public ActionResult AddDetail() { var model = new PaymentDetailViewModel(); model.Amount = 0; return(PartialView("PaymentDetail", model)); }
public ActionResult AddDetail(PaymentDetailViewModel model) { PaymentDetailSessionWrapper.AddDetail(model); var ajaxViewModel = new AjaxViewModel( data: new { TotalPayment = PaymentDetailSessionWrapper.TotalPayment }, message: "Payment detail has been updated."); return(Json(ajaxViewModel)); }
public static PaymentDetailViewModel GetDataById(int iId) { PaymentDetailViewModel result = new PaymentDetailViewModel(); using (POSContext context = new POSContext()) { result = (from x in context.TUser join y in context.TEmployee on x.Email equals y.Email where x.Id == iId select new PaymentDetailViewModel() { EmployeeID = y.ID, }).FirstOrDefault(); } return(result); }
public async Task <ActionResult <PaymentDetailViewModel> > GetPaymentDetail(int?id) { if (id == null) { return(NotFound(new { errorMessage = "Selected id was not found! Try again." })); } PaymentDetailViewModel aPaymentDetailViewModelInfo = _iMapper .Map <PaymentDetailViewModel>(await _iPaymentDetailManager.GetById(id)); if (aPaymentDetailViewModelInfo == null) { return(NotFound(new { errorMessage = "Selected payment detail was not found! Try again." })); } return(Ok(aPaymentDetailViewModelInfo)); }
public async Task <IActionResult> Payslip(int id) { var payment = (await _unitOfWork.PaymentRepository .GetAsync(filter: x => x.Id == id, includeProperties: "Employee")).FirstOrDefault(); if (payment == null) { return(NotFound()); } var model = new PaymentDetailViewModel() { Id = payment.Id, EmployeeId = payment.Id, FullName = payment.Employee.FirstName + " " + payment.Employee.LastName, NiNo = payment.Employee.NationalInsuranceNo, PayDate = payment.PayDate, PayMonth = payment.PayMonth, TaxCode = payment.TaxCode, TaxYearId = payment.TaxYearId, Year = (await _unitOfWork.TaxYearRepository.GetByIdAsync(payment.TaxYearId)).YearOfTax, HourlyRate = payment.HourlyRate, HoursWorked = payment.HoursWorked, ContractualHours = payment.ContractualHours, OvertimeHours = payment.OvertimeHours, OvertimeRate = _paymentComputeService.OvertimeRate(payment.HourlyRate), ContractualEarnings = payment.ContractualEarnings, OvertimeEarnings = payment.OvertimeEarnings, Tax = payment.Tax, NIC = payment.NIC, UnionFee = payment.UnionFee, SLC = payment.SLC, TotalEarnings = payment.TotalEarnings, TotalDeduction = payment.TotalDeduction, Employee = payment.Employee, TaxYear = payment.TaxYear, NetPayment = payment.NetPayment }; return(View(model)); }
public PaymentDetailPage() { InitializeComponent(); BindingContext = new PaymentDetailViewModel(); }
private IList <BillingViewModel> CreateBillingInvoices(int branchID, int billingTypeID, IEnumerable <BillingViewModel> billings, DateTime processDate, int processedByEmployeeID, string billingFileName) { List <BillingViewModel> list = new List <BillingViewModel>(); string autoNumber = autoNumberProvider.Generate(branchID, "BL", processDate.Month, processDate.Year); BillingHeader billingHeader = new BillingHeader(); billingHeader.BatchNo = autoNumber; billingHeader.BillingTypeID = billingTypeID; billingHeader.BranchID = branchID; billingHeader.UserName = context.Employees.Single(emp => emp.ID == processedByEmployeeID).UserName; billingHeader.ProcessDate = processDate; billingHeader.FileName = billingFileName; foreach (BillingViewModel billing in billings) { Contract contract = context.Contracts.SingleOrDefault(c => c.ContractNo == billing.ContractNo); Customer customer = contract.Customer; Item item = context.Items.SingleOrDefault(it => it.ID == contract.BillingItemID.Value); PackageHeader package = contract.PackageHeader; if (contract != null && package != null && customer != null && item != null) { var invoiceDetail = new InvoiceDetailViewModel(); invoiceDetail.InvoiceID = 0; invoiceDetail.ItemID = contract.BillingItemID.Value; invoiceDetail.Quantity = 1; invoiceDetail.UnitName = item.UnitName1; invoiceDetail.UnitPrice = billing.DuesAmount; invoiceDetail.Discount = 0; invoiceDetail.IsTaxable = true; var paymentDetail = new PaymentDetailViewModel(); paymentDetail.PaymentTypeID = context.PaymentTypes.SingleOrDefault(p => p.Description == "Credit Card").ID; paymentDetail.CreditCardTypeID = customer.CreditCardTypeID.HasValue ? customer.CreditCardTypeID.Value : context.CreditCardTypes.SingleOrDefault(cc => cc.Description == "Visa").ID; paymentDetail.ApprovalCode = String.Empty; paymentDetail.Amount = billing.DuesAmount; paymentDetail.Notes = "Auto Pay"; paymentDetail.PaymentID = 0; InvoiceHeader invoiceHeader = invoiceProvider.CreateExistingMemberInvoiceForBilling(branchID, processDate, customer.Barcode, processedByEmployeeID, "Auto pay " + contract.ContractNo, 0, new List <InvoiceDetailViewModel>() { invoiceDetail }, new List <PaymentDetailViewModel>() { paymentDetail }); var billingDetail = new BillingDetail(); billingDetail.Amount = billing.DuesAmount; billingDetail.Contract = contract; billingDetail.Customer = customer; billingDetail.InvoiceHeader = invoiceHeader; billingDetail.PackageHeader = package; billingHeader.BillingDetails.Add(billingDetail); context.Add(billingHeader); billing.Note += "," + invoiceHeader.InvoiceNo; list.Add(billing); } if (contract.NextDuesDate.HasValue) { contract.NextDuesDate = contract.NextDuesDate.Value.AddMonths(contract.DuesInMonth); } } autoNumberProvider.Increment("BL", branchID, processDate.Year); context.SaveChanges(); return(list); }
public ActionResult Add(PaymentDetailViewModel model) { if (ModelState.IsValid) { using (POSContext context = new POSContext()) { using (var dbTransaction = context.Database.BeginTransaction()) { int UserId = User.Identity.GetUserId <int>(); int empID = 0; empID = (int)PaymentDAL.GetDataById(UserId).EmployeeID; Payment item = new Payment() { CustomerID = model.CustomerID, EmployeeID = empID, GrandTotal = model.GrandTotal, CreatedBy = UserId, CreatedOn = DateTime.Now, ModifiedBy = UserId, ModifiedOn = DateTime.Now, }; context.TPayment.Add(item); context.SaveChanges(); int i = 0; foreach (var detail in model.VariantID) { PaymentDetail vDetail = new PaymentDetail() { HeaderID = item.ID, VariantID = detail, Quantity = model.Quantity[i], UnitPrice = model.UnitPrice[i], SubTotal = model.SubTotal[i], CreatedBy = UserId, CreatedOn = DateTime.Now, ModifiedBy = UserId, ModifiedOn = DateTime.Now, }; context.TPaymentDetail.Add(vDetail); ItemsIventory item2 = context.TItemsIventory.Where(m => m.VariantID == detail).FirstOrDefault(); item2.Sales = model.Quantity[i]; i++; } context.SaveChanges(); try { dbTransaction.Commit(); return(RedirectToAction("Add")); } catch (Exception) { dbTransaction.Rollback(); throw; } } } } return(View()); }
internal static void UpdateDetail(PaymentDetailViewModel model) { DeleteDetatil(model.Uid); AddDetail(model); }
internal static void AddDetail(PaymentDetailViewModel detailLine) { detailLine.Uid = Guid.NewGuid(); Detail.Add(detailLine); }