Author Topic: Charter cost  (Read 168 times)

helpinfo

  • Newbie
  • *
  • Posts: 4
    • 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: 23
    • View Profile
Re: Charter cost
« Reply #2 on: July 30, 2018, 04:20:16 PM »
Thank you !

works for us


Jan

helpinfo

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