/** * @return integer Numero de Operacion **/ function setNuevoMvto($fecha_operacion, $monto, $tipo_operacion, $periodo_de_socio, $observaciones, $signo_afectacion = 1, $mvto_contable = false, $socio = false, $documento = false, $fecha_afectacion = false, $fecha_vencimiento = false, $saldo_anterior = false, $saldo_nuevo = false) { $sucess = false; //inicializa el recibo if (!isset($this->mCodigoDeRecibo) or $this->mCodigoDeRecibo == false) { // } //Si no hay valores, obtenerlos del recibo if ($documento == false or !isset($documento)) { $documento = $this->mDocto; } if ($socio == false or !isset($socio)) { $socio = $this->mSocio; } //Verificar la Cuenta Bancaria if ($this->mCuentaBancaria == false) { $this->mCuentaBancaria = DEFAULT_CUENTA_BANCARIA; } $recibo = $this->mCodigoDeRecibo; $fecha_afectacion = $fecha_afectacion == false ? $fecha_operacion : $fecha_afectacion; // --------------------------------------- VALOR SQL DEL MVTO.------------------------------------------------------- // VALORES FIJOS $smf = "idusuario, codigo_eacp, socio_afectado, docto_afectado, recibo_afectado, fecha_operacion, "; // PERIODOS $smf .= "periodo_contable, periodo_cobranza, periodo_seguimiento, "; $smf .= "periodo_anual, periodo_mensual, periodo_semanal, "; // AFECTACIONES $smf .= "afectacion_cobranza, afectacion_contable, afectacion_estadistica, "; $smf .= "afectacion_real, valor_afectacion, "; // FECHAS Y TIPOS $smf .= "idoperaciones_mvtos, tipo_operacion, estatus_mvto, periodo_socio, "; $smf .= "fecha_afectacion, fecha_vcto, "; // SALDOS $smf .= "saldo_anterior, saldo_actual, detalles, sucursal, tasa_asociada, dias_asociados, grupo_asociado"; // $iduser = $_SESSION["SN_b80bb7740288fda1f201890375a60c8f"]; $eacp = EACP_CLAVE; // PERIODOS $percont = EACP_PER_CONTABLE; // Periodo Contable $percbza = EACP_PER_COBRANZA; // Periodo Cobranza. $perseg = EACP_PER_SEGUIMIENTO; // Period de Seguimiento. $permens = date("m", strtotime($fecha_operacion)); // Periodo mes $persem = date("N", strtotime($fecha_operacion)); // Periodo de dias en la semana. $peranual = date("Y", strtotime($fecha_operacion)); // A�o Natural. $persoc = $periodo_de_socio; // periodo del Socio. $estatus_mvto = $this->mDefMvtoStatus; $fecha_vcto = $fecha_vencimiento == false ? $this->mFechaDeVcto : $fecha_vencimiento; $saldo_anterior = $saldo_anterior === false ? 0 : $saldo_anterior; $saldo_nuevo = $saldo_nuevo === false ? $monto : $saldo_nuevo; $sucursal = getSucursal(); $afect_cbza = $monto; $afect_seg = $monto; $afect_cont = $monto; $afect_esta = $monto; $idoperacion = folios(2); $tasa = 0; $dias = 0; $grupo = $this->mGrupoAsociado; $viable = true; $xT = new cTipos(0); if ($this->mGrupoAsociado == false) { $grupo = DEFAULT_GRUPO; } $smv = "{$iduser}, '{$eacp}', {$socio}, {$documento}, {$recibo}, '{$fecha_operacion}',\n\t\t\t\t{$percont}, {$percbza}, {$perseg}, {$peranual}, {$permens}, {$persem},\n\t\t\t\t{$afect_cbza}, {$afect_cont}, {$afect_esta},\n\t\t\t\t{$monto}, {$signo_afectacion},\n\t\t\t\t{$idoperacion}, {$tipo_operacion}, {$estatus_mvto}, {$persoc},\n\t\t\t\t'{$fecha_afectacion}', '{$fecha_vcto}',\n\t\t\t\t{$saldo_anterior}, {$saldo_nuevo}, '{$observaciones}', '{$sucursal}', {$tasa}, {$dias}, {$grupo}\n\t\t\t\t"; $arrD = array($socio, $documento, $recibo); $viable = $xT->getEvalNotNull($arrD); if ($viable == false) { $this->mMessages .= "ERROR\tVARS\tError al Evaluar alguno de estos Valores Socio {$socio}, Documento {$documento}, Recibo {$recibo}\r\n"; $this->mMessages .= $xT->getMessages(); } $SQl_comp = "INSERT INTO operaciones_mvtos({$smf}) VALUES ({$smv})\n\t\t\t\t\t\tON DUPLICATE KEY UPDATE idoperaciones_mvtos = " . folios(2) . "\n\t\t\t\t\t"; if ($monto != 0 and isset($monto) and $this->mAfectar == true and $viable == true) { $exec = my_query($SQl_comp); if ($exec["stat"] == false) { $sucess = false; $this->mMessages .= "ERROR\t{$recibo}\tSe Fallo al Agregar la Operacion({$tipo_operacion}) por {$monto} con Numero {$idoperacion}\r\n"; } else { $sucess = true; $this->mMessages .= "SUCESS\t{$recibo}\tSe agrego Exitosamente la Operacion({$tipo_operacion}) por {$monto} con Numero {$idoperacion} \r\n"; } } else { $this->TxtLog .= "WARNING\tSe simula Agregar el Mvto {$idoperacion} del tipo {$tipo_operacion} por un monto de {$monto} \r\n"; } //Sumar al Recibo el Monto $this->mSumaDeRecibo += $monto; $this->mNumeroDeMvtos++; // return $idoperacion; }