Below is the to Code to meagre MainAccount Dimesion and Default Dimesion to get Ledger Dimension Account which is used in segmented while creating Journal voucher in LedgerJournalTrans
static void CreateLedgerDimension(Args _args)
{
LedgerDimensionAccount ledgerDimension,defaultDimension;
LedgerDimensionAccount empledgerdimension;
LedgerDimensionAccount mainAccDimension;
HcmPositionDefaultDimension (empPositionDimension
HcmPositionWorkerAssignment HcmPositionWorkerAssignment;
mainAccDimension = PayHeadTable::find('BasicRate').DebitAccount;
HcmPositionWorkerAssignment = HcmPositionWorkerAssignment::getActivePositionWorkerAssignment(HcmWorker::findByPersonnelNumber('PID-0937').RecId);
select empposdimension where empposdimension.Position == HcmPositionWorkerAssignment.Position;
if(empPositionDimension)
empledgerdimension = empPositionDimension.DefaultDimension;
defaultDimension = DimensionDefaultingService::serviceCreateLedgerDimension(mainAccDimension, empledgerdimension);
info(strFmt("Before: %1", DimensionAttributeValueCombination::find(defaultDimension).DisplayValue));
}
static void CreateLedgerDimension(Args _args)
{
LedgerDimensionAccount ledgerDimension,defaultDimension;
LedgerDimensionAccount empledgerdimension;
LedgerDimensionAccount mainAccDimension;
HcmPositionDefaultDimension (empPositionDimension
HcmPositionWorkerAssignment HcmPositionWorkerAssignment;
mainAccDimension = PayHeadTable::find('BasicRate').DebitAccount;
HcmPositionWorkerAssignment = HcmPositionWorkerAssignment::getActivePositionWorkerAssignment(HcmWorker::findByPersonnelNumber('PID-0937').RecId);
select empposdimension where empposdimension.Position == HcmPositionWorkerAssignment.Position;
if(empPositionDimension)
empledgerdimension = empPositionDimension.DefaultDimension;
defaultDimension = DimensionDefaultingService::serviceCreateLedgerDimension(mainAccDimension, empledgerdimension);
info(strFmt("Before: %1", DimensionAttributeValueCombination::find(defaultDimension).DisplayValue));
}
No comments:
Post a Comment