Beispiel #1
0
        private void UpdatePriceProperties()
        {
            if (_crudWidgetPrice.Validated && _crudWidgetQuantity.Validated && _crudWidgetDiscount.Validated && _crudWidgetSelectVatRate.Validated)
            {
                PriceProperties priceProperties = PriceProperties.GetPriceProperties(
                    PricePropertiesSourceMode.FromPriceUser,
                    false, //PriceWithVat : Always use PricesWithoutVat in Invoices
                    _articlePrice,
                    FrameworkUtils.StringToDecimal(_entryBoxValidationQuantity.EntryValidation.Text),
                    FrameworkUtils.StringToDecimal(_entryBoxValidationDiscount.EntryValidation.Text),
                    _discountGlobal,
                    _entryBoxSelectVatRate.Value.Value
                    );
                //priceProperties.SendToLog(article.Designation);

                //Update UI / Display with ExchangeRate
                _entryBoxValidationTotalNet.EntryValidation.Text   = FrameworkUtils.DecimalToString(priceProperties.TotalNet * _currencyDisplay.ExchangeRate);
                _entryBoxValidationTotalFinal.EntryValidation.Text = FrameworkUtils.DecimalToString(priceProperties.TotalFinal * _currencyDisplay.ExchangeRate);
            }
            else
            {
                _entryBoxValidationTotalNet.EntryValidation.Text   = FrameworkUtils.DecimalToString(0.0m);
                _entryBoxValidationTotalFinal.EntryValidation.Text = FrameworkUtils.DecimalToString(0.0m);
            }
        }
Beispiel #2
0
        public static MoneyPadResult RequestDecimalValue(Window pSourceWindow, string pWindowTitle = "", decimal pInitialValue = 0.0m, decimal pTotalOrder = 0.0m)
        {
            ResponseType resultResponse;
            decimal      resultValue = -1.0m;

            String regexDecimalGreaterThanZero = SettingsApp.RegexDecimalGreaterThanZero;
            String defaultValue = FrameworkUtils.DecimalToString(pInitialValue);

            PosMoneyPadDialog dialog;

            if (pWindowTitle != string.Empty)
            {
                dialog = new PosMoneyPadDialog(pSourceWindow, DialogFlags.DestroyWithParent, pWindowTitle, pInitialValue, pTotalOrder);
            }
            else
            {
                dialog = new PosMoneyPadDialog(pSourceWindow, DialogFlags.DestroyWithParent, pInitialValue, pTotalOrder);
            }

            int response = dialog.Run();

            if (response == (int)ResponseType.Ok)
            {
                resultValue = dialog.Amount;
            }
            resultResponse = (ResponseType)response;
            dialog.Destroy();

            MoneyPadResult result = new MoneyPadResult(resultResponse, resultValue);

            return(result);
        }
Beispiel #3
0
        //Change Price
        void _buttonKeyChangePrice_Clicked(object sender, EventArgs e)
        {
            decimal oldValueQuantity = CurrentOrderDetails.Lines[_listStoreModelSelectedIndex].Properties.Quantity;
            decimal oldValuePrice    = CurrentOrderDetails.Lines[_listStoreModelSelectedIndex].Properties.PriceFinal;

            MoneyPadResult result        = PosMoneyPadDialog.RequestDecimalValue(_sourceWindow, Resx.window_title_dialog_moneypad_product_price, oldValuePrice);
            decimal        newValuePrice = result.Value;

            if (result.Response == ResponseType.Ok && newValuePrice > 0)
            {
                //Create a Fresh Object to Get Input Price and Calc from TotalFinal with Quantity 1, Without Touch Quantity in current Line
                PriceProperties priceProperties = PriceProperties.GetPriceProperties(
                    PricePropertiesSourceMode.FromTotalFinal,
                    CurrentOrderDetails.Lines[_listStoreModelSelectedIndex].Properties.PriceWithVat,
                    newValuePrice,
                    1.0m,
                    CurrentOrderDetails.Lines[_listStoreModelSelectedIndex].Properties.DiscountArticle,
                    CurrentOrderDetails.Lines[_listStoreModelSelectedIndex].Properties.DiscountGlobal,
                    CurrentOrderDetails.Lines[_listStoreModelSelectedIndex].Properties.Vat
                    );

                //Update orderDetails
                CurrentOrderDetails.Update(_listStoreModelSelectedIndex, oldValueQuantity, priceProperties.PriceUser);
                //Update TreeView Model Price
                _listStoreModel.SetValue(_treeIter, (int)TicketListColumns.Price, FrameworkUtils.DecimalToString(newValuePrice));
                //Update Total
                decimal totalLine = CurrentOrderDetails.Lines[_listStoreModelSelectedIndex].Properties.TotalFinal;
                _listStoreModel.SetValue(_treeIter, (int)TicketListColumns.Total, FrameworkUtils.DecimalToString(totalLine));
            }
            UpdateTicketListTotal();
        }
Beispiel #4
0
        private void UpdateTitleBar()
        {
            try
            {
                decimal paymentPercentage = 0.0m;

                if (_diference < 0 || _diference > 0)
                {
                    //Calculate in Default Currency [EUR]
                    if (_paymentAmountTotal > 0)
                    {
                        paymentPercentage = (_payedAmount * 100) / _paymentAmountTotal;
                    }

                    WindowTitle = string.Format(
                        "{0}: {1} / {2}{3}",
                        resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_pay_invoices"),
                        FrameworkUtils.DecimalToStringCurrency(_diference, _entryBoxSelectConfigurationCurrency.Value.Acronym),
                        FrameworkUtils.DecimalToStringCurrency(_paymentAmountTotal * _exchangeRate, _entryBoxSelectConfigurationCurrency.Value.Acronym),
                        //Show only if above 100%
                        (paymentPercentage < 100) ? string.Format(" / {0}%", FrameworkUtils.DecimalToString(paymentPercentage)) : string.Empty
                        );
                }
                else
                {
                    WindowTitle = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_pay_invoices");
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
Beispiel #5
0
        //Totals, with TotalDelivery and TotalChange
        private void PrintMasterTotals()
        {
            try
            {
                //Init DataTable
                DataRow   dataRow   = null;
                DataTable dataTable = new DataTable();
                dataTable.Columns.Add(new DataColumn("Label", typeof(string)));
                dataTable.Columns.Add(new DataColumn("Value", typeof(string)));

                //Add Row : TotalFinal
                dataRow    = dataTable.NewRow();
                dataRow[0] = Resx.global_total;
                dataRow[1] = FrameworkUtils.DecimalToString(_documentFinancePaymentList[0].PaymentAmount * _documentFinancePaymentList[0].ExchangeRate);
                dataTable.Rows.Add(dataRow);

                //Configure Ticket Column Properties
                List <TicketColumn> columns = new List <TicketColumn>();
                columns.Add(new TicketColumn("Label", "", Convert.ToInt16(_maxCharsPerLineNormal / 2) - 2, TicketColumnsAlign.Left));
                columns.Add(new TicketColumn("Value", "", Convert.ToInt16(_maxCharsPerLineNormal / 2) - 2, TicketColumnsAlign.Right));

                //TicketTable(DataTable pDataTable, List<TicketColumn> pColumnsProperties, int pTableWidth)
                TicketTable ticketTable = new TicketTable(dataTable, columns, _thermalPrinterGeneric.MaxCharsPerLineNormalBold);
                ticketTable.Print(_thermalPrinterGeneric, WriteLineTextMode.DoubleHeightBold);

                //Line Feed
                _thermalPrinterGeneric.LineFeed();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #6
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        //WayBill

        /// <summary>
        /// Get Document <Line>s
        ///     Linhas do Documento(Line)
        /// </summary>
        /// <param name="DocumentMaster"></param>
        /// <returns></returns>
        public static string GetDocumentWayBillContentLines(FIN_DocumentFinanceMaster pDocumentMaster)
        {
            //Init Locals Vars
            string result = string.Empty;

            try
            {
                string sql = string.Format(@"
                    SELECT 
	                    Designation AS ProductDescription, Quantity, UnitMeasure AS UnitOfMeasure, Price AS UnitPrice,
	                    (SELECT rf.OriginatingON FROM fin_documentfinancedetailorderreference AS rf WHERE rf.DocumentDetail = fd.Oid) AS OrderReferences
                    FROM 
	                    fin_documentfinancedetail AS fd 
                    WHERE 
	                    DocumentMaster = '{0}' 
                    ORDER BY 
	                    Ord
                    ;"
                                           , pDocumentMaster.Oid
                                           );

                DataTable dtResult = FrameworkUtils.GetDataTableFromQuery(sql);

                //Init StringBuilder
                StringBuilder sb = new StringBuilder();

                foreach (DataRow item in dtResult.Rows)
                {
                    string orderReferences = (!string.IsNullOrEmpty(item["OrderReferences"].ToString()))
                        ? string.Format(@"{0}      <OrderReferences>
        <OriginatingON>{1}</OriginatingON>
      </OrderReferences>", Environment.NewLine, item["OrderReferences"])
                        : string.Empty
                    ;

                    sb.Append(string.Format(@"    <Line>{0}
      <ProductDescription>{1}</ProductDescription>
      <Quantity>{2}</Quantity>
      <UnitOfMeasure>{3}</UnitOfMeasure>
      <UnitPrice>{4}</UnitPrice>
    </Line>
"
                                            , orderReferences
                                            , item["ProductDescription"]
                                            , FrameworkUtils.DecimalToString(Convert.ToDecimal(item["Quantity"]), GlobalFramework.CurrentCultureNumberFormat)
                                            , item["UnitOfMeasure"]
                                            , FrameworkUtils.DecimalToString(Convert.ToDecimal(item["UnitPrice"]), GlobalFramework.CurrentCultureNumberFormat)
                                            ));
                }

                result = sb.ToString();
            }
            catch (Exception ex)
            {
                throw (ex);
            }

            return(result);
        }
Beispiel #7
0
        private void InitUI()
        {
            //Initial Values
            FIN_ConfigurationPaymentMethod initialValueConfigurationPaymentMethod = (FIN_ConfigurationPaymentMethod)FrameworkUtils.GetXPGuidObject(typeof(FIN_ConfigurationPaymentMethod), SettingsApp.XpoOidConfigurationPaymentMethodDefaultInvoicePaymentMethod);
            CFG_ConfigurationCurrency      intialValueConfigurationCurrency       = SettingsApp.ConfigurationSystemCurrency;
            string initialPaymentDate = FrameworkUtils.CurrentDateTimeAtomic().ToString(SettingsApp.DateTimeFormat);

            //ConfigurationPaymentMethod
            string           filterValidPaymentMethod = "(Token = 'CREDIT_CARD' OR Token = 'BANK_CHECK' OR Token = 'MONEY' OR Token = 'BANK_TRANSFER' OR Token = 'CASH_MACHINE' OR Token = 'VISA' OR Token = 'OTHER')";
            CriteriaOperator criteriaOperatorConfigurationPaymentMethod = CriteriaOperator.Parse(string.Format("(Disabled IS NULL OR Disabled  <> 1)  AND Oid <> '{0}' AND {1}", SettingsApp.XpoOidConfigurationPaymentMethodCurrentAccount.ToString(), filterValidPaymentMethod));

            _entryBoxSelectConfigurationPaymentMethod = new XPOEntryBoxSelectRecordValidation <FIN_ConfigurationPaymentMethod, TreeViewConfigurationPaymentMethod>(_sourceWindow, Resx.global_payment_method, "Designation", "Oid", initialValueConfigurationPaymentMethod, criteriaOperatorConfigurationPaymentMethod, SettingsApp.RegexGuid, true);
            _entryBoxSelectConfigurationPaymentMethod.EntryValidation.Changed   += delegate { Validate(); };
            _entryBoxSelectConfigurationPaymentMethod.EntryValidation.IsEditable = false;

            //ConfigurationCurrency
            CriteriaOperator criteriaOperatorConfigurationCurrency = CriteriaOperator.Parse(string.Format("(Disabled IS NULL OR Disabled  <> 1) AND (ExchangeRate IS NOT NULL OR Oid = '{0}')", SettingsApp.ConfigurationSystemCurrency.Oid.ToString()));

            _entryBoxSelectConfigurationCurrency = new XPOEntryBoxSelectRecordValidation <CFG_ConfigurationCurrency, TreeViewConfigurationCurrency>(_sourceWindow, Resx.global_currency, "Designation", "Oid", intialValueConfigurationCurrency, criteriaOperatorConfigurationCurrency, SettingsApp.RegexGuid, false);
            _entryBoxSelectConfigurationCurrency.EntryValidation.Changed   += _entryBoxSelectConfigurationCurrency_Changed;
            _entryBoxSelectConfigurationCurrency.EntryValidation.IsEditable = false;

            //PaymentAmount
            _entryPaymentAmount = new EntryBoxValidation(_sourceWindow, Resx.global_total_deliver, KeyboardMode.Numeric, SettingsApp.RegexDecimalGreaterEqualThanZero, true);
            _entryPaymentAmount.EntryValidation.Text = FrameworkUtils.DecimalToString(_paymentAmountTotal);
            _entryPaymentAmount.EntryValidation.Validate();
            _entryPaymentAmount.EntryValidation.Changed += delegate {
                Validate();
                UpdateTitleBar();
            };

            //PaymentDate
            _entryBoxPaymentDate = new EntryBoxValidation(_sourceWindow, Resx.global_date, KeyboardMode.Alfa, SettingsApp.RegexDateTime, true);
            _entryBoxPaymentDate.EntryValidation.Text = initialPaymentDate;
            _entryBoxPaymentDate.EntryValidation.Validate();
            _entryBoxPaymentDate.EntryValidation.Changed += delegate { Validate(); };

            //PaymentNotes
            _entryBoxDocumentPaymentNotes = new EntryBoxValidation(_sourceWindow, Resx.global_notes, KeyboardMode.Alfa, SettingsApp.RegexAlfaNumericExtended, false);
            _entryBoxDocumentPaymentNotes.EntryValidation.Changed += delegate { Validate(); };

            //Pack VBOX
            VBox vbox = new VBox(false, 0);

            vbox.PackStart(_entryBoxSelectConfigurationPaymentMethod, true, true, 0);
            vbox.PackStart(_entryBoxSelectConfigurationCurrency, false, false, 0);
            vbox.PackStart(_entryPaymentAmount, false, false, 0);
            vbox.PackStart(_entryBoxPaymentDate, false, false, 0);
            vbox.PackStart(_entryBoxDocumentPaymentNotes, false, false, 0);
            vbox.PackStart(_entryBoxDocumentPaymentNotes, false, false, 0);
            vbox.WidthRequest = _windowSize.Width - 14;

            //Put in FinishContent
            _fixedContent = new Fixed();
            _fixedContent.Put(vbox, 0, 0);
        }
Beispiel #8
0
        public void ShowOrder(string pArticle, decimal pQuantity, decimal pPrice, decimal pTotal)
        {
            string article = string.Format("{0} x {1}", FrameworkUtils.DecimalToString(pQuantity), pArticle);

            //string price = string.Format("{0}", FrameworkUtils.DecimalToString(pPrice));
            //string line1 = TextJustified(article, price, Convert.ToInt16(_charactersPerLine));
            Write(article, 1);
            WriteJustified(Resx.global_total, FrameworkUtils.DecimalToString(pTotal), 2);
            EnableStandBy();
        }
        public void ShowOrder(string pArticle, decimal pQuantity, decimal pPrice, decimal pTotal)
        {
            string article = string.Format("{0} x {1}", FrameworkUtils.DecimalToString(pQuantity), pArticle);

            //string price = string.Format("{0}", FrameworkUtils.DecimalToString(pPrice));
            //string line1 = TextJustified(article, price, Convert.ToInt16(_charactersPerLine));
            Write(article, 1);
            WriteJustified(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_total"), FrameworkUtils.DecimalToString(pTotal), 2);
            EnableStandBy();
        }
Beispiel #10
0
 void _entryBoxSelectConfigurationCurrency_Changed(object sender, EventArgs e)
 {
     //Update ExchangeRate Reference
     _exchangeRate = _entryBoxSelectConfigurationCurrency.Value.ExchangeRate;
     //Always Update Entry Value too paymentAmountTotal to prevent round values, this way when we change currency, we always assign to default paymentAmountTotal value
     _entryPaymentAmount.EntryValidation.Text = FrameworkUtils.DecimalToString(_paymentAmountTotal * _exchangeRate);
     //Call Validate
     Validate();
     //Call Update Title Bar
     UpdateTitleBar();
 }
Beispiel #11
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        //Helper Functions
        private void AddMoney(decimal pAmount)
        {
            if (_moneyPadMode != MoneyPadMode.Money)
            {
                _deliveryValue = 0.0m;
                _moneyPadMode  = MoneyPadMode.Money;
            }

            _deliveryValue          += pAmount;
            _entryDeliveryValue.Text = FrameworkUtils.DecimalToString(_deliveryValue);
        }
Beispiel #12
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        //Helper Methods

        private void ActivateButton(TouchButtonIconWithText pButton)
        {
            //If Changed Button, Clean old Values
            if (_selectedCashDrawerButton != pButton)
            {
                _entryBoxMovementAmountMoney.EntryValidation.Text = string.Empty;
                _entryBoxMovementDescription.EntryValidation.Text = string.Empty;
            }

            //Assign _selectedMovementType
            _selectedMovementType = (pos_worksessionmovementtype)FrameworkUtils.GetXPGuidObject(GlobalFramework.SessionXpo, typeof(pos_worksessionmovementtype), pButton.CurrentButtonOid);

            //Detect Cash open
            if (_selectedMovementType.Token == "CASHDRAWER_OPEN")
            {
                _entryBoxMovementAmountMoney.EntryValidation.Text      = FrameworkUtils.DecimalToString(_totalAmountInCashDrawer);
                _entryBoxMovementAmountMoney.EntryValidation.Sensitive = false;
                //Required to disable keyboard button
                _entryBoxMovementAmountMoney.ButtonKeyBoard.Sensitive = false;
                _entryBoxMovementAmountMoney.EntryValidation.Required = false;
                _entryBoxMovementAmountMoney.EntryValidation.Rule     = null;
            }
            else
            {
                _entryBoxMovementAmountMoney.EntryValidation.Required  = true;
                _entryBoxMovementAmountMoney.EntryValidation.Rule      = SettingsApp.RegexDecimalGreaterEqualThanZero;
                _entryBoxMovementAmountMoney.EntryValidation.Sensitive = true;
                //Required to enable keyboard button
                _entryBoxMovementAmountMoney.ButtonKeyBoard.Sensitive = true;
            }

            //Apply Requires Description for MONEY_IN and MONEY_OUT
            _entryBoxMovementDescription.EntryValidation.Required = (_selectedMovementType.Token == "CASHDRAWER_IN" || _selectedMovementType.Token == "CASHDRAWER_OUT");
            _entryBoxMovementDescription.EntryValidation.Validate();

            //Now we can UnToggle Old Selected Button
            if (_selectedCashDrawerButton != null)
            {
                //Toggle Button Off
                _selectedCashDrawerButton.ModifyBg(StateType.Normal, Utils.ColorToGdkColor(_colorBaseDialogDefaultButtonBackground));
            }

            //In the End Change reference to new Seleted Button
            _selectedCashDrawerButton = pButton;
            //Toggle Button On
            _selectedCashDrawerButton.ModifyBg(StateType.Normal, Utils.ColorToGdkColor(Utils.Lighten(_colorBaseDialogDefaultButtonBackground, 0.50f)));

            //Validate
            ValidateDialog();
        }
Beispiel #13
0
        private void PrintMasterTotalTax()
        {
            try
            {
                //Init DataTable
                DataRow    dataRow       = null;
                DataTable  dataTable     = new DataTable();
                DataColumn dcDesignation = new DataColumn("Designation", typeof(String));
                DataColumn dcTax         = new DataColumn("Tax", typeof(String));
                DataColumn dcTaxBase     = new DataColumn("TaxBase", typeof(String));
                DataColumn dcTotal       = new DataColumn("Total", typeof(String));
                dataTable.Columns.Add(dcDesignation);
                dataTable.Columns.Add(dcTax);
                dataTable.Columns.Add(dcTaxBase);
                dataTable.Columns.Add(dcTotal);

                foreach (FRBODocumentFinanceMasterTotalView item in _documentFinanceMasterTotalList)
                {
                    dataRow    = dataTable.NewRow();
                    dataRow[0] = item.Designation;
                    dataRow[1] = string.Format("{0}%", FrameworkUtils.DecimalToString(item.Value));
                    dataRow[2] = FrameworkUtils.DecimalToString(_documentFinanceMasterList[0].ExchangeRate * item.TotalBase);
                    dataRow[3] = FrameworkUtils.DecimalToString(_documentFinanceMasterList[0].ExchangeRate * item.Total);
                    dataTable.Rows.Add(dataRow);
                }

                //Configure Ticket Column Properties
                List <TicketColumn> columns = new List <TicketColumn>();
                columns.Add(new TicketColumn("Designation", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_designation"), 0, TicketColumnsAlign.Left));
                columns.Add(new TicketColumn("Tax", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_tax"), 8, TicketColumnsAlign.Right));
                columns.Add(new TicketColumn("TotalBase", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_total_tax_base"), 12, TicketColumnsAlign.Right));
                columns.Add(new TicketColumn("Total", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_documentfinance_totaltax_acronym"), 10, TicketColumnsAlign.Right));

                //TicketTable(DataTable pDataTable, List<TicketColumn> pColumnsProperties, int pTableWidth)
                TicketTable ticketTable = new TicketTable(dataTable, columns, _thermalPrinterGeneric.MaxCharsPerLineNormal);
                //Print Table Buffer
                ticketTable.Print(_thermalPrinterGeneric);

                //Line Feed
                _thermalPrinterGeneric.LineFeed();
            }
            catch (Exception ex)
            {
                _log.Debug("void PrintMasterTotalTax() :: Thermal Printer: " + ex.Message, ex);
                throw ex;
            }
        }
        private void PrintDocumentDetails()
        {
            _thermalPrinterGeneric.WriteLine(Resx.global_total_cashdrawer);
            _thermalPrinterGeneric.WriteLine(FrameworkUtils.DecimalToString(_totalAmountInCashDrawer), WriteLineTextMode.Big);
            _thermalPrinterGeneric.LineFeed();

            if (_movementAmount < 0.0m || _movementAmount > 0.0m)
            {
                _thermalPrinterGeneric.WriteLine(Resx.global_movement_amount);
                _thermalPrinterGeneric.WriteLine(FrameworkUtils.DecimalToString(_movementAmount), WriteLineTextMode.Big);
                _thermalPrinterGeneric.LineFeed();
            }

            string description = (_movementDescription != string.Empty) ? _movementDescription : "________________________________";

            _thermalPrinterGeneric.WriteLine(Resx.global_description);
            _thermalPrinterGeneric.WriteLine(description);
        }
        private void PrintDocumentDetails()
        {
            _thermalPrinterGeneric.WriteLine(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_total_cashdrawer"));
            _thermalPrinterGeneric.WriteLine(FrameworkUtils.DecimalToString(_totalAmountInCashDrawer), WriteLineTextMode.Big);
            _thermalPrinterGeneric.LineFeed();

            if (_movementAmount < 0.0m || _movementAmount > 0.0m)
            {
                _thermalPrinterGeneric.WriteLine(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_movement_amount"));
                _thermalPrinterGeneric.WriteLine(FrameworkUtils.DecimalToString(_movementAmount), WriteLineTextMode.Big);
                _thermalPrinterGeneric.LineFeed();
            }

            string description = (_movementDescription != string.Empty) ? _movementDescription : "________________________________";

            _thermalPrinterGeneric.WriteLine(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_description"));
            _thermalPrinterGeneric.WriteLine(description);
        }
        public string Format(string format, object arg, IFormatProvider formatProvider)
        {
            string result = string.Empty;;

            try
            {
                if (arg.ToString() != string.Empty)
                {
                    //Require to Convert Exponential from string to decimal
                    result = FrameworkUtils.DecimalToString(Convert.ToDecimal(double.Parse(arg.ToString())));
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
            return(result);
        }
Beispiel #17
0
        void _entryBoxSelectArticle_ClosePopup(object sender, EventArgs e)
        {
            //Prepare Objects


            fin_article article = _entryBoxSelectArticle.Value;
            fin_configurationpricetype configurationPriceTypeDefault = (fin_configurationpricetype)GlobalFramework.SessionXpo.GetObjectByKey(typeof(fin_configurationpricetype), SettingsApp.XpoOidConfigurationPriceTypeDefault);


            _entryBoxSelectArticleCode.Entry.Text = article.Code;
            _entryBoxSelectArticle.Entry.Text     = article.Designation;
            //Get PriceType from Customer.PriceType or from default if a New Customer or a Customer without PriceType Defined in BackOffice, always revert to Price1
            PriceType priceType = (_customer != null)
                ? (PriceType)_customer.PriceType.EnumValue
                : (PriceType)configurationPriceTypeDefault.EnumValue
            ;

            //Common changes for MediaNova | Non-MediaNova Articles | Here Prices are always in Retail Mode
            PriceProperties priceProperties = FrameworkUtils.GetArticlePrice(article, priceType, TaxSellType.Normal);

            //Price
            _articlePrice = priceProperties.PriceNet;
            //Display Price
            _entryBoxValidationPrice.EntryValidation.Text        = FrameworkUtils.DecimalToString(_articlePrice);
            _entryBoxValidationPriceDisplay.EntryValidation.Text = FrameworkUtils.DecimalToString(_articlePrice * _currencyDisplay.ExchangeRate);
            _entryBoxValidationQuantity.EntryValidation.Text     = (article.DefaultQuantity > 0) ? FrameworkUtils.DecimalToString(article.DefaultQuantity) : FrameworkUtils.DecimalToString(1.0m);
            _entryBoxValidationDiscount.EntryValidation.Text     = FrameworkUtils.DecimalToString(article.Discount);

            //VatRate
            _entryBoxSelectVatRate.Value      = article.VatDirectSelling;
            _entryBoxSelectVatRate.Entry.Text = article.VatDirectSelling.Designation;

            //Default Vat Exception Reason
            if (article.VatExemptionReason != null)
            {
                _entryBoxSelectVatExemptionReason.Value      = article.VatExemptionReason;
                _entryBoxSelectVatExemptionReason.Entry.Text = article.VatExemptionReason.Designation;
            }

            //Toggle ToggleVatExemptionReasonEditMode Validation
            ToggleVatExemptionReasonEditMode();
            //Update Price Properties
            UpdatePriceProperties();
        }
Beispiel #18
0
        private bool ValidateMaxArticleQuantity()
        {
            bool   result = true;
            string invalidArticleQuantity = string.Empty;

            try
            {
                /* IN009171 - when receiving a '.' on it, converter throws "System.FormatException" */
                string quantity = _entryBoxValidationQuantity.EntryValidation.Text;
                if (!string.IsNullOrEmpty(quantity))
                {
                    quantity = FrameworkUtils.DecimalToString(FrameworkUtils.StringToDecimal(quantity));
                    quantity = quantity.Replace('.', ',');
                }
                decimal currentQuantity = Convert.ToDecimal(quantity);
                // Validate Max Quantities only if ValidateMaxQuantities is defined
                if (_posDocumentFinanceDialog.ValidateMaxQuantities != null && _posDocumentFinanceDialog.ValidateMaxQuantities.Count > 0)
                {
                    decimal maxPossibleQuantity = _posDocumentFinanceDialog.ValidateMaxQuantities[_entryBoxSelectArticle.Value.Oid];

                    if (currentQuantity > maxPossibleQuantity)
                    {
                        _log.Debug(string.Format("CurrentQuantity: [{0}] is Greater than MaxPossibleQuantity: [{1}]", currentQuantity, maxPossibleQuantity));
                        result = false;
                    }

                    // Check if has Errrors, and Show Error Message
                    if (!result)
                    {
                        // Show Message
                        Utils.ShowMessageTouchErrorTryToIssueACreditNoteExceedingSourceDocumentArticleQuantities(this, currentQuantity, maxPossibleQuantity);
                    }
                }
            }
            catch (Exception ex)
            {
                _log.Error("bool ValidateMaxArticleQuantity() :: _entryBoxValidationQuantity.EntryValidation.Text [ " + _entryBoxValidationQuantity.EntryValidation.Text + " ]: " + ex.Message, ex);
            }

            return(result);
        }
Beispiel #19
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        //Static Methods

        public static decimal RequestDecimalValue(Window pSourceWindow, decimal pDefaultValue, bool pUseDefaultValue = true)
        {
            decimal result;
            String  regexDecimalGreaterThanZero = SettingsApp.RegexDecimalGreaterThanZero;
            String  defaultValue = (pUseDefaultValue) ? FrameworkUtils.DecimalToString(pDefaultValue) : string.Empty;

            PosKeyboardDialog dialog = new PosKeyboardDialog(pSourceWindow, DialogFlags.DestroyWithParent, KeyboardMode.Numeric, defaultValue, regexDecimalGreaterThanZero);
            int response             = dialog.Run();

            if (response == (int)ResponseType.Ok)
            {
                result = decimal.Parse(dialog.Text, GlobalFramework.CurrentCultureNumberFormat);
            }
            else
            {
                result = response;
            }
            dialog.Destroy();

            return(result);
        }
Beispiel #20
0
 public void ShowPayment(string pPaymentType, decimal pTotalDelivery, decimal pTotalChange)
 {
     Write(pPaymentType, 1);
     WriteJustified(FrameworkUtils.DecimalToString(pTotalDelivery), FrameworkUtils.DecimalToString(pTotalChange), 2);
     EnableStandBy();
 }
Beispiel #21
0
        public PosPaymentsDialog(Window pSourceWindow, DialogFlags pDialogFlags, ArticleBag pArticleBag, bool pEnablePartialPaymentButtons, bool pEnableCurrentAccountButton, bool pSkipPersistFinanceDocument, ProcessFinanceDocumentParameter pProcessFinanceDocumentParameter, string pSelectedPaymentMethodButtonName)
            : base(pSourceWindow, pDialogFlags, false)
        {
            try
            {
                //Init Local Vars
                _sourceWindow = pSourceWindow;
                string windowTitle = Resx.window_title_dialog_payments;
                //TODO:THEME
                Size   windowSize            = new Size(598, 620);
                string fileDefaultWindowIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\Windows\icon_window_payments.png");

                //Parameters
                _articleBagFullPayment           = pArticleBag;
                _skipPersistFinanceDocument      = pSkipPersistFinanceDocument;
                _processFinanceDocumentParameter = pProcessFinanceDocumentParameter;
                bool enablePartialPaymentButtons = pEnablePartialPaymentButtons;
                bool enableCurrentAccountButton  = pEnableCurrentAccountButton;
                if (enablePartialPaymentButtons)
                {
                    enablePartialPaymentButtons = (_articleBagFullPayment.TotalQuantity > 1) ? true : false;
                }
                //Files
                string fileIconClearCustomer  = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\icon_pos_nav_delete.png");
                string fileIconFullPayment    = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\icon_pos_payment_full.png");
                string fileIconPartialPayment = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\icon_pos_payment_partial.png");
                //Colors
                Color colorPosPaymentsDialogTotalPannelBackground = FrameworkUtils.StringToColor(GlobalFramework.Settings["colorPosPaymentsDialogTotalPannelBackground"]);
                //Objects
                _intialValueConfigurationCountry = SettingsApp.ConfigurationSystemCountry;

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
                //Payment Buttons
                //Get Custom Select Data
                string       executeSql   = @"SELECT Oid, Token, ResourceString FROM fin_configurationpaymentmethod ORDER BY Ord;";
                XPSelectData xPSelectData = FrameworkUtils.GetSelectedDataFromQuery(executeSql);
                //Get Required XpObjects from Selected Data
                FIN_ConfigurationPaymentMethod xpoMoney          = (FIN_ConfigurationPaymentMethod)xPSelectData.GetXPGuidObjectFromField(typeof(FIN_ConfigurationPaymentMethod), "Token", "MONEY");
                FIN_ConfigurationPaymentMethod xpoCheck          = (FIN_ConfigurationPaymentMethod)xPSelectData.GetXPGuidObjectFromField(typeof(FIN_ConfigurationPaymentMethod), "Token", "BANK_CHECK");
                FIN_ConfigurationPaymentMethod xpoMB             = (FIN_ConfigurationPaymentMethod)xPSelectData.GetXPGuidObjectFromField(typeof(FIN_ConfigurationPaymentMethod), "Token", "CASH_MACHINE");
                FIN_ConfigurationPaymentMethod xpoCreditCard     = (FIN_ConfigurationPaymentMethod)xPSelectData.GetXPGuidObjectFromField(typeof(FIN_ConfigurationPaymentMethod), "Token", "CREDIT_CARD");
                FIN_ConfigurationPaymentMethod xpoVisa           = (FIN_ConfigurationPaymentMethod)xPSelectData.GetXPGuidObjectFromField(typeof(FIN_ConfigurationPaymentMethod), "Token", "VISA");
                FIN_ConfigurationPaymentMethod xpoCurrentAccount = (FIN_ConfigurationPaymentMethod)xPSelectData.GetXPGuidObjectFromField(typeof(FIN_ConfigurationPaymentMethod), "Token", "CURRENT_ACCOUNT");
                FIN_ConfigurationPaymentMethod xpoCustomerCard   = (FIN_ConfigurationPaymentMethod)xPSelectData.GetXPGuidObjectFromField(typeof(FIN_ConfigurationPaymentMethod), "Token", "CUSTOMER_CARD");

                //Instantiate Buttons
                TouchButtonIconWithText buttonMoney = new TouchButtonIconWithText("touchButtonMoney_Green", _colorBaseDialogDefaultButtonBackground, Resx.ResourceManager.GetString(xpoMoney.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoMoney.ButtonIcon)), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height)
                {
                    CurrentButtonOid = xpoMoney.Oid, Sensitive = (xpoMoney.Disabled) ? false : true
                };
                TouchButtonIconWithText buttonCheck = new TouchButtonIconWithText("touchButtonCheck_Green", _colorBaseDialogDefaultButtonBackground, Resx.ResourceManager.GetString(xpoCheck.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoCheck.ButtonIcon)), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height)
                {
                    CurrentButtonOid = xpoCheck.Oid, Sensitive = (xpoCheck.Disabled) ? false : true
                };
                TouchButtonIconWithText buttonMB = new TouchButtonIconWithText("touchButtonMB_Green", _colorBaseDialogDefaultButtonBackground, Resx.ResourceManager.GetString(xpoMB.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoMB.ButtonIcon)), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height)
                {
                    CurrentButtonOid = xpoMB.Oid, Sensitive = (xpoMB.Disabled) ? false : true
                };
                TouchButtonIconWithText buttonCreditCard = new TouchButtonIconWithText("touchButtonCreditCard_Green", _colorBaseDialogDefaultButtonBackground, Resx.ResourceManager.GetString(xpoCreditCard.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoCreditCard.ButtonIcon)), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height)
                {
                    CurrentButtonOid = xpoCreditCard.Oid, Sensitive = (xpoCreditCard.Disabled) ? false : true
                };
                TouchButtonIconWithText buttonVisa = new TouchButtonIconWithText("touchButtonVisa_Green", _colorBaseDialogDefaultButtonBackground, Resx.ResourceManager.GetString(xpoVisa.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoVisa.ButtonIcon)), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height)
                {
                    CurrentButtonOid = xpoVisa.Oid, Sensitive = (xpoVisa.Disabled) ? false : true
                };
                TouchButtonIconWithText buttonCurrentAccount = new TouchButtonIconWithText("touchButtonCurrentAccount_Green", _colorBaseDialogDefaultButtonBackground, Resx.ResourceManager.GetString(xpoCurrentAccount.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoCurrentAccount.ButtonIcon)), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height)
                {
                    CurrentButtonOid = xpoCurrentAccount.Oid, Sensitive = (xpoCurrentAccount.Disabled) ? false : true
                };
                TouchButtonIconWithText buttonCustomerCard = new TouchButtonIconWithText("touchButtonCustomerCard_Green", _colorBaseDialogDefaultButtonBackground, Resx.ResourceManager.GetString(xpoCustomerCard.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoCustomerCard.ButtonIcon)), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height)
                {
                    CurrentButtonOid = xpoCustomerCard.Oid, Sensitive = (xpoCustomerCard.Disabled) ? false : true
                };
                //Secondary Buttons
                //Events
                buttonMoney.Clicked          += buttonMoney_Clicked;
                buttonCheck.Clicked          += buttonCheck_Clicked;
                buttonMB.Clicked             += buttonMB_Clicked;
                buttonCreditCard.Clicked     += buttonCredit_Clicked;
                buttonVisa.Clicked           += buttonVisa_Clicked;
                buttonCurrentAccount.Clicked += buttonCurrentAccount_Clicked;
                buttonCustomerCard.Clicked   += buttonCustomerCard_Clicked;

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

                //Table
                uint  tablePaymentsPadding = 0;
                Table tablePayments        = new Table(2, 3, true)
                {
                    BorderWidth = 2
                };
                //Row 1
                tablePayments.Attach(buttonMoney, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding);
                tablePayments.Attach(buttonMB, 1, 2, 0, 1, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding);
                tablePayments.Attach(buttonVisa, 2, 3, 0, 1, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding);
                //Row 2
                tablePayments.Attach(buttonCheck, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding);
                tablePayments.Attach(buttonCreditCard, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding);
                if (enableCurrentAccountButton)
                {
                    tablePayments.Attach(
                        (SettingsApp.PosPaymentsDialogUseCurrentAccount) ? buttonCurrentAccount : buttonCustomerCard
                        , 2, 3, 1, 2, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding
                        );
                }

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

                //Labels
                Label labelTotal    = new Label(Resx.global_total_price_to_pay + ":");
                Label labelDelivery = new Label(Resx.global_total_deliver + ":");
                Label labelChange   = new Label(Resx.global_total_change + ":");
                _labelTotalValue = new Label(FrameworkUtils.DecimalToStringCurrency(_articleBagFullPayment.TotalFinal))
                {
                    //Total Width
                    WidthRequest = 120
                };
                _labelDeliveryValue = new Label(FrameworkUtils.DecimalToStringCurrency(0));
                _labelChangeValue   = new Label(FrameworkUtils.DecimalToStringCurrency(0));

                //Colors
                labelTotal.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.FromArgb(101, 137, 171)));
                labelDelivery.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.FromArgb(101, 137, 171)));
                labelChange.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.FromArgb(101, 137, 171)));
                _labelTotalValue.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.White));
                _labelDeliveryValue.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.White));
                _labelChangeValue.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.White));

                //Alignments
                labelTotal.SetAlignment(0, 0.5F);
                labelDelivery.SetAlignment(0, 0.5F);
                labelChange.SetAlignment(0, 0.5F);
                _labelTotalValue.SetAlignment(1, 0.5F);
                _labelDeliveryValue.SetAlignment(1, 0.5F);
                _labelChangeValue.SetAlignment(1, 0.5F);

                //labels Font
                Pango.FontDescription fontDescription = Pango.FontDescription.FromString("Bold 10");
                labelTotal.ModifyFont(fontDescription);
                labelDelivery.ModifyFont(fontDescription);
                labelChange.ModifyFont(fontDescription);
                Pango.FontDescription fontDescriptionValue = Pango.FontDescription.FromString("Bold 12");
                _labelTotalValue.ModifyFont(fontDescriptionValue);
                _labelDeliveryValue.ModifyFont(fontDescriptionValue);
                _labelChangeValue.ModifyFont(fontDescriptionValue);

                //Table TotalPannel
                uint  totalPannelPadding = 9;
                Table tableTotalPannel   = new Table(3, 2, false);
                tableTotalPannel.HeightRequest = 132;
                //Row 1
                tableTotalPannel.Attach(labelTotal, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding);
                tableTotalPannel.Attach(_labelTotalValue, 1, 2, 0, 1, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding);
                //Row 2
                tableTotalPannel.Attach(labelDelivery, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding);
                tableTotalPannel.Attach(_labelDeliveryValue, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding);
                //Row 3
                tableTotalPannel.Attach(labelChange, 0, 1, 2, 3, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding);
                tableTotalPannel.Attach(_labelChangeValue, 1, 2, 2, 3, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding);

                //TotalPannel
                EventBox eventboxTotalPannel = new EventBox();
                eventboxTotalPannel.BorderWidth = 3;
                eventboxTotalPannel.ModifyBg(StateType.Normal, Utils.ColorToGdkColor(colorPosPaymentsDialogTotalPannelBackground));
                eventboxTotalPannel.Add(tableTotalPannel);

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

                //Customer Name
                CriteriaOperator criteriaOperatorCustomerName = null;
                _entryBoxSelectCustomerName             = new XPOEntryBoxSelectRecordValidation <ERP_Customer, TreeViewCustomer>(_sourceWindow, Resx.global_customer, "Name", "Name", null, criteriaOperatorCustomerName, KeyboardMode.Alfa, SettingsApp.RegexAlfaNumeric, false);
                _entryBoxSelectCustomerName.ClosePopup += delegate
                {
                    GetCustomerDetails("Oid", _entryBoxSelectCustomerName.Value.Oid.ToString());
                    Validate();
                };
                _entryBoxSelectCustomerName.EntryValidation.Changed += _entryBoxSelectCustomerName_Changed;

                //Customer Discount
                _entryBoxCustomerDiscount = new EntryBoxValidation(_sourceWindow, Resx.global_discount, KeyboardMode.Alfa, SettingsApp.RegexPercentage, true);
                _entryBoxCustomerDiscount.EntryValidation.Text           = FrameworkUtils.DecimalToString(0.0m);
                _entryBoxCustomerDiscount.EntryValidation.Sensitive      = false;
                _entryBoxCustomerDiscount.EntryValidation.Changed       += _entryBoxCustomerDiscount_Changed;
                _entryBoxCustomerDiscount.EntryValidation.FocusOutEvent += delegate
                {
                    _entryBoxCustomerDiscount.EntryValidation.Text = FrameworkUtils.StringToDecimalAndToStringAgain(_entryBoxCustomerDiscount.EntryValidation.Text);
                };

                //Address
                _entryBoxCustomerAddress = new EntryBoxValidation(this, Resx.global_address, KeyboardMode.Alfa, SettingsApp.RegexAlfaNumericExtended, false);
                _entryBoxCustomerAddress.EntryValidation.Changed += delegate { Validate(); };

                //Locality
                _entryBoxCustomerLocality = new EntryBoxValidation(this, Resx.global_locality, KeyboardMode.Alfa, SettingsApp.RegexAlfa, false);
                _entryBoxCustomerLocality.EntryValidation.Changed += delegate { Validate(); };

                //ZipCode
                _entryBoxCustomerZipCode = new EntryBoxValidation(this, Resx.global_zipcode, KeyboardMode.Alfa, SettingsApp.ConfigurationSystemCountry.RegExZipCode, false);
                _entryBoxCustomerZipCode.WidthRequest             = 150;
                _entryBoxCustomerZipCode.EntryValidation.Changed += delegate { Validate(); };

                //City
                _entryBoxCustomerCity = new EntryBoxValidation(this, Resx.global_city, KeyboardMode.Alfa, SettingsApp.RegexAlfa, false);
                _entryBoxCustomerCity.WidthRequest             = 200;
                _entryBoxCustomerCity.EntryValidation.Changed += delegate { Validate(); };

                //Country
                CriteriaOperator criteriaOperatorCustomerCountry = CriteriaOperator.Parse("(Disabled IS NULL OR Disabled  <> 1) AND (RegExFiscalNumber IS NOT NULL AND RegExZipCode IS NOT NULL)");
                _entryBoxSelectCustomerCountry = new XPOEntryBoxSelectRecordValidation <CFG_ConfigurationCountry, TreeViewConfigurationCountry>(pSourceWindow, Resx.global_country, "Designation", "Oid", _intialValueConfigurationCountry, criteriaOperatorCustomerCountry, SettingsApp.RegexGuid, true);
                _entryBoxSelectCustomerCountry.WidthRequest = 235;
                //Extra Protection to prevent Customer without Country
                if (_entryBoxSelectCustomerCountry.Value != null)
                {
                    _entryBoxSelectCustomerCountry.EntryValidation.Validate(_entryBoxSelectCustomerCountry.Value.Oid.ToString());
                }
                _entryBoxSelectCustomerCountry.EntryValidation.IsEditable  = false;
                _entryBoxSelectCustomerCountry.ButtonSelectValue.Sensitive = false;
                _entryBoxSelectCustomerCountry.ClosePopup += delegate
                {
                    _selectedCountry = _entryBoxSelectCustomerCountry.Value;
                    //Require to Update RegEx and Criteria to filter Country Clients Only
                    _entryBoxSelectCustomerFiscalNumber.EntryValidation.Rule = _entryBoxSelectCustomerCountry.Value.RegExFiscalNumber;
                    _entryBoxCustomerZipCode.EntryValidation.Rule            = _entryBoxSelectCustomerCountry.Value.RegExZipCode;
                    //Clear Customer Fields, Except Country
                    ClearCustomer(false);
                    //Apply Criteria Operators
                    ApplyCriteriaToCustomerInputs();
                    //Call Main Validate
                    Validate();
                };

                //FiscalNumber
                CriteriaOperator criteriaOperatorFiscalNumber = null;
                _entryBoxSelectCustomerFiscalNumber = new XPOEntryBoxSelectRecordValidation <ERP_Customer, TreeViewCustomer>(_sourceWindow, Resx.global_fiscal_number, "FiscalNumber", "FiscalNumber", null, criteriaOperatorFiscalNumber, KeyboardMode.AlfaNumeric, _intialValueConfigurationCountry.RegExFiscalNumber, false);
                _entryBoxSelectCustomerFiscalNumber.EntryValidation.Changed += _entryBoxSelectCustomerFiscalNumber_Changed;

                //CardNumber
                CriteriaOperator criteriaOperatorCardNumber = null;//Now Criteria is assigned in ApplyCriteriaToCustomerInputs();
                _entryBoxSelectCustomerCardNumber             = new XPOEntryBoxSelectRecordValidation <ERP_Customer, TreeViewCustomer>(_sourceWindow, Resx.global_card_number, "CardNumber", "CardNumber", null, criteriaOperatorCardNumber, KeyboardMode.AlfaNumeric, SettingsApp.RegexAlfaNumericExtended, false);
                _entryBoxSelectCustomerCardNumber.ClosePopup += delegate
                {
                    if (_entryBoxSelectCustomerCardNumber.EntryValidation.Validated)
                    {
                        GetCustomerDetails("CardNumber", _entryBoxSelectCustomerCardNumber.EntryValidation.Text);
                    }
                    Validate();
                };

                //Notes
                _entryBoxCustomerNotes = new EntryBoxValidation(this, Resx.global_notes, KeyboardMode.Alfa, SettingsApp.RegexAlfaNumericExtended, false);
                _entryBoxCustomerNotes.EntryValidation.Changed += delegate { Validate(); };

                //Fill Dialog Inputs with Defaults FinalConsumerEntity Values
                if (_processFinanceDocumentParameter == null)
                {
                    //If ProcessFinanceDocumentParameter is not null fill Dialog with value from ProcessFinanceDocumentParameter, implemented for SplitPayments
                    GetCustomerDetails("Oid", SettingsApp.XpoOidDocumentFinanceMasterFinalConsumerEntity.ToString());
                }
                //Fill Dialog Inputs with Stored Values, ex when we Work with SplitPayments
                else
                {
                    //Apply Default Customer Entity
                    GetCustomerDetails("Oid", _processFinanceDocumentParameter.Customer.ToString());

                    //Assign Totasl and Discounts Values
                    _totalDelivery  = _processFinanceDocumentParameter.TotalDelivery;
                    _totalChange    = _processFinanceDocumentParameter.TotalChange;
                    _discountGlobal = _processFinanceDocumentParameter.ArticleBag.DiscountGlobal;
                    // Update Visual Components
                    _labelDeliveryValue.Text = FrameworkUtils.DecimalToStringCurrency(_totalDelivery);
                    _labelChangeValue.Text   = FrameworkUtils.DecimalToStringCurrency(_totalChange);
                    // Selects
                    _selectedCustomer = (ERP_Customer)FrameworkUtils.GetXPGuidObject(typeof(ERP_Customer), _processFinanceDocumentParameter.Customer);
                    _selectedCountry  = _selectedCustomer.Country;
                    // PaymentMethod
                    _selectedPaymentMethod = (FIN_ConfigurationPaymentMethod)FrameworkUtils.GetXPGuidObject(typeof(FIN_ConfigurationPaymentMethod), _processFinanceDocumentParameter.PaymentMethod);
                    // Restore Selected Payment Method, require to associate button reference to selectedPaymentMethodButton
                    if (!string.IsNullOrEmpty(pSelectedPaymentMethodButtonName))
                    {
                        switch (pSelectedPaymentMethodButtonName)
                        {
                        case "touchButtonMoney_Green":
                            _selectedPaymentMethodButton = buttonMoney;
                            break;

                        case "touchButtonCheck_Green":
                            _selectedPaymentMethodButton = buttonCheck;
                            break;

                        case "touchButtonMB_Green":
                            _selectedPaymentMethodButton = buttonMB;
                            break;

                        case "touchButtonCreditCard_Green":
                            _selectedPaymentMethodButton = buttonCreditCard;
                            break;

                        case "touchButtonVisa_Green":
                            _selectedPaymentMethodButton = buttonVisa;
                            break;

                        case "touchButtonCurrentAccount_Green":
                            _selectedPaymentMethodButton = buttonCurrentAccount;
                            break;

                        case "touchButtonCustomerCard_Green":
                            _selectedPaymentMethodButton = buttonCustomerCard;
                            break;
                        }

                        //Assign Payment Method after have Reference
                        AssignPaymentMethod(_selectedPaymentMethodButton);
                    }

                    //UpdateChangeValue, if we add/remove Splits we must recalculate ChangeValue
                    UpdateChangeValue();
                }

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

                //Pack Content

                HBox hboxPaymenstAndTotals = new HBox(false, 0);
                hboxPaymenstAndTotals.PackStart(tablePayments, true, true, 0);
                hboxPaymenstAndTotals.PackStart(eventboxTotalPannel, true, true, 0);

                HBox hboxCustomerNameAndCustomerDiscount = new HBox(true, 0);
                hboxCustomerNameAndCustomerDiscount.PackStart(_entryBoxSelectCustomerName, true, true, 0);
                hboxCustomerNameAndCustomerDiscount.PackStart(_entryBoxCustomerDiscount, true, true, 0);

                HBox hboxFiscalNumberAndCardNumber = new HBox(true, 0);
                hboxFiscalNumberAndCardNumber.PackStart(_entryBoxSelectCustomerFiscalNumber, true, true, 0);
                hboxFiscalNumberAndCardNumber.PackStart(_entryBoxSelectCustomerCardNumber, true, true, 0);

                HBox hboxZipCodeCityAndCountry = new HBox(false, 0);
                hboxZipCodeCityAndCountry.PackStart(_entryBoxCustomerZipCode, false, false, 0);
                hboxZipCodeCityAndCountry.PackStart(_entryBoxCustomerCity, false, false, 0);
                hboxZipCodeCityAndCountry.PackStart(_entryBoxSelectCustomerCountry, true, true, 0);

                VBox vboxContent = new VBox(false, 0);
                vboxContent.PackStart(hboxPaymenstAndTotals, true, true, 0);
                vboxContent.PackStart(hboxFiscalNumberAndCardNumber, true, true, 0);
                vboxContent.PackStart(hboxCustomerNameAndCustomerDiscount, true, true, 0);
                vboxContent.PackStart(_entryBoxCustomerAddress, true, true, 0);
                vboxContent.PackStart(_entryBoxCustomerLocality, true, true, 0);
                vboxContent.PackStart(hboxZipCodeCityAndCountry, true, true, 0);
                vboxContent.PackStart(_entryBoxCustomerNotes, true, true, 0);

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

                //ActionArea Buttons
                _buttonOk             = ActionAreaButton.FactoryGetDialogButtonType(PosBaseDialogButtonType.Ok);
                _buttonCancel         = ActionAreaButton.FactoryGetDialogButtonType(PosBaseDialogButtonType.Cancel);
                _buttonClearCustomer  = ActionAreaButton.FactoryGetDialogButtonType("touchButtonClearCustomer_DialogActionArea", Resx.global_button_label_payment_dialog_clear_client, fileIconClearCustomer);
                _buttonFullPayment    = ActionAreaButton.FactoryGetDialogButtonType("touchButtonFullPayment_DialogActionArea", Resx.global_button_label_payment_dialog_full_payment, fileIconFullPayment);
                _buttonPartialPayment = ActionAreaButton.FactoryGetDialogButtonType("touchButtonPartialPayment_DialogActionArea", Resx.global_button_label_payment_dialog_partial_payment, fileIconPartialPayment);
                // Enable if has selectedPaymentMethod defined, ex when working with SplitPayments
                _buttonOk.Sensitive          = (_selectedPaymentMethod != null);
                _buttonFullPayment.Sensitive = false;

                //ActionArea
                ActionAreaButtons actionAreaButtons = new ActionAreaButtons();
                actionAreaButtons.Add(new ActionAreaButton(_buttonClearCustomer, _responseTypeClearCustomer));
                if (enablePartialPaymentButtons)
                {
                    actionAreaButtons.Add(new ActionAreaButton(_buttonFullPayment, _responseTypeFullPayment));
                    actionAreaButtons.Add(new ActionAreaButton(_buttonPartialPayment, _responseTypePartialPayment));
                }

                actionAreaButtons.Add(new ActionAreaButton(_buttonOk, ResponseType.Ok));
                actionAreaButtons.Add(new ActionAreaButton(_buttonCancel, ResponseType.Cancel));

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

                //Init Object
                this.InitObject(this, pDialogFlags, fileDefaultWindowIcon, windowTitle, windowSize, vboxContent, actionAreaButtons);
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
Beispiel #22
0
        /// <summary>
        /// Get Document <Line>s Splitted by Tax and <DocumentTotals> Content
        ///     Linhas do Documento por Taxa (Line)
        ///     Resumo das linhas da fatura por taxa de imposto, e motivo de isenção ou não liquidação.
        ///     Deve existir uma, e uma só linha, por cada taxa (TaxType, TaxCountryRegion, TaxCode) e motivo de isenção ou não liquidação (TaxExemptionReason)
        /// </summary>
        /// <param name="DocumentMaster"></param>
        /// <returns></returns>
        public static string GetDocumentContentLinesAndDocumentTotals(FIN_DocumentFinanceMaster pDocumentMaster)
        {
            //Init Locals Vars
            string  result     = string.Empty;
            decimal taxPayable = 0.0m;
            decimal netTotal   = 0.0m;
            decimal grossTotal = 0.0m;
            //Prepare Node Name
            string nodeName = (pDocumentMaster.DocumentType.Credit) ? "CreditAmount" : "DebitAmount";

            try
            {
                string sql = string.Format(@"
                    SELECT 
	                    fdVat AS Vat,
	                    cvTaxType AS TaxType,
	                    cvTaxCode AS TaxCode,
	                    cvTaxCountryRegion AS TaxCountryRegion,
	                    SUM(fdTotalNet) AS TotalNet,
	                    SUM(fdTotalGross) AS TotalGross,
                        SUM(fdTotalDiscount) AS TotalDiscount,
	                    SUM(fdTotalTax) AS TotalTax,
	                    SUM(fdTotalFinal) AS TotalFinal,
	                    cxAcronym AS VatExemptionReasonAcronym
                    FROM
	                    view_documentfinance
                    WHERE 
	                    fmOid = '{0}'
                    GROUP BY
	                    fdVat,cvTaxType,cvTaxCode,cvTaxCountryRegion,cxAcronym
                    ORDER BY
	                    fdVat, VatExemptionReasonAcronym
                    ;"
                                           , pDocumentMaster.Oid
                                           );

                DataTable dtResult = FrameworkUtils.GetDataTableFromQuery(sql);

                //Init StringBuilder
                StringBuilder sb = new StringBuilder();

                foreach (DataRow item in dtResult.Rows)
                {
                    string taxExemptionReason = (!string.IsNullOrEmpty(item["VatExemptionReasonAcronym"].ToString()))
                        ? string.Format("{0}      <ns2:TaxExemptionReason>{1}</ns2:TaxExemptionReason>", Environment.NewLine, item["VatExemptionReasonAcronym"])
                        : string.Empty
                    ;

                    sb.Append(string.Format(@"    <Line>
      <ns2:{0}>{1}</ns2:{0}>
      <ns2:Tax>
        <ns2:TaxType>{2}</ns2:TaxType>
        <ns2:TaxCountryRegion>{3}</ns2:TaxCountryRegion>
        <ns2:TaxPercentage>{4}</ns2:TaxPercentage>
      </ns2:Tax>{5}
    </Line>
"
                                            , nodeName
                                            , FrameworkUtils.DecimalToString(Convert.ToDecimal(item["TotalNet"]), GlobalFramework.CurrentCultureNumberFormat)
                                            , item["TaxType"]
                                            , item["TaxCountryRegion"]
                                            , FrameworkUtils.DecimalToString(Convert.ToDecimal(item["Vat"]), GlobalFramework.CurrentCultureNumberFormat)
                                            , taxExemptionReason
                                            ));

                    //Sum DocumentTotals
                    taxPayable += Convert.ToDecimal(item["TotalTax"]);
                    netTotal   += Convert.ToDecimal(item["TotalNet"]);
                    //Is TotalFinal not db TotalGross
                    grossTotal += Convert.ToDecimal(item["TotalFinal"]);
                }

                //Add DocumentTotals
                sb.Append(string.Format(@"    <DocumentTotals>
      <ns2:TaxPayable>{0}</ns2:TaxPayable>
      <ns2:NetTotal>{1}</ns2:NetTotal>
      <ns2:GrossTotal>{2}</ns2:GrossTotal>
    </DocumentTotals>"
                                        , FrameworkUtils.DecimalToString(taxPayable, GlobalFramework.CurrentCultureNumberFormat)
                                        , FrameworkUtils.DecimalToString(netTotal, GlobalFramework.CurrentCultureNumberFormat)
                                        , FrameworkUtils.DecimalToString(grossTotal, GlobalFramework.CurrentCultureNumberFormat)
                                        ));

                result = sb.ToString();
            }
            catch (Exception ex)
            {
                throw (ex);
            }

            return(result);
        }
        private void InitUI()
        {
            try
            {
                bool                  debug                = false;
                uint                  padding              = 5;
                decimal               exchangeRate         = _configurationCurrency.ExchangeRate;
                List <Label>          labelsTitle          = new List <Label>();
                List <Label>          labelsValue          = new List <Label>();
                Pango.FontDescription fontDescriptionTitle = Pango.FontDescription.FromString("Bold 11");
                Pango.FontDescription fontDescriptionValue = Pango.FontDescription.FromString("11");

                //Titles: Table Tax
                Label labelTitleTaxDesignation = new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_designation"));
                Label labelTitleTaxValue       = new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_tax"));
                Label labelTitleTaxBase        = new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_total_tax_base"));
                Label labelTitleTaxTotal       = new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_documentfinance_totaltax_acronym"));
                //Titles: Table Totals
                Label labelTitleDiscountCustomer = new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_documentfinance_discount_customer") + " (%)"); /* IN009206 */
                Label labelTitleTotalNet         = new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_totalnet"));
                Label labelTitleTotalGross       = new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_documentfinance_totalgross"));
                Label labelTitleDiscountTotal    = new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_documentfinance_total_discount")); /* IN009206 */
                /* IN009206 */
                //Label labelTitleDiscountPaymentConditions = new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_documentfinance_discount_payment_conditions);
                Label labelTitleTotalTax   = new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_documentfinance_totaltax")); /* IN009206 */
                Label labelTitleTotalFinal = new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_documentfinance_totalfinal"));

                //Values: Table Totals
                /* IN009206 - Begin */
                Label labelValueTotalGross       = new Label(FrameworkUtils.DecimalToString(_articleBag.TotalGross * exchangeRate));
                Label labelValueDiscountCustomer = new Label(FrameworkUtils.DecimalToString(_articleBag.DiscountGlobal))
                {
                    WidthRequest = 100
                };
                /* IN009206 */
                //Label labelValueDiscountPaymentConditions  = new Label(FrameworkUtils.DecimalToString(0.0m));
                Label labelValueDiscountTotal = new Label(FrameworkUtils.DecimalToString(_articleBag.TotalDiscount * exchangeRate));
                Label labelValueTotalNet      = new Label(FrameworkUtils.DecimalToString(_articleBag.TotalNet * exchangeRate));
                Label labelValueTotalTax      = new Label(FrameworkUtils.DecimalToString(_articleBag.TotalTax * exchangeRate));
                Label labelValueTotalFinal    = new Label(FrameworkUtils.DecimalToString(_articleBag.TotalFinal * exchangeRate));
                //Add to Titles List
                labelsTitle.Add(labelTitleTaxDesignation);
                labelsTitle.Add(labelTitleTaxValue);
                labelsTitle.Add(labelTitleTaxBase);
                labelsTitle.Add(labelTitleTaxTotal);

                labelsTitle.Add(labelTitleTotalGross);
                labelsValue.Add(labelValueTotalGross);

                labelsTitle.Add(labelTitleDiscountCustomer);
                labelsValue.Add(labelValueDiscountCustomer);

                /* IN009206 */
                //labelsTitle.Add(labelTitleDiscountPaymentConditions);
                //labelsValue.Add(labelValueDiscountPaymentConditions);

                labelsTitle.Add(labelTitleDiscountTotal);
                labelsValue.Add(labelValueDiscountTotal);

                labelsTitle.Add(labelTitleTotalNet);
                labelsValue.Add(labelValueTotalNet);

                labelsTitle.Add(labelTitleTotalTax);
                labelsValue.Add(labelValueTotalTax);
                /* IN009206 - End */

                labelsTitle.Add(labelTitleTotalFinal);
                labelsValue.Add(labelValueTotalFinal);

                //Add Tax Table and Rows
                uint  row      = 0;
                Table tableTax = new Table(Convert.ToUInt16(_articleBag.TaxBag.Count), 4, false);
                //tableTax.WidthRequest = 380;
                //Row0
                tableTax.Attach(labelTitleTaxDesignation, 0, 1, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding);
                tableTax.Attach(labelTitleTaxValue, 1, 2, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding);
                tableTax.Attach(labelTitleTaxBase, 2, 3, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding);
                tableTax.Attach(labelTitleTaxTotal, 3, 4, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding);
                foreach (var item in _articleBag.TaxBag.OrderBy(i => i.Key))
                {
                    row++;
                    if (_debug)
                    {
                        _log.Debug(string.Format("{0}:{1}:{2}:{3}", item.Value.Designation, item.Key, item.Value.TotalBase, item.Value.Total));
                    }
                    //Prepare Labels
                    Label labelDesignation = new Label(item.Value.Designation);
                    Label labelValue       = new Label(FrameworkUtils.DecimalToString(item.Key));
                    Label labelTotalBase   = new Label(FrameworkUtils.DecimalToString(item.Value.TotalBase * exchangeRate));
                    Label labelTotal       = new Label(FrameworkUtils.DecimalToString(item.Value.Total * exchangeRate));
                    //Add Row
                    tableTax.Attach(labelDesignation, 0, 1, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding);
                    tableTax.Attach(labelValue, 1, 2, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding);
                    tableTax.Attach(labelTotalBase, 2, 3, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding);
                    tableTax.Attach(labelTotal, 3, 4, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding);
                    //Add References to List
                    labelsValue.Add(labelDesignation);
                    labelsValue.Add(labelValue);
                    labelsValue.Add(labelTotalBase);
                    labelsValue.Add(labelTotal);
                }

                //Add Totals Table and Rows
                row = 0;
                Table tableTotal = new Table(6, 2, false);
                //tableTax.WidthRequest = 280;
                //Row0
                tableTotal.Attach(labelTitleTotalGross, 0, 1, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding); /* IN009206 */
                tableTotal.Attach(labelValueTotalGross, 1, 2, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding); /* IN009206 */
                //Row1
                row++;
                tableTotal.Attach(labelTitleDiscountCustomer, 0, 1, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding);
                tableTotal.Attach(labelValueDiscountCustomer, 1, 2, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding);
                //Row2
                row++;
                /* IN009206 */
                //tableTotal.Attach(labelTitleDiscountPaymentConditions, 0, 1, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding);
                //tableTotal.Attach(labelValueDiscountPaymentConditions, 1, 2, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding);
                //Row3
                /* IN009206 */
                row++;
                tableTotal.Attach(labelTitleDiscountTotal, 0, 1, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding);
                tableTotal.Attach(labelValueDiscountTotal, 1, 2, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding);
                //Row4
                /* IN009206 */
                row++;
                tableTotal.Attach(labelTitleTotalNet, 0, 1, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding);
                tableTotal.Attach(labelValueTotalNet, 1, 2, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding);
                //Row5
                row++;
                tableTotal.Attach(labelTitleTotalTax, 0, 1, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding);
                tableTotal.Attach(labelValueTotalTax, 1, 2, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding);
                //Row6
                row++;
                tableTotal.Attach(labelTitleTotalFinal, 0, 1, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding);
                tableTotal.Attach(labelValueTotalFinal, 1, 2, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, padding, padding);

                //Format labels Title
                foreach (Label label in labelsTitle)
                {
                    label.ModifyFont(fontDescriptionTitle);
                    label.SetAlignment(1.0F, 0.5F);
                }
                //Format labels Value
                foreach (Label label in labelsValue)
                {
                    label.ModifyFont(fontDescriptionValue);
                    label.SetAlignment(1.0F, 0.5F);
                }

                //Final Pack
                HBox hbox = new HBox(false, 20);

                EventBox eventboxTax = new EventBox()
                {
                    VisibleWindow = debug
                };
                eventboxTax.ModifyBg(StateType.Normal, Utils.ColorToGdkColor(Color.LightGray));
                eventboxTax.Add(tableTax);
                EventBox eventboxTotal = new EventBox()
                {
                    VisibleWindow = debug
                };
                eventboxTotal.ModifyBg(StateType.Normal, Utils.ColorToGdkColor(Color.LightGray));
                eventboxTotal.Add(tableTotal);

                hbox.PackStart(eventboxTax, true, true, 0);
                hbox.PackStart(eventboxTotal, false, false, 0);

                EventBox eventbox = new EventBox()
                {
                    VisibleWindow = debug, BorderWidth = padding
                };
                eventbox.ModifyBg(StateType.Normal, Utils.ColorToGdkColor(Color.LightCoral));
                eventbox.Add(hbox);

                _alignmentWindow = new Alignment(0.5f, 0.5f, 0.5f, 0.5f);
                _alignmentWindow.Add(eventbox);
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
Beispiel #24
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        //Add From ArticleBag Key/Props

        //NEW: Override/Replace Dictionary Add with() Custom Add()
        new public void Add(ArticleBagKey pKey, ArticleBagProperties pProps)
        {
            //Init local vars
            ArticleBagKey        key   = pKey;
            ArticleBagProperties props = pProps;

            //Get Fresh PriceProperties Helper Object to used for Addition (Vat and Totals)
            PriceProperties addPriceProperties = PriceProperties.GetPriceProperties(
                PricePropertiesSourceMode.FromPriceNet,
                false,
                pKey.Price,
                pProps.Quantity,
                pKey.Discount,
                this._discountGlobal,
                pKey.Vat
                );

            //If Key doesnt exists Add it
            if (!this.ContainsKey(key))
            {
                base.Add(key, props);
            }
            //Else Update Key, Increase Quantity
            else
            {
                this[key].Quantity += props.Quantity;
            }

            //Refresh Current Key Price Properties after Add Quantity)
            UpdateKeyProperties(key);

            //TaxBag Add Key
            if (!_taxBag.ContainsKey(key.Vat))
            {
                //Get Designation from Key
                //Get VatRate formated for filter, in sql server gives error without this it filters 23,0000 and not 23.0000 resulting in null vatRate
                string sql         = string.Format("SELECT Designation FROM fin_configurationvatrate WHERE VALUE = '{0}'", FrameworkUtils.DecimalToString(key.Vat, GlobalFramework.CurrentCultureNumberFormat));
                string designation = GlobalFramework.SessionXpo.ExecuteScalar(sql).ToString();
                //Now Add New Key with Designation
                _taxBag.Add(key.Vat, new TaxBagProperties(designation, addPriceProperties.TotalTax, addPriceProperties.TotalNet));
            }
            //Update Key, Add Vat
            else
            {
                _taxBag[key.Vat].Total     += addPriceProperties.TotalTax;
                _taxBag[key.Vat].TotalBase += addPriceProperties.TotalNet;
            }

            _totalQuantity += addPriceProperties.Quantity;
            _totalNet      += addPriceProperties.TotalNet;
            _totalGross    += addPriceProperties.TotalGross;
            _totalTax      += addPriceProperties.TotalTax;
            _totalDiscount += addPriceProperties.TotalDiscount;
            _totalFinal    += addPriceProperties.TotalFinal;
        }
Beispiel #25
0
        //Update TreeView TotalFinal, used when we change Customer Discount, this way we update Total Final for all Articles in TreeView
        public void UpdateTotalFinal()
        {
            bool debug = false;

            try
            {
                if (_treeViewArticles.DataSource.Rows.Count > 0)
                {
                    FIN_Article article;
                    //Get Discount from Select Customer
                    decimal discountGlobal = FrameworkUtils.StringToDecimal(_pagePad2.EntryBoxCustomerDiscount.EntryValidation.Text);
                    decimal exchangeRate   = _pagePad1.EntryBoxSelectConfigurationCurrency.Value.ExchangeRate;

                    //Update DataTable Rows
                    foreach (DataRow item in _treeViewArticles.DataSource.Rows)
                    {
                        article = (FIN_Article)FrameworkUtils.GetXPGuidObject(typeof(FIN_Article), new Guid(item.ItemArray[item.Table.Columns["Oid"].Ordinal].ToString()));

                        //Calc PriceProperties
                        PriceProperties priceProperties = PriceProperties.GetPriceProperties(
                            PricePropertiesSourceMode.FromPriceNet,
                            false,                                                                                                       //PriceWithVat
                            Convert.ToDecimal(item.ItemArray[item.Table.Columns["Price"].Ordinal]),                                      //Price
                            Convert.ToDecimal(item.ItemArray[item.Table.Columns["Quantity"].Ordinal]),                                   //Quantity
                            Convert.ToDecimal(item.ItemArray[item.Table.Columns["Discount"].Ordinal]),                                   //Discount
                            discountGlobal,
                            (item.ItemArray[item.Table.Columns["ConfigurationVatRate.Value"].Ordinal] as FIN_ConfigurationVatRate).Value //VatValue
                            );

                        //Finnally Update DataSourceRow Value with calculated PriceProperties
                        if (debug)
                        {
                            _log.Debug(string.Format("#1:TotalFinal DataSourceRow: [{0}], discountGlobal: [{1}]", FrameworkUtils.DecimalToString(Convert.ToDecimal(_treeViewArticles.DataSourceRow["TotalFinal"])), FrameworkUtils.DecimalToString(discountGlobal)));
                        }
                        //Update Display Values with ExchangeRate Multiplier
                        item["PriceDisplay"] = priceProperties.PriceNet * exchangeRate;
                        item["TotalNet"]     = (priceProperties.TotalNet * exchangeRate);
                        item["TotalFinal"]   = priceProperties.TotalFinal * exchangeRate;
                        item["PriceFinal"]   = priceProperties.PriceFinal * exchangeRate;
                        if (debug)
                        {
                            _log.Debug(string.Format("#2:TotalFinal DataSourceRow: [{0}], discountGlobal: [{1}]", FrameworkUtils.DecimalToString(Convert.ToDecimal(_treeViewArticles.DataSourceRow["TotalFinal"])), FrameworkUtils.DecimalToString(discountGlobal)));
                        }
                    }
                    //Call Refresh, Recreate TreeView from Model
                    _treeViewArticles.Refresh();
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
Beispiel #26
0
        public MoneyPad(Window pSourceWindow, decimal pInitialValue = 0.0m)
        {
            //Settings
            string fontMoneyPadButtonKeys = GlobalFramework.Settings["fontMoneyPadButtonKeys"];
            string fontMoneyPadTextEntry  = GlobalFramework.Settings["fontMoneyPadTextEntry"];
            //ButtonLabels
            string moneyButtonL1Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonL1Value);
            string moneyButtonL2Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonL2Value);
            string moneyButtonL3Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonL3Value);
            string moneyButtonL4Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonL4Value);
            string moneyButtonL5Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonL5Value);
            string moneyButtonR1Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonR1Value);
            string moneyButtonR2Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonR2Value);
            string moneyButtonR3Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonR3Value);
            string moneyButtonR4Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonR4Value);
            string moneyButtonR5Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonR5Value);

            //Local Vars
            Color colorFont           = Color.White;
            Size  numberPadButtonSize = new Size(100, 80);
            Size  moneyButtonSize     = new Size(100, 64);

            //Delivery Entry
            string initialValue = (pInitialValue > 0) ? FrameworkUtils.DecimalToString(pInitialValue) : string.Empty;

            _entryDeliveryValue = new EntryValidation(pSourceWindow, KeyboardMode.None, SettingsApp.RegexDecimal, true)
            {
                Text = initialValue, Alignment = 0.5F
            };
            _entryDeliveryValue.ModifyFont(Pango.FontDescription.FromString(fontMoneyPadTextEntry));
            //Dialog Validated Equal to Entry, Its the Only Entry in Dialog
            _validated = _entryDeliveryValue.Validated;
            //Event
            _entryDeliveryValue.Changed += _entry_Changed;

            //NumberPad
            _numberPad          = new NumberPad("numberPad", Color.Transparent, fontMoneyPadButtonKeys, (byte)numberPadButtonSize.Width, (byte)numberPadButtonSize.Height);
            _numberPad.Clicked += _numberPad_Clicked;

            //MoneyButtons Left
            _buttonKeyMBL1 = new TouchButtonText("touchButtonKeyMBL1_Green", Color.Transparent, moneyButtonL1Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height);
            _buttonKeyMBL2 = new TouchButtonText("touchButtonKeyMBL2_Green", Color.Transparent, moneyButtonL2Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height);
            _buttonKeyMBL3 = new TouchButtonText("touchButtonKeyMBL3_Green", Color.Transparent, moneyButtonL3Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height);
            _buttonKeyMBL4 = new TouchButtonText("touchButtonKeyMBL4_Green", Color.Transparent, moneyButtonL4Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height);
            _buttonKeyMBL5 = new TouchButtonText("touchButtonKeyMBL5_Green", Color.Transparent, moneyButtonL5Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height);
            //MoneyButtons Right
            _buttonKeyMBR1 = new TouchButtonText("touchButtonKeyMBR1_Green", Color.Transparent, moneyButtonR1Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height);
            _buttonKeyMBR2 = new TouchButtonText("touchButtonKeyMBR2_Green", Color.Transparent, moneyButtonR2Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height);
            _buttonKeyMBR3 = new TouchButtonText("touchButtonKeyMBR3_Green", Color.Transparent, moneyButtonR3Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height);
            _buttonKeyMBR4 = new TouchButtonText("touchButtonKeyMBR4_Green", Color.Transparent, moneyButtonR4Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height);
            _buttonKeyMBR5 = new TouchButtonText("touchButtonKeyMBR5_Green", Color.Transparent, moneyButtonR5Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height);
            //Events
            _buttonKeyMBL1.Clicked += buttonKeyMB_Clicked;
            _buttonKeyMBL2.Clicked += buttonKeyMB_Clicked;
            _buttonKeyMBL3.Clicked += buttonKeyMB_Clicked;
            _buttonKeyMBL4.Clicked += buttonKeyMB_Clicked;
            _buttonKeyMBL5.Clicked += buttonKeyMB_Clicked;
            _buttonKeyMBR1.Clicked += buttonKeyMB_Clicked;
            _buttonKeyMBR2.Clicked += buttonKeyMB_Clicked;
            _buttonKeyMBR3.Clicked += buttonKeyMB_Clicked;
            _buttonKeyMBR4.Clicked += buttonKeyMB_Clicked;
            _buttonKeyMBR5.Clicked += buttonKeyMB_Clicked;

            VBox vboxMoneyButtonsLeft = new VBox(true, 0);

            vboxMoneyButtonsLeft.PackStart(_buttonKeyMBL1, true, true, 0);
            vboxMoneyButtonsLeft.PackStart(_buttonKeyMBL2, true, true, 0);
            vboxMoneyButtonsLeft.PackStart(_buttonKeyMBL3, true, true, 0);
            vboxMoneyButtonsLeft.PackStart(_buttonKeyMBL4, true, true, 0);
            vboxMoneyButtonsLeft.PackStart(_buttonKeyMBL5, true, true, 0);

            VBox vboxMoneyButtonsRight = new VBox(true, 0);

            vboxMoneyButtonsRight.PackStart(_buttonKeyMBR1, true, true, 0);
            vboxMoneyButtonsRight.PackStart(_buttonKeyMBR2, true, true, 0);
            vboxMoneyButtonsRight.PackStart(_buttonKeyMBR3, true, true, 0);
            vboxMoneyButtonsRight.PackStart(_buttonKeyMBR4, true, true, 0);
            vboxMoneyButtonsRight.PackStart(_buttonKeyMBR5, true, true, 0);

            HBox hboxInput = new HBox(false, 5);

            hboxInput.PackStart(vboxMoneyButtonsLeft);
            hboxInput.PackStart(_numberPad);
            hboxInput.PackStart(vboxMoneyButtonsRight);

            //Vbox
            VBox vboxNumberPad = new VBox(false, 0);

            vboxNumberPad.PackStart(_entryDeliveryValue, false, true, 5);
            vboxNumberPad.PackStart(hboxInput, true, true, 5);

            //Pack It
            this.Add(vboxNumberPad);
        }
Beispiel #27
0
        public static bool Add(Session pSession, ProcessArticleStockMode pMode, FIN_DocumentFinanceDetail pDocumentDetail, ERP_Customer pCustomer, int pOrd, DateTime pDocumentDate, string pDocumentNumber, FIN_Article pArticle, decimal pQuantity, string pNotes)
        {
            //Log4Net
            log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            bool    result   = false;
            decimal quantity = 0.0m;

            try
            {
                switch (pMode)
                {
                case ProcessArticleStockMode.Out:
                    quantity = -(pQuantity);
                    break;

                case ProcessArticleStockMode.In:
                    quantity = pQuantity;
                    break;
                }

                //Get Objects in same Session
                ERP_Customer customer = (ERP_Customer)pSession.GetObjectByKey(typeof(ERP_Customer), pCustomer.Oid);
                FIN_Article  article  = (FIN_Article)pSession.GetObjectByKey(typeof(FIN_Article), pArticle.Oid);
                POS_ConfigurationPlaceTerminal terminal = (POS_ConfigurationPlaceTerminal)pSession.GetObjectByKey(typeof(POS_ConfigurationPlaceTerminal), GlobalFramework.LoggedTerminal.Oid);
                SYS_UserDetail userDetail = (SYS_UserDetail)pSession.GetObjectByKey(typeof(SYS_UserDetail), GlobalFramework.LoggedUser.Oid);

                FIN_ArticleStock articleStock = new FIN_ArticleStock(pSession)
                {
                    Customer     = customer,
                    Date         = pDocumentDate,
                    Article      = article,
                    Quantity     = quantity,
                    Notes        = pNotes,
                    CreatedWhere = terminal,
                    CreatedBy    = userDetail
                };
                if (pDocumentNumber != string.Empty)
                {
                    articleStock.DocumentNumber = pDocumentNumber;
                }
                if (pDocumentDetail != null)
                {
                    articleStock.DocumentNumber = pDocumentDetail.DocumentMaster.DocumentNumber;
                    articleStock.DocumentMaster = pDocumentDetail.DocumentMaster;
                    articleStock.DocumentDetail = pDocumentDetail;
                }

                //Only saves if not Working on a Unit Of Work Transaction
                if (pSession.GetType() != typeof(UnitOfWork))
                {
                    articleStock.Save();
                }

                //Audit
                switch (pMode)
                {
                case ProcessArticleStockMode.Out:
                    FrameworkUtils.Audit("STOCK_MOVEMENT_OUT", string.Format(Resx.audit_message_stock_movement_out, article.Designation, FrameworkUtils.DecimalToString(quantity, SettingsApp.DecimalFormatStockQuantity)));
                    break;

                case ProcessArticleStockMode.In:
                    FrameworkUtils.Audit("STOCK_MOVEMENT_IN", string.Format(Resx.audit_message_stock_movement_in, article.Designation, FrameworkUtils.DecimalToString(quantity, SettingsApp.DecimalFormatStockQuantity)));
                    break;
                }

                result = true;
            }
            catch (Exception ex)
            {
                log.Error(ex.Message, ex);
            }

            return(result);
        }
        //Totals, with TotalDelivery and TotalChange
        private void PrintMasterTotals()
        {
            try
            {
                //Init DataTable
                DataRow   dataRow   = null;
                DataTable dataTable = new DataTable();
                dataTable.Columns.Add(new DataColumn("Label", typeof(string)));
                dataTable.Columns.Add(new DataColumn("Value", typeof(string)));

                //Add Row : Discount
                if (_documentFinanceMasterList[0].Discount > 0.0m)
                {
                    dataRow    = dataTable.NewRow();
                    dataRow[0] = string.Format("{0} (%)", Resx.global_discount);
                    dataRow[1] = FrameworkUtils.DecimalToString(_documentFinanceMasterList[0].Discount);
                    dataTable.Rows.Add(dataRow);
                }
                //Add Row : TotalGross
                dataRow    = dataTable.NewRow();
                dataRow[0] = Resx.global_documentfinance_totalgross;
                //dataRow[1] = FrameworkUtils.DecimalToString(_documentFinanceMasterList[0].TotalGross * _documentFinanceMasterList[0].ExchangeRate);
                dataRow[1] = FrameworkUtils.DecimalToString(_documentFinanceMasterList[0].TotalNet * _documentFinanceMasterList[0].ExchangeRate);
                dataTable.Rows.Add(dataRow);
                //Add Row : TotalDiscount
                if (_documentFinanceMasterList[0].TotalDiscount > 0.0m)
                {
                    dataRow    = dataTable.NewRow();
                    dataRow[0] = Resx.global_documentfinance_discount_customer;
                    dataRow[1] = FrameworkUtils.DecimalToString(_documentFinanceMasterList[0].TotalDiscount * _documentFinanceMasterList[0].ExchangeRate);
                    dataTable.Rows.Add(dataRow);
                }
                //Add Row : Discount PaymentCondition
                //WIP Always 0
                //Add Row : TotalTax
                dataRow    = dataTable.NewRow();
                dataRow[0] = Resx.global_documentfinance_totaltax;
                dataRow[1] = FrameworkUtils.DecimalToString(_documentFinanceMasterList[0].TotalTax * _documentFinanceMasterList[0].ExchangeRate);
                dataTable.Rows.Add(dataRow);
                //Add Row : TotalFinal
                dataRow    = dataTable.NewRow();
                dataRow[0] = Resx.global_documentfinance_totalfinal;
                dataRow[1] = FrameworkUtils.DecimalToString(_documentFinanceMasterList[0].TotalFinal * _documentFinanceMasterList[0].ExchangeRate);
                dataTable.Rows.Add(dataRow);

                //If Simplified Invoice, Payment Method MONEY and has Total Change, add it
                if (new Guid(_documentFinanceMasterList[0].DocumentType) == SettingsApp.XpoOidDocumentFinanceTypeSimplifiedInvoice &&
                    _documentFinanceMasterList[0].PaymentMethodToken == "MONEY" &&
                    _documentFinanceMasterList[0].TotalChange > 0
                    )
                {
                    //Blank Row, to separate from Main Totals
                    dataRow    = dataTable.NewRow();
                    dataRow[0] = string.Empty;
                    dataRow[1] = string.Empty;
                    dataTable.Rows.Add(dataRow);
                    //TotalDelivery
                    dataRow    = dataTable.NewRow();
                    dataRow[0] = Resx.global_total_deliver;
                    dataRow[1] = FrameworkUtils.DecimalToString(_documentFinanceMasterList[0].TotalDelivery * _documentFinanceMasterList[0].ExchangeRate);
                    dataTable.Rows.Add(dataRow);
                    //TotalChange
                    dataRow    = dataTable.NewRow();
                    dataRow[0] = Resx.global_total_change;
                    dataRow[1] = FrameworkUtils.DecimalToString(_documentFinanceMasterList[0].TotalChange * _documentFinanceMasterList[0].ExchangeRate);
                    dataTable.Rows.Add(dataRow);
                }

                //Configure Ticket Column Properties
                List <TicketColumn> columns = new List <TicketColumn>();
                columns.Add(new TicketColumn("Label", "", Convert.ToInt16(_maxCharsPerLineNormal / 2) - 2, TicketColumnsAlign.Left));
                columns.Add(new TicketColumn("Value", "", Convert.ToInt16(_maxCharsPerLineNormal / 2) - 2, TicketColumnsAlign.Right));

                //TicketTable(DataTable pDataTable, List<TicketColumn> pColumnsProperties, int pTableWidth)
                TicketTable ticketTable = new TicketTable(dataTable, columns, _thermalPrinterGeneric.MaxCharsPerLineNormalBold);

                //Custom Print Loop, to Print all Table Rows, and Detect Rows to Print in DoubleHeight (TotalChange(4) and Total(7))
                List <string>     table = ticketTable.GetTable();
                WriteLineTextMode rowTextMode;
                //Dynamic Print All, some Rows ommited/bold(Table Header, TotalDocument,TotalChange)
                for (int i = 1; i < table.Count; i++)
                {
                    //Prepare TextMode Based on Row
                    rowTextMode = (i == 5 || i == 8) ? WriteLineTextMode.DoubleHeightBold : WriteLineTextMode.Bold;
                    //Print Row
                    _thermalPrinterGeneric.WriteLine(table[i], rowTextMode);
                }

                //Line Feed
                _thermalPrinterGeneric.LineFeed();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #29
0
        //Totals, with TotalDelivery and TotalChange
        private void PrintMasterTotals()
        {
            try
            {
                //Init DataTable
                DataRow   dataRow   = null;
                DataTable dataTable = new DataTable();
                dataTable.Columns.Add(new DataColumn("Label", typeof(string)));
                dataTable.Columns.Add(new DataColumn("Value", typeof(string)));

                //Add Row : Discount
                if (_documentFinanceMasterList[0].Discount > 0.0m)
                {
                    dataRow    = dataTable.NewRow();
                    dataRow[0] = string.Format("{0} (%)", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_documentfinance_discount_customer")); /* IN009211 */
                    dataRow[1] = FrameworkUtils.DecimalToString(_documentFinanceMasterList[0].Discount);
                    dataTable.Rows.Add(dataRow);
                }
                //Add Row : TotalDiscount
                if (_documentFinanceMasterList[0].TotalDiscount > 0.0m)
                {
                    dataRow    = dataTable.NewRow();
                    dataRow[0] = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_documentfinance_total_discount"); /* IN009211 */
                    dataRow[1] = FrameworkUtils.DecimalToString(_documentFinanceMasterList[0].TotalDiscount * _documentFinanceMasterList[0].ExchangeRate);
                    dataTable.Rows.Add(dataRow);
                }

                /* #TODO IN009214 */
                //Add Row : Discount PaymentCondition
                //WIP Always 0

                //Add Row : TotalNet
                dataRow    = dataTable.NewRow();
                dataRow[0] = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_totalnet"); /* IN009211 */
                //dataRow[1] = FrameworkUtils.DecimalToString(_documentFinanceMasterList[0].TotalGross * _documentFinanceMasterList[0].ExchangeRate);
                dataRow[1] = FrameworkUtils.DecimalToString(_documentFinanceMasterList[0].TotalNet * _documentFinanceMasterList[0].ExchangeRate);
                dataTable.Rows.Add(dataRow);
                //Add Row : TotalTax
                dataRow    = dataTable.NewRow();
                dataRow[0] = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_documentfinance_totaltax"); /* IN009211 */
                dataRow[1] = FrameworkUtils.DecimalToString(_documentFinanceMasterList[0].TotalTax * _documentFinanceMasterList[0].ExchangeRate);
                dataTable.Rows.Add(dataRow);
                //Add Row : TotalFinal
                dataRow    = dataTable.NewRow();
                dataRow[0] = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_documentfinance_totalfinal");
                dataRow[1] = FrameworkUtils.DecimalToString(_documentFinanceMasterList[0].TotalFinal * _documentFinanceMasterList[0].ExchangeRate);
                dataTable.Rows.Add(dataRow);

                //If Simplified Invoice, Payment Method MONEY and has Total Change, add it
                if (new Guid(_documentFinanceMasterList[0].DocumentType) == SettingsApp.XpoOidDocumentFinanceTypeSimplifiedInvoice &&
                    _documentFinanceMasterList[0].PaymentMethodToken == "MONEY" &&
                    _documentFinanceMasterList[0].TotalChange > 0
                    )
                {
                    //Blank Row, to separate from Main Totals
                    dataRow    = dataTable.NewRow();
                    dataRow[0] = string.Empty;
                    dataRow[1] = string.Empty;
                    dataTable.Rows.Add(dataRow);
                    //TotalDelivery
                    dataRow    = dataTable.NewRow();
                    dataRow[0] = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_total_deliver");
                    dataRow[1] = FrameworkUtils.DecimalToString(_documentFinanceMasterList[0].TotalDelivery * _documentFinanceMasterList[0].ExchangeRate);
                    dataTable.Rows.Add(dataRow);
                    //TotalChange
                    dataRow    = dataTable.NewRow();
                    dataRow[0] = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_total_change");
                    dataRow[1] = FrameworkUtils.DecimalToString(_documentFinanceMasterList[0].TotalChange * _documentFinanceMasterList[0].ExchangeRate);
                    dataTable.Rows.Add(dataRow);
                }

                /* IN009055 - related to IN005976 for Mozambique deployment */
                if (SettingsApp.XpoOidConfigurationCountryMozambique.Equals(SettingsApp.ConfigurationSystemCountry.Oid))
                {
                    cfg_configurationcurrency defaultCurrencyForExchangeRate =
                        (cfg_configurationcurrency)FrameworkUtils.GetXPGuidObject(
                            GlobalFramework.SessionXpo,
                            typeof(cfg_configurationcurrency),
                            SettingsApp.XpoOidConfigurationCurrencyUSDollar);

                    dataRow    = dataTable.NewRow();
                    dataRow[0] = string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_printer_thermal_total_default_currency"), defaultCurrencyForExchangeRate.Acronym);
                    dataRow[1] = FrameworkUtils.DecimalToString(_documentFinanceMasterList[0].TotalFinal * defaultCurrencyForExchangeRate.ExchangeRate);/* TO DO : IN009055 - this causes total equals 0,00 when low product price */
                    dataTable.Rows.Add(dataRow);
                }

                //Configure Ticket Column Properties
                List <TicketColumn> columns = new List <TicketColumn>();
                columns.Add(new TicketColumn("Label", "", Convert.ToInt16(_maxCharsPerLineNormal / 2) - 2, TicketColumnsAlign.Left));
                columns.Add(new TicketColumn("Value", "", Convert.ToInt16(_maxCharsPerLineNormal / 2) - 2, TicketColumnsAlign.Right));

                //TicketTable(DataTable pDataTable, List<TicketColumn> pColumnsProperties, int pTableWidth)
                TicketTable ticketTable = new TicketTable(dataTable, columns, _thermalPrinterGeneric.MaxCharsPerLineNormalBold);

                //Custom Print Loop, to Print all Table Rows, and Detect Rows to Print in DoubleHeight (TotalChange(4) and Total(7))
                List <string>     table = ticketTable.GetTable();
                WriteLineTextMode rowTextMode;
                //Dynamic Print All, some Rows ommited/bold(Table Header, TotalDocument,TotalChange)
                for (int i = 1; i < table.Count; i++)
                {
                    //Prepare TextMode Based on Row
                    rowTextMode = (i == 5 || i == 8) ? WriteLineTextMode.DoubleHeightBold : WriteLineTextMode.Bold;
                    //Print Row
                    _thermalPrinterGeneric.WriteLine(table[i], rowTextMode);
                }

                //Line Feed
                _thermalPrinterGeneric.LineFeed();
            }
            catch (Exception ex)
            {
                _log.Debug("void PrintMasterTotals() :: Thermal Printer: " + ex.Message, ex);
                throw ex;
            }
        }
Beispiel #30
0
        private void InitUI()
        {
            //Init Local Vars

            //Default Values (INSERT)
            FIN_Article initialValueSelectArticle = (_dataSourceRow["Article.Code"] as FIN_Article);
            string      initialValuePrice         = FrameworkUtils.DecimalToString(0);
            string      initialValuePriceDisplay  = FrameworkUtils.DecimalToString(0);
            string      initialValueQuantity      = FrameworkUtils.DecimalToString(0);
            string      initialValueDiscount      = FrameworkUtils.DecimalToString(0);
            string      initialValueTotalNet      = FrameworkUtils.DecimalToString(0);
            string      initialValueTotalFinal    = FrameworkUtils.DecimalToString(0);
            string      initialValueNotes         = string.Empty;
            FIN_ConfigurationVatRate            initialValueSelectConfigurationVatRate            = (FIN_ConfigurationVatRate)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_ConfigurationVatRate), SettingsApp.XpoOidArticleDefaultVatDirectSelling);
            FIN_ConfigurationVatExemptionReason initialValueSelectConfigurationVatExemptionReason = null;

            //Update Record : Override Default Values
            if (initialValueSelectArticle != null && initialValueSelectArticle.Oid != Guid.Empty)
            {
                //Always display Values from DataRow, for Both INSERT and UPDATE Modes, We Have defaults comming from ColumnProperties
                initialValuePrice        = FrameworkUtils.StringToDecimalAndToStringAgain(_dataSourceRow["Price"].ToString());
                initialValuePriceDisplay = FrameworkUtils.StringToDecimalAndToStringAgain(_dataSourceRow["PriceDisplay"].ToString());
                initialValueQuantity     = FrameworkUtils.StringToDecimalAndToStringAgain(_dataSourceRow["Quantity"].ToString());
                initialValueDiscount     = FrameworkUtils.StringToDecimalAndToStringAgain(_dataSourceRow["Discount"].ToString());
                initialValueTotalNet     = FrameworkUtils.StringToDecimalAndToStringAgain(_dataSourceRow["TotalNet"].ToString());
                initialValueTotalFinal   = FrameworkUtils.StringToDecimalAndToStringAgain(_dataSourceRow["TotalFinal"].ToString());
                initialValueSelectConfigurationVatRate            = (_dataSourceRow["ConfigurationVatRate.Value"] as FIN_ConfigurationVatRate);
                initialValueSelectConfigurationVatExemptionReason = (_dataSourceRow["VatExemptionReason.Acronym"] as FIN_ConfigurationVatExemptionReason);
                initialValueNotes = _dataSourceRow["Notes"].ToString();
                //Required, Else Wrong Calculation in UPDATES, when Price is not Defined :
                //Reverse Price if not in default System Currency, else use value from Input
                _articlePrice = (_currencyDefaultSystem == _currencyDisplay)
                    ? FrameworkUtils.StringToDecimal(initialValuePriceDisplay)
                    : (FrameworkUtils.StringToDecimal(initialValuePriceDisplay) / _currencyDisplay.ExchangeRate)
                ;
            }

            //Initialize crudWidgetsList
            _crudWidgetList = new GenericCRUDWidgetListDataTable();

            //SelectArticle
            CriteriaOperator criteriaOperatorSelectArticle = CriteriaOperator.Parse("(Disabled IS NULL OR Disabled  <> 1)");

            _entryBoxSelectArticle = new XPOEntryBoxSelectRecord <FIN_Article, TreeViewArticle>(this, Resx.global_article, "Designation", "Oid", initialValueSelectArticle, criteriaOperatorSelectArticle);
            _entryBoxSelectArticle.Entry.IsEditable = false;
            //Add to WidgetList
            _crudWidgetSelectArticle = new GenericCRUDWidgetDataTable(_entryBoxSelectArticle, _entryBoxSelectArticle.Label, _dataSourceRow, "Oid", _regexGuid, true);
            _crudWidgetList.Add(_crudWidgetSelectArticle);
            //Used only to Update DataRow Column from Widget : Used to force Assign XPGuidObject ChildNames to Columns
            _crudWidgetList.Add(new GenericCRUDWidgetDataTable(_entryBoxSelectArticle, new Label(), _dataSourceRow, "Article.Code"));
            _crudWidgetList.Add(new GenericCRUDWidgetDataTable(_entryBoxSelectArticle, new Label(), _dataSourceRow, "Article.Designation"));
            //Events
            _entryBoxSelectArticle.ClosePopup += _entryBoxSelectArticle_ClosePopup;

            //Price : Used only in Debug Mode, to Inspect SystemCurrency Values : To View add it to hboxPriceQuantityDiscountAndTotals.PackStart
            //Note #1
            //Removed. this will trigger an error when use a zero Price WayBill to issue an Invoice, better use discount 100%
            //If not Saft Document Type 2, required greater than zero in Price, else we can have zero or greater from Document Type 2 (ex Transportation Guide)
            //string regExPrice = (!_listSaftDocumentType2.Contains(_documentFinanceType.Oid.ToString())) ? _regexDecimalGreaterThanZero : _regexDecimalGreaterEqualThanZero;
            // Now all regExPrice must be greater than Zero
            string regExPrice = _regexDecimalGreaterThanZero;

            _entryBoxValidationPrice = new EntryBoxValidation(this, "Price EUR(*)", KeyboardMode.Numeric, regExPrice, true);
            _entryBoxValidationPrice.EntryValidation.Text      = initialValuePrice;
            _entryBoxValidationPrice.EntryValidation.Sensitive = false;
            //Add to WidgetList
            _crudWidgetPrice = new GenericCRUDWidgetDataTable(_entryBoxValidationPrice, _entryBoxValidationPrice.Label, _dataSourceRow, "Price", regExPrice, true);
            _crudWidgetList.Add(_crudWidgetPrice);

            //PriceDisplay
            //Note #1
            //If not Saft Document Type 2, required greater than zero in Price, else we can have zero or greater from Document Type 2 (ex Transportation Guide)
            _entryBoxValidationPriceDisplay = new EntryBoxValidation(this, Resx.global_price, KeyboardMode.Numeric, regExPrice, true);
            _entryBoxValidationPriceDisplay.EntryValidation.Text = initialValuePriceDisplay;
            //Add to WidgetList
            _crudWidgetPriceDisplay = new GenericCRUDWidgetDataTable(_entryBoxValidationPriceDisplay, _entryBoxValidationPriceDisplay.Label, _dataSourceRow, "PriceDisplay", regExPrice, true);
            _crudWidgetList.Add(_crudWidgetPriceDisplay);
            //Events
            _entryBoxValidationPriceDisplay.EntryValidation.Changed += delegate
            {
                if (_crudWidgetPriceDisplay.Validated)
                {
                    //Reverse Price if not in default System Currency, else use value from Input
                    _articlePrice = (_currencyDefaultSystem == _currencyDisplay)
                        ? FrameworkUtils.StringToDecimal(_entryBoxValidationPriceDisplay.EntryValidation.Text)
                        : (FrameworkUtils.StringToDecimal(_entryBoxValidationPriceDisplay.EntryValidation.Text) / _currencyDisplay.ExchangeRate);
                    //Assign to System Currency Price
                    _entryBoxValidationPrice.EntryValidation.Text = FrameworkUtils.DecimalToString(_articlePrice);
                    UpdatePriceProperties();
                }
            };
            _entryBoxValidationPriceDisplay.EntryValidation.FocusOutEvent += delegate { _entryBoxValidationPriceDisplay.EntryValidation.Text = FrameworkUtils.StringToDecimalAndToStringAgain(_entryBoxValidationPriceDisplay.EntryValidation.Text); };

            //Start with _articlePrice Assigned: DISABLED
            //_articlePrice = (_currencyDefaultSystem == _currencyDisplay)
            //    ? FrameworkUtils.StringToDecimal(_entryBoxValidationPriceDisplay.EntryValidation.Text)
            //    : (FrameworkUtils.StringToDecimal(_entryBoxValidationPriceDisplay.EntryValidation.Text) / _currencyDisplay.ExchangeRate)
            //    ;

            //Quantity
            _entryBoxValidationQuantity = new EntryBoxValidation(this, Resx.global_quantity, KeyboardMode.Numeric, _regexDecimalGreaterThanZero, true);
            _entryBoxValidationQuantity.EntryValidation.Text = initialValueQuantity;
            //Add to WidgetList
            _crudWidgetQuantity = new GenericCRUDWidgetDataTable(_entryBoxValidationQuantity, _entryBoxValidationQuantity.Label, _dataSourceRow, "Quantity", _regexDecimalGreaterThanZero, true);
            _crudWidgetList.Add(_crudWidgetQuantity);
            //Events
            _entryBoxValidationQuantity.EntryValidation.Changed       += delegate { UpdatePriceProperties(); };
            _entryBoxValidationQuantity.EntryValidation.FocusOutEvent += delegate { _entryBoxValidationQuantity.EntryValidation.Text = FrameworkUtils.StringToDecimalAndToStringAgain(_entryBoxValidationQuantity.EntryValidation.Text); };

            //Discount
            _entryBoxValidationDiscount = new EntryBoxValidation(this, Resx.global_discount, KeyboardMode.Numeric, _regexPercentage, true);
            _entryBoxValidationDiscount.EntryValidation.Text = initialValueDiscount;
            //Add to WidgetList
            _crudWidgetDiscount = new GenericCRUDWidgetDataTable(_entryBoxValidationDiscount, _entryBoxValidationDiscount.Label, _dataSourceRow, "Discount", _regexPercentage, true);
            _crudWidgetList.Add(_crudWidgetDiscount);
            //Events
            _entryBoxValidationDiscount.EntryValidation.Changed       += delegate { UpdatePriceProperties(); };
            _entryBoxValidationDiscount.EntryValidation.FocusOutEvent += delegate { _entryBoxValidationDiscount.EntryValidation.Text = FrameworkUtils.StringToDecimalAndToStringAgain(_entryBoxValidationDiscount.EntryValidation.Text); };

            //TotalGross
            _entryBoxValidationTotalNet = new EntryBoxValidation(this, Resx.global_totalnet, KeyboardMode.None);
            _entryBoxValidationTotalNet.EntryValidation.Text      = initialValueTotalNet;
            _entryBoxValidationTotalNet.EntryValidation.Sensitive = false;
            //Used only to Update DataRow Column from Widget
            _crudWidgetList.Add(new GenericCRUDWidgetDataTable(_entryBoxValidationTotalNet, new Label(), _dataSourceRow, "TotalNet"));

            //TotalFinal
            _entryBoxValidationTotalFinal = new EntryBoxValidation(this, Resx.global_total, KeyboardMode.None);
            _entryBoxValidationTotalFinal.EntryValidation.Text      = initialValueTotalFinal;
            _entryBoxValidationTotalFinal.EntryValidation.Sensitive = false;
            //Used only to Update DataRow Column from Widget
            _crudWidgetList.Add(new GenericCRUDWidgetDataTable(_entryBoxValidationTotalFinal, new Label(), _dataSourceRow, "TotalFinal"));

            //HBox PriceQuantityDiscountAndTotals
            HBox hboxPriceQuantityDiscountAndTotals = new HBox(true, 0);

            //Invisible, only used to Debug, to View Values in System Currency
            //hboxPriceQuantityDiscountAndTotals.PackStart(_entryBoxValidationPrice, true, true, 0);
            hboxPriceQuantityDiscountAndTotals.PackStart(_entryBoxValidationPriceDisplay, true, true, 0);
            hboxPriceQuantityDiscountAndTotals.PackStart(_entryBoxValidationQuantity, true, true, 0);
            hboxPriceQuantityDiscountAndTotals.PackStart(_entryBoxValidationDiscount, true, true, 0);
            hboxPriceQuantityDiscountAndTotals.PackStart(_entryBoxValidationTotalNet, true, true, 0);
            hboxPriceQuantityDiscountAndTotals.PackStart(_entryBoxValidationTotalFinal, true, true, 0);

            //SelectVatRate
            CriteriaOperator criteriaOperatorSelectVatRate = CriteriaOperator.Parse("(Disabled = 0 OR Disabled IS NULL)");

            _entryBoxSelectVatRate = new XPOEntryBoxSelectRecord <FIN_ConfigurationVatRate, TreeViewConfigurationVatRate>(this, Resx.global_vat_rate, "Designation", "Oid", initialValueSelectConfigurationVatRate, criteriaOperatorSelectVatRate);
            _entryBoxSelectVatRate.WidthRequest     = 149;
            _entryBoxSelectVatRate.Entry.IsEditable = false;
            _entryBoxSelectVatRate.Entry.Changed   += _entryBoxSelectVatRate_EntryValidation_Changed;
            //Add to WidgetList
            _crudWidgetSelectVatRate = new GenericCRUDWidgetDataTable(_entryBoxSelectVatRate, _entryBoxSelectVatRate.Label, _dataSourceRow, "ConfigurationVatRate.Value", _regexGuid, true);
            _crudWidgetList.Add(_crudWidgetSelectVatRate);

            //SelectVatExemptionReason
            CriteriaOperator criteriaOperatorSelectVatExemptionReason = CriteriaOperator.Parse("(Disabled = 0 OR Disabled IS NULL)");

            _entryBoxSelectVatExemptionReason = new XPOEntryBoxSelectRecord <FIN_ConfigurationVatExemptionReason, TreeViewConfigurationVatExceptionReason>(this, Resx.global_vat_exemption_reason, "Designation", "Oid", initialValueSelectConfigurationVatExemptionReason, criteriaOperatorSelectVatExemptionReason);
            _entryBoxSelectVatExemptionReason.Entry.IsEditable = false;
            //Add to WidgetList
            _crudWidgetSelectVatExemptionReason = new GenericCRUDWidgetDataTable(_entryBoxSelectVatExemptionReason, _entryBoxSelectVatExemptionReason.Label, _dataSourceRow, "VatExemptionReason.Acronym", _regexGuid, true);
            _crudWidgetList.Add(_crudWidgetSelectVatExemptionReason);
            //ToggleMode: Edit Active/Inactive
            ToggleVatExemptionReasonEditMode();

            //HBox VatRateAndVatExemptionReason
            HBox hboxVatRateAndVatExemptionReason = new HBox(false, 0);

            hboxVatRateAndVatExemptionReason.PackStart(_entryBoxSelectVatRate, false, false, 0);
            hboxVatRateAndVatExemptionReason.PackStart(_entryBoxSelectVatExemptionReason, true, true, 0);

            //Token1
            _entryBoxValidationToken1 = new EntryBoxValidation(this, "Token1", KeyboardMode.None);
            _entryBoxValidationToken1.EntryValidation.Sensitive = false;
            //Used only to Update DataRow Column from Widget
            _crudWidgetList.Add(new GenericCRUDWidgetDataTable(_entryBoxValidationToken1, new Label(), _dataSourceRow, "Token1"));
            //Token2
            _entryBoxValidationToken2 = new EntryBoxValidation(this, "Token2", KeyboardMode.None);
            _entryBoxValidationToken2.EntryValidation.Sensitive = false;
            //Used only to Update DataRow Column from Widget
            _crudWidgetList.Add(new GenericCRUDWidgetDataTable(_entryBoxValidationToken2, new Label(), _dataSourceRow, "Token2"));

            //Notes
            _entryBoxValidationNotes = new EntryBoxValidation(this, "Notes", KeyboardMode.AlfaNumeric, SettingsApp.RegexAlfaNumericExtended, false);
            _entryBoxValidationNotes.EntryValidation.Text = initialValueNotes;
            _crudWidgetList.Add(new GenericCRUDWidgetDataTable(_entryBoxValidationNotes, new Label(), _dataSourceRow, "Notes"));

            //Uncomment to Show Invisible Widgets
            //HBox Token1AndToken2
            //HBox hboxToken1AndToken2 = new HBox(false, 0);
            //hboxToken1AndToken2.PackStart(_entryBoxToken1, false, false, 0);
            //hboxToken1AndToken2.PackStart(_entryBoxToken2, true, true, 0);

            //Pack in VBox
            _vboxEntrys = new VBox(true, 0);
            _vboxEntrys.PackStart(_entryBoxSelectArticle);
            _vboxEntrys.PackStart(hboxPriceQuantityDiscountAndTotals);
            _vboxEntrys.PackStart(hboxVatRateAndVatExemptionReason);
            //Uncomment to Show Invisible Widgets
            //_vboxEntrys.PackStart(hboxToken1AndToken2);
            _vboxEntrys.PackStart(_entryBoxValidationNotes);
            _vboxEntrys.WidthRequest = _windowSize.Width - 13;

            // CreditNote : Protect all components, only Quantity is Editable in CreditMode
            if (_documentFinanceType.Oid == SettingsApp.XpoOidDocumentFinanceTypeCreditNote)
            {
                //Article
                _entryBoxSelectArticle.Entry.Sensitive             = false;
                _entryBoxSelectArticle.ButtonSelectValue.Sensitive = false;
                //PriceDisplay
                _entryBoxValidationPriceDisplay.EntryValidation.Sensitive = false;
                _entryBoxValidationPriceDisplay.ButtonKeyBoard.Sensitive  = false;
                //Discount
                _entryBoxValidationDiscount.EntryValidation.Sensitive = false;
                _entryBoxValidationDiscount.ButtonKeyBoard.Sensitive  = false;
                //VatRate
                _entryBoxSelectVatRate.Entry.Sensitive             = false;
                _entryBoxSelectVatRate.ButtonSelectValue.Sensitive = false;
                //VatExemptionReason
                _entryBoxSelectVatExemptionReason.Entry.Sensitive             = false;
                _entryBoxSelectVatExemptionReason.ButtonSelectValue.Sensitive = false;
            }
        }