I have a situation where by there is a person and his/her weekly payments.
Each person is supposed to have paid a certain amount let's say 100,000.
If (s)he fail to reach 100,000 then it carry on to the next week.
If (s)he passes 100,000 then it reduces the next week amount by the balance passed on.
Week start at Saturday.
I was thinking of having a design like this. I know it's wrong. So help me on this
Update
Also I need to mark if this user has paid his dues for this week. So there is some sort of status to keep.
I have come to realize maybe I can implement it using this
SELECT ROUND(DATEDIFF( CURRENT_DATE, "2010-01-04")/7, 0) AS weeksout
That's means I can have a start counting date and use that my index in the payment table like this.
Weeks
-->id
-->week_no
-->start_date
-->end_date
Payments
-->id
-->person_id
-->week_no
-->amount
-->date
Payment_status
-->person_id
-->week_no
-->status
-->balance
-->carry
Using the Payment_status I can keep track of the week status(Paid, Not Paid, Partial Paid).
I am still not comfortable with this, I don't know why.
Aucun commentaire:
Enregistrer un commentaire