Calculation more Request Order

Hi Everybody.

On Purchase Line of my include more Request Order. I want calculation Amount on all Request. But wrong.

This procedure only calculates 1 line. It can not repeat for the remaining lines by conditional :

RecRequisition.SETRANGE("Requisition No",RecPurchLine."Requisition No");

RecRequisition.RESET;
RecRequisition.SETRANGE("Requisition No",RecPurchLine."Requisition No");
IF RecRequisition.FIND('+') THEN BEGIN
  REPEAT
    RecRequisition.SETRANGE("Requisition No",RecPurchLine."Requisition No");
    RecRequisition.CALCSUMS(Amount);
    PRAmount:=RecRequisition.Amount;
  UNTIL RecRequisition.NEXT=0   ;
END;
MESSAGE(Txt0001,PRAmount);

Please help me fix code. Thanks so much

Best Regards,

Dinh Son

Parents
No Data
Reply
  • One very important piece of advice.


    NEVER prefix variables with their type. Eg change
    recRequisition  --> RequisitionHeader.
    recPurchLine --> PurchLine

    It will be extremely difficult for you to write stable, readable and debugged code this way, and absolutely IMPOSSIBLE for another person later to debug.

    Your first priority to get this code to work is to define first exactly what you want, Second is to start again and use correct notation and naming conventions.

Children
No Data
Related
Recommended