Example #1
0
    private void CheckChanMonthlyCloseYN(string sYN, out DataTable T_VANDER)
    {
        try
        {

            this.ErrorMsgLabel.Text = "";
            #region 傳入參數

            ParameterList.Clear();
            ParameterList.Add(sYN);
            #endregion

            #region 取得資料

            DataTable dt_Return = new DataTable();
            dt_Return = null;

            BCO.ProcessBalancePSS bco = new BCO.ProcessBalancePSS(ConntionDB);
            //string outResult = "", outErrorMsg = "";
            bco.CheckChanMonthlyClose(ParameterList, out dt_Return);
            //sResult = outResult;
            //sErrorMsg = outErrorMsg;
            T_VANDER = dt_Return;
            #endregion


        }
        catch (Exception ex)
        {
            this.ErrorMsgLabel.Text = ex.ToString();
            //sResult = "";
            //sErrorMsg = "";
            T_VANDER = null;
        }

    }
Example #2
0
    private void CheckLocateMonthlyCloseYN(string sYN, out string sResult, out string sErrorMsg, out DataTable T_VANDER)
    {
        try
        {

            this.ErrorMsgLabel.Text = "";
            #region 傳入參數

            ParameterList.Clear();
            ParameterList.Add(sYN);
            #endregion

            #region 取得資料

            DataTable dt_Return = new DataTable();
            DataTable dtM = new DataTable();
            dtM.Columns.Add("FIELD_NAME");
            dtM.Columns.Add("FIELD_DATE");

            //dtDetailData = dtM;
            //DataRow drA = dtM.NewRow();
            //dtM.Rows.Add(drA);
            BCO.ProcessBalancePSS bco = new BCO.ProcessBalancePSS(ConntionDB);
            string outResult = "", outErrorMsg = "";
            bco.CheckLocateMonthlyClose(ParameterList, out outResult, out outErrorMsg, out dt_Return);
            sResult = outResult;
            sErrorMsg = outErrorMsg;
            if (dt_Return.Rows.Count != 0)
            {
                DataRow drA1 = dtM.NewRow();
                DataRow drA2 = dtM.NewRow();
                DataRow drA3 = dtM.NewRow();
                drA1["FIELD_NAME"] = "凍結日期";
                drA1["FIELD_DATE"] = Convert.ToDateTime(dt_Return.Rows[0]["FREEZE_DATE"].ToString()).ToShortDateString();
                dtM.Rows.Add(drA1);

                drA2["FIELD_NAME"] = "月結日期";
                drA2["FIELD_DATE"] = Convert.ToDateTime(dt_Return.Rows[0]["UNFREEZE_DATE"].ToString()).ToShortDateString();
                dtM.Rows.Add(drA2);

                drA3["FIELD_NAME"] = "解凍日期";
                drA3["FIELD_DATE"] = Convert.ToDateTime(dt_Return.Rows[0]["CHECKOUT_DATE"].ToString()).ToShortDateString();
                dtM.Rows.Add(drA3);
            }

            T_VANDER = dtM;
            #endregion


        }
        catch (Exception ex)
        {
            this.ErrorMsgLabel.Text = ex.ToString();
            sResult = "";
            sErrorMsg = "";
            T_VANDER = null;
        }

    }
Example #3
0
    protected void SetClose()
    {
        try
        {
            this.Label1.Visible = false;
            this.gv_VANDER.Visible = false;
            this.Label2.Visible = false;
            this.gv_STORE_GROUP.Visible = false;
            this.btnSet.Visible = false;
            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            #region 檢查廠商日結
            DataTable dt_Return1 = new DataTable();
            string sResult1, sErrorMsg1;
            ChkVanderCloseYN(this.SLP_YearMonth1.Text.Trim(), out sResult1, out sErrorMsg1, out dt_Return1);
            if (sResult1 == "0")
            {
                //ErrorMsgLabel.Text = "供應商日結資訊有資料,月結不成功";
                sb.Append("供應商日結資訊有資料,月結不成功<br/>");
                this.Label1.Visible = false;
                //string SessionIDName = "PSS011_gv1_ItemInfo" + PageTimeStamp.Value;
                //Session[SessionIDName] = dt_Return1;
                this.gv_VANDER.Visible = true;
                this.gv_VANDER.DataSource = dt_Return1;
                this.gv_VANDER.DataBind();

            }
            else
            {
                this.Label1.Visible = true;
                this.Label1.Text = "當月供應商日結完成";
                
            }
            
            #endregion

            #region 檢查店群月結
            DataTable dt_Return2 = new DataTable();

            this.CheckChanMonthlyCloseYN(this.SLP_YearMonth1.Text.Trim(), out dt_Return2);
            if (dt_Return2.Rows.Count != 0)
            {
                sb.Append("尚未月結有資料,月結不成功<br/>");
                this.Label2.Visible = false;
                this.gv_STORE_GROUP.Visible = true;
                this.gv_STORE_GROUP.DataSource = dt_Return2;
                this.gv_STORE_GROUP.DataBind();
            }
            else
            {
                this.Label2.Visible = true;
                this.Label2.Text = "當月店群月結完成";
                
            }
            
            #endregion

            #region 檢查庫存月結
            DataTable dt_Return3 = new DataTable();
            string sResult3, sErrorMsg3;
            CheckLocateMonthlyCloseYN(this.SLP_YearMonth1.Text.Trim(), out sResult3, out sErrorMsg3, out dt_Return3);
            if (sResult3 == "0")
            {
                //ErrorMsgLabel.Text = "供應商日結資訊有資料,月結不成功";
                sb.Append("庫存月結未完成,請處理後再進行月結<br/>");
                //string SessionIDName = "PSS011_gv1_ItemInfo" + PageTimeStamp.Value;
                //Session[SessionIDName] = dt_Return1;
            }
            else
            {
                this.gv_DATE.Visible = true;
                this.gv_DATE.DataSource = dt_Return3;
                this.gv_DATE.DataBind();
            }
            #endregion

            if (sb.ToString() != "")
            {
                ErrorMsgLabel.Text = sb.ToString();
                this.btnSet.Visible = true;
                return;
            }
            else
            {
                #region 傳入參數

                ParameterList.Clear();
                ParameterList.Add(this.SLP_YearMonth1.Text.Trim());
                ParameterList.Add(Session["UID"].ToString());

                #endregion

                #region 取得資料

                BCO.ProcessBalancePSS bco = new BCO.ProcessBalancePSS(ConntionDB);
                //outDiffFlag判斷此月份是否有差異數。"1" 為有差異數
                string outDiffFlag = "", outResult = "", outErrorMsg = "";
                bco.ClosePSSLedger(ParameterList, out outDiffFlag, out outResult, out outErrorMsg);
                if (outResult == "0")
                {
                    ErrorMsgLabel.Text = outErrorMsg;
                }
                else
                {
                    if (outDiffFlag == "1")
                        ErrorMsgLabel.Text = "月結成功。此月份有差異數,請於進銷存差異調整作業進行調整。";
                    else
                        ErrorMsgLabel.Text = "月結成功";
                    //#region 檢查庫存月結
                    //DataTable dt_Return4 = new DataTable();
                    //string sResult4, sErrorMsg4;
                    //CheckLocateMonthlyCloseYN(this.txtYEAR_MONTH.Text.Trim(), out sResult4, out sErrorMsg4, out dt_Return4);
                    //if (sResult3 == "1")
                    //{
                    //    this.gv_DATE.DataSource = dt_Return4;
                    //    this.gv_DATE.DataBind();
                    //}
                    //#endregion
                }
                this.btnSet.Visible = true;
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "document.all['" + btnSet.ClientID + "'].disabled=false; ", true);
                #endregion
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
            this.btnSet.Visible = true;
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "document.all['" + btnSet.ClientID + "'].disabled=false; ", true);
        }
    }