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
// End income for regular flights
AFTER ADD
// 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
$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
$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
define ('INCOME_REGULAR_ROUTES' , 'INCOME REGULAR ROUTES');
AFTER ADD
define ('INCOME_CHARTER_ROUTES' , 'INCOME CHARTER ROUTES');