hechos modelos y entidades para facturas

This commit is contained in:
jaimejimenezortega
2024-06-25 20:08:17 +02:00
parent 20702a47f8
commit fcaacfbb5d
6 changed files with 231 additions and 0 deletions

View File

@ -0,0 +1,55 @@
<?php
namespace App\Entities\Facturas;
class FacturaEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
'id' => null,
'pedido_id' => null,
'factura_retificada_id' => null,
'factura_retificativa_id' => null,
'cliente_id' => null,
'serie_id' => null,
'numero' => null,
'estado' => null,
'estado_pago' => null,
'fecha_factura_at' => null,
'notas' => null,
'base' => null,
'total' => null,
'pendiente' => null,
'total_pagos' => null,
'creditoAsegurado' => null,
'cliente_nombre' => null,
'cliente_address' => null,
'cliente_cif' => null,
'cliente_pais' => null,
'cliente_cp' => null,
'cliente_ciudad' => null,
'cliente_provincia' => null,
'created_at' => null,
'updated_at' => null,
'deleted_at' => null,
'user_created_id' => null,
'user_update_id' => null,
];
protected $casts = [
'id' => 'int',
'pedido_id' => 'int',
'factura_retificada_id' => 'int',
'factura_retificativa_id' => 'int',
'cliente_id' => 'int',
'serie_id' => 'int',
'estado' => 'int',
'estado_pago' => 'int',
'base' => 'float',
'total' => 'float',
'pendiente' => 'float',
'total_pagos' => 'float',
'creditoAsegurado' => 'float',
];
}

View File

@ -0,0 +1,39 @@
<?php
namespace App\Entities\Facturas;
class FacturaLineaEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
'id' => null,
'factura_id' => null,
'pedido_impresion_id' => null,
'pedido_maquetacion_id' => null,
'descripcion' => null,
'cantidad' => null,
'precio_unidad' => null,
'iva' => null,
'base' => null,
'total_iva' => null,
'total' => null,
'data' => null,
'deleted_at' => null,
'user_update_id' => null,
];
protected $casts = [
'id' => 'int',
'factura_id' => 'int',
'pedido_impresion_id' => 'int',
'pedido_maquetacion_id' => 'int',
'cantidad' => 'float',
'precio_unidad' => 'float',
'iva' => 'float',
'base' => 'float',
'total_iva' => 'float',
'total' => 'float',
];
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Entities\Facturas;
class FacturaPagoEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
'id' => null,
'factura_id' => null,
'notes' => null,
'fecha_pago_at' => null,
'fecha_vencimiento_at' => null,
'forma_pago_id' => null,
'total' => null,
'deleted_at' => null,
'user_update_id' => null,
];
protected $casts = [
'id' => 'int',
'factura_id' => 'int',
'forma_pago_id' => 'int',
'total' => 'float',
];
}

View File

@ -0,0 +1,33 @@
<?php
namespace App\Models\Facturas;
class FacturaLineaModel extends \App\Models\BaseModel {
protected $table = 'facturas_lineas';
// Lista de columnas basada en los campos de la tabla, para asignación masiva
protected $allowedFields = [
'factura_id',
'pedido_impresion_id',
'pedido_maquetacion_id',
'descripcion',
'cantidad',
'precio_unidad',
'iva',
'base',
'total_iva',
'total',
'data',
'deleted_at',
'user_update_id'
];
protected $returnType = "App\Entities\Facturas\FacturaLineaEntity";
protected $useTimestamps = false;
protected $useSoftDeletes = true;
public static $labelField = "id";
}

View File

@ -0,0 +1,50 @@
<?php
namespace App\Models\Facturas;
class FacturaModel extends \App\Models\BaseModel {
protected $table = 'facturas';
// Lista de columnas basada en los campos de la tabla, para asignación masiva
protected $allowedFields = [
'pedido_id',
'factura_retificada_id',
'factura_retificativa_id',
'customer_id',
'serie_id',
'numero',
'estado',
'estado_pago',
'fecha_factura_at',
'notas',
'base',
'total',
'pendiente',
'total_pagos',
'creditoAsegurado',
'customer_nombre',
'customer_address',
'customer_cif',
'customer_pais',
'customer_cp',
'customer_ciudad',
'customer_provincia',
'created_at',
'updated_at',
'deleted_at',
'user_created_id',
'user_update_id'
];
protected $returnType = "App\Entities\Facturas\FacturaEntity";
protected $useTimestamps = true;
protected $useSoftDeletes = true;
protected $createdField = "created_at";
protected $updatedField = "updated_at";
public static $labelField = "id";
}

View File

@ -0,0 +1,26 @@
<?php
namespace App\Models\Facturas;
class FacturaPagoModel extends \App\Models\BaseModel {
protected $table = 'facturas_pagos';
protected $allowedFields = [
'factura_id',
'notes',
'fecha_pago_at',
'fecha_vencimiento_at',
'forma_pago_id',
'total',
'deleted_at',
'user_update_id'
];
protected $returnType = "App\Entities\Facturas\FacturaPagoEntity";
protected $useTimestamps = false;
protected $useSoftDeletes = true;
public static $labelField = "id";
}