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); }