вот так работает сцуко быстро
X++:
static void DK_vendSaldoByProfiles(Args _args)
{
VendLedgerAccounts vendLedgerAccounts;
VendTrans vendTrans;
VendTable vendTable;
Amount bablosDeb;
Amount bablosCred;
TransDate transDate;
;
transDate = 30\09\2007;
while select vendTable
group by VendGroup
join sum (amountMst) from vendTrans
group by AccountNum
where
vendTrans.TransDate <= transDate
&& vendTrans.AccountNum == vendTable.AccountNum
join vendLedgerAccounts
where
vendLedgerAccounts.SumAccount == "60.02.0001"
&& vendLedgerAccounts.PostingProfile == vendTrans.PostingProfile
&& (
(
vendLedgerAccounts.AccountCode == TableGroupAll::Table
&& vendLedgerAccounts.Num == vendTrans.AccountNum
)
|| (
vendLedgerAccounts.AccountCode == TableGroupAll::GroupId
&& vendLedgerAccounts.Num == vendTable.VendGroup
)
||
(
vendLedgerAccounts.AccountCode == TableGroupAll::All
)
)
{
if (vendTrans.AmountMST > 0)
bablosDeb += vendTrans.AmountMST;
else
bablosCred += vendTrans.AmountMST;
}
info(strfmt("%1 %2 ", bablosDeb, bablosCred));
}
при условии что профиля и группы не менялись в настройках системы
даже должен условно правильный результат дать