public dynamic Insert(SalesInvoice model) { try { if (!AuthenticationModel.IsAllowed("Create", Core.Constants.Constant.MenuName.SalesInvoice, Core.Constants.Constant.MenuGroupName.Transaction)) { Dictionary <string, string> Errors = new Dictionary <string, string>(); Errors.Add("Generic", "You are Not Allowed to Add record"); return(Json(new { Errors }, JsonRequestBehavior.AllowGet)); } model = _salesInvoiceService.CreateObject(model, _deliveryOrderService); } catch (Exception ex) { LOG.Error("Insert Failed", ex); Dictionary <string, string> Errors = new Dictionary <string, string>(); Errors.Add("Generic", "Error " + ex); return(Json(new { Errors }, JsonRequestBehavior.AllowGet)); } return(Json(new { model.Errors })); }
public void PopulateInvoiceData() { TimeSpan receivedDate = new TimeSpan(3, 0, 0, 0); TimeSpan lateDeliveryDate = new TimeSpan(2, 0, 0, 0); _deliveryOrderService.ConfirmObject(do1, DateTime.Now.Subtract(receivedDate), _deliveryOrderDetailService, _salesOrderService, _salesOrderDetailService, _stockMutationService, _itemService, _barringService, _warehouseItemService); _deliveryOrderService.ConfirmObject(do2, DateTime.Now.Subtract(receivedDate), _deliveryOrderDetailService, _salesOrderService, _salesOrderDetailService, _stockMutationService, _itemService, _barringService, _warehouseItemService); _deliveryOrderService.ConfirmObject(do3, DateTime.Now.Subtract(receivedDate), _deliveryOrderDetailService, _salesOrderService, _salesOrderDetailService, _stockMutationService, _itemService, _barringService, _warehouseItemService); si1 = new SalesInvoice() { InvoiceDate = DateTime.Today, Description = "Penjualan DO1", DeliveryOrderId = do1.Id, IsTaxable = true, Discount = 0, DueDate = DateTime.Today.AddDays(14) }; si1 = _salesInvoiceService.CreateObject(si1, _deliveryOrderService); si1a = new SalesInvoiceDetail() { SalesInvoiceId = si1.Id, DeliveryOrderDetailId = do1a.Id, Quantity = do1a.Quantity }; si1a = _salesInvoiceDetailService.CreateObject(si1a, _salesInvoiceService, _salesOrderDetailService, _deliveryOrderDetailService); si1b = new SalesInvoiceDetail() { SalesInvoiceId = si1.Id, DeliveryOrderDetailId = do1b.Id, Quantity = do1b.Quantity }; si1b = _salesInvoiceDetailService.CreateObject(si1b, _salesInvoiceService, _salesOrderDetailService, _deliveryOrderDetailService); si2 = new SalesInvoice() { InvoiceDate = DateTime.Today, Description = "Penjualan DO2", DeliveryOrderId = do2.Id, IsTaxable = true, Discount = 5, DueDate = DateTime.Today.AddDays(14) }; si2 = _salesInvoiceService.CreateObject(si2, _deliveryOrderService); si2a = new SalesInvoiceDetail() { SalesInvoiceId = si2.Id, DeliveryOrderDetailId = do2a.Id, Quantity = do2a.Quantity }; si2a = _salesInvoiceDetailService.CreateObject(si2a, _salesInvoiceService, _salesOrderDetailService, _deliveryOrderDetailService); si2b = new SalesInvoiceDetail() { SalesInvoiceId = si2.Id, DeliveryOrderDetailId = do2b.Id, Quantity = do2b.Quantity }; si2b = _salesInvoiceDetailService.CreateObject(si2b, _salesInvoiceService, _salesOrderDetailService, _deliveryOrderDetailService); si3 = new SalesInvoice() { InvoiceDate = DateTime.Today, Description = "Penjualan DO3", DeliveryOrderId = do3.Id, IsTaxable = true, Discount = 0, DueDate = DateTime.Today.AddDays(14) }; si3 = _salesInvoiceService.CreateObject(si3, _deliveryOrderService); si1a2 = new SalesInvoiceDetail() { SalesInvoiceId = si3.Id, DeliveryOrderDetailId = do1a2.Id, Quantity = do1a2.Quantity }; si1a2 = _salesInvoiceDetailService.CreateObject(si1a2, _salesInvoiceService, _salesOrderDetailService, _deliveryOrderDetailService); si1c = new SalesInvoiceDetail() { SalesInvoiceId = si3.Id, DeliveryOrderDetailId = do1c.Id, Quantity = do1c.Quantity }; si1c = _salesInvoiceDetailService.CreateObject(si1c, _salesInvoiceService, _salesOrderDetailService, _deliveryOrderDetailService); }