# 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

```objectpascal
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;
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.calwincloud.com/calwin-script/system-script-events/onsalesheaderpricefinalization.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
