Tuesday, December 22, 2015

Dynamics NAV - How to use Mergetool to merge Code

http://mergetool.com/addin_e/faq/FAQ_MERGETOOLTRAINING_WEB.htm

  • Download Mergetool and extract it
  • Look for the appropriate fob file to import to your NAV instance
    • Read the Readme in the extract to get the version number list
    • MGTx.xx.xx 7.10.fob = NAV 2013 R2
  • Create a new Database
    • Nav Admin>New>Database
  • Restore your old database into the new database
  • Import the Mergetool objects into the new database
  • Recompile all objects
  • Search for Mergetool
    • Click Versions to initialize values
  • Import all NEW text Codeunits and give them a version name
  • Import all OLD text Codeunits and give them a different version name
  • Import all BASE text Codeunits from the sample company of the final version you wish to merge into
  • Create a Blank Version MERGED to dump the final merged objects into
  • Compare the NEW and OLD
    • Click on Compare and look through the code line by line to determine what changes were made
    • Use Lines Log to see all differences
    • or Line Compare to see both files
    • This will give you an idea of how likely the files will merge correctly
  • Click merge
    • Select Old Version as BASE
    • New Version as OLD
    • Custom Version as NEW
    • New Custom as MERGED
    • Add new version = first
    • Skip if manual = true
    • Copy added new objects = true
    • Copy added custom objects = true
  • After it runs through once, set skip if manual to false, and run it again to see all the manual changes

Monday, December 21, 2015

Bixolon OPOS S-390plus POS Printer - OPOS_E_FAILURE - Print Buffer Error

Something is wrong with the memory on the printer, get a new printer, or replace the memory

Dynamics NAV - Logging, Auditing, Tracking - Change Log

To Track data changes in the system use the Change Log Entry screen

  • Search for Change Log
  • Click on Actions>Tables
    • Select tables to track
    • select fields to track
  • Tick Enable logging

Friday, December 18, 2015

Dynamics NAV - How to setup Mix & Match to print a line on the receipt when a customer purchases $100 worth of items within a specific set of groups


If a customer buys $100 worth of items across a number of specific item groups, print an extra line on the receipt indicating “Collect Free Bag from Sales Rep”
 

To achieve this, we will use the Mix and Match, with an additional benefit item (at 0 price) that has an extra print setup on it with the required message “Collect free bag”

 

·         Mix & Match Screen

o   Mix & Match Lines

§  Add all special groups, items, groups, etc. that should trigger this promotion

§  If there is no minimum quantity required, set the No. of items needed to 1

o   Triggers

§  Enter the Amount to Trigger (in this example, you would enter 100)

o   Additional Benefits

§  Add a 0 price/cost item with an Extra Print setup with the required message


Thursday, December 17, 2015

Dynamics GP -Lexmark Printers print strange fonts - line sizes are half sized, lines print one on top the other

The Lexmark driver may be causing problems
  • There is a mode to switch the Lexmark to emulate Epson behaviour
  • Or you can install and use a Generic Text driver for the printer

Dynamics NAV - LS REtail - Data Director - Enable Logging



How to activate File Debug Logging



1. Open the Data Director Configuration Tool as administrator.

2. Go to the Debugging tab

3. Select the server and press Get Config button.

4. Set the Startup level at 15 for both Router and Database.

5. Press the Save Config and restart the Data Director

The log files will appear under the Log folder in the Data Folder (see the Base Config tab)

For my setup, the logs will be in C:\ProgramData\LS Retail\Data Director\Log and the data files will be in C:\ProgramData\LS Retail\Data Director\Work


Wednesday, December 16, 2015

Receipt Printer - How to add a logo to receipt printer using NV Image tool: Bixolon SRP 350 plus

  • http://www.titanpos.co.za/downloads/Utilities/NV%20Image%20Tool%20V3.1.6(Eng)/NV%20Manual%20english_Rev_2_05.pdf
  • Run Bixolon OPOS Setup Utility
    • Select Printer
    • Change ports and checkhealth until you find the port the printer is connected to
    • Return to main menu
  • Select printer
    • Click NV Image
    • Click NV Image Tool
    • Click Port Setting
      • Select Printer Model SRP-350plus
      • Select Interface - select port
      • Click Download
      • Click Download Start
        • This will clear all images from the printer, and upload the selected image
        • Click print to print a sample
          • Tick Add Header
        • Test the printer

Monday, December 14, 2015

Dynamics NAV - How to fix an existing item cost that is currently incorrect - Wrong Costs - Cost Revaluation

  • Method 1 - The Proper Way - Only works if cost is coming from invoicing
    • Do return transactions to cancel the original invoices
    • Re-receive at the correct cost at the original date
  • Method 2 - Using a Revaluation Journal
    • Run Adjust Costs against the item you wish to revalue to ensure no outstanding adjust cost jobs exist
    • Ensure that the posting periods are open
    • Open Revaluation Journal Entry window
      • Click Calculate Inventory Value
      • Enter the date the costing error happened
      • Enter filter for item no.
        • If using average costing, calculate per item (not item ledger entry), location, variant
      • Enter any filters as required
      • Leave all other fields blank, click ok
      • System will populate the revaluation journal with all value entries
      • Change the Unit Cost (Revalued) column to the value you want
      • Post the revaluation entry
      • Run the adjust cost
      • This will also resolve any sales at historical incorrect costs.
  • Method 3 - Reset Stock (This is your only option if using average costing)
    • Adjust all stock out as at yesterday, or some previous date period that will allow you to adjust in new stock using a different date
      • We do not want to do the adjust out and adjust in on the same date or it will cause the average cost to average incorrectly
      • Example 
        • Change posting dates to 30-Jan-20
          • Whse. Phys. Inv. journal>Set to 0>Register (Ignore this step if not using warehousing)
          • Physical Inventory Journal>Set to 0, post
        • Change posting dates to 31-Jan-20
          • Whse. Phys. Inv. journal>Set to Stock amount>Register (Ignore this step if not using warehousing)
          • Physical Inventory Journal>Set to stock amount>Set new Cost>, post
        • This way it correctly calculates a new average cost on 31-Jan-20

Friday, December 11, 2015

Dynamics NAV - User Permissions View - User Access List

View showing all users and all assigned permission groups

SELECT dbo.[Access Control].[Company Name], dbo.[User].[User Name], dbo.[Access Control].[Role ID]

FROM dbo.[Access Control] INNER JOIN

dbo.[User] ON dbo.[Access Control].[User Security ID] = dbo.[User].[User Security ID]

Thursday, December 10, 2015

Dynamics NAV - LS Retail - Data Director - Jobs stuck in "PreProcessed"

There is some large job that is stuck in Data Director being processed, and sticking the queue.

Resolution:
Restart the Data Director Service.
You will lose any jobs that are currently in the queue. Remember to reset the replication counters and re-send them.
  • Launch DD configuration Tool
  • Select Head Office
  • Click Stop DD
  • Click Start DD

Dynamics NAV - LS Retail - Scheduler Job Record Filter

  • Edit Subjob>Navigate>From Table Filters
    • Use Filter Type "Filter" its the only one that works
    • It will insert this value directly into the SQL query
    • It can only hold 12 characters
  • Eg. Filter1 value to filter a date should be
  • ='20160120'
  • If using the sql filter
    • Also try '2016-6-20' because the field only accepts 12 characters in the filter
Example - How to set the filter to the current date for a subjob using CAL code

SJFilt."Value 1" := '='+ '''' +  FORMAT(DATE2DMY(TODAY,3),4)+
CONVERTSTR(FORMAT(DATE2DMY(TODAY,2),2),' ','0')+ CONVERTSTR(FORMAT(DATE2DMY(TODAY,1),2),' ','0') + ''''


SJFilt."Value 1" := '='+ '''' + FORMAT(DATE2DMY(CALCDATE('<1D>',TODAY),3),4)+ CONVERTSTR(FORMAT(DATE2DMY(CALCDATE('<1D>',TODAY),2),2),' ','0')+ CONVERTSTR(FORMAT(DATE2DMY(CALCDATE('<1D>',TODAY),1),2) ,' ','0')+ '''' ;

Example2 - How to set the filter to the current date for a subjob using sql

update [Cronus].[dbo].[Cronus$Scheduler Subjob Filter] set [Value 1] = '>'+'''' + cast(year(getdate()) as varchar) +  right('0' + cast(month(getdate()) as varchar),2) +  right('0'+case when day(getdate()) = 1 then cast(day(getdate()) as varchar) else cast(day(getdate())-1 as varchar) end,2) + ''''  FROM [Cronus].[dbo].[Cronus$Scheduler Subjob Filter] where [Subjob ID] = 'ITEM_DATE_FILTER'

Wednesday, December 9, 2015

Dynamics NAV - LS Retail - POS Replication - How to resend the last x action updates

Reduce the replication counter on the corresponding replication counter line on the job header for the number of actions you wish to resend
You can check the Preaction Log or the Preaction list to see what jobs have already gone through, or are pending to go through.

Dynamics NAV 2013 R2 - How to resolve CONSISTENCY error

  • Import this codeunit (save as text and import and compile)
---------------------------------------------------------------------------------------------


OBJECT Codeunit 50089 Single Instance CU-GL Consist
{
  OBJECT-PROPERTIES
  {
    Date=10/29/15;
    Time=[ 1:15:17 PM];
    Modified=Yes;
    Version List=MOD01;
  }
  PROPERTIES
  {
    Permissions=TableData 17=rimd;
    SingleInstance=Yes;
    OnRun=BEGIN
            IF NOT StoreToTemp THEN BEGIN
              StoreToTemp := TRUE;
            END ELSE
              PAGE.RUN(0,TempGLEntry);
          END;
  }
  CODE
  {
    VAR
      TempGLEntry@1000000000 : TEMPORARY Record 17;
      StoreToTemp@1000000001 : Boolean;
    PROCEDURE InsertGL@1000000000(GLEntry@1000000000 : Record 17);
    BEGIN
      IF StoreToTemp THEN BEGIN
        TempGLEntry := GLEntry;
        IF NOT TempGLEntry.INSERT THEN BEGIN
           TempGLEntry.DELETEALL;
           TempGLEntry.INSERT;
       END;
      END;
    END;
    BEGIN
    {
      Used for debugging GL Consistency errors.
      See CU 12
      Steps:
      1. Run CU and it will start in memory
      2. Run any posting that generates a consistency error
      3. Run CU again and the GL that would have posted will be shown
    }
    END.
  }
}


----------------------------------------------------------------------------------------------
  • Modify C12 - FinishPosting
    • Look for these lines 
    • Insert the code between //MOD

    • GlobalGLEntry.INSERT;
      //MOD
      SingleCU.InsertGL(GlobalGLEntry);
      //MOD
        UNTIL TempGLEntryBuf.NEXT = 0;
       
  • Add Global Variable SingleCU = Codeunit, Single Instance CU-GL Consist
  • Run CU and it will start in memory
  • Run any posting that generates a consistency error
  • Run CU again and the GL that would have posted will be shown
  • Copy and paste the results to Excel
  • Sort by account
  • Subtotal by account
  • Manually Sum totals for all Sales
  • Manually Sum totals for all Receipts
  • Compare the totals and work through the figures to find where the numbers do not match
  • General problem areas
    • Rounding causes minor differences and no rounding account is setup, so rounding differences are lost, causing inconsistencies
    • VAT causes rounding and above problem
    • Discounts cause rounding and above problem
    • Currency Exchange rates cause the above problem
    • Records are missing from the Sales_Trans_Entry table if dealing with statements
    • Total Payments do not match Total receipts
  • To resolve the issue
    • Determine the root cause of the differences to prevent future errors
    • Cancel, reverse, void or redo the transaction if possible
    • LAST RESORT: You may need to modify the Sales_Trans_Entry table record values to force a match to allow the current transaction to post if dealing with statements

Wednesday, December 2, 2015

Dynamics NAV - Change VAT %

  • When changing VAT, the problem of re-calculating Unit Price, and Unit Price Including VAT occurs
    • The Unit Price or Unit Price including VAT will not change unless the price is actually changed manually, or in a package
  • To resolve this issue
    • Stop Nav Scheduler to prevent changes from going to terminals
    • Export Current Items and Sales Prices
      • Export all Item no,, VAT Prod Posting Group, Unit Prices, Unit Price including VAT to excel package template
        • Split this into 2 templates, 
          • one for items with new prices - IC
          • one for items where prices are not changing - INC
      • Export all Sales Prices with no ending date to excel package template
        • Split this into 2 templates, 
          • one for items with new prices - PC
          • one for items where prices are not changing - PNC
    • Change VAT % (see methods below)
    • Import Item updates
      • For the INC List, set all item card prices including vat to 0
        • Import and apply this package
        • Then set all prices to the new selling price including VAT
        • Import and apply this package
          • This is to get NAV to reverse calculate the correct Unit Price without VAT
      • For the IC list, just import and apply
    • End all current Sales Prices
      • This is done as a precaution to ensure no old prices are missed
      • Run a SQL update to put an ending date on all sales prices with no ending date
      • update [mytable] set [Ending Date] = '2016-01-31' where [Ending Date] < 0
    • Import all new Sales Prices
      • For the PC List
        • Change the Starting Dates
        • Update PC template with new sales prices
        • Import and apply
      • For the PNC list
        • Change the starting dates
        • Import and apply
    • Re-Export all Items and Sales prices and compare to import lists to confirm changes went in correctly
      • In some instances, the unit prices on the item cards are incorrectly updated after importing the sales prices
    • Configure any custom jobs to push changes to terminals
    • Start NAV scheduler to push all changes to terminals
------------------------------------------------------------------------------------------------------
VAT CHANGE METHODS
  • Method1 - Change the existing rate and only affect new transactions moving forward
    • http://www.tvisiontech.co.uk/news_5.html
    • Search for VAT Posting Setup
      • Change current VAT %
      • Create new VAT Codes for the old rate to handle old transactions being entered before the vat change date. (eg. VATOLD)
      • Manually select the new vat code (VATOLD) if you need to handle transactions for the old vat %
    • Check and adjust item prices, including VAT and sales prices.
      • Use the batch job Adjust Item Costs/Prices.
    • Push all changes to terminals
      • Table VAT Posting Setup 325 to all terminals
      • Table VAT Code 99001560 to all terminals
      • Item
      • Sales Prices
  • Method 2 - Create a new Rate and only affect new transactions going forward
    • All existing transactions containing VAT should be posted
    • New VAT Posting Group should be created with new VAT% (keep the old existing ones)
    • New VAT Posting Setups should be created with new VAT% (keep the old existing ones)
    • New VAT Code should be created with new VAT % (keep the old existing ones)
    • Update all VAT Product Posting Groups on Customers, Vendors, Items, GL
    • Push all changes to terminals
      • Table VAT Posting Setup 325 to all terminals
      • Table VAT Code 99001560 to all terminals
      • Customers
      • Vendors
      • Items
      • GL Accounts
    • Only new transactions going forward will have the new VAT %

  • Method 3 - Change all unposted transactions, and all new transactions going forward
    • Create new VAT Codes
    • Create new VAT Posting Groups
    • Search for VAT Rate Change
    • Setup VAT Prod Posting Group conversion to define the old VAT code and the new VAT code to replace it with
  • Setup the VAT Rate Change Setup




  • Test the VAT conversion

    • Clear the VAT Rate change Tool Completed Checkbox
    • Clear the Perform Conversion Checkbox
      • Once this is cleared, running the convert function will only simulate a conversion
      • The actual conversion will not happen
    • Review the VAT Change Log Entry




  • Print all VAT reports before conversion
  • Perform the VAT Conversion

    • Clear the VAT Rate change Tool Completed Checkbox
    • Mark the Perform Conversion Checkbox
    • Review the VAT Change Log entry
    • Review sample data




  • Print all VAT reports after conversion
  • Push all changes to terminals

    • Push the values for Table VAT Posting Setup 325 to all terminals
    • Push the values for Table VAT Code 99001560 to all terminals




  • These changes will affect current unposted transactions, and new transactions going forward
  • Historical transactions will remain with the VAT% they had when they were posted

    Monday, November 30, 2015

    Dynamics NAV - There are more x unresolved serial numbers attached to this document

    Related: Item Tracking serial number for ... cannot be applied

    This occurs due to unposted assembly entries

    Even if you post the assembly afterwards, the serial error stays on the statement

    To resolve

    • Confirm if the assembly for the serial number was posted
      • View the error by opening the statement, click on serial no errors.
      • Search for the serial number under the item ledger entries under Serial no. column
    • Remove the error flag on the Trans. Sales Entry
      • Find the transaction number in the Trans.Sales entry table or Serial No.
      • Set Serial/Lot no not valid to 0 (untick it)
      • Find the transactions number or serial no in the Transaction Status Table
      • Set Serial/Lot not valid to 0
    --Post all assemblies before the statement date
     update [CRONUS$Transaction Status] set [Serial_Lot No_ Not Valid] = 0 where  [Serial_Lot No_ Not Valid] > 0
      update [CRONUS$Trans_ Sales Entry] set [Serial_Lot No_ Not Valid] = 0 where  [Serial_Lot No_ Not Valid] > 0

    Tuesday, November 24, 2015

    Dynamics Nav - LS Retail - Pharmacy - How to setup a Replacement Pharmacy Store Server

    Goal
    • Setup a second store server that can be activated if necessary to act as a replacement store server
    Background
    • Pharacy data
      • Terminal -> Store Server -> Head Office -> Store Servers -> Terminals
    • Regular POS Data
      • Terminal ->HO ->Terminals
    • Changes to new store server to get it to match the old store server it's replacing
      • Change new computer name to old server computer name
      • Change new sql instance name to old instance name
      • In NAV Admin Console, change the following to the old store database name and for all instances
        • Database Name
        • Database Service company
        • Services Default company
      • Set pharmacy prescription numbering last number to the last prescription number received at HO from this store + 100 to avoid duplicates of prescriptions that may not have been transmitted before the old server went down
      • Set Issuer Numbering last number to the last Issuer number at HO from this store
      • Set Pharmacy Customer last number to the last Pharmacy customer number at HO from this store
      • Update Web service setup in new Store Server database to match old store server web service setup

    Pre-Requisites
    • Install SQL 2008R2 or higher (Express can be used)
      • Enable TCP IP protocols
      • Change service account to sqldb account
    • Install NAV, LS and Data Director
    • Create NAS Instance: Same ports as old store server, point to company db
      • Set services time zone to server time zone
      • Set default company to the company db
    • Create Web Service Instance: Same ports as old store server, point to company db
      • Set services time zone to server time zone
      • Set default company to the company db
      • Enable soap, set message size 2048
    • Copy Images Folder to new machine
    • Copy pharmacy dll's to new machine
      • From  \\Pharmacy DLL
      • To c:\program files(x86) Microsoft dynamics nav\71\Role Tailored client\add-ins\
    • Copy Scanner dll to new machine
    • Restore Last Store Database Backup into SQL 

    Friday, November 20, 2015

    Dynamics NAV - LS Retail - Replenishment Troubleshooting guide

    • Replenishment suggests the wrong stock due to an incorrect daily average sale calculation
      • The Daily average sale calculation is affected by the out of stock days if the "Replenish as item no" field is blank
      • If the C10012203 Replen. Out of Stock Mgt. is not running regularly, the out of stock days may not be correctly calculated, or updated, resulting in incorrect daily sales for items that have no value for "Date In Stock" in the T10012209 "Replen Out of Stock Log"
    • C10012200 Calc Replen Qty will delete replenishment quantity lines in the following situations, and will not include them when the "Add Lines" button is pressed
      • If a location does not exist
      • If a replenish From location does not exist
      • Item Status is set to Block Purchasing or Block Transferring
      • Item is set to Blocked

    Thursday, November 12, 2015

    Dynamics NAV - LS Retail - Demo Script

    • Login Cycle
      • Login Cashier
      • Enter Float
    • Standard sale cycle
      • Start Sale
      • Scan items
      • Take payment
      • complete sale
    • Standard Return Cycle
      • Start return
      • Scan bill
      • complete return
    • Void item cycle
      • Start sale
      • Scan item
      • Manager login
      • Void Item
      • Take payment
      • Complete sale
    • Discount Cards
      • Start sale
      • Scan item
      • scan discount
      • Take payment
      • Complete sale
    • Loyalty cards and points
    • End of Day
    • Backoffice
      • Statement Calculation
      • Sales posting
      • Statement Posting
    • Reports
      • Sales reports
    • Admin
      • Security
      • Data synchronization
      • Multiple Stores
      • Multiple terminals

    Wednesday, November 4, 2015

    Dynamics NAV - SQL - Record is locked -exec sp_who2

    A record In the Item Ledger entry table is locked

    Run this

    --------------------------------------------------------------------------------
    CREATE TABLE #sp_who2 (SPID INT,Status VARCHAR(255),

          Login  VARCHAR(255),HostName  VARCHAR(255),

          BlkBy  VARCHAR(255),DBName  VARCHAR(255),

          Command VARCHAR(255),CPUTime INT,

          DiskIO INT,LastBatch VARCHAR(255),

          ProgramName VARCHAR(255),SPID2 INT,

          REQUESTID INT)

    INSERT INTO #sp_who2 EXEC sp_who2

    SELECT      *

    FROM        #sp_who2

    -- Add any filtering of the results here :

    WHERE       DBName = 'ESL'

    -- Add any sorting of the results here :

    ORDER BY    DBName ASC, BlkBy desc, SPID

     

    DROP TABLE #sp_who2

     

    --KILL 78

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

    Look for status of "Runnable" or any values in the "BlkBy" field

    Tuesday, November 3, 2015

    Dynamics NAV - Create a custom Factbox

    • Edit Page you want to use as factbox
      • Design>Scroll to the bottom, right click on a blank line to get page properties
      • Set Page Type to "CardPart" (info for one card) or "ListPart"(info for entire list)
      • Or create a new page completely
    • Edit Page you want factbox on
    • Under Container>FactboxArea
      • Part>Page>Page name you want to use as factbox
      • Enter Part Page ID (Object ID)
      • Set the Subpagelink to filter the information based on the fields currently selected in the lsit
        • Select Factbox Field>FIELD>Select List field to use as filter

    eOne Smartconnect - Timeout Expired when attempting to modify a source query

    Resolution
    Reduce the compatibility level of the database you are connecting to. Then restart Smartconnect.

    USE [master]
    GO
    ALTER DATABASE [TWO] SET COMPATIBILITY_LEVEL = 110
    GO

     

     


     
      

    Monday, November 2, 2015

    Thursday, October 29, 2015

    get/change operation on table 'gpCustomerPOSetup' cannot find the table

    Cause:
    This error is related to PSTL and the SOP PO Number check tool.
    It affects table DYNAMICS.dbo.gpCustomerPOSetup

    Related Errors:
    Clicking on PSTL throws error "Invalid Access"
    solution: Delete the PSTL shortcut and re-add it

    Resolution:
    Launch PSTL at least once
    It will install all missing tables

    Tuesday, October 27, 2015

    Dynamics GP - SQL Trigger - Track Customer Class, Item Type, Item Price Changes

    --Create Changes log table


    CREATE TABLE [dbo].[BI_ChangeTracking](

    [Timestamp] [datetime] NULL,

    [TableChanged] [nvarchar](50) NULL,

    [FieldChanged] [nvarchar](50) NULL,

    [FromValue] [nvarchar](50) NULL,

    [ToValue] [nvarchar](50) NULL,

    [UserChanged] [nvarchar](50) NULL,

    [RecordID] [nvarchar](50) NULL,

    [Description] [nvarchar](250) NULL

    ) ON [PRIMARY]




    GO
     

     

    --Create Trigger on customer table
      

    CREATE TRIGGER [dbo].[after_update_class]

    ON [dbo].[RM00101]

    AFTER UPDATE

    AS




    BEGIN

    Insert into BI_ChangeTracking(

    [Timestamp], TableChanged, FieldChanged,

    fromvalue,tovalue,

    userchanged,recordid,[Description]

    )

    Select

    getdate(),'RM00101','CUSTCLAS',

    d.CUSTCLAS, i.CUSTCLAS,

    USER_NAME(USER_ID()),i.CUSTNMBR,'Customer Class Changed'

    from Inserted i inner join deleted d on (i.CUSTNMBR = d.CUSTNMBR)

    Where (i.custclas <> '' or d.custclas <> '') and i.custclas <> d.custclas




    END
     
     




    GO
     
     


    -- Create Trigger on item table

    CREATE TRIGGER [dbo].[after_update_status]

    ON [dbo].[IV00101]

    AFTER UPDATE

    AS




    BEGIN
     

     



    Insert into BI_ChangeTracking(

    [Timestamp], TableChanged, FieldChanged,

    fromvalue,tovalue,

    userchanged,recordid,[Description]

    )

    Select

    getdate(),'IV00101','ITEMTYPE',

    d.ITEMTYPE, i.ITEMTYPE,

    USER_NAME(USER_ID()),i.ITEMNMBR,'Item Type Changed 1-sales inv,2-discontinued, 3-kit, 4-misc charges, 5-services, 6-flatfee ,'

    from Inserted i inner join deleted d on (i.ITEMNMBR = d.ITEMNMBR)

    Where (i.ITEMTYPE <> '' or d.ITEMTYPE <> '') and i.ITEMTYPE <> d.ITEMTYPE




    END

    GO

    --Create trigger on item price table

     

    CREATE TRIGGER [dbo].[after_update_price]

    ON [dbo].[IV00108]

    AFTER UPDATE

    AS




    BEGIN
     
     
    -- SET NOCOUNT ON added to prevent extra result sets from

    -- interfering with SELECT statements.

    SET NOCOUNT ON;

    -- Insert statements for trigger here

    Insert into BI_ChangeTracking(

    [Timestamp], TableChanged, FieldChanged,

    fromvalue,tovalue,

    userchanged,recordid,[Description]

    )

    Select

    getdate(),'IV00108','UOMPRICE',

    d.UOMPRICE, i.UOMPRICE,

    USER_NAME(USER_ID()),rtrim(i.ITEMNMBR) + ' | ' + i.PRCLEVEL,'Item Price Changed'

    from Inserted i inner join deleted d on (i.ITEMNMBR = d.ITEMNMBR and i.PRCLEVEL = d.PRCLEVEL)

    Where (i.UOMPRICE <> 0 or d.UOMPRICE <> 0) and i.UOMPRICE <> d.UOMPRICE




    END
     
     





     
     





     
     
    GO