Skip to main content
Question

How to override cash discount calculation

  • February 11, 2025
  • 0 replies
  • 53 views

Forum|alt.badge.img

Good day,

In Bills and adjustments I added a custom field in which I want that if it has any value it is considered for the calculation of the cash discount, at first I thought it could work to add the field into Terms since in another project I did something similar and it worked, but now it doesn't do anything, and in the Business logic I can't find a method or event that has the specific formula or instruction to calculate the cash discount when doing a prepayment.

Is it possible to override the cash discount calculation?

  public class APInvoiceEntry_Extension : PXGraphExtension<PX.Objects.AP.APInvoiceEntry>
{

[PXNonInstantiatedExtension]
public class AP_APInvoice_ExistingColumn : PXCacheExtension<PX.Objects.AP.APInvoice>
{
#region TermsID
[PXMergeAttributes(Method = MergeMethod.Merge)]
[PXUIField(DisplayName = "Terms", Visibility = PXUIVisibility.Visible)]
[APTermsSelector]
[Terms(typeof(APInvoice.docDate), typeof(APInvoice.dueDate), typeof(APInvoice.discDate), typeof(APInvoice.curyOrigDocAmt), typeof(APInvoice.curyOrigDiscAmt), typeof(APInvoice.curyTaxTotal), typeof(APRegisterExt.usrSubtotal))]
public virtual string TermsID { get; set; }
#endregion
}
}
public class APRegisterExt : PXCacheExtension<PX.Objects.AP.APRegister>
{

#region UsrSubtotal
[PXDBDecimal]
[PXUIField(DisplayName = "Subtotal")]

public virtual Decimal? UsrSubtotal { get; set; }
public abstract class usrSubtotal : PX.Data.BQL.BqlDecimal.Field<usrSubtotal> { }
#endregion
}