private void btnFinalPrintout_Click(object sender, EventArgs e) { int periodId = Convert.ToInt32(lkPeriod.EditValue); int activityID = Convert.ToInt32(lkInventoryAccount.EditValue); int physicalStoreID = Convert.ToInt32(lkInventoryStore.EditValue); PhysicalStore physicalStore = new PhysicalStore(); physicalStore.LoadByPrimaryKey(physicalStoreID); try { if (InventoryPeriod.HasUnCommited(periodId, activityID)) { throw new Exception("This inventory has not been commited yet,you are not allow to print before"); } DevExpress.XtraReports.UI.XtraReport xreport; DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; if (Settings.LocalvsTender) { xreport = new HCMIS.Desktop.Reports.InventoryCountSheetLocalTender(CurrentContext.LoggedInUserName); (xreport as HCMIS.Desktop.Reports.InventoryCountSheetLocalTender).Date.Text = dtDate.Text; } else { xreport = new HCMIS.Desktop.Reports.InventoryCountSheet(CurrentContext.LoggedInUserName); (xreport as HCMIS.Desktop.Reports.InventoryCountSheet).Date.Text = dtDate.Text; } xreport.DataSource = BLL.Receipt.GetInventoryCountbyInventoryPeriodID(periodId, physicalStoreID, activityID); xreport.ShowPreview(); } catch (Exception exp) { XtraMessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }