
<style>


    .table thead tr >th{

        background-color:#4c0870;

        color:#fff;
    }
    .table thead tr th[class*='sorting_'] {
        color: #fff;
    }
    .bg-master-lighter {
        border:none;
        background-color:#fff;
        border-top:1px solid #ddd; 

    }


</style>
<div class="container-fluid container-fixed-lg bg-white">
    <div class="panel panel-transparent">
        <div class="panel-heading">
            <div class="panel-title"><?php print CommonLAnguage::getMessage('aging_report'); ?></div>
            <div class="clearfix"></div>
        </div>
        <div class="panel-body">
            <table class="table table-bordered table-hover demo-table-search" id="tableWithSearch">
                <thead>
                    <tr>
                        <th style="display:none"></th>
                        <th class="v-align-middle text-center " style="width:20%"><?php print CommonLanguage::getMessage('customer_name'); ?></th>
                        <th class="v-align-middle text-center " style="width:16%" ><?php print CommonLanguage::getMessage('Balance'); ?> </th>
                        <th class="v-align-middle text-center " > <?php print CommonLanguage::getMessage('current'); ?> </th>
                        <th class="v-align-middle text-center " > <30 </th>
                        <th class="v-align-middle text-center " ><60 </th>
                        <th class="v-align-middle text-center " ><90 </th>     
                        <th class="v-align-middle text-center " ><120 </th>
                        <th class="v-align-middle text-center " ><?php print CommonLanguage::getMessage('More'); ?> </th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    for ($x = 0; $x < count($result) - 7; $x++) {
                        $CurItem = $result[$x];

                        $CurItem["0"]["Current"] = explode("->", $CurItem["0"]["Current"]);
                        $CurItem["0"]["<30"] = explode("->", $CurItem["0"]["<30"]);
                        $CurItem["0"]["<60"] = explode("->", $CurItem["0"]["<60"]);
                        $CurItem["0"]["<90"] = explode("->", $CurItem["0"]["<90"]);
                        $CurItem["0"]["<120"] = explode("->", $CurItem["0"]["<120"]);
                        $CurItem["0"]["More"] = explode("->", $CurItem["0"]["More"]);
                        ?>
                        <tr>
                            <td style="display:none"></td>

                            <td class='v-align-left text-left bold'><?php echo $CurItem["Customer_Name"]; ?></td>
                            <td class='v-align-middle text-center'><span class="DefaultCurrency"><?php echo $defCurrencySymbol; ?> </span> <span class=""><?php echo Forms::DecimalNumber($CurItem["Balance"]); ?></span></td>
                            <td class='v-align-middle text-center'><span class="DefaultCurrency"><?php echo $defCurrencySymbol; ?> </span> <?php echo!empty($CurItem["0"]["Current"]) ? ('<span class="">' . Forms::DecimalNumber($CurItem["0"]["Current"][0]) . '</span> ->' . $CurItem["0"]["Current"][1]) : '0' ?></td>
                            <td class='v-align-middle text-center'><span class="DefaultCurrency"><?php echo $defCurrencySymbol; ?> </span> <?php echo!empty($CurItem["0"]["<30"]) ? ('<span class="">' . Forms::DecimalNumber($CurItem["0"]["<30"][0]) . '</span> ->' . $CurItem["0"]["<30"][1]) : '0' ?></td>
                            <td class='v-align-middle text-center'><span class="DefaultCurrency"><?php echo $defCurrencySymbol; ?> </span> <?php echo!empty($CurItem["0"]["<60"]) ? ('<span class="">' . Forms::DecimalNumber($CurItem["0"]["<60"][0]) . '</span> ->' . $CurItem["0"]["<60"][1]) : '0'; ?></td>
                            <td class='v-align-middle text-center'><span class="DefaultCurrency"><?php echo $defCurrencySymbol; ?> </span> <?php echo!empty($CurItem["0"]["<90"]) ? ('<span class="">' . Forms::DecimalNumber($CurItem["0"]["<90"][0]) . '</span> ->' . $CurItem["0"]["<90"][1]) : '0'; ?> </td>
                            <td class='v-align-middle text-center'><span class="DefaultCurrency"><?php echo $defCurrencySymbol; ?> </span> <?php echo!empty($CurItem["0"]["<120"]) ? ('<span class="">' . Forms::DecimalNumber($CurItem["0"]["<120"][0]) . '</span> ->' . $CurItem["0"]["<120"][1] ) : '0'; ?></td>
                            <td class='v-align-middle text-center'><span class="DefaultCurrency"><?php echo $defCurrencySymbol; ?> </span> <?php echo!empty($CurItem["0"]["More"]) ? ('<span class="">' . Forms::DecimalNumber($CurItem["0"]["More"][0]) . '</span> ->' . $CurItem["0"]["More"][1]) : '0'; ?></td>
                        </tr>
<?php
}
$result ['Total_Current'] = explode("->", $result ['Total_Current']);
$result ['Total_M1'] = explode("->", $result ['Total_M1']);
$result ['Total_M2'] = explode("->", $result ['Total_M2']);
$result ['Total_M3'] = explode("->", $result ['Total_M3']);
$result ['Total_M4'] = explode("->", $result ['Total_M4']);
$result ['Total_More'] = explode("->", $result ['Total_More']);
?>
                    <tr>
                        <td style="display:none"></td>

                        <td class='v-align-middle text-center bold'><?php print CommonLanguage::getMessage('total'); ?></td>
                        <td class='v-align-middle text-center'><span class="DefaultCurrency"><?php echo $defCurrencySymbol; ?> </span> <span class=""> <?php echo Forms::DecimalNumber($result ['Total_Balance']); ?></span></td>
                        <td class='v-align-middle text-center'><span class="DefaultCurrency"><?php echo $defCurrencySymbol; ?> </span> <?php echo!empty($result['Total_Balance']) ? ('<span class="">' . Forms::DecimalNumber($result['Total_Current'][0]) . '</span> ->' . $result['Total_Current'][1]) : '0' ?></td>
                        <td class='v-align-middle text-center'><span class="DefaultCurrency"><?php echo $defCurrencySymbol; ?> </span> <?php echo!empty($result['Total_M1']) ? ('<span class="">' . Forms::DecimalNumber($result['Total_M1'][0]) . '</span> ->' . $result['Total_M1'][1]) : '0' ?></td>
                        <td class='v-align-middle text-center'><span class="DefaultCurrency"><?php echo $defCurrencySymbol; ?></span>  <?php echo!empty($result['Total_M2']) ? ('<span class="">' . Forms::DecimalNumber($result['Total_M2'][0]) . '</span> ->' . $result['Total_M2'][1]) : '0' ?></td>
                        <td class='v-align-middle text-center'><span class="DefaultCurrency"><?php echo $defCurrencySymbol; ?></span> <?php echo!empty($result['Total_M3']) ? ('<span class="">' . Forms::DecimalNumber($result['Total_M3'][0]) . '</span> ->' . $result['Total_M3'][1]) : '0' ?></td>
                        <td class='v-align-middle text-center'><span class="DefaultCurrency"><?php echo $defCurrencySymbol; ?></span>  <?php echo!empty($result['Total_M4']) ? ('<span class="">' . Forms::DecimalNumber($result['Total_M4'][0]) . '</span> ->' . $result['Total_M4'][1]) : '0' ?></td>
                        <td class='v-align-middle text-center'><span class="DefaultCurrency"><?php echo $defCurrencySymbol; ?></span>  <?php echo!empty($result['Total_More']) ? ('<span class="">' . Forms::DecimalNumber($result['Total_More'][0]) . '</span> ->' . $result['Total_More'][1]) : '0' ?></td>
                    </tr>
                </tbody>

            </table>
        </div>
    </div>
</div>
<nav class="navbar navbar-default bg-master-lighter sm-padding-10" role="navigation">
    <div class="container-fluid">
        <div class="collapse navbar-collapse" id="sub-nav">
            <div class="row"> 
                <div class="col-sm-4 ">
                    <ul class="nav navbar-nav navbar-center">
                        <li><a href="#" data-toggle="tooltip" data-placement="bottom" title="Print" class="PrintThisTableButton" data-date="<?php echo $today ?>" data-table="#tableWithSearch" data-title="Aging Reports"><i class="fa fa-print"></i></a></li>
                        <li><a href="#" data-toggle="tooltip" data-placement="bottom" title="Download"><i class="fa fa-download"></i></a></li>
                    </ul>
                </div>
                <div class="col-sm-4 pull-right">
                    <ul class="nav navbar-nav navbar-right">
                        <li>
                            <a href="#" class="p-r-10" data-download-pdf="#tableWithSearch" data-title="Aging Report"><img width="25" height="25" alt="" class="icon-pdf" data-src-retina="<?php echo SITE_LINK; ?>img/invoice/pdf2x.png" data-src="<?php echo SITE_LINK; ?>img/invoice/pdf2x.png" src="<?php echo SITE_LINK; ?>img/invoice/pdf2x.png"></a>
                        </li>
                        <li>
                            <a href="#" class="p-r-10"><img width="25" height="25" alt="" class="icon-image" data-src-retina="<?php echo SITE_LINK; ?>img/invoice/image2x.png" data-src="<?php echo SITE_LINK; ?>img/invoice/image2x.png" src="<?php echo SITE_LINK; ?>img/invoice/image2x.png"></a>
                        </li>
                        <li>
                            <a href="#" class="p-r-10"><img width="25" height="25" alt="" class="icon-doc" data-src-retina="<?php echo SITE_LINK; ?>img/invoice/doc2x.png" data-src="<?php echo SITE_LINK; ?>img/invoice/doc2x.png" src="<?php echo SITE_LINK; ?>img/invoice/doc2x.png"></a>
                        </li>
                        <li><a href="#" class="p-r-10" onclick="$.Pages.setFullScreen(document.querySelector('html'));return false"><i class="fa fa-expand"></i></a></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</nav>



