public F_BATCH() { InitializeComponent(); Load += (s, e) => { //Load xls vào grid gridControl1.DataSource = CSVFromToDataTable.XLSToDataTable(@"X:\\Eresis\\EXCHANGES\\OUT\\Batch.xls"); for (int i = 0; i <= gridView1.DataRowCount - 1; i++) { //MessageBox.Show("i : " + i.ToString()); //MessageBox.Show("WO : " + gridView1.GetRowCellValue(i, "WO").ToString()); if (i == 0) { if (OFB.F_OF_Find(gridView1.GetRowCellValue(i, "WO").ToString()).Rows.Count > 0) { DataTable dt = BTB.MINStart_MAXEnd_Date(gridView1.GetRowCellValue(i, "WO").ToString()); MINSTart = dt.Rows[0]["MINStart"].ToString(); MAXEnd = dt.Rows[0]["MAXEnd"].ToString(); ManufacturedQty = float.Parse(dt.Rows[0]["ManufacturedQty"].ToString()); Formula = dt.Rows[0]["Formula"].ToString(); TotalBatch = int.Parse(dt.Rows[0]["TotalBatchNb"].ToString()); OFB.OF_UPDATE(gridView1.GetRowCellValue(i, "WO").ToString(), ManufacturedQty, MINSTart, MAXEnd, Formula, TotalBatch); } } else if (gridView1.GetRowCellValue(i, "WO").ToString() != gridView1.GetRowCellValue(i - 1, "WO").ToString()) { if (OFB.F_OF_Find(gridView1.GetRowCellValue(i, "WO").ToString()).Rows.Count > 0) { DataTable dt = BTB.MINStart_MAXEnd_Date(gridView1.GetRowCellValue(i, "WO").ToString()); MINSTart = dt.Rows[0]["MINStart"].ToString(); MAXEnd = dt.Rows[0]["MAXEnd"].ToString(); ManufacturedQty = float.Parse(dt.Rows[0]["ManufacturedQty"].ToString()); Formula = dt.Rows[0]["Formula"].ToString(); TotalBatch = int.Parse(dt.Rows[0]["TotalBatchNb"].ToString()); OFB.OF_UPDATE(gridView1.GetRowCellValue(i, "WO").ToString(), ManufacturedQty, MINSTart, MAXEnd, Formula, TotalBatch); } } DataRow dr = gridView1.GetDataRow(i); //MessageBox.Show("batch : " + dr["batch"].ToString()); //Kiem tra có btach chưa //chưa có thì insert if (!dr["batch"].ToString().Equals("Somme")) { if (BTB.BATCH_Find(dr["batch"].ToString()).Rows.Count <= 0) { BTB.BATCH_INSERT(dr); } } } //Update data to tbl_OF //Show batch data gridControl2.DataSource = BTB.BATCH_View(); }; //action1.Report += (s, e) => //{ // MessageBox.Show("Nhấn Report button"); //}; action1.Report(new DevExpress.XtraBars.ItemClickEventHandler(ItemClickEventHandler_Report)); //simpleButton1.Click += (s, e) => //{ // simpleButton1.Enabled = false; // dt = cyn_.Report_DEPT_CM(textEdit1.Text.ToString().Trim(), dateEdit1.Text, dateEdit2.Text); // if (dt.Rows.Count > 0) // { // val = true; // dt.WriteXml(Path + "/../../Xml/CM.xml", System.Data.XmlWriteMode.IgnoreSchema); // } // if (val == true) // { // XtraMessageBox.Show("Path :" + Path.ToString()); // rpt.Load(Path + "/../../Report/Rpt_CM_2_2.rpt"); // //rpt.Load("C:/CM/Production/Report/Rpt_CM_2_2.rpt"); // rpt.SetDatabaseLogon("sa", "GiangBinh080399", "10.31.1.5", "CM"); // rpt.SetParameterValue("@Startdate", dateEdit1.Text.ToString()); // rpt.SetParameterValue("@Enddate", dateEdit2.Text.ToString()); // rpt.SetParameterValue("@Keywords", textEdit1.Text); // crystalReportViewer1.ReportSource = rpt; // } // else // XtraMessageBox.Show("No record can be displayed... ", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); //}; }