コード例 #1
0
ファイル: PUR052.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    //Get_LoginName
    private string Get_LoginName()
    {
        ParameterList.Clear();
        ParameterList.Add(Session["UID"].ToString());

        PIC.VDS2G.COMMON.SYS.MaintainUser BCO = new PIC.VDS2G.COMMON.SYS.MaintainUser(ConntionDB);
        DataTable dtUser = BCO.QueryUserName(ParameterList);

        string Login_Name = "";
        if (dtUser.Rows.Count != 0)
        {
            Login_Name = dtUser.Rows[0]["NAME"].ToString();
        }
        return Login_Name;
    }
コード例 #2
0
ファイル: STM291.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    /// <summary>
    /// 利用 CrystalReport 列印 Excel 報表
    /// </summary>
    /// <param name="s_FileName">Excel報表的檔名</param>
    /// <param name="s_rptFilePath">rpt檔的路徑</param>
    /// <param name="dt_Source">要列印的資料</param>
    /// /// <param name="reportFormatType">檔案型態</param>
    private void LoadCrystalReport(string s_FileName, string s_rptFilePath, DataTable dt_Source, string reportFormatType)
    {
        CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

        report.Load(s_rptFilePath);
        report.SetDataSource(dt_Source);

        PIC.VDS2G.COMMON.SYS.MaintainUser BCO2 = new PIC.VDS2G.COMMON.SYS.MaintainUser(ConntionDB);
        ParameterList.Clear();
        ParameterList.Add(Session["UID"].ToString());
        DataTable DtUser = BCO2.QueryUserName(ParameterList);
        string Login_Name = "";
        if (DtUser.Rows.Count != 0)
        {
            Login_Name = DtUser.Rows[0]["NAME"].ToString();
        }

        string s_par_Program_ID = string.Empty;
        string s_par_LoginUser = string.Empty;
        string s_par_LoginName = string.Empty;
        string s_par_Chan_No = string.Empty;
        string s_par_Route1 = string.Empty;
        string s_par_Route2 = string.Empty;

        s_par_Program_ID = this.PageCode + "R";
        s_par_LoginUser = Session["UID"].ToString() + " / " + Login_Name.Trim();
        s_par_LoginName = Login_Name.Trim();
        s_par_Route1 = ((TextBox)SLP_Route1.FindControl("TextBoxName")).Text.Trim();
        s_par_Route2 = ((TextBox)SLP_Route2.FindControl("TextBoxName")).Text.Trim();
        s_par_Chan_No = ((TextBox)SLP_CHAN_NO.FindControl("TextBoxCode")).Text.Trim() + (Request[SLP_CHAN_NO.TextBox_Name.UniqueID] == null ? "" :  Request[SLP_CHAN_NO.TextBox_Name.UniqueID].ToString());

        report.SetParameterValue("par_Program_ID", s_par_Program_ID);
        report.SetParameterValue("par_LoginUser", s_par_LoginUser);
        report.SetParameterValue("par_LoginName", s_par_LoginName);
        report.SetParameterValue("par_Route1", s_par_Route1);
        report.SetParameterValue("par_Route2", s_par_Route2);
        report.SetParameterValue("par_Chan_No", s_par_Chan_No);

        //判斷輸出檔案型態
        switch (reportFormatType)
        {
            case "EXCEL":

                System.IO.Stream streamXLS = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
                byte[] bytesXLS = new byte[streamXLS.Length];
                streamXLS.Read(bytesXLS, 0, bytesXLS.Length);
                streamXLS.Seek(0, System.IO.SeekOrigin.Begin);

                //export file  
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("content-disposition", "attachment;filename=" + s_FileName);//excel檔名  

                Response.ContentType = "application/vnd.ms-excel";

                Response.OutputStream.Write(bytesXLS, 0, bytesXLS.Length);
                Response.Flush();
                Response.Close();

                break;
            case "PDF":

                System.IO.Stream streamPDF = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                byte[] bytesPDF = new byte[streamPDF.Length];
                streamPDF.Read(bytesPDF, 0, bytesPDF.Length);
                streamPDF.Seek(0, System.IO.SeekOrigin.Begin);

                //export file  
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("content-disposition", "attachment;filename=" + s_FileName);//excel檔名  
                Response.ContentType = "application/pdf";
                Response.OutputStream.Write(bytesPDF, 0, bytesPDF.Length);
                Response.Flush();
                Response.Close();

                break;
            default:

                break;
        }


    }
コード例 #3
0
ファイル: VAM181.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    public static string SendReportMessage(string YearMonthControl,
                                           string VendorBaseControl,
                                           string VendorNameControl,
                                           string CNT_NOControl,
                                           string rblReportSourceControl,
                                           string rdoTypeControl,
                                           string rdoPrintControl,
                                           string UserIdControl,
                                           string src
                                          )
    {

        string ReportCode = "VAM18_1";

        #region DB需要的變數

        ReportParameter[] DBParameter = new ReportParameter[6];
        DBParameter[0].ParameterName = "結帳年月";
        DBParameter[0].ParameterValue = YearMonthControl;
        DBParameter[1].ParameterName = "廠商編號";
        DBParameter[1].ParameterValue = VendorBaseControl;
        DBParameter[2].ParameterName = "結帳類別";
        DBParameter[2].ParameterValue = rdoTypeControl;
        DBParameter[3].ParameterName = "合約編號";
        DBParameter[3].ParameterValue = CNT_NOControl;
        DBParameter[4].ParameterName = "月結種類";
        DBParameter[4].ParameterValue = rblReportSourceControl;
        DBParameter[5].ParameterName = "列印方式";
        DBParameter[5].ParameterValue = rdoPrintControl;

        #endregion

        #region 報表變數 送出產生報表
        ArrayList ParameterList = new ArrayList();
        ParameterList.Clear();
        ParameterList.Add(UserIdControl);

        PIC.VDS2G.COMMON.SYS.MaintainUser BCO = new PIC.VDS2G.COMMON.SYS.MaintainUser(ConntionDB);
        DataTable dtUser = BCO.QueryUserName(ParameterList);

        string Login_Name = "";
        if (dtUser.Rows.Count != 0)
        {
            Login_Name = dtUser.Rows[0]["NAME"].ToString();
        }

        string strCloseTypeName = string.Empty;
        switch (rblReportSourceControl)
        {
            case "1":
                strCloseTypeName = "一般";
                break;
            case "2":
                strCloseTypeName = "補收";
                break;
        }

        string strTypeName = string.Empty;
        switch (rdoTypeControl)
        {
            case "0":
                strTypeName = "全部";
                break;
            case "1":
                strTypeName = "未達銷售補貼";
                break;
            case "2":
                strTypeName = "獎勵金";
                break;
            case "3":
                strTypeName = "年度獎勵金";
                break;
            case "4":
                strTypeName = "VCMS費用";
                break;
        }

        string ProcessLogFile = "";
        VAM_VAM181 COMRPTPage = new VAM_VAM181();

        ReportParameter[] CryReportParameter = new ReportParameter[9];
        CryReportParameter[0].ParameterName = "par_Program_ID";
        CryReportParameter[0].ParameterValue = "VAM18";
        CryReportParameter[1].ParameterName = "par_LoginUser";
        CryReportParameter[1].ParameterValue = UserIdControl;
        CryReportParameter[2].ParameterName = "par_LoginName";
        CryReportParameter[2].ParameterValue = Login_Name;
        CryReportParameter[3].ParameterName = "par_YearMonth";
        CryReportParameter[3].ParameterValue = YearMonthControl;
        CryReportParameter[4].ParameterName = "par_VendorBase";
        CryReportParameter[4].ParameterValue = VendorBaseControl + " " + VendorNameControl;
        CryReportParameter[5].ParameterName = "par_CNT_NO";
        CryReportParameter[5].ParameterValue = CNT_NOControl;
        CryReportParameter[6].ParameterName = "par_rdoCloseType";
        CryReportParameter[6].ParameterValue = strCloseTypeName;
        CryReportParameter[7].ParameterName = "par_rdoType";
        CryReportParameter[7].ParameterValue = strTypeName;
        CryReportParameter[8].ParameterName = "par_rdoPrint";
        CryReportParameter[8].ParameterValue = rdoPrintControl;


        string strRprFile = string.Empty;
        if (src == "1")
        {
            if (rdoPrintControl == "1")
                strRprFile = COMRPTPage.Server.MapPath("REPORT\\VAM181\\VAM181_ReportA.rpt"); //全部
            else
                strRprFile = COMRPTPage.Server.MapPath("REPORT\\VAM181\\VAM181_ReportP.rpt"); //分頁
        }
        else
        {
            strRprFile = COMRPTPage.Server.MapPath("REPORT\\VAM181\\VAM181_Excel.rpt");
        }

        COMRPTPage.GenerReportConfigXML("VAM",
                                        "VAM181.aspx",
                                        ReportCode,
                                        strRprFile,
                                        DBParameter,
                                        CryReportParameter,
                                        (src == "1") ? ReportOutputFormat.PDF : ReportOutputFormat.EXCEL,
                                        "VAM18合約交易明細表-扣款表",
                                        ref ProcessLogFile
                                       );

        COMRPTPage.Dispose();

        #endregion

        return ProcessLogFile;
    }
コード例 #4
0
ファイル: COM151.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    public static string SendReportMessage(string StoreChainControl,
                                           string N_StoreChainControl,                                                                                     
                                           string SKUControl,
                                           string N_SKUControl,
                                           string ItemPeriodControl,
                                           string SDateControl,
                                           string EDateControl,
                                           string UserIdControl,        
                                           string src
                                          )
    {

        string ReportCode = "COM15_1";

        #region DB需要的變數

        ReportParameter[] DBParameter = new ReportParameter[5];
        DBParameter[0].ParameterName = "通路";
        DBParameter[0].ParameterValue = StoreChainControl;
        DBParameter[1].ParameterName = "品號";
        DBParameter[1].ParameterValue = SKUControl;
        DBParameter[2].ParameterName = "期別";
        DBParameter[2].ParameterValue = ItemPeriodControl;
        DBParameter[3].ParameterName = "日期起";
        DBParameter[3].ParameterValue = SDateControl;
        DBParameter[4].ParameterName = "日期迄";
        DBParameter[4].ParameterValue = EDateControl;

        #endregion

        #region 報表變數 送出產生報表
        ArrayList ParameterList = new ArrayList();
        ParameterList.Clear();
        ParameterList.Add(UserIdControl);

        PIC.VDS2G.COMMON.SYS.MaintainUser BCO = new PIC.VDS2G.COMMON.SYS.MaintainUser(ConntionDB);
        DataTable dtUser = BCO.QueryUserName(ParameterList);

        string Login_Name = "";
        if (dtUser.Rows.Count != 0)
        {
            Login_Name = dtUser.Rows[0]["NAME"].ToString();
        }

        string ProcessLogFile = "";
        COM_COM151 COMRPTPage = new COM_COM151();

        ReportParameter[] CryReportParameter = new ReportParameter[7];
        CryReportParameter[0].ParameterName = "par_Program_ID";
        CryReportParameter[0].ParameterValue = "COM15";
        CryReportParameter[1].ParameterName = "par_LoginUser";
        CryReportParameter[1].ParameterValue = UserIdControl;
        CryReportParameter[2].ParameterName = "par_LoginName";
        CryReportParameter[2].ParameterValue = Login_Name;
        CryReportParameter[3].ParameterName = "par_chan";
        CryReportParameter[3].ParameterValue = StoreChainControl + " " + N_StoreChainControl;
        CryReportParameter[4].ParameterName = "par_item";
        CryReportParameter[4].ParameterValue = SKUControl + " " + N_SKUControl;
        CryReportParameter[5].ParameterName = "par_period";
        CryReportParameter[5].ParameterValue = ItemPeriodControl;
        CryReportParameter[6].ParameterName = "par_DATE";
        CryReportParameter[6].ParameterValue = SDateControl + " ~ " + EDateControl;

        COMRPTPage.GenerReportConfigXML("COM",
                                        "COM151.aspx",
                                        ReportCode,
                                        COMRPTPage.Server.MapPath("REPORT\\COM151\\COM151_Report.rpt"),
                                        DBParameter,
                                        CryReportParameter,
                                        (src == "1") ? ReportOutputFormat.PDF : ReportOutputFormat.EXCEL,
                                        "單品每日銷售表",
                                        ref ProcessLogFile
                                       );

        COMRPTPage.Dispose();

        #endregion

        return ProcessLogFile;
    }