public function listcontratosAction()
 {
     $this->view->disable();
     $model = new Facturas();
     $resul = $model->listacontratos();
     $customers = array();
     foreach ($resul as $v) {
         //echo 'ver =>'.$v->id;
         $customers[] = array('id' => $v->id, 'razon_social' => $v->razon_social, 'nit' => $v->nit, 'grupo' => $v->grupo, 'linea' => $v->linea, 'estacion' => $v->estacion, 'contrato' => $v->contrato, 'producto' => $v->producto, 'fecha_fin' => $v->fecha_fin, 'diferencia_dias' => $v->diferencia_dias);
     }
     echo json_encode($customers);
 }
 public function listfacturasAction()
 {
     $this->view->disable();
     $model = new Facturas();
     $resul = $model->listafacturas();
     $customers = array();
     foreach ($resul as $v) {
         //echo 'ver =>'.$v->id;
         $customers[] = array('id' => $v->id, 'razon_social' => $v->razon_social, 'nit' => $v->nit, 'grupo' => $v->grupo, 'linea' => $v->linea, 'estacion' => $v->estacion, 'contrato' => $v->contrato, 'producto' => $v->producto, 'fecha_programado' => $v->fecha_programado . ' 00:00:00', 'monto_reprogramado' => $v->monto_reprogramado, 'diferencia_dias' => $v->diferencia_dias, 'planpagofactura_id' => $v->planpagofactura_id, 'fecha_factura' => $v->fecha_factura . ' 00:00:00', 'fecha_recepcion_cliente' => $v->fecha_recepcion_cliente . ' 00:00:00', 'monto_factura' => $v->monto_factura, 'nro_factura' => $v->nro_factura, 'fecha_reg' => $v->fecha_reg);
     }
     echo json_encode($customers);
 }
Esempio n. 3
0
function getDeudaTotal($residencia_id)
{
    $años = Facturas::distinct()->lists("año");
    $deuda = 0;
    foreach ($años as $año) {
        for ($mes = 1; $mes <= 12; $mes++) {
            $solvencia = Solvencia::mes($mes)->ano($año)->residencia($residencia_id)->first();
            if ($solvencia->estado == 'Moroso') {
                $deuda += $solvencia->monto;
            }
        }
    }
    return $deuda;
}
 public function run()
 {
     DB::table('facturas')->delete();
     $año = Carbon\Carbon::now()->year;
     for ($i = 1; $i <= 12; $i++) {
         $facturas[] = array('mes' => '' . $i, 'año' => $año, 'monto' => rand(100000, 500000), 'concepto' => 'Mantenimiento');
         $facturas[] = array('mes' => '' . $i, 'año' => $año, 'monto' => rand(100000, 500000), 'concepto' => 'Seguridad');
         $facturas[] = array('mes' => '' . $i, 'año' => $año, 'monto' => rand(100000, 500000), 'concepto' => 'Electricidad');
         $facturas[] = array('mes' => '' . $i, 'año' => $año, 'monto' => rand(100000, 500000), 'concepto' => 'Servicio de Agua');
         $facturas[] = array('mes' => '' . $i, 'año' => $año, 'monto' => rand(100000, 500000), 'concepto' => 'Gastos Generales');
     }
     Facturas::insert($facturas);
     DB::table('recibos')->delete();
     Recibos::create(array('concepto' => 'Contrato con Sistema Web de Condominio Online', 'monto' => '1', 'persona_id' => '0', 'transaccion' => "Transferencia", "path" => "recibo_online.png"));
     $this->command->info('Facturas Table Seed!');
 }
Esempio n. 5
0
 public function getMyPurchase($id)
 {
     $title = "Factura";
     $fac = Facturas::find($id);
     $user = User::find($fac->user_id);
     $aux = FacturaItem::where('factura_id', '=', $id)->get(array('item_id', 'item_qty'));
     $i = 0;
     foreach ($aux as $a) {
         $b = Items::find($a->item_id);
         $b->qty = $a->item_qty;
         $aux = Misc::where('item_id', '=', $a->item_id)->where('deleted', '=', 0)->first();
         $b->img = Images::where('misc_id', '=', $aux->id)->where('deleted', '=', 0)->first();
         $item[$i] = $b;
         $i++;
     }
     return View::make('user.factura')->with('fact', $item)->with('title', $title)->with('user', $user)->with('factura', $fac);
 }
<?php

$meses = getMeses();
$año = Input::get('año', $time->year);
$facturas = Facturas::groupby('mes')->select(DB::raw("mes ,año , sum(monto) as total"))->where("año", "=", $año)->get();
$stocksTable = Lava::DataTable();
$stocksTable->addStringColumn('Epoca')->addNumberColumn('Total $');
foreach ($facturas as $factura) {
    $label = $meses[$factura['mes']] . "/" . $factura["año"];
    $rowData = array($label, $factura['total']);
    $stocksTable->addRow($rowData);
}
$chart = Lava::AreaChart('FacturaChart')->title('Total de Monto de Recibo Por Mes')->colors(array('blue'));
$chart->datatable($stocksTable);
?>
	

<h3 class="text-success text-center">Grafico de Facturas Por Mes</h3>
{{ Lava::  render('AreaChart', 'FacturaChart', 'FacturaChart', true) }}
{{ Form::open(['method' => 'GET' , 'class' => 'form-inline']) }}
<div class="col-md-4 col-md-offset-4">
	{{ Form::number('año', $año, ['class'=>'form-control', 'min'=>'1999','max'=>'2099']) }}
	{{ Form::submit("Ver", ['class' => 'btn btn-primary']) }}
</div>
{{ Form::close() }}
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Facturas::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Esempio n. 8
0
<?php
    foreach(Yii::app()->user->getFlashes() as $key => $message) {
        echo '<div class="flash-' . $key . '">' . $message . "</div>\n";
    }
?>


<p class="help-block">Los campos con <span class="required">*</span> son obligatorios.</p>

<?php echo $form->errorSummary($model); ?>

	<?php //echo $form->textFieldGroup($model,'factura_id',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5')))); ?>

	<div class="form-group">
	<?php 	
		$list = CHtml::listData(Facturas::model()->findAllByAttributes(array('ente_organo_id'=>Usuarios::model()->actual()->ente_organo_id, 'cierre_carga'=>false, 'anho' => Yii::app()->params['trimestresFechas'][Yii::app()->session['trimestreSeleccionado']]['anho'])), 'id', function($factura){return $factura->etiquetaFactura();});

		echo CHtml::label('Seleccionar factura', 'Factura');
		echo "<br>";
		$this->widget(
		    'booster.widgets.TbSelect2',
		    array(
		        'asDropDownList' => true,
		        'model' => $model,
		        
		        'attribute' => 'factura_id',
		        //'name' => 'factura_id',
		        'data' => $list,
		        'htmlOptions'=>array('id'=>'Factura',
    			 'ajax' => array(
									'type'=>'POST', //request type
Esempio n. 9
0
 public function getPaymentAproved()
 {
     $title = "Pagos aprobados";
     $title = "Pagos | Nia Boutique.com";
     $fac = Facturas::join('direcciones', 'direcciones.id', '=', 'facturas.dir')->join('usuario', 'usuario.id', '=', 'facturas.user_id')->leftJoin('bancos', 'bancos.id', '=', 'facturas.banco')->where('pagada', '=', 1)->orderBy('facturas.id', 'DESC')->get(array('usuario.id as user_id', 'usuario.username', 'usuario.dir as user_dir', 'usuario.nombre', 'usuario.apellido', 'usuario.telefono', 'usuario.email', 'facturas.*', 'direcciones.email', 'direcciones.dir as dir_name', 'bancos.banco'));
     $type = "apr";
     return View::make('admin.showPayment')->with('title', $title)->with('fac', $fac)->with('type', $type);
 }
 public function actionPdf($id)
 {
     $factura = Facturas::model()->findByPk($id);
     if ($factura !== null) {
         $datos = array('factura.idfactura' => $factura->IdFactura, 'factura.fecha' => $factura->Fecha, 'factura.idpaciente' => $factura->IdPaciente, 'factura.numero' => $factura->Numero, 'factura.serie' => $factura->Serie, 'factura.concepto' => $factura->Concepto, 'factura.importe' => $factura->Importe, 'factura.fechacobro' => $factura->FechaCobro, 'factura.notas' => $factura->Notas, 'pacientes.nombre' => CHtml::value($factura, 'paciente.Nombre'), 'pacientes.apellidos' => CHtml::value($factura, 'paciente.Apellidos'), 'pacientes.dni_nif' => CHtml::value($factura, 'paciente.DNI_NIF'), 'pacientes.direccion' => CHtml::value($factura, 'paciente.Direccion'), 'pacientes.codpostal' => CHtml::value($factura, 'paciente.CodPostal'), 'pacientes.localidad' => CHtml::value($factura, 'paciente.Localidad'), 'pacientes.provincia' => CHtml::value($factura, 'paciente.Provincia'), 'pacientes.telfijo' => CHtml::value($factura, 'paciente.TelFijo'));
         plantilla::generarPlantilla('PlantillaFactura', $datos, true);
     } else {
         echo 'Factura no encontrada.';
     }
 }
Esempio n. 11
0
<?php

include 'Factura.php';
include 'Cliente.php';
include 'Producto.php';
ini_set('error_reporting', E_ALL);
# con esto me muestra los errores en el nav
$Producto = new Productos("", null);
$cliente2 = new Clientes("", "", "");
$Factura = new Facturas("", "", "", "", "", "");
$cliente2->registrarCliente(33000000, " Akiles Bailo", 3722426263);
$Producto->registrarProducto("Cafe", "La Virginia");
$Factura->registrarFactura('2001-04-12', "Factura tipo A", False, 67, 2, 25);
 function calcularIvaFacturas()
 {
     $sumaIva = 0;
     foreach (Facturas::model()->findAllByAttributes(array('ente_organo_id' => Usuarios::model()->actual()->ente_organo_id)) as $key => $value) {
         foreach ($value->productos as $key => $value) {
             $sumaIva += $value->costo_unitario * $value->cantidad_adquirida * ($value->iva->porcentaje / 100);
         }
     }
     return $sumaIva;
 }
 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id)
 {
     if (Yii::app()->request->isPostRequest) {
         // we only allow deletion via POST request
         //$this->loadModel($id)->delete();
         $model = $this->loadModel($id);
         $factura = Facturas::model()->findByPk($model->factura_id);
         if (!($factura->ente_organo_id == Usuarios::model()->actual()->ente_organo_id)) {
             throw new CHttpException(403, "No se puede procesar la solicitud.");
         }
         $model->delete();
         if (!isset($_GET['ajax'])) {
             $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
         } else {
             throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
         }
     }
     // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
 }
Esempio n. 14
0
 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 facturacion()
 {
     $factura = new Facturas();
     $factura->nombreUsuario = Input::get('nombre');
     $factura->Domicilio = Input::get('domicilio');
     $factura->rfc = Input::get('RFC');
     $factura->correo = Input::get('Correo');
     $factura->save();
     $FacturarR = new facturarr();
     $FacturarR->id_restaurante = Auth::user()->id_restaurante;
     $FacturarR->estatus = 'pendiente';
     $FacturarR->costo = Input::get('Costo');
     $FacturarR->save();
     return Redirect::to('restaurante/facturas')->with('message', 'factura guardada con éxito');
 }
Esempio n. 17
0
 public function eliminarconceptomasivo($concepto)
 {
     $cantidad = Facturas::where("concepto", "=", $concepto)->delete();
     return Redirect::back();
 }
Esempio n. 18
0
 public function postSendPayment()
 {
     $input = Input::all();
     $id = $input['factId'];
     $rules = array('transNumber' => 'required', 'banco' => 'required', 'fecha' => 'required');
     $messages = array('required' => 'El campo es obligatorio.', 'numeric' => 'El campo debe ser un número.');
     $validator = Validator::make($input, $rules, $messages);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $fac = Facturas::find($id);
     $fac->banco = $input['banco'];
     if (!empty($input['bank_ext'])) {
         $fac->banco_ext = $input['bank_ext'];
     }
     if (Input::hasFile('transNumber')) {
         $file = Input::file('transNumber');
         if (file_exists('images/pagos/' . $file->getClientOriginalName())) {
             //guardamos la imagen en public/imgs con el nombre original
             $i = 0;
             //indice para el while
             //separamos el nombre de la img y la extensión
             $info = explode(".", $file->getClientOriginalName());
             //asignamos de nuevo el nombre de la imagen completo
             $miImg = $file->getClientOriginalName();
             //mientras el archivo exista iteramos y aumentamos i
             while (file_exists('images/pagos/' . $miImg)) {
                 $i++;
                 $miImg = $info[0] . "(" . $i . ")" . "." . $info[1];
             }
             //guardamos la imagen con otro nombre ej foto(1).jpg || foto(2).jpg etc
             $file->move("images/pagos/", $miImg);
             if ($miImg != $file->getClientOriginalName()) {
                 $fac->num_trans = $miImg;
             }
         } else {
             $file->move("images/pagos/" . $id, $file->getClientOriginalName());
             $fac->num_trans = $file->getClientOriginalName();
         }
     }
     $fac->fech_trans = $input['fecha'];
     $fac->pagada = -1;
     if ($fac->save()) {
         $subject = "Correo de administrador";
         $data = array('subject' => $subject, 'createBy' => Auth::user()->username, 'monto' => $input['total']);
         $to_Email = '*****@*****.**';
         Mail::send('emails.newPayment', $data, function ($message) use($input, $to_Email, $subject) {
             $message->to($to_Email)->from('*****@*****.**')->subject($subject);
         });
         Session::flash('success', 'Pago enviado, pronto procesaremos su pago');
         return Redirect::to('usuario/mis-compras');
     } else {
         Session::flash('danger', 'Error al guardar el pago');
         return Redirect::back();
     }
 }