function check5Cierres($fecha_final, $alCerrar = false) { $xF = new cFecha(); $fecha_inicio_sistema = FECHA_INICIO_OPERACIONES_SISTEMA; $dias_a_revisar = REVISAR_DIAS_DE_CIERRE; $fecha_inicial = $xF->setRestarDias($dias_a_revisar, $fecha_final); $res = array(); $ok = false; $xSuc = new cSucursal(); for ($i = 0; $i <= $dias_a_revisar; $i++) { $fecha = $xF->setSumarDias($i, $fecha_inicial); if ($xF->getInt($fecha_inicio_sistema) >= $xF->getInt($fecha)) { $this->mMessages .= "WARN\tFecha {$fecha} OMITIDO por ser menor al inicio de operaciones\r\n"; $res[$fecha] = true; $ok = true; } elseif ($xF->getInt($fecha) == $xF->getInt(fechasys())) { $this->mMessages .= "WARN\tFecha {$fecha} OMITIDO por ser Fecha Actual\r\n"; $res[$fecha] = true; $ok = true; if ($alCerrar == true) { if ((int) date("H") < (int) $xSuc->getHorarioDeCierre()) { //considerar si es dia festivo $this->mMessages .= "ERROR\tNO ES EL HORARIO MINIMO DE CIERRE PARA LA FECHA {$fecha} SON LAS " . date("H") . " HRS. DE " . $xSuc->getHorarioDeCierre() . ", MINIMO DE CIERRE\r"; $res[$fecha] = false; $ok = false; } } } else { //$this->mMessages .= "WARN\tFecha $fecha OMITIDO por ser menor al inicio de operaciones\r\n"; if ($this->checkCierre($fecha) == false) { $res[$fecha] = false; $ok = false; $this->mMessages .= "ERROR\tFecha {$fecha} No existe en el sistema\r\n"; if ($xF->getInt($fecha) == $xF->getInt($fecha_final)) { $this->mMessages .= "ERROR\tPROCESAR LA FECHA {$fecha_final}|{$fecha} LAS FECHAS SON LAS MISMAS A " . fechasys() . "\r\n"; $res[$fecha] = true; $ok = true; } } else { $res[$fecha] = true; $ok = true; $this->mMessages .= "OK\tFecha {$fecha} existente\r\n"; } } $xCaja = new cCaja(); if ($alCerrar == true) { if ($xCaja->getCajasAbiertas($fecha) > 0) { $ok = false; $res[$fecha] = false; $this->mMessages .= "OK\tFecha {$fecha} tiene cortes pendientes\r\n"; } } } unset($res[fechasys()]); foreach ($res as $dateme => $rs) { if ($dateme != SYS_ESTADO) { if ($rs == false) { $this->mMessages .= "ERROR\tFecha {$dateme} tiene cortes pendientes.-2\r\n"; $ok = false; } } } if (MODO_DEBUG == true) { setLog($this->mMessages); } $res[SYS_ESTADO] = $ok; return $res; }