Exemplo n.º 1
0
        private int InsertStockInItem()
        {
            grvProductStockInShop.EndEdit();
            ArrayList arr = new ArrayList();
            ArrayList SiArr = new ArrayList();
            bool ret = true;
            bool rr = true;
            double cnt = 0;
            cnt = grvProductStockInShop.Rows.Count;
            StockInData sd = new StockInData();
            sd.GRANDTOT = Convert.ToDouble(txtTotal.Text.Trim());
            sd.LOID = Convert.ToDouble((txtSiLoid.Text.Trim()==""?"0":txtSiLoid.Text.Trim()));
            SiArr.Add(sd);
            if (_FLAG == "ADD")
            {
                for (int i = 0; i < cnt; i++)
                {
                    
                    DataGridViewTextBoxCell QTY = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["RECEIVE_QTY"];
                    DataGridViewTextBoxCell STOCKIN = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["SILOID"];
                    DataGridViewTextBoxCell PRODUCT = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["PDLOID"];
                    DataGridViewTextBoxCell REFLOID = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["RQILOID"];
                    DataGridViewTextBoxCell PRICE = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["PRICE"];
                    DataGridViewTextBoxCell ULOID = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["ULOID"];

                    StockInItemData dr = new StockInItemData();
                    dr.QTY = Convert.ToDouble(QTY.Value.ToString());
                    dr.STOCKIN = Convert.ToDouble(STOCKIN.Value.ToString());
                    dr.PRODUCT = Convert.ToDouble(PRODUCT.Value.ToString());
                    dr.REFLOID = Convert.ToDouble(REFLOID.Value.ToString());
                    dr.PRICE = Convert.ToDouble(PRICE.Value.ToString());
                    dr.UNIT = Convert.ToDouble(ULOID.Value.ToString());
                    arr.Add(dr);
                }
                ProductStockInShopFlow csFlow = new ProductStockInShopFlow();
                ret = csFlow.InsertStockInitem(Appz.CurrentUserData.UserID, arr);
                if (ret == true)
                {
                    rr = csFlow.UpdateStockIn_GrandTot(Appz.CurrentUserData.UserID, SiArr);
                    return 1;
                }
                else
                {
                    Appz.OpenWarningDialog(csFlow.ErrorMessage);
                    return 0;  
                } 
            }
            else
            {
                if (txtSiiStatus.Text.Trim() == "AP")
                {
                    Appz.OpenWarningDialog("ÃÒ¡ÒùÕé¶Ù¡Â×¹ÂѹáÅéÇ");
                    return 0;
                }                    
                else
                {
                    for (int i = 0; i < cnt; i++)
                    {
                        DataGridViewTextBoxCell SIILOID = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["SIILOID"];
                        DataGridViewTextBoxCell RECEIVE_QTY = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["RECEIVE_QTY"];
                        StockInItemData dr = new StockInItemData();
                        dr.LOID = Convert.ToDouble(SIILOID.Value.ToString());
                        dr.QTY = Convert.ToDouble(RECEIVE_QTY.Value.ToString());
                        arr.Add(dr);
                    }
                    ProductStockInShopFlow csFlow = new ProductStockInShopFlow();

                    ret = csFlow.UpdateTemptable(Appz.CurrentUserData.UserID, arr);
                    if (ret == true)
                    {
                        rr = csFlow.UpdateStockIn_GrandTot(Appz.CurrentUserData.UserID, SiArr);
                        return 2;
                    }  
                    else
                    {
                        Appz.OpenWarningDialog(csFlow.ErrorMessage);
                        return 0;
                    }
                }
            }            
        }
Exemplo n.º 2
0
        private int InsertStockInItem()
        {
            grvReturn.EndEdit();
            ArrayList arr = new ArrayList();
            ArrayList SiArr = new ArrayList();
            bool ret = true;
            bool rr = true;
            double cnt = 0;
            cnt = grvReturn.Rows.Count;
            StockInData sd = new StockInData();
            sd.GRANDTOT = Convert.ToDouble(txtGrandTot.Text.Trim());
            sd.LOID = Convert.ToDouble(_LOID.ToString());
            sd.REASON = txtReason.Text.Trim();
            sd.REMARK = txtRemark.Text.Trim();
            SiArr.Add(sd);
            if (_FLAG == "ADD")
            {
                for (int i = 0; i < cnt; i++)
                {

                    DataGridViewTextBoxCell QTY = (DataGridViewTextBoxCell)grvReturn.Rows[i].Cells["QTY"];
                    DataGridViewTextBoxCell STOCKIN = (DataGridViewTextBoxCell)grvReturn.Rows[i].Cells["SILOID"];
                    DataGridViewTextBoxCell PRODUCT = (DataGridViewTextBoxCell)grvReturn.Rows[i].Cells["PDLOID"];
                    DataGridViewTextBoxCell REFLOID = (DataGridViewTextBoxCell)grvReturn.Rows[i].Cells["RQILOID"];
                    DataGridViewTextBoxCell PRICE = (DataGridViewTextBoxCell)grvReturn.Rows[i].Cells["PRICE"];
                    DataGridViewTextBoxCell ULOID = (DataGridViewTextBoxCell)grvReturn.Rows[i].Cells["ULOID"];

                    StockInItemData dr = new StockInItemData();
                    dr.QTY = Convert.ToDouble(QTY.Value.ToString());
                    dr.STOCKIN = Convert.ToDouble(STOCKIN.Value.ToString());
                    dr.PRODUCT = Convert.ToDouble(PRODUCT.Value.ToString());
                    dr.REFLOID = Convert.ToDouble(REFLOID.Value.ToString());
                    dr.PRICE = Convert.ToDouble(PRICE.Value.ToString());
                    dr.UNIT = Convert.ToDouble(ULOID.Value.ToString());
                    arr.Add(dr);
                }

                ReturnSearchFlow csFlow = new ReturnSearchFlow();
                ret = csFlow.InsertStockInitem(Appz.CurrentUserData.UserID, arr);
                if (ret == true)
                {
                    rr = csFlow.UpdateStockIn_GrandTot(Appz.CurrentUserData.UserID, SiArr);
                    setStatusRequisition("0", "VO");
                    return 1;
                }
                else
                {
                    Appz.OpenWarningDialog(csFlow.ErrorMessage);
                    return 0;
                }
            }
            else
            {
                if (txtSiiStatus.Text.Trim() == "AP")
                {
                    Appz.OpenWarningDialog("ÃÒ¡ÒùÕé¶Ù¡Â×¹ÂѹáÅéÇ");
                    return 0;
                }
                else
                {
                    //¡Ã³Õ update ¨Ó¹Ç¹ÃѺ¤×¹
                //    for (int i = 0; i < cnt; i++)
                //    {
                //        DataGridViewTextBoxCell SIILOID = (DataGridViewTextBoxCell)grvReturn.Rows[i].Cells["SIILOID"];
                //        DataGridViewTextBoxCell QTY = (DataGridViewTextBoxCell)grvReturn.Rows[i].Cells["QTY"];
                //        StockInItemData dr = new StockInItemData();
                //        dr.LOID = Convert.ToDouble(SIILOID.Value.ToString());
                //        dr.QTY = Convert.ToDouble(QTY.Value.ToString());
                //        arr.Add(dr);
                //    }

                //    ReturnSearchFlow csFlow = new ReturnSearchFlow();


                //    ret = csFlow.UpdateTemptable(Appz.CurrentUserData.UserID, arr);
                //    if (ret == true)
                //    {
                //        rr = csFlow.UpdateStockIn_GrandTot(Appz.CurrentUserData.UserID, SiArr);
                //        return 2;
                //    }
                //    else
                //    {
                //        Appz.OpenWarningDialog(csFlow.ErrorMessage);
                        return 0;
                    }
                }
            }
Exemplo n.º 3
0
 private bool VerifyData(StockInItemData data)
 {
     bool ret = true;
     if (data.PRODUCT == 0)
     {
         ret = false;
         _error = "¡ÃسÒÃкØÊÔ¹¤éÒ";
     }
     else if (data.LOTNO == "")
     {
         ret = false;
         _error = "¡ÃسÒàÅ×Í¡ Lot No";
     }
     else if (data.QTY == 0)
     {
         ret = false;
         _error = "¡ÃسÒÃкبӹǹ";
     }
     return ret;
 }
Exemplo n.º 4
0
        public bool InsertStockInItem(string userID,StockInItemData data)
        {
            bool ret = true;
            if (VerifyData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    DALitemObj.GetData(data.STOCKIN, data.PRODUCT, data.REFLOID, data.REFTABLE, obj.zTrans);
                    DALitemObj.LOTNO = data.LOTNO;
                    DALitemObj.PRICE = data.PRICE;
                    DALitemObj.PRODUCT = data.PRODUCT;
                    DALitemObj.REFLOID = data.REFLOID;
                    DALitemObj.REFTABLE = data.REFTABLE;
                    DALitemObj.STATUS = data.STATUS;
                    DALitemObj.STOCKIN = data.STOCKIN;
                    DALitemObj.UNIT = data.UNIT;
                    if (DALitemObj.OnDB)
                    {
                        DALitemObj.QCQTY += data.QTY;
                        ret = DALitemObj.UpdateCurrentData(userID, obj.zTrans);
                    }
                    else
                    {
                        DALitemObj.QTY = data.QTY;
                        ret = DALitemObj.InsertCurrentData(userID, obj.zTrans);
                    }
                    if (!ret) throw new ApplicationException(DALitemObj.ErrorMessage);

                    obj.zTrans.Commit();
                    obj.CloseConnection();
                }
                catch (Exception ex)
                {
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                    ret = false;
                    _error = ex.Message;
                }
            }
            else
                ret = false;
            return ret;
        }
Exemplo n.º 5
0
 private bool VerifyData(StockInItemData data)
 {
     bool ret = true;
     if (data.PRODUCT == 0)
     {
         ret = false;
         _error = "¡ÃسÒÃкØÊÔ¹¤éÒ";
     }
     else if (data.LOTNO == "")
     {
         ret = false;
         _error = "¡ÃسÒàÅ×Í¡ Lot No";
     }
     else if (data.QTY == 0)
     {
         ret = false;
         _error = "¡ÃسÒÃкبӹǹÃѺ";
     }
     else if (data.QCQTY == 0)
     {
         ret = false;
         _error = "¡ÃسÒÃкبӹǹÊè§ QC";
     }
     else if (data.QCQTY > data.QTY)
     {
         _error = "¨Ó¹Ç¹Êè§ QC µéͧäÁèà¡Ô¹¨Ó¹Ç¹ÃѺ";
     }
     return ret;
 }
Exemplo n.º 6
0
 private StockInData GetData()
 {
     StockInData data = new StockInData();
     data.LOID = Convert.ToDouble(this.txtLOID.Text);
     data.CODE = this.txtCode.Text.Trim();
     data.GRANDTOT = Convert.ToDouble(this.txtTotal.Text);
     data.RECEIVEDATE = this.dtpReceiveDate.Value.Date;
     data.RECEIVER = Convert.ToDouble(this.txtReceiver.Text);
     data.REMARK = this.txtRemark.Text.Trim();
     data.SENDER = Convert.ToDouble(this.txtSender.Text);
     data.STATUS = this.txtStatus.Text;
     data.REFTABLE = "REQUISITION";
     data.REFLOID = Convert.ToDouble(this.txtRefLOID.Text);
     data.REASON = this.txtReason.Text.Trim();
     foreach (DataGridViewRow gRow in this.grvStockIn.Rows)
     {
         StockInItemData itemData = new StockInItemData();
         itemData.PRICE = Convert.ToDouble(gRow.Cells[indexPRICE].Value);
         itemData.PRODUCT = Convert.ToDouble(gRow.Cells[indexPRODUCT].Value);
         itemData.QTY = Convert.ToDouble(gRow.Cells[indexQTY].Value);
         itemData.UNIT = Convert.ToDouble(gRow.Cells[indexUNIT].Value);
         itemData.REFLOID = Convert.ToDouble(gRow.Cells[indexREFLOID].Value);
         itemData.REFTABLE = "REQUISITIONITEM";
         data.STOCKINITEM.Add(itemData);
     }
     return data;
 }
Exemplo n.º 7
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (this.pnlMessage.Visible)
        {
            ResetState();
        }
        else
        {
            StockInItemData data = new StockInItemData();
            double number = 0;
            if (Double.TryParse(this.txtQty.Text, out number) && Double.TryParse(this.txtQCQty.Text, out number))
            {
                data.REFTABLE = "POITEM";
                data.REFLOID = Convert.ToDouble(this.txtPOItem.Text == "" ? "0" : this.txtPOItem.Text);
                data.PRICE = Convert.ToDouble(this.txtPrice.Text == "" ? "0" : this.txtPrice.Text);
                data.PRODUCT = Convert.ToDouble(this.txtProduct.Text == "" ? "0" : this.txtProduct.Text);
                data.QTY = Convert.ToDouble(this.txtQty.Text == "" ? "0" : this.txtQty.Text);
                data.QCQTY = Convert.ToDouble(this.txtQCQty.Text == "" ? "0" : this.txtQCQty.Text);
                data.STATUS = Constz.Requisition.Status.Waiting.Code;
                data.STOCKIN = Convert.ToDouble(this.txtLOID.Text);
                data.UNIT = Convert.ToDouble(this.txtUnit.Text == "" ? "0" : this.txtUnit.Text);
                data.LOTNO = this.txtLotNo.Text.Trim();

                if (data.REFLOID != 0)
                {
                    if (FlowObj.InsertStockInItem(Authz.CurrentUserInfo.UserID, data))
                        ResetState();
                    else
                    {
                        this.pnlData.Visible = false;
                        this.ctlToolbar.Visible = false;
                        this.btnCancel.Visible = false;
                        this.pnlMessage.Visible = true;
                        this.lblError.Text = FlowObj.ErrorMessage;
                    }
                }
            }
        }

    }
Exemplo n.º 8
0
        private StockInData GetData()
        {
            StockInData data = new StockInData();
            data.LOID = Convert.ToDouble(this.txtLOID.Text);
            data.CODE = this.txtCode.Text.Trim();
            data.GRANDTOT = Convert.ToDouble(this.txtGrandTot.Text);
            data.RECEIVEDATE = this.dtpReceiveDate.Value.Date;
            data.RECEIVER = Convert.ToDouble(this.txtReceiver.Text);
            data.REMARK = this.txtRemark.Text.Trim();
            data.SENDER = Convert.ToDouble(this.txtSender.Text);
            data.STATUS = this.txtStatus.Text;
            data.REFCODE = this.txtRequisitionCode.Text.Trim();
            data.GRANDTOT = Convert.ToDouble(this.txtGrandTot.Text == "" ? "0" : this.txtGrandTot.Text);

            foreach (DataGridViewRow gRow in this.grvStockin.Rows)
            {
                StockInItemData itemData = new StockInItemData();
                if (!gRow.IsNewRow) 
                {
                    itemData.PRICE = Convert.ToDouble(gRow.Cells[indexPRICE].Value);
                    itemData.PRODUCT = Convert.ToDouble(gRow.Cells[indexPRODUCT].Value);
                    itemData.QTY = Convert.ToDouble(gRow.Cells[indexQTY].Value);
                    itemData.UNIT = Convert.ToDouble(gRow.Cells[indexUNIT].Value);
                    data.STOCKINITEM.Add(itemData);
                }
            }

            return data;
        }
Exemplo n.º 9
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (this.pnlMessage.Visible)
            ResetState();
        else
        {
            try
            {
                StockInItemData data = new StockInItemData();
                if (this.cmbLotNo.SelectedValue != "")
                {
                    data.REFTABLE = "PDPRODUCT";
                    data.REFLOID = Convert.ToDouble(this.cmbLotNo.SelectedItem.Value);
                    data.LOTNO = this.cmbLotNo.SelectedItem.Text;
                }
                data.PRICE = Convert.ToDouble(this.txtPrice.Text == "" ? "0" : this.txtPrice.Text);
                data.PRODUCT = Convert.ToDouble(this.txtProduct.Text);
                data.QTY = Convert.ToDouble(this.txtQty.Text == "" ? "0" : this.txtQty.Text);
                data.STATUS = Constz.Requisition.Status.Waiting.Code;
                data.STOCKIN = Convert.ToDouble(this.txtLOID.Text);
                data.UNIT = Convert.ToDouble(this.txtUnit.Text == "" ? "0 " : this.txtUnit.Text);

                if (FlowObj.InsertStockInItem(Authz.CurrentUserInfo.UserID, data))
                    ResetState();
                else
                    setError(FlowObj.ErrorMessage);
            }
            catch (InvalidCastException ex)
            {
                setError(ex.Message);
            }

        }

    }