IF NOT "Sales Price".INSERT(TRUE) THEN BEGIN MESSAGE('begin1'); MESSAGE('check %1',"Sales Price".FINDLAST); IF "Sales Price".FINDLAST THEN BEGIN MESSAGE('begin2'); MESSAGE('Item last %1', "Sales Price"."Item No."); MESSAGE('Item starting date %1', "Sales Price"."Starting Date"); MESSAGE('Item ending date %1', "Sales Price"."Starting Date"-1); "Sales Price"."Ending Date":="Sales Price"."Starting Date"-1; "Sales Price".MODIFY(TRUE); END; END;
1010100004 25/10/18 1 14,08 1010100002 26/10/18 1 12,65
Sales Price - Import::OnBeforeInsertRecord() nRecNum += 1; dlgProgress.UPDATE(3, nRecNum); "Sales Price".RESET; "Sales Price".SETRANGE("Sales Price"."Item No.",PRODUTO); "Sales Price".SETRANGE("Sales Price"."Sales Type",1); "Sales Price".SETRANGE("Sales Price"."Sales Code",'ALL'); "Sales Price".SETRANGE("Sales Price"."VAT Bus. Posting Gr. (Price)",'NAC'); "Sales Price".SETRANGE("Ending Date",0D); "Sales Price".SETRANGE("Currency Code",''); "Sales Price".SETRANGE("Variant Code",''); "Sales Price".SETRANGE("Unit of Measure Code",''); //"Sales Price".SETRANGE("Minimum Quantity",QT) DataInicioText:=COPYSTR(DATAINI,1,8); dia := COPYSTR(DataInicioText,1,2); mes := COPYSTR(DataInicioText,4,2); ano:= COPYSTR(DataInicioText,7,4); EVALUATE(DataInicio,dia+mes+ano); "Sales Price".SETRANGE("Starting Date",DataInicio); "Sales Price"."Starting Date":=DataInicio; IF "Sales Price".FINDFIRST THEN BEGIN IF DataInicio < "Sales Price"."Starting Date" THEN "Sales Price".DELETEALL; END; "Sales Price"."User ID":=USERID; "Sales Price"."Data criacao":=TODAY; "Sales Price"."Item No.":=PRODUTO; "Sales Price"."Allow Invoice Disc." :=TRUE; "Sales Price"."VAT Bus. Posting Gr. (Price)":='NAC'; "Sales Price"."Allow Invoice Disc.":=TRUE; "Sales Price"."Sales Code":='ALL'; "Sales Price"."Sales Type":=1; "Sales Price"."Currency Code":=''; "Sales Price"."Variant Code":=''; "Sales Price"."Ending Date":=0D; "Sales Price".VALIDATE("Sales Price"."Sales Code",'ALL'); Item.GET(PRODUTO); "Sales Price"."Unit of Measure Code":=Item."Base Unit of Measure"; //Quantity Quantity:=FORMAT(QT); EVALUATE("Sales Price"."Minimum Quantity",Quantity); //Unit Price Price:=FORMAT(PVP); EVALUATE("Sales Price"."Unit Price",Price); //Unit Price with vat VATPercentageProd:=Item."VAT Prod. Posting Group"; VATPercentageBus:=Item."VAT Bus. Posting Gr. (Price)"; VATPostingSetup.GET(VATPercentageBus,VATPercentageProd); VATPerCent:=VATPostingSetup."VAT %"; EVALUATE(PriceVAT,PVP); "Sales Price"."Unit Price Including VAT":=ConvertPriceToVAT(VATPerCent,PriceVAT); IF NOT "Sales Price".INSERT(TRUE) THEN BEGIN MESSAGE('begin1'); MESSAGE('check %1',"Sales Price".FINDLAST); IF "Sales Price".FINDLAST THEN BEGIN MESSAGE('begin2'); MESSAGE('Item last %1', "Sales Price"."Item No."); MESSAGE('Item starting date %1', "Sales Price"."Starting Date"); MESSAGE('Item ending date %1', "Sales Price"."Starting Date"-1); "Sales Price"."Ending Date":="Sales Price"."Starting Date"-1; "Sales Price".MODIFY(TRUE); END; END;
Answers
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/
At the moment i'm filling the last row but the previous before the last is not being filled
Or put it all through price worksheet/ journal
table Sales Price?