<div id="prind" class="prntbl2">
    {literal}
    <style>


        .prntbl2 {
            padding:0px !important;
            width:95% !important;
            margin:0px auto !important;
        }.prntbl2 table{
            border-collapse: collapse !important;
            width:100% !important;
            margin:0px !important;
            padding:0px !important;
        }
        .prntbl2 table th {
            background-color: #2D2D2D !important;
            background: #2D2D2D !important;
            border:0px solid #000000 !important;
            border-width:0px 0px 1px 1px !important;
            font-size:15px !important;
            font-family:Arial !important;
            font-weight:bold !important;
            color: #FFFFFF !important;
            text-align: center !important;
        }.prntbl2 tr:hover td{

        }
        .prntbl2 tr:nth-child(odd){background-color: #E0E0E0 !important;}
        .prntbl2 tr:nth-child(even)    { background-color:#ffffff !important; }
        .prntbl2 td{
            border:1px solid #000000 !important;
            padding: 0px 3px !important;
            font-size: 13px !important;
            font-family: tahoma !important;
            color:#000000 !important;
            text-align: left !important;
        }


        .prntbl2 th, .prntbl2 tt, .prntbl2 td {
            line-height: 20px !important;
            padding: 1px 5px !important;


        }

        .prntbl2 span {
            font-weight: 700;
        }

    </style>

    {/literal}
    <div class="clearfix"></div>
    <!----#########################################---------HISTORY------------############################################################################################---->
    <div >
        <div>
            <table style="direction: rtl;margin: 5px 0px;"  border="1">
                <tr>
                    <td >{if !empty($patientdata.wifetype)}{$patientdata.wifetype} {/if}/ {$patientdata.wifename}</td>
                    <td >{if $new_dateofbirth_calc != ''} {$new_dateofbirth_calc} سنة {/if}  </td>
                    <td >{if !empty($patientdata.wifejob)}{$patientdata.wifejob}{/if}</td>
                    <td >{$patientdata.address}</td>
                    <td>رقم المريضة : {$patientdata.statusno}</td>
                </tr>
                <tr>
                    {if $patientdata.statuesid != 1}
                    {if $patientdata.mirragefromdate }
                    <td >متزوجة منذ :{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 >متزوجة منذ :</td>

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

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

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



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

        <div >
            <div style="padding-right: 0px; padding-left: 0px;">

                <div>

                    {if $phmenstrualcount > 0}
                    <table border="1">
                        <tr >

                            <td>
                                Menstrual H
                            </td>

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

                            {if $phregualrity}<td> {$phregualrity->name}</td>{/if}

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

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

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

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

                            {if $phregualrity} <td> {$phregualrity->name}</td> {/if}

                            {if $phamount} <td> {$phamount->name}</td> {/if}

                            {if $phdysmenorrhoea} <td> {$phdysmenorrhoea->name}</td> {/if}

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

                            {/if}

                            {else}
                            <td>
                                <label>data is empty</label>
                            </td>
                            {/if}
                        </tr>
                    </table>
                    {/if}

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

                    <table border="1">

                        <tr >

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

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

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

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

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


                            {else}
                            <td>
                                <label>data is empty</label>
                            </td>
                            {/if}
                        </tr>

                    </table>
                    {/if}



                    <!-- ========================================================Obstetric H================================================================-->
                    {if $myallobsteric > 0}
                    <table border="1">
                        <tr>

                            <td>
                                Obstetric H
                            </td>



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

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

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

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

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

                        </tr>


                    </table>
                    {/if}







                    <!-- ========================================================Past Medical H================================================================-->
                    <table border="1">
                        {if $allpastmedicalcount > 0}
                        <tr>

                            <td>
                                Past Medical H
                            </td>

                            <td>
                                <label style="color:  #3598DC;"> Disease : </label>
                                {assign var=i value=1}
                                {foreach $allpastmedical 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 $allpastsurgicalcount > 0}
                        <tr>

                            <td>
                                Past Surgical H
                            </td>

                            <td>

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

                                {assign var=i value=1}
                                {foreach $allpastsurgical 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>

                            <td>
                                Past Gynecological
                            </td>

                            <td>

                                <label 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>

                            <td>
                                Past ART
                            </td>

                            <td>

                                <label 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}

                        <!-- ========================================================Family H================================================================-->
                        {if $allphfamilycount > 0}
                        <tr>

                            <td>
                                Family H
                            </td>




                            <td>

                                <label 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 style="margin-bottom: 0px; margin-top: 10px;" border="1">
        <thead>
            <tr>
                <th colspan="12">
                    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>
                <td>{$myallexmination.examinationdate}</td>
                <td>{$myallexmination.weight}</td>
                <td>{$myallexmination.height}</td>
                <td>{$myallexmination.bmi}</td>
                <td><input type="text" 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 style="margin-bottom: 0px; margin-top: 10px;" border="1">
        <thead>
            <tr>
                <th colspan="12">
                    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>
                <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>{if !empty($semen.normaltype)}   Normal {/if}</label></td>
                <td><label> {if !empty($semen.oligo)}    Oligo sprerm{/if}</label></td>
                <td><label> {if !empty($semen.astheno)}   Astheno sperm{/if}</label></td>
                <td><label>{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 style="margin-bottom: 0px; margin-top: 10px;" border="1">
        <thead>
            <tr>
                <th colspan="12">
                    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>
                <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 style="margin-bottom: 0px; margin-top: 10px;" border="1">
        <thead>
            <tr>
                <th colspan="12">
                    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>
                <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 style="margin-bottom: 0px; margin-top: 10px;" border="1">
        <thead>
            <tr>
                <th colspan="12">
                    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>
                <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 style="margin-bottom: 0px; margin-top: 10px;" border="1">
        <thead>
            <tr>
                <th colspan="12">
                    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>
                <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 style="margin-bottom: 0px; margin-top: 10px;" border="1">
        <thead>
            <tr>
                <th colspan="12">
                    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>
                <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 style="margin-bottom: 0px; margin-top: 10px;" border="1">
        <thead>
            <tr>
                <th colspan="20">
                    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 0}<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 0}   <td></td> {/if}
            </tr>
        </thead>
        <tbody>
            {foreach $allhormon as $hormon}
            <tr>
                <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 0}   <td>{$hormon.docname}</td> {/if}
            </tr>
            {/foreach}
        </tbody>
    </table>

    {/if}



    <!----#############################################################---------PATHOLOGY-------#######################################################################################################-->
    {if !empty($allpathology)}
    <table style="margin-bottom: 0px; margin-top: 10px;" border="1">
        <thead>
            <tr>
                <th colspan="12">
                    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>
                <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)}
    <table style="margin-bottom: 0px; margin-top: 10px;" border="1">
        <thead>
            <tr>
                <th colspan="12">
                    Gyna Visits
                </th>
            </tr>
            <tr>
                <th>Date</th>
                <th>Complaint</th>
                <th>Diagnosis</th>
                <th>Notes</th>
                {if $programSetting->displaydoctorname eq 1}<th>Doctor</th>{/if}
            </tr>
        </thead>
        <tbody>
            {foreach $allgyna as $gyna_obj}
            <tr>
                <td>{$gyna_obj.gynadate}</td>
                <td>{$gyna_obj.complaint}</td>

                <td>{$gyna_obj.diagnosistxt}</td>


                <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)}
    <table style="margin-bottom: 0px; margin-top: 10px;" border="1">
        <thead>
            <tr>
                <th colspan="25">
                    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">Uterus</th>
                <th colspan="3" scope="col">Cervix</th>
                <th colspan="3" scope="col">OVARY Lt</th>
                <th colspan="3" scope="col">OVARY Rt</th>
                <th colspan="4" scope="col">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>l</td>
                <td>w</td>
                <td>v</td>
                <td>l</td>
                <td>w</td>
                <td>v</td>
                <td>l</td>
                <td>w</td>
                <td>v</td>
                <td>l</td>
                <td>w</td>
                <td>v</td>
                <td>name</td>
                <td>Length</td>
                <td>Width</td>
                <td>Volume</td>
                <td>Name</td>
                <td>Length</td>
                <td>Width</td>
                <td>Volume</td>
            </tr>
        </thead>
        {foreach $allgynaUS  as $us }
        <tr>
            <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%">
                    {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%">
                    {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}
    <!----########################################################################================Investigation=======================############################################################################################-->
    {if !empty($idates)}
    <table style="margin-bottom: 0px; margin-top: 10px;" border="1">
        <thead>
            <tr>
                <th colspan="12">
                    investigation
                </th>
            </tr>
            <tr>
                <th></th>
                <th>Wife</th>
                <th>Husband</th>
            </tr>

        </thead>
        {foreach $idates as $inv}
        <tr>
            <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 style="margin-bottom: 0px; margin-top: 10px;" border="1">
        <thead>
            <tr>
                <th colspan="12">
                    Treatment
                </th>
            </tr>
            <tr>
                <th></th>
                <th>Wife</th>
                <th>Husband</th>
            </tr>

        </thead>
        <tbody>
            {foreach  $dates as $date}
            <tr>
                <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 style="margin-bottom: 0px; margin-top: 10px;" border="1">
        <thead>
            <tr>
                <th colspan="12">
                    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 style="margin-bottom: 0px; margin-top: 10px;" border="1">
        <thead>
            <tr>
                <th colspan="12">
                    Pregnancy No. {$h}
                </th>
            </tr>
        </thead>
        <tbody>

            {if !empty($mainObj->antvisit)}
        <table style="margin-bottom: 0px; margin-top: 10px;">
            <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>Notes</th>
                {if $programSetting->displaydoctorname eq 1}<th>Doctor</th>{/if}
            </tr>
            {foreach $mainObj->antvisit as $myObject}
            <!-----------------������ ����� ��� ���------------------------->

            <tr>
                <td>{$myObject.antenaldate}</td>
                <td>{$myObject.w}</td>
                <td>{$myObject.complaint}</td>
                {if $ProgramesettingData->diagnosshow == 0}
                <td>{$myObject.diagnosisid}</td>
                {/if}
                <td>{$myObject.wt}</td>
                <td>{$myObject.bp}</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 style="margin-bottom: 0px; margin-top: 10px;">
            <tr>
                <th colspan="6">TTT</th>
            </tr>
            <tr>
                <th></th>
                <th>Wife</th>
                <th>Husband</th>
            </tr>

            {foreach  $mainObj->ttt as $date}
            <tr>
                <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 style="margin-bottom: 0px; margin-top: 10px;" border="1">
            <tr>
                <th colspan="12">US</th>
            </tr>
            <tr>
                <th>Date</th>
                <th>N(GA)</th>
                <th>GS</th>
                <th>CRL</th>
                <th>FHR</th>
                <th>BPD</th>
                <th>FL</th>
                <th>Placenta</th>
                <th>AI</th>
                <th>FWT</th>
                <th>Notes</th>
                <th>{if $programSetting->displaydoctorname eq 1}Doctor{/if}</th>
            </tr>
            {assign var=i value=1}
            {foreach $mainObj->Us  as $aUs }
            <tr>
                <td>{$aUs.date}</td>
                <td>{$aUs.nga}</td>
                <td>{$aUs.gs}</td>
                <td>{$aUs.crl}</td>
                <td>{$aUs.fhr}</td>
                <td>{$aUs.bpd}</td>
                <td>{$aUs.fl}</td>
                <td>{$aUs.placenta}</td>
                <td>{$aUs.ai}</td>
                <td>{$aUs.fwt}</td>
                <td>{$aUs.notes}</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 style="margin-bottom: 0px; margin-top: 10px;" border="1">
            <tr>
                <th colspan="3">Lab</th>
            </tr>
            <tr>
                <th></th>
                <th>Wife</th>
                <th>Husband</th>
            </tr>
            {foreach $mainObj->lab as $inv}
            <tr>
                <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}

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


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






    <!--

        <div style="padding-top: 0px !important;" id="pnotDiv">
            <label style="font-weight: bold;">Notes</label>
            <div>
                <textarea rows="3" placeholder="Enter more text" id="preportNote"></textarea>
                <div></div>
            </div>
            <br /><br />
        </div>
        <br /><br />-->

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

</div>
