Wednesday, November 28, 2018

LS NAV - Shelf Label prints wrong cents

Rounding function in T99001573 CalculatePrice round 0.555 to 0.56, but on the item card and in the price setup, the price including vat is displayed as 0.55.

The code recalculates the price, and rounds the wrong way. However, different items may have different values after the decimal, and the only true solution is to truncate, not round.

the only way to fix this issue is to use the exact Unit Price Including VAT either from the Price Line Setup, or the Item Card

Tuesday, November 27, 2018

LS NAV - POS Cannot print Z-Report

An item is missing the VAT Posting Group.
Item was sold
Trans. Line is now missing the VAT Posting Group

Manually enter the VAT Posting group on the line in the dev environment to get the Z-Report to print.

Monday, November 26, 2018

Tuesday, November 20, 2018

LS ONE - Power BI template gives error on load

joins on some tables don't work if you have the same tax id's or loyalty schemes have multiple lines.

Tax Groups - Remove TAXGROUPHEADING from union
Loyalty Cards - Change query to be distinct

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);

Saturday, November 17, 2018

NAV - Matrix - P491 Items by Location, P9231 Modify Items by Location Matrix - Add location filter


  • P491 Items by location main page
    • Create LocationFilter Global text
    • Add LocationFilter to page as a field
      • On Validate, set filter and run setcolumns
  • Find this code, and insert this line


MATRIX_CaptionRange - OnControlAddIn(Index : Integer;Data : Text)

SetColumns(SetWanted : 'Initial,Previous,Same,Next')
MatrixRecord.SETRANGE("Use As In-Transit",ShowInTransit);
MatrixRecord.SETFILTER("Code",LocationFilter);//INSERT THIS LINE

CLEAR(MATRIX_CaptionSet);


  • P9231 
    • Add filter to item table to hide items with 0 qty

Friday, November 16, 2018

NAV - Change log does not log changes


  • Ensure you expand the screen and enable the Modificaiton and Deletion options as well on the change log table setup
  • Restart the NAV Service to enable all change log changes

Thursday, November 15, 2018

NAV - End previous Sales Prices when implementing new selling prices


  • R7053 Implement Price Change
Find this line
IF SalesPrice."Unit Price" <> 0 THEN

Insert this code
----------------------------------------------------------------------------------------


SP2.SETRANGE("Item No.",SalesPrice."Item No.");
SP2.SETRANGE("Sales Type",SalesPrice."Sales Type");
SP2.SETRANGE("Sales Code",SalesPrice."Sales Code");
SP2.SETRANGE("Unit of Measure Code",SalesPrice."Unit of Measure Code");
SP2.SETRANGE("Variant Code",SalesPrice."Variant Code");
SP2.SETRANGE("Starting Date",0D,SalesPrice."Starting Date");
SP2.SETRANGE("Ending Date",0D);
IF SP2.FIND('-') THEN BEGIN
  REPEAT
  SP2.VALIDATE("Ending Date",CALCDATE('<-1D>',SalesPrice."Starting Date"));
  SP2.MODIFY;
  UNTIL SP2.NEXT <= 0;
END;

-----------------------------------------------------------------------------------------

SSRS Rotate text, vertical text

https://docs.microsoft.com/en-us/sql/reporting-services/report-design/set-text-box-orientation-report-builder-and-ssrs?view=sql-server-2017

  1. Create a text field
  2. In Properties Tab on the right>Localizations>WritingMode
  3. In the list box, select Horizontal, Vertical, or Rotate270.

Wednesday, November 14, 2018

Dynamics NAV - Nav Prompts for username and password on launch


  • Go to C:\Users\<user>\AppData\Roaming\Microsoft\Microsoft Dynamics NAV\71
  • Edit the ClientUserSettings.ini
  • Change ClientServicesCredentialType from "Username" to "Windows"

Monday, November 12, 2018

LS NAV - Autopost Sales with PMS assemblies

COMMENT - AutopostSales Function to run on a schedule and post sales and inventory for calculated statements.
If a store has any unposted assembly transactions, do not post any statements for that store
If a terminal's transaction count does not match the statement, do not post that statement.
 Enabled 18-Dec-2017
Updated to ignore statement if internal filter exists.
Updated to clear internal filter, recalculate and post.

AutoPostSales()
BEGIN
            //Scan through all Open Statements
            //message('started');
//      OpenStatement.SETFILTER("No.",'VS0001963'); //rem
      OpenStatement.SETFILTER("Calculated Date",'>01/01/18'); //ignore old stmts
//      OpenStatement.SETFILTER("Staff/POS Term Filter Internal",'<0'); //ignore stmts with filters
      OpenStatement.SETFILTER("No.",'>0'); //ignore invalid stmts
      OpenStatement.SETFILTER(Status,'0'); //ignore non-available statements
      OpenStatement.SETAUTOCALCFIELDS("Sales Amount");
      IF OpenStatement.FIND('-') THEN BEGIN
      //MESSAGE('found');
        REPEAT
        //Check if any lines exist
        //MESSAGE(FORMAT(OpenStatement."Sales Amount",15));
        OpenStatement.VALIDATE("Staff/POS Term Filter Internal",'');
        OpenStatement.MODIFY;
        OpenStatement.SETFILTER("Staff/POS Terminal Filter",'*');
        OpenStatement."Skip Confirmation" := TRUE;
        StmtCalc.RUN(OpenStatement);
        IF OpenStatement."Sales Amount" <> 0 THEN BEGIN
        //IF 1=1 THEN BEGIN
          //Check if currently posting
          //MESSAGE('has sales');
          BatchPostingQueue.Status := BatchPosting.GetStatementStatus(OpenStatement);
          IF (BatchPostingQueue.Status < 0) OR
             (BatchPostingQueue.Status = BatchPostingQueue.Status::Finished) THEN
            BatchPostingStatus := ''
          ELSE
            BatchPostingStatus := FORMAT(BatchPostingQueue.Status);
        //MESSAGE('Statement:' + FORMAT(OpenStatement."No.",15) + ' BatchPostingStatus:' + BatchPostingStatus);

          IF BatchPostingStatus = '' THEN BEGIN //Only post if no status
          //IF CONFIRM(Txt_ConfirmItemOnlyPosting,TRUE) THEN BEGIN
            Store.GET(OpenStatement."Store No.");
            IF NOT Store."Use Batch Posting for Statem." THEN
               BEGIN
               //MESSAGE('Posting statement:' + FORMAT(OpenStatement."No.",15));
               StatementPost.RunItemPosting(OpenStatement,FALSE);
               END
            ELSE
              BEGIN
              //Check if any missing transactions
                RetailCommentLine.SETRANGE("No.",OpenStatement."No.");
                RetailCommentLine.FINDLAST;
                SavedErrLineCounter := RetailCommentLine."Line No.";
                StmtCalc.CheckMissingTransFromPOS(OpenStatement);
                COMMIT;  // needed to commit the RetailCommentLines
                RetailCommentLine.FINDLAST;
                  IF  RetailCommentLine."Line No." <> SavedErrLineCounter THEN BEGIN
                  //Do Nothing
                  END ELSE BEGIN
                    //Check if any open assemblies for store
                      AsmHdr.RESET;
                      AsmHdr.SETRANGE("Location Code",OpenStatement."Store No.");
                      IF AsmHdr.FIND('-') THEN BEGIN
                        //Do Nothing
                        END  ELSE BEGIN
                        BatchPosting.ValidateAndPostStatement(OpenStatement,TRUE);
                      END;
                  END;

              END;
          END;
        END;
        CLEAR(StatementPost);
        CLEAR(BatchPosting);
        UNTIL OpenStatement.NEXT  <= 0;
      END;
      //MESSAGE('End Statement Post');
    END;

Saturday, November 10, 2018

LS NAV PMS - Terminals locks or freezes up sometimes after prescription transaction

Solution:
The transaction is stuck on the POS, and even after a restart, the POS will attempt to reload the bad prescription and lock up the terminal again.
To prevent this, the POS Transaction Header.Voided field on the terminal database must be set to 1 via either sql or the dev environment.

Friday, November 9, 2018

Dynamics NAV - Cannot Post Purchase Order - Must be equal to 'xxx' in Purch. Rcpt. Line:Document no.='xxx'

Cause:
This occurs when there are multiple lines on a PO that have Purch_ Rcpt_ Line.Quantity Invoiced=0 and Purch_ Rcpt_ Line.Qty_ Invoiced (Base)=0 , However one of the lines has actually been invoiced, resulting in the error when the posting tries to process that line that has already been invoiced.

sometimes this may happen if there are multiple receipts, but a single invoice

Resolution:
Update Purch_ Rcpt_ Line.Quantity Invoiced=[Quantity] and Purch_ Rcpt_ Line.Qty_ Invoiced (Base)=[Quantity (Base)], [Qty_ Rcd_ Not Invoiced] = 0

update [CRONUS$Purch_ Rcpt_ Line]
set [Quantity Invoiced] = [Quantity], [Qty_ Invoiced (Base)] = [Quantity (Base)], [Qty_ Rcd_ Not Invoiced] = 0
 where [Document No_] = '107133962' and No_ = '546024443'

Thursday, November 1, 2018

LS NAV - Replenishment - How to use

http://help.lsnav.lsretail.com/Content/LS%20Retail/Replenishment/Replenishment.htm?tocpath=Retail%7CReplenishment%7C_____0

  • Process Overview
o   Define Replenishment Rules per item per destination location
o   Define Transfer Templates
o   Run Transfer Template manually or automatically to suggest transfers from a specific location (usually Warehouse)
§  Create Transfers
§  Pick and Ship transfers to consume stock
o   Define Purchase Templates
o   Run Purchase Template Manually or automatically to suggest purchases from a specific location, (warehouse or store)
§  Create Purchase Orders
§  Receive and Put Away purchase orders to increase stock
  • What are the different Replenishment Types?
    • Set on Retail Item Card>Replenishment Control Data
    • Automatic-From Data Profile=Use Replenishment Data Profile Settings
    • Average Usage = Historical sales based on rules set in Replenishment Sales Profiles
    • Manual Estimate = Use Manual Estimated Daily sale field (used for new items with no history)
    • Stock Levels=Only use Reorder Point and Maximum Stock for simple replenishment
    • Like for Like=Replenish in the same pattern that is sold (auto-replace stock sold,sell 10, buy 10)
    • Demand Plan=Integrated to Demand Plan Module (Calculates Daily forecast based on historical sales plus other rules, requires lots of history, stable products)
  • Most commonly used menus
    • LSRetail>Replenishment>Automatic>Purchase Replenishment Journal
      • Add items to journal
      • Create Purchase Orders
    • LSRetail>Replenishment>Automatic>Replenishment Templates
      • Template = collection of filters used in Purchase Replenishment Journal
    • Retail Item Card>Replenishment Control Data
      • Define general replenishment rules for this item for all locations and all vendors
    • Retail Item Card>Replenishment Control Data>Replenishment Information Setup>Item Store List
      • Define Vendor-Item-Store specific replenishment rules
  • What are the profiles for?
    • Replenishment Item Profiles
      • After filling in info, click Update to apply replenishment settings to all relevant items (Updates their Replenishment Control Data)
    • Replenishment Data Profiles
      • Can be used on Item Category
      • Defines Replenishment defaults for entire category if none explicitly set on item
    • Replenishment Sales Profiles
      • Defines how Average Sales are calculated when using Average Usage Replenishment Calculation Type on Replen. Inf. Data
    • Replenishment Forw. Sales Profiles
      • If defined, allows additional comparison to future period to adjust for upcoming seasonal future changes based on historical sales
      • Used in Replen control data setup
  • Where do i set lead times for vendors?
    • Retail Item Card>Ordering>Safety Lead Time (30D,3M)
      • Define Default Lead times if no others defined
    • Retail Item Card>Vendors>Item Vendor Catalog
      • Define Lead times by vendor
  • How do i see slow moving items?
    • Replenishment>Stock Turnover
      • Average Stock: Shows average stock for time period selected
      • Turnover Avg Inventory: Sales / Avg Stock
      • Turnover: How many times Avg. Inventory was sold (Sales/Avg. Inventory)
      • Waiting Time: How long it would take to sell all stock in days
    • Should be modified to add custom turnover calculations, filter on turnover value, filter on item division,group,category, last date purchased, last date sold
  • How do i see obsolete stock?
    • Item Age Composition - See old stock, should be run periodically, should add filter for only old stock
    • Worst Selling Items
    • Items without Sale
  • How do i see out of stock report?
    • Retail Item Card>Replenishment Control Data>Factbox-Out of Stock>Replen Out of Stock Days
      • View should be saved, or report built using this data
  • Automated Replenishment is recommending too much/little stock. How do i fix it?
    • RCD = Replenishment Control Data
    • Review RCD>Reorder Point (Suggested amount is increased to reorder point if it exists)
    • Review RCD>Maximum Inventory (Suggested amount is increased to max inventory if below reorder point)
    • Review RCD>Store Stock Cover (Suggested amount is increased to cover this many days' worth of sales)
    • Review RCD>Sales history Adjustment (Fix anomalies or errors in history that cause miscalculations, has no financial impact)
  • Useful Reports?
    • LSRetail>Backoffice>Reports&Analysis
    • Lifecycle curve
    • Trend report
  • Does this work with Blanket Orders?
    • No.