本文整理汇总了PHP中CRM_Batch_BAO_Batch::batchTotals方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Batch_BAO_Batch::batchTotals方法的具体用法?PHP CRM_Batch_BAO_Batch::batchTotals怎么用?PHP CRM_Batch_BAO_Batch::batchTotals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Batch_BAO_Batch
的用法示例。
在下文中一共展示了CRM_Batch_BAO_Batch::batchTotals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeBatchSummary
/**
* Makes an array of the batch's summary and returns array to parent getBatchSummary() function.
*
* @param $batchID
* @param $params
*
* @return array
*/
public static function makeBatchSummary($batchID, $params)
{
$batchInfo = CRM_Batch_BAO_Batch::retrieve($params, $value);
$batchTotals = CRM_Batch_BAO_Batch::batchTotals(array($batchID));
$batchSummary = array('created_by' => CRM_Contact_BAO_Contact::displayName($batchInfo->created_id), 'status' => CRM_Core_PseudoConstant::getLabel('CRM_Batch_BAO_Batch', 'status_id', $batchInfo->status_id), 'description' => $batchInfo->description, 'payment_instrument' => CRM_Core_PseudoConstant::getLabel('CRM_Batch_BAO_Batch', 'payment_instrument_id', $batchInfo->payment_instrument_id), 'item_count' => $batchInfo->item_count, 'assigned_item_count' => $batchTotals[$batchID]['item_count'], 'total' => CRM_Utils_Money::format($batchInfo->total), 'assigned_total' => CRM_Utils_Money::format($batchTotals[$batchID]['total']), 'opened_date' => CRM_Utils_Date::customFormat($batchInfo->created_date));
return $batchSummary;
}
示例2: getBatchSummary
public static function getBatchSummary()
{
$batchID = CRM_Utils_Type::escape($_REQUEST['batchID'], 'String');
$params = array('id' => $batchID);
$batchInfo = CRM_Batch_BAO_Batch::retrieve($params, $value);
$batchTotals = CRM_Batch_BAO_Batch::batchTotals(array($batchID));
$batchSummary = array('created_by' => CRM_Contact_BAO_Contact::displayName($batchInfo->created_id), 'status' => CRM_Core_OptionGroup::getLabel('batch_status', $batchInfo->status_id), 'description' => $batchInfo->description, 'payment_instrument' => CRM_Core_OptionGroup::getLabel('payment_instrument', $batchInfo->payment_instrument_id), 'item_count' => $batchInfo->item_count, 'assigned_item_count' => $batchTotals[$batchID]['item_count'], 'total' => CRM_Utils_Money::format($batchInfo->total), 'assigned_total' => CRM_Utils_Money::format($batchTotals[$batchID]['total']), 'opened_date' => CRM_Utils_Date::customFormat($batchInfo->created_date));
CRM_Utils_JSON::output($batchSummary);
}
示例3: postProcess
/**
* Process the form after the input has been submitted and validated.
*/
public function postProcess()
{
if (!$this->_exportFormat) {
$params = $this->exportValues();
$this->_exportFormat = $params['export_format'];
}
if ($this->_id) {
$batchIds = array($this->_id);
} elseif (!empty($this->_batchIds)) {
$batchIds = explode(',', $this->_batchIds);
}
// Recalculate totals
$totals = CRM_Batch_BAO_Batch::batchTotals($batchIds);
// build batch params
$session = CRM_Core_Session::singleton();
$batchParams['modified_date'] = date('YmdHis');
$batchParams['modified_id'] = $session->get('userID');
$batchParams['status_id'] = $this->_exportStatusId;
$ids = array();
foreach ($batchIds as $batchId) {
$batchParams['id'] = $ids['batchID'] = $batchId;
// Update totals
$batchParams = array_merge($batchParams, $totals[$batchId]);
CRM_Batch_BAO_Batch::create($batchParams, $ids, 'financialBatch');
}
CRM_Batch_BAO_Batch::exportFinancialBatch($batchIds, $this->_exportFormat);
}