Tuesday, November 20, 2018

LS NAV - CAL for Shelf Label with Price rounding

P99001713 - Quick Shelf Label Printing
C10000747 EPL Shelf Label 38x70

ShelfLabelRec.COPYFILTERS(Rec);
IF ShelfLabelRec.FINDSET THEN BEGIN
  LabelFunctions.GET(LabelFunctions.Type::"Shelf Label",ShelfLabelRec."Label Code");
  InitPrint(ShelfLabelRec."Label Code");
  IF LabelFunctions."Print to File" THEN
    CreateFile;
  REPEAT
    SetItemParameters(ShelfLabelRec);
    WriteLine(LineEnd);
    WriteLine('N' + LineEnd);
    WriteLine('q480' + LineEnd);
    WriteLine('Q200,B40' + LineEnd);
    IF STRLEN(ShelfLabelRec."Text 1") > 0 THEN
      WriteLine('A23,10,0,1,1,2,N,"' + COPYSTR(ShelfLabelRec."Text 1",1,50) + '"' + LineEnd);  //T21
//DAV2
//    Intamount := ShelfLabelRec."Price on Shelf Label" - (ShelfLabelRec."Price on Shelf Label" - ROUND(ShelfLabelRec."Price on Shelf Label",1,'<'));
    Intamount := ROUND(ROUND(ShelfLabelRec."Price on Shelf Label",0.01,'>'),1,'=');
    DollarText := FORMAT(Intamount);
    CentsText :=  '00' + FORMAT(ROUND(ShelfLabelRec."Price on Shelf Label",0.01,'>')-IntAmount);
    CentsText2 := COPYSTR(CentsText,STRLEN(CentsText) - 1,2);
//DAV2
    AlignAmount(Intamount);
    IF Intamount < 1000 THEN
      WriteLine('A' + AlignAmount(Intamount) + ',20,0,5,1,1,N,"' + '$' + FORMAT(Intamount) + '"' + LineEnd)  //A1   Price before decimal
    ELSE
      WriteLine('A' + AlignAmount(Intamount) + ',50,0,5,1,1,N,"' +  FORMAT(Intamount,10,'<Integer Thousand>') + '"' + LineEnd);  //A1
    WriteLine('B30,100,0,' + GetBarcodeType(ShelfLabelRec."Barcode No.") + ',2,7,70,B,"' + ShelfLabelRec."Barcode No." + '"'+LineEnd);  //T4
    WriteLine('A8,175,0,2,1,1,N,"' + ShelfLabelRec.Variant + '"' + LineEnd);  //T5
    WriteLine('A20,50,0,1,2,2,N,"' + ShelfLabelRec."Item No." + '"' + LineEnd);  //T9
//DAV2
//    WriteLine('A435,20,0,4,1,1,N,"' + COPYSTR(SalesAmountText,STRLEN(SalesAmountText) - 1,2) + '"' + LineEnd);  //A13 Price after decimal
    WriteLine('A435,20,0,4,1,1,N,"' + CentsText2 + '"' + LineEnd);  //A13 Price after decimal
//DAV2
    IF ShelfLabelRec."Comp. Price on Shelf Label" <> 0 THEN BEGIN
      WriteLine('A340,276,0,2,1,1,N,"' + Text002 + Item."Comparison Unit Code" + '"' + LineEnd);  //T11
      WriteLine('A370,276,0,2,1,1,N,"' + FORMAT(ShelfLabelRec."Comp. Price on Shelf Label") + '"' + LineEnd);  //A2
    END;
    WriteLine('P' + FORMAT(ShelfLabelRec.Quantity)+LineEnd);
    WriteLine('N' + LineEnd);
    WriteLine(LineEnd);
    UpdateLabelStatus;
  UNTIL ShelfLabelRec.NEXT = 0;
  IF LabelFunctions."Print to File" THEN
    CloseFile;
END ELSE
  ERROR(Text001 + ' ' + ShelfLabelRec.GETFILTERS);

No comments:

Post a Comment