ARV187
Members-
Posts
261 -
Joined
-
Last visited
-
Days Won
3
ARV187 last won the day on July 29
ARV187 had the most liked content!
Profile Information
-
Gender
Not Telling
-
Location
Spain
Recent Profile Visitors
13290 profile views
ARV187's Achievements
-
If someone want export the phpvms7 flights to volanta, can be done exporting database data to csv with the next sql script. NOTE: If you have flights currently in volanta and are the same of phpvms7 this isn't overwrite, so you will have duplicate flights in Volanta (Volanta + phpvms7 flights) SELECT dpt_airport_id AS Origin, arr_airport_id AS Destination, block_off_time AS DepartureTime, pireps.flight_time AS Duration, airlines.name AS Airline, flight_number AS FlightNumber, aircraft.icao AS AircraftType, registration AS AircraftRegistration, route AS Route, block_on_time AS ArrivalTime, distance AS Distance, fuel_used AS Fuel FROM `pireps`, `aircraft`, `airlines` WHERE aircraft.id = pireps.aircraft_id AND airlines.id = pireps.airline_id AND user_id=1 ORDER BY block_on_time DESC;
- 1 reply
-
- 1
-
I know that this cost includes a lot of expenses, all those that the plane has per hour. But as we wanted to have have each expense detailed, we were doing it with the "expenses" section below. The problem, as I commented in github, is that the cost type "time" is missing. Yes, what we want to simulate is the cost of the cabin crew, not the pilot. We could do a cost per flight but it would not adjust to the duration of the hours worked by the crew. The name change was to make it simpler for us, as much as changing a word, to know where it could be done, obviously the change was just for us to do it, not to be done in development 😅. It was difficult for us to know what was the "block time cost" because we knew it by the name given in the administration "cost per hour" and by doing the maths we realised that it was the field we used for the wage/hour of the crew. 😄 Thanks Dispo!!
-
Hi, To recreate the cost of crew salary We are adding up their hourly wages and putting them in this box "Cost Per Hour" as there is no other box in the system to do an hourly calculation. When the pirep is sent instead of hourly cost it says "block time cost" so it was a bit difficult to relate that both were the same. You could change the word in the resulting pirep. Or better yet, do this: https://github.com/nabeelio/phpvms/issues/776 Adding the possibility of create a expense for time. Any solution? Thanks!!
-
Thank you, it has been very helpful to start. P.S: Listeners not working.
-
I'm thinking in this debit xD A full payback xD, but taking half can be good. Where you get flight_time and others, database fields? Or filled? I don't found that in \app\Events\PirepFiled.php
-
Hi, I'm trying to charge to pilot to accept a pirep not scheduled. I tried to follow an example, but I don't know what I must write in condition. if ($event->pirep-> !scheduled) Or how charge the Debit of pirep $amount = pirep expenses/debit; Thanks! \app\Listeners\FreeFlight.php <?php namespace App\Listeners; use App\Contracts\Listener; use App\Events\Expenses; use App\Events\PirepAccepted; use App\Models\Enums\ExpenseType; use App\Models\Expense; class FreeFlight extends Listener { public function handle(Expenses $event) { $expenses = []; $amount = pirep expenses/debit; if ($event->pirep-> !scheduled) { return $expenses; } $expenses[] = new Expense([ 'type' => ExpenseType::FLIGHT, 'amount' => $amount, 'transaction_group' => 'Free Flight', 'name' => 'Free flight Fee For Pirep='.$event->pirep->id, 'multiplier' => false, 'charge_to_user' => true ]); return $expenses; } }
-
Search by time: \lib\skins\YourSkin\schedule_searchform.tpl <li class="nav-item"><a class="nav-link" href="#flighttimetab"><span><button type="button" class="btn btn-primary">Por tiempo</button></span></a></li> //write this with the others tabs code <div id="flighttimetab" class="card-body text-white bg-dark"> <p>Selecciona tiempo de vuelo:</p> <select id="type" name="type"> <option value="greater">Mayor que</option> <option value="less">Menor que</option> </select> <input type="text" name="flighttime" value="" /> Horas <input type="submit" name="submit" value="Buscar vuelos" /> </div> \core\modules\Schedules\Schedules.php if($this->post->flighttime != '') { if($this->post->type == 'greater') $value = '> '; if($this->post->type == 'less') $value = '< '; $value .= $this->post->flighttime; $params = array('s.flighttime' => $value); }
-
Getting the "reg" value from selected "type" aircraft dropdown [Simbrief]
ARV187 replied to ARV187's topic in Support Forum
Thanks to @DisposableHero and @Nabeelfor the help Code from DisposableHero: <?php require_once ("xxx/db.php"); mysqli_select_db($db, $database_db); $resultSet = "SELECT icao, registration FROM phpvms_aircraft WHERE `enabled`='1' ORDER BY `icao` ASC"; ?> <select id="dropdown" onChange="ChangeFormValues()"> <?php $resultSet = mysqli_query($db, $resultSet) or die(mysqli_error($db)); while ($rows = $resultSet->fetch_assoc()) { $icao = $rows['icao']; $reg = $rows['registration']; // Build your dropdown with php, just put a seperator between them like # echo '<option value="'.$icao.'#'.$reg.'">'.$icao.' '.$reg.'</option>'; } ?> </select> <input type="text" id="icao" name="type" maxlength="4" placeholder="ICAO Type" readonly> <input type="text" id="reg" name="reg" maxlength="7" placeholder="Registration" readonly> <script selectIcao="text/javascript"> function ChangeFormValues() { // Get the selection, and then split it var selected = document.getElementById('dropdown').value.split("#") ; // Now set your form field values according to selection document.getElementById('icao').value = selected[0] ; // Start. Added later, as a quick and temporary solution to aircraft that are not in simbrief DB, a custom airframe is created and when choosing the icao in the dropdown it is replaced by the Simbrief Internal ID. if (document.getElementById('icao').value=="B38M") { document.getElementById('icao').value = "288759_1640167452930" ;} // end document.getElementById('reg').value = selected[1] ; } </script> -
Getting the "reg" value from selected "type" aircraft dropdown [Simbrief]
ARV187 replied to ARV187's topic in Support Forum
Hi, I'm trying the solution via json aproach, but I get this error: SyntaxError: JSON.parse: expected property name or '}' at line 1 column 1 of the JSON data My code: <?php $resultSet = "SELECT icao, registration FROM phpvms_aircraft"; $resultSet = mysqli_query($xxxx, $resultSet) or die(mysqli_error($xxxx)); while($rows = $resultSet->fetch_assoc()) { echo $icao = $rows['icao'] . ' '; echo $reg = $rows['registration'] . '<br>'; $dropdown = array('icao','registration'); } //Print out the array in a JSON format. header('Content-Type: application/json'); echo json_encode($dropdown);//Print out the array in a JSON format. ?> I'm using this example: https://thisinterestsme.com/select-options-with-ajax/ Do you see what I am doing wrong at first glance? P.S: Fixed, I still don't know what was wrong. I'm now in dropdown step (select aircraft, extract icao & registration in separate inputs). -
Getting the "reg" value from selected "type" aircraft dropdown [Simbrief]
ARV187 replied to ARV187's topic in Support Forum
Yeah, can be an option, anyway I only need a dropdown with airplanes icao's and automatically add the associated registration. I will see what option I choose to do it, thanks DisposableHero -
Getting the "reg" value from selected "type" aircraft dropdown [Simbrief]
ARV187 replied to ARV187's topic in Support Forum
Thanks! I will post when I find the solution the next week. I guess that phpvms7 code is different because of laravel and OOP -
Getting the "reg" value from selected "type" aircraft dropdown [Simbrief]
ARV187 replied to ARV187's topic in Support Forum
Thank you @DisposableHero I tried your modifications, but same result that mine. If I edit: $resultSet2 = "SELECT registration FROM phpvms_aircraft WHERE icao='".$avion."'"; To: $resultSet2 = "SELECT registration FROM phpvms_aircraft WHERE icao='A20N'"; The line: echo '<option value="'.$reg.'">'.$reg.'</option>'; Show: RG-101 (the right reg to A20N), but when I send the form (<form id="sbapiform"> in \lib\skins\bs4\schedule_briefing.tpl) the result from simbrief (SimBrief?ofp_id=fpNumber) is an auto reg because when you don't pass a "reg" simbrief autogenerate one. However if I write in input type text: <input name="reg" id="regist"> the result from simbrief is the correct value written in the input text field. So I see two issues: 1º Form isn't sending the value from: echo '<option value="'.$reg.'">'.$reg.'</option>'; but this value is showed rightly in form page (<form id="sbapiform"> in \lib\skins\bs4\schedule_briefing.tpl). 2º I'm not sure if WHERE variable is working because when I use icao='".$avion."' not is showing nothing in the web page echo '<option value="'.$reg.'">'.$reg.'</option>'; However if I use WHERE icao='A20N' is showed in form web page. $resultSet2 = "SELECT registration FROM phpvms_aircraft WHERE icao='".$avion."'"; The full original code is here Line 123 and below: https://github.com/vangelisb/Simbrief/tree/5022f0bcfa886767f197ae890bffcc29fb98ba6a/phpvms/copy included file to your template folder L131 <?php $planedata=(OperationsData::getAircraftByReg($schedule->registration)) ;?> <td><input type="hidden" name="type" size="5" type="text" placeholder="ZZZZ" value="<?php echo $planedata->icao ;?>"></td> L186 <input type="hidden" name="reg" value="<?php echo $schedule->registration?>"> -
Getting the "reg" value from selected "type" aircraft dropdown [Simbrief]
ARV187 replied to ARV187's topic in Support Forum
Ok, thanks anyway! -
Getting the "reg" value from selected "type" aircraft dropdown [Simbrief]
ARV187 replied to ARV187's topic in Support Forum
I'm so sorry, I completely forgot about that. phpVMS version? Version 2.1.936 PHP version? 5.6 MySQL/MariaDB version? 5.7.35 What modules are you using? None. Are you using the FltBook module? No. All work well, only I want add that auto reg selection in the input <input type="hidden" name="reg" value="<?php echo $schedule->registration?>"> For reference: https://github.com/vangelisb/Simbrief/tree/5022f0bcfa886767f197ae890bffcc29fb98ba6a/phpvms -
Hi there, Im trying autoselecting the registration code from DB after select aircraft in a dropdown menu. But I don't know why not work. Simbrief plan set an auto registration to selected airplane. At the moment I coded this: Input name values that simbrief form get are: "type" to aircraft, "reg" to registration. <?php require_once ("/Connections/db.php"); mysqli_select_db($db, $database_db); $resultSet = "SELECT icao, registration FROM phpvms_aircraft"; ?> <select name="type" id="typo" onChange="upicao()"> <?php $resultSet = mysqli_query($db, $resultSet) or die(mysqli_error($db)); while($rows = $resultSet->fetch_assoc()) { $icao = $rows['icao']; $reg = $rows['registration']; echo "<option value=$icao>$icao $reg</option>"; } ?> </select> <?php $avion = "<input type=hidden id=typo readonly>"; ?> <script type="text/javascript"> function upicao() { var select = document.getElementById('typo'); var option = select.options[select.selectedIndex]; document.getElementById('typo').value = option.value; } upicao(); </script> <?php if (($avion)!=null) { require_once ("/Connections/db.php"); mysqli_select_db($db, $database_db); $resultSet2 = "SELECT registration FROM phpvms_aircraft WHERE icao='" . $avion . "'"; ?> <b>Registro</b> (opcional): <input name="reg" id="regist"> <?php $resultSet2 = mysqli_query($db, $resultSet2) or die(mysqli_error($db)); while($rows = $resultSet2->fetch_assoc()) { $reg = $rows['registration']; echo "<option value=$reg>$reg</option>"; } } ?> Could someone help me with the code, it's been two weeks ... Thank you!