Показать сообщение отдельно
Старый 18.07.2013, 21:28   #8  
db is offline
db
Роман Долгополов (RDOL)
Лучший по профессии 2015
Лучший по профессии AXAWARD 2013
 
393 / 692 (24) +++++++
Регистрация: 01.04.2004
Адрес: Москва
Если кому еще интересно, то проблема проявляется если по любым причинам (не обязательно отсутствие пересекающихся кодов) сумма налога получается равной 0.
Исправленный метод \Classes\CustVendPrepaymentHandling_W\postVATAmount

X++:
private void postVATAmount()
{
    LedgerBondClient_RU      ledgerBondClient;
    TaxLedgerJournal         tax;
    TaxAmount                taxAmount;
    LedgerVoucherTransObject ledgerVoucherTransObject;
    TaxWorkRegulation        taxWorkRegulation;
    TmpTaxWorkTrans          tmpTaxWorkTrans;
    ;

    ledgerVoucherObject.parmCorrection(custVendTrans.Correct);
    ledgerBondClient = ledgerVoucherObject.ledgerBondClient_RU();

    while select ledgerJournalTrans
        where ledgerJournalTrans.TaxGroup        &&
              ledgerJournalTrans.TaxItemGroup    &&
             (ledgerJournalTrans.AmountCurCredit ||
              ledgerJournalTrans.AmountCurDebit)
    {
        update_recordset taxWorkRegulation
            setting HeadingRecId = newCustVendTrans.RecId
            where taxWorkRegulation.HeadingRecId == ledgerJournalTrans.RecId;

        ledgerJournalTrans.RecId      = 0;
        ledgerJournalTrans.JournalNum = '';

        if (ledgerBondClient)
        {
            ledgerBondClient.addNewLogObject();
        }

        tax = TaxLedgerJournal::construct(TaxJournalCall::Journal,
                                          ledgerJournalTrans,
                                          null,
                                          ledgerVoucher,
                                          newCustVendTrans.RecId,
                                          UnknownNoYes::Yes);

        taxAmount = tax.calcAndPost();

        if(taxAmount)
        {
            tmpTaxWorkTrans = tax.tmpTaxWorkTrans();
            while select tmpTaxWorkTrans
            {
                tmpTaxWorkTrans.TransDate       = transDate;
                tmpTaxWorkTrans.update();

                tax.saveAndPost(exchRate, exchRateSecond, tmpTaxWorkTrans);
            }

            ledgerVoucherTransObject = LedgerVoucherTransObject::newCreateTrans(ledgerVoucherObject,
                                                                                this.ledgerPostingTypePayment(),
                                                                                this.vatPrepaymentsAccount(newCustVendTrans),
                                                                                newCustVendTrans.Dimension,
                                                                                newCustVendTrans.CurrencyCode,
                                                                                -taxAmount,
                                                                                newCustVendTrans.TableId,
                                                                                newCustVendTrans.RecId,
                                                                                0,
                                                                                exchRate,
                                                                                exchRateSecond);

            ledgerVoucher.addTrans(ledgerVoucherTransObject);

            if (ledgerBondClient)
            {
                ledgerBondClient.bondLastVRef2CurrentLog();
                ledgerBondClient.removeCurrentLogObject();
            }
        }
    }
}
2009 SP1 RU8