mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
modificacion hecha
This commit is contained in:
@ -168,8 +168,8 @@ class Maquinas extends \App\Controllers\GoBaseResourceController
|
||||
if ($this->request->getPost('is_rotativa') == null) {
|
||||
$sanitizedData['is_rotativa'] = false;
|
||||
}
|
||||
if ($this->request->getPost('is_tinta') == null) {
|
||||
$sanitizedData['is_tinta'] = false;
|
||||
if ($this->request->getPost('is_inkjet') == null) {
|
||||
$sanitizedData['is_inkjet'] = false;
|
||||
}
|
||||
|
||||
// JJO
|
||||
|
||||
@ -164,6 +164,7 @@ class Maquinaspapelesimpresion extends \App\Controllers\GoBaseResourceController
|
||||
$maquina_id = $reqData['maquina_id'] ?? -1;
|
||||
// Para saber si el papel que se tiene que mostrar es para rotativa
|
||||
$isRotativa= $reqData['isRotativa'] ?? 0;
|
||||
$isInkjet= $reqData['isInkjet'] ?? 0;
|
||||
|
||||
// modelos usados
|
||||
$tarifa_model = new MaquinasTarifasImpresionModel();
|
||||
@ -172,13 +173,13 @@ class Maquinaspapelesimpresion extends \App\Controllers\GoBaseResourceController
|
||||
$tarifas = $tarifa_model->getResource("", $maquina_id)->get()->getResultObject();
|
||||
|
||||
// 1- Se obtienen los papeles que hay seleccionados (de la tabla lg_maquina_papel_impresion y que coincidan con las tarifas actuales)
|
||||
$initData = $this->model->getInitData($isRotativa, $tarifas, $maquina_id);
|
||||
$initData = $this->model->getInitData($isRotativa, $isInkjet, $tarifas, $maquina_id);
|
||||
// 2- Se cuentan los resultados. Si no hay coincidencias, hay que crear la tabla pivote con todos los papeles que cumplan la
|
||||
// condición de las tarifas y con la columna active a 0. Si hay coincidencias, se guardan los activos en un array
|
||||
$selected_papers = $initData->countAllResults();
|
||||
$active_values = [];
|
||||
if($selected_papers > 0){
|
||||
$active_values = $this->model->getInitData($isRotativa, $tarifas, $maquina_id)->get()->getResult('array');
|
||||
$active_values = $this->model->getInitData($isRotativa, $isInkjet, $tarifas, $maquina_id)->get()->getResult('array');
|
||||
}
|
||||
// Primero se borran las filas con la maquina_id de la tabla pivote
|
||||
$this->model->deleteRows($maquina_id);
|
||||
|
||||
@ -205,10 +205,13 @@ class Papelesimpresion extends \App\Controllers\GoBaseResourceController
|
||||
if ($this->request->getPost('rotativa') == null) {
|
||||
$sanitizedData['rotativa'] = false;
|
||||
}
|
||||
if ($this->request->getPost('inkjet') == null) {
|
||||
$sanitizedData['inkjet'] = false;
|
||||
}
|
||||
|
||||
// Hay que asegurarse de que se quitan los consumos de tintas de rotativa
|
||||
// en caso de que se haya deseleccionado la opción rotativa
|
||||
if(!$sanitizedData['rotativa']){
|
||||
if(!$sanitizedData['rotativa'] && !$sanitizedData['inkjet']){
|
||||
$this->tpModel->removeForPapelImpresion($id);
|
||||
}
|
||||
|
||||
@ -221,8 +224,7 @@ class Papelesimpresion extends \App\Controllers\GoBaseResourceController
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
@ -415,12 +417,12 @@ class Papelesimpresion extends \App\Controllers\GoBaseResourceController
|
||||
$ma_model = new MaquinaModel();
|
||||
$ma_pa_model = new MaquinasPapelesImpresionModel();
|
||||
|
||||
$active_values = $ma_pa_model->getInitSelectedMachines($id, $data['rotativa'])->get()->getResult('array');
|
||||
$active_values = $ma_pa_model->getInitSelectedMachines($id, $data['rotativa'], $data['inkjet'])->get()->getResult('array');
|
||||
|
||||
$ma_pa_model->deleteForPapelImpresion($id);
|
||||
|
||||
// Se obtienen las máquinas que cumplen las condiciones
|
||||
$rows = $ma_model->getIdMaquinasForPapelImpresion($id, $data['rotativa'])->get()->getResult('array');
|
||||
$rows = $ma_model->getIdMaquinasForPapelImpresion($id, $data['rotativa'], $data['inkjet'])->get()->getResult('array');
|
||||
$ma_pa_model->insertRows($rows);
|
||||
|
||||
// Se actualizan los activos que había en caso de que los hubiera
|
||||
|
||||
@ -444,7 +444,21 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
if ($type=='interior') {
|
||||
|
||||
$resourceData = $this->getCompIntData($type, $datosPedido, $papel_generico, $gramaje, $isColor, $isHq, $cliente_id);
|
||||
$datosTipolog = $reqData['negro'] ?? null;
|
||||
if(!is_null($datosTipolog)){
|
||||
$datosTipolog = [];
|
||||
$data = (object)array(
|
||||
'negro' => intval($reqData['negro']) ?? 0,
|
||||
'cyan' => intval($reqData['cyan']) ?? 0,
|
||||
'magenta' => intval($reqData['magenta']) ?? 0,
|
||||
'amarillo' => intval($reqData['amarillo']) ?? 0,
|
||||
'gota_negro' => intval($reqData['gota_negro']) ?? 0,
|
||||
'gota_color' => intval($reqData['gota_color']) ?? 0,
|
||||
);
|
||||
array_push($datosTipolog, $data);
|
||||
}
|
||||
|
||||
$resourceData = $this->getCompIntData($type, $datosPedido, $papel_generico, $gramaje, $isColor, $isHq, $cliente_id, $datosTipolog);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
@ -560,7 +574,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
}
|
||||
|
||||
|
||||
public function getCompIntData($uso, $datosPedido, $papel_generico, $gramaje, $isColor, $isHq, $cliente_id)
|
||||
public function getCompIntData($uso, $datosPedido, $papel_generico, $gramaje, $isColor, $isHq, $cliente_id, $datosTipolog = null)
|
||||
{
|
||||
$tipo = $isColor? ($isHq?'colorhq':'color'): ($isHq?'negrohq':'negro');
|
||||
|
||||
@ -615,15 +629,61 @@ 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) {
|
||||
|
||||
if($maquina->is_inkjet){
|
||||
$parametrosInkjet = (object)array(
|
||||
'a_favor_fibra' => 1, // este parametro se cambia para comprobar
|
||||
// en las dos direcciones (menos en rustica fresada que es siempre 1)
|
||||
'bnPages' => $isColor?0:$datosPedido->paginas,
|
||||
'colorPages' => $isColor?$datosPedido->paginas:0,
|
||||
'rotativa_gota_negro' => 0,
|
||||
'rotativa_gota_color' => 0,
|
||||
);
|
||||
|
||||
$papelImpresionTipologiaModel = new \App\Models\Configuracion\PapelImpresionTipologiaModel();
|
||||
if(is_null($datosTipolog)){
|
||||
$datosTipologias = $papelImpresionTipologiaModel
|
||||
->findTipologiasForPapelImpresion($papel->id, $parametrosInkjet->colorPages>0?'color':'negro')
|
||||
->get()->getResultObject();
|
||||
|
||||
|
||||
if(count($datosTipologias)==0){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$datosTipologias = $datosTipolog;
|
||||
}
|
||||
|
||||
$parametrosInkjet->rotativa_gota_negro = $datosTipologias[0]->gota_negro;
|
||||
$parametrosInkjet->rotativa_gota_color = $datosTipologias[0]->gota_color;
|
||||
$parametrosInkjet->rotativa_negro = $datosTipologias[0]->negro;
|
||||
$parametrosInkjet->rotativa_cyan = $datosTipologias[0]->cyan;
|
||||
$parametrosInkjet->rotativa_magenta = $datosTipologias[0]->magenta;
|
||||
$parametrosInkjet->rotativa_amarillo = $datosTipologias[0]->amarillo;
|
||||
}
|
||||
|
||||
$tarifamodel = new MaquinasTarifasImpresionModel();
|
||||
[$tarifaId, $tarifa] = $tarifamodel->getTarifa($maquina->maquina_id, $uso, $tipo);
|
||||
if(!is_float($tarifa)){
|
||||
continue;
|
||||
}
|
||||
|
||||
$linea = PresupuestoService::getCostesLinea($uso, $datosPedido, $maquina, $papel, $opciones_papel, $tarifa);
|
||||
if($maquina->is_inkjet){
|
||||
$linea['fields'] = PresupuestoService::getCostesLineaRotativa($maquina, $papel, $datosPedido, $parametrosInkjet);
|
||||
[$precio_pliego_impresion, $margen_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;
|
||||
$linea['fields']['a_favor_fibra'] = $parametrosInkjet->a_favor_fibra;
|
||||
$linea['fields']['paginas_color'] = $isColor?$datosPedido->paginas:0;
|
||||
$linea['fields']['datosTipologias'] = $datosTipologias[0];
|
||||
}
|
||||
else{
|
||||
$linea = PresupuestoService::getCostesLinea($uso, $datosPedido, $maquina, $papel, $opciones_papel, $tarifa);
|
||||
}
|
||||
|
||||
if(array_key_exists('error', $linea))
|
||||
continue;
|
||||
|
||||
$linea['fields']['tarifa_impresion_id'] = $tarifaId;
|
||||
$linea['fields']['maquina'] = $maquina->maquina;
|
||||
$linea['fields']['maquina_id'] = $maquina->maquina_id;
|
||||
@ -634,6 +694,11 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$linea['fields']['gramaje'] = $gramaje;
|
||||
$linea['fields']['papel_generico_id'] = $papel_generico['id'];
|
||||
$linea['fields']['papel_generico'] = $papel_generico['nombre'];
|
||||
|
||||
if($maquina->is_inkjet){
|
||||
$linea['fields']['precio_click'] = $tarifa;
|
||||
$linea['fields']['precio_click_pedido'] = $linea['fields']['clicks_pedido'] * $linea['fields']['precio_click'];
|
||||
}
|
||||
$linea['fields']['tiempo_maquina'] = PresupuestoService::getTiempoMaquina(
|
||||
$linea['fields']['precio_click_pedido'],
|
||||
$linea['fields']['precio_click'],
|
||||
@ -642,7 +707,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$clientePreciosModel = new ClientePreciosModel();
|
||||
$config = (object)[
|
||||
"tipo" => $uso,
|
||||
"tipo_maquina" => $maquina->is_tinta?'inkjet':'toner',
|
||||
"tipo_maquina" => $maquina->is_inkjet?'inkjet':'toner',
|
||||
"tipo_impresion" => $tipo
|
||||
];
|
||||
$tiempo = PresupuestoService::getHorasMaquina(
|
||||
@ -655,15 +720,27 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
continue;
|
||||
}
|
||||
|
||||
$linea['fields']['tipo_maquina'] = $maquina->is_tinta?'inkjet':'toner';
|
||||
$linea['fields']['tipo_maquina'] = $maquina->is_inkjet?'inkjet':'toner';
|
||||
$linea['fields']['precio_hora'] = $precio_hora*$margen_precio_hora/100.0;
|
||||
$linea['fields']['precio_hora_margen'] = $margen_precio_hora;
|
||||
$linea['fields']['horas_maquina'] = $tiempo;
|
||||
$linea['fields']['precio_impresion_horas'] = $precio_hora*$tiempo*1.0;
|
||||
$linea['fields']['margen_impresion_horas'] = $precio_hora*$tiempo*1.0*$margen_precio_hora/100.0;
|
||||
|
||||
$linea['fields']['total_impresion'] = $linea['fields']['precio_pedido'] + // papel
|
||||
$linea['fields']['precio_impresion_horas']; // impresion
|
||||
if($maquina->is_inkjet){
|
||||
$linea['fields']['precio_pedido'] = $linea['fields']['precio_libro'] * ($datosPedido->tirada + $datosPedido->merma);
|
||||
$linea['fields']['margen_papel_pedido'] = $linea['fields']['pliegos_libro']*$margen_pliego_impresion* ($datosPedido->tirada + $datosPedido->merma); ;
|
||||
$linea['fields']['total_impresion'] =
|
||||
$linea['fields']['precio_pedido'] + // papel
|
||||
$linea['fields']['precio_impresion_horas'] + $linea['fields']['margen_impresion_horas'] + // horas de maquina
|
||||
$linea['fields']['precio_tinta']; // tinta
|
||||
}
|
||||
else{
|
||||
$linea['fields']['total_impresion'] = $linea['fields']['precio_pedido'] + // papel
|
||||
$linea['fields']['precio_impresion_horas']; // impresion
|
||||
}
|
||||
|
||||
|
||||
|
||||
array_push($lineas, $linea);
|
||||
}
|
||||
|
||||
@ -18,8 +18,20 @@ class Test extends BaseController
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->asignar_tarifa_defecto_todos_usuarios();
|
||||
$maquina_id = 114;
|
||||
|
||||
echo '<pre>';
|
||||
$papelimpresion_model = model('App\Models\Configuracion\PapelImpresionModel');
|
||||
$tarifa_model = model('App\Models\Configuracion\MaquinasTarifasImpresionModel');
|
||||
|
||||
$tarifas = $tarifa_model->getResource("", $maquina_id)->get()->getResultObject();
|
||||
var_dump($tarifas);
|
||||
|
||||
$papeles = $papelimpresion_model->getIdPapelesImpresion($maquina_id, $tarifas)->get()->getResult('array');
|
||||
|
||||
var_dump($papeles);
|
||||
|
||||
echo '</pre>';
|
||||
}
|
||||
|
||||
private function asignar_tarifa_defecto_todos_usuarios()
|
||||
|
||||
@ -23,7 +23,7 @@ class Maquina extends \CodeIgniter\Entity\Entity
|
||||
"orden_planning" => 1,
|
||||
"is_rotativa" => false,
|
||||
"precio_tinta_negro" => 0.0,
|
||||
"is_tinta" => false,
|
||||
"is_inkjet" => false,
|
||||
"precio_tinta_color" => 0.0,
|
||||
"velocidad_corte" => 0.0,
|
||||
"precio_hora_corte" => 0.0,
|
||||
@ -52,7 +52,7 @@ class Maquina extends \CodeIgniter\Entity\Entity
|
||||
"orden_planning" => "int",
|
||||
"is_rotativa" => "boolean",
|
||||
"precio_tinta_negro" => "float",
|
||||
"is_tinta" => "boolean",
|
||||
"is_inkjet" => "boolean",
|
||||
"precio_tinta_color" => "float",
|
||||
"velocidad_corte" => "float",
|
||||
"precio_hora_corte" => "float",
|
||||
|
||||
@ -19,6 +19,7 @@ class PapelImpresion extends \CodeIgniter\Entity\Entity
|
||||
"color" => true,
|
||||
"cubierta" => false,
|
||||
"sobrecubierta" => false,
|
||||
"inkjet" => false,
|
||||
"rotativa" => false,
|
||||
"is_deleted" => 0,
|
||||
"created_at" => null,
|
||||
|
||||
@ -19,7 +19,7 @@ return [
|
||||
'isDeleted' => 'Is Deleted',
|
||||
'isPadre' => 'Use for variant',
|
||||
'isRotativa' => 'Is Rotary?',
|
||||
'isTinta' => 'Is Ink',
|
||||
'isTinta' => 'Inkjet',
|
||||
'manipulado' => 'handling',
|
||||
'maquina' => 'Machine',
|
||||
'maquinaList' => 'Maniches List',
|
||||
|
||||
@ -30,12 +30,13 @@ return [
|
||||
'precioMetro' => 'Meter price',
|
||||
'precioTonelada' => 'Ton price',
|
||||
'referencia' => 'Reference',
|
||||
'inkjet' => 'Inkjet',
|
||||
'rotativa' => 'Rotary',
|
||||
'updatedAt' => 'Updated At',
|
||||
'activo' => 'Active?',
|
||||
'userUpdateId' => 'User Update ID',
|
||||
|
||||
'consumo_tintas_rotativas' => 'Rotary ink consumption',
|
||||
'consumo_tintas_rotativas' => 'Ink consumption',
|
||||
'maquinas_papel' => 'Selected machines',
|
||||
'sureToChangeRotativaTitle' => 'Are you sure to change this option?',
|
||||
'sureToChangeRotativaText' => 'This operation can\'t undone, the machines list and the rotary ink consumption will change.',
|
||||
|
||||
@ -19,7 +19,7 @@ return [
|
||||
'isDeleted' => 'Is Deleted',
|
||||
'isPadre' => 'Usar para variante?',
|
||||
'isRotativa' => 'Es Rotativa?',
|
||||
'isTinta' => 'Es Tinta?',
|
||||
'isTinta' => 'Inkjet',
|
||||
'manipulado' => 'manipulado',
|
||||
'maquina' => 'Maquina',
|
||||
'maquinaList' => 'Lista Máquinas',
|
||||
|
||||
@ -30,12 +30,13 @@ return [
|
||||
'precioMetro' => 'Precio Metro',
|
||||
'precioTonelada' => 'Precio Tonelada',
|
||||
'referencia' => 'Referencia',
|
||||
'inkjet' => 'Inkjet',
|
||||
'rotativa' => 'Rotativa',
|
||||
'updatedAt' => 'Actualizado en',
|
||||
'activo' => 'Activo?',
|
||||
'userUpdateId' => 'ID usuario actualización',
|
||||
|
||||
'consumo_tintas_rotativas' => 'Consumo tintas rotativas',
|
||||
'consumo_tintas_rotativas' => 'Consumo tintas',
|
||||
'maquinas_papel' => 'Máquinas seleccionadas',
|
||||
'sureToChangeRotativaTitle' => '¿Está seguro de cambiar esta opción?',
|
||||
'sureToChangeRotativaText' => 'Está operación no se puede deshacer, cambiará la lista de máquinas y el consumo de tintas.',
|
||||
|
||||
@ -48,7 +48,7 @@ class MaquinaModel extends \App\Models\GoBaseModel
|
||||
"orden_planning",
|
||||
"is_rotativa",
|
||||
"precio_tinta_negro",
|
||||
"is_tinta",
|
||||
"is_inkjet",
|
||||
"precio_tinta_color",
|
||||
"velocidad_corte",
|
||||
"precio_hora_corte",
|
||||
@ -253,7 +253,7 @@ class MaquinaModel extends \App\Models\GoBaseModel
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getIdMaquinasForPapelImpresion($papel_impresion_id, $rotativa)
|
||||
public function getIdMaquinasForPapelImpresion($papel_impresion_id, $rotativa , $inkjet)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
@ -261,6 +261,7 @@ class MaquinaModel extends \App\Models\GoBaseModel
|
||||
"'" . $papel_impresion_id . "'" . " as papel_impresion_id, t1.id AS maquina_id, '0' as active"
|
||||
);
|
||||
$builder->where("t1.is_rotativa", $rotativa);
|
||||
$builder->where("t1.is_inkjet", $inkjet);
|
||||
|
||||
return $builder;
|
||||
}
|
||||
@ -294,7 +295,13 @@ class MaquinaModel extends \App\Models\GoBaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS id, t1.nombre AS nombre, t1.is_padre AS is_padre, t1.tipo AS tipo, t1.velocidad AS velocidad, t1.ancho AS ancho, t1.alto AS alto, t1.ancho_impresion AS ancho_impresion, t1.alto_impresion AS alto_impresion, t1.alto_click AS alto_click, t1.min AS min, t1.max AS max, t1.duracion_jornada AS duracion_jornada, t1.orden_planning AS orden_planning, t1.is_rotativa AS is_rotativa, t1.precio_tinta_negro AS precio_tinta_negro, t1.is_tinta AS is_tinta, t1.precio_tinta_color AS precio_tinta_color, t1.velocidad_corte AS velocidad_corte, t1.precio_hora_corte AS precio_hora_corte, t1.metrosxminuto AS metrosxminuto, t1.forzar_num_formas_horizontales_cubierta AS forzar_num_formas_horizontales_cubierta, t1.forzar_num_formas_verticales_cubierta AS forzar_num_formas_verticales_cubierta, t1.observaciones AS observaciones, t2.nombre AS padre"
|
||||
"t1.id AS id, t1.nombre AS nombre, t1.is_padre AS is_padre, t1.tipo AS tipo, t1.velocidad AS velocidad, t1.ancho AS ancho, t1.alto AS alto, t1.ancho_impresion AS ancho_impresion, t1.alto_impresion AS alto_impresion, t1.alto_click AS alto_click, t1.min AS min, t1.max AS max, t1.duracion_jornada AS duracion_jornada,
|
||||
t1.orden_planning AS orden_planning, t1.is_rotativa AS is_rotativa, t1.precio_tinta_negro AS precio_tinta_negro,
|
||||
t1.is_inkjet AS is_inkjet, t1.precio_tinta_color AS precio_tinta_color, t1.velocidad_corte AS velocidad_corte,
|
||||
t1.precio_hora_corte AS precio_hora_corte, t1.metrosxminuto AS metrosxminuto,
|
||||
t1.forzar_num_formas_horizontales_cubierta AS forzar_num_formas_horizontales_cubierta,
|
||||
t1.forzar_num_formas_verticales_cubierta AS forzar_num_formas_verticales_cubierta,
|
||||
t1.observaciones AS observaciones, t2.nombre AS padre"
|
||||
);
|
||||
$builder->join("lg_maquinas t2", "t1.padre_id = t2.id", "left");
|
||||
|
||||
@ -367,7 +374,7 @@ class MaquinaModel extends \App\Models\GoBaseModel
|
||||
->select(
|
||||
"t1.id AS maquina_id, t1.nombre AS maquina, t1.ancho_impresion AS ancho_impresion,
|
||||
t1.alto_impresion AS alto_impresion, t1.ancho AS ancho, t1.alto AS alto,
|
||||
t1.is_rotativa AS is_rotativa, t1.is_tinta AS is_tinta, t1.alto_click AS alto_click, t1.velocidad AS velocidad,
|
||||
t1.is_rotativa AS is_rotativa, t1.is_inkjet AS is_inkjet, t1.alto_click AS alto_click, t1.velocidad AS velocidad,
|
||||
t1.precio_tinta_negro AS precio_tinta_negro, t1.precio_tinta_color AS precio_tinta_color,
|
||||
t1.velocidad_corte AS velocidad_corte, t1.precio_hora_corte AS precio_hora_corte,
|
||||
t1.forzar_num_formas_horizontales_cubierta AS forzar_num_formas_horizontales_cubierta,
|
||||
|
||||
@ -144,7 +144,7 @@ class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
|
||||
}
|
||||
|
||||
|
||||
public function getInitData($isRotativa = 0, $tarifas = [], $maquina_id = -1)
|
||||
public function getInitData($isRotativa = 0, $isInkjet=0, $tarifas = [], $maquina_id = -1)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
@ -158,6 +158,7 @@ class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
|
||||
$builder->where("t2.is_deleted", 0);
|
||||
$builder->where("t2.isActivo", 1);
|
||||
$builder->where("t2.rotativa", $isRotativa);
|
||||
$builder->where("t2.inkjet", $isInkjet);
|
||||
$builder->where("t1.active", 1);
|
||||
|
||||
$isFirst = true;
|
||||
@ -195,7 +196,7 @@ class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
|
||||
|
||||
|
||||
// Funcion para obtener todas las máquinas seleccionadas para un papel
|
||||
public function getInitSelectedMachines($papel_impresion_id= -1, $isRotativa)
|
||||
public function getInitSelectedMachines($papel_impresion_id= -1, $isRotativa=false, $isInkjet=false)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
@ -210,6 +211,7 @@ class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
|
||||
|
||||
// Se aplican las condiciones que tienen que cumplir
|
||||
$builder->where("t2.is_rotativa", $isRotativa);
|
||||
$builder->where("t2.is_inkjet", $isInkjet);
|
||||
|
||||
return $builder;
|
||||
}
|
||||
|
||||
@ -20,8 +20,9 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
|
||||
4 => "t1.color",
|
||||
5 => "t1.cubierta",
|
||||
6 => "t1.sobrecubierta",
|
||||
7 => "t1.rotativa",
|
||||
8 => "t1.isActivo"
|
||||
7 => "t1.inkjet",
|
||||
8 => "t1.rotativa",
|
||||
9 => "t1.isActivo"
|
||||
];
|
||||
|
||||
|
||||
@ -38,6 +39,7 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
|
||||
"color",
|
||||
"cubierta",
|
||||
"sobrecubierta",
|
||||
"inkjet",
|
||||
"rotativa",
|
||||
"isActivo",
|
||||
"deleted_at",
|
||||
@ -144,7 +146,8 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
|
||||
->select(
|
||||
"t1.id AS id, t1.nombre AS nombre, t1.defecto AS defecto, t1.referencia AS referencia, t1.mano AS mano,
|
||||
t1.espesor AS espesor, t1.gramaje AS gramaje, t1.precio_tonelada AS precio_tonelada,
|
||||
t1.bn AS bn, t1.color AS color, t1.cubierta AS cubierta, t1.sobrecubierta AS sobrecubierta, t1.rotativa AS rotativa,
|
||||
t1.bn AS bn, t1.color AS color, t1.cubierta AS cubierta, t1.sobrecubierta AS sobrecubierta,
|
||||
t1.inkjet AS inkjet, t1.rotativa AS rotativa,
|
||||
t1.isActivo AS isActivo, t2.nombre AS papel_generico_id"
|
||||
);
|
||||
|
||||
|
||||
@ -140,6 +140,131 @@ class PresupuestoService extends BaseService
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Devuelve los calculos para la linea de rotativa.
|
||||
*/
|
||||
public static function getCostesLineaInkjet($maquina, $papel_impresion, $datosPedido, $parametrosInkjet)
|
||||
{
|
||||
$data = [];
|
||||
|
||||
$data['resolucion'] = 600;
|
||||
$data['pulgada'] = 1 / 1000000000000.0;
|
||||
$data['superficie'] = round((($datosPedido->ancho / 2.54) / 10) * (($datosPedido->alto / 2.54) / 10), 2);
|
||||
|
||||
// posicionamos paginas en función de a favor de fibra o no
|
||||
|
||||
$anchoLibro = $datosPedido->ancho;
|
||||
$altoLibro = $datosPedido->alto;
|
||||
|
||||
$formas = PresupuestoService::getNumFormasPlana('interior', $maquina, $datosPedido->ancho, $datosPedido->alto, $datosPedido->isCosido);
|
||||
$response['fields'] = $formas;
|
||||
|
||||
|
||||
if ($response['fields']['num_formas']['posicion_formas'] == 'n/a') {
|
||||
$response['error']['value'] = true;
|
||||
$response['error']['message'] = 'no_formas_disponibles';
|
||||
return $response;
|
||||
}
|
||||
|
||||
$data['ancho'] = $anchoLibro;
|
||||
$data['alto'] = $altoLibro;
|
||||
|
||||
// si es cosido ancho x 2
|
||||
|
||||
if ($datosPedido->isCosido) {
|
||||
|
||||
$data['ancho'] = $data['ancho'] * 2;
|
||||
}
|
||||
|
||||
// calculo de papel y clicks
|
||||
$factor_anchura = round($maquina->ancho_impresion / $data['ancho'], 2);
|
||||
$factor_altura = round($maquina->alto_impresion / ($data['alto'] + self::MARGEN_PAGINAS_ROTATIVA), 2);
|
||||
$factor_altura_click = round($maquina->alto_click / ($data['alto'] + self::MARGEN_PAGINAS_ROTATIVA), 2);
|
||||
|
||||
$multiplicador_pliego = $datosPedido->isCosido ? 4 : 2;
|
||||
$paginas_por_pliego = round(floor($factor_anchura) * $factor_altura * $multiplicador_pliego, 2);
|
||||
$pliegos_libro = round($paginas_por_pliego ? $datosPedido->paginas / $paginas_por_pliego : 0, 2);
|
||||
$metros_papel_libro = round($pliegos_libro * ($maquina->alto_impresion / 1000.0), 2);
|
||||
$metros_papel_total = round($metros_papel_libro * ($datosPedido->tirada + $datosPedido->merma), 2);
|
||||
|
||||
$paginas_por_pliego_click = round(floor($factor_anchura) * $factor_altura_click * $multiplicador_pliego, 2);
|
||||
$pliegos_libro_click = round($paginas_por_pliego_click ? $datosPedido->paginas / $paginas_por_pliego_click : 0, 2);
|
||||
$clicks_libro = round(ceil($pliegos_libro_click) * 2, 2);
|
||||
$clicks_pedido = round($clicks_libro * ($datosPedido->tirada + $datosPedido->merma), 2);
|
||||
|
||||
$data['factor_altura'] = $factor_altura;
|
||||
$data['factor_anchura'] = $factor_anchura;
|
||||
$data['paginas_por_pliego'] = $paginas_por_pliego;
|
||||
$data['pliegos_libro'] = $pliegos_libro;
|
||||
$data['pliegos_pedido'] = $pliegos_libro * ($datosPedido->tirada + $datosPedido->merma);
|
||||
$data['metros_papel_libro'] = $metros_papel_libro;
|
||||
$data['metros_papel_total'] = $metros_papel_total;
|
||||
$data['clicks_libro'] = $clicks_libro;
|
||||
$data['clicks_pedido'] = $clicks_pedido;
|
||||
|
||||
// calculo de tintas
|
||||
$data['num_gotas_negro'] = round($data['superficie'] * $data['resolucion'] * $data['resolucion'] * ($parametrosInkjet->rotativa_negro / 100.0), 0);
|
||||
$data['num_gotas_cyan'] = round($data['superficie'] * $data['resolucion'] * $data['resolucion'] * ($parametrosInkjet->rotativa_cyan / 100.0), 0);
|
||||
$data['num_gotas_magenta'] = round($data['superficie'] * $data['resolucion'] * $data['resolucion'] * ($parametrosInkjet->rotativa_magenta / 100.0), 0);
|
||||
$data['num_gotas_amarillo'] = round($data['superficie'] * $data['resolucion'] * $data['resolucion'] * ($parametrosInkjet->rotativa_amarillo / 100.0), 0);
|
||||
|
||||
$pag_negro = $parametrosInkjet->bnPages;
|
||||
$pag_color = 0;
|
||||
if ($parametrosInkjet->colorPages>0) {
|
||||
$pag_color = $parametrosInkjet->colorPages;
|
||||
}
|
||||
|
||||
// peso tintas
|
||||
$data['peso_gotas_negro'] = round((($data['num_gotas_negro'] * $parametrosInkjet->rotativa_gota_negro * $data['pulgada']) / (17.91 / 20.0)) * $pag_negro * 1000, 6);
|
||||
$data['peso_gotas_cyan'] = round((($data['num_gotas_cyan'] * $parametrosInkjet->rotativa_gota_color * $data['pulgada']) / (17.65 / 20.0)) * $pag_color * 1000, 6);
|
||||
$data['peso_gotas_magenta'] = round((($data['num_gotas_magenta'] * $parametrosInkjet->rotativa_gota_color * $data['pulgada']) / (17.65 / 20.0)) * $pag_color * 1000, 6);
|
||||
$data['peso_gotas_amarillo'] = round((($data['num_gotas_amarillo'] * $parametrosInkjet->rotativa_gota_color * $data['pulgada']) / (17.65 / 20.0)) * $pag_color * 1000, 6);
|
||||
|
||||
// costes de tintas
|
||||
$data['peso_gotas_negro_pedido'] = round($data['peso_gotas_negro'], 2) * ($datosPedido->tirada + $datosPedido->merma);
|
||||
$data['peso_gotas_cyan_pedido'] = round($data['peso_gotas_cyan'], 2) * ($datosPedido->tirada + $datosPedido->merma);
|
||||
$data['peso_gotas_magenta_pedido'] = round($data['peso_gotas_magenta'], 2) * ($datosPedido->tirada + $datosPedido->merma);
|
||||
$data['peso_gotas_amarillo_pedido'] = round($data['peso_gotas_amarillo'], 2) * ($datosPedido->tirada + $datosPedido->merma);
|
||||
|
||||
// precio tinta
|
||||
$data['precio_tinta'] = round(
|
||||
round(($data['peso_gotas_negro_pedido'] / 1000.0) * $maquina->precio_tinta_negro, 2) +
|
||||
round(($data['peso_gotas_cyan_pedido'] / 1000.0) * $maquina->precio_tinta_color, 2) +
|
||||
round(($data['peso_gotas_magenta_pedido'] / 1000.0) * $maquina->precio_tinta_color, 2) +
|
||||
round(($data['peso_gotas_amarillo_pedido'] / 1000.0) * $maquina->precio_tinta_color, 2)
|
||||
, 2);
|
||||
|
||||
// precio pagina
|
||||
$data['precio_pagina_negro'] = round($pag_negro ? $data['precio_tinta'] / ($pag_negro * ($datosPedido->tirada + $datosPedido->merma)) : 0, 6);
|
||||
$data['precio_pagina_color'] = round($pag_color ? $data['precio_tinta'] / ($pag_color * ($datosPedido->tirada + $datosPedido->merma)) : 0, 6);
|
||||
|
||||
|
||||
|
||||
$data['mano'] = PresupuestoService::computeLomoInterior($datosPedido->paginas, $papel_impresion->espesor);
|
||||
// ($paginas / 2.0) * (($gramaje / 1000.0) * $papel_compra->mano);
|
||||
|
||||
// peso
|
||||
$data['peso'] = PresupuestoService::computePeso(
|
||||
ancho: $datosPedido->isCosido ? $datosPedido->ancho / 2.0 : $datosPedido->ancho,
|
||||
alto: $datosPedido->alto,
|
||||
gramaje: $papel_impresion->gramaje,
|
||||
paginas: $datosPedido->paginas
|
||||
);
|
||||
|
||||
$data['dimensiones_maquina'] = [$maquina->ancho, $maquina->alto];
|
||||
$data['dimensiones_maquina_impresion'] = [$maquina->ancho_impresion, $maquina->alto_impresion];
|
||||
$data['dimensiones_maquina_click'] = [$maquina->ancho_impresion, $maquina->alto_click];
|
||||
$data['dimensiones_libro'] = [$datosPedido->ancho, $datosPedido->alto];
|
||||
|
||||
$data['alto_click'] = $maquina->alto_click;
|
||||
|
||||
$formas = PresupuestoService::getNumFormasRot($maquina, $datosPedido->ancho, $datosPedido->alto, $datosPedido->isCosido);
|
||||
$data['num_formas'] = $formas;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Devuelve los calculos para la linea de rotativa.
|
||||
*/
|
||||
@ -262,11 +387,6 @@ class PresupuestoService extends BaseService
|
||||
$formas = PresupuestoService::getNumFormasRot($maquina, $datosPedido->ancho, $datosPedido->alto, $datosPedido->isCosido);
|
||||
$data['num_formas'] = $formas;
|
||||
|
||||
/*$data['num_formas']['posicion_formas'] = 'n/a';
|
||||
$data['num_formas']['num_formas_horizontales'] = 0;
|
||||
$data['num_formas']['num_formas_verticales'] = 0;
|
||||
$data['num_formas']['value'] = 0;
|
||||
*/
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
@ -164,9 +164,9 @@
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox"
|
||||
id="isTinta"
|
||||
name="is_tinta"
|
||||
name="is_inkjet"
|
||||
value="1"
|
||||
class="form-check-input"<?= $maquina->is_tinta == true ? 'checked' : ''; ?>
|
||||
class="form-check-input"<?= $maquina->is_inkjet == true ? 'checked' : ''; ?>
|
||||
>
|
||||
<label for="isPadre" class="form-check-label">
|
||||
<?= lang('Maquinas.isTinta') ?>
|
||||
@ -174,7 +174,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($maquina->is_rotativa == false): ?>
|
||||
<?php if ($maquina->is_rotativa == false && $maquina->is_inkjet == false): ?>
|
||||
<div class="row" id="datosRotativa" style="display:none">
|
||||
<?php else: ?>
|
||||
<div class="row" id="datosRotativa">
|
||||
@ -196,7 +196,8 @@
|
||||
maxLength="8" step="0.01" class="form-control"
|
||||
value="<?= old('precio_tinta_color', $maquina->precio_tinta_color) ?>">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
|
||||
<div class="col-md-2" <?= ($maquina->is_rotativa == false)?' style="display:none"':""; ?>>
|
||||
<label for="velocidadCorte" class="form-label">
|
||||
<?= lang('Maquinas.velocidadCorte') ?>
|
||||
</label>
|
||||
@ -204,7 +205,7 @@
|
||||
step="0.01" class="form-control"
|
||||
value="<?= old('velocidad_corte', $maquina->velocidad_corte) ?>">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="col-md-2" <?= ($maquina->is_rotativa == false)?' style="display:none"':""; ?>>
|
||||
<label for="precioHoraCorte" class="form-label">
|
||||
<?= lang('Maquinas.precioHoraCorte') ?>
|
||||
</label>
|
||||
@ -212,7 +213,7 @@
|
||||
maxLength="8" step="0.01" class="form-control"
|
||||
value="<?= old('precio_hora_corte', $maquina->precio_hora_corte) ?>">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="col-md-2" <?= ($maquina->is_rotativa == false)?' style="display:none"':""; ?>>
|
||||
<label for="metrosxminuto" class="form-label">
|
||||
<?= lang('Maquinas.metrosxminuto') ?>
|
||||
</label>
|
||||
@ -220,4 +221,5 @@
|
||||
step="0.01" class="form-control"
|
||||
value="<?= old('metrosxminuto', $maquina->metrosxminuto) ?>">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -208,6 +208,41 @@
|
||||
$('#isRotativa').prop("checked", !$('#isRotativa').prop("checked"));
|
||||
}
|
||||
|
||||
$('#isRotativa').on('change', function(){
|
||||
updatePapeles()
|
||||
})
|
||||
|
||||
$('#isTinta').on('change', function(){
|
||||
updatePapeles()
|
||||
})
|
||||
|
||||
function updatePapeles(){
|
||||
yeniden(json.<?= csrf_token() ?>);
|
||||
|
||||
$.ajax({
|
||||
url: '<?= route_to('updateMaquinaPapelOnTarifasChange') ?>',
|
||||
data: {
|
||||
maquina_id: id,
|
||||
isRotativa: isRotativa.watch,
|
||||
isInkjet: $('#isTinta').prop('checked'),
|
||||
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v,
|
||||
},
|
||||
method: 'POST',
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
success:function(response){
|
||||
|
||||
token=JSON.parse(response).<?= csrf_token() ?>;
|
||||
yeniden(token);
|
||||
|
||||
theTable.clearPipeline();
|
||||
theTable.draw();
|
||||
|
||||
theTable2.clearPipeline();
|
||||
theTable2.draw();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#isPadre').on("click",function(el){
|
||||
if($(this).is(':checked')){
|
||||
$("#selectVariante").show();
|
||||
@ -329,29 +364,7 @@
|
||||
|
||||
editor.on( 'postSubmit', function ( e, json, data, action ) {
|
||||
|
||||
yeniden(json.<?= csrf_token() ?>);
|
||||
|
||||
$.ajax({
|
||||
url: '<?= route_to('updateMaquinaPapelOnTarifasChange') ?>',
|
||||
data: {
|
||||
maquina_id: id,
|
||||
isRotativa: isRotativa.watch,
|
||||
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v,
|
||||
},
|
||||
method: 'POST',
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
success:function(response){
|
||||
|
||||
token=JSON.parse(response).<?= csrf_token() ?>;
|
||||
yeniden(token);
|
||||
|
||||
theTable.clearPipeline();
|
||||
theTable.draw();
|
||||
|
||||
theTable2.clearPipeline();
|
||||
theTable2.draw();
|
||||
}
|
||||
});
|
||||
updatePapeles()
|
||||
});
|
||||
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control" value="<?= old('nombre', $papelImpresion->nombre) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="mb-3">
|
||||
<label for="referencia" class="form-label">
|
||||
<?= lang('PapelImpresion.referencia') ?>
|
||||
</label>
|
||||
@ -22,13 +22,13 @@
|
||||
<input type="number" id="mano" name="mano" required maxLength="8" step="0.01" class="form-control" value="<?= old('mano', $papelImpresion->mano) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="mb-3">
|
||||
<label for="precioTonelada" class="form-label">
|
||||
<?= lang('PapelImpresion.precioTonelada') ?>*
|
||||
</label>
|
||||
<input type="number" id="precioTonelada" name="precio_tonelada" required maxLength="31" step="0.01" class="form-control" value="<?= old('precio_tonelada', $papelImpresion->precio_tonelada) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
</div><!--//.col -->
|
||||
|
||||
|
||||
@ -49,14 +49,14 @@
|
||||
</select>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="mb-3">
|
||||
<label for="gramaje" class="form-label">
|
||||
<?= lang('PapelImpresion.gramaje') ?>*
|
||||
</label>
|
||||
<input type="number" id="gramaje" name="gramaje" required maxLength="31" step="0.01" class="form-control" value="<?= old('gramaje', $papelImpresion->gramaje) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="mb-3">
|
||||
<label for="espesor" class="form-label">
|
||||
<?= lang('PapelImpresion.espesor') ?>*
|
||||
</label>
|
||||
@ -68,19 +68,19 @@
|
||||
|
||||
</div><!-- //.row -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-6 px-4">
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-6 px-4">
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
|
||||
<label for="bn" class="form-check-label">
|
||||
<input type="checkbox" id="bn" name="bn" value="1" class="form-check-input" <?= $papelImpresion->bn == true ? 'checked' : ''; ?>>
|
||||
<?= lang('PapelImpresion.bn') ?>
|
||||
</label>
|
||||
<label for="bn" class="form-check-label">
|
||||
<input type="checkbox" id="bn" name="bn" value="1" class="form-check-input" <?= $papelImpresion->bn == true ? 'checked' : ''; ?>>
|
||||
<?= lang('PapelImpresion.bn') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
|
||||
<label for="cubierta" class="form-check-label">
|
||||
@ -89,8 +89,8 @@
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
|
||||
<label for="rotativa" class="form-check-label">
|
||||
@ -100,7 +100,7 @@
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
|
||||
<label for="isActivo" class="form-check-label">
|
||||
@ -109,10 +109,10 @@
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-md-12 col-lg-6 px-4">
|
||||
<div class="mb-3">
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-md-12 col-lg-6 px-4">
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
|
||||
<label for="color" class="form-check-label">
|
||||
@ -132,6 +132,16 @@
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
|
||||
<label for="inkjet" class="form-check-label">
|
||||
<input type="checkbox" id="inkjet" name="inkjet" value="1" class="form-check-input" <?= $papelImpresion->inkjet == true ? 'checked' : ''; ?>>
|
||||
<?= lang('PapelImpresion.inkjet') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
|
||||
@ -141,5 +151,5 @@
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
</div><!-- //.row -->
|
||||
</div><!--//.col -->
|
||||
</div><!-- //.row -->
|
||||
@ -58,7 +58,7 @@
|
||||
</div> <!-- //.accordion -->
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if(str_contains($formAction,'edit') && $papelImpresion->rotativa == true): ?>
|
||||
<?php if(str_contains($formAction,'edit') && ($papelImpresion->rotativa == true || $papelImpresion->inkjet == true)): ?>
|
||||
<div class="accordion mt-3" id="accordionTipologias">
|
||||
|
||||
<div class="card accordion-item active">
|
||||
@ -729,7 +729,17 @@
|
||||
.submit();
|
||||
} );
|
||||
|
||||
|
||||
$('#rotativa').on('change', function() {
|
||||
if($('#inkjet').prop('checked')){
|
||||
$('#inkjet').prop('checked', false)
|
||||
}
|
||||
})
|
||||
|
||||
$('#inkjet').on('change', function() {
|
||||
if($('#rotativa').prop('checked')){
|
||||
$('#rotativa').prop('checked', false)
|
||||
}
|
||||
})
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
@ -25,7 +25,8 @@
|
||||
<th><?= lang('PapelImpresion.color') ?></th>
|
||||
<th><?= lang('PapelImpresion.cubierta') ?></th>
|
||||
<th><?= lang('PapelImpresion.sobrecubierta') ?></th>
|
||||
<th><?= lang('PapelImpresion.rotativa') ?></th>
|
||||
<th><?= lang('PapelImpresion.inkjet') ?></th>
|
||||
<th><?= lang('PapelImpresion.rotativa') ?></th>
|
||||
<th><?= lang('PapelImpresion.activo') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
@ -100,6 +101,7 @@
|
||||
{ 'data': 'color' },
|
||||
{ 'data': 'cubierta' },
|
||||
{ 'data': 'sobrecubierta' },
|
||||
{ 'data': 'inkjet' },
|
||||
{ 'data': 'rotativa' },
|
||||
{ 'data': 'isActivo' },
|
||||
{ 'data': actionBtns }
|
||||
@ -108,7 +110,7 @@
|
||||
|
||||
|
||||
theTable.on( 'draw.dt', function () {
|
||||
const boolCols = [3, 4, 5, 6, 7, 8];
|
||||
const boolCols = [3, 4, 5, 6, 7, 8, 9];
|
||||
for (let coln of boolCols) {
|
||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||
|
||||
@ -1134,7 +1134,7 @@ function change_lp_bn_paginas(){
|
||||
}
|
||||
}
|
||||
|
||||
function calcularPresupuesto_bn(input_data={}){
|
||||
function calcularPresupuesto_bn(input_data={}, updatedTipologias = false){
|
||||
|
||||
const dimension = getDimensionLibro();
|
||||
|
||||
@ -1166,6 +1166,15 @@ function calcularPresupuesto_bn(input_data={}){
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
|
||||
if(updatedTipologias){
|
||||
datos.gota_negro= $('#lp_bn_gotaNegro').val()
|
||||
datos.gota_color= $('#lp_bn_gotaColor').val()
|
||||
datos.negro= $('#lp_bn_cobNegro').val()
|
||||
datos.cyan= $('#lp_bn_cobCyan').val()
|
||||
datos.magenta= $('#lp_bn_cobMagenta').val()
|
||||
datos.amarillo= $('#lp_bn_cobAmarillo').val()
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/cosidotapablanda/datatable",
|
||||
@ -1203,8 +1212,35 @@ function calcularPresupuesto_bn(input_data={}){
|
||||
})
|
||||
}
|
||||
|
||||
function change_lp_bn_tipologia(){
|
||||
|
||||
if( parseInt($('#lp_bn_paginas').val())>0 &&
|
||||
parseInt($('#lp_bn_papel option:selected').val())>0 &&
|
||||
$('#lp_bn_gramaje option:selected').text().length>0 &&
|
||||
parseInt($('#lp_bn_papelImpresion option:selected').val())>0
|
||||
){
|
||||
|
||||
calcularPresupuesto_bn({},true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function por_defecto_lp_bn(){
|
||||
|
||||
if( parseInt($('#lp_bn_paginas').val())>0 &&
|
||||
parseInt($('#lp_bn_papel option:selected').val())>0 &&
|
||||
$('#lp_bn_gramaje option:selected').text().length>0 &&
|
||||
parseInt($('#lp_bn_papelImpresion option:selected').val())>0
|
||||
){
|
||||
|
||||
calcularPresupuesto_bn();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function fill_lp_bn(row, fromComparator=false){
|
||||
|
||||
console.log(row)
|
||||
if(fromComparator){
|
||||
|
||||
var input_data = {
|
||||
@ -1229,7 +1265,7 @@ function fill_lp_bn(row, fromComparator=false){
|
||||
}
|
||||
row.child(format(row.data())).show();
|
||||
|
||||
eventos_lp_bn()
|
||||
eventos_lp_bn(data.maquinaTipo=='inkjet'?true:false)
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales()
|
||||
@ -1241,13 +1277,19 @@ function fill_lp_bn(row, fromComparator=false){
|
||||
|
||||
}
|
||||
|
||||
function eventos_lp_bn(){
|
||||
function eventos_lp_bn(isInkjet = false){
|
||||
$('#lp_bn_papel').bind("focus", {clear_selectors: true}, clear_lp_bn);
|
||||
$('#lp_bn_gramaje').bind("focus", set_lp_bn_gramaje);
|
||||
$('#lp_bn_papelImpresion').focus("focus", set_lp_bn_papelImpresion);
|
||||
$('#lp_bn_maquina').bind("focus", set_lp_bn_maquina);
|
||||
$('#lp_bn_maquina').bind("change", change_lp_bn_maquina);
|
||||
$('#lp_bn_vercalculos').bind("click", {rowId: 'lp_bn'}, verCalculosInkjet);
|
||||
|
||||
if(isInkjet){
|
||||
$('.lp-bn-tipologia').bind("change", change_lp_bn_tipologia);
|
||||
$('#lp_bn_defecto').bind("click", por_defecto_lp_bn);
|
||||
}
|
||||
|
||||
$('#lp_bn_checkPapel').bind("change", {id_linea: 'lp_bn'}, update_total_linea);
|
||||
$('#lp_bn_checkClicks').bind("change", {id_linea: 'lp_bn'}, update_total_linea);
|
||||
}
|
||||
@ -1378,7 +1420,32 @@ function change_lp_color_paginas(){
|
||||
}
|
||||
}
|
||||
|
||||
function calcularPresupuesto_color(input_data={}){
|
||||
function change_lp_color_tipologia(){
|
||||
|
||||
if( parseInt($('#lp_color_paginas').val())>0 &&
|
||||
parseInt($('#lp_color_papel option:selected').val())>0 &&
|
||||
$('#lp_color_gramaje option:selected').text().length>0 &&
|
||||
parseInt($('#lp_color_papelImpresion option:selected').val())>0
|
||||
){
|
||||
|
||||
calcularPresupuesto_color({},true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function por_defecto_lp_bn(){
|
||||
|
||||
if( parseInt($('#lp_color_paginas').val())>0 &&
|
||||
parseInt($('#lp_color_papel option:selected').val())>0 &&
|
||||
$('#lp_color_gramaje option:selected').text().length>0 &&
|
||||
parseInt($('#lp_color_papelImpresion option:selected').val())>0
|
||||
){
|
||||
|
||||
calcularPresupuesto_color();
|
||||
}
|
||||
}
|
||||
|
||||
function calcularPresupuesto_color(input_data={}, updatedTipologias = false){
|
||||
|
||||
const dimension = getDimensionLibro();
|
||||
|
||||
@ -1410,6 +1477,15 @@ function calcularPresupuesto_color(input_data={}){
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
|
||||
if(updatedTipologias){
|
||||
datos.gota_negro= $('#lp_color_gotaNegro').val()
|
||||
datos.gota_color= $('#lp_color_gotaColor').val()
|
||||
datos.negro= $('#lp_color_cobNegro').val()
|
||||
datos.cyan= $('#lp_color_cobCyan').val()
|
||||
datos.magenta= $('#lp_color_cobMagenta').val()
|
||||
datos.amarillo= $('#lp_color_cobAmarillo').val()
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/cosidotapablanda/datatable",
|
||||
@ -1471,7 +1547,7 @@ function fill_lp_color(row, fromComparator=false){
|
||||
}
|
||||
row.child(format(row.data())).show();
|
||||
|
||||
eventos_lp_color()
|
||||
eventos_lp_color(data.maquinaTipo=='inkjet'?true:false)
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales()
|
||||
@ -1483,15 +1559,21 @@ function fill_lp_color(row, fromComparator=false){
|
||||
|
||||
}
|
||||
|
||||
function eventos_lp_color(){
|
||||
function eventos_lp_color(isInkjet = false){
|
||||
|
||||
$('#lp_color_papel').bind("focus", {clear_selectors: true}, clear_lp_color);
|
||||
$('#lp_color_gramaje').bind("focus", set_lp_color_gramaje);
|
||||
$('#lp_color_papelImpresion').focus("focus", set_lp_color_papelImpresion);
|
||||
$('#lp_color_maquina').bind("focus", set_lp_color_maquina);
|
||||
$('#lp_color_maquina').bind("change", change_color_maquina);
|
||||
$('#lp_color_maquina').bind("change", change_lp_color_maquina);
|
||||
$('#lp_color_paginas').bind("change", change_lp_color_paginas);
|
||||
$('#lp_color_vercalculos').bind("click", {rowId: 'lp_color'}, verCalculosInkjet);
|
||||
|
||||
if(isInkjet){
|
||||
$('.lp-color-tipologia').bind("change", change_lp_color_tipologia);
|
||||
$('#lp_color_defecto').bind("click", por_defecto_lp_color);
|
||||
}
|
||||
|
||||
$('#lp_color_checkPapel').bind("change", {id_linea: 'lp_color'}, update_total_linea);
|
||||
$('#lp_color_checkClicks').bind("change", {id_linea: 'lp_color'}, update_total_linea);
|
||||
}
|
||||
@ -1620,7 +1702,34 @@ function change_lp_bnhq_paginas(){
|
||||
}
|
||||
}
|
||||
|
||||
function calcularPresupuesto_bnhq(input_data={}){
|
||||
|
||||
function change_lp_bnhq_tipologia(){
|
||||
|
||||
if( parseInt($('#lp_bnhq_paginas').val())>0 &&
|
||||
parseInt($('#lp_bnhq_papel option:selected').val())>0 &&
|
||||
$('#lp_bnhq_gramaje option:selected').text().length>0 &&
|
||||
parseInt($('#lp_bnhq_papelImpresion option:selected').val())>0
|
||||
){
|
||||
|
||||
calcularPresupuesto_bnhq({},true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function por_defecto_lp_bnhq(){
|
||||
|
||||
if( parseInt($('#lp_bnhq_paginas').val())>0 &&
|
||||
parseInt($('#lp_bnhq_papel option:selected').val())>0 &&
|
||||
$('#lp_bnhq_gramaje option:selected').text().length>0 &&
|
||||
parseInt($('#lp_bnhq_papelImpresion option:selected').val())>0
|
||||
){
|
||||
|
||||
calcularPresupuesto_bnhq();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function calcularPresupuesto_bnhq(input_data={}, updatedTipologias = false){
|
||||
|
||||
const dimension = getDimensionLibro();
|
||||
|
||||
@ -1652,6 +1761,15 @@ function calcularPresupuesto_bnhq(input_data={}){
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
|
||||
if(updatedTipologias){
|
||||
datos.gota_negro= $('#lp_bnhq_gotaNegro').val()
|
||||
datos.gota_color= $('#lp_bnhq_gotaColor').val()
|
||||
datos.negro= $('#lp_bnhq_cobNegro').val()
|
||||
datos.cyan= $('#lp_bnhq_cobCyan').val()
|
||||
datos.magenta= $('#lp_bnhq_cobMagenta').val()
|
||||
datos.amarillo= $('#lp_bnhq_cobAmarillo').val()
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/cosidotapablanda/datatable",
|
||||
@ -1714,7 +1832,7 @@ function fill_lp_bnhq(row, fromComparator=false){
|
||||
}
|
||||
row.child(format(row.data())).show();
|
||||
|
||||
eventos_lp_bnhq()
|
||||
eventos_lp_bnhq(data.maquinaTipo=='inkjet'?true:false)
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales()
|
||||
@ -1725,7 +1843,7 @@ function fill_lp_bnhq(row, fromComparator=false){
|
||||
// getVisibleTabs(); // Update preview UI
|
||||
}
|
||||
|
||||
function eventos_lp_bnhq(){
|
||||
function eventos_lp_bnhq(isInkjet = false){
|
||||
$('#lp_bnhq_papel').bind("focus", {clear_selectors: true}, clear_lp_bnhq);
|
||||
$('#lp_bnhq_gramaje').bind("focus", set_lp_bnhq_gramaje);
|
||||
$('#lp_bnhq_papelImpresion').focus("focus", set_lp_bnhq_papelImpresion);
|
||||
@ -1733,6 +1851,12 @@ function eventos_lp_bnhq(){
|
||||
$('#lp_bnhq_maquina').bind("change", change_lp_bnhq_maquina);
|
||||
$('#lp_bnhq_paginas').bind("change", change_lp_bnhq_paginas);
|
||||
$('#lp_bnhq_vercalculos').bind("click", {rowId: 'lp_bnhq'}, verCalculosInkjet);
|
||||
|
||||
if(isInkjet){
|
||||
$('.lp-bnhq-tipologia').bind("change", change_lp_bnhq_tipologia);
|
||||
$('#lp_bnhq_defecto').bind("click", por_defecto_lp_bnhq);
|
||||
}
|
||||
|
||||
$('#lp_bnhq_checkPapel').bind("change", {id_linea: 'lp_bnhq'}, update_total_linea);
|
||||
$('#lp_bnhq_checkClicks').bind("change", {id_linea: 'lp_bnhq'}, update_total_linea);
|
||||
}
|
||||
@ -1865,7 +1989,34 @@ function change_lp_colorhq_paginas(){
|
||||
}
|
||||
|
||||
|
||||
function calcularPresupuesto_colorhq(input_data={}){
|
||||
function change_lp_colorhq_tipologia(){
|
||||
|
||||
if( parseInt($('#lp_colorhq_paginas').val())>0 &&
|
||||
parseInt($('#lp_colorhq_papel option:selected').val())>0 &&
|
||||
$('#lp_colorhq_gramaje option:selected').text().length>0 &&
|
||||
parseInt($('#lp_colorhq_papelImpresion option:selected').val())>0
|
||||
){
|
||||
|
||||
calcularPresupuesto_colorhq({},true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function por_defecto_lp_colorhq(){
|
||||
|
||||
if( parseInt($('#lp_colorhq_paginas').val())>0 &&
|
||||
parseInt($('#lp_colorhq_papel option:selected').val())>0 &&
|
||||
$('#lp_colorhq_gramaje option:selected').text().length>0 &&
|
||||
parseInt($('#lp_colorhq_papelImpresion option:selected').val())>0
|
||||
){
|
||||
|
||||
calcularPresupuesto_colorhq();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function calcularPresupuesto_colorhq(input_data={}, updatedTipologias = false){
|
||||
|
||||
const dimension = getDimensionLibro();
|
||||
|
||||
@ -1897,6 +2048,15 @@ function calcularPresupuesto_colorhq(input_data={}){
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
|
||||
if(updatedTipologias){
|
||||
datos.gota_negro= $('#lp_colorhq_gotaNegro').val()
|
||||
datos.gota_color= $('#lp_colorhq_gotaColor').val()
|
||||
datos.negro= $('#lp_colorhq_cobNegro').val()
|
||||
datos.cyan= $('#lp_colorhq_cobCyan').val()
|
||||
datos.magenta= $('#lp_colorhq_cobMagenta').val()
|
||||
datos.amarillo= $('#lp_colorhq_cobAmarillo').val()
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/cosidotapablanda/datatable",
|
||||
@ -1957,7 +2117,7 @@ function fill_lp_colorhq(row, fromComparator=false){
|
||||
}
|
||||
row.child(format(row.data())).show();
|
||||
|
||||
eventos_lp_colorhq()
|
||||
eventos_lp_colorhq(data.maquinaTipo=='inkjet'?true:false)
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales()
|
||||
@ -1969,7 +2129,7 @@ function fill_lp_colorhq(row, fromComparator=false){
|
||||
|
||||
}
|
||||
|
||||
function eventos_lp_colorhq(){
|
||||
function eventos_lp_colorhq(isInkjet = false){
|
||||
|
||||
$('#lp_colorhq_papel').bind("focus", {clear_selectors: true}, clear_lp_colorhq);
|
||||
$('#lp_colorhq_gramaje').bind("focus", set_lp_colorhq_gramaje);
|
||||
@ -1978,6 +2138,12 @@ function eventos_lp_colorhq(){
|
||||
$('#lp_colorhq_maquina').bind("change", change_lp_colorhq_maquina);
|
||||
$('#lp_colorhq_paginas').bind("change", change_lp_colorhq_paginas);
|
||||
$('#lp_colorhq_vercalculos').bind("click", {rowId: 'lp_colorhq'}, verCalculosInkjet);
|
||||
|
||||
if(isInkjet){
|
||||
$('.lp-colorhq-tipologia').bind("change", change_lp_colorhq_tipologia);
|
||||
$('#lp_colorhq_defecto').bind("click", por_defecto_lp_colorhq);
|
||||
}
|
||||
|
||||
$('#lp_colorhq_checkPapel').bind("change", {id_linea: 'lp_colorhq'}, update_total_linea);
|
||||
$('#lp_colorhq_checkClicks').bind("change", {id_linea: 'lp_colorhq'}, update_total_linea);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user