/// <summary> /// Runs the comparison report against the supplied filter /// </summary> /// <param name="_fitler">The filter we want to run against this KPA</param> /// <param name="_option">The filter option where this fitler was obtained</param> public override void RunComparison(string _filter, FilterOptions.Options _filterOption) { try { DataTable dt = KpaUtils.FollowUpQueries.GetDueTodayOrLateToConfirmed(); double totalDays = 0; // remove any apostraphe's from the filter as an exception will be thrown. CleanFilter(ref _filter); // Get the fitlered data rows from the datatable DataRow[] filteredResult = dt.Select(FilterOptions.GetSelectStatement(_filterOption, _filter)); foreach (DataRow dr in filteredResult) { //Check if the datarow meets the conditions of any applied filters. if (!Filters.FilterUtils.EvaluateAgainstFilters(dr)) { // This datarow dos not meet the conditions of the filters applied. continue; } string[] strDate = (dr["Latest Conf#Dt"].ToString()).Split('/'); int year = int.Parse(strDate[2]); int month = int.Parse(strDate[0].TrimStart('0')); int day = int.Parse(strDate[1].TrimStart('0')); DateTime date = new DateTime(year, month, day); DateTime today = DateTime.Now.Date; if (date > today) { continue; } double elapsedDays = (today - date).TotalDays; totalDays += elapsedDays; elapsedDays = (int)elapsedDays; // Apply the elapsed days against the time spand conditions template.TimeSpanDump(elapsedDays); } // Calculate the average for this KPA template.CalculateAverage(totalDays); dt.Rows.Clear(); dt = null; GC.Collect(); } catch (Exception) { MessageBox.Show("An argument out of range exception was thrown", "Folow Up -> Due Today or Late to Confirmed - Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
/// <summary> /// Runs the comparison report against the supplied filter /// </summary> /// <param name="_fitler">The filter we want to run against this KPA</param> /// <param name="_option">The filter option where this fitler was obtained</param> public override void RunComparison(string _filter, FilterOptions.Options _filterOption) { try { // Remove any apostrophe's from the filter or an exception will be thrown CleanFilter(ref _filter); // Get the filtered data rows from the datatable DataRow[] filteredResult = DatabaseManager.pr2ndLvlRelDateDt.Select(FilterOptions.GetSelectStatement(_filterOption, _filter)); foreach (DataRow dr in filteredResult) { //Check if the datarow meets the conditions of any applied filters. if (!FilterUtils.EvaluateAgainstFilters(dr)) { // This datarow dos not meet the conditions of the filters applied. continue; } #region EVASO_BUT_NOT_FULLY_RELEASED_CHECK string[] strPrFullyRelDate = (dr["PR Fully Rel Date"].ToString()).Split('/'); int prFullyRelYear = int.Parse(strPrFullyRelDate[2]); int prFullyRelMonth = int.Parse(strPrFullyRelDate[0]); int prFullyRelDay = int.Parse(strPrFullyRelDate[1]); if (prFullyRelYear == 0 && prFullyRelMonth == 0 && prFullyRelDay == 0) { // This PR line or PR in general might have been delted continue; } #endregion DateTime prFullyRelDt = new DateTime(prFullyRelYear, prFullyRelMonth, prFullyRelDay); template.TotalValue += decimal.Parse(dr["PR Pos#Value"].ToString()); DateTime today = DateTime.Now.Date; double elapsedDays = (prFullyRelDt - today).TotalDays; double weeks = Math.Floor(elapsedDays / 7); // Apply the weeks against the time span conditions template.TimeSpanDump(weeks); } } catch (Exception) { MessageBox.Show("An argument out of range exception was thrown", "Other -> PRs Released - Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
/// <summary> /// Get the filters associated with the filter option passed in. /// </summary> /// <param name="_filterOption">The filter being requested.</param> /// <returns>The unique list of filters.</returns> private List <string> GetFilters(FilterOptions.Options _filterOption) { List <string> tempFilterList = new List <string>(); switch (_filterOption) { case FilterOptions.Options.ProjectNumber: return(new List <string>(FilterManager.GetUniqueProjectNumber())); case FilterOptions.Options.WBSElement: return(new List <string>(FilterManager.GetUniqueWbsElement())); case FilterOptions.Options.Material: return(new List <string>(FilterManager.GetUniqueMaterial())); case FilterOptions.Options.MaterialGroup: return(new List <string>(FilterManager.GetUniqueMaterialGroup())); case FilterOptions.Options.Vendor: return(new List <string>(FilterManager.GetUniqueVendor())); case FilterOptions.Options.VendorDescription: return(new List <string>(FilterManager.GetUniqueVendorDescription())); case FilterOptions.Options.PRPurchaseGroup: return(new List <string>(FilterManager.GetUniquePrPurchaseGroup())); case FilterOptions.Options.POPurchaseGroup: return(new List <string>(FilterManager.GetUniquePoPurchaseGroup())); case FilterOptions.Options.IRSuppName: return(new List <string>(FilterManager.GetUniqueIrSuppName())); case FilterOptions.Options.FxdSuppName: return(new List <string>(FilterManager.GetUniqueFxdSuppName())); case FilterOptions.Options.DsrdSuppName: return(new List <string>(FilterManager.GetUniqueDsrdSuppName())); case FilterOptions.Options.CommodityCategory: return(new List <string>(FilterManager.GetUniqueCommodityCategory())); case FilterOptions.Options.PODocumentType: return(new List <string>(FilterManager.GetUniquePoDocumentType())); case FilterOptions.Options.ProductionOrderMaterial: return(new List <string>(FilterManager.GetUniqueProductionOrderMaterial())); case FilterOptions.Options.StorageLocation: return(new List <string>(FilterManager.GetUniqueStorageLocation())); } return(tempFilterList); }
/// <summary> /// Runs the comparison report against the supplied filter /// </summary> /// <param name="_fitler">The filter we want to run against this KPA</param> /// <param name="_option">The filter option where this fitler was obtained</param> public override void RunComparison(string _filter, FilterOptions.Options _filterOption) { try { DataTable dt = KpaUtils.ExcessStockOpenOrdersQueries.GetPrsAgingNotReleased(); double totalDays = 0; // remove any apostraphe's from the filter as an exception will be thrown. CleanFilter(ref _filter); // Get the fitlered data rows from the datatable DataRow[] filteredResult = dt.Select(FilterOptions.GetSelectStatement(_filterOption, _filter)); foreach (DataRow dr in filteredResult) { //Check if the datarow meets the conditions of any applied filters. if (!FilterUtils.EvaluateAgainstFilters(dr)) { // This datarow dos not meet the conditions of the filters applied. continue; } string[] reqCreationDate = (dr["Requisn Date"].ToString()).Split('/'); int year = int.Parse(reqCreationDate[2]); int month = int.Parse(reqCreationDate[0].TrimStart('0')); int day = int.Parse(reqCreationDate[1].TrimStart('0')); DateTime reqDate = new DateTime(year, month, day); DateTime today = DateTime.Now.Date; double elapsedDays = (today - reqDate).TotalDays; totalDays += elapsedDays; elapsedDays = (int)elapsedDays; template.TotalRecords++; } // Calculate the average for this KPA template.CalculateAverage(totalDays); dt.Rows.Clear(); dt = null; GC.Collect(); } catch (Exception) { MessageBox.Show("An argument out of range exception was thrown", "Excess Stock - Open Orders -> PR Aging (Not Released) - Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
/// <summary> /// Runs the comparison report against the supplied filter /// </summary> /// <param name="_fitler">The filter we want to run against this KPA</param> /// <param name="_option">The filter option where this fitler was obtained</param> public override void RunComparison(string _filter, FilterOptions.Options _filterOption) { try { // Remove any apostrophe's from the filter or an exception will be thrown CleanFilter(ref _filter); // Get the filtered data rows from the datatable DataRow[] filteredResult = DatabaseManager.AllDataDt.Select(FilterOptions.GetSelectStatement(_filterOption, _filter)); foreach (DataRow dr in filteredResult) { //Check if the datarow meets the conditions of any applied filters. if (!FilterUtils.EvaluateAgainstFilters(dr)) { // This datarow dos not meet the conditions of the filters applied. continue; } // Check if this record is a hot job if (dr["Purch# Group"].ToString() != "UHJ") { continue; } string[] strPrReqDt = (dr["Requisn Date"].ToString()).Split('/'); int reqDateYear = int.Parse(strPrReqDt[2]); int reqDateMonth = int.Parse(strPrReqDt[0].TrimStart('0')); int reqDateDay = int.Parse(strPrReqDt[1].TrimStart('0')); DateTime prReqDate = new DateTime(reqDateYear, reqDateMonth, reqDateDay); // Get the total value for this line item template.TotalValue += decimal.Parse(dr["PR Pos#Value"].ToString()); DateTime today = DateTime.Now.Date; double elapsedDays = (prReqDate - today).TotalDays; double weeks = Math.Floor(elapsedDays / 7); // Apply the weeks against the time span conditions template.TimeSpanDump(weeks); } } catch (Exception) { MessageBox.Show("An argument out of range exception was thrown", "Other -> Hot Job PRs - Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
/// <summary> /// Abstract method to calculate the data for the comparison report /// </summary> /// <param name="_filter">The filter currently running against the KPI</param> /// <param name="_filterOption">The filter option chosen to apply against the comparison report</param> public abstract void RunComparison(string _filter, FilterOptions.Options _filterOption);
/// <summary> /// Runs the comparison report against the supplied filter /// </summary> /// <param name="_fitler">The filter we want to run against this KPA</param> /// <param name="_option">The filter option where this fitler was obtained</param> public override void RunComparison(string _filter, FilterOptions.Options _filterOption) { try { // Remove any apostrophe's from the filter or an exception will be thrown CleanFilter(ref _filter); // Get the filtered data rows from the datatable DataRow[] filteredResult = DatabaseManager.prsOnPOsDt.Select(FilterOptions.GetSelectStatement(_filterOption, _filter)); foreach (DataRow dr in filteredResult) { //Check if the datarow meets the conditions of any applied filters. if (!FilterUtils.EvaluateAgainstFilters(dr)) { // This datarow dos not meet the conditions of the filters applied. continue; } string[] strPoCreateDt = (dr["PO Line Creat#DT"].ToString()).Split('/'); int poCreateDtYear = int.Parse(strPoCreateDt[2]); int poCreateDtMonth = int.Parse(strPoCreateDt[0]); int poCreateDtDay = int.Parse(strPoCreateDt[1]); ////////////////////////////////////////////////////////////////////////////// // // The below if statement was added on 03/27/2018. // ----------------------------------------------- // There was some issues with a few POs that conatined dates of 00/00/0000 // that were causing erros. This if else statement ignores those files. // ////////////////////////////////////////////////////////////////////////////// if (poCreateDtDay == 0 && poCreateDtMonth == 0 && poCreateDtYear == 0) { // This situation is a SAP issue. We should never have POs that dont // have a PO creation date. // Skip these records continue; } else { // trim the zeros off of month and day if there is any. poCreateDtMonth = int.Parse(strPoCreateDt[0].Trim('0')); poCreateDtDay = int.Parse(strPoCreateDt[1].Trim('0')); } DateTime poCreateDate = new DateTime(poCreateDtYear, poCreateDtMonth, poCreateDtDay); template.TotalValue += decimal.Parse(dr["PO Value"].ToString()); DateTime today = DateTime.Now.Date; double elapsedDays = (poCreateDate - today).TotalDays; double weeks = Math.Floor(elapsedDays / 7); // apply the weeks against the time span conditions template.TimeSpanDumpV2(weeks, dr); } } catch (Exception) { MessageBox.Show("An argument out of range exception was thrown", "Other -> Total Spend - Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
/// <summary> /// Runs the comparison report against the supplied filter /// </summary> /// <param name="_fitler">The filter we want to run against this KPA</param> /// <param name="_option">The filter option where this fitler was obtained</param> public override void RunComparison(string _filter, FilterOptions.Options _filterOption) { try { DataTable dt = KpaUtils.CurrentPlanVsActualQueries.GetCurrentPlanDateVsCurrentConfirmationDateForHotJobs(); double totalDays = 0; // remove any apostraphe's from the filter as an exception will be thrown. CleanFilter(ref _filter); // Get the fitlered data rows from the datatable DataRow[] filteredResult = dt.Select(FilterOptions.GetSelectStatement(_filterOption, _filter)); foreach (DataRow dr in filteredResult) { //Check if the datarow meets the conditions of any applied filters. if (!Filters.FilterUtils.EvaluateAgainstFilters(dr)) { // This datarow dos not meet the conditions of the filters applied. continue; } string[] strDate = (dr["Latest Conf#Dt"].ToString()).Split('/'); int year = int.Parse(strDate[2]); int month = int.Parse(strDate[0].TrimStart('0')); int day = int.Parse(strDate[1].TrimStart('0')); DateTime confDate = new DateTime(year, month, day); string[] strCurrPlanDate = (dr["Rescheduling date"].ToString()).Split('/'); int currConfYear = int.Parse(strCurrPlanDate[2]); int currConfMonth = int.Parse(strCurrPlanDate[0]); int currConfDay = int.Parse(strCurrPlanDate[1]); if (currConfYear == 0 && currConfMonth == 0 && currConfDay == 0) { string[] strNewCurrConfDate = (dr["Delivery Date"].ToString()).Split('/'); currConfYear = int.Parse(strNewCurrConfDate[2]); currConfMonth = int.Parse(strNewCurrConfDate[0].TrimStart('0')); currConfDay = int.Parse(strNewCurrConfDate[1].TrimStart('0')); } else { currConfYear = int.Parse(strCurrPlanDate[2]); currConfMonth = int.Parse(strCurrPlanDate[0].TrimStart('0')); currConfDay = int.Parse(strCurrPlanDate[1].TrimStart('0')); } DateTime currPlanDate = new DateTime(currConfYear, currConfMonth, currConfDay); double elapsedDays = (confDate - currPlanDate).TotalDays; // keep this a double so we can calculate an acccurate average // Our time spans are in weeks but we want to catch the average amount of days. totalDays += elapsedDays; elapsedDays = (int)elapsedDays; // Apply the elapsed days against the time spand conditions template.TimeSpanDump(elapsedDays); } // Calculate the average for this KPA template.CalculateAverage(totalDays); // Get the Percent Favorable for this KPA CalculatePercentFavorable(); dt.Rows.Clear(); dt = null; GC.Collect(); } catch (Exception) { MessageBox.Show("An argument out of range exception was thrown", "Current Plan Date vs Curren Confirmation date for Hot Jobs - Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
/// <summary> /// Runs the comparison report against the supplied filter /// </summary> /// <param name="_fitler">The filter we want to run against this KPA</param> /// <param name="_option">The filter option where this fitler was obtained</param> public override void RunComparison(string _filter, FilterOptions.Options _filterOption) { double totalDays = 0; try { // Remove any apostrophe's from the filter or an exception will be thrown CleanFilter(ref _filter); // Get the filtered data rows from the datatable DataRow[] filteredResult = DatabaseManager.pr2ndLvlRelDateDt.Select(FilterOptions.GetSelectStatement(_filterOption, _filter)); foreach (DataRow dr in filteredResult) { //Check if the datarow meets the conditions of any applied filters. if (!FilterUtils.EvaluateAgainstFilters(dr)) { // This datarow dos not meet the conditions of the filters applied. continue; } string[] strPrPlanDate = (dr["PR Delivery Date"].ToString()).Split('/'); int delConfYear = int.Parse(strPrPlanDate[2]); int delConfMonth = int.Parse(strPrPlanDate[0].TrimStart('0')); int delConfDay = int.Parse(strPrPlanDate[1].TrimStart('0')); #region EVASO_BUT_NOT_FULLY_RELEASED_CHECK string[] strPrFullyRelDate = (dr["PR Fully Rel Date"].ToString()).Split('/'); int prFullyRelYear = int.Parse(strPrFullyRelDate[2]); int prFullyRelMonth = int.Parse(strPrFullyRelDate[0]); int prFullyRelDay = int.Parse(strPrFullyRelDate[1]); if (prFullyRelYear == 0 && prFullyRelMonth == 0 && prFullyRelDay == 0) { // This PR line or PR in general might have been delted continue; } #endregion DateTime prFullyRelDt = new DateTime(prFullyRelYear, prFullyRelMonth, prFullyRelDay); DateTime prPlanDate = new DateTime(delConfYear, delConfMonth, delConfDay); int commCodeLeadTime = int.Parse(dr["Pl# Deliv# Time"].ToString()); double elapsedDays = (prPlanDate - prFullyRelDt).TotalDays; elapsedDays -= commCodeLeadTime; totalDays += elapsedDays; // Apply the elapsed days against the time span conditions template.TimeSpanDump(elapsedDays); } // Calculate the average for this KPI template.CalculateAverage(totalDays); // Calculate the percent facvorable for this KPI CalculatePercentFavorable(); } catch (Exception) { MessageBox.Show("An argument out of range exception was thrown", "KPI - Plan -> (Original Plan Date - 2nd Lvl Release Date) vs Coded Lead-Time - Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
/// <summary> /// Runs the comparison report against the supplied filter /// </summary> /// <param name="_fitler">The filter we want to run against this KPA</param> /// <param name="_option">The filter option where this fitler was obtained</param> public override void RunComparison(string _filter, FilterOptions.Options _filterOption) { double totalDays = 0; try { // Remove any apostrophe's from the filter or an exception will be thrown CleanFilter(ref _filter); // Get the filtered data rows from the datatable DataRow[] filteredResult = DatabaseManager.prsOnPOsDt.Select(FilterOptions.GetSelectStatement(_filterOption, _filter)); foreach (DataRow dr in filteredResult) { //Check if the datarow meets the conditions of any applied filters. if (!FilterUtils.EvaluateAgainstFilters(dr)) { // This datarow dos not meet the conditions of the filters applied. continue; } string[] strPrPlanDate = (dr["PR Delivery Date"].ToString()).Split('/'); int delConfYear = int.Parse(strPrPlanDate[2]); int delConfMonth = int.Parse(strPrPlanDate[0].TrimStart('0')); int delConfDay = int.Parse(strPrPlanDate[1].TrimStart('0')); DateTime prPlanDate = new DateTime(delConfYear, delConfMonth, delConfDay); string[] strCurrPlanDate = (dr["Rescheduling date"].ToString()).Split('/'); int currConfYear = int.Parse(strCurrPlanDate[2]); int currConfMonth = int.Parse(strCurrPlanDate[0]); int currConfDay = int.Parse(strCurrPlanDate[1]); if (currConfYear == 0 && currConfMonth == 0 && currConfDay == 0) { string[] strNewCurrConfDate = (dr["Delivery Date"].ToString()).Split('/'); currConfYear = int.Parse(strNewCurrConfDate[2]); currConfMonth = int.Parse(strNewCurrConfDate[0]); currConfDay = int.Parse(strNewCurrConfDate[1]); ////////////////////////////////////////////////////////////////////////////// // // // The below if statement was added on 03/27/2018. // ----------------------------------------------- // There was some issues with a few POs that conatined dates of 00/00/0000 // that were causing erros. This if else statement ignores those files. // ////////////////////////////////////////////////////////////////////////////// if (currConfDay == 0 && currConfMonth == 0 && currConfYear == 0) { // This situation is a SAP issue. We should never have POs that dont // have a PO creation date. // Skip these records continue; } else { // trim the zeros off of month and day if there is any. currConfMonth = int.Parse(strNewCurrConfDate[0].Trim('0')); currConfDay = int.Parse(strNewCurrConfDate[1].Trim('0')); } } else { currConfYear = int.Parse(strCurrPlanDate[2]); currConfMonth = int.Parse(strCurrPlanDate[0].TrimStart('0')); currConfDay = int.Parse(strCurrPlanDate[1].TrimStart('0')); } DateTime reqDate = new DateTime(currConfYear, currConfMonth, currConfDay); double elapsedDays = (reqDate - prPlanDate).TotalDays; totalDays += elapsedDays; // Apply the elapsed days against the time span conditions template.TimeSpanDump(elapsedDays); } // Calculate the average for this KPI template.CalculateAverage(totalDays); // Calculate the Percent favorable for this KPI CalculatePercentFavorable(); } catch (Exception) { MessageBox.Show("An argument out of range exception was thrown", "KPI - Plan -> Current Plan Date vs PR Plan Date - Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
/// <summary> /// Runs the comparison report against the supplied filter /// </summary> /// <param name="_fitler">The filter we want to run against this KPA</param> /// <param name="_option">The filter option where this fitler was obtained</param> public override void RunComparison(string _filter, FilterOptions.Options _filterOption) { double totalDays = 0; try { // Remove any apostrophe's from the filter or an exception will be thrown CleanFilter(ref _filter); // Get the filtered data rows from the datatable DataRow[] filteredResult = DatabaseManager.prsOnPOsDt.Select(FilterOptions.GetSelectStatement(_filterOption, _filter)); foreach (DataRow dr in filteredResult) { //Check if the datarow meets the conditions of any applied filters. if (!FilterUtils.EvaluateAgainstFilters(dr)) { // This datarow dos not meet the conditions of the filters applied. continue; } string[] strPoLineFirstRelDate = (dr["PO Line 1st Rel Dt"].ToString()).Split('/'); int poLineFirstRelYear = int.Parse(strPoLineFirstRelDate[2]); int poLineFirstRelMonth = int.Parse(strPoLineFirstRelDate[0]); int poLineFirstRelDay = int.Parse(strPoLineFirstRelDate[1]); if (poLineFirstRelYear == 0 && poLineFirstRelMonth == 0 && poLineFirstRelDay == 0) { continue; } else { poLineFirstRelYear = int.Parse(strPoLineFirstRelDate[2]); poLineFirstRelMonth = int.Parse(strPoLineFirstRelDate[0].TrimStart('0')); poLineFirstRelDay = int.Parse(strPoLineFirstRelDate[1].TrimStart('0')); } DateTime poLineFirstRelDate = new DateTime(poLineFirstRelYear, poLineFirstRelMonth, poLineFirstRelDay); string[] strPRDelDate = (dr["PR Delivery Date"].ToString()).Split('/'); int prDelYear = int.Parse(strPRDelDate[2]); int prDelMonth = int.Parse(strPRDelDate[0].TrimStart('0')); int prDelDay = int.Parse(strPRDelDate[1].TrimStart('0')); DateTime prDelDate = new DateTime(prDelYear, prDelMonth, prDelDay); double elapsedDays = (prDelDate - poLineFirstRelDate).TotalDays; totalDays += elapsedDays; elapsedDays = (int)elapsedDays; // Apply the elapsed days against the time span conditions template.TimeSpanDump(elapsedDays); } // Calculate the average for this KPI template.CalculateAverage(totalDays); } catch (Exception) { MessageBox.Show("An argument out of range exception was thrown", "KPI - PUrch/Plan -> PO Release vs PR Delivery Date - Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
/// <summary> /// Runs the comparison report against the supplied filter /// </summary> /// <param name="_fitler">The filter we want to run against this KPA</param> /// <param name="_option">The filter option where this fitler was obtained</param> public override void RunComparison(string _filter, FilterOptions.Options _filterOption) { double totalDays = 0; try { // Remove any apostraphe's from the filter or an exception will be thrown CleanFilter(ref _filter); // Get the fitlered data rows from the datatable DataRow[] filteredResult = DatabaseManager.posRecCompDt.Select(FilterOptions.GetSelectStatement(_filterOption, _filter)); foreach (DataRow dr in DatabaseManager.posRecCompDt.Rows) { //Check if the datarow meets the conditions of any applied filters. if (!Filters.FilterUtils.EvaluateAgainstFilters(dr)) { // This datarow dos not meet the conditions of the filters applied. continue; } string[] strDelConfDate = (dr["Latest Conf#Dt"].ToString()).Split('/'); int delConfYear = int.Parse(strDelConfDate[2]); int delConfMonth = int.Parse(strDelConfDate[0]); int delConfDay = int.Parse(strDelConfDate[1]); if (delConfYear == 0 && delConfMonth == 0 && delConfDay == 0) { UnconfirmedTotal++; template.TotalRecords++; continue; } else { delConfYear = int.Parse(strDelConfDate[2]); delConfMonth = int.Parse(strDelConfDate[0].TrimStart('0')); delConfDay = int.Parse(strDelConfDate[1].TrimStart('0')); } DateTime delConfDate = new DateTime(delConfYear, delConfMonth, delConfDay); string[] strDelDate = (dr["Delivery Date"].ToString()).Split('/'); int delYear = int.Parse(strDelDate[2]); int delMonth = int.Parse(strDelDate[0].TrimStart('0')); int delDay = int.Parse(strDelDate[1].TrimStart('0')); DateTime delDate = new DateTime(delYear, delMonth, delDay); double elapsedDays = (delConfDate - delDate).TotalDays; totalDays += elapsedDays; // Apply the elpased days against the time span conditions template.TimeSpanDump(elapsedDays); } // Caclualte the percent unconfirmed CalculatePercentUnconfirmed(UnconfirmedTotal); // Calculate the average for this KPI template.CalculateAverage(totalDays); // Calculate percent favorable CalculatePercentFavorable(); } catch (Exception) { MessageBox.Show("An argument out of range exception was thrown", "Follow Up -> Final Confirmation Date vs Final Plan Date - Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
/// <summary> /// Runs the comparison report against the supplied filter /// </summary> /// <param name="_fitler">The filter we want to run against this KPA</param> /// <param name="_option">The filter option where this fitler was obtained</param> public override void RunComparison(string _filter, FilterOptions.Options _filterOption) { double totalDays = 0; try { // Remove any apostrophe's from the filter or an exception will be thrown CleanFilter(ref _filter); // Get the filtered data rows from the datatable DataRow[] filteredResult = DatabaseManager.prsOnPOsDt.Select(FilterOptions.GetSelectStatement(_filterOption, _filter)); foreach (DataRow dr in filteredResult) { //Check if the datarow meets the conditions of any applied filters. if (!FilterUtils.EvaluateAgainstFilters(dr)) { // This datarow dos not meet the conditions of the filters applied. continue; } string[] strfirstConfCreateDt = (dr["1st Conf Creation Da"].ToString()).Split('/'); int firstConfCreateYear = int.Parse(strfirstConfCreateDt[2]); int firstConfCreateMonth = int.Parse(strfirstConfCreateDt[0]); int firstConfCreateDay = int.Parse(strfirstConfCreateDt[1]); if (firstConfCreateYear == 0 && firstConfCreateMonth == 0 & firstConfCreateDay == 0) { UnconfirmedTotal++; template.TotalRecords++; continue; } else { firstConfCreateYear = int.Parse(strfirstConfCreateDt[2]); firstConfCreateMonth = int.Parse(strfirstConfCreateDt[0].TrimStart('0')); firstConfCreateDay = int.Parse(strfirstConfCreateDt[1].TrimStart('0')); } DateTime poLineConfCreateDate = new DateTime(firstConfCreateYear, firstConfCreateMonth, firstConfCreateDay); #region EVASO_BUT_NOT_FULLY_RELEASED_CHECK string[] strPrFullyRelDate = (dr["PR Fully Rel Date"].ToString()).Split('/'); int prFullyRelYear = int.Parse(strPrFullyRelDate[2]); int prFullyRelMonth = int.Parse(strPrFullyRelDate[0]); int prFullyRelDay = int.Parse(strPrFullyRelDate[1]); if (prFullyRelYear == 0 && prFullyRelMonth == 0 && prFullyRelDay == 0) { // This PR line or PR in general might have been delted continue; } #endregion DateTime prFullyRelDt = new DateTime(prFullyRelYear, prFullyRelMonth, prFullyRelDay); double elapsedDays = (poLineConfCreateDate - prFullyRelDt).TotalDays; totalDays += elapsedDays; elapsedDays = (int)elapsedDays; // Apply the elapsed days against the time span conditions template.TimeSpanDump(elapsedDays); } // Calculate the percent uncofirmed for this KPI CalculatePercentUnconfirmed(UnconfirmedTotal); // Calculate the average for this KPI template.CalculateAverage(totalDays); } catch (Exception) { MessageBox.Show("An argument out of range exception was thrown", "KPI - Purch Total -> PR Release to Confirmed Entry Date - Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
/// <summary> /// Runs the comparison report against the supplied filter /// </summary> /// <param name="_fitler">The filter we want to run against this KPA</param> /// <param name="_option">The filter option where this fitler was obtained</param> public override void RunComparison(string _filter, FilterOptions.Options _filterOption) { double totalDays = 0; try { // Remove any apostrophe's from the filter or an exception will be thrown CleanFilter(ref _filter); // Get the filtered data rows from the datatable DataRow[] filteredResult = DatabaseManager.prsOnPOsDt.Select(FilterOptions.GetSelectStatement(_filterOption, _filter)); foreach (DataRow dr in filteredResult) { //Check if the datarow meets the conditions of any applied filters. if (!FilterUtils.EvaluateAgainstFilters(dr)) { // This datarow dos not meet the conditions of the filters applied. continue; } #region EVASO_BUT_NOT_FULLY_RELEASED_CHECK string[] strPrFullyRelDate = (dr["PR Fully Rel Date"].ToString()).Split('/'); int prFullyRelYear = int.Parse(strPrFullyRelDate[2]); int prFullyRelMonth = int.Parse(strPrFullyRelDate[0]); int prFullyRelDay = int.Parse(strPrFullyRelDate[1]); if (prFullyRelYear == 0 && prFullyRelMonth == 0 && prFullyRelDay == 0) { // This PR line or PR in general might have been delted continue; } #endregion DateTime prFullyRelDt = new DateTime(prFullyRelYear, prFullyRelMonth, prFullyRelDay); string[] strCurrPlanDate = (dr["Rescheduling date"].ToString()).Split('/'); int origPlanYear = int.Parse(strCurrPlanDate[2]); int origPlanMonth = int.Parse(strCurrPlanDate[0]); int origPlanDay = int.Parse(strCurrPlanDate[1]); if (origPlanYear == 0 && origPlanMonth == 0 && origPlanDay == 0) { string[] strNewCurrPlanDelDate = (dr["Delivery Date"].ToString()).Split('/'); origPlanYear = int.Parse(strNewCurrPlanDelDate[2]); origPlanMonth = int.Parse(strNewCurrPlanDelDate[0]); origPlanDay = int.Parse(strNewCurrPlanDelDate[1]); if (origPlanYear == 0 && origPlanMonth == 0 && origPlanDay == 0) { string[] strNewCurrPlanPrDelDate = (dr["PR Delivery Date"].ToString()).Split('/'); origPlanYear = int.Parse(strNewCurrPlanPrDelDate[2]); origPlanMonth = int.Parse(strNewCurrPlanPrDelDate[0].TrimStart('0')); origPlanDay = int.Parse(strNewCurrPlanPrDelDate[1].TrimStart('0')); } else { origPlanYear = int.Parse(strNewCurrPlanDelDate[2]); origPlanMonth = int.Parse(strNewCurrPlanDelDate[0].TrimStart('0')); origPlanDay = int.Parse(strNewCurrPlanDelDate[1].TrimStart('0')); } } else { origPlanYear = int.Parse(strCurrPlanDate[2]); origPlanMonth = int.Parse(strCurrPlanDate[0].TrimStart('0')); origPlanDay = int.Parse(strCurrPlanDate[1].TrimStart('0')); } DateTime currPlanDate = new DateTime(origPlanYear, origPlanMonth, origPlanDay); double elapsedDays = (currPlanDate - prFullyRelDt).TotalDays; totalDays += elapsedDays; // Apply the elapsed days against the time span conditions template.TimeSpanDump(elapsedDays); } // Calculate the average for this KPI template.CalculateAverage(totalDays); } catch (Exception) { MessageBox.Show("An argument out of range exception was thrown", "KPI - Plan II -> Material Due (Final Planned Date) -Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
/// <summary> /// Runs the comparison report against the supplied filter /// </summary> /// <param name="_fitler">The filter we want to run against this KPA</param> /// <param name="_option">The filter option where this fitler was obtained</param> public override void RunComparison(string _filter, FilterOptions.Options _filterOption) { try { DataTable dt = KpaUtils.PurchQueries.GetPoFirstRelease(); double totalDays = 0; // remove any apostraphe's from the filter as an exception will be thrown. CleanFilter(ref _filter); // Get the fitlered data rows from the datatable DataRow[] filteredResult = dt.Select(FilterOptions.GetSelectStatement(_filterOption, _filter)); foreach (DataRow dr in filteredResult) { //Check if the datarow meets the conditions of any applied filters. if (!Filters.FilterUtils.EvaluateAgainstFilters(dr)) { // This datarow dos not meet the conditions of the filters applied. continue; } string[] strDate = (dr["PO Line Creat#DT"].ToString()).Split('/'); int year = int.Parse(strDate[2]); int month = int.Parse(strDate[0]); int day = int.Parse(strDate[1]); ////////////////////////////////////////////////////////////////////////////// // // // The below if statement was added on 03/27/2018. // ----------------------------------------------- // There was some issues with a few POs that conatined dates of 00/00/0000 // that were causing erros. This if else statement ignores those files. // ////////////////////////////////////////////////////////////////////////////// if (day == 0 && month == 0 && year == 0) { // This situation is a SAP issue. We should never have POs that dont // have a PO creation date. // Skip these records continue; } else { // trim the zeros off of month and day if there is any. month = int.Parse(strDate[0].Trim('0')); day = int.Parse(strDate[1].Trim('0')); } DateTime date = new DateTime(year, month, day); DateTime today = DateTime.Now.Date; double elapsedDays = (today - date).TotalDays; totalDays += elapsedDays; elapsedDays = (int)elapsedDays; // Apply the elapsed days against the time span dump template.TimeSpanDump(elapsedDays); } // Calculate the average for this KPA template.CalculateAverage(totalDays); dt.Rows.Clear(); dt = null; GC.Collect(); } catch (Exception) { MessageBox.Show("An argument out of range exception was thrown", "Purch -> PO First Release - Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
/// <summary> /// Runs the comparison report against the supplied filter /// </summary> /// <param name="_fitler">The filter we want to run against this KPA</param> /// <param name="_option">The filter option where this fitler was obtained</param> public override void RunComparison(string _filter, FilterOptions.Options _filterOption) { double totalDays = 0; try { // Remove any apostrophe's from the filter or an exception will be thrown CleanFilter(ref _filter); // Get the filtered data rows from the datatable DataRow[] filteredResult = DatabaseManager.prsOnPOsDt.Select(FilterOptions.GetSelectStatement(_filterOption, _filter)); foreach (DataRow dr in filteredResult) { //Check if the datarow meets the conditions of any applied filters. if (!FilterUtils.EvaluateAgainstFilters(dr)) { // This datarow dos not meet the conditions of the filters applied. continue; } string[] strFirstConfCreateDate = (dr["1st Conf Creation Da"].ToString()).Split('/'); int poLineFirstConfCreateYear = int.Parse(strFirstConfCreateDate[2]); int poLineFirstConfCreateMonth = int.Parse(strFirstConfCreateDate[0]); int poLineFirstConfCreateDay = int.Parse(strFirstConfCreateDate[1]); if (poLineFirstConfCreateYear == 0 && poLineFirstConfCreateMonth == 0 && poLineFirstConfCreateDay == 0) { UnconfirmedTotal++; template.TotalRecords++; continue; } else { poLineFirstConfCreateYear = int.Parse(strFirstConfCreateDate[2]); poLineFirstConfCreateMonth = int.Parse(strFirstConfCreateDate[0]); poLineFirstConfCreateDay = int.Parse(strFirstConfCreateDate[1]); } DateTime initialConfCreateDate = new DateTime(poLineFirstConfCreateYear, poLineFirstConfCreateMonth, poLineFirstConfCreateDay); string[] strPOLineCreateDt = (dr["PO Line Creat#DT"].ToString()).Split('/'); int poLineCreateYear = int.Parse(strPOLineCreateDt[2]); int poLineCreateMonth = int.Parse(strPOLineCreateDt[0].Trim('0')); int poLineCreateDay = int.Parse(strPOLineCreateDt[1]); DateTime poLineItemCreateDate = new DateTime(poLineCreateYear, poLineCreateMonth, poLineCreateDay); double elapsedDays = (initialConfCreateDate - poLineItemCreateDate).TotalDays; totalDays += elapsedDays; elapsedDays = (int)elapsedDays; // Apply the elapsed days against the time span conditions template.TimeSpanDump(elapsedDays); } // Calculate the average for this KPI template.CalculateAverage(totalDays); // Calculate the percent unconfirmed for this KPI CalculatePercentUnconfirmed(UnconfirmedTotal); } catch (Exception) { MessageBox.Show("An argument out of range exception was thrown", "KPI - Purch Sub -> PO Creation vs Confirmation Entry - Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
/// <summary> /// Runs the comparison report against the supplied filter /// </summary> /// <param name="_fitler">The filter we want to run against this KPA</param> /// <param name="_option">The filter option where this fitler was obtained</param> public override void RunComparison(string _filter, FilterOptions.Options _filterOption) { double totalDays = 0; try { // Remove any apostrophe's from the filter or an exception will be thrown CleanFilter(ref _filter); // Get the filtered data rows from the datatable DataRow[] filteredResult = DatabaseManager.prFullyReleasedDt.Select(FilterOptions.GetSelectStatement(_filterOption, _filter)); foreach (DataRow dr in filteredResult) { //Check if the datarow meets the conditions of any applied filters. if (!FilterUtils.EvaluateAgainstFilters(dr)) { // This datarow dos not meet the conditions of the filters applied. continue; } #region EVASO_BUT_NOT_FULLY_RELEASED_CHECK string[] strPrFullyRelDate = (dr["PR Fully Rel Date"].ToString()).Split('/'); int prFullyRelYear = int.Parse(strPrFullyRelDate[2]); int prFullyRelMonth = int.Parse(strPrFullyRelDate[0]); int prFullyRelDay = int.Parse(strPrFullyRelDate[1]); if (prFullyRelYear == 0 && prFullyRelMonth == 0 && prFullyRelDay == 0) { // This PR line or PR in general might have been deleted continue; } #endregion // Get the Requisition date and seperate the date into year, month, and day integers string[] strReqCreateDate = (dr["Requisn Date"].ToString()).Split('/'); int reqCreateYear = int.Parse(strReqCreateDate[2]); int reqCreateMonth = int.Parse(strReqCreateDate[0].TrimStart('0')); int reqCreateDay = int.Parse(strReqCreateDate[1].TrimStart('0')); // Create the date objects DateTime reqCreateDate = new DateTime(reqCreateYear, reqCreateMonth, reqCreateDay); DateTime prFullReleaseDate = new DateTime(prFullyRelYear, prFullyRelMonth, prFullyRelDay); double elapsedDays = (prFullReleaseDate - reqCreateDate).TotalDays; totalDays += elapsedDays; // Apply the elapsed days against the time span dump template.TimeSpanDump(elapsedDays); } // Calculate the average for this KPI template.CalculateAverage(totalDays); } catch (Exception) { MessageBox.Show("An argument out of range exception was thrown", "KPI - Plan II -> PR Release Date vs PR Creation Date - Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
/// <summary> /// Runs the comparison report against the supplied filter /// </summary> /// <param name="_fitler">The filter we want to run against this KPA</param> /// <param name="_option">The filter option where this fitler was obtained</param> public override void RunComparison(string _filter, FilterOptions.Options _filterOption) { double totalDays = 0; try { // Remove any apostraphe's from the filter or an exception will be thrown CleanFilter(ref _filter); // Get the fitlered data rows from the datatable DataRow[] filteredResult = DatabaseManager.posRecCompDt.Select(FilterOptions.GetSelectStatement(_filterOption, _filter)); foreach (DataRow dr in filteredResult) { //Check if the datarow meets the conditions of any applied filters. if (!FilterUtils.EvaluateAgainstFilters(dr)) { // This datarow dos not meet the conditions of the filters applied. continue; } #region EVASO_BUT_NO_REC_DATE_CHECK string[] strLastPORecDate = (dr["Last PO Rec#Date"].ToString()).Split('/'); int lastPORecDtYear = int.Parse(strLastPORecDate[2]); int lastPORecDtMonth = int.Parse(strLastPORecDate[0]); int lastPORecDtDay = int.Parse(strLastPORecDate[1]); if (lastPORecDtYear == 0 && lastPORecDtMonth == 0 && lastPORecDtDay == 0) { // this po line or po in general may have been deleted. continue; } #endregion DateTime lastPORecDate = new DateTime(lastPORecDtYear, lastPORecDtMonth, lastPORecDtDay); string[] strFirstConfDate = (dr["1st Conf Date"].ToString()).Split('/'); int firstConfYear = int.Parse(strFirstConfDate[2]); int firstConfMonth = int.Parse(strFirstConfDate[0]); int firstConfDay = int.Parse(strFirstConfDate[1]); if (firstConfYear == 0 && firstConfMonth == 0 && firstConfDay == 0) { UnconfirmedTotal++; template.TotalRecords++; continue; } else { firstConfYear = int.Parse(strFirstConfDate[2]); firstConfMonth = int.Parse(strFirstConfDate[0].TrimStart('0')); firstConfDay = int.Parse(strFirstConfDate[1].TrimStart('0')); } DateTime firstConfDate = new DateTime(firstConfYear, firstConfMonth, firstConfDay); double elapsedDays = (lastPORecDate - firstConfDate).TotalDays; totalDays += elapsedDays; // Apply the elpased days against the time span conditions template.TimeSpanDump(elapsedDays); } // Caclualte the percent unconfirmed CalculatePercentUnconfirmed(UnconfirmedTotal); // Calculate the average for this KPI template.CalculateAverage(totalDays); // Calculate the percent favorable CalculatePercentFavorable(); } catch (Exception) { MessageBox.Show("An argument out of range exception was thrown", "Follow Up -> Receipt Date vs Original Confirmation Date - Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
/// <summary> /// Runs the comparison report against the supplied filter /// </summary> /// <param name="_fitler">The filter we want to run against this KPA</param> /// <param name="_option">The filter option where this fitler was obtained</param> public override void RunComparison(string _filter, FilterOptions.Options _filterOption) { try { DataTable dt = KpaUtils.ExcessStockStockQueries.GetPrsAgingReleased(); double totalDays = 0; // remove any apostraphe's from the filter as an exception will be thrown. CleanFilter(ref _filter); // Get the fitlered data rows from the datatable DataRow[] filteredResult = dt.Select(FilterOptions.GetSelectStatement(_filterOption, _filter)); foreach (DataRow dr in filteredResult) { //Check if the datarow meets the conditions of any applied filters. if (!Filters.FilterUtils.EvaluateAgainstFilters(dr)) { // This datarow dos not meet the conditions of the filters applied. continue; } #region EVASO_BUT_NOT_FULLY_RELEASED_CHECK string[] strPrFullyRelDate = (dr["PR Fully Rel Date"].ToString()).Split('/'); int prFullyRelYear = int.Parse(strPrFullyRelDate[2]); int prFullyRelMonth = int.Parse(strPrFullyRelDate[0]); int prFullyRelDay = int.Parse(strPrFullyRelDate[1]); if (prFullyRelYear == 0 && prFullyRelMonth == 0 && prFullyRelDay == 0) { // This PR line or PR in general might have been delted continue; } #endregion DateTime prFullyRelDt = new DateTime(prFullyRelYear, prFullyRelMonth, prFullyRelDay); double elapsedDays = (DateTime.Now - prFullyRelDt).TotalDays; totalDays += elapsedDays; elapsedDays = (int)elapsedDays; // Apply the elapsed days against the time span dump template.TimeSpanDump(elapsedDays); } // Calculate the average for this KPA template.CalculateAverage(totalDays); dt.Rows.Clear(); dt = null; GC.Collect(); } catch (Exception) { MessageBox.Show("An argument out of range exception was thrown", "Excess Stock - Open Orders -> Prs Aging (Released) - Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
/// <summary> /// Runs the comparison report against the supplied filter /// </summary> /// <param name="_fitler">The filter we want to run against this KPA</param> /// <param name="_option">The filter option where this fitler was obtained</param> public override void RunComparison(string _filter, FilterOptions.Options _filterOption) { double totalDays = 0; try { // Remove any apostrophe's from the filter or an exception will be thrown CleanFilter(ref _filter); // Get the filtered data rows from the datatable DataRow[] filteredResult = DatabaseManager.prsOnPOsDt.Select(FilterOptions.GetSelectStatement(_filterOption, _filter)); foreach (DataRow dr in filteredResult) { //Check if the datarow meets the conditions of any applied filters. if (!FilterUtils.EvaluateAgainstFilters(dr)) { // This datarow dos not meet the conditions of the filters applied. continue; } string[] strPOLineCreateDate = (dr["PO Line Creat#DT"].ToString()).Split('/'); int poCreateDtYear = int.Parse(strPOLineCreateDate[2]); int poCreateDtMonth = int.Parse(strPOLineCreateDate[0]); int poCreateDtDay = int.Parse(strPOLineCreateDate[1]); ////////////////////////////////////////////////////////////////////////////// // // The below if statement was added on 03/27/2018. // ----------------------------------------------- // There was some issues with a few POs that conatined dates of 00/00/0000 // that were causing erros. This if else statement ignores those files. // ////////////////////////////////////////////////////////////////////////////// if (poCreateDtDay == 0 && poCreateDtMonth == 0 && poCreateDtYear == 0) { // This situation is a SAP issue. We should never have POs that dont // have a PO creation date. // Skip these records continue; } else { // trim the zeros off of month and day if there is any. poCreateDtMonth = int.Parse(strPOLineCreateDate[0].Trim('0')); poCreateDtDay = int.Parse(strPOLineCreateDate[1].Trim('0')); } DateTime poLineCreateDate = new DateTime(poCreateDtYear, poCreateDtMonth, poCreateDtDay); #region EVASO_BUT_NOT_FULLY_RELEASED_CHECK string[] strPrFullyRelDate = (dr["PR Fully Rel Date"].ToString()).Split('/'); int prFullyRelYear = int.Parse(strPrFullyRelDate[2]); int prFullyRelMonth = int.Parse(strPrFullyRelDate[0]); int prFullyRelDay = int.Parse(strPrFullyRelDate[1]); if (prFullyRelYear == 0 && prFullyRelMonth == 0 && prFullyRelDay == 0) { // This PR line or PR in general might have been delted continue; } #endregion DateTime prFullyRelDt = new DateTime(prFullyRelYear, prFullyRelMonth, prFullyRelDay); double elapsedDays = (poLineCreateDate - prFullyRelDt).TotalDays; totalDays += elapsedDays; elapsedDays = (int)elapsedDays; // Apply the elapsed days against the time span conditions template.TimeSpanDump(elapsedDays); } // Calculate the average for this KPI template.CalculateAverage(totalDays); } catch (Exception) { MessageBox.Show("An argument out of range exception was thrown", "KPI - Purch II -> PR 2nd Lvl Release Date vs PO Creation Date - Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }