<?php
$CI = & get_instance();
$CI->load->model('company/company_info_model');
$company = $CI->company_info_model->companyById(element('compID', $this->session->userdata('logged_in')));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
        <link  rel="stylesheet" type="text/css"  href="<?php echo base_url() ?>css/bootstrap/bootstrap.min.css" />
        <?php echo put_headers(); ?>
        <style>
            @media print {
                // @charset "UTF-8";

                .tdPrint{
                    display:none;}
                .printTbl hr{
                    margin:0 !important;
                }
                .thPrint th{
                    background:url(<?php echo base_url() ?>img/rptPaymentAdvice.png) !important;
                    -webkit-print-color-adjust: exact; 
                }
            }
        </style>

        <script>
            $(document).ready(function() {
                $('.image').height($('.thPrint').height());
                $('.image').width($('.thPrint').width());
            });

            function do_print() {
                window.print();
            }

//             function getExcelFile() {
            var url = '<?php echo base_url();
        echo isset($myUrl) ? $myUrl : '';
        echo '/';
        echo isset($id) ? $id : ''; ?>"';
            //var url = "<?php echo base_url() ?>ApTransactionReport/printPaymentAdviceRptExel/<?php echo isset($id) ? $id : ''; ?>";
//                         window.location.href = url;
//                     }
            function downloadExcel() {
                var url = "<?php echo "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '/' . true; ?>";
                window.location.href = url;
            }
        </script>

    </head>

    <body>
        <table  style="width:70%; margin-top:20px; margin:auto;" class="printTbl">
            <tbody>
                <tr>
                    <td colspan="2" >
                        <p style="text-align: right; margin:0; padding-right: 10px; font-weight: 500; line-height: 2; padding-bottom: 0px; padding-top: 0px; color: black; font-size: 25px;">
                        <?php if (isset($rptTitle)) echo $rptTitle; ?>
                        </p>
                        <?php
                        if (isset($company)) {
                            foreach ($company as $rowC) {
                                ?>
                                <p style="text-align:center; font-size:16px;"> 
                                    <span style=" font-weight:800;"><?php echo $rowC->companyName; ?></span> <span style="font-size:14px;"><?php echo "(" . $rowC->companyNo . ")"; ?></span><br />
                                    <span style="font-size:10px;"><?php echo "GST Registration No : " . $rowC->gstRegisteredNo; ?></span><br />
                                </p>
                                <p style="text-align:center; font-size:10px; line-height:1.4; padding:0 0 5px; margin:0; border-bottom:1px solid #eeeeee;">

                                    <span><?php echo $rowC->line1; ?></span><br />
                                    <span><?php echo $rowC->line2; ?></span><br />
                                    <span><?php echo $rowC->line3; ?></span><br />
                                    <span><?php echo $rowC->companyPostCode . '  ' . $rowC->city; ?> </span><br />
                                    <span><?php echo 'Phone : ' . $rowC->phoneNo . '  Fax : ' . $rowC->faxNo; ?> </span>
                                    <span><?php echo $rowC->fldname . '  ' . $rowC->fldcountry; ?> </span>
                                </p>
    <?php
    }
}
?>
                    </td>
                </tr>
                
                <tr>
                            <td>
                                <?php
                                if (isset($leftContentHeader)){
                                    echo "<p style='padding-left:10px; margin:0; font-size:11px; '>"
                                    . "<strong>".$leftContentHeader."</strong></p>";
                                }
                                 
                                 if (isset($leftContent)){
                                   echo '<p style="padding-left:10px; margin:0; line-height:1.4;">';
                                    foreach ($leftContent as $value) {
                                         echo $value != ''?"<span>".$value."</span><br />":'';
                                     }
                                  echo '</p>';
                                 }
                                
                                ?>
                            </td>
                                
                                <td style="float:right;" valign="top">
                                    <p style="line-height:1.4; text-align:left;">
                                        <?php
	                                        if (isset($rightContentHeader)){
	                                        	echo "<p style='padding-right:10px; margin:0; font-size:11px; '>"
	                                        			. "<strong>".$rightContentHeader."</strong></p>";
	                                        } 
                                            if (isset($rightContent)){
                                                 foreach ($rightContent as $value) {
                                                    echo $value != ''?"<span>".$value."</span><br />":'';
                                                }
                                            }
                                        ?>
                                    </p>
                                  </td>
                            </tr>
                
                <tr>
                    <td>
                        <?php
                        if (isset($leftContentHeader)) {
                            echo "<p style='padding-left:10px; margin:0; font-size:15px; '>"
                            . "<strong>" . $leftContentHeader . "</strong></p>";
                        }

                        if (isset($leftContent)) {
                            echo '<p style="padding-left:10px; margin:0; line-height:1.4;">';
                            foreach ($leftContent as $value) {
                                echo $value != '' ? "<span>" . $value . "</span><br />" : '';
                            }
                            echo '</p>';
                        }
                        ?>
                    </td>

                    <td style="text-align:right;" valign="top">
                        <p style="line-height:1.4; text-align:left;">
                            <?php
                            if (isset($rightContentHeader)) {
                                echo "<p style='padding-right:10px; margin:0; font-size:15px; '>"
                                . "<strong>" . $rightContentHeader . "</strong></p>";
                            }
                            if (isset($rightContent)) {
                                foreach ($rightContent as $value) {
                                    echo $value != '' ? "<span>" . $value . "</span><br />" : '';
                                }
                            }
                            ?>
                        </p>
                    </td>
                </tr>
<?php $tdNoFormat = isset($tdNoFormat) ? $tdNoFormat : array(); ?>
                <style>
                    .table th,.table td{
                        line-height:10px;
                    }
                </style>
<?php if (!empty($dataTable)) { ?>
                    <tr>
                        <td  colspan="2">
                            <table class="table table-bordered" id="oTable" style="z-index: 100" cellpadding="0" cellspacing="0" width="70%">

                                <thead class="thPrint">
                                    <tr>
                                        <th style="display:none"></th>
                                        <th class="span1 tac">#</th>
                                        <th><?php echo $this->lang->line('description') ?></th>
                                        <th style="width:220px;" class="tar"><?php echo $this->lang->line('amount') ?></th>
                                    </tr>
                                </thead>
                                <tbody class="tbPrint">
                                    <?php
                                    $bill = 0;
                                    $Header = 0;
                                    $total = 0;
                                    $tG1 =0;
                                    $tG2 = 0;
                                    foreach ($dataTable as $row) {
                                        $bill++;
                                        if ($row->parentID != $Header) {
                                            echo "<tr><td colspan='3'>" . $row->topGroupName . "</td></tr>";
                                           
                                            $Header = $row->parentID;
                                        }
                                       if ($row->topGroupName=="Current Assets"){
                                            $tG1 += $row->totalAmount;
                                       }else {
                                           $tG2 += $row->totalAmount;
                                       }
                                        $total +=$row->totalAmount;
                                        echo "<tr><td style='display:none'>" . $row->ID . "</td><td class='tac'>" . $bill . "</td>" .
                                        "<td>" . $row->acctName . "</td><td class='tar'>" . number_format($row->totalAmount, 2) . "</td></tr>";
                                    }
                                    ?>
                                    <tr>
                                        <td style="border-left: none;border-bottom: none;" colspan="3">
                                        </td>

                                    </tr>
                                    <tr>
                                        <td style="border: none;" colspan="2">
                                        </td>
                                        <td style="text-align:right;">
                                            Total Net Assets Due for Zakat: <?php echo number_format($total, 2); ?> 
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="border: none;" colspan="2">
                                        </td>
                                        <td style="text-align:right;">
                                            Nisab : <?php $ni = $tG1-$tG2; echo number_format($ni,2);?>  
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="border: none;" colspan="2">
                                        </td>
                                        <td style="text-align:right;">
                                            Zakate Rate : 2.50% 
                                        </td>
                                    </tr>
                                     <tr>
                                        <td style="border: none;" colspan="2">
                                        </td>
                                        <td style="text-align:right;">
                                            Muslim's Ownership Share : <?php echo number_format($muslimShare,2); ?>%
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="border: none;" colspan="2">
                                        </td>
                                        <td style="text-align:right;">
                                            Zakat Payable For The Year : <?php 
                                            $t = 0;
                                          
                                                if ($total > $ni){
                                                   $t = $total*0.025*$muslimShare/100;
                                                   echo number_format($t,2);
                                                }else 
                                                    echo "0.00";
                                            ?>
                                        </td>
                                    </tr>
                                    
                                    <tr>
                                        <td style="border: none;" colspan="2">
                                        </td>
                                        <td style="text-align:right;">
                                            Monthly Zakat Payable : <?php echo ($t>0) ? number_format($t/12,2) :"0.00"; ?>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
    <?php // $rptDataDetail[] = $rptDataDetail[0]; echo count((array)$rptDataDetail); echo "hsssssssdakjdnaldkmaldkmad";  ?>        
                        </td>
                    </tr>
<?php } ?>


                <tr>
                    <td colspan="2">
                        <br /> 
                        <p style="text-align: right; font-size:8px; font-weight:500;"> Prepared by &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        Aprproved By&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;       Receive By</p>

                        <br />
                        <p>
                            <p style="text-align: right; font-weight: 600; font-size: 8px;">SYSTEM GENERATED NO SIGNATURE REQUIRRED</p>
                            <hr style="border: 1px solid #dddddd;" />
                                <?php if (isset($ftrLeftContentHeader) || isset($ftrLeftContent)): ?>
                                <div class="row-fluid" style="border-bottom:1px solid #dddddd;padding:0 0 10px;margin:0 0 10px;">
                                    <?php
                                    if (isset($ftrLeftContentHeader)) {
                                        echo "<p style='padding-right:10px; margin:0; font-size:15px; '>"
                                        . "<strong>" . $ftrLeftContentHeader . "</strong></p>";
                                    }
                                    if (isset($ftrLeftContent)) {
                                        foreach ($ftrLeftContent as $value) {
                                            echo ($value != '') ? "<span>" . $value . "</span><br />" : '';
                                        }
                                    }
                                    ?>
                                </div>
<?php endif; ?>
                            <div class="row-fluid">
                                <div class="span4"><?php echo date("m/d/Y G:i:s"); ?></div>
                                <div class="span4">Private and Confidential</div>
                                <div class="span4"></div>
                            </div>
                        </p>
                    </td>
                </tr>
                <tr class="tdPrint">
                    <td align="left" colspan="2">
                        <button title="Print" class="btn-icon btn-success-form Print" onclick="do_print()" type="button" name="Print"><i class="icon-print"></i></button> <button title="Download" class="btn-icon btn-warning-form EXCEL" onclick="downloadExcel()" type="button" name="EXCEL"><i class="icon-download"></i></button>&nbsp;&nbsp; <button title="Close" class="btn-icon btn-danger-form Close" onclick="javascript:window.close();" type="button" name="Close">
						<i class="icon-off"></i></button>        </td>
                </tr>


            </tbody>
        </table>
    </body>
</html>