<?php 
include("../../../comun/conexion3.php");
   	$txtsocialreason= strtoupper($_POST['txtsocialreason']); 

	$txtrfc= strtoupper($_POST['txtrfc']); 

	$txtcp= strtoupper($_POST['txtcp']); 

	$txtcity= strtoupper($_POST['txtcity']); 

	$txtno_contabilidad=$_POST['txtno_contabilidad'];

	$txtdirection= strtoupper($_POST['txtdirection']); 

	$txtcontact= strtoupper($_POST['txtcontact']); 

	$txttel1= strtoupper($_POST['txttel1']); 

	$txttel2= strtoupper($_POST['txttel2']); 

	$txttel3= strtoupper($_POST['txttel3']); 

	$txtfax = strtoupper($_POST['txtfax']); 

	$txtemail= strtoupper($_POST['txtemail']); 

	$txtobservations= strtoupper($_POST['txtobservations']); 

	$txtnickname= strtoupper($_POST['txtnickname']); 



	$txtinvoicename= strtoupper($_POST['txtinvoicename']); 

	$txtinvoiceaddress= strtoupper($_POST['txtinvoiceaddress']); 

	$txtinvoicecity= strtoupper($_POST['txtinvoicecity']); 

	$txtinvoicezip= strtoupper($_POST['txtinvoicezip']); 





	$txtamsfilenumber= strtoupper($_POST['txtamsfilenumber']); 

	$txtinvoicerevisiondate= strtoupper($_POST['txtinvoicerevisiondate']); 

	$txtinvoiceoceanfreights= strtoupper($_POST['txtinvoiceoceanfreights']); 

	$txtcreditforoceanfreights= strtoupper($_POST['txtcreditforoceanfreights']); 

	$txtcreditforoceanfreightsdays= strtoupper($_POST['txtcreditforoceanfreightsdays']); 

	$txtcreditforoceanfreightsfromdate= strtoupper($_POST['txtcreditforoceanfreightsfromdate']); 

	$txtcreditforlocalcharges= strtoupper($_POST['txtcreditforlocalcharges']); 

	$txtcreditforlocalchargesdays= strtoupper($_POST['txtcreditforlocalchargesdays']); 

	$txtcreditforlocalchargesfromdate= strtoupper($_POST['txtcreditforlocalchargesfromdate']); 



	$txtcustomer_expo=strtoupper($_POST['txtcustomer_expo']);

	$txtcustomer_impo=strtoupper($_POST['txtcustomer_impo']);

	$txtcustomer_service=strtoupper($_POST['txtcustomer_service']);

	$txtcto_ventas=strtoupper($_POST['txtcto_ventas']);

	

	

	$txtcalle_invoice=strtoupper($_POST['txtcalle_invoice']);

$txtno_ext_invoice=strtoupper($_POST['txtno_ext_invoice']);

$txtno_int_invoice=strtoupper($_POST['txtno_int_invoice']);

$txtcolonia_invoice=strtoupper($_POST['txtcolonia_invoice']);

$txtmunicipio_invoice=strtoupper($_POST['txtmunicipio_invoice']);

$txtestado_invoice=strtoupper($_POST['txtestado_invoice']);

$txtlocalidad_invoice=strtoupper($_POST['txtlocalidad_invoice']);

$txtpais_invoice=strtoupper($_POST['txtpais_invoice']);



/*

if ($txtsocialreason=="" || $txtnickname=="")

{

echo "COMPANY NAME OR NICK NAME CANT BE NULL";

}

*/





	

$id=$_GET['id'];

	$result=mysqli_query("select * from customerexpint where  nickname like '$txtnickname' and id<>'$id'");	

	if ( mysqli_fetch_array($result)){

			echo("	<form name=\"form2\" method=\"post\" action=\"customerexpint.php\">");

		echo("  <div align=\"center\"> ");

echo "<P></P>";

		echo("FAILURE THE DATAS CAN NOT BE DUPLICATED, PLEASE TRY AGAIN");

		echo("     <input type=\"submit\" name=\"Submit\" value=\"BACK\">");

		echo("  </div>");

		echo(" </form>");

		}

	else

		{



	$resultf=mysqli_query("select * from customerexpint where  id='$id'");	

	$rowf=mysqli_fetch_array($resultf);

	$txtclienteantes=$rowf['socialreason'];

	

mysqli_query("Update tarifasint  set cliente='$txtsocialreason' where cliente='$txtclienteantes'", $link);	

//mysqli_query("INSERT INTO customerexpint (socialreason,rfc,cp,city,direction,contact,tel1,tel2,tel3,fax,email,observations,nickname,id) Values ('$txtsocialreason','$txtrfc','$txtcp','$txtcity','$txtdirection','$txtcontact','$txttel1','$txttel2','$txttel3','$txtfax','$txtemail','$txtobservations','$txtnickname','$id')");

mysqli_query("UPDATE customerexpint SET socialreason='$txtsocialreason',rfc='$txtrfc',cp='$txtcp',city='$txtcity',direction='$txtdirection',contact='$txtcontact',tel1='$txttel1',tel2='$txttel2',tel3='$txttel3',fax='$txtfax',email='$txtemail',observations='$txtobservations',nickname='$txtnickname',invoicename='$txtinvoicename', invoiceaddress='$txtinvoiceaddress', invoicecity='$txtinvoicecity', invoicezip='$txtinvoicezip',amsfilenumber= '$txtamsfilenumber',	invoicerevisiondate= '$txtinvoicerevisiondate',	invoiceoceanfreights= '$txtinvoiceoceanfreights',	creditforoceanfreights= '$txtcreditforoceanfreights',creditforoceanfreightsdays='$txtcreditforoceanfreightsdays',	creditforoceanfreightsfromdate= '$txtcreditforoceanfreightsfromdate',	creditforlocalcharges= '$txtcreditforlocalcharges',	creditforlocalchargesdays='$txtcreditforlocalchargesdays',creditforlocalchargesfromdate= '$txtcreditforlocalchargesfromdate' ,customer_expo='$txtcustomer_expo',	customer_impo='$txtcustomer_impo',	customer_service='$txtcustomer_service', cto_ventas='$txtcto_ventas',no_contabilidad='$txtno_contabilidad' ,calle_invoice='$txtcalle_invoice',no_ext_invoice='$txtno_ext_invoice',no_int_invoice='$txtno_int_invoice',colonia_invoice='$txtcolonia_invoice',municipio_invoice='$txtmunicipio_invoice' ,estado_invoice='$txtestado_invoice' ,localidad_invoice='$txtlocalidad_invoice' ,pais_invoice='$txtpais_invoice'     WHERE id='$id'");

  header("Location: searchcustomerfacimp.php"); 

}

?> 

