public static void ShowArticleBag() { Guid articleClassProducts = new Guid("6924945d-f99e-476b-9c4d-78fb9e2b30a3"); Guid articleClassServices = new Guid("7622e5d2-2d52-4be9-bb8b-e5efae5ec791"); ArticleBag articleBag = TestArticleBag.GetArticleBag(false); foreach (var item in articleBag) { //_log.Debug(string.Format("{0} x {1}", item.Key.Designation, item.Value.Quantity)); Console.WriteLine(string.Format("{0} x {1}", item.Key.Designation, item.Value.Quantity)); } //Test GetClassTotals Dictionary <string, decimal> classTotals = articleBag.GetClassTotals(); //Show Result Console.WriteLine(Environment.NewLine); Console.WriteLine("TotalFinal P: [{0}]", classTotals["P"]); Console.WriteLine("TotalFinal S: [{0}]", classTotals["S"]); Console.WriteLine("ArticleBag TotalFinal: [{0}], TotalPAndS: [{1}]", articleBag.TotalFinal, classTotals["P"] + classTotals["S"]); }
//Override Base Validate public override void Validate() { //If not a Invoice|InvoiceAndPayment|Simplified Invoice if (_treeViewArticles.DataSource.Rows.Count > 0 && _pagePad1.EntryBoxSelectDocumentFinanceType.Value.Oid != SettingsApp.XpoOidDocumentFinanceTypeInvoice && _pagePad1.EntryBoxSelectDocumentFinanceType.Value.Oid != SettingsApp.XpoOidDocumentFinanceTypeInvoiceAndPayment && _pagePad1.EntryBoxSelectDocumentFinanceType.Value.Oid != SettingsApp.XpoOidDocumentFinanceTypeSimplifiedInvoice ) { _validated = true; } //Check TotalFinal with Current Customer Details else if ( _treeViewArticles.DataSource.Rows.Count > 0 && FrameworkUtils.IsInValidFinanceDocumentCustomer( _articleBag.TotalFinal, _pagePad2.EntryBoxSelectCustomerName.EntryValidation.Text, _pagePad2.EntryBoxCustomerAddress.EntryValidation.Text, _pagePad2.EntryBoxCustomerZipCode.EntryValidation.Text, _pagePad2.EntryBoxCustomerCity.EntryValidation.Text, _pagePad2.EntryBoxSelectCustomerCountry.EntryValidation.Text, _pagePad2.EntryBoxSelectCustomerFiscalNumber.EntryValidation.Text ) ) { Utils.ShowMessageTouchSimplifiedInvoiceMaxValueExceedForFinalConsumer(_posDocumentFinanceDialog, _articleBag.TotalFinal, SettingsApp.FinanceRuleRequiredCustomerDetailsAboveValue); _validated = false; } //If Simplified Invoice, Check if Total Document and Total Services is Not Greater than Max Value else if ( _treeViewArticles.DataSource.Rows.Count > 0 && ( _pagePad1.EntryBoxSelectDocumentFinanceType.Value.Oid == SettingsApp.XpoOidDocumentFinanceTypeSimplifiedInvoice && ( //Check Total Final and Total Services _articleBag.TotalFinal > SettingsApp.FinanceRuleSimplifiedInvoiceMaxTotal || _articleBag.GetClassTotals("S") > SettingsApp.FinanceRuleSimplifiedInvoiceMaxTotalServices ) ) ) { //In New Finance Dialog Mode we cant change to Invoice-Payment Utils.ShowMessageTouchSimplifiedInvoiceMaxValueExceed(_posDocumentFinanceDialog, ShowMessageTouchSimplifiedInvoiceMaxValueExceedMode.DocumentFinanceDialog, _articleBag.TotalFinal, SettingsApp.FinanceRuleSimplifiedInvoiceMaxTotal, _articleBag.GetClassTotals("S"), SettingsApp.FinanceRuleSimplifiedInvoiceMaxTotalServices); _validated = false; } else { _validated = (_treeViewArticles.DataSource.Rows.Count > 0); } //Enable Next Button, If not In Last Page and in WayBill Mode (WayBill + Invoice) if (_pagePad.CurrentPageIndex < _pagePad.Pages.Count - 1 && _pagePad.CurrentPageIndex == 2 && _pagePad.Pages[3].Enabled) { _pagePad.ButtonNext.Sensitive = _validated; } else { _pagePad.ButtonNext.Sensitive = false; }; //Validate Dialog (All Pages must be Valid) _posDocumentFinanceDialog.Validate(); }