Subversion Repositories SmartDukaan

Rev

Rev 35454 | 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)
<div class="container-fluid">

    #foreach($brands in $brandParts)
        <table class="table table-bordered table-striped">
            <thead>
            <tr>
                <th rowspan="2">Region</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>TODAY PO<br> Billed</th>
                    <th>Total Billed</th>
                #end
            </tr>
            </thead>
            <tbody>
                #foreach($brandRegionModelEntry in $brandRegionModelMap.entrySet())
                <tr class="green">
                    <td><b>$warehouseMap.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.getTodayPOBilledValue())
                            <td class="currency">$obj.getTodayPOBilledValue()</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>
## OPTIMIZED: Use single get with null check instead of containsKey + get pattern
            #foreach($warehouseEntry in $warehouseMap.entrySet())
                #if($warehouseEntry.getKey()!=0)
                <tr>
                    <td><b>$warehouseEntry.getValue()</b></td>
                    #set($warehouseTypeMap = $partnerTypeRegionModelMap.get($warehouseEntry.getKey()))
                    #foreach($partnerType in $partnerTypes)
                        <td>
                            #if($warehouseTypeMap)
                                #set($partnerTypeRegionModel = $warehouseTypeMap.get($partnerType.getValue()))
                                #if($partnerTypeRegionModel)
                                    $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">
## OPTIMIZED: Use single get instead of double get pattern
        #foreach($warehouseEntry in $warehouseMap.entrySet())
            #set($warehouseKey = $warehouseEntry.getKey())
            #set($collectionValue = $warehouseCollectionMap.get($warehouseKey))
            #set($pgCollectionValue = $warehousePgCollectionMap.get($warehouseKey))
            <div class="col-lg-2" style="font-size: 20px">
                $warehouseEntry.getValue() -
                #if($collectionValue)
                    <span class="currency">$collectionValue</span>
                #else
                    0
                #end
                /
                #if($pgCollectionValue)
                    <span class="currency">$pgCollectionValue</span>
                #else
                    0
                #end

            </div>
        #end
    </div>
</div>

#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>
</body>
</html>