Jump to content

Another Finances Question


TAV1702

Recommended Posts

Hey Nabeel, I am wondering if there is any way at all in to making the system allow us to give sign on bonuses.

For example, register now and file a pirep that is verifyable by use of an acars type script and recieve a 5k sign on bonus on pirep acceptance.

I have done this already, but when you optimize the database and recalculate stuff, it takes the cash away from the pilot and puts everything back in order. I know that is how it is supposed to work and that is great. I was just curious if there was a way around it for that one very reason or similar.

Oh and I almost forgot. Since I updated to 943, I can not edit pilot info such as transfer hours or cash or anything. I can add them to groups though. Strange. I have optimized my database and all and still a no go. It just seems stuck.

Link to comment
Share on other sites

TAV

See this post as I outlined what I did to get around the problem that you are describing

http://forum.phpvms.net/topic/3250-request-heavy-landing-pilot-pay-cost/page__p__22100__hl__bonushours__fromsearch__1#entry22100

Yeah and the funny part is I just read that and like a dork I came and posted here. My apologies for that. I like the last poster on that page am not to slick with the code necessary to do such things. I can template ok, but I get a little on the iffy side after that. The only sure thing I would get out of that would be to ruin my website and have to upload backups. ;)

Link to comment
Share on other sites

I have to add a payadjust column like Jeff described.

Yeah that would be sweet as hell. I know how time is now days though. ;-) I will try as I can to do the quick fix that was listed on that other thread. Thanks for replying Nabeel.

Link to comment
Share on other sites

Guest lorathon

This is what I did.

First you need to add a field to the pilots table using phpVMS. I added the field payadjust as a 'float'

/admin/modules/PilotAdmin/PilotAdmin.php

Under case 'saveprofile':

This takes the info sent from the form (see below) and adds it to the current and then saves it right back into the pilots row in the DB.

$payadjust = $this->post->payadjust + $this->post->addpay;  // This adds the previous payadjust with anything entered in the form field

$params = array(
				'code' => $this->post->code,
				'firstname' => $this->post->firstname,
				'lastname' => $this->post->lastname,
				'email' => $this->post->email,
				'location' => $this->post->location,
				'hub' => $this->post->hub,
				'retired' => $retired,
				'totalhours' => $this->post->totalhours,
				'totalflights' => $this->post->totalflights,
				'totalpay' => $totalpay,
				'transferhours' => $this->post->transferhours,					
				'payadjust'  => $payadjust                      // This is the pay adjust field

			);

/admin/templates/pilot_details.tpl

additon of the following below total pay

This adds a form field to the pilot details template and also info text. The form field allows you to put in the adjustment you desire. The info text shows what is currently in the payadjust field (what the pilot already has)

<tr>
	<td>Total Pay Adjustment</td>
	<td><?php echo $pilotinfo->payadjust;?><input type="hidden" name="payadjust" value="<?php echo $pilotinfo->payadjust;?>" /></td>
</tr>
<tr>
	<td>Adjust Pay ( use -XX to subtract pay )</td>
	<td><input type="text" name="addpay" value="" />  Reason: <input type="text" name="paydescrip" value="" /></td>
</tr>

/core/templates/profile_main.tpl (better if changed in the skin folder)

The following is modified to add the totalpay and the new payadjust into a total for the pilot

<td></td><td><li><strong>Total Earnings: </strong><?php echo FinanceData::FormatMoney($userinfo->totalpay + $userinfo->payadjust) ?></td>

Link to comment
Share on other sites

This is what I did.

First you need to add a field to the pilots table using phpVMS. I added the field payadjust as a 'float'

/admin/modules/PilotAdmin/PilotAdmin.php

Under case 'saveprofile':

This takes the info sent from the form (see below) and adds it to the current and then saves it right back into the pilots row in the DB.

$payadjust = $this->post->payadjust + $this->post->addpay;  // This adds the previous payadjust with anything entered in the form field

$params = array(
				'code' => $this->post->code,
				'firstname' => $this->post->firstname,
				'lastname' => $this->post->lastname,
				'email' => $this->post->email,
				'location' => $this->post->location,
				'hub' => $this->post->hub,
				'retired' => $retired,
				'totalhours' => $this->post->totalhours,
				'totalflights' => $this->post->totalflights,
				'totalpay' => $totalpay,
				'transferhours' => $this->post->transferhours,					
				'payadjust'  => $payadjust                      // This is the pay adjust field

			);

/admin/templates/pilot_details.tpl

additon of the following below total pay

This adds a form field to the pilot details template and also info text. The form field allows you to put in the adjustment you desire. The info text shows what is currently in the payadjust field (what the pilot already has)

<tr>
	<td>Total Pay Adjustment</td>
	<td><?php echo $pilotinfo->payadjust;?><input type="hidden" name="payadjust" value="<?php echo $pilotinfo->payadjust;?>" /></td>
</tr>
<tr>
	<td>Adjust Pay ( use -XX to subtract pay )</td>
	<td><input type="text" name="addpay" value="" />  Reason: <input type="text" name="paydescrip" value="" /></td>
</tr>

/core/templates/profile_main.tpl (better if changed in the skin folder)

The following is modified to add the totalpay and the new payadjust into a total for the pilot

<td></td><td><li><strong>Total Earnings: </strong><?php echo FinanceData::FormatMoney($userinfo->totalpay + $userinfo->payadjust) ?></td>

Thanks Lorathon! I'll check in to doing that here in a few. I appreciate it.

Link to comment
Share on other sites

Ok I got everything in the templates looking good. However, when I try to add pay, it does not update the pilots total cash amount. Did I miss something somewhere? Was I supposed to do anything in phpMyadmin?

I did not try to subtract pay. I only tried to add pay to his total.

Would I have to add this pay through a pirep only? I did it via tha admin center when viewing that pilots info.

Link to comment
Share on other sites

Guest lorathon

Did you add the new field?

First you need to add a field to the pilots table using phpVMS. I added the field payadjust as a 'float'

It does not show the total in the admin section. Only in your pilot section. If you want to use it elsewhere you have to do the same.

$pay = $pilot->totalpay + $pilot->payadjust;

Link to comment
Share on other sites

Guest lorathon

I also left something in the code that you can remove. I have a reason field but this is for another module that I use. It records comments and such.

Remove this from the pilot_details.tpl

 Reason: <input type="text" name="paydescrip" value="" />

Link to comment
Share on other sites

Ahh the field is where I went wrong. That is the part that I was worrying about. I am not sure how to do that. Can you elaborate a little further on that one please? And ok thanks for letting me know to delete that code. I will dot hat now. ;)

**EDIT** Ok I found where to add profile fields. Is this where I need to be?

Link to comment
Share on other sites

Guest lorathon

BACK-UP your DB before attempting modifications if you are not sure what you are doing.

To add the field

1. Got to phpAdmin

2. select the DB on the left hand side that is tied to phpVMS

3. Scroll down the list of tables until you locate the table phpvms_pilots on the left hand side (if you used a different prefix then you will have to search for it)

4. Select the pilots table (highlight it)

5. At the top of the right window you will see a tab marked structure. Click it

6. This is the structure of the pilots table. At the bottom it should be defaulted to "add 1 field to end of table" Click the GO

7. on the next window you will enter the following info

FIELD - payadjust

TYPE - float

8. Click the save in the lower right hand corner. And that is it.

Link to comment
Share on other sites

Jeff, I seemed to get it working, but I have a question. When you (the Admin) adjust the pilots pay, where does the information go to? (where will the "Reason" show up when you adjusted the pay? Will it be shown in the pilot's profile, their e-mail or where?) I know the amount will show up in their profile page next to "Total Earnings"b but when you adjust it from the Admin Center, there is a place for reason, that is the question.

(Yeah, I typed it, and I'm confused :D )

Link to comment
Share on other sites

Guest lorathon

I also left something in the code that you can remove. I have a reason field but this is for another module that I use. It records comments and such.

Remove this from the pilot_details.tpl

 Reason: <input type="text" name="paydescrip" value="" />

Link to comment
Share on other sites

Ok I was right the first time around it was phpmyadmin. that is where I got confused because you said phpvms. ;) Now I know what you are talking about. Thanks again. I will get to it here in a bit and get it tricked out. thanks again for the help on this one.

And yeah, My site gets backed up 3 times per day via a cron job I have on the server. I do not have enough traffic to worry about loosing a couple hours info in case anything goes wrong. ;)

Link to comment
Share on other sites

Success! On the database and template edits. However, I can not get it to take an advance in pay nor a subtraction. If I adjust pay via the database, it will remain as it should and appear as it should as far as templates goes, but simply adjusting it via the admin panel I am not getting any luck on. That is strange for sure. I have double checked the install twice.

I'll keep playing with it and see what I can get to happen or lack there of.

Link to comment
Share on other sites

Ok so after hours on end today messing with this, I have double and triple checked my edits and database and all is well. I just can not adjust pay through the admin center. If I do, I have to do it via phpmyadmin. I am not sure what is wrong to be honest. :(

Link to comment
Share on other sites

I can not attach rar file here so I will pm you the dload link. Thanks for having a look. I am sure it is something simple I fudged up. I can provide a screenshot of the database field structure too if you want, But I know it is good and working because I can update payadjust via phpmyadmin and it transfers info over to the website.

Link to comment
Share on other sites

  • 1 month later...

If anyone has tried this and it would not update pilot pay, you are on a older beta version. Nabeel has been made aware of a bug in the system and was or did fix it in the newest Beta. So if you have the newest beta it should work fine, if not then try this.

*****OPEN*****

/admin/modules/PilotAdmin/PilotAdmin.php

In the

$params = array( section

*****FIND AND DELETE*****

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

*****OPEN*****

admin/templates/pilot_details.tpl

*****FIND AND DELETE*****

<tr>

<td>Admin Comment</td>

<td><textarea style="width: 100%; height: 70px;" name="comment"><?php echo $pilotinfo->comment;?></textarea>

</tr>

*****EOM*****

*****CLOSE AND SAVE ALL FILES*****

*****ENJOY*****

Link to comment
Share on other sites

I actually just put a full install site yesterday again. I have not upgraded to the beta on it yet. As soon as I do I will give it a try and see how she works.

I thought you pointed out that you fixed the comment thing. B)

This post was in regards to a PM I got on adjusting pilot pay. I figured I would post it public so everyone who may have the issue can try this fix.

Link to comment
Share on other sites

  • 8 months later...

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...