<table class="table table-hover portlet light bg-inverse" id="repTable">
    <caption class="txtc"> Visits </caption>
    <thead>
        <tr>
            <th style="width: 10px !important;">#</th>
            <th>   Patient Name </th>
            <th>Patient Number</th>
            {if $showDate &&   $showDate == 1 }  <th>Visit Date</th>  {/if}
            <th>Type</th>
            <th>   Total      </th>
            <th>   Discount   </th>
            <th>   Cash </th>
            <th>   Visa  </th>
            <th>   Debt </th>
        </tr>
    </thead>
    <tbody>
        {assign var="i" value="1"}
        {foreach $allData as $data}
        <tr class="odd " {if $data.newPat == 1} style="background-color: #d8eac6;"  {/if}>
            <td>{$i}</td>
            <td>
                <a href="{$hosturl}/controllers/patienthistory.php?ac=show&patientid={$data.patientid}" target="_new">{$data.wifename}</a>
            </td>
            <td>{$data.statusno}</td>
            {if $showDate &&   $showDate == 1 }  <td>   {$data.visitdate}  </td>  {/if} 
            <td>{$data.type}</td>
            <td>
                {$data.totaldetectionvalue}
            </td>
            <td>
                {$data.discount}
            </td>
            <td>
                {$data.detectionvalue_cash}
            </td>
            <td>
                {$data.detectionvalue_visa}
            </td>
            <td>
                {$data.restdetectionvalue}
            </td>
        </tr>
        {assign var="i" value={$i+1}}
        {/foreach}
    </tbody>

    <tfoot>
        <tr>
            <th>Total </th>
            <td></td>
            <td></td>
            {if $showDate &&   $showDate == 1 } <td></td>  {/if}
            <td></td>
            <td>{$totalCost}</td>
            <td>{$totalDiscount}</td>
            <td>{$totalCash}</td>
            <td>{$totalVisa}</td>
            <td>{$totalDept}</td>
        </tr>
    </tfoot>
</table>

<div class="clearfix"></div>

<table class="table table-hover portlet light bg-inverse dataTable " >
    <caption class="txtc" style="background-color: #d8eac6;" >New Patients </caption>
    <thead>
        <tr>
            <th style="width: 10px !important;">#</th>
            <th>   Patient Name</th>
            <th>   Patient No.</th>
            <th>Address</th>
            <th>   Register  Date</th>
        </tr>
    </thead>
    <tbody>
        {assign var="i" value="1"}
        {foreach $newPatients as $data}
        <tr class="odd ">
            <td>{$i}</td>
            <td>
                <a href="{$hosturl}/controllers/patienthistory.php?ac=show&patientid={$data.patientid}" target="_new">
                    {if  !empty($data.wifename) && $data.wifename != '' }
                    {$data.wifename}
                    {else} 
                    {$data.husdandname}
                    {/if}
                </a>
            </td>
            <td>{$data.statusno}</td>

            <td>{$data.address}</td>
            <td>
                {$data.entrydate}
            </td>
        </tr>
        {assign var="i" value={$i+1}}
        {/foreach}
    </tbody>
</table>




<div id="long" class="modal fade modal-scroll" tabindex="-1" data-replace="true">
    <div class="modal-dialog wds75">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close hidden-print" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title"></h4>
            </div>
            <div class="modal-body printtable" id="printd">
                <center><h4 class="modal-title">Financial Report</h4></center>
                <center><h5 class="modal-title">{$fdate}</h5></center>
                <table class="table table-hover portlet light bg-inverse" id="controllprop">
                    <thead>
                        <tr>
                            <th>Patient Number</th>
                            <th>
                                Patient Name
                            </th>
                            <th>
                                Cost
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        {assign var="i" value="1"}
                        {foreach $allData as $data}
                        <tr class="odd gradeX">
                            <td>{$data.statusno}</td>
                            <td>
                                {$data.wifename}
                            </td>
                            <td>
                                {$data.detectionvalue}
                            </td>
                        </tr>
                        {assign var="i" value={$i+1}}
                        {/foreach}
                        {if !empty($allData)}
                        <tr class="odd gradeX">
                            <th colspan="2">Total Cost</th>
                            <td>{$totalCost}</td>
                        </tr>
                        {/if}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>



{literal}
<script type="text/javascript" >
    $('#repTable').dataTable();
    $('.dataTable').dataTable();
</script>
{/literal}