<? include("../header_subnivel1.php");
include("../comun/conexion3.php");

?>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/funciones.js"></script>
<script type="text/javascript" src="../js/validator.js"></script>
<script src="../js/windowfiles_1/dhtmlwindow.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="../js/windowfiles_1/dhtmlwindow.css" media="all" />
<script>

function controlar_alias(forma) {

var laDatos = valores_forma(forma);
		$.post( "../alias/control_alias_no_repetidos.php",
				$(laDatos),
				function FuncionRecepcion(respuesta) {
					var laRespuesta = eval('(' + respuesta + ')');
					if ( laRespuesta != null ) {
						var laActions = laRespuesta["actions"];
						var liIdx;
						for ( liIdx=0 ; liIdx<laActions.length ; liIdx++ )
							eval( laActions[liIdx] );
					}
				});

}

<link rel="stylesheet" type="text/css" href="../style.css" media="all" />

<script language="Javascript">
function copyyinvoice(){ 
    this.document.form1.txtinvoicename.value = this.document.form1.txtsocialreason.value

    this.document.form1.txtinvoiceaddress.value = this.document.form1.txtdirection.value

    this.document.form1.txtinvoicezip.value = this.document.form1.txtcp.value

    this.document.form1.txtinvoicecity.value = this.document.form1.txtcity.value

}

function preguntar(inst1,dato){

eliminar=confirm("Do you really want to delete it ? " + dato);

if (eliminar)

window.location.href = inst1; 

//else

//alert('No se ha podido eliminar el registro...')

}

</script>



<script> 

function guarda(){ 

	if ( this.document.form1.txtsocialreason.value==0)

{

alert ("Company Name must be not empty");

exit();

} 

	if ( this.document.form1.txtnickname.value==0)

{

alert ("Nick Name must be not empty");

exit();

} 

this.document.form1.submit();

}

</script>

<div align="justify" style="line-height:18px;margin-top:-44px; position:absolute;width: 960px; height:100%;background:url(../images/mundo.jpg) ">
<br /><span style="color:#00AF4B">Customers &raquo;</span>
<br><br>

<table border="0" width="28%" align="left" style="line-height:28px">
<form name="form1" method="post" action="guardacustomerexpint.php">

<tr bordercolor="#FFFFFF"> 

      <td bgcolor="#00E1A9">
      <table width="28%" >
      
    <tr bordercolor="#FFFFFF"> 

      <td bgcolor="#00E1A9">Company 

        Name </td>

      <td><input name="txtsocialreason" type="text" id="txtsocialreason" size="40"></td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td bgcolor="#00E1A9">Nick 

        Name:</td>

      <td><input name="txtnickname" type="text" id="txtnickname2"  size="40"></td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td bgcolor="#00E1A9">Address</td>

      <td><input name="txtdirection" type="text" id="txtdirection"  size="40"></td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td bgcolor="#00E1A9">City</td>

      <td><input name="txtcity" type="text" id="txtcity"  size="40"></td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td bgcolor="#00E1A9">Tel</td>

      <td><input name="txttel1" type="text" id="txttel1"  size="40"></td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td bgcolor="#00E1A9">Fax</td>

      <td><input name="txtfax" type="text" id="txtfax"  size="40"></td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td bgcolor="#00E1A9">Email</td>

      <td><input name="txtemail" type="text" id="txtemail"  size="40"></td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td bgcolor="#00E1A9">Web 

        Site </td>

      <td><input name="txtobservations" type="text" id="txtobservations"  size="40"></td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td bgcolor="#00E1A9"> AMS File Number 

      </td>

      <td><input name="txtamsfilenumber" type="text" id="txtamsfilenumber"  size="40"></td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td >&nbsp;</td>

      <td>&nbsp;</td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td width="55%" bgcolor="#00E1A9">Invoice 

        Name 

        <input type="checkbox" name="checkbox" value="checkbox" onClick="copyyinvoice()" class="aa">

        Copy</td>

      <td width="45%"><input name="txtinvoicename" type="text" id="txtinvoicename"  size="40"></td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td bgcolor="#00E1A9">RFC</td>

      <td><input name="txtrfc" type="text" id="txtrfc"  size="40"></td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td bgcolor="#00E1A9">Invoice 

        Address</td>

      <td><input name="txtinvoiceaddress" type="text" id="txtinvoiceaddress"  size="40"></td>

    </tr>

    <tr bordercolor="#FFFFFF">

      <td bgcolor="#00E1A9">Invoice Calle</td>

      <td><input name="txtcalle_invoice" type="text" id="txtcalle_invoice"  size="40" value="<? echo $txtcalle_invoice; ?>"></td>

    </tr>

    <tr bordercolor="#FFFFFF">

      <td bgcolor="#00E1A9">Invoice No Ext</td>

      <td><input name="txtno_ext_invoice" type="text" id="txtno_ext_invoice"  size="40" value="<? echo $txtno_ext_invoice; ?>"></td>

    </tr>

    <tr bordercolor="#FFFFFF">

      <td bgcolor="#00E1A9">Invoice No Int</td>

      <td><input name="txtno_int_invoice" type="text" id="txtno_int_invoice" size="40" value="<? echo $txtno_int_invoice; ?>"></td>

    </tr>

    <tr bordercolor="#FFFFFF">

      <td bgcolor="#00E1A9">Invoice Colonia</td>

      <td><input name="txtcolonia_invoice" type="text" id="txtcolonia_invoice"  size="40" value="<? echo $txtcolonia_invoice; ?>"></td>

    </tr>

    <tr bordercolor="#FFFFFF">

      <td bgcolor="#00E1A9">Invoice Municipio o Delegacion</td>

      <td><input name="txtmunicipio_invoice" type="text" id="txtmunicipio_invoice"  size="40" value="<? echo $txtmunicipio_invoice; ?>"></td>

    </tr>

    <tr bordercolor="#FFFFFF">

      <td bgcolor="#00E1A9">Invoice Estado</td>

      <td><input name="txtestado_invoice" type="text" id="txtestado_invoice"  size="40" value="<? echo $txtestado_invoice; ?>"></td>

    </tr>

    <tr bordercolor="#FFFFFF">

      <td bgcolor="#00E1A9">Invoice Localidad</td>

      <td><input name="txtlocalidad_invoice" type="text" id="txtlocalidad_invoice"  size="40" value="<? echo $txtlocalidad_invoice; ?>"></td>

    </tr>

    <tr bordercolor="#FFFFFF">

      <td bgcolor="#00E1A9">Invoice Pais</td>

      <td><input name="txtpais_invoice" type="text" id="txtpais_invoice"  size="40" value="<? echo $txtpais_invoice; ?>"></td>

    </tr>

    <tr bordercolor="#FFFFFF">

      <td bgcolor="#00E1A9">Zip 

        (CP)</td>

      <td><input name="txtcp" type="text" id="txtcp"  size="40"></td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td bgcolor="#00E1A9">Invoice 

        Zip (CP)</td>

      <td><input name="txtinvoicezip" type="text" id="txtinvoicezip"  size="40"></td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td bgcolor="#00E1A9">Invoice 

        City</td>

      <td><input name="txtinvoicecity" type="text" id="txtinvoicecity"  size="40"></td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td >&nbsp;</td>

      <td>&nbsp;</td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td bgcolor="#00E1A9">Invoice 

        Revision Date</td>

      <td><input name="txtinvoicerevisiondate" type="text" id="txtinvoicerevisiondate"  size="40"></td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td bgcolor="#00E1A9">Invoice 

        Oceanfreights</td>

      <td><select name="txtinvoiceoceanfreights" id="txtinvoiceoceanfreights" class="aa" >

          <option value="YES">YES</option>

          <option value="NO">NO</option>

          <option value="" selected></option>		  

        </select></td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td bgcolor="#00E1A9">Credit 

        for Oceanfreights (days)</td>

      <td><select name="txtcreditforoceanfreights" id="txtcreditforoceanfreights" class="aa">

          <option value="YES">YES</option>

          <option value="NO" selected>NO</option>

        </select> <input name="txtcreditforoceanfreightsdays" type="text" id="txtcreditforoceanfreightsdays" size="5" maxlength="3"></td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td bgcolor="#00E1A9">From 

        Date</td>

      <td><select name="txtcreditforoceanfreightsfromdate" id="txtcreditforoceanfreightsfromdate" class="aa">



    <?php

		$authors = mysqli_query("SELECT * FROM calculationdates order by text");

		  while ($author = mysqli_fetch_array($authors)) {

    $aid = $author["text"];

    $aname = htmlspecialchars($author["text"]);

    echo("<option value=\"$aid\">$aname</option>\n"); 			

		  }

//		  printf ("<option value=\"%s\" selected>%s</option>",$txtcreditforoceanfreightsfromdate,$txtcreditforoceanfreightsfromdate) ;

		?>

        </select></td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td bgcolor="#00E1A9">Credit 

        for Local Charges (days)</td>

      <td><select name="txtcreditforlocalcharges" id="txtcreditforlocalcharges" class="aa">

          <option value="YES">YES</option>

          <option value="NO" selected>NO</option>

        </select> <input name="txtcreditforlocalchargesdays" type="text" id="txtcreditforlocalchargesdays" size="5" maxlength="3"></td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td bgcolor="#00E1A9">From 

        Date</td>

      <td><select name="txtcreditforlocalchargesfromdate" id="txtcreditforlocalchargesfromdate" class="aa">

     <?php



		$authors = mysqli_query("SELECT * FROM calculationdates order by text");

		  while ($author = mysqli_fetch_array($authors)) {

    $aid = $author["text"];

    $aname = htmlspecialchars($author["text"]);

    echo("<option value=\"$aid\">$aname</option>\n"); 			

		  }

//		  printf ("<option value=\"%s\" selected>%s</option>",$txtcreditforoceanfreightsfromdate,$txtcreditforoceanfreightsfromdate) ;

		?>

 

        </select></td>

    </tr>

    <tr bordercolor="#FFFFFF"> 

      <td ><input type="button" name="BAgregar" value="Create" onclick="guarda()" /></td>

      <td>&nbsp;</td>

    </tr>
    </form>
    
    <tr bordercolor="#FFFFFF">
      <td colspan="2" >
<!--<form name="form2" method="post" action="searchcustomer.php">-->
	    <input type="submit" name="Submit" value="Search" onclick='dhtmlwindow.open("ClientesBox", "iframe", "searchcustomer.php", "Buscar Clientes", 
"width=750px,height=400px,resize=1,scrolling=1,center=1", "recal")'>

  <table width="255" border="0

  ">
          <tr>
            <td>
              <input name="Button2infoimpo" type="button" onclick="abreVentana('customerinfomail.php?id=%&amp;&amp; val=impo')" value="Send Info IMPO" />
            </td>
            <td>&nbsp;</td>
            <td>
              <input name="Button2infoexpo2" type="button" onclick="abreVentana('customerinfomail.php?id=%&amp;&amp; val=expo')" value="Send Info EXPO" />
            </td>
          </tr>
  </table>
<!--</form>-->
      </td>
    </tr>
    
    </table>
    </td>
    </tr>
    
    <tr bordercolor="#FFFFFF">
      <td >&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    
    <tr bordercolor="#FFFFFF">
      <td colspan="2" >
    <?php



	

$page= $_GET['page'];

if ($page == "")

$page=1;

$registrosm=30;

$page2i=0  + $registrosm * ($page-1);

$page2f=$registrosm;

$sqlpag="SELECT * FROM customerexpint order by nickname ";

$paf="customerexpint.php"	;

$result = mysqli_query("SELECT * FROM customerexpint order by nickname limit  $page2i,$page2f"); 





if ($row = mysqli_fetch_array($result)){ 

   //   echo "<table border = '1' align=\"center\"  bordercolorlight=\"#0000FF\" bgcolor=\"#CCFFFF\" > \n"; 
?>
</p>
    <table align="left" width="100%"  class="tablas_con_bordes_" style="font-family:Arial, Helvetica, sans-serif; font-size:11px" >
<?

$i=0;

printf("<TR class='yellow'><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">Company Name</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">Nick Name</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">Invoice Name</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">Delete</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">Change</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">Contacts</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">Address</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">ZIP (CP)</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">City</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">Tel</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">Fax</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">Email</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">Web Site</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">AMS FIle Number</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">RFC</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">Invoice Address</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">Invoice Zip</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">Invoice City</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">Invoice Revision Date</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">Invoice Ocean Freights</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">Credit for Oceanfreights</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">From Date</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">Credit for Local Charges</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">From Date</TD></TR>");





do {

	$i=$i+1; 

//impresion

printf("<TR  class='comun'><TD><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">%s</TD><TD><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">%s</TD><TD><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">%s</TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\"><a href=\"javascript:preguntar('borracustomerexpint.php?id=%s','')\">Delete</a></TD><TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\"><a href=\"cambiocustomerexpint.php?id=%s\">Change</a></TD>
																																																																													<TD><strong><font size=\"1\" face=\"Arial, Helvetica, sans-serif\"><a href=\"customercontactdetails.php?id=%s\">Administrate</a></TD><TD><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">%s</TD><TD><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">%s</TD><TD><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">%s</TD><TD><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">%s</TD><TD><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">%s</TD><TD><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">%s</TD><TD><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">%s</TD><TD><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">%s</TD><TD><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">%s</TD><TD><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">%s</TD><TD><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">%s</TD><TD><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">%s</TD><TD><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">%s</TD><TD><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">%s</TD><TD><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">%s</TD><TD><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">%s</TD><TD><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">%s</TD><TD><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">%s</TD></TR>",utf8_encode($row["socialreason"]),utf8_encode($row["nickname"]),utf8_encode($row["invoicename"]),$row["id"],$row["id"],$row["id"],utf8_encode($row["direction"]),$row["cp"],utf8_encode($row["city"]),$row["tel1"],$row["fax"],"<a href=\"mailto:" . $row["email"] . "\">" . $row["email"] . "</a>",utf8_encode($row["observations"]),$row["amsfilenumber"],$row["rfc"],utf8_encode($row["invoiceaddress"]),$row["invoicezip"],utf8_encode($row["invoicecity"]),$row["invoicerevisiondate"],$row["invoiceoceanfreights"],$row["creditforoceanfreights"] . " " . $row["creditforoceanfreightsdays"],$row["creditforoceanfreightsfromdate"],$row["creditforlocalcharges"] . " " . $row["creditforlocalchargesdays"],$row["creditforlocalchargesfromdate"]);



echo "        </TD \n";

echo "      </TR>\n";



   } while ($row = mysqli_fetch_array($result)); 
?>
<tr>
<td colspan="20">
<?

echo "<p align=\"center\">";

$result = mysqli_query($sqlpag); 

if ($row = mysqli_fetch_array($result))

{

$num_rows = mysqli_num_rows($result);

//echo $num_rows;

mysqli_data_seek($result, 0);

for($co1=1;$col<=$num_rows/$registrosm;$col++)

{

  if (!mysqli_data_seek($result, (($col)*$registrosm))) {

       continue;

   }

   if (!($row = mysqli_fetch_assoc($result))) {

       continue;

   }

   $ffin= substr($row['nickname'],0,3);

   $col2=$col2*1+1;

if ($col2==$page)

echo "     <a href=\"$paf?page=$col2\">( $ffin )</a>    - ";

else

echo "     <a href=\"$paf?page=$col2\">$ffin</a>    - ";

}

if ($col2==$page)

echo "     <a href=\"$paf?page=$col2\">( LAST )</a>    - ";

else

echo "     <a href=\"$paf?page=$col2\">LAST</a>    - ";

}

echo "</p>";

?>
</td></tr>
<?
   echo  "</table>" ;
}

?>  
      
    

  </table>


</form>
</div>