mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
terminado lineas de presupuesto
This commit is contained in:
@ -145,6 +145,8 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$this->viewData['papelGenericoColorHQList'] = $this->getPapelGenericoColorHQ();
|
||||
$this->viewData['papelGenericoCubiertaList'] = $this->getPapelGenericoCubierta();
|
||||
$this->viewData['papelGenericoSobrecubiertaList'] = $this->getPapelGenericoSobreCubierta();
|
||||
$this->viewData['papelGenericoRotativaNegroList'] = $this->getPapelGenericoRotativaNegro();
|
||||
$this->viewData['papelGenericoRotativaColorList'] = $this->getPapelGenericoRotativaColor();
|
||||
|
||||
// Tarifas
|
||||
$this->viewData['serviciosPreimpresion'] = $this->getServiciosPreimpresion();
|
||||
@ -440,6 +442,8 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
];
|
||||
|
||||
$gramaje = $reqData['gramaje'] ?? 0;
|
||||
|
||||
|
||||
|
||||
if ($type=='interior') {
|
||||
|
||||
@ -461,7 +465,21 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
'color' => intval($reqData['paginas_color']) ?? 0,
|
||||
);
|
||||
|
||||
$resourceData = $this->getCompIntRotData($datosPedido, $papel_generico, $gramaje, $paginas);
|
||||
$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->getCompIntRotData($datosPedido, $papel_generico, $gramaje, $paginas, $datosTipolog);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
@ -551,6 +569,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$maquinas = $maquinamodel->getMaquinaImpresionForPresupuesto(
|
||||
is_rotativa: 0,
|
||||
tarifa_tipo: $tipo,
|
||||
uso_tarifa: $uso,
|
||||
tirada: $datosPedido->tirada + $datosPedido->merma,
|
||||
papel_impresion_id: $papel->id,
|
||||
);
|
||||
@ -584,7 +603,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
return $lineas;
|
||||
}
|
||||
|
||||
public function getCompIntRotData($datosPedido, $papel_generico, $gramaje, $paginas)
|
||||
public function getCompIntRotData($datosPedido, $papel_generico, $gramaje, $paginas, $datosTipolog = null)
|
||||
{
|
||||
|
||||
$uso = 'interior';
|
||||
@ -628,13 +647,18 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
foreach ($papeles as $papel) {
|
||||
|
||||
$papelImpresionTipologiaModel = new \App\Models\Configuracion\PapelImpresionTipologiaModel();
|
||||
$datosTipologias = $papelImpresionTipologiaModel
|
||||
->findTipologiasForPapelImpresion($papel->id, $parametrosRotativa->colorPages>0?'color':'negro')
|
||||
->get()->getResultObject();
|
||||
if(is_null($datosTipolog)){
|
||||
$datosTipologias = $papelImpresionTipologiaModel
|
||||
->findTipologiasForPapelImpresion($papel->id, $parametrosRotativa->colorPages>0?'color':'negro')
|
||||
->get()->getResultObject();
|
||||
|
||||
|
||||
if(count($datosTipologias)==0){
|
||||
continue;
|
||||
|
||||
if(count($datosTipologias)==0){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$datosTipologias = $datosTipolog;
|
||||
}
|
||||
|
||||
$parametrosRotativa->rotativa_gota_negro = $datosTipologias[0]->gota_negro;
|
||||
@ -649,6 +673,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$maquinas = $maquinamodel->getMaquinaImpresionForPresupuesto(
|
||||
is_rotativa: 1,
|
||||
tarifa_tipo: $tipo,
|
||||
uso_tarifa: $uso,
|
||||
tirada: $datosPedido->tirada + $datosPedido->merma,
|
||||
papel_impresion_id: $papel->id,
|
||||
);
|
||||
@ -683,6 +708,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$linea['fields']['papel_impresion'] = $papel->nombre;
|
||||
$linea['fields']['papel_impresion_id'] = $papel->id;
|
||||
$linea['fields']['paginas'] = $datosPedido->paginas;
|
||||
$linea['fields']['paginas_color'] = $paginas->color;
|
||||
$linea['fields']['gramaje'] = $gramaje;
|
||||
$linea['fields']['papel_generico_id'] = $papel_generico['id'];
|
||||
$linea['fields']['papel_generico'] = $papel_generico['nombre'];
|
||||
@ -691,6 +717,8 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$linea['fields']['num_formas_horizontales'] = floor($linea['fields']['factor_anchura']);
|
||||
$linea['fields']['num_formas_verticales'] = floor($linea['fields']['factor_altura']);
|
||||
|
||||
$linea['fields']['datosTipologias'] = $datosTipologias[0];
|
||||
|
||||
// impresion
|
||||
$linea['fields']['precio_click'] = $tarifa;
|
||||
$linea['fields']['precio_click_pedido'] = $linea['fields']['clicks_pedido'] * $linea['fields']['precio_click'];
|
||||
@ -791,8 +819,9 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$alto = $reqData['alto'] ?? null;
|
||||
// Datos contiene la tirada
|
||||
// uso: negro, negrohq, color, colorhq,
|
||||
$uso_tarifa = $reqData['uso_tarifa'] ?? 'interior';
|
||||
$model = new MaquinaModel();
|
||||
$maquinas = $model->getMaquinaImpresionForPresupuesto($is_rotativa, $uso, $datos, $papel_impresion );
|
||||
$maquinas = $model->getMaquinaImpresionForPresupuesto($is_rotativa, $uso, $uso_tarifa ,$datos, $papel_impresion );
|
||||
$menu = [];
|
||||
foreach ($maquinas as $maquina){
|
||||
|
||||
@ -855,6 +884,29 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
protected function getPapelGenericoRotativaNegro()
|
||||
{
|
||||
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
||||
$data = $model->getPapelForComparador('negro', false, false, true);
|
||||
array_unshift($data, (object)array(
|
||||
"id" => 0,
|
||||
"nombre" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])
|
||||
));
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getPapelGenericoRotativaColor()
|
||||
{
|
||||
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
||||
$data = $model->getPapelForComparador('color', false, false, true);
|
||||
array_unshift($data, (object)array(
|
||||
"id" => 0,
|
||||
"nombre" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])
|
||||
));
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getPapelGenericoNegro()
|
||||
{
|
||||
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
||||
|
||||
@ -92,6 +92,8 @@ return [
|
||||
'color' => 'Colour',
|
||||
'colorhq' => 'ColourHQ',
|
||||
'rotativa' => 'Rotary',
|
||||
'rotativa_bn' => 'Rot. BW',
|
||||
'rotativa_color' => 'Rot. Colour',
|
||||
'si' => 'Yes',
|
||||
'no' => 'No',
|
||||
'insertarLinea' => 'Insert Line',
|
||||
@ -137,6 +139,15 @@ return [
|
||||
'totalCorte' => 'Total Cut',
|
||||
'totalImpresion' => 'TOTAL PRINT',
|
||||
|
||||
'addLineaPresupuesto' => 'Add line...',
|
||||
|
||||
'errores' => [
|
||||
'paginas' => 'The field pages must be greater than zero',
|
||||
'tiradas' => 'The field print must be greater than zero',
|
||||
'dimension' => 'The book dimension must be greater than 60mm',
|
||||
'lineaDuplicada' => 'That type of line already exists in the budget.',
|
||||
],
|
||||
|
||||
/* '4x0' => '4x0',
|
||||
'4x4' => '4x4',
|
||||
'aprobadoAt' => 'Aprobado At',
|
||||
|
||||
@ -91,6 +91,8 @@ return [
|
||||
'color' => 'Color',
|
||||
'colorhq' => 'ColorHQ',
|
||||
'rotativa' => 'Rotativa',
|
||||
'rotativa_bn' => 'Rot. BN',
|
||||
'rotativa_color' => 'Rot. Color',
|
||||
'si' => 'Si',
|
||||
'no' => 'No',
|
||||
'insertarLinea' => 'Insertar Línea',
|
||||
@ -143,6 +145,8 @@ return [
|
||||
'gTintaMagentaPed' => 'G.T. Magenta Ped.',
|
||||
'gTintaAmarilloPed' => 'G.T. Amarillo Ped.',
|
||||
|
||||
'addLineaPresupuesto' => 'Añadir linea...',
|
||||
|
||||
'servicioAcabado' => 'Servicio de acabado',
|
||||
'servicioPreimpresion' => 'Servicio de preimpresión',
|
||||
'servicioEncuadernado' => 'Servicio de encuadernado',
|
||||
@ -170,6 +174,7 @@ return [
|
||||
'paginas' => 'El campo páginas tiene que ser mayor que cero',
|
||||
'tiradas' => 'El campo tiradas tiene que ser mayor que cero',
|
||||
'dimension' => 'La dimensión del libro tiene que ser mayor que 60mm',
|
||||
'lineaDuplicada' => 'Ya existe ese tipo de linea en el presupuesto'
|
||||
],
|
||||
|
||||
|
||||
|
||||
@ -336,7 +336,7 @@ class MaquinaModel extends \App\Models\GoBaseModel
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
public function getMaquinaImpresionForPresupuesto($is_rotativa, $tarifa_tipo, $tirada, $papel_impresion_id = -1)
|
||||
public function getMaquinaImpresionForPresupuesto($is_rotativa, $tarifa_tipo, $uso_tarifa = 'interior', $tirada, $papel_impresion_id = -1)
|
||||
{
|
||||
/*
|
||||
1.-> tarifa_Tipo impresion
|
||||
@ -371,11 +371,12 @@ class MaquinaModel extends \App\Models\GoBaseModel
|
||||
|
||||
if(is_array($tarifa_tipo)){
|
||||
foreach($tarifa_tipo as $tarifa){
|
||||
$builder->where("EXISTS (SELECT * FROM lg_maquinas_tarifas_impresion t2 WHERE t1.id=t2.maquina_id AND t2.tipo='{$tarifa}' AND t2.is_deleted=0)");
|
||||
$builder->where("EXISTS (SELECT * FROM lg_maquinas_tarifas_impresion t2 WHERE t1.id=t2.maquina_id AND t2.tipo='{$tarifa}' AND t2.uso='{$uso_tarifa}' AND t2.is_deleted=0)");
|
||||
}
|
||||
}
|
||||
else{
|
||||
$builder->where("t2.tipo", $tarifa_tipo);
|
||||
$builder->where("t2.uso", $uso_tarifa);
|
||||
}
|
||||
|
||||
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
|
||||
|
||||
@ -93,7 +93,7 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
|
||||
}
|
||||
|
||||
|
||||
public function getPapelForComparador($tipo, $is_cubierta = null, $is_sobrecubierta = null)
|
||||
public function getPapelForComparador($tipo, $is_cubierta = null, $is_sobrecubierta = null, $rotativa = null)
|
||||
{
|
||||
/*
|
||||
1.-> Tipo impresion
|
||||
@ -124,12 +124,19 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
|
||||
$builder->where("t2.cubierta", 1);
|
||||
}
|
||||
}
|
||||
|
||||
if(!is_null($is_sobrecubierta)){
|
||||
if($is_sobrecubierta==true){
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
}
|
||||
}
|
||||
|
||||
if(!is_null($rotativa)){
|
||||
if($rotativa==true){
|
||||
$builder->where("t2.rotativa", 1);
|
||||
}
|
||||
}
|
||||
|
||||
return $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
|
||||
}
|
||||
|
||||
@ -162,15 +169,23 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
|
||||
->where("t4.tipo", "impresion")
|
||||
->where("t5.tipo", $tipo)
|
||||
->where("t1.nombre", $papel_generico_nombre);
|
||||
|
||||
$uso_tarifa = 'interior';
|
||||
|
||||
if($uso == 'bn' || $uso == 'bnhq')
|
||||
$builder->where("t2.bn", 1);
|
||||
else if ($uso == 'color' || $uso == 'colorhq')
|
||||
$builder->where("t2.color", 1);
|
||||
else if ($uso == 'cubierta')
|
||||
else if ($uso == 'cubierta'){
|
||||
$uso_tarifa = 'cubierta';
|
||||
$builder->where("t2.cubierta", 1);
|
||||
else if ($uso == 'sobrecubierta')
|
||||
}
|
||||
else if ($uso == 'sobrecubierta'){
|
||||
$uso_tarifa = 'sobrecubierta';
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
}
|
||||
|
||||
$builder->where("t5.uso", $uso_tarifa);
|
||||
|
||||
$values = $builder->orderBy("t2.gramaje", "asc")->get()->getResultObject();
|
||||
$id = 1;
|
||||
@ -209,18 +224,26 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
|
||||
->where("t5.tipo", $tipo)
|
||||
->where("t1.id", $papel_generico_id);
|
||||
|
||||
$uso_tarifa = 'interior';
|
||||
|
||||
if($tipo == 'negro' || $tipo == 'negrohq')
|
||||
$builder->where("t2.bn", 1);
|
||||
else if ($tipo == 'color' || $tipo == 'colorhq')
|
||||
$builder->where("t2.color", 1);
|
||||
if ($uso == 'cubierta')
|
||||
if ($uso == 'cubierta'){
|
||||
$uso_tarifa = 'cubierta';
|
||||
$builder->where("t2.cubierta", 1);
|
||||
else if ($uso == 'sobrecubierta')
|
||||
}
|
||||
else if ($uso == 'sobrecubierta'){
|
||||
$uso_tarifa = 'sobrecubierta';
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
}
|
||||
if($uso=='rotativa')
|
||||
$builder->where("t2.rotativa", 1);
|
||||
else
|
||||
$builder->where("t2.rotativa", 0);
|
||||
|
||||
$builder->where("t5.uso", $uso_tarifa);
|
||||
|
||||
|
||||
$values = $builder->orderBy("t2.gramaje", "asc")->get()->getResultObject();
|
||||
|
||||
@ -295,35 +295,7 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
|
||||
$builder->where("t1.rotativa", 1);
|
||||
else
|
||||
$builder->where("t1.rotativa", 0);
|
||||
/*
|
||||
if($tipo=='negro' || $tipo=='negrohq'){
|
||||
$builder->where("t1.bn", 1);
|
||||
$builder->where("t1.rotativa", 0);
|
||||
}
|
||||
elseif($tipo=='color' || $tipo=='colorhq'){
|
||||
$builder->where("t1.color", 1);
|
||||
$builder->where("t1.rotativa", 0);
|
||||
}
|
||||
elseif($tipo=='cubierta'){
|
||||
$builder->where("t1.cubierta", 1);
|
||||
$builder->where("t1.color", 1);
|
||||
$builder->where("t1.rotativa", 0);
|
||||
}
|
||||
elseif($tipo=='sobrecubierta'){
|
||||
$builder->where("t1.sobrecubierta", 1);
|
||||
$builder->where("t1.color", 1);
|
||||
$builder->where("t1.rotativa", 0);
|
||||
}
|
||||
elseif($tipo=='rot_bn'){
|
||||
$builder->where("t1.bn", 1);
|
||||
$builder->where("t1.rotativa", 1);
|
||||
}
|
||||
elseif($tipo=='rot_color'){
|
||||
$builder->where("t1.color", 1);
|
||||
$builder->where("t1.rotativa", 1);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
|
||||
}
|
||||
|
||||
@ -233,6 +233,8 @@ class PresupuestoService extends BaseService
|
||||
$data['precio_pagina_color'] = round($pag_color ? $data['precio_tinta'] / ($pag_color * ($datosPedido->tirada + $datosPedido->merma)) : 0, 6);
|
||||
|
||||
// calculo de corte
|
||||
$data['velocidad_corte'] = $maquina->velocidad_corte;
|
||||
$data['precio_hora_corte'] = $maquina->precio_hora_corte;
|
||||
$data['tiempo_corte'] = $maquina->velocidad_corte > 0 ? round($metros_papel_total / $maquina->velocidad_corte, 2) : 0;
|
||||
$data['total_corte'] = round(($data['tiempo_corte'] / 60.0) * $maquina->precio_hora_corte, 2);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -208,6 +208,7 @@ function getRowFromLineaRot(linea) {
|
||||
'tiempoMaquina': linea.fields.tiempo_maquina,
|
||||
'papelGenericoId': linea.fields.papel_generico_id,
|
||||
'papelImpresionId': linea.fields.papel_impresion_id,
|
||||
'paginasColor': linea.fields.paginas_color,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -184,7 +184,7 @@
|
||||
info: false,
|
||||
ordering: false,
|
||||
responsive: true,
|
||||
select: true,
|
||||
select: false,
|
||||
language: {
|
||||
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
|
||||
},
|
||||
@ -239,7 +239,7 @@
|
||||
info: false,
|
||||
ordering: false,
|
||||
responsive: true,
|
||||
select: true,
|
||||
select: false,
|
||||
language: {
|
||||
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
|
||||
},
|
||||
@ -281,11 +281,12 @@
|
||||
{ 'data': 'maquinaVelocidad'},
|
||||
{ 'data': 'tiempoMaquina'},
|
||||
{ 'data': 'papelGenericoId'},
|
||||
{ 'data': 'papelImpresionId'}
|
||||
{ 'data': 'papelImpresionId'},
|
||||
{ 'data': 'paginasColor'},
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
target: [21,22,23,24,25],
|
||||
target: [21,22,23,24,25,26],
|
||||
visible: false,
|
||||
searchable: false
|
||||
},
|
||||
@ -299,7 +300,7 @@
|
||||
info: false,
|
||||
ordering: false,
|
||||
responsive: true,
|
||||
select: true,
|
||||
select: false,
|
||||
language: {
|
||||
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
|
||||
},
|
||||
@ -549,38 +550,17 @@
|
||||
|
||||
$('#tipoImpresion').on("change", function () {
|
||||
updatePapelesComparador();
|
||||
|
||||
$('#title_int_rot').html('<?= lang("Presupuestos.compInteriorRotativa") ?>');
|
||||
$('#title_int_plana').html('<?= lang("Presupuestos.compInteriorPlana") ?>');
|
||||
$('#paginas').change();
|
||||
|
||||
$('#tableCompIntRotativa').DataTable().clear().draw();
|
||||
$('#total_comp_rot').html("0.00");
|
||||
|
||||
if (($('#tipoImpresion').select2('data')[0].id == 'negro' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'color')){
|
||||
|
||||
$('#tableCompIntRotativa').DataTable().clear().draw();
|
||||
$('#total_comp_rot').html("0.00");
|
||||
|
||||
if( $('#tableCompIntPlana').DataTable().rows().count() > 0 &&
|
||||
$('#tableCompIntPlana').DataTable().cell(0, 0).data().includes('hq')) {
|
||||
$('#tableCompIntPlana').DataTable().clear().draw();
|
||||
$('#total_comp_plana').html("0.00");
|
||||
|
||||
$('#tableCompIntPlana').DataTable().clear().draw();
|
||||
$('#total_comp_plana').html("0.00");
|
||||
}
|
||||
|
||||
}
|
||||
else if (($('#tipoImpresion').select2('data')[0].id == 'negrohq' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'colorhq')){
|
||||
|
||||
$('#tableCompIntRotativa').DataTable().clear().draw();
|
||||
$('#total_comp_rot').html("0.00");
|
||||
|
||||
if($('#tableCompIntPlana').DataTable().rows().count() > 0 &&
|
||||
!$('#tableCompIntPlana').DataTable().cell(0, 0).data().includes('hq')) {
|
||||
|
||||
$('#tableCompIntPlana').DataTable().clear().draw();
|
||||
$('#total_comp_plana').html("0.00");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -593,7 +573,13 @@
|
||||
checkDatosPedidoForComp()) {
|
||||
|
||||
getLineasIntPlana(is_color, is_hq).then((result) =>{
|
||||
getLineasIntRot(is_hq);
|
||||
|
||||
// Para rotativa, si es color el papel y el gramaje tiene que ser igual
|
||||
if(!is_color || ($('#compPapelNegro').select2('data')[0].id == $('#compPapelColor').select2('data')[0].id &&
|
||||
$('#compGramajeNegro').select2('data')[0].text.trim() == $('#compGramajeColor').select2('data')[0].text.trim()))
|
||||
{
|
||||
getLineasIntRot(is_hq);
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
|
||||
Reference in New Issue
Block a user