public async Task <ProjectResult> MonthWiseSumReport(tblBill model) { try { if (ModelState.IsValid) { var result = _db.tblBills.Where(psd => psd.Bmonth == model.Bmonth && psd.Byear == model.Byear && psd.IMEINo == model.IMEINo && psd.OperatorCode == model.OperatorCode).Sum(psd => (psd.PaymentAmount1) + (psd.PaymentAmount2)).Value; return(new ProjectResult { Message = "Success", Status = 1, Response = result }); } else { return(new ProjectResult { Message = "Failed", Status = 0, Response = null }); } } catch (Exception exp) { return(new ProjectResult { Message = exp.ToString(), Status = 0, Response = null }); } }
public async Task <ProjectResult> BillNoDetails(tblBill model) { try { if (ModelState.IsValid) { var result = _db.tblBills.Where(psd => psd.Bid == model.Bid && psd.OperatorCode == model.OperatorCode).ToList(); return(new ProjectResult { Message = "Success", Status = 1, Response = result }); } else { return(new ProjectResult { Message = "Failed", Status = 0, Response = null }); } } catch (Exception exp) { return(new ProjectResult { Message = exp.ToString(), Status = 0, Response = null }); } }
public async Task <ProjectResult> PaidDetailsList(tblBill model) { try { if (ModelState.IsValid) { var result = _db.tblBills.Where(psd => psd.AgentName == model.AgentName && psd.CustId == model.CustId).ToList(); return(new ProjectResult { Message = "Success", Status = 1, Response = result }); } else { return(new ProjectResult { Message = "Failed", Status = 0, Response = null }); } } catch (Exception exp) { return(new ProjectResult { Message = exp.ToString(), Status = 0, Response = null }); } }
public void LoadById() { try { using (BudgetManagementEntities dc = new BudgetManagementEntities()) { if (this.Id != Guid.Empty) { tblBill bill = dc.tblBills.FirstOrDefault(c => c.Id == this.Id); if (bill != null) { this.Id = bill.Id; this.UserId = bill.UserId; this.DueDate = bill.DueDate; this.BillAmount = bill.BillAmount; this.PaidOnTime = bill.PaidOnTime; this.DesinationId = bill.BillDestinationId; } else { throw new Exception("Could not find the row."); } } else { throw new Exception("Id is not set."); } } } catch (Exception ex) { throw ex; } }
public ActionResult bill(FormCollection form, int id) { tblBooking book = dc.tblBookings.SingleOrDefault(ob => ob.BookingId == id); tblConsignment con = dc.tblConsignments.SingleOrDefault(ob => ob.ConsignmentId == book.ConsignmentId); tblUser user = dc.tblUsers.SingleOrDefault(ob => ob.UserId == con.UserId); tblBidding bid = dc.tblBiddings.SingleOrDefault(ob => ob.BidId == book.BidId); ViewBag.UserName = (from ob in dc.tblUsers where ob.UserId == con.UserId select ob).Take(1).SingleOrDefault().FirstName; ViewBag.Company = (from ob in dc.tblTransportCompanies where ob.CompanyId == bid.CompanyId select ob).Take(1).SingleOrDefault().CompanyName; ViewBag.Weburl = (from ob in dc.tblTransportCompanies where ob.CompanyId == bid.CompanyId select ob).Take(1).SingleOrDefault().WebURL; ViewBag.Contact = (from ob in dc.tblTransportCompanies where ob.CompanyId == bid.CompanyId select ob).Take(1).SingleOrDefault().ContactPersonNo; var com = Convert.ToInt32(Session["CompanyId"]); tblTransportCompany company = dc.tblTransportCompanies.SingleOrDefault(ob => ob.CompanyId == com); //ViewBag.Bill = (from ob in dc.tblBookings where ob.BookingId == id select ob).Take(1).SingleOrDefault().TotalPayment; tblBill bill = new tblBill(); bill.BookingId = id; bill.UserId = Convert.ToInt32(user.UserId); bill.Desc = form["txtDesc"]; bill.Price = Convert.ToInt32(book.TotalPayment); bill.TollTax = Convert.ToInt32(form["txtToll"]); bill.GST = (Convert.ToInt32(book.TotalPayment) * 18) / 100; bill.TotalPrice = Convert.ToInt32(book.TotalPayment) + Convert.ToInt32(form["txtToll"]) + (Convert.ToInt32(book.TotalPayment) * 18) / 100; bill.CompanyId = Convert.ToInt32(Session["CompanyId"]); bill.CreatedOn = DateTime.Now; dc.tblBills.Add(bill); dc.SaveChanges(); return(RedirectToAction("Index", "Home")); }
public ActionResult PaidBillEdit(tblBill bill) { if (ModelState.IsValid) { tblPaidBillModel model = new tblPaidBillModel(); model.Bid = bill.Bid; model.PaymentAmount1 = bill.PaymentAmount1; model.PaymentAmount2 = bill.PaymentAmount2; model.PaymentDate1 = bill.PaymentDate1; model.PaymentDate2 = bill.PaymentDate2; model.Monthcharge = bill.Monthcharge; model.Balance = bill.Balance; _db.Entry(bill).State = EntityState.Modified; _db.SaveChanges(); var result = _objReg.PaidBill(model); return(RedirectToAction("Dashboard", "Admin")); } return(View(bill)); }
/// <summary> /// Converts this instance of <see cref="tblBillDTO"/> to an instance of <see cref="tblBill"/>. /// </summary> /// <param name="dto"><see cref="tblBillDTO"/> to convert.</param> public static tblBill ToEntity(this tblBillDTO dto) { if (dto == null) { return(null); } var entity = new tblBill(); entity.BillId = dto.BillId; entity.BillNo = dto.BillNo; entity.BillDate = dto.BillDate; entity.PartyId = dto.PartyId; entity.BranchCode = dto.BranchCode; entity.PaymentDueDate = dto.PaymentDueDate; entity.BillType = dto.BillType; entity.BasicOfChargesGC = dto.BasicOfChargesGC; entity.Enclosure = dto.Enclosure; entity.ServiceTaxThrough = dto.ServiceTaxThrough; entity.CheckedBy = dto.CheckedBy; entity.GrandTotal = dto.GrandTotal; entity.ServiceTaxRegdNo = dto.ServiceTaxRegdNo; dto.OnEntity(entity); return(entity); }
/// <summary> /// Converts this instance of <see cref="tblBill"/> to an instance of <see cref="tblBillDTO"/>. /// </summary> /// <param name="entity"><see cref="tblBill"/> to convert.</param> public static tblBillDTO ToDTO(this tblBill entity) { if (entity == null) { return(null); } var dto = new tblBillDTO(); dto.BillId = entity.BillId; dto.BillNo = entity.BillNo; dto.BillDate = entity.BillDate; dto.PartyId = entity.PartyId; dto.BranchCode = entity.BranchCode; dto.PaymentDueDate = entity.PaymentDueDate; dto.BillType = entity.BillType; dto.BasicOfChargesGC = entity.BasicOfChargesGC; dto.Enclosure = entity.Enclosure; dto.ServiceTaxThrough = entity.ServiceTaxThrough; dto.CheckedBy = entity.CheckedBy; dto.GrandTotal = entity.GrandTotal; dto.ServiceTaxRegdNo = entity.ServiceTaxRegdNo; dto.tblConsignorDTO = entity.tblConsignor.ToDTO(); entity.OnDTO(dto); return(dto); }
public int Insert() { int result = 0; try { using (BudgetManagementEntities dc = new BudgetManagementEntities()) { tblBill bill = new tblBill(); bill.Id = Guid.NewGuid(); bill.UserId = this.UserId; bill.BillDestinationId = this.DesinationId; bill.DueDate = this.DueDate; bill.BillAmount = this.BillAmount; bill.PaidOnTime = this.PaidOnTime; dc.tblBills.Add(bill); result = dc.SaveChanges(); return(result); } } catch (Exception ex) { throw ex; } }
public int Update() { try { using (BudgetManagementEntities dc = new BudgetManagementEntities()) { if (this.Id != Guid.Empty) { tblBill bill = dc.tblBills.Where(c => c.Id == this.Id).FirstOrDefault(); bill.UserId = this.UserId; bill.BillDestinationId = this.DesinationId; bill.DueDate = this.DueDate; bill.BillAmount = this.BillAmount; bill.PaidOnTime = this.PaidOnTime; return(dc.SaveChanges()); } else { throw new Exception("Id is not set."); } } } catch (Exception ex) { throw ex; } }
public async Task <ProjectResult> DailyCollectionReportAgent(tblBill model) { try { if (ModelState.IsValid) { var result = _db.tblBills.Where(psd => (psd.PaymentDate1.Contains(model.PaymentDate1)) || (psd.PaymentDate2.Contains(model.PaymentDate2)) && psd.Bmonth == model.Bmonth && psd.Byear == model.Byear && psd.AgentName == model.AgentName && psd.OperatorCode == model.OperatorCode).ToList(); return(new ProjectResult { Message = "Successs", Status = 1, Response = result }); } else { return(new ProjectResult { Message = "Failed", Status = 0, Response = null }); } } catch (Exception exp) { return(new ProjectResult { Message = exp.ToString(), Status = 0, Response = null }); } }
public async Task <ProjectResult> DeactiveCustomerReport(tblBill model) { try { if (ModelState.IsValid) { var result = _db.tblBills.Where(psd => psd.Bmonth == model.Bmonth && psd.Byear == model.Byear && psd.IMEINo == model.IMEINo && psd.OperatorCode == model.OperatorCode && psd.Status == "Deactive").ToList(); return(new ProjectResult { Message = "Success", Status = 1, Response = result }); } else { return(new ProjectResult { Message = "Failed", Status = 0, Response = null }); } } catch (Exception exp) { return(new ProjectResult { Message = exp.ToString(), Status = 0, Response = null }); } }
public ActionResult bill(int id) { tblBooking booking = dc.tblBookings.SingleOrDefault(ob => ob.BookingId == id); ViewBag.Price = booking.TotalPayment; tblBill bill = dc.tblBills.SingleOrDefault(ob => ob.BookingId == id); return(View(bill)); }
public ActionResult PaidBillEdit(int id) { tblBill _objBill = _db.tblBills.Find(id); if (_objBill == null) { return(HttpNotFound()); } return(View(_objBill)); }
public void DeleteTest() { using (BudgetManagementEntities dc = new BudgetManagementEntities()) { tblBill tblbill = dc.tblBills.Where(c => c.BillAmount == 100).FirstOrDefault(); dc.tblBills.Remove(tblbill); dc.SaveChanges(); tblBill newbill = dc.tblBills.Where(c => c.BillAmount == 100).FirstOrDefault(); Assert.IsNull(newbill); } }
private int AddOrUpdateTractorBill(Bill tractorBill) { tblBill bill = new tblBill() { Customer_Id = tractorBill.CustomerId, Bill_GrandTotal = tractorBill.GrandTotal, Bill_Date = tractorBill.DateOfBill, Bill_Type = "T" }; dc.tblBills.InsertOnSubmit(bill); dc.SubmitChanges(); return dc.tblBills.Max(s => s.Bill_Id); }
private int AddOrUpdateTractorBill(Bill tractorBill) { tblBill bill = new tblBill() { Customer_Id = tractorBill.CustomerId, Bill_GrandTotal = tractorBill.GrandTotal, Bill_Date = tractorBill.DateOfBill, Bill_Type = "T" }; dc.tblBills.InsertOnSubmit(bill); dc.SubmitChanges(); return(dc.tblBills.Max(s => s.Bill_Id)); }
public ActionResult Detail(int id) { tblBill bill = dc.tblBills.SingleOrDefault(ob => ob.BillId == id); ViewBag.UserName = (from ob in dc.tblUsers where ob.UserId == bill.UserId select ob).Take(1).SingleOrDefault().FirstName; ViewBag.cno = (from ob in dc.tblUsers where ob.UserId == bill.UserId select ob).Take(1).SingleOrDefault().ContactNo; ViewBag.ComName = (from ob in dc.tblTransportCompanies where ob.CompanyId == bill.CompanyId select ob).Take(1).SingleOrDefault().CompanyName; ViewBag.WebUrl = (from ob in dc.tblTransportCompanies where ob.CompanyId == bill.CompanyId select ob).Take(1).SingleOrDefault().WebURL; string Name = ViewBag.UserName; string no = ViewBag.cno; string com = ViewBag.ComName; string url = ViewBag.WebUrl; return(View(bill)); }
public ActionResult ActiveCustomerReport() { // tblDailyCollectionModel model = new tblDailyCollectionModel(); tblBill model = new tblBill(); model.PaymentDate1 = Convert.ToString(System.DateTime.Now.Date); model.PaymentDate1 = model.PaymentDate1.Remove(10); model.PaymentDate2 = Convert.ToString(System.DateTime.Now.Date); model.PaymentDate2 = model.PaymentDate2.Remove(10); model.Bmonth = Convert.ToString(DateTime.Now.ToString("MMM")); model.Byear = Convert.ToString(DateTime.Now.Year); var result = _db.tblBills.Where(psd => psd.Bmonth == model.Bmonth && psd.Byear == model.Byear && psd.Status == "Active").ToList(); return(View(result)); }
public void InsertTest() { using (BudgetManagementEntities dc = new BudgetManagementEntities()) { tblUser user = dc.tblUsers.Where(c => c.FirstName == "Owen").FirstOrDefault(); tblBillDestination destination = dc.tblBillDestinations.Where(c => c.BusinessName == "Spectrum").FirstOrDefault(); tblBill tblbill = new tblBill(); tblbill.Id = Guid.NewGuid(); tblbill.UserId = user.Id; tblbill.BillDestinationId = destination.Id; tblbill.BillAmount = 50; tblbill.DueDate = new DateTime(2019, 5, 1); tblbill.PaidOnTime = true; dc.tblBills.Add(tblbill); dc.SaveChanges(); tblBill newbill = dc.tblBills.Where(c => c.BillAmount == 50).FirstOrDefault(); Assert.AreEqual(newbill.BillAmount, 50); } }
public int Delete() { try { using (BudgetManagementEntities dc = new BudgetManagementEntities()) { if (this.Id != Guid.Empty) { tblBill bill = dc.tblBills.Where(c => c.Id == this.Id).FirstOrDefault(); dc.tblBills.Remove(bill); return(dc.SaveChanges()); } else { throw new Exception("Id is not set."); } } } catch (Exception ex) { throw ex; } }
/// <summary> /// Invoked when <see cref="ToEntity"/> operation is about to return. /// </summary> /// <param name="entity"><see cref="tblBill"/> converted from <see cref="tblBillDTO"/>.</param> static partial void OnEntity(this tblBillDTO dto, tblBill entity);
/// <summary> /// Invoked when <see cref="ToDTO"/> operation is about to return. /// </summary> /// <param name="dto"><see cref="tblBillDTO"/> converted from <see cref="tblBill"/>.</param> static partial void OnDTO(this tblBill entity, tblBillDTO dto);
public async Task <ProjectResult> PaidBill(tblPaidBillModel model) { try { if (ModelState.IsValid) { // var result = _db.tblBills.Where(psd=>psd.CustId==model.CustId).FirstOrDefault(); using (CableApiAndroidEntity _db = new CableApiAndroidEntity()) { tblBill _objBill = (from psd in _db.tblBills.Where(psd => psd.Bid == model.Bid) select psd).FirstOrDefault(); tblCustomerRegistration _objCust = (from psd in _db.tblCustomerRegistrations.Where(psd => psd.CustId == _objBill.CustId) select psd).FirstOrDefault(); if (model.PaymentAmount2 != 0 && model.PaymentDate2 != "") { //_objBill.PaymentAmount1 = model.PaymentAmount1; //_objBill.PaymentDate1 = model.PaymentDate1; _objBill.PaymentAmount2 = model.PaymentAmount2; _objBill.PaymentDate2 = model.PaymentDate2; _objBill.Balance = model.Balance; _objBill.Bid = model.Bid; } else { _objBill.PaymentAmount1 = model.PaymentAmount1; _objBill.PaymentDate1 = model.PaymentDate1; _objBill.PaymentAmount2 = 0; _objBill.PaymentDate2 = ""; _objBill.Balance = model.Balance; _objBill.Bid = model.Bid; } if (model.PaymentAmount1 != 0 && model.PaymentAmount2 == 0) { //_objBill.Balance = (model.Monthcharge-model.PaymentAmount1); _objCust.OldBal = model.Balance; } else { //_objBill.Balance = (model.Monthcharge - (model.PaymentAmount2 + model.PaymentAmount1)); _objCust.OldBal = model.Balance; } _db.Entry(_objBill).State = System.Data.Entity.EntityState.Modified; _db.SaveChanges(); _db.Entry(_objCust).State = System.Data.Entity.EntityState.Modified; _db.SaveChanges(); return(new ProjectResult { Message = "Success", Status = 1, Response = _objBill }); } } else { return(new ProjectResult { Message = "Failed", Status = 0, Response = null }); } } catch (Exception exp) { return(new ProjectResult { Message = exp.ToString(), Status = 0, Response = null }); } }
public async Task <ProjectResult> BillGeneration(tblBillGenerationModel model) { try { var result1 = _db.tblBills.Where(a => a.Bmonth == model.Bmonth && a.Byear == model.Byear && a.IMEINo == model.IMEINo && a.OperatorCode == model.OperatorCode).ToList(); if (result1.Count == 0) { tblBill _objBill = new tblBill(); var result = _db.tblCustomerRegistrations.ToList(); if (result.Count != 0) { foreach (var record in result) { _objBill.CustId = record.CustId; _objBill.CustName = record.CustName; _objBill.Address = record.Address; _objBill.MobileNo = record.MobileNo; _objBill.Area = record.Area; _objBill.NoOfBox = record.NoOfBox; _objBill.SetupBox_Details = record.SetupBox_Details; _objBill.Package = record.Package; if (record.OldBal == null) { record.OldBal = 0; } _objBill.Monthcharge = (Convert.ToInt32(record.PackageRate + record.OldBal)); _objBill.RegistrationDate = record.RegistrationDate; _objBill.AgentName = record.AgentName; _objBill.PaymentDate1 = ""; _objBill.PaymentAmount1 = 0; _objBill.PaymentDate2 = ""; _objBill.PaymentAmount2 = 0; _objBill.OldBal = record.OldBal; _objBill.Balance = (Convert.ToInt32(record.PackageRate + record.OldBal)); _objBill.Bmonth = model.Bmonth; _objBill.Byear = model.Byear; _objBill.Status = record.Status; _objBill.IMEINo = record.IMEINo; _objBill.OperatorCode = record.OperatorCode; _db.tblBills.Add(_objBill); _db.SaveChanges(); } return(new ProjectResult { Message = "Success", Status = 1, Response = "Success" }); } else { return(new ProjectResult { Message = "Failed", Status = 0, Response = null }); } } else { return(new ProjectResult { Message = "Bill Already Generated", Status = 2, Response = null }); } } catch (Exception exp) { return(new ProjectResult { Message = exp.ToString(), Status = 0, Response = null }); } }