private void btDatecsXReport_Click(object sender, EventArgs e) { Datecs _printer = new Datecs(); if (_printer.HasError) { MessageBox.Show("Ошибка принтера : " + _printer.ErrorText); _printer.Close(); return; } _printer.XReport(); if (_printer.HasError) { MessageBox.Show("Ошибка принтера : " + _printer.ErrorText); _printer.Close(); return; } MessageBox.Show("Реализация : " + _printer.printerCashInfo.Income.ToString(), "Печать дневного отчета (Х-Отчет)"); _printer.Close(); }
private bool InitDataCash() { Datecs _printer = new Datecs(); if (_printer.HasError) { MessageBox.Show("Ошибка принтера :" + _printer.ErrorText); _printer.Close(); return(false); } DataRow[] _dr = this.mDataSet.Cash.Select("NumZ= -1"); if (_dr.Length == 0) { MessageBox.Show("Не найдена строка для Z отчета"); MainForm.Log("Не найдена строка для Z отчета"); _printer.Close(); return(false); } else { _cashRow = _dr[0] as MDataSet.CashRow; } _cashRow.Date = DateTime.Today; _cashRow.BalanceBegin = _printer.printerCashInfo.BalanceBegin; _cashRow.OfIncome = 0; _cashRow.OfExpend = _printer.printerCashInfo.OfExpend; _cashRow.Income = _printer.printerCashInfo.Income; _cashRow.Expend = 0; _cashRow.BalanceEnd = _printer.printerCashInfo.BalanceEnd; DataRow[] _modif = new DataRow[1]; _modif[0] = _cashRow; if (!(this.ParentForm as MainForm).SaveToBaseDirectoryModifed(_modif)) { MainForm.Log("Не обновлена строка Z Отчета"); return(false); } _mainForm.cashBindingSource.Position = _mainForm.cashBindingSource.Find("ID", _cashRow.ID); this.cashBindingSource.DataSource = _mainForm.cashBindingSource.Current; this.cashBindingSource.ResetBindings(true); /* this.cashBindingSource.DataSource = _cashRow; * this.cashBindingSource.ResetBindings(true); */ _printer.Close(); return(true); }
private void btDatecsCloseCheck_Click(object sender, EventArgs e) { Datecs _printer = new Datecs(); _printer.CancelCheck("Ошибка!!!"); _printer.CloseCheck(10000, 0, 1000, false); _printer.Close(); }
private void btPeriodReportByNum_Click(object sender, EventArgs e) { Datecs _printer = new Datecs(); if (_printer.HasError) { MessageBox.Show("Ошибка принтера :" + _printer.ErrorText); _printer.Close(); return; } DialogPeriodNum dialogPeriodNum = new DialogPeriodNum(); if (dialogPeriodNum.ShowDialog(this.ParentForm) == DialogResult.OK) { _printer.ZPeriodReport((int)dialogPeriodNum.startEdit.Value, (int)dialogPeriodNum.endEdit.Value); } _printer.Close(); }
private void btDatecsPeriodReport_Click(object sender, EventArgs e) { Datecs _printer = new Datecs(); if (_printer.HasError) { MessageBox.Show("Ошибка принтера :" + _printer.ErrorText); _printer.Close(); return; } DialogPeriod _DialogPeriod = new DialogPeriod(); if (_DialogPeriod.ShowDialog(this) == DialogResult.OK) { if (!_printer.ZPeriodReport(_DialogPeriod.StartDate, _DialogPeriod.EndDate)) { MessageBox.Show("Печать отчета не выполнена"); } } _printer.Close(); }
private void InvoiceDetailDatecs_FormClosed(object sender, FormClosedEventArgs e) { _printer.Close(); foreach (GridView view in this.gridDet.ViewCollection) { string fileName = new FileInfo(Application.ExecutablePath).DirectoryName + "\\" + view.Name.ToString() + ".xml"; view.SaveLayoutToXml(fileName); } foreach (GridView view in this.gridRem.ViewCollection) { string fileName = new FileInfo(Application.ExecutablePath).DirectoryName + "\\" + view.Name.ToString() + ".xml"; view.SaveLayoutToXml(fileName); } }
private void menuDatecsZReport_Click(object sender, EventArgs e) { Datecs _printer = new Datecs(); MDataSet.CashRow _cashRow; if (_printer.HasError) { MessageBox.Show("Ошибка принтера : " + _printer.ErrorText); _printer.Close(); return; } //добавить строку если нет this.cashBindingSource.Position = this.cashBindingSource.Find("NumZ", -1); if (this.cashBindingSource.Current != null) { _cashRow = (this.cashBindingSource.Current as DataRowView).Row as MDataSet.CashRow; } else { _cashRow = (this.cashBindingSource.AddNew() as DataRowView).Row as MDataSet.CashRow; _cashRow.Date = DateTime.Today; _cashRow.BalanceBegin = _printer.printerCashInfo.BalanceBegin; _cashRow.OfIncome = 0; _cashRow.OfExpend = _printer.printerCashInfo.OfExpend; _cashRow.Income = _printer.printerCashInfo.Income; _cashRow.Expend = 0; _cashRow.BalanceEnd = _printer.printerCashInfo.BalanceEnd; DataRow[] _modifnew = new DataRow[1]; _modifnew[0] = _cashRow; if (!this.SaveToBaseDirectoryModifed(_modifnew)) { _printer.Close(); return; } } if (_cashRow == null) { MessageBox.Show("Не инициализированна касса!"); return; } if (DialogResult.Cancel == MessageBox.Show(this, "Снять Z отчет с обнулением ? ", "Печать Z Отчета", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning)) { return; } _cashRow.Date = DateTime.Today; _cashRow.BalanceBegin = _printer.printerCashInfo.BalanceBegin; _cashRow.OfIncome = 0; _cashRow.OfExpend = _printer.printerCashInfo.OfExpend; _cashRow.Income = _printer.printerCashInfo.Income; _cashRow.Expend = 0; _cashRow.BalanceEnd = _printer.printerCashInfo.BalanceEnd; DataRow[] _modif1 = new DataRow[1]; _modif1[0] = _cashRow; if (!this.SaveToBaseDirectoryModifed(_modif1)) { _printer.Close(); return; } _cashRow.NumZ = _printer.ZReport(); DataRow[] _modif = new DataRow[1]; _modif[0] = _cashRow; if (!this.SaveToBaseDirectoryModifed(_modif)) { MessageBox.Show("Не удалось обновить данные!"); Log(" Ошибка Z отчета :(!this.SaveToBaseDirectoryModifed(_modif)) "); _printer.Close(); return; } try { this.cashTableAdapter.ClosePeriod(-1); MDataSet.CashDataTable _cash = new MDataSet.CashDataTable(); this.cashTableAdapter.Fill(_cash); this.mDataSet.Cash.Merge(_cash); } catch (Exception err) { Log("Zreport" + err.Message); MessageBox.Show("Ошибка!!! " + err.Message); } finally { this.cashBindingSource.Position = this.cashBindingSource.Find("NumZ", -1); } MessageBox.Show("Остаток в кассе : " + _printer.printerCashInfo.BalanceEnd.ToString(), "Печать дневного отчета (Z-Отчет)"); _printer.Close(); }
private void btDatecsOfExpend_Click(object sender, EventArgs e) { Datecs _printer = new Datecs(); if (_printer.HasError) { MessageBox.Show("Ошибка принтера :" + _printer.ErrorText); _printer.Close(); return; } this.cashBindingSource.Position = this.cashBindingSource.Find("NumZ", -1); MDataSet.CashRow _cashRow = (this.cashBindingSource.Current as DataRowView).Row as MDataSet.CashRow; if (_cashRow == null) { MessageBox.Show("Не инициализированна касса!"); _printer.Close(); return; } _cashRow.NumZ = _printer.printerCashInfo.NumZ; _cashRow.Date = DateTime.Today; _cashRow.BalanceBegin = _printer.printerCashInfo.BalanceBegin; _cashRow.OfIncome = 0; _cashRow.OfExpend = _printer.printerCashInfo.OfExpend; _cashRow.Income = _printer.printerCashInfo.Income; _cashRow.Expend = 0; _cashRow.BalanceEnd = _printer.printerCashInfo.BalanceEnd; DialogOfExpend _DialogOfExpend = new DialogOfExpend(_cashRow); if (DialogResult.OK == _DialogOfExpend.ShowDialog(this)) { if (!_printer.OfExpend((double)_DialogOfExpend.SummExpend)) { MessageBox.Show("Не удалось изъять сумму !"); _printer.Close(); return; } _cashRow.NumZ = _printer.printerCashInfo.NumZ; _cashRow.Date = DateTime.Today; _cashRow.BalanceBegin = _printer.printerCashInfo.BalanceBegin; _cashRow.OfIncome = 0; _cashRow.OfExpend = _printer.printerCashInfo.OfExpend; _cashRow.Income = _printer.printerCashInfo.Income; _cashRow.Expend = 0; _cashRow.BalanceEnd = _printer.printerCashInfo.BalanceEnd; DataRow[] _modif1 = new DataRow[1]; _modif1[0] = _cashRow; if (!this.SaveToBaseDirectoryModifed(_modif1)) { _printer.Close(); return; } } _printer.Close(); }
private void menuDatecsZReport_Click(object sender, EventArgs e) { Datecs _printer = new Datecs(); MDataSet.CashRow _cashRow; if (_printer.HasError) { MessageBox.Show("Ошибка принтера : " + _printer.ErrorText); _printer.Close(); return; } //добавить строку если нет this.cashBindingSource.Position= this.cashBindingSource.Find("NumZ", -1); if (this.cashBindingSource.Current != null) { _cashRow = (this.cashBindingSource.Current as DataRowView).Row as MDataSet.CashRow; } else { _cashRow = (this.cashBindingSource.AddNew() as DataRowView).Row as MDataSet.CashRow; _cashRow.Date = DateTime.Today; _cashRow.BalanceBegin = _printer.printerCashInfo.BalanceBegin; _cashRow.OfIncome = 0; _cashRow.OfExpend = _printer.printerCashInfo.OfExpend; _cashRow.Income = _printer.printerCashInfo.Income; _cashRow.Expend = 0; _cashRow.BalanceEnd = _printer.printerCashInfo.BalanceEnd; DataRow[] _modifnew = new DataRow[1]; _modifnew[0] = _cashRow; if (!this.SaveToBaseDirectoryModifed(_modifnew)) { _printer.Close(); return; } } if (_cashRow == null) { MessageBox.Show("Не инициализированна касса!"); return; } if (DialogResult.Cancel == MessageBox.Show(this, "Снять Z отчет с обнулением ? ", "Печать Z Отчета", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning)) { return; } _cashRow.Date = DateTime.Today; _cashRow.BalanceBegin = _printer.printerCashInfo.BalanceBegin; _cashRow.OfIncome = 0; _cashRow.OfExpend = _printer.printerCashInfo.OfExpend; _cashRow.Income = _printer.printerCashInfo.Income; _cashRow.Expend = 0; _cashRow.BalanceEnd = _printer.printerCashInfo.BalanceEnd; DataRow[] _modif1 = new DataRow[1]; _modif1[0] = _cashRow; if (!this.SaveToBaseDirectoryModifed(_modif1)) { _printer.Close(); return; } _cashRow.NumZ = _printer.ZReport(); DataRow[] _modif = new DataRow[1]; _modif[0] = _cashRow; if (!this.SaveToBaseDirectoryModifed(_modif)) { MessageBox.Show("Не удалось обновить данные!"); Log(" Ошибка Z отчета :(!this.SaveToBaseDirectoryModifed(_modif)) "); _printer.Close(); return ; } try { this.cashTableAdapter.ClosePeriod(-1); this.cashTableAdapter.Fill(this.mDataSet.Cash); } catch ( Exception err) { Log("Zreport" + err.Message); MessageBox.Show("Ошибка!!! " + err.Message); } finally { this.cashBindingSource.Position = this.cashBindingSource.Find("NumZ", -1); } MessageBox.Show("Остаток в кассе : " + _printer.printerCashInfo.BalanceEnd.ToString(), "Печать дневного отчета (Z-Отчет)"); _printer.Close(); }
private void btDatecsXReport_Click(object sender, EventArgs e) { Datecs _printer = new Datecs(); if (_printer.HasError) { MessageBox.Show("Ошибка принтера : " + _printer.ErrorText); _printer.Close(); return; } _printer.XReport(); if (_printer.HasError) { MessageBox.Show("Ошибка принтера : " + _printer.ErrorText); _printer.Close(); return; } MessageBox.Show("Реализация : " + _printer.printerCashInfo.Income.ToString(),"Печать дневного отчета (Х-Отчет)"); _printer.Close(); }
private void btPeriodReportByNum_Click(object sender, EventArgs e) { Datecs _printer = new Datecs(); if (_printer.HasError) { MessageBox.Show("Ошибка принтера :" + _printer.ErrorText); _printer.Close(); return; } DialogPeriodNum dialogPeriodNum = new DialogPeriodNum(); if (dialogPeriodNum.ShowDialog(this.ParentForm) == DialogResult.OK) { _printer.ZPeriodReport((int)dialogPeriodNum.startEdit.Value, (int)dialogPeriodNum.endEdit.Value); } _printer.Close(); }
private void btDatecsOfExpend_Click(object sender, EventArgs e) { Datecs _printer = new Datecs(); if (_printer.HasError) { MessageBox.Show("Ошибка принтера :" + _printer.ErrorText); _printer.Close(); return; } this.cashBindingSource.Position = this.cashBindingSource.Find("NumZ", -1); MDataSet.CashRow _cashRow = (this.cashBindingSource.Current as DataRowView).Row as MDataSet.CashRow; if (_cashRow == null) { MessageBox.Show("Не инициализированна касса!"); _printer.Close(); return; } _cashRow.NumZ = _printer.printerCashInfo.NumZ; _cashRow.Date = DateTime.Today; _cashRow.BalanceBegin = _printer.printerCashInfo.BalanceBegin; _cashRow.OfIncome = 0; _cashRow.OfExpend = _printer.printerCashInfo.OfExpend; _cashRow.Income = _printer.printerCashInfo.Income; _cashRow.Expend = 0; _cashRow.BalanceEnd = _printer.printerCashInfo.BalanceEnd; DialogOfExpend _DialogOfExpend = new DialogOfExpend(_cashRow); if (DialogResult.OK == _DialogOfExpend.ShowDialog(this)) { if (!_printer.OfExpend((double)_DialogOfExpend.SummExpend)) { MessageBox.Show("Не удалось изъять сумму !"); _printer.Close(); return; } _cashRow.NumZ = _printer.printerCashInfo.NumZ; _cashRow.Date = DateTime.Today; _cashRow.BalanceBegin = _printer.printerCashInfo.BalanceBegin; _cashRow.OfIncome = 0; _cashRow.OfExpend = _printer.printerCashInfo.OfExpend; _cashRow.Income = _printer.printerCashInfo.Income; _cashRow.Expend = 0; _cashRow.BalanceEnd = _printer.printerCashInfo.BalanceEnd; DataRow[] _modif1 = new DataRow[1]; _modif1[0] = _cashRow; if (!this.SaveToBaseDirectoryModifed(_modif1)) { _printer.Close(); return; } } _printer.Close(); }
private void btDatecsPeriodReport_Click(object sender, EventArgs e) { Datecs _printer = new Datecs(); if (_printer.HasError) { MessageBox.Show("Ошибка принтера :" + _printer.ErrorText); _printer.Close(); return; } DialogPeriod _DialogPeriod = new DialogPeriod(); if (_DialogPeriod.ShowDialog(this) == DialogResult.OK) { if (!_printer.ZPeriodReport(_DialogPeriod.StartDate, _DialogPeriod.EndDate)) { MessageBox.Show("Печать отчета не выполнена"); } } _printer.Close(); }
private void btDatecsCloseCheck_Click(object sender, EventArgs e) { Datecs _printer = new Datecs(); _printer.CancelCheck("Ошибка!!!"); _printer.CloseCheck(10000, 0); _printer.Close(); }
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); } } } }