コード例 #1
0
        /// <summary>
        /// Triggered when the user clicks a 'view' button which then in return will present
        /// a new window with a datagrid view.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ViewData_Click(object sender, EventArgs e)
        {
            try
            {
                Bunifu.Framework.UI.BunifuFlatButton btn = (Bunifu.Framework.UI.BunifuFlatButton)sender;
                int tag = int.Parse(btn.Tag.ToString());

                switch (ActiveCategory)
                {
                case 0:
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //
                    // PRs Created
                    //
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    prsCreated = new DataTable();
                    prsCreated = Overall.AllDt.Clone();



                    foreach (DataRow dr in Overall.AllDt.Rows)
                    {
                        string[] strReqDate   = (dr["Requisn Date"].ToString()).Split('/');
                        int      reqDateYear  = int.Parse(strReqDate[2]);
                        int      reqDateMonth = int.Parse(strReqDate[0].TrimStart('0'));
                        int      reqDateDay   = int.Parse(strReqDate[1].TrimStart('0'));

                        DateTime prReqDate = new DateTime(reqDateYear, reqDateMonth, reqDateDay);

                        DateTime today       = DateTime.Now.Date;
                        double   elapsedDays = (prReqDate - today).TotalDays;
                        double   weeks       = Math.Floor(elapsedDays / 7);

                        switch (tag)
                        {
                        case 0:
                            prsCreated.ImportRow(dr);
                            break;

                        case 1:
                            if (weeks == 0)
                            {
                                prsCreated.ImportRow(dr);
                            }
                            continue;

                        case 2:
                            if (weeks < 0 && weeks >= (-1))
                            {
                                prsCreated.ImportRow(dr);
                            }
                            continue;

                        case 3:
                            if (weeks < (-1) && weeks >= (-2))
                            {
                                prsCreated.ImportRow(dr);
                            }
                            continue;

                        case 4:
                            if (weeks < (-2) && weeks >= (-3))
                            {
                                prsCreated.ImportRow(dr);
                            }
                            continue;

                        case 5:
                            if (weeks < (-3) && weeks >= (-4))
                            {
                                prsCreated.ImportRow(dr);
                            }
                            continue;

                        case 6:
                            if (weeks < (-4) && weeks >= (-5))
                            {
                                prsCreated.ImportRow(dr);
                            }
                            continue;

                        case 7:
                            if (weeks < (-5) && weeks >= (-6))
                            {
                                prsCreated.ImportRow(dr);
                            }
                            continue;

                        case 8:
                            if (weeks < (-6) && weeks >= (-7))
                            {
                                prsCreated.ImportRow(dr);
                            }
                            continue;

                        case 9:
                            if (weeks < (-7) && weeks >= (-8))
                            {
                                prsCreated.ImportRow(dr);
                            }
                            continue;

                        case 10:
                            if (weeks <= (-9))
                            {
                                prsCreated.ImportRow(dr);
                            }
                            continue;

                        default:
                            continue;
                        }
                    }

                    using (DataViewer dv = new DataViewer()
                    {
                        Data = prsCreated
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }
                    break;

                case 1:
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //
                    // PRs Released
                    //
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    prReleased = new DataTable();
                    prReleased = Overall.pr2ndLvlRelDateDt.Clone();



                    foreach (DataRow dr in Overall.pr2ndLvlRelDateDt.Rows)
                    {
                        string[] strPr2ndLvlRelDt   = (dr["PR 2° Rel# Date"].ToString()).Split('/');
                        int      pr2ndLvlRelDtYear  = int.Parse(strPr2ndLvlRelDt[2]);
                        int      pr2ndLvlRelDtMonth = int.Parse(strPr2ndLvlRelDt[0].TrimStart('0'));
                        int      pr2ndLvlRelDtDay   = int.Parse(strPr2ndLvlRelDt[1].TrimStart('0'));

                        DateTime pr2ndLvlRelDt = new DateTime(pr2ndLvlRelDtYear, pr2ndLvlRelDtMonth, pr2ndLvlRelDtDay);
                        DateTime today         = DateTime.Now.Date;
                        double   elapsedDays   = (pr2ndLvlRelDt - today).TotalDays;
                        double   weeks         = Math.Floor(elapsedDays / 7);

                        switch (tag)
                        {
                        case 0:
                            prReleased.ImportRow(dr);
                            break;

                        case 1:
                            if (weeks == 0)
                            {
                                prReleased.ImportRow(dr);
                            }
                            continue;

                        case 2:
                            if (weeks < 0 && weeks >= (-1))
                            {
                                prReleased.ImportRow(dr);
                            }
                            continue;

                        case 3:
                            if (weeks < (-1) && weeks >= (-2))
                            {
                                prReleased.ImportRow(dr);
                            }
                            continue;

                        case 4:
                            if (weeks < (-2) && weeks >= (-3))
                            {
                                prReleased.ImportRow(dr);
                            }
                            continue;

                        case 5:
                            if (weeks < (-3) && weeks >= (-4))
                            {
                                prReleased.ImportRow(dr);
                            }
                            continue;

                        case 6:
                            if (weeks < (-4) && weeks >= (-5))
                            {
                                prReleased.ImportRow(dr);
                            }
                            continue;

                        case 7:
                            if (weeks < (-5) && weeks >= (-6))
                            {
                                prReleased.ImportRow(dr);
                            }
                            continue;

                        case 8:
                            if (weeks < (-6) && weeks >= (-7))
                            {
                                prReleased.ImportRow(dr);
                            }
                            continue;

                        case 9:
                            if (weeks < (-7) && weeks >= (-8))
                            {
                                prReleased.ImportRow(dr);
                            }
                            continue;

                        case 10:
                            if (weeks <= (-9))
                            {
                                prReleased.ImportRow(dr);
                            }
                            continue;

                        default:
                            continue;
                        }
                    }

                    using (DataViewer dv = new DataViewer()
                    {
                        Data = prReleased
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }
                    break;

                case 2:
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //
                    // Total Spend
                    //
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    totalSpend = new DataTable();
                    totalSpend = Overall.prsOnPOsDt.Clone();



                    foreach (DataRow dr in Overall.prsOnPOsDt.Rows)
                    {
                        string[] strPoCreateDt   = (dr["PO Line Creat#DT"].ToString()).Split('/');
                        int      poCreateDtYear  = int.Parse(strPoCreateDt[2]);
                        int      poCreateDtMonth = int.Parse(strPoCreateDt[0].TrimStart('0'));
                        int      poCreateDtDay   = int.Parse(strPoCreateDt[1].TrimStart('0'));

                        DateTime poCreateDate = new DateTime(poCreateDtYear, poCreateDtMonth, poCreateDtDay);
                        DateTime today        = DateTime.Now.Date;
                        double   elapsedDays  = (poCreateDate - today).TotalDays;
                        double   weeks        = Math.Floor(elapsedDays / 7);

                        switch (tag)
                        {
                        case 0:
                            totalSpend.ImportRow(dr);
                            break;

                        case 1:
                            if (weeks == 0)
                            {
                                totalSpend.ImportRow(dr);
                            }
                            continue;

                        case 2:
                            if (weeks < 0 && weeks >= (-1))
                            {
                                totalSpend.ImportRow(dr);
                            }
                            continue;

                        case 3:
                            if (weeks < (-1) && weeks >= (-2))
                            {
                                totalSpend.ImportRow(dr);
                            }
                            continue;

                        case 4:
                            if (weeks < (-2) && weeks >= (-3))
                            {
                                totalSpend.ImportRow(dr);
                            }
                            continue;

                        case 5:
                            if (weeks < (-3) && weeks >= (-4))
                            {
                                totalSpend.ImportRow(dr);
                            }
                            continue;

                        case 6:
                            if (weeks < (-4) && weeks >= (-5))
                            {
                                totalSpend.ImportRow(dr);
                            }
                            continue;

                        case 7:
                            if (weeks < (-5) && weeks >= (-6))
                            {
                                totalSpend.ImportRow(dr);
                            }
                            continue;

                        case 8:
                            if (weeks < (-6) && weeks >= (-7))
                            {
                                totalSpend.ImportRow(dr);
                            }
                            continue;

                        case 9:
                            if (weeks < (-7) && weeks >= (-8))
                            {
                                totalSpend.ImportRow(dr);
                            }
                            continue;

                        case 10:
                            if (weeks <= (-9))
                            {
                                totalSpend.ImportRow(dr);
                            }
                            continue;

                        default:
                            continue;
                        }
                    }

                    using (DataViewer dv = new DataViewer()
                    {
                        Data = totalSpend
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }
                    break;

                case 3:
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //
                    // PR vs PO Value
                    //
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    prVsPOValue = new DataTable();
                    prVsPOValue = Overall.prsOnPOsDt.Clone();



                    foreach (DataRow dr in Overall.prsOnPOsDt.Rows)
                    {
                        string[] strPoCreateDt   = (dr["PO Line Creat#DT"].ToString()).Split('/');
                        int      poCreateDtYear  = int.Parse(strPoCreateDt[2]);
                        int      poCreateDtMonth = int.Parse(strPoCreateDt[0].TrimStart('0'));
                        int      poCreateDtDay   = int.Parse(strPoCreateDt[1].TrimStart('0'));

                        DateTime poCreateDate = new DateTime(poCreateDtYear, poCreateDtMonth, poCreateDtDay);

                        DateTime today       = DateTime.Now.Date;
                        double   elapsedDays = (poCreateDate - today).TotalDays;
                        double   weeks       = Math.Floor(elapsedDays / 7);

                        switch (tag)
                        {
                        case 0:
                            prVsPOValue.ImportRow(dr);
                            break;

                        case 1:
                            if (weeks == 0)
                            {
                                prVsPOValue.ImportRow(dr);
                            }
                            continue;

                        case 2:
                            if (weeks < 0 && weeks >= (-1))
                            {
                                prVsPOValue.ImportRow(dr);
                            }
                            continue;

                        case 3:
                            if (weeks < (-1) && weeks >= (-2))
                            {
                                prVsPOValue.ImportRow(dr);
                            }
                            continue;

                        case 4:
                            if (weeks < (-2) && weeks >= (-3))
                            {
                                prVsPOValue.ImportRow(dr);
                            }
                            continue;

                        case 5:
                            if (weeks < (-3) && weeks >= (-4))
                            {
                                prVsPOValue.ImportRow(dr);
                            }
                            continue;

                        case 6:
                            if (weeks < (-4) && weeks >= (-5))
                            {
                                prVsPOValue.ImportRow(dr);
                            }
                            continue;

                        case 7:
                            if (weeks < (-5) && weeks >= (-6))
                            {
                                prVsPOValue.ImportRow(dr);
                            }
                            continue;

                        case 8:
                            if (weeks < (-6) && weeks >= (-7))
                            {
                                prVsPOValue.ImportRow(dr);
                            }
                            continue;

                        case 9:
                            if (weeks < (-7) && weeks >= (-8))
                            {
                                prVsPOValue.ImportRow(dr);
                            }
                            continue;

                        case 10:
                            if (weeks <= (-9))
                            {
                                prVsPOValue.ImportRow(dr);
                            }
                            continue;

                        default:
                            continue;
                        }
                    }

                    using (DataViewer dv = new DataViewer()
                    {
                        Data = prVsPOValue
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }
                    break;

                case 4:
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //
                    // Hot Job PRs
                    //
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    hotJobPRs = new DataTable();
                    hotJobPRs = Overall.AllDt.Clone();



                    foreach (DataRow dr in Overall.AllDt.Rows)
                    {
                        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 reqDate     = new DateTime(reqDateYear, reqDateMonth, reqDateDay);
                        DateTime today       = DateTime.Now.Date;
                        double   elapsedDays = (reqDate - today).TotalDays;
                        double   weeks       = Math.Floor(elapsedDays / 7);

                        switch (tag)
                        {
                        case 0:
                            hotJobPRs.ImportRow(dr);
                            break;

                        case 1:
                            if (weeks == 0)
                            {
                                hotJobPRs.ImportRow(dr);
                            }
                            continue;

                        case 2:
                            if (weeks < 0 && weeks >= (-1))
                            {
                                hotJobPRs.ImportRow(dr);
                            }
                            continue;

                        case 3:
                            if (weeks < (-1) && weeks >= (-2))
                            {
                                hotJobPRs.ImportRow(dr);
                            }
                            continue;

                        case 4:
                            if (weeks < (-2) && weeks >= (-3))
                            {
                                hotJobPRs.ImportRow(dr);
                            }
                            continue;

                        case 5:
                            if (weeks < (-3) && weeks >= (-4))
                            {
                                hotJobPRs.ImportRow(dr);
                            }
                            continue;

                        case 6:
                            if (weeks < (-4) && weeks >= (-5))
                            {
                                hotJobPRs.ImportRow(dr);
                            }
                            continue;

                        case 7:
                            if (weeks < (-5) && weeks >= (-6))
                            {
                                hotJobPRs.ImportRow(dr);
                            }
                            continue;

                        case 8:
                            if (weeks < (-6) && weeks >= (-7))
                            {
                                hotJobPRs.ImportRow(dr);
                            }
                            continue;

                        case 9:
                            if (weeks < (-7) && weeks >= (-8))
                            {
                                hotJobPRs.ImportRow(dr);
                            }
                            continue;

                        case 10:
                            if (weeks <= (-9))
                            {
                                hotJobPRs.ImportRow(dr);
                            }
                            continue;

                        default:
                            continue;
                        }
                    }

                    using (DataViewer dv = new DataViewer()
                    {
                        Data = hotJobPRs
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }
                    break;

                default:

                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "KPI -> Other Data Viewer Calculation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        /// <summary>
        /// Triggered when the user clicks a 'view' button which then in return will present
        /// a new window with a datagrid view.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ViewData_Click(object sender, EventArgs e)
        {
            try
            {
                Bunifu.Framework.UI.BunifuFlatButton btn = (Bunifu.Framework.UI.BunifuFlatButton)sender;
                int tag = int.Parse(btn.Tag.ToString());

                switch (ActiveCategory)
                {
                case 0:
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //
                    // PRs Aging Rel
                    //
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    dt            = new DataTable();
                    prsAgingRelDt = new DataTable();

                    if (Overall.SelectedCountry == AccessInfo.MainTables.US_PRPO)
                    {
                        cmd = new OleDbCommand(PRPOCommands.Queries[(int)PRPOCommands.DatabaseTables.TableNames.KPA_Purch_PRsAgingRel] + Filters.FilterQuery, PRPO_DB_Utils.DatabaseConnection);
                    }
                    else
                    {
                        cmd = new OleDbCommand(PRPOCommands.Queries[(int)PRPOCommands.DatabaseTables.TableNames.KPA_Purch_PRsAgingRel] + Filters.FilterQuery, PRPO_DB_Utils.DatabaseConnection);
                    }

                    da = new OleDbDataAdapter(cmd);
                    da.Fill(dt);

                    prsAgingRelDt = dt.Clone();


                    foreach (DataRow dr in dt.Rows)
                    {
                        string[] strDate = (dr["PR 2° Rel# Date"].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);
                        double   elapsedDays = (int)(DateTime.Now - date).TotalDays;

                        switch (tag)
                        {
                        case 0:
                            prsAgingRelDt.ImportRow(dr);
                            break;

                        case 1:
                            if (elapsedDays <= 0)
                            {
                                prsAgingRelDt.ImportRow(dr);
                            }
                            continue;

                        case 2:
                            if (elapsedDays >= 1 && elapsedDays <= 3)
                            {
                                prsAgingRelDt.ImportRow(dr);
                            }
                            continue;

                        case 3:
                            if (elapsedDays >= 4 && elapsedDays <= 7)
                            {
                                prsAgingRelDt.ImportRow(dr);
                            }
                            continue;

                        case 4:
                            if (elapsedDays >= 8 && elapsedDays <= 14)
                            {
                                prsAgingRelDt.ImportRow(dr);
                            }
                            continue;

                        case 5:
                            if (elapsedDays >= 15 && elapsedDays <= 21)
                            {
                                prsAgingRelDt.ImportRow(dr);
                            }
                            continue;

                        case 6:
                            if (elapsedDays >= 22 && elapsedDays <= 28)
                            {
                                prsAgingRelDt.ImportRow(dr);
                            }
                            continue;

                        case 7:
                            if (elapsedDays >= 29)
                            {
                                prsAgingRelDt.ImportRow(dr);
                            }
                            continue;

                        default:
                            continue;
                        }
                    }

                    using (DataViewer dv = new DataViewer()
                    {
                        Data = prsAgingRelDt
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }
                    break;

                case 1:
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //
                    // PO First Rel
                    //
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    dt           = new DataTable();
                    poFirstRelDt = new DataTable();
                    if (Overall.SelectedCountry == AccessInfo.MainTables.US_PRPO)
                    {
                        cmd = new OleDbCommand(PRPOCommands.Queries[(int)PRPOCommands.DatabaseTables.TableNames.KPA_Purch_POFirstRelease] + Filters.FilterQuery, PRPO_DB_Utils.DatabaseConnection);
                    }
                    else
                    {
                        cmd = new OleDbCommand(PRPOCommands.Queries[(int)PRPOCommands.DatabaseTables.TableNames.KPA_Purch_POFirstRelease] + Filters.FilterQuery, PRPO_DB_Utils.DatabaseConnection);
                    }

                    da = new OleDbDataAdapter(cmd);
                    da.Fill(dt);


                    poFirstRelDt = dt.Clone();



                    foreach (DataRow dr in dt.Rows)
                    {
                        string[] strDate = (dr["PO Line Creat#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);
                        double   elapsedDays = (int)(DateTime.Now - date).TotalDays;

                        switch (tag)
                        {
                        case 0:
                            poFirstRelDt.ImportRow(dr);
                            break;

                        case 1:
                            if (elapsedDays <= 0)
                            {
                                poFirstRelDt.ImportRow(dr);
                            }
                            continue;

                        case 2:
                            if (elapsedDays >= 1 && elapsedDays <= 3)
                            {
                                poFirstRelDt.ImportRow(dr);
                            }
                            continue;

                        case 3:
                            if (elapsedDays >= 4 && elapsedDays <= 7)
                            {
                                poFirstRelDt.ImportRow(dr);
                            }
                            continue;

                        case 4:
                            if (elapsedDays >= 8 && elapsedDays <= 14)
                            {
                                poFirstRelDt.ImportRow(dr);
                            }
                            continue;

                        case 5:
                            if (elapsedDays >= 15 && elapsedDays <= 21)
                            {
                                poFirstRelDt.ImportRow(dr);
                            }
                            continue;

                        case 6:
                            if (elapsedDays >= 22 && elapsedDays <= 28)
                            {
                                poFirstRelDt.ImportRow(dr);
                            }
                            continue;

                        case 7:
                            if (elapsedDays >= 29)
                            {
                                poFirstRelDt.ImportRow(dr);
                            }
                            continue;

                        default:
                            continue;
                        }
                    }

                    using (DataViewer dv = new DataViewer()
                    {
                        Data = poFirstRelDt
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }
                    break;

                case 2:
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //
                    // PO Prev Rel
                    //
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    dt          = new DataTable();
                    poPrevRelDt = new DataTable();
                    if (Overall.SelectedCountry == AccessInfo.MainTables.US_PRPO)
                    {
                        cmd = new OleDbCommand(PRPOCommands.Queries[(int)PRPOCommands.DatabaseTables.TableNames.KPA_Purch_POPrevRelease] + Filters.FilterQuery, PRPO_DB_Utils.DatabaseConnection);
                    }
                    else
                    {
                        cmd = new OleDbCommand(PRPOCommands.Queries[(int)PRPOCommands.DatabaseTables.TableNames.KPA_Purch_POPrevRelease] + Filters.FilterQuery, PRPO_DB_Utils.DatabaseConnection);
                    }

                    da = new OleDbDataAdapter(cmd);
                    da.Fill(dt);


                    poPrevRelDt = dt.Clone();



                    foreach (DataRow dr in dt.Rows)
                    {
                        string[] strDate = (dr["PO Line Creat#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);
                        double   elapsedDays = (int)(DateTime.Now - date).TotalDays;

                        switch (tag)
                        {
                        case 0:
                            poPrevRelDt.ImportRow(dr);
                            break;

                        case 1:
                            if (elapsedDays <= 0)
                            {
                                poPrevRelDt.ImportRow(dr);
                            }
                            continue;

                        case 2:
                            if (elapsedDays >= 1 && elapsedDays <= 3)
                            {
                                poPrevRelDt.ImportRow(dr);
                            }
                            continue;

                        case 3:
                            if (elapsedDays >= 4 && elapsedDays <= 7)
                            {
                                poPrevRelDt.ImportRow(dr);
                            }
                            continue;

                        case 4:
                            if (elapsedDays >= 8 && elapsedDays <= 14)
                            {
                                poPrevRelDt.ImportRow(dr);
                            }
                            continue;

                        case 5:
                            if (elapsedDays >= 15 && elapsedDays <= 21)
                            {
                                poPrevRelDt.ImportRow(dr);
                            }
                            continue;

                        case 6:
                            if (elapsedDays >= 22 && elapsedDays <= 28)
                            {
                                poPrevRelDt.ImportRow(dr);
                            }
                            continue;

                        case 7:
                            if (elapsedDays >= 29)
                            {
                                poPrevRelDt.ImportRow(dr);
                            }
                            continue;

                        default:
                            continue;
                        }
                    }

                    using (DataViewer dv = new DataViewer()
                    {
                        Data = poPrevRelDt
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }
                    break;

                case 3:
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //
                    // No Confirmations
                    //
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    dt = new DataTable();
                    noConfirmationsDt = new DataTable();
                    if (Overall.SelectedCountry == AccessInfo.MainTables.US_PRPO)
                    {
                        cmd = new OleDbCommand(PRPOCommands.Queries[(int)PRPOCommands.DatabaseTables.TableNames.KPA_Purch_NoConfirmation] + Filters.FilterQuery, PRPO_DB_Utils.DatabaseConnection);
                    }
                    else
                    {
                        cmd = new OleDbCommand(PRPOCommands.Queries[(int)PRPOCommands.DatabaseTables.TableNames.KPA_Purch_NoConfirmation] + Filters.FilterQuery, PRPO_DB_Utils.DatabaseConnection);
                    }

                    da = new OleDbDataAdapter(cmd);
                    da.Fill(dt);


                    noConfirmationsDt = dt.Clone();



                    foreach (DataRow dr in dt.Rows)
                    {
                        string[] strDate = (dr["PO Line 1st Rel 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);
                        double   elapsedDays = (int)(DateTime.Now - date).TotalDays;

                        switch (tag)
                        {
                        case 0:
                            noConfirmationsDt.ImportRow(dr);
                            break;

                        case 1:
                            if (elapsedDays <= 0)
                            {
                                noConfirmationsDt.ImportRow(dr);
                            }
                            continue;

                        case 2:
                            if (elapsedDays >= 1 && elapsedDays <= 3)
                            {
                                noConfirmationsDt.ImportRow(dr);
                            }
                            continue;

                        case 3:
                            if (elapsedDays >= 4 && elapsedDays <= 7)
                            {
                                noConfirmationsDt.ImportRow(dr);
                            }
                            continue;

                        case 4:
                            if (elapsedDays >= 8 && elapsedDays <= 14)
                            {
                                noConfirmationsDt.ImportRow(dr);
                            }
                            continue;

                        case 5:
                            if (elapsedDays >= 15 && elapsedDays <= 21)
                            {
                                noConfirmationsDt.ImportRow(dr);
                            }
                            continue;

                        case 6:
                            if (elapsedDays >= 22 && elapsedDays <= 28)
                            {
                                noConfirmationsDt.ImportRow(dr);
                            }
                            continue;

                        case 7:
                            if (elapsedDays >= 29)
                            {
                                noConfirmationsDt.ImportRow(dr);
                            }
                            continue;

                        default:
                            continue;
                        }
                    }

                    using (DataViewer dv = new DataViewer()
                    {
                        Data = noConfirmationsDt
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "KPA -> Purch Data Viewer Calculation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #3
0
        /// <summary>
        /// Triggered when the user clicks a 'view' button which then in return will present
        /// a new window with a datagrid view.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ViewData_Click(object sender, EventArgs e)
        {
            try
            {
                Bunifu.Framework.UI.BunifuFlatButton btn = (Bunifu.Framework.UI.BunifuFlatButton)sender;
                int tag = int.Parse(btn.Tag.ToString());


                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                //
                // PR Release to COnfirmation Entry
                //
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                prReleaseConfEntry = new DataTable();
                unconfirmed        = new DataTable();

                prReleaseConfEntry = Overall.prsOnPOsDt.Clone();
                unconfirmed        = Overall.prsOnPOsDt.Clone();



                foreach (DataRow dr in Overall.prsOnPOsDt.Rows)
                {
                    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)
                    {
                        unconfirmed.ImportRow(dr);
                        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);

                    string[] strPR2ndLvlRelDate = (dr["PR 2° Rel# Date"].ToString()).Split('/');
                    int      secLvlRelYear      = int.Parse(strPR2ndLvlRelDate[2]);
                    int      secLvlRelMonth     = int.Parse(strPR2ndLvlRelDate[0].TrimStart('0'));
                    int      secLvlRelDay       = int.Parse(strPR2ndLvlRelDate[1].TrimStart('0'));

                    DateTime pr2ndLvlRelDate = new DateTime(secLvlRelYear, secLvlRelMonth, secLvlRelDay);
                    double   elapsedDays     = (int)(poLineConfCreateDate - pr2ndLvlRelDate).TotalDays;

                    switch (tag)
                    {
                    case 0:
                        prReleaseConfEntry.ImportRow(dr);
                        break;

                    case 1:
                        if (elapsedDays <= 0)
                        {
                            prReleaseConfEntry.ImportRow(dr);
                        }
                        continue;

                    case 2:
                        if (elapsedDays >= 1 && elapsedDays <= 3)
                        {
                            prReleaseConfEntry.ImportRow(dr);
                        }
                        continue;

                    case 3:
                        if (elapsedDays >= 4 && elapsedDays <= 7)
                        {
                            prReleaseConfEntry.ImportRow(dr);
                        }
                        continue;

                    case 4:
                        if (elapsedDays >= 8 && elapsedDays <= 14)
                        {
                            prReleaseConfEntry.ImportRow(dr);
                        }
                        continue;

                    case 5:
                        if (elapsedDays >= 15 && elapsedDays <= 21)
                        {
                            prReleaseConfEntry.ImportRow(dr);
                        }
                        continue;

                    case 6:
                        if (elapsedDays >= 22 && elapsedDays <= 28)
                        {
                            prReleaseConfEntry.ImportRow(dr);
                        }
                        continue;

                    case 7:
                        if (elapsedDays >= 29 && elapsedDays <= 35)
                        {
                            prReleaseConfEntry.ImportRow(dr);
                        }
                        continue;

                    case 8:
                        if (elapsedDays >= 36 && elapsedDays <= 42)
                        {
                            prReleaseConfEntry.ImportRow(dr);
                        }
                        continue;

                    case 9:
                        if (elapsedDays >= 43 && elapsedDays <= 49)
                        {
                            prReleaseConfEntry.ImportRow(dr);
                        }
                        continue;

                    case 10:
                        if (elapsedDays >= 50)
                        {
                            prReleaseConfEntry.ImportRow(dr);
                        }
                        continue;

                    default:
                        continue;
                    }
                }

                if (tag != 11)
                {
                    using (DataViewer dv = new DataViewer()
                    {
                        Data = prReleaseConfEntry
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }
                }
                else
                {
                    using (DataViewer dv = new DataViewer()
                    {
                        Data = unconfirmed
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "KPI -> Purch Total Data Viewer Calculation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #4
0
        /// <summary>
        /// Triggered when the user clicks a 'view' button which then in return will present
        /// a new window with a datagrid view.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_viewData_Click(object sender, EventArgs e)
        {
            try
            {
                Bunifu.Framework.UI.BunifuFlatButton btn = (Bunifu.Framework.UI.BunifuFlatButton)sender;
                int tag = int.Parse(btn.Tag.ToString());

                switch (ActiveCategory)
                {
                case 0:
                    break;

                case 1:

                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //
                    // PRs Aging (Not Released)
                    //
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    dt = new DataTable();
                    prsAgingNotRelDt = new DataTable();

                    if (Overall.SelectedCountry == AccessInfo.MainTables.US_PRPO)
                    {
                        cmd = new OleDbCommand(PRPOCommands.Queries[(int)PRPOCommands.DatabaseTables.TableNames.KPA_Plan_PRsAgingNotRel] + Filters.FilterQuery, PRPO_DB_Utils.DatabaseConnection);
                    }
                    else
                    {
                        cmd = new OleDbCommand(PRPOCommands.Queries[(int)PRPOCommands.DatabaseTables.TableNames.KPA_Plan_PRsAgingNotRel] + Filters.FilterQuery, PRPO_DB_Utils.DatabaseConnection);
                    }

                    da = new OleDbDataAdapter(cmd);
                    da.Fill(dt);

                    prsAgingNotRelDt = dt.Clone();



                    foreach (DataRow dr in dt.Rows)
                    {
                        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);
                        double   elapsedDays = (int)(DateTime.Now - reqDate).TotalDays;

                        switch (tag)
                        {
                        case 0:
                            prsAgingNotRelDt.ImportRow(dr);
                            break;

                        case 1:
                            if (elapsedDays <= 0)
                            {
                                prsAgingNotRelDt.ImportRow(dr);
                            }
                            continue;

                        case 2:
                            if (elapsedDays >= 1 && elapsedDays <= 3)
                            {
                                prsAgingNotRelDt.ImportRow(dr);
                            }
                            continue;

                        case 3:
                            if (elapsedDays >= 4 && elapsedDays <= 7)
                            {
                                prsAgingNotRelDt.ImportRow(dr);
                            }
                            continue;

                        case 4:
                            if (elapsedDays >= 8 && elapsedDays <= 14)
                            {
                                prsAgingNotRelDt.ImportRow(dr);
                            }
                            continue;

                        case 5:
                            if (elapsedDays >= 15 && elapsedDays <= 21)
                            {
                                prsAgingNotRelDt.ImportRow(dr);
                            }
                            continue;

                        case 6:
                            if (elapsedDays >= 22 && elapsedDays <= 28)
                            {
                                prsAgingNotRelDt.ImportRow(dr);
                            }
                            continue;

                        case 7:
                            if (elapsedDays >= 29)
                            {
                                prsAgingNotRelDt.ImportRow(dr);
                            }
                            continue;

                        default:
                            continue;
                        }
                    }

                    using (DataViewer dv = new DataViewer()
                    {
                        Data = prsAgingNotRelDt
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }

                    break;

                case 2:
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //
                    // Material Due
                    //
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    dt            = new DataTable();
                    MaterialDueDt = new DataTable();

                    if (Overall.SelectedCountry == AccessInfo.MainTables.US_PRPO)
                    {
                        cmd = new OleDbCommand(PRPOCommands.Queries[(int)PRPOCommands.DatabaseTables.TableNames.KPA_Plan_MaterialDue] + Filters.FilterQuery, PRPO_DB_Utils.DatabaseConnection);
                    }
                    else
                    {
                        cmd = new OleDbCommand(PRPOCommands.Queries[(int)PRPOCommands.DatabaseTables.TableNames.KPA_Plan_MaterialDue] + Filters.FilterQuery, PRPO_DB_Utils.DatabaseConnection);
                    }

                    da = new OleDbDataAdapter(cmd);
                    da.Fill(dt);

                    MaterialDueDt = dt.Clone();

                    foreach (DataRow dr in dt.Rows)
                    {
                        string[] strCurrReqDate = (dr["PR Delivery Date"].ToString()).Split('/');
                        int      year           = int.Parse(strCurrReqDate[2]);
                        int      month          = int.Parse(strCurrReqDate[0].TrimStart('0'));
                        int      day            = int.Parse(strCurrReqDate[1].TrimStart('0'));

                        DateTime currReqDate = new DateTime(year, month, day);
                        double   elapsedDays = (int)(currReqDate - DateTime.Now).TotalDays;


                        switch (int.Parse(btn.Tag.ToString()))
                        {
                        case 0:
                            MaterialDueDt.ImportRow(dr);
                            break;

                        case 1:
                            if (elapsedDays <= 0)
                            {
                                MaterialDueDt.ImportRow(dr);
                            }
                            break;

                        case 2:
                            if (elapsedDays >= 1 && elapsedDays <= 3)
                            {
                                MaterialDueDt.ImportRow(dr);
                            }
                            break;

                        case 3:
                            if (elapsedDays >= 4 && elapsedDays <= 7)
                            {
                                MaterialDueDt.ImportRow(dr);
                            }
                            break;

                        case 4:
                            if (elapsedDays >= 8 && elapsedDays <= 14)
                            {
                                MaterialDueDt.ImportRow(dr);
                            }
                            break;

                        case 5:
                            if (elapsedDays >= 15 && elapsedDays <= 21)
                            {
                                MaterialDueDt.ImportRow(dr);
                            }
                            break;

                        case 6:
                            if (elapsedDays >= 22 && elapsedDays <= 28)
                            {
                                MaterialDueDt.ImportRow(dr);
                            }
                            break;

                        case 7:
                            if (elapsedDays >= 29)
                            {
                                MaterialDueDt.ImportRow(dr);
                            }
                            break;

                        default:
                            break;
                        }
                    }

                    using (DataViewer dv = new DataViewer()
                    {
                        Data = MaterialDueDt
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "KPA -> Plan Data Viewer Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #5
0
        /// <summary>
        /// Triggered when the user clicks a 'view' button which then in return will present
        /// a new window with a datagrid view.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ViewData_Click(object sender, EventArgs e)
        {
            try
            {
                Bunifu.Framework.UI.BunifuFlatButton btn = (Bunifu.Framework.UI.BunifuFlatButton)sender;
                int tag = int.Parse(btn.Tag.ToString());


                switch (ActiveCategory)
                {
                case 0:

                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //
                    // Current Planned Date vs Current Confirmation Date (Open Pos)
                    //
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    dt = new DataTable();
                    currPlanDateVsCurrConfDateDt = new DataTable();

                    if (Overall.SelectedCountry == AccessInfo.MainTables.US_PRPO)
                    {
                        cmd = new OleDbCommand(PRPOCommands.Queries[(int)PRPOCommands.DatabaseTables.TableNames.KPA_CurrPlanActual_CurrPlanDateCurrConfDateOpenPO] + Filters.FilterQuery, PRPO_DB_Utils.DatabaseConnection);
                    }
                    else
                    {
                        cmd = new OleDbCommand(PRPOCommands.Queries[(int)PRPOCommands.DatabaseTables.TableNames.KPA_CurrPlanActual_CurrPlanDateCurrConfDateOpenPO] + Filters.FilterQuery, PRPO_DB_Utils.DatabaseConnection);
                    }

                    da = new OleDbDataAdapter(cmd);
                    da.Fill(dt);

                    currPlanDateVsCurrConfDateDt = dt.Clone();



                    foreach (DataRow dr in dt.Rows)
                    {
                        string[] strDate = (dr["Del#Conf#Date"].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  = (int)(confDate - currPlanDate).TotalDays;

                        int weeks = 0;
                        if (elapsedDays < 0)
                        {
                            weeks = (int)Math.Floor(elapsedDays / 7);
                        }
                        else
                        {
                            weeks = (int)Math.Ceiling(elapsedDays / 7);
                        }

                        switch (tag)
                        {
                        case 0:
                            currPlanDateVsCurrConfDateDt.ImportRow(dr);
                            break;

                        case 1:
                            if (weeks <= (-4))
                            {
                                currPlanDateVsCurrConfDateDt.ImportRow(dr);
                            }
                            continue;

                        case 2:
                            if (weeks > (-4) && weeks <= (-3))
                            {
                                currPlanDateVsCurrConfDateDt.ImportRow(dr);
                            }
                            continue;

                        case 3:
                            if (weeks > (-3) && weeks <= (-2))
                            {
                                currPlanDateVsCurrConfDateDt.ImportRow(dr);
                            }
                            continue;

                        case 4:
                            if (weeks > (-2) && weeks <= (-1))
                            {
                                currPlanDateVsCurrConfDateDt.ImportRow(dr);
                            }
                            continue;

                        case 5:
                            if (weeks == 0)
                            {
                                currPlanDateVsCurrConfDateDt.ImportRow(dr);
                            }
                            continue;

                        case 6:
                            if (weeks > 0 && weeks <= 1)
                            {
                                currPlanDateVsCurrConfDateDt.ImportRow(dr);
                            }
                            continue;

                        case 7:
                            if (weeks > 1 && weeks <= 2)
                            {
                                currPlanDateVsCurrConfDateDt.ImportRow(dr);
                            }
                            continue;

                        case 8:
                            if (weeks > 2 && weeks <= 3)
                            {
                                currPlanDateVsCurrConfDateDt.ImportRow(dr);
                            }
                            continue;

                        case 9:
                            if (weeks >= 4)
                            {
                                currPlanDateVsCurrConfDateDt.ImportRow(dr);
                            }
                            continue;

                        default:
                            continue;
                        }
                    }

                    using (DataViewer dv = new DataViewer()
                    {
                        Data = currPlanDateVsCurrConfDateDt
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }
                    break;

                case 1:

                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //
                    // Current Planned Date vs Current Confirmation Date (Open POs) - Hot Jobs Only
                    //
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    dt = new DataTable();
                    currPlanDateVsCurrConfDateDtHotJobs = new DataTable();

                    if (Overall.SelectedCountry == AccessInfo.MainTables.US_PRPO)
                    {
                        cmd = new OleDbCommand(PRPOCommands.Queries[(int)PRPOCommands.DatabaseTables.TableNames.KPA_CurrPlanActual_CurrPlanDateCurrConfDateOpenPOHotJobs] + Filters.FilterQuery, PRPO_DB_Utils.DatabaseConnection);
                    }
                    else
                    {
                        cmd = new OleDbCommand(PRPOCommands.Queries[(int)PRPOCommands.DatabaseTables.TableNames.KPA_CurrPlanActual_CurrPlanDateCurrConfDateOpenPOHotJobs] + Filters.FilterQuery, PRPO_DB_Utils.DatabaseConnection);
                    }

                    da = new OleDbDataAdapter(cmd);
                    da.Fill(dt);

                    currPlanDateVsCurrConfDateDtHotJobs = dt.Clone();



                    foreach (DataRow dr in dt.Rows)
                    {
                        string[] strDate = (dr["Del#Conf#Date"].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  = (int)(confDate - currPlanDate).TotalDays;


                        int weeks = 0;
                        if (elapsedDays < 0)
                        {
                            weeks = (int)Math.Floor(elapsedDays / 7);
                        }
                        else
                        {
                            weeks = (int)Math.Ceiling(elapsedDays / 7);
                        }


                        switch (tag)
                        {
                        case 0:
                            currPlanDateVsCurrConfDateDtHotJobs.ImportRow(dr);
                            break;

                        case 1:
                            if (weeks <= (-4))
                            {
                                currPlanDateVsCurrConfDateDtHotJobs.ImportRow(dr);
                            }
                            continue;

                        case 2:
                            if (weeks > (-4) && weeks <= (-3))
                            {
                                currPlanDateVsCurrConfDateDtHotJobs.ImportRow(dr);
                            }
                            continue;

                        case 3:
                            if (weeks > (-3) && weeks <= (-2))
                            {
                                currPlanDateVsCurrConfDateDtHotJobs.ImportRow(dr);
                            }
                            continue;

                        case 4:
                            if (weeks > (-2) && weeks <= (-1))
                            {
                                currPlanDateVsCurrConfDateDtHotJobs.ImportRow(dr);
                            }
                            continue;

                        case 5:
                            if (weeks == 0)
                            {
                                currPlanDateVsCurrConfDateDtHotJobs.ImportRow(dr);
                            }
                            continue;

                        case 6:
                            if (weeks > 0 && weeks <= 1)
                            {
                                currPlanDateVsCurrConfDateDtHotJobs.ImportRow(dr);
                            }
                            continue;

                        case 7:
                            if (weeks > 1 && weeks <= 2)
                            {
                                currPlanDateVsCurrConfDateDtHotJobs.ImportRow(dr);
                            }
                            continue;

                        case 8:
                            if (weeks > 2 && weeks <= 3)
                            {
                                currPlanDateVsCurrConfDateDtHotJobs.ImportRow(dr);
                            }
                            continue;

                        case 9:
                            if (weeks >= 4)
                            {
                                currPlanDateVsCurrConfDateDtHotJobs.ImportRow(dr);
                            }
                            continue;

                        default:
                            continue;
                        }
                    }

                    using (DataViewer dv = new DataViewer()
                    {
                        Data = currPlanDateVsCurrConfDateDtHotJobs
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "KPA -> Current Plan vs Actual Data Viewer Calculation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #6
0
        /// <summary>
        /// Triggered when the user clicks a 'view' button which then in return will present
        /// a new window with a datagrid view.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ViewData_Click(object sender, EventArgs e)
        {
            try
            {
                Bunifu.Framework.UI.BunifuFlatButton btn = (Bunifu.Framework.UI.BunifuFlatButton)sender;
                int tag = int.Parse(btn.Tag.ToString());


                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                //
                // Initial Confirmation vs PR Planned Date
                //
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                initConfVsPrPlanDateDt = new DataTable();
                unconfirmed            = new DataTable();
                DataTable posConf = new DataTable();

                initConfVsPrPlanDateDt = Overall.prsOnPOsDt.Clone();
                unconfirmed            = Overall.prsOnPOsDt.Clone();


                foreach (DataRow dr in Overall.prsOnPOsDt.Rows)
                {
                    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)
                    {
                        unconfirmed.ImportRow(dr);
                        continue;
                    }
                    else
                    {
                        posConf.ImportRow(dr);
                        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);

                    string[] strPRPlanDate = (dr["PR Delivery Date"].ToString()).Split('/');
                    int      prDelYear     = int.Parse(strPRPlanDate[2]);
                    int      prDelMonth    = int.Parse(strPRPlanDate[0].TrimStart('0'));
                    int      prDelDay      = int.Parse(strPRPlanDate[1].TrimStart('0'));

                    DateTime prPlanDate  = new DateTime(prDelYear, prDelMonth, prDelDay);
                    double   elapsedDays = (int)(firstConfDate - prPlanDate).TotalDays;

                    switch (tag)
                    {
                    case 0:
                        initConfVsPrPlanDateDt.ImportRow(dr);
                        break;

                    case 1:
                        if (elapsedDays <= (-22))
                        {
                            initConfVsPrPlanDateDt.ImportRow(dr);
                        }
                        continue;

                    case 2:
                        if (elapsedDays > (-22) && elapsedDays <= (-15))
                        {
                            initConfVsPrPlanDateDt.ImportRow(dr);
                        }
                        continue;

                    case 3:
                        if (elapsedDays > (-14) && elapsedDays <= (-8))
                        {
                            initConfVsPrPlanDateDt.ImportRow(dr);
                        }
                        continue;

                    case 4:
                        if (elapsedDays > (-7) && elapsedDays <= (-1))
                        {
                            initConfVsPrPlanDateDt.ImportRow(dr);
                        }
                        continue;

                    case 5:
                        if (elapsedDays == 0)
                        {
                            initConfVsPrPlanDateDt.ImportRow(dr);
                        }
                        continue;

                    case 6:
                        if (elapsedDays >= 1 && elapsedDays <= 7)
                        {
                            initConfVsPrPlanDateDt.ImportRow(dr);
                        }
                        continue;

                    case 7:
                        if (elapsedDays >= 8 && elapsedDays <= 14)
                        {
                            initConfVsPrPlanDateDt.ImportRow(dr);
                        }
                        continue;

                    case 8:
                        if (elapsedDays >= 15 && elapsedDays <= 21)
                        {
                            initConfVsPrPlanDateDt.ImportRow(dr);
                        }
                        continue;

                    case 9:
                        if (elapsedDays >= 22)
                        {
                            initConfVsPrPlanDateDt.ImportRow(dr);
                        }
                        continue;

                    default:
                        continue;
                    }
                }

                if (tag != 10)
                {
                    using (DataViewer dv = new DataViewer()
                    {
                        Data = initConfVsPrPlanDateDt
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }
                }
                else
                {
                    using (DataViewer dv = new DataViewer()
                    {
                        Data = unconfirmed
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "KPI -> Purch Data Viewer Calculation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #7
0
        /// <summary>
        /// Triggered when the user clicks a 'view' button which then in return will present
        /// a new window with a datagrid view.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ViewData_Click(object sender, EventArgs e)
        {
            try
            {
                Bunifu.Framework.UI.BunifuFlatButton btn = (Bunifu.Framework.UI.BunifuFlatButton)sender;
                int tag = int.Parse(btn.Tag.ToString());

                switch (ActiveCategory)
                {
                case 0:
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //
                    // Confirmed Vs Plan Date
                    //
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    dt = new DataTable();
                    confVsPlanDateDt = new DataTable();

                    if (Overall.SelectedCountry == AccessInfo.MainTables.US_PRPO)
                    {
                        cmd = new OleDbCommand(PRPOCommands.Queries[(int)PRPOCommands.DatabaseTables.TableNames.KPA_FollowUp_ConfPlanDate] + Filters.FilterQuery, PRPO_DB_Utils.DatabaseConnection);
                    }
                    else
                    {
                        cmd = new OleDbCommand(PRPOCommands.Queries[(int)PRPOCommands.DatabaseTables.TableNames.KPA_FollowUp_ConfPlanDate] + Filters.FilterQuery, PRPO_DB_Utils.DatabaseConnection);
                    }

                    da = new OleDbDataAdapter(cmd);
                    da.Fill(dt);

                    confVsPlanDateDt = dt.Clone();



                    foreach (DataRow dr in dt.Rows)
                    {
                        string[] strCurrConfDate = (dr["Del#Conf#Date"].ToString()).Split('/');
                        int      delConfYear     = int.Parse(strCurrConfDate[2]);
                        int      delConfMonth    = int.Parse(strCurrConfDate[0].TrimStart('0'));
                        int      delConfDay      = int.Parse(strCurrConfDate[1].TrimStart('0'));

                        DateTime delConfDate = 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].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  = (int)(delConfDate - currPlanDate).TotalDays;

                        switch (tag)
                        {
                        case 0:
                            confVsPlanDateDt.ImportRow(dr);
                            break;

                        case 1:
                            if (elapsedDays <= 0)
                            {
                                confVsPlanDateDt.ImportRow(dr);
                            }
                            continue;

                        case 2:
                            if (elapsedDays >= 1 && elapsedDays <= 3)
                            {
                                confVsPlanDateDt.ImportRow(dr);
                            }
                            continue;

                        case 3:
                            if (elapsedDays >= 4 && elapsedDays <= 7)
                            {
                                confVsPlanDateDt.ImportRow(dr);
                            }
                            continue;

                        case 4:
                            if (elapsedDays >= 8 && elapsedDays <= 14)
                            {
                                confVsPlanDateDt.ImportRow(dr);
                            }
                            continue;

                        case 5:
                            if (elapsedDays >= 15 && elapsedDays <= 21)
                            {
                                confVsPlanDateDt.ImportRow(dr);
                            }
                            continue;

                        case 6:
                            if (elapsedDays >= 22 && elapsedDays <= 28)
                            {
                                confVsPlanDateDt.ImportRow(dr);
                            }
                            continue;

                        case 7:
                            if (elapsedDays >= 29)
                            {
                                confVsPlanDateDt.ImportRow(dr);
                            }
                            continue;

                        default:
                            continue;
                        }
                    }

                    using (DataViewer dv = new DataViewer()
                    {
                        Data = confVsPlanDateDt
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }
                    break;

                case 1:
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //
                    // Confirmed Date for Upcoming Deliveries
                    //
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    dt = new DataTable();
                    poFirsconfDateUpDelDt = new DataTable();
                    if (Overall.SelectedCountry == AccessInfo.MainTables.US_PRPO)
                    {
                        cmd = new OleDbCommand(PRPOCommands.Queries[(int)PRPOCommands.DatabaseTables.TableNames.KPA_FollowUp_ConfDateUpcomingDel] + Filters.FilterQuery, PRPO_DB_Utils.DatabaseConnection);
                    }
                    else
                    {
                        cmd = new OleDbCommand(PRPOCommands.Queries[(int)PRPOCommands.DatabaseTables.TableNames.KPA_FollowUp_ConfDateUpcomingDel] + Filters.FilterQuery, PRPO_DB_Utils.DatabaseConnection);
                    }

                    da = new OleDbDataAdapter(cmd);
                    da.Fill(dt);


                    poFirsconfDateUpDelDt = dt.Clone();

                    foreach (DataRow dr in dt.Rows)
                    {
                        string[] strDate = (dr["Del#Conf#Date"].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);
                        double   elapsedDays = (int)(date - DateTime.Now).TotalDays;

                        switch (tag)
                        {
                        case 0:
                            poFirsconfDateUpDelDt.ImportRow(dr);
                            break;

                        case 1:
                            if (elapsedDays <= 0)
                            {
                                poFirsconfDateUpDelDt.ImportRow(dr);
                            }
                            continue;

                        case 2:
                            if (elapsedDays >= 1 && elapsedDays <= 3)
                            {
                                poFirsconfDateUpDelDt.ImportRow(dr);
                            }
                            continue;

                        case 3:
                            if (elapsedDays >= 4 && elapsedDays <= 7)
                            {
                                poFirsconfDateUpDelDt.ImportRow(dr);
                            }
                            continue;

                        case 4:
                            if (elapsedDays >= 8 && elapsedDays <= 14)
                            {
                                poFirsconfDateUpDelDt.ImportRow(dr);
                            }
                            continue;

                        case 5:
                            if (elapsedDays >= 15 && elapsedDays <= 21)
                            {
                                poFirsconfDateUpDelDt.ImportRow(dr);
                            }
                            continue;

                        case 6:
                            if (elapsedDays >= 22 && elapsedDays <= 28)
                            {
                                poFirsconfDateUpDelDt.ImportRow(dr);
                            }
                            continue;

                        case 7:
                            if (elapsedDays >= 29)
                            {
                                poFirsconfDateUpDelDt.ImportRow(dr);
                            }
                            continue;

                        default:
                            continue;
                        }
                    }

                    using (DataViewer dv = new DataViewer()
                    {
                        Data = poFirsconfDateUpDelDt
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }
                    break;

                case 2:
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "KPA -> Follow Up Data Viewer Calculation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #8
0
        /// <summary>
        /// Triggered when the user clicks a 'view' button which then in return will present
        /// a new window with a datagrid view.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ViewData_Click(object sender, EventArgs e)
        {
            try
            {
                Bunifu.Framework.UI.BunifuFlatButton btn = (Bunifu.Framework.UI.BunifuFlatButton)sender;
                int tag = int.Parse(btn.Tag.ToString());

                switch (ActiveCategory)
                {
                case 0:
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //
                    // PR Planned Date vs Current Planned
                    //
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    prPlanDateVsCurrPlanDt = new DataTable();
                    prPlanDateVsCurrPlanDt = Overall.prsOnPOsDt.Clone();



                    foreach (DataRow dr in Overall.prsOnPOsDt.Rows)
                    {
                        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].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 reqDate     = new DateTime(currConfYear, currConfMonth, currConfDay);
                        double   elapsedDays = (int)(reqDate - prPlanDate).TotalDays;

                        switch (tag)
                        {
                        case 0:
                            prPlanDateVsCurrPlanDt.ImportRow(dr);
                            break;

                        case 1:
                            if (elapsedDays <= (-22))
                            {
                                prPlanDateVsCurrPlanDt.ImportRow(dr);
                            }
                            continue;

                        case 2:
                            if (elapsedDays > (-22) && elapsedDays <= (-15))
                            {
                                prPlanDateVsCurrPlanDt.ImportRow(dr);
                            }
                            continue;

                        case 3:
                            if (elapsedDays > (-14) && elapsedDays <= (-8))
                            {
                                prPlanDateVsCurrPlanDt.ImportRow(dr);
                            }
                            continue;

                        case 4:
                            if (elapsedDays > (-7) && elapsedDays <= (-1))
                            {
                                prPlanDateVsCurrPlanDt.ImportRow(dr);
                            }
                            continue;

                        case 5:
                            if (elapsedDays == 0)
                            {
                                prPlanDateVsCurrPlanDt.ImportRow(dr);
                            }
                            continue;

                        case 6:
                            if (elapsedDays >= 1 && elapsedDays <= 7)
                            {
                                prPlanDateVsCurrPlanDt.ImportRow(dr);
                            }
                            continue;

                        case 7:
                            if (elapsedDays >= 8 && elapsedDays <= 14)
                            {
                                prPlanDateVsCurrPlanDt.ImportRow(dr);
                            }
                            continue;

                        case 8:
                            if (elapsedDays >= 15 && elapsedDays <= 21)
                            {
                                prPlanDateVsCurrPlanDt.ImportRow(dr);
                            }
                            continue;

                        case 9:
                            if (elapsedDays >= 22)
                            {
                                prPlanDateVsCurrPlanDt.ImportRow(dr);
                            }
                            continue;

                        default:
                            continue;
                        }
                    }

                    using (DataViewer dv = new DataViewer()
                    {
                        Data = prPlanDateVsCurrPlanDt
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }
                    break;

                case 1:

                    break;

                case 2:

                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "KPI -> Plan Data Viewer Calculation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #9
0
        /// <summary>
        /// Triggered when the user clicks a 'view' button which then in return will present
        /// a new window with a datagrid view.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ViewData_Click(object sender, EventArgs e)
        {
            try
            {
                Bunifu.Framework.UI.BunifuFlatButton btn = (Bunifu.Framework.UI.BunifuFlatButton)sender;
                int tag = int.Parse(btn.Tag.ToString());

                switch (ActiveCategory)
                {
                case 0:
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //
                    // PO Release vs PR Deliver Date
                    //
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    poRelVsPRDelDateDt = new DataTable();
                    poRelVsPRDelDateDt = Overall.prsOnPOsDt.Clone();



                    foreach (DataRow dr in Overall.prsOnPOsDt.Rows)
                    {
                        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 = (int)(prDelDate - poLineFirstRelDate).TotalDays;

                        switch (tag)
                        {
                        case 0:
                            poRelVsPRDelDateDt.ImportRow(dr);
                            break;

                        case 1:
                            if (elapsedDays <= 0)
                            {
                                poRelVsPRDelDateDt.ImportRow(dr);
                            }
                            continue;

                        case 2:
                            if (elapsedDays >= 1 && elapsedDays <= 3)
                            {
                                poRelVsPRDelDateDt.ImportRow(dr);
                            }
                            continue;

                        case 3:
                            if (elapsedDays >= 4 && elapsedDays <= 7)
                            {
                                poRelVsPRDelDateDt.ImportRow(dr);
                            }
                            continue;

                        case 4:
                            if (elapsedDays >= 8 && elapsedDays <= 14)
                            {
                                poRelVsPRDelDateDt.ImportRow(dr);
                            }
                            continue;

                        case 5:
                            if (elapsedDays >= 15 && elapsedDays <= 21)
                            {
                                poRelVsPRDelDateDt.ImportRow(dr);
                            }
                            continue;

                        case 6:
                            if (elapsedDays >= 22 && elapsedDays <= 28)
                            {
                                poRelVsPRDelDateDt.ImportRow(dr);
                            }
                            continue;

                        case 7:
                            if (elapsedDays >= 29 && elapsedDays <= 35)
                            {
                                poRelVsPRDelDateDt.ImportRow(dr);
                            }
                            continue;

                        case 8:
                            if (elapsedDays >= 36 && elapsedDays <= 42)
                            {
                                poRelVsPRDelDateDt.ImportRow(dr);
                            }
                            continue;

                        case 9:
                            if (elapsedDays >= 43 && elapsedDays <= 49)
                            {
                                poRelVsPRDelDateDt.ImportRow(dr);
                            }
                            continue;

                        case 10:
                            if (elapsedDays >= 50)
                            {
                                poRelVsPRDelDateDt.ImportRow(dr);
                            }
                            continue;

                        default:
                            continue;
                        }
                    }

                    using (DataViewer dv = new DataViewer()
                    {
                        Data = poRelVsPRDelDateDt
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }
                    break;

                case 1:
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //
                    // PR 2nd Level Release to Original Planned Delivery Date
                    //
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    pr2ndLvlRelOrigPlanDelDateDt = new DataTable();
                    pr2ndLvlRelOrigPlanDelDateDt = Overall.prsOnPOsDt.Clone();



                    foreach (DataRow dr in Overall.prsOnPOsDt.Rows)
                    {
                        string[] strPR2ndLvlRelDate = (dr["PR 2° Rel# Date"].ToString()).Split('/');
                        int      pr2ndLvlRelYear    = int.Parse(strPR2ndLvlRelDate[2]);
                        int      pr2ndLvlRelMonth   = int.Parse(strPR2ndLvlRelDate[0]);
                        int      pr2ndLvlRelDay     = int.Parse(strPR2ndLvlRelDate[1]);

                        if (pr2ndLvlRelYear == 0 && pr2ndLvlRelMonth == 0 && pr2ndLvlRelDay == 0)
                        {
                            continue;
                        }
                        else
                        {
                            pr2ndLvlRelYear  = int.Parse(strPR2ndLvlRelDate[2]);
                            pr2ndLvlRelMonth = int.Parse(strPR2ndLvlRelDate[0].TrimStart('0'));
                            pr2ndLvlRelDay   = int.Parse(strPR2ndLvlRelDate[1].TrimStart('0'));
                        }
                        DateTime pr2ndLvlRelDate = new DateTime(pr2ndLvlRelYear, pr2ndLvlRelMonth, pr2ndLvlRelDay);

                        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 = (int)(prDelDate - pr2ndLvlRelDate).TotalDays;

                        switch (tag)
                        {
                        case 0:
                            pr2ndLvlRelOrigPlanDelDateDt.ImportRow(dr);
                            break;

                        case 1:
                            if (elapsedDays <= 0)
                            {
                                pr2ndLvlRelOrigPlanDelDateDt.ImportRow(dr);
                            }
                            continue;

                        case 2:
                            if (elapsedDays >= 1 && elapsedDays <= 3)
                            {
                                pr2ndLvlRelOrigPlanDelDateDt.ImportRow(dr);
                            }
                            continue;

                        case 3:
                            if (elapsedDays >= 4 && elapsedDays <= 7)
                            {
                                pr2ndLvlRelOrigPlanDelDateDt.ImportRow(dr);
                            }
                            continue;

                        case 4:
                            if (elapsedDays >= 8 && elapsedDays <= 14)
                            {
                                pr2ndLvlRelOrigPlanDelDateDt.ImportRow(dr);
                            }
                            continue;

                        case 5:
                            if (elapsedDays >= 15 && elapsedDays <= 21)
                            {
                                pr2ndLvlRelOrigPlanDelDateDt.ImportRow(dr);
                            }
                            continue;

                        case 6:
                            if (elapsedDays >= 22 && elapsedDays <= 28)
                            {
                                pr2ndLvlRelOrigPlanDelDateDt.ImportRow(dr);
                            }
                            continue;

                        case 7:
                            if (elapsedDays >= 29 && elapsedDays <= 35)
                            {
                                pr2ndLvlRelOrigPlanDelDateDt.ImportRow(dr);
                            }
                            continue;

                        case 8:
                            if (elapsedDays >= 36 && elapsedDays <= 42)
                            {
                                pr2ndLvlRelOrigPlanDelDateDt.ImportRow(dr);
                            }
                            continue;

                        case 9:
                            if (elapsedDays >= 43 && elapsedDays <= 49)
                            {
                                pr2ndLvlRelOrigPlanDelDateDt.ImportRow(dr);
                            }
                            continue;

                        case 10:
                            if (elapsedDays >= 50)
                            {
                                pr2ndLvlRelOrigPlanDelDateDt.ImportRow(dr);
                            }
                            continue;

                        default:
                            continue;
                        }
                    }

                    using (DataViewer dv = new DataViewer()
                    {
                        Data = pr2ndLvlRelOrigPlanDelDateDt
                    })
                    {
                        dv.LoadData();
                        dv.ShowDialog();
                    }
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "KPI -> Purch/Plan Data Viewer Calculation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }