public void Update(ReceiptViewModel model) { var entity = mapper.Map(model, new Receipt()); receiptRepository.Update(entity); receiptRepository.SaveChanges(); }
public ActionResult Receipt(int id) { if (Session["token"] == null || string.IsNullOrWhiteSpace(Session["token"].ToString())) { ViewBag.Message = "Please Login"; return(View()); } var client = new RestClient("http://localhost:19625/api/rental/GetRental"); var request = new RestRequest(Method.POST); request.AddHeader("content-type", "application/json"); request.AddHeader("authorization", "bearer " + Session["token"].ToString()); request.AddParameter("application/json", "{\n\"RentalId\":" + id + "\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); var rentalModel = JsonConvert.DeserializeObject <Rental>(response.Content); var rentalIndexViewModel = new ReceiptViewModel { Rental = rentalModel }; return(View(rentalIndexViewModel)); }
// // GET: /Receipt/Edit/5 public ActionResult Edit(int id) { Receipt receipt = ctx.Receipts.Where(x => x.IdReceipt == id).First(); string currUserId = User.Identity.GetUserId(); //redirects user to the 403 page if he is trying to change data that is not his own if (receipt.ApplicationUserId != currUserId) { throw new HttpException(403, "Forbidden"); } ReceiptViewModel receiptView = new ReceiptViewModel() { Id = receipt.IdReceipt, JournalEntryNum = receipt.JournalEntryNum, Date = receipt.DateReceipt.ToShortDateString(), AmountCash = receipt.AmountCash.ToString(), AmountNonCashBenefit = receipt.AmountNonCashBenefit.ToString(), AmountTransferAccount = receipt.AmountTransferAccount.ToString(), ValueAddedTax = receipt.ValueAddedTax.ToString(), Totaled = receipt.Totaled }; return(View(receiptView)); }
public async Task <IActionResult> PutReceipt(string id, ReceiptViewModel receipt) { if (string.Compare(receipt.Id, id) != 0) { throw new Exception(string.Format("Id và Id của phiếu thu không giống nhau!")); } try { await Task.Run(() => { receipt.DateModified = DateTime.Now; _receiptService.UpdateStatusReceiptAnđetail(receipt); _receiptService.SaveChanges(); return(Ok()); }); } catch (DbUpdateConcurrencyException) { if (!ReceiptExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
/// <summary> /// Loads the receipt information on the page /// </summary> /// <param name="receiptID"></param> public void loadReceipt(int receiptID) { receipt = ReceiptViewModel.getReceipt(receiptID); if (receipt != null) { // Customer details textBox_Customer.Text = receipt.customer.CustomerName; textBox_Contact_Details.Text = receipt.customer.PhoneNumber.ToString(); textBox_Email_Address.Text = receipt.customer.Email; textBox_Address.Text = receipt.customer.Address + ", " + receipt.customer.City + ", " + receipt.customer.Country; // Receipt details txtBox_receiptNumber.Text = receipt.idReceipt.ToString(); txtBox_receiptNumber.IsReadOnly = true; txtBox_receiptDate.Text = receipt.createdDate.ToString("d"); txtBox_issuedBy.Text = receipt.issuedBy; TotalAmount_TextBlock.Text = receipt.totalAmount.ToString("C"); // Receipt payments receiptPaymentsGrid.ItemsSource = receipt.payments; } else { MessageBox.Show("Receipt with ID = " + receiptID + ", does not exist"); } }
public ActionResult Receipt() { var cart = _context.Carts.ToList(); var menuItems = new List <MenuItem>(); double price = 0; foreach (var el in cart) { var item = _context.MenuItems.SingleOrDefault(x => x.Id == el.MenuItemId); menuItems.Add(item); price += item.Price; } string pricestring = String.Format("{0:C}", price); var viewModel = new ReceiptViewModel() { Cart = menuItems, Total = price, TotalString = pricestring }; return(View("Receipt", viewModel)); }
public ActionResult Index(int orderNumber) { var customer = HttpContext.GetCustomer(); var order = new Order(orderNumber, customer.LocaleSetting); // Does the order exist? if (order.IsEmpty) { return(RedirectToAction(ActionNames.Detail, ControllerNames.Topic, new { @name = "ordernotfound" })); } // If currently logged in user is not the one who owns the order, and this is not an admin user who is logged in, reject the view if (customer.CustomerID != order.CustomerID && !customer.IsAdminUser) { return(RedirectToAction(ActionNames.Detail, ControllerNames.Topic, new { @name = "ordernotfound" })); } // Determine if customer is allowed to view orders from other store. if (!customer.IsAdminUser && AppLogic.StoreID() != AppLogic.GetOrdersStoreID(orderNumber) && AppLogic.GlobalConfigBool("AllowCustomerFiltering")) { return(RedirectToAction(ActionNames.Detail, ControllerNames.Topic, new { @name = "ordernotfound" })); } var model = new ReceiptViewModel(body: order.Receipt(customer, false)); return(View(model)); }
public ActionResult Detail(int?Id, string TransactionCode) { var receipt = new vwReceipt(); if (Id != null && Id.Value > 0) { receipt = ReceiptRepository.GetvwReceiptById(Id.Value); } if (!string.IsNullOrEmpty(TransactionCode)) { receipt = ReceiptRepository.GetvwReceiptByCode(TransactionCode); } if (receipt != null) { var model = new ReceiptViewModel(); AutoMapper.Mapper.Map(receipt, model); model.ModifiedUserName = userRepository.GetUserById(model.ModifiedUserId.Value).FullName; ViewBag.SuccessMessage = TempData["SuccessMessage"]; ViewBag.FailedMessage = TempData["FailedMessage"]; ViewBag.AlertMessage = TempData["AlertMessage"]; ViewBag.ReceiptDetail = ReceiptDetailRepository.GetAllReceiptDetailByReceiptId(model.Id).ToList(); return(View(model)); } return(RedirectToAction("Index")); }
public ActionResult Edit(string id) { ReceiptViewModel model = ReceiptHelper.GetReceipt(id); if (model.CustomerSites == null) { model.CustomerSites = CustomerHelper.GetCustomerSites(model.CustomerId).Select(a => new SelectListItem { Text = a.SiteName.ToString(), Value = a.Id.ToString() }).ToList(); } if (model.Banks == null) { model.Banks = BankHelper.GetBankList(model.SOBId); } if (model.BankAccounts == null) { model.BankAccounts = BankHelper.GetBankAccountList(model.BankId); } SessionHelper.Calendar = CalendarHelper.GetCalendar(model.PeriodId.ToString()); SessionHelper.PrecisionLimit = CurrencyHelper.GetCurrency(model.CurrencyId.ToString()).Precision; return(View("Create", model)); }
private void TrackAfterPayment(ReceiptViewModel model) { // Track Analytics GoogleAnalyticsTracking tracking = new GoogleAnalyticsTracking(ControllerContext.HttpContext); // Add the products int i = 1; foreach (OrderLineViewModel orderLine in model.Order.OrderLines) { if (string.IsNullOrEmpty(orderLine.Code) == false) { tracking.ProductAdd(code: orderLine.Code, name: orderLine.Name, quantity: orderLine.Quantity, price: (double)orderLine.Price, position: i ); i++; } } // And the transaction itself tracking.Purchase(model.Order.OrderNumber, null, (double)model.Order.TotalAmount, (double)model.Order.Tax, (double)model.Order.Shipping); }
public ActionResult Edit(ReceiptViewModel model) { if (ModelState.IsValid) { if (Request["Submit"] == "Save") { var Receipt = ReceiptRepository.GetReceiptById(model.Id); AutoMapper.Mapper.Map(model, Receipt); Receipt.ModifiedUserId = WebSecurity.CurrentUserId; Receipt.ModifiedDate = DateTime.Now; ReceiptRepository.UpdateReceipt(Receipt); var receiptDetail = ReceiptDetailRepository.GetReceiptDetailByReceiptId(model.Id); receiptDetail.ModifiedUserId = WebSecurity.CurrentUserId; receiptDetail.ModifiedDate = DateTime.Now; receiptDetail.Name = model.Name; receiptDetail.Amount = model.Amount; ReceiptDetailRepository.UpdateReceiptDetail(receiptDetail); TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.UpdateSuccess; return(RedirectToAction("Index")); } return(View(model)); } return(View(model)); //if (Request.UrlReferrer != null) // return Redirect(Request.UrlReferrer.AbsoluteUri); //return RedirectToAction("Index"); }
/// <summary> /// Loads the statement items on the grid based on the filters given /// </summary> /// <returns></returns> private bool loadStatementItems() { var customerID = ((Customer)comboBox_customer.SelectedItem).idCustomer; var from = fromDate.SelectedDate.Value.Date; from += new TimeSpan(0, 0, 0); // start from 00:00:00 of from date var to = toDate.SelectedDate.Value.Date; to += new TimeSpan(23, 59, 59); // end on 23:59:59 of to date var statement = new List <StatementItem>(); statement.AddRange(InvoiceViewModel.getInvoicesForStatement(customerID, from, to)); statement.AddRange(CreditNoteViewModel.getCreditNotesForStatement(customerID, from, to)); statement.AddRange(ReceiptViewModel.getReceiptsForStatement(customerID, from, to)); if (statement.Count > 0) { statementDataGrid.ItemsSource = statement; var firstCol = statementDataGrid.Columns.First(); firstCol.SortDirection = ListSortDirection.Ascending; statementDataGrid.Items.SortDescriptions.Add(new SortDescription(firstCol.SortMemberPath, ListSortDirection.Ascending)); return(true); } return(false); }
// GET: Vehicles/Receipt public async Task <IActionResult> Receipt(int id) { var local_vehicle = await _context.Vehicles.FindAsync(id); var endTime = DateTime.UtcNow; var startTime = local_vehicle.TimeOfParking; var totalTime = (endTime - startTime); string formattedTime = $"{totalTime.Days} days and {totalTime.Hours} hours and {totalTime.Minutes} minutes"; var calculatedPrice = (int)((totalTime.TotalMinutes / 60) * 100); var price = $"{calculatedPrice} KR"; var local_model = new ReceiptViewModel { RegNr = local_vehicle.RegNr, TimeOfParking = local_vehicle.TimeOfParking, TimeOfUnParking = endTime, TotalTime = formattedTime, Price = price }; return(View(local_model)); }
public void QrPaymentComplete() { PaymentCommand payment = new PaymentCommand() { TotalDiscount = TotalDiscount, ItemList = CurrentTicket.ToList(), ShiftId = App.OpenShiftId, StoreEmail = App.Email, Total = TotalPrice }; payment.PaymentType = Api.ViewModels.Enixer_Enumerations.EP_PaymentTypeEnum.Qr; ReceiptViewModel resultW = _service.AddPayment(payment); if (resultW != null) { PopupNavigation.PushAsync(new Error(new ErrorViewModel("Payment Completed", 3))); Application.Current.MainPage.Navigation.PushAsync(new ReceiptPage(this)); } else { Application.Current.MainPage.DisplayAlert("Payment Error", "Payment not completed please try again.", "Ok"); } PopupNavigation.PopAllAsync(); }
//Зберігає public override bool UpdateReceipt(ReceiptViewModel pReceipt) { bool Res = false; try { if (pReceipt != null && pReceipt.ReceiptEvents != null) { var RE = pReceipt.ReceiptEvents.Select(r => GetReceiptEvent(r)); if (RE != null) { Bl.SaveReceiptEvents(RE); } if (pReceipt.ReceiptItems != null) { var WR = pReceipt.ReceiptItems.Where(r => r.Excises != null && r.Excises.Count() > 0).Select(r => GetReceiptWaresFromReceiptItem(new IdReceipt(pReceipt.Id), r)); if (WR != null && WR.Count() > 0) { Res = Bl.UpdateExciseStamp(WR); } } } FileLogger.WriteLogMessage($"ApiPSU.UpdateReceipt =>(pTerminalId=>{pReceipt?.ToJSON()}) => ({Res})", eTypeLog.Full); } catch (Exception e) { FileLogger.WriteLogMessage($"ApiPSU.UpdateReceipt Exception =>(pTerminalId=>{pReceipt?.ToJSON()}) => ({Res}){Environment.NewLine}Message=>{e.Message}{Environment.NewLine}StackTrace=>{e.StackTrace}", eTypeLog.Error); throw new Exception("ApiPSU.UpdateReceipt", e); } return(Res); }
public void TrackAfterPayment(ReceiptViewModel model) { // Track Analytics var tracking = new GoogleAnalyticsTracking(_contextProvider.GetContext()); // Add the products int i = 1; foreach (var orderLine in model.Order.OrderLines) { if (string.IsNullOrEmpty(orderLine.Code) == false) { tracking.ProductAdd(code: orderLine.Code, name: orderLine.Name, quantity: orderLine.Quantity, price: (double)orderLine.Price, position: i ); i++; } } // And the transaction itself tracking.Purchase(model.Order.OrderNumber, null, (double)model.Order.TotalAmount, (double)model.Order.Tax, (double)model.Order.Shipping); }
/// <summary> /// Opens the delete dialog prompting the user to confirm deletion or cancel /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Btn_delete_Click(object sender, RoutedEventArgs e) { int.TryParse(txtBox_receiptNumber.Text, out var receiptID); if (txtBox_receiptNumber.IsReadOnly) { var msgtext = "You are about to delete the receipt with ID = " + receiptID + ". Are you sure?"; var txt = "Delete Receipt"; var button = MessageBoxButton.YesNo; var result = MessageBox.Show(msgtext, txt, button); switch (result) { case MessageBoxResult.Yes: ReceiptViewModel.deleteReceipt(receiptID); Btn_clearView_Click(null, null); MessageBox.Show("Deleted Receipt with ID = " + receiptID); break; case MessageBoxResult.No: break; } } else { MessageBox.Show("No receipt is loaded"); } }
/// <summary> /// Loads the receipt information on the page /// </summary> /// <param name="receiptID"></param> public void loadReceipt(int receiptID) { old_receipt = ReceiptViewModel.getReceipt(receiptID); if (old_receipt != null) { // Customer details textBox_Customer.Text = old_receipt.customer.CustomerName; textBox_Contact_Details.Text = old_receipt.customer.PhoneNumber.ToString(); textBox_Email_Address.Text = old_receipt.customer.Email; textBox_Address.Text = old_receipt.customer.Address + ", " + old_receipt.customer.City + ", " + old_receipt.customer.Country; // Receipt details textBox_ReceiptNumber.Text = old_receipt.idReceipt.ToString(); txtbox_ReceiptDate.Text = old_receipt.createdDate.ToString("d"); issuedBy.Text = old_receipt.issuedBy; TotalAmount_TextBlock.Text = old_receipt.totalAmount.ToString("C"); // Receipt payments foreach (var p in old_receipt.payments) { ReceiptDataGrid.Items.Add(p); } } else { MessageBox.Show("Receipt with ID = " + receiptID + ", does not exist"); } }
public ReceiptViewModel GetDetails(string receiptId, string username) { Receipt receipt = context.Receipts.Where(x => x.Recipient.UserName == username && x.Id == receiptId).Include(x => x.Recipient).Include(x => x.Package).SingleOrDefault(); if (receipt == null) { return(null); } var receiptViewModel = new ReceiptViewModel() { Id = receipt.Id, Fee = receipt.Fee, IssuedOn = receipt.IssuedOn.ToString("dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture), Recipient = receipt.Recipient.UserName, Package = new Models.Package.PackageViewModel { Description = receipt.Package.Description, ShippingAddress = receipt.Package.ShippingAddress, Weight = receipt.Package.Weight } }; return(receiptViewModel); }
/// <summary> /// Displays receipt list to admin /// </summary> /// <param name="page"></param> /// <returns></returns> public ActionResult ReceiptsList(string search, int?page) { try { int pageSize = 10; int pageNumber = (page ?? 1); Session["Search"] = search; Session["page"] = pageNumber; ReceiptViewModel model = new ReceiptViewModel(); if (!string.IsNullOrEmpty(search)) { //search receipt by receipt no model.ReceiptsList = db.GetAllReceiptsListToAdmin().Where(r => r.ReceiptNo.ToLower().Contains(search.ToLower())).OrderBy(r => r.BillingDate).ToList().ToPagedList(pageNumber, pageSize); } else { model.ReceiptsList = db.GetAllReceiptsListToAdmin().OrderBy(r => r.BillingDate).ToList().ToPagedList(pageNumber, pageSize); } model.listcount = (pageNumber - 1) * 10; return(View(model)); } catch (Exception ex) { GlobalVariable.objWriteLog.PrintMessage(Server.MapPath("~/ErrorLog/"), ex.Message); throw ex; } }
/// <summary> /// After validating creates the receipt and switches to viewing it /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Btn_Complete_Click(object sender, RoutedEventArgs e) { var ALL_VALUES_OK = true; if (!Check_CustomerForm()) { ALL_VALUES_OK = false; } if (!Check_DetailsForm()) { ALL_VALUES_OK = false; } if (!Has_Items_Selected()) { ALL_VALUES_OK = false; } if (ALL_VALUES_OK) { var rec = createReceiptObject(); rec.createdDate += DateTime.Now.TimeOfDay; ReceiptViewModel.insertReceipt(rec); MessageBox.Show("Receipt with ID " + rec.idReceipt + " was created."); receiptMain.viewReceipt(rec.idReceipt); Btn_clearAll_Click(null, null); } }
async void Payment() { if (Cash < TotalPrice) { Application.Current.MainPage.DisplayAlert("Invalid Cash Amount", "Invalid cash amount, Please try again", "Ok"); return; } Change = Cash - TotalPrice; PaymentCommand payment = new PaymentCommand() { TotalDiscount = TotalDiscount, ItemList = CurrentTicket.ToList(), PaymentType = Api.ViewModels.Enixer_Enumerations.EP_PaymentTypeEnum.Cash, ShiftId = App.OpenShiftId, StoreEmail = App.Email, Total = TotalPrice }; payment.PaymentType = Api.ViewModels.Enixer_Enumerations.EP_PaymentTypeEnum.Cash; ReceiptViewModel resultW = _service.AddPayment(payment); if (resultW != null) { await PopupNavigation.Instance.PushAsync(new ShowChange(this)); await Application.Current.MainPage.Navigation.PushAsync(new ReceiptPage(this)); } else { Application.Current.MainPage.DisplayAlert("Payment Error", "Payment not completed please try again.", "Ok"); } }
public ReceiptPage(ChargeViewModel vm) { _vm = vm; InitializeComponent(); Receipt = vm.Receipt; CreateReceipt(); BindingContext = vm; }
public ViewResult Index() { var defaultReceipt = new ReceiptViewModel(); defaultReceipt.DatePayed = DateTime.Now.Date; defaultReceipt.NumTransactions = _receiptRepository.GetCountTransactionsWaiting(); return(View(defaultReceipt)); }
public ReceiptViewModel BuildFor(DibsPaymentProcessingResult processingResult) { var receiptPage = _contentRepository.Get<ReceiptPage>(_siteConfiguration.GetSettings().ReceiptPage); var model = new ReceiptViewModel(receiptPage); model.CheckoutMessage = processingResult.Message; model.Order = new OrderViewModel(_currentMarket.GetCurrentMarket().DefaultCurrency.Format, processingResult.Order); return model; }
public ActionResult Index() { var receiptPage = _contentRepository.Get <ReceiptPage>(_siteConfiguration.GetSettings().ReceiptPage); var cartHelper = new CartHelper(Cart.DefaultName); if (cartHelper.IsEmpty && !PageEditing.PageIsInEditMode) { return(View("Error/_EmptyCartError")); } string message = ""; OrderViewModel orderViewModel = null; if (cartHelper.Cart.OrderForms.Count > 0) { var orderNumber = cartHelper.Cart.GeneratePredictableOrderNumber(); _log.Debug("Order placed - order number: " + orderNumber); cartHelper.Cart.OrderNumberMethod = CartExtensions.GeneratePredictableOrderNumber; System.Diagnostics.Trace.WriteLine("Running Workflow: " + OrderGroupWorkflowManager.CartCheckOutWorkflowName); var results = OrderGroupWorkflowManager.RunWorkflow(cartHelper.Cart, OrderGroupWorkflowManager.CartCheckOutWorkflowName); message = string.Join(", ", OrderGroupWorkflowManager.GetWarningsFromWorkflowResult(results)); if (message.Length == 0) { cartHelper.Cart.SaveAsPurchaseOrder(); cartHelper.Cart.Delete(); cartHelper.Cart.AcceptChanges(); } System.Diagnostics.Trace.WriteLine("Loading Order: " + orderNumber); var order = _orderService.GetOrderByTrackingNumber(orderNumber); // Must be run after order is complete, // This might release the order for shipment and // send the order receipt by email System.Diagnostics.Trace.WriteLine(string.Format("Process Completed Payment: {0} (User: {1})", orderNumber, User.Identity.Name)); _paymentCompleteHandler.ProcessCompletedPayment(order, User.Identity); orderViewModel = new OrderViewModel(_currentMarket.GetCurrentMarket().DefaultCurrency.Format, order); } ReceiptViewModel model = new ReceiptViewModel(receiptPage); model.CheckoutMessage = message; model.Order = orderViewModel; // Track successfull order in Google Analytics TrackAfterPayment(model); _metricsLoggingService.Count("Purchase", "Purchase Success"); _metricsLoggingService.Count("Payment", "Generic"); return(View("ReceiptPage", model)); }
public ModelMID.Receipt ReceiptViewModelToReceipt(Guid pTerminalId, ReceiptViewModel pReceiptRVM) { if (pReceiptRVM == null) { return(null); } RefundReceiptViewModel RefundRVM = null; if (pReceiptRVM is RefundReceiptViewModel) { RefundRVM = (RefundReceiptViewModel)pReceiptRVM; } var receipt = new ModelMID.Receipt(RefundRVM == null ? new IdReceipt(pReceiptRVM.Id) : Bl.GetNewIdReceipt(Global.GetIdWorkplaceByTerminalId(pTerminalId))) { //ReceiptId = pReceiptRVM.Id, StateReceipt = (string.IsNullOrEmpty(pReceiptRVM.FiscalNumber) ? (pReceiptRVM.PaymentInfo != null ? eStateReceipt.Pay : eStateReceipt.Prepare) : eStateReceipt.Print), TypeReceipt = (RefundRVM == null ? eTypeReceipt.Sale : eTypeReceipt.Refund), NumberReceipt = pReceiptRVM.FiscalNumber, /* Status = (pReceiptRVM.SumCash > 0 || pReceiptRVM.SumCreditCard > 0 * ? ReceiptStatusType.Paid * : ReceiptStatusType.Created), //!!!TMP Треба врахувати повернення*/ TerminalId = pReceiptRVM.TerminalId, SumReceipt = pReceiptRVM.Amount, //!!!TMP Сума чека. SumDiscount = pReceiptRVM.Discount, //!!TMP TotalAmount = pReceiptRVM.SumReceipt - pReceiptRVM.SumBonus, ///CustomerId = new Client(pReceiptRVM.CodeClient).ClientId, DateCreate = pReceiptRVM.CreatedAt, DateReceipt = (pReceiptRVM.UpdatedAt == default(DateTime) ? DateTime.Now : pReceiptRVM.UpdatedAt) //ReceiptItems= //Customer /// !!!TMP Модель клієнта //PaymentInfo }; if (RefundRVM != null) { receipt.RefundId = (RefundRVM.IdPrimary == null ? null : new IdReceipt(RefundRVM.IdPrimary)); } if (pReceiptRVM.PaymentInfo != null) { receipt.Payment = new Payment[] { ReceiptPaymentToPayment(receipt, pReceiptRVM.PaymentInfo) } } ; if (pReceiptRVM.ReceiptItems != null) { receipt.Wares = pReceiptRVM.ReceiptItems.Select(r => GetReceiptWaresFromReceiptItem(receipt, r)); } //if(pReceiptRVM.ReceiptEvents!=null) // receipt.ReceiptEvent= pReceiptRVM.ReceiptEvent return(receipt); }
public ReceiptViewModel BuildFor(DibsPaymentProcessingResult processingResult) { var receiptPage = _contentRepository.Get <ReceiptPage>(_siteConfiguration.GetSettings().ReceiptPage); var model = new ReceiptViewModel(receiptPage); model.CheckoutMessage = processingResult.Message; model.Order = new OrderViewModel(_currentMarket.GetCurrentMarket().DefaultCurrency.Format, processingResult.Order); return(model); }
public IActionResult Create(ReceiptViewModel receipt) { if (ModelState.IsValid) { _receiptService.Create(receipt); return(RedirectToAction("Index")); } return(View(receipt)); }
public ReceiptViewModel GetReceiptViewModel(IdReceipt pReceipt, bool pIsDetail = false) { if (pReceipt == null) { return(null); } var receiptMID = Bl.GetReceiptHead(pReceipt, true); if (receiptMID == null) { return(null); } var receipt = new Receipt() { Id = receiptMID.ReceiptId, FiscalNumber = receiptMID.NumberReceipt, Status = (receiptMID.SumCash > 0 || receiptMID.SumCreditCard > 0 ? ReceiptStatusType.Paid : ReceiptStatusType.Created), //!!!TMP Треба врахувати повернення TerminalId = receiptMID.TerminalId, Amount = receiptMID.SumReceipt, //!!!TMP Сума чека. Discount = receiptMID.SumDiscount, TotalAmount = receiptMID.SumReceipt - receiptMID.SumBonus - receiptMID.SumDiscount, CustomerId = new Client(receiptMID.CodeClient).ClientId, CreatedAt = receiptMID.DateCreate, UpdatedAt = receiptMID.DateReceipt, //ReceiptItems= //Customer /// !!!TMP Модель клієнта //PaymentInfo }; var listReceiptItem = GetReceiptItem(receiptMID.Wares, pIsDetail); //GetReceiptItem(pReceipt); var Res = new ReceiptViewModel(receipt, listReceiptItem, null, null) { CustomId = receiptMID.NumberReceipt1C }; if (receiptMID.Payment != null && receiptMID.Payment.Count() > 0) { Res.PaidAmount = receiptMID.Payment.Sum(r => receipt.Amount); var SumCash = receiptMID.Payment.Where(r => r.TypePay == eTypePay.Cash).Sum(r => receipt.Amount); var SumCard = receiptMID.Payment.Where(r => r.TypePay == eTypePay.Card).Sum(r => receipt.Amount); Res.PaymentType = (SumCash > 0 && SumCard > 0 ? PaymentType.Card | PaymentType.Card : (SumCash == 0 && SumCard == 0 ? PaymentType.None : (SumCash > 0 ? PaymentType.Cash : PaymentType.Card))); Res.PaymentInfo = PaymentToReceiptPayment(receiptMID.Payment.First()); } if (receiptMID.ReceiptEvent != null && receiptMID.ReceiptEvent.Count() > 0) { Res.ReceiptEvents = receiptMID.ReceiptEvent.Select(r => GetReceiptEvent(r)).ToList(); } if (pIsDetail) { Bl.GenQRAsync(receiptMID.Wares); } return(Res); }
// GET: Receipt/Create public ActionResult Create() { var receipt = new ReceiptViewModel(); receipt.ProviderList = new SelectList(db.Providers, "ID", "Name"); receipt.UserList = new SelectList(db.Users, "Username", "FullName"); receipt.Devices = new List <DeviceViewModel>(); return(View(receipt)); }
// GET: Receipts/Create public async Task <IActionResult> Create() { var viewModel = new ReceiptViewModel { AppUsers = new SelectList(await _uow.BaseRepository <AppUser>().AllAsync(), nameof(AppUser.Id), nameof(AppUser.UserNickname)) }; return(View(viewModel)); }
public override void SetUp() { base.SetUp(); _paymentResponse = Fixture.Create<DibsPaymentResult>(); _processingResult = new DibsPaymentProcessingResult(Fixture.Create<PurchaseOrderModel>(), Fixture.Create<string>()); _dibsPaymentProcessorMock.Setup(x => x.ProcessPaymentResult(_paymentResponse, It.IsAny<IIdentity>())) .Returns(_processingResult); _expectedModel = CreateReceiptViewModel(); _receiptViewModelBuilderMock.Setup(b => b.BuildFor(_processingResult)).Returns(_expectedModel); }