<?php 
error_reporting(0);
ini_set(“display_errors”, 0 );
include "protege_professor.php"; 

if(isset($_GET['excluir'])){
 $id_empreendimento = $_GET['empreendimento_id'];
 $palno              = $_GET['plano'];

 $query2 = "DELETE * FROM tab_val_loteparcela WHERE  id_empreendimento = '$id_empreendimento' AND num_parcelas = '$plano' ";
  // echo $query1; die();

 $executa2 = mysqli_query($db,$query2);

}


if(isset($_GET['empreendimento_id']) AND isset($_GET['num_parcelas'])){

 $empreendimento =  $_GET['empreendimento_id'];
 $num_parcelas   =  $_GET['num_parcelas'];

 $avistas        =  str_replace(".", "", $_GET['av_sembonu']);
 $avistas        =  str_replace(",", ".", $avistas);

 $confconts      =  str_replace(".", "", $_GET['av_confcontratos']);
 $confconts      =  str_replace(",", ".", $confconts);

 $avistac        =  str_replace(".","", $_GET['av_combonu']);
 $avistac        =  str_replace(",",".", $avistac);

 $confcontc      =  str_replace(".","", $_GET['av_confcontratoc']);
 $confcontc      =  str_replace(",",".", $confcontc );

 $bonus          =  str_replace(".","", $_GET['bonus']);
 $bonus          =  str_replace(",", ".", $bonus);

 include "conexao.php";

 $query1 = "INSERT INTO tab_val_loteparcela (id_empreendimento, avista_semb, av_conf_sbonus, bonus, avista_comb, av_conf_cbonus, num_parcelas) VALUES('$empreendimento', '$avistas', '$confconts', '$bonus', '$avistac', '$confcontc', '$num_parcelas' )";
  // echo $query1; die();

 $executa = mysqli_query($db,$query1);

}


// echo "<pre>";
// print_r($_GET);
// echo "</pre>"; 

function buscar_nome_empreendimento($id){
      include "conexao.php";
      $query3 = "SELECT * FROM cadastro"



}





?>

<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->

<head>
  <meta charset="utf-8" />
  <title>Immobile | Business</title>
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport" />
  <meta content="" name="description" />
  <meta content="" name="author" />

  <!-- ================== BEGIN BASE CSS STYLE ================== -->
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet">
  <link href="https://immobilebusiness.com.br/admin/assets/plugins/jquery-ui/themes/base/minified/jquery-ui.min.css" rel="stylesheet" />
  <link href="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
  <link href="https://immobilebusiness.com.br/admin/assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
  <link href="https://immobilebusiness.com.br/admin/assets/css/animate.min.css" rel="stylesheet" />
  <link href="https://immobilebusiness.com.br/admin/assets/css/style.min.css" rel="stylesheet" />
  <link href="https://immobilebusiness.com.br/admin/assets/css/style-responsive.min.css" rel="stylesheet" />
  <link href="https://immobilebusiness.com.br/admin/assets/css/theme/default.css" rel="stylesheet" id="theme" />

  <link href="https://immobilebusiness.com.br/admin/assets/plugins/select2/dist/css/select2.min.css" rel="stylesheet" />
  <link href="https://immobilebusiness.com.br/admin/assets/css/multiple-select.css" rel="stylesheet"/>

  <!-- ================== END BASE CSS STYLE ================== -->

  <!-- ================== BEGIN PAGE LEVEL STYLE ================== -->
  <link href="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/media/css/dataTables.bootstrap.min.css" rel="stylesheet" />
  <link href="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Buttons/css/buttons.bootstrap.min.css" rel="stylesheet" />
  <link href="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Responsive/css/responsive.bootstrap.min.css" rel="stylesheet" />
  <!-- ================== END PAGE LEVEL STYLE ================== -->

  <!-- ================== BEGIN BASE JS ================== -->
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/pace/pace.min.js"></script>
  <!-- ================== END BASE JS ================== -->
</head>
<body>


  <!-- begin #page-loader -->
  <div id="page-loader" class="fade in"><span class="spinner"></span></div>
  <!-- end #page-loader -->

  <!-- begin #page-container -->
  <div id="page-container" class="page-container fade page-sidebar-fixed page-header-fixed">
    <!-- begin #header -->
    <?php include "topo.php"; ?>

    <!-- begin #content -->
    <div id="content" class="content">
      <!-- begin breadcrumb -->

      <!-- end breadcrumb -->
      <!-- begin page-header -->
      <h1 class="page-header">Tabela de Valores dos Lotes e Parcelas</h1>
      <!-- end page-header -->

      <div class="row">
        <div class="col-md-12">
          <div class="panel panel-inverse">
            <div class="panel-heading">
              <div class="panel-heading-btn">
                <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
                <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i class="fa fa-repeat"></i></a>
                <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning" data-click="panel-collapse"><i class="fa fa-minus"></i></a>
                <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-danger" data-click="panel-remove"><i class="fa fa-times"></i></a>
              </div>
              <h4 class="panel-title">Informe dados para cadastro </h4>
            </div>
            <div class="panel-body">
             <form class="form-vertical form-bordered" name="myForm" method="GET" action="tab_val_lotesparcelas.php">
              <div class="row">    
                <div class="form-group">
                  <label class="col-md-2 control-label">Empreendimento</label>
                  <div class="col-md-4">
                    <div class="input-group">
                     <select class="default-select2 form-control" name="empreendimento_id" id="os" required="" >
                      <option value="Todos">Todos</option>
                      <?php

                      include "conexao.php";

                      $query_amigo = "SELECT * FROM empreendimento_cadastro order by descricao_empreendimento Asc";

                      $executa_query = mysqli_query ($db,$query_amigo) or die ("Erro ao listar empreendimento");
                while ($buscar_amigo = mysqli_fetch_assoc($executa_query)) {//--verifica se são amigos

                  $idempreendimento_cadastro             = $buscar_amigo['idempreendimento_cadastro'];
                  $descricao_empreendimento              = $buscar_amigo["descricao_empreendimento"];
                  
                  ?>
                  <option value="<?php echo $idempreendimento_cadastro ?>"> <?php echo $descricao_empreendimento ?> </option>
                <?php } ?>


              </select>

            </div>
          </div>

          <label class="col-md-2 control-label">Numero de Parcelas</label>
          <div class="col-md-4">
            <div class="input-group">
              <input type="number" name="num_parcelas" class="form-control" required="" >
            </div>
          </div>
        </div>
      </div>
      <br>
      <div class="row">

        <div class="form-group"> 
          <label class="col-md-2 control-label">Bônus:</label>
          <div class="col-md-4">
            <div class="input-group">
              <input type="text" name="bonus" class="form-control masc_valor" placeholder="R$">
            </div>
          </div>
        </div>

      </div>
      <div class="row">

        <label class="col-md-12 control-label"><strong>Sinal (arras) Sem Bônus</strong></label>
        <hr>
      </div>

      <div class="row">

       <div class="form-group"> 
        <label class="col-md-2 control-label" >À vista SEM Bônus:</label>
        <div class="col-md-4">
          <div class="input-group">
            <input type="text" name="av_sembonu" class="form-control masc_valor" placeholder="R$">
          </div>
        </div>
        <label class="col-md-2 control-label">À vista Confeçao do Contrato:</label>
        <div class="col-md-4">
          <div class="input-group">
            <input type="text" name="av_confcontratos" class="form-control masc_valor" placeholder="R$">
          </div>
        </div>
      </div>

    </div>

    <div class="row">

      <label class="col-md-12 control-label"><strong>Sinal (arras) COM Bônus</strong></label>
      <hr>
    </div>

    <div class="row">

     <div class="form-group"> 
      <label class="col-md-2 control-label" >À vista com Bônus:</label>
      <div class="col-md-4">
        <div class="input-group">
          <input type="text" name="av_combonu" class="form-control masc_valor" placeholder="R$">
        </div>
      </div>


      <label class="col-md-2 control-label">À vista Confeçao do Contrato:</label>
      <div class="col-md-4">
        <div class="input-group">
          <input type="text" name="av_confcontratoc" class="form-control masc_valor" placeholder="R$">
        </div>
      </div>
    </div>

  </div>

  <br>

  <div class="row">
    <div class="form-group">
      <div class="col-md-12">
        <input type="submit" class="btn btn-sm btn-success" value="Cadastrar" />
      </div>
    </div>
  </div>


</div>
</form>
<!-- end #content -->
</div>

          <div class="col-md-12">
              <!-- begin panel -->
                    <div class="panel panel-inverse">
                        <div class="panel-heading">
                            <div class="panel-heading-btn">
                                <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
                                <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i class="fa fa-repeat"></i></a>
                                <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning" data-click="panel-collapse"><i class="fa fa-minus"></i></a>
                                <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-danger" data-click="panel-remove"><i class="fa fa-times"></i></a>
                            </div>
                            <h4 class="panel-title">Planos Cadastrados</h4>
                        </div>
                      
                        <div class="panel-body">
                            <table id="data-table" class="table table-striped table-bordered">
    <thead>
      <tr>
        <th>Empreendimento</th>
        <th>Plano</th>
        <th>Ações</th>

      </tr>
    </thead>
    <tbody>

      <?php 

      $idempreendimento = $_GET['empreendimento_id'];

      include "conexao.php";
      $query_slide = mysqli_query($db,"SELECT * FROM tab_val_loteparcela
       WHERE id_empreendimento = '$idempreendimento' order by idplanotab desc LIMIT 1"); 

            while ($buscar_slide = mysqli_fetch_assoc($query_slide)) {//--While categoria

             $emp        = $buscar_slide["id_empreendimento"];
             $plano       = $buscar_slide["num_parcelas"];

             ?> 

             <tr class="odd gradeX">
              <td><?php echo "$emp"?></td>
              <td><?php echo "$plano"?></td>
              <td><a href="tab_val_lotesparcelas.php?empreendimento_id=<?php echo $emp ?>&excluir=ok&plano=<?php echo $plano?>"> <span class="label label-danger">Excluir</span> </a></td>
            </tr>

          <?php } ?>

        </tbody>

      </table>
    </div>
</div>
</div>






    <!-- begin scroll to top btn -->
    <a href="javascript:;" class="btn btn-icon btn-circle btn-success btn-scroll-to-top fade" data-click="scroll-top"><i class="fa fa-angle-up"></i></a>
    <!-- end scroll to top btn -->
  </div>
  <!-- ================== BEGIN BASE JS ================== -->
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/jquery/jquery-1.9.1.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/jquery/jquery-migrate-1.1.0.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/jquery-ui/ui/minified/jquery-ui.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap/js/bootstrap.min.js"></script>
  <!--[if lt IE 9]>
    <script src="https://immobilebusiness.com.br/admin/assets/crossbrowserjs/html5shiv.js"></script>
    <script src="https://immobilebusiness.com.br/admin/assets/crossbrowserjs/respond.min.js"></script>
    <script src="https://immobilebusiness.com.br/admin/assets/crossbrowserjs/excanvas.min.js"></script>
  <![endif]-->
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/slimscroll/jquery.slimscroll.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/jquery-cookie/jquery.cookie.js"></script>
  <!-- ================== END BASE JS ================== -->
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/ionRangeSlider/js/ion-rangeSlider/ion.rangeSlider.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap-colorpicker/js/bootstrap-colorpicker.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/masked-input/masked-input.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap-timepicker/js/bootstrap-timepicker.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/password-indicator/js/password-indicator.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap-combobox/js/bootstrap-combobox.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap-select/bootstrap-select.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap-tagsinput/bootstrap-tagsinput.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap-tagsinput/bootstrap-tagsinput-typeahead.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/jquery-tag-it/js/tag-it.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap-daterangepicker/moment.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap-daterangepicker/daterangepicker.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/select2/dist/js/select2.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap-eonasdan-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/js/form-plugins.demo.min.js"></script>
  <!-- ================== BEGIN PAGE LEVEL JS ================== -->
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/media/js/jquery.dataTables.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/media/js/dataTables.bootstrap.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Buttons/js/dataTables.buttons.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Buttons/js/buttons.bootstrap.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Buttons/js/buttons.flash.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Buttons/js/jszip.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Buttons/js/pdfmake.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Buttons/js/vfs_fonts.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Buttons/js/buttons.html5.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Buttons/js/buttons.print.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Responsive/js/dataTables.responsive.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/js/table-manage-buttons.demo.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/js/apps.min.js"></script>
  <!-- ================== END PAGE LEVEL JS ================== -->
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/jquery/jquery-1.9.1.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/js/jquery.maskMoney.js" type="text/javascript"></script>


  <script type="text/javascript">


    $(function(){
      $(".masc_valor").maskMoney({symbol:'', 
        showSymbol:true, thousands:'.', decimal:',', symbolStay: true});
    })

// $(function(){
// $("#valor_cheque").maskMoney({symbol:'R$ ', 
// showSymbol:true, thousands:'.', decimal:',', symbolStay: true});
//  })
</script>




<script src="produtos_pagar.js"></script>
<script src="lote_pagar.js"></script>

<script>
  $(document).ready(function() {
    App.init();
    TableManageButtons.init();
    FormPlugins.init();

  });
</script>

</body>


</html>
