Esempio n. 1
0
<?php

$toRoot = "../";
include_once $toRoot . "beans/LancamentoServico.class.php";
include_once $toRoot . "dao/DAOLancamentoServico.class.php";
include_once $toRoot . "utils/ConectarMySQL.class.php";
include_once $toRoot . "utils/funcoes.php";
foreach ($_GET as $nomeCampo => $valor) {
    $comando = "\$" . $nomeCampo . "= antiSQL(isset(\$_GET['{$nomeCampo}']) ? '" . $valor . "' : NULL);";
    eval($comando);
}
$conexao = new ConectarMySql($toRoot);
$bean = new LancamentoServico();
$dao = new DAOLancamentoServico($bean, $conexao);
$bean = $dao->zerar($valRef);
$conexao->fechar();
?>
<html>
	<head>
		<script type="text/javascript" language="javascript">
			window.onload = function(){
				setTimeout('window.close()',3000);
			}
		</script>
	</head>
	<body>
		<p>Lan&ccedil;amentos zerados com sucesso!</p>
	</body>
</html>
    }
    $lancamento->pcCodigo = $slPlaCon;
    $lancamento->ordemServico = $tfOrdSer;
    $lancamento->valor = converterValor($tfValTot);
    $lancamento->desconto = converterValor($tfValDesc);
    $dao->setLancamento($lancamento);
    $dao->cadastrar();
    if ($lancamento->tipCodigo == 101 || $lancamento->tipCodigo == 103) {
        include_once $toRoot . "beans/LancamentoProduto.class.php";
        include_once $toRoot . "dao/DAOLancamentoProduto.class.php";
        $lancamentoProduto = new LancamentoProduto($tfCod, $slPro, $tfQua, converterValor($tfValPro));
        $daoP = new DAOLancamentoProduto($lancamentoProduto, $conexao);
        $daoP->cadastrar();
    }
    if ($lancamento->tipCodigo == 102 || $lancamento->tipCodigo == 103) {
        include_once $toRoot . "beans/LancamentoServico.class.php";
        include_once $toRoot . "dao/DAOLancamentoServico.class.php";
        $lancamentoServico = new LancamentoServico($tfCod, $slSer, $slTec, converterValor($tfValSer));
        $daoS = new DAOLancamentoServico($lancamentoServico, $conexao);
        $daoS->cadastrar();
    }
    $log = new Log(3, 11, $tfCod . " cadastrado!");
    $daoLog = new DAOLog($log, $conexao);
    $daoLog->cadastrar();
    $chave = $dao->getChave();
    $conexao->fechar();
    $cadastrar = true;
} else {
    $chave = $dao->getChave();
    $conexao->fechar();
}