Jump to content

Recommended Posts

Posted

think it have not been asked before? if yes please give me a hint where

I have added something like this to simpilots charter module to get prices for the charter flights which works quite well ;)

$charter[price] = ($distance/100)*20;

is it possible to remove the manual price input and do it in background following maths operations like above?

Best Regards and Thanks in advance

Thomas

  • Moderators
Posted

You would need to edit the core files, but I'm not sure what your trying to do here.

Are you saying that you don't want the price to be counted in the schedule flight and use the php math in the code you used and put it in the schedules? Is that that your trying to do?

Posted

You would need to edit the core files, but I'm not sure what your trying to do here.

Are you saying that you don't want the price to be counted in the schedule flight and use the php math in the code you used and put it in the schedules? Is that that your trying to do?

what I want to do is that php math calculates the flight price for me and fill it in the flightplan formular :)

it works great with Charter Modul from Simpilot

but I don't know how I can get it into the schedule submit form in admin backend

  • Moderators
Posted

what I want to do is that php math calculates the flight price for me and fill it in the flightplan formular :)

it works great with Charter Modul from Simpilot

but I don't know how I can get it into the schedule submit form in admin backend

Your likely going to have to edit the admin core files, and what if you updated your phpVMS and you'll lose that feature?

If you want to go ahead and agree with that and it's not my fault for you to lose that feature when you update, and I'll type a piece of a code, simple and I'll show you how.

Posted

Your likely going to have to edit the admin core files, and what if you updated your phpVMS and you'll lose that feature?

If you want to go ahead and agree with that and it's not my fault for you to lose that feature when you update, and I'll type a piece of a code, simple and I'll show you how.

yes please help me with the code :)

just found out that 30 works better as multiplicator

thanks in advance

Thomas

  • Moderators
Posted

Okay, here we go...

1) Go to admin/modules/Operations/Operations.php

2) Find the following line... (Around Line 950 to 1150)

    $data = array(
	    'code' => $this->post->code,
	    'flightnum' => $this->post->flightnum,
	    'depicao' => $this->post->depicao,
	    'arricao' => $this->post->arricao,
	    'route' => $this->post->route,

3) Add before the line I posted above the $data = array

$payperdis = ($this->post->distance/100)*20;

4) Then we need to change the $data arrays, so find this, in the same area

'price' => $this->post->price,

5) Replace the code with the following...

'price' => $payperdis,

And it should do it automatically for you, and if you putted in the price, remember, it will change because of that.

  • Like 1
Posted

thank you very much :)

will make the changes tomorow since I have a flight running at the moment!

modified your code a bit

$payperdis = round((($this->post->distance/100)*30), 2);

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...