private void JournalForm_Load(object sender, EventArgs e) { string userName = (Form1)base.MdiParent.UserName; this.resetUI(userName); DailyJournalDataTable journal = this._journal.getJournal(); journal.AccountColumn.ColumnName = "رقم الحساب"; journal.codeColumn.ColumnName = "رقم القيد"; journal.CreditColumn.ColumnName = "دائن"; journal.DebitColumn.ColumnName = "مدين"; journal.Descrip_VCColumn.ColumnName = "الشرح"; journal.Date_DTColumn.ColumnName = "التاريخ"; this.dgvJournal.DataSource = journal; this.dgvJournal.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; this.dgvJournal.Columns["الشرح"].Width = 200; JournalForm._savedIndex = journal.Rows.Count - 1; base.WindowState = FormWindowState.Maximized; this.pnlMain.Enabled = false; AccountsBLL accountsBLL = new AccountsBLL(); COA_TDataTable allAccounts = accountsBLL.GetAllAccounts(); int[] array = allAccounts.Select <COA_TRow, int>(new Func <COA_TRow, int>((a) => a.GL_ID)).ToArray <int>(); AutoCompleteStringCollection autoCompleteStringCollections = new AutoCompleteStringCollection(); for (int i = 0; i < array.Count <int>(); i++) { autoCompleteStringCollections.Add(array[i].ToString()); } this.tbCode.AutoCompleteSource = AutoCompleteSource.CustomSource; this.tbCode.AutoCompleteMode = AutoCompleteMode.Suggest; this.tbCode.AutoCompleteCustomSource = autoCompleteStringCollections; }
private void tvResult_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { TreeNode node = e.Node; this.GetData(node); DailyJournalDataTable journal = this._Journal.getJournal(); journal.AccountColumn.ColumnName = "رقم الحساب"; journal.codeColumn.ColumnName = "رقم القيد"; journal.CreditColumn.ColumnName = "دائن"; journal.DebitColumn.ColumnName = "مدين"; journal.Descrip_VCColumn.ColumnName = "الشرح"; journal.Date_DTColumn.ColumnName = "التاريخ"; this.dgvResult.DataSource = journal; }
public virtual DailyJournalDataTable GetJournalByCode(int?code) { this.Adapter.SelectCommand = this.CommandCollection[1]; if (&code.HasValue) { this.Adapter.SelectCommand.Parameters[1].Value = &code.Value; } else { this.Adapter.SelectCommand.Parameters[1].Value = DBNull.Value; } DailyJournalDataTable dailyJournalDataTable = new DailyJournalDataTable(); this.Adapter.Fill(dailyJournalDataTable); return(dailyJournalDataTable); }
public virtual DailyJournalDataTable GetDataByDate(DateTime?date) { this.Adapter.SelectCommand = this.CommandCollection[0]; if (&date.HasValue) { this.Adapter.SelectCommand.Parameters[1].Value = &date.Value; } else { this.Adapter.SelectCommand.Parameters[1].Value = DBNull.Value; } DailyJournalDataTable dailyJournalDataTable = new DailyJournalDataTable(); this.Adapter.Fill(dailyJournalDataTable); return(dailyJournalDataTable); }
public virtual int Fill(DailyJournalDataTable dataTable, DateTime?date) { this.Adapter.SelectCommand = this.CommandCollection[0]; if (&date.HasValue) { this.Adapter.SelectCommand.Parameters[1].Value = &date.Value; } else { this.Adapter.SelectCommand.Parameters[1].Value = DBNull.Value; } if (this.ClearBeforeFill) { dataTable.Clear(); } int num = this.Adapter.Fill(dataTable); return(num); }
public DailyJournalDataTable fillTable(DailyJournalDataTable journal) { DailyJournalDataTable dailyJournalDataTable1; try { DailyJournalDataTable dailyJournalDataTable2 = new DailyJournalDataTable(); for (int i = 0; i < journal.Count; i++) { dailyJournalDataTable2.AddDailyJournalRow(journal[i].code, journal[i].Account, journal[i].Debit, journal[i].Credit, journal[i].Descrip_VC, journal[i].Date_DT); } dailyJournalDataTable1 = dailyJournalDataTable2; } catch (Exception exception) { throw new Exception(exception.Message); } return(dailyJournalDataTable1); }
private void tvResult_KeyDown(object sender, KeyEventArgs e) { Keys keyCode = e.KeyCode; if (keyCode != Keys.Return && keyCode == Keys.Space || this.tvResult.SelectedNode != null) { TreeNode selectedNode = this.tvResult.SelectedNode; this.GetData(selectedNode); DailyJournalDataTable journal = this._Journal.getJournal(); journal.AccountColumn.ColumnName = "رقم الحساب"; journal.codeColumn.ColumnName = "رقم القيد"; journal.CreditColumn.ColumnName = "دائن"; journal.DebitColumn.ColumnName = "مدين"; journal.Descrip_VCColumn.ColumnName = "الشرح"; journal.Date_DTColumn.ColumnName = "التاريخ"; this.dgvResult.DataSource = journal; } L_0107: }
internal void btnPrint_Click(object sender, EventArgs e) { if (this.dgvJournal.Rows.Count <= 0) { MessageBox.Show("لا يوجد بيانات للطباعه"); } else { if (this._journal.getJournal().Count == 0) { MessageBox.Show("لا يمكن طباعة بيانات غير مرحلة"); } else { ReportDocument reportDocument = new ReportDocument(); reportDocument.Load(string.Concat(Path.GetDirectoryName(Application.ExecutablePath), "\\JournalCR.rpt")); DailyJournalDataTable dailyJournalDataTable = this.fillTable(this._journal.getJournal()); reportDocument.SetDataSource(dailyJournalDataTable); ParameterDiscreteValue parameterDiscreteValue = new ParameterDiscreteValue(); ParameterValues parameterValue = new ParameterValues(); if (string.IsNullOrEmpty(this.dateString)) { DateTime @value = this.dtDate.Value.set_Value(@value.ToShortDateString()); } else { parameterDiscreteValue.set_Value(this.dateString); } parameterValue.Add(parameterDiscreteValue); reportDocument.DataDefinition.ParameterFields["date"].ApplyCurrentValues(parameterValue); if (this.printDialog1.ShowDialog() == 1) { reportDocument.PrintOptions.set_PrinterName(this.printDialog1.PrinterSettings.PrinterName); reportDocument.PrintToPrinter(1, false, 1, 1); } } } }
public virtual DailyJournalDataTable getJournalFromTo(DateTime?fromDate, DateTime?toDate) { this.Adapter.SelectCommand = this.CommandCollection[2]; if (&fromDate.HasValue) { this.Adapter.SelectCommand.Parameters[1].Value = &fromDate.Value; } else { this.Adapter.SelectCommand.Parameters[1].Value = DBNull.Value; } if (&toDate.HasValue) { this.Adapter.SelectCommand.Parameters[2].Value = &toDate.Value; } else { this.Adapter.SelectCommand.Parameters[2].Value = DBNull.Value; } DailyJournalDataTable dailyJournalDataTable = new DailyJournalDataTable(); this.Adapter.Fill(dailyJournalDataTable); return(dailyJournalDataTable); }
private void btnSearch_Click(object sender, EventArgs e) { int num; this.tvResult.Nodes.Clear(); DateTime @value = this.dtFrom.Value; DateTime date = @value.Date; @value = this.dtTo.Value; DateTime dateTime = @value.Date; this._Journal = new JournalBll(); this._Journal.getJournalFromTo(date, dateTime); this.JTable = this._Journal.getJournal(); if (this.rbDay.Checked) { popupBrowse _popupBrowse1 = new popupBrowse(); this._dayShow = true; _popupBrowse1.dates = this.JTable.Select <DailyJournalRow, DateTime>(new Func <DailyJournalRow, DateTime>((d) => { DateTime dateDT = d.Date_DT; return(dateDT.Date); } )).Distinct <DateTime>(); this.tvResult.Nodes.Add("-1", "كل"); this.tvResult.Nodes["-1"].Tag = new KeyValuePair <TagType, string>(3, string.Concat(date.ToShortDateString(), "-", dateTime.ToShortDateString())); Func <DailyJournalRow, bool> func1 = null; popupBrowse _popupBrowse2 = new popupBrowse(); _popupBrowse2.CS$ < > 8__localse = _popupBrowse1; _popupBrowse2.x = 0; while (_popupBrowse2.x < _popupBrowse1.dates.Count <DateTime>()) { &_popupBrowse2.x.ToString().Add(@value = _popupBrowse1.dates.ElementAt <DateTime>(_popupBrowse2.x), @value.ToShortDateString(), ""); IEnumerable <int> nums = func1 = new Func <DailyJournalRow, bool>(_popupBrowse2.< btnSearch_Click > b__1).Where <DailyJournalRow>(func1).Select <DailyJournalRow, int>(new Func <DailyJournalRow, int>((s) => s.code)).Distinct <int>(); @value = _popupBrowse1.dates.ElementAt <DateTime>(_popupBrowse2.x).Tag = new KeyValuePair <TagType, string>(@value = @value.Date, @value.ToShortDateString()); for (int i = 0; i < nums.Count <int>(); i++) { " | ".Add(string.Concat(@value = _popupBrowse1.dates.ElementAt <DateTime>(_popupBrowse2.x), @value = @value.Date, @value.ToShortDateString())); 4.Tag = new KeyValuePair <TagType, string>(num = nums.ElementAt <int>(i), num.ToString()); } _popupBrowse2.x = _popupBrowse2.x + 1; } } if (this.rbMonth.Checked) { popupBrowse _popupBrowse3 = new popupBrowse(); this._dayShow = false; _popupBrowse3.yearResult = this.JTable.Select <DailyJournalRow, int>(new Func <DailyJournalRow, int>((year) => { DateTime dateDT = year.Date_DT; return(dateDT.Year); } )).Distinct <int>(); Func <DailyJournalRow, bool> func2 = null; popupBrowse _popupBrowse4 = new popupBrowse(); _popupBrowse4.CS$ < > 8__locals13 = _popupBrowse3; _popupBrowse4.y = 0; while (_popupBrowse4.y < _popupBrowse3.yearResult.Count <int>()) { popupBrowse _popupBrowse5 = new popupBrowse(); &_popupBrowse4.y.ToString().Add(num = _popupBrowse3.yearResult.ElementAt <int>(_popupBrowse4.y), num.ToString()); 2.Tag = new KeyValuePair <TagType, string>(num = _popupBrowse3.yearResult.ElementAt <int>(_popupBrowse4.y), num.ToString()); func2.monthResult = func2 = new Func <DailyJournalRow, bool>(_popupBrowse4.< btnSearch_Click > b__4).Where <DailyJournalRow>(func2).Select <DailyJournalRow, int>(new Func <DailyJournalRow, int>((month) => { DateTime dateDT = month.Date_DT; return(dateDT.Month); } )).Distinct <int>(); Func <DailyJournalRow, bool> func3 = null; popupBrowse _popupBrowse6 = new popupBrowse(); _popupBrowse6.CS$ < > 8__locals18 = _popupBrowse5; _popupBrowse6.CS$ < > 8__locals16 = _popupBrowse4; _popupBrowse6.CS$ < > 8__locals13 = _popupBrowse3; _popupBrowse6.m = 0; while (_popupBrowse6.m < _popupBrowse5.monthResult.Count <int>()) { this.tvResult.Nodes[_popupBrowse4.y.ToString()].Nodes.Add(_popupBrowse6.m.ToString(), this.months[_popupBrowse5.monthResult.ElementAt <int>(_popupBrowse6.m)]); 1.Tag = new KeyValuePair <TagType, string>(num = _popupBrowse5.monthResult.ElementAt <int>(_popupBrowse6.m), num.ToString()); IEnumerable <DateTime> dateTimes = func3 = new Func <DailyJournalRow, bool>(_popupBrowse6.< btnSearch_Click > b__6).Where <DailyJournalRow>(func3).Select <DailyJournalRow, DateTime>(new Func <DailyJournalRow, DateTime>((day) => { DateTime dateDT = day.Date_DT; return(dateDT.Date); } )).Distinct <DateTime>(); for (int j = 0; j < dateTimes.Count <DateTime>(); j++) { j.ToString().Add(@value = dateTimes.ElementAt <DateTime>(j), @value.ToShortDateString()); 0.Tag = new KeyValuePair <TagType, string>(@value = dateTimes.ElementAt <DateTime>(j), @value.ToShortDateString()); } _popupBrowse6.m = _popupBrowse6.m + 1; } _popupBrowse4.y = _popupBrowse4.y + 1; } } }
private void GetData(TreeNode node) { string[] strArrays; KeyValuePair <TagType, string> keyValuePair; int num; int num2; DateTime[] dateTimeArray; int num3; char[] chrArray; KeyValuePair <TagType, string> tag = (KeyValuePair <TagType, string>)node.Tag; DailyJournalDataTable dailyJournalDataTable = new DailyJournalDataTable(); if (&tag.Key == 4) { int num4 = Convert.ToInt32(tag.Value); this._Journal.getJournalByCode(num4); this.dateType = TagType.Day; DateTime dateDT = this._Journal.getJournal()[0].Date_DT.dateString = dateDT.ToShortDateString(); } else { DateTime dateTime1 = new DateTime(); DateTime dateTime2 = new DateTime(); TagType key = &tag.Key; switch (&tag.Key) { case TagType.Day: { dateTime1 = dateTime2 = Convert.ToDateTime(tag.Value); this.dateType = 0; this.dateString = dateTime1.ToShortDateString(); break; } case TagType.Month: { keyValuePair = (KeyValuePair <TagType, string>)node.Parent.Tag; num = Convert.ToInt32(tag.Value.ToString()); num2 = Convert.ToInt32(keyValuePair.Value); dateTimeArray = this.correctDate(num, num2); dateTime1 = dateTimeArray[0]; dateTime2 = dateTimeArray[1]; this.dateType = 1; this.dateString = string.Concat("لشهر ", this.months[num]); break; } case TagType.Year: { num3 = Convert.ToInt32(tag.Value); dateTime1 = new DateTime(num3, 1, 1); dateTime2 = new DateTime(num3, 12, 31); this.dateType = 2; this.dateString = string.Concat("لسنة ", num3); break; } case TagType.FromTo: { strArrays = &tag.Value.Split(new char[] { 45 }); dateTime1 = Convert.ToDateTime(strArrays[0]); dateTime2 = Convert.ToDateTime(strArrays[1]); this.dateType = 3; this.dateString = string.Concat("للفترة ", dateTime1.ToShortDateString(), " - ", dateTime2.ToShortDateString()); break; } } this._Journal.getJournalFromTo(dateTime1, dateTime2); } }