private void DGV() { NP_Cls.SqlSelect = "SELECT DepartmentCode, AuthLevel, Per FROM s_Level WHERE (FileStatus = N'1') "; NP_Cls.SqlSelect += " AND (DepartmentCode = '" + this.cbDepartment.SelectedValue + "') "; NP_Cls.SqlSelect += " AND (AuthLevel = '" + this.cbLevel.Text.Trim() + "') "; DataSet ds = new DataSet(); ds = NP.GetClientDataSet(NP_Cls.SqlSelect); if (ds.Tables[0].Rows.Count > 0) { string[] strPer = ds.Tables[0].Rows[0]["Per"].ToString().Split(':'); this.chkVendorMaster.Checked = Convert.ToBoolean(strPer[0].ToString()); this.chkCurrencyMaster.Checked = Convert.ToBoolean(strPer[1].ToString()); this.chkLocationMaster.Checked = Convert.ToBoolean(strPer[2].ToString()); this.chkUnit.Checked = Convert.ToBoolean(strPer[3].ToString()); this.chkDepartment.Checked = Convert.ToBoolean(strPer[4].ToString()); this.chkCustomerMaster.Checked = Convert.ToBoolean(strPer[5].ToString()); this.chkPlantMaster.Checked = Convert.ToBoolean(strPer[6].ToString()); this.chkMaterialMaster.Checked = Convert.ToBoolean(strPer[7].ToString()); this.chkMaterialGroupMaster.Checked = Convert.ToBoolean(strPer[8].ToString()); this.chkEmpUser.Checked = Convert.ToBoolean(strPer[9].ToString()); this.chkManageLevel.Checked = Convert.ToBoolean(strPer[10].ToString()); this.chkInfoRec.Checked = Convert.ToBoolean(strPer[11].ToString()); this.chkSourceList.Checked = Convert.ToBoolean(strPer[12].ToString()); this.chkWorkCenter.Checked = Convert.ToBoolean(strPer[13].ToString()); this.chkRouting.Checked = Convert.ToBoolean(strPer[14]); try { this.chkProductionOrder.Checked = Convert.ToBoolean(strPer[15].ToString()); this.chkGoodsIssue.Checked = Convert.ToBoolean(strPer[16].ToString()); this.chkGRProduction.Checked = Convert.ToBoolean(strPer[17].ToString()); this.chkProductionCost.Checked = Convert.ToBoolean(strPer[18].ToString()); this.chkBOM.Checked = Convert.ToBoolean(strPer[19]); this.chkPR.Checked = Convert.ToBoolean(strPer[20].ToString()); this.chkPO.Checked = Convert.ToBoolean(strPer[21].ToString()); this.chkGR.Checked = Convert.ToBoolean(strPer[22].ToString()); this.chkGRT.Checked = Convert.ToBoolean(strPer[23].ToString()); this.chkSO.Checked = Convert.ToBoolean(strPer[24].ToString()); this.chkDO.Checked = Convert.ToBoolean(strPer[25].ToString()); this.chkMRP.Checked = Convert.ToBoolean(strPer[26].ToString()); this.chkOverview.Checked = Convert.ToBoolean(strPer[27].ToString()); this.chkTransfer.Checked = Convert.ToBoolean(strPer[28].ToString()); this.chkMM.Checked = Convert.ToBoolean(strPer[29].ToString()); this.chkAppBOM.Checked = Convert.ToBoolean(strPer[30]); this.chkAppPR.Checked = Convert.ToBoolean(strPer[31]); this.chkAppPO.Checked = Convert.ToBoolean(strPer[32]); this.chkAppSO.Checked = Convert.ToBoolean(strPer[33]); } catch { this.chkProductionOrder.Checked = false; this.chkGoodsIssue.Checked = false; this.chkGRProduction.Checked = false; this.chkProductionCost.Checked = false; this.chkBOM.Checked = false; this.chkPR.Checked = false; this.chkPO.Checked = false; this.chkGR.Checked = false; this.chkGRT.Checked = false; this.chkSO.Checked = false; this.chkDO.Checked = false; this.chkMRP.Checked = false; this.chkOverview.Checked = false; this.chkTransfer.Checked = false; this.chkMM.Checked = false; this.chkAppBOM.Checked = false; this.chkAppPR.Checked = false; this.chkAppPO.Checked = false; this.chkAppSO.Checked = false; } this.btnAdd.Visible = false; this.btnEdit.Visible = true; this.btnDelete.Visible = true; } else { this.chkVendorMaster.Checked = false; this.chkCurrencyMaster.Checked = false; this.chkLocationMaster.Checked = false; this.chkUnit.Checked = false; this.chkDepartment.Checked = false; this.chkCustomerMaster.Checked = false; this.chkPlantMaster.Checked = false; this.chkMaterialMaster.Checked = false; this.chkMaterialGroupMaster.Checked = false; this.chkEmpUser.Checked = false; this.chkManageLevel.Checked = false; this.chkInfoRec.Checked = false; this.chkSourceList.Checked = false; this.chkWorkCenter.Checked = false; this.chkRouting.Checked = false; this.chkProductionOrder.Checked = false; this.chkGoodsIssue.Checked = false; this.chkGRProduction.Checked = false; this.chkProductionCost.Checked = false; this.chkPO.Checked = false; this.chkPR.Checked = false; this.chkGR.Checked = false; this.chkGRT.Checked = false; this.chkSO.Checked = false; this.chkDO.Checked = false; this.chkMRP.Checked = false; this.chkOverview.Checked = false; this.chkTransfer.Checked = false; this.chkMM.Checked = false; this.chkBOM.Checked = false; this.chkAppBOM.Checked = false; this.chkAppPR.Checked = false; this.chkAppPO.Checked = false; this.chkAppSO.Checked = false; this.btnAdd.Visible = true; this.btnEdit.Visible = false; this.btnDelete.Visible = false; } }
private double GetStockByFG(string FGCode) { try { string strTmp = "SELECT (SELECT sum(isnull(UR,0) + isnull(QI,0)) FROM t_StockOverview WHERE (MaterialCode = N'" + FGCode + "'))as SumURQI, t_StockOverview.AutoID, t_StockOverview.MaterialCode, t_StockOverview.BatchNumber, ISNULL(t_StockOverview.UR, 0) + ISNULL(t_StockOverview.QI, 0) AS QI, t_StockOverview.Block, t_StockOverview.UserCreate, t_StockOverview.DateCreate, t_StockOverview.UserChange, t_StockOverview.DateChange, t_MRPBOM.RequireDate, t_MRPBOM.SONumber FROM t_StockOverview LEFT OUTER JOIN t_MRPBOM ON t_StockOverview.MaterialCode = t_MRPBOM.ComponentCode WHERE (t_StockOverview.MaterialCode = N'" + FGCode + "') ORDER BY t_MRPBOM.RequireDate"; DataSet dsTmp = new DataSet(); dsTmp = NP.GetClientDataSet(strTmp); double dMinus = 0; if (dsTmp.Tables[0].Rows.Count > 0) { //for (int st = 0; st < dsTmp.Tables[0].Rows.Count; st++) //{ // if (dsTmp.Tables[0].Rows[st]["SONumber"].ToString().Trim() == SO) // { // return Convert.ToDouble(dsTmp.Tables[0].Rows[0]["QI"].ToString()) - dMinus; // } // else // { // dMinus += Convert.ToDouble(dsTmp.Tables[0].Rows[st]["QI"]); // } //} return(Convert.ToDouble(dsTmp.Tables[0].Rows[0]["SumURQI"].ToString())); } else { return(0); } } catch (Exception ex) { throw new Exception(ex.Message); } }
private void DGV() { //NP_Cls.SqlSelect = "SELECT t_VendorInfoRecordPeriodsDetail.ValidPeriodDetailCode, t_VendorInfoRecordPeriods.ValidPeriodCode, m_Currency.CurrencyName, m_Unit.UnitName, t_VendorInfoRecordPeriodsDetail.ScaleQty, t_VendorInfoRecordPeriodsDetail.Rate FROM t_VendorInfoRecordPeriods INNER JOIN " + // "m_Material ON t_VendorInfoRecordPeriods.MaterialCode = m_Material.MaterialCode INNER JOIN " + // "m_Vendor ON t_VendorInfoRecordPeriods.VendorCode = m_Vendor.VendorCode INNER JOIN " + // "m_Currency ON m_Vendor.CurrencyCode = m_Currency.CurrencyCode INNER JOIN " + // "m_Unit ON m_Material.UnitCode = m_Unit.UnitCode INNER JOIN " + // "t_VendorInfoRecordPeriodsDetail ON t_VendorInfoRecordPeriods.ValidPeriodCode = t_VendorInfoRecordPeriodsDetail.ValidPeriodCode WHERE (t_VendorInfoRecordPeriods.VendorCode = N'" + NP_Cls.hVendorInfo["Vendor"].ToString() + "') AND (t_VendorInfoRecordPeriods.MaterialCode = N'" + NP_Cls.hVendorInfo["Material"].ToString() +"')"; NP_Cls.SqlSelect = "SELECT t_VendorInfoRecordPeriodsDetail.ValidPeriodDetailCode, t_VendorInfoRecordPeriods.ValidPeriodCode, m_Currency.CurrencyName, m_Unit.UnitName, t_VendorInfoRecordPeriodsDetail.ScaleQty, t_VendorInfoRecordPeriodsDetail.Rate " + "FROM t_VendorInfoRecordPeriods INNER JOIN " + "m_Material ON t_VendorInfoRecordPeriods.MaterialCode = m_Material.MaterialCode INNER JOIN " + "m_Vendor ON m_Vendor.VendorCode = t_VendorInfoRecordPeriods.VendorCode INNER JOIN " + "m_Currency ON m_Currency.CurrencyCode = m_Vendor.CurrencyCode INNER JOIN " + "m_Unit ON m_Unit.UnitCode = m_Material.UnitCode LEFT OUTER JOIN " + "t_VendorInfoRecordPeriodsDetail ON t_VendorInfoRecordPeriods.ValidPeriodCode = t_VendorInfoRecordPeriodsDetail.ValidPeriodCode " + "WHERE (t_VendorInfoRecordPeriods.VendorCode = N'" + NP_Cls.hVendorInfo["Vendor"].ToString() + "') AND (t_VendorInfoRecordPeriods.MaterialCode = N'" + NP_Cls.hVendorInfo["Material"].ToString() + "') AND (t_VendorInfoRecordPeriods.ValidPeriodCode = '" + NP_Cls.strValidCode + "')"; DataSet ds = new DataSet(); ds = NP.GetClientDataSet(NP_Cls.SqlSelect); if (ds.Tables[0].Rows.Count > 0) { this.txtCurrency.Text = ds.Tables[0].Rows[0]["CurrencyName"].ToString(); this.txtUnit.Text = ds.Tables[0].Rows[0]["UnitName"].ToString(); } else { this.txtCurrency.Text = string.Empty; this.txtUnit.Text = string.Empty; } this.dgvView.DataSource = ds.Tables[0]; }
private void DGV() { NP_Cls.SqlSelect = "SELECT 0 AS No, t_RoutingDetail.WorkCenterCode, m_WorkCenter.WorkCenterName, t_Routing.BaseQuantity,t_RoutingDetail.STDManHour,t_Routing.Remark ,t_Routing.MaterialCode,t_Routing.PlantCode,t_RoutingDetail.Hours " + "FROM t_Routing INNER JOIN t_RoutingDetail ON t_Routing.MaterialCode = t_RoutingDetail.MaterialCode AND t_Routing.PlantCode = t_RoutingDetail.PlantCode INNER JOIN m_WorkCenter ON t_RoutingDetail.WorkCenterCode = m_WorkCenter.WorkCenterCode " + "WHERE (t_Routing.MaterialCode = '" + this.cbMaterial.SelectedValue + "') AND (t_Routing.PlantCode = '" + this.cbPlant.SelectedValue + "') ORDER BY t_RoutingDetail.WorkCenterCode"; DataSet dsSerach = new DataSet(); dsSerach = NP.GetClientDataSet(NP_Cls.SqlSelect); for (Int32 i = 0; i < dsSerach.Tables[0].Rows.Count; i++) { txtBaseQuantity.Text = dsSerach.Tables[0].Rows[0]["BaseQuantity"].ToString(); dsSerach.Tables[0].Rows[i][0] = i + 1; } this.dgvView.DataSource = dsSerach.Tables[0]; if (dsSerach.Tables[0].Rows.Count > 0) { //gDetail.Enabled = false; if (dsSerach.Tables[0].Rows.Count == 1) { this.contextMenuStrip1.Items[1].Enabled = false; } else { this.contextMenuStrip1.Items[1].Enabled = true; } } else { gDetail.Enabled = true; } }
private void DGV() { NP_Cls.SqlSelect = "SELECT MaterialCode, BatchNumber, UR, QI, Block FROM t_StockOverview WHERE (1=1) "; if (!string.IsNullOrEmpty(this.txtSCode.Text.Trim())) { NP_Cls.SqlSelect += " AND (MaterialCode LIKE '%" + this.txtSCode.Text.Trim() + "%') "; } if (!string.IsNullOrEmpty(this.txtSName.Text.Trim())) { NP_Cls.SqlSelect += " AND (BatchNumber LIKE '%" + this.txtSName.Text.Trim() + "%') "; } this.dgvView.DataSource = NP.GetClientDataSet(NP_Cls.SqlSelect).Tables[0]; }
private void DGV() { NP_Cls.SqlSelect = "SELECT WorkCenterCode, WorkCenterName FROM m_WorkCenter WHERE (FileStatus = N'1') "; if (!string.IsNullOrEmpty(this.txtSCode.Text.Trim())) { NP_Cls.SqlSelect += " AND (WorkCenterCode LIKE '%" + this.txtSCode.Text.Trim() + "%') "; } if (!string.IsNullOrEmpty(this.txtSName.Text.Trim())) { NP_Cls.SqlSelect += " AND (WorkCenterName LIKE '%" + this.txtSName.Text.Trim() + "%') "; } this.dgvView.DataSource = NP.GetClientDataSet(NP_Cls.SqlSelect).Tables[0]; }
private void DGV() { NP_Cls.SqlSelect = "SELECT DepartmentCode, DepartmentName FROM m_Department WHERE (FileStatus = N'1') "; if (!string.IsNullOrEmpty(this.txtSCode.Text.Trim())) { NP_Cls.SqlSelect += " AND (DepartmentCode LIKE '%" + this.txtSCode.Text.Trim() + "%') "; } if (!string.IsNullOrEmpty(this.txtSName.Text.Trim())) { NP_Cls.SqlSelect += " AND (DepartmentName LIKE '%" + this.txtSName.Text.Trim() + "%') "; } NP_Cls.SqlSelect += " Order By AutoID"; this.dgvView.DataSource = NP.GetClientDataSet(NP_Cls.SqlSelect).Tables[0]; }
private void DGV(string strSerach) { NP_Cls.SqlSelect = "SELECT t_VendorInfoRecord.VendorCode, m_Vendor.VendorName, t_VendorSourceList.Fix, t_VendorInfoRecord.Block, m_Vendor.PurchasingGroup, " + "m_Material.MaterialName FROM t_VendorInfoRecord INNER JOIN " + "m_Material ON t_VendorInfoRecord.MaterialCode = m_Material.MaterialCode INNER JOIN " + "m_Vendor ON t_VendorInfoRecord.VendorCode = m_Vendor.VendorCode INNER JOIN " + "t_VendorSourceList ON t_VendorInfoRecord.VendorCode = t_VendorSourceList.VendorCode AND " + "t_VendorInfoRecord.MaterialCode = t_VendorSourceList.MaterialCode " + "WHERE (1 = 1)"; if (!string.IsNullOrEmpty(this.txtMaterialCode.Text.Trim())) { NP_Cls.SqlSelect += " AND (t_VendorInfoRecord.MaterialCode + m_Material.MaterialName LIKE '%" + this.txtMaterialCode.Text.Trim() + "%') "; } else { NP_Cls.SqlSelect += " AND (t_VendorInfoRecord.MaterialCode = '') "; } DataSet dsSerach = new DataSet(); dsSerach = NP.GetClientDataSet(NP_Cls.SqlSelect); if (dsSerach.Tables[0].Rows.Count == 0) { this.lblWarn.Visible = true; this.lblMaterial.Text = string.Empty; } else { this.lblWarn.Visible = false; this.lblMaterial.Text = "Material Name : " + dsSerach.Tables[0].Rows[0]["MaterialName"].ToString(); } this.dgvView.DataSource = dsSerach.Tables[0]; this.dgvView.ClearSelection(); SetBlockColor(); }
private void DGV() { NP_Cls.SqlSelect = "SELECT s_User.EmployeeCode, s_User.EmployeeFirstName, m_Department.DepartmentName, s_User.AuthLevel " + "FROM s_User INNER JOIN m_Department ON s_User.DepartmentCode = m_Department.DepartmentCode " + "WHERE (s_User.FileStatus = N'1') "; if (!string.IsNullOrEmpty(this.txtSCode.Text.Trim())) { NP_Cls.SqlSelect += " AND (s_User.EmployeeCode LIKE '%" + this.txtSCode.Text.Trim() + "%') "; } if (!string.IsNullOrEmpty(this.txtSName.Text.Trim())) { NP_Cls.SqlSelect += " AND (s_User.EmployeeFirstName LIKE '%" + this.txtSName.Text.Trim() + "%') "; } NP_Cls.SqlSelect += " Order By s_User.DepartmentCode"; this.dgvView.DataSource = NP.GetClientDataSet(NP_Cls.SqlSelect).Tables[0]; }
private void btnOverview_Click(object sender, EventArgs e) { if (!NP.ReqField(this.txtMatCode, "Please enter Material Code !!")) { return; } NP_Cls.SqlSelect = "SELECT t_StockMovement.DocNumber, t_StockMovement.TranDate, t_StockMovement.MovementType, t_StockMovementDetail.MaterialCode, t_StockMovementDetail.MaterialName, t_StockMovementDetail.Quantity, t_StockMovementDetail.UnitCode, t_StockMovementDetail.RefNumber, '' AS CL FROM t_StockMovement INNER JOIN t_StockMovementDetail ON t_StockMovement.DocNumber = t_StockMovementDetail.DocNumber WHERE (t_StockMovementDetail.MaterialCode = N'" + this.txtMatCode.Text.Trim() + "' AND t_StockMovementDetail.RefNumber not like '%X%') ORDER BY t_StockMovement.TranDate"; DataSet ds = new DataSet(); ds = NP.GetClientDataSet(NP_Cls.SqlSelect); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (ds.Tables[0].Rows[i]["DocNumber"].ToString().Contains("TR")) { if (ds.Tables[0].Rows[i]["RefNumber"].ToString().Contains("X")) { ds.Tables[0].Rows[i]["CL"] = "red"; } else { ds.Tables[0].Rows[i]["CL"] = "green"; } } else if (ds.Tables[0].Rows[i]["DocNumber"].ToString().Contains("GR")) { ds.Tables[0].Rows[i]["CL"] = "green"; } else if (ds.Tables[0].Rows[i]["DocNumber"].ToString().Contains("PD")) { ds.Tables[0].Rows[i]["CL"] = "red"; } } this.pDesc.Visible = true; this.lblMatName.Text = ds.Tables[0].Rows[0]["MaterialName"].ToString(); this.dataGridView1.DataSource = ds.Tables[0]; this.dataGridView1.ClearSelection(); for (int d = 0; d < this.dataGridView1.RowCount; d++) { if (this.dataGridView1["clnCL", d].Value.ToString().IndexOf("red") > -1) { this.dataGridView1.Rows[d].DefaultCellStyle.BackColor = Color.LightCoral; } else if (this.dataGridView1["clnCL", d].Value.ToString().IndexOf("green") > -1) { this.dataGridView1.Rows[d].DefaultCellStyle.BackColor = Color.PaleGreen; } } this.dataGridView1.Columns["clnCL"].Visible = false; } else { this.pDesc.Visible = false; NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Data Not Found !!"); this.txtMatCode.Select(); this.txtMatCode.SelectAll(); return; } }
private void DGV() { NP_Cls.SqlSelect = "SELECT 0 as ItemNo, AutoID, PrdONumber, MaterialCode, PlantCode, WorkCenterCode, UsedMachine, UsedSetup, UsedLabor, UsedOT FROM t_ProductionCost WHERE (1=1) "; if (!string.IsNullOrEmpty(this.txtSCode.Text.Trim())) { NP_Cls.SqlSelect += " AND (PrdONumber LIKE N'%" + this.txtSCode.Text.Trim() + "%') "; } if (!string.IsNullOrEmpty(this.txtSName.Text.Trim())) { NP_Cls.SqlSelect += " AND (MaterialCode LIKE N'%" + this.txtSName.Text.Trim() + "%') "; } NP_Cls.SqlSelect += " ORDER BY PrdONumber"; DataSet dsSerach = new DataSet(); dsSerach = NP.GetClientDataSet(NP_Cls.SqlSelect); for (Int32 i = 0; i < dsSerach.Tables[0].Rows.Count; i++) { dsSerach.Tables[0].Rows[i][0] = i + 1; } this.dgvView.DataSource = dsSerach.Tables[0]; }
private void DGV() { NP_Cls.SqlSelect = "SELECT t_VendorInfoRecord.VendorCode, t_VendorInfoRecord.MaterialCode, t_VendorInfoRecord.DeliveryTime, " + "t_VendorInfoRecord.Block, m_Vendor.VendorName, m_Material.MaterialName " + "FROM t_VendorInfoRecord INNER JOIN " + "m_Vendor ON t_VendorInfoRecord.VendorCode = m_Vendor.VendorCode INNER JOIN " + "m_Material ON t_VendorInfoRecord.MaterialCode = m_Material.MaterialCode WHERE (1=1) "; if (!string.IsNullOrEmpty(this.txtSCode.Text.Trim())) { NP_Cls.SqlSelect += " AND (m_Vendor.VendorCode LIKE '%" + this.txtSCode.Text.Trim() + "%') "; } if (!string.IsNullOrEmpty(this.txtSName.Text.Trim())) { NP_Cls.SqlSelect += " AND (m_Material.MaterialCode LIKE '%" + this.txtSName.Text.Trim() + "%') "; } //if (!string.IsNullOrEmpty(this.txtSPG.Text.Trim())) //{ // NP_Cls.SqlSelect += " AND (t_VendorInfoRecord.PurchasingGroup LIKE '%" + this.txtSPG.Text.Trim() + "%') "; //} this.dgvView.DataSource = NP.GetClientDataSet(NP_Cls.SqlSelect).Tables[0]; }
private void btnOverview_Click(object sender, EventArgs e) { if (!NP.ReqField(this.txtMatCode, "Please enter Material Code !!")) { return; } NP_Cls.SqlSelect = "SELECT m_Material.MaterialCode, m_Material.MaterialName, m_Material.MaterialTypeName, m_Unit.UnitName FROM m_Material INNER JOIN m_Unit ON m_Material.UnitCode = m_Unit.UnitCode WHERE (m_Material.MaterialCode = N'" + this.txtMatCode.Text.Trim() + "') AND (m_Material.FileStatus = N'1')"; DataSet ds = new DataSet(); ds = NP.GetClientDataSet(NP_Cls.SqlSelect); if (ds.Tables[0].Rows.Count > 0) { this.pDesc.Visible = true; this.lblMatName.Text = ds.Tables[0].Rows[0]["MaterialName"].ToString(); this.lblMatType.Text = ds.Tables[0].Rows[0]["MaterialTypeName"].ToString(); this.lblUnit.Text = ds.Tables[0].Rows[0]["UnitName"].ToString(); NP_Cls.SqlSelect = "SELECT BatchNumber, UR , QI, Block FROM t_StockOverview WHERE (MaterialCode = N'" + this.txtMatCode.Text.Trim() + "')"; this.dataGridView1.DataSource = NP.GetClientDataSet(NP_Cls.SqlSelect).Tables[0]; } else { this.pDesc.Visible = false; NP_Cls.SqlSelect = "SELECT BatchNumber, UR, QI, Block FROM t_StockOverview WHERE (MaterialCode = N'" + this.txtMatCode.Text.Trim() + "')"; this.dataGridView1.DataSource = NP.GetClientDataSet(NP_Cls.SqlSelect).Tables[0]; NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Data Not Found !!"); this.txtMatCode.Select(); this.txtMatCode.SelectAll(); return; } }
public void GenVCode() { try { NP_Cls.SqlSelect = "SELECT TmpValidPeriodsCode FROM tmp_GenCode"; Int64 iCode = Convert.ToInt64(NP.GetClientDataSet(NP_Cls.SqlSelect).Tables[0].Rows[0][0].ToString()); iCode += 1; string strErr = string.Empty; if (NP.SqlCmd("UPDATE tmp_GenCode SET TmpValidPeriodsCode = " + iCode, ref strErr)) { NP_Cls.strValidCode = iCode.ToString(); } else { NP.MSGB(NP_Cls.NPMgsStyle.WarningType, strErr); return; } } catch (Exception ex) { NP.MSGB(NP_Cls.NPMgsStyle.WarningType, ex.Message); return; } }
private void btnLogin_Click(object sender, EventArgs e) { if (!NP.ReqField(this.txtUserName, "Please enter UserName: !!")) { return; } if (!NP.ReqField(this.txtPassword, "Please enter Password: !!")) { return; } NP_Cls.SqlSelect = "SELECT UserName, Password, UserIP FROM s_User WHERE (UserName = '******'", "") + "') AND (Password = '******'", "") + "')"; DataSet dsUser = new DataSet(); dsUser = NP.GetClientDataSet(NP_Cls.SqlSelect); if (dsUser.Tables[0].Rows.Count > 0) { string strIP = string.Empty; //NP.getip(); if (string.IsNullOrEmpty(dsUser.Tables[0].Rows[0]["UserIP"].ToString())) { //NP_Cls.sqlUpdate = "UPDATE s_User SET UserIP = '" + strIP + "' WHERE (UserName = '******')"; //string strErr = string.Empty; //if (NP.SqlCmd(NP_Cls.sqlUpdate, ref strErr) == false) //{ //NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Warning !! : " + strErr); return; //}NP.MSGB(NP_Cls.NPMgsStyle.InfoType, "You are login !!"); NP_Cls.strUsr = dsUser.Tables[0].Rows[0]["UserName"].ToString(); ManageMenu(NP_Cls.strUsr); this.txtUserName.Text = string.Empty; this.txtPassword.Text = string.Empty; this.txtUserName.Select(); frmMainMenu frmM = new frmMainMenu(); frmM.Show(); this.Hide(); } else { if (strIP == dsUser.Tables[0].Rows[0]["UserIP"].ToString()) { NP_Cls.strUsr = dsUser.Tables[0].Rows[0]["UserName"].ToString(); NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "You are login the same IP !!"); ManageMenu(NP_Cls.strUsr); this.txtUserName.Text = string.Empty; this.txtPassword.Text = string.Empty; this.txtUserName.Select(); frmMainMenu frmM = new frmMainMenu(); frmM.Show(); this.Hide(); } else { NP_Cls.strUsr = string.Empty; NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "You can not login with multi user !!"); return; } } } else { NP_Cls.strUsr = string.Empty; NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Invalid UserName or Password !!"); return; } }
private void DGV() { NP_Cls.SqlSelect = "SELECT 0 AS ItemNo, t_BOM.BOMCode, t_BOM.MaterialCode, m_Material.MaterialName, m_Plant.PlantName, t_BOM.BOMVersion, t_BOM.Approve, t_BOM.PlantCode, t_BOM.Quantity, m_Unit.UnitName, t_BOM.BOMType FROM t_BOM INNER JOIN " + "m_Material ON t_BOM.MaterialCode = m_Material.MaterialCode INNER JOIN " + "m_Plant ON t_BOM.PlantCode = m_Plant.PlantCode INNER JOIN " + "m_Unit ON t_BOM.UnitCode = m_Unit.UnitCode " + "WHERE (t_BOM.FileStatus = N'1') " + "ORDER BY t_BOM.BOMVersion"; DataSet ds = new DataSet(); ds = NP.GetClientDataSet(NP_Cls.SqlSelect); ds.Tables[0].Columns.Add(new DataColumn("imgAppr", typeof(System.Byte[]))); if (ds.Tables[0].Rows.Count > 0) { this.contextMenuStrip1.Enabled = true; System.Drawing.Bitmap ImageApp = new System.Drawing.Bitmap(WMS.Properties.Resources.VerAp); System.Drawing.Bitmap ImageNot = new System.Drawing.Bitmap(WMS.Properties.Resources.NotAppr); MemoryStream stream = new MemoryStream(); MemoryStream stream2 = new MemoryStream(); ImageApp.Save(stream, System.Drawing.Imaging.ImageFormat.Png); ImageNot.Save(stream2, System.Drawing.Imaging.ImageFormat.Png); byte[] imgbyteApp; byte[] imgbyteNot; imgbyteApp = stream.ToArray(); imgbyteNot = stream2.ToArray(); for (Int32 i = 0; i < ds.Tables[0].Rows.Count; i++) { ds.Tables[0].Rows[i]["ItemNo"] = i + 1; if (((bool)ds.Tables[0].Rows[i]["Approve"])) { ds.Tables[0].Rows[i]["imgAppr"] = imgbyteApp; } else { ds.Tables[0].Rows[i]["imgAppr"] = imgbyteNot; } } //ds.Tables[0].Columns.Remove("Approve"); } else { this.contextMenuStrip1.Enabled = false; } this.dgvView.DataSource = ds.Tables[0]; }
private void getOldData() { NP_Cls.SqlSelect = "SELECT SOAutoID , BatchNumber, Qty , SONumber FROM tmp_DOforApprove WHERE (SOAutoID = '" + NP_Cls.autoIDDO + "')"; this.dataGridView1.DataSource = NP.GetClientDataSet(NP_Cls.SqlSelect).Tables[0]; }
private void MyGrid(DataGridView grid) { NP_Cls.SqlSelect = "SELECT t_PRDetail.AutoID,1 AS ItemNo, t_PRDetail.MaterialCode, t_PRDetail.MaterialName, t_PRDetail.PRQuantity AS Qty, t_PRDetail.UnitCode, t_PRDetail.UnitName, t_PRDetail.NetPrice, t_PRDetail.PRAmount AS Amt, t_PRDetail.DeliveryDate, t_PR.PRNumber, t_PRDetail.PlantCode, t_PRDetail.PlantName, t_PRDetail.LocCode, t_PRDetail.LocName FROM t_PRDetail INNER JOIN t_PR ON t_PRDetail.PRNumber = t_PR.PRNumber WHERE (t_PRDetail.MaterialCode = N'') AND (t_PR.VendorCode = N'')"; this.dsPR = NP.GetClientDataSet(NP_Cls.SqlSelect); grid.DataSource = this.dsPR.Tables[0]; }
private void MyGrid(DataGridView grid) { NP_Cls.SqlSelect = "SELECT 0 AS ItemNo, t_GRDetail.MaterialCode, t_GRDetail.MaterialName, t_GRDetail.GRQuantity AS GTQty, t_GRDetail.UnitCode, t_GRDetail.UnitName, t_GRDetail.PlantCode, t_GRDetail.LocCode, t_GRDetail.BatchNumber, t_GRDetail.DeliveryDate, t_GRDetail.GRNumber, t_GRDetail.NetPrice, t_GRDetail.GRAmount AS GTAmt, t_GRDetail.PlantName, t_GRDetail.LocName, t_GRDetail.AutoID FROM t_GR INNER JOIN t_GRDetail ON t_GR.GRNumber = t_GRDetail.GRNumber WHERE (t_GRDetail.GRNumber = N'') AND (t_GR.VendorCode = N'') AND (t_GR.MovementType = N'101')"; this.dsPR = NP.GetClientDataSet(NP_Cls.SqlSelect); grid.DataSource = this.dsPR.Tables[0]; }
private void MyGrid(DataGridView grid) { NP_Cls.SqlSelect = "SELECT 1 AS ItemNo,'' as BatchNumber,t_SODetail.DOQuantity, t_SODetail.MaterialCode, t_SODetail.MaterialName, t_SODetail.SOQuantity AS Qty, t_SODetail.UnitCode, t_SODetail.UnitName, t_SODetail.NetPrice, t_SODetail.SOAmount AS Amt, t_SODetail.DeliveryDate, t_SODetail.PlantCode, t_SODetail.PlantName, t_SODetail.LocCode, t_SODetail.LocName, t_SO.SONumber, t_SODetail.AutoID, t_StockOverview.UR, 0 as TmpSO FROM t_SO INNER JOIN t_SODetail ON t_SO.SONumber = t_SODetail.SONumber LEFT OUTER JOIN t_StockOverview ON t_SODetail.MaterialCode = t_StockOverview.MaterialCode WHERE (t_SO.SONumber = N'')"; this.dsPR = NP.GetClientDataSet(NP_Cls.SqlSelect); grid.DataSource = this.dsPR.Tables[0]; }
private void MyGrid(DataGridView grid) { NP_Cls.SqlSelect = "SELECT 1 AS ItemNo, t_PrdOrderDetail.UnitCode, t_PrdOrderDetail.UnitName, t_PrdOrderDetail.PlantCode, t_PrdOrderDetail.PlantName, t_PrdOrderDetail.LocCode, t_PrdOrderDetail.LocName, t_PrdOrderDetail.PrdONumber, t_PrdOrderDetail.ComponentCode AS MaterialCode, t_PrdOrderDetail.ComponentName AS MaterialName, t_PrdOrderDetail.PrdOQuantity AS Qty, t_PrdOrderDetail.PrdOQuantity AS PrdOQty, ISNULL(t_StockOverview.QI,0) AS QI, t_StockOverview.BatchNumber FROM t_PrdOrder INNER JOIN t_PrdOrderDetail ON t_PrdOrder.PrdONumber = t_PrdOrderDetail.PrdONumber LEFT OUTER JOIN t_StockOverview ON t_PrdOrderDetail.ComponentCode = t_StockOverview.MaterialCode WHERE (t_PrdOrderDetail.ComponentCode = N'') AND (t_PrdOrderDetail.PrdONumber = N'')"; this.dsPR = NP.GetClientDataSet(NP_Cls.SqlSelect); grid.DataSource = this.dsPR.Tables[0]; }
private void frmPicking_Load(object sender, EventArgs e) { NP_Cls.SqlSelect = "SELECT 0 AS ItemNo, t_PrdOrderDetail.ComponentCode AS MaterialCode, t_PrdOrderDetail.ComponentName AS MaterialName, t_PrdOrderDetail.PrdOQuantity AS Qty, SUM((ISNULL(t_StockOverview.UR, 0) + ISNULL(t_StockOverview.QI,0)) * isnull(t_VendorInfoRecord.QtyConversion,1)) AS StockQty, SUM(0.000) AS Diff, t_StockOverview.BatchNumber, t_PrdOrderDetail.PrdOQuantity AS CurQty, t_PrdOrderDetail.UnitCode, t_PrdOrderDetail.UnitName, t_PrdOrderDetail.PlantCode, t_PrdOrderDetail.PlantName, t_PrdOrderDetail.LocCode, t_PrdOrderDetail.LocName FROM t_PrdOrderDetail LEFT OUTER JOIN t_StockOverview ON t_PrdOrderDetail.ComponentCode = t_StockOverview.MaterialCode LEFT OUTER JOIN t_VendorInfoRecord ON t_VendorInfoRecord.MaterialCode = t_PrdOrderDetail.ComponentCode WHERE (t_PrdOrderDetail.PrdONumber = N'" + this.txtProdOrder.Text.Trim() + "') GROUP BY t_PrdOrderDetail.ComponentCode, t_PrdOrderDetail.ComponentName, t_PrdOrderDetail.PrdOQuantity,t_StockOverview.BatchNumber, t_PrdOrderDetail.UnitCode, t_PrdOrderDetail.UnitName, t_PrdOrderDetail.PlantCode, t_PrdOrderDetail.PlantName, t_PrdOrderDetail.LocCode, t_PrdOrderDetail.LocName ORDER BY MaterialCode"; DataSet ds = new DataSet(); ds = NP.GetClientDataSet(NP_Cls.SqlSelect); Double DiffBefore = 0; bool IsManyBatch = false; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { ds.Tables[0].Rows[i]["ItemNo"] = i + 1; if (i != ds.Tables[0].Rows.Count - 1) { if (ds.Tables[0].Rows[i]["MaterialCode"].ToString().Trim() == ds.Tables[0].Rows[i + 1]["MaterialCode"].ToString().Trim()) { if (IsManyBatch && DiffBefore == 0) { ds.Tables[0].Rows[i]["Qty"] = 0; ds.Tables[0].Rows[i]["Diff"] = Convert.ToDouble(ds.Tables[0].Rows[i]["StockQty"]); } else if (Convert.ToDouble(ds.Tables[0].Rows[i]["StockQty"]) < Convert.ToDouble(ds.Tables[0].Rows[i]["Qty"])) { DiffBefore = (Convert.ToDouble(ds.Tables[0].Rows[i]["Qty"]) - Convert.ToDouble(ds.Tables[0].Rows[i]["StockQty"])); ds.Tables[0].Rows[i]["Diff"] = 0; ds.Tables[0].Rows[i]["Qty"] = ds.Tables[0].Rows[i]["StockQty"]; } else { ds.Tables[0].Rows[i]["Diff"] = (Convert.ToDouble(ds.Tables[0].Rows[i]["StockQty"]) - Convert.ToDouble(ds.Tables[0].Rows[i]["Qty"])); DiffBefore = 0; } IsManyBatch = true; } else { if (DiffBefore > 0) { ds.Tables[0].Rows[i]["Diff"] = Convert.ToDouble(ds.Tables[0].Rows[i]["StockQty"]) - DiffBefore; } else if (IsManyBatch) { ds.Tables[0].Rows[i]["Qty"] = 0; ds.Tables[0].Rows[i]["Diff"] = Convert.ToDouble(ds.Tables[0].Rows[i]["StockQty"]); } else { ds.Tables[0].Rows[i]["Diff"] = Convert.ToDouble(ds.Tables[0].Rows[i]["StockQty"]) - Convert.ToDouble(ds.Tables[0].Rows[i]["Qty"]); } IsManyBatch = false; DiffBefore = 0; } } else { ds.Tables[0].Rows[i]["Diff"] = Convert.ToDouble(ds.Tables[0].Rows[i]["StockQty"]) - Convert.ToDouble(ds.Tables[0].Rows[i]["Qty"]); } } DataRow[] rows = ds.Tables[0].Select("Qty <= 0"); foreach (DataRow row in rows) { ds.Tables[0].Rows.Remove(row); } this.dgvView.DataSource = ds.Tables[0];; this.dgvView.ClearSelection(); }
private void MyGrid(DataGridView grid) { NP_Cls.SqlSelect = "SELECT 1 AS ItemNo, t_BOMDetail.MaterialCode, m_Material.MaterialName, t_BOMDetail.Quantity AS Qty, m_Material.UnitCode, m_Unit.UnitName, m_Location.LocName, m_Plant.PlantName FROM m_Location RIGHT OUTER JOIN t_BOM INNER JOIN t_BOMDetail ON t_BOM.BOMCode = t_BOMDetail.BOMCode LEFT OUTER JOIN m_Plant RIGHT OUTER JOIN m_Material ON m_Plant.PlantCode = m_Material.PlantCode LEFT OUTER JOIN m_Unit ON m_Material.UnitCode = m_Unit.UnitCode ON t_BOMDetail.MaterialCode = m_Material.MaterialCode ON m_Location.LocCode = m_Material.LocCode WHERE (t_BOM.MaterialCode = N'') AND (t_BOM.FileStatus = N'1') AND (t_BOM.Approve = 1)"; grid.DataSource = NP.GetClientDataSet(NP_Cls.SqlSelect).Tables[0]; }
private void MyGrid(DataGridView grid) { NP_Cls.SqlSelect = "SELECT 1 AS ItemNo, t_StockOverview.MaterialCode, m_Material.MaterialName, t_StockOverview.BatchNumber, t_StockOverview.UR, t_StockOverview.QI, t_StockOverview.Block, t_StockMovementDetail.PlantCode, t_StockMovementDetail.PlantName, t_StockMovementDetail.LocCode, t_StockMovementDetail.LocName, 0 AS TranQuantity, t_StockMovementDetail.UnitCode, t_StockMovementDetail.UnitName, '' as Remark , '' as MovementType FROM t_StockOverview INNER JOIN m_Material ON t_StockOverview.MaterialCode = m_Material.MaterialCode LEFT OUTER JOIN t_StockMovementDetail ON t_StockOverview.AutoID = t_StockMovementDetail.AutoID WHERE (t_StockOverview.MaterialCode = '')"; this.dsPR = NP.GetClientDataSet(NP_Cls.SqlSelect); grid.DataSource = this.dsPR.Tables[0]; }
private void DGV() { NP_Cls.SqlSelect = "SELECT 0 AS ItemNo, t_BOMDetail.BOMCode, t_BOMDetail.BOMDetailCode, t_BOMDetail.Category, t_BOMDetail.MaterialCode, t_BOMDetail.Quantity, m_Material.MaterialName, m_Unit.UnitName, m_Unit.UnitCode, t_BOMDetail.LossPercentage, t_BOMDetail.SortIndex " + "FROM t_BOMDetail INNER JOIN " + "m_Material ON t_BOMDetail.MaterialCode = m_Material.MaterialCode INNER JOIN " + "t_BOM ON t_BOMDetail.BOMCode = t_BOM.BOMCode INNER JOIN " + "m_Unit ON m_Material.UnitCode = m_Unit.UnitCode " + "WHERE (t_BOMDetail.BOMCode = '" + NP_Cls.hBOM["BOMCode"].ToString() + "') ORDER BY t_BOMDetail.SortIndex"; DataSet ds = new DataSet(); ds = NP.GetClientDataSet(NP_Cls.SqlSelect); this.dgvView.DataSource = ds.Tables[0]; if (ds.Tables[0].Rows.Count > 0) { if (NP_Cls.hBOM["BOMType"].ToString().ToUpper() == "M") { Decimal bQty = 0; for (byte i = 0; i < ds.Tables[0].Rows.Count; i++) { ds.Tables[0].Rows[i]["ItemNo"] = i + 1; } for (byte i = 0; i < this.dgvView.RowCount; i++) { if (this.dgvView["clnQty", i].Value.ToString().ToUpper() == "G") { bQty += Convert.ToDecimal(this.dgvView["clnQty", i].Value) / 1000; } else { bQty += Convert.ToDecimal(this.dgvView["clnQty", i].Value); } } this.dQtyChk = 100 - bQty; if (this.dQtyChk == 0) { this.btnSuccess.Visible = true; } else { this.btnSuccess.Visible = false; } this.lblRemain.Text = "Remain: " + (100 - bQty).ToString() + " " + NP_Cls.hBOM["UnitName"].ToString() + " - BOM Type : " + NP_Cls.hBOM["BOMType"].ToString(); this.lblSum.Text = bQty.ToString(); this.lblSumUnit.Text = NP_Cls.hBOM["UnitName"].ToString(); } else { Decimal bQty = 0; for (byte i = 0; i < ds.Tables[0].Rows.Count; i++) { ds.Tables[0].Rows[i]["ItemNo"] = i + 1; } for (byte i = 0; i < this.dgvView.RowCount; i++) { bQty += Convert.ToDecimal(this.dgvView["clnQty", i].Value); } //this.dQtyChk = Convert.ToDecimal(NP_Cls.hBOM["Qty"].ToString()) - bQty; if (this.dQtyChk == 0) { this.btnSuccess.Visible = true; } else { this.btnSuccess.Visible = false; } this.btnSuccess.Visible = true; this.lblRemain.Text = "Remain: " + Convert.ToDecimal(NP_Cls.hBOM["Qty"]).ToString() + " " + NP_Cls.hBOM["UnitName"].ToString() + " - BOM Type : " + NP_Cls.hBOM["BOMType"].ToString(); this.lblSum.Text = bQty.ToString(); this.lblSumUnit.Text = NP_Cls.hBOM["UnitName"].ToString(); } } else { if (NP_Cls.hBOM["BOMType"].ToString().ToUpper() == "M") { this.dQtyChk = Convert.ToDecimal(NP_Cls.hBOM["Qty"].ToString()) - 0; if (this.dQtyChk == 0) { this.btnSuccess.Visible = true; } else { this.btnSuccess.Visible = false; } } else { this.btnSuccess.Visible = true; } this.lblRemain.Text = "Remain: " + NP_Cls.hBOM["Qty"].ToString() + " " + NP_Cls.hBOM["UnitName"].ToString() + " - BOM Type : " + NP_Cls.hBOM["BOMType"].ToString(); this.lblSum.Text = "0"; this.lblSumUnit.Text = NP_Cls.hBOM["UnitName"].ToString(); } }
private void MyGrid(DataGridView grid) { NP_Cls.SqlSelect = "SELECT 1 AS ItemNo, t_StockOverview.MaterialCode, m_Material.MaterialName, t_StockOverview.BatchNumber, t_StockOverview.UR, 0 AS Qty, t_StockOverview.UnitCode, m_Unit.UnitName, t_StockOverview.PlantCode, m_Plant.PlantName, t_StockOverview.LocCode, m_Location.LocName FROM m_Material INNER JOIN t_StockOverview ON m_Material.MaterialCode = t_StockOverview.MaterialCode INNER JOIN m_Unit ON t_StockOverview.UnitCode = m_Unit.UnitCode INNER JOIN m_Plant ON t_StockOverview.PlantCode = m_Plant.PlantCode INNER JOIN m_Location ON t_StockOverview.LocCode = m_Location.LocCode WHERE (1=0) "; grid.DataSource = NP.GetClientDataSet(NP_Cls.SqlSelect).Tables[0]; }