quotes including discounts

pull/1/head
Sascha Woitschetzki 2021-06-21 10:32:01 +07:00 committed by Sascha Woitschetzki
parent cc02294cc6
commit f00112b12d
4 changed files with 29 additions and 16 deletions

@ -84,6 +84,7 @@
<StackPanel x:Name="Opp" Grid.Row="0" Grid.Column="2" Orientation="Vertical">
<CheckBox d:DataContext="{d:DesignInstance Type=viewmodels:QuoteVM}" x:Name="cbBrutto" Content="Brutto anzeigen" Margin="10,5,10,5" IsChecked="{Binding Path=Brutto, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Click="CbBrutto_Click"/>
<CheckBox x:Name="cbSinglePrices" Content="Einzelpreise ausweisen" Margin="10,5,10,5" IsChecked="True" Click="CbSinglePrices_Click" />
<CheckBox x:Name="cbShowDiscounts" Content="Discounts ausweisen" Margin="10,5,10,5" IsChecked="True" Click="CbShowDiscounts_Click"/>
<CheckBox x:Name="cbBrochure" Content="Broschüren anhängen" Margin="10,5,10,5" Click="CbBrochure_Click" />
<CheckBox x:Name="cbDataSheets" Content="Datenblätter anhängen" Margin="10,5,10,5" Click="CbDataSheets_Click" />
<CheckBox x:Name="cbMailTemplate" Content="Mail aus Template erstellen" Margin="10,5,10,5" Click="CbMailTemplate_Click" />

@ -70,9 +70,12 @@ namespace Gremlin.GremlinUI
cbDataSheets.IsChecked,
cbMailTemplate.IsChecked,
tbQuotePath.Text,
validity
validity,
cbShowDiscounts.IsChecked
);
if (quoteVM == null) return;
ObservableCollection<LineItemVM> 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;
}
}
}

@ -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();

@ -9,28 +9,29 @@ namespace Gremlin.GremlinUI.ViewModels
internal class QuoteVM : BaseVM
{
public List<LineItemVM> 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<LineItemVM> lineItemsVM = LineItemVM.ReadLineItemsFromClipboard();
if (lineItemsVM == null) return null;
foreach (LineItemVM lineItemVM in lineItemsVM)
{
totalListprice += lineItemVM.ListPrice;