Friday, June 29, 2018

LS NAV - NAS Scheduler stops, sticks, freezes or hangs for no reason

Review the windows error logs
Give the NAS service account access to
  • tabledata Calendar Event User config: insert
  • tabledata job queue entry: modify

C99001468 controls the nas scheduler
The TYPEFILTER set in the NAS setup control what job types will actually get to run
Ensure your jobs always have a type dd-from-ho or dd-to-ho

LS NAV - Configure Manager MSR Card to takeover transaction until completion, revert to staff

This can be controlled on the Functionality Profile. Look for Card Logon at Sale in the Staff & Logon fast tab. Set this to Manager Key.

Tuesday, June 26, 2018

NAV - Reports CAL use OnPreDataItem for additional filters

The OnPreDataItem can be used to put additional filters on your report data before it is populated, which can significantly increase the speed of certain reports if they are pulling unnecessary data due to joining constraints.

You can populate variables with data that can be used in a setfilter in the OnPreDataItem

NAV - SQL Database Tuning and Indexes for speed improvements

https://www.sqlshack.com/a-great-tool-to-create-sql-server-indexes/



  • Run  a trace in the SQL Profiler, save it
  • Load it into the Database Tuning advisor
  • Let it analyze and recommend indexes
  • In NAV, build keys in the dev environment to best meet the recommendations at your discretion
  • Each key will build an appropriate index in sql
  • DO NOT run the scripts and generate indexes outside of NAV

LS NAV - Change shows negative value on screen and does not open drawer

On the tender type, set the change tend code as the code for cash

LS NAV - Object Push - [22924070] The CRONUS database on the NAV server cannot be opened by this version of the Microsoft Dynamics NAV Development Environment. The database has already been converted by a newer version. You must upgrade the Microsoft Dynamics NAV Development Environment to the latest version to open the database.

This happens when the destination has multiple versions of nav installed.
Uninstall the old nav.

Sunday, June 24, 2018

LS NAV - How to deal with Web Service Issues - Enable Log

  • How to enable web requests
    • Pos Functionality Profile>DD Tab>Send Transaction = Yes
      • This will send a transaction immediately to ho as soon as it is posted to the local db via web services "SEND_TRANS_HEADER"
  • Turn on the Web service Log
    • Departments/LS Retail/Administration/Web Service/Web Service Setup
    • Client Log On = Yes
    • Server Log Level = All
    • Client Log Path = C:\Temp\Webservice
    • Use the Web Request Log to view the log
  • After every transaction, there is a long delay while "Sending Transaction Header" is displayed
  • "Sorry, we just updated this page. Reopen it, and try again."

-------------------------------------------
Check the Trans. Server Work Table, if it has too many entries, it may be locking itself up.
Copy the data out to excel, then put it back in 20 at a time.
Login and logout of pos to send requests
Repeat for all records.
-------------------------------------------

Be sure to fill in Functionality Profile / Web Servers -> Dist. Location.


https://ptsteadman.com/nav.html

Friday, June 22, 2018

Dynamics NAV - Bank Rec Notes


  • P379-Bank Acc. Reconciliation
  • T273-Bank Acc. Reconciliation
  • C374-Bank Rec apply
  • C375-Bank Acc. entry Set Recon-No (Bank Unapply)
  • C371 - Bank Acc. Recon. Post (Yes/No) (Post Button)
  • C370-Bank Acc Rec Post 
  • C12252-Match Bank Rec Lines
  • T271-Bank Account Ledger entry (Right hand side) (P380)
  • T274-Bank Acc. Reconciliation Line (Left Hand Side) (P372)

  • BankRecLineTypes
    • 0-Bank Account Ledger Entry,
    • 1-Check Ledger Entry,
    • 2-Difference
  • Statement Statuses
    • 0-Open,
    • 1-Bank Acc. Entry Applied,
    • 2-Check Entry Applied,
    • 3-Closed
  • Unapplying a bank entry to a rec line does the following
    • BankAccReconLine."Applied Amount" -= BankAccLedgEntry."Remaining Amount";
    • BankAccReconLine."Applied Entries" := BankAccReconLine."Applied Entries" - 1;

    • Applying a bank entry to a rec line does the following
      • BankAccReconLine."Ready for Application" := TRUE;
      • SetReconNo(BankAccLedgEntry,BankAccReconLine);
        • If BankLedgerentry
          • BankAccLedgEntry.TESTFIELD(Open,TRUE);
          • BankAccLedgEntry.TESTFIELD("Statement Status",BankAccLedgEntry."Statement Status"::Open);
          • BankAccLedgEntry.TESTFIELD("Statement No.",'');
          • BankAccLedgEntry.TESTFIELD("Statement Line No.",0);
          • BankAccLedgEntry.TESTFIELD("Bank Account No.",BankAccReconLine."Bank Account No.");
          • BankAccLedgEntry."Statement Status" :=
          •   BankAccLedgEntry."Statement Status"::"Bank Acc. Entry Applied";
          • BankAccLedgEntry."Statement No." := BankAccReconLine."Statement No.";
          • BankAccLedgEntry."Statement Line No." := BankAccReconLine."Statement Line No.";
        • If checkLedgerentry
          •     CheckLedgEntry.TESTFIELD("Statement Status",CheckLedgEntry."Statement Status"::Open);
          •     CheckLedgEntry.TESTFIELD("Statement No.",'');
          •     CheckLedgEntry.TESTFIELD("Statement Line No.",0);
          •     CheckLedgEntry."Statement Status" :=
          •       CheckLedgEntry."Statement Status"::"Bank Acc. Entry Applied";
          •     CheckLedgEntry."Statement No." := '';
          •     CheckLedgEntry."Statement Line No." := 0;
      • BankAccReconLine."Applied Amount" += BankAccLedgEntry."Remaining Amount";
      • BankAccReconLine."Applied Entries" := BankAccReconLine."Applied Entries" + 1;
    ---------------------------------------------------------------------
    --Views to show what trx are applied, and to check the totals
    -----------------------------------------------------------------
    /****** Object:  View [dbo].[BI_BankRecApply]    Script Date: 6/22/2018 2:10:02 PM ******/
    SET ANSI_NULLS ON
    GO

    SET QUOTED_IDENTIFIER ON
    GO

    CREATE VIEW [dbo].[BI_BankRecApply]
    AS
    SELECT        dbo.[CRONUS$Bank Acc_ Reconciliation Line].[Bank Account No_], dbo.[CRONUS$Bank Acc_ Reconciliation Line].[Statement No_], 
                             dbo.[CRONUS$Bank Acc_ Reconciliation Line].[Statement Line No_], dbo.[CRONUS$Bank Acc_ Reconciliation Line].[Statement Amount], 
                             dbo.[CRONUS$Bank Acc_ Reconciliation Line].[Applied Entries], dbo.[CRONUS$Bank Acc_ Reconciliation Line].[Applied Amount], 
                             SUM(dbo.[CRONUS$Bank Account Ledger Entry].[Debit Amount]) AS BLEDebit, SUM(dbo.[CRONUS$Bank Account Ledger Entry].[Credit Amount]) AS BLECredit, 
                             COUNT(dbo.[CRONUS$Bank Account Ledger Entry].[Document No_]) AS BLEApplied
    FROM            dbo.[CRONUS$Bank Acc_ Reconciliation Line] LEFT OUTER JOIN
                             dbo.[CRONUS$Bank Account Ledger Entry] ON dbo.[CRONUS$Bank Acc_ Reconciliation Line].[Bank Account No_] = dbo.[CRONUS$Bank Account Ledger Entry].[Bank Account No_] AND 
                             dbo.[CRONUS$Bank Acc_ Reconciliation Line].[Statement No_] = dbo.[CRONUS$Bank Account Ledger Entry].[Statement No_] AND 
                             dbo.[CRONUS$Bank Acc_ Reconciliation Line].[Statement Line No_] = dbo.[CRONUS$Bank Account Ledger Entry].[Statement Line No_]
    GROUP BY dbo.[CRONUS$Bank Acc_ Reconciliation Line].[Bank Account No_], dbo.[CRONUS$Bank Acc_ Reconciliation Line].[Statement No_], 
                             dbo.[CRONUS$Bank Acc_ Reconciliation Line].[Statement Line No_], dbo.[CRONUS$Bank Acc_ Reconciliation Line].[Statement Amount], 
                             dbo.[CRONUS$Bank Acc_ Reconciliation Line].[Applied Entries], dbo.[CRONUS$Bank Acc_ Reconciliation Line].[Applied Amount]
    GO

    /****** Object:  View [dbo].[BI_BankRecApply_Smry]    Script Date: 6/22/2018 2:10:09 PM ******/
    SET ANSI_NULLS ON
    GO

    SET QUOTED_IDENTIFIER ON
    GO

    /****** Script for SelectTopNRows command from SSMS  ******/
    CREATE VIEW [dbo].[BI_BankRecApply_Smry]
    AS
    SELECT        dbo.BI_BankRecApply.[Bank Account No_], dbo.BI_BankRecApply.[Statement No_], SUM(dbo.BI_BankRecApply.[Statement Amount]) AS StmtAmt, SUM(dbo.BI_BankRecApply.[Applied Amount]) AS AppldAmt, 
                             SUM(dbo.BI_BankRecApply.BLEDebit) AS BLEDebit, SUM(dbo.BI_BankRecApply.BLECredit) AS BLECredit, SUM(dbo.BI_BankRecApply.BLEDebit - dbo.BI_BankRecApply.BLECredit) AS BLETotal, 
                             dbo.[CRONUS$Bank Acc_ Reconciliation].[Statement Ending Balance], dbo.[CRONUS$Bank Acc_ Reconciliation].[Balance Last Statement]
    FROM            dbo.BI_BankRecApply INNER JOIN
                             dbo.[CRONUS$Bank Acc_ Reconciliation] ON dbo.BI_BankRecApply.[Bank Account No_] = dbo.[CRONUS$Bank Acc_ Reconciliation].[Bank Account No_]
    GROUP BY dbo.BI_BankRecApply.[Bank Account No_], dbo.BI_BankRecApply.[Statement No_], dbo.[CRONUS$Bank Acc_ Reconciliation].[Statement Ending Balance], 
                             dbo.[CRONUS$Bank Acc_ Reconciliation].[Balance Last Statement]
    GO

    /****** Object:  View [dbo].[BI_BankRecApply_Smry2]    Script Date: 6/22/2018 2:10:17 PM ******/
    SET ANSI_NULLS ON
    GO

    SET QUOTED_IDENTIFIER ON
    GO

    CREATE VIEW [dbo].[BI_BankRecApply_Smry2]
    AS
    SELECT        [Bank Account No_], ([Balance Last Statement] - [Statement Ending Balance] + StmtAmt) * - 1 AS RndgAdjustment, StmtAmt, AppldAmt, BLEDebit, BLECredit, BLETotal, [Balance Last Statement], [Statement Ending Balance], 
                             BLETotal + [Balance Last Statement] AS CalcStmtBal
    FROM            dbo.BI_BankRecApply_Smry
    GO


    Thursday, June 21, 2018

    LS NAV - Printing Labels to a local printer takes very long over azure. Print ZPL to text, then send to Printer.


    • Objects 
      • Worksheets - Labels (10001280)
      • T10001338 Worksheet Lines
        • Createprintlabelrequests
      • C99001481 Label Utility
        • OrderShelfLabelsFromWorksheet
      • T99001574  Label Functions
      • T99001573 Shelf Label

    SQL - Database is too large, insufficient space, hard drive is full, large log file

    //Change MYDB to your database name
    /****** Script for SelectTopNRows command from SSMS  ******/
    USE MYDB;
    GO
    -- Truncate the log by changing the database recovery model to SIMPLE.
    ALTER DATABASE MYDB
    SET RECOVERY SIMPLE;
    GO
    -- Shrink the truncated log file to 1 MB.
    DBCC SHRINKFILE (MYDB_Log, 1);
    GO
    -- Reset the database recovery model.
    ALTER DATABASE MYDB
    SET RECOVERY FULL;
    GO

    Wednesday, June 20, 2018

    LS NAV - "UOM EA is not available for item" in POS after scanning an item

    Ensure you synch the two uofm tables

    • 204 - Unit of measure
    • 5404 - Item Unit of Measure

    Dynamics NAV - Users cannot see any companies

    User Access Control table is missing user permission set assignments.

    Insert records here to assign permissions to users.
    Use the powershell commands here

    https://docs.microsoft.com/en-us/previous-versions/dynamicsnav-2013r2/jj672890(v=nav.71)

    From powershell or administration shell, run as administrator
    New-NAVServerUser MicrosoftDynamicsNavServer -WindowsAccount Cronus\Chris

    New-NAVServerUserPermissionSet DynamicsNAV71 –WindowsAccount cronus\chris -PermissionSetId BASIC

    New-NAVServerUserPermissionSet CRONUS –WindowsAccount cronus\Joe -PermissionSetId SUPER


    eg.
    New-NAVServerUser BC150 -WindowsAccount mypc\test New-NAVServerUserPermissionSet BC150 –WindowsAccount mypc\test -PermissionSetId SUPER

    LS NAV - change the NAS Service Instance


    • General
      • Fill in the Services Default Company
      • Services Default Time Zone = "Server Time Zone"
    • NAS Services
      • Startup Argument
      • Startup codeunit
      • Startup Method



    Stop the old instance
    Create the new instance
    Start the new instance
    Restart the nav instance, it should detect the new nas instance and start using that automatically


    Dynamics NAV - The Specified Host Name is not valid

    Solution:
    Change default connection string on nav shortcut
    • Navigate to C:\Users\<user>\AppData\Roaming\Microsoft\Microsoft Dynamics NAV\110
    • Open ClientUserSettings in notepad
    • Change the Server Name to the correct server name
    • Look for     <add key="ClientServicesPort" value="7046"/>
      • Change it to the port of the instance you are trying to connect to
    • Look for      <add key="ServerInstance" value="DynamicsNAV71"/>
      • Chnage it to the name of the instance you are trying to connect to

    Tuesday, June 19, 2018

    LS NAV 2015-2017 Upgrade Errors


    • Retail Setup does not exist - Additional companies did not have a retail setup record causing the error
      • Record was copied from other companies

    SSRS - SQL 2012+ Reporting Services Migration Tool

    https://www.microsoft.com/en-us/download/details.aspx?id=29560

    This tool will allow you to backup the entire contents of your SSRS site, and import them to a new site if necessary, or just save as a backup.

    LS NAV - Data Upgrade - Hardware Usage - Upgrading to NAV 2017 on SQL 2017

    Get-NavDataUpgrade -Progress

    These figures are what were observed throughout the data upgrade process

    • Db server: used 22gb ram, 30% 2.3ghz, disk and network traffic max out at 1mbps 
    • App server: used 6gb ram, 30% 2.3ghz, disk and network traffic max out at 1mbps
    • 150gb database took 10 hours to complete

    Saturday, June 16, 2018

    LS NAV - Data Director - How to import the license


    • Get Data Director License from LS Retail
    • Launch DD Configuration Tool
    • Connect to server
    • Send License
    • Choose License file

    Thursday, June 14, 2018

    LS NAV - Return or Refund does not scan


    • Related to 
      • C99001570  POS Transaction
        • ProcessBarcode
      • C9908915 POS Refund Mgt
        • Initrefund
        • Createrefundlookup
      • C99008909 POS Transaction Server Utility
        • GetPostedTransaction - Web service fails

    • POS Functionality Profile>Web Requests
      • Add GetTransaction>Tick Active
      • New Web request in 11.02 changed from GET_TRANSACTION to GetTransaction
      • This web request must exist at HO and all POS
    • Create job to sync these tables
      • T99008941 Web Requests
      • T99008942 Web Request Setup
      • T99008947 Func. Prof. Web Request

    LS NAV - Tasklet Factory - Web Service Address URL


    • Go to Web Services
    • Look for the Tasklet Factory web Service TF Mobile WS Dispatcher
    • Copy the SOAP URL

    LS NAV - Receipt / Return Printing and Multiple Copies

    By default, LS NAV will print an original and a copy of everything to the OPOS
    If you setup a windows print, it will send one print to the receipt printer, and one print to the windows printer

    To get multiple copies if using the windows invoice, Retail Customer>Invoicing>Invoice Copies

    If using the OPOS, you would need to modify the C99008903 POS Print Utility>PrintSalesSlip
    Mod 7622 prevents the return from printing twice. Remove this mod to get two return prints.

    and set terminal > printing > slip of return > all returns

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

    • You can also modify the C99001570 to add a custom command, or modify the existing PRINT_SL command
    • Under Functionality Profile>POS Actions
      • On the End of Command Line, add "PRINT_SL" under the Action command column (or your custom command)

    -----------------------------------
    Install latest printer driver

    LS NAV - Discount Offer Objects


    • Discount Offer (P99001594)-Periodic Discount (T99001453)
      • P99001595 Discount Offer Lines - Periodic Discount Line (T99001454)

    LS NAV Upgrade - Converts Product Groups to Item Categories

    Upgrade turns product groups into item categories on item masters.

    Create import package from old with item categories
    Import to new items to update item category values

    LS NAV - Delete Logs, Clear Logs Manually, Logs take too long to delete


    • Scheduled Job - DELETELOGS should be scheduled to run nightly, after other important tasks are done
      • Scheduler Setup controls how many days of each to keep
    • Run C99001486 - DeleteLogs
      • Tables that can be cleared
        • Preaction
        • Action
        • Scheduler Log
        • Preaction Log
    • POS Functionality Profile-General-Days Transaction Exists
      •  has the number of days to keep logs. Anything older will be purged on login if the user says "yes" to purge

    Tasklet Factory - How to open a support request

    https://jira.taskletfactory.com/servicedesk/customer/portal/2

    Use "Problem with Mobile WMS"

    Wednesday, June 13, 2018

    LS NAV - Tasklet Factory - Scanning item barcodes submits leading zeroes even if none exist on barcode

    In the C6181388 TF Mobile WMS Toolbox: CheckCrossRef function
    use DELCHR(Scannedbarcode,'<','0');  
    To remove leading zeroes

    ----------------------------------
    --If it's not filtering orders correctly because of leading 0's
    ----------------------------------
    advanced: C6181388 TF Mobile WMS Toolbox>GetOrders function
    or
    basic: C6181374 TF Mobile WMS Pick>Search for ScannedValue
    ---------------------------------


    If this does not work, the other alternative is to include multiple barcodes on the items that include the leading zero so that any of the barcodes will find the item

    Tuesday, June 12, 2018

    LS NAV - Microsoft.Dynamics.Nav.Types.Exceptions.NavNCLTypeMappingException

    This error occurs if you attempt to copy or synchronize the permission tables from one database to another.

    You must export and import permissions.

    Run these to remove all users and allow you to enter the database.

    delete from [dbo].[User]
    delete from [dbo].[Access Control]
    delete from [dbo].[User Property]
    delete from [dbo].[Page Data Personalization]
    delete from [dbo].[User Default Style Sheet]
    delete from [dbo].[User Metadata]
    delete from [dbo].[User Personalization]

    NAV Logs

    Search for Change Log Entries
    Change Log Setup controls what is logged

    LS NAV - "You do not have the following permissions on CodeUnit Forecourt Tank Jnl.-Post Line: Execute"


    The Forecourt module was removed back in 2016 from the Starter Pack

    To fix this now, is to set the properties on the object to skip.


    • Open NAV Development Environment>Design C10012608
    • View>CAL Globals>Functions>OnPostItemJournalEvent>Properties
    • Set OnMissingLicense = Skip
    • Set OnMissingPermission = Skip


    Dynamics NAV - Bank Rec Objects


    • P379 - Bank Acc Reconciliaton - T273
      • P380 Bank Acc. Rec Lines - T274
        • Applied amount P372 Bank Account Ledger entries - T 271
    • P372-Bank Account Ledger Entries - T271 - Shows posted bank rec lines
    • R1407 Bank Account Statement (You can set anything in the report selection)


    • To get all unapplied bank Ledger Entries
      • T271 any record with a statement status of "Open"

    Saturday, June 9, 2018

    Dynamics GP - SQL View - Purchase Receipts vs Purchase Invoices vs Sales Invoice Lines

    This view was used to help identify costing differences between purchase receipts, purchase invoices and sales invoice lines

    This view was used as part of this solution
    https://community.dynamics.com/gp/b/dynamicsgpessentials/archive/2014/04/27/cost-layers-analysis-sql-script
    -------------------------------------------------------------------

    /****** Object:  View [dbo].[BI_INV_HITBTrx]    Script Date: 06/09/2018 8:05:50 PM ******/

    CREATE VIEW [dbo].[BI_INV_HITBTrx]
    AS
    SELECT        dbo.SEE30303.ITEMNMBR, dbo.SEE30303.SEQNUMBR, dbo.SEE30303.DOCDATE, dbo.SEE30303.GLPOSTDT, dbo.SEE30303.DOCNUMBR, dbo.SEE30303.DOCTYPE, dbo.SEE30303.LOCNCODE,
                             dbo.SEE30303.RCPTNMBR, dbo.SEE30303.RCTSEQNM, dbo.SEE30303.PCHSRCTY, dbo.SEE30303.QTYTYPE, dbo.SEE30303.UOFM, dbo.SEE30303.TRXQTYInBase, dbo.SEE30303.TRXQTY,
                             dbo.SEE30303.VARIANCEQTY, dbo.SEE30303.UNITCOST, dbo.SEE30303.EXTDCOST, dbo.SEE30303.DECPLQTY, dbo.SEE30303.DECPLCUR, dbo.SEE30303.IsOverrideReceipt, dbo.SEE30303.IsOverrideRelieved,
                             dbo.SEE30303.OverrideRelievedDate, dbo.SEE30303.RCPTNMBR1, dbo.SEE30303.HSTMODUL, dbo.SEE30303.ORTRXSRC, dbo.SEE30303.LNSEQNBR, dbo.SEE30303.LNITMSEQ, dbo.SEE30303.CMPNTSEQ,
                             dbo.SEE30303.SRCRFRNCNMBR, dbo.SEE30303.VENDORID, dbo.SEE30303.PONUMBER, dbo.SEE30303.TRXREFERENCE, dbo.SEE30303.VCTNMTHD, dbo.SEE30303.IVIVINDX, dbo.SEE30303.IVIVOFIX,
                             dbo.SEE30303.JRNENTRY, dbo.SEE30303.TRXSORCE, dbo.SEE30303.DEBITAMT, dbo.SEE30303.CRDTAMNT, dbo.SEE30303.DATE1, dbo.SEE30303.TIME1, dbo.SEE30303.DEX_ROW_ID,
                             dbo.GL00105.ACTNUMST AS IVOffsetAcc, dbo.GL00100.ACTDESCR AS IVOffsetAccDesc, GL00100_1.ACTDESCR AS IVAcc, GL00105_1.ACTNUMST AS IVAccDesc
    FROM            dbo.SEE30303 INNER JOIN
                             dbo.GL00100 ON dbo.SEE30303.IVIVOFIX = dbo.GL00100.ACTINDX INNER JOIN
                             dbo.GL00105 ON dbo.GL00100.ACTINDX = dbo.GL00105.ACTINDX INNER JOIN
                             dbo.GL00100 AS GL00100_1 ON dbo.SEE30303.IVIVINDX = GL00100_1.ACTINDX INNER JOIN
                             dbo.GL00105 AS GL00105_1 ON GL00100_1.ACTINDX = GL00105_1.ACTINDX

    GO
    -----------------------------------------------------------
    /****** Object:  View [dbo].[BI_POP_RctvsInvUnitCost]    Script Date: 06/09/2018 8:06:09 PM ******/

    CREATE VIEW [dbo].[BI_POP_RctvsInvUnitCost]
    AS
    SELECT        RCTHDR.POPRCTNM AS RctNum, RCT.RCPTLNNM AS RctLine, RCTHDR.GLPOSTDT AS RctPostDate, INVHDR.POPRCTNM AS InvNum, INVOICE.RCPTLNNM AS InvLine, INVHDR.GLPOSTDT AS InvPostDate,
                             RCT.ITEMNMBR AS RctItem, RCT.ITEMDESC AS RctItemDesc, RCT.UNITCOST AS RctUnitCost, INVOICE.UNITCOST AS InvUnitCost, RCT.EXTDCOST AS RctExtCost, INVOICE.EXTDCOST AS InvExtCost,
                             RCT.LOCNCODE AS RctLocation, InvLayers.RctSold, InvLayers.QtyRcd, InvLayers.QtySold, RCT.NONINVEN, INVOICE.TRXSORCE AS InvTrxSource, RCT.TRXSORCE AS RctTrxSource
    FROM            dbo.POP30310 AS RCT LEFT OUTER JOIN
                                 (SELECT        RCPTNMBR, ITEMNMBR, SUM(RCPTSOLD) AS RctSold, SUM(QTYRECVD) AS QtyRcd, SUM(QTYSOLD) AS QtySold
                                   FROM            dbo.IV10200 AS IV10200_1
                                   GROUP BY ITEMNMBR, RCPTNMBR) AS InvLayers ON RCT.POPRCTNM = InvLayers.RCPTNMBR AND RCT.ITEMNMBR = InvLayers.ITEMNMBR LEFT OUTER JOIN
                             dbo.POP30300 AS RCTHDR ON RCT.POPRCTNM = RCTHDR.POPRCTNM RIGHT OUTER JOIN
                             dbo.POP30300 AS INVHDR RIGHT OUTER JOIN
                             dbo.POP30310 AS INVOICE ON INVHDR.POPRCTNM = INVOICE.POPRCTNM RIGHT OUTER JOIN
                             dbo.POP10600 ON INVOICE.POPRCTNM = dbo.POP10600.POPIVCNO AND INVOICE.RCPTLNNM = dbo.POP10600.IVCLINNO ON RCT.POPRCTNM = dbo.POP10600.POPRCTNM AND
                             RCT.RCPTLNNM = dbo.POP10600.RCPTLNNM

    GO
    --------------------------------------------------------------
    /****** Object:  View [dbo].[BI_POP_RctvsSOP]    Script Date: 06/09/2018 8:06:44 PM ******/

    CREATE VIEW [dbo].[BI_POP_RctvsSOP]
    AS
    SELECT        CASE A.RCPTSOLD WHEN 1 THEN 'Closed' WHEN 0 THEN 'Open' ELSE 'NA' END AS [Cost Layer Status], A.RCPTNMBR AS [In Receipt Number],
                             CASE A.PCHSRCTY WHEN 1 THEN 'Adjustment' WHEN 2 THEN 'Variance' WHEN 3 THEN 'Transfer' WHEN 4 THEN 'Override' WHEN 5 THEN 'Receipt' WHEN 6 THEN 'Return' WHEN 7 THEN 'Assembly' WHEN 8 THEN
                              'In-Transit' ELSE 'NA' END AS [In Transaction Type], A.DATERECD AS [In Date Received], A.ITEMNMBR AS [In Item Number], A.TRXLOCTN AS [In Transaction Location], A.QTYRECVD AS [In Quantity Received],
                             A.QTYSOLD AS [In Quantity Sold], A.UNITCOST AS [In Unit Cost], A.RCTSEQNM AS [In Receipt Sequence Number], ISNULL(B.ORIGINDOCID, ' ') AS [Out Document Number], ISNULL(B.DOCDATE, ' ')
                             AS [Out Document Date], ISNULL(B.ITEMNMBR, ' ') AS [Out Item Number], ISNULL(B.TRXLOCTN, ' ') AS [Out Transaction Location], ISNULL(B.QTYSOLD, 0) AS [Out Quantity Sold], ISNULL(B.UNITCOST, 0)
                             AS [Out Unit Cost], ISNULL(B.SRCRCTSEQNM, ' ') AS [Out Source Receipt Sequence Number], ISNULL(C.SOPTYPE, ' ') AS [SLS SOP Type], ISNULL(C.SOPNUMBE, ' ') AS [SLS SOP Number], ISNULL(C.UNITPRCE,
                             0) AS [SLS SOP Unit Price], C.LNITMSEQ, dbo.SOP30200.DOCDATE AS SlsDocDate, dbo.SOP30200.GLPOSTDT AS SlsPostDate
    FROM            dbo.SOP30200 INNER JOIN
                                 (SELECT        CASE SOPTYPE WHEN 1 THEN 'Quote' WHEN 2 THEN 'Order' WHEN 3 THEN 'Invoice' WHEN 4 THEN 'Return' WHEN 5 THEN 'Back Order' WHEN 6 THEN 'Fulfillment Order' ELSE 'NA' END AS SOPTYPE,
                                                              SOPNUMBE, ITEMNMBR, LOCNCODE, UNITCOST, UNITPRCE, LNITMSEQ, SOPTYPE AS sopcode
                                   FROM            dbo.SOP30300) AS C ON dbo.SOP30200.SOPNUMBE = C.SOPNUMBE AND dbo.SOP30200.SOPTYPE = C.sopcode RIGHT OUTER JOIN
                             dbo.IV10200 AS A LEFT OUTER JOIN
                             dbo.IV10201 AS B ON A.ITEMNMBR = B.ITEMNMBR AND A.TRXLOCTN = B.TRXLOCTN AND A.RCTSEQNM = B.SRCRCTSEQNM ON C.SOPNUMBE = B.ORIGINDOCID AND C.ITEMNMBR = B.ITEMNMBR AND
                             C.LOCNCODE = B.TRXLOCTN

    GO
    ---------------------------------------------------
    --This is the final view with all info combined
    /****** Object:  View [dbo].[BI_POP_RctvsInvvsSOP]    Script Date: 06/09/2018 8:05:29 PM ******/

    CREATE VIEW [dbo].[BI_POP_RctvsInvvsSOP]
    AS
    SELECT        dbo.BI_POP_RctvsSOP.[Cost Layer Status], dbo.BI_POP_RctvsSOP.[In Transaction Type], dbo.BI_POP_RctvsSOP.[In Date Received], dbo.BI_POP_RctvsSOP.[In Item Number],
                             dbo.BI_POP_RctvsSOP.[In Transaction Location], dbo.BI_POP_RctvsSOP.[In Quantity Received], dbo.BI_POP_RctvsSOP.[In Quantity Sold], dbo.BI_POP_RctvsSOP.[In Receipt Sequence Number],
                             dbo.BI_POP_RctvsSOP.[Out Document Number], dbo.BI_POP_RctvsSOP.[Out Document Date], dbo.BI_POP_RctvsSOP.[Out Item Number], dbo.BI_POP_RctvsSOP.[Out Transaction Location],
                             dbo.BI_POP_RctvsSOP.[Out Source Receipt Sequence Number], dbo.BI_POP_RctvsSOP.[SLS SOP Type], dbo.BI_POP_RctvsSOP.[SLS SOP Unit Price], dbo.BI_POP_RctvsSOP.LNITMSEQ,
                             dbo.BI_INV_HITBTrx.IVOffsetAcc, dbo.BI_INV_HITBTrx.IVOffsetAccDesc, dbo.BI_INV_HITBTrx.IVAcc, dbo.BI_INV_HITBTrx.IVAccDesc, dbo.BI_POP_RctvsSOP.[In Receipt Number],
                             dbo.BI_POP_RctvsSOP.[In Unit Cost], dbo.BI_POP_RctvsInvUnitCost.InvNum, dbo.BI_POP_RctvsInvUnitCost.InvUnitCost, dbo.BI_POP_RctvsSOP.[SLS SOP Number], dbo.BI_POP_RctvsSOP.[Out Quantity Sold],
                             dbo.BI_POP_RctvsSOP.[Out Unit Cost], dbo.BI_POP_RctvsSOP.SlsDocDate, dbo.BI_POP_RctvsSOP.SlsPostDate
    FROM            dbo.BI_POP_RctvsSOP LEFT OUTER JOIN
                             dbo.BI_POP_RctvsInvUnitCost ON dbo.BI_POP_RctvsSOP.[In Receipt Number] = dbo.BI_POP_RctvsInvUnitCost.RctNum AND
                             dbo.BI_POP_RctvsSOP.[In Item Number] = dbo.BI_POP_RctvsInvUnitCost.RctItem LEFT OUTER JOIN
                             dbo.BI_INV_HITBTrx ON dbo.BI_POP_RctvsSOP.[In Item Number] = dbo.BI_INV_HITBTrx.ITEMNMBR AND dbo.BI_POP_RctvsSOP.LNITMSEQ = dbo.BI_INV_HITBTrx.LNITMSEQ AND
                             dbo.BI_POP_RctvsSOP.[SLS SOP Number] = dbo.BI_INV_HITBTrx.DOCNUMBR

    GO

    Friday, June 8, 2018

    Dynamics GP - SQL VIEW - Received Costs vs Invoiced Costs - see where costing went wrong

    This view should be used to help identify any discrepancies in item costing if the automatic revaluation was not enabled


    • Objects used
      • POP30300 - RctHeader Hist (Receipts and invoices)
      • POP30310 - RctLineHist (Receipts and invoices)
      • POP10600 - Rct to Invoice Match
      • IV10200 - Inv Cost layers



    CREATE VIEW [dbo].[BI_POP_RctvsInvCost]
    AS
    SELECT        RCTHDR.POPRCTNM AS RctNum, RCT.RCPTLNNM AS RctLine, RCTHDR.GLPOSTDT AS RctPostDate, INVHDR.POPRCTNM AS InvNum, INVOICE.RCPTLNNM AS InvLine, INVHDR.GLPOSTDT AS InvPostDate, 
                             RCT.ITEMNMBR AS RctItem, RCT.ITEMDESC AS RctItemDesc, RCT.EXTDCOST AS RctExtCost, INVOICE.EXTDCOST AS InvExtCost, InvLayers.RctSold, InvLayers.QtyRcd, InvLayers.QtySold
    FROM            dbo.POP30310 AS RCT LEFT OUTER JOIN
                                 (SELECT        RCPTNMBR, ITEMNMBR, SUM(RCPTSOLD) AS RctSold, SUM(QTYRECVD) AS QtyRcd, SUM(QTYSOLD) AS QtySold
                                   FROM            dbo.IV10200 AS IV10200_1
                                   GROUP BY ITEMNMBR, RCPTNMBR) AS InvLayers ON RCT.POPRCTNM = InvLayers.RCPTNMBR AND RCT.ITEMNMBR = InvLayers.ITEMNMBR LEFT OUTER JOIN
                             dbo.POP30300 AS RCTHDR ON RCT.POPRCTNM = RCTHDR.POPRCTNM RIGHT OUTER JOIN
                             dbo.POP30300 AS INVHDR RIGHT OUTER JOIN
                             dbo.POP30310 AS INVOICE ON INVHDR.POPRCTNM = INVOICE.POPRCTNM RIGHT OUTER JOIN
                             dbo.POP10600 ON INVOICE.POPRCTNM = dbo.POP10600.POPIVCNO AND INVOICE.RCPTLNNM = dbo.POP10600.IVCLINNO ON RCT.POPRCTNM = dbo.POP10600.POPRCTNM AND 
                             RCT.RCPTLNNM = dbo.POP10600.RCPTLNNM

    GO

    Thursday, June 7, 2018

    LS NAV - Modify the Statement-Post routine to pass Salesperson Code to the Customer Ledger Entry when posting Sales Transactions

    By default, the salesperson from the Transaction Register does not get passed to the Customer Ledger entry when statements are posted.

    To modify this:

    • Objects
      • C99001457 Statement-Post
        • Function PostToCustomer
    • Create new Function
      • GetPOSTrxSR
        • Parameters - Store(code) Terminal(code), Trx (int)
        • Variables - TSE (rec, Trans. Sales Entry)
        • Return - SR (text)
    GetPOSTrxFirstSR(Store : Code[10];Terminal : Code[10];Trx : Integer) SR : Text
    // Uses FIRST Sales Staff - SR code if exists(comes from SALESP POS Command). Otherwise, defaults to customer SR
    TSE.SETRANGE("Store No.",Store);
    TSE.SETRANGE("POS Terminal No.",Terminal);
    TSE.SETRANGE("Transaction No.",Trx);
    IF TSE.FIND('-') THEN BEGIN
      REPEAT
        IF TSE."Sales Staff" > '' THEN BEGIN
          Staff.SETRANGE(ID,TSE."Sales Staff");
            IF Staff.FIND('-') THEN BEGIN
              IF (SR = '') AND (Staff."Sales Person" > '') THEN BEGIN
                SR := Staff."Sales Person";
              END;
            END;
        END;
      UNTIL TSE.NEXT <=0;
    //If SR blank, use customer default
      IF SR = '' THEN BEGIN
        TH.SETRANGE("Store No.",Store);
        TH.SETRANGE("POS Terminal No.",Terminal);
        TH.SETRANGE("Transaction No.",Trx);
        IF TH.FIND('-') THEN BEGIN
          Cus.SETRANGE("No.",TH."Customer No.");
          IF Cus.FIND('-') THEN BEGIN;
          SR := Cus."Salesperson Code";
          END;
        END;
      END;
    END;
    • Modify Statement-Post
      •    GenJnlLine.VALIDATE("Salespers./Purch. Code",DT.GetPOSTrxFirstSR(Transaction."Store No.",Transaction."POS Terminal No.",Transaction."Transaction No."));
      •  

    NAV - Modify the Commission Report

    The default functionality of the commission % on the T13 Salesperson/Purchaser is to calculate commission based on Sales.
    We want to calculate commission based on payments recieved


    • When calculating and posting statements, NAV salesperson information is not populated to the customer ledger entry tables
    • Modify R115 Salesperson - Commission to add a calculation based on payments only, hide other commissions
      • Invoice Date, Invoice No, Customer Name, Amount Paid, Comm%, Comm Amt, Remarks (payment no.)
      • Group by Salesrep
      • Total Amount Paid, Comm Amt
      • Filter by invoice date and salesrep
      • SR Signature, Manager Signature
    • Other Objects
      • T21 Cust. Ledger Entry
      • Detailed Cust. Ledg. Entry (T379)
        • Need the sum of this to get unapplied amounts
      • T18 Customer
    • Modification Notes
      • T21 document type: 1 (Payment)



    Wednesday, June 6, 2018

    LS NAV - How to add an Item Group navigation menu to the POS


    • Launch POS, Right click>Panel Properties
    • Increase column amount>Add column
    • Under pos panel control lines
      • Screen will draw based on Line numbers, then columns, then rows. 
      • The column and row selected is where the top left starts drawing from
      • Row span and column span are applied last
    • Control Type: Button Pad
    • Control ID: #ITEMGROUPS
      • Copy these if necessary from other profiles
      • Create POS Button Control Card #ITEMGROUPS
        • Create Menu ID #ITEMGROUPS
          • Create POS Menu #ITEMGROUPS as Menu
            • Add line showpanel, parameter ITEMGROUPS
              • Create POS Panel Card ITEMGROUPS
                • Insert Line type Button Pad, Control Id: ITEMGROUPS
                  • Create POS Button Pad Control Pad: Menu ID: FRUIT
                    • Create POS Menu FRUIT
                      • Add lines command: PLU_K, Parameter: Item Number (This is what turns into your final buttons that will populate POS lines when pressed)

    LS NAV - Cannot right click on POS to edit button properties


    • In CRONUS Search for Context Menus
    • Copy all Context Menus to your live company
      • POS Context Menu (T99008938)
      • POS Context Menu Line (T99008939)
    • Retial Users>Enable POS Super User for user

    Dynamics NAV - Export Permission Sets and Permissions

    Run X9171 and X9172 direction: Export

    Then Run X9171 and X9172 direction: Import to import the files


    If you need to clear existing permission sets and permissions, DO NOT DELETE them from the page, it will delete all of the user assignments as well.
    Delte the Permission and Permission Set tables directly out of sql, then reimport using the xmlport

    LS NAV - Add POS menu and button with all customer options to add to transaction, create or edit

    POS Menu M1-CUST has all examples

    • Create new to copy POS menu to current Profile
    • Button to open menu: 
      • Command: IMENU
      • Parameter: M1-CUST
    • Restart POS

    • Button setup
      • Select customer: SELECTCUST
      • Edit/New customer: VIEW_CUSTOMER

    Tuesday, June 5, 2018

    LS NAV - POS Command codeunit

    All POS Command logic is stored in C99001570 - POS Transaction

    To debug any error that displays in the POS display, put a debug point on
    C99001570
    MessageBeep(Txt : Text)
    OnBeforeMessageBeep(REC,COPYSTR(Txt,1,100));

    or
    ErrorBeep(Txt : Text)

    LS NAV - How to install the online help

    By default, the NAV help that comes upwhen you press F1 does not include nay help on the LS objects.

    To update the existing help with additional LS NAV help

    • Download LS NAV install, and extract to the default location
    • Navigate to  C:\LS Retail\LS11.01\Online Help
    • Run the exe
    • It will prompt for the location to install the help
    • You must enter the same location as the existing NAV help
      • This is the default location for the NAV help
      • C:\Inetpub\wwwroot\DynamicsNAV110Help
    • It will install, then prompt to open help
    • The help is context sensitive, and will navigate to appropriate help when selecting a field, and using the F1 key

    LS NAV - Staff POS Specific Options

    If you configure any of these options directly on the Staff card, they will override any other store or terminal settings
    • POS Profiles
      • Interface Profile
        • General Settings for POS behaviour
        • General Layouts and Controls
        • Eg. Cashier layout vs Information Terminal
      • Menu Profile
        • Control Visual Appearance and colors
        • Control which specific menu layouts to use for different functions
        • Eg. Grocery Checkout vs Cafeteria checkout
      • Style Profile
        • Control color schemes, fonts and skins on buttons
        • Eg. Cashier colors vs Manager colors

    LS Nav - Create POS user Login Button

    Staff must have no password

    Command: Alphanum_k
    Parameter: Staff ID
    Post Command: OK

    Monday, June 4, 2018

    SSRS - Sys.webforms.pagerequestmanagerservererrorexception: An unknown error occurred while processing the request on the server. The status code returned form the server was: 500

    Background:
    The report would run if a small range was entered. (4 at a time)
    It would only throw this error if no filters were used.
    The report used to work in the past, and suddenly one day starting giving the error.
    The report was calling a subreport that would be called multiple times

    Cause:
    The view that was being used as the source for the SSRS report had multiple unions, partitions and calculations in the logic.
    A stored procedure was created to output the view to a table first.
    The SSRS was then connected to that table, and everything worked fine.

    Conclusion:
    SSRS cannot handle extremely complex views as data sources.
    You must output the results to a table first before handing to SSRS.

    Friday, June 1, 2018

    LS Nav - Apply payment to AR Invoice through POS

    Scenario:
    A Regular NAV invoice was done for a customer 30 days ago. Customer walks in to store to pay invoice through the POS.

    Requirements:
    Cashier must be able to select customer account, take the payment, pull up a list of his open AR transactions, select he invoice to pay, and apply the payment.

    Setup:

    http://help.lsnav.lsretail.com/Content/LS%20Retail/POS/Functionality/Commands.htm

    To achieve this, the following steps were taken


    • Create a "PAY AR" button that kicks off the AR process, and requests the invoice number to be paid
      • Create button with command: PAYM_ACC_INV calls the payment against invoice command and uses your selection
      • Parameter: Tender code (4 is Customer Account, Default function must = Customer)
    • Create a "OPEN AR" button that displays all open AR
      • Create button with command: LOOKUP
      • Create Parameter for OPENAR_LU in the POS Lookup Card screen 
        • MenuID: #LOOKUP-FI to get filters in the lookup
        • Input Control ID: #LOOKUPINPUT 
      • Create Data Table ID #OPENAR in the POS Data Table screen
        • Table 21
        • Cols:4, Rows:15, key: 6
        • Selectionmode: SelectOne
        • Set first column to DocumentNo
        • Default search command: filter
        • Set Indexes on columns to make them filterable and sortable
    • Process
      • User clicks PAY AR
      • POS prompts for invoice
      • User clicks OPEN AR
      • Filter, and select invoice to be paid
      • POS Prompts for amount to pay
      • Enter amount to pay
      • Select Tender Type
      • Transaction completes, Receipt prints
      • End of Day - Applications do not appear on account or against invoice until statement is posted
      • After posting statement, Payments appear on customer account applied against invoice
    Application data is stored in the Transaction Header.Apply to Doc. No. field
    *Notes
    Even if a payment has been taken for an invoice, the POS will not prevent additional payments to the same invoice.
    To remove the paid invoices from the datatable list

    • Modify T21 Add flowfield ToBeAppliedFromPOS to calculate sum of Transaction Header.Amount to Account matched on apply to doc no field and Customer No.
    • Add field to datatable so user can see if any payments were previously applied from this pos

    LS NAV - Change Salesperson on POS Transaction

    http://help.lsnav.lsretail.com/Content/How%20To/How%20to%20Link%20Sales%20Person%20to.htm

    http://help.lsnav.lsretail.com/Content/LS%20Retail/POS/Functionality/Commands.htm

    SALESP Command can be added to POS button to prompt user to change salesperson id on the transaction.

    Salesperson ID can only be another Staff that is configured as a salesperson. The Staff can be linked to an existing NAV Salesperson


    • Create Staff SR's
    • Create Real SR's in Salespeople menu, Assign to Staff SR's
    • Sync Table 13, and all staff tables


    On the functionality profile,

    • Sales Person Mode - Manual: allows you to manually enter a salesperson
    • Sales Person Mode - Automatic: forces you to enter a salesperson every time you start a transaction

    If you accidentally add salespersons, they cannot be removed. You must void and redo the transaction.

    Added Salespersons appear in the Trans_Sales Entry.Staff ID (only the last SR entered) per line

    When statements are posted, the salesperson information does NOT go to the Customer Ledger entries, but lives on the Trans_ Sales Entry as the Staff ID
    To modify this behaviour, and put the SR Code into the Customer Ledger Entry, check
    http://cowmasterscorner.blogspot.com/2018/06/ls-nav-modify-statement-post-routine-to.html

    To add a button to bring up a list of salespersons





  • Create a "OPEN SR" button that displays all SR's assigned to the store

    • Create Staff and assign them as Sales Persons with the appropriate SR id's attached
    • Create button with command: LOOKUP
    • Create Parameter for SR in the POS Lookup Card screen 
      • MenuID: #LOOKUP-FI to get filters in the lookup
      • Input Control ID: #LOOKUPINPUT 
    • Create Data Table ID SR in the POS Data Table screen
      • Table 99001461
      • Selectionmode: SelectOne
      • Set columns to
        • ID
        • First Name
        • Last Name
        • Employment Type
        • Sales Person
        • Store No.
      • Default search command: filter
      • Set Indexes on columns to make them filterable and sortable
      • Set filters as
        • Employment Type - Fixed filter "Sales Person|Both" (no quotes)
        • Store no. - Fixed Filter [STORE] (to use the current store)

    Dynamics GP - Key Segment Not found

    This error comes up when attempting to print a check from the AP screen.

    https://support.microsoft.com/en-us/help/2492442/key-segment-not-found-error-registering-table-or-table-open-error-mess


    Causes:
    Corrupted Forms or Report dictionary
    Client is the wrong version