Цитата:
Сообщение от
zelen
В таблицах Cust\VendTrans есть поле LedgerAccount, в которое при разноске операций пишется счет ГК из профиля разноски.
В моей версии АХ 4.0 sp 2 таких полей нет.
Novic, да, Вы правы, случаются случаи, что одному счету ГК соответствуют несколько профилей разноски, тогда нужно делать так:
X++:
while select PostingProfile from custLedgerAccounts group by PostingProfile
where custLedgerAccounts.SumAccount == ledgerAccount
{
select sum(AmountMST) from custTrans
where custTrans.AccountNum == custTable.AccountNum
&& custTrans.TransDate <= toDate
&& custTrans.PostingProfile == custLedgerAccounts.PostingProfile
exists join ledgerTrans
where ledgerTrans.AccountNum == ledgerAccount
&& ledgerTrans.Voucher == custTrans.Voucher
&& ledgerTrans.TransDate == custTrans.TransDate;
custAmountMST += custTrans.AmountMST;
}