Exemplo n.º 1
0
    private void SetProductDetail(StockOutFGItemData data, GridViewRow gRow, TextBox txtBarcode, DropDownList cmbProduct, DropDownList cmbLotNo, TextBox txtUnit, Label lblUnitName, TextBox txtPrice, TextBox txtQty, TextBox txtRef)
    {
        txtBarcode.Text = data.BARCODE;
        cmbProduct.SelectedIndex = cmbProduct.Items.IndexOf(cmbProduct.Items.FindByValue(data.PRODUCT.ToString()));
        SetProductStock(cmbLotNo, data.PRODUCT);
        txtUnit.Text = data.UNIT.ToString();
        lblUnitName.Text = data.UNITNAME;
        txtPrice.Text = data.PRICE.ToString(Constz.DblFormat);
        txtQty.Text = data.QTY.ToString(Constz.IntFormat);
        txtRef.Text = data.REFLOID.ToString();

        //if (txtBarcode.ID == "txtBarcodeNew" && txtBarcode.Text != "")
        //    InsertData(gRow);
    }
Exemplo n.º 2
0
    protected void grvItem_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        TextBox txtBarcode = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[2].FindControl("txtBarcode");
        DropDownList cmbProduct = (DropDownList)this.grvItem.Rows[e.RowIndex].Cells[3].FindControl("cmbProduct");
        DropDownList cmbLotNo = (DropDownList)this.grvItem.Rows[e.RowIndex].Cells[4].FindControl("cmbLotNo");
        TextBox txtRemainQty = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[5].FindControl("txtRemainQty");
        TextBox txtQty = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[6].FindControl("txtQty");
        TextBox txtUnit = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[7].FindControl("txtUnit");
        Label lblUnitName = (Label)this.grvItem.Rows[e.RowIndex].Cells[7].FindControl("lblUnitName");
        TextBox txtPrice = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[7].FindControl("txtPrice");
        TextBox txtRefLOID = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[7].FindControl("txtRefLOID");
        StockOutFGItemData data = new StockOutFGItemData();
        data.BARCODE = txtBarcode.Text.Trim();
        data.LOTNO = cmbLotNo.SelectedItem.Value;
        data.PRICE = Convert.ToDouble(txtPrice.Text == "" ? "0" : txtPrice.Text);
        data.PRODUCT = Convert.ToDouble(cmbProduct.SelectedItem.Value);
        data.REMAIN = Convert.ToDouble(txtRemainQty.Text == "" ? "0" : txtRemainQty.Text);
        data.QTY = Convert.ToDouble(txtQty.Text == "" ? "0" : txtQty.Text);
        data.REFLOID = Convert.ToDouble(txtRefLOID.Text == "" ? "0" : txtRefLOID.Text);
        data.UNIT = Convert.ToDouble(txtUnit.Text == "" ? "0" : txtUnit.Text);
        data.UNITNAME = lblUnitName.Text.Trim();

        e.NewValues["NO"] = "0";
        e.NewValues["BARCODE"] = data.BARCODE;
        e.NewValues["PRODUCT"] = data.PRODUCT.ToString();
        e.NewValues["LOTNO"] = data.LOTNO;
        e.NewValues["REMAINQTY"] = data.REMAIN.ToString();
        e.NewValues["QTY"] = data.QTY.ToString();
        e.NewValues["UNIT"] = data.UNIT.ToString();
        e.NewValues["PRICE"] = data.PRICE.ToString();
        e.NewValues["UNITNAME"] = data.UNITNAME;
        e.NewValues["REFLOID"] = data.REFLOID;
        e.NewValues["REQUISITION"] = (this.txtRefLoid.Text == "" ? "0" : this.txtRefLoid.Text);
    }
Exemplo n.º 3
0
    private void InsertData(GridViewRow gRow)
    {
        TextBox txtBarcode = (TextBox)gRow.Cells[2].FindControl("txtBarcodeNew");
        DropDownList cmbProduct = (DropDownList)gRow.Cells[3].FindControl("cmbProductNew");
        DropDownList cmbLotNo = (DropDownList)gRow.Cells[4].FindControl("cmbLotNoNew");
        TextBox txtQty = (TextBox)gRow.Cells[6].FindControl("txtQtyNew");
        TextBox txtUnit = (TextBox)gRow.Cells[7].FindControl("txtUnitNew");
        Label lblUnitName = (Label)gRow.Cells[7].FindControl("lblUnitNameNew");
        TextBox txtPrice = (TextBox)gRow.Cells[7].FindControl("txtPriceNew");
        TextBox txtRefLOID = (TextBox)gRow.Cells[7].FindControl("txtRefLOIDNew");
        TextBox txtRemainQty = (TextBox)gRow.Cells[5].FindControl("txtRemainQtyNew");


        StockOutFGItemData data = new StockOutFGItemData();
        data.BARCODE = txtBarcode.Text;
        data.LOTNO = cmbLotNo.SelectedItem.Value;
        data.PRICE = Convert.ToDouble(txtPrice.Text == "" ? "0" : txtPrice.Text);
        data.PRODUCT = Convert.ToDouble(cmbProduct.SelectedItem.Value);
        data.QTY = Convert.ToDouble(txtQty.Text == "" ? "0" : txtQty.Text);
        data.REMAIN = Convert.ToDouble(txtRemainQty.Text == "" ? "0" : txtRemainQty.Text);
        data.REFLOID = Convert.ToDouble(txtRefLOID.Text == "" ? "0" : txtRefLOID.Text);
        data.UNIT = Convert.ToDouble(txtUnit.Text == "" ? "0" : txtUnit.Text);
        data.UNITNAME = lblUnitName.Text.Trim();
        data.REQUISITION = Convert.ToDouble(this.txtRefLoid.Text == "" ? "0" : this.txtRefLoid.Text);

        if (ItemObj.InsertStockOutItem(data))
        {
            SetGrvItem(this.txtStatus.Text);
            Calculation();
        }
        else
            Appz.ClientAlert(this, ItemObj.ErrorMessage);
    }
Exemplo n.º 4
0
 public bool UpdateStockOutItem(decimal NO, decimal REFLOID, string BARCODE, decimal PRODUCT, string LOTNO, decimal REMAINQTY, decimal QTY, decimal UNIT, decimal PRICE, string UNITNAME, decimal REQUISITION)
 {
     StockOutFGItemData data = new StockOutFGItemData();
     data.NO = Convert.ToDouble(NO);
     data.LOTNO = LOTNO;
     data.PRICE = Convert.ToDouble(PRICE);
     data.BARCODE = BARCODE;
     data.PRODUCT = Convert.ToDouble(PRODUCT);
     data.REMAIN = Convert.ToDouble(REMAINQTY);
     data.QTY = Convert.ToDouble(QTY);
     data.REFLOID = Convert.ToDouble(REFLOID);
     data.UNIT = Convert.ToDouble(UNIT);
     data.UNITNAME = UNITNAME;
     data.REQUISITION = Convert.ToDouble(REQUISITION);
     bool ret = true;
     ret = VerifyData(data);
     if (ret)
     {
         DataTable dt = (DataTable)System.Web.HttpContext.Current.Session[sessionName];
         if (dt != null)
         {
             DataRow[] dRows = dt.Select("NO = " + data.NO);
             DataRow dRow = dRows[0];
             dRow["REFLOID"] = data.REFLOID;
             dRow["BARCODE"] = data.BARCODE;
             dRow["PRODUCT"] = data.PRODUCT;
             dRow["LOTNO"] = data.LOTNO;
             dRow["REMAINQTY"] = data.REMAIN;
             dRow["QTY"] = data.QTY;
             dRow["UNIT"] = data.UNIT;
             dRow["PRICE"] = data.PRICE;
             dRow["UNITNAME"] = data.UNITNAME;
             ReOrder(dt);
             System.Web.HttpContext.Current.Session[sessionName] = dt;
         }
     }
     else throw new ApplicationException(_error);
     return ret;
 }
Exemplo n.º 5
0
 //0 LOID, 0 PRODUCT, 0 QTY, 0 UNIT, 0 PRICE, 0 DISCOUNT, 0 NETPRICE, '" + Constz.ActiveStatus.Active + "' ACTIVE, '' BARCODE, '' UNITNAME, '' ISVAT ";
 public bool InsertStockOutItem(StockOutFGItemData data)
 {
     bool ret = true;
     ret = VerifyData(data);
     if (ret)
     {
         DataTable dt = (DataTable)System.Web.HttpContext.Current.Session[sessionName];
         if (dt != null)
         {
             ReOrder(dt);
             DataRow dRow = dt.NewRow();
             dRow["NO"] = Convert.ToDouble(dt.Rows.Count) + 1;
             dRow["REFLOID"] = data.REFLOID;
             dRow["BARCODE"] = data.BARCODE;
             dRow["PRODUCT"] = data.PRODUCT;
             dRow["LOTNO"] = data.LOTNO;
             dRow["REMAINQTY"] = data.REMAIN;
             dRow["QTY"] = data.QTY;
             dRow["UNIT"] = data.UNIT;
             dRow["PRICE"] = data.PRICE;
             dRow["UNITNAME"] = data.UNITNAME;
             dt.Rows.Add(dRow);
             System.Web.HttpContext.Current.Session[sessionName] = dt;
         }
     }
     return ret;
 }
Exemplo n.º 6
0
    private bool VerifyData(StockOutFGItemData data)
    {
        bool ret = true;
        if (data.PRODUCT == 0)
        {
            ret = false;
            _error = "¡ÃسÒàÅ×Í¡ÊÔ¹¤éÒ";
        }
        else if (data.LOTNO == "")
        {
            ret = false;
            _error = "¡ÃسÒàÅ×Í¡ Lot";
        }
        else if (data.QTY == 0)
        {
            ret = false;
            _error = "¡ÃسÒÃкبӹǹ";
        }

        else
        {
            if (data.QTY > 0)
            {
                double STOCK = FlowObj.GetQTYStock(data.LOTNO, data.PRODUCT);
                if (data.QTY > STOCK)
                {
                    _error = "¨Ó¹Ç¹ÊÔ¹¤éÒ·ÕèàºÔ¡µéͧäÁèà¡Ô¹¨Ó¹Ç¹·ÕèÁÕã¹ Stock";
                    ret = false;
                }
            }

            DataTable dt = (DataTable)System.Web.HttpContext.Current.Session[sessionName];
            if (dt != null)
            {
                foreach (DataRow dRow in dt.Rows)
                {
                    if (Convert.ToDouble(dRow["PRODUCT"]) == data.PRODUCT && Convert.ToDouble(dRow["NO"]) != data.NO)
                    {
                        _error = "ÃÒ¡ÒÃÊÔ¹¤éÒ¹ÕéÁÕÍÂÙèã¹ÃÒ¡ÒÃáÅéÇ";
                        ret = false;
                        goto ex;
                    }
                }

                if (FlowObj.GetReqItemProductData(data.REQUISITION, data.PRODUCT))
                {
                    StockOutFGItemData itemData = FlowObj.ReqItemProductData;
                    if (data.QTY > itemData.QTY)
                    {
                        _error = "¨Ó¹Ç¹ÊÔ¹¤éÒ·ÕèàºÔ¡µéͧ äÁèà¡Ô¹ ¨Ó¹Ç¹·Õè¢Í";
                        ret = false;
                    }
                }
            }

        ex: ;
        }
        return ret;
    }