Subversion Repositories SmartDukaan

Rev

Rev 30409 | Rev 30414 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<section>
    <div>
        <table class="table table-border table-condensed table-bordered" id="brandWiseIncome">

            <thead class="row htable">

            <tr style="color:black;">
                <th>Model Name</th>
                <th>Purchase Qty</th>
                <th>Purchase Margin</th>
                <th>Sale Qty</th>
                <th>Sale Margin</th>
                <th>Pending Sale Magin</th>
                <th>Total Amount</th>
            </tr>
            </thead>
            <tbody>
                #foreach($modelWiseEntry in $modelNameMap.entrySet())
                <tr class="imei_wise_income" data-catalogitemid="$modelWiseEntry.getKey()"
                    data-month="$month">
                    <td>$modelWiseEntry.getValue()</td>

                    #if($modelWiseSchemeInMarginsMap.containsKey($modelWiseEntry.getKey()))
                        <td>$modelWiseSchemeInMarginsMap.get($modelWiseEntry.getKey()).getQty()</td>
                        <td>$nf.format($modelWiseSchemeInMarginsMap.get($modelWiseEntry.getKey()).getAmount())</td>
                    #else
                        <td>--</td>
                        <td>--</td>
                    #end
                    #if($modelWiseSchemeOutMarginsMap.get($modelWiseEntry.getKey()))
                        <td>$modelWiseSchemeOutMarginsMap.get($modelWiseEntry.getKey()).getQty()</td>
                        #if($modelWiseSchemeOutMarginsMap.get($modelWiseEntry.getKey()).getAmount() > 0)
                            <td>$nf.format($modelWiseSchemeOutMarginsMap.get($modelWiseEntry.getKey()).getAmount())
                                #if($categoryUpradeBrandModelMap.get($modelWiseEntry.getKey()))
                                    <i class="far fa-arrow-alt-circle-up" style="color: green;"
                                       title="$nf.format($categoryUpradeBrandModelMap.get($modelWiseEntry.getKey())) Category Upgrade Additional Margin.">
                                    </i>
                                #end
                            </td>
                        #else
                            <td>--</td>
                        #end
                        #if($modelWiseSchemeOutMarginsMap.get($modelWiseEntry.getKey()).getPendingAmount() > 0)
                            <td>$nf.format($modelWiseSchemeOutMarginsMap.get($modelWiseEntry.getKey()).getPendingAmount())</td>
                        #else
                            <td>--</td>
                        #end
                    #else
                        <td>--</td>
                        <td>--</td>
                    #end

                    #if($modelTotalIncomeMap.get($modelWiseEntry.getKey()))
                        <td>$nf.format($modelTotalIncomeMap.get($modelWiseEntry.getKey()))</td>
                    #else
                        <td>--</td>
                    #end
                </tr>
                #end
            <tbody>

            <tfoot>
            <tr>
                <td style="font-weight: bold;">Total</td>
                <td>-</td>
                <td id="brand-purchase-total"></td>
                <td>-</td>
                <td id="brand-sale-total"></td>
                <td id="brand-pending-total"></td>

                <td id="brand-sum-total"></td>

            </tr>
            </tfoot>


        </table>

    </div>

</section>

<script type="text/javascript">

    $(document).ready(function () {
        datatableSum();
        var table = $('#brandWiseIncome').DataTable(
                {
                    "bPaginate": true,
                    "bLengthChange": true,
                    "bFilter": true,
                    "bInfo": false,
                    "bAutoWidth": false,
                    "scrollX": true,

                });

        table.on('search.dt', function () {
            console.log('Currently applied global search: ' + table.search());
            datatableSum();
        });

    });


    function datatableSum() {

        var col_two_sum = $('#brandWiseIncome').DataTable().column(2, {page: 'current'}).data().sum();
        $('#brand-purchase-total').html(numberToComma(col_two_sum));

        var col_four_sum = $('#brandWiseIncome').DataTable().column(4, {page: 'current'}).data().sum();
        console.log(col_four_sum)
        $('#brand-sale-total').html(numberToComma(col_four_sum));

        var col_five_sum = $('#brandWiseIncome').DataTable().column(5, {page: 'current'}).data().sum();
        $('#brand-pending-total').html(numberToComma(col_five_sum));


        var col_six_sum = $('#brandWiseIncome').DataTable().column(6, {page: 'current'}).data().sum();
        console.log(col_six_sum)
        $('#brand-sum-total').html(numberToComma(col_six_sum));

    }


</script>