Click here to Skip to main content
15,566,625 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I'm working on leasing shops system and here is my database for now: Database Diagram

I have contracts these contracts have 2 types, lease for a duration (year) and the payment will be once, and the other type is lease for a duration but the payments will be monthly.

I already did the yearly one payment, but I don't know what is the best approach to do that, I'm thinking this way, to create a new table and add the duration to that table for all months E.G, if I have a 12-month contract I will add 12 records on the table each record for one month, but in this case, It will be hard to manage all scenarios whin user need to update the contract and change the duration for it.

What I have tried:

So my question is: what the best approach to accomplish this ?? 
Thank you.
Updated 28-Apr-21 9:25am

1 solution

You're missing "invoices".

For yearly or monthly, you "generate" an invoice when due; then you monitor ("age") those invoices for payment (i.e. accounts receivable).

Any payment should reference the "invoice number" that you generated as part of the invoice.
Share this answer
Rabee Qabaha 28-Apr-21 19:22pm    
Hello @Gerry,
So what you are saying that I need to create a new table called Invoices, all payments for both yearly and monthly should be stored in this table.
but what about the monthly payments, what the best way to deal with that?? generate a new table contains all the monthly payments??

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