mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
precio minimo en tarifa encuadernacion a nivel de lineas
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
<?php namespace App\Controllers\Tarifas;
|
||||
<?php
|
||||
namespace App\Controllers\Tarifas;
|
||||
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
@ -10,15 +11,15 @@ use App\Entities\Tarifas\TarifaEncuadernacionLinea;
|
||||
use App\Models\Tarifas\TarifaEncuadernacionLineaModel;
|
||||
|
||||
use
|
||||
DataTables\Editor,
|
||||
DataTables\Database,
|
||||
DataTables\Editor\Field,
|
||||
DataTables\Editor\Format,
|
||||
DataTables\Editor\Mjoin,
|
||||
DataTables\Editor\Options,
|
||||
DataTables\Editor\Upload,
|
||||
DataTables\Editor\Validate,
|
||||
DataTables\Editor\ValidateOptions;
|
||||
DataTables\Editor,
|
||||
DataTables\Database,
|
||||
DataTables\Editor\Field,
|
||||
DataTables\Editor\Format,
|
||||
DataTables\Editor\Mjoin,
|
||||
DataTables\Editor\Options,
|
||||
DataTables\Editor\Upload,
|
||||
DataTables\Editor\Validate,
|
||||
DataTables\Editor\ValidateOptions;
|
||||
|
||||
|
||||
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');
|
||||
|
||||
@ -84,10 +85,10 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
$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 {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
} 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
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
if ($noException && $successfulResult):
|
||||
|
||||
$id = $this->model->db->insertID();
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
@ -134,20 +135,20 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
|
||||
if ($requestedId == null) :
|
||||
if ($requestedId == null):
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$tarifaEncuadernacionLinea = $this->model->find($id);
|
||||
|
||||
if ($tarifaEncuadernacionLinea == false) :
|
||||
if ($tarifaEncuadernacionLinea == false):
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('TarifaEncuadernacionLineas.tarifaencuadernacionLinea')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
@ -156,10 +157,10 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
$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 {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
@ -176,12 +177,12 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
|
||||
|
||||
$thenRedirect = false;
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
if ($noException && $successfulResult):
|
||||
$id = $tarifaEncuadernacionLinea->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
@ -214,45 +215,90 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
|
||||
$response = Editor::inst($db, 'tarifa_encuadernacion_lineas')
|
||||
->fields(
|
||||
Field::inst('paginas_libro_min')
|
||||
->validator('Validate::numeric', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.decimal'))
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.decimal')
|
||||
)
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.required')
|
||||
)
|
||||
),
|
||||
Field::inst('paginas_libro_max')
|
||||
->validator('Validate::numeric', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.decimal'))
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.decimal')
|
||||
)
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.required')
|
||||
)
|
||||
),
|
||||
Field::inst('precio_min')
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator('Validate::numeric', array(
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('TarifaAcabadoLineas.validation.precio_min.decimal'))
|
||||
'message' => lang('TarifaAcabadoLineas.validation.precio_min.decimal')
|
||||
)
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.precio_min.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.precio_min.required')
|
||||
)
|
||||
),
|
||||
Field::inst('precio_max')
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator('Validate::numeric', array(
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('TarifaAcabadoLineas.validation.precio_max.decimal'))
|
||||
'message' => lang('TarifaAcabadoLineas.validation.precio_max.decimal')
|
||||
)
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.precio_max.required'))
|
||||
->validator(
|
||||
'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')
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator('Validate::numeric', array(
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('TarifaAcabadoLineas.validation.margen.decimal'))
|
||||
'message' => lang('TarifaAcabadoLineas.validation.margen.decimal')
|
||||
)
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.margen.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.margen.required')
|
||||
)
|
||||
),
|
||||
Field::inst('tirada_encuadernacion_id'),
|
||||
Field::inst('user_created_id'),
|
||||
@ -322,10 +368,10 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$reqData = $this->request->getPost();
|
||||
|
||||
|
||||
$cleandatatable = $reqData['cleandatatable'] ?? 0;
|
||||
|
||||
if($cleandatatable){
|
||||
|
||||
if ($cleandatatable) {
|
||||
|
||||
$tarifa_encuadernacion_id = $reqData['tarifa_encuadernacion_id'] ?? -1;
|
||||
|
||||
@ -338,11 +384,9 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
|
||||
}
|
||||
|
||||
else{
|
||||
|
||||
} else {
|
||||
|
||||
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
|
||||
$errstr = 'No data available in response to this specific request.';
|
||||
$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;
|
||||
@ -10,15 +11,15 @@ use App\Entities\Tarifas\TarifaEncuadernacionLinea;
|
||||
use App\Models\Tarifas\TarifaEncuadernacionLineaHorasModel;
|
||||
|
||||
use
|
||||
DataTables\Editor,
|
||||
DataTables\Database,
|
||||
DataTables\Editor\Field,
|
||||
DataTables\Editor\Format,
|
||||
DataTables\Editor\Mjoin,
|
||||
DataTables\Editor\Options,
|
||||
DataTables\Editor\Upload,
|
||||
DataTables\Editor\Validate,
|
||||
DataTables\Editor\ValidateOptions;
|
||||
DataTables\Editor,
|
||||
DataTables\Database,
|
||||
DataTables\Editor\Field,
|
||||
DataTables\Editor\Format,
|
||||
DataTables\Editor\Mjoin,
|
||||
DataTables\Editor\Options,
|
||||
DataTables\Editor\Upload,
|
||||
DataTables\Editor\Validate,
|
||||
DataTables\Editor\ValidateOptions;
|
||||
|
||||
|
||||
class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceController
|
||||
@ -71,9 +72,9 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
|
||||
|
||||
public function add()
|
||||
{
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
@ -82,10 +83,10 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
$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 {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
} 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
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
if ($noException && $successfulResult):
|
||||
|
||||
$id = $this->model->db->insertID();
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
@ -134,20 +135,20 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
|
||||
if ($requestedId == null) :
|
||||
if ($requestedId == null):
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$tarifaEncuadernacionLinea = $this->model->find($id);
|
||||
|
||||
if ($tarifaEncuadernacionLinea == false) :
|
||||
if ($tarifaEncuadernacionLinea == false):
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('TarifaEncuadernacionLineas.tarifaencuadernacionLinea')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
@ -156,10 +157,10 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
$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 {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
@ -176,12 +177,12 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
|
||||
|
||||
$thenRedirect = false;
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
if ($noException && $successfulResult):
|
||||
$id = $tarifaEncuadernacionLinea->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
@ -214,40 +215,79 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
|
||||
$response = Editor::inst($db, 'tarifa_encuadernacion_lineas_horas')
|
||||
->fields(
|
||||
Field::inst('tiempo_min')
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator('Validate::numeric', array(
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.decimal'))
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.decimal')
|
||||
)
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.required')
|
||||
)
|
||||
),
|
||||
Field::inst('tiempo_max')
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator('Validate::numeric', array(
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.decimal'))
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.decimal')
|
||||
)
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.required')
|
||||
)
|
||||
),
|
||||
Field::inst('precio_hora')
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator('Validate::numeric', array(
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('TarifaAcabadoLineas.validation.precio_min.decimal'))
|
||||
'message' => lang('TarifaAcabadoLineas.validation.precio_min.decimal')
|
||||
)
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.precio_min.required'))
|
||||
->validator(
|
||||
'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')
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator('Validate::numeric', array(
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('TarifaAcabadoLineas.validation.margen.decimal'))
|
||||
'message' => lang('TarifaAcabadoLineas.validation.margen.decimal')
|
||||
)
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.margen.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.margen.required')
|
||||
)
|
||||
),
|
||||
Field::inst('tirada_encuadernacion_id'),
|
||||
Field::inst('user_created_id'),
|
||||
@ -314,10 +354,10 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
|
||||
|
||||
$cleandatatable = $reqData['cleandatatable'] ?? 0;
|
||||
|
||||
if($cleandatatable){
|
||||
|
||||
if ($cleandatatable) {
|
||||
|
||||
$tarifa_encuadernacion_id = $reqData['tarifa_encuadernacion_id'] ?? -1;
|
||||
|
||||
@ -330,9 +370,8 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
} else {
|
||||
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
|
||||
$errstr = 'No data available in response to this specific request.';
|
||||
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
|
||||
|
||||
@ -126,15 +126,6 @@ class Tarifaencuadernaciontiradas extends \App\Controllers\BaseResourceControlle
|
||||
->validator('Validate::notEmpty', array(
|
||||
'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')
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_max.required'))
|
||||
|
||||
@ -11,6 +11,7 @@ class TarifaEncuadernacionLineaHoras extends \CodeIgniter\Entity\Entity
|
||||
"tiempo_min" => 0,
|
||||
"tiempo_max" => 0,
|
||||
"precio_hora" => 0,
|
||||
"total_min" => 0,
|
||||
"margen" => 0,
|
||||
"user_created_id" => 0,
|
||||
"user_updated_id" => 0,
|
||||
@ -22,6 +23,7 @@ class TarifaEncuadernacionLineaHoras extends \CodeIgniter\Entity\Entity
|
||||
"tirada_encuadernacion_id" => "int",
|
||||
"tiempo_min" => "float",
|
||||
"tiempo_max" => "float",
|
||||
"total_min" => "float",
|
||||
"precio_hora" => "float",
|
||||
"margen" => "float",
|
||||
"user_created_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);
|
||||
if (!$POD){
|
||||
$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[1] = $precio_total;
|
||||
@ -323,11 +331,12 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
|
||||
$total = $precio_unidad * $ejemplares;
|
||||
$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);
|
||||
$margen = round(100.0 * (floatval($tarifa->tarifa_precio_min) - $total) / floatval($tarifa->tarifa_precio_min), 0);
|
||||
$total = floatval($tarifa->tarifa_precio_min);
|
||||
$margen = round(100.0 * (floatval($tarifa_precio_min) - $total) / floatval($tarifa_precio_min), 0);
|
||||
$total = floatval($tarifa_precio_min);
|
||||
$precio_unidad = round(floatval($total / $ejemplares), 2);
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,8 @@ class TarifaEncuadernacionLineaHorasModel extends \App\Models\BaseModel
|
||||
1 => "t1.tiempo_min",
|
||||
2 => "t1.tiempo_max",
|
||||
3 => "t1.precio_hora",
|
||||
4 => "t1.margen",
|
||||
4 => "t1.total_min",
|
||||
5 => "t1.margen",
|
||||
];
|
||||
|
||||
protected $allowedFields = [
|
||||
@ -25,6 +26,7 @@ class TarifaEncuadernacionLineaHorasModel extends \App\Models\BaseModel
|
||||
"tiempo_min",
|
||||
"tiempo_max",
|
||||
"precio_hora",
|
||||
"total_min",
|
||||
"margen",
|
||||
"user_created_id",
|
||||
"is_deleted",
|
||||
@ -54,6 +56,10 @@ class TarifaEncuadernacionLineaHorasModel extends \App\Models\BaseModel
|
||||
"label" => "TarifaEncuadernacionLineas.precioHora",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"total_min" => [
|
||||
"label" => "TarifaEncuadernacionLineas.precioHora",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"margen" => [
|
||||
"label" => "TarifaEncuadernacionLineas.margen",
|
||||
"rules" => "required|decimal",
|
||||
@ -73,6 +79,10 @@ class TarifaEncuadernacionLineaHorasModel extends \App\Models\BaseModel
|
||||
"decimal" => "TarifaEncuadernacionLineas.validation.tirada_max.decimal",
|
||||
"required" => "TarifaEncuadernacionLineas.validation.tirada_max.required",
|
||||
],
|
||||
"total_min" => [
|
||||
"decimal" => "TarifaEncuadernacionLineas.validation.tirada_max.decimal",
|
||||
"required" => "TarifaEncuadernacionLineas.validation.tirada_max.required",
|
||||
],
|
||||
"margen" => [
|
||||
"decimal" => "TarifaEncuadernacionLineas.validation.margen.decimal",
|
||||
"required" => "TarifaEncuadernacionLineas.validation.margen.required",
|
||||
@ -92,7 +102,7 @@ class TarifaEncuadernacionLineaHorasModel extends \App\Models\BaseModel
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"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"
|
||||
);
|
||||
//JJO
|
||||
|
||||
@ -19,6 +19,8 @@ class TarifaEncuadernacionLineaModel extends \App\Models\BaseModel
|
||||
3 => "t1.paginas_libro_max",
|
||||
4 => "t1.precio_min",
|
||||
5 => "t1.precio_max",
|
||||
6 => "t1.total_min",
|
||||
7 => "t1.margen",
|
||||
];
|
||||
|
||||
protected $allowedFields = [
|
||||
@ -30,6 +32,8 @@ class TarifaEncuadernacionLineaModel extends \App\Models\BaseModel
|
||||
"precio_max",
|
||||
"tirada_min",
|
||||
"tirada_max",
|
||||
"margen",
|
||||
"total_min",
|
||||
"user_created_id",
|
||||
"is_deleted",
|
||||
|
||||
@ -62,6 +66,10 @@ class TarifaEncuadernacionLineaModel extends \App\Models\BaseModel
|
||||
"label" => "TarifaEncuadernacionLineas.tiradaMin",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"total_min" => [
|
||||
"label" => "TarifaEncuadernacionLineas.precioMin",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"paginas_libro_max" => [
|
||||
"label" => "TarifaEncuadernacionLineas.paginasMax",
|
||||
"rules" => "required|decimal",
|
||||
@ -93,6 +101,10 @@ class TarifaEncuadernacionLineaModel extends \App\Models\BaseModel
|
||||
"decimal" => "TarifaEncuadernacionLineas.validation.tirada_min.decimal",
|
||||
"required" => "TarifaEncuadernacionLineas.validation.tirada_min.required",
|
||||
],
|
||||
"total_min" => [
|
||||
"decimal" => "TarifaEncuadernacionLineas.validation.precio_min.decimal",
|
||||
"required" => "TarifaEncuadernacionLineas.validation.precio_min.required",
|
||||
],
|
||||
"paginas_libro_max" => [
|
||||
"decimal" => "TarifaEncuadernacionLineas.validation.paginas_libro_max.decimal",
|
||||
"required" => "TarifaEncuadernacionLineas.validation.paginas_libro_max.required",
|
||||
@ -120,7 +132,7 @@ class TarifaEncuadernacionLineaModel extends \App\Models\BaseModel
|
||||
->table($this->table . " t1")
|
||||
->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.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
|
||||
$builder->where('tirada_encuadernacion_id', $tirada_encuadernacion_id);
|
||||
@ -190,6 +202,7 @@ class TarifaEncuadernacionLineaModel extends \App\Models\BaseModel
|
||||
|
||||
return $builder;
|
||||
}
|
||||
|
||||
|
||||
public function removeAllEncuadernacionLineasForTarifa($tarifaId = -1, $datetime = null, $delete_flag=1){
|
||||
|
||||
|
||||
@ -125,7 +125,7 @@ class TarifaEncuadernacionModel extends \App\Models\BaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->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,
|
||||
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"
|
||||
@ -161,7 +161,7 @@ class TarifaEncuadernacionModel extends \App\Models\BaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->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,
|
||||
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",
|
||||
1 => "t1.tirada_min",
|
||||
2 => "t1.tirada_max",
|
||||
3 => "t1.precio_min",
|
||||
4 => "t1.importe_fijo",
|
||||
];
|
||||
|
||||
@ -25,7 +24,6 @@ class TarifaEncuadernacionTiradaModel extends \App\Models\BaseModel
|
||||
"tirada_min",
|
||||
"tirada_max",
|
||||
"proveedor_id",
|
||||
"precio_min",
|
||||
"importe_fijo",
|
||||
"user_created_id",
|
||||
"user_updated_id",
|
||||
@ -53,10 +51,6 @@ class TarifaEncuadernacionTiradaModel extends \App\Models\BaseModel
|
||||
"label" => "TarifaEncuadernacionTiradas.tiradaMin",
|
||||
"rules" => "required|integer",
|
||||
],
|
||||
"precio_min" => [
|
||||
"label" => "Tarifaencuadernacion.precioMin",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"importe_fijo" => [
|
||||
"label" => "Tarifaencuadernacion.importeFijo",
|
||||
"rules" => "required|decimal",
|
||||
@ -72,10 +66,6 @@ class TarifaEncuadernacionTiradaModel extends \App\Models\BaseModel
|
||||
"integer" => "TarifaEncuadernacionTiradas.validation.tirada_min.integer",
|
||||
"required" => "TarifaEncuadernacionTiradas.validation.tirada_min.required",
|
||||
],
|
||||
"precio_min" => [
|
||||
"required" => "Tarifaencuadernacion.validation.precio_min.required",
|
||||
"decimal" => "Tarifaencuadernacion.validation.precio_min.decimal",
|
||||
],
|
||||
"importe_fijo" => [
|
||||
"required" => "Tarifaencuadernacion.validation.importe_fijo.required",
|
||||
"decimal" => "Tarifaencuadernacion.validation.importe_fijo.decimal",
|
||||
@ -95,7 +85,7 @@ class TarifaEncuadernacionTiradaModel extends \App\Models\BaseModel
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"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,
|
||||
t3.nombre AS proveedor, t3.id AS proveedor_id, t2.id AS tarifa_encuadernacion"
|
||||
);
|
||||
|
||||
@ -49,7 +49,6 @@
|
||||
<th><?= lang('TarifaEncuadernacionTiradas.proveedor') ?></th>
|
||||
<th><?= lang('TarifaEncuadernacionTiradas.tiradaMin') ?></th>
|
||||
<th><?= lang('TarifaEncuadernacionTiradas.tiradaMax') ?></th>
|
||||
<th><?= lang('Tarifaencuadernacion.importeMin') ?></th>
|
||||
<th><?= lang('Tarifaencuadernacion.importeFijo') ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
@ -83,6 +82,7 @@
|
||||
<th><?= lang('TarifaEncuadernacionLineas.precioMin') ?></th>
|
||||
<th><?= lang('TarifaEncuadernacionLineas.paginasMax') ?></th>
|
||||
<th><?= lang('TarifaEncuadernacionLineas.precioMax') ?></th>
|
||||
<th><?= lang('Tarifaencuadernacion.importeMin') ?></th>
|
||||
<th><?= lang('TarifaEncuadernacionLineas.margen') ?></th>
|
||||
<th style="min-width:100px"></th>
|
||||
</tr>
|
||||
@ -112,6 +112,7 @@
|
||||
<th><?= lang('TarifaEncuadernacionLineas.tiempoMin') ?></th>
|
||||
<th><?= lang('TarifaEncuadernacionLineas.tiempoMax') ?></th>
|
||||
<th><?= lang('TarifaEncuadernacionLineas.precioHora') ?></th>
|
||||
<th><?= lang('Tarifaencuadernacion.importeMin') ?></th>
|
||||
<th><?= lang('TarifaEncuadernacionLineas.margen') ?></th>
|
||||
<th style="min-width:100px"></th>
|
||||
</tr>
|
||||
@ -298,6 +299,8 @@
|
||||
name: "tiempo_max"
|
||||
}, {
|
||||
name: "precio_hora"
|
||||
}, {
|
||||
name: "total_min"
|
||||
}, {
|
||||
name: "margen"
|
||||
}, {
|
||||
@ -366,6 +369,7 @@
|
||||
{ 'data': 'tiempo_min' },
|
||||
{ 'data': 'tiempo_max' },
|
||||
{ 'data': 'precio_hora' },
|
||||
{ 'data': 'total_min' },
|
||||
{ 'data': 'margen' },
|
||||
{
|
||||
data: actionBtns,
|
||||
@ -477,6 +481,8 @@
|
||||
name: "paginas_libro_max"
|
||||
}, {
|
||||
name: "precio_max"
|
||||
}, {
|
||||
name: "total_min"
|
||||
}, {
|
||||
name: "margen"
|
||||
}, {
|
||||
@ -556,6 +562,7 @@
|
||||
{ 'data': 'precio_max' },
|
||||
{ 'data': 'paginas_libro_max' },
|
||||
{ 'data': 'precio_min' },
|
||||
{ 'data': 'total_min' },
|
||||
{ 'data': 'margen' },
|
||||
{
|
||||
data: actionBtns,
|
||||
@ -661,8 +668,6 @@
|
||||
name: "tirada_min"
|
||||
}, {
|
||||
name: "tirada_max"
|
||||
}, {
|
||||
name: "precio_min"
|
||||
}, {
|
||||
name: "importe_fijo"
|
||||
}, {
|
||||
@ -746,7 +751,6 @@
|
||||
},
|
||||
{ 'data': 'tirada_min' },
|
||||
{ 'data': 'tirada_max' },
|
||||
{ 'data': 'precio_min' },
|
||||
{ 'data': 'importe_fijo' },
|
||||
{
|
||||
data: actionBtns,
|
||||
|
||||
@ -98,7 +98,7 @@
|
||||
});
|
||||
|
||||
theTable.on( 'draw.dt', function () {
|
||||
const boolCols = [1,2,3];
|
||||
const boolCols = [1,2,3, 4];
|
||||
for (let coln of boolCols) {
|
||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||
|
||||
Reference in New Issue
Block a user