<!DOCTYPE html>
<html lang="es-ES">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Configuraci&oacute;n de Par&aacute;metros</title>
<link href="../../maincss.css" rel="stylesheet" type="text/css" />
<link href="../../printcss.css" rel="stylesheet" type="text/css" media="print" />
</head>
<?php
include "../../conn.php";
include "../../general.php";
include "../../token.php";

$rep=$_GET["rep"];
$tipo=$_GET["tipo"];
$modulos=$_POST["modulos"];
//$usuario=$_POST["usuario"];

$editable0 = '<img src="../../Images/gpg.png" />';
$editable1 = '<img src="../../Images/clean.png" />';
//user=Luigi

?>
<body>

<?php

//Inicio reporte configuracion de parametros
if($rep == 9 && $tipo == 1) { // if 2
	
// Inicio area Administracion, Region
//configuracion Canal
$result_canal = mysqli_query($link, "select pkyChannel as cod_canal, fldName as canal, txtDescription as descripcion, sysEditable as editable
from agnChannel
where 
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_canal = array();
while ($row = mysqli_fetch_array($result_canal)) {
	$matriz_canal [$i][1] = $row['cod_canal'];
	$matriz_canal [$i][2] = $row['canal'];
	$matriz_canal [$i][3] = $row['descripcion'];
	$matriz_canal [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_canal);
$fin_canal = $i - 1;

//configuracion Rubro
$result_rubro = mysqli_query($link, "select pkyCompanyHeading as cod_rubro, fldName as rubro, txtDescription as descripcion, sysEditable as editable
from agnCompanyHeading
where 
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_rubro = array();
while ($row = mysqli_fetch_array($result_rubro)) {
	$matriz_rubro [$i][1] = $row['cod_rubro'];
	$matriz_rubro [$i][2] = $row['rubro'];
	$matriz_rubro [$i][3] = $row['descripcion'];
	$matriz_rubro [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_rubro);
$fin_rubro = $i - 1;

//configuracion Titulo
$result_titulo = mysqli_query($link, "select pkyTitle as cod_titulo, fldName as titulo, txtDescription as descripcion, sysEditable as editable
from agnTitle
where 
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_titulo = array();
while ($row = mysqli_fetch_array($result_titulo)) {
	$matriz_titulo [$i][1] = $row['cod_titulo'];
	$matriz_titulo [$i][2] = $row['titulo'];
	$matriz_titulo [$i][3] = $row['descripcion'];
	$matriz_titulo [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_titulo);
$fin_titulo = $i - 1;

//Recursos humanos
//configuracion Bono de Antiguedad
$result_ant = mysqli_query($link, "select pkySeniorityBonus as ano_ini, fldEndYear as ano_fin, fldPercent as incremento, sysEditable as editable
from hrsSeniorityBonus
where 
sysEnabled = 1 and sysAuthorized = 1 
order by pkySeniorityBonus;");
$i = 1;
$matriz_ant = array();
while ($row = mysqli_fetch_array($result_ant)) {
	$matriz_ant [$i][1] = $row['ano_ini'];
	$matriz_ant [$i][2] = $row['ano_fin'];
	$matriz_ant [$i][3] = $row['incremento'];
	$matriz_ant [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_ant);
$fin_ant = $i - 1;

//configuracion Cargo
$result_cargo = mysqli_query($link, "select pkyJob as cod_cargo, fldName as cargo, txtDescription as descripcion, sysEditable as editable
from hrsJob
where 
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_cargo = array();
while ($row = mysqli_fetch_array($result_cargo)) {
	$matriz_cargo [$i][1] = $row['cod_cargo'];
	$matriz_cargo [$i][2] = $row['cargo'];
	$matriz_cargo [$i][3] = $row['descripcion'];
	$matriz_cargo [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_cargo);
$fin_cargo = $i - 1;

//configuracion Concepto de bono o descuento
$result_bono = mysqli_query($link, "select a.pkyBonusDiscountConcept as cod_bono, a.fldName as bono, a.codAccount as cod_cta, b.fldName as cuenta, a.fldIsFixed as modalidad, a.fldIsDiscount as tipo, a.sysEditable as editable
from hrsBonusDiscountConcept a, actAccount b
where 
a.codAccount = b.pkyAccount and 
a.sysEnabled = 1 and a.sysAuthorized = 1 
order by a.fldName;");
$i = 1;
$matriz_bono = array();
while ($row = mysqli_fetch_array($result_bono)) {
	$matriz_bono [$i][1] = $row['cod_bono'];
	$matriz_bono [$i][2] = $row['bono'];
	$matriz_bono [$i][3] = $row['cod_cta'];
	$matriz_bono [$i][4] = $row['cuenta'];
	if($row['modalidad'] == 0) {
		$matriz_bono [$i][5] = 'Variable';
	} else {
		$matriz_bono [$i][5] = 'Fijo';
	}
	if($row['tipo'] == 0) {
		$matriz_bono [$i][6] = 'Bono';
	} else {
		$matriz_bono [$i][6] = 'Descuento';
	}
	$matriz_bono [$i][7] = $row['editable'];
	$i++;
}
mysqli_free_result($result_bono);
$fin_bono = $i - 1;

//configuracion Concepto de Planillas
$result_planilla = mysqli_query($link, "select pkyPayrollConcept as cod_planilla, fldName as planilla, txtDescription as descripcion, sysEditable as editable
from hrsPayrollConcept
where 
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_planilla = array();
while ($row = mysqli_fetch_array($result_planilla)) {
	$matriz_planilla [$i][1] = $row['cod_planilla'];
	$matriz_planilla [$i][2] = $row['planilla'];
	$matriz_planilla [$i][3] = $row['descripcion'];
	$matriz_planilla [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_planilla);
$fin_planilla = $i - 1;

//configuracion Descuentos Fijos
$result_desc = mysqli_query($link, "select a.pkyFixedDiscounts as cod_desc, a.codPaymentConcept as cod_cxp, b.fldName as concepto_cxp, a.codPayrollConcept as cod_base, b.fldName as base, a.codCompany as cod_emp, d.fldName as empresa, a.fldName as descuento, a.fldIsFixed as tipo, a.fldAmount as monto, a.fldNonTaxableMin as monto_no_imp, a.sysEditable as editable
from hrsFixedDiscounts a, payAccountsPayableConcept b, hrsPayrollConcept c, agnCompany d
where 
a.codPaymentConcept = b.pkyAccountsPayableConcept and 
a.codPayrollConcept = c.pkyPayrollConcept and 
a.codCompany = d.pkyCompany and 
a.sysEnabled = 1 and a.sysAuthorized = 1 
order by a.fldName;");
$i = 1;
$matriz_desc = array();
while ($row = mysqli_fetch_array($result_desc)) {
	$matriz_desc [$i][1] = $row['cod_desc'];
	$matriz_desc [$i][2] = $row['descuento'];
	$matriz_desc [$i][3] = $row['concepto_cxp'];
	$matriz_desc [$i][4] = $row['base'];
	$matriz_desc [$i][5] = $row['empresa'];
	if($row['tipo'] == 0) {
		$matriz_desc [$i][6] = 'Porcentaje';
	} else {
		$matriz_desc [$i][6] = 'Fijo';
	}
	$matriz_desc [$i][7] = $row['monto'];
	$matriz_desc [$i][8] = $row['monto_no_imp'];
	$matriz_desc [$i][9] = $row['editable'];
	$i++;
}
mysqli_free_result($result_desc);
$fin_desc = $i - 1;

//configuracion Profesion
$result_prof = mysqli_query($link, "select pkyProfession as cod_profesion, fldName as profesion, txtDescription as descripcion, sysEditable as editable
from hrsProfession
where 
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_prof = array();
while ($row = mysqli_fetch_array($result_prof)) {
	$matriz_prof [$i][1] = $row['cod_profesion'];
	$matriz_prof [$i][2] = $row['profesion'];
	$matriz_prof [$i][3] = $row['descripcion'];
	$matriz_prof [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_prof);
$fin_prof = $i - 1;

//configuracion Tiempo de Vacacion
$result_tiem_vaca = mysqli_query($link, "select pkyVacationTime as cod_tiempo_vaca, fldName as tiempo_vaca, sysEditable as editable
from hrsVacationTime
where 
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_tiem_vaca = array();
while ($row = mysqli_fetch_array($result_tiem_vaca)) {
	$matriz_tiem_vaca [$i][1] = $row['cod_tiempo_vaca'];
	$matriz_tiem_vaca [$i][2] = $row['tiempo_vaca'];
	$matriz_tiem_vaca [$i][3] = $row['editable'];
	$i++;
}
mysqli_free_result($result_tiem_vaca);
$fin_tiem_vaca = $i - 1;

//configuracion Tipo de Movimiento
$result_tipo_mov_vaca = mysqli_query($link, "select pkyEmployeeMovementType as cod_tipo_mov_vaca, fldName as tipo_mov_vaca, sysEditable as editable
from hrsEmployeeMovementType
where 
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_tipo_mov_vaca = array();
while ($row = mysqli_fetch_array($result_tipo_mov_vaca)) {
	$matriz_tipo_mov_vaca [$i][1] = $row['cod_tipo_mov_vaca'];
	$matriz_tipo_mov_vaca [$i][2] = $row['tipo_mov_vaca'];
	//$matriz_tipo_mov_vaca [$i][3] = $row['descripcion'];
	$matriz_tipo_mov_vaca [$i][3] = $row['editable'];
	$i++;
}
mysqli_free_result($result_tipo_mov_vaca);
$fin_tipo_mov_vaca = $i - 1;

//configuracion Tipo de Vacacion
$result_tipo_vaca = mysqli_query($link, "select pkyVacationType as cod_tipo_vaca, fldName as tipo_vaca,  sysEditable as editable
from hrsVacationType
where 
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_tipo_vaca = array();
while ($row = mysqli_fetch_array($result_tipo_vaca)) {
	$matriz_tipo_vaca [$i][1] = $row['cod_tipo_vaca'];
	$matriz_tipo_vaca [$i][2] = $row['tipo_vaca'];
	$matriz_tipo_vaca [$i][3] = $row['editable'];
	$i++;
}
mysqli_free_result($result_tipo_vaca);
$fin_tipo_vaca = $i - 1;


// Inicio area Comercial
//configuracion Concepto Gasto Compra
$result_gasto_compra = mysqli_query($link, "select a.pkyPurchaseConcept as cod_gasto_compra, a.fldName as gasto_compra, a.codApportionmentMethod as cod_pro, b.fldName as prorrateo, a.txtDescription as descripcion, a.sysEditable as editable
from pchPurchaseConcept a, pchApportionmentMethod b
where 
a.codApportionmentMethod = b.pkyApportionmentMethod and 
a.sysEnabled = 1 and a.sysAuthorized = 1 
order by a.fldName;");
$i = 1;
$matriz_gasto_compra = array();
while ($row = mysqli_fetch_array($result_gasto_compra)) {
	$matriz_gasto_compra [$i][1] = $row['cod_gasto_compra'];
	$matriz_gasto_compra [$i][2] = $row['gasto_compra'];
	$matriz_gasto_compra [$i][3] = $row['prorrateo'];
	$matriz_gasto_compra [$i][4] = $row['descripcion'];
	$matriz_gasto_compra [$i][5] = $row['editable'];
	$i++;
}
mysqli_free_result($result_gasto_compra);
$fin_gasto_compra = $i - 1;

//configuracion Tipo de Retencion
$result_retencion = mysqli_query($link, "select a.pkyRetentionType as cod_retencion, a.fldName as retencion, a.fldPercent as valor, a.codAccount as cod_cuenta, b.fldName as cuenta, a.txtDescription as descripcion, a.sysEditable as editable
from txsRetentionType a, actAccount b 
where 
a.codAccount = b.pkyAccount and 
a.sysEnabled = 1 and a.sysAuthorized = 1 
order by a.fldName;");
$i = 1;
$matriz_retencion = array();
while ($row = mysqli_fetch_array($result_retencion)) {
	$matriz_retencion [$i][1] = $row['cod_retencion'];
	$matriz_retencion [$i][2] = $row['retencion'];
	$matriz_retencion [$i][3] = $row['valor'];
	$matriz_retencion [$i][4] = $row['cod_cuenta'];
	$matriz_retencion [$i][5] = $row['cuenta'];
	$matriz_retencion [$i][6] = $row['descripcion'];
	$matriz_retencion [$i][7] = $row['editable'];
	$i++;
}
mysqli_free_result($result_retencion);
$fin_retencion = $i - 1;

//Area Finanzas
//configuracion Moneda
$result_moneda = mysqli_query($link, "select pkyCurrency as cod_moneda, fldName as moneda, txtDescription as descripcion, sysEditable as editable
from actCurrency 
where 
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_moneda = array();
while ($row = mysqli_fetch_array($result_moneda)) {
	$matriz_moneda [$i][1] = $row['cod_moneda'];
	$matriz_moneda [$i][2] = $row['moneda'];
	$matriz_moneda [$i][3] = $row['descripcion'];
	$matriz_moneda [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_moneda);
$fin_moneda = $i - 1;

//configuracion Tipo de Asiento
$result_tipo_asiento = mysqli_query($link, "select pkyAccountEntryType as cod_tipo_asiento, fldName as tipo_asiento, txtDescription as descripcion, sysEditable as editable
from actAccountEntryType 
where 
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_tipo_asiento = array();
while ($row = mysqli_fetch_array($result_tipo_asiento)) {
	$matriz_tipo_asiento [$i][1] = $row['cod_tipo_asiento'];
	$matriz_tipo_asiento [$i][2] = $row['tipo_asiento'];
	$matriz_tipo_asiento [$i][3] = $row['descripcion'];
	$matriz_tipo_asiento [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_tipo_asiento);
$fin_tipo_asiento = $i - 1;

//configuracion Tipo de Centro de Costo
function dependientes($nivel = 0) {
	
	include "../../conn.php"; //como es funcion debo incluir la conexion de nuevo

	// Iniciamos la creaci�n de la lista
    $lista = '<ul>';
 
    // Obtenemos los datos los dependientes del nivel solicitado
	//$sql = sprintf("SELECT pkyCostCenterType, fldName, parParent FROM actCostCenterTypeView WHERE parParent = %s", $nivel);
	
	$sql = sprintf("select * from (
			SELECT pkyCostCenterType, case when parParent is NULL then 0 else parParent end as parParent, fldName, txtDescription, sysEnabled, sysEditable, sysAuthorized, sysVisible, sysContext, sysAuthorizationGroup 
FROM actCostCenterType
WHERE sysEnabled = 1 and sysAuthorized = 1) t 
				   where t.parParent = %s", $nivel);
				   //echo $sql;
    $q = mysqli_query($link, $sql);
 
    // Para cada dependiente del nivel solicitado...
    while ($r = mysqli_fetch_assoc($q))  {
 		
		if($r['sysEditable'] == 0) { $editable = '<img src="../../Images/gpg.png" />';
		} else { $editable = '<img src="../../Images/clean.png" />';}
        // Abrimos el nodo con el nombre del primer dependiente
        $lista .= '<li>' . $editable . ' ' . $r['pkyCostCenterType'] . ' - ' . $r['fldName'];
 
        // Utilizaremos esta variable para ver si seguimos consultado la BDD
        $tiene_dependientes = NULL;
        $sql = sprintf("SELECT COUNT(parParent) FROM actCostCenterType WHERE parParent = %s", $r['pkyCostCenterType']);
        $tiene_dependientes = mysqli_num_rows(mysqli_query($link, $sql));
 
        // Si tiene dependientes, ejecutamos recursivamente
        // tomando como par�metro el nuevo nivel
        if ($tiene_dependientes) {
            $lista .= dependientes($r['pkyCostCenterType']);
        }
 
        // Cerramos el nodo
        $lista .= '</li>';
    }
 
    // Cerramos la lista
    $lista .= '</ul>';
    return $lista;
}

//configuracion Uso de Cuenta
$result_uso_cta = mysqli_query($link, "select pkyAccountUse as cod_uso, fldName as uso, txtDescription as descripcion, sysEditable as editable 
from actAccountUse
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_uso_cta = array();
while ($row = mysqli_fetch_array($result_uso_cta)) {
	$matriz_uso_cta [$i][1] = $row['cod_uso'];
	$matriz_uso_cta [$i][2] = $row['uso'];
	$matriz_uso_cta [$i][3] = $row['descripcion'];
	$matriz_uso_cta [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_uso_cta);
$fin_uso_cta = $i - 1;

//configuracion Concepto Cuenta por Cobrar
$result_con_cxc = mysqli_query($link, "select a.pkyAccountsReceivableConcept as cod_con_cxc, a.fldName as con_cxc, a.codAccount as cod_cta, b.fldName as cuenta, a.codCostCenter as cod_cc, a.txtDescription as descripcion, a.sysEditable as editable
from colAccountsReceivableConcept a, actAccount b
where
a.codAccount = b.pkyAccount and 
a.sysEnabled = 1 and a.sysAuthorized = 1 
order by a.fldName;");
$i = 1;
$matriz_con_cxc = array();
while ($row = mysqli_fetch_array($result_con_cxc)) {
	$matriz_con_cxc [$i][1] = $row['cod_con_cxc'];
	$matriz_con_cxc [$i][2] = $row['con_cxc'];
	$matriz_con_cxc [$i][3] = $row['cod_cta'];
	$matriz_con_cxc [$i][4] = $row['cuenta'];
	$matriz_con_cxc [$i][5] = $row['cod_cc'];
	$cod_cc_ = $row['cod_cc'];
	$matriz_con_cxc [$i][7] = $row['descripcion'];
	$matriz_con_cxc [$i][8] = $row['editable'];
	if($cod_cc_ != NULL) {
		$result_cc_ = mysqli_query($link, "select fldName as cc
									from actCostCenter
									where
									pkyCostCenter = '$cod_cc_';");
		while ($row = mysqli_fetch_array($result_cc_)) {
			$matriz_con_cxc [$i][6] = $row['cc'];
		}
	}
	$i++;
}
mysqli_free_result($result_con_cxc);
$fin_con_cxc = $i - 1;

//configuracion Concepto de Ingreso
$result_con_ing = mysqli_query($link, "select pkyIncomeConcept as cod_con_ing, fldName as con_ing, codAccount as cod_cta, txtDescription as descripcion, sysEditable as editable
from colIncomeConcept
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_con_ing = array();
while ($row = mysqli_fetch_array($result_con_ing)) {
	$matriz_con_ing [$i][1] = $row['cod_con_ing'];
	$matriz_con_ing [$i][2] = $row['con_ing'];
	$matriz_con_ing [$i][3] = $row['cod_cta'];
	$cod_cta_ = $row['cod_cta'];
	$matriz_con_ing [$i][5] = $row['descripcion'];
	$matriz_con_ing [$i][6] = $row['editable'];
	if($cod_cta_ != NULL) {
		$result_cta_ = mysqli_query($link, "select fldName as cuenta
									from actAccount
									where
									pkyAccount = '$cod_cta_';");
		while ($row = mysqli_fetch_array($result_cta_)) {
			$matriz_con_ing [$i][4] = $row['cuenta'];
		}
	}
	$i++;
}
mysqli_free_result($result_con_ing);
$fin_con_ing = $i - 1;

//configuracion Via de Cobro
$result_via_cobro = mysqli_query($link, "select pkyCollectionRoute as cod_via, fldName as via_cobro, codAccount as cod_cta, txtDescription as descripcion, sysEditable as editable
from colCollectionRoute 
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_via_cobro = array();
while ($row = mysqli_fetch_array($result_via_cobro)) {
	$matriz_via_cobro [$i][1] = $row['cod_via'];
	$matriz_via_cobro [$i][2] = $row['via_cobro'];
	$matriz_via_cobro [$i][3] = $row['cod_cta'];
	$cod_cta_ = $row['cod_cta'];
	$matriz_via_cobro [$i][5] = $row['descripcion'];
	$matriz_via_cobro [$i][6] = $row['editable'];
	if($cod_cta_ != NULL) {
		$result_cta_ = mysqli_query($link, "select fldName as cuenta
									from actAccount
									where
									pkyAccount = '$cod_cta_';");
		while ($row = mysqli_fetch_array($result_cta_)) {
			$matriz_via_cobro [$i][4] = $row['cuenta'];
		}
	}
	$i++;
}
mysqli_free_result($result_via_cobro);
$fin_via_cobro = $i - 1;


//configuracion Concepto Cuenta por Pagar
$result_con_cxp = mysqli_query($link, "select a.pkyAccountsPayableConcept as cod_con_cxp, a.fldName as con_cxp, a.codAccount as cod_cta, b.fldName as cuenta, a.codCostCenter as cod_cc, a.txtDescription as descripcion, a.sysEditable as editable
from payAccountsPayableConcept a, actAccount b
where
a.codAccount = b.pkyAccount and 
a.sysEnabled = 1 and a.sysAuthorized = 1 
order by a.fldName;");
$i = 1;
$matriz_con_cxp = array();
while ($row = mysqli_fetch_array($result_con_cxp)) {
	$matriz_con_cxp [$i][1] = $row['cod_con_cxp'];
	$matriz_con_cxp [$i][2] = $row['con_cxp'];
	$matriz_con_cxp [$i][3] = $row['cod_cta'];
	$matriz_con_cxp [$i][4] = $row['cuenta'];
	$matriz_con_cxp [$i][5] = $row['cod_cc'];
	$cod_cc_ = $row['cod_cc'];
	$matriz_con_cxp [$i][7] = $row['descripcion'];
	$matriz_con_cxp [$i][8] = $row['editable'];
	if($cod_cc_ != NULL) {
		$result_cc_ = mysqli_query($link, "select fldName as cc
									from actCostCenter
									where
									pkyCostCenter = '$cod_cc_';");
		while ($row = mysqli_fetch_array($result_cc_)) {
			$matriz_con_cxp [$i][6] = $row['cc'];
		}
	}
	$i++;
}
mysqli_free_result($result_con_cxp);
$fin_con_cxp = $i - 1;

//configuracion Concepto de Gasto
$result_con_gto = mysqli_query($link, "select pkyExpensesConcept as cod_con_gto, fldName as con_gto, codAccount as cod_cta, fldItemControl as cod_ctrl_item, txtDescription as descripcion, sysEditable as editable
from payExpensesConcept
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_con_gto = array();
while ($row = mysqli_fetch_array($result_con_gto)) {
	$matriz_con_gto [$i][1] = $row['cod_con_gto'];
	$matriz_con_gto [$i][2] = $row['con_gto'];
	$matriz_con_gto [$i][3] = $row['cod_cta'];
	$cod_cta_ = $row['cod_cta'];
	$matriz_con_gto [$i][5] = $row['descripcion'];
	$matriz_con_gto [$i][6] = $row['editable'];
	if($row['cod_ctrl_item'] == 0) {
		$matriz_con_gto [$i][7] = 'No';
	} else {
		$matriz_con_gto [$i][7] = 'Si';
	}
	if($cod_cta_ != NULL) {
		$result_cta_ = mysqli_query($link, "select fldName as cuenta
									from actAccount
									where
									pkyAccount = '$cod_cta_';");
		while ($row = mysqli_fetch_array($result_cta_)) {
			$matriz_con_gto [$i][4] = $row['cuenta'];
		}
	}
	$i++;
}
mysqli_free_result($result_con_gto);
$fin_con_gto = $i - 1;

//configuracion Via de Pago
$result_via_pago = mysqli_query($link, "select pkyPaymentRoute as cod_via, fldName as via_pago, codAccount as cod_cta, txtDescription as descripcion, sysEditable as editable
from payPaymentRoute 
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_via_pago = array();
while ($row = mysqli_fetch_array($result_via_pago)) {
	$matriz_via_pago [$i][1] = $row['cod_via'];
	$matriz_via_pago [$i][2] = $row['via_pago'];
	$matriz_via_pago [$i][3] = $row['cod_cta'];
	$cod_cta_ = $row['cod_cta'];
	$matriz_via_pago [$i][5] = $row['descripcion'];
	$matriz_via_pago [$i][6] = $row['editable'];
	if($cod_cta_ != NULL) {
		$result_cta_ = mysqli_query($link, "select fldName as cuenta
									from actAccount
									where
									pkyAccount = '$cod_cta_';");
		while ($row = mysqli_fetch_array($result_cta_)) {
			$matriz_via_pago [$i][4] = $row['cuenta'];
		}
	}
	$i++;
}
mysqli_free_result($result_via_pago);
$fin_via_pago = $i - 1;


//configuracion Tipo de Movimiento
$result_mov_caja = mysqli_query($link, "select pkyPettyCashMovementType as cod_mov_caja, fldName as mov_caja, txtDescription as descripcion, sysEditable as editable
from ptcPettyCashMovementType 
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_mov_caja = array();
while ($row = mysqli_fetch_array($result_mov_caja)) {
	$matriz_mov_caja [$i][1] = $row['cod_mov_caja'];
	$matriz_mov_caja [$i][2] = $row['mov_caja'];
	$matriz_mov_caja [$i][3] = $row['descripcion'];
	$matriz_mov_caja [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_mov_caja);
$fin_mov_caja = $i - 1;

//configuracion Estado de Cheque
$result_est_cheque = mysqli_query($link, "select pkyCheckStatus as cod_est_cheque, fldName as est_cheque, txtDescription as descripcion, sysEditable as editable
from tryCheckStatus 
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_est_cheque = array();
while ($row = mysqli_fetch_array($result_est_cheque)) {
	$matriz_est_cheque [$i][1] = $row['cod_est_cheque'];
	$matriz_est_cheque [$i][2] = $row['est_cheque'];
	$matriz_est_cheque [$i][3] = $row['descripcion'];
	$matriz_est_cheque [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_est_cheque);
$fin_est_cheque = $i - 1;

//configuracion Tipo de Cuenta Bancaria
$result_tipo_cta = mysqli_query($link, "select pkyBankAccountType as cod_tipo_cta, fldName as tipo_cta, txtDescription as descripcion, sysEditable as editable
from tryBankAccountType 
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_tipo_cta = array();
while ($row = mysqli_fetch_array($result_tipo_cta)) {
	$matriz_tipo_cta [$i][1] = $row['cod_tipo_cta'];
	$matriz_tipo_cta [$i][2] = $row['tipo_cta'];
	$matriz_tipo_cta [$i][3] = $row['descripcion'];
	$matriz_tipo_cta [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_tipo_cta);
$fin_tipo_cta = $i - 1;

//configuracion Tipo de Movimiento Bancario
$result_mov_banco = mysqli_query($link, "select pkyBankMovementType as cod_mov_banco, fldName as mov_banco, txtDescription as descripcion, sysEditable as editable
from tryBankMovementType 
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_mov_banco = array();
while ($row = mysqli_fetch_array($result_mov_banco)) {
	$matriz_mov_banco [$i][1] = $row['cod_mov_banco'];
	$matriz_mov_banco [$i][2] = $row['mov_banco'];
	$matriz_mov_banco [$i][3] = $row['descripcion'];
	$matriz_mov_banco [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_mov_banco);
$fin_mov_banco = $i - 1;


//configuracion Tipo de Identificador
$result_tipo_id = mysqli_query($link, "select pkyUserIdentifierType as cod_tipo_id, fldName as tipo_id, txtDescription as descripcion, sysEditable as editable
from accUserIdentifierType 
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_tipo_id = array();
while ($row = mysqli_fetch_array($result_tipo_id)) {
	$matriz_tipo_id [$i][1] = $row['cod_tipo_id'];
	$matriz_tipo_id [$i][2] = $row['tipo_id'];
	$matriz_tipo_id [$i][3] = $row['descripcion'];
	$matriz_tipo_id [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_tipo_id);
$fin_tipo_id = $i - 1;

//configuracion Tipo de Usuario
$result_tipo_us = mysqli_query($link, "select pkyUserType as cod_tipo_us, fldName as tipo_us, txtDescription as descripcion, sysEditable as editable
from accUserType 
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_tipo_us = array();
while ($row = mysqli_fetch_array($result_tipo_us)) {
	$matriz_tipo_us [$i][1] = $row['cod_tipo_us'];
	$matriz_tipo_us [$i][2] = $row['tipo_us'];
	$matriz_tipo_us [$i][3] = $row['descripcion'];
	$matriz_tipo_us [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_tipo_us);
$fin_tipo_us = $i - 1;

//configuracion Politica de Transmision
$result_pol_trans = mysqli_query($link, "select pkyTransmissionPolicy as cod_pol_trans, fldName as pol_trans, txtDescription as descripcion, sysEditable as editable
from dbaTransmissionPolicy 
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_pol_trans = array();
while ($row = mysqli_fetch_array($result_pol_trans)) {
	$matriz_pol_trans [$i][1] = $row['cod_pol_trans'];
	$matriz_pol_trans [$i][2] = $row['pol_trans'];
	$matriz_pol_trans [$i][3] = $row['descripcion'];
	$matriz_pol_trans [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_pol_trans);
$fin_pol_trans = $i - 1;


//configuracion Tipo de Componente
$result_tipo_comp = mysqli_query($link, "select pkyComponentType as cod_tipo_comp, fldName as tipo_comp, txtDescription as descripcion, sysEditable as editable
from srvComponentType 
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_tipo_comp = array();
while ($row = mysqli_fetch_array($result_tipo_comp)) {
	$matriz_tipo_comp [$i][1] = $row['cod_tipo_comp'];
	$matriz_tipo_comp [$i][2] = $row['tipo_comp'];
	$matriz_tipo_comp [$i][3] = $row['descripcion'];
	$matriz_tipo_comp [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_tipo_comp);
$fin_tipo_comp = $i - 1;

//configuracion Tipo de Unidad de Medida
$result_tipo_uni = mysqli_query($link, "select pkyMeasureUnitType as cod_tipo_uni, fldName as tipo_uni, txtDescription as descripcion, sysEditable as editable
from srvMeasureUnitType 
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_tipo_uni = array();
while ($row = mysqli_fetch_array($result_tipo_uni)) {
	$matriz_tipo_uni [$i][1] = $row['cod_tipo_uni'];
	$matriz_tipo_uni [$i][2] = $row['tipo_uni'];
	$matriz_tipo_uni [$i][3] = $row['descripcion'];
	$matriz_tipo_uni [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_tipo_uni);
$fin_tipo_uni = $i - 1;

//activos fijos
//configuracion Clasificacion de activos fijos
$result_cla_af = mysqli_query($link, "select a.codFamily as cod_familia, b.fldName as familia, a.codSubFamily as cod_subfamilia, a.codGroup as cod_grupo, a.codSubGroup as cod_subgrupo, a.sysEditable as editable  
from fasFixedAssetClassification a, fasFixedAssetCategory b
where
a.codFamily = b.pkyFixedAssetCategory and 
a.sysEnabled = 1 and a.sysAuthorized = 1
order by 
b.fldName, a.codSubFamily, a.codGroup, a.codSubGroup;");
$i = 1;
$matriz_cla_af = array();
while ($row = mysqli_fetch_array($result_cla_af)) {
	$matriz_cla_af [$i][1] = $row['cod_familia'];
	$matriz_cla_af [$i][2] = $row['familia'];
	$matriz_cla_af [$i][3] = $row['cod_subfamilia'];
	$matriz_cla_af [$i][4] = NULL;
	$matriz_cla_af [$i][5] = $row['cod_grupo'];
	$matriz_cla_af [$i][6] = NULL;
	$matriz_cla_af [$i][7] = $row['cod_subgrupo'];
	$matriz_cla_af [$i][8] = NULL;
	$matriz_cla_af [$i][9] = $row['editable'];
	$i++;
}
mysqli_free_result($result_cla_af);
$fin_cla_af = $i - 1;

//configuracion categoria de activo fijo
$result_cat_af = mysqli_query($link, "select a.pkyFixedAssetCategory as cod_cat_af, a.fldName as cat_af, a.fldLevel as nivel, a.codAccount as cod_cta_alta, a.codAccumulatedDepreciationAccount as cod_cta_dep_acum, a.codDepreciationAccount as cod_cta_dep_gasto, a.codRevaluationAccount as cod_cta_rev, a.fldDepreciationTime as tiempo_dep, a.fldIsDepreciated as se_dep, a.txtDescription as descripcion, a.sysEditable as editable
from fasFixedAssetCategory a
where 
a.sysEnabled = 1 and a.sysAuthorized = 1 
order by a.fldName;");
$i = 1;
$matriz_cat_af = array();
while ($row = mysqli_fetch_array($result_cat_af)) {
	$matriz_cat_af [$i][1] = $row['cod_cat_af'];
	$matriz_cat_af [$i][2] = $row['cat_af'];
	$matriz_cat_af [$i][3] = $row['nivel'];
	$matriz_cat_af [$i][4] = $row['cod_cta_alta'];
	$matriz_cat_af [$i][5] = NULL;
	$matriz_cat_af [$i][6] = $row['cod_cta_dep_acum'];
	$matriz_cat_af [$i][7] = NULL;
	$matriz_cat_af [$i][8] = $row['cod_cta_dep_gasto'];
	$matriz_cat_af [$i][9] = NULL;
	$matriz_cat_af [$i][10] = $row['cod_cta_rev'];
	$matriz_cat_af [$i][11] = NULL;
	$matriz_cat_af [$i][12] = $row['tiempo_dep'];
	if($row['se_dep'] == 0) {
		$matriz_cat_af [$i][13] = 'NO';
	} else {
		$matriz_cat_af [$i][13] = 'SI';
	}
	$matriz_cat_af [$i][14] = $row['descripcion'];
	$matriz_cat_af [$i][15] = $row['editable'];
	$i++;
}
mysqli_free_result($result_cat_af);
$fin_cat_af = $i - 1;

//configuracion Tipo de Movimiento
$result_tipo_mov_af = mysqli_query($link, "select pkyFixedAssetMovementType as cod_tipo_mov, fldName as tipo_mov, txtDescription as descripcion, sysEditable as editable
from fasFixedAssetMovementType 
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_tipo_mov_af = array();
while ($row = mysqli_fetch_array($result_tipo_mov_af)) {
	$matriz_tipo_mov_af [$i][1] = $row['cod_tipo_mov'];
	$matriz_tipo_mov_af [$i][2] = $row['tipo_mov'];
	$matriz_tipo_mov_af [$i][3] = $row['descripcion'];
	$matriz_tipo_mov_af [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_tipo_mov_af);
$fin_tipo_mov_af = $i - 1;

//inventario
//configuracion Clasificacion de Item
$result_cla_item = mysqli_query($link, "select a.codFamily as cod_familia, b.fldName as familia, a.codSubFamily as cod_subfamilia, a.codGroup as cod_grupo, a.codSubGroup as cod_subgrupo, a.sysEditable as editable 
from invItemClassification a, invItemCategory b
where
a.codFamily = b.pkyItemCategory and 
a.sysEnabled = 1 and a.sysAuthorized = 1
order by 
b.fldName, a.codSubFamily, a.codGroup, a.codSubGroup;");
$i = 1;
$matriz_cla_item = array();
while ($row = mysqli_fetch_array($result_cla_item)) {
	$matriz_cla_item [$i][1] = $row['cod_familia'];
	$matriz_cla_item [$i][2] = $row['familia'];
	$matriz_cla_item [$i][3] = $row['cod_subfamilia'];
	$matriz_cla_item [$i][4] = NULL;
	$matriz_cla_item [$i][5] = $row['cod_grupo'];
	$matriz_cla_item [$i][6] = NULL;
	$matriz_cla_item [$i][7] = $row['cod_subgrupo'];
	$matriz_cla_item [$i][8] = NULL;
	$matriz_cla_item [$i][9] = $row['editable'];
	$i++;
}
mysqli_free_result($result_cla_item);
$fin_cla_item = $i - 1;

//configuracion Categoria de Item
$result_cat_item = mysqli_query($link, "select pkyItemCategory as cod_cat_item, fldName as cat_item, fldLevel as nivel, codAccount as cod_cta, codCostAccount as cod_costo_cta, txtDescription as descripcion, sysEditable as editable
from invItemCategory 
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_cat_item = array();
while ($row = mysqli_fetch_array($result_cat_item)) {
	$matriz_cat_item [$i][1] = $row['cod_cat_item'];
	$matriz_cat_item [$i][2] = $row['cat_item'];
	$matriz_cat_item [$i][3] = $row['nivel'];
	$matriz_cat_item [$i][4] = $row['cod_cta'];
	$matriz_cat_item [$i][5] = NULL;
	$matriz_cat_item [$i][6] = $row['cod_costo_cta'];
	$matriz_cat_item [$i][7] = NULL;
	$matriz_cat_item [$i][8] = $row['descripcion'];
	$matriz_cat_item [$i][9] = $row['editable'];
	$i++;
}
mysqli_free_result($result_cat_item);
$fin_cat_item = $i - 1;

//configuracion Tipo de Item
$result_tipo_item = mysqli_query($link, "select pkyItemType as cod_tipo_item, fldName as tipo_item, txtDescription as descripcion, sysEditable as editable
from invItemType 
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_tipo_item = array();
while ($row = mysqli_fetch_array($result_tipo_item)) {
	$matriz_tipo_item [$i][1] = $row['cod_tipo_item'];
	$matriz_tipo_item [$i][2] = $row['tipo_item'];
	$matriz_tipo_item [$i][3] = $row['descripcion'];
	$matriz_tipo_item [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_tipo_item);
$fin_tipo_item = $i - 1;

//configuracion Tipo de Movimiento
$result_tipo_mov = mysqli_query($link, "select pkyItemMovementType as cod_tipo_mov, fldName as tipo_mov, txtDescription as descripcion, sysEditable as editable
from invItemMovementType 
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_tipo_mov = array();
while ($row = mysqli_fetch_array($result_tipo_mov)) {
	$matriz_tipo_mov [$i][1] = $row['cod_tipo_mov'];
	$matriz_tipo_mov [$i][2] = $row['tipo_mov'];
	$matriz_tipo_mov [$i][3] = $row['descripcion'];
	$matriz_tipo_mov [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_tipo_mov);
$fin_tipo_mov = $i - 1;

//configuracion Unidad de Almacenamiento
$result_uni = mysqli_query($link, "select pkyStorageUnit as cod_uni, fldName as uni, fldAbbreviation as abrev, txtDescription as descripcion, sysEditable as editable
from invStorageUnit 
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");
$i = 1;
$matriz_uni = array();
while ($row = mysqli_fetch_array($result_uni)) {
	$matriz_uni [$i][1] = $row['cod_uni'];
	$matriz_uni [$i][2] = $row['uni'];
	$matriz_uni [$i][3] = $row['abrev'];
	$matriz_uni [$i][4] = $row['descripcion'];
	$matriz_uni [$i][5] = $row['editable'];
	$i++;
}
mysqli_free_result($result_uni);
$fin_uni = $i - 1;

//configuracion Linea de Produccion
$result_linea_prod = mysqli_query($link, "select a.pkyProductionLine as cod_linea, a.fldName as linea, a.codSourceWarehouse as cod_alm1, b.fldName as nombre_alm1, a.codTargetWarehouse as cod_alm2, c.fldName as nombre_alm2, a.txtDescription as descripcion, a.sysEditable as editable 
from prdProductionLine a, invWarehouse b, invWarehouse c 
where 
a.codSourceWarehouse = b.pkyWarehouse and 
a.codTargetWarehouse = c.pkyWarehouse and 
a.sysEnabled = 1 and a.sysAuthorized = 1 
order by a.fldName;");
$i = 1;
$matriz_linea_prod = array();
while ($row = mysqli_fetch_array($result_linea_prod)) {
	$matriz_linea_prod [$i][1] = $row['cod_linea'];
	$matriz_linea_prod [$i][2] = $row['linea'];
	$matriz_linea_prod [$i][3] = $row['cod_alm1'];
	$matriz_linea_prod [$i][4] = $row['nombre_alm1'];
	$matriz_linea_prod [$i][5] = $row['cod_alm2'];
	$matriz_linea_prod [$i][6] = $row['nombre_alm2'];
	$matriz_linea_prod [$i][7] = $row['descripcion'];
	$matriz_linea_prod [$i][8] = $row['editable'];
	$i++;
}
mysqli_free_result($result_linea_prod);
$fin_linea_prod = $i - 1;


//configuracion Equipamiento del Vehiculo
$result_equip = mysqli_query($link, "select pkyVehicleEquipment as cod_equip, fldName as equip, txtDescription as descripcion, sysEditable as editable
from vhcVehicleEquipment
where
sysEnabled = 1 and sysAuthorized = 1  
order by fldName;");
$i = 1;
$matriz_equip = array();
while ($row = mysqli_fetch_array($result_equip)) {
	$matriz_equip [$i][1] = $row['cod_equip'];
	$matriz_equip [$i][2] = $row['equip'];
	$matriz_equip [$i][3] = $row['descripcion'];
	$matriz_equip [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_equip);
$fin_equip = $i - 1;

//configuracion Estado de Contrato
$result_estado = mysqli_query($link, "select pkyVehicleContractStatus as cod_estado, fldName as estado, txtDescription as descripcion, sysEditable as editable
from vhcVehicleContractStatus
where
sysEnabled = 1 and sysAuthorized = 1   
order by fldName;");
$i = 1;
$matriz_estado = array();
while ($row = mysqli_fetch_array($result_estado)) {
	$matriz_estado [$i][1] = $row['cod_estado'];
	$matriz_estado [$i][2] = $row['estado'];
	$matriz_estado [$i][3] = $row['descripcion'];
	$matriz_estado [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_estado);
$fin_estado = $i - 1;

//configuracion Extras
$result_extras = mysqli_query($link, "select pkyVehicleExtra as cod_extras, fldName as extras, txtDescription as descripcion, sysEditable as editable
from vhcVehicleExtra
where
sysEnabled = 1 and sysAuthorized = 1   
order by fldName;");
$i = 1;
$matriz_extras = array();
while ($row = mysqli_fetch_array($result_extras)) {
	$matriz_extras [$i][1] = $row['cod_extras'];
	$matriz_extras [$i][2] = $row['extras'];
	$matriz_extras [$i][3] = $row['descripcion'];
	$matriz_extras [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_extras);
$fin_extras = $i - 1;

//configuracion Seguro
$result_seguro = mysqli_query($link, "select pkyVehicleInsurance as cod_seguro, fldName as seguro, txtDescription as descripcion, sysEditable as editable
from vhcVehicleInsurance
where
sysEnabled = 1 and sysAuthorized = 1    
order by fldName;");
$i = 1;
$matriz_seguro = array();
while ($row = mysqli_fetch_array($result_seguro)) {
	$matriz_seguro [$i][1] = $row['cod_seguro'];
	$matriz_seguro [$i][2] = $row['seguro'];
	$matriz_seguro [$i][3] = $row['descripcion'];
	$matriz_seguro [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_seguro);
$fin_seguro = $i - 1;

//configuracion Tipo de Combustible
$result_comb = mysqli_query($link, "select pkyFuelType as cod_comb, fldName as comb, txtDescription as descripcion, sysEditable as editable
from vhcFuelType
where
sysEnabled = 1 and sysAuthorized = 1     
order by fldName;");
$i = 1;
$matriz_comb = array();
while ($row = mysqli_fetch_array($result_comb)) {
	$matriz_comb [$i][1] = $row['cod_comb'];
	$matriz_comb [$i][2] = $row['comb'];
	$matriz_comb [$i][3] = $row['descripcion'];
	$matriz_comb [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_comb);
$fin_comb = $i - 1;

//configuracion Tipo de Contrato
$result_cont = mysqli_query($link, "select pkyVehicleContractType as cod_cont, fldName as cont, txtDescription as descripcion, sysEditable as editable
from vhcVehicleContractType
where
sysEnabled = 1 and sysAuthorized = 1      
order by fldName;");
$i = 1;
$matriz_cont = array();
while ($row = mysqli_fetch_array($result_cont)) {
	$matriz_cont [$i][1] = $row['cod_cont'];
	$matriz_cont [$i][2] = $row['cont'];
	$matriz_cont [$i][3] = $row['descripcion'];
	$matriz_cont [$i][4] = $row['editable'];
	$i++;
}
mysqli_free_result($result_cont);
$fin_cont = $i - 1;
?>
<table border="0" align="left" width="100%" cellpadding="5">
<tr><td><?php echo $mostrar_logo_reportes; ?>
</td><td align="right"><b>Fecha: <?php echo date("Y-m-d"); ?><br/>Hora: <?php echo date("H:i:s"); ?><br/>Usuario: <?php echo $usuario; ?></b>
</td></tr></table>
<p><br /><center><font color="#000099" size="+1"><b>Configuraci&oacute;n de Par&aacute;metros (<?php echo $modulos ?>)</b></font></center></p>

<?php if($modulos == 'Agenda' || $modulos == 'Todos') { //if modulo agenda ?>

<br /><center><font size="+1"><b>Administraci&oacute;n - Agenda</b></font></center>
<table border="1" cellpadding="2" align="center" width="70%">
<thead>
<?php
printf("<tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Canal</b></td></tr>");
?>
<tr>
<td align="center" width="20%"><b>Cod.</b></td>
<td align="center" width="40%"><b>Nombre</b></td>
<td align="center" width="40%"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php
$color = 2;
for($i = 1; $i <= $fin_canal; $i++){
	if($matriz_canal[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_canal[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_canal[$i][1]);
	}
	printf("<td>%s</td>", $matriz_canal[$i][2]);
	printf("<td>%s</td></tr>", $matriz_canal[$i][3]);
	$color++;
}

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='70%'>";
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Rubro</b></td></tr>");
?>
<tr>
<td align="center" width="20%"><b>Cod.</b></td>
<td align="center" width="40%"><b>Nombre</b></td>
<td align="center" width="40%"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php
$color = 2;
for($i = 1; $i <= $fin_rubro; $i++){
	if($matriz_rubro[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_rubro[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_rubro[$i][1]);
	}
	printf("<td>%s</td>", $matriz_rubro[$i][2]);
	printf("<td>%s</td></tr>", $matriz_rubro[$i][3]);
	$color++;
}

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='70%'>";
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>T&iacute;tulo</b></td></tr>");
?>
<tr>
<td align="center" width="20%"><b>Cod.</b></td>
<td align="center" width="40%"><b>Nombre</b></td>
<td align="center" width="40%"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php
$color = 2;
for($i = 1; $i <= $fin_titulo; $i++){
	if($matriz_titulo[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_titulo[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_titulo[$i][1]);
	}
	printf("<td>%s</td>", $matriz_titulo[$i][2]);
	printf("<td>%s</td></tr>", $matriz_titulo[$i][3]);
	$color++;
}

?>
</tbody>
</table>

<?php } //fin if modulo agenda ?>

<?php if($modulos == 'Recursos Humanos' || $modulos == 'Todos') { //if modulo rrhh ?>

<br /><center><font size="+1"><b>Administraci&oacute;n - Recursos Humanos</b></font></center>
<table border="1" cellpadding="2" align="center" width="90%">
<thead>
<?php
printf("<tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Bono de Antig&uuml;edad</b></td></tr>");
?>
<tr>
<td align="center" width="30%"><b>A&ntilde;o inicial</b></td>
<td align="center" width="30%"><b>A&ntilde;o final</b></td>
<td align="center" width="30%"><b>Incremento</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php
$color = 2;
for($i = 1; $i <= $fin_ant; $i++){
	if($matriz_ant[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_ant[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_ant[$i][1]);
	}
	printf("<td>%s</td>", $matriz_ant[$i][2]);
	printf("<td>%s</td></tr>", $matriz_ant[$i][3]);
	$color++;
}

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='90%'>";
printf("<tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Cargo</b></td></tr>");
?>
<tr>
<td align="center" width="20%"><b>Cod.</b></td>
<td align="center" width="40%"><b>Nombre</b></td>
<td align="center" width="40%"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php
$color = 2;
for($i = 1; $i <= $fin_cargo; $i++){
	if($matriz_cargo[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_cargo[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_cargo[$i][1]);
	}
	printf("<td>%s</td>", $matriz_cargo[$i][2]);
	printf("<td>%s</td></tr>", $matriz_cargo[$i][3]);
	$color++;
}

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='90%'>";
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='6' align='center'><b>Concepto de Bono o Descuento</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Cod. Cta.</b></td>
<td align="center"><b>Cuenta</b></td>
<td align="center"><b>Modalidad</b></td>
<td align="center"><b>Tipo</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php
$color = 2;
for($i = 1; $i <= $fin_bono; $i++){
	if($matriz_bono[$i][7] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_bono[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_bono[$i][1]);
	}
	printf("<td>%s</td>", $matriz_bono[$i][2]);
	printf("<td align='center'>%s</td>", $matriz_bono[$i][3]);
	printf("<td>%s</td>", $matriz_bono[$i][4]);
	printf("<td>%s</td>", $matriz_bono[$i][5]);
	printf("<td>%s</td></tr>", $matriz_bono[$i][6]);
	$color++;
}
echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='90%'>";
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Concepto de Planillas</b></td></tr>");
?>
<tr>
<td align="center" width="20%"><b>Cod.</b></td>
<td align="center" width="40%"><b>Nombre</b></td>
<td align="center" width="40%"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php
/*
$color2 = 2;

for($i = 1; $i <= $fin_planilla; $i++){//for planilla
	
	$cod_planilla_ = $matriz_planilla[$i][1];
	$result_planilla_det = mysqli_query($link, "select pkyPayrollConceptDetail as cod_planilla_det, fldName as planilla_det, txtDescription as descripcion, sysEditable as editable
		from hrsPayrollConceptDetail
		where
		codPayrollConcept = '$cod_planilla_' 
		order by fldName;");
	$hay_planilla_det = mysqli_num_rows($result_planilla_det);	
	if($matriz_planilla[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color2 % 2 == 0) { //if color2
	printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>",$editable, $matriz_planilla[$i][1]);
	} else {
	printf("<tr><td align='center'>%s %s</td>",$editable, $matriz_planilla[$i][1]);
	} //fin if color2
	printf("<td>%s</td>", $matriz_planilla[$i][2]);
	printf("<td>%s</td></tr>", $matriz_planilla[$i][3]);
	if($hay_planilla_det != 0) { //if planilla_det
	$color = 2;
	echo "<tr><td colspan='3'>";
	echo '<table border="1" cellpadding="2" align="center" width="90%">';
	echo "<thead><tr BGCOLOR='#ffcc99'><td colspan='5' align='left'><b>Detalle</b></td></tr>";
	echo '<tr><td align="center"><b>Cod.</b></td>
		<td align="center"><b>Nombre</b></td>
		<td align="center"><b>Descripci&oacute;n</b></td></tr></thead><tbody class="marcafila">';
	
	
	$matriz_planilla_det = array();
	while ($row = mysqli_fetch_array($result_planilla_det)) {
		$cod_planilla_det_ = $row['cod_planilla_det'];
		$planilla_det_ = $row['planilla_det'];
		$editable_det_ = $row['editable'];
		$descrip_det_ = $row['descripcion'];
		if($editable_det_ == 0) { $editable = $editable0;
		} else { $editable = $editable1;}
		if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $cod_planilla_det_);
		} else {
		printf("<td align='center'>%s %s</td>", $editable, $cod_planilla_det_);
		}
		printf("<td>%s</td>", $planilla_det_);
		printf("<td>%s</td></tr>", $descrip_det_);
		$color++;
	}
	echo "</td></tr>";
	echo "</tbody></table>";
	echo "<br>";
	} //fin if planilla_det
	mysqli_free_result($result_planilla_det);
	$color2++;
	
}//fin for planilla
*/
echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='90%'>";
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='8' align='center'><b>Descuentos Fijos</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Concepto Cuenta x Pagar</b></td>
<td align="center"><b>Concepto Salario (Base C&aacute;lculo)</b></td>
<td align="center"><b>Empresa</b></td>
<td align="center"><b>Tipo</b></td>
<td align="center"><b>Monto o Porcentaje</b></td>
<td align="center"><b>Min. No Imponible</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php
$color = 2;
for($i = 1; $i <= $fin_desc; $i++){
	if($matriz_desc[$i][9] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_desc[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_desc[$i][1]);
	}
	printf("<td>%s</td>", $matriz_desc[$i][2]);
	printf("<td>%s</td>", $matriz_desc[$i][3]);
	printf("<td>%s</td>", $matriz_desc[$i][4]);
	printf("<td>%s</td>", $matriz_desc[$i][5]);
	printf("<td>%s</td>", $matriz_desc[$i][6]);
	printf("<td align='right'>%s</td>", number_format($matriz_desc[$i][7], $n_decimales));
	printf("<td align='right'>%s</td></tr>", number_format($matriz_desc[$i][8], $n_decimales));
	$color++;
}

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='90%'>";
printf("<tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Profesi&oacute;n</b></td></tr>");
?>
<tr>
<td align="center" width="20%"><b>Cod.</b></td>
<td align="center" width="40%"><b>Nombre</b></td>
<td align="center" width="40%"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php
$color = 2;
for($i = 1; $i <= $fin_prof; $i++){
	if($matriz_prof[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_prof[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_prof[$i][1]);
	}
	printf("<td>%s</td>", $matriz_prof[$i][2]);
	printf("<td>%s</td></tr>", $matriz_prof[$i][3]);
	$color++;
}

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='90%'>";
printf("<tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Tiempo de Vacaci&oacute;n</b></td></tr>");
?>
<tr>
<td align="center" width="20%"><b>Cod.</b></td>
<td align="center" width="40%"><b>Nombre</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php
$color = 2;
for($i = 1; $i <= $fin_tiem_vaca; $i++){
	if($matriz_tiem_vaca[$i][3] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_tiem_vaca[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_tiem_vaca[$i][1]);
	}
	printf("<td>%s</td></tr>", $matriz_tiem_vaca[$i][2]);
	$color++;
}

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='90%'>";
printf("<tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Tipo de Movimiento</b></td></tr>");
?>
<tr>
<td align="center" width="20%"><b>Cod.</b></td>
<td align="center" width="40%"><b>Nombre</b></td>
<!--<td align="center" width="40%"><b>Descripci&oacute;n</b></td>-->
</tr>
</thead>
<tbody class="marcafila">
<?php
$color = 2;
for($i = 1; $i <= $fin_tipo_mov_vaca; $i++){
	if($matriz_tipo_mov_vaca[$i][3] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_tipo_mov_vaca[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_tipo_mov_vaca[$i][1]);
	}
	//printf("<td>%s</td>", $matriz_tipo_mov_vaca[$i][2]);
	printf("<td>%s</td></tr>", $matriz_tipo_mov_vaca[$i][2]);
	$color++;
}

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='90%'>";
printf("<tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Tipo de Vacaci&oacute;n</b></td></tr>");
?>
<tr>
<td align="center" width="20%"><b>Cod.</b></td>
<td align="center" width="40%"><b>Nombre</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php
$color = 2;
for($i = 1; $i <= $fin_tipo_vaca; $i++){
	if($matriz_tipo_vaca[$i][3] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_tipo_vaca[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_tipo_vaca[$i][1]);
	}
	printf("<td>%s</td></tr>", $matriz_tipo_vaca[$i][2]);
	$color++;
}

?>
</tbody>
</table>

<?php } //fin if modulo rrhh ?>

<?php if($modulos == 'Compras' || $modulos == 'Todos') { //if modulo compras ?>

<br /><center><font size="+1"><b>Comercial - Compras</b></font></center>
<table border="1" cellpadding="2" align="center" width="70%">
<thead>
<?php
printf("<tr BGCOLOR='#ffffcc'><td colspan='4' align='center'><b>Concepto Gasto de Compra</b></td></tr>");
?>
<tr>
<td align="center" width="20%"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>M&eacute;todo de Prorrateo</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php
$color = 2;
for($i = 1; $i <= $fin_gasto_compra; $i++){
	if($matriz_gasto_compra[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_gasto_compra[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_gasto_compra[$i][1]);
	}
	printf("<td>%s</td>", $matriz_gasto_compra[$i][2]);
	printf("<td>%s</td>", $matriz_gasto_compra[$i][3]);
	printf("<td>%s</td></tr>", $matriz_gasto_compra[$i][4]);
	$color++;
}
?>
</tbody>
</table>

<?php } //fin if modulo compras ?>

<?php if($modulos == 'Impuestos' || $modulos == 'Todos') { //if modulo impuestos ?>

<br /><center><font size="+1"><b>Comercial - Impuestos</b></font></center>
<table border="1" cellpadding="2" align="center" width="70%">
<thead>
<?php
printf("<tr BGCOLOR='#ffffcc'><td colspan='6' align='center'><b>Tipo de Retenci&oacute;n</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Porcentaje</b></td>
<td align="center"><b>Cod. Cuenta</b></td>
<td align="center"><b>Cuenta</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php
$color = 2;
for($i = 1; $i <= $fin_retencion; $i++){
	if($matriz_retencion[$i][7] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_retencion[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_retencion[$i][1]);
	}
	printf("<td>%s</td>", $matriz_retencion[$i][2]);
	printf("<td align='right'>%s %s</td>", number_format($matriz_retencion[$i][3],2), '%');
	printf("<td align='center'>%s</td>", $matriz_retencion[$i][4]);
	printf("<td>%s</td>", $matriz_retencion[$i][5]);
	printf("<td>%s</td></tr>", $matriz_retencion[$i][6]);
	$color++;
}
?>
</tbody>
</table>

<?php } //fin if modulo impuestos ?>

<?php if($modulos == 'Contabilidad' || $modulos == 'Todos') { //if modulo contabilidad ?>

<br /><center><font size="+1"><b>Finanzas - Contabilidad</b></font></center>
<table border="1" cellpadding="2" align="center" width="70%">
<thead>
<?php
printf("<tr BGCOLOR='#ffffcc'><td colspan='6' align='center'><b>Estructura de Cuentas</b></td></tr>");
?>
<tr>
<td align="center" width="30%"><b>Total Digitos</b></td>
<td align="center" width="30%"><b>Total Niveles</b></td>
<td align="center" width="40%"><b>Formato</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php
$total_digitos = 0;
for($i = 0; $i <= $numero_niveles; $i++){
	$total_digitos = $total_digitos + $digitos_cuenta[$i];
}
if($editable_estructura == 0) { $editable = $editable0;
} else { $editable = $editable1;}
printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $total_digitos);
printf("<td align='center'>%s</td>", $numero_niveles);
printf("<td align='center'>%s</td></tr>", $estructura_cuenta);

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='70%'>";
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Moneda</b></td></tr>");
?>

<tr>
<td align="center" width="20%"><b>Cod.</b></td>
<td align="center" width="40%"><b>Nombre</b></td>
<td align="center" width="40%"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php
$color = 2;
for($i = 1; $i <= $fin_moneda; $i++){
	if($matriz_moneda[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_moneda[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_moneda[$i][1]);
	}
	printf("<td>%s</td>", $matriz_moneda[$i][2]);
	printf("<td>%s</td></tr>", $matriz_moneda[$i][3]);
	$color++;
}

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='70%'>";
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Tipo de Asiento</b></td></tr>");
?>
<tr>
<td align="center" width="20%"><b>Cod.</b></td>
<td align="center" width="40%"><b>Nombre</b></td>
<td align="center" width="40%"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php
$color = 2;
for($i = 1; $i <= $fin_tipo_asiento; $i++){
	if($matriz_tipo_asiento[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_tipo_asiento[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_tipo_asiento[$i][1]);
	}
	printf("<td>%s</td>", $matriz_tipo_asiento[$i][2]);
	printf("<td>%s</td></tr>", $matriz_tipo_asiento[$i][3]);
	$color++;
}

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='70%'>";
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Tipo de Centro de Costo</b></td></tr>");
?>
<tr>
<td colspan="3" align="center" width="100%"><b>Cod. - Nombre (Por Niveles)</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php
echo "<tr BGCOLOR='#e2e7fa'><td colspan='3' align='left'>";
echo dependientes();
echo "</td></tr>";

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='70%'>";
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Uso de Cuenta</b></td></tr>");
?>
<tr>
<td align="center" width="20%"><b>Cod.</b></td>
<td align="center" width="40%"><b>Nombre</b></td>
<td align="center" width="40%"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php
$color = 2;
for($i = 1; $i <= $fin_uso_cta; $i++){
	if($matriz_uso_cta[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_uso_cta[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_uso_cta[$i][1]);
	}
	printf("<td>%s</td>", $matriz_uso_cta[$i][2]);
	printf("<td>%s</td></tr>", $matriz_uso_cta[$i][3]);
	$color++;
}
?>
</tbody>
</table>

<?php } //fin if modulo contabilidad ?>

<?php if($modulos == 'Cobros' || $modulos == 'Todos') { //if modulo cobros ?>

<br /><center><font size="+1"><b>Finanzas - Cobranzas</b></font></center>
<table border="1" cellpadding="2" align="center" width="90%">
<thead>
<?php
printf("<tr BGCOLOR='#ffffcc'><td colspan='7' align='center'><b>Concepto de Cuentas por Cobrar</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Cod. Cta.</b></td>
<td align="center"><b>Cuenta</b></td>
<td align="center"><b>Cod. CC.</b></td>
<td align="center"><b>Centro de Costo</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_con_cxc; $i++){
	if($matriz_con_cxc[$i][8] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_con_cxc[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_con_cxc[$i][1]);
	}
	printf("<td>%s</td>", $matriz_con_cxc[$i][2]);
	printf("<td align='center'>%s</td>", $matriz_con_cxc[$i][3]);
	printf("<td>%s</td>", $matriz_con_cxc[$i][4]);
	printf("<td align='center'>%s</td>", $matriz_con_cxc[$i][5]);
	printf("<td>%s</td>", $matriz_con_cxc[$i][6]);
	printf("<td>%s</td></tr>", $matriz_con_cxc[$i][7]);
	$color++;
}

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='90%'>";
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='5' align='center'><b>Concepto de Ingreso</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Cod. Cta.</b></td>
<td align="center"><b>Cuenta</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_con_ing; $i++){
	if($matriz_con_ing[$i][6] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_con_ing[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_con_ing[$i][1]);
	}
	printf("<td>%s</td>", $matriz_con_ing[$i][2]);
	printf("<td align='center'>%s</td>", $matriz_con_ing[$i][3]);
	printf("<td>%s</td>", $matriz_con_ing[$i][4]);
	printf("<td>%s</td></tr>", $matriz_con_ing[$i][5]);
	$color++;
}

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='90%'>";
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='5' align='center'><b>V&iacute;a de Cobro</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Cod. Cta.</b></td>
<td align="center"><b>Cuenta</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
<?php 
$color = 2;
for($i = 1; $i <= $fin_via_cobro; $i++){
	if($matriz_via_cobro[$i][6] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_via_cobro[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_via_cobro[$i][1]);
	}
	printf("<td>%s</td>", $matriz_via_cobro[$i][2]);
	printf("<td align='center'>%s</td>", $matriz_via_cobro[$i][3]);
	printf("<td>%s</td>", $matriz_via_cobro[$i][4]);
	printf("<td>%s</td></tr>", $matriz_via_cobro[$i][5]);
	$color++;
}
?>
</tbody>
</table>

<?php } //fin if modulo cobros ?>

<?php if($modulos == 'Pagos' || $modulos == 'Todos') { //if modulo pagos ?>

<br /><center><font size="+1"><b>Finanzas - Pagos</b></font></center>
<table border="1" cellpadding="2" align="center" width="90%">
<thead>
<?php
printf("<tr BGCOLOR='#ffffcc'><td colspan='7' align='center'><b>Concepto de Cuentas por Pagar</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Cod. Cta.</b></td>
<td align="center"><b>Cuenta</b></td>
<td align="center"><b>Cod. CC.</b></td>
<td align="center"><b>Centro de Costo</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_con_cxp; $i++){
	if($matriz_con_cxp[$i][8] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_con_cxp[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_con_cxp[$i][1]);
	}
	printf("<td>%s</td>", $matriz_con_cxp[$i][2]);
	printf("<td align='center'>%s</td>", $matriz_con_cxp[$i][3]);
	printf("<td>%s</td>", $matriz_con_cxp[$i][4]);
	printf("<td align='center'>%s</td>", $matriz_con_cxp[$i][5]);
	printf("<td>%s</td>", $matriz_con_cxp[$i][6]);
	printf("<td>%s</td></tr>", $matriz_con_cxp[$i][7]);
	$color++;
}

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='90%'>";
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='6' align='center'><b>Concepto de Gasto</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Cod. Cta.</b></td>
<td align="center"><b>Cuenta</b></td>
<td align="center"><b>Ctrl. Item</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_con_gto; $i++){
	if($matriz_con_gto[$i][6] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_con_gto[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_con_gto[$i][1]);
	}
	printf("<td>%s</td>", $matriz_con_gto[$i][2]);
	printf("<td align='center'>%s</td>", $matriz_con_gto[$i][3]);
	printf("<td>%s</td>", $matriz_con_gto[$i][4]);
	printf("<td align='center'>%s</td>", $matriz_con_gto[$i][7]);
	printf("<td>%s</td></tr>", $matriz_con_gto[$i][5]);
	$color++;
}

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='90%'>";
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='6' align='center'><b>V&iacute;a de Pago</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Cod. Cta.</b></td>
<td align="center"><b>Cuenta</b></td>
<td align="center" colspan="2"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_via_pago; $i++){
	if($matriz_via_pago[$i][6] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_via_pago[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_via_pago[$i][1]);
	}
	printf("<td>%s</td>", $matriz_via_pago[$i][2]);
	printf("<td align='center'>%s</td>", $matriz_via_pago[$i][3]);
	printf("<td>%s</td>", $matriz_via_pago[$i][4]);
	printf("<td colspan='2'>%s</td></tr>", $matriz_via_pago[$i][5]);
	$color++;
}
?>
</tbody>
</table>

<?php } //fin if modulo pagos ?>

<?php if($modulos == 'Caja' || $modulos == 'Todos') { //if modulo caja ?>

<br /><center><font size="+1"><b>Finanzas - Caja</b></font></center>
<table border="1" cellpadding="2" align="center" width="90%">
<thead>
<?php

for($i = 1; $i <= $fin_mov_caja; $i++){//for mov caja
	echo "<tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Tipo de Movimiento</b></td></tr>";
	echo '<tr><td align="center" width="20%"><b>Cod.</b></td>
			<td align="center" width="40%"><b>Nombre</b></td>
			<td align="center" width="40%"><b>Descripci&oacute;n</b></td>
			</tr>';
	$cod_mov_caja_ = $matriz_mov_caja[$i][1];
	if($matriz_mov_caja[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>",$editable, $matriz_mov_caja[$i][1]);
	printf("<td>%s</td>", $matriz_mov_caja[$i][2]);
	printf("<td>%s</td></tr></thead><tbody class='marcafila'>", $matriz_mov_caja[$i][3]);
	$color = 2;
	echo "<tr><td colspan='3'>";
	echo '<table border="1" cellpadding="2" align="center" width="90%">';
	echo "<thead><tr BGCOLOR='#ffcc99'><td colspan='5' align='left'><b>Concepto de Movimiento</b></td></tr>";
	echo '<tr><td align="center"><b>Cod.</b></td>
		<td align="center"><b>Nombre</b></td>
		<td align="center"><b>Cod. Cta.</b></td>
		<td align="center"><b>Cuenta</b></td>
		<td align="center"><b>Descripci&oacute;n</b></td></tr></thead><tbody class="marcafila">';
	
	$result_mov_caja_det = mysqli_query($link, "select pkyPettyCashMovementTypeConcept as cod_mov_caja_det, fldName as mov_caja_det, codAccount as cod_cuenta, txtDescription as descripcion, sysEditable as editable
		from ptcPettyCashMovementTypeConcept
		where
		codPettyCashMovementType = '$cod_mov_caja_' 
		order by fldName;");
	$matriz_mov_caja_det = array();
	while ($row = mysqli_fetch_array($result_mov_caja_det)) {
		$cod_mov_caja_det_ = $row['cod_mov_caja_det'];
		$mov_caja_det_ = $row['mov_caja_det'];
		$cod_cuenta_ = $row['cod_cuenta'];
		$cuenta_ = NULL;
		$editable_det_ = $row['editable'];
		$descrip_det_ = $row['descripcion'];
		if($editable_det_ == 0) { $editable = $editable0;
		} else { $editable = $editable1;}
		if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $cod_mov_caja_det_);
		} else {
		printf("<td align='center'>%s %s</td>", $editable, $cod_mov_caja_det_);
		}
		printf("<td>%s</td>", $mov_caja_det_);
		printf("<td align='center'>%s</td>", $cod_cuenta_);
		
		if($cod_cuenta_ != NULL) {
		$result_cta_ = mysqli_query($link, "select fldName as cuenta
									from actAccount
									where
									pkyAccount = '$cod_cuenta_';");
			while ($row = mysqli_fetch_array($result_cta_)) {
				$cuenta_ = $row['cuenta'];
			}
		}
		printf("<td>%s</td>", $cuenta_);
		printf("<td>%s</td></tr>", $descrip_det_);
		$color++;
	}
	mysqli_free_result($result_mov_caja_det);
	echo "</td></tr>";
	echo "</tbody></table>";
	echo "<br>";
	
}//fin for mov caja

?>
</tbody>
</table>

<?php } //fin if modulo caja ?>

<?php if($modulos == 'Tesorería' || $modulos == 'Todos') { //if modulo tesoreria ?>

<br /><center><font size="+1"><b>Finanzas - Tesorer&iacute;a</b></font></center>
<table border="1" cellpadding="2" align="center" width="90%">
<thead>
<?php
printf("<tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Estado de Cheque</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_est_cheque; $i++){
	if($matriz_est_cheque[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_est_cheque[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_est_cheque[$i][1]);
	}
	printf("<td>%s</td>", $matriz_est_cheque[$i][2]);
	printf("<td>%s</td></tr>", $matriz_est_cheque[$i][3]);
	$color++;
}

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='90%'>";
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Tipo de Cuenta Bancaria</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_tipo_cta; $i++){
	if($matriz_tipo_cta[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_tipo_cta[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_tipo_cta[$i][1]);
	}
	printf("<td>%s</td>", $matriz_tipo_cta[$i][2]);
	printf("<td>%s</td></tr>", $matriz_tipo_cta[$i][3]);
	$color++;
}

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='90%'>";
echo "<thead>";
for($i = 1; $i <= $fin_mov_banco; $i++){//for mov banco
	echo "<tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Tipo de Movimiento Bancario</b></td></tr>";
	echo '<tr><td align="center" width="20%"><b>Cod.</b></td>
			<td align="center" width="40%"><b>Nombre</b></td>
			<td align="center" width="40%"><b>Descripci&oacute;n</b></td>
			</tr>';
	$cod_mov_banco_ = $matriz_mov_banco[$i][1];
	if($matriz_mov_banco[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_mov_banco[$i][1]);
	printf("<td>%s</td>", $matriz_mov_banco[$i][2]);
	printf("<td>%s</td></tr></thead><tbody class='marcafila'>", $matriz_mov_banco[$i][3]);
	$color = 2;
	echo "<tr><td colspan='3'>";
	echo '<table border="1" cellpadding="2" align="center" width="90%">';
	echo "<thead><tr BGCOLOR='#ffcc99'><td colspan='5' align='left'><b>Concepto de Movimiento</b></td></tr>";
	echo '<tr><td align="center"><b>Cod.</b></td>
		<td align="center"><b>Nombre</b></td>
		<td align="center"><b>Cod. Cta.</b></td>
		<td align="center"><b>Cuenta</b></td>
		<td align="center"><b>Descripci&oacute;n</b></td></tr></thead><tbody class="marcafila">';
	
	$result_mov_banco_det = mysqli_query($link, "select pkyBankMovementTypeConcept as cod_mov_banco_det, fldName as mov_banco_det, codAccount as cod_cuenta, txtDescription as descripcion, sysEditable as editable
		from tryBankMovementTypeConcept
		where
		codBankMovementType = '$cod_mov_banco_' 
		order by fldName;");
	$matriz_mov_banco_det = array();
	while ($row = mysqli_fetch_array($result_mov_banco_det)) {
		$cod_mov_banco_det_ = $row['cod_mov_banco_det'];
		$mov_banco_det_ = $row['mov_banco_det'];
		$cod_cuenta_ = $row['cod_cuenta'];
		$cuenta_ = NULL;
		$editable_det_ = $row['editable'];
		$descrip_det_ = $row['descripcion'];
		if($editable_det_ == 0) { $editable = $editable0;
		} else { $editable = $editable1;}
		if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $cod_mov_banco_det_);
		} else {
		printf("<td align='center'>%s %s</td>", $editable, $cod_mov_banco_det_);
		}
		printf("<td>%s</td>", $mov_banco_det_);
		printf("<td align='center'>%s</td>", $cod_cuenta_);
		
		if($cod_cuenta_ != NULL) {
		$result_cta_ = mysqli_query($link, "select fldName as cuenta
									from actAccount
									where
									pkyAccount = '$cod_cuenta_';");
			while ($row = mysqli_fetch_array($result_cta_)) {
				$cuenta_ = $row['cuenta'];
			}
		}
		printf("<td>%s</td>", $cuenta_);
		printf("<td>%s</td></tr>", $descrip_det_);
		$color++;
	}
	mysqli_free_result($result_mov_banco_det);
	echo "</td></tr>";
	echo "</tbody></table>";
	echo "<br>";
	
}//fin for mov banco
?>
</tbody>
</table>

<?php } //fin if modulo tesoreria ?>

<?php if($modulos == 'Acceso' || $modulos == 'Todos') { //if modulo acceso ?>

<br /><center><font size="+1"><b>Sistema - Acceso</b></font></center>
<table border="1" cellpadding="2" align="center" width="70%">
<thead>
<?php
printf("<tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Tipo de Identificador</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_tipo_id; $i++){
	if($matriz_tipo_id[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_tipo_id[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_tipo_id[$i][1]);
	}
	printf("<td>%s</td>", $matriz_tipo_id[$i][2]);
	printf("<td>%s</td></tr>", $matriz_tipo_id[$i][3]);
	$color++;
}

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='70%'>";
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Tipo de Usuario</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_tipo_us; $i++){
	if($matriz_tipo_us[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_tipo_us[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_tipo_us[$i][1]);
	}
	printf("<td>%s</td>", $matriz_tipo_us[$i][2]);
	printf("<td>%s</td></tr>", $matriz_tipo_us[$i][3]);
	$color++;
}
?>
</tbody>
</table>

<?php } //fin if modulo acceso ?>

<?php if($modulos == 'Base de datos' || $modulos == 'Todos') { //if modulo bd ?>

<br /><center><font size="+1"><b>Sistema - Base de Datos</b></font></center>
<table border="1" cellpadding="2" align="center" width="70%">
<thead>
<?php
printf("<tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Pol&iacute;tica de Transmisi&oacute;n</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_pol_trans; $i++){
	if($matriz_pol_trans[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_pol_trans[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_pol_trans[$i][1]);
	}
	printf("<td>%s</td>", $matriz_pol_trans[$i][2]);
	printf("<td>%s</td></tr>", $matriz_pol_trans[$i][3]);
	$color++;
}

?>
</tbody>
</table>

<?php } //fin if modulo bd ?>

<?php if($modulos == 'Servidor' || $modulos == 'Todos') { //if modulo servidor ?>

<br /><center><font size="+1"><b>Sistema - Servidor</b></font></center>
<table border="1" cellpadding="2" align="center" width="70%">
<thead>
<?php
printf("<tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Tipo de Componente</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_tipo_comp; $i++){
	if($matriz_tipo_comp[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_tipo_comp[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_tipo_comp[$i][1]);
	}
	printf("<td>%s</td>", $matriz_tipo_comp[$i][2]);
	printf("<td>%s</td></tr>", $matriz_tipo_comp[$i][3]);
	$color++;
}

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='70%'>";
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Tipo de Unidad de Medida</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_tipo_uni; $i++){
	if($matriz_tipo_uni[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_tipo_uni[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_tipo_uni[$i][1]);
	}
	printf("<td>%s</td>", $matriz_tipo_uni[$i][2]);
	printf("<td>%s</td></tr>", $matriz_tipo_uni[$i][3]);
	$color++;
}
?>
</tbody>
</table>

<?php } //fin if modulo servidor ?>

<?php if($modulos == 'Activos Fijos' || $modulos == 'Todos') { //if modulo activos fijos ?>

<br /><center><font size="+1"><b>Stock - Activos Fijos</b></font></center>
<table border="1" cellpadding="2" align="center" width="100%">
<thead>
<?php
printf("<tr BGCOLOR='#ffffcc'><td colspan='4' align='center'><b>Clasificaci&oacute;n de Activos Fijos</b></td></tr>");
?>
<tr>
<td align="center"><b>Familia</b></td>
<td align="center"><b>Sub Familia</b></td>
<td align="center"><b>Grupo</b></td>
<td align="center"><b>Sub Grupo</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
//$color = 2;

for($i = 1; $i <= $fin_cla_af; $i++){
	$cod_subfamilia_ = $matriz_cla_af [$i][3];
	$cod_grupo_ = $matriz_cla_af [$i][5];
	$cod_subgrupo_ = $matriz_cla_af [$i][7];
	
	if($cod_subfamilia_ != NULL) {
		$result_cla_ = mysqli_query($link, "select fldName as nombre
		from fasFixedAssetCategory
		where 
		pkyFixedAssetCategory = '$cod_subfamilia_';");
		while ($row = mysqli_fetch_array($result_cla_)) {
		$matriz_cla_af [$i][4] = $row['nombre'];
		}
		mysqli_free_result($result_cla_);
	}
	
	if($cod_grupo_ != NULL) {
		$result_cla_ = mysqli_query($link, "select fldName as nombre
		from fasFixedAssetCategory
		where 
		pkyFixedAssetCategory = '$cod_grupo_';");
		while ($row = mysqli_fetch_array($result_cla_)) {
		$matriz_cla_af [$i][6] = $row['nombre'];
		}
		mysqli_free_result($result_cla_);
	}
	
	if($cod_subgrupo_ != NULL) {
		$result_cla_ = mysqli_query($link, "select fldName as nombre
		from fasFixedAssetCategory
		where 
		pkyFixedAssetCategory = '$cod_subgrupo_';");
		while ($row = mysqli_fetch_array($result_cla_)) {
		$matriz_cla_af [$i][8] = $row['nombre'];
		}
		mysqli_free_result($result_cla_);
	}
	if($matriz_cla_af[$i][9] == 0) { $editable = $editable0;
		} else { $editable = $editable1;}
	
	if($i == 1) { //if para primero
		$color = 2;
		if($color % 2 == 0) { //if color
			printf("<tr BGCOLOR='#e2e7fa'><td>%s %s - %s</td>", $editable, $matriz_cla_af[$i][1], $matriz_cla_af[$i][2]);
		} else {
			printf("<tr><td>%s %s - %s</td>", $editable, $matriz_cla_af[$i][1], $matriz_cla_af[$i][2]);
		}
		printf("<td>%s - %s</td>", $matriz_cla_af[$i][3], $matriz_cla_af[$i][4]);
		printf("<td>%s - %s</td>", $matriz_cla_af[$i][5], $matriz_cla_af[$i][6]);
		printf("<td>%s - %s</td></tr>", $matriz_cla_af[$i][7], $matriz_cla_af[$i][8]);
	
	} else { //else if para primero
	
		if($matriz_cla_af[$i][1] != $matriz_cla_af[$i-1][1]) {//if 1m
			$color++;
			if($color % 2 == 0) { //if color
				printf("<tr BGCOLOR='#e2e7fa'><td>%s %s - %s</td>", $editable, $matriz_cla_af[$i][1], $matriz_cla_af[$i][2]);
			} else {
				printf("<tr><td>%s %s - %s</td>", $editable, $matriz_cla_af[$i][1], $matriz_cla_af[$i][2]);
			}
		} else {
			if($color % 2 == 0) { //if color
				printf("<tr BGCOLOR='#e2e7fa'><td>-</td>");
			} else {
				printf("<tr><td>-</td>");
			}	
	  	} //fin if 1m
	  	if($matriz_cla_af[$i][3] != $matriz_cla_af[$i-1][3]) {//if 3m
			printf("<td>%s - %s</td>", $matriz_cla_af[$i][3], $matriz_cla_af[$i][4]);
	  	} else {
			echo '<td>-</td>';	
		}//fin if 3m
	  	if($matriz_cla_af[$i][5] != $matriz_cla_af[$i-1][5]) {//if 5m
			printf("<td>%s - %s</td>", $matriz_cla_af[$i][5], $matriz_cla_af[$i][6]);
		} else {
			echo '<td>-</td>';
	  	} //fin if 5m
	  	if($matriz_cla_af[$i][7] != $matriz_cla_af[$i-1][7]) {//if 7m
			printf("<td>%s - %s</td></tr>", $matriz_cla_af[$i][7], $matriz_cla_af[$i][8]);
		} else {
			echo '<td>-</td></tr>';
	  	} //fin if 7m
	} //fin if para primero
	//$color++;
}

echo '</tbody></table>';
echo '<table border="1" cellpadding="2" align="center" width="100%">';
printf("<tr BGCOLOR='#ffffcc'><td colspan='14' align='center'><b>Categor&iacute;a de Activo Fijo</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Nivel</b></td>
<td align="center"><b>Cod. Cta. Alta</b></td>
<td align="center"><b>Cta. Alta</b></td>
<td align="center"><b>Cod. Cta. Dep.</b></td>
<td align="center"><b>Cta. Depreciaci&oacute;n Acumulada</b></td>
<td align="center"><b>Cod. Cta. Dep.</b></td>
<td align="center"><b>Cta. Depreciaci&oacute;n (Gasto)</b></td>
<td align="center"><b>Cod. Cta. Rev.</b></td>
<td align="center"><b>Cta. Revalorizaci&oacute;n</b></td>
<td align="center"><b>Tiempo Depreciaci&oacute;n (Meses)</b></td>
<td align="center"><b>¿Sujeto a Depreciaci&oacute;n?</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 

$color = 2;
for($i = 1; $i <= $fin_cat_af; $i++){
	if($matriz_cat_af[$i][15] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_cat_af[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_cat_af[$i][1]);
	}
	$cod_cta_alta_ = $matriz_cat_af[$i][4];
	$cod_cta_dep_acum_ = $matriz_cat_af[$i][6];
	$cod_cta_dep_gasto_ = $matriz_cat_af[$i][8];
	$cod_cta_rev_ = $matriz_cat_af[$i][10];
	printf("<td>%s</td>", $matriz_cat_af[$i][2]);//nombre
	printf("<td align='center'>%s</td>", $matriz_cat_af[$i][3]);//nivel
	printf("<td align='center'>%s</td>", $matriz_cat_af[$i][4]);//cod cta alta
	if($cod_cta_alta_ != NULL) {
		$result_cta_ = mysqli_query($link, "select fldName as cuenta
		from actAccount
		where
		pkyAccount = '$cod_cta_alta_';");
		while ($row = mysqli_fetch_array($result_cta_)) {
		$matriz_cat_af [$i][5] = $row['cuenta'];
		}
		mysqli_free_result($result_cta_);
	}
	if($cod_cta_dep_acum_ != NULL) {
		$result_cta_ = mysqli_query($link, "select fldName as cuenta
		from actAccount
		where
		pkyAccount = '$cod_cta_dep_acum_';");
		while ($row = mysqli_fetch_array($result_cta_)) {
		$matriz_cat_af [$i][7] = $row['cuenta'];
		}
		mysqli_free_result($result_cta_);
	}
	if($cod_cta_dep_gasto_ != NULL) {
		$result_cta_ = mysqli_query($link, "select fldName as cuenta
		from actAccount
		where
		pkyAccount = '$cod_cta_dep_gasto_';");
		while ($row = mysqli_fetch_array($result_cta_)) {
		$matriz_cat_af [$i][9] = $row['cuenta'];
		}
		mysqli_free_result($result_cta_);
	}
	if($cod_cta_rev_ != NULL) {
		$result_cta_ = mysqli_query($link, "select fldName as cuenta
		from actAccount
		where
		pkyAccount = '$cod_cta_rev_';");
		while ($row = mysqli_fetch_array($result_cta_)) {
		$matriz_cat_af [$i][11] = $row['cuenta'];
		}
		mysqli_free_result($result_cta_);
	}
	printf("<td>%s</td>", $matriz_cat_af[$i][5]);//cta alta
	printf("<td align='center'>%s</td>", $matriz_cat_af[$i][6]);//cod cta dep acum
	printf("<td>%s</td>", $matriz_cat_af[$i][7]);//cta dep acum
	printf("<td align='center'>%s</td>", $matriz_cat_af[$i][8]);//cod cta dep gasto
	printf("<td>%s</td>", $matriz_cat_af[$i][9]);//cta dep gasto
	printf("<td align='center'>%s</td>", $matriz_cat_af[$i][10]);//cod cta rev
	printf("<td>%s</td>", $matriz_cat_af[$i][11]);//cta rev
	printf("<td align='center'>%s</td>", $matriz_cat_af[$i][12]);//tiempo dep
	printf("<td align='center'>%s</td>", $matriz_cat_af[$i][13]);//es dep
	printf("<td>%s</td></tr>", $matriz_cat_af[$i][14]);//descripcion
	$color++;
}

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='90%'>";
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Tipo de Movimiento</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_tipo_mov_af; $i++){
	if($matriz_tipo_mov_af[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_tipo_mov_af[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_tipo_uni[$i][1]);
	}
	printf("<td>%s</td>", $matriz_tipo_mov_af[$i][2]);
	printf("<td>%s</td></tr>", $matriz_tipo_mov_af[$i][3]);
	$color++;
}
?>
</tbody>
</table>

<?php } //fin if modulo activos fijos ?>

<?php if($modulos == 'Inventario' || $modulos == 'Todos') { //if modulo inventario ?>

<br /><center><font size="+1"><b>Stock - Inventario</b></font></center>
<table border="1" cellpadding="2" align="center" width="80%">
<thead>
<?php
printf("<tr BGCOLOR='#ffffcc'><td colspan='4' align='center'><b>Clasificaci&oacute;n de Items</b></td></tr>");
?>
<tr>
<td align="center"><b>Familia</b></td>
<td align="center"><b>Sub Familia</b></td>
<td align="center"><b>Grupo</b></td>
<td align="center"><b>Sub Grupo</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
//$color = 2;

for($i = 1; $i <= $fin_cla_item; $i++){
	$cod_subfamilia_ = $matriz_cla_item [$i][3];
	$cod_grupo_ = $matriz_cla_item [$i][5];
	$cod_subgrupo_ = $matriz_cla_item [$i][7];
	
	if($cod_subfamilia_ != NULL) {
		$result_cla_ = mysqli_query($link, "select fldName as nombre
		from invItemCategory
		where 
		pkyItemCategory = '$cod_subfamilia_';");
		while ($row = mysqli_fetch_array($result_cla_)) {
		$matriz_cla_item [$i][4] = $row['nombre'];
		}
		mysqli_free_result($result_cla_);
	}
	
	if($cod_grupo_ != NULL) {
		$result_cla_ = mysqli_query($link, "select fldName as nombre
		from invItemCategory
		where 
		pkyItemCategory = '$cod_grupo_';");
		while ($row = mysqli_fetch_array($result_cla_)) {
		$matriz_cla_item [$i][6] = $row['nombre'];
		}
		mysqli_free_result($result_cla_);
	}
	
	if($cod_subgrupo_ != NULL) {
		$result_cla_ = mysqli_query($link, "select fldName as nombre
		from invItemCategory
		where 
		pkyItemCategory = '$cod_subgrupo_';");
		while ($row = mysqli_fetch_array($result_cla_)) {
		$matriz_cla_item [$i][8] = $row['nombre'];
		}
		mysqli_free_result($result_cla_);
	}
	if($matriz_cla_item[$i][9] == 0) { $editable = $editable0;
		} else { $editable = $editable1;}
	
	if($i == 1) { //if para primero
		$color = 2;
		if($color % 2 == 0) { //if color
			printf("<tr BGCOLOR='#e2e7fa'><td>%s %s - %s</td>", $editable, $matriz_cla_item[$i][1], $matriz_cla_item[$i][2]);
		} else {
			printf("<tr><td>%s %s - %s</td>", $editable, $matriz_cla_item[$i][1], $matriz_cla_item[$i][2]);
		}
		printf("<td>%s - %s</td>", $matriz_cla_item[$i][3], $matriz_cla_item[$i][4]);
		printf("<td>%s - %s</td>", $matriz_cla_item[$i][5], $matriz_cla_item[$i][6]);
		printf("<td>%s - %s</td></tr>", $matriz_cla_item[$i][7], $matriz_cla_item[$i][8]);
	
	} else { //else if para primero
	
		if($matriz_cla_item[$i][1] != $matriz_cla_item[$i-1][1]) {//if 1m
			$color++;
			if($color % 2 == 0) { //if color
				printf("<tr BGCOLOR='#e2e7fa'><td>%s %s - %s</td>", $editable, $matriz_cla_item[$i][1], $matriz_cla_item[$i][2]);
			} else {
				printf("<tr><td>%s %s - %s</td>", $editable, $matriz_cla_item[$i][1], $matriz_cla_item[$i][2]);
			}
		} else {
			if($color % 2 == 0) { //if color
				printf("<tr BGCOLOR='#e2e7fa'><td>-</td>");
			} else {
				printf("<tr><td>-</td>");
			}	
	  	} //fin if 1m
	  	if($matriz_cla_item[$i][3] != $matriz_cla_item[$i-1][3]) {//if 3m
			printf("<td>%s - %s</td>", $matriz_cla_item[$i][3], $matriz_cla_item[$i][4]);
	  	} else {
			echo '<td>-</td>';	
		}//fin if 3m
	  	if($matriz_cla_item[$i][5] != $matriz_cla_item[$i-1][5]) {//if 5m
			printf("<td>%s - %s</td>", $matriz_cla_item[$i][5], $matriz_cla_item[$i][6]);
		} else {
			echo '<td>-</td>';
	  	} //fin if 5m
	  	if($matriz_cla_item[$i][7] != $matriz_cla_item[$i-1][7]) {//if 7m
			printf("<td>%s - %s</td></tr>", $matriz_cla_item[$i][7], $matriz_cla_item[$i][8]);
		} else {
			echo '<td>-</td></tr>';
	  	} //fin if 7m
	} //fin if para primero
	//$color++;
}

echo '</tbody></table>';
echo '<table border="1" cellpadding="2" align="center" width="90%">';
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='8' align='center'><b>Categor&iacute;a de Item</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Nivel</b></td>
<td align="center"><b>Cod. Cta.</b></td>
<td align="center"><b>Cuenta</b></td>
<td align="center"><b>Cod. Cta. Costo</b></td>
<td align="center"><b>Cuenta de Costo</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_cat_item; $i++){
	if($matriz_cat_item[$i][9] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_cat_item[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_cat_item[$i][1]);
	}
	$cod_cta_ = $matriz_cat_item [$i][4];
	$cod_cta_costo_ = $matriz_cat_item [$i][6];
	$descripcion_ = $matriz_cat_item [$i][8];
	printf("<td>%s</td>", $matriz_cat_item[$i][2]);
	printf("<td align='center'>%s</td>", $matriz_cat_item[$i][3]);
	if($cod_cta_ != NULL) {
		$result_cta_ = mysqli_query($link, "select fldName as cuenta
		from actAccount
		where
		pkyAccount = '$cod_cta_';");
		while ($row = mysqli_fetch_array($result_cta_)) {
		$matriz_cat_item [$i][5] = $row['cuenta'];
		}
		mysqli_free_result($result_cta_);
	}
	
	if($cod_cta_costo_ != NULL) {
		$result_cc_ = mysqli_query($link, "select fldName as cuenta
		from actAccount
		where
		pkyAccount = '$cod_cta_costo_';");
		while ($row = mysqli_fetch_array($result_cc_)) {
		$matriz_cat_item [$i][7] = $row['cuenta'];
		}
		mysqli_free_result($result_cc_);
	}
	printf("<td align='center'>%s</td>", $cod_cta_);
	printf("<td>%s</td>", $matriz_cat_item [$i][5]);	
	printf("<td align='center'>%s</td>", $cod_cta_costo_);
	printf("<td>%s</td>", $matriz_cat_item [$i][7]);
	printf("<td>%s</td></tr>", $descripcion_);
	$color++;
}

echo '</tbody></table>';
echo '<table border="1" cellpadding="2" align="center" width="90%">';
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Tipo de Item</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_tipo_item; $i++){
	if($matriz_tipo_item[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_tipo_item[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_tipo_item[$i][1]);
	}
	printf("<td>%s</td>", $matriz_tipo_item[$i][2]);
	printf("<td>%s</td></tr>", $matriz_tipo_item[$i][3]);
	$color++;
}

echo "</tbody></table>";
echo "<table border='1' cellpadding='2' align='center' width='90%'>";
echo "<thead>";

for($i = 1; $i <= $fin_tipo_mov; $i++){//for concepto mov
	echo "<tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Tipo de Movimiento</b></td></tr>";
	echo '<tr><td align="center" width="20%"><b>Cod.</b></td>
			<td align="center" width="40%"><b>Nombre</b></td>
			<td align="center" width="40%"><b>Descripci&oacute;n</b></td>
			</tr>';
	$cod_tipo_mov_ = $matriz_tipo_mov[$i][1];
	if($matriz_tipo_mov[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_tipo_mov[$i][1]);
	printf("<td>%s</td>", $matriz_tipo_mov[$i][2]);
	printf("<td>%s</td></tr></thead><tbody class='marcafila'>", $matriz_tipo_mov[$i][3]);
	$color = 2;
	echo "<tr><td colspan='3'>";
	echo '<table border="1" cellpadding="2" align="center" width="90%">';
	echo "<thead><tr BGCOLOR='#ffcc99'><td colspan='6' align='left'><b>Concepto de Movimiento</b></td></tr>";
	echo '<tr><td align="center"><b>Cod.</b></td>
		<td align="center"><b>Nombre</b></td>
		<td align="center"><b>Cod. Cta.</b></td>
		<td align="center"><b>Cuenta</b></td>
		<td align="center"><b>Ctrl. Item</b></td>
		<td align="center"><b>Descripci&oacute;n</b></td></tr></thead><tbody class="marcafila">';
	
	$result_tipo_mov_det = mysqli_query($link, "select pkyItemMovementTypeConcept as cod_tipo_mov_det, 
	fldName as tipo_mov_det, codAccount as cod_cuenta, fldItemControl as ctrl_item, 	
	txtDescription as descripcion, sysEditable as editable
	from invItemMovementTypeConcept
	where
	codItemMovementType = '$cod_tipo_mov_' 
	order by fldName;");
	$matriz_tipo_mov_det = array();
	while ($row = mysqli_fetch_array($result_tipo_mov_det)) {
		$cod_tipo_mov_det_ = $row['cod_tipo_mov_det'];
		$tipo_mov_det_ = $row['tipo_mov_det'];
		$cod_cuenta_ = $row['cod_cuenta'];
		$cuenta_ = NULL;
		if($row['ctrl_item'] == 0) { $ctrl_item_det_ = 'No';
		} else { $ctrl_item_det_ = 'Si';
		}
		$descrip_det_ = $row['descripcion'];
		$editable_det_ = $row['editable'];
		if($editable_det_ == 0) { $editable = $editable0;
		} else { $editable = $editable1;}
		if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $cod_tipo_mov_det_);
		} else {
		printf("<td align='center'>%s %s</td>", $editable, $cod_tipo_mov_det_);
		}
		printf("<td>%s</td>", $tipo_mov_det_);
		printf("<td align='center'>%s</td>", $cod_cuenta_);
		
		if($cod_cuenta_ != NULL) {
		$result_cta_ = mysqli_query($link, "select fldName as cuenta
									from actAccount
									where
									pkyAccount = '$cod_cuenta_';");
			while ($row = mysqli_fetch_array($result_cta_)) {
				$cuenta_ = $row['cuenta'];
			}
		}
		printf("<td>%s</td>", $cuenta_);
		printf("<td align='center'>%s</td>", $ctrl_item_det_);
		printf("<td>%s</td></tr>", $descrip_det_);
		$color++;
	}
	mysqli_free_result($result_tipo_mov_det);
	echo "</td></tr>";
	echo "</tbody></table>";
	echo "<br>";
	
}//fin for concepto mov

echo "</tbody></table>";
echo '<table border="1" cellpadding="2" align="center" width="90%">';
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='4' align='center'><b>Unidad de Almacenamiento</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Abrev.</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_uni; $i++){
	if($matriz_uni[$i][5] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_uni[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_uni[$i][1]);
	}
	printf("<td>%s</td>", $matriz_uni[$i][2]);
	printf("<td>%s</td>", $matriz_uni[$i][3]);
	printf("<td>%s</td></tr>", $matriz_uni[$i][4]);
	$color++;
}

?>
</tbody>
</table>

<?php } //fin if modulo inventario ?>

<?php if($modulos == 'Producción' || $modulos == 'Todos') { //if modulo produccion ?>

<br /><center><font size="+1"><b>Stock - Producci&oacute;n</b></font></center>
<table border="1" cellpadding="2" align="center" width="90%">
<thead>
<?php
printf("<tr BGCOLOR='#ffffcc'><td colspan='7' align='center'><b>L&iacute;nea de Producci&oacute;n</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Cod. Alm. Mat. Pri.</b></td>
<td align="center"><b>Alm. Materia Prima</b></td>
<td align="center"><b>Cod. Alm. Prod. Term.</b></td>
<td align="center"><b>Alm. Producto Terminado</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_linea_prod; $i++){
	if($matriz_linea_prod[$i][8] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_linea_prod[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_linea_prod[$i][1]);
	}
	printf("<td>%s</td>", $matriz_linea_prod[$i][2]);
	printf("<td align='center'>%s</td>", $matriz_linea_prod[$i][3]);
	printf("<td>%s</td>", $matriz_linea_prod[$i][4]);
	printf("<td align='center'>%s</td>", $matriz_linea_prod[$i][5]);
	printf("<td>%s</td>", $matriz_linea_prod[$i][6]);
	printf("<td>%s</td></tr>", $matriz_linea_prod[$i][7]);
	$color++;
}
?>
</tbody>
</table>

<?php } //fin if modulo produccion ?>

<?php if($modulos == 'Vehículos' || $modulos == 'Todos') { //if modulo vehiculos ?>

<br /><center><font size="+1"><b>Stock - Veh&iacute;culos</b></font></center>
<table border="1" cellpadding="2" align="center" width="70%">
<thead>
<?php
printf("<tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Equipamiento del Veh&iacute;culo</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_equip; $i++){
	if($matriz_equip[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_equip[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_equip[$i][1]);
	}
	printf("<td>%s</td>", $matriz_equip[$i][2]);
	printf("<td>%s</td></tr>", $matriz_equip[$i][3]);
	$color++;
}

echo '</tbody></table>';
echo '<table border="1" cellpadding="2" align="center" width="70%">';
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Estado de Contrato</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_estado; $i++){
	if($matriz_estado[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_estado[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_estado[$i][1]);
	}
	printf("<td>%s</td>", $matriz_estado[$i][2]);
	printf("<td>%s</td></tr>", $matriz_estado[$i][3]);
	$color++;
}

echo '</tbody></table>';
echo '<table border="1" cellpadding="2" align="center" width="70%">';
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Extras</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_extras; $i++){
	if($matriz_extras[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_extras[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_extras[$i][1]);
	}
	printf("<td>%s</td>", $matriz_extras[$i][2]);
	printf("<td>%s</td></tr>", $matriz_extras[$i][3]);
	$color++;
}

echo '</tbody></table>';
echo '<table border="1" cellpadding="2" align="center" width="70%">';
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Seguro</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_seguro; $i++){
	if($matriz_seguro[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_seguro[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_seguro[$i][1]);
	}
	printf("<td>%s</td>", $matriz_seguro[$i][2]);
	printf("<td>%s</td></tr>", $matriz_seguro[$i][3]);
	$color++;
}

echo '</tbody></table>';
echo '<table border="1" cellpadding="2" align="center" width="70%">';
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Tipo de Combustible</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_comb; $i++){
	if($matriz_comb[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_comb[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_comb[$i][1]);
	}
	printf("<td>%s</td>", $matriz_comb[$i][2]);
	printf("<td>%s</td></tr>", $matriz_comb[$i][3]);
	$color++;
}

echo '</tbody></table>';
echo '<table border="1" cellpadding="2" align="center" width="70%">';
printf("<thead><tr BGCOLOR='#ffffcc'><td colspan='3' align='center'><b>Tipo de Contrato</b></td></tr>");
?>
<tr>
<td align="center"><b>Cod.</b></td>
<td align="center"><b>Nombre</b></td>
<td align="center"><b>Descripci&oacute;n</b></td>
</tr>
</thead>
<tbody class="marcafila">
<?php 
$color = 2;
for($i = 1; $i <= $fin_cont; $i++){
	if($matriz_cont[$i][4] == 0) { $editable = $editable0;
	} else { $editable = $editable1;}
	if($color % 2 == 0) { //if color
		printf("<tr BGCOLOR='#e2e7fa'><td align='center'>%s %s</td>", $editable, $matriz_cont[$i][1]);
	} else {
		printf("<tr><td align='center'>%s %s</td>", $editable, $matriz_cont[$i][1]);
	}
	printf("<td>%s</td>", $matriz_cont[$i][2]);
	printf("<td>%s</td></tr>", $matriz_cont[$i][3]);
	$color++;
}
?>
</tbody>
</table>

<?php } //fin if modulo vehiculos ?>

<?php if($modulos == 'Comunicación' || $modulos == 'Región' || $modulos == 'Ventas') { //if modulo sin conf ?>

<br /><center><font color="#FF0000" size="+1"><b>M&oacute;dulo sin par&aacute;metros de configuraci&oacute;n</b></font></center>

<?php } //fin if modulo sin conf ?>


<?php 
} //fin if 2
?>
</body>
</html>
