function __construct($credito, $fecha = false) { $xF = new cFecha(); $this->mClaveDeCredito = $credito; $this->mFechaDeCorte = $fecha == false ? fechasys() : $fecha; $xF->set($this->mFechaDeCorte); $this->mFechaDeCorte = $xF->get(); $this->mMessages .= "WARN\t1FECHA_DE_REPORTE AS " . $this->mFechaDeCorte . " \r\n"; }
?> </td> </tr> <tr> <td><?php echo $xHP->lang("numero de", "pagos"); ?> </td> <td><input name="numpagos" type="number" value="2" id="idnumpagos" onblur="jsaValidarMontoDeCredito()" class="mny" size="4"/></td> <td><?php echo $xHP->lang("fecha de", "vencimiento"); ?> </td> <td id="idthvcto"><?php $xF0 = new cFecha(0); $xF0->set($xF0->setSumarDias(EACP_DIAS_MINIMO_CREDITO)); $xF0->show(false, "OPERATIVO"); ?> </td> </tr> <tr> <td><?php echo $xHP->lang("monto", "solicitado"); ?> </td> <td><input name="montosol" type ="number" value = "0.00" id="idmontosol" onchange="jsValidarMonto();jsaGetLetrasByNumero();" onblur=" jsaGetLetrasByNumero();" class="mny"/></td> <th colspan="2"><div id="idmontoletras" ></div></th> </tr> <tr> <td><?php
$frecuencia = parametro("periocidad", SYS_TODAS); $producto = parametro("convenio", SYS_TODAS); $producto = parametro("producto", $producto); $empresa = parametro("empresa", SYS_TODAS); $out = parametro("out", SYS_DEFAULT); $FechaInicial = parametro("on", false); $FechaInicial = parametro("fecha-0", $FechaInicial); $FechaInicial = $FechaInicial == false ? FECHA_INICIO_OPERACIONES_SISTEMA : $xF->getFechaISO($FechaInicial); $FechaFinal = parametro("off", false); $FechaFinal = parametro("fecha-1", $FechaFinal); $FechaFinal = $FechaFinal == false ? fechasys() : $xF->getFechaISO($FechaFinal); $jsEvent = $out != OUT_EXCEL ? "initComponents()" : ""; $senders = getEmails($_REQUEST); $sucursal = parametro("s", SYS_TODAS); $si_es_por_fecha = ""; $graficos = parametro("graficos", false, MQL_BOOL); $BySuc = $sucursal == SYS_TODAS ? "" : " AND `creditos_solicitud`.`sucursal`= '{$sucursal}'"; $si_es_por_fecha = " AND fecha_ministracion>='{$FechaInicial}' AND fecha_ministracion<='{$FechaFinal}' "; $xF->set($FechaFinal); $ejercicio = $xF->anno(); my_query("SET @ejercicio:={$ejercicio};"); $sql = "\nSELECT\n\t`creditos_tipoconvenio`.`descripcion_tipoconvenio` AS `convenio`,\n\tCOUNT(`creditos_saldo_mensuales`.`numero_solicitud`) AS `creditos`,\n\tSUM(`creditos_saldo_mensuales`.`enero`) AS `enero`,\n\tSUM(`creditos_saldo_mensuales`.`febrero`) AS `febrero`,\n\tSUM(`creditos_saldo_mensuales`.`marzo`) AS `marzo`,\n\tSUM(`creditos_saldo_mensuales`.`abril`) AS `abril`,\n\tSUM(`creditos_saldo_mensuales`.`mayo`) AS `mayo`,\n\tSUM(`creditos_saldo_mensuales`.`junio`) AS `junio`,\n\tSUM(`creditos_saldo_mensuales`.`julio`) AS `julio`,\n\tSUM(`creditos_saldo_mensuales`.`agosto`) AS `agosto`,\n\tSUM(`creditos_saldo_mensuales`.`septiembre`) AS `septiembre`,\n\tSUM(`creditos_saldo_mensuales`.`octubre`) AS `octubre`,\n\tSUM(`creditos_saldo_mensuales`.`noviembre`) AS `noviembre`,\n\tSUM(`creditos_saldo_mensuales`.`diciembre`) AS `diciembre` \n\t\t\nFROM\n\t`creditos_saldo_mensuales` `creditos_saldo_mensuales` \n\t\tINNER JOIN `creditos_tipoconvenio` `creditos_tipoconvenio` \n\t\tON `creditos_saldo_mensuales`.`tipo_convenio` = `creditos_tipoconvenio`.\n\t\t`idcreditos_tipoconvenio`\n\tGROUP BY\n\t\t\n\t\t`creditos_saldo_mensuales`.`tipo_convenio`\n\t\t "; $xT = new cTabla($sql); $xT->setFootSum(array(1 => "creditos", 2 => "enero", 3 => "febrero", 4 => "marzo", 5 => "abril", 6 => "mayo", 7 => "junio", 8 => "julio", 9 => "agosto", 10 => "septiembre", 11 => "octubre", 12 => "noviembre", 13 => "diciembre")); $xRPT->setOut($out); $xRPT->addContent($xRPT->getEncabezado($xHP->getTitle(), $FechaInicial, $FechaFinal)); $xRPT->setSQL($sql); $xT->setTipoSalida($out); $xRPT->addContent($xT->Show()); //$xRPT->addContent("<script>setTimeout('mychart',1500); function mychart() { $('#sqltable').visualize({type: 'bar', width: '450px'}).appendTo('body'); }</script>"); echo $xRPT->render(true);
function setRegenerarSDPM($PFechaInicial, $PFechaFinal, $GenerarInteres = true, $incluirSinSaldo = false, $NumeroCuenta = false) { // $PFechaFinal = ""; $mBase = 3100; $xT = new cTipos(); $ql = new MQL(); $BySaldo = $incluirSinSaldo == false ? " AND captacion_cuentas.saldo_cuenta >=" . TOLERANCIA_SALDOS : ""; $ByCuentaSDPM = $NumeroCuenta == false ? "" : " AND `captacion_sdpm_historico`.`cuenta` = {$NumeroCuenta} "; $ByCuentaMvto = $NumeroCuenta == false ? "" : " AND `operaciones_mvtos`.`docto_afectado` = {$NumeroCuenta} "; $ByCuentaCta = $NumeroCuenta == false ? "" : " AND captacion_cuentas.numero_cuenta = {$NumeroCuenta} "; $msg = ""; $msg .= "==========================================================================================\r\n"; $msg .= "==================\tGenerando SDPM desde el {$PFechaInicial} al {$PFechaFinal}\r\n"; $msg .= "==========================================================================================\r\n"; $msg .= "Socio\tCuenta\tOPER\tEjercicio\tPeriodo\tFecha\tDias\tMonto\tSaldo\tSDPM\r\n"; $sqlM = "SELECT \n\t\t\t\t\t\t\t\t\t`operaciones_mvtos`.`fecha_operacion` AS 'fecha_operacion',\n\t\t\t\t\t\t\t\t\t`operaciones_mvtos`.`recibo_afectado` AS 'recibo_afectado',\n\t\t\t\t\t\t\t\t\t`operaciones_mvtos`.`docto_afectado` AS 'docto_afectado',\n\t\t\t\t\t\t\t\t\t`operaciones_mvtos`.`afectacion_real` AS 'afectacion_real',\n\t\t\t\t\t\t\t\t\t`operaciones_mvtos`.`valor_afectacion`,\n\t\t\t\t\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`afectacion` AS 'afectacion'\n\t\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t\t`operaciones_mvtos` `operaciones_mvtos` \n\t\t\t\t\t\t\t\t\t\tINNER JOIN `eacp_config_bases_de_integracion_miembros` \n\t\t\t\t\t\t\t\t\t\t\t`eacp_config_bases_de_integracion_miembros` \n\t\t\t\t\t\t\t\t\t\tON `operaciones_mvtos`.`tipo_operacion` = \n\t\t\t\t\t\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`miembro` \n\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t(`eacp_config_bases_de_integracion_miembros`.`codigo_de_base` ={$mBase})\n\t\t\t\t\t\t\t\t\t{$ByCuentaMvto}\n\t\t\t\t\t\t\t\tORDER BY\n\t\t\t\t\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`codigo_de_base`,\n\t\t\t\t\t\t\t\t\t`operaciones_mvtos`.`fecha_operacion` ASC"; $rsM = getRecordset($sqlM); $arrOps = array(); //Array de montos de operacion $arrRecs = array(); //Array de Recibos de Operacion while ($rwM = mysql_fetch_array($rsM)) { //clave cuenta fecha $cuenta = $rwM["docto_afectado"]; $fecha = $rwM["fecha_operacion"]; if (isset($arrOps[$cuenta . "-" . $fecha])) { $arrOps[$cuenta . "-" . $fecha] += $rwM["afectacion_real"] * $rwM["afectacion"]; } else { $arrOps[$cuenta . "-" . $fecha] = $rwM["afectacion_real"] * $rwM["afectacion"]; } $arrRecs[$cuenta . "-" . $fecha] = $rwM["recibo_afectado"]; //$msg .= "WARN\t$cuenta\tAgregar " . ($rwM["afectacion_real"] * $rwM["afectacion"] ) . "\r\n"; } //Eliminar periodos anteriores $sqlDF = "DELETE FROM captacion_sdpm_historico WHERE (fecha>='{$PFechaInicial}' AND fecha<='{$PFechaFinal}') {$ByCuentaSDPM} "; my_query($sqlDF); //FECHAS $xF = new cFecha(0); // $xTbl = new cSAFETabla(TCAPTACION_CUENTAS); $sqlCX = $xTbl->getQueryInicial() . " WHERE captacion_cuentas.tipo_cuenta = " . CAPTACION_TIPO_VISTA . " {$BySaldo} {$ByCuentaCta} "; $rs1 = getRecordset($sqlCX); while ($rw1 = mysql_fetch_array($rs1)) { $socio = $rw1["numero_socio"]; $cuenta = $rw1["numero_cuenta"]; $xCta = new cCuentaALaVista($cuenta, $socio); $xCta->init($rw1); $DCta = $xCta->getDatosInArray(); $FApertura = $DCta["fecha_apertura"]; $dias = $xF->setRestarFechas($PFechaFinal, $FApertura); $dias += 1; $sucursal = $DCta["sucursal"]; $FechaAnterior = $FApertura; $saldoAnterior = 0; $xF2 = new cFecha(1); for ($i = 0; $i <= $dias; $i++) { $OpFecha = $xF->setSumarDias($i, $FApertura); $xF->set($OpFecha); $OpFechaFin = $xF->getDiaFinal(); $OpMonto = isset($arrOps[$cuenta . "-" . $OpFecha]) ? $arrOps[$cuenta . "-" . $OpFecha] : 0; $idrecibo = isset($arrRecs[$cuenta . "-" . $OpFecha]) ? $arrRecs[$cuenta . "-" . $OpFecha] : DEFAULT_RECIBO; //si la operacion es mayor a cero o es FIN DE MES if ($OpMonto != 0 or $OpFecha == $OpFechaFin) { $diasTrans = $xF2->setRestarFechas($OpFecha, $FechaAnterior); $xF2->set($OpFecha); $ejercicio = $xF2->anno(); $periodo = $xF2->mes(); $sdpd = $saldoAnterior * $diasTrans; $nuevatasa = $xCta->getTasaAplicable(0, 0, $saldoAnterior); //corregir fecha $sqlUSPM = "INSERT INTO captacion_sdpm_historico\n\t\t\t\t\t\t\t\t\t\t(ejercicio, periodo, cuenta, fecha, dias, tasa, monto, recibo, numero_de_socio, sucursal)\n\t \t\t\t\t\t\t\t\tVALUES( {$ejercicio}, {$periodo}, {$cuenta}, '{$OpFecha}', {$diasTrans}, {$nuevatasa}, {$sdpd}, {$idrecibo}, {$socio}, '{$sucursal}') "; //si es valida la operacion, se actualizan if ($OpFecha >= $PFechaInicial and $OpFecha <= $PFechaFinal) { my_query($sqlUSPM); $msg .= "{$socio}\t{$cuenta}\t+SDPM\t{$ejercicio}\t{$periodo}\t{$OpFecha}\t{$diasTrans}\t{$OpMonto}\t{$saldoAnterior}\t{$sdpd}\r\n"; } else { $msg .= "{$socio}\t{$cuenta}\t=SDPM\t{$ejercicio}\t{$periodo}\t{$OpFecha}\t{$diasTrans}\t{$OpMonto}\t{$saldoAnterior}\t{$sdpd}\r\n"; } $FechaAnterior = $OpFecha; $saldoAnterior += $OpMonto; } } } //Agregar Movimientos Finales del MES. //FIXME: Corregir incidencias //opcional: agregar Interes if ($GenerarInteres == true) { $xRec = new cReciboDeOperacion(12, false); $recibo = $xRec->setNuevoRecibo(DEFAULT_SOCIO, 1, $PFechaFinal, 1, 12, "REGENERAR_INTERES_SDPM_{$PFechaFinal}", "NA", "ninguno", "NA", DEFAULT_GRUPO); $msg .= "==========================================================================================\r\n"; $msg .= "==================\tAGREGADO INTERES :: RECIBO {$recibo}\r\n"; $msg .= "==========================================================================================\r\n"; $_SESSION["recibo_en_proceso"] = $recibo; //sumar sdpm del mes por cuenta $sqlSDPM = "SELECT\n\t\t\t\t\t\t\t\t`captacion_sdpm_historico`.`numero_de_socio`,\n\t\t\t\t\t\t\t\t`captacion_sdpm_historico`.`cuenta`,\n\t\t\t\t\t\t\t\tSUM(`captacion_sdpm_historico`.`dias`) AS `dias_transcurridos`,\n\t\t\t\t\t\t\t\tSUM(`captacion_sdpm_historico`.`monto`) AS `sdpm`,\n\t\t\t\t\t\t\t\tROUND( (`captacion_sdpm_historico`.`monto` / `captacion_sdpm_historico`.`dias`), 2) AS `ultimo_saldo`,\n\t\t\t\t\t\t\t\tMAX(`captacion_sdpm_historico`.`fecha`) AS 'UltimaFecha'\n\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t`captacion_sdpm_historico` `captacion_sdpm_historico` \n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t(`captacion_sdpm_historico`.`fecha` >= '{$PFechaInicial}')\n\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\t(`captacion_sdpm_historico`.`fecha` <= '{$PFechaFinal}')\n\t\t\t\t\t\t\t\t{$ByCuentaSDPM}\n\t\t\t\t\t\t\tGROUP BY\n\t\t\t\t\t\t\t\t`captacion_sdpm_historico`.`cuenta`,\n\t\t\t\t\t\t\t\t`captacion_sdpm_historico`.`ejercicio`,\n\t\t\t\t\t\t\t\t`captacion_sdpm_historico`.`periodo`\n\t\t\t\t\t\t\tORDER BY\n\t\t\t\t\t\t\t\t`captacion_sdpm_historico`.`fecha` DESC "; $rsCAP = $ql->getDataRecord($sqlSDPM); //setLog($sqlSDPM); foreach ($rsCAP as $rwC) { $socio = $rwC["numero_de_socio"]; $cuenta = $rwC["cuenta"]; $dias_de_calc = $rwC["dias_transcurridos"]; $sumaSDPM = $rwC["sdpm"]; $FechaI = $rwC["UltimaFecha"]; $promedio = $xT->cFloat($sumaSDPM / $dias_de_calc, 2); //XXX: Solucionar Tasa de Interes y hacer las rapida la consulta $xCta = new cCuentaDeCaptacion($cuenta); $xCta->init(); $subtipo = $xCta->getTipoDeSubproducto(); $tasa_nueva = obtentasa($promedio, CAPTACION_TIPO_VISTA, 0, $subtipo); $interes = $sumaSDPM * $tasa_nueva / EACP_DIAS_INTERES; $interes = $xT->cFloat($interes, 2); //agregar movimiento if ($interes > 0) { setNuevoMvto($socio, $cuenta, $recibo, $FechaI, $interes, 222, 1, "CALCULO_AUTOMATICO_DESDE_{$PFechaInicial}"); $msg .= "{$socio}\t{$cuenta}\tAGREGAR\tInteres por {$interes}, tasa {$tasa_nueva}, Promedio {$promedio}, SDPM {$sumaSDPM}, Dias {$dias_de_calc}\r\n"; } else { $msg .= "{$socio}\t{$cuenta}\tIGNORAR\tInteres por {$interes}, tasa {$tasa_nueva}, Promedio {$promedio}, SDPM {$sumaSDPM}, Dias {$dias_de_calc}\r\n"; } } } return $msg; }
} $monto = getFMoney($rw["monto"]); $tdEsp = ""; if ($BCapital->getIsMember($rw["tipo_operacion"]) == true) { $tdEsp = "<td class='mny'>{$monto}</td><td /><td /><td />"; } elseif ($BInteres->getIsMember($rw["tipo_operacion"]) == true) { $tdEsp = "<td /><td class='mny'>{$monto}</td><td /><td />"; $ints += $rw["monto"]; } elseif ($BIva->getIsMember($rw["tipo_operacion"]) == true) { $tdEsp = "<td /><td /><td class='mny'>{$monto}</td><td />"; $iva += $rw["monto"]; } else { $tdEsp = "<td /><td /><td /><td class='mny'>{$monto}</td>"; $otros += $rw["monto"]; } $xF->set($rw["fecha_operacion"]); $cssFecha = $xF->mes() != $mes ? " class='otromes' " : " class='date' "; $mtd = "<tr>\n\t\t\t\t\t<td {$cssFecha}>" . $xF->getFechaDDMM() . "</td>\n\t\t\t\t\t<td onclick=\"msgbox('Total Recibo " . $rw["total_recibo"] . "')\">" . $rw[2] . "</td>\n\t\t\t\t\t<td>" . $rw[3] . "</td>\n\t\t\t\t\t<td class='ajustar'>" . $rw[4] . "</td>\n\t\t\t\t\t{$tdEsp}\n\t\t\t\t\t<td class='mny'>{$sdos}</td>\n\t\t\t\t\t<td class='ajustar'>{$observa}</td>\n\t\t\t\t</tr>"; //parche de credito if (strtotime($rw["fecha_operacion"]) < strtotime($fecha_inicial) or strtotime($rw["fecha_operacion"]) > strtotime($fecha_final)) { $mtd = ""; } $mes = $xF->mes(); $trs .= $mtd; $i++; //Imprime en pantalla el Aviso de NO COINCIDENCIA } //$sdo1 = if (round($sdo, 2) != round($sdoTemp, 2)) { if (FORCE_CUADRE_EN_OPERACIONES == true) { if ($cFC->getEstadoActual() == CREDITO_ESTADO_AUTORIZADO or $cFC->getEstadoActual() == CREDITO_ESTADO_SOLICITADO) {
function jsa_getDatosDeCredito($solicitud) { $xCred = new cCredito($solicitud); $xCred->initCredito(); $xF = new cFecha(); $xT = new cTipos(); $dCreds = $xCred->getDatosDeCredito(); $periocidad = $xCred->getPeriocidadDePago(); $FMinistracion = $xCred->getFechaDeMinistracion(); $contrato_corriente = $xCred->getContratoCorriente(); $xPlanGen = new cPlanDePagosGenerador(); $xPlanGen->initPorCredito($solicitud); $FPrimerAb = $xPlanGen->getFechaDePrimerPago(); $xF = new cFecha(0, $FMinistracion); $FM_d = $xF->dia(); $FM_a = $xF->anno(); $FM_m = $xF->mes(); $xF2 = new cFecha(1, $FPrimerAb); $xF2->set($FPrimerAb); $PA_d = $xF2->dia(); $PA_a = $xF2->anno(); $PA_m = $xF2->mes(); $tab = new TinyAjaxBehavior(); //setLog("$PA_d --- $PA_m ---- $PA_a - - - - - $FPrimerAb"); $tab->add(TabSetvalue::getBehavior('ideldia1', $FM_d)); $tab->add(TabSetvalue::getBehavior('idelmes1', $FM_m)); $tab->add(TabSetvalue::getBehavior('idelanno1', $FM_a)); $tab->add(TabSetvalue::getBehavior('ideldia0', $PA_d)); $tab->add(TabSetvalue::getBehavior('idelmes0', $PA_m)); $tab->add(TabSetvalue::getBehavior('idelanno0', $PA_a)); $tab->add(TabSetvalue::getBehavior('idDescripcionSolicitud', $xCred->getShortDescription())); $tab->add(TabSetvalue::getBehavior('idcuenta', $contrato_corriente)); //$xCred->getPeriocidadDePago() != CREDITO_TIPO_PERIOCIDAD_CATORCENAL if ($xCred->getTipoEnSistema() == CREDITO_PRODUCTO_NOMINA) { $tab->add(TabSetvalue::getBehavior('idFormaDePago', $xCred->getTipoDePago())); //setLog("El pago es " . $xCred->getPeriocidadDePago() ); if ($xCred->getPeriocidadDePago() != CREDITO_TIPO_PERIOCIDAD_CATORCENAL) { $tab->add(TabSetvalue::getBehavior('idtipo_plan_pagos', CREDITO_TIPO_DIAS_DE_PAGO_PERSONALIZADOS)); } } return $tab->getString(); }
function __construct($fecha = false) { $xF = new cFecha(); $xF->set($xF->getFechaISO($fecha)); $mes = $xF->mes(); $annio = $xF->anno(); if ($mes <= 3) { $this->mID = 1; $this->mFechaInicial = "{$annio}-01-01"; $this->mFechaFinal = "{$annio}-03-31"; } elseif ($mes >= 4 and $mes <= 6) { $this->mID = 2; $this->mFechaInicial = "{$annio}-04-01"; $this->mFechaFinal = "{$annio}-06-30"; } elseif ($mes >= 7 and $mes <= 9) { $this->mID = 3; $this->mFechaInicial = "{$annio}-07-01"; $this->mFechaFinal = "{$annio}-09-30"; } else { $this->mID = 4; $this->mFechaInicial = "{$annio}-10-01"; $this->mFechaFinal = "{$annio}-12-31"; } }
function get($label = "", $Fecha = false, $indice = false) { $xTr = new cLang(); $label = $xTr->getT($label); $maxSize = $this->mLabelSize == 0 ? HP_LABEL_SIZE : $this->mLabelSize; if ($indice !== false) { $this->mIndex = $indice; } if (strlen($label) < $maxSize) { $rll = $maxSize - strlen(html_entity_decode($label)); } $extraDate = ""; $label = $label == "" ? "" : "<label for='idfecha-" . $this->mIndex . "'>{$label}</label>"; $this->set($Fecha); $xF = new cFecha($this->mIndex, $this->mFecha); $events = $this->mEvents; $xF->init(FECHA_FORMATO_MX); $id = $this->mId == "" ? "idfecha-" . $this->mIndex . "" : $this->mId; if ($this->mTipoFecha == FECHA_TIPO_NACIMIENTO) { $anno = $xF->anno() - 18; $xF->set("{$anno}-" . $xF->mes() . "-" . $xF->dia()); $this->set($xF->get()); $extraDate = ",selectYears: true "; } $txt = "<input type=\"text\" id=\"{$id}\" value=\"" . $xF->get() . "\" name=\"{$id}\" {$events}><script>\$(\"#{$id}\").pickadate({format: 'dd-mm-yyyy',formatSubmit:'yyyy-mm-dd', editable : true {$extraDate}});</script> "; $initDiv = $this->mClassDiv == "" ? "" : "<div class=\"" . $this->mClassDiv . "\">"; $endDiv = $this->mClassDiv == "" ? "" : "</div>"; return $this->mSelects == false ? $initDiv . $label . $txt . $endDiv : $initDiv . $label . $xF->show(true, $this->mTipoFecha) . $endDiv; }
$periocidad = parametro("periocidad", $periocidad); $periocidad = parametro("frecuencia", $periocidad); $estado = parametro("estado", SYS_TODAS); $estado = parametro("estatus", $estado); $producto = parametro("convenio", SYS_TODAS); $producto = parametro("producto", $producto); $fechaInicial = parametro("on", EACP_FECHA_DE_CONSTITUCION); $fechaFinal = parametro("off", fechasys()); $fechaInicial = $xF->getFechaISO($fechaInicial); $fechaFinal = $xF->getFechaISO($fechaFinal); $formato = parametro("out", SYS_DEFAULT, MQL_RAW); $sucursal = parametro("sucursal", SYS_TODAS, MQL_RAW); $xRPT = new cReportes($xHP->getTitle()); $ByProducto = $xLi->OFiltro()->CreditosPorProducto($producto); $BySucursal = $xLi->OFiltro()->CreditosPorSucursal($sucursal); $xF->set($fechaFinal); $ejercicio = $xF->anno(); my_query("SET @ejercicio:={$ejercicio};"); $sql = "\nSELECT\n\t`socios`.`iddependencia`,\n\t`socios`.`dependencia`,\n\tCOUNT(`creditos_saldos_por_ejercicio`.`numero_solicitud`) AS `creditos`,\n\tSUM(`creditos_saldos_por_ejercicio`.`diciembre`) AS `saldo` \nFROM\n\t`socios` `socios` \n\t\tINNER JOIN `creditos_saldos_por_ejercicio` \n\t\t`creditos_saldos_por_ejercicio` \n\t\tON `socios`.`codigo` = `creditos_saldos_por_ejercicio`.`numero_socio` \n\tGROUP BY\n\t\t`socios`.`iddependencia`\n"; //$sql = "CALL sp_saldos_al_cierre('$fechaFinal')"; //exit($sql); $xTbl = new cTabla($sql); $xTbl->setFootSum(array(2 => "creditos", 3 => "saldo")); /*$xTbl->setFootSum(array( 3 => "monto_autorizado", 52 => "abonos", 53 => "saldo" ));*/ $xRPT->setSQL($xTbl->getSQL()); $xTbl->setTipoSalida($formato); $xRPT->setOut($formato);