$datos[$rs->fields['idTipo']] = $rs->fields['descripcion'];
            $rs->moveNext();
        }
        $smarty->assign("tipos", $datos);
        break;
    case 'listaServicios':
        $db = TBase::conectaDB();
        $rs = $db->Execute("select * from servicio a join tipoServicio b on a.idTipo = b.idTipo");
        $datos = array();
        while (!$rs->EOF) {
            $rs->fields['json'] = json_encode($rs->fields);
            array_push($datos, $rs->fields);
            $rs->moveNext();
        }
        $smarty->assign("lista", $datos);
        break;
    case 'cservicio':
        switch ($objModulo->getAction()) {
            case 'add':
                $obj = new TServicio($_POST['id']);
                $obj->setTipo($_POST['tipo']);
                $obj->setNombre($_POST['nombre']);
                echo json_encode(array("band" => $obj->guardar()));
                break;
            case 'del':
                $obj = new TServicio($_POST['id']);
                echo json_encode(array("band" => $obj->eliminar()));
                break;
        }
        break;
}
Beispiel #2
0
                 $datos['datos']['descripcion'] = $obj->getDescripcion();
                 $datos['datos']['departamento'] = $obj->getIdDepartamento();
                 $datos['datos']['precio'] = $obj->getPrecio();
                 $datos['datos']['impInc'] = $obj->isImpInc() ? 'S' : 'N';
                 $datos['datos']['impuesto'] = $obj->getImpuesto();
                 $datos['datos']['idTipoCosteo'] = $obj->getIdTipoCosteo();
                 $datos['datos']['costo'] = $obj->getCosto();
                 $datos['datos']['id'] = $obj->getId();
                 $datos['datos']['existencias'] = $obj->getExistencias();
                 $datos['datos']['minimo'] = $obj->getMinimo();
                 $datos['datos']['marca'] = $obj->getMarca();
                 $datos['datos']['codigo'] = $obj->getCodigo();
                 break;
             case 2:
                 #servicios
                 $obj = new TServicio($rs->fields['idItem']);
                 $datos['datos']['nombre'] = $obj->getNombre();
                 $datos['datos']['descripcion'] = $obj->getDescripcion();
                 $datos['datos']['precio'] = $obj->getPrecio();
                 $datos['datos']['impInc'] = $obj->isImpInc() ? 'S' : 'N';
                 $datos['datos']['impuesto'] = $obj->getImpuesto();
                 $datos['datos']['id'] = $obj->getId();
                 $datos['datos']['codigo'] = $obj->getCodigo();
                 break;
         }
     }
     echo json_encode($datos);
     break;
 case 'del':
     $obj = new TItem(hexdec($_POST['id']));
     echo json_encode(array("band" => $obj->eliminar()));
 public function generar()
 {
     /*Primero hay que checar si es supervisor o administrador*/
     global $sesion;
     $supervisor = new TUsuario($sesion['usuario']);
     $hoja =& $this->libro->addWorksheet('Reporte');
     $head =& $this->libro->addFormat(array('Size' => 8, 'bold' => 1, 'Color' => 'red'));
     $this->libro->setCustomColor(15, 192, 192, 192);
     $titulo =& $this->libro->addFormat(array('Size' => 8, 'bold' => 1, "Align" => "center", "border" => 1, "FgColor" => 15));
     $encabezado =& $this->libro->addFormat(array('Size' => 10, 'bold' => 1, "Align" => "center", "FgColor" => 15));
     $hoja->write(2, 1, utf8_decode("REPORTE DE CONSULTAS GENERAL"), $encabezado);
     $hoja->mergeCells(2, 1, 2, 9);
     $hoja->write(3, 1, utf8_decode("Generado el: " . date("Y-m-d")), $head);
     $hoja->mergeCells(3, 1, 3, 9);
     $titulo->setAlign("vcenter");
     $db = TBase::conectaDB();
     switch ($supervisor->getIdTipo()) {
         case 1:
             $rs = $db->Execute("select idConsultorio, idDoctor, idServicio, sum(cantidad) as cantidad from reporte a join consulta b using(idReporte) join consultorio d using(idConsultorio) join servicio e using(idServicio) join tipoServicio f using(idTipo) join clasificacion g using(idClasificacion) where extract(month from fecha) = " . $this->mes . " and extract(year from fecha) = " . $this->anio . " group by idConsultorio, idDoctor, idServicio");
             break;
         case 2:
             $rs = $db->Execute("select idConsultorio, idDoctor, idServicio, sum(cantidad) as cantidad from reporte a join consulta b using(idReporte) join consultorio d using(idConsultorio) join servicio e using(idServicio) join tipoServicio f using(idTipo) join clasificacion g using(idClasificacion) where extract(month from fecha) = " . $this->mes . " and extract(year from fecha) = " . $this->anio . " and idSupervisor = " . $supervisor->getId() . " group by idConsultorio, idDoctor, idServicio");
             break;
         default:
             return false;
     }
     $hoja->write(4, 1, utf8_decode("Estado"), $titulo);
     $hoja->mergeCells(4, 1, 5, 1);
     $hoja->write(4, 2, utf8_decode("Ciudad"), $titulo);
     $hoja->mergeCells(4, 2, 5, 2);
     $hoja->write(4, 3, utf8_decode("Consultorio"), $titulo);
     $hoja->mergeCells(4, 3, 4, 4);
     $hoja->write(5, 3, utf8_decode("Clave"), $titulo);
     $hoja->write(5, 4, utf8_decode("Nombre"), $titulo);
     $hoja->write(4, 5, utf8_decode("Doctor"), $titulo);
     $hoja->mergeCells(4, 5, 4, 6);
     $hoja->write(5, 5, utf8_decode("Nombre"), $titulo);
     $hoja->write(5, 6, utf8_decode("EMail"), $titulo);
     $hoja->write(4, 7, utf8_decode("Servicio"), $titulo);
     $hoja->mergeCells(4, 7, 4, 8);
     $hoja->write(5, 7, utf8_decode("Tipo"), $titulo);
     $hoja->write(5, 8, utf8_decode("Nombre"), $titulo);
     $hoja->write(4, 9, utf8_decode("Cantidad"), $titulo);
     $hoja->mergeCells(4, 9, 5, 9);
     $datos =& $this->libro->addFormat(array('Size' => 8, "border" => 1));
     $hoja->setColumn(4, 8, 30);
     $y = 6;
     while (!$rs->EOF) {
         $consultorio = new TConsultorio($rs->fields['idConsultorio']);
         $servicio = new TServicio($rs->fields['idServicio']);
         $doctor = new TDoctor($rs->fields['idDoctor']);
         $hoja->write($y, 1, utf8_decode($consultorio->getEstado()), $datos);
         $hoja->write($y, 2, utf8_decode($consultorio->getCiudad()), $datos);
         $hoja->write($y, 3, utf8_decode($consultorio->getClave()), $datos);
         $hoja->write($y, 4, utf8_decode($consultorio->getNombre()), $datos);
         $hoja->write($y, 5, utf8_decode($doctor->getNombre()), $datos);
         $hoja->write($y, 6, utf8_decode($doctor->getEmail()), $datos);
         $hoja->write($y, 7, utf8_decode($servicio->tipo->getDescripcion()), $datos);
         $hoja->write($y, 8, utf8_decode($servicio->getNombre()), $datos);
         $hoja->write($y, 9, utf8_decode($rs->fields["cantidad"]), $datos);
         $rs->moveNext();
         $y++;
     }
     return true;
 }
Beispiel #4
0
            $el['nombre'] = $obj->getNombre();
            $el['precio'] = $obj->getPrecio();
            $el['encriptado']['id'] = dechex($obj->getId());
            array_push($datos, $el);
            $rs->moveNext();
        }
        $smarty->assign("servicios", $datos);
        break;
    case 'servicioAdd':
        $obj = new TServicio(hexdec($_GET['id']));
        $smarty->assign("servicio", $obj);
        break;
    case 'cservicios':
        switch ($objModulo->getAction()) {
            case 'guardar':
                $obj = new TServicio($_POST['id']);
                $obj->setCodigo($_POST['codigo']);
                $obj->setNombre($_POST['nombre']);
                $obj->setDescripcion($_POST['descripcion']);
                $obj->setPrecio($_POST['precioUnitario']);
                $obj->setImpInc($_POST['impuestoIncluido']);
                $obj->setImpuesto($_POST['impuesto']);
                if ($obj->guardar()) {
                    echo json_encode(array("band" => "true"));
                } else {
                    echo json_encode(array("band" => "false"));
                }
                break;
        }
        break;
}