public IFluentSupplierLedger UpdateSupplierLedgerByGeneralLedgerView(GeneralLedgerView ledgerView) { Task <SupplierLedger> supplierLedgerTask = Task.Run(async() => await unitOfWork.supplierLedgerRepository.GetEntityByDocNumber(ledgerView.DocNumber, ledgerView.DocType)); Task.WaitAll(supplierLedgerTask); supplierLedgerTask.Result.SupplierId = ledgerView.SupplierId ?? 0; supplierLedgerTask.Result.InvoiceId = ledgerView.InvoiceId ?? 0; supplierLedgerTask.Result.AcctPayId = ledgerView.AcctPayId ?? 0; supplierLedgerTask.Result.DocNumber = ledgerView.DocNumber; supplierLedgerTask.Result.DocType = ledgerView.DocType; supplierLedgerTask.Result.Amount = ledgerView.Amount; supplierLedgerTask.Result.Gldate = ledgerView.GLDate; supplierLedgerTask.Result.CreatedDate = ledgerView.CreatedDate; supplierLedgerTask.Result.AccountId = ledgerView.AccountId; supplierLedgerTask.Result.AddressId = ledgerView.AddressId; supplierLedgerTask.Result.Comment = ledgerView.Comment; supplierLedgerTask.Result.DebitAmount = ledgerView.DebitAmount; supplierLedgerTask.Result.CreditAmount = ledgerView.CreditAmount; supplierLedgerTask.Result.FiscalPeriod = ledgerView.FiscalPeriod; supplierLedgerTask.Result.FiscalYear = ledgerView.FiscalYear; supplierLedgerTask.Result.GeneralLedgerId = ledgerView.GeneralLedgerId; UpdateSupplierLedger(supplierLedgerTask.Result); return(this as IFluentSupplierLedger); }
public IGeneralLedger UpdateAccountBalances(GeneralLedgerView ledgerView) { Task <bool> resultTask = Task.Run(() => unitOfWork.generalLedgerRepository.UpdateBalanceByAccountId(ledgerView.AccountId, ledgerView.FiscalYear, ledgerView.FiscalPeriod)); Task.WaitAll(resultTask); return(this as IGeneralLedger); }
public async Task TestCustomerCashPayment2() { int customerId = 2; GeneralLedgerView ledgerView = new GeneralLedgerView(); CustomerModule custMod = new CustomerModule(); long? addressId = await custMod.AddressBook.Query().GetAddressIdByCustomerId(customerId); ChartOfAccountModule coaMod = new ChartOfAccountModule(); ChartOfAccount coa = await coaMod.ChartOfAccount.Query().GetEntity("1000", "1200", "101", ""); ledgerView.GeneralLedgerId = -1; ledgerView.DocNumber = 1; ledgerView.DocType = "PV"; ledgerView.Amount = 250M; ledgerView.LedgerType = "AA"; ledgerView.GLDate = DateTime.Parse("8/10/2018"); ledgerView.AccountId = coa.AccountId; ledgerView.CreatedDate = DateTime.Parse("8/10/2018"); ledgerView.AddressId = addressId ?? 0; ledgerView.Comment = "First installment payment for dashboard"; ledgerView.DebitAmount = 250; ledgerView.CreditAmount = 0; ledgerView.FiscalPeriod = 8; ledgerView.FiscalYear = 2018; ledgerView.CheckNumber = "112"; AccountReceivableModule acctRecMod = new AccountReceivableModule(); bool result = await acctRecMod.CreateCustomerLedger(ledgerView); Assert.True(result); }
public ISupplier UpdateAccountsPayable(GeneralLedgerView generalLedgerView) { Task<CreateProcessStatus> statusResultTask = Task.Run(() => unitOfWork.accountPayableRepository.UpdatePayableByLedgerView(generalLedgerView)); Task.WaitAll(statusResultTask); processStatus = statusResultTask.Result; return this as ISupplier; }
public async Task <bool> CreateCustomerLedger(GeneralLedgerView ledgerView) { try { GeneralLedger.CreateGeneralLedgerByView(ledgerView).Apply(); GeneralLedgerView glView = await GeneralLedger .Query() .GetLedgerViewByExpression(e => e.AccountId == ledgerView.AccountId && e.Amount == ledgerView.Amount && e.Gldate == ledgerView.GLDate && e.DocNumber == ledgerView.DocNumber && e.CheckNumber == ledgerView.CheckNumber); ledgerView.GeneralLedgerId = glView.GeneralLedgerId; CustomerLedger .Apply(); await CustomerLedger .CreateEntityByGeneralLedgerView(ledgerView); CustomerLedger.Apply(); AccountReceivable .UpdateAccountReceivableByGeneralLedgerView(ledgerView) .Apply(); GeneralLedger .UpdateAccountBalances(ledgerView); return(true); } catch (Exception ex) { throw new Exception("CreateCustomerLedger", ex); } }
public override CustomerLedgerView MapToCustomerLedgerView(GeneralLedgerView ledgerView) { return(new CustomerLedgerView { CustomerId = ledgerView.CustomerId ?? 0, GeneralLedgerId = ledgerView.GeneralLedgerId, //CustomerName= ledgerView.Cusot InvoiceId = ledgerView.InvoiceId ?? 0, //AcctRecId //CustomerLedgerId = ledgerView.cu DocNumber = ledgerView.DocNumber, DocType = ledgerView.DocType, Amount = ledgerView.Amount, LedgerType = ledgerView.LedgerType, GLDate = ledgerView.GLDate, AccountId = ledgerView.AccountId, CreatedDate = ledgerView.CreatedDate, AddressId = ledgerView.AddressId, Comment = ledgerView.Comment, DebitAmount = ledgerView.DebitAmount, CreditAmount = ledgerView.CreditAmount, FiscalPeriod = ledgerView.FiscalPeriod, FiscalYear = ledgerView.FiscalYear, CheckNumber = ledgerView.CheckNumber }); }
public async Task <GeneralLedgerView> Get(long generalLedgerId) { DataService ds = new DataService(this._baseUrl); GeneralLedgerView view = await ds.GetAsync <GeneralLedgerView>("api/GeneralLedger/ById/" + generalLedgerId.ToString()); return(view); }
public async Task <bool> CreateCustomerCashPayment(GeneralLedgerView ledgerView) { try { GeneralLedger .CreateGeneralLedgerByView(ledgerView) .Apply(); CustomerLedger .Apply(); await CustomerLedger .CreateEntityByGeneralLedgerView(ledgerView); CustomerLedger.Apply(); AccountReceivable .UpdateAccountReceivableByGeneralLedgerView(ledgerView) .Apply(); GeneralLedger .UpdateAccountBalances(ledgerView); return(true); } catch (Exception ex) { throw new Exception("CreateCustomerCashPayment", ex); } }
public IAccountsReceivable UpdateAccountReceivable(GeneralLedgerView ledgerView) { //Update receivable (today) (check for discount rules) Task <CreateProcessStatus> statusTask = Task.Run(() => unitOfWork.accountReceiveableRepository.UpdateReceivableByCashLedger(ledgerView)); Task.WaitAll(statusTask); processStatus = statusTask.Result; return(this as IAccountsReceivable); }
public async Task TestCustomerCashPayment2() { int customerId = 2; UnitOfWork unitOfWork = new UnitOfWork(); GeneralLedgerView ledgerView = new GeneralLedgerView(); long?addressId = await unitOfWork.customerRepository.GetAddressIdByCustomerId(customerId); ChartOfAcct coa = await unitOfWork.chartOfAccountRepository.GetChartofAccount("1000", "1200", "101", ""); ledgerView.GeneralLedgerId = -1; ledgerView.DocNumber = 1; ledgerView.DocType = "PV"; ledgerView.Amount = 250M; ledgerView.LedgerType = "AA"; ledgerView.GLDate = DateTime.Parse("8/10/2018"); ledgerView.AccountId = coa.AccountId; ledgerView.CreatedDate = DateTime.Parse("8/10/2018"); ledgerView.AddressId = addressId ?? 0; ledgerView.Comment = "First installment payment for dashboard"; ledgerView.DebitAmount = 250; ledgerView.CreditAmount = 0; ledgerView.FiscalPeriod = 8; ledgerView.FiscalYear = 2018; ledgerView.CheckNumber = "112"; AccountsReceivableModule acctRecMod = new AccountsReceivableModule(); acctRecMod .CustomerCashPayment .GeneralLedger.CreateGeneralLedger(ledgerView).Apply(); acctRecMod .CustomerCashPayment .CustomerLedger .CreateCustomerLedger(ledgerView) .Apply(); acctRecMod .CustomerCashPayment .AccountsReceivable .UpdateAccountReceivable(ledgerView) .Apply(); acctRecMod .CustomerCashPayment .GeneralLedger .UpdateAccountBalances(ledgerView); //bool result = await acctRec.CustomerCashPayment(ledgerView); Assert.True(true); }
public async Task TestCustomerCashPayment() { int customerId = 9; UnitOfWork unitOfWork = new UnitOfWork(); GeneralLedgerView ledgerView = new GeneralLedgerView(); long?addressId = await unitOfWork.customerRepository.GetAddressIdByCustomerId(customerId); ChartOfAcct coa = await unitOfWork.chartOfAccountRepository.GetChartofAccount("1000", "1200", "101", ""); ledgerView.GeneralLedgerId = -1; ledgerView.DocNumber = 12; ledgerView.DocType = "PV"; ledgerView.Amount = 189.63M; ledgerView.LedgerType = "AA"; ledgerView.GLDate = DateTime.Parse("7/21/2018"); ledgerView.AccountId = coa.AccountId; ledgerView.CreatedDate = DateTime.Parse("7/21/2018"); ledgerView.AddressId = addressId ?? 0; ledgerView.Comment = "Payment in Part for 50% sharing of project income"; ledgerView.DebitAmount = 189.63M; ledgerView.CreditAmount = 0; ledgerView.FiscalPeriod = 7; ledgerView.FiscalYear = 2018; ledgerView.CheckNumber = "111"; AccountsReceivableModule acctRecMod = new AccountsReceivableModule(); acctRecMod .CustomerCashPayment .GeneralLedger .CreateGeneralLedger(ledgerView) .Apply(); acctRecMod .CustomerCashPayment .CustomerLedger .CreateCustomerLedger(ledgerView) .Apply(); acctRecMod .CustomerCashPayment .AccountsReceivable .UpdateAccountReceivable(ledgerView) .Apply(); acctRecMod .CustomerCashPayment .GeneralLedger .UpdateAccountBalances(ledgerView); Assert.True(true); }
public ISupplier UpdateSupplierLedgerWithGeneralLedger(GeneralLedgerView generalLedgerView) { Task<SupplierLedgerView> supplierLedgerTask = Task.Run(() => unitOfWork.supplierLedgerRepository.GetSupplierLedgerByDocNumber(generalLedgerView.DocNumber, generalLedgerView.DocType)); Task.WaitAll(supplierLedgerTask); SupplierLedgerView supplierLedgerView = applicationViewFactory.MapSupplierLedgerView(generalLedgerView); supplierLedgerView.SupplierLedgerId = supplierLedgerTask.Result.SupplierLedgerId; Task<CreateProcessStatus> statusResultTask = Task.Run(() => unitOfWork.supplierLedgerRepository.UpdateSupplierLedger(supplierLedgerView)); Task.WaitAll(statusResultTask); processStatus = statusResultTask.Result; return this as ISupplier; }
public IGeneralLedger CreateGeneralLedger(GeneralLedgerView ledgerView) { try { Task <CreateProcessStatus> statusTask = Task.Run(() => unitOfWork.generalLedgerRepository.CreateLedgerFromView(ledgerView)); Task.WaitAll(statusTask); processStatus = statusTask.Result; return(this as IGeneralLedger); } catch (Exception ex) { throw new Exception(GetMyMethodName(), ex); } }
public IFluentSupplierLedger CreateSupplierLedgerWithGeneralLedgerView(GeneralLedgerView generalLedgerView) { Task <GeneralLedger> generalLedgerTask = Task.Run(() => unitOfWork.generalLedgerRepository.GetEntityByDocNumber(generalLedgerView.DocNumber, generalLedgerView.DocType)); Task.WaitAll(generalLedgerTask); SupplierLedgerView supplierLedgerView = applicationViewFactory.MapSupplierLedgerView(generalLedgerView); supplierLedgerView.GeneralLedgerId = generalLedgerTask.Result.GeneralLedgerId; CreateEntityByView(supplierLedgerView); Apply(); return(this as IFluentSupplierLedger); }
public IFluentSupplierLedger UpdateSupplierLedgerWithGeneralLedger(GeneralLedgerView generalLedgerView) { Task <SupplierLedgerView> supplierLedgerTask = Task.Run(async() => await Query().GetSupplierLedgerByDocNumber(generalLedgerView.DocNumber, generalLedgerView.DocType)); Task.WaitAll(supplierLedgerTask); SupplierLedgerView supplierLedgerView = applicationViewFactory.MapSupplierLedgerView(generalLedgerView); supplierLedgerView.SupplierLedgerId = supplierLedgerTask.Result.SupplierLedgerId; UpdateEntityByView(supplierLedgerView); Apply(); return(this as IFluentSupplierLedger); }
public CustomerLedgerView(GeneralLedgerView ledger) { this.DocNumber = ledger.DocNumber; this.DocType = ledger.DocType; this.Amount = ledger.Amount; this.GLDate = ledger.GLDate; this.CreatedDate = ledger.CreatedDate; this.AccountId = ledger.AccountId; this.AddressId = ledger.AddressId; this.Comment = ledger.Comment; this.DebitAmount = ledger.DebitAmount; this.CreditAmount = ledger.CreditAmount; this.FiscalPeriod = ledger.FiscalPeriod; this.FiscalYear = ledger.FiscalYear; this.GeneralLedgerId = ledger.GeneralLedgerId; }
public async Task TestPayAccountsPayable() { long customerId = 2; string poNumber = "PO-2"; AccountPayableModule acctPayablesMod = new AccountPayableModule(); GeneralLedgerView ledgerView = new GeneralLedgerView(); long?addressId = await acctPayablesMod.AddressBook.Query().GetAddressIdByCustomerId(customerId); ChartOfAccount coa = await acctPayablesMod.ChartOfAccount.Query().GetEntity("1000", "1200", "210", ""); AccountPayable acctPay = await acctPayablesMod.AccountPayable.Query().GetAcctPayByPONumber(poNumber); SupplierInvoice supplierInvoice = await acctPayablesMod.SupplierInvoice.Query().GetEntityByPONumber(poNumber); if (coa == null || acctPay == null || supplierInvoice == null) { Assert.True(false); } ledgerView.GeneralLedgerId = -1; ledgerView.SupplierId = 3; ledgerView.DocNumber = acctPay.DocNumber ?? 0; //doc number of the account payable ledgerView.AcctPayId = acctPay.AccountPayableId; 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"; acctPayablesMod.CreateAccountPayable(ledgerView); acctPayablesMod.AccountPayable.Apply(); Assert.True(true); }
public async Task <CreateProcessStatus> UpdateReceivableByCashLedger(GeneralLedgerView ledgerView) { try { List <AcctRec> list = await GetObjectsQueryable(e => e.DocNumber == ledgerView.DocNumber).ToListAsync <AcctRec>(); AcctRec acctRec = list[0]; if (acctRec != null) { //Find the General Ledger Cash Amount by Doc Number var query = await(from e in _dbContext.GeneralLedgers where e.DocNumber == ledgerView.DocNumber && e.DocType == "PV" && e.LedgerType == "AA" && e.AccountId == ledgerView.AccountId group e by e.DocNumber into g select new { AmountPaid = g.Sum(e => e.Amount) } ).FirstOrDefaultAsync(); decimal?cash = query?.AmountPaid ?? 0; acctRec.DebitAmount = cash; acctRec.OpenAmount = acctRec.Amount - acctRec.DebitAmount; decimal discountAmount = acctRec.Amount * acctRec.DiscountPercent ?? 0; //Check for Discount Dates if ( (acctRec.DiscountDueDate <= ledgerView.GLDate) && ((acctRec.DebitAmount + discountAmount) == acctRec.Amount) ) { acctRec.OpenAmount = acctRec.Amount - (acctRec.DebitAmount + discountAmount); } UpdateObject(acctRec); return(CreateProcessStatus.Update); } return(CreateProcessStatus.Failed); } catch (Exception ex) { throw new Exception(GetMyMethodName(), ex); } }
public IFluentAccountReceivable UpdateAccountReceivableByGeneralLedgerView(GeneralLedgerView ledgerView) { try { Task <AccountReceivable> acctRecTask = Task.Run(async() => await unitOfWork.accountReceivableRepository.GetAcctRecByDocNumber(ledgerView.DocNumber)); Task.WaitAll(acctRecTask); if (acctRecTask.Result != null) { Task <IList <GeneralLedger> > glListTask = Task.Run(async() => await unitOfWork.generalLedgerRepository.FindEntitiesByExpression( e => e.DocNumber == ledgerView.DocNumber && e.DocType == "PV" && e.LedgerType == "AA" && e.AccountId == ledgerView.AccountId )); Task.WaitAll(glListTask); Decimal cash = glListTask.Result.Sum(e => e.Amount); acctRecTask.Result.DebitAmount = cash; acctRecTask.Result.OpenAmount = acctRecTask.Result.Amount - acctRecTask.Result.DebitAmount; decimal discountAmount = acctRecTask.Result.Amount * acctRecTask.Result.DiscountPercent ?? 0; //Check for Discount Dates if ( (acctRecTask.Result.DiscountDueDate <= ledgerView.GLDate) && ((acctRecTask.Result.DebitAmount + discountAmount) == acctRecTask.Result.Amount) ) { acctRecTask.Result.OpenAmount = acctRecTask.Result.Amount - (acctRecTask.Result.DebitAmount + discountAmount); } UpdateAccountReceivable(acctRecTask.Result); return(this as IFluentAccountReceivable); } processStatus = CreateProcessStatus.Failed; return(this as IFluentAccountReceivable); } catch (Exception ex) { throw new Exception(GetMyMethodName(), ex); } }
public SupplierLedgerView(GeneralLedgerView ledger) { this.SupplierId = ledger.SupplierId ?? 0; this.InvoiceId = ledger.InvoiceId ?? 0; this.AcctPayId = ledger.AcctPayId ?? 0; this.DocNumber = ledger.DocNumber; this.DocType = ledger.DocType; this.Amount = ledger.Amount; this.GLDate = ledger.GLDate; this.CreatedDate = ledger.CreatedDate; this.AccountId = ledger.AccountId; this.AddressId = ledger.AddressId; this.Comment = ledger.Comment; this.DebitAmount = ledger.DebitAmount; this.CreditAmount = ledger.CreditAmount; this.FiscalPeriod = ledger.FiscalPeriod; this.FiscalYear = ledger.FiscalYear; this.GeneralLedgerId = ledger.GeneralLedgerId; }
public async Task <IFluentCustomerLedger> CreateEntityByGeneralLedgerView(GeneralLedgerView ledgerView) { CustomerLedgerView customerLedgerView = applicationViewFactory.MapToCustomerLedgerView(ledgerView); //Get the AcctRecId AccountReceivable acctRec = await unitOfWork.accountReceivableRepository.GetAcctRecByDocNumber(ledgerView.DocNumber); if (acctRec != null) { customerLedgerView.AccountReceivableId = acctRec.AccountReceivableId; customerLedgerView.InvoiceId = acctRec.InvoiceId ?? 0; customerLedgerView.CustomerId = acctRec.CustomerId; customerLedgerView.GeneralLedgerId = ledgerView.GeneralLedgerId; CreateEntityByView(customerLedgerView); } return(this as IFluentCustomerLedger); }
public IFluentAccountPayable UpdatePayableByLedgerView(GeneralLedgerView ledgerView) { try { Task <AccountPayable> acctPayTask = Task.Run(async() => await unitOfWork.accountPayableRepository.GetEntityByGeneralLedger(ledgerView)); Task.WaitAll(acctPayTask); if (acctPayTask.Result != null) { UpdateAccountPayable(acctPayTask.Result); processStatus = CreateProcessStatus.Update; return(this as IFluentAccountPayable); } processStatus = CreateProcessStatus.Failed; return(this as IFluentAccountPayable); } catch (Exception ex) { throw new Exception("UpdatePayableByLedgerView", ex); } }
public async Task <AccountPayable> GetEntityByGeneralLedger(GeneralLedgerView ledgerView) { List <AccountPayable> list = await(from detail in _dbContext.AccountPayable where detail.DocNumber == ledgerView.DocNumber select detail).ToListAsync <AccountPayable>(); AccountPayable acctPay = list[0]; if (acctPay != null) { //Find the General Ledger Cash Amount by Doc Number var query = await(from e in _dbContext.GeneralLedger where e.DocNumber == ledgerView.DocNumber && e.DocType == "PV" && e.LedgerType == "AA" && e.AccountId == ledgerView.AccountId group e by e.DocNumber into g select new { AmountPaid = g.Sum(e => e.Amount) } ).FirstOrDefaultAsync(); decimal?cash = query?.AmountPaid ?? 0; acctPay.AmountPaid = cash; acctPay.AmountOpen = acctPay.GrossAmount - acctPay.AmountPaid; decimal discountAmount = acctPay.GrossAmount * acctPay.DiscountPercent ?? 0; //Check for Discount Dates if ( (acctPay.DiscountDueDate <= ledgerView.GLDate) && ((acctPay.AmountPaid + discountAmount) == acctPay.AmountOpen) ) { acctPay.AmountOpen = acctPay.GrossAmount - (acctPay.AmountPaid + discountAmount); } } await Task.Yield(); return(acctPay); }
public bool CreateAccountPayable(GeneralLedgerView ledgerView) { try { GeneralLedger.CreateGeneralLedgerByView(ledgerView).Apply(); Task <GeneralLedgerView> generalLedgerViewTask = Task.Run(async() => await GeneralLedger.Query().GetViewByDocNumber(ledgerView.DocNumber, ledgerView.DocType)); Task.WaitAll(generalLedgerViewTask); SupplierLedgerView supplierLedgerView = applicationViewFactory.MapSupplierLedgerView(generalLedgerViewTask.Result); supplierLedgerView.GeneralLedgerId = generalLedgerViewTask.Result.GeneralLedgerId; SupplierLedger.CreateEntityByView(supplierLedgerView); SupplierLedger.Apply(); SupplierLedger.CreateSupplierLedgerWithGeneralLedgerView(ledgerView).Apply(); AccountPayable.UpdatePayableByLedgerView(ledgerView).Apply(); GeneralLedger.UpdateAccountBalances(ledgerView); return(true); } catch (Exception ex) { throw new Exception("CreateAccountPayable", ex); } }
public override SupplierLedgerView MapSupplierLedgerView(GeneralLedgerView ledgerView) { return(new SupplierLedgerView { SupplierId = ledgerView.SupplierId ?? 0, InvoiceId = ledgerView.InvoiceId ?? 0, AcctPayId = ledgerView.AcctPayId ?? 0, DocNumber = ledgerView.DocNumber, DocType = ledgerView.DocType, Amount = ledgerView.Amount, Gldate = ledgerView.GLDate, CreatedDate = ledgerView.CreatedDate, AccountId = ledgerView.AccountId, AddressId = ledgerView.AddressId, Comment = ledgerView.Comment, DebitAmount = ledgerView.DebitAmount, CreditAmount = ledgerView.CreditAmount, FiscalPeriod = ledgerView.FiscalPeriod, FiscalYear = ledgerView.FiscalYear, GeneralLedgerId = ledgerView.GeneralLedgerId }); }
public ICustomerLedger CreateCustomerLedger(GeneralLedgerView ledgerView) { CustomerLedgerView customerLedgerView = new CustomerLedgerView(ledgerView); //Get the AcctRecId Task <AcctRec> acctRecTask = Task.Run(() => unitOfWork.accountReceiveableRepository.GetAcctRecByDocNumber(ledgerView.DocNumber)); Task.WaitAll(acctRecTask); if (acctRecTask.Result != null) { customerLedgerView.AcctRecId = acctRecTask.Result.AcctRecId; customerLedgerView.InvoiceId = acctRecTask.Result.InvoiceId; customerLedgerView.CustomerId = acctRecTask.Result.CustomerId; customerLedgerView.GeneralLedgerId = ledgerView.GeneralLedgerId; Task <CreateProcessStatus> statusTask = Task.Run(() => unitOfWork.customerLedgerRepository.CreateLedgerFromView(customerLedgerView)); Task.WaitAll(statusTask); processStatus = statusTask.Result; } return(this as ICustomerLedger); }
public async Task <bool> PostIncome([FromBody] IncomeShortView incomeShortView) { int addressId = 1; GeneralLedgerModule ledgerMod = new GeneralLedgerModule(); NextNumber DocNumber = await ledgerMod.GeneralLedger.Query().GetDocNumber(); //Income GL GeneralLedgerView glView = new GeneralLedgerView(); glView.DocNumber = DocNumber.NextNumberValue; glView.Amount = incomeShortView.Amount; glView.GLDate = incomeShortView.GLDate; glView.AddressId = addressId; glView.Comment = incomeShortView.Comment; glView.CheckNumber = incomeShortView.CheckNumber; bool result = await ledgerMod.CreateIncomeAndCash(glView); return(result); }
public async Task TestCustomerCashPayment() { long?customerId = 9; GeneralLedgerView ledgerView = new GeneralLedgerView(); CustomerModule custMod = new CustomerModule(); long? addressId = await custMod.AddressBook.Query().GetAddressIdByCustomerId(customerId); ChartOfAccountModule coaMod = new ChartOfAccountModule(); ChartOfAccount coa = await coaMod.ChartOfAccount.Query().GetEntity("1000", "1200", "101", ""); ledgerView.GeneralLedgerId = -1; ledgerView.DocNumber = 12; ledgerView.DocType = "PV"; ledgerView.Amount = 189.63M; ledgerView.LedgerType = "AA"; ledgerView.GLDate = DateTime.Parse("7/21/2018"); ledgerView.AccountId = coa.AccountId; ledgerView.CreatedDate = DateTime.Parse("7/21/2018"); ledgerView.AddressId = addressId ?? 0; ledgerView.Comment = "Payment in Part for 50% sharing of project income"; ledgerView.DebitAmount = 189.63M; ledgerView.CreditAmount = 0; ledgerView.FiscalPeriod = 7; ledgerView.FiscalYear = 2018; ledgerView.CheckNumber = "111"; AccountReceivableModule acctRecMod = new AccountReceivableModule(); bool result = await acctRecMod.CreateCustomerCashPayment(ledgerView); Assert.True(true); }
public async Task <bool> PostPayment([FromBody] PersonalBudgetView budget) { GeneralLedgerModule ledgerMod = new GeneralLedgerModule(); NextNumber nextNumberDocNumber = await ledgerMod.GeneralLedger.Query().GetDocNumber(); //long addressId = 1; decimal expense = budget.BudgetAmount / (Decimal)budget.PayCycles ?? 0; // ChartOfAccts coa = ledgerMod.ChartOfAccounts.Query().GetChartofAccount("1000", "1200", "502", "01"); //Udc udcLedgerType = ledgerMod.UDC.Query().GetUdc("GENERALLEDGERTYPE", "AA"); //Udc udcDocType = ledgerMod.UDC.Query().GetUdc("DOCTYPE", "PV"); //AddressBook addressBook = ledgerMod.AddressBook.Query().GetAddressBookByAddressId(addressId); GeneralLedgerView glView = new GeneralLedgerView(); glView.DocNumber = nextNumberDocNumber.NextNumberValue; //glView.DocType = udcDocType.KeyCode; //glView.AccountId = coa.AccountId; glView.Amount = expense * -1; //glView.LedgerType = udcLedgerType.KeyCode; glView.GLDate = budget.GLDate; glView.CreatedDate = DateTime.Now; //glView.AddressId = addressBook.AddressId; //glView.Comment = "Mortgage Payment"; //glView.DebitAmount = 0; //glView.CreditAmount = expense; //glView.FiscalPeriod = budget.GLDate.Month; //glView.FiscalYear = budget.GLDate.Year; bool result1 = await ledgerMod.CreatePersonalExpense(glView); //GeneralLedgerView glViewLookup = //ledgerMod.GeneralLedger.Query().GetGeneralLedgerView(glView.DocNumber, glView.DocType); //ChartOfAccts coaCash = await unitOfWork.generalLedgerRepository.GetChartofAccount("1000", "1200", "101", ""); //ChartOfAccts coaCash = ledgerMod.ChartOfAccounts.Query().GetChartofAccount("1000", "1200", "101", ""); GeneralLedgerView glCashView = new GeneralLedgerView(); NextNumber nextNumberDocNumber2 = await ledgerMod.GeneralLedger.Query().GetDocNumber(); //long cashDocumentNumber = 22; glCashView.DocNumber = nextNumberDocNumber2.NextNumberValue; //glCashView.DocType = udcDocType.KeyCode; //glCashView.AccountId = coaCash.AccountId; glCashView.Amount = budget.PaymentAmount ?? 0; //glCashView.LedgerType = udcLedgerType.KeyCode; glCashView.GLDate = budget.GLDate; //glCashView.CreatedDate = DateTime.Now; //glCashView.AddressId = addressBook.AddressId; glCashView.Comment = glView.Comment; // glCashView.DebitAmount = 0; //glCashView.CreditAmount = expense; //glCashView.FiscalPeriod = budget.GLDate.Month; //glCashView.FiscalYear = budget.GLDate.Year; bool result2 = await ledgerMod.CreateCashPayment(glCashView); // GeneralLedgerView glCashViewLookup = //ledgerMod.GeneralLedger.Query().GetGeneralLedgerView(glCashView.DocNumber, glCashView.DocType); return(result2); }
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); }