mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
acabados todos los servicios de presupuesto
This commit is contained in:
@ -50,7 +50,9 @@ class Presupuestoacabados extends \App\Controllers\GoBaseResourceController
|
||||
$this->model->deleteAllServicios($requestedId);
|
||||
}
|
||||
|
||||
$this->model->updateTarifas($requestedId, $postData->datos);
|
||||
if(count($tarifas)>0){
|
||||
$this->model->updateTarifas($requestedId, $postData->datos);
|
||||
}
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
@ -61,6 +63,36 @@ class Presupuestoacabados extends \App\Controllers\GoBaseResourceController
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
public function update($requestedId = null)
|
||||
{
|
||||
|
||||
if ($requestedId == null) :
|
||||
return;
|
||||
endif;
|
||||
|
||||
$postData = $this->request->getJSON();
|
||||
$tarifas = array_column($postData->datos, 'tarifa_id');
|
||||
$tirada = $postData->tirada ?? 0;
|
||||
$POD = $postData->POD ?? 0;
|
||||
$result = [];
|
||||
|
||||
if(count($tarifas)>0){
|
||||
foreach ($tarifas as $tarifa){
|
||||
$values = $this->model->getPrecioTarifa($tarifa, $tirada, $POD);
|
||||
array_push($result, $values);
|
||||
}
|
||||
}
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'lines' => $result,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
@ -48,7 +48,9 @@ class Presupuestoencuadernaciones extends \App\Controllers\GoBaseResourceControl
|
||||
$this->model->deleteAllServicios($requestedId);
|
||||
}
|
||||
|
||||
$this->model->updateTarifas($requestedId, $postData->datos);
|
||||
if(count($tarifas)>0){
|
||||
$this->model->updateTarifas($requestedId, $postData->datos);
|
||||
}
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
@ -59,6 +61,44 @@ class Presupuestoencuadernaciones extends \App\Controllers\GoBaseResourceControl
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
public function update($requestedId = null)
|
||||
{
|
||||
$tarifaModel = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
||||
|
||||
if ($requestedId == null) :
|
||||
return;
|
||||
endif;
|
||||
|
||||
$postData = $this->request->getJSON();
|
||||
$tarifas = array_column($postData->datos, 'tarifa_id');
|
||||
$tirada = $postData->tirada ?? 0;
|
||||
$paginas = $postData->paginas ?? 0;
|
||||
$POD = $postData->POD ?? 0;
|
||||
$ancho = $postData->ancho ?? 0;
|
||||
$alto = $postData->alto ?? 0;
|
||||
$result = [];
|
||||
|
||||
if(count($tarifas)>0){
|
||||
foreach ($tarifas as $tarifa){
|
||||
if($tarifaModel->isTarifaPorHoras($tarifa)){
|
||||
$values = $this->model->getPrecioTarifaHoras($tarifa, $paginas, $tirada, -1, $POD);
|
||||
}else{
|
||||
$values = $this->model->getPrecioTarifa($tarifa, $paginas, $tirada, $ancho, $alto, -1, $POD);
|
||||
}
|
||||
array_push($result, $values);
|
||||
}
|
||||
}
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'lines' => $result,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
|
||||
@ -42,6 +42,7 @@ class Presupuestomanipulados extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
$postData = $this->request->getJSON();
|
||||
$tarifas = array_column($postData->datos, 'tarifa_id');
|
||||
|
||||
if(count($tarifas)>0){
|
||||
$this->model->deleteServiciosNotInArray($requestedId, $tarifas);
|
||||
}
|
||||
@ -49,7 +50,9 @@ class Presupuestomanipulados extends \App\Controllers\GoBaseResourceController
|
||||
$this->model->deleteAllServicios($requestedId);
|
||||
}
|
||||
|
||||
$this->model->updateTarifas($requestedId, $postData->datos);
|
||||
if(count($tarifas)>0){
|
||||
$this->model->updateTarifas($requestedId, $postData->datos);
|
||||
}
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
@ -60,6 +63,37 @@ class Presupuestomanipulados extends \App\Controllers\GoBaseResourceController
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
public function update($requestedId = null)
|
||||
{
|
||||
|
||||
if ($requestedId == null) :
|
||||
return;
|
||||
endif;
|
||||
|
||||
$postData = $this->request->getJSON();
|
||||
$tarifas = array_column($postData->datos, 'tarifa_id');
|
||||
$tirada = $postData->tirada ?? 0;
|
||||
$POD = $postData->POD ?? 0;
|
||||
$result = [];
|
||||
|
||||
if(count($tarifas)>0){
|
||||
foreach ($tarifas as $tarifa){
|
||||
$values = $this->model->getPrecioTarifa($tarifa, $tirada, $POD);
|
||||
array_push($result, $values);
|
||||
}
|
||||
}
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'lines' => $result,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
@ -45,7 +45,9 @@ class Presupuestopreimpresiones extends \App\Controllers\GoBaseResourceControlle
|
||||
$this->model->deleteAllServicios($requestedId);
|
||||
}
|
||||
|
||||
$this->model->updateTarifas($requestedId, $postData->datos);
|
||||
if(count($tarifas)>0){
|
||||
$this->model->updateTarifas($requestedId, $postData->datos);
|
||||
}
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
@ -17,8 +17,9 @@ class Test extends BaseController
|
||||
|
||||
public function index()
|
||||
{
|
||||
$model = model('App\Models\Tarifas\TarifaManipuladoModel');
|
||||
echo '<pre>';
|
||||
var_dump($this->get_precio_tarifa_acabado(1, 200, 30));
|
||||
var_dump($model->getTarifaPresupuestoManipulado(21, 200));
|
||||
echo '</pre>';
|
||||
}
|
||||
|
||||
|
||||
@ -192,7 +192,8 @@ return [
|
||||
'dimension' => 'La dimensión del libro tiene que ser mayor que 60mm',
|
||||
'lineaDuplicada' => 'Ya existe ese tipo de linea en el presupuesto',
|
||||
'errorRotColor' => 'Papeles y gramajes deben ser iguales en color y BN',
|
||||
'error_servicios_anadidos' => 'Hay servicios sin datos'
|
||||
'error_servicios_anadidos' => 'Hay servicios sin datos',
|
||||
'error_servicios_duplicados' => 'El servicio seleccionado ya está añadido'
|
||||
],
|
||||
|
||||
|
||||
|
||||
@ -108,6 +108,7 @@ class PresupuestoPreimpresionesModel extends \App\Models\GoBaseModel
|
||||
$builder->where('tarifa_preimpresion_id', $tarifa->tarifa_id);
|
||||
$result = $builder->get()->getResultObject();
|
||||
if(count($result)>0){
|
||||
|
||||
$this->db
|
||||
->table($this->table . " t1")
|
||||
->where('presupuesto_id', $presupuesto_id)
|
||||
|
||||
@ -156,7 +156,7 @@ class TarifaEncuadernacionModel extends \App\Models\GoBaseModel
|
||||
|
||||
$builder->where('t1.id =', $tarifa_id);
|
||||
$builder->where('t2.tirada_min <=', $tirada);
|
||||
$builder->where('t2.tirada_max >', $tirada);
|
||||
$builder->where('t2.tirada_max >=', $tirada);
|
||||
$builder->where('t3.paginas_libro_min <=', $paginas);
|
||||
$builder->where('t3.paginas_libro_max >', $paginas);
|
||||
$builder->where('t4.ancho_min <=', $ancho);
|
||||
|
||||
@ -126,7 +126,7 @@ class TarifaManipuladoModel extends \App\Models\GoBaseModel
|
||||
|
||||
$builder->where('t1.id =', $tarifa_id);
|
||||
$builder->where('t2.tirada_min <=', $tirada);
|
||||
$builder->where('t2.tirada_max >', $tirada);
|
||||
$builder->where('t2.tirada_max >=', $tirada);
|
||||
|
||||
return $builder->get()->getResultObject();
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ class TarifaacabadoModel extends \App\Models\GoBaseModel
|
||||
|
||||
$builder->where('t1.id =', $tarifa_id);
|
||||
$builder->where('t2.tirada_min <=', $tirada);
|
||||
$builder->where('t2.tirada_max >', $tirada);
|
||||
$builder->where('t2.tirada_max >=', $tirada);
|
||||
|
||||
return $builder->get()->getResultObject();
|
||||
}
|
||||
|
||||
@ -271,6 +271,29 @@
|
||||
<!-- Código JS comportamiento general pag. -->
|
||||
<!------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
$('#paginas').on("change", function () {
|
||||
// Si es negro o color
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'negro' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'color') {
|
||||
document.getElementById('compPaginasNegro').value = document.getElementById('paginas').value;
|
||||
document.getElementById('compPaginasColor').value = 0;
|
||||
}
|
||||
// Si es negrohq o colorhq
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'negrohq' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'colorhq') {
|
||||
document.getElementById('compPaginasNegrohq').value = document.getElementById('paginas').value;
|
||||
document.getElementById('compPaginasColorhq').value = 0;
|
||||
}
|
||||
|
||||
update_servicios()
|
||||
});
|
||||
|
||||
$('#tirada').on("change", function () {
|
||||
|
||||
update_servicios()
|
||||
})
|
||||
|
||||
$('#papelFormatoId').select2({
|
||||
allowClear: false,
|
||||
});
|
||||
|
||||
@ -311,7 +311,7 @@
|
||||
fetch(domain + "/presupuestos/presupuestomanipulados/edit/" + id , {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
datos: datosAcabado,
|
||||
datos: datosManipulado,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
}),
|
||||
headers: {
|
||||
@ -327,7 +327,7 @@
|
||||
fetch(domain + "/presupuestos/presupuestoacabados/edit/" + id , {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
datos: datosManipulado,
|
||||
datos: datosAcabado,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
}),
|
||||
headers: {
|
||||
@ -355,7 +355,94 @@
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
function update_servicios(){
|
||||
const domain = window.location.origin
|
||||
const dimension = getDimensionLibro();
|
||||
|
||||
if(parseInt($('#tirada').val())>0){
|
||||
var tirada = parseInt($('#tirada').val())
|
||||
}
|
||||
else{
|
||||
var tirada = 0
|
||||
}
|
||||
var paginas = parseInt($('#paginas').val())>0?parseInt($('#paginas').val()):0
|
||||
|
||||
var datosAcabado = get_datos_acabado()
|
||||
var datosEnc = get_datos_encuadernacion()
|
||||
var datosManipulado = get_datos_manipulado()
|
||||
var datosPreimpresion = get_datos_preimpresion()
|
||||
|
||||
fetch(domain + "/presupuestos/presupuestoacabados/update/" + id , {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
datos: datosAcabado,
|
||||
tirada: tirada,
|
||||
POD: POD,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
}),
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8"
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
data.lines.forEach((line) => {
|
||||
$('#precio_unidad_acabado_' + line[0].tarifa_id).text(parseFloat(line[0].precio_unidad).toFixed(2))
|
||||
$('#precio_total_acabado_' + line[0].tarifa_id).val(parseFloat(line[0].total).toFixed(2))
|
||||
});
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
}).then(
|
||||
fetch(domain + "/presupuestos/presupuestoencuadernaciones/update/" + id , {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
datos: datosEnc,
|
||||
tirada: tirada,
|
||||
paginas: paginas,
|
||||
ancho: dimension.ancho,
|
||||
alto: dimension.alto,
|
||||
POD: POD,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
}),
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8"
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
data.lines.forEach((line) => {
|
||||
$('#proveedor_enc_' + line[0].tarifa_id).off('change')
|
||||
$('#proveedor_enc_' + line[0].tarifa_id).val(line[0].proveedor_id)
|
||||
$('#precio_unidad_encuadernado_' + line[0].tarifa_id).text(parseFloat(line[0].precio_unidad).toFixed(2))
|
||||
$('#precio_total_encuadernado_' + line[0].tarifa_id).val(parseFloat(line[0].total).toFixed(2))
|
||||
$('#proveedor_enc_' + line[0].tarifa_id).on('change', proveedor_enc_event)
|
||||
});
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
}).then(
|
||||
fetch(domain + "/presupuestos/presupuestomanipulados/update/" + id , {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
datos: datosManipulado,
|
||||
tirada: tirada,
|
||||
POD: POD,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
}),
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8"
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
data.lines.forEach((line) => {
|
||||
$('#precio_unidad_manipulado_' + line[0].tarifa_id).text(parseFloat(line[0].precio_unidad).toFixed(2))
|
||||
$('#precio_total_manipulado_' + line[0].tarifa_id).val(parseFloat(line[0].total).toFixed(2))
|
||||
});
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
@ -396,8 +483,8 @@
|
||||
tableServiciosAcabado.row.add([
|
||||
element.tarifa_acabado_id,
|
||||
element.nombre,
|
||||
'<span id="precio_unidad_' + element.tarifa_acabado_id + '">' + parseFloat(element.precio_unidad).toFixed(2) + '</span>',
|
||||
'<input id="precio_total_' + element.tarifa_acabado_id +'" value="' + parseFloat(element.precio_total).toFixed(2) + '"></input>',
|
||||
'<span id="precio_unidad_acabado_' + element.tarifa_acabado_id + '">' + parseFloat(element.precio_unidad).toFixed(2) + '</span>',
|
||||
'<input id="precio_total_acabado_' + element.tarifa_acabado_id +'" value="' + parseFloat(element.precio_total).toFixed(2) + '"></input>',
|
||||
'<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete-serv mx-2" data-id="' + element.tarifa_acabado_id +'"></i></a>'
|
||||
]).draw(false)
|
||||
|
||||
@ -453,8 +540,8 @@
|
||||
tableServiciosAcabado.row.add([
|
||||
row.tarifa_id,
|
||||
row.tarifa_nombre,
|
||||
'<span id="precio_unidad_' + row.tarifa_id + '">' + parseFloat(row.precio_unidad).toFixed(2) + '</span>',
|
||||
'<input id="precio_total_' + row.tarifa_id +'" value="' + parseFloat(row.total).toFixed(2) + '"></input>',
|
||||
'<span id="precio_unidad_acabado_' + row.tarifa_id + '">' + parseFloat(row.precio_unidad).toFixed(2) + '</span>',
|
||||
'<input id="precio_total_acabado_' + row.tarifa_id +'" value="' + parseFloat(row.total).toFixed(2) + '"></input>',
|
||||
'<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete-serv mx-2" data-id="' + row.tarifa_id +'"></i></a>'
|
||||
]).draw(false)
|
||||
});
|
||||
@ -477,7 +564,7 @@
|
||||
if($('#tableOfServiciosAcabado tr > td:contains(' + tarifa_text + ')').length == 0)
|
||||
get_tarifas_acabado($('#add_servicio_acabado_list').select2('data')[0].id);
|
||||
else{
|
||||
popErrorAlert("Ese servicio ya existe", 'serv-acabado-alert')
|
||||
popErrorAlert("<?= lang("Presupuestos.errores.error_servicios_duplicados") ?>", 'serv-acabado-alert')
|
||||
}
|
||||
}
|
||||
check_serv_acabado_error()
|
||||
@ -486,25 +573,27 @@
|
||||
function get_datos_acabado(){
|
||||
|
||||
var datosAcabado = []
|
||||
$("#tableOfServiciosAcabado tr").each(function (index,tr) {
|
||||
var values = {}
|
||||
$(this).find("td").each(function (index2) {
|
||||
|
||||
switch (index2) {
|
||||
case 0:
|
||||
values['tarifa_id'] = $(this).text()
|
||||
break
|
||||
case 2:
|
||||
values['precio_unidad'] = $(this).text()
|
||||
break
|
||||
case 3:
|
||||
values['precio_total'] = $(this).children(":first").val()
|
||||
break
|
||||
}
|
||||
if(tableServiciosAcabado.rows().count()>0){
|
||||
$("#tableOfServiciosAcabado tr").each(function (index,tr) {
|
||||
var values = {}
|
||||
$(this).find("td").each(function (index2) {
|
||||
|
||||
switch (index2) {
|
||||
case 0:
|
||||
values['tarifa_id'] = $(this).text()
|
||||
break
|
||||
case 2:
|
||||
values['precio_unidad'] = $(this).text()
|
||||
break
|
||||
case 3:
|
||||
values['precio_total'] = $(this).children(":first").val()
|
||||
break
|
||||
}
|
||||
})
|
||||
if(Object.keys(values).length>0)
|
||||
datosAcabado.push(values)
|
||||
})
|
||||
if(Object.keys(values).length>0)
|
||||
datosAcabado.push(values)
|
||||
})
|
||||
}
|
||||
|
||||
return datosAcabado
|
||||
}
|
||||
@ -555,8 +644,8 @@
|
||||
proveedor_nombre +
|
||||
'</option>' +
|
||||
'</select>',
|
||||
'<span id="precio_unidad_' + element.tarifa_encuadernado_id + '">' + parseFloat(element.precio_unidad).toFixed(2) + '</span>',
|
||||
'<input id="precio_total_' + element.tarifa_encuadernado_id +'" value="' + parseFloat(element.precio_total).toFixed(2) + '"></input>',
|
||||
'<span id="precio_unidad_encuadernado_' + element.tarifa_encuadernado_id + '">' + parseFloat(element.precio_unidad).toFixed(2) + '</span>',
|
||||
'<input id="precio_total_encuadernado_' + element.tarifa_encuadernado_id +'" value="' + parseFloat(element.precio_total).toFixed(2) + '"></input>',
|
||||
'<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete-serv mx-2" data-id="' + element.tarifa_encuadernado_id +'"></i></a>'
|
||||
]).draw(false)
|
||||
|
||||
@ -628,8 +717,8 @@
|
||||
data: datos,
|
||||
success: function (data) {
|
||||
|
||||
$('#precio_unidad_' + datos.tarifa_encuadernacion_id).text(parseFloat(data.values[0].precio_unidad).toFixed(2))
|
||||
$('#precio_total_' + datos.tarifa_encuadernacion_id).val(parseFloat(data.values[0].total).toFixed(2))
|
||||
$('#precio_unidad_encuadernado_' + datos.tarifa_encuadernacion_id).text(parseFloat(data.values[0].precio_unidad).toFixed(2))
|
||||
$('#precio_total_encuadernado_' + datos.tarifa_encuadernacion_id).val(parseFloat(data.values[0].total).toFixed(2))
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
return true;
|
||||
},
|
||||
@ -702,8 +791,8 @@
|
||||
row.proveedor +
|
||||
'</option>' +
|
||||
'</select>',
|
||||
'<span id="precio_unidad_' + row.tarifa_id + '">' + parseFloat(row.precio_unidad).toFixed(2) + '</span>',
|
||||
'<input id="precio_total_' + row.tarifa_id +'" value="' + parseFloat(row.total).toFixed(2) + '"></input>',
|
||||
'<span id="precio_unidad_encuadernado_' + row.tarifa_id + '">' + parseFloat(row.precio_unidad).toFixed(2) + '</span>',
|
||||
'<input id="precio_total_encuadernado_' + row.tarifa_id +'" value="' + parseFloat(row.total).toFixed(2) + '"></input>',
|
||||
'<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete-serv mx-2" data-id="' + row.tarifa_id +'"></i></a>'
|
||||
]).draw(false)
|
||||
|
||||
@ -772,7 +861,7 @@
|
||||
if($('#tableOfServiciosEncuadernacion tr > td:contains(' + tarifa_text + ')').length == 0)
|
||||
get_tarifas_enc('tarifa', $('#add_servicio_enc_list').select2('data')[0].id);
|
||||
else{
|
||||
popErrorAlert("Ese servicio ya existe", 'serv-enc-alert')
|
||||
popErrorAlert("<?= lang("Presupuestos.errores.error_servicios_duplicados") ?>", 'serv-enc-alert')
|
||||
}
|
||||
}
|
||||
check_serv_enc_error()
|
||||
@ -781,28 +870,30 @@
|
||||
function get_datos_encuadernacion(){
|
||||
|
||||
var datosEnc = []
|
||||
$("#tableOfServiciosEncuadernacion tr").each(function (index,tr) {
|
||||
var values = {}
|
||||
$(this).find("td").each(function (index2) {
|
||||
|
||||
switch (index2) {
|
||||
case 0:
|
||||
values['tarifa_id'] = $(this).text()
|
||||
break
|
||||
case 2:
|
||||
values['proveedor_id'] = $(this).children(":first").select2('data')[0].id
|
||||
break
|
||||
case 3:
|
||||
values['precio_unidad'] = $(this).text()
|
||||
break
|
||||
case 4:
|
||||
values['precio_total'] = $(this).children(":first").val()
|
||||
break
|
||||
}
|
||||
if(tableServiciosEnc.rows().count()>0){
|
||||
$("#tableOfServiciosEncuadernacion tr").each(function (index,tr) {
|
||||
var values = {}
|
||||
$(this).find("td").each(function (index2) {
|
||||
|
||||
switch (index2) {
|
||||
case 0:
|
||||
values['tarifa_id'] = $(this).text()
|
||||
break
|
||||
case 2:
|
||||
values['proveedor_id'] = $(this).children(":first").select2('data')[0].id
|
||||
break
|
||||
case 3:
|
||||
values['precio_unidad'] = $(this).text()
|
||||
break
|
||||
case 4:
|
||||
values['precio_total'] = $(this).children(":first").val()
|
||||
break
|
||||
}
|
||||
})
|
||||
if(Object.keys(values).length>0)
|
||||
datosEnc.push(values)
|
||||
})
|
||||
if(Object.keys(values).length>0)
|
||||
datosEnc.push(values)
|
||||
})
|
||||
}
|
||||
|
||||
return datosEnc
|
||||
}
|
||||
@ -845,8 +936,8 @@
|
||||
tableServiciosManipulado.row.add([
|
||||
element.tarifa_manipulado_id,
|
||||
element.nombre,
|
||||
'<span id="precio_unidad_' + element.tarifa_manipulado_id + '">' + parseFloat(element.precio_unidad).toFixed(2) + '</span>',
|
||||
'<input id="precio_total_' + element.tarifa_manipulado_id +'" value="' + parseFloat(element.precio_total).toFixed(2) + '"></input>',
|
||||
'<span id="precio_unidad_manipulado_' + element.tarifa_manipulado_id + '">' + parseFloat(element.precio_unidad).toFixed(2) + '</span>',
|
||||
'<input id="precio_total_manipulado_' + element.tarifa_manipulado_id +'" value="' + parseFloat(element.precio_total).toFixed(2) + '"></input>',
|
||||
'<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete-serv mx-2" data-id="' + element.tarifa_manipulado_id +'"></i></a>'
|
||||
]).draw(false)
|
||||
|
||||
@ -902,8 +993,8 @@
|
||||
tableServiciosManipulado.row.add([
|
||||
row.tarifa_id,
|
||||
row.tarifa_nombre,
|
||||
'<span id="precio_unidad_' + row.tarifa_id + '">' + parseFloat(row.precio_unidad).toFixed(2) + '</span>',
|
||||
'<input id="precio_total_' + row.tarifa_id +'" value="' + parseFloat(row.total).toFixed(2) + '"></input>',
|
||||
'<span id="precio_unidad_manipulado_' + row.tarifa_id + '">' + parseFloat(row.precio_unidad).toFixed(2) + '</span>',
|
||||
'<input id="precio_total_manipulado_' + row.tarifa_id +'" value="' + parseFloat(row.total).toFixed(2) + '"></input>',
|
||||
'<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete-serv mx-2" data-id="' + row.tarifa_id +'"></i></a>'
|
||||
]).draw(false)
|
||||
});
|
||||
@ -926,7 +1017,7 @@
|
||||
if($('#tableOfServiciosManipulado tr > td:contains(' + tarifa_text + ')').length == 0)
|
||||
get_tarifas_manipulado($('#add_servicio_manipulado_list').select2('data')[0].id);
|
||||
else{
|
||||
popErrorAlert("Ese servicio ya existe", 'serv-manipulado-alert')
|
||||
popErrorAlert("<?= lang("Presupuestos.errores.error_servicios_duplicados") ?>", 'serv-manipulado-alert')
|
||||
}
|
||||
}
|
||||
check_serv_manipulado_error()
|
||||
@ -935,25 +1026,28 @@
|
||||
function get_datos_manipulado(){
|
||||
|
||||
var datosManipulado = []
|
||||
$("#tableOfServiciosManipulado tr").each(function (index,tr) {
|
||||
var values = {}
|
||||
$(this).find("td").each(function (index2) {
|
||||
|
||||
switch (index2) {
|
||||
case 0:
|
||||
values['tarifa_id'] = $(this).text()
|
||||
break
|
||||
case 2:
|
||||
values['precio_unidad'] = $(this).text()
|
||||
break
|
||||
case 3:
|
||||
values['precio_total'] = $(this).children(":first").val()
|
||||
break
|
||||
}
|
||||
if(tableServiciosManipulado.rows().count()>0){
|
||||
|
||||
$("#tableOfServiciosManipulado tr").each(function (index,tr) {
|
||||
var values = {}
|
||||
$(this).find("td").each(function (index2) {
|
||||
|
||||
switch (index2) {
|
||||
case 0:
|
||||
values['tarifa_id'] = $(this).text()
|
||||
break
|
||||
case 2:
|
||||
values['precio_unidad'] = $(this).text()
|
||||
break
|
||||
case 3:
|
||||
values['precio_total'] = $(this).children(":first").val()
|
||||
break
|
||||
}
|
||||
})
|
||||
if(Object.keys(values).length>0)
|
||||
datosManipulado.push(values)
|
||||
})
|
||||
if(Object.keys(values).length>0)
|
||||
datosManipulado.push(values)
|
||||
})
|
||||
}
|
||||
|
||||
return datosManipulado
|
||||
}
|
||||
@ -996,7 +1090,7 @@
|
||||
tableServiciosPreimpresion.row.add([
|
||||
element.tarifa_preimpresion_id,
|
||||
element.nombre,
|
||||
'<input id="precio_' + element.tarifa_preimpresion_id +'" value="' + parseFloat(element.precio).toFixed(2) + '"></input>',
|
||||
'<input id="precio_preimpresion' + element.tarifa_preimpresion_id +'" value="' + parseFloat(element.precio).toFixed(2) + '"></input>',
|
||||
'<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete-serv mx-2" data-id="' + element.tarifa_preimpresion_id +'"></i></a>'
|
||||
]).draw(false)
|
||||
|
||||
@ -1044,7 +1138,7 @@
|
||||
tableServiciosPreimpresion.row.add([
|
||||
row.tarifa_id,
|
||||
row.tarifa_nombre,
|
||||
'<input id="precio_' + row.tarifa_id +'" value="' + parseFloat(row.precio).toFixed(2) + '"></input>',
|
||||
'<input id="precio_preimpresion' + row.tarifa_id +'" value="' + parseFloat(row.precio).toFixed(2) + '"></input>',
|
||||
'<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete-serv mx-2" data-id="' + row.tarifa_id +'"></i></a>'
|
||||
]).draw(false)
|
||||
});
|
||||
@ -1067,7 +1161,7 @@
|
||||
if($('#tableOfServiciosPreimpresion tr > td:contains(' + tarifa_text + ')').length == 0)
|
||||
get_tarifas_preimpresion($('#add_servicio_preimpresion_list').select2('data')[0].id);
|
||||
else{
|
||||
popErrorAlert("Ese servicio ya existe", 'serv-preimpresion-alert')
|
||||
popErrorAlert("<?= lang("Presupuestos.errores.error_servicios_duplicados") ?>", 'serv-preimpresion-alert')
|
||||
}
|
||||
}
|
||||
check_serv_preimpresion_error()
|
||||
@ -1076,22 +1170,25 @@
|
||||
function get_datos_preimpresion(){
|
||||
|
||||
var datosPreimpresion = []
|
||||
$("#tableOfServiciosPreimpresion tr").each(function (index,tr) {
|
||||
var values = {}
|
||||
$(this).find("td").each(function (index2) {
|
||||
|
||||
switch (index2) {
|
||||
case 0:
|
||||
values['tarifa_id'] = $(this).text()
|
||||
break
|
||||
case 2:
|
||||
values['precio_total'] = $(this).children(":first").val()
|
||||
break
|
||||
}
|
||||
if(tableServiciosPreimpresion.rows().count()>0){
|
||||
|
||||
$("#tableOfServiciosPreimpresion tr").each(function (index,tr) {
|
||||
var values = {}
|
||||
$(this).find("td").each(function (index2) {
|
||||
|
||||
switch (index2) {
|
||||
case 0:
|
||||
values['tarifa_id'] = $(this).text()
|
||||
break
|
||||
case 2:
|
||||
values['precio'] = $(this).children(":first").val()
|
||||
break
|
||||
}
|
||||
})
|
||||
if(Object.keys(values).length>0)
|
||||
datosPreimpresion.push(values)
|
||||
})
|
||||
if(Object.keys(values).length>0)
|
||||
datosPreimpresion.push(values)
|
||||
})
|
||||
}
|
||||
|
||||
return datosPreimpresion
|
||||
}
|
||||
|
||||
@ -71,22 +71,6 @@ $('#compPaginasColorhq').on("change", function () {
|
||||
}
|
||||
});
|
||||
|
||||
$('#paginas').on("change", function () {
|
||||
// Si es negro o color
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'negro' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'color') {
|
||||
document.getElementById('compPaginasNegro').value = document.getElementById('paginas').value;
|
||||
document.getElementById('compPaginasColor').value = 0;
|
||||
}
|
||||
// Si es negrohq o colorhq
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'negrohq' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'colorhq') {
|
||||
document.getElementById('compPaginasNegrohq').value = document.getElementById('paginas').value;
|
||||
document.getElementById('compPaginasColorhq').value = 0;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#compRetractilado').on("change", function () {
|
||||
checkRetractiladoComparador(this);
|
||||
|
||||
Reference in New Issue
Block a user