Saturday, July 16, 2022

Get sales totals amount by using x++ code

 Get sales totals amount by  using x++ code.

    //Total Discount from Sales Totals form
    SalesTable      salesTable      = SalesTable::find('sales order number');
    SalesTotals     salesTotals     = SalesTotals::construct(salesTable, salesUpdate::All);
    container       displayFields;
    DiscAmount      totalDisc;
    RealBase        subTotal;
    AmountCur       invoiceAmount;
    AmountMST       salesTax;
    AmountMST       totalCharges;
displayFields = SalesTotals::displayFieldsServer(salesTable, SalesUpdate::All, salesTotals.CurrencyCode()); //Total Discount totalDisc = conpeek(displayFields, TradeTotals::posEndDisc()); info(Strfmt("Total discount %1", totalDisc)); //Subtotal Amount subTotal=conpeek(displayFields, TradeTotals::posBalance()); info(Strfmt("Subtotal Amount %1", subTotal)); //Invoice Amount invoiceAmount =conpeek(displayFields, TradeTotals::posTotalAmount()); info(Strfmt("Invoice Amount %1", invoiceAmount));
   //sales Tax
   salesTax = conpeek(displayFields, TradeTotals::posTaxTotal());
info(Strfmt("sales Tax %1", salesTax));
 //Total Charges
  totalCharges = conpeek(displayFields, TradeTotals::posMarkup());
info(Strfmt("Total Charges
%1", totalCharges));


Keep Daxing!!

No comments:

Post a Comment