Add additional total discounts to the sales total form using x++.
/// <summary> /// extension class to apply total discounts on sales total forms /// </summary> [ExtensionOf(classstr(TradeTotals))] public final class TradeTotals_Extension { /// <summary> /// adds additional total discounts to the sales total form /// </summary> /// <returns>total discount</returns> public DiscAmount totalEndDisc() { endDisc = next totalEndDisc(); if (orderTable.tableID == tableNum(SalesTable)) { SalesTable salestableloc = orderTable; if (salestableloc.TotalDiscountAmount && salestableloc.SalesStatus != SalesStatus::Invoiced && balance) { return endDisc + ((balance / 100) * salestableloc.TotalDiscPercentage); // return endDisc + salestableloc.TotalDiscountAmount; } } return endDisc; } //public TaxAmountCur totalTaxAmount() //{ // TaxAmountCur tax; // tax = next totalTaxAmount(); // if (orderTable.tableID == tableNum(SalesTable)) // { // SalesTable salestableloc = orderTable; // if (salestableloc.TotalDiscountAmount && salestableloc.SalesStatus != SalesStatus::Invoiced) // { // return tax - salestableloc.TotalDiscountAmount ; // } // } // return tax; //} public TaxAmountCur getInclTaxAmount_IN(Common _buffer) { TaxAmountCur taxAmount; taxAmount = next getInclTaxAmount_IN(_buffer); if (orderTable.tableID == tableNum(SalesTable)) { SalesTable salestableloc = orderTable; if (salestableloc.TotalDiscountAmount && salestableloc.SalesStatus != SalesStatus::Invoiced && balance) { return taxAmount - ((balance / 100) * salestableloc.TotalDiscPercentage); } } return taxAmount; } }
/// <summary> /// Retrieves the line amount excluding tax and adding total discount to line. /// </summary> [ExtensionOf(classStr(TaxSales))] final class TaxSales_Extension { /// <summary> /// Retrieves the line amount excluding tax (base amount) from the <c>SalesFormLetter</c> instance. /// </summary> /// <param name = "_lineAmount">Line amount.</param> /// <returns>The line amount excluding tax.</returns> [Replaceable] protected TaxBaseCur retrieveBaseAmount(AmountCur _lineAmount) { AmountCur lineAmount; SalesTable salesTableLoc; lineAmount = next retrieveBaseAmount(_lineAmount); salesTableLoc = salesLine.Salestable(); if (salesTableLoc.TotalDiscountAmount != 0 && salesTableLoc.SalesStatus != SalesStatus::Invoiced) { lineAmount -= ((lineAmount / 100) * salesTableLoc.TotalDiscPercentage); } return lineAmount; } }
Keep Daxing!!
No comments:
Post a Comment