mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
realizado el calculo por horas e introducido en el comparador
This commit is contained in:
@ -63,6 +63,9 @@ class ClientePrecios extends \App\Controllers\GoBaseResourceController
|
||||
if($plantilla_id == -1){
|
||||
$this->model->clean_plantilla_id($requestedId);
|
||||
}
|
||||
else if($requestedId== -1){ // actualizar todos los clientes que usan una plantilla
|
||||
$this->model->update_from_plantilla($plantilla_id);
|
||||
}
|
||||
else{
|
||||
$this->model->copy_from_plantilla($requestedId, $plantilla_id);
|
||||
}
|
||||
|
||||
@ -249,7 +249,7 @@ class Maquinastarifasimpresion extends \App\Controllers\GoBaseResourceController
|
||||
// Si no se quiere borrar...
|
||||
if ($data['data'][$pkey]['is_deleted'] != 1) {
|
||||
// Cubierta y sobrecubierta sólo pueden ser en color
|
||||
if ($values['uso'] != 'interior' && $values['tipo'] != 'color') {
|
||||
if ($values['uso'] != 'interior' && $values['tipo'] != 'colorhq') {
|
||||
return lang('MaquinasTarifasImpresions.validation.cubierta_sobrecubierta_color');
|
||||
}
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@ use App\Services\PresupuestoService;
|
||||
use App\Models\Configuracion\PapelImpresionModel;
|
||||
use App\Models\Configuracion\MaquinaModel;
|
||||
use App\Models\Configuracion\MaquinasTarifasImpresionModel;
|
||||
use App\Models\Clientes\ClientePreciosModel;
|
||||
use Exception;
|
||||
|
||||
class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
@ -432,12 +433,14 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
];
|
||||
|
||||
$gramaje = $reqData['gramaje'] ?? 0;
|
||||
|
||||
$cliente_id = $reqData['cliente_id'] ?? -1;
|
||||
|
||||
|
||||
|
||||
if ($type=='interior') {
|
||||
|
||||
$resourceData = $this->getCompIntData($type, $datosPedido, $papel_generico, $gramaje, $isColor, $isHq);
|
||||
$resourceData = $this->getCompIntData($type, $datosPedido, $papel_generico, $gramaje, $isColor, $isHq, $cliente_id);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
@ -469,7 +472,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
array_push($datosTipolog, $data);
|
||||
}
|
||||
|
||||
$resourceData = $this->getCompIntRotData($datosPedido, $papel_generico, $gramaje, $paginas, $datosTipolog);
|
||||
$resourceData = $this->getCompIntRotData($datosPedido, $papel_generico, $gramaje, $paginas, $cliente_id, $datosTipolog);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
@ -480,12 +483,13 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
return $this->respond($data);
|
||||
}
|
||||
else if ($type=='cubierta') {
|
||||
else if ($type=='cubierta' || $type=='sobrecubierta') {
|
||||
|
||||
$datosPedido->solapas = $reqData['solapas'];
|
||||
$datosPedido->solapas_ancho = $reqData['solapas_ancho'];
|
||||
|
||||
$resourceData = $this->getCompIntData($type, $datosPedido, $papel_generico, $gramaje, $isColor, $isHq);
|
||||
// Cubierta y sobrecubierta siempre color HQ
|
||||
$resourceData = $this->getCompIntData($type, $datosPedido, $papel_generico, $gramaje, $isColor, 1, $cliente_id);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
@ -523,11 +527,6 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$datos = $reqData['datos'] ?? null;
|
||||
$presupuesto_id = $reqData['presupuesto_id'] ?? -1;
|
||||
|
||||
/*foreach($datos as $key=>$linea){
|
||||
$datos[$key]['papel_id'] = $datos[$key]['papel_id'] ?? -1;
|
||||
}*/
|
||||
|
||||
|
||||
if($datos != null){
|
||||
$this->updateLineasPresupuestoActivas($presupuesto_id, $datos);
|
||||
}
|
||||
@ -554,7 +553,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
}
|
||||
|
||||
|
||||
public function getCompIntData($uso, $datosPedido, $papel_generico, $gramaje, $isColor, $isHq)
|
||||
public function getCompIntData($uso, $datosPedido, $papel_generico, $gramaje, $isColor, $isHq, $cliente_id)
|
||||
{
|
||||
$tipo = $isColor? ($isHq?'colorhq':'color'): ($isHq?'negrohq':'negro');
|
||||
|
||||
@ -584,8 +583,6 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
'rotativa' => 0,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Se obtienen los papeles disponibles
|
||||
$papelimpresionmodel = new PapelImpresionModel();
|
||||
@ -616,6 +613,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
if(!is_float($tarifa)){
|
||||
continue;
|
||||
}
|
||||
|
||||
$linea = PresupuestoService::getCostesLinea($uso, $datosPedido, $maquina, $papel, $opciones_papel, $tarifa);
|
||||
if(array_key_exists('error', $linea))
|
||||
continue;
|
||||
@ -634,13 +632,35 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$linea['fields']['precio_click'],
|
||||
$maquina->velocidad);
|
||||
|
||||
$clientePreciosModel = new ClientePreciosModel();
|
||||
$config = (object)[
|
||||
"tipo" => $uso,
|
||||
"tipo_maquina" => $maquina->is_tinta?'inkjet':'toner',
|
||||
"tipo_impresion" => $tipo
|
||||
];
|
||||
$tiempo = PresupuestoService::getHorasMaquina(
|
||||
$linea['fields']['precio_click_pedido'],
|
||||
$linea['fields']['precio_click'],
|
||||
$maquina->velocidad);
|
||||
[$precio_hora, $margen_precio_hora] = $clientePreciosModel->get_precio_hora($cliente_id, $config, $tiempo);
|
||||
|
||||
if(is_null($precio_hora)){
|
||||
continue;
|
||||
}
|
||||
|
||||
$linea['fields']['precio_hora'] = $precio_hora;
|
||||
$linea['fields']['precio_hora_margen'] = $margen_precio_hora;
|
||||
$linea['fields']['horas_maquina'] = $tiempo;
|
||||
$linea['fields']['precio_impresion_horas'] = $precio_hora*$tiempo*1.0;
|
||||
$linea['fields']['margen_impresion_horas'] = $precio_hora*$tiempo*1.0*$margen_precio_hora/100.0;
|
||||
|
||||
array_push($lineas, $linea);
|
||||
}
|
||||
}
|
||||
return $lineas;
|
||||
}
|
||||
|
||||
public function getCompIntRotData($datosPedido, $papel_generico, $gramaje, $paginas, $datosTipolog = null)
|
||||
public function getCompIntRotData($datosPedido, $papel_generico, $gramaje, $paginas, $cliente_id, $datosTipolog = null)
|
||||
{
|
||||
|
||||
$uso = 'interior';
|
||||
@ -771,9 +791,37 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$linea['fields']['precio_click'],
|
||||
$maquina->velocidad);
|
||||
|
||||
|
||||
$clientePreciosModel = new ClientePreciosModel();
|
||||
$config = (object)[
|
||||
"tipo" => $uso,
|
||||
"tipo_maquina" => 'inkjet',
|
||||
"tipo_impresion" => $tipo
|
||||
];
|
||||
$tiempo = PresupuestoService::getHorasMaquina(
|
||||
$linea['fields']['precio_click_pedido'],
|
||||
$linea['fields']['precio_click'],
|
||||
$maquina->velocidad);
|
||||
[$precio_hora, $margen_precio_hora] = $clientePreciosModel->get_precio_hora($cliente_id, $config, $tiempo);
|
||||
|
||||
if(is_null($precio_hora)){
|
||||
continue;
|
||||
}
|
||||
|
||||
$linea['fields']['precio_hora'] = $precio_hora;
|
||||
$linea['fields']['precio_hora_margen'] = $margen_precio_hora;
|
||||
$linea['fields']['horas_maquina'] = $tiempo;
|
||||
$linea['fields']['precio_impresion_horas'] = $precio_hora*$tiempo*1.0;
|
||||
$linea['fields']['margen_impresion_horas'] = $precio_hora*$tiempo*1.0*$margen_precio_hora/100.0;
|
||||
|
||||
// total linea rotativa
|
||||
$linea['fields']['total_impresion'] = $linea['fields']['precio_pedido'] + $linea['fields']['precio_click_pedido'] + $linea['fields']['precio_tinta'] +
|
||||
$linea['fields']['total_corte'];
|
||||
//$linea['fields']['total_impresion'] = $linea['fields']['precio_pedido'] + $linea['fields']['precio_click_pedido'] + $linea['fields']['precio_tinta'] +
|
||||
// $linea['fields']['total_corte'];
|
||||
$linea['fields']['total_impresion'] =
|
||||
$linea['fields']['precio_pedido'] + // papel
|
||||
$linea['fields']['precio_impresion_horas'] + $linea['fields']['margen_impresion_horas'] + // horas de maquina
|
||||
$linea['fields']['precio_tinta'] + // tinta
|
||||
$linea['fields']['total_corte']; // corte
|
||||
|
||||
array_push($lineas, $linea);
|
||||
}
|
||||
|
||||
@ -17,11 +17,20 @@ class Test extends BaseController
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$model = model('App\Models\Clientes\ClientePreciosModel') ;
|
||||
echo '<pre>';
|
||||
$model = model('App\Models\Configuracion\TipoPresupuestoModel');
|
||||
var_dump($model->get_isCosido(25));
|
||||
var_dump($model->update_from_plantilla(5));
|
||||
echo '</pre>';
|
||||
/*
|
||||
echo '<pre>';
|
||||
$model = model('App\Models\Clientes\ClientePreciosModel');
|
||||
$configuracion = (object)[
|
||||
'tipo' => 'interior',
|
||||
'tipo_maquina' => 'inkjet',
|
||||
'tipo_impresion' => 'color'
|
||||
];
|
||||
var_dump($model->get_precio_hora(999,$configuracion, 1.5));
|
||||
echo '</pre>';*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ return [
|
||||
'bicolor' => 'Bicolor',
|
||||
'validation' => [
|
||||
'duplicated_uso_tipo' => "Duplicate line (the combination 'use' and 'type' already exists)",
|
||||
'cubierta_sobrecubierta_color' => "Cover and dust jacket only allow 'color' type",
|
||||
'cubierta_sobrecubierta_color' => "Cover and dust jacket only allow 'color HQ' type",
|
||||
'tipo' => [
|
||||
'in_list' => 'The {field} field must be one of: {param}.',
|
||||
'required' => 'Required field.',
|
||||
|
||||
@ -75,6 +75,8 @@ return [
|
||||
'peso' => 'Weight',
|
||||
'click' => 'Click',
|
||||
'totalClicks' => 'Total clicks',
|
||||
'horas' => 'Machine hours',
|
||||
'precioImpresion' => 'Print price',
|
||||
'precioPagNegro' => 'Pages black price',
|
||||
'precioPagColor' => 'Pages color price',
|
||||
'totalTinta' => 'Total ink',
|
||||
|
||||
@ -30,7 +30,7 @@ return [
|
||||
'bicolor' => 'Bicolor',
|
||||
'validation' => [
|
||||
'duplicated_uso_tipo' => "Línea duplicada (la combinación 'uso' y 'tipo' ya existe)",
|
||||
'cubierta_sobrecubierta_color' => "Cubierta y sobrecubierta solo permiten tipo 'color'",
|
||||
'cubierta_sobrecubierta_color' => "Cubierta y sobrecubierta solo permiten tipo 'color HQ'",
|
||||
'tipo' => [
|
||||
'in_list' => 'El campo {field} debe contener uno de: {param}.',
|
||||
'required' => 'Campo obligatorio.',
|
||||
|
||||
@ -74,6 +74,8 @@ return [
|
||||
'peso' => 'Peso',
|
||||
'click' => 'Click',
|
||||
'totalClicks' => 'Total clicks',
|
||||
'horas' => 'Horas máquina',
|
||||
'precioImpresion' => 'Precio impresión',
|
||||
'precioPagNegro' => 'Precio pág. negro',
|
||||
'precioPagColor' => 'Precio pág. color',
|
||||
'totalTinta' => 'Total tinta',
|
||||
|
||||
@ -129,10 +129,16 @@ class ClientePreciosModel extends \App\Models\GoBaseModel
|
||||
|
||||
|
||||
function delete_values($cliente_id = 0){
|
||||
$session = session();
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
$date_value = $datetime->format('Y-m-d H:i:s');
|
||||
|
||||
$this->db
|
||||
->table($this->table . " t1")
|
||||
->where('cliente_id', $cliente_id)
|
||||
->set('is_deleted', 1)
|
||||
->set('deleted_at', $date_value)
|
||||
->set('user_updated_id', $session->id_user)
|
||||
->update();
|
||||
}
|
||||
|
||||
@ -158,14 +164,90 @@ class ClientePreciosModel extends \App\Models\GoBaseModel
|
||||
->set('tipo_impresion', $value->tipo_impresion)
|
||||
->set('tiempo_min', $value->tiempo_min)
|
||||
->set('tiempo_max', $value->tiempo_max)
|
||||
->set('precio_hora', $value->precio_hora)
|
||||
->set('margen', $value->margen)
|
||||
->set('user_updated_id', $session->id_user)
|
||||
->set('updated_at', $date_value)
|
||||
->set('user_created_id', $session->id_user)
|
||||
->set('created_at', $date_value)
|
||||
->insert();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function update_from_plantilla($plantilla_id = 0){
|
||||
|
||||
$session = session();
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
$date_value = $datetime->format('Y-m-d H:i:s');
|
||||
|
||||
// Se obtienen todos los id de clientes que usen esa tarifa
|
||||
$clientes = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select("t1.cliente_id AS id")
|
||||
->where('t1.plantilla_id', $plantilla_id)
|
||||
->distinct()
|
||||
->get()->getResultObject();
|
||||
|
||||
if(count($clientes)<=0){
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($clientes as $cliente){
|
||||
// Se borran los valores existentes
|
||||
$this->delete_values($cliente->id);
|
||||
|
||||
// Se cargan los valores de la plantilla
|
||||
$plantillaModel = model('App\Models\Clientes\ClientePlantillaPreciosLineasModel');
|
||||
$values = $plantillaModel->getResource($plantilla_id)->get()->getResultObject();
|
||||
foreach ($values as $value) {
|
||||
$this->db
|
||||
->table($this->table . " t1")
|
||||
->set('cliente_id', $cliente->id)
|
||||
->set('plantilla_id', $plantilla_id)
|
||||
->set('tipo', $value->tipo)
|
||||
->set('tipo_maquina', $value->tipo_maquina)
|
||||
->set('tipo_impresion', $value->tipo_impresion)
|
||||
->set('tiempo_min', $value->tiempo_min)
|
||||
->set('tiempo_max', $value->tiempo_max)
|
||||
->set('precio_hora', $value->precio_hora)
|
||||
->set('margen', $value->margen)
|
||||
->set('user_updated_id', $value->user_updated_id)
|
||||
->set('updated_at', $value->updated_at)
|
||||
->set('user_created_id', $session->id_user)
|
||||
->set('created_at', $date_value)
|
||||
->insert();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// config es un objeto que incluye
|
||||
// - tipo: 'interior', 'cubierta', 'sobrecubierta'
|
||||
// - tipo_maquina: 'toner', 'inkjet'
|
||||
// - tipo_impresion: 'negro', 'color', 'negrohq', 'colorhq'
|
||||
|
||||
function get_precio_hora($cliente_id, $config, $tiempo){
|
||||
|
||||
// Se cargan los valores de la plantilla
|
||||
$values = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select("t1.precio_hora AS precio_hora, t1.margen AS margen")
|
||||
->where('cliente_id', $cliente_id)
|
||||
->where('tipo', $config->tipo)
|
||||
->where('tipo_maquina', $config->tipo_maquina)
|
||||
->where('tipo_impresion', $config->tipo_impresion)
|
||||
->where('tiempo_min <=', $tiempo)
|
||||
->where('tiempo_max >=', $tiempo)
|
||||
->where('is_deleted', 0)
|
||||
->get()->getResultObject();
|
||||
|
||||
if(count($values)>0){
|
||||
return [floatval(($values[0])->precio_hora), floatval(($values[0])->margen)];
|
||||
}
|
||||
return [null, null];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get resource data.
|
||||
|
||||
@ -367,7 +367,7 @@ class MaquinaModel extends \App\Models\GoBaseModel
|
||||
->select(
|
||||
"t1.id AS maquina_id, t1.nombre AS maquina, t1.ancho_impresion AS ancho_impresion,
|
||||
t1.alto_impresion AS alto_impresion, t1.ancho AS ancho, t1.alto AS alto,
|
||||
t1.is_rotativa AS is rotativa, t1.alto_click AS alto_click, t1.velocidad AS velocidad,
|
||||
t1.is_rotativa AS is_rotativa, t1.is_tinta AS is_tinta, t1.alto_click AS alto_click, t1.velocidad AS velocidad,
|
||||
t1.precio_tinta_negro AS precio_tinta_negro, t1.precio_tinta_color AS precio_tinta_color,
|
||||
t1.velocidad_corte AS velocidad_corte, t1.precio_hora_corte AS precio_hora_corte,
|
||||
t1.forzar_num_formas_horizontales_cubierta AS forzar_num_formas_horizontales_cubierta,
|
||||
|
||||
@ -441,6 +441,21 @@ class PresupuestoService extends BaseService
|
||||
}
|
||||
}
|
||||
|
||||
public static function getHorasMaquina($totalClicks, $precioClick, $velocidadMaquina) {
|
||||
try {
|
||||
|
||||
if($precioClick>0 && $velocidadMaquina>0)
|
||||
$horas = (1.0*$totalClicks/$precioClick)/$velocidadMaquina/60.0;
|
||||
else
|
||||
$horas = 0;
|
||||
|
||||
return $horas;
|
||||
|
||||
} catch (Exception $e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Devuelve la dimensión del lomo interior.
|
||||
|
||||
@ -178,6 +178,18 @@
|
||||
editor.on( 'postSubmit', function ( e, json, data, action ) {
|
||||
|
||||
yeniden(json.<?= csrf_token() ?>);
|
||||
|
||||
const domain = window.location.origin
|
||||
fetch(domain + "/clientes/clienteprecios/update/" + -1 , {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
plantilla_id: id,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
}),
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8"
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
editor.on( 'submitSuccess', function ( e, json, data, action ) {
|
||||
|
||||
@ -269,14 +269,14 @@
|
||||
<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;"><?= lang('Presupuestos.pliegosPedido') ?></th>
|
||||
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.precioPliego') ?></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;"><?= lang('Presupuestos.totalPapelPedido') ?></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;"><?= lang('Presupuestos.click') ?></th>
|
||||
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.totalClicks') ?></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>
|
||||
@ -334,8 +334,8 @@
|
||||
<th style="padding-right: 0.75em;"><?= 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;"><?= lang('Presupuestos.click') ?></th>
|
||||
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.totalClicks') ?></th>
|
||||
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.horas') ?></th>
|
||||
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.precioImpresion') ?></th>
|
||||
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.precioPagNegro') ?></th>
|
||||
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.precioPagColor') ?></th>
|
||||
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.totalTinta') ?></th>
|
||||
@ -388,14 +388,14 @@
|
||||
<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;"><?= lang('Presupuestos.pliegosPedido') ?></th>
|
||||
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.precioPliego') ?></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;"><?= lang('Presupuestos.totalPapelPedido') ?></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;"><?= lang('Presupuestos.click') ?></th>
|
||||
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.totalClicks') ?></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>
|
||||
@ -694,8 +694,8 @@
|
||||
{ 'data': 'totalPapelPedido' },
|
||||
{ 'data': 'lomo' },
|
||||
{ 'data': 'peso' },
|
||||
{ 'data': 'click' },
|
||||
{ 'data': 'totalClicks' },
|
||||
{ 'data': 'horasMaquina' },
|
||||
{ 'data': 'precioImpresion' },
|
||||
{ 'data': 'total' },
|
||||
{ 'data': 'maquinaId'},
|
||||
{ 'data': 'maquinaVelocidad'},
|
||||
@ -752,8 +752,8 @@
|
||||
{ 'data': 'totalPapelPedido' },
|
||||
{ 'data': 'lomo' },
|
||||
{ 'data': 'peso' },
|
||||
{ 'data': 'click' },
|
||||
{ 'data': 'totalClicks' },
|
||||
{ 'data': 'horasMaquina' },
|
||||
{ 'data': 'precioImpresion' },
|
||||
{ 'data': 'precioPagNegro' },
|
||||
{ 'data': 'precioPagColor' },
|
||||
{ 'data': 'totalTinta' },
|
||||
@ -808,8 +808,8 @@
|
||||
{ 'data': 'totalPapelPedido' },
|
||||
{ 'data': 'lomo' },
|
||||
{ 'data': 'peso' },
|
||||
{ 'data': 'click' },
|
||||
{ 'data': 'totalClicks' },
|
||||
{ 'data': 'horasMaquina' },
|
||||
{ 'data': 'precioImpresion' },
|
||||
{ 'data': 'total' },
|
||||
{ 'data': 'maquinaId'},
|
||||
{ 'data': 'maquinaVelocidad'},
|
||||
@ -845,6 +845,7 @@
|
||||
papel_generico_id: $(''+ elementos.papel).select2('data')[0].id,
|
||||
papel_generico: $(''+ elementos.papel).select2('data')[0].text.trim(),
|
||||
gramaje: $(''+ elementos.gramaje).select2('data')[0].text.trim() ,
|
||||
cliente_id: $('#clienteId').find(":selected").val(),
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
|
||||
@ -857,7 +858,7 @@
|
||||
clearIntLineas(is_color);
|
||||
|
||||
if(data.lineas.length >0){
|
||||
|
||||
|
||||
fillIntPlana(data, is_color, is_hq);
|
||||
selectIntLineas();
|
||||
$('#title_int_plana').html('<?= lang("Presupuestos.compInteriorPlana") ?>' + ' (' + tableCompIntPlana.rows().count() + ')');
|
||||
@ -922,6 +923,7 @@
|
||||
papel_generico_id: $('#compPapelNegro').select2('data')[0].id,
|
||||
papel_generico: $('#compPapelNegro').select2('data')[0].text.trim(),
|
||||
gramaje: $('#compGramajeNegro').select2('data')[0].text.trim() ,
|
||||
cliente_id: $('#clienteId').find(":selected").val(),
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
|
||||
@ -998,6 +1000,7 @@
|
||||
papel_generico_id: $('#compPapelCubierta').select2('data')[0].id,
|
||||
papel_generico: $('#compPapelCubierta').select2('data')[0].text.trim(),
|
||||
gramaje: $('#compGramajeCubierta').select2('data')[0].text.trim() ,
|
||||
cliente_id: $('#clienteId').find(":selected").val(),
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
|
||||
@ -1010,7 +1013,7 @@
|
||||
clearCubierta();
|
||||
|
||||
if(data.lineas.length >0){
|
||||
|
||||
|
||||
fillCubierta(data);
|
||||
selectCubiertaLineas();
|
||||
$('#title_cubierta').html('<?= lang("Presupuestos.cubierta") ?>' + ' (' + tableCompCubierta.rows().count() + ')');
|
||||
|
||||
@ -1042,6 +1042,7 @@ $('.insertarLinea').on("click", function (e) {
|
||||
clear_rotativa();
|
||||
|
||||
var rows = $("#tableCompIntPlana").DataTable().rows( '.selected' ).data().toArray();
|
||||
|
||||
for(row of rows){
|
||||
if(row['tipo'] =='bn'){
|
||||
fill_lp_bn(row, true);
|
||||
@ -1313,6 +1314,7 @@ function calcularPresupuesto_bn(){
|
||||
papel_generico_id: $('#lp_bn_papel option:selected').val() ,
|
||||
papel_generico: $('#lp_bn_papel option:selected').text().trim(),
|
||||
gramaje: $('#lp_bn_gramaje option:selected').text().trim(),
|
||||
cliente_id: $('#clienteId').find(":selected").val(),
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
|
||||
@ -1553,6 +1555,7 @@ function calcularPresupuesto_color(){
|
||||
papel_generico_id: $('#lp_color_papel option:selected').val() ,
|
||||
papel_generico: $('#lp_color_papel option:selected').text().trim(),
|
||||
gramaje: $('#lp_color_gramaje option:selected').text().trim(),
|
||||
cliente_id: $('#clienteId').find(":selected").val(),
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
|
||||
@ -1790,6 +1793,7 @@ function calcularPresupuesto_bnhq(){
|
||||
papel_generico_id: $('#lp_bnhq_papel option:selected').val() ,
|
||||
papel_generico: $('#lp_bnhq_papel option:selected').text().trim(),
|
||||
gramaje: $('#lp_bnhq_gramaje option:selected').text().trim(),
|
||||
cliente_id: $('#clienteId').find(":selected").val(),
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
|
||||
@ -2029,6 +2033,7 @@ function calcularPresupuesto_colorhq(){
|
||||
papel_generico_id: $('#lp_colorhq_papel option:selected').val() ,
|
||||
papel_generico: $('#lp_colorhq_papel option:selected').text().trim(),
|
||||
gramaje: $('#lp_colorhq_gramaje option:selected').text().trim(),
|
||||
cliente_id: $('#clienteId').find(":selected").val(),
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
|
||||
@ -2285,6 +2290,7 @@ function calcularPresupuesto_rot_bn(fromComparador=false, updatedTipologias=fals
|
||||
papel_generico_id: $('#lp_rot_bn_papel option:selected').val() ,
|
||||
papel_generico: $('#lp_rot_bn_papel option:selected').text().trim(),
|
||||
gramaje: $('#lp_rot_bn_gramaje option:selected').text().trim(),
|
||||
cliente_id: $('#clienteId').find(":selected").val(),
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
|
||||
@ -2634,6 +2640,7 @@ function calcularPresupuesto_rot_color(fromComparador=false, updatedTipologias=f
|
||||
papel_generico_id: $('#lp_rot_color_papel option:selected').val() ,
|
||||
papel_generico: $('#lp_rot_color_papel option:selected').text().trim(),
|
||||
gramaje: $('#lp_rot_color_gramaje option:selected').text().trim(),
|
||||
cliente_id: $('#clienteId').find(":selected").val(),
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
|
||||
@ -2993,6 +3000,7 @@ function calcularPresupuesto_cubierta(fromComparador=false, updatedTipologias=fa
|
||||
papel_generico_id: $('#lp_cubierta_papel option:selected').val() ,
|
||||
papel_generico: $('#lp_cubierta_papel option:selected').text().trim(),
|
||||
gramaje: $('#lp_cubierta_gramaje option:selected').text().trim(),
|
||||
cliente_id: $('#clienteId').find(":selected").val(),
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
}
|
||||
|
||||
|
||||
@ -112,6 +112,10 @@ $('.accordion-button').on('click', function (e) {
|
||||
*******************************/
|
||||
function getRowFromLineaInt(tipo, linea) {
|
||||
|
||||
$precio_impresion = isNaN(parseFloat(linea.fields.precio_impresion_horas + linea.fields.margen_impresion_horas)) ? "" :
|
||||
parseFloat(linea.fields.precio_impresion_horas + linea.fields.margen_impresion_horas).toFixed(2);
|
||||
|
||||
|
||||
return {
|
||||
'tipo': tipo,
|
||||
'paginas': linea.fields.paginas,
|
||||
@ -126,10 +130,10 @@ function getRowFromLineaInt(tipo, linea) {
|
||||
'totalPapelPedido': isNaN(parseFloat(linea.fields.precio_pedido)) ? "" : parseFloat(linea.fields.precio_pedido).toFixed(2),
|
||||
'lomo': isNaN(parseFloat(linea.fields.mano)) ? "" : parseFloat(linea.fields.mano).toFixed(2),
|
||||
'peso': isNaN(parseFloat(linea.fields.peso)) ? "" : parseFloat(linea.fields.peso).toFixed(2),
|
||||
'click': isNaN(parseFloat(linea.fields.precio_click)) ? "" : parseFloat(linea.fields.precio_click).toFixed(6),
|
||||
'totalClicks': isNaN(parseFloat(linea.fields.precio_click_pedido)) ? "" : parseFloat(linea.fields.precio_click_pedido).toFixed(2),
|
||||
'total': isNaN(parseFloat(linea.fields.precio_pedido) + parseFloat(linea.fields.precio_click_pedido)) ?
|
||||
"" : (parseFloat(linea.fields.precio_pedido) + parseFloat(linea.fields.precio_click_pedido)).toFixed(2),
|
||||
'horasMaquina': isNaN(parseFloat(linea.fields.horas_maquina)) ? "" : parseFloat(linea.fields.horas_maquina).toFixed(2),
|
||||
'precioImpresion': $precio_impresion,
|
||||
'total': isNaN(parseFloat(linea.fields.precio_pedido) + parseFloat($precio_impresion)) ?
|
||||
"" : (parseFloat(linea.fields.precio_pedido) + parseFloat($precio_impresion)).toFixed(2),
|
||||
'maquinaId': linea.fields.maquina_id,
|
||||
'maquinaVelocidad': linea.fields.maquina_velocidad,
|
||||
'tiempoMaquina': linea.fields.tiempo_maquina,
|
||||
@ -141,6 +145,9 @@ function getRowFromLineaInt(tipo, linea) {
|
||||
|
||||
function getRowFromLineaRot(linea) {
|
||||
|
||||
$precio_impresion = isNaN(parseFloat(linea.fields.precio_impresion_horas + linea.fields.margen_impresion_horas)) ? "" :
|
||||
parseFloat(linea.fields.precio_impresion_horas + linea.fields.margen_impresion_horas).toFixed(2);
|
||||
|
||||
return {
|
||||
'tipo': 'rotativa',
|
||||
'paginas': linea.fields.paginas,
|
||||
@ -156,8 +163,8 @@ function getRowFromLineaRot(linea) {
|
||||
'totalPapelPedido': isNaN(parseFloat(linea.fields.precio_pedido)) ? "" : parseFloat(linea.fields.precio_pedido).toFixed(2),
|
||||
'lomo': isNaN(parseFloat(linea.fields.mano)) ? "" : parseFloat(linea.fields.mano).toFixed(2),
|
||||
'peso': isNaN(parseFloat(linea.fields.peso)) ? "" : parseFloat(linea.fields.peso).toFixed(2),
|
||||
'click': isNaN(parseFloat(linea.fields.precio_click)) ? "" : parseFloat(linea.fields.precio_click).toFixed(6),
|
||||
'totalClicks': isNaN(parseFloat(linea.fields.precio_click_pedido)) ? "" : parseFloat(linea.fields.precio_click_pedido).toFixed(2),
|
||||
'horasMaquina': isNaN(parseFloat(linea.fields.horas_maquina)) ? "" : parseFloat(linea.fields.horas_maquina).toFixed(2),
|
||||
'precioImpresion': $precio_impresion,
|
||||
'precioPagNegro': isNaN(parseFloat(linea.fields.precio_pagina_negro)) ? "" : parseFloat(linea.fields.precio_pagina_negro).toFixed(6),
|
||||
'precioPagColor': isNaN(parseFloat(linea.fields.precio_pagina_color)) ? "" : parseFloat(linea.fields.precio_pagina_color).toFixed(6),
|
||||
'totalTinta': isNaN(parseFloat(linea.fields.precio_tinta)) ? "" : parseFloat(linea.fields.precio_tinta).toFixed(2),
|
||||
|
||||
@ -457,7 +457,7 @@ function getVisibleTabs() {
|
||||
|
||||
$("#tableLineasPresupuesto tbody tr:visible").each(function () {
|
||||
|
||||
console.log($(this).attr('id'));
|
||||
//console.log($(this).attr('id'));
|
||||
if ($(this).attr('id').indexOf('cubierta') > -1) {
|
||||
$("#" + $(this).attr('id').replace('lp_', 'tab-pv-')).show();
|
||||
$("#" + $(this).attr('id').replace('lp_', 'tab-pv-esquema-')).show();
|
||||
|
||||
Reference in New Issue
Block a user