| Author |
Topic  |
|
|
Tijesuni
Starting Member
Nigeria
4 Posts |
Posted - 03/16/2013 : 09:16:02
|
I have these tables
MANAGEMENT.PAYMENTS PaymentID PatientID AdvancePayment FinalPayment PaymentStatus
FACILITIES.WARDDETAILS WardID WardName Ward_Charge
PATIENTS.PATIENTDETAILS PatientID Discharge_Date Admit_Date Ward_ID
Pls how do i validate
1)FinalPayment should store the final amount chargeable and must be calculated as Total Bill - AdvancePayment 3)The total bill will be calculated at time of discharge by adding the ward charges for the number of days the patient was admitted to the ward |
|
|
stepson
Yak Posting Veteran
Romania
85 Posts |
Posted - 03/16/2013 : 12:07:13
|
Hello I guess about ManagementPayment, is one per patient per session.
not tested
select patientID , datediff(d,discharge_Date,Admit_date) * Ward_Charge as [Total Bill] , datediff(d,discharge_Date,Admit_date) * Ward_Charge-coalesce(AdvancePayment,0) as FinalPayment from Patients.PatientDetails as PD inner join Facilities.WardDetails as WD on PD.Ward_ID=WD.Ward_ID inner join Management.Payments MP on PD.PatientID=MP.PatientID
Ce-am pe mine am si-n dulap, cand ma-mbrac zici ca ma mut sabinWeb |
 |
|
|
stepson
Yak Posting Veteran
Romania
85 Posts |
Posted - 03/16/2013 : 12:09:38
|
it will be nice , if where some samples date, for better understand the relation between tables , especially ManagementPayment
S
Ce-am pe mine am si-n dulap, cand ma-mbrac zici ca ma mut sabinWeb |
 |
|
| |
Topic  |
|
|
|