"SELECT ac_id FROM cac_actividad WHERE ac_codigo = TO_NUMBER(:codigo)"; return ValorSql($sql, 0, $params, 0); } } validarSesion(isset($_SESSION["isAgenteComercial"])); SetNumberFormatOracle(); $curs = null; $params = array(":naumento" => zeroIfEmpty(str_replace(",", ".", $_REQUEST["a"])), ":ncanttrabajador" => $_REQUEST["ct"], ":ndescuento" => 0, ":nidciiu" => getIdActividad($_REQUEST["c"]), ":nmasasalarial" => str_replace(",", ".", $_REQUEST["ms"])); $sql = "BEGIN webart.get_valor_online(:nidciiu, :nmasasalarial, :ncanttrabajador, :ndescuento, :naumento, :data); END;"; $stmt = DBExecSP($conn, $curs, $sql, $params); $row = DBGetSP($curs); ?> <script type="text/javascript"> with (window.parent.document) { getElementById('alicuotasFijo').value = '<?php echo str_replace(",", ".", $row["SUMAFIJA"]); ?> '; getElementById('alicuotasMasaSalarial').value = '<?php echo str_replace(",", ".", $row["PORCVARIABLE"]); ?> ';
function setCampanaF931() { global $conn; $curs = null; $params = array(":naumento" => 0, ":ncanttrabajador" => intval($_POST["totalTrabajadores"]), ":ndescuento" => 0, ":nidciiu" => nullIfCero(getIdActividad($_POST["ciiu1"])), ":nmasasalarial" => floatval($_POST["masaSalarialSinSac"])); $sql = "BEGIN webart.get_valor_online(:nidciiu, :nmasasalarial, :ncanttrabajador, :ndescuento, :naumento, :data); END;"; $stmt = DBExecSP($conn, $curs, $sql, $params, true, 0); $row = DBGetSP($curs); if (floatval($row["SUMAFIJA"]) < 0.6) $row["SUMAFIJA"] = 0.6; $curs2 = null; $params2 = array(":naumento" => 121, ":ncanttrabajador" => intval($_POST["totalTrabajadores"]), ":ndescuento" => 0, ":nidciiu" => nullIfCero(getIdActividad($_POST["ciiu1"])), ":nmasasalarial" => floatval($_POST["masaSalarialSinSac"])); $sql2 = "BEGIN webart.get_valor_online(:nidciiu, :nmasasalarial, :ncanttrabajador, :ndescuento, :naumento, :data); END;"; $stmt2 = DBExecSP($conn, $curs2, $sql2, $params2, true, 0); $row2 = DBGetSP($curs2); $params = array("identidad" => $_SESSION["entidad"]); $sql = "SELECT ca_descuento FROM afi.aca_campania931 WHERE ca_identidad = :identidad AND SYSDATE < ca_fechahasta AND ca_fechabaja IS NULL"; ?> <script src="/js/validations.js" type="text/javascript"></script> <script src="/modules/solicitud_cotizacion/js/cotizacion.js" type="text/javascript"></script> <script type="text/javascript"> alert('Por favor, indique la Alícuota FINAL.'); // Deshabilito todos los campos, porque ya presionó el botón "Obtener Cotización".. window.parent.lockControls(true, true); with (window.parent.document) { mostrarBotonGuardar(window.parent.document); // Muestro los objetos relacionados con la campaña F931.. getElementById('campanaF931').value = 'N'; getElementById('spanAlicuotaF931').innerHTML = 'Alícuota F931 <?php echo ValorSql($sql, "", $params, 0); ?> % Descuento'; getElementById('porcVarTarifario').value = (<?php echo $row["PORCVARIABLE"]; ?> ).toFixed(3); getElementById('porcVarF931').value = <?php echo (floatval($_POST["calculoVariable"]) * (floatval($_POST["masaSalarialSinSac"]) / intval($_POST["totalTrabajadores"])) + (floatval($_POST["calculoSumaFija"]) - 0.6)) / (floatval($_POST["masaSalarialSinSac"]) / intval($_POST["totalTrabajadores"])); ?> ; getElementById('porcVarF931').value = (getElementById('porcVarF931').value * (1 - (<?php echo ValorSql($sql, "", $params, 0); ?> / 100))).toFixed(3); if (Number(getElementById('porcVarTarifario').value * 0.3) > Number(getElementById('porcVarF931').value)) getElementById('porcVarF931').value = Number(getElementById('porcVarTarifario').value * 0.3).toFixed(3); getElementById('porcVarDescuento').value = (<?php echo $row["PORCVARIABLE"]; ?> * (1 - (25 / 100))).toFixed(3); // getElementById('porcVarAumento').value = (<?php echo $row["PORCVARIABLE"]; ?> * (1 + (80 / 100))).toFixed(3); getElementById('porcVarAumento').value = (<?php echo $row2["PORCVARIABLE"]; ?> ).toFixed(3); getElementById('costoFinalTarifario').value = (<?php echo $row["COSTOCAPITAS"]; ?> ).toFixed(2); getElementById('costoMensualTarifario').value = (<?php echo $row["COSTOMENSUAL"]; ?> ).toFixed(0); getElementById('costoAnualTarifario').value = (<?php echo $row["COSTOANUAL"]; ?> ).toFixed(0); getElementById('costoFinalF931').value = ((getElementById('porcVarF931').value /100) * <?php echo floatval($_POST["masaSalarialSinSac"]); ?> / <?php echo intval($_POST["totalTrabajadores"]); ?> + 0.6).toFixed(2); getElementById('costoMensualF931').value = (((getElementById('porcVarF931').value / 100) * <?php echo floatval($_POST["masaSalarialSinSac"]); ?> ) + 0.6 * <?php echo intval($_POST["totalTrabajadores"]); ?> ).toFixed(0); getElementById('costoAnualF931').value = (((getElementById('porcVarF931').value / 100) * <?php echo floatval($_POST["masaSalarialSinSac"]); ?> * 13) + 0.6 * <?php echo intval($_POST["totalTrabajadores"]); ?> * 12).toFixed(0); getElementById('costoFinalDescuento').value = ((getElementById('porcVarDescuento').value /100) * <?php echo floatval($_POST["masaSalarialSinSac"]); ?> / <?php echo intval($_POST["totalTrabajadores"]); ?> + 0.6).toFixed(2); getElementById('costoMensualDescuento').value = (((getElementById('porcVarDescuento').value / 100) * <?php echo floatval($_POST["masaSalarialSinSac"]); ?> ) + 0.6 * <?php echo intval($_POST["totalTrabajadores"]); ?> ).toFixed(0); getElementById('costoAnualDescuento').value = (((getElementById('porcVarDescuento').value / 100) * <?php echo floatval($_POST["masaSalarialSinSac"]); ?> * 13) + 0.6 * <?php echo intval($_POST["totalTrabajadores"]); ?> * 12).toFixed(0); getElementById('costoFinalAumento').value = ((getElementById('porcVarAumento').value / 100) * <?php echo floatval($_POST["masaSalarialSinSac"]); ?> / <?php echo intval($_POST["totalTrabajadores"]); ?> + 0.6).toFixed(2); getElementById('costoMensualAumento').value = (((getElementById('porcVarAumento').value / 100) * <?php echo floatval($_POST["masaSalarialSinSac"]); ?> ) + 0.6 * <?php echo intval($_POST["totalTrabajadores"]); ?> ).toFixed(0); getElementById('costoAnualAumento').value = (((getElementById('porcVarAumento').value / 100) * <?php echo floatval($_POST["masaSalarialSinSac"]); ?> * 13) + 0.6 * <?php echo intval($_POST["totalTrabajadores"]); ?> * 12).toFixed(0); <? $params = array(":canttrabajador" => intval($_POST["totalTrabajadores"]), ":cuit" => $_POST["cuit"], ":idactividad" => nullIfCero(getIdActividad($_POST["ciiu1"])), ":usuario" => "W_".$_SESSION["usuario"]); $sql = "SELECT cotizacion.get_descuento(:cuit, :canttrabajador, :idactividad, :usuario) FROM DUAL"; ?> getElementById('descuentoTopeF931').value = <?php echo ValorSql($sql, 0, $params, 0); ?> ; getElementById('spanAlicuotaDescuento').innerHTML = 'Alícuota ' + getElementById('descuentoTopeF931').value + '% Descuento'; if (getElementById('descuentoTopeF931').value > 0) getElementById('trDescuento').style.display = 'block'; else getElementById('trDescuento').style.display = 'none'; <? $params = array(":emplecoti" => intval($_POST["totalTrabajadores"]), ":idactividad" => nullIfCero(getIdActividad($_POST["ciiu1"])), ":masacoti" => floatval($_POST["masaSalarialSinSac"]), ":porcvariable" => floatval($row["PORCVARIABLE"]), ":sumafija" => floatval($row["SUMAFIJA"]), ":usuario" => "W_".$_SESSION["usuario"]); $sql = "SELECT art.cotizacion.get_aumento(:idactividad, :masacoti, :emplecoti, :sumafija, :porcvariable, :usuario) FROM DUAL"; ?> getElementById('aumentoTopeF931').value = <?php echo ValorSql($sql, 0, $params, 0); ?> ; // getElementById('spanAlicuotaAumento').innerHTML = 'Alícuota ' + getElementById('aumentoTopeF931').value + '% Aumento'; if (getElementById('aumentoTopeF931').value > 0) getElementById('trAumento').style.display = 'block'; else getElementById('trAumento').style.display = 'none'; getElementById('spanTopesAlicuotaFinal').innerHTML = '(Entre ' + getTopeMinimoF931() + '% y ' + getTopeMaximoF931() + '%)'; getElementById('sumaFijaF931').value = (<?php echo $row["SUMAFIJA"]; ?> ).toFixed(2); // edSumaAseguradaRCF931.Value := 0; // edAlicuotaVariableRCF931.Value := 0; // edMasaSalarialRCF931.Value := floatval($_POST["masaSalarialSinSac"]); // edCuotaInicialRCF931.Value := 0; getElementById('tableCampanaF931').style.display = 'block'; getElementById('aumento').value = 0; getElementById('descuento').value = 0; getElementById('alicuotaFinalF931').focus(); } </script> <? }
function setCampanaF931() { global $conn; $curs = null; $params = array(":naumento" => 0, ":ncanttrabajador" => intval($_POST["totalTrabajadores"]), ":ndescuento" => 0, ":nidciiu" => nullIfCero(getIdActividad($_POST["ciiu1"])), ":nmasasalarial" => floatval($_POST["masaSalarialSinSac"])); $sql = "BEGIN webart.get_valor_online(:nidciiu, :nmasasalarial, :ncanttrabajador, :ndescuento, :naumento, :data); END;"; $stmt = DBExecSP($conn, $curs, $sql, $params, true, 0); $row = DBGetSP($curs); if (floatval($row["SUMAFIJA"]) < 0.6) $row["SUMAFIJA"] = 0.6; $curs2 = null; $params2 = array(":naumento" => 121, ":ncanttrabajador" => intval($_POST["totalTrabajadores"]), ":ndescuento" => 0, ":nidciiu" => nullIfCero(getIdActividad($_POST["ciiu1"])), ":nmasasalarial" => floatval($_POST["masaSalarialSinSac"])); $sql2 = "BEGIN webart.get_valor_online(:nidciiu, :nmasasalarial, :ncanttrabajador, :ndescuento, :naumento, :data); END;"; $stmt2 = DBExecSP($conn, $curs2, $sql2, $params2, true, 0); $row2 = DBGetSP($curs2); // Traigo los límites de la SSN.. $params3 = array(":idactividad" => getIdActividad($_POST["ciiu1"])); $sql3 = "SELECT ls_minimo minimo, ls_maximo maximo FROM als_limitessn WHERE ls_idactividad IN(SELECT ac_id FROM cac_actividad WHERE ac_codigo = SUBSTR(art.hys.get_codactividadrevdos(:idactividad), 1, 1)) AND ls_fechadesde <= SYSDATE AND ls_fechahasta >= SYSDATE AND ls_fechabaja IS NULL"; $stmt3 = DBExecSql($conn, $sql3, $params3, OCI_DEFAULT); $row3 = DBGetQuery($stmt3); if ($row3["MINIMO"] == "") $row3["MINIMO"] = 0; if ($row3["MAXIMO"] == "") $row3["MAXIMO"] = 0; $params = array("identidad" => $_SESSION["entidad"], "idSucursal" => $_SESSION["sucursal"]); $sql = "SELECT ca_descuento FROM afi.aca_campania931 WHERE ca_identidad = :identidad AND SYSDATE < ca_fechahasta AND ca_fechabaja IS NULL AND NOT EXISTS (SELECT 1 FROM comercial.cse_sucursalexcluidof931 WHERE se_identidad = ca_identidad AND se_idsucursal = :idSucursal)"; ?> <script src="/js/validations.js" type="text/javascript"></script> <script src="/modules/solicitud_cotizacion/js/cotizacion.js" type="text/javascript"></script> <script type="text/javascript"> alert('Por favor, indique la Alícuota FINAL.'); // Deshabilito todos los campos, porque ya presionó el botón "Obtener Cotización".. window.parent.lockControls(true, true); with (window.parent.document) { mostrarBotonGuardar(window.parent.document); var minimoSSN = <?php echo $row3["MINIMO"]; ?> ; var maximoSSN = <?php echo $row3["MAXIMO"]; ?> ; // Muestro los objetos relacionados con la campaña F931.. getElementById('campanaF931').value = 'N'; getElementById('spanAlicuotaF931').innerHTML = 'Alícuota F931 <?php echo ValorSql($sql, "", $params, 0); ?> % Descuento'; getElementById('porcVarTarifario').value = (<?php echo $row["PORCVARIABLE"]; ?> ).toFixed(3); getElementById('porcVarF931').value = <?php echo (floatval($_POST["calculoVariable"]) * (floatval($_POST["masaSalarialSinSac"]) / intval($_POST["totalTrabajadores"])) + (floatval($_POST["calculoSumaFija"]) - 0.6)) / (floatval($_POST["masaSalarialSinSac"]) / intval($_POST["totalTrabajadores"])); ?> ; getElementById('porcVarF931').value = (getElementById('porcVarF931').value * (1 - (<?php echo ValorSql($sql, "0", $params, 0); ?> / 100))).toFixed(3); if (Number(getElementById('porcVarTarifario').value * 0.3) > Number(getElementById('porcVarF931').value)) getElementById('porcVarF931').value = Number(getElementById('porcVarTarifario').value * 0.3).toFixed(3); // No dejo que el porcentaje variable del F931 pase los límites de la SSN.. if ((minimoSSN == 0) && (maximoSSN == 0)) throw new Error('No se encontraron los límites ante la SSN.'); if (Number(getElementById('porcVarF931').value) < minimoSSN) getElementById('porcVarF931').value = minimoSSN; if (Number(getElementById('porcVarF931').value) > maximoSSN) getElementById('porcVarF931').value = maximoSSN; getElementById('porcVarDescuento').value = (<?php echo $row["PORCVARIABLE"]; ?> * (1 - (25 / 100))).toFixed(3); // getElementById('porcVarAumento').value = (<?php echo $row["PORCVARIABLE"]; ?> * (1 + (80 / 100))).toFixed(3); getElementById('porcVarAumento').value = (<?php echo $row2["PORCVARIABLE"]; ?> ).toFixed(3); getElementById('costoFinalTarifario').value = (<?php echo $row["COSTOCAPITAS"]; ?> ).toFixed(2); getElementById('costoMensualTarifario').value = (<?php echo $row["COSTOMENSUAL"]; ?> ).toFixed(0); getElementById('costoAnualTarifario').value = (<?php echo $row["COSTOANUAL"]; ?> ).toFixed(0); getElementById('costoFinalF931').value = ((getElementById('porcVarF931').value /100) * <?php echo floatval($_POST["masaSalarialSinSac"]); ?> / <?php echo intval($_POST["totalTrabajadores"]); ?> + 0.6).toFixed(2); getElementById('costoMensualF931').value = (((getElementById('porcVarF931').value / 100) * <?php echo floatval($_POST["masaSalarialSinSac"]); ?> ) + 0.6 * <?php echo intval($_POST["totalTrabajadores"]); ?> ).toFixed(0); getElementById('costoAnualF931').value = (((getElementById('porcVarF931').value / 100) * <?php echo floatval($_POST["masaSalarialSinSac"]); ?> * 13) + 0.6 * <?php echo intval($_POST["totalTrabajadores"]); ?> * 12).toFixed(0); getElementById('costoFinalDescuento').value = ((getElementById('porcVarDescuento').value /100) * <?php echo floatval($_POST["masaSalarialSinSac"]); ?> / <?php echo intval($_POST["totalTrabajadores"]); ?> + 0.6).toFixed(2); getElementById('costoMensualDescuento').value = (((getElementById('porcVarDescuento').value / 100) * <?php echo floatval($_POST["masaSalarialSinSac"]); ?> ) + 0.6 * <?php echo intval($_POST["totalTrabajadores"]); ?> ).toFixed(0); getElementById('costoAnualDescuento').value = (((getElementById('porcVarDescuento').value / 100) * <?php echo floatval($_POST["masaSalarialSinSac"]); ?> * 13) + 0.6 * <?php echo intval($_POST["totalTrabajadores"]); ?> * 12).toFixed(0); getElementById('costoFinalAumento').value = ((getElementById('porcVarAumento').value / 100) * <?php echo floatval($_POST["masaSalarialSinSac"]); ?> / <?php echo intval($_POST["totalTrabajadores"]); ?> + 0.6).toFixed(2); getElementById('costoMensualAumento').value = (((getElementById('porcVarAumento').value / 100) * <?php echo floatval($_POST["masaSalarialSinSac"]); ?> ) + 0.6 * <?php echo intval($_POST["totalTrabajadores"]); ?> ).toFixed(0); getElementById('costoAnualAumento').value = (((getElementById('porcVarAumento').value / 100) * <?php echo floatval($_POST["masaSalarialSinSac"]); ?> * 13) + 0.6 * <?php echo intval($_POST["totalTrabajadores"]); ?> * 12).toFixed(0); <? $params = array(":canttrabajador" => intval($_POST["totalTrabajadores"]), ":cuit" => $_POST["cuit"], ":idactividad" => nullIfCero(getIdActividad($_POST["ciiu1"])), ":usuario" => "W_".$_SESSION["usuario"]); $sql = "SELECT cotizacion.get_descuento(:cuit, :canttrabajador, :idactividad, :usuario) FROM DUAL"; ?> getElementById('descuentoTopeF931').value = <?php echo ValorSql($sql, 0, $params, 0); ?> ; getElementById('spanAlicuotaDescuento').innerHTML = 'Alícuota ' + getElementById('descuentoTopeF931').value + '% Descuento'; if (getElementById('descuentoTopeF931').value > 0) getElementById('trDescuento').style.display = 'block'; else getElementById('trDescuento').style.display = 'none'; <? $params = array(":emplecoti" => intval($_POST["totalTrabajadores"]), ":idactividad" => nullIfCero(getIdActividad($_POST["ciiu1"])), ":masacoti" => floatval($_POST["masaSalarialSinSac"]), ":porcvariable" => floatval($row["PORCVARIABLE"]), ":sumafija" => floatval($row["SUMAFIJA"]), ":usuario" => "W_".$_SESSION["usuario"]); $sql = "SELECT art.cotizacion.get_aumento(:idactividad, :masacoti, :emplecoti, :sumafija, :porcvariable, :usuario) FROM DUAL"; ?> getElementById('aumentoTopeF931').value = <?php echo ValorSql($sql, 0, $params, 0); ?> ; // getElementById('spanAlicuotaAumento').innerHTML = 'Alícuota ' + getElementById('aumentoTopeF931').value + '% Aumento'; if (getElementById('aumentoTopeF931').value > 0) getElementById('trAumento').style.display = 'block'; else getElementById('trAumento').style.display = 'none'; getElementById('spanTopesAlicuotaFinal').innerHTML = '(Entre ' + getTopeMinimoF931() + '% y ' + getTopeMaximoF931() + '%)'; getElementById('sumaFijaF931').value = (<?php echo $row["SUMAFIJA"]; ?> ).toFixed(2); // edSumaAseguradaRCF931.Value := 0; // edAlicuotaVariableRCF931.Value := 0; // edMasaSalarialRCF931.Value := floatval($_POST["masaSalarialSinSac"]); // edCuotaInicialRCF931.Value := 0; getElementById('tableCampanaF931').style.display = 'block'; getElementById('aumento').value = 0; getElementById('descuento').value = 0; getElementById('alicuotaFinalF931').focus(); } </script> <? }
":cpostal" => $_POST["codigoPostal"], ":cpostalpost" => $_POST["codigoPostal"], ":datosempleadormanual" => nullIsEmpty($datosEmpleadorManual), ":departamento" => $_POST["oficina"], ":departamentopost" => $_POST["oficina"], ":direlectronicacont" => $_POST["emailResponsable"], ":direlectronicatitular" => $_POST["emailTitular"], ":documentotitular" => intval($_POST["dniTitular"]), ":establecimientos" => nullIfCero($_POST["establecimientos"]), ":fechaafiliacion" => $_POST["fechaSuscripcion"], ":fecharecepcion" => $_POST["fechaSuscripcion"], ":fechavigenciadesde" => $_POST["fechaVigenciaDesde"], ":fechavigenciahasta" => $_POST["fechaVigenciaHasta"], ":feinicactiv" => $_POST["fechaInicioActividad"], ":formaj" => nullIfCero($_POST["formaJuridicaTmp"]), ":idactividad" => getIdActividad($_POST["ciiu"]), ":identidadvendedor" => nullIfCero($idEntidadVendedor), ":idvendedor" => nullIfCero($idVendedor), ":localidad" => $_POST["localidad"], ":localidadpost" => $_POST["localidad"], ":lugarsuscripcion" => $_POST["lugarSuscripcion"], ":maillegal" => $_POST["email"], ":mailpostal" => $_POST["email"], ":masatotal" => formatFloat($_POST["trabajadoresMasaSalarial"]), ":nivel" => $_POST["nivel"], ":nombre" => substr($_POST["razonSocial"], 0, 60), ":nombrevendedor" => $_POST["nombreComercializador"], ":numero" => $_POST["numero"], ":numeropost" => $_POST["numero"], ":observaciones" => substr($_POST["observaciones"], 0, 250), ":piso" => $_POST["piso"],