Hi, i have crearted a menu item, “get job price” in Purchase Quote under Line. It calculates the total price of a job from Job Budget Line and would populate the amount in the “Direct unit cost” field in Purchase Quote line. I am able to calculate price, but unable to populate it in the Purchase Quote line. I have created a process only report to do this with the code: //CALCULATE TOTAL PRICE FOR A JOB TotalPrice:=0.0; GVJobBudgetLine.SETRANGE(GVJobBudgetLine.“Job No.”,GVJobNo); IF GVJobBudgetLine.FIND(’-’) THEN REPEAT TotalPrice:=TotalPrice+GVJobBudgetLine.“Unit Price”; UNTIL(GVJobBudgetLine.NEXT=0); //CALCULATE TOTAL PRICE FOR A JOB GVJobBudgetLine = Record of Job Budget Line. Plz help
Personally I would have created a new function on the Job-table, instead of creating a Processingonly-report.
Since the “Line”-button is on the mainform, wich has PurchaseHeader as SourceTable, You must ensure that Your function updates the correct PurchaseLine. This is easiest done by retrieving it in the OnPush-trigger, and passing it to the function as a VAR-parameter.