Hi
from my LedgerTransVoucher I will do following:
- Select all records where SubledgerVoucher starts with 'fb-' and LedgerAccount starts with '2'.
- Select the sum(AccountingCurrencyAmount) where ProjectID (in LedgerDimension) == '214667'
- I have made this job to test the functionality. But I dont get any value. It seems that I never get any ProjId.
- What is it that do wrong?

static void NCExpensed(Args _args)
{
GeneralJournalAccountEntry generalJournalAccountEntry, generalJournalAccountEntryLocal;
GeneralJournalEntry generalJournalEntry;
ProjId projId;
MainAccount mainAccount;
str mainAccountId, subLedgerVoucher;
real expensed;
while select generalJournalAccountEntry
join generalJournalEntry
where generalJournalAccountEntry.GeneralJournalEntry == generalJournalEntry.RecId
{
projId = ProjTable::findByLedgerDimension(generalJournalAccountEntry.LedgerDimension).ProjId;
mainAccount = MainAccount::findByLedgerDimension(generalJournalAccountEntry.LedgerDimension);
mainAccountId = subStr(mainAccount.MainAccountId,1,1);
subLedgerVoucher = subStr(generalJournalEntry.SubledgerVoucher,1,2);
if(mainAccountId == '2' && subLedgerVoucher == 'fb' && projId == '214667')
{
select sum(AccountingCurrencyAmount) from generalJournalAccountEntryLocal;
expensed = generalJournalAccountEntryLocal.AccountingCurrencyAmount;
}
}
if(expensed)
{
info(strFmt('%1', expensed));
}
}
*This post is locked for comments
I have the same question (0)