if ($estatus != SYS_TODAS) {
    $es_por_estatus = " AND creditos_solicitud.estatus_actual={$estatus} ";
}
//
if ($frecuencia != SYS_TODAS) {
    $es_por_frecuencia = " AND creditos_solicitud.periocidad_de_pago ={$frecuencia} ";
}
//
if ($convenio != SYS_TODAS) {
    $es_por_convenio = " AND creditos_solicitud.tipo_convenio = {$convenio} ";
    if ($estatus == CREDITO_ESTADO_SOLICITADO or $estatus == CREDITO_ESTADO_AUTORIZADO) {
        $BySaldo = " AND (creditos_solicitud.saldo_actual>=0.99) ";
    }
}
/* ******************************************************************************/
$setSql = "SELECT socios.nombre, creditos_solicitud.numero_socio AS 'socio',\n\tcreditos_solicitud.numero_solicitud AS 'solicitud', \n\tcreditos_tipoconvenio.descripcion_tipoconvenio AS 'modalidad',\n\tcreditos_periocidadpagos.descripcion_periocidadpagos AS 'condiciones_de_pago', \n\tgetFechaMX(creditos_solicitud.fecha_ministracion) AS 'fecha_de_otorgamiento',\n\tcreditos_solicitud.monto_autorizado AS 'monto_original', \n\tgetFechaMX(creditos_solicitud.fecha_vencimiento) AS 'fecha_de_vencimiento',\n\t(creditos_solicitud.tasa_interes *100) AS 'tasa_anual',\n\tCONCAT(creditos_solicitud.ultimo_periodo_afectado, '/', creditos_solicitud.pagos_autorizados) AS 'numero_de_pagos',\n\tcreditos_solicitud.periocidad_de_pago AS 'frecuencia', \n\tcreditos_solicitud.saldo_actual AS 'saldo_insoluto',\n\tcreditos_solicitud.fecha_ultimo_mvto, \n\tcreditos_estatus.descripcion_estatus AS 'estatus',\n\tsocios.genero, socios.tipo_ingreso, creditos_solicitud.tipo_autorizacion AS 'modaut'\n\t\tFROM\n\t`creditos_solicitud` `creditos_solicitud`\n\t\tINNER JOIN `creditos_estatus` `creditos_estatus`\n\t\tON `creditos_solicitud`.`estatus_actual` = `creditos_estatus`.\n\t\t`idcreditos_estatus`\n\t\t\tINNER JOIN `creditos_periocidadpagos` `creditos_periocidadpagos`\n\t\t\tON `creditos_solicitud`.`periocidad_de_pago` =\n\t\t\t`creditos_periocidadpagos`.`idcreditos_periocidadpagos`\n\t\t\t\tINNER JOIN `creditos_tipoconvenio` `creditos_tipoconvenio`\n\t\t\t\tON `creditos_solicitud`.`tipo_convenio` =\n\t\t\t\t`creditos_tipoconvenio`.`idcreditos_tipoconvenio`\n\t\t\t\t\tINNER JOIN `socios` `socios`\n\t\t\t\t\tON `creditos_solicitud`.`numero_socio` = `socios`.`codigo`\n\n\tWHERE \n\tcreditos_solicitud.numero_solicitud != 0\n\t{$BySaldo}\n\t{$es_por_estatus}\n\t{$es_por_frecuencia}\n\t{$es_por_convenio}\n\t{$ByEmpresa}\n\tORDER BY `creditos_solicitud`.`estatus_actual`, \n\t`creditos_solicitud`.`tipo_convenio`,\n\tcreditos_solicitud.numero_socio";
//echo $setSql; exit();
if ($input != OUT_EXCEL) {
    $oRpt = new PHPReportMaker();
    $oRpt->setDatabase(MY_DB_IN);
    $oRpt->setUser(RPT_USR_DB);
    $oRpt->setPassword(RPT_PWD_DB);
    $oRpt->setSQL($setSql);
    $oRpt->setXML("../repository/report45b.xml");
    $oOut = $oRpt->createOutputPlugin($input);
    $oRpt->setOutputPlugin($oOut);
    $oRpt->run();
} else {
    $xHP = new cHExcel();
    $xHP->convertTable($setSql);
}
$fecha_inicial = $_GET["on"];
$fecha_final = $_GET["off"];
$compFecha = "\n\t\t(`seguimiento_compromisos`.`fecha_vencimiento` >= '{$fecha_inicial}')\n\t\tAND\n\t\t(`seguimiento_compromisos`.`fecha_vencimiento` <= '{$fecha_final}')";
$input = $_GET["out"];
if (!$input) {
    $input = "default";
}
$setSql = " SELECT\n\t`oficiales`.`id` AS 'oficial',\n\t`oficiales`.`nombre_completo`,\n\t`oficiales`.`puesto`,\n\t`oficiales`.`sucursal`,\n\n\n\t`seguimiento_compromisos`.`socio_comprometido`,\n\t`socios`.`nombre`,\n\n\t`seguimiento_compromisos`.`credito_comprometido`,\n\t`seguimiento_compromisos`.`idseguimiento_compromisos` AS 'clave',\n\t`seguimiento_compromisos`.`fecha_vencimiento`,\n\t`seguimiento_compromisos`.`hora_vencimiento`,\n\t`seguimiento_compromisos`.`tipo_compromiso`,\n\t`seguimiento_compromisos`.`anotacion`,\n\t`seguimiento_compromisos`.`estatus_compromiso`\n\nFROM\n\t`seguimiento_compromisos` `seguimiento_compromisos`\n\t\tINNER JOIN `socios` `socios`\n\t\tON `seguimiento_compromisos`.`socio_comprometido` = `socios`.`codigo`\n\t\t\tINNER JOIN `oficiales` `oficiales`\n\t\t\tON `seguimiento_compromisos`.`oficial_de_seguimiento` = `oficiales`.\n\t\t\t`id`\nWHERE\n\t{$compFecha}\nORDER BY\n\t`oficiales`.`id`,\n\t`seguimiento_compromisos`.`fecha_vencimiento`,\n\t`seguimiento_compromisos`.`hora_vencimiento`,\n\t`seguimiento_compromisos`.`tipo_compromiso`";
//exit($setSql);
if ($input != OUT_EXCEL) {
    $oRpt = new PHPReportMaker();
    $oRpt->setDatabase(MY_DB_IN);
    $oRpt->setUser(RPT_USR_DB);
    $oRpt->setPassword(RPT_PWD_DB);
    $oRpt->setSQL($setSql);
    $oRpt->setXML("../repository/report72.xml");
    $oOut = $oRpt->createOutputPlugin($input);
    $oRpt->setOutputPlugin($oOut);
    $oRpt->run();
    //	*/
} else {
    $filename = $_SERVER['SCRIPT_NAME'];
    $filename = str_replace(".php", "", $filename);
    $filename = str_replace("rpt", "", $filename);
    $filename = str_replace("-", "", $filename);
    $filename = "{$filename}-" . date("YmdHi") . "-from-" . $iduser . ".xls";
    header("Content-type: application/x-msdownload");
    header("Content-Disposition: attachment; filename={$filename}");
    header("Pragma: no-cache");
    header("Expires: 0");
    $cTbl = new cTabla($setSql);
//=====================================================================================================
include_once "../core/entidad.datos.php";
include_once "../core/core.deprecated.inc.php";
include_once "../core/core.fechas.inc.php";
include_once "../libs/sql.inc.php";
include_once "../core/core.config.inc.php";
$xml_f = $_GET["xm"];
$inp_f = $_GET["in"];
$input = "default";
//require_once("PHPReportMaker.php");
//	ini_set("include_path",ini_get("include_path")."/reports");
include_once "../reports/PHPReportMaker.php";
if ($inp_f && $inp_f != "") {
    $input = $inp_f;
}
/******************************************************************************
 *																										*
 *	Use this file to see a sample of PHPReports.											*
 *	Please check the PDF manual for see how to use it.									*
 *	It need to be placed on a directory reached by the web server.					*
 *																										*
 ******************************************************************************/
$oRpt = new PHPReportMaker();
$oRpt->setDatabase(MY_DB_IN);
$oRpt->setUser(RPT_USR_DB);
$oRpt->setPassword(RPT_PWD_DB);
$oRpt->setXML($xml_f);
$oOut = $oRpt->createOutputPlugin($input);
$oRpt->setOutputPlugin($oOut);
$oRpt->run();
//	*/
Пример #4
0
<?php

require_once "PHPReportMaker.php";
/******************************************************************************
 *																										*
 *	Use this file to see a sample of PHPReports.											*
 *	Please check the PDF manual for see how to use it.									*
 *	It need to be placed on a directory reached by the web server.					*
 *																										*
 ******************************************************************************/
$oRpt = new PHPReportMaker();
$oRpt->setUser("taq");
$oRpt->setPassword("******");
$oRpt->setXML("sales.xml");
$oOut = $oRpt->createOutputPlugin("default");
$oRpt->setOutputPlugin($oOut);
$oRpt->run();
//http://localhost/rptotros/rpt_mvtos_x_tipo_segun_fechas.php
//estado=todas
//out=default
//empresa=todas
//convenio=todas
//tipodepago=transferenci
//usuario=todas
if ($output != OUT_EXCEL) {
    $fmt = "getFechaMX";
}
$BySucursal = $sucursal == SYS_TODAS ? "" : "  AND operaciones_mvtos.sucursal = '{$sucursal}'  ";
$xmlFile = "report73";
$ByPersona = $persona == SYS_NINGUNO ? "" : " AND operaciones_mvtos.socio_afectado={$persona} ";
$ByOperacion = $operacion == SYS_TODAS ? "" : " AND `operaciones_mvtos`.`tipo_operacion` = {$operacion} ";
$ByPago = $forma_de_pago == SYS_TODAS ? "" : " AND operaciones_recibos.tipo_pago ='{$forma_de_pago}' ";
$setSql = " SELECT\n\t\t\t\toperaciones_mvtos.sucursal,\n\t\t\t\toperaciones_recibos.tipo_pago \t\t\t\tAS 'tipo_de_pago',\n\t\t\t\toperaciones_mvtos.socio_afectado \t\t\tAS 'numero_de_socio',\n\t\t\t\tCONCAT(socios_general.apellidopaterno, ' ', socios_general.apellidomaterno, ' ',socios_general.nombrecompleto) AS\n\t\t\t\t'nombre_completo',\n\t\t\t\toperaciones_tipos.descripcion_operacion \tAS 'tipo_de_operacion',\n\t\t\t\t{$fmt}(operaciones_mvtos.fecha_afectacion) \t\t\tAS 'fecha',\n\t\t\t\t`operaciones_mvtos`.`idoperaciones_mvtos`\tAS `operacion`,\n\t\t\t\t`operaciones_mvtos`.`recibo_afectado`   \tAS `recibo`,\n\t\t\t\t`operaciones_recibos`.`recibo_fiscal`   \tAS `fiscal`,\n\t\t\t\toperaciones_mvtos.docto_afectado \t\t\tAS 'documento',\n\t\t\t\toperaciones_mvtos.afectacion_real\t\t\tAS 'monto',\n\t\t\t\toperaciones_mvtos.detalles \t\t\t\t\tAS 'observaciones'\n\t\t\t\tFROM\n\t\t\t\t`socios_general` `socios_general`\n\t\t\t\tINNER JOIN `operaciones_mvtos` `operaciones_mvtos`\n\t\t\t\tON `socios_general`.`codigo` = `operaciones_mvtos`.`socio_afectado`\n\t\t\t\t\tINNER JOIN `operaciones_recibos` `operaciones_recibos`\n\t\t\t\t\tON `operaciones_recibos`.`idoperaciones_recibos` =\n\t\t\t\t\t`operaciones_mvtos`.`recibo_afectado`\n\t\t\t\t\t\tINNER JOIN `operaciones_tipos` `operaciones_tipos`\n\t\t\t\t\t\tON `operaciones_tipos`.`idoperaciones_tipos` =\n\t\t\t\t\t\t`operaciones_mvtos`.`tipo_operacion`\n\t\t\t\tWHERE operaciones_mvtos.fecha_afectacion>='{$fecha_inicial}' AND operaciones_mvtos.fecha_afectacion<='{$fecha_final}'\n\t\t\t\t\t{$ByPersona}\n\t\t\t\t\t{$BySucursal}\n\t\t\t\t\t{$ByOperacion}\n\t\t\t\t\t{$ByPago}\n\t\t\tORDER BY\n\t\t\t\t`operaciones_mvtos`.`sucursal`,\n\t\t\t\t`operaciones_recibos`.`fecha_operacion`,\n\t\t\t\t`operaciones_recibos`.`idoperaciones_recibos`,\n\t\t\t\t`operaciones_mvtos`.`idoperaciones_mvtos` ";
//exit($setSql);
if ($output != OUT_EXCEL) {
    $oRpt = new PHPReportMaker();
    $oRpt->setDatabase(MY_DB_IN);
    $oRpt->setUser(RPT_USR_DB);
    $oRpt->setPassword(RPT_PWD_DB);
    $oRpt->setSQL($setSql);
    $oRpt->setXML("../repository/{$xmlFile}.xml");
    $oOut = $oRpt->createOutputPlugin($output);
    $oRpt->setOutputPlugin($oOut);
    $oRpt->run();
} else {
    $xls = new cHExcel();
    $xls->convertTable($setSql);
}
 function render($includeHeaders = false)
 {
     $xOH = new cHObject();
     $cnt = "";
     $toMail = count($this->mSenders) >= 1 ? true : false;
     $body = "";
     if ($includeHeaders == true) {
         $this->mHeader .= getRawHeader(false, $this->mOut);
         $this->mFooter = getRawFooter(false, $this->mOut) . $this->mFooter;
     }
     if ($this->mIncluirH3 == true) {
         $this->mHeader = $this->mHeader . "<h3 class='title'>" . $this->mTitulo . "</h3>";
     }
     switch ($this->mOut) {
         case OUT_EXCEL:
             if ($this->mSQL != "") {
                 $xls = new cHExcel();
                 $html = $this->mHeader . $this->mBody . $this->mFooter;
                 $xls->addContent($html);
                 //$cnt 	= $xls->convertTable($this->mSQL, $this->mTitulo, true);
                 $cnt = $xls->render();
             }
             break;
         case OUT_RXML:
             $arrPar = array("titulo" => $this->mTitulo);
             $output = SYS_DEFAULT;
             $oRpt = new PHPReportMaker();
             $oRpt->setParameters($arrPar);
             $oRpt->setDatabase(MY_DB_IN);
             $oRpt->setUser(RPT_USR_DB);
             $oRpt->setPassword(RPT_PWD_DB);
             $oRpt->setSQL($this->mSQL);
             $oRpt->setXML("../repository/" . $this->mFile . ".xml");
             $oOut = $oRpt->createOutputPlugin("html");
             //$oOut->setClean(false);
             $oRpt->setOutputPlugin($oOut);
             //echo  $oRpt->run(true);exit;
             if ($toMail == true) {
                 $html = $oRpt->run(true);
                 $title = $xOH->getTitulize($this->mTitulo);
                 $body = $this->mBodyMail == "" ? $title : $this->mBodyMail;
                 $dompdf = new DOMPDF();
                 $dompdf->load_html($html);
                 $dompdf->set_paper("letter", "portrait");
                 $dompdf->render();
                 $this->mFile = PATH_TMP . "" . $title . ".pdf";
                 $output = $dompdf->output();
                 file_put_contents($this->mFile, $output);
             } else {
                 $oRpt->run();
             }
             break;
         case OUT_PDF:
             $html = $this->mHeader . $this->mBody . $this->mFooter;
             $title = $xOH->getTitulize($this->mTitulo);
             $body = $this->mBodyMail == "" ? $title : $this->mBodyMail;
             $dompdf = new DOMPDF();
             $dompdf->load_html($html);
             $dompdf->set_paper("letter", "portrait");
             $dompdf->render();
             if ($toMail == true) {
                 $this->mFile = PATH_TMP . "" . $title . ".pdf";
                 $output = $dompdf->output();
                 file_put_contents($this->mFile, $output);
             } else {
                 $this->mFile = $title . ".pdf";
                 # Enviamos el fichero PDF al navegador.
                 $dompdf->stream($this->mFile);
             }
             break;
         default:
             $cnt = $this->mHeader . $this->mBody . $this->mFooter;
             if ($toMail == true) {
                 $html = $cnt;
                 $title = $xOH->getTitulize($this->mTitulo);
                 $dompdf = new DOMPDF();
                 $dompdf->load_html($html);
                 $dompdf->set_paper("letter", "portrait");
                 $dompdf->render();
                 $body = $this->mBodyMail == "" ? $title : $this->mBodyMail;
                 $this->mFile = PATH_TMP . "" . $title . ".pdf";
                 $output = $dompdf->output();
                 file_put_contents($this->mFile, $output);
             } else {
                 if ($this->mOut == OUT_DOC) {
                     $this->mJS = "";
                 }
                 $this->mJS = $this->mJS == "" ? "" : "<script>var xRpt = new RepGen();" . $this->mJS . "</script>";
                 $footerbar = trim($this->mFooterBar) == "" ? "" : "<div class='footer-bar warning'>" . $this->mFooterBar . "</div>";
                 $cnt = $this->mHeader . $this->mBody . $this->mJS . $footerbar . $this->mFooter;
             }
             break;
     }
     if ($toMail == true) {
         $xMail = new cNotificaciones();
         foreach ($this->mSenders as $idmail => $email) {
             $this->mMessages .= $xMail->sendMail($this->mTitulo, $body, $email, array("path" => $this->mFile));
         }
         if ($this->mResponse == true) {
             $rs = array("message" => $this->mMessages);
             $cnt = json_encode($rs);
         }
     }
     return $cnt;
 }
    $BySaldo = "";
}
//
if ($frecuencia != SYS_TODAS) {
    $nfreq = eltipo("creditos_periocidadpagos", $frecuencia);
    $es_por_frecuencia = " AND creditos.periocidad='{$nfreq}' ";
}
//
if ($convenio != SYS_TODAS) {
    $nconv = eltipo("creditos_tipoconvenio", $convenio);
    $es_por_convenio = " AND creditos.convenio = '{$nconv}' ";
}
$f3 = $_GET["f3"];
$input = isset($_GET["out"]) ? $_GET["out"] : SYS_DEFAULT;
$setSql = "\n\tSELECT socios_cajalocal.idsocios_cajalocal AS 'id',\n\tsocios.numero_caja_local,\n\tsocios_cajalocal.descripcion_cajalocal AS 'caja_local',\n\tsocios.nombre, creditos.*\n\tFROM socios_cajalocal,\n\tsocios,\n\tcreditos\n\tWHERE socios.numero_caja_local=socios_cajalocal.idsocios_cajalocal\n\tAND creditos.numero_socio=socios.codigo\n\t{$BySaldo}\n\t{$ByFecha}\n\t{$es_por_convenio}\n\t{$es_por_frecuencia}\n\t{$es_por_estatus}\n\tORDER BY socios.numero_caja_local\n\t";
//exit($setSql);
if ($input != OUT_EXCEL) {
    $oRpt = new PHPReportMaker();
    $oRpt->setDatabase(MY_DB_IN);
    $oRpt->setUser(RPT_USR_DB);
    $oRpt->setPassword(RPT_PWD_DB);
    $oRpt->setSQL($setSql);
    $oRpt->setXML("../repository/report31a.xml");
    $oOut = $oRpt->createOutputPlugin($input);
    $oRpt->setOutputPlugin($oOut);
    $oRpt->run();
    //	*/
} else {
    $xEx = new cHExcel();
    $xEx->convertTable($setSql, "Creditos Generales");
}
//=====>	INICIO_H
include_once "../core/go.login.inc.php";
include_once "../core/core.error.inc.php";
include_once "../core/core.html.inc.php";
include_once "../core/core.init.inc.php";
$theFile = __FILE__;
$permiso = getSIPAKALPermissions($theFile);
if ($permiso === false) {
    header("location:../404.php?i=999");
}
$_SESSION["current_file"] = addslashes($theFile);
//<=====	FIN_H
$iduser = $_SESSION["log_id"];
//=====================================================================================================
$xHP = new cHPage("", HP_RPTXML);
$xml = parametro("x");
$input = parametro("i", SYS_DEFAULT);
//ini_set("display_errors", "on");
if ($input != OUT_EXCEL) {
    $oRpt = new PHPReportMaker();
    $oRpt->setDatabase(MY_DB_IN);
    $oRpt->setUser(RPT_USR_DB);
    $oRpt->setPassword(RPT_PWD_DB);
    $oRpt->setXML("../repository/report" . $xml . ".xml");
    $oOut = $oRpt->createOutputPlugin($input);
    $oRpt->setOutputPlugin($oOut);
    $oRpt->run();
    $oRpt->preview();
} else {
}
$fecha_final = $_GET["off"];
$f1 = $_GET["f1"];
$recibo = $_GET["f10"];
$input = $_GET["out"];
if (!isset($recibo)) {
    $recibo = $_GET["recibo"];
}
if (!$input) {
    $input = "default";
}
$setSql = " SELECT\n\t`operaciones_recibos`.`fecha_operacion`             AS `fecha_de_recibo`,\n\t`operaciones_recibostipo`.`descripcion_recibostipo` AS `tipo_de_recibo`,\n\t`operaciones_recibos`.`total_operacion`             AS `total_recibo`,\n\t`operaciones_recibos`.`observacion_recibo`          AS `observaciones`,\n\t`operaciones_recibos`.`cheque_afectador`            AS `cheque`,\n\t`operaciones_recibos`.`tipo_pago`                   AS `forma_de_pago`,\n\t`operaciones_recibos`.`idoperaciones_recibos`       AS `recibo`,\n\t`operaciones_mvtos`.`socio_afectado`                AS `socio`,\n\tCONCAT(`socios_general`.`apellidopaterno`, ' ', `socios_general`.`apellidomaterno`, ' ',\n     `socios_general`.`nombrecompleto`)                 AS `nombre`,\n\t`operaciones_mvtos`.`docto_afectado`                AS `documento`,\n\t`operaciones_tipos`.`descripcion_operacion`         AS `operacion`,\n\t`operaciones_mvtos`.`fecha_vcto`                    AS `fecha`,\n\t`operaciones_mvtos`.`afectacion_real`               AS `monto`,\n\t`operaciones_mvtos`.`periodo_socio`              \tAS `periodo`\nFROM\n\t`operaciones_mvtos` `operaciones_mvtos`\n\t\tINNER JOIN `operaciones_tipos` `operaciones_tipos`\n\t\tON `operaciones_mvtos`.`tipo_operacion` = `operaciones_tipos`.\n\t\t`idoperaciones_tipos`\n\t\t\tINNER JOIN `operaciones_recibos` `operaciones_recibos`\n\t\t\tON `operaciones_recibos`.`idoperaciones_recibos` =\n\t\t\t`operaciones_mvtos`.`recibo_afectado`\n\t\t\t\tINNER JOIN `operaciones_recibostipo` `operaciones_recibostipo`\n\t\t\t\tON `operaciones_recibos`.`tipo_docto` =\n\t\t\t\t`operaciones_recibostipo`.`idoperaciones_recibostipo`\n\t\t\t\t\tINNER JOIN `socios_general` `socios_general`\n\t\t\t\t\tON `operaciones_mvtos`.`socio_afectado` = `socios_general`.\n\t\t\t\t\t`codigo`\nWHERE\n\t(`operaciones_recibos`.`idoperaciones_recibos` = {$recibo} )\nORDER BY\n\t`operaciones_recibos`.`idoperaciones_recibos`,\n\t`operaciones_mvtos`.`socio_afectado`,\n\t`operaciones_mvtos`.`docto_afectado`,\n\t`operaciones_mvtos`.`periodo_socio`\n";
if ($input != OUT_EXCEL) {
    $oRpt = new PHPReportMaker();
    $oRpt->setDatabase(MY_DB_IN);
    $oRpt->setUser(RPT_USR_DB);
    $oRpt->setPassword(RPT_PWD_DB);
    $oRpt->setSQL($setSql);
    $oRpt->setXML("../repository/report22-B.xml");
    $oOut = $oRpt->createOutputPlugin($input);
    $oRpt->setOutputPlugin($oOut);
    $oRpt->run();
} else {
    $filename = "export_from_" . date("YmdHi") . "_to_uid-" . $iduser . ".xls";
    header("Content-type: application/x-msdownload");
    header("Content-Disposition: attachment; filename={$filename}");
    header("Pragma: no-cache");
    header("Expires: 0");
    $cTbl = new cTabla($setSql);
    $cTbl->setWidth();
    $cTbl->Show("", false);
}