Пример #1
0
    private void SetProductDetail(StockOutWHItemData 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);
    }
Пример #2
0
 public bool UpdateStockOutItem(decimal NO, decimal REFLOID, string BARCODE, decimal PRODUCT, string LOTNO, 
     decimal QTY, decimal UNIT, decimal PRICE, string UNITNAME, decimal REQUISITION, decimal REMAINQTY, 
     string PRODUCTNAME)
 {
     StockOutWHItemData data = new StockOutWHItemData();
     data.NO = Convert.ToDouble(NO);
     data.LOTNO = LOTNO;
     data.PRICE = Convert.ToDouble(PRICE);
     data.BARCODE = BARCODE;
     data.PRODUCT = Convert.ToDouble(PRODUCT);
     data.PRODUCTNAME = PRODUCTNAME;
     data.QTY = Convert.ToDouble(QTY);
     data.REFLOID = Convert.ToDouble(REFLOID);
     data.UNIT = Convert.ToDouble(UNIT);
     data.UNITNAME = UNITNAME;
     data.REQUISITION = Convert.ToDouble(REQUISITION);
     data.REMAIN = Convert.ToDouble(REMAINQTY);
     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;
             dRow["PRODUCTNAME"] = data.PRODUCTNAME;
             ReOrder(dt);
             System.Web.HttpContext.Current.Session[sessionName] = dt;
         }
     }
     else throw new ApplicationException(_error);
     return ret;
 }
Пример #3
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(StockOutWHItemData 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;
             dRow["PRODUCTNAME"] = data.PRODUCTNAME;
             dt.Rows.Add(dRow);
             System.Web.HttpContext.Current.Session[sessionName] = dt;
         }
     }
     return ret;
 }
Пример #4
0
    private bool VerifyData(StockOutWHItemData 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 && dRow["PRODUCT"].ToString() == data.LOTNO && Convert.ToDouble(dRow["NO"]) != data.NO)
                    {
                        _error = "ÃÒ¡ÒÃÊÔ¹¤éÒã¹ Lot ¹ÕéÁÕÍÂÙèã¹ÃÒ¡ÒÃáÅéÇ";
                        ret = false;
                        goto ex;
                    }
                }


            }
        ex: ;
        }
        return ret;
    }
Пример #5
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 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");
        StockOutWHItemData data = new StockOutWHItemData();
        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.PRODUCTNAME = cmbProduct.SelectedItem.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["PRODUCTNAME"] = data.PRODUCTNAME;
        e.NewValues["LOTNO"] = data.LOTNO;
        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);
    }
Пример #6
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");

        StockOutWHItemData data = new StockOutWHItemData();
        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.PRODUCTNAME = cmbProduct.SelectedItem.Text;
        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);
    }