static void createGLJournal(Args _args)
{
AxLedgerJournalTable journalTable; // class
AxLedgerJournalTrans journalTrans; // class
container acctPattern;
container offSetAcctPattern;
MainAccountNum mainAccount;
MainAccountNum OffmainAccount ;
LedgerJournalTable ledgerJournalTable; // table
ledgerJournalCheckPost ledgerJournalCheckPost;// table
LedgerAccountContract ledgerAccountContract,OffledgerAccountContract; //ModifiedBy
str costcenter,department,assetcode,customer,description;
DimensionAttributeValueContract attributeValueContract;
DimensionStorage DimensionStorage;
Amount amountCurDebit,amountCurCredit;
mainAccount = "110110"; //IntegPostingProf.RentalRevenue;//
OffmainAccount = "USA OPER"; //401100 IntegPostingProf.Revenue;
/*costcenter = dimensionMappingRg.DimValue;// Creating dimension for OffsetAcc
department = dimensionMappingBr.DimValue;
assetcode = RentalRevenueStagingTable.AssetCode;
customer = RentalRevenueStagingTable.AccountNum;//
;
*/
journalTable = new AxLedgerJournalTable();
journalTrans = new AxLedgerJournalTrans();
//Journal Name
journalTable.parmJournalName("GenJrn");
journalTable.save();
journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum);
journalTrans.parmTransDate(systemDateGet());
journalTrans.parmCurrencyCode("USD");
journalTrans.parmAmountCurDebit(1200);
journalTrans.parmAccountType(LedgerJournalACType::Vend);
journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum);//
//AccountNum
ledgerAccountContract = new LedgerAccountContract();
ledgerAccountContract.parmValues(new List(Types::Class));
ledgerAccountContract.parmMainAccount(mainAccount);
if (department)
{
attributeValueContract = new DimensionAttributeValueContract();
attributeValueContract.parmName("@SYS850");
attributeValueContract.parmValue(department);
ledgerAccountContract.parmValues().addEnd(attributeValueContract);
}
if (costcenter)
{
attributeValueContract = new DimensionAttributeValueContract();
attributeValueContract.parmName("@SYS343410");
attributeValueContract.parmValue(costcenter);
ledgerAccountContract.parmValues().addEnd(attributeValueContract);
}
if (assetcode)
{
attributeValueContract = new DimensionAttributeValueContract();
attributeValueContract.parmName("@SYS343374");
attributeValueContract.parmValue(assetcode);
ledgerAccountContract.parmValues().addEnd(attributeValueContract);
}
if (customer)
{
attributeValueContract = new DimensionAttributeValueContract();
attributeValueContract.parmName("Customer");
attributeValueContract.parmValue(customer);
ledgerAccountContract.parmValues().addEnd(attributeValueContract);
}
dimensionStorage = DimensionServiceProvider::buildDimensionStorageForLedgerAccount(ledgerAccountContract);//
journalTrans.parmLedgerDimension(dimensionStorage.save());
//-------------------------------------
//OffsetAccount
OffledgerAccountContract = new LedgerAccountContract();
OffledgerAccountContract.parmValues(new List(Types::Class));
OffledgerAccountContract.parmMainAccount(OffmainAccount);
if (department)
{
attributeValueContract = new DimensionAttributeValueContract();
attributeValueContract.parmName("@SYS850");
attributeValueContract.parmValue(department);
OffledgerAccountContract.parmValues().addEnd(attributeValueContract);
}
if (costcenter)
{
attributeValueContract = new DimensionAttributeValueContract();
attributeValueContract.parmName("@SYS343410");
attributeValueContract.parmValue(costcenter);
OffledgerAccountContract.parmValues().addEnd(attributeValueContract);
}
if (assetcode)
{
attributeValueContract = new DimensionAttributeValueContract();
attributeValueContract.parmName("@SYS343374");
attributeValueContract.parmValue(assetcode);
OffledgerAccountContract.parmValues().addEnd(attributeValueContract);
}
if (customer)
{
attributeValueContract = new DimensionAttributeValueContract();
attributeValueContract.parmName("Customer");
attributeValueContract.parmValue(customer);
OffledgerAccountContract.parmValues().addEnd(attributeValueContract);
}
//dimensionStorage = DimensionServiceProvider::(OffledgerAccountContract);
journalTrans.parmOffsetAccountType(LedgerJournalACType::Bank);
journalTrans.parmOffsetLedgerDimension(dimensionStorage.save());
journalTrans.save();
/*
journalTrans.parmOffsetAccountType(LedgerJournalACType:: Ledger );
//journalTrans.parmOffsetLedgerDimension( = "401100";
offSetAcctPattern = ["401100-Disp","401100", 0];//,"BusinessUnit", "10", "Department","800","CostCenter", "07","CustomerGroup","10" ];
journalTrans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId(offSetAcctPattern));
journalTrans.save(); */
info(strFmt("Journal %1 created", journalTable.ledgerJournalTable().JournalNum));
/*ledgerJournalCheckPost = ledgerJournalCheckPost::newLedgerJournalTable(journalTable.ledgerJournalTable(),NoYes::Yes);
ledgerJournalCheckPost.run();
info(strFmt("Journal No. %1.", journalTable.ledgerJournalTable().JournalNum)); */
}
{
AxLedgerJournalTable journalTable; // class
AxLedgerJournalTrans journalTrans; // class
container acctPattern;
container offSetAcctPattern;
MainAccountNum mainAccount;
MainAccountNum OffmainAccount ;
LedgerJournalTable ledgerJournalTable; // table
ledgerJournalCheckPost ledgerJournalCheckPost;// table
LedgerAccountContract ledgerAccountContract,OffledgerAccountContract; //ModifiedBy
str costcenter,department,assetcode,customer,description;
DimensionAttributeValueContract attributeValueContract;
DimensionStorage DimensionStorage;
Amount amountCurDebit,amountCurCredit;
mainAccount = "110110"; //IntegPostingProf.RentalRevenue;//
OffmainAccount = "USA OPER"; //401100 IntegPostingProf.Revenue;
/*costcenter = dimensionMappingRg.DimValue;// Creating dimension for OffsetAcc
department = dimensionMappingBr.DimValue;
assetcode = RentalRevenueStagingTable.AssetCode;
customer = RentalRevenueStagingTable.AccountNum;//
;
*/
journalTable = new AxLedgerJournalTable();
journalTrans = new AxLedgerJournalTrans();
//Journal Name
journalTable.parmJournalName("GenJrn");
journalTable.save();
journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum);
journalTrans.parmTransDate(systemDateGet());
journalTrans.parmCurrencyCode("USD");
journalTrans.parmAmountCurDebit(1200);
journalTrans.parmAccountType(LedgerJournalACType::Vend);
journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum);//
//AccountNum
ledgerAccountContract = new LedgerAccountContract();
ledgerAccountContract.parmValues(new List(Types::Class));
ledgerAccountContract.parmMainAccount(mainAccount);
if (department)
{
attributeValueContract = new DimensionAttributeValueContract();
attributeValueContract.parmName("@SYS850");
attributeValueContract.parmValue(department);
ledgerAccountContract.parmValues().addEnd(attributeValueContract);
}
if (costcenter)
{
attributeValueContract = new DimensionAttributeValueContract();
attributeValueContract.parmName("@SYS343410");
attributeValueContract.parmValue(costcenter);
ledgerAccountContract.parmValues().addEnd(attributeValueContract);
}
if (assetcode)
{
attributeValueContract = new DimensionAttributeValueContract();
attributeValueContract.parmName("@SYS343374");
attributeValueContract.parmValue(assetcode);
ledgerAccountContract.parmValues().addEnd(attributeValueContract);
}
if (customer)
{
attributeValueContract = new DimensionAttributeValueContract();
attributeValueContract.parmName("Customer");
attributeValueContract.parmValue(customer);
ledgerAccountContract.parmValues().addEnd(attributeValueContract);
}
dimensionStorage = DimensionServiceProvider::buildDimensionStorageForLedgerAccount(ledgerAccountContract);//
journalTrans.parmLedgerDimension(dimensionStorage.save());
//-------------------------------------
//OffsetAccount
OffledgerAccountContract = new LedgerAccountContract();
OffledgerAccountContract.parmValues(new List(Types::Class));
OffledgerAccountContract.parmMainAccount(OffmainAccount);
if (department)
{
attributeValueContract = new DimensionAttributeValueContract();
attributeValueContract.parmName("@SYS850");
attributeValueContract.parmValue(department);
OffledgerAccountContract.parmValues().addEnd(attributeValueContract);
}
if (costcenter)
{
attributeValueContract = new DimensionAttributeValueContract();
attributeValueContract.parmName("@SYS343410");
attributeValueContract.parmValue(costcenter);
OffledgerAccountContract.parmValues().addEnd(attributeValueContract);
}
if (assetcode)
{
attributeValueContract = new DimensionAttributeValueContract();
attributeValueContract.parmName("@SYS343374");
attributeValueContract.parmValue(assetcode);
OffledgerAccountContract.parmValues().addEnd(attributeValueContract);
}
if (customer)
{
attributeValueContract = new DimensionAttributeValueContract();
attributeValueContract.parmName("Customer");
attributeValueContract.parmValue(customer);
OffledgerAccountContract.parmValues().addEnd(attributeValueContract);
}
//dimensionStorage = DimensionServiceProvider::(OffledgerAccountContract);
journalTrans.parmOffsetAccountType(LedgerJournalACType::Bank);
journalTrans.parmOffsetLedgerDimension(dimensionStorage.save());
journalTrans.save();
/*
journalTrans.parmOffsetAccountType(LedgerJournalACType:: Ledger );
//journalTrans.parmOffsetLedgerDimension( = "401100";
offSetAcctPattern = ["401100-Disp","401100", 0];//,"BusinessUnit", "10", "Department","800","CostCenter", "07","CustomerGroup","10" ];
journalTrans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId(offSetAcctPattern));
journalTrans.save(); */
info(strFmt("Journal %1 created", journalTable.ledgerJournalTable().JournalNum));
/*ledgerJournalCheckPost = ledgerJournalCheckPost::newLedgerJournalTable(journalTable.ledgerJournalTable(),NoYes::Yes);
ledgerJournalCheckPost.run();
info(strFmt("Journal No. %1.", journalTable.ledgerJournalTable().JournalNum)); */
}
No comments:
Post a Comment