public async Task <IActionResult> Add([FromBody] BillPaymentAddModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState.GetErrorList())); } await _manager.AddAsync(model); return(Ok()); }
public static BillPayment Create(BillPaymentAddModel model, string depositTo, decimal amount, string userId) { return(new BillPayment { BillId = model.BillId, PaymentMode = model.PaymentMode, BankAccountId = model.BankAccountId, CreditCardId = model.CreditCardId, ChequeNumber = model.ChequeNumber, DepositTo = depositTo, Amount = amount, PaymentDate = model.PaymentDate, Description = model.Description, Status = Constants.RecordStatus.Active, CreatedBy = userId ?? "0", CreatedOn = Utility.GetDateTime() }); }
public async Task AddAsync(BillPaymentAddModel model) { if (model.PaymentType == Constants.TransactionType.BillPayment) { var billSummary = await _billRepository.GetSummaryAsunc(model.BillId); var vendorPaymentInfo = await _vendorRepository.GetPaymentInfoAsync(billSummary.VendorId); var billPayment = BillPaymentFactory.Create(model, vendorPaymentInfo.AccountNumber, billSummary.TotalAmount, _userId); await _billPaymentRepository.AddAsync(billPayment); await _billRepository.UpdateStatusAsync(model.BillId, Constants.BillStatus.Paid); //For Transaction Update await _transactionRepository.SetTransactionAccountIdForBill(model.BillId, model.BankAccountId, model.PaymentDate, model.Description); await _unitOfWork.SaveChangesAsync(); } else if (model.PaymentType == Constants.TransactionType.VendorAdvancePayment) { var transaction = TransactionFactory.CreateByVendorAdvancePayment(model, model.BankAccountId, model.Amount, 0, true); await _transactionRepository.AddAsync(transaction); var transactionForDebit = TransactionFactory.CreateByVendorAdvancePayment(model, model.DebitBankAccountId, 0, model.Amount, false); await _transactionRepository.AddAsync(transactionForDebit); await _unitOfWork.SaveChangesAsync(); } else if (model.PaymentType == Constants.TransactionType.AccountExpence) { var transactionforCredit = TransactionFactory.CreateByTaxPaymentByVendor(model, model.BankAccountId, model.Amount, 0, true); await _transactionRepository.AddAsync(transactionforCredit); var transactionforDebit = TransactionFactory.CreateByTaxPaymentByVendor(model, model.DebitBankAccountId, 0, model.Amount, false); await _transactionRepository.AddAsync(transactionforDebit); await _unitOfWork.SaveChangesAsync(); } }
public static Transaction CreateByTaxPaymentByVendor(BillPaymentAddModel model, int?accId, decimal creditAmt, decimal debitAmt, bool isForTransEntry) { var transaction = new Transaction { TransactionId = null, CompanyId = null, TransactionTypeId = Constants.TransactionType.AccountExpence, TransactionDate = model.PaymentDate, TransactionNumber = null, ContactType = null, ContactId = null, BankAccountId = accId, DebitAmount = debitAmt, CreditAmount = creditAmt, CreationDate = model.PaymentDate, ModifyDate = model.PaymentDate, Status = Constants.TransactionStatus.Paid, Description = model.Description, isForTransEntry = isForTransEntry }; return(transaction); }