本文整理汇总了PHP中Zend_Currency::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Currency::add方法的具体用法?PHP Zend_Currency::add怎么用?PHP Zend_Currency::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Currency
的用法示例。
在下文中一共展示了Zend_Currency::add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _checkPreviousClaims
/**
* Identifies if the previous claims will force a referral.
*
* @param string $refNo
* The unique legacy customer reference number.
*
* @return mixed
* Returns an array of referral reasons. If there are no referral reasons,
* then will return null.
*/
protected function _checkPreviousClaims($refNo)
{
$previousClaimsReferralReasons = array();
if (empty($this->_previousClaimsModel)) {
$this->_previousClaimsModel = new Datasource_Insurance_PreviousClaims();
}
$previousClaimsArray = $this->_previousClaimsModel->getPreviousClaims($refNo);
if (!empty($previousClaimsArray)) {
//Tenant has one or more claims. Add the totals together to see if they exceed
//the threshold.
$claimsTotal = new Zend_Currency(array('value' => 0, 'precision' => 2));
foreach ($previousClaimsArray as $previousClaim) {
$claimsTotal->add($previousClaim->getClaimValue());
}
//Test against the previous claims threshold
$claimsThreshold = new Zend_Currency(array('value' => $params->uw->rt->portfolio->claimsThreshold, 'precision' => 2));
if ($claimsTotal->isMore($claimsThreshold)) {
$previousClaimsReferralReasons[] = $params->uw->rr->portfolio->previousClaims;
}
}
//Return the results consistent with this method's contract.
if (empty($previousClaimsReferralReasons)) {
$returnVal = null;
} else {
$returnVal = $previousClaimsReferralReasons;
}
return $returnVal;
}
示例2:
echo $this->translate('online-shop.back-office.order.order-items');
?>
</th>
<th></th>
<th width="100"><?php
echo $this->translate('online-shop.back-office.order.price.total');
?>
</th>
</tr>
</thead>
<tbody>
<?php
$totalSum = new Zend_Currency(OnlineShop_Framework_Factory::getInstance()->getEnvironment()->getCurrencyLocale());
foreach ($paginator as $item) {
/* @var \OnlineShop\Framework\OrderManager\IOrderListItem $item */
$totalSum->add($item->getTotalPrice());
?>
<tr>
<td>
<?php
$urlDetail = $this->url(['action' => 'detail', 'controller' => 'admin-order', 'module' => 'OnlineShop', 'id' => $item->getOrderId()], null, true);
?>
<a href="<?php
echo $urlDetail;
?>
"><?php
echo $item->getOrderNumber();
?>
</a>
</td>
<td>
示例3: testModValues
/**
* Modulo values
*/
public function testModValues()
{
$currency = new Zend_Currency(array('currency' => 'EUR', 'locale' => 'de_AT'));
$currency->add(801);
$currency->mod(2);
$this->assertEquals('€ 1,00', $currency->toCurrency());
}
示例4: summaryDialogAction
/**
* Displays the reference summary details page as a popup.
*/
public function summaryDialogAction()
{
$this->_helper->getHelper('layout')->disableLayout();
$session = new Zend_Session_Namespace('referencing_global');
$referenceManager = new Manager_Referencing_Reference();
$reference = $referenceManager->getReference($session->referenceId);
//Prepare the prospective landlord details.
$prospectiveLandlord = $reference->propertyLease->prospectiveLandlord;
$pllArray = array();
$pllArray['name'] = $prospectiveLandlord->name->firstName . ' ' . $prospectiveLandlord->name->lastName;
$pllArray['contactName'] = '';
$pllArray['address'] = $prospectiveLandlord->address->addressLine1 . ' ' . $prospectiveLandlord->address->addressLine2 . ' ' . $prospectiveLandlord->address->town;
$pllArray['postCode'] = $prospectiveLandlord->address->postCode;
$pllArray['telephone'] = $prospectiveLandlord->contactDetails->telephone1;
$pllArray['mobile'] = $prospectiveLandlord->contactDetails->telephone2;
$pllArray['email'] = $prospectiveLandlord->contactDetails->email1;
$this->view->prospectiveLandlord = $pllArray;
//Prepare the property details.
$propertyArray = array();
$propertyArray['address'] = $reference->propertyLease->address->addressLine1 . ' ' . $reference->propertyLease->address->addressLine2 . ' ' . $reference->propertyLease->address->town;
$propertyArray['postCode'] = $reference->propertyLease->address->postCode;
$propertyArray['rent'] = $reference->propertyLease->rentPerMonth->getValue();
$propertyArray['startDate'] = $reference->propertyLease->tenancyStartDate->toString();
$propertyArray['duration'] = $reference->propertyLease->tenancyTerm;
$propertyArray['noOfTenants'] = $reference->propertyLease->noOfTenants;
$this->view->property = $propertyArray;
//Prepare the reference subject details
$referenceSubject = $reference->referenceSubject;
$referenceSubjectArray = array();
$referenceSubjectArray['name'] = $referenceSubject->name->firstName . ' ' . $referenceSubject->name->lastName;
$referenceSubjectArray['maidenName'] = $referenceSubject->name->maidenName;
$referenceSubjectArray['dob'] = $referenceSubject->dob->toString();
if (!empty($referenceSubject->bankAccount)) {
$referenceSubjectArray['bankAccountNumber'] = $referenceSubject->bankAccount->accountNumber;
$referenceSubjectArray['bankSortCode'] = $referenceSubject->bankAccount->sortCode;
} else {
$referenceSubjectArray['bankAccountNumber'] = '';
$referenceSubjectArray['bankSortCode'] = '';
}
$referenceSubjectArray['telephone'] = $referenceSubject->contactDetails->telephone1;
$referenceSubjectArray['mobile'] = $referenceSubject->contactDetails->telephone2;
$referenceSubjectArray['email'] = $referenceSubject->contactDetails->email1;
$residenceManager = new Manager_Referencing_Residence();
$residence = $residenceManager->findSpecificResidence($reference->referenceSubject->residences, Model_Referencing_ResidenceChronology::CURRENT);
$referenceSubjectArray['currentResidentialStatus'] = Model_Referencing_ResidenceStatus::toString($residence->status);
$occupationManager = new Manager_Referencing_Occupation();
$occupation = $occupationManager->findSpecificOccupation($reference->referenceSubject->occupations, Model_Referencing_OccupationChronology::CURRENT, Model_Referencing_OccupationImportance::FIRST);
//Convert the occupation type to an 'occupation status' for display purposes.
switch ($occupation->type) {
case Model_Referencing_OccupationTypes::EMPLOYMENT:
$occupationStatus = 'Employed';
break;
case Model_Referencing_OccupationTypes::CONTRACT:
$occupationStatus = 'On Contract';
break;
case Model_Referencing_OccupationTypes::SELFEMPLOYMENT:
$occupationStatus = 'Self Employed';
break;
case Model_Referencing_OccupationTypes::INDEPENDENT:
$occupationStatus = 'Financially Independent';
break;
case Model_Referencing_OccupationTypes::RETIREMENT:
$occupationStatus = 'Retired';
break;
case Model_Referencing_OccupationTypes::STUDENT:
$occupationStatus = 'Student';
break;
case Model_Referencing_OccupationTypes::UNEMPLOYMENT:
$occupationStatus = 'Unemployed';
break;
case Model_Referencing_OccupationTypes::OTHER:
$occupationStatus = 'Other';
break;
default:
throw new Zend_Exception(get_class() . '::' . __FUNCTION__ . ': unknonwn type provided.');
}
$referenceSubjectArray['currentOccupationStatus'] = $occupationStatus;
$referenceSubjectArray['isOccupationLikelyToChange'] = $occupation->isPermanent ? 'No' : 'Yes';
//Calculate the total income.
$totalIncome = new Zend_Currency(array('value' => 0, 'precision' => 0));
foreach ($reference->referenceSubject->occupations as $occupation) {
$totalIncome->add($occupation->income);
}
$referenceSubjectArray['income'] = $totalIncome->getValue();
$referenceSubjectArray['shareOfRent'] = $referenceSubject->shareOfRent->getValue();
$this->view->referenceSubject = $referenceSubjectArray;
//Prepare the current landlord details.
$currentResidence = $residenceManager->findSpecificResidence($reference->referenceSubject->residences, Model_Referencing_ResidenceChronology::CURRENT);
$currentLandlordArray = array();
if (!empty($currentResidence->refereeDetails)) {
$currentLandlordArray['name'] = $currentResidence->refereeDetails->name->firstName . ' ' . $currentResidence->refereeDetails->name->lastName;
$currentLandlordArray['address'] = $currentResidence->refereeDetails->address->addressLine1 . ' ' . $currentResidence->refereeDetails->address->addressLine2 . ' ' . $currentResidence->refereeDetails->address->town;
$currentLandlordArray['postCode'] = $currentResidence->refereeDetails->address->postCode;
$currentLandlordArray['telephoneDay'] = $currentResidence->refereeDetails->contactDetails->telephone1;
$currentLandlordArray['telephoneEvening'] = $currentResidence->refereeDetails->contactDetails->telephone2;
$currentLandlordArray['fax'] = $currentResidence->refereeDetails->contactDetails->fax1;
$currentLandlordArray['email'] = $currentResidence->refereeDetails->contactDetails->email1;
//.........这里部分代码省略.........
示例5: insertReferenceSubject
public function insertReferenceSubject($referenceSubject)
{
//Get the bank account details.
if (!empty($referenceSubject->bankAccount)) {
$accountNumber = $referenceSubject->bankAccount->accountNumber;
$sortCode = $referenceSubject->bankAccount->sortCode;
if ($referenceSubject->bankAccount->isValidated) {
$isValidated = 'Yes';
} else {
$isValidated = 'No';
}
} else {
$accountNumber = '';
$sortCode = '';
$isValidated = 'N/A';
}
//Get the current residential status.
if (!empty($referenceSubject->residences)) {
foreach ($referenceSubject->residences as $residence) {
if ($residence->chronology == Model_Referencing_ResidenceChronology::CURRENT) {
switch ($residence->status) {
case Model_Referencing_ResidenceStatus::OWNER:
$currentResidentialStatus = 'Owner';
break;
case Model_Referencing_ResidenceStatus::TENANT:
$currentResidentialStatus = 'Tenant';
break;
case Model_Referencing_ResidenceStatus::LIVING_WITH_RELATIVES:
$currentResidentialStatus = 'Living with Relative';
break;
}
break;
}
}
}
//Get the occupational income.
$totalIncome = new Zend_Currency(array('value' => 0, 'precision' => 0));
foreach ($referenceSubject->occupations as $occupation) {
$totalIncome->add($occupation->income);
}
//Get the current occupational status.
$currentOccupationalStatus = '';
foreach ($referenceSubject->occupations as $occupation) {
if ($occupation->chronology == Model_Referencing_OccupationChronology::CURRENT) {
if ($occupation->importance == Model_Referencing_OccupationImportance::FIRST) {
switch ($occupation->type) {
case Model_Referencing_OccupationTypes::EMPLOYMENT:
$currentOccupationalStatus = 'Employed';
break;
case Model_Referencing_OccupationTypes::CONTRACT:
$currentOccupationalStatus = 'On Contract';
break;
case Model_Referencing_OccupationTypes::SELFEMPLOYMENT:
$currentOccupationalStatus = 'Self Employed';
break;
case Model_Referencing_OccupationTypes::INDEPENDENT:
$currentOccupationalStatus = 'of Independent Means';
break;
case Model_Referencing_OccupationTypes::RETIREMENT:
$currentOccupationalStatus = 'Retired';
break;
case Model_Referencing_OccupationTypes::STUDENT:
$currentOccupationalStatus = 'Student';
break;
case Model_Referencing_OccupationTypes::UNEMPLOYMENT:
$currentOccupationalStatus = 'Unemployed';
break;
}
//Whilst we are here, determine if the occupation is permanent.
if ($occupation->isPermanent) {
$occupationChange = 'No';
} else {
$occupationChange = 'Yes';
}
break;
}
}
}
if (empty($referenceSubject->shareOfRent)) {
$shareOfRent = 0;
} else {
$shareOfRent = $referenceSubject->shareOfRent->getValue();
}
if (empty($referenceSubject->dob)) {
$dob = '0000-00-00';
} else {
$dob = $referenceSubject->dob->toString(Zend_Date::ISO_8601);
}
//Finally, push to munt
$data = array('title' => empty($referenceSubject->name->title) ? '' : $referenceSubject->name->title, 'firstname' => empty($referenceSubject->name->firstName) ? '' : $referenceSubject->name->firstName, 'middlename' => empty($referenceSubject->name->middleName) ? '' : $referenceSubject->name->middleName, 'lastname' => empty($referenceSubject->name->lastName) ? '' : $referenceSubject->name->lastName, 'maidenname' => empty($referenceSubject->name->maidenName) ? '' : $referenceSubject->name->maidenName, 'dob' => $dob, 'tel' => empty($referenceSubject->contactDetails->telephone1) ? '' : $referenceSubject->contactDetails->telephone1, 'mobile' => empty($referenceSubject->contactDetails->telephone2) ? '' : $referenceSubject->contactDetails->telephone2, 'email' => empty($referenceSubject->contactDetails->email1) ? '' : $referenceSubject->contactDetails->email1, 'rstatus' => $currentResidentialStatus, 'estatus' => $currentOccupationalStatus, 'echange' => $occupationChange, 'RentShare' => $shareOfRent, 'income' => $totalIncome->getValue(), 'hasCCJs' => $referenceSubject->hasAdverseCredit == true ? 'Yes' : 'No', 'isForeignNational' => $referenceSubject->isForeignNational == true ? 'yes' : 'no', 'accountNo' => $accountNumber, 'sortcodeNo' => $sortCode, 'bankValidationCheckStatus' => $isValidated);
return $this->insert($data);
}
示例6: getReferralReasons
/**
* Implements abstract method from superclass - refer to superclass for description.
*/
public function getReferralReasons($policyNumber)
{
$referralReasons = array();
$params = Zend_Registry::get('params');
$quote = new Manager_Insurance_TenantsContentsPlus_Quote(null, null, $policyNumber);
if ($quote->getPolicyName() == 'tenantsp') {
//Test 1: If the cover is greater than the threshold, then refer.
$contentsAmount = $quote->getPolicyOptionAmountCovered('contentstp');
$contentsThreshold = new Zend_Currency(array('value' => $params->uw->rt->tenantsp->contents, 'precision' => 0));
if ($contentsAmount >= $contentsThreshold) {
$referralReasons[] = $params->uw->rr->tenantsp->cover;
}
//Test 2: If claim values are greater than 1000 then refer.
if (empty($this->_previousClaimsModel)) {
$this->_previousClaimsModel = new Datasource_Insurance_PreviousClaims();
}
$previousClaimsArray = $this->_previousClaimsModel->getPreviousClaims($quote->getRefno());
if (!empty($previousClaimsArray)) {
//Tenant has one or more claims. Add the totals together to see if they exceed
//the threshold.
$claimsTotal = new Zend_Currency(array('value' => 0, 'precision' => 2));
foreach ($previousClaimsArray as $previousClaim) {
$claimsTotal->add($previousClaim->getClaimValue());
}
//Test against the previous claims threshold
$claimsThreshold = new Zend_Currency(array('value' => $params->uw->rt->tenantsp->claimsThreshold, 'precision' => 2));
if ($claimsTotal->isMore($claimsThreshold)) {
$referralReasons[] = $params->uw->rr->tenantsp->previousClaims;
}
}
//Test 3: Answering the underwriting questions.
$answersManager = new Manager_Insurance_Answers();
$answersArray = $answersManager->getUnderwritingAnswers($policyNumber);
if (empty($answersArray)) {
//You can't process for referral if no underwriting answers have first been provided.
throw new Zend_Exception(get_class() . __FUNCTION__ . ": no underwriting answers provided.");
}
foreach ($answersArray as $currentAnswer) {
//Identify if the current answer is one that should be checked.
if (in_array($currentAnswer->getQuestionNumber(), $params->uw->rt->tenantsp->checkAnswer->toArray())) {
$answer = $currentAnswer->getAnswer();
if ($answer == Model_Insurance_Answer::YES) {
$referralReasons[] = $params->uw->rr->tenantsp->answer;
}
}
}
//Test 4: pedal cycles over 1500
$pedalCyclesModel = new Datasource_Insurance_Policy_Cycles($quote->getRefno(), $policyNumber);
$pedalCyclesArray = $pedalCyclesModel->listBikes();
if (!empty($pedalCyclesArray)) {
$pedalCycleThreshold = new Zend_Currency(array('value' => $params->uw->rt->tenantsp->pedalCycle, 'precision' => 2));
foreach ($pedalCyclesArray as $currentPedalCycle) {
//Compare the pedal cycle values in Zend_Currency format for simplity.
$currentCycleValue = new Zend_Currency(array('value' => $currentPedalCycle['value'], 'precision' => 2));
if ($currentCycleValue->isMore($pedalCycleThreshold)) {
$referralReasons[] = $params->uw->rr->tenantsp->pedalCycle;
}
}
}
//Test 5: specified possessions greater than threshold
$specPossessionsModel = new Datasource_Insurance_Policy_SpecPossessions($policyNumber);
$specPossessionsArray = $specPossessionsModel->listPossessions();
if (!empty($specPossessionsArray)) {
//Wrap the threshold parameter in a Zend_Currency object for easier comparisons.
$specPossessionThreshold = new Zend_Currency(array('value' => $params->uw->rt->tenantsp->specPossession, 'precision' => 2));
//Cycle through each specpossession...
foreach ($specPossessionsArray as $currentSpecPossession) {
//Wrap the current specpossession value in a Zend_Currency for easier comparision.
$currentSpecPossessionValue = new Zend_Currency(array('value' => $currentSpecPossession['value'], 'precision' => 2));
//Determine if the threshold is exceeded:
if ($currentSpecPossessionValue->isMore($specPossessionThreshold)) {
$referralReasons[] = $params->uw->rr->tenantsp->specPossession;
}
}
}
} else {
throw new Zend_Exception("Invalid product.");
}
return $referralReasons;
}