<?php
//criar a conexão com o banco
include "sql.php";

if(isset($_POST['done'])){
    
    $hora = $_POST['hora'];
	$data_pagamento = $_POST['data_pagamento'];
    $data_vencimento = $_POST['data_vencimento'];
    $prazo = $_POST['prazo'];
	$tipo = $_POST['tipo'];
	$valor = $_POST['valor'];
	$codigo = $_POST['codigo'];
	$nome = $_POST['nome'];
    $telefone = $_POST['telefone'];
	$lucro = $_POST['lucro'];
	$soma = $_POST['soma'];
	$status = $_POST['status'];
	


    
    if(empty($tipo) || empty($data_vencimento) || empty($valor) || empty($codigo)){
        $erro = "erro escolha qual bamdeira dejesa paga..";
    }else{        
       $sql = mysql_query("INSERT INTO `agenda`(`hora`, `data_pagamento`, `data_vencimento`, `prazo`, `tipo`, `valor`, `codigo`, `nome`, `telefone`, `lucro`, soma, status) VALUES ('$hora', '$data_pagamento', '$data_vencimento', '$prazo', '$tipo', '$valor', '$codigo', '$nome', '$telefone', '$lucro', '$soma', '$status')") or die(mysql_error());
            if($sql){
                $erro = "O PAGAMENTO FOI SOLICITADO COM SUSSESO!";
              } else{
                  $erro = "Não foi possivel PAGA";
              }
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<script type="text/javascript" language="javascript">
function mascaraData( campo, e )
{
	var kC = (document.all) ? event.keyCode : e.keyCode;
	var data = campo.value;
	
	if( kC!=8 && kC!=46 )
	{
		if( data.length==2 )
		{
			campo.value = data += '/';
		}
		else if( data.length==5 )
		{
			campo.value = data += '/';
		}
		else
			campo.value = data;
	}
}
</script>
<script language="JavaScript">
/**
* Abre popup centralizado.
* url - local da página pra exibição no popup
* w - width largura do popup
* h - height  altura do poup
*/
function abrirPopup(url,w,h) {
var newW = w + 100;
var newH = h + 100;
var left = (screen.width-newW)/2;
var top = (screen.height-newH)/2;
var newwindow = window.open(url, 'name', 'width='+newW+',height='+newH+',left='+left+',top='+top);
newwindow.resizeTo(newW, newH);
 
//posiciona o popup no centro da tela
newwindow.moveTo(left, top);
newwindow.focus();
return false;
}
</script>
    <style type="text/css">
<!--
body{
	margin: 20px 0;
	font-family: Arial,sans-serif;
	font-size: 12px;
}
label{
	display:block;
	margin-top:0px;
}
input{
	display:block;
	height:40px;
	border:1px solid #e5e5e5;
	padding:10px;
	margin-top: 5px;
	width: 70%;
}
.container{
	width: 600px;
	margin:0 auto;
}
.g-recaptcha{
	margin-top:0px;
}
.send{
	background: #46ac00;
	color: #fff;
	border: 0px;
}
    .container1 {	width: 960px;
	margin:0 auto;
}
    </style>
<style type="text/css">
body {
    padding: 25px;
}

.payment-methods {
  list-style: none;
  margin: 0;
  padding: 0;
}

.payment-methods:after {
  content: "";
  clear: both;
}

.payment-method {
  border: 1px solid #ccc;
  box-sizing: border-box;
  float: left;
  height: 70px;
  position: relative;
  width: 120px;
}

.payment-method label {
	background: #fff no-repeat center center;
	bottom: 1px;
	cursor: pointer;
	display: block;
	font-size: 0;
	left: 1px;
	position: absolute;
	right: 1px;
	text-indent: 100%;
	top: 0px;
	white-space: nowrap;
}

.payment-method + .payment-method {
  margin-left: 25px;
}

.claro label {
  background-image: url(5.png);
}

.vivo label {
  background-image: url(4.png);
}


.oi label{
  background-image: url(7.png);
}

.detran label {
  background-image: url(2.png);
}

.tim label {
  background-image: url(8.png);
}


.boletos label {
  background-image: url(9.png);
  
}


.enel label {
  background-image: url(10.png);
}

.saneago label {
  background-image: url(3.png);
}

.caixa label {
  background-image: url(1.png);
}

.payment-methods input:focus + label {
  outline: 2px dotted #21b4d0;
}

.payment-methods input:checked + label {
  outline: 4px solid #21b4d0;
}

.payment-methods input:checked + label:after {
  background: url(https://dl.dropbox.com/s/vm6hpxjqbupy1xv/checked.png);
  bottom: -10px;
  content: "";
  display: inline-block;
  height: 20px;
  position: absolute;
  right: -10px;
  width: 20px;
}

@-moz-document url-prefix() {
  .payment-methods input:checked + label:after {
    bottom: 0;
    right: 0;
    background-color: #21b4d0;
  }
}
  </style>




 <script >
 
 
function moeda(z){
v = z.value;
v=v.replace(/\D/g,"") //permite digitar apenas números
v=v.replace(/[0-9]{12}/,"inválido") //limita pra máximo 999.999.999,99
v=v.replace(/(\d{1})(\d{8})$/,"$1.$2") //coloca ponto antes dos últimos 8 digitos
v=v.replace(/(\d{1})(\d{1,2})$/,"$1.$2") //coloca ponto antes dos últimos 5 digitos
//v=v.replace(/(\d{1})(\d{1,2})$/,"$1,$2") //coloca virgula antes dos últimos 2 digitos
z.value = v;
}
</script>
 <script >
 
function mascara(o,f){
    v_obj=o
    v_fun=f
    setTimeout("execmascara()",1)
}
function execmascara(){
    v_obj.value=v_fun(v_obj.value)
}
function mdata(v){
    v=v.replace(/\D/g,"");
    v=v.replace(/(\d{2})(\d)/,"$1/$2");
    v=v.replace(/(\d{2})(\d)/,"$1/$2");

    v=v.replace(/(\d{2})(\d{2})$/,"$1$2");
    return v;
}

</script>


</head>
<body topmargin="0">

	<h1 align="center">
			  <?php
if(isset($erro)){
    print '<div style="width:80%; background:#009900; color:#fff; padding: 5px 0px 5px 0px; text-align:center; margin: 0 auto;">'.$erro.'</div>';
}
?>
		
             </td>
              
              </h1>
	<table width="750" border="0" align="center">
	  <tr>
	    <td><form action="pagar.php" method="POST" name="form1" class="font-17" style="padding-top:40px;" >
  <ul class="payment-methods">
  <table width="750" border="1">
  <tr>
	    <td colspan="3" rowspan="10">
				<label>
			  <table width="100%" border="0">
                  <tr>
                    <td width="75%">&nbsp;</td>
                    <td width="25%" bgcolor="#FF6600"> <h2><a href="#" class="g-recaptcha" onclick="return abrirPopup('http://cie-go.com/caixa/contas.php', 900, 900)"><strong>COMPROVANTES</strong></a></h2></td>
                  </tr>
              </table>
	          <div align="center"><span class="style23"><span class="style24">
			    <input name="data_pagamento" type="hidden" id="data_pagamento" value="<?php echo date('d/m/Y'); ?>" />
			    <input name="lucro" type="hidden" id="lucro" value="2.00" />
		      <input name="prazo" type="hidden" id="prazo" value="O prazo para a conta constar como paga no sistema pode levar algumas horas, ou ate 3 dias uteis. Caso receba algum SMS de cobrança neste periodo, favor desconsiderar." />
			    </span></span>
			    <table width="90%" border="0">
                    <tr>
                      <td colspan="4">&nbsp;</td>
                      <td width="84%" class="font-18">Codigo de Barras da Fatura : </td>
                    </tr>
                    <tr>
                      <td width="8%"><a href="http://zxing.appspot.com/scan?ret=http://cie-go.com/contas/pagar.php?codigo={CODE}"><img src="http://cie-go.com/contas/IMGBTN/icon.png" width="60" height="60" border="0"></a></td>
                      <td colspan="4"><input name=codigo type=text class="breadcrumb-bg-white" id="codigo" value="<?= $_GET['codigo'] ?>" size=100 />
                     
            (<a href="http://zxing.appspot.com/scan?ret=http://cie-go.com/contas/pagar.php?codigo={CODE}">Leitor</a>):</td>
                    </tr>
                </table>
		      </div>
			  </label>
				<label>
				<div align="center">
				  <table width="90%" border="0">
                    <tr>
                      <td width="9%">&nbsp;</td>
                      <td width="11%">&nbsp;</td>
                      <td width="80%" class="font-18">Vencimento da Fatura: </td>
                    </tr>
                    <tr>
                      <td class="font-18"><img src="http://cie-go.com/contas/IMGBTN/download.jpg" width="60" height="60"></td>
                      <td colspan="2"><input name="data_vencimento"   onkeyup="mascara(this, mdata);" class="breadcrumb-bg-white" id="bday" /></td>
                    </tr>
                  </table>
			  </div>
			  </label>
				<label>
				<div align="center">
				  <table width="90%" border="0">
              <tr>
                      <td width="9%">&nbsp;</td>
                      <td width="11%">&nbsp;</td>
                  <?php
// DEFINE O FUSO HORARIO COMO O HORARIO DE BRASILIA
    date_default_timezone_set('America/Sao_Paulo');
// CRIA UMA VARIAVEL E ARMAZENA A HORA ATUAL DO FUSO-HORÀRIO DEFINIDO (BRASÍLIA)
    $dataLocal = date('d-m-Y H:i:s', time());
 
  // resultado: 29/06/2018 às 08:02:00
?>


                     
                      <input name="hora" type="hidden" class="breadcrumb-bg-white" id="hora" value="<?php echo date('H:i ');?>" size="10" />
       <input name="soma" type="hidden" class="breadcrumb-bg-white" id="soma" value="1" size="10" />
			 
             <input name="status" type="hidden" class="breadcrumb-bg-white" id="status" value="1" size="10" />
			                
                      
			  </div>
			  </label>
				<label>
				<div align="center">
				  <table width="90%" border="0">
                      <tr>
                        <td width="9%">&nbsp;</td>
                        <td width="12%">&nbsp;</td>
                        <td width="79%" class="font-18">Valor da fatura: </td>
                    </tr>
                      <tr>
                        <td width="9%" class="font-18"><img src="http://cie-go.com/contas/IMGBTN/639365.png" width="60" height="60"></td>
                        <td colspan="2"><input name=valor type=text class="breadcrumb-bg-white" id="valor" size=30 onKeyUp="moeda(this);"/></td>
                      </tr>
                  </table>
		      </div>
			  <div align="center">
			    <table width="90%" border="0">
                      <tr>
                        <td width="9%">&nbsp;</td>
                        <td width="12%">&nbsp;</td>
                        <td width="79%" class="font-18">Nome do cliente : </td>
                  </tr>
                      <tr>
                        <td width="9%" class="font-18"><img src="http://cie-go.com/contas/IMGBTN/f76048d6347a66848ee065770591089f--cone-de-usu-rio-magnifier-by-vexels.png" width="60" height="60"></td>
                        <td colspan="2"><input name=nome type=text class="breadcrumb-bg-white" id="nome" size=30 /></td>
                      </tr>
                </table>
		      </div>
		    <div align="center">
			    <table width="90%" border="0">
                      <tr>
                        <td width="9%">&nbsp;</td>
                        <td width="12%">&nbsp;</td>
                        <td width="79%" class="font-18">Telefone: </td>
                  </tr>
                      <tr>
                        <td width="9%" class="font-18"><img src="http://cie-go.com/contas/IMGBTN/3923ff4aa765e79ebb7ea28156f62f76-icono-de-ronda-m-vil-by-vexels.png" width="60" height="60"></td>
                        <td colspan="2"><input name=telefone type=text class="breadcrumb-bg-white" id="telefone" size=30 /></td>
                      </tr>
                </table>
		      </div>
			  </label>
				
				<div align="center">
				  <!-- Div do ReCaptcha foi adicionado no final do formulário -->
			  </div>
				
		
			<span class="container1">		    </span></div>
                  
              <table width="100%" border="0">
                <tr>
                  <td><div align="center" class="font-17">
                    <input name="submit" type="submit" class="send" value="CONFIRMA PAGAMENTO" />
                  </div></td>
                </tr>
              </table>
              <p align="center">&nbsp;</p>
 
    <table width="100%" border="1">
    <tr>
      
    </tr>
  </table>
  <table width="0" border="0" align="center" cellpadding="0" cellspacing="0">
</table>
 <div align="center"><span class="style23"></span>
 <input type="hidden" name="done" value="" />
</form></td>
	    <td> <li class="payment-method detran">
	      <input name="tipo" type="radio" value="DETRAN" id="detran">
	      <label for="detran">dentran</label>
        </li></td>
      </tr>
	  <tr>
	    <td> <li class="payment-method vivo">
	      <input name="tipo" type="radio" value="VIVO" id="vivo">
	      <label for="vivo">vivo</label>
        </li></td>
      </tr>
	  <tr>
	    <td> <li class="payment-method claro">
	      <input name="tipo" type="radio" value="CLARO" id="claro">
	      <label for="claro">claro</label>
        </li></td>
      </tr>
	  <tr>
	    <td>  <li class="payment-method oi">
	      <input name="tipo" type="radio" value="OI"  id="oi">
	      <label for="oi">oi</label>
        </li></td>
      </tr>
	  <tr>
	    <td>  <li class="payment-method tim">
	      <input name="tipo" type="radio" value="TIM"  id="tim">
	      <label for="tim">tim</label>
        </li></td>
      </tr>
	  <tr>
	    <td>  <li class="payment-method boletos">
	      <input name="tipo" type="radio" value="BOLETOS"  id="boletos">
	      <label for="boletos">Boletos</label>
        </li></td>
      </tr>
	  <tr>
	    <td><li class="payment-method enel">
	      <input name="tipo" type="radio" value="ENEL" id="enel">
	      <label for="enel">Enel</label>
	      </li>
        </td>
      </tr>
	  <tr>
	    <td>  <li class="payment-method saneago">
	      <input name="tipo" type="radio" value="SANEAGO"  id="saneago">
	      <label for="saneago">Saneago</label>
        </li></td>
      </tr>
	  <tr>
	    <td>  <li class="payment-method caixa">
	      <input name="tipo" type="radio" value="CAIXA" id="caixa">
	      <label for="caixa">Habitação</label>
        </li></td>
      </tr>
</table>
	</ul>		
<div align="right"></div></td>
      </tr>
</table>

            
			
</body>
</html>
