<div id="prind">
    <div class="clearfix"></div>
    <!----#########################################---------HISTORY------------############################################################################################---->
    <div class="row arabic">
        <div class="aw_xblue">
            <table class="table table-bordered table-hover  nopdngtbl" style="direction: rtl;margin: 5px 0px;">
                <tr>
                    <td class="txtr">{if !empty($patientdata.wifetype)}{$patientdata.wifetype} {/if}/ {$patientdata.wifename}</td>
                    <td class="txtr">{if $new_dateofbirth_calc != ''} {$new_dateofbirth_calc} سنة {/if}  </td>
                    <td class="txtr">{if !empty($patientdata.wifejob)}{$patientdata.wifejob}{/if}</td>
                    <td class="txtr">{$patientdata.address}</td>
                    <td class="txtr wds15">رقم المريضة : {$patientdata.statusno}</td>
                </tr>
                <tr>
                    {if $patientdata.statuesid != 1}
                    {if $patientdata.mirragefromdate }
                    <td class="txtr">متزوجة منذ :{if $mirragemonths == 0} {$mirrageyears} سنة 
                        {elseif $mirrageyears==0 } {if $mirragemonths==1}{$mirragemonths} شهر {else}{$mirragemonths} شهور {/if}
                        {else } {$mirrageyears}سنة  -{if $mirragemonths==1}{$mirragemonths} شهر {else}{$mirragemonths} شهور {/if}
                        {/if} </td>
                    {else}
                    <td class="txtr">متزوجة منذ :</td>

                    {/if}
                    <td class="txtr"> الذكور: {$patientdata.boyson} </td>
                    <td class="txtr"> الإناث: {$patientdata.girlson} </td>
                    {/if}
                    <td class="attintbl2rows" colspan="2">   </td>
                    {if $patientdata.statuesid == 1}
                    <td  class="wds15" colspan="3">

                    </td>
                    {/if}
                </tr>
                {if $patientdata.statuesid != 1}
                <tr>
                    <td class="txtr">{if !empty($patientdata.husbandtype)}{$patientdata.husbandtype} {/if}/ {$patientdata.husdandname}</td>
                    <td class="txtr">{if  $patientdata.statuesid != 3 }{if $new_dateofbirth_husband != '' } {$new_dateofbirth_husband} سنة {/if} {/if}</td>
                    <td class="txtr">{if !empty($patientdata.husbandjob)}{$patientdata.husbandjob} {/if}</td>
                    <td  class="wds15" colspan="2">

                    </td>
                </tr>
                {/if}

                {if $patientdata.importantnote != '' && $patientdata.importantnote != null }
                <tr>
                    <td class="txtr" colspan="5">  ملاحظات هامة : {$patientdata.importantnote}</td>
                </tr>
                {/if}
            </table>
        </div>
    </div>
    <div class="row">



        <input type="hidden" id="patientid" value="{$patientId}"/>

        <div class="row">
            <div class="col-md-12" style="padding-right: 0px; padding-left: 0px;">

                <div class="aw_green">

                    {if $phmenstrualcount > 0}
                    <table class="table  table-bordered table-hover nopdngtbl" >
                        <tr class="odd gradeX gradeXY">

                            <td class="bold">
                                Menstrual H
                            </td>

                            {if $idData == "yes"}
                            {if !empty($phregualrity) && ($phregualrity->id eq 1  || $phregualrity->id eq 2)  }

                            {if $phregualrity}<td class="txtl"> {$phregualrity->name}</td>{/if}

                            {if $myphmenstrual->phlMP}<td class="txtl"> <label class="bold" style="color:  #3598DC;">LMP </label> {$myphmenstrual->phlMP}</td>{/if}

                            {else}
                            {if $myphmenstrual->menarche} <td class="txtl"> {$myphmenstrual->menarche} <label class="bold" style="color:  #3598DC;">Y </label> </td>   {/if}

                            {if $myphmenstrual->duration} <td class="txtl"> {$myphmenstrual->duration} <label class="bold" style="color:  #3598DC;"> D  </label></td> {/if}

                            {if $myphmenstrual->length} <td class="txtl"> {$myphmenstrual->length} <label class="bold" style="color:  #3598DC;"> D </label></td> {/if}

                            {if $phregualrity} <td class="txtl"> {$phregualrity->name}</td> {/if}

                            {if $phamount} <td class="txtl"> {$phamount->name}</td> {/if}

                            {if $phdysmenorrhoea} <td class="txtl"> {$phdysmenorrhoea->name}</td> {/if}

                            {if $myphmenstrual->phlMP} <td class="txtl"> <label class="bold" style="color:  #3598DC;">LMP </label> {$myphmenstrual->phlMP}</td> {/if}

                            {/if}

                            {else}
                            <td class="txtl">
                                <label>data is empty</label>
                            </td>
                            {/if}
                        </tr>
                    </table>
                    {/if} 

                    <!-- ========================================================Contraception================================================================-->
                    {if $myallcontractcount > 0}

                    <table class="table  table-bordered table-hover nopdngtbl" >

                        <tr class="odd gradeX gradeXY">

                            <td class="bold">
                                Contraception H 
                            </td>
                            {if $idData1 == "yes"}

                            {if $phcontracttype->name} <td class="txtl"><label class="bold" style="color:  #3598DC;">Type : </label> {$phcontracttype->name} </td>{/if}

                            {if $myallcontract->contduration} <td class="txtl"> <label class="bold" style="color:  #3598DC;"> Duration : </label>  {$myallcontract->contduration} Y</td>{/if}

                            {if $myallcontract->contstopped} <td class="txtl"> <label class="bold" style="color:  #3598DC;"> Stopped : </label>   {$myallcontract->contstopped} Y</td>{/if}

                            {if $myallcontract->contranote} <td class="txtl"> <label class="bold" style="color:  #3598DC;"> Note : </label>  {$myallcontract->contranote}</td> {/if}


                            {else}
                            <td class="txtl">
                                <label>data is empty</label>
                            </td>
                            {/if}
                        </tr>

                    </table>
                    {/if}



                    <!-- ========================================================Obstetric H================================================================-->
                    {if $myallobsteric > 0}
                    <table class="table  table-bordered table-hover nopdngtbl" >
                        <tr class="odd gradeX gradeXY">

                            <td class="bold">
                                Obstetric H
                            </td>



                            <td class="txtl"><label class="bold" style="color:  #3598DC;">G : </label>   {$myallobsteric}</td>

                            <td class="txtl"><label class="bold" style="color:  #3598DC;"> P : </label>  {$pcounter}</td>

                            <td class="txtl"><label class="bold" style="color:  #3598DC;"> AB : </label>  {$abcounter}</td>

                            <td class="txtl"><label class="bold" style="color:  #3598DC;"> Ectopic : </label>  {$Ectopiccounter}</td>

                            <td class="txtl"><label class="bold" style="color:  #3598DC;"> V.mole : </label>  {$vmodelcounter}</td>

                        </tr>


                    </table>
                    {/if}







                    <!-- ========================================================Past Medical H================================================================-->
                    <table class="table  table-bordered table-hover nopdngtbl" >
                        {if $allpastmedicalWcount > 0}
                        <tr class="odd gradeX gradeXY">

                            <td class="bold">
                                Past Medical H  ( Wife )
                            </td>

                            <td class="txtl">
                                <label class="bold" style="color:  #3598DC;"> Disease  : </label>
                                {assign var=i value=1}
                                {foreach $allpastmedicalW as $myallpastmedical}
                                {if $i == 1 }
                                {$myallpastmedical.name}
                                {else}
                                ,{$myallpastmedical.name}
                                {/if}

                                {capture assign=i}{$i+1}{/capture}
                                {/foreach}
                            </td>
                        </tr>
                        {/if}

                        {if $allpastmedicalHcount > 0}
                        <tr class="odd gradeX gradeXY">

                            <td class="bold">
                                Past Medical H ( Husband )
                            </td>

                            <td class="txtl">
                                <label class="bold" style="color:  #3598DC;"> Disease  : </label>
                                {assign var=i value=1}
                                {foreach $allpastmedicalH as $myallpastmedical}
                                {if $i == 1 }
                                {$myallpastmedical.name}
                                {else}
                                ,{$myallpastmedical.name}
                                {/if}

                                {capture assign=i}{$i+1}{/capture}
                                {/foreach}
                            </td>
                        </tr>
                        {/if}

                        <!-- ========================================================Past surgical H================================================================-->

                        {if $allpastsurgicalWcount > 0}
                        <tr class="odd gradeX gradeXY">

                            <td class="bold">
                                Past Surgical H ( Wife )
                            </td>

                            <td class="txtl">

                                <label class="bold" style="color:  #3598DC;"> Operation : </label>

                                {assign var=i value=1}
                                {foreach $allpastsurgicalW as $myallpastsurgical}
                                {if $i == 1 }
                                {$myallpastsurgical.name}
                                {else}
                                ,{$myallpastsurgical.name}
                                {/if}

                                {capture assign=i}{$i+1}{/capture}
                                {/foreach}
                            </td>

                        </tr>
                        {/if}


                        {if $allpastsurgicalHcount > 0}
                        <tr class="odd gradeX gradeXY">

                            <td class="bold">
                                Past Surgical H ( Husband )
                            </td>

                            <td class="txtl">

                                <label class="bold" style="color:  #3598DC;"> Operation : </label>

                                {assign var=i value=1}
                                {foreach $allpastsurgicalH as $myallpastsurgical}
                                {if $i == 1 }
                                {$myallpastsurgical.name}
                                {else}
                                ,{$myallpastsurgical.name}
                                {/if}

                                {capture assign=i}{$i+1}{/capture}
                                {/foreach}
                            </td>

                        </tr>
                        {/if}



                        <!-- ========================================================Past Gynecological H================================================================-->

                        {if $allphpastgynecologicalcount > 0}
                        <tr class="odd gradeX gradeXY">

                            <td class="bold">
                                Past Gynecological 
                            </td>

                            <td class="txtl">

                                <label class="bold" style="color:  #3598DC;"> Operation : </label>

                                {assign var=i value=1}
                                {foreach $allphpastgynecological as $myallphpastgynecological}
                                {if $i == 1 }
                                {$myallphpastgynecological.name}
                                {else}
                                ,{$myallphpastgynecological.name}
                                {/if}

                                {capture assign=i}{$i+1}{/capture}
                                {/foreach}
                            </td>

                        </tr>
                        {/if}
                        <!-- ========================================================Past art H================================================================-->

                        {if $allphpastartcount > 0}
                        <tr class="odd gradeX gradeXY">

                            <td class="bold">
                                ART External 
                            </td>

                            <td class="txtl">

                                <label class="bold" style="color:  #3598DC;"> Type :  </label>

                                {assign var=i value=1}
                                {foreach $allphpastart as $myallphpastart}
                                {if $i == 1 }
                                {$myallphpastart.name}
                                {else}
                                ,{$myallphpastart.name}
                                {/if}

                                {capture assign=i}{$i+1}{/capture}
                                {/foreach}
                            </td>
                        </tr>
                        {/if}


                        {if $internalphpastartcount > 0}
                        <tr class="odd gradeX gradeXY">

                            <td class="bold">
                                ART INTERNAL
                            </td>

                            <td class="txtl">

                                <label class="bold" style="color:  #3598DC;"> Place :  </label>

                                {assign var=i value=1}
                                {foreach $internalphpastart as $myallphpastart}
                                {if $i > 1 }  ,  {/if}

                                &nbsp; {$myallphpastart.monitordate} :  {$myallphpastart.place}

                                {capture assign=i}{$i+1}{/capture}
                                {/foreach}
                            </td>
                        </tr>
                        {/if}

                        <!-- ========================================================Family H================================================================-->
                        {if $allphfamilycount > 0}
                        <tr class="odd gradeX gradeXY">

                            <td class="bold">
                                Family H
                            </td>




                            <td class="txtl">

                                <label class="bold" style="color:  #3598DC;"> Disease :  </label>

                                {assign var=i value=1}
                                {foreach $allphfamily as $myallphfamily}
                                {if $i == 1 }
                                {$myallphfamily.name}
                                {else}
                                ,{$myallphfamily.name}
                                {/if}

                                {capture assign=i}{$i+1}{/capture}
                                {/foreach}
                            </td>
                        </tr>
                        {/if}


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


    <!----#########################################------EXAMINATION------##################################################################################-->
    {if !empty($allexmination)}
    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px;">
        <thead>
            <tr>
                <th colspan="12" class="bg-grey-gallery bg-font-grey-gallery">
                    Examination
                </th>
            </tr>
            <tr>
                <th>Date</th>
                <th>WT.</th>
                <th>HT.</th>
                <th>BMI</th>
                <th>BP</th>
                <th>pulse</th>
                <th>Head & neck</th>
                <th>Chest & heart</th>
                <th>Abdomen</th>
                <th>Pelvis</th>
                <th>Extremitis</th>
                {if $programSetting->displaydoctorname eq 1}<th>Doctor</th>{/if}
            </tr>
        </thead>
        <tbody>
            {foreach $allexmination as $myallexmination}
            <tr class="odd gradeXH">
                <td>{$myallexmination.examinationdate}</td>
                <td>{$myallexmination.weight}</td>
                <td>{$myallexmination.height}</td>
                <td>{$myallexmination.bmi}</td>
                <td><input type="text" class="bp_mask" value="{$myallexmination.b_p}" disabled style="border: none;background: inherit ;width: 50px;"/></td>
                <td>{$myallexmination.pulse}</td>
                <td>{$myallexmination.headandneck}</td>
                <td>{$myallexmination.chestandheart}</td>
                <td>{$myallexmination.abdomen}</td>
                <td>{$myallexmination.pelvis}</td>
                <td>{$myallexmination.extremitis}</td>
                {if $programSetting->displaydoctorname eq 1}   <td>{$myallexmination.docname}</td> {/if}
            </tr>
            {/foreach}
        </tbody>
    </table>
    {/if}   
    <!----#########################################------SEMEN------##################################################################################-->
    {if !empty($allsemen)} 
    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px;">
        <thead>
            <tr>
                <th colspan="12" class="bg-grey-gallery bg-font-grey-gallery">
                    Semen
                </th>
            </tr>
            <tr>
                <th>Date</th>
                <th>Count</th>
                <th>MotilityA</th>
                <th>MotilityA+B</th>
                <th>Normal</th>
                <th>Pus cells</th>
                <th>Notes</th>
                {if $programSetting->displaydoctorname eq 1}<th>Doctor</th>{/if}
            </tr>
        </thead>
        <tbody>
            {foreach $allsemen as $semen}
            <tr class="odd gradeXH">
                <td>{$semen.sdate}</td>
                <td>{$semen.count}</td>
                <td>{$semen.motilitya}</td>
                <td>{$semen.motilityab}</td>
                <td>{$semen.normal}</td>
                <td>{$semen.puscell}</td>
                <td>{$semen.notes}</td>
                {if $programSetting->displaydoctorname eq 1}   <td>{$semen.docname}</td> {/if}
            </tr>
            <tr>
                <td></td>
                <td><label class="checkbox-inline ">{if !empty($semen.normaltype)} Normal {/if}</label></td>
                <td><label class="checkbox-inline ">{if !empty($semen.oligo)} Oligo sprerm {/if}</label></td>
                <td><label class="checkbox-inline ">{if !empty($semen.astheno)} Astheno sperm {/if}</label></td>
                <td><label class="checkbox-inline ">{if !empty($semen.tetrato)} Tetrato sperm {/if}</label></td>
                <td></td>
                <td></td>
                {if $programSetting->displaydoctorname eq 1}   <td></td> {/if}
            </tr>
            {/foreach}
        </tbody>
    </table>
    {/if}

    <!----#########################################------HSG------##################################################################################-->
    {if !empty($allhsg)}                         
    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px;">
        <thead>
            <tr>
                <th colspan="12" class="bg-grey-gallery bg-font-grey-gallery">
                    HSG
                </th>
            </tr>
            <tr>
                <th>Date</th>
                <th>Uterus</th>
                <th>R.tube</th>
                <th>L.tube</th>
                <th>Smear</th>
                <th>Notes</th>
                {if $programSetting->displaydoctorname eq 1}<th>Doctor</th>{/if}
            </tr>
        </thead>
        <tbody>
            {foreach $allhsg as $hsg}
            <tr class="odd gradeXH">
                <td>{$hsg.sdate}</td>
                <td>{$hsg.uterus}</td>
                <td>{$hsg.rtube}</td>
                <td>{$hsg.ltube}</td>
                <td>{$hsg.smear}</td>
                <td>{$hsg.notes}</td>
                {if $programSetting->displaydoctorname eq 1}   <td>{$hsg.docname}</td> {/if}
            </tr>
            {/foreach}
        </tbody>
    </table>

    {/if}
    <!----################################################################ USTV  ####################################################################################################-->
    {if !empty($allustv)}  

    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px;">
        <thead>
            <tr>
                <th colspan="12" class="bg-grey-gallery bg-font-grey-gallery">
                    US/TVS
                </th>
            </tr>
            <tr>
                <th>Date</th>
                <th>Uterus</th>
                <th>R.adnexa</th>
                <th>L.adnexa</th>
                <th>Pelvis</th>
                <th>Notes</th>
                {if $programSetting->displaydoctorname eq 1}<th>Doctor</th>{/if}
            </tr>
        </thead>
        <tbody>
            {foreach $allustv as $ustv}
            <tr class="odd gradeXH">
                <td>{$ustv.sdate}</td>
                <td>{$ustv.uterus}</td>
                <td>{$ustv.radnexa}</td>
                <td>{$ustv.ladnexa}</td>
                <td>{$ustv.pelvis}</td>
                <td>{$ustv.notes}</td>
                {if $programSetting->displaydoctorname eq 1}   <td>{$ustv.docname}</td> {/if}
            </tr>
            {/foreach}
        </tbody>
    </table>
    {/if}

    <!----###################################################################----LAPAROSCOPY-----#################################################################################################-->
    {if !empty($alllaparoscopy)} 

    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px;">
        <thead>
            <tr>
                <th colspan="12" class="bg-grey-gallery bg-font-grey-gallery">
                    LAPAROSCOPY
                </th>
            </tr>
            <tr>
                <th>Date</th>
                <th>Uterus</th>
                <th>R.adnexa</th>
                <th>L.adnexa</th>
                <th>Pelvis</th>
                <th>Notes</th>
                {if $programSetting->displaydoctorname eq 1}<th>Doctor</th>{/if}
            </tr>
        </thead>
        <tbody>
            {foreach $alllaparoscopy as $lap}
            <tr class="odd gradeXH">
                <td>{$lap.sdate}</td>
                <td>{$lap.uterus}</td>
                <td>{$lap.radnexa}</td>
                <td>{$lap.ladnexa}</td>
                <td>{$lap.pelvis}</td>
                <td>{$lap.notes}</td>
                {if $programSetting->displaydoctorname eq 1}   <td>{$lap.docname}</td> {/if}
            </tr>
            {/foreach}
        </tbody>
    </table>
    {/if}
    <!----#########################################################---HYSTEROSCOPY----################################################################################-->
    {if !empty($allhysteroscopy)} 

    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px;">
        <thead>
            <tr>
                <th colspan="12" class="bg-grey-gallery bg-font-grey-gallery">
                    HYSTEROSCOPY
                </th>
            </tr>
            <tr>
                <th>Date</th>
                <th>Cervix</th>
                <th>Uterine Cavity</th>
                <th>R.Ostium</th>
                <th>L.Ostium</th>
                <th>Notes</th>
                {if $programSetting->displaydoctorname eq 1}<th>Doctor</th>{/if}
            </tr>
        </thead>
        <tbody>
            {foreach $allhysteroscopy as $hyst}
            <tr class="odd gradeXH">
                <td>{$hyst.sdate}</td>
                <td>{$hyst.cervix}</td>
                <td>{$hyst.uterine}</td>
                <td>{$hyst.rostium}</td>
                <td>{$hyst.lostium}</td>
                <td>{$hyst.notes}</td>
                {if $programSetting->displaydoctorname eq 1}   <td>{$hyst.docname}</td> {/if}
            </tr>
            {/foreach}
        </tbody>
    </table>

    {/if}
    <!----#######################################################################--------MRICT-----------#############################################################################################-->
    {if !empty($allmrict)}  
    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px;">
        <thead>
            <tr>
                <th colspan="12" class="bg-grey-gallery bg-font-grey-gallery">
                    MRI/CT
                </th>
            </tr>
            <tr>
                <th>Date</th>
                <th>Uterus</th>
                <th>R.adnexa</th>
                <th>L.adnexa</th>
                <th>Pelvis</th>
                <th>Notes</th>
                {if $programSetting->displaydoctorname eq 1}<th>Doctor</th>{/if}
            </tr>
        </thead>
        <tbody>
            {foreach $allmrict as $mri}
            <tr class="odd gradeXH">
                <td>{$mri.sdate}</td>
                <td>{$mri.uterus}</td>
                <td>{$mri.radnexa}</td>
                <td>{$mri.ladnexa}</td>
                <td>{$mri.pelvis}</td>
                <td>{$mri.notes}</td>
                {if $programSetting->displaydoctorname eq 1}   <td>{$mri.docname}</td> {/if}
            </tr>
            {/foreach}
        </tbody>
    </table>
    {/if}
    <!----##############################################################-------HORMON-----------------######################################################################################################-->
    {if !empty($allhormon)}   

    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px;">
        <thead>
            <tr>
                <th colspan="19" class="bg-grey-gallery bg-font-grey-gallery">
                    HORMONES
                </th>
            </tr>
            <tr>
                <th>Date</th>
                <th>FSH</th>
                <th>LH</th>
                <th>PRL</th>
                <th>E2</th>
                <th>AMH</th>
                <th>FreeT</th>
                <th>TotalT</th>
                <th>P4</th>
                <th>TSH</th>
                <th>T3</th>
                <th>T4</th>
                <th>DHEAS</th>
                <th>DHT</th>
                <th>B.HCG </th>
                <th>InhibinB</th>
                <th>ASD</th>
                <th>Notes</th>
                {if $programSetting->displaydoctorname eq 1}<th>Doctor</th>{/if}
            </tr>
            <tr>
                <td></td>
                <td>mIU/ml</td>
                <td>mIU/ml</td>
                <td>ng/ml</td>
                <td>pg/ml</td>

                <td>ng/ml</td>
                <td>pg/ml</td>
                <td>ng/dl</td>
                <td>ng/ml</td>

                <td>uIU/ml</td>
                <td>ng/ml</td>
                <td>ug/dl</td>
                <td>ug/dl</td>

                <td>ng/ml</td>
                <td>mIU/ml</td>
                <td>pg/ml</td>
                <td>ng/ml</td>

                <td></td>
                {if $programSetting->displaydoctorname eq 1}   <td></td> {/if}
            </tr>
        </thead>                                            
        <tbody>
            {foreach $allhormon as $hormon}
            <tr class="odd gradeXH">
                <td>{$hormon.sdate}</td>
                <td>{$hormon.fsh}</td>
                <td>{$hormon.lh}</td>
                <td>{$hormon.prl}</td>
                <td>{$hormon.etwo}</td>
                <td>{$hormon.amh}</td>
                <td>{$hormon.freet}</td>
                <td>{$hormon.totalt}</td>
                <td>{$hormon.pfour}</td>
                <td>{$hormon.tsh}</td>
                <td>{$hormon.tthree}</td>
                <td>{$hormon.tfour}</td>
                <td>{$hormon.dheas}</td>
                <td>{$hormon.dht}</td>
                <td>{$hormon.bhcg}</td>
                <td>{$hormon.inhibinb}</td>
                <td>{$hormon.asd}</td>
                <td>{$hormon.notes}</td>
                {if $programSetting->displaydoctorname eq 1}   <td>{$hormon.docname}</td> {/if}
            </tr>
            {/foreach}
        </tbody>
    </table>

    {/if}



    <!----#############################################################---------PATHOLOGY-------#######################################################################################################-->
    {if !empty($allpathology)}
    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px;">
        <thead>
            <tr>
                <th colspan="12" class="bg-grey-gallery bg-font-grey-gallery">
                    PATHOLOGY
                </th>
            </tr>
            <tr>
                <th>Date</th>
                <th>Cytology</th>
                <th>Histopathology</th>
                {if $programSetting->displaydoctorname eq 1}<th>Doctor</th>{/if}
            </tr>
        </thead>
        <tbody>
            {foreach $allpathology as $path}
            <tr class="odd gradeXH">
                <td>{$path.sdate}</td>
                <td>{$path.cytology}</td>
                <td>{$path.histopathology}</td>
                {if $programSetting->displaydoctorname eq 1}   <td>{$path.docname}</td> {/if}
            </tr>
            {/foreach}
        </tbody>
    </table>
    {/if}
    <!----#################################################################--------------GYNA VISITS-----------------------###################################################################################################-->
    {if !empty($allgyna) || (!empty($maingyna) && ( $maingyna->notes != ''  || $maingyna->plan != '' ) )}
    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px;">
        <thead>
            <tr>
                <th colspan="12" class="bg-grey-gallery bg-font-grey-gallery">
                    {if $programSetting->programview eq 1}
                    Gyna Visits
                    {else}
                    Follow Up Visits
                    {/if}
                </th>
            </tr>

        </thead>
    </table>
    {/if}

    {if !empty($maingyna) && ( $maingyna->notes != ''  || $maingyna->plan != '' ) }
    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px;">
        <tbody>
            {if  $maingyna->notes != ''  }
            <tr>
                <th class="col-md-1">Notes</th>
                <td>{$maingyna->notes}</td>
            </tr>
            {/if}

            {if  $maingyna->plan != ''  }
            <tr>
                <th class="col-md-1" >Plan</th>
                <td>{$maingyna->plan}</td>
            </tr>
            {/if}
        </tbody> 
    </table>
    {/if}




    {if !empty($allgyna)}
    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px;">
        <thead>
            <tr>
                <th>Date</th>
                <th>Complaint</th>
                {if $programSetting->diagnosshow eq 0} <th>Diagnosis</th>{/if}
                <th>Notes</th>
                {if $programSetting->displaydoctorname eq 1}<th>Doctor</th>{/if}
            </tr>
        </thead>
        <tbody>
            {foreach $allgyna as $gyna_obj}
            <tr class="odd gradeXH">
                <td>{$gyna_obj.gynadate}</td>
                {if $programSetting->diagnosshow eq 0}
                <td>{$gyna_obj.complaintxt}</td>
                <td>{$gyna_obj.diagnosistxt}</td>
                {else}
                <td>{$gyna_obj.complaint}</td>                                        
                {/if}

                <td>{$gyna_obj.notes}</td>
                {if $programSetting->displaydoctorname eq 1}   <td>{$gyna_obj.docname}</td> {/if}
            </tr>
            {/foreach}
        </tbody>       
    </table>
    {/if}
    <!----########################################################################================Folliculometry=================############################################################################################-->
    {if !empty($allgynaUS)}
    {if $programSetting->ultrasound eq 0}
    <table class="table table-striped table-hover table-bordered" >

        <thead>
            <tr>
                <th colspan="25" class="bg-grey-gallery bg-font-grey-gallery">
                    Folliculometry
                </th>
            </tr>
            <tr>
                <th rowspan="2" class="cent" style=" width: 100px; ">
                    Date
                </th>
                <th rowspan="2" class="cent" style=" width: 60px; ">
                    Day
                </th>
                <th colspan="2" class="cent">
                    Right Ovary
                </th>

                <th colspan="2" class="cent">
                    Left Ovary
                </th>
                <th rowspan="2" class="cent" style=" width: 60px; ">
                    Endo
                </th>

                <th rowspan="2" class="cent">
                    Notes
                </th>
                {if $ProgramesettingData->displaydoctorname eq 1}
                <th rowspan="2">
                    Doctor
                </th>
                {/if}
            </tr>
            <tr>
                <th style=" width: 60px; background: #c6d7f2;">
                    No
                </th>

                <th style="background: #c6d7f2;">
                    Size
                </th>
                <th style=" width: 60px; background: #c6d7f2;">
                    No
                </th>

                <th style="background: #c6d7f2;">
                    Size
                </th>
                {if $ProgramesettingData->displaydoctorname eq 1}                                                    {/if}

            </tr>
        </thead>


        <tbody id="ussimple">
            {assign var=i value=1}
            {foreach $allgynaUS  as $gUs }
            <tr>
                <td>
                    {$gUs->date}
                </td>
                <td>
                    {$gUs->day}
                </td>
                <td>
                    {$gUs->ovraylno}
                </td>
                <td>
                    {$gUs->ovraylsize}
                </td>
                <td>
                    {$gUs->ovrayrno}
                </td>
                <td>
                    {$gUs->ovrayrsize}
                </td>
                <td>
                    {$gUs->endo}
                </td>
                <td>
                    {$gUs->notes}
                </td>
                {if $ProgramesettingData->displaydoctorname eq 1}
                <td class="bold">
                    {$gUs->doctorname}
                </td>
                {/if}
            </tr>
            {capture assign=i}{$i+1}{/capture}
            {/foreach}
        </tbody>
    </table>
    {else}
    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px;">
        <thead>
            <tr>
                <th colspan="25" class="bg-grey-gallery bg-font-grey-gallery">
                    Folliculometry
                </th>
            </tr>
            <tr>
                <th rowspan="2" scope="col">Date</th>
                <th rowspan="2" scope="col">Day</th>
                <th rowspan="2" scope="col">Endo</th>
                <th colspan="3" scope="col" class="bg-grey bg-font-grey">Uterus</th>
                <th colspan="3" scope="col">Cervix</th>
                <th colspan="3" scope="col" class="bg-grey bg-font-grey">OVARY Lt</th>
                <th colspan="3" scope="col">OVARY Rt</th>
                <th colspan="4" scope="col" class="bg-grey bg-font-grey">LTovary</th>
                <th colspan="4" scope="col">Rtovary</th>
                <th rowspan="2" scope="col">{if $programSetting->displaydoctorname eq 1}Doctor{/if}</th>
            </tr>
            <tr>
                <td class="bg-grey bg-font-grey">l</td>
                <td class="bg-grey bg-font-grey">w</td>
                <td class="bg-grey bg-font-grey">v</td>
                <td>l</td>
                <td>w</td>
                <td>v</td>
                <td class="bg-grey bg-font-grey">l</td>
                <td class="bg-grey bg-font-grey">w</td>
                <td class="bg-grey bg-font-grey">v</td>
                <td>l</td>
                <td>w</td>
                <td>v</td>
                <td class="bg-grey bg-font-grey">name</td>
                <td class="bg-grey bg-font-grey">Length</td>
                <td class="bg-grey bg-font-grey">Width</td>
                <td class="bg-grey bg-font-grey">Volume</td>
                <td>Name</td>
                <td>Length</td>
                <td>Width</td>
                <td>Volume</td>
            </tr>
        </thead>
        {foreach $allgynaUS  as $us }
        <tr class="odd gradeXH">
            <td>{$us->date}</td>
            <td>{$us->day}</td>
            <td>{$us->endo}</td>
            <td>{$us->uterusl}</td>
            <td>{$us->uterusw}</td>
            <td>{$us->uterusv}</td>
            <td>{$us->cervixl}</td>
            <td>{$us->cervixw}</td>
            <td>{$us->cervixv}</td>
            <td>{$us->ovrayll}</td>
            <td>{$us->ovraylw}</td>
            <td>{$us->ovraylv}</td>
            <td>{$us->ovrayrl}</td>
            <td>{$us->ovrayrw}</td>
            <td>{$us->ovraylv}</td>
            <td colspan='4' style=" padding: 0; ">
                <table width="100%" class="table  table-bordered table-hover nopdngtbl">
                    {foreach $us->focilsl as $fo}
                    <tr>
                        <td style=" width: 54px; ">{$fo->name}</td>
                        <td style=" width: 63px; ">{$fo->length}</td>
                        <td style=" width: 56px; ">{$fo->width}</td>
                        <td>{$fo->volume}</td>
                    </tr>
                    {/foreach}
                </table>
            </td>

            <td colspan='4' style=" padding: 0; ">
                <table width="100%" class="table  table-bordered table-hover nopdngtbl">
                    {foreach $us->focilsr as $fo}
                    <tr>
                        <td>{$fo->name}</td>
                        <td>{$fo->length}</td>
                        <td>{$fo->width}</td>
                        <td>{$fo->volume}</td>
                    </tr>
                    {/foreach}
                </table>
            </td>
            <td>{if $programSetting->displaydoctorname eq 1} {$us->doctorname}{/if}</td>
        </tr>
        {/foreach}
    </table>
    {/if}
    {/if}
    <!----########################################################################================Investigation=======================############################################################################################-->
    {if !empty($idates)}
    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px;">
        <thead>
            <tr>
                <th colspan="12" class="bg-grey-gallery bg-font-grey-gallery">
                    investigation
                </th>
            </tr>
            <tr>
                <th></th>
                <th>Wife</th>
                <th>Husband</th>
            </tr>

        </thead>
        {foreach $idates as $inv}
        <tr class="odd gradeXH">
            <td>{$inv.date}</td>
            <td>
                {foreach $inv.investsw as $invest}
                <b>{$invest->invname}: </b>{if !empty($invest->investresult)} {$invest->investresult} {else} --- {/if},
                {/foreach}
            </td>
            <td>
                {foreach $inv.investsh as $invest}
                <b>{$invest->invname}: </b>{if !empty($invest->investresult)} {$invest->investresult} {else} --- {/if},
                {/foreach}
            </td>
        </tr>
        {/foreach}
    </table>
    {/if}

    <!----#######################################################------------------TREATMRNT---------------------------#############################################################################################################-->
    {if !empty($dates)}

    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px;">
        <thead>
            <tr>
                <th colspan="12" class="bg-grey-gallery bg-font-grey-gallery">
                    Treatment
                </th>
            </tr>
            <tr>
                <th></th>
                <th>Wife</th>
                <th>Husband</th>
            </tr>

        </thead>
        <tbody>
            {foreach  $dates as $date}
            <tr class="odd gradeXH">
                <td>
                    {$date["date"]}
                </td>
                <td>
                    {if !empty($date["drugdos"])} {$date["drugdos"]} {/if}
                </td>
                <td>
                    {if !empty($date["drugtype"])} {$date["drugtype"]} {/if}
                </td>
            </tr>

            {/foreach}
        </tbody>
    </table>


    {/if}
    <!----###################################################################----ANTENATAL VISITS----------#################################################################################################-->
    {if !empty($allObj)}
    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px;">
        <thead>
            <tr>
                <th colspan="12" class="bg-grey-gallery bg-font-grey-gallery">
                    Antenatal Visits
                </th>
            </tr>

        </thead>
    </table>

    {assign var = h value = 1}
    {foreach $allObj as $mainObj}
    {if !empty($mainObj->antvisit) || !empty($mainObj->ttt) || !empty($mainObj->Us) || !empty($mainObj->lab)}
    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px; border: 2px solid #000000;">
        <thead>
            <tr>
                <th colspan="12" class="bg-grey-gallery bg-font-grey-gallery">
                    Pregnancy No. {$h}
                </th>
            </tr>                      
        </thead>
        <tbody>
            <tr>
                <td>
                    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px;">
                        <tr>
                            <th class="wds9">LMP</th>
                            <th class="wds9">EDD</th>
                            <th class="wds9">Hb</th>
                            <th>Notes</th>
                        </tr>
                        <tr>
                            <td>{$mainObj.lmp}</td>
                            <td>{$mainObj.eed}</td>
                            <td>{$mainObj.hb}</td>
                            <td>{$mainObj.notes}</td>
                        </tr>
                    </table>

                    {if !empty($mainObj->antvisit)}
                    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px;border: 2px solid #000000;">
                        <tr>
                            <th>Date</th>
                            <th>W</th>
                            <th>Complaint</th>
                            {if $ProgramesettingData->diagnosshow == 0}
                            <th>Diagnosis</th>
                            {/if}
                            <th>Wt</th>
                            <th>Bp</th>
                            <th>Pulse</th>
                            <th>Notes</th>
                            {if $programSetting->displaydoctorname eq 1}<th>Doctor</th>{/if}
                        </tr>
                        {foreach $mainObj->antvisit as $myObject}
                        <!-----------------������ ����� ��� ���------------------------->

                        <tr class="odd gradeXH">
                            <td>{$myObject.antenaldate}</td>
                            <td>{$myObject.w}</td>
                            {if $ProgramesettingData->diagnosshow == 0}
                            <td>{$myObject.complaintid}</td>
                            {else}
                            <td>{$myObject.complaint}</td>
                            {/if}
                            {if $ProgramesettingData->diagnosshow == 0}
                            <td>{$myObject.diagnosisid}</td>
                            {/if}
                            <td>{$myObject.wt}</td>
                            <td><input type="text" class="bp_mask" value="{$myObject.bp}" disabled style="border: none;background: inherit ;width: 50px;"/></td>
                            <td>{$myObject.pulse}</td>
                            <td>{$myObject.notes}</td>
                            {if $programSetting->displaydoctorname eq 1}   <td>{$myObject.doctorname}</td> {/if}
                        </tr>
                        {/foreach}
                    </table>
                    {/if}

                    <!------------------------------ANTENATAL TTT---------------------------------------------->
                    {if !empty($mainObj->ttt)}
                    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px;border: 2px solid #000000;">
                        <tr>
                            <th colspan="6">TTT</th>
                        </tr>
                        <tr>
                            <th></th>
                            <th>Wife</th>
                            <th>Husband</th>
                        </tr>

                        {foreach  $mainObj->ttt as $date}
                        <tr class="odd gradeXH">
                            <td>
                                {$date["date"]}
                            </td>
                            <td>
                                {if !empty($date["drugdos"])}{$date["drugdos"]} {/if}
                            </td>
                            <td>
                                {if !empty($date["drugtype"])}{$date["drugtype"]} {/if}
                            </td>

                        </tr>
                        {/foreach}
                    </table>
                    {/if}
                    <!------------------------------ANTENATAL US---------------------------------------------->
                    {if !empty($mainObj->Us)}

                    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px;border: 2px solid #000000;">
                        <tr>
                            <th colspan="12">US</th>
                        </tr>
                        <tr>
                            <th>Sex</th>
                            <td colspan="11">{$mainObj->sex}</td>
                        </tr>
                        <tr>
                            <th>Date</th>
                            <th>W</th>
                            <th>Notes</th>
                            <th>Placenta</th>
                            <th>AI</th>
                            <th>FWT</th>
                            {if $programSetting->displaydoctorname eq 1} <th> Doctor </th>{/if}
                        </tr>
                        {assign var=i value=1}
                        {foreach $mainObj->Us  as $aUs }
                        <tr class="odd gradeXH">
                            <td>{$aUs.date}</td>
                            <td>{$aUs.w}</td>
                            <td>{$aUs.notes}</td>
                            <td>{$aUs.placenta}</td>
                            <td>{$aUs.ai}</td>
                            <td>{$aUs.fwt}</td>
                            {if $programSetting->displaydoctorname eq 1}   <td>{$aUs.doctorname}</td> {/if}
                        </tr>
                        {capture assign=i}{$i+1}{/capture}
                        {/foreach}
                    </table>
                    {/if}
                    <!------------------------------ANTENATAL LAB---------------------------------------------->
                    {if !empty($mainObj->lab)}
                    <table class="table  table-bordered table-hover" style="margin-bottom: 0px; margin-top: 10px;border: 2px solid #000000;">
                        <tr>
                            <th colspan="3">Lab</th>
                        </tr>
                        <tr>
                            <th></th>
                            <th>Wife</th>
                            <th>Husband</th>
                        </tr>
                        {foreach $mainObj->lab as $inv}
                        <tr class="odd gradeXH">
                            <td>{$inv.date}</td>
                            <td>

                                {foreach $inv.investsw as $invest}
                                <b>  {$invest->invname}: </b>{if !empty({$invest->investresult})}{$invest->investresult}{else} --- {/if} ,
                                {/foreach}
                            </td>
                            <td>

                                {foreach $inv.investsh as $invest}
                                <b>  {$invest->invname}: </b>{if !empty({$invest->investresult})}{$invest->investresult}{else} --- {/if} ,
                                {/foreach}
                            </td>
                        </tr>
                        {assign var = i value = i+1}
                        {/foreach}


                    </table>
                    {/if}
                </td>
            </tr>
        </tbody>
    </table>
    {/if}
    {assign var = h value = $h+1}
    {/foreach}


    {/if}
    <!----####################################################################################################################################################################-->








    <div class="form-group form-md-line-input has-info" style="padding-top: 0px !important;" id="notDiv">
        <label class="col-md-1 control-label" for="form_control_1" style="font-weight: bold;">Notes</label>
        <div class="col-md-10">
            <textarea class="form-control save_complete_report_notes" rows="3" placeholder="Enter more text" id="reportNote">{$patientdata.report_note}</textarea>
            <div class="form-control-focus">
            </div>
        </div>
        <br /><br />
    </div>
    <br /><br />
    <div class="clearfix"></div>
</div>