public function action_taxpaymentsearch() { $search_terms = $this->request->post('search_terms'); $count = $this->request->post('count'); if (!$count) { $count = 5; } $tax_payment_search_data = new stdClass(); $tax_payment_search_data->sort_by = 'newest'; $tax_payment_search_data->page_size = $count; $tax_payment_search_data->search_tax_name = $search_terms; $tax_payment_search = new Beans_Tax_Payment_Search($this->_beans_data_auth($tax_payment_search_data)); $tax_payment_search_result = $tax_payment_search->execute(); if (!$tax_payment_search_result->success) { return $this->_return_error($tax_payment_search_result->error); } foreach ($tax_payment_search_result->data->payments as $index => $payment) { $html = new View_Partials_Taxes_Payments_Payment(); $html->payment = $payment; $tax_payment_search_result->data->payments[$index]->html = $html->render(); } $this->_return_object->data->payments = $tax_payment_search_result->data->payments; }
public function action_taxes() { $tax_id = FALSE; $tax_payment_id = FALSE; if ($this->request->post('tax_id')) { $tax_id = $this->request->post('tax_id'); } if ($this->request->post('tax_payment_id')) { $tax_payment_id = $this->request->post('tax_payment_id'); } if ($tax_id) { $tax_payment_search_data = new stdClass(); $tax_payment_search_data->sort_by = 'newest'; $tax_payment_search_data->page_size = 24; $tax_payment_search_data->search_tax_id = $tax_id; $tax_payment_search = new Beans_Tax_Payment_Search($this->_beans_data_auth($tax_payment_search_data)); $tax_payment_search_result = $tax_payment_search->execute(); if ($this->_beans_result_check($tax_payment_search_result)) { $this->_view->tax_payments = $tax_payment_search_result->data->payments; } } if ($tax_id && $tax_payment_id) { if ($tax_payment_id == "prep") { $date_start = date("Y-m-d"); $date_end = date("Y-m-d"); $tax_prep = new Beans_Tax_Prep($this->_beans_data_auth((object) array('id' => $tax_id, 'date_start' => $date_start, 'date_end' => $date_end))); $tax_prep_result = $tax_prep->execute(); if ($this->_beans_result_check($tax_prep_result)) { $this->_view->payment = (object) array('id' => NULL, 'prep' => TRUE, 'tax' => $tax_prep_result->data->tax, 'amount' => NULL, 'writeoff_amount' => NULL, 'date' => NULL, 'date_start' => $tax_prep_result->data->date_start, 'date_end' => $tax_prep_result->data->date_end, 'check_number' => NULL, 'invoiced_line_amount' => $tax_prep_result->data->taxes->due->invoiced->form_line_amount, 'invoiced_line_taxable_amount' => $tax_prep_result->data->taxes->due->invoiced->form_line_taxable_amount, 'invoiced_amount' => $tax_prep_result->data->taxes->due->invoiced->amount, 'refunded_line_amount' => $tax_prep_result->data->taxes->due->refunded->form_line_amount, 'refunded_line_taxable_amount' => $tax_prep_result->data->taxes->due->refunded->form_line_taxable_amount, 'refunded_amount' => $tax_prep_result->data->taxes->due->refunded->amount, 'net_line_amount' => $tax_prep_result->data->taxes->due->net->form_line_amount, 'net_line_taxable_amount' => $tax_prep_result->data->taxes->due->net->form_line_taxable_amount, 'net_amount' => $tax_prep_result->data->taxes->due->net->amount, 'liabilities' => array_merge($tax_prep_result->data->taxes->due->invoiced->liabilities, $tax_prep_result->data->taxes->due->refunded->liabilities), 'amount' => NULL, 'writeoff_amount' => NULL); } } else { $tax_payment_lookup = new Beans_Tax_Payment_Lookup($this->_beans_data_auth((object) array('id' => $tax_payment_id))); $tax_payment_lookup_result = $tax_payment_lookup->execute(); if ($this->_beans_result_check($tax_payment_lookup_result)) { $this->_view->payment = $tax_payment_lookup_result->data->payment; } } } $this->_action_tab_name = "Sales Tax"; $this->_action_tab_uri = '/' . $this->request->uri(); }
public function action_loadtaxpayments() { $tax_payment_search_data = new stdClass(); $tax_payment_search_data->sort_by = 'newest'; $tax_payment_search_data->page_size = 24; $tax_payment_search_data->search_tax_id = $this->request->post('tax_id'); if (!$tax_payment_search_data->search_tax_id) { return $this->_return_error("Please select a tax."); } $tax_payment_search = new Beans_Tax_Payment_Search($this->_beans_data_auth($tax_payment_search_data)); $tax_payment_search_result = $tax_payment_search->execute(); if (!$tax_payment_search_result->success) { return $this->_return_error($tax_payment_search_result->error); } $this->_return_object = $tax_payment_search_result; }
public function action_taxpayments() { $payment_id = $this->request->param('id'); $tax_id = NULL; if ($payment_id == "new") { $payment_id = NULL; $tax_id = $this->request->param('code'); } $tax_payment_search = new Beans_Tax_Payment_Search($this->_beans_data_auth((object) array('page_size' => 5, 'sort_by' => 'newest'))); $tax_payment_search_result = $tax_payment_search->execute(); if ($this->_beans_result_check($tax_payment_search_result)) { $this->_view->tax_payment_search_result = $tax_payment_search_result; } if ($tax_id) { $tax_lookup = new Beans_Tax_Lookup($this->_beans_data_auth((object) array('id' => $tax_id))); $tax_lookup_result = $tax_lookup->execute(); if ($this->_beans_result_check($tax_lookup_result)) { $this->_view->requested_tax_id = $tax_lookup_result->data->tax->id; $this->_view->requested_tax_name = $tax_lookup_result->data->tax->name; } } $this->_view->requested_payment_id = $payment_id; }