Files
ui/resources/views/informes/resumen_contabilidad.blade.php
2021-12-01 21:04:06 -03:00

72 lines
1.8 KiB
PHP

@extends('layout.base')
@section('content')
<h2>Resumen para Contabilidad</h2>
<form action="#" class="form-horizontal">
<div class="form-group">
<div class="col-md-1">Hasta Mes</div>
<div class="col-md-3"><select name="mes" class="form-control">
<option value="">Todo</option>
<?php $f = Carbon\Carbon::today(); ?>
@for ($y = date('Y'); $y >= date('Y') - 5; $y --)
@for ($m = 12; $m > 0; $m --)
@if ($y == date('Y') and $m >= date('m'))
@continue
@endif
<option value="{{$y}}-{{$m}}" @if ($m == $f->month-1 and $y == $f->year) selected="selected" @endif>
{{ucwords(strftime('%B - %Y', mktime(0, 0, 0, $m, 1, $y)))}}
</option>
@endfor
@endfor
</select></div>
</div>
</form>
<div id="proyectos">
@include('informes.proyectos', ['a' => 'resumen_contabilidad'])
</div>
@endsection
@push('scripts')
<script type="text/javascript">
function changeUrl(url, field, change) {
if (url.indexOf(field) > -1) {
var nurl = [];
var info = url.split('&');
$.each(info, function(k, v) {
if (v.indexOf(field) == -1) {
nurl.push(v);
} else {
if (change != '') {
nurl.push(field + '=' + change);
}
}
});
nurl = nurl.join('&');
return nurl;
} else {
if (change != '') {
nurl = url + '&' + field + '=' + change;
return nurl;
}
}
return url;
}
function updateUrls(select, link_id) {
var f = $("select[name='" + select + "']").val();
var links = $('#' + link_id + ' a');
links.each(function(k, v) {
url = $(v).attr('href');
nurl = changeUrl(url, 'fecha', f);
$(v).attr('href', nurl);
});
}
$(document).ready(function() {
$("select[name='mes']").change(function(e) {
updateUrls('mes', 'proyectos');
});
updateUrls('mes', 'proyectos');
});
</script>
@endpush