本文整理汇总了PHP中MiscLib::centStrToDouble方法的典型用法代码示例。如果您正苦于以下问题:PHP MiscLib::centStrToDouble方法的具体用法?PHP MiscLib::centStrToDouble怎么用?PHP MiscLib::centStrToDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MiscLib
的用法示例。
在下文中一共展示了MiscLib::centStrToDouble方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cents
/**
Add a tender to the transaction
@right tender amount in cents (100 = $1)
@strl tender code from tenders table
@return An array see Parser::default_json()
for format explanation.
This function will automatically end a transaction
if the amount due becomes <= zero.
*/
public static function tender($right, $strl)
{
$ret = array('main_frame' => false, 'redraw_footer' => false, 'target' => '.baseHeight', 'output' => "");
$strl = MiscLib::centStrToDouble($strl);
if (CoreLocal::get('RepeatAgain')) {
// the default tender prompt utilizes boxMsg2.php to
// repeat the previous input, plus amount, on confirmation
// the tender's preReqCheck methods will need to pretend
// this is the first input rather than a repeat
CoreLocal::set('msgrepeat', 0);
CoreLocal::set('RepeatAgain', false);
}
$tender_mods = self::getTenderMods($right);
$tender_object = null;
foreach ($tender_mods as $class) {
if (!class_exists($class)) {
$ret['output'] = DisplayLib::boxMsg(_('tender is misconfigured'), _('Notify Administrator'), false, DisplayLib::standardClearButton());
return $ret;
}
$tender_object = new $class($right, $strl);
/**
Do tender-specific error checking and prereqs
*/
$error = $tender_object->ErrorCheck();
if ($error !== true) {
$ret['output'] = $error;
return $ret;
}
$prereq = $tender_object->PreReqCheck();
if ($prereq !== true) {
$ret['main_frame'] = $prereq;
return $ret;
}
}
// add the tender record
$tender_object->Add();
Database::getsubtotals();
// see if transaction has ended
if (CoreLocal::get("amtdue") <= 0.005) {
CoreLocal::set("change", -1 * CoreLocal::get("amtdue"));
$cash_return = CoreLocal::get("change");
TransRecord::addchange($cash_return, $tender_object->ChangeType(), $tender_object->ChangeMsg());
CoreLocal::set("End", 1);
$ret['receipt'] = 'full';
$ret['output'] = DisplayLib::printReceiptFooter();
TransRecord::finalizeTransaction();
} else {
CoreLocal::set("change", 0);
CoreLocal::set("fntlflag", 0);
Database::setglobalvalue("FntlFlag", 0);
$chk = self::ttl();
if ($chk === true) {
$ret['output'] = DisplayLib::lastpage();
} else {
$ret['main_frame'] = $chk;
}
}
$ret['redraw_footer'] = true;
return $ret;
}