private void grid_CellEndEdit(object sender, DataGridViewCellEventArgs e) { conDataGridView grd = (conDataGridView)sender; DataGridViewCell cell = grd[e.ColumnIndex, e.RowIndex]; //cell.Style.BackColor = Color.White; if (grd.Columns[e.ColumnIndex].ToolTipText.IndexOf("수량") >= 0 || grd.Columns[e.ColumnIndex].ToolTipText.IndexOf("단가") >= 0 || grd.Columns[e.ColumnIndex].ToolTipText.IndexOf("금액") >= 0) { string total_amt = (string)grd.Rows[e.RowIndex].Cells["TOTAL_AMT"].Value; string price = (string)grd.Rows[e.RowIndex].Cells["PRICE"].Value; if (total_amt != null) { total_amt = total_amt.ToString().Replace(" ", ""); if (total_amt == "") { grd.Rows[e.RowIndex].Cells["TOTAL_AMT"].Value = "0"; } } else { grd.Rows[e.RowIndex].Cells["TOTAL_AMT"].Value = "0"; } if (price != null) { price = price.ToString().Replace(" ", ""); if (price == "") { grd.Rows[e.RowIndex].Cells["PRICE"].Value = "0"; } } else { grd.Rows[e.RowIndex].Cells["PRICE"].Value = "0"; } wConst.f_Calc_Price(grd, e.RowIndex, "TOTAL_AMT", "PRICE"); } }
private void rs_order_grid_CellEndEdit(object sender, DataGridViewCellEventArgs e) { DataGridView grd = (DataGridView)sender; if (grd.Columns[e.ColumnIndex].ToolTipText.IndexOf("발주량") >= 0) { string rs_amt = (string)grd.Rows[e.RowIndex].Cells["RS_AMT"].Value; if (rs_amt != null) { rs_amt = rs_amt.ToString().Replace(" ", ""); if (rs_amt == "") { grd.Rows[e.RowIndex].Cells["RS_AMT"].Value = "0"; } } else { grd.Rows[e.RowIndex].Cells["RS_AMT"].Value = "0"; } } wConst.f_Calc_Price(grd, e.RowIndex, "RS_AMT", "PRICE"); }
private void btn_move_Click(object sender, EventArgs e) { if (dgv배송완료.Rows.Count > 0) { int chk = 0; for (int i = 0; i < dgv배송완료.Rows.Count; i++) { if ((bool)dgv배송완료.Rows[i].Cells["CHK"].Value == true) { for (int j = 0; j < itemOutGrid.Rows.Count; j++) { if ((string)dgv배송완료.Rows[i].Cells["LOT_NO"].Value == (string)itemOutGrid.Rows[j].Cells["O_LOT_NO"].Value && (string)dgv배송완료.Rows[i].Cells["LOT_SUB"].Value == (string)itemOutGrid.Rows[j].Cells["O_LOT_SUB"].Value) { MessageBox.Show("해당 출고할 제품이 이미 등록되어있습니다."); return; } } for (int k = 0; k < del_outGrid.Rows.Count; k++) { if ((string)dgv배송완료.Rows[i].Cells["LOT_NO"].Value == (string)del_outGrid.Rows[k]["LOT_NO"].ToString() && (string)dgv배송완료.Rows[i].Cells["LOT_SUB"].Value == (string)del_outGrid.Rows[k]["LOT_SUB"].ToString()) { MessageBox.Show("해당 제품출고의 삭제데이터가 있어서 등록이 불가합니다."); return; } } itemOutGrid.Rows.Add(); int rowNum = itemOutGrid.Rows.Count - 1; txt_cust_nm.Text = (String)dgv배송완료.Rows[i].Cells["납품처"].Value; txt_cust_cd.Text = (String)dgv배송완료.Rows[i].Cells["납품처코드"].Value; itemOutGrid.Rows[rowNum].Cells["O_LOT_NO"].Value = dgv배송완료.Rows[i].Cells["LOT_NO"].Value; itemOutGrid.Rows[rowNum].Cells["O_LOT_SUB"].Value = dgv배송완료.Rows[i].Cells["LOT_SUB"].Value; itemOutGrid.Rows[rowNum].Cells["O_ITEM_CD"].Value = dgv배송완료.Rows[i].Cells["ITEM_CD"].Value; itemOutGrid.Rows[rowNum].Cells["O_ITEM_NM"].Value = dgv배송완료.Rows[i].Cells["ITEM_NM"].Value; itemOutGrid.Rows[rowNum].Cells["OUTPUT_AMT"].Value = dgv배송완료.Rows[i].Cells["STOCK_AMT"].Value; itemOutGrid.Rows[rowNum].Cells["O_SPEC"].Value = dgv배송완료.Rows[i].Cells["SPEC"].Value; itemOutGrid.Rows[rowNum].Cells["PRICE"].Value = dgv배송완료.Rows[i].Cells["OUTPUT_PRICE"].Value; itemOutGrid.Rows[rowNum].Cells["O_UNIT_CD"].Value = dgv배송완료.Rows[i].Cells["UNIT_CD"].Value; itemOutGrid.Rows[rowNum].Cells["O_UNIT_NM"].Value = dgv배송완료.Rows[i].Cells["UNIT_NM"].Value; itemOutGrid.Rows[rowNum].Cells["OLD_OUT_AMT"].Value = dgv배송완료.Rows[i].Cells["STOCK_AMT"].Value; double total_money = double.Parse(dgv배송완료.Rows[i].Cells["STOCK_AMT"].Value.ToString()) * double.Parse(dgv배송완료.Rows[i].Cells["OUTPUT_PRICE"].Value.ToString()); itemOutGrid.Rows[rowNum].Cells["TOTAL_MONEY"].Value = total_money.ToString("#,0.###"); itemOutGrid.Rows[rowNum].Cells["O_INPUT_DATE"].Value = dgv배송완료.Rows[i].Cells["INPUT_DATE"].Value; itemOutGrid.Rows[rowNum].Cells["O_INPUT_CD"].Value = dgv배송완료.Rows[i].Cells["INPUT_CD"].Value; itemOutGrid.Rows[rowNum].Cells["O_CUST_CD"].Value = txt_cust_cd.Text.ToString(); itemOutGrid.Rows[rowNum].Cells["O_TAX_CD"].Value = dgv배송완료.Rows[i].Cells["TAX_CD"].Value; itemOutGrid.Rows[rowNum].Cells["O_LINK_CD"].Value = dgv배송완료.Rows[i].Cells["LINK_CD"].Value; chk = 1; wConst.f_Calc_Price(itemOutGrid, rowNum, "OUTPUT_AMT", "PRICE"); itemOutGrid.Focus(); dgv배송완료.Rows[i].Visible = false; dgv배송완료.Rows[i].Cells["CHK"].Value = false; } } if (chk == 0) { MessageBox.Show("발주서의 원자재를 선택하십시기 바랍니다."); } } else { MessageBox.Show("입고 데이터가 없습니다."); } }
private void popupLogic(object sender, DataGridViewCellEventArgs e) { conDataGridView grd = (conDataGridView)sender; DataGridViewCell cell = grd[e.ColumnIndex, e.RowIndex]; cell.Style.BackColor = Color.White; #region 공통 그리드 체크 if (grd.Columns[e.ColumnIndex].ToolTipText.IndexOf("명칭") >= 0 && grd._KeyInput == "enter") { string rat_mat_nm = (string)grd.Rows[e.RowIndex].Cells["RAW_MAT_NM"].Value; wnDm wDm = new wnDm(); DataTable dt = new DataTable(); StringBuilder sb = new StringBuilder(); sb.AppendLine("where RAW_MAT_NM like '%" + rat_mat_nm + "%' "); if (chk구매처.Checked == true) { sb.AppendLine(" and cust_cd = '" + txt_cust_cd.Text + "' "); } dt = wDm.fn_Raw_List(sb.ToString(), "1"); if (dt.Rows.Count > 1) { //row가 2줄이 넘을 경우 팝업으로 넘어간다. wConst.call_pop_raw_mat(grd, dt, e.RowIndex, rat_mat_nm, 2, txt_cust_cd.Text); //orderGridAdd(); } else if (dt.Rows.Count == 1) //row가 1일 경우 해당 row에 값을 자동 입력한다. { grd.Rows[e.RowIndex].Cells["RAW_MAT_CD"].Value = dt.Rows[0]["RAW_MAT_CD"].ToString(); grd.Rows[e.RowIndex].Cells["RAW_MAT_NM"].Value = dt.Rows[0]["RAW_MAT_NM"].ToString(); grd.Rows[e.RowIndex].Cells["OLD_RAW_MAT_NM"].Value = dt.Rows[0]["RAW_MAT_NM"].ToString(); grd.Rows[e.RowIndex].Cells["SPEC"].Value = dt.Rows[0]["SPEC"].ToString(); grd.Rows[e.RowIndex].Cells["UNIT_CD"].Value = dt.Rows[0]["INPUT_UNIT"].ToString(); grd.Rows[e.RowIndex].Cells["UNIT_NM"].Value = dt.Rows[0]["INPUT_UNIT_NM"].ToString(); grd.Rows[e.RowIndex].Cells["PRICE"].Value = dt.Rows[0]["INPUT_PRICE"].ToString(); if (rmOrderGrid.Rows[rmOrderGrid.Rows.Count - 1].Cells[2].Value != null) { orderGridAdd(); } } else { //row가 없는 경우 MessageBox.Show("데이터가 없습니다."); rmOrderGrid.Rows.RemoveAt(rmOrderGrid.SelectedRows[0].Index); rmOrderGrid.CurrentCell = rmOrderGrid[2, rmOrderGrid.Rows.Count]; //minus_logic(rmOrderGrid); } wConst.f_Calc_Price(grd, e.RowIndex, "TOTAL_AMT", "PRICE"); } if (grd.Columns[e.ColumnIndex].ToolTipText.IndexOf("수량") >= 0 || grd.Columns[e.ColumnIndex].ToolTipText.IndexOf("단가") >= 0 || grd.Columns[e.ColumnIndex].ToolTipText.IndexOf("금액") >= 0) { string total_amt = (string)grd.Rows[e.RowIndex].Cells["TOTAL_AMT"].Value; string input_price = (string)grd.Rows[e.RowIndex].Cells["PRICE"].Value; if (total_amt != null) { total_amt = total_amt.ToString().Replace(" ", ""); if (total_amt == "") { grd.Rows[e.RowIndex].Cells["TOTAL_AMT"].Value = "0"; } } else { grd.Rows[e.RowIndex].Cells["TOTAL_AMT"].Value = "0"; } if (input_price != null) { input_price = input_price.ToString().Replace(" ", ""); if (input_price == "") { grd.Rows[e.RowIndex].Cells["PRICE"].Value = "0"; } } else { grd.Rows[e.RowIndex].Cells["PRICE"].Value = "0"; } wConst.f_Calc_Price(grd, e.RowIndex, "TOTAL_AMT", "PRICE"); } #endregion 공통 그리드 체크 //string sSearchTxt = "" + (string)grd.Rows[e.RowIndex].Cells[e.ColumnIndex].Value; }
private void grid_CellEndEdit(object sender, DataGridViewCellEventArgs e) { conDataGridView grd = (conDataGridView)sender; DataGridViewCell cell = grd[e.ColumnIndex, e.RowIndex]; cell.Style.BackColor = Color.White; #region 공통 그리드 체크 if (grd.Columns[e.ColumnIndex].ToolTipText.IndexOf("명칭") >= 0 && grd._KeyInput == "enter") { string item_nm = (string)grd.Rows[e.RowIndex].Cells["ITEM_NM"].Value; wnDm wDm = new wnDm(); DataTable dt = new DataTable(); dt = wDm.fn_Raw_Item_List("where A.RAW_MAT_NM like '%" + item_nm + "%' ", "where B.ITEM_NM like '%" + item_nm + "%' "); if (dt.Rows.Count > 0) { //row가 2줄이 넘을 경우 팝업으로 넘어간다. string sResult = wConst.CZM_call_pop_raw_and_item(grd, dt, e.RowIndex, item_nm); } else { //row가 없는 경우 string sResult = wConst.CZM_call_pop_raw_and_item(grd, dt, e.RowIndex, item_nm); } wConst.f_Calc_Price(grd, e.RowIndex, "TOTAL_AMT", "PRICE"); } if (grd.Columns[e.ColumnIndex].ToolTipText.IndexOf("수량") >= 0 || grd.Columns[e.ColumnIndex].ToolTipText.IndexOf("단가") >= 0 || grd.Columns[e.ColumnIndex].ToolTipText.IndexOf("금액") >= 0) { string total_amt = (string)grd.Rows[e.RowIndex].Cells["TOTAL_AMT"].Value; string price = (string)grd.Rows[e.RowIndex].Cells["PRICE"].Value; if (total_amt != null) { total_amt = total_amt.ToString().Replace(" ", ""); if (total_amt == "") { grd.Rows[e.RowIndex].Cells["TOTAL_AMT"].Value = "0"; } } else { grd.Rows[e.RowIndex].Cells["TOTAL_AMT"].Value = "0"; } if (price != null) { price = price.ToString().Replace(" ", ""); if (price == "") { grd.Rows[e.RowIndex].Cells["PRICE"].Value = "0"; } } else { grd.Rows[e.RowIndex].Cells["PRICE"].Value = "0"; } //if (total_amt == "" || total_amt == null) //{ // grd.Rows[e.RowIndex].Cells["TOTAL_AMT"].Value = "0"; //} //if (price == "" || price == null) //{ // grd.Rows[e.RowIndex].Cells["PRICE"].Value = "0"; //} wConst.f_Calc_Price(grd, e.RowIndex, "TOTAL_AMT", "PRICE"); string item_cd_chk = (string)grd.Rows[e.RowIndex].Cells["ITEM_CD"].Value; } #endregion 공통 그리드 체크 //string sSearchTxt = "" + (string)grd.Rows[e.RowIndex].Cells[e.ColumnIndex].Value; }
private void btn_move_Click(object sender, EventArgs e) { if (itemStockGrid.Rows.Count > 0) { if (chk_self_yn.Checked == true) { MessageBox.Show("자체출고가 체크되어 출고를 할 수 없습니다."); return; } int chk = 0; for (int i = 0; i < itemStockGrid.Rows.Count; i++) { if ((bool)itemStockGrid.Rows[i].Cells["CHK"].Value == true) { for (int j = 0; j < itemOutGrid.Rows.Count; j++) { if ((string)itemStockGrid.Rows[i].Cells["LOT_NO"].Value == (string)itemOutGrid.Rows[j].Cells["O_LOT_NO"].Value && (string)itemStockGrid.Rows[i].Cells["LOT_SUB"].Value == (string)itemOutGrid.Rows[j].Cells["O_LOT_SUB"].Value) { MessageBox.Show("해당 출고할 제품이 이미 등록되어있습니다."); return; } } for (int k = 0; k < del_outGrid.Rows.Count; k++) { if ((string)itemStockGrid.Rows[i].Cells["LOT_NO"].Value == (string)del_outGrid.Rows[k].Cells["O_LOT_NO"].Value && (string)itemStockGrid.Rows[i].Cells["LOT_SUB"].Value == (string)del_outGrid.Rows[k].Cells["O_LOT_SUB"].Value) { MessageBox.Show("해당 제품출고의 삭제데이터가 있어서 등록이 불가합니다."); return; } } itemOutGrid.Rows.Add(); int rowNum = itemOutGrid.Rows.Count - 1; itemOutGrid.Rows[rowNum].Cells["O_LOT_NO"].Value = itemStockGrid.Rows[i].Cells["LOT_NO"].Value; itemOutGrid.Rows[rowNum].Cells["O_LOT_SUB"].Value = itemStockGrid.Rows[i].Cells["LOT_SUB"].Value; itemOutGrid.Rows[rowNum].Cells["O_ITEM_CD"].Value = itemStockGrid.Rows[i].Cells["ITEM_CD"].Value; itemOutGrid.Rows[rowNum].Cells["O_ITEM_NM"].Value = itemStockGrid.Rows[i].Cells["ITEM_NM"].Value; itemOutGrid.Rows[rowNum].Cells["OUTPUT_AMT"].Value = itemStockGrid.Rows[i].Cells["STOCK_AMT"].Value; itemOutGrid.Rows[rowNum].Cells["O_SPEC"].Value = itemStockGrid.Rows[i].Cells["SPEC"].Value; itemOutGrid.Rows[rowNum].Cells["PRICE"].Value = itemStockGrid.Rows[i].Cells["OUTPUT_PRICE"].Value; itemOutGrid.Rows[rowNum].Cells["O_UNIT_CD"].Value = itemStockGrid.Rows[i].Cells["UNIT_CD"].Value; itemOutGrid.Rows[rowNum].Cells["O_UNIT_NM"].Value = itemStockGrid.Rows[i].Cells["UNIT_NM"].Value; itemOutGrid.Rows[rowNum].Cells["OLD_OUT_AMT"].Value = itemStockGrid.Rows[i].Cells["STOCK_AMT"].Value; double total_money = double.Parse(itemStockGrid.Rows[i].Cells["STOCK_AMT"].Value.ToString()) * double.Parse(itemStockGrid.Rows[i].Cells["OUTPUT_PRICE"].Value.ToString()); itemOutGrid.Rows[rowNum].Cells["TOTAL_MONEY"].Value = total_money.ToString("#,0.######"); itemOutGrid.Rows[rowNum].Cells["O_INPUT_DATE"].Value = itemStockGrid.Rows[i].Cells["INPUT_DATE"].Value; itemOutGrid.Rows[rowNum].Cells["O_INPUT_CD"].Value = itemStockGrid.Rows[i].Cells["INPUT_CD"].Value; itemOutGrid.Rows[rowNum].Cells["O_CUST_CD"].Value = itemStockGrid.Rows[i].Cells["CUST_CD"].Value; itemOutGrid.Rows[rowNum].Cells["O_CUST_NM"].Value = itemStockGrid.Rows[i].Cells["CUST_NM"].Value; itemOutGrid.Rows[rowNum].Cells["O_BTN_OUT"].Value = "등록"; chk = 1; wConst.f_Calc_Price(itemOutGrid, rowNum, "OUTPUT_AMT", "PRICE"); } } if (chk == 0) { MessageBox.Show("발주서의 원부재료를 선택하십시기 바랍니다."); } } else { MessageBox.Show("입고 데이터가 없습니다."); } }
private void grid_CellEndEdit(object sender, DataGridViewCellEventArgs e) { conDataGridView grd = (conDataGridView)sender; DataGridViewCell cell = grd[e.ColumnIndex, e.RowIndex]; cell.Style.BackColor = Color.White; if (grd.Columns[e.ColumnIndex].ToolTipText.IndexOf("명칭") >= 0 && grd._KeyInput == "enter") { string item_nm = (string)grd.Rows[e.RowIndex].Cells["ITEM_NM"].Value; wnDm wDm = new wnDm(); DataTable dt = new DataTable(); String sqlcontion = ""; if (txt_cust_cd.Text != "" & Common.p_saupNo == "1278113487") { sqlcontion += "and A.cust_CD = '" + txt_cust_cd.Text + "'"; } else { txt_cust_cd.Tag = "NOT매출제품"; } dt = wDm.fn_Item_List("where ITEM_NM like '%" + item_nm + "%' " + sqlcontion, txt_cust_cd.Text.ToString()); if (dt.Rows.Count > 1) { //row가 2줄이 넘을 경우 팝업으로 넘어간다. string sResult = wConst.call_pop_item2(grd, dt, e.RowIndex, item_nm, txt_cust_cd.Text); if (sResult != "") { } //itemPlanGridAdd(); itemJumunGridAdd(); } else if (dt.Rows.Count == 1) //row가 1일 경우 해당 row에 값을 자동 입력한다. { grd.Rows[e.RowIndex].Cells["ITEM_NM"].Value = dt.Rows[0]["ITEM_NM"].ToString(); grd.Rows[e.RowIndex].Cells["ITEM_CD"].Value = dt.Rows[0]["ITEM_CD"].ToString(); grd.Rows[e.RowIndex].Cells["SPEC"].Value = dt.Rows[0]["SPEC"].ToString(); grd.Rows[e.RowIndex].Cells["UNIT_CD"].Value = dt.Rows[0]["UNIT_CD"].ToString(); grd.Rows[e.RowIndex].Cells["UNIT_NM"].Value = dt.Rows[0]["UNIT_NM"].ToString(); grd.Rows[e.RowIndex].Cells["TOTAL_AMT"].Value = "1"; grd.Rows[e.RowIndex].Cells["UNIT_AMT"].Value = "1"; grd.Rows[e.RowIndex].Cells["PRICE"].Value = dt.Rows[0]["OUTPUT_PRICE"].ToString(); itemJumunGridAdd(); } else { //row가 없는 경우 MessageBox.Show("데이터가 없습니다."); itemJumunGrid.Rows.RemoveAt(itemJumunGrid.SelectedRows[0].Index); itemJumunGrid.CurrentCell = itemJumunGrid[2, itemJumunGrid.Rows.Count]; } wConst.f_Calc_Price(grd, e.RowIndex, "TOTAL_AMT", "PRICE"); } if (grd.Columns[e.ColumnIndex].ToolTipText.IndexOf("수량") >= 0 || grd.Columns[e.ColumnIndex].ToolTipText.IndexOf("단가") >= 0 || grd.Columns[e.ColumnIndex].ToolTipText.IndexOf("금액") >= 0) { string total_amt = (string)grd.Rows[e.RowIndex].Cells["TOTAL_AMT"].Value; string price = (string)grd.Rows[e.RowIndex].Cells["PRICE"].Value; if (total_amt != null) { total_amt = total_amt.ToString().Replace(" ", ""); if (total_amt == "") { grd.Rows[e.RowIndex].Cells["TOTAL_AMT"].Value = "0"; } } else { grd.Rows[e.RowIndex].Cells["TOTAL_AMT"].Value = "0"; } if (price != null) { price = price.ToString().Replace(" ", ""); if (price == "") { grd.Rows[e.RowIndex].Cells["PRICE"].Value = "0"; } } else { grd.Rows[e.RowIndex].Cells["PRICE"].Value = "0"; } //if (total_amt == "" || total_amt == null) //{ // grd.Rows[e.RowIndex].Cells["TOTAL_AMT"].Value = "0"; //} //if (price == "" || price == null) //{ // grd.Rows[e.RowIndex].Cells["PRICE"].Value = "0"; //} wConst.f_Calc_Price(grd, e.RowIndex, "TOTAL_AMT", "PRICE"); } }