Subversion Repositories SmartDukaan

Rev

Rev 33939 | Rev 33944 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 33939 Rev 33942
Line 87... Line 87...
87
                                class="target-cell">$target.getTodayOtherMovingTarget()</span></td>
87
                                class="target-cell">$target.getTodayOtherMovingTarget()</span></td>
88
                        <td class="other-percent"></td>
88
                        <td class="other-percent"></td>
89
                    </tr>
89
                    </tr>
90
                    #end
90
                    #end
91
                </tbody>
91
                </tbody>
-
 
92
                <tfoot>
-
 
93
                <tr>
-
 
94
                    <td><strong>Total</strong></td>
-
 
95
                    <td><span id="total-achieved"></span> / <span id="total-target"></span></td>
-
 
96
                    <td class="total-percent"></td>
-
 
97
                    <td><span id="total-achieved-hid"></span> / <span id="total-target-hid"></span></td>
-
 
98
                    <td class="hid-percent"></td>
-
 
99
                    <td><span id="total-achieved-run"></span> / <span id="total-target-run"></span></td>
-
 
100
                    <td class="run-percent"></td>
-
 
101
                    <td><span id="total-achieved-slow"></span> / <span id="total-target-slow"></span></td>
-
 
102
                    <td class="slow-percent"></td>
-
 
103
                    <td><span id="total-achieved-eol"></span> / <span id="total-target-eol"></span></td>
-
 
104
                    <td class="eol-percent"></td>
-
 
105
                    <td><span id="total-achieved-other"></span> / <span id="total-target-other"></span></td>
-
 
106
                    <td class="other-percent"></td>
-
 
107
                </tr>
-
 
108
                </tfoot>
92
            </table>
109
            </table>
93
        </div>
110
        </div>
94
    </div>
111
    </div>
95
</section>
112
</section>
96
 
113
 
Line 99... Line 116...
99
        return (value / 100000).toFixed(1) + 'L';
116
        return (value / 100000).toFixed(1) + 'L';
100
    }
117
    }
101
 
118
 
102
    function formatTargets() {
119
    function formatTargets() {
103
        const rows = document.querySelectorAll('#rbm-arr-table tbody tr');
120
        const rows = document.querySelectorAll('#rbm-arr-table tbody tr');
-
 
121
        let totalAchieved = 0, totalTarget = 0;
-
 
122
        let totalAchievedHid = 0, totalTargetHid = 0;
-
 
123
        let totalAchievedRun = 0, totalTargetRun = 0;
-
 
124
        let totalAchievedSlow = 0, totalTargetSlow = 0;
-
 
125
        let totalAchievedEol = 0, totalTargetEol = 0;
-
 
126
        let totalAchievedOther = 0, totalTargetOther = 0;
104
 
127
 
105
        rows.forEach(row => {
128
        rows.forEach(row => {
106
            const cells = row.querySelectorAll('td');
129
            const cells = row.querySelectorAll('td');
107
 
-
 
108
            cells.forEach(cell => {
130
            cells.forEach((cell, index) => {
109
                const achievedSpan = cell.querySelector('.achieved-cell');
131
                const achievedSpan = cell.querySelector('.achieved-cell');
110
                const targetSpan = cell.querySelector('.target-cell');
132
                const targetSpan = cell.querySelector('.target-cell');
111
 
-
 
112
                if (achievedSpan && targetSpan) {
133
                if (achievedSpan && targetSpan) {
113
                    const achievedValue = parseFloat(achievedSpan.textContent.replace(/[^\d.-]/g, ''));
134
                    const achievedValue = parseFloat(achievedSpan.textContent.replace(/[^\d.-]/g, ''));
114
                    const targetValue = parseFloat(targetSpan.textContent.replace(/[^\d.-]/g, ''));
135
                    const targetValue = parseFloat(targetSpan.textContent.replace(/[^\d.-]/g, ''));
115
 
136
 
-
 
137
                    // Add to totals
-
 
138
                    if (index === 1) {
-
 
139
                        totalAchieved += achievedValue || 0;
-
 
140
                        totalTarget += targetValue || 0;
-
 
141
                    } else if (index === 3) {
-
 
142
                        totalAchievedHid += achievedValue || 0;
-
 
143
                        totalTargetHid += targetValue || 0;
-
 
144
                    } else if (index === 5) {
-
 
145
                        totalAchievedRun += achievedValue || 0;
-
 
146
                        totalTargetRun += targetValue || 0;
-
 
147
                    } else if (index === 7) {
-
 
148
                        totalAchievedSlow += achievedValue || 0;
-
 
149
                        totalTargetSlow += targetValue || 0;
-
 
150
                    } else if (index === 9) {
-
 
151
                        totalAchievedEol += achievedValue || 0;
-
 
152
                        totalTargetEol += targetValue || 0;
-
 
153
                    } else if (index === 11) {
-
 
154
                        totalAchievedOther += achievedValue || 0;
-
 
155
                        totalTargetOther += targetValue || 0;
-
 
156
                    }
-
 
157
 
116
                    // Format values in lakh
158
                    // Format values in lakh
117
                    if (!isNaN(achievedValue)) achievedSpan.textContent = formatValueInLakh(achievedValue);
159
                    if (!isNaN(achievedValue)) achievedSpan.textContent = formatValueInLakh(achievedValue);
118
                    if (!isNaN(targetValue)) targetSpan.textContent = formatValueInLakh(targetValue);
160
                    if (!isNaN(targetValue)) targetSpan.textContent = formatValueInLakh(targetValue);
119
 
161
 
120
                    const percentCell = cell.nextElementSibling;
162
                    const percentCell = cell.nextElementSibling;
Line 139... Line 181...
139
                        percentCell.style.background = 'none';
181
                        percentCell.style.background = 'none';
140
                    }
182
                    }
141
                }
183
                }
142
            });
184
            });
143
        });
185
        });
-
 
186
 
-
 
187
        // Update total row with calculated totals
-
 
188
        document.getElementById('total-achieved').textContent = formatValueInLakh(totalAchieved);
-
 
189
        document.getElementById('total-target').textContent = formatValueInLakh(totalTarget);
-
 
190
        document.getElementById('total-achieved-hid').textContent = formatValueInLakh(totalAchievedHid);
-
 
191
        document.getElementById('total-target-hid').textContent = formatValueInLakh(totalTargetHid);
-
 
192
        document.getElementById('total-achieved-run').textContent = formatValueInLakh(totalAchievedRun);
-
 
193
        document.getElementById('total-target-run').textContent = formatValueInLakh(totalTargetRun);
-
 
194
        document.getElementById('total-achieved-slow').textContent = formatValueInLakh(totalAchievedSlow);
-
 
195
        document.getElementById('total-target-slow').textContent = formatValueInLakh(totalTargetSlow);
-
 
196
        document.getElementById('total-achieved-eol').textContent = formatValueInLakh(totalAchievedEol);
-
 
197
        document.getElementById('total-target-eol').textContent = formatValueInLakh(totalTargetEol);
-
 
198
        document.getElementById('total-achieved-other').textContent = formatValueInLakh(totalAchievedOther);
-
 
199
        document.getElementById('total-target-other').textContent = formatValueInLakh(totalTargetOther);
144
    }
200
    }
145
 
201
 
146
    window.onload = formatTargets;
202
    window.onload = formatTargets;
147
</script>
203
</script>
148
 
204