コード例 #1
0
        // Main Access Point
        public object CallFunction(string name, params object[] param)
        {
            // local variables
            string description = ((UI.AppUI.Tree)driverui).GetDescription(name);
            object value = new object();

            // reset transfering data
            OutputData = new byte[0];
            ReadedBytes = 0;

            // execute method
            switch (name)
            {
                /*
                 * General methods
                 *
                 */
                #region Initialization
                case "SetPrintParams":
                    {
                        SetPrintParams sdt = new SetPrintParams(Name, description);
                        if (sdt.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            Hashtable item = new Hashtable();
                            foreach (DictionaryEntry pItem in sdt.PrinterFormat)
                            {
                                item = (Hashtable)pItem.Value;
                                foreach (DictionaryEntry headLine in item)
                                    SetPrintParams(headLine.Key.ToString(), headLine.Value.ToString());
                            }
                        }
                        sdt.Dispose();
                        break;
                    }
                case "SetDateTime":
                    {
                        SetDateTime sdt = new SetDateTime(Name, description);
                        if (sdt.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            SetDateTime(sdt.NewDateTime);
                        sdt.Dispose();
                        break;
                    }
                case "Fiscalize":
                    {
                        string[] _errMsgs = new string[9] {
                                "Таблиця податкових номерів вичерпана",
                                "Не вказаний фіскальний номер",
                                "Неправильний заводський номер або інші параметри",
                                "Відкритий чек",
                                "Не обнулені суми за день (зробіть Z-звіт)",
                                "Не задані податкові ставки",
                                "Податковий номер складається з нулів",
                                "Нема чекової (контрольної) стрічки",
                                "Годиннк не встановлений"};
                        break;
                    }
                case "SetTaxRate":
                    {
                        SetTaxRate str = new SetTaxRate(Name, description);
                        if (str.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            object[] taxData = SetTaxRate(str.Password, str.DecimalPoint, str.UseRates, str.Rates);
                            string _infotext = string.Empty;

                            if (func.IsEmpty(taxData))
                            {
                                _infotext = string.Format("{0}\r\n\r\n{1} - {2}\r\n{3}: {4:0.00} [{5}]\r\n{6}: {7:0.00} [{8}]\r\n{9}: {10:0.00} [{11}]\r\n{12}: {13:0.00} [{14}]",
                                    "Податкові ставки",
                                    "Кількість знаків після коми", (byte)taxData[0],
                                    "Група А", (double)taxData[5], (bool)taxData[1] ? "дозволено" : "не дозволено",
                                    "Група Б", (double)taxData[6], (bool)taxData[2] ? "дозволено" : "не дозволено",
                                    "Група В", (double)taxData[7], (bool)taxData[3] ? "дозволено" : "не дозволено",
                                    "Група Г", (double)taxData[8], (bool)taxData[4] ? "дозволено" : "не дозволено");

                                value = taxData;
                            }
                            else
                                _infotext = "Нема даних";

                            System.Windows.Forms.MessageBox.Show(_infotext, Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);
                        }
                        str.Dispose();
                        break;
                    }
                case "SetSaleMode":
                    {
                        SetSaleMode ssm = new SetSaleMode(Name, description);
                        if (ssm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            SetSaleMode(ssm.SaleMode);
                        ssm.Dispose();
                        break;
                    }
                case "SetSerialNum":
                    {
                        SetSerialNum ssm = new SetSerialNum(Name, description);
                        if (ssm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            char r = SetSerialNum(ssm.CountryCode, ssm.SerialNumber);
                            string _infotext = string.Empty;

                            if (r == 'P')
                                _infotext = "Команда виконана успішно";
                            if (r == 'F')
                                _infotext = "Невідформатована фіскальна память\r\nЗаводський номер вже встановлено\r\nНе встановлено дату";
                            if (r == '\0')
                                _infotext = "Нема відповіді від принтера";

                            System.Windows.Forms.MessageBox.Show(_infotext, Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);
                        }
                        ssm.Dispose();
                        break;
                    }
                case "SetFixNum":
                    {
                        SetFixNum sfn = new SetFixNum(Name, description);
                        if (sfn.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            char r = SetFixNum(sfn.FiscalNumber);
                            string _infotext = string.Empty;

                            if (r == 'P')
                                _infotext = "Команда виконана успішно";
                            if (r == 'F')
                                _infotext = "Заводський номер не встановлено\r\nНе встановлено дату\r\nВідкритий чек або необхідно виконати Z-звіт";
                            if (r == '\0')
                                _infotext = "Нема відповіді від принтера";

                            System.Windows.Forms.MessageBox.Show(_infotext, Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);
                        }
                        sfn.Dispose();
                        break;
                    }
                case "SetTaxNum":
                    {
                        SetTaxNum stn = new SetTaxNum(Name, description);
                        if (stn.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            char r = SetTaxNum(stn.TaxNumber, stn.TaxType);
                            string _infotext = string.Empty;

                            if (r == 'P')
                                _infotext = "Команда виконана успішно";
                            if (r == 'F')
                                _infotext = "Помилка виконання команди";
                            if (r == '\0')
                                _infotext = "Нема відповіді від принтера";

                            System.Windows.Forms.MessageBox.Show(_infotext, Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);
                        }
                        stn.Dispose();
                        break;
                    }
                case "SetUserPass":
                    {
                        SetUserPass sup = new SetUserPass(Name, description);
                        if (sup.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            SetUserPass(sup.OldPassword, sup.NewPassword, sup.UserNo);
                        sup.Dispose();
                        break;
                    }
                case "SetUserName":
                    {
                        SetUserName sun = new SetUserName(Name, description);
                        if (sun.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            SetUserName(sun.Password, sun.UserNo, sun.UserName);
                        sun.Dispose();
                        break;
                    }
                case "ResetUserData":
                    {
                        ResetUserData sun = new ResetUserData(Name, description);
                        if (sun.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            ResetUserData(sun.Password, sun.UserNo);
                        sun.Dispose();
                        break;
                    }
                case "SetGetArticle":
                    {
                        SetGetArticle sga = new SetGetArticle(Name, description);
                        if (sga.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            object[] artInfo = SetGetArticle(sga.Option, sga.Param);

                            string[] _errorMsgs = new string[2]{
                                "Команда виконана успішно",
                                "Помилка виконання команди"};
                            string _infotext = string.Empty;
                            string _infoFormat = string.Empty;
                            if (!func.IsEmpty(artInfo) && artInfo[0].ToString() != "F")
                                switch (sga.Option)
                                {
                                    case 'I':
                                        {
                                            _infotext = string.Format("{0}\r\n\r\n{1}: {2:0.00}\r\n{3}: {4:0.00}\r\n{5}: {6:0.00}",
                                                "Загальна інформація",
                                                "Максимальний розмір назви товару", artInfo[0],
                                                "Всього товарів", artInfo[1],
                                                "Запроограмовано", artInfo[2]);
                                            break;
                                        }
                                    case 'D':
                                    case 'C':
                                    case 'P':
                                        {
                                            _infotext = _errorMsgs[0];
                                            break;
                                        }
                                    case 'F':
                                    case 'N':
                                    case 'R':
                                        {
                                            _infoFormat = "{0}\r\n\r\n{1}: {2}\r\n{3} - {4}\r\n{5}: {6}\r\n{7}: {8:0.00}\r\n";
                                            _infoFormat += "{9}: {10}\r\n{11}: {12:0.00}\r\n{13}: {14}\r\n{15}: {16:0.00}\r\n{17}: {18}";
                                            _infotext = string.Format(_infoFormat,
                                                "Інформація про товар",
                                                "Номер товару", artInfo[1],
                                                "Податкова група", artInfo[2],
                                                "Група", artInfo[3],
                                                "Ціна", double.Parse(artInfo[4].ToString(), Params.NumberFormat),
                                                "Кількість продажів", double.Parse(artInfo[5].ToString(), Params.NumberFormat),
                                                "Сума продажів", double.Parse(artInfo[6].ToString(), Params.NumberFormat),
                                                "Кількість в межах чеку", double.Parse(artInfo[7].ToString(), Params.NumberFormat),
                                                "Сума в межах чеку", double.Parse(artInfo[8].ToString(), Params.NumberFormat),
                                                "Назва", artInfo[9]);
                                            break;
                                        }
                                }
                            else
                                _infotext = _errorMsgs[1];

                            System.Windows.Forms.MessageBox.Show(_infotext, Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);
                        }
                        sga.Dispose();
                        break;
                    }
                case "LoadLogo":
                    {
                        //LoadLogo("0000", new byte[96][]);
                        LoadLogo ll = new LoadLogo(Name, description);
                        if (ll.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            LoadLogo(ll.Password, ll.Logo);
                        ll.Dispose();
                        break;
                    }
                case "SetAdminPass":
                    {
                        SetAdminPass sap = new SetAdminPass(Name, description);
                        if (sap.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            SetAdminPass(sap.OldPassword, sap.NewPassword);
                        sap.Dispose();
                        break;
                    }
                case "ResetUserPass":
                    {
                        ResetUserPass sup = new ResetUserPass(Name, description);
                        if (sup.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            ResetUserPass(sup.Password, sup.UserNo);
                        sup.Dispose();
                        break;
                    }
                #endregion
                #region Other
                case "SetGetMoney":
                    {
                        SetGetMoney sgm = new SetGetMoney(Name, description);
                        if (sgm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            double[] money = SetGetMoney(sgm.Money);
                            string _infotext = string.Format("{0}\r\n\r\n{1}: {2:0.00}\r\n{3}: {4:0.00}\r\n{5}: {6:0.00}",
                                "Фінансова звітнсть",
                                "Загальна сума внеску за день", money[2],
                                "Загальна сума вилучення за день", money[3],
                                "Сума в касі", money[1]);
                            System.Windows.Forms.MessageBox.Show(_infotext, Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);

                            value = money.Clone();
                        }
                        sgm.Dispose();
                        break;
                    }
                case "PrintDiagInfo":
                    {
                        PrintDiagInfo();
                        break;
                    }
                case "Beep":
                    {
                        Beep();
                        break;
                    }
                case "OpenBox":
                    {
                        OpenBox ob = new OpenBox(Name, description);
                        if (ob.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            OpenBox(ob.Impulse);

                        value = new object[1] { ob.Impulse };
                        break;
                    }
                #endregion
                #region Display
                case "DisplText":
                    {
                        DisplText dt = new DisplText(Name, description);
                        if (dt.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            DisplText(dt.TextLine);
                        dt.Dispose();
                        break;
                    }
                case "DisplBotLine":
                    {
                        DisplBotLine dbl = new DisplBotLine(Name, description);
                        if (dbl.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            DisplBotLine(dbl.BottomLine);
                        dbl.Dispose();
                        break;
                    }
                case "DisplTopLine":
                    {
                        DisplTopLine dtl = new DisplTopLine(Name, description);
                        if (dtl.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            DisplTopLine(dtl.TopLine);
                        dtl.Dispose();
                        break;
                    }
                case "ClrDispl":
                    {
                        ClrDispl();
                        break;
                    }
                case "DisplayDateTime":
                    {
                        DisplayDateTime();
                        break;
                    }
                #endregion
                #region DayReport
                case "ReportXZ":
                    {
                        ReportXZ rxz = new ReportXZ(Name, description);
                        if (rxz.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            object[] xzInfo = ReportXZ(rxz.Password, rxz.ReportType, new bool[] { rxz.ClearUserSumm, rxz.ClearArtsSumm });
                            string _infotext = string.Empty;
                            if (!func.IsEmpty(xzInfo))
                            {
                                string _infoFormat = "{0}\r\n\r\n{1} - {2}\r\n{3}: {4:0.00}\r\n{5}: {6:0.00}\r\n";
                                _infoFormat += "{7}: {8}\r\n{9}: {10}\r\n{11}: {12}";
                                _infotext = string.Format(_infoFormat,
                                    "Інформація поточного " + (rxz.ReportType == 0 ? "Z" : "X") + "-звіту",
                                    "Номер звіту", (uint)xzInfo[0],
                                    "Сума по групі А", (double)xzInfo[1],
                                    "Сума по групі Б", (double)xzInfo[2],
                                    "Сума по групі В", (double)xzInfo[3],
                                    "Сума по групі Г", (double)xzInfo[4],
                                    "Сума по групі Д", (double)xzInfo[5]);
                            }

                            System.Windows.Forms.MessageBox.Show(_infotext, Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);

                            value = xzInfo.Clone();
                        }
                        rxz.Dispose();
                        break;
                    }
                #endregion
                #region Reports
                case "ReportByTax":
                    {
                        ReportByTax rbt = new ReportByTax(Name, description);
                        if (rbt.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            ReportByTax(rbt.Password, rbt.StartDate, rbt.EndDate);
                        rbt.Dispose();
                        break;
                    }
                case "ReportByNoFull":
                    {
                        ReportByNoFull rbnf = new ReportByNoFull(Name, description);
                        if (rbnf.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            ReportByNoFull(rbnf.Password, rbnf.StartNo, rbnf.EndNo);
                        rbnf.Dispose();
                        break;
                    }
                case "ReportByDateFull":
                    {
                        ReportByDateFull rbdf = new ReportByDateFull(Name, description);
                        if (rbdf.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            ReportByDateFull(rbdf.Password, rbdf.StartDate, rbdf.EndDate);
                        rbdf.Dispose();
                        break;
                    }
                case "ReportByDateShort":
                    {
                        ReportByDateShort rbds = new ReportByDateShort(Name, description);
                        if (rbds.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            ReportByDateShort(rbds.Password, rbds.StartDate, rbds.EndDate);
                        rbds.Dispose();
                        break;
                    }
                case "ReportByNoShort":
                    {
                        ReportByNoShort rbns = new ReportByNoShort(Name, description);
                        if (rbns.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            ReportByNoShort(rbns.Password, rbns.StartNo, rbns.EndNo);
                        rbns.Dispose();
                        break;
                    }
                case "ReportByUsers":
                    {
                        ReportByUsers rbu = new ReportByUsers(Name, description);
                        if (rbu.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            ReportByUsers(rbu.Password);
                        rbu.Dispose();
                        break;
                    }
                case "ReportByArts":
                    {
                        ReportByArts rba = new ReportByArts(Name, description);
                        if (rba.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            ReportByArts(rba.Password, rba.ReportMode);
                        rba.Dispose();
                        break;
                    }
                #endregion
                #region Selling
                case "OpenNOrder":
                    {
                        ushort[] oinfo = OpenNOrder();
                        if (oinfo[3] != 0)
                        {
                            string[] _errMsgs = new string[4]{
                                "Не відформатована фіскальна пам'ять",
                                "Відкритий фіскальний чек",
                                "Вже відкритий нефіскальний чек",
                                "Не встановлена дата і час"};
                            System.Windows.Forms.DialogResult _res = System.Windows.Forms.MessageBox.Show(_errMsgs[oinfo[3] - 1], Name,
                                System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Warning);
                        }

                        value = oinfo.Clone();
                        break;
                    }
                case "CloseNOrder":
                    {
                        ushort[] oinfo = CloseNOrder();
                        value = oinfo.Clone();
                        break;
                    }
                case "PrintNText":
                    {
                        PrintNText pnt = new PrintNText(Name, description);
                        if (pnt.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            PrintNText(pnt.NonFixText);
                        pnt.Dispose();
                        break;
                    }
                case "OpenFOrder":
                    {
                        //OpenFOrder(port);
                        break;
                    }
                case "SubTotal": { break; }
                case "SaleArtIndicate": { break; }
                case "Total": { break; }
                case "PrintFText":
                    {
                        PrintFText pft = new PrintFText(Name, description);
                        if (pft.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            PrintFText(pft.FixText);
                        pft.Dispose();
                        break;
                    }
                case "TotalAndClose": { break; }
                case "CloseFOrder":
                    {
                        CloseFOrder();
                        break;
                    }
                case "ResetOrder":
                    {
                        string _infotext = string.Format("{0}", "Анулювати поточне замовлення");
                        System.Windows.Forms.DialogResult _res = System.Windows.Forms.MessageBox.Show(_infotext, Name,
                            System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);
                        if (_res == System.Windows.Forms.DialogResult.Yes)
                            ResetOrder();
                        break;
                    }
                case "SaleArt": { break; }
                case "GroupDiscount": { break; }
                case "OpenROrder": { break; }
                case "PrintCopy":
                    {
                        PrintCopy pc = new PrintCopy(Name, description);
                        if (pc.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            PrintCopy(pc.Copies);
                        pc.Dispose();
                        break;
                    }
                #endregion
                #region Printer commands
                case "CutChq":
                    {
                        CutChq();
                        break;
                    }
                case "LineFeed":
                    {
                        LineFeed lf = new LineFeed(Name, description);
                        if (lf.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            LineFeed(lf.Lines);
                        lf.Dispose();
                        break;
                    }
                #endregion
                #region Get Info
                case "GetDateTime":
                    {
                        DateTime dtime = GetDateTime();
                        string _infotext = string.Format("{0}: {1}", "Поточна дата принтера", dtime.ToString("dd-MM-yyyy HH:mm:ss"));
                        System.Windows.Forms.MessageBox.Show(_infotext, Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = dtime;
                        break;
                    }
                case "GetLastZReport":
                    {
                        GetLastZReport glzr = new GetLastZReport(Name, description);
                        if (glzr.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            object[] zrep = GetLastZReport(glzr.ReportMode);
                            string _infotext = string.Empty;
                            if (!func.IsEmpty(zrep))
                            {
                                string _infoFormat = "{0}\r\n\r\n{1} - {2}\r\n{3}: {4:0.00}\r\n{5}: {6:0.00}\r\n";
                                _infoFormat += "{7}: {8}\r\n{9}: {10}\r\n{11}: {12}";
                                _infotext = string.Format(_infoFormat,
                                    "Інформація останнього Z-звіту",
                                    "Номер звіту", (uint)zrep[0],
                                    "Сума по групі А", (double)zrep[1],
                                    "Сума по групі Б", (double)zrep[2],
                                    "Сума по групі В", (double)zrep[3],
                                    "Сума по групі Г", (double)zrep[4],
                                    "Сума по групі Д", (double)zrep[5]);
                            }
                            else
                                _infotext = "Немає даних";

                            System.Windows.Forms.MessageBox.Show(_infotext, Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);

                            value = zrep.Clone();
                        }
                        glzr.Dispose();
                        break;
                    }
                case "GetSummsByDay":
                    {
                        GetSummsByDay gsbd = new GetSummsByDay(Name, description);
                        if (gsbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            double[] summ = GetSummsByDay(gsbd.ReportMode);
                            string _infoFormat = "{0}\r\n\r\n{1}: {2:0.00}\r\n{3}: {4:0.00}\r\n{5}: {6:0.00}\r\n";
                            _infoFormat += "{7}: {8:0.00}\r\n{9}: {10:0.00}";
                            string _infotext = string.Format(_infoFormat,
                                "Інформація сум за день",
                                "Сума по групі А", (double)summ[0],
                                "Сума по групі Б", (double)summ[1],
                                "Сума по групі В", (double)summ[2],
                                "Сума по групі Г", (double)summ[3],
                                "Сума по групі Д", (double)summ[4]);
                            System.Windows.Forms.MessageBox.Show(_infotext, Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);

                            value = summ.Clone();
                        }
                        gsbd.Dispose();
                        break;
                    }
                case "GetSumCorByDay":
                    {
                        object[] scorr = GetSumCorByDay();
                        string _infoFormat = "{0}\r\n\r\n{1}: {2:0.00}\r\n{3}: {4:0.00}\r\n{5}: {6:0.00}\r\n";
                        _infoFormat += "{7}: {8}\r\n{9}: {10}\r\n{11}: {12}";
                        string _infotext = string.Format(_infoFormat,
                            "Суми корекцій за день",
                            "Сума всіх продажів", (double)scorr[0],
                            "Сума по чекових корекціях", (double)scorr[1],
                            "Сума виплат по кредиту", (double)scorr[2],
                            "Нефіскальні чеки", (ushort)scorr[3],
                            "Фіскальні чеки", (ushort)scorr[4],
                            "Чеки повернення", (ushort)scorr[5]);
                        System.Windows.Forms.MessageBox.Show(_infotext, Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = scorr.Clone();
                        break;
                    }
                case "GetFreeMem":
                    {
                        uint fmem = GetFreeMem();
                        string _infotext = string.Format("{0} {1} {2}", "Розмір вільної пам'яті:", fmem, "записів");
                        System.Windows.Forms.MessageBox.Show(_infotext, Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = fmem;
                        break;
                    }
                case "GetState":
                    {
                        byte[] _state = GetState();
                        string _infotext = string.Empty;
                        for (int i = 0; i < _state.Length; i++)
                        {
                            if (((string[])Params.DriverData["Status"])[_state[i]].Length == 0)
                                continue;
                            _infotext += ((string[])Params.DriverData["Status"])[_state[i]] + "\r\n";
                            if (i != 0 && _state[i] == 0)
                                break;
                        }
                        System.Windows.Forms.MessageBox.Show(_infotext, Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = _infotext.Split(new string[1] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Clone();
                        break;
                    }
                case "GetFixTransState":
                    {
                        GetFixTransState gfts = new GetFixTransState(Name, description);
                        if (gfts.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            object[] transinfo = GetFixTransState(gfts.TransParam);
                            string _infoFormat = "{0}\r\n\r\n{1} {2}\r\n{3}: {4}\r\n{5}: {6:0.00}{7}{8}";
                            string _infotext = string.Format(_infoFormat,
                                "Стан фіскальної транзакції",
                                "Чек", ((byte)transinfo[0] == 1) ? "відкритий" : "не відкритий",
                                "Лічильник фіскальних чеків", transinfo[1],
                                "Сума по чеку", (double)transinfo[2],
                                (transinfo[3] == null) ? "" : ("\r\nОплата по чеку: " + string.Format("{0:0.00}", (double)transinfo[3])),
                                (transinfo[4] == null) ? "" : ("\r\nОстання оплата виконана " + ((byte)transinfo[4] == 1 ? "успішно" : "не успішно")));
                            System.Windows.Forms.MessageBox.Show(_infotext, Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);

                            value = transinfo.Clone();
                        }

                        break;
                    }
                case "GetDiagInfo":
                    {
                        string[] dinfo = GetDiagInfo();
                        string _infoFormat = "{0}\r\n\r\n{1} - {2}\r\n{3}: {4}\r\n{5}: {6}\r\n{7}: {8}";
                        _infoFormat += "\r\n{9} - {10}\r\n{11}: {12}\r\n{13}: {14}";
                        string _infotext = string.Format(_infoFormat,
                            "Діагностична інформація",
                            "Версія ПЗ", dinfo[0],
                            "Дата час", DateTime.Parse(dinfo[1] + " " + dinfo[2].Insert(2, ":")).ToString("dd/MM/yyyy HH:mm"),
                            "Контрольна сума", dinfo[3],
                            "Перемикачі Sw", dinfo[4],
                            "Код країни", dinfo[5],
                            "Серійний номер", dinfo[6],
                            "Фіскальний номер", dinfo[7]);
                        System.Windows.Forms.MessageBox.Show(_infotext, Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = dinfo.Clone();
                        break;
                    }
                case "GetTaxRates":
                    {
                        double[] taxs = GetTaxRates();
                        string _infotext = string.Format("{0}\r\n\r\n{1}: {2:0.00}%\r\n{3}: {4:0.00}%\r\n{5}: {6:0.00}%\r\n{7}: {8:0.00}%",
                            "Податкові ставки",
                            "А", taxs[0], "Б", taxs[1], "В", taxs[2], "Г", taxs[3]);
                        System.Windows.Forms.MessageBox.Show(_infotext, Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = taxs.Clone();
                        break;
                    }
                case "GetTaxID":
                    {
                        string[] taxid = GetTaxID();
                        string _infotext = string.Format("{0}\r\n\r\n{1} {2}",
                            "Податковий ідентифікаційний номер", taxid[0], (taxid[1] == "0") ? "ПН" : "ІД");
                        System.Windows.Forms.MessageBox.Show(_infotext, Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = taxid.Clone();
                        break;
                    }
                case "GetChqInfo":
                    {
                        object[] cinfo = GetChqInfo();
                        string _infoFormat = "{0}\r\n\r\n{1} - {2}\r\n{3}: {4:0.00}\r\n{5}: {6:0.00}\r\n";
                        _infoFormat += "{7}: {8:0.00}\r\n{9}: {10:0.00}\r\n{11}: {12:0.00}\r\n{13} - {14}";
                        string _infotext = string.Format(_infoFormat,
                            "Інформація поточного фіскального чеку",
                            "Здійснене повернення", ((byte)cinfo[0] == 1) ? "Ні" : "Так",
                            "Сума по групі А", (double)cinfo[1],
                            "Сума по групі Б", (double)cinfo[2],
                            "Сума по групі В", (double)cinfo[3],
                            "Сума по групі Г", (double)cinfo[4],
                            "Сума по групі *", (double)cinfo[5],
                            "Розширений чек", ((byte)cinfo[6] == 1) ? "Так" : "Ні");
                        System.Windows.Forms.MessageBox.Show(_infotext, Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = cinfo.Clone();
                        break;
                    }
                case "GetPaymentInfo":
                    {
                        object[] pinfo = GetPaymentInfo();
                        string _infoFormat = "{0}\r\n\r\n{1}: {2:0.00}\r\n{3}: {4:0.00}\r\n{5}: {6:0.00}\r\n";
                        _infoFormat += "{7}: {8:0.00}\r\n{9} - {10}\r\n{11} - {12}\r\n{13} - {14}";
                        string _infotext = string.Format(_infoFormat,
                            "Інформація по типах розрахунків",
                            "Готівка", (double)pinfo[0],
                            "Кредит", (double)pinfo[1],
                            "Дебетна картка", (double)pinfo[2],
                            "Чек", (double)pinfo[3],
                            "Номер останньго Z-звіту", (uint)pinfo[4],
                            "Номер наступного Z-звіту", (uint)pinfo[5],
                            "Глобальний лічильник чеків", (uint)pinfo[6]);
                        System.Windows.Forms.MessageBox.Show(_infotext, Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = pinfo.Clone();
                        break;
                    }
                case "GetUserInfo":
                    {
                        GetUserInfo gui = new GetUserInfo(Name, description);
                        if (gui.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            object[] uinfo = GetUserInfo(gui.UserNo);
                            string _infoFormat = "{0}\r\n\r\n{1} - {2}\r\n{3}: [{4}]; {5:0.00}\r\n{6}: [{7}]; {8:0.00}\r\n";
                            _infoFormat += "{9}: [{10}]; {11:0.00}\r\n{12}: [{13}]; {14:0.00}\r\n{15}: [{16}]; {17:0.00}\r\n{18}: {19}";
                            string _infotext = string.Format(_infoFormat,
                                "Інформація про касира",
                                "Реалізовано чеків", (uint)uinfo[0],
                                "Кількість і сума продажів", (uint)uinfo[1], (double)uinfo[2],
                                "Кількість і сума скидок", (uint)uinfo[3], (double)uinfo[4],
                                "Кількість і сума надбаваок", (uint)uinfo[5], (double)uinfo[6],
                                "Кількість і сума чеків поверення", (uint)uinfo[7], (double)uinfo[8],
                                "Інше", (uint)uinfo[9], (double)uinfo[10],
                                "Ідентифікатор", uinfo[11].ToString());
                            System.Windows.Forms.MessageBox.Show(_infotext, Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);

                            value = uinfo.Clone();
                        }
                        gui.Dispose();

                        break;
                    }
                case "GetLastFChqNo":
                    {
                        uint cno = GetLastFChqNo();
                        string _infotext = string.Format("{0} {1}", "Номер останнього фіскального чеку:", cno);
                        System.Windows.Forms.MessageBox.Show(_infotext, Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = cno;
                        break;
                    }
                case "GetFixMem":
                    {
                        GetFixMem gfm = new GetFixMem(Name, description);
                        if (gfm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            object[] fmem = GetFixMem(gfm.FixNo, gfm.ReturnType, gfm.SecondaryParam);
                            string _infoFormat = "{0}\r\n\r\n{1} {2}\r\n{3}: {4}\r\n{5}: {6}\r\n{7}: {8}\r\n{9} {10}";
                            string _infotext = string.Format(_infoFormat,
                                "Інформація фіскальної пам'яті",
                                "Чек", fmem[0],
                                "Лічильник фіскальних чеків", fmem[1],
                                "Сума по чеку", fmem[3],
                                "Оплата по чеку", fmem[4],
                                "Остання оплата виконана", fmem[5]);
                            System.Windows.Forms.MessageBox.Show(_infotext, Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);

                            value = fmem.Clone();
                        }
                        break;
                    }
                case "GetRemTime":
                    {
                        object[] remtime = GetRemTime();
                        string _infotext = string.Format("{0}", "Інтервал часу до завершення зміни");
                        System.Windows.Forms.MessageBox.Show(_infotext, Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = remtime.Clone();
                        break;
                    }
                #endregion
                /*
                 * There are special methods for accessing from main app and
                 * custom methods without custom their implementation. (using built-in parameters)
                 */
                #region Program access methods
                case "FP_Sale":
                    {
                        FP_Sale(param);
                        break;
                    }
                case "FP_PayMoney":
                    {
                        FP_PayMoney(param);
                        break;
                    }
                case "FP_Payment":
                    {
                        FP_Payment(param);
                        break;
                    }
                case "FP_Discount":
                    {
                        FP_Discount(param);
                        break;
                    }
                case "FP_LastChqNo":
                    {
                        value = FP_LastChqNo(param);
                        break;
                    }
                case "FP_LastZRepNo":
                    {
                        value = FP_LastZRepNo(param);
                        break;
                    }
                case "FP_OpenBox":
                    {
                        FP_OpenBox();
                        break;
                    }
                case "FP_SetCashier":
                    {
                        value = FP_SetCashier(param);
                        break;
                    }
                case "FP_SendCustomer":
                    {
                        FP_SendCustomer(param);
                        break;
                    }
                #endregion
                #region Custom methods
                case "Custom_ReportX":
                    {
                        ReportX rxz = new ReportX(Name, description);
                        if (rxz.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            object[] xzInfo = ReportXZ(rxz.Password, rxz.ReportType, new bool[] { rxz.ClearUserSumm, rxz.ClearArtsSumm });
                            value = xzInfo.Clone();
                        }
                        rxz.Dispose();
                        break;
                    }
                case "Custom_ReportZ":
                    {
                        ReportZ rxz = new ReportZ(Name, description);
                        if (rxz.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            object[] xzInfo = ReportXZ(rxz.Password, rxz.ReportType, new bool[] { rxz.ClearUserSumm, rxz.ClearArtsSumm });
                            value = xzInfo.Clone();
                        }
                        rxz.Dispose();
                        SetGetArticle('D', "A,0000");
                        Params.DriverData["LastArtNo"] = (uint)1;
                        this.param.Save();
                        break;
                    }
                #endregion
            }
            return value;
        }
コード例 #2
0
ファイル: fpmain.cs プロジェクト: AndrewEastwood/desktop
        // Main Access Point
        internal override object CallFunction(string name, string description, ComPort port, object[] param)
        {
            object value = new object();
            OutputData = new byte[0];
            ReadedBytes = 0;

            if (description == string.Empty)
                description = ((Tree)FP_Panel).GetDescription(name);

            switch (name)
            {
                #region Initialization
                case "SetPrintParams":
                    {
                        break;
                    }
                case "SetDateTime":
                    {
                        SetDateTime sdt = new SetDateTime(Protocol_Name, description);
                        if (sdt.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            SetDateTime(port, sdt.NewDateTime);
                        sdt.Dispose();
                        break;
                    }
                case "Fiscalize":
                    {
                        string[] _errMsgs = new string[9] {
                                "������� ���������� ������ ���������",
                                "�� �������� ��������� �����",
                                "������������ ���������� ����� ��� ���� ���������",
                                "³������� ���",
                                "�� ������� ���� �� ���� (������ Z-���)",
                                "�� ����� �������� ������",
                                "���������� ����� ���������� � ����",
                                "���� ������ (����������) ������",
                                "������� �� ������������"};
                        break;
                    }
                case "SetTaxRate":
                    {
                        SetTaxRate str = new SetTaxRate(Protocol_Name, description);
                        if (str.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            object[] taxData = SetTaxRate(port, str.Password, str.DecimalPoint, str.UseRates, str.Rates);
                            string _infotext = string.Empty;

                            if (Methods.IsEmpty(taxData))
                            {
                                _infotext = string.Format("{0}\r\n\r\n{1} - {2}\r\n{3}: {4:0.00} [{5}]\r\n{6}: {7:0.00} [{8}]\r\n{9}: {10:0.00} [{11}]\r\n{12}: {13:0.00} [{14}]",
                                    "�������� ������",
                                    "ʳ������ ����� ���� ����", (byte)taxData[0],
                                    "����� �", (double)taxData[5], (bool)taxData[1] ? "���������" : "�� ���������",
                                    "����� �", (double)taxData[6], (bool)taxData[2] ? "���������" : "�� ���������",
                                    "����� �", (double)taxData[7], (bool)taxData[3] ? "���������" : "�� ���������",
                                    "����� �", (double)taxData[8], (bool)taxData[4] ? "���������" : "�� ���������");

                                value = taxData;
                            }
                            else
                                _infotext = "���� �����";

                            System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);
                        }
                        str.Dispose();
                        break;
                    }
                case "SetSaleMode":
                    {
                        SetSaleMode ssm = new SetSaleMode(Protocol_Name, description);
                        if (ssm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            SetSaleMode(port, ssm.SaleMode);
                        ssm.Dispose();
                        break;
                    }
                case "SetSerialNum":
                    {
                        SetSerialNum ssm = new SetSerialNum(Protocol_Name, description);
                        if (ssm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            char r = SetSerialNum(port, ssm.CountryCode, ssm.SerialNumber);
                            string _infotext = string.Empty;

                            if (r == 'P')
                                _infotext = "������� �������� ������";
                            if (r == 'F')
                                _infotext = "��������������� �������� ������\r\n���������� ����� ��� �����������\r\n�� ����������� ����";
                            if (r == '\0')
                                _infotext = "���� ������ �� ��������";

                            System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);
                        }
                        ssm.Dispose();
                        break;
                    }
                case "SetFixNum":
                    {
                        SetFixNum sfn = new SetFixNum(Protocol_Name, description);
                        if (sfn.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            char r = SetFixNum(port, sfn.FiscalNumber);
                            string _infotext = string.Empty;

                            if (r == 'P')
                                _infotext = "������� �������� ������";
                            if (r == 'F')
                                _infotext = "���������� ����� �� �����������\r\n�� ����������� ����\r\n³������� ��� ��� ��������� �������� Z-���";
                            if (r == '\0')
                                _infotext = "���� ������ �� ��������";

                            System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);
                        }
                        sfn.Dispose();
                        break;
                    }
                case "SetTaxNum":
                    {
                        SetTaxNum stn = new SetTaxNum(Protocol_Name, description);
                        if (stn.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            char r = SetTaxNum(port, stn.TaxNumber, stn.TaxType);
                            string _infotext = string.Empty;

                            if (r == 'P')
                                _infotext = "������� �������� ������";
                            if (r == 'F')
                                _infotext = "������� ��������� �������";
                            if (r == '\0')
                                _infotext = "���� ������ �� ��������";

                            System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);
                        }
                        stn.Dispose();
                        break;
                    }
                case "SetUserPass":
                    {
                        SetUserPass sup = new SetUserPass(Protocol_Name, description);
                        if (sup.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            SetUserPass(port, sup.OldPassword, sup.NewPassword, sup.UserNo);
                        sup.Dispose();
                        break;
                    }
                case "SetUserName":
                    {
                        SetUserName sun = new SetUserName(Protocol_Name, description);
                        if (sun.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            SetUserName(port, sun.Password, sun.UserNo, sun.UserName);
                        sun.Dispose();
                        break;
                    }
                case "ResetUserData":
                    {
                        ResetUserData sun = new ResetUserData(Protocol_Name, description);
                        if (sun.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            ResetUserData(port, sun.Password, sun.UserNo);
                        sun.Dispose();
                        break;
                    }
                case "SetGetArticle":
                    {
                        SetGetArticle sga = new SetGetArticle(Protocol_Name, description);
                        if (sga.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            object[] artInfo = SetGetArticle(port, sga.Option, sga.Param);

                            string[] _errorMsgs = new string[2]{
                                "������� �������� ������",
                                "������� ��������� �������"};
                            string _infotext = string.Empty;
                            string _infoFormat = string.Empty;
                            if (!Methods.IsEmpty(artInfo) && artInfo[0].ToString() != "F")
                                switch (sga.Option)
                                {
                                    case 'I':
                                        {
                                            _infotext = string.Format("{0}\r\n\r\n{1}: {2:0.00}\r\n{3}: {4:0.00}\r\n{5}: {6:0.00}",
                                                "�������� ����������",
                                                "������������ ����� ����� ������", artInfo[0],
                                                "������ ������", artInfo[1],
                                                "���������������", artInfo[2]);
                                            break;
                                        }
                                    case 'D':
                                    case 'C':
                                    case 'P':
                                        {
                                            _infotext = _errorMsgs[0];
                                            break;
                                        }
                                    case 'F':
                                    case 'N':
                                    case 'R':
                                        {
                                            _infoFormat = "{0}\r\n\r\n{1}: {2}\r\n{3} - {4}\r\n{5}: {6}\r\n{7}: {8:0.00}\r\n";
                                            _infoFormat += "{9}: {10}\r\n{11}: {12:0.00}\r\n{13}: {14}\r\n{15}: {16:0.00}\r\n{17}: {18}";
                                            _infotext = string.Format(_infoFormat,
                                                "���������� ��� �����",
                                                "����� ������", artInfo[1],
                                                "��������� �����", artInfo[2],
                                                "�����", artInfo[3],
                                                "ֳ��", double.Parse(artInfo[4].ToString(), NumberFormat),
                                                "ʳ������ �������", double.Parse(artInfo[5].ToString(), NumberFormat),
                                                "���� �������", double.Parse(artInfo[6].ToString(), NumberFormat),
                                                "ʳ������ � ����� ����", double.Parse(artInfo[7].ToString(), NumberFormat),
                                                "���� � ����� ����", double.Parse(artInfo[8].ToString(), NumberFormat),
                                                "�����", artInfo[9]);
                                            break;
                                        }
                                }
                            else
                                _infotext = _errorMsgs[1];

                            System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);
                        }
                        sga.Dispose();
                        break;
                    }
                case "LoadLogo":
                    {
                        LoadLogo ll = new LoadLogo(Protocol_Name, description);
                        if (ll.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            LoadLogo(port, ll.Password, ll.Logo);
                        ll.Dispose();
                        break;
                    }
                case "SetAdminPass":
                    {
                        SetAdminPass sap = new SetAdminPass(Protocol_Name, description);
                        if (sap.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            SetAdminPass(port, sap.OldPassword, sap.NewPassword);
                        sap.Dispose();
                        break;
                    }
                case "ResetUserPass":
                    {
                        ResetUserPass sup = new ResetUserPass(Protocol_Name, description);
                        if (sup.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            ResetUserPass(port, sup.Password, sup.UserNo);
                        sup.Dispose();
                        break;
                    }
                #endregion
                #region Other
                case "SetGetMoney":
                    {
                        SetGetMoney sgm = new SetGetMoney(Protocol_Name, description);
                        if (sgm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            double[] money = SetGetMoney(port, sgm.Money);
                            string _infotext = string.Format("{0}\r\n\r\n{1}: {2:0.00}\r\n{3}: {4:0.00}\r\n{5}: {6:0.00}",
                                "Գ������� �������",
                                "�������� ���� ������ �� ����", money[0],
                                "�������� ���� ��������� �� ����", money[1],
                                "���� � ���", money[2]);
                            System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);

                            value = money.Clone();
                        }
                        sgm.Dispose();
                        break;
                    }
                case "PrintDiagInfo":
                    {
                        PrintDiagInfo(port);
                        break;
                    }
                case "Beep":
                    {
                        Beep(port);
                        break;
                    }
                case "OpenBox":
                    {
                        OpenBox ob = new OpenBox(Protocol_Name, description);
                        if (ob.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            OpenBox(port, ob.Impulse);

                        value = new object[1] { ob.Impulse };
                        break;
                    }
                #endregion
                #region Display
                case "DisplText":
                    {
                        DisplText dt = new DisplText(Protocol_Name, description);
                        if (dt.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            DisplText(port, dt.TextLine);
                        dt.Dispose();
                        break;
                    }
                case "DisplBotLine":
                    {
                        DisplBotLine dbl = new DisplBotLine(Protocol_Name, description);
                        if (dbl.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            DisplBotLine(port, dbl.BottomLine);
                        dbl.Dispose();
                        break;
                    }
                case "DisplTopLine":
                    {
                        DisplTopLine dtl = new DisplTopLine(Protocol_Name, description);
                        if (dtl.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            DisplTopLine(port, dtl.TopLine);
                        dtl.Dispose();
                        break;
                    }
                case "ClrDispl":
                    {
                        ClrDispl(port);
                        break;
                    }
                case "DisplayDateTime":
                    {
                        DisplayDateTime(port);
                        break;
                    }
                #endregion
                #region DayReport
                case "ReportXZ":
                    {
                        ReportXZ rxz = new ReportXZ(Protocol_Name, description);
                        if (rxz.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            object[] xzInfo = ReportXZ(port, rxz.Password, rxz.ReportType, new bool[] { rxz.ClearUserSumm, rxz.ClearArtsSumm });
                            string _infotext = string.Empty;
                            if (!Methods.IsEmpty(xzInfo))
                            {
                                string _infoFormat = "{0}\r\n\r\n{1} - {2}\r\n{3}: {4:0.00}\r\n{5}: {6:0.00}\r\n";
                                _infoFormat += "{7}: {8}\r\n{9}: {10}\r\n{11}: {12}";
                                _infotext = string.Format(_infoFormat,
                                    "���������� ��������� " + (rxz.ReportType == 0 ? "Z" : "X") + "-����",
                                    "����� ����", (uint)xzInfo[0],
                                    "���� �� ���� �", (double)xzInfo[1],
                                    "���� �� ���� �", (double)xzInfo[2],
                                    "���� �� ���� �", (double)xzInfo[3],
                                    "���� �� ���� �", (double)xzInfo[4],
                                    "���� �� ���� �", (double)xzInfo[5]);
                            }

                            System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);

                            value = xzInfo.Clone();
                        }
                        rxz.Dispose();
                        break;
                    }
                #endregion
                #region Reports
                case "ReportByTax":
                    {
                        ReportByTax rbt = new ReportByTax(Protocol_Name, description);
                        if (rbt.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            ReportByTax(port, rbt.Password, rbt.StartDate, rbt.EndDate);
                        rbt.Dispose();
                        break;
                    }
                case "ReportByNoFull":
                    {
                        ReportByNoFull rbnf = new ReportByNoFull(Protocol_Name, description);
                        if (rbnf.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            ReportByNoFull(port, rbnf.Password, rbnf.StartNo, rbnf.EndNo);
                        rbnf.Dispose();
                        break;
                    }
                case "ReportByDateFull":
                    {
                        ReportByDateFull rbdf = new ReportByDateFull(Protocol_Name, description);
                        if (rbdf.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            ReportByDateFull(port, rbdf.Password, rbdf.StartDate, rbdf.EndDate);
                        rbdf.Dispose();
                        break;
                    }
                case "ReportByDateShort":
                    {
                        ReportByDateShort rbds = new ReportByDateShort(Protocol_Name, description);
                        if (rbds.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            ReportByDateShort(port, rbds.Password, rbds.StartDate, rbds.EndDate);
                        rbds.Dispose();
                        break;
                    }
                case "ReportByNoShort":
                    {
                        ReportByNoShort rbns = new ReportByNoShort(Protocol_Name, description);
                        if (rbns.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            ReportByNoShort(port, rbns.Password, rbns.StartNo, rbns.EndNo);
                        rbns.Dispose();
                        break;
                    }
                case "ReportByUsers":
                    {
                        ReportByUsers rbu = new ReportByUsers(Protocol_Name, description);
                        if (rbu.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            ReportByUsers(port, rbu.Password);
                        rbu.Dispose();
                        break;
                    }
                case "ReportByArts":
                    {
                        ReportByArts rba = new ReportByArts(Protocol_Name, description);
                        if (rba.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            ReportByArts(port, rba.Password, rba.ReportMode);
                        rba.Dispose();
                        break;
                    }
                #endregion
                #region Selling
                case "PrintCopy":
                    {
                        PrintCopy pc = new PrintCopy(Protocol_Name, description);
                        if (pc.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            PrintCopy(port, pc.Copies);
                        pc.Dispose();
                        break;
                    }
                case "ResetOrder":
                    {
                        string _infotext = string.Format("{0}", "��������� ������� ����������");
                        System.Windows.Forms.DialogResult _res = System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                            System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);
                        if (_res == System.Windows.Forms.DialogResult.Yes)
                            ResetOrder(port);
                        break;
                    }
                case "PrintFText":
                    {
                        PrintFText pft = new PrintFText(Protocol_Name, description);
                        if (pft.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            PrintFText(port, pft.FixText);
                        pft.Dispose();
                        break;
                    }
                case "PrintNText":
                    {
                        PrintNText pnt = new PrintNText(Protocol_Name, description);
                        if (pnt.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            PrintNText(port, pnt.NonFixText);
                        pnt.Dispose();
                        break;
                    }
                case "OpenNOrder":
                    {
                        ushort[] oinfo = OpenNOrder(port);
                        if (oinfo[3] != 0)
                        {
                            string[] _errMsgs = new string[4]{
                                "�� ������������� �������� ���'���",
                                "³������� ��������� ���",
                                "��� �������� ����������� ���",
                                "�� ����������� ���� � ���"};
                            System.Windows.Forms.DialogResult _res = System.Windows.Forms.MessageBox.Show(_errMsgs[oinfo[3] - 1], Protocol_Name,
                                System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Warning);
                        }

                        value = oinfo.Clone();
                        break;
                    }
                case "CloseNOrder":
                    {
                        ushort[] oinfo = CloseNOrder(port);
                        value = oinfo.Clone();
                        break;
                    }
                case "CloseFOrder":
                    {
                        CloseFOrder(port);
                        break;
                    }
                case "OpenFOrder":
                    {
                        //OpenFOrder(port);
                        break;
                    }
                #endregion
                #region Printer commands
                case "CutChq":
                    {
                        CutChq(port);
                        break;
                    }
                case "LineFeed":
                    {
                        LineFeed lf = new LineFeed(Protocol_Name, description);
                        if (lf.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            LineFeed(port, lf.Lines);
                        lf.Dispose();
                        break;
                    }
                #endregion
                #region Get Info
                case "GetDateTime":
                    {
                        DateTime dtime = GetDateTime(port);
                        string _infotext = string.Format("{0}: {1}", "������� ���� ��������", dtime.ToString("dd-MM-yyyy HH:mm:ss"));
                        System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = dtime;
                        break;
                    }
                case "GetLastZReport":
                    {
                        GetLastZReport glzr = new GetLastZReport(Protocol_Name, description);
                        if (glzr.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            object[] zrep = GetLastZReport(port, glzr.ReportMode);
                            string _infotext = string.Empty;
                            if (!Methods.IsEmpty(zrep))
                            {
                                string _infoFormat = "{0}\r\n\r\n{1} - {2}\r\n{3}: {4:0.00}\r\n{5}: {6:0.00}\r\n";
                                _infoFormat += "{7}: {8}\r\n{9}: {10}\r\n{11}: {12}";
                                _infotext = string.Format(_infoFormat,
                                    "���������� ���������� Z-����",
                                    "����� ����", (uint)zrep[0],
                                    "���� �� ���� �", (double)zrep[1],
                                    "���� �� ���� �", (double)zrep[2],
                                    "���� �� ���� �", (double)zrep[3],
                                    "���� �� ���� �", (double)zrep[4],
                                    "���� �� ���� �", (double)zrep[5]);
                            }
                            else
                                _infotext = "���� �����";

                            System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);

                            value = zrep.Clone();
                        }
                        glzr.Dispose();
                        break;
                    }
                case "GetSummsByDay":
                    {
                        GetSummsByDay gsbd = new GetSummsByDay(Protocol_Name, description);
                        if (gsbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            double[] summ = GetSummsByDay(port, gsbd.ReportMode);
                            string _infoFormat = "{0}\r\n\r\n{1}: {2:0.00}\r\n{3}: {4:0.00}\r\n{5}: {6:0.00}\r\n";
                            _infoFormat += "{7}: {8:0.00}\r\n{9}: {10:0.00}";
                            string _infotext = string.Format(_infoFormat,
                                "���������� ��� �� ����",
                                "���� �� ���� �", (double)summ[0],
                                "���� �� ���� �", (double)summ[1],
                                "���� �� ���� �", (double)summ[2],
                                "���� �� ���� �", (double)summ[3],
                                "���� �� ���� �", (double)summ[4]);
                            System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);

                            value = summ.Clone();
                        }
                        gsbd.Dispose();
                        break;
                    }
                case "GetSumCorByDay":
                    {
                        object[] scorr = GetSumCorByDay(port);
                        string _infoFormat = "{0}\r\n\r\n{1}: {2:0.00}\r\n{3}: {4:0.00}\r\n{5}: {6:0.00}\r\n";
                        _infoFormat += "{7}: {8}\r\n{9}: {10}\r\n{11}: {12}";
                        string _infotext = string.Format(_infoFormat,
                            "���� �������� �� ����",
                            "���� ��� �������", (double)scorr[0],
                            "���� �� ������� ���������", (double)scorr[1],
                            "���� ������ �� �������", (double)scorr[2],
                            "��������� ����", (ushort)scorr[3],
                            "Գ������ ����", (ushort)scorr[4],
                            "���� ����������", (ushort)scorr[5]);
                        System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = scorr.Clone();
                        break;
                    }
                case "GetFreeMem":
                    {
                        uint fmem = GetFreeMem(port);
                        string _infotext = string.Format("{0} {1} {2}", "����� ����� ���'��:", fmem, "������");
                        System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = fmem;
                        break;
                    }
                case "GetState":
                    {
                        byte[] _state = GetState(port);
                        string _infotext = string.Empty;
                        for (int i = 0; i < _state.Length; i++)
                        {
                            if (((string[])CustomData["Status"])[_state[i]].Length == 0)
                                continue;
                            _infotext += ((string[])CustomData["Status"])[_state[i]] + "\r\n";
                            if (i != 0 && _state[i] == 0)
                                break;
                        }
                        System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = _infotext.Split(new string[1] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Clone();
                        break;
                    }
                case "GetFixTransState":
                    {
                        GetFixTransState gfts = new GetFixTransState(Protocol_Name, description);
                        if (gfts.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            object[] transinfo = GetFixTransState(port, gfts.TransParam);
                            string _infoFormat = "{0}\r\n\r\n{1} {2}\r\n{3}: {4}\r\n{5}: {6:0.00}{7}{8}";
                            string _infotext = string.Format(_infoFormat,
                                "���� �������� ����������",
                                "���", ((byte)transinfo[0] == 1) ? "��������" : "�� ��������",
                                "˳������� ��������� ����", transinfo[1],
                                "���� �� ����", (double)transinfo[2],
                                (transinfo[3] == null) ? "" : ("\r\n������ �� ����: " + string.Format("{0:0.00}", (double)transinfo[3])),
                                (transinfo[4] == null) ? "" : ("\r\n������� ������ �������� " + ((byte)transinfo[4] == 1 ? "������" : "�� ������")));
                            System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);

                            value = transinfo.Clone();
                        }

                        break;
                    }
                case "GetDiagInfo":
                    {
                        string[] dinfo = GetDiagInfo(port);
                        string _infoFormat = "{0}\r\n\r\n{1} - {2}\r\n{3}: {4}\r\n{5}: {6}\r\n{7}: {8}";
                        _infoFormat += "\r\n{9} - {10}\r\n{11}: {12}\r\n{13}: {14}";
                        string _infotext = string.Format(_infoFormat,
                            "ij���������� ����������",
                            "����� ��", dinfo[0],
                            "���� ���", DateTime.Parse(dinfo[1] + " " + dinfo[2].Insert(2, ":")).ToString("dd/MM/yyyy HH:mm"),
                            "���������� ����", dinfo[3],
                            "���������� Sw", dinfo[4],
                            "��� �����", dinfo[5],
                            "������� �����", dinfo[6],
                            "Գ�������� �����", dinfo[7]);
                        System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = dinfo.Clone();
                        break;
                    }
                case "GetTaxRates":
                    {
                        double[] taxs = GetTaxRates(port);
                        string _infotext = string.Format("{0}\r\n\r\n{1}: {2:0.00}%\r\n{3}: {4:0.00}%\r\n{5}: {6:0.00}%\r\n{7}: {8:0.00}%",
                            "�������� ������",
                            "�", taxs[0], "�", taxs[1], "�", taxs[2], "�", taxs[3]);
                        System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = taxs.Clone();
                        break;
                    }
                case "GetTaxID":
                    {
                        string[] taxid = GetTaxID(port);
                        string _infotext = string.Format("{0}\r\n\r\n{1} {2}",
                            "���������� ��������������� �����", taxid[0], (taxid[1] == "0") ? "��" : "��");
                        System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = taxid.Clone();
                        break;
                    }
                case "GetChqInfo":
                    {
                        object[] cinfo = GetChqInfo(port);
                        string _infoFormat = "{0}\r\n\r\n{1} - {2}\r\n{3}: {4:0.00}\r\n{5}: {6:0.00}\r\n";
                        _infoFormat += "{7}: {8:0.00}\r\n{9}: {10:0.00}\r\n{11}: {12:0.00}\r\n{13} - {14}";
                        string _infotext = string.Format(_infoFormat,
                            "���������� ��������� ���������� ����",
                            "�������� ����������", ((byte)cinfo[0] == 1) ? "ͳ" : "���",
                            "���� �� ���� �", (double)cinfo[1],
                            "���� �� ���� �", (double)cinfo[2],
                            "���� �� ���� �", (double)cinfo[3],
                            "���� �� ���� �", (double)cinfo[4],
                            "���� �� ���� *", (double)cinfo[5],
                            "���������� ���", ((byte)cinfo[6] == 1) ? "���" : "ͳ");
                        System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = cinfo.Clone();
                        break;
                    }
                case "GetPaymentInfo":
                    {
                        object[] pinfo = GetPaymentInfo(port);
                        string _infoFormat = "{0}\r\n\r\n{1}: {2:0.00}\r\n{3}: {4:0.00}\r\n{5}: {6:0.00}\r\n";
                        _infoFormat += "{7}: {8:0.00}\r\n{9} - {10}\r\n{11} - {12}\r\n{13} - {14}";
                        string _infotext = string.Format(_infoFormat,
                            "���������� �� ����� ����������",
                            "������", (double)pinfo[0],
                            "������", (double)pinfo[1],
                            "������� ������", (double)pinfo[2],
                            "���", (double)pinfo[3],
                            "����� ��������� Z-����", (uint)pinfo[4],
                            "����� ���������� Z-����", (uint)pinfo[5],
                            "���������� �������� ����", (uint)pinfo[6]);
                        System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = pinfo.Clone();
                        break;
                    }
                case "GetUserInfo":
                    {
                        GetUserInfo gui = new GetUserInfo(Protocol_Name, description);
                        if (gui.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            object[] uinfo = GetUserInfo(port, gui.UserNo);
                            string _infoFormat = "{0}\r\n\r\n{1} - {2}\r\n{3}: [{4}]; {5:0.00}\r\n{6}: [{7}]; {8:0.00}\r\n";
                            _infoFormat += "{9}: [{10}]; {11:0.00}\r\n{12}: [{13}]; {14:0.00}\r\n{15}: [{16}]; {17:0.00}\r\n{18}: {19}";
                            string _infotext = string.Format(_infoFormat,
                                "���������� ��� ������",
                                "���������� ����", (uint)uinfo[0],
                                "ʳ������ � ���� �������", (uint)uinfo[1], (double)uinfo[2],
                                "ʳ������ � ���� ������", (uint)uinfo[3], (double)uinfo[4],
                                "ʳ������ � ���� ���������", (uint)uinfo[5], (double)uinfo[6],
                                "ʳ������ � ���� ���� ���������", (uint)uinfo[7], (double)uinfo[8],
                                "����", (uint)uinfo[9], (double)uinfo[10],
                                "������������", uinfo[11].ToString());
                            System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);

                            value = uinfo.Clone();
                        }
                        gui.Dispose();

                        break;
                    }
                case "GetLastFChqNo":
                    {
                        uint cno = GetLastFChqNo(port);
                        string _infotext = string.Format("{0} {1}", "����� ���������� ���������� ����:", cno);
                        System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = cno;
                        break;
                    }
                case "GetFixMem":
                    {
                        GetFixMem gfm = new GetFixMem(Protocol_Name, description);
                        if (gfm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            object[] fmem = GetFixMem(port, gfm.FixNo, gfm.ReturnType, gfm.SecondaryParam);
                            string _infoFormat = "{0}\r\n\r\n{1} {2}\r\n{3}: {4}\r\n{5}: {6}\r\n{7}: {8}\r\n{9} {10}";
                            string _infotext = string.Format(_infoFormat,
                                "���������� �������� ���'��",
                                "���", fmem[0],
                                "˳������� ��������� ����", fmem[1],
                                "���� �� ����", fmem[3],
                                "������ �� ����", fmem[4],
                                "������� ������ ��������", fmem[5]);
                            System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);

                            value = fmem.Clone();
                        }
                        break;
                    }
                case "GetRemTime":
                    {
                        object[] remtime = GetRemTime(port);
                        string _infotext = string.Format("{0}", "�������� ���� �� ���������� ����");
                        System.Windows.Forms.MessageBox.Show(_infotext, Protocol_Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        value = remtime.Clone();
                        break;
                    }
                #endregion

                #region Program access methods
                case "FP_SendCustomer":
                    {
                        FP_SendCustomer(port, param);
                        break;
                    }
                case "FP_SetCashier":
                    {
                        FP_SetCashier(port, param);
                        break;
                    }
                case "FP_LastZRepNo":
                    {
                        FP_LastZRepNo(port, param);
                        break;
                    }
                case "FP_LastChqNo":
                    {
                        value = FP_LastChqNo(port, param);
                        break;
                    }
                case "FP_OpenBox":
                    {
                        FP_OpenBox(port);
                        break;
                    }

                #endregion
                #region
                /*
                #region Functions of registration
                case "SendStatus":
                    {
                        object[] FPinfo = SendStatus(port);

                        if (FPinfo != null && FPinfo.Length != 0)
                        {
                            FP_Info fi = new FP_Info(FPinfo, Protocol_Name);
                            fi.ShowDialog();
                            fi.Dispose();
                        }

                        break;
                    }
                case "GetDate":
                    {
                        System.Windows.Forms.MessageBox.Show(GetDate(port).ToLongDateString(),Protocol_Name);
                        break;
                    }
                case "SetDate":
                    {
                        if (param == null || param.Length == 0)
                        {
                            SetDate sd = new SetDate(Protocol_Name, description);
                            if (sd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                SetDate(port, sd.date);
                            sd.Dispose();
                        }
                        else
                            SetDate(port, (DateTime)param[0]);

                        break;
                    }
                case "GetTime":
                    {
                        System.Windows.Forms.MessageBox.Show(GetTime(port).ToLongTimeString(),
                            Protocol_Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);
                        break;
                    }
                case "SetTime":
                    {
                        if (param == null || param.Length == 0)
                        {
                            SetTime st = new SetTime(Protocol_Name, description);
                            if (st.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                SetTime(port, st.time);
                            st.Dispose();
                        }
                        else
                            SetTime(port, (DateTime)param[0]);

                        break;
                    }
                case "SetCod":
                    {
                        if (param == null || param.Length == 0)
                        {
                            SetCod sc = new SetCod(Protocol_Name, description);
                            if (sc.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                SetCod(port, sc.oldPass, sc.nom, sc.newPass);
                            sc.Dispose();
                        }
                        else
                            SetCod(port, (uint)param[0], (byte)param[1], (uint)param[2]);

                        break;
                    }
                case "SetCashier":
                    {
                        if (param == null || param.Length == 0)
                        {
                            SetCashier sc = new SetCashier(Protocol_Name, description);
                            if (sc.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                SetCashier(port, sc.nom, sc.pass, sc.id);
                            sc.Dispose();
                        }
                        else
                            SetCashier(port, Convert.ToByte(param[0]), (uint)param[1], param[2].ToString());

                        break;
                    }
                case "PayMoney":
                    {
                        if (Errors[name])
                            ResetOrder(port);

                        uint articleNewID = LoadArtID(port);

                        if (articleNewID + 50 == uint.MaxValue)
                        {
                            System.Windows.Forms.MessageBox.Show("�������� ������� Z-��� ��� ���������� �������",
                                Protocol_Name, System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);
                            return null;
                        }

                        if (param == null || param.Length == 0)
                        {
                            PayMoney s = new PayMoney(Protocol_Name, description);
                            if (s.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                object[] article = null;
                                for (byte i = 0; i < s.articles.Length; i++)
                                {
                                    article = (object[])s.articles[i];
                                    articleNewID++;
                                    PayMoney(port, (double)article[0], (byte)article[1], s.dontPrintOne,
                                        (double)article[2], article[3].ToString()[0],
                                        article[4].ToString(), articleNewID);
                                }
                            }
                            s.Dispose();
                        }
                        else
                        {
                            System.Data.DataTable dTable = (System.Data.DataTable)param[0];
                            object[] article = new object[5];
                            byte ppt = Convert.ToByte(param[1]);
                            bool useTotDisc = (bool)param[2];

                            for (int i = 0; i < dTable.Rows.Count; i++)
                            {
                                article[0] = Methods.GetDouble(dTable.Rows[i]["TOT"]);
                                article[1] = ppt;
                                article[2] = Methods.GetDouble(dTable.Rows[i]["PRICE"]);
                                article[3] = dTable.Rows[i]["VG"];
                                article[4] = dTable.Rows[i]["NAME"].ToString().Replace('�', 'i').Replace('�', 'I');
                                articleNewID++;
                                PayMoney(port, (double)article[0], (byte)article[1], true,
                                    (double)article[2], article[3].ToString()[0],
                                    article[4].ToString(), articleNewID);
                                if (!useTotDisc && (bool)dTable.Rows[i]["USEDDISC"] && (double)dTable.Rows[i]["DISC"] != 0)
                                    Discount(port, (byte)0, (double)dTable.Rows[i]["DISC"], ppt, "");
                            }
                        }
                        SaveArtID(articleNewID);
                        break;
                    }
                case "Comment":
                    {
                        if (param == null || param.Length == 0)
                        {
                            Comment cmm = new Comment(Protocol_Name, description);
                            if (cmm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                Comment(port, cmm.commentLine, cmm.retCheque);
                            cmm.Dispose();
                        }
                        else
                            Comment(port, param[0].ToString(), (bool)param[1]);

                        break;
                    }
                case "CplPrint":
                    {
                        CplPrint(port);
                        byte[] mem = GetMemory(port, "2A", 0, 1);
                        //BIT 6 - OnLine state
                        string _status = string.Format("{0} {1}", "���� � ������������ �����", (mem[0] & 0x08) != 0 ? "����������" : "�� ����������");
                        System.Windows.Forms.MessageBox.Show(_status, Protocol_Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);
                        break;
                    }
                case "LineFeed":
                    {
                        LineFeed(port);
                        break;
                    }
                case "ResetOrder":
                    {
                        ResetOrder(port);
                        break;
                    }
                case "Avans":
                    {
                        if (param == null || param.Length == 0)
                        {
                            Avans a = new Avans(Protocol_Name, description);
                            if (a.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                Avans(port, a.copecks);
                            a.Dispose();
                        }
                        else
                            Avans(port, Convert.ToUInt32(param[0]));

                        break;
                    }
                case "Sale":
                    {
                        if (Errors[name])
                            ResetOrder(port);

                        uint articleNewID = LoadArtID(port);

                        if (articleNewID + 50 == uint.MaxValue)
                        {
                            System.Windows.Forms.MessageBox.Show("�������� ������� Z-��� ��� ���������� �������",
                                Protocol_Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Warning);
                            return null;
                        }

                        if (param == null || param.Length == 0)
                        {
                            Sale s = new Sale(Protocol_Name, description);
                            if (s.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                object[] article = null;
                                for (byte i = 0; i < s.articles.Length; i++)
                                {
                                    article = (object[])s.articles[i];
                                    articleNewID++;
                                    Sale(port, (double)article[0],
                                        (byte)article[1], s.dontPrintOne,
                                        (double)article[2], article[3].ToString()[0],
                                        article[4].ToString(), articleNewID, (byte)article[6]);
                                }
                            }
                            s.Dispose();
                        }
                        else
                        {
                            System.Data.DataTable dTable = (System.Data.DataTable)param[0];
                            object[] article = new object[5];
                            byte dose_ppt = Convert.ToByte(param[1]);
                            byte money_ppt = Convert.ToByte(param[3]);
                            bool useTotDisc = (bool)param[2];

                            System.IO.StreamWriter sWr = null;

                            for (int i = 0; i < dTable.Rows.Count; i++)
                            {
                                article[0] = Methods.GetDouble(dTable.Rows[i]["TOT"]);
                                article[2] = Methods.GetDouble(dTable.Rows[i]["PRICE"]);
                                article[3] = dTable.Rows[i]["VG"];
                                article[4] = dTable.Rows[i]["NAME"].ToString().Replace('�', 'i').Replace('�', 'I');
                                articleNewID++;

                                sWr = System.IO.File.AppendText("a.txt");
                                sWr.WriteLine(articleNewID);
                                sWr.Close();
                                sWr.Dispose();
                                Sale(port, (double)article[0], dose_ppt, false, (double)article[2],
                                    article[3].ToString()[0], article[4].ToString(), articleNewID, money_ppt);
                                if (!useTotDisc && (bool)dTable.Rows[i]["USEDDISC"] && (double)dTable.Rows[i]["DISC"] != 0)
                                    Discount(port, (byte)0, (double)dTable.Rows[i]["DISC"], money_ppt, "");
                            }
                            sWr = System.IO.File.AppendText("a.txt");
                            sWr.WriteLine("-----");
                            sWr.Close();
                            sWr.Dispose();
                        }

                        SaveArtID(articleNewID);
                        break;
                    }
                case "Payment":
                    {

                        if (param == null || param.Length == 0)
                        {
                            Payment p = new Payment(Protocol_Name, description);
                            if (p.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                object[] ans = Payment(port, (byte)p.payInfo[0], (bool)p.payInfo[1],
                                    (double)p.payInfo[2], (bool)p.payInfo[3], p.payInfo[4].ToString());
                                try
                                {
                                    string info = string.Empty;
                                    if (ans[0].ToString() == "1")
                                        info += "����� : ";
                                    else
                                        info += "������� : ";

                                    info += string.Format("{0:F2}", ans[1]);
                                    System.Windows.Forms.MessageBox.Show(info, Protocol_Name,
                                        System.Windows.Forms.MessageBoxButtons.OK,
                                        System.Windows.Forms.MessageBoxIcon.Information);
                                }
                                catch { }
                            }
                            p.Dispose();
                        }
                        else
                            Payment(port, (byte)param[0], (bool)param[1], (double)param[2],
                                (bool)param[3], param[4].ToString());

                        break;
                    }
                case "SetString":
                    {
                        if (param == null || param.Length == 0)
                        {
                            SetString ss = new SetString(Protocol_Name, description);
                            if (ss.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                SetString(port, ss.lines);
                            ss.Dispose();
                        }
                        else
                            SetString(port, (string[])param);

                        break;
                    }
                case "Give":
                    {
                        if (param == null || param.Length == 0)
                        {
                            Give g = new Give(Protocol_Name, description);
                            if (g.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                Give(port, g.copecks);
                            g.Dispose();
                        }
                        else
                            Give(port, (uint)param[0]);

                        break;
                    }
                case "SendCustomer":
                    {
                        if (param == null || param.Length == 0)
                        {
                            SendCustomer sc = new SendCustomer(Protocol_Name, description);
                            if (sc.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                SendCustomer(port, sc.lines, sc.show);
                            sc.Dispose();
                        }
                        else
                            SendCustomer(port, (string[])param[0], (bool[])param[1]);

                        break;
                    }
                case "GetMemory":
                    {
                        if (param == null || param.Length == 0)
                        {
                            GetMemory gm = new GetMemory(Protocol_Name, description);
                            if (gm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                byte[] mem = GetMemory(port, gm.block, gm.page, gm.size);
                                string memInfoLine = "DEC :";
                                for (int i = 0; i < mem.Length; i++)
                                {
                                    if (i % 10 == 0)
                                        memInfoLine += "\r\n";
                                    memInfoLine += mem[i].ToString() + " ";
                                }
                                memInfoLine += "\r\n\r\nHEX :";
                                for (int i = 0; i < mem.Length; i++)
                                {
                                    if (i % 10 == 0)
                                        memInfoLine += "\r\n";
                                    memInfoLine += String.Format("{0:X2}", mem[i]) + " ";
                                }
                                System.Windows.Forms.MessageBox.Show(memInfoLine, Protocol_Name,
                                    System.Windows.Forms.MessageBoxButtons.OK,
                                    System.Windows.Forms.MessageBoxIcon.Information);
                            }
                            gm.Dispose();
                        }
                        else
                        {
                            byte[] mem = GetMemory(port, param[0].ToString(), Convert.ToByte(param[1]), Convert.ToByte(param[2]));
                            value = new object[1];
                            value[0] = Methods.GetNumberFromBCD(mem);
                        }

                        break;
                    }
                case "OpenBox":
                    {
                        OpenBox(port);
                        break;
                    }
                case "PrintCopy":
                    {
                        PrintCopy(port);
                        break;
                    }
                case "PrintVer":
                    {
                        PrintVer(port);
                        break;
                    }
                case "GetBox":
                    {
                        uint copecks = GetBox(port);
                        string _status = string.Format("� ���� : {0}", (double)(copecks / 100) + (double)(copecks % 100) / 100);
                        System.Windows.Forms.MessageBox.Show(_status, Protocol_Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);
                        break;
                    }
                case "Discount":
                    {
                        if (param == null || param.Length == 0)
                        {
                            Discount d = new Discount(Protocol_Name, description);
                            if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                Discount(port, (byte)d.discInfo[0], (double)d.discInfo[1], Convert.ToByte(d.discInfo[2]), d.discInfo[3].ToString());
                            d.Dispose();
                        }
                        else
                            Discount(port, (byte)param[0], (double)param[1], Convert.ToByte(param[2]), param[3].ToString());

                        break;
                    }
                case "CplOnline":
                    {
                        CplOnline(port);
                        byte[] mem = GetMemory(port, "2A", 0, 1);
                        //BIT 6 - OnLine state
                        string _status = string.Format("{0} {1}", "����� OnLine", (mem[0] & 0x40) != 0 ? "��������" : "��������");
                        System.Windows.Forms.MessageBox.Show(_status, Protocol_Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);
                        break;
                    }
                case "CplInd":
                    {
                        CplInd(port);
                        byte[] mem = GetMemory(port, "29", 0, 1);
                        //BIT 7 - Indicator state
                        string _status = string.Format("{0} {1}", "������ ���� �� ���������", (mem[0] & 0x80) != 0 ? "�� �������" : "�������");
                        System.Windows.Forms.MessageBox.Show(_status, Protocol_Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);
                        break;
                    }
                case "ChangeRate":
                    {
                        if (param == null || param.Length == 0)
                        {
                            ChangeRate cr = new ChangeRate(Protocol_Name, description);
                            if (cr.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                ChangeRate(port, cr.rate);
                            cr.Dispose();
                        }
                        else
                            ChangeRate(port, (byte)param[0]);

                        break;
                    }
                case "LineSP":
                    {
                        if (param == null || param.Length == 0)
                        {
                            LineSP lsp = new LineSP(Protocol_Name, description);
                            if (lsp.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                LineSP(port, lsp.lsp);
                            lsp.Dispose();
                        }
                        else
                            LineSP(port, (byte)param[0]);

                        break;
                    }
                case "TransPrint":
                    {
                        if (param == null || param.Length == 0)
                        {
                            TransPrint tp = new TransPrint(Protocol_Name, description);
                            if (tp.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                TransPrint(port, tp.text, tp.endPrint);
                            tp.Dispose();
                        }
                        else
                            TransPrint(port, param[0].ToString(), (bool)param[0]);

                        break;
                    }
                case "GetArticle":
                    {
                        object[] artInfo = new object[0];
                        string info = string.Empty;
                        if (param == null)
                        {
                            GetArticle ga = new GetArticle(Protocol_Name, description);
                            if (ga.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                artInfo = GetArticle(port, ga.articleID);
                            ga.Dispose();
                        }
                        else
                            artInfo = GetArticle(port, (uint)param[0]);

                        if (artInfo.Length != 0)
                        {
                            info += "����� ������" + " : ";
                            info += artInfo[0].ToString() + "\r\n";
                            info += "ʳ������" + " : ";
                            info += artInfo[1].ToString() + "\r\n";
                            info += "ֳ��" + " : ";
                            info += artInfo[2].ToString() + "\r\n";
                            info += "��������� �����" + " : ";
                            info += artInfo[3].ToString() + "\r\n";
                            info += "���� ����" + " : ";
                            info += artInfo[4].ToString() + "\r\n";
                            info += "\r\n\r\n";
                            info += "�������� ��������" + "\r\n";
                            info += "ʳ������" + " : ";
                            info += artInfo[5].ToString() + "\r\n";
                            info += "���� ����" + " : ";
                            info += artInfo[6].ToString() + "\r\n";
                        }
                        else
                            info = "���������� ��� �� ����� �������";

                        System.Windows.Forms.MessageBox.Show(info, Protocol_Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);

                        break;
                    }
                case "GetDayReport":
                    {
                        value = GetDayReport(port);
                        if (param == null && value != null && value.Length != 0)
                        {
                            string dayRepInfoLine = string.Empty;
                            int i = 0;
                            string[] payTypes = new string[] { "������", "������", "���", "������" };

                            double[] sales_group = (double[])((object[])value[1])[0];
                            double[] sales_forms = (double[])((object[])value[1])[1];

                            double[] pays_group = (double[])((object[])value[6])[0];
                            double[] pays_forms = (double[])((object[])value[6])[1];

                            dayRepInfoLine += "˳������� ���� ������ : " + value[0];
                            dayRepInfoLine += "\r\n";
                            dayRepInfoLine += "˳������� ������ �� ���������� ������ � ������ ������";
                            dayRepInfoLine += "\r\n";
                            for (i = 0; i < sales_group.Length; i++)
                                dayRepInfoLine += string.Format("{0} : {1:F2}\r\n", (char)(((int)'�') + i), sales_group[i]);
                            dayRepInfoLine += "--------------\r\n";
                            for (i = 0; i < sales_forms.Length; i++)
                                dayRepInfoLine += string.Format("{0} : {1:F2}\r\n", payTypes[i], sales_forms[i]);
                            dayRepInfoLine += "\r\n";
                            dayRepInfoLine += "����� ������� �� �������� : " + value[2];
                            dayRepInfoLine += "\r\n";
                            dayRepInfoLine += "����� ������ �� �������� : " + value[3];
                            dayRepInfoLine += "\r\n";
                            dayRepInfoLine += "����� ���� ���������� �������� : " + value[4];
                            dayRepInfoLine += "\r\n\r\n";
                            dayRepInfoLine += "˳������� ���� ������ : " + value[5];
                            dayRepInfoLine += "\r\n";
                            dayRepInfoLine += "˳������� ������ �� ���������� ������ � ������ ������";
                            dayRepInfoLine += "\r\n";
                            for (i = 0; i < pays_group.Length; i++)
                                dayRepInfoLine += string.Format("{0} : {1:F2}\r\n", (char)(((int)'�') + i), pays_group[i]);
                            dayRepInfoLine += "--------------\r\n";
                            for (i = 0; i < pays_forms.Length; i++)
                                dayRepInfoLine += string.Format("{0} : {1:F2}\r\n", payTypes[i], pays_forms[i]);
                            dayRepInfoLine += "\r\n";
                            dayRepInfoLine += "����� ������� �� �������� : " + value[7];
                            dayRepInfoLine += "\r\n";
                            dayRepInfoLine += "����� ������ �� �������� : " + value[8];
                            dayRepInfoLine += "\r\n";
                            dayRepInfoLine += "����� ���� �������� ������ : " + value[9];

                            System.Windows.Forms.MessageBox.Show(dayRepInfoLine, Protocol_Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);
                        }
                        break;
                    }
                case "GetCheckSums":
                    {
                        value = GetCheckSums(port);
                        if (value != null && value.Length != 0)
                        {
                            string checkSumsInfoLine = string.Empty;
                            int i = 0;
                            checkSumsInfoLine += "˳������� ���� �� ���������� ������";
                            checkSumsInfoLine += "\r\n";
                            double[] tax = (double[])value[0];
                            for (i = 0; i < tax.Length; i++)
                                checkSumsInfoLine += string.Format("{0} : {1:F2}\r\n", (char)(((int)'�') + i), tax[i]);
                            checkSumsInfoLine += "\r\n";
                            double[] sum = (double[])value[1];
                            checkSumsInfoLine += "˳������� ��� ����� �� ������ �����";
                            checkSumsInfoLine += "\r\n";
                            string[] payTypes = new string[] { "������", "������", "���", "������" };
                            for (i = 0; i < sum.Length; i++)
                                checkSumsInfoLine += string.Format("{0} : {1:F2}\r\n", payTypes[i], sum[i]);

                            System.Windows.Forms.MessageBox.Show(checkSumsInfoLine, Protocol_Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);
                        }
                        break;
                    }
                case "GetTaxRates":
                    {
                        object[] taxData = GetTaxRates(port);
                        if (taxData != null && taxData.Length != 0)
                        {
                            string taxInfoLine = string.Empty;
                            taxInfoLine += "�-��� ���������� ������ : " + taxData[0];
                            taxInfoLine += "\r\n";
                            taxInfoLine += "���� ������������ : " + ((DateTime)taxData[1]).ToLongDateString();
                            taxInfoLine += "\r\n\r\n";
                            taxInfoLine += "������ ���";
                            taxInfoLine += "\r\n";
                            double[] tax = (double[])taxData[2];
                            for (int i = 0; i < tax.Length; i++)
                                taxInfoLine += string.Format("{0} : {1:F2}%\r\n", (char)(((int)'�') + i), tax[i]);
                            taxInfoLine += "\r\n";
                            taxInfoLine += "�-��� ���������� ������� �������� ��� : " + taxData[3];
                            taxInfoLine += "\r\n";
                            taxInfoLine += "��� ��� : " + ((taxData[4].ToString() == "0") ? "��������" : "�������");
                            if ((bool)taxData[5])
                            {
                                taxInfoLine += "\r\n\r\n";
                                taxInfoLine += "������ �����";
                                taxInfoLine += "\r\n";
                                tax = (double[])taxData[6];
                                for (int i = 0; i < tax.Length; i++)
                                    taxInfoLine += string.Format("{0} : {1:F2}%\r\n", (char)(((int)'�') + i), tax[i]);
                            }
                            System.Windows.Forms.MessageBox.Show(taxInfoLine, Protocol_Name,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Information);
                        }
                        break;
                    }
                case "CplCutter":
                    {
                        CplCutter(port);
                        byte[] mem = GetMemory(port, "301A", 16, 1);
                        //BIT 3 - Cutter state
                        string _status = string.Format("{0} {1}", "�������", (mem[0] & 0x08) == 0 ? "��������" : "�� ��������");
                        System.Windows.Forms.MessageBox.Show(_status, Protocol_Name,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Information);
                        break;
                    }
                #endregion
                #region Function of programming
                case "Fiscalization":
                    {
                        Fiscalazation f = new Fiscalazation(Protocol_Name, description);
                        if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            Fiscalization(port, f.pass, f.fn);
                        f.Dispose();

                        break;
                    }
                case "SetHeadLine":
                    {
                        SetHeadLine shl = new SetHeadLine(Protocol_Name, description);
                        if (shl.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            SetHeadLine(port, shl.pass, shl.line1, shl.line2, shl.line3, shl.line4);
                        shl.Dispose();

                        break;
                    }
                case "SetTaxRate":
                    {
                        SetTaxRate str = new SetTaxRate(Protocol_Name, description);
                        if (str.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            SetTaxRate(port, str.pass, str.taxCount, str.tax, str.status, str.taxGCount, str.gtax);
                        str.Dispose();

                        break;
                    }
                case "ProgArt":
                    {
                        if (param == null || param.Length == 0)
                        {
                            ProgArt pa = new ProgArt(Protocol_Name, description);
                            if (pa.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                object[] article = null;
                                for (byte i = 0; i < pa.articles.Length; i++)
                                {
                                    article = (object[])pa.articles[i];

                                    ProgArt(port, pa.pass, (byte)article[0],
                                        (double)article[1], article[2].ToString()[0],
                                        article[3].ToString(), (uint)article[4]);
                                }
                            }
                            pa.Dispose();
                        }
                        else
                        {
                            System.Data.DataTable dTable = (System.Data.DataTable)param[0];
                            object[] article = new object[5];
                            byte ppt = Convert.ToByte(param[1]);
                            uint articleNewID = LoadArtID(port);

                            System.IO.StreamWriter sWr = null;

                            for (int i = 0; i < dTable.Rows.Count; i++)
                            {
                                article[0] = ppt;
                                article[1] = Methods.GetDouble(dTable.Rows[i]["PRICE"]);
                                article[2] = dTable.Rows[i]["VG"];
                                article[3] = dTable.Rows[i]["NAME"].ToString().Replace('�', 'i').Replace('�', 'I');
                                articleNewID++;

                                ProgArt(port, (ushort)0, (byte)article[0], (double)article[1],
                                    article[3].ToString()[0], article[4].ToString(), articleNewID);
                            }
                        }

                        break;
                    }
                case "LoadBMP":
                    {
                        LoadBMP lbmp = new LoadBMP(Protocol_Name, description);
                        if (lbmp.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            LoadBMP(port, (ushort)lbmp.imageInfo[0], true, lbmp.imageInfo[1].ToString());
                        lbmp.Dispose();

                        break;
                    }
                #endregion
                #region Function of reports
                case "ArtReport":
                    {
                        byte[] mem = GetMemory(port, "3003", 16, 2 * 10);
                        uint pass = (uint)Methods.GetNumber(new byte[] { mem[18], mem[19] });
                        ArtReport(port, pass);
                        break;
                    }
                case "ArtXReport":
                    {
                        byte[] mem = GetMemory(port, "3003", 16, 2 * 10);
                        uint pass = (uint)Methods.GetNumber(new byte[] { mem[18], mem[19] });
                        ArtXReport(port, pass);
                        break;
                    }
                case "DayReport":
                    {
                        byte[] mem = GetMemory(port, "3003", 16, 2 * 10);
                        uint pass = (uint)Methods.GetNumber(new byte[] { mem[18], mem[19] });
                        DayReport(port, pass);
                        break;
                    }
                case "DayClrReport":
                    {
                        byte[] mem = GetMemory(port, "3003", 16, 2 * 10);
                        uint pass = (uint)Methods.GetNumber(new byte[] { mem[18], mem[19] });
                        DayClrReport(port, pass);

                        System.IO.StreamWriter sWr = System.IO.File.AppendText("a.txt");
                        sWr.WriteLine("---------\r\n## Z-rep ##\r\n---------");
                        sWr.Close();
                        sWr.Dispose();

                        break;
                    }
                case "PeriodicReport":
                    {
                        byte[] mem = GetMemory(port, "3003", 16, 2 * 10);
                        uint pass = (uint)Methods.GetNumber(new byte[] { mem[18], mem[19] });
                        PeriodicReport pr = new PeriodicReport(Protocol_Name, description);
                        if (pr.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            PeriodicReport(port, pass, pr.startDate, pr.endDate);
                        pr.Dispose();

                        break;
                    }
                case "PeriodicReportShort":
                    {
                        byte[] mem = GetMemory(port, "3003", 16, 2 * 10);
                        uint pass = (uint)Methods.GetNumber(new byte[] { mem[18], mem[19] });
                        PeriodicReportShort prs = new PeriodicReportShort(Protocol_Name, description);
                        if (prs.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            PeriodicReportShort(port, pass, prs.startDate, prs.endDate);
                        prs.Dispose();

                        break;
                    }
                case "PeriodicReport2":
                    {
                        byte[] mem = GetMemory(port, "3003", 16, 2 * 10);
                        uint pass = (uint)Methods.GetNumber(new byte[] { mem[18], mem[19] });
                        PeriodicReport2 pr2 = new PeriodicReport2(Protocol_Name, description);
                        if (pr2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            PeriodicReport2(port, pass, pr2.startNo, pr2.endNo);
                        pr2.Dispose();

                        break;
                    }
                #endregion
            */
                #endregion
            }
            return value;
        }