Example #1
0
    //在輸入完條碼後的ENTER事件
    protected void Button2_Click(object sender, EventArgs e)
    {
        try
        {
            int i = this.txtBarCode.Text.Trim().Length;
            if (this.SLP_StoreChain1.Text.Trim() == "")
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "VGR022.aspx", "alert(' 請先選擇通路! ');", true);
            }
            else if (this.SLP_Store1.Text.Trim() == "")
            { ScriptManager.RegisterStartupScript(Page, this.GetType(), "VGR022.aspx", "alert(' 請先選擇門市! ');", true); }
            else if (this.SLP_SLPDate1.Text.Trim().Replace("/", "") == "")
            { ScriptManager.RegisterStartupScript(Page, this.GetType(), "VGR022.aspx", "alert(' 請先選擇簽收日! ');", true); }
            else if (i != 8 && i != 10 && i != 12 && i != 13 && i != 15 && i != 18)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "VGR022.aspx", "alert(' 條碼刷讀錯誤! ');", true);
                //ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(UpdatePanel), "隨便寫", "document.getElementById('" + this.txtBarCode.ClientID + "').focus();", true);
                SetClinetFocus(txtBarCode.ClientID);
            }
            else
            {
                VGRModel.MaintainChanReturnData BCO = new PIC.VDS2G.LGT.VGR.MaintainChanReturnData(ConntionDB);
                ParameterList.Clear();

                ParameterList.Add(this.txtBarCode.Text);
                ParameterList.Add(this.SLP_StoreChain1.Text);
                ParameterList.Add(this.SLP_Store1.Text);
                ParameterList.Add(DateTime.Parse(this.SLP_SLPDate1.Text));
                ParameterList.Add(SLP_SKU1.Text);
                ParameterList.Add(SLP_ItemPeriod1.Text);

                string strItem; string strPeriod; decimal iPrice; DateTime DChanEndDate; string strMSG; string strRESULT;
                BCO.GetItemByBarCode(ParameterList, out strItem, out strPeriod, out iPrice, out DChanEndDate, out strMSG, out strRESULT);
                //if (strItem != string.Empty)
                //{
                //this.SLP_SKU1.Text = dt.Rows[0][0].ToString();
                //this.SLP_ItemPeriod1.Text = dt.Rows[0][1].ToString();
                //this.h_ChanPrice.Value = dt.Rows[0][2].ToString();
                //this.h_ChanEndDate.Value = dt.Rows[0][3].ToString();
                this.SLP_SKU1.Text = strItem;
                this.SLP_ItemPeriod1.Text = strPeriod;
                this.h_ChanPrice.Value = iPrice.ToString();
                this.h_ChanEndDate.Value = DChanEndDate.ToString("yyyy/MM/dd");
                this.SLP_AdjustQty.Text = "1";
                pnlAdd.Visible = true;
                //}            
                //else
                //{
                //    ScriptManager.RegisterStartupScript(Page, this.GetType(), "VGR022.aspx", "alert(' 無此條碼! ');", true);
                //}

                if (strMSG != string.Empty)
                {
                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "VGR022.aspx", "alert(' " + strMSG + " ');", true);
                    return;
                }

                SetClinetFocus(((TextBox)SLP_AdjustQty.FindControl("TextBoxCode")).ClientID);
                //SLP_AdjustQty.Focus();
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
    }
Example #2
0
    protected void txtBarCode_TextChanged(object sender, EventArgs e)
    {
        int i = this.txtBarCode.Text.Trim().Length;
        if (this.SLP_StoreChain1.Text.Trim() == "")
        {
            ScriptManager.RegisterStartupScript(Page, this.GetType(), "VGR022.aspx", "alert(' 請先選擇通路! ');", true);
        }
        else if (this.SLP_Store1.Text.Trim() == "")
        { ScriptManager.RegisterStartupScript(Page, this.GetType(), "VGR022.aspx", "alert(' 請先選擇門市! ');", true); }
        else if (this.SLP_SLPDate1.Text.Trim().Replace("/", "") == "")
        { ScriptManager.RegisterStartupScript(Page, this.GetType(), "VGR022.aspx", "alert(' 請先選擇簽收日! ');", true); }
        else if (i != 8 && i != 10 && i != 12 && i != 13 && i != 15 && i != 18)
        {
            ScriptManager.RegisterStartupScript(Page, this.GetType(), "VGR022.aspx", "alert(' 條碼刷讀錯誤! ');", true);
        }
        else
        {
            VGRModel.MaintainChanReturnData BCO = new PIC.VDS2G.LGT.VGR.MaintainChanReturnData(ConntionDB);
            ParameterList.Clear();

            ParameterList.Add(this.txtBarCode.Text);
            ParameterList.Add(this.SLP_StoreChain1.Text);
            ParameterList.Add(this.SLP_Store1.Text);
            ParameterList.Add(DateTime.Parse(this.SLP_SLPDate1.Text));
            ParameterList.Add(SLP_SKU1.Text);
            ParameterList.Add(SLP_ItemPeriod1.Text);

            string strItem; string strPeriod; decimal iPrice; DateTime DChanEndDate; string strMSG; string strRESULT;
            BCO.GetItemByBarCode(ParameterList, out strItem, out strPeriod, out iPrice, out DChanEndDate, out strMSG, out strRESULT);

            this.SLP_SKU1.Text = strItem;
            this.SLP_ItemPeriod1.Text = strPeriod;
            this.h_ChanPrice.Value = iPrice.ToString();
            this.h_ChanEndDate.Value = DChanEndDate.ToString("yyyy/MM/dd");
            this.SLP_AdjustQty.Text = "1";
            pnlAdd.Visible = true;

            if (strMSG != string.Empty)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "VGR022.aspx", "alert(' " + strMSG + " ');", true);
                return;
            }
        }
    }
Example #3
0
    //更新鈕
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        if (this.SLP_SKU1.Text.Trim() == "" || this.SLP_ItemPeriod1.Text.Trim() == "" || this.SLP_AdjustQty.Text.Trim() == "")
        {
            ScriptManager.RegisterStartupScript(Page, this.GetType(), "VGR022.aspx", "alert(' 新增明細輸入不完全! ');", true);
            pnlAdd.Visible = true;
        }
        else
        {
            if (SLP_AdjustQty.Text.Trim() == "0")
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "VGR022.aspx", "alert('退貨數量請輸入0以外的正整數! ');", true);
                pnlAdd.Visible = true;
            }
            else
            {
                VGRModel.MaintainChanReturnData BCO = new PIC.VDS2G.LGT.VGR.MaintainChanReturnData(ConntionDB);
                ParameterList.Clear();

                ParameterList.Add(this.txtBarCode.Text);
                ParameterList.Add(this.SLP_StoreChain1.Text);
                ParameterList.Add(this.SLP_Store1.Text);
                ParameterList.Add(DateTime.Parse(this.SLP_SLPDate1.Text));
                ParameterList.Add(SLP_SKU1.Text);
                ParameterList.Add(SLP_ItemPeriod1.Text);

                string strItem; string strPeriod; decimal iPrice; DateTime DChanEndDate; string strMSG; string strRESULT;
                BCO.GetItemByBarCode(ParameterList, out strItem, out strPeriod, out iPrice, out DChanEndDate, out strMSG, out strRESULT);
                if (strItem != string.Empty)
                {
                    //this.SLP_SKU1.Text = strItem;
                    //this.SLP_ItemPeriod1.Text = strPeriod;
                    this.h_ChanPrice.Value = iPrice.ToString();
                    if (DChanEndDate.ToString("yyyy/MM/dd") != "1900/01/01")
                        this.h_ChanEndDate.Value = DChanEndDate.ToString("yyyy/MM/dd");
                    //this.SLP_AdjustQty.Text = "1";
                    //pnlAdd.Visible = true;
                }
                else
                {
                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "VGR022.aspx", "alert(' 無此牌價資料! ');", true);
                    pnlAdd.Visible = true;
                    return;
                }

                if (strMSG != string.Empty)
                {
                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "VGR022.aspx", "alert(' " + strMSG + " ');", true);
                    pnlAdd.Visible = true;
                    return;
                }

                try
                {
                    for (int i = 0; i < this.GridView1.Rows.Count; i++)
                    {
                        string strITEM = ((Label)this.GridView1.Rows[i].FindControl("lblItem")).Text;
                        string strPERIOD = ((Label)this.GridView1.Rows[i].FindControl("lblPeriod")).Text;
                        string strBACKWARD_QTY = ((TextBox)this.GridView1.Rows[i].FindControl("txtBackWardQty")).Text;

                        if (strITEM == SLP_SKU1.Text && strPERIOD == SLP_ItemPeriod1.Text)
                        {
                            ScriptManager.RegisterStartupScript(Page, this.GetType(), "VGR022.aspx", "alert(' 此商品已存在明細中! ');", true);
                            pnlAdd.Visible = true;
                            //TextBox txtSKU = (TextBox)this.SLP_SKU1.FindControl("TextBoxCode");//訂單擷轉日
                            //ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(UpdatePanel), "隨便寫", "document.getElementById('" + txtSKU.ClientID + "').focus();", true);
                            return;
                        }
                    }

                    DataRow dRow = dtForBrowse.NewRow();

                    string strID = "";

                    if (Request.QueryString["ID"] != null)
                    {
                        strID = Request.QueryString["ID"].ToString();
                    }
                    else
                    {
                        strID = CraeteMainID;
                    }

                    dRow["item"] = SLP_SKU1.Text;
                    dRow["item_name"] = SLP_SKU1.Name;
                    dRow["period"] = SLP_ItemPeriod1.Text;
                    dRow["Chan_Price"] = h_ChanPrice.Value;
                    if (h_ChanEndDate.Value != "")
                        dRow["Chan_End_Date"] = h_ChanEndDate.Value;

                    dRow["BackWard_Qty"] = SLP_AdjustQty.Text;
                    dRow["PID"] = 0;
                    dRow["UPDATEUID"] = Session["UID"].ToString();
                    dRow["UPDATEDATE"] = DateTime.Parse(PageTimeStamp.Value);
                    dRow["CREATEUID"] = Session["UID"].ToString();
                    dRow["CREATEDATE"] = DateTime.Parse(PageTimeStamp.Value);

                    dtForBrowse.Rows.Add(dRow);

                    GridView1.DataSource = dtForBrowse;
                    GridView1.DataBind();
                    //dtForBrowse = OldDt;
                    ClearAddDetail();

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