Subversion Repositories SmartDukaan

Rev

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

<section class="wrapper">
    <div class="row">
        <div class="col-lg-12">
            <h3 class="page-header"><i class="icon_document_alt"></i>Credited Income</h3>
            <ol class="breadcrumb">
                <li><i class="fa fa-home"></i><a href="${rc.contextPath}/dashboard">Home</a></li>
                <li><i class="icon_document_alt"></i>Credited Income</li>
            </ol>
        </div>
    </div>

    <div class="row">
        <div class="form-group">
            <label class="control-label col-lg-1" for="months" style="color:green;">Select Month</label>
            <div class="col-lg-2">
                <select class="form-control input-sm" id="month-wise-income"
                        style="font-weight: bold;margin:auto;" name="month-wise-income"
                        placeholder="months">
                    <option value="" disabled selected>Month</option>
                    #foreach($mVM in $monthValueMap.entrySet())
                        #if($mVM.getKey()== $month )
                        <b>
                            <option value="$mVM.getKey()" selected>$mVM.getValue()</option>
                        #else
                        <b>
                            <option value="$mVM.getKey()">$mVM.getValue()</option>
                        #end
                    #end
                </select>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-4">
            <table class="table table-border table-condensed table-bordered" id="lmiCreditedIncome">

                <thead class="row htable">

                <tr style="color:black;">
                    <th>Brand</th>
                    <th>Purchase Qty</th>
                    <th>Purchase Margin</th>
                    <th>Sale Qty</th>
                    <th>Sale Margin</th>
                    <th>Pending Sale Margin</th>
                    <th>Total Income</th>
                </tr>
                </thead>
                <tbody>

                    #foreach($key in $keySet)
                    <tr class="brand-wise-income" data-brand="$key" data-month="$month" data-status="$status">
                        <td>$key</td>

                        #if($lastMonthPurchaseInMarginMap.get($key).getQty())
                            <td>$lastMonthPurchaseInMarginMap.get($key).getQty()</td>
                        #else
                            <td>0</td>
                        #end
                        #if($lastMonthPurchaseInMarginMap.get($key).getAmount())
                            <td>$nf.format($lastMonthPurchaseInMarginMap.get($key).getAmount())</td>
                        #else
                            <td>0</td>
                        #end
                        #if($lastMonthSaleMarginMap.get($key).getQty())
                            <td>$lastMonthSaleMarginMap.get($key).getQty()</td>
                        #else
                            <td>0</td>
                        #end
                        #if($lastMonthCategoryUpgradeMarginMap.get($key))

                            #if($lastMonthSaleMarginMap.get($key).getAmount())

                                <td>$nf.format($lastMonthSaleMarginMap.get($key).getAmount()) <i
                                        class='far fa-arrow-alt-circle-up' style="color: green;"
                                        title="$nf.format($lastMonthCategoryUpgradeMarginMap.get($key)) Category Upgrade Additional Margin."></i>
                                </td>
                            #else
                                <td>0<i class='far fa-arrow-alt-circle-up' style="color: green;"
                                        title="$nf.format($lastMonthCategoryUpgradeMarginMap.get($key)) Category Upgrade Additional Margin."></i>
                                </td>
                            #end


                        #else
                            #if($lastMonthSaleMarginMap.get($key).getAmount())

                                <td>$nf.format($lastMonthSaleMarginMap.get($key).getAmount()) </td>
                            #else
                                <td>0</td>
                            #end

                        #end
                        #if($lastMonthPendingIncomeMap.get($key).getAmount())
                            <td>$nf.format($lastMonthPendingIncomeMap.get($key).getAmount())</td>

                        #else
                            <td>0</td>
                        #end

                        #if($totalAmountMap.get($key))

                            <td>$nf.format($totalAmountMap.get($key))</td>
                        #else
                            <td>0</td>
                        #end

                    </tr>
                    #end

                </tbody>
                <tfoot>
                <tr>
                    <td>Total</td>
                    <td>-</td>
                    <td id="purchase-total"></td>

                    <td>-</td>
                    <td id="sale-total"></td>
                    <td id="pending-total"></td>

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

                </tr>
                </tfoot>


            </table>
        </div>


        <div class="col-lg-8 brand-wise-income-container"></div>

    </div>

    <div class="imei-wise-income-container"></div>


</section>


<script type="text/javascript">
    $(document).ready(function () {
        var table = $('#lmiCreditedIncome').DataTable();

        $('#lmiCreditedIncome tbody').on('click', 'tr', function () {
            if ($(this).hasClass('selected')) {
                $(this).removeClass('selected');
            } else {
                table.$('tr.selected').removeClass('selected');
                $(this).addClass('selected');
            }
        });

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


        });

    });


    function datatableSum() {

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

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

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


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

    }


</script>