<?php
session_start();
if(isset($_SESSION['Nome']))
$_SESSION['Nome'] = "000";
else
$_SESSION['Nome'] = "No ID";
//o título h1, h2 ou equivalente
$designacao="Lista de faltas";
//este ficheiro
$ficheiro="bo_2_colab_vendas_1_720_dias";
//activação de filtro
$ficheiro_filtro_activo=0;
//ficheiro de filtragem caso exista
$ficheiro_filtro=$ficheiro."_filtro";
//o nome da var de sessão que possui a query SQL
$sessao_filtro=$ficheiro_filtro;
//ficheiro alvo do post relativo à option presente no grid
$ficheiro_alvo_post_get="";
//ficheiro para criação de registo
$ficheiro_criar="";
//ficheiro para edição de registo
$ficheiro_editar="";
//ficheiro para eliminação de registo
$ficheiro_eliminar="";
//ficheiro para acesso à área privada do registo
$ficheiro_area_privada="";
$texto_legenda_area_privada="";
$tooltip_legenda_area_privada="";
//qt de colunas mas não contando com a referente a operações e a referente a selecção
$qt_colunas=7;
$contagem_colunas=0;
$header_col[1]="Data.";
$header_col[2]="Nome";
$header_col[3]="Valor Bruto";
$header_col[4]="Valor líquido";
$header_col[5]="Crédito";
$header_col[6]="Id CB";
$header_col[7]="Telemóvel";
$header_col[8]="GGG";
$header_col[9]="HHH";
$header_col[10]="III";
$header_col[11]="Selecção";
$header_col[12]="Acção";
//campos a mostrar nas colunas
$campo[1]="data";
$campo[2]="nome";
$campo[3]="v_bruto";
$campo[4]="v_liquido";
$campo[5]="v_credito";
$campo[6]="id";
$campo[7]="estado_pago";
$campo[8]="id";
$campo[9]="id";
$campo[10]="id";
$alinhar_celula[1]="center";
$alinhar_celula[2]="left";
$alinhar_celula[3]="center";
$alinhar_celula[4]="center";
$alinhar_celula[5]="center";
$alinhar_celula[6]="center";
$alinhar_celula[7]="center";
$alinhar_celula[8]="center";
$alinhar_celula[9]="center";
$alinhar_celula[10]="center";
$alinhar_celula[11]="center";
$alinhar_celula[12]="right";
$width_celula[1]=100;
$width_celula[2]=360;
$width_celula[3]=100;
$width_celula[4]=100;
$width_celula[5]=100;
$width_celula[6]=70;
$width_celula[7]=70;
$width_celula[8]=100;
$width_celula[9]=100;
$width_celula[10]=100;
$width_celula[11]=90;
$width_celula[12]=90;
$campos_concatenados="";
$j=0;
$borda_tabela=0;
?>
<!-- ---------------------------------------- CONTAINER HEADER HTML ---------------------------------------- -->
<?php include('bo_1_init_html_header.php');?>
<!-- ---------------------------------------- INCLUDES INITS ---------------------------------------- -->
<?php
$d=dirname(__FILE__);
/*$path = '/i/_func';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);*/?>
<?php //include("bo_1_init_sys.php");?>
<?php //include("bo_1_init_sql.php");?>
<!-- ---------------------------------------- CONTAINER TABELA DE DADOS ---------------------------------------- -->
<!-- H1 H1 H1 H1 H1 H1 H1 H1 -->
<h1><?php echo($designacao);?></h1>
<input readonly="readonly" style="visibility:visible; border-style:dashed" size="90" maxlength="250" type="text" id="contagem"></input>
<!-- ---------------------------------------- CONTAINER MENU MAIN ---------------------------------------- -->
<?php
include("bo_1_menu_003.php");
?>
<!-- ---------------------------------------- CONTAINER MENU MAIN ---------------------------------------- -->
<form id="frm_<?php echo($ficheiro);?>" name="frm_<?php echo($ficheiro);?>" action="<?php echo($ficheiro_alvo_post_get);?>.php" method="get">
<table border="<?php echo($borda_tabela);?>" cellpadding="4" cellspacing="1" bgcolor="#ffffff" align="center" width="100%">
<tr><td colspan="12" align="right">
<?php
//check de filtro
if($ficheiro_filtro_activo==1){echo ("<a href=\"".($ficheiro_filtro).".php\" target=\"\">Filtro</a>");}else{};
?>
</td>
</tr>
<tr height="25">
<?php
//header da tabela
/*
for($j=1;$j<=$qt_colunas;$j++){
echo("<td class=\"headerTabela\"> ".$header_col[$j]."</td>");
}
echo("<td class=\"headerTabela\"> ".$header_col[11]."</td>");
echo("<td class=\"headerTabela\"> ".$header_col[12]."</td>");
*/
?>
</tr>
<?php
$ij=1;
$ij_2=1;
$arr_cb=array();
$arr_cb_telem=array();
$arr_cb_email=array();
//para a concatenação de 1 array com ao fim de ser ordenado
$arr_cb_full_data=array();
include("bo_2_colab_vendas_1_720_dias_loop_cb.php");
echo "<br>Qt registos: ".$num_total_registos_201105180432." [ Array size: ".sizeof($arr_cb)."]";
for($ij=1;$ij<sizeof($arr_cb);$ij++){
//echo "<br>".$ij." - ".$arr_cb[$ij];
$diff=0;
$diff_2=0;
$id_alvo=$arr_cb[$ij];
$id_alvo_telem=$arr_cb_telem[$ij];
$estado_de_publicacao=""; -
$id_programado=0;
$id_artista=0;
$intRowCount = 0;
$classeCss="";
$valorCelula="";
$query="";
$resultado="";
$num_total_registos=0;
$qt_registos_p_pagina=2000000000;
$inicio_de_consideracao_do_rs=0;
$total_paginas=0;
$pagina_corrente=0;
$pagina_inicial=0;
$criterio="";
$criterio_temp_da_page=sql_20110518_0327_default_sql($id_alvo);
$criterio=$criterio_temp_da_page;
$num_total_registos=0;
$FLAG_RS_1_REG=0;
//debug
if(isset($_SESSION['nivelDeAcesso']))
{
if ($_SESSION['nivelDeAcesso']<5)
{
echo "<font color=\"#ff0000\">";
echo $criterio."<br>";
echo "</font>";
}else{}}
// Erro
$msg[0] = "Conexão off";
$msg[1] = "Não foi possível selecionar a BD";
// conexão
$conexao = mysql_pconnect($mySqlHost,$mySqlUser,$mySqlPw) or die($msg[0]);
mysql_select_db($mySqlDB,$conexao) or die($msg[1]);
// consulta SQL
$query = sql_20110518_0327($criterio,$inicio_de_consideracao_do_rs,$qt_registos_p_pagina);
$resultado = mysql_query($query,$conexao);
$num_total_registos=mysql_num_rows($resultado);
//echo "<br>num_total_registos".$num_total_registos;
if ($num_total_registos>0){
$FLAG_RS_1_REG=0;
while ($linha = mysql_fetch_array($resultado) AND $FLAG_RS_1_REG==0) {
echo "";
if ($intRowCount % 2 == 0) {
$classeCss = "rowImpar";
}
else {
$classeCss = "rowPar";
}
$classeCss2 = "TrAmarelo";
$classeCss3 = "TrVermelho";
$classeCss4 = "TrVerde";
//%classeCss5 = "\"TrAzul\"";
//%classeCss6 = "\"TrCinza\"";
?>
<?php
$id_programado=$linha['id'];
$contagem_colunas=0;
$startDate = $linha['stamp'];
$endDate = time();
$diff=round((abs($endDate-$startDate)/60/60/24),0);
//print("<br>Dias: ".$diff);
if($diff<720 AND $diff>1){
//print("<br><strong>Lembrete:</strong> ".$diff);
//echo $linha[$campo[1]]."";
$startDate =$linha['stamp'];
$endDate = time();
$diff_2=round((abs($endDate-$startDate)/60/60/24),0);
//print("<br><strong>Dias:</strong> ".$diff_2);
//para a concatenação de 1 array com ao fim de ser ordenado
if($diff_2>=720 OR $diff_2<=01){
}else{
//devido à ordenação de um array ser alfabética e não numérica
if(strlen($diff_2."")<3){
$arr_cb_full_data[$ij]="DIAS: 0".$diff_2." |".$arr_cb_full_data[$ij];
}else{
$arr_cb_full_data[$ij]="DIAS: ".$diff_2." |".$arr_cb_full_data[$ij];
}
}
//print("<br><strong>Arr:</strong> ".$arr_cb_full_data[$ij]);
/*
?>
<tr height="30">
<?php //coluna 1
if($contagem_colunas<=$qt_colunas-1){
?>
<td width="<?php echo $width_celula[1]; ?>" class="<?php echo $classeCss; ?>" align="<?php echo $alinhar_celula[1];?>">
<?php
echo $linha[$campo[1]]."";
$startDate =$linha['stamp'];
$endDate = time();
$diff_2=round((abs($endDate-$startDate)/60/60/24),0);
print("<br><strong>Dias:</strong> ".$diff_2);
//para a concatenação de 1 array com ao fim de ser ordenado
$arr_cb_full_data[$ij]="DIAS DESDE A VENDA: ".$diff_2."-".$arr_cb_full_data[$ij];
print("<br><strong>Arr:</strong> ".$arr_cb_full_data[$ij]);
?>
</td>
<?php //fim de coluna
}else{};
$contagem_colunas=$contagem_colunas+1;
?>
<?php //coluna 2
if($contagem_colunas<=$qt_colunas-1){
?>
<td width="<?php echo $width_celula[2]; ?>" class="<?php echo $classeCss; ?>" align="<?php echo $alinhar_celula[2];?>">
<?php echo $linha[$campo[2]]."";?>
<a href="bo_1_colab_ficha_grid.php?id_programado=<?php echo trim($linha['id_cb']);?>" target="_self">
<?php echo "+";?>
</a>
</td>
<?php //fim de coluna
}else{};
$contagem_colunas=$contagem_colunas+1;
?>
<?php //coluna 3
if($contagem_colunas<=$qt_colunas-1){
?>
<td width="<?php echo $width_celula[3]; ?>" class="<?php echo $classeCss; ?>" align="<?php echo $alinhar_celula[3];?>"><?php echo $linha[$campo[3]]."";?></td>
<?php //fim de coluna
}else{};
$contagem_colunas=$contagem_colunas+1;
?>
<?php //coluna 4
if($contagem_colunas<=$qt_colunas-1){
?>
<td width="<?php echo $width_celula[4]; ?>" class="<?php echo $classeCss; ?>" align="<?php echo $alinhar_celula[4];?>"><?php echo $linha[$campo[4]]."";?></td>
<?php //fim de coluna
}else{};
$contagem_colunas=$contagem_colunas+1;
?>
<?php //coluna 5
if($contagem_colunas<=$qt_colunas-1){
?>
<td width="<?php echo $width_celula[5]; ?>" class="<?php echo $classeCss; ?>" align="<?php echo $alinhar_celula[5];?>">
<?php
echo $linha[$campo[5]]."";
?>
</td>
<?php //fim de coluna
}else{};
$contagem_colunas=$contagem_colunas+1;
?>
<?php //coluna 6
if($contagem_colunas<=$qt_colunas-1-1){
?>
<td width="<?php echo $width_celula[6]; ?>" class="<?php echo $classeCss; ?>" align="<?php echo $alinhar_celula[6];?>">
<?php
echo $id_alvo."";
?>
</a>
</td>
<?php //fim de coluna
}else{};
$contagem_colunas=$contagem_colunas+1;
?>
<?php //coluna 7
if($contagem_colunas<=$qt_colunas-1){
?>
<td width="<?php echo $width_celula[7]; ?>" class="<?php echo $classeCss; ?>" align="<?php echo $alinhar_celula[7];?>">
<?php
echo $id_alvo_telem;
?>
</td>
<?php //fim de coluna
}else{};
$contagem_colunas=$contagem_colunas+1;
?>
<?php //coluna 8
if($contagem_colunas<=$qt_colunas-1){
?>
<td width="<?php echo $width_celula[8]; ?>" class="<?php echo $classeCss; ?>" align="<?php echo $alinhar_celula[8];?>"><?php echo $linha[$campo[8]]."";?></td>
<?php //fim de coluna
}else{};
$contagem_colunas=$contagem_colunas+1;
?>
<?php //coluna 9
if($contagem_colunas<=$qt_colunas-1){
?>
<td width="<?php echo $width_celula[9]; ?>" class="<?php echo $classeCss; ?>" align="<?php echo $alinhar_celula[9];?>"><?php echo $linha[$campo[9]]."";?></td>
<?php //fim de coluna
}else{};
$contagem_colunas=$contagem_colunas+1;
?>
<?php //coluna 10
if($contagem_colunas<=$qt_colunas-1){
?>
<td width="<?php echo $width_celula[10]; ?>" class="<?php echo $classeCss; ?>" align="<?php echo $alinhar_celula[10];?>"><?php echo $linha[$campo[10]]."";?></td>
<?php //fim de coluna
}else{};
$contagem_colunas=$contagem_colunas+1;
?>
<?php //coluna 11
if(1==1){
?>
<td width="<?php echo $width_celula[11]; ?>" class="<?php echo $classeCss; ?>" align="<?php echo $alinhar_celula[11];?>">
<div align="center"><font size="1"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#000000">
<input type="radio" name="id_programado" value="<?php echo $id_programado;?>"></input>
</font> </b></font></div>
</td>
<?php //fim de coluna
}else{};
?>
<?php //coluna 12
if(1==1){
?>
<td width="<?php echo $width_celula[12]; ?>" class="<?php echo $classeCss; ?>" align="<?php echo $alinhar_celula[12];?>"">
<?php
echo "<a href=\"".$ficheiro_area_privada.".php?id_programado=$id_programado\" title=\"".$tooltip_legenda_area_privada."\">".$texto_legenda_area_privada."</a>";
?>
</td>
<?php //fim de coluna
}else{};
?>
</tr>
<?php
*/
?>
<?php
//
}
$intRowCount++;
// fim do loop (sair já no 1ª registo)
break;
};
//fim da condição de RS>0 ou não
}else{}
//fim de listagem condicional
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//array para export
$export_step_20110823_0008=1;
include("bo_2_colab_vendas_1_720_dias_export_mail.php");
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//array para export
$export_step_20110823_0009=1;
include("bo_2_colab_vendas_1_720_dias_export_tel.php");
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
print "<br>";
//desordenado
for($ij_2=1;$ij_2<sizeof($arr_cb_full_data);$ij_2++){
//print "<br>".$arr_cb_full_data[$ij_2];
}
sort($arr_cb_full_data);
//print_r($arr_cb_full_data);
print "<br>";
//ordenado
for($ij_2=1;$ij_2<sizeof($arr_cb_full_data);$ij_2++){
if(left($arr_cb_full_data[$ij_2],4)=="DIAS"){
print "<br><br><span style=\"font-size:14px\">-> ".$arr_cb_full_data[$ij_2]."</span>";
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//array para export
$export_step_20110823_0008=2;
include("bo_2_colab_vendas_1_720_dias_export_mail.php");
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//array para export
$export_step_20110823_0009=2;
include("bo_2_colab_vendas_1_720_dias_export_tel.php");
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
}else{};
}
?>
</table>
<P><br>
<?php
echo "<br><br>";
// libertar recursos
mysql_free_result($resultado);
mysql_close($conexao);
?>
</form>
<!-- ---------------------------------------- CONTAINER TABELA DE DADOS ---------------------------------------- -->
<!-- ---------------------------------------- CONTAINER FOOTER HTML ---------------------------------------- -->
<?php
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//array para export
$export_step_20110823_0008=3;
include("bo_2_colab_vendas_1_720_dias_export_mail.php");
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//array para export
$export_step_20110823_0009=3;
include("bo_2_colab_vendas_1_720_dias_export_tel.php");
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
?>
<?php include('bo_1_init_html_footer.php');?>