public List <TypeWiseReport> GetTestTypeInfoByDate(double fromDate, double todate) { List <TypeWiseReport> typeWiseReportList = new List <TypeWiseReport>(); GetDateConfiguration dateConfiguration = new GetDateConfiguration(); int totalTest = 0; double totalAmount = 0; string type = ""; GenarateConnection(); string query = "SELECT * FROM TypeWiseReportView ORDER BY TypeName,PrintDate"; Command = new SqlCommand(query, Connection); Command.Parameters.Clear(); Connection.Open(); Reader = Command.ExecuteReader(); if (Reader.HasRows) { while (Reader.Read()) { double printDate = Convert.ToDouble(dateConfiguration.GetDateInDouble(Reader["PrintDate"].ToString())); if (fromDate <= printDate & todate >= printDate) { string newtypename = Reader["TypeName"].ToString(); if (type.Equals(newtypename)) { totalTest = totalTest + 1; totalAmount = totalAmount + Convert.ToDouble(Reader["Fee"]); } else { if (!type.Equals("")) { TypeWiseReport typeWiseReport = new TypeWiseReport(); typeWiseReport.TestTypeName = type; typeWiseReport.TotalAmount = totalAmount; typeWiseReport.TotalNoOfTest = totalTest; typeWiseReportList.Add(typeWiseReport); } type = Reader["TypeName"].ToString(); totalTest = 1; totalAmount = Convert.ToDouble(Reader["Fee"]); } } } TypeWiseReport typeWiseReportForLast = new TypeWiseReport(); typeWiseReportForLast.TestTypeName = type; typeWiseReportForLast.TotalAmount = totalAmount; typeWiseReportForLast.TotalNoOfTest = totalTest; typeWiseReportList.Add(typeWiseReportForLast); } Connection.Close(); return(typeWiseReportList); }
public List <UnpaidBillReport> GetUnPaidReport(double fromDate, double todate) { List <UnpaidBillReport> unpaidBillReportList = new List <UnpaidBillReport>(); GetDateConfiguration dateConfiguration = new GetDateConfiguration(); double billAmount = 0; string billNumber = ""; string mobileNo = ""; string patientName = ""; GenarateConnection(); string query = "SELECT * FROM TestRequestView WHERE PaymentStatus =@PaymentStatus ORDER BY BillNumber;"; Command = new SqlCommand(query, Connection); Command.Parameters.Clear(); Command.Parameters.Add("@PaymentStatus", SqlDbType.VarChar); Command.Parameters["@PaymentStatus"].Value = "0"; Connection.Open(); Reader = Command.ExecuteReader(); if (Reader.HasRows) { while (Reader.Read()) { double printDate = Convert.ToDouble(dateConfiguration.GetDateInDouble(Reader["PrintDate"].ToString())); if (fromDate <= printDate & todate >= printDate) { if (billNumber.Equals(Reader["BillNumber"].ToString())) { billAmount = billAmount + Convert.ToDouble(Reader["Fee"]); } else { if (!billNumber.Equals("")) { UnpaidBillReport unpaidBillReport = new UnpaidBillReport(); unpaidBillReport.BillNumber = billNumber; unpaidBillReport.BillAmount = billAmount; unpaidBillReport.PatientName = patientName; unpaidBillReport.MobileNo = mobileNo; unpaidBillReportList.Add(unpaidBillReport); } billNumber = Reader["BillNumber"].ToString(); mobileNo = Reader["MobileNo"].ToString(); patientName = Reader["Name"].ToString(); billAmount = Convert.ToDouble(Reader["Fee"]); } } } UnpaidBillReport unpaidBillReports = new UnpaidBillReport(); unpaidBillReports.BillNumber = billNumber; unpaidBillReports.BillAmount = billAmount; unpaidBillReports.PatientName = patientName; unpaidBillReports.MobileNo = mobileNo; unpaidBillReportList.Add(unpaidBillReports); } Connection.Close(); return(unpaidBillReportList); }