public ActionResult EditPayment(int id) { using (LinkToDBDataContext context = new LinkToDBDataContext()) { BillHistory history = context.GetBillHistoryItem(id); history.Bill = context.GetBill(history.BillId); ViewBag.Action = "Edit"; return View("Payment", history); } }
public DashboardItem(BillHistory history) { Id = history.BillId; Name = history.Bill.Name; Date = history.DatePaid; Amount = history.Amount; IsShared = history.Bill.Shared; Type = "Bill"; IsPaid = true; }
public bool Update(Guid?id) { try { BillHistory entity = new BillHistory(); return(entity.Update(id)); } catch (Exception ex) { throw ex; } }
public BillHistoryModel GetByParentId(Guid id) { try { BillHistory entity = new BillHistory(); return(entity.GetByParentId(id)); } catch (Exception ex) { throw ex; } }
public List <BillHistoryModel> Get() { try { BillHistory entity = new BillHistory(); return(entity.Get()); } catch (Exception ex) { throw ex; } }
public bool Create(BillHistoryModel model) { try { BillHistory entity = new BillHistory(); return(entity.Create(model)); } catch (Exception ex) { throw ex; } }
public ActionResult AddPayment(BillHistory collection) { using (LinkToDBDataContext context = new LinkToDBDataContext()) { ViewBag.Action = "Add"; try { BillHistory history = new BillHistory(); history.CreationDate = DateTime.Now; history.ModifyDate = DateTime.Now; history.Version = 1; history.BillId = collection.Id; Bill bill = context.GetBill(history.BillId); history.Bill = bill; history.Amount = collection.Amount; history.DatePaid = collection.DatePaid; history.Payee = collection.Payee; history.PaymentTypeId = collection.PaymentTypeId; bill.BillHistories.Add(history); if (bill.StaysSame || bill.BillHistoryAverage == null) { bill.DueDate = bill.DueDate.AddMonths(1); } else { IEnumerable<BillHistoryAverage> bha = bill.BillHistoryAverage.Where(x => x.Month.Month == bill.DueDate.AddMonths(1).Month); if (bha.Any()) { bill.DueDate = bha.FirstOrDefault().Month; bill.Amount = bha.FirstOrDefault().Average; } else { bill.DueDate = bill.DueDate.AddMonths(1); } } context.SubmitChanges(); return RedirectToAction("View", new { id = history.BillId }); } catch { return View("Payment", collection); } } }
/* ========================= * Bill History Functions * ========================= */ public ActionResult AddPayment(int id) { using (LinkToDBDataContext context = new LinkToDBDataContext()) { Bill bill = context.GetBill(id); BillHistory history = new BillHistory(); history.Amount = bill.Amount; history.DatePaid = bill.DueDate; history.Payee = bill.Payee; history.PaymentTypeId = bill.PaymentTypeId; history.Bill = bill; ViewBag.Action = "Add"; return View("Payment", history); } }
public ActionResult Paid (int id) { using (LinkToDBDataContext context = new LinkToDBDataContext()) { BillHistory history = new BillHistory(); history.CreationDate = DateTime.Now; history.ModifyDate = DateTime.Now; history.Version = 1; history.BillId = id; Bill bill = context.GetBill(id); history.Amount = bill.Amount; history.DatePaid = bill.DueDate; history.Payee = bill.Payee; history.PaymentTypeId = bill.PaymentTypeId; history.Bill = bill; if (bill.StaysSame || bill.BillHistoryAverage == null) { bill.DueDate = bill.DueDate.AddMonths(1); } else { DateTime useDate = bill.DueDate; IEnumerable<BillHistoryAverage> bha = bill.BillHistoryAverage.Where(x => x.Month.Month == useDate.AddMonths(1).Month); if (bha.Any()) { bill.DueDate = bha.FirstOrDefault().Month; bill.Amount = bha.FirstOrDefault().Average; } else { bill.DueDate = bill.DueDate.AddMonths(1); } } context.SubmitChanges(); return RedirectToAction("Index", "Home", null); } }
private static BillHistory HistoryFromSunlight(SunlightBillResult.History billHistory) { if (billHistory == null) { return(null); } var history = new BillHistory() { AwaitingSignature = billHistory.awaiting_signature, AwaitingSignatureSince = DataTransformationUtil.DateFromSunlightTime(billHistory.awaiting_signature_since), DateHouseLastVotedOnPassage = DataTransformationUtil.DateFromSunlightTime(billHistory.house_passage_result_at), DateSenateLastVotedOnPassage = DataTransformationUtil.DateFromSunlightTime(billHistory.senate_passage_result_at), DateEnacted = DataTransformationUtil.DateFromSunlightTime(billHistory.enacted_at), Enacted = billHistory.enacted, DateVetoed = DataTransformationUtil.DateFromSunlightTime(billHistory.vetoed_at), Vetoed = billHistory.vetoed, HousePassageResult = DataTransformationUtil.LegislativeBillVoteFromSunlight(billHistory.house_passage_result), SenatePassageResult = DataTransformationUtil.LegislativeBillVoteFromSunlight(billHistory.senate_passage_result) }; return(history); }
private void SaveDetailsToDb() { try { FuelDB.Singleton.CreateTable <FuelEntryDetails>(); FuelDB.Singleton.CreateTable <BillHistory>(); var billhistory = new BillHistory { CurrentDate = fuelDetails.CurrentDate, FuelInLtrs = fuelDetails.FuelInLtrs, VehicleNumber = fuelDetails.VehicleNumber, IsInward = isInward }; FuelDB.Singleton.InsertFuelEntryValues(fuelDetails); FuelDB.Singleton.InsertBillHistoryValues(billhistory); FuelDB.Singleton.UpdateFuel(availableFuel.ToString()); ExceptionLog.LogDetails(this, "Current Value in DB :"); ExceptionLog.LogDetails(this, "Total Fuel entry " + FuelDB.Singleton.GetFuelValues().ToArray().Count()); //foreach (var item in FuelDB.Singleton.GetFuelValues()) //{ // ExceptionLog.LogDetails(this, item.BillNumber + " " + item.FuelInLtrs + " " + item.FuelType); //} ExceptionLog.LogDetails(this, "Current Fuel Balance :"); ExceptionLog.LogDetails(this, FuelDB.Singleton.GetBillDetails().FirstOrDefault().AvailableLiters + " " + FuelDB.Singleton.GetBillDetails().FirstOrDefault().BillPrefix + FuelDB.Singleton.GetBillDetails().FirstOrDefault().BillCurrentNumber); savedToDB = true; } catch (Exception ex) { Toast.MakeText(this, "Error in storing the values in DB", ToastLength.Short).Show(); ExceptionLog.LogDetails(this, "Error in SaveDetailsToDB " + ex.Message); btnStore.Clickable = true; savedToDB = false; } }
public ActionResult EditPayment(BillHistory collection) { using (LinkToDBDataContext context = new LinkToDBDataContext()) { BillHistory history = context.GetBillHistoryItem(collection.Id); ViewBag.Action = "Edit"; try { history.ModifyDate = DateTime.Now; history.Version += 1; history.DatePaid = collection.DatePaid; history.Amount = collection.Amount; history.Payee = collection.Payee; context.SubmitChanges(); return RedirectToAction("View", new { id = history.BillId }); } catch { return View("Payment", history); } } }
public BillHistoryInfo FindBillHistory([FromBody] FindBillHistoryRequest requestParams) { return(BillHistory.GetBillDetails(requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.PaySn, requestParams.DeviceSn)); }
public IEnumerable <BillListItem> FindBills([FromBody] FindBillsRequest requestParams) { return(BillHistory.GetBills(requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.QueryMachineSn, requestParams.Date, requestParams.Range, requestParams.DeviceSn, requestParams.PaySn, requestParams.Cashier)); }
public ActionResult BillHistory() { BillHistory listview = new BillHistory(); List <SalePoint> salepointlist = AgroExpressDBAccess.GetallEnabledSalePoint(); if (salepointlist != null) { listview.salepointlist = salepointlist.Select(x => new SelectListItem { Value = x.PKSalePointID.ToString(), Text = x.SalePointName }); } List <Area> arealist = AgroExpressDBAccess.GetallEnabledArea(); if (arealist != null) { listview.arealist = arealist.Select(x => new SelectListItem { Value = x.PKAreaId.ToString(), Text = x.AreaName }); } List <SubArea> sarealist = AgroExpressDBAccess.GetallEnabledSubArea(); if (sarealist != null) { listview.subarealist = sarealist.Select(x => new SelectListItem { Value = x.PKSubAreaId.ToString(), Text = x.SubAreaName }); } var customerlist = AgroExpressDBAccess.GetallEnabledCustomer(); if (customerlist != null) { listview.selectedcustomerlist = customerlist.Select(x => new SelectListItem { Value = x.PKCustomerId.ToString(), Text = x.FullName }); } listview.EntryDateMax = System.DateTime.Now.Date.AddDays(1); listview.EntryDateMin = listview.EntryDateMax.AddDays(-30); var billinfo = AgroExpressDBAccess.GetBillingInfoByDate(listview.EntryDateMin, listview.EntryDateMax); List <BillingHistoryListView> bill = new List <BillingHistoryListView>(); if (billinfo != null) { foreach (var li in billinfo) { bill.Add(new BillingHistoryListView { DateTime = li.DateTime, CustomerName = li.customer.FullName, BillPaid = li.BillPaid, OperatorName = li.OperatorName }); } } listview.allbills = bill; return(View(listview)); }
public ActionResult BillHistory(BillHistory listview) { List <SalePoint> salepointlist = AgroExpressDBAccess.GetallEnabledSalePoint(); if (salepointlist != null) { listview.salepointlist = salepointlist.Select(x => new SelectListItem { Value = x.PKSalePointID.ToString(), Text = x.SalePointName }); } List <Area> arealist = AgroExpressDBAccess.GetallEnabledArea(); if (arealist != null) { listview.arealist = arealist.Select(x => new SelectListItem { Value = x.PKAreaId.ToString(), Text = x.AreaName }); } List <SubArea> sarealist = AgroExpressDBAccess.GetallEnabledSubArea(); if (sarealist != null) { listview.subarealist = sarealist.Select(x => new SelectListItem { Value = x.PKSubAreaId.ToString(), Text = x.SubAreaName }); } var customerlist = AgroExpressDBAccess.GetallEnabledCustomer(); if (customerlist != null) { listview.selectedcustomerlist = customerlist.Select(x => new SelectListItem { Value = x.PKCustomerId.ToString(), Text = x.FullName }); } var billinfo = AgroExpressDBAccess.GetBillingInfoByDate(listview.EntryDateMin, listview.EntryDateMax.AddDays(1)); if (listview.PaidAmountVMax != null) { billinfo = billinfo.Where(a => a.BillPaid <= listview.PaidAmountVMax).ToList(); } if (listview.PaidAmountVMin != null) { billinfo = billinfo.Where(a => a.BillPaid >= listview.PaidAmountVMin).ToList(); } if (listview.CustomerID != null) { billinfo = billinfo.Where(a => a.CustomerId == listview.CustomerID).ToList(); } List <Area> AreList = new List <Area>(); List <SubArea> subAreList = AgroExpressDBAccess.GetallEnabledSubArea(); if (listview.SalePointId != null) { AreList = AgroExpressDBAccess.GetAreaBySalePointID((int)listview.SalePointId); if (AreList != null) { subAreList = subAreList .Where(x => AreList.Any(y => y.PKAreaId == x.AreaId)).ToList(); } customerlist = customerlist.Where(customer => subAreList.Any(subarea => subarea.PKSubAreaId == customer.SubAreaId)).ToList(); billinfo = billinfo.Where(salei => customerlist.Any(customer => customer.PKCustomerId == salei.CustomerId)).ToList(); } if (listview.AreaId != null) { subAreList = subAreList.Where(su => su.AreaId == listview.AreaId).ToList(); customerlist = customerlist.Where(customer => subAreList.Any(subarea => subarea.PKSubAreaId == customer.SubAreaId)).ToList(); billinfo = billinfo.Where(salei => customerlist.Any(customer => customer.PKCustomerId == salei.CustomerId)).ToList(); } if (listview.SubAreaId != null) { customerlist = customerlist.Where(customer => customer.SubAreaId == listview.SubAreaId).ToList(); billinfo = billinfo.Where(salei => customerlist.Any(customer => customer.PKCustomerId == salei.CustomerId)).ToList(); } List <BillingHistoryListView> bill = new List <BillingHistoryListView>(); if (billinfo != null) { foreach (var li in billinfo) { bill.Add(new BillingHistoryListView { DateTime = li.DateTime, CustomerName = li.customer.FullName, BillPaid = li.BillPaid, OperatorName = li.OperatorName }); } } listview.allbills = bill; return(View(listview)); }
public void InsertBillHistoryValues(BillHistory billHistory) { localDB.Insert(billHistory); }