private void refreshProgramming() { DateTime dateString; DateConversion dc = new DateConversion(); dateString = dc.GetDate("January", cmbYear.Text); SqlConnection conn = new SqlConnection(ConnectionStrings.ConnectionString); conn.Open(); SqlCommand cmd = new SqlCommand("usp_kpi_engineering_loop_yearly", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@startDate", SqlDbType.DateTime).Value = dateString; SqlDataAdapter ad = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); ad.Fill(dt); dgvMonthly.DataSource = dt; conn.Close(); paintEngineeringGrid(); }
private void btnRankedCustomerOrders_Click(object sender, EventArgs e) { clearGrid(); DateTime dateString; DateConversion DC = new DateConversion(); dateString = DC.GetDate(cmbMonth.Text, cmbYear.Text); //dateString = Convert.ToDateTime("23/08/2018"); SqlConnection conn = new SqlConnection(ConnectionStrings.ConnectionString); conn.Open(); SqlCommand cmd = new SqlCommand("usp_ranked_customer_orders", conn); cmd.CommandType = CommandType.StoredProcedure; SqlParameter param = new SqlParameter(); param = cmd.Parameters.Add("@start_Date", SqlDbType.DateTime); param.Direction = ParameterDirection.Input; param.Value = dateString; SqlDataAdapter adap = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); adap.Fill(dt); dgvCustomer.DataSource = dt; }
private void populateDailyEngineerGrid(string fullname) { DateTime dateString; DateConversion dc = new DateConversion(); dateString = dc.GetDate(cmbMonth.Text, cmbYear.Text); SqlConnection conn = new SqlConnection(ConnectionStrings.ConnectionString); conn.Open(); SqlCommand cmd = new SqlCommand("usp_kpi_engineering_loop_daily", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@startDate", SqlDbType.DateTime).Value = dateString; cmd.Parameters.AddWithValue("@staffName", SqlDbType.NVarChar).Value = fullname; SqlDataAdapter ad = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); ad.Fill(dt); dgEngineeringDaily.DataSource = dt; conn.Close(); }
private void populatePackTimingsGrid() { DateTime dateString; DateConversion DC = new DateConversion(); dateString = DC.GetDate(cmbMonth.Text, cmbYear.Text); //dateString = Convert.ToDateTime("23/08/2018"); SqlConnection conn = new SqlConnection(ConnectionStrings.ConnectionString); conn.Open(); SqlCommand cmd = new SqlCommand("usp_kpi_pack_timings_grid", conn); cmd.CommandType = CommandType.StoredProcedure; SqlParameter param = new SqlParameter(); param = cmd.Parameters.Add("@start_Date", SqlDbType.DateTime); param.Direction = ParameterDirection.Input; param.Value = dateString; SqlDataAdapter adap = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); adap.Fill(dt); dgPackTimings.DataSource = dt; }
public ProductionStaffTimings(string department, string month, string year) { InitializeComponent(); //Sets up the date string DateConversion DC = new DateConversion(); _dateString = DC.GetDate(month, year); _department = department; populateCombo(); //populateStaffTimings(); }
private void populateLostCustomers() { clearGrid(); DateTime dateString; DateConversion DC = new DateConversion(); dateString = DC.GetDate(cmbMonth.Text, cmbYear.Text); //dateString = Convert.ToDateTime("23/08/2018"); SqlConnection conn = new SqlConnection(ConnectionStrings.ConnectionString); conn.Open(); SqlCommand cmd = new SqlCommand("usp_lost_customer_view", conn); cmd.CommandType = CommandType.StoredProcedure; SqlParameter param = new SqlParameter(); param = cmd.Parameters.Add("@start_Date", SqlDbType.DateTime); param.Direction = ParameterDirection.Input; param.Value = dateString; SqlDataAdapter adap = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); adap.Fill(dt); dgvCustomer.DataSource = dt; //Color the datagrid paintGrid(); //Add button to data grid DataGridViewButtonColumn button = new DataGridViewButtonColumn(); { button.Name = "Button1"; button.HeaderText = "Do Not Contact"; button.Text = "Do Not Contact"; button.UseColumnTextForButtonValue = true; //dont forget this line if (dgvCustomer.Columns["Do Not Contact"] == null) { this.dgvCustomer.Columns.Add(button); } } }
private void DgPackTimings_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { DateTime dateString; DateConversion DC = new DateConversion(); dateString = DC.GetDate(cmbMonth.Text, cmbYear.Text); if (dgPackTimings.SelectedCells.Count > 0) { int selectedrowindex = dgPackTimings.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = dgPackTimings.Rows[selectedrowindex]; string a = Convert.ToString(selectedRow.Cells["Door Type"].Value); frmProductionDoorTypeAnalysis dta = new frmProductionDoorTypeAnalysis(a, dateString, "Packing"); dta.ShowDialog(); } }
private void getCurrent() { DateTime dateString; DateConversion DC = new DateConversion(); dateString = DC.GetDate(cmbMonth.Text, cmbYear.Text); //dateString = Convert.ToDateTime("23/08/2018"); using (SqlConnection con = new SqlConnection(ConnectionStrings.ConnectionString)) { using (SqlCommand cmd = new SqlCommand("usp_kpi_analysis", con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@start_Date", SqlDbType.DateTime).Value = dateString; con.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { txtTraditionalSales.Text = string.Format(CultureInfo.CurrentCulture, "{0:C2}", reader["TraditionalSales"]); txtTraditionalEstimating.Text = string.Format(CultureInfo.CurrentCulture, "{0:C2}", reader["TraditionalEstimating"]); txtTraditionalTurnaround.Text = reader["TraditionalQuotationTurnaround"].ToString(); txtTraditionalConversion.Text = reader["TraditionalConversion"].ToString() + '%'; txtTraditionalQuoteCount.Text = reader["TraditionalQuoteCount"].ToString(); txtSlimlineSales.Text = string.Format(CultureInfo.CurrentCulture, "{0:C2}", reader["SlimlineSales"]); txtSlimlineEstimating.Text = string.Format(CultureInfo.CurrentCulture, "{0:C2}", reader["SlimlineEstimating"]); txtSlimlineTurnaround.Text = reader["SlimlineQuotationTurnaround"].ToString(); txtSlimlineConversion.Text = reader["SlimlineConversion"].ToString() + '%'; txtSlimlineQuoteCount.Text = reader["SlimlineQuoteCount"].ToString(); txtFreehandSales.Text = string.Format(CultureInfo.CurrentCulture, "{0:C2}", reader["FreehandSales"]); txtUniqueCustomers.Text = reader["UniqueCustomers"].ToString(); txtNewCustomer.Text = reader["NewCustomers"].ToString(); txtNonReturning.Text = reader["LostCustomers"].ToString(); txtTop3Sales.Text = string.Format(CultureInfo.CurrentCulture, "{0:C2}", reader["Top3Sales"]); txtTop3Dependancy.Text = string.Format("{0:0.0%}", reader["Top3Dependancy"]); txtPipelineEntries.Text = reader["PipelineAdditions"].ToString(); txtPipelineValues.Text = string.Format(CultureInfo.CurrentCulture, "{0:C2}", reader["PipelineValue"]); txtMeetings.Text = reader["MeetingCount"].ToString(); txtOATurnaround.Text = reader["OATurnaround"].ToString(); //Install related txtReturnInternal.Text = reader["NumberOfReturnVisitsInternal"].ToString(); txtReturnExternal.Text = reader["NumberOfReturnVisitsExternal"].ToString(); txtReturnValue.Text = string.Format(CultureInfo.CurrentCulture, "{0:C2}", reader["ValueOfReturnVisits"]); txtInstallationCost.Text = string.Format(CultureInfo.CurrentCulture, "{0:C2}", reader["InstallationCost"]); txtInstallationSales.Text = string.Format(CultureInfo.CurrentCulture, "{0:C2}", reader["InstallationSales"]); txtInstallationMarkup.Text = reader["InstallationMarkup"].ToString() + '%'; txtBookingInDelay.Text = reader["BookingInDelay"].ToString(); //Production related txtRemakeCount.Text = reader["RemakeCount"].ToString(); txtRepaintCount.Text = reader["RepaintCount"].ToString(); txtDoorsPunched.Text = reader["DoorsPunched"].ToString(); txtDoorsBent.Text = reader["DoorsBent"].ToString(); txtDoorsWelded.Text = reader["DoorsWelded"].ToString(); txtDoorsBuffed.Text = reader["DoorsBuffed"].ToString(); txtDoorsPainted.Text = reader["DoorsPainted"].ToString(); txtDoorsPacked.Text = reader["DoorsPacked"].ToString(); txtDiffToOA.Text = reader["DifferenceToOA"].ToString(); txtAverageSlimlineLeadtime.Text = reader["SlimlineLeadTime"].ToString(); txtAverageTraditionalLeadtime.Text = reader["TraditionalLeadTime"].ToString(); } con.Close(); //Populate accounts data fillAccounts(); } } }
private void generateEngineerData(string fullname) { DateTime dateString; if (cmbMonth.Text == "") { DateConversion dc = new DateConversion(); dateString = dc.GetDate("January", cmbYear.Text); lblEngineerName.Text = fullname; SqlConnection conn = new SqlConnection(ConnectionStrings.ConnectionString); conn.Open(); SqlCommand cmd = new SqlCommand("usp_kpi_detailed_engineering_info_yearly", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@fullName", SqlDbType.NVarChar).Value = fullname; cmd.Parameters.AddWithValue("@startDate", SqlDbType.Date).Value = dateString; SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.Read()) { lblProg.Text = rdr[0].ToString(); lblAssess.Text = rdr[1].ToString(); lblCheck.Text = rdr[2].ToString(); lblDraw.Text = rdr[3].ToString(); lblHoliday.Text = rdr[4].ToString(); lblAbsent.Text = rdr[5].ToString(); lblLate.Text = rdr[6].ToString(); lblOvertimeHours.Text = rdr[7].ToString(); } conn.Close(); populateDailyEngineerGridYearly(fullname); } else { DateConversion dc = new DateConversion(); dateString = dc.GetDate(cmbMonth.Text, cmbYear.Text); lblEngineerName.Text = fullname; SqlConnection conn = new SqlConnection(ConnectionStrings.ConnectionString); conn.Open(); SqlCommand cmd = new SqlCommand("usp_kpi_detailed_engineering_info", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@fullName", SqlDbType.NVarChar).Value = fullname; cmd.Parameters.AddWithValue("@startDate", SqlDbType.Date).Value = dateString; SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.Read()) { lblProg.Text = rdr[0].ToString(); lblAssess.Text = rdr[1].ToString(); lblCheck.Text = rdr[2].ToString(); lblDraw.Text = rdr[3].ToString(); lblHoliday.Text = rdr[4].ToString(); lblAbsent.Text = rdr[5].ToString(); lblLate.Text = rdr[6].ToString(); lblOvertimeHours.Text = rdr[7].ToString(); } conn.Close(); populateDailyEngineerGrid(fullname); } paintEngineeringGridDaily(); programmingLessDetail(); }