<?php
include("session.php");
             include("conexion.php");
                                             
$query="SELECT `orden_pedido`, id_item FROM `importado_items`";
    $resultadoc=$conexion->query($query);
   while($row1=$resultadoc->fetch_assoc())
   {

$pedido=$row1['orden_pedido'];
$id=$row1['id_item'];

$queryi="SELECT `id_pedido` FROM `importado` where id_pedido='$pedido'";
    $resultadoi=$conexion->query($queryi);
$rowi=$resultadoi->fetch_assoc();

if ($pedido!=$rowi['id_pedido']) {
 
 $querye="DELETE FROM `importado_items` WHERE `id_item`='$id'";
 $resultadoce=$conexion->query($querye);
}


}

?>
<!DOCTYPE html>
<html>


  <?php

   include("head.php"); ?>
<body>
    <div id="wrapper">
       <?php
        include ("menu.php");
       ?>

        <div id="page-wrapper" class="gray-bg dashbard-1">
        <div class="row border-bottom">
        <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
        <div class="navbar-header">
            <a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a>
            
        </div>
            <ul class="nav navbar-top-links navbar-right">

                <li>
                    <a href="index.php">
                    
                        <i class="fa fa-sign-in"></i> Salir
                    </a>
                </li>
                
            </ul>

        </nav>
        </div>
               
      <div class="row">
            <div class="col-lg-12">
                 <div class="ibox float-e-margins">
                    
                          <div class="ibox-title">
                            <div class="pull-right">
                              <div class="row">
                                <div class="col-md-6">
                                      <?php 
                                             if ($_SESSION["roles"]==1 || $_SESSION["roles"]==2) {
                                             ?>   
                                <button class="btn btn-primary" data-toggle="modal" data-target="#myModal">Nuevo Fichero</button>
                                   <?php 
                                            }
                                             ?> 

                                             </div>
                              <div class="col-md-6" >               
                              </div>
                            </div>

                                </div>
                                
                                <h5>Ficheros</h5>
                                
                        </div>
                        </div>
                      
                        <div class="col-lg-12">
                          <div class="row">
                          <div class="col-md-4">
                            <div class="ibox-content">
                                <div class="table-responsive">
                                    <table class="table">
                                        <thead class="thead-dark">
                                          <tr>
                                            <th><strong>Remarks</strong></th>
                                              <?php 
                                               if ($_SESSION["roles"]==1 || $_SESSION["roles"]==2) {
                                              ?>                  
                                              <th style="width: 5%">Editar</th>

                                              <?php if ($_SESSION["roles"]==1) {
                                              ?>
                                              <th style="width: 5%">Eliminar</th>

                                              <?php
                                                }
                                                }
                                              ?>
                                          </tr>
                                        </thead>


                                      <tbody>
                                        <?php 
                                             include("conexion.php");

                                             $query="SELECT `id_remarks`, `nombre_remarks` FROM `remarks`";
                                                  $resultadoc=$conexion->query($query);
                                                  while ($rowc=$resultadoc->fetch_assoc()) {
                                              ?>
                                         <tr>
                                            
                                            <td style="font-size:11px"><?php echo strtoupper($rowc['nombre_remarks']); ?></td>
                                             <?php 
                                             if ($_SESSION["roles"]==1 || $_SESSION["roles"]==2) {
                                             ?>                  
                                           <td><a href="ficheros.php?id_remarks=<?php echo $rowc['id_remarks'] ?>"><i class="fa fa-edit"></i></a></td>

                                            <?php if ($_SESSION["roles"]==1) {
                                              ?>
                                            <td><a href="eliminar_reg_remark.php?id_remarks=<?php echo $rowc['id_remarks'] ?>"><i class="fa fa-trash"></i></a></td>

                                            <?php
                                          }
                                          }
                                          ?>  
                                        </tr>

                                         <?php 
                                            }
                                          ?>

                                      </tbody>
                                    </table>
                                  </div>
                                </div>
                                </div>
                         

                                <div class="col-md-4">
                                  <div class="ibox-content">
                                    <div class="table-responsive">
                                      <table class="table">
                                        <thead class="thead-dark">
                                          <tr>
                                            <th><strong>Embalaje</strong></th>
                                              <?php 
                                               if ($_SESSION["roles"]==1 || $_SESSION["roles"]==2) {
                                              ?>                  
                                              <th style="width: 5%">Editar</th>

                                              <?php if ($_SESSION["roles"]==1) {
                                              ?>
                                              <th style="width: 5%">Eliminar</th>

                                              <?php
                                                }
                                                }
                                              ?>
                                          </tr>
                                        </thead>


                                      <tbody>
                                        <?php 
                                             include("conexion.php");

                                             $query="SELECT `id_embalaje`, `nombre_embalaje` FROM `embalaje`";
                                                  $resultadoc=$conexion->query($query);
                                                  while ($rowc=$resultadoc->fetch_assoc()) {
                                              ?>
                                         <tr>
                                            <td style="font-size:11px"><?php echo strtoupper($rowc['nombre_embalaje']); ?></td>
                                             <?php 
                                             if ($_SESSION["roles"]==1 || $_SESSION["roles"]==2) {
                                             ?>                  
                                           <td><a href="ficheros.php?id_embalaje=<?php echo $rowc['id_embalaje'] ?>"><i class="fa fa-edit"></i></a></td>

                                            <?php if ($_SESSION["roles"]==1) {
                                              ?>
                                            <td><a href="eliminar_reg_embalaje.php?id_embalaje=<?php echo $rowc['id_embalaje'] ?>"><i class="fa fa-trash"></i></a></td>

                                            <?php
                                          }
                                          }
                                          ?>  
                                        </tr>

                                         <?php 
                                            }
                                          ?>

                                      </tbody>
                                    </table>
                                   </div>
                                </div>
                            </div>

                            <div class="col-md-4">
                            <div class="ibox-content">
                              <div class="table-responsive">
                                      <table class="table">
                                        <thead class="thead-dark">
                                          <tr>
                                            <th><strong>Forma de Pago</strong></th>
                                              <?php 
                                               if ($_SESSION["roles"]==1 || $_SESSION["roles"]==2) {
                                              ?>                  
                                              <th style="width: 5%">Editar</th>

                                              <?php if ($_SESSION["roles"]==1) {
                                              ?>
                                              <th style="width: 5%">Eliminar</th>

                                              <?php
                                                }
                                                }
                                              ?>
                                          </tr>
                                        </thead>


                                      <tbody>
                                        <?php 
                                             include("conexion.php");

                                             $query="SELECT `id_forma_de_pago`, `nombre_forma_de_pago` FROM `forma_de_pago`";
                                                  $resultadoc=$conexion->query($query);
                                                  while ($rowc=$resultadoc->fetch_assoc()) {
                                              ?>
                                         <tr>
                                            <td style="font-size:11px"><?php echo strtoupper($rowc['nombre_forma_de_pago']); ?></td>
                                             <?php 
                                             if ($_SESSION["roles"]==1 || $_SESSION["roles"]==2) {
                                             ?>                  
                                           <td><a href="ficheros.php?id_forma_de_pago=<?php echo $rowc['id_forma_de_pago'] ?>"><i class="fa fa-edit"></i></a></td>

                                            <?php if ($_SESSION["roles"]==1) {
                                              ?>
                                            <td><a href="eliminar_reg_forma_de_pago.php?id_forma_de_pago=<?php echo $rowc['id_forma_de_pago'] ?>"><i class="fa fa-trash"></i></a></td>

                                            <?php
                                          }
                                          }
                                          ?>  
                                        </tr>

                                         <?php 
                                            }
                                          ?>

                                      </tbody>
                                    </table>
                                   </div>

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

                        
                        
                            <div class="col-lg-12">
                              <div class="row">
                            <div class="col-md-4">
                            <div class="ibox-content">
                              <div class="table-responsive">
                                      <table class="table">
                                        <thead class="thead-dark">
                                          <tr>
                                            <th><strong>Paises Destinos</strong></th>
                                              <?php 
                                               if ($_SESSION["roles"]==1 || $_SESSION["roles"]==2) {
                                              ?>                  
                                              <th style="width: 5%">Editar</th>

                                              <?php if ($_SESSION["roles"]==1) {
                                              ?>
                                              <th style="width: 5%">Eliminar</th>

                                              <?php
                                                }
                                                }
                                              ?>
                                          </tr>
                                        </thead>


                                      <tbody>
                                        <?php 
                                             include("conexion.php");

                                             $query="SELECT `id_destino`, `nombre_destino` FROM `destino`";
                                                  $resultadoc=$conexion->query($query);
                                                  while ($rowc=$resultadoc->fetch_assoc()) {
                                              ?>
                                         <tr>
                                            <td style="font-size:11px"><?php echo strtoupper($rowc['nombre_destino']); ?></td>
                                             <?php 
                                             if ($_SESSION["roles"]==1 || $_SESSION["roles"]==2) {
                                             ?>

                                                       
                                           <td><a href="ficheros.php?id_destino=<?php echo $rowc['id_destino'] ?>"><i class="fa fa-edit"></i></a></td>

                                            <?php if ($_SESSION["roles"]==1) {
                                              ?>
                                            <td><a href="eliminar_reg_destino.php?id_destino=<?php echo $rowc['id_destino'] ?>"><i class="fa fa-trash"></i></a></td>

                                            <?php
                                          }
                                          }
                                          ?>  
                                        </tr>

                                         <?php 
                                            }
                                          ?>

                                      </tbody>
                                    </table>
                                   </div>

                            </div>
                            </div>

                            <div class="col-md-4">
                            <div class="ibox-content">
                              <div class="table-responsive">
                                      <table class="table">
                                        <thead class="thead-dark">
                                          <tr>
                                            <th><strong>Paise de Origen</strong></th>
                                              <?php 
                                               if ($_SESSION["roles"]==1 || $_SESSION["roles"]==2) {
                                              ?>                  
                                              <th style="width: 5%">Editar</th>

                                              <?php if ($_SESSION["roles"]==1) {
                                              ?>
                                              <th style="width: 5%">Eliminar</th>

                                              <?php
                                                }
                                                }
                                              ?>
                                          </tr>
                                        </thead>


                                      <tbody>
                                        <?php 
                                             include("conexion.php");

                                             $query="SELECT `id_origen`, `nombre_origen` FROM `origen`";
                                                  $resultadoc=$conexion->query($query);
                                                  while ($rowc=$resultadoc->fetch_assoc()) {
                                              ?>
                                         <tr>
                                            <td style="font-size:11px"><?php echo strtoupper($rowc['nombre_origen']); ?></td>
                                             <?php 
                                             if ($_SESSION["roles"]==1 || $_SESSION["roles"]==2) {
                                             ?>                  
                                           <td><a href="ficheros.php?id_origen=<?php echo $rowc['id_origen'] ?>"><i class="fa fa-edit"></i></a></td>

                                            <?php if ($_SESSION["roles"]==1) {
                                              ?>
                                            <td><a href="eliminar_reg_origen.php?id_origen=<?php echo $rowc['id_origen'] ?>"><i class="fa fa-trash"></i></a></td>

                                            <?php
                                          }
                                          }
                                          ?>  
                                        </tr>

                                         <?php 
                                            }
                                          ?>

                                      </tbody>
                                    </table>
                                   </div>

                            </div>
                            </div>


                            <div class="col-md-4">
                            <div class="ibox-content">
                              <div class="table-responsive">
                                      <table class="table">
                                        <thead class="thead-dark">
                                          <tr>
                                            <th><strong>DELIVERY</strong></th>
                                              <?php 
                                               if ($_SESSION["roles"]==1 || $_SESSION["roles"]==2) {
                                              ?>                  
                                              <th style="width: 5%">Editar</th>

                                              <?php if ($_SESSION["roles"]==1) {
                                              ?>
                                              <th style="width: 5%">Eliminar</th>

                                              <?php
                                                }
                                                }
                                              ?>
                                          </tr>
                                        </thead>


                                      <tbody>
                                        <?php 
                                             include("conexion.php");

                                             $query="SELECT `id_entrega`, `nombre_entrega` FROM `entrega`";
                                                  $resultadoc=$conexion->query($query);
                                                  while ($rowc=$resultadoc->fetch_assoc()) {
                                              ?>
                                         <tr>
                                            <td style="font-size:11px"><?php echo strtoupper($rowc['nombre_entrega']); ?></td>
                                             <?php 
                                             if ($_SESSION["roles"]==1 || $_SESSION["roles"]==2) {
                                             ?>                  
                                           <td><a href="ficheros.php?id_entrega=<?php echo $rowc['id_entrega'] ?>"><i class="fa fa-edit"></i></a></td>

                                            <?php if ($_SESSION["roles"]==1) {
                                              ?>
                                            <td><a href="eliminar_reg_entrega.php?id_entrega=<?php echo $rowc['id_entrega'] ?>"><i class="fa fa-trash"></i></a></td>

                                            <?php
                                          }
                                          }
                                          ?>  
                                        </tr>

                                         <?php 
                                            }
                                          ?>

                                      </tbody>
                                    </table>
                                   </div>

                            </div>
                            </div>



                        </div>
                        </div>




                            <div class="col-lg-12">
                              <div class="row">
                            <div class="col-md-4">
                            <div class="ibox-content">
                              <div class="table-responsive">
                                      <table class="table">
                                        <thead class="thead-dark">
                                          <tr>
                                            <th><strong>BANCOS</strong></th>
                                              <?php 
                                               if ($_SESSION["roles"]==1 || $_SESSION["roles"]==2) {
                                              ?>                  
                                              <th style="width: 5%">Editar</th>

                                              <?php if ($_SESSION["roles"]==1) {
                                              ?>
                                              <th style="width: 5%">Eliminar</th>

                                              <?php
                                                }
                                                }
                                              ?>
                                          </tr>
                                        </thead>


                                      <tbody>
                                        <?php 
                                             include("conexion.php");

                                             $query="SELECT `id_bancos`, `nombre_bancos` FROM `bancos`";
                                                  $resultadoc=$conexion->query($query);
                                                  while ($rowc=$resultadoc->fetch_assoc()) {
                                              ?>
                                         <tr>
                                            <td style="font-size:11px"><?php echo strtoupper($rowc['nombre_bancos']); ?></td>
                                             <?php 
                                             if ($_SESSION["roles"]==1 || $_SESSION["roles"]==2) {
                                             ?>                  
                                           <td><a href="ficheros.php?id_bancos=<?php echo $rowc['id_bancos'] ?>"><i class="fa fa-edit"></i></a></td>

                                            <?php if ($_SESSION["roles"]==1) {
                                              ?>
                                            <td><a href="eliminar_reg_bancos.php?id_bancos=<?php echo $rowc['id_bancos'] ?>"><i class="fa fa-trash"></i></a></td>

                                            <?php
                                          }
                                          }
                                          ?>  
                                        </tr>

                                         <?php 
                                            }
                                          ?>

                                      </tbody>
                                    </table>
                                   </div>

                            </div>
                            </div>

                          <div class="col-md-4">
                            <div class="ibox-content">
                                <div class="table-responsive">
                                    <table class="table">
                                        <thead class="thead-dark">
                                          <tr>
                                            <th><strong>Term of negotiation</strong></th>
                                              <?php 
                                               if ($_SESSION["roles"]==1 || $_SESSION["roles"]==2) {
                                              ?>                  
                                              <th style="width: 5%">Editar</th>

                                              <?php if ($_SESSION["roles"]==1) {
                                              ?>
                                              <th style="width: 5%">Eliminar</th>

                                              <?php
                                                }
                                                }
                                              ?>
                                          </tr>
                                        </thead>


                                      <tbody>
                                        <?php 
                                             include("conexion.php");

                                             $query="SELECT `id_toneg`, `nombre_toneg` FROM `term_of_negotiation`";
                                                  $resultadoc=$conexion->query($query);
                                                  while ($rowc=$resultadoc->fetch_assoc()) {
                                              ?>
                                         <tr>
                                            
                                            <td style="font-size:11px"><?php echo strtoupper($rowc['nombre_toneg']); ?></td>
                                             <?php 
                                             if ($_SESSION["roles"]==1 || $_SESSION["roles"]==2) {
                                             ?>                  
                                           <td><a href="ficheros.php?id_toneg=<?php echo $rowc['id_toneg'] ?>"><i class="fa fa-edit"></i></a></td>

                                            <?php if ($_SESSION["roles"]==1) {
                                              ?>
                                            <td><a href="eliminar_reg_term_of_negotiation.php?id_toneg=<?php echo $rowc['id_toneg'] ?>"><i class="fa fa-trash"></i></a></td>

                                            <?php
                                          }
                                          }
                                          ?>  
                                        </tr>

                                         <?php 
                                            }
                                          ?>

                                      </tbody>
                                    </table>
                                  </div>
                                </div>
                                </div>                       

                          <div class="col-md-4">
                            <div class="ibox-content">
                                <div class="table-responsive">
                                    <table class="table">
                                        <thead class="thead-dark">
                                          <tr>
                                            <th><strong>Port of loading</strong></th>
                                              <?php 
                                               if ($_SESSION["roles"]==1 || $_SESSION["roles"]==2) {
                                              ?>                  
                                              <th style="width: 5%">Editar</th>

                                              <?php if ($_SESSION["roles"]==1) {
                                              ?>
                                              <th style="width: 5%">Eliminar</th>

                                              <?php
                                                }
                                                }
                                              ?>
                                          </tr>
                                        </thead>


                                      <tbody>
                                        <?php 
                                             include("conexion.php");

                                             $query="SELECT `id_port`, `nombre_port` FROM `Port_of_Loading`";
                                                  $resultadoc=$conexion->query($query);
                                                  while ($rowc=$resultadoc->fetch_assoc()) {
                                              ?>
                                         <tr>
                                            
                                            <td style="font-size:11px"><?php echo strtoupper($rowc['nombre_port']); ?></td>
                                             <?php 
                                             if ($_SESSION["roles"]==1 || $_SESSION["roles"]==2) {
                                             ?>                  
                                           <td><a href="ficheros.php?id_port=<?php echo $rowc['id_port'] ?>"><i class="fa fa-edit"></i></a></td>

                                            <?php if ($_SESSION["roles"]==1) {
                                              ?>
                                            <td><a href="eliminar_reg_port_of_loading.php?id_port=<?php echo $rowc['id_port'] ?>"><i class="fa fa-trash"></i></a></td>

                                            <?php
                                          }
                                          }
                                          ?>  
                                        </tr>

                                         <?php 
                                            }
                                          ?>

                                      </tbody>
                                    </table>
                                  </div>
                                </div>
                                </div>



                        </div>
                        </div>


                        <!----------- *********************************************************************  -->

                      <div class="col-lg-12" style="padding-bottom: 5%">
                        <div class="row">
                          <div class="col-md-4">
                            <div class="ibox-content">
                              <div class="table-responsive">
                                      <table class="table">
                                        <thead class="thead-dark">
                                          <tr>
                                            <th><strong>TEÑIDO</strong></th>
                                              <?php 
                                               if ($_SESSION["roles"]==1 || $_SESSION["roles"]==2) {
                                              ?>                  
                                              <th style="width: 5%">Editar</th>

                                              <?php if ($_SESSION["roles"]==1) {
                                              ?>
                                              <th style="width: 5%">Eliminar</th>

                                              <?php
                                                }
                                                }
                                              ?>
                                          </tr>
                                        </thead>


                                      <tbody>
                                        <?php 
                                             include("conexion.php");

                                             $query="SELECT `id_teñido`, `nombre_teñido` FROM `teñido`";
                                                  $resultadoc=$conexion->query($query);
                                                  while ($rowc=$resultadoc->fetch_assoc()) {
                                              ?>
                                         <tr>
                                            <td style="font-size:11px"><?php echo strtoupper($rowc['nombre_teñido']); ?></td>
                                             <?php 
                                             if ($_SESSION["roles"]==1 || $_SESSION["roles"]==2) {
                                             ?>                  
                                           <td><a href="ficheros.php?id_teñido=<?php echo $rowc['id_teñido'] ?>"><i class="fa fa-edit"></i></a></td>

                                            <?php if ($_SESSION["roles"]==1) {
                                              ?>
                                            <td><a href="eliminar_reg_tenido.php?id_teñido=<?php echo $rowc['id_teñido'] ?>"><i class="fa fa-trash"></i></a></td>

                                            <?php
                                          }
                                          }
                                          ?>  
                                        </tr>

                                         <?php 
                                            }
                                          ?>

                                      </tbody>
                                    </table>
                                   </div>
                                  </div>
                                </div>
                              </div>
                            </div>

               
            </div>

       
       

        
        <?php include("footer.php"); ?>
</div>

      
        
 <!-- MODAL -->  
   
              <div class="modal inmodal" id="myModal" >
                <div class="modal-dialog">
                  <div class="modal-content animated bounceInRight">
                    <div class="modal-header" style="text-align: left">
                      <h4 class="modal-title"><img alt="Logo" src="img/logo.png" height="10%" width="10%"> Registro de Detalles</h4>
                    </div>

              <div class="modal-body">
   
                                                                
                                        
              <div class="row">
                <div class="col-lg-12">
                    <div class="tabs-container">
                        <ul class="nav nav-tabs">
                            <li <?php if (isset($_GET['id_remarks'])) { echo "class=active";} ?> > <a data-toggle="tab" href="#tab-1">Remarks</a></li>
                            <li <?php if (isset($_GET['id_embalaje'])) { echo "class=active";} ?> > <a data-toggle="tab" href="#tab-2">Embalaje</a></li>
                            <li <?php if (isset($_GET['id_forma_de_pago'])) { echo "class=active";} ?> > <a data-toggle="tab" href="#tab-3">Forma de Pago</a></li>
                            <li <?php if (isset($_GET['id_destino'])) { echo "class=active";} ?> > <a data-toggle="tab" href="#tab-4">Destinos</a></li>
                            <li <?php if (isset($_GET['id_origen'])) { echo "class=active";} ?> > <a data-toggle="tab" href="#tab-5">Origenes</a></li>
                            <li <?php if (isset($_GET['id_entrega'])) { echo "class=active";} ?> > <a data-toggle="tab" href="#tab-6">Delivery</a></li>
                            <li <?php if (isset($_GET['id_bancos'])) { echo "class=active";} ?> > <a data-toggle="tab" href="#tab-7">Bancos</a></li>
                            <li <?php if (isset($_GET['id_toneg'])) { echo "class=active";} ?> > <a data-toggle="tab" href="#tab-8">Term of negotiation</a></li>
                            <li <?php if (isset($_GET['id_port'])) { echo "class=active";} ?> > <a data-toggle="tab" href="#tab-9">Port of loading</a></li>
                            <li <?php if (isset($_GET['id_teñido'])) { echo "class=active";} ?> > <a data-toggle="tab" href="#tab-10">Teñido</a></li>
                        </ul>
                        <div class="tab-content">
                            <div id="tab-1" class="tab-pane <?php if (isset($_GET['id_remarks'])) { echo "active";} ?>">
                                <div class="panel-body">
                                  <form class="form-horizontal" action="<?php if (isset($_GET['id_remarks'])) { echo "edit_remarks.php";} else { echo "reg_remarks.php"; }?>" method="POST">
                                  
                                    <div class="form-group">
                                      <div class="row">
                                        <div class="col-md-12">
                                          <label>Nombre</label>
                                          <?php
                                          $idremarks=$_GET['id_remarks'];

                                            $query="SELECT `id_remarks`, `nombre_remarks` FROM `remarks` where id_remarks='$idremarks'";
                                            $resultadoc=$conexion->query($query);
                                            $rowc=$resultadoc->fetch_assoc();
 
                                          ?>
                                            <input type="text" value="<?php echo $rowc['nombre_remarks'] ?>"  class="form-control" name="nombre_remarks" id="nombre_remarks" >
                                            <input type="hidden" value="<?php echo $rowc['id_remarks'] ?>"  class="form-control" name="id_remarks" id="id_remarks" >
                                        </div>
                                      </div>
                                    </div>
                                    <div class="modal-footer">
                                               <a href="ficheros.php"> <button type="button" class="btn btn-white">Cerrar</button></a>
                                                <button type="submit" class="btn btn-primary">Guardar cambios</button>
                                            
                                            </div>
                                  </form>
                            
                                </div>
                            </div>
                            <div id="tab-2" class="tab-pane <?php if (isset($_GET['id_embalaje'])) { echo "active";} ?>">
                                <div class="panel-body">
                                  <form class="form-horizontal" action="<?php if (isset($_GET['id_embalaje'])) { echo "edit_embalaje.php";} else { echo "reg_embalaje.php"; }?>" method="POST">

                                    <div class="form-group">
                                      <div class="row">
                                        <div class="col-md-12">
                                          <label>Nombre</label>

<?php
$idembalaje=$_GET['id_embalaje'];
                                            $query="SELECT `id_embalaje`, `nombre_embalaje` FROM `embalaje` where id_embalaje='$idembalaje'";
                                            $resultadoc=$conexion->query($query);
                                            $rowc=$resultadoc->fetch_assoc();

?>

                                            <input type="text" value="<?php echo $rowc['nombre_embalaje'] ?>"  class="form-control" name="nombre_embalaje" id="nombre_embalaje">
                                            <input type="hidden" value="<?php echo $rowc['id_embalaje'] ?>"  class="form-control" name="id_embalaje" id="id_embalaje" >
                                        </div>
                                      </div>
                                    </div>
                                    <div class="modal-footer">
                                               <a href="ficheros.php"> <button type="button" class="btn btn-white">Cerrar</button></a>
                                                <button type="submit" class="btn btn-primary">Guardar cambios</button>
                                            
                                            </div>
                                  </form>
                              
                                </div>
                            </div>
                            <div id="tab-3" class="tab-pane <?php if (isset($_GET['id_forma_de_pago'])) { echo "active";} ?>">
                                <div class="panel-body">
                                  <form class="form-horizontal" action="<?php if (isset($_GET['id_forma_de_pago'])) {echo "edit_forma_de_pago.php";} else {echo "reg_forma_de_pago.php";} ?>" method="POST">
                                    
                       
                                    <div class="form-group">
                                      <div class="row">
                                        <div class="col-md-12">
                                          <label>Nombre</label>

                                            <?php 
                                              $idformadepago=$_GET['id_forma_de_pago'];

                                              $query="SELECT `id_forma_de_pago`, `nombre_forma_de_pago` FROM `forma_de_pago` where id_forma_de_pago='$idformadepago'";
                                                  $resultadoc=$conexion->query($query);
                                                  $rowc=$resultadoc->fetch_assoc();
                                            ?>


                                            <input type="text" value="<?php echo $rowc['nombre_forma_de_pago'] ?>"  class="form-control" name="nombre_forma_de_pago" id="nombre_forma_de_pago">
                                            <input type="hidden" value="<?php echo $rowc['id_forma_de_pago'] ?>"  class="form-control" name="id_forma_de_pago" id="id_forma_de_pago">
                                        </div>
                                      </div>
                                    </div>
                                  <div class="modal-footer">
                                               <a href="ficheros.php"> <button type="button" class="btn btn-white">Cerrar</button></a>
                                                <button type="submit" class="btn btn-primary">Guardar cambios</button>
                                            
                                            </div>
                                  </form>
                              
                                </div>
                            </div>
                            <div id="tab-4" class="tab-pane <?php if (isset($_GET['id_destino'])) { echo "active";} ?>">
                                <div class="panel-body">
                                  <form class="form-horizontal" action="<?php if (isset($_GET['id_destino'])) { echo "edit_destino.php";} else { echo "reg_destino.php"; }?>" method="POST">
                                  
                                    <div class="form-group">
                                      <div class="row">
                                        <div class="col-md-12">
                                          <label>Final Destination</label>
                                          <?php
                                          $id_destino=$_GET['id_destino'];

                                            $query="SELECT `id_destino`, `nombre_destino` FROM `destino` where id_destino='$id_destino'";
                                            $resultadoc=$conexion->query($query);
                                            $rowc=$resultadoc->fetch_assoc();
 
                                          ?>
                                            <input type="text" value="<?php echo $rowc['nombre_destino'] ?>"  class="form-control" name="nombre_destino" id="nombre_destino" >
                                            <input type="hidden" value="<?php echo $rowc['id_destino'] ?>"  class="form-control" name="id_destino" id="id_destino" >
                                        </div>
                                      </div>
                                    </div>
                                    <div class="modal-footer">
                                               <a href="ficheros.php"> <button type="button" class="btn btn-white">Cerrar</button></a>
                                                <button type="submit" class="btn btn-primary">Guardar cambios</button>
                                            
                                            </div>
                                  </form>
                            
                                </div>
                            </div>

                            <div id="tab-5" class="tab-pane <?php if (isset($_GET['id_origen'])) { echo "active";} ?>">
                                <div class="panel-body">
                                  <form class="form-horizontal" action="<?php if (isset($_GET['id_origen'])) { echo "edit_origen.php";} else { echo "reg_origen.php"; }?>" method="POST">
                                  
                                    <div class="form-group">
                                      <div class="row">
                                        <div class="col-md-12">
                                          <label>COUNTRY OF ORIGIN</label>
                                          <?php
                                          $id_origen=$_GET['id_origen'];

                                            $query="SELECT `id_origen`, `nombre_origen` FROM `origen` where id_origen='$id_origen'";
                                            $resultadoc=$conexion->query($query);
                                            $rowc=$resultadoc->fetch_assoc();
 
                                          ?>
                                            <input type="text" value="<?php echo $rowc['nombre_origen'] ?>"  class="form-control" name="nombre_origen" id="nombre_origen" >
                                            <input type="hidden" value="<?php echo $rowc['id_origen'] ?>"  class="form-control" name="id_origen" id="id_origen" >
                                        </div>
                                      </div>
                                    </div>
                                    <div class="modal-footer">
                                               <a href="ficheros.php"> <button type="button" class="btn btn-white">Cerrar</button></a>
                                                <button type="submit" class="btn btn-primary">Guardar cambios</button>
                                            
                                            </div>
                                  </form>
                            
                                </div>
                            </div>


                             <div id="tab-6" class="tab-pane <?php if (isset($_GET['id_entrega'])) { echo "active";} ?>">
                                <div class="panel-body">
                                  <form class="form-horizontal" action="<?php if (isset($_GET['id_entrega'])) { echo "edit_entrega.php";} else { echo "reg_entrega.php"; }?>" method="POST">
                                  
                                    <div class="form-group">
                                      <div class="row">
                                        <div class="col-md-12">
                                          <label>DELIVERY</label>
                                          <?php
                                          $id_entrega=$_GET['id_entrega'];

                                            $query="SELECT `id_entrega`, `nombre_entrega` FROM `entrega` where id_entrega='$id_entrega'";
                                            $resultadoc=$conexion->query($query);
                                            $rowc=$resultadoc->fetch_assoc();
 
                                          ?>
                                            <input type="text" value="<?php echo $rowc['nombre_entrega'] ?>"  class="form-control" name="nombre_entrega" id="nombre_entrega" >
                                            <input type="hidden" value="<?php echo $rowc['id_entrega'] ?>"  class="form-control" name="id_entrega" id="id_entrega" >
                                        </div>
                                      </div>
                                    </div>
                                    <div class="modal-footer">
                                               <a href="ficheros.php"> <button type="button" class="btn btn-white">Cerrar</button></a>
                                                <button type="submit" class="btn btn-primary">Guardar cambios</button>
                                            
                                            </div>
                                  </form>
                            
                                </div>
                            </div>


                             <div id="tab-7" class="tab-pane <?php if (isset($_GET['id_bancos'])) { echo "active";} ?>">
                                <div class="panel-body">
                                  <form class="form-horizontal" action="<?php if (isset($_GET['id_bancos'])) { echo "edit_bancos.php";} else { echo "reg_bancos.php"; }?>" method="POST">
                                  
                                    <div class="form-group">
                                      <div class="row">
                                        <div class="col-md-12">
                                          <label>NOMBRE BANCO</label>
                                          <?php
                                          $id_bancos=$_GET['id_bancos'];

                                            $query="SELECT `id_bancos`, `nombre_bancos`, `beneficiario_empre`, `direccion_empresa`, `beneficiario_bancos`, `direccion_bancos`, `swift_bic`, `num_cuenta`, `intermediario`, `swift_code` FROM `bancos` where id_bancos='$id_bancos'";
                                            $resultadoc=$conexion->query($query);
                                            $rowc=$resultadoc->fetch_assoc();
 
                                          ?>
                                            <input type="text" value="<?php echo $rowc['nombre_bancos'] ?>"  class="form-control" name="nombre_bancos" id="nombre_bancos" >
                                            <input type="hidden" value="<?php echo $rowc['id_bancos'] ?>"  class="form-control" name="id_bancos" id="id_bancos" >


     </div>
                                      </div>

                                      <div class="row">
                                        <div class="col-md-12">
                                          <label>BENEFICIARIO EMPRESA</label>
                                        <input type="text" value="<?php echo $rowc['beneficiario_empre'] ?>"  class="form-control" name="beneficiario_empre" id="beneficiario_empre" >
                                        </div>
                                      </div>



                                      <div class="row">
                                        <div class="col-md-12">
                                          <label>DIRECCION EMPRESA</label>
                                        <input type="text" value="<?php echo $rowc['direccion_empresa'] ?>"  class="form-control" name="direccion_empresa" id="direccion_empresa" >
                                        </div>
                                      </div>


                                      <div class="row">
                                        <div class="col-md-12">
                                          <label>BENEFICIARIO BANCO</label>
                                        <input type="text" value="<?php echo $rowc['beneficiario_bancos'] ?>"  class="form-control" name="beneficiario_bancos" id="beneficiario_bancos" >
                                        </div>
                                      </div>



                                         <div class="row">
                                        <div class="col-md-12">
                                          <label>SWIFT BIC</label>
                                        <input type="text" value="<?php echo $rowc['swift_bic'] ?>"  class="form-control" name="swift_bic" id="swift_bic" >
                                        </div>
                                      </div>



                                         <div class="row">
                                        <div class="col-md-12">
                                          <label>NUMERO DE CUENTA</label>
                                        <input type="text" value="<?php echo $rowc['swift_bic'] ?>"  class="form-control" name="swift_bic" id="swift_bic" >
                                        </div>
                                      </div>


                                            <div class="row">
                                        <div class="col-md-12">
                                          <label>DIRECCION BANCO</label>
                                        <input type="text" value="<?php echo $rowc['num_cuenta'] ?>"  class="form-control" name="num_cuenta" id="num_cuenta" >
                                        </div>
                                      </div>


                                       <div class="row">
                                        <div class="col-md-12">
                                          <label>INTERMEDIARIO</label>
                                        <input type="text" value="<?php echo $rowc['intermediario'] ?>"  class="form-control" name="intermediario" id="intermediario" >
                                        </div>
                                      </div>


                                          <div class="row">
                                        <div class="col-md-12">
                                          <label>SWIFT CODE</label>
                                        <input type="text" value="<?php echo $rowc['swift_code'] ?>"  class="form-control" name="swift_code" id="swift_code" >
                                        </div>
                                      </div> 





                                    </div>
                                    <div class="modal-footer">
                                               <a href="ficheros.php"> <button type="button" class="btn btn-white">Cerrar</button></a>
                                                <button type="submit" class="btn btn-primary">Guardar cambios</button>
                                            
                                            </div>
                                  </form>
                            
                                </div>
                            </div>

                            <div class="tab-content">
                            <div id="tab-8" class="tab-pane <?php if (isset($_GET['id_toneg'])) { echo "active";} ?>">
                                <div class="panel-body">
                                  <form class="form-horizontal" action="<?php if (isset($_GET['id_toneg'])) { echo "edit_term_of_negotiation.php";} else { echo "reg_term_of_negotiation.php"; }?>" method="POST">
                                  
                                    <div class="form-group">
                                      <div class="row">
                                        <div class="col-md-12">
                                          <label>Nombre</label>
                                          <?php
                                          $idtoneg=$_GET['id_toneg'];

                                            $query="SELECT `id_toneg`, `nombre_toneg` FROM `term_of_negotiation` where id_toneg='$idtoneg'";
                                            $resultadoc=$conexion->query($query);
                                            $rowc=$resultadoc->fetch_assoc();
 
                                          ?>
                                            <input type="text" value="<?php echo $rowc['nombre_toneg'] ?>"  class="form-control" name="nombre_toneg" id="nombre_toneg" >
                                            <input type="hidden" value="<?php echo $rowc['id_toneg'] ?>"  class="form-control" name="id_toneg" id="id_toneg" >
                                        </div>
                                      </div>
                                    </div>
                                    <div class="modal-footer">
                                               <a href="ficheros.php"> <button type="button" class="btn btn-white">Cerrar</button></a>
                                                <button type="submit" class="btn btn-primary">Guardar cambios</button>
                                            
                                            </div>
                                  </form>
                            
                                </div>
                            </div>

<div class="tab-content">
                            <div id="tab-9" class="tab-pane <?php if (isset($_GET['id_port'])) { echo "active";} ?>">
                                <div class="panel-body">
                                  <form class="form-horizontal" action="<?php if (isset($_GET['id_port'])) { echo "edit_port_of_loading.php";} else { echo "reg_port_of_loading.php"; }?>" method="POST">
                                  
                                    <div class="form-group">
                                      <div class="row">
                                        <div class="col-md-12">
                                          <label>Nombre</label>
                                          <?php
                                          $idport=$_GET['id_port'];

                                            $query="SELECT `id_port`, `nombre_port` FROM `Port_of_Loading` where id_port='$idport'";
                                            $resultadoc=$conexion->query($query);
                                            $rowc=$resultadoc->fetch_assoc();
 
                                          ?>
                                            <input type="text" value="<?php echo $rowc['nombre_port'] ?>"  class="form-control" name="nombre_port" id="nombre_port" >
                                            <input type="hidden" value="<?php echo $rowc['id_port'] ?>"  class="form-control" name="id_port" id="id_port" >
                                        </div>
                                      </div>
                                    </div>
                                    <div class="modal-footer">
                                               <a href="ficheros.php"> <button type="button" class="btn btn-white">Cerrar</button></a>
                                                <button type="submit" class="btn btn-primary">Guardar cambios</button>
                                            
                                            </div>
                                  </form>
                            
                                </div>
                            </div>

                        </div>


                        <div class="tab-content">
                            <div id="tab-10" class="tab-pane <?php if (isset($_GET['id_teñido'])) { echo "active";} ?>">
                                <div class="panel-body">
                                  <form class="form-horizontal" action="<?php if (isset($_GET['id_teñido'])) { echo "edit_tenido.php";} else { echo "reg_tenido.php"; }?>" method="POST">
                                  
                                    <div class="form-group">
                                      <div class="row">
                                        <div class="col-md-12">
                                          <label>Nombre</label>
                                          <?php
                                          $idteñido=$_GET['id_teñido'];

                                            $query="SELECT `id_teñido`, `nombre_teñido` FROM `teñido` where id_teñido='$idteñido'";
                                            $resultadoc=$conexion->query($query);
                                            $rowc=$resultadoc->fetch_assoc();
 
                                          ?>
                                            <input type="text" value="<?php echo $rowc['nombre_teñido'] ?>"  class="form-control" name="nombre_teñido" id="nombre_teñido" >
                                            <input type="hidden" value="<?php echo $rowc['id_teñido'] ?>"  class="form-control" name="id_teñido" id="id_teñido" >
                                        </div>
                                      </div>
                                    </div>
                                    <div class="modal-footer">
                                               <a href="ficheros.php"> <button type="button" class="btn btn-white">Cerrar</button></a>
                                                <button type="submit" class="btn btn-primary">Guardar cambios</button>
                                            
                                            </div>
                                  </form>
                            
                                </div>
                            </div>

                        </div>


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

                                  </div><!-- div body-->
    </div>
    <?php include("script.php"); ?>

       <script type="text/javascript">
           <?php
                    if (isset($_GET['id_remarks']) || isset($_GET['id_embalaje']) || isset($_GET['id_forma_de_pago']) || isset($_GET['id_destino']) || isset($_GET['id_origen']) || isset($_GET['id_entrega']) || isset($_GET['id_bancos']) || isset($_GET['id_toneg']) || isset($_GET['id_port']) || isset($_GET['id_teñido']) ) {
                    ?>
                    $('#myModal').modal('show');
                      <?php                       }  
           ?>


          
       </script>
</body>
</html>