Пример #1
0
        private void cboProjects_SelectedIndexChanged(object sender, EventArgs e)
        {
            int      projID;
            CBBudget bud = new CBBudget();

            lstBudgets.Items.Clear();

            projID = ((RevSol.RSListItem)cboProjects.SelectedItem).ID;

            SqlDataReader dr = CBBudget.GetListByProject(projID);

            RevSol.RSListItem li;

            while (dr.Read())
            {
                bud.Load(Convert.ToInt32(dr["ID"]));

                li             = new RevSol.RSListItem();
                li.ID          = bud.ID;
                li.Description = bud.GetNumber();

                lstBudgets.Items.Add(li);
            }

            dr.Close();

            IsReadyForCopy();
        }
Пример #2
0
        public void EditPreviousPCN(int pcnID)
        {
            ClearForm();

            moProj = new CBProject();
            moBudg = new CBBudget();

            moPCN.LoadWithData(pcnID);
            moProj.Load(moPCN.ProjectID);
            project_ID = moPCN.ProjectID;

            List <CBActivityCodeDisc> _Groups = CBActivityCodeDisc.GetAllForProject(project_ID).ToList();

            foreach (var group in _Groups)
            {
                codes[i] = group.Code;
                i++;
            }


            moBudg.LoadByProject(moProj.ID);

            LoadFromPCN();

            this.Text = "PCN: Job-" + moProj.Number + " PCN-" + moPCN.PCNNumber;

            SetPCNSecurityLevel();
            mbIsFixedRate = moProj.IsFixedRate;
            SetPCN_RateLevel();
        }
Пример #3
0
        public void PreviewBudgetFormEntry(int budID, string wbs)
        {
            FPreviewAR           pv   = new FPreviewAR();
            rprtBudgetAccounting rprt = new rprtBudgetAccounting();
            DataSet    ds;
            CBBudget   bud   = new CBBudget();
            CBProject  proj  = new CBProject();
            CBCustomer cust  = new CBCustomer();
            CBLocation loc   = new CBLocation();
            CBState    state = new CBState();

            bud.Load(budID);
            proj.Load(bud.ProjectID);
            cust.Load(proj.CustomerID);
            loc.Load(proj.LocationID);
            state.Load(loc.StateID);

            ds = CBBudget.GetBudgetAccountingEntryForReport(budID, wbs);

            rprt.SetTitles(cust.Name + " / " + loc.City + "," + state.Abbrev, proj.Description, proj.Number, bud.GetNumber(), wbs);
            rprt.DataSource = ds;
            rprt.DataMember = "Table";
            pv.projNumber   = proj.Number; //*************************Added 6/29/15

            pv.ViewReport(rprt);
            pv.ShowDialog();
        }
Пример #4
0
        private GrapeCity.ActiveReports.Document.Section.PagesCollection CreatePagesBudgetFormEntry(int budID, string wbs)
        {
            rprtBudgetAccounting rprt = new rprtBudgetAccounting();
            DataSet    ds;
            CBBudget   bud   = new CBBudget();
            CBProject  proj  = new CBProject();
            CBCustomer cust  = new CBCustomer();
            CBLocation loc   = new CBLocation();
            CBState    state = new CBState();

            bud.Load(budID);
            proj.Load(bud.ProjectID);
            cust.Load(proj.CustomerID);
            loc.Load(proj.LocationID);
            state.Load(loc.StateID);

            ds = CBBudget.GetBudgetAccountingEntryForReport(budID, wbs);

            rprt.SetTitles(cust.Name + " / " + loc.City + "," + state.Abbrev, proj.Description, proj.Number, bud.GetNumber(), wbs);
            rprt.DataSource = ds;
            rprt.DataMember = "Table";

            rprt.Run(false);

            return(rprt.Document.Pages);
        }
Пример #5
0
        private void bttCopy_Click(object sender, EventArgs e)
        {
            int budID;
            int newProjID;
            int newRevision;

            budID       = ((RevSol.RSListItem)lstBudgets.SelectedItem).ID;
            newProjID   = ((RevSol.RSListItem)cboTargetProj.SelectedItem).ID;
            newRevision = RevSol.RSMath.IsIntegerEx(txtRevision.Text);

            string msg;

            try
            {
                CBBudget.CopyBudgetToProject(budID, newProjID, newRevision);

                msg = "Copied budget to new project";
            }
            catch
            {
                msg = "Unable to copy budget";
            }

            MessageBox.Show(msg);
        }
Пример #6
0
        public void InsertWBS1Outline(int budID)
        {
            CDbVisionExport db   = new CDbVisionExport();
            CBBudget        bud  = new CBBudget();
            CBProject       proj = new CBProject();

            bud.Load(budID);
            proj.Load(bud.ProjectID);

            db.InsertWBS1Outline(proj.Number, proj.Description, proj.Number, proj.DateStart, proj.DateEnd);
        }
Пример #7
0
        public void PreviewBudgetDetails(int budID, string wbs)
        {
            FPreviewAR       pv   = new FPreviewAR();
            rprtBudgetDetail rprt = new rprtBudgetDetail();
            DataSet          ds;
            CBBudget         bud   = new CBBudget();
            CBProject        proj  = new CBProject();
            CBCustomer       cust  = new CBCustomer();
            CBLocation       loc   = new CBLocation();
            CBState          state = new CBState();

            bud.Load(budID);
            proj.Load(bud.ProjectID);
            cust.Load(proj.CustomerID);
            loc.Load(proj.LocationID);
            state.Load(loc.StateID);

            ds = CBBudget.GetBudgetDetailsForReport(budID, wbs);


            if (proj.BusinessUnit() == 1)
            {
                rprt.MainReportTitle = "Staffing Estimate Loaded Details";
            }
            if (proj.BusinessUnit() == 2)
            {
                rprt.MainReportTitle = "Engineering Estimate Loaded Details";
            }
            if (proj.BusinessUnit() == 3)
            {
                rprt.MainReportTitle = "Pipeline Services Estimate Loaded Details";
            }
            if (proj.BusinessUnit() == 4)
            {
                rprt.MainReportTitle = "Program Management Estimate Loaded Details";
            }
            if (proj.BusinessUnit() == 5)
            {
                rprt.MainReportTitle = "EPC Estimate Loaded Details";
            }


            pv.projNumber = proj.Number; //***************************Added 6/25/15

            // MessageBox.Show(pv.projNumber);

            rprt.SetTitles(cust.Name + " / " + loc.City + "," + state.Abbrev, proj.Description, proj.Number, bud.GetNumber(), wbs);
            rprt.DataSource = ds;
            rprt.DataMember = "Table";
            pv.Title        = rprt.MainReportTitle; //************************Added 10/1/2015
            pv.ViewReport(rprt);
            pv.ShowDialog();
        }
Пример #8
0
        public void InsertWBS2Outline(int budID, string OutlineNumber, string Name, string WBS2, string ParentOutlineNumber,
                                      DateTime DateStart, DateTime DateEnd, int ChildrenCount)
        {
            CDbVisionExport db   = new CDbVisionExport();
            CBBudget        bud  = new CBBudget();
            CBProject       proj = new CBProject();

            bud.Load(budID);
            proj.Load(bud.ProjectID);

            db.InsertWBS2Outline(proj.Number, OutlineNumber, Name, proj.Number, WBS2, ParentOutlineNumber, DateStart, DateEnd, ChildrenCount);
        }
Пример #9
0
        public void SetBudget(int budgetID)
        {
            CBBudget bud = new CBBudget();

            bud.Load(budgetID);

            miBudgetID          = budgetID;
            txtBudget.Text      = bud.GetNumber();
            txtDescription.Text = bud.Description;
            txtPreparedBy.Text  = bud.PreparedBy;
            txtContingency.Text = bud.Contingency.ToString("#,##0.00");
        }
Пример #10
0
        private GrapeCity.ActiveReports.Document.Section.PagesCollection CreatePagesBudgetDetails(int budID, string wbs)
        {
            rprtBudgetDetail rprt = new rprtBudgetDetail();
            DataSet          ds;
            CBBudget         bud   = new CBBudget();
            CBProject        proj  = new CBProject();
            CBCustomer       cust  = new CBCustomer();
            CBLocation       loc   = new CBLocation();
            CBState          state = new CBState();

            bud.Load(budID);
            proj.Load(bud.ProjectID);
            cust.Load(proj.CustomerID);
            loc.Load(proj.LocationID);
            state.Load(loc.StateID);

            ds = CBBudget.GetBudgetDetailsForReport(budID, wbs);


            if (proj.BusinessUnit() == 1)
            {
                rprt.MainReportTitle = "Staffing Estimate Loaded Details";
            }
            if (proj.BusinessUnit() == 2)
            {
                rprt.MainReportTitle = "Engineering Estimate Loaded Details";
            }
            if (proj.BusinessUnit() == 3)
            {
                rprt.MainReportTitle = "Pipeline Services Estimate Loaded Details";
            }
            if (proj.BusinessUnit() == 4)
            {
                rprt.MainReportTitle = "Program Management Estimate Loaded Details";
            }
            if (proj.BusinessUnit() == 5)
            {
                rprt.MainReportTitle = "EPC Estimate Loaded Details";
            }

            rprt.SetTitles(cust.Name + " / " + loc.City + "," + state.Abbrev, proj.Description, proj.Number, bud.GetNumber(), wbs);
            rprt.DataSource = ds;
            rprt.DataMember = "Table";

            rprt.Run(false);

            return(rprt.Document.Pages);
        }
Пример #11
0
        public void SetDataValues(dsWorkSheet ds, int budgetID)
        {
            mdsWSData  = (dsWorkSheet)ds.Copy();
            miBudgetID = budgetID;

            CBBudget b = new CBBudget();

            b.Load(budgetID);

            if (b.IsLocked == true)
            {
                groupBox1.Enabled = false;
                groupBox2.Enabled = false;
                bttOK.Visible     = false;
            }
        }
Пример #12
0
        private void bttOK_Click(object sender, EventArgs e)
        {
            CBBudget bud = new CBBudget();

            bud.Load(miBudgetID);
            bud.Description = txtDescription.Text;
            bud.PreparedBy  = txtPreparedBy.Text;
            bud.Contingency = Convert.ToDecimal(txtContingency.Text);
            bud.Save();

            if (OnBudgetPropertiesChanged != null)
            {
                string[] vals = new string[2];

                vals[0] = txtDescription.Text;
                vals[1] = txtContingency.Text;

                OnBudgetPropertiesChanged(vals, 2);
            }

            this.Close();
        }
Пример #13
0
        private void LoadBudget(int projID)
        {
            ListViewItem  lvi;
            SqlDataReader dr;
            CBBudget      b = new CBBudget();
            int           budID;

            dr = CBBudget.GetListByProject(projID);

            lvwBudgets.Items.Clear();

            while (dr.Read())
            {
                budID = Convert.ToInt32(dr["ID"]);
                b.Load(budID);

                lvi      = new ListViewItem();
                lvi.Text = b.ID.ToString();
                lvi.SubItems.Add(b.GetCleanNumber());

                lvwBudgets.Items.Add(lvi);
            }
        }
Пример #14
0
        public void CopyPCN(int projID, int pcnID)
        {
            ClearForm();

            moProj = new CBProject();
            moBudg = new CBBudget();

            moPCN.LoadWithCopyData(pcnID);

            moProj.Load(moPCN.ProjectID);
            moBudg.LoadByProject(moProj.ID);

            LoadFromPCN();

            this.Text = "PCN: Job-" + moProj.Number + " PCN-" + moPCN.PCNNumber;

            moProj.Load(projID);
            moPCN.PCNNumber = moPCN.GetNextPCNNumber(projID);
            moPCN.ProjectID = projID;

            lblProjectNumber.Text = moProj.Number;
            lblProjectTitle.Text  = moProj.Description;
            txtPCNNumber.Text     = moPCN.PCNNumber;
            this.Text             = "PCN: Job-" + moProj.Number + " PCN-" + moPCN.PCNNumber;
            project_ID            = moPCN.ProjectID;
            List <CBActivityCodeDisc> _Groups = CBActivityCodeDisc.GetAllForProject(project_ID).ToList();

            foreach (var group in _Groups)
            {
                codes[i] = group.Code;
                i++;
            }

            SetPCNSecurityLevel();
            mbIsFixedRate = moProj.IsFixedRate;
            SetPCN_RateLevel();
        }
Пример #15
0
        private GrapeCity.ActiveReports.Document.Section.PagesCollection CreatePagesBudgetSummary(int budID, string wbs)
        {
            rprtBudgetSummary1 rprt = new rprtBudgetSummary1();
            DataSet            ds;

            int        totalHours;
            decimal    totalHourDollars;
            decimal    totalExpenses;
            decimal    contingency;
            CBBudget   bud   = new CBBudget();
            CBProject  proj  = new CBProject();
            CBCustomer cust  = new CBCustomer();
            CBLocation loc   = new CBLocation();
            CBState    state = new CBState();

            bud.Load(budID);
            proj.Load(bud.ProjectID);
            cust.Load(proj.CustomerID);
            loc.Load(proj.LocationID);
            state.Load(loc.StateID);

            totalHours       = CBBudget.GetTotalBudgetHours(budID, wbs);
            totalHourDollars = CBBudget.GetTotalBudgetHourDollars(budID, wbs);
            totalExpenses    = CBBudget.GetTotalBudgetExpenses(budID);
            contingency      = CBBudget.GetContingencyForBudget(budID);
            ds = CBBudget.GetBudgetSummaryForReport(budID, wbs);


            if (proj.BusinessUnit() == 1)
            {
                rprt.MainReportTitle = "Staffing Estimate Loaded Summary";
            }
            if (proj.BusinessUnit() == 2)
            {
                rprt.MainReportTitle = "Engineering Estimate Loaded Summary";
            }
            if (proj.BusinessUnit() == 3)
            {
                rprt.MainReportTitle = "Pipeline Services Estimate Loaded Summary";
            }
            if (proj.BusinessUnit() == 4)
            {
                rprt.MainReportTitle = "Program Management Estimate Loaded Summary";
            }
            if (proj.BusinessUnit() == 5)
            {
                rprt.MainReportTitle = "EPC Estimate Loaded Summary";
            }

            rprt.SetTitles(proj.Number, proj.Description, bud.GetNumber(), cust.Name, loc.City + "," + state.Abbrev, wbs);
            rprt.TotalHours       = totalHours;
            rprt.TotalHourDollars = totalHourDollars;
            rprt.TotalExpenses    = totalExpenses;
            rprt.Contingency      = contingency;
            rprt.DataSource       = ds;
            rprt.DataMember       = "Table";

            rprt.Run(false);

            return(rprt.Document.Pages);
        }
Пример #16
0
        private void bttProcess_Click(object sender, EventArgs e)
        {
            string msg        = "Export the selected budget " + (lvwBudgets.SelectedItems[0]).SubItems[1].Text;
            string projNumber = lvwProjects.SelectedItems[0].SubItems[1].Text;

            if (MessageBox.Show(msg, "Export", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
            {
                CBVisionExport ve   = new CBVisionExport();
                CBBudget       bud  = new CBBudget();
                CBProject      proj = new CBProject();
                SqlDataReader  dr;
                int            budID;

                ListViewItem l = lvwBudgets.SelectedItems[0];
                budID = Convert.ToInt32(l.Text);
                bud.Load(budID);
                proj.Load(bud.ProjectID);

                // prepare teh data tables
                lblStatus.Visible = true;
                UpdateStatus("Preparing data tables for export");
                ve.ResetStagingTables();
                UpdateStatus("Retrieving budget information");
                dr = ve.GetBudgetLinesForStaging(budID);
                UpdateStatus("Loading budget info into staging table");
                while (dr.Read())
                {
                    ve.InsertLineForStaging(
                        bud.ID,
                        proj.Number,
                        Convert.ToInt32(dr["DeptGroup"]),
                        Convert.ToInt32(dr["Task"]),
                        Convert.ToInt32(dr["Category"]),
                        Convert.ToInt32(dr["Activity"]),
                        dr["WBS"].ToString(),
                        dr["Description"].ToString(),
                        Convert.ToInt32(dr["Quantity"]),
                        Convert.ToInt32(dr["HoursEach"]),
                        Convert.ToInt32(dr["TotalHours"]),
                        Convert.ToDecimal(dr["LoadedRate"]),
                        Convert.ToDecimal(dr["TotalDollars"]),
                        0, 0, dr["LineGUID"].ToString(),
                        false,
                        "",
                        proj.DateStart,
                        proj.DateEnd,
                        dr["BudgetType"].ToString());
                }
                dr.Close();

                UpdateStatus("Loading plan information");
                ve.InsertPlanInformation(budID);
                UpdateStatus("Loading WBS1 outline");
                ve.InsertWBS1Outline(budID);

                UpdateStatus("Loading WBS2 outline");
                // load wbs2 with outline numbers
                int    outLvl = 1;
                int    chldCnt = 0;
                string outlineNumber, deptName, deptNumber;

                dr = ve.GetWBS2Levels();
                while (dr.Read())
                {
                    outlineNumber = "001." + outLvl.ToString("000");
                    deptName      = dr["Description"].ToString();
                    deptNumber    = dr["DeptGroup"].ToString();
                    chldCnt       = Convert.ToInt32(dr["Cnt"]);

                    ve.InsertWBS2Outline(budID, outlineNumber, deptName, deptNumber, "001", proj.DateStart, proj.DateEnd, chldCnt);

                    outLvl++;
                }
                dr.Close();

                UpdateStatus("Loading WBS3 outline");
                // load wbs3 with outline numbers
                outLvl  = 0;
                chldCnt = 0;
                string currLvl  = "";
                string activity = "";
                int    stageID;

                dr = ve.GetWBS3Levels();
                while (dr.Read())
                {
                    if (dr["OutlineNumber"].ToString() != currLvl)
                    {
                        currLvl = dr["OutlineNumber"].ToString();
                        outLvl  = 1;
                    }

                    stageID       = Convert.ToInt32(dr["ID"]);
                    outlineNumber = currLvl + "." + outLvl.ToString("000");
                    deptName      = dr["Description"].ToString();
                    deptNumber    = dr["DeptGroup"].ToString();
                    activity      = dr["ACtivity"].ToString();

                    ve.InsertWBS3Outline(budID, outlineNumber, deptName, deptNumber, activity, currLvl, proj.DateStart, proj.DateEnd, chldCnt, stageID);

                    outLvl++;
                }
                dr.Close();

                UpdateStatus("Update staging with outline");
                ve.UpdateStagingWithOutline();

                if (CheckForExistingImport(projNumber) == true)
                {
                    UpdateStatus("Processing as previous Export");
                    LoadAsPreviousExport(projNumber);
                }

                ve.RecordExportedBudgetLInes();

                UpdateStatus("Finished Export");

                MessageBox.Show("Finished building export tables");

                this.Close();
            }
        }
Пример #17
0
        public void Show_BudgetDetails(int budID, string wbs)    //**************************Added 6/22/15
        {
            FPreviewAR       pv   = new FPreviewAR();
            rprtBudgetDetail rprt = new rprtBudgetDetail();
            DataSet          ds;
            CBBudget         bud   = new CBBudget();
            CBProject        proj  = new CBProject();
            CBCustomer       cust  = new CBCustomer();
            CBLocation       loc   = new CBLocation();
            CBState          state = new CBState();

            bud.Load(budID);
            proj.Load(bud.ProjectID);
            cust.Load(proj.CustomerID);
            loc.Load(proj.LocationID);
            state.Load(loc.StateID);

            ds = CBBudget.GetBudgetDetailsForReport(budID, wbs);


            if (proj.BusinessUnit() == 1)
            {
                rprt.MainReportTitle = "Staffing Estimate Loaded Details";
            }
            if (proj.BusinessUnit() == 2)
            {
                rprt.MainReportTitle = "Engineering Estimate Loaded Details";
            }
            if (proj.BusinessUnit() == 3)
            {
                rprt.MainReportTitle = "Pipeline Services Estimate Loaded Details";
            }
            if (proj.BusinessUnit() == 4)
            {
                rprt.MainReportTitle = "Program Management Estimate Loaded Details";
            }
            if (proj.BusinessUnit() == 5)
            {
                rprt.MainReportTitle = "EPC Estimate Loaded Details";
            }

            rprt.SetTitles(cust.Name + " / " + loc.City + "," + state.Abbrev, proj.Description, proj.Number, bud.GetNumber(), wbs);
            rprt.DataSource = ds;
            rprt.DataMember = "Table";

            //pv.ViewReport(rprt);
            //pv.ShowDialog();



            GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport PDFEx = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();

            pv.Title = rprt.MainReportTitle;  //************************Added 10/1/2015
            rprt.Run();

            SaveFileDialog sv1 = new SaveFileDialog();

            sv1.Filter     = "PDF Files | *.pdf";
            sv1.DefaultExt = "pdf";

            //PDFEx.FileFormat = GrapeCity.ActiveReports.Export.Pdf.Section.FileFormat.Xlsx;


            if (sv1.ShowDialog() == DialogResult.OK)
            {
                //    ee.ExportBudgetForPrimavera(saveFileDialog1.FileName, moPCN.ID);
                PDFEx.Export(rprt.Document, sv1.FileName);
            }
        }
Пример #18
0
        public void PreviewBudgetSummary(int budID, string wbs, bool rate) //***********************Added 7/22/2015
        {
            FPreviewAR         pv   = new FPreviewAR();
            rprtBudgetSummary1 rprt = new rprtBudgetSummary1();
            DataSet            ds;


            int        totalHours;
            decimal    totalHourDollars;
            decimal    totalExpenses;
            decimal    contingency;
            CBBudget   bud   = new CBBudget();
            CBProject  proj  = new CBProject();
            CBCustomer cust  = new CBCustomer();
            CBLocation loc   = new CBLocation();
            CBState    state = new CBState();

            bud.Load(budID);
            proj.Load(bud.ProjectID);
            cust.Load(proj.CustomerID);
            loc.Load(proj.LocationID);
            state.Load(loc.StateID);

            totalHours       = CBBudget.GetTotalBudgetHours(budID, wbs);
            totalHourDollars = CBBudget.GetTotalBudgetHourDollars(budID, wbs);
            totalExpenses    = CBBudget.GetTotalBudgetExpenses(budID);
            contingency      = CBBudget.GetContingencyForBudget(budID);

            ds = CBBudget.GetBudgetSummaryForReport(budID, wbs);
            //ds = CBBudget.GetBudgetSummaryForReport(budID, wbs);
            if (proj.BusinessUnit() == 1)
            {
                rprt.MainReportTitle = "Staffing Estimate Loaded Summary";
            }
            if (proj.BusinessUnit() == 2)
            {
                rprt.MainReportTitle = "Engineering Estimate Loaded Summary";
            }
            if (proj.BusinessUnit() == 3)
            {
                rprt.MainReportTitle = "Pipeline Services Estimate Loaded Summary";
            }
            if (proj.BusinessUnit() == 4)
            {
                rprt.MainReportTitle = "Program Management Estimate Loaded Summary";
            }
            if (proj.BusinessUnit() == 5)
            {
                rprt.MainReportTitle = "EPC Estimate Loaded Summary";
            }



            rprt.SetTitles(proj.Number, proj.Description, bud.GetNumber(), cust.Name, loc.City + "," + state.Abbrev, wbs);
            rprt.TotalHours       = totalHours;
            rprt.TotalHourDollars = totalHourDollars;
            rprt.TotalExpenses    = totalExpenses;
            rprt.Contingency      = contingency;
            rprt.Rate             = rate;
            rprt.DataSource       = ds;
            rprt.DataMember       = "Table";


            pv.projNumber = proj.Number; // **************************Added 6/29/2015 **************************
            if (rate == false)           //************************Added 10/1/2015
            {
                pv.Title = rprt.MainReportTitle + "WO Rate";
            }
            else
            {
                pv.Title = rprt.MainReportTitle;
            }
            pv.ViewReport(rprt);
            pv.ShowDialog();
        }