public function action_paymentsearch() { $search_terms = $this->request->post('search_terms'); $count = $this->request->post('count'); $page = $this->request->post('page'); if (!$count) { $count = 5; } if (!$page) { $page = 0; } $customer_payment_search_data = new stdClass(); $customer_payment_search_data->sort_by = 'newest'; $customer_payment_search_data->page_size = $count; $customer_payment_search_data->page = $page; $customer_payment_search_data->keywords = $search_terms; // Include this as a checkbox? $customer_payment_search_data->include_invoices = TRUE; $customer_payment_search = new Beans_Customer_Payment_Search($this->_beans_data_auth($customer_payment_search_data)); $customer_payment_search_result = $customer_payment_search->execute(); if (!$customer_payment_search_result->success) { return $this->_return_error($customer_payment_search_result->error); } foreach ($customer_payment_search_result->data->payments as $index => $payment) { $html = new View_Partials_Customers_Payments_Payment(); $html->payment = $payment; $customer_payment_search_result->data->payments[$index]->html = $html->render(); } $this->_return_object->data = $customer_payment_search_result->data; }
public function action_payments() { $payment_id = $this->request->param('id'); $customer_payment_search = new Beans_Customer_Payment_Search($this->_beans_data_auth((object) array('page_size' => 5, 'sort_by' => 'newest'))); $customer_payment_search_result = $customer_payment_search->execute(); if ($this->_beans_result_check($customer_payment_search_result)) { $this->_view->customer_payment_search_result = $customer_payment_search_result; } // Oustanding sales $customer_sale_search = new Beans_Customer_Sale_Search($this->_beans_data_auth((object) array('page_size' => 30, 'invoiced' => TRUE, 'has_balance' => TRUE, 'sort_by' => 'duesoonest'))); $customer_sale_search_result = $customer_sale_search->execute(); if ($this->_beans_result_check($customer_sale_search_result)) { $this->_view->customer_sale_search_result = $customer_sale_search_result; } $this->_view->requested_payment_id = $payment_id; $this->_view->force_current_uri = "/customers/payments"; }