<?php

	require_once "../php/conexion.php";
	$conexion=conexion();

 ?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Bitacora Amazon</title>


<link rel="stylesheet" type="text/css" href="../librerias/bootstrap/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="../librerias/alertifyjs/css/alertify.css">
<link rel="stylesheet" type="text/css" href="../librerias/alertifyjs/css/themes/default.css">

</head>
<body>
<header>
<h2> Bitacora de Registro Amazon</h2>

  <table class="table table-hover table-condensed table-bordered">

		<tr style="text-align:center;">

<!--0-->					<td>ID</td>
<!--1-->					<td>PO#</td>
<!--2-->          <td>SO#</td>
<!--3-->          <td>Ship-Date</td>
<!--4-->          <td>Scanlist-Date</td>
<!--5-->          <td>Part#</td>
<!--6-->          <td>Part-Desc</td>
<!--7-->          <td>Part-Type</td>
<!--8-->          <td>Qty</td>
<!--9-->          <td>Unite-Price</td>
<!--10-->         <td>Total-Price</td>
<!--11-->         <td>Case#</td>
<!--12-->         <td>Dim/Peso</td>
<!--13-->         <td>COO</td>
<!--14-->         <td>Invoice#</td>
<!--15-->         <td>Carrier</td>
<!--16-->         <td>TrackID</td>
<!--17-->         <td>Man/Way</td>
<!--18-->         <td>ShipTo</td>
<!--19-->         <td>CountryTo</td>
<!--20-->         <td>MOT</td>
<!--21-->         <td>Ship-Address</td>
<!--22-->         <td>Ship-Time</td>
<!--23-->         <td>Scanlist-Time</td>
<!--24-->         <td>Seal</td>
<!--25-->         <td>Scanlist</td>
<!--26-->         <td>Scanlist-Transmitted</td>
<!--27-->         <td>Service-Level</td>
<!--28-->         <td>Sap-Inovice</td>
<!--29-->         <td>UserID</td>
<!--30-->         <td>AssetID</td>
<!--31-->         <td>Unit-Serial</td>
<!--32-->         <td>Eco-Remolque</td>
<!--33-->         <td>Eta-Comitted</td>
<!--34-->         <td>Arrival-Date</td>
<!--35-->         <td>Est-Delivery</td>
<!--36-->         <td>Re-Program</td>
<!--37-->         <td>Uncreate</td>
<!--38-->         <td>Delivery-Date</td>
<!--39-->         <td>Signed-By</td>
<!--40-->         <td>Pod-File</td>
<!--41-->         <td>Is-Order</td>
<!--42-->         <td>DCO</td>
<!--43-->         <td>Accidente-Imputable/(No pagar flete)</td>
<!--44-->         <td>Real-Delivery</td>
<!--45-->         <td>Factura-Pagada</td>
<!--46-->         <td>Invoice-Sumary</td>
<!--47-->         <td>Fecha-Resumen</td>
<!--48-->         <td>Costo</td>
<!--49-->         <td>Comentarios</td>
<!--50-->					<td>Crear Cartas</td>
<!--51-->         <td>Editar</td>
<!--52-->				  <td>Eliminar</td>
		</tr>


          <?php

          $po=$_GET['po'];
          $shipdate=$_GET['ship'];
          $scanlistDate=$_GET['scan'];
          $partDesc=$_GET['part'];
          $assetID=$_GET['asset'];
          $unitserial=$_GET['unit'];
          $trackID=$_GET['track'];
          $shipAddress=$_GET['address'];
          $transmitted=$_GET['k'];
          $countryto=$_GET['e'];
          $carrier=$_GET['f'];
          $partType=$_GET['a'];

					mysqli_set_charset($conexion, "utf8");
             	$sql= "SELECT id,po,so,shipdate,scanlistDate,part,partDesc,partType,qty,unitPrice,
						totalPrice,caseNum,dimepeso,coo,invoice,carrier,trackID,manway,shipto,countryto,
						mot,shipAddress,shipTime,scanlistime,seal,scanlist,transmitted,servicelevel,sapinvoice,
						userID,assetID,unitserial,eco,eta,arrival,est,reprogram,uncreate,delivery,signed,pod,isorder,
						dco,accidente,realDelivery,factura,invoiceSumari,fecha,costo,comentarios from t_persona WHERE	po  LIKE '%$po%'
             	AND shipdate  LIKE '%$shipdate%'
             	AND scanlistDate LIKE '%$scanlistDate%'
             	AND part LIKE '%$partDesc%'
             	AND partType LIKE '%$partType%'
             	AND carrier LIKE '%$carrier%'
             	AND trackID LIKE '%$trackID%'
             	AND countryto LIKE '%$countryto%'
             	AND shipAddress LIKE '%$shipAddress%'
             	AND transmitted LIKE '%$transmitted%'
             	AND assetID LIKE '%$assetID%'
             	AND unitserial LIKE '%$unitserial%'
             	  ";

								$result = mysqli_query($conexion,$sql) or die(mysqli_error($conexion));
						while($ver=mysqli_fetch_row($result)){

							$datos=$ver[0]."||". $ver[1]."||". $ver[2]."||". $ver[3]."||". $ver[4]."||". $ver[5]."||". $ver[6]."||". $ver[7]."||". $ver[8]."||". $ver[9]."||". $ver[10]."||". $ver[11]."||". $ver[12]."||". $ver[13]."||". $ver[14]."||". $ver[15]."||". $ver[16]."||". $ver[17]."||". $ver[18]."||". $ver[19]."||". $ver[20]."||". $ver[21]."||". $ver[22]."||". $ver[23]."||". $ver[23]."||". $ver[25]."||". $ver[26]."||". $ver[27]."||". $ver[28]."||". $ver[29]."||". $ver[30]."||". $ver[31]."||". $ver[32]."||". $ver[33]."||".$ver[34]."||". $ver[35]."||". $ver[36]."||". $ver[37]."||". $ver[38]."||". $ver[39]."||". $ver[40]."||".$ver[41]."||". $ver[42]."||". $ver[43]."||". $ver[44]."||". $ver[45]."||". $ver[46]."||". $ver[47]."||". $ver[48]."||".  $ver[49];

					 ?>

					<tr>
		<!--0-->					<td><?php echo $ver[0]?></td>
		<!--1-->					<td><?php echo $ver[1]?></td>
		<!--2-->					<td><?php echo $ver[2]?></td>
		<!--3-->					<td><?php echo $ver[3]?></td>
		<!--4-->					<td><?php echo $ver[4]?></td>
		<!--5-->				  <td><?php echo $ver[5]?></td>
		<!--6-->					<td><?php echo $ver[6]?></td>
		<!--7-->					<td><?php echo $ver[7]?></td>
		<!--8-->					<td><?php echo $ver[8]?></td>
		<!--9-->				  <td><?php echo $ver[9]?></td>
		<!--10-->				  <td><?php echo $ver[10]?></td>
		<!--11-->				  <td><?php echo $ver[11]?></td>
		<!--12-->					<td><?php echo $ver[12]?></td>
		<!--13-->					<td><?php echo $ver[13]?></td>
		<!--14-->					<td><?php echo $ver[14]?></td>
		<!--15-->					<td><?php echo $ver[15]?></td>
		<!--16-->				  <td><?php echo $ver[16]?></td>
		<!--17-->				  <td><?php echo $ver[17]?></td>
		<!--18-->					<td><?php echo $ver[18]?></td>
		<!--19-->					<td><?php echo $ver[19]?></td>
		<!--20-->					<td><?php echo $ver[20]?></td>
		<!--21-->				  <td><?php echo $ver[21]?></td>
		<!--22-->					<td><?php echo $ver[22]?></td>
		<!--23-->					<td><?php echo $ver[23]?></td>
		<!--24-->					<td><?php echo $ver[24]?></td>
		<!--25-->					<td><?php echo $ver[25]?></td>
		<!--26-->					<td><?php echo $ver[26]?></td>
		<!--27-->					<td><?php echo $ver[27]?></td>
		<!--28-->					<td><?php echo $ver[28]?></td>
		<!--29-->					<td><?php echo $ver[29]?></td>
		<!--30-->					<td><?php echo $ver[30]?></td>
		<!--31-->					<td><?php echo $ver[31]?></td>
		<!--32-->					<td><?php echo $ver[32]?></td>
		<!--33-->					<td><?php echo $ver[33]?></td>
		<!--34-->					<td><?php echo $ver[34]?></td>
		<!--35-->					<td><?php echo $ver[35]?></td>
		<!--36-->					<td><?php echo $ver[36]?></td>
		<!--37-->					<td><?php echo $ver[37]?></td>
		<!--38-->					<td><?php echo $ver[38]?></td>
		<!--39-->					<td><?php echo $ver[39]?></td>
		<!--40-->					<td><?php echo $ver[40]?></td>
		<!--41-->				  <td><?php echo $ver[41]?></td>
		<!--42-->				  <td><?php echo $ver[42]?></td>
		<!--43-->				  <td><?php echo $ver[43]?></td>
		<!--44-->				  <td><?php echo $ver[44]?></td>
		<!--45-->				  <td><?php echo $ver[45]?></td>
		<!--46-->				  <td><?php echo $ver[46]?></td>
		<!--47-->				  <td><?php echo $ver[47]?></td>
		<!--48-->				  <td><?php echo $ver[48]?></td>
		<!--49-->			   	<td><?php echo $ver[49]?></td>

		<td>
		<button class="btn btn-info" data-toggle="modal" data-target="#modalDesc" onclick="deascarga('<?php echo $datos ?>')">
		Descargar <span class="glyphicon glyphicon-download"></span>
		</button>
		</td>
		<!-- Modal para descargar datos -->

		<div class="modal fade" id="modalDesc" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
		  <div class="modal-dialog" role="document">
		    <div class="modal-content">
		      <div class="modal-header">
		        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
		        <h4 class="modal-title" style=" text-align:center;">Descargar Carta de Instruccion</h4>
						<p style="background:rgba(241, 46, 45, 0.66); text-align:center;">Favor de Verificar Los Datos que se Van a descargar&hellip;</p>
		      </div>

		      <div class="modal-body col-xs-12 col-sm-12">
						<div class="col-xs-12 col-sm-6">
							<form class="formDesc" action="archivoDesc.php" method="post">

							<input type="text" hidden="" id="idpersona" name="">

							<label>Factura:</label>
							<input class="form-control" type="text" id="facturaIn" name="facturaIn" placeholder="Numero de Factura">

							<label>Fecha Factura: </label>
							<input class="form-control" type="date" id="fechaF" placeholder="Fecha de Factura" name="fechaF" >

							<label>Direccion: </label>
							<input class="form-control" type="text" id="direccion" name="direccion"placeholder="Direccion a donde se Dirige">

							<label> AWB:</label>
							<input class="form-control" type="text" id="AWB" placeholder="Numero de TrackID" name="AWB">

							<label>Carrier: </label>
							<input class="form-control" type="text" id="carrier" placeholder="Tipo de Carrier" name="carrier">

							<label>Orden: </label>
							<input class="form-control" type="text" id="orden" placeholder="Num de Orden" name="orden">

							<label>Descripcion: </label>
							<input class="form-control" type="text" id="descripcion" placeholder="Descripcion del Material" name="descripcion">

							<label>#Parte: </label>
							<input class="form-control" type="text" id="parte" placeholder="Numnero de Parte" name="parte">

		        </div>
						<div class="col-xs-12 col-sm-6">
							<label>Cantidad: </label>
							<input class="form-control" type="text" id="cantidad" placeholder="Cantidad" name="cantidad" >

							<label>Precio unit: </label>
							<input class="form-control" type="text" id="precio" placeholder="Precio Unitario" name="precio">

							<label>V. Factura: </label>
							<input class="form-control" type="text" id="vfact" placeholder="Valor de Factura" name="vfact">

							<label>Peso Neto:</label>
							<input class="form-control" type="text" id="peso" placeholder="Peso Neto" name="peso">

							<label>Nivel de servicio:
								<select  class="form-control input-sm" id="nivel" name="nivel"
									<option value=""></option>
									<option value="zz">ZZ</option>
									<option value="o6">6</option>
								</select>
							</label>

							<label>Destino:
								<select  class="form-control input-sm" id="compaDes" name="compaDes">
									<option value=""></option>
									<option value="PHL">ISH-PHL</option>
									<option value="SFO">ISH-SFO</option>
									<option value="IAD">IAD22</option>
									<option value="SYD">SYD51</option>
									<option value="CMH">CMH52</option>
									<option value="GRU">GRU50</option>
									<option value="YUL">YUL51</option>
								</select>
							</label>

							<label>Para:
								<select  class="form-control input-sm" id="aduana" name="aduana">
									<option value=""></option>
									<option value="Fedex">Elizabeth Montiel</option>
									<option value="Adualink">Eduardo de la Peña</option>
								</select>
							</label>

							<label>Compañia Transportista :
								<select  class="form-control input-sm" id="compTrans" name="compTrans">
									<option value=""></option>
									<option value="Fedex">Fedex</option>
									<option value="Adualink">Adualink</option>
								</select>
							</label>

							<label>Des Español :
								<select  class="form-control input-sm" id="dscrip" name="dscrip">
									<option value=""></option>
									<option value="MEMORIA">UNIDAD DE MEMORIA (DISCO DURO)</option>
									<option value="UNIDAD">UNIDAD DE PROCESAMIENTO DIGITAL</option>
								</select>
							</label>
		        </div>
		      </div>
		      <div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
			        <button type="button" class="btn btn-primary" id="descargar" name="descargar" data-dismiss="modal">Aceptar</button>
						</form>
		      </div>
		    </div><!-- /.modal-content -->
		  </div><!-- /.modal-dialog -->
		</div><!-- /.modal -->

		<td>
		<button class="btn btn-success" data-toggle="modal" data-target="#modalEdicion" onclick="agregaform('<?php echo $datos ?>')">
		Editar <span class="glyphicon glyphicon-refresh"></span>
		</button>
		</td>

		<div class="modal fade" id="modalEdicion" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
		  <div class="modal-dialog modal-lg" role="document">
		    <div class="modal-content">
		      <div class="modal-header">
		        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
		        <h4 class="modal-title" style=" text-align:center;" id="myModalLabel">Actualizar datos</h4>
		      </div>
		      <div class="modal-body col-xs-12 col-sm-12">
						<div class="col-xs-12 col-sm-6">
							<input type="text" hidden="" id="idpersona" name="">

							<label>ECO Remolque/Reparacion Menor: </label>
							<input class="form-control" type="text" id="Eco" name="" placeholder="ECO Remolque" >

							<label>Eta Comitted: </label>
							<input class="form-control" type="date" id="Eta" name="" >

							<label>Arrival Date "Real": </label>
							<input class="form-control" type="date" id="Arrival" name="">

							<label>Est Delivery Date: </label>
							<input class="form-control" type="date" id="EstDelivery" name="" >

							<label>Re-Programacion: </label>
							<input class="form-control" type="date" id="Programacion" name="" >

							<label>Uncreate Tracking: </label>
							<input class="form-control" type="date" id="Uncreate" name="">

							<label>Delivery Date: </label>
							<input class="form-control" type="date" id="Delivery" name="">

							<label>Signed By: </label>
							<input class="form-control" type="text" id="Signed" name="" placeholder="Signed By" >

							<label>POD File: </label>
							<input class="form-control" type="text" id="pod" name="" placeholder="POD File">

							<label>IS Order: </label>
							<input class="form-control" type="text" id="isOR" name="" placeholder="IS Order" >

		          </div>
						  <div class="col-xs-12 col-sm-6">
							<label>IS Order: </label>
							<input class="form-control" type="text" id="isOR" name="" placeholder="IS Order" >

							<label>DCO: </label>
							<input class="form-control" type="text" id="dco" name="" placeholder="DCO" >

							<label>Accidente Imputable/(No pagar flete): </label>
							<input class="form-control" type="text" id="Accidente" name="" placeholder="Accidente Imputable" >

							<label>Real Delivery Date: </label>
							<input class="form-control" type="date" id="realD" name="">

							<label>Factura Pagada: </label>
							<input class="form-control" type="text" id="factura" name="" placeholder="Factura Pagada" >

							<label>Invoice Sumary: </label>
							<input class="form-control" type="text" id="Invoice" name="" placeholder="Invoice Sumary" >

							<label>Fecha Resumen Factura: </label>
							<input class="form-control" type="date" id="FechaRes" name="">

							<label>Costo Factura: </label>
							<input class="form-control" type="text" id="Costo" name="" placeholder="Costo Factura" >

							<label>Comentarios: </label>
							<textarea class="form-control" id="Comentarios" placeholder="Comentarios" name=""></textarea><br>

		        </div>
					</div>
		      <div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
		        <button type="button" class="btn btn-primary" id="actualizadatos" data-dismiss="modal">Actualizar</button>

		      </div>
		    </div>
		  </div>
		</div>

		<td>
		<button class="btn btn-danger glyphicon glyphicon-trash" onclick="preguntarSiNo('<?php echo $ver[0] ?>')"></button>
		</td>
		</tr>
				<?php
				}
					?>
				</table>
			</div>
		</div>

	
