本文整理汇总了PHP中PilotData::getPilotPay方法的典型用法代码示例。如果您正苦于以下问题:PHP PilotData::getPilotPay方法的具体用法?PHP PilotData::getPilotPay怎么用?PHP PilotData::getPilotPay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PilotData
的用法示例。
在下文中一共展示了PilotData::getPilotPay方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkPIREP
/**
* SchedulePIREPTest::checkPIREP()
*
* @param mixed $pirepdata
* @return void
*/
protected function checkPIREP($pirep_test, $pirepid)
{
$sched = $this->findSchedule();
$pirepdata = PIREPData::findPIREPS(array('p.pirepid' => $pirepid));
$pirepdata = $pirepdata[0];
$this->checkPIREPFinances($pirep_test, $pirepdata);
# Check the pilot pay
$pilot_data = PilotData::getPilotData($this->samplePilotID);
# Change PIREP Status
$status = PIREPData::changePIREPStatus($pirepdata->pirepid, PIREP_ACCEPTED);
$pirepdata = PIREPData::findPIREPS(array('p.pirepid' => $pirepid));
$this->assertEquals(PIREP_ACCEPTED, $pirepdata[0]->accepted, 'changePIREPStatus to ACCEPTED');
$pirepdata = $pirepdata[0];
# Check the schedule flown count:
$post_accept = $this->findSchedule();
$this->assertEquals($sched->timesflown + 1, $post_accept->timesflown, "Schedule increment count");
# Check the pilot pay
$post_pilot_data = PilotData::getPilotData($this->samplePilotID);
$pay_log = LedgerData::getPaymentByPIREP($pirepid);
if ($pirepdata->paytype == PILOT_PAY_SCHEDULE) {
$this->assertEquals($this->sample_schedule['payforflight'], $pirepdata->pilotpay, 'PIREP Pay Amount');
$this->assertEquals($this->sample_schedule['payforflight'], $pay_log->amount, 'Check pilot pay after PIREP ACCEPT');
} else {
$this->assertEquals(PilotData::getPilotPay($this->sample_schedule['flighttime'], $pilot_data->payrate), $pay_log->amount, 'Check pilot pay after PIREP ACCEPT');
}
$this->assertEquals($pilot_data->totalflights + 1, $post_pilot_data->totalflights, 'Total Flights');
# Check total hours
$this->assertGreaterThan($pilot_data->totalhours, $post_pilot_data->totalhours, 'Checking total hours');
# Reject the PIREP and then check the pilot pay
$status = PIREPData::changePIREPStatus($pirepdata->pirepid, PIREP_REJECTED);
$pirepdata = PIREPData::findPIREPS(array('p.pirepid' => $pirepid));
$this->assertEquals(PIREP_REJECTED, $pirepdata[0]->accepted, 'changePIREPStatus to REJECTED');
$pirepdata = $pirepdata[0];
# Check the schedule flown count:
$post_accept = $this->findSchedule();
$this->assertEquals($sched->timesflown, $post_accept->timesflown, "Schedule increment count");
$post_pilot_data = PilotData::getPilotData($this->samplePilotID);
$this->assertEquals($pilot_data->totalpay, $post_pilot_data->totalpay, 'Check pilot pay after PIREP REJECT');
$this->assertEquals($pilot_data->totalflights, $post_pilot_data->totalflights, 'Total Flights after REJECT');
# Delete the PIREP
PIREPData::deletePIREP($pirepid);
# Verify delete
$data = PIREPData::findPIREPS(array('p.pirepid' => $pirepid));
$this->assertEmpty($data, 'PIREPDdata::deletePIREP()');
}
示例2: testPIREPPerHourPay
/**
* SchedulePIREPTest::testPIREPPerHourPay()
*
* @return void
*/
public function testPIREPPerHourPay()
{
$this->resetPilot();
$sched = $this->findSchedule();
Config::Set('PIREP_CHECK_DUPLICATE', false);
Config::Set('EMAIL_SEND_PIREP', false);
# Update this schedule to only pay per-hour
SchedulesData::editScheduleFields($sched->id, array('payforflight' => 0));
$sched = $this->findSchedule();
$this->assertEquals(0, $sched->payforflight, 'Pay per-flight set to 0');
$pirep_test = array('pilotid' => $this->samplePilotID, 'code' => $sched->code, 'flightnum' => $sched->flightnum, 'route' => $sched->route, 'depicao' => $sched->depicao, 'arricao' => $sched->arricao, 'aircraft' => $sched->aircraft, 'flighttime' => $sched->flighttime, 'submitdate' => 'NOW()', 'fuelused' => 6000, 'source' => 'unittest', 'comment' => 'Test Flight');
# Update Pilot Pay to be set to zero
PilotData::updateProfile($this->samplePilotID, array('totalpay' => 0));
$pilot_data = PilotData::getPilotData($this->samplePilotID);
$this->assertEquals($pilot_data->totalpay, 0, 'Reset Pilot Pay to 0');
# File the flight report
$pirepid = PIREPData::fileReport($pirep_test);
$this->assertGreaterThan(0, $pirepid, PIREPData::$lasterror);
$pirepdata = PIREPData::findPIREPS(array('p.pirepid' => $pirepid));
$this->assertGreaterThan(0, count($pirepdata), 'No PIREPs returned');
# Work on one...
$pirepdata = $pirepdata[0];
# Verify the little bits of this PIREP....
$this->assertEquals(PILOT_PAY_HOURLY, $pirepdata->paytype, 'PIREP Pay Type');
$this->assertEquals($pilot_data->payrate, $pirepdata->pilotpay, 'PIREP Pay Amount');
# Check the pilot pay
$pilot_data = PilotData::getPilotData($this->samplePilotID);
$this->assertEquals(0, $pilot_data->totalpay, 'Check pilot pay after PIREP FILE');
$this->assertEquals(0, $pilot_data->totalflights, 'Check total flights after PIREP FILE');
# Change PIREP Status
$status = PIREPData::changePIREPStatus($pirepdata->pirepid, PIREP_ACCEPTED);
$pirepdata = PIREPData::findPIREPS(array('p.pirepid' => $pirepid));
$this->assertEquals(PIREP_ACCEPTED, $pirepdata[0]->accepted, 'changePIREPStatus to ACCEPTED');
$pirepdata = $pirepdata[0];
# Check the schedule flown count:
$post_accept = $this->findSchedule();
$this->assertEquals($sched->timesflown + 1, $post_accept->timesflown, "Schedule increment count");
# Check the pilot pay
$pilot_data = PilotData::getPilotData($this->samplePilotID);
$this->assertEquals(PilotData::getPilotPay($this->sample_schedule['flighttime'], $pilot_data->payrate), $pilot_data->totalpay, 'Check pilot pay after PIREP ACCEPT');
# Reject the PIREP and then check the pilot pay
$status = PIREPData::changePIREPStatus($pirepdata->pirepid, PIREP_REJECTED);
$pirepdata = PIREPData::findPIREPS(array('p.pirepid' => $pirepid));
$this->assertEquals(PIREP_REJECTED, $pirepdata[0]->accepted, 'changePIREPStatus to ACCEPTED');
$pirepdata = $pirepdata[0];
# Check the schedule flown count:
$post_accept = $this->findSchedule();
$this->assertEquals($sched->timesflown, $post_accept->timesflown, "Schedule increment count");
$post_pilot_data = PilotData::getPilotData($this->samplePilotID);
$this->assertEquals(0, $post_pilot_data->totalpay, 'Check pilot pay after PIREP REJECT');
$this->assertEquals(0, $post_pilot_data->totalflights, 'Total Flights after REJECT');
# Delete the PIREP
PIREPData::deletePIREP($pirepid);
# Verify delete
$data = PIREPData::findPIREPS(array('p.pirepid' => $pirepid));
$this->assertEmpty($data, 'PIREPDdata::deletePIREP()');
}