Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $columns[] = ['label'=>'Servicio Logistico','name'=>'Servicio_Logistico','type'=>'number','required'=>true];
- $columns[] = ['label'=>'Diferencia Giro','name'=>'Diferencia_Giro','type'=>'number','required'=>true];
- $columns[] = ['label'=>'Anticipo','name'=>'Anticipo','type'=>'number','required'=>true];
- $columns[] = ['label'=>'Sub Total','name'=>'Sub_Total','type'=>'number','formula'=>"([Servicio_Logistico]) + ([Diferencia_Giro]) - [Anticipo]","readonly"=>true,'required'=>true];
- @if($col['formula'])
- <?php
- $formula = $col['formula'];
- $formula_function_name ='formula'.str_slug($name.$col['name'],'');
- $script_onchange = "";
- foreach($form['columns'] as $c) {
- if(strpos($formula, "[".$c['name']."]")!==false) {
- $script_onchange .= "
- $('#$name$c[name]').change(function() {
- $formula_function_name();
- });
- ";
- }
- $formula = str_replace("[".$c['name']."]","$('#".$name.$c['name']."').val()",$formula);
- }
- ?>
- @push('bottom')
- <script type="text/javascript">
- function {{ $formula_function_name }}() {
- var v = {!! $formula !!};
- $('#{{$name_column}}').val(v);
- }
- $(function() {
- {!! $script_onchange !!}
- })
- </script>
- @endpush
- @endif
Add Comment
Please, Sign In to add comment