コード例 #1
0
ファイル: new.php プロジェクト: hexti/troncal
include_once '../Taxa.class.php';
checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true');
include_once '../../head.php';
if (!in_array(7, listarAcesso())) {
    echo '<script language= "JavaScript">location.href="index.php";</script>';
}
$taxa = new Taxa();
$DAO = new TaxaDAO();
// Verifica se a acao de salvar foi iniciada
if (!empty($_POST['cmd']) && $_POST['cmd'] == 'inserir') {
    $taxa->setTaxaPTAX($_POST['ptax']);
    $taxa->setTaxaCasadaIene($_POST['ienes']);
    $taxa->setTaxaUSD1($_POST['usd1']);
    $taxa->setTaxaUSD2($_POST['usd2']);
    $taxa->setData($_POST['data']);
    $resultado = $DAO->Gravar($taxa);
    if ($resultado == 1) {
        echo '<script language= "JavaScript">alert("Registro cadastrado com sucesso");</script>';
        echo '<script language= "JavaScript">location.href="new.php";</script>';
    } else {
        echo '<script language= "JavaScript">alert("Erro ao salvar o registro.");</script>';
        print_r($resultado);
    }
} else {
    $taxa->setTaxaPTAX("0.00000");
    $taxa->setTaxaCasadaIene("0.00000");
    $taxa->setTaxaUSD1("0.00000");
    $taxa->setTaxaUSD2("0.00000");
}
?>
<!-- topbar ends -->