<div class="page-content-wrapper">
    <div class="page-content">
        <div class="row">
            <div class="col-md-12">
                <!-- BEGIN EXAMPLE TABLE PORTLET-->
                <div class="portlet box blue">
                    <div class="portlet-title">
                        <div class="caption">
                            <i class="fa fa-users"></i>Financial Report
                        </div>
                    </div>
                    <div class="portlet-body all">
                        <input type="hidden" id="reportPage" value="1"/>
                        <input type="hidden" id="tdate" value="{$today}">
                        <input type="hidden" id="controllName" value="financialreport"/>
                        <!--Begin Semen-->

                        <div class="row">
                            <div class="row clinick posre">
                                <div class="col-md-2 wds10">
                                    <div class="form-group form-md-line-input form-md-floating-label has-info">
                                        <input type="text" class="form-control datepicker txtc " id="findate" value="{$today}"/>
                                        <label for="form_control_1">Date From </label>
                                    </div>
                                </div>

                                <div class="col-md-2 wds10">
                                    <div class="form-group form-md-line-input form-md-floating-label has-info">
                                        <input type="text" class="form-control datepicker txtc " id="tofindate" value="{$today}"/>
                                        <label for="form_control_1">Date To </label>
                                    </div>
                                </div>

                                <div class="col-md-2 wds10">
                                    <div class="form-group">
                                        <label class="control-label ls2">Patient No</label>
                                        <input type="text" name="search" id="statusNo" 
                                               class="form-control searchPat txtc sbystno" >
                                    </div>
                                </div>


                                <div class="col-md-3">
                                    <div class="form-group">
                                        <label class="control-label ls2">Patient Name</label>

                                        <select class="form-control searchFin " id="patientName">
                                            <option value="">choose</option>
                                            {foreach  $allPatients as $data}
                                            <option value="{$data->id}" >{$data->wifename}</option>
                                            {/foreach}
                                        </select>

                                    </div>
                                </div>

                                <div class="col-md-3">
                                    <div class="form-group">
                                        <label class="control-label ls2">Husband Name</label>

                                        <select class="form-control searchFin " id="husband">
                                            <option value="">choose</option>
                                            {foreach  $allPatients as $data}
                                            <option value="{$data->husdandname}" >{$data->husdandname}</option>
                                            {/foreach}
                                        </select>

                                    </div>
                                </div>

                                <div class="col-md-2 wds20">
                                    <div class="form-group">
                                        <label class="control-label ls2">Address</label>
                                        <input type="text" name="address" id="patAddress" 
                                               class="form-control  txtc" >
                                    </div>
                                </div>



                            </div>

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

                            <div class="portlet box white">
                                <div class="portlet-title">
                                    <div class="actions">

                                        <a class="btn btn-primary btn-sm" id="finSearchBtn" >
                                            <i class="fa fa-search"></i> Search </a>

                                        <a class="btn btn-default btn-sm" id="printfi" >
                                            <i class="fa fa-print"></i> Print </a>

                                    </div>
                                </div>

                                <div class="portlet-body form" id="financialDiv">
                                    <table class="table table-hover portlet light bg-inverse dataTable ">
                                        <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>
                            </div>
                        </div>

                    </div>

                    <!--End Semen-->


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

                </div>
            </div>
        </div>
    </div>
</div>

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