public CashBankMutation VConfirmObject(CashBankMutation cashBankMutation, ICashBankService _cashBankService, IClosingService _closingService) { VHasConfirmationDate(cashBankMutation); if (!isValid(cashBankMutation)) { return(cashBankMutation); } VHasNotBeenDeleted(cashBankMutation); if (!isValid(cashBankMutation)) { return(cashBankMutation); } VHasNotBeenConfirmed(cashBankMutation); if (!isValid(cashBankMutation)) { return(cashBankMutation); } VNonNegativeNorZeroAmount(cashBankMutation); if (!isValid(cashBankMutation)) { return(cashBankMutation); } VNonNegativeNorZeroSourceCashBank(cashBankMutation, _cashBankService); if (!isValid(cashBankMutation)) { return(cashBankMutation); } VGeneralLedgerPostingHasNotBeenClosed(cashBankMutation, _closingService, 1); return(cashBankMutation); }
public CashSalesInvoice PaidObject(CashSalesInvoice cashSalesInvoice, decimal AmountPaid, decimal Allowance, ICashBankService _cashBankService, IReceivableService _receivableService, IReceiptVoucherService _receiptVoucherService, IReceiptVoucherDetailService _receiptVoucherDetailService, IContactService _contactService, ICashMutationService _cashMutationService, ICashSalesReturnService _cashSalesReturnService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService) { cashSalesInvoice.AmountPaid = AmountPaid; cashSalesInvoice.Allowance = Allowance; if (_validator.ValidPaidObject(cashSalesInvoice, _cashBankService, _receiptVoucherService, _cashSalesReturnService, _closingService)) { CashBank cashBank = _cashBankService.GetObjectById((int)cashSalesInvoice.CashBankId.GetValueOrDefault()); cashSalesInvoice.IsBank = cashBank.IsBank; if (cashSalesInvoice.AmountPaid + cashSalesInvoice.Allowance == cashSalesInvoice.Total) { cashSalesInvoice.IsFullPayment = true; } Receivable receivable = _receivableService.GetObjectBySource(Core.Constants.Constant.ReceivableSource.CashSalesInvoice, cashSalesInvoice.Id); receivable.AllowanceAmount = Allowance; receivable.RemainingAmount = receivable.Amount - receivable.AllowanceAmount; _receivableService.UpdateObject(receivable); ReceiptVoucher receiptVoucher = _receiptVoucherService.CreateObject((int)cashSalesInvoice.CashBankId.GetValueOrDefault(), receivable.ContactId, DateTime.Now, cashSalesInvoice.AmountPaid.GetValueOrDefault() /*receivable.RemainingAmount*/, false, (DateTime)cashSalesInvoice.DueDate.GetValueOrDefault(), cashSalesInvoice.IsBank, _receiptVoucherDetailService, _receivableService, _contactService, _cashBankService); ReceiptVoucherDetail receiptVoucherDetail = _receiptVoucherDetailService.CreateObject(receiptVoucher.Id, receivable.Id, cashSalesInvoice.AmountPaid.GetValueOrDefault(), "Automatic Payment", _receiptVoucherService, _cashBankService, _receivableService); cashSalesInvoice = _repository.PaidObject(cashSalesInvoice); _generalLedgerJournalService.CreatePaidJournalForCashSalesInvoice(cashSalesInvoice, _accountService); _receiptVoucherService.ConfirmObject(receiptVoucher, (DateTime)cashSalesInvoice.ConfirmationDate.GetValueOrDefault(), _receiptVoucherDetailService, _cashBankService, _receivableService, _cashMutationService, _generalLedgerJournalService, _accountService, _closingService); } return(cashSalesInvoice); }
public PaymentVoucher VGeneralLedgerPostingHasNotBeenClosed(PaymentVoucher paymentVoucher, IClosingService _closingService, int CaseConfirmUnconfirmReconcileUnreconcile) { switch (CaseConfirmUnconfirmReconcileUnreconcile) { case (1): // Confirm { if (_closingService.IsDateClosed(paymentVoucher.ConfirmationDate.GetValueOrDefault())) { paymentVoucher.Errors.Add("Generic", "Ledger sudah tutup buku"); } break; } case (2): // Unconfirm { if (_closingService.IsDateClosed(DateTime.Now)) { paymentVoucher.Errors.Add("Generic", "Ledger sudah tutup buku"); } break; } case (3): // Reconcile { if (_closingService.IsDateClosed(paymentVoucher.ReconciliationDate.GetValueOrDefault())) { paymentVoucher.Errors.Add("Generic", "Ledger sudah tutup buku"); } break; } case (4): // Unreconcile { if (_closingService.IsDateClosed(DateTime.Now)) { paymentVoucher.Errors.Add("Generic", "Ledger sudah tutup buku"); } break; } } return(paymentVoucher); }
public PaymentVoucher UnreconcileObject(PaymentVoucher paymentVoucher, IPaymentVoucherDetailService _paymentVoucherDetailService, ICashMutationService _cashMutationService, ICashBankService _cashBankService, IPayableService _payableService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService) { if (_validator.ValidUnreconcileObject(paymentVoucher, _closingService)) { _repository.UnreconcileObject(paymentVoucher); CashBank cashBank = _cashBankService.GetObjectById(paymentVoucher.CashBankId); IList <CashMutation> cashMutations = _cashMutationService.SoftDeleteCashMutationForPaymentVoucher(paymentVoucher, cashBank); foreach (var cashMutation in cashMutations) { _cashMutationService.ReverseCashMutateObject(cashMutation, _cashBankService); } IList <PaymentVoucherDetail> paymentVoucherDetails = _paymentVoucherDetailService.GetObjectsByPaymentVoucherId(paymentVoucher.Id); foreach (var paymentVoucherDetail in paymentVoucherDetails) { Payable payable = _payableService.GetObjectById(paymentVoucherDetail.PayableId); payable.PendingClearanceAmount += paymentVoucherDetail.Amount; if (payable.PendingClearanceAmount != 0 || payable.RemainingAmount != 0) { payable.IsCompleted = false; payable.CompletionDate = null; } _payableService.UpdateObject(payable); } } return(paymentVoucher); }
void before_each() { var db = new OffsetPrintingSuppliesEntities(); using (db) { db.DeleteAllTables(); itemService = new ItemService(new ItemRepository(), new ItemValidator()); contactService = new ContactService(new ContactRepository(), new ContactValidator()); poService = new PurchaseOrderService(new PurchaseOrderRepository(), new PurchaseOrderValidator()); poDetailService = new PurchaseOrderDetailService(new PurchaseOrderDetailRepository(), new PurchaseOrderDetailValidator()); _stockMutationService = new StockMutationService(new StockMutationRepository(), new StockMutationValidator()); _itemTypeService = new ItemTypeService(new ItemTypeRepository(), new ItemTypeValidator()); _uomService = new UoMService(new UoMRepository(), new UoMValidator()); _warehouseItemService = new WarehouseItemService(new WarehouseItemRepository(), new WarehouseItemValidator()); _warehouseService = new WarehouseService(new WarehouseRepository(), new WarehouseValidator()); _barringService = new BarringService(new BarringRepository(), new BarringValidator()); _itemService = new ItemService(new ItemRepository(), new ItemValidator()); _stockAdjustmentService = new StockAdjustmentService(new StockAdjustmentRepository(), new StockAdjustmentValidator()); _stockAdjustmentDetailService = new StockAdjustmentDetailService(new StockAdjustmentDetailRepository(), new StockAdjustmentDetailValidator()); _accountService = new AccountService(new AccountRepository(), new AccountValidator()); _closingService = new ClosingService(new ClosingRepository(), new ClosingValidator()); _generalLedgerJournalService = new GeneralLedgerJournalService(new GeneralLedgerJournalRepository(), new GeneralLedgerJournalValidator()); _priceMutationService = new PriceMutationService(new PriceMutationRepository(), new PriceMutationValidator()); _contactGroupService = new ContactGroupService(new ContactGroupRepository(), new ContactGroupValidator()); 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); } baseGroup = _contactGroupService.CreateObject(Core.Constants.Constant.GroupType.Base, "Base Group", true); Pcs = new UoM() { Name = "Pcs" }; _uomService.CreateObject(Pcs); contact = new Contact() { Name = "President of Indonesia", Address = "Istana Negara Jl. Veteran No. 16 Jakarta Pusat", ContactNo = "021 3863777", PIC = "Mr. President", PICContactNo = "021 3863777", Email = "*****@*****.**" }; contact = contactService.CreateObject(contact, _contactGroupService); type = _itemTypeService.CreateObject("Item", "Item"); warehouse = new Warehouse() { Name = "Sentral Solusi Data", Description = "Kali Besar Jakarta", Code = "LCL" }; warehouse = _warehouseService.CreateObject(warehouse, _warehouseItemService, itemService); item1 = new Item() { ItemTypeId = _itemTypeService.GetObjectByName("Item").Id, Name = "Batik Tulis", Category = "Item", Sku = "bt123", UoMId = Pcs.Id }; itemService.CreateObject(item1, _uomService, _itemTypeService, _warehouseItemService, _warehouseService, _priceMutationService, _contactGroupService); item2 = new Item() { ItemTypeId = _itemTypeService.GetObjectByName("Item").Id, Name = "Buku Gambar", Category = "Item", Sku = "bg123", UoMId = Pcs.Id }; itemService.CreateObject(item2, _uomService, _itemTypeService, _warehouseItemService, _warehouseService, _priceMutationService, _contactGroupService); StockAdjustment sa = new StockAdjustment() { AdjustmentDate = DateTime.Today, WarehouseId = warehouse.Id, Description = "item adjustment" }; _stockAdjustmentService.CreateObject(sa, _warehouseService); StockAdjustmentDetail sadItem1 = new StockAdjustmentDetail() { ItemId = item1.Id, Quantity = 1000, StockAdjustmentId = sa.Id }; _stockAdjustmentDetailService.CreateObject(sadItem1, _stockAdjustmentService, _itemService, _warehouseItemService); StockAdjustmentDetail sadItem2 = new StockAdjustmentDetail() { ItemId = item2.Id, Quantity = 1000, StockAdjustmentId = sa.Id }; _stockAdjustmentDetailService.CreateObject(sadItem2, _stockAdjustmentService, _itemService, _warehouseItemService); _stockAdjustmentService.ConfirmObject(sa, DateTime.Today, _stockAdjustmentDetailService, _stockMutationService, _itemService, _barringService, _warehouseItemService, _generalLedgerJournalService, _accountService, _closingService); } }
public bool ValidUnconfirmObject(CashBankAdjustment cashBankAdjustment, ICashBankService _cashBankService, IClosingService _closingService) { cashBankAdjustment.Errors.Clear(); VUnconfirmObject(cashBankAdjustment, _cashBankService, _closingService); return(isValid(cashBankAdjustment)); }
public PaymentVoucher UnconfirmObject(PaymentVoucher paymentVoucher, IPaymentVoucherDetailService _paymentVoucherDetailService, ICashBankService _cashBankService, IPayableService _payableService, ICashMutationService _cashMutationService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService) { if (_validator.ValidUnconfirmObject(paymentVoucher, _closingService)) { IList <PaymentVoucherDetail> details = _paymentVoucherDetailService.GetObjectsByPaymentVoucherId(paymentVoucher.Id); foreach (var detail in details) { detail.Errors = new Dictionary <string, string>(); _paymentVoucherDetailService.UnconfirmObject(detail, this, _payableService); } _repository.UnconfirmObject(paymentVoucher); if (!paymentVoucher.IsGBCH) { CashBank cashBank = _cashBankService.GetObjectById(paymentVoucher.CashBankId); IList <CashMutation> cashMutations = _cashMutationService.SoftDeleteCashMutationForPaymentVoucher(paymentVoucher, cashBank); foreach (var cashMutation in cashMutations) { _cashMutationService.ReverseCashMutateObject(cashMutation, _cashBankService); } _generalLedgerJournalService.CreateUnconfirmationJournalForPaymentVoucher(paymentVoucher, cashBank, _accountService); } } return(paymentVoucher); }
/*public CashSalesInvoice VIsCashBankTypeNotBank(CashSalesInvoice cashSalesInvoice, ICashBankService _cashBankService) * { * CashBank cashBank = _cashBankService.GetObjectById((int)cashSalesInvoice.CashBankId.GetValueOrDefault()); * if (cashBank.IsBank) * { * cashSalesInvoice.Errors.Add("Generic", "CashBank harus bukan tipe Bank"); * return cashSalesInvoice; * } * return cashSalesInvoice; * }*/ public CashSalesInvoice VGeneralLedgerPostingHasNotBeenClosed(CashSalesInvoice cashSalesInvoice, IClosingService _closingService, int CaseConfirmUnconfirm) { switch (CaseConfirmUnconfirm) { case (1): // Confirm & Paid { if (_closingService.IsDateClosed(cashSalesInvoice.ConfirmationDate.GetValueOrDefault())) { cashSalesInvoice.Errors.Add("Generic", "Ledger sudah tutup buku"); } break; } case (2): // Unconfirm & Unpaid { if (_closingService.IsDateClosed(DateTime.Now)) { cashSalesInvoice.Errors.Add("Generic", "Ledger sudah tutup buku"); } break; } } return(cashSalesInvoice); }
public bool ValidConfirmObject(CashSalesInvoice cashSalesInvoice, ICashSalesInvoiceDetailService _cashSalesInvoiceDetailService, ICashSalesInvoiceService _cashSalesInvoiceService, IWarehouseItemService _warehouseItemService, IContactService _contactService, ICashBankService _cashBankService, IClosingService _closingService) { cashSalesInvoice.Errors.Clear(); VConfirmObject(cashSalesInvoice, _cashSalesInvoiceDetailService, _cashSalesInvoiceService, _warehouseItemService, _contactService, _cashBankService, _closingService); return(isValid(cashSalesInvoice)); }
public StockAdjustment VUnconfirmObject(StockAdjustment stockAdjustment, IStockAdjustmentService _stockAdjustmentService, IStockAdjustmentDetailService _stockAdjustmentDetailService, IItemService _itemService, IBarringService _barringService, IWarehouseItemService _warehouseItemService, IClosingService _closingService) { VHasBeenConfirmed(stockAdjustment); if (!isValid(stockAdjustment)) { return(stockAdjustment); } VGeneralLedgerPostingHasNotBeenClosed(stockAdjustment, _closingService, 2); return(stockAdjustment); }
public bool ValidUnconfirmObject(StockAdjustment stockAdjustment, IStockAdjustmentService _stockAdjustmentService, IStockAdjustmentDetailService _stockAdjustmentDetailService, IItemService _itemService, IBarringService _barringService, IWarehouseItemService _warehouseItemService, IClosingService _closingService) { stockAdjustment.Errors.Clear(); VUnconfirmObject(stockAdjustment, _stockAdjustmentService, _stockAdjustmentDetailService, _itemService, _barringService, _warehouseItemService, _closingService); return(isValid(stockAdjustment)); }
public StockAdjustment VConfirmObject(StockAdjustment stockAdjustment, IStockAdjustmentService _stockAdjustmentService, IStockAdjustmentDetailService _stockAdjustmentDetailService, IItemService _itemService, IBarringService _barringService, IWarehouseItemService _warehouseItemService, IClosingService _closingService) { VHasConfirmationDate(stockAdjustment); if (!isValid(stockAdjustment)) { return(stockAdjustment); } VHasNotBeenConfirmed(stockAdjustment); if (!isValid(stockAdjustment)) { return(stockAdjustment); } VHasStockAdjustmentDetails(stockAdjustment, _stockAdjustmentDetailService); if (!isValid(stockAdjustment)) { return(stockAdjustment); } VDetailsAreVerifiedConfirmable(stockAdjustment, _stockAdjustmentService, _stockAdjustmentDetailService, _itemService, _barringService, _warehouseItemService); if (!isValid(stockAdjustment)) { return(stockAdjustment); } VGeneralLedgerPostingHasNotBeenClosed(stockAdjustment, _closingService, 1); return(stockAdjustment); }
public bool ValidUnconfirmObject(CashBankMutation cashBankMutation, ICashBankService _cashBankService, IClosingService _closingService) { cashBankMutation.Errors.Clear(); VUnconfirmObject(cashBankMutation, _cashBankService, _closingService); return(isValid(cashBankMutation)); }
public CashBankMutation VUnconfirmObject(CashBankMutation cashBankMutation, ICashBankService _cashBankService, IClosingService _closingService) { VHasNotBeenDeleted(cashBankMutation); if (!isValid(cashBankMutation)) { return(cashBankMutation); } VHasBeenConfirmed(cashBankMutation); if (!isValid(cashBankMutation)) { return(cashBankMutation); } VNonNegativeNorZeroTargetCashBank(cashBankMutation, _cashBankService); if (!isValid(cashBankMutation)) { return(cashBankMutation); } VGeneralLedgerPostingHasNotBeenClosed(cashBankMutation, _closingService, 2); return(cashBankMutation); }
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); } }
public bool ValidUnpaidObject(CashSalesInvoice cashSalesInvoice, ICashSalesReturnService _cashSalesReturnService, IClosingService _closingService) { cashSalesInvoice.Errors.Clear(); VUnpaidObject(cashSalesInvoice, _cashSalesReturnService, _closingService); return(isValid(cashSalesInvoice)); }
public CashBankAdjustment VUnconfirmObject(CashBankAdjustment cashBankAdjustment, ICashBankService _cashBankService, IClosingService _closingService) { VHasBeenConfirmed(cashBankAdjustment); if (!isValid(cashBankAdjustment)) { return(cashBankAdjustment); } VNonNegativeNorZeroCashBankAmount(cashBankAdjustment, _cashBankService, false); if (!isValid(cashBankAdjustment)) { return(cashBankAdjustment); } VGeneralLedgerPostingHasNotBeenClosed(cashBankAdjustment, _closingService, 2); return(cashBankAdjustment); }
public CashBankAdjustment ConfirmObject(CashBankAdjustment cashBankAdjustment, DateTime ConfirmationDate, ICashMutationService _cashMutationService, ICashBankService _cashBankService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService) { cashBankAdjustment.ConfirmationDate = ConfirmationDate; if (_validator.ValidConfirmObject(cashBankAdjustment, _cashBankService, _closingService)) { CashBank cashBank = _cashBankService.GetObjectById(cashBankAdjustment.CashBankId); CashMutation cashMutation = _cashMutationService.CreateCashMutationForCashBankAdjustment(cashBankAdjustment, cashBank); // cashBank.Amount += cashBankAdjustment.Amount; _cashMutationService.CashMutateObject(cashMutation, _cashBankService); _generalLedgerJournalService.CreateConfirmationJournalForCashBankAdjustment(cashBankAdjustment, cashBank, _accountService); _repository.ConfirmObject(cashBankAdjustment); } return(cashBankAdjustment); }
public CashBankAdjustment VGeneralLedgerPostingHasNotBeenClosed(CashBankAdjustment cashBankAdjustment, IClosingService _closingService, int CaseConfirmUnconfirm) { switch (CaseConfirmUnconfirm) { case (1): // Confirm { if (_closingService.IsDateClosed(cashBankAdjustment.ConfirmationDate.GetValueOrDefault())) { cashBankAdjustment.Errors.Add("Generic", "Ledger sudah tutup buku"); } break; } case (2): // Unconfirm { if (_closingService.IsDateClosed(DateTime.Now)) { cashBankAdjustment.Errors.Add("Generic", "Ledger sudah tutup buku"); } break; } } return(cashBankAdjustment); }
public CashBankAdjustment UnconfirmObject(CashBankAdjustment cashBankAdjustment, ICashMutationService _cashMutationService, ICashBankService _cashBankService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService) { if (_validator.ValidUnconfirmObject(cashBankAdjustment, _cashBankService, _closingService)) { CashBank cashBank = _cashBankService.GetObjectById(cashBankAdjustment.CashBankId); IList <CashMutation> cashMutations = _cashMutationService.SoftDeleteCashMutationForCashBankAdjustment(cashBankAdjustment, cashBank); // cashBank.Amount -= cashBankAdjustment.Amount; foreach (var cashMutation in cashMutations) { _cashMutationService.ReverseCashMutateObject(cashMutation, _cashBankService); } _generalLedgerJournalService.CreateUnconfirmationJournalForCashBankAdjustment(cashBankAdjustment, cashBank, _accountService); _repository.UnconfirmObject(cashBankAdjustment); } return(cashBankAdjustment); }
public PaymentVoucher ReconcileObject(PaymentVoucher paymentVoucher, DateTime ReconciliationDate, IPaymentVoucherDetailService _paymentVoucherDetailService, ICashMutationService _cashMutationService, ICashBankService _cashBankService, IPayableService _payableService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService) { paymentVoucher.ReconciliationDate = ReconciliationDate; if (_validator.ValidReconcileObject(paymentVoucher, _closingService)) { _repository.ReconcileObject(paymentVoucher); CashBank cashBank = _cashBankService.GetObjectById(paymentVoucher.CashBankId); CashMutation cashMutation = _cashMutationService.CreateCashMutationForPaymentVoucher(paymentVoucher, cashBank); _cashMutationService.CashMutateObject(cashMutation, _cashBankService); IList <PaymentVoucherDetail> paymentVoucherDetails = _paymentVoucherDetailService.GetObjectsByPaymentVoucherId(paymentVoucher.Id); foreach (var paymentVoucherDetail in paymentVoucherDetails) { Payable payable = _payableService.GetObjectById(paymentVoucherDetail.PayableId); payable.PendingClearanceAmount -= paymentVoucherDetail.Amount; if (payable.PendingClearanceAmount == 0 && payable.RemainingAmount == 0) { payable.IsCompleted = true; payable.CompletionDate = DateTime.Now; } _payableService.UpdateObject(payable); } } return(paymentVoucher); }
public CustomPurchaseInvoice ConfirmObject(CustomPurchaseInvoice customPurchaseInvoice, DateTime ConfirmationDate, ICustomPurchaseInvoiceDetailService _customPurchaseInvoiceDetailService, IContactService _contactService, IPriceMutationService _priceMutationService, IPayableService _payableService, ICustomPurchaseInvoiceService _customPurchaseInvoiceService, IWarehouseItemService _warehouseItemService, IWarehouseService _warehouseService, IItemService _itemService, IBarringService _barringService, IStockMutationService _stockMutationService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService) { customPurchaseInvoice.ConfirmationDate = ConfirmationDate; if (_validator.ValidConfirmObject(customPurchaseInvoice, _customPurchaseInvoiceDetailService, _customPurchaseInvoiceService, _warehouseItemService, _contactService, _closingService)) { IList <CustomPurchaseInvoiceDetail> customPurchaseInvoiceDetails = _customPurchaseInvoiceDetailService.GetObjectsByCustomPurchaseInvoiceId(customPurchaseInvoice.Id); customPurchaseInvoice.Total = 0; customPurchaseInvoice.CoGS = 0; foreach (var customPurchaseInvoiceDetail in customPurchaseInvoiceDetails) { customPurchaseInvoiceDetail.Errors = new Dictionary <string, string>(); _customPurchaseInvoiceDetailService.ConfirmObject(customPurchaseInvoiceDetail, _customPurchaseInvoiceService, _warehouseItemService, _warehouseService, _itemService, _barringService, _stockMutationService, _priceMutationService); customPurchaseInvoice.Total += customPurchaseInvoiceDetail.Amount; customPurchaseInvoice.CoGS += customPurchaseInvoiceDetail.CoGS; } // Tax dihitung setelah discount //customPurchaseInvoice.Total = (customPurchaseInvoice.Total * (100 - customPurchaseInvoice.Discount) / 100) * (100 - customPurchaseInvoice.Tax) / 100; customPurchaseInvoice.Total = CalculateTotalAmountAfterDiscountAndTax(customPurchaseInvoice); Payable payable = _payableService.CreateObject(customPurchaseInvoice.ContactId, Core.Constants.Constant.PayableSource.CustomPurchaseInvoice, customPurchaseInvoice.Id, customPurchaseInvoice.Code, customPurchaseInvoice.Total, (DateTime)customPurchaseInvoice.DueDate.GetValueOrDefault()); _generalLedgerJournalService.CreateConfirmationJournalForCustomPurchaseInvoice(customPurchaseInvoice, _accountService); customPurchaseInvoice = _repository.ConfirmObject(customPurchaseInvoice); } else { customPurchaseInvoice.ConfirmationDate = null; } return(customPurchaseInvoice); }
public PaymentVoucher ConfirmObject(PaymentVoucher paymentVoucher, DateTime ConfirmationDate, IPaymentVoucherDetailService _paymentVoucherDetailService, ICashBankService _cashBankService, IPayableService _payableService, ICashMutationService _cashMutationService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService) { paymentVoucher.ConfirmationDate = ConfirmationDate; if (_validator.ValidConfirmObject(paymentVoucher, this, _paymentVoucherDetailService, _cashBankService, _payableService, _closingService)) { IList <PaymentVoucherDetail> details = _paymentVoucherDetailService.GetObjectsByPaymentVoucherId(paymentVoucher.Id); foreach (var detail in details) { detail.Errors = new Dictionary <string, string>(); _paymentVoucherDetailService.ConfirmObject(detail, ConfirmationDate, this, _payableService); } _repository.ConfirmObject(paymentVoucher); if (!paymentVoucher.IsGBCH) { CashBank cashBank = _cashBankService.GetObjectById(paymentVoucher.CashBankId); CashMutation cashMutation = _cashMutationService.CreateCashMutationForPaymentVoucher(paymentVoucher, cashBank); _cashMutationService.CashMutateObject(cashMutation, _cashBankService); _generalLedgerJournalService.CreateConfirmationJournalForPaymentVoucher(paymentVoucher, cashBank, _accountService); } } return(paymentVoucher); }
public CustomPurchaseInvoice UnconfirmObject(CustomPurchaseInvoice customPurchaseInvoice, ICustomPurchaseInvoiceDetailService _customPurchaseInvoiceDetailService, IPayableService _payableService, IPaymentVoucherDetailService _paymentVoucherDetailService, IWarehouseItemService _warehouseItemService, IWarehouseService _warehouseService, IItemService _itemService, IBarringService _barringService, IStockMutationService _stockMutationService, IPriceMutationService _priceMutationService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService) { if (_validator.ValidUnconfirmObject(customPurchaseInvoice, _customPurchaseInvoiceDetailService, _payableService, _paymentVoucherDetailService, _closingService)) { IList <CustomPurchaseInvoiceDetail> customPurchaseInvoiceDetails = _customPurchaseInvoiceDetailService.GetObjectsByCustomPurchaseInvoiceId(customPurchaseInvoice.Id); foreach (var customPurchaseInvoiceDetail in customPurchaseInvoiceDetails) { customPurchaseInvoiceDetail.Errors = new Dictionary <string, string>(); _customPurchaseInvoiceDetailService.UnconfirmObject(customPurchaseInvoiceDetail, _warehouseItemService, _warehouseService, _itemService, _barringService, _stockMutationService, _priceMutationService); } Payable payable = _payableService.GetObjectBySource(Core.Constants.Constant.PayableSource.CustomPurchaseInvoice, customPurchaseInvoice.Id); _payableService.SoftDeleteObject(payable); customPurchaseInvoice.Total = 0; customPurchaseInvoice.CoGS = 0; _generalLedgerJournalService.CreateUnconfirmationJournalForCustomPurchaseInvoice(customPurchaseInvoice, _accountService); customPurchaseInvoice = _repository.UnconfirmObject(customPurchaseInvoice); } return(customPurchaseInvoice); }
public StockAdjustment UnconfirmObject(StockAdjustment stockAdjustment, IStockAdjustmentDetailService _stockAdjustmentDetailService, IStockMutationService _stockMutationService, IItemService _itemService, IBarringService _barringService, IWarehouseItemService _warehouseItemService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService) { if (_validator.ValidUnconfirmObject(stockAdjustment, this, _stockAdjustmentDetailService, _itemService, _barringService, _warehouseItemService, _closingService)) { IList <StockAdjustmentDetail> stockAdjustmentDetails = _stockAdjustmentDetailService.GetObjectsByStockAdjustmentId(stockAdjustment.Id); foreach (var detail in stockAdjustmentDetails) { detail.Errors = new Dictionary <string, string>(); _stockAdjustmentDetailService.UnconfirmObject(detail, this, _stockMutationService, _itemService, _barringService, _warehouseItemService); } _generalLedgerJournalService.CreateUnconfirmationJournalForStockAdjustment(stockAdjustment, _accountService); _repository.UnconfirmObject(stockAdjustment); } return(stockAdjustment); }
public ReceiptVoucher ReconcileObject(ReceiptVoucher receiptVoucher, DateTime ReconciliationDate, IReceiptVoucherDetailService _receiptVoucherDetailService, ICashMutationService _cashMutationService, ICashBankService _cashBankService, IReceivableService _receivableService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService) { receiptVoucher.ReconciliationDate = ReconciliationDate; if (_validator.ValidReconcileObject(receiptVoucher, _closingService)) { _repository.ReconcileObject(receiptVoucher); CashBank cashBank = _cashBankService.GetObjectById(receiptVoucher.CashBankId); CashMutation cashMutation = _cashMutationService.CreateCashMutationForReceiptVoucher(receiptVoucher, cashBank); _cashMutationService.CashMutateObject(cashMutation, _cashBankService); IList <ReceiptVoucherDetail> receiptVoucherDetails = _receiptVoucherDetailService.GetObjectsByReceiptVoucherId(receiptVoucher.Id); foreach (var receiptVoucherDetail in receiptVoucherDetails) { Receivable receivable = _receivableService.GetObjectById(receiptVoucherDetail.ReceivableId); receivable.PendingClearanceAmount -= receiptVoucherDetail.Amount; if (receivable.PendingClearanceAmount == 0 && receivable.RemainingAmount == 0) { receivable.IsCompleted = true; receivable.CompletionDate = DateTime.Now; } _receivableService.UpdateObject(receivable); } } return(receiptVoucher); }
public CashSalesInvoice ConfirmObject(CashSalesInvoice cashSalesInvoice, DateTime ConfirmationDate, decimal Discount, decimal Tax, ICashSalesInvoiceDetailService _cashSalesInvoiceDetailService, IContactService _contactService, IPriceMutationService _priceMutationService, IReceivableService _receivableService, ICashSalesInvoiceService _cashSalesInvoiceService, IWarehouseItemService _warehouseItemService, IWarehouseService _warehouseService, IItemService _itemService, IBarringService _barringService, IStockMutationService _stockMutationService, ICashBankService _cashBankService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService) { cashSalesInvoice.ConfirmationDate = ConfirmationDate; if (_validator.ValidConfirmObject(cashSalesInvoice, _cashSalesInvoiceDetailService, _cashSalesInvoiceService, _warehouseItemService, _contactService, _cashBankService, _closingService)) { cashSalesInvoice.Discount = Discount; cashSalesInvoice.Tax = Tax; IList <CashSalesInvoiceDetail> cashSalesInvoiceDetails = _cashSalesInvoiceDetailService.GetObjectsByCashSalesInvoiceId(cashSalesInvoice.Id); cashSalesInvoice.Total = 0; cashSalesInvoice.CoGS = 0; foreach (var cashSalesInvoiceDetail in cashSalesInvoiceDetails) { cashSalesInvoiceDetail.Errors = new Dictionary <string, string>(); _cashSalesInvoiceDetailService.ConfirmObject(cashSalesInvoiceDetail, _cashSalesInvoiceService, _warehouseItemService, _warehouseService, _itemService, _barringService, _stockMutationService); cashSalesInvoice.Total += cashSalesInvoiceDetail.Amount; cashSalesInvoice.CoGS += cashSalesInvoiceDetail.CoGS; } // Tax dihitung setelah Discount cashSalesInvoice.Total = (cashSalesInvoice.Total * ((100 - cashSalesInvoice.Discount) / 100) * ((100 + cashSalesInvoice.Tax) / 100)); Contact contact = _contactService.GetObjectByName(Core.Constants.Constant.BaseContact); Receivable receivable = _receivableService.CreateObject(contact.Id, Core.Constants.Constant.ReceivableSource.CashSalesInvoice, cashSalesInvoice.Id, cashSalesInvoice.Code, cashSalesInvoice.Total, (DateTime)cashSalesInvoice.DueDate.GetValueOrDefault()); _generalLedgerJournalService.CreateConfirmationJournalForCashSalesInvoice(cashSalesInvoice, _accountService); cashSalesInvoice = _repository.ConfirmObject(cashSalesInvoice); } else { cashSalesInvoice.ConfirmationDate = null; } return(cashSalesInvoice); }
public ReceiptVoucher UnreconcileObject(ReceiptVoucher receiptVoucher, IReceiptVoucherDetailService _receiptVoucherDetailService, ICashMutationService _cashMutationService, ICashBankService _cashBankService, IReceivableService _receivableService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService) { if (_validator.ValidUnreconcileObject(receiptVoucher, _closingService)) { _repository.UnreconcileObject(receiptVoucher); CashBank cashBank = _cashBankService.GetObjectById(receiptVoucher.CashBankId); IList <CashMutation> cashMutations = _cashMutationService.SoftDeleteCashMutationForReceiptVoucher(receiptVoucher, cashBank); foreach (var cashMutation in cashMutations) { _cashMutationService.ReverseCashMutateObject(cashMutation, _cashBankService); } IList <ReceiptVoucherDetail> receiptVoucherDetails = _receiptVoucherDetailService.GetObjectsByReceiptVoucherId(receiptVoucher.Id); foreach (var receiptVoucherDetail in receiptVoucherDetails) { Receivable receivable = _receivableService.GetObjectById(receiptVoucherDetail.ReceivableId); receivable.PendingClearanceAmount += receiptVoucherDetail.Amount; if (receivable.PendingClearanceAmount != 0 || receivable.RemainingAmount != 0) { receivable.IsCompleted = false; receivable.CompletionDate = null; } _receivableService.UpdateObject(receivable); } } return(receiptVoucher); }
public bool ValidReconcileObject(PaymentVoucher paymentVoucher, IClosingService _closingService) { paymentVoucher.Errors.Clear(); VReconcileObject(paymentVoucher, _closingService); return(isValid(paymentVoucher)); }
public bool ValidUnreconcileObject(ReceiptVoucher receiptVoucher, IClosingService _closingService) { receiptVoucher.Errors.Clear(); VUnreconcileObject(receiptVoucher, _closingService); return(isValid(receiptVoucher)); }