Показать сообщение отдельно
Старый 04.12.2007, 13:06   #4  
Silence is offline
Silence
Участник
Аватар для Silence
 
287 / 27 (1) +++
Регистрация: 29.09.2004
Адрес: г. Москва, Зеленоград
Может так кто поможет?
Правильно ли следущее?
X++:
VendTrans checkVendTrans()
{
    VendLedgerAccounts  vendLedgerAccounts;
    ;

    while select vendTrans
        where vendTrans.TransDate <= toDate
        {
            select firstOnly SumAccount from vendLedgerAccounts
                    where vendLedgerAccounts.PostingProfile == vendTrans.PostingProfile
                       && vendLedgerAccounts.AccountCode    == TableGroupAll::Table
                       && vendLedgerAccounts.Num            == vendTrans.AccountNum;

            if (! vendLedgerAccounts.SumAccount)
            {
                select firstOnly SumAccount from vendLedgerAccounts
                    where vendLedgerAccounts.PostingProfile == vendTrans.PostingProfile
                       && vendLedgerAccounts.AccountCode    == TableGroupAll::GroupId
                       && vendLedgerAccounts.Num            == VendTable::find(vendTrans.AccountNum).VendGroup;
            }

            if (! vendLedgerAccounts.SumAccount)
            {
                select firstOnly SumAccount from vendLedgerAccounts
                    where vendLedgerAccounts.PostingProfile == vendTrans.PostingProfile
                       && vendLedgerAccounts.AccountCode    == TableGroupAll::All
                       && vendLedgerAccounts.SumAccount     == accountNum;
            }

            if (vendLedgerAccounts.SumAccount == accountNum)
                amountMST += vendTrans.AmountMST;
    }

    return vendTrans;
}
Такой запрос выдаёт тот же результат, что и запрос "Оборотно-сальдовая ведомость".
__________________
Бывает, что человек молчит, когда ничего не знает о данном предмете, но чаще – когда знает о нем все. (Джордж Бернард Шоу)

Последний раз редактировалось Silence; 04.12.2007 в 16:55.