コード例 #1
0
ファイル: InvoiceController.cs プロジェクト: AsliMotor/AMQ
 public JsonResult UpdateToCredit(UpdateToCreditCommand cmd)
 {
     try
     {
         CompanyProfile cp = new CompanyProfile(this.HttpContext);
         cmd.BranchId = cp.BranchId;
         InvoiceService.UpdateToCredit(cmd, cp.UserName);
         return Json(new { error = false, data = cmd }, JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex)
     {
         return Json(new { error = true, message = ex.Message }, JsonRequestBehavior.AllowGet);
     }
 }
コード例 #2
0
ファイル: InvoiceService.cs プロジェクト: AsliMotor/AMQ
 public void UpdateToCredit(UpdateToCreditCommand cmd, string username)
 {
     Invoice inv = Repository.Get(cmd.InvoiceId);
     InvoiceSnapshot invSnap = inv.CreateSnapshot();
     FailIfInvoiceNotFound(invSnap);
     if (invSnap.Status == (int)StatusInvoice.BOOKING)
     {
         Receive bookingRcv = ReceiveRepository.GetBooking(invSnap.id);
         PaymentTermReport term = PaymentTermRepository.GetById(cmd.TermId);
         inv.UpdateToCredit(new UpdateToCreditParameter
         {
             DueDate = cmd.DueDate,
             LamaAngsuran = cmd.LamaAngsuran,
             SukuBunga = cmd.SukuBunga,
             UangMuka = cmd.UangMuka,
             UangTandaJadi = bookingRcv.Total,
             TermId = cmd.TermId,
             TermValue = term.Value,
             TermType = term.Type
         });
         Repository.Update(inv);
         CreateUangMukaReceive(inv, cmd.UangMuka);
         PerjanjianService.CreateSuratPerjanjian(inv.CreateSnapshot().id, inv.CreateSnapshot().BranchId, DateTime.Now);
         PublishPaymentTypeChanged(inv, username);
     }
 }