<!---
Name:        results.cfm
Author:      David Golden (d_golden73@hotmail.com)
Description: Results page
Created:     5/01/01
--->

<cfinclude template="Connections/connOWS.cfm">
<cfparam name="URL.FilmID" default="1">
<cfparam name="GetExpenseDetails__MMColParam" default="#URL.FilmID#">
<cfquery name="GetExpenseDetails" datasource=#MM_connOWS_DSN# username=#MM_connOWS_USERNAME# password=#MM_connOWS_PASSWORD#>
SELECT FilmID, ExpenseAmount, Description, ExpenseDate FROM Expenses WHERE FilmID 
= #GetExpenseDetails__MMColParam# ORDER BY ExpenseDate DESC 
</cfquery>
<cfparam name="GetMovieInfo__MMColParam" default="#URL.FilmID#">
<cfquery name="GetMovieInfo" datasource=#MM_connOWS_DSN# username=#MM_connOWS_USERNAME# password=#MM_connOWS_PASSWORD#>
SELECT FilmID, MovieTitle, AmountBudgeted, DateInTheaters FROM Films WHERE FilmID 
= #GetMovieInfo__MMColParam# 
</cfquery>
<cfparam name="GetTotalExpenses__MMColParam" default="#URL.FilmID#">
<cfquery name="GetTotalExpenses" datasource=#MM_connOWS_DSN# username=#MM_connOWS_USERNAME# password=#MM_connOWS_PASSWORD#>
SELECT SUM(ExpenseAmount) AS TotalExpense FROM Expenses WHERE FilmID = #GetTotalExpenses__MMColParam# 
</cfquery>
<cfscript>
GetExpenseDetails_NumRows = GetExpenseDetails.RecordCount;
</cfscript>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><font size="4"><b>Expense Report for <cfoutput>#GetMovieInfo.MovieTitle#</cfoutput></b></font></p>
<table width="50%" border="1" cellspacing="2" cellpadding="2">
  <tr> 
    <td width="46%">Premiere Date:</td>
    <td width="54%"><cfoutput># LSDateFormat(GetMovieInfo.DateInTheaters, 'M/DD/YY') 
        #</cfoutput></td>
  </tr>
  <tr> 
    <td width="46%">Budget:</td>
    <td width="54%"><cfoutput># DollarFormat(GetMovieInfo.AmountBudgeted) #</cfoutput></td>
  </tr>
  <tr> 
    <td width="46%">Total Expenses To Date:</td>
    <td width="54%"><cfoutput># DollarFormat(GetTotalExpenses.TotalExpense) #</cfoutput></td>
  </tr>
</table>
<p>&nbsp;</p>
<table width="50%" border="1" cellspacing="2" cellpadding="2">
  <tr> 
    <td><b>Date</b></td>
    <td><b>Description</b></td>
    <td><b>Amount</b></td>
  </tr>
  <cfoutput query="GetExpenseDetails"> 
    <tr> 
      <td># 
        LSDateFormat(GetExpenseDetails.ExpenseDate, 'M/DD/YY') #</td>
      <td>#GetExpenseDetails.Description#</td>
      <td># 
        DollarFormat(GetExpenseDetails.ExpenseAmount) #</td>
    </tr>
  </cfoutput> 
</table>
<p>&nbsp; </p>
</body>
</html>
