Subversion Repositories SmartDukaan

Rev

Rev 35669 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
33991 ranu 1
<link rel="stylesheet"
2
      href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-daterangepicker/3.1.0/daterangepicker.min.css"/>
3
 
33951 ranu 4
<style>
5
    table th {
6
        text-align: center;
7
    }
8
 
9
    #rbm-arr-table td, #rbm-arr-table th {
10
        padding: 0.35rem;
33997 ranu 11
        font-size: 18px;
33951 ranu 12
    }
13
 
33953 ranu 14
    .text-bold {
15
        font-weight: bold !important;
16
    }
17
 
18
    .text-bold span {
19
        font-weight: bold;
20
    }
21
 
33951 ranu 22
    .rb-name {
33997 ranu 23
        font-size: 16px;
33951 ranu 24
        font-weight: bold;
25
    }
26
 
27
    #rbm-arr-table td {
28
        text-align: center;
29
        background-size: 100% 100%;
30
        background-repeat: no-repeat;
31
        color: #000; /* Ensure text remains visible */
32
        font-weight: 400;
33
    }
34
 
34055 ranu 35
    #rbm-aging-table td {
36
        text-align: center;
37
        background-size: 100% 100%;
38
        background-repeat: no-repeat;
39
        color: #000; /* Ensure text remains visible */
40
        font-weight: 400;
41
    }
42
 
43
    .border-top-bottom {
44
        border-top: 2px solid #000 !important;
45
        border-bottom: 2px solid #000 !important;
46
    }
47
 
48
    #rbm-aging-table td, #rbm-aging-table th {
49
        padding: 0.35rem;
50
        font-size: 18px;
51
    }
52
 
33951 ranu 53
</style>
54
 
33917 ranu 55
<section class="wrapper">
37442 ranu 56
    #* <div class="row" style="margin: 0 0 10px 0">
57
         *##*<div class="col-md-12 text-right">
58
             <input class="btn btn-success btn-sm rbm-drr-dashboard"
59
                    type="button"
60
                    value="Open DRR Dashboard"
61
                    style="font-weight:600;">
62
         </div>*##*
63
     </div>*#
34055 ranu 64
    <div class="row" style="margin: 0">
33992 ranu 65
        #if($isGtEqL3)
34098 ranu 66
            <div class="col-md-12 text-right">
67
                <h4>RBM Wise Today's ARR (Basis Product Movement)</h4>
68
                <table style="float:right;margin-bottom: 10px;">
69
                    <tr>
70
                        <td>
71
                            <input placeholder="Set Duration" name="rbmArrPeriod"
72
                                   id="rbmArrPeriod"
73
                                   type="text" value="" class="form-control input-sm" style="height: 34px;">
74
                        </td>
75
                        <td>
76
                            <input class="btn btn-primary btn-sm rbm-target-achievement"
77
                                   type="button"
78
                                   value="View">
79
                        </td>
80
                        <td>
81
                            <input class="btn btn-primary btn-sm sold-catalog-report"
82
                                   type="button"
83
                                   value="Download row data">
84
                        </td>
85
                    </tr>
86
                </table>
87
            </div>
33992 ranu 88
        #end
33917 ranu 89
        <div class="col-lg-12">
90
            <table id="rbm-arr-table" class="table table-border table-condensed table-bordered" style="width:100%">
91
                <tr>
33939 ranu 92
                    <th>RBM</th>
93
                    <th>Total (ACH/TGT)</th>
94
                    <th>%</th>
95
                    <th>HID (ACH/TGT)</th>
96
                    <th>%</th>
33956 ranu 97
                    <th>FAST (ACH/TGT)</th>
98
                    <th>%</th>
33939 ranu 99
                    <th>RUN (ACH/TGT)</th>
100
                    <th>%</th>
34098 ranu 101
                    <th>SLOW (ACH/TGT)</th>
33939 ranu 102
                    <th>%</th>
103
                    <th>Other (ACH/TGT)</th>
104
                    <th>%</th>
33917 ranu 105
                </tr>
34098 ranu 106
                #foreach($target in $rbmArrViewModels)
33917 ranu 107
                    <tr>
33933 ranu 108
                        <td>$target.getRbmName()- $target.getWarehouseName()</td>
34098 ranu 109
 
33939 ranu 110
                        <td><span class="achieved-cell">$target.getTotalAchievedTarget()</span> / <span
111
                                class="target-cell">$target.getTodayTarget()</span></td>
112
                        <td class="total-percent"></td>
34098 ranu 113
 
33939 ranu 114
                        <td><span class="achieved-cell">$target.getTodayAchievedHidTarget()</span> / <span
115
                                class="target-cell">$target.getTodayHidTarget()</span></td>
116
                        <td class="hid-percent"></td>
34098 ranu 117
 
33939 ranu 118
                        <td><span class="achieved-cell">$target.getTodayAchievedFastMovingTarget()</span> / <span
119
                                class="target-cell">$target.getTodayFastMovingTarget()</span></td>
34098 ranu 120
                        <td class="fast-percent"></td>
121
 
122
                        <td><span class="achieved-cell">$target.getTodayAchievedRunningTarget()</span> / <span
123
                                class="target-cell">$target.getTodayRunningTarget()</span></td>
33939 ranu 124
                        <td class="run-percent"></td>
34098 ranu 125
 
33939 ranu 126
                        <td><span class="achieved-cell">$target.getTodayAchievedSlowMovingTarget()</span> / <span
127
                                class="target-cell">$target.getTodaySlowMovingTarget()</span></td>
128
                        <td class="slow-percent"></td>
34098 ranu 129
 
33939 ranu 130
                        <td><span class="achieved-cell">$target.getTodayAchievedOtherMovingTarget()</span> / <span
131
                                class="target-cell">$target.getTodayOtherMovingTarget()</span></td>
132
                        <td class="other-percent"></td>
33917 ranu 133
                    </tr>
34098 ranu 134
                #end
33946 ranu 135
                <!-- Add a row for totals -->
33942 ranu 136
                <tr>
137
                    <td><strong>Total</strong></td>
33953 ranu 138
                    <td class="text-bold"><span class="achieved-cell">$totalAchieved </span> / <span
139
                            class="target-cell">$totalTargetSum</span></td>
140
                    <td class="total-percent text-bold"></td>
33951 ranu 141
 
33953 ranu 142
                    <td class="text-bold"><span class="achieved-cell">$totalHidAchievedSum</span> / <span
143
                            class="target-cell">$totalHidSum</span></td>
144
                    <td class="hid-percent text-bold"></td>
33951 ranu 145
 
33953 ranu 146
                    <td class="text-bold"><span class="achieved-cell">$totalFastAchievedSum</span> / <span
147
                            class="target-cell">$totalFastSum</span></td>
34098 ranu 148
                    <td class="fast-percent text-bold"></td>
149
 
150
                    <td class="text-bold"><span class="achieved-cell">$totalRunningAchievedSum</span> / <span
151
                            class="target-cell">$totalRunningSum</span></td>
33953 ranu 152
                    <td class="run-percent text-bold"></td>
33951 ranu 153
 
33953 ranu 154
                    <td class="text-bold"><span class="achieved-cell">$totalSlowAchievedSum</span> / <span
155
                            class="target-cell">$totalSlowSum</span></td>
156
                    <td class="slow-percent text-bold"></td>
33951 ranu 157
 
33953 ranu 158
                    <td class="text-bold"><span class="achieved-cell">$totalOtherAchievedSum</span> / <span
159
                            class="target-cell">$totalOtherSum</span></td>
160
                    <td class="other-percent text-bold"></td>
33942 ranu 161
                </tr>
33951 ranu 162
 
33917 ranu 163
            </table>
164
        </div>
165
    </div>
34055 ranu 166
 
167
    <div class="row" style="margin: 0">
34098 ranu 168
        <div class="col-md-12">
169
            <br>
170
            <h4> > 15 Days Aging Sold </h4>
171
            <table id="rbm-aging-table" class="table table-border table-condensed table-bordered"
172
                   style="width:100%">
173
                <thead>
174
                <tr>
175
                    <th>RBM</th>
176
                    <th>HID</th>
177
                    <th>FASTMOVING</th>
178
                    <th>RUNNING</th>
179
                    <th>SLOWMOVING</th>
180
                    <th>OTHER</th>
181
                    <th>TOTAL</th>
182
                </tr>
183
                </thead>
184
                <tbody>
185
                    #foreach($model in $sold15daysOldAgingModels)
34055 ranu 186
                    <tr>
34098 ranu 187
                        <th>$model.getRbmName()</th>
188
                        <td class="format-indian">$model.getHidBilled()</td>
189
                        <td class="format-indian">$model.getFastmovingBilled()</td>
190
                        <td class="format-indian">$model.getRunningBilled()</td>
191
                        <td class="format-indian">$model.getSlowmovingBilled()</td>
192
                        <td class="format-indian">$model.getOthersBilled()</td>
193
                        <td class="format-indian">$model.getTotalBilled()</td>
34055 ranu 194
                    </tr>
34098 ranu 195
                    #end
196
                <tr>
197
                    <th class="border-top-bottom"> Total</th>
198
                    <td class="border-top-bottom format-indian">$totalSoldHid</td>
199
                    <td class="border-top-bottom format-indian">$totalSoldFast</td>
200
                    <td class="border-top-bottom format-indian">$totalSoldRun</td>
201
                    <td class="border-top-bottom format-indian">$totalSoldSlow</td>
202
                    <td class="border-top-bottom format-indian">$totalSoldOther</td>
203
                    <td class="border-top-bottom format-indian">$totalSoldAging</td>
204
                </tr>
205
                    #foreach($aging in $our15DaysOldAgingStocks)
34055 ranu 206
                    <tr>
34098 ranu 207
                        <th class="border-top-bottom"> 15 days Balance Value</th>
208
                        <td class="border-top-bottom format-indian">$aging.getHidAgingStock()</td>
209
                        <td class="border-top-bottom format-indian">$aging.getFastmovingAgingStock()</td>
210
                        <td class="border-top-bottom format-indian">$aging.getRunningAgingStock()</td>
211
                        <td class="border-top-bottom format-indian">$aging.getSlomovingAgingStock()</td>
212
                        <td class="border-top-bottom format-indian">$aging.getOtherAgingStock()</td>
213
                        <td class="border-top-bottom format-indian">$aging.getTotal()</td>
34055 ranu 214
                    </tr>
34098 ranu 215
                    #end
216
                </tbody>
217
            </table>
218
        </div>
34055 ranu 219
    </div>
34103 ranu 220
 
221
    <div class="row" style="margin: 0">
222
        <div class="col-md-12">
223
            <br>
35669 ranu 224
            <h4>Partner Billing Count (Target: >1L, Non-Target: >20K)</h4>
34103 ranu 225
            <table id="rbm-aging-table" class="table table-border table-condensed table-bordered"
226
                   style="width:100%">
227
                <thead>
228
                <tr>
229
                    <th>RBM</th>
35631 ranu 230
                    <th>Targeted Partner</th>
34120 ranu 231
                    <th>First Week Billed <br> (1-7)</th>
232
                    <th>Second Week Billed <br>(8-15)</th>
34144 ranu 233
                    <th>Third Week Billed <br>(16-22)</th>
234
                    <th>Fourth Week Billed <br> (23-month end)</th>
34106 ranu 235
                    <th>MTD Billed</th>
35669 ranu 236
                    <th>Zero Billed <br>(Target: &lt;1L, Non-Target: &lt;20K)</th>
34103 ranu 237
                </tr>
238
                </thead>
239
                <tbody>
240
                    #foreach($model in $sold15daysOldAgingModels)
241
                    <tr>
34277 ranu 242
                        <th>
243
                            $model.getRbmName()
244
                            #if($rbmNameToRatingMap.get($model.getRbmName()).getRating())
245
                                #set($rating =$rbmNameToRatingMap.get($model.getRbmName()).getRating())
246
                                #if($rating && $rating > 0 and $rating <= 1)
247
                                    <b style="color: goldenrod;font-size: 9px;"> &#9733;</b>
248
 
249
                                #elseif($rating && $rating > 1 and $rating <= 2)
250
                                    <b style="color: goldenrod;font-size: 9px;"> &#9733; &#9733;</b>
251
 
252
                                #elseif($rating && $rating > 2 and $rating <= 3)
253
                                    <b style="color: goldenrod;font-size: 9px;"> &#9733; &#9733; &#9733;</b>
254
 
255
                                #elseif($rating && $rating > 3 and $rating <= 4)
256
                                    <b style="color: goldenrod;font-size: 9px;"> &#9733; &#9733; &#9733; &#9733;</b>
257
 
258
                                #elseif($rating && $rating > 4 and $rating <= 5)
259
                                    <b style="color: goldenrod;font-size: 9px;"> &#9733; &#9733; &#9733; &#9733;
260
                                        &#9733; </b>
261
 
262
                                #end
263
                            #end
264
 
265
                        </th>
34103 ranu 266
                        <td>
34114 ranu 267
                            #if($rbmTargetedFofoIdCountMap.get($model.getRbmName()))
268
                                $rbmTargetedFofoIdCountMap.get($model.getRbmName())
269
                            #else
270
 
271
                            #end
272
                        </td>
273
                        <td>
34103 ranu 274
                            #if($rbmBilledCountMapFirstWeek.get($model.getRbmName()))
275
                                $rbmBilledCountMapFirstWeek.get($model.getRbmName())
276
                            #else
277
 
278
                            #end
279
                        </td>
280
                        <td>
281
                            #if($rbmBilledCountMapSecondWeek.get($model.getRbmName()))
282
                                $rbmBilledCountMapSecondWeek.get($model.getRbmName())
283
                            #else
284
 
285
                            #end
286
                        </td>
287
                        <td>
288
                            #if($rbmBilledCountMapThirdWeek.get($model.getRbmName()))
289
                                $rbmBilledCountMapThirdWeek.get($model.getRbmName())
290
                            #else
291
 
292
                            #end
293
                        </td>
294
                        <td>
295
                            #if($rbmBilledCountMapFourthWeek.get($model.getRbmName()))
296
                                $rbmBilledCountMapFourthWeek.get($model.getRbmName())
297
                            #else
298
 
299
                            #end
300
                        </td>
301
                        <td>
302
                            #if($rbmBilledCountMapMtd.get($model.getRbmName()))
303
                                $rbmBilledCountMapMtd.get($model.getRbmName())
304
                            #else
305
 
306
                            #end
307
                        </td>
34119 ranu 308
                        <td>
309
                            #if($zeroBilledCountMap.get($model.getRbmName()))
310
                                $zeroBilledCountMap.get($model.getRbmName())
311
                            #else
312
 
313
                            #end
314
                        </td>
34103 ranu 315
                    </tr>
316
                    #end
34119 ranu 317
                <tr>
318
                    <th class="border-top-bottom">Total</th>
319
                    <th class="border-top-bottom">$totalTargetedCount</th>
320
                    <th class="border-top-bottom">$totalFirstWeekCount</th>
321
                    <th class="border-top-bottom">$totalSecondWeekCount</th>
322
                    <th class="border-top-bottom">$totalThirdWeekCount</th>
323
                    <th class="border-top-bottom">$totalFourthWeekCount</th>
324
                    <th class="border-top-bottom">$totalMtdCount</th>
325
                    <th class="border-top-bottom">$totalZeroBilledCount</th>
326
                </tr>
34103 ranu 327
                </tbody>
328
            </table>
329
        </div>
330
    </div>
33930 ranu 331
</section>
33945 ranu 332
 
33930 ranu 333
<script>
34074 ranu 334
    function formatNumberIndian(num) {
34075 ranu 335
        x = num.toString();
336
        var lastThree = x.substring(x.length - 3);
337
        var otherNumbers = x.substring(0, x.length - 3);
338
        if (otherNumbers != '')
339
            lastThree = ',' + lastThree;
340
        var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree;
341
        return res;
34074 ranu 342
    }
343
 
344
    document.addEventListener("DOMContentLoaded", function () {
345
        document.querySelectorAll(".format-indian").forEach(function (el) {
346
            el.textContent = formatNumberIndian(el.textContent.trim());
347
        });
348
    });
349
</script>
350
 
351
 
352
<script>
33933 ranu 353
    function formatValueInLakh(value) {
33939 ranu 354
        return (value / 100000).toFixed(1) + 'L';
33930 ranu 355
    }
356
 
357
    function formatTargets() {
358
        const rows = document.querySelectorAll('#rbm-arr-table tbody tr');
33942 ranu 359
        let totalAchieved = 0, totalTarget = 0;
360
        let totalAchievedHid = 0, totalTargetHid = 0;
34098 ranu 361
        let totalAchievedFast = 0, totalTargetFast = 0;
362
        let totalAchievedRunning = 0, totalTargetRunning = 0;
33942 ranu 363
        let totalAchievedSlow = 0, totalTargetSlow = 0;
364
        let totalAchievedOther = 0, totalTargetOther = 0;
33930 ranu 365
 
366
        rows.forEach(row => {
33931 ranu 367
            const cells = row.querySelectorAll('td');
33946 ranu 368
            cells.forEach((cell, index) => {
369
                const achievedSpan = cell.querySelector('.achieved-cell');
370
                const targetSpan = cell.querySelector('.target-cell');
371
                if (achievedSpan && targetSpan) {
372
                    const achievedValue = parseFloat(achievedSpan.textContent.replace(/[^\d.-]/g, ''));
373
                    const targetValue = parseFloat(targetSpan.textContent.replace(/[^\d.-]/g, ''));
33944 ranu 374
 
33946 ranu 375
                    // Add to totals
376
                    if (index === 1) {
377
                        totalAchieved += achievedValue || 0;
378
                        totalTarget += targetValue || 0;
379
                    } else if (index === 3) {
380
                        totalAchievedHid += achievedValue || 0;
381
                        totalTargetHid += targetValue || 0;
382
                    } else if (index === 5) {
34098 ranu 383
                        totalAchievedFast += achievedValue || 0;
384
                        totalTargetFast += targetValue || 0;
33946 ranu 385
                    } else if (index === 7) {
34098 ranu 386
                        totalAchievedRunning += achievedValue || 0;
387
                        totalTargetRunning += targetValue || 0;
388
                    } else if (index === 9) {
33946 ranu 389
                        totalAchievedSlow += achievedValue || 0;
390
                        totalTargetSlow += targetValue || 0;
391
                    } else if (index === 11) {
392
                        totalAchievedOther += achievedValue || 0;
393
                        totalTargetOther += targetValue || 0;
394
                    }
33930 ranu 395
 
33946 ranu 396
                    // Format values in lakh
397
                    if (!isNaN(achievedValue)) achievedSpan.textContent = formatValueInLakh(achievedValue);
398
                    if (!isNaN(targetValue)) targetSpan.textContent = formatValueInLakh(targetValue);
33942 ranu 399
 
33946 ranu 400
                    const percentCell = cell.nextElementSibling;
401
                    if (percentCell && targetValue > 0) {
402
                        const percentage = ((achievedValue / targetValue) * 100).toFixed(1);
403
                        percentCell.textContent = percentage + '%';
33931 ranu 404
 
33946 ranu 405
                        // Determine background color based on percentage
406
                        let color;
33962 ranu 407
                        if (percentage <= 1) {
408
                            percentCell.style.color = `red`
409
                        }
33946 ranu 410
                        if (percentage <= 40) {
411
                            color = '#F56983FF'; // Orange for <= 40%
34110 ranu 412
                        } else if (percentage > 40 && percentage <= 95) {
413
                            color = '#f2c947e8'; // Yellow for 41% - 95%
33946 ranu 414
                        } else {
34110 ranu 415
                            color = '#82ef8299'; // Green for > 95%
33946 ranu 416
                        }
33945 ranu 417
 
33946 ranu 418
                        // Apply gradient background with the color
419
                        percentCell.style.background = `linear-gradient(to right, ${color} ${percentage}%, transparent ${percentage}%)`;
420
                    } else if (percentCell) {
33953 ranu 421
                        percentCell.textContent = "-";
33946 ranu 422
                        percentCell.style.background = 'none';
33931 ranu 423
                    }
33946 ranu 424
                }
33930 ranu 425
            });
33946 ranu 426
        });
33942 ranu 427
 
33946 ranu 428
    }
33944 ranu 429
 
33958 ranu 430
    function groupRowsByRbm() {
431
        const rows = document.querySelectorAll('#rbm-arr-table tbody tr');
432
        let currentRbm = null;
433
        let rbmGroup = [];
434
 
435
        rows.forEach((row, index) => {
436
            const rbmCell = row.cells[0];
437
            if (!rbmCell) return;
438
 
439
            const rbmName = rbmCell.textContent.split('-')[0].trim(); // Extract RBM name
440
 
441
            if (rbmName !== currentRbm) {
442
                // Apply border to the previous group
443
                if (rbmGroup.length > 0) {
444
                    applyBorderToGroup(rbmGroup);
445
                }
446
 
447
                // Reset for new RBM
448
                currentRbm = rbmName;
449
                rbmGroup = [];
450
            }
451
 
452
            // Add the row to the current group
453
            rbmGroup.push(row);
454
 
455
            // Apply border to the last group
456
            if (index === rows.length - 1 && rbmGroup.length > 0) {
457
                applyBorderToGroup(rbmGroup);
458
            }
459
        });
460
    }
461
 
462
    function applyBorderToGroup(group) {
463
        if (group.length === 0) return;
464
 
465
        // Add border styles to the first and last rows in the group
466
        //group[0].style.borderTop = '2px solid #000'; // Black border for start
467
        group[group.length - 1].style.borderBottom = '2px solid #000'; // Black border for end
468
    }
469
 
470
    window.onload = function () {
471
        formatTargets(); // Format targets first
472
        groupRowsByRbm(); // Group rows by RBM
473
    };
474
 
475
 
33945 ranu 476
</script>