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

if(isset($_POST["titulo"])){

	include "conexao.php";
	date_default_timezone_set('America/Sao_Paulo');
  $imovel_id             = $_POST["imovel_id"];
  $empreendimento_id     = $_POST["empreendimento_id"];
  $quadra_id             = $_POST["quadra_id"];
  $lote_id               = $_POST["lote_id"];
  $descricao             = $_POST["descricao"];
	$titulo                = $_POST["titulo"];
	$cadastrado_por        = $_POST["cadastrado_por"];
	$ocorrencia_para       = $_POST["cliente_idcliente"];
  $ocorrencia_para_grupo = $_POST["grupo_idgrupo"];
  
	$data_ocorrencia    = date('d-m-Y H:i:s');
	$status_ocorrencia  = '1';

	$inserir = mysqli_query($db, "INSERT INTO ocorrencia(titulo, descricao, cadastrado_por, data_ocorrencia, status_ocorrencia, ocorrencia_para, imovel_id, empreendimento_id, quadra_id, lote_id, ocorrencia_para_grupo) values ('$titulo','$descricao','$cadastrado_por','$data_ocorrencia','$status_ocorrencia','$ocorrencia_para','$imovel_id','$empreendimento_id','$quadra_id','$lote_id', '$ocorrencia_para_grupo')");

	$ultimo_id = mysqli_insert_id($db);


$pasta = "ocorrencias/".$ultimo_id."/";
if(!file_exists($pasta)){
mkdir($pasta);
}




 foreach($_FILES["img"]["error"] as $key => $error){
 
 if($error == UPLOAD_ERR_OK){
 $tmp_name = $_FILES["img"]["tmp_name"][$key];
 $cod     = $_FILES["img"]["name"][$key];
 ////////////////////////////////////////

 //////////////////////////////////////////

$extensao = explode(".", $cod);
$parte1   =  $extensao[0]; // piece1
$parte2   =  ".".$extensao[1]; // piece2


$novo_nome =  rand(1, 15);
$pasta_g   = $novo_nome.$parte2;
$pasta2    = $pasta.$novo_nome.$parte2;
 
 $nome    = $_FILES["img"]["name"][$key];
 $uploadfile = $pasta . basename($cod);
 
$mover = move_uploaded_file($tmp_name, $uploadfile);

$trocando_nome = rename($uploadfile, $pasta2);

$inserir = mysqli_query ($db,"INSERT INTO ocorrencia_arquivos (ocorrencia_id, descricao, url_anexo) values ('$ultimo_id','$descricao','$pasta_g')") or die ("ERRO AO ANEXAR ARQUIVO.");

 
}}

        //Envia Notificação
      include "envia_notificacao.php"; 

      date_default_timezone_set('America/Sao_Paulo');

      $mensagem = null;
      $data = date(H);

      if($data > 00 && $data < 12){
        $mensagem = "Bom dia";

      }if ($data >= 12 && $data <= 18) {
        $mensagem = "Boa tarde";
        # code...
      }if($data > 18 && $data <= 23){
        $mensagem = "Boa noite";
      }
        
        if(isset($ocorrencia_para_grupo) && !empty($ocorrencia_para_grupo)){

            $notifica = "SELECT * FROM `cliente` WHERE `idgrupo` = $ocorrencia_para_grupo";
            $executa = mysqli_query($db,$notifica) or die ("Erro ao listar empreendiment123");
    
            if(mysqli_num_rows($executa)){
               $dados = [];
             while ($recebe = mysqli_fetch_assoc($executa)){
                $dado = null;
                
                $dado['id_user'] = $recebe["idcliente"];
                $dado['titulo'] = $mensagem." ".buscaNome($recebe["idcliente"]).", "." você tem uma nova ocorrencia.";
                $dado['msg'] = 'Uma nova ocorrencia foi lançada';
                $dado['icon'] = 'https://immobilebusiness.com.br/home/assets/img/icons/site/favicon.png';
                $dado['link_red'] ="https://modelo.ibsystem.com.br/ocorrencias_tratar.php?idocorrencia=".$ultimo_id ."";
                $dado['badge'] = 'https://notificacao.ibsystem.com.br/badges/icone%20para%20notifica%c3%a7%c3%a3o.png';

                $dados[] = $dado;
                envia_notificacao($dados);   
          }
       }
  }elseif(isset($ocorrencia_para) && !empty($ocorrencia_para_grupo)){
           $dados = [];

            $dado = null;
            $dado['id_user'] = $ocorrencia_para;
            $dado['titulo'] = $mensagem.", ".buscaNome($ocorrencia_para).", você tem uma nova ocorrencia.";
            $dado['msg'] = 'Uma nova ocorrencia foi lançada';
            $dado['icon'] = 'https://immobilebusiness.com.br/home/assets/img/icons/site/favicon.png';
            $dado['link_red'] ="https://modelo.ibsystem.com.br/ocorrencias_tratar.php?idocorrencia=".$ultimo_id ."";
            $dado['badge'] = 'https://notificacao.ibsystem.com.br/badges/icone%20para%20notifica%c3%a7%c3%a3o.png';

            $dados[] = $dado;
            envia_notificacao($dados);
        }
   ?>






<?php 


include "conexao.php";
 $query_amigo_cli = "SELECT * FROM cliente
                
                WHERE idcliente = $ocorrencia_para";


        
                $executa_query_cli = mysqli_query ($db,$query_amigo_cli) or die ("Erro ao listar empreendimento");
                
                
            while ($buscar_amigo = mysqli_fetch_assoc($executa_query_cli)) {//--verifica se são amigos
            
                $nome_cli         = $buscar_amigo['nome_cli'];                  
                $email_cli        = $buscar_amigo['email_cli'];
                

              }



$email ="<!DOCTYPE html>
<!--[if IE 8]> <html lang='en' class='ie8'> <![endif]-->
<!--[if !IE]><!-->
<html lang='en'>
<!--<![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' />
	
	<style type='text/css'>
	    /******************************************************
        * INK RESPONSIVE EMAIL TEMPLATE: http://zurb.com/ink/ *
        ******************************************************/
        
        /* Client-specific Styles & Reset */
        
        #outlook a { 
          padding:0; 
        } 
        
        body{ 
          width:100% !important; 
          min-width: 100%;
          -webkit-text-size-adjust:100%; 
          -ms-text-size-adjust:100%; 
          margin:0; 
          padding:0;
        }
        
        .ExternalClass { 
          width:100%;
        } 
        
        .ExternalClass, 
        .ExternalClass p, 
        .ExternalClass span, 
        .ExternalClass font, 
        .ExternalClass td, 
        .ExternalClass div { 
          line-height: 100%; 
        } 
        
        #backgroundTable { 
          margin:0; 
          padding:0; 
          width:100% !important; 
          line-height: 100% !important; 
        }
        
        img { 
          outline:none; 
          text-decoration:none; 
          -ms-interpolation-mode: bicubic;
          width: auto;
          max-width: 100%; 
          float: left; 
          clear: both; 
          display: block;
        }
        
        center {
          width: 100%;
          min-width: 580px;
        }
        
        a img { 
          border: none;
        }
        
        p {
          margin: 0 0 0 10px;
        }
        
        table {
          border-spacing: 0;
          border-collapse: collapse;
        }
        
        td { 
          word-break: break-word;
          -webkit-hyphens: auto;
          -moz-hyphens: auto;
          hyphens: auto;
          border-collapse: collapse !important; 
        }
        
        table, tr, td {
          padding: 0;
          vertical-align: top;
          text-align: left;
        }
        
        hr {
          color: #d9d9d9; 
          background-color: #d9d9d9; 
          height: 1px; 
          border: none;
        }
        
        /* Responsive Grid */
        
        table.body {
          height: 100%;
          width: 100%;
        }
        
        table.container {
          width: 580px;
          margin: 0 auto;
          text-align: inherit;
        }
        
        table.row { 
          padding: 0px; 
          width: 100%;
          position: relative;
        }
        
        table.container table.row {
          display: block;
        }
        
        td.wrapper {
          padding: 10px 20px 0px 0px;
          position: relative;
        }
        
        table.columns,
        table.column {
          margin: 0 auto;
        }
        
        table.columns td,
        table.column td {
          padding: 0px 0px 10px; 
        }
        
        table.columns td.sub-columns,
        table.column td.sub-columns,
        table.columns td.sub-column,
        table.column td.sub-column {
          padding-right: 10px;
        }
        
        td.sub-column, td.sub-columns {
          min-width: 0px;
        }
        
        table.row td.last,
        table.container td.last {
          padding-right: 0px;
        }
        
        table.one { width: 30px; }
        table.two { width: 80px; }
        table.three { width: 130px; }
        table.four { width: 180px; }
        table.five { width: 230px; }
        table.six { width: 280px; }
        table.seven { width: 330px; }
        table.eight { width: 380px; }
        table.nine { width: 430px; }
        table.ten { width: 480px; }
        table.eleven { width: 530px; }
        table.twelve { width: 580px; }
        
        table.one center { min-width: 30px; }
        table.two center { min-width: 80px; }
        table.three center { min-width: 130px; }
        table.four center { min-width: 180px; }
        table.five center { min-width: 230px; }
        table.six center { min-width: 280px; }
        table.seven center { min-width: 330px; }
        table.eight center { min-width: 380px; }
        table.nine center { min-width: 430px; }
        table.ten center { min-width: 480px; }
        table.eleven center { min-width: 530px; }
        table.twelve center { min-width: 580px; }
        
        table.one .panel center { min-width: 10px; }
        table.two .panel center { min-width: 60px; }
        table.three .panel center { min-width: 110px; }
        table.four .panel center { min-width: 160px; }
        table.five .panel center { min-width: 210px; }
        table.six .panel center { min-width: 260px; }
        table.seven .panel center { min-width: 310px; }
        table.eight .panel center { min-width: 360px; }
        table.nine .panel center { min-width: 410px; }
        table.ten .panel center { min-width: 460px; }
        table.eleven .panel center { min-width: 510px; }
        table.twelve .panel center { min-width: 560px; }
        
        .body .columns td.one,
        .body .column td.one { width: 8.333333%; }
        .body .columns td.two,
        .body .column td.two { width: 16.666666%; }
        .body .columns td.three,
        .body .column td.three { width: 25%; }
        .body .columns td.four,
        .body .column td.four { width: 33.333333%; }
        .body .columns td.five,
        .body .column td.five { width: 41.666666%; }
        .body .columns td.six,
        .body .column td.six { width: 50%; }
        .body .columns td.seven,
        .body .column td.seven { width: 58.333333%; }
        .body .columns td.eight,
        .body .column td.eight { width: 66.666666%; }
        .body .columns td.nine,
        .body .column td.nine { width: 75%; }
        .body .columns td.ten,
        .body .column td.ten { width: 83.333333%; }
        .body .columns td.eleven,
        .body .column td.eleven { width: 91.666666%; }
        .body .columns td.twelve,
        .body .column td.twelve { width: 100%; }
        
        td.offset-by-one { padding-left: 50px; }
        td.offset-by-two { padding-left: 100px; }
        td.offset-by-three { padding-left: 150px; }
        td.offset-by-four { padding-left: 200px; }
        td.offset-by-five { padding-left: 250px; }
        td.offset-by-six { padding-left: 300px; }
        td.offset-by-seven { padding-left: 350px; }
        td.offset-by-eight { padding-left: 400px; }
        td.offset-by-nine { padding-left: 450px; }
        td.offset-by-ten { padding-left: 500px; }
        td.offset-by-eleven { padding-left: 550px; }
        
        td.expander {
          visibility: hidden;
          width: 0px;
          padding: 0 !important;
        }
        
        table.columns .text-pad,
        table.column .text-pad {
          padding-left: 10px;
          padding-right: 10px;
        }
        
        table.columns .left-text-pad,
        table.columns .text-pad-left,
        table.column .left-text-pad,
        table.column .text-pad-left {
          padding-left: 10px;
        }
        
        table.columns .right-text-pad,
        table.columns .text-pad-right,
        table.column .right-text-pad,
        table.column .text-pad-right {
          padding-right: 10px;
        }
        
        /* Block Grid */
        
        .block-grid {
          width: 100%;
          max-width: 580px;
        }
        
        .block-grid td {
          display: inline-block;
          padding:10px;
        }
        
        .two-up td {
          width:270px;
        }
        
        .three-up td {
          width:173px;
        }
        
        .four-up td {
          width:125px;
        }
        
        .five-up td {
          width:96px;
        }
        
        .six-up td {
          width:76px;
        }
        
        .seven-up td {
          width:62px;
        }
        
        .eight-up td {
          width:52px;
        }
        
        /* Alignment & Visibility Classes */
        
        table.center, td.center {
          text-align: center;
        }
        
        h1.center,
        h2.center,
        h3.center,
        h4.center,
        h5.center,
        h6.center {
          text-align: center;
        }
        
        span.center {
          display: block;
          width: 100%;
          text-align: center;
        }
        
        img.center {
          margin: 0 auto;
          float: none;
        }
        
        .show-for-small,
        .hide-for-desktop {
          display: none;
        }
        
        /* Typography */
        
        body, table.body, h1, h2, h3, h4, h5, h6, p, td { 
          color: #222222;
          font-family: 'Helvetica', 'Arial', sans-serif; 
          font-weight: normal; 
          padding:0; 
          margin: 0;
          text-align: left; 
          line-height: 1.3;
        }
        
        h1, h2, h3, h4, h5, h6 {
          word-break: normal;
        }
        
        h1 {font-size: 40px;}
        h2 {font-size: 36px;}
        h3 {font-size: 32px;}
        h4 {font-size: 28px;}
        h5 {font-size: 24px;}
        h6 {font-size: 20px;}
        body, table.body, p, td {font-size: 14px;line-height:19px;}
        
        p.lead, p.lede, p.leed {
          font-size: 18px;
          line-height:21px;
        }
        
        p { 
          margin-bottom: 10px;
        }
        
        small {
          font-size: 10px;
        }
        
        a {
          color: #2ba6cb; 
          text-decoration: none;
        }
        
        a:hover { 
          color: #2795b6 !important;
        }
        
        a:active { 
          color: #2795b6 !important;
        }
        
        a:visited { 
          color: #2ba6cb !important;
        }
        
        h1 a, 
        h2 a, 
        h3 a, 
        h4 a, 
        h5 a, 
        h6 a {
          color: #2ba6cb;
        }
        
        h1 a:active, 
        h2 a:active,  
        h3 a:active, 
        h4 a:active, 
        h5 a:active, 
        h6 a:active { 
          color: #2ba6cb !important; 
        } 
        
        h1 a:visited, 
        h2 a:visited,  
        h3 a:visited, 
        h4 a:visited, 
        h5 a:visited, 
        h6 a:visited { 
          color: #2ba6cb !important; 
        } 
        
        /* Panels */
        
        .panel {
          background: #f2f2f2;
          border: 1px solid #d9d9d9;
          padding: 10px !important;
        }
        
        .sub-grid table {
          width: 100%;
        }
        
        .sub-grid td.sub-columns {
          padding-bottom: 0;
        }
        
        /* Buttons */
        
        table.button,
        table.tiny-button,
        table.small-button,
        table.medium-button,
        table.large-button {
          width: 100%;
          overflow: hidden;
        }
        
        table.button td,
        table.tiny-button td,
        table.small-button td,
        table.medium-button td,
        table.large-button td {
          display: block;
          width: auto !important;
          text-align: center;
          background: #2ba6cb;
          border: 1px solid #2284a1;
          color: #ffffff;
          padding: 8px 0;
        }
        
        table.tiny-button td {
          padding: 5px 0 4px;
        }
        
        table.small-button td {
          padding: 8px 0 7px;
        }
        
        table.medium-button td {
          padding: 12px 0 10px;
        }
        
        table.large-button td {
          padding: 21px 0 18px;
        }
        
        table.button td a,
        table.tiny-button td a,
        table.small-button td a,
        table.medium-button td a,
        table.large-button td a {
          font-weight: bold;
          text-decoration: none;
          font-family: Helvetica, Arial, sans-serif;
          color: #ffffff;
          font-size: 16px;
        }
        
        table.tiny-button td a {
          font-size: 12px;
          font-weight: normal;
        }
        
        table.small-button td a {
          font-size: 16px;
        }
        
        table.medium-button td a {
          font-size: 20px;
        }
        
        table.large-button td a {
          font-size: 24px;
        }
        
        table.button:hover td,
        table.button:visited td,
        table.button:active td {
          background: #2795b6 !important;
        }
        
        table.button:hover td a,
        table.button:visited td a,
        table.button:active td a {
          color: #fff !important;
        }
        
        table.button:hover td,
        table.tiny-button:hover td,
        table.small-button:hover td,
        table.medium-button:hover td,
        table.large-button:hover td {
          background: #2795b6 !important;
        }
        
        table.button:hover td a,
        table.button:active td a,
        table.button td a:visited,
        table.tiny-button:hover td a,
        table.tiny-button:active td a,
        table.tiny-button td a:visited,
        table.small-button:hover td a,
        table.small-button:active td a,
        table.small-button td a:visited,
        table.medium-button:hover td a,
        table.medium-button:active td a,
        table.medium-button td a:visited,
        table.large-button:hover td a,
        table.large-button:active td a,
        table.large-button td a:visited {
          color: #ffffff !important; 
        }
        
        table.secondary td {
          background: #e9e9e9;
          border-color: #d0d0d0;
          color: #555;
        }
        
        table.secondary td a {
          color: #555;
        }
        
        table.secondary:hover td {
          background: #d0d0d0 !important;
          color: #555;
        }
        
        table.secondary:hover td a,
        table.secondary td a:visited,
        table.secondary:active td a {
          color: #555 !important;
        }
        
        table.success td {
          background: #5da423;
          border-color: #457a1a;
        }
        
        table.success:hover td {
          background: #457a1a !important;
        }
        
        table.alert td {
          background: #c60f13;
          border-color: #970b0e;
        }
        
        table.alert:hover td {
          background: #970b0e !important;
        }
        
        table.radius td {
          -webkit-border-radius: 3px;
          -moz-border-radius: 3px;
          border-radius: 3px;
        }
        
        table.round td {
          -webkit-border-radius: 500px;
          -moz-border-radius: 500px;
          border-radius: 500px;
        }
        
        /* Outlook First */
        
        body.outlook p {
          display: inline !important;
        }
        
        /*  Media Queries */
        
        @media only screen and (max-width: 600px) {
        
          table[class='body'] img {
            width: auto !important;
            height: auto !important;
          }
        
          table[class='body'] center {
            min-width: 0 !important;
          }
        
          table[class='body'] .container {
            width: 95% !important;
          }
        
          table[class='body'] .row {
            width: 100% !important;
            display: block !important;
          }
        
          table[class='body'] .wrapper {
            display: block !important;
            padding-right: 0 !important;
          }
        
          table[class='body'] .columns,
          table[class='body'] .column {
            table-layout: fixed !important;
            float: none !important;
            width: 100% !important;
            padding-right: 0px !important;
            padding-left: 0px !important;
            display: block !important;
          }
        
          table[class='body'] .wrapper.first .columns,
          table[class='body'] .wrapper.first .column {
            display: table !important;
          }
        
          table[class='body'] table.columns td,
          table[class='body'] table.column td {
            width: 100% !important;
          }
        
          table[class='body'] .columns td.one,
          table[class='body'] .column td.one { width: 8.333333% !important; }
          table[class='body'] .columns td.two,
          table[class='body'] .column td.two { width: 16.666666% !important; }
          table[class='body'] .columns td.three,
          table[class='body'] .column td.three { width: 25% !important; }
          table[class='body'] .columns td.four,
          table[class='body'] .column td.four { width: 33.333333% !important; }
          table[class='body'] .columns td.five,
          table[class='body'] .column td.five { width: 41.666666% !important; }
          table[class='body'] .columns td.six,
          table[class='body'] .column td.six { width: 50% !important; }
          table[class='body'] .columns td.seven,
          table[class='body'] .column td.seven { width: 58.333333% !important; }
          table[class='body'] .columns td.eight,
          table[class='body'] .column td.eight { width: 66.666666% !important; }
          table[class='body'] .columns td.nine,
          table[class='body'] .column td.nine { width: 75% !important; }
          table[class='body'] .columns td.ten,
          table[class='body'] .column td.ten { width: 83.333333% !important; }
          table[class='body'] .columns td.eleven,
          table[class='body'] .column td.eleven { width: 91.666666% !important; }
          table[class='body'] .columns td.twelve,
          table[class='body'] .column td.twelve { width: 100% !important; }
        
          table[class='body'] td.offset-by-one,
          table[class='body'] td.offset-by-two,
          table[class='body'] td.offset-by-three,
          table[class='body'] td.offset-by-four,
          table[class='body'] td.offset-by-five,
          table[class='body'] td.offset-by-six,
          table[class='body'] td.offset-by-seven,
          table[class='body'] td.offset-by-eight,
          table[class='body'] td.offset-by-nine,
          table[class='body'] td.offset-by-ten,
          table[class='body'] td.offset-by-eleven {
            padding-left: 0 !important;
          }
        
          table[class='body'] table.columns td.expander {
            width: 1px !important;
          }
        
          table[class='body'] .right-text-pad,
          table[class='body'] .text-pad-right {
            padding-left: 10px !important;
          }
        
          table[class='body'] .left-text-pad,
          table[class='body'] .text-pad-left {
            padding-right: 10px !important;
          }
        
          table[class='body'] .hide-for-small,
          table[class='body'] .show-for-desktop {
            display: none !important;
          }
        
          table[class='body'] .show-for-small,
          table[class='body'] .hide-for-desktop {
            display: inherit !important;
          }
        }
	</style>
	<style type='text/css'>
	    /********************************
        * CUSTOM STYLING - SYSTEM EMAIL *
        ********************************/
	    body {
	        background: #d9e0e7;
	    }
	    a:hover,
	    a:focus {
	        text-decoration: underline;
	    }
	    
	    /* Typography */
	    
	    body, table.body, p, td {
	        font-size: 12px;
	    }
	    h1, h2, h3, h4 {
	        margin: 5px 0 10px;
	    }
	    h5, h6 {
	        margin: 5px 0;
	    }
	    
	    h1 { font-size: 36px; }
	    h2 { font-size: 30px; }
	    h3 { font-size: 24px; }
	    h4 { font-size: 18px; }
	    h5 { font-size: 14px; }
	    h6 { font-size: 12px; }
	    
	    /* Predefined Class */
	    
	    h1.last,
	    h2.last,
	    h3.last,
	    h4.last,
	    h5.last,
	    h6.last,
	    p.last {
	        margin-bottom: 0;
	    }
	    td.last {
	        padding-bottom: 0 !important;
	    }
	    td.wrapper {
	        padding: 15px 15px 0 15px;
	    }
	    table.columns td, table.column td {
	        padding: 0 0 15px 0;
	    }
	    .header,
	    .footer {
	        background: #ffffff;
	    }
	    .content.dark-theme {
	        background: #2d353c;
	    }
	    .content.dark-theme .panel {
	        background: #1b2024;
	        border: none;
	    }
	    .content.dark-theme h1, 
	    .content.dark-theme h2,
	    .content.dark-theme h3, 
	    .content.dark-theme h4, 
	    .content.dark-theme h5, 
	    .content.dark-theme h6,
	    .content.dark-theme .highlight {
	        color: #fff !important;
	    } 
	    .content.dark-theme a, a {
	        color: #00acac;
	    }
	    .content.dark-theme p, 
	    .content.dark-theme td {
	        color: #a8acb1 !important;
	    }
	    .divider {
	        height: 1px;
	        width: 100%;
	        background: #000;
	        margin-top: 5px;
	    }
	    .text-right {
	        text-align: right;
	    }
	    .valign-middle {
	        vertical-align: middle;
	    }
	    .m-t-0 { margin-top: 0px !important; }
	    .m-t-5 { margin-top: 5px !important; }
	    .m-t-10 { margin-top: 10px !important; }
	    .m-t-15 { margin-top: 15px !important; }
	    .m-b-0 { margin-bottom: 0px !important; }
	    .m-b-5 { margin-bottom: 5px !important; }
	    .m-b-10 { margin-bottom: 10px !important; }
	    .m-b-15 { margin-bottom: 15px !important; }
	    .p-t-0 { padding-top: 0px !important; }
	    .p-t-5 { padding-top: 5px !important; }
	    .p-t-10 { padding-top: 10px !important; }
	    .p-t-15 { padding-top: 15px !important; }
	    
	    /* Button */
	    .btn a,
	    .button a {
	        color: #fff !important;
	        font-weight: normal !important;
	        text-decoration: none !important;
	    }
	    table.btn td,
	    table.button td {
	        vertical-align: middle !important;
	        padding: 6px 18px !important;
	        background: #00acac !important;
	        border-color: #00acac !important;
	    }
	    table.btn:hover td, 
	    table.button:hover td,
	    table.btn:visited td, 
	    table.button:visited td,
	    table.btn:active td,
	    table.button:active td {
	        background: #008a8a !important;
	        border-color: #008a8a !important;
	    }
	    
	    /* Button Orange */
	    
	    table.btn.orange td,
	    table.button.orange td {
	        background: #f59c1a !important;
	        border-color: #f59c1a !important;
	    }
	    table.btn.orange:hover td, 
	    table.button.orange:hover td,
	    table.btn.orange:visited td, 
	    table.button.orange:visited td,
	    table.btn.orange:active td,
	    table.button.orange:active td {
	        background: #c47d15 !important;
	        border-color: #c47d15 !important;
	    }
	    
	    /* Button Blue */
	    
	    table.btn.blue td,
	    table.button.blue td {
	        background: #348fe2 !important;
	        border-color: #348fe2 !important;
	    }
	    table.btn.blue:hover td, 
	    table.button.blue:hover td,
	    table.btn.blue:visited td, 
	    table.button.blue:visited td,
	    table.btn.blue:active td,
	    table.button.blue:active td {
	        background: #2a72b5 !important;
	        border-color: #2a72b5 !important;
	    }
	    
	    /* Button Red */
	    
	    table.btn.red td,
	    table.button.red td {
	        background: #ff5b57 !important;
	        border-color: #ff5b57 !important;
	    }
	    table.btn.red:hover td, 
	    table.button.red:hover td,
	    table.btn.red:visited td, 
	    table.button.red:visited td,
	    table.btn.red:active td,
	    table.button.red:active td {
	        background: #cc4946 !important;
	        border-color: #cc4946 !important;
	    }
	    
	    /* Button White */
	    
	    table.btn.white td a,
	    table.button.white td a {
	        color: #333 !important;
	    }
	    table.btn.white td,
	    table.button.white td {
	        background: #ffffff !important;
	        border-color: #ffffff !important;
	    }
	    table.btn.white:hover td, 
	    table.button.white:hover td,
	    table.btn.white:visited td, 
	    table.button.white:visited td,
	    table.btn.white:active td,
	    table.button.white:active td {
	        background: #e2e7eb !important;
	        border-color: #e2e7eb !important;
	    }
	    
	    /* Button Grey */
	    
	    table.btn.grey td,
	    table.button.grey td {
	        background: #348fe2 !important;
	        border-color: #348fe2 !important;
	    }
	    table.btn.grey:hover td, 
	    table.button.grey:hover td,
	    table.btn.grey:visited td, 
	    table.button.grey:visited td,
	    table.btn.grey:active td,
	    table.button.grey:active td {
	        background: #929ba1 !important;
	        border-color: #929ba1 !important;
	    }
	    
	    @media only screen and (max-width: 600px) {
	        .body .container.content {
	            width: 100% !important;
	        }
	        table[class='body'] .wrapper {
	            padding-right: 15px !important;
	        }
	        .text-right {
	            text-align: left !important;
	        }
	    }
	</style>
</head>
<body>
<!-- begin page body -->
<table class='body'>
    <tr>
        <td class='center' align='center' valign='top'>
            <center>
                <!-- begin page header -->
                <table class='row header'>
                    <tr>
                        <td class='center' align='center'>
                            <center>
                                <!-- begin container -->
                                <table class='container'>
                                    <tr>
                                        <td class='wrapper'>
                                            <!-- begin six columns -->
                                            <table class='six columns'>
                                                <tr>
                                                    <td>
                                                        <a href='index.html'><img src='http://immobilebusiness.com.br/vendas/s3-us-west-2.amazonaws.com/hr.png' /></a>
                                                    </td>
                                                    <td class='expander'></td>
                                                </tr>
                                            </table>
                                            <!-- end six columns -->
                                        </td>
                                        <td class='wrapper'>
                                            <!-- begin six columns -->
                                            <table class='six columns'>
                                                <tr>
                                                    <td class='text-right valign-middle'>
                                                        <a href='http://hrsantos.com.br/carteira'>Site</a>
                                                    </td>
                                                    <td class='expander'></td>
                                                </tr>
                                            </table>
                                            <!-- end six columns -->
                                        </td>
                                    </tr>
                                </table>
                                <!-- end container -->
                            </center>
                        </td>
                    </tr>
                </table>
                <!-- end page header -->
                
                <!-- begin page container -->
                <table class='container content dark-theme'>
                    <tr>
                        <td>
                           
                            <table class='row'>
                                <tr>
                                    <td class='wrapper'>
                                        <table class='twelve columns'>
                                            <tr>
                                                <td class='last'>
                                                    <h4>Olá $nome_cli, </h4>
                                                    <p>
                                                        Vc recebeu uma nova ocorrencia em nosso sistema para visualizar acesse atráves do Link:
                                                        <a href='http://hrsantos.com.br/carteira'>Immobile Business</a>
                                                    </p>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                            <!-- end row -->
                            <!-- begin row -->
                            <table class='row'>

                                <tr>

                                    <td class='wrapper'>
                                        <!-- begin four columns -->
                                       
                                        <!-- end four columns -->
                                    </td>
                                    
                                </tr>
                            </table>
                            <!-- end row -->
                            <br />
                        </td>
                    </tr>
                </table>
                <!-- end page container -->
                
                <!-- begin page footer -->
                <table class='row footer'>
                    <tr>
                        <td class='center' align='center'>
                            <center>
                                <!-- begin container -->
                                <table class='container'>
                                    <tr>
                                        <td class='wrapper'>
                                            <table class='four columns'>
                                                <tr>
                                                    <td>
                                                        &copy;Immobile Business.
                                                    </td>
                                                    <td class='expander'></td>
                                                </tr>
                                            </table>
                                        </td>
                                     
                                    </tr>
                                </table>
                                <!-- end container -->
                            </center>
                        </td>
                    </tr>
                </table>
                <!-- end page footer -->
            </center>
        </td>
    </tr>
</table>
<!-- end page body -->

</body>


</html>";


// emails para quem será enviado o formulário
  $emailenviar = $email_cli;
  $destino = $emailenviar;
  $assunto = "Imoveis | Immobile Business";

  // É necessário indicar que o formato do e-mail é html
  $headers  = 'MIME-Version: 1.0' . "\r\n";
      $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
      $headers .= 'From: '.$nome_cli.' <'.$email_cli.'>';
  //$headers .= "Bcc: $EmailPadrao\r\n";
  
  $enviaremail = mail($destino, $assunto, $email, $headers);
  if($enviaremail){
  $mgm = "E-MAIL ENVIADO COM SUCESSO! <br> O link será enviado para o e-mail fornecido no formulário";
  echo " <meta http-equiv='refresh' content='0'>";
  } else {
  $mgm = "ERRO AO ENVIAR E-MAIL!";
  echo "";
  }
?>




<script type="text/javascript">
	window.location="sistema_ocorrencia.php";
</script>
<?php  } ?>

<!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" />
	
	 <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>
<script>
function ShowHideDIV(){

  Valor = document.getElementById("tipo_cobranca").value;

  if (Valor=="2") 
  {
    document.getElementById('locacao').style.display    = "none"
    document.getElementById('teste').style.display      = "block"
    document.getElementById('quadra2').style.display    = "block"
    document.getElementById('lote32').style.display     = "block"

  }
  else
  {
    document.getElementById('locacao').style.display    = "block"
    document.getElementById('teste').style.display      = "none"
    document.getElementById('quadra2').style.display    = "none"
    document.getElementById('lote32').style.display     = "none"

   }
}


</script>
	<!-- 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="fade page-header-fixed page-sidebar-fixed">
	
	<?php  include "topo.php"; 	?>
		<div class="sidebar-bg"></div>
		<!-- end #sidebar -->
		
		<!-- begin #content -->
		<div id="content" class="content">
			<!-- begin breadcrumb -->
		
				
			<!-- end breadcrumb -->
			<!-- begin page-header -->
		
			<!-- end page-header -->
			
			<!-- begin row -->
			<div class="row">



			    <!-- begin col-6 -->
			    <div class="col-md-12">
					
					<div class="tab-content">
						<div class="tab-pane fade active in" id="default-tab-1">



				   <div class="col-md-12">
			        <!-- begin panel -->
                    <div class="panel panel-inverse" data-sortable-id="form-plugins-11">
                        <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">Nova Ocorrência</h4>
                        </div>
                        <div class="panel-body panel-form">
                            <form class="form-horizontal form-bordered" action="cadastro_ocorrencia.php" method="POST" enctype="multipart/form-data">
                              <?php 
                              	$cadastrado_por = $_SESSION["id_usuario"];
                              ?>

                               <input type="hidden" name="cadastrado_por" value="<?php echo $cadastrado_por ?>">
                                

                                <div class="form-group">
                                    <label class="col-md-3 control-label">Destinatário</label>
                                    <div class="col-md-9">
                                  <select class="default-select2 form-control" name="cliente_idcliente" required="">
                                        <option value="">Escolha</option>
                      <?php

                      include "conexao.php";
              
 				$query_amigo = "SELECT * FROM cliente
                				INNER JOIN cliente_tipo ON cliente_tipo.idcliente = cliente.idcliente
                				WHERE idtipo = 1 or idtipo = 4 or idtipo = 5 group by cliente.idcliente order by nome_cli 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
           
             	$idcliente             = $buscar_amigo['idcliente'];
             	$nome_cli              = $buscar_amigo["nome_cli"];
              	$cpf_cli              = $buscar_amigo["cpf_cli"];
        
             
            
             ?>
                <option value="<?php echo "$idcliente" ?>"> <?php echo "$nome_cli "."CPF: "."$cpf_cli" ?> </option>
            <?php } ?>

                                           
                                        </select>

                                      
                                    </div>
                                </div>





                                  <div class="form-group">
                                    <label class="col-md-3 control-label">Para o Grupo</label>
                                    <div class="col-md-9">
                                  <select class="default-select2 form-control" name="grupo_idgrupo">
                                        <option value="">Escolha&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(opcional)</option>
                     <?php 

                include "conexao.php";
                $query_slide = mysqli_query($db,"SELECT * FROM grupo
                                                  order by titulo_grupo Asc") or die ("Erro ao listar grupo dos clientes, tente mais tarde"); 


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


             

             $idgrupo       = $buscar_slide["idgrupo"];
             $titulo_grupo  = $buscar_slide["titulo_grupo"];
           
                        

                    ?> 
                        <option value="<?php echo $idgrupo ?>"><?php echo utf8_encode($titulo_grupo) ?></option>
                                                       
                                                       <?php }

                                                        ?> 

                                           
                                        </select>

                                      
                                    </div>
                                </div>















                     <div class="form-group">
                                    <label class="col-md-3 control-label">Categoria</label>
                                    <div class="col-md-9">
                                 <select class="form-control" name="tipo_venda" id="tipo_cobranca" onchange="ShowHideDIV()">
     

      <option value="">Escolha</option>
    <option value="1">Locação</option>
      <option value="2">Empreendimento</option>
                                        </select>

                                      
                                    </div>
                                </div>


                                   <div class="form-group" id="teste" style="display:none">
                                    <label class="col-md-3 control-label">Empreendimento</label>
                                    <div class="col-md-9">
                                 <select class="form-control" name="empreendimento_id" id="os">
      <option value="">Escolha</option>

     
<?php 
             include "conexao.php";
             $query_c = "SELECT * FROM empreendimento
                                                 INNER JOIN empreendimento_cadastro ON empreendimento.empreendimento_cadastro_id = empreendimento_cadastro.idempreendimento_cadastro
                    order by idempreendimento desc";
                     $executa_queryc = mysqli_query ($db,$query_c) or die ("Erro ao listar empreendimento mesmo");
                
                
            while ($buscar_amigoc = mysqli_fetch_assoc($executa_queryc)) {//--verifica se são amigos
           
             $idempreendimento             = $buscar_amigoc['idempreendimento_cadastro'];
           $descricao                   = $buscar_amigoc['descricao_empreendimento'];
        ?>
    <option value="<?php echo $idempreendimento ?> "><?php echo $descricao ?></option>
      <?php }  ?>
                                        </select>

                                      
                                    </div>
                                </div>

                                   <div class="form-group" id="locacao" style="display:none">
                                    <label class="col-md-3 control-label">Imovel</label>
                                    <div class="col-md-9">
                                 <select class="form-control" name="imovel_id">
           <option value="">Escolha</option>

<?php 
            include "conexao.php";
            $query_c = "SELECT * FROM imovel";



            $executa_queryc = mysqli_query ($db,$query_c) or die ("Erro ao listar empreendimento mesmo");               
                
            while ($buscar_amigoc = mysqli_fetch_assoc($executa_queryc)) {//--verifica se são amigos
           
            $idimovel             = $buscar_amigoc['idimovel'];
            $endereco             = $buscar_amigoc['endereco'];
            $numero               = $buscar_amigoc['numero'];
        ?>
            <option value="<?php echo $idimovel ?> "><?php echo $endereco.", ".$numero ?></option>
      <?php }  ?>
                                        </select>

                                      
                                    </div>
                                </div>
                                  




                                   <div class="form-group" id="quadra2" style="display:none">
                                    <label class="col-md-3 control-label">Quadra</label>
                                    <div class="col-md-9">
                                   <select name="quadra_id" id="quadra" class="form-control">
                                       </select>

                                      
                                    </div>
                                </div>


 <div class="form-group" id="lote32" style="display:none">
                                    <label class="col-md-3 control-label">Lote</label>
                                    <div class="col-md-9">
                                    <select name="lote_id"  id="lote" class="form-control">
                                       </select>

                                      
                                    </div>
                                </div>



























                                 <div class="form-group">
                                    <label class="col-md-3 control-label">Titulo</label>
                                    <div class="col-md-9">
                                  <textarea class="form-control" name="titulo"></textarea>

                                      
                                    </div>
                                </div>
                          		  <div class="form-group">
                                    <label class="col-md-3 control-label">Descrição</label>
                                    <div class="col-md-9">
                                  <textarea class="form-control" name="descricao"></textarea>

                                      
                                    </div>
                                </div>

                                 <div class="form-group">
                                    <label class="col-md-3 control-label">Anexar Arquivo</label>
                                    <div class="col-md-9">
                                 <input type="file" name="img[]" multiple="">

                                      
                                    </div>
                                </div>
                               
                            
                                  <div class="form-group">
                            
                                    <div class="col-md-9">
                                       <input type="submit" class="btn btn-success m-r-5 m-b-5" value="Cadastrar" />
                                    </div>
                                </div>

                             




                              





                              






                         
                        </div>
                    </div>
                    <!-- end panel -->
                </div>




							 
						</div>




<!-- inicio da aba de parcelas -->


						<div class="tab-pane fade" id="default-tab-2">
							


						</div>
						<div class="tab-pane fade" id="default-tab-3">
							
						</div>
					</div>
					
				</div>
			    <!-- end col-6 -->
			 
			</div>
			<!-- end row -->
		</div>
		<!-- end #content -->
		
        <!-- begin theme-panel -->
     
        <!-- end theme-panel -->
		
		<!-- 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>
	<!-- end page container -->
	
	<!-- ================== 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>
	
  <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>





  <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>

  <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>

		$(document).ready(function() {
			App.init();
			TableManageButtons.init();
         FormPlugins.init();
		});
	</script>
<script type="text/javascript">
  $(document).ready( function() {
   /* Executa a requisição quando o campo CEP perder o foco */
   $('#os').click(function(){


           /* Configura a requisição AJAX */
           $.ajax({
                url : 'consultar_produto_pagar.php', /* URL que será chamada */ 
                type : 'POST', /* Tipo da requisição */ 
                data: 'os=' + $('#os').val(), /* dado que será enviado via POST */
                dataType: 'json', /* Tipo de transmissão */
                success: function(data){
var $quadra = $('#quadra');
            $quadra.empty();
                  
            $.each(data, function(idproduto, quadra){
                   $quadra.append('<option value=' + idproduto + '>' + quadra + '</option>');
            });

              $quadra.change();        
                              
    
    
                    
                       
                 
                }
           });   
   return false;    
   })
});
</script>
<script type="text/javascript">
  $(document).ready( function() {
   /* Executa a requisição quando o campo CEP perder o foco */
   $('#quadra').blur(function(){
           /* Configura a requisição AJAX */
           $.ajax({
                url : 'consultar_lote_pagar.php', /* URL que será chamada */ 
                type : 'POST', /* Tipo da requisição */ 
                data: 'quadra=' + $('#quadra').val(), /* dado que será enviado via POST */
                dataType: 'json', /* Tipo de transmissão */
                success: function(data){
                  
var $lote = $('#lote');
            $lote.empty();

                  

            $.each(data, function(idlote, lote){
                   $lote.append('<option value=' + idlote + '>' + lote + '</option>');
            });

              $lote.change();        
                              
    
    
                    
                       
                 
                }
           });   
   return false;    
   })
});
</script>
</body>


</html>
