public Invoice generateInvoice(jobDTO job) { Invoice invoice = new Invoice(); invoice.expenses = new List <InvoiceExpenses>(); invoice.BusinessName = job.user.Name; invoice.BusinessPhoneNumber = job.user.PhoneNumber; invoice.ClientName = job.client.Name; invoice.ClientNumber = job.client.PhoneNumber; invoice.ClientStreet = job.client.Address.Street; invoice.ClientCity = job.client.Address.City; invoice.ClientState = job.client.Address.State; invoice.ZipCode = job.client.Address.Zip; invoice.ServiceType = job.type.Name; invoice.StartDate = job.StartDate.GetValueOrDefault().ToString(); invoice.EndDate = job.StartDate.GetValueOrDefault().AddDays(job.EstimatedDuration.GetValueOrDefault()).ToString(); invoice.HourlyRate = job.type.Rate.GetValueOrDefault().ToString(); invoice.BilledHours = job.Hours.GetValueOrDefault().ToString(); var jobexpenses = getJobExpenseByJobId(job); var expenses = new List <ExpenseDTO>(); foreach (var item in jobexpenses) { var x = getExpenses().Where(m => m.Id == item.ExpenseId).FirstOrDefault(); expenses.Add(x); InvoiceExpenses ie = new InvoiceExpenses(); ie.Cost = x.Cost.ToString(); ie.Name = x.Name; invoice.expenses.Add(ie); } var expensetotal = 0.00m; foreach (var item in expenses) { expensetotal += item.Cost; } var subtotal = (job.type.Rate * job.Hours) + expensetotal; invoice.totalExpenses = Decimal.Round(expensetotal, 2); invoice.subTotal = Decimal.Round(subtotal.GetValueOrDefault(), 2); invoice.totalExpensesString = "$" + expensetotal.ToString(); invoice.subTotalString = "$" + subtotal.ToString(); invoice.Notes = job.Notes; return(invoice); }
public Dashbord ViewDashbord(string HospitalId) { try { SqlParameter[] sqlparam; sqlparam = new SqlParameter[2]; sqlparam[0] = new SqlParameter("@Flag", "1"); sqlparam[1] = new SqlParameter("@HospitalId", HospitalId); DataSet ds = CommonFunction.GetDataSet("USP_GET_DashbordDetails", sqlparam, ""); Dashbord D = new Dashbord(); // week List <Dashbord1> lst1 = new List <Dashbord1>(); if (ds != null && ds.Tables[0].Rows.Count > 0) { DataTable dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { Dashbord1 Model = new Dashbord1(); CommonFunction.ReflectSingleData(Model, dr); lst1.Add(Model); } } //month List <Dashbord2> lst2 = new List <Dashbord2>(); if (ds != null && ds.Tables[1].Rows.Count > 0) { DataTable dt = ds.Tables[1]; foreach (DataRow dr in dt.Rows) { Dashbord2 Model = new Dashbord2(); CommonFunction.ReflectSingleData(Model, dr); lst2.Add(Model); } } List <InvoiceExpenses> lst3 = new List <InvoiceExpenses>(); if (ds != null && ds.Tables[2].Rows.Count > 0) { DataTable dt = ds.Tables[2]; foreach (DataRow dr in dt.Rows) { InvoiceExpenses Model = new InvoiceExpenses(); CommonFunction.ReflectSingleData(Model, dr); lst3.Add(Model); } } List <FeedbackDetails> lst4 = new List <FeedbackDetails>(); if (ds != null && ds.Tables[3].Rows.Count > 0) { DataTable dt = ds.Tables[3]; foreach (DataRow dr in dt.Rows) { FeedbackDetails Model = new FeedbackDetails(); CommonFunction.ReflectSingleData(Model, dr); lst4.Add(Model); } } List <Dashbord5> lst5 = new List <Dashbord5>(); if (ds != null && ds.Tables[4].Rows.Count > 0) { DataTable dt = ds.Tables[4]; foreach (DataRow dr in dt.Rows) { Dashbord5 Model = new Dashbord5(); CommonFunction.ReflectSingleData(Model, dr); lst5.Add(Model); } } // exp_Inv ///4///// D.d1lst = lst1; D.d2lst = lst2; D.d3lst = lst3; D.Fedlst = lst4; D.d5lst = lst5; return(D); } catch (Exception Ex) { throw Ex; } }