/// <summary> /// CRM16_2報表(列印鈕) /// </summary> /// <param name="ParameterList">變數清單</param> /// <returns>回傳查詢結果</returns> public DataTable CRM16_2(ArrayList ParameterList) { #region CRMModel.QueryCRMOrderReport BCO = new CRMModel.QueryCRMOrderReport(ConntionDB); DataTable Dt = BCO.PrintDetail(ParameterList); if (Dt.Rows.Count == 0) { throw new Exception("查無資料"); } else { return Dt; } #endregion }
/// <summary> /// BUTTON [列印]鈕 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void but_Print_Click(object sender, EventArgs e) { try { #region 檢查Validate this.Page.Validate(); if (!Page.IsValid) { return; } #endregion #region 設定 hid_PageStauts 狀態 this.hid_PageStauts.Value = "open"; #endregion #region 清空 show_Report 的 Session Session["Rpt_Data" + PageTimeStamp.Value] = null; #endregion #region 檢查條件 string s_CheckPage = CheckPage(sender); if (s_CheckPage != string.Empty) { ClientScript.RegisterClientScriptBlock(this.GetType(), "CRM161", "<script>alert('" + s_CheckPage + "');</script>"); return; } #endregion #region 傳入參數 TextBox txt_BUSDATE_B = (TextBox)((ASP.wui_slp_slp_slpdate_ascx)this.slp_BUSDATE.FindControl("SLP_SLPDate1")).FindControl("TextBoxCode"); TextBox txt_BUSDATE_E = (TextBox)((ASP.wui_slp_slp_slpdate_ascx)this.slp_BUSDATE.FindControl("SLP_SLPDate2")).FindControl("TextBoxCode"); ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(GetValueSetParameter(txt_BUSDATE_B.Text, "date", false)); ParameterList.Add(GetValueSetParameter(txt_BUSDATE_E.Text, "date", false)); ParameterList.Add(GetValueSetParameter(this.rdb_STATUS.SelectedValue, "string", false)); ParameterList.Add(GetValueSetParameter(this.slp_CHAN_NO.Text, "string", false)); ParameterList.Add(GetValueSetParameter(this.slp_STORE.Text, "string", false)); ParameterList.Add(GetValueSetParameter(this.slp_ITEM.Text, "string", false)); ParameterList.Add(GetValueSetParameter(this.slp_Z_O_B.Text, "string", false)); ParameterList.Add(GetValueSetParameter(this.slp_Z_O_E.Text, "string", false)); ParameterList.Add(GetValueSetParameter(this.slp_MANUFACTURE_B.Text, "string", false)); ParameterList.Add(GetValueSetParameter(this.slp_MANUFACTURE_E.Text, "string", false)); ParameterList.Add(Session["UID"].ToString()); #endregion #region 取得資料 BCO.QueryCRMOrderReport bco = new BCO.QueryCRMOrderReport(ConntionDB); DataTable dt_Result = new DataTable(); dt_Result = bco.PrintDetail(ParameterList); Session["Rpt_Data" + PageTimeStamp.Value] = dt_Result; if (dt_Result.Rows.Count == 0) { this.CryView.ReportSource = null; ClientScript.RegisterClientScriptBlock(this.GetType(), "CRM161", "<script>alert('查無資料');</script>"); return; } #endregion #region CrystalReport列印報表 //Show_Report(dt_Result); Show_Report2(dt_Result); #endregion #region 設定 hid_PageStauts 狀態 this.hid_PageStauts.Value = "close";//代表程式完整執行完成 #endregion } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message; } finally { #region 設定頁面狀態 string s_ScriptManager_Script = @" Set_Print_PageStatus ( '" + this.PanelQuery.ClientID + @"', '" + this.but_Print.ClientID + @"', '" + this.but_Close.ClientID + @"', '" + this.hid_PageStauts.Value + @"' ); "; ScriptManager.RegisterStartupScript(this.up_ErrorMsg, typeof(UpdatePanel), "CRM161", s_ScriptManager_Script, true); #endregion } }