Example #1
0
        private void LoadProjectList()
        {
            SqlDataReader dr;

            RevSol.RSConnection cnn;
            SqlCommand          cmd;
            string tmpProj;
            int    cnt = 0;

            cnn = new RevSol.RSConnection("CR");
            //SSS 20131105 cmd = new SqlCommand("spProject_ListAll", cnn.GetConnection());
            cmd             = new SqlCommand("spProject_ListAllProj", cnn.GetConnection());
            cmd.CommandType = CommandType.StoredProcedure;

            dr = cmd.ExecuteReader();

            lstJob.Items.Clear();

            while (dr.Read())
            {
                cnt++;
                tmpProj = dr["Number"].ToString();
                lstJob.Items.Add(tmpProj);
            }

            dr.Close();
            cnn.CloseConnection();


            LoadDefaultSelection();
        }
Example #2
0
        private void SaveSelectionChange(string projNum, bool checkedVal)
        {
            RevSol.RSConnection cnn;
            SqlCommand          cmd;
            SqlParameter        prm;

            cnn = new RevSol.RSConnection("CR");

            if (checkedVal == true)
            {
                cmd = new SqlCommand("spBatch_CRProjectInsert", cnn.GetConnection());
            }
            else
            {
                cmd = new SqlCommand("spBatch_CRProjectRemove", cnn.GetConnection());
            }

            cmd.CommandType = CommandType.StoredProcedure;

            prm       = cmd.Parameters.Add("@Project", SqlDbType.VarChar, 50);
            prm.Value = projNum;

            cmd.ExecuteNonQuery();

            cnn.CloseConnection();
        }
Example #3
0
        private void LoadReportforBatchPrint(string project, int rprtCase, string printer, int copy)
        {
            DataSet ds;

            RevSol.RSConnection cnn;
            SqlDataAdapter      da;
            SqlCommand          cmd;
            SqlParameter        prm;
            string currDate;

            this.Cursor = Cursors.WaitCursor;


            currDate = DateTime.Now.ToShortDateString();

            cnn = new RevSol.RSConnection("CR");

            if (UseNewCodes(project) == true)
            {
                cmd = new SqlCommand("spRPRT_CostReport_NewAcct2_Vision_Batch", cnn.GetConnection());
            }
            else
            {
                cmd = new SqlCommand("spRPRT_CostReport_OldAcct2_Vision_Batch", cnn.GetConnection());
            }

            cmd.CommandType = CommandType.StoredProcedure;


            //prm = cmd.Parameters.Add("@records", SqlDbType.Int); //*******Added 10/1/2015, because, it was throwing exception in PM Report
            //prm.Direction = ParameterDirection.Output;
            prm       = cmd.Parameters.Add("@Project", SqlDbType.VarChar, 50);
            prm.Value = project;
            prm       = cmd.Parameters.Add("@Rprtdate", SqlDbType.SmallDateTime);
            prm.Value = currDate;
            prm       = cmd.Parameters.Add("@ReportCase", SqlDbType.Int);
            prm.Value = rprtCase;

            da = new SqlDataAdapter();
            ds = new DataSet();
            da.SelectCommand = cmd;

            da.Fill(ds);
            FtcCalculator.UpdateCalculatedField(ds);

            cnn.CloseConnection();

            //  rprtCostReport1 rprt = new rprtCostReport1();
            rprtCostReport2 rprt = new rprtCostReport2();

            rprt.Document.Printer.PrinterName            = printer;
            rprt.Document.Printer.PrinterSettings.Copies = (short)copy;
            rprt.CutoffDate = currDate;
            rprt.DataSource = ds;
            rprt.DataMember = "Table";
            rprt.Run();
            rprt.Document.Print(false, false);

            this.Cursor = Cursors.Default;
        }
Example #4
0
        private void LoadRollupList()
        {
            SqlDataReader dr;

            RevSol.RSConnection cnn;
            SqlCommand          cmd;
            string tmpProj;
            int    cnt = 0;

            cnn             = new RevSol.RSConnection("CR");
            cmd             = new SqlCommand("spProject_ListAllMasters", cnn.GetConnection());
            cmd.CommandType = CommandType.StoredProcedure;

            dr = cmd.ExecuteReader();

            chkRollups.Items.Clear();

            while (dr.Read())
            {
                cnt++;
                tmpProj = dr["Number"].ToString();
                chkRollups.Items.Add(tmpProj);
            }

            dr.Close();
            cnn.CloseConnection();
        }
Example #5
0
        private void SaveSelectionChange(string dept, string proj, bool checkedVal)
        {
            RevSol.RSConnection cnn;
            SqlCommand          cmd;
            SqlParameter        prm;

            //SSS 20131104  string tmpProj;
            //SSS 20131104 string tmpLst;
            //SSS 20131104  int cnt = 0;

            cnn = new RevSol.RSConnection("CR");

            if (checkedVal == true)
            {
                cmd = new SqlCommand("spBatch_DTProjectInsert", cnn.GetConnection());
            }
            else
            {
                cmd = new SqlCommand("spBatch_DTProjectRemove", cnn.GetConnection());
            }

            cmd.CommandType = CommandType.StoredProcedure;

            prm       = cmd.Parameters.Add("@Department", SqlDbType.VarChar, 50);
            prm.Value = dept;
            prm       = cmd.Parameters.Add("@Project", SqlDbType.VarChar, 50);
            prm.Value = proj;

            cmd.ExecuteNonQuery();

            cnn.CloseConnection();
        }
Example #6
0
        private void LoadCurrentGroups()
        {
            RevSol.RSConnection cnn;
            SqlDataReader       dr;
            SqlCommand          cmd;
            SqlParameter        prm;
            DataRow             d;
            int       grpNum;
            CBProject proj = new CBProject();

            proj.Load(msCurrProj);

            if (CheckForPipeline(msCurrProj) == true)
            {
                grpNum = 1;
            }
            else
            {
                grpNum = 0;
            }

            if (proj.UseAllGroups() == true)
            {
                grpNum = 0;
            }

            CreateNewForecastDS();

            cnn = new RevSol.RSConnection("CR");

            cmd             = new SqlCommand("spAcctGroup_ListAll2", cnn.GetConnection());
            cmd.CommandType = CommandType.StoredProcedure;

            prm       = cmd.Parameters.Add("@SpecialGroup", SqlDbType.Int);
            prm.Value = grpNum;

            dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                d = mdsForecast.Tables["Forecast"].NewRow();

                d["AcctGroup"] = dr["AcctNumber"];
                d["FTCHrs"]    = 0;
                d["FTCRate"]   = 0;

                mdsForecast.Tables["ForeCast"].Rows.Add(d);
            }



            dr.Close();
            cnn.CloseConnection();


            LoadExpenseGroups();
        }
Example #7
0
        private GrapeCity.ActiveReports.Document.Section.PagesCollection CreatePagesForecast(string project, int rprtCase)
        {
            DataSet ds;

            RevSol.RSConnection cnn;
            SqlDataAdapter      da;
            SqlCommand          cmd;
            SqlParameter        prm;
            string currDate;

            this.Cursor = Cursors.WaitCursor;

            currDate = DateTime.Now.ToShortDateString();

            cnn = new RevSol.RSConnection("CR");

            if (UseNewCodes(project) == true)
            {
                cmd = new SqlCommand("spRPRT_CostReport_NewAcct2_Vision_Batch", cnn.GetConnection());
            }
            else
            {
                cmd = new SqlCommand("spRPRT_CostReport_OldAcct2_Vision_Batch", cnn.GetConnection());
            }

            cmd.CommandType = CommandType.StoredProcedure;

            prm       = cmd.Parameters.Add("@Project", SqlDbType.VarChar, 50);
            prm.Value = project;
            prm       = cmd.Parameters.Add("@Rprtdate", SqlDbType.SmallDateTime);
            prm.Value = currDate;
            prm       = cmd.Parameters.Add("@ReportCase", SqlDbType.Int);
            prm.Value = rprtCase;

            da = new SqlDataAdapter();
            ds = new DataSet();
            da.SelectCommand = cmd;

            da.Fill(ds);
            FtcCalculator.UpdateCalculatedField(ds);

            cnn.CloseConnection();

            //   rprtCostReport1 rprt = new rprtCostReport1();

            rprtCostReport2 rprt = new rprtCostReport2();

            rprt.CutoffDate = currDate;
            rprt.DataSource = ds;
            rprt.DataMember = "Table";
            rprt.Run(false);

            return(rprt.Document.Pages);
        }
Example #8
0
        public void LoadReportForDeptList(string projects, string acct)
        {
            DataSet ds;

            RevSol.RSConnection cnn;
            SqlDataAdapter      da;
            SqlCommand          cmd;
            SqlParameter        prm;
            string currDate;

            this.Cursor = Cursors.WaitCursor;

            currDate = DateTime.Now.ToShortDateString();
            cnn      = new RevSol.RSConnection("CR");

            cmd             = new SqlCommand("spRPRT_CostReport_ByDept", cnn.GetConnection());
            cmd.CommandType = CommandType.StoredProcedure;

            prm       = cmd.Parameters.Add("@ProjXml", SqlDbType.Text);
            prm.Value = projects;
            prm       = cmd.Parameters.Add("@AcctCode", SqlDbType.VarChar, 10);
            prm.Value = acct;

            da = new SqlDataAdapter();
            ds = new DataSet();
            da.SelectCommand = cmd;
            //  try
            // {

            da.Fill(ds);

            cnn.CloseConnection();

            rprtCostReport1 rprt = new rprtCostReport1();

            rprt.CutoffDate = currDate;
            rprt.NoExpenses();
            rprt.DataSource  = ds;
            rprt.DataMember  = "Table";
            viewer1.Document = rprt.Document;
            // By default rprtCostReport1.records = 0. So, when its Called for Report for Department, Detail part becomes invisible.

            rprt.records = 10;     //**********************Added 10/20/2015 *******************To Test

            rprt.Run();
            //}
            //catch {
            //    MessageBox.Show("Exception");
            //}
            this.Cursor = Cursors.Default;
        }
Example #9
0
        private void LoadDefaultSelection()
        {
            SqlDataReader dr;

            RevSol.RSConnection cnn;
            SqlCommand          cmd;
            SqlParameter        prm;
            string tmpDept;
            string tmpLst;

            tmpDept = mdsDepts.Tables["Depts"].Rows[cboDept.Bookmark]["Name"].ToString();

            cnn             = new RevSol.RSConnection("CR");
            cmd             = new SqlCommand("spBatch_DTProjectList", cnn.GetConnection());
            cmd.CommandType = CommandType.StoredProcedure;

            prm       = cmd.Parameters.Add("@Department", SqlDbType.VarChar, 50);
            prm.Value = tmpDept;

            dr = cmd.ExecuteReader();

            mbLoadingList = true;

            while (dr.Read())
            {
                tmpDept = dr["Number"].ToString();

                for (int i = 0; i < lstJob.Items.Count; i++)
                {
                    tmpLst = lstJob.Items[i].ToString();

                    if (tmpLst == tmpDept)
                    {
                        lstJob.SetItemChecked(i, true);
                        break;
                    }
                }
            }

            mbLoadingList = false;

            dr.Close();
            cnn.CloseConnection();


            if (lstJob.CheckedItems.Count > 0)
            {
                bttPreview.Enabled = true;
            }
        }
Example #10
0
        public void LoadReportForDetailFirstTry(string project)
        {
            DataSet ds;

            RevSol.RSConnection cnn;
            SqlDataAdapter      da;
            SqlCommand          cmd;
            SqlParameter        prm;
            string currDate;

            this.Cursor = Cursors.WaitCursor;


            currDate = DateTime.Now.ToShortDateString();


            cnn = new RevSol.RSConnection("CR");

            cmd             = new SqlCommand("spRPRT_CostReport_DetailNew", cnn.GetConnection());
            cmd.CommandType = CommandType.StoredProcedure;

            prm       = cmd.Parameters.Add("@Project", SqlDbType.VarChar, 50);
            prm.Value = project;
            prm       = cmd.Parameters.Add("@Rprtdate", SqlDbType.SmallDateTime);
            prm.Value = currDate;

            da = new SqlDataAdapter();
            ds = new DataSet();
            da.SelectCommand = cmd;
            da.Fill(ds);

            cnn.CloseConnection();

            rprtCostReportDetail1 rprt = new rprtCostReportDetail1();

            projNumber = project;
            //  p.ViewReport(rprt);
            ViewReport(rprt);

            //rprt.CutoffDate = currDate;
            rprt.DataSource  = ds;
            rprt.DataMember  = "Table";
            viewer1.Document = rprt.Document;
            rprt.Run();

            this.Cursor = Cursors.Default;
        }
Example #11
0
        private void LoadDefaultSelection()
        {
            SqlDataReader dr;

            RevSol.RSConnection cnn;
            SqlCommand          cmd;
            string tmpProj;
            string tmpLst;

            cnn             = new RevSol.RSConnection("CR");
            cmd             = new SqlCommand("spBatch_CRProjectList", cnn.GetConnection());
            cmd.CommandType = CommandType.StoredProcedure;

            dr = cmd.ExecuteReader();

            mbLoadingList = true;

            while (dr.Read())
            {
                tmpProj = dr["Number"].ToString();

                for (int i = 0; i < clstProjects.Items.Count; i++)
                {
                    tmpLst = clstProjects.Items[i].ToString();

                    if (tmpLst == tmpProj)
                    {
                        clstProjects.SetItemChecked(i, true);
                        break;
                    }
                }
            }

            mbLoadingList = false;

            dr.Close();
            cnn.CloseConnection();


            if (clstProjects.CheckedItems.Count > 0)
            {
                bttPrint.Enabled = true;
            }
        }
Example #12
0
        private void LoadDepartmentList()
        {
            DataTable  dt;
            DataColumn dc;

            dt = new DataTable("Depts");
            dc = new DataColumn("Code", Type.GetType("System.String"));
            dt.Columns.Add(dc);
            dc = new DataColumn("Name", Type.GetType("System.String"));
            dt.Columns.Add(dc);

            mdsDepts = new DataSet();
            mdsDepts.Tables.Add(dt);

            SqlDataReader dr;

            RevSol.RSConnection cnn;
            SqlCommand          cmd;
            DataRow             d;

            cnn             = new RevSol.RSConnection("CR");
            cmd             = new SqlCommand("spDepartment_ListAll", cnn.GetConnection());
            cmd.CommandType = CommandType.StoredProcedure;

            dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                d         = mdsDepts.Tables["Depts"].NewRow();
                d["Code"] = dr["AcctGroup"].ToString();
                d["Name"] = dr["Name"].ToString();
                mdsDepts.Tables["Depts"].Rows.Add(d);
            }

            dr.Close();
            cnn.CloseConnection();

            cboDept.HoldFields();
            cboDept.DataSource = mdsDepts;
            cboDept.DataMember = "Depts";
            cboDept.Rebind();
        }
Example #13
0
        private void LoadProjectList()
        {
            SqlDataReader dr;

            RevSol.RSConnection cnn;
            SqlCommand          cmd;
            string tmpProj;
            string tmpDescription;
            int    cnt = 0;

            cnn = new RevSol.RSConnection("CR");
            if (mbIsMasterList == true)
            {
                cmd = new SqlCommand("spProject_ListAllMasters", cnn.GetConnection());
            }
            else
            {
                //SSS 20131105 cmd = new SqlCommand("spProject_ListAll", cnn.GetConnection());
                cmd = new SqlCommand("spProject_ListAllProj", cnn.GetConnection());
            }
            cmd.CommandType = CommandType.StoredProcedure;

            dr = cmd.ExecuteReader();

            // lstProjects.Items.Clear();//******************Commented 6/16/15***11 am***MZ

            while (dr.Read())
            {
                cnt++;
                tmpProj = dr["Number"].ToString();

                //tmpDescription=dr["Description"].ToString();
                lstProjects.Items.Add(tmpProj);     //******************Commented 6/16/15***11 am***MZ
                //lstProjects.SubItems.Add(dr["Description"].ToString());
            }

            dr.Close();
            cnn.CloseConnection();

            stPan1.Text = cnt.ToString() + " Project(s)";
        }
Example #14
0
        public int GetPCNID_From_PCNNumber(string PCNNumber, int projID) //************************Added 11/2/2015
        {
            SqlDataReader dr;

            RevSol.RSConnection cnn;
            SqlParameter        prm;
            SqlCommand          cmd;

            int cnt   = 0;
            int pcnID = 0;

            cnn = new RevSol.RSConnection("CR");

            cmd = new SqlCommand("spBudgetPCN_ListAllByProject", cnn.GetConnection());

            cmd.CommandType = CommandType.StoredProcedure;

            prm       = cmd.Parameters.Add("@ProjectID", SqlDbType.Int);
            prm.Value = projectID;



            dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                cnt++;
                if (dr["PCNNumber"].ToString() == PCNNumber)
                {
                    pcnID = Convert.ToInt32(dr["ID"]);
                }
            }

            dr.Close();
            cnn.CloseConnection();

            return(pcnID);
        }
Example #15
0
        private void LoadPCNList(int projectID)
        {
            SqlDataReader dr;

            RevSol.RSConnection cnn;
            SqlParameter        prm;
            SqlCommand          cmd;
            string PCNNo;
            int    cnt = 0;

            cnn = new RevSol.RSConnection("CR");
            cmd = new SqlCommand("spBudgetPCN_ListAllByProject", cnn.GetConnection());

            cmd.CommandType = CommandType.StoredProcedure;

            prm       = cmd.Parameters.Add("@ProjectID", SqlDbType.Int);
            prm.Value = projectID;



            dr = cmd.ExecuteReader();

            clstProjects.Items.Clear();

            while (dr.Read())
            {
                cnt++;
                PCNNo = dr["PCNNumber"].ToString() + "--" + dr["PCNStatus"].ToString() + "--" + dr["PCNTitle"].ToString();
                clstProjects.Items.Add(PCNNo);
            }

            dr.Close();
            cnn.CloseConnection();


            //  LoadDefaultSelection();
        }
Example #16
0
        public DataSet GetCRForProject(string projNum, int rprtCase)
        {
            DataSet ds;

            RevSol.RSConnection cnn;
            SqlDataAdapter      da;
            SqlCommand          cmd;
            SqlParameter        prm;
            string currDate;

            currDate = DateTime.Now.ToShortDateString();

            cnn             = new RevSol.RSConnection("CR");
            cmd             = new SqlCommand("spRPRT_CostReport_NewAcct2_Vision", cnn.GetConnection());
            cmd.CommandType = CommandType.StoredProcedure;

            prm           = cmd.Parameters.Add("@records", SqlDbType.Int); //********************Added 7/23/2015
            prm.Direction = ParameterDirection.Output;

            prm       = cmd.Parameters.Add("@Project", SqlDbType.VarChar, 50);
            prm.Value = projNum;
            prm       = cmd.Parameters.Add("Rprtdate", SqlDbType.SmallDateTime);
            prm.Value = currDate;
            prm       = cmd.Parameters.Add("@ReportCase", SqlDbType.Int);
            prm.Value = rprtCase;

            ds = new DataSet();
            da = new SqlDataAdapter();
            da.SelectCommand = cmd;
            da.Fill(ds);
            FtcCalculator.UpdateCalculatedField(ds);

            cnn.CloseConnection();

            return(ds);
        }
Example #17
0
        public DataTable GetProjectInfo(string projNum)
        {
            DataSet ds;

            RevSol.RSConnection cnn;
            SqlDataAdapter      da;
            SqlCommand          cmd;
            SqlParameter        prm;

            cnn             = new RevSol.RSConnection("CR");
            cmd             = new SqlCommand("spRPRT_CostReport_NewAcct2_ProjectInfo", cnn.GetConnection());
            cmd.CommandType = CommandType.StoredProcedure;
            prm             = cmd.Parameters.Add("@Project", SqlDbType.VarChar, 50);
            prm.Value       = projNum;

            ds = new DataSet();
            da = new SqlDataAdapter();
            da.SelectCommand = cmd;
            da.Fill(ds);

            cnn.CloseConnection();

            return(ds.Tables[0]);
        }
Example #18
0
        public void LoadReportForProject_Pipelines(int rprtCase)
        {
            DataSet ds;

            RevSol.RSConnection cnn;
            SqlDataAdapter      da;
            SqlCommand          cmd;
            SqlParameter        prm;
            string currDate;
            int    record = 0; //**************************************************10/20/2015

            this.Cursor = Cursors.WaitCursor;

            currDate = DateTime.Now.ToShortDateString();

            cnn = new RevSol.RSConnection("CR");

            if (UseNewCodes(msCurrProj) == true)
            {
                cmd = new SqlCommand("spRPRT_CostReport_NewAcct2_Vision_Pipelines", cnn.GetConnection());
            }
            else
            {
                cmd = new SqlCommand("spRPRT_CostReport_OldAcct2_Vision_Pipelines", cnn.GetConnection());
            }

            cmd.CommandType = CommandType.StoredProcedure;


            prm           = cmd.Parameters.Add("@records", SqlDbType.Int); //*******Added 10/1/2015, because, it was throwing exception in PM Report
            prm.Direction = ParameterDirection.Output;

            prm       = cmd.Parameters.Add("@Project", SqlDbType.VarChar, 50);
            prm.Value = msCurrProj;
            prm       = cmd.Parameters.Add("@Rprtdate", SqlDbType.SmallDateTime);
            prm.Value = currDate;
            prm       = cmd.Parameters.Add("@ReportCase", SqlDbType.Int);
            prm.Value = rprtCase;

            da = new SqlDataAdapter();
            ds = new DataSet();
            da.SelectCommand = cmd;

            da.Fill(ds);
            FtcCalculator.UpdateCalculatedField(ds);
            record = Convert.ToInt32(cmd.Parameters["@records"].Value); //****************************************Added 10/20/2015
            cnn.CloseConnection();

            rprtCostReport1 rprt = new rprtCostReport1();

            rprt.records = record;
            //     MessageBox.Show(rprt.records.ToString());
            rprt.CutoffDate = currDate;
            rprt.DataSource = ds;
            rprt.DataMember = "Table";

            viewer1.Document = rprt.Document;
            rprt.Run();

            this.Cursor = Cursors.Default;
        }
Example #19
0
        public DSForecastRprt LoadReportForProjectRollup(string project, int rprtCase)
        {
            DataSet ds;

            RevSol.RSConnection cnn;
            SqlCommand          cmd;
            SqlParameter        prm;
            SqlDataReader       dr;
            DSForecastRprt      dsFor;

            cnn             = new RevSol.RSConnection("CR");
            cmd             = new SqlCommand("spProject_GetListByMaster", cnn.GetConnection());
            cmd.CommandType = CommandType.StoredProcedure;
            prm             = cmd.Parameters.Add("@MasterNum", SqlDbType.VarChar, 50);
            prm.Value       = project;
            dr = cmd.ExecuteReader();

            dsFor = new DSForecastRprt();

            string sProject, sDescription, sCustomer, sLocation, sManager, sBillType;
            var    project_info = GetProjectInfo(project);

            ds = GetCRForProject(project, rprtCase);

            sProject     = "";
            sDescription = "";
            sCustomer    = "";
            sLocation    = "";
            sManager     = "";
            sBillType    = "";

            foreach (DataRow d in project_info.Rows)
            {
                sProject     = d["Project"].ToString();
                sDescription = d["Description"].ToString();
                sCustomer    = d["Customer"].ToString();
                sLocation    = d["Location"].ToString();
                sManager     = d["Manager"].ToString();
                sBillType    = d["BillType"].ToString();
            }

            while (dr.Read())
            {
                ds = GetCRForProject(dr["Number"].ToString(), rprtCase);


                foreach (DataRow d in ds.Tables[0].Rows)
                {
                    DSForecastRprt.EngrInfoRow eir = dsFor.EngrInfo.NewEngrInfoRow();

                    eir.Project     = sProject;
                    eir.Description = sDescription;
                    eir.Customer    = sCustomer;
                    eir.Location    = sLocation;
                    eir.BudgetGroup = d["BudgetGroup"].ToString();
                    eir.AcctGroup   = d["AcctGroup"].ToString();
                    eir.Manager     = sManager;
                    eir.BillType    = sBillType;
                    try
                    {
                        eir.BudgetDlrs    = Convert.ToDecimal(d["BudgetDlrs"]);
                        eir.BudgetHrs     = Convert.ToDecimal(d["BudgetHrs"]);
                        eir.ActualTime    = Convert.ToDecimal(d["ActualTime"]);
                        eir.ActualAmnt    = Convert.ToDecimal(d["ActualAmnt"]);
                        eir.JSBudgetHrs   = Convert.ToDecimal(d["JSBudgetHrs"]);
                        eir.RemainingHrs  = Convert.ToDecimal(d["RemainingHrs"]);
                        eir.JSLastUpdated = Convert.ToDateTime(d["JSLastUpdated"]);
                        eir.EarnedHrs     = Convert.ToDecimal(d["EarnedHrs"]);
                        eir.ProjectedHrs  = Convert.ToDecimal(d["ProjectedHrs"]);
                        eir.ForecastHrs   = Convert.ToDecimal(d["ForecastHrs"]);
                        eir.FTCHrs        = Convert.ToDecimal(d["FTCHrs"]);
                        eir.FTCAmnt       = Convert.ToDecimal(d["FTCAmnt"]);
                        eir.FTCUpdate     = Convert.ToDateTime(d["FTCUpdate"]);
                    }
                    catch { }

                    dsFor.EngrInfo.AddEngrInfoRow(eir);
                }

                foreach (DataRow d in ds.Tables[1].Rows)
                {
                    DSForecastRprt.Table1Row t1r = dsFor.Table1.NewTable1Row();

                    t1r.Project         = sProject;
                    t1r.AcctNumber      = d["AcctNumber"].ToString();
                    t1r.AcctGroup       = d["AcctGroup"].ToString();
                    t1r.AcctNumberGroup = d["AcctNumberGroup"].ToString();
                    t1r.budget          = Convert.ToDecimal(d["budget"]);
                    t1r.costs           = Convert.ToDecimal(d["costs"]);
                    t1r.ForecastHrs     = Convert.ToDecimal(d["ForecastHrs"]);
                    t1r.ForecastAmnt    = Convert.ToDecimal(d["ForecastAmnt"]);
                    t1r.ftc             = Convert.ToDecimal(d["ftc"]);

                    dsFor.Table1.AddTable1Row(t1r);
                }
            }

            dr.Close();

            DSForecastRprt rprtDs = new DSForecastRprt();


            var groups = new List <string>();

            foreach (DataRow row in dsFor.EngrInfo.Rows)
            {
                groups.Add(row["BudgetGroup"].ToString());
            }
            groups = groups.Distinct().OrderBy(x => x).ToList();

            foreach (var group in groups)
            {
                DSForecastRprt.EngrInfoRow eRow = rprtDs.EngrInfo.NewEngrInfoRow();
                DataRow[] dInfos = dsFor.EngrInfo.Select("BudgetGroup = '" + group + "'");
                this.GroupRows(dInfos, eRow);
                rprtDs.EngrInfo.AddEngrInfoRow(eRow);
            }


            var exp_groups = new List <string>();

            foreach (DataRow row in dsFor.Table1.Rows)
            {
                exp_groups.Add(row["AcctNumber"].ToString());
            }
            exp_groups = exp_groups.Distinct().OrderBy(x => x).ToList();

            foreach (var exp_group in exp_groups)
            {
                DSForecastRprt.Table1Row tblRow = rprtDs.Table1.NewTable1Row();
                DataRow[] dInfos = dsFor.Table1.Select("AcctNumber = '" + exp_group + "'");
                this.GroupExpRows(sProject, dInfos, tblRow);
                rprtDs.Table1.AddTable1Row(tblRow);
            }


            return(rprtDs);
        }
Example #20
0
        private void bttUpdate_Click(object sender, EventArgs e)
        {
            RevSol.RSConnection cnn;
            SqlCommand          cmd;
            SqlParameter        prm;
            int       forecastID;
            int       specGrp = 0;
            CBProject proj    = new CBProject();

            proj.Load(msCurrProj);

            cnn             = new RevSol.RSConnection("CR");
            cmd             = new SqlCommand("spForecastUpdate_Insert", cnn.GetConnection());
            cmd.CommandType = CommandType.StoredProcedure;

            prm           = cmd.Parameters.Add("@ForecastID", SqlDbType.Int);
            prm.Direction = ParameterDirection.Output;
            prm           = cmd.Parameters.Add("@Project", SqlDbType.VarChar, 50);
            prm.Value     = msCurrProj;

            cmd.ExecuteNonQuery();

            forecastID = Convert.ToInt32(cmd.Parameters["@ForecastID"].Value);

            specGrp = 0;


            if (proj.UseAllGroups() == true)
            {
                specGrp = 0;
            }

            string  acct;
            decimal hrs, amnt;

            foreach (DataRow dr in mdsForecast.Tables["Forecast"].Rows)
            {
                acct = dr["AcctGroup"].ToString();
                hrs  = Convert.ToDecimal(dr["FTCHrs"]);
                amnt = Convert.ToDecimal(dr["FTCRate"]);

                cmd             = new SqlCommand("spForecastToComplete_Insert2_Vision", cnn.GetConnection());
                cmd.CommandType = CommandType.StoredProcedure;


                prm       = cmd.Parameters.Add("@ForecastID", SqlDbType.Int);
                prm.Value = forecastID;
                prm       = cmd.Parameters.Add("@AccountGroup", SqlDbType.VarChar, 50);
                prm.Value = acct.Replace("E", "");
                prm       = cmd.Parameters.Add("@ForecastHrs", SqlDbType.Money);
                prm.Value = hrs;
                prm       = cmd.Parameters.Add("@ForecastRate", SqlDbType.Money);
                prm.Value = amnt;
                prm       = cmd.Parameters.Add("@SpecialGroup", SqlDbType.Int);
                prm.Value = specGrp;

                cmd.ExecuteNonQuery();
            }

            cnn.CloseConnection();

            LoadCurrentGroups();

            bttUpdate.Enabled      = false;
            bttSetForecast.Enabled = false;

            LoadReportForProject(FCRMain.GetRprtCase(msCurrProj));
        }