purchase order validation

Can anyone please help me on putting validation on the direct unit cost in the purchase order , by which i mean when my direct unit cost is derived from the purchase table in navision , if anyone tries to change the cost it gives an error on the same.

 

Thanks in advance!!!!

  • onvalidate of direct unit cost put the following code
    if CurrFieldNo = FIELDNO("Direct Unit Cost") then begin
    if xrec."direct unit cost" <> "direct unit cost" then
    error('Direct unit cost cannot be changed.');
    end;
  • In reply to sbhatbng:

    thankyou for your quick response,
    but is there any provision that i can give a 10 % variation in the direct unit cost?

    For e.g if the price given in item table for the specific table is 200, then the user can change it uptil 199.90 or 200.10 Rs.

    it would be really helpful.
  • In reply to Yuneek Singh:

    Yes, what you can do is in the General ledger setup add a field called Variation % a decimal field and using the same above code you will add a variable to check variation called it VariationPer Decimal
    and to the above code then begin
    variationper := 0;
    glsetup.get;
    variationper := "direct unit cost" * glsetup.variation % / 100
    if "direct unit cost" + variationper > "direct unit cost then
    errormessage;
    end;
  • In reply to sbhatbng:

    i have added the field in general ledger setup as suggested by you, but can you please tell the code as it needs to be written?
  • In reply to sbhatbng:

    other thing in needed is this validation should only be applicable if the direct unit cost is there in the price table.
    otherwise it should work normally.
Related