Example #1
0
if (!empty($_POST['cmd']) && $_POST['cmd'] == 'editar') {
    $pagamento->setId($_POST['id']);
    $pagamento->setTaxa($_POST['taxa']);
    $pagamento->setCmat_real($_POST['cmat_real']);
    $pagamento->setVetec_real($_POST['Vetec_real']);
    $pagamento->setCmat_iene($_POST['cmat_iene']);
    $pagamento->setVetec_iene($_POST['Vetec_iene']);
    $pagamento->setCmat_fiscal($_POST['cmat_fiscal']);
    $pagamento->setVetec_fiscal($_POST['Vetec_fiscal']);
    $pagamento->setCmat_pgmt($_POST['cmat_pgmt']);
    $pagamento->setVetec_pgmt($_POST['Vetec_pgmt']);
    $pagamento->setChodai_iene($_POST['chodai_iene']);
    $pagamento->setYec_iene($_POST['yec_iene']);
    $pagamento->setChodai_invoice($_POST['chodai_invoice']);
    $pagamento->setYec_invoice($_POST['yec_invoice']);
    $Cmat_real = $pagamento->getCmat_real();
    // Verifica se o nome foi preenchido
    if (!empty($Cmat_real)) {
        $retorno = $DAO->Atualizar($pagamento);
        if ($retorno == 1) {
            echo '<script language= "JavaScript">alert("Registro cadastrado com sucesso");</script>';
            echo '<script language= "JavaScript">location.href="index.php";</script>';
        } else {
            print_r($retorno);
        }
    } else {
        echo '<script language= "JavaScript">alert("Preencha o todos os campos");</script>';
    }
} else {
    $resultado = $DAO->Listar("SELECT * FROM " . MYSQL_BASE_FINANCEIRO_PAGAMENTO . "\r\n\t\t\t\t\t\t\t\tWHERE id =" . $pagamento->getId() . " AND status = 'S'");
    if ($resultado) {