function confere($num, $id) { $parcelas = new Parcelas(); $p = $parcelas->get_parcelas_pagas($id); for ($i = 0; $i < count($p); $i++) { if ($p[$i] == $num) { return $num; } } }
public function add_parcelas_bd() { $sql = new Sql(); $sql->conn_bd(); $g = new Glob(); Parcelas::confere_ultimaparcela($this->id_conta); $query = "INSERT INTO parcelas (id_conta, data, parcela_n, comprovante) \n\t\t VALUES ( '%s', '%s', '%s', '%s')"; if ($g->tratar_query($query, $this->id_conta, $this->data, $this->parcela_n, $this->comprovante)) { return true; } else { return false; } }
?> <body> <?php include_once "../view/topo.php"; ?> <div id="result"></div> <div class='formulario' style="width:50%;"> <div class="title-box" style="float:left"><div style="float:left"><img src="../images/user_add.png" width="60px" style="margin-left:-20px; margin-top:-20px;"></div><div style="float:left; margin-top:10px; margin-left:10px;"><span class="title">CADASTRO DE CONTAS</span></div></div> <?php $contas = new Contas(); $clsparcelas = new Parcelas(); $parcelas = array(); $err = 0; $unicaData = ""; if (isset($_POST['apagar_areceber']) && $_POST['apagar_areceber'] != "") { foreach ($_POST as $key => $value) { if ($_POST['tipo'] == 1) { if ($key == "parcela1") { $unicaData = $value; } } else { echo "<script>alert('por data')</script>"; for ($i = 1; $i <= $_POST['parcelas']; $i++) { if ($key == "parcela" . $i) { $parcela[$i] = $value; }