This is sample Code to get Sales order Total Value in Axapta. You can try this job in Your Ax environment to check all vales . It will work well with open and Invoiced status sales order I hope it will help you and save your lot of time.
static void SalesTotalAmountJOb(Args _args)
{
SalesTotals salesTotals;
SalesTable salesOrderTable;
SalesLine salesLine;
TaxAmountCur salesAmt,taxAmount,amt1,discountAmt,totcharges,totOfOrder,contributionRatio;
Tax tax;
;
salesOrderTable = SalesTable::find("TD_SO_00069218");
salesLine = SalesLine::find(salesOrderTable.SalesId);
salesTotals = SalesTotals::construct(salesOrderTable);
tax = Tax::construct(NoYes::No);
salesAmt = salesTotals.totalBalance();
taxAmount = salesTotals.totalTaxAmount();
discountAmt = salesTotals.totalEndDisc();
totcharges = salesTotals.totalMarkup();
totOfOrder = salesTotals.totalAmount();
contributionRatio = salesTotals.totalContributionRatio();
info(Strfmt("Sales Lines Amount %1",salesAmt ));
info(Strfmt("The VAT\tax amount is %1",taxAmount ));
info(Strfmt("The Discount Value is %1",discountAmt ));
info(Strfmt("Misc Markup %1",totcharges ));
info(Strfmt("Total Invoice Amount %1",totOfOrder ));
info(Strfmt("Total Contribution ratio %1",contributionRatio ));
}