Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
1.25/5 (3 votes)
Hi, I have this Database:


http://social.msdn.microsoft.com/Forums/getfile/397664[^]


My scenario like that:

Customer A has purchased products by $ 1,000 on 1/1, & pay $ 500, then he returned products by $ 600.

So , the total amount of this customer will be 400, & he pay $ 500 , The remaining amount in installments



How can I handle this scenario in SQL server database

Updated:

My database tables like that:

<img src="http://i43.tinypic.com/2s7gwn5.jpg" border="0" alt="Image and video hosting by TinyPic"></img>

And there is sample for data in it:

<img src="http://i40.tinypic.com/6fa06w.jpg" border="0" alt="Image and video hosting by TinyPic"></img>


And I mean by "So , the total amount of this customer will be 400, & he pay $ 500 , The remaining amount in installments" that some customers pay there amount - not this case - in installments
Posted
Updated 16-Jan-14 4:35am
v3
Comments
gettgotcha 15-Jan-14 14:11pm    
Sorry I couldn't get a clear picture here, what exactly you mean "then he returned products by $ 600"

1 solution

You just need to sum up the amount paid and the amount bought. What I don't see is a way to record items returned in this database ? Perhaps if you gave us SQL to create these tables, and sample data and your expected output, we could help more.

Your question is clear to me. Someone bought $1000 in goods, and paid $500. So they owed $500, but then they returned $600 worth. I don't get 'The remaining amount in installments', do you mean he intended to pay in installments ? Because he's now owed $100.

And you don't 'handle a scenario' in SQL Server, you just get the data and your business layer decides what to do with it. What do you WANT to do, is the core question ?

You have not answered me. What do you WANT to do ? What is your question ? Do you not know how to create the tables to manage returns or installment plans ? Which bit are you stuck on ?
 
Share this answer
 
v2
Comments
Doudy_2020 16-Jan-14 10:28am    
My database tables like that:

http://tinypic.com/view.php?pic=2s7gwn5&s=5

And there is sample for data in it:

http://tinypic.com/view.php?pic=6fa06w&s=5#.UtgWVPQW050


And I mean by "So , the total amount of this customer will be 400, & he pay $ 500 , The remaining amount in installments" that some customers pay there amount - not this case - in installments
Christian Graus 16-Jan-14 16:35pm    
A pic is NOT A sample. SCRIPTS where I can create tables and data, are a sample.

So you want to add tables to keep track of returns and installment plans, is that right ? What have you tried ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900