Author Topic: Charter cost  (Read 1090 times)

helpinfo

  • Newbie
  • *
  • Posts: 6
    • View Profile
Charter cost
« on: May 18, 2018, 12:16:40 AM »
Salut à tous, je vous fait un petit partage, j'ai mis en place le calcul pax et cargo des vols charter avec ajout dans le module finance.
c'est fonctionnel mais ça peu toujours être amélioré.


Hi all, I make you a little sharing, I set up the calculation pax and cargo charter flights with addition in the finance module.
it's functional but it can always be improved

OPEN calculate_flight_finances.php
FIND
Code: [Select]
// End income for regular flightsAFTER ADD
Code: [Select]
                // income section for charter flights
$sql_cost = "select * from vampireps where flightid='$flight_id'";
if (!$result_cost = $db->query($sql_cost)) {
die('There was an error running the query [' . $db->error . ']');
}
while ($row_cost = $result_cost->fetch_assoc()) {
// Income by PAX
$pax_char_price = 250000; // Your pax price for charter
$cargo_char_price = 2500; // Your cargo price for charter
$amount = $pax_char_price * $pax;
$descrip= 'Number of PAX:' .$pax.' .Charter Price per PAX:'.$pax_char_price;
if ($amount!=0)
{
$sql = "insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (99994,now(),$amount,$gvauser_id,'$descrip','$reporttype','$flight_id')";
if (!$result = $db->query($sql)) {
die('There was an error running the query [' . $db->error . ']');
}
}

$amount = $cargo_char_price * $cargo;
$descrip= 'Cargo:' .$cargo.' .Price per Cargo Unit:'.$cargo_char_price;
if ($amount!=0)
{
$sql = "insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (99993,now(),$amount,$gvauser_id,'$descrip','$reporttype','$flight_id')";
if (!$result = $db->query($sql)) {
die('There was an error running the query [' . $db->error . ']');
}
}
}
// End income section for charter flights
( replace value $pax_char_price and $cargo_char_price by your price)

OPEN va_global_financial_report.php
FIND
Code: [Select]
$sql = "SELECT 'Aircraft Repair' as description,sum(vaf.amount) as vaf_amount FROM  va_finances vaf  where vaf.parameter_id in (99996) group by parameter_id";
if (!$result8= $db->query($sql)) {
die('There was an error running the query  [' . $db->error . ']');
}
AFTER ADD
Code: [Select]
$sql = "SELECT 'Cargo in charter flight' as des,sum(vaf.amount) as vaf_amount FROM  va_finances vaf  where vaf.parameter_id in (99993) group by parameter_id";
if (!$result9= $db->query($sql)) {
die('There was an error running the query  [' . $db->error . ']');
}

$sql = "SELECT 'PAX in charter flight' as des,sum(vaf.amount) as vaf_amount FROM  va_finances vaf  where vaf.parameter_id in (99994) group by parameter_id";
if (!$result10= $db->query($sql)) {
die('There was an error running the query  [' . $db->error . ']');
}

OPEN languages/lang_en.php
FIND
Code: [Select]
define ('INCOME_REGULAR_ROUTES' , 'INCOME REGULAR ROUTES');
AFTER ADD
Code: [Select]
define ('INCOME_CHARTER_ROUTES' , 'INCOME CHARTER ROUTES');
« Last Edit: May 18, 2018, 12:26:33 AM by helpinfo »

quepsi83

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
Re: Charter cost
« Reply #1 on: May 23, 2018, 04:38:22 PM »
"Hmmmm... This looks like a pretty interesting 'TWEAK' to the overall logic of VAM Operations.

Thank you for sharing.

Cheers,

Keith

smokey

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Charter cost
« Reply #2 on: July 30, 2018, 04:20:16 PM »
Thank you !

works for us


Jan

helpinfo

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Charter cost
« Reply #3 on: August 16, 2018, 01:41:02 PM »
thank you for your thanks
 ;)

Caporrella

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Charter cost
« Reply #4 on: March 31, 2019, 04:07:01 PM »
don't on my site  :-\

Bruchpilot

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Hamburg-Airways
Re: Charter cost
« Reply #5 on: May 02, 2019, 08:08:50 PM »
A great approach, now depending on the flight length then it fits well. A 100 nm flight and 1000nm may not be the same.
either the time or length as a multiplier.
thanks for that :) :) :) :)

I supplemented it with the flight time.
Example:  calculate_flight_finances.php
Code: [Select]
// income section for charter flights
$sql_cost = "select * from vampireps where flightid='$flight_id'";
if (!$result_cost = $db->query($sql_cost)) {
die('There was an error running the query [' . $db->error . ']');
}
while ($row_cost = $result_cost->fetch_assoc()) {
// Income by PAX
$pax_char_price = 100; // Your pax price for charter
$cargo_char_price = 10; // Your cargo price for charter
$amount = $pax_char_price * $pax * $flight_duration;
$descrip= 'Number of PAX:' .$pax.' .Charter Price per PAX:'.$pax_char_price;
if ($amount!=0)
{
$sql = "insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (99994,now(),$amount,$gvauser_id,'$descrip','$reporttype','$flight_id')";
if (!$result = $db->query($sql)) {
die('There was an error running the query [' . $db->error . ']');
}
}

$amount = $cargo_char_price * $cargo * $flight_duration;
$descrip= 'Cargo:' .$cargo.' .Price per Cargo Unit:'.$cargo_char_price;
if ($amount!=0)
{
$sql = "insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (99993,now(),$amount,$gvauser_id,'$descrip','$reporttype','$flight_id')";
if (!$result = $db->query($sql)) {
die('There was an error running the query [' . $db->error . ']');
}
}
}
// End income section for charter flights

Gruß Uwe
« Last Edit: May 04, 2019, 08:44:25 AM by Bruchpilot »

airnubeiro

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Charter cost
« Reply #6 on: August 04, 2020, 11:57:12 PM »
Servus Uwe

Well fisrt of all thank you guys for supporting that system with great new ideas, even if the project seems to be death at the moment. I tried to add that php lines and it worked, but when I'm flying a regular flight no calculations are done... What could be the problem. And do we have to have to delete the section of "income for any flight"?

Thank you so much for the support guys

loko_06

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Charter cost
« Reply #7 on: January 11, 2021, 07:00:55 PM »
hello,

it works for me but i have a issue , when i complete a regular flight , he give me the money for the regular (pax and cargo) and the charter (pax and cargo)

do you have some idea ?