Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. public DataTable GetARCustomerPaymentsReportDetailed(String LocationID, String UserID, String PaymentType, DateTime FrDate, DateTime ToDate, int Type, int ReportType)
  2. {
  3. var table = new DataTable();
  4. var conn = new SqlConnection(connString);
  5. var command = new SqlCommand();
  6. command.CommandType = System.Data.CommandType.StoredProcedure;
  7. command.CommandText = "sp_Rpt_GetBankDepositByManagerForClient";
  8. command.Parameters.Add(new SqlParameter("@RegionID", 2));
  9. command.Parameters.Add(new SqlParameter("@LocID", LocationID));
  10. command.Parameters.Add(new SqlParameter("@UserID", UserID));
  11. command.Parameters.Add(new SqlParameter("@PaymentType", PaymentType));
  12. command.Parameters.Add(new SqlParameter("@Type", Type));
  13. command.Parameters.Add(new SqlParameter("@ReportType", ReportType));
  14. command.Parameters.Add(new SqlParameter("@FrDate", FrDate));
  15. command.Parameters.Add(new SqlParameter("@Todate", ToDate));
  16. command.Connection = conn;
  17. using (conn)
  18. using (command)
  19. using (var da = new SqlDataAdapter(command))
  20. {
  21. command.CommandType = CommandType.StoredProcedure;
  22. da.Fill(table);
  23. }
  24. conn.Close();
  25.  
  26. return table;
  27. }
  28.  
  29.  
  30.  
  31. if (ReportMode == '1') {
  32. url = '@Url.Action("ARCustomerPaymentsDetailedReport", "Report")';
  33. var strParams = '?LocationID=' + LocationID + '&Date1=' + FromDate + '&Date2=' + ToDate + '&ReportType=' + ReportType + '&PaymentType=' + PaymentTypeStr;
  34.  
  35. var win = window.open(url + strParams);
  36. if (win) {
  37. //Browser has allowed it to be opened
  38. win.focus();
  39. }
  40. }
  41.  
  42. public ActionResult ARCustomerPaymentsDetailedReport(String LocationID, DateTime Date1, DateTime Date2, int ReportType, String PaymentType)
  43. {
  44. ReportViewer reportViewer = new ReportViewer();
  45. reportViewer.SizeToReportContent = true;
  46.  
  47. var DT = new ReportingDataService().GetARCustomerPaymentsReportDetailed(LocationID, "%", PaymentType, Date1, Date2, 0, ReportType);
  48. var DS = new DataSet();
  49. DS.Tables.Add(DT);
  50.  
  51. reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Reports\ReportFiles\ARCustomerPaymentsDetailed.rdlc";
  52. reportViewer.LocalReport.DataSources.Add(new ReportDataSource("ARCustomerPaymentsDetailedDS", DS.Tables[0]));
  53.  
  54. ViewBag.ReportViewer = reportViewer;
  55. return View();
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement