private void btPrintCheck_Click(object sender, EventArgs e) { if (_printer.HasError) { MessageBox.Show("Ошибка принтера" + _printer.ErrorText); return; } if (_invmasterRow.GetInvoiceDetailRows().Length == 0) { MessageBox.Show("Нечего печатать"); return; } _printer.OpenCheck(_mainForm.LocalSettingRow.Num); this.gridRem.Enabled = false; this.gridRem.Enabled = false; this.btDelete.Enabled = false; foreach (MDataSet.InvoiceDetailRow detrow in _invmasterRow.GetInvoiceDetailRows()) { this.SaleInvoiceDetail(detrow); } if (_printer.HasError) { return; } this.btPay_Click(sender, e); }
private void InvoiceDetailDatecs_Load(object sender, EventArgs e) { _printer = new Datecs(); if (_printer.HasError) { MessageBox.Show(_printer.ErrorText); _printer.Close(); this.DialogResult = DialogResult.Abort; return; } else { this.invoiceMasterBindingSourceView.DataSource = mDataSet.InvoiceMaster; this.invoiceMasterBindingSourceView.ResetBindings(true); // если новый документ if (_invmasterRow == null) { _invmasterRow = (invoiceMasterBindingSourceView.AddNew() as DataRowView).Row as MDataSet.InvoiceMasterRow; this.invoiceMasterBindingSourceView.EndEdit(); _printer.OpenCheck(_mainForm.LocalSettingRow.Num); } else //если открыть { this.invoiceMasterBindingSourceView.Position = this.invoiceMasterBindingSourceView.Find("Id", _invmasterRow.ID); this.gridRem.Enabled = false; this.btPay.Visible = false; this.creditCardButton.Visible = false; this.cardDiscountButton.Visible = false; this.btPayDiscount.Visible = false; this.btDeleteInСheck.Visible = false; this.btPrintCheck.Visible = true; this.printCreditCardButton.Visible = true; this.btDelete.Visible = true; this.btPayMenu.Enabled = false; } this.invoiceMasterBindingSource.DataSource = _invmasterRow; this.invoiceMasterBindingSource.ResetBindings(true); this.invoiceDetailBindingSource.DataSource = this.invoiceMasterBindingSourceView; this.invoiceDetailBindingSource.DataMember = "FK_InvoiceDetail_InvoiceMaster"; this.invoiceDetailBindingSource.ResetBindings(true); foreach (GridView view in this.gridRem.ViewCollection) { string fileName = new FileInfo(Application.ExecutablePath).DirectoryName + "\\" + view.Name.ToString() + ".xml"; if (File.Exists(fileName)) { view.RestoreLayoutFromXml(fileName); } } foreach (GridView view in this.gridDet.ViewCollection) { string fileName = new FileInfo(Application.ExecutablePath).DirectoryName + "\\" + view.Name.ToString() + ".xml"; if (File.Exists(fileName)) { view.RestoreLayoutFromXml(fileName); } } } }