Esempio n. 1
0
        /// <summary>
        /// ALO21_1報表_轉單前檢查差異EXCEL
        /// </summary>
        /// <param name="ParameterList">變數清單</param>
        /// <returns>回傳查詢結果</returns>
        public DataTable ALO21_1(ArrayList ParameterList,
                                 ref ReportList.ExcelOtherType EOT)
        {
            #region
            ALOModel.MaintainStAccept BCO = new ALOModel.MaintainStAccept(ConntionDB);

            DataTable Dt = BCO.QueryCheckErrorInfo(ParameterList);

            if (Dt != null && Dt.Rows.Count > 0)
            {

                #region 表頭:如要指定表頭必設定
                Dt.Columns[0].ColumnName = "配本序號";
                Dt.Columns[1].ColumnName = "品號";
                Dt.Columns[2].ColumnName = "品名";
                Dt.Columns[3].ColumnName = "通路";
                Dt.Columns[4].ColumnName = "店號";
                Dt.Columns[5].ColumnName = "店名";
                Dt.Columns[6].ColumnName = "期別";
                Dt.Columns[7].ColumnName = "差異原因";
                #endregion

                EOT = ReportList.ExcelOtherType.Normal;//如要匯出EXCEL此為必要設定


                return Dt;
            }
            else
            {
                throw new Exception("查無資料!!");
            }
            #endregion
        }
    private void QueryData()
    {
        #region
        try
        {
            string SessionIDName = string.Format("{0}_{1}", strPrefixed, PageTimeStamp.Value);
            ALOModel.MaintainStAccept BCO = new ALOModel.MaintainStAccept(ConnectionDB);

            ArrayList ParameterList = new ArrayList();//20091113

            ParameterList.Clear();
            ParameterList.Add(SLP_SLPDate1.Text.Trim() == "" ? null : SLP_SLPDate1.Text.Trim());
            ParameterList.Add(txt_PickBatch.Text.Trim() == "" ? null : txt_PickBatch.Text.Trim());
            ParameterList.Add(Request.QueryString["UserIDKey"]);
            ParameterList.Add(string.Format("{0}_{1}", Request.QueryString["SessionIDKey"], Request.QueryString["UserIDKey"]));

            DataTable dt = BCO.QueryCheckErrorInfo(ParameterList);
            if (dt != null && dt.Rows.Count > 0)
            {
                gv_Result.DataSource = dt;
                gv_Result.PageSize = (TextBoxPagesize_Query.Text == "") ? 20 : (int.Parse(TextBoxPagesize_Query.Text) <= 0) ? 20 : int.Parse(TextBoxPagesize_Query.Text);
                gv_Result.DataBind();
                Session[SessionIDName] = dt;
                btn_Export.Enabled = true;
            }
            else
            {
                btn_Export.Enabled = false;
                gv_Result.DataBind();
                ResultMsgLabel.Text = "查無資料";
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }

        #endregion
    }
Esempio n. 3
0
        /// <summary>
        /// ALO21_2報表_列印鈕(已轉單)
        /// </summary>
        /// <param name="ParameterList">變數清單</param>
        /// <param name="ReportOutputFormat">報表格式(PDF,EXCEL)</param>
        /// <param name="EOT">匯出Excel方式</param>           
        /// <returns>回傳查詢結果</returns>
        public DataTable ALO21_2(ArrayList ParameterList,
                                 string ReportOutputFormat,
                                 ref ReportList.ExcelOtherType EOT
                                 )
        {

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

            DataTable Dt = null;
            string strErrMsg = "";

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

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

            return Dt;
            #endregion
        }
Esempio n. 4
0
    /// <summary>
    /// BUTTON [匯出]鈕

    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void but_GetOnHandResult_Click(object sender, EventArgs e)
    {
        DataTable dtReturn = new DataTable();
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        ArrayList ParameterList = new ArrayList();
        try
        {
            #region 檢查必填欄位
            BCO.CRMCommon CRMComm = new BCO.CRMCommon();
            sb.Append(CRMComm.Check_MustFillIN_Column(this.slp_ST_ACCEPT_DATE.Text, "[門市進貨日]為必填欄位", "0"));
            if (sb.ToString().Length > 0)
            {
                throw new Exception(sb.ToString().Trim());
            }
            #endregion

            #region 從資料庫取得資料

            ParameterList.Add(slp_ST_ACCEPT_DATE.Text);
            ParameterList.Add(Session["UID"].ToString());
            PIC.VDS2G.BSM.ALO.MaintainStAccept alo_bco = new PIC.VDS2G.BSM.ALO.MaintainStAccept(ConntionDB);
            //ALOBCO.MaintainStAccept alo_bco = new ALOBCO.MaintainStAccept();

            dtReturn = alo_bco.QueryOnHandResult(ParameterList);
            if (dtReturn == null || dtReturn.Rows.Count < 1)
            {
                throw new Exception("查無資料,門市進貨日[" + slp_ST_ACCEPT_DATE.Text + "]無手開單轉單");
            }

            #endregion

            #region 匯出資料
            string[] NameArr = { "類別", "店數", "品項數", "總冊數" };
            for (int i = 0; i < NameArr.Length; i++)
            {
                dtReturn.Columns[i].ColumnName = NameArr[i];
            }
            string FileCode = "CRM17_手開單轉單品項_" + slp_ST_ACCEPT_DATE.Text.Replace("/", "") + ".xls";
            //ExcelExportHelper.RenderDataTableToExcel(dt_Return, FileCode);
            WriteToXls2(dtReturn, FileCode);

            #endregion

        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally { }
    }
Esempio n. 5
0
    protected void gv_Result_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        #region
        try
        {


            bool bResult = false;
            Label lbl_N_DATA_STATUS = (Label)gv_Result.Rows[e.RowIndex].FindControl("lbl_N_DATA_STATUS");
            Label lbl_DIS_NO = (Label)gv_Result.Rows[e.RowIndex].FindControl("lbl_DIS_NO");
            Label lbl_ITEM = (Label)gv_Result.Rows[e.RowIndex].FindControl("lbl_ITEM");
            Label lbl_PERIOD = (Label)gv_Result.Rows[e.RowIndex].FindControl("lbl_PERIOD");

            ALOModel.MaintainStAccept BCO = new ALOModel.MaintainStAccept(ConnectionDB);
            string strErrMsg = "";
            ArrayList ParameterList = new ArrayList();

            ParameterList.Clear();
            ParameterList.Add(lbl_N_DATA_STATUS.Text.Trim());//門市進貨日
            ParameterList.Add(SLP_SLPDate1.Text);//門市進貨日
            ParameterList.Add(SLP_SLPNumber1.Text);//理貨批次
            ParameterList.Add(lbl_DIS_NO.Text.Trim());//配本序號
            ParameterList.Add(lbl_ITEM.Text.Trim());//品號
            ParameterList.Add(lbl_PERIOD.Text.Trim());//期別
            ParameterList.Add(Session["UID"].ToString());//執行者
            ParameterList.Add(DateTime.Now);//執行日期
            ParameterList.Add(string.Format("{0}_{1}", PageTimeStamp.Value, Session["UID"].ToString()));//PageTimeStamp_LoginID

            bResult = BCO.DeleteStOutAccept(ParameterList, out strErrMsg, null);

            if (bResult)
                ResultMsgLabel.Text = "刪除成功";
            else
                ResultMsgLabel.Text = "刪除失敗";

            DataTable dt = dt_QueryResult;
            for (Int32 i = 0; i <= dt.Rows.Count - 1; i++)
            {
                //2010/01/12 因為同一個配本序號要同生共滅,所以從GridView刪除某筆資料時,同一筆配本序號的資料要一起刪除
                if (dt.Rows[i].RowState != DataRowState.Deleted &&
                    lbl_DIS_NO.Text.Trim() == dt.Rows[i]["DIS_NO"].ToString().Trim()
                    //&& lbl_ITEM.Text.Trim() == dt.Rows[i]["ITEM"].ToString().Trim()
                    //&& lbl_PERIOD.Text.Trim() == dt.Rows[i]["PERIOD"].ToString().Trim()
                    )
                {

                    dt.Rows[i].Delete();
                }

            }

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



        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }

        #endregion
    }
Esempio n. 6
0
    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
    }
Esempio n. 7
0
    protected void btn11_ClearAbnormal_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            ALOModel.MaintainStAccept BCO = new ALOModel.MaintainStAccept(ConnectionDB);
            ArrayList ParameterList = new ArrayList();
            ParameterList.Add(Session["UID"].ToString());
            BCO.CLEAR_PROCESS_FLAG(ParameterList, null);

            string strJS = "alert('清除前次異常轉單狀態成功');location.href='ALO211.aspx?Code=ALO21';";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "CLEARABNORMAL", strJS, true);

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }


        #endregion

    }
Esempio n. 8
0
    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
    }
Esempio n. 9
0
    private bool ProcessCreateMultiStoreAccepts(string strStAcceptDate, string strDisType, string strPickBatch, string strUserID, string strSessionID, out string strErrMsg)
    {
        #region
        bool bResult = false;

        try
        {
            ALOModel.MaintainStAccept BCO = new ALOModel.MaintainStAccept(ConnectionDB);
            string strStAcceptNoArr = "";

            ArrayList ParameterList = new ArrayList();

            ParameterList.Clear();
            ParameterList.Add(strStAcceptDate);//門市進貨日
            ParameterList.Add(strPickBatch);//理貨批次
            ParameterList.Add(strDisType);//配本方式
            ParameterList.Add(strUserID);//執行者
            ParameterList.Add(string.Format("{0}_{1}", strSessionID, strUserID));//PageTimeStamp_LoginID

            bResult = BCO.ProcessCreateMultiStoreAccepts(ParameterList, out strStAcceptNoArr, out strErrMsg, null);
        }
        catch (Exception ex)
        {
            throw ex;
        }

        return bResult;

        #endregion
    }
Esempio n. 10
0
    private bool DeleteMultiStoreOutAccept()
    {
        #region
        bool bResult = false;

        try
        {
            ALOModel.MaintainStAccept BCO = new ALOModel.MaintainStAccept(ConnectionDB);
            string strErrMsg = "";

            ArrayList ParameterList = new ArrayList();

            ParameterList.Clear();
            ParameterList.Add(SLP_SLPDate1.Text);//門市進貨日
            ParameterList.Add(GetDisTypeSelectedValue());//配本方式
            ParameterList.Add(SLP_SLPNumber1.Text);//理貨批次
            ParameterList.Add(Session["UID"].ToString());//執行者
            ParameterList.Add(string.Format("{0}_{1}", PageTimeStamp.Value, Session["UID"].ToString()));//PageTimeStamp_LoginID

            bResult = BCO.DeleteMultiStoreOutAccept(ParameterList, out strErrMsg, null);

            if (bResult)
            {
                ResultMsgLabel.Text = "批次刪除成功";
                gv_Result.DataBind();
                gv_ResultFiltered.DataBind();
            }
            else
                ResultMsgLabel.Text = "批次刪除失敗";

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

        #endregion
    }
Esempio n. 11
0
    private bool SaveData()
    {
        #region
        bool bResult = false;

        try
        {
            ALOModel.MaintainStAccept BCO = new ALOModel.MaintainStAccept(ConnectionDB);
            string strErrMsg = "";

            ArrayList ParameterList = new ArrayList();

            ParameterList.Clear();
            ParameterList.Add(SLP_SLPDate1.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

            bResult = BCO.SaveMultiOutStAcccept(ParameterList, out strErrMsg, null);
        }
        catch (Exception ex)
        {
            throw ex;
        }

        return bResult;
        #endregion
    }