require_once('../include/orm.php');
require_once('../include/globals.php');
require_once('../include/util.php');
$_planos_planococheras_db_connected = $Link == '';
if($_planos_planococheras_db_connected) $Link = connectDb();
define('DBCONNECTED', 1);
debugstartpage();
if( isset($_x) ) {
//if( $_x != '' ) {
$_x = $_x == '' ? array() : StringTokenize($_x, ",");
$_result = array();
$_result['version'] = array('actual' => 341);
$_result['visibility'] = array();
$_initialvars = arrayExclude(get_defined_vars(), array("_*", "form_*", "s_*", "GLOBALS", "Link", "thisname"));
}
// isbasewindow:
// On Open
while( ($__action == "" or $__action == "executedonopen") and (empty($_x) or in('onopen', $_x)) ) {
$__action = "executedonopen";
$__tempresult = sqlexec($Link, "select nombre, torre, piso, tipologia, vista, archivo, tamano from planos where id = " . mysql_escape($id) . "");
while( $__temprow = mysql_fetch_array($__tempresult)) {
$planonombre = $__temprow[0];
$planotorre = $__temprow[1];
$planopiso = $__temprow[2];
$planotipologia = $__temprow[3];
$planovista = $__temprow[4];
$archivo = $__temprow[5];
$tamano = $__temprow[6];
}
$__tempresult = sqlexec($Link, "select w, h from rect where plano = '" . mysql_escape($id) . "' order by id desc limit 1");
while( $__temprow = mysql_fetch_array($__tempresult)) {
$lastw = $__temprow[0];
$lasth = $__temprow[1];
}
if( $lastw == "" ) $lastw = 50;
if( $lasth == "" ) $lasth = 50;
list($ancho, $alto, $tipo, $atributos) = getimagesize("../files/planos/$archivo");
if( $url == "" )
$url = "../emprendimientos/cotizarunidad.php?";
else if( strpos($url, '?') === false )
$url .= "?";
if( $urltarget == "" ) $urltarget = "popup";
//print "planonombre: $planonombre
planotorre: $planotorre
planopiso: $planopiso
planotipologia: $planotipologia
planovista: $planovista
archivo: $archivo
tamaƱo: $tamano
";
//print "ancho: $ancho
alto: $alto
tipo: $tipo
atributos $atributos
";
//select format(compra,2),date_format(fecha,'%d/%m/%Y') into $cotizacionuva, $fechacotizacion from cotizaciones where moneda = 'UVA' and fecha <= current_date() order by fecha desc limit 1;
// Si puso header location para ir a otra pagina cierra el script
if( !isset($_x) and $__exiting ) {
disconnectDb($Link); exit(0);
}
break;
}
// PHP Vars
while( ($__action == "" or $__action == "executedonopen") and isset($_GET['_x']) and empty($_x) ) {
$__row0 = array();
$__row0['__panel__1'] = $titulo ;
$__row0['__panel__2'] = $planonombre ;
$__row0['__contenedorimagen__1'] = $archivo ;
$__row0['__unnamed1__1'] = (1== 0) ? 'display: inline !important;' : 'display: none !important;' ;
$__row0['__unnamed1__2'] = $unnamed1 ;
$__row0['__unnamed1__3'] = $titulo ;
$__row0['__unnamed1__4'] = $planonombre ;
$__row0['__volver__1'] = $emprendimiento;
$__row0['__volver__2'] = $emprendimiento;
$__row0['__volver__3'] = $unidadid ;
$_result['morevars'] = $__row0;
break;
}
if( has($_x, 'pdf') or has($_x, 'pdfprint') or has($_x, 'pdfprint2') ) {
require_once('../include/fpdfreport.php');
$_pdf = new PDF((isset($_orientation) ? $_orientation : 'P'),'pt', (isset($_size) ? $_size : 'A4' ));
$_pdf->initialPage = ($_page != '' ? $_page : 1);
//$_pdf->SetAutoPageBreak(true);
$_pdf->title = "";
$_pdf->SetTopMargin(50);
$_pdf->AliasNbPages();
$_pdf->AddPage();
}
if( has($_x, 'selectorunidad') ) {
$_result['selectorunidad'] = array();
foreach(sqltoarray($Link, "select rect.unidad, rect.x, rect.y, rect.w, rect.h, if(ifnull(rect.unidad,'')='',rect.link,concat('$url&proyecto=$proyecto&id=', rect.unidad)) as link, rect.transicion, (select archivo from planos where id = substring_index(rect.link, '=', -1)) as archivoplano, if('$cocheraid' = 0 or '$cocheraid' = '',(select id from Unidades as U2 where tipou = 'C' and U2.id = Unidades.id),'$cocheraid') as cocheraid, if('$bauleraid' = 0 or 'bauleraid' = '',(select id from Unidades as U2 where tipou = 'B' and U2.id = Unidades.id),'$bauleraid') as bauleraid, Unidades.denominacion, Unidades.tipounidad, Unidades.torre, Unidades.piso, Unidades.departamento, Unidades.superficieM2, baulera1M2, Unidades.ancho as cocheraancho, Unidades.largo as cocheralargo, Unidades.precio, Unidades.observaciones, Unidades.status , Unidades.torres from rect left outer join Unidades on rect.unidad = Unidades.id where rect.plano = '$id' and Unidades.tipou = '$tipou' and ('$etapa' = Unidades.sector or '$etapa' = '')") as $__row0) {
makeglobals($__row0);
$_result['selectorunidad'][] = $__row0;
}
}
if( isset($_GET['_x']) and empty($_x) ) {
$_result['visibility']['unnamed1'] = (1== 0);
}
if( has($_x, 'pdf') or has($_x, 'pdfprint') or has($_x, 'pdfprint2') ) {
$_pdf->Output();
}
?>
if( !isset($_x) ) {
?>
if( isset($_export) ) { ?>
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=.xls");
//echo('');
//echo('');
echo('');
?> } else { ?>