Display vendor account on LedgerTransPreview_RU report

Hi,

LedgerTransPreview_RU form is used to view the voucher transaction against ledger general before posting and we can also print report from this form report name LedgerTransPreview_RU ssrs report. in this report we can see the voucher transactions and can see the DimensionDisplayValue. I need to customized the this report for example if i have general ledger with this transaction

and i open the ledgerTransPreview_RU Form it will look like this

Now the report is running on TmpLedgerTransPreview_RU table in query as well

In form we can see the Voucher Transaction and DimensionDisplayValue i need to show the Vendor Account against this DimensionDisplayValue.

After Posting we can get the vendor account from VendTrans but before posting as we have not posted yet voucher thats why we does not have transaction in vendtrans.

How can i display vendor account if i have DimensionDisplayValue ?

You can use \Classes\DimensionStorage\ledgerDimension2AccountNum to get the Vendor account from LedgerDimension

Hi Kranthi,

I dont have ledgerDimension i only have DimensionDisplayValue.

I am doing like this.

if(_ledgerTransPreviewLocal.PostingType == LedgerPostingType::VendBalance)
{

select* from ledgertrans
where ledgertrans.Voucher == _ledgerTransPreviewLocal.Voucher
&& ((ledgertrans.AmountCurDebit == _ledgerTransPreviewLocal.AmountCur && ledgertrans.AmountCurCredit == 0)
||(ledgertrans.AmountCurDebit == -1*(_ledgerTransPreviewLocal.AmountCur) && ledgertrans.AmountCurCredit == 0)
|| (ledgertrans.AmountCurDebit == 0 && ledgertrans.AmountCurCredit == -1*( _ledgerTransPreviewLocal.AmountCur))
|| (ledgertrans.AmountCurDebit == 0 && ledgertrans.AmountCurCredit == 0))
&& (ledgertrans.OffsetAccountType == LedgerJournalACType::Vend || ledgertrans.AccountType == LedgerJournalACType::Vend);

if(ledgertrans.OffsetAccountType == LedgerJournalACType::Vend)
{
select * from dimensionAttributeValueCombination
where dimensionAttributeValueCombination.RecId == ledgertrans.OffsetLedgerDimension;
}
else if(ledgertrans.AccountType == LedgerJournalACType::Vend)
{
select * from dimensionAttributeValueCombination
where dimensionAttributeValueCombination.RecId == ledgertrans.LedgerDimension;
}

ledgerTransPreviewTmp_RU.TransDimensionDisplayValue = dimensionAttributeValueCombination.DisplayValue;

But this is failed in scenerio pastedimage1522239161334v1.png

if both account type and offsetaccounttype is vend.

Not sure what you are trying to do? Can you explain?

TransDimensionDisplayValue - what do you want to show in this field if both account type and offset account type are vendor?

I just want to know if i have DimensionDisplayValue like 521110… can i get the vendor account.

see in this below image i have only display value in voucher transaction

pastedimage1522239499481v1.png

You use existing method, DimensionAttributeValueCombination::getDisplayValue(ledgertrans.LedgerDimension);

It may not be a good idea to get the vendor account from display value rather you need to try to get it from LedgerDimension or offserLedgerDimension.

Event the display value is found by using the LedgerDimension

It only giving me Vendor Account BB001 in both lines when i print report

Kranthi read the class LedgerTransPreviewDP_RU understand the insetledgertranspreview method of code then suggest me the way how can i get the vendor account

As i dont have one to one relation with ledgerJournalTrans

What does the report shows? Does it shows two lines for a single ledger journal trans record? Can you put a screen shot?

inserLedgerTransPreviewTmp_RU method has LedgerJournalTrans as parameter.

here is the report screen shot it show same vendor account in both transactions

Based on the amount you may need get the either the ledgerDimension or offsetLedgerDimension.

Example code if you have both account and offset account on a journal line.

if (_ledgerJournalTrans.LedgerDimension && _ledgerJournalTrans.OffsetLedgerDimension)
    {
        if (_ledgerTransPreviewLocal.AmountMST > 0)
        {
            if (_ledgerJournalTrans.AmountCurDebit)
            {
                info('Take account');
            }
            else
            {
                info('Take offset');
            }
        }

        if (_ledgerTransPreviewLocal.AmountMST < 0)
        {
            if (_ledgerJournalTrans.AmountCurDebit)
            {
                info('Take offset account');
            }
            else
            {
                info('Take account');
            }
        }
    }

Hi Kranthi,

Thanks for your response this code will work if i have value in _ledgerjournalTrans but in showTrans case ledgerJournalTrans parameter value is null see the code in processReport

///


/// Processes the report business logic.
///

[SysEntryPointAttribute]
public void processReport()
{
int counter;
LedgerJournalTrans ledgerJournalTrans;
TmpLedgerTransPreview_RU ledgerTransPreviewLocal,tmpledgertranspreview;
LedgerJournalTable ledgerJournalTable;
SRSReportRunPermission permission;
boolean showJournal;
boolean showTrans;
recId tmpTableDataRecId;
Voucher voucher;
TransDate transDate;
QueryRun qr;
LedgerTransPreviewContract_RU contract = this.parmDataContract() as LedgerTransPreviewContract_RU;
tmpTableDataRecId = contract.parmTmpTableDataRecId();
permission = new SRSReportRunPermission();
permission.assert();
ledgerTransPreviewLocal = SRSTmpTblMarshaller::getTmpTbl(tmpTableDataRecId);
SRSTmpTblMarshaller::deleteTmpTblData(tmpTableDataRecId);
CodeAccessPermission::revertAssert();

showJournal = contract.parmShowJournal();
showTrans = contract.parmShowTrans();
mainAccountsOnly = contract.parmMainAccountsOnly();

ledgerJournalTable = LedgerJournalTable::find(ledgerTransPreviewLocal.JournalNumber);
qr = new QueryRun(this.parmQuery());
qr.setCursor(ledgerTransPreviewLocal);
while(qr.next())
{
ledgerTransPreviewLocal = qr.get(tableNum(TmpLedgerTransPreview_RU));
if (voucher != ledgerTransPreviewLocal.Voucher ||
transDate != ledgerTransPreviewLocal.TransDate)
{
if (voucher)
{
if (showTrans)
{
amountMST = 0;
amountCur = 0;
amountMSTSecondary = 0;
}
}
if (showJournal)
{
amountCurCredit = 0;
amountCurDebit = 0;

while select ledgerJournalTrans
where ledgerJournalTrans.Voucher == ledgerTransPreviewLocal.Voucher &&
ledgerJournalTrans.TransDate == ledgerTransPreviewLocal.TransDate
{

amountCurCredit = ledgerJournalTrans.AmountCurCredit;
amountCurDebit = ledgerJournalTrans.AmountCurDebit;
this.inserLedgerTransPreviewTmp_RU(true, ledgerJournalTrans, ledgerTransPreviewLocal, ledgerJournalTable);
}
}

voucher = ledgerTransPreviewLocal.Voucher;
transDate = ledgerTransPreviewLocal.TransDate;
}

if (showTrans)
{

amountMST = ledgerTransPreviewLocal.AmountMST;

amountCur = ledgerTransPreviewLocal.AmountCur;
amountMSTSecondary = ledgerTransPreviewLocal.AmountMSTSecond;

this.inserLedgerTransPreviewTmp_RU(false, null, ledgerTransPreviewLocal, ledgerJournalTable);

}
}
}

In that case it may not be possible to get the vendor account. You can fetch the ledgerJournalTrans by using the voucher and date. It may not be accurate in all the cases (if there are multiple lines per voucher), but you can give a try.

The data in this table is inserted from GeneralJournalAccountEntry which doesn’t have any information of the ledgerJournalTrans or its related ledger dimension (vendor).

Yes Thanks for your help