Ejemplo n.º 1
0
        /// <summary>
        /// Calculates the overall report for this KPA
        /// </summary>
        public override void Run()
        {
            try
            {
                foreach (DataRow dr in DatabaseManager.prsOnPOsDt.Rows)
                {
                    //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 - Overall Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
        /// <summary>
        /// Calculates the overall report for this KPA
        /// </summary>
        public override void RunOverall()
        {
            try
            {
                DataTable dt        = KpaUtils.PurchTotalQueries.GetPrReleaseToConfirmationEntry();
                double    totalDays = 0;

                foreach (DataRow dr in dt.Rows)
                {
                    //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);

                    DateTime today       = DateTime.Now.Date;
                    double   elapsedDays = (today - prFullyRelDt).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", "Purch Total -> PR Release To Confirmation Entry - Average 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();
            }
        }
Ejemplo n.º 4
0
        /// <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.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;

                    // Apply the elapsed days against the time span conditions
                    template.TimeSpanDump(elapsedDays);
                }


                // Calculate the average for this KPA
                template.CalculateAverage(totalDays);

                dt.Rows.Clear();
                dt = null;
                GC.Collect();
            }
            catch (ArgumentOutOfRangeException)
            {
                MessageBox.Show("An argument out of range exception was thrown", "Excess Stock - Stock -> PRs Aging (Not Released) - Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Calculates the overall report for this KPA
        /// </summary>
        public override void RunOverall()
        {
            try
            {
                DataTable dt        = KpaUtils.FollowUpQueries.GetDueTodayOrLateToConfirmed();
                double    totalDays = 0;

                foreach (DataRow dr in dt.Rows)
                {
                    //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[] 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 - Overall Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
Ejemplo n.º 6
0
        /// <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>
        /// Calculates the overall report for this KPA
        /// </summary>
        public override void RunOverall()
        {
            try
            {
                DataTable dt        = KpaUtils.ExcessStockOpenOrdersQueries.GetPrsAgingNotReleased();
                double    totalDays = 0;
                foreach (DataRow dr in dt.Rows)
                {
                    //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;

                    // Apply the elapsed days against the timespan 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", "Excess Stock - Open Orders -> PR Aging (Not Released) - Average Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
Ejemplo n.º 8
0
        /// <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.CurrentPlanVsActualQueries.GetCurrentPlanDateVsCurrentConfirmationDate();
                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[] 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;

                    // 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 span conditions
                    template.TimeSpanDump(elapsedDays);
                }

                // Calculate the average for this KPA
                template.CalculateAverage(totalDays);

                // Calcualte 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 - 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();
            }
        }
Ejemplo n.º 11
0
        /// <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();
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Calculates the overall report for this KPA
        /// </summary>
        public override void Run()
        {
            double totalDays = 0;

            try
            {
                foreach (DataRow dr in DatabaseManager.posRecCompDt.Rows)
                {
                    //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


                    string[] strDate = (dr["PO Line 1st Rel Dt"].ToString()).Split('/');
                    int      poLine1stRelDateYear  = int.Parse(strDate[2]);
                    int      poLine1stRelDateMonth = int.Parse(strDate[0]);
                    int      poLine1stRelDateDay   = int.Parse(strDate[1]);

                    if (poLine1stRelDateYear == 0 && poLine1stRelDateMonth == 0 && poLine1stRelDateDay == 0)
                    {
                        continue;
                    }

                    DateTime lastPORecDate = new DateTime(lastPORecDtYear, lastPORecDtMonth, lastPORecDtDay);
                    DateTime firstRelDate  = new DateTime(poLine1stRelDateYear, poLine1stRelDateMonth, poLine1stRelDateDay);

                    double elapsedDays = (lastPORecDate - firstRelDate).TotalDays;
                    totalDays += elapsedDays;

                    // Apply the elpased 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", "Follow Up II -> PO Release Date to Last PO Receipt Date - Overall Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Calculates the overall report for this KPA
        /// </summary>
        public override void Run()
        {
            double totalDays = 0;

            try
            {
                foreach (DataRow dr in DatabaseManager.prsOnPOsDt.Rows)
                {
                    //Check if the datarow meets the conditions of any applied filters.
                    if (!FilterUtils.EvaluateAgainstFilters(dr))
                    {
                        // This datarow does not meet the conditions of the filters applied.
                        continue;
                    }


                    string[] strPOLineFirstRelDate   = (dr["PO Line 1st Rel Dt"].ToString()).Split('/');
                    int      poLineFirstRelDateYear  = int.Parse(strPOLineFirstRelDate[2]);
                    int      poLineFirstRelDateMonth = int.Parse(strPOLineFirstRelDate[0]);
                    int      poLineFirstRelDateDay   = int.Parse(strPOLineFirstRelDate[1]);

                    if (poLineFirstRelDateYear == 0 && poLineFirstRelDateMonth == 0 && poLineFirstRelDateDay == 0)
                    {
                        continue;
                    }
                    else
                    {
                        poLineFirstRelDateYear  = int.Parse(strPOLineFirstRelDate[2]);
                        poLineFirstRelDateMonth = int.Parse(strPOLineFirstRelDate[0].TrimStart('0'));
                        poLineFirstRelDateDay   = int.Parse(strPOLineFirstRelDate[1].TrimStart('0'));
                    }

                    DateTime poLineFirstRelDate = new DateTime(poLineFirstRelDateYear, poLineFirstRelDateMonth, poLineFirstRelDateDay);

                    string[] strPOLineFirstConfCreateDate = (dr["1st Conf Creation Da"].ToString()).Split('/');
                    int      poLineFirstConfCreateYear    = int.Parse(strPOLineFirstConfCreateDate[2]);
                    int      poLineFirstConfCreateMonth   = int.Parse(strPOLineFirstConfCreateDate[0]);
                    int      poLineFirstConfCreateDay     = int.Parse(strPOLineFirstConfCreateDate[1]);


                    if (poLineFirstConfCreateYear == 0 && poLineFirstConfCreateMonth == 0 && poLineFirstConfCreateDay == 0)
                    {
                        UnconfirmedTotal++;
                        template.TotalRecords++;
                        continue;
                    }
                    else
                    {
                        poLineFirstConfCreateYear  = int.Parse(strPOLineFirstConfCreateDate[2]);
                        poLineFirstConfCreateMonth = int.Parse(strPOLineFirstConfCreateDate[0].TrimStart('0'));
                        poLineFirstConfCreateDay   = int.Parse(strPOLineFirstConfCreateDate[1].TrimStart('0'));
                    }

                    DateTime poLineFirstConfCreateDt = new DateTime(poLineFirstConfCreateYear, poLineFirstConfCreateMonth, poLineFirstConfCreateDay);

                    double elapsedDays = (poLineFirstConfCreateDt - 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);

                // Calcualte the percent unconfrimed for this KPI
                CalculatePercentUnconfirmed(UnconfirmedTotal);
            }
            catch (Exception)
            {
                MessageBox.Show("An argument out of range exception was thrown", "KPI - Puch II -> PO Release Date vs PO Confirmation Date - Overall Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
Ejemplo n.º 14
0
        /// <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();
            }
        }
Ejemplo n.º 15
0
        /// <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();
            }
        }
Ejemplo n.º 16
0
        /// <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.PurchSubQueries.GetPrReleaseToPoRelease();
                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;
                    }

                    #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 today        = DateTime.Now.Date;
                    double   elapsedDays  = (today - prFullyRelDt).TotalDays;
                    totalDays  += elapsedDays;
                    elapsedDays = (int)elapsedDays;

                    // Apply the elapsed days against the time span 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", "Purch Sub -> PR Release to PO 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)
        {
            try
            {
                DataTable dt        = KpaUtils.PurchSubQueries.GetPoCreationToConfirmationEntry();
                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[] 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 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", "Purch Sub -> PO Creation to 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.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>
        /// Calculates the overall report for this KPA
        /// </summary>
        public override void Run()
        {
            double totalDays = 0;

            try
            {
                foreach (DataRow dr in DatabaseManager.prsOnPOsDt.Rows)
                {
                    //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);

                    #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  = (poLineFirstRelDate - 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 Sub -> PR Release Date vs PO Release Date - Overall Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
Ejemplo n.º 20
0
        /// <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();
            }
        }
Ejemplo n.º 21
0
        /// <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();
            }
        }
Ejemplo n.º 22
0
        /// <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();
            }
        }