Check Amount on Item Charge Assignment vs Amount Purchase Line

Hi Everybody

I write code check Amount on table Item Charge Assignment (Purch) vs Field Amount Table Purchase Line. If not same then error note. But it’s not work.


IF  PurchaseLine."Document Type"=  PurchaseLine."Document Type"::Invoice THEN
    ItemChargeAssgnment.SETRANGE("Document No.",PurchaseLine."Document No.");
      IF ItemChargeAssgnment.FINDSET THEN
        PurchaseLine.RESET ;
        PurchaseLine.SETFILTER(Type,'%1',PurchaseLine.Type::"Charge (Item)");
        PurchaseLine.SETFILTER(Type,'>0');
        PurchaseLine.SETFILTER(PurchaseLine.Amount,'<>%1',ItemChargeAssgnment."Amount to Assign");
        IF PurchaseLine.FINDSET THEN
          ERROR('"Amount to Assign" <> "Amount PIO"');

Please help me fix code. Thanks so much.

Best Regards

Dinhson

Hi Dinhson,
You should try with some BEGIN’s and END’s… [:)]

Thanks you Erik.
I tried, tried to begin… End but still no effect. It’s not work.

And maybe a repeat until… You are only finding one.