| 33917 |
ranu |
1 |
<style>
|
| 33930 |
ranu |
2 |
|
|
|
3 |
table th {
|
|
|
4 |
text-align: center;
|
| 33917 |
ranu |
5 |
}
|
|
|
6 |
|
| 33930 |
ranu |
7 |
#rbm-arr-table td, #rbm-arr-table th {
|
|
|
8 |
padding: 0.35rem;
|
|
|
9 |
font-size: 20px;
|
| 33917 |
ranu |
10 |
}
|
| 33930 |
ranu |
11 |
|
|
|
12 |
|
|
|
13 |
.rb-name {
|
|
|
14 |
font-size: 17px;
|
|
|
15 |
font-weight: bold;
|
|
|
16 |
}
|
| 33917 |
ranu |
17 |
</style>
|
|
|
18 |
|
|
|
19 |
<section class="wrapper">
|
| 33925 |
ranu |
20 |
## <div class="row">
|
|
|
21 |
## <div class="col-lg-12">
|
|
|
22 |
## <h3 class="page-header"><i class="icon_document_alt"></i>RBM ARR</h3>
|
|
|
23 |
## <ol class="breadcrumb">
|
|
|
24 |
## <li><i class="fa fa-home"></i><a href="${rc.contextPath}/dashboard">Home</a></li>
|
|
|
25 |
## <li><i class="icon_document_alt"></i>RBM Wise Today's ARR (Basis Product Movement)</li>
|
|
|
26 |
## </ol>
|
|
|
27 |
## </div>
|
|
|
28 |
## </div>
|
| 33917 |
ranu |
29 |
|
|
|
30 |
<div class="row">
|
| 33925 |
ranu |
31 |
## <div class="col-lg-4">
|
|
|
32 |
## <table>
|
|
|
33 |
## <tr>
|
|
|
34 |
## <td style="margin-right: 10px;"><input type="date" class="form-control arr-start_date" placeholder="select date"> </td>
|
|
|
35 |
## <td><button type="button" class="btn btn-info arr-button-mk">Submit</button> </td>
|
|
|
36 |
## </tr>
|
|
|
37 |
## </table>
|
|
|
38 |
## </div>
|
|
|
39 |
## <div class="col-lg-8"></div>
|
| 33917 |
ranu |
40 |
<div class="clearfix"></div>
|
|
|
41 |
<br>
|
|
|
42 |
<div class="col-lg-12">
|
|
|
43 |
<table id="rbm-arr-table" class="table table-border table-condensed table-bordered" style="width:100%">
|
|
|
44 |
|
|
|
45 |
<thead>
|
|
|
46 |
<tr>
|
| 33930 |
ranu |
47 |
<th rowspan="2" class="text-left">RBM</th>
|
| 33931 |
ranu |
48 |
<th class="text-center">HID</th>
|
|
|
49 |
<th>RUN</th>
|
|
|
50 |
<th>SLOW</th>
|
|
|
51 |
<th>EOL</th>
|
|
|
52 |
<th>Other</th>
|
|
|
53 |
<th>Total</th>
|
| 33917 |
ranu |
54 |
</tr>
|
|
|
55 |
<tr>
|
| 33931 |
ranu |
56 |
<th>ACH/TGT</th>
|
| 33917 |
ranu |
57 |
|
| 33931 |
ranu |
58 |
<th>ACH/TGT</th>
|
| 33917 |
ranu |
59 |
|
| 33931 |
ranu |
60 |
<th>ACH/TGT</th>
|
| 33917 |
ranu |
61 |
|
| 33931 |
ranu |
62 |
<th>ACH/TGT</th>
|
| 33917 |
ranu |
63 |
|
| 33931 |
ranu |
64 |
<th>ACH/TGT</th>
|
| 33917 |
ranu |
65 |
|
| 33931 |
ranu |
66 |
<th>ACH/TGT</th>
|
|
|
67 |
|
| 33917 |
ranu |
68 |
</tr>
|
|
|
69 |
|
|
|
70 |
</thead>
|
|
|
71 |
#foreach($target in $rbmArrViewModels)
|
|
|
72 |
<tbody>
|
|
|
73 |
<tr>
|
| 33930 |
ranu |
74 |
<td class="rb-name">$target.getRbmName()- $target.getWarehouseName()</td>
|
| 33917 |
ranu |
75 |
|
| 33931 |
ranu |
76 |
<td><span class="target-cell">$target.getTodayAchievedHidTarget()</span> / <span
|
|
|
77 |
class="achieved-cell">$target.getTodayHidTarget()</span></td>
|
| 33917 |
ranu |
78 |
|
| 33931 |
ranu |
79 |
<td><span class="target-cell">$target.getTodayAchievedFastMovingTarget()</span> / <span
|
|
|
80 |
class="achieved-cell">$target.getTodayFastMovingTarget()</span></td>
|
| 33917 |
ranu |
81 |
|
| 33931 |
ranu |
82 |
<td><span class="target-cell">$target.getTodayAchievedSlowMovingTarget()</span> / <span
|
|
|
83 |
class="achieved-cell">$target.getTodaySlowMovingTarget()</span></td>
|
| 33917 |
ranu |
84 |
|
| 33931 |
ranu |
85 |
<td><span class="target-cell">$target.getTodayAchievedEolTarget()</span> / <span
|
|
|
86 |
class="achieved-cell">$target.getTodayEolTarget()</span></td>
|
| 33917 |
ranu |
87 |
|
| 33931 |
ranu |
88 |
<td><span class="target-cell">$target.getTodayAchievedOtherMovingTarget()</span> / <span
|
|
|
89 |
class="achieved-cell">$target.getTodayOtherMovingTarget()</span></td>
|
| 33917 |
ranu |
90 |
|
| 33931 |
ranu |
91 |
<td><span class="target-cell">$target.getTotalAchievedTarget()</span> / <span
|
|
|
92 |
class="achieved-cell">$target.getTodayTarget()</span></td>
|
| 33917 |
ranu |
93 |
</tr>
|
|
|
94 |
</tbody>
|
|
|
95 |
#end
|
|
|
96 |
|
|
|
97 |
</table>
|
|
|
98 |
</div>
|
|
|
99 |
|
|
|
100 |
|
|
|
101 |
</div>
|
|
|
102 |
|
|
|
103 |
|
| 33930 |
ranu |
104 |
</section>
|
|
|
105 |
|
|
|
106 |
<script>
|
| 33931 |
ranu |
107 |
// Function to format all values in lakhs, converting thousands to lakhs and ignoring hundreds
|
|
|
108 |
function formatValueInLakhs(value) {
|
|
|
109 |
if (value >= 1000) {
|
|
|
110 |
return (value / 100000).toFixed(1) + ' L'; // Convert thousands and above to lakhs
|
| 33930 |
ranu |
111 |
} else {
|
| 33931 |
ranu |
112 |
return '0.0 L'; // Display as 0.0 L for values less than 1000
|
| 33930 |
ranu |
113 |
}
|
|
|
114 |
}
|
|
|
115 |
|
| 33931 |
ranu |
116 |
// Function to format target and achieved values in lakhs, with special handling for target = 0
|
| 33930 |
ranu |
117 |
function formatTargets() {
|
| 33931 |
ranu |
118 |
// Select all rows
|
| 33930 |
ranu |
119 |
const rows = document.querySelectorAll('#rbm-arr-table tbody tr');
|
|
|
120 |
|
|
|
121 |
rows.forEach(row => {
|
| 33931 |
ranu |
122 |
// Find cells that contain both target and achieved values (ACH/TGT)
|
|
|
123 |
const cells = row.querySelectorAll('td');
|
| 33930 |
ranu |
124 |
|
| 33931 |
ranu |
125 |
cells.forEach(cell => {
|
|
|
126 |
// Separate achieved and target values using the `/` separator
|
|
|
127 |
let values = cell.textContent.split('/').map(val => val.trim());
|
| 33930 |
ranu |
128 |
|
| 33931 |
ranu |
129 |
if (values.length === 2) {
|
|
|
130 |
let achievedValue = parseFloat(values[0].replace(/[^\d.-]/g, ''));
|
|
|
131 |
let targetValue = parseFloat(values[1].replace(/[^\d.-]/g, ''));
|
| 33930 |
ranu |
132 |
|
| 33931 |
ranu |
133 |
if (targetValue === 0) {
|
|
|
134 |
// If target is 0, display '-'
|
|
|
135 |
cell.innerHTML = '-';
|
|
|
136 |
} else {
|
|
|
137 |
// Format values to lakhs
|
|
|
138 |
let formattedAchieved = !isNaN(achievedValue) ? formatValueInLakhs(achievedValue) : '0.0 L';
|
|
|
139 |
let formattedTarget = !isNaN(targetValue) ? formatValueInLakhs(targetValue) : '0.0 L';
|
|
|
140 |
|
|
|
141 |
// Replace cell content with formatted values
|
|
|
142 |
cell.innerHTML = `<span class="achieved-cell">${formattedAchieved}</span> / <span class="target-cell">${formattedTarget}</span>`;
|
|
|
143 |
|
|
|
144 |
// Apply green background if achieved >= target
|
|
|
145 |
if (!isNaN(achievedValue) && !isNaN(targetValue) && achievedValue >= targetValue) {
|
|
|
146 |
cell.querySelector('.achieved-cell').style.backgroundColor = '#abf2abd4';
|
|
|
147 |
}
|
|
|
148 |
}
|
| 33930 |
ranu |
149 |
}
|
|
|
150 |
});
|
|
|
151 |
});
|
|
|
152 |
}
|
|
|
153 |
|
|
|
154 |
// Run the function when the page loads or after data is dynamically added to the table
|
|
|
155 |
window.onload = formatTargets; // Call when the page is loaded
|
|
|
156 |
</script>
|
|
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
|
161 |
|
| 33931 |
ranu |
162 |
|
|
|
163 |
|
|
|
164 |
|
|
|
165 |
|