예제 #1
0
    public static string SendReport2Message(string MDCStartDate,
                                            string MDCEndDate,
                                            string ROOTNOStart,
                                            string ROOTNOEnd,
                                            string PMAStart,
                                            string PMAEnd,
                                            string CATEGORYStart,
                                            string CATEGORYEnd,
                                            string SORTOUTStart,
                                            string SORTOUTEnd,
                                            string SKUStart,
                                            string SKUEnd,
                                            string ITEMStart,
                                            string ITEMEnd,
                                            string CHAINStart,
                                            string CHAINEnd,
                                            string STOREStart,
                                            string STOREEnd,
                                            string ZOStart,
                                            string ZOEnd,
                                            string VENDORStart,
                                            string VENDOREnd,
                                            string rdoCLASSIFY,
                                            string rdoTYPE,
                                            string ExportFileNameText
                                            )
    {
        ReportParameter[] DBParameter = new ReportParameter[24];

        #region DB需要的變數

        DBParameter[0].ParameterName = "分析開始日";
        DBParameter[0].ParameterValue = MDCStartDate;
        DBParameter[1].ParameterName = "分析結束日";
        DBParameter[1].ParameterValue = MDCEndDate;
        DBParameter[2].ParameterName = "群分類起";
        DBParameter[2].ParameterValue = ROOTNOStart;
        DBParameter[3].ParameterName = "群分類迄";
        DBParameter[3].ParameterValue = ROOTNOEnd;
        DBParameter[4].ParameterName = "大分類起";
        DBParameter[4].ParameterValue = PMAStart;
        DBParameter[5].ParameterName = "大分類迄";
        DBParameter[5].ParameterValue = PMAEnd;
        DBParameter[6].ParameterName = "中分類起";
        DBParameter[6].ParameterValue = CATEGORYStart;
        DBParameter[7].ParameterName = "中分類迄";
        DBParameter[7].ParameterValue = CATEGORYEnd;
        DBParameter[8].ParameterName = "小分類起";
        DBParameter[8].ParameterValue = SORTOUTStart;
        DBParameter[9].ParameterName = "小分類迄";
        DBParameter[9].ParameterValue = SORTOUTEnd;
        DBParameter[10].ParameterName = "商品起";
        DBParameter[10].ParameterValue = SKUStart;
        DBParameter[11].ParameterName = "商品迄";
        DBParameter[11].ParameterValue = SKUEnd;
        DBParameter[12].ParameterName = "期別起";
        DBParameter[12].ParameterValue = ITEMStart;
        DBParameter[13].ParameterName = "期別迄";
        DBParameter[13].ParameterValue = ITEMEnd;
        DBParameter[14].ParameterName = "通路起";
        DBParameter[14].ParameterValue = CHAINStart;
        DBParameter[15].ParameterName = "通路迄";
        DBParameter[15].ParameterValue = CHAINEnd;
        DBParameter[16].ParameterName = "門市起";
        DBParameter[16].ParameterValue = STOREStart;
        DBParameter[17].ParameterName = "門市迄";
        DBParameter[17].ParameterValue = STOREEnd;
        DBParameter[18].ParameterName = "營業所起";
        DBParameter[18].ParameterValue = ZOStart;
        DBParameter[19].ParameterName = "營業所迄";
        DBParameter[19].ParameterValue = ZOEnd;
        DBParameter[20].ParameterName = "供應商起";
        DBParameter[20].ParameterValue = VENDORStart;
        DBParameter[21].ParameterName = "供應商迄";
        DBParameter[21].ParameterValue = VENDOREnd;
        DBParameter[22].ParameterName = "報表分類選擇";
        DBParameter[22].ParameterValue = rdoCLASSIFY;
        DBParameter[23].ParameterName = "報表類別";
        DBParameter[23].ParameterValue = rdoTYPE;

        #endregion

        string ReportCode = "MKT09_2";
        string ProcessLogFile = "";

        MKT_MKT091 MKTRPTPage = new MKT_MKT091();

        MKTRPTPage.GenerReportConfigXML("MKT",
                                        "MKT091.aspx",
                                        ReportCode,
                                        "",
                                        DBParameter,
                                        null,
                                        ReportOutputFormat.EXCEL,
                                        ExportFileNameText,
                                        ref ProcessLogFile
                                        );

        MKTRPTPage.Dispose();

        return ProcessLogFile;
    }
예제 #2
0
    public static string SendReport1Message(string MDCStartDate,
                                            string MDCEndDate,
                                            string ROOTNOStart,
                                            string ROOTNOEnd,
                                            string PMAStart,
                                            string PMAEnd,
                                            string CATEGORYStart,
                                            string CATEGORYEnd,
                                            string SORTOUTStart,
                                            string SORTOUTEnd,
                                            string SKUStart,
                                            string SKUEnd,
                                            string ITEMStart,
                                            string ITEMEnd,
                                            string CHAINStart,
                                            string CHAINEnd,
                                            string STOREStart,
                                            string STOREEnd,
                                            string ZOStart,
                                            string ZOEnd,
                                            string VENDORStart,
                                            string VENDOREnd,
                                            string rdoCLASSIFY,
                                            string rdoTYPE,
                                            string UID,
                                            string StAcceptDateRange,
                                            string ROOTDateRange,
                                            string PMADateRange,
                                            string RPTParameter5Value,
                                            string RPTParameter6Value,
                                            string RPTParameter7Value,
                                            string RPTParameter8Value,
                                            string RPTParameterAdd1Value,                                            
                                            string RPTParameterAdd2Value,
                                            string RPTParameterAdd3Value
                                            )
    {
        ReportParameter[] DBParameter = new ReportParameter[24];

        #region DB需要的變數

        DBParameter[0].ParameterName = "分析開始日";
        DBParameter[0].ParameterValue = MDCStartDate;
        DBParameter[1].ParameterName = "分析結束日";
        DBParameter[1].ParameterValue = MDCEndDate;
        DBParameter[2].ParameterName = "群分類起";
        DBParameter[2].ParameterValue = ROOTNOStart;
        DBParameter[3].ParameterName = "群分類迄";
        DBParameter[3].ParameterValue = ROOTNOEnd;
        DBParameter[4].ParameterName = "大分類起";
        DBParameter[4].ParameterValue = PMAStart;
        DBParameter[5].ParameterName = "大分類迄";
        DBParameter[5].ParameterValue = PMAEnd;
        DBParameter[6].ParameterName = "中分類起";
        DBParameter[6].ParameterValue = CATEGORYStart;
        DBParameter[7].ParameterName = "中分類迄";
        DBParameter[7].ParameterValue = CATEGORYEnd;
        DBParameter[8].ParameterName = "小分類起";
        DBParameter[8].ParameterValue = SORTOUTStart;
        DBParameter[9].ParameterName = "小分類迄";
        DBParameter[9].ParameterValue = SORTOUTEnd;
        DBParameter[10].ParameterName = "商品起";
        DBParameter[10].ParameterValue = SKUStart;
        DBParameter[11].ParameterName = "商品迄";
        DBParameter[11].ParameterValue = SKUEnd;
        DBParameter[12].ParameterName = "期別起";
        DBParameter[12].ParameterValue = ITEMStart;
        DBParameter[13].ParameterName = "期別迄";
        DBParameter[13].ParameterValue = ITEMEnd;
        DBParameter[14].ParameterName = "通路起";
        DBParameter[14].ParameterValue = CHAINStart;
        DBParameter[15].ParameterName = "通路迄";
        DBParameter[15].ParameterValue = CHAINEnd;
        DBParameter[16].ParameterName = "門市起";
        DBParameter[16].ParameterValue = STOREStart;
        DBParameter[17].ParameterName = "門市迄";
        DBParameter[17].ParameterValue = STOREEnd;
        DBParameter[18].ParameterName = "營業所起";
        DBParameter[18].ParameterValue = ZOStart;
        DBParameter[19].ParameterName = "營業所迄";
        DBParameter[19].ParameterValue = ZOEnd;
        DBParameter[20].ParameterName = "供應商起";
        DBParameter[20].ParameterValue = VENDORStart;
        DBParameter[21].ParameterName = "供應商迄";
        DBParameter[21].ParameterValue = VENDOREnd;
        DBParameter[22].ParameterName = "報表分類選擇";
        DBParameter[22].ParameterValue = rdoCLASSIFY;
        DBParameter[23].ParameterName = "報表類別";
        DBParameter[23].ParameterValue = rdoTYPE;

        #endregion

        ReportParameter[] CryReportParameter = new ReportParameter[12];

        #region 報表變數

        CryReportParameter[0].ParameterName = "par_Program_ID";
        CryReportParameter[0].ParameterValue = "MKT09";
        CryReportParameter[1].ParameterName = "par_LoginUser";
        CryReportParameter[1].ParameterValue = UID;
        CryReportParameter[2].ParameterName = "par_StAcceptDate";
        CryReportParameter[2].ParameterValue = StAcceptDateRange;
        CryReportParameter[3].ParameterName = "par_ROOTDate";
        CryReportParameter[3].ParameterValue = ROOTDateRange;
        CryReportParameter[4].ParameterName = "par_PMADate";
        CryReportParameter[4].ParameterValue = PMADateRange;

        #endregion

        string ReportCode = "MKT09_1";
        string ProcessLogFile = "";
            
        MKT_MKT091 MKTRPTPage = new MKT_MKT091();

        string ReportFilePath = "";
        string DownLoadFileName = "";
        int RPTParameterCount = 0;


        if (rdoTYPE.Trim() != "")//類別不是空白
        {
            RPTParameterCount = 4;

            switch (rdoCLASSIFY)
            {
                #region 依分類增加報表參數

                case "1"://中分類
                    CryReportParameter[5].ParameterName = "par_CATEGORYDate";
                    CryReportParameter[5].ParameterValue = RPTParameter5Value;
                    RPTParameterCount = 5;
                    break;
                case "2"://小分類
                    CryReportParameter[5].ParameterName = "par_CATEGORYDate";
                    CryReportParameter[5].ParameterValue = RPTParameter5Value;
                    CryReportParameter[6].ParameterName = "par_SORTOUTDate";
                    CryReportParameter[6].ParameterValue = RPTParameter6Value;
                    RPTParameterCount = 6;
                    break;
                case "3"://單品
                    CryReportParameter[5].ParameterName = "par_CATEGORYDate";
                    CryReportParameter[5].ParameterValue = RPTParameter5Value;
                    CryReportParameter[6].ParameterName = "par_SORTOUTDate";
                    CryReportParameter[6].ParameterValue = RPTParameter6Value;
                    CryReportParameter[7].ParameterName = "par_SKUDate";
                    CryReportParameter[7].ParameterValue = RPTParameter7Value;
                    if (rdoTYPE != "4")//不是不分類別的
                    {
                        CryReportParameter[8].ParameterName = "par_ITEMDate";
                        CryReportParameter[8].ParameterValue = RPTParameter8Value;
                        RPTParameterCount = 8;
                    }
                    else
                    {
                        RPTParameterCount = 7;
                    }
                    break;
                default:
                    break;

                #endregion
            }

            if (rdoTYPE == "4") //不分類別報表
            {
                switch (rdoCLASSIFY) //判斷分類
                {
                    #region 依分類判斷開啟報表

                    case "0"://大分類
                        ReportFilePath = MKTRPTPage.Server.MapPath("REPORT\\MKT07\\CRMKT07R01.rpt");
                        DownLoadFileName = "PMA(大分類)銷售查詢";
                        break;
                    case "1"://中分類
                        ReportFilePath = MKTRPTPage.Server.MapPath("REPORT\\MKT07\\CRMKT07R02.rpt");
                        DownLoadFileName = "PMA(中分類)銷售查詢";
                        break;
                    case "2"://小分類
                        ReportFilePath = MKTRPTPage.Server.MapPath("REPORT\\MKT07\\CRMKT07R03.rpt");
                        DownLoadFileName = "PMA(小分類)銷售查詢";
                        break;
                    case "3"://單品
                        ReportFilePath = MKTRPTPage.Server.MapPath("REPORT\\MKT09\\CRMKT09R06.rpt");
                        DownLoadFileName = "PMA(單品)銷售查詢";
                        break;
                    default:
                        break;

                    #endregion
                }
            }
            else //通路,營業所,供應商,門市報表
            {

                switch (rdoCLASSIFY) //判斷分類
                {
                    #region 依分類判斷開啟報表

                    case "0"://大分類
                        ReportFilePath = MKTRPTPage.Server.MapPath("REPORT\\MKT09\\CRMKT09R01.rpt");
                        DownLoadFileName = "PMA(大分類)銷售查詢";
                        break;
                    case "1"://中分類
                        ReportFilePath = MKTRPTPage.Server.MapPath("REPORT\\MKT09\\CRMKT09R02.rpt");
                        DownLoadFileName = "PMA(中分類)銷售查詢";
                        break;
                    case "2"://小分類
                        ReportFilePath = MKTRPTPage.Server.MapPath("REPORT\\MKT09\\CRMKT09R03.rpt");
                        DownLoadFileName = "PMA(小分類)銷售查詢";
                        break;
                    case "3"://單品
                        ReportFilePath = (rdoTYPE == "3") ? MKTRPTPage.Server.MapPath("REPORT\\MKT09\\CRMKT09R05.rpt") : MKTRPTPage.Server.MapPath("REPORT\\MKT09\\CRMKT09R04.rpt");
                        DownLoadFileName = "PMA(單品)銷售查詢";
                        break;
                    default:
                        break;

                    #endregion
                }
            }


            if (rdoTYPE != "4") //通路,營業所,供應商,門市報表
            {
                #region 通路,營業所,供應商,門市報表都必需加變數

                CryReportParameter[RPTParameterCount+1].ParameterName = "par_TypeDate";
                CryReportParameter[RPTParameterCount+1].ParameterValue = RPTParameterAdd1Value;
                CryReportParameter[RPTParameterCount+2].ParameterName = "par_RPTDate";
                CryReportParameter[RPTParameterCount+2].ParameterValue = RPTParameterAdd2Value;
                CryReportParameter[RPTParameterCount+3].ParameterName = "par_ReportName";
                CryReportParameter[RPTParameterCount + 3].ParameterValue = DownLoadFileName + RPTParameterAdd3Value;

                DownLoadFileName += RPTParameterAdd3Value;

                #endregion
            }


            MKTRPTPage.GenerReportConfigXML("MKT",
                                            "MKT091.aspx",
                                            ReportCode,
                                            ReportFilePath,
                                            DBParameter,
                                            CryReportParameter,
                                            ReportOutputFormat.PDF,
                                            DownLoadFileName,
                                            ref ProcessLogFile
                                            );
        }
        else
        {
            throw new Exception("請選擇報表類別!!");
        }



        MKTRPTPage.Dispose();

        return ProcessLogFile;
    }