public void Update(Invoice inv) { ReportingRepository.Update<InvoiceSnapshot>(inv.CreateSnapshot(), new { id = inv.CreateSnapshot().id }); }
public void Remove(Invoice inv) { ReportingRepository.Delete<InvoiceSnapshot>(new { id = inv.CreateSnapshot().id }); }
public void Save(Invoice inv) { ReportingRepository.Save<InvoiceSnapshot>(inv.CreateSnapshot()); }
private void PublishUangMukaChanged(Invoice inv, string username) { _bus.Publish(new UangMukaChanged { Payload = inv.CreateSnapshot(), Username = username }); }
private void UpdateUangMukaReceive(Invoice inv, decimal totalUangMuka) { InvoiceSnapshot invSnapshot = inv.CreateSnapshot(); ReceiveService.ChangeUangMuka(invSnapshot.id, totalUangMuka); }
private void PublishLamaAngsuranChanged(Invoice inv, string username) { _bus.Publish(new LamaAngsuranChanged { Payload = inv.CreateSnapshot(), Username = username }); }
private void PublishPaymentTypeChanged(Invoice inv, string username) { _bus.Publish(new PaymentTypeChanged { Payload = inv.CreateSnapshot(), Username = username }); }
private void PublishAngsuranPaid(Invoice inv, string username) { _bus.Publish(new AngsuranPaid { Payload = inv.CreateSnapshot(), Username = username }); }
private void PublishInvoicePulled(Invoice inv, string username) { _bus.Publish(new InvoicePulled { Payload = inv.CreateSnapshot(), Username = username }); }
private void CreateCashReceive(Invoice inv, decimal total) { InvoiceSnapshot invSnapshot = inv.CreateSnapshot(); ReceiveService.CreateCash(new CreateCashReceive { InvoiceId = invSnapshot.id, BranchId = invSnapshot.BranchId, Total = total }); }
private void CreateUangMukaReceive(Invoice inv, decimal totalUangMuka) { InvoiceSnapshot invSnapshot = inv.CreateSnapshot(); ReceiveService.CreateUangMuka(new CreateUangMukaReceive { InvoiceId = invSnapshot.id, BranchId = invSnapshot.BranchId, Total = totalUangMuka }); }
private void CreateBookingReceive(Invoice inv, decimal debitnote) { InvoiceSnapshot invSnapshot = inv.CreateSnapshot(); if (invSnapshot.Status == (int)StatusInvoice.BOOKING && debitnote > 0) { ReceiveService.CreateBooking(new CreateBookingReceive { InvoiceId = invSnapshot.id, BranchId = invSnapshot.BranchId, Total = debitnote }); } }
private void CreateAngsuranReceive(Invoice inv, DateTime date, decimal denda, long totalangsuran, decimal creditNote) { InvoiceSnapshot invSnapshot = inv.CreateSnapshot(); var perbayaranBulanKe = (Convert.ToInt32(totalangsuran) + 1) * invSnapshot.TermValue; string bulanAngsuran = string.Empty; if (invSnapshot.TermType.Equals((int)TermType.Day)) bulanAngsuran = invSnapshot.InvoiceDate.AddDays(perbayaranBulanKe).ToString("MMyyyy"); else if (invSnapshot.TermType.Equals((int)TermType.Month)) bulanAngsuran = invSnapshot.InvoiceDate.AddMonths(perbayaranBulanKe).ToString("MMyyyy"); else throw new Exception("Type termin pembayaran tidak terdefinisi"); ReceiveService.CreateAngsuran(new CreateAngsuranReceive { BranchId = invSnapshot.BranchId, Denda = Math.Round(denda), Total = Math.Round(invSnapshot.AngsuranBulanan + denda), InvoiceId = invSnapshot.id, BulanAngsuran = bulanAngsuran, PaymentDate = date, BulanAngsuranNumber = totalangsuran + 1, CreditNote = creditNote }); }
public void Credit(CreditCommand cmd, string username) { FailIfCustomerNotFound(cmd.CustomerId); FailIfProductCantSale(cmd.ProductId, cmd.BranchId); PaymentTermReport term = PaymentTermRepository.GetById(cmd.TermId); Invoice inv = new Invoice(new CreateParameter { BranchId = cmd.BranchId, CustomerId = cmd.CustomerId, id = cmd.id, InvoiceNo = InvoiceAutoNumberGenerator.GenerateInvoiceNumber(DateTime.Now, cmd.BranchId), InvoiceDate = cmd.InvoiceDate, ProductId = cmd.ProductId, Status = StatusInvoice.CREDIT, Price = cmd.Price, UangMuka = cmd.UangMuka, SukuBunga = cmd.SukuBunga, LamaAngsuran = cmd.LamaAngsuran, DueDate = cmd.DueDate, TermId = term.id, TermValue = term.Value, TermType = term.Type }); Repository.Save(inv); ProductService.ChangeStatus(cmd.ProductId, cmd.BranchId, StatusProduct.TERJUAL, username); CreateUangMukaReceive(inv, cmd.UangMuka); PerjanjianService.CreateSuratPerjanjian(inv.CreateSnapshot().id, inv.CreateSnapshot().BranchId, inv.CreateSnapshot().InvoiceDate); PublishInvoiceCreated(inv, username); }
public void Cash(CashCommand cmd, string username) { FailIfCustomerNotFound(cmd.CustomerId); FailIfProductCantSale(cmd.ProductId, cmd.BranchId); Invoice inv = new Invoice(new CashParameter { BranchId = cmd.BranchId, CustomerId = cmd.CustomerId, id = cmd.id, InvoiceNo = InvoiceAutoNumberGenerator.GenerateInvoiceNumber(DateTime.Now, cmd.BranchId), InvoiceDate = cmd.InvoiceDate, Price = cmd.Price, ProductId = cmd.ProductId, Status = StatusInvoice.PAID }); Repository.Save(inv); ProductService.ChangeStatus(cmd.ProductId, cmd.BranchId, StatusProduct.TERJUAL, username); CreateCashReceive(inv, inv.CreateSnapshot().Price); PublishInvoiceCreated(inv, username); }
public void Booking(BookingCommand cmd, string username) { FailIfCustomerNotFound(cmd.CustomerId); FailIfProductCantSale(cmd.ProductId, cmd.BranchId); if (cmd.DebitNote <= 0) throw new ApplicationException("Uang Tanda Jadi harus diisi"); Invoice inv = new Invoice(new BookingParameter { BranchId = cmd.BranchId, CustomerId = cmd.CustomerId, id = cmd.id, InvoiceNo = InvoiceAutoNumberGenerator.GenerateInvoiceNumber(DateTime.Now, cmd.BranchId), InvoiceDate = cmd.InvoiceDate, DueDate = cmd.InvoiceDate, Price = cmd.Price, ProductId = cmd.ProductId, UangTandaJadi = cmd.DebitNote, Status = StatusInvoice.BOOKING }); Repository.Save(inv); ProductService.ChangeStatus(cmd.ProductId, cmd.BranchId, StatusProduct.TERJUAL, username); CreateBookingReceive(inv, cmd.DebitNote); PublishInvoiceCreated(inv, username); }