|
|
|
|
@ -1,12 +1,12 @@
|
|
|
|
|
using Gremlin.ViewModels;
|
|
|
|
|
using Caliburn.Micro;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace Gremlin.GremlinUI.ViewModels
|
|
|
|
|
namespace Gremlin.MVVM
|
|
|
|
|
{
|
|
|
|
|
internal class QuoteVM : BaseVM
|
|
|
|
|
internal class QuoteViewModel : PropertyChangedBase
|
|
|
|
|
{
|
|
|
|
|
private string _quoteType = "ein Analysegerät";
|
|
|
|
|
private string _quotePath;
|
|
|
|
|
@ -20,7 +20,7 @@ namespace Gremlin.GremlinUI.ViewModels
|
|
|
|
|
private decimal _averageDiscount;
|
|
|
|
|
private decimal _totalNet;
|
|
|
|
|
private float _vAT = 19f;
|
|
|
|
|
private bool? _brutto = true;
|
|
|
|
|
private bool? _showBrutto = true;
|
|
|
|
|
private bool? _singlePrices = true;
|
|
|
|
|
private bool? _brochures = false;
|
|
|
|
|
private bool? _dataSheets = false;
|
|
|
|
|
@ -36,20 +36,23 @@ namespace Gremlin.GremlinUI.ViewModels
|
|
|
|
|
internal set
|
|
|
|
|
{
|
|
|
|
|
_quoteType = value;
|
|
|
|
|
OnPropertyChanged("QuoteType");
|
|
|
|
|
NotifyOfPropertyChange(() => QuoteType);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string QuotePath
|
|
|
|
|
{
|
|
|
|
|
get => _quotePath;
|
|
|
|
|
|
|
|
|
|
internal set
|
|
|
|
|
{
|
|
|
|
|
_quotePath = value;
|
|
|
|
|
OnPropertyChanged("QuotePath");
|
|
|
|
|
NotifyOfPropertyChange(() => QuotePath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool? ShowBrutto { get => _showBrutto; internal set { _showBrutto = value; NotifyOfPropertyChange(() => ShowBrutto); } }
|
|
|
|
|
|
|
|
|
|
public List<LineItemVM> LineItemsVM { get => _lineItemsVM; private set => _lineItemsVM = value; }
|
|
|
|
|
public ContactVM Recipient { get => _recipient; internal set => _recipient = value; }
|
|
|
|
|
public ContactVM SalesRep { get => _salesRep; private set => _salesRep = value; }
|
|
|
|
|
@ -60,7 +63,6 @@ namespace Gremlin.GremlinUI.ViewModels
|
|
|
|
|
public decimal AverageDiscount { get => _averageDiscount; private set => _averageDiscount = value; }
|
|
|
|
|
public decimal TotalNet { get => _totalNet; private set => _totalNet = value; }
|
|
|
|
|
public float VAT { get => _vAT; private set => _vAT = value; }
|
|
|
|
|
public bool? Brutto { get => _brutto; internal set => _brutto = value; }
|
|
|
|
|
public bool? SinglePrices { get => _singlePrices; internal set => _singlePrices = value; }
|
|
|
|
|
public bool? Brochures { get => _brochures; internal set => _brochures = value; }
|
|
|
|
|
public bool? DataSheets { get => _dataSheets; internal set => _dataSheets = value; }
|
|
|
|
|
@ -69,7 +71,7 @@ namespace Gremlin.GremlinUI.ViewModels
|
|
|
|
|
public bool QuoteContainsRB { get => _quoteContainsRB; private set => _quoteContainsRB = value; }
|
|
|
|
|
public bool? ShowDiscounts { get => _showDiscounts; internal set => _showDiscounts = value; }
|
|
|
|
|
|
|
|
|
|
internal QuoteVM(ContactVM salesRep)
|
|
|
|
|
internal QuoteViewModel(ContactVM salesRep)
|
|
|
|
|
{
|
|
|
|
|
Random random = new();
|
|
|
|
|
SalesRep = salesRep;
|
|
|
|
|
@ -81,15 +83,15 @@ namespace Gremlin.GremlinUI.ViewModels
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public QuoteVM() { }
|
|
|
|
|
public QuoteViewModel() { }
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
private QuoteViewModel(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;
|
|
|
|
|
Recipient = recipient;
|
|
|
|
|
SalesRep = salesRep;
|
|
|
|
|
Brutto = brutto;
|
|
|
|
|
ShowBrutto = brutto;
|
|
|
|
|
VAT = vAT;
|
|
|
|
|
Warranty = warranty;
|
|
|
|
|
Validity = validity;
|
|
|
|
|
@ -101,12 +103,12 @@ namespace Gremlin.GremlinUI.ViewModels
|
|
|
|
|
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, bool? showDiscounts = true)
|
|
|
|
|
internal static QuoteViewModel 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, showDiscounts);
|
|
|
|
|
QuoteViewModel quoteVM = new(quoteNumber, quoteType, recipient, salesRep, brutto, vAT, warranty, validity, quotePath, singlePrices, brochures, dataSheets, mailTemplate, showDiscounts);
|
|
|
|
|
quoteVM.LineItemsVM = new();
|
|
|
|
|
|
|
|
|
|
ObservableCollection<LineItemVM> lineItemsVM = LineItemVM.ReadLineItemsFromClipboard();
|