<?php
include_once('../../../php/sessionStart.php');
include_once('../../../php/db/dbExec.php');
include_once('../../../php/functions.php');
include_once('../../../php/timezone.php');
include_once('../../../php/privileges.php');

$bitForm = "inv2130";
$bitMod = "inv";
$empCod = $_SESSION['empCod'];
$usuCod = utf8_decode($_SESSION['usuCod']);
$usuNom = utf8_decode($_SESSION['usuNom']);

switch ($_POST['action']) {

	case 'consultarSubdep':
		echo consultarSubdep();
		break;
}

function consultarSubdep() {
	global $empCod;
	$selDepto=utf8_decode($_POST['selDepto']);
	# QUERYS
	$sSubdep = "SELECT *, TRIM(sdep_cod) AS sdep_cod,TRIM(sdep_nom) AS sdep_nom FROM subdeptosi where sdep_dep='$selDepto' ORDER BY sdep_nom";

	# EJECUCION DE QUERYS
	$db = new dbExec();
	$resp["subdeptosi"] = $db->sFetchAll($sSubdep);
	$db->close();

	$func = new functions();

	return $func->jsonEncodeArray($resp, "subdeptosi");
}

?>