public bool ValidUpdateObject(DeliveryOrderDetail deliveryOrderDetail, IDeliveryOrderDetailService _deliveryOrderDetailService,
                               IDeliveryOrderService _deliveryOrderService, ISalesOrderDetailService _salesOrderDetailService, IItemService _itemService)
 {
     deliveryOrderDetail.Errors.Clear();
     VUpdateObject(deliveryOrderDetail, _deliveryOrderDetailService, _deliveryOrderService, _salesOrderDetailService, _itemService);
     return(isValid(deliveryOrderDetail));
 }
예제 #2
0
 public bool ValidConfirmObject(SalesInvoice salesInvoice, ISalesInvoiceDetailService _salesInvoiceDetailService,
                                IDeliveryOrderService _deliveryOrderService, IDeliveryOrderDetailService _deliveryOrderDetailService)
 {
     salesInvoice.Errors.Clear();
     VConfirmObject(salesInvoice, _salesInvoiceDetailService, _deliveryOrderService, _deliveryOrderDetailService);
     return(isValid(salesInvoice));
 }
 public bool ValidConfirmObject(DeliveryOrderDetail deliveryOrderDetail, IDeliveryOrderService _deliveryOrderService,
                                IDeliveryOrderDetailService _deliveryOrderDetailService, ISalesOrderDetailService _salesOrderDetailService,
                                IItemService _itemService, IWarehouseItemService _warehouseItemService)
 {
     deliveryOrderDetail.Errors.Clear();
     VConfirmObject(deliveryOrderDetail, _deliveryOrderService, _deliveryOrderDetailService, _salesOrderDetailService, _itemService, _warehouseItemService);
     return(isValid(deliveryOrderDetail));
 }
예제 #4
0
 public DeliveryOrder VDeleteObject(DeliveryOrder deliveryOrder, IDeliveryOrderDetailService _deliveryOrderDetailService)
 {
     VHasNotBeenConfirmed(deliveryOrder);
     if (!isValid(deliveryOrder))
     {
         return(deliveryOrder);
     }
     VHasNoDeliveryOrderDetail(deliveryOrder, _deliveryOrderDetailService);
     return(deliveryOrder);
 }
예제 #5
0
        public DeliveryOrder VHasNoDeliveryOrderDetail(DeliveryOrder deliveryOrder, IDeliveryOrderDetailService _deliveryOrderDetailService)
        {
            IList <DeliveryOrderDetail> details = _deliveryOrderDetailService.GetObjectsByDeliveryOrderId(deliveryOrder.Id);

            if (details.Any())
            {
                deliveryOrder.Errors.Add("Generic", "Masih memiliki delivery order detail");
            }
            return(deliveryOrder);
        }
예제 #6
0
 public SalesOrderController()
 {
     _itemService                = new ItemService(new ItemRepository(), new ItemValidator());
     _warehouseItemService       = new WarehouseItemService(new WarehouseItemRepository(), new WarehouseItemValidator());
     _stockMutationService       = new StockMutationService(new StockMutationRepository(), new StockMutationValidator());
     _barringService             = new BarringService(new BarringRepository(), new BarringValidator());
     _contactService             = new ContactService(new ContactRepository(), new ContactValidator());
     _salesOrderService          = new SalesOrderService(new SalesOrderRepository(), new SalesOrderValidator());
     _salesOrderDetailService    = new SalesOrderDetailService(new SalesOrderDetailRepository(), new SalesOrderDetailValidator());
     _deliveryOrderService       = new DeliveryOrderService(new DeliveryOrderRepository(), new DeliveryOrderValidator());
     _deliveryOrderDetailService = new DeliveryOrderDetailService(new DeliveryOrderDetailRepository(), new DeliveryOrderDetailValidator());
 }
예제 #7
0
 public SalesInvoiceDetail UnconfirmObject(SalesInvoiceDetail salesInvoiceDetail, IDeliveryOrderService _deliveryOrderService,
                                           IDeliveryOrderDetailService _deliveryOrderDetailService)
 {
     if (_validator.ValidUnconfirmObject(salesInvoiceDetail))
     {
         salesInvoiceDetail = _repository.UnconfirmObject(salesInvoiceDetail);
         // reverse sales receival detail PendingInvoiceQuantity
         DeliveryOrderDetail deliveryOrderDetail = _deliveryOrderDetailService.GetObjectById(salesInvoiceDetail.DeliveryOrderDetailId);
         _deliveryOrderDetailService.UndoInvoiceObject(deliveryOrderDetail, salesInvoiceDetail.Quantity, _deliveryOrderService);
     }
     return(salesInvoiceDetail);
 }
예제 #8
0
        public SalesInvoiceDetail CreateObject(int salesInvoiceId, int deliveryOrderDetailId, int quantity, decimal amount,
                                               ISalesInvoiceService _salesInvoiceService, ISalesOrderDetailService _salesOrderDetailService,
                                               IDeliveryOrderDetailService _deliveryOrderDetailService)
        {
            SalesInvoiceDetail salesInvoiceDetail = new SalesInvoiceDetail
            {
                SalesInvoiceId        = salesInvoiceId,
                DeliveryOrderDetailId = deliveryOrderDetailId,
                Quantity = quantity
            };

            return(this.CreateObject(salesInvoiceDetail, _salesInvoiceService, _salesOrderDetailService, _deliveryOrderDetailService));
        }
예제 #9
0
        public DeliveryOrder CheckAndSetInvoiceComplete(DeliveryOrder deliveryOrder, IDeliveryOrderDetailService _deliveryOrderDetailService)
        {
            IList <DeliveryOrderDetail> details = _deliveryOrderDetailService.GetObjectsByDeliveryOrderId(deliveryOrder.Id);

            foreach (var detail in details)
            {
                if (!detail.IsAllInvoiced)
                {
                    return(deliveryOrder);
                }
            }
            return(_repository.SetInvoiceComplete(deliveryOrder));
        }
예제 #10
0
 public DeliveryOrder VConfirmObject(DeliveryOrder deliveryOrder, IDeliveryOrderDetailService _deliveryOrderDetailService)
 {
     VHasConfirmationDate(deliveryOrder);
     if (!isValid(deliveryOrder))
     {
         return(deliveryOrder);
     }
     VHasNotBeenConfirmed(deliveryOrder);
     if (!isValid(deliveryOrder))
     {
         return(deliveryOrder);
     }
     VHasDeliveryOrderDetails(deliveryOrder, _deliveryOrderDetailService);
     return(deliveryOrder);
 }
예제 #11
0
 public SalesOrderDetail VUnconfirmObject(SalesOrderDetail salesOrderDetail, IDeliveryOrderDetailService _deliveryOrderDetailService, IItemService _itemService)
 {
     VHasBeenConfirmed(salesOrderDetail);
     if (!isValid(salesOrderDetail))
     {
         return(salesOrderDetail);
     }
     VHasItemPendingDelivery(salesOrderDetail, _itemService);
     if (!isValid(salesOrderDetail))
     {
         return(salesOrderDetail);
     }
     VHasNoDeliveryOrderDetail(salesOrderDetail, _deliveryOrderDetailService);
     return(salesOrderDetail);
 }
예제 #12
0
 public DeliveryOrder UnconfirmObject(DeliveryOrder deliveryOrder, IDeliveryOrderDetailService _deliveryOrderDetailService,
                                      ISalesInvoiceService _salesInvoiceService, ISalesInvoiceDetailService _salesInvoiceDetailService,
                                      ISalesOrderService _salesOrderService, ISalesOrderDetailService _salesOrderDetailService,
                                      IStockMutationService _stockMutationService, IItemService _itemService, IBarringService _barringService,
                                      IWarehouseItemService _warehouseItemService)
 {
     if (_validator.ValidUnconfirmObject(deliveryOrder, _salesInvoiceService))
     {
         IList <DeliveryOrderDetail> deliveryOrderDetails = _deliveryOrderDetailService.GetObjectsByDeliveryOrderId(deliveryOrder.Id);
         foreach (var detail in deliveryOrderDetails)
         {
             detail.Errors = new Dictionary <string, string>();
             _deliveryOrderDetailService.UnconfirmObject(detail, this, _salesOrderService, _salesOrderDetailService,
                                                         _salesInvoiceDetailService, _stockMutationService,
                                                         _itemService, _barringService, _warehouseItemService);
         }
         _repository.UnconfirmObject(deliveryOrder);
     }
     return(deliveryOrder);
 }
예제 #13
0
 public SalesInvoiceController()
 {
     _purchaseOrderService          = new PurchaseOrderService(new PurchaseOrderRepository(), new PurchaseOrderValidator());
     _purchaseOrderDetailService    = new PurchaseOrderDetailService(new PurchaseOrderDetailRepository(), new PurchaseOrderDetailValidator());
     _purchaseInvoiceService        = new PurchaseInvoiceService(new PurchaseInvoiceRepository(), new PurchaseInvoiceValidator());
     _purchaseInvoiceDetailService  = new PurchaseInvoiceDetailService(new PurchaseInvoiceDetailRepository(), new PurchaseInvoiceDetailValidator());
     _purchaseReceivalService       = new PurchaseReceivalService(new PurchaseReceivalRepository(), new PurchaseReceivalValidator());
     _purchaseReceivalDetailService = new PurchaseReceivalDetailService(new PurchaseReceivalDetailRepository(), new PurchaseReceivalDetailValidator());
     _paymentVoucherDetailService   = new PaymentVoucherDetailService(new PaymentVoucherDetailRepository(), new PaymentVoucherDetailValidator());
     _payableService              = new PayableService(new PayableRepository(), new PayableValidator());
     _itemService                 = new ItemService(new ItemRepository(), new ItemValidator());
     _salesInvoiceService         = new SalesInvoiceService(new SalesInvoiceRepository(), new SalesInvoiceValidator());
     _salesInvoiceDetailService   = new SalesInvoiceDetailService(new SalesInvoiceDetailRepository(), new SalesInvoiceDetailValidator());
     _deliveryOrderDetailService  = new DeliveryOrderDetailService(new DeliveryOrderDetailRepository(), new DeliveryOrderDetailValidator());
     _receiptVoucherDetailService = new ReceiptVoucherDetailService(new ReceiptVoucherDetailRepository(), new ReceiptVoucherDetailValidator());
     _receivableService           = new ReceivableService(new ReceivableRepository(), new ReceivableValidator());
     _salesOrderService           = new SalesOrderService(new SalesOrderRepository(), new SalesOrderValidator());
     _deliveryOrderDetailService  = new DeliveryOrderDetailService(new DeliveryOrderDetailRepository(), new DeliveryOrderDetailValidator());
     _salesOrderDetailService     = new SalesOrderDetailService(new SalesOrderDetailRepository(), new SalesOrderDetailValidator());
     _deliveryOrderService        = new DeliveryOrderService(new DeliveryOrderRepository(), new DeliveryOrderValidator());
 }
 public DeliveryOrderDetail VConfirmObject(DeliveryOrderDetail deliveryOrderDetail, IDeliveryOrderService _deliveryOrderService,
                                           IDeliveryOrderDetailService _deliveryOrderDetailService, ISalesOrderDetailService _salesOrderDetailService,
                                           IItemService _itemService, IWarehouseItemService _warehouseItemService)
 {
     VHasConfirmationDate(deliveryOrderDetail);
     if (!isValid(deliveryOrderDetail))
     {
         return(deliveryOrderDetail);
     }
     VHasNotBeenConfirmed(deliveryOrderDetail);
     if (!isValid(deliveryOrderDetail))
     {
         return(deliveryOrderDetail);
     }
     VHasItemQuantity(deliveryOrderDetail, _deliveryOrderService, _itemService, _warehouseItemService);
     if (!isValid(deliveryOrderDetail))
     {
         return(deliveryOrderDetail);
     }
     VQuantityOfDeliveryOrderDetailsIsLessThanOrEqualSalesOrderDetail(deliveryOrderDetail, _deliveryOrderDetailService, _salesOrderDetailService);
     return(deliveryOrderDetail);
 }
예제 #15
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);
        }
예제 #16
0
        public SalesInvoiceDetail VHasDeliveryOrderDetail(SalesInvoiceDetail salesInvoiceDetail, IDeliveryOrderDetailService _deliveryOrderDetailService)
        {
            DeliveryOrderDetail deliveryOrderDetail = _deliveryOrderDetailService.GetObjectById(salesInvoiceDetail.DeliveryOrderDetailId);

            if (deliveryOrderDetail == null)
            {
                salesInvoiceDetail.Errors.Add("DeliveryOrderDetailId", "Tidak boleh tidak ada");
            }
            return(salesInvoiceDetail);
        }
예제 #17
0
 public bool ValidUpdateObject(SalesInvoiceDetail salesInvoiceDetail, ISalesInvoiceService _salesInvoiceService, ISalesInvoiceDetailService _salesInvoiceDetailService, IDeliveryOrderDetailService _deliveryOrderDetailService)
 {
     salesInvoiceDetail.Errors.Clear();
     VUpdateObject(salesInvoiceDetail, _salesInvoiceService, _salesInvoiceDetailService, _deliveryOrderDetailService);
     return(isValid(salesInvoiceDetail));
 }
예제 #18
0
 public bool ValidCreateObject(SalesInvoiceDetail salesInvoiceDetail, ISalesInvoiceService _salesInvoiceService,
                               ISalesInvoiceDetailService _salesInvoiceDetailService, IDeliveryOrderDetailService _deliveryOrderDetailService)
 {
     VCreateObject(salesInvoiceDetail, _salesInvoiceService, _salesInvoiceDetailService, _deliveryOrderDetailService);
     return(isValid(salesInvoiceDetail));
 }
예제 #19
0
 public SalesInvoiceDetail VConfirmObject(SalesInvoiceDetail salesInvoiceDetail, ISalesInvoiceDetailService _salesInvoiceDetailService, IDeliveryOrderDetailService _deliveryOrderDetailService)
 {
     VHasConfirmationDate(salesInvoiceDetail);
     if (!isValid(salesInvoiceDetail))
     {
         return(salesInvoiceDetail);
     }
     VHasNotBeenConfirmed(salesInvoiceDetail);
     if (!isValid(salesInvoiceDetail))
     {
         return(salesInvoiceDetail);
     }
     VQuantityIsLessThanOrEqualPendingInvoiceQuantity(salesInvoiceDetail, _deliveryOrderDetailService);
     return(salesInvoiceDetail);
 }
예제 #20
0
 public SalesInvoiceDetail VUpdateObject(SalesInvoiceDetail salesInvoiceDetail, ISalesInvoiceService _salesInvoiceService,
                                         ISalesInvoiceDetailService _salesInvoiceDetailService, IDeliveryOrderDetailService _deliveryOrderDetailService)
 {
     VHasNotBeenConfirmed(salesInvoiceDetail);
     if (!isValid(salesInvoiceDetail))
     {
         return(salesInvoiceDetail);
     }
     VCreateObject(salesInvoiceDetail, _salesInvoiceService, _salesInvoiceDetailService, _deliveryOrderDetailService);
     return(salesInvoiceDetail);
 }
예제 #21
0
 public SalesInvoiceDetail VCreateObject(SalesInvoiceDetail salesInvoiceDetail, ISalesInvoiceService _salesInvoiceService,
                                         ISalesInvoiceDetailService _salesInvoiceDetailService, IDeliveryOrderDetailService _deliveryOrderDetailService)
 {
     VHasSalesInvoice(salesInvoiceDetail, _salesInvoiceService);
     if (!isValid(salesInvoiceDetail))
     {
         return(salesInvoiceDetail);
     }
     VHasDeliveryOrderDetail(salesInvoiceDetail, _deliveryOrderDetailService);
     if (!isValid(salesInvoiceDetail))
     {
         return(salesInvoiceDetail);
     }
     VDeliveryOrderDetailAndSalesInvoiceMustHaveTheSameDeliveryOrder(salesInvoiceDetail, _deliveryOrderDetailService, _salesInvoiceService);
     if (!isValid(salesInvoiceDetail))
     {
         return(salesInvoiceDetail);
     }
     VIsUniqueDeliveryOrderDetail(salesInvoiceDetail, _salesInvoiceDetailService, _deliveryOrderDetailService);
     if (!isValid(salesInvoiceDetail))
     {
         return(salesInvoiceDetail);
     }
     VNonNegativeNorZeroQuantity(salesInvoiceDetail);
     if (!isValid(salesInvoiceDetail))
     {
         return(salesInvoiceDetail);
     }
     VQuantityIsLessThanOrEqualPendingInvoiceQuantity(salesInvoiceDetail, _deliveryOrderDetailService);
     return(salesInvoiceDetail);
 }
예제 #22
0
 public bool ValidUnconfirmObject(SalesOrderDetail salesOrderDetail, IDeliveryOrderDetailService _deliveryOrderDetailService, IItemService _itemService)
 {
     salesOrderDetail.Errors.Clear();
     VUnconfirmObject(salesOrderDetail, _deliveryOrderDetailService, _itemService);
     return(isValid(salesOrderDetail));
 }
예제 #23
0
 public bool ValidConfirmObject(DeliveryOrder deliveryOrder, IDeliveryOrderDetailService _deliveryOrderDetailService)
 {
     deliveryOrder.Errors.Clear();
     VConfirmObject(deliveryOrder, _deliveryOrderDetailService);
     return(isValid(deliveryOrder));
 }
예제 #24
0
        public SalesOrderDetail VHasNoDeliveryOrderDetail(SalesOrderDetail salesOrderDetail, IDeliveryOrderDetailService _deliveryOrderDetailService)
        {
            IList <DeliveryOrderDetail> details = _deliveryOrderDetailService.GetObjectsBySalesOrderDetailId(salesOrderDetail.Id);

            if (details.Any())
            {
                salesOrderDetail.Errors.Add("Generic", "Tidak boleh boleh terasosiasi dengan Delivery Order Detail");
            }
            return(salesOrderDetail);
        }
예제 #25
0
 public SalesOrderDetail UnconfirmObject(SalesOrderDetail salesOrderDetail, ISalesOrderService _salesOrderService, IDeliveryOrderDetailService _deliveryOrderDetailService,
                                         IStockMutationService _stockMutationService, IItemService _itemService, IBarringService _barringService, IWarehouseItemService _warehouseItemService)
 {
     if (_validator.ValidUnconfirmObject(salesOrderDetail, _deliveryOrderDetailService, _itemService))
     {
         salesOrderDetail = _repository.UnconfirmObject(salesOrderDetail);
         Item item = _itemService.GetObjectById(salesOrderDetail.ItemId);
         IList <StockMutation> stockMutations = _stockMutationService.SoftDeleteStockMutationForSalesOrder(salesOrderDetail, item);
         foreach (var stockMutation in stockMutations)
         {
             _stockMutationService.ReverseStockMutateObject(stockMutation, _itemService, _barringService, _warehouseItemService);
             //item.PendingDelivery -= salesOrderDetail.Quantity;
         }
     }
     return(salesOrderDetail);
 }
예제 #26
0
        public SalesInvoice VAllSalesInvoiceDetailsAreConfirmable(SalesInvoice salesInvoice, ISalesInvoiceDetailService _salesInvoiceDetailService, IDeliveryOrderDetailService _deliveryOrderDetailService)
        {
            IList <SalesInvoiceDetail> details = _salesInvoiceDetailService.GetObjectsBySalesInvoiceId(salesInvoice.Id);

            foreach (var detail in details)
            {
                detail.ConfirmationDate = salesInvoice.ConfirmationDate;
                _salesInvoiceDetailService.GetValidator().VConfirmObject(detail, _salesInvoiceDetailService, _deliveryOrderDetailService);
                foreach (var error in detail.Errors)
                {
                    salesInvoice.Errors.Add(error.Key, error.Value);
                }
                if (!isValid(salesInvoice))
                {
                    return(salesInvoice);
                }
            }
            return(salesInvoice);
        }
예제 #27
0
        public SalesInvoiceDetail VIsUniqueDeliveryOrderDetail(SalesInvoiceDetail salesInvoiceDetail, ISalesInvoiceDetailService _salesInvoiceDetail, IDeliveryOrderDetailService _deliveryOrderDetailService)
        {
            IList <SalesInvoiceDetail> details = _salesInvoiceDetail.GetObjectsBySalesInvoiceId(salesInvoiceDetail.SalesInvoiceId);

            foreach (var detail in details)
            {
                if (detail.DeliveryOrderDetailId == salesInvoiceDetail.DeliveryOrderDetailId && detail.Id != salesInvoiceDetail.Id)
                {
                    salesInvoiceDetail.Errors.Add("Generic", "Tidak boleh memiliki lebih dari 2 Sales Receival Detail");
                }
            }
            return(salesInvoiceDetail);
        }
예제 #28
0
 public SalesInvoice VConfirmObject(SalesInvoice salesInvoice, ISalesInvoiceDetailService _salesInvoiceDetailService,
                                    IDeliveryOrderService _deliveryOrderService, IDeliveryOrderDetailService _deliveryOrderDetailService)
 {
     VHasConfirmationDate(salesInvoice);
     if (!isValid(salesInvoice))
     {
         return(salesInvoice);
     }
     VDeliveryOrderHasNotBeenInvoiceCompleted(salesInvoice, _deliveryOrderService);
     if (!isValid(salesInvoice))
     {
         return(salesInvoice);
     }
     VHasNotBeenDeleted(salesInvoice);
     if (!isValid(salesInvoice))
     {
         return(salesInvoice);
     }
     VHasNotBeenConfirmed(salesInvoice);
     if (!isValid(salesInvoice))
     {
         return(salesInvoice);
     }
     VHasSalesInvoiceDetails(salesInvoice, _salesInvoiceDetailService);
     if (!isValid(salesInvoice))
     {
         return(salesInvoice);
     }
     VAllSalesInvoiceDetailsAreConfirmable(salesInvoice, _salesInvoiceDetailService, _deliveryOrderDetailService);
     return(salesInvoice);
 }
예제 #29
0
        public SalesInvoiceDetail VQuantityIsLessThanOrEqualPendingInvoiceQuantity(SalesInvoiceDetail salesInvoiceDetail, IDeliveryOrderDetailService _deliveryOrderDetailService)
        {
            DeliveryOrderDetail deliveryOrderDetail = _deliveryOrderDetailService.GetObjectById(salesInvoiceDetail.DeliveryOrderDetailId);

            if (salesInvoiceDetail.Quantity > deliveryOrderDetail.PendingInvoicedQuantity)
            {
                salesInvoiceDetail.Errors.Add("Generic", "Quantity harus kurang dari atau sama dengan pending invoice quantity");
            }
            return(salesInvoiceDetail);
        }
예제 #30
0
        public PurchaseBuilder()
        {
            _accountService                  = new AccountService(new AccountRepository(), new AccountValidator());
            _barringService                  = new BarringService(new BarringRepository(), new BarringValidator());
            _barringOrderService             = new BarringOrderService(new BarringOrderRepository(), new BarringOrderValidator());
            _barringOrderDetailService       = new BarringOrderDetailService(new BarringOrderDetailRepository(), new BarringOrderDetailValidator());
            _cashBankAdjustmentService       = new CashBankAdjustmentService(new CashBankAdjustmentRepository(), new CashBankAdjustmentValidator());
            _cashBankMutationService         = new CashBankMutationService(new CashBankMutationRepository(), new CashBankMutationValidator());
            _cashBankService                 = new CashBankService(new CashBankRepository(), new CashBankValidator());
            _cashMutationService             = new CashMutationService(new CashMutationRepository(), new CashMutationValidator());
            _closingService                  = new ClosingService(new ClosingRepository(), new ClosingValidator());
            _coreBuilderService              = new CoreBuilderService(new CoreBuilderRepository(), new CoreBuilderValidator());
            _coreIdentificationDetailService = new CoreIdentificationDetailService(new CoreIdentificationDetailRepository(), new CoreIdentificationDetailValidator());
            _coreIdentificationService       = new CoreIdentificationService(new CoreIdentificationRepository(), new CoreIdentificationValidator());
            _contactService                  = new ContactService(new ContactRepository(), new ContactValidator());
            _deliveryOrderService            = new DeliveryOrderService(new DeliveryOrderRepository(), new DeliveryOrderValidator());
            _deliveryOrderDetailService      = new DeliveryOrderDetailService(new DeliveryOrderDetailRepository(), new DeliveryOrderDetailValidator());
            _generalLedgerJournalService     = new GeneralLedgerJournalService(new GeneralLedgerJournalRepository(), new GeneralLedgerJournalValidator());
            _itemService                          = new ItemService(new ItemRepository(), new ItemValidator());
            _itemTypeService                      = new ItemTypeService(new ItemTypeRepository(), new ItemTypeValidator());
            _machineService                       = new MachineService(new MachineRepository(), new MachineValidator());
            _payableService                       = new PayableService(new PayableRepository(), new PayableValidator());
            _paymentVoucherDetailService          = new PaymentVoucherDetailService(new PaymentVoucherDetailRepository(), new PaymentVoucherDetailValidator());
            _paymentVoucherService                = new PaymentVoucherService(new PaymentVoucherRepository(), new PaymentVoucherValidator());
            _purchaseInvoiceDetailService         = new PurchaseInvoiceDetailService(new PurchaseInvoiceDetailRepository(), new PurchaseInvoiceDetailValidator());
            _purchaseInvoiceService               = new PurchaseInvoiceService(new PurchaseInvoiceRepository(), new PurchaseInvoiceValidator());
            _purchaseOrderService                 = new PurchaseOrderService(new PurchaseOrderRepository(), new PurchaseOrderValidator());
            _purchaseOrderDetailService           = new PurchaseOrderDetailService(new PurchaseOrderDetailRepository(), new PurchaseOrderDetailValidator());
            _purchaseReceivalService              = new PurchaseReceivalService(new PurchaseReceivalRepository(), new PurchaseReceivalValidator());
            _purchaseReceivalDetailService        = new PurchaseReceivalDetailService(new PurchaseReceivalDetailRepository(), new PurchaseReceivalDetailValidator());
            _receivableService                    = new ReceivableService(new ReceivableRepository(), new ReceivableValidator());
            _receiptVoucherDetailService          = new ReceiptVoucherDetailService(new ReceiptVoucherDetailRepository(), new ReceiptVoucherDetailValidator());
            _receiptVoucherService                = new ReceiptVoucherService(new ReceiptVoucherRepository(), new ReceiptVoucherValidator());
            _recoveryOrderDetailService           = new RecoveryOrderDetailService(new RecoveryOrderDetailRepository(), new RecoveryOrderDetailValidator());
            _recoveryOrderService                 = new RecoveryOrderService(new RecoveryOrderRepository(), new RecoveryOrderValidator());
            _recoveryAccessoryDetailService       = new RecoveryAccessoryDetailService(new RecoveryAccessoryDetailRepository(), new RecoveryAccessoryDetailValidator());
            _rollerBuilderService                 = new RollerBuilderService(new RollerBuilderRepository(), new RollerBuilderValidator());
            _rollerTypeService                    = new RollerTypeService(new RollerTypeRepository(), new RollerTypeValidator());
            _rollerWarehouseMutationDetailService = new RollerWarehouseMutationDetailService(new RollerWarehouseMutationDetailRepository(), new RollerWarehouseMutationDetailValidator());
            _rollerWarehouseMutationService       = new RollerWarehouseMutationService(new RollerWarehouseMutationRepository(), new RollerWarehouseMutationValidator());
            _salesInvoiceDetailService            = new SalesInvoiceDetailService(new SalesInvoiceDetailRepository(), new SalesInvoiceDetailValidator());
            _salesInvoiceService                  = new SalesInvoiceService(new SalesInvoiceRepository(), new SalesInvoiceValidator());
            _salesOrderService                    = new SalesOrderService(new SalesOrderRepository(), new SalesOrderValidator());
            _salesOrderDetailService              = new SalesOrderDetailService(new SalesOrderDetailRepository(), new SalesOrderDetailValidator());
            _stockAdjustmentDetailService         = new StockAdjustmentDetailService(new StockAdjustmentDetailRepository(), new StockAdjustmentDetailValidator());
            _stockAdjustmentService               = new StockAdjustmentService(new StockAdjustmentRepository(), new StockAdjustmentValidator());
            _stockMutationService                 = new StockMutationService(new StockMutationRepository(), new StockMutationValidator());
            _uomService                          = new UoMService(new UoMRepository(), new UoMValidator());
            _validCombService                    = new ValidCombService(new ValidCombRepository(), new ValidCombValidator());
            _warehouseItemService                = new WarehouseItemService(new WarehouseItemRepository(), new WarehouseItemValidator());
            _warehouseService                    = new WarehouseService(new WarehouseRepository(), new WarehouseValidator());
            _warehouseMutationOrderService       = new WarehouseMutationOrderService(new WarehouseMutationOrderRepository(), new WarehouseMutationOrderValidator());
            _warehouseMutationOrderDetailService = new WarehouseMutationOrderDetailService(new WarehouseMutationOrderDetailRepository(), new WarehouseMutationOrderDetailValidator());

            _priceMutationService = new PriceMutationService(new PriceMutationRepository(), new PriceMutationValidator());
            _contactGroupService  = new ContactGroupService(new ContactGroupRepository(), new ContactGroupValidator());

            typeAccessory    = _itemTypeService.CreateObject("Accessory", "Accessory");
            typeBar          = _itemTypeService.CreateObject("Bar", "Bar");
            typeBarring      = _itemTypeService.CreateObject("Barring", "Barring", true);
            typeBearing      = _itemTypeService.CreateObject("Bearing", "Bearing");
            typeBlanket      = _itemTypeService.CreateObject("Blanket", "Blanket");
            typeChemical     = _itemTypeService.CreateObject("Chemical", "Chemical");
            typeCompound     = _itemTypeService.CreateObject("Compound", "Compound");
            typeConsumable   = _itemTypeService.CreateObject("Consumable", "Consumable");
            typeCore         = _itemTypeService.CreateObject("Core", "Core", true);
            typeGlue         = _itemTypeService.CreateObject("Glue", "Glue");
            typeUnderpacking = _itemTypeService.CreateObject("Underpacking", "Underpacking");
            typeRoller       = _itemTypeService.CreateObject("Roller", "Roller", true);

            typeDamp       = _rollerTypeService.CreateObject("Damp", "Damp");
            typeFoundDT    = _rollerTypeService.CreateObject("Found DT", "Found DT");
            typeInkFormX   = _rollerTypeService.CreateObject("Ink Form X", "Ink Form X");
            typeInkDistD   = _rollerTypeService.CreateObject("Ink Dist D", "Ink Dist D");
            typeInkDistM   = _rollerTypeService.CreateObject("Ink Dist M", "Ink Dist M");
            typeInkDistE   = _rollerTypeService.CreateObject("Ink Dist E", "Ink Dist E");
            typeInkDuctB   = _rollerTypeService.CreateObject("Ink Duct B", "Ink Duct B");
            typeInkDistH   = _rollerTypeService.CreateObject("Ink Dist H", "Ink Dist H");
            typeInkFormW   = _rollerTypeService.CreateObject("Ink Form W", "Ink Form W");
            typeInkDistHQ  = _rollerTypeService.CreateObject("Ink Dist HQ", "Ink Dist HQ");
            typeDampFormDQ = _rollerTypeService.CreateObject("Damp Form DQ", "Damp Form DQ");
            typeInkFormY   = _rollerTypeService.CreateObject("Ink Form Y", "Ink Form Y");

            baseGroup = _contactGroupService.CreateObject(Core.Constants.Constant.GroupType.Base, "Base Group", true);

            if (!_accountService.GetLegacyObjects().Any())
            {
                Asset = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Asset", Code = Constant.AccountCode.Asset, LegacyCode = Constant.AccountLegacyCode.Asset, Level = 1, Group = Constant.AccountGroup.Asset, IsLegacy = true
                }, _accountService);
                CashBank = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "CashBank", Code = Constant.AccountCode.CashBank, LegacyCode = Constant.AccountLegacyCode.CashBank, Level = 2, Group = Constant.AccountGroup.Asset, ParentId = Asset.Id, IsLegacy = true
                }, _accountService);
                AccountReceivable = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Account Receivable", IsLeaf = true, Code = Constant.AccountCode.AccountReceivable, LegacyCode = Constant.AccountLegacyCode.AccountReceivable, Level = 2, Group = Constant.AccountGroup.Asset, ParentId = Asset.Id, IsLegacy = true
                }, _accountService);
                GBCHReceivable = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "GBCH Receivable", IsLeaf = true, Code = Constant.AccountCode.GBCHReceivable, LegacyCode = Constant.AccountLegacyCode.GBCHReceivable, Level = 2, Group = Constant.AccountGroup.Asset, ParentId = Asset.Id, IsLegacy = true
                }, _accountService);
                Inventory = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Inventory", IsLeaf = true, Code = Constant.AccountCode.Inventory, LegacyCode = Constant.AccountLegacyCode.Inventory, Level = 2, Group = Constant.AccountGroup.Asset, ParentId = Asset.Id, IsLegacy = true
                }, _accountService);

                Expense = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Expense", Code = Constant.AccountCode.Expense, LegacyCode = Constant.AccountLegacyCode.Expense, Level = 1, Group = Constant.AccountGroup.Expense, IsLegacy = true
                }, _accountService);
                CashBankAdjustmentExpense = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "CashBank Adjustment Expense", IsLeaf = true, Code = Constant.AccountCode.CashBankAdjustmentExpense, LegacyCode = Constant.AccountLegacyCode.CashBankAdjustmentExpense, Level = 2, Group = Constant.AccountGroup.Expense, ParentId = Expense.Id, IsLegacy = true
                }, _accountService);
                COGS = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Cost Of Goods Sold", IsLeaf = true, Code = Constant.AccountCode.COGS, LegacyCode = Constant.AccountLegacyCode.COGS, Level = 2, Group = Constant.AccountGroup.Expense, ParentId = Expense.Id, IsLegacy = true
                }, _accountService);
                Discount = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Discount", IsLeaf = true, Code = Constant.AccountCode.Discount, LegacyCode = Constant.AccountLegacyCode.Discount, Level = 2, Group = Constant.AccountGroup.Expense, ParentId = Expense.Id, IsLegacy = true
                }, _accountService);
                SalesAllowance = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Sales Allowance", IsLeaf = true, Code = Constant.AccountCode.SalesAllowance, LegacyCode = Constant.AccountLegacyCode.SalesAllowance, Level = 2, Group = Constant.AccountGroup.Expense, ParentId = Expense.Id, IsLegacy = true
                }, _accountService);
                StockAdjustmentExpense = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Stock Adjustment Expense", IsLeaf = true, Code = Constant.AccountCode.StockAdjustmentExpense, LegacyCode = Constant.AccountLegacyCode.StockAdjustmentExpense, Level = 2, Group = Constant.AccountGroup.Expense, ParentId = Expense.Id, IsLegacy = true
                }, _accountService);

                Liability = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Liability", Code = Constant.AccountCode.Liability, LegacyCode = Constant.AccountLegacyCode.Liability, Level = 1, Group = Constant.AccountGroup.Liability, IsLegacy = true
                }, _accountService);
                AccountPayable = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Account Payable", IsLeaf = true, Code = Constant.AccountCode.AccountPayable, LegacyCode = Constant.AccountLegacyCode.AccountPayable, Level = 2, Group = Constant.AccountGroup.Liability, ParentId = Liability.Id, IsLegacy = true
                }, _accountService);
                GBCHPayable = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "GBCH Payable", IsLeaf = true, Code = Constant.AccountCode.GBCHPayable, LegacyCode = Constant.AccountLegacyCode.GBCHPayable, Level = 2, Group = Constant.AccountGroup.Liability, ParentId = Liability.Id, IsLegacy = true
                }, _accountService);
                GoodsPendingClearance = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Goods Pending Clearance", IsLeaf = true, Code = Constant.AccountCode.GoodsPendingClearance, LegacyCode = Constant.AccountLegacyCode.GoodsPendingClearance, Level = 2, Group = Constant.AccountGroup.Liability, ParentId = Liability.Id, IsLegacy = true
                }, _accountService);

                Equity = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Equity", Code = Constant.AccountCode.Equity, LegacyCode = Constant.AccountLegacyCode.Equity, Level = 1, Group = Constant.AccountGroup.Equity, IsLegacy = true
                }, _accountService);
                OwnersEquity = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Owners Equity", Code = Constant.AccountCode.OwnersEquity, LegacyCode = Constant.AccountLegacyCode.OwnersEquity, Level = 2, Group = Constant.AccountGroup.Equity, ParentId = Equity.Id, IsLegacy = true
                }, _accountService);
                EquityAdjustment = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Equity Adjustment", IsLeaf = true, Code = Constant.AccountCode.EquityAdjustment, LegacyCode = Constant.AccountLegacyCode.EquityAdjustment, Level = 3, Group = Constant.AccountGroup.Equity, ParentId = OwnersEquity.Id, IsLegacy = true
                }, _accountService);

                Revenue = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Revenue", IsLeaf = true, Code = Constant.AccountCode.Revenue, LegacyCode = Constant.AccountLegacyCode.Revenue, Level = 1, Group = Constant.AccountGroup.Revenue, IsLegacy = true
                }, _accountService);
            }
        }