/** * Created by PhpStorm. * User: rodrigo.martins * Date: 21/01/2016 * Time: 10:47 */ include_once "first_all.php"; //echo "<pre>".print_r($_POST)."</pre>"; if (isset($_POST) && $_POST != "") { $bd = new BD(); $table = "contratos"; $table_1 = "fin_receber"; if ($_POST['id'] == 0) { $dados['ativo'] = "true"; $bd->insert($table, $dados); $_POST['id'] = $bd->get("insert_id"); $da = date('Y-m-d', strtotime($_POST['me_dia_vencimento'])); $db = date('d', strtotime($da)); for ($i = 1; $i < 13; $i++) { $dados_1['ativo'] = 'true'; $dados_1['numero_parcela'] = $i; $dados_1['valor'] = $_POST['me_total'] / $_POST['me_parcelas']; if ($_POST['me_parcelas'] < $i) { $dados_1['valor'] = 0; //$dados_1['numero_parcela'] = 0; } $dm = date('m', strtotime($da)); $dd = date('d', strtotime($da)); if ($dm == 2 && $dd >= 28) { $d1 = date('Y-m-1', strtotime($da));
<?php /** * Created by PhpStorm. * User: rodrigo.martins * Date: 21/01/2016 * Time: 10:47 */ include_once "first_all.php"; if (isset($_POST) && $_POST != "") { $bd = new BD(); $bd->start_transaction(); if ($_POST['id'] == 0) { $dados['logo'] = "../dist/img/representantes/padrao.png"; $bd->insert('representantes', $dados); $_POST['id'] = $bd->get("insert_id"); } //UPDATE - representantes $table = 'representantes'; $dados = $_POST; unset($dados['id']); foreach ($dados as $key => $value) { if ($key != 'linha') { $dados[$key] = "'" . $value . "'"; } } $where = "codigo={$_POST['id']}"; $bd->update($table, $dados, $where); $nome_input = "logo"; if (!empty($_FILES[$nome_input]['name'])) { $target_dir = "../dist/img/representantes/";
<?php /** * Created by PhpStorm. * User: rodrigo.martins * Date: 21/01/2016 * Time: 10:47 */ include_once "first_all.php"; if (isset($_POST) && $_POST != "") { $bd = new BD(); $bd->start_transaction(); if ($_POST['id'] == 0) { $dados['status'] = "Ativo"; $bd->insert('produtos', $dados); $_POST['id'] = $bd->get("insert_id"); } //UPDATE - produtos $table = 'produtos'; $dados = array("nome_produto" => "'" . $_POST['nome_produto'] . "'", "detalhamento" => "'" . $_POST['detalhamento'] . "'", "cod_linha" => $_POST['linha'], "status" => "'" . $_POST['status'] . "'", "url" => "'" . $_POST['url'] . "'", "fios" => $_POST['fios'], "desconto" => "'" . $_POST['desconto'] . "'", "substituido" => $_POST['substituido_por']); $where = "codigo={$_POST['id']}"; $bd->update($table, $dados, $where); //DELETE - produto_aplicacao $table1 = "produto_aplicacao"; $where1 = "cod_produto={$_POST['id']}"; $bd->delete($table1, $where1); //INSERT - produto_aplicacao foreach (array_keys($_POST) as $k) { if (preg_match('/^aplicacao_/', $k)) { $dados2 = array("cod_produto" => $_POST['id'], "cod_aplicacao" => $_POST[$k]); $bd->insert($table1, $dados2);
<?php /** * Created by PhpStorm. * User: rodrigo.martins * Date: 21/01/2016 * Time: 10:47 */ include_once "first_all.php"; if (isset($_POST) && $_POST != "") { $bd = new BD(); $bd->start_transaction(); $table = "aplicacao"; if ($_POST['id'] == 0) { $dados['ativo'] = "true"; $bd->insert($table, $dados); $_POST['id'] = $bd->get("insert_id"); } $dados = $_POST; unset($dados['id']); $dados['descricao'] = "'" . $dados['descricao'] . "'"; $where = "codigo={$_POST['id']}"; $bd->update($table, $dados, $where); $bd->record_log("log_login", 'update_aplicacao', $_POST['id']); $bd->commit(); header('Location: ../pages/geral.php'); }
if (isset($_REQUEST["pass"])) { $pass = $_REQUEST["pass"]; } else { $pass = ""; } if (isset($_REQUEST["id_persona"])) { $id_persona = $_REQUEST["id_persona"]; } else { $id_persona = 0; } if ($accion == "add") { $bd = new BD(); $bd->beginTransaction(); try { $parametrosPersona = array("pers_nombres" => $nombre, "pers_paterno" => $apPaterno, "pers_materno" => $apMaterno, "pers_nombrecompleto" => $nombre . " " . $apPaterno . " " . $apMaterno, "pers_email" => $email); $bd->insert(tablas::PERSONAS, $parametrosPersona); if ($bd->myException->getEstado() == 0) { $parametrosUsuario = array('usua_nombre_usuario' => $user, 'usua_clave' => $pass, 'usua_fecha_creacion' => date("Y-m-d H:i:s"), 'id_persona' => $bd->lastId()); $bd->insert2(tablas::USUARIOS, $parametrosUsuario); if ($bd->myException->getEstado() == 0) { $bd->commit(); $estado = "ok"; $mensaje = "Usuario Ingresado Exitosamente"; } else { $bd->rollBack(); $estado = "error"; $mensaje = $bd->myException->getMensaje(); } } else { $bd->rollBack(); $estado = "error";