Example #1
0
     $db = TBase::conectaDB();
     $rs = $db->Execute("select * from cotizacion a join cliente b using(idCliente) where idCotizacion = " . $_GET['id']);
     $datos = array();
     $datos = $rs->fields;
     $datos["movimientos"] = array();
     $rs = $db->Execute("select * from movimiento where idCotizacion = " . $_GET['id']);
     while (!$rs->EOF) {
         array_push($datos["movimientos"], $rs->fields);
         $rs->moveNext();
     }
     echo json_encode($datos);
     break;
 case 'pdf':
     require_once getcwd() . "/repositorio/pdf/cotizacion.php";
     $obj = new RCotizacion($_GET['id']);
     $obj->generar();
     $documento = $obj->Output();
     if ($documento == '') {
         $result = array("doc" => "", "band" => false);
     } else {
         if ($_GET['email'] == 'no') {
             $result = array("band" => true, "documento" => $obj->Output());
         } else {
             global $sesion;
             $email = new TMail();
             $cotizacion = new TCotizacion($_GET['id']);
             $email->setTema("Su cotizaciĆ³n");
             $email->setDestino($cotizacion->cliente->getEmail(), utf8_decode($cotizacion->cliente->getNombre()));
             $datos = array();
             $datos['nombreCompleto'] = $cotizacion->cliente->getNombre();
             $datos['ligaActualizacionDatosCliente'] = $ini["sistema"]["url"] . "?mod=clienteDatos&data=" . base64_encode($cotizacion->cliente->getId());