Subversion Repositories SmartDukaan

Rev

Rev 32026 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 32026 Rev 32331
Line 5... Line 5...
5
 
5
 
6
    .highlight-br {
6
    .highlight-br {
7
        border-right: 1px solid #aaa !important;
7
        border-right: 1px solid #aaa !important;
8
    }
8
    }
9
</style>
9
</style>
10
 
-
 
11
<script type="text/javascript">
-
 
12
    $(document).ready(function () {
-
 
13
 
-
 
14
 
-
 
15
    });
-
 
16
</script>
-
 
17
 
-
 
18
<body>
-
 
19
<div class="col-lg-12">
10
<div class="col-lg-12">
20
    <h4>Note</h4>
11
    <h4>Note</h4>
21
    <b>Hygiene Payout</b> - Hygiene Payout calculation is subject to sales
12
    <b>Hygiene Payout</b> - Hygiene Payout calculation is subject to sales
22
    hygiene including customer & other details entered in the system, pl
13
    hygiene including customer & other details entered in the system, pl
23
    refer to hygiene meter in your Dashboard.<br> <b>Tertiary
14
    refer to hygiene meter in your Dashboard.<br> <b>Tertiary
Line 40... Line 31...
40
    <b>Below Price Structure is subject to change at the discretion of
31
    <b>Below Price Structure is subject to change at the discretion of
41
        SmartDukaan.</b>
32
        SmartDukaan.</b>
42
 
33
 
43
</div>
34
</div>
44
 
35
 
45
<div class="col-lg-12">
-
 
46
    <table class="table table-border table-condensed table-bordered"
-
 
47
           id="circular-table">
-
 
48
 
-
 
49
        <thead>
-
 
50
            #set($rowspan = 1)
-
 
51
            #if($allMargins.size() > 0 || $offers.size() > 0)
-
 
52
                #set($rowspan=2)
-
 
53
            #end
-
 
54
 
-
 
55
        <tr>
-
 
56
            <th rowspan="$rowspan">Model Id</th>
-
 
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>
-
 
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)
-
 
72
                <th rowspan=$rowspan>Upgrade Offer</th>
-
 
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
-
 
81
            <th rowspan=$rowspan>NLC</th>
-
 
82
            <th rowspan=$rowspan>MOP-DP</th>
-
 
83
            <th rowspan=$rowspan>Total Margin</th>
-
 
84
            <th rowspan=$rowspan>Net % Margin</th>
-
 
85
 
-
 
86
        </tr>
-
 
87
            #if($rowspan==2)
-
 
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>
-
 
99
        <tbody>
-
 
100
            #foreach($priceCircularItemModel in $priceCircularItemModels )
-
 
101
            <tr>
-
 
102
                <td>$priceCircularItemModel.getCatalogSummaryModel().getCatalogId()</td>
-
 
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>
-
 
110
                #foreach($marginName in $allMargins)
-
 
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
-
 
117
                #end
-
 
118
                #if($upgradeOffer)
-
 
119
                    <td class="currency">$priceCircularItemModel.getUpgradeOffer()</td>
-
 
120
                #end
-
 
121
                #foreach($slabPayouts in $priceCircularItemModel.getSlabPayouts())
-
 
122
                    #if($slabPayouts && $slabPayouts.size()>0)
-
 
123
                        <td>
-
 
124
                            <select class="mk_criteria_slab"
-
 
125
                                    data-value='$slabPayouts.entrySet().iterator().next().getValue()'>
-
 
126
                                #foreach($payout in $slabPayouts.entrySet())
-
 
127
                                    <option value='$mvcResponseSender.createResponseString($payout.getValue())'>$payout.getKey()
-
 
128
                                        onwards
-
 
129
                                    </option>
-
 
130
                                #end
-
 
131
                            </select>
-
 
132
                        </td>
-
 
133
                        <td class="currency margin"
-
 
134
                            data-value='$mvcResponseSender.createResponseString($slabPayouts.values().iterator().next())'>
-
 
135
                            $mvcResponseSender.createResponseString($slabPayouts.values().iterator().next())
-
 
136
                        </td>
-
 
137
                    #else
-
 
138
                        <td> -</td>
-
 
139
                        <td> -</td>
-
 
140
                    #end
-
 
141
                #end
-
 
142
                <td class="currency netprice">-</td>
-
 
143
                <td class="currency dpmop">-</td>
-
 
144
                <td class="currency totalmargin">-</td>
-
 
145
                <td class="netmargin">-</td>
-
 
146
 
-
 
147
            </tr>
-
 
148
            #end
-
 
149
        </tbody>
-
 
150
    </table>
-
 
151
</div>
-
 
152
 
-
 
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">
-
 
157
            </div>
-
 
158
        </div>
-
 
159
    </div>
-
 
160
</div>
-
 
161
</body>
-
 
162
<script type="text/javascript">
-
 
163
    $(document).ready(function () {
-
 
164
        $('#circular-table').find('tr').each(function (i, el) {
-
 
165
            setMargins(el);
-
 
166
        });
-
 
167
        priceCircularTable = $('#circular-table').DataTable({
-
 
168
            "scrollX": true,
-
 
169
            "bPaginate": true,
-
 
170
            "bLengthChange": true,
-
 
171
            "bFilter": true,
-
 
172
            "bInfo": false,
-
 
173
            "bAutoWidth": false,
-
 
174
            "pageLength": 100,
-
 
175
            lengthMenu: [
-
 
176
                [100, -1],
-
 
177
                [100, 'All'],
-
 
178
            ]
-
 
179
        });
-
 
180
        //setMargins();
-
 
181
    });
-
 
182
 
-
 
183
    $('select.mk_criteria_slab').change(function () {
-
 
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
    });
-
 
190
 
-
 
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') {
-
 
203
                    if (!amountModel.discount)
-
 
204
                        fixedMargin += amountModel.amount;
-
 
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
    }
-
 
235
 
-
 
236
</script>
-
 
237
36
#parse("price-circular-table.vm")
-
 
37
238
38