I want to work out the VAT on the total items on the Purchase receipts page. I can just select the correct TaxRev class using BQL I was wondering does the system have a static class where I can get the same value. Same as Accessinfo will have the userID.
using PX.Data;
using PX.Objects.TX;
namespace PX.Objects.PO
{
// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public class POReceiptEntry_Extension : PXGraphExtension<POReceiptEntry>
{
#region Event Handlers
protected void POReceipt_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
var row = (POReceipt)e.Row;
if (row is null) return;
decimal totalVat = 0;
decimal totalUnitCost = 0;
foreach (POReceiptLine item in Base.transactions.Select())
{
if (item.UnitCost is null || item.Qty is null) continue;
totalUnitCost += item.UnitCost.Value * item.Qty.Value;
}
// TODO remove hard coded 0.15 below
totalVat = totalUnitCost * (decimal)0.15;
// cache.SetValueExt<POReceiptExt.usrTotalVAT>(row, totalVat);
// cache.SetValueExt<POReceiptExt.usrTotalInclVAT>(row, totalUnitCost);
}
#endregion
}
}