Hi everyone, something really strange is happening with my xmlport.
From one moment to another, the date read from a file is "2020" instead of "2018" and the field "Ending Date" of my previous record can't be calculated (this field is equal to the last starting date - 1 day).
So I have a text file with the info below
1010100002 11/11/2018 0 11,95 (item no | starting date | quantity | price)
and the idea is to fill the Sales Price table with this information using my dataport with the following code
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); MESSAGE('ano %1',ano); MESSAGE('data %1',DataInicioText); 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"."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'); "Sales Price".VALIDATE("VAT Bus. Posting Gr. (Price)",'NAC'); 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 "Sales Price".NEXT(-1); "Sales Price"."VAT Bus. Posting Gr. (Price)":='NAC'; "Sales Price"."Ending Date":=DataInicio-1; "Sales Price".MODIFY(TRUE); END;
And this xmlport is used in page 31 (item list) in a page action which have the property "RunObject" with "XMLport ImportTabPrecos".
Anyone can understand this strange thing?
*This post is locked for comments