require_once('../include/orm.php'); require_once('../include/globals.php'); require_once('../include/util.php'); $_procesos_resumenestados_db_connected = $Link == ''; if($_procesos_resumenestados_db_connected) $Link = connectDb(); define('DBCONNECTED', 1); debugstartpage(); if( isset($_x) ) { $_x = StringTokenize($_x, ","); $_result = array(); $_initialvars = arrayExclude(get_defined_vars(), array("_*", "form_*", "s_*", "GLOBALS", "Link", "thisname")); } require('../include/base.events.php'); // isbasewindow: // On Refresh do { if(in('estados', $_x)) { $estados = array(); $cantidades = array(); $_def = sqltoarray($Link, "select * from ddform where concat(module, '.', name) = '$_form'"); $_dbtable = $_def[0]['dbtable']; $_dbwhere = $_def[0]['dbwhere']; $_dbwhere = sqlreplace($_dbwhere); if( $_dbwhere != '' ) $_dbwhere .= ' and '; $_where = ''; //debug("GET:"); //debug($_GET); foreach($_GET as $n => $v) { if( endsWith($n, '_filter') and $v != 'null' and $v != '' ) { if( $_where != '' ) $_where .= ' and '; if( strpos($v, " - ") !== false and strlen($v) == 23 ) { list($d1, $d2) = periodtoarray($v); $_where .= str_replace('_filter' , '' , $n) . " between '" . $d1 . "' and '" . $d2 . "'"; } else { $_where .= str_replace('_filter' , '' , $n) . " = '" . $v . "'"; } } } if( $_where != '' ) $_dbwhere = '(' . $_where . ') and ' . $_dbwhere; if( isset($my) and $my == 'mine' ) { $_dbwhere .= " (select count(*) from emresp where form = '$_form' and objeto = ". $_dbtable . ".id and usuario = '$s_idusuario' and estado = estados.descripcion) > 0 and "; } $__tempresult = sqlexec($Link, "select descripcion, (select count(*) from $_dbtable where $_dbwhere status = estados.descripcion) from estados where form = '$_form' and activo = 'S' order by orden;"); while( $__temprow = mysql_fetch_array($__tempresult)) { $estados[] = $__temprow[0]; $cantidades[] = $__temprow[1]; } $_result['estados'] = array(); foreach($estados as $ii => $estado) { $_result['estados'][] = array('nombre' => $estado, 'cantidad' => $cantidades[$ii]); } } // Si puso header location para ir a otra pagina cierra el script if( !isset($_x) and $__exiting ) { disconnectDb($Link); exit(0); } } while(false); ?> // isbasewidnow!: if( !isset($_x) ) { ?>
require('../include/base.head.php'); ?> class="popup" } ?> >