<table class="table table-striped table-hover table-bordered">
    <thead>
        <tr>
            <th> # </th>
            <th> Duration</th>
            <th> Termination</th>
            <th> Place </th>
            <th> Date</th>
            <th> Type</th>
            <th> OutCome </th>
            <th> Gender</th>
            <th> Baby Weight</th>
            <th> Baby Name </th>
            <th> Notes </th>
        </tr>
    </thead>
    <tbody>
        {assign var=i value=1}
        {foreach $allobsteric as $data}
        {if $data->obstermination == 1    || $data->obstermination == 2}
                    <tr>
                        <td  {if $data->outcomeid eq 2}rowspan="2" {elseif $data->outcomeid eq 3} rowspan="3" {/if} > {$i} </td>

                        <td  {if $data->outcomeid eq 2}rowspan="2" {elseif $data->outcomeid eq 3} rowspan="3" {/if} >{$data->obstrduration}</td>

                        <td  {if $data->outcomeid eq 2}rowspan="2" {elseif $data->outcomeid eq 3} rowspan="3" {/if} >{if !empty($data->terminatename)}{$data->terminatename}{/if}</td>

                        <td  {if $data->outcomeid eq 2}rowspan="2" {elseif $data->outcomeid eq 3} rowspan="3" {/if} >{if !empty($data->placename)}{$data->placename}{/if}</td>

                        <td  {if $data->outcomeid eq 2}rowspan="2" {elseif $data->outcomeid eq 3} rowspan="3" {/if} >{$data->obsdate}</td>


                        <td  {if $data->outcomeid eq 2}rowspan="2" {elseif $data->outcomeid eq 3} rowspan="3" {/if} >
                            {if $data->outcomeid eq 0}Male {/if}
                            {if $data->outcomeid eq 1}Female {/if}
                            {if $data->outcomeid eq 2}Twins {/if}
                            {if $data->outcomeid eq 3}Triplets {/if}
                        </td>
                        <td>
                            {if {$data->babytype} eq 0}Living {/if}
                            {if {$data->babytype} eq 1}Dead {/if}
                        </td>
                        <td>
                            {if {$data->babygendernew} eq 0}M {/if}
                            {if {$data->babygendernew} eq 1}F {/if}
                        </td>
                        <td>{$data->babyweight}</td>
                        <td>{$data->babyname}</td>
                        <td {if $data->outcomeid eq 2}rowspan="2"{elseif $data->outcomeid eq 3}rowspan="3"{/if}>{$data->obsnote}</td>

                    </tr>
                    {if $data->outcomeid eq 2 || $data->outcomeid eq 3}
                    <tr>
                        <td>
                            {if {$data->babytype1} eq 0}Living {/if}
                            {if {$data->babytype1} eq 1}Dead {/if}
                        </td>
                        <td>
                            {if {$data->babygendernew1} eq 0}M {/if}
                            {if {$data->babygendernew1} eq 1}F {/if}
                        </td>
                        <td>{$data->babyweight1}</td>
                        <td>{$data->babyname1}</td>
                    </tr>
                    {/if}
                    {if $data->outcomeid eq 3}
                    <tr>
                        <td>
                            {if {$data->babytype2} eq 0}Living {/if}
                            {if {$data->babytype2} eq 1}Dead {/if}
                        </td>
                        <td>
                            {if {$data->babygendernew2} eq 0}M {/if}
                            {if {$data->babygendernew2} eq 1}F {/if}
                        </td>
                        <td>{$data->babyweight2}</td>
                        <td>{$data->babyname2}</td>
                    </tr>
                    {/if}
        {else}
        <tr>
                        <td> {$i} </td>

                        <td>{if !empty($data->obstrduration)}{$data->obstrduration}{/if}</td>

                        <td>{if !empty($data->terminatename)}{$data->terminatename}{/if}</td>

                        <td>{if !empty($data->placename)}{$data->placename}{/if}</td>

                        <td>{if !empty($data->obsdate)}{$data->obsdate}{/if}</td>


                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td>{$data->obsnote}</td>

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