示例#1
0
 public ActionResult InvoicePayment(int id, int? invoiceId, FormCollection collection)
 {
     if (!UserInfo.CurUser.HasRight("业务管理-销售收款")) return Redirect("~/content/AccessDeny.htm");
     InvoicePayment p = db.InvoicePayments.Find(id);
     if (p == null)
     {
         p = new InvoicePayment { InvoiceId = (int)invoiceId };
         db.InvoicePayments.Add(p);
     }
     TryUpdateModel(p, collection);
     Invoice invoice = db.Invoices.Find(p.InvoiceId);
     ViewBag.Payed = invoice.State == InvoiceState.已收齐;
     if (ModelState.IsValid)
     {
         if (collection["closepay"] == "1")
         {
             invoice.State = InvoiceState.已收齐;
         }
         else
         {
             invoice.State = InvoiceState.未收齐;
         }
         db.SaveChanges();
         return Redirect("~/content/close.htm");
     }
     return View(p);
 }
示例#2
0
 public ActionResult InvoicePayment(int id, int? invoiceId)
 {
     if (!UserInfo.CurUser.HasRight("业务管理-销售收款")) return Redirect("~/content/AccessDeny.htm");
     InvoicePayment p = db.InvoicePayments.Find(id);
     if (p == null)
     {
         p = new InvoicePayment { InvoiceId = (int)invoiceId, PaymentDate = DateTime.Today };
     }
     Invoice invoice = db.Invoices.Find(p.InvoiceId);
     ViewBag.Payed = invoice.State == InvoiceState.已收齐;
     return View(p);
 }