Ejemplo n.º 1
0
        private void Settings_Tax_Grid(object profile)
        {
            if (ConfigManager.Instance.CommonConfiguration.TAX_Compatibility == null)
                ConfigManager.Instance.CommonConfiguration.TAX_Compatibility = new Hashtable();

            if (ConfigManager.Instance.CommonConfiguration.TAX_DefinedRates == null)
                ConfigManager.Instance.CommonConfiguration.TAX_DefinedRates = new Hashtable();

            // check for default
            if (!ConfigManager.Instance.CommonConfiguration.TAX_Compatibility.ContainsKey(profile))
            {
                ConfigManager.Instance.CommonConfiguration.TAX_Compatibility[profile] = ConfigManager.Instance.CommonConfiguration.TAX_Compatibility_Template;
                ConfigManager.Instance.CommonConfiguration.TAX_DefinedRates[profile] = new Hashtable();
            }

            // get profile config
            Hashtable compatibleGrid = (Hashtable)ConfigManager.Instance.CommonConfiguration.TAX_Compatibility[profile];
            Hashtable definedGrid = (Hashtable)ConfigManager.Instance.CommonConfiguration.TAX_DefinedRates[profile];

            // load defined tax rates
            dataGridView_tax_userdefined.Rows.Clear();
            List<string> definedParameters = new List<string>();
            if (definedGrid != null)
            {
                SortedDictionary<string, string> sortedDefinedGrid = new SortedDictionary<string, string>();
                foreach (DictionaryEntry de in definedGrid)
                    sortedDefinedGrid[(string)de.Key] = de.Value.ToString();

                foreach (KeyValuePair<string, string> de in sortedDefinedGrid)
                {
                    definedParameters.Clear();
                    definedParameters.Add(de.Key.ToString());
                    definedParameters.AddRange(de.Value.ToString().Split(';'));
                    //definedParameters = de.Value.ToString().Split(';');
                    dataGridView_tax_userdefined.Rows.Add(definedParameters.ToArray());
                }
            }

            // load compatible grid
            dataGridView_tax_compatibility.Rows.Clear();
            SortedDictionary<char, char> sortedCompatibleGrid = new SortedDictionary<char, char>();
            if (compatibleGrid != null)
            {
                DataGridViewRow dwRow = null;
                DataGridViewComboBoxCell cbCell = null;
                DataGridViewTextBoxCell tbCell = null;

                foreach (DictionaryEntry de in compatibleGrid)
                    sortedCompatibleGrid[(char)de.Key] = (char)de.Value;

                foreach (KeyValuePair<char, char> de in sortedCompatibleGrid)
                {
                    cbCell = new DataGridViewComboBoxCell();
                    cbCell.ValueType = typeof(char);
                    cbCell.MaxDropDownItems = 8;
                    cbCell.Value = de.Value;

                    tbCell = new DataGridViewTextBoxCell();
                    tbCell.ValueType = typeof(char);
                    tbCell.Value = de.Key;

                    dwRow = new DataGridViewRow();
                    dwRow.Cells.Add(cbCell);
                    dwRow.Cells.Add(tbCell);

                    dataGridView_tax_compatibility.Rows.Add(dwRow);

                    cbCell.Dispose();
                    tbCell.Dispose();
                    dwRow.Dispose();
                }
                dataGridView_tax_compatibility.ReadOnly = false;
                dataGridView_tax_compatibility.Columns["mkt"].ReadOnly = true;
                dataGridView_tax_compatibility.Columns["mkt"].SortMode = DataGridViewColumnSortMode.Automatic;
                dataGridView_tax_compatibility.Sort(dataGridView_tax_compatibility.Columns["mkt"], ListSortDirection.Ascending);
            }

            UpdateTaxValues();

            try
            {
                if (compatibleGrid != null)
                {
                    int rowIndex = 0;
                    foreach (KeyValuePair<char, char> de in sortedCompatibleGrid)
                        dataGridView_tax_compatibility["pd", rowIndex++].Value = de.Value;
                }
            }
            catch { }

            //LoadAppTaxRates
            /*
            dataGridView_tax_userdefined.Rows.Clear();
            if (ConfigManager.Instance.CommonConfiguration.TAX_AppTaxChar != null)
                for (i = 0; i < ConfigManager.Instance.CommonConfiguration.TAX_AppTaxChar.Length; i++)
                {
                    dataGridView_tax_userdefined.Rows.Add(
                        ConfigManager.Instance.CommonConfiguration.TAX_AppTaxChar[i],
                        ConfigManager.Instance.CommonConfiguration.TAX_AppTaxRates[i],
                        ConfigManager.Instance.CommonConfiguration.TAX_AppTaxDisc[i]);
                }
            */
            //LoadComparableTaxTable
            /*
            DataGridViewRow dwRow = null;
            DataGridViewComboBoxCell cbCell = null;
            DataGridViewTextBoxCell tbCell = null;
            for (i = 0; i < ConfigManager.Instance.CommonConfiguration.TAX_MarketColumn.Length; i++)
            {
                cbCell = new DataGridViewComboBoxCell();
                cbCell.ValueType = typeof(char);
                cbCell.MaxDropDownItems = 8;
                cbCell.Value = ' ';

                tbCell = new DataGridViewTextBoxCell();
                tbCell.ValueType = typeof(char);
                tbCell.Value = ConfigManager.Instance.CommonConfiguration.TAX_MarketColumn[i];

                dwRow = new DataGridViewRow();
                dwRow.Cells.Add(cbCell);
                dwRow.Cells.Add(tbCell);

                dataGridView_tax_compatibility.Rows.Add(dwRow);

                cbCell.Dispose();
                tbCell.Dispose();
                dwRow.Dispose();
            }
            dataGridView_tax_compatibility.ReadOnly = false;
            dataGridView_tax_compatibility.Columns[1].ReadOnly = true;
            UpdateTaxValues();
            */
            //RestoreComparableValues
            /*
            try
            {
                if (ConfigManager.Instance.CommonConfiguration.TAX_AppColumn != null)
                    for (i = 0; i < ConfigManager.Instance.CommonConfiguration.TAX_AppColumn.Length; i++)
                        dataGridView_tax_compatibility["pd", i].Value = ConfigManager.Instance.CommonConfiguration.TAX_AppColumn[i];
            }
            catch { }
            */
        }
Ejemplo n.º 2
0
        private void Settings_Load(object sender, EventArgs e)
        {
            //#TAX
            //LoadAppTaxRates
            dataGridView2.Rows.Clear();
            if (AppConfig.TAX_AppTaxChar != null)
                for (i = 0; i < AppConfig.TAX_AppTaxChar.Length; i++)
                {
                    dataGridView2.Rows.Add(
                        AppConfig.TAX_AppTaxChar[i],
                        AppConfig.TAX_AppTaxRates[i],
                        AppConfig.TAX_AppTaxDisc[i]);
                }
            //LoadComparableTaxTable
            DataGridViewRow dwRow = null;
            DataGridViewComboBoxCell cbCell = null;
            DataGridViewTextBoxCell tbCell = null;
            for (i = 0; i < AppConfig.TAX_MarketColumn.Length; i++)
            {
                cbCell = new DataGridViewComboBoxCell();
                cbCell.ValueType = typeof(char);
                cbCell.MaxDropDownItems = 8;
                cbCell.Value = ' ';

                tbCell = new DataGridViewTextBoxCell();
                tbCell.ValueType = typeof(char);
                tbCell.Value = AppConfig.TAX_MarketColumn[i];

                dwRow = new DataGridViewRow();
                dwRow.Cells.Add(cbCell);
                dwRow.Cells.Add(tbCell);

                dataGridView1.Rows.Add(dwRow);

                cbCell.Dispose();
                tbCell.Dispose();
                dwRow.Dispose();
            }
            dataGridView1.ReadOnly = false;
            dataGridView1.Columns[1].ReadOnly = true;
            UpdateTaxValues();
            //RestoreComparableValues
            try
            {
                if (AppConfig.TAX_AppColumn != null)
                    for (i = 0; i < AppConfig.TAX_AppColumn.Length; i++)
                        dataGridView1["pd", i].Value = AppConfig.TAX_AppColumn[i];
            }
            catch { }

            //#COMMON
            //PayDesk
            sys_gen_kasaNom.Value = AppConfig.APP_PayDesk;
            //RefreshRate
            numericUpDown5.Value = AppConfig.APP_RefreshRate / 1000;
            //SubUnit
            sys_gen_pidrozd.Value = AppConfig.APP_SubUnit;
            //DefaultCountOfArticle
            textBox3.Text = AppConfig.APP_StartTotal.ToString();
            //SubUnitName
            textBox5.Text = AppConfig.APP_SubUnitName;
            //Customer's ID
            textBox1.Text = AppConfig.APP_ClientID;
            //WeightType
            comboBox1.SelectedIndex = AppConfig.APP_WeightType;
            //DefaultSearchType
            comboBox2.SelectedIndex = AppConfig.APP_SearchType;
            //Search Types Access
            // --> realized in Event (comboBox2_SelctedIndexChanged)

            //#PATH
            //Folder of Exchange
            phExTbBox.Text = AppConfig.Path_Exchnage;
            //Folder of Cheques
            phCheqTbBox.Text = AppConfig.Path_Cheques;
            //Folder of Bills
            phBillTbBox.Text = AppConfig.Path_Bills;
            //Folder of Articles
            phArtTBox.Text = AppConfig.Path_Articles;

            //#ADDITIONAL
            //Timeout request of refresh
            numericUpDown6.Value = AppConfig.APP_RefreshTimeout;
            //ChequeName
            maskedTextBox1.Text = AppConfig.APP_ChequeName;
            //Invent auto save
            numericUpDown3.Value = AppConfig.APP_InvAutoSave;
            //Language
            comboBox5.SelectedItem = AppConfig.APP_Language;
            //Total digits after point of money
            numericUpDown2.Value = AppConfig.APP_MoneyDecimals;
            //Total digits after point of dose
            numericUpDown4.Value = AppConfig.APP_DoseDecimals;
            //Clear temp on exit
            checkBox6.Checked = AppConfig.APP_ClearTEMPonExit;
            //Show info on indicator
            checkBox7.Checked = AppConfig.APP_ShowInfoOnIndicator;
            //Use for enabling/disabling propmt message before closing illegal order
            checkBox8.Checked = AppConfig.APP_IllegalMsgPrompt;
            //Invent window
            checkBox4.Checked = AppConfig.APP_ShowInventWindow;
            //One copy
            checkBox5.Checked = AppConfig.APP_AllowOneCopy;
            //Client Card
            textBox4.Text = AppConfig.APP_ClientCard;
            // Add total
            switch (AppConfig.APP_AddTotal)
            {
                case "none": radioButton1.Checked = true; break;
                case "type1": radioButton2.Checked = true; break;
                case "type2": radioButton3.Checked = true; break;
            }
            //Navigator
            treeView1.Select();
            treeView1.SelectedNode = treeView1.Nodes[0];
        }
Ejemplo n.º 3
0
        private void Settings_Load(object sender, EventArgs e)
        {
            //#TAX
            //LoadAppTaxRates
            dataGridView2.Rows.Clear();
            if (AppConfig.TAX_AppTaxChar != null)
                for (i = 0; i < AppConfig.TAX_AppTaxChar.Length; i++)
                {
                    dataGridView2.Rows.Add(
                        AppConfig.TAX_AppTaxChar[i],
                        AppConfig.TAX_AppTaxRates[i],
                        AppConfig.TAX_AppTaxDisc[i]);
                }
            //LoadComparableTaxTable
            DataGridViewRow dwRow = null;
            DataGridViewComboBoxCell cbCell = null;
            DataGridViewTextBoxCell tbCell = null;
            for (i = 0; i < AppConfig.TAX_MarketColumn.Length; i++)
            {
                cbCell = new DataGridViewComboBoxCell();
                cbCell.ValueType = typeof(char);
                cbCell.MaxDropDownItems = 8;
                cbCell.Value = ' ';

                tbCell = new DataGridViewTextBoxCell();
                tbCell.ValueType = typeof(char);
                tbCell.Value = AppConfig.TAX_MarketColumn[i];

                dwRow = new DataGridViewRow();
                dwRow.Cells.Add(cbCell);
                dwRow.Cells.Add(tbCell);

                dataGridView1.Rows.Add(dwRow);

                cbCell.Dispose();
                tbCell.Dispose();
                dwRow.Dispose();
            }
            dataGridView1.ReadOnly = false;
            dataGridView1.Columns[1].ReadOnly = true;
            UpdateTaxValues();
            //RestoreComparableValues
            try
            {
                if (AppConfig.TAX_AppColumn != null)
                    for (i = 0; i < AppConfig.TAX_AppColumn.Length; i++)
                        dataGridView1["pd", i].Value = AppConfig.TAX_AppColumn[i];
            }
            catch { }

            //#COMMON
            //PayDesk
            sys_gen_kasaNom.Value = AppConfig.APP_PayDesk;
            //RefreshRate
            numericUpDown5.Value = AppConfig.APP_RefreshRate / 1000;
            //SubUnit
            sys_gen_pidrozd.Value = AppConfig.APP_SubUnit;
            //DefaultCountOfArticle
            textBox3.Text = AppConfig.APP_StartTotal.ToString();
            //SubUnitName
            textBox5.Text = AppConfig.APP_SubUnitName;
            //Customer's ID
            textBox1.Text = AppConfig.APP_ClientID;
            //WeightType
            comboBox1.SelectedIndex = AppConfig.APP_WeightType;
            //DefaultSearchType
            comboBox2.SelectedIndex = AppConfig.APP_SearchType;
            //Search Types Access
            // --> realized in Event (comboBox2_SelctedIndexChanged)

            //#PATH
            //Folder of Exchange
            phExTbBox.Text = AppConfig.Path_Exchnage;
            //Folder of Cheques
            phCheqTbBox.Text = AppConfig.Path_Cheques;
            //Folder of Bills
            phBillTbBox.Text = AppConfig.Path_Bills;
            //Folder of Articles
            phArtTBox.Text = AppConfig.Path_Articles;

            //#ADDITIONAL
            //Timeout request of refresh
            numericUpDown6.Value = AppConfig.APP_RefreshTimeout;
            //ChequeName
            maskedTextBox1.Text = AppConfig.APP_ChequeName;
            //Invent auto save
            numericUpDown3.Value = AppConfig.APP_InvAutoSave;
            //Language
            comboBox5.SelectedItem = AppConfig.APP_Language;
            //Total digits after point of money
            numericUpDown2.Value = AppConfig.APP_MoneyDecimals;
            //Total digits after point of dose
            numericUpDown4.Value = AppConfig.APP_DoseDecimals;
            //Clear temp on exit
            checkBox6.Checked = AppConfig.APP_ClearTEMPonExit;
            //Show info on indicator
            checkBox7.Checked = AppConfig.APP_ShowInfoOnIndicator;
            //Invent window
            checkBox4.Checked = AppConfig.APP_ShowInventWindow;
            //One copy
            checkBox5.Checked = AppConfig.APP_AllowOneCopy;
            //barcode scanner
            scaner_cBox_useProgramMode.Checked = AppConfig.APP_ScannerUseProgamMode;
            scanner_char_frequency.Value = (decimal)AppConfig.APP_ScannerCharReadFrequency;
            system_cBox_buyerBCReader.SelectedIndex = AppConfig.APP_BuyerBarCodeSource;
            system_num_buyerBCMinLen.Value = (decimal)AppConfig.APP_BuyerBarCodeMinLen;

            // PAGE: Content
            // -TabControl: Main
            // --TabPage: Common
            this.content_general_checkBox_showPromptMsgOnIllegal.Checked = AppConfig.Content_Common_PromptMsgOnIllegal;
            // --TabPage: Cheques
            // Add total
            switch (AppConfig.Content_Cheques_AddTotal)
            {
                case "none": this.content_order_radioButton_addQuantity1.Checked = true; break;
                case "type1": this.content_order_radioButton_addQuantity2.Checked = true; break;
                case "type2": this.content_order_radioButton_addQuantity3.Checked = true; break;
            }
            // --TabPage: Bills
            this.checkBox_pBills_DeleteBillAtEnd.Checked = AppConfig.Content_Bills_KeepAliveAfterCheque;
            // --TabPage: Articles
            this.checkBox_pArticles_KeepOriginData.Checked = AppConfig.Content_Articles_KeepDataAfterImport;

            //Navigator
            treeView1.Select();
            treeView1.SelectedNode = treeView1.Nodes[0];
        }