Esempio n. 1
0
        private void btMariaXreport_Click(object sender, EventArgs e)
        {
            Maria301Printer _printer = new Maria301Printer(1);

            if (_printer.HasError)
            {
                MessageBox.Show("Ошибка инициализации принтера ");
                _printer.Done();
                return;
            }


            if (DialogResult.OK == MessageBox.Show(this, "Поверните ключ в положение Х отчет ", "Печать Х отчета", MessageBoxButtons.OKCancel, MessageBoxIcon.Information))
            {
                _printer.XReport();
            }

            while (_printer.KeyPosition != Maria301Printer.KeyPositions.Work)
            {
                MessageBox.Show("Поверните ключ в рабочее положение!", "Печать отчета закончена");
            }



            _printer.Done();
        }
Esempio n. 2
0
        private void btClose_Click(object sender, EventArgs e)
        {
            _printer.Done();
            foreach (GridView view in this.grid.ViewCollection)
            {
                string fileName = new FileInfo(Application.ExecutablePath).DirectoryName + "\\" + view.Name.ToString() + ".xml";
                view.SaveLayoutToXml(fileName);
            }

            this._mainForm.MariaMenu.Enabled = true;
            this._mainForm.DeleteDataTab(this.Parent as TabPage);
        }
Esempio n. 3
0
        private void btMariaZperiodReport_Click(object sender, EventArgs e)
        {
            Maria301Printer _printer = new Maria301Printer(1);

            if (_printer.HasError)
            {
                MessageBox.Show("Ошибка инициализации принтера ");
                _printer.Done();
                return;
            }



            if (DialogResult.OK == MessageBox.Show(this, "Поверните ключ в положение Z отчет ", "Печать отчета за период", MessageBoxButtons.OKCancel, MessageBoxIcon.Information))
            {
                if (_printer.KeyPosition != Maria301Printer.KeyPositions.ZReport)
                {
                    _printer.Done();
                    return;
                }


                DialogPeriod _DialogPeriod = new DialogPeriod();

                if (_DialogPeriod.ShowDialog(this) == DialogResult.OK)
                {
                    if (!_printer.ZPeriodReport(_DialogPeriod.StartDate, _DialogPeriod.EndDate))
                    {
                        MessageBox.Show("Печать отчета не выполнена");
                    }
                }
            }


            while (_printer.KeyPosition != Maria301Printer.KeyPositions.Work)
            {
                MessageBox.Show("Поверните ключ в рабочее положение!", "Печать переодического Z отчета закончена");
            }
            _printer.Done();
        }
Esempio n. 4
0
        private void btMariaZReport_Click(object sender, EventArgs e)
        {
            Maria301Printer _printer = new Maria301Printer(1);

            if (_printer.HasError)
            {
                MessageBox.Show("Ошибка инициализации принтера ");
                _printer.Done();
                return;
            }

            /* если нет строки*/

            MDataSet.CashRow _firstRow;

            DataRow[] dataRowsInTable = this.mDataSet.Cash.Select("NumZ = " + _printer.Info.NumZ.ToString());

            if (dataRowsInTable.Length == 0)
            {
                dataRowsInTable = this.mDataSet.Cash.Select("NumZ = -1");
                if (dataRowsInTable.Length != 0)
                {
                    _firstRow      = (dataRowsInTable[0] as MDataSet.CashRow);
                    _firstRow.NumZ = _printer.Info.NumZ;
                }
                else
                {
                    _firstRow = (this.cashBindingSource.AddNew() as DataRowView).Row as MDataSet.CashRow;

                    _firstRow.NumZ         = _printer.Info.NumZ;
                    _firstRow.Date         = DateTime.Today;
                    _firstRow.BalanceBegin = _printer.Info.BalanceBegin;
                    _firstRow.BalanceEnd   = _printer.Info.BalanceEnd;
                    _firstRow.OfIncome     = 0;
                    _firstRow.OfExpend     = _printer.Info.OfExpend;
                    _firstRow.Income       = _printer.Info.Income;
                    _firstRow.Expend       = 0;
                    this.cashBindingSource.EndEdit();
                    this.cashTableAdapter.Update(_firstRow);
                }
            }
            else
            {
                _firstRow = null;
            }



            if ((_printer.Info.ifJustZ) & _firstRow != null)
            {
                _firstRow.NumZ += 1;



                DataRow[] _forSave = new DataRow[1];
                _forSave[0] = _firstRow;

                this.SaveToBaseDirectoryModifed(_forSave);

                _printer.Done();

                MessageBox.Show("Z отчет был снят!");
                return;
            }


            this.cashBindingSource.Position = this.cashBindingSource.Find("NumZ", _printer.Info.NumZ);

            MDataSet.CashRow _cashRow = (this.cashBindingSource.Current as DataRowView).Row as MDataSet.CashRow;

            if (_cashRow == null)
            {
                MessageBox.Show("Не инициализированна касса!");
                return;
            }

            int newZ = _printer.Info.NumZ + 1;

            _cashRow.NumZ         = _printer.Info.NumZ;
            _cashRow.Date         = DateTime.Today;
            _cashRow.BalanceBegin = _printer.Info.BalanceBegin;
            _cashRow.OfIncome     = 0;
            _cashRow.OfExpend     = _printer.Info.OfExpend;
            _cashRow.Income       = _printer.Info.Income;
            _cashRow.Expend       = 0;
            _cashRow.BalanceEnd   = _printer.Info.BalanceEnd;


            DataRow[] _modif1 = new DataRow[1];
            _modif1[0] = _cashRow;

            if (!this.SaveToBaseDirectoryModifed(_modif1))
            {
                _printer.Done();

                return;
            }


            if (DialogResult.OK == MessageBox.Show(this, "Поверните ключ в положение Z отчет ", "Печать Z дневного отчета", MessageBoxButtons.OKCancel, MessageBoxIcon.Information))
            {
                _printer.ZReport();
            }


            try
            {
                this.cashTableAdapter.ClosePeriod(newZ);
                this.cashTableAdapter.Fill(this.mDataSet.Cash);
                this.FillTableNewDocuments(this.mDataSet.InvoiceMaster);
            }

            catch (Exception err)
            {
                Log("Zreport" + err.Message);
                MessageBox.Show("Ошибка!!! " + err.Message);
            }

            finally
            {
                this.cashBindingSource.Position = this.cashBindingSource.Find("NumZ", newZ);
            }



            while (_printer.KeyPosition != Maria301Printer.KeyPositions.Work)
            {
                MessageBox.Show("Поверните ключ в рабочее положение!", "Печать переодического отчета закончена");
            }


            MessageBox.Show("Остаток в кассе : " + _printer.Info.BalanceEnd.ToString(), "Печать дневного отчета (Z-Отчет)");

            _printer.Done();
        }
Esempio n. 5
0
        private void btMariaOfExpend_Click(object sender, EventArgs e)
        {
            Maria301Printer _printer = new Maria301Printer(this.LocalSettingRow.Num);

            if (_printer.HasError)
            {
                _printer.Done();

                MessageBox.Show("Ошибка принтера: " + _printer.ErrorText);


                return;
            }

            if (_printer.Info.ifJustZ)
            {
                _printer.Done();

                MessageBox.Show(" Был снят Z отчет! ");
                return;
            }


            this.cashBindingSource.Position = this.cashBindingSource.Find("NumZ", _printer.Info.NumZ);

            MDataSet.CashRow _cashRow = (this.cashBindingSource.Current as DataRowView).Row as MDataSet.CashRow;

            if (_cashRow == null)
            {
                MessageBox.Show("Не инициализированна касса!");
                _printer.Done();
                return;
            }


            _cashRow.NumZ         = _printer.Info.NumZ;
            _cashRow.Date         = DateTime.Today;
            _cashRow.BalanceBegin = _printer.Info.BalanceBegin;
            _cashRow.OfIncome     = 0;
            _cashRow.OfExpend     = _printer.Info.OfExpend;
            _cashRow.Income       = _printer.Info.Income;
            _cashRow.Expend       = 0;
            _cashRow.BalanceEnd   = _printer.Info.BalanceEnd;


            DialogOfExpend _DialogOfExpend = new DialogOfExpend(_cashRow);

            if (DialogResult.OK == _DialogOfExpend.ShowDialog(this))
            {
                if (!_printer.OfExpend(_DialogOfExpend.SummExpend))
                {
                    MessageBox.Show("Не удалось изъять сумму !");
                    _printer.Done();
                    return;
                }

                _cashRow.NumZ         = _printer.Info.NumZ;
                _cashRow.Date         = DateTime.Today;
                _cashRow.BalanceBegin = _printer.Info.BalanceBegin;
                _cashRow.OfIncome     = 0;
                _cashRow.OfExpend     = _printer.Info.OfExpend;
                _cashRow.Income       = _printer.Info.Income;
                _cashRow.Expend       = 0;
                _cashRow.BalanceEnd   = _printer.Info.BalanceEnd;


                DataRow[] _modif1 = new DataRow[1];
                _modif1[0] = _cashRow;

                if (!this.SaveToBaseDirectoryModifed(_modif1))
                {
                    _printer.Done();

                    return;
                }
            }

            _printer.Done();
        }