<?php 
require('../cfg/res.php');
require('../cfg/cfg.php');

require('../../_lib/vrinsext.php');
$inext=new vrinsext('../cfg/res.php','item',$_POST['codigo'],$_POST['ext']);

require('../../_lib/ean.php');
$ean1=new ean();
$ean_sql='select item_codigo from item0 where item_codigo like "'.$num.'%"';

mysql_query('update item0 item0 set item_tlla=SUBSTR(item_codigo,7,2)where item_codigo like "'.$num.'%"',$link_vcrx);

$ean_res=mysql_query($ean_sql,$link_vcrx);
if(mysql_num_rows($ean_res)!=0)
{
	while($ean_r=mysql_fetch_assoc($ean_res))
	{
		mysql_query('update item0  set item_ean="'.$ean1->set($ean_r['item_codigo']).'" where item_codigo="'.$ean_r['item_codigo'].'"',$link_vcrx);
	}
	
}





if( $empr_codigo=='gnya' || $empr_codigo=='gmny')
{
$upd_ite='INSERT INTO vcrxol_gnya.item0 (
vcrxol_gnya.item0.item_codigo,
vcrxol_gnya.item0.item_descri,
vcrxol_gnya.item0.item_ean,
vcrxol_gnya.item0.item_cair

)
SELECT
vcrxol_gmny.item0.item_codigo,
vcrxol_gmny.item0.item_descri,
vcrxol_gmny.item0.item_ean,
vcrxol_gmny.item0.item_cair

FROM   
vcrxol_gmny.item0
where 
vcrxol_gmny.item0.item_codigo not in (select vcrxol_gnya.item0.item_codigo from vcrxol_gnya.item0)
';


	mysql_query($upd_ite,$link_vcrx);
}

?>