Пример #1
0
        /// <summary>
        /// CAA21報表
        /// </summary>
        /// <param name="ParameterList">變數清單</param>
        /// <returns>回傳查詢結果</returns>
        public DataTable CAA21_1(ArrayList ParameterList)
        {
            CAAModel.InvoiceLetterPrint bco = new CAAModel.InvoiceLetterPrint(ConntionDB);
            DataTable Dt = bco.PrintReport(ParameterList);

            if (Dt.Rows.Count == 0)
            {
                throw new Exception("查無資料");
            }
            else
            {
                return Dt;
            }
        }
Пример #2
0
    //protected void btnReport_Click(object sender, EventArgs e)
    //{
    //    try
    //    {
    //        CAAModel.InvoiceLetterPrint BCO = new CAAModel.InvoiceLetterPrint(ConntionDB);

    //        DataTable dt;
    //        ParameterList.Clear();
    //        string strINVOICE_SEND = SLP_INVOICE_SEND.Text;
    //        ParameterList.Add(this.SLP_YearMonth.Text.Trim());
    //        ParameterList.Add(this.SLP_DATE.Text.Trim());
    //        ParameterList.Add(this.txtRFNO.Text.Trim());
    //        ParameterList.Add(this.SLP_Store.Text.Trim());
    //        ParameterList.Add(strINVOICE_SEND);

    //        dt = BCO.PrintReport(ParameterList);

    //        if (dt.Rows.Count == 0)
    //        {
    //            ErrorMsgLabel.Text = "查無資料";
    //            this.CryView.ReportSource = null;
    //        }
    //        else
    //        {
    //            //#region 設定頁面狀態
    //            //this.hid_PageStatus.Value = "PRINT";
    //            //#endregion

    //            //ShowReport(dt);

    //            #region 設定頁面狀態
    //            this.hid_PageStatus.Value = "QUERY";
    //            #endregion
    //            ExportReport(dt);
    //        }
    //    }
    //    catch (Exception ex)
    //    {
    //        ErrorMsgLabel.Text = ex.Message;
    //    }
    //    finally { }
    //}

    /// <summary>
    /// show報表
    /// </summary>
    //private void ShowReport(DataTable Dt)
    //{
    //    try
    //    {
    //        CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

    //        report.Load(Server.MapPath("./REPORT/CAA211/CAA21R01.rpt"));

    //        this.CryView.ReportSource = null;

    //        report.SetDataSource(Dt);

    //        this.CryView.ReportSource = report;

    //        //CryView.Visible = true;

    //        //重Bind Report 用
    //        Session["Rpt_Data" + PageTimeStamp.Value] = Dt;
    //    }
    //    catch (Exception ex)
    //    {
    //        ErrorMsgLabel.Text = ex.Message;
    //    }
    //    finally { }
    //}

    /// <summary>
    /// 設定報表參數
    /// </summary>
    /// <param name="paramName"></param>
    /// <param name="paramValue"></param>
    /// <param name="paramFields"></param>

    protected void btnExport_Click(object sender, EventArgs e)
    {
        string strGROUP_NO = ""; //店群代號
        string strGROUP_NAME = ""; //店群名稱
        string strCHAN_NO = ""; //通路代號
        string strCHAN_NAME = ""; //通路名稱
        string strSTORE_ID = ""; //店號
        string strSTORE_NAME = ""; //店名
        string strPAY_RFNO = ""; //結帳統編
        string strROUTE = ""; //路線
        string strSTEP = ""; //路順
        string strAC_UID = ""; //帳務人員

        string strPath = "";
        string strContent = "";
        CAAModel.InvoiceLetterPrint BCO = new CAAModel.InvoiceLetterPrint(ConntionDB);

        DataTable dtResult;
        ParameterList.Clear();
        string strINVOICE_SEND = SLP_INVOICE_SEND.Text;
        ParameterList.Add(this.SLP_YearMonth.Text.Trim());
        ParameterList.Add(this.SLP_DATE.Text.Trim());
        ParameterList.Add(this.txtRFNO.Text.Trim());
        ParameterList.Add(this.SLP_Store.Text.Trim());
        ParameterList.Add(strINVOICE_SEND);

        dtResult = BCO.ExportLetterText(ParameterList);
        ErrorMsgLabel.Text = "";
        if (dtResult.Rows.Count == 0)
        {
            ErrorMsgLabel.Text = "查無資料";
        }
        else
        {
            strContent = "\"店群代號\",\"店群名稱\",\"通路代號\",\"通路名稱\",\"店號\",\"店名\",\"結帳統編\",\"路線\",\"路順\",\"帳務人員\"" + "\r\n";
            for (int i = 0; i < dtResult.Rows.Count; i++)
            {
                strGROUP_NO = dtResult.Rows[i]["GROUP_NO"].ToString().Trim(); //店群代號
                strGROUP_NAME = dtResult.Rows[i]["GROUP_NAME"].ToString().Trim(); //店群名稱
                strCHAN_NO = dtResult.Rows[i]["CHAN_NO"].ToString().Trim(); //通路代號
                strCHAN_NAME = dtResult.Rows[i]["CHAN_NAME"].ToString().Trim(); //通路名稱
                strSTORE_ID = dtResult.Rows[i]["STORE_ID"].ToString().Trim(); //店號
                strSTORE_NAME = dtResult.Rows[i]["STORE_NAME"].ToString().Trim(); //店名
                strPAY_RFNO = dtResult.Rows[i]["PAY_RFNO"].ToString().Trim(); //結帳統編
                strROUTE = dtResult.Rows[i]["ROUTE"].ToString().Trim(); //路線
                strSTEP = dtResult.Rows[i]["STEP"].ToString().Trim(); //路順
                strAC_UID = dtResult.Rows[i]["AC_UID"].ToString().Trim(); //帳務人員

                strContent += "=\"" + strGROUP_NO + "\",=\"" + strGROUP_NAME + "\",=\"" + strCHAN_NO + "\",=\"" + strCHAN_NAME + "\",=\"" + strSTORE_ID + "\",=\"" + strSTORE_NAME + "\",=\"" + strPAY_RFNO + "\",=\"" + strROUTE + "\",=\"" + strSTEP + "\",=\"" + strAC_UID + "\"" + "\r\n";
            }

            DownloadStringToFile(this.Page, "EXPORT.CSV", strContent);
        }
    }