";
print "location.href='../sigesp_inicio_sesion.php'";
print "";
}
$ls_logusr=$_SESSION["la_logusr"];
require_once("class_folder/class_funciones_viaticos.php");
$io_fun_viaticos=new class_funciones_viaticos();
$io_fun_viaticos->uf_load_seguridad("SCV","sigesp_scv_d_regiones.php",$ls_permisos,$la_seguridad,$la_permisos);
////////////////////////////////////////////// SEGURIDAD /////////////////////////////////////////////
?>
Definición de Regiones
uf_conectar();
require_once("../shared/class_folder/class_sql.php");
$io_sql= new class_sql($conn);
require_once("../shared/class_folder/class_funciones.php");
$io_funcion= new class_funciones();
require_once("../shared/class_folder/class_funciones_db.php");
$io_funciondb= new class_funciones_db($conn);
require_once("../shared/class_folder/class_mensajes.php");
$io_msg= new class_mensajes();
require_once("../shared/class_folder/grid_param.php");
$io_grid= new grid_param();
require_once("../shared/class_folder/class_datastore.php");
$io_ds= new class_datastore();
$io_dsdoc= new class_datastore();
require_once("class_folder/sigesp_scv_c_regiones.php");
$io_region= new sigesp_scv_c_regiones($conn);
$lb_existe= "";
global $object;
$ls_operacion= $io_fun_viaticos->uf_obteneroperacion();
$ls_codreg= $io_fun_viaticos->uf_obtenervalor("txtcodreg","");
$ls_denreg= $io_fun_viaticos->uf_obtenervalor("txtdenreg","");
$li_lastrow= $io_fun_viaticos->uf_obtenervalor("lastrow",0);
$total= $io_fun_viaticos->uf_obtenervalor("hidtotrows","");
$ls_estatus= $io_fun_viaticos->uf_obtenervalor("hidestatus","NUEVO");
$ls_codpais= $io_fun_viaticos->uf_obtenervalor("cmbpais","---");
$ls_existe= $io_fun_viaticos->uf_obtenervalor("existe","FALSE");
$ls_codemp= $_SESSION["la_empresa"]["codemp"];
//Titulos de la tabla de Detalle Estados.
$title[1]="Código";
$title[2]="Denominación";
$title[3]="";
$grid="grid";
////////////Fin de la Tabla//////////////.
switch ($ls_operacion)
{
case "NUEVO":
$lb_empresa = true;
if($ls_codpais!="---")
{
$ls_codreg = $io_region->uf_generar_codigo($lb_empresa,$ls_codemp,'scv_regiones','codreg',$ls_codpais);
if (empty($ls_codreg))
{
$io_msg->message($io_funciondb->is_msg_error);
}
}
$ls_denreg= "";
$li_lastrow= 0;
$object[1][1]="";
$object[1][2]="";
$object[1][3]="
";
$li_totrows = 1;
break;
case "PINTAR":
$li_lastrow = $_POST["hidlastrow"];
$li_totrows = $_POST["hidtotrows"];
for ($li_i=1;$li_i<=$li_totrows;$li_i++)
{
if (array_key_exists("txtcodest".$li_i,$_POST))
{
$ls_codest = $_POST["txtcodest".$li_i];
$ls_denest = $_POST["txtdenest".$li_i];
$object[$li_i][1]="";
$object[$li_i][2]="";
$object[$li_i][3]="
";
}
else
{
$object[$li_i][1]="";
$object[$li_i][2]="";
$object[$li_i][3]="
";
}
}
break;
case "GUARDAR":
$li_total = 0;
$li_lastrow = $_POST["hidlastrow"];
empty($lr_grid);
for ($li_i=1;$li_i<=$li_lastrow;$li_i++)
{
$ls_codest= $_POST["txtcodest".$li_i];
$lr_grid["estado"][$li_i]= $ls_codest;
$li_total++;
}
//$lb_existe = $io_region->uf_load_region($ls_codemp,$ls_codpais,$ls_codreg);
if ($ls_existe=="TRUE")
{
if ($ls_estatus=="NUEVO")
{
$io_msg->message("El Código de Región ya existe");
$lb_valido=false;
}
elseif($ls_estatus=="GRABADO")
{
$lb_valido = $io_region->uf_update_region($ls_codemp,$ls_codreg,$ls_codpais,$ls_denreg,$lr_grid,$li_total,$la_seguridad);
if ($lb_valido)
{
$io_msg->message("La Región ha sido actualizada");
$lb_empresa=true;
$ls_codreg="";
$ls_denreg="";
$ls_estatus="NUEVO";
}
else
{
$io_msg->message("No se pudo actualizar la Región");
}
}
}
else
{
$lb_valido = $io_region->uf_insert_region($ls_codemp,$ls_codreg,$ls_codpais,$ls_denreg,$lr_grid,$li_total,$la_seguridad);
if ($lb_valido)
{
$io_msg->message("La región ha sido incluida");
$ls_denreg="";
$ls_estatus= "NUEVO";
$lb_empresa= true;
$ls_codpais= '---';
$ls_codreg="";
}
else
{
$io_msg->message("No se pudo incluir la Región");
}
}
$object[1][1]="";
$object[1][2]="";
$object[1][3]="
";
$li_totrows= 1;
$li_lastrow= 0;
break;
case "CARGAR":
$lb_valido = $io_region->uf_load_dt_region($ls_codemp,$ls_codreg,$ls_codpais);
if ($lb_valido)
{
$li_total= $io_region->ds_dtregion->getRowCount('codest');
$li_lastrow= $li_total;
$li_totrows= intval($li_lastrow)+1;
for ($li_i=1;$li_i<=$li_total;$li_i++)
{
$ls_codest = $io_region->ds_dtregion->getValue('codest',$li_i);
$ls_denest = $io_region->ds_dtregion->getValue('desest',$li_i);
$object[$li_i][1]="";
$object[$li_i][2]="";
$object[$li_i][3]="
";
}
$object[$li_i][1]="";
$object[$li_i][2]="";
$object[$li_i][3]="
";
}
break;
case "DELETEROW":
$li_lastrow= $_POST["hidlastrow"];
$li_totrows= $_POST["hidtotrows"];
$li_rowdel= $_POST["filadel"];
$li_temp= 0;
for ($li_i=1;$li_i<=$li_totrows;$li_i++)
{
if ($li_i!=$li_rowdel)
{
$li_temp = $li_temp+1;
$ls_codest = $_POST["txtcodest".$li_i];
$ls_denest = $_POST["txtdenest".$li_i];
$object[$li_temp][1]="";
$object[$li_temp][2]="";
$object[$li_temp][3]="
";
}
else
{
$li_rowdelete=0;
}
}
$li_totrows = intval($li_totrows)-1;
$li_lastrow = intval($li_lastrow)-1;
break;
case "ELIMINAR":
$lb_existe = $io_region->uf_load_region($ls_codemp,$ls_codpais,$ls_codreg);
if ($lb_existe)
{
$lb_valido=$io_region->uf_delete_region($ls_codemp,$ls_codpais,$ls_codreg,$la_seguridad);
if ($lb_valido)
{
$io_msg->message("La Región ha sido eliminada");
$lb_empresa=true;
$ls_codreg="";
$ls_denreg="";
$ls_codpais = '---';
$ls_estatus="NUEVO";
}
else
{
$io_msg->message("No se pudo eliminar la Región");
$ls_codpais = '---';
$ls_denreg="";
$ls_codreg="";
}
}
else
{
$io_msg->message("El Registro No Existe");
}
$total=0;
$li_lastrow=0;
for ($li_i=1;$li_i<=1;$li_i++)
{
$object[$li_i][1]="";
$object[$li_i][2]="";
$object[$li_i][3]="
";
}
$li_totrows=1;
break;
}
?>