static void createRentalRevenueJournal()
{
NumberSequenceTable numberSequenceTable;
Voucher voucher;
Amount amountCurDebit,amountCurCredit;
AxLedgerJournalTrans trans = new AxLedgerJournalTrans();
AxLedgerJournalTable header ;//= new AxLedgerJournalTable();
str costcenter,department,assetcode,customer,description,IntegPostingProf;
DimensionStorage DimensionStorage;
LedgerJournalNameId LedgerJournalNameId;
AX_CustomerPaymentsStagingTable_IN RentalRevenueStagingTable;
CurrencyCode currencycode;
TransDate TransDate = today();
args args;
LedgerAccountContract ledgerAccountContract,OffledgerAccountContract;
MainAccountNum mainAccount;
mainAccountNum OffmainAccount ;
DimensionAttributeValueContract attributeValueContract;
DimensionMapping dimensionMappingRg,dimensionMappingBr;
LedgerJournalCheckPost ledgerJournalCheckPost;
boolean errorCheck;
CustomerPaymentsRefunds customerPaymentsRefunds;
numberSequenceTable = NumberSequenceTable::find(LedgerJournalName::find(LedgerJournalNameId).NumberSequenceTable);
voucher = NumberSeq::newGetVoucherFromCode(numberSequenceTable.NumberSequence).voucher();
amountCurDebit = 0;
amountCurCredit = 0;
description = "Accrual Revenue";
currencycode = CompanyInfo::standardCurrency();
amountCurDebit = RentalRevenueStagingTable.Amount;
amountCurCredit = 0;
mainAccount = IntegPostingProf.RentalRevenue;
OffmainAccount = IntegPostingProf.Revenue;
costcenter = dimensionMappingRg.DimValue;
department = dimensionMappingBr.DimValue;
assetcode = RentalRevenueStagingTable.AssetCode;
customer = RentalRevenueStagingTable.AccountNum;
trans.parmJournalNum(header.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);
trans.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::buildDimensionStorageForLedgerAccount(OffledgerAccountContract);
trans.parmOffsetLedgerDimension(dimensionStorage.save());
//------------------------------------
trans.parmTxt(description);
trans.parmDocumentDate(RentalRevenueStagingTable.Date);
trans.parmTransDate(RentalRevenueStagingTable.Date);
trans.parmAmountCurDebit(AmountCurDebit);
trans.parmAmountCurCredit(AmountCurCredit) ;
trans.parmCompany(curext());
trans.parmCurrencyCode(currencycode);
trans.parmVoucher(voucher);
trans.parmExchRate(1);
// Customized fields
trans.parmKRContractNo(RentalRevenueStagingTable.KR_ContractNo);
trans.parmKRCustomerCode(RentalRevenueStagingTable.KR_CustomerCode);
trans.parmKRCustomerName(RentalRevenueStagingTable.KR_CustomerName);
trans.parmKROperationalActivity(RentalRevenueStagingTable.KR_OperationalActivity);
trans.parmKRRevenueType(RentalRevenueStagingTable.KR_TypeId);
trans.parmKRContractstatus(RentalRevenueStagingTable.ContractStatus);
trans.parmKRInvoiceNo(RentalRevenueStagingTable.KR_InvoiceNumber);
// Customized fields
trans.currentRecord().insert();
trans.save();
//ledgerJournalCheckPost= ledgerJournalCheckPost::newLedgerJournalTable(header.ledgerJournalTable(),NoYes::Yes);
//ledgerJournalCheckPost.run();
// create Free text invoice
ttsCommit;
}
next RentalRevenueStagingTable;
}
}
{
NumberSequenceTable numberSequenceTable;
Voucher voucher;
Amount amountCurDebit,amountCurCredit;
AxLedgerJournalTrans trans = new AxLedgerJournalTrans();
AxLedgerJournalTable header ;//= new AxLedgerJournalTable();
str costcenter,department,assetcode,customer,description,IntegPostingProf;
DimensionStorage DimensionStorage;
LedgerJournalNameId LedgerJournalNameId;
AX_CustomerPaymentsStagingTable_IN RentalRevenueStagingTable;
CurrencyCode currencycode;
TransDate TransDate = today();
args args;
LedgerAccountContract ledgerAccountContract,OffledgerAccountContract;
MainAccountNum mainAccount;
mainAccountNum OffmainAccount ;
DimensionAttributeValueContract attributeValueContract;
DimensionMapping dimensionMappingRg,dimensionMappingBr;
LedgerJournalCheckPost ledgerJournalCheckPost;
boolean errorCheck;
CustomerPaymentsRefunds customerPaymentsRefunds;
numberSequenceTable = NumberSequenceTable::find(LedgerJournalName::find(LedgerJournalNameId).NumberSequenceTable);
voucher = NumberSeq::newGetVoucherFromCode(numberSequenceTable.NumberSequence).voucher();
amountCurDebit = 0;
amountCurCredit = 0;
description = "Accrual Revenue";
currencycode = CompanyInfo::standardCurrency();
amountCurDebit = RentalRevenueStagingTable.Amount;
amountCurCredit = 0;
mainAccount = IntegPostingProf.RentalRevenue;
OffmainAccount = IntegPostingProf.Revenue;
costcenter = dimensionMappingRg.DimValue;
department = dimensionMappingBr.DimValue;
assetcode = RentalRevenueStagingTable.AssetCode;
customer = RentalRevenueStagingTable.AccountNum;
trans.parmJournalNum(header.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);
trans.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::buildDimensionStorageForLedgerAccount(OffledgerAccountContract);
trans.parmOffsetLedgerDimension(dimensionStorage.save());
//------------------------------------
trans.parmTxt(description);
trans.parmDocumentDate(RentalRevenueStagingTable.Date);
trans.parmTransDate(RentalRevenueStagingTable.Date);
trans.parmAmountCurDebit(AmountCurDebit);
trans.parmAmountCurCredit(AmountCurCredit) ;
trans.parmCompany(curext());
trans.parmCurrencyCode(currencycode);
trans.parmVoucher(voucher);
trans.parmExchRate(1);
// Customized fields
trans.parmKRContractNo(RentalRevenueStagingTable.KR_ContractNo);
trans.parmKRCustomerCode(RentalRevenueStagingTable.KR_CustomerCode);
trans.parmKRCustomerName(RentalRevenueStagingTable.KR_CustomerName);
trans.parmKROperationalActivity(RentalRevenueStagingTable.KR_OperationalActivity);
trans.parmKRRevenueType(RentalRevenueStagingTable.KR_TypeId);
trans.parmKRContractstatus(RentalRevenueStagingTable.ContractStatus);
trans.parmKRInvoiceNo(RentalRevenueStagingTable.KR_InvoiceNumber);
// Customized fields
trans.currentRecord().insert();
trans.save();
//ledgerJournalCheckPost= ledgerJournalCheckPost::newLedgerJournalTable(header.ledgerJournalTable(),NoYes::Yes);
//ledgerJournalCheckPost.run();
// create Free text invoice
ttsCommit;
}
next RentalRevenueStagingTable;
}
}
No comments:
Post a Comment