示例#1
0
        /// <summary>
        /// MKT09報表所需要的資料內容
        /// </summary>
        /// <param name="ParameterList">變數清單</param>
        /// <returns>回傳查詢結果</returns>
        public DataTable MKT09_1(ArrayList ParameterList)
        {
            MKTModel.MaintainPMASale BCO = new MKTModel.MaintainPMASale(ConntionDB);

            DataTable Dt = BCO.QuerySwitch(MKTModel.MaintainPMASale.QueryType.QueryByPMA, ParameterList);

            if (Dt.Rows.Count > 0)
            {
                return Dt;
            }
            else
            {
                throw new Exception("查無資料!!");
            }
        }
示例#2
0
        /// <summary>
        /// MKT09匯出報表所需要的資料內容
        /// </summary>
        /// <param name="ParameterList">變數清單</param>
        /// <returns>回傳查詢結果</returns>
        public DataTable MKT09_2(ArrayList ParameterList,
                                 string ReportOutputFormat,
                                 ref ReportList.ExcelOtherType EOT)
        {
            MKTModel.MaintainPMASale BCO = new MKTModel.MaintainPMASale(ConntionDB);

            DataTable Dt = BCO.QuerySwitch(MKTModel.MaintainPMASale.QueryType.QueryByPMA, ParameterList);

            if (Dt.Rows.Count == 0)
            {
                throw new Exception("查無資料");
            }
            if (Dt.Rows.Count > 60000)
            {
                throw new Exception("目前查詢筆數過多,請縮小查詢條件範圍");
            }

            //設定使用第三方元件匯出EXCEL
            if (ReportOutputFormat == "EXCEL")
            {
                #region 表頭

                Dt.Columns[0].ColumnName = "群分類";
                Dt.Columns[1].ColumnName = "群分類名稱";
                Dt.Columns[2].ColumnName = "大分類";
                Dt.Columns[3].ColumnName = "大分類名稱";
                int i = 4;

                //分類
                string rdoClassIFY = ParameterList[22].ToString();
                //報表型式
                string rdoTYPE = ParameterList[23].ToString();

                switch (rdoClassIFY)
                {
                    case "0"://大分類
                        #region 判斷報表

                        switch (rdoTYPE)
                        {
                            case "0"://通路
                                Dt.Columns[4].ColumnName = "通路代號";
                                Dt.Columns[5].ColumnName = "通路名稱 ";
                                i = 6;
                                break;
                            case "1"://營業所
                                Dt.Columns[4].ColumnName = "營業所代碼";
                                Dt.Columns[5].ColumnName = "營業所名稱  ";
                                i = 6;
                                break;
                            case "2"://供應商
                                Dt.Columns[4].ColumnName = "供應商代號";
                                Dt.Columns[5].ColumnName = "供應商名稱  ";
                                i = 6;
                                break;
                            case "3"://門市報表
                                Dt.Columns[4].ColumnName = "門市代號";
                                Dt.Columns[5].ColumnName = "門市名稱  ";
                                i = 6;
                                break;
                            default:
                                break;
                        }

                        #endregion
                        break;
                    case "1"://中分類
                        #region 判斷報表

                        Dt.Columns[4].ColumnName = "中分類";
                        Dt.Columns[5].ColumnName = "中分類名稱";
                        i = 6;

                        switch (rdoTYPE)
                        {
                            case "0"://通路
                                Dt.Columns[6].ColumnName = "通路代號";
                                Dt.Columns[7].ColumnName = "通路名稱 ";
                                i = 8;
                                break;
                            case "1"://營業所
                                Dt.Columns[6].ColumnName = "營業所代碼";
                                Dt.Columns[7].ColumnName = "營業所名稱  ";
                                i = 8;
                                break;
                            case "2"://供應商
                                Dt.Columns[6].ColumnName = "供應商代號";
                                Dt.Columns[7].ColumnName = "供應商名稱  ";
                                i = 8;
                                break;
                            case "3"://門市報表
                                Dt.Columns[6].ColumnName = "門市代號";
                                Dt.Columns[7].ColumnName = "門市名稱  ";
                                i = 8;
                                break;
                            default:
                                break;
                        }

                        #endregion
                        break;
                    case "2"://小分類
                        #region 判斷報表

                        Dt.Columns[4].ColumnName = "中分類";
                        Dt.Columns[5].ColumnName = "中分類名稱";
                        Dt.Columns[6].ColumnName = "小分類";
                        Dt.Columns[7].ColumnName = "小分類名稱";
                        i = 8;

                        switch (rdoTYPE)
                        {
                            case "0"://通路
                                Dt.Columns[8].ColumnName = "通路代號";
                                Dt.Columns[9].ColumnName = "通路名稱 ";
                                i = 10;
                                break;
                            case "1"://營業所
                                Dt.Columns[8].ColumnName = "營業所代碼";
                                Dt.Columns[9].ColumnName = "營業所名稱  ";
                                i = 10;
                                break;
                            case "2"://供應商
                                Dt.Columns[8].ColumnName = "供應商代號";
                                Dt.Columns[9].ColumnName = "供應商名稱  ";
                                i = 10;
                                break;
                            case "3"://門市報表
                                Dt.Columns[8].ColumnName = "門市代號";
                                Dt.Columns[9].ColumnName = "門市名稱  ";
                                i = 10;
                                break;
                            default:
                                break;
                        }

                        #endregion
                        break;
                    case "3"://單品
                        #region 判斷報表

                        Dt.Columns[4].ColumnName = "中分類";
                        Dt.Columns[5].ColumnName = "中分類名稱";
                        Dt.Columns[6].ColumnName = "小分類";
                        Dt.Columns[7].ColumnName = "小分類名稱";
                        Dt.Columns[8].ColumnName = "品號";
                        Dt.Columns[9].ColumnName = "品名";
                        Dt.Columns[10].ColumnName = "期別";
                        i = 11;

                        switch (rdoTYPE)
                        {
                            case "0"://通路
                                Dt.Columns[11].ColumnName = "通路代號";
                                Dt.Columns[12].ColumnName = "通路名稱 ";
                                i = 13;
                                break;
                            case "1"://營業所
                                Dt.Columns[11].ColumnName = "營業所代碼";
                                Dt.Columns[12].ColumnName = "營業所名稱  ";
                                i = 13;
                                break;
                            case "2"://供應商
                                Dt.Columns[11].ColumnName = "供應商代號";
                                Dt.Columns[12].ColumnName = "供應商名稱";
                                i = 13;
                                break;
                            case "3"://門市報表
                                Dt.Columns[11].ColumnName = "營業所名稱";
                                Dt.Columns[12].ColumnName = "通路代號";
                                Dt.Columns[13].ColumnName = "門市代號";
                                Dt.Columns[14].ColumnName = "門市名稱  ";
                                Dt.Columns[15].ColumnName = "營業人員  ";
                                i = 16;
                                break;
                            default:
                                break;
                        }

                        #endregion
                        break;
                    default:
                        break;
                }

                Dt.Columns[i++].ColumnName = "進貨數量";
                Dt.Columns[i++].ColumnName = "退貨數量";
                Dt.Columns[i++].ColumnName = "實銷數量";
                Dt.Columns[i++].ColumnName = "進貨牌價";
                Dt.Columns[i++].ColumnName = "退貨牌價";
                Dt.Columns[i++].ColumnName = "實銷牌價";
                Dt.Columns[i++].ColumnName = "進貨成本";
                Dt.Columns[i++].ColumnName = "退貨成本";
                Dt.Columns[i++].ColumnName = "實銷成本";
                Dt.Columns[i++].ColumnName = "進貨零售價";
                Dt.Columns[i++].ColumnName = "退貨零售價";
                Dt.Columns[i++].ColumnName = "實銷零售價";

                #endregion

                EOT = ReportList.ExcelOtherType.Normal;
            }

            return Dt;
        }