Пример #1
0
        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 }));
        }
Пример #2
0
        public int CreateBillItemAPI(CreateBillItemInput input)
        {
            double total = input.Total + input.Loyality + input.LMDA + input.TFF + input.VAT + input.CESS + input.TP + input.DataSheet + input.Others;

            var billItem = new BillItem
            {
                BillId      = input.BillId,
                ActivityId  = input.ActivityId,
                Description = input.Description,
                Loyality    = input.Loyality,
                TFF         = input.TFF,
                LMDA        = input.LMDA,
                VAT         = input.VAT,
                CESS        = input.CESS,
                TP          = input.TP,
                DataSheet   = input.DataSheet,
                Others      = input.Others,
                EquvAmont   = input.EquvAmont,
                MiscAmont   = input.MiscAmont,
                GfsCode     = input.GfsCode,
                Total       = total,
                Quantity    = input.Quantity
            };

            int obj = _billItemRepository.InsertAndGetId(billItem);

            return(obj);
        }
Пример #3
0
        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());
            }
        }
Пример #4
0
        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 }));
        }
Пример #5
0
        public IHttpActionResult ResponseBillItem([FromBody] BillItem input)
        {
            var ActivityObj = this.activityAppService.GetActivity(input.ActivityId);


            var revenue = this.revenueSourceAppService.GetRevenueResource(ActivityObj.RevenueSourceId);
            int code    = Convert.ToInt32(revenue.MainRevenueSource.Code);

            var obj = new CreateBillItemInput
            {
                BillId      = input.BillId,
                ActivityId  = input.ActivityId,
                Total       = input.Total,
                GfsCode     = code,
                Description = input.Description
            };

            int billItem   = this.billItemAppService.CreateBillItemAPI(obj);
            var newBillTem = this.billItemAppService.GetBillItem(billItem);

            return(Json(""));
        }
Пример #6
0
        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));
            }
        }
Пример #7
0
        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"));
            }
        }