private void btnReport_Click(object sender, EventArgs e) { NP_Cls.SqlSelect = "SELECT 0 AS ItemNo, t_BOM.BOMCode, t_BOM.MaterialCode, m_Material.MaterialName,t_BOM.FormulaNo, t_BOM.Remark, t_BOM.BOMVersion, t_BOM.Quantity, t_BOM.ApproveUser, CASE WHEN t_BOM.UserChange IS NULL THEN t_BOM.UserCreate ELSE t_BOM.UserChange END AS HUSER, CASE WHEN t_BOM.DateChange IS NULL THEN t_BOM.DateCreate ELSE t_BOM.DateChange END AS HDATE, t_BOMDetail.MaterialCode AS CompCode, t_BOMDetail.Quantity AS CompQty, t_BOMDetail.LossPercentage, t_BOMDetail.Remark AS DRemark, GetCreate.EmployeeFirstName AS FirstNameCreate, s_User.EmployeeFirstName AS FirstNameAppr, CompMaster.UnitCode AS CompUnitCode, CompUnit.UnitName AS CompUnitName, t_BOM.UnitCode, m_Unit.UnitName, m_Material.ProcurementType, CompMaster.MaterialName AS CompName, m_Material.MaterialTypeName FROM t_BOM INNER JOIN t_BOMDetail ON t_BOM.BOMCode = t_BOMDetail.BOMCode INNER JOIN m_Material ON t_BOM.MaterialCode = m_Material.MaterialCode INNER JOIN s_User AS GetCreate ON CASE WHEN t_BOM.UserChange IS NULL THEN t_BOM.UserCreate ELSE t_BOM.UserChange END = GetCreate.UserName INNER JOIN m_Material AS CompMaster ON t_BOMDetail.MaterialCode = CompMaster.MaterialCode INNER JOIN m_Unit AS CompUnit ON CompMaster.UnitCode = CompUnit.UnitCode INNER JOIN m_Unit ON t_BOM.UnitCode = m_Unit.UnitCode LEFT OUTER JOIN s_User ON t_BOM.ApproveUser = s_User.UserName WHERE (t_BOM.BOMCode = '" + this.dgvView["clnBOMCode", this.dgvView.CurrentRow.Index].Value.ToString() + "') ORDER BY t_BOMDetail.SortIndex, CompCode"; DataSet ds = new DataSet(); ds = NP.GetClientDataSet(NP_Cls.SqlSelect); if (ds.Tables[0].Rows.Count > 0) { frmBOMViewer frm = new frmBOMViewer(); if (ds.Tables[0].Rows[0]["MaterialTypeName"].ToString() != "FG") { //if (!NP.ReqField(this.txtFor, "please enter Formula No : !!")) { return; } frm.strFor = ds.Tables[0].Rows[0]["FormulaNo"].ToString(); } frm.bType = Convert.ToByte(ds.Tables[0].Rows[0]["MaterialTypeName"].ToString() == "FG" ? 1 : 0); frm.dsReportA = ds.Copy(); frm.WindowState = FormWindowState.Maximized; frm.ShowDialog(); } else { NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Data Not Found !!"); return; } }