Показать сообщение отдельно
Старый 11.12.2007, 14:54   #17  
UNRW is offline
UNRW
Участник
 
383 / 67 (3) ++++
Регистрация: 16.09.2004
Адрес: Москва
оказалось косяпта лажается на строках
X++:
                                  vendLedgerAccounts.AccountCode    == TableGroupAll::Table
                               && vendLedgerAccounts.Num            == vendTrans.AccountNum
vendLedgerAccounts.Num
vendTrans.AccountNum

имеют выравнивания строки Left и Right

и SQL сервер не находит совпадений


можно попробовать так:
X++:
                                  vendLedgerAccounts.AccountCode    == TableGroupAll::Table
                               && vendLedgerAccounts.Num           like vendTrans.AccountNum
правда like в этом запросе не гуд
надо бы сделать LTRIM для обоих полей (Аксапта не умеет так делать), но тем не менее:
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            like 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));

}

Последний раз редактировалось UNRW; 11.12.2007 в 14:57.