public ActionResult nextmonth(DateTime DeliverTime, string restcode) { DateTime DeliverTime1 = DeliverTime.AddDays(1); DateTime DeliverTime2 = DeliverTime.AddDays(32); //string DeliverTime1 = dateTime.AddDays(-15).ToString("dd/MM/yyyy"); Ankapurservices objCrd = new Ankapurservices(); var modelCust = objCrd.monthlyreports(DeliverTime2, restcode); foreach (var item in modelCust) { string amount = item.amountPaid; string total = item.TotalPrice; if (total == null || total == "") { total = "0"; } string cgst = item.cgstcharges; string sgst = item.sgstcharges; string deliverycharges = item.Deliverycharges; string status = item.status; string tip = item.Tip; string disco = item.Discount; if (status != "8") { TotalPrice = TotalPrice + decimal.Parse(total); Deliverycharges = Deliverycharges + decimal.Parse(deliverycharges); sgstcharges = sgstcharges + decimal.Parse(sgst); cgstcharges = cgstcharges + decimal.Parse(cgst); tips = tips + decimal.Parse(tip); discounts = discounts + decimal.Parse(disco); revenue2 = TotalPrice + Deliverycharges + sgstcharges + cgstcharges + tips - discounts; PriceSum2 = PriceSum2 + decimal.Parse(amount); } } var r2 = String.Format(new CultureInfo("en-IN", false), "{0:n}", Convert.ToDouble(revenue2)); var p2 = String.Format(new CultureInfo("en-IN", false), "{0:n}", Convert.ToDouble(PriceSum2)); //PriceSum1 += item.amountPaid; // instead of =+ ViewBag.Pricesum = p2; ViewBag.revenue = r2; ViewBag.modelCust = modelCust.Count; ViewBag.selectdate1 = DeliverTime1.ToString("dd/MM/yyyy"); ViewBag.selectdate = DeliverTime2.ToString("dd/MM/yyyy"); ViewBag.selectdate2 = DeliverTime2.ToString("yyyy/MM/dd").Replace('-', '/'); if (restcode == "HN") { restcode1 = "Himayath Nagar"; } else if (restcode == "KP") { restcode1 = "Kukatpally"; } else if (restcode == "AN") { restcode1 = "A.S.Rao Nagar"; } ViewBag.restcode1 = restcode1; ViewBag.restcode = restcode; return(View(modelCust)); }
public ActionResult downloadmonth(DateTime DeliverTime, string restcode) { if (DeliverTime != null) { //ViewBag.Message = "Your application description page."; Ankapurservices objCrd = new Ankapurservices(); var modelCust1 = objCrd.monthlyreports(DeliverTime, restcode); var gv = new GridView(); gv.DataSource = modelCust1; gv.DataBind(); Response.ClearContent(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment; filename=ankapurchickenmonthly.xls"); Response.ContentType = "application/ms-excel"; Response.Charset = ""; StringWriter objStringWriter = new StringWriter(); HtmlTextWriter objHtmlTextWriter = new HtmlTextWriter(objStringWriter); gv.RenderControl(objHtmlTextWriter); Response.Output.Write(objStringWriter.ToString()); Response.Flush(); Response.End(); return(View("Index")); } return(Content("<script> alert('please select date')</script>")); }
public ActionResult About() { try { string DeliverTime = DateTime.Today.ToString(); //ViewBag.Message = "Your application description page."; Ankapurservices objCrd = new Ankapurservices(); var modelCust1 = objCrd.Getdailyreports(DeliverTime); foreach (var reports in modelCust1) { string amount = reports.amountPaid; string total = reports.TotalPrice; string cgst = reports.cgstcharges; string sgst = reports.sgstcharges; string deliverycharges = reports.Deliverycharges; TotalPrice = TotalPrice + decimal.Parse(total); Deliverycharges = Deliverycharges + decimal.Parse(deliverycharges); sgstcharges = sgstcharges + decimal.Parse(sgst); cgstcharges = cgstcharges + decimal.Parse(cgst); revenue = TotalPrice + Deliverycharges + sgstcharges + cgstcharges; PriceSum = PriceSum + decimal.Parse(amount); } var modelCust2 = objCrd.Weeklyreports(DeliverTime); foreach (var item in modelCust2) { string amount = item.amountPaid; string total = item.TotalPrice; if (total == null) { total = "0"; } string cgst = item.cgstcharges; string sgst = item.sgstcharges; string deliverycharges = item.Deliverycharges; TotalPrice1 = TotalPrice1 + decimal.Parse(total); Deliverycharges1 = Deliverycharges + decimal.Parse(deliverycharges); sgstcharges1 = sgstcharges + decimal.Parse(sgst); cgstcharges1 = cgstcharges + decimal.Parse(cgst); revenue1 = TotalPrice1 + Deliverycharges1 + sgstcharges1 + cgstcharges1; PriceSum1 = PriceSum1 + decimal.Parse(amount); //PriceSum1 += item.amountPaid; // instead of =+ } var modelCust3 = objCrd.monthlyreports(DeliverTime); foreach (var item in modelCust3) { string amount = item.amountPaid; string total = item.TotalPrice; if (total == null) { total = "0"; } string cgst = item.cgstcharges; string sgst = item.sgstcharges; string deliverycharges = item.Deliverycharges; TotalPrice2 = TotalPrice2 + decimal.Parse(total); Deliverycharges2 = Deliverycharges + decimal.Parse(deliverycharges); sgstcharges2 = sgstcharges + decimal.Parse(sgst); cgstcharges2 = cgstcharges + decimal.Parse(cgst); revenue2 = TotalPrice2 + Deliverycharges2 + sgstcharges2 + cgstcharges2; PriceSum2 = PriceSum2 + decimal.Parse(item.amountPaid); //PriceSum2 += item.amountPaid; // instead of =+ } ViewBag.modelCust1 = modelCust1.Count; ViewBag.modelCust2 = modelCust2.Count; ViewBag.modelCust3 = modelCust3.Count; ViewBag.Pricesum = PriceSum; ViewBag.Pricesum1 = PriceSum1; ViewBag.Pricesum2 = PriceSum2; ViewBag.revenue = revenue; ViewBag.revenue1 = revenue1; ViewBag.revenue2 = revenue2; ViewBag.selectdate = DateTime.Now.ToString("dd/MM/yyyy").Replace('-', '/'); return(View()); } catch (Exception) { return(Content("<script language='javascript' type='text/javascript'>alert('Restaurant is closed at the moment');location.href='" + @Url.Action("Index", "Home") + "'</script>")); } }
public ActionResult About(string restcode) { try { if (restcode == null) { restcode = "HN"; } DateTime DeliverTime = DateTime.Today; //ViewBag.Message = "Your application description page."; Ankapurservices objCrd = new Ankapurservices(); var modelCust1 = objCrd.Getdailyreports(DeliverTime, restcode); foreach (var reports in modelCust1) { string amount = reports.amountPaid; string total = reports.TotalPrice; if (total == null || total == "") { total = "0"; } string cgst = reports.cgstcharges; string sgst = reports.sgstcharges; string deliverycharges = reports.Deliverycharges; string status = reports.status; string tip = reports.Tip; string disco = reports.Discount; if (status != "8") { TotalPrice = TotalPrice + decimal.Parse(total); Deliverycharges = Deliverycharges + decimal.Parse(deliverycharges); sgstcharges = sgstcharges + decimal.Parse(sgst); cgstcharges = cgstcharges + decimal.Parse(cgst); tips = tips + decimal.Parse(tip); discounts = discounts + decimal.Parse(disco); revenue2 = TotalPrice + Deliverycharges + sgstcharges + cgstcharges + tips - discounts; PriceSum2 = PriceSum2 + decimal.Parse(amount); } } var r2 = String.Format(new CultureInfo("en-IN", false), "{0:n}", Convert.ToDouble(revenue2)); var p2 = String.Format(new CultureInfo("en-IN", false), "{0:n}", Convert.ToDouble(PriceSum2)); //PriceSum1 += item.amountPaid; // instead of =+ ViewBag.modelCust = modelCust1.Count; ViewBag.Pricesum = p2; ViewBag.revenue = r2; var modelCust2 = objCrd.Weeklyreports(DeliverTime, restcode); //foreach (var item in modelCust2) //{ // string amount = item.amountPaid; // string total = item.TotalPrice; // if (total == null || total == "") // { // total = "0"; // } // string cgst = item.cgstcharges; // string sgst = item.sgstcharges; // string deliverycharges = item.Deliverycharges; // TotalPrice1 = TotalPrice1 + decimal.Parse(total); // Deliverycharges1 = Deliverycharges + decimal.Parse(deliverycharges); // sgstcharges1 = sgstcharges + decimal.Parse(sgst); // cgstcharges1 = cgstcharges + decimal.Parse(cgst); // revenue1 = TotalPrice1 + Deliverycharges1 + sgstcharges1 + cgstcharges1; // PriceSum1 = PriceSum1 + decimal.Parse(amount); // //PriceSum1 += item.amountPaid; // instead of =+ //} var modelCust3 = objCrd.monthlyreports(DeliverTime, restcode); //foreach (var item in modelCust3) //{ // string amount = item.amountPaid; // string total = item.TotalPrice; // if (total == null || total == "") // { // total = "0"; // } // string cgst = item.cgstcharges; // string sgst = item.sgstcharges; // string deliverycharges = item.Deliverycharges; // TotalPrice2 = TotalPrice2 + decimal.Parse(total); // Deliverycharges2 = Deliverycharges + decimal.Parse(deliverycharges); // sgstcharges2 = sgstcharges + decimal.Parse(sgst); // cgstcharges2 = cgstcharges + decimal.Parse(cgst); // revenue2 = TotalPrice2 + Deliverycharges2 + sgstcharges2 + cgstcharges2; // PriceSum2 = PriceSum2 + decimal.Parse(item.amountPaid); // var r2 = String.Format(new CultureInfo("en-IN", false), "{0:n}", Convert.ToDouble(revenue2)); // var p2 = String.Format(new CultureInfo("en-IN", false), "{0:n}", Convert.ToDouble(PriceSum2)); // //PriceSum2 += item.amountPaid; // instead of =+ //} ViewBag.modeldaily = modelCust1; ViewBag.modelCust1 = modelCust1.Count; ViewBag.modelCust2 = modelCust2.Count; ViewBag.modelCust3 = modelCust3.Count; //ViewBag.Pricesum = PriceSum; //ViewBag.Pricesum1 = PriceSum1; //ViewBag.Pricesum2 = PriceSum2; //ViewBag.revenue = revenue; //ViewBag.revenue1 = revenue1; //ViewBag.revenue2 = revenue2; ViewBag.selectdate = DeliverTime.ToString("dd/MM/yyyy").Replace('-', '/'); ViewBag.selectdate1 = DeliverTime.ToString("yyyy/MM/dd").Replace('-', '/'); if (restcode == "HN") { restcode1 = "Himayath Nagar"; } else if (restcode == "KP") { restcode1 = "Kukatpally"; } else if (restcode == "AN") { restcode1 = "A.S.Rao Nagar"; } ViewBag.restcode1 = restcode1; ViewBag.restcode = restcode; return(View()); } catch (Exception) { return(Content("<script language='javascript' type='text/javascript'>alert('Restaurant is closed at the moment');location.href='" + @Url.Action("About", "Home") + "'</script>")); } }
public PartialViewResult monthlypview(string restcode) { if (restcode == null) { restcode = "HN"; } DateTime DeliverTime = DateTime.Today; DateTime dateTime = Convert.ToDateTime(DeliverTime, new CultureInfo("en-GB")); string DeliverTime1 = dateTime.AddDays(31).ToString("dd/MM/yyyy"); Ankapurservices objCrd = new Ankapurservices(); var modelCust3 = objCrd.monthlyreports(DeliverTime, restcode); foreach (var item in modelCust3) { string orderid = item.OrderId; string amount = item.amountPaid; string total = item.TotalPrice; if (total == null || total == "") { total = "0"; } string cgst = item.cgstcharges; string sgst = item.sgstcharges; string deliverycharges = item.Deliverycharges; string status = item.status; string tip = item.Tip; string disco = item.Discount; if (status != "8") { TotalPrice = TotalPrice + decimal.Parse(total); Deliverycharges = Deliverycharges + decimal.Parse(deliverycharges); sgstcharges = sgstcharges + decimal.Parse(sgst); cgstcharges = cgstcharges + decimal.Parse(cgst); tips = tips + decimal.Parse(tip); discounts = discounts + decimal.Parse(disco); revenue2 = TotalPrice + Deliverycharges + sgstcharges + cgstcharges + tips - discounts; PriceSum2 = PriceSum2 + decimal.Parse(amount); } var r2 = String.Format(new CultureInfo("en-IN", false), "{0:n}", Convert.ToDouble(revenue2)); var p2 = String.Format(new CultureInfo("en-IN", false), "{0:n}", Convert.ToDouble(PriceSum2)); //PriceSum1 += item.amountPaid; // instead of =+ ViewBag.modelCust3 = modelCust3.Count; ViewBag.Pricesum2 = p2; ViewBag.revenue2 = r2; ViewBag.selectdate = DateTime.Now.ToString("dd/MM/yyyy").Replace('-', '/'); ViewBag.selectdate = DeliverTime1; if (restcode == "HN") { restcode1 = "Himayath Nagar"; } else if (restcode == "KP") { restcode1 = "Kukatpally"; } else if (restcode == "AN") { restcode1 = "A.S.Rao Nagar"; } ViewBag.restcode1 = restcode1; ViewBag.restcode = restcode; } return(PartialView("monthlypview", modelCust3)); }