Ejemplo n.º 1
0
    private void QueryDUE()
    {
        CAAModel.MaintainDueRecord BCO = new CAAModel.MaintainDueRecord(ConntionDB);

        ParameterList.Clear();
        if (chkLike.Checked == true)
            ParameterList.Add("%" + txtDUE_NO.Text.Trim() + "%"); //V_DUE_NO
        else
            ParameterList.Add(txtDUE_NO.Text.Trim());             //V_DUE_NO

        ParameterList.Add(this.SLP_DUE_SOURCE_TYPE.Text); //V_SOURCE_TYPE
        ParameterList.Add(SLP_DUE_GROUP_NO.Text.Trim());  //V_GROUP_NO
        ParameterList.Add(SLP_DUE_STORE_ID.Text.Trim());  //V_STORE_ID
        ParameterList.Add(SLP_DUE_Z_O.Text.Trim());       //V_Z_O        

        if (chkLike.Checked == true)
            ParameterList.Add("%" + txtDUE_RFNO.Text.Trim() + "%"); //V_RFNO
        else
            ParameterList.Add(txtDUE_RFNO.Text.Trim());             //V_RFNO

        ParameterList.Add(SLP_DUE_SAL_ID.Text.Trim());       //V_SAL_ID
        ParameterList.Add(SLP_DUE_AC_ID.Text.Trim());        //V_AC_UID        
        ParameterList.Add(this.SLP_DUE_ROOT_NO.Text.Trim()); //V_ROOT_NO
        ParameterList.Add(this.ddlDUE_TAX_TYPE.SelectedValue.Trim()); //V_TAX_TYPE

        string strMin, strMax, strEqual;
        CompareSign(this.SLP_DUE_AMT.Operator, SLP_DUE_AMT.Text, out strMin, out strMax, out strEqual);
        ParameterList.Add(strMin);    //V_DUE_AMT_S
        ParameterList.Add(strMax);    //V_DUE_AMT_E
        ParameterList.Add(strEqual);  //V_DUE_AMT_Equal
        CompareSign(this.SLP_SUM_DUE_AMT.Operator, SLP_SUM_DUE_AMT.Text, out strMin, out strMax, out strEqual);
        ParameterList.Add(strMin);    //V_SUM_DUE_AMT_S
        ParameterList.Add(strMax);    //V_SUM_DUE_AMT_E
        ParameterList.Add(strEqual);  //V_SUM_DUE_AMT_Equal
        CompareSign(this.SLP_DUE_REMAIN_AMT.Operator, SLP_DUE_REMAIN_AMT.Text, out strMin, out strMax, out strEqual);
        ParameterList.Add(strMin);     //V_DUE_REMAIN_AMT_S
        ParameterList.Add(strMax);     //V_DUE_REMAIN_AMT_E
        ParameterList.Add(strEqual);   //V_DUE_REMAIN_AMT_Equal
        if (chkLike.Checked == true)
            ParameterList.Add("%" + txtDUE_MEMO.Text.Trim() + "%"); //V_MEMO
        else
            ParameterList.Add(txtDUE_MEMO.Text.Trim());            //V_MEMO

        ParameterList.Add(txtDUE_CLOSE_MONTH.Text.Trim());         //V_CLOSE_MONTH        
        ParameterList.Add(GetDateS(SLP_DUE_CREATEDATE.StartDate)); //V_CREATEDATE_S
        ParameterList.Add(GetDateE(SLP_DUE_CREATEDATE.EndDate));   //V_CREATEDATE_E
        ParameterList.Add(SLP_DUE_CREATEUID.Text.Trim());          //V_CREATEUID
        ParameterList.Add(GetDateS(SLP_DUE_UPDATEDATE.StartDate)); //V_UPDATEDATE_S
        ParameterList.Add(GetDateE(SLP_DUE_UPDATEDATE.EndDate));   //V_UPDATEDATE_E
        ParameterList.Add(SLP_DUE_UPDATEUID.Text.Trim());          //V_UPDATEUID
        Int32 iTopRownum;
        Int32.TryParse(TextBoxRowCountLimit.Text.Trim(), out iTopRownum);
        ParameterList.Add(iTopRownum.ToString());
        //Like部分直接在資料庫和前台做判斷,所以不再分別呼叫不同BCO
        DataTable dt = BCO.QueryDueByFind(ParameterList);

        Session[SessionName_DT] = dt;

        LabelQueryRecordCount.Text = string.Format("共{0}筆", dt.Rows.Count.ToString());
        if (dt.Rows.Count > 0)
        {
            GridView2.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text);
            GridView2.PageIndex = 0;
            BindData();
        }
        else
        {
            GridView2.DataSource = null;
            GridView2.DataBind();
            ErrorMsgLabel.Text = "查無資料";
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 編輯模式下的[儲存]鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void ButtonModify_Click(object sender, EventArgs e)
    {
        try
        {
            #region 檢查條件

            CAAModel.CAACommon CAAComm = new CAAModel.CAACommon();
            ArrayList arl_Check_Condition = Check_Condition(ViewState["Mode"].ToString());

            #region 如果檢查有誤,則Return

            if (arl_Check_Condition[1].ToString() != string.Empty)
            {
                #region 錯誤訊息

                this.ErrorMsgLabel.Text = arl_Check_Condition[1].ToString();

                #endregion

                #region Focus欄位

                if (arl_Check_Condition[0].ToString() != string.Empty)
                {
                    string s_ScriptManager_Script = CAAComm.ToMakeUp_SetFocus_Script(arl_Check_Condition[0].ToString(), true);
                    ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(UpdatePanel), "CAA143", s_ScriptManager_Script, true);
                }

                #endregion

                return;
            }

            #endregion

            #endregion

            DataTable dt;
            CAAModel.MaintainDueRecord BCO = new CAAModel.MaintainDueRecord(ConntionDB);

            #region 傳入參數

            ParameterList.Clear();
            ParameterList.Add(CAAComm.GetValueSetParameter(this.txtDUE_NO.Text, "string", false));//暫收單號

            //累計調整金額等於零時
            if (this.SLP_SUM_DUE_AMT.Text == "0")
            {
                //[調整餘額]是使用javascript帶入[調整金額]的數值,回server端時,再重新寫入一次
                this.SLP_DUE_REMAIN_AMT.Text = this.SLP_DUE_AMT.Text;

                ParameterList.Add(CAAComm.GetValueSetParameter(this.SLP_SOURCE_TYPE.Text, "int", false));//型式
                ParameterList.Add(CAAComm.GetValueSetParameter(this.SLP_STORE_ID.Text, "string", false));//客戶店號
                ParameterList.Add(CAAComm.GetValueSetParameter(this.SLP_ROOT_NO.Text, "string", false));//商品群分類
                ParameterList.Add(CAAComm.GetValueSetParameter(this.ddlTaxType.SelectedValue, "string", false));//稅別
                ParameterList.Add(CAAComm.GetValueSetParameter(this.SLP_DUE_AMT.Text, "int64", false));//調整金額
                ParameterList.Add(CAAComm.GetValueSetParameter(this.SLP_DUE_REMAIN_AMT.Text, "int64", false));//調整餘額
                ParameterList.Add(CAAComm.GetValueSetParameter(this.txtCLOSE_MONTH.Text, "string", false));//結帳年月
            }
            else
            {
                ParameterList.Add(CAAComm.GetValueSetParameter(string.Empty, "int", false));//型式
                ParameterList.Add(CAAComm.GetValueSetParameter(string.Empty, "string", false));//客戶店號
                ParameterList.Add(CAAComm.GetValueSetParameter(string.Empty, "string", false));//商品群分類
                ParameterList.Add(CAAComm.GetValueSetParameter(string.Empty, "string", false));//稅別
                ParameterList.Add(CAAComm.GetValueSetParameter(string.Empty, "int64", false));//調整金額
                ParameterList.Add(CAAComm.GetValueSetParameter(string.Empty, "int64", false));//調整餘額
                ParameterList.Add(CAAComm.GetValueSetParameter(string.Empty, "string", false));//結帳年月
            }
            ParameterList.Add(CAAComm.GetValueSetParameter(this.txtMEMO.Text, "string", false));//備註
            ParameterList.Add(CAAComm.GetValueSetParameter(DateTime.Now.ToString(), "datetime", false));//更新時間
            ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//更新人員
            ParameterList.Add(CAAComm.GetValueSetParameter(this.hdf_Old_UpdateDate.Value, "datetime", false));//原始更新時間
            ParameterList.Add(CAAComm.GetValueSetParameter(this.hdf_Old_UpdateUID.Value, "string", false));//原始更新人員

            #endregion

            #region 連結資料庫

            int iResult = BCO.UpdateDueRecord(ParameterList, DBT);

            if (iResult == 0)
            { ErrorMsgLabel.Text = "資料更新失敗:可能是已不存在或資料已被異動過"; }
            else
            {
                if (ViewState["DUE_NO"] != null)
                {
                    if (ViewState["SSID"] != null)
                        Response.Redirect("CAA143.aspx?Code=CAA14&Mode=View&DUE_NO=" + txtDUE_NO.Text.Trim() + "&SSID=" + ViewState["SSID"].ToString(), false);
                    else
                        Response.Redirect("CAA143.aspx?Code=CAA14&Mode=View&DUE_NO=" + txtDUE_NO.Text.Trim() + "&SSID=", false);
                }
            }

            #endregion
        }
        catch (Exception ex)
        { this.ErrorMsgLabel.Text = ex.Message; }
        finally { }
    }
Ejemplo n.º 3
0
    private void BindData()
    {
        ErrorMsgLabel.Text = "";

        CAAModel.MaintainDueRecord BCO = new CAAModel.MaintainDueRecord(ConntionDB);
        ParameterList.Clear();
        ParameterList.Add("");//ID
        ParameterList.Add(ViewState["DUE_NO"].ToString());//DUE_NO
        DataTable dt = BCO.QueryDetail(ParameterList);
        if (dt.Rows.Count > 0)
        {
            txtDUE_NO.Text = dt.Rows[0]["DUE_NO"].ToString().Trim();
            SLP_SOURCE_TYPE.Text = dt.Rows[0]["SOURCE_TYPE"].ToString().Trim();
            txtGROUP_NO.Text = dt.Rows[0]["GROUP_NO"].ToString().Trim();
            SLP_STORE_ID.Text = dt.Rows[0]["STORE_ID"].ToString().Trim();
            txtZ_O.Text = dt.Rows[0]["Z_O"].ToString().Trim();
            txtRFNO.Text = dt.Rows[0]["RFNO"].ToString().Trim();
            txtSAL_ID.Text = dt.Rows[0]["SAL_ID"].ToString().Trim();
            txtAC_ID.Text = dt.Rows[0]["AC_UID"].ToString().Trim();
            SLP_ROOT_NO.Text = dt.Rows[0]["ROOT_NO"].ToString().Trim();
            ddlTaxType.Text = dt.Rows[0]["TAX_TYPE"].ToString().Trim();
            SLP_DUE_AMT.Text = dt.Rows[0]["DUE_AMT"].ToString().Trim();
            SLP_SUM_DUE_AMT.Text = dt.Rows[0]["SUM_DUE_AMT"].ToString().Trim();
            SLP_DUE_REMAIN_AMT.Text = dt.Rows[0]["DUE_REMAIN_AMT"].ToString().Trim();
            txtMEMO.Text = dt.Rows[0]["MEMO"].ToString().Trim();
            txtCLOSE_MONTH.Text = dt.Rows[0]["CLOSE_MONTH"].ToString().Trim();
            SLP_CREATEDATE.Text = dt.Rows[0]["CREATEDATE"].ToString().Trim();
            SLP_CREATEUID.Text = dt.Rows[0]["CREATEUID"].ToString().Trim();
            SLP_UPDATEDATE.Text = dt.Rows[0]["UPDATEDATE"].ToString().Trim();
            SLP_UPDATEUID.Text = dt.Rows[0]["UPDATEUID"].ToString().Trim();
            hdf_Old_CreateDate.Value = dt.Rows[0]["CREATEDATE"].ToString().Trim();
            hdf_Old_UpdateDate.Value = dt.Rows[0]["UPDATEDATE"].ToString().Trim();
            hdf_Old_UpdateUID.Value = dt.Rows[0]["UPDATEUID"].ToString().Trim();
        }
        else
        {
            txtDUE_NO.Text = string.Empty;
            SLP_SOURCE_TYPE.Text = string.Empty;
            txtGROUP_NO.Text = string.Empty;
            SLP_STORE_ID.Text = string.Empty;
            txtZ_O.Text = string.Empty;
            txtRFNO.Text = string.Empty;
            txtSAL_ID.Text = string.Empty;
            txtAC_ID.Text = string.Empty;
            SLP_ROOT_NO.Text = string.Empty;
            ddlTaxType.Text = string.Empty;
            SLP_DUE_AMT.Text = string.Empty;
            SLP_SUM_DUE_AMT.Text = string.Empty;
            SLP_DUE_REMAIN_AMT.Text = string.Empty;
            txtMEMO.Text = string.Empty;
            txtCLOSE_MONTH.Text = string.Empty;
            SLP_CREATEDATE.Text = string.Empty;
            SLP_CREATEUID.Text = string.Empty;
            SLP_UPDATEDATE.Text = string.Empty;
            SLP_UPDATEUID.Text = string.Empty;
            hdf_Old_CreateDate.Value = string.Empty;
            hdf_Old_UpdateDate.Value = string.Empty;
            hdf_Old_UpdateUID.Value = string.Empty;

            ErrorMsgLabel.Text = "查無資料";
            if (ViewState["READMODE"] != null)
                if (ViewState["READMODE"].ToString().Trim() == "TOOLBAR")
                    ErrorMsgLabel.Text = "查無此筆資料或已被其他使用者刪除,請點選上一筆/下一筆鈕或回查詢頁重新查詢!";
        }
    }
Ejemplo n.º 4
0
    /// <summary>
    /// 新增模式下的[儲存]鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void ButtonNew_Click(object sender, EventArgs e)
    {
        try
        {
            #region 檢查條件

            CAAModel.CAACommon CAAComm = new CAAModel.CAACommon();
            ArrayList arl_Check_Condition = Check_Condition(ViewState["Mode"].ToString());

            #region 如果檢查有誤,則Return

            if (arl_Check_Condition[1].ToString() != string.Empty)
            {
                #region 錯誤訊息

                this.ErrorMsgLabel.Text = arl_Check_Condition[1].ToString();

                #endregion

                #region Focus欄位

                if (arl_Check_Condition[0].ToString() != string.Empty)
                {
                    string s_ScriptManager_Script = CAAComm.ToMakeUp_SetFocus_Script(arl_Check_Condition[0].ToString(), true);
                    ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(UpdatePanel), "CAA143", s_ScriptManager_Script, true);
                }

                #endregion

                return;
            }

            #endregion

            #endregion

            CAAModel.MaintainDueRecord BCO = new CAAModel.MaintainDueRecord(ConntionDB);

            DataTable dt;
            ParameterList.Clear();
            ParameterList.Add(SLP_SOURCE_TYPE.Text);          /// (1) 來源	    = SOURCE_TYPE                
            ParameterList.Add(SLP_STORE_ID.Text.Trim());      /// (2) 客戶店號	= STORE_ID            
            ParameterList.Add(SLP_ROOT_NO.Text.Trim());       /// (3) 商品群分類	= ROOT_NO
            ParameterList.Add(ddlTaxType.SelectedValue);      /// (4) 稅別	    = TAX_TYPE
            ParameterList.Add(SLP_DUE_AMT.Text);              /// (5) 調整金額	= DUE_AMT
            ParameterList.Add(SLP_SUM_DUE_AMT.Text.Replace(",", ""));          /// (6) 累計沖帳金額	= SUM_DUE_AMT
            this.SLP_DUE_REMAIN_AMT.Text = SLP_DUE_AMT.Text;
            ParameterList.Add(SLP_DUE_REMAIN_AMT.Text.Replace(",", ""));       /// (7) 調整餘額	= DUE_REMAIN_AMT                
            ParameterList.Add(txtMEMO.Text.Trim());           /// (8) 備註說明	= MEMO
            ParameterList.Add(txtCLOSE_MONTH.Text.Trim());    /// (9) 結帳年月	= CLOSE_MONTH
            ParameterList.Add(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")); /// (10) 建立日期	= CREATEDATE (系統抓取目前AP機器之時間)
            ParameterList.Add(Session["UID"].ToString());           /// (11) 建立人員	= CREATEUID  (系統抓取登入之使用者ID)
            string DUE_NO = "";
            string ID = "";
            int iResult = BCO.CreateDueRecord(ParameterList, DBT, out DUE_NO, out ID);

            Response.Redirect("CAA143.aspx?Code=CAA14&Mode=View&DUE_NO=" + DUE_NO, false);
        }
        catch (Exception ex)
        { this.ErrorMsgLabel.Text = ex.Message; }
        finally { }
    }
Ejemplo n.º 5
0
    /// <summary>
    /// 設定編輯狀態下的各個控制項狀態
    /// </summary>
    private void ModeSetEdit()
    {
        CAAModel.CAACommon CAAComm = new CAAModel.CAACommon();
        CAAModel.MaintainDueRecord BCO = new CAAModel.MaintainDueRecord(ConntionDB);

        this.ButtonModify.Visible = true;

        if (ViewState["DUE_NO"] != null)
        { BindData(); }
        else
        { ErrorMsgLabel.Text = "查無資料"; }

        txtDUE_NO.ReadOnly = true;
        txtDUE_NO.CssClass = "readtxtbox";

        ParameterList.Clear();
        ParameterList.Add(CAAComm.GetValueSetParameter(this.txtDUE_NO.Text, "string", false));//應收應付單號

        int wash_amt;
        BCO.QueryWashData(ParameterList,out wash_amt);
        if (wash_amt==0)
        {
            this.SLP_SOURCE_TYPE.ReadOnly = false;
            SLP_STORE_ID.ReadOnly = false;
            SLP_ROOT_NO.ReadOnly = false;
            ddlTaxType.Enabled = true;
            ddlTaxType.CssClass = "";
            SLP_DUE_AMT.ReadOnly = false;
            SourceType_Change();
            this.txtCLOSE_MONTH.ReadOnly = false;
        }
        else
        {
            this.SLP_SOURCE_TYPE.ReadOnly = true;
            SLP_STORE_ID.ReadOnly = true;
            SLP_ROOT_NO.ReadOnly = true;
            ddlTaxType.Enabled = false;
            ddlTaxType.CssClass = "readtxtbox";
            SLP_DUE_AMT.ReadOnly = true;
            this.txtCLOSE_MONTH.ReadOnly = true;
        }

        txtRFNO.ReadOnly = true;
        txtRFNO.CssClass = "readtxtbox";
        SLP_SUM_DUE_AMT.ReadOnly = true;
        SLP_DUE_REMAIN_AMT.ReadOnly = true;
        SLP_CREATEDATE.ReadOnly = true;
        SLP_CREATEUID.ReadOnly = true;
        SLP_UPDATEDATE.ReadOnly = true;
        SLP_UPDATEUID.ReadOnly = true;

        txtGROUP_NO.ReadOnly = true;
        txtGROUP_NO.CssClass = "readtxtbox";
        txtAC_ID.ReadOnly = true;
        txtAC_ID.CssClass = "readtxtbox";
        txtSAL_ID.ReadOnly = true;
        txtSAL_ID.CssClass = "readtxtbox";
        txtZ_O.ReadOnly = true;
        txtZ_O.CssClass = "readtxtbox";

        #region 設定需要驗證的控制項

        this.SLP_STORE_ID.ValidationGroup = "validate_Modify";//店號
        this.SLP_ROOT_NO.ValidationGroup = "validate_Modify";//商品群分類
        this.cuv_TaxType.ValidationGroup = "validate_Modify";//稅別
        this.SLP_DUE_AMT.ValidationGroup = "validate_Modify";//調整金額
        this.txtCLOSE_MONTH.ValidationGroup = "validate_Modify";//結帳年月

        #endregion
    }