static void Na_ProjContractDimension(Args _args)
{
DimensionAttributeValue dimAtrrProjValue;
DimensionAttribute dimAtrrProj;
DimensionAttributeValueSetStorage davss;
RecId defaultDimension;
VendTable vendtable;
container defaultdimension1;
ProjTable projTable,projTable1;
ProjFundingSource projFundingSource;
ProjInvoiceTable projInvoiceTable;
int updatecount;
try
{
select forUpdate projFundingSource join projInvoiceTable where projFundingSource.ContractId == projInvoiceTable.ProjInvoiceProjId
join projTable where projInvoiceTable.ProjInvoiceProjId == projTable.ProjInvoiceProjId
{
select count(RecId) from projTable1 where projTable1.ProjInvoiceProjId == projFundingSource.ContractId;
if(projTable1.RecId == 1)
{
if(projFundingSource.ContractId)
{
davss = DimensionAttributeValueSetStorage::find(projTable::find(projTable.ProjId).DefaultDimension);
dimAtrrProj = DimensionAttribute::findByName('Project');
dimAtrrProjValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAtrrProj, ProjTable.ProjId, false, true);
if(dimAtrrProjValue)
{
davss.addItem(dimAtrrProjValue);
ttsBegin;
projFundingSource.DefaultDimension = davss.save();
projFundingSource.selectForUpdate(true);
projFundingSource.doUpdate();
ttsCommit;
}
}
updatecount++;
}
else
{
info(strFmt("contractid--%1 , projid--%2",projFundingSource.ContractId,projTable.ProjId,projTable1.ProjId));
}
}
}
catch(Exception::Error)
{
info(strFmt("%1", projFundingSource.ContractId));
}
info("successfully completed");
Box::info(strFmt("%1 Records updated ",updatecount));
}
{
DimensionAttributeValue dimAtrrProjValue;
DimensionAttribute dimAtrrProj;
DimensionAttributeValueSetStorage davss;
RecId defaultDimension;
VendTable vendtable;
container defaultdimension1;
ProjTable projTable,projTable1;
ProjFundingSource projFundingSource;
ProjInvoiceTable projInvoiceTable;
int updatecount;
try
{
select forUpdate projFundingSource join projInvoiceTable where projFundingSource.ContractId == projInvoiceTable.ProjInvoiceProjId
join projTable where projInvoiceTable.ProjInvoiceProjId == projTable.ProjInvoiceProjId
{
select count(RecId) from projTable1 where projTable1.ProjInvoiceProjId == projFundingSource.ContractId;
if(projTable1.RecId == 1)
{
if(projFundingSource.ContractId)
{
davss = DimensionAttributeValueSetStorage::find(projTable::find(projTable.ProjId).DefaultDimension);
dimAtrrProj = DimensionAttribute::findByName('Project');
dimAtrrProjValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAtrrProj, ProjTable.ProjId, false, true);
if(dimAtrrProjValue)
{
davss.addItem(dimAtrrProjValue);
ttsBegin;
projFundingSource.DefaultDimension = davss.save();
projFundingSource.selectForUpdate(true);
projFundingSource.doUpdate();
ttsCommit;
}
}
updatecount++;
}
else
{
info(strFmt("contractid--%1 , projid--%2",projFundingSource.ContractId,projTable.ProjId,projTable1.ProjId));
}
}
}
catch(Exception::Error)
{
info(strFmt("%1", projFundingSource.ContractId));
}
info("successfully completed");
Box::info(strFmt("%1 Records updated ",updatecount));
}
No comments:
Post a Comment