private void RecordTSB_Click(object sender, EventArgs e) { GStrCode = ""; frmgrnSearch f = new frmgrnSearch(); GlobalVariables.GCode = "PROCESS"; f.AddItemCallback = new frmgrnSearch.AddPurchaseDelegate(this.SetPurchaseCallBack); f.ShowDialog(); if (GStrCode != "") { DataSet dsHeader = new ginCRUD().getData(GStrCode); txtGRNNO.Text = GStrCode; dateCreated.Value = (DateTime)dsHeader.Tables[0].Rows[0]["DATE"]; cbDIV.SelectedValue = dsHeader.Tables[0].Rows[0]["GDIV"]; txtCustomerID.Text = dsHeader.Tables[0].Rows[0]["CUSTVENDCODE"].ToString(); txtAddress.Text = Convert.ToString(dsHeader.Tables[0].Rows[0]["DELIVERYTOADDRESS"]); txtRefer.Text = Convert.ToString(dsHeader.Tables[0].Rows[0]["DELIVERYTONAME"]); //txtStyleID.Text = dsHeader.Tables[0].Rows[0]["STYLEID"].ToString(); txtRemarks.Text = dsHeader.Tables[0].Rows[0]["REMARKS"].ToString(); cbJENIS.Text = dsHeader.Tables[0].Rows[0]["TYPE"].ToString(); cbStore.Text = dsHeader.Tables[0].Rows[0]["STOREID"].ToString(); //load detail DataSet dsDetail = new gindetailCRUD().getData(GStrCode); dtGrid.Rows.Clear(); for (int i = 0; i < dsDetail.Tables[0].Rows.Count; i++) { GlobalVariables.GID = GlobalVariables.GID + 1; dtGrid.Rows.Add(); dtGrid.Rows[i].HeaderCell.Value = "V"; //key dtGrid.Rows[i].Cells["hGINNO1"].Value = dsDetail.Tables[0].Rows[i]["GINNO"].ToString(); dtGrid.Rows[i].Cells["hID1"].Value = dsDetail.Tables[0].Rows[i]["ID"].ToString(); //end key dtGrid.Rows[i].Cells["hGINNO"].Value = dsDetail.Tables[0].Rows[i]["GINNO"].ToString(); dtGrid.Rows[i].Cells["hID"].Value = dsDetail.Tables[0].Rows[i]["ID"].ToString(); dtGrid.Rows[i].Cells["hItemsID"].Value = dsDetail.Tables[0].Rows[i]["ITEMSID"].ToString(); dtGrid.Rows[i].Cells["hDescription"].Value = dsDetail.Tables[0].Rows[i]["DESCRIPTION"].ToString(); dtGrid.Rows[i].Cells["hJenis"].Value = dsDetail.Tables[0].Rows[i]["JENIS"].ToString(); dtGrid.Rows[i].Cells["hColorID"].Value = dsDetail.Tables[0].Rows[i]["COLORID"].ToString(); dtGrid.Rows[i].Cells["hSizeID"].Value = dsDetail.Tables[0].Rows[i]["SIZEID"].ToString(); dtGrid.Rows[i].Cells["hGrade"].Value = DBNull.Value.Equals(dsDetail.Tables[0].Rows[i]["GRADE"]) ? null : dsDetail.Tables[0].Rows[i]["GRADE"].ToString(); dtGrid.Rows[i].Cells["hStyleID"].Value = dsDetail.Tables[0].Rows[i]["STYLEID"].ToString(); // dtGrid.Rows[i].Cells["hPONO"].Value = dsDetail.Tables[0].Rows[i]["PONO"].ToString(); dtGrid.Rows[i].Cells["hQuantity"].Value = dsDetail.Tables[0].Rows[i]["QUANTITY"].ToString(); dtGrid.Rows[i].Cells["hUOM"].Value = dsDetail.Tables[0].Rows[i]["UOM"].ToString(); dtGrid.Rows[i].Cells["hGRNNO"].Value = dsDetail.Tables[0].Rows[i]["GRNNO"].ToString(); } SimpanTSB.Enabled = false; UbahTSB.Enabled = true; dtGrid.Enabled = true; } }
private void RecordTSB_Click(object sender, EventArgs e) { GStrCode = ""; frmgrnSearch f = new frmgrnSearch(); GlobalVariables.GCode = "PRODUCT"; f.AddItemCallback = new frmgrnSearch.AddPurchaseDelegate(this.SetPurchaseCallBack); f.ShowDialog(); //txtCostingNo.Text if (GStrCode != "") { //load header //GRNNO,DATE,OFFICER,GDIV,RECEIVEFROM,REMARKS,STOREID,PONO,CUSTVENDCODE,REFFNO,APPROVE,APPROVEDATE,APPROVEBY, //CLOSE,STYLEID,COLORID,DOCREGNO,JENIS, DataSet dsHeader = new grnCRUD().getData(GStrCode); txtGRNNO.Text = GStrCode; dateCreated.Value = (DateTime)dsHeader.Tables[0].Rows[0]["DATE"]; cbDIV.SelectedValue = dsHeader.Tables[0].Rows[0]["GDIV"]; //RECEIVEFROM di hilangkan txtRemarks.Text = dsHeader.Tables[0].Rows[0]["REMARKS"].ToString(); txtCustomerID.Text = dsHeader.Tables[0].Rows[0]["CUSTVENDCODE"].ToString(); txtRefer.Text = dsHeader.Tables[0].Rows[0]["REFFNO"].ToString(); txtJONO.Text = dsHeader.Tables[0].Rows[0]["PONO"].ToString(); cbJENIS.Text = dsHeader.Tables[0].Rows[0]["JENIS"].ToString(); cbStore.Text = dsHeader.Tables[0].Rows[0]["STOREID"].ToString(); //load detail DataSet dsDetail = new grndetailCRUD().getData(GStrCode); dtGrid.Rows.Clear(); for (int i = 0; i < dsDetail.Tables[0].Rows.Count; i++) { GlobalVariables.GID = GlobalVariables.GID + 1; // ID,ITEMSID,DESCRIPTION,JENIS,COLORID,SIZEID,GRADE,COSTINGNO,STYLEID,PONO,QUANTITY,UOM, //PRICE,CURRENCYID,KURS,REMARKS,QTYPURCHASE,PRICEPURCHASE,UOMPURCHASE, dtGrid.Rows.Add(); dtGrid.Rows[i].HeaderCell.Value = "V"; //key dtGrid.Rows[i].Cells["hGRNNo1"].Value = dsDetail.Tables[0].Rows[i]["GRNNO"].ToString(); dtGrid.Rows[i].Cells["hID1"].Value = dsDetail.Tables[0].Rows[i]["ID"].ToString(); //end key dtGrid.Rows[i].Cells["hGRNNo"].Value = dsDetail.Tables[0].Rows[i]["GRNNO"].ToString(); dtGrid.Rows[i].Cells["hID"].Value = dsDetail.Tables[0].Rows[i]["ID"].ToString(); dtGrid.Rows[i].Cells["hItemsID"].Value = dsDetail.Tables[0].Rows[i]["ITEMSID"].ToString(); dtGrid.Rows[i].Cells["hDescription"].Value = dsDetail.Tables[0].Rows[i]["DESCRIPTION"].ToString(); dtGrid.Rows[i].Cells["hJenis"].Value = dsDetail.Tables[0].Rows[i]["JENIS"].ToString(); dtGrid.Rows[i].Cells["hColorID"].Value = dsDetail.Tables[0].Rows[i]["COLORID"].ToString(); dtGrid.Rows[i].Cells["hSizeID"].Value = dsDetail.Tables[0].Rows[i]["SIZEID"].ToString(); //if (row[col] == DBNull.Value) dtGrid.Rows[i].Cells["hGrade"].Value = DBNull.Value.Equals(dsDetail.Tables[0].Rows[i]["GRADE"]) ? null : dsDetail.Tables[0].Rows[i]["GRADE"].ToString(); //dtGrid.Rows[i].Cells["hCostingNo"].Value = dsDetail.Tables[0].Rows[i]["COSTINGNO"].ToString(); dtGrid.Rows[i].Cells["hStyleID"].Value = dsDetail.Tables[0].Rows[i]["STYLEID"].ToString(); dtGrid.Rows[i].Cells["hPONO"].Value = dsDetail.Tables[0].Rows[i]["PONO"].ToString(); dtGrid.Rows[i].Cells["hQuantity"].Value = dsDetail.Tables[0].Rows[i]["QUANTITY"].ToString(); dtGrid.Rows[i].Cells["hUOM"].Value = dsDetail.Tables[0].Rows[i]["UOM"].ToString(); // dtGrid.Rows[i].Cells["hPrice"].Value = dsDetail.Tables[0].Rows[i]["PRICE"].ToString(); //dtGrid.Rows[i].Cells["hCurrencyID"].Value = dsDetail.Tables[0].Rows[i]["CURRENCYID"].ToString(); //dtGrid.Rows[i].Cells["hKurs"].Value = dsDetail.Tables[0].Rows[i]["KURS"].ToString(); dtGrid.Rows[i].Cells["hConvert"].Value = dsDetail.Tables[0].Rows[i]["CONVER"].ToString(); //dtGrid.Rows[i].Cells["hRemarks"].Value = dsDetail.Tables[0].Rows[i]["REMARKS"].ToString(); dtGrid.Rows[i].Cells["hQtyPurchase"].Value = dsDetail.Tables[0].Rows[i]["QTYPURCHASE"].ToString(); //dtGrid.Rows[i].Cells["hPricePurchase"].Value = dsDetail.Tables[0].Rows[i]["PRICEPURCHASE"].ToString(); dtGrid.Rows[i].Cells["hUOMPurchase"].Value = dsDetail.Tables[0].Rows[i]["UOMPURCHASE"].ToString(); } SimpanTSB.Enabled = false; UbahTSB.Enabled = true; dtGrid.Enabled = true; } }