public async Task CreateBill1(CreateBillInput input) { //get current active financial year; var current = _financialYearRepository.FirstOrDefault(c => c.IsActive == true); var loginUser = _userRepository.FirstOrDefault(Convert.ToInt32(AbpSession.UserId)); if (current != null & loginUser != null) { var bill = new Bill { ApplicantId = input.ApplicantId, Description = input.Description, BillAmount = input.BillAmount, Currency = input.Currency, IssuedDate = DateTime.Now, ExpiredDate = input.ExpiredDate, FinancialYearId = current.Id, StationId = loginUser.StationId }; await _billRepository.InsertAsync(bill); } else { throw new UserFriendlyException("No Active Financial Year"); } }
public ActionResult Bill(int id, CreateBillInput billInput, int ActivityId) { var dealer = _dealerAppService.GetDealer(id); if (dealer != null) { var activities = _dealerActivityAppService.GetDealerActivities(dealer); var revenue = _revenueSourceAppService.GetRevenueResource(ActivityId); //Dealer Registration Bill int bill = _billAppService.CreateBill(billInput); if (bill > 0) { foreach (var activity in activities) { var item = new CreateBillItemInput { BillId = bill, ActivityId = ActivityId, Description = revenue.Description, Loyality = activity.Activity.Fee + activity.Activity.RegistrationFee, Total = activity.Activity.Fee + activity.Activity.RegistrationFee }; _billItemAppService.CreateBillItem(item); _dealerAppService.UpdateBillControlNumber(dealer, _billAppService.GetBill(bill).ControlNumber); } } return(RedirectToAction("ApplicationBill", "DealerActivities", new { id = bill })); } return(RedirectToAction("Create", new { id = dealer.Id })); }
public int CreateBill(CreateBillInput input) { //get current active financial year; var current = _financialYearRepository.FirstOrDefault(c => c.IsActive == true); var loginUser = _userRepository.FirstOrDefault(Convert.ToInt32(AbpSession.UserId)); if (current != null) { var bill = new Bill { ApplicantId = input.ApplicantId, Description = input.Description, BillAmount = input.BillAmount, EquvAmont = input.EquvAmont, MiscAmont = input.MiscAmont, Currency = input.Currency, IssuedDate = DateTime.Now, ExpiredDate = DateTime.Now.AddDays(15), FinancialYearId = current.Id, StationId = input.StationId }; var billId = _billRepository.InsertAndGetId(bill); return(billId); } else { throw new UserFriendlyException("No Active Financial Year"); } }
public ActionResult CreateBill(CreateBillInput input, int[] ActivityId, int[] Quantity, double[] Amount, double total) { var loginUser = _userRepository.FirstOrDefault(Convert.ToInt32(AbpSession.UserId)); try { //insert Bill details DateTime billExpireDate = DateTime.Now; billExpireDate = billExpireDate.AddDays(30); input.ExpiredDate = billExpireDate; input.BillAmount = total; input.StationId = loginUser.StationId; int CreatedBillId = this.billAppService.CreateBill(input); for (int i = 0; i < ActivityId.Length; i++) { var ActivityObj = this.activityAppService.GetActivity(ActivityId[i]); var revenue = this.revenueSourceAppService.GetRevenueResource(ActivityObj.RevenueSourceId); int code = Convert.ToInt32(revenue.MainRevenueSource.Code); if (ActivityObj != null) { var obj = new CreateBillItemInput { BillId = CreatedBillId, ActivityId = ActivityId[i], Description = ActivityObj.Description, Quantity = Quantity[i], GfsCode = code, Total = Amount[i] }; this.billItemAppService.CreateBillItem(obj); } } //redirect to Tp page TempData["success"] = string.Format(@"The Bill has been Created successfully!"); return(RedirectToAction("CreateTp", new { Id = CreatedBillId })); //return Json(new { Total = GTotal, gfs = GfsCode }); } catch (Exception ex) { TempData["danger"] = ex.Message; ViewBag.Applicant = this.applicantService.GetApplicantById(input.ApplicantId); ViewBag.Activities = this.activityAppService.GetActivities(); ViewBag.ActivitiyId = new SelectList(this.activityAppService.GetActivities(), "Id", "Description"); return(View()); } }
public ActionResult Bill(int id, CreateBillInput billInput, int ActivityId) { var dealer = _dealerAppService.GetDealer(id); if (dealer != null) { var revenue = _revenueSourceAppService.GetRevenueResource(ActivityId); var items = _allocatedPlotAppService.GetAllocatedPlotsByDealer(dealer); var user = _userAppService.GetLoggedInUser(); var Fyear = _financialYearAppService.GetActiveFinancialYear(); //Dealer Registration Bill int bill = _billAppService.CreateBill(billInput); if (bill > 0) { foreach (var item in items) { var billItem = new CreateBillItemInput { BillId = bill, ActivityId = ActivityId, Description = revenue.Description, Loyality = item.Loyality, TFF = item.TFF, LMDA = item.LMDA, CESS = item.CESS, VAT = item.VAT, TP = item.TP, Total = item.TOTAL }; _billItemAppService.CreateBillItem(billItem); } var License = new CreateLicenseInput { BillId = bill, FinancialYearId = Fyear.Id, StationId = user.StationId, IssuedDate = DateTime.Now }; _licenseAppService.CreateLicense(License);// Create Licence under pending status return(RedirectToAction("ApplicationBill", "PlotAllocation", new { id = bill })); } } return(RedirectToAction("Index", new { id = id })); }
public IHttpActionResult RespondBill([FromBody] Bill input) { //insert Bill details var obj = new CreateBillInput { ApplicantId = input.ApplicantId, StationId = input.StationId, Currency = "TZS", Description = input.Description, BillAmount = input.BillAmount }; var Billid = this.billAppService.CreateBill(obj); var bill = this.billAppService.GetBill(Billid); return(Json(bill)); }
public ActionResult Create(CreateBillInput input, int[] sources, double[] Amount, double total) { if (ModelState.IsValid) { input.BillAmount = Convert.ToDouble(total); int bill = _billAppService.CreateBill(input); if (bill > 0) { for (int i = 0; i < sources.Length; i++) {// change var source = _revenueSourceAppService.GetRevenueResource(sources[i]); if (source != null) { CreateBillItemInput item = new CreateBillItemInput { BillId = bill, ActivityId = source.Id, Description = source.Description, Loyality = Convert.ToDouble(Amount[i]) }; _billItemAppService.CreateBillItem(item); } } } //return RedirectToAction("CreateNew"); return(Json(Url.Action("Details", "Bills", new { id = bill }))); } else { var dealers = _dealerAppService.GetAllDealers().Select(c => new SelectListItem { Value = c.Id.ToString(), Text = c.Applicant.Name }); ViewBag.DealerId = dealers; return(View(input)); } }
public ActionResult ApproveRegistration(DealerDto input) { double TotalBillAmount = 0; try { var dealer = _dealerAppService.GetDealer(input.Id); var DealerActivities = _dealerActivityAppService.GetDealerActivities(dealer); if (input.Remark != null && dealer != null) { int dealerId = _dealerAppService.ApproveRegistration(dealer); foreach (var activity in DealerActivities) { TotalBillAmount = TotalBillAmount + activity.Activity.Fee + activity.Activity.RegistrationFee; } DateTime billExpireDate = DateTime.Now; billExpireDate = billExpireDate.AddDays(30); var RegistrationBill = new CreateBillInput { ApplicantId = dealer.ApplicantId, StationId = dealer.StationId, FinancialYearId = dealer.FinancialYearId, BillAmount = TotalBillAmount, EquvAmont = TotalBillAmount, Description = "Application For Registration Fee", ExpiredDate = billExpireDate, Currency = "TZS" }; int bill = _billAppService.CreateBill(RegistrationBill); // create bill foreach (var activity in DealerActivities) /// add Bill Items { CreateBillItemInput item = new CreateBillItemInput { BillId = bill, ActivityId = activity.ActivityId, Description = activity.Activity.Description, Loyality = activity.Activity.Fee + activity.Activity.RegistrationFee, EquvAmont = activity.Activity.Fee + activity.Activity.RegistrationFee, }; _billItemAppService.CreateBillItem(item); } TempData["success"] = string.Format(@"The application has been approved successfully!"); return(RedirectToAction("OnlineRegApplications")); } else { ViewBag.DealerActivities = DealerActivities; TempData["danger"] = string.Format(@"Failed to reject the selected application, remarks field should not be empty!"); return(View(dealer)); } } catch { TempData["danger"] = string.Format(@"Failed to approve the selected application!"); return(RedirectToAction("OnlineRegApplications")); } }