<!DOCTYPE html>
<html lang="es-ES">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Empresa</title>
<link href="../../maincss.css" rel="stylesheet" type="text/css" />
<link href="../../printcss.css" rel="stylesheet" type="text/css" media="print" />

<script language="JavaScript"> 
 
function oculta(id){
	 var elDiv = document.getElementById(id); //se define la variable "elDiv" igual a nuestro div
	 elDiv.style.display='none'; //damos un atributo display:none que oculta el div	 
	}
 
function muestra(id){
	 var elDiv = document.getElementById(id); //se define la variable "elDiv" igual a nuestro div
	 elDiv.style.display='block';//damos un atributo display:block que  el div	 
	}
 
window.onload = function(){/*hace que se cargue la función */
/* "Mandamos como parametro el nombre de la Div para ocultar" */
oculta('Pcatalogo');
}
</script>
</head>
<?php
include "../../conn.php";
include "../../class.nroenletraver2.php";
include "../../general.php";
include "../../token.php";

//index.php?pkyCompany=2&user=Luigi&token=123456

$cod_empresa = $_GET["pkyCompany"];
//$usuario = $_GET["user"];

?>
<body>

<?php

// Inicio impresion Empresa

$result = mysqli_query($link, "select a.pkyCompany as codigo, a.fldName as empresa, a.codType as cod_tipo, b.fldName as tipo, a.fldNIT as nit, a.codCityLocation as cod_ciu, c.fldName as ciudad, a.codHeading as cod_rubro, d.fldName as rubro, a.fldWebSite as sitio_web, a.fldZipCode as casilla, a.fldAlternativeKey as cod_alt, a.fldIsClient as es_cliente, a.fldIsSupplier as es_prov, a.codPurchaseType as cod_tipo_compra, a.codSalesType as cod_tipo_venta, a.codPriceList as cod_lista, a.codChannel as cod_canal, a.fldCreditDays as dias_cred, a.fldMaxInvoiceReceptionDay as dia_max, a.codSeller as cod_vendedor, a.txtDescription as glosa, g.fldName as usuario_reg 
from 
agnCompany a, agnCompanyType b, regCity c, agnCompanyHeading d, accGroup g 
where
a.pkyCompany = '$cod_empresa' and 
a.codType = b.pkyCompanyType and 
a.codCityLocation = c.pkyCity and 
a.codHeading = d.pkyCompanyHeading and 
a.sysAuthorizationGroup = g.pkyGroup; ");
	while ($row = mysqli_fetch_array($result)) {
		$codigo = $row['codigo'];
		$empresa = $row['empresa'];
		$cod_tipo = $row['cod_tipo'];
		$tipo_emp = $row['tipo'];
		$nit = $row['nit'];
		$cod_ciudad = $row['cod_ciu'];
		$ciudad = $row['ciudad'];
		$cod_rubro = $row['cod_rubro'];
		$rubro = $row['rubro'];
		$sitio_web = $row['sitio_web'];
		$casilla = $row['casilla'];
		$cod_alt = $row['cod_alt'];
		if($row['es_cliente'] == 1) {
		$es_cliente = 'Si';
		} else {
		$es_cliente = 'No';	
		}
		if($row['es_prov'] == 1) {
		$es_prov = 'Si';
		} else {
		$es_prov = 'No';	
		}
		$cod_tipo_compra = $row['cod_tipo_compra'];
		$cod_tipo_venta = $row['cod_tipo_venta'];
		$cod_lista = $row['cod_lista'];
		$cod_canal = $row['cod_canal'];
		$dias_cred = $row['dias_cred'];
		$dia_max = $row['dia_max'];
		$cod_vendedor = $row['cod_vendedor'];
		$glosa = $row['glosa'];
		$glosa = nl2br($glosa);//quita salto de linea 
		$glosa = str_replace('\n','<br />',$glosa);//reemplaza para salto de linea
		$usuario_reg = $row['usuario_reg'];
	}
	mysqli_free_result($result);
	

$resultlista = mysqli_query($link, "select pkyPriceList as cod_lista, fldName as lista 
from slsPriceList
where 
pkyPriceList = '$cod_lista';");
while ($row = mysqli_fetch_array($resultlista)) {
	$lista = $row['lista'];
}
mysqli_free_result($resultlista);

$resultcanal = mysqli_query($link, "select pkyChannel as cod_canal, fldName as canal 
from agnChannel
where 
pkyChannel = '$cod_canal';");
while ($row = mysqli_fetch_array($resultcanal)) {
	$canal = $row['canal'];
}
mysqli_free_result($resultcanal);

$resultvendedor = mysqli_query($link, "select pkyPerson as codigo, case when fldMiddleName is NULL then concat(fldLastName,', ',fldFirstName) else concat(fldLastName,' ',fldMiddleName,', ',fldFirstName) end as vendedor
from agnPerson
where 
pkyPerson = '$cod_vendedor';");
while ($row = mysqli_fetch_array($resultvendedor)) {
	$vendedor = $row['vendedor'];
}
mysqli_free_result($resultvendedor);

$resultdir = mysqli_query($link, "select a.fldAddress as direccion, b.fldName as tipo_dir, a.fldDefault as principal, a.txtDescription as glosa
from
agnCompanyAddress a, agnAddressType b
where
a.codType = b.pkyAddressType and 
a.codCompany = '$cod_empresa' 
order by principal desc, direccion;");
$ma_dir = array();
$d = 1;
while ($row = mysqli_fetch_array($resultdir)) {
	$ma_dir [$d][1] = $row['direccion'];
	$ma_dir [$d][2] = $row['tipo_dir'];
	if($row['principal'] == 1) {
	$ma_dir [$d][3] = 'Si';
	} else {
	$ma_dir [$d][3] = ' ';	
	}
	$ma_dir [$d][4] = $row['glosa'];
	$d++;
}
$hay_direccion = mysqli_num_rows($resultdir);
mysqli_free_result($resultdir);
$fin_d = $d - 1;

$resultsuc = mysqli_query($link, "select a.fldName as nombre, a.fldID as id, a.codCity as cod_ciu, b.fldName as ciudad, a.fldPhone as tel, a.fldAddress as direcc, a.fldHealthFundCode as codigo_cns, a.txtDescription as glosa 
from agnCompanyBranch a, regCity b
where 
a.codCity = b.pkyCity and 
a.codCompany = '$cod_empresa' 
order by id desc, nombre, ciudad;");
$ma_suc = array();
$s = 1;
while ($row = mysqli_fetch_array($resultsuc)) {
	$ma_suc [$s][1] = $row['nombre'];
	$ma_suc [$s][2] = $row['id'];
	$ma_suc [$s][3] = $row['ciudad'];
	$ma_suc [$s][4] = $row['tel'];
	$ma_suc [$s][5] = $row['direcc'];
	$ma_suc [$s][6] = $row['codigo_cns'];
	$ma_suc [$s][7] = $row['glosa'];
	$s++;
}
mysqli_free_result($resultsuc);
$fin_s = $s - 1;

$resulttarjeta = mysqli_query($link, "select b.fldName as tipo, a.fldNumber as numero, a.fldName as nombre, a.fldSecurityNumber as nro_seg, a.fldIssuedDate as fecha_emi, a.fldExpiringDate as fecha_exp, a.txtDescription as glosa 
from agnCompanyCreditCard a, agnCreditCardType b
where 
a.codType = b.pkyCreditCardType and 
a.codCompany = '$cod_empresa' 
order by tipo, numero;");
$ma_tarj = array();
$t = 1;
while ($row = mysqli_fetch_array($resulttarjeta)) {
	$ma_tarj [$t][1] = $row['tipo'];
	$ma_tarj [$t][2] = $row['numero'];
	$ma_tarj [$t][3] = $row['nombre'];
	$ma_tarj [$t][4] = $row['nro_seg'];
	$ma_tarj [$t][5] = $row['fecha_emi'];
	$ma_tarj [$t][6] = $row['fecha_exp'];
	$ma_tarj [$t][7] = $row['glosa'];
	$t++;
}
$hay_tarjeta = mysqli_num_rows($resulttarjeta);
mysqli_free_result($resulttarjeta);
$fin_t = $t - 1;

$resultdoc = mysqli_query($link, "select a.fldNumber as numero, b.fldName as tipo, a.fldIssuedDate as fecha_nac, a.fldExpiringDate as fecha_exp, a.txtDescription as glosa 
from agnCompanyIdentityDocument a, agnIdentityDocumentType b
where 
a.codType = b.pkyIdentityDocumentType and 
a.codCompany = '$cod_empresa' 
order by tipo, numero;");
$ma_doc = array();
$do = 1;
while ($row = mysqli_fetch_array($resultdoc)) {
	$ma_doc [$do][1] = $row['numero'];
	$ma_doc [$do][2] = $row['tipo'];
	$ma_doc [$do][3] = $row['fecha_nac'];
	$ma_doc [$do][4] = $row['fecha_exp'];
	$ma_doc [$do][5] = $row['glosa'];
	$do++;
}
$hay_documento = mysqli_num_rows($resultdoc);
mysqli_free_result($resultdoc);
$fin_do = $do - 1;

$resultmail = mysqli_query($link, "select a.fldMail as correo, b.fldName as tipo, a.fldDefault as principal, a.txtDescription as glosa 
from agnCompanyMail a, agnMailType b
where 
a.codType = b.pkyMailType and 
a.codCompany = '$cod_empresa' 
order by principal desc, tipo, correo;");
$ma_mail = array();
$m = 1;
while ($row = mysqli_fetch_array($resultmail)) {
	$ma_mail [$m][1] = $row['correo'];
	$ma_mail [$m][2] = $row['tipo'];
	if($row['principal'] == 1) {
	$ma_mail [$m][3] = 'Si';
	} else {
	$ma_mail [$m][3] = ' ';	
	}
	$ma_mail [$m][4] = $row['glosa'];
	$m++;
}
$hay_mail = mysqli_num_rows($resultmail);
mysqli_free_result($resultmail);
$fin_m = $m - 1;

$resulttel = mysqli_query($link, "select a.fldPhone as telefono, b.fldName as tipo, a.fldDefault as principal, a.txtDescription as glosa 
from agnCompanyPhone a, agnPhoneType b
where 
a.codType = b.pkyPhoneType and 
a.codCompany = '$cod_empresa' 
order by principal desc, tipo, telefono;");
$ma_tel = array();
$te = 1;
while ($row = mysqli_fetch_array($resulttel)) {
	$ma_tel [$te][1] = $row['telefono'];
	$ma_tel [$te][2] = $row['tipo'];
	if($row['principal'] == 1) {
	$ma_tel [$te][3] = 'Si';
	} else {
	$ma_tel [$te][3] = ' ';
	}
	$ma_tel [$te][4] = $row['glosa'];
	$te++;
}
$hay_telefono = mysqli_num_rows($resulttel);
mysqli_free_result($resulttel);
$fin_te = $te - 1;


//catalogo	
$resultcat = mysqli_query($link, "select a.codItem as cod_item, b.fldName as item, c.fldName as moneda, a.fldPrice as precio, a.fldDeliveryDays as dias_ent, a. fldFactoryKey as cod_fabrica 
from pchSupplierCatalog a, invItem b, actCurrency c
where 
a.codItem = b.pkyItem and 
a.codCurrency = c.pkyCurrency and 
a.codSupplier = '$cod_empresa' 
order by item;");
$ma_cat = array();
$ca = 1;
while ($row = mysqli_fetch_array($resultcat)) {
	$ma_cat [$ca][1] = $row['cod_item'];
	$ma_cat [$ca][2] = $row['item'];
	$ma_cat [$ca][3] = $row['moneda'];
	$ma_cat [$ca][4] = $row['precio'];
	$ma_cat [$ca][5] = $row['dias_ent'];
	$ma_cat [$ca][6] = $row['cod_fabrica'];
	$ca++;
}
$hay_catalogo = mysqli_num_rows($resultcat);
mysqli_free_result($resultcat);
$fin_ca = $ca - 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>Empresa</b></font></center></p>

<table border="0" cellpadding="2" align="center" width="100%">
<tr>
<td>  
    <table border="1" align="center" cellpadding="2" width="100%">
        <TR> 
        <TD width="33%"><b>Cod.: </b><?php echo $cod_empresa; ?></TD>
        <TD width="33%"><b>Cod. Alt.: </b><?php echo $cod_alt; ?></TD>
        <TD width="33%"><b>Ciudad: </b><?php echo $ciudad; ?></TD>
        </TR>
        <TR>
        <TD><b>Nombre: </b><?php echo $empresa; ?></TD>
        <TD><b>Tipo: </b><?php echo $tipo_emp; ?></TD>
        <TD><b>Rubro: </b><?php echo $rubro; ?></TD>
        </TR>
        <TR>
        <TD><b>NIT: </b><?php echo $nit; ?></TD>
        <TD><b>Web: </b><?php echo $sitio_web; ?></TD>
        <TD><b>Casilla: </b><?php echo $casilla; ?></a></TD>
        </TR>
        <TR>
        <TD><b>Canal: </b><?php echo $canal; ?></TD>
		<TD><b>Lista de Precios: </b><?php echo $lista; ?></TD>
		<TD><b>Vendedor: </b><?php echo $vendedor; ?></TD>
        </TR>
        <TR>
		<TD><b>Es Cliente: </b><?php echo $es_cliente; ?></TD>
        <TD><b>D&iacute;as de Cr&eacute;dito: </b><?php echo $dias_cred; ?></TD>
        <TD><b>Max. D&iacute;a de Facturaci&oacute;n: </b><?php echo $dia_max; ?></TD>
        </TR>
        <TR>
		<TD><b>Es Proveedor: </b><?php echo $es_prov; ?></TD>
		<TD colspan="2"><b>Descripci&oacute;n: </b><?php echo $glosa; ?></TD>
        </TR>
        
    </table>

</td>
</tr>

<?php if($hay_direccion != 0) { //if hay_direccion ?>
<tr>
<td>
	<b>Direcci&oacute;n: </b>
    <table border="1" align="center" cellpadding="2" width="100%">
	<thead>
    <tr>
    <TD align="center"><b>Direcci&oacute;n</b></TD>
    <TD align="center"><b>Tipo</b></TD>
    <TD align="center"><b>Principal</b></TD>
    <TD align="center"><b>Descripci&oacute;n</b></TD>
	</tr>
	</thead>
    <tbody class="marcafila">
    <?php
	$color = 2;
    for($d = 1; $d <= $fin_d; $d++) {
		if($color % 2 == 0) { //if color
    	printf("<tr BGCOLOR='#e2e7fa'><td align='left'>%s</td>", $ma_dir [$d][1]);//direccion
		} else {
		printf("<tr><td align='left'>%s</td>", $ma_dir [$d][1]);//direccion
		} //fin if color
    	printf("<td align='left'>%s</td>", $ma_dir [$d][2]);//tipo
    	printf("<td align='center'>%s</td>", $ma_dir [$d][3]);//principal
        printf("<td align='left'>%s</td></tr>", $ma_dir [$d][4]);//descripcion
		$color++;
    }
	?>
	</tbody>
    </table>
</td>
</tr>
<?php } //fin if hay_direccion ?>

<?php if($cod_empresa == 2) { //if cod_empresa ?>
<tr>
<td>
	<b>Sucursal: </b>
    <table border="1" align="center" cellpadding="2" width="100%">
	<thead>
    <tr>
    <TD align="center"><b>Nombre</b></TD>
    <TD align="center"><b>ID</b></TD>
    <TD align="center"><b>Ciudad</b></TD>
    <TD align="center"><b>Tel&eacute;fono</b></TD>
    <TD align="center"><b>Direcci&oacute;n</b></TD>
    <TD align="center"><b>Cod. Caja Nal. de Salud</b></TD>
    <TD align="center"><b>Descripci&oacute;n</b></TD>
	</tr>
	</thead>
    <tbody class="marcafila">
    <?php
	$color = 2;
    for($s = 1; $s <= $fin_s; $s++) {
		if($color % 2 == 0) { //if color
    	printf("<tr BGCOLOR='#e2e7fa'><td align='left'>%s</td>", $ma_suc [$s][1]);//nombre
		} else {
		printf("<tr><td align='left'>%s</td>", $ma_suc [$s][1]);//nombre
		} //fin if color
    	printf("<td align='center'>%s</td>", $ma_suc [$s][2]);//id
    	printf("<td align='left'>%s</td>", $ma_suc [$s][3]);//ciudad
		printf("<td align='left'>%s</td>", $ma_suc [$s][4]);//telefono
		printf("<td align='left'>%s</td>", $ma_suc [$s][5]);//direccion
		printf("<td align='left'>%s</td>", $ma_suc [$s][6]);//cod caja nal
        printf("<td align='left'>%s</td></tr>", $ma_suc [$s][7]);//descripcion
		$color++;
    }
	?>
	</tbody>
    </table>
</td>
</tr>
<?php } //fin if cod_empresa ?>

<?php if($hay_tarjeta != 0) { //if hay_tarjeta ?>
<tr>
<td>
	<b>Tarjetas de Cr&eacute;dito: </b>
    <table border="1" align="center" cellpadding="2" width="100%">
	<thead>
    <tr>
    <TD align="center"><b>Tipo</b></TD>
    <TD align="center"><b>N&uacute;mero</b></TD>
    <TD align="center"><b>Nombre</b></TD>
    <TD align="center"><b>Nro. Seguridad</b></TD>
    <TD align="center"><b>Fecha de Emisi&oacute;n</b></TD>
    <TD align="center"><b>Fecha de Caducidad</b></TD>
    <TD align="center"><b>Descripci&oacute;n</b></TD>
	</tr>
	</thead>
    <tbody class="marcafila">
    <?php
	$color = 2;
    for($t = 1; $t <= $fin_t; $t++) {
		if($color % 2 == 0) { //if color
    	printf("<tr BGCOLOR='#e2e7fa'><td align='left'>%s</td>", $ma_tarj [$t][1]);//tipo
		} else {
		printf("<tr><td align='left'>%s</td>", $ma_tarj [$t][1]);//tipo
		} //fin if color
    	printf("<td align='left'>%s</td>", $ma_tarj [$t][2]);//numero
    	printf("<td align='left'>%s</td>", $ma_tarj [$t][3]);//nombre
		printf("<td align='left'>%s</td>", $ma_tarj [$t][4]);//nro seg
		printf("<td align='center'>%s</td>", $ma_tarj [$t][5]);//fecha emision
		printf("<td align='center'>%s</td>", $ma_tarj [$t][6]);//fecha caducidad
        printf("<td align='left'>%s</td></tr>", $ma_tarj [$t][7]);//descripcion
		$color++;
    }
	?>
	</tbody>
    </table>
</td>
</tr>
<?php } //fin if hay_tarjeta ?>

<?php if($hay_documento != 0) { //if hay_documento ?>
<tr>
<td>
	<b>Documentos del Contacto: </b>
    <table border="1" align="center" cellpadding="2" width="100%">
	<thead>
    <tr>
    <TD align="center"><b>N&uacute;mero</b></TD>
    <TD align="center"><b>Tipo</b></TD>
    <TD align="center"><b>Fecha de Nacimiento</b></TD>
    <TD align="center"><b>Fecha de Caducidad</b></TD>
    <TD align="center"><b>Descripci&oacute;n</b></TD>
	</tr>
	</thead>
    <tbody class="marcafila">
    <?php
	$color = 2;
    for($do = 1; $do <= $fin_do; $do++) {
		if($color % 2 == 0) { //if color
    	printf("<tr BGCOLOR='#e2e7fa'><td align='left'>%s</td>", $ma_doc [$do][1]);//numero
		} else {
		printf("<tr><td align='left'>%s</td>", $ma_doc [$do][1]);//numero
		} //fin if color
    	printf("<td align='left'>%s</td>", $ma_doc [$do][2]);//tipo
    	printf("<td align='center'>%s</td>", $ma_doc [$do][3]);//fecha nacimiento
		printf("<td align='center'>%s</td>", $ma_doc [$do][4]);//fecha caducidad
        printf("<td align='left'>%s</td></tr>", $ma_doc [$do][5]);//descripcion
		$color++;
    }
	?>
	</tbody>
    </table>
</td>
</tr>
<?php } //fin if hay_documento ?>

<?php if($hay_mail != 0) { //if hay_mail ?>
<tr>
<td>
	<b>Mail: </b>
    <table border="1" align="center" cellpadding="2" width="100%">
	<thead>
    <tr>
    <TD align="center"><b>Correo</b></TD>
    <TD align="center"><b>Tipo</b></TD>
    <TD align="center"><b>Principal</b></TD>
    <TD align="center"><b>Descripci&oacute;n</b></TD>
	</tr>
	</thead>
    <tbody class="marcafila">
    <?php
	$color = 2;
    for($m = 1; $m <= $fin_m; $m++) {
		if($color % 2 == 0) { //if color
    	printf("<tr BGCOLOR='#e2e7fa'><td align='left'>%s</td>", $ma_mail [$m][1]);//correo
		} else {
		printf("<tr><td align='left'>%s</td>", $ma_mail [$m][1]);//correo
		} //fin if color
    	printf("<td align='left'>%s</td>", $ma_mail [$m][2]);//tipo
    	printf("<td align='center'>%s</td>", $ma_mail [$m][3]);//principal
        printf("<td align='left'>%s</td></tr>", $ma_mail [$m][4]);//descripcion
		$color++;
    }
	?>
	</tbody>
    </table>
</td>
</tr>
<?php } //fin if hay_mail ?>

<?php if($hay_telefono != 0) { //if hay_telefono ?>
<tr>
<td>
	<b>Tel&eacute;fonos: </b>
    <table border="1" align="center" cellpadding="2" width="100%">
	<thead>
    <tr>
    <TD align="center"><b>Tel&eacute;fono</b></TD>
    <TD align="center"><b>Tipo</b></TD>
    <TD align="center"><b>Principal</b></TD>
    <TD align="center"><b>Descripci&oacute;n</b></TD>
	</tr>
	</thead>
    <tbody class="marcafila">
    <?php
	$color = 2;
    for($te = 1; $te <= $fin_te; $te++) {
		if($color % 2 == 0) { //if color
    	printf("<tr BGCOLOR='#e2e7fa'><td align='left'>%s</td>", $ma_tel [$te][1]);//telef
		} else {
		printf("<tr><td align='left'>%s</td>", $ma_tel [$te][1]);//telef
		} //fin if color
    	printf("<td align='left'>%s</td>", $ma_tel [$te][2]);//tipo
    	printf("<td align='center'>%s</td>", $ma_tel [$te][3]);//principal
        printf("<td align='left'>%s</td></tr>", $ma_tel [$te][4]);//descripcion
		$color++;
    }
	?>
	</tbody>
    </table>
</td>
</tr>
<?php } //fin if hay_telefono ?>

<?php if($hay_catalogo != 0) { //if hay_catalogo ?>
<tr>
<td>
	<b>Cat&aacute;logo: </b><button onclick="muestra('Pcatalogo')" class="boton">Mostrar</button> <button onclick="oculta('Pcatalogo')" class="boton">Ocultar</button> 
    <table border="1" align="center" cellpadding="2" width="100%" id="Pcatalogo">
    <thead>
    <tr>
    <TD align="center" width="10%"><b>Cod.</b></TD>
    <TD align="center" width="45%"><b>Item</b></TD>
    <TD align="center" width="5%"><b>Moneda</b></TD>
    <TD align="center" width="15%"><b>Precio</b></TD>
    <TD align="center" width="10%"><b>D&iacute;as de Entrega</b></TD>
    <TD align="center" width="10%"><b>Cod. F&aacute;brica</b></TD>
    </tr>
    </thead>
    <tbody class="marcafila">
    <?php
	$color = 2;
    for($ca = 1; $ca <= $fin_ca; $ca++) {
		if($color % 2 == 0) { //if color
    	printf("<tr BGCOLOR='#e2e7fa'><td align='right'>%s</td>", $ma_cat [$ca][1]);//cod item
		} else {
		printf("<tr><td align='right'>%s</td>", $ma_cat [$ca][1]);//cod item
		} //fin if color
    	printf("<td align='left'>%s</td>", $ma_cat [$ca][2]);//item
    	printf("<td align='left'>%s</td>", $ma_cat [$ca][3]);//moneda
		printf("<td align='right'>%s</td>", number_format($ma_cat [$ca][4],$n_decimales));//precio
		printf("<td align='right'>%s</td>", $ma_cat [$ca][5]);//dias entrega
        printf("<td align='right'>%s</td></tr>", $ma_cat [$ca][6]);//cod fabrica
		$color++;
    }
    ?>
    </tbody>
    </table>
</td>
</tr>
<?php } //fin if hay_catalogo ?>

</table>

<br /><br />
<b>Registrado por: </b> <?php echo $usuario_reg; ?>

</body>
</html>
