<-----------continue------------->
if (purchLine.endDisc())
{
this.updateEndDiscBalances(lineAmount);
}
if (purchLine.PurchPrice)
lineDisc += purchLine.calcLineDiscExclTax(purchQty, purchCalcTax.invoiceDate());
markup.calc(purchQty, lineAmount, purchLine, DocumentStatus::Invoice, this.interCompanyLineAmount(purchQty, purchCalcTax.invoiceDate()));
markupAmount -= markup.markupCustVend();
}
queryPurchTableMarkup = this.queryBuildPurchTable();
while (queryPurchTableMarkup.next())
{
purchTableMarkup = this.queryGetPurchTable(queryPurchTableMarkup);
if (!purchTableMarkup)
continue;
markup.calc(1, this.purchOrderBalance(purchTableMarkup.RecId), purchTableMarkup, DocumentStatus::Invoice, this.interCompanyLineAmount(1, purchCalcTax.invoiceDate()));
markupAmount -= markup.markupCustVend();
}
endDisc = this.endDisc();
calculatedEndDisc = this.calculatedEndDisc();
this.calcTax(purchCalcTax);
roundOff = this.invoiceRoundOff();
totalAmount = balance
- endDisc
+ markupAmount
+ this.taxTotal()
+ this.purchTaxRoundOff()
+ roundOff;
if (totalAmount != 0)
{
roundedOffTotalAmount = this.roundedOffTotalAmount();
roundOff += roundedOffTotalAmount - totalAmount;
totalAmount = roundedOffTotalAmount;
}
vendTable = purchTable.vendTable_InvoiceAccount();
if (vendTable.CreditMax)
{
freeValue = vendTable.freeValueMST(Currency::mSTAmount( totalAmount,
currency,
systemdateget(),
Currency::noYes2UnknownNoYes(this.triangulation()),
this.exchRate(),
this.exchRateSecondary()));
}
if (TaxParameters::canApplyCashDiscOnInvoice_ES())
{
onlyOneCashDiscOnInvoice = true;
}
cashDisc = this.cashDisc();
this.purchTotalAmount();
if (TaxParameters::canApplyCashDiscOnInvoice_ES())
{
cashDiscDate = this.cashDiscDate();
}
}