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 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 DataSet GetCostReport(string project, int rprtCase, bool isRollup) { DataSet ds; RSLib.CDbConnection cnn; SqlDataAdapter da; SqlCommand cmd; SqlParameter prm; string currDate; currDate = DateTime.Now.ToShortDateString(); cnn = new RSLib.CDbConnection(); if (isRollup == true) { cmd = new SqlCommand("spRPRT_CostReport_NewAcct2ForRollup_Vision", cnn.GetConnection()); } else { if (UseNewCodes(project) == true) { cmd = new SqlCommand("spRPRT_CostReport_NewAcct2_Vision", cnn.GetConnection()); } else { cmd = new SqlCommand("spRPRT_CostReport_OldAcct2_Vision", cnn.GetConnection()); } } cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 60 * 2; prm = cmd.Parameters.Add("@records", SqlDbType.Int); //*******Added 7/24/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(); return(ds); }
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 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; }