mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
editar factura
This commit is contained in:
@ -315,4 +315,21 @@ class ClienteModel extends \App\Models\BaseModel
|
||||
public function creditoDisponible($cliente_id){
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getClienteDataFacturas($cliente_id){
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"
|
||||
t1.nombre AS cliente_nombre, t1.direccion AS cliente_address, t1.cif AS cliente_cif,
|
||||
t2.nombre AS cliente_pais, t1.cp AS cliente_cp, t1.ciudad AS cliente_ciudad,
|
||||
t3.nombre AS cliente_provincia, t1.credito_asegurado AS creditoAsegurado"
|
||||
)
|
||||
->where("t1.is_deleted", 0)
|
||||
->where("t1.id", $cliente_id);
|
||||
$builder->join("lg_paises t2", "t1.pais_id = t2.id", "left");
|
||||
$builder->join("lg_provincias t3", "t1.provincia_id = t3.id", "left");
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,4 +91,21 @@ class SeriesFacturasModel extends \App\Models\BaseModel
|
||||
->orLike("t1.grupo", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
public function getMenuItemsFacturas(){
|
||||
|
||||
$resultSorting = $this->getPrimaryKeyName();
|
||||
|
||||
$id = 'id AS id';
|
||||
$text = 'nombre AS text';
|
||||
|
||||
$queryBuilder = $this->db->table($this->table);
|
||||
$queryBuilder->select([$id, $text]);
|
||||
$queryBuilder->where('tipo', 'facturacion');
|
||||
$queryBuilder->where('grupo', '1');
|
||||
$queryBuilder->orderBy($resultSorting);
|
||||
$result = $queryBuilder->get()->getResult();
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,4 +30,19 @@ class FacturaLineaModel extends \App\Models\BaseModel {
|
||||
protected $useSoftDeletes = true;
|
||||
|
||||
public static $labelField = "id";
|
||||
|
||||
public function getResource($factura_id)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS id, t1.factura_id AS factura_id,
|
||||
t1.pedido_impresion_id AS pedido_impresion_id, t1.pedido_maquetacion_id AS pedido_maquetacion_id,
|
||||
t1.descripcion AS concepto, t1.cantidad as cantidad, t1.precio_unidad AS precio_unidad, t1.iva AS iva,
|
||||
t1.base AS base, t1.total_iva AS total_iva, t1.total AS total, t1.data AS data,"
|
||||
)
|
||||
->where("t1.factura_id", $factura_id);
|
||||
|
||||
return $builder;
|
||||
}
|
||||
}
|
||||
@ -28,7 +28,7 @@ class FacturaModel extends \App\Models\BaseModel {
|
||||
'pedido_id',
|
||||
'factura_retificada_id',
|
||||
'factura_retificativa_id',
|
||||
'customer_id',
|
||||
'cliente_id',
|
||||
'serie_id',
|
||||
'numero',
|
||||
'estado',
|
||||
@ -40,13 +40,13 @@ class FacturaModel extends \App\Models\BaseModel {
|
||||
'pendiente',
|
||||
'total_pagos',
|
||||
'creditoAsegurado',
|
||||
'customer_nombre',
|
||||
'customer_address',
|
||||
'customer_cif',
|
||||
'customer_pais',
|
||||
'customer_cp',
|
||||
'customer_ciudad',
|
||||
'customer_provincia',
|
||||
'cliente_nombre',
|
||||
'cliente_address',
|
||||
'cliente_cif',
|
||||
'cliente_pais',
|
||||
'cliente_cp',
|
||||
'cliente_ciudad',
|
||||
'cliente_provincia',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
@ -69,10 +69,10 @@ class FacturaModel extends \App\Models\BaseModel {
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS id, t1.numero AS numero, t1.fecha_factura_at AS fecha_factura_at,
|
||||
"t1.id AS id, t1.numero AS numero, DATE_FORMAT(t1.fecha_factura_at, '%d/%m/%Y') AS fecha_factura_at,
|
||||
t2.nombre AS cliente, t1.base AS base, t1.total AS total, t1.pendiente AS pendiente,
|
||||
t1.creditoAsegurado AS creditoAsegurado, t1.estado AS estado, t1.estado_pago AS estado_pago,
|
||||
t4.nombre AS forma_pago, t3.fecha_vencimiento_at AS venciemento"
|
||||
t4.nombre AS forma_pago, DATE_FORMAT(t3.fecha_vencimiento_at, '%d/%m/%Y') AS vencimiento"
|
||||
);
|
||||
|
||||
$builder->join("clientes t2", "t2.id = t1.cliente_id", "left");
|
||||
|
||||
Reference in New Issue
Block a user