コード例 #1
0
        public dynamic GetInfo(int Id)
        {
            SalesInvoice model = new SalesInvoice();

            try
            {
                model = _salesInvoiceService.GetObjectById(Id);
            }
            catch (Exception ex)
            {
                LOG.Error("GetInfo", ex);
                Dictionary <string, string> Errors = new Dictionary <string, string>();
                Errors.Add("Generic", "Error " + ex);

                return(Json(new
                {
                    Errors
                }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new
            {
                model.Id,
                model.Code,
                model.DeliveryOrderId,
                DeliveryOrder = _deliveryOrderService.GetObjectById(model.DeliveryOrderId).Code,
                model.AmountReceivable,
                model.Discount,
                model.Description,
                model.IsTaxable,
                model.InvoiceDate,
                model.DueDate,
                model.Errors
            }, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public SalesInvoiceDetail VHasSalesInvoice(SalesInvoiceDetail salesInvoiceDetail, ISalesInvoiceService _salesInvoiceService)
        {
            SalesInvoice salesInvoice = _salesInvoiceService.GetObjectById(salesInvoiceDetail.SalesInvoiceId);

            if (salesInvoice == null)
            {
                salesInvoiceDetail.Errors.Add("SalesInvoiceId", "Tidak terasosiasi dengan sales invoice");
            }
            return(salesInvoiceDetail);
        }
コード例 #3
0
 public SalesInvoiceDetail SoftDeleteObject(SalesInvoiceDetail salesInvoiceDetail, ISalesInvoiceService _salesInvoiceService)
 {
     if (_validator.ValidDeleteObject(salesInvoiceDetail))
     {
         SalesInvoice salesInvoice = _salesInvoiceService.GetObjectById(salesInvoiceDetail.SalesInvoiceId);
         _repository.SoftDeleteObject(salesInvoiceDetail);
         _salesInvoiceService.CalculateAmountReceivable(salesInvoice, this);
     }
     return(salesInvoiceDetail);
 }
コード例 #4
0
        public SalesInvoiceDetail VDeliveryOrderDetailAndSalesInvoiceMustHaveTheSameDeliveryOrder(SalesInvoiceDetail salesInvoiceDetail,
                                                                                                  IDeliveryOrderDetailService _deliveryOrderDetailService, ISalesInvoiceService _salesInvoiceService)
        {
            DeliveryOrderDetail deliveryOrderDetail = _deliveryOrderDetailService.GetObjectById(salesInvoiceDetail.DeliveryOrderDetailId);
            SalesInvoice        salesInvoice        = _salesInvoiceService.GetObjectById(salesInvoiceDetail.SalesInvoiceId);

            if (deliveryOrderDetail.DeliveryOrderId != salesInvoice.DeliveryOrderId)
            {
                deliveryOrderDetail.Errors.Add("Generic", "Delivery order detail dan sales invoice memiliki delivery order berbeda");
            }
            return(salesInvoiceDetail);
        }
コード例 #5
0
 public SalesInvoiceDetail UpdateObject(SalesInvoiceDetail salesInvoiceDetail, ISalesInvoiceService _salesInvoiceService,
                                        ISalesOrderDetailService _salesOrderDetailService, IDeliveryOrderDetailService _deliveryOrderDetailService)
 {
     if (_validator.ValidUpdateObject(salesInvoiceDetail, _salesInvoiceService, this, _deliveryOrderDetailService))
     {
         DeliveryOrderDetail deliveryOrderDetail = _deliveryOrderDetailService.GetObjectById(salesInvoiceDetail.DeliveryOrderDetailId);
         SalesOrderDetail    salesOrderDetail    = _salesOrderDetailService.GetObjectById(deliveryOrderDetail.SalesOrderDetailId);
         salesInvoiceDetail.Amount = salesInvoiceDetail.Quantity * salesOrderDetail.Price;
         _repository.UpdateObject(salesInvoiceDetail);
         SalesInvoice salesInvoice = _salesInvoiceService.GetObjectById(salesInvoiceDetail.SalesInvoiceId);
         _salesInvoiceService.CalculateAmountReceivable(salesInvoice, this);
     }
     return(salesInvoiceDetail);
 }
コード例 #6
0
 public SalesInvoiceDetail CreateObject(SalesInvoiceDetail salesInvoiceDetail, ISalesInvoiceService _salesInvoiceService,
                                        ISalesOrderDetailService _salesOrderDetailService, IDeliveryOrderDetailService _deliveryOrderDetailService)
 {
     salesInvoiceDetail.Errors = new Dictionary <String, String>();
     if (_validator.ValidCreateObject(salesInvoiceDetail, _salesInvoiceService, this, _deliveryOrderDetailService))
     {
         DeliveryOrderDetail deliveryOrderDetail = _deliveryOrderDetailService.GetObjectById(salesInvoiceDetail.DeliveryOrderDetailId);
         SalesOrderDetail    salesOrderDetail    = _salesOrderDetailService.GetObjectById(deliveryOrderDetail.SalesOrderDetailId);
         salesInvoiceDetail.Amount = salesInvoiceDetail.Quantity * salesOrderDetail.Price;
         salesInvoiceDetail        = _repository.CreateObject(salesInvoiceDetail);
         SalesInvoice salesInvoice = _salesInvoiceService.GetObjectById(salesInvoiceDetail.SalesInvoiceId);
         _salesInvoiceService.CalculateAmountReceivable(salesInvoice, this);
     }
     return(salesInvoiceDetail);
 }