// Report: DP-crsum.rpt (based on 1.3 of crsum.rpt)
//
// Description: SDT 19319 - ITIL Incident Summary Report Export to Excel
//
// Group by: None
//
// Sort by: open_date DESC
//
// Input: Standard Where Clause
//
// Algorith: N/A
//
////////////////////////////////////////////////////////////////////////////
// Created: 21/12/2007
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// $Log: DP-crsum.rpt,v $
//
////////////////////////////////////////////////////////////////////////////
PAGE HEADER {
}
PAGE FOOTER {
}
////////////////////////////////////////////////////////////////////////////
// Outside Block
////////////////////////////////////////////////////////////////////////////
BLOCK in ("SELECT id FROM Impact", "WHERE enum = 1") {
////////////////////////////////////////////////////////////////////////////
// Main Block
////////////////////////////////////////////////////////////////////////////
BLOCK cr ("SELECT \
ref_num, id, status, active_flag, open_date, close_date, \
customer, description, priority, summary, assignee, group_id \
FROM Call_Req",
$# > 1 ? $1 : "") SORT "open_date DESC" {
ccnt = count(cr);
HEADER {
<HTML>
<BODY>
Press the button to start Excel and display your listed data.
<SCRIPT LANGUAGE="VBScript">
</SCRIPT>
<SCRIPT LANGUAGE="JScript">
function AutomateExcel()
\{
var counter=1;
// Start Excel and get Application object.
var oXL = new ActiveXObject("Excel.Application");
oXL.Visible = true;
// Get a new workbook.
var oWB = oXL.Workbooks.Add();
var oSheet = oWB.ActiveSheet;
}
BLOCK crs ("SELECT sym FROM Cr_Status", "WHERE #code = ?", cr::status) {}
BLOCK grp ("SELECT last_name FROM ca_contact", "WHERE id = ?", cr::group_id) {}
anal_name = deref (assignee);
cust_name = deref (customer);
grp_name = grp::last_name;
pr = deref (priority);
summ = summary;
stat = crs::sym;
odate = open_date DATE;
PRINT {
if(counter<=[ccnt>)\{
oSheet.Cells(counter,1).Value = "[ref_num>";
oSheet.Cells(counter,2).Value = "[cust_name>";
oSheet.Cells(counter,3).Value = "[anal_name>";
oSheet.Cells(counter,4).Value = "[odate>";
oSheet.Cells(counter,5).Value = "[stat>";
oSheet.Cells(counter,6).Value = "[pr>";
counter++;
\};
}
FOOTER {
// Make sure Excel is visible and give the user control
// of Excel's lifetime.
oXL.Visible = true;
oXL.UserControl = true;
\}
</SCRIPT>
<P><INPUT id=button1 type=button value="Start Excel"
onclick="AutomateExcel"></P>
</BODY>
</HTML>
}
} // end cr
PRINT (count(cr) == 0){
<p>
<center><b>Your Query Did Not Return Any Matching Records</b></center>
<p>
}
} // end in
|