mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'dev/presu_cliente_v2' into fix/message-notification
This commit is contained in:
@ -1278,8 +1278,8 @@ class Cosidotapablanda extends \App\Controllers\BaseResourceController
|
|||||||
$input_data['is_duplicado'] = $presupuestoEntity->is_duplicado;
|
$input_data['is_duplicado'] = $presupuestoEntity->is_duplicado;
|
||||||
|
|
||||||
if($presupuestoEntity->papel_formato_personalizado){
|
if($presupuestoEntity->papel_formato_personalizado){
|
||||||
$input_data['ancho'] = $presupuestoEntity->ancho;
|
$input_data['ancho'] = $presupuestoEntity->papel_formato_ancho ;
|
||||||
$input_data['alto'] = $presupuestoEntity->alto;
|
$input_data['alto'] = $presupuestoEntity->papel_formato_alto ;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$model = model("App\Models\Configuracion\PapelFormatoModel");
|
$model = model("App\Models\Configuracion\PapelFormatoModel");
|
||||||
|
|||||||
@ -99,9 +99,16 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
|
|
||||||
// Se obtiene el cliente ID a partir del usuario de la sesion
|
// Se obtiene el cliente ID a partir del usuario de la sesion
|
||||||
$model_user = model('App\Models\Usuarios\UserModel');
|
$model_user = model('App\Models\Usuarios\UserModel');
|
||||||
|
|
||||||
$user = $model_user->find(auth()->user()->id);
|
$user = $model_user->find(auth()->user()->id);
|
||||||
$clienteId = $user->cliente_id;
|
$clienteId = $user->cliente_id;
|
||||||
|
|
||||||
|
if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
|
||||||
|
if ($clienteId === false || $clienteId === null) {
|
||||||
|
return $this->failNotFound('Su usuario no tiene asociado un cliente de Safekat. Póngase en contacto con el administrador.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$POD = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD();
|
$POD = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD();
|
||||||
|
|
||||||
$this->viewData['breadcrumb'] = [
|
$this->viewData['breadcrumb'] = [
|
||||||
@ -139,6 +146,9 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
$user = $model_user->find(auth()->user()->id);
|
$user = $model_user->find(auth()->user()->id);
|
||||||
if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
|
if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
|
||||||
$clienteId = $user->cliente_id;
|
$clienteId = $user->cliente_id;
|
||||||
|
if ($clienteId === false || $clienteId === null) {
|
||||||
|
return $this->failNotFound('Su usuario no tiene asociado un cliente de Safekat. Póngase en contacto con el administrador.');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$clienteId = $presupuestoEntity->cliente_id;
|
$clienteId = $presupuestoEntity->cliente_id;
|
||||||
}
|
}
|
||||||
@ -154,8 +164,9 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
if ($presupuestoEntity->is_duplicado) {
|
if ($presupuestoEntity->is_duplicado) {
|
||||||
$this->model->removeIsDuplicado($presupuestoEntity->id);
|
$this->model->removeIsDuplicado($presupuestoEntity->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->viewData['presupuestoId'] = $presupuestoEntity->id;
|
$this->viewData['presupuestoId'] = $presupuestoEntity->id;
|
||||||
|
$this->viewData['state'] = intval($presupuestoEntity->estado_id);
|
||||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . $this->viewData['pageTitle'] . ' ' . lang('Basic.global.edit3');
|
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . $this->viewData['pageTitle'] . ' ' . lang('Basic.global.edit3');
|
||||||
|
|
||||||
return $this->displayForm(__METHOD__, $id);
|
return $this->displayForm(__METHOD__, $id);
|
||||||
@ -374,7 +385,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
if (array_key_exists('exception', $return_data)) {
|
if (array_key_exists('exception', $return_data)) {
|
||||||
return $this->failServerError(
|
return $this->failServerError(
|
||||||
$return_data['exception'] . ' - ' .
|
$return_data['exception'] . ' - ' .
|
||||||
$return_data['file'] . ' - ' . $return_data['line']
|
$return_data['file'] . ' - ' . $return_data['line']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -616,6 +627,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
$datosCabecera = $reqData['datosCabecera'] ?? [];
|
$datosCabecera = $reqData['datosCabecera'] ?? [];
|
||||||
|
|
||||||
$confirmar = $reqData['confirmar'] ?? 0;
|
$confirmar = $reqData['confirmar'] ?? 0;
|
||||||
|
$confirmar = intval($confirmar);
|
||||||
|
|
||||||
$cliente_id = $reqData['clienteId'] ?? -1;
|
$cliente_id = $reqData['clienteId'] ?? -1;
|
||||||
|
|
||||||
@ -918,17 +930,16 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
{
|
{
|
||||||
if ($this->request->isAJAX()) {
|
if ($this->request->isAJAX()) {
|
||||||
|
|
||||||
$modelPapelGenerico = new PapelGenericoModel();
|
|
||||||
$modelPapelFormato = new PapelFormatoModel();
|
$modelPapelFormato = new PapelFormatoModel();
|
||||||
$modelCliente = new ClienteModel();
|
$modelCliente = new ClienteModel();
|
||||||
|
|
||||||
$reqData = $this->request->getPost();
|
|
||||||
|
|
||||||
$presupuesto = $this->model->find($id);
|
$presupuesto = $this->model->find($id);
|
||||||
$data = [];
|
$data = [];
|
||||||
if ($presupuesto) {
|
if ($presupuesto) {
|
||||||
$data['lc'] = $presupuesto->lomo_cubierta;
|
$data['lc'] = $presupuesto->lomo_cubierta;
|
||||||
$data['lsc'] = $presupuesto->lomo_sobrecubierta;
|
$data['lsc'] = $presupuesto->lomo_sobrecubierta;
|
||||||
|
$data['state'] = intval($presupuesto->estado_id);
|
||||||
$data['datosGenerales']['titulo'] = $presupuesto->titulo;
|
$data['datosGenerales']['titulo'] = $presupuesto->titulo;
|
||||||
$data['datosGenerales']['autor'] = $presupuesto->autor;
|
$data['datosGenerales']['autor'] = $presupuesto->autor;
|
||||||
$data['datosGenerales']['isbn'] = $presupuesto->isbn;
|
$data['datosGenerales']['isbn'] = $presupuesto->isbn;
|
||||||
@ -995,6 +1006,11 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
|
|
||||||
$data['direcciones'] = $this->obtenerDireccionesEnvio($id, $presupuesto->cliente_id);
|
$data['direcciones'] = $this->obtenerDireccionesEnvio($id, $presupuesto->cliente_id);
|
||||||
|
|
||||||
|
if(intval($presupuesto->estado_id) == 2){
|
||||||
|
$data['resumen']['base'] = $presupuesto->total_aceptado;
|
||||||
|
$data['resumen']['precio_unidad'] = $presupuesto->total_precio_unidad;
|
||||||
|
}
|
||||||
|
|
||||||
$tiradas_alternativas = json_decode($presupuesto->tirada_alternativa_json_data);
|
$tiradas_alternativas = json_decode($presupuesto->tirada_alternativa_json_data);
|
||||||
for ($i = 0; $i < count($tiradas_alternativas); $i++) {
|
for ($i = 0; $i < count($tiradas_alternativas); $i++) {
|
||||||
$tirada = $tiradas_alternativas[$i];
|
$tirada = $tiradas_alternativas[$i];
|
||||||
@ -2134,7 +2150,8 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
$color = 'negro';
|
$color = 'negro';
|
||||||
|
|
||||||
$model = model('App\Models\Presupuestos\PresupuestoLineaModel');
|
$model = model('App\Models\Presupuestos\PresupuestoLineaModel');
|
||||||
$data = $model->where('presupuesto_id', $presupuestoId)->findAll();;
|
$data = $model->where('presupuesto_id', $presupuestoId)->findAll();
|
||||||
|
;
|
||||||
foreach ($data as $linea) {
|
foreach ($data as $linea) {
|
||||||
|
|
||||||
if (strpos($linea->tipo, "hq") !== false) { // $linea->tipo contains the substring "hq"
|
if (strpos($linea->tipo, "hq") !== false) { // $linea->tipo contains the substring "hq"
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
<?php namespace App\Controllers\Tarifas;
|
<?php
|
||||||
|
namespace App\Controllers\Tarifas;
|
||||||
|
|
||||||
|
|
||||||
use App\Controllers\BaseResourceController;
|
use App\Controllers\BaseResourceController;
|
||||||
@ -10,15 +11,15 @@ use App\Entities\Tarifas\TarifaEncuadernacionLinea;
|
|||||||
use App\Models\Tarifas\TarifaEncuadernacionLineaModel;
|
use App\Models\Tarifas\TarifaEncuadernacionLineaModel;
|
||||||
|
|
||||||
use
|
use
|
||||||
DataTables\Editor,
|
DataTables\Editor,
|
||||||
DataTables\Database,
|
DataTables\Database,
|
||||||
DataTables\Editor\Field,
|
DataTables\Editor\Field,
|
||||||
DataTables\Editor\Format,
|
DataTables\Editor\Format,
|
||||||
DataTables\Editor\Mjoin,
|
DataTables\Editor\Mjoin,
|
||||||
DataTables\Editor\Options,
|
DataTables\Editor\Options,
|
||||||
DataTables\Editor\Upload,
|
DataTables\Editor\Upload,
|
||||||
DataTables\Editor\Validate,
|
DataTables\Editor\Validate,
|
||||||
DataTables\Editor\ValidateOptions;
|
DataTables\Editor\ValidateOptions;
|
||||||
|
|
||||||
|
|
||||||
class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
|
class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
|
||||||
@ -73,9 +74,9 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($this->request->getPost()) :
|
|
||||||
|
if ($this->request->getPost()):
|
||||||
|
|
||||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||||
|
|
||||||
@ -84,10 +85,10 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
|
|||||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||||
|
|
||||||
$noException = true;
|
$noException = true;
|
||||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||||
|
|
||||||
|
|
||||||
if ($this->canValidate()) :
|
if ($this->canValidate()):
|
||||||
try {
|
try {
|
||||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -101,14 +102,14 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
|
|||||||
|
|
||||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||||
endif;
|
endif;
|
||||||
if ($noException && $successfulResult) :
|
if ($noException && $successfulResult):
|
||||||
|
|
||||||
$id = $this->model->db->insertID();
|
$id = $this->model->db->insertID();
|
||||||
|
|
||||||
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||||
|
|
||||||
if ($thenRedirect) :
|
if ($thenRedirect):
|
||||||
if (!empty($this->indexRoute)) :
|
if (!empty($this->indexRoute)):
|
||||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||||
else:
|
else:
|
||||||
return $this->redirect2listView('sweet-success', $message);
|
return $this->redirect2listView('sweet-success', $message);
|
||||||
@ -134,20 +135,20 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
|
|||||||
public function edit($requestedId = null)
|
public function edit($requestedId = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($requestedId == null) :
|
if ($requestedId == null):
|
||||||
return $this->redirect2listView();
|
return $this->redirect2listView();
|
||||||
endif;
|
endif;
|
||||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||||
$tarifaEncuadernacionLinea = $this->model->find($id);
|
$tarifaEncuadernacionLinea = $this->model->find($id);
|
||||||
|
|
||||||
if ($tarifaEncuadernacionLinea == false) :
|
if ($tarifaEncuadernacionLinea == false):
|
||||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('TarifaEncuadernacionLineas.tarifaencuadernacionLinea')), $id]);
|
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('TarifaEncuadernacionLineas.tarifaencuadernacionLinea')), $id]);
|
||||||
return $this->redirect2listView('sweet-error', $message);
|
return $this->redirect2listView('sweet-error', $message);
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($this->request->getPost()) :
|
|
||||||
|
if ($this->request->getPost()):
|
||||||
|
|
||||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||||
|
|
||||||
@ -156,10 +157,10 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
|
|||||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||||
|
|
||||||
$noException = true;
|
$noException = true;
|
||||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||||
|
|
||||||
|
|
||||||
if ($this->canValidate()) :
|
if ($this->canValidate()):
|
||||||
try {
|
try {
|
||||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -176,12 +177,12 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
|
|||||||
|
|
||||||
$thenRedirect = false;
|
$thenRedirect = false;
|
||||||
endif;
|
endif;
|
||||||
if ($noException && $successfulResult) :
|
if ($noException && $successfulResult):
|
||||||
$id = $tarifaEncuadernacionLinea->id ?? $id;
|
$id = $tarifaEncuadernacionLinea->id ?? $id;
|
||||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||||
|
|
||||||
if ($thenRedirect) :
|
if ($thenRedirect):
|
||||||
if (!empty($this->indexRoute)) :
|
if (!empty($this->indexRoute)):
|
||||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||||
else:
|
else:
|
||||||
return $this->redirect2listView('sweet-success', $message);
|
return $this->redirect2listView('sweet-success', $message);
|
||||||
@ -214,45 +215,90 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
|
|||||||
$response = Editor::inst($db, 'tarifa_encuadernacion_lineas')
|
$response = Editor::inst($db, 'tarifa_encuadernacion_lineas')
|
||||||
->fields(
|
->fields(
|
||||||
Field::inst('paginas_libro_min')
|
Field::inst('paginas_libro_min')
|
||||||
->validator('Validate::numeric', array(
|
->validator(
|
||||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.decimal'))
|
'Validate::numeric',
|
||||||
|
array(
|
||||||
|
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.decimal')
|
||||||
|
)
|
||||||
)
|
)
|
||||||
->validator('Validate::notEmpty', array(
|
->validator(
|
||||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.required'))
|
'Validate::notEmpty',
|
||||||
|
array(
|
||||||
|
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.required')
|
||||||
|
)
|
||||||
),
|
),
|
||||||
Field::inst('paginas_libro_max')
|
Field::inst('paginas_libro_max')
|
||||||
->validator('Validate::numeric', array(
|
->validator(
|
||||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.decimal'))
|
'Validate::numeric',
|
||||||
|
array(
|
||||||
|
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.decimal')
|
||||||
|
)
|
||||||
)
|
)
|
||||||
->validator('Validate::notEmpty', array(
|
->validator(
|
||||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.required'))
|
'Validate::notEmpty',
|
||||||
|
array(
|
||||||
|
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.required')
|
||||||
|
)
|
||||||
),
|
),
|
||||||
Field::inst('precio_min')
|
Field::inst('precio_min')
|
||||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||||
->validator('Validate::numeric', array(
|
->validator(
|
||||||
|
'Validate::numeric',
|
||||||
|
array(
|
||||||
"decimal" => ',',
|
"decimal" => ',',
|
||||||
'message' => lang('TarifaAcabadoLineas.validation.precio_min.decimal'))
|
'message' => lang('TarifaAcabadoLineas.validation.precio_min.decimal')
|
||||||
|
)
|
||||||
)
|
)
|
||||||
->validator('Validate::notEmpty', array(
|
->validator(
|
||||||
'message' => lang('TarifaAcabadoLineas.validation.precio_min.required'))
|
'Validate::notEmpty',
|
||||||
|
array(
|
||||||
|
'message' => lang('TarifaAcabadoLineas.validation.precio_min.required')
|
||||||
|
)
|
||||||
),
|
),
|
||||||
Field::inst('precio_max')
|
Field::inst('precio_max')
|
||||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||||
->validator('Validate::numeric', array(
|
->validator(
|
||||||
|
'Validate::numeric',
|
||||||
|
array(
|
||||||
"decimal" => ',',
|
"decimal" => ',',
|
||||||
'message' => lang('TarifaAcabadoLineas.validation.precio_max.decimal'))
|
'message' => lang('TarifaAcabadoLineas.validation.precio_max.decimal')
|
||||||
|
)
|
||||||
)
|
)
|
||||||
->validator('Validate::notEmpty', array(
|
->validator(
|
||||||
'message' => lang('TarifaAcabadoLineas.validation.precio_max.required'))
|
'Validate::notEmpty',
|
||||||
|
array(
|
||||||
|
'message' => lang('TarifaAcabadoLineas.validation.precio_max.required')
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Field::inst('total_min')
|
||||||
|
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||||
|
->validator(
|
||||||
|
'Validate::numeric',
|
||||||
|
array(
|
||||||
|
"decimal" => ',',
|
||||||
|
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_min.decimal')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
->validator(
|
||||||
|
'Validate::notEmpty',
|
||||||
|
array(
|
||||||
|
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_min.required')
|
||||||
|
)
|
||||||
),
|
),
|
||||||
Field::inst('margen')
|
Field::inst('margen')
|
||||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||||
->validator('Validate::numeric', array(
|
->validator(
|
||||||
|
'Validate::numeric',
|
||||||
|
array(
|
||||||
"decimal" => ',',
|
"decimal" => ',',
|
||||||
'message' => lang('TarifaAcabadoLineas.validation.margen.decimal'))
|
'message' => lang('TarifaAcabadoLineas.validation.margen.decimal')
|
||||||
|
)
|
||||||
)
|
)
|
||||||
->validator('Validate::notEmpty', array(
|
->validator(
|
||||||
'message' => lang('TarifaAcabadoLineas.validation.margen.required'))
|
'Validate::notEmpty',
|
||||||
|
array(
|
||||||
|
'message' => lang('TarifaAcabadoLineas.validation.margen.required')
|
||||||
|
)
|
||||||
),
|
),
|
||||||
Field::inst('tirada_encuadernacion_id'),
|
Field::inst('tirada_encuadernacion_id'),
|
||||||
Field::inst('user_created_id'),
|
Field::inst('user_created_id'),
|
||||||
@ -322,10 +368,10 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
|
|||||||
if ($this->request->isAJAX()) {
|
if ($this->request->isAJAX()) {
|
||||||
|
|
||||||
$reqData = $this->request->getPost();
|
$reqData = $this->request->getPost();
|
||||||
|
|
||||||
$cleandatatable = $reqData['cleandatatable'] ?? 0;
|
$cleandatatable = $reqData['cleandatatable'] ?? 0;
|
||||||
|
|
||||||
if($cleandatatable){
|
if ($cleandatatable) {
|
||||||
|
|
||||||
$tarifa_encuadernacion_id = $reqData['tarifa_encuadernacion_id'] ?? -1;
|
$tarifa_encuadernacion_id = $reqData['tarifa_encuadernacion_id'] ?? -1;
|
||||||
|
|
||||||
@ -338,11 +384,9 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
|
|||||||
$csrfTokenName => $newTokenHash
|
$csrfTokenName => $newTokenHash
|
||||||
];
|
];
|
||||||
return $this->respond($data);
|
return $this->respond($data);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
else{
|
} else {
|
||||||
|
|
||||||
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
|
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
|
||||||
$errstr = 'No data available in response to this specific request.';
|
$errstr = 'No data available in response to this specific request.';
|
||||||
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
|
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
<?php namespace App\Controllers\Tarifas;
|
<?php
|
||||||
|
namespace App\Controllers\Tarifas;
|
||||||
|
|
||||||
|
|
||||||
use App\Controllers\BaseResourceController;
|
use App\Controllers\BaseResourceController;
|
||||||
@ -10,15 +11,15 @@ use App\Entities\Tarifas\TarifaEncuadernacionLinea;
|
|||||||
use App\Models\Tarifas\TarifaEncuadernacionLineaHorasModel;
|
use App\Models\Tarifas\TarifaEncuadernacionLineaHorasModel;
|
||||||
|
|
||||||
use
|
use
|
||||||
DataTables\Editor,
|
DataTables\Editor,
|
||||||
DataTables\Database,
|
DataTables\Database,
|
||||||
DataTables\Editor\Field,
|
DataTables\Editor\Field,
|
||||||
DataTables\Editor\Format,
|
DataTables\Editor\Format,
|
||||||
DataTables\Editor\Mjoin,
|
DataTables\Editor\Mjoin,
|
||||||
DataTables\Editor\Options,
|
DataTables\Editor\Options,
|
||||||
DataTables\Editor\Upload,
|
DataTables\Editor\Upload,
|
||||||
DataTables\Editor\Validate,
|
DataTables\Editor\Validate,
|
||||||
DataTables\Editor\ValidateOptions;
|
DataTables\Editor\ValidateOptions;
|
||||||
|
|
||||||
|
|
||||||
class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceController
|
class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceController
|
||||||
@ -71,9 +72,9 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
|
|||||||
|
|
||||||
public function add()
|
public function add()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if ($this->request->getPost()) :
|
|
||||||
|
if ($this->request->getPost()):
|
||||||
|
|
||||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||||
|
|
||||||
@ -82,10 +83,10 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
|
|||||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||||
|
|
||||||
$noException = true;
|
$noException = true;
|
||||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||||
|
|
||||||
|
|
||||||
if ($this->canValidate()) :
|
if ($this->canValidate()):
|
||||||
try {
|
try {
|
||||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -99,14 +100,14 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
|
|||||||
|
|
||||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||||
endif;
|
endif;
|
||||||
if ($noException && $successfulResult) :
|
if ($noException && $successfulResult):
|
||||||
|
|
||||||
$id = $this->model->db->insertID();
|
$id = $this->model->db->insertID();
|
||||||
|
|
||||||
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||||
|
|
||||||
if ($thenRedirect) :
|
if ($thenRedirect):
|
||||||
if (!empty($this->indexRoute)) :
|
if (!empty($this->indexRoute)):
|
||||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||||
else:
|
else:
|
||||||
return $this->redirect2listView('sweet-success', $message);
|
return $this->redirect2listView('sweet-success', $message);
|
||||||
@ -134,20 +135,20 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
|
|||||||
public function edit($requestedId = null)
|
public function edit($requestedId = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($requestedId == null) :
|
if ($requestedId == null):
|
||||||
return $this->redirect2listView();
|
return $this->redirect2listView();
|
||||||
endif;
|
endif;
|
||||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||||
$tarifaEncuadernacionLinea = $this->model->find($id);
|
$tarifaEncuadernacionLinea = $this->model->find($id);
|
||||||
|
|
||||||
if ($tarifaEncuadernacionLinea == false) :
|
if ($tarifaEncuadernacionLinea == false):
|
||||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('TarifaEncuadernacionLineas.tarifaencuadernacionLinea')), $id]);
|
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('TarifaEncuadernacionLineas.tarifaencuadernacionLinea')), $id]);
|
||||||
return $this->redirect2listView('sweet-error', $message);
|
return $this->redirect2listView('sweet-error', $message);
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($this->request->getPost()) :
|
|
||||||
|
if ($this->request->getPost()):
|
||||||
|
|
||||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||||
|
|
||||||
@ -156,10 +157,10 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
|
|||||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||||
|
|
||||||
$noException = true;
|
$noException = true;
|
||||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||||
|
|
||||||
|
|
||||||
if ($this->canValidate()) :
|
if ($this->canValidate()):
|
||||||
try {
|
try {
|
||||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -176,12 +177,12 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
|
|||||||
|
|
||||||
$thenRedirect = false;
|
$thenRedirect = false;
|
||||||
endif;
|
endif;
|
||||||
if ($noException && $successfulResult) :
|
if ($noException && $successfulResult):
|
||||||
$id = $tarifaEncuadernacionLinea->id ?? $id;
|
$id = $tarifaEncuadernacionLinea->id ?? $id;
|
||||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||||
|
|
||||||
if ($thenRedirect) :
|
if ($thenRedirect):
|
||||||
if (!empty($this->indexRoute)) :
|
if (!empty($this->indexRoute)):
|
||||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||||
else:
|
else:
|
||||||
return $this->redirect2listView('sweet-success', $message);
|
return $this->redirect2listView('sweet-success', $message);
|
||||||
@ -214,40 +215,79 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
|
|||||||
$response = Editor::inst($db, 'tarifa_encuadernacion_lineas_horas')
|
$response = Editor::inst($db, 'tarifa_encuadernacion_lineas_horas')
|
||||||
->fields(
|
->fields(
|
||||||
Field::inst('tiempo_min')
|
Field::inst('tiempo_min')
|
||||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||||
->validator('Validate::numeric', array(
|
->validator(
|
||||||
|
'Validate::numeric',
|
||||||
|
array(
|
||||||
"decimal" => ',',
|
"decimal" => ',',
|
||||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.decimal'))
|
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.decimal')
|
||||||
|
)
|
||||||
)
|
)
|
||||||
->validator('Validate::notEmpty', array(
|
->validator(
|
||||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.required'))
|
'Validate::notEmpty',
|
||||||
|
array(
|
||||||
|
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.required')
|
||||||
|
)
|
||||||
),
|
),
|
||||||
Field::inst('tiempo_max')
|
Field::inst('tiempo_max')
|
||||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||||
->validator('Validate::numeric', array(
|
->validator(
|
||||||
|
'Validate::numeric',
|
||||||
|
array(
|
||||||
"decimal" => ',',
|
"decimal" => ',',
|
||||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.decimal'))
|
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.decimal')
|
||||||
|
)
|
||||||
)
|
)
|
||||||
->validator('Validate::notEmpty', array(
|
->validator(
|
||||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.required'))
|
'Validate::notEmpty',
|
||||||
|
array(
|
||||||
|
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.required')
|
||||||
|
)
|
||||||
),
|
),
|
||||||
Field::inst('precio_hora')
|
Field::inst('precio_hora')
|
||||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||||
->validator('Validate::numeric', array(
|
->validator(
|
||||||
|
'Validate::numeric',
|
||||||
|
array(
|
||||||
"decimal" => ',',
|
"decimal" => ',',
|
||||||
'message' => lang('TarifaAcabadoLineas.validation.precio_min.decimal'))
|
'message' => lang('TarifaAcabadoLineas.validation.precio_min.decimal')
|
||||||
|
)
|
||||||
)
|
)
|
||||||
->validator('Validate::notEmpty', array(
|
->validator(
|
||||||
'message' => lang('TarifaAcabadoLineas.validation.precio_min.required'))
|
'Validate::notEmpty',
|
||||||
|
array(
|
||||||
|
'message' => lang('TarifaAcabadoLineas.validation.precio_min.required')
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Field::inst('total_min')
|
||||||
|
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||||
|
->validator(
|
||||||
|
'Validate::numeric',
|
||||||
|
array(
|
||||||
|
"decimal" => ',',
|
||||||
|
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_min.decimal')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
->validator(
|
||||||
|
'Validate::notEmpty',
|
||||||
|
array(
|
||||||
|
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_min.required')
|
||||||
|
)
|
||||||
),
|
),
|
||||||
Field::inst('margen')
|
Field::inst('margen')
|
||||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||||
->validator('Validate::numeric', array(
|
->validator(
|
||||||
|
'Validate::numeric',
|
||||||
|
array(
|
||||||
"decimal" => ',',
|
"decimal" => ',',
|
||||||
'message' => lang('TarifaAcabadoLineas.validation.margen.decimal'))
|
'message' => lang('TarifaAcabadoLineas.validation.margen.decimal')
|
||||||
|
)
|
||||||
)
|
)
|
||||||
->validator('Validate::notEmpty', array(
|
->validator(
|
||||||
'message' => lang('TarifaAcabadoLineas.validation.margen.required'))
|
'Validate::notEmpty',
|
||||||
|
array(
|
||||||
|
'message' => lang('TarifaAcabadoLineas.validation.margen.required')
|
||||||
|
)
|
||||||
),
|
),
|
||||||
Field::inst('tirada_encuadernacion_id'),
|
Field::inst('tirada_encuadernacion_id'),
|
||||||
Field::inst('user_created_id'),
|
Field::inst('user_created_id'),
|
||||||
@ -314,10 +354,10 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
|
|||||||
{
|
{
|
||||||
if ($this->request->isAJAX()) {
|
if ($this->request->isAJAX()) {
|
||||||
$reqData = $this->request->getPost();
|
$reqData = $this->request->getPost();
|
||||||
|
|
||||||
$cleandatatable = $reqData['cleandatatable'] ?? 0;
|
$cleandatatable = $reqData['cleandatatable'] ?? 0;
|
||||||
|
|
||||||
if($cleandatatable){
|
if ($cleandatatable) {
|
||||||
|
|
||||||
$tarifa_encuadernacion_id = $reqData['tarifa_encuadernacion_id'] ?? -1;
|
$tarifa_encuadernacion_id = $reqData['tarifa_encuadernacion_id'] ?? -1;
|
||||||
|
|
||||||
@ -330,9 +370,8 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
|
|||||||
$csrfTokenName => $newTokenHash
|
$csrfTokenName => $newTokenHash
|
||||||
];
|
];
|
||||||
return $this->respond($data);
|
return $this->respond($data);
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
|
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
|
||||||
$errstr = 'No data available in response to this specific request.';
|
$errstr = 'No data available in response to this specific request.';
|
||||||
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
|
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
|
||||||
|
|||||||
@ -126,15 +126,6 @@ class Tarifaencuadernaciontiradas extends \App\Controllers\BaseResourceControlle
|
|||||||
->validator('Validate::notEmpty', array(
|
->validator('Validate::notEmpty', array(
|
||||||
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_min.required'))
|
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_min.required'))
|
||||||
),
|
),
|
||||||
Field::inst('precio_min')
|
|
||||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
|
||||||
->validator('Validate::numeric', array(
|
|
||||||
"decimal" => ',',
|
|
||||||
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_min.decimal'))
|
|
||||||
)
|
|
||||||
->validator('Validate::notEmpty', array(
|
|
||||||
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_min.required'))
|
|
||||||
),
|
|
||||||
Field::inst('proveedor_id')
|
Field::inst('proveedor_id')
|
||||||
->validator('Validate::notEmpty', array(
|
->validator('Validate::notEmpty', array(
|
||||||
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_max.required'))
|
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_max.required'))
|
||||||
|
|||||||
@ -15,6 +15,7 @@ class TarifaEncuadernacionLinea extends \CodeIgniter\Entity\Entity
|
|||||||
"precio_max" => 0,
|
"precio_max" => 0,
|
||||||
"tirada_min" => 0,
|
"tirada_min" => 0,
|
||||||
"tirada_max" => 0,
|
"tirada_max" => 0,
|
||||||
|
"total_min" => 0,
|
||||||
"margen" => 0,
|
"margen" => 0,
|
||||||
"user_created_id" => 0,
|
"user_created_id" => 0,
|
||||||
"user_updated_id" => 0,
|
"user_updated_id" => 0,
|
||||||
@ -31,6 +32,7 @@ class TarifaEncuadernacionLinea extends \CodeIgniter\Entity\Entity
|
|||||||
"precio_max" => "float",
|
"precio_max" => "float",
|
||||||
"tirada_min" => "float",
|
"tirada_min" => "float",
|
||||||
"tirada_max" => "float",
|
"tirada_max" => "float",
|
||||||
|
"total_min" => "float",
|
||||||
"margen" => "float",
|
"margen" => "float",
|
||||||
"user_created_id" => "int",
|
"user_created_id" => "int",
|
||||||
"user_updated_id" => "int",
|
"user_updated_id" => "int",
|
||||||
|
|||||||
@ -11,6 +11,7 @@ class TarifaEncuadernacionLineaHoras extends \CodeIgniter\Entity\Entity
|
|||||||
"tiempo_min" => 0,
|
"tiempo_min" => 0,
|
||||||
"tiempo_max" => 0,
|
"tiempo_max" => 0,
|
||||||
"precio_hora" => 0,
|
"precio_hora" => 0,
|
||||||
|
"total_min" => 0,
|
||||||
"margen" => 0,
|
"margen" => 0,
|
||||||
"user_created_id" => 0,
|
"user_created_id" => 0,
|
||||||
"user_updated_id" => 0,
|
"user_updated_id" => 0,
|
||||||
@ -22,6 +23,7 @@ class TarifaEncuadernacionLineaHoras extends \CodeIgniter\Entity\Entity
|
|||||||
"tirada_encuadernacion_id" => "int",
|
"tirada_encuadernacion_id" => "int",
|
||||||
"tiempo_min" => "float",
|
"tiempo_min" => "float",
|
||||||
"tiempo_max" => "float",
|
"tiempo_max" => "float",
|
||||||
|
"total_min" => "float",
|
||||||
"precio_hora" => "float",
|
"precio_hora" => "float",
|
||||||
"margen" => "float",
|
"margen" => "float",
|
||||||
"user_created_id" => "int",
|
"user_created_id" => "int",
|
||||||
|
|||||||
@ -11,7 +11,6 @@ class TarifaEncuadernacionTirada extends \CodeIgniter\Entity\Entity
|
|||||||
"tirada_min" => 0,
|
"tirada_min" => 0,
|
||||||
"tirada_max" => 0,
|
"tirada_max" => 0,
|
||||||
"proveedor_id" => 0,
|
"proveedor_id" => 0,
|
||||||
"precio_min" => 0,
|
|
||||||
"importe_fijo" => 0,
|
"importe_fijo" => 0,
|
||||||
"user_created_id" => 0,
|
"user_created_id" => 0,
|
||||||
"user_updated_id" => 0,
|
"user_updated_id" => 0,
|
||||||
@ -24,7 +23,6 @@ class TarifaEncuadernacionTirada extends \CodeIgniter\Entity\Entity
|
|||||||
"tirada_min" => "float",
|
"tirada_min" => "float",
|
||||||
"tirada_max" => "float",
|
"tirada_max" => "float",
|
||||||
"proveedor_id" => "int",
|
"proveedor_id" => "int",
|
||||||
"precio_min" => "float",
|
|
||||||
"importe_fijo" => "float",
|
"importe_fijo" => "float",
|
||||||
"user_created_id" => "int",
|
"user_created_id" => "int",
|
||||||
"user_updated_id" => "int",
|
"user_updated_id" => "int",
|
||||||
|
|||||||
@ -267,7 +267,15 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
|||||||
$precio_total = floatval(1.0* $tarifa_proveedor->precio_hora* $tiempo) * (1+$tarifa_value[0]->margen/100.0);
|
$precio_total = floatval(1.0* $tarifa_proveedor->precio_hora* $tiempo) * (1+$tarifa_value[0]->margen/100.0);
|
||||||
if (!$POD){
|
if (!$POD){
|
||||||
$precio_total += floatval($tarifa_proveedor->tarifa_importe_fijo);
|
$precio_total += floatval($tarifa_proveedor->tarifa_importe_fijo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tarifa_precio_min = floatval($tarifa_proveedor->tarifa_precio_min);
|
||||||
|
|
||||||
|
if($tarifa_precio_min > $precio_total){
|
||||||
|
$total = $total-($total * $margen/100.0);
|
||||||
|
$margen = round(100.0 * (floatval($$tarifa_precio_min) - $total) / floatval($$tarifa_precio_min), 0);
|
||||||
|
$total = floatval($$tarifa_precio_min);
|
||||||
|
}
|
||||||
|
|
||||||
$result_data[0] = floatval($precio_total / $tirada); // Precio/unidad
|
$result_data[0] = floatval($precio_total / $tirada); // Precio/unidad
|
||||||
$result_data[1] = $precio_total;
|
$result_data[1] = $precio_total;
|
||||||
@ -323,11 +331,12 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
|||||||
|
|
||||||
$total = $precio_unidad * $ejemplares;
|
$total = $precio_unidad * $ejemplares;
|
||||||
$margen = floatval($tarifa->margen);
|
$margen = floatval($tarifa->margen);
|
||||||
|
$tarifa_precio_min = floatval($tarifa->tarifa_precio_min);
|
||||||
|
|
||||||
if($tarifa->tarifa_precio_min > $total){
|
if($tarifa_precio_min > $total){
|
||||||
$total = $total-($total * $margen/100.0);
|
$total = $total-($total * $margen/100.0);
|
||||||
$margen = round(100.0 * (floatval($tarifa->tarifa_precio_min) - $total) / floatval($tarifa->tarifa_precio_min), 0);
|
$margen = round(100.0 * (floatval($tarifa_precio_min) - $total) / floatval($tarifa_precio_min), 0);
|
||||||
$total = floatval($tarifa->tarifa_precio_min);
|
$total = floatval($tarifa_precio_min);
|
||||||
$precio_unidad = round(floatval($total / $ejemplares), 2);
|
$precio_unidad = round(floatval($total / $ejemplares), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,8 @@ class TarifaEncuadernacionLineaHorasModel extends \App\Models\BaseModel
|
|||||||
1 => "t1.tiempo_min",
|
1 => "t1.tiempo_min",
|
||||||
2 => "t1.tiempo_max",
|
2 => "t1.tiempo_max",
|
||||||
3 => "t1.precio_hora",
|
3 => "t1.precio_hora",
|
||||||
4 => "t1.margen",
|
4 => "t1.total_min",
|
||||||
|
5 => "t1.margen",
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $allowedFields = [
|
protected $allowedFields = [
|
||||||
@ -25,6 +26,7 @@ class TarifaEncuadernacionLineaHorasModel extends \App\Models\BaseModel
|
|||||||
"tiempo_min",
|
"tiempo_min",
|
||||||
"tiempo_max",
|
"tiempo_max",
|
||||||
"precio_hora",
|
"precio_hora",
|
||||||
|
"total_min",
|
||||||
"margen",
|
"margen",
|
||||||
"user_created_id",
|
"user_created_id",
|
||||||
"is_deleted",
|
"is_deleted",
|
||||||
@ -54,6 +56,10 @@ class TarifaEncuadernacionLineaHorasModel extends \App\Models\BaseModel
|
|||||||
"label" => "TarifaEncuadernacionLineas.precioHora",
|
"label" => "TarifaEncuadernacionLineas.precioHora",
|
||||||
"rules" => "required|decimal",
|
"rules" => "required|decimal",
|
||||||
],
|
],
|
||||||
|
"total_min" => [
|
||||||
|
"label" => "TarifaEncuadernacionLineas.precioHora",
|
||||||
|
"rules" => "required|decimal",
|
||||||
|
],
|
||||||
"margen" => [
|
"margen" => [
|
||||||
"label" => "TarifaEncuadernacionLineas.margen",
|
"label" => "TarifaEncuadernacionLineas.margen",
|
||||||
"rules" => "required|decimal",
|
"rules" => "required|decimal",
|
||||||
@ -73,6 +79,10 @@ class TarifaEncuadernacionLineaHorasModel extends \App\Models\BaseModel
|
|||||||
"decimal" => "TarifaEncuadernacionLineas.validation.tirada_max.decimal",
|
"decimal" => "TarifaEncuadernacionLineas.validation.tirada_max.decimal",
|
||||||
"required" => "TarifaEncuadernacionLineas.validation.tirada_max.required",
|
"required" => "TarifaEncuadernacionLineas.validation.tirada_max.required",
|
||||||
],
|
],
|
||||||
|
"total_min" => [
|
||||||
|
"decimal" => "TarifaEncuadernacionLineas.validation.tirada_max.decimal",
|
||||||
|
"required" => "TarifaEncuadernacionLineas.validation.tirada_max.required",
|
||||||
|
],
|
||||||
"margen" => [
|
"margen" => [
|
||||||
"decimal" => "TarifaEncuadernacionLineas.validation.margen.decimal",
|
"decimal" => "TarifaEncuadernacionLineas.validation.margen.decimal",
|
||||||
"required" => "TarifaEncuadernacionLineas.validation.margen.required",
|
"required" => "TarifaEncuadernacionLineas.validation.margen.required",
|
||||||
@ -92,7 +102,7 @@ class TarifaEncuadernacionLineaHorasModel extends \App\Models\BaseModel
|
|||||||
->table($this->table . " t1")
|
->table($this->table . " t1")
|
||||||
->select(
|
->select(
|
||||||
"t1.id AS id, t1.tirada_encuadernacion_id AS tirada_encuadernacion_id, t1.tiempo_min AS tiempo_min,
|
"t1.id AS id, t1.tirada_encuadernacion_id AS tirada_encuadernacion_id, t1.tiempo_min AS tiempo_min,
|
||||||
t1.tiempo_max AS tiempo_max, t1.precio_hora AS precio_hora, t1.margen AS margen,
|
t1.tiempo_max AS tiempo_max, t1.precio_hora AS precio_hora, t1.total_min AS total_min, t1.margen AS margen,
|
||||||
t2.id AS tarifa_encuadernacion"
|
t2.id AS tarifa_encuadernacion"
|
||||||
);
|
);
|
||||||
//JJO
|
//JJO
|
||||||
|
|||||||
@ -19,6 +19,8 @@ class TarifaEncuadernacionLineaModel extends \App\Models\BaseModel
|
|||||||
3 => "t1.paginas_libro_max",
|
3 => "t1.paginas_libro_max",
|
||||||
4 => "t1.precio_min",
|
4 => "t1.precio_min",
|
||||||
5 => "t1.precio_max",
|
5 => "t1.precio_max",
|
||||||
|
6 => "t1.total_min",
|
||||||
|
7 => "t1.margen",
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $allowedFields = [
|
protected $allowedFields = [
|
||||||
@ -30,6 +32,8 @@ class TarifaEncuadernacionLineaModel extends \App\Models\BaseModel
|
|||||||
"precio_max",
|
"precio_max",
|
||||||
"tirada_min",
|
"tirada_min",
|
||||||
"tirada_max",
|
"tirada_max",
|
||||||
|
"margen",
|
||||||
|
"total_min",
|
||||||
"user_created_id",
|
"user_created_id",
|
||||||
"is_deleted",
|
"is_deleted",
|
||||||
|
|
||||||
@ -62,6 +66,10 @@ class TarifaEncuadernacionLineaModel extends \App\Models\BaseModel
|
|||||||
"label" => "TarifaEncuadernacionLineas.tiradaMin",
|
"label" => "TarifaEncuadernacionLineas.tiradaMin",
|
||||||
"rules" => "required|decimal",
|
"rules" => "required|decimal",
|
||||||
],
|
],
|
||||||
|
"total_min" => [
|
||||||
|
"label" => "TarifaEncuadernacionLineas.precioMin",
|
||||||
|
"rules" => "required|decimal",
|
||||||
|
],
|
||||||
"paginas_libro_max" => [
|
"paginas_libro_max" => [
|
||||||
"label" => "TarifaEncuadernacionLineas.paginasMax",
|
"label" => "TarifaEncuadernacionLineas.paginasMax",
|
||||||
"rules" => "required|decimal",
|
"rules" => "required|decimal",
|
||||||
@ -93,6 +101,10 @@ class TarifaEncuadernacionLineaModel extends \App\Models\BaseModel
|
|||||||
"decimal" => "TarifaEncuadernacionLineas.validation.tirada_min.decimal",
|
"decimal" => "TarifaEncuadernacionLineas.validation.tirada_min.decimal",
|
||||||
"required" => "TarifaEncuadernacionLineas.validation.tirada_min.required",
|
"required" => "TarifaEncuadernacionLineas.validation.tirada_min.required",
|
||||||
],
|
],
|
||||||
|
"total_min" => [
|
||||||
|
"decimal" => "TarifaEncuadernacionLineas.validation.precio_min.decimal",
|
||||||
|
"required" => "TarifaEncuadernacionLineas.validation.precio_min.required",
|
||||||
|
],
|
||||||
"paginas_libro_max" => [
|
"paginas_libro_max" => [
|
||||||
"decimal" => "TarifaEncuadernacionLineas.validation.paginas_libro_max.decimal",
|
"decimal" => "TarifaEncuadernacionLineas.validation.paginas_libro_max.decimal",
|
||||||
"required" => "TarifaEncuadernacionLineas.validation.paginas_libro_max.required",
|
"required" => "TarifaEncuadernacionLineas.validation.paginas_libro_max.required",
|
||||||
@ -120,7 +132,7 @@ class TarifaEncuadernacionLineaModel extends \App\Models\BaseModel
|
|||||||
->table($this->table . " t1")
|
->table($this->table . " t1")
|
||||||
->select(
|
->select(
|
||||||
"t1.id AS id, t1.tirada_encuadernacion_id AS tirada_encuadernacion_id, t1.paginas_libro_min AS paginas_libro_min, t1.paginas_libro_max AS paginas_libro_max, t1.precio_min AS precio_min, t1.precio_max AS precio_max, t1.tirada_min AS tirada_min,
|
"t1.id AS id, t1.tirada_encuadernacion_id AS tirada_encuadernacion_id, t1.paginas_libro_min AS paginas_libro_min, t1.paginas_libro_max AS paginas_libro_max, t1.precio_min AS precio_min, t1.precio_max AS precio_max, t1.tirada_min AS tirada_min,
|
||||||
t1.tirada_max AS tirada_max, t1.margen AS margen, t2.id AS tarifa_encuadernacion, t3.id AS dimensiones_id, t3.ancho_min, t3.ancho_max, , t3.alto_min, t3.alto_max, t3.descripcion as descripcion"
|
t1.tirada_max AS tirada_max, t1.total_min as total_min, t1.margen AS margen, t2.id AS tarifa_encuadernacion, t3.id AS dimensiones_id, t3.ancho_min, t3.ancho_max, , t3.alto_min, t3.alto_max, t3.descripcion as descripcion"
|
||||||
);
|
);
|
||||||
//JJO
|
//JJO
|
||||||
$builder->where('tirada_encuadernacion_id', $tirada_encuadernacion_id);
|
$builder->where('tirada_encuadernacion_id', $tirada_encuadernacion_id);
|
||||||
@ -190,6 +202,7 @@ class TarifaEncuadernacionLineaModel extends \App\Models\BaseModel
|
|||||||
|
|
||||||
return $builder;
|
return $builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function removeAllEncuadernacionLineasForTarifa($tarifaId = -1, $datetime = null, $delete_flag=1){
|
public function removeAllEncuadernacionLineasForTarifa($tarifaId = -1, $datetime = null, $delete_flag=1){
|
||||||
|
|
||||||
|
|||||||
@ -125,7 +125,7 @@ class TarifaEncuadernacionModel extends \App\Models\BaseModel
|
|||||||
$builder = $this->db
|
$builder = $this->db
|
||||||
->table($this->table . " t1")
|
->table($this->table . " t1")
|
||||||
->select(
|
->select(
|
||||||
"t1.id AS tarifa_enc_id, t1.nombre AS tarifa_enc_nombre, t2.precio_min AS tarifa_precio_min, t2.importe_fijo AS tarifa_importe_fijo,
|
"t1.id AS tarifa_enc_id, t1.nombre AS tarifa_enc_nombre, t3.total_min AS tarifa_precio_min, t2.importe_fijo AS tarifa_importe_fijo,
|
||||||
t2.id AS tarifa_tirada_id, t2.proveedor_id AS proveedor_id, t5.nombre AS proveedor_nombre, t2.tirada_min AS tirada_min, t2.tirada_max AS tirada_max,
|
t2.id AS tarifa_tirada_id, t2.proveedor_id AS proveedor_id, t5.nombre AS proveedor_nombre, t2.tirada_min AS tirada_min, t2.tirada_max AS tirada_max,
|
||||||
t3.id AS tarifa_linea_id, t3.paginas_libro_min AS paginas_min, t3.paginas_libro_max AS paginas_max, t3.precio_min AS precio_min, t3.precio_max AS precio_max, t3.margen AS margen,
|
t3.id AS tarifa_linea_id, t3.paginas_libro_min AS paginas_min, t3.paginas_libro_max AS paginas_max, t3.precio_min AS precio_min, t3.precio_max AS precio_max, t3.margen AS margen,
|
||||||
t4.ancho_min AS ancho_min, t4.ancho_max AS ancho_max, t4.alto_min AS alto_min, t4.alto_max AS alto_max"
|
t4.ancho_min AS ancho_min, t4.ancho_max AS ancho_max, t4.alto_min AS alto_min, t4.alto_max AS alto_max"
|
||||||
@ -161,7 +161,7 @@ class TarifaEncuadernacionModel extends \App\Models\BaseModel
|
|||||||
$builder = $this->db
|
$builder = $this->db
|
||||||
->table($this->table . " t1")
|
->table($this->table . " t1")
|
||||||
->select(
|
->select(
|
||||||
"t1.id AS tarifa_enc_id, t1.nombre AS tarifa_enc_nombre, t2.precio_min AS tarifa_precio_min, t2.importe_fijo AS tarifa_importe_fijo,
|
"t1.id AS tarifa_enc_id, t1.nombre AS tarifa_enc_nombre, t3.total_min AS tarifa_precio_min, t2.importe_fijo AS tarifa_importe_fijo,
|
||||||
t2.id AS tarifa_tirada_id, t2.proveedor_id AS proveedor_id, t5.nombre AS proveedor_nombre, t2.tirada_min AS tirada_min, t2.tirada_max AS tirada_max,
|
t2.id AS tarifa_tirada_id, t2.proveedor_id AS proveedor_id, t5.nombre AS proveedor_nombre, t2.tirada_min AS tirada_min, t2.tirada_max AS tirada_max,
|
||||||
t3.id AS tarifa_linea_id, t3.tiempo_min AS tiempo_min, t3.tiempo_max AS tiempo_max, t3.precio_hora AS precio_hora, t3.margen AS margen"
|
t3.id AS tarifa_linea_id, t3.tiempo_min AS tiempo_min, t3.tiempo_max AS tiempo_max, t3.precio_hora AS precio_hora, t3.margen AS margen"
|
||||||
)
|
)
|
||||||
|
|||||||
@ -16,7 +16,6 @@ class TarifaEncuadernacionTiradaModel extends \App\Models\BaseModel
|
|||||||
0 => "t3.nombre",
|
0 => "t3.nombre",
|
||||||
1 => "t1.tirada_min",
|
1 => "t1.tirada_min",
|
||||||
2 => "t1.tirada_max",
|
2 => "t1.tirada_max",
|
||||||
3 => "t1.precio_min",
|
|
||||||
4 => "t1.importe_fijo",
|
4 => "t1.importe_fijo",
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -25,7 +24,6 @@ class TarifaEncuadernacionTiradaModel extends \App\Models\BaseModel
|
|||||||
"tirada_min",
|
"tirada_min",
|
||||||
"tirada_max",
|
"tirada_max",
|
||||||
"proveedor_id",
|
"proveedor_id",
|
||||||
"precio_min",
|
|
||||||
"importe_fijo",
|
"importe_fijo",
|
||||||
"user_created_id",
|
"user_created_id",
|
||||||
"user_updated_id",
|
"user_updated_id",
|
||||||
@ -53,10 +51,6 @@ class TarifaEncuadernacionTiradaModel extends \App\Models\BaseModel
|
|||||||
"label" => "TarifaEncuadernacionTiradas.tiradaMin",
|
"label" => "TarifaEncuadernacionTiradas.tiradaMin",
|
||||||
"rules" => "required|integer",
|
"rules" => "required|integer",
|
||||||
],
|
],
|
||||||
"precio_min" => [
|
|
||||||
"label" => "Tarifaencuadernacion.precioMin",
|
|
||||||
"rules" => "required|decimal",
|
|
||||||
],
|
|
||||||
"importe_fijo" => [
|
"importe_fijo" => [
|
||||||
"label" => "Tarifaencuadernacion.importeFijo",
|
"label" => "Tarifaencuadernacion.importeFijo",
|
||||||
"rules" => "required|decimal",
|
"rules" => "required|decimal",
|
||||||
@ -72,10 +66,6 @@ class TarifaEncuadernacionTiradaModel extends \App\Models\BaseModel
|
|||||||
"integer" => "TarifaEncuadernacionTiradas.validation.tirada_min.integer",
|
"integer" => "TarifaEncuadernacionTiradas.validation.tirada_min.integer",
|
||||||
"required" => "TarifaEncuadernacionTiradas.validation.tirada_min.required",
|
"required" => "TarifaEncuadernacionTiradas.validation.tirada_min.required",
|
||||||
],
|
],
|
||||||
"precio_min" => [
|
|
||||||
"required" => "Tarifaencuadernacion.validation.precio_min.required",
|
|
||||||
"decimal" => "Tarifaencuadernacion.validation.precio_min.decimal",
|
|
||||||
],
|
|
||||||
"importe_fijo" => [
|
"importe_fijo" => [
|
||||||
"required" => "Tarifaencuadernacion.validation.importe_fijo.required",
|
"required" => "Tarifaencuadernacion.validation.importe_fijo.required",
|
||||||
"decimal" => "Tarifaencuadernacion.validation.importe_fijo.decimal",
|
"decimal" => "Tarifaencuadernacion.validation.importe_fijo.decimal",
|
||||||
@ -95,7 +85,7 @@ class TarifaEncuadernacionTiradaModel extends \App\Models\BaseModel
|
|||||||
->table($this->table . " t1")
|
->table($this->table . " t1")
|
||||||
->select(
|
->select(
|
||||||
"t1.id AS id, t1.tarifa_encuadernacion_id AS tarifa_encuadernacion_id,
|
"t1.id AS id, t1.tarifa_encuadernacion_id AS tarifa_encuadernacion_id,
|
||||||
t1.precio_min AS precio_min, t1.importe_fijo AS importe_fijo,
|
t1.importe_fijo AS importe_fijo,
|
||||||
t1.tirada_min AS tirada_min, t1.tirada_max AS tirada_max,
|
t1.tirada_min AS tirada_min, t1.tirada_max AS tirada_max,
|
||||||
t3.nombre AS proveedor, t3.id AS proveedor_id, t2.id AS tarifa_encuadernacion"
|
t3.nombre AS proveedor, t3.id AS proveedor_id, t2.id AS tarifa_encuadernacion"
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,30 +1,36 @@
|
|||||||
<div class="col-12" style="min-height: 50px;">
|
<div class="col-12" style="min-height: 50px;">
|
||||||
<div id="btnsDiv" class="d-flex w-100 position-relative" style="margin-top: 40px;">
|
<div id="btnsDiv" class="d-flex w-100 position-relative" style="margin-top: 40px;">
|
||||||
|
|
||||||
<div class="me-auto">
|
<div class="me-auto">
|
||||||
<div id="btnPrint" class="btn mt-3 btn-secondary waves-effect waves-light ml-2 d-none">
|
<div id="btnPrint" class="btn mt-3 btn-secondary waves-effect waves-light ml-2 d-none">
|
||||||
<span class="align-middle d-sm-inline-block d-none me-sm-1"></i><?= lang('App.global_print2') ?></span>
|
<span class="align-middle d-sm-inline-block d-none me-sm-1"></i><?= lang('App.global_print2') ?></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="position-absolute start-50 translate-middle-x">
|
||||||
|
<?php if ($state != 2): ?>
|
||||||
|
<div id="btnPrev" class="btn mt-3 btn-primary waves-effect waves-light ml-2 d-none">
|
||||||
|
<span class="align-middle d-sm-inline-block d-none me-sm-1"></i><?= lang('App.global_prev') ?></span>
|
||||||
|
</div>
|
||||||
|
<div id="btnNext" class="btn mt-3 btn-primary waves-effect waves-light ml-2">
|
||||||
|
<span class="align-middle d-sm-inline-block d-none me-sm-1"></i><?= lang('App.global_next') ?></span>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ms-auto">
|
||||||
|
|
||||||
|
<?php if ($state != 2): ?>
|
||||||
|
|
||||||
|
<div id="btnConfirm" class="btn mt-3 btn-success waves-effect waves-light ml-2 d-none">
|
||||||
|
<span class="align-middle d-sm-inline-block d-none me-sm-1"></i><?= lang('App.global_confirm') ?></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="btnSave" class="btn mt-3 btn-primary waves-effect waves-light ml-2 d-none">
|
||||||
|
<span class="align-middle d-sm-inline-block d-none me-sm-1"></i><?= lang('App.global_save') ?></span>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="position-absolute start-50 translate-middle-x">
|
|
||||||
<div id="btnPrev" class="btn mt-3 btn-primary waves-effect waves-light ml-2 d-none">
|
|
||||||
<span class="align-middle d-sm-inline-block d-none me-sm-1"></i><?= lang('App.global_prev') ?></span>
|
|
||||||
</div>
|
|
||||||
<div id="btnNext" class="btn mt-3 btn-primary waves-effect waves-light ml-2">
|
|
||||||
<span class="align-middle d-sm-inline-block d-none me-sm-1"></i><?= lang('App.global_next') ?></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="ms-auto">
|
|
||||||
<div id="btnConfirm" class="btn mt-3 btn-success waves-effect waves-light ml-2 d-none">
|
|
||||||
<span class="align-middle d-sm-inline-block d-none me-sm-1"></i><?= lang('App.global_confirm') ?></span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="btnSave" class="btn mt-3 btn-primary waves-effect waves-light ml-2 d-none">
|
|
||||||
<span class="align-middle d-sm-inline-block d-none me-sm-1"></i><?= lang('App.global_save') ?></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
@ -16,14 +16,15 @@
|
|||||||
<label for="autor" class="form-label">
|
<label for="autor" class="form-label">
|
||||||
<?= lang('Presupuestos.autor') ?>
|
<?= lang('Presupuestos.autor') ?>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" id="autor" placeholder="Autor" name="autor" maxLength="150" class="form-control text-center" value="">
|
<input type="text" id="autor" placeholder="Autor" name="autor" maxLength="150" class="form-control text-center"
|
||||||
|
value="">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
|
|
||||||
<div class="col-sm-4 mb-3">
|
<div class="col-sm-4 mb-3">
|
||||||
<label for="isbn" class="form-label">
|
<label for="isbn" class="form-label">
|
||||||
<?=lang('Presupuestos.isbn') ?>
|
<?= lang('Presupuestos.isbn') ?>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" id="isbn" name="isbn" placeholder="ISBN" maxLength="50" class="form-control" value="">
|
<input type="text" id="isbn" name="isbn" placeholder="ISBN" maxLength="50" class="form-control" value="">
|
||||||
</div>
|
</div>
|
||||||
@ -32,35 +33,44 @@
|
|||||||
<label for="coleccion" class="form-label">
|
<label for="coleccion" class="form-label">
|
||||||
<?= lang('Presupuestos.coleccion') ?>
|
<?= lang('Presupuestos.coleccion') ?>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" id="coleccion" name="coleccion" placeholder="Coleccion" maxLength="255" class="form-control" value="">
|
<input type="text" id="coleccion" name="coleccion" placeholder="Coleccion" maxLength="255"
|
||||||
|
class="form-control" value="">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-4 mb-3">
|
<div class="col-sm-4 mb-3">
|
||||||
<label for="referenciaCliente" class="form-label">
|
<label for="referenciaCliente" class="form-label">
|
||||||
<?=lang('Presupuestos.referenciaCliente') ?>
|
<?= lang('Presupuestos.referenciaCliente') ?>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" id="referenciaCliente" name="referencia_cliente" placeholder="Referencia cliente" maxLength="100" class="form-control" value="">
|
<input type="text" id="referenciaCliente" name="referencia_cliente" placeholder="Referencia cliente"
|
||||||
</div>
|
maxLength="100" class="form-control" value="">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="col-sm-5 mb-3 d-flex flex-column align-items-center">
|
<div class="col-sm-5 mb-3 d-flex flex-column align-items-center">
|
||||||
<label id="label_clienteId" for="clienteId" class="form-label">
|
<label <?= (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))? " hidden" : "" ?>
|
||||||
|
id="label_clienteId" for="clienteId" class="form-label">
|
||||||
Cliente*
|
Cliente*
|
||||||
</label>
|
</label>
|
||||||
<select id="clienteId" name="cliente_id" class="form-control select2bs2 calcular-presupuesto"
|
<select <?= (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))? " hidden" : "" ?>
|
||||||
|
id="clienteId" name="cliente_id" class="form-control select2bs2 calcular-presupuesto"
|
||||||
style="width: 100%;">
|
style="width: 100%;">
|
||||||
|
<?php if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')): ?>
|
||||||
|
<option value="<?= $clienteId ?>" selected>cliente</option>
|
||||||
|
<?php endif; ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="row col-sm-5 mb-3 d-flex flex-column align-items-center">
|
<div class="row col-sm-5 mb-3 d-flex flex-column align-items-center">
|
||||||
<div class="form-check form-switch mb-2">
|
<div class="form-check form-switch mb-2">
|
||||||
<input class="calcular-presupuesto form-check-input" type="checkbox" id="excluirRotativa"
|
<input <?= (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))? " hidden" : "" ?>
|
||||||
|
class="calcular-presupuesto form-check-input" type="checkbox" id="excluirRotativa"
|
||||||
name="excluir_rotativa" value="1">
|
name="excluir_rotativa" value="1">
|
||||||
<label class="form-check-label" for="excluirRotativa">Excluir rotativa</label>
|
<label <?= (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))? " hidden" : "" ?>
|
||||||
|
class="form-check-label" for="excluirRotativa">Excluir rotativa</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -182,4 +182,25 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<?php if ($state == 2): ?>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<h3>Ficheros</h3>
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="dropzone needsclick" id="dropzone-multi">
|
||||||
|
<div class="dz-message needsclick">
|
||||||
|
Arrastre aquí los ficheros o haga click
|
||||||
|
</div>
|
||||||
|
<div class="fallback">
|
||||||
|
<input name="file" type="file" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button id="submit-all-files" class="btn mt-3 btn-primary btn-submit waves-effect waves-light ml-2">
|
||||||
|
<span class="align-middle d-sm-inline-block d-none me-sm-1">Actualizar ficheros</span>
|
||||||
|
<i class="ti ti-upload ti-xs"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -12,7 +12,7 @@
|
|||||||
<?= view("themes/vuexy/components/modals/modalDireccion") ?>
|
<?= view("themes/vuexy/components/modals/modalDireccion") ?>
|
||||||
|
|
||||||
<div class="container-xxl flex-grow-1 container-p-y">
|
<div class="container-xxl flex-grow-1 container-p-y">
|
||||||
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
|
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
|
||||||
<?= csrf_field() ?>
|
<?= csrf_field() ?>
|
||||||
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
<div class="bs-stepper-header">
|
<div class="bs-stepper-header">
|
||||||
|
|
||||||
<div class="step active titulos-menu" data-target="#datos-generales">
|
<div <?= ($state == 2)? 'hidden': '' ?> class="step active titulos-menu" data-target="#datos-generales">
|
||||||
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
|
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
|
||||||
<span class="bs-stepper-circle"><i class="ti ti-info-circle ti-sm"></i></span>
|
<span class="bs-stepper-circle"><i class="ti ti-info-circle ti-sm"></i></span>
|
||||||
<span class="bs-stepper-label">
|
<span class="bs-stepper-label">
|
||||||
@ -38,7 +38,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="step titulos-menu" data-target="#interior-libro">
|
<div <?= ($state == 2)? 'hidden': '' ?> class="step titulos-menu" data-target="#interior-libro">
|
||||||
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
|
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
|
||||||
<span class="bs-stepper-circle"><i class="ti ti-book ti-sm"></i></span>
|
<span class="bs-stepper-circle"><i class="ti ti-book ti-sm"></i></span>
|
||||||
<span class="bs-stepper-label">
|
<span class="bs-stepper-label">
|
||||||
@ -47,7 +47,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="step titulos-menu" data-target="#cubierta-libro">
|
<div <?= ($state == 2)? 'hidden': '' ?> class="step titulos-menu" data-target="#cubierta-libro">
|
||||||
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
|
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
|
||||||
<span class="bs-stepper-circle"><i class="ti ti-books ti-sm"></i></span>
|
<span class="bs-stepper-circle"><i class="ti ti-books ti-sm"></i></span>
|
||||||
<span class="bs-stepper-label">
|
<span class="bs-stepper-label">
|
||||||
@ -56,7 +56,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="step titulos-menu" data-target="#direcciones-libro">
|
<div <?= ($state == 2)? 'hidden': '' ?> class="step titulos-menu" data-target="#direcciones-libro">
|
||||||
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
|
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
|
||||||
<span class="bs-stepper-circle"><i class="ti ti-map-pins ti-sm"></i></span>
|
<span class="bs-stepper-circle"><i class="ti ti-map-pins ti-sm"></i></span>
|
||||||
<span class="bs-stepper-label">
|
<span class="bs-stepper-label">
|
||||||
@ -65,7 +65,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="step titulos-menu" data-target="#resumen-libro">
|
<div id="menu_resumen_button" class="step titulos-menu" data-target="#resumen-libro">
|
||||||
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
|
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
|
||||||
<span class="bs-stepper-circle"><i class="ti ti-checkbox ti-sm"></i></span>
|
<span class="bs-stepper-circle"><i class="ti ti-checkbox ti-sm"></i></span>
|
||||||
<span class="bs-stepper-label">
|
<span class="bs-stepper-label">
|
||||||
@ -87,26 +87,30 @@
|
|||||||
|
|
||||||
<form id="presupuesto-cliente-form" onsubmit="return false">
|
<form id="presupuesto-cliente-form" onsubmit="return false">
|
||||||
|
|
||||||
<div id="datos-generales" class="content active dstepper-block fv-plugins-bootstrap5 fv-plugins-framework">
|
<div <?= ($state == 2) ? 'hidden' : '' ?> id="datos-generales"
|
||||||
|
class="content active dstepper-block fv-plugins-bootstrap5 fv-plugins-framework">
|
||||||
|
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
<?= view("themes/vuexy/form/presupuestos/cliente/items/_datosGenerales") ?>
|
<?= view("themes/vuexy/form/presupuestos/cliente/items/_datosGenerales") ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="interior-libro" class="content fv-plugins-bootstrap5 fv-plugins-framework">
|
<div <?= ($state == 2) ? 'hidden' : '' ?> id="interior-libro"
|
||||||
|
class="content fv-plugins-bootstrap5 fv-plugins-framework">
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
<?= view("themes/vuexy/form/presupuestos/cliente/items/_disenioInterior") ?>
|
<?= view("themes/vuexy/form/presupuestos/cliente/items/_disenioInterior") ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="cubierta-libro" class="content fv-plugins-bootstrap5 fv-plugins-framework">
|
<div <?= ($state == 2) ? 'hidden' : '' ?> id="cubierta-libro"
|
||||||
|
class="content fv-plugins-bootstrap5 fv-plugins-framework">
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
<?= view("themes/vuexy/form/presupuestos/cliente/items/_disenioCubierta") ?>
|
<?= view("themes/vuexy/form/presupuestos/cliente/items/_disenioCubierta") ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="direcciones-libro" class="content fv-plugins-bootstrap5 fv-plugins-framework">
|
<div <?= ($state == 2) ? 'hidden' : '' ?> id="direcciones-libro"
|
||||||
|
class="content fv-plugins-bootstrap5 fv-plugins-framework">
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
<?= view("themes/vuexy/form/presupuestos/cliente/items/_direcciones") ?>
|
<?= view("themes/vuexy/form/presupuestos/cliente/items/_direcciones") ?>
|
||||||
</div>
|
</div>
|
||||||
@ -132,8 +136,8 @@
|
|||||||
<div id="form_buttons" class="row col-sm-12 justify-content-center" style="display: none;">
|
<div id="form_buttons" class="row col-sm-12 justify-content-center" style="display: none;">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<?php if($formAction == 'edit'): ?>
|
<?php if ($formAction == 'edit'): ?>
|
||||||
<?= view("themes/vuexy/components/chat_internal_presupuesto",data:["modelId" => $presupuestoId,"type" => "presupuesto"]) ?>
|
<?= view("themes/vuexy/components/chat_internal_presupuesto", data: ["modelId" => $presupuestoId, "type" => "presupuesto"]) ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div><!--//.row -->
|
</div><!--//.row -->
|
||||||
<?= view("themes/_commonPartialsBs/_modalConfirmDialog") ?>
|
<?= view("themes/_commonPartialsBs/_modalConfirmDialog") ?>
|
||||||
@ -166,5 +170,5 @@
|
|||||||
|
|
||||||
<script type="module"
|
<script type="module"
|
||||||
src="<?= site_url('assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js') ?>"></script>
|
src="<?= site_url('assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js') ?>"></script>
|
||||||
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -121,11 +121,11 @@ function calcular_mermas(){
|
|||||||
|
|
||||||
|
|
||||||
$('#papelFormatoPersonalizado').on("click",function(){
|
$('#papelFormatoPersonalizado').on("click",function(){
|
||||||
var checkbox = document.getElementById('papelFormatoPersonalizado');
|
|
||||||
if(checkbox.checked == true){
|
if($('#papelFormatoPersonalizado').is(':checked')){
|
||||||
document.getElementById("papelFormatoAncho").style.display = "block";
|
document.getElementById("papelFormatoAncho").style.display = "block";
|
||||||
document.getElementById("papelFormatoAlto").style.display = "block";
|
document.getElementById("papelFormatoAlto").style.display = "block";
|
||||||
$('#papelFormatoId').next(".select2-container").hide();
|
$('#papelFormatoId').hide();
|
||||||
$('#papelFormatoId').val(0).change();
|
$('#papelFormatoId').val(0).change();
|
||||||
document.getElementById("label_papelFormatoId").innerHTML =
|
document.getElementById("label_papelFormatoId").innerHTML =
|
||||||
window.Presupuestos.papelFormatoId + " (" +
|
window.Presupuestos.papelFormatoId + " (" +
|
||||||
@ -136,7 +136,7 @@ $('#papelFormatoPersonalizado').on("click",function(){
|
|||||||
document.getElementById("papelFormatoAlto").value= "";
|
document.getElementById("papelFormatoAlto").value= "";
|
||||||
document.getElementById("papelFormatoAncho").style.display = "none";
|
document.getElementById("papelFormatoAncho").style.display = "none";
|
||||||
document.getElementById("papelFormatoAlto").style.display = "none";
|
document.getElementById("papelFormatoAlto").style.display = "none";
|
||||||
$('#papelFormatoId').next(".select2-container").show();
|
$('#papelFormatoId').show();
|
||||||
document.getElementById("label_papelFormatoId").innerHTML =
|
document.getElementById("label_papelFormatoId").innerHTML =
|
||||||
window.Presupuestos.papelFormatoId + '*';
|
window.Presupuestos.papelFormatoId + '*';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,7 +42,7 @@
|
|||||||
<?= lang('Presupuestos.papelFormatoId') ?>*
|
<?= lang('Presupuestos.papelFormatoId') ?>*
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<select id="papelFormatoId" name="papel_formato_id" tabindex="3" class="form-control select2bs2" style="width: 100%;">
|
<select id="papelFormatoId" <?= $presupuestoEntity->papel_formato_personalizado == false ? '' : 'style="display: none"'; ?> name="papel_formato_id" tabindex="3" class="form-control select2bs2" style="width: 100%;">
|
||||||
|
|
||||||
<?php if (isset($papelFormatoList) && is_array($papelFormatoList) && !empty($papelFormatoList)) :
|
<?php if (isset($papelFormatoList) && is_array($papelFormatoList) && !empty($papelFormatoList)) :
|
||||||
foreach ($papelFormatoList as $formato) : ?>
|
foreach ($papelFormatoList as $formato) : ?>
|
||||||
|
|||||||
@ -49,7 +49,6 @@
|
|||||||
<th><?= lang('TarifaEncuadernacionTiradas.proveedor') ?></th>
|
<th><?= lang('TarifaEncuadernacionTiradas.proveedor') ?></th>
|
||||||
<th><?= lang('TarifaEncuadernacionTiradas.tiradaMin') ?></th>
|
<th><?= lang('TarifaEncuadernacionTiradas.tiradaMin') ?></th>
|
||||||
<th><?= lang('TarifaEncuadernacionTiradas.tiradaMax') ?></th>
|
<th><?= lang('TarifaEncuadernacionTiradas.tiradaMax') ?></th>
|
||||||
<th><?= lang('Tarifaencuadernacion.importeMin') ?></th>
|
|
||||||
<th><?= lang('Tarifaencuadernacion.importeFijo') ?></th>
|
<th><?= lang('Tarifaencuadernacion.importeFijo') ?></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -83,6 +82,7 @@
|
|||||||
<th><?= lang('TarifaEncuadernacionLineas.precioMin') ?></th>
|
<th><?= lang('TarifaEncuadernacionLineas.precioMin') ?></th>
|
||||||
<th><?= lang('TarifaEncuadernacionLineas.paginasMax') ?></th>
|
<th><?= lang('TarifaEncuadernacionLineas.paginasMax') ?></th>
|
||||||
<th><?= lang('TarifaEncuadernacionLineas.precioMax') ?></th>
|
<th><?= lang('TarifaEncuadernacionLineas.precioMax') ?></th>
|
||||||
|
<th><?= lang('Tarifaencuadernacion.importeMin') ?></th>
|
||||||
<th><?= lang('TarifaEncuadernacionLineas.margen') ?></th>
|
<th><?= lang('TarifaEncuadernacionLineas.margen') ?></th>
|
||||||
<th style="min-width:100px"></th>
|
<th style="min-width:100px"></th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -112,6 +112,7 @@
|
|||||||
<th><?= lang('TarifaEncuadernacionLineas.tiempoMin') ?></th>
|
<th><?= lang('TarifaEncuadernacionLineas.tiempoMin') ?></th>
|
||||||
<th><?= lang('TarifaEncuadernacionLineas.tiempoMax') ?></th>
|
<th><?= lang('TarifaEncuadernacionLineas.tiempoMax') ?></th>
|
||||||
<th><?= lang('TarifaEncuadernacionLineas.precioHora') ?></th>
|
<th><?= lang('TarifaEncuadernacionLineas.precioHora') ?></th>
|
||||||
|
<th><?= lang('Tarifaencuadernacion.importeMin') ?></th>
|
||||||
<th><?= lang('TarifaEncuadernacionLineas.margen') ?></th>
|
<th><?= lang('TarifaEncuadernacionLineas.margen') ?></th>
|
||||||
<th style="min-width:100px"></th>
|
<th style="min-width:100px"></th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -298,6 +299,8 @@
|
|||||||
name: "tiempo_max"
|
name: "tiempo_max"
|
||||||
}, {
|
}, {
|
||||||
name: "precio_hora"
|
name: "precio_hora"
|
||||||
|
}, {
|
||||||
|
name: "total_min"
|
||||||
}, {
|
}, {
|
||||||
name: "margen"
|
name: "margen"
|
||||||
}, {
|
}, {
|
||||||
@ -366,6 +369,7 @@
|
|||||||
{ 'data': 'tiempo_min' },
|
{ 'data': 'tiempo_min' },
|
||||||
{ 'data': 'tiempo_max' },
|
{ 'data': 'tiempo_max' },
|
||||||
{ 'data': 'precio_hora' },
|
{ 'data': 'precio_hora' },
|
||||||
|
{ 'data': 'total_min' },
|
||||||
{ 'data': 'margen' },
|
{ 'data': 'margen' },
|
||||||
{
|
{
|
||||||
data: actionBtns,
|
data: actionBtns,
|
||||||
@ -477,6 +481,8 @@
|
|||||||
name: "paginas_libro_max"
|
name: "paginas_libro_max"
|
||||||
}, {
|
}, {
|
||||||
name: "precio_max"
|
name: "precio_max"
|
||||||
|
}, {
|
||||||
|
name: "total_min"
|
||||||
}, {
|
}, {
|
||||||
name: "margen"
|
name: "margen"
|
||||||
}, {
|
}, {
|
||||||
@ -556,6 +562,7 @@
|
|||||||
{ 'data': 'precio_max' },
|
{ 'data': 'precio_max' },
|
||||||
{ 'data': 'paginas_libro_max' },
|
{ 'data': 'paginas_libro_max' },
|
||||||
{ 'data': 'precio_min' },
|
{ 'data': 'precio_min' },
|
||||||
|
{ 'data': 'total_min' },
|
||||||
{ 'data': 'margen' },
|
{ 'data': 'margen' },
|
||||||
{
|
{
|
||||||
data: actionBtns,
|
data: actionBtns,
|
||||||
@ -661,8 +668,6 @@
|
|||||||
name: "tirada_min"
|
name: "tirada_min"
|
||||||
}, {
|
}, {
|
||||||
name: "tirada_max"
|
name: "tirada_max"
|
||||||
}, {
|
|
||||||
name: "precio_min"
|
|
||||||
}, {
|
}, {
|
||||||
name: "importe_fijo"
|
name: "importe_fijo"
|
||||||
}, {
|
}, {
|
||||||
@ -746,7 +751,6 @@
|
|||||||
},
|
},
|
||||||
{ 'data': 'tirada_min' },
|
{ 'data': 'tirada_min' },
|
||||||
{ 'data': 'tirada_max' },
|
{ 'data': 'tirada_max' },
|
||||||
{ 'data': 'precio_min' },
|
|
||||||
{ 'data': 'importe_fijo' },
|
{ 'data': 'importe_fijo' },
|
||||||
{
|
{
|
||||||
data: actionBtns,
|
data: actionBtns,
|
||||||
|
|||||||
@ -98,7 +98,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
theTable.on( 'draw.dt', function () {
|
theTable.on( 'draw.dt', function () {
|
||||||
const boolCols = [1,2,3];
|
const boolCols = [1,2,3, 4];
|
||||||
for (let coln of boolCols) {
|
for (let coln of boolCols) {
|
||||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||||
|
|||||||
@ -66,6 +66,7 @@ class DatosGenerales {
|
|||||||
this.formatoLibro.init();
|
this.formatoLibro.init();
|
||||||
this.cliente.init();
|
this.cliente.init();
|
||||||
|
|
||||||
|
|
||||||
// Inicializa el tipo de impresion
|
// Inicializa el tipo de impresion
|
||||||
this.#handlePaginas();
|
this.#handlePaginas();
|
||||||
|
|
||||||
@ -100,6 +101,8 @@ class DatosGenerales {
|
|||||||
message: window.translations["validation"].cliente,
|
message: window.translations["validation"].cliente,
|
||||||
callback: function (input) {
|
callback: function (input) {
|
||||||
// Get the selected options
|
// Get the selected options
|
||||||
|
if (!$(this.excluirRotativa).prop('hidden'))
|
||||||
|
return true;
|
||||||
const options = $("#clienteId").select2('data');
|
const options = $("#clienteId").select2('data');
|
||||||
const hasValidOption = options.some(option => parseInt(option.id) > 0);
|
const hasValidOption = options.some(option => parseInt(option.id) > 0);
|
||||||
return options !== null && options.length > 0 && hasValidOption;
|
return options !== null && options.length > 0 && hasValidOption;
|
||||||
@ -434,6 +437,12 @@ class DatosGenerales {
|
|||||||
this.ivaReducido.val(datos.ivaReducido ? 1 : 0).trigger('change');
|
this.ivaReducido.val(datos.ivaReducido ? 1 : 0).trigger('change');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getCliente() {
|
||||||
|
if ($(this.excluirRotativa).prop('hidden'))
|
||||||
|
return $('#clienteId').val();
|
||||||
|
return this.cliente.getVal();
|
||||||
|
}
|
||||||
|
|
||||||
getDimensionLibro() {
|
getDimensionLibro() {
|
||||||
|
|
||||||
let ancho = 0;
|
let ancho = 0;
|
||||||
|
|||||||
@ -37,7 +37,7 @@ class Direcciones {
|
|||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
|
||||||
$("#clienteId").on('change', this.handleChangeCliente.bind(this));
|
$("#clienteId").on('change', this.handleChangeCliente.bind(this));
|
||||||
|
|
||||||
this.direccionesCliente.init();
|
this.direccionesCliente.init();
|
||||||
this.btnAdd.on('click', this.#insertDireccion.bind(this));
|
this.btnAdd.on('click', this.#insertDireccion.bind(this));
|
||||||
|
|||||||
@ -61,11 +61,24 @@ class PresupuestoCliente {
|
|||||||
this.disenioInterior.init();
|
this.disenioInterior.init();
|
||||||
this.disenioCubierta.init();
|
this.disenioCubierta.init();
|
||||||
this.direcciones.init();
|
this.direcciones.init();
|
||||||
|
if (window.location.href.includes("edit")) {
|
||||||
|
this.resumen.init(window.location.href.split("/").pop());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.resumen.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (this.datosGenerales.excluirRotativa.length == 0) {
|
||||||
|
|
||||||
|
this.direcciones.direccionesCliente.setParams({ 'cliente_id': $("#clienteId").val() })
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
this.btnNext.on('click', this.#nextStep.bind(this));
|
this.btnNext.on('click', this.#nextStep.bind(this));
|
||||||
this.btnPrev.on('click', this.#prevtStep.bind(this));
|
this.btnPrev.on('click', this.#prevtStep.bind(this));
|
||||||
this.btnSave.on('click', this.#savePresupuesto.bind(this));
|
this.btnSave.on('click', this.#savePresupuesto.bind(this));
|
||||||
|
this.btnConfirm.on('click', this.#confirmPresupuesto.bind(this));
|
||||||
|
|
||||||
this.titulosMenu.on('click', this.#handleTitulosMenu.bind(this));
|
this.titulosMenu.on('click', this.#handleTitulosMenu.bind(this));
|
||||||
|
|
||||||
@ -83,7 +96,6 @@ class PresupuestoCliente {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(".calcular-presupuesto").on('change', this.checkForm.bind(this));
|
$(".calcular-presupuesto").on('change', this.checkForm.bind(this));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -189,63 +201,6 @@ class PresupuestoCliente {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*RELLENAR_PRESUPUESTO(finalizar) {
|
|
||||||
|
|
||||||
if (finalizar) {
|
|
||||||
|
|
||||||
$("#titulo").val("Titulo del libro");
|
|
||||||
$("#titulo").trigger('change');
|
|
||||||
|
|
||||||
const clienteId = $("#clienteId");
|
|
||||||
const newOption = new Option("Cliente Potencial", "1817", true, true);
|
|
||||||
clienteId.append(newOption).trigger('change');
|
|
||||||
|
|
||||||
const papelFormatoId = $("#papelFormatoId");
|
|
||||||
const newOption2 = new Option("148 x 210", "1", true, true);
|
|
||||||
papelFormatoId.append(newOption2).trigger('change');
|
|
||||||
|
|
||||||
|
|
||||||
$("#paginasColor").val("6");
|
|
||||||
$("#paginasColor").trigger('change');
|
|
||||||
|
|
||||||
$("#fresado").trigger("click");
|
|
||||||
|
|
||||||
|
|
||||||
$("#colorPremium").trigger("click");
|
|
||||||
$("#offsetBlanco").trigger("click");
|
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
$("#gramaje90").trigger("click");
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
$("#tapaDura").trigger("click");
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
$("#btnNext").trigger("click");
|
|
||||||
}, 0);
|
|
||||||
setTimeout(function () {
|
|
||||||
$("#btnNext").trigger("click");
|
|
||||||
}, 0);
|
|
||||||
setTimeout(function () {
|
|
||||||
$("#btnNext").trigger("click");
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
$("#unidadesEnvio").val("50");
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$("#titulo").trigger('change');
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
#handleTitulosMenu(event) {
|
#handleTitulosMenu(event) {
|
||||||
|
|
||||||
$('.titulos-menu').removeClass('crossed');
|
$('.titulos-menu').removeClass('crossed');
|
||||||
@ -266,7 +221,7 @@ class PresupuestoCliente {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#goToForm(form) {
|
#goToForm(form) {
|
||||||
|
|
||||||
switch (form) {
|
switch (form) {
|
||||||
case '#datos-generales':
|
case '#datos-generales':
|
||||||
this.validationStepper.to(1);
|
this.validationStepper.to(1);
|
||||||
@ -414,10 +369,27 @@ class PresupuestoCliente {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#confirmPresupuesto() {
|
||||||
|
|
||||||
|
this.#solicitudGuardarPresupuesto(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#savePresupuesto() {
|
#savePresupuesto() {
|
||||||
|
|
||||||
|
this.#solicitudGuardarPresupuesto(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#solicitudGuardarPresupuesto(confirmar = false) {
|
||||||
|
|
||||||
this.#getDatos(true);
|
this.#getDatos(true);
|
||||||
|
|
||||||
|
if (confirmar) {
|
||||||
|
this.datos["confirmar"] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$('#loader').modal('show');
|
$('#loader').modal('show');
|
||||||
|
|
||||||
@ -439,7 +411,7 @@ class PresupuestoCliente {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(response.error){
|
if (response.error) {
|
||||||
popErrorAlert("No se ha podido guardar el presupuesto. Por favor, póngase en contacto con el departamento comercial.");
|
popErrorAlert("No se ha podido guardar el presupuesto. Por favor, póngase en contacto con el departamento comercial.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -546,7 +518,7 @@ class PresupuestoCliente {
|
|||||||
|
|
||||||
this.datos = {
|
this.datos = {
|
||||||
|
|
||||||
clienteId: this.datosGenerales.cliente.getVal(),
|
clienteId: this.datosGenerales.getCliente(),
|
||||||
|
|
||||||
tamanio: this.datosGenerales.getDimensionLibro(),
|
tamanio: this.datosGenerales.getDimensionLibro(),
|
||||||
tirada: this.datosGenerales.getTiradas(),
|
tirada: this.datosGenerales.getTiradas(),
|
||||||
@ -652,14 +624,27 @@ class PresupuestoCliente {
|
|||||||
|
|
||||||
this.datosGenerales.cargarDatos(response.data.datosGenerales);
|
this.datosGenerales.cargarDatos(response.data.datosGenerales);
|
||||||
this.direcciones.handleChangeCliente();
|
this.direcciones.handleChangeCliente();
|
||||||
|
|
||||||
this.disenioInterior.cargarDatos(response.data.interior, response.data.datosGenerales.papelInteriorDiferente);
|
this.disenioInterior.cargarDatos(response.data.interior, response.data.datosGenerales.papelInteriorDiferente);
|
||||||
this.disenioCubierta.cargarDatos(response.data.cubierta, response.data.guardas, response.data.sobrecubierta);
|
this.disenioCubierta.cargarDatos(response.data.cubierta, response.data.guardas, response.data.sobrecubierta);
|
||||||
this.direcciones.cargarDatos(response.data.direcciones, response.data.datosGenerales);
|
this.direcciones.cargarDatos(response.data.direcciones, response.data.datosGenerales);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
||||||
$('#loader').modal('hide');
|
$('#loader').modal('hide');
|
||||||
this.calcularPresupuesto = true;
|
|
||||||
this.checkForm({ target: { id: 'tirada' } });
|
if (response.data.state != 2) {
|
||||||
|
|
||||||
|
this.calcularPresupuesto = true;
|
||||||
|
this.checkForm({ target: { id: 'tirada' } });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#menu_resumen_button').trigger('click');
|
||||||
|
setTimeout(() => {
|
||||||
|
this.resumen.init_dropzone();
|
||||||
|
this.resumen.generate_total(response.data.resumen.base, response.data.resumen.precio_unidad);
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -53,13 +53,133 @@ class Resumen {
|
|||||||
this.divPreview = $(this.domItem.find("#pv_ec_shape"));
|
this.divPreview = $(this.domItem.find("#pv_ec_shape"));
|
||||||
this.btnPreviewCubierta = $(this.domItem.find("#btnPreviewCubierta"));
|
this.btnPreviewCubierta = $(this.domItem.find("#btnPreviewCubierta"));
|
||||||
|
|
||||||
this.init();
|
this.submitFiles = $(this.domItem.find("#submit-all-files"));
|
||||||
|
|
||||||
|
this.dropzone = null;
|
||||||
|
this.presupuesto_id = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
init() {
|
init(presupuesto_id = -1) {
|
||||||
|
|
||||||
this.btnPreviewCubierta.on('click', this.#btnPreview.bind(this));
|
this.btnPreviewCubierta.on('click', this.#btnPreview.bind(this));
|
||||||
|
|
||||||
|
this.submitFiles.on('click', this.#btnUploadFiles.bind(this));
|
||||||
|
|
||||||
|
if (presupuesto_id != -1) {
|
||||||
|
this.presupuesto_id = presupuesto_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init_dropzone(presupuesto_id) {
|
||||||
|
|
||||||
|
Dropzone.autoDiscover = false;
|
||||||
|
|
||||||
|
const previewTemplate = `<div class="dz-preview dz-file-preview">
|
||||||
|
<div class="dz-details">
|
||||||
|
<div class="dz-thumbnail">
|
||||||
|
<!---<img data-dz-thumbnail>
|
||||||
|
<span class="dz-nopreview">No preview</span> --->
|
||||||
|
<div class="dz-success-mark"></div>
|
||||||
|
<div class="dz-error-mark"></div>
|
||||||
|
<div class="dz-error-message"><span data-dz-errormessage></span></div>
|
||||||
|
<div class="progress">
|
||||||
|
<div class="progress-bar progress-bar-primary" role="progressbar" aria-valuemin="0" aria-valuemax="100" data-dz-uploadprogress></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="dz-filename" data-dz-name></div>
|
||||||
|
<div class="dz-size" data-dz-size></div>
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
|
||||||
|
this.dropzone = new Dropzone('#dropzone-multi', {
|
||||||
|
url: "/presupuestos/presupuestocliente/upload_files",
|
||||||
|
addRemoveLinks: true,
|
||||||
|
previewTemplate: previewTemplate,
|
||||||
|
paramName: "file",
|
||||||
|
uploadMultiple: true,
|
||||||
|
parallelUploads: 4, // Ajusta este número al máximo número de archivos que esperas subir a la vez
|
||||||
|
maxFiles: 5, // Ajusta este número al máximo número de archivos que esperas subir a la vez
|
||||||
|
autoProcessQueue: true,
|
||||||
|
dictRemoveFile: "Eliminar",
|
||||||
|
acceptedFiles: 'image/*, application/pdf',
|
||||||
|
maxFilesize: 5e+7, // Bytes
|
||||||
|
init: function () {
|
||||||
|
let thisDropzone = this;
|
||||||
|
$('#loader').show();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "/presupuestos/presupuestocliente/get_files",
|
||||||
|
type: 'POST',
|
||||||
|
data: { presupuesto_id: presupuesto_id },
|
||||||
|
|
||||||
|
}).done(function (response) {
|
||||||
|
if (response == null || response == "") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let values = JSON.parse(response);
|
||||||
|
for (var i = 0; i < values.length; i++) {
|
||||||
|
var mockFile = { name: values[i].name, size: values[i].size, hash: values[i].hash };
|
||||||
|
|
||||||
|
thisDropzone.files.push(mockFile); // add to files array
|
||||||
|
thisDropzone.emit("addedfile", mockFile);
|
||||||
|
thisDropzone.emit("thumbnail", mockFile, window.location.host + "/sistema/intranet/presupuestos/" + values[i].hash);
|
||||||
|
thisDropzone.emit("complete", mockFile);
|
||||||
|
thisDropzone.options.success.call(thisDropzone, mockFile);
|
||||||
|
};
|
||||||
|
}).always(function () {
|
||||||
|
$('#loader').hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.on("addedfile", function (file) {
|
||||||
|
if (file.hash) {
|
||||||
|
var viewButton = Dropzone.createElement("<span class='dz-remove'>Ver</span>");
|
||||||
|
file.previewElement.appendChild(viewButton);
|
||||||
|
// Listen to the view button click event
|
||||||
|
viewButton.addEventListener("click", function (e) {
|
||||||
|
|
||||||
|
window.open(window.location.protocol + "//" + window.location.host + "/sistema/intranet/presupuestos/" + file.hash, '_blank');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#btnUploadFiles() {
|
||||||
|
|
||||||
|
var files = this.dropzone.files;
|
||||||
|
$('#loader').show();
|
||||||
|
|
||||||
|
var formData = new FormData();
|
||||||
|
var oldFiles = [];
|
||||||
|
var counter = 0;
|
||||||
|
for (var i = 0; i < files.length; i++) {
|
||||||
|
|
||||||
|
if (files[i].upload) {
|
||||||
|
var file = files[i];
|
||||||
|
formData.append('file[' + counter + ']', file);
|
||||||
|
counter += 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
oldFiles.push(files[i].name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
formData.append('oldFiles', JSON.stringify(oldFiles));
|
||||||
|
|
||||||
|
formData.append('presupuesto_id', this.presupuesto_id);
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "/presupuestos/presupuestocliente/upload_files",
|
||||||
|
type: 'POST',
|
||||||
|
data: formData,
|
||||||
|
processData: false, // Indicar a jQuery que no procese los datos
|
||||||
|
contentType: false // Indicar a jQuery que no establezca el tipo de contenido
|
||||||
|
}).done(function (response) {
|
||||||
|
|
||||||
|
}).always(function () {
|
||||||
|
$('#loader').hide();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -178,15 +298,15 @@ class Resumen {
|
|||||||
const tarjetaPrecio = $('.tarjeta-tiradas-precios').filter(function () {
|
const tarjetaPrecio = $('.tarjeta-tiradas-precios').filter(function () {
|
||||||
return parseInt($(this).find('.tarjeta-tiradas-precios-tirada').attr('data')) == unidades;
|
return parseInt($(this).find('.tarjeta-tiradas-precios-tirada').attr('data')) == unidades;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
let precio_u_text = tarjetaPrecio.find('.tarjeta-tiradas-precios-precio-unidad').text();
|
|
||||||
|
let precio_u_text = tarjetaPrecio.find('.tarjeta-tiradas-precios-precio-unidad').text();
|
||||||
precio_u_text = precio_u_text.replace('€/u', '');
|
precio_u_text = precio_u_text.replace('€/u', '');
|
||||||
precio_u_text = this.#changeDecimalFormat(precio_u_text);
|
precio_u_text = this.#changeDecimalFormat(precio_u_text);
|
||||||
|
|
||||||
const base = tarjetaPrecio.find('.tarjeta-tiradas-precios-precio').attr('data');
|
const base = tarjetaPrecio.find('.tarjeta-tiradas-precios-precio').attr('data');
|
||||||
let base_text = this.#changeDecimalFormat(base);
|
let base_text = this.#changeDecimalFormat(base);
|
||||||
|
|
||||||
const iva_porcentaje = this.datosGenerales.ivaReducido.find('option:selected').val() == 1 ? 0.21 : 0.04;
|
const iva_porcentaje = this.datosGenerales.ivaReducido.find('option:selected').val() == 1 ? 0.21 : 0.04;
|
||||||
const iva = (parseFloat(base) * iva_porcentaje).toFixed(2);
|
const iva = (parseFloat(base) * iva_porcentaje).toFixed(2);
|
||||||
let iva_text = this.#changeDecimalFormat(iva);
|
let iva_text = this.#changeDecimalFormat(iva);
|
||||||
@ -202,6 +322,28 @@ class Resumen {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generate_total(base, precio_u) {
|
||||||
|
|
||||||
|
let precio_u_text = String(precio_u);
|
||||||
|
precio_u_text = precio_u_text.replace('€/u', '');
|
||||||
|
precio_u_text = this.#changeDecimalFormat(precio_u_text);
|
||||||
|
|
||||||
|
let base_text = this.#changeDecimalFormat(String(base));
|
||||||
|
|
||||||
|
const iva_porcentaje = this.datosGenerales.ivaReducido.find('option:selected').val() == 1 ? 0.21 : 0.04;
|
||||||
|
const iva = (parseFloat(base) * iva_porcentaje).toFixed(2);
|
||||||
|
let iva_text = this.#changeDecimalFormat(iva);
|
||||||
|
|
||||||
|
const total = (parseFloat(base) + parseFloat(iva)).toFixed(2);
|
||||||
|
let total_text = this.#changeDecimalFormat(total);
|
||||||
|
|
||||||
|
this.precio_unidad.text(precio_u_text);
|
||||||
|
this.total_base.text(base_text);
|
||||||
|
this.iva_porcentaje.text(this.datosGenerales.ivaReducido.find('option:selected').val() == 1 ? '21' : '4');
|
||||||
|
this.iva.text(iva_text);
|
||||||
|
this.total.text(total_text);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#capitalizeFirstLetter(string) {
|
#capitalizeFirstLetter(string) {
|
||||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||||
@ -209,7 +351,7 @@ class Resumen {
|
|||||||
|
|
||||||
|
|
||||||
#changeDecimalFormat(number) {
|
#changeDecimalFormat(number) {
|
||||||
|
|
||||||
let cleanedNumber = String(number).replace(/[^\d.]/g, '');
|
let cleanedNumber = String(number).replace(/[^\d.]/g, '');
|
||||||
let partes = cleanedNumber.split('.');
|
let partes = cleanedNumber.split('.');
|
||||||
partes[0] = partes[0].replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1.');
|
partes[0] = partes[0].replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1.');
|
||||||
|
|||||||
Reference in New Issue
Block a user