private void load_data(string JONO) { DataSet dsHeader = new joborderCRUD().getData(JONO); txtCostingNo.Text = JONO; cbDIV.SelectedValue = dsHeader.Tables[0].Rows[0]["GDIV"].ToString(); cbTypeID.SelectedValue = dsHeader.Tables[0].Rows[0]["TYPEID"].ToString(); txtQty.Text = dsHeader.Tables[0].Rows[0]["QUANTITY"].ToString(); txtCustomerID.Text = dsHeader.Tables[0].Rows[0]["CUSTVENDCODE"].ToString(); txtStyleID.Text = dsHeader.Tables[0].Rows[0]["ITEMSID"].ToString(); txtCategoryID.Text = dsHeader.Tables[0].Rows[0]["CATEGORYID"].ToString(); dateCreated.Value = (DateTime)dsHeader.Tables[0].Rows[0]["DATE"]; txtPOCustomer.Text = dsHeader.Tables[0].Rows[0]["POCUSTOMER"].ToString(); txtRemarks.Text = dsHeader.Tables[0].Rows[0]["REMARKS"].ToString(); txtWash.Text = dsHeader.Tables[0].Rows[0]["WASH"].ToString(); DataSet dsDetail = new joborderdetailCRUD().getData(JONO); dtGrid.Rows.Clear(); for (int i = 0; i < dsDetail.Tables[0].Rows.Count; i++) { dtGrid.Rows.Add(); dtGrid.Rows[i].HeaderCell.Value = "V"; dtGrid.Rows[i].Cells["hOrderNo"].Value = dsDetail.Tables[0].Rows[i]["ORDERNO"].ToString(); dtGrid.Rows[i].Cells["hPOCustomer"].Value = dsDetail.Tables[0].Rows[i]["POCUSTOMER"].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["hNoUrut"].Value = dsDetail.Tables[0].Rows[i]["NOURUT"].ToString(); dtGrid.Rows[i].Cells["hAllowance"].Value = dsDetail.Tables[0].Rows[i]["ALLOWANCE"].ToString(); dtGrid.Rows[i].Cells["hQuantity"].Value = dsDetail.Tables[0].Rows[i]["QUANTITY"].ToString(); dtGrid.Rows[i].Cells["hCuttingQty"].Value = dsDetail.Tables[0].Rows[i]["CUTTINGQTY"].ToString(); dtGrid.Rows[i].Cells["hDestination"].Value = dsDetail.Tables[0].Rows[i]["DESTINATION"].ToString(); //dt = dsDetail.Tables[0].Rows[i]["DELIVERY"].; dtGrid.Rows[i].Cells["hDelivery"].Value = Convert.ToDateTime(dsDetail.Tables[0].Rows[i]["DELIVERY"]).ToString("dd/MM/yyyy"); } }
private void button1_Click(object sender, EventArgs e) { frmjoborderSearch f = new frmjoborderSearch(); f.AddItemCallback = new frmjoborderSearch.AddCostingDelegate(this.SetCostingCallBack); f.ShowDialog(); if (GStrCode != "") { DataSet dsHeader = new joborderCRUD().getGarment(GStrCode); cbDIV.SelectedValue = dsHeader.Tables[0].Rows[0]["GDIV"].ToString(); txtCustomerID.Text = dsHeader.Tables[0].Rows[0]["CUSTVENDCODE"].ToString(); DataSet dsSupplier = new mcustvendCRUD().getData(txtCustomerID.Text, "", ""); if (dsSupplier.Tables[0].Rows.Count > 0) { txtCustomerDesc.Text = dsSupplier.Tables[0].Rows[0]["NAME"].ToString(); txtAddress.Text = dsSupplier.Tables[0].Rows[0]["ADDRESS"].ToString(); } //isi detail DataSet dsDetail = new joborderdetailCRUD().getData(GStrCode); // var index = dtGrid.Rows.Add(); dtGrid.Rows.Clear(); for (int i = 0; i < dsDetail.Tables[0].Rows.Count; i++) { dtGrid.Rows.Add(); dtGrid.Rows[i].HeaderCell.Value = "#"; dtGrid.Rows[i].Cells["hID"].Value = i;//dsDetail.Tables[0].Rows[i]["ID"].ToString(); dtGrid.Rows[i].Cells["hItemsID"].Value = Convert.ToString(dsHeader.Tables[0].Rows[0]["ITEMSID"]); dtGrid.Rows[i].Cells["hDescription"].Value = Convert.ToString(dsHeader.Tables[0].Rows[0]["ITEMSID"]); // dtGrid.Rows[i].Cells["hJenis"].Value = dsDetail.Tables[0].Rows[i]["JENIS"].ToString(); dtGrid.Rows[i].Cells["hColorID"].Value = Convert.ToString(dsDetail.Tables[0].Rows[i]["COLORID"]); dtGrid.Rows[i].Cells["hSizeID"].Value = Convert.ToString(dsDetail.Tables[0].Rows[i]["SIZEID"]); dtGrid.Rows[i].Cells["hGrade"].Value = "A"; dtGrid.Rows[i].Cells["hStyleID"].Value = Convert.ToString(dsHeader.Tables[0].Rows[0]["ITEMSID"]); dtGrid.Rows[i].Cells["hQuantity"].Value = Convert.ToString(dsDetail.Tables[0].Rows[i]["QUANTITY"]); dtGrid.Rows[i].Cells["hUOM"].Value = "PCS"; dtGrid.Rows[i].Cells["hConvert"].Value = 1; dtGrid.Rows[i].Cells["hQtyPurchase"].Value = Convert.ToString(dsDetail.Tables[0].Rows[i]["QUANTITY"]); dtGrid.Rows[i].Cells["hUOMPurchase"].Value = "PCS"; } SimpanTSB.Enabled = true; UbahTSB.Enabled = false; dtGrid.Enabled = true; } }