Author Topic: Financial Modul  (Read 5784 times)

UweK

  • Full Member
  • ***
  • Posts: 132
    • View Profile
    • Terra-Fly VA IVAO Certified
Financial Modul
« on: November 25, 2015, 11:50:09 AM »
Hi,

I made a flight over 3h yesterday. Unfortunatly only our costs are shown but not our profit. Pax and cargo price was set.

Any ideas?

Regards Uwe

YYZ342

  • Newbie
  • *
  • Posts: 21
  • If I could only stop flying toy air planes...
    • View Profile
    • NiA Virtual Airline Group
Re: Financial Modul
« Reply #1 on: December 06, 2015, 09:08:08 PM »
Same problem for me. First flight yesterday. Only COSTS PILOTS SALARY was calculated on Financial Reports page . INCOME, INCOME REGULAR ROUTES are empty.
Table vaprofits was empty.
Suggested calculate_flight_finances.php fix did not work.

Suggested fix http://virtualairlinesmanager.net/download/vam_installer/debug_flight_finances.zip seems to have worked with few remaining problems:
1. Pilot Salary COSTS PILOTS SALARY: not showing as cost to VA on Financial Report page BUT is showing as salary paid to the pilot
2. Aircraft purchase AIRCRAFT PURCHASE: costs are not listed. Suspect because va_finances table was emptied. How do we add the aircraft purchase costs back, I tried to Edit the Aircraft (no changes) and saving thinking it would force the update but it did not.

fix http://virtualairlinesmanager.net/download/vam_installer/debug_flight_finances.zip report follows:

query to get the date for finance activation
select DATE_FORMAT(date_activation_finance_module,'%Y%m%d') as date_activation_finance_module from va_parameters
Activation date
20151011
query to get simacars flights
select gvauser_id, flightid, flight_duration,pax, cargo, block_fuel, distance, route_id,DATE_FORMAT(flight_date,'%Y%m%d') as flight_date from vampireps where validated=1 and flightid not in (select distinct(report_id) from va_finances where report_id is not NULL)
Flight Date:20150912
diff_days:
-99
Flight Date:20150913
diff_days:
-98
Flight Date:20150913
diff_days:
-98
Flight Date:20151002
diff_days:
-9
Flight Date:20151003
diff_days:
-8
Flight Date:20151004
diff_days:
-7
Flight Date:20151009
diff_days:
-2
Flight Date:20151010
diff_days:
-1
query to get manual flights
select gvauser_id,pirep_id,duration,pax ,cargo,fuel,distance,route,DATE_FORMAT(created_at,'%Y%m%d') as flight_date from pireps where valid=1 and pirep_id not in (select distinct(report_id) from va_finances where report_id is not NULL)
diff_days:
-7
query to get fs keeper flights
select gvauser_id,IDPIREP,FlightTime,Passenger,Cargo,BlockFuel,DistanceFlight,route,DATE_FORMAT(CreatedOn,'%Y%m%d') as flight_date from pirepfsfk where validated=1 and IDPIREP not in (select distinct(report_id) from va_finances where report_id is not NULL)


Thanks
Cheers

niavirtual.com
***********
XP 10.42
i7-5820k 3.3Mhz
GTX 970 4GB
HyperX Fury 32GB 2133Mhz DDR4
Samsung EVO 850 250GB SSD
MSI X99S SLI PLUS
Windows 10

YYZ342

  • Newbie
  • *
  • Posts: 21
  • If I could only stop flying toy air planes...
    • View Profile
    • NiA Virtual Airline Group
Re: Financial Modul
« Reply #2 on: December 06, 2015, 10:42:49 PM »
I made a flight to check. Manual pirep. Result was no financial data was recorded except salary was updated. Salary was updated as profit when should be as cost.

Report follows:
query to get the date for finance activation
select DATE_FORMAT(date_activation_finance_module,'%Y%m%d') as date_activation_finance_module from va_parameters
Activation date
20151011
query to get simacars flights
select gvauser_id, flightid, flight_duration,pax, cargo, block_fuel, distance, route_id,DATE_FORMAT(flight_date,'%Y%m%d') as flight_date from vampireps where validated=1 and flightid not in (select distinct(report_id) from va_finances where report_id is not NULL)
Flight Date:20150912
diff_days:
-99
Flight Date:20150913
diff_days:
-98
Flight Date:20150913
diff_days:
-98
Flight Date:20151002
diff_days:
-9
Flight Date:20151003
diff_days:
-8
Flight Date:20151004
diff_days:
-7
Flight Date:20151009
diff_days:
-2
Flight Date:20151010
diff_days:
-1
Flight Date:20151206
diff_days:
195
calculate_cost simacars:22|201512517515766117068|6.76|51639175.99|3027|SIM ACARS|1051|14450
COSTS

------------------

query sql_cost:
select * from financial_parameters where parameter_active=1 and is_cost=1
linked_to_flight
amount:-200
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (1,now(),-200,22,'AIRPORT TAXES','SIM ACARS','201512517515766117068')
linked_to_pax
amount:-7740
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (4,now(),-7740,22,'CATERING(15). Number of PAX: 516','SIM ACARS','201512517515766117068')
linked_to_flight
amount:-700
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (6,now(),-700,22,'ENGINE WEAR','SIM ACARS','201512517515766117068')
linked_to_fuel
amount:-14886.8762
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (9,now(),-14886.8762,22,'FUEL(0.38). Fuel used: 39175.99','SIM ACARS','201512517515766117068')
linked_to_flight
amount:-500
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (10,now(),-500,22,'GROUND HANDLING','SIM ACARS','201512517515766117068')
linked_to_flight
amount:-5000
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (11,now(),-5000,22,'LANDING FEES','SIM ACARS','201512517515766117068')
linked_to_pax
amount:-2580
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (15,now(),-2580,22,'SECURITY(5). Number of PAX: 516','SIM ACARS','201512517515766117068')
income

------------------

routes:
select * from routes where route_id=1051
amount:1973700
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (99999,now(),1973700,22,'Number of PAX:516 .Price per PAX:3825','SIM ACARS','201512517515766117068')
amount:28900
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (99998,now(),28900,22,'Cargo:14450 .Price per Cargo Unit:2','SIM ACARS','201512517515766117068')
profit:
select * from financial_parameters where parameter_active=1 and is_profit=1
linked_to_pax
amount:2580
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (2,now(),2580,22,'ADDITIONAL BAGS(5). Number of PAX: 516','SIM ACARS','201512517515766117068')
linked_to_pax
amount:5160
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (3,now(),5160,22,'ALCOHOL BEVERAGE(10). Number of PAX: 516','SIM ACARS','201512517515766117068')
linked_to_pax
amount:1548
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (5,now(),1548,22,'CARRYON LUGGAGE(3). Number of PAX: 516','SIM ACARS','201512517515766117068')
linked_to_pax
amount:7740
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (7,now(),7740,22,'ENTERTAINMENT ON BOARD(15). Number of PAX: 516','SIM ACARS','201512517515766117068')
linked_to_pax
amount:335400
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (8,now(),335400,22,'FARE(650). Number of PAX: 516','SIM ACARS','201512517515766117068')
linked_to_flight
amount:1000
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (12,now(),1000,22,'MARKETING','SIM ACARS','201512517515766117068')
linked_to_pax
amount:10320
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (13,now(),10320,22,'MEAL ON BOARD(20). Number of PAX: 516','SIM ACARS','201512517515766117068')
linked_to_pax
amount:2580
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (14,now(),2580,22,'WIFI ON BOARD(5). Number of PAX: 516','SIM ACARS','201512517515766117068')
query to get manual flights
select gvauser_id,pirep_id,duration,pax ,cargo,fuel,distance,route,DATE_FORMAT(created_at,'%Y%m%d') as flight_date from pireps where valid=1 and pirep_id not in (select distinct(report_id) from va_finances where report_id is not NULL)
diff_days:
-7
diff_days:
195
calculate_cost Manual:22|23|408|012000|1586|Manual report|0|0
COSTS

------------------

query sql_cost:
select * from financial_parameters where parameter_active=1 and is_cost=1
linked_to_flight
amount:-200
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (1,now(),-200,22,'AIRPORT TAXES','Manual report','23')
linked_to_pax
amount:0
linked_to_flight
amount:-700
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (6,now(),-700,22,'ENGINE WEAR','Manual report','23')
linked_to_fuel
amount:-4560
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (9,now(),-4560,22,'FUEL(0.38). Fuel used: 12000','Manual report','23')
linked_to_flight
amount:-500
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (10,now(),-500,22,'GROUND HANDLING','Manual report','23')
linked_to_flight
amount:-5000
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (11,now(),-5000,22,'LANDING FEES','Manual report','23')
linked_to_pax
amount:0
income

------------------

routes:
select * from routes where route_id=0
profit:
select * from financial_parameters where parameter_active=1 and is_profit=1
linked_to_pax
amount:0
linked_to_pax
amount:0
linked_to_pax
amount:0
linked_to_pax
amount:0
linked_to_pax
amount:0
linked_to_flight
amount:1000
into va_finances:
insert into va_finances (parameter_id,finance_date,amount,gvauser_id, description, report_type,report_id) values (12,now(),1000,22,'MARKETING','Manual report','23')
linked_to_pax
amount:0
linked_to_pax
amount:0
query to get fs keeper flights
select gvauser_id,IDPIREP,FlightTime,Passenger,Cargo,BlockFuel,DistanceFlight,route,DATE_FORMAT(CreatedOn,'%Y%m%d') as flight_date from pirepfsfk where validated=1 and IDPIREP not in (select distinct(report_id) from va_finances where report_id is not NULL)
Cheers
 
« Last Edit: December 06, 2015, 10:51:17 PM by YYZ342 »
niavirtual.com
***********
XP 10.42
i7-5820k 3.3Mhz
GTX 970 4GB
HyperX Fury 32GB 2133Mhz DDR4
Samsung EVO 850 250GB SSD
MSI X99S SLI PLUS
Windows 10

NCLWDT

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
    • NCL Gaming Australia
Re: Financial Modul
« Reply #3 on: December 07, 2015, 06:37:50 AM »
Are you sure you installed database correctly?

Have you gone through VA settings in admin and acars ?

YYZ342

  • Newbie
  • *
  • Posts: 21
  • If I could only stop flying toy air planes...
    • View Profile
    • NiA Virtual Airline Group
Re: Financial Modul
« Reply #4 on: December 20, 2015, 02:06:55 PM »
Kind of late coming back. To answer your question, nope I am not sure. This is the problem for me.  Some of the data seems to be in the right place, some of it is not or missing. I cannot seem to get my head around the db structure.
Cheers
niavirtual.com
***********
XP 10.42
i7-5820k 3.3Mhz
GTX 970 4GB
HyperX Fury 32GB 2133Mhz DDR4
Samsung EVO 850 250GB SSD
MSI X99S SLI PLUS
Windows 10

NCLWDT

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
    • NCL Gaming Australia
Re: Financial Modul
« Reply #5 on: December 21, 2015, 11:09:52 AM »
The only thing that i can think of is the DB is not installed properly.

I can replace your DB for you if want.

or you can do your self.

Make sure you upload the shcema first then the other files 1-5 in order.

You will have to re-do the admin name, password again.

When you upload DB files make sure the - Do not use AUTO_INCREMENT for zero values - is clicked / ticked.

this is same for all DB files

also -check you DB user permissions / privileges - make sure they are ALL clicked ( All Privileges )
« Last Edit: December 21, 2015, 11:12:31 AM by NCLWDT »

UweK

  • Full Member
  • ***
  • Posts: 132
    • View Profile
    • Terra-Fly VA IVAO Certified
Re: Financial Modul
« Reply #6 on: December 22, 2015, 07:57:59 PM »
Hi Mate,

as attached two screenshots of our DB and directory on ftp server.

The settings you can see should be correct, shouldn´t they?

I give it up. Have no ideas any more...

You are higly invited to have a look via teamview to control our settings if you want.

Regards, Uwe
« Last Edit: December 22, 2015, 08:01:39 PM by UweK »

NCLWDT

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
    • NCL Gaming Australia
Re: Financial Modul
« Reply #7 on: December 23, 2015, 05:47:59 AM »
you should not need to change any permissions for files.

if any permissions need changing it will be for you database, not files.

when you create a user for a database, you are asked what Privileges the user can have.
Usually it is ALL Privileges.

find where your database is ( NOT phpadmin )
see what permissions / Privileges the main user it has ( YOU ) and make sure all the boxes are ticked / checked.

UweK

  • Full Member
  • ***
  • Posts: 132
    • View Profile
    • Terra-Fly VA IVAO Certified
Re: Financial Modul
« Reply #8 on: December 23, 2015, 11:45:58 AM »
I am sorry but I don´t know what you mean and where I can find these settings.
Would you please so kind and give me an example?

Regards,

Uwe

NCLWDT

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
    • NCL Gaming Australia
Re: Financial Modul
« Reply #9 on: December 23, 2015, 12:45:13 PM »
it will be in your website manager - cPanel ( if you have cpanel ) - or where you got to look at server settings.
MySql Databases.
Current Databases.
Click on the Privileged User for that database and alter Privileges to ALL and then save.

If you use a free website, that maybe your problem.

I can have a look if you want,
email me here with server login details. ( username and pwd )
nclgaming@iinet.net.au


It will have to be tomorrow that i can look at it, I am in Australia.

UweK

  • Full Member
  • ***
  • Posts: 132
    • View Profile
    • Terra-Fly VA IVAO Certified
Re: Financial Modul
« Reply #10 on: December 23, 2015, 01:52:35 PM »
aaah,

now I know what you mean. No, I am not using a free website hoster.

I looked at my admin panel but there is no possibility to change settings for a user.
I think as owner of the website I have all privileges as default.

Attached you will find some screenshots from my admin panel. Fortunately I could change the language in english :-)

Regards,

Uwe

UweK

  • Full Member
  • ***
  • Posts: 132
    • View Profile
    • Terra-Fly VA IVAO Certified
Re: Financial Modul
« Reply #11 on: December 23, 2015, 01:53:23 PM »
picture 2

UweK

  • Full Member
  • ***
  • Posts: 132
    • View Profile
    • Terra-Fly VA IVAO Certified
Re: Financial Modul
« Reply #12 on: December 23, 2015, 01:54:00 PM »
picture 3

NCLWDT

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
    • NCL Gaming Australia
Re: Financial Modul
« Reply #13 on: December 24, 2015, 04:14:05 AM »
Theoretically, you would have had to do the privileges when you made the user for the database.
any way, thats all i can do, without having actual access to the server.

UweK

  • Full Member
  • ***
  • Posts: 132
    • View Profile
    • Terra-Fly VA IVAO Certified
Re: Financial Modul
« Reply #14 on: December 24, 2015, 11:37:40 AM »
First: Merry x-mas to you and your familiy

Let me know when you have time (z-time).

Regards,
Uwe