CalWin
  • Introduction
  • Code Snippets
  • Useful SQL statements
  • CalWin Script
    • Hardware Script
      • GetQty
      • DefineParts
      • WorkXXX
      • Script classes
        • TWorkWrapper
        • TFrameWrapper
        • TDividerWrapper
    • System script Events
      • OnAdjustStainLoad
      • OnAfterCalcItemRequirement
      • OnCalcPriceListAddition
      • OnCalcProductPurchaseDeliveryTime
      • OnCalcSalesHeaderAutoLineData
      • OnCalcSashLeadWeight
      • OnCheckFromSemiStock
      • OnCheckFromStock
      • OnCheckGlassFromStock
      • OnCheckProduct
      • OnCheckSalesheaderRules
      • OnCheckSaleslineDates
      • OnGetBatchGroup
      • OnGetClassification
      • OnGetDiscountGroup
      • OnGetElementProfile
      • OnGetLoadPoints
      • OnGetProductSourceAltParams
      • OnGetProductSourceParams
      • OnGetprofile (deprecated)
      • OnGetSaleslinesSourceParams
      • OnGetStockItemGroup
      • OnIncludeBottleneckLoad
      • OnIncludeCheckpoint
      • OnIsSpecialProduct
      • OnModifyEdgeList
      • OnModifyKickPlate
      • OnModifyVariants_Final
      • OnModifyVariants_Initial
      • OnSalesheaderPriceFinalization
      • OnSetElementJointType
      • OnSetSileDividersPos
      • OnSetTranMullDesignCode
      • OnSetTranMullDividersPos
      • Helper Procedure Repository
        • Loop ElementList
    • Machine Link
      • Machine Link Events
        • Initialize and Finalize
        • BeforeOptimization
        • PreParseMain_xxx
        • PostParseMain_xxx
        • ParseChild_xxx
        • BeforeOutput_xxx
      • How to use a search table in Machine Link
  • Brukerdokumentasjon (NOR)
    • Fullkostkalkyle
    • Bonus og markedsstøtte
    • CalWin enhet og faktor
    • Kalenderen
    • Budsjett
    • Eksport til Excel
    • Dokument-hÃ¥ndtering
  • Misc documentation
    • CalWin 64-bit Beta
    • CalWin E-Quote
    • CalWin WEB Dashboard
    • Oracle related
      • Oracle Database Server Requirements
      • Oracle DBA
        • Resize and rename data files
        • Arhivelog mode
        • LISTENER.ORA
        • Connection strings
        • Create Oracle user (schema) for CalWin
        • Create a database link
        • Password expiration
        • Add a Directory object
        • Show table space size
        • Recovery Area Space
        • ORA-00257 - not enough space in recovery file
    • CalWin Server
      • Legg til web certificate
Powered by GitBook
On this page

Was this helpful?

  1. CalWin Script
  2. System script Events

OnSalesheaderPriceFinalization

This event can be used to make final adjustments to the total net price and gross price of a quote/order. The events execution is activated from the total calculation screen.

Example and syntax

procedure OnSalesheaderPriceFinalization(const aParams: TScriptOnSalesheaderPriceFinalizationParams);
var
  vMultDiv,vAddSub: integer;
  vDiscountpercent: double;  
begin
  if aParams.Grossprice > 0 then
    vDiscountpercent := ((aParams.Grossprice - aParams.Netprice)/aParams.Grossprice)*100
  else
    vDiscountpercent := 0;
    
  if aparams.Netprice > 5000 then
  begin
    //Round up to nearest 490 or 990
  
    vMultDiv := 500;         
    vAddSub := 10;           

    //Rounds up to nearest 490 og 990 above original netprice
    aParams.Netprice := vMultDiv*Ceil((aParams.Netprice+vAddSub)/vMultDiv)-vAddSub; //Calculate new netprice
    aParams.Grossprice := aParams.Netprice / (100 - vDiscountpercent) *100          //Keep original discount percent
  end;
end;
PreviousOnModifyVariants_InitialNextOnSetElementJointType

Last updated 2 years ago

Was this helpful?