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; }
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(); }
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(); }
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(); }
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(); }
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(); }
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); }
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; }
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; } }
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; }
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; } }
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(); }
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)"; }
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); }
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(); }
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); }
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]); }
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; }
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)); }