require_once('../include/orm.php');
require_once('../include/globals.php');
require_once('../include/util.php');
$_planos_plano_db_connected = $Link == '';
if($_planos_plano_db_connected) $Link = connectDb();
define('DBCONNECTED', 1);
debugstartpage();
if( isset($_x) ) {
//if( $_x != '' ) {
$_x = $_x == '' ? array() : StringTokenize($_x, ",");
$_result = array();
$_result['version'] = array('actual' => 460);
$_result['visibility'] = array();
$_initialvars = arrayExclude(get_defined_vars(), array("_*", "form_*", "s_*", "GLOBALS", "Link", "thisname"));
}
require('../main/base.events.php');
// 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, dibujar 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];
$pol = $__temprow[7];
}
$size = getimagesize("../files/planos/$archivo");
$warchivo = $size[0];
$harchivo = $size[1];
$pol = ( $pol == 'poligonos' ? 'pol' : '');
$__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/unidad.php?";
$url = "../emprendimientos/cotizarunidad.php?";
$url2 = "../ventas/verventa.php?";
} else if( strpos($url, '?') === false ) {
$url .= "?";
$url2 = "?";
}
//if( $urltarget == "" ) $urltarget = "popup";
//select compra into $tcuva from cotizaciones where moneda = 'UVA' and fecha <= curdate() order by fecha desc limit 1;
//select compra into $tcusd from cotizaciones where moneda = 'U' and fecha <= curdate() order by fecha desc limit 1;
$tcuva = "21.29";
$fechacotizacion = "15/01/2018";
$tcusd = "18.50";
//select id into $idfp from formapago where emprendimiento = '$proyecto' order by id limit 1;
//$fpcuotas = sqltoarray($Link, "select porcentaje, tipo, fecha, cantidad, moneda, tc from cuotasformapago where formapago = '$idfp'");
//print("
fp
");
//print_r($fpcuotas);
header_remove('Location');
// 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['__visualizacion__1'] = ($pol != 'pol') ? 'display: inline !important;' : 'display: none !important;' ;
$__row0['__visualizacion__2'] = $archivo ;
$__row0['__tituloplano__1'] = (1 == 0) ? 'display: inline !important;' : 'display: none !important;' ;
$__row0['__tituloplano__2'] = $tituloplano ;
$__row0['__tituloplano__3'] = $titulo ;
$__row0['__tituloplano__4'] = $planonombre ;
$__row0['__contenedorcanvas__1'] = $archivo ;
$_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, 'info_select') ) {
/**
* Patente,Titular,Unidad Funcional
*/
$_result['info_select'] = [["Patente","Patente"],["Titular","Titular"],["Unidad Funcional","Unidad Funcional"]];
}
while( has($_x, "info__onchange") ) {
redirect("plano.php?id=$id&info=$info");
// Si puso header location para ir a otra pagina cierra el script
if( !isset($_x) and $__exiting ) {
disconnectDb($Link); exit(0);
}
break;
}
if( has($_x, 'selectorunidad') ) {
$_result['selectorunidad'] = array();
foreach(sqltoarray($Link, "select rect.unidad, rect.x, rect.y, rect.w, rect.h, '' as coordenadas, if(ifnull(rect.unidad,'')='', rect.link, if(Unidades.status='RESERVADO', concat('$url2&proyecto=$proyecto&id=', (select operacioncomercial from rcom where estado = 'ACTIVA' and unidadId = rect.unidad)), concat('../emprendimientos/planos.php?proyecto=$proyecto&unidad=', rect.unidad) ) ) as link, if(ifnull(rect.unidad,'')='', '', if(Unidades.status='RESERVADO', 'blank', 'popup' ) ) as linktarget, rect.transicion, /** (select archivo from planos where id = substring_index(rect.link, '=', -1)) as archivoplano, **/ '' as archivoplano, Unidades.denominacion, Unidades.tipounidad, Unidades.torre, Unidades.piso, Unidades.departamento, Unidades.superficieM2, baulera1M2, Unidades.ancho as cocheraancho, Unidades.largo as cocheralargo, Unidades.precio, Unidades.moneda, Unidades.observaciones, Unidades.status , Unidades.torres, Unidades.tipou, Unidades.relevamiento, hacecuanto(Unidades.relevamientofecha) as relevamientofechahacecuanto, hacecuanto(Unidades.relevamientodesde) as relevamientodesdehacecuanto, if( ifnull(Unidades.relevamiento,'')= '', 'Vacia', if( Unidades.relevamiento in (select patente from cmvehiculo where unidad in (select id from Unidades where emprendimientoid = '$proyecto') and cochera=Unidades.departamento ), 'Bien estacionado', if( Unidades.relevamiento in (select patente from cmvehiculo where unidad in (select id from Unidades where emprendimientoid = '$proyecto')), 'Mal estacionado', 'No identificado' ) ) ) as resultadorelevamiento, (select group_concat(patente) from cmvehiculo where cochera=Unidades.denominacion ) as patente, (select group_concat(apellido) from cmcont where unidad = Unidades.id and tipo = 'Titular' and estado = 'activo') as titular, (select group_concat(ifnull(razonsocial, ''), ' ', nombre, ' ', apellido) from cmcont cross join ocomcli on cmcont.id = ocomcli.cliente cross join ocom on ocomcli.operacioncomercial = ocom.id cross join rcom on ocom.id = rcom.operacioncomercial where ocom.estado != 'ANULADA' and rcom.unidadid = Unidades.id and rcom.estado not in ('Inactiva')) as clientes, (select group_concat(ifnull(razonsocial, ''), ' ', apellido) from cmcont cross join ocomcli on cmcont.id = ocomcli.cliente cross join ocom on ocomcli.operacioncomercial = ocom.id cross join rcom on ocom.id = rcom.operacioncomercial where ocom.estado != 'ANULADA' and rcom.unidadid = Unidades.id and rcom.estado not in ('Inactiva')) as apellidosclientes, Unidades.estado as estadounidad, (select group_concat(uf.denominacion) from rcom as r1 cross join ocom on r1.operacioncomercial = ocom.id cross join rcom as r2 on ocom.id = r2.operacioncomercial cross join Unidades as uf on r2.unidadId = uf.id where r1.unidadid = Unidades.id and r1.estado not in ('Inactiva') and r2.estado not in ('Inactiva') and ocom.estado != 'ANULADA' and uf.tipou = 'D' ) as ufdenominacion, (select group_concat(u2.denominacion separator ',') from Unidades as u2 where u2.emprendimientoId = Unidades.emprendimientoId and u2.uf = Unidades.id) as complementariasasociadas, (select u2.denominacion from Unidades as u2 where u2.emprendimientoId = Unidades.emprendimientoId and u2.id = Unidades.uf) as ufasociada from rect left outer join Unidades on rect.unidad = Unidades.id where rect.plano = '$id' union all select pol.unidad, 0 as x, 0 as y, 0 as w, 0 as h, pol.coordenadas, if(ifnull(pol.unidad,'')='', pol.link, if(Unidades.status='RESERVADO', concat('$url2&proyecto=$proyecto&id=', (select operacioncomercial from rcom where estado = 'ACTIVA' and unidadId = pol.unidad)), concat('../emprendimientos/planos.php?proyecto=$proyecto&unidad=', pol.unidad) ) ) as link, if(ifnull(pol.unidad,'')='', '', if(Unidades.status='RESERVADO', 'blank', 'popup' ) ) as linktarget, pol.transicion, /** (select archivo from planos where id = substring_index(pol.link, '=', -1)) as archivoplano, **/ '' as archivoplano, Unidades.denominacion, Unidades.tipounidad, Unidades.torre, Unidades.piso, Unidades.departamento, Unidades.superficieM2, baulera1M2, Unidades.ancho as cocheraancho, Unidades.largo as cocheralargo, Unidades.precio, Unidades.moneda, Unidades.observaciones, Unidades.status , Unidades.torres, Unidades.tipou, Unidades.relevamiento, hacecuanto(Unidades.relevamientofecha) as relevamientofechahacecuanto, hacecuanto(Unidades.relevamientodesde) as relevamientodesdehacecuanto, if( ifnull(Unidades.relevamiento,'')= '', 'Vacia', if( Unidades.relevamiento in (select patente from cmvehiculo where unidad in (select id from Unidades where emprendimientoid = '$proyecto') and cochera=Unidades.departamento ), 'Bien estacionado', if( Unidades.relevamiento in (select patente from cmvehiculo where unidad in (select id from Unidades where emprendimientoid = '$proyecto')), 'Mal estacionado', 'No identificado' ) ) ) as resultadorelevamiento, (select group_concat(patente) from cmvehiculo where cochera=Unidades.departamento ) as patente, (select group_concat(apellido) from cmcont where unidad = Unidades.id and tipo = 'Titular' and estado = 'activo') as titular, (select group_concat(ifnull(razonsocial, ''), ' ', nombre, ' ', apellido) from cmcont cross join ocomcli on cmcont.id = ocomcli.cliente cross join ocom on ocomcli.operacioncomercial = ocom.id cross join rcom on ocom.id = rcom.operacioncomercial where ocom.estado != 'ANULADA' and rcom.unidadid = Unidades.id and rcom.estado not in ('Inactiva')) as clientes, (select group_concat(ifnull(razonsocial, ''), ' ', apellido) from cmcont cross join ocomcli on cmcont.id = ocomcli.cliente cross join ocom on ocomcli.operacioncomercial = ocom.id cross join rcom on ocom.id = rcom.operacioncomercial where ocom.estado != 'ANULADA' and rcom.unidadid = Unidades.id and rcom.estado not in ('Inactiva')) as apellidosclientes, Unidades.estado as estadounidad, (select group_concat(uf.denominacion) from rcom as r1 cross join ocom on r1.operacioncomercial = ocom.id cross join rcom as r2 on ocom.id = r2.operacioncomercial cross join Unidades as uf on r2.unidadId = uf.id where r1.unidadid = Unidades.id and r1.estado not in ('Inactiva') and r2.estado not in ('Inactiva') and ocom.estado != 'ANULADA' and uf.tipou = 'D' ) as ufdenominacion, (select group_concat(u2.denominacion separator ',') from Unidades as u2 where u2.emprendimientoId = Unidades.emprendimientoId and u2.uf = Unidades.id) as complementariasasociadas, (select u2.denominacion from Unidades as u2 where u2.emprendimientoId = Unidades.emprendimientoId and u2.id = Unidades.uf) as ufasociada from pol left outer join Unidades on pol.unidad = Unidades.id where pol.plano = '$id' ") as $__row0) {
makeglobals($__row0);
$_result['selectorunidad'][] = $__row0;
}
}
if( isset($_GET['_x']) and empty($_x) ) {
$_result['visibility']['visualizacion'] = ($pol != 'pol');
}
if( isset($_GET['_x']) and empty($_x) ) {
$_result['visibility']['tituloplano'] = (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 { ?>
require('../main/base.head.php'); ?>
class="popup" } ?>
>