public ActionResult UpdateInvoice(int invoiceId, int locationId) { var invoices = InvoiceProcessor.LoadInvoices(); var invoicesDetails = InvoiceProcessor.LoadInvoiceDetails(); bool invoiceFound = invoices.Any(invoice => invoice.InvoiceId == invoiceId && invoice.LocationId == locationId); if (!invoiceFound) { return(HttpNotFound()); } var invoiceData = invoices.SingleOrDefault(invoice => invoice.InvoiceId == invoiceId && invoice.LocationId == locationId); var invoiceDetailsData = invoicesDetails.SingleOrDefault(invoiceDetails => invoiceDetails.InvoiceId == invoiceId && invoiceDetails.LocationId == locationId); InvoiceModel invoiceToUpdate = new InvoiceModel { InvoiceId = invoiceId, LocationId = locationId, InvoiceNumber = invoiceData.InvoiceNumber, Date = invoiceData.Date, ClientName = invoiceData.ClientName, InvoiceDetailsId = invoiceDetailsData.InvoiceDetailsId, ProductName = invoiceDetailsData.ProductName, Price = invoiceDetailsData.Price, Quantity = invoiceDetailsData.Quantity }; return(View(invoiceToUpdate)); }
private async void Submit_add_invoice_Click(object sender, RoutedEventArgs e) { InvoiceModel tempInvoice = new InvoiceModel(invoice.Text, Convert.ToDouble(netAmount.Text), Convert.ToDouble(grossAmount.Text), Convert.ToDouble(percent.Text), (companyId.SelectedItem as Models.ComboBoxItem).Value.ToString(), (employeeId.SelectedItem as Models.ComboBoxItem).Value.ToString(), dateOfReturn.SelectedDate); await InvoiceProcessor.UploadInvoice(tempInvoice); this.Content = null; }
public ActionResult DeleteInvoice(InvoiceModel model) { InvoiceProcessor.DeleteInvoice(model.InvoiceId, model.LocationId); //InvoiceProcessor.DeleteInvoiceDetails(model.InvoiceDetailsId, model.LocationId); return(RedirectToAction("ViewInvoices")); }
public ActionResult CreateInvoice(InvoiceModel model) { if (ModelState.IsValid) { bool invoiceFound = InvoiceProcessor.LoadInvoices().Any(invoice => invoice.InvoiceId == model.InvoiceId && invoice.LocationId == model.LocationId); if (invoiceFound) { return(View()); } InvoiceProcessor.CreateInvoice( model.InvoiceId, model.LocationId, model.InvoiceNumber, model.Date, model.ClientName ); InvoiceProcessor.CreateInvoiceDetail( model.InvoiceDetailsId, model.InvoiceId, model.LocationId, model.ProductName, model.Quantity, model.Price, model.Value ); return(RedirectToAction("ViewInvoices")); } return(View()); }
public void demat_test_all_first_run() { var processor = new InvoiceProcessor(250, "C:\\test"); processor.ZeroExportNumbers(); processor.ProcessAll(); }
private async Task LoadFromServerToGrid() { await CompanyProcessor.LoadCompanies(); await RepresentativeProcessor.LoadRepresentatives(); await InvoiceProcessor.LoadInvoices(); }
/// <summary> /// Checks the invoice status. /// </summary> /// <param name="request">The request.</param> /// <returns></returns> public PayFortCheckInvoiceRequestModel CheckInvoiceStatus(PayFortCheckInvoiceRequestModel request) { //Declarations //1. Generate SHA256 Signature request.Signature = request.GenerateCheckInvoiceStatusSHA256Signature(); //2. Generate Json Request Parameter var jsonRequest = request.GenerateCheckInvoiceStatusRequestParams(); //3. Send Request return(InvoiceProcessor.CheckStatus(jsonRequest, request)); }
static void Main(string[] args) { IDiscountStrategy strategy; // Wybór strategii if (user.IsPremium) { strategy = new PremiumDiscountStrategy(); } else { strategy = new StandardDiscountStrategy(); } var invoiceProcessor = new InvoiceProcessor(strategy); }
public ActionResult ViewInvoices() { ViewBag.Message = "Invoices"; var data = InvoiceProcessor.LoadInvoices(); List <InvoiceModel> invoices = new List <InvoiceModel>(); foreach (var row in data) { invoices.Add(new InvoiceModel { InvoiceId = row.InvoiceId, LocationId = row.LocationId, InvoiceNumber = row.InvoiceNumber, ClientName = row.ClientName, Date = row.Date }); } return(View(invoices)); }
/// <summary> /// Generates the invoice. /// </summary> /// <param name="request">The request.</param> /// <returns></returns> public PaymentResponse GenerateInvoice(PayfortInvoiceRequestModel request) { //Declarations var errInfo = new PaymentResponse(); errInfo.BookingRefNumber = request.BookingReference; request.RequestExpiryDate = DateTimeOffset.UtcNow.AddDays(24); errInfo.RequestExpiryDate = request.RequestExpiryDate; if (request != null) { //1. Generate SHA256 Signature request.Signature = request.GenerateInvoiceSHA256Signature(); //2. Generate Json Request Parameter var jsonRequest = request.GetInvoiceRequestParams(); //3. Send Request return(InvoiceProcessor.Invoice(jsonRequest, request.Url, errInfo)); } else { return(ExceptionHandler.ExceptionHandler.GetPayfortExceptionResponseInfo(errInfo, PaymentCommandType.AUTHORIZATION)); } }
private async void btnEmail_Click(object sender, RoutedEventArgs e) { await InvoiceProcessor.EmailInvoice(invoiceUser.UserID, invoiceOrder.OrderStatus, invoiceOrder.OrderTotal, currentInvoice.PaymentTotal, invoiceOrder.OrderDateComplete, currentInvoice.Notes, currentInvoice.OrderID, invoiceOrder.ServiceName, currentUser.Token); }
private async void BtnAppend_Click(object sender, RoutedEventArgs e) { // Date to use for string format try { // Validating Date & Report is Picked -- LR if (cmbReports.SelectedIndex == -1) { MessageBox.Show("Please select a report"); return; } // If In-Progress Orders is checked -- Lr if (cmbReports.SelectedIndex == 0) { if (dateStart.SelectedDate == null || dateEnd.SelectedDate == null) { MessageBox.Show("Please select a start and end date"); return; } startDate = (DateTime)dateStart.SelectedDate; endDate = (DateTime)dateEnd.SelectedDate; selectedOrders = await OrderProcessor.ShowAllProgressOrders(currentUser.Privileges, currentUser.Token); if (selectedUser == null && selectedEmployee == null) { lstReports.Items.Add("\t\t\t\t\tIn Progress Orders from " + startDate.ToString("MM/dd/yyyy") + " to " + endDate.ToString("MM/dd/yyyy")); } else if (selectedUser != null && selectedEmployee == null) { lstReports.Items.Add("\t\t\t\t\tIn Progress Orders for " + selectedUser.Firstname + " " + selectedUser.Lastname + " from " + startDate.ToString("MM/dd/yyyy") + " to " + endDate.ToString("MM/dd/yyyy")); } else if (selectedUser != null && selectedEmployee != null) { lstReports.Items.Add("\t\t\t\t\tIn Progress Orders for " + selectedUser.Firstname + " " + selectedUser.Lastname + " with " + selectedEmployee.Firstname + " " + selectedEmployee.Lastname + " from " + startDate.ToString("MM/dd/yyyy") + " to " + endDate.ToString("MM/dd/yyyy")); } FillListBox(); } // If Completed Orders is checked -- Lr if (cmbReports.SelectedIndex == 1) { if (dateStart.SelectedDate == null || dateEnd.SelectedDate == null) { MessageBox.Show("Please select a start and end date"); return; } startDate = (DateTime)dateStart.SelectedDate; endDate = (DateTime)dateEnd.SelectedDate; selectedOrders = await OrderProcessor.ShowAllCompleteOrders(currentUser.Privileges, currentUser.Token); if (selectedUser == null && selectedEmployee == null) { lstReports.Items.Add("\t\t\t\t\tCompleted Orders from " + startDate.ToString("MM/dd/yyyy") + " to " + endDate.ToString("MM/dd/yyyy")); } else if (selectedUser != null && selectedEmployee == null) { lstReports.Items.Add("\t\t\t\t\tCompleted Orders for " + selectedUser.Firstname + " " + selectedUser.Lastname + " from " + startDate.ToString("MM/dd/yyyy") + " to " + endDate.ToString("MM/dd/yyyy")); } else if (selectedUser != null && selectedEmployee != null) { lstReports.Items.Add("\t\t\t\t\tCompleted Orders for " + selectedUser.Firstname + " " + selectedUser.Lastname + " with " + selectedEmployee.Firstname + " " + selectedEmployee.Lastname + " from " + startDate.ToString("MM/dd/yyyy") + " to " + endDate.ToString("MM/dd/yyyy")); } FillListBox(); } // If Cancelled Orders is checked -- Lr if (cmbReports.SelectedIndex == 2) { if (dateStart.SelectedDate == null || dateEnd.SelectedDate == null) { MessageBox.Show("Please select a start and end date"); return; } startDate = (DateTime)dateStart.SelectedDate; endDate = (DateTime)dateEnd.SelectedDate; selectedOrders = await OrderProcessor.ShowAllCancelledOrders(currentUser.Privileges, currentUser.Token); if (selectedUser == null && selectedEmployee == null) { lstReports.Items.Add("\t\t\t\t\tCancelled Orders from " + startDate.ToString("MM/dd/yyyy") + " to " + endDate.ToString("MM/dd/yyyy")); } else if (selectedUser != null && selectedEmployee == null) { lstReports.Items.Add("\t\t\t\t\tCancelled Orders for " + selectedUser.Firstname + " " + selectedUser.Lastname + " from " + startDate.ToString("MM/dd/yyyy") + " to " + endDate.ToString("MM/dd/yyyy")); } else if (selectedUser != null && selectedEmployee != null) { lstReports.Items.Add("\t\t\t\t\tCancelled Orders for " + selectedUser.Firstname + " " + selectedUser.Lastname + " with " + selectedEmployee.Firstname + " " + selectedEmployee.Lastname + " from " + startDate.ToString("MM/dd/yyyy") + " to " + endDate.ToString("MM/dd/yyyy")); } FillListBox(); } // If Customer's Orders is checked -- Lr if (cmbReports.SelectedIndex == 3) { if (dateStart.SelectedDate == null || dateEnd.SelectedDate == null) { MessageBox.Show("Please select a start and end date"); return; } startDate = (DateTime)dateStart.SelectedDate; endDate = (DateTime)dateEnd.SelectedDate; selectedOrders = await OrderProcessor.ShowAllOrders(currentUser.Privileges, currentUser.Token); if (string.IsNullOrEmpty(txtCustomer.Text)) { MessageBox.Show("Please select a customer"); return; } lstReports.Items.Add("\t\t\t\t\t" + txtCustomer.Text + "'s orders from " + startDate.ToString("MM/dd/yyyy") + " to " + endDate.ToString("MM/dd/yyyy")); FillListBox(); } // If Pet's By Customer is checked -- Lr if (cmbReports.SelectedIndex == 4) { if (string.IsNullOrEmpty(txtCustomer.Text)) { MessageBox.Show("Please select a customer"); return; } lstReports.Items.Add("\t\t\t\t\t" + txtCustomer.Text + "'s Pets"); selectedPets = await PetProcessor.ShowPetsByCustomer(selectedUser.UserID, currentUser.Token); foreach (PetModel m in selectedPets) { lstReports.Items.Add(m); } } // If Employee Assigned Orders is checked -- Lr if (cmbReports.SelectedIndex == 5) { if (string.IsNullOrEmpty(txtEmployee.Text)) { MessageBox.Show("Please select an employee."); return; } if (dateStart.SelectedDate == null || dateEnd.SelectedDate == null) { MessageBox.Show("Please select a start and end date"); return; } startDate = (DateTime)dateStart.SelectedDate; endDate = (DateTime)dateEnd.SelectedDate; lstReports.Items.Add("\t\t\t\t\t" + txtEmployee.Text + "'s schedule from " + startDate.ToString("MM/dd/yyyy") + " to " + endDate.ToString("MM/dd/yyyy")); selectedOrders = await OrderProcessor.GetAssignedRequest(selectedEmployee.UserID, currentUser.Token); FillListBox(); } // If Paid Invoices is checked -- LR if (cmbReports.SelectedIndex == 6) { /// Validation if (dateStart.SelectedDate == null || dateEnd.SelectedDate == null) { MessageBox.Show("Please select a start and end date"); return; } if (dateStart.SelectedDate == null || dateEnd.SelectedDate == null) { MessageBox.Show("Please select a start and end date"); return; } startDate = (DateTime)dateStart.SelectedDate; endDate = (DateTime)dateEnd.SelectedDate; /// Header If Statement if (selectedUser != null) { lstReports.Items.Add("\t\t\t\t\t" + txtCustomer.Text + "'s paid invoices from " + startDate.ToString("MM/dd/yyyy") + " to " + endDate.ToString("MM/dd/yyyy")); } else { lstReports.Items.Add("\t\t\t\t\t" + "Paid Invoices from " + startDate.ToString("MM/dd/yyyy") + " to " + endDate.ToString("MM/dd/yyyy")); } /// Calling API Service for Unpaid Invoices selectedInvoices = await InvoiceProcessor.getPaidinvoices(currentUser.Privileges, currentUser.Token); /// Testing to see if there are any paid invoices for date if (selectedInvoices == null) { MessageBox.Show("There are no invoices to display."); return; } /// Adding invoices in listbox foreach (InvoiceModel m in selectedInvoices) { if (selectedUser != null) { if (m.CustomerID == selectedUser.UserID) { if (DateTime.Parse(m.InvoiceDate) >= dateStart.SelectedDate && DateTime.Parse(m.InvoiceDate) <= dateEnd.SelectedDate) { lstReports.Items.Add(m); } } } else { if (DateTime.Parse(m.InvoiceDate) >= dateStart.SelectedDate && DateTime.Parse(m.InvoiceDate) <= dateEnd.SelectedDate) { lstReports.Items.Add(m); } } } } // If Unpaid Invoices is checked -- LR if (cmbReports.SelectedIndex == 7) { /// Validation if (dateStart.SelectedDate == null || dateEnd.SelectedDate == null) { MessageBox.Show("Please select a start and end date"); return; } if (dateStart.SelectedDate == null || dateEnd.SelectedDate == null) { MessageBox.Show("Please select a start and end date"); return; } startDate = (DateTime)dateStart.SelectedDate; endDate = (DateTime)dateEnd.SelectedDate; /// Header If Statement if (selectedUser != null) { lstReports.Items.Add("\t\t\t\t\t" + txtCustomer.Text + "'s unpaid invoices from " + startDate.ToString("MM/dd/yyyy") + " to " + endDate.ToString("MM/dd/yyyy")); } else { lstReports.Items.Add("\t\t\t\t\t" + "Unpaid Invoices from " + startDate.ToString("MM/dd/yyyy") + " to " + endDate.ToString("MM/dd/yyyy")); } /// Calling API Service for Unpaid Invoices selectedInvoices = await InvoiceProcessor.getUnpaidInvoices(currentUser.Privileges, currentUser.Token); /// Testing to see if there are any paid invoices for date if (selectedInvoices == null) { MessageBox.Show("There are no invoices to display."); return; } /// Adding invoices in listbox foreach (InvoiceModel m in selectedInvoices) { if (selectedUser != null) { if (m.CustomerID == selectedUser.UserID) { if (DateTime.Parse(m.InvoiceDate) >= dateStart.SelectedDate && DateTime.Parse(m.InvoiceDate) <= dateEnd.SelectedDate) { lstReports.Items.Add(m); } } } else { if (DateTime.Parse(m.InvoiceDate) >= dateStart.SelectedDate && DateTime.Parse(m.InvoiceDate) <= dateEnd.SelectedDate) { lstReports.Items.Add(m); } } } } // test comment // If overdue invoices is checked -- LR if (cmbReports.SelectedIndex == 8) { if (dateStart.SelectedDate == null || dateEnd.SelectedDate == null) { MessageBox.Show("Please select a start and end date"); return; } startDate = (DateTime)dateStart.SelectedDate; endDate = (DateTime)dateEnd.SelectedDate; selectedInvoices = await InvoiceProcessor.getOverdueInvoices(currentUser.Privileges, currentUser.Token); if (selectedInvoices == null) { MessageBox.Show("There are no invoices to display."); return; } if (selectedUser != null) { lstReports.Items.Add("\t\t\t\t\t" + txtCustomer.Text + "'s overdue invoices from " + startDate.ToString("MM/dd/yyyy") + " to " + endDate.ToString("MM/dd/yyyy")); } else { lstReports.Items.Add("\t\t\t\t\t" + "Overdue invoices from " + startDate.ToString("MM/dd/yyyy") + " to " + endDate.ToString("MM/dd/yyyy")); } foreach (InvoiceModel m in selectedInvoices) { if (selectedUser != null) { if (m.CustomerID == selectedUser.UserID) { if (DateTime.Parse(m.InvoiceDate) >= dateStart.SelectedDate && DateTime.Parse(m.InvoiceDate) <= dateEnd.SelectedDate) { lstReports.Items.Add(m); } } } else { if (DateTime.Parse(m.InvoiceDate) >= dateStart.SelectedDate && DateTime.Parse(m.InvoiceDate) <= dateEnd.SelectedDate) { lstReports.Items.Add(m); } } } } // If due invoices is checked -- LR if (cmbReports.SelectedIndex == 9) { if (dateStart.SelectedDate == null || dateEnd.SelectedDate == null) { MessageBox.Show("Please select a start and end date"); return; } startDate = (DateTime)dateStart.SelectedDate; endDate = (DateTime)dateEnd.SelectedDate; selectedInvoices = await InvoiceProcessor.getUnderdueInvoices(currentUser.Privileges, currentUser.Token); if (selectedInvoices == null) { MessageBox.Show("There are no invoices to display."); return; } if (selectedUser != null) { lstReports.Items.Add("\t\t\t\t\t" + txtCustomer.Text + "'s due invoices (not overdue) from " + startDate.ToString("MM/dd/yyyy") + " to " + endDate.ToString("MM/dd/yyyy")); } else { lstReports.Items.Add("\t\t\t\t\t" + "Due invoices (not overdue) from " + startDate.ToString("MM/dd/yyyy") + " to " + endDate.ToString("MM/dd/yyyy")); } foreach (InvoiceModel m in selectedInvoices) { if (selectedUser != null) { if (m.CustomerID == selectedUser.UserID) { if (DateTime.Parse(m.InvoiceDate) >= dateStart.SelectedDate && DateTime.Parse(m.InvoiceDate) <= dateEnd.SelectedDate) { lstReports.Items.Add(m); } } } else { if (DateTime.Parse(m.InvoiceDate) >= dateStart.SelectedDate && DateTime.Parse(m.InvoiceDate) <= dateEnd.SelectedDate) { lstReports.Items.Add(m); } } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void demat_test_ho() { var processor = new InvoiceProcessor(250, "C:\\test"); processor.ProcessOne(120327); //141902, 137480, 158173, 200116, 200980 }
public void demat_test_all_next_run() { var processor = new InvoiceProcessor(250, "C:\\test"); processor.ProcessAll(); }
private async void FillInvoiceListBox(UserModel user) { lstInvoices.Items.Clear(); usedInvoices.Clear(); invoices.Clear(); lstInvoices.IsEnabled = true; if (await InvoiceProcessor.getOverdueInvoices(currentUser.Privileges, currentUser.Token) != null) { invoices.Add(await InvoiceProcessor.getOverdueInvoices(currentUser.Privileges, currentUser.Token)); } if (await InvoiceProcessor.getUnderdueInvoices(currentUser.Privileges, currentUser.Token) != null) { invoices.Add(await InvoiceProcessor.getUnderdueInvoices(currentUser.Privileges, currentUser.Token)); } if (await InvoiceProcessor.getUnpaidInvoices(currentUser.Privileges, currentUser.Token) != null) { invoices.Add(await InvoiceProcessor.getUnpaidInvoices(currentUser.Privileges, currentUser.Token)); } if (await InvoiceProcessor.getPaidinvoices(currentUser.Privileges, currentUser.Token) != null) { invoices.Add(await InvoiceProcessor.getPaidinvoices(currentUser.Privileges, currentUser.Token)); } if (invoices != null) { foreach (List <InvoiceModel> i in invoices) { foreach (InvoiceModel n in i) { if (n.CustomerID == user.UserID) { if (usedInvoices.Count == 0) { usedInvoices.Add(n); } else { foreach (InvoiceModel invoice in usedInvoices) { if (n.InvoiceID == invoice.InvoiceID) { lstInvoices.Items.Add(n); } } usedInvoices.Add(n); } } } } if (lstInvoices.Items.IsEmpty) { lstInvoices.Items.Add("NO INVOICES FOR THIS CUSTOMER"); } } else { lstInvoices.Items.Add("NO INVOICES FOR THIS CUSTOMER"); } }