Beispiel #1
0
        private void InvoiceDetailDatecs_FormClosing(object sender, FormClosingEventArgs e)
        {
            _mainForm.RefreshData(_invmasterRow);

            //проверить если выход по ошибке


            if ((_invmasterRow.NumCheck == 0) & (_invmasterRow.GetInvoiceDetailRows().Length > 0))
            {
                FormDialog _fdlg = new FormDialog();
                TextBox    _tb   = new TextBox();
                _fdlg.Text = "Аннуляция чека: ";


                if (this.causeError == null)
                {
                    _tb.Text = "Ошибочный чек ...";
                }
                else
                {
                    _tb.Text = this.causeError;
                }


                _tb.Width = _fdlg.panel.Width;
                // _tb.Dock = DockStyle.Fill;
                _tb.SelectAll();

                _fdlg.panel.Controls.Add(_tb);

                if (DialogResult.OK == _fdlg.ShowDialog(this))
                {
                    _invmasterRow.Note = _tb.Text;

                    if (!_mainForm.SaveToBase(_invmasterRow))
                    {
                        MessageBox.Show("Ошибка обновления!");
                        return;
                    }

                    _printer.CancelCheck("ОТМЕНА:" + _tb.Text);
                }
                else
                {
                    e.Cancel = true;
                }
            }
        }
        private void btDelete_Click(object sender, EventArgs e)
        {
            try
            {
                MDataSet.InvoiceMasterRow master = this.gridViewInvAll.GetDataRow(this.gridViewInvAll.FocusedRowHandle) as MDataSet.InvoiceMasterRow;
                if (master == null)
                {
                    return;
                }

                if (master.GetInvoiceDetailRows().Length > 0)
                {
                    MessageBox.Show("Невозможно удалить документ!");

                    return;
                }



                this.invoiceMasterBindingSource.RemoveCurrent();
                this.invoiceMasterBindingSource.EndEdit();
                this._mainForm.SaveToBase(master);
            }
            catch (Exception err)

            {
                MainForm.Log(" btDelete_Click" + err.Message);

                MessageBox.Show(err.Message);
            }
        }
        private void btDelete_Click(object sender, EventArgs e)
        {
            try
            {
                //удалить пустую строку
                MDataSet.InvoiceMasterRow mast = this.gridViewInvDatAll.GetDataRow(this.gridViewInvDatAll.FocusedRowHandle) as MDataSet.InvoiceMasterRow;

                if (mast == null)
                {
                    return;
                }

                if (mast.GetInvoiceDetailRows().Length == 0)
                {
                    this.invoiceMasterBindingSource.RemoveCurrent();
                    this.invoiceMasterBindingSource.EndEdit();
                    this._mainForm.SaveToBase(mast);
                }
                else
                {
                    MessageBox.Show("Документ не пустой!");
                }
            }

            catch (Exception err)
            {
                MainForm.Log("btDelete_Click" + err.Message);
                MessageBox.Show("Ошибка : " + err.Message);
            }
        }
Beispiel #4
0
        private void btPrintCheck_Click(object sender, EventArgs e)
        {
            _mainForm.RefreshData(_invmasterRow);

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

            if (_invmasterRow.GetInvoiceDetailRows().Length != 0)
            {
                if (!_printer.OpenCheck("1"))
                {
                    MessageBox.Show("Ошибка открытия чека:" + _printer.ErrorText);
                    return;
                }


                foreach (MDataSet.InvoiceDetailRow _detRow in _invmasterRow.GetInvoiceDetailRows())
                {
                    this.SaleInvoiceDetail(_detRow);
                }

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

                if (this.CloseCeck(_invmasterRow.Sum + 1))
                {
                    this.DialogResult = DialogResult.OK;
                }
            }
        }