Exemplo n.º 1
0
    public static string SendReportMessage(string PickNoControl,
                                           string UserIdControl,
                                           string kind,
                                           string sort
                                          )
    {
        int FunNo = 0;

        IVMModel.MaintainPickData DBO = new IVMModel.MaintainPickData(ConntionDB);

        FunNo = DBO.GetPickFunNo(PickNoControl);

        if (FunNo == 99)
        {
            return "Error1";
        }

        string ReportCode = "";
        string ProgName = "", FileName = "", FilePath = "";
        switch (kind)
        {
            case "0":
                if (sort == "0") ReportCode = "VIM157_10"; else ReportCode = "VIM157_11";
                ProgName = "IVM15A";
                FileName = "揀貨單儲位匯總表列印";
                FilePath = "REPORT\\IVM15\\CRIVM15R01.rpt";
                break;
            case "1":
                if (sort == "0") ReportCode = "VIM157_20"; else ReportCode = "VIM157_21";
                ProgName = "IVM15A";
                FileName = "揀貨單儲格明細表列印";
                FilePath = "REPORT\\IVM15\\CRIVM15R02.rpt";
                break;
            case "2":
                if (FunNo != 6)
                {
                    return "Error";
                }

                ReportCode = "VIM157_3";
                ProgName = "IVM15A";
                FileName = "揀貨單門市揀貨清單列印";
                FilePath = "REPORT\\IVM15\\CRIVM15R03.rpt";
                break;
        }

        #region DB需要的變數

        ReportParameter[] DBParameter = new ReportParameter[1];
        DBParameter[0].ParameterName = "揀貨單號";
        DBParameter[0].ParameterValue = PickNoControl;

        #endregion

        #region 報表變數 送出產生報表

        string ProcessLogFile = "";
        IVM_IVM15A IVMRPTPage = new IVM_IVM15A();

        ReportParameter[] CryReportParameter;
        if (kind == "2")
        {
            CryReportParameter = new ReportParameter[2];
            CryReportParameter[0].ParameterName = "paraProg";
            CryReportParameter[0].ParameterValue = ProgName;
            CryReportParameter[1].ParameterName = "paraUserID";
            CryReportParameter[1].ParameterValue = UserIdControl;
        }
        else
        {
            CryReportParameter = new ReportParameter[10];
            CryReportParameter[0].ParameterName = "paraProg";
            CryReportParameter[0].ParameterValue = ProgName;
            CryReportParameter[1].ParameterName = "paraUserID";
            CryReportParameter[1].ParameterValue = UserIdControl;
            CryReportParameter[2].ParameterName = "paraPickNo";
            CryReportParameter[2].ParameterValue = PickNoControl;
            CryReportParameter[3].ParameterName = "paraSource";
            CryReportParameter[3].ParameterValue = "揀貨單列印處理";
            CryReportParameter[4].ParameterName = "paraAccDate";
            CryReportParameter[4].ParameterValue = "";
            CryReportParameter[5].ParameterName = "paraReturnNo";
            CryReportParameter[5].ParameterValue = "";
            CryReportParameter[6].ParameterName = "paraRemoveNo";
            CryReportParameter[6].ParameterValue = "";
            CryReportParameter[7].ParameterName = "paraBLocate";
            CryReportParameter[7].ParameterValue = "";
            CryReportParameter[8].ParameterName = "paraELocate";
            CryReportParameter[8].ParameterValue = "";
            CryReportParameter[9].ParameterName = "paraVendor";
            CryReportParameter[9].ParameterValue = "";
        }

        IVMRPTPage.GenerReportConfigXML("IVM",
                                        "IVM15A.aspx",
                                        ReportCode,
                                        IVMRPTPage.Server.MapPath(FilePath),
                                        DBParameter,
                                        CryReportParameter,
                                        ReportOutputFormat.PDF,
                                        FileName,
                                        ref ProcessLogFile
                                       );
        IVMRPTPage.Dispose();

        #endregion

        return ProcessLogFile;
    }
Exemplo n.º 2
0
    protected void btnRePrint_Click(object sender, EventArgs e)
    {

        int FunNo = 0;
        string PickNo = txtPickNo.Text;
        string strErr = string.Empty;

        if (this.txtPickNo.Text == string.Empty)
        {
            strErr = "請輸入撿貨單號";
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(UpdatePanel), "IVM15A", "alert('" + strErr + "');", true);
            return;
        }

        try
        {
            IVMModel.MaintainPickData DBO = new IVMModel.MaintainPickData(ConntionDB);
            FunNo = DBO.GetPickFunNo(txtPickNo.Text);

            if (FunNo == 99)
            {
                strErr = "無此揀貨單號";
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(UpdatePanel), "IVM15A", "alert('" + strErr + "');", true);
                return;
            }
            else
            {
                if (rdbKind.SelectedIndex == 0)
                {
                    if (rdbSort.SelectedIndex == 0)
                        LoadCrystalReport(PickNo, HttpUtility.UrlEncode("揀貨單儲位匯總表列印.PDF"), "./REPORT/IVM15/CRIVM15R01.rpt", "PDF", "item");
                    else
                        LoadCrystalReport(PickNo, HttpUtility.UrlEncode("揀貨單儲位匯總表列印.PDF"), "./REPORT/IVM15/CRIVM15R01.rpt", "PDF", "locate");
                }
                else if (rdbKind.SelectedIndex == 1)
                {
                    if (rdbSort.SelectedIndex == 0)
                        LoadCrystalReport(PickNo, HttpUtility.UrlEncode("揀貨單儲格明細表列印.PDF"), "./REPORT/IVM15/CRIVM15R02.rpt", "PDF", "item");
                    else
                        LoadCrystalReport(PickNo, HttpUtility.UrlEncode("揀貨單儲格明細表列印.PDF"), "./REPORT/IVM15/CRIVM15R02.rpt", "PDF", "locate");
                }
                else
                {
                    if (FunNo != 6)
                    {
                        strErr = "非手開單揀貨單號";
                        ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(UpdatePanel), "IVM15A", "alert('" + strErr + "');", true);
                        return;
                    }
                    if (rdbSort.SelectedIndex == 0)
                        LoadCrystalReport(PickNo, HttpUtility.UrlEncode("揀貨單門市揀貨明細表列印.PDF"), "./REPORT/IVM15/CRIVM15R03.rpt", "PDF", "item");
                    else
                        LoadCrystalReport(PickNo, HttpUtility.UrlEncode("揀貨單門市揀貨明細表列印.PDF"), "./REPORT/IVM15/CRIVM15R03.rpt", "PDF", "locate");
                }


            }

        }
        catch (Exception ex)
        {
            throw ex;
        }
    }