public static List<AccountsReceivableModel> getAccountsReceiveableModel(DateTime startDate, DateTime endDate, Forms.Reporting.Dialogs.AccountsRecivableDialog.updateFormProgress callback, int docID = 0) { List<AccountsReceivableModel> lstAccReceivables = new List<AccountsReceivableModel>(); patient[] allPatients; if(docID == 0) { PatientMgr patMgr = new PatientMgr(); allPatients = patMgr.getPatients().ToArray(); } else { DoctorMgr docMgr = new DoctorMgr(); allPatients = docMgr.getDoctor(docID).patients.ToArray(); } int total = allPatients.Length; int progress = 0; foreach (patient pat in allPatients) { decimal balance = pat.rangedAccountBalance(startDate, endDate.AddDays(1).Date); if (balance < 0) { AccountsReceivableModel accRec = new AccountsReceivableModel(); accRec.Patient = pat; accRec.AmountOweing = -balance; // just to remove the minus sign on the report lstAccReceivables.Add(accRec); } callback(++progress, total); } lstAccReceivables.Sort((p1, p2) => string.Compare(p1.Patient.FullName, p2.Patient.FullName)); return lstAccReceivables; }
public YourUserControl() { InitializeComponent(); PatientsViewModel = new PatientMgr(); DataContext = PatientsViewModel; }
internal static decimal getPatientPrevBalance(int patID, DateTime startDate) { decimal prevBalance = 0; PatientMgr patMgr = new PatientMgr(); patient p = patMgr.getPatient(patID); if (p != null) { prevBalance = p.prevAccountBalance(startDate); } return prevBalance; }