Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
30471 amit.gupta 1
<style>
2
    .table {
3
        background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='100px' width='100px'><text transform='translate(20, 100) rotate(-45)' fill='rgb(211,211,211)' font-size='20'>$partnerCode</text></svg>");
4
    }
28102 tejbeer 5
 
30471 amit.gupta 6
    .highlight-br {
7
        border-right: 1px solid #aaa !important;
8
    }
28117 tejbeer 9
</style>
28134 tejbeer 10
 
11
<script type="text/javascript">
30471 amit.gupta 12
    $(document).ready(function () {
28139 tejbeer 13
 
30471 amit.gupta 14
 
15
    });
28134 tejbeer 16
</script>
28109 tejbeer 17
 
28139 tejbeer 18
<body>
30471 amit.gupta 19
<div class="col-lg-12">
20
    <h4>Note</h4>
21
    <b>Hygiene Payout</b> - Hygiene Payout calculation is subject to sales
22
    hygiene including customer & other details entered in the system, pl
23
    refer to hygiene meter in your Dashboard.<br> <b>Tertiary
24
    Payout</b> - Tertiary Payout calculation is subject to activation of the
25
    handset against the sales entered in system. <br> <b>Investment
26
    Payout</b> - Investment Payout calculation is subject to maintenance of
27
    90% of minimum Investments for minimum 12 days in a month as per below
28
    slabs
29
    <ul>
30
        <li>a) 2% in case minimum investment is 90% or above for 12 days
31
            or more in a month
32
        </li>
33
        <li>b) 1% in case of minimum investment is 90% or above for 8-11
34
            days in a month
35
        </li>
36
        <li>c) No payout in case of minimum investment is less than 8
37
            days in a month.
38
        </li>
39
    </ul>
40
    <b>Below Price Structure is subject to change at the discretion of
41
        SmartDukaan.</b>
28102 tejbeer 42
 
30471 amit.gupta 43
</div>
28102 tejbeer 44
 
30471 amit.gupta 45
<div class="col-lg-12">
46
    <table class="table table-border table-condensed table-bordered"
47
           id="circular-table">
28102 tejbeer 48
 
31215 amit.gupta 49
        <thead>
31234 amit.gupta 50
            #set($rowspan = 1)
51
            #if($allMargins.size() > 0 || $offers.size() > 0)
52
                #set($rowspan=2)
31215 amit.gupta 53
            #end
54
 
55
        <tr>
32026 amit.gupta 56
            <th rowspan="$rowspan">Model Id</th>
31232 amit.gupta 57
            <th rowspan=$rowspan>Model</th>
58
            <th rowspan=$rowspan>Type</th>
59
            <th rowspan=$rowspan>MRP</th>
60
            <th rowspan=$rowspan>MOP</th>
61
            <th rowspan=$rowspan>DP</th>
31215 amit.gupta 62
            #if($sellins.size() > 0)
63
                <th colspan="$sellins.size()" style="text-align: center">Sell In</th>
64
            #end
65
            #if($sellouts.size() > 0)
66
                <th colspan="$sellouts.size()" style="text-align: center
67
                ">Sell Out
68
                </th>
69
            #end
70
            #set($add=0)
71
            #if($upgradeOffer)
31232 amit.gupta 72
                <th rowspan=$rowspan>Upgrade Offer</th>
31215 amit.gupta 73
                #set($add=1)
74
            #end
75
            #foreach($offer in $offers)
76
                #set($fieldIndex=$velocityCount*2 + (4 + $allMargins.size() + $add))
77
                <th data-idx="$fieldIndex" colspan=2 data-offerid="$offer.getId()"><a href="javascript:void(0)"
78
                                                                                      class="mk_partner_view">$offer.getName()</a>
79
                </th>
80
            #end
31903 amit.gupta 81
            <th rowspan=$rowspan>NLC</th>
82
            <th rowspan=$rowspan>MOP-DP</th>
31232 amit.gupta 83
            <th rowspan=$rowspan>Total Margin</th>
84
            <th rowspan=$rowspan>Net % Margin</th>
31215 amit.gupta 85
 
86
        </tr>
31233 amit.gupta 87
            #if($rowspan==2)
31215 amit.gupta 88
            <tr>
89
                #foreach($marginName in $allMargins)
90
                    <th>$marginName</th>
91
                #end
92
                #foreach($offer in $offers)
93
                    <th>Target</th>
94
                    <th>Margin</th>
95
                #end
96
            </tr>
97
            #end
98
        </thead>
31233 amit.gupta 99
        <tbody>
31903 amit.gupta 100
            #foreach($priceCircularItemModel in $priceCircularItemModels )
31233 amit.gupta 101
            <tr>
32026 amit.gupta 102
                <td>$priceCircularItemModel.getCatalogSummaryModel().getCatalogId()</td>
31903 amit.gupta 103
                <td>$priceCircularItemModel.getCatalogSummaryModel().getModelName() $priceCircularItemModel.getCatalogSummaryModel().getModelNumber()</td>
104
                <td>$priceCircularItemModel.getCatalogSummaryModel().getCategory()</td>
105
                <td class="currency">$priceCircularItemModel.getCatalogSummaryModel().getMrp()</td>
106
                <td class="currency mop"
107
                    data-value="$priceCircularItemModel.getCatalogSummaryModel().getMop()">$priceCircularItemModel.getCatalogSummaryModel().getMop()</td>
108
                <td class="currency dp"
109
                    data-value='$priceCircularItemModel.getCatalogSummaryModel().getDp()'>$priceCircularItemModel.getCatalogSummaryModel().getDp()</td>
31233 amit.gupta 110
                #foreach($marginName in $allMargins)
31903 amit.gupta 111
                    #if ($priceCircularItemModel.getHeaderSchemeModelsMap().containsKey($marginName))
112
                        <td class="currency margin"
113
                            data-value='$mvcResponseSender.createResponseString($priceCircularItemModel.getHeaderSchemeModelsMap().get($marginName))'>$mvcResponseSender.createResponseString($priceCircularItemModel.getHeaderSchemeModelsMap().get($marginName))</td>
114
                    #else
115
                        <td>-</td>
116
                    #end
31233 amit.gupta 117
                #end
118
                #if($upgradeOffer)
31903 amit.gupta 119
                    <td class="currency">$priceCircularItemModel.getUpgradeOffer()</td>
31233 amit.gupta 120
                #end
31903 amit.gupta 121
                #foreach($slabPayouts in $priceCircularItemModel.getSlabPayouts())
31233 amit.gupta 122
                    #if($slabPayouts && $slabPayouts.size()>0)
123
                        <td>
124
                            <select class="mk_criteria_slab"
31903 amit.gupta 125
                                    data-value='$slabPayouts.entrySet().iterator().next().getValue()'>
31233 amit.gupta 126
                                #foreach($payout in $slabPayouts.entrySet())
31903 amit.gupta 127
                                    <option value='$mvcResponseSender.createResponseString($payout.getValue())'>$payout.getKey()
31233 amit.gupta 128
                                        onwards
129
                                    </option>
130
                                #end
131
                            </select>
132
                        </td>
31903 amit.gupta 133
                        <td class="currency margin"
134
                            data-value='$mvcResponseSender.createResponseString($slabPayouts.values().iterator().next())'>
135
                            $mvcResponseSender.createResponseString($slabPayouts.values().iterator().next())
136
                        </td>
31233 amit.gupta 137
                    #else
138
                        <td> -</td>
139
                        <td> -</td>
140
                    #end
141
                #end
31903 amit.gupta 142
                <td class="currency netprice">-</td>
143
                <td class="currency dpmop">-</td>
144
                <td class="currency totalmargin">-</td>
145
                <td class="netmargin">-</td>
31233 amit.gupta 146
 
147
            </tr>
148
            #end
149
        </tbody>
30471 amit.gupta 150
    </table>
151
</div>
28102 tejbeer 152
 
30471 amit.gupta 153
<div class="offer-margin-container">
154
    <div class="modal  text-center" id="offerDescription">
155
        <div class="modal-dialog modal-lg modal-dialog-scrollable">
156
            <div class="modal-content">
29785 amit.gupta 157
            </div>
158
        </div>
30471 amit.gupta 159
    </div>
160
</div>
28139 tejbeer 161
</body>
28102 tejbeer 162
<script type="text/javascript">
30471 amit.gupta 163
    $(document).ready(function () {
31903 amit.gupta 164
        $('#circular-table').find('tr').each(function (i, el) {
165
            setMargins(el);
166
        });
30471 amit.gupta 167
        priceCircularTable = $('#circular-table').DataTable({
168
            "scrollX": true,
169
            "bPaginate": true,
170
            "bLengthChange": true,
171
            "bFilter": true,
172
            "bInfo": false,
173
            "bAutoWidth": false,
32026 amit.gupta 174
            "pageLength": 100,
175
            lengthMenu: [
176
                [100, -1],
177
                [100, 'All'],
178
            ]
30471 amit.gupta 179
        });
31903 amit.gupta 180
        //setMargins();
30471 amit.gupta 181
    });
31903 amit.gupta 182
 
30471 amit.gupta 183
    $('select.mk_criteria_slab').change(function () {
31903 amit.gupta 184
        let tdPayout = $(this).closest('td').next();
185
        tdPayout.data("value", JSON.parse($(this).val()));
186
        console.log("--------" + tdPayout.data('value'));
187
        setMargins($(this).closest('tr'));
188
        priceCircularTable.draw();
189
    });
30471 amit.gupta 190
 
31903 amit.gupta 191
    function setMargins(trContainer) {
192
        let dp = $(trContainer).find('.dp').data("value");
193
        if (dp == undefined) return;
194
        let mop = $(trContainer).find('.mop').data('value');
195
        let totalMargin = 0;
196
        if ($(trContainer).find('.margin').length > 0) {
197
            let fixedMargin = 0;
198
            let percentageMargin = 0;
199
            $(trContainer).find('.margin').each(function (i, ele) {
200
                let amountModel = $(ele).data('value');
201
                //console.log(amountModel);
202
                if (amountModel.amountType == 'FIXED') {
32022 amit.gupta 203
                    if (!amountModel.discount)
204
                        fixedMargin += amountModel.amount;
31903 amit.gupta 205
                } else if (amountModel.amountType == 'PERCENTAGE') {
206
                    percentageMargin += amountModel.amount;
207
                }
208
            });
209
            let effectiveDp = dp - fixedMargin;
210
            console.log(fixedMargin);
211
            let percentageValue = effectiveDp / (100 + percentageMargin);
212
            console.log(percentageValue + "(" + percentageMargin + "%)");
213
            $(trContainer).find('.margin').each(function (i, ele) {
214
                let amountModel = $(ele).data('value');
215
                //console.log(amountModel);
216
                if (amountModel.amountType == 'PERCENTAGE') {
217
                    $(ele).html(numberToComma(percentageValue * amountModel.amount));
218
                    totalMargin += percentageValue * amountModel.amount;
219
                } else {
220
                    $(ele).html(numberToComma(amountModel.amount));
221
                    totalMargin += amountModel.amount;
222
                }
223
            });
224
        }
225
        let dpmop = mop - dp;
226
        let nlc = dp - totalMargin;
227
        $(trContainer).find('.netprice').html(numberToComma(nlc));
228
        $(trContainer).find('.dpmop').html(numberToComma(dpmop));
229
        totalMargin += dpmop;
230
        $(trContainer).find('.totalmargin').html(numberToComma(totalMargin));
231
        //debugger;
232
        $(trContainer).find('.netmargin').html(numberToComma(totalMargin * 100 / (nlc)) + '%');
233
        //priceCircularTable.draw();
234
    }
30471 amit.gupta 235
 
28102 tejbeer 236
</script>