MOON
Server: Apache/2.2.34 (Unix) mod_ssl/2.2.34 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 FrontPage/5.0.2.2635
System: Linux server.asjudinet.com 2.6.32-042stab141.3 #1 SMP Fri Nov 15 22:45:34 MSK 2019 i686
User: asjudine (504)
PHP: 5.2.17
Disabled: NONE
Upload Files
File: /home/asjudine/www/generar_registros_fecha.php
<?php 
require_once("mainfile.php");
include ("config.php");
global $dbi;

require_once("Conectarse.php");

//$query_sql4 = "SELECT * FROM director_ventas where estado = '1' and (tipo = 'N' || tipo = 'M')order by nombre";
//$sql4 = mysql_query($query_sql4, $dbi) or die(mysql_error());
$sql4 = mysql_query('SELECT * FROM director_ventas WHERE estado =  "1" and (tipo = "N" || tipo = "M")order by nombre');
			if (!$sql4) {
				die('Invalid query re: ' . mysql_error());
			}
$row_sql4 = mysql_fetch_assoc($sql4);
$totalRows_sql4 = mysql_num_rows($sql4); 
?>
<!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>Generar Comisiones por Director</title>
<style type="text/css">
<!--
.recaudo {font-family: "Courier New", Courier, monospace;
	font-size: 12px;
	font-style: normal;
	font-weight: bold;
	font-variant: normal;
	color: #000000;
	background-color: #B6CBDC;
	margin: 4px;
	padding: 8px;
	width: auto;
	border: medium outset #339966;
}
.est_cont1 {
	font-family: "Times New Roman", Times, serif;
	font-size: 12px;
	font-style: normal;
	font-weight: normal;
	color: #4068F4;
	background-color: #E6FFF1;
	margin: 1px;
	padding: 1px;
	height: auto;
	width: auto;
	border: thin double #33CC66;
}
.est_cont2 {
	font-family: Geneva, Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-style: normal;
	font-weight: normal;
	color: #418BAF;
	background-color: #F0F5CF;
	height: 15px;
	width: auto;
	border: thin solid #FABF85;
}
.est_cont3 {
	font-family: "Courier New", Courier, monospace;
	font-size: 12px;
	font-style: normal;
	font-weight: normal;
	color: #EA261C;
	background-color: #DEDDE8;
	height: auto;
	width: auto;
	border: thin outset #FC9F67;
}
.est_cont5 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-style: normal;
	font-weight: normal;
	background-color: #D6ECFE;
	margin: 2px;
	padding: 2px;
	height: auto;
	width: auto;
	border: thin groove #E9AAF0;
	color: #C72350;
}
.Estilo50 {color: #CC3333;
	font-family: "Arial Narrow";
	font-weight: bold;
}
.fecha {font-size: 12px; font-family: Arial; color:#990000; display: block; }
.titulos {font: 16px; color: red; font-family:Arial; font-weight:bold}
.Estilo51 {
	font-size: 14px;
	font-weight: bold;
}
.col_cre2 {	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-style: normal;
	font-weight: bold;
	color: #F92F0B;
	background-color: #B3D9F0;
	height: auto;
	width: auto;
	border: medium groove #FC9227;
}
.est_cont21 {	font-family: Geneva, Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-style: normal;
	font-weight: normal;
	color: #2B39EC;
	background-color: #F0F5CF;
	height: 18px;
	width: auto;
	border: thin solid #FABF85;
}
.Estilo2 {font-family: Arial;	font-size: 16px;	color: #990000;}
.campo {
	background-color:#FFFFAA;
	width: 80px;
	border:2px solid #990000;
	height: 17px;
}
.Estilo53 {font-family: Arial; font-size: 12px; color: #990000; }
.Estilo54 {
	color: #0066FF;
	font-weight: bold;
}


body {
	background-image: url(ELEMENTOS/gri06.jpg);
}


-->
</style>
</head>

<body>
<center> <img src="ELEMENTOS\CABEZOTE SERVIASJUDINET.jpg" WIDTH=60% > </center>
<br />
<form id="form1" name="form1" method="post" action="">

    <table width="607" border="10" align="center" cellpadding="2" cellspacing="2">
      <tr bgcolor="#FFFFCC">
        <td colspan="4" bgcolor="#ECE9D8" class="titulos"><div align="center" class="titulos">REGISTROS POR FECHA</div></td>
      </tr>
      <tr bgcolor="#ECE9D8">
        <td height="22" colspan="2" class="fecha">
          <div align="right">
              <script languaje="JavaScript">Mostrar_Fecha()</script>
          
        <td colspan="2" class="fecha"><div align="left">
       
        </div></td>
  <tr bgcolor="#FFCC99">
    <td width="309" class="Estilo53" align="right"><strong>DESDE:</strong> 
      <input name="fecha1" type="text" id="fecha1" size="12" maxlength="14" value="0000-00-00" /></td>
	  <td width="120" class="Estilo53" align="right"><strong>HASTA:</strong> </td>
    <td width="271">
      <input name="fecha2" type="text" id="fecha2" size="12" maxlength="14" value="0000-00-00"></td>
    
   
  </tr>
  <tr bgcolor="#FFCC99">
    <td width="309" class="Estilo53" align="right"><strong>AÑO:</strong> 
      <input name="fechaan" type="text" id="fechaan" size="12" maxlength="14" value="" /></td>
      
	  <td width="120" class="Estilo53" align="right"><strong>MES:</strong> </td>
    <td width="271">
      <input name="fechames" type="text" id="fechames" size="12" maxlength="14" value=""></td>
    
   
  </tr>
  
      <tr bgcolor="#FFCC99">
        <td colspan="4"><div align="center">
          <input name="consultar" type="submit" class="col_cre2" id="consultar" value="Consultar"  />
        </div></td>
      </tr>
      <tr bgcolor="#FFCC99">

      <td colspan="4"><div align="center">
      <input name="menu2" type="button" class="Estilo50" id="menu2" onclick="window.location.href='consulta_comisiones.php'" value="IR AL MENU" />
      <label></label>
      </div></td>
      </tr>
    </table>
<div align="left"></div>
    <div align="left"></div>
    <div align="right"></div> 

</form>
</body>
</html>
<?php

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

$coddirna=$_POST[ase];
				
$añoaplica=$_POST[fechaan];
$mesaplica=$_POST[fechames];		

			   				
$cont2 = mysql_query('SELECT mes_aplicado,ano_aplicado FROM distribucion_porcentaje_ventas WHERE mes_aplicado = "'.$_POST[fechames].'" and ano_aplicado = "'.$_POST[fechaan].'"');				
							
				$fil = mysql_num_rows($cont2);	
				if ($fil == 0)
			{		
				
$cont = mysql_query('SELECT cedula,nombre,contrato,contratotipo,valor_cuota,cuota,codigo_descuento,unidad_descuento, fecha_registro FROM cartera_estado_contable WHERE fecha_registro >= "'.$_POST[fecha1].'" and fecha_registro <= "'.$_POST[fecha2].'"  and codigo_descuento!="900" order by  nombre');
			if (!$cont) {
				die('Invalid query aaaa ' . mysql_error());
			} 
                      if ((mysql_num_rows($cont)!=0))   
	                    {	 
                               
						 
					echo "<table width='400' border='2' align='center' cellpadding='1' cellspacing='1' class='est_cont5'>
                        <tr>
        					<td width='70'><div align='center'><strong>CEDULA</strong></div></td>
							<td width='70'><div align='center'><strong>CEDULA</strong></div></td>
        					<td width='140'><div align='center'><strong>NOMBRE</strong></div></td>
        					<td width='50'><div align='center'><strong>CONTRATO No</strong></div></td>
       						<td width='70'><div align='center'><strong>TIPO</strong></div></td>
							<td width='70'><div align='center'><strong>DESCUENTO</strong></div></td>
							<td width='70'><div align='center'><strong>UNIDAD</strong></div></td>
        					<td width='70'><div align='center'><strong>VALOR COMISION</strong></div></td>
							<td width='70'><div align='center'><strong>CUOTA</strong></div></td>
							<td width='70'><div align='center'><strong>FECHA REGISTRO</strong></div></td></tr>";		  

      	
		
		while(list($cedt, $nombre, $numcon, $tipoc, $val, $cuo, $forma, $unid, $fech) = mysql_fetch_row($cont))
			{			   
			
			   

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


 if ($forma == "10" and $unid == "CPRN")
  {
	   $entid="COOVEEDURIA";
  
	  }
	  
	   if ($forma == "9" and $unid == "DDFC")
  {
	   $entid="COOVEEDURIA";
  
	  }
	  
	  	  
	   if ($forma == "11" and $unid == "CCPP")
  {
	   $entid="COOVEEDURIA";
  
	  }
	  	  
	   if ($forma == "12" and $unid == "CPPJ")
  {
	   $entid="COOVEEDURIA";
  
	  }
	  	  
	   if ($forma == "16" and $unid == "NDFC")
  {
	   $entid="COOVEEDURIA";
  
	  }
	  	  
	   if ($forma == "100" and $unid == "INPE")
  {
	   $entid="COOVEEDURIA";
  
	  }
	  	  
	   if ($forma == "101" and $unid == "INPE")
  {
	   $entid="COOVEEDURIA";
  
	  }
	  	  
	   if ($forma == "305" and $unid == "NPFM")
  {
	   $entid="COOVEEDURIA";
  
	  }
	  	  
	   if ($forma == "685" and $unid == "NCSR")
  {
	   $entid="COOVEEDURIA";
  
	  }
	  	  
	   if ($forma == "9802" and $unid == "NNEE")
  {
	   $entid="COOVEEDURIA";
  
	  }
	  	  
	   if ($forma == "9802" and $unid == "NNFA")
  {
	   $entid="COOVEEDURIA";
  
	  }
	  	  
	   if ($forma == "9802" and $unid == "NNAN")
  {
	   $entid="COOVEEDURIA";
  
	  }
	  	  
	   if ($forma == "9802" and $unid == "NPMD")
  {
	   $entid="COOVEEDURIA";
  
	  }
	  	  
	   if ($forma == "10199" and $unid == "NPCV")
  {
	   $entid="COOVEEDURIA";
  
	  }
	  	  
	   if ($forma == "2013" and $unid == "NDIM")
  {
	   $entid="COOVEEDURIA";
  
	  }


   if ($forma == "102" and $unid == "NEPV")
  {
	   $entid="COOPSERVINET";
  
	  }
	  
	   if ($forma == "1301" and $unid == "NPCT")
  {
	   $entid="COOPSERVINET";
  
	  }
	   if ($forma == "973A" and $unid == "CPEE")
  {
	   $entid="COOPSERVINET";
  
	  }
	   if ($forma == "973A" and $unid == "CPAN")
  {
	   $entid="COOPSERVINET";
  
	  }
	   
	   if ($forma == "973A" and $unid == "CPFA")
  {
	   $entid="COOPSERVINET";
  
	  }

if ($forma == "201" and $unid == "DPCC")
  {
	   $entid="BANCOS";
  
	  }
	  
	  if ($forma == "420" and $unid == "DACM")
  {
	   $entid="BANCOS";
  
	  }
	  if ($forma == "425" and $unid == "YYY0")
  {
	   $entid="BANCOS";
  
	  }
	  if ($forma == "430" and $unid == "DABG")
  {
	   $entid="BANCOS";
  
	  }
	  if ($forma == "435" and $unid == "YYY0")
  {
	   $entid="BANCOS";
  
	  }
	  if ($forma == "475" and $unid == "YYY0")
  {
	   $entid="BANCOS";
  
	  }
	  if ($forma == "500" and $unid == "YYY0")
  {
	   $entid="BANCOS";
  
	  }
	  if ($forma == "700" and $unid == "YYY0")
  {
	   $entid="BANCOS";
  
	  }
	 
	  if ($forma == "2000" and $unid == "PSEN")
  {
	   $entid="BANCOS";
  
	  }
	  if ($forma == "2001" and $unid == "PSEN")
  {
	   $entid="BANCOS";
  
	  }
	  if ($forma == "2002" and $unid == "PSEN")
  {
	   $entid="BANCOS";
  
	  }
	  if ($forma == "2003" and $unid == "PSEN")
  {
	   $entid="BANCOS";
  
	  }
	  if ($forma == "16" and $unid == "CPRN2")
  {
	   $entid="BANCOS";
  
	  }
	  if ($forma == "17" and $unid == "CPRN1")
  {
	   $entid="BANCOS";
  
	  }
	  if ($forma == "22" and $unid == "CPPJ")
  {
	   $entid="BANCOS";
  
	  }
	  if ($forma == "25" and $unid == "CCPP1")
  {
	   $entid="BANCOS";
  
	  }
	  
	  if ($forma == "26" and $unid == "NDFC")
  {
	   $entid="BANCOS";
  
	  }

$aprova =  mysql_query("INSERT INTO distribucion_porcentaje_ventas (cedula, nombre, contrato , contratotipo, cuota, valor_cuota,fecha_registro,codigo_descuento,unidad_descuento,entidad_recaudo,mes_aplicado,ano_aplicado) VALUES ('".$cedt."','".$nombre. "','".$numcon."','".$tipoc."','".$cuo."','".$val."','".$fech."','".$forma."', '".$unid."', '".$entid."','".$mesaplica."','".$añoaplica."')");
				  if (!$aprova) {
				die('Invalid query update aprova: ' . mysql_error());
							}

$tota = $tota + $val;
$nuer = $nuer + 1 ;
								  printf("<TR>
                                   <TD bgcolor='#ECE9D8'><div align='center' class='lista'><input type='button' value=$cedt name='cedt' class=est_cont1 onClick =window.open('consulta_ingreso_contrato.php?id2=$id&ced2=$cedt&numcon=$numcon','','top=50,left=100,toolbar=yes,scrollbars=yes,width=800,height=500,status=yes')></a></span></div></TD>
                                 <TD bgcolor='#C5D6FC'><div align='center' class='lista'>".$cedt."</span></div></TD>
								 <TD bgcolor='#C5D6FC'><div align='center' class='lista'>".$nombre."</span></div></TD>
								 <TD bgcolor='#C5D6FC'><div align='center' class='lista'>".$numcon."</span></div></TD>
								 <TD bgcolor='#C5D6FC'><div align='center' class='lista'>".$tipoc."</span></div></TD>
								 <TD bgcolor='#C5D6FC'><div align='center' class='lista'>".$forma."</span></div></TD>
								 <TD bgcolor='#C5D6FC'><div align='center' class='lista'>".$unid."</span></div></TD>						   		                         <TD bgcolor='#C5D6FC'><div align='center' class='lista'>".$val."</span></div></TD>
								 <TD bgcolor='#C5D6FC'><div align='center' class='lista'>".$cuo."</span></div></TD>
								 <TD bgcolor='#C5D6FC'><div align='center' class='lista'>".$fech."</span></div></TD></TR>");
						}
			          }   
								 
							echo "</table>";		  
							echo "<width='400' border='2' align='center' cellpadding='1' cellspacing='1' class='est_cont5' >
                       		<tr>
        					<td width='70'><div align='center'><strong>TOTAL VALOR CONSIGNACION</strong></div></td>
							</tr>";	
								   
								printf("<TR>
								<TD bgcolor='#C5D6FC'><div align='center' class='lista'>".$tota."</span></div></TD>	</TR>"); 
									 
									 
							echo "<width='400' border='2' align='center' cellpadding='1' cellspacing='1' class='est_cont5' >
                       		<tr>
							<td width='70'><div align='center'><strong>TOTAL REGISTROS</strong></div></td>
							</tr>";	
								   
							printf("<TR>
							<TD bgcolor='#C5D6FC'><div align='center' class='lista'>".$nuer."</span></div></TD>	</TR>"); 
								   
                        }
						
							else {
	
	echo "<script>alert('Ya Se Encuentran Registros De Esta Fecha');</script>";
	
			}
					}
		
	
	  	

echo "</form>";

?>