Create stored procedure to update the dblBillQty

Issue No: IC-6327
Created 10/29/2018 4:53:35 AM
Type Feature
Priority Major
Status Closed
Resolution Fixed
Fixed Version 18.3
Description we will implement the logic on this JIRA http://jira.irelyserver.com/browse/AP-5142 to add payables integration.   for brief history before AP-5142 came. We update the received qty of PO once the inventory receipt have been posted. then, AP-5142 came, we update the received qty of PO upon saving of receipt and voucher (for misc item).   acceptance:   now we want to do the same with Add Payables data. currently we update the available qty to voucher upon posting. we want to change it upon saving.   stored procedure should have the ff signature of parameters. (example of PO implementation)   {noformat}CREATE PROCEDURE [dbo].[uspPOReceivedMiscItem] @voucherPayables AS VoucherPayable READONLY, @decrease BIT = 0 AS{noformat} This is how PO update the dblReceivedQty.   {noformat}UPDATE A SET A.dblQtyReceived = (CASE WHEN @decreaseQty = 1 THEN A.dblQtyReceived - B.dblQuantityToBill ELSE A.dblQtyReceived + B.dblQuantityToBill END) FROM tblPOPurchaseDetail A INNER JOIN @voucherPayables B ON A.intPurchaseDetailId = B.[intPurchaseDetailId] LEFT JOIN tblICItem C ON A.intItemId = C.intItemId WHERE (dbo.fnIsStockTrackingItem(C.intItemId) = 0 OR C.intItemId IS NULL){noformat} It is recommented that you add validation and throw it if necessary so saving will not continue.   We will call your stored procedure inside 'uspAPUpdateIntegrationPayableAvailableQty' for the following events of saving voucher.   Voucher screen.   1. User added the item from 'Add Payables'.   2. User edited the qty of the item from integration modules.   3. User deleted the item added on voucher which is from integration modules.   Integration script:   Calling integration script uspAPCreateVoucher or uspAPAddVoucherDetail.   _Note: Posting validation is still in place where we do not allow to voucher more than the available qty on the receipt._   _While receipt is not yet implementing the changes, we will still update the dblBillQty upon posting._