web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics RMS (Archived)

Why is HQ quantity not machine with store quantity?

(0) ShareShare
ReportReport
Posted on by 26

 Why is HQ quantity not machine with store quantity, i.e in HQ an item in inventory the quantity will show like 20pcs but went you check store quantity tab you will see the quantity of each store but if you total evey thing it does not match with that of HQ.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    archelle16 Profile Picture
    1,743 on at
    RE: Why is HQ quantity not machine with store quantity?

    It is bcoz Item Quantity looks after the sum of itemdynamic.Quantity while the Store Quantity in ItemDynamic.SnapshotQuantity.

    To get rid if this, execute this trigger in your hq db. In this way, everytime the sync updates the current onhan, it will be automatically update the total item quantity.

    /****** Object:  Trigger [dbo].[tr_ItemStoreQty]    Script Date: 02/04/2016 09:42:49 ******/

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    CREATE TRIGGER [dbo].[tr_ItemStoreQty]

    ON [dbo].[ItemDynamic] FOR UPDATE, INSERT, DELETE AS

    /* Updates Quantity and QuantityCommitted in Item table when changes are made to the ItemDynamic table */

    DECLARE @Rows INT

    SELECT @Rows = @@ROWCOUNT

    IF @Rows = 0

      /* No rows inserted or deleted, exit trigger */

      RETURN

    /* Update the Quantity and QuantityCommitted fields in ItemDynamic table */      

    SELECT   ItemDynamic.ItemID,

            SUM(ItemDynamic.Quantity) AS Quantity,

            SUM(ItemDynamic.QuantityCommitted) AS QuantityCommitted

    INTO     #tr_Temp

    FROM     ItemDynamic

    WHERE    ItemDynamic.ItemID IN

            (

            SELECT ItemID

            FROM   INSERTED

    UNION

            SELECT ItemID

            FROM   DELETED

    )

    GROUP BY ItemDynamic.ItemID

    UPDATE   Item

    SET      Quantity = #tr_Temp.Quantity,

            QuantityCommitted = #Tr_temp.QuantityCommitted

    FROM     Item, #tr_Temp

    WHERE    Item.ID = #tr_Temp.ItemID

    GO

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics RMS (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans