示例#1
0
        //
        // GET: /PaymentMaster/Create
        public ActionResult Create()
        {
            PaymentMaster payment = new PaymentMaster();
            ViewBag.IdPaymentType = new SelectList(_repo.PaymentTypes, "IdPaymentType", "NamePaymentType");
            ViewBag.IdChartOfAccount = new SelectList(_repo.ChartOfAccounts, "IdChartOfAccount", "NumChartOfAccount");

            return View(payment);
        }
示例#2
0
        public void CreatePayment(IEnumerable<InvoiceMaster> invoices, MemberPaymentViewModel model, string user)
        {
            PaymentMaster payment = new PaymentMaster();
            PaymentDetail paymentDetail = new PaymentDetail();
            var member = _repo.GetMemberById(model.IdMember);

            payment.NumPayment = "1";
            payment.DatePayment = DateTime.Now;
            payment.IsPosted = true;

            payment.AmtPayment = model.AmtPayment;

            payment.NameAccount = model.NameAccount;
            payment.NumAccount = model.NumAccount;
            payment.MonthExpires = _repo.GetMonthById(model.IdMonth).MonthValue;
            payment.YearExpires = _repo.GetYearById(model.IdYear).YearValue;
            payment.NumICVerify = model.NumICVerify;
            payment.IsICVerify = model.IsICVerify;
            payment.NumCheck = model.NumCheck;
            payment.AccountNumber = model.AccountNumber;
            payment.RoutingNumber = model.RoutingNumber;
            payment.DateCreated = DateTime.Now;
            payment.DateModified = DateTime.Now;
            payment.CreatedByLogin = user;
            payment.ModifiedByLogin = user;
            payment.IdPaymentType = model.IdPaymentType;
            payment.IdMember = model.IdMember;
            payment.IdChartOfAccount = model.IdChartOfAccount;
            member.TotalAmountDue -= model.AmtPayment;

            paymentDetail.Invoices = invoices;

            foreach (InvoiceMaster invoice in invoices)
            {
                InvoiceMaster inv = _repo.GetInvoiceMasterById(invoice.IdInvoiceMaster);
                inv.State = false;

                _repo.Update(inv);
            }

            _repo.Add(payment);
            member.Payments.Add(payment);
            _repo.Update(member);
        }
示例#3
0
 public void Update(PaymentMaster paymentMaster)
 {
     _db.Entry(paymentMaster).State = EntityState.Modified;
     _db.SaveChanges();
 }
示例#4
0
 public void Remove(PaymentMaster paymentMaster)
 {
     _db.PaymentMasters.Remove(paymentMaster);
     _db.SaveChanges();
 }
示例#5
0
 public void Add(PaymentMaster paymentMaster)
 {
     _db.PaymentMasters.Add(paymentMaster);
     _db.SaveChanges();
 }
示例#6
0
 public ActionResult Edit(PaymentMaster paymentmaster)
 {
     if (ModelState.IsValid)
     {
         _repo.Update(paymentmaster);
         return RedirectToAction("Index");
     }
     ViewBag.IdMember = new SelectList(_repo.Members, "IdMember", "MemberNumber", paymentmaster.IdMember);
     ViewBag.IdPaymentType = new SelectList(_repo.PaymentTypes, "IdPaymentType", "NamePaymentType", paymentmaster.IdPaymentType);
     ViewBag.IdChartOfAccount = new SelectList(_repo.ChartOfAccounts, "IdChartOfAccount", "NumChartOfAccount", paymentmaster.IdChartOfAccount);
     return View(paymentmaster);
 }