Merge branch 'dev/presupuestos3' into 'dev/presupuestos_pdf'

# Conflicts:
#   ci4/app/Config/Routes.php
#   ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php
This commit is contained in:
Ignacio Martinez Navajas
2023-11-06 10:35:22 +00:00
89 changed files with 6395 additions and 1902 deletions

4
.idea/php.xml generated
View File

@ -10,7 +10,9 @@
<option name="highlightLevel" value="WARNING" />
<option name="transferred" value="true" />
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.3" />
<component name="PhpProjectSharedConfiguration" php_language_level="8.0">
<option name="suggestChangeDefaultLanguageLevel" value="false" />
</component>
<component name="PhpStanOptionsConfiguration">
<option name="transferred" value="true" />
</component>

View File

@ -478,11 +478,28 @@ $routes->group('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos
});
$routes->resource('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Cosidotapablanda', 'except' => 'show,new,create,update']);
$routes->group('printpresupuestos', ['namespace' => 'App\Controllers\Pdf'], function ($routes) {
$routes->get('', 'PrintPresupuestos::index', ['as' => 'pdfList']);
$routes->match(['get', 'post'], 'generar', 'PrintPresupuestos::generar', ['as' => 'presupuestoToPdf']);
$routes->group('serviciosacabados', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
$routes->post('datatable', 'PresupuestoAcabados::datatable', ['as' => 'dataTableOfPresupuestoAcabados']);
$routes->post('datatable_editor', 'PresupuestoAcabados::datatable_editor', ['as' => 'editorOfPresupuestoAcabados']);
$routes->get('delete/(:num)', 'PresupuestoAcabados::delete/$1', ['as' => 'deletePresupuestoAcabado']);
});
$routes->group('serviciosencuadernaciones', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
$routes->post('datatable', 'PresupuestoEncuadernaciones::datatable', ['as' => 'dataTableOfPresupuestoEncuadernaciones']);
$routes->post('datatable_editor', 'PresupuestoEncuadernaciones::datatable_editor', ['as' => 'editorOfPresupuestoEncuadernaciones']);
});
$routes->group('serviciosmanipulados', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
$routes->post('datatable', 'PresupuestoManipulados::datatable', ['as' => 'dataTableOfPresupuestoManipulados']);
$routes->post('datatable_editor', 'PresupuestoManipulados::datatable_editor', ['as' => 'editorOfPresupuestoManipulados']);
});
$routes->group('serviciospreimpresiones', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
$routes->post('datatable', 'PresupuestoPreimpresiones::datatable', ['as' => 'dataTableOfPresupuestoPreimpresiones']);
$routes->post('datatable_editor', 'PresupuestoPreimpresiones::datatable_editor', ['as' => 'editorOfPresupuestoPreimpresiones']);
});
/*
* --------------------------------------------------------------------
* Additional Routing

View File

@ -1,46 +0,0 @@
<?php
namespace App\Controllers\Clientes;
use App\Controllers\BaseController;
class Tarifacliente extends BaseController
{
function __construct()
{
}
public function index()
{
$uri = service('uri');
$data['page_name'] = "Tarifa Cliente";
$data['url'] = base_url() . $uri->getSegment(1) . '/' . $uri->getSegment(2);
echo view(getenv('theme.path').'main/demo_view', $data);
}
public function delete()
{
$uri = service('uri');
$data['page_name'] = "Tarifa Cliente";
$data['url'] = base_url() . $uri->getSegment(1) . '/' . $uri->getSegment(2);
echo view(getenv('theme.path').'main/demo_view', $data);
}
public function add()
{
$uri = service('uri');
$data['page_name'] = "Tarifa Cliente";
$data['url'] = base_url() . $uri->getSegment(1) . '/' . $uri->getSegment(2);
echo view(getenv('theme.path').'main/demo_view', $data);
}
public function edit()
{
$uri = service('uri');
$data['page_name'] = "Tarifa Cliente";
$data['url'] = base_url() . $uri->getSegment(1) . '/' . $uri->getSegment(2);
echo view(getenv('theme.path').'main/demo_view', $data);
}
}

View File

@ -1,232 +0,0 @@
<?php namespace App\Controllers\Configuracion;
use App\Entities\Configuracion\FormasPagoEntity;
class Formaspago extends \App\Controllers\GoBaseController
{
use \CodeIgniter\API\ResponseTrait;
protected static $primaryModelName = 'App\Models\Configuracion\FormasPagoModel';
protected static $singularObjectNameCc = 'formaPago';
protected static $singularObjectName = 'Forma Pago';
protected static $pluralObjectName = 'Formas Pago';
protected static $controllerSlug = 'formaspago';
protected static $viewPath = 'themes/backend/vuexy/form/configuracion/formas-pago/';
protected $indexRoute = 'formaPagoList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
$this->viewData['pageTitle'] = lang('FormasPagoes.moduleTitle');
parent::initController($request, $response, $logger);
$this->viewData['usingSweetAlert'] = true;
if (session('errorMessage')) {
$this->session->setFlashData('sweet-error', session('errorMessage'));
}
if (session('successMessage')) {
$this->session->setFlashData('sweet-success', session('successMessage'));
}
}
public function index()
{
$this->viewData['usingClientSideDataTable'] = true;
$this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('FormasPagoes.formaPago')]);
parent::index();
}
public function add()
{
$requestMethod = $this->request->getMethod();
if ($requestMethod === 'post') :
$nullIfEmpty = true; // !(phpversion() >= '8.1');
$postData = $this->request->getPost();
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) :
try {
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
} catch (\Exception $e) {
$noException = false;
$this->dealWithException($e);
}
else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors());
endif;
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
endif;
if ($noException && $successfulResult) :
$id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
if ($thenRedirect) :
if (!empty($this->indexRoute)) :
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
else:
return $this->redirect2listView('sweet-success', $message);
endif;
else:
$this->session->setFlashData('sweet-success', $message);
endif;
endif; // $noException && $successfulResult
endif; // ($requestMethod === 'post')
$this->viewData['formasPagoEntity'] = isset($sanitizedData) ? new FormasPagoEntity($sanitizedData) : new FormasPagoEntity();
$this->viewData['formAction'] = route_to('createFormaPago');
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('FormasPagoes.formaPago') . ' ' . lang('Basic.global.addNewSuffix');
return $this->displayForm(__METHOD__);
} // end function add()
public function edit($requestedId = null)
{
if ($requestedId == null) :
return $this->redirect2listView();
endif;
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
$formasPagoEntity = $this->model->find($id);
if ($formasPagoEntity == false) :
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('FormasPagoes.formaPago')), $id]);
return $this->redirect2listView('sweet-error', $message);
endif;
$requestMethod = $this->request->getMethod();
if ($requestMethod === 'post') :
$nullIfEmpty = true; // !(phpversion() >= '8.1');
$postData = $this->request->getPost();
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) :
try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
} catch (\Exception $e) {
$noException = false;
$this->dealWithException($e);
}
else:
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('FormasPagoes.formaPago'))]);
$this->session->setFlashdata('formErrors', $this->model->errors());
endif;
$formasPagoEntity->fill($sanitizedData);
$thenRedirect = false;
endif;
if ($noException && $successfulResult) :
$id = $formasPagoEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
if ($thenRedirect) :
if (!empty($this->indexRoute)) :
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
else:
return $this->redirect2listView('sweet-success', $message);
endif;
else:
$this->session->setFlashData('sweet-success', $message);
endif;
endif; // $noException && $successfulResult
endif; // ($requestMethod === 'post')
$this->viewData['formasPagoEntity'] = $formasPagoEntity;
$this->viewData['formAction'] = route_to('updateFormaPago', $id);
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('FormasPagoes.formaPago') . ' ' . lang('Basic.global.edit3');
return $this->displayForm(__METHOD__, $id);
} // end function edit(...)
public function allItemsSelect()
{
if ($this->request->isAJAX()) {
$onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id';
$menu = $this->model->getAllForMenu($reqVal . ', nombre', 'nombre', $onlyActiveOnes, false);
$nonItem = new \stdClass;
$nonItem->id = '';
$nonItem->nombre = '- ' . lang('Basic.global.None') . ' -';
array_unshift($menu, $nonItem);
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data = [
'menu' => $menu,
$csrfTokenName => $newTokenHash
];
return $this->respond($data);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function menuItems()
{
if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0];
$reqText = goSanitize($this->request->getPost('text'))[0];
$onlyActiveOnes = false;
$columns2select = [$reqId ?? 'id', $reqText ?? 'nombre'];
$onlyActiveOnes = false;
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
$nonItem = new \stdClass;
$nonItem->id = '';
$nonItem->text = '- ' . lang('Basic.global.None') . ' -';
array_unshift($menu, $nonItem);
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data = [
'menu' => $menu,
$csrfTokenName => $newTokenHash
];
return $this->respond($data);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
}

View File

@ -52,19 +52,12 @@ class Maquinascalles extends \App\Controllers\GoBaseResourceController
// Build our Editor instance and process the data coming from _POST
$response = Editor::inst($db, 'maquinas_calles')
->fields(
Field::inst('formas_min')
Field::inst('formas')
->validator('Validate::numeric', array(
'message' => lang('MaquinasCalles.validation.formas_min.integer'))
'message' => lang('MaquinasCalles.validation.formas.integer'))
)
->validator('Validate::notEmpty', array(
'message' => lang('MaquinasCalles.validation.formas_min.required'))
),
Field::inst('formas_max')
->validator('Validate::numeric', array(
'message' => lang('MaquinasCalles.validation.formas_max.integer'))
)
->validator('Validate::notEmpty', array(
'message' => lang('MaquinasCalles.validation.formas_max.required'))
'message' => lang('MaquinasCalles.validation.formas.required'))
),
Field::inst('internas')
->validator('Validate::numeric', array(
@ -94,10 +87,9 @@ class Maquinascalles extends \App\Controllers\GoBaseResourceController
foreach ($data['data'] as $pkey => $values) {
// Si no se quiere borrar...
if ($data['data'][$pkey]['is_deleted'] != 1) {
$process_data['formas_min'] = $data['data'][$pkey]['formas_min'];
$process_data['formas_max'] = $data['data'][$pkey]['formas_max'];
$process_data['formas'] = $data['data'][$pkey]['formas'];
$process_data['maquina_id'] = $data['data'][$pkey]['maquina_id'];
$response = $this->model->checkIntervals($process_data, $pkey);
$response = $this->model->checkDuplicatedFormas($process_data, $pkey);
// No se pueden duplicar valores al crear o al editar
if (!empty($response)) {
return $response;

View File

@ -78,8 +78,17 @@ class Maquinaspapelesimpresion extends \App\Controllers\GoBaseResourceController
$length = $reqData['length'] ?? 5;
$search = $reqData['search']['value'];
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
$order = MaquinasPapelesImpresionModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
$requestedOrder2 = $reqData['order']['1']['column'] ?? $requestedOrder;
$requestedOrder3 = $reqData['order']['2']['column'] ?? $requestedOrder;
$requestedOrder4 = $reqData['order']['3']['column'] ?? $requestedOrder;
$order = MaquinasPapelesImpresionModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 0];
$order2 = MaquinasPapelesImpresionModel::SORTABLE[$requestedOrder2 >= 0 ? $requestedOrder2 : $requestedOrder];
$order3 = MaquinasPapelesImpresionModel::SORTABLE[$requestedOrder3 >= 0 ? $requestedOrder3 : $requestedOrder];
$order4 = MaquinasPapelesImpresionModel::SORTABLE[$requestedOrder4 >= 0 ? $requestedOrder4 : $requestedOrder];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$dir2 = $reqData['order']['1']['dir'] ?? $dir;
$dir3 = $reqData['order']['2']['dir'] ?? $dir;
$dir4= $reqData['order']['3']['dir'] ?? $dir;
$maquina_id = $reqData['maquina_id'] ?? -1;
// Para saber si el papel que se tiene que mostrar es para rotativa
@ -88,11 +97,12 @@ class Maquinaspapelesimpresion extends \App\Controllers\GoBaseResourceController
// Se obtienen las líneas de las tarifas seleccionadas para esta máquina
$tarifas = $tarifa_model->getResource("", $maquina_id)->get()->getResultObject();
$resourceData = $this->model->getResource($search, $isRotativa, $tarifas, $maquina_id)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
$resourceData = $this->model->getResource($search, $isRotativa, $tarifas, $maquina_id)
->orderBy($order, $dir)->orderBy($order2, $dir2)->orderBy($order3, $dir3)->orderBy($order4, $dir4)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getResource()->countAllResults(),
$this->model->getResource("", $isRotativa, $tarifas, $maquina_id)->countAllResults(),
$this->model->getResource($search, $isRotativa, $tarifas, $maquina_id)->countAllResults()
));
} else {
@ -115,14 +125,25 @@ class Maquinaspapelesimpresion extends \App\Controllers\GoBaseResourceController
$start = $reqData['start'] ?? 0;
$length = $reqData['length'] ?? 5;
$search = $reqData['search']['value'];
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
$order = MaquinasPapelesImpresionModel::SORTABLE_2[$requestedOrder >= 0 ? $requestedOrder : 1];
$requestedOrder = $reqData['order']['0']['column'] ?? 0;
$requestedOrder2 = $reqData['order']['1']['column'] ?? $requestedOrder;
$requestedOrder3 = $reqData['order']['2']['column'] ?? $requestedOrder;
$requestedOrder4 = $reqData['order']['3']['column'] ?? $requestedOrder;
$order = MaquinasPapelesImpresionModel::SORTABLE_2[$requestedOrder >= 0 ? $requestedOrder : 0];
$order2 = MaquinasPapelesImpresionModel::SORTABLE_2[$requestedOrder2 >= 0 ? $requestedOrder2 : $requestedOrder];
$order3 = MaquinasPapelesImpresionModel::SORTABLE_2[$requestedOrder3 >= 0 ? $requestedOrder3 : $requestedOrder];
$order4 = MaquinasPapelesImpresionModel::SORTABLE_2[$requestedOrder4 >= 0 ? $requestedOrder4 : $requestedOrder];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$dir2 = $reqData['order']['1']['dir'] ?? $dir;
$dir3 = $reqData['order']['2']['dir'] ?? $dir;
$dir4= $reqData['order']['3']['dir'] ?? $dir;
$papel_id = $reqData['papel_id'] ?? -1;
$isRotativa = $reqData['isRotativa'] ?? -1;
$resourceData = $this->model->getResource_maquinas($search, $papel_id, $isRotativa)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
$resourceData = $this->model->getResource_maquinas($search, $papel_id, $isRotativa)
->orderBy($order, $dir)->orderBy($order2, $dir2)->orderBy($order3, $dir3)->orderBy($order4, $dir4)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,

View File

@ -0,0 +1,26 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
class Js_loader extends BaseController
{
function __construct()
{
}
function comparadorCosidoTapaBlanda_js()
{
$this->response->setHeader('Content-Type', 'text/javascript');
return view('themes/backend/vuexy/form/presupuestos/cosidotapablanda/comparador.js');
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +0,0 @@
<?php
namespace App\Controllers\Presupuestos;
use App\Controllers\BaseController;
class Cosidotapablandasolapas extends BaseController
{
function __construct()
{
}
public function index()
{
echo 'Presupuesto >> Libros >> Cosido tapa blanda con solapas [en desarrollo].';
}
}

View File

@ -16,10 +16,9 @@ class Js_loader extends BaseController
function comparadorCosidoTapablanda_js()
{
$this->load->view('themes/backend/vuexy/form/presupuestos/cosidotapablanda/comparador.js', $data);
$this->load->view('themes/backend/vuexy/form/presupuestos/cosidotapablanda/comparador.js');
$this->output->set_content_type('text/javascript');
}
}

View File

@ -0,0 +1,121 @@
<?php namespace App\Controllers\Presupuestos;
use App\Controllers\GoBaseResourceController;
use App\Models\Collection;
use App\Models\Presupuestos\PresupuestoAcabadosModel;
use DataTables\Editor;
use DataTables\Editor\Field;
use DataTables\Editor\Validate;
class PresupuestoAcabados extends \App\Controllers\GoBaseResourceController
{
protected $modelName = PresupuestoAcabadosModel::class;
protected $format = 'json';
protected static $singularObjectName = 'Presupuesto acabado';
protected static $singularObjectNameCc = 'presupuestoAcabado';
protected static $pluralObjectName = 'Presupuestos acabado';
protected static $pluralObjectNameCc = 'presupuestosAcabado';
protected static $controllerSlug = 'presupuesto-acabados';
protected static $viewPath = 'themes/backend/vuexy/form/presupuestos/';
protected $indexRoute = 'contactoDeClienteList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
}
public function datatable()
{
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
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);
return $response;
}
$start = $reqData['start'] ?? 0;
$length = $reqData['length'] ?? 5;
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
$order = PresupuestoAcabadosModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$id_P = $reqData['id_presupuesto'] ?? -1;
$resourceData = $this->model->getResource($id_P)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getResource()->countAllResults(),
$this->model->getResource($id_P)->countAllResults()
));
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function datatable_editor() {
if ($this->request->isAJAX()) {
include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php");
// Build our Editor instance and process the data coming from _POST
$response = Editor::inst( $db, 'presupuesto_acabados' )
->fields(
Field::inst( 'tarifa_acabado_id' )
->validator( 'Validate::notEmpty',array(
'message' => 'Selecciones servicios de acabado' )
),
Field::inst( 'precio_unidad' )
->validator( 'Validate::notEmpty',array(
'message' => 'Falta precio unitario' )
),
Field::inst( 'precio_total' )
->validator( 'Validate::notEmpty',array(
'message' => 'Falta precio total' )
),
Field::inst( 'presupuesto_id' ),
)
->validator( function($editor, $action, $data){
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT){
//return $response;
/*foreach ($data['data'] as $pkey => $values ){
// No se pueden duplicar valores al crear o al editar
if (!empty($response)){
return $response;
}
}*/
}
})
->debug(true)
->process( $_POST )
->data();
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$response[$csrfTokenName] = $newTokenHash;
echo json_encode($response);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
}

View File

@ -0,0 +1,119 @@
<?php namespace App\Controllers\Presupuestos;
use App\Controllers\GoBaseResourceController;
use App\Models\Collection;
use App\Models\Presupuestos\PresupuestoEncuadernacionesModel;
use DataTables\Editor;
use DataTables\Editor\Field;
use DataTables\Editor\Validate;
class PresupuestoEncuadernaciones extends \App\Controllers\GoBaseResourceController
{
protected $modelName = PresupuestoEncuadernacionesModel::class;
protected $format = 'json';
protected static $singularObjectName = 'Presupuesto encuadernaciones';
protected static $singularObjectNameCc = 'presupuestoEncuadernaciones';
protected static $pluralObjectName = 'Presupuestos encuadernaciones';
protected static $pluralObjectNameCc = 'presupuestosEncuadernaciones';
protected static $controllerSlug = 'presupuesto-encuadernaciones';
protected static $viewPath = 'themes/backend/vuexy/form/presupuestos/';
protected $indexRoute = 'contactoDeClienteList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
}
public function datatable()
{
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
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);
return $response;
}
$start = $reqData['start'] ?? 0;
$length = $reqData['length'] ?? 5;
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
$order = PresupuestoEncuadernacionesModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$id_P = $reqData['id_presupuesto'] ?? -1;
$resourceData = $this->model->getResource($id_P)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getResource()->countAllResults(),
$this->model->getResource($id_P)->countAllResults()
));
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function datatable_editor() {
if ($this->request->isAJAX()) {
include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php");
// Build our Editor instance and process the data coming from _POST
$response = Editor::inst( $db, 'presupuesto_acabados' )
->fields(
Field::inst( 'tarifa_encuadernado_id' )
->validator( 'Validate::notEmpty',array(
'message' => 'Selecciones servicios de acabado' )
),
Field::inst( 'precio_unidad' )
->validator( 'Validate::notEmpty',array(
'message' => 'Falta precio unitario' )
),
Field::inst( 'precio_total' )
->validator( 'Validate::notEmpty',array(
'message' => 'Falta precio total' )
),
Field::inst( 'presupuesto_id' ),
)
->validator( function($editor, $action, $data){
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT){
//return $response;
/*foreach ($data['data'] as $pkey => $values ){
// No se pueden duplicar valores al crear o al editar
if (!empty($response)){
return $response;
}
}*/
}
})
->debug(true)
->process( $_POST )
->data();
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$response[$csrfTokenName] = $newTokenHash;
echo json_encode($response);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
}

View File

@ -0,0 +1,123 @@
<?php namespace App\Controllers\Presupuestos;
use App\Controllers\GoBaseResourceController;
use App\Models\Collection;
use App\Entities\Clientes\ClienteContactoEntity;
use App\Models\Clientes\ClienteModel;
use App\Models\Presupuestos\PresupuestoManipuladosModel;
use DataTables\Editor;
use DataTables\Editor\Field;
use DataTables\Editor\Validate;
class PresupuestoManipulados extends \App\Controllers\GoBaseResourceController
{
protected $modelName = PresupuestoManipuladosModel::class;
protected $format = 'json';
protected static $singularObjectName = 'Presupuesto manipulado';
protected static $singularObjectNameCc = 'presupuestoManipulado';
protected static $pluralObjectName = 'Presupuestos manipulado';
protected static $pluralObjectNameCc = 'presupuestosManipulado';
protected static $controllerSlug = 'presupuesto-manipulado';
protected static $viewPath = 'themes/backend/vuexy/form/presupuestos/';
protected $indexRoute = 'contactoDeClienteList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
}
public function datatable()
{
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
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);
return $response;
}
$start = $reqData['start'] ?? 0;
$length = $reqData['length'] ?? 5;
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
$order = PresupuestoManipuladosModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$id_P = $reqData['id_presupuesto'] ?? -1;
$resourceData = $this->model->getResource($id_P)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getResource()->countAllResults(),
$this->model->getResource($id_P)->countAllResults()
));
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function datatable_editor() {
if ($this->request->isAJAX()) {
include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php");
// Build our Editor instance and process the data coming from _POST
$response = Editor::inst( $db, 'presupuesto_manipulados' )
->fields(
Field::inst( 'tarifa_manipulado_id' )
->validator( 'Validate::notEmpty',array(
'message' => 'Selecciones servicios de acabado' )
),
Field::inst( 'precio_unidad' )
->validator( 'Validate::notEmpty',array(
'message' => 'Falta precio unitario' )
),
Field::inst( 'precio_total' )
->validator( 'Validate::notEmpty',array(
'message' => 'Falta precio total' )
),
Field::inst( 'presupuesto_id' ),
)
->validator( function($editor, $action, $data){
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT){
//return $response;
/*foreach ($data['data'] as $pkey => $values ){
// No se pueden duplicar valores al crear o al editar
if (!empty($response)){
return $response;
}
}*/
}
})
->debug(true)
->process( $_POST )
->data();
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$response[$csrfTokenName] = $newTokenHash;
echo json_encode($response);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
}

View File

@ -0,0 +1,117 @@
<?php namespace App\Controllers\Presupuestos;
use App\Models\Collection;
use App\Models\Presupuestos\PresupuestoPreimpresionesModel;
use DataTables\Editor;
use DataTables\Editor\Field;
use DataTables\Editor\Validate;
class PresupuestoPreimpresiones extends \App\Controllers\GoBaseResourceController
{
protected $modelName = PresupuestoPreimpresionesModel::class;
protected $format = 'json';
protected static $singularObjectName = 'Presupuesto preimpresion';
protected static $singularObjectNameCc = 'presupuestoPreimpresion';
protected static $pluralObjectName = 'Presupuestos preimpresion';
protected static $pluralObjectNameCc = 'presupuestosPreimpresion';
protected static $controllerSlug = 'presupuesto-preimpresiones';
protected static $viewPath = 'themes/backend/vuexy/form/presupuestos/';
protected $indexRoute = 'contactoDeClienteList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
}
public function datatable()
{
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
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);
return $response;
}
$start = $reqData['start'] ?? 0;
$length = $reqData['length'] ?? 5;
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
$order = PresupuestoPreimpresionesModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$id_P = $reqData['id_presupuesto'] ?? -1;
$resourceData = $this->model->getResource($id_P)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getResource()->countAllResults(),
$this->model->getResource($id_P)->countAllResults()
));
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function datatable_editor() {
if ($this->request->isAJAX()) {
include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php");
// Build our Editor instance and process the data coming from _POST
$response = Editor::inst( $db, 'presupuesto_preimpresiones' )
->fields(
Field::inst( 'tarifa_preimpresion_id' )
->validator( 'Validate::notEmpty',array(
'message' => 'Selecciones servicios de acabado' )
),
Field::inst( 'precio_unidad' )
->validator( 'Validate::notEmpty',array(
'message' => 'Falta precio unitario' )
),
Field::inst( 'precio_total' )
->validator( 'Validate::notEmpty',array(
'message' => 'Falta precio total' )
),
Field::inst( 'presupuesto_id' ),
)
->validator( function($editor, $action, $data){
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT){
//return $response;
/*foreach ($data['data'] as $pkey => $values ){
// No se pueden duplicar valores al crear o al editar
if (!empty($response)){
return $response;
}
}*/
}
})
->debug(true)
->process( $_POST )
->data();
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$response[$csrfTokenName] = $newTokenHash;
echo json_encode($response);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
}

View File

@ -215,19 +215,19 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
// Build our Editor instance and process the data coming from _POST
$response = Editor::inst($db, 'tarifa_encuadernacion_lineas')
->fields(
Field::inst('paginas_min')
Field::inst('paginas_libro_min')
->validator('Validate::numeric', array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_min.decimal'))
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.decimal'))
)
->validator('Validate::notEmpty', array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_min.required'))
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.required'))
),
Field::inst('paginas_max')
Field::inst('paginas_libro_max')
->validator('Validate::numeric', array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_max.decimal'))
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.decimal'))
)
->validator('Validate::notEmpty', array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_max.required'))
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.required'))
),
Field::inst('precio_min')
->validator('Validate::numeric', array(
@ -264,8 +264,8 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
foreach ($data['data'] as $pkey => $values) {
// Si no se quiere borrar...
if ($data['data'][$pkey]['is_deleted'] != 1) {
$process_data['paginas_min'] = $data['data'][$pkey]['paginas_min'];
$process_data['paginas_max'] = $data['data'][$pkey]['paginas_max'];
$process_data['paginas_libro_min'] = $data['data'][$pkey]['paginas_libro_min'];
$process_data['paginas_libro_max'] = $data['data'][$pkey]['paginas_libro_max'];
$response = $this->model->checkIntervals($process_data, $pkey, $data['data'][$pkey]['tirada_encuadernacion_id']);
// No se pueden duplicar valores al crear o al editar
if (!empty($response)) {

View File

@ -1,35 +0,0 @@
<?php
namespace App\Controllers\Tarifas;
use App\Controllers\BaseController;
class Tarifaenvio extends BaseController
{
function __construct()
{
}
public function index()
{
echo 'Tarifa envio';
}
public function delete()
{
}
public function add()
{
}
public function edit()
{
}
}

View File

@ -2,12 +2,14 @@
namespace App\Controllers;
use App\Models\Configuracion\MaquinasCallesModel;
use App\Controllers\BaseController;
use App\Models\Configuracion\MaquinasTarifasImpresionModel;
use App\Models\Configuracion\PapelGenericoModel;
use App\Models\Configuracion\MaquinaModel;
use App\Services\PresupuestoService;
class Test extends BaseController
{
function __construct()
{
@ -15,11 +17,343 @@ class Test extends BaseController
public function index()
{
$model = new MaquinasCallesModel();
$this->testLineasIntPlana();
}
public function getPapelesHQ(){
$model = model('App\Models\Configuracion\PapelGenericoModel');
$data = $model->getPapelForComparador('colorhq', false, false);
var_dump($data);
}
public function getGramaje(){
$model = new PapelGenericoModel();
$data = $model->getGramajeComparador("AHUESADO OFFSET", "bnhq" );
var_dump($data);
}
public function testGetPrecioPliegoRotativa()
{
$paginas=240;
$papel_impresion = (object)array(
'id' => 198,
'gramaje' => 90,
'precio_tonelada'=> 1600
);
$maquina = (object)array(
//'id' => 48,
'alto' => 800,
'ancho' => 520,
);
$precio = PresupuestoService::getPrecioPliego($maquina, $papel_impresion, $paginas);
var_dump($precio);
}
public function testGetMaquinasFromTarifas()
{
$maquinamodel = new MaquinaModel();
//$tarifa_tipo = ['negro', 'color'];
//$tarifa_tipo = 'color';
$tarifa_tipo = 'negro';
$papel_impresion_id = 5;
$maquina = $maquinamodel->getMaquinaImpresionForPresupuesto(1, $tarifa_tipo, 100, $papel_impresion_id);
echo '<pre>';
$resourceData = $model->getResource("", 113)->get()->getResultObject();
var_dump($resourceData);
var_dump($maquina);
echo '</pre>';
}
public static function testLineasIntPlana()
{
$uso = 'interior';
$tipo = 'colorhq';
$datosPedido = (object)array(
'paginas' => 200,
'tirada' => 500,
'merma' => 10,
'merma_portada' => 10,
'ancho' => 165,
'alto' => 148,
'isCosido' => true,
);
$maquina_model = new \App\Models\Configuracion\MaquinaModel();
$opciones_papel = array(
'color' => 1,
'cubierta' => 0,
'sobrecubierta' => 0,
'rotativa' => 0,
);
$papelimpresionmodel = new \App\Models\Configuracion\PapelImpresionModel();
$papeles = $papelimpresionmodel->getIdPapelesImpresionForPresupuesto(
papel_generico_id: 4,
gramaje: 90,
options: $opciones_papel
);
foreach ($papeles as $papel) {
echo '-------------------------------';
$maquinas = $maquina_model->getMaquinaImpresionForPresupuesto(
is_rotativa: $papel->rotativa,
tarifa_tipo: 'colorhq',
tirada: $datosPedido->tirada + $datosPedido->merma,
papel_impresion_id: $papel->id,
);
foreach ($maquinas as $maquina) {
echo '----------------------------<br>';
var_dump($maquina->maquina);
var_dump($papel->nombre);
$tarifa = (new \App\Models\Configuracion\MaquinasTarifasImpresionModel())->getTarifa($maquina->maquina_id, $uso, $tipo);
$linea = PresupuestoService::getCostesLinea($uso, $datosPedido, $maquina, $papel, $opciones_papel, $tarifa);
echo '<pre>';
var_dump($linea);
echo '</pre>';
}
}
}
public static function testLineasIntPlanaCubierta()
{
echo '<pre>';
$uso = 'cubierta';
$tipo = 'color';
$datosPedido = (object)array(
'paginas' => 200,
'tirada' => 500,
'merma' => 10,
'merma_portada' => 10,
'ancho' => 165,
'alto' => 148,
'isCosido' => true,
'solapas' => 0,
'solapas_ancho' => 0,
);
$maquina_model = new \App\Models\Configuracion\MaquinaModel();
$opciones_papel = array(
'color' => 1,
'cubierta' => 1,
'sobrecubierta' => 0,
'rotativa' => 0,
);
$papelimpresionmodel = new \App\Models\Configuracion\PapelImpresionModel();
$papeles = $papelimpresionmodel->getIdPapelesImpresionForPresupuesto(
papel_generico_id: 3,
gramaje: 100,
options: $opciones_papel
);
foreach ($papeles as $papel) {
echo '-------------------------------';
var_dump($papel);
$maquinas = $maquina_model->getMaquinaImpresionForPresupuesto(
is_rotativa: $papel->rotativa,
tarifa_tipo: 'color',
tirada: $datosPedido->tirada + $datosPedido->merma_portada,
papel_impresion_id: $papel->id,
);
foreach ($maquinas as $maquina) {
echo '----------------------------<br>';
var_dump($maquina->maquina);
var_dump($papel->nombre);
$tarifa = (new \App\Models\Configuracion\MaquinasTarifasImpresionModel())->getTarifa($maquina->maquina_id, $uso, $tipo);
$linea = PresupuestoService::getCostesLinea($uso, $datosPedido, $maquina, $papel, $opciones_papel, $tarifa);
var_dump($linea);
}
}
echo '</pre>';
}
public static function testLineasIntRotativa()
{
$uso = 'interior';
$tipo = 'negro';
$datosPedido = (object)array(
'paginas' => 240,
'tirada' => 100,
'merma' => 10,
'merma_portada' => 10,
'ancho' => 150,
'alto' => 210,
'isCosido' => true,
);
$parametrosRotativa = (object)array(
'a_favor_fibra' => 0,
'bnPages' => 240,
'colorPages' => 0,
'rotativa_gota_negro' => 0,
'rotativa_gota_color' => 0,
);
$maquina_model = new \App\Models\Configuracion\MaquinaModel();
$opciones_papel = array(
'bn' => 1,
'cubierta' => 0,
'sobrecubierta' => 0,
'rotativa' => 1,
);
$papelimpresionmodel = new \App\Models\Configuracion\PapelImpresionModel();
$papeles = $papelimpresionmodel->getIdPapelesImpresionForPresupuesto(
papel_generico_id: 4,
gramaje: 90,
options: $opciones_papel
);
foreach ($papeles as $papel) {
$papelImpresionTipologiaModel = new \App\Models\Configuracion\PapelImpresionTipologiaModel();
$datosTipologias = $papelImpresionTipologiaModel
->findTipologiasForPapelImpresion($papel->id, $parametrosRotativa->colorPages>0?'color':'negro')
->get()->getResultObject();
echo '<pre>';
var_dump($papel->id);
var_dump($datosTipologias);
echo '</pre>';
$parametrosRotativa->rotativa_gota_negro = $datosTipologias[0]->gota_negro;
$parametrosRotativa->rotativa_gota_color = $datosTipologias[0]->gota_color;
$parametrosRotativa->rotativa_negro = $datosTipologias[0]->negro;
$parametrosRotativa->rotativa_cyan = $datosTipologias[0]->cyan;
$parametrosRotativa->rotativa_magenta = $datosTipologias[0]->magenta;
$parametrosRotativa->rotativa_amarillo = $datosTipologias[0]->amarillo;
echo '-------------------------------';
$maquinas = $maquina_model->getMaquinaImpresionForPresupuesto(
is_rotativa: $papel->rotativa,
tarifa_tipo: 'negro',
tirada: $datosPedido->tirada + $datosPedido->merma,
papel_impresion_id: $papel->id,
);
foreach ($maquinas as $maquina) {
echo '----------------------------<br>';
var_dump($maquina->maquina);
var_dump($papel->nombre);
//$linea = PresupuestoService::getCostesLineaRotativa($maquina, $datosPedido, $parametrosRotativa);
echo '<pre>';
var_dump($linea);
echo '</pre>';
}
}
}
public static function testLineasCubierta()
{
$uso = 'cubierta';
$tipo = 'color';
$datosPedido = (object)array(
'paginas' => 240,
'tirada' => 100,
'merma' => 10,
'merma_portada' => 10,
'ancho' => 150,
'alto' => 210,
'isCosido' => true,
'solapas' => false,
);
$opciones_papel = array(
'color' => 1,
'cubierta' => 1,
);
// Se obtienen los papeles disponibles
$papelimpresionmodel = new \App\Models\Configuracion\PapelImpresionModel();
$papeles = $papelimpresionmodel->getIdPapelesImpresionForPresupuesto(
papel_generico_id: 3, // Blanco offset
gramaje: 100,
options: $opciones_papel
);
echo '<pre>';
var_dump($papeles);
echo '</pre>';
$lineas = array();
// Para cada papel, se obtienen las maquinas disponibles
foreach ($papeles as $papel) {
$maquinamodel = new \App\Models\Configuracion\MaquinaModel();
$maquinas = $maquinamodel->getMaquinaImpresionForPresupuesto(
is_rotativa: 0,
tarifa_tipo: $tipo,
tirada: $datosPedido->tirada + $datosPedido->merma,
papel_impresion_id: $papel->id,
);
echo '<pre>';
echo '-------------------------------';
echo '</pre>';
echo '<pre>';
var_dump($maquinas);
echo '</pre>';
// Se recorren las máquinas y se calcula el coste de linea por cada una
foreach ($maquinas as $maquina) {
echo '<pre>';
echo '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$';
echo '</pre>';
$tarifamodel = new \App\Models\Configuracion\MaquinasTarifasImpresionModel();
$tarifa = $tarifamodel->getTarifa($maquina->maquina_id, $uso, $tipo);
echo '<pre>';
var_dump($tarifa);
echo '</pre>';
if(!is_float($tarifa)){
continue;
}
$linea = PresupuestoService::getCostesLinea($uso, $datosPedido, $maquina, $papel, $opciones_papel, $tarifa);
$linea['fields']['maquina'] = $maquina->maquina;
$linea['fields']['maquina_id'] = $maquina->maquina_id;
$linea['fields']['papel_impresion'] = $papel->nombre;
$linea['fields']['papel_impresion_id'] = $papel->id;
$linea['fields']['paginas'] = $datosPedido->paginas;
$linea['fields']['gramaje'] = 100;
$linea['fields']['papel_generico_id'] = 3;
$linea['fields']['papel_generico'] = 'Blanco offset';
array_push($lineas, $linea);
}
}
echo '<pre>';
var_dump($lineas);
echo '</pre>';
}
}

View File

@ -1,15 +0,0 @@
<?php
namespace App\Entities\Configuracion;
use CodeIgniter\Entity;
class FormasPagoEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"nombre" => null,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [];
}

View File

@ -28,8 +28,8 @@ class Maquina extends \CodeIgniter\Entity\Entity
"velocidad_corte" => 0.0,
"precio_hora_corte" => 0.0,
"metrosxminuto" => 0.0,
"forzar_num_formas_horizontales_portada" => null,
"forzar_num_formas_verticales_portada" => null,
"forzar_num_formas_horizontales_cubierta" => null,
"forzar_num_formas_verticales_cubierta" => null,
"observaciones" => "",
"is_deleted" => 0,
"created_at" => null,
@ -56,8 +56,8 @@ class Maquina extends \CodeIgniter\Entity\Entity
"precio_tinta_color" => "float",
"velocidad_corte" => "float",
"precio_hora_corte" => "float",
"forzar_num_formas_horizontales_portada" => "?int",
"forzar_num_formas_verticales_portada" => "?int",
"forzar_num_formas_horizontales_cubierta" => "?int",
"forzar_num_formas_verticales_cubierta" => "?int",
"is_deleted" => "int",
"user_created_id" => "int",
"user_updated_id" => "int",

View File

@ -8,8 +8,7 @@ class MaquinasCallesEntity extends \CodeIgniter\Entity\Entity
protected $attributes = [
"id" => null,
"maquina_id" => null,
"formas_min" => null,
"formas_max" => null,
"formas" => null,
"internas" => 3.32,
"externas" => 1.66,
"user_created_id" => 0,
@ -20,8 +19,7 @@ class MaquinasCallesEntity extends \CodeIgniter\Entity\Entity
];
protected $casts = [
"maquina_id" => "int",
"formas_min" => "int",
"formas_max" => "int",
"formas" => "int",
"internas" => "float",
"externas" => "float",
"user_created_id" => "int",

View File

@ -0,0 +1,23 @@
<?php
namespace App\Entities\Presupuestos;
use CodeIgniter\Entity;
class PresupuestoAcabadosEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"presupuesto_id" => null,
"tarifa_acabado_id" => null,
"precio_unidad" => null,
"precio_total" => null,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [
"presupuesto_id" => "int",
"tarifa_acabado_id" => "int",
"precio_unidad" => "float",
"precio_total" => "float",
];
}

View File

@ -0,0 +1,23 @@
<?php
namespace App\Entities\Presupuestos;
use CodeIgniter\Entity;
class PresupuestoEncuadernacionesEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"presupuesto_id" => null,
"tarifa_encuadernado_id" => null,
"precio_unidad" => null,
"precio_total" => null,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [
"presupuesto_id" => "int",
"tarifa_encuadernado_id" => "int",
"precio_unidad" => "float",
"precio_total" => "float",
];
}

View File

@ -50,10 +50,11 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
"merma" => null,
"merma_portada" => 6.0,
"imagenes_bn_interior" => false,
"comentarios" => null,
"comentarios_cliente" => null,
"comentarios_safekat" => null,
"comentarios_pdf" => null,
"comentarios_tarifa" => null,
"comentarios_produccion" => null,
"en_produccion" => false,
"en_espera" => false,
"modo_comparador" => false,

View File

@ -0,0 +1,23 @@
<?php
namespace App\Entities\Presupuestos;
use CodeIgniter\Entity;
class PresupuestoManipuladosEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"presupuesto_id" => null,
"tarifa_manipulado_id" => null,
"precio_unidad" => null,
"precio_total" => null,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [
"presupuesto_id" => "int",
"tarifa_manipulado_id" => "int",
"precio_unidad" => "float",
"precio_total" => "float",
];
}

View File

@ -0,0 +1,23 @@
<?php
namespace App\Entities\Presupuestos;
use CodeIgniter\Entity;
class PresupuestoPreimpresionesEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"presupuesto_id" => null,
"tarifa_preimpresion_id" => null,
"precio_unidad" => null,
"precio_total" => null,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [
"presupuesto_id" => "int",
"tarifa_preimpresion_id" => "int",
"precio_unidad" => "float",
"precio_total" => "float",
];
}

View File

@ -8,10 +8,13 @@ class TarifaEncuadernacionLinea extends \CodeIgniter\Entity\Entity
protected $attributes = [
"id" => null,
"tirada_encuadernacion_id" => 0,
"paginas_min" => 0,
"paginas_max" => 0,
"paginas_libro_min" => 0,
"paginas_libro_max" => 0,
"dimensiones_id" => 0,
"precio_min" => 0,
"precio_max" => 0,
"tirada_min" => 0,
"tirada_max" => 0,
"margen" => 0,
"user_created_id" => 0,
"user_updated_id" => 0,
@ -21,10 +24,13 @@ class TarifaEncuadernacionLinea extends \CodeIgniter\Entity\Entity
];
protected $casts = [
"tirada_encuadernacion_id" => "int",
"paginas_min" => "float",
"paginas_max" => "float",
"dimensiones_id" => "int",
"paginas_libro_min" => "float",
"paginas_libro_max" => "float",
"precio_min" => "float",
"precio_max" => "float",
"tirada_min" => "float",
"tirada_max" => "float",
"margen" => "float",
"user_created_id" => "int",
"user_updated_id" => "int",

View File

@ -12,6 +12,8 @@ return [
'Close' => 'Close',
'Dashboard' => 'Dashboard',
'Delete' => 'Delete',
'Clone' => 'Clone',
'Print' => 'Print',
'Error' => 'Error',
'Groups' => 'Groups',
'Home' => 'Home',

View File

@ -54,12 +54,12 @@ return [
'greater_than' => 'The field {field} must be greater than {param}',
],
'forzar_num_formas_horizontales_portada' => [
'forzar_num_formas_horizontales_cubierta' => [
'integer' => 'The {field} field must contain an integer.',
],
'forzar_num_formas_verticales_portada' => [
'forzar_num_formas_verticales_cubierta' => [
'integer' => 'The {field} field must contain an integer.',
],

View File

@ -6,20 +6,12 @@ return [
'id' => 'ID',
'moduleTitle' => 'Streets config',
'deleteLine' => 'the selected register',
'formas_min' => 'Shapes mín.',
'formas_max' => 'Shapes max.',
'formas' => 'Shapes',
'internas' => 'Internal streets',
'externas' => 'External streets',
'validation' => [
'error_calle_overlap' => 'The range [Shapes mín, Shapes max] is overlapped with another one.',
'error_calle_range' => 'The field Shapes min. must be lower than the field Shapes max.',
'formas_min' => [
'integer' => 'Must be a integer number.',
'required' => 'Required.',
],
'formas_max' => [
'error_formas_exists' => 'The shape value for another line already exists',
'formas' => [
'integer' => 'Must be a integer number.',
'required' => 'Required.',

View File

@ -10,6 +10,7 @@ return [
'datosPresupuesto' => 'Budget information',
'datosLibro' => 'Book information',
'datosServicios' => 'Other Services',
'datosPresupuestoCliente' => 'Client budget data (comparator)',
'id' => 'Budget Number',
@ -45,7 +46,7 @@ return [
'recogerEnTaller' => 'Pick up in workshop',
'marcapaginas' => 'Bookmark',
'merma' => 'Weakening',
'mermaportada' => 'Cover weakening',
'mermacubierta' => 'Cover weakening',
'tipoImpresion' => 'Printing type',
'papelesComparadorCosidoTapaBlanda' => 'Interior and cover papers',
'posicionPagColor' => 'Color pages position',
@ -58,6 +59,27 @@ return [
'retractilado5' => 'Shrink-wrapping in packs of 5',
'Guardas' => 'Endpapers',
'fajaColor' => 'Print color band ',
'compInteriorPlana' => 'Interior in flat machine',
'compInteriorRotativa' => 'Interior in rotary',
'compCubiertaSobrecubierta' => 'Cover and dust jacket',
'tipo' => 'Type',
'marca' => 'Brand',
'maquina' => 'Machine',
'numeroPliegos' => 'Sheets No.',
'pliegosPedido' => 'Sheets order',
'precioPliego' => 'Sheets price',
'libro' => 'Book',
'totalPapelPedido' => 'Total paper order',
'lomo' => 'Spine',
'peso' => 'Weight',
'click' => 'Click',
'totalClicks' => 'Total clicks',
'precioPagNegro' => 'Pages black price',
'precioPagColor' => 'Pages color price',
'totalTinta' => 'Total ink',
'totalCorte' => 'Total cut',
'total' => 'Total',
'aFavorFibra' => 'In fiber direction',
'cubierta' => 'Cover',
'sobrecubierta' => 'Dust jacket',
'encuadernacion' => 'Binding',
@ -65,6 +87,55 @@ return [
'solapasAnchoCubierta' => 'Cover dust jacket width',
'1cara' => '1 side',
'2caras' => '2 sides',
'bn' => 'BW',
'bnhq' => 'BWHQ',
'color' => 'Colour',
'colorhq' => 'ColourHQ',
'rotativa' => 'Rotary',
'si' => 'Yes',
'no' => 'No',
'insertarLinea' => 'Insert Line',
'plana' => 'flat',
'rotativa' => 'rotary',
'lineasPresupuesto' => 'Budget Lines',
'tiempo' => 'Time',
'porDefecto' => 'Deafult',
'tipoImpresion' => 'Print',
'numPagColor' => 'No Color Pages',
'saturacion' => 'Saturation',
'cobNegro' => 'Cov. % Black',
'cobCyan' => 'Cov. % Cyan',
'cobMagenta' => 'Cov. % Magenta',
'cobAmarillo' => 'Cov. % Yellow',
'gotaNegro' => 'Black drop',
'gotaColor' => 'Color drop',
'totalLinea' => 'TOTAL LINE',
'verCalculos' => 'Calculations',
'metrosMinuto' => 'Meters x min.',
'resolucion' => 'Resolution (dpi)',
'areaPaginas' => 'Pages area (in)',
'gotasNegro' => 'No black drops',
'gotasCyan' => 'No color drops',
'gotasMagenta' => 'No magenta drops',
'gotasAmarillo' => 'No yellow drops',
'precioPagNegro' => 'Price black pages',
'precioPagColor' => 'Price color pages',
'factorAltura' => 'Height factor',
'factorAnchura' => 'Width factor',
'paginasPliego' => 'Pages/sheet',
'metrosPapelLibro' => 'M. Paper Book',
'metrosPapelTotal' => 'M. Paper Total',
'clicksLibro' => 'Clicks/Book',
'gTintaNegro' => 'G. Black Ink',
'gTintaCyan' => 'G. Cyan Ink',
'gTintaMagenta' => 'G. Magenta Ink',
'gTintaAmarillo' => 'G. Yellow Ink',
'clicksPedido' => 'Clicks Order',
'totalClicks' => 'Total Clicks',
'totalTinta' => 'Total Ink',
'totalCorte' => 'Total Cut',
'totalImpresion' => 'TOTAL PRINT',
/* '4x0' => '4x0',
'4x4' => '4x4',

View File

@ -745,7 +745,6 @@ return [
"menu_libros_fresasdo_tapa_blanda" => "Fresado tapa blanda",
"menu_libros_cosido_tapa_dura" => "Cosidos tapa dura",
"menu_libros_cosido_tapa_blanda" => "Cosidos tapa blanda",
"menu_libros_cosido_tapa_blanda_solapas" => "Cosidos tapa blanda con solapas",
"menu_libros_grapados" => "Grapados",
"menu_libros_espiral_tapa_dura" => "Espiral tapa dura",
"menu_libros_espiral_tapa_blanda" => "Espiral tapa blanda",

View File

@ -14,6 +14,8 @@ return [
'Clone' => 'Duplicar',
'Dashboard' => 'Panel de control',
'Delete' => 'Borrar',
'Clone' => 'Duplicar',
'Print' => 'Imprimir',
'Error' => 'Error',
'Groups' => 'Grupos',
'Home' => 'Inicio',

View File

@ -12,8 +12,8 @@ return [
'createdAt' => 'Created At',
'deletedAt' => 'Deleted At',
'duracionJornada' => 'Duracion Jornada',
'forzarNumFormasHorizontalesPortada' => 'Forzar Num Formas Horizontales Portada',
'forzarNumFormasVerticalesPortada' => 'Forzar Num Formas Verticales Portada',
'forzarNumFormasHorizontalesPortada' => 'Forzar Num Formas Horizontales Cubierta',
'forzarNumFormasVerticalesPortada' => 'Forzar Num Formas Verticales Cubierta',
'id' => 'ID',
'impresion' => 'impresion',
'isDeleted' => 'Is Deleted',
@ -54,12 +54,12 @@ return [
'greater_than' => 'El campo {field} debe ser mayor que {param}',
],
'forzar_num_formas_horizontales_portada' => [
'forzar_num_formas_horizontales_cubierta' => [
'integer' => 'El campo {field} debe contener un número entero.',
],
'forzar_num_formas_verticales_portada' => [
'forzar_num_formas_verticales_cubierta' => [
'integer' => 'El campo {field} debe contener un número entero.',
],

View File

@ -6,20 +6,12 @@ return [
'id' => 'ID',
'moduleTitle' => 'Configuración Calles',
'deleteLine' => 'el registro seleccionado',
'formas_min' => 'Formas mín.',
'formas_max' => 'Formas max.',
'formas' => 'Formas',
'internas' => 'Calles internas',
'externas' => 'Calles externas',
'validation' => [
'error_calle_overlap' => 'El rango [Formas mín, Formas max] se solapa con otro existente para el tipo seleccionado.',
'error_calle_range' => 'El campo Formas mín. debe ser menor que el campo Formas max.',
'formas_min' => [
'integer' => 'Debe contener un número entero.',
'required' => 'Requerido.',
],
'formas_max' => [
'error_formas_exists' => 'Ya existe el valor de forma para otra línea',
'formas' => [
'integer' => 'Debe contener un número entero.',
'required' => 'Requerido.',

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,8 @@ return [
'deleteLine' => 'el registro seleccionado',
'precioMax' => 'Precio Max',
'precioMin' => 'Precio Min',
'tiradaMax' => 'Tirada Max',
'tiradaMin' => 'Tirada Min',
'precioUnidad' => 'Precio Unidad',
'paginasMax' => 'Páginas Max',
'paginasMin' => 'Páginas Min',
@ -19,23 +21,26 @@ return [
'error_paginas_range' => 'El campo Páginas Min debe ser menor que el campo Páginas Max',
'precio_max' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
'required' => 'The {field} field is required.',
'required' => 'El campo {field} es obligatorio.',
],
'precio_min' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
'required' => 'The {field} field is required.',
'required' => 'El campo {field} es obligatorio.',
],
'paginas_max' => [
'tirada_max' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
'required' => 'El campo {field} es obligatorio.',
],
'tirada_min' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
'required' => 'El campo {field} es obligatorio.',
],
'paginas_libro_max' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
'required' => 'The {field} field is required.',
],
'paginas_min' => [
'paginas_libro_min' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
'required' => 'The {field} field is required.',

View File

@ -12,7 +12,7 @@ return [
'precioMin' => 'Precio Mínimo',
'importeFijo' => 'Importe Fijo',
'mostrar_en_presupuesto' => 'Mostrar en presupuesto',
'tarifaacabado' => 'Tarifas Acabado',
'tarifaacabado' => 'Tarifa Acabado',
'tarifaacabadoList' => 'Lista Tarifas Acabado',
'tarifasacabado' => 'Tarifas Acabado',
'updatedAt' => 'Actualizado en',

View File

@ -1,33 +0,0 @@
<?php
namespace App\Models\Configuracion;
class FormasPagoModel extends \App\Models\GoBaseModel
{
protected $table = "lg_formas_pago";
/**
* Whether primary key uses auto increment.
*
* @var bool
*/
protected $useAutoIncrement = true;
protected $allowedFields = ["nombre"];
protected $returnType = "App\Entities\Configuracion\FormasPagoEntity";
public static $labelField = "nombre";
protected $validationRules = [
"nombre" => [
"label" => "FormasPagoes.nombre",
"rules" => "trim|required|max_length[255]",
],
];
protected $validationMessages = [
"nombre" => [
"max_length" => "FormasPagoes.validation.nombre.max_length",
"required" => "FormasPagoes.validation.nombre.required",
],
];
}

View File

@ -1,4 +1,5 @@
<?php
namespace App\Models\Configuracion;
class MaquinaModel extends \App\Models\GoBaseModel
@ -26,8 +27,8 @@ class MaquinaModel extends \App\Models\GoBaseModel
9 => "t1.orden_planning",
10 => "t1.min",
11 => "t1.max",
];
protected $allowedFields = [
@ -52,8 +53,8 @@ class MaquinaModel extends \App\Models\GoBaseModel
"velocidad_corte",
"precio_hora_corte",
"metrosxminuto",
"forzar_num_formas_horizontales_portada",
"forzar_num_formas_verticales_portada",
"forzar_num_formas_horizontales_cubierta",
"forzar_num_formas_verticales_cubierta",
"observaciones",
"deleted_at",
"is_deleted",
@ -94,11 +95,11 @@ class MaquinaModel extends \App\Models\GoBaseModel
"label" => "Maquinas.duracionJornada",
"rules" => "required|integer",
],
"forzar_num_formas_horizontales_portada" => [
"forzar_num_formas_horizontales_cubierta" => [
"label" => "Maquinas.forzarNumFormasHorizontalesPortada",
"rules" => "integer|permit_empty",
],
"forzar_num_formas_verticales_portada" => [
"forzar_num_formas_verticales_cubierta" => [
"label" => "Maquinas.forzarNumFormasVerticalesPortada",
"rules" => "integer|permit_empty",
],
@ -175,11 +176,11 @@ class MaquinaModel extends \App\Models\GoBaseModel
"integer" => "Maquinas.validation.duracion_jornada.integer",
"required" => "Maquinas.validation.duracion_jornada.required",
],
"forzar_num_formas_horizontales_portada" => [
"integer" => "Maquinas.validation.forzar_num_formas_horizontales_portada.integer",
"forzar_num_formas_horizontales_cubierta" => [
"integer" => "Maquinas.validation.forzar_num_formas_horizontales_cubierta.integer",
],
"forzar_num_formas_verticales_portada" => [
"integer" => "Maquinas.validation.forzar_num_formas_verticales_portada.integer",
"forzar_num_formas_verticales_cubierta" => [
"integer" => "Maquinas.validation.forzar_num_formas_verticales_cubierta.integer",
],
"max" => [
"integer" => "Maquinas.validation.max.integer",
@ -252,14 +253,15 @@ class MaquinaModel extends \App\Models\GoBaseModel
return $result;
}
public function getIdMaquinasForPapelImpresion($papel_impresion_id, $rotativa){
public function getIdMaquinasForPapelImpresion($papel_impresion_id, $rotativa)
{
$builder = $this->db
->table($this->table . " t1")
->select(
"'".$papel_impresion_id."'". " as papel_impresion_id, t1.id AS maquina_id, '0' as active"
);
"'" . $papel_impresion_id . "'" . " as papel_impresion_id, t1.id AS maquina_id, '0' as active"
);
$builder->where("t1.is_rotativa", $rotativa);
return $builder;
}
@ -275,62 +277,107 @@ class MaquinaModel extends \App\Models\GoBaseModel
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.nombre AS nombre, t1.is_padre AS is_padre, t1.tipo AS tipo, t1.velocidad AS velocidad, t1.ancho AS ancho, t1.alto AS alto, t1.ancho_impresion AS ancho_impresion, t1.alto_impresion AS alto_impresion, t1.alto_click AS alto_click, t1.min AS min, t1.max AS max, t1.duracion_jornada AS duracion_jornada, t1.orden_planning AS orden_planning, t1.is_rotativa AS is_rotativa, t1.precio_tinta_negro AS precio_tinta_negro, t1.is_tinta AS is_tinta, t1.precio_tinta_color AS precio_tinta_color, t1.velocidad_corte AS velocidad_corte, t1.precio_hora_corte AS precio_hora_corte, t1.metrosxminuto AS metrosxminuto, t1.forzar_num_formas_horizontales_portada AS forzar_num_formas_horizontales_portada, t1.forzar_num_formas_verticales_portada AS forzar_num_formas_verticales_portada, t1.observaciones AS observaciones, t2.nombre AS padre"
"t1.id AS id, t1.nombre AS nombre, t1.is_padre AS is_padre, t1.tipo AS tipo, t1.velocidad AS velocidad, t1.ancho AS ancho, t1.alto AS alto, t1.ancho_impresion AS ancho_impresion, t1.alto_impresion AS alto_impresion, t1.alto_click AS alto_click, t1.min AS min, t1.max AS max, t1.duracion_jornada AS duracion_jornada, t1.orden_planning AS orden_planning, t1.is_rotativa AS is_rotativa, t1.precio_tinta_negro AS precio_tinta_negro, t1.is_tinta AS is_tinta, t1.precio_tinta_color AS precio_tinta_color, t1.velocidad_corte AS velocidad_corte, t1.precio_hora_corte AS precio_hora_corte, t1.metrosxminuto AS metrosxminuto, t1.forzar_num_formas_horizontales_cubierta AS forzar_num_formas_horizontales_cubierta, t1.forzar_num_formas_verticales_cubierta AS forzar_num_formas_verticales_cubierta, t1.observaciones AS observaciones, t2.nombre AS padre"
);
$builder->join("lg_maquinas t2", "t1.padre_id = t2.id", "left");
//JJO
$builder->where("t1.is_deleted", 0);
$builder->where("t1.is_deleted", 0);
return empty($search)
? $builder
: $builder
->groupStart()
->like("t1.id", $search)
->orLike("t1.nombre", $search)
->orLike("t1.tipo", $search)
->orLike("t1.velocidad", $search)
->orLike("t1.ancho", $search)
->orLike("t1.alto", $search)
->orLike("t1.ancho_impresion", $search)
->orLike("t1.alto_impresion", $search)
->orLike("t1.alto_click", $search)
->orLike("t1.min", $search)
->orLike("t1.max", $search)
->orLike("t1.duracion_jornada", $search)
->orLike("t1.orden_planning", $search)
->orLike("t1.precio_tinta_negro", $search)
->orLike("t1.precio_tinta_color", $search)
->orLike("t1.velocidad_corte", $search)
->orLike("t1.precio_hora_corte", $search)
->orLike("t1.metrosxminuto", $search)
->orLike("t1.forzar_num_formas_horizontales_portada", $search)
->orLike("t1.forzar_num_formas_verticales_portada", $search)
->orLike("t1.observaciones", $search)
->orLike("t2.id", $search)
->orLike("t1.id", $search)
->orLike("t1.nombre", $search)
->orLike("t1.tipo", $search)
->orLike("t1.velocidad", $search)
->orLike("t1.ancho", $search)
->orLike("t1.alto", $search)
->orLike("t1.ancho_impresion", $search)
->orLike("t1.alto_impresion", $search)
->orLike("t1.alto_click", $search)
->orLike("t1.padre_id", $search)
->orLike("t1.min", $search)
->orLike("t1.max", $search)
->orLike("t1.duracion_jornada", $search)
->orLike("t1.orden_planning", $search)
->orLike("t1.precio_tinta_negro", $search)
->orLike("t1.precio_tinta_color", $search)
->orLike("t1.velocidad_corte", $search)
->orLike("t1.precio_hora_corte", $search)
->orLike("t1.metrosxminuto", $search)
->orLike("t1.forzar_num_formas_horizontales_portada", $search)
->orLike("t1.forzar_num_formas_verticales_portada", $search)
->orLike("t1.observaciones", $search)
->orLike("t2.nombre", $search)
->groupEnd();
->groupStart()
->like("t1.id", $search)
->orLike("t1.nombre", $search)
->orLike("t1.tipo", $search)
->orLike("t1.velocidad", $search)
->orLike("t1.ancho", $search)
->orLike("t1.alto", $search)
->orLike("t1.ancho_impresion", $search)
->orLike("t1.alto_impresion", $search)
->orLike("t1.alto_click", $search)
->orLike("t1.min", $search)
->orLike("t1.max", $search)
->orLike("t1.duracion_jornada", $search)
->orLike("t1.orden_planning", $search)
->orLike("t1.precio_tinta_negro", $search)
->orLike("t1.precio_tinta_color", $search)
->orLike("t1.velocidad_corte", $search)
->orLike("t1.precio_hora_corte", $search)
->orLike("t1.metrosxminuto", $search)
->orLike("t1.forzar_num_formas_horizontales_cubierta", $search)
->orLike("t1.forzar_num_formas_verticales_cubierta", $search)
->orLike("t1.observaciones", $search)
->orLike("t2.id", $search)
->orLike("t1.id", $search)
->orLike("t1.nombre", $search)
->orLike("t1.tipo", $search)
->orLike("t1.velocidad", $search)
->orLike("t1.ancho", $search)
->orLike("t1.alto", $search)
->orLike("t1.ancho_impresion", $search)
->orLike("t1.alto_impresion", $search)
->orLike("t1.alto_click", $search)
->orLike("t1.padre_id", $search)
->orLike("t1.min", $search)
->orLike("t1.max", $search)
->orLike("t1.duracion_jornada", $search)
->orLike("t1.orden_planning", $search)
->orLike("t1.precio_tinta_negro", $search)
->orLike("t1.precio_tinta_color", $search)
->orLike("t1.velocidad_corte", $search)
->orLike("t1.precio_hora_corte", $search)
->orLike("t1.metrosxminuto", $search)
->orLike("t1.forzar_num_formas_horizontales_cubierta", $search)
->orLike("t1.forzar_num_formas_verticales_cubierta", $search)
->orLike("t1.observaciones", $search)
->orLike("t2.nombre", $search)
->groupEnd();
}
public function getMaquinaImpresionForPresupuesto($is_rotativa, $tarifa_tipo, $tirada, $papel_impresion_id = -1)
{
/*
1.-> tarifa_Tipo impresion
2.-> Maquina
3.-> Papeles impresion asociados a esa maquina
4.-> papeles genericos que aparecen en esos papeles impresion
*/
$builder = $this->db
->table($this->table . " t1")
->distinct('t1.id')
->select(
"t1.id AS maquina_id, t1.nombre AS maquina, t1.ancho_impresion AS ancho_impresion,
t1.alto_impresion AS alto_impresion, t1.ancho AS ancho, t1.alto AS alto,
t1.is_rotativa AS is rotativa, t1.alto_click AS alto_click, t1.velocidad AS velocidad,
t1.precio_tinta_negro AS precio_tinta_negro, t1.precio_tinta_color AS precio_tinta_color,
t1.velocidad_corte AS velocidad_corte, t1.precio_hora_corte AS precio_hora_corte,
t1.forzar_num_formas_horizontales_cubierta AS forzar_num_formas_horizontales_cubierta,
t1.forzar_num_formas_verticales_cubierta AS forzar_num_formas_verticales_cubierta"
)
->join("lg_maquinas_tarifas_impresion t2", "t1.id = t2.maquina_id", "left")
->join("lg_maquina_papel_impresion t3", "t1.id = t3.maquina_id", "left")
->where("t1.is_deleted", 0)
->where("t1.tipo", "impresion")
->where("t1.is_rotativa", $is_rotativa)
->where("t2.is_deleted", 0)
->where("t3.papel_impresion_id", $papel_impresion_id)
->where("t3.active", 1)
->where("t1.min <=", $tirada)
->where("t1.max >=", $tirada);
if(is_array($tarifa_tipo)){
foreach($tarifa_tipo as $tarifa){
$builder->where("EXISTS (SELECT * FROM lg_maquinas_tarifas_impresion t2 WHERE t1.id=t2.maquina_id AND t2.tipo='{$tarifa}' AND t2.is_deleted=0)");
}
}
else{
$builder->where("t2.tipo", $tarifa_tipo);
}
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
}
}

View File

@ -13,16 +13,14 @@ class MaquinasCallesModel extends \App\Models\GoBaseModel
protected $useAutoIncrement = true;
const SORTABLE = [
0 => "t1.formas_min",
1 => "t1.formas_max",
2 => "t1.internas",
3 => "t1.externas",
0 => "t1.formas",
1 => "t1.internas",
2 => "t1.externas",
];
protected $allowedFields = [
"maquina_id",
"formas_min",
"formas_max",
"formas",
"internas",
"externas",
"user_created_id",
@ -43,10 +41,7 @@ class MaquinasCallesModel extends \App\Models\GoBaseModel
public static $labelField = "maquina_id";
protected $validationRules = [
"formas_min" => [
"rules" => "required|int",
],
"formas_max" => [
"formas" => [
"rules" => "required|int",
],
"internas" => [
@ -70,8 +65,8 @@ class MaquinasCallesModel extends \App\Models\GoBaseModel
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.maquina_id as maquina, t1.formas_min AS formas_min,
t1.formas_max AS formas_max, t1.internas AS internas, t1.externas AS externas,"
"t1.id AS id, t1.maquina_id as maquina, t1.formas AS formas,
t1.internas AS internas, t1.externas AS externas,"
);
//JJO
@ -82,29 +77,39 @@ class MaquinasCallesModel extends \App\Models\GoBaseModel
? $builder
: $builder
->groupStart()
->like("t1.formas_min", $search)
->orLike("t1.formas_max", $search)
->like("t1.formas", $search)
->orLike("t1.internas", $search)
->orLike("t1.externas", $search)
->orLike("t1.formas_min", $search)
->orLike("t1.formas_max", $search)
->orLike("t1.formas", $search)
->orLike("t1.internas", $search)
->orLike("t1.externas", $search)
->groupEnd();
}
public function checkIntervals($data = [], $id = null){
public function getCallesForMaquina($maquina_id=-1, $num_formas = 0)
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.formas AS formas,
t1.internas AS internas, t1.externas AS externas,"
);
//JJO
$builder->where('t1.maquina_id', $maquina_id);
$builder->where('t1.formas', $num_formas);
$builder->where("t1.is_deleted", 0);
return $builder->get()->getResultObject();
}
public function checkDuplicatedFormas($data = [], $id = null){
helper('general');
if(floatval($data["formas_min"])>= floatval($data["formas_max"])){
return lang('MaquinasCalles.validation.error_calle_range');
}
$rows = $this->db
->table($this->table)
->select("id, formas_min, formas_max")
->select("id, formas")
->where("is_deleted", 0)
->where("maquina_id", $data['maquina_id'])
->get()->getResultObject();
@ -116,9 +121,8 @@ class MaquinasCallesModel extends \App\Models\GoBaseModel
continue;
}
}
if(check_overlap(floatval($data["formas_min"]), floatval($data["formas_max"]),
$row->formas_min, $row->formas_max)){
return lang('MaquinasCalles.validation.error_calle_overlap');
if(intval($data["formas"]) == $row->formas){
return lang('MaquinasCalles.validation.error_formas_exists');
}
}
}

View File

@ -29,6 +29,11 @@ class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
const SORTABLE_2 = [
0 => "t1.active",
1 => "t2.nombre",
2 => "t2.ancho",
3 => "t2.alto",
4 => "t2.ancho_impresion",
5 => "t2.alto_impresion",
];

View File

@ -1,4 +1,5 @@
<?php
namespace App\Models\Configuracion;
class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
@ -59,7 +60,7 @@ class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
],
];
public function findAllWithMaquinas(string $selcols = "*", int $limit = null, int $offset = 0)
{
$sql =
@ -88,7 +89,7 @@ class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
*
* @return \CodeIgniter\Database\BaseBuilder
*/
public function getResource(string $search = "", $maquina_id=-1)
public function getResource(string $search = "", $maquina_id = -1)
{
$builder = $this->db
->table($this->table . " t1")
@ -97,24 +98,45 @@ class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
);
//JJO
$builder->where('maquina_id', $maquina_id);
$builder->where('maquina_id', $maquina_id);
$builder->where("t1.is_deleted", 0);
$builder->join("lg_maquinas t2", "t1.maquina_id = t2.id", "left");
return empty($search)
? $builder
: $builder
->groupStart()
->like("t1.id", $search)
->orLike("t1.tipo", $search)
->orLike("t1.precio", $search)
->orLike("t1.uso", $search)
->orLike("t1.id", $search)
->orLike("t1.maquina_id", $search)
->orLike("t1.tipo", $search)
->orLike("t1.precio", $search)
->orLike("t1.uso", $search)
->groupEnd();
->groupStart()
->like("t1.id", $search)
->orLike("t1.tipo", $search)
->orLike("t1.precio", $search)
->orLike("t1.uso", $search)
->orLike("t1.id", $search)
->orLike("t1.maquina_id", $search)
->orLike("t1.tipo", $search)
->orLike("t1.precio", $search)
->orLike("t1.uso", $search)
->groupEnd();
}
public function getTarifa($maquina_id = -1, $uso = " ", $tipo = " ")
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.precio AS precio"
);
//JJO
$builder->where('maquina_id', $maquina_id);
$builder->where('tipo', $tipo);
$builder->where('uso', $uso);
$builder->where("t1.is_deleted", 0);
$tarifas = $builder->get()->getResultArray();
if (count($tarifas)>0){
return floatval($tarifas[0]['precio']);
}
return $tarifas;
}
}

View File

@ -104,8 +104,9 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.nombre AS papel_generico"
"t1.id as id, t1.nombre AS nombre"
)
->distinct('t1.id')
->join("lg_papel_impresion t2", "t2.papel_generico_id = t1.id", "left")
->join("lg_maquina_papel_impresion t3", "t3.papel_impresion_id = t2.id", "left")
->join("lg_maquinas t4", "t3.maquina_id = t4.id", "left")
@ -113,6 +114,7 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
->where("t1.is_deleted", 0)
->where("t2.is_deleted", 0)
->where("t3.active", 1)
->where("t4.is_deleted", 0)
->where("t4.tipo", "impresion")
->where("t5.tipo", $tipo);
@ -121,15 +123,72 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
if($is_cubierta==true){
$builder->where("t2.cubierta", 1);
}
else if($is_sobrecubierta==true){
}
if(!is_null($is_sobrecubierta)){
if($is_sobrecubierta==true){
$builder->where("t2.sobrecubierta", 1);
}
}
return array_unique(array_column($builder->orderBy("t1.nombre", "asc")->get()->getResultArray(), 'papel_generico'));
return $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
}
public function getGramajeComparador(string $papel_generico_nombre="")
public function getGramajeComparador(string $papel_generico_nombre="", $uso="")
{
if($uso == 'cubierta' || $uso == 'sobrecubierta')
$tipo = 'color';
else
$tipo=$uso; // color y colorhq valen para los dos
if($uso == 'bn')
$tipo="negro";
if($uso == 'bnhq')
$tipo="negrohq";
$builder = $this->db
->table($this->table . " t1")
->select(
"t2.gramaje AS text"
)
->join("lg_papel_impresion t2", "t2.papel_generico_id = t1.id", "left")
->join("lg_maquina_papel_impresion t3", "t3.papel_impresion_id = t2.id", "left")
->join("lg_maquinas t4", "t3.maquina_id = t4.id", "left")
->join("lg_maquinas_tarifas_impresion t5", "t5.maquina_id = t4.id", "left")
->where("t1.is_deleted", 0)
->where("t2.is_deleted", 0)
->where("t2.isActivo", 1)
->where("t3.active", 1)
->where("t4.is_deleted", 0)
->where("t4.tipo", "impresion")
->where("t5.tipo", $tipo)
->where("t1.nombre", $papel_generico_nombre);
if($uso == 'bn' || $uso == 'bnhq')
$builder->where("t2.bn", 1);
else if ($uso == 'color' || $uso == 'colorhq')
$builder->where("t2.color", 1);
else if ($uso == 'cubierta')
$builder->where("t2.cubierta", 1);
else if ($uso == 'sobrecubierta')
$builder->where("t2.sobrecubierta", 1);
$values = $builder->orderBy("t2.gramaje", "asc")->get()->getResultObject();
$id = 1;
foreach ($values as $value){
$value->id = $id;
$id++;
}
$values_array = array_map( function( $value ) {
return $value->text;
}, $values );
$unique_values = array_unique($values_array);
return array_values(array_intersect_key($values, $unique_values));
}
//tipo: negro, negrohq, color, colorhq
//uso: interior, rotativa, cubierta, sobrecubierta
public function getGramajeLineasPresupuesto($papel_generico_id=0, $tipo="", $uso="")
{
$builder = $this->db
->table($this->table . " t1")
@ -137,11 +196,33 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
"t2.gramaje AS text"
)
->join("lg_papel_impresion t2", "t2.papel_generico_id = t1.id", "left")
->join("lg_maquina_papel_impresion t3", "t3.papel_impresion_id = t2.id", "left")
->join("lg_maquinas t4", "t3.maquina_id = t4.id", "left")
->join("lg_maquinas_tarifas_impresion t5", "t5.maquina_id = t4.id", "left")
->where("t1.is_deleted", 0)
->where("t2.is_deleted", 0)
->where("t1.nombre", $papel_generico_nombre);
->where("t2.isActivo", 1)
->where("t3.active", 1)
->where("t4.is_deleted", 0)
->where("t4.tipo", "impresion")
->where("t5.tipo", $tipo)
->where("t1.id", $papel_generico_id);
if($tipo == 'negro' || $tipo == 'negrohq')
$builder->where("t2.bn", 1);
else if ($tipo == 'color' || $tipo == 'colorhq')
$builder->where("t2.color", 1);
if ($uso == 'cubierta')
$builder->where("t2.cubierta", 1);
else if ($uso == 'sobrecubierta')
$builder->where("t2.sobrecubierta", 1);
if($uso=='rotativa')
$builder->where("t2.rotativa", 1);
else
$builder->where("t2.rotativa", 0);
$values = $builder->orderBy("t2.gramaje", "asc")->get()->getResultObject();
$id = 1;
foreach ($values as $value){

View File

@ -1,4 +1,5 @@
<?php
namespace App\Models\Configuracion;
class PapelImpresionMargenModel extends \App\Models\GoBaseModel
@ -86,27 +87,28 @@ class PapelImpresionMargenModel extends \App\Models\GoBaseModel
t1.paginas_max AS paginas_max, t1.margen AS margen"
);
//JJO
$builder->where('papel_impresion_id', $papel_impresion_id);
$builder->where('papel_impresion_id', $papel_impresion_id);
$builder->where("t1.is_deleted", 0);
return empty($search)
? $builder
: $builder
->groupStart()
->like("t1.paginas_min", $search)
->orLike("t1.paginas_max", $search)
->orLike("t1.margen", $search)
->orLike("t1.paginas_min", $search)
->orLike("t1.paginas_max", $search)
->orLike("t1.margen", $search)
->groupEnd();
->groupStart()
->like("t1.paginas_min", $search)
->orLike("t1.paginas_max", $search)
->orLike("t1.margen", $search)
->orLike("t1.paginas_min", $search)
->orLike("t1.paginas_max", $search)
->orLike("t1.margen", $search)
->groupEnd();
}
public function checkIntervals($data = [], $id_linea = null, $papel_impresion_id = null){
public function checkIntervals($data = [], $id_linea = null, $papel_impresion_id = null)
{
helper('general');
if(floatval($data["paginas_min"])>= floatval($data["paginas_max"])){
if (floatval($data["paginas_min"]) >= floatval($data["paginas_max"])) {
return lang('PapelImpresionMargenes.validation.error_paginas_range');
}
@ -119,17 +121,38 @@ class PapelImpresionMargenModel extends \App\Models\GoBaseModel
foreach ($rows as $row) {
if (!is_null($id_linea)){
if($row->id == $id_linea){
if (!is_null($id_linea)) {
if ($row->id == $id_linea) {
continue;
}
}
if(check_overlap(floatval($data["paginas_min"]), floatval($data["paginas_max"]),
$row->paginas_min, $row->paginas_max)){
return lang('PapelImpresionMargenes.validation.error_paginas_overlap');
if (check_overlap(
floatval($data["paginas_min"]),
floatval($data["paginas_max"]),
$row->paginas_min,
$row->paginas_max
)) {
return lang('PapelImpresionMargenes.validation.error_paginas_overlap');
}
}
return "";
}
public function getMargenFormPags($papel_impresion_id = -1, $num_paginas = 0)
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.margen AS margen"
);
//JJO
$builder->where('papel_impresion_id', $papel_impresion_id);
$builder->where("t1.is_deleted", 0);
$builder->where("t1.paginas_min <=", $num_paginas);
$builder->where("t1.paginas_max >=", $num_paginas);
return $builder->get()->getResultArray();
}
}

View File

@ -209,4 +209,122 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
return $builder;
}
/**
* @param null $papel_generico_id
* @param null $gramaje
* @param mixed $options
* array con las opciones para bn,color,cubierta,sobrecubierta,rotativa
* @param mixed $is_activo=true
*
* @return [type]
*/
public function getIdPapelesImpresionForPresupuesto($papel_generico_id = null, $gramaje = null, $options=[]){
$bn = array_key_exists('bn', $options) ? $options['bn'] : null;
$color = array_key_exists('color', $options)? $options['color'] : null;
$cubierta = array_key_exists('cubierta', $options)? $options['cubierta'] : null;
$sobrecubierta = array_key_exists('sobrecubierta', $options)? $options['sobrecubierta'] : null;
$rotativa = array_key_exists('rotativa', $options)? $options['rotativa'] : null;
$builder = $this->db
->table($this->table . " t1")
->distinct("t1.id")
->select(
"t1.id AS id, t1.nombre AS nombre, t1.papel_generico_id AS papel_generico_id,
t1.gramaje as gramaje, t1.espesor AS espesor, t1.precio_tonelada AS precio_tonelada, t1.rotativa AS rotativa");
$builder->where("t1.is_deleted", 0);
$builder->where("t1.isActivo", 1);
$builder->where("t1.papel_generico_id", $papel_generico_id);
$builder->where("t1.gramaje", $gramaje);
if(!is_null($bn)){
$builder->where("t1.bn", $bn);
}
if(!is_null($color)){
$builder->where("t1.color", $color);
}
if(!is_null($cubierta)){
$builder->where("t1.cubierta", $cubierta);
}
if(!is_null($sobrecubierta)){
$builder->where("t1.sobrecubierta", $sobrecubierta);
}
if(!is_null($rotativa)){
$builder->where("t1.rotativa", $rotativa);
}
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
}
//tipo: negro, negrohq, color, colorhq
//uso: interior, rotativa, cubierta, sobrecubierta
public function getPapelesImpresionForMenu($papel_generico = null, $gramaje = null, $tipo = null, $uso=""){
$builder = $this->db
->table($this->table . " t1")
->distinct("t1.id")
->join("lg_papel_generico t2", "t1.papel_generico_id = t2.id", "left")
->join("lg_maquina_papel_impresion t3", "t1.id = t3.papel_impresion_id", "left")
->join("lg_maquinas t4", "t3.maquina_id = t4.id", "left")
->join("lg_maquinas_tarifas_impresion t5", "t4.id = t5.maquina_id", "left")
->select(
"t1.id AS id, t1.nombre AS text");
$builder->where("t1.is_deleted", 0);
$builder->where("t1.isActivo", 1);
$builder->where("t2.is_deleted", 0);
$builder->where("t3.active", 1);
$builder->where("t4.is_deleted", 0);
$builder->where("t4.tipo", 'impresion');
$builder->where("t5.is_deleted", 0);
$builder->where("t5.tipo", $tipo);
$builder->where("t2.id", $papel_generico);
$builder->where("t1.gramaje", $gramaje);
if($tipo == 'negro' || $tipo == 'negrohq')
$builder->where("t1.bn", 1);
else if ($tipo == 'color' || $tipo == 'colorhq')
$builder->where("t1.color", 1);
if ($uso == 'cubierta')
$builder->where("t1.cubierta", 1);
else if ($uso == 'sobrecubierta')
$builder->where("t1.sobrecubierta", 1);
if($uso=='rotativa')
$builder->where("t1.rotativa", 1);
else
$builder->where("t1.rotativa", 0);
/*
if($tipo=='negro' || $tipo=='negrohq'){
$builder->where("t1.bn", 1);
$builder->where("t1.rotativa", 0);
}
elseif($tipo=='color' || $tipo=='colorhq'){
$builder->where("t1.color", 1);
$builder->where("t1.rotativa", 0);
}
elseif($tipo=='cubierta'){
$builder->where("t1.cubierta", 1);
$builder->where("t1.color", 1);
$builder->where("t1.rotativa", 0);
}
elseif($tipo=='sobrecubierta'){
$builder->where("t1.sobrecubierta", 1);
$builder->where("t1.color", 1);
$builder->where("t1.rotativa", 0);
}
elseif($tipo=='rot_bn'){
$builder->where("t1.bn", 1);
$builder->where("t1.rotativa", 1);
}
elseif($tipo=='rot_color'){
$builder->where("t1.color", 1);
$builder->where("t1.rotativa", 1);
}
*/
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
}
}

View File

@ -109,18 +109,21 @@ class PapelImpresionTipologiaModel extends \App\Models\GoBaseModel
return $result;
}
public function findTipologiasForPapelImpresion(int $papelImpresionID){
public function findTipologiasForPapelImpresion(int $papelImpresionID, $tipo=null){
$builder = $this->db
->table($this->table )
->select("*")
->where("papel_impresion_id", $papelImpresionID);
if(!is_null($tipo)){
$builder->where("tipo", $tipo);
}
return $builder;
}
public function removeForPapelImpresion($papel_impresion_id){
$builder = $this->db
->table($this->table . " t1")

View File

@ -0,0 +1,68 @@
<?php
namespace App\Models\Presupuestos;
class PresupuestoAcabadosModel extends \App\Models\GoBaseModel
{
protected $table = "presupuesto_acabados";
/**
* Whether primary key uses auto increment.
*
* @var bool
*/
protected $useAutoIncrement = true;
const SORTABLE = [
0 => "t2.nombre",
1 => "t1.precio_unidad",
2 => "t1.precio_total"
];
protected $allowedFields = ["presupuesto_id", "tarifa_acabado_id", "nombre", "precio_total", "precio_unidad"];
protected $returnType = "App\Entities\Presupuestos\PresupuestoAcabadosEntity";
protected $useTimestamps = true;
protected $useSoftDeletes = false;
protected $createdField = "created_at";
protected $updatedField = "updated_at";
public static $labelField = "nombre";
protected $validationRules = [
"precio_total" => [
"label" => "Presupuestos.precioTotal",
"rules" => "decimal|required",
],
];
protected $validationMessages = [
"precio_total" => [
"decimal" => "Presupuestos.validation.decimal",
"requerido" => "Presupuestos.validation.decimal",
],
];
/**
* Get resource data.
*
* @param string $search
*
* @return \CodeIgniter\Database\BaseBuilder
*/
public function getResource($presupuesto_id = -1)
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.tarifa_acabado_id AS tarifa_acabado_id, t1.precio_unidad AS precio_unidad, t1.precio_total AS precio_total, t2.nombre AS nombre"
);
$builder->where('t1.presupuesto_id', $presupuesto_id);
$builder->join("lg_tarifa_acabado t2", "t1.tarifa_acabado_id = t2.id", "left");
return $builder;
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace App\Models\Presupuestos;
class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel
{
protected $table = "presupuesto_encuadernaciones";
/**
* Whether primary key uses auto increment.
*
* @var bool
*/
protected $useAutoIncrement = true;
const SORTABLE = [
0 => "t2.nombre",
1 => "t1.precio_unidad",
2 => "t1.precio_total"
];
protected $allowedFields = ["presupuesto_id", "tarifa_encuadernado_id", "nombre", "precio_total", "precio_unidad"];
protected $returnType = "App\Entities\Presupuestos\PresupuestoEncuadernacionesEntity";
protected $useTimestamps = true;
protected $useSoftDeletes = false;
protected $createdField = "created_at";
protected $updatedField = "updated_at";
public static $labelField = "nombre";
protected $validationRules = [
"precio_total" => [
"label" => "Presupuestos.precioTotal",
"rules" => "decimal|required",
],
];
protected $validationMessages = [
"precio_total" => [
"decimal" => "Presupuestos.validation.decimal",
"requerido" => "Presupuestos.validation.decimal",
],
];
/**
* Get resource data.
*
* @param string $search
*
* @return \CodeIgniter\Database\BaseBuilder
*/
public function getResource($presupuesto_id = -1)
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.tarifa_encuadernado_id AS tarifa_encuadernado_id, t1.precio_unidad AS precio_unidad, t1.precio_total AS precio_total, t2.nombre AS nombre"
);
$builder->where('t1.presupuesto_id', $presupuesto_id);
$builder->join("tarifa_encuadernacion t2", "t1.tarifa_encuadernado_id = t2.id", "left");
return $builder;
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace App\Models\Presupuestos;
class PresupuestoManipuladosModel extends \App\Models\GoBaseModel
{
protected $table = "presupuesto_manipulados";
/**
* Whether primary key uses auto increment.
*
* @var bool
*/
protected $useAutoIncrement = true;
const SORTABLE = [
0 => "t2.nombre",
1 => "t1.precio_unidad",
2 => "t1.precio_total"
];
protected $allowedFields = ["presupuesto_id", "tarifa_manipulado_id", "nombre", "precio_total", "precio_unidad"];
protected $returnType = "App\Entities\Presupuestos\PresupuestoManipuladosEntity";
protected $useTimestamps = true;
protected $useSoftDeletes = false;
protected $createdField = "created_at";
protected $updatedField = "updated_at";
public static $labelField = "nombre";
protected $validationRules = [
"precio_total" => [
"label" => "Presupuestos.precioTotal",
"rules" => "decimal|required",
],
];
protected $validationMessages = [
"precio_total" => [
"decimal" => "Presupuestos.validation.decimal",
"requerido" => "Presupuestos.validation.decimal",
],
];
/**
* Get resource data.
*
* @param string $search
*
* @return \CodeIgniter\Database\BaseBuilder
*/
public function getResource($presupuesto_id = -1)
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.tarifa_manipulado_id AS tarifa_manipulado_id, t1.precio_unidad AS precio_unidad, t1.precio_total AS precio_total, t2.nombre AS nombre"
);
$builder->where('t1.presupuesto_id', $presupuesto_id);
$builder->join("lg_tarifa_manipulado t2", "t1.tarifa_manipulado_id = t2.id", "left");
return $builder;
}
}

View File

@ -71,10 +71,11 @@ class PresupuestoModel extends \App\Models\GoBaseModel
"merma",
"merma_portada",
"imagenes_bn_interior",
"comentarios",
"comentarios_cliente",
"comentarios_safekat",
"comentarios_pdf",
"comentarios_tarifa",
"comentarios_produccion",
"en_produccion",
"en_espera",
"modo_comparador",
@ -234,8 +235,8 @@ class PresupuestoModel extends \App\Models\GoBaseModel
"label" => "Presupuestos.coleccion",
"rules" => "trim|max_length[255]",
],
"comentarios" => [
"label" => "Presupuestos.comentarios",
"comentarios_cliente" => [
"label" => "Presupuestos.comentarios_cliente",
"rules" => "trim|required|max_length[16313]",
],
"comentarios_pdf" => [
@ -250,6 +251,10 @@ class PresupuestoModel extends \App\Models\GoBaseModel
"label" => "Presupuestos.comentariosTarifa",
"rules" => "trim|required|max_length[16313]",
],
"comentarios_produccion" => [
"label" => "Presupuestos.comentariosProduccion",
"rules" => "trim|required|max_length[16313]",
],
"comparador_json_data" => [
"label" => "Presupuestos.comparadorJsonData",
"rules" => "trim|max_length[16313]",
@ -671,21 +676,25 @@ class PresupuestoModel extends \App\Models\GoBaseModel
"coleccion" => [
"max_length" => "Presupuestos.validation.coleccion.max_length",
],
"comentarios" => [
"max_length" => "Presupuestos.validation.comentarios.max_length",
"required" => "Presupuestos.validation.comentarios.required",
"comentarios_cliente" => [
"max_length" => "Presupuestos.validation.max_length",
"required" => "Presupuestos.validation.required",
],
"comentarios_pdf" => [
"max_length" => "Presupuestos.validation.comentarios_pdf.max_length",
"required" => "Presupuestos.validation.comentarios_pdf.required",
"max_length" => "Presupuestos.validation.max_length",
"required" => "Presupuestos.validation.required",
],
"comentarios_safekat" => [
"max_length" => "Presupuestos.validation.comentarios_safekat.max_length",
"required" => "Presupuestos.validation.comentarios_safekat.required",
"max_length" => "Presupuestos.validation.max_length",
"required" => "Presupuestos.validation.required",
],
"comentarios_tarifa" => [
"max_length" => "Presupuestos.validation.comentarios_tarifa.max_length",
"required" => "Presupuestos.validation.comentarios_tarifa.required",
"max_length" => "Presupuestos.validation.max_length",
"required" => "Presupuestos.validation.required",
],
"comentarios_produccion" => [
"max_length" => "Presupuestos.validation.max_length",
"required" => "Presupuestos.validation.required",
],
"comparador_json_data" => [
"max_length" => "Presupuestos.validation.comparador_json_data.max_length",

View File

@ -0,0 +1,68 @@
<?php
namespace App\Models\Presupuestos;
class PresupuestoPreimpresionesModel extends \App\Models\GoBaseModel
{
protected $table = "presupuesto_preimpresiones";
/**
* Whether primary key uses auto increment.
*
* @var bool
*/
protected $useAutoIncrement = true;
const SORTABLE = [
0 => "t2.nombre",
1 => "t1.precio_unidad",
2 => "t1.precio_total"
];
protected $allowedFields = ["presupuesto_id", "tarifa_preimpresion_id", "nombre", "precio_total", "precio_unidad"];
protected $returnType = "App\Entities\Presupuestos\PresupuestoPreimpresionesEntity";
protected $useTimestamps = true;
protected $useSoftDeletes = false;
protected $createdField = "created_at";
protected $updatedField = "updated_at";
public static $labelField = "nombre";
protected $validationRules = [
"precio_total" => [
"label" => "Presupuestos.precioTotal",
"rules" => "decimal|required",
],
];
protected $validationMessages = [
"precio_total" => [
"decimal" => "Presupuestos.validation.decimal",
"requerido" => "Presupuestos.validation.decimal",
],
];
/**
* Get resource data.
*
* @param string $search
*
* @return \CodeIgniter\Database\BaseBuilder
*/
public function getResource($presupuesto_id = -1)
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.tarifa_preimpresion_id AS tarifa_preimpresion_id, t1.precio_unidad AS precio_unidad, t1.precio_total AS precio_total, t2.nombre AS nombre"
);
$builder->where('t1.presupuesto_id', $presupuesto_id);
$builder->join("lg_tarifa_preimpresion t2", "t1.tarifa_preimpresion_id = t2.id", "left");
return $builder;
}
}

View File

@ -13,18 +13,21 @@ class TarifaEncuadernacionLineaModel extends \App\Models\GoBaseModel
protected $useAutoIncrement = true;
const SORTABLE = [
0 => "t1.paginas_min",
1 => "t1.paginas_max",
0 => "t1.paginas_libro_min",
1 => "t1.paginas_libro_max",
2 => "t1.precio_min",
3 => "t1.precio_max",
];
protected $allowedFields = [
"tirada_encuadernacion_id",
"paginas_min",
"paginas_max",
"paginas_libro_min",
"paginas_libro_max",
"dimensiones_id",
"precio_min",
"precio_max",
"tirada_min",
"tirada_max",
"user_created_id",
"is_deleted",
@ -49,11 +52,19 @@ class TarifaEncuadernacionLineaModel extends \App\Models\GoBaseModel
"label" => "TarifaEncuadernacionLineas.precioMin",
"rules" => "required|decimal",
],
"paginas_max" => [
"tirada_max" => [
"label" => "TarifaEncuadernacionLineas.tiradaMax",
"rules" => "required|decimal",
],
"tirada_min" => [
"label" => "TarifaEncuadernacionLineas.tiradaMin",
"rules" => "required|decimal",
],
"paginas_libro_max" => [
"label" => "TarifaEncuadernacionLineas.paginasMax",
"rules" => "required|decimal",
],
"paginas_min" => [
"paginas_libro_min" => [
"label" => "TarifaEncuadernacionLineas.paginasMin",
"rules" => "required|decimal",
],
@ -72,13 +83,21 @@ class TarifaEncuadernacionLineaModel extends \App\Models\GoBaseModel
"decimal" => "TarifaEncuadernacionLineas.validation.precio_min.decimal",
"required" => "TarifaEncuadernacionLineas.validation.precio_min.required",
],
"paginas_max" => [
"decimal" => "TarifaEncuadernacionLineas.validation.paginas_max.decimal",
"required" => "TarifaEncuadernacionLineas.validation.paginas_max.required",
"tirada_max" => [
"decimal" => "TarifaEncuadernacionLineas.validation.tirada_max.decimal",
"required" => "TarifaEncuadernacionLineas.validation.tirada_max.required",
],
"paginas_min" => [
"decimal" => "TarifaEncuadernacionLineas.validation.paginas_min.decimal",
"required" => "TarifaEncuadernacionLineas.validation.paginas_min.required",
"tirada_min" => [
"decimal" => "TarifaEncuadernacionLineas.validation.tirada_min.decimal",
"required" => "TarifaEncuadernacionLineas.validation.tirada_min.required",
],
"paginas_libro_max" => [
"decimal" => "TarifaEncuadernacionLineas.validation.paginas_libro_max.decimal",
"required" => "TarifaEncuadernacionLineas.validation.paginas_libro_max.required",
],
"paginas_libro_min" => [
"decimal" => "TarifaEncuadernacionLineas.validation.paginas_libro_min.decimal",
"required" => "TarifaEncuadernacionLineas.validation.paginas_libro_min.required",
],
"margen" => [
"decimal" => "TarifaEncuadernacionLineas.validation.margen.decimal",
@ -98,7 +117,7 @@ class TarifaEncuadernacionLineaModel extends \App\Models\GoBaseModel
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.tirada_encuadernacion_id AS tirada_encuadernacion_id, t1.paginas_min AS paginas_min, t1.paginas_max AS paginas_max, t1.precio_min AS precio_min, t1.precio_max AS precio_max, t1.margen AS margen, t2.id AS tarifa_encuadernacion"
"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"
);
//JJO
$builder->where('tirada_encuadernacion_id', $tirada_encuadernacion_id);
@ -113,16 +132,12 @@ class TarifaEncuadernacionLineaModel extends \App\Models\GoBaseModel
->groupStart()
->like("t1.id", $search)
->orLike("t1.tirada_encuadernacion_id", $search)
->orLike("t1.paginas_min", $search)
->orLike("t1.paginas_max", $search)
->orLike("t1.precio_min", $search)
->orLike("t1.precio_max", $search)
->orLike("t1.id", $search)
->orLike("t1.tirada_encuadernacion_id", $search)
->orLike("t1.paginas_min", $search)
->orLike("t1.paginas_max", $search)
->orLike("t1.paginas_libro_min", $search)
->orLike("t1.paginas_libro_max", $search)
->orLike("t1.precio_min", $search)
->orLike("t1.precio_max", $search)
->orLike("t1.tirada_min", $search)
->orLike("t1.tirada_max", $search)
->groupEnd();
}
@ -130,13 +145,13 @@ class TarifaEncuadernacionLineaModel extends \App\Models\GoBaseModel
helper('general');
if(floatval($data["paginas_min"])>= floatval($data["paginas_max"])){
if(floatval($data["paginas_libro_min"])>= floatval($data["paginas_libro_max"])){
return lang('TarifaEncuadernacionLineas.validation.error_paginas_range');
}
$rows = $this->db
->table($this->table)
->select("id, paginas_min, paginas_max")
->select("id, paginas_libro_min, paginas_libro_max")
->where("is_deleted", 0)
->where("tirada_encuadernacion_id", $tirada_encuadernacion_id)
->get()->getResultObject();
@ -148,8 +163,8 @@ class TarifaEncuadernacionLineaModel extends \App\Models\GoBaseModel
continue;
}
}
if(check_overlap(floatval($data["paginas_min"]), floatval($data["paginas_max"]),
$row->paginas_min, $row->paginas_max)){
if(check_overlap(floatval($data["paginas_libro_min"]), floatval($data["paginas_libro_max"]),
$row->paginas_libro_min, $row->paginas_libro_max)){
return lang('TarifaEncuadernacionLineas.validation.error_paginas_overlap');
}
}

View File

@ -94,4 +94,22 @@ class TarifaEncuadernacionModel extends \App\Models\GoBaseModel
->like("t1.nombre", $search)
->groupEnd();
}
public function getServiciosEncuadernacionSelector()
{
/*
Todos los servicios de encuadernacion activas que se pueden usar en presupuestos
*/
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id as value, t1.nombre AS label"
)
->where("t1.is_deleted", 0)
->where("t1.mostrar_en_presupuesto", 1);
return $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
}
}

View File

@ -93,4 +93,20 @@ class TarifaManipuladoModel extends \App\Models\GoBaseModel
->like("t1.nombre", $search)
->groupEnd();
}
public function getServiciosManipuladoSelector()
{
/*
Todos los servicios de manipulado activas que se pueden usar en presupuestos
*/
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id as value, t1.nombre AS label"
)
->where("t1.is_deleted", 0)
->where("t1.mostrar_en_presupuesto", 1);
return $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
}
}

View File

@ -94,4 +94,22 @@ class TarifaacabadoModel extends \App\Models\GoBaseModel
->like("t1.nombre", $search)
->groupEnd();
}
public function getServiciosAcabadoSelector()
{
/*
Todos los servicios de acabado activos que se pueden usar en presupuestos
*/
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id as value, t1.nombre AS label"
)
->where("t1.is_deleted", 0)
->where("t1.mostrar_en_presupuesto", 1);
return $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
}
}

View File

@ -79,4 +79,22 @@ class TarifapreimpresionModel extends \App\Models\GoBaseModel
"decimal" => "Tarifapreimpresion.validation.margen.decimal",
],
];
public function getServiciosPreimpresionSelector()
{
/*
Todos los servicios de preimpresion activas que se pueden usar en presupuestos
*/
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id as value, t1.nombre AS label"
)
->where("t1.is_deleted", 0)
->where("t1.mostrar_en_presupuesto", 1);
return $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
}
}

View File

@ -4,24 +4,416 @@ namespace App\Services;
use CodeIgniter\Config\BaseService;
use App\Models\Configuracion\PapelGenericoModel;
class PresupuestoService extends BaseService
{
public static function example(){
return 'Hola';
/**
* CONSTANTES USADAS PARA LOS CALCULOS
*/
const MARGEN_PAGINAS_ROTATIVA = 15.0;
/**
* @param mixed $uso
* contiene algun parametro de la lista ['interior,'cubierta','sobrecubierta']
* @param mixed $tipo
* contiene algun parametro de la lista ['negro','color','negrohq','bicolor','colorhq']
* @param mixed $datosPedido
* objeto con la siguiente extructura:
* -> paginas: numero de paginas por libro
* -> tirada: numero de unidades a imprimir
* -> merma: unidades que se añaden a la tirada
*
* @param mixed $maquina
* objeto con la siguiente estructura:
* -> id: el id de la maquina
* -> nombre: nombre de la maquina
* -> ancho_impresion: valor maximo del ancho para imprimir
* -> alto_impresion: valor maximo del alto para imprimir
* @param mixed $papel_impresion
* @param mixed $tarifa
*
* @return [type]
*/
public static function getCostesLinea($uso, $datosPedido, $maquina, $papel_impresion, $opciones_papel, $tarifa)
{
$response['fields'] = [];
if ($uso!='rotativa') {
$formas = PresupuestoService::getNumFormasPlana($uso, $maquina, $datosPedido->ancho, $datosPedido->alto, $datosPedido->isCosido);
$response['fields'] = $formas;
}
if ($response['fields']['num_formas']['posicion_formas'] == 'n/a') {
$response['error']['value'] = true;
$response['error']['message'] = 'no_formas_disponibles';
return $response;
}
// precio del pliego de impresion
$precio_pliego_impresion = PresupuestoService::getPrecioPliego($maquina, $papel_impresion, $datosPedido->paginas);
$precio_click = 0;
$precio_click_pedido = 0;
$pliegos_libro = 0;
$cubierta = array_key_exists('cubierta', $opciones_papel) ? $opciones_papel['cubierta'] : 0;
$sobrecubierta = array_key_exists('sobrecubierta', $opciones_papel) ? $opciones_papel['sobrecubierta'] : 0;
$rotativa = array_key_exists('rotativa', $opciones_papel) ? $opciones_papel['rotativa'] : 0;
//interior (bn o color)
if ($cubierta == 0 && $sobrecubierta == 0 && $rotativa == 0) {
// precio papel
$pliegos_libro = ($datosPedido->paginas / 2.0) / $response['fields']['num_formas']['value'];
$pliegos_pedido = $pliegos_libro * ($datosPedido->tirada + $datosPedido->merma);
$precio_libro = $pliegos_libro * $precio_pliego_impresion;
$precio_pedido = $precio_libro * ($datosPedido->tirada + $datosPedido->merma);
$mano = PresupuestoService::computeLomoInterior($datosPedido->paginas, $papel_impresion->espesor);
// peso
$peso = PresupuestoService::computePeso(
ancho: $datosPedido->isCosido ? $datosPedido->ancho / 2.0 : $datosPedido->ancho,
alto: $datosPedido->alto,
gramaje: $papel_impresion->gramaje,
paginas: $datosPedido->paginas
);
// impresion
$precio_click = $tarifa;
$precio_click_pedido = $pliegos_pedido * 2 * $precio_click;
}
// cubierta o sobrecubierta (siempre a color)
else if (($cubierta == 1 || $sobrecubierta == 1) && $rotativa == 0) {
// precio papel
$pliegos_libro = 1.0 / $response['fields']['num_formas']['value'];
// En cubierta y sobrecubierta siempre el mínimo pliego es 1
$pliegos_libro = $pliegos_libro<1?1:$pliegos_libro;
$pliegos_pedido = $pliegos_libro * ($datosPedido->tirada + $datosPedido->merma);
$precio_libro = $pliegos_libro * $precio_pliego_impresion;
$precio_pedido = $precio_libro * ($datosPedido->tirada + $datosPedido->merma);
$mano = PresupuestoService::computeLomoPortada($papel_impresion->espesor);
// peso
$ancho_total = $datosPedido->solapas? $datosPedido->ancho + $datosPedido->solapas_ancho:$datosPedido->ancho;
$peso = PresupuestoService::computePeso($ancho_total, $datosPedido->alto, $papel_impresion->gramaje);
// impresion
if ($tarifa) {
$precio_click = $tarifa;
$precio_click_pedido = $pliegos_pedido * $precio_click;
// dos caras
if($datosPedido->paginas > 2) {
$precio_click_pedido *= 2.0;
}
}
}
// response
$response['fields']['pliegos_libro'] = $pliegos_libro;
$response['fields']['pliegos_pedido'] = $pliegos_pedido;
$response['fields']['precios_pliegos'] = $precio_pliego_impresion;
$response['fields']['precio_libro'] = $precio_libro;
$response['fields']['precio_pedido'] = $precio_pedido;
$response['fields']['mano'] = $mano;
$response['fields']['peso'] = $peso;
$response['fields']['precio_click'] = $precio_click;
$response['fields']['precio_click_pedido'] = $precio_click_pedido;
$response['fields']['dimensiones_maquina'] = [$maquina->ancho, $maquina->alto];
$response['fields']['dimensiones_maquina_impresion'] = [$maquina->ancho_impresion, $maquina->alto_impresion];
$response['fields']['dimensiones_maquina_click'] = [$maquina->ancho_impresion, $maquina->alto_click];
$response['fields']['dimensiones_libro'] = [$datosPedido->ancho, $datosPedido->alto];
//$response['fields']['datos_rotativa'] = $datos_rotativa;
return $response;
}
/*
/**
* getPapelForMenu.
* Devuelve la lista de papeles disponibles
*
* @param mixed $tipo_impresion
* @param mixed $dimensiones
* @return mixed
* Devuelve los calculos para la linea de rotativa.
*/
public static function test(){
public static function getCostesLineaRotativa($maquina, $papel_impresion, $datosPedido, $parametrosRotativa)
{
$data = [];
$data['resolucion'] = 600;
$data['pulgada'] = 1 / 1000000000000.0;
$data['superficie'] = round((($datosPedido->ancho / 2.54) / 10) * (($datosPedido->alto / 2.54) / 10), 2);
// posicionamos paginas en función de a favor de fibra o no
$anchoLibro = $datosPedido->ancho;
$altoLibro = $datosPedido->alto;
if (!$parametrosRotativa->a_favor_fibra) {
$anchoLibro = $datosPedido->alto;
$altoLibro = $datosPedido->ancho;
}
$data['ancho'] = $anchoLibro;
$data['alto'] = $altoLibro;
// si es cosido ancho x 2
if ($datosPedido->isCosido) {
if (!$parametrosRotativa->a_favor_fibra) {
$data['alto'] = $data['alto'] * 2;
} else {
$data['ancho'] = $data['ancho'] * 2;
}
}
// calculo de papel y clicks
$factor_anchura = round($maquina->ancho_impresion / $data['ancho'], 2);
$factor_altura = round($maquina->alto_impresion / ($data['alto'] + self::MARGEN_PAGINAS_ROTATIVA), 2);
$factor_altura_click = round($maquina->alto_click / ($data['alto'] + self::MARGEN_PAGINAS_ROTATIVA), 2);
$multiplicador_pliego = $datosPedido->isCosido ? 4 : 2;
$paginas_por_pliego = round(floor($factor_anchura) * $factor_altura * $multiplicador_pliego, 2);
$pliegos_libro = round($paginas_por_pliego ? $datosPedido->paginas / $paginas_por_pliego : 0, 2);
$metros_papel_libro = round($pliegos_libro * ($maquina->alto_impresion / 1000.0), 2);
$metros_papel_total = round($metros_papel_libro * ($datosPedido->tirada + $datosPedido->merma), 2);
$paginas_por_pliego_click = round(floor($factor_anchura) * $factor_altura_click * $multiplicador_pliego, 2);
$pliegos_libro_click = round($paginas_por_pliego_click ? $datosPedido->paginas / $paginas_por_pliego_click : 0, 2);
$clicks_libro = round(ceil($pliegos_libro_click) * 2, 2);
$clicks_pedido = round($clicks_libro * ($datosPedido->tirada + $datosPedido->merma), 2);
$data['factor_altura'] = $factor_altura;
$data['factor_anchura'] = $factor_anchura;
$data['paginas_por_pliego'] = $paginas_por_pliego;
$data['pliegos_libro'] = $pliegos_libro;
$data['pliegos_pedido'] = $pliegos_libro * ($datosPedido->tirada + $datosPedido->merma);
$data['metros_papel_libro'] = $metros_papel_libro;
$data['metros_papel_total'] = $metros_papel_total;
$data['clicks_libro'] = $clicks_libro;
$data['clicks_pedido'] = $clicks_pedido;
// calculo de tintas
$data['num_gotas_negro'] = round($data['superficie'] * $data['resolucion'] * $data['resolucion'] * ($parametrosRotativa->rotativa_negro / 100.0), 0);
$data['num_gotas_cyan'] = round($data['superficie'] * $data['resolucion'] * $data['resolucion'] * ($parametrosRotativa->rotativa_cyan / 100.0), 0);
$data['num_gotas_magenta'] = round($data['superficie'] * $data['resolucion'] * $data['resolucion'] * ($parametrosRotativa->rotativa_magenta / 100.0), 0);
$data['num_gotas_amarillo'] = round($data['superficie'] * $data['resolucion'] * $data['resolucion'] * ($parametrosRotativa->rotativa_amarillo / 100.0), 0);
$pag_negro = $parametrosRotativa->bnPages;
$pag_color = 0;
if ($parametrosRotativa->colorPages>0) {
$pag_color = $parametrosRotativa->colorPages;
}
// peso tintas
$data['peso_gotas_negro'] = round((($data['num_gotas_negro'] * $parametrosRotativa->rotativa_gota_negro * $data['pulgada']) / (17.91 / 20.0)) * $pag_negro * 1000, 6);
$data['peso_gotas_cyan'] = round((($data['num_gotas_cyan'] * $parametrosRotativa->rotativa_gota_color * $data['pulgada']) / (17.65 / 20.0)) * $pag_color * 1000, 6);
$data['peso_gotas_magenta'] = round((($data['num_gotas_magenta'] * $parametrosRotativa->rotativa_gota_color * $data['pulgada']) / (17.65 / 20.0)) * $pag_color * 1000, 6);
$data['peso_gotas_amarillo'] = round((($data['num_gotas_amarillo'] * $parametrosRotativa->rotativa_gota_color * $data['pulgada']) / (17.65 / 20.0)) * $pag_color * 1000, 6);
// costes de tintas
$data['peso_gotas_negro_pedido'] = round($data['peso_gotas_negro'], 2) * ($datosPedido->tirada + $datosPedido->merma);
$data['peso_gotas_cyan_pedido'] = round($data['peso_gotas_cyan'], 2) * ($datosPedido->tirada + $datosPedido->merma);
$data['peso_gotas_magenta_pedido'] = round($data['peso_gotas_magenta'], 2) * ($datosPedido->tirada + $datosPedido->merma);
$data['peso_gotas_amarillo_pedido'] = round($data['peso_gotas_amarillo'], 2) * ($datosPedido->tirada + $datosPedido->merma);
// precio tinta
$data['precio_tinta'] = round(
round(($data['peso_gotas_negro_pedido'] / 1000.0) * $maquina->precio_tinta_negro, 2) +
round(($data['peso_gotas_cyan_pedido'] / 1000.0) * $maquina->precio_tinta_color, 2) +
round(($data['peso_gotas_magenta_pedido'] / 1000.0) * $maquina->precio_tinta_color, 2) +
round(($data['peso_gotas_amarillo_pedido'] / 1000.0) * $maquina->precio_tinta_color, 2)
, 2);
// precio pagina
$data['precio_pagina_negro'] = round($pag_negro ? $data['precio_tinta'] / ($pag_negro * ($datosPedido->tirada + $datosPedido->merma)) : 0, 6);
$data['precio_pagina_color'] = round($pag_color ? $data['precio_tinta'] / ($pag_color * ($datosPedido->tirada + $datosPedido->merma)) : 0, 6);
// calculo de corte
$data['tiempo_corte'] = $maquina->velocidad_corte > 0 ? round($metros_papel_total / $maquina->velocidad_corte, 2) : 0;
$data['total_corte'] = round(($data['tiempo_corte'] / 60.0) * $maquina->precio_hora_corte, 2);
$data['mano'] = PresupuestoService::computeLomoInterior($datosPedido->paginas, $papel_impresion->espesor);
// ($paginas / 2.0) * (($gramaje / 1000.0) * $papel_compra->mano);
// peso
$data['peso'] = PresupuestoService::computePeso(
ancho: $datosPedido->isCosido ? $datosPedido->ancho / 2.0 : $datosPedido->ancho,
alto: $datosPedido->alto,
gramaje: $papel_impresion->gramaje,
paginas: $datosPedido->paginas
);
return $data;
}
public static function getNumFormasPlana($uso, $maquina, $ancho, $alto, $isCosido)
{
// El ancho si es cosido es el doble
if($uso != 'cubierta' && $uso != 'sobrecubierta'){
$anchoForCalculo = $isCosido ? $ancho * 2 : $ancho;
}
else{
$anchoForCalculo = $ancho;
}
if($uso == 'cubierta' || $uso == 'sobrecubierta') {
if(property_exists($maquina, 'forzar_num_formas_horizontales_cubierta') &&
property_exists($maquina, 'forzar_num_formas_horizontales_cubierta')){
if($maquina->forzar_num_formas_horizontales_cubierta > 0 &&
$maquina->forzar_num_formas_horizontales_cubierta > 0){
$h1_temp = $maquina->forzar_num_formas_horizontales_cubierta;
$h2_temp = $maquina->forzar_num_formas_verticales_cubierta;
//$num_formas = $h1_temp * $h2_temp;
}
else{
$h1_temp == 0;
$h2_temp == 0;
}
}
else{
$h1_temp == 0;
$h2_temp == 0;
}
}
// No es cubierta ni sobrecubierta
else{
// horizontales
$h1_temp = floor($maquina->ancho_impresion / $anchoForCalculo);
$h2_temp = floor($maquina->ancho_impresion / $alto);
}
// horizontales
$calles = (new \App\Models\Configuracion\MaquinasCallesModel())->getCallesForMaquina($maquina->maquina_id, $h1_temp);
// Si son mas de 2 formas
if(count($calles)>0)
$h1 = ($h1_temp * $anchoForCalculo + 2 * $calles[0]->externas + ($h1_temp - 1) * $calles[0]->internas < ($maquina->ancho)) ? $h1_temp : $h1_temp - 1;
else
$h1 = $h1_temp;
$v1 = floor($maquina->alto_impresion / $alto);
$formas_h = $h1 * $v1; //p1
// verticales
$calles = (new \App\Models\Configuracion\MaquinasCallesModel())->getCallesForMaquina($maquina->maquina_id, $h2_temp);
if(count($calles)>0)
$h2 = ($h2_temp * $anchoForCalculo + 2 * $calles[0]->externas + ($h2_temp - 1) * $calles[0]->internas < ($maquina->ancho)) ? $h2_temp : $h2_temp - 1;
else
$h2 = $h2_temp;
$v2 = floor($maquina->alto_impresion / $anchoForCalculo);
$formas_v = $h2 * $v2; //p2
// Se calcula el numero de formas
if($uso != 'cubierta' && $uso != 'sobrecubierta'){
$num_formas = ($formas_h > $formas_v) ? $formas_h : $formas_v;
$num_formas = $isCosido ? $num_formas * 2 : $num_formas;
}
else{
$num_formas = $h1*$h2;
}
// si no hay formas se devuelve n/a
if ($num_formas == 0) {
$response['num_formas']['posicion_formas'] = 'n/a'; // not available
} else if ($formas_h > $formas_v) {
$response['num_formas']['posicion_formas'] = 'h';
$response['num_formas']['num_formas_horizontales'] = $h1;
$response['num_formas']['num_formas_verticales'] = $v1;
$response['num_formas']['value'] = $num_formas;
} else {
$response['num_formas']['posicion_formas'] = 'v';
$response['num_formas']['num_formas_horizontales'] = $h2;
$response['num_formas']['num_formas_verticales'] = $v2;
$response['num_formas']['value'] = $num_formas;
}
if($uso == 'cubierta' || $uso == 'sobrecubierta') {
if(property_exists($maquina, 'forzar_num_formas_horizontales_cubierta') &&
property_exists($maquina, 'forzar_num_formas_horizontales_cubierta')){
$response['num_formas']['num_formas_verticales'] = $h2;
}
}
return $response;
}
public static function getPrecioPliego($maquina, $papel_impresion, $paginas)
{
$margen = (new \App\Models\Configuracion\PapelImpresionMargenModel())->getMargenFormPags($papel_impresion->id, $paginas);
if (count($margen) > 0) {
$peso_por_pliego = $maquina->alto * $maquina->ancho * $papel_impresion->gramaje / 1000000;
$precio_pliego = ($peso_por_pliego * $papel_impresion->precio_tonelada / 1000000.0) * (1 + (floatval($margen[0]['margen']) / 100.0));
return round($precio_pliego, 6);
}
return -1;
}
public static function getTiempoMaquina($totalClicks, $precioClick, $velocidadMaquina) {
try {
if($precioClick>0 && $velocidadMaquina>0)
$minutos = (1.0*$totalClicks/$precioClick)/$velocidadMaquina;
else
$minutos = 0;
return gmdate("H:i:s", round($minutos*60,0));
} catch (Exception $e) {
return gmdate("H:i:s", round(0,0));
}
}
/**
* Devuelve la dimensión del lomo interior.
*/
private static function computeLomoInterior($paginas = null, $espesor = null)
{
$lomo = 0;
if (!is_null($paginas) && !is_null($espesor)) {
$lomo += (($espesor * $paginas / 2.0) + 1) / 1000.0;
}
return $lomo;
}
/**
* Calcula la dimensión del lomo para portada y cubierta
*/
private static function computeLomoPortada($espesor)
{
return ($espesor * 2.0) / 1000.0;
}
/**
* Devuelve el peso de un pedido.
*/
private static function computePeso($ancho, $alto, $gramaje, $paginas = null)
{
$peso = ($ancho / 1000.0) * ($alto / 1000.0) * $gramaje;
if (!is_null($paginas)) {
if ($paginas > 0) {
$peso *= ($paginas / 2.0);
}
}
return $peso;
}
}

View File

@ -13,7 +13,7 @@
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-bs-dismiss="modal"><?= lang('Basic.global.deleteConfirmationCancel') ?></button>
<a href="javascript:void(0);" class="btn btn-danger btn-confirm btn-remove"><?= lang('Basic.global.deleteConfirmationButton') ?></a>
<a id="confirmDelete" href="javascript:void(0);" class="btn btn-danger btn-confirm btn-remove"><?= lang('Basic.global.deleteConfirmationButton') ?></a>
</div><!--//.modal-footer -->
</div><!--//.modal-content -->
</div><!--//.modal-dialog -->

View File

@ -175,6 +175,12 @@
$(this).find('.btn-confirm').attr('href', $(e.relatedTarget).data('href'));
});
$('#confirm2delete').keypress(function(e) { // Attach the form handler to the keypress event
if (e.keyCode == 13) { // If the the enter key was pressed.
$('#confirmDelete').click(); // Trigger the button(elementId) click event.
}
});
function toggleAllCheckboxes($cssClass, $io=null) {
$('.'+$cssClass).prop('checked', $io);
}

View File

@ -1,12 +0,0 @@
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('FormasPagoes.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control" value="<?=old('nombre', $formasPagoEntity->nombre) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -1,26 +0,0 @@
<?= $this->include("themes_commonPartialsBs/select2bs5") ?>
<?= $this->include("themes_commonPartialsBs/sweetalert") ?>
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
<?= $this->section("content") ?>
<div class="row">
<div class="col-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
</div><!--//.card-header -->
<form id="formaPagoForm" method="post" action="<?= $formAction ?>">
<?= csrf_field() ?>
<div class="card-body">
<?= view("themes_commonPartialsBs/_alertBoxes") ?>
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
<?= view("themes/backend/vuexy/form/configuracion/formas-pago/_formaPagoFormItems") ?>
</div><!-- /.card-body -->
<div class="card-footer">
<?= anchor(route_to("formaPagoList2"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
<input type="submit" class="btn btn-primary float-end" name="save" value="<?= lang("Basic.global.Save") ?>">
</div><!-- /.card-footer -->
</form>
</div><!-- //.card -->
</div><!--//.col -->
</div><!--//.row -->
<?= $this->endSection() ?>

View File

@ -1,141 +0,0 @@
<?=$this->include('themes_commonPartialsBs/datatables') ?>
<?=$this->include('themes_commonPartialsBs/sweetalert') ?>
<?=$this->extend('themes'.config('Basics')->theme['name'].'/AdminLayout/defaultLayout') ?>
<?=$this->section('content'); ?>
<div class="row">
<div class="col-md-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?=lang('FormasPagoes.formaPagoList') ?></h3>
</div><!--//.card-header -->
<div class="card-body">
<?= view('themes_commonPartialsBs/_alertBoxes'); ?>
<table id="tableOfFormaspago" class="table table-striped table-hover using-exportable-data-table" style="width: 100%;">
<thead>
<tr>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
<th><?= lang('FormasPagoes.id') ?></th>
<th><?= lang('FormasPagoes.nombre') ?></th>
<th><?= lang('FormasPagoes.createdAt') ?></th>
<th><?= lang('FormasPagoes.updatedAt') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($formaPagoList as $item ) : ?>
<tr>
<td class="align-middle text-center text-nowrap">
<?=anchor(route_to('editFormaPago', $item->id), lang('Basic.global.edit'), ['class'=>'btn btn-sm btn-warning btn-edit me-1', 'data-id'=>$item->id,]); ?>
<?=anchor('#confirm2delete', lang('Basic.global.Delete'), ['class'=>'btn btn-sm btn-danger btn-delete ms-1', 'data-href'=>route_to('deleteFormaPago', $item->id)]); ?>
</td>
<td class="align-middle text-center">
<?=$item->id ?>
</td>
<td class="align-middle">
<?= empty($item->nombre) || strlen($item->nombre) < 51 ? esc($item->nombre) : character_limiter(esc($item->nombre), 50) ?>
</td>
<td class="align-middle text-nowrap">
<?= empty($item->created_at) ? '' : date('mm/dd/YYYY H:i', strtotime($item->created_at)) ?>
</td>
<td class="align-middle text-nowrap">
<?= empty($item->updated_at) ? '' : date('mm/dd/YYYY H:i', strtotime($item->updated_at)) ?>
</td>
<td class="align-middle text-center text-nowrap">
<?=anchor(route_to('editFormaPago', $item->id), lang('Basic.global.edit'), ['class'=>'btn btn-sm btn-warning btn-edit me-1', 'data-id'=>$item->id,]); ?>
<?=anchor('#confirm2delete', lang('Basic.global.Delete'), ['class'=>'btn btn-sm btn-danger btn-delete ms-1', 'data-href'=>route_to('deleteFormaPago', $item->id)]); ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div><!--//.card-body -->
<div class="card-footer">
<?=anchor(route_to('newFormaPago'), lang('Basic.global.addNew').' '.lang('FormasPagoes.formaPago'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-footer -->
</div><!--//.card -->
</div><!--//.col -->
</div><!--//.row -->
<?=$this->endSection() ?>
<?=$this->section('additionalInlineJs') ?>
const lastColNr2 = $(".using-exportable-data-table").find("tr:first th").length - 1;
theTable = $('.using-exportable-data-table').DataTable({
"responsive": true,
"paging": true,
"lengthMenu": [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
"pageLength": 10,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"dom": 'lfrtipB', // 'lfBrtip', // you can try different layout combinations by uncommenting one or the other
// "dom": '<"top"lf><"clear">rt<"bottom"ipB><"clear">', // remember to comment this line if you uncomment the above
"buttons": [
'copy', 'csv', 'excel', 'print', {
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'A4'
}
],
"autoWidth": true,
"scrollX": true,
"stateSave": true,
"language": {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
"columnDefs": [
{
orderable: false,
searchable: false,
targets: [0,lastColNr2]
}
]
});
$(document).on('click', '.btn-delete', function(e) {
e.preventDefault();
const dataHref = $(this).data('href');
Swal.fire({
title: "<?= lang('Basic.global.sweet.sureToDeleteTitle', [lang('FormasPagoes.forma pago')]) ?>",
text: "<?= lang('Basic.global.sweet.sureToDeleteText') ?>",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
cancelButtonColor: '#d33'
}).then((result) => {
if (result.value) {
window.location.href = `${dataHref}`;
}
});
});
<?=$this->endSection() ?>
<?=$this->section('css') ?>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.bootstrap5.min.css">
<?=$this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.bootstrap5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.0/jszip.min.js" integrity="sha512-xcHCGC5tQ0SHlRX8Anbz6oy/OullASJkEhb4gjkneVpGE3/QGYejf14CUO5n5q5paiHfRFTa9HKgByxzidw2Bw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/pdfmake.min.js" integrity="sha512-rDbVu5s98lzXZsmJoMa0DjHNE+RwPJACogUCLyq3Xxm2kJO6qsQwjbE5NDk2DqmlKcxDirCnU1wAzVLe12IM3w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/vfs_fonts.js" integrity="sha512-cktKDgjEiIkPVHYbn8bh/FEyYxmt4JDJJjOCu5/FQAkW4bc911XtKYValiyzBiJigjVEvrIAyQFEbRJZyDA1wQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<?=$this->endSection() ?>

View File

@ -101,16 +101,16 @@
<?= lang('Maquinas.forzarNumFormasHorizontalesPortada') ?>
</label>
<input type="number" id="forzarNumFormasHorizontalesPortada"
name="forzar_num_formas_horizontales_portada" maxLength="11" class="form-control"
value="<?= old('forzar_num_formas_horizontales_portada', $maquina->forzar_num_formas_horizontales_portada) ?>">
name="forzar_num_formas_horizontales_cubierta" maxLength="11" class="form-control"
value="<?= old('forzar_num_formas_horizontales_cubierta', $maquina->forzar_num_formas_horizontales_cubierta) ?>">
</div>
<div class="col-md-3">
<label for="forzarNumFormasVerticalesPortada" class="form-label">
<?= lang('Maquinas.forzarNumFormasVerticalesPortada') ?>
</label>
<input type="number" id="forzarNumFormasVerticalesPortada"
name="forzar_num_formas_verticales_portada" maxLength="11" class="form-control"
value="<?= old('forzar_num_formas_verticales_portada', $maquina->forzar_num_formas_verticales_portada) ?>">
name="forzar_num_formas_verticales_cubierta" maxLength="11" class="form-control"
value="<?= old('forzar_num_formas_verticales_cubierta', $maquina->forzar_num_formas_verticales_cubierta) ?>">
</div>
<div class="col-md-12">
<label for="observaciones" class="form-label">

View File

@ -78,8 +78,7 @@
<table id="tableOfCalles" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('MaquinasCalles.formas_min') ?></th>
<th><?= lang('MaquinasCalles.formas_max') ?></th>
<th><?= lang('MaquinasCalles.formas') ?></th>
<th><?= lang('MaquinasCalles.internas') ?></th>
<th><?= lang('MaquinasCalles.externas') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
@ -479,13 +478,14 @@
processing: true,
autoWidth: true,
responsive: true,
lengthMenu: [ 5, 10, 25],
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250],
order: [[ 1, "asc" ]],
pageLength: 10,
pageLength: 25,
lengthChange: true,
searching: true,
paging: true,
info: true,
stateSave: true,
dom: "lftp",
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfMaquinasPapelesImpresion') ?>',
@ -522,8 +522,11 @@
columnDefs: [
{
orderable: false,
searchable: false,
targets: [lastColNr2]
},
{
searchable: false,
targets: [0,3,4,5,6,7,8,lastColNr2]
}
],
rowCallback: function (row, data) {
@ -532,13 +535,7 @@
},
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
columnDefs: [
{
searchable: false,
targets: [0,3,4,5,6,7,8]
}
],
}
} );
@ -657,9 +654,7 @@
table : "#tableOfCalles",
idSrc: 'id',
fields: [ {
name: "formas_min"
}, {
name: "formas_max"
name: "formas"
}, {
name: "internas"
}, {
@ -728,8 +723,7 @@
async: true,
}),
columns : [
{ 'data': 'formas_min' },
{ 'data': 'formas_max' },
{ 'data': 'formas' },
{ 'data': 'internas' },
{ 'data': 'externas' },
{ data: actionBtns,

View File

@ -0,0 +1,175 @@
<div class="accordion mt-3" id="accordionComentarios">
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingOne">
<button type="button" class="accordion-button" data-bs-toggle="collapse"
data-bs-target="#accordionComentariosTip" aria-expanded="false"
aria-controls="accordionComentariosTip">
<h4><?= lang("Presupuestos.comentarios") ?></h4>
</button>
</h2>
<div id="accordionComentariosTip" class="accordion-collapse collapse show"
data-bs-parent="#accordionComentarios">
<div class="accordion-body">
<div class="nav-align-top mb-4">
<ul class="nav nav-pills mb-3" role="tablist">
<li class="nav-item">
<button
type="button"
class="nav-link active"
role="tab"
data-bs-toggle="tab"
data-bs-target="#comentarios-cliente"
aria-controls="comentarios-cliente"
aria-selected="true">
<?= lang("Presupuestos.comentariosCliente") ?>
<span
id="mostrar_comentarios_cliente"
style="display: none"
class="badge rounded-pill badge-center h-px-20 w-px-20 bg-warning ms-1">
!
</span>
</button>
</li>
<li class="nav-item">
<button
type="button"
class="nav-link"
role="tab"
data-bs-toggle="tab"
data-bs-target="#comentarios-safekat"
aria-controls="comentarios-safekat"
aria-selected="false">
<?= lang("Presupuestos.comentariosSafekat") ?>
<span
id="mostrar_comentarios_safekat"
style="display: none"
class="badge rounded-pill badge-center h-px-20 w-px-20 bg-warning ms-1">
!
</span>
</button>
</li>
<li class="nav-item">
<button
type="button"
class="nav-link"
role="tab"
data-bs-toggle="tab"
data-bs-target="#comentarios-presupuesto"
aria-controls="comentarios-presupuesto"
aria-selected="false">
<?= lang("Presupuestos.comentariosPresupuesto") ?>
<span
id="mostrar_comentarios_pdf"
style="display: none"
class="badge rounded-pill badge-center h-px-20 w-px-20 bg-warning ms-1">
!
</span>
</button>
</li>
<li class="nav-item">
<button
type="button"
class="nav-link"
role="tab"
data-bs-toggle="tab"
data-bs-target="#comentarios-produccion"
aria-controls="comentarios-produccion"
aria-selected="false">
<?= lang("Presupuestos.comentariosProduccion") ?>
<span
id="mostrar_comentarios_produccion"
style="display: none"
class="badge rounded-pill badge-center h-px-20 w-px-20 bg-warning ms-1">
!
</span>
</button>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade show active" id="comentarios-cliente" role="tabpanel">
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<textarea
rows="3"
id="comentariosCliente"
name="comentarios_cliente"
required style="height: 10em;"
class="form-control"><?= old('comentarios', $presupuestoEntity->comentarios_cliente) ?></textarea>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="comentarios-safekat" role="tabpanel">
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<textarea
rows="3"
id="comentariosSafekat"
name="comentarios_safekat"
required
style="height: 10em;"
class="form-control"><?=old('comentarios_safekat', $presupuestoEntity->comentarios_safekat) ?></textarea>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="comentarios-presupuesto" role="tabpanel">
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<textarea
rows="3"
id="comentariosPdf"
name="comentarios_pdf"
required style="height: 10em;"
class="form-control"><?=old('comentarios_pdf', $presupuestoEntity->comentarios_pdf) ?></textarea>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="comentarios-produccion" role="tabpanel">
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<textarea
rows="3"
id="comentariosProduccion"
name="comentarios_produccion"
required
style="height: 10em;"
class="form-control"><?=old('comentarios_pdf', $presupuestoEntity->comentarios_produccion) ?></textarea>
</div>
</div>
</div>
</div>
</div>
</div>
</div> <!-- //.accordion-body -->
</div> <!-- //.accordion-collapse -->
</div> <!-- //.accordion-item -->
</div> <!-- //.accordion -->
<!------------------------------------------------------->
<!-- Código JS comportamiento ?????. -->
<!------------------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
$("textarea[name*='comentarios_']").each(function(){
if (!$.trim($(this).val())) {
// textarea is empty or contains only white-space
$("#mostrar_" + $(this).attr('name')).hide();
}else{
$("#mostrar_" + $(this).attr('name')).show();
}
});
<?= $this->endSection() ?>

View File

@ -204,26 +204,11 @@
<div class="mb-3">
<label for="comentarios" class="form-label">
<?=lang('Presupuestos.comentarios') ?>*
</label>
<textarea rows="3" id="comentarios" name="comentarios" required style="height: 10em;" class="form-control"><?=old('comentarios', $presupuestoEntity->comentarios) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="comentariosSafekat" class="form-label">
<?=lang('Presupuestos.comentariosSafekat') ?>*
</label>
<textarea rows="3" id="comentariosSafekat" name="comentarios_safekat" required style="height: 10em;" class="form-control"><?=old('comentarios_safekat', $presupuestoEntity->comentarios_safekat) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="comentariosPdf" class="form-label">
<?=lang('Presupuestos.comentariosPdf') ?>*
</label>
<textarea rows="3" id="comentariosPdf" name="comentarios_pdf" required style="height: 10em;" class="form-control"><?=old('comentarios_pdf', $presupuestoEntity->comentarios_pdf) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="comentariosTarifa" class="form-label">

View File

@ -95,16 +95,16 @@
<label for="merma" class="form-label">
<?= lang('Presupuestos.merma') ?>*
</label>
<input type="number" id="merma" name="merma" maxLength="8" step="0.01" class="form-control" value="<?= old('merma', $presupuestoEntity->merma) ?>">
<input type="number" id="merma" name="merma" maxLength="8" step="1" class="form-control" value="<?= old('merma', $presupuestoEntity->merma) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-2 px-4">
<div class="mb-3">
<label for="mermaportada" class="form-label">
<?= lang('Presupuestos.mermaportada') ?>*
<label for="mermacubierta" class="form-label">
<?= lang('Presupuestos.mermacubierta') ?>*
</label>
<input type="number" id="mermaportada" name="merma_sobrecubierta" placeholder="6.00" maxLength="8" step="0.01" class="form-control" value="<?= old('merma_sobrecubierta', $presupuestoEntity->merma_sobrecubierta) ?>">
<input type="number" id="mermacubierta" name="merma_cubierta" placeholder="10" maxLength="8" step="1" class="form-control" value="<?= old('merma_cubierta', $presupuestoEntity->merma_cubierta) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->

View File

@ -69,21 +69,21 @@
<p><?= lang('MaquinasTarifasImpresions.negro') ?></p>
</div>
<div class="col-md-12 col-lg-2 px-4">
<input type="number" id="compPaginasNegro" name="comp_paginas_negro" placeholder="0" maxLength="5" class="form-control" value="<?= isset($presupuestoEntity->comparador_json_data->negro) ? (old(0, $presupuestoEntity->comparador_json_data->negro->paginas)) : '0' ?>">
<input type="text" id="compPaginasNegro" name="comp_paginas_negro" placeholder="0" maxLength="5" class="form-control comp_negro_items" value="<?= isset($presupuestoEntity->comparador_json_data->negro) ? (old(0, $presupuestoEntity->comparador_json_data->negro->paginas)) : '0' ?>">
</div>
<div class="col-md-12 col-lg-6 px-4">
<select id="compPapelNegro" name="comp_papel_negro" class="form-control select2bs2" style="width: 100%;">
<?php if (isset($papelGenericoNegroList) && is_array($papelGenericoNegroList) && !empty($papelGenericoNegroList)) :
foreach ($papelGenericoNegroList as $k => $v) : ?>
<option value="<?= $k ?>" /*<?= $k == $presupuestoEntity->tipo_impresion_id ? ' selected' : '' ?>* />
<?= $v ?>
<option value="<?= $v->id ?>">
<?= $v->nombre ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div>
<div class="col-md-12 col-lg-2 px-4">
<select id="compGramajeNegro" name="comp_gramaje_negro" class="form-control select2bs2" disabled style="width: 100%;">
<select id="compGramajeNegro" name="comp_gramaje_negro" class="form-control select2bs2 comp_negro_items" disabled style="width: 100%;">
</select>
</div>
<div>
@ -97,21 +97,21 @@
<p><?= lang('MaquinasTarifasImpresions.negrohq') ?></p>
</div>
<div class="col-md-12 col-lg-2 px-4">
<input type="number" id="compPaginasNegrohq" name="comp_paginas_negrohq" placeholder="0" maxLength="5" class="form-control" value="<?= isset($presupuestoEntity->comparador_json_data->negro) ? (old(0, $presupuestoEntity->comparador_json_data->negro->paginas)) : '0' ?>">
<input type="text" id="compPaginasNegrohq" name="comp_paginas_negrohq" placeholder="0" maxLength="5" class="form-control comp_negrohq_items" value="<?= isset($presupuestoEntity->comparador_json_data->negro) ? (old(0, $presupuestoEntity->comparador_json_data->negro->paginas)) : '0' ?>">
</div>
<div class="col-md-12 col-lg-6 px-4">
<select id="compPapelNegrohq" name="comp_papel_negrohq" class="form-control select2bs2" style="width: 100%;">
<select id="compPapelNegrohq" name="comp_papel_negrohq" class="form-control select2bs2 comp_negrohq_items" style="width: 100%;">
<?php if (isset($papelGenericoNegroHQList) && is_array($papelGenericoNegroHQList) && !empty($papelGenericoNegroHQList)) :
foreach ($papelGenericoNegroHQList as $k => $v) : ?>
<option value="<?= $k ?>" /*<?= $k == $presupuestoEntity->tipo_impresion_id ? ' selected' : '' ?>* />
<?= $v ?>
<option value="<?= $v->id ?>">
<?= $v->nombre ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div>
<div class="col-md-12 col-lg-2 px-4">
<select id="compGramajeNegrohq" name="comp_gramaje_negrohq" class="form-control select2bs2" disabled style="width: 100%;">
<select id="compGramajeNegrohq" name="comp_gramaje_negrohq" class="form-control select2bs2 comp_negrohq_items" disabled style="width: 100%;">
</select>
</div>
<div>
@ -125,21 +125,21 @@
<p><?= lang('MaquinasTarifasImpresions.color') ?></p>
</div>
<div class="col-md-12 col-lg-2 px-4">
<input type="number" id="compPaginasColor" name="comp_paginas_color" placeholder="0" maxLength="5" class="form-control" value="<?= isset($presupuestoEntity->comparador_json_data->color) ? (old(0, $presupuestoEntity->comparador_json_data->color->paginas)) : '0' ?>">
<input type="text" id="compPaginasColor" name="comp_paginas_color" placeholder="0" maxLength="5" class="form-control comp_color_items" value="<?= isset($presupuestoEntity->comparador_json_data->color) ? (old(0, $presupuestoEntity->comparador_json_data->color->paginas)) : '0' ?>">
</div>
<div class="col-md-12 col-lg-6 px-4">
<select id="compPapelColor" name="comp_papel_color" class="form-control select2bs2" style="width: 100%;">
<select id="compPapelColor" name="comp_papel_color" class="form-control select2bs2 comp_color_items" style="width: 100%;">
<?php if (isset($papelGenericoColorList) && is_array($papelGenericoColorList) && !empty($papelGenericoColorList)) :
foreach ($papelGenericoColorList as $k => $v) : ?>
<option value="<?= $k ?>" /*<?= $k == $presupuestoEntity->tipo_impresion_id ? ' selected' : '' ?>* />
<?= $v ?>
<option value="<?= $v->id ?>">
<?= $v->nombre ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div>
<div class="col-md-12 col-lg-2 px-4">
<select id="compGramajeColor" name="comp_gramaje_color" class="form-control select2bs2" disabled style="width: 100%;">
<select id="compGramajeColor" name="comp_gramaje_color" class="form-control select2bs2 comp_color_items" disabled style="width: 100%;">
</select>
</div>
<div>
@ -153,21 +153,21 @@
<p><?= lang('MaquinasTarifasImpresions.colorhq') ?></p>
</div>
<div class="col-md-12 col-lg-2 px-4">
<input type="number" id="compPaginasColorhq" name="comp_paginas_colorhq" placeholder="0" maxLength="5" class="form-control" value="<?= isset($presupuestoEntity->comparador_json_data->color) ? (old(0, $presupuestoEntity->comparador_json_data->color->paginas)) : '0' ?>">
<input type="text" id="compPaginasColorhq" name="comp_paginas_colorhq" placeholder="0" maxLength="5" class="form-control comp_colorhq_items" value="<?= isset($presupuestoEntity->comparador_json_data->color) ? (old(0, $presupuestoEntity->comparador_json_data->color->paginas)) : '0' ?>">
</div>
<div class="col-md-12 col-lg-6 px-4">
<select id="compPapelColorhq" name="comp_papel_colorhq" class="form-control select2bs2" style="width: 100%;">
<select id="compPapelColorhq" name="comp_papel_colorhq" class="form-control select2bs2 comp_colorhq_items" style="width: 100%;">
<?php if (isset($papelGenericoColorHQList) && is_array($papelGenericoColorHQList) && !empty($papelGenericoColorHQList)) :
foreach ($papelGenericoColorHQList as $k => $v) : ?>
<option value="<?= $k ?>" /*<?= $k == $presupuestoEntity->tipo_impresion_id ? ' selected' : '' ?>* />
<?= $v ?>
<option value="<?= $v->id ?>">
<?= $v->nombre ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div>
<div class="col-md-12 col-lg-2 px-4">
<select id="compGramajeColorhq" name="comp_gramaje_colorhq" class="form-control select2bs2" disabled style="width: 100%;">
<select id="compGramajeColorhq" name="comp_gramaje_colorhq" class="form-control select2bs2 comp_colorhq_items" disabled style="width: 100%;">
</select>
</div>
<div>
@ -179,30 +179,30 @@
<div class="row">
<div class="col-md-12 col-lg-2 px-4">
<p><?= lang('PapelImpresion.cubierta') ?></p>
</div>
</div>
<div class="col-md-12 col-lg-2 px-4">
<select id="compPaginasCubierta" name="comp_paginas_cubierta" class="form-control select2bs2" style="width: 100%;">
<option value="1" >
<select id="compCarasCubierta" name="comp_paginas_cubierta" class="form-control select2bs2 comp_cubierta_items" style="width: 100%;">
<option value="2">
<p><?= lang('Presupuestos.1cara') ?></p>
</option>
<option value="2" >
<option value="4">
<p><?= lang('Presupuestos.2caras') ?></p>
</option>
</select>
</div>
<div class="col-md-12 col-lg-6 px-4">
<select id="compPapelCubierta" name="comp_papel_cubierta" class="form-control select2bs2" style="width: 100%;">
<?php if (isset($papelGenericoSobrecubiertaList) && is_array($papelGenericoSobrecubiertaList) && !empty($papelGenericoSobrecubiertaList)) :
foreach ($papelGenericoSobrecubiertaList as $k => $v) : ?>
<option value="<?= $k ?>" /*<?= $k == $presupuestoEntity->tipo_impresion_id ? ' selected' : '' ?>* />
<?= $v ?>
<select id="compPapelCubierta" name="comp_papel_cubierta" class="form-control select2bs2 comp_cubierta_items" style="width: 100%;">
<?php if (isset($papelGenericoCubiertaList) && is_array($papelGenericoCubiertaList) && !empty($papelGenericoCubiertaList)) :
foreach ($papelGenericoCubiertaList as $k => $v) : ?>
<option value="<?= $v->id ?>">
<?= $v->nombre ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div>
<div class="col-md-12 col-lg-2 px-4">
<select id="compGramajeCubierta" name="comp_gramaje_cubierta" class="form-control select2bs2" disabled style="width: 100%;">
<select id="compGramajeCubierta" name="comp_gramaje_cubierta" class="form-control select2bs2 comp_cubierta_items" disabled style="width: 100%;">
</select>
</div>
<div>
@ -246,17 +246,15 @@
<div class="accordion mt-3" id="accordionCompInteriorPlana">
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingOne">
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionCompInteriorPlanaTip" aria-expanded="false" aria-controls="accordionCompInteriorPlanaTip">
<h6><?= lang("Presupuestos.compInteriorPlana") ?></h4>
<button id="accordion-button-int-plana" type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionCompInteriorPlanaTip" aria-expanded="false" aria-controls="accordionCompInteriorPlanaTip">
<h6 id="title_int_plana"><?= lang("Presupuestos.compInteriorPlana") ?></h6>
</button>
</h2>
<div id="accordionCompInteriorPlanaTip" class="accordion-collapse collapse" data-bs-parent="#accordionCompInteriorPlana">
<div class="accordion-body">
<table id="tableCompIntPlana" class="comparator-table table dt-responsive dataTable">
<table id="tableCompIntPlana" class="comparator-table table dt-responsive dataTable" style="width: 100%;">
<thead>
<tr>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.tipo') ?></th>
@ -274,10 +272,6 @@
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.peso') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.click') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.totalClicks') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.precioPagNegro') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.precioPagColor') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.totalTinta') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.totalCorte') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.total') ?></th>
</tr>
</thead>
@ -285,12 +279,21 @@
</tbody>
<tfoot>
<tr>
<td class="dt-result dt-result-text" colspan="18"><?= lang('Presupuestos.total') ?> <?= lang("Presupuestos.compInteriorPlana") ?>:</td>
<td class="dt-result dt-result-value" colspan="2"> 0.00 </td>
<td class="dt-result dt-result-text" colspan="14"><?= lang('Presupuestos.total') ?> <?= lang("Presupuestos.compInteriorPlana") ?>:</td>
<td id="total_comp_plana" class="dt-result dt-result-value" colspan="2"> 0.00 </td>
</tr>
</tfoot>
</table>
<div >
<button type="button" name="insertarPlanaBtn"
id="insertarPlanaBtn"
class="btn btn-primary float-end me-sm-3 me-1 mb-3 insertarLinea d-none">
<?= lang('Presupuestos.insertarLinea').' '.strtoupper(lang('Presupuestos.plana')) ?>
</button>
</div>
</div>
</div>
</div>
@ -300,8 +303,8 @@
<div class="accordion mt-3" id="accordionCompInteriorRotativa">
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingTwo">
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionCompInteriorRotativaTip" aria-expanded="false" aria-controls="accordionCompInteriorRotativaTip">
<h6><?= lang("Presupuestos.compInteriorRotativa") ?></h4>
<button id="accordion-button-int-rotativa" type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionCompInteriorRotativaTip" aria-expanded="false" aria-controls="accordionCompInteriorRotativaTip">
<h6 id="title_int_rot"><?= lang("Presupuestos.compInteriorRotativa") ?></h6>
</button>
</h2>
@ -309,7 +312,7 @@
<div class="accordion-body">
<table id="tableCompIntRotativa" class="comparator-table table dt-responsive dataTable">
<table id="tableCompIntRotativa" class="comparator-table table dt-responsive dataTable" style="width: 100%;">
<thead>
<tr>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.tipo') ?></th>
@ -317,6 +320,7 @@
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.papel') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.gramaje') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.marca') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.aFavorFibra') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.maquina') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.numeroPliegos') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.pliegosPedido') ?></th>
@ -338,12 +342,20 @@
</tbody>
<tfoot>
<tr>
<td class="dt-result dt-result-text" colspan="18"><?= lang('Presupuestos.total') ?> <?= lang("Presupuestos.compInteriorRotativa") ?>:</td>
<td class="dt-result dt-result-value" colspan="2">0.00</td>
<td class="dt-result dt-result-text" colspan="19"><?= lang('Presupuestos.total') ?> <?= lang("Presupuestos.compInteriorRotativa") ?>:</td>
<td id="total_comp_rot" class="dt-result dt-result-value" colspan="2">0.00</td>
</tr>
</tfoot>
</table>
<div >
<button type="button" name="insertarRotativaBtn"
id="insertarRotativaBtn"
class="btn btn-primary float-end me-sm-3 me-1 mb-3 insertarLinea d-none">
<?= lang('Presupuestos.insertarLinea').' '.strtoupper(lang('Presupuestos.rotativa')) ?>
</button>
</div>
</div>
</div>
</div>
@ -352,15 +364,15 @@
<div class="accordion mt-3" id="accordionCompCubiertaSobrecubierta">
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingThree">
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionCompCubiertaSobrecubiertaTip" aria-expanded="false" aria-controls="accordionCompCubiertaSobrecubiertaTip">
<h6><?= lang("Presupuestos.cubierta") ?></h4>
<button id="accordion-button-cubierta" type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionCompCubiertaSobrecubiertaTip" aria-expanded="false" aria-controls="accordionCompCubiertaSobrecubiertaTip">
<h6 id="title_cubierta"><?= lang("Presupuestos.cubierta") ?></h6>
</button>
</h2>
<div id="accordionCompCubiertaSobrecubiertaTip" class="accordion-collapse collapse" data-bs-parent="#accordionCompCubiertaSobrecubierta">
<div class="accordion-body">
<table id="tableCompCubierta" class="comparator-table table dt-responsive dataTable">
<table id="tableCompCubierta" class="comparator-table table dt-responsive dataTable" style="width: 100%;">
<thead>
<tr>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.tipo') ?></th>
@ -378,10 +390,6 @@
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.peso') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.click') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.totalClicks') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.precioPagNegro') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.precioPagColor') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.totalTinta') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.totalCorte') ?></th>
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.total') ?></th>
</tr>
</thead>
@ -389,13 +397,20 @@
</tbody>
<tfoot>
<tr>
<td class="dt-result dt-result-text" colspan="18"><?= lang('Presupuestos.total') ?> <?= lang('Presupuestos.cubierta') ?>:</td>
<td class="dt-result dt-result-value" colspan="2">0.00</td>
<td class="dt-result dt-result-text" colspan="14"><?= lang('Presupuestos.total') ?> <?= lang("Presupuestos.compInteriorPlana") ?>:</td>
<td id="total_comp_cubierta" class="dt-result dt-result-value" colspan="2"> 0.00 </td>
</tr>
</tfoot>
</table>
<div>
<button type="button" name="insertarCubiertaBtn"
id="insertarCubiertaBtn"
class="btn btn-primary float-end me-sm-3 me-1 mb-3 insertarLinea d-none">
<?= lang('Presupuestos.insertarLinea').' '.strtoupper(lang('Presupuestos.cubierta')) ?>
</button>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,712 @@
<div class="accordion mt-3" id="accordionDatosServicios">
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingOne">
<button type="button" class="accordion-button" data-bs-toggle="collapse"
data-bs-target="#accordionDatosServiciosTip" aria-expanded="false"
aria-controls="accordionDatosServiciosTip">
<h4><?= lang("Presupuestos.datosServicios") ?></h4>
</button>
</h2>
<div id="accordionDatosServiciosTip" class="accordion-collapse collapse show"
data-bs-parent="#accordionDatosServicios">
<div class="accordion-body">
<div class="nav-align-top mb-4">
<ul class="nav nav-pills mb-3" role="tablist">
<li class="nav-item">
<button
type="button"
class="nav-link active"
role="tab"
data-bs-toggle="tab"
data-bs-target="#servicios-acabado"
aria-controls="servicios-acabado"
aria-selected="true">
<?= lang("Presupuestos.servicioAcabado") ?>
</button>
</li>
<li class="nav-item">
<button
type="button"
class="nav-link"
role="tab"
data-bs-toggle="tab"
data-bs-target="#servicios-preimpresion"
aria-controls="servicios-preimpresion"
aria-selected="false">
<?= lang("Presupuestos.servicioPreimpresion") ?>
</button>
</li>
<li class="nav-item">
<button
type="button"
class="nav-link"
role="tab"
data-bs-toggle="tab"
data-bs-target="#servicios-encuadernacion"
aria-controls="servicios-encuadernacion"
aria-selected="false">
<?= lang("Presupuestos.servicioEncuadernado") ?>
</button>
</li>
<li class="nav-item">
<button
type="button"
class="nav-link"
role="tab"
data-bs-toggle="tab"
data-bs-target="#servicios-manipulado"
aria-controls="servicios-manipulado"
aria-selected="false">
<?= lang("Presupuestos.servicioManipulado") ?>
</button>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade show active" id="servicios-acabado" role="tabpanel">
<table id="tableOfServiciosAcabado" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('Tarifaacabado.tarifaacabado') ?></th>
<th><?= lang('Presupuestos.precioUnidad') ?></th>
<th><?= lang('Presupuestos.precioTotal') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="tab-pane fade" id="servicios-preimpresion" role="tabpanel">
<table id="tableOfServiciosPreimpresion" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('Tarifapreimpresion.tarifapreimpresion') ?></th>
<th><?= lang('Presupuestos.precioUnidad') ?></th>
<th><?= lang('Presupuestos.precioTotal') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="tab-pane fade" id="servicios-encuadernacion" role="tabpanel">
<table id="tableOfServiciosEncuadernacion" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('Tarifaencuadernacion.tarifaencuadernacion') ?></th>
<th><?= lang('Presupuestos.precioUnidad') ?></th>
<th><?= lang('Presupuestos.precioTotal') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="tab-pane fade" id="servicios-manipulado" role="tabpanel">
<table id="tableOfServiciosManipulado" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('Tarifamanipulado.tarifamanipulado') ?></th>
<th><?= lang('Presupuestos.precioUnidad') ?></th>
<th><?= lang('Presupuestos.precioTotal') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div> <!-- //.accordion-body -->
</div> <!-- //.accordion-collapse -->
</div> <!-- //.accordion-item -->
</div> <!-- //.accordion -->
<!------------------------------------------------------->
<!-- Código JS comportamiento tabla servicios acabado. -->
<!------------------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
const lastColNr = $('#tableOfServiciosAcabado').find("tr:first th").length - 1;
const url = window.location.href;
const url_parts = url.split('/');
if(url_parts[url_parts.length-2] == 'edit'){
id = url_parts[url_parts.length-1];
}
else{
id = 200000; // id=-1
}
const actionBtns = function(data) {
return `
<span class="edit"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a></span>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
<span class="cancel"></span>
`;
};
editor = new $.fn.dataTable.Editor( {
ajax: {
url: "<?= route_to('editorOfPresupuestoAcabados') ?>",
headers: {
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
},
},
table : "#tableOfServiciosAcabado",
idSrc: 'id',
fields: [ {
"name": "tarifa_acabado_id",
"type": "select"
}, {
"name": "precio_unidad"
}, {
"name": "precio_total"
}, {
"name": "presupuesto_id",
"type": "hidden"
},
]
} );
// Generación de la lista de servicios de acabado (id, nombre)
const acabadosList = <?php echo json_encode($serviciosAcabado); ?>;
editor.field( 'tarifa_acabado_id' ).update( acabadosList );
editor.on( 'preSubmit', function ( e, d, type ) {
if ( type === 'create'){
d.data[0]['presupuesto_id'] = id;
}
else if(type === 'edit' ) {
for (v in d.data){
d.data[v]['presupuesto_id'] = id;
}
}
});
editor.on( 'postSubmit', function ( e, json, data, action ) {
yeniden(json.<?= csrf_token() ?>);
});
editor.on( 'submitSuccess', function ( e, json, data, action ) {
theTable.clearPipeline();
theTable.draw();
});
// Activate an inline edit on click of a table cell
$('#tableOfServiciosAcabado').on( 'click', 'tbody span.edit', function (e) {
editor.inline(
theTable.cells(this.parentNode.parentNode, '*').nodes(),
{
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
cancelTrigger: 'span.cancel',
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
submitTrigger: 'span.edit',
submit: 'allIfChanged'
}
);
} );
// Delete row
$(document).on('click', '.btn-delete', function(e) {
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
});
$(document).on('click', '.btn-remove', function(e) {
const dataId = $(this).attr('data-id');
const row = $(this).closest('tr');
if ($.isNumeric(dataId)) {
$.ajax({
url: `/serviciosacabados/delete/${dataId}`,
method: 'GET',
}).done((data, textStatus, jqXHR) => {
$('#confirm2delete').modal('toggle');
theTable.clearPipeline();
theTable.row($(row)).invalidate().draw();
popSuccessAlert(data.msg ?? jqXHR.statusText);
}).fail((jqXHR, textStatus, errorThrown) => {
popErrorAlert(jqXHR.responseJSON.messages.error)
})
}
});
var theTable = $('#tableOfServiciosAcabado').DataTable( {
serverSide: true,
processing: true,
autoWidth: true,
responsive: true,
lengthMenu: [ 5, 10, 25],
order: [[ 0, "asc" ], [ 1, "asc" ]],
pageLength: 10,
lengthChange: true,
searching: false,
paging: true,
info: false,
dom: '<"mt-4"><"float-start"l><t><"mt-4 mb-3"p>',
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfPresupuestoAcabados') ?>',
data: {
id_presupuesto: id,
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columns: [
{'data': 'tarifa_acabado_id',
render: function(data, type, row, meta) {
var value = acabadosList.find(element => element.value === data);
return value['label'];
},
},
{ 'data': 'precio_unidad' },
{ 'data': 'precio_total' },
{
data: actionBtns,
className: 'row-edit dt-center'
}
],
columnDefs: [
{
orderable: false,
searchable: false,
targets: [lastColNr]
},
{
"orderData": [ 0, 1 ],
"targets": 0
},
],
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
buttons: [ {
className: 'btn btn-primary float-end me-sm-3 me-1',
extend: "createInline",
editor: editor,
formOptions: {
submitTrigger: -1,
submitHtml: '<i class="ti ti-device-floppy"/>'
}
} ]
} );
<?= $this->endSection() ?>
<!-------------------------------------------------------------->
<!-- Código JS comportamiento tabla servicios encuadernacion. -->
<!-------------------------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
const lastColNr2 = $('#tableOfServiciosEncuadernacion').find("tr:first th").length - 1;
editor2 = new $.fn.dataTable.Editor( {
ajax: {
url: "<?= route_to('editorOfPresupuestoEncuadernaciones') ?>",
headers: {
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
},
},
table : "#tableOfServiciosEncuadernacion",
idSrc: 'id',
fields: [ {
"name": "tarifa_encuadernado_id",
"type": "select"
}, {
"name": "precio_unidad"
}, {
"name": "precio_total"
}, {
"name": "presupuesto_id",
"type": "hidden"
},
]
} );
// Generación de la lista de servicios de acabado (id, nombre)
const encuadernadosList = <?php echo json_encode($serviciosEncuadernacion); ?>;
editor2.field( 'tarifa_encuadernado_id' ).update( encuadernadosList );
editor2.on( 'preSubmit', function ( e, d, type ) {
if ( type === 'create'){
d.data[0]['presupuesto_id'] = id;
}
else if(type === 'edit' ) {
for (v in d.data){
d.data[v]['presupuesto_id'] = id;
}
}
});
editor2.on( 'postSubmit', function ( e, json, data, action ) {
yeniden(json.<?= csrf_token() ?>);
});
editor2.on( 'submitSuccess', function ( e, json, data, action ) {
theTable2.clearPipeline();
theTable2.draw();
});
// Activate an inline edit on click of a table cell
$('#tableOfServiciosEncuadernacion').on( 'click', 'tbody span.edit', function (e) {
editor2.inline(
theTable2.cells(this.parentNode.parentNode, '*').nodes(),
{
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
cancelTrigger: 'span.cancel',
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
submitTrigger: 'span.edit',
submit: 'allIfChanged'
}
);
} );
var theTable2 = $('#tableOfServiciosEncuadernacion').DataTable( {
serverSide: true,
processing: true,
autoWidth: true,
responsive: true,
lengthMenu: [ 5, 10, 25],
order: [[ 0, "asc" ], [ 1, "asc" ]],
pageLength: 10,
lengthChange: true,
searching: false,
paging: true,
info: false,
dom: '<"mt-4"><"float-start"l><t><"mt-4 mb-3"p>',
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfPresupuestoEncuadernaciones') ?>',
data: {
id_presupuesto: id,
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columns: [
{'data': 'tarifa_encuadernado_id',
render: function(data, type, row, meta) {
var value = encuadernadosList.find(element => element.value === data);
return value['label'];
},
},
{ 'data': 'precio_unidad' },
{ 'data': 'precio_total' },
{
data: actionBtns,
className: 'row-edit dt-center'
}
],
columnDefs: [
{
orderable: false,
searchable: false,
targets: [lastColNr2]
},
{
"orderData": [ 0, 1 ],
"targets": 0
},
],
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
buttons: [ {
className: 'btn btn-primary float-end me-sm-3 me-1',
extend: "createInline",
editor: editor2,
formOptions: {
submitTrigger: -1,
submitHtml: '<i class="ti ti-device-floppy"/>'
}
} ]
} );
<?= $this->endSection() ?>
<!-------------------------------------------------------------->
<!-- Código JS comportamiento tabla servicios manipulados. -->
<!-------------------------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
const lastColNr3 = $('#tableOfServiciosManipulado').find("tr:first th").length - 1;
editor3 = new $.fn.dataTable.Editor( {
ajax: {
url: "<?= route_to('editorOfPresupuestoManipulados') ?>",
headers: {
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
},
},
table : "#tableOfServiciosManipulado",
idSrc: 'id',
fields: [ {
"name": "tarifa_manipulado_id",
"type": "select"
}, {
"name": "precio_unidad"
}, {
"name": "precio_total"
}, {
"name": "presupuesto_id",
"type": "hidden"
},
]
} );
// Generación de la lista de servicios de acabado (id, nombre)
const manipuladosList = <?php echo json_encode($serviciosManipulado); ?>;
editor3.field( 'tarifa_manipulado_id' ).update( manipuladosList );
editor3.on( 'preSubmit', function ( e, d, type ) {
if ( type === 'create'){
d.data[0]['presupuesto_id'] = id;
}
else if(type === 'edit' ) {
for (v in d.data){
d.data[v]['presupuesto_id'] = id;
}
}
});
editor3.on( 'postSubmit', function ( e, json, data, action ) {
yeniden(json.<?= csrf_token() ?>);
});
editor3.on( 'submitSuccess', function ( e, json, data, action ) {
theTable3.clearPipeline();
theTable3.draw();
});
// Activate an inline edit on click of a table cell
$('#tableOfServiciosManipulado').on( 'click', 'tbody span.edit', function (e) {
editor3.inline(
theTable3.cells(this.parentNode.parentNode, '*').nodes(),
{
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
cancelTrigger: 'span.cancel',
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
submitTrigger: 'span.edit',
submit: 'allIfChanged'
}
);
} );
// Delete row
var theTable3 = $('#tableOfServiciosManipulado').DataTable( {
serverSide: true,
processing: true,
autoWidth: true,
responsive: true,
lengthMenu: [ 5, 10, 25],
order: [[ 0, "asc" ], [ 1, "asc" ]],
pageLength: 10,
lengthChange: true,
searching: false,
paging: true,
info: false,
dom: '<"mt-4"><"float-start"l><t><"mt-4 mb-3"p>',
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfPresupuestoManipulados') ?>',
data: {
id_presupuesto: id,
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columns: [
{'data': 'tarifa_manipulado_id',
render: function(data, type, row, meta) {
var value = manipuladosList.find(element => element.value === data);
return value['label'];
},
},
{ 'data': 'precio_unidad' },
{ 'data': 'precio_total' },
{
data: actionBtns,
className: 'row-edit dt-center'
}
],
columnDefs: [
{
orderable: false,
searchable: false,
targets: [lastColNr3]
},
{
"orderData": [ 0, 1 ],
"targets": 0
},
],
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
buttons: [ {
className: 'btn btn-primary float-end me-sm-3 me-1',
extend: "createInline",
editor: editor3,
formOptions: {
submitTrigger: -1,
submitHtml: '<i class="ti ti-device-floppy"/>'
}
} ]
} );
<?= $this->endSection() ?>
<!-------------------------------------------------------------->
<!-- Código JS comportamiento tabla servicios preimpresion. -->
<!-------------------------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
const lastColNr4 = $('#tableOfServiciosPreimpresion').find("tr:first th").length - 1;
editor4 = new $.fn.dataTable.Editor( {
ajax: {
url: "<?= route_to('editorOfPresupuestoPreimpresiones') ?>",
headers: {
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
},
},
table : "#tableOfServiciosPreimpresion",
idSrc: 'id',
fields: [ {
"name": "tarifa_preimpresion_id",
"type": "select"
}, {
"name": "precio_unidad"
}, {
"name": "precio_total"
}, {
"name": "presupuesto_id",
"type": "hidden"
},
]
} );
// Generación de la lista de servicios de acabado (id, nombre)
const preimpresionesList = <?php echo json_encode($serviciosPreimpresion); ?>;
editor4.field( 'tarifa_preimpresion_id' ).update( preimpresionesList );
editor4.on( 'preSubmit', function ( e, d, type ) {
if ( type === 'create'){
d.data[0]['presupuesto_id'] = id;
}
else if(type === 'edit' ) {
for (v in d.data){
d.data[v]['presupuesto_id'] = id;
}
}
});
editor4.on( 'postSubmit', function ( e, json, data, action ) {
yeniden(json.<?= csrf_token() ?>);
});
editor4.on( 'submitSuccess', function ( e, json, data, action ) {
theTable4.clearPipeline();
theTable4.draw();
});
// Activate an inline edit on click of a table cell
$('#tableOfServiciosPreimpresion').on( 'click', 'tbody span.edit', function (e) {
editor4.inline(
theTable4.cells(this.parentNode.parentNode, '*').nodes(),
{
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
cancelTrigger: 'span.cancel',
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
submitTrigger: 'span.edit',
submit: 'allIfChanged'
}
);
} );
// Delete row
var theTable4 = $('#tableOfServiciosPreimpresion').DataTable( {
serverSide: true,
processing: true,
autoWidth: true,
responsive: true,
lengthMenu: [ 5, 10, 25],
order: [[ 0, "asc" ], [ 1, "asc" ]],
pageLength: 10,
lengthChange: true,
searching: false,
paging: true,
info: false,
dom: '<"mt-4"><"float-start"l><t><"mt-4 mb-3"p>',
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfPresupuestoPreimpresiones') ?>',
data: {
id_presupuesto: id,
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columns: [
{'data': 'tarifa_preimpresion_id',
render: function(data, type, row, meta) {
var value = preimpresionesList.find(element => element.value === data);
return value['label'];
},
},
{ 'data': 'precio_unidad' },
{ 'data': 'precio_total' },
{
data: actionBtns,
className: 'row-edit dt-center'
}
],
columnDefs: [
{
orderable: false,
searchable: false,
targets: [lastColNr4]
},
{
"orderData": [ 0, 1 ],
"targets": 0
},
],
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
buttons: [ {
className: 'btn btn-primary float-end me-sm-3 me-1',
extend: "createInline",
editor: editor4,
formOptions: {
submitTrigger: -1,
submitHtml: '<i class="ti ti-device-floppy"/>'
}
} ]
} );
<?= $this->endSection() ?>

View File

@ -0,0 +1,81 @@
<div class="accordion mt-3 col-xl-6" id="accordionResumen">
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingOne">
<button type="button" class="accordion-button" data-bs-toggle="collapse"
data-bs-target="#accordionResumenTip" aria-expanded="false"
aria-controls="accordionResumenTip">
<h4><?= lang("Presupuestos.resumen") ?></h4>
</button>
</h2>
<div id="accordionResumenTip" class="accordion-collapse collapse show"
data-bs-parent="#accordionResumen">
<div class="accordion-body">
<div class="col-xl-12">
<div class="border rounded p-4 mb-3 pb-3">
<!-- Price Details -->
<h6>Detalles del presupuesto</h6>
<dl class="row mb-0">
<dt class="col-6 fw-normal text-end">Coste papel</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 fw-normal text-end">Margen papel</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 fw-normal text-end">Coste impresión</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 fw-normal text-end">Margen impresión</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 fw-normal text-end">Coste servicios</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 fw-normal text-end">Margen servicios</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 fw-normal text-end">Costes</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 fw-normal text-end">Margen</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 fw-normal text-end">Descuento</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 fw-normal text-end">Precio unidad</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 fw-normal text-end">Coste de envío</dt>
<dd class="col-6 text-end">NaN €</dd>
</dl>
<hr class="mx-n4">
<dl class="row mb-0">
<dt class="col-6 fw-normal text-end">Total impresión</dt>
<dd class="col-6 text-end">NaN €</dd>
<dt class="col-6 text-end">Total presupuesto</dt>
<dd class="col-6 fw-semibold text-end mb-0">NaN €</dd>
</dl>
</div>
<div class="d-grid float-end mb-4">
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="confirmar_presupuesto" name="solapas" value="1" <?= $presupuestoEntity->confirmarPresupuesto == true ? 'checked' : ''; ?>>
<label class="form-check-label" for="papelFormatoPersonalizado"><?= lang('Presupuestos.confirmar') ?></label>
</div>
</div>
</div>
</div> <!-- //.accordion-body -->
</div> <!-- //.accordion-collapse -->
</div> <!-- //.accordion-item -->
</div> <!-- //.accordion -->
<!------------------------------------------------------->
<!-- Código JS comportamiento ?????. -->
<!------------------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
<?= $this->endSection() ?>

View File

@ -1,6 +1,85 @@
/*******************************
* Eventos asociados a elementos HTML
*******************************/
$('#compPaginasNegro').on("change", function () {
var negro = parseInt(document.getElementById('compPaginasNegro').value);
const paginas = parseInt(document.getElementById('paginas').value);
if (paginas < negro) {
document.getElementById('compPaginasNegro').value = paginas;
negro = paginas;
}
var color = parseInt(document.getElementById('compPaginasColor').value);
if ($('#tipoImpresion').select2('data')[0].id == 'color') {
var newValue = paginas - negro;
if (newValue != color) {
document.getElementById('compPaginasColor').value = newValue >= 0 ? newValue : 0;
$('#compPaginasColor').change();
}
}
});
$('#compPaginasColor').on("change", function () {
const paginas = parseInt(document.getElementById('paginas').value);
var color = parseInt(document.getElementById('compPaginasColor').value);
var negro = parseInt(document.getElementById('compPaginasNegro').value);
if (paginas < color) {
document.getElementById('compPaginasColor').value = paginas;
color = paginas
}
var newValue = paginas - color;
if (newValue != negro) {
document.getElementById('compPaginasNegro').value = newValue >= 0 ? newValue : 0;
$('#compPaginasNegro').change();
}
});
$('#compPaginasNegrohq').on("change", function () {
if (document.getElementById('paginas').value < document.getElementById('compPaginasNegrohq').value) {
document.getElementById('compPaginasNegrohq').value = document.getElementById('paginas').value;
}
if ($('#tipoImpresion').select2('data')[0].id == 'color') {
if (document.getElementById('compPaginasNegrohq').value + document.getElementById('compPaginasColorhq').value > document.getElementById('paginas').value) {
var newValue = document.getElementById('paginas').value - document.getElementById('compPaginasNegrohq').value;
document.getElementById('compPaginasColorhq').value = newValue >= 0 ? newValue : 0;
}
}
});
$('#compPaginasColorhq').on("change", function () {
const paginas = parseInt(document.getElementById('paginas').value);
var color = parseInt(document.getElementById('compPaginasColorhq').value);
var negro = parseInt(document.getElementById('compPaginasNegrohq').value);
if (paginas < color) {
document.getElementById('compPaginasColorhq').value = paginas;
color = paginas
}
var newValue = paginas - color;
if (newValue != negro) {
document.getElementById('compPaginasNegrohq').value = newValue >= 0 ? newValue : 0;
$('#compPaginasNegrohq').change();
}
});
$('#paginas').on("change", function () {
// Si es negro o color
if ($('#tipoImpresion').select2('data')[0].id == 'negro' ||
$('#tipoImpresion').select2('data')[0].id == 'color') {
document.getElementById('compPaginasNegro').value = document.getElementById('paginas').value;
document.getElementById('compPaginasColor').value = 0;
}
// Si es negrohq o colorhq
if ($('#tipoImpresion').select2('data')[0].id == 'negrohq' ||
$('#tipoImpresion').select2('data')[0].id == 'colorhq') {
document.getElementById('compPaginasNegrohq').value = document.getElementById('paginas').value;
document.getElementById('compPaginasColorhq').value = 0;
}
});
$("#solapas").on("click", function () {
var e = document.getElementById('div_solapas_ancho');
if (document.getElementById('solapas').checked) {
@ -11,22 +90,18 @@ $("#solapas").on("click", function () {
}
});
$('#tipoImpresion').on("change", function () {
updatePapelesComparador();
});
$('#tipoImpresion').on("change", function () {
updatePapelesComparador();
});
$('#compRetractilado').on("change", function () {
checkRetractiladoComparador(this);
});
$('#compRetractilado5').on("change", function () {
checkRetractiladoComparador(this);
});
$('#imagenesBnInterior').on("change", function () {
var e = document.getElementById('tipoImpresion');
var optionToHide = e.querySelector("option[value='negro']");
@ -44,6 +119,7 @@ $('#imagenesBnInterior').on("change", function () {
$('#tipoImpresion').select2();
});
$('#compPosPaginasColor').on("keyup", function () {
computarPaginasColor(this.value);
});
@ -52,23 +128,152 @@ $('#compPosPaginasColor').on("keyup", function () {
// Este evento recoloca los headers de las tablas cuando se pulsa el
// boton del acordeon
$('.accordion-button').on('click', function (e) {
$.fn.dataTable.tables({ visible: true, api: true }).columns.adjust();
if(e.target.id.includes("plana")){
$("#tableCompIntPlana").DataTable().columns.adjust();
}
else if(e.target.id.includes("rotativa")){
$("#tableCompIntRotativa").DataTable().columns.adjust();
}
else if(e.target.id.includes("cubierta")){
$("#tableCompCubierta").DataTable().columns.adjust();
}
else if(e.target.id.includes("LineasPresupuesto")){
$("#tableLineasPresupuesto").DataTable().columns.adjust();
}
});
/*******************************
* Metodos
*******************************/
$('.insertarLinea').on("click", function (e) {
if(e.target.id.includes("Plana")){
// Se borran todas las líneas que no sean cubierta y sobrecubierta
$('#tableLineasPresupuesto').DataTable()
.rows( function ( idx, data, node ) {
return data[0] !== 'cubierta' && data[0] !== 'sobrecubierta';
} )
.remove()
.draw();
var rows = $("#tableCompIntPlana").DataTable().rows( '.selected' ).data().toArray();
console.log(rows);
for(row of rows){
$('#tableLineasPresupuesto').DataTable().row.add({
'tipo': row['tipo'],
'paginas': row['paginas'],
'papel': row['papel'],
'gramaje': row['gramaje'],
'marca': row['marca'],
'maquina': row['maquina'],
'tiempo': row['tiempoMaquina'],
'numeroPliegos': row['numeroPliegos'],
'pliegosPedido': row['pliegosPedido'],
'precioPliego': row['precioPliego'],
'libro': row['libro'],
'totalPapelPedido': row['totalPapelPedido'],
'chekPapel': true,
'lomo': row['lomo'],
'peso': row['peso'],
'click': row['click'],
'totalClicks': row['totalClicks'],
'chekClicks': true,
'maquinaId': row['maquinaId'],
'maquinaVelocidad': row['maquinaVelocidad'],
'papelGenericoId': row['papelGenericoId'],
'papelImpresionId': row['papelImpresionId'],
}
).draw();
}
}
});
function getRowFromLineaInt(tipo, linea) {
return {
'tipo': tipo,
'paginas': linea.fields.paginas,
'papel': linea.fields.papel_generico,
'gramaje': linea.fields.gramaje,
'marca': linea.fields.papel_impresion,
'maquina': linea.fields.maquina,
'numeroPliegos': isNaN(parseFloat(linea.fields.pliegos_libro)) ? "" : parseFloat(linea.fields.pliegos_libro).toFixed(2),
'pliegosPedido': isNaN(parseFloat(linea.fields.pliegos_pedido)) ? "" : parseFloat(linea.fields.pliegos_pedido).toFixed(2),
'precioPliego': isNaN(parseFloat(linea.fields.precios_pliegos)) ? "" : parseFloat(linea.fields.precios_pliegos).toFixed(6),
'libro': isNaN(parseFloat(linea.fields.precio_libro)) ? "" : parseFloat(linea.fields.precio_libro).toFixed(2),
'totalPapelPedido': isNaN(parseFloat(linea.fields.precio_pedido)) ? "" : parseFloat(linea.fields.precio_pedido).toFixed(2),
'lomo': isNaN(parseFloat(linea.fields.mano)) ? "" : parseFloat(linea.fields.mano).toFixed(2),
'peso': isNaN(parseFloat(linea.fields.peso)) ? "" : parseFloat(linea.fields.peso).toFixed(2),
'click': isNaN(parseFloat(linea.fields.precio_click)) ? "" : parseFloat(linea.fields.precio_click).toFixed(6),
'totalClicks': isNaN(parseFloat(linea.fields.precio_click_pedido)) ? "" : parseFloat(linea.fields.precio_click_pedido).toFixed(2),
'total': isNaN(parseFloat(linea.fields.precio_pedido) + parseFloat(linea.fields.precio_click_pedido)) ?
"" : (parseFloat(linea.fields.precio_pedido) + parseFloat(linea.fields.precio_click_pedido)).toFixed(2),
'maquinaId': linea.fields.maquina_id,
'maquinaVelocidad': linea.fields.maquina_velocidad,
'tiempoMaquina': linea.fields.tiempo_maquina,
'papelGenericoId': linea.fields.papel_generico_id,
'papelImpresionId': linea.fields.papel_impresion_id,
}
}
function getRowFromLineaRot(linea) {
return {
'tipo': 'rotativa',
'paginas': linea.fields.paginas,
'papel': linea.fields.papel_generico,
'gramaje': linea.fields.gramaje,
'marca': linea.fields.papel_impresion,
'aFavorFibra':linea.fields.a_favor_fibra==1?'si':'no',
'maquina': linea.fields.maquina,
'numeroPliegos': isNaN(parseFloat(linea.fields.pliegos_libro)) ? "" : parseFloat(linea.fields.pliegos_libro).toFixed(2),
'pliegosPedido': isNaN(parseFloat(linea.fields.pliegos_pedido)) ? "" : parseFloat(linea.fields.pliegos_pedido).toFixed(2),
'precioPliego': isNaN(parseFloat(linea.fields.precios_pliegos)) ? "" : parseFloat(linea.fields.precios_pliegos).toFixed(6),
'libro': isNaN(parseFloat(linea.fields.precio_libro)) ? "" : parseFloat(linea.fields.precio_libro).toFixed(2),
'totalPapelPedido': isNaN(parseFloat(linea.fields.precio_pedido)) ? "" : parseFloat(linea.fields.precio_pedido).toFixed(2),
'lomo': isNaN(parseFloat(linea.fields.mano)) ? "" : parseFloat(linea.fields.mano).toFixed(2),
'peso': isNaN(parseFloat(linea.fields.peso)) ? "" : parseFloat(linea.fields.peso).toFixed(2),
'click': isNaN(parseFloat(linea.fields.precio_click)) ? "" : parseFloat(linea.fields.precio_click).toFixed(6),
'totalClicks': isNaN(parseFloat(linea.fields.precio_click_pedido)) ? "" : parseFloat(linea.fields.precio_click_pedido).toFixed(2),
'precioPagNegro': isNaN(parseFloat(linea.fields.precio_pagina_negro)) ? "" : parseFloat(linea.fields.precio_pagina_negro).toFixed(6),
'precioPagColor': isNaN(parseFloat(linea.fields.precio_pagina_color)) ? "" : parseFloat(linea.fields.precio_pagina_color).toFixed(6),
'totalTinta':isNaN(parseFloat(linea.fields.precio_tinta)) ? "" : parseFloat(linea.fields.precio_tinta).toFixed(2),
'totalCorte':isNaN(parseFloat(linea.fields.total_corte)) ? "" : parseFloat(linea.fields.total_corte).toFixed(2),
'total': isNaN(parseFloat(linea.fields.total_impresion)) ? "" : (parseFloat(linea.fields.total_impresion)).toFixed(2),
'maquinaId': linea.fields.maquina_id,
'maquinaVelocidad': linea.fields.maquina_velocidad,
'tiempoMaquina': linea.fields.tiempo_maquina,
'papelGenericoId': linea.fields.papel_generico_id,
'papelImpresionId': linea.fields.papel_impresion_id,
}
}
function checkDatosPedidoForComp() {
if (parseInt($('#paginas').val()) > 0 &&
parseInt($('#tirada').val()) > 0 &&
($('#papelFormatoId').select2('data').length > 0 ||
(parseInt($('#papelFormatoAncho').val()) > 0 && parseInt($('#papelFormatoAlto').val()) > 0)))
return true;
return false;
}
function init_comparador() {
updatePapelesComparador();
const paginasColor = document.getElementById('compCalPaginasColor');
if (paginasColor.value.length > 0) {
computarPaginasColor(paginasColor.value);
}
}
@ -100,6 +305,7 @@ function computarPaginasColor(string) {
autosize.update(calPagesTextarea);
}
function checkRetractiladoComparador(element) {
switch (element.id) {
@ -140,11 +346,13 @@ function updatePapelesComparador() {
Array.from(elements_colorhq).forEach(element => {
element.style.display = "none";
});
clearNegro();
break;
case "negrohq":
Array.from(elements_color).forEach(element => {
element.style.display = "none";
});
Array.from(elements_negro).forEach(element => {
element.style.display = "none";
@ -190,8 +398,217 @@ function updatePapelesComparador() {
default:
break;
}
}
function clearNegro() {
document.getElementById('compPaginasNegro').value = 0;
$('#compGramajeNegro').val('').change();
$('#compGramajeNegro').prop('disabled', true);
$('#compPapelNegro').val('data', { id: '0' });
}
function clearIntLineas(is_color){
$("#tableCompIntPlana").DataTable().rows( '.selected' ).deselect();
var tabla = $('#tableCompIntPlana').DataTable();
tabla
.rows( function ( idx, data, node ) {
return data['tipo'].includes(is_color?'color':'bn');
} )
.remove()
.draw();
$('#insertarPlanaBtn').css('display', 'none');
}
function clearCubierta(){
$('#tableCompCubierta').DataTable().clear().draw();
}
function clearIntRot(){
$('#tableCompIntRotativa').DataTable().clear().draw();
}
function selectIntLineas(){
var negro_selected = false;
var color_selected = false;
$("#tableCompIntPlana").DataTable().rows( '.selected' ).deselect();
$("#tableCompIntPlana").DataTable().rows().every( function ( rowIdx, tableLoop, rowLoop ) {
if( !negro_selected && $('#tableCompIntPlana').DataTable().cell(rowIdx, 0).data().includes('bn') ){
$("#tableCompIntPlana").DataTable().row( rowIdx ).nodes().to$().toggleClass( 'selected' );
negro_selected = true;
}
if( !color_selected && $('#tableCompIntPlana').DataTable().cell(rowIdx, 0).data().includes('color') ){
$("#tableCompIntPlana").DataTable().row( rowIdx ).nodes().to$().toggleClass( 'selected' );
color_selected = true;
}
});
var table = $("#tableCompIntPlana").DataTable();
var rows = table.rows( '.selected' ).indexes();
var data = table.rows( rows ).data();
var value_total = 0.00;
for (let i = 0; i < data.length ; i++) {
value_total += parseFloat(data[i]['total'])
}
$('#total_comp_plana').html(value_total.toFixed(2));
}
function selectIntRotLineas(){
$("#tableCompIntRotativa").DataTable().rows( '.selected' ).deselect();
let value_total = 0.00;
if($("#tableCompIntRotativa").DataTable().rows().count()>0) {
$("#tableCompIntRotativa").DataTable().row( 0 ).nodes().to$().toggleClass( 'selected' );
value_total = parseFloat($("#tableCompIntRotativa").DataTable().rows( 0 ).data()[0]['total'])
};
$('#total_comp_rot').html(value_total.toFixed(2));
}
function selectCubiertaLineas(){
$("#tableCompCubierta").DataTable().rows( '.selected' ).deselect();
let value_total = 0.00;
if($("#tableCompCubierta").DataTable().rows().count()>0) {
$("#tableCompCubierta").DataTable().row( 0 ).nodes().to$().toggleClass( 'selected' );
value_total = parseFloat($("#tableCompCubierta").DataTable().rows( 0 ).data()[0]['total'])
};
$('#total_comp_cubierta').html(value_total.toFixed(2));
}
function getIDsComparador(is_color, is_hq){
if(!is_color){
if(is_hq){
var papel = '#compPapelNegrohq';
var gramaje = '#compGramajeNegrohq';
var paginas = '#compPaginasNegrohq';
}
else{
var papel = '#compPapelNegro';
var gramaje = '#compGramajeNegro';
var paginas = '#compPaginasNegro';
}
}
else{
if(is_hq){
var papel = '#compPapelColorhq';
var gramaje = '#compGramajeColorhq';
var paginas = '#compPaginasColorhq';
}
else{
var papel = '#compPapelColor';
var gramaje = '#compGramajeColor';
var paginas = '#compPaginasColor';
}
}
return{
papel: papel,
gramaje: gramaje,
paginas: paginas,
}
}
function getDimensionLibro(){
var ancho = 0;
var alto = 0;
if($('#papelFormatoId').select2('data').length > 0){
ancho = parseFloat($('#papelFormatoId').select2('data')[0].text.trim().split(" x ")[0]);
alto = parseFloat($('#papelFormatoId').select2('data')[0].text.trim().split(" x ")[1]);
}
else{
ancho = parseFloat(document.getElementById('papelFormatoAncho').value);
alto = parseFloat(document.getElementById('papelFormatoAlto').value);
}
return {
ancho: ancho,
alto: alto
}
}
function checkInputsForRotativa(){
// Si es color, el gramaje y el papel tiene que ser el mismo
try{
if ($('#tipoImpresion').select2('data')[0].id == 'color') {
if($('#compPapelNegro').select2('data')[0].id == $('#compPapelColor').select2('data')[0].id &&
$('#compGramajeNegro').select2('data')[0].text.trim() == $('#compGramajeColor').select2('data')[0].text.trim() ){
return true;
}
}
else if ($('#tipoImpresion').select2('data')[0].id == 'negro') {
if($('#compPapelNegro').select2('data')[0].id.length>0 &&
$('#compGramajeNegro').select2('data')[0].text.length>0){
return true;
}
}
}
catch(error){
return false;
}
return false;
}
function fillIntPlana(data, is_color, is_hq){
let sorted = data.lineas.sort(
(p1, p2) => ((p1.fields.precio_pedido+p1.fields.precio_click_pedido) < (p2.fields.precio_pedido+p2.fields.precio_click_pedido)) ?
-1 : ((p1.fields.precio_pedido+p1.fields.precio_click_pedido) > (p2.fields.precio_pedido+p2.fields.precio_click_pedido)) ? 1 : 0);
sorted.forEach(function(linea) {
if(typeof linea.error == "undefined")
$('#tableCompIntPlana').DataTable().row
.add(getRowFromLineaInt(is_color?(is_hq?'colorhq':'color'):(is_hq?'bnhq':'bn'), linea))
.draw()
})
}
function fillIntRot(data){
let sorted = data.lineas.sort(
(p1, p2) => ((p1.fields.precio_pedido+p1.fields.precio_click_pedido) < (p2.fields.precio_pedido+p2.fields.precio_click_pedido)) ?
-1 : ((p1.fields.precio_pedido+p1.fields.precio_click_pedido) > (p2.fields.precio_pedido+p2.fields.precio_click_pedido)) ? 1 : 0);
sorted.forEach(function(linea) {
if(typeof linea.error == "undefined"){
$('#tableCompIntRotativa').DataTable().row
.add(getRowFromLineaRot(linea))
.draw()
}
})
}
function fillCubierta(data, is_color, is_hq){
let sorted = data.lineas.sort(
(p1, p2) => ((p1.fields.precio_pedido+p1.fields.precio_click_pedido) < (p2.fields.precio_pedido+p2.fields.precio_click_pedido)) ?
-1 : ((p1.fields.precio_pedido+p1.fields.precio_click_pedido) > (p2.fields.precio_pedido+p2.fields.precio_click_pedido)) ? 1 : 0);
sorted.forEach(function(linea) {
if(typeof linea.error == "undefined")
$('#tableCompCubierta').DataTable().row
.add(getRowFromLineaInt('cubierta', linea))
.draw()
})
}

View File

@ -27,7 +27,7 @@
name="save"
value="<?= lang("Basic.global.Save") ?>"
/>
<?= anchor(route_to("presupuestoToPdf"), lang("Basic.global.Print"), ["class" => "btn btn-dark float-start me-sm-3 me-1",]) ?>
<?= anchor(route_to("#"), lang("Basic.global.Print"), ["class" => "btn btn-dark float-start me-sm-3 me-1",]) ?>
<?= anchor(route_to("#"), lang("Basic.global.Clone"), ["class" => "btn btn-info float-start me-sm-3 me-1",]) ?>
<?= anchor(route_to("cosidotapablandaList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start",]) ?>
</div>
@ -146,7 +146,7 @@
<?= $this->section("additionalInlineJs") ?>
autosize($('#compCalPaginasColor'));
$('#papelFormatoPersonalizado').on("click",function(){
var checkbox = document.getElementById('papelFormatoPersonalizado');
if(checkbox.checked == true){
@ -154,7 +154,7 @@
document.getElementById("papelFormatoAlto").style.display = "block";
$('#papelFormatoId').next(".select2-container").hide();
$('#papelFormatoId').val('').change();
document.getElementById("label_papelFormatoId").innerHTML =
document.getElementById("label_papelFormatoId").innerHTML =
"<?=lang('Presupuestos.papelFormatoId') ?> (" +
"<?=lang('Presupuestos.papelFormatoAncho') ?> x <?=lang('Presupuestos.papelFormatoAncho') ?>)*";
}
@ -185,7 +185,7 @@
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
columns: [
{ 'data': 'tipo',
{ 'data': 'tipo',
'render': function ( data, type, row, meta ) {
if(data=='bn')
return '<?= lang('Presupuestos.bn') ?>';
@ -240,7 +240,7 @@
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
columns: [
{ 'data': 'tipo',
{ 'data': 'tipo',
'render': function ( data, type, row, meta ) {
if(data=='rotativa')
return '<?= lang('Presupuestos.rotativa') ?>';
@ -300,7 +300,7 @@
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
columns: [
{ 'data': 'tipo',
{ 'data': 'tipo',
'render': function ( data, type, row, meta ) {
if(data=='cubierta')
return '<?= lang('Presupuestos.cubierta') ?>';
@ -339,7 +339,7 @@
});
const papelGenericoNegroList = <?php echo json_encode($papelGenericoNegroList); ?>;
var tableLineasPresupuesto = new DataTable('#tableLineasPresupuesto',{
scrollX: true,
@ -352,9 +352,256 @@
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
});
$('.comp_negro_items').on('change', function (e) {
checkComparadorInt(false,false);
});
$('.comp_negrohq_items').on('change', function (e) {
checkComparadorInt(false, true);
});
$('.comp_color_items').on('change', function (e) {
checkComparadorInt(true, false);
});
$('.comp_colorhq_items').on('change', function (e) {
checkComparadorInt(true, true);
});
async function getLineasIntPlana(is_color, is_hq){
const dimension = getDimensionLibro();
let datos = {
type: 'interior',
color: is_color?1:0,
hq: is_hq?1:0,
paginas: parseInt($(''+ elementos.paginas).val()),
tirada: parseInt($('#tirada').val()),
merma: parseInt($('#merma').val()),
ancho: dimension.ancho,
alto: dimension.alto,
papel_generico_id: $(''+ elementos.papel).select2('data')[0].id,
papel_generico: $(''+ elementos.papel).select2('data')[0].text.trim(),
gramaje: $(''+ elementos.gramaje).select2('data')[0].text.trim() ,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
$.ajax({
type: "POST",
url: "/cosidotapablanda/datatable",
data: datos,
success: function (data) {
clearIntLineas(is_color);
if(data.lineas.length >0){
fillIntPlana(data, is_color, is_hq);
selectIntLineas();
$('#title_int_plana').html('<?= lang("Presupuestos.compInteriorPlana") ?>' + ' (' + tableCompIntPlana.rows().count() + ')');
$('#insertarPlanaBtn').removeClass('d-none')
}
else{
$('#title_int_plana').html('<?= lang("Presupuestos.compInteriorPlana") ?>');
$('#insertarPlanaBtn').addClass('d-none')
$('#total_comp_plana').html('0.00');
}
yeniden(data.<?= csrf_token() ?>);
return true;
},
error: function(e){
return false;
}
})
return false;
}
async function getLineasIntRot(is_hq){
const dimension = getDimensionLibro();
// Rotativa solo negro o color (no hq)
if ( is_hq==false){
if(checkInputsForRotativa()){
let datos = {
type: 'interior_rot',
paginas: parseInt($('#paginas').val()),
paginas_negro: parseInt($('#compPaginasNegro').val()),
paginas_color: parseInt($('#compPaginasColor').val()),
tirada: parseInt($('#tirada').val()),
merma: parseInt($('#merma').val()),
ancho: dimension.ancho,
alto: dimension.alto,
// el papel y el gramaje se coge del negro (siempre estará)
papel_generico_id: $('#compPapelNegro').select2('data')[0].id,
papel_generico: $('#compPapelNegro').select2('data')[0].text.trim(),
gramaje: $('#compGramajeNegro').select2('data')[0].text.trim() ,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
$.ajax({
type: "POST",
url: "/cosidotapablanda/datatable",
data: datos,
success: function (data) {
clearIntRot();
if(data.lineas.length >0){
fillIntRot(data);
selectIntRotLineas();
$('#title_int_rot').html('<?= lang("Presupuestos.compInteriorRotativa") ?>' + ' (' + tableCompIntRotativa.rows().count() + ')');
$('#insertarRotativaBtn').removeClass('d-none')
}
else{
$('#title_int_rot').html('<?= lang("Presupuestos.compInteriorRotativa") ?>');
$('#insertarRotativaBtn').addClass('d-none')
$('#total_comp_rot').html('0.00')
}
yeniden(data.<?= csrf_token() ?>);
return true;
},
error: function(e){
return false;
}
})
}
}
return false;
}
$('.comp_cubierta_items').on('change', function (){
if ($('#compCarasCubierta').select2('data').length > 0 &&
$('#compPapelCubierta').select2('data').length > 0 &&
$('#compGramajeCubierta').select2('data').length > 0 ){
const dimension = getDimensionLibro();
let datos = {
type: 'cubierta',
paginas: parseInt($('#compCarasCubierta').select2('data')[0].id),
tirada: parseInt($('#tirada').val()),
merma: parseInt($('#mermacubierta').val()),
color: 1,
ancho: dimension.ancho,
alto: dimension.alto,
solapas: $('#solapas').is(':checked')?1:0,
solapas_ancho: parseInt($('#solapas_ancho').val()),
papel_generico_id: $('#compPapelCubierta').select2('data')[0].id,
papel_generico: $('#compPapelCubierta').select2('data')[0].text.trim(),
gramaje: $('#compGramajeCubierta').select2('data')[0].text.trim() ,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
$.ajax({
type: "POST",
url: "/cosidotapablanda/datatable",
data: datos,
success: function (data) {
clearCubierta();
if(data.lineas.length >0){
fillCubierta(data);
selectCubiertaLineas();
$('#title_cubierta').html('<?= lang("Presupuestos.cubierta") ?>' + ' (' + tableCompCubierta.rows().count() + ')');
$('#insertarCubiertaBtn').removeClass('d-none')
}
else{
$('#title_cubierta').html('<?= lang("Presupuestos.cubierta") ?>');
$('#insertarCubiertaBtn').addClass('d-none')
$('#total_comp_cubierta').html('0.00')
}
yeniden(data.<?= csrf_token() ?>);
return true;
},
error: function(e){
return false;
}
})
}
else{
clearCubierta();
}
});
$('#tipoImpresion').on("change", function () {
updatePapelesComparador();
$('#title_int_rot').html('<?= lang("Presupuestos.compInteriorRotativa") ?>');
$('#title_int_plana').html('<?= lang("Presupuestos.compInteriorPlana") ?>');
$('#paginas').change();
if (($('#tipoImpresion').select2('data')[0].id == 'negro' ||
$('#tipoImpresion').select2('data')[0].id == 'color')){
$('#tableCompIntRotativa').DataTable().clear().draw();
$('#total_comp_rot').html("0.00");
if( $('#tableCompIntPlana').DataTable().rows().count() > 0 &&
$('#tableCompIntPlana').DataTable().cell(0, 0).data().includes('hq')) {
$('#tableCompIntPlana').DataTable().clear().draw();
$('#total_comp_plana').html("0.00");
}
}
else if (($('#tipoImpresion').select2('data')[0].id == 'negrohq' ||
$('#tipoImpresion').select2('data')[0].id == 'colorhq')){
$('#tableCompIntRotativa').DataTable().clear().draw();
$('#total_comp_rot').html("0.00");
if($('#tableCompIntPlana').DataTable().rows().count() > 0 &&
!$('#tableCompIntPlana').DataTable().cell(0, 0).data().includes('hq')) {
$('#tableCompIntPlana').DataTable().clear().draw();
$('#total_comp_plana').html("0.00");
}
}
});
function checkComparadorInt(is_color, is_hq) {
elementos = getIDsComparador(is_color, is_hq)
if ($(''+ elementos.papel).select2('data').length > 0 &&
$(''+ elementos.gramaje).select2('data').length > 0 &&
parseInt($(''+ elementos.paginas).val()) > 0 &&
checkDatosPedidoForComp()) {
getLineasIntPlana(is_color, is_hq).then((result) =>{
getLineasIntRot(is_hq);
});
}
else{
clearIntLineas(is_color);
clearIntRot();
$('#title_int_rot').html('<?= lang("Presupuestos.compInteriorRotativa") ?>');
$('#title_int_plana').html('<?= lang("Presupuestos.compInteriorPlana") ?>');
}
}
$('.comp_negro_items').on('change', function (e) {
@ -641,7 +888,7 @@
return {
results: response.menu
};
},
},
cache: true
}
});
@ -683,7 +930,7 @@
return {
results: response.menu
};
},
},
cache: true
}
});
@ -727,7 +974,7 @@
return {
results: response.menu
};
},
},
cache: true
}
});
@ -771,7 +1018,7 @@
return {
results: response.menu
};
},
},
cache: true
}
});
@ -811,7 +1058,7 @@
return {
results: response.menu
};
},
},
cache: true
}
});
@ -826,8 +1073,6 @@
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.bootstrap5.min.css">
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/sk-datatables.css') ?>">
<?=$this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
@ -835,7 +1080,7 @@
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
<script src="https://cdn.datatables.net/select/1.7.0/js/dataTables.select.min.js"></script>
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.min.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.min.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/autosize/autosize.js') ?>"></script>
<script src="<?= site_url('js_loader/comparadorCosidoTapaBlanda_js') ?>"></script>

View File

@ -10,7 +10,7 @@
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?=lang('Presupuestos.presupuestoCosidotapablandaList') ?></h3>
<?=anchor(route_to('newCosidotapablanda'), lang('Basic.global.addNew').' '.lang('Presupuestos.presupuesto'), ['class'=>'btn btn-primary float-end']); ?>
<?=anchor(route_to('newCosidotapablanda'), lang('Basic.global.addNew').' '.lang('Presupuestos.presupuesto'), ['class'=>'btn btn-primary ']); ?>
</div><!--//.card-header -->
<div class="card-body">
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>

View File

@ -172,11 +172,11 @@
table : "#tableOfTarifaencuadernacionlineas",
idSrc: 'id',
fields: [ {
name: "paginas_min"
name: "paginas_libro_min"
}, {
name: "precio_max"
}, {
name: "paginas_max"
name: "paginas_libro_max"
}, {
name: "precio_min"
}, {
@ -243,9 +243,9 @@
async: true,
}),
columns: [
{ 'data': 'paginas_min' },
{ 'data': 'paginas_libro_min' },
{ 'data': 'precio_max' },
{ 'data': 'paginas_max' },
{ 'data': 'paginas_libro_max' },
{ 'data': 'precio_min' },
{ 'data': 'margen' },
{

View File

@ -0,0 +1,17 @@
/*
fetch("/presupuestos/cosidotapablanda/datatable", {
method: 'POST',
body: JSON.stringify(data),
headers: { 'X-Requested-With': 'XMLHttpRequest' },
})
.then(response => console.log(response))
//.then(json => console.log(json))
.catch(err => console.log(err));
*/

View File

@ -0,0 +1,36 @@
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
<?= $this->section("additionalInlineJs") ?>
console.log("Hola")
let datos = {
table_type: 'comp_int_bn',
paginas: 200,
tirada: 100,
merma: 10,
ancho: 98 ,
alto: 148,
papel_generico_id: 4,
papel_generico: 'AHUESADO OFFSET',
gramaje: 80,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
}
$.ajax({
type:"POST",
url:"cosidotapablanda/datatable",
data:datos, // data recive un objeto con la informacion que se enviara al servidor
success:function(data){ //success es una funcion que se utiliza si el servidor retorna informacion
console.log(data)
yeniden(data.<?= csrf_token() ?>);
},
//dataType: dataType // El tipo de datos esperados del servidor. Valor predeterminado: Intelligent Guess (xml, json, script, text, html).
})
<?=$this->endSection() ?>

View File

@ -29,7 +29,7 @@
/**
* MENU CLIENTES
*/
if (allowMenuSection($menus, ['Cliente', 'Tarifacliente'], 'index')):
if (allowMenuSection($menus, ['Cliente'], 'index')):
?>
<!-- Clientes -->
<li class="menu-item">
@ -47,15 +47,6 @@
</li>
<?php endif; ?>
<?php endif; ?>
<?php if (count($temp = getArrayItem($menus, 'name', 'Tarifacliente')) > 0): ?>
<?php if (count(getArrayItem($temp, 'methods', 'index', true)) > 0): ?>
<li class="menu-item">
<a href="<?= site_url("clientes/tarifacliente") ?>" class="menu-link">
<div data-i18n="<?= lang("App.menu_tarifacliente") ?>"><?= lang("App.menu_tarifacliente") ?></div>
</a>
</li>
<?php endif; ?>
<?php endif; ?>
</ul>
</li>
<?php endif; ?>

View File

@ -29,7 +29,7 @@
/**
* MENU CLIENTES
*/
if (allowMenuSection($menus, ['Cliente', 'Tarifacliente'], 'index')):
if (allowMenuSection($menus, ['Cliente'], 'index')):
?>
<!-- Clientes -->
<li class="menu-item">
@ -47,15 +47,6 @@
</li>
<?php endif; ?>
<?php endif; ?>
<?php if (count($temp = getArrayItem($menus, 'name', 'Tarifacliente')) > 0): ?>
<?php if (count(getArrayItem($temp, 'methods', 'index', true)) > 0): ?>
<li class="menu-item">
<a href="<?= site_url("clientes/tarifacliente") ?>" class="menu-link">
<div data-i18n="<?= lang("App.menu_tarifacliente") ?>"><?= lang("App.menu_tarifacliente") ?></div>
</a>
</li>
<?php endif; ?>
<?php endif; ?>
</ul>
</li>
<?php endif; ?>
@ -76,7 +67,7 @@
<?php if (allowMenuSection(
$menus,
['Fresadotapadura', 'Fresadotapablanda', 'Cosidotapadura', 'Cosidotapablanda',
'Cosidotapablandasolapas', 'Grapados', 'Espiraltapadura', 'Espiraltapablanda',
'Grapados', 'Espiraltapadura', 'Espiraltapablanda',
'Wireotapadura', 'Wireotapablanda'],
'index')):
?>
@ -125,16 +116,6 @@
<?php endif; ?>
<?php endif; ?>
<?php if (count($temp = getArrayItem($menus, 'name', 'Cosidotapablandasolapas')) > 0): ?>
<?php if (count(getArrayItem($temp, 'methods', 'index', true)) > 0): ?>
<li class="menu-item">
<a href="<?= site_url("presupuestos/cosidotapablandasolapas") ?>" class="menu-link">
<div data-i18n="<?= lang("App.menu_libros_cosido_tapa_blanda_solapas") ?>"><?= lang("App.menu_libros_cosido_tapa_blanda_solapas") ?></div>
</a>
</li>
<?php endif; ?>
<?php endif; ?>
<?php if (count($temp = getArrayItem($menus, 'name', 'Grapados')) > 0): ?>
<?php if (count(getArrayItem($temp, 'methods', 'index', true)) > 0): ?>
<li class="menu-item">

View File

@ -29,7 +29,7 @@
/**
* MENU CLIENTES
*/
if (allowMenuSection($menus, ['Cliente', 'Tarifacliente'], 'index')):
if (allowMenuSection($menus, ['Cliente'], 'index')):
?>
<!-- Clientes -->
<li class="menu-item">
@ -47,15 +47,6 @@
</li>
<?php endif; ?>
<?php endif; ?>
<?php if (count($temp = getArrayItem($menus, 'name', 'Cliente')) > 0): ?>
<?php if (count(getArrayItem($temp, 'methods', 'nuevo', true)) > 0): ?>
<li class="menu-item">
<a href="<?= site_url("clientes/nuevo") ?>" class="menu-link">
<div data-i18n="<?= lang("App.menu_clientes_nuevo") ?>"><?= lang("App.menu_clientes_nuevo") ?></div>
</a>
</li>
<?php endif; ?>
<?php endif; ?>
</ul>
</li>
<?php endif; ?>

View File

@ -40,4 +40,53 @@ table.dataTable.table-hover>tbody>tr.selected:hover>* {
.comparator-table td.dt-result-value {
text-align: left;
}
.lp-cell {
padding-left: 1px;
padding-right: 1px;
margin:0;
}
.lp-input {
text-align: center;
min-width: 50px;
width: 100%;
border-radius: 0.25rem !important;
}
.lp-select {
padding-top: 2px;
padding-bottom: 2px;
width: 100%;
font-size:0.7rem !important;
}
.lp-td {
padding-left: 1px;
padding-right: 1px;
margin:0 !important;
}
.lp-header {
text-align: center !important;
padding-left: 1px !important;
padding-right: 1px !important;
padding-top: 1px !important;
padding-bottom: 5px !important;
margin:0 !important;
}
.lp-cell-disabled {
background-color: Gainsboro;
}
.lp-button{
font-size: 1.1em;
padding-left: 3px;
padding-right: 3px;
width: 100%;
height: 25px;
margin-top: 6px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB