Creating a custom page

Creating a custom page

Hi there

I have a report called "All Transaction List" which lists all transactions including date of transaction, chart of account code, Dr and Cr amounts. I now want to create a Profit and Loss report using this information. So I am trying to create a Page for that. I have written some code for doing that but it gives me errors when trying to save it. Can someone please help me with what I am doing wrong in that code?? The error shows up in line where the Myfunction is defined? It keeps saying the syntax is missing?

htmlpage Consolidated_Report()

displayname = "Consolidated Report"

content

<%{

%>

<html>

<body>

<h2><center>Profit and Loss</center></h2>

<p>Select the date range for Profit and Loss report</p>

From:<input type="date" id="field1">

To:<input type="date" id="field2">

<button onclick="myFunction()">Submit</button></td>

<script>

function myFunction()

<%{

fet = All_Transactions_List[Date_field >= document.getElementById("field1").value && Date_field <= document.getElementById("field2").value && Account_Types == "3644861000000012019"];

              COA = fet.distinct(Chart_of_Accounts);

%>

              <thead><th>Chart Of Account</th><th>DR</th><th>CR</th></thead>

<%

              for each   var in COA

              {

%>

              <tr><td><%=var.Chart_of_Accounts[ID == var].Chart_of_Accounts %></td><td><%=sum(All_Transactions_List[Chart_of_Accounts == var].sum(DR))%></td><td><%=sum(All_Transactions_List[Chart_of_Accounts == var].sum(CR))%></td>

<%

}

%>

</script>

</body>

</html>

<%

}%>
<%

}%>