private void barButtonItem4_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { DatabaseFB db = HelpDB.getDatabase(); System.Data.Common.DbCommand cmd = db.GetStoredProcCommand("ST_LICH_LAM_VIEC"); DateTime NgayDauTuan = HelpDateExt.DayFirstOfWeek((DateTime)this.bardateEdit_NgayDauTuan.EditValue); if (LCoDinh == false) db.AddInParameter(cmd, "@DNGAY_DAU_TUAN", DbType.DateTime, NgayDauTuan); else { db.AddInParameter(cmd, "@DNGAY_DAU_TUAN", DbType.DateTime, null); return; } DataSet ds = new DataSet(); db.LoadDataSet(cmd, ds, "ST_LICH_LAM_VIEC"); DataView view = ds.Tables[0].DefaultView; view.Sort = "TEN_NV ASC"; DataSet dsCopy=ds.Copy(); DataSet dsSort =DALichLamViec.SortDataSet(dsCopy,view); _Print print = new _Print(); print.ReportNameFile = "EMB" + typeof(RPT_LichLamViec).FullName; print.MainForm = this; print.MainDataset = dsSort; print.SubDataset = new DataSet[] { HeaderDataSet() }; print.execPreviewWith(); } catch (Exception ex) { HelpMsgBox.ShowErrorMessage(ex.Message); } finally { if (FrameworkParams.wait != null) FrameworkParams.wait.Finish(); } }
/// <summary>Xem trước Crystall Report /// </summary> public static void Preview(_Print PrintObj) { PrintObj.execPreviewWith(); }