Уважаемы гуру, прошу посмотрите код. Что в нем не так. Ну ни как не могу скорректировать налог ((. Выдает ошибку и все тут
.
X++:
switch (rDeferralsJournalTrans.DocumentStatus)
{
case DocumentStatus::Invoice :
purchFormLetter = PurchFormLetter::construct(DocumentStatus::Invoice);
break;
case DocumentStatus::Facture_RU :
purchFormLetter = PurchFormLetter::construct(DocumentStatus::Facture_RU);
break;
}
purchFormLetter.specQty(PurchUpdate::ReceiveNow);
purchParmTable.clear();
purchFormLetter.createParmTable(purchParmTable,purchTable);
purchParmTable.ParmId = purchFormLetter.parmId();
purchParmTable.TransDate = systemDateGet();
purchParmTable.DocumentDate = systemDateGet();
purchParmTable.Num = rDeferralsJournalTrans.DocumentNum;
purchParmTable.FactureExternalId_RU = rDeferralsJournalTrans.DocumentNum;
purchParmTable.insert();
purchFormLetter.createParmLine(purchLine);
ttsbegin;
select forupdate * from purchParmLine
where purchParmLine.OrigPurchId==rDeferralsJournalTrans.PurchId &&
purchParmLine.ParmId==purchFormLetter.parmId();
purchParmLine.initFromPurchLine(purchLine);
purchParmLine.initFromParmTable(purchParmTable);
purchParmLine.LineAmount=rDeferralsJournalTrans.AmountCur;
purchParmLine.update();
ttscommit;
purchFormLetter.createParmUpdate();
purchParmUpdate = purchFormLetter.purchParmUpdate();
purchParmUpdate.SumBy = AccountOrder::None;
purchParmUpdate.SpecQty = purchFormLetter.specQty();
purchParmUpdate.DocumentStatus = purchFormLetter.documentStatus();
purchParmUpdate.update();
purchFormLetter.purchParmUpdate(purchParmUpdate);
purchTotals = PurchTotals::construct(purchTable,
PurchUpdate::ReceiveNow,
AccountOrder::None,
purchFormLetter.parmId(),
purchTable.PurchId,
purchFormLetter.documentStatus());
purchTotals.calc();
taxRegulation = TaxRegulation::newTaxRegulation(purchTotals.tax());
taxRegulation.allocateAmount(rDeferralsJournalTrans.TaxAmount);
taxRegulation.saveTaxRegulation();
purchFormLetter.initParameters(purchParmUpdate,PrintOut::Current,NoYes::No,NoYes::No,NoYes::No);
purchFormLetter.run();