Viewing file: historicoRegistroBoletosWS.php (11.1 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
require_once "../../incCaminho.php";
$CaminhoConexao = "../{$CaminhoConexao}";
require_once "{$CaminhoConexao}/inc_Conexao.php";
require_once("{$_SERVER['DOCUMENT_ROOT']}/incValidaSessao.php");
require_once "{$CaminhoConexao}/inc_Funcoes.php";
$linkECert = $conecta;
require_once('includes/inc_dadosCombo.php');
$CaminhoImagens = "../{$CaminhoImagens}";
$nomePag = 'menu1';
if (count($_GET) > 0) {
//debug($_GET);
//$form['tipo'] = (int) $_GET['selTipo'];
$form['modalidade'] = (int) $_GET['selModalidade'];
$form['situacao'] = $_GET['selSituacao'];
$form['pedido'] = (int) $_GET['txtPedido'];
$form['boleto'] = trim($_GET['txtBoleto']);
$form['data'] = (int) $_GET['radData'];
$form['dataInicial']= trim($_GET['txtDataInicial']);
$form['dataFinal'] = trim($_GET['txtDataFinal']);
$form['confirma'] = $_GET['btnConfirma'];
//debug($form); //exit;
}
//if ($form['tipo'] == 0 ) $form['tipo'] = 1;
if ($form['data'] == 0 ) $form['data'] = 1;
if ($form['confirma'] == '') $form['confirma'] = 'Pesquisar';
if (!isset($form['modalidade'])) $form['modalidade'] = -1;
//debug($form);
$inputWidth = '260px';
//$comboTipo = htmlSelect($dadosTipo, 'selTipo', 'selTipo', '', $form['tipo'], "style=\"min-width:{$inputWidth}\"");
$comboModalidade = htmlSelect($dadosModalidade, 'selModalidade', 'selModalidade', '', $form['modalidade'], "style=\"min-width:{$inputWidth}\"", false);
$comboSituacao = htmlSelect($dadosSituacao, 'selSituacao', 'selSituacao', '', $form['situacao'], "style=\"min-width:{$inputWidth}\"", true, 'Todos');
?>
<!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> E-CERTIDÕES ON-LINE </title>
<link href="../<?= $caminhoCss?>/estilo_site.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../js/jquery-1.3.2.js"></script>
<script language="javascript" src="../../js/nm_digita.js"></script>
<style type="text/css">
.listagem {
width:95%;
}
.topoListagem .tituloListagem {
text-transform:uppercase;
width:100%;
}
.nenhumRegistro {
background-position:280px 40px;
text-indent:200px;
}
</style>
<style type="text/css" media="print">
#menuGestor {
display:none;
}
#topo {
display:none;
}
#rodape2 {
display:none;
}
.noPrint {
display:none;
}
</style>
<link rel="stylesheet" type="text/css" href="includes/css.css"/>
</head>
<body>
<div id="geral">
<?php
$caminhoIncSite = "../{$caminhoIncSite}";
$nivel = "../../";
include "{$caminhoIncSite}/inc_topo.php";
?>
<div id="corpo">
<p> </p>
<div class="listagem">
<div class="topoListagem">
<div class="tituloListagem noPrint">RELAÇÃO DE REGISTROS DE BOLETOS</div>
<div class="opcoes noPrint"> </div>
</div>
<br/><br/><br/>
<form name="frmPesquisa" id="frmPesquisa" >
<!--table class="filtro" border="1"><tr><td>
<table -->
<table width="95%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<th colspan="4" width="100%" >Pesquisa de Registro de Boletos</th>
</tr>
<tr>
<td width="25%"></td>
<td width="20%"></td>
<td width="30%"></td>
<td width="25%"></td>
</tr>
<tr>
<td></td>
<td align="right"><label for="selModalidade">Modalidade: </label></td>
<td><?= $comboModalidade; ?></td>
<td></td>
</tr>
<tr>
<td></td>
<td align="right"><label for="selModalidade">Situação: </label></td>
<td><?= $comboSituacao; ?></td>
<td></td>
</tr>
<tr>
<td></td>
<td align="right"><label for="txtPedido">Pedido: </label></td>
<td><input name="txtPedido" id="txtPedido" style="size=10 width:<?= $inputWidth; ?>" value="<?= $form['pedido']==0 ? '' : $form['pedido']; ?>" /></td>
<td></td>
</tr>
<tr>
<td></td>
<td align="right"><label for="txtBoleto">Nosso Número / Boleto: </label></td>
<td><input name="txtBoleto" id="txtBoleto" style="size=10 width:<?= $inputWidth; ?>" value="<?= $form['boleto']; ?>" /></td>
<td></td>
</tr>
<tr>
<td colspan="4"><br/></td>
</tr>
<tr>
<td></td>
<td colspan="2" style="padding-left:15em" >
<input type="radio" name="radData" id="radUltSemana" value="1" <?= $form['data']==1 ? 'checked="checked"' : '' ; ?> /><label for="radUltSemana">Emitidos hoje ou na Última Semana</label><br>
<input type="radio" name="radData" id="radMesAtual" value="2" <?= $form['data']==2 ? 'checked="checked"' : '' ; ?> /><label for="radMesAtual">Vencidos no Mes Atual</label><br>
<input type="radio" name="radData" id="radMesAnterior" value="3" <?= $form['data']==3 ? 'checked="checked"' : '' ; ?> /><label for="radMesAnterior">Vencidos no Mes Anterior</label><br>
<input type="radio" name="radData" id="radDe" value="4" <?= $form['data']==4 ? 'checked="checked"' : '' ; ?> /><label for="radDe">Vencidos De:
<input name="txtDataInicial" size="8" onfocus="document.getElementById('radDe').checked='checked';NM_onfocus(this.form.name, this.name, 'Data', 'dd/mm/aaaa' )" value="<?= $form['dataInicial']; ?>" /> até
<input name="txtDataFinal" size="8" onfocus="document.getElementById('radDe').checked='checked';NM_onfocus(this.form.name, this.name, 'Data', 'dd/mm/aaaa' )" value="<?= $form['dataFinal']; ?>" /></label>
<br>
</td>
<td></td>
</tr>
<tr>
<td colspan="4"> </td>
</tr>
<tr>
<td colspan="4" align="center"><input class="botaoPadrao2" type="submit" name="btnConfirma" id="btnConfirma" value="Pesquisar"></td>
</tr>
</table>
<p> </p>
</form>
<?php
if ($form['confirma']=='Pesquisar') {
// listagem
$arrWhere = array();
$arrWhere[] = "PED_AtivoSN = 'S' ";
$arrWhere[] = "BOL_Valor > 0 ";
$arrWhere[] = "PED_TipoSolicitante_DR <> 1"; // 29-11-2017
if ($form['modalidade'] != -1) {
$arrWhere[] = " CCW_Grupo = '{$form['modalidade']}' ";
}
if ($form['situacao'] != '') {
$arrWhere[] = " PED_PagoSN = '{$form['situacao']}' ";
}
if ($form['boleto'] != '') {
$arrWhere[] = " PED_NossoNumeroWS = '{$form['boleto']}' ";
}
if ($form['pedido'] != 0 ) {
$arrWhere[] = " PED_RowID = '{$form['pedido']}' ";
// se um pedido por informdo, ignora o filtro de data
} else {
if ($form['data'] == 1) { // Última Semana
$ultSemana = date('Y-m-d H:i:s', mktime(0, 0, 0, date('n'), date('d')-5, date('Y')));
$hoje = date('Y-m-d H:i:s', mktime(23, 59, 59, date('n'), date('d'), date('Y')));
$arrWhere[] = " PED_DataHora between '{$ultSemana}' and '{$hoje}' ";
} elseif ($form['data'] == 2) { // Mes Atual
$mesAtual = date('Y-m', mktime(0, 0, 0, date('n'), 1, date('Y')));
$arrWhere[] = " left(BOL_DataVencimento, 7) = '{$mesAtual}' ";
} elseif ($form['data'] == 3) { // Mes anterior
$mesAnterior = date('Y-m', mktime(0, 0, 0, date('n')-1, 1, date('Y')));
$arrWhere[] = " left(BOL_DataVencimento, 7) = '{$mesAnterior}' ";
} elseif ($form['data'] == 4 && $form['dataInicial'] != '' && $form['dataFinal'] != '') { // de até
// format_data parou de funcionar :-/ está confundindo mes e dia
$data1 = inverte_data($form['dataInicial'],'/','-');
$data2 = inverte_data($form['dataFinal'],'/','-');
$arrWhere[] = " BOL_DataVencimento between '{$data1} 00:00:00' and '{$data2} 23:59:59' ";
}
}
if (count($arrWhere) > 0) {
$strWhere = 'where '. implode("\n\t\t\t and ", $arrWhere);
} else {
$strWhere = '';
}
//ECE_RegistroSolicitacaoComunicacaoWS ?
$sql = "
select PED_RowID as pedido, PED_NossoNumeroWS as nossoNumero, DAS_Nome as nome, DAS_Cidade as localidade,
concat(DAS_DDDf, ' ', DAS_Telefone) as fone, CCW_Grupo as codModalidade, CCW_DescricaoGrupo as modalidade,
BOL_DataVencimento as dataVencimento, BOL_DataPagamento as dataPagamento, PED_PagoSN as pago, BOL_Valor as valorBoleto
from CER_Pedidos
inner join ECE_RegistroConfiguracaoComunicacaoWS on CCW_RowID = PED_RegistroConfiguracaoComunicacaoWS_DR
inner join CER_Boletos on BOL_RowID = PED_Boleto_DR
inner join CER_DadosSolicitante on DAS_RowID = PED_Solicitante_DR
{$strWhere}
order by PED_RowID desc
";
//debug($sql);
$result = executa($sql, $linkECert);
echo "
<table width=\"95%\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"0\">
<tr>
<th>#</th>
<th>Pedido</th>
<th>Nosso Número</th>
<th>Solicitante</th>
<th>Valor</th>
<th>Data de Pagamento</th>
<th>Situação</th>
<th>Modalidade</th>
<th>Detalhar</th>
</tr>";
if (!empty($result)) {
foreach ($result as $key => $res) {
$tr_color = '';
if ($key % 2 == 0) {
$tr_color = '#FFF';
} else {
$tr_color = '#EEE';
}
if ($res['codModalidade']==5) {
$tr_color = 'red';
}
$td_style_sit = '';
switch ($res['pago']) {
case 'S':
$td_style_sit = 'style="color:navy;font-weight:bold;"';
break;
case 'N':
$td_style_sit = 'style="color:#900;font-weight:bold;"';
break;
}
$linkDetalhar = "detalharRegistroBoleto.php?pedido={$res['pedido']}";
$click = "window.open('{$linkDetalhar}','page','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=900,height=600');";
$res['dataPagamento'] = ($res['dataPagamento'] == '0000-00-00' ? '' : format_data($res['dataPagamento']));
$res['valorBoleto'] = format_moeda($res['valorBoleto']);
$num = $key+1;
echo "
<tr style=\"background-color:{$tr_color}\">
<td class=\"bordaLateralTD\" align=\"center\">{$num}</td>
<td class=\"bordaLateralTD\" align=\"center\">{$res['pedido']}</td>
<td class=\"bordaLateralTD\" align=\"center\">{$res['nossoNumero']}</td>
<td class=\"bordaLateralTD\">
<strong>Nome</strong>: {$res['nome']}<br>
<strong>Localidade</strong>: {$res['localidade']}<br>
<strong>Telefone</strong>: {$res['fone']}
</td>
<td class=\"bordaLateralTD\" align=\"right\">{$res['valorBoleto']}</td>
<td class=\"bordaLateralTD\" align=\"center\">{$res['dataPagamento']}</td>
<td class=\"bordaLateralTD\" {$td_style_sit} >{$dadosSituacao[$res['pago']]}</td>
<td class=\"bordaLateralTD\" >{$res['modalidade']}</td>
<td align=\"center\" class=\"noPrint\" ><input type=\"button\" name=\"btnVer\" value=\"VER\"
onclick=\"{$click}\" class=\"botaoVer noPrint\" />
</td>
</tr>
";
}
} else {
echo '<tr><td colspan="9"><div class="nenhumRegistro">NENHUM REGISTRO LOCALIZADO</div></td></tr>';
}
echo '</table>';
}
echo '<br><br>';
//require_once('/var/www/vhosts/funarpen.com.br/httpdocs-funarpbr/dump/populaWS/includes/inc_rodape.php');
?>
</div> <!-- listagem -->
</div> <!-- corpo -->
</div> <!-- geral -->
</body>
</html>
|