dc79404a by pramila

Calculate income on client site (onchange lc and lcamt calculate Income Achievement)

1 parent c92ad136
...@@ -35,7 +35,7 @@ if(Auth::user()->id=="1" || Auth::user()->id == "199"){ ?> ...@@ -35,7 +35,7 @@ if(Auth::user()->id=="1" || Auth::user()->id == "199"){ ?>
35 </tr> 35 </tr>
36 <tr> 36 <tr>
37 <th>Income Achievement</th> 37 <th>Income Achievement</th>
38 <th>{{$totalIncome}}</th> 38 <th><span id="showCalculatedAmt">{{$totalIncome}}</span></th>
39 </tr> 39 </tr>
40 40
41 <tr> 41 <tr>
...@@ -54,10 +54,10 @@ if(Auth::user()->id=="1" || Auth::user()->id == "199"){ ?> ...@@ -54,10 +54,10 @@ if(Auth::user()->id=="1" || Auth::user()->id == "199"){ ?>
54 <tr> 54 <tr>
55 <td> <input type="hidden" name="products[<?= $i ?>][productId]" value="{{$value['productId']}}"> 55 <td> <input type="hidden" name="products[<?= $i ?>][productId]" value="{{$value['productId']}}">
56 <input type="hidden" name="products[<?= $i ?>][product]" value="{{ $value['name'] }} " >{{ $value['name'] }}</td> 56 <input type="hidden" name="products[<?= $i ?>][product]" value="{{ $value['name'] }} " >{{ $value['name'] }}</td>
57 <td><input type="number" name="products[<?= $i ?>][lg]" value="{{isset($value['lead_generated'])?$value['lead_generated']:'0'}}" $disabled></td> 57 <td><input type="number" name="products[<?= $i ?>][lg]" min="0" value="{{isset($value['lead_generated'])?$value['lead_generated']:'0'}}" $disabled></td>
58 <td><input type="number" min="0" step="0.01" name="products[<?= $i ?>][lgAmt]" value="{{isset($value['lead_generated_amount'])?$value['lead_generated_amount']:'0'}}" $disabled></td> 58 <td><input type="number" min="0" step="0.01" name="products[<?= $i ?>][lgAmt]" value="{{isset($value['lead_generated_amount'])?$value['lead_generated_amount']:'0'}}" $disabled></td>
59 <td><input type="number" name="products[<?= $i ?>][lc]" value="{{isset($value['lead_closed'])?$value['lead_closed']:'0'}}" $disabled></td> 59 <td><input type="number" min="0" name="products[<?= $i ?>][lc]" value="{{isset($value['lead_closed'])?$value['lead_closed']:'0'}}" class="calculateIncome" id="products<?= $i ?>Lc" $disabled></td>
60 <td><input type="number" min="0" step="0.01" name="products[<?= $i ?>][lcAmt]" value="{{isset($value['lead_closed_amount'])?$value['lead_closed_amount']:'0'}}" $disabled></td> 60 <td><input type="number" min="0" step="0.01" name="products[<?= $i ?>][lcAmt]" value="{{isset($value['lead_closed_amount'])?$value['lead_closed_amount']:'0'}}" class="calculateIncome" id="products<?= $i ?>LcAmt" $disabled></td>
61 </tr> 61 </tr>
62 <?php 62 <?php
63 $i++; 63 $i++;
...@@ -73,10 +73,11 @@ if(Auth::user()->id=="1" || Auth::user()->id == "199"){ ?> ...@@ -73,10 +73,11 @@ if(Auth::user()->id=="1" || Auth::user()->id == "199"){ ?>
73 </table> 73 </table>
74 </div> 74 </div>
75 </form> 75 </form>
76 <script> 76 <script>
77
78 function createOutputReport()
79 {
77 80
78 function createOutputReport()
79 {
80 var putdata = $('#output-report').serialize(); 81 var putdata = $('#output-report').serialize();
81 //console.log("--->"+putdata); 82 //console.log("--->"+putdata);
82 doAjax('outputreport?action=createOutputReport',putdata,'__fake__div__','ajax_create_output_report','singlethis','POST',function(retstr) 83 doAjax('outputreport?action=createOutputReport',putdata,'__fake__div__','ajax_create_output_report','singlethis','POST',function(retstr)
...@@ -93,6 +94,28 @@ if(Auth::user()->id=="1" || Auth::user()->id == "199"){ ?> ...@@ -93,6 +94,28 @@ if(Auth::user()->id=="1" || Auth::user()->id == "199"){ ?>
93 }); 94 });
94 } 95 }
95 96
97
98 $( document ).ready(function() {
99 $( ".calculateIncome" ).change(function() {
100
101 var numItems = $('.calculateIncome').length;
102 var lc = 0;
103 var lcAmt = 0;
104 var totalIncome = 0;
105 for (var i = 1; i <= (numItems/2); i++) {
106 lc = $('#products'+i+'Lc').val();
107 lcAmt = $('#products'+i+'LcAmt').val();
108
109 if(lc != '' && lcAmt != ''){
110 totalIncome = totalIncome + (lc * lcAmt);
111 }
112 }
113 $('#showCalculatedAmt').html(totalIncome);
114
115 });
116 });
117
118
96 </script> 119 </script>
97 120
98 121
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!