コード例 #1
0
ファイル: ALO211.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    private void QueryData()
    {
        #region
        try
        {
            ALOModel.MaintainStAccept BCO = new ALOModel.MaintainStAccept(ConnectionDB);
            string strErrMsg = "";
            DataTable dt = null;

            ArrayList ParameterList = new ArrayList();

            ParameterList.Clear();
            ParameterList.Add(SLP_SLPDate1.Text);//門市進貨日
            ParameterList.Add(SLP_SLPDate2.Text);//轉門市進貨單日
            ParameterList.Add(GetDisTypeSelectedValue());//配本方式
            ParameterList.Add(SLP_SLPNumber1.Text);//理貨批次
            ParameterList.Add(Session["UID"].ToString());//執行者
            ParameterList.Add(DateTime.Now);//執行日期
            ParameterList.Add(string.Format("{0}_{1}", PageTimeStamp.Value, Session["UID"].ToString()));//PageTimeStamp_LoginID :Session_ID
            ParameterList.Add(TextBoxRowCountLimit.Text.Trim());//最大筆數


            TransStatusType tst = GetCurrentTransStatus();

            if (tst == TransStatusType.Transfered)
            {
                #region
                dt = BCO.QueryStOutAcceptData(ParameterList, out strErrMsg);
                #endregion
            }

            if (tst == TransStatusType.Untransfered)
            {
                #region
                dt = BCO.QueryForFind(ParameterList, out strErrMsg);
                #endregion
            }

            dt_QueryResult = dt;

            txt_DisNo_Filtered.Text = "";
            SLP_SKU1_Filtered.Text = "";
            SLP_SKU1_Filtered.Name = "";
            SLP_ItemPeriod1_Filtered.Text = "";

            Int32 iRowCount = 0;


            if (dt != null && dt.Rows.Count > 0)
            {
                #region
                iRowCount = dt.Rows.Count;

                gv_Result.PageSize = iCurrentGvPageSize;
                gv_Result.PageIndex = iCurrentGvPageIndex;

                gv_Result.DataSource = dt;
                gv_Result.DataBind();

                btn3_Save.Enabled = true;

                Panel_ResultFilteredAll.Visible = true;
                btn_QueryFiltered.Visible = true;
                btn_QueryFiltered.Enabled = true;


                if (rbtn_TransStatus0.Checked)//未轉單
                {
                    btn0_CheckOutItem.Enabled = true;
                    btn1_CheckDisItem.Enabled = true;

                    if (iInsertCnt > 0)
                    {
                        btn3_Save.Enabled = true;
                        btn6_BatchDelete.Enabled = false;
                    }
                    else
                    {
                        btn3_Save.Enabled = false;
                        btn6_BatchDelete.Enabled = true;
                    }

                    btn4_CountItem.Enabled = true;
                    btn5_CountDisNo.Enabled = true;
                    btn7_Print.Enabled = true;
                }
                else//已轉單
                {
                    btn3_Save.Enabled = false;
                    btn6_BatchDelete.Enabled = false;
                    btn4_CountItem.Enabled = true;
                    btn5_CountDisNo.Enabled = true;
                    btn7_Print.Enabled = true;
                }


                #region
                hidden_DIS_NO.Value = "";

                foreach (DataRow dr in dt.Rows)
                {
                    hidden_DIS_NO.Value += string.Format("[{0}],", dr["DIS_NO"].ToString());
                }


                if (hidden_DIS_NO.Value.Trim() != "")
                {
                    if (hidden_DIS_NO.Value.Substring(hidden_DIS_NO.Value.Length - 1, 1) == ",")
                    {
                        hidden_DIS_NO.Value = hidden_DIS_NO.Value.Substring(0, hidden_DIS_NO.Value.Length - 1);
                    }
                }


                #endregion

                #endregion
            }
            else
            {
                #region
                iRowCount = 0;
                btn3_Save.Enabled = false;
                Panel_ResultFilteredAll.Visible = false;
                btn_QueryFiltered.Enabled = false;
                ResultMsgLabel.Text = "查無資料";
                gv_Result.DataBind();
                #endregion
            }

            dt_Filtered = null;
            gv_ResultFiltered.DataSource = dt_Filtered;
            gv_ResultFiltered.DataBind();


            AuthorityControls(this);

            LabelQueryRecordCount.Text = string.Format(" {0} Rows ", iRowCount);

            hiddenGvRowCounts.Value = iRowCount.ToString();

            //2010/04/27 added:clear Session value
            Session[string.Format("ALO21_StAcceptDate_{0}_{1}", PageTimeStamp.Value, Session["UID"].ToString())] = null;
            Session[string.Format("ALO21_PickBatch_{0}_{1}", PageTimeStamp.Value, Session["UID"].ToString())] = null;
            Session[string.Format("ALO21_DisType_{0}_{1}", PageTimeStamp.Value, Session["UID"].ToString())] = null;


        }
        catch (Exception ex)
        {
            gv_Result.DataBind();
            gv_ResultFiltered.DataBind();
            LabelQueryRecordCount.Text = "";

            throw ex;
        }


        #endregion
    }
コード例 #2
0
ファイル: ALO21.cs プロジェクト: ChiangHanLung/PIC_VDS
        /// <summary>
        /// ALO21_3報表_列印鈕(未轉單)
        /// </summary>
        /// <param name="ParameterList">變數清單</param>
        /// <param name="ReportOutputFormat">報表格式(PDF,EXCEL)</param>
        /// <param name="EOT">匯出Excel方式</param>           
        /// <returns>回傳查詢結果</returns>
        public DataTable ALO21_3(ArrayList ParameterList,
                                 string ReportOutputFormat,
                                 ref ReportList.ExcelOtherType EOT
                                 )
        {

            #region
            ALOModel.MaintainStAccept BCO = new ALOModel.MaintainStAccept(ConntionDB);

            DataTable Dt = null;
            string strErrMsg = "";

            Dt = BCO.QueryForFind(ParameterList, out strErrMsg);

            if (Dt == null || Dt.Rows.Count == 0)
            {
                throw new Exception("查無資料");
            }

            return Dt;
            #endregion
        }
コード例 #3
0
ファイル: ALO211.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    private void ShowReport()
    {
        #region

        CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

        try
        {
            string strFileName = "";

            report.Load(Server.MapPath("./REPORT/ALO21/ALO21R01.rpt"));
            strFileName = HttpUtility.UrlEncode("轉門市進貨單明細表.pdf", System.Text.Encoding.UTF8);


            #region 2010/02/11 重新查詢
            ArrayList ParameterList = new ArrayList();
            ParameterList.Clear();
            ParameterList.Add(SLP_SLPDate1.Text);//門市進貨日
            ParameterList.Add(SLP_SLPDate2.Text);//轉門市進貨單日
            ParameterList.Add(GetDisTypeSelectedValue());//配本方式
            ParameterList.Add(SLP_SLPNumber1.Text);//理貨批次
            ParameterList.Add(Session["UID"].ToString());//執行者
            ParameterList.Add(DateTime.Now);//執行日期
            ParameterList.Add(string.Format("{0}_{1}", PageTimeStamp.Value, Session["UID"].ToString()));//PageTimeStamp_LoginID :Session_ID
            ParameterList.Add(-1);//最大筆數

            ALOModel.MaintainStAccept BCO = new ALOModel.MaintainStAccept(ConnectionDB);

            string strErrMsg = "";
            DataTable Dt = null;

            if (rbtn_TransStatus1.Checked)//已轉單
            {
                #region
                Dt = BCO.QueryStOutAcceptData(ParameterList, out strErrMsg);
                #endregion
            }
            else//未轉單
            {
                #region
                Dt = BCO.QueryForFind(ParameterList, out strErrMsg);
                #endregion
            }

            #endregion

            report.SetDataSource(Dt);

            string Login_Name = ((DataTable)Session["UserInfo"]).Rows[0]["Name"].ToString();

            report.SetParameterValue("par_Program_ID", "ALO21R01");
            report.SetParameterValue("par_LoginUser", Session["UID"].ToString() + Login_Name);
            report.SetParameterValue("par_StAcceptDate", SLP_SLPDate1.Text);
            report.SetParameterValue("par_OutStAcceptDate", SLP_SLPDate2.Text);
            report.SetParameterValue("par_DisType", GetDisTypeSelectedText());

            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=" + strFileName);//pdf檔名  
            Response.ContentType = "application/pdf";
            Response.OutputStream.Write(bytesPDF, 0, bytesPDF.Length);
            Response.Flush();
            Response.Close();
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally
        {
            report.Close();
        }
        #endregion
    }