CustomerInvoiceLine.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. using System.Windows;
  2. using System.Windows.Controls;
  3. using Comal.Classes;
  4. using InABox.Core;
  5. using InABox.DynamicGrid;
  6. namespace PRSDesktop
  7. {
  8. internal class CustomerInvoiceLine : DynamicOneToManyGrid<Invoice, InvoiceLine>
  9. {
  10. public CustomerInvoiceLine()
  11. {
  12. AddButton("Calculate", null, CalculateInvoice);
  13. }
  14. private bool CalculateInvoice(Button arg1, CoreRow[] arg2)
  15. {
  16. var res = MessageBox.Show("Summarise Time and Materials?", "Confirm Action", MessageBoxButton.YesNoCancel, MessageBoxImage.Question,
  17. MessageBoxResult.Yes, MessageBoxOptions.None);
  18. if (res == MessageBoxResult.Cancel)
  19. return false;
  20. //EditorGrid
  21. var invoice = Item;
  22. if (invoice != null)
  23. {
  24. Utility.CalculateInvoice(invoice, res == MessageBoxResult.Yes);
  25. return true;
  26. }
  27. MessageBox.Show("Please Select or Create an Invoice First!");
  28. return false;
  29. }
  30. }
  31. }