public virtual MDataSet.CashDataTable GetData() { this.Adapter.SelectCommand = this.CommandCollection[0]; MDataSet.CashDataTable dataTable = new MDataSet.CashDataTable(); this.Adapter.Fill(dataTable); return dataTable; }
public virtual MDataSet.CashDataTable GetDataByNumZ(System.Nullable<int> Numz) { this.Adapter.SelectCommand = this.CommandCollection[2]; if ((Numz.HasValue == true)) { this.Adapter.SelectCommand.Parameters[1].Value = ((int)(Numz.Value)); } else { this.Adapter.SelectCommand.Parameters[1].Value = System.DBNull.Value; } MDataSet.CashDataTable dataTable = new MDataSet.CashDataTable(); this.Adapter.Fill(dataTable); return dataTable; }
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(); }