Taking report from web page
function sendReport() {
var dataInput = {};
reportBody = $(".dataTables_scroll");
reportBody.prepend('<link rel="stylesheet" href="' + location.protocol + '//' + window.location.host + '/Scripts/Main/BusinessSuite.css" type="text/css" />');
reportBody.prepend('<link rel="stylesheet" href="' + location.protocol + '//' + window.location.host + '/Scripts/Libs/BootStrap/css/bootstrap.css" type="text/css" />');
reportBody.prepend('<link rel="stylesheet" href="' + location.protocol + '//' + window.location.host + '/Scripts/Libs/JQueryConfirm/css/jquery-confirm.css" type="text/css" />');
reportBody.prepend('<link rel="stylesheet" href="' + location.protocol + '//' + window.location.host + '/Scripts/Libs/JQueryDatatables/css/jquery.dataTables.css" type="text/css" />');
reportBody.prepend('<link rel="stylesheet" href="' + location.protocol + '//' + window.location.host + '/Css/Table/tableenhacements.css" type="text/css" />');
reportBody.prepend('<link rel="stylesheet" href="' + location.protocol + '//' + window.location.host + '/Scripts/Libs/JQueryUI/jquery-ui.css" type="text/css" />');
dataInput.ReportName = $("#ddlReports option:selected").attr("data-report-name");
dataInput.ReportPage = reportBody.html().replace(/height: 0px;/g, 'height: 30px;padding:5px 0 !important;')
.replace(/dataTables_scrollHeadInner"/g, 'dataTables_scrollHeadInner" style="display:none"')
.replace(/<table/g, '<table style="font-size:12px !important;"')
.replace(/<th/g, '<th style="align:left;"')
.replace(/<div class="dataTables_scrollHeadInner".*?(<\/div>)/gm,'');
var ajaxParameters = {
methodUrl: "Mail/SendReport",
dataInput: dataInput
};
new BaseClass().AjaxCall(
ajaxParameters,
function () { },
function (data) { }
);
return false;
Stored Proc:
ALTER proc [dbo].[usp_BS_SendMail](
@PRM_LAN_ID VARCHAR(100)='',
@REPORT_NAME nvarchar(150) =null,
@REPORT_PAGE nvarchar(max) =null
) as
if coalesce(@REPORT_NAME,'')='' or coalesce(@REPORT_PAGE,'')='' return;
declare @typeid int,@subject nvarchar(255);
select @typeid=ReportTypeID from [dbo].[tbl_BS_Reports_Configuration] where ReportName = @REPORT_NAME
insert dbo.tbl_ReportPage (ReportTypeID, ReportName,ReportPage,CreatedBy)
values (@typeid,@REPORT_NAME,@REPORT_PAGE,@PRM_LAN_ID)
set @subject = 'Report: ' + @REPORT_NAME;
EXEC msdb.dbo.sp_send_dbmail
@profile_name = null,
--@recipients = '"Vat, Moh" <abc.vat@ball.ca>;"Pill, Balak" <def.pill@ball.ca>',
@recipients = 'xxxxx@gmail.com',
@body = @REPORT_PAGE,
@body_format = 'HTML',
@subject = @subject;
Calling sp
using (var fnReturn = new DataTable())
{
fnReturn.RunStoredProcedure(filters.Conn, "[dbo].[usp_BS_SendMail]",
new Dictionary<string, object>() {
{ "@PRM_LAN_ID", filters.Lan_ID?? "" },
{ "@REPORT_NAME", filters.ReportName},
{ "@REPORT_PAGE", filters.ReportPage}
});
return fnReturn;
}
==========================
report contents:
<link href="http://localhost:1282/Scripts/Libs/JQueryUI/jquery-ui.css" rel="stylesheet" type="text/css">
<link href="http://localhost:1282/Css/Table/tableenhacements.css" rel="stylesheet" type="text/css">
<link href="http://localhost:1282/Scripts/Libs/JQueryDatatables/css/jquery.dataTables.css" rel="stylesheet" type="text/css">
<link href="http://localhost:1282/Scripts/Libs/JQueryConfirm/css/jquery-confirm.css" rel="stylesheet" type="text/css">
<link href="http://localhost:1282/Scripts/Libs/BootStrap/css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="http://localhost:1282/Scripts/Main/BusinessSuite.css" rel="stylesheet" type="text/css">
<div class="dataTables_scrollHead" style="border: 0px currentColor; border-image: none; width: 100%; overflow: hidden; position: relative;"></div>
<div class="dataTables_scrollBody" style="width: 1352px; overflow: auto; position: relative; max-height: 740px;">
<table style="font-size:12px !important;" class="dataTable striped border hovered no-footer" id="DataTables_Table_1" role="grid" aria-describedby="DataTables_Table_1_info" style="min-height: 500px;">
<th style="align:left;"ead>
<tr role="row" style="height: 30px;padding:5px 0 !important;">
<th style="align:left;" class="sorting_disabled" style="width: 242px; height: 30px;padding:5px 0 !important; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px;" rowspan="1" colspan="1">
<div class="dataTables_sizing" style="height: 30px;padding:5px 0 !important; overflow: hidden;"><span class="header-title">BackOffice Automation</span></div>
</th>
<th style="align:left;" class="sorting_disabled" style="width: 79px; height: 30px;padding:5px 0 !important; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px;" rowspan="1" colspan="1">
<div class="dataTables_sizing" style="height: 30px;padding:5px 0 !important; overflow: hidden;">2018-06-24</div>
</th>
<th style="align:left;" class="sorting_disabled" style="width: 79px; height: 30px;padding:5px 0 !important; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px;" rowspan="1" colspan="1">
<div class="dataTables_sizing" style="height: 30px;padding:5px 0 !important; overflow: hidden;">2018-06-25</div>
</th>
<th style="align:left;" class="sorting_disabled" style="width: 79px; height: 30px;padding:5px 0 !important; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px;" rowspan="1" colspan="1">
<div class="dataTables_sizing" style="height: 30px;padding:5px 0 !important; overflow: hidden;">2018-06-26</div>
</th>
<th style="align:left;" class="sorting_disabled" style="width: 79px; height: 30px;padding:5px 0 !important; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px;" rowspan="1" colspan="1">
<div class="dataTables_sizing" style="height: 30px;padding:5px 0 !important; overflow: hidden;">2018-06-27</div>
</th>
<th style="align:left;" class="sorting_disabled" style="width: 79px; height: 30px;padding:5px 0 !important; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px;" rowspan="1" colspan="1">
<div class="dataTables_sizing" style="height: 30px;padding:5px 0 !important; overflow: hidden;">2018-06-28</div>
</th>
<th style="align:left;" class="sorting_disabled" style="width: 79px; height: 30px;padding:5px 0 !important; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px;" rowspan="1" colspan="1">
<div class="dataTables_sizing" style="height: 30px;padding:5px 0 !important; overflow: hidden;">2018-06-29</div>
</th>
<th style="align:left;" class="sorting_disabled" style="width: 79px; height: 30px;padding:5px 0 !important; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px;" rowspan="1" colspan="1">
<div class="dataTables_sizing" style="height: 30px;padding:5px 0 !important; overflow: hidden;">2018-06-30</div>
</th>
<th style="align:left;" class="sorting_disabled" style="width: 81px; height: 30px;padding:5px 0 !important; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px;" rowspan="1" colspan="1">
<div class="dataTables_sizing" style="height: 30px;padding:5px 0 !important; overflow: hidden;">WEEKSUM</div>
</th>
<th style="align:left;" class="sorting_disabled" style="width: 40px; height: 30px;padding:5px 0 !important; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px;" rowspan="1" colspan="1">
<div class="dataTables_sizing" style="height: 30px;padding:5px 0 !important; overflow: hidden;">MTD</div>
</th>
<th style="align:left;" class="sorting_disabled" style="width: 40px; height: 30px;padding:5px 0 !important; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px;" rowspan="1" colspan="1">
<div class="dataTables_sizing" style="height: 30px;padding:5px 0 !important; overflow: hidden;">YTD</div>
</th>
</tr>
</thead>
<tbody>
<tr class="header-lightblue odd" role="row">
<td width="400"><b>Total Back Office</b></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr class="even" role="row">
<td width="400"> Volume sent to robot</td>
<td>1,257</td>
<td>1,900</td>
<td>2,153</td>
<td>31</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>5,341</td>
<td>43,029</td>
<td>278,128</td>
</tr>
<tr class="odd" role="row">
<td width="400"> Volume worked by robot</td>
<td>914</td>
<td>1,310</td>
<td>1,414</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>3,638</td>
<td>33,304</td>
<td>199,104</td>
</tr>
<tr class="even" role="row">
<td width="400"> % automated</td>
<td>72.71 %</td>
<td>68.95 %</td>
<td>65.68 %</td>
<td> </td>
<td>N/A</td>
<td>N/A</td>
<td>N/A</td>
<td>68.11 %</td>
<td>77.40 %</td>
<td>71.59 %</td>
</tr>
<tr class="header-lightblue odd" role="row">
<td width="400">- <b>BM Back Office</b></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr class="even" role="row">
<td width="400"> Volume sent to robot</td>
<td>336</td>
<td>401</td>
<td>381</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>1,118</td>
<td>12,305</td>
<td>81,027</td>
</tr>
<tr class="odd" role="row">
<td width="400"> Volume worked by robot</td>
<td>288</td>
<td>342</td>
<td>318</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>948</td>
<td>10,546</td>
<td>67,326</td>
</tr>
<tr class="even" role="row">
<td width="400"><strong> % automated</strong></td>
<td>85.71 %</td>
<td>85.29 %</td>
<td>83.46 %</td>
<td>N/A</td>
<td>N/A</td>
<td>N/A</td>
<td>N/A</td>
<td>84.79 %</td>
<td>85.71 %</td>
<td>83.09 %</td>
</tr>
<tr class="header-lightblue odd" role="row">
<td width="400">- <b>BRS Back Office</b></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr class="even" role="row">
<td width="400"> Volume sent to robot</td>
<td>921</td>
<td>1,499</td>
<td>1,772</td>
<td>31</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>4,223</td>
<td>30,724</td>
<td>197,101</td>
</tr>
<tr class="odd" role="row">
<td width="400"> Volume worked by robot</td>
<td>626</td>
<td>968</td>
<td>1,096</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>2,690</td>
<td>22,758</td>
<td>131,778</td>
</tr>
<tr class="even" role="row">
<td width="400"><strong> % automated</strong></td>
<td>67.97 %</td>
<td>64.58 %</td>
<td>61.85 %</td>
<td> </td>
<td>N/A</td>
<td>N/A</td>
<td>N/A</td>
<td>63.70 %</td>
<td>74.07 %</td>
<td>66.86 %</td>
</tr>
</tbody>
</table>
</div>
2,889 total views, 4 views today
Comments
Greetings! This is my first visit to your blog! We are a
team of volunteers and starting a new initiative in a community in the same niche.
Your blog provided us beneficial information to work
on. You have done a wonderful job!
@m.2 slot pc Thank you for encouraging!