当前位置: 首页>>代码示例>>PHP>>正文


PHP DataHandler::convertMoneyToBrazil方法代码示例

本文整理汇总了PHP中DataHandler::convertMoneyToBrazil方法的典型用法代码示例。如果您正苦于以下问题:PHP DataHandler::convertMoneyToBrazil方法的具体用法?PHP DataHandler::convertMoneyToBrazil怎么用?PHP DataHandler::convertMoneyToBrazil使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataHandler的用法示例。


在下文中一共展示了DataHandler::convertMoneyToBrazil方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: purchaseDetail

 public function purchaseDetail()
 {
     //iniciando o retorno padrao em http result
     $returnResult = new HttpResult();
     //id do pedido
     $id_purchase_order = DataHandler::forceInt($this->arrayRestFolder[1]);
     //agora verifica se esse pedido é desse usuário
     $eh_desse_cara = $this->checkPurchaseOwner($id_purchase_order, UserClient::getId());
     if ($eh_desse_cara) {
         //o pedido é dele
         //busca o detalhe dos pedidos
         $VO = new PurchaseOrderVO();
         $VO->setId($id_purchase_order, TRUE);
         $StdVO = $VO->toStdClass();
         $returnResult->setSuccess(TRUE);
         $retornoDaPaginaHTML = new PurchaseInfo();
         //lista os pagamentos efetuados pra esse id
         //$StdVO->id
         include_once "library/e_commerce/modules/payment/dao/PaymentDAO.class.php";
         $PaymentDAO = PaymentDAO::getInstance();
         $ReturnResultVO = $PaymentDAO->select(PaymentDAO::RETURN_VO, NULL, 1, NULL, $StdVO->id);
         $ReturnResultVO->transformAllVoInStdClass();
         //~inventa um parametro
         $StdVO->array_payment = array();
         $StdVO->total_payment = 0;
         if ($ReturnResultVO->success) {
             $StdVO->array_payment = $ReturnResultVO->result;
             foreach ($StdVO->array_payment as $StdPaymentVO) {
                 $StdVO->total_payment += DataHandler::forceNumber($StdPaymentVO->total_value);
             }
         }
         $StdVO->total_payment = DataHandler::convertMoneyToBrazil($StdVO->total_payment, FALSE);
         $StdVO->total_a_pagar = 0;
         $tempDebito = DataHandler::forceNumber($StdVO->total_value) - DataHandler::forceNumber($StdVO->total_payment);
         if ($tempDebito > 0) {
             $StdVO->total_a_pagar = $tempDebito;
         }
         $StdVO->total_a_pagar = DataHandler::convertMoneyToBrazil($StdVO->total_a_pagar, FALSE);
         include_once "library/e_commerce/modules/purchase/dao/PurchaseItemDAO.class.php";
         $PurchaseItemDAO = PurchaseItemDAO::getInstance();
         /*
          * 
          */
         $ReturnDataVO = $PurchaseItemDAO->select(PurchaseItemDAO::RETURN_VO, NULL, NULL, $StdVO->id);
         $ReturnDataVO->transformAllVoInStdClass();
         //~inventa um parametro
         $StdVO->array_itens = array();
         if ($ReturnDataVO->success) {
             $StdVO->array_itens = $ReturnDataVO->result;
         }
         $valorSomandoItens = 0;
         foreach ($StdVO->array_itens as $item) {
             $valorSomandoItens = $valorSomandoItens + DataHandler::forceNumber($item->product_price) * $item->quantity;
         }
         $descontoFinal = 0;
         $CouponVO = new CouponVO();
         $arrayLinkVO = $VO->getLinks("coupon", 1);
         if (count($arrayLinkVO) > 0) {
             //busca todos os cupons dentro da validade e que o codigo token não é obrigatorio
             $CouponDAO = CouponDAO::getInstance();
             $ReturnDataVO = $CouponDAO->select(CouponDAO::RETURN_VO, $arrayLinkVO[0]->linked_table_id, 2, NULL, NULL, NULL, NULL, NULL, date('Y-m-d'), $date_in_symbol = "<=", date('Y-m-d'), $date_out_symbol = ">=");
             if ($ReturnDataVO->success && count($ReturnDataVO->result) > 0) {
                 $CouponVO = $ReturnDataVO->result[0];
                 switch ($CouponVO->getType()) {
                     case "+":
                         $descontoFinal = $CouponVO->getValue() + $valorSomandoItens;
                         break;
                     case "-":
                         $descontoFinal = $CouponVO->getValue() - $valorSomandoItens;
                         break;
                     case "*":
                         $descontoFinal = $valorSomandoItens - $valorSomandoItens * ($CouponVO->getValue() / 100);
                         break;
                     default:
                         break;
                 }
             }
         }
         $CouponStd = $CouponVO->toStdClass();
         $CouponStd->valor_total = $valorSomandoItens;
         $CouponStd->valor_desconto = $valorSomandoItens - $descontoFinal;
         $StdVO->coupon = $CouponStd;
         $retornoDaPaginaHTML->std_vo = $StdVO;
         $returnResult->setHttpContentResult($retornoDaPaginaHTML);
     } else {
         $returnResult->setSuccess(FALSE);
         $returnResult->addMessage("Não foi encontrado o detalhe desse pedido.");
     }
     //retorna pra view
     return $returnResult;
 }
开发者ID:reytuty,项目名称:facil,代码行数:91,代码来源:Account.php


注:本文中的DataHandler::convertMoneyToBrazil方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。