public void HeaderRefresh() { try { this.Cursor = Cursors.WaitCursor; dtHeader = new DataTable(); using (Database db = new Database(GlobalVar.DBFinance)) { dtHeader = VoucherJournal.ListHeader(db, (DateTime)tbTanggal.FromDate, (DateTime)tbTanggal.ToDate, "TT"); } dtHeader.DefaultView.Sort = "TglVoucher"; gridHeader.DataSource = dtHeader.DefaultView; gridHeader.Focus(); } catch (Exception ex) { Error.LogError(ex); } finally { this.Cursor = Cursors.Default; } }
private void HeaderRefresh() { try { dtHeader = new DataTable(); DataTable dtPG = new DataTable(); DataTable dtCC = new DataTable(); DataTable dtDB = new DataTable(); using (Database db = new Database(GlobalVar.DBName)) { dtPG = VoucherJournal.ListHeader(db, (DateTime)tbTanggal.FromDate, (DateTime)tbTanggal.ToDate, "PG"); dtCC = VoucherJournal.ListHeader(db, (DateTime)tbTanggal.FromDate, (DateTime)tbTanggal.ToDate, "CC"); dtDB = VoucherJournal.ListHeader(db, (DateTime)tbTanggal.FromDate, (DateTime)tbTanggal.ToDate, "DB"); } dtHeader = dtPG; dtHeader.Merge(dtCC); dtHeader.Merge(dtDB); if (dtHeader.Rows.Count > 0) { dtHeader.DefaultView.Sort = "TglVoucher"; gridHeader.DataSource = dtHeader.DefaultView.ToTable(); DetailRefresh(); gridHeader.Focus(); } } catch (Exception ex) { Error.LogError(ex); } }
public void RefreshHeader() { string tipe = ""; DataTable dt1 = new DataTable(), dt2 = new DataTable(), dt3 = new DataTable(); if (dataLoaded) { if (cboTipe.Text == "ALL") { tipe = ""; } else if (cboTipe.Text == "Penerimaan Giro") { tipe = "PG"; } else if (cboTipe.Text == "Titipan Giro") { tipe = "TT"; } else if (cboTipe.Text == "Uang Muka Sementara") { tipe = "UM"; } try { this.Cursor = Cursors.WaitCursor; using (Database db = new Database(GlobalVar.DBName)) { if (tipe == "PG") { dt1 = VoucherJournal.ListHeader(db, (DateTime)rangeDateBox1.FromDate, (DateTime)rangeDateBox1.ToDate, "PG"); dt2 = VoucherJournal.ListHeader(db, (DateTime)rangeDateBox1.FromDate, (DateTime)rangeDateBox1.ToDate, "CC"); dt3 = VoucherJournal.ListHeader(db, (DateTime)rangeDateBox1.FromDate, (DateTime)rangeDateBox1.ToDate, "DB"); dtHeader = dt1; dtHeader.Merge(dt2); dtHeader.Merge(dt3); } else { dtHeader = VoucherJournal.ListHeader(db, (DateTime)rangeDateBox1.FromDate, (DateTime)rangeDateBox1.ToDate, tipe); } } gridHeader.DataSource = dtHeader.DefaultView; } catch (Exception ex) { Error.LogError(ex); } finally { this.Cursor = Cursors.Default; } } }