getting standard Shipping and Tax for SO

HI, Below sample code used to get shipping charges for sales order.

static real shippingCharges(SalesId _salesId)
QueryRun queryRun;
OSSDeliveryChargeTable deliveryChargeTable, table;
DlvMode mode;
SalesTable _salesTable = SalesTable::find(_salesId);
real shipping;

queryRun = new QueryRun(OSSDlvMode::query(_salesTable.CustAccount, _salesTable, _salesTable.DlvMode,
OCSCatalogueTable::find(OCSBrandTable::find(_salesTable.OSSBrandId).CatalogueId, false).ShippingChargegroupId));

deliveryChargeTable = queryRun.get(tablenum(OSSDeliveryChargeTable));
table = deliveryChargeTable;
_salesTable.ossCreateMarkupTransFromChargeRecord(true, deliveryChargeTable, deliveryChargeTable.DlvModeId);
shipping = MarkupTrans::ossCalculateDeliveryCharges(_salesTable);

return shipping;

Getting tax(multiple ways):

displayFields = SalesTotals::displayFieldsServer(SalesTable::find(oldSalesId), SalesUpdate::All, ‘USD’);

tax = conPeek(displayFields, 16);
ossOrderValue.Tax = Tax;
ossOrderValue.Tax = SalesTable::find(oldSalesId).ossTaxCalc();
while select salesLineTax
where salesLineTax.SalesId == oldSalesId
tax += Tax::calcTaxAmount(salesLineTax.TaxGroup, salesLineTax.TaxItemGroup, Systemdateget(), salesLineTax.CurrencyCode,
salesLineTax.LineAmount + ossOrderValue.ShippingCharges, TaxModuleType::Sales);

ossOrderValue.Tax = tax;


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s