<?php
  $page_title = 'CONFIGURACION';
  require_once('../../includes/load.php');
?>
<?php
// Checkin What level user has permission to view this page
 page_require_level(1);
?>
<?php include_once('../../layouts/header.php'); ?>
<div class="col-md-12">
   <?php echo display_msg($msg); ?>
</div>
<form enctype="multipart/form-data" autocomplete="off" id="form" onSubmit="PreguntaCancel()">
<div class="container pt-1 mt-1 animated fadeIn">
    <div class="row pt-4">
      <div class="col-12 mb-3">
        <p class="h1 text-center text-primary font-weight-bold"> TARIFARIO VEHICULAR</p>
      </div>
    </div>
  
    <div class="row d-flex justify-content-center pt-3">
      <div class="col-12 col-md-8">
        <div class="input-group">
          <select class="custom-select" id="anio" name="anio">     
              <?php
                  $year = date("Y");
                  for ($i=2022; $i<=$year; $i++) {
                      $selected = ($year == $i) ? 'selected' : ''; // Verifica si este año debe ser seleccionado
                      echo '<option ' . $selected . ' value="' . $i . '">'.$i.'</option>';
                  }
              ?>
          </select>
          <select class="custom-select" id="mes" name="mes">     
                    <?php
                      $mesA = date("m");
                      for ($i = 1; $i <= 12; $i++) {
                          $value = ($i < 10) ? '0' . $i : $i;
                          switch ($value) {
                             case '1': $mes = 'Enero';break;
                             case '2': $mes = 'Febrero';break;
                             case '3': $mes = 'Marzo';break;
                             case '4': $mes = 'Abril';break;
                             case '5': $mes = 'Mayo';break;
                             case '6': $mes = 'Junio';break;
                             case '7': $mes = 'Julio';break;
                             case '8': $mes = 'Agosto';break;
                             case '9': $mes = 'Septiembre';break;
                             case '10': $mes = 'Octubre';break;
                             case '11': $mes = 'Noviembre';break;
                             case '12': $mes = 'Diciembre';break;
                             default: $mes = 'Non'; break;
                          }
                          $selected = ($mesA == $i) ? 'selected' : ''; // Verifica si este mes debe ser seleccionado
                          echo '<option ' . $selected . ' value="' . $i . '">' . $mes . '</option>';
                      }
                      ?>  
          </select>
          <select class="custom-select" id="placa" name="placa" required>
            <option value="" disabled selected>Seleccione</option>
                  <?php   
                    $consulta = $db->query("SELECT * FROM vehiculo ORDER BY id DESC");
                      while ($row = $db->fetch_assoc($consulta)) {   
                        $Placa = $row['PLACA'];    
                        echo "<option value='$Placa'>$Placa</option>";
                      }
                  ?>
          </select>
          <div class="input-group-append">
            <button class="btn btn-outline-secondary" type="button" id="buscar" name="buscar">Buscar</button>
          </div>
          <div class="input-group-append">
            <button class="btn btn-outline-secondary" type="button"
              (click)="ListadoVehiculosRegistrados(mesSelect,anioSelect)" 
              data-toggle="modal" data-target="#exampleModal"
                >Listados</button>
          </div>
        </div>
      </div>
    </div>
    <br>
      <div class="container-fluid p-0">
        <div class="row mb-3">
          <div class="col-12 col-lg-12">
            <div class="card">
              <div class="card-header">
                <h5 class="card-title mb-0">Datos Generales</h5>
              </div>
              <div class="card-body">
  
                <div class="row mb-3">
                  <div class="col-12 col-lg-8">
                    <div class="form-group row">
                      <label for="DatosMV" class="col-sm-5 col-form-label text-primary">MARCA DEL VEHICULO</label>
                      <div class="col-sm-7">
                        <input type="text" class="form-control" id="DatosMV" name="DatosMV" placeholder="number" readonly required>
  
                      </div>
                    </div>
                  </div>
                </div>
                <div class="row mb-3">
                  <div class="col-12 col-lg-8">
                    <div class="form-group row">
                      <label for="DatosPlaca" class="col-sm-5 col-form-label text-primary">PLACA</label>
                      <div class="col-sm-7">
                        <input type="text" class="form-control" id="DatosPlaca" name="DatosPlaca" placeholder="DatosPlaca" readonly required>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="row mb-3">
                  <div class="col-12 col-lg-8">
                    <div class="form-group row">
                      <label for="DatosAno" class="col-sm-5 col-form-label text-primary">AÑO</label>
                      <div class="col-sm-7">
                        <input type="number" class="form-control" id="DatosAno" name="DatosAno" placeholder="number" readonly required>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="row mb-3">
                  <div class="col-12 col-lg-8">
                    <div class="form-group row">
                      <label for="DatosNMotor" class="col-sm-5 col-form-label text-primary">NUMERO DE MOTOR</label>
                      <div class="col-sm-7">
                        <input type="number" class="form-control" id="DatosNMotor" name="DatosNMotor" placeholder="number" readonly required>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="row mb-3">
                  <div class="col-12 col-lg-8">
                    <div class="form-group row">
                      <label for="DatosMttoP" class="col-sm-5 col-form-label text-primary">PARAMETRO DE MANTENIMIENTO
                        PREVENTIVO / KM</label>
                      <div class="col-sm-7">
                        <input type="number" class="form-control" id="DatosMttoP" name="DatosMttoP" placeholder="number" readonly required>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="row mb-3">
                  <div class="col-12 col-lg-8">
                    <div class="form-group row">
                      <label for="DatosMPropio" class="col-sm-5 col-form-label text-primary">UTILIZACION MES PROPIA /
                        KM</label>
                      <div class="col-sm-7">
                        <input type="number" class="form-control" id="DatosMPropio" name="DatosMPropio" placeholder="number" readonly required>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="row mb-3">
                  <div class="col-12 col-lg-8">
                    <div class="form-group row">
                      <label for="DatosRendC" class="col-sm-5 col-form-label text-primary">RENDIMIENTO DE COMBUSTIBLE
                        / KM</label>
                      <div class="col-sm-7">
                        <input type="number" class="form-control" id="DatosRendC" name="DatosRendC" placeholder="number" readonly required>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="row mb-3">
                  <div class="col-12 col-lg-8">
                    <div class="form-group row">
                      <label for="DatosCA" class="col-sm-5 col-form-label text-primary">CODIGO DE ACTIVO</label>
                      <div class="col-sm-7">
                        <input type="text" class="form-control" id="DatosCA" name="DatosCA" placeholder="number" readonly required>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
  
          </div>
      </div>
  </div>
  
          <div class="col-12 px-0 pt-3">
          <div class="row mb-3">
            <div class="col-6">
              <div class="card">
                <div class="card-header">
                  <h5 class="card-title mb-0">Costos Fijos - Administrativos</h5>
                </div>
                <div class="card-body">
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CFDepre" class="col-sm-6 col-form-label text-primary">DEPRECIACION</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CFDepre" name="CFDepre" placeholder="number" readonly required>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CFGps" class="col-sm-6 col-form-label text-primary">GPS</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CFGps" name="CFGps" placeholder="number" readonly required>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CFSoat" class="col-sm-6 col-form-label text-primary">SOAT</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CFSoat" name="CFSoat" placeholder="number" readonly required>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CFImp" class="col-sm-6 col-form-label text-primary">IMPUESTO
                          VEHICULAR</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CFImp" name="CFImp" placeholder="number" readonly required>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CFGADM" class="col-sm-6 col-form-label text-primary">GASTO
                          ADMINISTRATIVO</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CFGADM" name="CFGADM" placeholder="number" readonly required>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CFServP" class="col-sm-6 col-form-label text-primary">SERVICIO
                          PUBLICO</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CFServP" name="CFServP" placeholder="number" readonly required>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CFOD" class="col-sm-6 col-form-label text-primary">OTRAS DEPRECIACION</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CFOD" name="CFOD" placeholder="number" readonly required>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CFRevtec" class="col-sm-6 col-form-label text-primary">REVISION
                          TECNICA</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CFRevtec" name="CFRevtec" placeholder="number" readonly required>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CFOG" class="col-sm-6 col-form-label text-primary">OTROS GASTOS</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CFOG" name="CFOG" placeholder="number" readonly required>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CFTotalADM" class="col-sm-6 col-form-label text-primary">TOTAL DE COSTOS
                          FIJOS ADMINISTRATIVOS</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CFTotalADM" name="CFTotalADM" placeholder="number" readonly required>                             
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <br><br>
              </div>


            </div>
            <div class="col-6">
              <div class="card">
                <div class="card-header">
                  <h5 class="card-title mb-0">Costos Fijos - Operaciones</h5>
                </div>
                <div class="card-body">
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CFOSUELDO" class="col-sm-6 col-form-label text-primary">SUELDO
                          OPERARIOS</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CFOSUELDO" name="CFOSUELDO" placeholder="number" readonly required>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CFOSctr" class="col-sm-6 col-form-label text-primary">SCTR</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CFOSctr" name="CFOSctr" placeholder="number" readonly required>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CFOBono" class="col-sm-6 col-form-label text-primary">BONO</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CFOBono" name="CFOBono" placeholder="number" required>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CFOEpps" class="col-sm-6 col-form-label text-primary">EPPS</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CFOEpps" name="CFOEpps" placeholder="number" readonly required>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CFOAccS" class="col-sm-6 col-form-label text-primary">ACCESORIOS DE
                          SEGURIDAD</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CFOAccS" name="CFOAccS" placeholder="number" readonly required>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CFOMovi" class="col-sm-6 col-form-label text-primary">MOVILIDAD</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CFOMovi" name="CFOMovi" placeholder="number" required>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CFOAli" class="col-sm-6 col-form-label text-primary">ALIMENTACION</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CFOAli" name="CFOAli" placeholder="number" required>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CFOOG" class="col-sm-6 col-form-label text-primary">OTROS GASTOS</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CFOOG" name="CFOOG" placeholder="number" required>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CFOTotalOpera" class="col-sm-6 col-form-label text-primary">TOTAL DE COSTO
                          FIJOS OPERACIONES</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CFOTotalOpera" name="CFOTotalOpera" placeholder="number" readonly required>
                         
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CFTotalADMOPE" class="col-sm-6 col-form-label text-primary">TOTAL DE COSTOS
                          FIJOS</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CFTotalADMOPE" name="CFTotalADMOPE" placeholder="number" readonly required>
                          
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CFOtotalKM" class="col-sm-6 col-form-label text-primary">TOTAL DE COSTOS
                          FIJOS / KM</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CFOtotalKM" name="CFOtotalKM" placeholder="number" readonly required>
                   

                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div> 
        </div>
      	<div class="col-12 px-0 pt-3">
          <div class="row mb-3">
            <div class="col-6">
              <div class="card">
                <div class="card-header">
                  <h5 class="card-title mb-0">Costos Variables</h5>
                </div>
                <div class="card-body">
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CVComb" class="col-sm-6 col-form-label text-primary">COMBUSTIBLE</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CVComb" name="CVComb" placeholder="number" readonly required>
                        </div>
                      </div>
                    </div>

                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CVNeuma" class="col-sm-6 col-form-label text-primary">NEUMATICO X KM</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CVNeuma" name="CVNeuma" placeholder="number" readonly required>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CVMttoPrevKM" class="col-sm-6 col-form-label text-primary">MANTENIMIENTO
                          PREVENTIVO/KM</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CVMttoPrevKM" name="CVMttoPrevKM" placeholder="number" required>
                        </div>
                        <label for="CVMttoPrevKMSeg" class="col-sm-6 col-form-label text-primary"></label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CVMttoPrevKMSeg" name="CVMttoPrevKMSeg" placeholder="number" readonly required>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CVMttoCorrecKM" class="col-sm-6 col-form-label text-primary">MANTENIMIENTO
                          CORRECTIVO/KM</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CVMttoCorrecKM" name="CVMttoCorrecKM" placeholder="number" required>
                        </div>
                        <label for="CVMttoCorrecKMSeg" class="col-sm-6 col-form-label text-primary"></label>

                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CVMttoCorrecKMSeg" name="CVMttoCorrecKMSeg" placeholder="number"  readonly required>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CVTotalCV" class="col-sm-6 col-form-label text-primary">TOTAL DE COSTO VARIABLE</label>
                        <div class="col-sm-6">

                          <input type="number" class="form-control" id="CVTotalCV" name="CVTotalCV" placeholder="number" readonly required>
                      

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


            </div>
            <div class="col-6">
              <div class="card">
                <div class="card-header">
                  <h5 class="card-title mb-0">Combustible</h5>
                </div>
                <div class="card-body">
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="PreCVComb" class="col-sm-6 col-form-label text-primary">PRECIO
                          COMBUSTIBLE</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="PreCVComb" name="PreCVComb" placeholder="number" required>
                        </div>
                      </div>
                    </div>

                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CVKm" class="col-sm-6 col-form-label text-primary">KM RECORRIDO</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CVKm" name="CVKm" placeholder="number" readonly required>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="CVcostotal" class="col-sm-6 col-form-label text-primary">COSTO
                          TOTAL</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="CVcostotal" name="CVcostotal" placeholder="number" readonly required>
                    
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row mb-3">
                    <div class="col-12 col-lg-12">
                      <div class="form-group row">
                        <label for="tarifaxkm" class="col-sm-6 col-form-label text-primary">TARIFA X
                          KM</label>
                        <div class="col-sm-6">
                          <input type="number" class="form-control" id="tarifaxkm" name="tarifaxkm" placeholder="number" readonly required>
                           
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
    <div class="container pt-3">
      <div class="row mb-3">
        <div class="col-12">
          <button type="submit" class="btn btn-success btn-block">Registrar</button>
        </div>
      </div>
    </div>
  </div>
</form>

 <?php include_once('../../layouts/footer.php'); ?>
<script type="text/javascript" src="js/tarifario.js"></script>