php - display two database table data in a single html table -
i have 3 tables viz customer, project , payment. logically customer should pay based on project in real scenario payment system different. pay in random amounts. project , payment child table of customer. both project , payment have customer id
customer table
custid custname custaddress 1 xyz abc 2 ijk abcd
project table
projid projname amount cus_id 1 project 1 10000 1 2 project 2 5000 1 3 project 3 11000 1 4 project 4 2000 2 5 project 5 3000 1
payment table
payid paid cust_id 1 5000 1 2 7000 1 3 4000 2 4 1000 1
now want display project , payment details of each customer in same html table. want payment reflected based on project. if first project amount 5000 , first payment 7000 want payment displayed in second project because 5000 applicable amount first project , remaining 2000 can applied second project provided second project amount greater 2000. otherwise if second project amount 1000 payment should displayed in third project 1000 second project , 1000 leftover goes third project on , forth. if project amount , payment amount equal or project amount greater payment payment should reflected on same row.
how can achieve below or can recommend me better solution achieve displaying data 2 disjoint database table 1 html table.
projid projname amount cus_id payid 1 project 1 10000 1 2 project 2 5000 1 2 (for payment 7000+2000<11000) 3 project 3 11000 1 1 (for payment 5000, left 2000) 5 project 5 3000 1
Comments
Post a Comment