mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'mod/pedido_form' into 'main'
Mod/pedido form See merge request jjimenez/safekat!603
This commit is contained in:
@ -29,6 +29,8 @@ const SK_PERMISSION_MATRIX = [
|
|||||||
"pedidos-cancelados.menu",
|
"pedidos-cancelados.menu",
|
||||||
"pedidos-todos.view",
|
"pedidos-todos.view",
|
||||||
"pedidos-todos.menu",
|
"pedidos-todos.menu",
|
||||||
|
"pedidos-gestion.toprod",
|
||||||
|
"pedidos-gestion.menu",
|
||||||
"tarifa-preimpresion.create",
|
"tarifa-preimpresion.create",
|
||||||
"tarifa-preimpresion.edit",
|
"tarifa-preimpresion.edit",
|
||||||
"tarifa-preimpresion.delete",
|
"tarifa-preimpresion.delete",
|
||||||
@ -169,6 +171,29 @@ const SK_PERMISSION_MATRIX = [
|
|||||||
"token.menu",
|
"token.menu",
|
||||||
],
|
],
|
||||||
"director" => [
|
"director" => [
|
||||||
|
"clientes.create",
|
||||||
|
"clientes.edit",
|
||||||
|
"clientes.menu",
|
||||||
|
"plantilla-tarifa.create",
|
||||||
|
"plantilla-tarifa.edit",
|
||||||
|
"plantilla-tarifa.menu",
|
||||||
|
"direcciones.create",
|
||||||
|
"direcciones.edit",
|
||||||
|
"direcciones.menu",
|
||||||
|
"presupuesto.create",
|
||||||
|
"presupuesto.edit",
|
||||||
|
"presupuesto.menu",
|
||||||
|
"presupuesto-cliente.create",
|
||||||
|
"presupuesto-cliente.edit",
|
||||||
|
"presupuesto-cliente.menu",
|
||||||
|
"pedidos-activos.view",
|
||||||
|
"pedidos-activos.menu",
|
||||||
|
"pedidos-finalizados.view",
|
||||||
|
"pedidos-finalizados.menu",
|
||||||
|
"pedidos-cancelados.view",
|
||||||
|
"pedidos-cancelados.menu",
|
||||||
|
"pedidos-todos.view",
|
||||||
|
"pedidos-todos.menu",
|
||||||
"tarifa-preimpresion.create",
|
"tarifa-preimpresion.create",
|
||||||
"tarifa-preimpresion.edit",
|
"tarifa-preimpresion.edit",
|
||||||
"tarifa-preimpresion.menu",
|
"tarifa-preimpresion.menu",
|
||||||
@ -190,6 +215,11 @@ const SK_PERMISSION_MATRIX = [
|
|||||||
"servicio-acabado.create",
|
"servicio-acabado.create",
|
||||||
"servicio-acabado.edit",
|
"servicio-acabado.edit",
|
||||||
"servicio-acabado.menu",
|
"servicio-acabado.menu",
|
||||||
|
"proveedores.create",
|
||||||
|
"proveedores.edit",
|
||||||
|
"proveedores.menu",
|
||||||
|
"tickets.edit",
|
||||||
|
"tickets.menu",
|
||||||
],
|
],
|
||||||
"contabilidad" => [
|
"contabilidad" => [
|
||||||
"token.token",
|
"token.token",
|
||||||
|
|||||||
@ -29,6 +29,8 @@ const SK_PERMISSIONS = [
|
|||||||
'pedidos-cancelados.menu' => 'Menu shall be visualize',
|
'pedidos-cancelados.menu' => 'Menu shall be visualize',
|
||||||
'pedidos-todos.view' => 'Can view',
|
'pedidos-todos.view' => 'Can view',
|
||||||
'pedidos-todos.menu' => 'Menu shall be visualize',
|
'pedidos-todos.menu' => 'Menu shall be visualize',
|
||||||
|
'pedidos-gestion.toprod' => 'Can toprod',
|
||||||
|
'pedidos-gestion.menu' => 'Menu shall be visualize',
|
||||||
'tarifa-preimpresion.create' => 'Can create',
|
'tarifa-preimpresion.create' => 'Can create',
|
||||||
'tarifa-preimpresion.edit' => 'Can edit',
|
'tarifa-preimpresion.edit' => 'Can edit',
|
||||||
'tarifa-preimpresion.delete' => 'Can delete',
|
'tarifa-preimpresion.delete' => 'Can delete',
|
||||||
|
|||||||
@ -31,7 +31,7 @@ const SK_ROLES = [
|
|||||||
],
|
],
|
||||||
'director' => [
|
'director' => [
|
||||||
'title' => 'Director',
|
'title' => 'Director',
|
||||||
'description' => '',
|
'description' => 'Para los directores de área',
|
||||||
],
|
],
|
||||||
'contabilidad' => [
|
'contabilidad' => [
|
||||||
'title' => 'Contabilidad',
|
'title' => 'Contabilidad',
|
||||||
|
|||||||
@ -747,6 +747,7 @@ $routes->group('pedidos', ['namespace' => 'App\Controllers\Pedidos'], function (
|
|||||||
$routes->post('getlineas', 'Pedido::getLineas', ['as' => 'tablaLineasPedido']);
|
$routes->post('getlineas', 'Pedido::getLineas', ['as' => 'tablaLineasPedido']);
|
||||||
$routes->post('cambiarestado', 'Pedido::cambiarEstado', ['as' => 'cambiarEstadoPedido']);
|
$routes->post('cambiarestado', 'Pedido::cambiarEstado', ['as' => 'cambiarEstadoPedido']);
|
||||||
$routes->post('update/(:any)', 'Pedido::update/$1', ['as' => 'actualizarPedido']);
|
$routes->post('update/(:any)', 'Pedido::update/$1', ['as' => 'actualizarPedido']);
|
||||||
|
$routes->post('insertfactura', 'Pedido::addFactura');
|
||||||
$routes->get('xml/(:num)', 'Pedido::get_xml_pedido/$1', ['as' => 'getXMLPedido']);
|
$routes->get('xml/(:num)', 'Pedido::get_xml_pedido/$1', ['as' => 'getXMLPedido']);
|
||||||
$routes->post('produccion/(:num)', 'Pedido::to_produccion/$1', ['as' => 'toProduccion']);
|
$routes->post('produccion/(:num)', 'Pedido::to_produccion/$1', ['as' => 'toProduccion']);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -7,6 +7,7 @@ use App\Entities\Facturas\FacturaEntity;
|
|||||||
use App\Models\Clientes\ClienteModel;
|
use App\Models\Clientes\ClienteModel;
|
||||||
use App\Models\Collection;
|
use App\Models\Collection;
|
||||||
use Hermawan\DataTables\DataTable;
|
use Hermawan\DataTables\DataTable;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
class Facturas extends \App\Controllers\BaseResourceController
|
class Facturas extends \App\Controllers\BaseResourceController
|
||||||
{
|
{
|
||||||
@ -463,6 +464,37 @@ class Facturas extends \App\Controllers\BaseResourceController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function delete($id = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
$user_id = auth()->user()->id;
|
||||||
|
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||||
|
$rawResult = $this->model->where('id', $id)
|
||||||
|
->set([
|
||||||
|
'deleted_at' => $datetime->format('Y-m-d H:i:s'),
|
||||||
|
'user_updated_id' => $user_id,
|
||||||
|
])
|
||||||
|
->update();
|
||||||
|
if (!$rawResult) {
|
||||||
|
return $this->failNotFound(lang('Basic.global.deleteError', [$objName]));
|
||||||
|
}
|
||||||
|
|
||||||
|
$modelLineas = model('\App\Models\Facturas\FacturaLineaModel');
|
||||||
|
$rawResult = $modelLineas->where('factura_id', $id)
|
||||||
|
->set([
|
||||||
|
'deleted_at' => $datetime->format('Y-m-d H:i:s'),
|
||||||
|
'user_updated_id' => $user_id,
|
||||||
|
])
|
||||||
|
->update();
|
||||||
|
|
||||||
|
$this->model->db->query('DELETE FROM facturas_pedidos_lineas WHERE factura_id=' . $id);
|
||||||
|
|
||||||
|
// $message = lang('Basic.global.deleteSuccess', [$objName]); IMN commented
|
||||||
|
$message = lang('Basic.global.deleteSuccess', [lang('Basic.global.record')]);
|
||||||
|
$response = $this->respondDeleted(['id' => $id, 'msg' => $message]);
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function menuPedidosPendientes($cliente_id)
|
public function menuPedidosPendientes($cliente_id)
|
||||||
{
|
{
|
||||||
@ -608,81 +640,102 @@ class Facturas extends \App\Controllers\BaseResourceController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addLineaPedidoImpresion($factura_id)
|
public function addLineaPedidoImpresion($factura_id, $data = -1)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->request->isAJAX()) {
|
if ($this->request) {
|
||||||
$model_pedido_linea = model('\App\Models\Pedidos\PedidoLineaModel');
|
if ($this->request->isAJAX())
|
||||||
$model_presupuesto = model('\App\Models\Presupuestos\PresupuestoModel');
|
|
||||||
$model_factura_linea = model('\App\Models\Facturas\FacturaLineaModel');
|
|
||||||
|
|
||||||
try {
|
|
||||||
$pedido_linea_id = $this->request->getPost('lineaPedido') ?? 0;
|
$pedido_linea_id = $this->request->getPost('lineaPedido') ?? 0;
|
||||||
$linea = $model_pedido_linea->find($pedido_linea_id);
|
} else {
|
||||||
|
if ($data == -1) {
|
||||||
|
return "Error: sin datos";
|
||||||
|
}
|
||||||
|
$pedido_linea_id = $data;
|
||||||
|
}
|
||||||
|
|
||||||
$factura = $this->model->find($factura_id);
|
$model_pedido_linea = model('\App\Models\Pedidos\PedidoLineaModel');
|
||||||
|
$model_presupuesto = model('\App\Models\Presupuestos\PresupuestoModel');
|
||||||
|
$model_factura_linea = model('\App\Models\Facturas\FacturaLineaModel');
|
||||||
|
$model_factura = model('\App\Models\Facturas\FacturaModel');
|
||||||
|
|
||||||
if ($factura) {
|
try {
|
||||||
|
|
||||||
if ($linea) {
|
$linea = $model_pedido_linea->find($pedido_linea_id);
|
||||||
$presupuesto = $model_presupuesto->find($linea->presupuesto_id);
|
|
||||||
|
|
||||||
if ($presupuesto) {
|
$factura = $model_factura->find($factura_id);
|
||||||
// Se añade la linea de factura
|
|
||||||
$descripcion = $model_presupuesto->generarLineaPedido($presupuesto->id, true, $linea->pedido_id);
|
|
||||||
$cantidad = intval($presupuesto->tirada) - intval($this->model->getCantidadLineaPedidoFacturada($linea->id));
|
|
||||||
$base = $cantidad * floatval($presupuesto->total_precio_unidad);
|
|
||||||
$base = round($base, 2);
|
|
||||||
$total_iva = $base * ($presupuesto->iva_reducido == 1 ? 0.04 : 0.21);
|
|
||||||
// se redondea a dos decimales
|
|
||||||
$total_iva = round($total_iva, 2);
|
|
||||||
$total = $base + $total_iva;
|
|
||||||
|
|
||||||
$data = (object) [
|
if ($factura) {
|
||||||
'factura_id' => $factura_id,
|
|
||||||
'pedido_linea_impresion_id' => $linea->pedido_id,
|
if ($linea) {
|
||||||
'descripcion' => $descripcion[0]->concepto,
|
$presupuesto = $model_presupuesto->find($linea->presupuesto_id);
|
||||||
'cantidad' => $cantidad,
|
|
||||||
'precio_unidad' => $presupuesto->total_precio_unidad,
|
if ($presupuesto) {
|
||||||
'iva' => $presupuesto->iva_reducido == 1 ? 4 : 21,
|
// Se añade la linea de factura
|
||||||
'base' => $base,
|
$descripcion = $model_presupuesto->generarLineaPedido($presupuesto->id, true, $linea->pedido_id);
|
||||||
'total_iva' => $total_iva,
|
$cantidad = intval($presupuesto->tirada) - intval($model_factura->getCantidadLineaPedidoFacturada($linea->id));
|
||||||
'total' => $total,
|
$base = $cantidad * floatval($presupuesto->total_precio_unidad);
|
||||||
'user_updated_id' => auth()->user()->id,
|
$base = round($base, 2);
|
||||||
|
$total_iva = $base * ($presupuesto->iva_reducido == 1 ? 0.04 : 0.21);
|
||||||
|
// se redondea a dos decimales
|
||||||
|
$total_iva = round($total_iva, 2);
|
||||||
|
$total = $base + $total_iva;
|
||||||
|
|
||||||
|
$data = (object) [
|
||||||
|
'factura_id' => $factura_id,
|
||||||
|
'pedido_linea_impresion_id' => $linea->pedido_id,
|
||||||
|
'descripcion' => $descripcion[0]->concepto,
|
||||||
|
'cantidad' => $cantidad,
|
||||||
|
'precio_unidad' => $presupuesto->total_precio_unidad,
|
||||||
|
'iva' => $presupuesto->iva_reducido == 1 ? 4 : 21,
|
||||||
|
'base' => $base,
|
||||||
|
'total_iva' => $total_iva,
|
||||||
|
'total' => $total,
|
||||||
|
'user_updated_id' => auth()->user()->id,
|
||||||
|
];
|
||||||
|
|
||||||
|
$model_factura_linea->insert($data);
|
||||||
|
|
||||||
|
$id = $model_factura_linea->getInsertID();
|
||||||
|
|
||||||
|
if ($id) {
|
||||||
|
|
||||||
|
$model_factura_linea->addFacturaPedidoLinea($factura_id, $linea->id, $cantidad);
|
||||||
|
|
||||||
|
$newTokenHash = csrf_hash();
|
||||||
|
$csrfTokenName = csrf_token();
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'error' => 0,
|
||||||
|
'id' => $id,
|
||||||
|
$csrfTokenName => $newTokenHash
|
||||||
];
|
];
|
||||||
|
if ($this->request) {
|
||||||
$model_factura_linea->insert($data);
|
if ($this->request->isAJAX())
|
||||||
|
return $this->respond($data);
|
||||||
$id = $model_factura_linea->getInsertID();
|
} else {
|
||||||
|
// remove csrf token
|
||||||
if ($id) {
|
unset($data[$csrfTokenName]);
|
||||||
|
return $data;
|
||||||
$model_factura_linea->addFacturaPedidoLinea($factura_id, $linea->id, $cantidad);
|
|
||||||
|
|
||||||
$newTokenHash = csrf_hash();
|
|
||||||
$csrfTokenName = csrf_token();
|
|
||||||
$data = [
|
|
||||||
'error' => 0,
|
|
||||||
'id' => $id,
|
|
||||||
$csrfTokenName => $newTokenHash
|
|
||||||
];
|
|
||||||
return $this->respond($data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
$newTokenHash = csrf_hash();
|
$newTokenHash = csrf_hash();
|
||||||
$csrfTokenName = csrf_token();
|
$csrfTokenName = csrf_token();
|
||||||
$data = [
|
$data = [
|
||||||
|
'error' => 1,
|
||||||
|
'error_text' => $e->getMessage(),
|
||||||
$csrfTokenName => $newTokenHash
|
$csrfTokenName => $newTokenHash
|
||||||
];
|
];
|
||||||
return $this->respond($data);
|
if ($this->request) {
|
||||||
} else {
|
if ($this->request->isAJAX())
|
||||||
return $this->failUnauthorized('Invalid request', 403);
|
return $this->respond($data);
|
||||||
|
} else {
|
||||||
|
unset($data[$csrfTokenName]);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Controllers\Pedidos;
|
namespace App\Controllers\Pedidos;
|
||||||
use App\Controllers\BaseController;
|
use App\Controllers\BaseController;
|
||||||
|
use App\Controllers\Facturacion\Facturas;
|
||||||
use App\Entities\Pedidos\PedidoEntity;
|
use App\Entities\Pedidos\PedidoEntity;
|
||||||
use App\Models\Collection;
|
use App\Models\Collection;
|
||||||
use App\Models\Pedidos\PedidoModel;
|
use App\Models\Pedidos\PedidoModel;
|
||||||
@ -366,6 +367,74 @@ class Pedido extends \App\Controllers\BaseResourceController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function addFactura(){
|
||||||
|
|
||||||
|
if($this->request->isAJAX()){
|
||||||
|
|
||||||
|
|
||||||
|
$modelFactura = model('App\Models\Facturas\FacturaModel');
|
||||||
|
$modelFacturaLinea = model('App\Models\Facturas\FacturaLineaModel');
|
||||||
|
|
||||||
|
$pedido_id = $this->request->getPost('pedido_id');
|
||||||
|
$serie_id = $this->request->getPost('serie_id');
|
||||||
|
|
||||||
|
$datosFactura = $this->model->obtenerDatosForFactura($pedido_id);
|
||||||
|
|
||||||
|
if(count($datosFactura) == 0){
|
||||||
|
return $this->respond(['status' => 'error', 'message' => 'Error obteniendo datos de factura']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$datosFactura = $datosFactura[0];
|
||||||
|
|
||||||
|
$modelFactura->insert([
|
||||||
|
'cliente_id' => $datosFactura->cliente_id,
|
||||||
|
'serie_id' => $serie_id,
|
||||||
|
'estado' => 'borrador',
|
||||||
|
'estado_pago' => 'pendiente',
|
||||||
|
'fecha_factura_at' => date('Y-m-d'),
|
||||||
|
'cliente_nombre' => $datosFactura->cliente_nombre,
|
||||||
|
'cliente_cif' => $datosFactura->cliente_cif,
|
||||||
|
'cliente_pais' => $datosFactura->cliente_pais,
|
||||||
|
'cliente_address' => $datosFactura->cliente_direccion,
|
||||||
|
'cliente_cp' => $datosFactura->cliente_cp,
|
||||||
|
'cliente_cuidad' => $datosFactura->cliente_ciudad,
|
||||||
|
'cliente_provincia' => $datosFactura->cliente_provincia,
|
||||||
|
'user_created_id' => auth()->user()->id,
|
||||||
|
'user_updated_id' => auth()->user()->id
|
||||||
|
]);
|
||||||
|
|
||||||
|
$factura_id = $modelFactura->getInsertID();
|
||||||
|
|
||||||
|
if($factura_id){
|
||||||
|
|
||||||
|
$model_pedido_linea = model('\App\Models\Pedidos\PedidoLineaModel');
|
||||||
|
$lineas = $model_pedido_linea->where('pedido_id', $pedido_id)->first();
|
||||||
|
$facturas = new Facturas();
|
||||||
|
$result = $facturas->addLineaPedidoImpresion($factura_id, $lineas->id);
|
||||||
|
if($result['error'] == 0){
|
||||||
|
// Se actualiza el precio total de la factura obtenido de la linea añadida
|
||||||
|
$linea_added = $modelFacturaLinea->where('factura_id', $factura_id)->first();
|
||||||
|
$modelFactura->set([
|
||||||
|
'base' => $linea_added->base,
|
||||||
|
'total' => $linea_added->total,
|
||||||
|
'pendiente' => $linea_added->total,
|
||||||
|
])->where('id', $factura_id)->update();
|
||||||
|
return $this->respond(['status' => 'success', 'id' => $factura_id, 'message' => lang('Basic.global.success')]);
|
||||||
|
}else{
|
||||||
|
return $this->respond(['status' => 'error', 'message' => 'Error insertando lineas de factura']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->respond(['status' => 'error', 'message' => 'Error insertando factura']);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
return $this->failUnauthorized('Invalid request', 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private function obtenerDatosFormulario(&$pedidoEntity){
|
private function obtenerDatosFormulario(&$pedidoEntity){
|
||||||
|
|
||||||
$datos = $this->model->obtenerDatosForm($pedidoEntity->id);
|
$datos = $this->model->obtenerDatosForm($pedidoEntity->id);
|
||||||
|
|||||||
@ -71,6 +71,7 @@ return [
|
|||||||
"fechaVencimiento" => "Fecha Vencimiento",
|
"fechaVencimiento" => "Fecha Vencimiento",
|
||||||
"fechaCobro" => "Fecha Cobro",
|
"fechaCobro" => "Fecha Cobro",
|
||||||
"cantidad" => "Cantidad",
|
"cantidad" => "Cantidad",
|
||||||
|
"ejemplares" => "Ejemplares",
|
||||||
"addPago" => "Añadir Pago",
|
"addPago" => "Añadir Pago",
|
||||||
"facturaPagada" => "Factura rectificativa ya abonada",
|
"facturaPagada" => "Factura rectificativa ya abonada",
|
||||||
|
|
||||||
|
|||||||
@ -77,10 +77,12 @@ return [
|
|||||||
|
|
||||||
|
|
||||||
'facturas' => 'Facturas',
|
'facturas' => 'Facturas',
|
||||||
|
'addFactura' => 'Añadir Factura',
|
||||||
|
|
||||||
'showTotal' => 'Mostrar totales',
|
'showTotal' => 'Mostrar totales',
|
||||||
|
|
||||||
'validation' => [
|
'validation' => [
|
||||||
|
'errorCantidadAlbaranes' => 'Total en albaranes {0} no coincide con la tirada {1}',
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,8 @@ return [
|
|||||||
'editPermission' => 'Editar',
|
'editPermission' => 'Editar',
|
||||||
'deletePermission' => 'Eliminar',
|
'deletePermission' => 'Eliminar',
|
||||||
|
|
||||||
|
'toprodPermission' => 'Pasar a Producción',
|
||||||
|
|
||||||
// System sections
|
// System sections
|
||||||
'clientesSection' => 'Clientes',
|
'clientesSection' => 'Clientes',
|
||||||
'plantillaTarifaSection' => 'Plantilla de tarifas',
|
'plantillaTarifaSection' => 'Plantilla de tarifas',
|
||||||
@ -35,6 +37,7 @@ return [
|
|||||||
'pedidosFinalizadosSection' => 'Finalizados',
|
'pedidosFinalizadosSection' => 'Finalizados',
|
||||||
'pedidosCanceladosSection' => 'Cancelados',
|
'pedidosCanceladosSection' => 'Cancelados',
|
||||||
'pedidosTodosSection' => 'Todos',
|
'pedidosTodosSection' => 'Todos',
|
||||||
|
'pedidosGestionSection' => 'Gestion',
|
||||||
'tarifaPreimpresionSection' => 'Tarifas de preimpresión',
|
'tarifaPreimpresionSection' => 'Tarifas de preimpresión',
|
||||||
'tarifaManipuladoSection' => 'Tarifas de manipulado',
|
'tarifaManipuladoSection' => 'Tarifas de manipulado',
|
||||||
'tarifaAcabadoSection' => 'Tarifas de acabado',
|
'tarifaAcabadoSection' => 'Tarifas de acabado',
|
||||||
|
|||||||
@ -49,7 +49,8 @@ class FacturaLineaModel extends \App\Models\BaseModel {
|
|||||||
->join("albaranes t5", "t5.pedido_id = t2.pedido_id", "left")
|
->join("albaranes t5", "t5.pedido_id = t2.pedido_id", "left")
|
||||||
->join("albaranes_lineas t6", "t6.albaran_id = t5.id", "left")
|
->join("albaranes_lineas t6", "t6.albaran_id = t5.id", "left")
|
||||||
->where("t1.factura_id", $factura_id)
|
->where("t1.factura_id", $factura_id)
|
||||||
->where("t1.deleted_at", null);
|
->where("t1.deleted_at", null)
|
||||||
|
->groupBy('t1.id');
|
||||||
|
|
||||||
return $builder;
|
return $builder;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,9 +29,11 @@ class FacturaModel extends \App\Models\BaseModel
|
|||||||
const SORTABLE_PEDIDOS = [
|
const SORTABLE_PEDIDOS = [
|
||||||
1 => "t1.numero",
|
1 => "t1.numero",
|
||||||
2 => "t2.nombre",
|
2 => "t2.nombre",
|
||||||
3 => "t1.estado",
|
3 => "t4.cantidad",
|
||||||
4 => "t1.fecha_factura_at",
|
4 => "t2.nombre",
|
||||||
5 => "t1.total",
|
5 => "t1.estado",
|
||||||
|
6 => "t1.fecha_factura_at",
|
||||||
|
7 => "t1.total",
|
||||||
];
|
];
|
||||||
|
|
||||||
// Lista de columnas basada en los campos de la tabla, para asignación masiva
|
// Lista de columnas basada en los campos de la tabla, para asignación masiva
|
||||||
@ -185,6 +187,7 @@ class FacturaModel extends \App\Models\BaseModel
|
|||||||
->table($this->table . " t1")
|
->table($this->table . " t1")
|
||||||
->select(
|
->select(
|
||||||
"t1.id AS id, t1.numero AS numero, t2.nombre AS serie, t1.estado AS estado,
|
"t1.id AS id, t1.numero AS numero, t2.nombre AS serie, t1.estado AS estado,
|
||||||
|
t4.cantidad AS ejemplares,
|
||||||
DATE_FORMAT(t1.fecha_factura_at, '%d/%m/%Y') AS fecha_factura_at, t1.total AS total"
|
DATE_FORMAT(t1.fecha_factura_at, '%d/%m/%Y') AS fecha_factura_at, t1.total AS total"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -76,6 +76,36 @@ class PedidoModel extends \App\Models\BaseModel
|
|||||||
return $builder->get()->getResultObject();
|
return $builder->get()->getResultObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function obtenerDatosForFactura($pedido_id = -1){
|
||||||
|
|
||||||
|
$builder = $this->db
|
||||||
|
->table($this->table . " t1")
|
||||||
|
->select("
|
||||||
|
t3.cliente_id, t4.nombre as cliente_nombre, t4.cif as cliente_cif, t4.direccion as cliente_direccion,
|
||||||
|
t5.nombre as cliente_pais, t4.cp as cliente_cp, t4.ciudad as cliente_ciudad, t6.nombre as cliente_provincia
|
||||||
|
"
|
||||||
|
)
|
||||||
|
->join("pedidos_linea t2", "t2.pedido_id = t1.id", "left")
|
||||||
|
->join("presupuestos t3", "t2.presupuesto_id = t3.id", "left")
|
||||||
|
->join("clientes t4", "t4.id = t3.cliente_id", "left")
|
||||||
|
->join("lg_paises t5", "t5.id = t4.pais_id", "left")
|
||||||
|
->join("lg_provincias t6", "t6.id = t4.provincia_id", "left");
|
||||||
|
|
||||||
|
$builder->where("t1.id", $pedido_id);
|
||||||
|
return $builder->get()->getResultObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addFacturaPedidoLinea($pedido_id, $factura_id, $cantidad)
|
||||||
|
{
|
||||||
|
return $this->db
|
||||||
|
->table("facturas_pedidos_lineas")
|
||||||
|
->insert([
|
||||||
|
"factura_id" => $factura_id,
|
||||||
|
"pedido_id" => $pedido_id,
|
||||||
|
"cantidad" => $cantidad
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
public function obtenerLineasPedido($pedido_id)
|
public function obtenerLineasPedido($pedido_id)
|
||||||
{
|
{
|
||||||
$builder = $this->db
|
$builder = $this->db
|
||||||
@ -91,6 +121,7 @@ class PedidoModel extends \App\Models\BaseModel
|
|||||||
foreach ($builder->get()->getResultObject() as $row) {
|
foreach ($builder->get()->getResultObject() as $row) {
|
||||||
array_push($lineasPresupuesto, $model_presupuesto->generarLineaPedido($row->presupuesto_id)[0]);
|
array_push($lineasPresupuesto, $model_presupuesto->generarLineaPedido($row->presupuesto_id)[0]);
|
||||||
}
|
}
|
||||||
|
$builder->groupBy("t1.id");
|
||||||
|
|
||||||
return $lineasPresupuesto;
|
return $lineasPresupuesto;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -120,8 +120,7 @@ $('#addNewPedidoImpresion').on('click', function(){
|
|||||||
// se ajustan el ancho de las columnas
|
// se ajustan el ancho de las columnas
|
||||||
$('#pedidoImpresion').val(null).trigger('change');
|
$('#pedidoImpresion').val(null).trigger('change');
|
||||||
// Se actualiza la tabla de lineas de factura
|
// Se actualiza la tabla de lineas de factura
|
||||||
tableLineas.clearPipeline();
|
$('#tableOfLineasFactura').DataTable().clearPipeline().draw();
|
||||||
$('#tableOfLineasFactura').DataTable().columns.adjust().draw();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -17,12 +17,12 @@
|
|||||||
<th>id</th>
|
<th>id</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
<th ></th>
|
||||||
<th><?= lang('Facturas.unidades') ?></th>
|
<th style="width: 10%;"><?= lang('Facturas.unidades') ?></th>
|
||||||
<th><?= lang('Facturas.concepto') ?></th>
|
<th ><?= lang('Facturas.concepto') ?></th>
|
||||||
<th><?= lang('Facturas.precioUnidad') ?></th>
|
<th style="width: 10%;"><?= lang('Facturas.precioUnidad') ?></th>
|
||||||
<th><?= lang('Facturas.iva') ?></th>
|
<th style="width: 10%;"><?= lang('Facturas.iva') ?></th>
|
||||||
<th><?= lang('Facturas.subtotal') ?></th>
|
<th style="width: 10%;"><?= lang('Facturas.subtotal') ?></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -395,6 +395,10 @@ var tableLineas = $('#tableOfLineasFactura').DataTable({
|
|||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
|
drawCallback: function() {
|
||||||
|
$(this.api().table().container()).find('table').css('width', '100%');
|
||||||
|
this.api().columns.adjust();
|
||||||
|
},
|
||||||
footerCallback: function (row, data, start, end, display) {
|
footerCallback: function (row, data, start, end, display) {
|
||||||
updateFooterLineas(this.api());
|
updateFooterLineas(this.api());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,11 @@
|
|||||||
<div id="accordionAlbaranesTip" class="accordion-collapse collapse show" data-bs-parent="#accordioAlbaranes">
|
<div id="accordionAlbaranesTip" class="accordion-collapse collapse show" data-bs-parent="#accordioAlbaranes">
|
||||||
<div class="accordion-body">
|
<div class="accordion-body">
|
||||||
|
|
||||||
|
<div id='alert-albaranes' class="alert alert-warning d-flex align-items-baseline d-none" role="alert">
|
||||||
|
<div class="d-flex flex-column ps-1">
|
||||||
|
<h5 id='error-albaranes' class="alert-heading mb-2"></h5>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div id="bonotes_albaranes" class="col-12 d-flex flex-row-reverse mt-4 gap-2">
|
<div id="bonotes_albaranes" class="col-12 d-flex flex-row-reverse mt-4 gap-2">
|
||||||
<div id="generar_albaranes" class="btn mt-3 btn-success waves-effect waves-light ml-2">
|
<div id="generar_albaranes" class="btn mt-3 btn-success waves-effect waves-light ml-2">
|
||||||
<span class="align-middle d-sm-inline-block d-none me-sm-1"><?= lang('Pedidos.generarAlbaranes') ?></span>
|
<span class="align-middle d-sm-inline-block d-none me-sm-1"><?= lang('Pedidos.generarAlbaranes') ?></span>
|
||||||
@ -31,6 +35,8 @@
|
|||||||
|
|
||||||
<?=$this->section('additionalInlineJs') ?>
|
<?=$this->section('additionalInlineJs') ?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#generar_albaranes').on('click', function(){
|
$('#generar_albaranes').on('click', function(){
|
||||||
|
|
||||||
var lineasPedido = $('#tableOfLineasPedido').DataTable();
|
var lineasPedido = $('#tableOfLineasPedido').DataTable();
|
||||||
@ -51,6 +57,7 @@ $('#generar_albaranes').on('click', function(){
|
|||||||
generarAlbaran(item);
|
generarAlbaran(item);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
calcular_cantidades_albaranes();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@ -163,7 +170,7 @@ function generarAlbaran(item){
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
const table = $('<table>',
|
const table = $('<table>',
|
||||||
{ id: 'tablaAlbaran' + item.albaran.id, width:'100%', class: 'table table-responsive table-striped table-hover' })
|
{ id: 'tablaAlbaran' + item.albaran.id, width:'100%', class: 'table table-responsive table-striped table-hover table-albaran' })
|
||||||
.css({
|
.css({
|
||||||
'width': '100%',
|
'width': '100%',
|
||||||
}).append(
|
}).append(
|
||||||
@ -238,7 +245,6 @@ function generarAlbaran(item){
|
|||||||
$('#bonotes_albaranes').before(accordion);
|
$('#bonotes_albaranes').before(accordion);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const datatableAlbaran = new DataTable('#tablaAlbaran' + item.albaran.id,{
|
const datatableAlbaran = new DataTable('#tablaAlbaran' + item.albaran.id,{
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
searching: false,
|
searching: false,
|
||||||
@ -264,7 +270,7 @@ function generarAlbaran(item){
|
|||||||
var input = $('<input>', {
|
var input = $('<input>', {
|
||||||
id: 'cantidad_' + row.id,
|
id: 'cantidad_' + row.id,
|
||||||
name: 'cantidad_' + row.id,
|
name: 'cantidad_' + row.id,
|
||||||
class: 'lp-cell lp-input albaran_linea',
|
class: 'lp-cell lp-input albaran_linea cantidad-albaran',
|
||||||
albaran: item.albaran.numero_albaran,
|
albaran: item.albaran.numero_albaran,
|
||||||
type: 'text',
|
type: 'text',
|
||||||
value: data,
|
value: data,
|
||||||
@ -434,38 +440,6 @@ function generarAlbaran(item){
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
footerCallback: function (row, data, start, end, display) {
|
|
||||||
|
|
||||||
/*
|
|
||||||
let api = this.api();
|
|
||||||
var numColumns = api.columns().count();
|
|
||||||
|
|
||||||
if(item.albaran.mostrar_precios == 1){
|
|
||||||
|
|
||||||
// Remove the formatting to get integer data for summation
|
|
||||||
let intVal = function (i) {
|
|
||||||
return typeof i === 'string'
|
|
||||||
? i.replace(/[\$,]/g, '') * 1
|
|
||||||
: typeof i === 'number'
|
|
||||||
? i
|
|
||||||
: 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Total over all pages
|
|
||||||
total = api
|
|
||||||
.column(9)
|
|
||||||
.data()
|
|
||||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
|
||||||
|
|
||||||
// Update footer
|
|
||||||
api.column(numColumns-1).footer().innerHTML =
|
|
||||||
'Total: ' + total.toFixed(2);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
api.column(numColumns-1).footer().innerHTML = '';
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Añadir la nueva fila a la tabla
|
// Añadir la nueva fila a la tabla
|
||||||
@ -474,6 +448,17 @@ function generarAlbaran(item){
|
|||||||
datatableAlbaran.row.add(linea).draw();
|
datatableAlbaran.row.add(linea).draw();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$(document).on('change', '#tablaAlbaran' + item.albaran.id + ' .cantidad-albaran', function(){
|
||||||
|
let table = $('#tablaAlbaran' + item.albaran.id).DataTable();
|
||||||
|
let row = $(this).closest('tr'); // Encuentra la fila actual
|
||||||
|
let rowIndex = table.row(row).index(); // Obtiene el índice de la fila
|
||||||
|
let newValue = $(this).val(); // Obtiene el nuevo valor del input
|
||||||
|
// Actualiza el DataTable
|
||||||
|
table.cell(rowIndex, 2).data(newValue);
|
||||||
|
calcular_cantidades_albaranes();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('click', '.accordion-button', function(){
|
$(document).on('click', '.accordion-button', function(){
|
||||||
@ -712,7 +697,6 @@ $(document).on('click', '.imprimir-albaran', function(){
|
|||||||
|
|
||||||
var albaran_id = $(this).attr('id').split('_').slice(-1)[0];
|
var albaran_id = $(this).attr('id').split('_').slice(-1)[0];
|
||||||
|
|
||||||
//NACHO AQUI
|
|
||||||
window.open('<?= site_url('print-albaran/generar/') ?>' + albaran_id, '_blank');
|
window.open('<?= site_url('print-albaran/generar/') ?>' + albaran_id, '_blank');
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -726,7 +710,37 @@ $.ajax({
|
|||||||
Object.values(response.data).forEach(function(item){
|
Object.values(response.data).forEach(function(item){
|
||||||
generarAlbaran(item);
|
generarAlbaran(item);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
calcular_cantidades_albaranes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function calcular_cantidades_albaranes(){
|
||||||
|
let cantidad_albaranes = 0;
|
||||||
|
const tablas = $('.table.table-albaran');
|
||||||
|
for(var i = 0; i < tablas.length; i++){
|
||||||
|
var table = $(tablas[i]).DataTable();
|
||||||
|
table.rows().every(function(){
|
||||||
|
cantidad_albaranes += parseInt(this.data().cantidad) || 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
check_cantidad_albaranes(cantidad_albaranes);
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_cantidad_albaranes(unidades_albaranes){
|
||||||
|
if(unidades_albaranes != parseInt($('#total_tirada').val()) ){
|
||||||
|
$('#alert-albaranes').removeClass('d-none');
|
||||||
|
$('#error-albaranes').
|
||||||
|
html('<?= lang('Pedidos.validation.errorCantidadAlbaranes') ?>'
|
||||||
|
.replace('{0}', unidades_albaranes)
|
||||||
|
.replace('{1}', $('#total_tirada').val()));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('#alert-albaranes').addClass('d-none');
|
||||||
|
$('#error-albaranes').html('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
<?=$this->endSection() ?>
|
<?=$this->endSection() ?>
|
||||||
@ -152,6 +152,12 @@
|
|||||||
<span class="align-middle d-sm-inline-block d-none me-sm-1"><?= lang('Pedidos.cancelar') ?></span>
|
<span class="align-middle d-sm-inline-block d-none me-sm-1"><?= lang('Pedidos.cancelar') ?></span>
|
||||||
<i class="ti ti-circle-x ti-xs"></i>
|
<i class="ti ti-circle-x ti-xs"></i>
|
||||||
</div>
|
</div>
|
||||||
|
<?php if ($pedidoEntity->estado == 'validacion' && auth()->user()->can('pedidos-gestion.toprod')) : ?>
|
||||||
|
<div id="button-pedido-to-prod" data-id="<?= $pedidoEntity->id ?>" class="buton-estado btn mt-3 btn-primary waves-effect waves-light ml-2">
|
||||||
|
<span class="align-middle d-sm-inline-block d-none me-sm-1"><?= lang("Produccion.btn_pedido_produccion_accion") ?></span>
|
||||||
|
<i class="ti ti-building-factory-2 ti-xs"></i>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|||||||
@ -10,12 +10,19 @@
|
|||||||
<div id="accordionFacturasTip" class="accordion-collapse collapse show" data-bs-parent="#accordioFacturas">
|
<div id="accordionFacturasTip" class="accordion-collapse collapse show" data-bs-parent="#accordioFacturas">
|
||||||
<div class="accordion-body">
|
<div class="accordion-body">
|
||||||
|
|
||||||
|
<?php if ($pedidoEntity->estado == 'finalizado') : ?>
|
||||||
|
<div class="d-flex justify-content-end">
|
||||||
|
<button type="button" class="btn btn-primary btn-md" id="add-factura" ><span><?= lang("Pedidos.addFactura") ?><i class="ti ti-receipt-2 ti-xs"></i></span></button>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<table id="tableOfFacturas" class="table table-striped table-hover" style="width: 100%;grid-template-columns: 1fr 1fr 6fr 1fr 1fr 1fr;">
|
<table id="tableOfFacturas" class="table table-striped table-hover" style="width: 100%;grid-template-columns: 1fr 1fr 6fr 1fr 1fr 1fr;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="max-width:60px;"></th>
|
<th style="max-width:60px;"></th>
|
||||||
<th>ID</th>
|
<th>ID</th>
|
||||||
<th><?= lang('Facturas.numeroFactura') ?></th>
|
<th><?= lang('Facturas.numeroFactura') ?></th>
|
||||||
|
<th><?= lang('Facturas.ejemplares') ?></th>
|
||||||
<th><?= lang('Facturas.serieFacturacion') ?></th>
|
<th><?= lang('Facturas.serieFacturacion') ?></th>
|
||||||
<th><?= lang('Facturas.estado') ?></th>
|
<th><?= lang('Facturas.estado') ?></th>
|
||||||
<th><?= lang('Facturas.fechaFactura') ?></th>
|
<th><?= lang('Facturas.fechaFactura') ?></th>
|
||||||
@ -43,7 +50,7 @@ const actionBtns_facturas = function(data) {
|
|||||||
</td>`;
|
</td>`;
|
||||||
};
|
};
|
||||||
|
|
||||||
tablaFacturasPedido = $('#tableOfFacturas').DataTable({
|
window.tablaFacturasPedido = $('#tableOfFacturas').DataTable({
|
||||||
processing: true,
|
processing: true,
|
||||||
serverSide: true,
|
serverSide: true,
|
||||||
autoWidth: true,
|
autoWidth: true,
|
||||||
@ -75,6 +82,7 @@ tablaFacturasPedido = $('#tableOfFacturas').DataTable({
|
|||||||
{ 'data': actionBtns_facturas },
|
{ 'data': actionBtns_facturas },
|
||||||
{ 'data': 'id' },
|
{ 'data': 'id' },
|
||||||
{ 'data': 'numero' },
|
{ 'data': 'numero' },
|
||||||
|
{ 'data': 'ejemplares'},
|
||||||
{ 'data': 'serie' },
|
{ 'data': 'serie' },
|
||||||
{ 'data': 'estado',
|
{ 'data': 'estado',
|
||||||
render: function(data, type, row, meta) {
|
render: function(data, type, row, meta) {
|
||||||
|
|||||||
@ -96,6 +96,10 @@ var tableOfLineasPedido = new DataTable('#tableOfLineasPedido',{
|
|||||||
orderable: false,
|
orderable: false,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
drawCallback: function(){
|
||||||
|
$(this.api().table().container()).find('table').css('width', '100%');
|
||||||
|
this.api().columns.adjust();
|
||||||
|
},
|
||||||
footerCallback: function (row, data, start, end, display) {
|
footerCallback: function (row, data, start, end, display) {
|
||||||
let api = this.api();
|
let api = this.api();
|
||||||
|
|
||||||
@ -124,7 +128,7 @@ var tableOfLineasPedido = new DataTable('#tableOfLineasPedido',{
|
|||||||
|
|
||||||
|
|
||||||
$(document).on('click', '.btn-view', function(e) {
|
$(document).on('click', '.btn-view', function(e) {
|
||||||
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')): ?>
|
<?php if (!auth()->user()->inGroup('cliente-admin') && !auth()->user()->inGroup('cliente-editor')): ?>
|
||||||
var url = '<?= route_to('editarPresupuestoAdmin', ':id') ?>';
|
var url = '<?= route_to('editarPresupuestoAdmin', ':id') ?>';
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
var url = '<?= route_to('editarPresupuestoCliente2', ':id') ?>';
|
var url = '<?= route_to('editarPresupuestoCliente2', ':id') ?>';
|
||||||
|
|||||||
@ -31,11 +31,6 @@
|
|||||||
<div class="pt-4">
|
<div class="pt-4">
|
||||||
<?= anchor(route_to("listaPresupuestos"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
|
<?= anchor(route_to("listaPresupuestos"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
|
||||||
</div><!-- /.card-footer -->
|
</div><!-- /.card-footer -->
|
||||||
<?php if ($pedidoEntity->estado == 'finalizado') : ?>
|
|
||||||
<div class="pt-4">
|
|
||||||
<button type="button" class="btn btn-primary btn-md" id="button-pedido-to-prod" data-id="<?= $pedidoEntity->id ?>"><span> <i class="ti ti-building-factory-2 ti-xs"></i> <?= lang("Produccion.btn_pedido_produccion_accion") ?> </span></button>
|
|
||||||
</div><!-- /.card-footer -->
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container-fluid d-flex flex-md-row flex-column justify-content-between align-items-md-center gap-1 container-p-x py-3">
|
<div class="container-fluid d-flex flex-md-row flex-column justify-content-between align-items-md-center gap-1 container-p-x py-3">
|
||||||
@ -70,6 +65,7 @@
|
|||||||
href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
|
href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
|
||||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/sk-datatables.css') ?>">
|
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/sk-datatables.css') ?>">
|
||||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
|
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
|
||||||
|
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/pedidos.css') ?>">
|
||||||
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
@ -89,4 +85,6 @@
|
|||||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>"
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>"
|
||||||
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
|
||||||
|
|
||||||
|
<script type="module" src="<?= site_url("assets/js/safekat/pages/pedidos/pedidos.js") ?>"></script>
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -61,9 +61,12 @@ class Cliente {
|
|||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
|
||||||
const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
|
const dropdown = document.querySelector(".dropdown-language");
|
||||||
|
const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
|
||||||
|
let locale = 'es';
|
||||||
|
if (activeItem) {
|
||||||
|
locale = activeItem.getAttribute("data-language");
|
||||||
|
}
|
||||||
|
|
||||||
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['ClienteContactos', 'ClientePrecios'] }, {},
|
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['ClienteContactos', 'ClientePrecios'] }, {},
|
||||||
function(translations) {
|
function(translations) {
|
||||||
|
|||||||
@ -147,7 +147,12 @@ class ClienteList {
|
|||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
|
||||||
const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
|
const dropdown = document.querySelector(".dropdown-language");
|
||||||
|
const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
|
||||||
|
let locale = 'es';
|
||||||
|
if (activeItem) {
|
||||||
|
locale = activeItem.getAttribute("data-language");
|
||||||
|
}
|
||||||
|
|
||||||
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Clientes', 'FormasPago', 'Users'] }, {},
|
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Clientes', 'FormasPago', 'Users'] }, {},
|
||||||
function (translations) {
|
function (translations) {
|
||||||
|
|||||||
@ -182,7 +182,12 @@ class MaquinasList {
|
|||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
|
||||||
const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
|
const dropdown = document.querySelector(".dropdown-language");
|
||||||
|
const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
|
||||||
|
let locale = 'es';
|
||||||
|
if (activeItem) {
|
||||||
|
locale = activeItem.getAttribute("data-language");
|
||||||
|
}
|
||||||
|
|
||||||
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Maquinas'] }, {},
|
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Maquinas'] }, {},
|
||||||
function (translations) {
|
function (translations) {
|
||||||
|
|||||||
@ -775,9 +775,12 @@ class PlantillasTarifasClienteForm {
|
|||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
|
||||||
const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
|
const dropdown = document.querySelector(".dropdown-language");
|
||||||
|
const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
|
||||||
|
let locale = 'es';
|
||||||
|
if (activeItem) {
|
||||||
|
locale = activeItem.getAttribute("data-language");
|
||||||
|
}
|
||||||
|
|
||||||
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['ClientePrecios'] }, {},
|
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['ClientePrecios'] }, {},
|
||||||
function (translations) {
|
function (translations) {
|
||||||
|
|||||||
@ -172,7 +172,12 @@ class PresupuestoAdminAdd {
|
|||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
|
||||||
const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
|
const dropdown = document.querySelector(".dropdown-language");
|
||||||
|
const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
|
||||||
|
let locale = 'es';
|
||||||
|
if (activeItem) {
|
||||||
|
locale = activeItem.getAttribute("data-language");
|
||||||
|
}
|
||||||
|
|
||||||
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Presupuestos', 'PresupuestosDirecciones'] }, {},
|
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Presupuestos', 'PresupuestosDirecciones'] }, {},
|
||||||
function (translations) {
|
function (translations) {
|
||||||
|
|||||||
@ -640,7 +640,12 @@ class PresupuestoAdminEdit {
|
|||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
|
||||||
const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
|
const dropdown = document.querySelector(".dropdown-language");
|
||||||
|
const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
|
||||||
|
let locale = 'es';
|
||||||
|
if (activeItem) {
|
||||||
|
locale = activeItem.getAttribute("data-language");
|
||||||
|
}
|
||||||
|
|
||||||
$(document).on("keydown", "textarea", function (event) {
|
$(document).on("keydown", "textarea", function (event) {
|
||||||
if (event.key === "Enter" && !event.shiftKey) {
|
if (event.key === "Enter" && !event.shiftKey) {
|
||||||
|
|||||||
@ -992,7 +992,12 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
|
const dropdown = document.querySelector(".dropdown-language");
|
||||||
|
const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
|
||||||
|
let locale = 'es';
|
||||||
|
if (activeItem) {
|
||||||
|
locale = activeItem.getAttribute("data-language");
|
||||||
|
}
|
||||||
|
|
||||||
new Ajax('/translate/getTranslation', { locale: locale, translationFile: 'Presupuestos' }, {},
|
new Ajax('/translate/getTranslation', { locale: locale, translationFile: 'Presupuestos' }, {},
|
||||||
initialize,
|
initialize,
|
||||||
|
|||||||
@ -293,7 +293,12 @@ class Ticket {
|
|||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
|
||||||
const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
|
const dropdown = document.querySelector(".dropdown-language");
|
||||||
|
const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
|
||||||
|
let locale = 'es';
|
||||||
|
if (activeItem) {
|
||||||
|
locale = activeItem.getAttribute("data-language");
|
||||||
|
}
|
||||||
|
|
||||||
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Tickets', 'datePicker'] }, {},
|
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Tickets', 'datePicker'] }, {},
|
||||||
function (translations) {
|
function (translations) {
|
||||||
|
|||||||
Reference in New Issue
Block a user