Passar Parâmetro
Olá Bom dia!
Preciso passar um parâmetro para um modal para que os itens de uma consulta apareça e não tenho idéia de como fazer!
Será que alguem pode me ajudar?????????
<script language="Javascript" type="text/javascript">
parent.document.getElementById("klaus").height = document.getElementById("conteudo").scrollHeight + 40; //40: Margem Superior e Inferior, somadas
</script>
</script>
<script language="javascript">
function voltar(){
self.location.href = '../controle/voltar.php';
}
</script>
<?php
include("BD/ConnectDB.php");
/*
function cnpj_for ($cnpj){
$carac = array('.','/','-');
$cnpj = str_replace($carac,"",$cnpj);
return $cnpj;
}
*/
class configurar extends Conexao {
private $cnpj_de;
private $cfop_de;
private $cnpj_para;
private $cfop_para;
public function __construct() {
$this->setAtributos(null,null,null,null); }
public function setAtributos($cnpj_de,$cfop_de,$cnpj_para,$cfop_para) {
$this->Cnpj_de = $cnpj_de;
$this->Cfop_de = $cfop_de;
$this->Cnpj_para = $cnpj_para;
$this->Cfop_para = $cfop_para;
}
public function getCnpj_de(){ return $this->Cnpj_de;}
public function getCfop_de(){ return $this->Cfop_de;}
public function getCnpj_para(){ return $this->Cnpj_para;}
public function getCfop_para(){ return $this->Cfop_para;}
public function setConfiguracao($cnpj_de){
$query = new Conexao();
$EMP = $query->cnpj_for($cnpj_de);
$select = $query->consulta("SELECT COD_EMPRESA, dbo.FCT_CNPJ_MASCARA(CNPJ) as CNPJ ,NOME_EMPRESA FROM TBL_EMPRESA WHERE CNPJ = '".$EMP ."'");
$dados = $query->busca_unica($select);
$nome_pesquisa = $dados['NOME_EMPRESA'];
$s = "Select A.infNFe as infNFe,A.Chave as Chave ,A.dEmi as dEmi,substring(A.chave,26,9) as NumeroNota,B.xNome as Fornecedor,B.CNPJ as CNPJFROM VW_NFE as A, TBL_NFE_emit as B
where B.infNFe=A.infNFe
and A.cnpj='07107001000260'
and (A.dEmi BETWEEN '05-01-2011'
and '05-31-2013') and A.status='NF'
and A.TIPO_ES='E' order by A.dEmi,A.vNF";
$consul = $query->consulta($s);
$total_campos = $query->conta($consul);
$cont=0;
echo '<table cellpadding="0" cellspacing="0" border="0" class="table">';
echo '<tr>';
echo '<td width="50px"></td>';
echo '<td width="00px"><img src="http://ohmsapoio.com.br/2.0/sistema/img/topo_bt/cadastro_cfop.png" style="position:relative; top:-20px; left:-25px"/><p><p></td>';
echo '</tr>';
echo '</table>';
echo '<table id="tb1" cellpadding="0" cellspacing="0" border="0" class="table">';
echo '<tr class="header">';
echo '<th width="50px">FORNECEDOR</th >';
echo '<th width="10px"></th >';
echo '<th width="100px">CNPJ</th >';
echo '<th width="50px">NUMERO NF-e</th>';
echo '<th width="50px">CHAVE NF-e</th >';
echo '<th width="50px">DATA ENT.</th >';
echo "</tr>";
echo '<form name="FormDepara" id="FormDepara" method="post" action="../controle/gravar_config.php"';
while ($l = $query->busca($consul))
{
$cont = $cont+1;
$nomes = $l['Nome1'];
echo '<tr>';
echo '<td width="50px"><input style="background:#b7dcff;" type="text" name="cnpj_saida_'.$cont.'" id="cnpj_saida_'.$cont.'" readonly="true" size="50" maxlength="50" value='.$l['Fornecedor'].'></input></td >';
echo '<td width="10px"><input style="/* background:#b7dcff; */background-image: url(../class/modal/itens.png);/* position: relative; */width: 26px;height: 21px;" type="button" class="activate_modal" name="first_window" title="Editar Itens"<="" input=""></td >';
echo '<td width="50px"><input style="background:#b7dcff;" type="text" name="cnpj_saida_'.$cont.'" id="cnpj_saida_'.$cont.'" readonly="true" size="14" maxlength="14" value='.$l['CNPJ'].'></input></td >';
echo '<td width="50px"><input style="background:#b7dcff;" type="text" name="cnpj_saida_'.$cont.'" id="cnpj_saida_'.$cont.'" readonly="true" size="9" maxlength="9" value='.$l['NumeroNota'].'></input></td >';
echo '<td width="50px"><input style="background:#b7dcff;" type="text" name="cnpj_saida_'.$cont.'" id="cnpj_saida_'.$cont.'" readonly="true" size="44" maxlength="44" value='.$l['Chave'].'></input></td >';
echo '<td width="50px"><input style="background:#b7dcff;" type="text" name="cnpj_saida_'.$cont.'" id="cnpj_saida_'.$cont.'" readonly="true" size="10" maxlength="10" value='.$l['dEmi'].'></input></td >';
echo '</tr>';
$b = "Select A.nItem as nItem,A.cProd as CodigoProduto, A.xProd as DescricaoProduto,A.NCM as NCM,A.CFOP as CFOP,B.CFOP as NovaCFOP,B.CODINTERNO as NovoCodigo,C.CST as CST,B.CSTICMS as CSTNOVA from
([nfe_prod].dbo.TBL_NFE_prod as A
INNER JOIN [nfe_prod].dbo.TBL_NFE_ICMS as C on A.infNFe=C.infNFe and A.nItem=C.nItem)
LEFT OUTER JOIN [nfe_prod].dbo.TBL_SPED_PROD as B ON A.cProd=B.CODIGOFABRICANTE
and B.cod_cliente='0650' and B.CNPJFAB='07107001000693'
where A.infNFe='11899' order by A.nItem
";
$consul1 = $query->consulta($b);
while ($c = $query->busca($consul1))
{
echo '<div id="first_window" class="modal_window" >';
echo '<input style="background:#b7dcff;" type="text" name="cnpj_saida_'.$cont.'" id="cnpj_saida_'.$cont.'" readonly="true" size="3" maxlength="3" value='.$c['nItem'].'></input>';
echo '<input style="background:#b7dcff;" type="text" name="cnpj_saida_'.$cont.'" id="cnpj_saida_'.$cont.'" readonly="true" size="20" maxlength="20" value='.$c['CodigoProduto'].'></input>';
echo '<input style="background:#b7dcff;" type="text" name="cnpj_saida_'.$cont.'" id="cnpj_saida_'.$cont.'" readonly="true" size="50" maxlength="50" value='.$c['DescricaoProduto'].'></input>';
echo '<input style="background:#b7dcff;" type="text" name="cnpj_saida_'.$cont.'" id="cnpj_saida_'.$cont.'" readonly="true" size="8" maxlength="8" value='.$c['NCM'].'></input>';
echo '<input style="background:#b7dcff;" type="text" name="cnpj_saida_'.$cont.'" id="cnpj_saida_'.$cont.'" readonly="true" size="4" maxlength="4" value='.$c['CFOP'].'></input>';
echo '<input style="background:#b7dcff;" type="text" name="cnpj_saida_'.$cont.'" id="cnpj_saida_'.$cont.'" readonly="true" size="3" maxlength="3" value='.$c['CST'].'></input>';
echo '<input type="text" style="background:#FFFFFF;" name="cfop_para_'.$cont.'" id="cfop_para_'.$cont.'" size="5" maxlength="4" value='.$c['NovaCFOP'].'></input></td >';
echo '<input type="text" style="background:#FFFFFF;" name="cfop_para_'.$cont.'" id="cfop_para_'.$cont.'" size="5" maxlength="4" value='.$c['NovoCodigo'].'></input></td >';
echo '<input type="text" style="background:#FFFFFF;" name="cfop_para_'.$cont.'" id="cfop_para_'.$cont.'" size="5" maxlength="4" value='.$c['CSTNOVA'].'></input></td >';
echo '</div>';
}
}
echo '</table>';
// <img src="http://ohmsapoio.com.br/2.0/sistema/img/topo_bt/cadastro_cfop.png" style="position:relative; top:0px; left:-25px">
echo '<input type="hidden" name="cont" id="cont" size="5" maxlength="4" value='.$cont.'></input>';
echo '<input type="hidden" name="cnpj_pesquisa" id="cnpj_pesquisa" value='.$EMP.'></input>';
// echo '<input type="image" src="http://ohmsapoio.com.br/2.0/sistema/img/topo_bt/gravar.png" style="position: relative; left: 324px; top:0px; border: 0px;" value="Gravar" name="Gravar"></input>';
echo '<input type="hidden" name="paginacao" id="paginacao" value="'.$total_campos.'" />' ;
echo '</form>';
?>
<div id="green" style="margin: auto">
<?php
}
}
?>
<script type="text/javascript">
$(document).ready(function(){
//get the height and width of the page
var window_width = $(window).width();
var window_height = $(window).height();
//vertical and horizontal centering of modal window(s)
/*we will use each function so if we have more then 1
modal window we center them all*/
$('.modal_window').each(function(){
//get the height and width of the modal
var modal_height = $(this).outerHeight();
var modal_width = $(this).outerWidth();
//calculate top and left offset needed for centering
var top = (window_height-modal_height)/2;
var left = (window_width-modal_width)/2;
//apply new top and left css values
$(this).css({'top' : top , 'left' : left});
});
$('.activate_modal').click(function(){
//get the id of the modal window stored in the name of the activating element
var modal_id = $(this).attr('name');
//use the function to show it
show_modal(modal_id);
});
$('.close_modal').click(function(){
//use the function to close it
close_modal();
});
});
//THE FUNCTIONS
function close_modal(){
//hide the mask
$('#mask').fadeOut(500);
//hide modal window(s)
$('.modal_window').fadeOut(500);
}
function show_modal(modal_id){
//set display to block and opacity to 0 so we can use fadeTo
$('#mask').css({ 'display' : 'block', opacity : 0});
//fade in the mask to opacity 0.8
$('#mask').fadeTo(500,0.9);
//show the modal window
$('#'+modal_id).fadeIn(500);
}
</script>
<link rel="stylesheet" href="[http://ohmsapoio.com.br/sistema/class/modal/estilo.css](http://ohmsapoio.com.br/sistema/class/modal/estilo.css)" type="text/css"/>
<div id='mask' class='close_modal'></div>
<script type="text/javascript">
$(document).ready(function(){
//get the height and width of the page
var window_width = $(window).width();
var window_height = $(window).height();
//vertical and horizontal centering of modal window(s)
/*we will use each function so if we have more then 1
modal window we center them all*/
$('.modal_window').each(function(){
//get the height and width of the modal
var modal_height = $(this).outerHeight();
var modal_width = $(this).outerWidth();
//calculate top and left offset needed for centering
var top = (window_height-modal_height)/2;
var left = (window_width-modal_width)/2;
//apply new top and left css values
$(this).css({'top' : top , 'left' : left});
});
$('.activate_modal').click(function(){
//get the id of the modal window stored in the name of the activating element
var modal_id = $(this).attr('name');
//use the function to show it
show_modal(modal_id);
});
$('.close_modal').click(function(){
//use the function to close it
close_modal();
});
});
//THE FUNCTIONS
function close_modal(){
//hide the mask
$('#mask').fadeOut(500);
//hide modal window(s)
$('.modal_window').fadeOut(500);
}
function show_modal(modal_id){
//set display to block and opacity to 0 so we can use fadeTo
$('#mask').css({ 'display' : 'block', opacity : 0});
//fade in the mask to opacity 0.8
$('#mask').fadeTo(500,0.9);
//show the modal window
$('#'+modal_id).fadeIn(500);
}
</script>Estas são as linhas dos itens que preciso passar!
echo '<div id="first_window" class="modal_window" >';
echo '<input style="background:#b7dcff;" type="text" name="cnpj_saida_'.$cont.'" id="cnpj_saida_'.$cont.'" readonly="true" size="3" maxlength="3" value='.$c['nItem'].'></input>';
echo '<input style="background:#b7dcff;" type="text" name="cnpj_saida_'.$cont.'" id="cnpj_saida_'.$cont.'" readonly="true" size="20" maxlength="20" value='.$c['CodigoProduto'].'></input>';
echo '<input style="background:#b7dcff;" type="text" name="cnpj_saida_'.$cont.'" id="cnpj_saida_'.$cont.'" readonly="true" size="50" maxlength="50" value='.$c['DescricaoProduto'].'></input>';
echo '<input style="background:#b7dcff;" type="text" name="cnpj_saida_'.$cont.'" id="cnpj_saida_'.$cont.'" readonly="true" size="8" maxlength="8" value='.$c['NCM'].'></input>';
echo '<input style="background:#b7dcff;" type="text" name="cnpj_saida_'.$cont.'" id="cnpj_saida_'.$cont.'" readonly="true" size="4" maxlength="4" value='.$c['CFOP'].'></input>';
echo '<input style="background:#b7dcff;" type="text" name="cnpj_saida_'.$cont.'" id="cnpj_saida_'.$cont.'" readonly="true" size="3" maxlength="3" value='.$c['CST'].'></input>';
echo '<input type="text" style="background:#FFFFFF;" name="cfop_para_'.$cont.'" id="cfop_para_'.$cont.'" size="5" maxlength="4" value='.$c['NovaCFOP'].'></input></td >';
echo '<input type="text" style="background:#FFFFFF;" name="cfop_para_'.$cont.'" id="cfop_para_'.$cont.'" size="5" maxlength="4" value='.$c['NovoCodigo'].'></input></td >';
echo '<input type="text" style="background:#FFFFFF;" name="cfop_para_'.$cont.'" id="cfop_para_'.$cont.'" size="5" maxlength="4" value='.$c['CSTNOVA'].'></input></td >';
echo '</div>';
}Discussão (2)
Carregando comentários...