Esempio n. 1
0
        /// <summary>
        /// CRM15_2報表(列印鈕 明細表)
        /// </summary>
        /// <param name="ParameterList">變數清單</param>          
        /// <returns>回傳查詢結果</returns>
        public DataTable CRM15_2(ArrayList ParameterList)
        {
            CRMModel.QueryCRMOrderOutOfStockReport BCO = new PIC.VDS2G.BSM.CRM.QueryCRMOrderOutOfStockReport(ConntionDB);
            DataTable Dt = BCO.PrintDetail(ParameterList);

            if (Dt.Rows.Count == 0)
            {
                throw new Exception("查無資料");
            }
            else
            {
                return Dt;
            }
        }
Esempio n. 2
0
    /// <summary>
    /// BUTTON [列印]
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void but_Print_Click(object sender, EventArgs e)
    {
        try
        {
            #region 頁面狀態檢查 2009-06-25 cyhsu add
            this.Page.Validate();
            if (!Page.IsValid)
            {
                return;
            }
            this.Page.Validate("Validate");
            if (!Page.IsValid)
            {
                return;
            }

            #endregion

            #region 檢查條件

            string s_CheckPage = CheckPage(sender);

            if (s_CheckPage != string.Empty)
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "CRM151", "<script>alert('" + s_CheckPage + "');</script>");
                return;
            }

            #endregion

            #region 設定 hid_PageStauts 狀態

            this.hid_PageStauts.Value = "open";

            #endregion

            #region 清空 show_Report 的 Session

            Session["Rpt_Data_Detl" + PageTimeStamp.Value] = null;
            Session["Rpt_Data_Gather" + PageTimeStamp.Value] = null;

            #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.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(GetValueSetParameter(this.rdb_OUT_OF_STOCK_DAY.SelectedValue, "string", false));
            ParameterList.Add(Session["UID"].ToString());

            #endregion

            #region 取得資料

            BCO.QueryCRMOrderOutOfStockReport bco = new BCO.QueryCRMOrderOutOfStockReport(ConntionDB);
            DataTable dt_Result = new DataTable();

            if (this.rdb_Report_Status.SelectedValue == "0")//明細表
            {
                dt_Result = bco.PrintDetail(ParameterList);
                Session["Rpt_Data_Detl" + PageTimeStamp.Value] = dt_Result;
            }
            else if (this.rdb_Report_Status.SelectedValue == "1")//彙總表
            {
                dt_Result = bco.PrintSum(ParameterList);
                Session["Rpt_Data_Gather" + PageTimeStamp.Value] = dt_Result;
            }

            if (dt_Result.Rows.Count == 0)
            {
                this.CryView.ReportSource = null;
                ClientScript.RegisterClientScriptBlock(this.GetType(), "CRM151", "<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), "CRM151", s_ScriptManager_Script, true);

            #endregion
        }
    }