<%@ Page Language="VB" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Register TagPrefix="uc" TagName="Menu" Src="~/Views/Shared/Menu.ascx" %>
<%@ Register TagPrefix="uc" TagName="subMenu" Src="~/Views/Report/ReportMenu.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
  <script src="<% response.Write(course.mvcapplication.WebPath) %>Scripts/jquery-1.10.2.js"></script>  
    <script src="<% response.Write(course.mvcapplication.WebPath) %>Scripts/jquery-migrate-1.2.1.js"></script>  

  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  <script src="<% response.Write(course.mvcapplication.WebPath) %>Scripts/jquery.maskedinput.js"></script>  


<head runat="server">
    <title>ListTransactions</title>
    
</head>
<body>
        <uc:Menu id="Menu" 
        runat="server"/>
                <uc:subMenu id="subMenu" 
        runat="server"/>
        <script type="text/VB" runat="server">
            Public Function CreateTable(ByVal dt As CoursE.coursedata.transactionDataTable, ByVal name As String, ByVal rowfilter As String, ByVal daytrans As Date) As String
                Dim ret As String = ""
                Dim total As Decimal = 0
                ret &= "<tr><td>" & name & "</td><td></td><td></td></tr>"
                dt.DefaultView.RowFilter = " TRANSACTION_PAYMENT_METHOD = " & rowfilter '& " AND TRANSACTION_CREATION_DATE = #" & daytrans.ToString("MM/dd/yyyy") & "#"
                For intcpt As Integer = 0 To dt.DefaultView.Count - 1
                    ret &= "<tr><tr><td>" & dt.DefaultView.Item(intcpt).Item("CLIENT_NAME") & "</td><td>" & dt.DefaultView.Item(intcpt).Item("TRANSACTION_DATE") & "</td><td>" & dt.DefaultView.Item(intcpt).Item("TRANSACTION_AMOUNT") & "</td></tr>"
                    total += dt.DefaultView.Item(intcpt).Item("TRANSACTION_AMOUNT")
                Next
                ret &= "<tr><td></td><td>Total :</td><td>" & total & "</td></tr>"
                
                Return ret
            End Function
        </script>
    <div>
    
    <script type="text/javascript">
        $(function () { $(".datepicker").datepicker({ dateFormat: 'mm/dd/yy', firstDay: 1, selectWeek: false }); }); 
    </script> 
    <% 
        Dim dt As CoursE.coursedata.transactionDataTable = ViewData.Item("transactiontable")
        Dim dayd As String = ViewData.Item("dayd")
        %>
        <form method="post" action="<%response.write(course.mvcapplication.WebPath) %>Report/ListTransactions">
    <label for="COURSE_DATE_START">Date</label>
    <input class="datepicker" id="datepickerx" type="text" name="dayd" value="<% response.write(dayd) %>" size="50"/>
    <input value="Changer de date" type="submit" />
    </form>
    <table>
<%  
    
    
    If dt.Rows.Count > 0 Then
        Dim total As Decimal = 0
        Response.Write(CreateTable(dt, "Comptant", "1", Now.Date))
        Response.Write(CreateTable(dt, "Chèque", "2", Now.Date))
        Response.Write(CreateTable(dt, "Visa", "3", Now.Date))
        Response.Write(CreateTable(dt, "MasterCard", "8", Now.Date))
        Response.Write(CreateTable(dt, "Paypal", "4", Now.Date))
        Response.Write(CreateTable(dt, "Carte de guichet", "7", Now.Date))
        'Response.Write("<tr><td>Chèque</td><td></td><td></td></tr>")

        'dt.DefaultView.RowFilter = " TRANSACTION_PAYMENT_METHOD = 2 "
        'total = 0
        'For intcpt As Integer = 0 To dt.DefaultView.Count - 1
        '    Response.Write("<tr><td>" & dt.DefaultView.Item(intcpt).Item("CLIENT_NAME") & "</td><td>" & dt.DefaultView.Item(intcpt).Item("TRANSACTION_DATE") & "</td><td>" & dt.DefaultView.Item(intcpt).Item("TRANSACTION_AMOUNT") & "</td></tr>")
        '    total += dt.DefaultView.Item(intcpt).Item("TRANSACTION_AMOUNT")
        'Next
        'Response.Write("<tr><td></td><td>Total :</td><td>" & total & "</td></tr>")

        'Response.Write("<tr><td>Visa</td><td></td><td></td></tr>")
        
        'dt.DefaultView.RowFilter = " TRANSACTION_PAYMENT_METHOD = 3 "
        'total = 0
        'For intcpt As Integer = 0 To dt.DefaultView.Count - 1
        '    Response.Write("<tr><td>" & dt.DefaultView.Item(intcpt).Item("CLIENT_NAME") & "</td><td>" & dt.DefaultView.Item(intcpt).Item("TRANSACTION_DATE") & "</td><td>" & dt.DefaultView.Item(intcpt).Item("TRANSACTION_AMOUNT") & "</td></tr>")
        '    total += dt.DefaultView.Item(intcpt).Item("TRANSACTION_AMOUNT")
        'Next
        'Response.Write("<tr><td></td><td>Total :</td><td>" & total & "</td></tr>")

        'Response.Write("<tr><td>MasterCard</td><td></td><td></td></tr>")
        'dt.DefaultView.RowFilter = " TRANSACTION_PAYMENT_METHOD = 8 "
        'total = 0
        'For intcpt As Integer = 0 To dt.DefaultView.Count - 1
        '    Response.Write("<tr><td>" & dt.DefaultView.Item(intcpt).Item("CLIENT_NAME") & "</td><td>" & dt.DefaultView.Item(intcpt).Item("TRANSACTION_DATE") & "</td><td>" & dt.DefaultView.Item(intcpt).Item("TRANSACTION_AMOUNT") & "</td></tr>")
        '    total += dt.DefaultView.Item(intcpt).Item("TRANSACTION_AMOUNT")
        'Next
        'Response.Write("<tr><td></td><td>Total :</td><td>" & total & "</td></tr>")

        'Response.Write("<tr><td>Paypal</td><td></td><td></td></tr>")
        'dt.DefaultView.RowFilter = " TRANSACTION_PAYMENT_METHOD = 4 "
        'total = 0
        'For intcpt As Integer = 0 To dt.DefaultView.Count - 1
        '    Response.Write("<tr><td>" & dt.DefaultView.Item(intcpt).Item("CLIENT_NAME") & "</td><td>" & dt.DefaultView.Item(intcpt).Item("TRANSACTION_DATE") & "</td><td>" & dt.DefaultView.Item(intcpt).Item("TRANSACTION_AMOUNT") & "</td></tr>")
        '    total += dt.DefaultView.Item(intcpt).Item("TRANSACTION_AMOUNT")
        'Next
        'Response.Write("<tr><td></td><td>Total :</td><td>" & total & "</td></tr>")

        'Response.Write("<tr><td>Carte de guichet</td><td></td><td></td></tr>")
        'dt.DefaultView.RowFilter = " TRANSACTION_PAYMENT_METHOD = 7 "
        'total = 0
        'For intcpt As Integer = 0 To dt.DefaultView.Count - 1
        '    Response.Write("<tr><td>" & dt.DefaultView.Item(intcpt).Item("CLIENT_NAME") & "</td><td>" & dt.DefaultView.Item(intcpt).Item("TRANSACTION_DATE") & "</td><td>" & dt.DefaultView.Item(intcpt).Item("TRANSACTION_AMOUNT") & "</td></tr>")
        '    total += dt.DefaultView.Item(intcpt).Item("TRANSACTION_AMOUNT")
        'Next
        'Response.Write("<tr><td></td><td>Total :</td><td>" & total & "</td></tr>")

    End If
        %>
</table>
    </div>
</body>
</html>
