text/x-generic inv_transfer_direct_excel.php ( HTML document, ASCII text )
<html>

<head>
    <title>title</title>
    <style>
        table,
        th,
        td {
            border: 1px solid black;
        }
    </style>

</head>

<body>
    <div class="col-12">

        <table class="table" style="width:100%">
            <tr>
                <th colspan="2">Direct Transfer</th>
            </tr>
            <tr>

                <?php $model = InventoryDirectTransfer::model()->findByPk($id); ?>

                <td class="bc-tl">Transfer No</td>
                <td>
                    <?php echo $model->id; ?>
                </td>
            </tr>
            <tr>
                <td>Date</td>
                <td>
                    <?php echo date('d/m/Y', STRTOTIME($model->transfer_date)); ?>
                </td>
            </tr>
            <tr>
                <td>From</td>
                <td>
                    <?php echo $model->warehouseFrom->warehouse_name; ?>
                </td>
            </tr>
            <tr>
                <td>To</td>
                <td>
                    <?php echo $model->warehouseTo->warehouse_name; ?>
                </td>
            </tr>
        </table>
    </div>
    </div>

    <br>
    <table style="width:100%">
        <thead>

            <tr>
               <th class="text-center bc-tl">No</th>
                    <th class="text-center">Product</th>
                    <th class="text-center" style="width:40%">Description</th>
                    <th class="text-center" style="width:15%">Transferred Qty</th>
                    <th class="text-center" style="width:10%">Sample Qty</th>
                      <th class="text-center" style="width:15%">Total Qty</th>
                    <th class="text-center" style="width:8%">Unit</th>

            </tr>
        </thead>
        <tbody>

            <?php
                $total_sample_qty = $total_qty =$total_transfer= 0;

            $m = 1;
            $condition .= '1=1';
            $condition .= ' AND t.direct_transfer_id ="' . $id . '"';
            $model_Items = InventoryDirectTransferItem::model()->findAll(array('condition' => $condition));
            foreach ($model_Items as $i =>  $each_Item) {

            ?>
                  <tr>
                        <td>
                            <?php echo $m; ?>
                        </td>
                        <td>
                            <?php echo $each_Item->item_name; ?>
                        </td>
                        <td>
                            <?php echo $each_Item->item_description; ?>
                        </td>

                       <td class="text-right">
                            <?php 
                           $total_transffered =  $each_Item->transfer_qty-$each_Item->sample_qty;
                            echo Yii::app()->numberFormatter->formatCurrency($total_transffered, " ");
                            $total_transfer += $total_transffered;
                            ?>
                        </td>

                        <td class="text-right">
                            <?php echo Yii::app()->numberFormatter->formatCurrency($each_Item->sample_qty, " ");
                            $total_sample_qty += $each_Item->sample_qty;
                            ?>
                        </td>
                        
                         <td class="text-right">
                            <?php echo Yii::app()->numberFormatter->formatCurrency($each_Item->transfer_qty, " ");
                            $total_qty += $each_Item->transfer_qty;
                            ?>
                        </td>
                        <td class="text-right">
                            <?php echo $each_Item->unitdetails->name; ?>
                        </td>


                    </tr>
            <?php $m++;
            }
            ?>
            <tr>
                <td colspan="3">Total </td>
                    <td class="text-right"><b> <?php echo Yii::app()->numberFormatter->formatCurrency($total_transfer, " ");     ?></b> </td>

                    <td class="text-right"><b> <?php echo Yii::app()->numberFormatter->formatCurrency($total_sample_qty, " ");     ?></b> </td>
                    <td class="text-right"><b> <?php echo Yii::app()->numberFormatter->formatCurrency($total_qty, " ");     ?></b> </td>

                    <td class="text-right"></td>

            </tr>


        </tbody>
    </table>

    <br />



    </table>
</body>

</html>