mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'dev/presupuesto_fresado' into 'main'
Dev/presupuesto fresado See merge request jjimenez/safekat!141
This commit is contained in:
@ -512,10 +512,10 @@ $routes->group('clientedirecciones', ['namespace' => 'App\Controllers\Clientes']
|
||||
});
|
||||
$routes->resource('clientedirecciones', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'Clientedirecciones', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
|
||||
$routes->group('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
$routes->get('list/(:num)', 'Cosidotapablanda::list/$1', ['as' => 'cosidotapablandaList']); // HOMOGENIZAR CON ARGS DINAMICOS!!!
|
||||
$routes->get('add', 'Cosidotapablanda::add', ['as' => 'newCosidotapablanda']);
|
||||
$routes->get('add/(:num)', 'Cosidotapablanda::add/$1', ['as' => 'newCosidotapablanda']);
|
||||
$routes->post('add', 'Cosidotapablanda::add', ['as' => 'createCosidotapablanda']);
|
||||
$routes->post('create', 'Cosidotapablanda::create', ['as' => 'ajaxCreateCosidotapablanda']);
|
||||
$routes->put('(:num)/update', 'Cosidotapablanda::update/$1', ['as' => 'ajaxUpdateCosidotapablanda']);
|
||||
|
||||
@ -47,55 +47,41 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
|
||||
$this->viewData['pageTitle'] = lang('Presupuestos.moduleTitleCosidoTB');
|
||||
$this->viewData['usingSweetAlert'] = true;
|
||||
|
||||
// Se indica que este controlador trabaja con soft_delete
|
||||
$this->soft_delete = true;
|
||||
// Se indica el flag para los ficheros borrados
|
||||
$this->delete_flag = 1;
|
||||
|
||||
|
||||
$this->viewData = ['usingServerSideDataTable' => true]; // JJO
|
||||
|
||||
// Breadcrumbs
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_presupuestos"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("App.menu_libros_cosido_tapa_blanda"), 'route' => site_url('presupuestos/cosidotapablanda/list/4'), 'active' => true]
|
||||
];
|
||||
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->model = new PresupuestoModel();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function list($tipo_presupuesto = 4)
|
||||
public function list($tipo_impresion_id = 4)
|
||||
{
|
||||
switch ($tipo_presupuesto){
|
||||
|
||||
case 4:
|
||||
break;
|
||||
|
||||
default:
|
||||
return "A IMPLEMENTAR!";
|
||||
|
||||
}
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Presupuestos.presupuesto')]),
|
||||
'presupuestoEntity' => new PresupuestoEntity(),
|
||||
'usingServerSideDataTable' => true,
|
||||
|
||||
'tipo_impresion_id' => $tipo_impresion_id
|
||||
];
|
||||
|
||||
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
|
||||
$viewData = array_merge($viewData, $this->getStringsFromTipoImpresion($tipo_impresion_id));
|
||||
|
||||
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
|
||||
|
||||
|
||||
return view(static::$viewPath . 'viewCosidotapablandaList', $viewData);
|
||||
}
|
||||
|
||||
|
||||
public function add()
|
||||
public function add($tipo_impresion_id = null)
|
||||
{
|
||||
|
||||
// JJO
|
||||
@ -152,8 +138,9 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['tipo_impresion_id'] = 4; // Cosido tapa blanda JJO
|
||||
$this->viewData['presupuestoEntity'] = isset($sanitizedData) ? new PresupuestoEntity($sanitizedData) : new PresupuestoEntity();
|
||||
$this->viewData['tipo_impresion_id'] = $tipo_impresion_id; // Cosido tapa blanda JJO
|
||||
$presupuestoEntity = isset($sanitizedData) ? new PresupuestoEntity($sanitizedData) : new PresupuestoEntity();
|
||||
$this->viewData['presupuestoEntity'] = $presupuestoEntity;
|
||||
$this->viewData['isCosido'] = (new TipoPresupuestoModel())->get_isCosido($this->viewData['tipo_impresion_id']);
|
||||
|
||||
$this->viewData['clienteList'] = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null);
|
||||
@ -165,134 +152,121 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
$this->viewData['formAction'] = route_to('createCosidotapablanda');
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Presupuestos.moduleTitleCosidoTB') . ' ' . lang('Basic.global.addNewSuffix');
|
||||
$this->viewData = array_merge($this->viewData, $this->getStringsFromTipoImpresion($tipo_impresion_id));
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . $this->viewData['pageTitle'] . ' ' . lang('Basic.global.addNewSuffix');
|
||||
|
||||
return $this->displayForm(__METHOD__);
|
||||
} // end function add()
|
||||
|
||||
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
// JJO
|
||||
$session = session();
|
||||
|
||||
// JJO
|
||||
$session = session();
|
||||
if ($requestedId == null) :
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$presupuestoEntity = $this->model->find($id);
|
||||
|
||||
if ($requestedId == null) :
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$presupuestoEntity = $this->model->find($id);
|
||||
if ($presupuestoEntity == false) :
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Presupuestos.presupuesto')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
if ($presupuestoEntity == false) :
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Presupuestos.presupuesto')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
$requestMethod = $this->request->getMethod();
|
||||
|
||||
$requestMethod = $this->request->getMethod();
|
||||
if ($requestMethod === 'post') :
|
||||
|
||||
if ($requestMethod === 'post') :
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
$postData['updated_at'] = gmdate('Y-m-d H:m:s', time());
|
||||
|
||||
$postData['updated_at'] = gmdate('Y-m-d H:m:s', time());
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
// JJO
|
||||
$sanitizedData['user_updated_id'] = $session->id_user;
|
||||
|
||||
|
||||
// JJO
|
||||
$sanitizedData['user_updated_id'] = $session->id_user;
|
||||
if ($this->request->getPost('retractilado') == null) {
|
||||
$sanitizedData['retractilado'] = false;
|
||||
}
|
||||
if ($this->request->getPost('retractilado5') == null) {
|
||||
$sanitizedData['retractilado5'] = false;
|
||||
}
|
||||
if ($this->request->getPost('ferro') == null) {
|
||||
$sanitizedData['ferro'] = false;
|
||||
}
|
||||
if ($this->request->getPost('ferro_digital') == null) {
|
||||
$sanitizedData['ferro_digital'] = false;
|
||||
}
|
||||
if ($this->request->getPost('prototipo') == null) {
|
||||
$sanitizedData['prototipo'] = false;
|
||||
}
|
||||
if ($this->request->getPost('marcapaginas') == null) {
|
||||
$sanitizedData['marcapaginas'] = false;
|
||||
}
|
||||
if ($this->request->getPost('faja_color') == null) {
|
||||
$sanitizedData['faja_color'] = false;
|
||||
}
|
||||
if ($this->request->getPost('papel_formato_personalizado') == null) {
|
||||
$sanitizedData['papel_formato_personalizado'] = false;
|
||||
}
|
||||
|
||||
if ($this->request->getPost('retractilado') == null) {
|
||||
$sanitizedData['retractilado'] = false;
|
||||
}
|
||||
if ($this->request->getPost('retractilado5') == null) {
|
||||
$sanitizedData['retractilado5'] = false;
|
||||
}
|
||||
if ($this->request->getPost('ferro') == null) {
|
||||
$sanitizedData['ferro'] = false;
|
||||
}
|
||||
if ($this->request->getPost('ferro_digital') == null) {
|
||||
$sanitizedData['ferro_digital'] = false;
|
||||
}
|
||||
if ($this->request->getPost('prototipo') == null) {
|
||||
$sanitizedData['prototipo'] = false;
|
||||
}
|
||||
if ($this->request->getPost('marcapaginas') == null) {
|
||||
$sanitizedData['marcapaginas'] = false;
|
||||
}
|
||||
if ($this->request->getPost('faja_color') == null) {
|
||||
$sanitizedData['faja_color'] = false;
|
||||
}
|
||||
if ($this->request->getPost('papel_formato_personalizado') == null) {
|
||||
$sanitizedData['papel_formato_personalizado'] = false;
|
||||
}
|
||||
|
||||
$noException = true;
|
||||
if($sanitizedData['papel_formato_id'] == null && $sanitizedData['papel_formato_ancho'] == null
|
||||
&& $sanitizedData['papel_formato_alto'] == null){
|
||||
if ($this->request->isAJAX()) {
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'errorMensaje' => lang('Presupuestos.errores.formato_papel'),
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
|
||||
}
|
||||
else{
|
||||
$this->session->setFlashData('errorMessage', lang('Presupuestos.errores.formato_papel'));
|
||||
}
|
||||
$successfulResult = false;
|
||||
$noException = true;
|
||||
if($sanitizedData['papel_formato_id'] == null && $sanitizedData['papel_formato_ancho'] == null
|
||||
&& $sanitizedData['papel_formato_alto'] == null){
|
||||
if ($this->request->isAJAX()) {
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'errorMensaje' => lang('Presupuestos.errores.formato_papel'),
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
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('Presupuestos.presupuesto'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
|
||||
endif;
|
||||
|
||||
$presupuestoEntity->fill($sanitizedData);
|
||||
|
||||
$thenRedirect = false;
|
||||
endif;
|
||||
$this->session->setFlashData('errorMessage', lang('Presupuestos.errores.formato_papel'));
|
||||
}
|
||||
$successfulResult = false;
|
||||
}
|
||||
else{
|
||||
|
||||
if ($noException && $successfulResult) :
|
||||
$id = $presupuestoEntity->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Presupuestos.presupuesto'))]) . '.';
|
||||
// $message .= anchor("admin/presupuestos/{$id}/edit", lang('Basic.global.continueEditing') . '?');
|
||||
//$message = ucfirst(str_replace("'", "\'", $message));
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) )
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else :
|
||||
if ($this->request->isAJAX()) {
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'mensaje' => $message,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
}
|
||||
else{
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
}
|
||||
|
||||
endif;
|
||||
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('Presupuestos.presupuesto'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
|
||||
endif;
|
||||
|
||||
$presupuestoEntity->fill($sanitizedData);
|
||||
|
||||
$thenRedirect = false;
|
||||
endif;
|
||||
}
|
||||
|
||||
if ($noException && $successfulResult) :
|
||||
$id = $presupuestoEntity->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Presupuestos.presupuesto'))]) . '.';
|
||||
// $message .= anchor("admin/presupuestos/{$id}/edit", lang('Basic.global.continueEditing') . '?');
|
||||
//$message = ucfirst(str_replace("'", "\'", $message));
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else :
|
||||
if ($this->request->isAJAX()) {
|
||||
$newTokenHash = csrf_hash();
|
||||
@ -304,12 +278,27 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
return $this->respond($data);
|
||||
}
|
||||
else{
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
}
|
||||
|
||||
endif;
|
||||
else :
|
||||
if ($this->request->isAJAX()) {
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'mensaje' => $message,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
}
|
||||
else{
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
}
|
||||
endif;
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
endif; // ($requestMethod === 'post')
|
||||
endif; // $noException && $successfulResult
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
|
||||
$this->viewData['presupuestoId'] = $id;
|
||||
@ -363,11 +352,13 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
'fajaColor' => 16,
|
||||
];
|
||||
|
||||
$this->viewData['tipo_impresion_id'] = 4; // Cosido tapa blanda JJO
|
||||
$this->viewData['tipo_impresion_id'] = $presupuestoEntity->tipo_impresion_id; // Cosido tapa blanda JJO
|
||||
|
||||
$this->viewData = array_merge($this->viewData, $this->getStringsFromTipoImpresion($presupuestoEntity->tipo_impresion_id));
|
||||
|
||||
$this->viewData['formAction'] = route_to('updateCosidotapablanda', $id);
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Presupuestos.moduleTitleCosidoTB') . ' ' . lang('Basic.global.edit3');
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . $this->viewData['pageTitle'] . ' ' . lang('Basic.global.edit3');
|
||||
|
||||
|
||||
return $this->displayForm(__METHOD__, $id);
|
||||
@ -403,12 +394,14 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$order3 = PresupuestoModel::SORTABLE[$requestedOrder3 >= 0 ? $requestedOrder1 : 0];
|
||||
$dir3 = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
|
||||
// por defecto, se deja cosido tapa blanda por ahora JJO
|
||||
$tipo_impresion_id = $reqData['tipo_impresion_id'] ?? 4;
|
||||
|
||||
if (is_null($type)) {
|
||||
|
||||
$searchValues = get_filter_datatables_columns($reqData);
|
||||
|
||||
$resourceData = $this->model->getResource($searchValues)->orderBy($order1, $dir1)->orderBy($order2, $dir2)
|
||||
$resourceData = $this->model->getResource($searchValues, $tipo_impresion_id)->orderBy($order1, $dir1)->orderBy($order2, $dir2)
|
||||
->orderBy($order3, $dir3)->limit($length, $start)->get()->getResultObject();
|
||||
foreach ($resourceData as $item) :
|
||||
if (isset($item->comentarios_pdf) && strlen($item->comentarios_pdf) > 100) :
|
||||
@ -460,7 +453,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
'ancho' => intval($reqData['ancho']) ?? 100000,
|
||||
'alto' => intval($reqData['alto']) ?? 100000,
|
||||
'a_favor_fibra' => $reqData['a_favor_fibra'] ?? 1,
|
||||
'isCosido' => true, // JJO esto es custom por cada tipo de presupuesto
|
||||
'isCosido' => (new TipoPresupuestoModel())->get_isCosido($tipo_impresion_id), // JJO esto es custom por cada tipo de presupuesto
|
||||
);
|
||||
|
||||
$papel_generico = [
|
||||
@ -561,8 +554,8 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource()->countAllResults(),
|
||||
$this->model->getResource($search)->countAllResults()
|
||||
$this->model->getResource("", $tipo_impresion_id)->countAllResults(),
|
||||
$this->model->getResource($search, $tipo_impresion_id)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
@ -613,6 +606,40 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
private function getStringsFromTipoImpresion($tipo_impresion_id){
|
||||
|
||||
$breadcrumbTitle = "";
|
||||
|
||||
switch ($tipo_impresion_id){
|
||||
|
||||
// Fresado tapa blanda
|
||||
case 2:
|
||||
$viewData['pageTitle'] = lang('Presupuestos.moduleTitleFresadoTB');
|
||||
$viewData['isCosido'] = 0;
|
||||
$breadcrumbTitle = lang("App.menu_libros_fresasdo_tapa_blanda");
|
||||
break;
|
||||
|
||||
// Cosido tapa blanda
|
||||
case 4:
|
||||
$viewData['pageTitle'] = lang('Presupuestos.moduleTitleCosidoTB');
|
||||
$viewData['isCosido'] = 1;
|
||||
$breadcrumbTitle = lang("App.menu_libros_cosido_tapa_blanda");
|
||||
break;
|
||||
|
||||
default:
|
||||
return "A IMPLEMENTAR!";
|
||||
|
||||
}
|
||||
|
||||
// Breadcrumbs
|
||||
$viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_presupuestos"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => $breadcrumbTitle, 'route' => site_url('presupuestos/cosidotapablanda/list/' . $tipo_impresion_id), 'active' => true]
|
||||
];
|
||||
|
||||
return $viewData;
|
||||
}
|
||||
|
||||
|
||||
public function getCompIntData($uso, $datosPedido, $papel_generico, $gramaje, $isColor, $isHq, $cliente_id, $datosTipolog = null)
|
||||
{
|
||||
@ -790,6 +817,8 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
return $lineas;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getCompIntRotData($datosPedido, $papel_generico, $gramaje, $paginas, $cliente_id, $datosTipolog = null)
|
||||
{
|
||||
$uso = 'interior';
|
||||
|
||||
@ -140,8 +140,11 @@ class Presupuestoencuadernaciones extends \App\Controllers\GoBaseResourceControl
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
$values = $this->model->initPresupuesto(4, $solapas, $tirada, $paginas, $ancho, $alto, $POD);
|
||||
else{
|
||||
$tipo_impresion_id = $reqData['tipo_impresion_id'] ?? 4;
|
||||
$values = $this->model->initPresupuesto($tipo_impresion_id, $solapas, $tirada, $paginas, $ancho, $alto, $POD);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'values' => $values,
|
||||
$csrfTokenName => $newTokenHash
|
||||
|
||||
@ -104,6 +104,7 @@ class Presupuestomanipulados extends \App\Controllers\GoBaseResourceController
|
||||
$POD = $reqData['POD'] ?? 0;
|
||||
$tipo = $reqData['tipo'] ?? null;
|
||||
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
@ -112,7 +113,8 @@ class Presupuestomanipulados extends \App\Controllers\GoBaseResourceController
|
||||
}
|
||||
else{
|
||||
$solapas = $reqData['solapas'] ?? -1;
|
||||
$values = $this->model->initPresupuesto(4, $solapas, $tirada, $POD);
|
||||
$tipo_impresion_id = $reqData['tipo_impresion_id'] ?? 4;
|
||||
$values = $this->model->initPresupuesto($tipo_impresion_id, $solapas, $tirada, $POD);
|
||||
}
|
||||
|
||||
$data = [
|
||||
|
||||
@ -4,8 +4,10 @@
|
||||
|
||||
return [
|
||||
'moduleTitleCosidoTB' => 'Budget for Softcover Stitched Book',
|
||||
'moduleTitleFresadoTB' => 'Budget for Softcover Milling Book',
|
||||
|
||||
'presupuestoCosidotapablandaList' => 'List of budgets for Softcover Stitched Books',
|
||||
'presupuestoFresadotapablandaList' => 'List of budgets for Milling Stitched Books',
|
||||
'presupuesto' => 'Budget',
|
||||
|
||||
'datosPresupuesto' => 'Budget information',
|
||||
|
||||
@ -3,8 +3,10 @@
|
||||
|
||||
return [
|
||||
'moduleTitleCosidoTB' => 'Presupuesto Libro Cosido Tapa Blanda',
|
||||
'moduleTitleFresadoTB' => 'Presupuesto Libro Fresado Tapa Blanda',
|
||||
|
||||
'presupuestoCosidotapablandaList' => 'Lista presupuestos Libros Cosido Tapa Blanda',
|
||||
'presupuestoFresadotapablandaList' => 'Lista presupuestos Libros Fresado Tapa Blanda',
|
||||
'presupuesto' => 'Presupuesto',
|
||||
|
||||
'datosPresupuesto' => 'Datos generales del presupuesto',
|
||||
|
||||
@ -51,12 +51,11 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel
|
||||
public function initPresupuesto($tipo_presupuesto, $solapas, $tirada, $paginas, $ancho, $alto, $POD){
|
||||
|
||||
$model = model('App\Models\Presupuestos\TipoPresupuestoServiciosDefectoModel');
|
||||
$tarifas_procesar = $model->get_tarifas($tipo_presupuesto,$solapas, "encuadernacion");
|
||||
$tarifas_procesar = $model->get_tarifas($tipo_presupuesto, $solapas, "encuadernacion");
|
||||
|
||||
$modelTarifa = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
||||
$tarifas = [];
|
||||
|
||||
|
||||
foreach($tarifas_procesar as $tarifa){
|
||||
|
||||
if($modelTarifa->isTarifaPorHoras($tarifa['tarifa_id'])){
|
||||
|
||||
@ -220,7 +220,7 @@ class PresupuestoModel extends \App\Models\GoBaseModel
|
||||
*
|
||||
* @return \CodeIgniter\Database\BaseBuilder
|
||||
*/
|
||||
public function getResource($search = [])
|
||||
public function getResource($search = [], $tipo_impresion_id = 4)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
@ -236,6 +236,7 @@ class PresupuestoModel extends \App\Models\GoBaseModel
|
||||
$builder->join("presupuesto_estados t6", "t1.estado_id = t6.id", "left");
|
||||
|
||||
$builder->where("t1.is_deleted", 0);
|
||||
$builder->where("t1.tipo_impresion_id", $tipo_impresion_id);
|
||||
|
||||
if (empty($search))
|
||||
return $builder;
|
||||
|
||||
@ -34,8 +34,6 @@ class TipoPresupuestoServiciosDefectoModel extends \App\Models\GoBaseModel
|
||||
|
||||
public function get_tarifas($tipo_presupuesto=-1, $solapas=0, $tipo=""){
|
||||
|
||||
$where = "(t1.solapas=2) OR (t1.solapas=" . $solapas . ")";
|
||||
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->where("t1.tipo_presupuesto_id", $tipo_presupuesto);
|
||||
@ -43,42 +41,42 @@ class TipoPresupuestoServiciosDefectoModel extends \App\Models\GoBaseModel
|
||||
if(strcmp($tipo, "encuadernacion")==0){
|
||||
|
||||
$builder->join("tarifa_encuadernacion t2", "t1.tarifa_id = t2.id", "left");
|
||||
$builder->where("is_servicio_encuadernacion", 1);
|
||||
$builder->where("is_servicio_acabado", 0);
|
||||
$builder->where("is_servicio_manipulado", 0);
|
||||
$builder->where("is_servicio_preimpresion", 0);
|
||||
$builder->where("t1.is_servicio_encuadernacion", 1);
|
||||
$builder->where("t1.is_servicio_acabado", 0);
|
||||
$builder->where("t1.is_servicio_manipulado", 0);
|
||||
$builder->where("t1.is_servicio_preimpresion", 0);
|
||||
}
|
||||
else if(strcmp($tipo, "acabado")==0){
|
||||
|
||||
$builder->join("lg_tarifa_acabado t2", "t1.tarifa_id = t2.id", "left");
|
||||
$builder->where("is_servicio_acabado", 1);
|
||||
$builder->where("is_servicio_encuadernacion", 0);
|
||||
$builder->where("is_servicio_manipulado", 0);
|
||||
$builder->where("is_servicio_preimpresion", 0);
|
||||
$builder->where("t1.is_servicio_acabado", 1);
|
||||
$builder->where("t1.is_servicio_encuadernacion", 0);
|
||||
$builder->where("t1.is_servicio_manipulado", 0);
|
||||
$builder->where("t1.is_servicio_preimpresion", 0);
|
||||
}
|
||||
else if(strcmp($tipo, "manipulado")==0){
|
||||
|
||||
$builder->join("lg_tarifa_manipulado t2", "t1.tarifa_id = t2.id", "left");
|
||||
$builder->where("is_servicio_manipulado", 1);
|
||||
$builder->where("is_servicio_encuadernacion", 0);
|
||||
$builder->where("is_servicio_acabado", 0);
|
||||
$builder->where("is_servicio_preimpresion", 0);
|
||||
$builder->where("t1.is_servicio_manipulado", 1);
|
||||
$builder->where("t1.is_servicio_encuadernacion", 0);
|
||||
$builder->where("t1.is_servicio_acabado", 0);
|
||||
$builder->where("t1.is_servicio_preimpresion", 0);
|
||||
|
||||
}
|
||||
else if(strcmp($tipo, "preimpresion")==0){
|
||||
|
||||
$builder->join("lg_tarifa_preimpresion t2", "t1.tarifa_id = t2.id", "left");
|
||||
$builder->where("is_servicio_preimpresion", 1);
|
||||
$builder->where("is_servicio_encuadernacion", 0);
|
||||
$builder->where("is_servicio_acabado", 0);
|
||||
$builder->where("is_servicio_manipulado", 0);
|
||||
$builder->where("t1.is_servicio_preimpresion", 1);
|
||||
$builder->where("t1.is_servicio_encuadernacion", 0);
|
||||
$builder->where("t1.is_servicio_acabado", 0);
|
||||
$builder->where("t1.is_servicio_manipulado", 0);
|
||||
|
||||
}
|
||||
else{
|
||||
return [];
|
||||
}
|
||||
|
||||
$where = "t1.solapas IS NULL OR t1.solapas='" . $solapas . "'";
|
||||
$where = "(t1.solapas IS NULL OR t1.solapas='" . $solapas . "')";
|
||||
$builder->where($where);
|
||||
|
||||
$builder->where("t2.is_deleted", 0);
|
||||
|
||||
@ -451,6 +451,8 @@ class PresupuestoService extends BaseService
|
||||
$h1_temp = 0;
|
||||
$h2_temp = 0;
|
||||
|
||||
|
||||
|
||||
// El ancho si es cosido es el doble
|
||||
if($uso != 'cubierta' && $uso != 'sobrecubierta'){
|
||||
$anchoForCalculo = $isCosido ? $ancho * 2 : $ancho;
|
||||
@ -458,6 +460,13 @@ class PresupuestoService extends BaseService
|
||||
else{
|
||||
$anchoForCalculo = $ancho;
|
||||
}
|
||||
|
||||
// Generates a message like: User 123 logged into the system from 127.0.0.1
|
||||
$info = [
|
||||
'isCosido' => $anchoForCalculo,
|
||||
];
|
||||
|
||||
log_message('error', 'isCosido en formas planas: {isCosido}', $info);
|
||||
|
||||
if($uso == 'cubierta' || $uso == 'sobrecubierta') {
|
||||
if(property_exists($maquina, 'forzar_num_formas_horizontales_cubierta') &&
|
||||
|
||||
@ -834,6 +834,7 @@
|
||||
const dimension = getDimensionLibro();
|
||||
|
||||
let datos = {
|
||||
tipo_impresion_id: <?php echo $tipo_impresion_id ?>,
|
||||
type: 'interior',
|
||||
color: is_color?1:0,
|
||||
hq: is_hq?1:0,
|
||||
@ -911,6 +912,7 @@
|
||||
if(checkInputsForRotativa()){
|
||||
|
||||
let datos = {
|
||||
tipo_impresion_id: <?php echo $tipo_impresion_id ?>,
|
||||
type: 'interior_rot',
|
||||
paginas: parseInt($('#paginas').val()),
|
||||
paginas_negro: parseInt($('#compPaginasNegro').val()),
|
||||
@ -988,6 +990,7 @@
|
||||
const dimension = getDimensionLibro();
|
||||
|
||||
let datos = {
|
||||
tipo_impresion_id: <?php echo $tipo_impresion_id ?>,
|
||||
type: 'cubierta',
|
||||
paginas: parseInt($('#compCarasCubierta').select2('data')[0].id),
|
||||
tirada: parseInt($('#tirada').val()),
|
||||
|
||||
@ -877,8 +877,10 @@
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
|
||||
if(tipo != null)
|
||||
if(tipo != null){
|
||||
datos['tipo'] = tipo;
|
||||
datos['tipo_impresion_id'] = <?php echo $tipo_impresion_id; ?>;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
@ -1095,6 +1097,7 @@
|
||||
if(tipo != null){
|
||||
datos['tipo'] = tipo;
|
||||
datos['solapas'] = $('#solapas').is(':checked')?1:0;
|
||||
datos['tipo_impresion_id'] = <?php echo $tipo_impresion_id; ?>;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1203,6 +1203,7 @@ function calcularPresupuesto_bn(input_data={}, updatedTipologias = false){
|
||||
}
|
||||
|
||||
var datos = {
|
||||
tipo_impresion_id: <?php echo $tipo_impresion_id ?>,
|
||||
type: 'interior',
|
||||
color: 0,
|
||||
hq: 0,
|
||||
@ -1526,6 +1527,7 @@ function calcularPresupuesto_color(input_data={}, updatedTipologias = false){
|
||||
}
|
||||
|
||||
let datos = {
|
||||
tipo_impresion_id: <?php echo $tipo_impresion_id ?>,
|
||||
type: 'interior',
|
||||
color: 1,
|
||||
hq: 0,
|
||||
@ -1822,6 +1824,7 @@ function calcularPresupuesto_bnhq(input_data={}, updatedTipologias = false){
|
||||
}
|
||||
|
||||
let datos = {
|
||||
tipo_impresion_id: <?php echo $tipo_impresion_id ?>,
|
||||
type: 'interior',
|
||||
color: 0,
|
||||
hq: 1,
|
||||
@ -2121,6 +2124,7 @@ function calcularPresupuesto_colorhq(input_data={}, updatedTipologias = false){
|
||||
}
|
||||
|
||||
let datos = {
|
||||
tipo_impresion_id: <?php echo $tipo_impresion_id ?>,
|
||||
type: 'interior',
|
||||
color: 1,
|
||||
hq: 1,
|
||||
@ -2412,6 +2416,7 @@ function calcularPresupuesto_rot_bn(fromComparador=false, updatedTipologias=fals
|
||||
}
|
||||
|
||||
let datos = {
|
||||
tipo_impresion_id: <?php echo $tipo_impresion_id ?>,
|
||||
type: 'interior_rot',
|
||||
color: 0,
|
||||
hq: 0,
|
||||
@ -2745,6 +2750,7 @@ function calcularPresupuesto_rot_color(fromComparador=false, updatedTipologias=f
|
||||
paginas_color = isNaN(parseInt($('#lp_rot_color_numPagColor').val()))?input_data.paginas:parseInt($('#lp_rot_color_numPagColor').val())
|
||||
|
||||
let datos = {
|
||||
tipo_impresion_id: <?php echo $tipo_impresion_id ?>,
|
||||
type: 'interior_rot',
|
||||
color: 1,
|
||||
hq: 0,
|
||||
@ -3060,6 +3066,7 @@ function calcularPresupuesto_cubierta(fromComparador=false, input_data={}){
|
||||
|
||||
|
||||
let datos = {
|
||||
tipo_impresion_id: <?php echo $tipo_impresion_id ?>,
|
||||
type: 'cubierta',
|
||||
color: 1,
|
||||
hq: 1,
|
||||
|
||||
@ -740,50 +740,50 @@
|
||||
|
||||
$('#tab-pv-bn').on( "click", function() {
|
||||
|
||||
previewInteriorPlana('bn');
|
||||
previewInteriorPlana('bn', <?php echo $isCosido; ?>);
|
||||
|
||||
} );
|
||||
|
||||
$('#tab-pv-bnhq').on( "click", function() {
|
||||
|
||||
previewInteriorPlana('bnhq');
|
||||
previewInteriorPlana('bnhq', <?php echo $isCosido; ?>);
|
||||
|
||||
} );
|
||||
|
||||
$('#tab-pv-color').on( "click", function() {
|
||||
|
||||
previewInteriorPlana('color');
|
||||
previewInteriorPlana('color', <?php echo $isCosido; ?>);
|
||||
|
||||
} );
|
||||
|
||||
$('#tab-pv-colorhq').on( "click", function() {
|
||||
|
||||
|
||||
previewInteriorPlana('colorhq');
|
||||
previewInteriorPlana('colorhq', <?php echo $isCosido; ?>);
|
||||
|
||||
} );
|
||||
|
||||
$('#tab-pv-rot-bn').on( "click", function() {
|
||||
|
||||
previewRotativa('rot_bn');
|
||||
previewRotativa('rot_bn', <?php echo $isCosido; ?>);
|
||||
|
||||
} );
|
||||
|
||||
$('#tab-pv-rot-color').on( "click", function() {
|
||||
|
||||
previewRotativa('rot_color');
|
||||
previewRotativa('rot_color', <?php echo $isCosido; ?>);
|
||||
|
||||
} );
|
||||
|
||||
$('#tab-pv-cubierta').on( "click", function() {
|
||||
|
||||
previewInteriorPlana('cubierta');
|
||||
previewInteriorPlana('cubierta', <?php echo $isCosido; ?>);
|
||||
|
||||
} );
|
||||
|
||||
$('#tab-pv-esquema-cubierta').on( "click", function() {
|
||||
|
||||
previewEsquemaCubierta('ec');
|
||||
previewEsquemaCubierta('ec', <?php echo $isCosido; ?>);
|
||||
|
||||
} );
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// Global parameters
|
||||
var _isCosido = true;
|
||||
//var _isCosido = true;
|
||||
var pvObj;
|
||||
|
||||
var sangradoTexto = "Sangrado 5 mm";
|
||||
@ -7,7 +7,7 @@ var sangradoValor = parseFloat(5); // mm
|
||||
var offsetSolapaValor = parseFloat(0); // mm
|
||||
|
||||
|
||||
function previewInteriorPlana(lpTagName) {
|
||||
function previewInteriorPlana(lpTagName, isCosido) {
|
||||
|
||||
// Local parameters
|
||||
let guardaV = 0;
|
||||
@ -15,7 +15,7 @@ function previewInteriorPlana(lpTagName) {
|
||||
let styleText = {size: 12, family: 'Public Sans'};
|
||||
|
||||
// Get the preview Object parameters
|
||||
getObjetoLP(lpTagName);
|
||||
getObjetoLP(lpTagName, isCosido);
|
||||
|
||||
// Configuracion de las guardas
|
||||
// Guarda vertical
|
||||
@ -83,7 +83,7 @@ function previewInteriorPlana(lpTagName) {
|
||||
_pvPlana.update();
|
||||
}
|
||||
|
||||
function previewRotativa(lpTagName) {
|
||||
function previewRotativa(lpTagName, isCosido) {
|
||||
|
||||
// Local parameters
|
||||
let styleText = {size: 12, family: 'Public Sans'};
|
||||
@ -92,7 +92,7 @@ function previewRotativa(lpTagName) {
|
||||
let guardaH = 0;
|
||||
|
||||
// Get the preview Object parameters
|
||||
getObjetoLP(lpTagName);
|
||||
getObjetoLP(lpTagName, isCosido);
|
||||
|
||||
// Calculos
|
||||
// Configuracion de las guardas
|
||||
@ -186,14 +186,14 @@ function getDecimalPart(floatNumber) {
|
||||
}
|
||||
|
||||
|
||||
function previewEsquemaCubierta(lpTagName) {
|
||||
function previewEsquemaCubierta(lpTagName, isCosido) {
|
||||
|
||||
// Variables locales
|
||||
let altoLibro, anchoLibro, lomoLibro, anchoSolapa, anchoCubierta, altoSangrado, anchoSangrado;
|
||||
let styleCotas = {size: 12, family: 'Public Sans'};
|
||||
|
||||
// Get the preview Object parameters
|
||||
getObjetoLP(lpTagName);
|
||||
getObjetoLP(lpTagName, isCosido);
|
||||
|
||||
// Definicion de los parametros del Esquema de Cubierta (EC)
|
||||
if (pvObj.anchoSolapa == 0) {
|
||||
@ -360,7 +360,7 @@ function getLomoLibro() {
|
||||
}
|
||||
|
||||
|
||||
function getObjetoLP(lpName) {
|
||||
function getObjetoLP(lpName, _isCosido) {
|
||||
|
||||
let rowData = null;
|
||||
|
||||
|
||||
@ -82,13 +82,12 @@
|
||||
id: 'id',
|
||||
text: 'nombre',
|
||||
searchTerm: params.term,
|
||||
<
|
||||
? = csrf_token() ?? "token" ? > : < ? = csrf_token() ? > v
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
},
|
||||
delay: 60,
|
||||
processResults: function(response) {
|
||||
yeniden(response. < ? = csrf_token() ? > );
|
||||
yeniden(response. <?= csrf_token() ?> );
|
||||
return {
|
||||
results: response.menu
|
||||
};
|
||||
|
||||
@ -9,8 +9,8 @@
|
||||
|
||||
<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 ']); ?>
|
||||
<h3 class="card-title"><?= $pageTitle ?></h3>
|
||||
<?=anchor(route_to('newCosidotapablanda', $tipo_impresion_id), lang('Basic.global.addNew').' '.lang('Presupuestos.presupuesto'), ['class'=>'btn btn-primary ']); ?>
|
||||
</div><!--//.card-header -->
|
||||
<div class="card-body">
|
||||
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
||||
@ -155,6 +155,9 @@ theTable = $('#tableOfPresupuestos').DataTable({
|
||||
},
|
||||
ajax : $.fn.dataTable.pipeline( {
|
||||
url: '<?= route_to('dataTableOfCosidotapablanda') ?>',
|
||||
data: function (d) {
|
||||
d.tipo_impresion_id = '<?php echo $tipo_impresion_id; ?>';
|
||||
},
|
||||
method: 'POST',
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
async: true,
|
||||
@ -218,7 +221,7 @@ theTable.on( 'draw.dt', function () {
|
||||
|
||||
|
||||
$(document).on('click', '.btn-edit', function(e) {
|
||||
window.location.href = `/presupuestos/cosidotapablanda/edit/${$(this).attr('data-id')}`;
|
||||
window.location.href = `/presupuestos/cosidotapablanda/edit/${$(this).attr('data-id')}/`;
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user