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


PHP Payment::getAllByCriteria方法代码示例

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


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

示例1: _getData

 protected static function _getData()
 {
     if (count(self::$_dateRange) === 0) {
         $yesterdayLocal = new UDate('now', 'Australia/Melbourne');
         $yesterdayLocal->modify('-1 day');
         $fromDate = new UDate($yesterdayLocal->format('Y-m-d') . ' 00:00:00', 'Australia/Melbourne');
         $fromDate->setTimeZone('UTC');
         $toDate = new UDate($yesterdayLocal->format('Y-m-d') . ' 23:59:59', 'Australia/Melbourne');
         $toDate->setTimeZone('UTC');
     } else {
         $fromDate = self::$_dateRange['start'];
         $toDate = self::$_dateRange['end'];
     }
     $dataType = 'created';
     $items = Payment::getAllByCriteria($dataType . ' >= :fromDate and ' . $dataType . ' < :toDate', array('fromDate' => trim($fromDate), 'toDate' => trim($toDate)));
     $now = new UDate();
     $now->setTimeZone('Australia/Melbourne');
     $return = array();
     foreach ($items as $item) {
         $return[] = array('Type' => $item->getOrder() instanceof Order ? 'Payment' : 'Credit', 'InvNo' => $item->getOrder() instanceof Order ? trim($item->getOrder()->getInvNo()) === '' ? '' : $item->getOrder()->getInvNo() : '', 'Payment Date' => $item->getPaymentDate()->setTimeZone('Australia/Melbourne')->format('Y-m-d'), 'Customer Name' => $item->getOrder() instanceof Order ? $item->getOrder()->getCustomer() instanceof Customer ? $item->getOrder()->getCustomer()->getName() : '' : '', 'Order No.' => $item->getOrder() instanceof Order ? $item->getOrder()->getOrderNo() : '', 'CreditNote No' => $item->getCreditNote() instanceof CreditNote ? $item->getCreditNote()->getCreditNoteNo() : '', 'Processed Date' => trim($item->getCreated()->setTimeZone('Australia/Melbourne')), 'Processed By' => $item->getCreatedBy() instanceof UserAccount ? $item->getCreatedBy()->getPerson()->getFullName() : '', 'Method' => $item->getMethod() instanceof PaymentMethod ? trim($item->getMethod()->getName()) : '', 'Amount' => StringUtilsAbstract::getCurrency($item->getCreditNote() instanceof CreditNote ? 0 - $item->getValue() : $item->getValue()), 'Comments' => trim(implode(',', array_map(create_function('$a', 'return $a->getComments();'), Comments::getAllByCriteria('entityName = ? and entityId = ?', array(get_class($item), $item->getId()))))));
     }
     return $return;
 }
开发者ID:larryu,项目名称:magento-b2b,代码行数:23,代码来源:PaymentExport_Xero.php

示例2: getPayments

 /**
  * Getting the payments
  *
  * @param unknown $sender
  * @param unknown $param
  */
 public function getPayments($sender, $param)
 {
     $result = $error = array();
     try {
         $pageNo = 1;
         $pageSize = $this->pageSize;
         if (isset($param->CallbackParameter->pagination)) {
             $pageNo = isset($param->CallbackParameter->pagination->pageNo) ? $param->CallbackParameter->pagination->pageNo : $pageNo;
             $pageSize = isset($param->CallbackParameter->pagination->pageSize) ? $param->CallbackParameter->pagination->pageSize : $pageSize;
         }
         if (!isset($param->CallbackParameter->entity) || !isset($param->CallbackParameter->entityId) || ($entityName = trim($param->CallbackParameter->entity)) === '' || !($entity = $entityName::get(trim($param->CallbackParameter->entityId))) instanceof $entityName) {
             throw new Exception('System Error: invalid Order or CreditNote provided. Can NOT get any payments at all.');
         }
         if ($entity instanceof Order) {
             $where = 'orderId = ?';
         } else {
             if ($entity instanceof CreditNote) {
                 $where = 'creditNoteId = ?';
             } else {
                 throw new Exception('System Error: you can ONLY get payments for a Order or a CreditNote');
             }
         }
         $stats = $items = array();
         foreach (Payment::getAllByCriteria($where, array($entity->getId()), true, $pageNo, $pageSize, array('id' => 'desc'), $stats) as $payment) {
             $items[] = $payment->getJson();
         }
         $result['pagination'] = $stats;
         $result['items'] = $items;
         if ($pageNo === 1) {
             $result['paymentMethods'] = array_map(create_function('$a', 'return $a->getJson();'), PaymentMethod::findAll());
         }
     } catch (Exception $ex) {
         $error[] = $ex->getMessage();
     }
     $param->ResponseData = StringUtilsAbstract::getJson($result, $error);
 }
开发者ID:larryu,项目名称:magento-b2b,代码行数:42,代码来源:PaymentListPanel.php

示例3: preSave

 /**
  * (non-PHPdoc)
  * @see BaseEntityAbstract::preSave()
  */
 public function preSave()
 {
     if (trim($this->getId()) !== '') {
         $items = CreditNoteItem::getAllByCriteria('creditNoteId = ?', array($this->getId()));
         $total = $this->getShippingValue();
         foreach ($items as $item) {
             $total = $total * 1 + $item->getTotalPrice() * 1;
         }
         $this->setTotalValue($total);
         $payments = Payment::getAllByCriteria('creditNoteId = ?', array($this->getId()));
         $totalPaid = 0;
         foreach ($payments as $payment) {
             $totalPaid += $payment->getValue();
         }
         $this->setTotalPaid($totalPaid);
     } else {
         if ($this->getOrder() instanceof Order && intval($this->getOrder()->getStatus()->getId()) === OrderStatus::ID_CANCELLED) {
             throw new EntityException('You can NOT create a credit note against a CANCELED order(OrderNo: ' . $this->getOrder()->getOrderNo() . ')');
         }
         $this->setTotalValue($this->getTotalValue() + $this->getShippingValue());
     }
 }
开发者ID:larryu,项目名称:magento-b2b,代码行数:26,代码来源:CreditNote.php


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