<?php
  $page_title = 'CONFIGURACION';
  require_once('../../includes/load.php');
?>
<?php
// Checkin What level user has permission to view this page
 page_require_level(1);

$maestra = find_by_id('tb_maestra',(int)$_GET['id']);
if(!$maestra){
$session->msg("d","Error: No se encontró id del tarifario.");
redirect('tarifario.php');  
}
$placa = $maestra['placa'];
$consulta = $db->query("SELECT * FROM vehiculo WHERE PLACA = '$placa'");
$vehiculo=$db->fetch_assoc($consulta);
?>
<?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" style="pointer-events: none;">     
              <option value="<?php echo $maestra['anio'] ?>"><?php echo $maestra['anio'] ?></option>
          </select>
          <select class="custom-select" id="mes" name="mes" style="pointer-events: none;">     
                   <?php
                        $def='';
                        if($maestra['mes']==true){
                            $def='selected';
                        }
                      for ($i=1; $i<=12; $i++){
                        $value = ($i < 10)?'0'.$i:$i;
                         switch ($value) {
                           case '01': $mes = 'Enero';break;
                           case '02': $mes = 'Febrero';break;
                           case '03': $mes = 'Marzo';break;
                           case '04': $mes = 'Abril';break;
                           case '05': $mes = 'Mayo';break;
                           case '06': $mes = 'Junio';break;
                           case '07': $mes = 'Julio';break;
                           case '08': $mes = 'Agosto';break;
                           case '09': $mes = 'Septiembre';break;
                           case '10': $mes = 'Octubre';break;
                           case '11': $mes = 'Noviembre';break;
                           case '12': $mes = 'Diciembre';break;
                           default: $mes = 'Non'; break;
                         }
                          echo '<option ' . ($maestra['mes'] == $i ? $def : ''). ' value="'.$i.'" readonly>'.$mes.'</option>';
                        
                      }
                      ?>

          </select>
          <select class="custom-select" id="placa" name="placa" style="pointer-events: none;">
                  <option value="<?php echo $maestra['placa'] ?>"><?php echo $maestra['placa'] ?></option>
          </select>
        </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" value="<?php echo $vehiculo['NOMB_VEHIC'] ?>" readonly required disabled>
  
                      </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" value="<?php echo $vehiculo['PLACA'] ?>" readonly required disabled>
                      </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" value="<?php echo $vehiculo['anio'] ?>" readonly required disabled>
                      </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" value="<?php echo (double)$vehiculo['num_motor'] ?>" readonly required disabled>
                      </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" value="<?php echo (double)$vehiculo['mtto_prevkm'] ?>" readonly required disabled>
                      </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" value="<?php echo (double)$vehiculo['mes_propiokm'] ?>" readonly required disabled>
                      </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" value="<?php echo (double)$vehiculo['rend_combkm'] ?>" readonly required disabled>
                      </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" value="<?php echo $vehiculo['COD_ACTIVO'] ?>" readonly required disabled>
                      </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" value="<?php echo (double)$maestra['depreciacion'] ?>" readonly required disabled>
                        </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" value="<?php echo (double)$maestra['gps'] ?>" readonly required disabled>
                        </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" value="<?php echo (double)$maestra['soat'] ?>" readonly required disabled>
                        </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" value="<?php echo (double)$maestra['imp_vehicular'] ?>" readonly required disabled>
                        </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" value="<?php echo (double)$maestra['gasto_adm'] ?>" readonly required disabled>
                        </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" value="<?php echo (double)$maestra['serv_public'] ?>" readonly required disabled>
                        </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" value="<?php echo (double)$maestra['otras_depre'] ?>" readonly required disabled>
                        </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" value="<?php echo (double)$maestra['rev_tecnica'] ?>" readonly required disabled>
                        </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" value="<?php echo (double)$maestra['otros_gastos'] ?>" readonly required disabled>
                        </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" value="<?php echo (double)$maestra['total_cfadm'] ?>" readonly required disabled>                             
                        </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" value="<?php echo (double)$maestra['sueldo_oper'] ?>" readonly required disabled>
                        </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" value="<?php echo (double)$maestra['sctr'] ?>" readonly required disabled>
                        </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" value="<?php echo (double)$maestra['bono'] ?>" required disabled>
                        </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" value="<?php echo (double)$maestra['epps'] ?>" readonly required disabled>
                        </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" value="<?php echo (double)$maestra['accesorios_seg'] ?>" readonly required disabled>
                        </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" value="<?php echo (double)$maestra['movilidad'] ?>" required disabled>
                        </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" value="<?php echo (double)$maestra['alimentacion'] ?>" required disabled>
                        </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" value="<?php echo (double)$maestra['otros_gastoscv'] ?>" required disabled>
                        </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" value="<?php echo (double)$maestra['total_cfoperaciones'] ?>" readonly required disabled>
                         
                        </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" value="<?php echo (double)$maestra['total_cf'] ?>" readonly required disabled>
                          
                        </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" value="<?php echo (double)$maestra['total_cfkm'] ?>" readonly required disabled>
                   

                        </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" value="<?php echo (double)$maestra['combustible'] ?>" readonly required disabled>
                        </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" value="<?php echo (double)$maestra['neuma_km'] ?>" readonly required disabled>
                        </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" value="<?php echo (double)$maestra['mtto_prevkm'] ?>" required disabled>
                        </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" value="<?php echo (double)$maestra['mtto_prevkmtotal'] ?>" readonly required disabled>
                        </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" value="<?php echo (double)$maestra['mtto_correctkm'] ?>" required disabled>
                        </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" value="<?php echo (double)$maestra['mtto_correctkmtotal'] ?>"  readonly required disabled>
                        </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" value="<?php echo (double)$maestra['TotalCostoVariable'] ?>" readonly required disabled>
                      

                        </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" value="<?php echo (double)$maestra['precio_comb'] ?>" required disabled>
                        </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" value="<?php echo (double)$maestra['KmRecorrido']?>" readonly required disabled>
                        </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" value="<?php echo (double)$maestra['TotalCostos'] ?>" readonly required disabled>
                    
                        </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" value="<?php echo (double)$maestra['TotalTarifa'] ?>" readonly required disabled>
                           
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
  </div>
</form>

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