Move Transactions from customer A to B

Jun 28, 2007 2 Replies

One of the cashier - entered the wrong customer ID for a transaction (#244) - can I run a sql script to move the purchase to the proper customer and will all the account history, number of visits be adjusted properly.



Dan


Yes you can do so, but remember it is not easy. is the tender to customer was cash or on account if it is cash then you need to update the following tables:

1) Update [Transaction] set CustomerID=CorrectID where TransactionNumber=XXTransactionNo 2) Update Customer set LastVisit=(Select LastVisit from Customer where ID=WrongID), TotalVisits=TotalVisits+1, TotalSales=TotalSales+XXSaleAmount Where ID=CorrectID 3) Update Customer set LastVisit=(Select Max([Time]) from [Transaction] where CustomerID=WrongID), TotalVisits=TotalVisits-1, TotalSales=TotalSales-XXSaleAmount Where ID=WrongID 4) Update Journal set CustomerID=CorrectID where TransactionType=1 and ReferenceID=XXTransactionNo.

If it is on Account then additional few more query you will run:

5) UPdate AccountReceivable Set CustomerID=CorrectID where CustomerID=WrongID and TransactionNumber=xxTransactionNo

I hope you understand what I mean with CorrectID, WrongID and xx fields mean you will enter the manually the values, if works please rate.

"Danny" wrote:

Thanks Akber - worked great...

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required