{if $reportType == "drug"}
{if $storeDrugscount > 0 }
{assign var=i value=1}
{foreach $storeDrugs as $data1}
{foreach $data1->storedrugsvalidation as $data}
<tr>
    <td>
        {$i}
    </td>
    <td>
        {$data1->storeName}
    </td>
    <td>
        {$data->validateto}
    </td>
    <td>
        {$data->currentbalance}
    </td>
</tr>
{capture assign=i}{$i+1}{/capture}
{/foreach}
{/foreach}

{else}
<tr>
    <td colspan="4">
        No data found ...........
    </td>
</tr>
{/if}
{/if}

<!-------------------------------------------------------------------------------------------------------------->

{if $reportType == "import"}
{if $importdrugscount > 0 }
{assign var=i value=1}
{foreach $importdrugs as $data}
<tr>
    <td>
        {$i}
    </td>
    <td>
        {$data.invoicedate}
    </td>
    <td>
        {$data.invoicenum}
    </td>
    <td>
        {$data.name}
    </td>
    <td>
        {$data.drugname}
    </td>
    <td>
        {$data.drugtype}
    </td>
    <td>
        {$data.validto}
    </td>
    <td>
        {$data.amount}
    </td>
</tr>
{capture assign=i}{$i+1}{/capture}
{/foreach}

{else}
<tr>
    <td colspan="7">
        No data found ...........
    </td>
</tr>
{/if}
{/if}

<!-------------------------------------------------------------------------------------------------------------->

{if $reportType == "minimum"}
{if $storedrugscount > 0 }
{assign var=i value=1}
{foreach $storedrugsDis as $data}

{if $data.show == 1 }
<tr>
    <td>
        {$i}
    </td>
    <td>
        {$data.name}
    </td>
    <td>
        {$data.drugname}
    </td>
    <td>
        {$data.drugtype}
    </td>
    <td>
        {$data.amount}
    </td>
</tr>
{capture assign=i}{$i+1}{/capture}
{/if}
{/foreach}

{else}
<tr>
    <td colspan="5">
        No data found ...........
    </td>
</tr>
{/if}
{/if}


<!-------------------------------------------------------------------------------------------------------------->

{if $reportType == "external"}
{if $rescount > 0 }
{assign var=i value=1}
{foreach $res as $data}
{foreach $data.res as $data1}
<tr>
    <td>
        {$i}
    </td>
    <td>
        {$data.patientname}
    </td>
    <td>
        {$data1.drugname}
    </td>
    <td>
        {$data1.drugtype}
    </td>
    <td>
        {$data1.amountcached}
    </td>
    <td>
        {$data.doctorname}
    </td>
</tr>

{capture assign=i}{$i+1}{/capture}
{/foreach}
{/foreach}
{else}
<tr>
    <td colspan="6">
        No data found ...........
    </td>
</tr>
{/if}
{/if}

<!-------------------------------------------------------------------------------------------------------------->

{if $reportType == "validation"}
{if $rescount > 0 }
{assign var=i value=1}
{foreach $res as $data}

<tr>
    <td>
        {$i}
    </td>
    <td>
        {$data.name}
    </td>
    <td>
        {$data.drugname}
    </td>
    <td>
        {$data.drugtype}
    </td>
    <td>
        {$data.validateto}
    </td>
    <td>
        {$data.currentbalance}
    </td>
</tr>
{capture assign=i}{$i+1}{/capture}
{/foreach}

{else}
<tr>
    <td colspan="5">
        No data found ...........
    </td>
</tr>
{/if}
{/if}

<!-------------------------------------------------------------------------------------------------------------->

{if $reportType == "internal"}
{if $rescount > 0 }
{assign var=i value=1}
{foreach $res as $data}
{foreach $data.res as $data1}
<tr>
    <td>
        {$i}
    </td>
    <td>
        {$data.patientname}
    </td>
    <td>
        {$data1.drugname}
    </td>
    <td>
        {$data1.drugtype}
    </td>
    <td>
        {$data1.amountcached}
    </td>
    <td>
        {$data.doctorname}
    </td>
</tr>

{capture assign=i}{$i+1}{/capture}
{/foreach}
{/foreach}
{else}
<tr>
    <td colspan="6">
        No data found ...........
    </td>
</tr>
{/if}
{/if}




<!-------------------------------------------------------------------------------------------------------------->

{if $reportType == "doctor"}

{if $is_all == 0}


<thead>
<tr>
    <th width="20%">drug name <br/> doctor name</th>
    {foreach $medicine_result as $one_med}
    {if $one_med.drugname != ''}
    <th class="rotate">
        <div><span>{$one_med.drugname}</span></div>
    </th>
    {/if}
    {/foreach}
</tr>
</thead>
<tbody >

{foreach $doctor_res_array as $one_doc}
{if $one_doc.doctor_name != ''}
<tr>
<th style="white-space: nowrap;">
    {$one_doc.doctor_name}
</th>
    {foreach $one_doc.drugs as $one_med}
    {if $one_med.drugname != ''}
    <th>
        {$one_med.drugSum}
    </th>
    {/if}
    {/foreach}

</tr>
{/if}
{/foreach}

{if $doctor_res_array|@count <= 0}
<tr>
    <th>
        لا يوجد نتائج
    </th>
</tr>
{/if}

</tbody>



{else}


{if $rescount > 0 }
{assign var=i value=1}
{foreach $res as $data}

<tr>
    <td>
        {$i}
    </td>
    <td>
        {$data.drugname}
    </td>
    <td>
        {$data.drugtype}
    </td>
    <td>
        {$data.drugSum}
    </td>
</tr>
{capture assign=i}{$i+1}{/capture}
{/foreach}

{else}
<tr>
    <td colspan="6">
        No data found ...........
    </td>
</tr>
{/if}


{/if}

{/if}


{literal}
<style>
    th.rotate {
        /* Something you can count on */
        height: 140px;
        white-space: nowrap;
        border-right: 1px solid #ccc !important;
    }

    th.rotate > div {
        transform:
            /* Magic Numbers */
                translate(0px, 0px)
                    /* 45 is really 360 - 45 */
                rotate(270deg);
        width: 43px;
    }
    th.rotate > div > span {
        border-bottom: 1px solid #ccc;
        padding: 15px 12px;
    }
</style>
{/literal}

