Example #1
0
 public AccountPayableView(AcctPay acctPay)
 {
     this.AcctPayId       = acctPay.AcctPayId;
     this.DocNumber       = acctPay.DocNumber;
     this.GrossAmount     = acctPay.GrossAmount;
     this.DiscountAmount  = acctPay.DiscountAmount;
     this.Remark          = acctPay.Remark;
     this.GLDate          = acctPay.GLDate;
     this.SupplierId      = acctPay.SupplierId;
     this.SupplierName    = acctPay.Supplier.AddressBook.Name;
     this.ContractId      = acctPay.ContractId;
     this.POQuoteId       = acctPay.POQuoteId;
     this.Description     = acctPay.Description;
     this.PurchaseOrderId = acctPay.PurchaseOrderId;
     this.Tax             = acctPay.Tax;
     this.InvoiceId       = acctPay.InvoiceId;
     this.AccountId       = acctPay.AccountId;
     this.DocType         = acctPay.DocType;
     this.PaymentTerms    = acctPay.PaymentTerms;
     this.DiscountPercent = acctPay.DiscountPercent;
     this.AmountPaid      = acctPay.AmountPaid;
     this.AmountOpen      = acctPay.AmountOpen;
     this.OrderNumber     = acctPay.OrderNumber;
     this.DiscountDueDate = acctPay.DiscountDueDate;
 }
Example #2
0
        public async Task TestPayAccountsPayable()
        {
            long              customerId = 2;
            string            poNumber   = "PO-2";
            UnitOfWork        unitOfWork = new UnitOfWork();
            GeneralLedgerView ledgerView = new GeneralLedgerView();

            long?addressId = await unitOfWork.customerRepository.GetAddressIdByCustomerId(customerId);

            ChartOfAccts coa = await unitOfWork.chartOfAccountRepository.GetChartofAccount("1000", "1200", "210", "");

            AcctPay acctPay = await unitOfWork.accountPayableRepository.GetAcctPayByPONumber(poNumber);

            SupplierInvoice supplierInvoice = await unitOfWork.supplierInvoiceRepository.GetSupplierInvoiceByPONumber(poNumber);

            if (coa == null || acctPay == null || supplierInvoice == null)
            {
                Assert.True(false);
            }
            //TODO create a process to match the ledger to the invoice and account receivable

            ledgerView.GeneralLedgerId = -1;
            ledgerView.SupplierId      = 3;
            ledgerView.DocNumber       = acctPay.DocNumber ?? 0; //doc number of the account payable
            ledgerView.AcctPayId       = acctPay.AcctPayId;
            ledgerView.InvoiceId       = supplierInvoice.SupplierInvoiceId;
            ledgerView.DocType         = "PV";
            ledgerView.Amount          = 268M;
            ledgerView.LedgerType      = "AA";
            ledgerView.GLDate          = DateTime.Parse("8/28/2018");
            ledgerView.AccountId       = coa.AccountId;
            ledgerView.CreatedDate     = DateTime.Parse("8/28/2018");
            ledgerView.AddressId       = addressId ?? 0;
            ledgerView.Comment         = "Payment for back to school";
            ledgerView.DebitAmount     = 0;
            ledgerView.CreditAmount    = 268M;
            ledgerView.FiscalPeriod    = 8;
            ledgerView.FiscalYear      = 2018;
            ledgerView.CheckNumber     = "113";


            AccountsPayableModule acctPayablesMod = new AccountsPayableModule();


            acctPayablesMod
            .Supplier
            .GeneralLedger.CreateGeneralLedger(ledgerView).Apply();


            acctPayablesMod
            .Supplier
            .CreateSupplierLedger(ledgerView)
            .Apply();

            acctPayablesMod
            .Supplier
            .UpdateAccountsPayable(ledgerView)
            .Apply();

            acctPayablesMod
            .Supplier
            .GeneralLedger
            .UpdateAccountBalances(ledgerView);

            Assert.True(true);
        }