Показать сообщение отдельно
Старый 25.09.2010, 15:19   #1  
Wamr is offline
Wamr
----------------
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
 
1,737 / 868 (32) +++++++
Регистрация: 15.01.2002
Адрес: Москва
Записей в блоге: 7
CustVendSettle просмотр кода
DAX 2009 RU 5
просматривал код и возникли вопросы
- метод settleNow
строка 552 и далее
X++:
            if (!areDebitsDone && custVendTransDebit.AmountCur != 0)
            {
                //find the offset to the custVendTransDebet still open
                select firstonly custVendTransCredit order by RecId desc
                where custVendTransCredit.RecId == custVendTransDebit.OffsetRecId;

                this.setStillOpenValues(custVendTransDebit,
                    custVendTransOpenDebit.RecId,
                    specTransDebit.Balance01,
                    custVendTransCredit.Dimension,
                    debitTransState);
            }

            if (!areCreditsDone && custVendTransCredit.AmountCur != 0)
            {
                this.setStillOpenValues(custVendTransCredit,
                    custVendTransOpenCredit.RecId,
                    specTransCredit.Balance01,
                    custVendTransCredit.Dimension,
                    debitTransState); // ???
            }
почему (или зачем) при сохранении кредитовой проводки с ней идет состояние дебетовой?

- метод processStillOpenTransactions
Делается цикл по еще открытым проводкам.
X++:
    for (currentIndex = stillOpenIndex; currentIndex > 0; currentIndex--)
    {
        // Find over/under amount for the company
        currentCompany = stillOpenCompany[stillOpenIndex];
        changecompany(currentCompany)
        {
            // There can be multiple transactions per company in the index, but we only want to
            // process each company once for over/under taxes.  Will use set called companiesWithTaxProccesed
            // and if company is already in the set this is indication that taxes where already calculated
            // and shouldn't be calculated again.
            if (companiesWithTaxProcessed.in(currentCompany))
            {
                calcTaxForCompany = false;
            }
            else
...
Здесь каждый раз берется код компании для проводки с индексом stillOpenIndex, который не меняется. Надо либо changeCompany вынести из цикла, либо все-таки брать компанию для currentIndex .

- метод processStillOpenTransactions
объявлена переменная isCrossCompany.
Единственный раз ее значение меняется в цикле по проводкам. То есть, с какого-то момента все последуюшие проводки обрабатывются с признаком isCrossCompany = true, независимо от данных в самих проводках.
Это такая задумка или недодумка?

Последний раз редактировалось Wamr; 25.09.2010 в 15:51.
За это сообщение автора поблагодарили: kashperuk (5), Logger (3), ziva (2), MikeR (4), gl00mie (5).