<?
session_start();
if($v==1){
include("stilos/config.inc.php");
}
?>

<table width="868" border="1" cellpadding="0" cellspacing="0" bordercolor="<?=$bordetabla?>" bgcolor="<?=$c_fondo['fondo tabla']?>" style="<?=$stylo['tabla']?>" >  
  <tr class="lblCampoBlanco" bgcolor="<?=$c_fondo_tr["fondo tr"]?>">
    <td width="17"><div align="center" class="lblCampoBlanco">#</div></td>
    <td width="180"><div align="center" class="lblCampoBlanco">Descripcion</div></td>
    <td width="114" ><div align="center" class="lblCampoBlanco">Empresa</div></td>
    <td width="65"><div align="center" class="lblCampoBlanco">G. Remision </div></td>
    <td width="100"><div align="center" class="lblCampoBlanco">C. Costo </div></td>
    <td width="68"><div align="center" class="lblCampoBlanco">Origen</div></td>
    <td width="72"><div align="center" class="lblCampoBlanco">Destino</div></td>
    <td width="52"><div align="center" class="lblCampoBlanco">Tipo Carga </div></td>
    <td width="82">      
      <div align="center" class="lblCampoBlanco">U.M.</div></td>
    <td width="39"><div align="center" class="lblCampoBlanco">Cant</div></td>
    <td width="38"><div align="center" class="lblCampoBlanco">Total</div></td>
    <td width="15">&nbsp;    </td>
  </tr>
<?php 
if($q==1){	   
$rscard=$objPer->getCargaDatos($cod_man,$via);	
while($rowcard=$objPer->NextRow($rscard)){

$des_w=$rowcard['des_w'];
$compania=$rowcard['compania'];
$guia_w=$rowcard['guia_w'];
$ccosto_w=$rowcard['ccosto'];
$ttc=$rowcard['tipocarga'];
$tipounidad=$rowcard['tipounidad'];
$cant_w=$rowcard['cant_w'];
$peso_w=$rowcard['peso_w'];
$origen_w=$rowcard['origen'];
$destino_w=$rowcard['destino'];
$distanciac=$rowcard['distancia'];
$codigo_w=$rowcard['codigo_w'];
$numorigen_w=$rowcard['numorigen'];
$numdestino_w=$rowcard['numdestino'];
$id_w=$rowcard['id_peso'];
						
$cargac1[]=array("$des_w",$compania,$guia_w,$ccosto_w,$ttc,$tipounidad,$cant_w,$peso_w,$origen_w,$destino_w,$distanciac,$codigo_w,$numorigen_w,$numdestino_w,$id_w);
}$objPer->Liberar($rscard);  
} 
$n=0;
if($v==1){
if(isset($cargac1)){
while(list($clave,$valor)=each($cargac1)){
$des_w=$valor[0];
$compania=$valor[1];
$guia_w=$valor[2];											
$ccosto_w=$valor[3];																				
$ttc=$valor[4];
$tipounidad=$valor[5];											
$cant_w=$valor[6];
$peso_w=$valor[7];
$origen_w=$valor[8];
$destino_w=$valor[9];
$distanciac=$valor[10];
$codigo_w=$valor[11];
$numorigen_w=$valor[12];
$numdestino_w=$valor[13];
$id_w=$valor[14];
?>
  <tr >
    <td><div align="center"><?=++$n;?></div></td>
    <td><div align="left">
	<? 
	if($cerrar=='0'){
	if($codigo_w!=''){?>
	<textarea class="inputoff" id="g<?=$codigo_w;?>" onFocus="Focus1(this.id, this.value)" onBlur="Blur1(this.id, this.value, 'des_w', <?=$codigo_w;?>, '<?=$cod_ruta;?>', '1', '<?=$via;?>', '<?=$clave;?>')" cols="30"><?=$des_w;?></textarea>	
	<?
	}else{ echo $des_w;}}else{echo $des_w;}
	echo $distanciac;
	?>
	</div></td>
    <td><div align="center">
	<? 
	if($cerrar=='0'){
	if($codigo_w!=''){?>
	<select class="inputoff" id="h<?=$codigo_w;?>" onFocus="Focus1(this.id, this.options[this.options.selectedIndex].value)" onBlur="Blur1(this.id, this.options[this.options.selectedIndex].value, 'compania', <?=$codigo_w;?>, '<?=$cod_ruta;?>', '1', '<?=$via;?>', '<?=$clave;?>')">        
        <?=$objPer->getCboEmpresasFact($compania);?>
      </select>
	
      <?
	  }else{ echo $compania;}}else{echo $compania;}
	  
	  ?>
    </div></td>
    <td><div align="center">
	<? 
	if($cerrar=='0'){
	if($codigo_w!=''){?>
	<input class="inputoff" id="i<?=$codigo_w;?>" onFocus="Focus1(this.id, this.value)" onBlur="Blur1(this.id, this.value, 'guia_w', <?=$codigo_w;?>, '<?=$cod_ruta;?>', '1', '<?=$via;?>', '<?=$clave;?>')" value="<?=$guia_w;?>" size="9">
      <?
	  }else{ echo $guia_w;}}else{echo $guia_w;}
	  ?>
    </div></td>
    <td><div align="center">
	
      <? 
	  if($cerrar=='0'){
	  if($codigo_w!=''){?>
      <select class="inputoff" id="j<?=$codigo_w;?>" onFocus="Focus1(this.id, this.options[this.options.selectedIndex].value)" onBlur="Blur1(this.id, this.options[this.options.selectedIndex].value, 'ccosto_w', <?=$codigo_w;?>, '<?=$cod_ruta;?>', '1', '<?=$via;?>', '<?=$clave;?>')">
        <option value="0" <? if($ccosto_w=="0"){?> selected <? }?>>Centro Costo</option>
        <?=$objPer->getCboCCostoT($ccosto_w);?>
      </select>
      <?
	  }else{ echo $ccosto_w;}}else{echo $ccosto_w;}
	  ?>
    </div></td>
    <td><div align="center">
      <? 
	  if($cerrar=='0'){
	  if($codigo_w!=''){?>
      <select class="inputoff" id="k<?=$codigo_w;?>" onFocus="Focus1(this.id, this.options[this.options.selectedIndex].value)" onBlur="Blur1(this.id, this.options[this.options.selectedIndex].value, 'origen_w', <?=$codigo_w;?>, '<?=$cod_ruta;?>', '1', '<?=$via;?>', '<?=$clave;?>')">
        <option value="0" <? if($origen_w=="0"){?> selected <? }?>>Origen</option>
        <?=$objPer->getCboOrigenMan1($numorigen_w,$cod_ruta);?>
      </select>
      <?
	  }else{ echo $origen_w;}}else{echo $origen_w;}
	  
	  ?>
    </div></td>
    <td><div align="center">
      <? 
	  if($cerrar=='0'){
	  if($codigo_w!=''){?>
      <select name="select" class="inputoff" id="f<?=$codigo_w;?>" onFocus="Focus1(this.id, this.options[this.options.selectedIndex].value)" onBlur="Blur1(this.id, this.options[this.options.selectedIndex].value, 'destino_w', <?=$codigo_w;?>, '<?=$cod_ruta;?>', '1', '<?=$via;?>', '<?=$clave;?>')">
        <option value="0" <? if($destino_w=="0"){?> selected <? }?>>Destino</option>
        <?=$objPer->getCboDestinoMan1($numdestino_w,$cod_ruta);?>
      </select>
      <?
	  }else{ echo $destino_w;}}else{echo $destino_w;}
	  
	  ?>
    </div></td>
    <td><div align="center">
	  <? 
	  if($cerrar=='0'){
	  if($codigo_w!=''){?>
	  <select class="inputoff" id="l<?=$codigo_w;?>" onFocus="Focus1(this.id, this.options[this.options.selectedIndex].value)" onBlur="Blur1(this.id, this.options[this.options.selectedIndex].value, 'ttc', <?=$codigo_w;?>, '<?=$cod_ruta;?>', '1', '<?=$via;?>', '<?=$clave;?>')">
        <option value="Int" <? if($ttc=='Int'){?> selected <? }?>>Int</option>
        <option value="Ext" <? if($ttc=='Ext'){?> selected <? }?>>Ext</option>
      </select>
	  <?
	  }else{ echo $ttc;}}else{echo $ttc;}
	  ?>
    </div></td>
    <td><div align="center">
      <? 
	  if($cerrar=='0'){
	  if($codigo_w!=''){?>
      <select class="inputoff" id="m<?=$codigo_w;?>" onFocus="Focus1(this.id, this.options[this.options.selectedIndex].value)" onBlur="Blur1(this.id, this.options[this.options.selectedIndex].value, 'tipounidad', <?=$codigo_w;?>, '<?=$cod_ruta;?>', '1', '<?=$via;?>', '<?=$clave;?>')">
        <option value="UND" <? if($tipounidad=='UND'){?> selected <? }?>>UND</option>
        <option value="KG" <? if($tipounidad=='KG'){?> selected <? }?>>KG</option>
        <option value="BULTOS" <? if($tipounidad=='BULTOS'){?> selected <? }?>>BULTOS</option>
        <option value="GAL" <? if($tipounidad=='GAL'){?> selected <? }?>>GALONES</option>
      </select>
      <?
	  }else{ echo $tipounidad;}}else{echo $tipounidad;}
	  ?>
</div></td>
    <td><div align="center">
	  <? 
	  if($cerrar=='0'){
	  if($codigo_w!=''){?>
	  <input class="inputoff" id="n<?=$codigo_w;?>" onFocus="Focus1(this.id, this.value)" onBlur="Blur1(this.id, this.value, 'cant_w', <?=$codigo_w;?>, '<?=$cod_ruta;?>', '1', '<?=$via;?>', '<?=$clave;?>')" value="<?=$cant_w;?>" size="2">
      <? }else{ echo $cant_w;}}else{echo $cant_w;}
	  $cantw=$cantw+$cant_w;
	  ?>
    </div></td>
    <td><div align="center">
	  <? 
	  if($cerrar=='0'){
	  if($codigo_w!=''){?>
	  <input class="inputoff" id="o<?=$codigo_w;?>" onFocus="Focus1(this.id, this.value)" onBlur="Blur1(this.id, this.value, 'peso_w', <?=$codigo_w;?>, '<?=$cod_ruta;?>', '1', '<?=$via;?>', '<?=$clave;?>')" value="<?=$peso_w;?>" size="2">
      <? }else{ echo $peso_w;}}else{echo $peso_w;}
	  $pesocardis=$distanciac*$peso_w;
	  $pesow=$pesow+$peso_w;
	  $pesocardist=$pesocardist+$pesocardis;
	  ?>
    </div></td>
    <td><div align="center">
	<? 
	if($cerrar=='0'){
	if($codigo_w!=''){?>
	<input name="boton_delete" type="button" id="boton_delete" value="x" onClick="DatosDeleteItemCarEdit('<?=$clave?>',<?=$codigo_w?>,'<?=$via?>','<?=$cod_man?>','<?=$cod_ruta?>',<?=$id_w?>)">
	<!-- <a href="#">	
	<img src="../imagenes/btn_eliminar.gif" width="15" height="15" border="0">
	</a> -->
	<? }else{?>
	<input name="boton_delete1" type="button" id="eliminar" value="x" onClick="DatosDeleteItemCarEdit1('<?=$clave?>','<?=$via?>','<?=$cod_man?>','<?=$cod_ruta?>',<?=$id_w?>)">
	<!-- <a href="#">
	<img src="../imagenes/btn_eliminar.gif" width="15" height="15" border="0">
	</a> -->
	<? }}?>
	</div></td>
  </tr>  
  <? }}}?>
  <tr class="lblCampo">
    <td colspan="9">                <input name="tvcom" type="hidden" value="<?=$th?>" size="4">    </td>
    <td><div align="center">
      <?//$cantw;?>
    </div></td>
    <td><div align="center">
      <?
	  $pesow;
	  $_SESSION['pesototalcarga']=$pesow;
	  $_SESSION['pesototalcardis']=$pesocardist;
	  ?>
    </div></td>
    <td>&nbsp;</td>
  </tr>
</table>
