Beispiel #1
0
include_once "../../utils/ConectarMySQL.class.php";
$slAveRef = antiSQL(isset($_POST["slAveRef"]) ? $_POST["slAveRef"] : NULL);
if ($slAveRef != NULL) {
    $conexao = new ConectarMySQL();
    include_once "../../dao/DAOAverbacao.class.php";
    include_once "../../dao/DAOParcela.class.php";
    include_once "../../dao/DAOServidor.class.php";
    include_once "../../dao/DAOLog.class.php";
    include_once "../../beans/Parcela.class.php";
    include_once "../../beans/Servidor.class.php";
    $sql = "SELECT pes_codigo, ave_numero_parcelas FROM averbacoes WHERE ave_numero_externo = '" . $slAveRef . "'";
    $resultado = $conexao->selecionar($sql);
    $linha = mysqli_fetch_array($resultado);
    $dao = new DAOParcela(NULL, NULL, NULL, NULL, NULL, "../../", $conexao);
    $parcela = new Parcela(NULL, NULL, NULL, NULL, NULL);
    $parcela = $dao->getParcela("%", $slAveRef);
    $dao = new DAOServidor(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "../../", $conexao);
    $servidor = new Servidor(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
    $servidor = $dao->getServidor($linha["pes_codigo"], "%");
    $servidor->setUtilizada($servidor->getUtilizada() - $parcela->getValor());
    $servidor->setDisponivel($servidor->getDisponivel() + $parcela->getValor());
    $dao->setServidor($servidor);
    if (!$dao->alterar($servidor->getPesCodigo() . ":" . $servidor->getMatricula())) {
        $comitar = false;
    }
    $comitar = true;
    $dao = new DAOAverbacao(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "../../", $conexao);
    $log = new DAOLog($_SESSION["pessoa"], 7, $_SESSION["nivel"], $_SESSION["codigo"], 12, "id=\\'" . $slEmpRef . "\\'", "../../", $conexao);
    if (!$dao->deletar($slAveRef) || !$log->cadastrar()) {
        $comitar = false;
    }
Beispiel #2
0
 include_once "../../dao/DAOLog.class.php";
 include_once "../../dao/DAOServidor.class.php";
 include_once "../../dao/DAOParcela.class.php";
 include_once "../../beans/Servidor.class.php";
 include_once "../../beans/Parcela.class.php";
 $servidor = new Servidor(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 $parcela = new Parcela(NULL, NULL, NULL, NULL, NULL);
 for ($x = 0; $x < $nLinhas; $x++) {
     $linha = $matriz[$x];
     $linha[2] = rtrim($linha[2]);
     $linha[4] = rtrim($linha[4]);
     if ($linha[8] != 4) {
         continue;
     }
     $dao = new DAOParcela(NULL, NULL, NULL, NULL, NULL, "../../", $mysql);
     $parcela = $dao->getParcela($linha[5], $linha[4]);
     if ($parcela->getStaCodigo() != 2) {
         continue;
     }
     $sql = "UPDATE parcelas SET sta_codigo = " . $linha[8] . " WHERE par_numero_parcela=" . $linha[5] . " AND ave_numero_externo='" . $linha[4] . "'";
     if (!$mysql->executar($sql)) {
         $comitar = false;
         echo "Erro ao alterar status parcela ne= " . $linha[4];
     } else {
         $comitar = true;
     }
     /*$log = new DAOLog($_SESSION["pessoa"], 4, $_SESSION["nivel"], $_SESSION["codigo"], 13, "Log numExt= ".$linha[4], "../../", $mysql);
     		if(!$log->cadastrar())
     			$comitar = false;*/
     $dao = new DAOServidor(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "../../", $mysql);
     $servidor = $dao->getServidor($linha[2], "%");