mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'dev/fixes' of https://git.imnavajas.es/jjimenez/safekat into dev/fixes
This commit is contained in:
@ -125,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,
|
||||
|
||||
@ -158,35 +158,6 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
/*
|
||||
|
||||
$this->viewData['formaPagoList'] = $this->getFormaPagoListItems();
|
||||
$this->viewData['tiposImpresionList'] = $this->getTiposImpresionListItems($presupuestoEntity->tipo_impresion_id ?? null);
|
||||
$this->viewData['tipologiasLibroList'] = $this->getTipologiasLibroListItems($presupuestoEntity->tipologia_id ?? null);
|
||||
|
||||
$this->viewData['ubicacionLibroList'] = $this->getUbicacionLibroListItems($presupuestoEntity->ubicacion_id ?? null);
|
||||
$this->viewData['presupuestoEstadoList'] = $this->getPresupuestoEstadoListItems($presupuestoEntity->estado_id ?? null);
|
||||
|
||||
$this->viewData['papelGenericoList'] = $this->getPapelGenericoListItems($presupuestoEntity->paginas_negro_papel_id ?? null);
|
||||
$this->viewData['papelImpresionList'] = $this->getPapelImpresionListItems($presupuestoEntity->paginas_negro_papel_impresion_id ?? null);
|
||||
$this->viewData['maquinaList'] = $this->getMaquinaListItems($presupuestoEntity->paginas_negro_maquina_id ?? null);
|
||||
$this->viewData['maquinasTarifasImpresionList'] = $this->getMaquinasTarifasImpresionListItems($presupuestoEntity->paginas_negro_tarifa_impresion_id ?? null);
|
||||
$this->viewData['papelGenericoList2'] = $this->getPapelGenericoListItems2($presupuestoEntity->paginas_color_papel_id ?? null);
|
||||
$this->viewData['papelImpresionList2'] = $this->getPapelImpresionListItems2($presupuestoEntity->paginas_color_papel_impresion_id ?? null);
|
||||
$this->viewData['maquinaList2'] = $this->getMaquinaListItems2($presupuestoEntity->paginas_color_maquina_id ?? null);
|
||||
$this->viewData['maquinasTarifasImpresionList2'] = $this->getMaquinasTarifasImpresionListItems2($presupuestoEntity->paginas_color_tarifa_impresion_id ?? null);
|
||||
$this->viewData['papelGenericoList3'] = $this->getPapelGenericoListItems3($presupuestoEntity->paginas_portada_papel_id ?? null);
|
||||
$this->viewData['papelImpresionList3'] = $this->getPapelImpresionListItems3($presupuestoEntity->paginas_portada_papel_impresion_id ?? null);
|
||||
$this->viewData['maquinaList3'] = $this->getMaquinaListItems3($presupuestoEntity->paginas_portada_maquina_id ?? null);
|
||||
$this->viewData['maquinasTarifasImpresionList3'] = $this->getMaquinasTarifasImpresionListItems3($presupuestoEntity->paginas_portada_tarifa_impresion_id ?? null);
|
||||
$this->viewData['papelGenericoList4'] = $this->getPapelGenericoListItems4($presupuestoEntity->paginas_cubierta_papel_id ?? null);
|
||||
$this->viewData['papelImpresionList4'] = $this->getPapelImpresionListItems4($presupuestoEntity->paginas_cubierta_papel_impresion_id ?? null);
|
||||
$this->viewData['maquinaList4'] = $this->getMaquinaListItems4($presupuestoEntity->paginas_cubierta_maquina_id ?? null);
|
||||
$this->viewData['maquinasTarifasImpresionList4'] = $this->getMaquinasTarifasImpresionListItems4($presupuestoEntity->paginas_cubierta_tarifa_impresion_id ?? null);
|
||||
$this->viewData['userList'] = $this->getUserListItems($presupuestoEntity->total_confirmado_user_id ?? null);
|
||||
$this->viewData['userList2'] = $this->getUserListItems2($presupuestoEntity->aprobado_user_id ?? null);
|
||||
$this->viewData['userList3'] = $this->getUserListItems3($presupuestoEntity->pedido_espera_user_id ?? null);
|
||||
$this->viewData['paginasCubiertaList'] = $this->getPaginasCubiertaOptions();
|
||||
$this->viewData['paginasPortadaList'] = $this->getPaginasPortadaOptions();
|
||||
*/
|
||||
$this->viewData['formAction'] = route_to('createCosidotapablanda');
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Presupuestos.moduleTitleCosidoTB') . ' ' . lang('Basic.global.addNewSuffix');
|
||||
@ -397,9 +368,9 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
|
||||
$table_type = $reqData['table_type'] ?? null;
|
||||
$type = $reqData['type'] ?? null;
|
||||
|
||||
if (is_null($table_type)) {
|
||||
if (is_null($type)) {
|
||||
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);
|
||||
@ -417,7 +388,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
|
||||
|
||||
if (is_null($table_type)) {
|
||||
if (is_null($type)) {
|
||||
$resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
foreach ($resourceData as $item) :
|
||||
if (isset($item->comentarios_pdf) && strlen($item->comentarios_pdf) > 100) :
|
||||
@ -456,40 +427,74 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
endforeach;
|
||||
} else {
|
||||
|
||||
switch ($table_type) {
|
||||
case 'comp_int_bn':
|
||||
$isColor = $reqData['color'] ?? false;
|
||||
$isHq = $reqData['hq'] ?? false;
|
||||
|
||||
$datosPedido = (object)array(
|
||||
'paginas' => intval($reqData['paginas']) ?? 0,
|
||||
'tirada' => intval($reqData['tirada']) ?? 0,
|
||||
'merma' => intval($reqData['merma']) ?? 0,
|
||||
'ancho' => intval($reqData['ancho']) ?? 100000,
|
||||
'alto' => intval($reqData['alto']) ?? 100000,
|
||||
'isCosido' => true, // JJO esto es custom por cada tipo de presupuesto
|
||||
);
|
||||
|
||||
$datosPedido = (object)array(
|
||||
'paginas' => intval($reqData['paginas']) ?? 0,
|
||||
'tirada' => intval($reqData['tirada']) ?? 0,
|
||||
'merma' => intval($reqData['merma']) ?? 0,
|
||||
'ancho' => intval($reqData['alto']) ?? 100000,
|
||||
'alto' => intval($reqData['ancho']) ?? 100000,
|
||||
'isCosido' => true, // JJO esto es custom por cada tipo de presupuesto
|
||||
);
|
||||
$papel_generico = [
|
||||
'id' => $reqData['papel_generico_id'] ?? 0,
|
||||
'nombre' => $reqData['papel_generico'] ?? "",
|
||||
];
|
||||
|
||||
$gramaje = $reqData['gramaje'] ?? 0;
|
||||
|
||||
$papel_generico = [
|
||||
'id' => $reqData['papel_generico_id'] ?? 0,
|
||||
'nombre' => $reqData['papel_generico'] ?? "",
|
||||
];
|
||||
|
||||
$gramaje = $reqData['gramaje'] ?? 0;
|
||||
if ($type=='interior') {
|
||||
|
||||
$resourceData = $this->getCompBnData($datosPedido, $papel_generico, $gramaje);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'lineas' => $resourceData,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
$resourceData = $this->getCompIntData($type, $datosPedido, $papel_generico, $gramaje, $isColor, $isHq);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'lineas' => $resourceData,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
}
|
||||
else if ($type=='interior_rot') {
|
||||
|
||||
$paginas = (object)array(
|
||||
'negro' => intval($reqData['paginas_negro']) ?? 0,
|
||||
'color' => intval($reqData['paginas_color']) ?? 0,
|
||||
);
|
||||
|
||||
$resourceData = $this->getCompIntRotData($datosPedido, $papel_generico, $gramaje, $paginas);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'lineas' => $resourceData,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
}
|
||||
else if ($type=='cubierta') {
|
||||
|
||||
$datosPedido->solapas = $reqData['solapas'];
|
||||
$datosPedido->solapas_ancho = $reqData['solapas_ancho'];
|
||||
|
||||
$resourceData = $this->getCompIntData($type, $datosPedido, $papel_generico, $gramaje, $isColor, $isHq);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'lineas' => $resourceData,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
@ -502,18 +507,37 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
private function getCompBnData($datosPedido, $papel_generico, $gramaje)
|
||||
public function getCompIntData($uso, $datosPedido, $papel_generico, $gramaje, $isColor, $isHq)
|
||||
{
|
||||
$uso = 'interior';
|
||||
$tipo = 'negro';
|
||||
$tipo = $isColor? ($isHq?'colorhq':'color'): ($isHq?'negrohq':'negro');
|
||||
|
||||
$opciones_papel = array(
|
||||
'bn' => 1,
|
||||
'cubierta' => 0,
|
||||
'sobrecubierta' => 0,
|
||||
'rotativa' => 0,
|
||||
);
|
||||
if( $uso == 'cubierta' ){
|
||||
$opciones_papel = array(
|
||||
'cubierta' => 1,
|
||||
'rotativa' => 0,
|
||||
);
|
||||
}
|
||||
else if ( $uso == 'sobrecubierta' ){
|
||||
$opciones_papel = array(
|
||||
'sobrecubierta' => 1,
|
||||
'rotativa' => 0,
|
||||
);
|
||||
}
|
||||
else if( $isColor ){
|
||||
$opciones_papel = array(
|
||||
'color' => 1,
|
||||
'rotativa' => 0,
|
||||
);
|
||||
}
|
||||
else{
|
||||
$opciones_papel = array(
|
||||
'bn' => 1,
|
||||
'rotativa' => 0,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Se obtienen los papeles disponibles
|
||||
$papelimpresionmodel = new PapelImpresionModel();
|
||||
$papeles = $papelimpresionmodel->getIdPapelesImpresionForPresupuesto(
|
||||
@ -522,13 +546,13 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
options: $opciones_papel
|
||||
);
|
||||
|
||||
|
||||
$lineas = array();
|
||||
// Para cada papel, se obtienen las maquinas disponibles
|
||||
foreach ($papeles as $papel) {
|
||||
|
||||
$maquinamodel = new MaquinaModel();
|
||||
$maquinas = $maquinamodel->getMaquinaImpresionForPresupuesto(
|
||||
is_rotativa: $papel->rotativa,
|
||||
is_rotativa: 0,
|
||||
tarifa_tipo: $tipo,
|
||||
tirada: $datosPedido->tirada + $datosPedido->merma,
|
||||
papel_impresion_id: $papel->id,
|
||||
@ -536,8 +560,12 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
// Se recorren las máquinas y se calcula el coste de linea por cada una
|
||||
foreach ($maquinas as $maquina) {
|
||||
|
||||
$tarifamodel = new MaquinasTarifasImpresionModel();
|
||||
$tarifa = $tarifamodel->getTarifa($maquina->maquina_id, $uso, $tipo);
|
||||
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;
|
||||
@ -551,7 +579,123 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
array_push($lineas, $linea);
|
||||
}
|
||||
}
|
||||
return $lineas;
|
||||
}
|
||||
|
||||
public function getCompIntRotData($datosPedido, $papel_generico, $gramaje, $paginas)
|
||||
{
|
||||
|
||||
$uso = 'interior';
|
||||
|
||||
$tipo = $paginas->color>0? 'color': 'negro';
|
||||
|
||||
|
||||
$parametrosRotativa = (object)array(
|
||||
'a_favor_fibra' => 0, // este parametro se cambia para comprobar
|
||||
// en las dos direcciones (menos en rustica fresada que es siempre 1)
|
||||
'bnPages' => $paginas->negro,
|
||||
'colorPages' => $paginas->color,
|
||||
'rotativa_gota_negro' => 0,
|
||||
'rotativa_gota_color' => 0,
|
||||
);
|
||||
|
||||
$opciones_papel = array(
|
||||
'rotativa' => 1,
|
||||
);
|
||||
|
||||
$tipo = array();
|
||||
if( $paginas->color > 0 ){
|
||||
$tipo[] = 'color';
|
||||
$opciones_papel['color'] = 1;
|
||||
}
|
||||
if( $paginas->negro > 0 ){
|
||||
$opciones_papel['bn'] = 1;
|
||||
$tipo[] = 'negro';
|
||||
}
|
||||
|
||||
// Se obtienen los papeles disponibles
|
||||
$papelimpresionmodel = new PapelImpresionModel();
|
||||
$papeles = $papelimpresionmodel->getIdPapelesImpresionForPresupuesto(
|
||||
papel_generico_id: $papel_generico['id'],
|
||||
gramaje: $gramaje,
|
||||
options: $opciones_papel
|
||||
);
|
||||
|
||||
$lineas = array();
|
||||
// Para cada papel, se obtienen las maquinas disponibles
|
||||
foreach ($papeles as $papel) {
|
||||
|
||||
$papelImpresionTipologiaModel = new \App\Models\Configuracion\PapelImpresionTipologiaModel();
|
||||
$datosTipologias = $papelImpresionTipologiaModel
|
||||
->findTipologiasForPapelImpresion($papel->id, $parametrosRotativa->colorPages>0?'color':'negro')
|
||||
->get()->getResultObject();
|
||||
|
||||
$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;
|
||||
|
||||
$maquinamodel = new MaquinaModel();
|
||||
|
||||
$maquinas = $maquinamodel->getMaquinaImpresionForPresupuesto(
|
||||
is_rotativa: 1,
|
||||
tarifa_tipo: $tipo,
|
||||
tirada: $datosPedido->tirada + $datosPedido->merma,
|
||||
papel_impresion_id: $papel->id,
|
||||
);
|
||||
|
||||
// Se recorren las máquinas y se calcula el coste de linea por cada una
|
||||
foreach ($maquinas as $maquina) {
|
||||
|
||||
for ($i = 0; $i <= 1; $i++) {
|
||||
|
||||
$parametrosRotativa->a_favor_fibra = $i;
|
||||
|
||||
$tarifamodel = new MaquinasTarifasImpresionModel();
|
||||
$tarifa = $tarifamodel->getTarifa($maquina->maquina_id, $uso, is_array($tipo)?'color':$tipo);
|
||||
if(!is_float($tarifa)){
|
||||
continue;
|
||||
}
|
||||
|
||||
// precio del pliego de impresion
|
||||
$linea['fields'] = PresupuestoService::getCostesLineaRotativa($maquina, $papel, $datosPedido, $parametrosRotativa);
|
||||
|
||||
$precio_pliego_impresion = PresupuestoService::getPrecioPliego($maquina, $papel, $datosPedido->paginas);
|
||||
$linea['fields']['precios_pliegos'] = $precio_pliego_impresion;
|
||||
|
||||
$linea['fields']['precio_libro'] = $linea['fields']['pliegos_libro'] * $precio_pliego_impresion;
|
||||
// Precio papel pedido
|
||||
$linea['fields']['precio_pedido'] = $linea['fields']['precio_libro'] * ($datosPedido->tirada + $datosPedido->merma);
|
||||
|
||||
$linea['fields']['a_favor_fibra'] = $parametrosRotativa->a_favor_fibra;
|
||||
$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'] = $gramaje;
|
||||
$linea['fields']['papel_generico_id'] = $papel_generico['id'];
|
||||
$linea['fields']['papel_generico'] = $papel_generico['nombre'];
|
||||
|
||||
$linea['fields']['posicion_formas'] = $parametrosRotativa->a_favor_fibra ? 'h' : 'v';
|
||||
$linea['fields']['num_formas_horizontales'] = floor($linea['fields']['factor_anchura']);
|
||||
$linea['fields']['num_formas_verticales'] = floor($linea['fields']['factor_altura']);
|
||||
|
||||
// impresion
|
||||
$linea['fields']['precio_click'] = $tarifa;
|
||||
$linea['fields']['precio_click_pedido'] = $linea['fields']['clicks_pedido'] * $linea['fields']['precio_click'];
|
||||
|
||||
|
||||
// total linea rotativa
|
||||
$linea['fields']['total_impresion'] = $linea['fields']['precio_pedido'] + $linea['fields']['precio_click_pedido'] + $linea['fields']['precio_tinta'] +
|
||||
$linea['fields']['total_corte'];
|
||||
|
||||
array_push($lineas, $linea);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $lineas;
|
||||
}
|
||||
|
||||
@ -585,14 +729,15 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$reqData = $this->request->getPost();
|
||||
|
||||
$tipo = $reqData['tipo'] ?? null;
|
||||
$uso = $reqData['uso'] ?? null;
|
||||
$datos = $reqData['datos'] ?? null;
|
||||
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
|
||||
//$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
|
||||
|
||||
|
||||
if ($tipo == 'gramaje') {
|
||||
// En este caso contiene el nombre del papel generico
|
||||
$model = new PapelGenericoModel();
|
||||
$menu = $model->getGramajeComparador($datos, $searchStr);
|
||||
$menu = $model->getGramajeComparador($datos, $uso );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,11 +3,12 @@
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\Configuracion\MaquinasTarifasImpresionModel;
|
||||
use App\Models\Configuracion\MaquinaModel;
|
||||
use App\Services\PresupuestoService;
|
||||
|
||||
class Test extends BaseController
|
||||
{
|
||||
|
||||
|
||||
function __construct()
|
||||
{
|
||||
|
||||
@ -15,21 +16,237 @@ class Test extends BaseController
|
||||
|
||||
public function index()
|
||||
{
|
||||
//PresupuestoService::test();
|
||||
return view('themes/backend/vuexy/form/test_js/viewTest');
|
||||
$this->testLineasIntPlanaCubierta();
|
||||
}
|
||||
|
||||
function test_js()
|
||||
public function testGetPrecioPliegoRotativa()
|
||||
{
|
||||
/*$this->response->setHeader('Content-Type', 'text/javascript');
|
||||
return view('themes/backend/vuexy/form/test_js/test_js.js');*/
|
||||
$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 pruebaJJO()
|
||||
public function testGetMaquinasFromTarifas()
|
||||
{
|
||||
//PresupuestoService::test2();
|
||||
$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>';
|
||||
var_dump($maquina);
|
||||
echo '</pre>';
|
||||
}
|
||||
|
||||
public static function testLineasIntPlana()
|
||||
{
|
||||
$uso = 'negro';
|
||||
$tipo = 'color';
|
||||
$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(
|
||||
'bn' => 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: '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);
|
||||
$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>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user