function Reporte_Gastos($fechaInicio, $fechaFin, $empresa, $usuario, $centro, $concepto) { $cnn = new conexion(); $aux = array(); $extra = ""; if ($empresa > 0 && $empresa != 'Todas') { $extra .= " and U.u_empresa in (select e_id from empresas where e_id='{$empresa}')"; } if ($centro != "Todas") { $extra .= " and EP.idcentrocosto='{$centro}'"; } if ($usuario != "Todas") { $extra .= " and T.t_iniciador='{$usuario}'"; } if ($concepto != "Todas") { $extra .= " and CC.dc_id='{$concepto}'"; } // Convierte fechas a formato de mysql $date = explode("/", $fechaInicio); $fechaInicio = $date[2] . "-" . $date[1] . "-" . $date[0]; $date = explode("/", $fechaFin); $fechaFin = $date[2] . "-" . $date[1] . "-" . $date[0]; $query = sprintf("SELECT \ne_codigo,cc_centrocostos,u_nombre,cp_concepto, SUM(dc_total_aprobado) as total\nFROM comprobaciones C \nINNER JOIN tramites T ON (C.co_mi_tramite=T.t_id)\nINNER JOIN detalle_comprobacion DC on (C.co_id=DC.dc_comprobacion) \nINNER JOIN usuario U on(T.t_iniciador=U.u_id) \nINNER JOIN empleado EP on (U.u_id=EP.idfwk_usuario)\nINNER JOIN cat_cecos CECO ON (EP.idcentrocosto = CECO.cc_id)\nINNER JOIN empresas E on (U.u_empresa=E.e_id) \nINNER JOIN cat_conceptos CC on (DC.dc_concepto=CC.dc_id)\nWHERE DC.dc_id=DC.dc_id \n AND(C.co_fecha_registro >='%s 00:00:01' and C.co_fecha_registro<='%s 23:59:59') %s \nGROUP BY e_codigo,cc_centrocostos,u_nombre,cp_concepto", $fechaInicio, $fechaFin, $extra); //error_log($query); $rst = $cnn->consultar($query); while ($fila = mysql_fetch_assoc($rst)) { array_push($aux, $fila); } return $aux; }
public function Siguiente_Etapa($etapa) { $query = sprintf("select et_siguiente_etapa from etapas where et_id=%s", $etapa); $rst = parent::consultar($query); $etapa = mysql_result($rst, 0, 0); return $etapa; }
public function Load_Homologacion_Usuarios($id) { $arr = array(); $query = sprintf("SELECT hd_u_id FROM homologacion_dueno \n WHERE hd_au_id='%s'", $id); //error_log($query); return $this->rst_grupo_usuario = parent::consultar($query); }
public function Load_Tramite($id) { $query = sprintf("select * from tramites where t_id=%s", $id); $this->rst_tramite = parent::consultar($query); if (parent::get_rows() > 0) { $this->t_id = $this->Get_dato("t_id"); } }
public function cargaGastoporTramite($idTramite) { $query = sprintf("SELECT * FROM solicitud_gastos WHERE sg_tramite = '%s'", $idTramite); $this->rst_solGastos = parent::consultar($query); if (parent::get_rows() > 0) { $this->sg_id = $this->Get_dato("sg_id"); } }
function Get_nombre_proveedores($dato) { $cnn = new conexion(); $query = "select pro_proveedor from proveedores where pro_rfc like '%{$dato}%'"; $rst = $cnn->consultar($query); $fila = mysql_fetch_assoc($rst); echo $fila["pro_proveedor"]; }
public function obtenerCargosporID($idamex) { $query = sprintf("SELECT * FROM amex WHERE idamex = '%s'", $idamex); $this->rst_rstAMEX = parent::consultar($query); if (parent::get_rows() > 0) { $this->idamex = $this->Get_dato("idamex"); } }
/** * Cargamos los datos de un concepto * */ public function Load_Catalogs($id) { $query = sprintf("select * from cat_regiones_conceptos where reco_id=%s", $id); $this->rst_catalogo = parent::consultar($query); if (parent::get_rows() > 0) { $this->dc_id = $this->Get_dato("reco_id"); } }
public function obtenerProveedorporRFC($rfc) { $query = sprintf("SELECT * FROM proveedores WHERE pro_rfc = '%s'", $rfc); $this->rst_proveedores = parent::consultar($query); if (parent::get_rows() > 0) { $this->pro_id = $this->Get_dato("pro_id"); } }
public function cargaDetalleComprobacion($idComprobacion) { $query = sprintf("SELECT * FROM detalle_comprobacion_gastos WHERE dc_comprobacion = '%s'", $idComprobacion); $this->rst_detalleCompGastos = parent::consultar($query); if (parent::get_rows() > 0) { $this->dc_id = $this->Get_dato("dc_id"); } }
private function Busca_papa_por_hijo($dir) { global $RUTA_R; $query = sprintf("select * from menu where m_pertenece_a in (select m_pertenece_a from menu where m_ruta='%s') order by m_orden,m_nombre;", $dir); $rst = parent::consultar($query); while ($fila = mysql_fetch_assoc($rst)) { $this->hijos[$fila["m_nombre"]] = $RUTA_R . $fila["m_ruta"]; } }
public function existe_producto($descripcion, $marca) { $consulta = "select * from productos where descripcion like '{$descripcion}' and fabricante like '{$marca}'"; $resultado = conexion::consultar($consulta); if (conexion::contar_filas($resultado) > 0) { return true; } else { return false; } }
public function existe_servicio($descripcion = '', $maquina) { $consulta = "select * from servicios\n\t\twhere descripcion like '{$descripcion}' and maquinaria like '{$maquina}'"; $resultado = conexion::consultar($consulta); if (conexion::contar_filas($resultado) > 0) { return true; } else { return false; } }
/** * Busca concepto por cuenta */ public function Busca_ConceptoXCuenta($cuenta) { $query = sprintf("SELECT dc_id FROM cat_conceptosbmw WHERE cp_cuenta =%s", $cuenta); $result = parent::consultar($query); if (parent::get_rows() > 0) { $row = mysql_fetch_assoc($result); return $row; } else { return NULL; } }
function Descuentos() { $aux = array(); $cnn = new conexion(); $query = "SELECT * from rechazos "; $rst = $cnn->consultar($query); while ($fila = mysql_fetch_assoc($rst)) { array_push($aux, array("nombre" => $fila["re_motivo"])); } return $aux; }
function Load_all() { $arr = array(); $query = sprintf("SELECT * FROM empleado "); $arrEmpleado = array(); $var = parent::consultar($query); while ($arr = mysql_fetch_assoc($var)) { array_push($arrEmpleado, $arr); } return $arrEmpleado; }
public function Load_all() { $arr = array(); $query = sprintf("select * from cat_conceptos order by cc_centrocostos "); $arrConceptos = array(); $var = parent::consultar($query); while ($arr = mysql_fetch_assoc($var)) { array_push($arrConceptos, $arr); } return $arrConceptos; }
public function Load_comensales_by_comprobacion($idcomprobacion) { $arr = array(); $query = sprintf("SELECT * FROM comensales WHERE c_comprobacion = %s ORDER BY id_comensal", $idcomprobacion); $arrComensales = array(); $var = parent::consultar($query); while ($arr = mysql_fetch_assoc($var)) { array_push($arrComensales, $arr); } return $arrComensales; }
/** * Carga los nombres de vicepresidencia para los reportes. */ function Load_vnombre() { $arr = array(); $query = sprintf("SELECT v_nombre FROM vicepresidencia"); $arrVicnom = array(); $var = parent::consultar($query); while ($arr = mysql_fetch_assoc($var)) { array_push($arrVicnom, $arr); } return $arrVicnom; }
public function Load_all() { $arr = array(); $query = sprintf("select * from grupos "); $arrGrupos = array(); $var = parent::consultar($query); while ($arr = mysql_fetch_assoc($var)) { array_push($arrGrupos, $arr); } return $arrGrupos; }
function verificaCotizaciones($id) { $cnn = new conexion(); $query = "SELECT sv_monto_vuelo, sv_vuelo, sv_id_agencia \n\t\t\t\t\tFROM solicitud_viaje \n\t\t\t\t\tWHERE sv_vuelo = 1 \n\t\t\t\t\tAND sv_id_agencia = 0\n\t\t\t\t\tAND sv_tramite = {$id}"; $res = $cnn->consultar($query); $tot = @mysql_num_rows($res); $banderaavion = $tot >= 1 ? 0 : 1; $query = "SELECT sv_id\n\t\t\t\t\tFROM solicitud_viaje, sv_itinerario, hospedaje\n\t\t\t\t\tWHERE sv_id = svi_solicitud\n\t\t\t\t\tAND svi_id = h_id_itinerario\n\t\t\t\t\tAND sv_tramite = {$id}\n\t\t\t\t\tAND h_id_agencia = 0"; $res = $cnn->consultar($query); $tot = @mysql_num_rows($res); $banderahospedaje = $tot >= 1 ? 0 : 1; $query = "SELECT sv_id\n\t\t\t\t\tFROM solicitud_viaje, sv_itinerario, traslados\n\t\t\t\t\tWHERE sv_id = svi_solicitud\n\t\t\t\t\tAND svi_id = t_id_itinerario\n\t\t\t\t\tAND sv_tramite = {$id}\n\t\t\t\t\tAND t_id_agencia = 0"; $res = $cnn->consultar($query); $tot = @mysql_num_rows($res); $banderatraslados = $tot >= 1 ? 0 : 1; if ($banderahospedaje == 1 && $banderatraslados == 1 && $banderaavion == 1) { $sql = "UPDATE tramites SET t_dueno = t_iniciador WHERE t_id = {$id}"; @mysql_query($sql); } }
function Load_Usuarios() { $aux = array(); $cnn = new conexion(); $query = "select * from usuario order by u_nombre, u_paterno, u_materno;"; $rst = $cnn->consultar($query); while ($fila = mysql_fetch_assoc($rst)) { $nombre = $fila["u_nombre"] . " " . $fila["u_paterno"] . " " . $fila["u_materno"]; array_push($aux, array("id" => $fila["u_id"], "nombre" => $nombre)); } return $aux; }
function jefeNombre($idjefe) { $cnn = new conexion(); // Obtener tasa USD $query = "SELECT * FROM empleado WHERE idempleado = {$idjefe}"; $rst = $cnn->consultar($query); $item = array(); while ($fila = mysql_fetch_assoc($rst)) { $nombreJefe = $fila['idempleado'] . '|' . $fila['nombre']; } return $nombreJefe; }
function get_select_conceptos_viaje($tipoDivisa) { $ret = ""; $idusuario = $_SESSION["idusuario"]; $nivelUser = $_SESSION["nivelUser"]; $cnn = new conexion(); $query = sprintf("SELECT cp_concepto, cp_retencion, dc_id, p_id, cp_deducible as deducible, coalesce(p_cantidad, 0) AS p_cantidad, cp_recurrente FROM cat_conceptos LEFT JOIN parametros ON (dc_id=p_concepto and p_nivel_usuario=%s and p_divisa='{$tipoDivisa}') WHERE cp_activo=true AND cp_en_anticipo = 1 AND dc_catalogo=1 and cp_empresa_id = " . $_SESSION["empresa"] . " ORDER BY cp_concepto", $nivelUser); //error_log($query); $rst = $cnn->consultar($query); while ($fila = mysql_fetch_assoc($rst)) { $ret = $ret . "<option id=" . $fila["cp_concepto"] . " value=" . $fila["dc_id"] . "&" . $fila["p_cantidad"] . "&" . $fila["cp_recurrente"] . ">" . $fila["cp_concepto"] . "</option>"; } return $ret; }
function Get_list_rfc_proveedores($dato, $sociedad) { $cnn = new conexion(); $query = "select pro_nif from proveedores where pro_nif like '{$dato}%' AND pro_sociedad = '{$sociedad}' AND pro_activo = 1 order by pro_nif"; $rst = $cnn->consultar($query); if (!mysql_num_rows($rst)) { echo " "; } else { while ($fila = mysql_fetch_assoc($rst)) { echo $fila["pro_nif"] . "\n"; } } //error_log($query); }
/** * La funcion permite obtener el objeto de la BD deseado */ public function obtenerParametro() { $cnn = new conexion(); $codigo = $this->codigo; $id = $this->id; $sql = "SELECT * \r\n\t\t\t\t\tFROM parametros_sistema\r\n\t\t\t\t\tWHERE ps_id = '{$id}'\r\n\t\t\t\t\tOR ps_codigo = '{$codigo}'"; $res = $cnn->consultar($sql); $row = mysql_fetch_assoc($res); $array = array("id" => $row["ps_id"], "descripcion" => $row["ps_descripcion"], "codigo" => $row["ps_codigo"], "valor" => $row["ps_valor"], "flujo" => $row["f_id"]); foreach ($array as $key => $value) { $this->{$key} = $value; } return json_encode($array); }
public function Busca_CeCoXCodigo($codigoCC, $idSoc) { $query = sprintf("SELECT cc_id FROM cecos WHERE cc_sociedad_id = '%s' AND cc_codigo = '%s'", $idSoc, $codigoCC); //error_log($query); $result = parent::consultar($query); return mysql_result($result, 0, 'cc_id'); // $result=parent::consultar($query); // if(parent::get_rows()>0){ // $row=mysql_fetch_assoc($result); // return $row; // }else{ // return NULL; // } }
public function Load_all_conceptos_gastos($estatus = "") { //1 para seleccionar los activos, 0 para seleccionar los inactivos y ""(vacio) para seleccionar todos $arr = array(); $agrupar = ""; $query = "SELECT * FROM conceptos_gastos WHERE cg_estatus like '%{$estatus}%' GROUP BY cg_nombre"; error_log($query); $arrEmp = array(); $var = parent::consultar($query); while ($arr = mysql_fetch_assoc($var)) { array_push($arrEmp, $arr); } return $arrEmp; }
public function Carga_Datos($fecha, $fecha2) { $aux = array(); $cnn = new conexion(); $query = sprintf(" select T.t_id as id,T.t_cancelado as cancelado, T.t_cerrado as seleccionado, concat(U.u_paterno,' ',U.u_materno,' ',U.u_nombre) as nombre, SG.sg_anticipo as monto,date(T.t_fecha_registro) as fecha from solicitud_gastos SG inner join tramites T on (T.t_id=SG.sg_tramite) inner join usuario U on (U.u_id=T.t_iniciador) where SG.sg_referencia_comprobacion is not null and (T.t_fecha_registro >='%s 00:00:01' and T.t_fecha_registro <='%s 23:59:59');", $fecha, $fecha2); $rst = $cnn->consultar($query); while ($fila = mysql_fetch_assoc($rst)) { $fila["seleccionado"] = $fila["seleccionado"] == true ? true : false; $fila["cancelado"] = $fila["cancelado"] == true ? true : false; $fila["editable"] = $fila["seleccionado"] == true ? false : true; array_push($aux, $fila); } return $aux; }
public function GetObservaciones($id) { file_put_contents('text.txt', "saludos 1"); $cnn = new conexion(); $aux = array(); $asignado = ""; if ($id > 0) { $query = sprintf("select * from notificaciones where nt_tramite=%s and nt_comentarios!='Ninguno'", $id); $rst = $cnn->consultar($query); while ($fila = mysql_fetch_assoc($rst)) { array_push($aux, array("observacion" => $fila["nt_comentarios"] . " \n" . $fila["nt_fecha"])); } } return $aux; }