| 35775 |
ranu |
1 |
## Model-wise margin results only - no breadcrumbs, no search boxes
|
|
|
2 |
#if($priceCircularItemModels && !$priceCircularItemModels.isEmpty())
|
|
|
3 |
<div class="result-header"
|
|
|
4 |
style="background: #e3f2fd; padding: 8px 12px; border-radius: 4px; margin-bottom: 10px; font-weight: 600; color: #1565c0;">
|
|
|
5 |
<i class="fa fa-mobile"></i> Model: $modelName
|
|
|
6 |
#if($dp)
|
|
|
7 |
<span style="margin-left: 15px; color: #333;">DP: <span class="currency">$dp</span></span>
|
|
|
8 |
#end
|
|
|
9 |
#if($mop)
|
|
|
10 |
<span style="margin-left: 15px; color: #333;">MOP: <span class="currency">$mop</span></span>
|
|
|
11 |
#end
|
|
|
12 |
</div>
|
|
|
13 |
|
|
|
14 |
<div class="alert alert-info" style="font-size: 11px; padding: 8px; margin-bottom: 10px;">
|
|
|
15 |
<i class="fa fa-info-circle"></i>
|
|
|
16 |
Margins shown are as of the selected date. DP/MOP shown are current values.
|
|
|
17 |
</div>
|
|
|
18 |
|
|
|
19 |
<div class="table-responsive">
|
|
|
20 |
<table class="table table-bordered table-condensed" id="modal-circular-table" style="font-size: 12px;">
|
|
|
21 |
<thead>
|
|
|
22 |
#set($rowspan = 1)
|
|
|
23 |
#if($allMargins.size() > 0 || $offers.size() > 0)
|
|
|
24 |
#set($rowspan=2)
|
|
|
25 |
#end
|
|
|
26 |
<tr style="background-color: #f5f5f5;">
|
|
|
27 |
<th rowspan="$rowspan">Model</th>
|
|
|
28 |
<th rowspan=$rowspan>MRP</th>
|
|
|
29 |
<th rowspan=$rowspan>MOP</th>
|
|
|
30 |
<th rowspan=$rowspan>DP</th>
|
|
|
31 |
#if($sellins && $sellins.size() > 0)
|
|
|
32 |
<th colspan="$sellins.size()" style="text-align: center">Sell In</th>
|
|
|
33 |
#end
|
|
|
34 |
#if($sellouts && $sellouts.size() > 0)
|
|
|
35 |
<th colspan="$sellouts.size()" style="text-align: center">Sell Out</th>
|
|
|
36 |
#end
|
|
|
37 |
#set($add=0)
|
|
|
38 |
#if($upgradeOffer)
|
|
|
39 |
<th rowspan=$rowspan>Upgrade</th>
|
|
|
40 |
#set($add=1)
|
|
|
41 |
#end
|
|
|
42 |
#if($offers)
|
|
|
43 |
#foreach($offer in $offers)
|
|
|
44 |
<th colspan=2>$offer.getName()</th>
|
|
|
45 |
#end
|
|
|
46 |
#end
|
|
|
47 |
<th rowspan=$rowspan>NLC</th>
|
|
|
48 |
<th rowspan=$rowspan>MOP-DP</th>
|
|
|
49 |
<th rowspan=$rowspan>Total Margin</th>
|
|
|
50 |
<th rowspan=$rowspan>Net %</th>
|
|
|
51 |
</tr>
|
|
|
52 |
#if($rowspan==2)
|
|
|
53 |
<tr style="background-color: #f5f5f5;">
|
|
|
54 |
#if($allMargins)
|
|
|
55 |
#foreach($marginName in $allMargins)
|
|
|
56 |
<th>$marginName</th>
|
|
|
57 |
#end
|
|
|
58 |
#end
|
|
|
59 |
#if($offers)
|
|
|
60 |
#foreach($offer in $offers)
|
|
|
61 |
<th>Target</th>
|
|
|
62 |
<th>Margin</th>
|
|
|
63 |
#end
|
|
|
64 |
#end
|
|
|
65 |
</tr>
|
|
|
66 |
#end
|
|
|
67 |
</thead>
|
|
|
68 |
<tbody>
|
|
|
69 |
#foreach($priceCircularItemModel in $priceCircularItemModels)
|
|
|
70 |
<tr>
|
|
|
71 |
<td>$priceCircularItemModel.getCatalogSummaryModel().getModelName() $priceCircularItemModel.getCatalogSummaryModel().getModelNumber()</td>
|
|
|
72 |
<td class="currency">$priceCircularItemModel.getCatalogSummaryModel().getMrp()</td>
|
|
|
73 |
<td class="currency mop"
|
|
|
74 |
data-value="$priceCircularItemModel.getCatalogSummaryModel().getMop()">$priceCircularItemModel.getCatalogSummaryModel().getMop()</td>
|
|
|
75 |
<td class="currency dp"
|
|
|
76 |
data-value='$priceCircularItemModel.getCatalogSummaryModel().getDp()'>$priceCircularItemModel.getCatalogSummaryModel().getDp()</td>
|
|
|
77 |
#if($allMargins)
|
|
|
78 |
#foreach($marginName in $allMargins)
|
|
|
79 |
#if ($priceCircularItemModel.getHeaderSchemeModelsMap().containsKey($marginName))
|
|
|
80 |
<td class="currency margin"
|
|
|
81 |
data-value='$mvcResponseSender.createResponseString($priceCircularItemModel.getHeaderSchemeModelsMap().get($marginName))'>$mvcResponseSender.createResponseString($priceCircularItemModel.getHeaderSchemeModelsMap().get($marginName))</td>
|
|
|
82 |
#else
|
|
|
83 |
<td>-</td>
|
|
|
84 |
#end
|
|
|
85 |
#end
|
|
|
86 |
#end
|
|
|
87 |
#if($upgradeOffer)
|
|
|
88 |
<td class="currency">$priceCircularItemModel.getUpgradeOffer()</td>
|
|
|
89 |
#end
|
|
|
90 |
#foreach($slabPayouts in $priceCircularItemModel.getSlabPayouts())
|
|
|
91 |
#if($slabPayouts && $slabPayouts.size()>0)
|
|
|
92 |
<td>
|
|
|
93 |
<select class="modal-mk-criteria-slab form-control input-sm"
|
|
|
94 |
data-value='$slabPayouts.entrySet().iterator().next().getValue()'
|
|
|
95 |
style="width: 70px; font-size: 10px; padding: 2px;">
|
|
|
96 |
#foreach($payout in $slabPayouts.entrySet())
|
|
|
97 |
<option value='$mvcResponseSender.createResponseString($payout.getValue())'>$payout.getKey()
|
|
|
98 |
+
|
|
|
99 |
</option>
|
|
|
100 |
#end
|
|
|
101 |
</select>
|
|
|
102 |
</td>
|
|
|
103 |
<td class="currency margin"
|
|
|
104 |
data-value='$mvcResponseSender.createResponseString($slabPayouts.values().iterator().next())'>
|
|
|
105 |
$mvcResponseSender.createResponseString($slabPayouts.values().iterator().next())
|
|
|
106 |
</td>
|
|
|
107 |
#else
|
|
|
108 |
<td>-</td>
|
|
|
109 |
<td>-</td>
|
|
|
110 |
#end
|
|
|
111 |
#end
|
|
|
112 |
<td class="currency netprice">-</td>
|
|
|
113 |
<td class="currency dpmop">-</td>
|
|
|
114 |
<td class="currency totalmargin">-</td>
|
|
|
115 |
<td class="netmargin">-</td>
|
|
|
116 |
</tr>
|
|
|
117 |
#end
|
|
|
118 |
</tbody>
|
|
|
119 |
</table>
|
|
|
120 |
</div>
|
|
|
121 |
|
|
|
122 |
<script type="text/javascript">
|
|
|
123 |
$(document).ready(function () {
|
|
|
124 |
$('#modal-circular-table').find('tr').each(function (i, el) {
|
|
|
125 |
setModalMargins(el);
|
|
|
126 |
});
|
|
|
127 |
});
|
|
|
128 |
|
|
|
129 |
$('select.modal-mk-criteria-slab').change(function () {
|
|
|
130 |
let tdPayout = $(this).closest('td').next();
|
|
|
131 |
tdPayout.data("value", JSON.parse($(this).val()));
|
|
|
132 |
setModalMargins($(this).closest('tr'));
|
|
|
133 |
});
|
|
|
134 |
|
|
|
135 |
function setModalMargins(trContainer) {
|
|
|
136 |
let dp = $(trContainer).find('.dp').data("value");
|
|
|
137 |
if (dp == undefined) return;
|
|
|
138 |
let mop = $(trContainer).find('.mop').data('value');
|
|
|
139 |
let totalMargin = 0;
|
|
|
140 |
if ($(trContainer).find('.margin').length > 0) {
|
|
|
141 |
let fixedMargin = 0;
|
|
|
142 |
let percentageMargin = 0;
|
|
|
143 |
$(trContainer).find('.margin').each(function (i, ele) {
|
|
|
144 |
let amountModel = $(ele).data('value');
|
|
|
145 |
if (amountModel && amountModel.amountType == 'FIXED') {
|
|
|
146 |
if (!amountModel.discount)
|
|
|
147 |
fixedMargin += amountModel.amount;
|
|
|
148 |
} else if (amountModel && amountModel.amountType == 'PERCENTAGE') {
|
|
|
149 |
percentageMargin += amountModel.amount;
|
|
|
150 |
}
|
|
|
151 |
});
|
|
|
152 |
let effectiveDp = dp - fixedMargin;
|
|
|
153 |
let percentageValue = effectiveDp / (100 + percentageMargin);
|
|
|
154 |
$(trContainer).find('.margin').each(function (i, ele) {
|
|
|
155 |
let amountModel = $(ele).data('value');
|
|
|
156 |
if (amountModel && amountModel.amountType == 'PERCENTAGE') {
|
|
|
157 |
$(ele).html(numberToComma(percentageValue * amountModel.amount));
|
|
|
158 |
totalMargin += percentageValue * amountModel.amount;
|
|
|
159 |
} else if (amountModel) {
|
|
|
160 |
$(ele).html(numberToComma(amountModel.amount));
|
|
|
161 |
totalMargin += amountModel.amount;
|
|
|
162 |
}
|
|
|
163 |
});
|
|
|
164 |
}
|
|
|
165 |
let dpmop = mop - dp;
|
|
|
166 |
let nlc = dp - totalMargin;
|
|
|
167 |
$(trContainer).find('.netprice').html(numberToComma(nlc));
|
|
|
168 |
$(trContainer).find('.dpmop').html(numberToComma(dpmop));
|
|
|
169 |
totalMargin += dpmop;
|
|
|
170 |
$(trContainer).find('.totalmargin').html(numberToComma(totalMargin));
|
|
|
171 |
$(trContainer).find('.netmargin').html(numberToComma(totalMargin * 100 / (nlc)) + '%');
|
|
|
172 |
}
|
|
|
173 |
</script>
|
|
|
174 |
#else
|
|
|
175 |
<div class="text-center" style="padding: 30px; color: #666;">
|
|
|
176 |
<i class="fa fa-info-circle fa-2x" style="margin-bottom: 10px;"></i>
|
|
|
177 |
<p>No margin data found for this model on the selected date</p>
|
|
|
178 |
</div>
|
|
|
179 |
#end
|