mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
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:
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -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;
|
||||
|
||||
@ -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,
|
||||
|
||||
26
ci4/app/Controllers/Js_loader.php
Normal file
26
ci4/app/Controllers/Js_loader.php
Normal 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
@ -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].';
|
||||
}
|
||||
}
|
||||
|
||||
@ -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');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
121
ci4/app/Controllers/Presupuestos/PresupuestoAcabados.php
Normal file
121
ci4/app/Controllers/Presupuestos/PresupuestoAcabados.php
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
119
ci4/app/Controllers/Presupuestos/PresupuestoEncuadernaciones.php
Normal file
119
ci4/app/Controllers/Presupuestos/PresupuestoEncuadernaciones.php
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
123
ci4/app/Controllers/Presupuestos/PresupuestoManipulados.php
Normal file
123
ci4/app/Controllers/Presupuestos/PresupuestoManipulados.php
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
117
ci4/app/Controllers/Presupuestos/PresupuestoPreimpresiones.php
Normal file
117
ci4/app/Controllers/Presupuestos/PresupuestoPreimpresiones.php
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -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)) {
|
||||
|
||||
@ -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()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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>';
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user