public function Existe_Presupuesto($id_concepto, $tipo_presupuesto) { $query = sprintf("select * from presupuesto where p_concepto = '%s' and p_tipo = '%s' and p_ano = YEAR(CURDATE())", $id_concepto, $tipo_presupuesto); $result = parent::consultar($query); if (parent::get_rows() > 0) { $row = mysql_fetch_assoc($result); return $row; } else { return NULL; } }
public function Max_Proveedor() { $query = sprintf("SELECT (MAX(pro_id)) FROM proveedores"); $result = parent::consultar($query); $row = 0; if (parent::get_rows() > 0) { $row = mysql_fetch_assoc($result); } $result1 = $row['(MAX(pro_id))']; $result1 = $result1 + 1; return $result1; }
public function Existe_PP($cc_id, $finicial, $ffinal) { $FI = explode("-", $finicial); $FF = explode("-", $ffinal); $query = sprintf("SELECT * FROM periodo_presupuestal WHERE cc_id = {$cc_id} AND pp_periodo_inicial = '" . $FI[2] . "-" . $FI[1] . "-" . $FI[0] . "' AND pp_periodo_final = '" . $FF[2] . "-" . $FF[1] . "-" . $FF[0] . "' "); $result = parent::consultar($query); if (parent::get_rows() > 0) { $row = mysql_fetch_assoc($result); return $row; } else { return NULL; } }
/** * Busca concepto por cuenta y ceco */ public function Busca_ConceptoXIdentificadorAndCeco($cuenta, $ceco, $identificador) { //$queryceco=sprintf("SELECT cc_id from cecos where cc_codigo=%s",$ceco); $query = sprintf("SELECT cg_id FROM conceptos_gastos WHERE cg_cuenta = '%s' AND cg_ceco = '%s' AND cg_identificador = '%s'", $cuenta, $ceco, $identificador); // $query=sprintf("SELECT cg_id FROM conceptos_gastos AS cg // INNER JOIN cecos AS cc // ON (cc.cc_id = cg.cg_ceco) // WHERE cg.cg_identificador = '%s' // AND cc.cc_codigo = '%s'", // $identificador, $ceco); error_log($query); $result = parent::consultar($query); if (parent::get_rows() > 0) { $row = mysql_fetch_assoc($result); return $row; } else { return NULL; } }
require_once "../lib/php/constantes.php"; require_once "../Connections/fwk_db.php"; require_once "../lib/php/configuracion.mailgun.php"; $conexion = new Conexion(); $directorioSalida = realpath(dirname(__FILE__) . "/../../respaldoxml"); $mensaje = ""; ini_set('memory_limit', '1024M'); set_time_limit(6000); $mensaje .= logger("INFO", "======================="); $mensaje .= logger("INFO", "Comienza Proceso"); $mensaje .= logger("INFO", "Creando conexion a BD"); $mensaje .= logger("INFO", "Consultando facturas por procesar"); $sql = "SELECT DATE_FORMAT(t_fecha_cierre, '%Y%m%d') AS t_fecha_cierre, uuid, factura.id_factura, dc_comprobacion, urlMD5, c_folio, YEAR(t_fecha_cierre) as year, DATE_FORMAT(t_fecha_cierre, '%m') as month\r\n\t\t\tFROM factura \r\n\t\t\tJOIN detalle_comprobacion ON detalle_comprobacion.id_factura = factura.id_factura\r\n\t\t\tJOIN comprobaciones ON dc_comprobacion = co_id\r\n\t\t\tJOIN tramites ON co_mi_tramite = t_id\r\n\t\t\tWHERE f_procesada = 0\r\n\t\t\tAND t_etapa_actual = 3\r\n\t\t\t\r\n\t\t\tUNION \r\n\t\t\t\r\n\t\t\tSELECT DATE_FORMAT(t_fecha_cierre, '%Y%m%d') AS t_fecha_cierre, uuid, factura.id_factura, dc_comprobacion, urlMD5, c_folio, YEAR(t_fecha_cierre) as year, DATE_FORMAT(t_fecha_cierre, '%m') as month\r\n\t\t\tFROM factura \r\n\t\t\tJOIN detalle_comprobacion_gastos ON detalle_comprobacion_gastos.id_factura = factura.id_factura\r\n\t\t\tJOIN comprobaciones ON dc_comprobacion = co_id\r\n\t\t\tJOIN tramites ON co_mi_tramite = t_id\r\n\t\t\tWHERE f_procesada = 0\r\n\t\t\tAND t_etapa_actual = 3\r\n\t\t\t\r\n\t\t\tGROUP BY id_factura\r\n\t\t\t"; $res = $conexion->consultar($sql); $row = $conexion->get_data_array($res); $tot = $conexion->get_rows($res); $mensaje .= logger("INFO", "{$tot} Facturas encontradas"); foreach ($row as $key => $val) { try { $facturaString = file_get_contents(dirname(__FILE__) . "/../flujos/comprobaciones/" . $val["urlMD5"] . ".xml"); $facturaXml = new SimpleXMLElement($facturaString); $receptor = $facturaXml->xpath("//cfdi:Receptor"); $rfcReceptor = (string) $receptor[0]["rfc"]; if (!validaDirectorio($directorioSalida, $rfcReceptor)) { creaDirectorio($directorioSalida, $rfcReceptor); } if (!validaDirectorio($directorioSalida . "/" . $rfcReceptor, $val["year"])) { creaDirectorio($directorioSalida . "/" . $rfcReceptor, $val["year"]); } if (!validaDirectorio($directorioSalida . "/" . $rfcReceptor . "/" . $val["year"], $val["month"])) { creaDirectorio($directorioSalida . "/" . $rfcReceptor . "/" . $val["year"], $val["month"]);