function getdeuda($residencia_id, $mes, $año) { $maestra = json_decode(File::get(app_path("config/maestra.php")), true); $total = Facturas::wherenull("residencia_id")->where("mes", "=", $mes)->where("año", "=", $año)->where("porcentual", "=", 1)->sum('monto') * (Residencias::find($residencia_id)->alicuota / 100); $total += Facturas::wherenull("residencia_id")->where("mes", "=", $mes)->where("año", "=", $año)->where("porcentual", "=", 0)->sum('monto') / Residencias::where("id", "<>", "1")->count(); $total += Facturas::where("residencia_id", "=", $residencia_id)->where("mes", "=", $mes)->where("año", "=", $año)->sum('monto'); if ($maestra['is_fondo']) { $total += $total * ($maestra['fondo_%'] / 100); } return $total; }
public function delFactura() { $factura = Facturas::where('id', '=', Input::get('id'))->first(); $factura->delete(); return Response::json('Factura eliminada'); }
<?php $mes = Input::get('mes', $time->month); $año = Input::get('año', $time->year); $conceptos = Facturas::where('mes', '=', $mes)->where('año', '=', $año)->wherenull("residencia_id")->select('concepto', 'monto')->orderby('monto', 'asc')->get(); $stocksTable = Lava::DataTable(); $stocksTable->addStringColumn('Concepto')->addNumberColumn("Monto \$")->addNumberColumn("SubTotal \$"); $subtotal = 0; $rowData = array('Monto X Concepto'); foreach ($conceptos as $concepto) { $rowData = array($concepto['concepto'], $concepto['monto'], $subtotal += $concepto['monto']); $stocksTable->addRow($rowData); } $chart = Lava::ComboChart('conceptoChart')->series(array(0 => Lava::Series(array('type' => 'bars'))))->title("Monto X Concepto"); $chart->datatable($stocksTable); ?> <h3 class="text-success text-center">Grafico de Usuarios Por Morosidad</h3> {{Lava:: render('ComboChart', 'conceptoChart', 'conceptoChart', array('width'=> 500, 'height' => 300));}} {{ Form::open(['method' => 'GET' , 'class' => 'form-inline']) }} <div class="col-md-12"> {{Form::select('mes', getMeses(), $mes, ['class' => 'form-control'])}} {{ Form::number('año', $año, ['class'=>'form-control', 'min'=>'1999','max'=>'2099']) }} {{ Form::submit("Ver", ['class' => 'btn btn-primary']) }} </div> {{ Form::close() }}
public function eliminarconceptomasivo($concepto) { $cantidad = Facturas::where("concepto", "=", $concepto)->delete(); return Redirect::back(); }