<?php
  include("stilos/config.inc.php");
  include("clases/BDConexion.php");
  include("clases/clsClinico.php");
  include("Funciones.php");
  include("funcion/funciones.php");
  session_start();
  session_register('pedido');
  $objClinico=new clsClinico;
  $result=$objClinico->getCabTransfer($id_transfer);
  $fila=$objClinico->NextRow($result);
  $num_transfer=$fila['num_transfer'];
  $id_transfer=$fila['id_transfer'];
  $fecha=extraerfechanormal($fila['fecha']);
  $razon=$fila['razon'];
  $partida=$fila['origen'];
  $llegada=$fila['destino'];
  $marca_placa=$fila['marca_placa'];
  $num_guia=$fila['num_guia'];

  

  if ($borrar==1){
  		$pedido=array();      
   }
   if(!isset($valor)){$valor=1;}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><MMString:LoadString id="insertbar/formsHidden" /></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">

<link href="Estilos.css" rel="stylesheet" type="text/css">

<link href="stilos/Estilos.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="styless_autocomplete.css" />
<SCRIPT language=JavaScript src="js/calendario.js"></SCRIPT>
<script type="text/javascript" src="ajax.js"></script>
<script>
function ChequearTodos(chkbox)
{
for (var i=0;i < document.forms["form1"].elements.length;i++)
{
var elemento = document.forms[0].elements[i];
if (elemento.type == "checkbox")
{
elemento.checked = chkbox.checked
}
}
}
</script> 
<script language="JavaScript"> 
<!--
//sURL,x,y
function Abrir_Ventanapopup1(sURL,x,y) { 
if (!window.focus) return;
			var par;
			par = "width=" +x + ",height="+y+","
			par = par + "dependent=no,scrollbars=yes,resizable=no"
			par = par + "menubar=no,toolbar=no,status=yes"
			var ventana = window.open(sURL,"Ver",par)
			ventana.focus();
}

function Abrir_Ventanapopup2(sURL,x,y) { 
if (!window.focus) return;
			var par;
			par = "width=" +x + ",height="+y+","
			par = par + "dependent=no,scrollbars=yes,resizable=no"
			par = par + "menubar=no,toolbar=no,status=yes"
			var ventana = window.open(sURL,"Ver",par)
			ventana.focus();
} 
//-->
</script>
<? 
$envia="um_listarpedido_total.php?proveedor=$proveedor";
$envia1="um_listar_pedidoprovedit.php";
?>
<script language="JavaScript">
function volverB(form)
{
location.reload('<? echo $envia1 ?>');
}
function volver(form)
{
location.reload('<? echo $envia ?>');
}
var vent = null;
function foco() {
   if (vent != null)
       vent.focus();
}
function cerrar() {
   vent = null;
}

</script>
<script language="JavaScript">
function selecciona(form)
{
 if(form.botones1.value)
  {
   form.zonasi.disabled=true;
  }
}

function cierra(form)
{
location.reload('../ventana.php');
}
function activainter(form)
{
   form.pais2.disabled=false;
   form.ciudad2.disabled=false;
   form.nacionalidad2.disabled=false;
   form.btn_ver2.disabled=false;
   form.btn_nuevo2.disabled=false;
   
   form.pais.value="";
   form.pais.disabled=true;
   form.ciudad.value="";
   form.ciudad.disabled=true;
   form.nacionalidad.value="";
   form.nacionalidad.disabled=true;
   form.idciudad1.value="";
   form.btn_ver1.disabled=true;
   form.btn_nuevo1.disabled=true;
}
</script>
<SCRIPT LANGUAGE=javascript>
function fn(form,field)
{
var next=0, found=false
var f=form
if(event.keyCode!=13) return;
for(var i=0;i<f.length;i++) {
if(field.name==f.item(i).name){
next=i+1;
found=true
break;
}
}
while(found){
if( f.item(next).disabled==false && f.item(next).type!='hidden'){
f.item(next).focus();
break;
}
else{
if(next<f.length-1)
next=next+1;
else
break;
}
}
}
</SCRIPT>
<script language="JavaScript">
   function Enviar()
{
     var fecha = window.document.form1.fecha.value;
   	 var proveedor = window.document.form1.proveedor.value;
     var id_prov = window.document.form1.id_prov.value;
     var medicina = window.document.form1.medicina.value;
     var cod_med = window.document.form1.cod_med.value;
   	 var cantidad = window.document.form1.cantidad.value;
	 var um = window.document.form1.um.value;
	 var stock = window.document.form1.stock.value;
	 var costo = window.document.form1.costo.value;
	 var obser = window.document.form1.obser.value;
	 var id_medpedet = window.document.form1.id_medpedet.value;
	 var id_medped = window.document.form1.id_medped.value;
	 if (form1.medicina.value==""){
     alert("No Eligió un medicamento");
	 form1.medicina.focus();
	 return;
	 }else if(form1.cantidad.value==""){
	 alert("No Eligió la cantidad");
	 form1.cantidad.focus();
     }else{
	 window.location ="procesos/cvp_medped_agregarItem_edit.php?fecha="+fecha+"&proveedor="+proveedor+"&id_prov="+id_prov+"&medicina="+medicina+"&cod_med="+cod_med+"&cantidad="+cantidad+"&um="+um+"&stock="+stock+"&costo="+costo+"&obser="+obser+"&id_medped="+id_medped+"&id_medpedet="+id_medpedet;
	 }

}

function Enviar1()
  
{
   var existe='<?php echo contarItem ?>';
   if (form1.fecha.value==""){
     alert("No Eligio una Fecha");
	 form1.fecha.focus();
	 return;
      }
	 	  	  

   if (form1.btn_grabar){form1.submit()}
}
function Enviar2(){
		window.location="cvp_charlas_a_per.php?borrar=1";
               }
</script>
<script language="JavaScript">
function Datos(clave,id_medpedet){
	 var fecha = window.document.form1.fecha.value;
   	 var proveedor = window.document.form1.proveedor.value;
     var id_prov = window.document.form1.id_prov.value;
     var obser = window.document.form1.obser.value;
	 var id_medped = window.document.form1.id_medped.value;
	 window.location="procesos/um_borrarItem_pedmed_edit.php?clave="+clave+"&id_medpedet="+id_medpedet+"&fecha="+fecha+"&proveedor="+proveedor+"&id_prov="+id_prov+"&obser="+obser+"&id_medped="+id_medped;
     }
function EnviarD1(){	
	var fecha = window.document.form1.fecha.value;
   	var proveedor = window.document.form1.proveedor.value; 
	var id_prov = window.document.form1.id_prov.value; 
	var obser = window.document.form1.obser.value;    
	window.location ="um_ver_prov.php?fecha="+fecha+"&proveedor="+proveedor+"&id_prov="+id_prov+"&obser="+obser;
    }
function EnviarD2(){	
	var fecha = window.document.form1.fecha.value;
   	var proveedor = window.document.form1.proveedor.value; 
	var id_prov = window.document.form1.id_prov.value;   
	var obser = window.document.form1.obser.value; 
	window.location ="um_nueva_prov.php?fecha="+fecha+"&proveedor="+proveedor+"&id_prov="+id_prov+"&obser="+obser;
    }

</script>
<script language="JavaScript">
function poner_imagen()
{
imagen1=new Image;
imagen1.src=document.form1.foto.value;
document.imagenes['foto'].src=imagen1.src;
}
</script>
<!-- Copyright 2000,2001 Macromedia, Inc. All rights reserved. -->
<!-- Copyright 2000,2001 Macromedia, Inc. All rights reserved. -->
<!-- Copyright 2000,2001 Macromedia, Inc. All rights reserved. -->
<script language="JavaScript" type="text/JavaScript">
function MensajeEditar(m){
if (m==1){window.alert("Se Creo un Pedido Nuevo satisfactoriamente")}
}
</script>
</head>
<body onLoad='javascript:print();'>
	
<table width="740" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr valign="top" >
    <td height="25" colspan="4">
    <div align="left" >      
      <table width="690" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><div align="center">TRANSFERENCIA DE MEDICINAS </div></td>
        </tr>
        <tr>
          <td><div align="center">
            <table width="679" border="0" cellspacing="0" cellpadding="0">
              <tr class="lblCampo">
                <td width="167" height="18"><div align="left">Fecha Ingreso </div></td>
                <td width="6"><div align="left">:</div></td>
                <td colspan="3"><div align="left"> </div>
                    <?=$fecha?>
                </td>
              </tr>
              <tr class="lblCampo">
                <td height="18"><div align="left">Numero de Guia </div></td>
                <td>:</td>
                <td width="282"><div align="left">
                    <?=$num_guia?>
                </div></td>
                <td width="125"><div align="left">
                    <!-- <input type="button" name="Submit244" value="buscar" style="<?=$stylo['st2']?>" class="botira" onClick="javascript:EnviarD1()"/>
                        <input type="button" name="Submit2442" value="nuevo" style="<?=$stylo['st2']?>" class="botira" onClick="javascript:EnviarD2()"/> -->
                </div></td>
                <td width="99"><div align="center"> </div></td>
              </tr>
              <tr class="lblCampo">
                <td height="18"><div align="left">Denominacion</div></td>
                <td>&nbsp;</td>
                <td><div align="left">
                    <?=$razon?>
                </div></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr class="lblCampo">
                <td height="18"><div align="left">Almacen Origen </div></td>
                <td>&nbsp;</td>
                <td><div align="left">
                    <?=$partida?>
                </div></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr class="lblCampo">
                <td height="18"><div align="left">Almacen Destino </div></td>
                <td>&nbsp;</td>
                <td><div align="left">
                    <?=$llegada?>
                </div></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr class="normal">
                <td colspan="5">
                  <hr align="left" size="1" color="#000000">
                </td>
              </tr>
              <tr class="normal">
                <td colspan="5">
                  <div align="center">
                    <table width="660" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td colspan="6"><div id="lista"></div></td>
                      </tr>
                      <tr>
                        <td colspan="6">
                          <table width="710" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="<?=$bordetabla?>" bgcolor="<?=$c_fondo['fondo tabla']?>" style="<?=$stylo['tabla']?>">
                            <tr bordercolor="#000000" bgcolor="#999999">
                              <td width="42" class="rdoBanners"><div align="center">N&ordm;</div></td>
                              <td width="153" class="rdoBanners"><div align="center">Codigo</div></td>
                              <td width="288" class="rdoBanners"><div align="center">Medicina</div></td>
                              <td width="77" class="rdoBanners"><div align="center">UM</div></td>
                              <td width="73" class="rdoBanners"><div align="center">Cantidad</div></td>
                              <td width="62" class="rdoBanners"><div align="center">Costo</div></td>
                            </tr>
                            <?				
								$resultado=$objClinico->getDetTransfer($id_transfer);
								while($filas=$objClinico->NextRow($resultado)){
								$n++;
 								 ?>
                            <tr>
                              <td class="lblReporte"><?php echo $n;//echo ($clave + 1)?></td>
                              <td class="lblReporte" align="left"><div align="center"><?php echo $filas['codigo_med']?></div></td>
                              <td class="lblReporte"><div align="left"><?php echo $filas['medicina']?> </div></td>
                              <td class="lblReporte"><div align="center"><?php echo $filas['um']?></div></td>
                              <td class="lblReporte"><div align="center">
                                  <?=$filas['cantidad']?>
                              </div></td>
                              <td class="lblReporte"><div align="right"><?php echo $filas['costo']?></div></td>
                            </tr>
                            <? 
								}
								$objClinico->Liberar($resultado);			
								?>
                            <tr>
                              <td class="lblReporte">&nbsp;</td>
                              <td class="lblReporte" align="left">&nbsp;</td>
                              <td colspan="2" class="lblReporte"><div align="right"></div></td>
                              <td class="lblReporte"><div align="center"></div></td>
                              <td class="lblReporte"><div align="right"></div></td>
                            </tr>
                        </table></td>
                      </tr>
                      <tr>
                        <td width="258">&nbsp;</td>
                        <td colspan="5">&nbsp;</td>
                      </tr>
                      <tr>
                        <td width="78" colspan="2">&nbsp;</td>
                        <td width="76">&nbsp;</td>
                        <td width="82">&nbsp;</td>
                        <td width="234" colspan="2">&nbsp;</td>
                      </tr>
                    </table>
                </div></td>
              </tr>
            </table>
          </div></td>
        </tr>
      </table>
    </div></td>
  </tr>
  <tr class="lblCampo" >
    <td colspan="4"><div align="center">
        
    </div></td>
  </tr>
  <tr valign="top" class="lblCampo" >
    <td colspan="4">
    <div align="center"> </div></td>
  </tr>
</body>
</html>

