



CREATE PROCEDURE DBO.CCTOpenStatusFix @BillNumber INTEGER, @OTN INTEGER AS
SET NOCOUNT ON
/*
COMMENT:            

nb20040514 Created

DESCRIPTION:
-  Credit Card Transaction Open Status Fix (No such OT number fix)

PRĘ: 
@BillNumber: You will always have a BillNumber as reference (use the Billnumber  report)
@OTN: OpenTransactionNumber from Interface log

POST:                      

*/
 
UPDATE BillCardInfo SET Status=0 WHERE OpenTransactionNumber=@OTN AND TransactionNumber IN (
  SELECT BillCardInfo.TransactionNumber FROM Transactions WITH (NOLOCK) INNER JOIN
    BillCardInfo WITH (NOLOCK) ON BillCardInfo.TransactionNumber = Transactions.TransactionNumber 
  WHERE ShowOnBillFlag=1 and InvoiceBillNumber=@BillNumber
)

