/// <summary> /// 列印鈕 /// </summary> protected void btnPrintReport_Click(object sender, EventArgs e) { if (VerifyFormData()) { try { ErrorMsgLabel.Text = ""; this.hid_PageStatus.Value = "PRINT"; string SessionIDName = "CGD211_" + PageTimeStamp.Value; CGDModel.ProcessVds_Code_Detail BCO = new CGDModel.ProcessVds_Code_Detail(ConntionDB); DataTable Dt = null; ParameterList.Clear(); if (radDealGoodsList.Checked)//理貨清單 { ParameterList.Add(SLP_SLPDate.Text.Trim());//門市進貨日 ParameterList.Add(txtProcBatch.Text.Trim());//理貨批次 ParameterList.Add(SLP_Route_S.Text.Trim());//路線起 ParameterList.Add(SLP_Route_E.Text.Trim());//路線迄 ParameterList.Add(getStore());//門市對象 ParameterList.Add(getDataSrc());//資料來源 Dt = BCO.QueryReportData(CGDModel.CGDCommon.QueryType.QuerySpecPickList, ParameterList); if (Dt.Rows.Count == 0) { this.hid_PageStatus.Value = "QUERY"; this.CrystalReportViewer1.Visible = false; ErrorMsgLabel.Text = "特殊門市報表查無資料"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD211.aspx", "alert(' 特殊門市報表查無資料 ');", true); return; } else { #region 顯示報表 string s_FileName = ""; //設定輸出檔名 string s_rptFilePath = ""; //設定報表路徑 s_rptFilePath = Server.MapPath("./REPORT/CGD211R01.rpt"); s_FileName = HttpUtility.UrlEncode("特殊門市理貨清單.PDF", System.Text.Encoding.UTF8); LoadCrystalReport(s_FileName, s_rptFilePath, Dt, "PDF"); #endregion } } else if (radDealTotal.Checked)//理貨彙總表 { ParameterList.Add(SLP_SLPDate.Text.Trim());//門市進貨日 ParameterList.Add(txtProcBatch.Text.Trim());//理貨批次 ParameterList.Add(getStore());//門市對象 ParameterList.Add(getDataSrc());//資料來源 Dt = BCO.QueryReportData(CGDModel.CGDCommon.QueryType.QuerySpecPickListSum, ParameterList); if (Dt.Rows.Count == 0) { this.hid_PageStatus.Value = "QUERY"; this.CrystalReportViewer1.Visible = false; ErrorMsgLabel.Text = "查無資料"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD211.aspx", "alert(' 特殊門市報表查無資料 ');", true); return; } else { #region 顯示報表 string s_FileName = ""; //設定輸出檔名 string s_rptFilePath = ""; //設定報表路徑 s_rptFilePath = Server.MapPath("./REPORT/CGD211R02.rpt"); s_FileName = HttpUtility.UrlEncode("特殊門市理貨彙總表.PDF", System.Text.Encoding.UTF8); LoadCrystalReport(s_FileName, s_rptFilePath, Dt, "PDF"); #endregion } } else if (radOutRpt.Checked)//出貨統計表 { ParameterList.Add(SLP_SLPDate.Text.Trim());//門市進貨日 ParameterList.Add(txtProcBatch.Text.Trim());//理貨批次 ParameterList.Add(ddlTransSt_S.SelectedValue);//運轉起 ParameterList.Add(ddlTransSt_E.SelectedValue);//運轉迄 ParameterList.Add(SLP_Route_S.Text.Trim());//路線起 ParameterList.Add(SLP_Route_E.Text.Trim());//路線迄 ParameterList.Add(getStore());//門市對象 ParameterList.Add(getDataSrc());//資料來源 Dt = BCO.QueryReportData(CGDModel.CGDCommon.QueryType.QuerySpecPickSales, ParameterList); if (Dt.Rows.Count == 0) { this.hid_PageStatus.Value = "QUERY"; this.CrystalReportViewer1.Visible = false; ErrorMsgLabel.Text = "特殊門市報表查無資料"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD211.aspx", "alert(' 特殊門市報表查無資料 ');", true); return; } else { #region 顯示報表 string s_FileName = ""; //設定輸出檔名 string s_rptFilePath = ""; //設定報表路徑 s_rptFilePath = Server.MapPath("./REPORT/CGD211R03.rpt"); s_FileName = HttpUtility.UrlEncode("特殊門市出貨統計表.PDF", System.Text.Encoding.UTF8); LoadCrystalReport(s_FileName, s_rptFilePath, Dt, "PDF"); #endregion } } // ShowReport(Dt); } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } finally { } } }
protected void Page_Load(object sender, EventArgs e) { try { AuthorityControls(this); ErrorMsgLabel.Text = ""; if (!IsPostBack) { this.btnPrintReport.Attributes["onclick"] += "Clear_Msg();"; this.Btn_Close.Attributes["onclick"] += "Clear_Msg();"; SLP_SLPDate.Text = DateTime.Today.AddDays(1).ToString(); //寫入首次載入Page TimeStamp PageTimeStamp.Value = string.Format("{0}{1}{2}{3}{4}{5}", DateTime.Now.Year.ToString(), DateTime.Now.Month.ToString().PadLeft(2, '0'), DateTime.Now.Day.ToString().PadLeft(2, '0'), DateTime.Now.Hour.ToString().PadLeft(2, '0'), DateTime.Now.Minute.ToString().PadLeft(2, '0'), DateTime.Now.Second.ToString().PadLeft(2, '0') ); //設定GridView預設的狀態 Initialization_Component(); //設定ToolBar預設狀態 ToolBarInit(); string slpdStAcceptDateClientId = ""; slpdStAcceptDateClientId = ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)SLP_SLPDate).FindControl("TextBoxCode")).ClientID; SetClinetFocus(slpdStAcceptDateClientId); //取得轉運站起、迄資料至下拉選單 try { string SessionIDName = "CGD211_" + PageTimeStamp.Value; CGDModel.ProcessVds_Code_Detail BCO = new CGDModel.ProcessVds_Code_Detail(ConntionDB); DataTable Dt; Dt = BCO.QueryVDS_CODE_DETAIL(); if (Dt.Rows.Count != 0) { ddlTransSt_S.Items.Clear(); ddlTransSt_E.Items.Clear(); ddlTransSt_S.Items.Add(new ListItem("全部", "")); ddlTransSt_E.Items.Add(new ListItem("全部", "")); foreach (DataRow dr in Dt.Rows) { ddlTransSt_S.Items.Add(new ListItem(dr["Explain"].ToString(), dr["Scode"].ToString())); ddlTransSt_E.Items.Add(new ListItem(dr["Explain"].ToString(), dr["Scode"].ToString())); } } } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } finally { } Line_S.Visible = false; Line_E.Visible = false; LineL_S.Visible = false; LineL_E.Visible = false; radStoreIn.Enabled = false; radPay.Enabled = false; radStoreIn.Checked = true; radPay.Checked = false; radDealGoodsList_CheckedChanged(sender, e); this.hid_PageStatus.Value = "QUERY"; } //else //{ // //if (this.hid_PageStatus.Value == "QUERY") // //{ // if (Session["Rpt_Data"] != null) // { // ShowReport((DataTable)Session["Rpt_Data"]); // } // //} //} } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } finally { } }