diff --git a/Gremlin/GremlinUI/QuoteUI.xaml b/Gremlin/GremlinUI/QuoteUI.xaml index bed1d9b..50ac95e 100644 --- a/Gremlin/GremlinUI/QuoteUI.xaml +++ b/Gremlin/GremlinUI/QuoteUI.xaml @@ -84,6 +84,7 @@ + diff --git a/Gremlin/GremlinUI/QuoteUI.xaml.cs b/Gremlin/GremlinUI/QuoteUI.xaml.cs index 670ed63..36b19ac 100644 --- a/Gremlin/GremlinUI/QuoteUI.xaml.cs +++ b/Gremlin/GremlinUI/QuoteUI.xaml.cs @@ -70,9 +70,12 @@ namespace Gremlin.GremlinUI cbDataSheets.IsChecked, cbMailTemplate.IsChecked, tbQuotePath.Text, - validity + validity, + cbShowDiscounts.IsChecked ); + if (quoteVM == null) return; + ObservableCollection lineItemsViewModel = new(quoteVM.LineItemsVM); lineItems = new(lineItemsViewModel); UpdateUI(); @@ -155,5 +158,10 @@ namespace Gremlin.GremlinUI { quoteVM.MailTemplate = cbMailTemplate.IsChecked; } + + private void CbShowDiscounts_Click(object sender, RoutedEventArgs e) + { + quoteVM.ShowDiscounts = cbMailTemplate.IsChecked; + } } } \ No newline at end of file diff --git a/Gremlin/GremlinUI/ViewModels/LineItemVM.cs b/Gremlin/GremlinUI/ViewModels/LineItemVM.cs index b528245..7c26409 100644 --- a/Gremlin/GremlinUI/ViewModels/LineItemVM.cs +++ b/Gremlin/GremlinUI/ViewModels/LineItemVM.cs @@ -15,7 +15,6 @@ namespace Gremlin.GremlinUI.ViewModels public CustomDescriptionVM CustomDescription { get; private set; } public string ProductLine { get; private set; } public decimal TotalDiscount { get; internal set; } - { string clipboard = Clipboard.GetText(); diff --git a/Gremlin/GremlinUI/ViewModels/QuoteVM.cs b/Gremlin/GremlinUI/ViewModels/QuoteVM.cs index 0feb585..4ba2716 100644 --- a/Gremlin/GremlinUI/ViewModels/QuoteVM.cs +++ b/Gremlin/GremlinUI/ViewModels/QuoteVM.cs @@ -9,28 +9,29 @@ namespace Gremlin.GremlinUI.ViewModels internal class QuoteVM : BaseVM { public List LineItemsVM { get; private set; } - public ContactVM Recipient { get; set; } + public ContactVM Recipient { get; internal set; } public ContactVM SalesRep { get; private set; } - public string QuoteNumber { get; set; } - public string QuoteType { get; set; } - public string QuotePath { get; set; } - public int Warranty { get; set; } - public int Validity { get; set; } + public string QuoteNumber { get; internal set; } + public string QuoteType { get; internal set; } + public string QuotePath { get; internal set; } + public int Warranty { get; internal set; } + public int Validity { get; internal set; } public decimal TotalListprice { get; private set; } public decimal AverageDiscount { get; private set; } public decimal TotalNet { get; private set; } public float VAT { get; private set; } - public bool? Brutto { get; set; } - public bool? SinglePrices { get; set; } - public bool? Brochures { get; set; } - public bool? DataSheets { get; set; } - public bool? MailTemplate { get; set; } + public bool? Brutto { get; internal set; } + public bool? SinglePrices { get; internal set; } + public bool? Brochures { get; internal set; } + public bool? DataSheets { get; internal set; } + public bool? MailTemplate { get; internal set; } public bool QuoteContains3PP { get; private set; } public bool QuoteContainsRB { get; private set; } + public bool? ShowDiscounts { get; internal set; } internal QuoteVM() { } - private QuoteVM(string quoteNumber, string quoteType, ContactVM recipient, ContactVM salesRep, bool? brutto, float vAT, int warranty, int validity, string quotePath, bool? singlePrices, bool? brochures, bool? dataSheets, bool? mailTemplate) + private QuoteVM(string quoteNumber, string quoteType, ContactVM recipient, ContactVM salesRep, bool? brutto, float vAT, int warranty, int validity, string quotePath, bool? singlePrices, bool? brochures, bool? dataSheets, bool? mailTemplate, bool? showDiscounts) { QuoteNumber = quoteNumber; QuoteType = quoteType; @@ -45,17 +46,21 @@ namespace Gremlin.GremlinUI.ViewModels Brochures = brochures; DataSheets = dataSheets; MailTemplate = mailTemplate; + ShowDiscounts = showDiscounts; } - internal static QuoteVM CreateQuote(string quoteNumber, ContactVM recipient, ContactVM salesRep, float vAT = 19f, string quoteType = "ein Analysegerät", bool? brutto = true, int warranty = 12, bool? singlePrices = true, bool? brochures = true, bool? dataSheets = true, bool? mailTemplate = true, string quotePath = "", int validity = 60) + internal static QuoteVM CreateQuote(string quoteNumber, ContactVM recipient, ContactVM salesRep, float vAT = 19f, string quoteType = "ein Analysegerät", bool? brutto = true, int warranty = 12, bool? singlePrices = true, bool? brochures = true, bool? dataSheets = true, bool? mailTemplate = true, string quotePath = "", int validity = 60, bool? showDiscounts = true) { decimal totalListprice = 0, totalDiscount = 0, calcTotalNet = 0; bool quoteContains3PP = false, quoteContainsRB = false; - QuoteVM quoteVM = new(quoteNumber, quoteType, recipient, salesRep, brutto, vAT, warranty, validity, quotePath, singlePrices, brochures, dataSheets, mailTemplate); + QuoteVM quoteVM = new(quoteNumber, quoteType, recipient, salesRep, brutto, vAT, warranty, validity, quotePath, singlePrices, brochures, dataSheets, mailTemplate, showDiscounts); quoteVM.LineItemsVM = new(); ObservableCollection lineItemsVM = LineItemVM.ReadLineItemsFromClipboard(); + + if (lineItemsVM == null) return null; + foreach (LineItemVM lineItemVM in lineItemsVM) { totalListprice += lineItemVM.ListPrice;