Subversion Repositories SmartDukaan

Rev

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