<table class="table table-hover portlet light bg-inverse" id="repTable">
    <thead>
        <tr style="color:#5ce4f2;">
            <th colspan="5"></th>
            <th colspan="2"></th>
            <th colspan="2" >Infertility</th>
            <th colspan="27" >ICSI cycle</th>
        </tr>
        <tr style="color:#bd0606;">
            <th  style="border-bottom: 0.1px solid #fff !important;">Name</th>
            <th  style="border-bottom: 0.1px solid #fff !important;">Age</th>
            <th style="border-bottom: 0.1px solid #fff !important;">BMI</th>
            <th  style="border-bottom: 0.1px solid #fff !important;">AMH</th>
            <th  style="border-bottom: 0.1px solid #fff !important;">evaluation</th>
            <th  style="border-bottom: 0.1px solid #fff !important;">Name</th>
            <th  style="border-bottom: 0.1px solid #fff !important;">evaluation</th>
            <th  style="border-bottom: 0.1px solid #fff !important;">Type</th>
            <th  style="border-bottom: 0.1px solid #fff !important;">Durat</th>
            <th  style="border-bottom: 0.1px solid #fff !important;">Trial</th>
            <th  style="border-bottom: 0.1px solid #fff !important;">Protocol</th>
            <th colspan="3">COH</th>
            <th  style="border-bottom: 0.1px solid #fff !important;">TOO</th>
            <th colspan="3">OPU</th>
            <th colspan="2">Semen</th>
            <th  style="border-bottom: 0.1px solid #fff !important;">F/E D2</th>
            <th colspan="2">Thawing</th>
            <th >SS</th>
            <th colspan="5">ET</th>
            <th colspan="3">Fr</th>
            <th >Re</th>
            <th colspan="3">Outcome</th>
        </tr>
        <tr style="color:red;">
            <th  ></th>
            <th ></th>
            <th ></th>
            <th ></th>
            <th ></th>
            <th ></th>
            <th ></th>
            <th ></th>
            <th ></th>
            <th ></th>
            <th ></th>
            <th >HMG</th>
            <th >Durat</th>
            <th >E</th>
            <th ></th>
            <th >date</th>
            <th >N</th>
            <th >MII</th>
            <th >Fresh/frozen</th>
            <th >Sample/TESE</th>
            <th ></th>
            <th >Date</th>
            <th >ST.N</th>
            <th >result</th>
            <th >Date</th>
            <th >D</th>
            <th >N</th>
            <th >G</th>
            <th >cancel</th>
            <th >D</th>
            <th >ST</th>
            <th >EN</th>
            <th >EN</th>
            <th >HCG</th>
            <th >TVS</th>
            <th >Deliv</th>

        </tr>
    </thead>
    <tbody>

        {assign var="i" value="1"}
        {foreach $allData as $data}                                        <tr>
            <td><a href="{$hosturl}/controllers/patienthistory.php?ac=show&patientid={$data->patientid}" target="_new">{$data->info->wifename}</a></td>
            <td>{$data->trialAge}</td>
            <td>{$data->bmi}</td>
            <td>{$data->anamh}</td>
            <td>{$data->anevaluations}</td>
            <td>{$data->info->husdandname}</td>
            <td>{$data->anevaluation}</td>
            <td>{$data->antypet->title}</td>
            <td>{$data->sheetyear} / {$data->sheetmonth}</td>
            <td>{$data->annn}</td>
            <td>{$data->anprotocolt->title}</td>
            <td> {$data->ovsthmgs->ovsthmg} </td>
            {if $data->frozenor == "fresh"}
            <td>{$data->countovst}</td>
            <td>{$data->ovste->eovst}</td>
            {else}
            <td>{$data->counteprep}</td>
            <td>{$data->eprepdes->eprepe}</td>
            {/if}


            <td>{$data->toodrug}</td>
            <td>{$data->opudate}</td>
            <td>{$data->opun}</td>
            <td>{$data->opumll}</td>
            <td>{$data->frozenor}</td>
            <td>{$data->icsisement->title}</td>
            <td>{$data->fefn}</td>

            {if $data->frozenor == "fresh"}
            <td>
                {$data->eprepasc->thawingdate} 
            </td>
            <td>  
                {$data->eprepasc->thawingstn}
            </td>
            <td>{$data->sssresult}</td>
            <td>{$data->ettdate}</td>
            <td>{$data->ssscd}</td>
            <td>{$data->ettn}</td>
            <td>{$data->ettg}</td>
            <td>{$data->ettcancel}</td>
            <td>{$data->frrcd}</td>
            <td>{$data->frrst}</td>
            <td>{$data->frren}</td>
            <td>{$data->refren}</td>
            <td>{$data->ooutcomehsgn}</td>
            <td>{$data->ooutcometvsn}</td>
            <td>{$data->ooutcomedeln}</td>
            {else}
            <td>
                {$data->eprepdes->thawingdate} 
            </td>
            <td>  
                {$data->eprepdes->thawingstn}
            </td>
            <td>{$data->ssresult}</td>
            <td>{$data->etdate}</td>
            <td>{$data->etcd}</td>
            <td>{$data->etn}</td>
            <td>{$data->etg}</td>
            <td>{$data->etcancel}</td>
            <td>{$data->frrcd}</td>
            <td>{$data->frrst}</td>
            <td>{$data->frren}</td>
            <td>{$data->refren}</td>
            <td>{$data->outcomehsgn}</td>
            <td>{$data->outcometvsn}</td>
            <td>{$data->outcomedeln}</td>
            {/if}
        </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">EPC Date</h4></center>
                <table class="table table-hover portlet light bg-inverse" >
                    <thead>
                        <tr style="color:#5ce4f2;">
                            <th colspan="5"></th>
                            <th colspan="2"></th>
                            <th colspan="2" >Infertility</th>
                            <th colspan="27" >ICSI cycle</th>
                        </tr>
                        <tr style="color:#bd0606;">
                            <th  style="border-bottom: 0.1px solid #fff !important;">Name</th>
                            <th  style="border-bottom: 0.1px solid #fff !important;">Age</th>
                            <th style="border-bottom: 0.1px solid #fff !important;">BMI</th>
                            <th  style="border-bottom: 0.1px solid #fff !important;">AMH</th>
                            <th  style="border-bottom: 0.1px solid #fff !important;">evaluation</th>
                            <th  style="border-bottom: 0.1px solid #fff !important;">Name</th>
                            <th  style="border-bottom: 0.1px solid #fff !important;">evaluation</th>
                            <th  style="border-bottom: 0.1px solid #fff !important;">Type</th>
                            <th  style="border-bottom: 0.1px solid #fff !important;">Durat</th>
                            <th  style="border-bottom: 0.1px solid #fff !important;">Trial</th>
                            <th  style="border-bottom: 0.1px solid #fff !important;">Protocol</th>
                            <th colspan="3">COH</th>
                            <th  style="border-bottom: 0.1px solid #fff !important;">TOO</th>
                            <th colspan="3">OPU</th>
                            <th colspan="2">Semen</th>
                            <th  style="border-bottom: 0.1px solid #fff !important;">F/E D2</th>
                            <th colspan="2">Thawing</th>
                            <th >SS</th>
                            <th colspan="5">ET</th>
                            <th colspan="3">Fr</th>
                            <th >Re</th>
                            <th colspan="3">Outcome</th>
                        </tr>
                        <tr style="color:red;">
                            <th  ></th>
                            <th ></th>
                            <th ></th>
                            <th ></th>
                            <th ></th>
                            <th ></th>
                            <th ></th>
                            <th ></th>
                            <th ></th>
                            <th ></th>
                            <th ></th>
                            <th >HMG</th>
                            <th >Durat</th>
                            <th >E</th>
                            <th ></th>
                            <th >date</th>
                            <th >N</th>
                            <th >MII</th>
                            <th >Fresh/frozen</th>
                            <th >Sample/TESE</th>
                            <th ></th>
                            <th >Date</th>
                            <th >ST.N</th>
                            <th >result</th>
                            <th >Date</th>
                            <th >D</th>
                            <th >N</th>
                            <th >G</th>
                            <th >cancel</th>
                            <th >D</th>
                            <th >ST</th>
                            <th >EN</th>
                            <th >EN</th>
                            <th >HCG</th>
                            <th >TVS</th>
                            <th >Deliv</th>

                        </tr>
                    </thead>
                    <tbody>
                        {assign var="i" value="1"}
                        {foreach $allData as $data}                                        <tr>
                            <td><a href="{$hosturl}/controllers/patienthistory.php?ac=show&patientid={$data->patientid}" target="_new">{$data->info->wifename}</a></td>
                            <td>{$data->trialAge}</td>
                            <td>{$data->bmi}</td>
                            <td>{$data->anamh}</td>
                            <td>{$data->anevaluations}</td>
                            <td>{$data->info->husdandname}</td>
                            <td>{$data->anevaluation}</td>
                            <td>{$data->antypet->title}</td>
                            <td>{$data->sheetyear} / {$data->sheetmonth}</td>
                            <td>{$data->annn}</td>
                            <td>{$data->anprotocolt->title}</td>
                            <td> {$data->ovsthmgs->ovsthmg} </td>
                            {if $data->frozenor == "fresh"}
                            <td>{$data->countovst}</td>
                            <td>{$data->ovste->eovst}</td>
                            {else}
                            <td>{$data->counteprep}</td>
                            <td>{$data->eprepdes->eprepe}</td>
                            {/if}


                            <td>{$data->toodrug}</td>
                            <td>{$data->opudate}</td>
                            <td>{$data->opun}</td>
                            <td>{$data->opumll}</td>
                            <td>{$data->frozenor}</td>
                            <td>{$data->icsisement->title}</td>
                            <td>{$data->fefn}</td>

                            {if $data->frozenor == "fresh"}
                            <td>
                                {$data->eprepasc->thawingdate} 
                            </td>
                            <td>  
                                {$data->eprepasc->thawingstn}
                            </td>
                            <td>{$data->sssresult}</td>
                            <td>{$data->ettdate}</td>
                            <td>{$data->ssscd}</td>
                            <td>{$data->ettn}</td>
                            <td>{$data->ettg}</td>
                            <td>{$data->ettcancel}</td>
                            <td>{$data->frrcd}</td>
                            <td>{$data->frrst}</td>
                            <td>{$data->frren}</td>
                            <td>{$data->refren}</td>
                            <td>{$data->ooutcomehsgn}</td>
                            <td>{$data->ooutcometvsn}</td>
                            <td>{$data->ooutcomedeln}</td>
                            {else}
                            <td>
                                {$data->eprepdes->thawingdate} 
                            </td>
                            <td>  
                                {$data->eprepdes->thawingstn}
                            </td>
                            <td>{$data->ssresult}</td>
                            <td>{$data->etdate}</td>
                            <td>{$data->etcd}</td>
                            <td>{$data->etn}</td>
                            <td>{$data->etg}</td>
                            <td>{$data->etcancel}</td>
                            <td>{$data->frrcd}</td>
                            <td>{$data->frrst}</td>
                            <td>{$data->frren}</td>
                            <td>{$data->refren}</td>
                            <td>{$data->outcomehsgn}</td>
                            <td>{$data->outcometvsn}</td>
                            <td>{$data->outcomedeln}</td>
                            {/if}
                        </tr>
                        {assign var="i" value={$i+1}}
                        {/foreach}
                    </tbody>
                </table>
            </div>
            <div class="modal-footer">
                <button type="button" data-dismiss="modal" class="btn hidden-print">Close</button>
                <button type="button" id="print1" class="btn red hidden-print">print</button>
            </div>
        </div>
    </div>
</div>


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

        "lengthMenu": [
            [15, 20, -1],
            [15, 20, "All"] // change per page values here
        ],
        // set the initial value
        "pageLength": 15,
        "language": {
            "lengthMenu": " _MENU_",
            "aria": {
                "sortAscending": ": Used to order Ascending",
                "sortDescending": ": Used to order Descending"
            },
            "emptyTable": "NO data",
            "info": "Show _START_ From _END_ To _TOTAL_ item",
            "infoFiltered": "(Filter is _MAX_ from total)",
            "lengthMenu": "_MENU_",
            "search": "",
            "zeroRecords": "No search data"
        },
        "columnDefs": [{// set default column settings
                'orderable': true,
                'targets': [0]
            }],
        "order": [
            [4, "asc"]
        ] // set first column as a default sort by asc
        , "scrollX": true
    });
</script>
{/literal}
