예제 #1
0
        // GET: Payables/Approve
        public async Task <IActionResult> Approve(Guid productId)
        {
            HttpContext.Session.SetString("ProductID", productId.ToString());

            var payablesdue = await(_context.ClaimTransactions
                                    .Include(c => c.Account)
                                    .Include(c => c.Affected)
                                    .Include(c => c.Claim)
                                    .Include(c => c.Payee)
                                    .Include(c => c.TransactionType)
                                    .AsNoTracking()
                                    .Where(p => // p.Claim.Policy.ProductID == productId &&
                                           p.Authorised == true &&
                                           p.PassForPayment == 0)
                                    .OrderBy(t => t.TransactionNumber)
                                    .OrderBy(c => c.InvoiceDate)).ToListAsync();

            PayableViewModel viewModel = new PayableViewModel()
            {
                ProductID         = productId,
                ProductName       = ProductName(productId),
                ClaimTransactions = payablesdue
            };

            return(View(viewModel));
        }
예제 #2
0
        public ActionResult GetBookingById(PayableViewModel PViewModel)
        {
            try
            {
                PaginationInfo pager = new PaginationInfo();

                pager = PViewModel.Pager;

                PaginationViewModel pViewModel = new PaginationViewModel();
                PViewModel.PayableInfo        = _payablerepo.GetVendorDetailsById(PViewModel.PayableInfo.BookingId);
                PViewModel.PayableHistoryList = _payablerepo.GetPaymentHistoryForPayment(PViewModel.PayableInfo.BookingId);
                decimal temptotalpaid = 0;
                foreach (var item in PViewModel.PayableHistoryList)
                {
                    temptotalpaid += item.AmountPaid;
                }

                PViewModel.PayableInfo.TotalAmountPaid = temptotalpaid;
                Logger.Debug("Customer Controller GetVendorById");
            }
            catch (Exception ex)
            {
                PViewModel.FriendlyMessage.Add(MessageStore.Get("SYS01"));

                Logger.Error("Payable Controller - GetVendorById" + ex.ToString());
            }
            TempData["PViewModel"] = PViewModel;
            return(View("AddPayable", PViewModel));
        }
예제 #3
0
        public async Task <IActionResult> PayablesConfirmed(PayableViewModel viewModel)
        {
            // Make Paid and generate EFT file
            Guid currentUserId = Guid.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier));

            var payParam = new object[] { Guid.NewGuid(), viewModel.ProductID, viewModel.Payable.Reference,
                viewModel.Payable.PayableDate, viewModel.Payable.PaymentTypeID,
                viewModel.Payable.Amount, viewModel.Payable.BatchNumber,
                false, null, null, null, DateTime.Now, currentUserId, null, null };

            await _context.Database.ExecuteSqlCommandAsync(
                "INSERT INTO Payable(ID, ProductID, Reference, PayableDate, PaymentTypeID, Amount, BatchNumber, " +
                "Void, VoidReason, Remarks, PayableExportID, DateAdded, AddedBy, DateModified, ModifiedBy) " +
                "Values({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14})",
                parameters : payParam);

            Guid payableId = GetPayableId(viewModel.Payable.Reference);

            foreach (var c in viewModel.ClaimTransactions)
            {
                var myParams = new object[] { c.ID, payableId };

                await _context.Database.ExecuteSqlCommandAsync(
                    "UPDATE ClaimTransaction SET PayableID = {1} WHERE ID = {0}",
                    parameters : myParams);
            }

            return(RedirectToAction("GeneratePayables", new { productId = viewModel.ProductID }));
        }
예제 #4
0
        public JsonResult GetPayable(PayableViewModel PViewModel)
        {
            PaginationInfo pager = new PaginationInfo();

            pager = PViewModel.Pager;

            PaginationViewModel pViewModel = new PaginationViewModel();

            try
            {
                pViewModel.dt = _payablerepo.GetPayable(PViewModel.PayableInfo.VendorName, PViewModel.PayableInfo.BookingNo, PViewModel.PayableInfo.ProductId, PViewModel.PayableInfo.PaymentStatus, ref pager);

                pViewModel.Pager = pager;

                Logger.Debug("Payable Controller GetCustomer");
            }

            catch (Exception ex)
            {
                PViewModel.FriendlyMessage.Add(MessageStore.Get("SYS01"));

                Logger.Error("Payable Controller - GetPayable" + ex.ToString());
            }
            return(Json(JsonConvert.SerializeObject(pViewModel), JsonRequestBehavior.AllowGet));
        }
예제 #5
0
        public ActionResult Update(PayableViewModel PViewModel)
        {
            try
            {
                Set_Date_Session(PViewModel.PayableInfo);
                Set_Date_Session(PViewModel.PayableHistoryInfo);
                Set_Date_Session(PViewModel.TransactionInfo);
                Set_Date_Session(PViewModel.PayableInfo.PayableHistoryInfo);

                _payablerepo.UpdatePayable(PViewModel.PayableInfo);

                int PayableId = PViewModel.PayableInfo.PayableId;

                if (PViewModel.PayableInfo.PayableHistoryInfo.Cheque_No != null)
                {
                    PViewModel.PayableInfo.PayableHistoryInfo.TransactionModeNo = PViewModel.PayableInfo.PayableHistoryInfo.Cheque_No;
                }
                else if (PViewModel.PayableInfo.PayableHistoryInfo.Debit_Card_No != null)
                {
                    PViewModel.PayableInfo.PayableHistoryInfo.TransactionModeNo = PViewModel.PayableInfo.PayableHistoryInfo.Debit_Card_No;
                }
                else if (PViewModel.PayableInfo.PayableHistoryInfo.Credit_Card_No != null)
                {
                    PViewModel.PayableInfo.PayableHistoryInfo.TransactionModeNo = PViewModel.PayableInfo.PayableHistoryInfo.Credit_Card_No;
                }
                if (PViewModel.PayableInfo.PayableHistoryInfo.Transaction_No != null)
                {
                    PViewModel.PayableInfo.PayableHistoryInfo.TransactionModeNo = PViewModel.PayableInfo.PayableHistoryInfo.Transaction_No;
                }
                var PayableHistoryInfo = PViewModel.PayableInfo.PayableHistoryInfo;

                PViewModel.PayableInfo.PayableHistoryInfo.PayableHistoryId = _payablerepo.InsertPayableHistory(PayableHistoryInfo, PayableId);

                PViewModel.PayableHistoryList = _payablerepo.GetPaymentHistoryForPayment(PViewModel.PayableInfo.BookingId);
                decimal temptotalpaid = 0;
                foreach (var item in PViewModel.PayableHistoryList)
                {
                    temptotalpaid += item.AmountPaid;
                }

                PViewModel.PayableInfo.TotalAmountPaid = temptotalpaid;
                PViewModel.FriendlyMessage.Add(MessageStore.Get("Pa02"));

                Logger.Debug("Payable Controller Updatepayable");
            }
            catch (Exception ex)
            {
                PViewModel.FriendlyMessage.Add(MessageStore.Get("SYS01"));

                Logger.Error("Payable Controller - UpdatePayable  " + ex.Message);
            }

            TempData["MessageModel"] = PViewModel.FriendlyMessage;

            return(RedirectToAction("Search"));
        }
예제 #6
0
        public ActionResult Insert(PayableViewModel PViewModel)
        {
            try
            {
                Set_Date_Session(PViewModel.PayableInfo);
                Set_Date_Session(PViewModel.PayableHistoryInfo);
                Set_Date_Session(PViewModel.TransactionInfo);
                Set_Date_Session(PViewModel.PayableInfo.PayableHistoryInfo);

                PViewModel.PayableInfo.PayableId = _payablerepo.InsertPayable(PViewModel.PayableInfo);

                int PayableId = PViewModel.PayableInfo.PayableId;

                if (PViewModel.PayableInfo.PayableHistoryInfo.Cheque_No != null)
                {
                    PViewModel.PayableInfo.PayableHistoryInfo.TransactionModeNo = PViewModel.PayableInfo.PayableHistoryInfo.Cheque_No;
                }
                else if (PViewModel.PayableInfo.PayableHistoryInfo.Debit_Card_No != null)
                {
                    PViewModel.PayableInfo.PayableHistoryInfo.TransactionModeNo = PViewModel.PayableInfo.PayableHistoryInfo.Debit_Card_No;
                }
                else if (PViewModel.PayableInfo.PayableHistoryInfo.Credit_Card_No != null)
                {
                    PViewModel.PayableInfo.PayableHistoryInfo.TransactionModeNo = PViewModel.PayableInfo.PayableHistoryInfo.Credit_Card_No;
                }
                if (PViewModel.PayableInfo.PayableHistoryInfo.Transaction_No != null)
                {
                    PViewModel.PayableInfo.PayableHistoryInfo.TransactionModeNo = PViewModel.PayableInfo.PayableHistoryInfo.Transaction_No;
                }
                var PayableHistoryInfo = PViewModel.PayableInfo.PayableHistoryInfo;

                PViewModel.PayableInfo.PayableHistoryInfo.PayableHistoryId = _payablerepo.InsertPayableHistory(PayableHistoryInfo, PayableId);

                PViewModel.PayableInfo.PayableHistoryInfo.PayableHistoryId = _payablerepo.InsertPayableHistory(PayableHistoryInfo, PayableId);


                PViewModel.FriendlyMessage.Add(MessageStore.Get("Pa01"));

                TempData["MessageModel"] = PViewModel.FriendlyMessage;

                Logger.Debug("Payable Controller Insert");
            }
            catch (Exception ex)
            {
                PViewModel.FriendlyMessage.Add(MessageStore.Get("SYS01"));

                Logger.Error("Payable Controller - Insert " + ex.Message);
            }
            return(RedirectToAction("Search"));
        }
예제 #7
0
        public ActionResult Search(PayableViewModel PViewModel)
        {
            if (TempData["PViewModel"] != null)
            {
                PViewModel = (PayableViewModel)TempData["PViewModel"];
            }

            if (TempData["MessageModel"] != null)
            {
                PViewModel.FriendlyMessage = (List <FriendlyMessage>)TempData["MessageModel"];
            }


            return(View("Search", PViewModel));
        }
예제 #8
0
        public async Task <IActionResult> ApproveConfirmed(PayableViewModel viewModel)
        {
            //bool authValue = authorised ? false : true;
            //Guid currentUserId = Guid.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier));

            foreach (var c in viewModel.ClaimTransactions)
            {
                var myParams = new object[] { c.ID, 1 };

                await _context.Database.ExecuteSqlCommandAsync(
                    "UPDATE ClaimTransaction SET PassForPayment = {1} WHERE ID = {0}",
                    parameters : myParams);
            }

            return(RedirectToAction("Approve", new { productId = viewModel.ProductID }));
        }
예제 #9
0
        public async Task <IActionResult> Payables(Guid productId)
        {
            var payables = await(_context.ClaimTransactions
                                 .Include(c => c.Account)
                                 .Include(c => c.Affected)
                                 .Include(c => c.Claim)
                                 .Include(c => c.Payee)
                                 .Include(c => c.TransactionType)
                                 .AsNoTracking()
                                 .Where(p => // p.Claim.Policy.ProductID == productId &&
                                        p.Authorised == true &&
                                        p.PassForPayment == 1)
                                 .OrderBy(t => t.TransactionNumber)
                                 .OrderBy(c => c.InvoiceDate)).ToListAsync();

            PayableViewModel viewModel = new PayableViewModel()
            {
                ProductID         = productId,
                ClaimTransactions = payables
            };

            return(View(viewModel));
        }