コード例 #1
0
 public function eliminar()
 {
     if ($this->getId() == '') {
         return false;
     }
     $db = TBase::conectaDB();
     return $db->Execute("delete from departamento where idDepartamento = " . $this->getId()) ? true : false;
 }
コード例 #2
0
ファイル: TServicio.class.php プロジェクト: hugooluisss/pdv
 public function guardar()
 {
     if (!parent::guardar()) {
         return false;
     }
     $db = TBase::conectaDB();
     $rs = $db->Execute("select idItem from servicio where idItem = " . $this->getId());
     if ($rs->EOF) {
         $rs = $db->Execute("INSERT INTO servicio (idItem, precio, impInc, imp) VALUES (" . $this->getId() . ", 0, 'S', 0)");
     }
     $rs = $db->Execute("UPDATE servicio\n\t\t\tSET\n\t\t\t\tprecio = " . $this->getPrecio() . ",\n\t\t\t\timpInc = '" . $this->impInc . "',\n\t\t\t\timp = " . $this->getImpuesto() . "\n\t\t\tWHERE idItem = " . $this->getId());
     return $rs ? true : false;
 }
コード例 #3
0
ファイル: TVenta.class.php プロジェクト: hugooluisss/pdv
 public function setId($id = '')
 {
     if ($id == '') {
         return false;
     }
     parent::setId($id);
     $db = TBase::conectaDB();
     $rs = $db->Execute("select * from venta where idOrden = " . $this->getId());
     foreach ($rs->fields as $key => $val) {
         switch ($key) {
             case 'idCliente':
                 $this->setCliente($val);
                 break;
             default:
                 $this->{$key} = $val;
         }
     }
 }
コード例 #4
0
ファイル: TEstudiante.class.php プロジェクト: hugooluisss/DGI
 /**
  * Carga los datos del objeto
  *
  * @autor Hugo
  * @access public
  * @param int $id identificador del objeto
  * @return boolean True si se realizó sin problemas
  */
 public function setId($id = '')
 {
     if ($id == '') {
         return false;
     }
     $db = TBase::conectaDB("sigei");
     $rs = $db->Execute("select idEstudiante, matricula, plantel, nombrem, app, apm from estudiante where idEstudiante = " . $id);
     foreach ($rs->fields as $field => $val) {
         switch ($field) {
             case 'idPlantel':
                 $this->plantel = new TPlantel($val);
                 break;
             default:
                 $this->{$field} = $val;
         }
     }
     return true;
 }
コード例 #5
0
ファイル: pedido copy.php プロジェクト: hugooluisss/cotizador
 public function generar($id)
 {
     $this->AddPage();
     //$this->Image('repositorio/img/ordendetrabajo.jpg', 0, 0);
     $pedido = $this->pedido;
     $this->Cell(0, 5, "C. " . $pedido->cliente->getNombre(), 0, 1);
     $this->Ln(10);
     $this->Write(5, utf8_decode("Estimado cliente, por medio del presente, le hago entrega del detalle de su pedido. Cualquier duda favor de contactarnos, con gusto se las resolveremos"));
     $this->SetFillColor(0, 150, 0);
     $this->Ln(20);
     $this->SetFont('Sans', 'B', 8);
     $this->Cell(80, 8, "Nombre", 0, 0, 'C', 1);
     $this->Cell(40, 8, "Marca", 0, 0, 'C', 1);
     $this->Cell(45, 8, "Talla", 0, 0, 'C', 1);
     $this->Cell(30, 8, "Cantidad", 0, 1, 'C', 1);
     $this->SetFont('Sans', '', 6);
     $cantidad = 0;
     $db = TBase::conectaDB();
     $rs = $db->Execute("select * from movped join talla using(idTalla) join ropa using(idItem) where idPedido = " . $this->pedido->getId());
     while (!$rs->EOF) {
         $mov = $rs->fields;
         $this->Cell(80, 8, $mov['descripcion'], "B", 0, 'L');
         $this->Cell(40, 8, $mov["marca"], "B", 0, 'L');
         $this->Cell(45, 8, $mov["nombre"], "B", 0, 'L');
         $this->Cell(30, 8, $mov["cantidad"], "B", 1, 'R');
         $cantidad += $mov["cantidad"];
         $rs->moveNext();
     }
     if ($unidades > 0) {
         $this->SetFont('Sans', '', 10);
         $this->Cell(165, 12, "Unidades", 0, 0, 'R');
         $this->SetFont('Sans', 'B', 11);
         $this->Cell(30, 12, "\$ " . sprintf("%d", $unidades), "B", 1, 'R');
     }
     $this->SetFont('Sans', 'B', 6);
     $this->Cell(165, 8, "Total a pagar", 0, 0, 'R');
     $this->Cell(30, 8, (string) $pedido->getPrecio(), "B", 1, 'R');
     $this->Cell(165, 8, "Seña", 0, 0, 'R');
     $this->Cell(30, 8, $pedido->getAnticipo(), "B", 1, 'R');
     $this->Cell(165, 8, "Resta", 0, 0, 'R');
     $this->Cell(30, 8, (string) sprintf("%0.2f", $pedido->getPrecio() - $pedido->getAnticipo()), "B", 1, 'R');
 }
コード例 #6
0
ファイル: TPlantel.class.php プロジェクト: hugooluisss/DGI
 /**
  * Carga los datos del objeto
  *
  * @autor Hugo
  * @access public
  * @param int $id identificador del objeto
  * @return boolean True si se realizó sin problemas
  */
 public function setId($id = '')
 {
     if ($id == '') {
         return false;
     }
     $db = TBase::conectaDB("sip");
     $rs = $db->Execute("select * from plantel where id_plantel = '" . $id . "'");
     foreach ($rs->fields as $field => $val) {
         switch ($field) {
             case 'id_plantel':
                 $this->idPlantel = $val;
                 break;
             case 'nombre':
                 $this->nombre_pl = $val;
                 break;
             case 'clave_pl':
                 $this->clave = $val;
                 break;
         }
     }
     return true;
 }
コード例 #7
0
 /**
  * Eliminar a doctor a supervisor
  *
  * @autor Hugo
  * @access public
  * @param $id Identificador del usuario doctor
  * @return boolean True si se realizó sin problemas
  */
 public function delSupervisado($id = '')
 {
     if ($id == '') {
         return false;
     }
     if ($this->getId() == '' or $this->getIdTipo() != 2) {
         return false;
     }
     $db = TBase::conectaDB();
     $rs = $db->Execute("delete from encargados where idSupervisor = " . $this->getId() . " and idUsuario = " . $id);
     return $rs ? true : false;
 }
コード例 #8
0
ファイル: TItem.class.php プロジェクト: hugooluisss/pdv
 public function eliminar()
 {
     if ($this->getId() == '') {
         return false;
     }
     $db = TBase::conectaDB();
     $rs = $db->Execute("update item set estado = 'E' where idItem = " . $this->getId());
     return $rs ? true : false;
 }
コード例 #9
0
 /**
  * Elimina el objeto de la base de datos
  *
  * @autor Hugo
  * @access public
  * @return boolean True si se realizó sin problemas
  */
 public function eliminar()
 {
     if ($this->getId() == '') {
         return false;
     }
     $db = TBase::conectaDB();
     $rs = $db->Execute("delete from limite where idLimite = " . $this->getId());
     return $rs ? true : false;
 }
コード例 #10
0
ファイル: TUsuario.class.php プロジェクト: hugooluisss/DGI
 public function setTipo($id = '')
 {
     if ($id == '' or $this->getId() == '') {
         return false;
     }
     $db = TBase::conectaDB();
     $rs = $db->Execute("update usuario set idTipo = " . $id . " where num_personal = " . $this->getId() . "");
     return true;
 }
コード例 #11
0
 public function addTecnica($id, $tecnica, $color, $cantidad, $ubicacion, $size, $medidas, $precio)
 {
     if ($this->getId() == '') {
         return false;
     }
     $db = TBase::conectaDB();
     if ($id == '') {
         $rs = $db->Execute("insert into pedidotecnicaimpresion(idPedido, idImpresion, color) values (" . $this->getId() . ", " . $tecnica . ", '" . $color . "')");
         $id = $db->Insert_ID();
     }
     if ($id != '') {
         $rs = $db->Execute("update pedidotecnicaimpresion set \n\t\t\t\t\tidImpresion = " . $tecnica . ",\n\t\t\t\t\tcolor = " . $color . ",\n\t\t\t\t\tcantidad = " . $cantidad . ",\n\t\t\t\t\tubicacion = " . $ubicacion . ",\n\t\t\t\t\tsize = " . $size . ",\n\t\t\t\t\tmedidas = " . $medidas . ",\n\t\t\t\t\tprecio = " . $precio . "\n\t\t\t\twhere idImpresion = " . $id . "\n\t\t\t");
     }
     return $rs ? true : false;
 }
コード例 #12
0
ファイル: TReporte.php プロジェクト: hugooluisss/SAMAP
 /**
  * Agregar comentarios
  *
  * @autor Hugo
  * @access public
  * @return boolean True si se realizó sin problemas
  */
 public function setComentarios()
 {
     if ($this->getId() == '') {
         return false;
     }
     $db = TBase::conectaDB();
     $rs = $db->Execute("select idReporte from comentario where idReporte = " . $this->getId());
     if ($rs->EOF) {
         $rs = $db->Execute("insert into comentario (idReporte, campo1, campo2, campo3) values (" . $this->getId() . ", '" . $this->getCampo1() . "', '" . $this->getCampo2() . "', '" . $this->getCampo3() . "')");
     } else {
         $rs = $db->Execute("update comentario set\n\t\t\t\t\tcampo1 = '" . $this->getCampo1() . "',\n\t\t\t\t\tcampo2 = '" . $this->getCampo2() . "',\n\t\t\t\t\tcampo3 = '" . $this->getCampo3() . "'\n\t\t\t\twhere idReporte = " . $this->getId());
     }
     return $rs ? true : false;
 }
コード例 #13
0
ファイル: pedido.php プロジェクト: hugooluisss/cotizador
 public function generar($id)
 {
     $adicionalY = -20;
     $adicionalX = -5;
     $this->AddPage();
     if ($his->formatoFondo) {
         $this->Image('repositorio/img/orden.jpg', 0, 0, 190, 240);
     }
     $pedido = $this->pedido;
     $this->SetFont('Arial', 'B', 8);
     $this->SetXY(96 + $adicionalX, 32.5 + $adicionalY);
     $this->Cell(15, 4, "No. Orden: ", 0, 0, 'L');
     $this->SetFont('Arial', '', 8);
     $this->SetXY(110 + $adicionalX, 32.5 + $adicionalY);
     $this->Cell(25, 4, (string) $pedido->getId(), 0, 0, 'R');
     $this->SetXY(24 + $adicionalX, 46 + $adicionalY);
     $this->Cell(0, 5, $pedido->cliente->getNombre(), 0);
     $this->SetXY(24 + $adicionalX, 54.5 + $adicionalY);
     $this->Cell(0, 5, $pedido->cliente->getCelular(), 0);
     $this->SetXY(24 + $adicionalX, 63 + $adicionalY);
     $this->Cell(0, 5, $pedido->cliente->getEmail(), 0);
     #registro
     $this->SetXY(40 + $adicionalX, 30 + $adicionalY);
     $this->Cell(0, 5, $pedido->getRegistro(), 0);
     #entrega
     $entrega = explode("-", $pedido->getEntrega());
     $entregaAux = explode(" ", $entrega[2]);
     $entrega[2] = $entregaAux[0];
     $entrega = explode("-", $pedido->getEntregaCliente() == '' ? $pedido->getEntrega() : $pedido->getEntregaCliente());
     $entregaHora = explode(":", $entregaAux[1]);
     $this->SetXY(40 + $adicionalX, 37 + $adicionalY);
     $this->Cell(0, 5, $entrega[2] . '-' . $entrega[1] . '-' . $entrega[0], 0);
     $this->SetXY(65 + $adicionalX, 37 + $adicionalY);
     $this->Cell(0, 5, $entregaHora[0], 0);
     $this->SetXY(71 + $adicionalX, 37 + $adicionalY);
     $this->Cell(0, 5, $entregaHora[1], 0);
     #Impresiones
     $db = TBase::conectaDB();
     $rs = $db->Execute("select * from pedidoimpresion where idPedido = " . $pedido->getId() . " and idImpresion = 4");
     if (!$rs->EOF) {
         $this->SetXY(107.5 + $adicionalX, 44.5 + $adicionalY);
         $this->Cell(3.5, 2, "", 0, 0, 'L', 1);
     }
     $rs = $db->Execute("select * from pedidoimpresion where idPedido = " . $pedido->getId() . " and idImpresion = 5");
     if (!$rs->EOF) {
         $this->SetXY(107.5 + $adicionalX, 48 + $adicionalY);
         $this->Cell(3.5, 2, "", 0, 0, 'L', 1);
     }
     $rs = $db->Execute("select * from pedidoimpresion where idPedido = " . $pedido->getId() . " and idImpresion = 6");
     if (!$rs->EOF) {
         $this->SetXY(107.5 + $adicionalX, 51.6 + $adicionalY);
         $this->Cell(3.5, 2, "", 0, 0, 'L', 1);
     }
     $rs = $db->Execute("select * from pedidoimpresion where idPedido = " . $pedido->getId() . " and idImpresion = 7");
     if (!$rs->EOF) {
         $this->SetXY(107.5 + $adicionalX, 55.1 + $adicionalY);
         $this->Cell(3.5, 2, "", 0, 0, 'L', 1);
     }
     $rs = $db->Execute("select * from pedidoimpresion where idPedido = " . $pedido->getId() . " and idImpresion = 8");
     if (!$rs->EOF) {
         $this->SetXY(107.5 + $adicionalX, 58.7 + $adicionalY);
         $this->Cell(3.5, 2, "", 0, 0, 'L', 1);
     }
     #articulos
     $rs = $db->Execute("select * from pedidoentregables where idPedido = " . $pedido->getId() . " and idEntregable = 10");
     if (!$rs->EOF) {
         $this->SetXY(117 + $adicionalX, 44.5 + $adicionalY);
         $this->Cell(3.5, 2, "", 0, 0, 'L', 1);
     }
     $rs = $db->Execute("select * from pedidoentregables where idPedido = " . $pedido->getId() . " and idEntregable = 11");
     if (!$rs->EOF) {
         $this->SetXY(117 + $adicionalX, 48 + $adicionalY);
         $this->Cell(3.5, 2, "", 0, 0, 'L', 1);
     }
     $rs = $db->Execute("select * from pedidoentregables where idPedido = " . $pedido->getId() . " and idEntregable = 12");
     if (!$rs->EOF) {
         $this->SetXY(117 + $adicionalX, 51.6 + $adicionalY);
         $this->Cell(3.5, 2, "", 0, 0, 'L', 1);
     }
     $rs = $db->Execute("select * from pedidoentregables where idPedido = " . $pedido->getId() . " and idEntregable = 13");
     if (!$rs->EOF) {
         $this->SetXY(117 + $adicionalX, 55.1 + $adicionalY);
         $this->Cell(3.5, 2, "", 0, 0, 'L', 1);
     }
     $rs = $db->Execute("select * from pedidoentregables where idPedido = " . $pedido->getId() . " and idEntregable = 14");
     if (!$rs->EOF) {
         $this->SetXY(117 + $adicionalX, 58.7 + $adicionalY);
         $this->Cell(3.5, 2, "", 0, 0, 'L', 1);
     }
     $this->SetXY(82 + $adicionalX, 63 + $adicionalY);
     $this->Cell(100, 3, $pedido->getEntregables());
     #Remeras
     $rs = $db->Execute("select distinct idItem from movped a join talla b using(idTalla) join ropa c using(idItem) where idPedido = " . $pedido->getId() . " limit 2");
     $tallas = array(1, 2, 3, 4, 5, 6, 8, 10, 12, 14, 16, 'S', 'M', 'L', 'XL', 'XXL');
     #$colores = array("rojo", "roja", "azul", "amarillo", "amarilla", "verde", "gris claro", "gris oscuro", "beige", "blanco", "negro", "blanca", "azul francia", "azul marino", "azul piedra", "celeste", "bordo", "naranja", "verde militar", "verde meletton", "verde manzana", "verde ingles", "uva", "fucsia", "violeta", "turquesa", "verde italia", "arena", "marron", "marròn");
     $y = 78 + $adicionalY;
     #$y = 83.7 + $adicionalY;
     while (!$rs->EOF) {
         $x = 16.5 + $adicionalX;
         $item = '';
         $descripcion = "";
         foreach ($tallas as $talla) {
             $rs2 = $db->Execute("select * from movped join talla using(idTalla) join ropa using(idItem) where idPedido = " . $pedido->getId() . " and idItem = " . $rs->fields['idItem'] . " and talla.nombre = 'Talle " . $talla . "'");
             $this->SetXY($x, $y);
             $this->Cell(7, 5, $rs2->fields['cantidad'] == '' ? 0 : $rs2->fields['cantidad'], 0, 0, 'R');
             $x += 6.9;
             $item = !$rs2->EOF ? $rs2->fields['descripcion'] : $item;
         }
         $this->SetXY(128 + $adicionalX, $y);
         $this->Cell(7, 5, substr($item, 0, 20), 0, 0, 'L');
         $y += 5.7;
         $rs->moveNext();
     }
     #posiciones, no se ponen
     #colores;
     $this->SetXY(68 + $adicionalX, 124 + $adicionalY);
     $this->Cell(7, 5, utf8_decode(substr($pedido->getColores(), 0, 17)), 0, 0, 'L');
     $this->SetXY(68 + $adicionalX, 130 + $adicionalY);
     $this->Cell(7, 5, utf8_decode(substr($pedido->getColores(), 17, 17)), 0, 0, 'L');
     $this->SetXY(68 + $adicionalX, 136 + $adicionalY);
     $this->Cell(7, 5, utf8_decode(substr($pedido->getColores(), 34, 17)), 0, 0, 'L');
     $this->SetXY(68 + $adicionalX, 142 + $adicionalY);
     $this->Cell(7, 5, utf8_decode(substr($pedido->getColores(), 51, 17)), 0, 0, 'L');
     $this->SetXY(68 + $adicionalX, 148 + $adicionalY);
     $this->Cell(7, 5, utf8_decode(substr($pedido->getColores(), 51, 17)), 0, 0, 'L');
     #Observaciones
     $this->SetXY(62 + $adicionalX, 169 + $adicionalY);
     $this->MultiCell(117, 5, utf8_decode($pedido->getObservaciones()), 0, 'J');
     $this->SetXY(40 + $adicionalX, 199 + $adicionalY);
     $this->Cell(22, 5, $pedido->getPrecio(), 0, 0, 'R');
     $this->SetXY(78 + $adicionalX, 199 + $adicionalY);
     $this->Cell(22, 5, $pedido->getAnticipo(), 0, 0, 'R');
     $this->SetXY(117 + $adicionalX, 199 + $adicionalY);
     $this->Cell(22, 5, (string) sprintf("%0.2f", $pedido->getPrecio() - $pedido->getAnticipo()), 0, 0, 'R');
     $this->SetXY(12 + $adicionalX, 188 + $adicionalY);
     $this->Cell(40, 5, $pedido->getArchivo(), 0, 0, 'C');
 }
コード例 #14
0
 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;
 }
コード例 #15
0
ファイル: TCliente.class.php プロジェクト: hugooluisss/pdv
 public function eliminar()
 {
     if ($this->getId() == '') {
         return false;
     }
     $db = TBase::conectaDB();
     return $db->Execute("update cliente set estado = 'E' where idCliente = " . $this->getId()) ? true : false;
 }
コード例 #16
0
ファイル: login.php プロジェクト: hugooluisss/DGI
<?php

global $objModulo;
switch ($objModulo->getId()) {
    case 'logout':
        unset($_SESSION['usuario']);
        session_destroy();
        header('Location: index.php');
        break;
    default:
        switch ($objModulo->getAction()) {
            case 'login':
            case 'validarCredenciales':
                $db = TBase::conectaDB("sip");
                $rs = $db->Execute("select num_personal, nip from ficha_personal where upper(curp) = upper('" . $_POST['usuario'] . "') and estatus_laboral = 1");
                $result = array('band' => false, 'mensaje' => 'Error al consultar los datos');
                if ($rs->EOF) {
                    $result = array('band' => false, 'mensaje' => 'La CURP no es válida');
                } elseif (strtoupper($rs->fields['nip']) != strtoupper($_POST['pass'])) {
                    $result = array('band' => false, 'mensaje' => 'NIP inválido');
                } else {
                    $obj = new TUsuario($rs->fields['num_personal']);
                    if ($obj->getId() == '') {
                        $result = array('band' => false, 'mensaje' => 'Acceso denegado');
                    } else {
                        $result = array('band' => true);
                    }
                }
                if ($result['band']) {
                    $obj = new TUsuario($rs->fields['num_personal']);
                    $sesion['usuario'] = $obj->getId();
コード例 #17
0
 /**
  * Agregar una consulta
  *
  * @autor Hugo
  * @access public
  * @return boolean True si se realizó sin problemas
  */
 public function addConsulta($servicio = '', $turno = '', $cantidad = 0, $cubiculo = 1)
 {
     if ($this->getId() == '') {
         return false;
     }
     if ($turno == '') {
         return false;
     }
     if ($servicio == '') {
         return false;
     }
     if (!is_numeric($cantidad)) {
         return false;
     }
     #buscamos el id de la consulta
     $db = TBase::conectaDB();
     $rs = $db->Execute("select idConsulta from consulta where idReporte = " . $this->getId() . " and idServicio = " . $servicio . " and idTurno = " . $turno . " and cubiculo = " . $cubiculo);
     $obj = new TConsulta($rs->fields["idConsulta"]);
     $obj->setIdReporte($this->getId());
     $obj->setServicio($servicio);
     $obj->setTurno($turno);
     $obj->setCantidad($cantidad);
     $obj->setCubiculo($cubiculo);
     return $obj->guardar();
 }
コード例 #18
0
 /**
  * Retorna el precio
  *
  * @autor Hugo
  * @param integer $limite id del Limite
  * @param integer $colores Colores
  * @param integer $tam Identificador del tamaño
  * @param decimal $precio Precio definido
  * @access public
  * @return boolean True si se realizó sin problemas
  */
 public function getPrecio($colores, $tam, $cantidad)
 {
     if ($this->getId() == '') {
         return false;
     }
     if (!($cantidad > 0 and is_numeric($cantidad))) {
         return false;
     }
     $db = TBase::conectaDB();
     $rs = $db->Execute("select precio\nfrom item a join serigrafia b using(idItem) join precioserigrafia c using(idItem) join limite d using(idLimite)\nwhere idItem = " . $this->getId() . " and idTamano = " . $tam . " and colores = " . $colores . " and inferior <= " . $cantidad . " order by inferior desc;");
     if ($rs->EOF) {
         return false;
     }
     return $rs->fields["precio"];
 }
コード例 #19
0
 /**
  * Guarda los datos en la base de datos, si no existe un identificador entonces crea el objeto
  *
  * @autor Hugo
  * @access public
  * @return boolean True si se realizó sin problemas
  */
 public function guardar()
 {
     if (!parent::guardar()) {
         return false;
     }
     $db = TBase::conectaDB();
     $rs = $db->Execute("select idUsuario from doctor where idUsuario = " . $this->getId());
     if ($rs->EOF) {
         $rs = $db->Execute("INSERT INTO doctor(idUsuario)VALUES(" . $this->getId() . ");");
         if (!$rs) {
             return false;
         }
     }
     if ($this->getId() == '') {
         return false;
     }
     $rs = $db->Execute("UPDATE doctor\n\t\t\tSET\n\t\t\t\tcedula = '" . $this->getCedula() . "',\n\t\t\t\tuniversidad = '" . $this->getUniversidad() . "',\n\t\t\t\tespecialidad = '" . $this->getEspecialidad() . "'\n\t\t\tWHERE idUsuario = " . $this->getId());
     return $rs ? true : false;
 }
コード例 #20
0
 /**
  * Elimina un turno
  *
  * @autor Hugo
  * @access public
  * @return boolean True si se realizó sin problemas
  */
 public function delTurno($turno = '')
 {
     if ($this->getId() == '' or $turno == '') {
         return false;
     }
     $db = TBase::conectaDB();
     $rs = $db->Execute("delete from consultorioTurno where idConsultorio = " . $this->getId() . " and idTurno = " . $turno);
     return $rs ? true : false;
 }
コード例 #21
0
ファイル: TTecnicas.php プロジェクト: hugooluisss/cotizador
 /**
  * Retorna el precio
  *
  * @autor Hugo
  * @param integer $cantidad 
  * @access public
  * @return boolean True si se realizó sin problemas
  */
 public function getPrecio($cantidad)
 {
     if ($this->getId() == '') {
         return false;
     }
     if (!($cantidad > 0 and is_numeric($cantidad))) {
         return false;
     }
     $db = TBase::conectaDB();
     $rs = $db->Execute("select precio\nfrom item a join otrastecnicas b using(idItem) join preciootrastecnicas c using(idItem) join limite d using(idLimite)\nwhere idItem = " . $this->getId() . " and inferior <= " . $cantidad . " order by inferior desc;");
     if ($rs->EOF) {
         return false;
     }
     return $rs->fields["precio"];
 }
コード例 #22
0
 /**
  * Guarda los datos en la base de datos, si no existe un identificador entonces crea el objeto
  *
  * @autor Hugo
  * @access public
  * @return boolean True si se realizó sin problemas
  */
 public function guardar()
 {
     $db = TBase::conectaDB();
     //if ($this->idItem == '')
     if (!parent::guardar()) {
         return false;
     }
     $rs = $db->Execute("select idItem from serigrafiadigital where idItem = " . $this->idItem);
     if ($rs->EOF) {
         $rs = $db->Execute("INSERT INTO serigrafiadigital(idItem) VALUES(" . $this->idItem . ");");
         if (!$rs) {
             return false;
         }
     }
     if ($this->getId() == '') {
         return false;
     }
     $rs = $db->Execute("UPDATE serigrafiadigital\n\t\t\tSET\n\t\t\t\tdescripcion = '" . $this->getDescripcion() . "',\n\t\t\t\tprecio = " . ($this->getPrecio() != '' ? $this->getPrecio() : 0) . "\n\t\t\tWHERE idItem = " . $this->idItem);
     return $rs ? true : false;
 }
コード例 #23
0
ファイル: TTrabajador.class.php プロジェクト: hugooluisss/DGI
 public function isSindicalizado()
 {
     if ($this->num_personal == '') {
         return '';
     }
     $db = TBase::conectaDB("sip");
     $rs = $db->Execute("select tipo_personal from ficha_personal where num_personal = " . $this->num_personal);
     return $rs->fields['tipo_personal'] == 1;
 }
コード例 #24
0
ファイル: TProducto.class.php プロジェクト: hugooluisss/pdv
 public function guardar()
 {
     if (!parent::guardar()) {
         return false;
     }
     $db = TBase::conectaDB();
     $rs = $db->Execute("select idItem from producto where idItem = " . $this->getId());
     if ($rs->EOF) {
         $rs = $db->Execute("INSERT INTO producto (idItem, idDepartamento, idTipoCosteo, costo, precio, impInc, imp, marca, minimo, existencias) VALUES (" . $this->getId() . ",\n" . $this->getIdDepartamento() . ", " . $this->getIdTipoCosteo() . ", 0, 0, 'S', 0, '', 0, 0)");
     }
     $rs = $db->Execute("UPDATE producto\n\t\t\tSET\n\t\t\t\tidDepartamento = " . $this->getIdDepartamento() . ",\n\t\t\t\tidTipoCosteo = " . $this->getIdTipoCosteo() . ",\n\t\t\t\tcosto = " . $this->getCosto() . ",\n\t\t\t\tprecio = " . $this->getPrecio() . ",\n\t\t\t\timpInc = '" . $this->impInc . "',\n\t\t\t\timp = " . $this->getImpuesto() . ",\n\t\t\t\tmarca = '" . $this->getMarca() . "',\n\t\t\t\tminimo = " . $this->getMinimo() . ",\n\t\t\t\texistencias = " . $this->getExistencias() . "\n\t\t\tWHERE idItem = " . $this->getId());
     return $rs ? true : false;
 }
コード例 #25
0
ファイル: TUsuario.class.php プロジェクト: hugooluisss/pdv
 public function delete()
 {
     if ($this->getId() == '') {
         return false;
     }
     $db = TBase::conectaDB();
     $db->Execute("update usuario set estado = 'E' where idUsuario = " . $this->getId());
     return true;
 }
コード例 #26
0
 public function truncateMovimientos($lista = false)
 {
     if ($this->getId() == '') {
         return false;
     }
     if ($lista) {
         $this->movimientos = array();
     }
     $db = TBase::conectaDB();
     $db->Execute("delete from movimiento where idCotizacion = " . $this->getId());
 }
コード例 #27
0
ファイル: TOpcion.class.php プロジェクト: hugooluisss/DGI
 /**
  * Carga la lista de opciones al objeto que representa la pregunta
  *
  * @autor Hugo
  * @access public
  * @return array Lista de opciones
  */
 public function getOpciones()
 {
     if ($this->getId() == '') {
         return false;
     }
     $db = TBase::conectaDB();
     $rs = $db->Execute("select idOpcion from opcion where idReactivo = " . $this->getId() . " order by posicion");
     $this->opciones = array();
     while (!$rs->EOF) {
         array_push($this->opciones, new TOpcion($rs->fields['idOpcion']));
         $rs->moveNext();
     }
     return $this->opciones;
 }
コード例 #28
0
 public function generar()
 {
     if ($this->consultorio->getId() == '') {
         return false;
     }
     if ($this->turno['idTurno'] == '') {
         return false;
     }
     if ($this->cubiculo == '') {
         return false;
     }
     $hoja =& $this->libro->addWorksheet('Reporte');
     $titulo =& $this->libro->addFormat();
     $titulo->setHAlign('center');
     $head =& $this->libro->addFormat(array('Size' => 10, 'bold' => 1, 'Color' => 'red'));
     $hoja->write(2, 1, utf8_decode("REPORTE DE CONSULTAS"), $titulo);
     $hoja->mergeCells(2, 1, 2, 37);
     $hoja->setColumn(1, 3, 2);
     $hoja->setColumn(1, 1, 4);
     $hoja->setColumn(4, 5, 10);
     $hoja->write(3, 1, utf8_decode("CLAVE DE LA UNIDAD: " . $this->consultorio->getClave() . "   NOMBRE DE LA UNIDAD: " . $this->consultorio->getNombre()), $head);
     $hoja->mergeCells(3, 1, 3, 18);
     $hoja->write(3, 19, utf8_decode("TURNO: " . $this->turno['nombre']), $head);
     $hoja->mergeCells(3, 19, 3, 30);
     $hoja->write(3, 31, utf8_decode("MES A REPORTAR: " . $this->getMesLetra()), $head);
     $hoja->mergeCells(3, 31, 3, 37);
     $hoja->write(4, 1, utf8_decode("NOMBRE DEL MÉDICO: " . $this->doctor->getNombreCompleto() . "   CÉDULA: " . $this->doctor->getCedula()), $head);
     $hoja->mergeCells(4, 1, 4, 18);
     $hoja->write(4, 19, utf8_decode("CONSULTORIO: " . $this->cubiculo), $head);
     $hoja->mergeCells(4, 19, 4, 30);
     $hoja->write(4, 31, utf8_decode("AÑO: " . $this->anio), $head);
     $hoja->mergeCells(4, 31, 4, 37);
     $dias =& $this->libro->addFormat(array('Size' => 11, 'bold' => 1, "Align" => "center", "border" => 1));
     $hoja->setColumn(6, 36, 3);
     #Dias
     $hoja->mergeCells(5, 1, 5, 5);
     $hoja->write(5, 1, "", $dias);
     for ($dia = 1; $dia < 32; $dia++) {
         $hoja->write(5, $dia + 5, $dia, $dias);
     }
     $hoja->setColumn(37, 37, 7);
     #Total sobre dias
     $hoja->write(5, $dia + 5, "Total", $dias);
     $db = TBase::conectaDB();
     $rs = $db->Execute("select * from tipoServicio");
     $cont = 1;
     $this->libro->setCustomColor(15, 192, 192, 192);
     $formatClasif = array(2 => array('FgColor' => "black", 'color' => "white"), 1 => array('FgColor' => 15));
     $objConsulta = new TConsulta();
     while (!$rs->EOF) {
         $FormTipoServicio =& $this->libro->addFormat(array_merge(array('Size' => 8, "TextRotation" => 270, "Align" => "vcenter"), $formatClasif[$rs->fields['idClasificacion']]));
         $FormTipoServicio->setTextWrap();
         $rsServicios = $db->Execute("select * from servicio where idTipo = " . $rs->fields['idTipo']);
         $hoja->mergeCells($cont + 5, 1, $cont + 4 + $rsServicios->RecordCount(), 1);
         $hoja->write($cont + 5, 1, strtoupper(utf8_decode($rs->fields['descripcion'])), $FormTipoServicio);
         while (!$rsServicios->EOF) {
             $hoja->setRow($cont + 5, 35);
             $hoja->mergeCells($cont + 5, 2, $cont + 5, 3);
             $FormTipoServicio =& $this->libro->addFormat(array_merge(array('Size' => 8, "Align" => "vcenter", "border" => 1), $formatClasif[$rs->fields['idClasificacion']]));
             $hoja->write($cont + 5, 2, $cont, $FormTipoServicio);
             $hoja->mergeCells($cont + 5, 4, $cont + 5, 5);
             $tituloServicios =& $this->libro->addFormat(array('Size' => 8, "border" => 1));
             $tituloServicios->setVAlign('top');
             $tituloServicios->setTextWrap();
             $hoja->write($cont + 5, 4, strtoupper(utf8_decode($rsServicios->fields['nombre'])), $tituloServicios);
             $total = 0;
             $cantidad =& $this->libro->addFormat(array('Size' => 6, "border" => 1));
             for ($dia = 1; $dia < 32; $dia++) {
                 $rsConsulta = $db->Execute("select idConsulta from reporte a join consulta b using(idReporte) where idConsultorio = " . $this->consultorio->getId() . " and cubiculo = " . $this->cubiculo . " and idTurno = " . $this->turno['idTurno'] . " and fecha = '" . $this->anio . "-" . $this->mes . "-" . $dia . "' and idServicio = " . $rsServicios->fields['idServicio'] . " and idDoctor = " . $this->doctor->getId());
                 $objConsulta = new TConsulta($rsConsulta->fields['idConsulta']);
                 $total += $objConsulta->getCantidad();
                 $hoja->write($cont + 5, $dia + 5, $objConsulta->getCantidad() == 0 ? '' : $objConsulta->getCantidad(), $cantidad);
             }
             $hoja->write($cont + 5, $dia + 5, $total, $cantidad);
             $cont++;
             $rsServicios->moveNext();
         }
         $rs->moveNext();
     }
     /*Totales*/
     $cont += 5;
     $fTotales =& $this->libro->addFormat(array('Size' => 10, "bold" => 1, "TextRotation" => 270, "Align" => "vcenter", "Border" => 1));
     $hoja->write($cont, 1, "TOTALES", $fTotales);
     $hoja->mergeCells($cont, 1, $cont + 2, 1);
     $hoja->setRow($cont, 30);
     $hoja->setRow($cont + 1, 30);
     $hoja->setRow($cont + 2, 30);
     $fTotales =& $this->libro->addFormat(array_merge(array('Size' => 10, "bold" => 1, "Border" => 1), $formatClasif[1]));
     $fTotales->setAlign("center");
     $fTotales->setAlign("vcenter");
     $hoja->mergeCells($cont, 2, $cont, 3);
     $hoja->write($cont, 2, "A", $fTotales);
     $fTotales =& $this->libro->addFormat(array_merge(array('Size' => 10, "bold" => 1, "Border" => 1), $formatClasif[2]));
     $fTotales->setAlign("center");
     $fTotales->setAlign("vcenter");
     $hoja->mergeCells($cont + 1, 2, $cont + 1, 3);
     $hoja->write($cont + 1, 2, "B", $fTotales);
     $fTotales =& $this->libro->addFormat(array('Size' => 10, "bold" => 1, "Border" => 1));
     $fTotales->setAlign("center");
     $fTotales->setAlign("vcenter");
     $hoja->mergeCells($cont + 2, 2, $cont + 2, 3);
     $hoja->write($cont + 2, 2, "C", $fTotales);
     $fTotales =& $this->libro->addFormat(array('Size' => 8, "Border" => 1));
     $fTotales->setAlign("vcenter");
     $hoja->write($cont, 4, "TOTAL DE CONSULTAS", $fTotales);
     $hoja->mergeCells($cont, 4, $cont, 5);
     $hoja->write($cont + 1, 4, "TOTAL DE PROCEDIMIENTOS", $fTotales);
     $hoja->mergeCells($cont + 1, 4, $cont + 1, 5);
     $hoja->write($cont + 2, 4, "TOTAL DE ATENCIONES", $fTotales);
     $hoja->mergeCells($cont + 2, 4, $cont + 2, 5);
     $fTotales->setBold(1);
     for ($dia = 1; $dia < 32; $dia++) {
         $rsTotales1 = $db->Execute("select sum(cantidad) as total from reporte a join consulta b using(idReporte) join servicio c using(idServicio) join tipoServicio d using(idTipo) where idConsultorio = " . $this->consultorio->getId() . " and cubiculo = " . $this->cubiculo . " and idTurno = " . $this->turno['idTurno'] . " and fecha = '" . $this->anio . "-" . $this->mes . "-" . $dia . "' and idDoctor = " . $this->doctor->getId() . " and idClasificacion = 1");
         $hoja->write($cont, $dia + 5, sprintf("%d", $rsTotales1->fields['total']), $fTotales);
         $rsTotales2 = $db->Execute("select sum(cantidad) as total from reporte a join consulta b using(idReporte) join servicio c using(idServicio) join tipoServicio d using(idTipo) where idConsultorio = " . $this->consultorio->getId() . " and cubiculo = " . $this->cubiculo . " and idTurno = " . $this->turno['idTurno'] . " and fecha = '" . $this->anio . "-" . $this->mes . "-" . $dia . "' and idDoctor = " . $this->doctor->getId() . " and idClasificacion = 2");
         $hoja->write($cont + 1, $dia + 5, sprintf("%d", $rsTotales2->fields['total']), $fTotales);
         $hoja->write($cont + 2, $dia + 5, sprintf("%d", $rsTotales2->fields['total'] + $rsTotales1->fields['total']), $fTotales);
     }
     $rsTotales1 = $db->Execute("select sum(cantidad) as total from reporte a join consulta b using(idReporte) join servicio c using(idServicio) join tipoServicio d using(idTipo) where idConsultorio = " . $this->consultorio->getId() . " and cubiculo = " . $this->cubiculo . " and idTurno = " . $this->turno['idTurno'] . " and fecha between '" . $this->anio . "-" . $this->mes . "-1' and '" . $this->anio . "-" . $this->mes . "-31' and idDoctor = " . $this->doctor->getId() . " and idClasificacion = 1");
     $hoja->write($cont, $dia + 5, sprintf("%d", $rsTotales1->fields['total']), $fTotales);
     $rsTotales2 = $db->Execute("select sum(cantidad) as total from reporte a join consulta b using(idReporte) join servicio c using(idServicio) join tipoServicio d using(idTipo) where idConsultorio = " . $this->consultorio->getId() . " and cubiculo = " . $this->cubiculo . " and idTurno = " . $this->turno['idTurno'] . " and fecha between '" . $this->anio . "-" . $this->mes . "-1' and '" . $this->anio . "-" . $this->mes . "-31' and idDoctor = " . $this->doctor->getId() . " and idClasificacion = 2");
     $hoja->write($cont + 1, $dia + 5, sprintf("%d", $rsTotales2->fields['total']), $fTotales);
     $hoja->write($cont + 2, $dia + 5, sprintf("%d", $rsTotales2->fields['total'] + $rsTotales1->fields['total']), $fTotales);
     return true;
 }
コード例 #29
0
ファイル: empresa.php プロジェクト: hugooluisss/pdv
<?php

global $objModulo;
switch ($objModulo->getId()) {
    case 'empresa':
        $db = TBase::conectaDB();
        $rs = $db->Execute("select *from empresa");
        $datos = array();
        while (!$rs->EOF) {
            array_push($datos, $rs->fields);
            $rs->moveNext();
        }
        $smarty->assign("lista", $datos);
        break;
    case 'cempresa':
        switch ($objModulo->getAction()) {
            case 'set':
                $db = TBase::conectaDB();
                $rs = $db->Execute("update empresa set valor = '" . $_POST['val'] . "' where tag = '" . $_POST['key'] . "'");
                if ($rs) {
                    echo json_encode(array("band" => "true"));
                } else {
                    echo json_encode(array("band" => "false"));
                }
                break;
        }
        break;
}
コード例 #30
0
ファイル: TExamen.class.php プロジェクト: hugooluisss/DGI
 /**
  * Carga la lista de opciones al objeto que representa la pregunta
  *
  * @autor Hugo
  * @access public
  * @return array Lista de opciones
  */
 public function getReactivo()
 {
     if ($this->getId() == '') {
         return false;
     }
     $db = TBase::conectaDB();
     $rs = $db->Execute("select idReactivo from reactivo where idExamen = " . $this->getId() . " order by posicion");
     $this->reactivos = array();
     while (!$rs->EOF) {
         array_push($this->reactivos, new TReactivo($rs->fields['idReactivo']));
         $rs->moveNext();
     }
     return $this->reactivos;
 }