private bool SetApprove() { bool ret = true; ArrayList arrLOID = new ArrayList(); for (int i = 0; i < grvProductStockInShop.Rows.Count; i++) { arrLOID.Add(grvProductStockInShop.Rows[i].Cells["SILOID"].Value.ToString()); } ProductStockInShopFlow csFlow = new ProductStockInShopFlow(); if (txtSiiStatus.Text.Trim () != "") ret = csFlow.UpdateStockInData(Appz.CurrentUserData.UserID, arrLOID); else ret = csFlow.UpdateStockInApproveData(Appz.CurrentUserData.UserID, arrLOID); if (ret == false) Appz.OpenWarningDialog(csFlow.ErrorMessage); return ret; }
private void btnBack_Click(object sender, EventArgs e) { int cnt = -1; bool ret = true ; if (Appz.OpenQuestionDialog("µéͧ¡ÒáÅѺ˹éÒ¨ÍËÅÑ¡ãªèËÃ×ÍäÁè?") == DialogResult.OK ) { cnt = ProductStockInShopFlow.CheckStockInitemData(_LOID.ToString()); if (cnt == 0) { ProductStockInShopFlow PdFlow = new ProductStockInShopFlow(); ret = PdFlow.DeleteStockInData(_LOID.ToString()); } this.Close(); } }
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; } } } }
private int InsertStockInItem() { grvProductStockInShop.EndEdit(); ArrayList arr = new ArrayList(); bool ret = true; double cnt = 0; cnt = grvProductStockInShop.Rows.Count; 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"]; 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()); arr.Add(dr); } ProductStockInShopFlow csFlow = new ProductStockInShopFlow(); ret = csFlow.InsertStockInitem(Appz.CurrentUserData.UserID, arr); if (ret == true) { //Appz.OpenInformationDialog("ºÑ¹·Ö¡ÃÒ¡ÒÃàÃÕºÃéÍÂ"); 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) return 2; else Appz.OpenWarningDialog(csFlow.ErrorMessage); return 0; } } }
private void btnApprove_Click(object sender, EventArgs e) { bool ret = true; for (int i = 0; i < grvPDSearchInShop.Rows.Count ; i++) { DataGridViewTextBoxCell SISTATUS = (DataGridViewTextBoxCell)grvPDSearchInShop.Rows[i].Cells["SISTATUS"]; if (SISTATUS.Value.ToString() == "AP") { Appz.OpenWarningDialog("ÃÒ¡ÒùÕé¶Ù¡Â×¹ÂѹáÅéÇ"); return; } } if (Appz.OpenQuestionDialog("µéͧ¡ÒÃÂ×¹ÂѹÃѺà¢éÒ¤ÅѧËÃ×ÍäÁè?") == DialogResult.OK) { ArrayList arrLOID = new ArrayList(); for (int i = 0; i < grvPDSearchInShop.Rows.Count; i++) { DataGridViewCheckBoxCell maCell = (DataGridViewCheckBoxCell)this.grvPDSearchInShop.Rows[i].Cells["CHKAPPROVE"]; if (maCell.FormattedValue.Equals(true)) { arrLOID.Add(grvPDSearchInShop.Rows[i].Cells["LOID"].Value.ToString()); } } ProductStockInShopFlow csFlow = new ProductStockInShopFlow(); ret = csFlow.UpdateStockInData(Appz.CurrentUserData.UserID, arrLOID); if (ret == true) Appz.OpenInformationDialog("ºÑ¹·Ö¡ÃÒ¡ÒÃàÃÕºÃéÍÂ"); else Appz.OpenWarningDialog(csFlow.ErrorMessage); LoadData(); } }
private void btnDelete_Click(object sender, EventArgs e) { bool ret = true; if (Appz.OpenQuestionDialog("µéͧ¡ÒÃźÃÒ¡ÒÃãªèËÃ×ÍäÁè?") == DialogResult.OK) { ArrayList arrLOID = new ArrayList(); for (int i = 0; i < grvPDSearchInShop.Rows.Count; i++) { DataGridViewCheckBoxCell maCell = (DataGridViewCheckBoxCell)this.grvPDSearchInShop.Rows[i].Cells["CHKAPPROVE"]; if (maCell.FormattedValue.Equals(true)) { arrLOID.Add(grvPDSearchInShop.Rows[i].Cells["LOID"].Value.ToString()); } } ProductStockInShopFlow csFlow = new ProductStockInShopFlow(); ret = csFlow.DeleteStockIn_StockInitemData(Appz.CurrentUserData.UserID, arrLOID); if (ret == true) Appz.OpenInformationDialog("źÃÒ¡ÒÃàÃÕºÃéÍÂ"); else Appz.OpenWarningDialog(csFlow.ErrorMessage); LoadData(); } }
private void btnNew_Click(object sender, EventArgs e) { if (Appz.OpenQuestionDialog("µéͧ¡ÒÃÊÃéÒ§ÃÒ¡ÒÃãËÁèãªèËÃ×ÍäÁè") == DialogResult.OK ) { ProductStockInShopFlow csFlow = new ProductStockInShopFlow(); StockInData csData = new StockInData(); csData.SENDER = Appz.CurrentUserData.Warehouse; //csData.RECEIVER = Appz.CurrentUserData.Warehouse; double loid ; //insert STockin loid = csFlow.InsertStockIn(Appz.CurrentUserData.UserID.ToString(),csData ); if (loid == 0) MessageBox.Show(csFlow.ErrorMessage); else Openfrm(loid,"ADD"); LoadData(); } }