mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'dev/fresado_tapa_dura' into 'main'
Dev/fresado tapa dura See merge request jjimenez/safekat!150
This commit is contained in:
@ -196,12 +196,15 @@ class Papelesimpresion extends \App\Controllers\GoBaseResourceController
|
|||||||
if ($this->request->getPost('color') == null) {
|
if ($this->request->getPost('color') == null) {
|
||||||
$sanitizedData['color'] = false;
|
$sanitizedData['color'] = false;
|
||||||
}
|
}
|
||||||
if ($this->request->getPost('portada') == null) {
|
|
||||||
$sanitizedData['portada'] = false;
|
|
||||||
}
|
|
||||||
if ($this->request->getPost('cubierta') == null) {
|
if ($this->request->getPost('cubierta') == null) {
|
||||||
$sanitizedData['cubierta'] = false;
|
$sanitizedData['cubierta'] = false;
|
||||||
}
|
}
|
||||||
|
if ($this->request->getPost('sobrecubierta') == null) {
|
||||||
|
$sanitizedData['sobrecubierta'] = false;
|
||||||
|
}
|
||||||
|
if ($this->request->getPost('guardas') == null) {
|
||||||
|
$sanitizedData['guardas'] = false;
|
||||||
|
}
|
||||||
if ($this->request->getPost('rotativa') == null) {
|
if ($this->request->getPost('rotativa') == null) {
|
||||||
$sanitizedData['rotativa'] = false;
|
$sanitizedData['rotativa'] = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -322,6 +322,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
$this->viewData['papelGenericoColorList'] = $this->getPapelGenericoColor();
|
$this->viewData['papelGenericoColorList'] = $this->getPapelGenericoColor();
|
||||||
$this->viewData['papelGenericoColorHQList'] = $this->getPapelGenericoColorHQ();
|
$this->viewData['papelGenericoColorHQList'] = $this->getPapelGenericoColorHQ();
|
||||||
$this->viewData['papelGenericoCubiertaList'] = $this->getPapelGenericoCubierta();
|
$this->viewData['papelGenericoCubiertaList'] = $this->getPapelGenericoCubierta();
|
||||||
|
$this->viewData['papelGenericoGuardasList'] = $this->getPapelGenericoGuardas();
|
||||||
$this->viewData['papelGenericoSobrecubiertaList'] = $this->getPapelGenericoSobreCubierta();
|
$this->viewData['papelGenericoSobrecubiertaList'] = $this->getPapelGenericoSobreCubierta();
|
||||||
$this->viewData['papelGenericoRotativaNegroList'] = $this->getPapelGenericoRotativaNegro();
|
$this->viewData['papelGenericoRotativaNegroList'] = $this->getPapelGenericoRotativaNegro();
|
||||||
$this->viewData['papelGenericoRotativaColorList'] = $this->getPapelGenericoRotativaColor();
|
$this->viewData['papelGenericoRotativaColorList'] = $this->getPapelGenericoRotativaColor();
|
||||||
@ -344,12 +345,13 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
|
|
||||||
$this->viewData['POD'] = $this->getPOD();
|
$this->viewData['POD'] = $this->getPOD();
|
||||||
|
|
||||||
$this->viewData['serviciosCheckboxes'] = [
|
$this->viewData['serviciosAutomaticos'] = [
|
||||||
'retractilado' => 3,
|
'retractilado' => 3,
|
||||||
'retractilado5' => 5,
|
'retractilado5' => 5,
|
||||||
'ferro' => 24,
|
'ferro' => 24,
|
||||||
'prototipo' => 9,
|
'prototipo' => 9,
|
||||||
'fajaColor' => 16,
|
'fajaColor' => 16,
|
||||||
|
'plegadoGuardas' => 62,
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->viewData['tipo_impresion_id'] = $presupuestoEntity->tipo_impresion_id; // Cosido tapa blanda JJO
|
$this->viewData['tipo_impresion_id'] = $presupuestoEntity->tipo_impresion_id; // Cosido tapa blanda JJO
|
||||||
@ -467,7 +469,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($type=='interior') {
|
if ($type=='interior' || $type=='guardas') {
|
||||||
|
|
||||||
$datosTipolog = $reqData['negro'] ?? null;
|
$datosTipolog = $reqData['negro'] ?? null;
|
||||||
if(!is_null($datosTipolog)){
|
if(!is_null($datosTipolog)){
|
||||||
@ -484,6 +486,19 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
array_push($datosTipolog, $data);
|
array_push($datosTipolog, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($type=='guardas') {
|
||||||
|
$datosPedido->paginas_impresion = intval($reqData['paginas_impresion']) ?? 0;
|
||||||
|
// Para el caso de Fresado y Cosido tapa dura, las guardas son un diptico
|
||||||
|
// y hay que imprimirlas como "cosido" (dos hojas pegadas). En el caso de espiral
|
||||||
|
// o wire-o tapa dura, las guardas se imprimen como hojas sueltas
|
||||||
|
if($tipo_impresion_id == 1 || $tipo_impresion_id == 3){
|
||||||
|
$datosPedido->isCosido = true;
|
||||||
|
}else if ($tipo_impresion_id == 5 || $tipo_impresion_id == 7){
|
||||||
|
$datosPedido->isCosido = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$a_favor_fibra = $reqData['a_favor_fibra'] ?? false;
|
$a_favor_fibra = $reqData['a_favor_fibra'] ?? false;
|
||||||
|
|
||||||
$resourceData = $this->getCompIntData($type, $datosPedido, $papel_generico, $gramaje, $isColor, $isHq, $cliente_id, $datosTipolog, $a_favor_fibra);
|
$resourceData = $this->getCompIntData($type, $datosPedido, $papel_generico, $gramaje, $isColor, $isHq, $cliente_id, $datosTipolog, $a_favor_fibra);
|
||||||
@ -538,7 +553,8 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
if($type=='sobrecubierta')
|
if($type=='sobrecubierta')
|
||||||
$datosPedido->lomo_cubierta = $reqData['lomo_cubierta'];
|
$datosPedido->lomo_cubierta = $reqData['lomo_cubierta'];
|
||||||
|
|
||||||
$datosPedido->anchoExteriores = PresupuestoService::getAnchoTotalExteriores($datosPedido);
|
$datosPedido->anchoExteriores = PresupuestoService::getAnchoTotalExteriores($tipo_impresion_id, $datosPedido);
|
||||||
|
$datosPedido->altoExteriores = PresupuestoService::getAltoTotalExteriores($tipo_impresion_id, $datosPedido);
|
||||||
// Cubierta y sobrecubierta siempre color HQ
|
// Cubierta y sobrecubierta siempre color HQ
|
||||||
$resourceData = $this->getCompIntData($type, $datosPedido, $papel_generico, $gramaje, $isColor, 1, $cliente_id);
|
$resourceData = $this->getCompIntData($type, $datosPedido, $papel_generico, $gramaje, $isColor, 1, $cliente_id);
|
||||||
|
|
||||||
@ -675,6 +691,13 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
'rotativa' => 0,
|
'rotativa' => 0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
else if ( $uso == 'guardas' ){
|
||||||
|
$opciones_papel = array(
|
||||||
|
'guardas' => 1,
|
||||||
|
//'color' => 1,
|
||||||
|
'rotativa' => 0,
|
||||||
|
);
|
||||||
|
}
|
||||||
else if( $isColor ){
|
else if( $isColor ){
|
||||||
$opciones_papel = array(
|
$opciones_papel = array(
|
||||||
'color' => 1,
|
'color' => 1,
|
||||||
@ -704,7 +727,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
$maquinas = $maquinamodel->getMaquinaImpresionForPresupuesto(
|
$maquinas = $maquinamodel->getMaquinaImpresionForPresupuesto(
|
||||||
is_rotativa: 0,
|
is_rotativa: 0,
|
||||||
tarifa_tipo: $tipo,
|
tarifa_tipo: $tipo,
|
||||||
uso_tarifa: $uso,
|
uso_tarifa: ($uso=='guardas')?'interior':$uso,
|
||||||
tirada: $datosPedido->tirada + $datosPedido->merma,
|
tirada: $datosPedido->tirada + $datosPedido->merma,
|
||||||
papel_impresion_id: $papel->id,
|
papel_impresion_id: $papel->id,
|
||||||
);
|
);
|
||||||
@ -717,7 +740,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
'a_favor_fibra' => $a_favor_fibra, // este parametro se cambia para comprobar
|
'a_favor_fibra' => $a_favor_fibra, // este parametro se cambia para comprobar
|
||||||
// en las dos direcciones (menos en rustica fresada que es siempre 1)
|
// en las dos direcciones (menos en rustica fresada que es siempre 1)
|
||||||
'bnPages' => $isColor?0:$datosPedido->paginas,
|
'bnPages' => $isColor?0:$datosPedido->paginas,
|
||||||
'colorPages' => $isColor?$datosPedido->paginas:0,
|
'colorPages' => ($uso == 'guardas')?$datosPedido->paginas_impresion:($isColor?$datosPedido->paginas:0),
|
||||||
'rotativa_gota_negro' => 0,
|
'rotativa_gota_negro' => 0,
|
||||||
'rotativa_gota_color' => 0,
|
'rotativa_gota_color' => 0,
|
||||||
);
|
);
|
||||||
@ -746,7 +769,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$tarifamodel = new MaquinasTarifasImpresionModel();
|
$tarifamodel = new MaquinasTarifasImpresionModel();
|
||||||
[$tarifaId, $tarifa] = $tarifamodel->getTarifa($maquina->maquina_id, $uso, $tipo);
|
[$tarifaId, $tarifa] = $tarifamodel->getTarifa($maquina->maquina_id, ($uso=='guardas')?'interior':$uso, $tipo);
|
||||||
if(!is_float($tarifa)){
|
if(!is_float($tarifa)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -784,7 +807,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
|
|
||||||
$clientePreciosModel = new ClientePreciosModel();
|
$clientePreciosModel = new ClientePreciosModel();
|
||||||
$config = (object)[
|
$config = (object)[
|
||||||
"tipo" => $uso,
|
"tipo" => ($uso=='guardas')?'interior':$uso,
|
||||||
"tipo_maquina" => $maquina->is_inkjet?'inkjet':'toner',
|
"tipo_maquina" => $maquina->is_inkjet?'inkjet':'toner',
|
||||||
"tipo_impresion" => $tipo
|
"tipo_impresion" => $tipo
|
||||||
];
|
];
|
||||||
@ -805,11 +828,26 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
$linea['fields']['precio_impresion_horas'] = $precio_hora*(1+$margen_precio_hora/100.0)*$tiempo;
|
$linea['fields']['precio_impresion_horas'] = $precio_hora*(1+$margen_precio_hora/100.0)*$tiempo;
|
||||||
$linea['fields']['margen_impresion_horas'] = $precio_hora*($margen_precio_hora/100.0)*$tiempo;
|
$linea['fields']['margen_impresion_horas'] = $precio_hora*($margen_precio_hora/100.0)*$tiempo;
|
||||||
|
|
||||||
|
// para guardas
|
||||||
|
if(\property_exists($datosPedido, 'paginas_impresion')){
|
||||||
|
$linea['fields']['paginas_impresion'] = $datosPedido->paginas_impresion;
|
||||||
|
}
|
||||||
|
|
||||||
if($maquina->is_inkjet){
|
if($maquina->is_inkjet){
|
||||||
$linea['fields']['a_favor_fibra'] = $parametrosInkjet->a_favor_fibra;
|
$linea['fields']['a_favor_fibra'] = $parametrosInkjet->a_favor_fibra;
|
||||||
$linea['fields']['paginas_color'] = $isColor?$datosPedido->paginas:0;
|
$linea['fields']['paginas_color'] = $isColor?$datosPedido->paginas:0;
|
||||||
$linea['fields']['totalClicksPedido'] = $linea['fields']['precio_click_pedido'];
|
$linea['fields']['totalClicksPedido'] = $linea['fields']['precio_click_pedido'];
|
||||||
$linea['fields']['clicks_libro'] = round(ceil($linea['fields']['pliegos_libro']) * 2, 2);
|
if( $uso != 'guardas' ){
|
||||||
|
$linea['fields']['clicks_libro'] = round(ceil($linea['fields']['pliegos_libro']) * 2, 2);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if($datosPedido->paginas_impresion == 4)
|
||||||
|
$linea['fields']['clicks_libro'] = round(ceil($linea['fields']['pliegos_libro']), 2);
|
||||||
|
else if($datosPedido->paginas_impresion == 8)
|
||||||
|
$linea['fields']['clicks_libro'] = round(ceil($linea['fields']['pliegos_libro'])*2, 2);
|
||||||
|
else
|
||||||
|
$linea['fields']['clicks_libro'] = 0;
|
||||||
|
}
|
||||||
$linea['fields']['clicks_pedido'] = round($linea['fields']['clicks_libro'] * ($datosPedido->tirada + $datosPedido->merma), 2);
|
$linea['fields']['clicks_pedido'] = round($linea['fields']['clicks_libro'] * ($datosPedido->tirada + $datosPedido->merma), 2);
|
||||||
[$ancho, $alto] = PresupuestoService::calculoDimForma($datosPedido, $parametrosInkjet);
|
[$ancho, $alto] = PresupuestoService::calculoDimForma($datosPedido, $parametrosInkjet);
|
||||||
$linea['fields']['factor_anchura'] = round($maquina->ancho_impresion / $ancho, 2);
|
$linea['fields']['factor_anchura'] = round($maquina->ancho_impresion / $ancho, 2);
|
||||||
@ -1247,6 +1285,17 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getPapelGenericoGuardas()
|
||||||
|
{
|
||||||
|
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
||||||
|
$data = $model->getPapelForComparador('colorhq', false, false, false, true);
|
||||||
|
array_unshift($data, (object)array(
|
||||||
|
"id" => 0,
|
||||||
|
"nombre" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])
|
||||||
|
));
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
protected function getPapelGenericoSobreCubierta()
|
protected function getPapelGenericoSobreCubierta()
|
||||||
{
|
{
|
||||||
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
||||||
|
|||||||
@ -18,15 +18,7 @@ class Test extends BaseController
|
|||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
echo '<pre>';
|
echo '<pre>';
|
||||||
$papelImpresionTipologiaModel = new \App\Models\Configuracion\PapelImpresionTipologiaModel();
|
$this->getPapelesGuardas();
|
||||||
$datosTipologias = $papelImpresionTipologiaModel
|
|
||||||
->findTipologiasForPapelImpresion(17, 'color')
|
|
||||||
->get()->getResultObject();
|
|
||||||
|
|
||||||
|
|
||||||
var_dump($datosTipologias);
|
|
||||||
var_dump($datosTipologias[0]->cg);
|
|
||||||
|
|
||||||
echo '</pre>';
|
echo '</pre>';
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@ -187,6 +179,13 @@ class Test extends BaseController
|
|||||||
var_dump($data);
|
var_dump($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPapelesGuardas(){
|
||||||
|
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
||||||
|
$data = $model->getPapelForComparador('color', false, false, false, true);
|
||||||
|
|
||||||
|
var_dump($data);
|
||||||
|
}
|
||||||
|
|
||||||
public function getGramaje(){
|
public function getGramaje(){
|
||||||
$model = new PapelGenericoModel();
|
$model = new PapelGenericoModel();
|
||||||
$data = $model->getGramajeComparador("AHUESADO OFFSET", "bnhq" );
|
$data = $model->getGramajeComparador("AHUESADO OFFSET", "bnhq" );
|
||||||
|
|||||||
@ -19,6 +19,7 @@ class PapelImpresion extends \CodeIgniter\Entity\Entity
|
|||||||
"color" => true,
|
"color" => true,
|
||||||
"cubierta" => false,
|
"cubierta" => false,
|
||||||
"sobrecubierta" => false,
|
"sobrecubierta" => false,
|
||||||
|
"guardas" => false,
|
||||||
"inkjet" => false,
|
"inkjet" => false,
|
||||||
"rotativa" => false,
|
"rotativa" => false,
|
||||||
"is_deleted" => 0,
|
"is_deleted" => 0,
|
||||||
@ -36,6 +37,7 @@ class PapelImpresion extends \CodeIgniter\Entity\Entity
|
|||||||
"color" => "boolean",
|
"color" => "boolean",
|
||||||
"cubierta" => "boolean",
|
"cubierta" => "boolean",
|
||||||
"sobrecubierta" => "boolean",
|
"sobrecubierta" => "boolean",
|
||||||
|
"guardas" => "boolean",
|
||||||
"rotativa" => "boolean",
|
"rotativa" => "boolean",
|
||||||
"is_deleted" => "int",
|
"is_deleted" => "int",
|
||||||
];
|
];
|
||||||
|
|||||||
@ -10,6 +10,7 @@ class PresupuestoLineaEntity extends \CodeIgniter\Entity\Entity
|
|||||||
"presupuesto_id" => null,
|
"presupuesto_id" => null,
|
||||||
"tipo" => null,
|
"tipo" => null,
|
||||||
"paginas" => 0,
|
"paginas" => 0,
|
||||||
|
"paginas_impresion" => 0, //guardas
|
||||||
"paginas_color_posicion" => null,
|
"paginas_color_posicion" => null,
|
||||||
"solapas_ancho" => 0.0,
|
"solapas_ancho" => 0.0,
|
||||||
"papel_id" => null,
|
"papel_id" => null,
|
||||||
@ -79,6 +80,7 @@ class PresupuestoLineaEntity extends \CodeIgniter\Entity\Entity
|
|||||||
protected $casts = [
|
protected $casts = [
|
||||||
"presupuesto_id" => "int",
|
"presupuesto_id" => "int",
|
||||||
"paginas" => "int",
|
"paginas" => "int",
|
||||||
|
"paginas_impresion" => "int", // guardas
|
||||||
"solapas_ancho" => "float",
|
"solapas_ancho" => "float",
|
||||||
"papel_id" => "?int",
|
"papel_id" => "?int",
|
||||||
"papel_impresion_id" => "?int",
|
"papel_impresion_id" => "?int",
|
||||||
@ -140,3 +142,4 @@ class PresupuestoLineaEntity extends \CodeIgniter\Entity\Entity
|
|||||||
"total_linea" => "double",
|
"total_linea" => "double",
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10,6 +10,7 @@ return [
|
|||||||
'createdAt' => 'Creado en',
|
'createdAt' => 'Creado en',
|
||||||
'cubierta' => 'Cubierta',
|
'cubierta' => 'Cubierta',
|
||||||
'sobrecubierta' => 'Sobrecubierta',
|
'sobrecubierta' => 'Sobrecubierta',
|
||||||
|
'guardas' => 'Guardas',
|
||||||
'defecto' => 'Por defecto',
|
'defecto' => 'Por defecto',
|
||||||
'deletedAt' => 'Borrado en',
|
'deletedAt' => 'Borrado en',
|
||||||
'espesor' => 'Espesor',
|
'espesor' => 'Espesor',
|
||||||
|
|||||||
@ -64,6 +64,7 @@ return [
|
|||||||
'retractilado' => 'Retractilado individual',
|
'retractilado' => 'Retractilado individual',
|
||||||
'retractilado5' => 'Retractilado de 5',
|
'retractilado5' => 'Retractilado de 5',
|
||||||
'Guardas' => 'Guardas',
|
'Guardas' => 'Guardas',
|
||||||
|
'imprimir_guardas' => 'Imprimir guardas',
|
||||||
'fajaColor' => 'Imprimir faja a color',
|
'fajaColor' => 'Imprimir faja a color',
|
||||||
'compInteriorPlana' => 'Interior en plana',
|
'compInteriorPlana' => 'Interior en plana',
|
||||||
'compInteriorRotativa' => 'Interior en rotativa',
|
'compInteriorRotativa' => 'Interior en rotativa',
|
||||||
@ -95,6 +96,7 @@ return [
|
|||||||
'encuadernacion' => 'Encuadernación',
|
'encuadernacion' => 'Encuadernación',
|
||||||
'solapasCubierta' => 'Solapas cubierta',
|
'solapasCubierta' => 'Solapas cubierta',
|
||||||
'solapasAnchoCubierta' => 'Ancho solapas cubierta',
|
'solapasAnchoCubierta' => 'Ancho solapas cubierta',
|
||||||
|
'sinImpresion' => 'Sin impresion',
|
||||||
'1cara' => '1 cara',
|
'1cara' => '1 cara',
|
||||||
'2caras' => '2 caras',
|
'2caras' => '2 caras',
|
||||||
'bn' => 'BN',
|
'bn' => 'BN',
|
||||||
|
|||||||
@ -93,7 +93,7 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getPapelForComparador($tipo, $is_cubierta = false, $is_sobrecubierta = false, $rotativa = false)
|
public function getPapelForComparador($tipo, $is_cubierta = false, $is_sobrecubierta = false, $rotativa = false, $is_guardas = false)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
1.-> Tipo impresion
|
1.-> Tipo impresion
|
||||||
@ -128,8 +128,9 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
|
|||||||
$builder->where("t5.uso", 'cubierta');
|
$builder->where("t5.uso", 'cubierta');
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$builder->where("t2.cubierta", 0);
|
if(!$is_guardas){
|
||||||
$builder->where("t5.uso", 'interior');
|
$builder->where("t2.cubierta", 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($is_sobrecubierta==true){
|
if($is_sobrecubierta==true){
|
||||||
@ -137,13 +138,19 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
|
|||||||
$builder->where("t5.uso", 'sobrecubierta');
|
$builder->where("t5.uso", 'sobrecubierta');
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$builder->where("t2.sobrecubierta", 0);
|
if(!$is_guardas){
|
||||||
|
$builder->where("t2.sobrecubierta", 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($is_cubierta==false && $is_sobrecubierta==false){
|
if($is_cubierta==false && $is_sobrecubierta==false){
|
||||||
$builder->where("t5.uso", 'interior');
|
$builder->where("t5.uso", 'interior');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($is_guardas==true){
|
||||||
|
$builder->where("t2.guardas", 1);
|
||||||
|
}
|
||||||
|
|
||||||
if($rotativa==true){
|
if($rotativa==true){
|
||||||
$builder->where("t2.rotativa", 1);
|
$builder->where("t2.rotativa", 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,9 +20,10 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
|
|||||||
4 => "t1.color",
|
4 => "t1.color",
|
||||||
5 => "t1.cubierta",
|
5 => "t1.cubierta",
|
||||||
6 => "t1.sobrecubierta",
|
6 => "t1.sobrecubierta",
|
||||||
7 => "t1.inkjet",
|
7 => "t1.guardas",
|
||||||
8 => "t1.rotativa",
|
8 => "t1.inkjet",
|
||||||
9 => "t1.isActivo"
|
9 => "t1.rotativa",
|
||||||
|
10 => "t1.isActivo"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@ -39,6 +40,7 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
|
|||||||
"color",
|
"color",
|
||||||
"cubierta",
|
"cubierta",
|
||||||
"sobrecubierta",
|
"sobrecubierta",
|
||||||
|
"guardas",
|
||||||
"inkjet",
|
"inkjet",
|
||||||
"rotativa",
|
"rotativa",
|
||||||
"isActivo",
|
"isActivo",
|
||||||
@ -146,7 +148,7 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
|
|||||||
->select(
|
->select(
|
||||||
"t1.id AS id, t1.nombre AS nombre, t1.defecto AS defecto, t1.referencia AS referencia, t1.mano AS mano,
|
"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.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.bn AS bn, t1.color AS color, t1.cubierta AS cubierta, t1.sobrecubierta AS sobrecubierta, t1.guardas AS guardas,
|
||||||
t1.inkjet AS inkjet, t1.rotativa AS rotativa,
|
t1.inkjet AS inkjet, t1.rotativa AS rotativa,
|
||||||
t1.isActivo AS isActivo, t2.nombre AS papel_generico_id"
|
t1.isActivo AS isActivo, t2.nombre AS papel_generico_id"
|
||||||
);
|
);
|
||||||
@ -227,6 +229,7 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
|
|||||||
$color = array_key_exists('color', $options)? $options['color'] : null;
|
$color = array_key_exists('color', $options)? $options['color'] : null;
|
||||||
$cubierta = array_key_exists('cubierta', $options)? $options['cubierta'] : null;
|
$cubierta = array_key_exists('cubierta', $options)? $options['cubierta'] : null;
|
||||||
$sobrecubierta = array_key_exists('sobrecubierta', $options)? $options['sobrecubierta'] : null;
|
$sobrecubierta = array_key_exists('sobrecubierta', $options)? $options['sobrecubierta'] : null;
|
||||||
|
$guardas = array_key_exists('guardas', $options)? $options['guardas'] : null;
|
||||||
$rotativa = array_key_exists('rotativa', $options)? $options['rotativa'] : null;
|
$rotativa = array_key_exists('rotativa', $options)? $options['rotativa'] : null;
|
||||||
|
|
||||||
$builder = $this->db
|
$builder = $this->db
|
||||||
@ -254,6 +257,9 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
|
|||||||
if(!is_null($sobrecubierta)){
|
if(!is_null($sobrecubierta)){
|
||||||
$builder->where("t1.sobrecubierta", $sobrecubierta);
|
$builder->where("t1.sobrecubierta", $sobrecubierta);
|
||||||
}
|
}
|
||||||
|
if(!is_null($guardas)){
|
||||||
|
$builder->where("t1.guardas", $guardas);
|
||||||
|
}
|
||||||
if(!is_null($rotativa)){
|
if(!is_null($rotativa)){
|
||||||
$builder->where("t1.rotativa", $rotativa);
|
$builder->where("t1.rotativa", $rotativa);
|
||||||
}
|
}
|
||||||
@ -290,6 +296,8 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
|
|||||||
$builder->where("t1.cubierta", 1);
|
$builder->where("t1.cubierta", 1);
|
||||||
else if ($uso == 'sobrecubierta')
|
else if ($uso == 'sobrecubierta')
|
||||||
$builder->where("t1.sobrecubierta", 1);
|
$builder->where("t1.sobrecubierta", 1);
|
||||||
|
else if ($uso == 'guardas')
|
||||||
|
$builder->where("t1.guardas", 1);
|
||||||
else{
|
else{
|
||||||
if($tipo == 'negro' || $tipo == 'negrohq')
|
if($tipo == 'negro' || $tipo == 'negrohq')
|
||||||
$builder->where("t1.bn", 1);
|
$builder->where("t1.bn", 1);
|
||||||
|
|||||||
@ -17,6 +17,7 @@ class PresupuestoLineaModel extends \App\Models\GoBaseModel
|
|||||||
"presupuesto_id",
|
"presupuesto_id",
|
||||||
"tipo",
|
"tipo",
|
||||||
"paginas",
|
"paginas",
|
||||||
|
"paginas_impresion", //guardas
|
||||||
"paginas_color_posicion",
|
"paginas_color_posicion",
|
||||||
"solapas_ancho",
|
"solapas_ancho",
|
||||||
"papel_id",
|
"papel_id",
|
||||||
|
|||||||
@ -45,7 +45,8 @@ class PresupuestoService extends BaseService
|
|||||||
if ($uso!='rotativa') {
|
if ($uso!='rotativa') {
|
||||||
|
|
||||||
$ancho_calculo = ($uso=='cubierta' || $uso=='sobrecubierta') ? $datosPedido->anchoExteriores : $datosPedido->ancho;
|
$ancho_calculo = ($uso=='cubierta' || $uso=='sobrecubierta') ? $datosPedido->anchoExteriores : $datosPedido->ancho;
|
||||||
$formas = PresupuestoService::getNumFormasPlana($uso, $maquina, $ancho_calculo, $datosPedido->alto, $datosPedido->isCosido, $forzar_a_favor_fibra);
|
$alto_calculo = ($uso=='cubierta' || $uso=='sobrecubierta') ? $datosPedido->altoExteriores : $datosPedido->ancho;
|
||||||
|
$formas = PresupuestoService::getNumFormasPlana($uso, $maquina, $ancho_calculo, $alto_calculo, $datosPedido->isCosido, $forzar_a_favor_fibra);
|
||||||
$response['fields'] = $formas;
|
$response['fields'] = $formas;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +71,9 @@ class PresupuestoService extends BaseService
|
|||||||
//interior (bn o color)
|
//interior (bn o color)
|
||||||
if ($cubierta == 0 && $sobrecubierta == 0 && $rotativa == 0) {
|
if ($cubierta == 0 && $sobrecubierta == 0 && $rotativa == 0) {
|
||||||
// precio papel
|
// precio papel
|
||||||
$pliegos_libro = ($datosPedido->paginas / 2.0) / $response['fields']['num_formas']['value'];
|
$pliegos_libro = ceil(($datosPedido->paginas / 2.0) / $response['fields']['num_formas']['value']);
|
||||||
|
if($pliegos_libro<1)
|
||||||
|
$pliegos_libro = 1;
|
||||||
$pliegos_pedido = $pliegos_libro * ($datosPedido->tirada + $datosPedido->merma);
|
$pliegos_pedido = $pliegos_libro * ($datosPedido->tirada + $datosPedido->merma);
|
||||||
$precio_libro = $pliegos_libro * ($precio_pliego_impresion+$margen_pliego_impresion);
|
$precio_libro = $pliegos_libro * ($precio_pliego_impresion+$margen_pliego_impresion);
|
||||||
$margen_papel_pedido = $pliegos_libro * $margen_pliego_impresion * ($datosPedido->tirada + $datosPedido->merma);
|
$margen_papel_pedido = $pliegos_libro * $margen_pliego_impresion * ($datosPedido->tirada + $datosPedido->merma);
|
||||||
@ -88,7 +91,14 @@ class PresupuestoService extends BaseService
|
|||||||
|
|
||||||
// impresion
|
// impresion
|
||||||
$precio_click = $tarifa;
|
$precio_click = $tarifa;
|
||||||
$precio_click_pedido = $pliegos_pedido * 2 * $precio_click;
|
if($uso=='guardas'){
|
||||||
|
if(floatval($datosPedido->paginas_impresion)==0)
|
||||||
|
$precio_click_pedido = 0;
|
||||||
|
elseif (floatval($datosPedido->paginas_impresion)==4) // Una cara
|
||||||
|
$precio_click_pedido = $pliegos_pedido * $precio_click;
|
||||||
|
else // dos caras (impresion normal)
|
||||||
|
$precio_click_pedido = $pliegos_pedido * 2 * $precio_click;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// cubierta o sobrecubierta (siempre a color)
|
// cubierta o sobrecubierta (siempre a color)
|
||||||
@ -376,13 +386,6 @@ class PresupuestoService extends BaseService
|
|||||||
$anchoForCalculo = $ancho;
|
$anchoForCalculo = $ancho;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generates a message like: User 123 logged into the system from 127.0.0.1
|
|
||||||
$info = [
|
|
||||||
'isCosido' => $forzar_a_favor_fibra,
|
|
||||||
];
|
|
||||||
|
|
||||||
log_message('error', 'isCosido en formas planas: {isCosido}', $info);
|
|
||||||
|
|
||||||
if($uso == 'cubierta' || $uso == 'sobrecubierta') {
|
if($uso == 'cubierta' || $uso == 'sobrecubierta') {
|
||||||
if(property_exists($maquina, 'forzar_num_formas_horizontales_cubierta') &&
|
if(property_exists($maquina, 'forzar_num_formas_horizontales_cubierta') &&
|
||||||
property_exists($maquina, 'forzar_num_formas_verticales_cubierta')){
|
property_exists($maquina, 'forzar_num_formas_verticales_cubierta')){
|
||||||
@ -521,23 +524,51 @@ class PresupuestoService extends BaseService
|
|||||||
/**
|
/**
|
||||||
* Devuelve el ancho de la cubierta/sobrecubierta, incluido el lomo.
|
* Devuelve el ancho de la cubierta/sobrecubierta, incluido el lomo.
|
||||||
*/
|
*/
|
||||||
public static function getAnchoTotalExteriores($datosPedido=null)
|
public static function getAnchoTotalExteriores($tipo_impresion_id, $datosPedido=null)
|
||||||
{
|
{
|
||||||
$ancho_total = 0;
|
$ancho_total = 0;
|
||||||
|
|
||||||
if ($datosPedido) {
|
if ($datosPedido) {
|
||||||
$ancho_total = floatval($datosPedido->ancho)*2 + floatval($datosPedido->lomo);
|
// Tapa blanda (cosido y fresado)
|
||||||
$ancho_total += property_exists($datosPedido, 'lomo_cubierta')?$datosPedido->lomo_cubierta:0;
|
if($tipo_impresion_id == 2 || $tipo_impresion_id == 4){
|
||||||
|
$ancho_total = floatval($datosPedido->ancho)*2 + floatval($datosPedido->lomo);
|
||||||
|
$ancho_total += property_exists($datosPedido, 'lomo_cubierta')?$datosPedido->lomo_cubierta:0;
|
||||||
|
|
||||||
// añadimos ancho de las solapas
|
// añadimos ancho de las solapas
|
||||||
// si se añaden solapas hay que sumar 3mm de los dobleces
|
// si se añaden solapas hay que sumar 3mm de los dobleces
|
||||||
if ($datosPedido->solapas) {
|
if ($datosPedido->solapas) {
|
||||||
$ancho_total += (floatval($datosPedido->solapas_ancho) * 2) + 6;
|
$ancho_total += (floatval($datosPedido->solapas_ancho) * 2) + 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Tapa dura cosido y fresado
|
||||||
|
else if($tipo_impresion_id == 1 || $tipo_impresion_id == 3){
|
||||||
|
$ancho_total = floatval($datosPedido->ancho)*2 + floatval($datosPedido->lomo);
|
||||||
|
$ancho_total += property_exists($datosPedido, 'lomo_cubierta')?$datosPedido->lomo_cubierta:0;
|
||||||
|
// Se añaden 20mm de sangre por cada lado + 2 * 0.6mm de portada y contraportada -> total 41.2
|
||||||
|
$ancho_total += 41.2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $ancho_total;
|
return $ancho_total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Devuelve el ancho de la cubierta/sobrecubierta, incluido el lomo.
|
||||||
|
*/
|
||||||
|
public static function getAltoTotalExteriores($tipo_impresion_id, $datosPedido=null)
|
||||||
|
{
|
||||||
|
$alto_total = 0;
|
||||||
|
|
||||||
|
if ($datosPedido) {
|
||||||
|
// Tapa blanda (cosido y fresado)
|
||||||
|
$alto_total = floatval($datosPedido->alto);
|
||||||
|
if($tipo_impresion_id == 1 || $tipo_impresion_id == 3){
|
||||||
|
// Se añaden 20mm de sangre por cada lado + 0.7mm extra que sobresale -> total 40.7
|
||||||
|
$alto_total += 40.7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $alto_total;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Devuelve la dimensión del lomo interior.
|
* Devuelve la dimensión del lomo interior.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -90,6 +90,16 @@
|
|||||||
</div><!--//.form-check -->
|
</div><!--//.form-check -->
|
||||||
</div><!--//.mb-3 -->
|
</div><!--//.mb-3 -->
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="form-check">
|
||||||
|
|
||||||
|
<label for="guardas" class="form-check-label">
|
||||||
|
<input type="checkbox" id="guardas" name="guardas" value="1" class="form-check-input" <?= $papelImpresion->guardas == true ? 'checked' : ''; ?>>
|
||||||
|
<?= lang('PapelImpresion.guardas') ?>
|
||||||
|
</label>
|
||||||
|
</div><!--//.form-check -->
|
||||||
|
</div><!--//.mb-3 -->
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
<th><?= lang('PapelImpresion.color') ?></th>
|
<th><?= lang('PapelImpresion.color') ?></th>
|
||||||
<th><?= lang('PapelImpresion.cubierta') ?></th>
|
<th><?= lang('PapelImpresion.cubierta') ?></th>
|
||||||
<th><?= lang('PapelImpresion.sobrecubierta') ?></th>
|
<th><?= lang('PapelImpresion.sobrecubierta') ?></th>
|
||||||
|
<th><?= lang('PapelImpresion.guardas') ?></th>
|
||||||
<th><?= lang('PapelImpresion.inkjet') ?></th>
|
<th><?= lang('PapelImpresion.inkjet') ?></th>
|
||||||
<th><?= lang('PapelImpresion.rotativa') ?></th>
|
<th><?= lang('PapelImpresion.rotativa') ?></th>
|
||||||
<th><?= lang('PapelImpresion.activo') ?></th>
|
<th><?= lang('PapelImpresion.activo') ?></th>
|
||||||
@ -101,6 +102,7 @@
|
|||||||
{ 'data': 'color' },
|
{ 'data': 'color' },
|
||||||
{ 'data': 'cubierta' },
|
{ 'data': 'cubierta' },
|
||||||
{ 'data': 'sobrecubierta' },
|
{ 'data': 'sobrecubierta' },
|
||||||
|
{ 'data': 'guardas' },
|
||||||
{ 'data': 'inkjet' },
|
{ 'data': 'inkjet' },
|
||||||
{ 'data': 'rotativa' },
|
{ 'data': 'rotativa' },
|
||||||
{ 'data': 'isActivo' },
|
{ 'data': 'isActivo' },
|
||||||
@ -110,7 +112,7 @@
|
|||||||
|
|
||||||
|
|
||||||
theTable.on( 'draw.dt', function () {
|
theTable.on( 'draw.dt', function () {
|
||||||
const boolCols = [3, 4, 5, 6, 7, 8, 9];
|
const boolCols = [3, 4, 5, 6, 7, 8, 9, 10];
|
||||||
for (let coln of boolCols) {
|
for (let coln of boolCols) {
|
||||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||||
|
|||||||
@ -215,6 +215,44 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 col-lg-2 px-4">
|
||||||
|
<p><?= lang('PapelImpresion.guardas') ?></p>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12 col-lg-2 px-4">
|
||||||
|
<select id="compCarasGuardas" name="comp_paginas_guardas" class="form-control select2bs2 comp_guardas_items" style="width: 100%;">
|
||||||
|
<option value="0">
|
||||||
|
<p><?= lang('Presupuestos.sinImpresion') ?></p>
|
||||||
|
</option>
|
||||||
|
<option value="4">
|
||||||
|
<p><?= lang('Presupuestos.1cara') ?></p>
|
||||||
|
</option>
|
||||||
|
<option value="8">
|
||||||
|
<p><?= lang('Presupuestos.2caras') ?></p>
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12 col-lg-6 px-4">
|
||||||
|
<select id="compPapelGuardas" name="comp_papel_guardas" class="form-control select2bs2 comp_guardas_items" style="width: 100%;">
|
||||||
|
<?php if (isset($papelGenericoGuardasList) && is_array($papelGenericoGuardasList) && !empty($papelGenericoGuardasList)) :
|
||||||
|
foreach ($papelGenericoGuardasList as $k => $v) : ?>
|
||||||
|
<option value="<?= $v->id ?>">
|
||||||
|
<?= $v->nombre ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach;
|
||||||
|
endif; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12 col-lg-2 px-4">
|
||||||
|
<input readonly type="text" id="compGramajeGuardas" name="comp_gramaje_guardas" placeholder="0" maxLength="5" class="form-control comp_guardas_items" value='170'>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<hr class="my-1">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<!----------------------------------------------------------------------------->
|
<!----------------------------------------------------------------------------->
|
||||||
|
|
||||||
<div class="divider divider-dark text-start mb-1 comp-color-selected">
|
<div class="divider divider-dark text-start mb-1 comp-color-selected">
|
||||||
@ -422,6 +460,66 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!----------------------------------------------------------------------------->
|
||||||
|
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
|
||||||
|
<div class="accordion mt-3" id="accordionCompGuardas">
|
||||||
|
<div class="card accordion-item active">
|
||||||
|
<h2 class="accordion-header" id="headingOne">
|
||||||
|
<button id="accordion-button-int-guardas" type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionCompGuardasTip" aria-expanded="false" aria-controls="accordionCompGuardasTip">
|
||||||
|
<h6 id="title_guardas"><?= lang("Presupuestos.Guardas") ?></h6>
|
||||||
|
</button>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<div id="accordionCompGuardasTip" class="accordion-collapse collapse" data-bs-parent="#accordionCompGuardasTip">
|
||||||
|
<div class="accordion-body">
|
||||||
|
|
||||||
|
<table id="tableCompGuardas" class="comparator-table table dt-responsive dataTable" style="width: 100%;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.tipo') ?></th>
|
||||||
|
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.paginas') ?></th>
|
||||||
|
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.papel') ?></th>
|
||||||
|
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.gramaje') ?></th>
|
||||||
|
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.marca') ?></th>
|
||||||
|
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.maquina') ?></th>
|
||||||
|
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.numeroPliegos') ?></th>
|
||||||
|
<th style="padding-right: 0.75em; max-width:80px"><?= lang('Presupuestos.pliegosPedido') ?></th>
|
||||||
|
<th style="padding-right: 0.75em; max-width:80px"><?= lang('Presupuestos.precioPliego') ?></th>
|
||||||
|
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.libro') ?></th>
|
||||||
|
<th style="padding-right: 0.75em; max-width:80px"><?= lang('Presupuestos.totalPapelPedido') ?></th>
|
||||||
|
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.lomo') ?></th>
|
||||||
|
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.peso') ?></th>
|
||||||
|
<th style="padding-right: 0.75em; max-width:80px"><?= lang('Presupuestos.horas') ?></th>
|
||||||
|
<th style="padding-right: 0.75em; max-width:80px"><?= lang('Presupuestos.precioImpresion') ?></th>
|
||||||
|
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.total') ?></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td class="dt-result dt-result-text" colspan="14"><?= lang('Presupuestos.total') ?> <?= lang("Presupuestos.Guardas") ?>:</td>
|
||||||
|
<td id="total_comp_guardas" class="dt-result dt-result-value" colspan="2"> 0.00 </td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div >
|
||||||
|
<button type="button" name="insertarGuardasBtn"
|
||||||
|
id="insertarGuardasBtn"
|
||||||
|
class="btn btn-primary float-end me-sm-3 me-1 mb-3 insertarLinea d-none">
|
||||||
|
<?= lang('Presupuestos.insertarLinea').' '.strtoupper(lang('Presupuestos.Guardas')) ?>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endif;?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div> <!-- //.accordion-body -->
|
</div> <!-- //.accordion-body -->
|
||||||
@ -580,11 +678,22 @@
|
|||||||
allowClear: false,
|
allowClear: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
|
||||||
$('#compCarasCubierta').select2({
|
$('#compCarasCubierta').select2({
|
||||||
allowClear: false,
|
allowClear: false,
|
||||||
minimumResultsForSearch: Infinity,
|
minimumResultsForSearch: Infinity,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#compPapelGuardas').select2({
|
||||||
|
allowClear: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#compCarasGuardas').select2({
|
||||||
|
allowClear: false,
|
||||||
|
minimumResultsForSearch: Infinity,
|
||||||
|
});
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
updatePapelesComparador();
|
updatePapelesComparador();
|
||||||
const paginasColor = document.getElementById('compCalPaginasColor');
|
const paginasColor = document.getElementById('compCalPaginasColor');
|
||||||
if (paginasColor.value.length > 0) {
|
if (paginasColor.value.length > 0) {
|
||||||
@ -592,7 +701,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
computarPaginasColor($('#compPosPaginasColor').val());
|
computarPaginasColor($('#compPosPaginasColor').val());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function init_lineas_comparador(){
|
function init_lineas_comparador(){
|
||||||
@ -643,7 +751,7 @@
|
|||||||
}catch(e){}
|
}catch(e){}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
$("#compCarasCubierta").val(parseInt(comp_data.cubierta.paginas)).trigger('select2:select');
|
$("#compCarasCubierta").val(parseInt(comp_data.cubierta.paginas)).change();
|
||||||
try{
|
try{
|
||||||
$("#compPapelCubierta").val(parseInt(comp_data.cubierta.papel_id)).trigger('select2:select');
|
$("#compPapelCubierta").val(parseInt(comp_data.cubierta.papel_id)).trigger('select2:select');
|
||||||
|
|
||||||
@ -656,6 +764,11 @@
|
|||||||
}catch(e){}
|
}catch(e){}
|
||||||
}catch(e){}
|
}catch(e){}
|
||||||
|
|
||||||
|
try{
|
||||||
|
$("#compCarasGuardas").val(parseInt(comp_data.guardas.paginas_impresion)).change();
|
||||||
|
$("#compPapelGuardas").val(parseInt(comp_data.guardas.papel_id)).trigger('change');
|
||||||
|
}catch(e){}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var tableCompIntPlana = new DataTable('#tableCompIntPlana',{
|
var tableCompIntPlana = new DataTable('#tableCompIntPlana',{
|
||||||
@ -827,6 +940,128 @@
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
|
||||||
|
var tableCompGuardas = new DataTable('#tableCompGuardas',{
|
||||||
|
scrollX: true,
|
||||||
|
searching: false,
|
||||||
|
paging: false,
|
||||||
|
info: false,
|
||||||
|
ordering: false,
|
||||||
|
responsive: true,
|
||||||
|
select: false,
|
||||||
|
language: {
|
||||||
|
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
|
||||||
|
},
|
||||||
|
columns: [
|
||||||
|
{ 'data': 'tipo',
|
||||||
|
'render': function ( data, type, row, meta ) {
|
||||||
|
|
||||||
|
return '<?= lang('Presupuestos.Guardas') ?>';
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
{ 'data': 'paginas' },
|
||||||
|
{ 'data': 'papel' },
|
||||||
|
{ 'data': 'gramaje' },
|
||||||
|
{ 'data': 'marca' },
|
||||||
|
{ 'data': 'maquina' },
|
||||||
|
{ 'data': 'numeroPliegos' },
|
||||||
|
{ 'data': 'pliegosPedido' },
|
||||||
|
{ 'data': 'precioPliego' },
|
||||||
|
{ 'data': 'libro' },
|
||||||
|
{ 'data': 'totalPapelPedido' },
|
||||||
|
{ 'data': 'lomo' },
|
||||||
|
{ 'data': 'peso' },
|
||||||
|
{ 'data': 'horasMaquina' },
|
||||||
|
{ 'data': 'precioImpresion' },
|
||||||
|
{ 'data': 'total' },
|
||||||
|
{ 'data': 'maquinaId'},
|
||||||
|
{ 'data': 'maquinaVelocidad'},
|
||||||
|
{ 'data': 'tiempoMaquina'},
|
||||||
|
{ 'data': 'papelGenericoId'},
|
||||||
|
{ 'data': 'papelImpresionId'},
|
||||||
|
{ 'data': 'tarifa_impresion_id'},
|
||||||
|
{ 'data': 'paginas_impresion'},
|
||||||
|
],
|
||||||
|
columnDefs: [
|
||||||
|
{
|
||||||
|
target: [16,17,18,19,20,21,22],
|
||||||
|
visible: false,
|
||||||
|
searchable: false
|
||||||
|
},
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
function checkComparadorGuardas(actualizarLinea = false){
|
||||||
|
|
||||||
|
if ($('#compPapelGuardas').select2('data')[0].id > 0 ){
|
||||||
|
|
||||||
|
const dimension = getDimensionLibro();
|
||||||
|
|
||||||
|
let datos = {
|
||||||
|
tipo_impresion_id: <?php echo $tipo_impresion_id ?>,
|
||||||
|
type: 'guardas',
|
||||||
|
paginas: 8,
|
||||||
|
paginas_impresion: parseInt($('#compCarasGuardas').select2('data')[0].id),
|
||||||
|
tirada: parseInt($('#tirada').val()),
|
||||||
|
merma: parseInt($('#mermacubierta').val()),
|
||||||
|
color: 1,
|
||||||
|
hq: 1,
|
||||||
|
ancho: dimension.ancho,
|
||||||
|
alto: dimension.alto,
|
||||||
|
papel_generico_id: $('#compPapelGuardas').select2('data')[0].id,
|
||||||
|
papel_generico: $('#compPapelGuardas').select2('data')[0].text.trim(),
|
||||||
|
gramaje: parseInt($('#compGramajeGuardas').val()),
|
||||||
|
cliente_id: $('#clienteId').find(":selected").val(),
|
||||||
|
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||||
|
};
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/cosidotapablanda/datatable",
|
||||||
|
data: datos,
|
||||||
|
success: function (data) {
|
||||||
|
|
||||||
|
clearGuardas();
|
||||||
|
|
||||||
|
if(data.lineas.length >0){
|
||||||
|
fillGuardas(data);
|
||||||
|
selectGuardasLineas();
|
||||||
|
$('#title_guardas').html('<?= lang("Presupuestos.Guardas") ?>' + ' (' + tableCompGuardas.rows().count() + ')');
|
||||||
|
$('#insertarGuardasBtn').removeClass('d-none')
|
||||||
|
if(actualizarLinea){
|
||||||
|
var rows = $("#tableCompCubierta").DataTable().rows( '.selected' ).data().toArray();
|
||||||
|
for(row of rows){
|
||||||
|
fill_lp_guardas(row, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('#title_guardas').html('<?= lang("Presupuestos.Guardas") ?>');
|
||||||
|
$('#insertarGuardasBtn').addClass('d-none')
|
||||||
|
$('#total_comp_guardas').html('0.00')
|
||||||
|
|
||||||
|
}
|
||||||
|
yeniden(data.<?= csrf_token() ?>);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
error: function(e){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
else{
|
||||||
|
clearGuardas();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$('.comp_guardas_items').on('change', function (e) {
|
||||||
|
|
||||||
|
checkComparadorGuardas(false);
|
||||||
|
});
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
||||||
async function getLineasIntPlana(is_color, is_hq, actualizarLinea){
|
async function getLineasIntPlana(is_color, is_hq, actualizarLinea){
|
||||||
@ -983,7 +1218,7 @@
|
|||||||
|
|
||||||
function checkComparadorCubierta(actualizarLinea = false){
|
function checkComparadorCubierta(actualizarLinea = false){
|
||||||
|
|
||||||
if ($('#compCarasCubierta').select2('data').length > 0 &&
|
if ($('#compCarasCubierta option:selected').val().length > 0 &&
|
||||||
$('#compPapelCubierta').select2('data').length > 0 &&
|
$('#compPapelCubierta').select2('data').length > 0 &&
|
||||||
$('#compGramajeCubierta').select2('data').length > 0 ){
|
$('#compGramajeCubierta').select2('data').length > 0 ){
|
||||||
|
|
||||||
@ -992,7 +1227,7 @@
|
|||||||
let datos = {
|
let datos = {
|
||||||
tipo_impresion_id: <?php echo $tipo_impresion_id ?>,
|
tipo_impresion_id: <?php echo $tipo_impresion_id ?>,
|
||||||
type: 'cubierta',
|
type: 'cubierta',
|
||||||
paginas: parseInt($('#compCarasCubierta').select2('data')[0].id),
|
paginas: parseInt($('#compCarasCubierta option:selected').val()),
|
||||||
tirada: parseInt($('#tirada').val()),
|
tirada: parseInt($('#tirada').val()),
|
||||||
merma: parseInt($('#mermacubierta').val()),
|
merma: parseInt($('#mermacubierta').val()),
|
||||||
color: 1,
|
color: 1,
|
||||||
@ -1049,6 +1284,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('.comp_negro_items').on('change', function (e) {
|
$('.comp_negro_items').on('change', function (e) {
|
||||||
|
|
||||||
checkComparadorInt(false,false);
|
checkComparadorInt(false,false);
|
||||||
|
|||||||
@ -609,12 +609,12 @@
|
|||||||
|
|
||||||
function servicioRetractilado(){
|
function servicioRetractilado(){
|
||||||
if($('#retractilado').prop('checked')){
|
if($('#retractilado').prop('checked')){
|
||||||
$('#add_servicio_acabado_list').val(<?php echo $serviciosCheckboxes['retractilado'] ?>)
|
$('#add_servicio_acabado_list').val(<?php echo $serviciosAutomaticos['retractilado'] ?>)
|
||||||
$('#insertar_serv_acabado').click()
|
$('#insertar_serv_acabado').click()
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
var row_indexes = tableServiciosAcabado.rows().eq( 0 ).filter( function (rowIdx) {
|
var row_indexes = tableServiciosAcabado.rows().eq( 0 ).filter( function (rowIdx) {
|
||||||
return tableServiciosAcabado.cell( rowIdx, 0 ).data() == <?php echo $serviciosCheckboxes['retractilado'] ?> ? true : false;
|
return tableServiciosAcabado.cell( rowIdx, 0 ).data() == <?php echo $serviciosAutomaticos['retractilado'] ?> ? true : false;
|
||||||
} );
|
} );
|
||||||
if(row_indexes.length > 0){
|
if(row_indexes.length > 0){
|
||||||
tableServiciosAcabado.row(row_indexes[0]).remove().draw()
|
tableServiciosAcabado.row(row_indexes[0]).remove().draw()
|
||||||
@ -625,12 +625,12 @@
|
|||||||
|
|
||||||
function servicioRetractilado5(){
|
function servicioRetractilado5(){
|
||||||
if($('#retractilado5').prop('checked')){
|
if($('#retractilado5').prop('checked')){
|
||||||
$('#add_servicio_acabado_list').val(<?php echo $serviciosCheckboxes['retractilado5'] ?>)
|
$('#add_servicio_acabado_list').val(<?php echo $serviciosAutomaticos['retractilado5'] ?>)
|
||||||
$('#insertar_serv_acabado').click()
|
$('#insertar_serv_acabado').click()
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
var row_indexes = tableServiciosAcabado.rows().eq( 0 ).filter( function (rowIdx) {
|
var row_indexes = tableServiciosAcabado.rows().eq( 0 ).filter( function (rowIdx) {
|
||||||
return tableServiciosAcabado.cell( rowIdx, 0 ).data() == <?php echo $serviciosCheckboxes['retractilado5'] ?> ? true : false;
|
return tableServiciosAcabado.cell( rowIdx, 0 ).data() == <?php echo $serviciosAutomaticos['retractilado5'] ?> ? true : false;
|
||||||
} );
|
} );
|
||||||
if(row_indexes.length > 0){
|
if(row_indexes.length > 0){
|
||||||
tableServiciosAcabado.row(row_indexes[0]).remove().draw()
|
tableServiciosAcabado.row(row_indexes[0]).remove().draw()
|
||||||
@ -641,12 +641,12 @@
|
|||||||
|
|
||||||
function servicioFajaColor(){
|
function servicioFajaColor(){
|
||||||
if($('#fajaColor').prop('checked')){
|
if($('#fajaColor').prop('checked')){
|
||||||
$('#add_servicio_acabado_list').val(<?php echo $serviciosCheckboxes['fajaColor'] ?>)
|
$('#add_servicio_acabado_list').val(<?php echo $serviciosAutomaticos['fajaColor'] ?>)
|
||||||
$('#insertar_serv_acabado').click()
|
$('#insertar_serv_acabado').click()
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
var row_indexes = tableServiciosAcabado.rows().eq( 0 ).filter( function (rowIdx) {
|
var row_indexes = tableServiciosAcabado.rows().eq( 0 ).filter( function (rowIdx) {
|
||||||
return tableServiciosAcabado.cell( rowIdx, 0 ).data() == <?php echo $serviciosCheckboxes['fajaColor'] ?> ? true : false;
|
return tableServiciosAcabado.cell( rowIdx, 0 ).data() == <?php echo $serviciosAutomaticos['fajaColor'] ?> ? true : false;
|
||||||
} );
|
} );
|
||||||
if(row_indexes.length > 0){
|
if(row_indexes.length > 0){
|
||||||
tableServiciosAcabado.row(row_indexes[0]).remove().draw()
|
tableServiciosAcabado.row(row_indexes[0]).remove().draw()
|
||||||
@ -1180,6 +1180,22 @@
|
|||||||
return datosManipulado
|
return datosManipulado
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function servicioGuardas(add_service = false){
|
||||||
|
if(add_service){
|
||||||
|
$('#add_servicio_manipulado_list').val(<?php echo $serviciosAutomaticos['plegadoGuardas'] ?>)
|
||||||
|
$('#insertar_serv_manipulado').click()
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
var row_indexes = tableServiciosManipulado.rows().eq( 0 ).filter( function (rowIdx) {
|
||||||
|
return tableServiciosManipulado.cell( rowIdx, 0 ).data() == <?php echo $serviciosAutomaticos['plegadoGuardas'] ?> ? true : false;
|
||||||
|
} );
|
||||||
|
if(row_indexes.length > 0){
|
||||||
|
tableServiciosManipulado.row(row_indexes[0]).remove().draw()
|
||||||
|
check_serv_manipulado_error()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
init_servicio_manipulado()
|
init_servicio_manipulado()
|
||||||
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -1290,12 +1306,12 @@
|
|||||||
|
|
||||||
function servicioPrototipo(){
|
function servicioPrototipo(){
|
||||||
if($('#prototipo').prop('checked')){
|
if($('#prototipo').prop('checked')){
|
||||||
$('#add_servicio_preimpresion_list').val(<?php echo $serviciosCheckboxes['prototipo'] ?>)
|
$('#add_servicio_preimpresion_list').val(<?php echo $serviciosAutomaticos['prototipo'] ?>)
|
||||||
$('#insertar_serv_preimpresion').click()
|
$('#insertar_serv_preimpresion').click()
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
var row_indexes = tableServiciosPreimpresion.rows().eq( 0 ).filter( function (rowIdx) {
|
var row_indexes = tableServiciosPreimpresion.rows().eq( 0 ).filter( function (rowIdx) {
|
||||||
return tableServiciosPreimpresion.cell( rowIdx, 0 ).data() == <?php echo $serviciosCheckboxes['prototipo'] ?> ? true : false;
|
return tableServiciosPreimpresion.cell( rowIdx, 0 ).data() == <?php echo $serviciosAutomaticos['prototipo'] ?> ? true : false;
|
||||||
} );
|
} );
|
||||||
if(row_indexes.length > 0){
|
if(row_indexes.length > 0){
|
||||||
tableServiciosPreimpresion.row(row_indexes[0]).remove().draw()
|
tableServiciosPreimpresion.row(row_indexes[0]).remove().draw()
|
||||||
@ -1306,11 +1322,11 @@
|
|||||||
|
|
||||||
function servicioFerro(){
|
function servicioFerro(){
|
||||||
var row_indexes = tableServiciosPreimpresion.rows().eq( 0 ).filter( function (rowIdx) {
|
var row_indexes = tableServiciosPreimpresion.rows().eq( 0 ).filter( function (rowIdx) {
|
||||||
return tableServiciosPreimpresion.cell( rowIdx, 0 ).data() == <?php echo $serviciosCheckboxes['ferro'] ?> ? true : false;
|
return tableServiciosPreimpresion.cell( rowIdx, 0 ).data() == <?php echo $serviciosAutomaticos['ferro'] ?> ? true : false;
|
||||||
} );
|
} );
|
||||||
if($('#ferro').prop('checked')){
|
if($('#ferro').prop('checked')){
|
||||||
if(row_indexes.length == 0){
|
if(row_indexes.length == 0){
|
||||||
$('#add_servicio_preimpresion_list').val(<?php echo $serviciosCheckboxes['ferro'] ?>)
|
$('#add_servicio_preimpresion_list').val(<?php echo $serviciosAutomaticos['ferro'] ?>)
|
||||||
$('#insertar_serv_preimpresion').click()
|
$('#insertar_serv_preimpresion').click()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,9 +49,8 @@
|
|||||||
<div class='col-md-12 col-lg-9 px-4'></div>
|
<div class='col-md-12 col-lg-9 px-4'></div>
|
||||||
<div class='col-md-12 col-lg-3 px-4'>
|
<div class='col-md-12 col-lg-3 px-4'>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<label class="input-group-text" for="addLineasPresupuesto"><?= lang('Presupuestos.addLineaPresupuesto') ?></label>
|
<label id="btn_addLinea" class="btn btn-outline-primary waves-effect" ><?= lang('Presupuestos.addLineaPresupuesto') ?></label>
|
||||||
<select class="form-select" id="addLineasPresupuesto" data-native-menu="false">
|
<select class="form-select" id="addLineasPresupuesto" data-native-menu="false">
|
||||||
<option></option>
|
|
||||||
<option value="lp_bn"><?= lang('Presupuestos.bn') ?></option>
|
<option value="lp_bn"><?= lang('Presupuestos.bn') ?></option>
|
||||||
<option value="lp_bnhq"><?= lang('Presupuestos.bnhq') ?></option>
|
<option value="lp_bnhq"><?= lang('Presupuestos.bnhq') ?></option>
|
||||||
<option value="lp_color"><?= lang('Presupuestos.color') ?></option>
|
<option value="lp_color"><?= lang('Presupuestos.color') ?></option>
|
||||||
@ -59,6 +58,7 @@
|
|||||||
<option value="lp_rot_bn"><?= lang('Presupuestos.rotativa_bn') ?></option>
|
<option value="lp_rot_bn"><?= lang('Presupuestos.rotativa_bn') ?></option>
|
||||||
<option value="lp_rot_color"><?= lang('Presupuestos.rotativa_color') ?></option>
|
<option value="lp_rot_color"><?= lang('Presupuestos.rotativa_color') ?></option>
|
||||||
<option value="lp_cubierta"><?= lang('Presupuestos.cubierta') ?></option>
|
<option value="lp_cubierta"><?= lang('Presupuestos.cubierta') ?></option>
|
||||||
|
<option value="lp_guardas"><?= lang('Presupuestos.Guardas') ?></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -81,6 +81,9 @@ const papelGenericoCubiertaList = <?php echo json_encode($papelGenericoCubiertaL
|
|||||||
const papelGenericoSobrecubiertaList = <?php echo json_encode($papelGenericoSobrecubiertaList); ?>;
|
const papelGenericoSobrecubiertaList = <?php echo json_encode($papelGenericoSobrecubiertaList); ?>;
|
||||||
const papelGenericoRotativaNegroList = <?php echo json_encode($papelGenericoRotativaNegroList); ?>;
|
const papelGenericoRotativaNegroList = <?php echo json_encode($papelGenericoRotativaNegroList); ?>;
|
||||||
const papelGenericoRotativaColorList = <?php echo json_encode($papelGenericoRotativaColorList); ?>;
|
const papelGenericoRotativaColorList = <?php echo json_encode($papelGenericoRotativaColorList); ?>;
|
||||||
|
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
|
||||||
|
const papelGenericoGuardasList = <?php echo json_encode($papelGenericoGuardasList); ?>;
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
||||||
// Formatting function for row details - modify as you need
|
// Formatting function for row details - modify as you need
|
||||||
@ -409,7 +412,7 @@ const actionBtns_lp = function(data) {
|
|||||||
`;
|
`;
|
||||||
};
|
};
|
||||||
|
|
||||||
var tableLineasPresupuesto = new DataTable('#tableLineasPresupuesto',{
|
var tableLineasPresupuesto = new DataTable('#tableLineasPresupuesto',{
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
searching: false,
|
searching: false,
|
||||||
paging: false,
|
paging: false,
|
||||||
@ -475,6 +478,9 @@ const actionBtns_lp = function(data) {
|
|||||||
else if(row.row_id.includes('_sobrecubierta')){
|
else if(row.row_id.includes('_sobrecubierta')){
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
else if(row.row_id.includes('_guardas')){
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{data: 'icon',
|
{data: 'icon',
|
||||||
@ -484,19 +490,60 @@ const actionBtns_lp = function(data) {
|
|||||||
},
|
},
|
||||||
{data: 'paginas',
|
{data: 'paginas',
|
||||||
render: function ( data, type, row, meta ) {
|
render: function ( data, type, row, meta ) {
|
||||||
if(row.row_id != "lp_cubierta" && row.row_id != "lp_sobrecubierta")
|
if(row.row_id != "lp_cubierta" && row.row_id != "lp_sobrecubierta" && row.row_id != "lp_guardas")
|
||||||
return '<td class="lp-td"><input id="' + row.row_id + '_paginas" name="' + row.row_id + '_paginas" class="lp-cell lp-input paginas-lp" type="text" value="' + data + '"></td>';
|
return '<td class="lp-td"><input id="' + row.row_id + '_paginas" name="' + row.row_id + '_paginas" class="lp-cell lp-input paginas-lp" type="text" value="' + data + '"></td>';
|
||||||
else if(row.row_id == "lp_cubierta"){
|
else if(row.row_id == "lp_cubierta"){
|
||||||
return ' \
|
select = '<select id="lp_cubierta_paginas" name="comp_paginas_cubierta" class="form-control form-select-sm lp-cell lp-select" style="min-width:50px;">'
|
||||||
<select id="lp_cubierta_paginas" name="comp_paginas_cubierta" class="form-control form-select-sm lp-cell lp-select" style="min-width:50px;"> \
|
if(data==2){
|
||||||
<option value="2"> \
|
select += '<option value="2" selected >'
|
||||||
<p><?= lang('Presupuestos.1cara') ?></p> \
|
}
|
||||||
</option> \
|
else{
|
||||||
<option value="4"> \
|
select += '<option value="2">'
|
||||||
<p><?= lang('Presupuestos.2caras') ?></p> \
|
}
|
||||||
</option> \
|
select +='<p><?= lang('Presupuestos.1cara') ?></p>'
|
||||||
</select> \
|
select += '</option>'
|
||||||
';
|
if(data==4){
|
||||||
|
select += '<option value="4" selected >'
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
select += '<option value="4">'
|
||||||
|
}
|
||||||
|
select +='<p><?= lang('Presupuestos.2caras') ?></p>'
|
||||||
|
select += '</option>'
|
||||||
|
select += '</select>'
|
||||||
|
|
||||||
|
return select;
|
||||||
|
}
|
||||||
|
else if(row.row_id == "lp_guardas"){
|
||||||
|
select = '<select id="lp_guardas_paginas" name="comp_paginas_guardas" class="form-control form-select-sm lp-cell lp-select" style="min-width:50px;">'
|
||||||
|
if(row.paginas_impresion==0){
|
||||||
|
select += '<option value="0" selected >'
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
select += '<option value="0">'
|
||||||
|
}
|
||||||
|
select +='<p><?= lang('Presupuestos.sinImpresion') ?></p>'
|
||||||
|
select += '</option>'
|
||||||
|
if(row.paginas_impresion==4){
|
||||||
|
select += '<option value="4" selected >'
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
select += '<option value="4">'
|
||||||
|
}
|
||||||
|
select +='<p><?= lang('Presupuestos.1cara') ?></p>'
|
||||||
|
select += '</option>'
|
||||||
|
if(row.paginas_impresion==8){
|
||||||
|
select += '<option value="8" selected >'
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
select += '<option value="8">'
|
||||||
|
}
|
||||||
|
select +='<p><?= lang('Presupuestos.2caras') ?></p>'
|
||||||
|
select += '</option>'
|
||||||
|
select += '</select>'
|
||||||
|
|
||||||
|
return select;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -527,6 +574,9 @@ const actionBtns_lp = function(data) {
|
|||||||
else if (row.row_id == 'lp_sobrecubierta'){
|
else if (row.row_id == 'lp_sobrecubierta'){
|
||||||
papelList = papelGenericoSobrecubiertaList
|
papelList = papelGenericoSobrecubiertaList
|
||||||
}
|
}
|
||||||
|
else if (row.row_id == 'lp_guardas'){
|
||||||
|
papelList = papelGenericoGuardasList
|
||||||
|
}
|
||||||
else if (row.row_id == 'lp_rot_bn'){
|
else if (row.row_id == 'lp_rot_bn'){
|
||||||
papelList = papelGenericoRotativaNegroList
|
papelList = papelGenericoRotativaNegroList
|
||||||
}
|
}
|
||||||
@ -625,12 +675,16 @@ tableLineasPresupuesto.on( 'draw.dt', function () {
|
|||||||
$(document).on('click', '.btn-delete-lp', function(e) {
|
$(document).on('click', '.btn-delete-lp', function(e) {
|
||||||
|
|
||||||
const row = $(this).closest('tr');
|
const row = $(this).closest('tr');
|
||||||
|
data = tableLineasPresupuesto.row( row ).data()
|
||||||
tableLineasPresupuesto.row( row )
|
tableLineasPresupuesto.row( row )
|
||||||
.remove()
|
.remove()
|
||||||
.draw();
|
.draw();
|
||||||
updateTotales(true, false, false)
|
updateTotales(true, false, false)
|
||||||
updateTablaEnvios()
|
updateTablaEnvios()
|
||||||
|
|
||||||
|
if(data.row_id == 'lp_guardas')
|
||||||
|
servicioGuardas(false)
|
||||||
|
|
||||||
// Si existe cubierta, hay que actualizar con el valor del lomo
|
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||||
check_update_cubierta()
|
check_update_cubierta()
|
||||||
})
|
})
|
||||||
@ -686,6 +740,8 @@ function processRowData(row, rowId, rowClass){
|
|||||||
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_cubierta.png") ?>'
|
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_cubierta.png") ?>'
|
||||||
else if(rowId=='lp_sobrecubierta')
|
else if(rowId=='lp_sobrecubierta')
|
||||||
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_sobrecubierta.png") ?>'
|
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_sobrecubierta.png") ?>'
|
||||||
|
else if(rowId=='lp_guardas')
|
||||||
|
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_guardas.png") ?>'
|
||||||
else if(rowId=='lp_rot_bn')
|
else if(rowId=='lp_rot_bn')
|
||||||
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_rotativa_bn.png") ?>'
|
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_rotativa_bn.png") ?>'
|
||||||
else if(rowId=='lp_rot_color')
|
else if(rowId=='lp_rot_color')
|
||||||
@ -708,6 +764,7 @@ function processRowData(row, rowId, rowClass){
|
|||||||
|
|
||||||
'icon': icon,
|
'icon': icon,
|
||||||
'paginas': blank_line?0:row.paginas,
|
'paginas': blank_line?0:row.paginas,
|
||||||
|
'paginas_impresion': rowId=='lp_guardas'?row.paginas_impresion:0,
|
||||||
'papel': blank_line?"":row.papel_generico_id,
|
'papel': blank_line?"":row.papel_generico_id,
|
||||||
'gramaje': blank_line?"":row.gramaje,
|
'gramaje': blank_line?"":row.gramaje,
|
||||||
'papel_impresion': blank_line?"":row.papel_impresion,
|
'papel_impresion': blank_line?"":row.papel_impresion,
|
||||||
@ -721,8 +778,8 @@ function processRowData(row, rowId, rowClass){
|
|||||||
|
|
||||||
'total_linea': isNaN(parseFloat(row.total_impresion)) ? "" : parseFloat(row.total_impresion).toFixed(2),
|
'total_linea': isNaN(parseFloat(row.total_impresion)) ? "" : parseFloat(row.total_impresion).toFixed(2),
|
||||||
|
|
||||||
'numeroPliegos':isNaN(parseFloat(row.pliegos_libro)) ? "" : parseFloat(row.pliegos_libro).toFixed(2),
|
'numeroPliegos':isNaN(parseFloat(row.pliegos_libro)) ? "" : parseFloat(row.pliegos_libro).toFixed(0),
|
||||||
'pliegosPedido': isNaN(parseFloat(row.pliegos_pedido)) ? "" : parseFloat(row.pliegos_pedido).toFixed(2),
|
'pliegosPedido': isNaN(parseFloat(row.pliegos_pedido)) ? "" : parseFloat(row.pliegos_pedido).toFixed(0),
|
||||||
'precioPliego': isNaN(parseFloat(row.precios_pliegos)) ? "" : parseFloat(row.precios_pliegos).toFixed(6),
|
'precioPliego': isNaN(parseFloat(row.precios_pliegos)) ? "" : parseFloat(row.precios_pliegos).toFixed(6),
|
||||||
'libro': isNaN(parseFloat(row.precio_libro)) ? "" : parseFloat(row.precio_libro).toFixed(2),
|
'libro': isNaN(parseFloat(row.precio_libro)) ? "" : parseFloat(row.precio_libro).toFixed(2),
|
||||||
'totalPapelPedido': isNaN(parseFloat(row.precio_pedido)) ? "" : parseFloat(row.precio_pedido).toFixed(2),
|
'totalPapelPedido': isNaN(parseFloat(row.precio_pedido)) ? "" : parseFloat(row.precio_pedido).toFixed(2),
|
||||||
@ -806,7 +863,6 @@ function processRowData(row, rowId, rowClass){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$('#addLineasPresupuesto').val('');
|
|
||||||
|
|
||||||
$('.paginas-lp').on('change', function(){
|
$('.paginas-lp').on('change', function(){
|
||||||
checkPaginasPresupuesto()
|
checkPaginasPresupuesto()
|
||||||
@ -892,6 +948,7 @@ function clear_cubierta(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('.insertarLinea').on("click", function (e) {
|
$('.insertarLinea').on("click", function (e) {
|
||||||
|
|
||||||
if(e.target.id.includes("Plana")){
|
if(e.target.id.includes("Plana")){
|
||||||
@ -942,10 +999,21 @@ $('.insertarLinea').on("click", function (e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(e.target.id.includes("Guardas")){
|
||||||
|
|
||||||
|
clear_guardas();
|
||||||
|
|
||||||
|
var rows = $("#tableCompGuardas").DataTable().rows( '.selected' ).data().toArray();
|
||||||
|
for(row of rows){
|
||||||
|
fill_lp_guardas(row, true);
|
||||||
|
}
|
||||||
|
servicioGuardas(true)
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('#addLineasPresupuesto').on("change", function (e) {
|
$('#btn_addLinea').on("click", function (e) {
|
||||||
|
|
||||||
var dataRows = tableLineasPresupuesto
|
var dataRows = tableLineasPresupuesto
|
||||||
.rows()
|
.rows()
|
||||||
@ -1099,6 +1167,29 @@ $('#addLineasPresupuesto').on("change", function (e) {
|
|||||||
tableLineasPresupuesto.row.add(data).draw()
|
tableLineasPresupuesto.row.add(data).draw()
|
||||||
eventos_lp_cubierta()
|
eventos_lp_cubierta()
|
||||||
break
|
break
|
||||||
|
|
||||||
|
case 'lp_guardas':
|
||||||
|
var hayLinea = false
|
||||||
|
for(let number=0;number<dataRows.length;number++){
|
||||||
|
if(dataRows[number].row_id == 'lp_guardas'){
|
||||||
|
hayLinea = true
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hayLinea){
|
||||||
|
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = processRowData({tipo_maquina: 'toner'}, 'lp_guardas', 'lp-guardas');
|
||||||
|
tableLineasPresupuesto.row.add(data).draw()
|
||||||
|
$('#lp_guardas_gramaje').empty()
|
||||||
|
var o = new Option("170", "170");
|
||||||
|
$('#lp_guardas_gramaje').append(o)
|
||||||
|
eventos_lp_guardas()
|
||||||
|
servicioGuardas(true)
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -3411,10 +3502,280 @@ function getLomoLineasPresupuesto(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/********************************
|
||||||
|
***************************** */
|
||||||
|
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
|
||||||
|
|
||||||
|
function clear_lp_guardas(clear_selectors){
|
||||||
|
let pags = $("#lp_guardas_paginas option:selected" ).val()
|
||||||
|
$(".lp-guardas-input" ).val("0")
|
||||||
|
$("#lp_guardas_paginas" ).val(pags)
|
||||||
|
if(clear_selectors){
|
||||||
|
$( "#lp_guardas_maquina").empty()
|
||||||
|
$( "#lp_guardas_papelImpresion").empty()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function clear_guardas(){
|
||||||
|
clear_lp_guardas(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function calcularPresupuesto_guardas(fromComparador=false, input_data={}){
|
||||||
|
|
||||||
|
const dimension = getDimensionLibro();
|
||||||
|
|
||||||
|
if(Object.keys(input_data).length == 0){
|
||||||
|
|
||||||
|
input_data = {
|
||||||
|
paginas: <?php echo ($tipo_impresion_id == 1 || $tipo_impresion_id == 3)?8:4 ?>,
|
||||||
|
paginas_impresion: parseInt($('#lp_guardas_paginas option:selected').val()),
|
||||||
|
papel_generico_id: $('#lp_guardas_papel option:selected').val(),
|
||||||
|
papel_generico: $('#lp_guardas_papel option:selected').text().trim(),
|
||||||
|
gramaje: 170,
|
||||||
|
maquina_id: $('#lp_guardas_maquina option:selected').val(),
|
||||||
|
papel_impresion_id: $('#lp_guardas_papelImpresion option:selected').val()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var datos = {
|
||||||
|
tipo_impresion_id: <?php echo $tipo_impresion_id ?>,
|
||||||
|
type: 'guardas',
|
||||||
|
color: 1,
|
||||||
|
hq: 1,
|
||||||
|
paginas: <?php echo ($tipo_impresion_id == 1 || $tipo_impresion_id == 3)?8:4 ?>,
|
||||||
|
paginas_impresion: input_data.paginas_impresion,
|
||||||
|
tirada: parseInt($('#tirada').val()),
|
||||||
|
merma: parseInt($('#merma').val()),
|
||||||
|
ancho: dimension.ancho,
|
||||||
|
alto: dimension.alto,
|
||||||
|
papel_generico_id: input_data.papel_generico_id,
|
||||||
|
papel_generico: input_data.papel_generico,
|
||||||
|
gramaje: input_data.gramaje,
|
||||||
|
cliente_id: $('#clienteId').find(":selected").val(),
|
||||||
|
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||||
|
};
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/cosidotapablanda/datatable",
|
||||||
|
data: datos,
|
||||||
|
success: function (data) {
|
||||||
|
|
||||||
|
if(data.lineas.length >0){
|
||||||
|
// Se cogen los valores de la linea con los datos correspondientes
|
||||||
|
$.each(data.lineas, function(key, value) {
|
||||||
|
if(value.fields.maquina_id === input_data.maquina_id &&
|
||||||
|
value.fields.papel_generico_id === input_data.papel_generico_id &&
|
||||||
|
value.fields.papel_impresion_id === input_data.papel_impresion_id) {
|
||||||
|
|
||||||
|
if(Object.keys(input_data).length == 0){
|
||||||
|
value.fields.check_papel_total = $('#lp_guardas' + '_checkPapel').is(":checked")?1:0
|
||||||
|
value.fields.check_impresion_total = $('#lp_guardas' + '_checkClicks').is(":checked")?1:0
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
value.fields.check_papel_total = 1
|
||||||
|
value.fields.check_impresion_total = 1
|
||||||
|
}
|
||||||
|
fill_lp_guardas(value.fields);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
clear_lp_guardas(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
}
|
||||||
|
yeniden(data.<?= csrf_token() ?>);
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function(e){
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function fill_lp_guardas(row, fromComparador=false){
|
||||||
|
|
||||||
|
if(fromComparador){
|
||||||
|
|
||||||
|
var input_data = {
|
||||||
|
paginas: row.paginas,
|
||||||
|
paginas_impresion: row.paginas_impresion,
|
||||||
|
papel_generico_id: row.papelGenericoId,
|
||||||
|
gramaje: row.gramaje,
|
||||||
|
papel_impresion_id: row.papelImpresionId,
|
||||||
|
maquina_id: row.maquinaId,
|
||||||
|
}
|
||||||
|
|
||||||
|
calcularPresupuesto_guardas(false, input_data);
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
// Se guarda el estado de "ver calculos"
|
||||||
|
mostrar_calculos = ($( ".calculos_lp_guardas").css('display') == 'table-row')
|
||||||
|
|
||||||
|
// Si viene de hacerlo a mano...
|
||||||
|
data = processRowData(row, 'lp_guardas', 'lp-guardas');
|
||||||
|
|
||||||
|
var row = tableLineasPresupuesto.row('#lp_guardas');
|
||||||
|
if(row.length>0)
|
||||||
|
tableLineasPresupuesto.row('#lp_guardas').data(data).draw()
|
||||||
|
else{
|
||||||
|
tableLineasPresupuesto.row.add(data).draw()
|
||||||
|
row = tableLineasPresupuesto.row('#lp_guardas');
|
||||||
|
}
|
||||||
|
row.child(format(row.data())).show();
|
||||||
|
|
||||||
|
eventos_lp_guardas(data.maquinaTipo=='inkjet'?true:false)
|
||||||
|
|
||||||
|
$('#lp_guardas_checkPapel').change()
|
||||||
|
|
||||||
|
calcular_mermas()
|
||||||
|
updateTotales(true, false, false)
|
||||||
|
updateTablaEnvios()
|
||||||
|
|
||||||
|
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||||
|
check_update_cubierta()
|
||||||
|
|
||||||
|
if(mostrar_calculos){
|
||||||
|
$( ".calculos_lp_guardas").css('display','table-row')
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$("#tableLineasPresupuesto").DataTable().columns.adjust();
|
||||||
|
}
|
||||||
|
|
||||||
|
function eventos_lp_guardas(isInkjet = false){
|
||||||
|
|
||||||
|
$('#lp_guardas_papel').bind("focus", {clear_selectors: true}, clear_lp_guardas);
|
||||||
|
$('#lp_guardas_papelImpresion').focus("focus", set_lp_guardas_papelImpresion);
|
||||||
|
$('#lp_guardas_maquina').bind("focus", set_lp_guardas_maquina);
|
||||||
|
$('#lp_guardas_maquina').bind("change", calcularPresupuesto_guardas);
|
||||||
|
$('#lp_guardas_paginas').bind("change", change_lp_guardas_paginas);
|
||||||
|
$('#lp_guardas_checkPapel').bind("change", {id_linea: 'lp_guardas'}, update_total_linea);
|
||||||
|
$('#lp_guardas_checkClicks').bind("change", {id_linea: 'lp_guardas'}, update_total_linea);
|
||||||
|
|
||||||
|
if(isInkjet){
|
||||||
|
$('#lp_guardas_vercalculos').bind("click", {rowId: 'lp_guardas'}, verCalculosInkjet);
|
||||||
|
$('.lp-guardas-tipologia').bind("change", change_lp_guardas_tipologia);
|
||||||
|
$('#lp_guardas_defecto').bind("click", por_defecto_lp_guardas);
|
||||||
|
$('#lp_guardas_aFavorFibra').bind("change", change_lp_guardas_aFavorFibra);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function change_lp_guardas_tipologia(){
|
||||||
|
|
||||||
|
if( parseInt($('#lp_guardas_papel option:selected').val())>0 &&
|
||||||
|
parseInt($('#lp_guardas_papelImpresion option:selected').val())>0
|
||||||
|
){
|
||||||
|
|
||||||
|
calcularPresupuesto_guardas({},true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function por_defecto_lp_guardas(){
|
||||||
|
|
||||||
|
if( parseInt($('#lp_guardas_papel option:selected').val())>0 &&
|
||||||
|
parseInt($('#lp_guardas_papelImpresion option:selected').val())>0
|
||||||
|
){
|
||||||
|
|
||||||
|
calcularPresupuesto_guardas();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function change_lp_guardas_aFavorFibra(){
|
||||||
|
|
||||||
|
if( parseInt($('#lp_guardas_papel option:selected').val())>0 &&
|
||||||
|
parseInt($('#lp_guardas_papelImpresion option:selected').val())>0
|
||||||
|
){
|
||||||
|
var rowData = tableLineasPresupuesto.row('#lp_guardas').data()
|
||||||
|
rowData.aFavorFibra = $('#lp_guardas_aFavorFibra').prop('checked')
|
||||||
|
tableLineasPresupuesto.row('#lp_guardas').data(rowData).draw(false)
|
||||||
|
|
||||||
|
calcularPresupuesto_guardas(false, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function change_lp_guardas_paginas(){
|
||||||
|
|
||||||
|
if( parseInt($('#lp_guardas_papel option:selected').val())>0 &&
|
||||||
|
parseInt($('#lp_guardas_papelImpresion option:selected').val())>0
|
||||||
|
){
|
||||||
|
|
||||||
|
calcularPresupuesto_guardas();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function set_lp_guardas_maquina(){
|
||||||
|
|
||||||
|
await $.ajax({
|
||||||
|
type: 'post',
|
||||||
|
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
|
||||||
|
beforeSend: function() {
|
||||||
|
$('#lp_guardas_maquina').empty()
|
||||||
|
clear_lp_guardas(false)
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
tipo: 'maquina',
|
||||||
|
uso: 'colorhq',
|
||||||
|
tipoLinea: "guardas",
|
||||||
|
is_rotativa: 0,
|
||||||
|
ancho: getDimensionLibro().ancho,
|
||||||
|
alto: getDimensionLibro().alto,
|
||||||
|
datos: parseInt($('#tirada').val()) + parseInt($('#merma').val()),
|
||||||
|
papel_impresion: $('#lp_guardas_papelImpresion option:selected').val() ,
|
||||||
|
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v
|
||||||
|
},
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (data) {
|
||||||
|
yeniden(data.<?= csrf_token() ?>);
|
||||||
|
$.each(data.menu, function(item){
|
||||||
|
var option = $('<option/>', {'value':data.menu[item].maquina_id, 'text':data.menu[item].maquina})
|
||||||
|
$('#lp_guardas_maquina').append(option);
|
||||||
|
});
|
||||||
|
$('#lp_guardas_maquina').val('')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function set_lp_guardas_papelImpresion(){
|
||||||
|
await $.ajax({
|
||||||
|
type: 'post',
|
||||||
|
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
|
||||||
|
beforeSend: function() {
|
||||||
|
$('#lp_guardas_papelImpresion').empty()
|
||||||
|
$('#lp_guardas_maquina').empty()
|
||||||
|
clear_lp_guardas(false)
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
tipo: 'papelImpresion',
|
||||||
|
uso: 'guardas',
|
||||||
|
datos: $('#lp_guardas_papel option:selected').val() ,
|
||||||
|
gramaje: 170 ,
|
||||||
|
tipoLinea: "colorhq",
|
||||||
|
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v
|
||||||
|
},
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (data) {
|
||||||
|
yeniden(data.<?= csrf_token() ?>);
|
||||||
|
$.each(data.menu, function(item){
|
||||||
|
var option = $('<option/>', {'value':data.menu[item].id, 'text':data.menu[item].text})
|
||||||
|
$('#lp_guardas_papelImpresion').append(option);
|
||||||
|
});
|
||||||
|
$('#lp_guardas_papelImpresion').val('')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
||||||
fill_lp_from_bbdd()
|
fill_lp_from_bbdd()
|
||||||
|
|
||||||
@ -3543,7 +3904,12 @@ function fill_lp_from_bbdd(){
|
|||||||
case 'lp_cubierta':
|
case 'lp_cubierta':
|
||||||
eventos_lp_cubierta()
|
eventos_lp_cubierta()
|
||||||
break
|
break
|
||||||
|
case 'lp_guardas':
|
||||||
|
eventos_lp_guardas()
|
||||||
|
lp['paginas_impresion'] = lp.paginas_impresion
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3575,7 +3941,7 @@ async function fill_bbdd_from_lp(presupuesto_id){
|
|||||||
linea_data = {
|
linea_data = {
|
||||||
presupuesto_id: presupuesto_id,
|
presupuesto_id: presupuesto_id,
|
||||||
tipo: rowData.row_id,
|
tipo: rowData.row_id,
|
||||||
paginas: rowData.paginas,
|
paginas: (rowData.row_id=='lp_guardas')?(<?php echo ($tipo_impresion_id == 1 || $tipo_impresion_id == 3)?8:4 ?>):rowData.paginas,
|
||||||
papel_id: rowData.papel,
|
papel_id: rowData.papel,
|
||||||
gramaje: rowData.gramaje,
|
gramaje: rowData.gramaje,
|
||||||
papel_impresion_id: rowData.papel_impresion_id,
|
papel_impresion_id: rowData.papel_impresion_id,
|
||||||
@ -3606,6 +3972,9 @@ async function fill_bbdd_from_lp(presupuesto_id){
|
|||||||
total_linea: rowData.total_linea,
|
total_linea: rowData.total_linea,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(rowData.row_id=='lp_guardas')
|
||||||
|
linea_data.paginas_impresion = rowData.paginas_impresion
|
||||||
|
|
||||||
// maquina rotativa o inkjet
|
// maquina rotativa o inkjet
|
||||||
if(linea_data.maquina_tipo=='inkjet'){
|
if(linea_data.maquina_tipo=='inkjet'){
|
||||||
|
|
||||||
@ -3730,7 +4099,7 @@ function checkPaginasPresupuesto(){
|
|||||||
|
|
||||||
tableLineasPresupuesto.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
tableLineasPresupuesto.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
||||||
var rowData = this.data();
|
var rowData = this.data();
|
||||||
if(rowData.row_id != 'lp_cubierta' && rowData.row_id != 'lp_sobrecubierta')
|
if(rowData.row_id != 'lp_cubierta' && rowData.row_id != 'lp_sobrecubierta' && rowData.row_id != 'lp_guardas')
|
||||||
cantidad_total += parseInt(rowData.paginas)
|
cantidad_total += parseInt(rowData.paginas)
|
||||||
})
|
})
|
||||||
htmlString = ''
|
htmlString = ''
|
||||||
|
|||||||
@ -97,6 +97,9 @@ $('.accordion-button').on('click', function (e) {
|
|||||||
else if (e.target.id.includes("cubierta")) {
|
else if (e.target.id.includes("cubierta")) {
|
||||||
$("#tableCompCubierta").DataTable().columns.adjust();
|
$("#tableCompCubierta").DataTable().columns.adjust();
|
||||||
}
|
}
|
||||||
|
else if (e.target.id.includes("guardas")) {
|
||||||
|
$("#tableCompGuardas").DataTable().columns.adjust();
|
||||||
|
}
|
||||||
else if (e.target.id.includes("LineasPresupuesto")) {
|
else if (e.target.id.includes("LineasPresupuesto")) {
|
||||||
$("#tableLineasPresupuesto").DataTable().columns.adjust();
|
$("#tableLineasPresupuesto").DataTable().columns.adjust();
|
||||||
}
|
}
|
||||||
@ -116,7 +119,7 @@ function getRowFromLineaInt(tipo, linea) {
|
|||||||
parseFloat(linea.fields.precio_impresion_horas + linea.fields.margen_impresion_horas + linea.fields.precio_click_pedido).toFixed(2);
|
parseFloat(linea.fields.precio_impresion_horas + linea.fields.margen_impresion_horas + linea.fields.precio_click_pedido).toFixed(2);
|
||||||
|
|
||||||
|
|
||||||
return {
|
data = {
|
||||||
'tipo': tipo,
|
'tipo': tipo,
|
||||||
'paginas': linea.fields.paginas,
|
'paginas': linea.fields.paginas,
|
||||||
'papel': linea.fields.papel_generico,
|
'papel': linea.fields.papel_generico,
|
||||||
@ -140,6 +143,9 @@ function getRowFromLineaInt(tipo, linea) {
|
|||||||
'papelImpresionId': linea.fields.papel_impresion_id,
|
'papelImpresionId': linea.fields.papel_impresion_id,
|
||||||
'tarifa_impresion_id': linea.fields.tarifa_impresion_id,
|
'tarifa_impresion_id': linea.fields.tarifa_impresion_id,
|
||||||
}
|
}
|
||||||
|
if(data['tipo']=='guardas')
|
||||||
|
data['paginas_impresion'] = linea.fields.paginas_impresion;
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRowFromLineaRot(linea) {
|
function getRowFromLineaRot(linea) {
|
||||||
@ -328,6 +334,12 @@ function clearCubierta() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function clearGuardas() {
|
||||||
|
|
||||||
|
$('#tableCompGuardas').DataTable().clear().draw();
|
||||||
|
$('#insertarGuardasBtn').css('display', 'none');
|
||||||
|
}
|
||||||
|
|
||||||
function clearIntRot() {
|
function clearIntRot() {
|
||||||
|
|
||||||
$('#errorComRot').html('');
|
$('#errorComRot').html('');
|
||||||
@ -397,6 +409,22 @@ function selectCubiertaLineas() {
|
|||||||
$('#total_comp_cubierta').html(value_total.toFixed(2));
|
$('#total_comp_cubierta').html(value_total.toFixed(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function selectGuardasLineas() {
|
||||||
|
|
||||||
|
$("#tableCompGuardas").DataTable().rows('.selected').deselect();
|
||||||
|
|
||||||
|
let value_total = 0.00;
|
||||||
|
|
||||||
|
if ($("#tableCompGuardas").DataTable().rows().count() > 0) {
|
||||||
|
|
||||||
|
$("#tableCompGuardas").DataTable().row(0).nodes().to$().toggleClass('selected');
|
||||||
|
value_total = parseFloat($("#tableCompGuardas").DataTable().rows(0).data()[0]['total'])
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$('#total_comp_guardas').html(value_total.toFixed(2));
|
||||||
|
}
|
||||||
|
|
||||||
function getIDsComparador(is_color, is_hq) {
|
function getIDsComparador(is_color, is_hq) {
|
||||||
|
|
||||||
if (!is_color) {
|
if (!is_color) {
|
||||||
@ -511,7 +539,7 @@ function fillIntRot(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function fillCubierta(data, is_color, is_hq) {
|
function fillCubierta(data) {
|
||||||
|
|
||||||
let sorted = data.lineas.sort(
|
let sorted = data.lineas.sort(
|
||||||
(p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ?
|
(p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ?
|
||||||
@ -524,6 +552,19 @@ function fillCubierta(data, is_color, is_hq) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fillGuardas(data) {
|
||||||
|
|
||||||
|
let sorted = data.lineas.sort(
|
||||||
|
(p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ?
|
||||||
|
-1 : ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) > (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ? 1 : 0);
|
||||||
|
sorted.forEach(function (linea) {
|
||||||
|
if (typeof linea.error == "undefined")
|
||||||
|
$('#tableCompGuardas').DataTable().row
|
||||||
|
.add(getRowFromLineaInt('guardas', linea))
|
||||||
|
.draw()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function clearCompTable() {
|
function clearCompTable() {
|
||||||
|
|
||||||
$('#insertarPlanaBtn').addClass('d-none')
|
$('#insertarPlanaBtn').addClass('d-none')
|
||||||
@ -606,7 +647,7 @@ function generateCompJSON() {
|
|||||||
try {
|
try {
|
||||||
cubierta_obj = {
|
cubierta_obj = {
|
||||||
"cubierta": {
|
"cubierta": {
|
||||||
'paginas': $('#compCarasCubierta').select2('data')[0].id,
|
'paginas': $('#compCarasCubierta option:selected').val(),
|
||||||
'papel_id': $('#compPapelCubierta').select2('data')[0].id,
|
'papel_id': $('#compPapelCubierta').select2('data')[0].id,
|
||||||
'gramaje': $('#compGramajeCubierta').select2('data')[0].text.trim(),
|
'gramaje': $('#compGramajeCubierta').select2('data')[0].text.trim(),
|
||||||
},
|
},
|
||||||
@ -615,9 +656,24 @@ function generateCompJSON() {
|
|||||||
catch (e) {
|
catch (e) {
|
||||||
cubierta_obj = {}
|
cubierta_obj = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
$.extend(data, cubierta_obj);
|
$.extend(data, cubierta_obj);
|
||||||
|
|
||||||
|
if($('#compCarasGuardas').length>0){
|
||||||
|
try {
|
||||||
|
guardas_obj = {
|
||||||
|
"guardas": {
|
||||||
|
'paginas_impresion': $('#compCarasGuardas option:selected').val(),
|
||||||
|
'papel_id': $('#compPapelGuardas').select2('data')[0].id,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
guardas_obj = {}
|
||||||
|
}
|
||||||
|
$.extend(data, guardas_obj);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
data_str = JSON.stringify(data)
|
data_str = JSON.stringify(data)
|
||||||
$('#comparador_json_data').val(data_str)
|
$('#comparador_json_data').val(data_str)
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
httpdocs/themes/vuexy/img/safekat/presupuestos/icon_guardas.png
Normal file
BIN
httpdocs/themes/vuexy/img/safekat/presupuestos/icon_guardas.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
Reference in New Issue
Block a user