Subversion Repositories SmartDukaan

Rev

Rev 33925 | Rev 33931 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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>
48
                    <th colspan="2" class="text-center">HID</th>
33917 ranu 49
                    <th colspan="2">RUN</th>
50
                    <th colspan="2">SLOW</th>
51
                    <th colspan="2">EOL</th>
52
                    <th colspan="2">Other</th>
53
                    <th colspan="2">Total</th>
54
                </tr>
55
                <tr>
33930 ranu 56
                    <th>TGT</th>
57
                    <th>ACH</th>
33917 ranu 58
 
33930 ranu 59
                    <th>TGT</th>
60
                    <th>ACH</th>
33917 ranu 61
 
33930 ranu 62
                    <th>TGT</th>
63
                    <th>ACH</th>
33917 ranu 64
 
33930 ranu 65
                    <th>TGT</th>
66
                    <th>ACH</th>
33917 ranu 67
 
33930 ranu 68
                    <th>TGT</th>
69
                    <th>ACH</th>
33917 ranu 70
 
33930 ranu 71
                    <th>TGT</th>
72
                    <th>ACH</th>
33917 ranu 73
                </tr>
74
 
75
                </thead>
76
                #foreach($target in $rbmArrViewModels)
77
                    <tbody>
78
                    <tr>
33930 ranu 79
                        <td class="rb-name">$target.getRbmName()- $target.getWarehouseName()</td>
33917 ranu 80
 
33930 ranu 81
                        <td class="target-cell">$target.getTodayHidTarget()</td>
82
                        <td class="achieved-cell">$target.getTodayAchievedHidTarget()</td>
33917 ranu 83
 
33930 ranu 84
                        <td class="target-cell">$target.getTodayFastMovingTarget()</td>
85
                        <td class="achieved-cell">$target.getTodayAchievedFastMovingTarget()</td>
33917 ranu 86
 
33930 ranu 87
                        <td class="target-cell">$target.getTodaySlowMovingTarget()</td>
88
                        <td class="achieved-cell">$target.getTodayAchievedSlowMovingTarget()</td>
33917 ranu 89
 
33930 ranu 90
                        <td class="target-cell">$target.getTodayEolTarget()</td>
91
                        <td class="achieved-cell">$target.getTodayAchievedEolTarget()</td>
33917 ranu 92
 
33930 ranu 93
                        <td class="target-cell">$target.getTodayOtherMovingTarget()</td>
94
                        <td class="achieved-cell">$target.getTodayAchievedOtherMovingTarget()</td>
33917 ranu 95
 
33930 ranu 96
                        <td class="target-cell">$target.getTodayTarget()</td>
97
                        <td class="achieved-cell">$target.getTotalAchievedTarget()</td>
33917 ranu 98
                    </tr>
99
                    </tbody>
100
                #end
101
 
102
            </table>
103
        </div>
104
 
105
 
106
    </div>
107
 
108
 
33930 ranu 109
</section>
110
 
111
<script>
112
    // Function to format the numbers with appropriate abbreviations
113
    function formatValue(value) {
114
        if (value >= 10000000) {  // 1 Crore and above
115
            return (value / 10000000).toFixed(1) + 'Cr'; // 1 Cr = 10,000,000
116
        } else if (value >= 100000) {  // 1 Lakh and above
117
            return (value / 100000).toFixed(1) + 'L'; // 1 Lakh = 100,000
118
        } else if (value >= 1000) {  // 1 Thousand and above
119
            return (value / 1000).toFixed(1) + 'K'; // 1K = 1,000
120
        } else {
121
            return value.toFixed(1); // Show decimals for values below 1000
122
        }
123
    }
124
 
125
    // Function to format all target and achieved values in the table and apply color conditionally
126
    function formatTargets() {
127
        // Select all rows to compare target and achieved cells
128
        const rows = document.querySelectorAll('#rbm-arr-table tbody tr');
129
 
130
        rows.forEach(row => {
131
            // Get all target and achieved cells in the current row
132
            const targetCells = row.querySelectorAll('.target-cell');
133
            const achievedCells = row.querySelectorAll('.achieved-cell');
134
 
135
            targetCells.forEach((targetCell, index) => {
136
                // Convert text content to numeric values
137
                let targetValue = parseFloat(targetCell.textContent.replace(/[^\d.-]/g, ''));
138
                let achievedValue = parseFloat(achievedCells[index].textContent.replace(/[^\d.-]/g, ''));
139
 
140
                // Format both cells with the abbreviated units
141
                if (!isNaN(targetValue)) targetCell.textContent = formatValue(targetValue);
142
                if (!isNaN(achievedValue)) achievedCells[index].textContent = formatValue(achievedValue);
143
 
144
                // Apply green background if achieved value is greater than or equal to target
145
                if (!isNaN(targetValue) && !isNaN(achievedValue) && achievedValue >= targetValue) {
146
                    achievedCells[index].style.backgroundColor = '#abf2abd4';
147
                }
148
            });
149
        });
150
    }
151
 
152
    // Run the function when the page loads or after data is dynamically added to the table
153
    window.onload = formatTargets;  // Call when the page is loaded
154
</script>
155
 
156
 
157
 
158
 
159