Subversion Repositories SmartDukaan

Rev

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

<html lang="en">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta http-equiv="refresh" content="180">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
          integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
    <style>
        html, body {
            margin-top: 10px;
            padding: 0;
        }


        td, th {
            font-size: 20px;
        }


        .table td, .table th {
            padding: 0.25rem;
        }

        tr:first-child.green td {
            font-weight: bold;
            background-color: #00d6b2;
        }

        td {
            font-size: 24px;
        }
    </style>
    <link href="../resources/css/brand-logo.css" rel="stylesheet"/>
</head>
<body>

    #if($isGtEqL2)
<h3>RBM Wise Today's ARR (Basis Product Movement)</h3>
    #parse("rbm-today-arr.vm")
<br>
<div class="container-fluid">
    #foreach($brands in $brandParts)
        <table class="table table-bordered table-striped">
            <thead>
            <tr>
                <th rowspan="2">AuthUser</th>
                #foreach($brand in $brands)
                    <th colspan="3" class="$brand.toLowerCase()"><p>$brand</p></th>
                #end
            </tr>
            <tr>
                #foreach($brand in $brands)
                    <th>TODAY PO</th>
                    <th>Partner Count</th>
                    <th>Total Billed</th>
                #end
            </tr>
            </thead>
            <tbody>
                #foreach($brandRegionModelEntry in $brandRegionModelMap.entrySet())
                <tr class="green">
                    <td><b>$authUserMap.get($brandRegionModelEntry.getKey())</b></td>
                    #foreach($brand in $brands)
                        #set($obj = $brandRegionModelEntry.getValue().get($brand))
                        #if($obj.getTodayPOValue())
                            <td class="currency">$obj.getTodayPOValue()</td>
                        #else
                            <td>-</td>
                        #end
                        #if($obj.getPartiesBilled())
                            <td>$obj.getPartiesBilled()</td>
                        #else
                            <td>-</td>
                        #end
                        #if($obj.getTodayBilledValue())
                            <td class="currency">$obj.getTodayBilledValue()</td>
                        #else
                            <td>-</td>
                        #end
                    #end

                </tr>
                #end
            </tbody>
        </table>
    #end
</div>
#if($partnerTypeRegionModelMap)
<div class="container-fluid">
    ##    <table class="table table-bordered table-striped">
##        <thead>
##        <tr>
##            <th>Regionwise Billed Partners</th>
##            #foreach($partnerType in $partnerTypes)
##                <th>$partnerType.getValue()<br>Today/MTD/Total</th>
##            #end
##        </tr>
##        </thead>
##        <tbody>
##            #foreach($authUserEntry in $authUserMap.entrySet())
##                #if($authUserEntry.getKey()!=0)
##                <tr>
##                    <td><b>$authUserEntry.getValue()</b></td>
##                    #foreach($partnerType in $partnerTypes)
##                        <td>
##                            #if($partnerTypeRegionModelMap.containsKey($warehouseEntry.getKey()))
##                                #if($partnerTypeRegionModelMap.get($warehouseEntry.getKey()).containsKey($partnerType.getValue()))
##                                    #set ($partnerTypeRegionModel=$partnerTypeRegionModelMap.get($warehouseEntry.getKey()).get($partnerType.getValue()))
##                                    $partnerTypeRegionModel.getTodayCount()/$partnerTypeRegionModel.getMtdCount()
##                                    /$partnerTypeRegionModel.getTotalCount()
##                                #else
##                                    -
##                                #end
##                            #else
##                                -
##                            #end
##                        </td>
##                    #end
##                </tr>
##                #end
##            #end
##        </tbody>
##    </table>
</div>
#end
<div class="container-fluid ">
    <h3>Total Collection(Overall Collection/Limit Utilization))</h3>
    <div class="row">
        #foreach($warehouseEntry in $warehouseMap.entrySet())
            <div class="col-lg-2" style="font-size: 20px">
                $warehouseEntry.getValue() -
                #if($warehouseCollectionMap.get($warehouseEntry.getKey()))
                    <span class="currency">$warehouseCollectionMap.get($warehouseEntry.getKey())</span>
                #else
                    0
                #end
                /
                #if($warehousePgCollectionMap.get($warehouseEntry.getKey()))
                    <span class="currency">$warehousePgCollectionMap.get($warehouseEntry.getKey())</span>
                #else
                    0
                #end

            </div>
        #end
    </div>
</div>
    #parse("today_target.vm")
#end
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
        integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
        crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
        integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
        crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
        integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
        crossorigin="anonymous"></script>
<script type="text/javascript">
    function numberToComma(x) {

        x = x.toString();
        x = x.split('.');
        var x1 = x[0];
        var x2 = x.length > 1 && x[1] != '0' ? '.' + x[1] : '';
        var lastThree = x1.substring(x1.length - 3);
        var otherNumbers = x1.substring(0, x1.length - 3);
        if (x1.charAt(x1.length - 4) == ',' || x1.charAt(x1.length - 4) == '-') {
            console.log(lastThree)
        } else {
            if (otherNumbers != '')
                lastThree = ',' + lastThree;
        }
        return otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + (lastThree)
                + x2;

    }

    $(document).ready(function () {
        $('.currency').each(function (index, ele) {
            if (!isNaN(parseInt($(ele).html()))) {
                $(ele).html(numberToComma($(ele).html()));
            }
        });
    })
</script>


<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css"/>

<script>
    // Initialize the date range picker
    $('input[name="rbmArrPeriod"]').daterangepicker({
        autoUpdateInput: false, // Prevent auto-filling the input with dates
        locale: {
            cancelLabel: 'Clear'
        }
    });

    // Update the input field when dates are selected
    $('input[name="rbmArrPeriod"]').on('apply.daterangepicker', function (ev, picker) {
        $(this).val(picker.startDate.format('YYYY-MM-DD') + ' - ' + picker.endDate.format('YYYY-MM-DD'));
    });

    // Clear the input field when the user cancels
    $('input[name="rbmArrPeriod"]').on('cancel.daterangepicker', function (ev, picker) {
        $(this).val('');
    });

    // Function to get the dates from the picker
    function getDatesFromPicker(selector) {
        const pickerElement = $(selector).data('daterangepicker');
        if (!pickerElement) {
            console.error('Date Range Picker is not initialized.');
            return {startDate: null, endDate: null};
        }
        return {
            startDate: pickerElement.startDate.format('YYYY-MM-DD'),
            endDate: pickerElement.endDate.format('YYYY-MM-DD')
        };
    }

    // Button click event
    $(document).on('click', '.sold-catalog-report', function () {
        const dates = getDatesFromPicker('input[name="rbmArrPeriod"]');
        const startDate = dates.startDate;
        const endDate = dates.endDate;

        if (!startDate || !endDate) {
            alert("Start date and end date cannot be empty!!");
            return;
        }

        let endPoint = `/downloadSoldCatalogReport?startDate=${startDate}&endDate=${endDate}`;
        window.open(endPoint, '_blank');
        ;
    });
</script>
</body>
</html>