Blame | Last modification | View Log | RSS feed
## Model-wise margin results only - no breadcrumbs, no search boxes#if($priceCircularItemModels && !$priceCircularItemModels.isEmpty())<div class="result-header"style="background: #e3f2fd; padding: 8px 12px; border-radius: 4px; margin-bottom: 10px; font-weight: 600; color: #1565c0;"><i class="fa fa-mobile"></i> Model: $modelName#if($dp)<span style="margin-left: 15px; color: #333;">DP: <span class="currency">$dp</span></span>#end#if($mop)<span style="margin-left: 15px; color: #333;">MOP: <span class="currency">$mop</span></span>#end</div><div class="alert alert-info" style="font-size: 11px; padding: 8px; margin-bottom: 10px;"><i class="fa fa-info-circle"></i>Margins shown are as of the selected date. DP/MOP shown are current values.</div><div class="table-responsive"><table class="table table-bordered table-condensed" id="modal-circular-table" style="font-size: 12px;"><thead>#set($rowspan = 1)#if($allMargins.size() > 0 || $offers.size() > 0)#set($rowspan=2)#end<tr style="background-color: #f5f5f5;"><th rowspan="$rowspan">Model</th><th rowspan=$rowspan>MRP</th><th rowspan=$rowspan>MOP</th><th rowspan=$rowspan>DP</th>#if($sellins && $sellins.size() > 0)<th colspan="$sellins.size()" style="text-align: center">Sell In</th>#end#if($sellouts && $sellouts.size() > 0)<th colspan="$sellouts.size()" style="text-align: center">Sell Out</th>#end#set($add=0)#if($upgradeOffer)<th rowspan=$rowspan>Upgrade</th>#set($add=1)#end#if($offers)#foreach($offer in $offers)<th colspan=2>$offer.getName()</th>#end#end<th rowspan=$rowspan>NLC</th><th rowspan=$rowspan>MOP-DP</th><th rowspan=$rowspan>Total Margin</th><th rowspan=$rowspan>Net %</th></tr>#if($rowspan==2)<tr style="background-color: #f5f5f5;">#if($allMargins)#foreach($marginName in $allMargins)<th>$marginName</th>#end#end#if($offers)#foreach($offer in $offers)<th>Target</th><th>Margin</th>#end#end</tr>#end</thead><tbody>#foreach($priceCircularItemModel in $priceCircularItemModels)<tr><td>$priceCircularItemModel.getCatalogSummaryModel().getModelName() $priceCircularItemModel.getCatalogSummaryModel().getModelNumber()</td><td class="currency">$priceCircularItemModel.getCatalogSummaryModel().getMrp()</td><td class="currency mop"data-value="$priceCircularItemModel.getCatalogSummaryModel().getMop()">$priceCircularItemModel.getCatalogSummaryModel().getMop()</td><td class="currency dp"data-value='$priceCircularItemModel.getCatalogSummaryModel().getDp()'>$priceCircularItemModel.getCatalogSummaryModel().getDp()</td>#if($allMargins)#foreach($marginName in $allMargins)#if ($priceCircularItemModel.getHeaderSchemeModelsMap().containsKey($marginName))<td class="currency margin"data-value='$mvcResponseSender.createResponseString($priceCircularItemModel.getHeaderSchemeModelsMap().get($marginName))'>$mvcResponseSender.createResponseString($priceCircularItemModel.getHeaderSchemeModelsMap().get($marginName))</td>#else<td>-</td>#end#end#end#if($upgradeOffer)<td class="currency">$priceCircularItemModel.getUpgradeOffer()</td>#end#foreach($slabPayouts in $priceCircularItemModel.getSlabPayouts())#if($slabPayouts && $slabPayouts.size()>0)<td><select class="modal-mk-criteria-slab form-control input-sm"data-value='$slabPayouts.entrySet().iterator().next().getValue()'style="width: 70px; font-size: 10px; padding: 2px;">#foreach($payout in $slabPayouts.entrySet())<option value='$mvcResponseSender.createResponseString($payout.getValue())'>$payout.getKey()+</option>#end</select></td><td class="currency margin"data-value='$mvcResponseSender.createResponseString($slabPayouts.values().iterator().next())'>$mvcResponseSender.createResponseString($slabPayouts.values().iterator().next())</td>#else<td>-</td><td>-</td>#end#end<td class="currency netprice">-</td><td class="currency dpmop">-</td><td class="currency totalmargin">-</td><td class="netmargin">-</td></tr>#end</tbody></table></div><script type="text/javascript">$(document).ready(function () {$('#modal-circular-table').find('tr').each(function (i, el) {setModalMargins(el);});});$('select.modal-mk-criteria-slab').change(function () {let tdPayout = $(this).closest('td').next();tdPayout.data("value", JSON.parse($(this).val()));setModalMargins($(this).closest('tr'));});function setModalMargins(trContainer) {let dp = $(trContainer).find('.dp').data("value");if (dp == undefined) return;let mop = $(trContainer).find('.mop').data('value');let totalMargin = 0;if ($(trContainer).find('.margin').length > 0) {let fixedMargin = 0;let percentageMargin = 0;$(trContainer).find('.margin').each(function (i, ele) {let amountModel = $(ele).data('value');if (amountModel && amountModel.amountType == 'FIXED') {if (!amountModel.discount)fixedMargin += amountModel.amount;} else if (amountModel && amountModel.amountType == 'PERCENTAGE') {percentageMargin += amountModel.amount;}});let effectiveDp = dp - fixedMargin;let percentageValue = effectiveDp / (100 + percentageMargin);$(trContainer).find('.margin').each(function (i, ele) {let amountModel = $(ele).data('value');if (amountModel && amountModel.amountType == 'PERCENTAGE') {$(ele).html(numberToComma(percentageValue * amountModel.amount));totalMargin += percentageValue * amountModel.amount;} else if (amountModel) {$(ele).html(numberToComma(amountModel.amount));totalMargin += amountModel.amount;}});}let dpmop = mop - dp;let nlc = dp - totalMargin;$(trContainer).find('.netprice').html(numberToComma(nlc));$(trContainer).find('.dpmop').html(numberToComma(dpmop));totalMargin += dpmop;$(trContainer).find('.totalmargin').html(numberToComma(totalMargin));$(trContainer).find('.netmargin').html(numberToComma(totalMargin * 100 / (nlc)) + '%');}</script>#else<div class="text-center" style="padding: 30px; color: #666;"><i class="fa fa-info-circle fa-2x" style="margin-bottom: 10px;"></i><p>No margin data found for this model on the selected date</p></div>#end