示例#1
0
文件: json.php 项目: rrsc/beansbooks
 public function action_taxsearch()
 {
     $term = $this->request->post('term');
     $tax_search = new Beans_Tax_Search($this->_beans_data_auth((object) array('search_and' => FALSE, 'search_code' => $term, 'search_name' => $term, 'search_include_hidden' => TRUE)));
     $tax_search_result = $tax_search->execute();
     if (!$tax_search_result->success) {
         return $this->_return_error($this->_beans_result_get_error($tax_search_result));
     }
     foreach ($tax_search_result->data->taxes as $index => $tax) {
         $html = new View_Partials_Taxes_Taxes_Tax();
         $html->tax = $tax;
         $tax_search_result->data->taxes[$index]->html = $html->render();
     }
     $this->_return_object->data->taxes = $tax_search_result->data->taxes;
 }
示例#2
0
文件: json.php 项目: rrsc/beansbooks
 public function action_taxsearch()
 {
     $search_terms = $this->request->post('search_terms');
     $tax_search = new Beans_Tax_Search($this->_beans_data_auth((object) array('search_name' => $search_terms, 'search_include_hidden' => TRUE)));
     $tax_search_result = $tax_search->execute();
     $this->_return_object->data->taxes = $tax_search_result->data->taxes;
 }
示例#3
0
文件: dash.php 项目: rrsc/beansbooks
 private function _dash_index_messages_taxes()
 {
     $taxes_search = new Beans_Tax_Search($this->_beans_data_auth((object) array('search_include_hidden' => TRUE)));
     $taxes_search_result = $taxes_search->execute();
     // V2Item - Consider error'ing
     if (!$taxes_search_result->success) {
         return array();
     }
     $messages = array();
     foreach ($taxes_search_result->data->taxes as $tax) {
         if (strtotime($tax->date_due . ' -10 Days') <= strtotime(date("Y-m-d")) && ($tax->balance != 0.0 || $tax->visible)) {
             $messages[] = (object) array('title' => $tax->name . " Due on " . $tax->date_due, 'text' => $tax->name . " payable to the " . $tax->authority . " is due " . $tax->date_due . ".", 'actions' => array((object) array('text' => "Make a Payment", 'url' => "/vendors/taxpayments/new/" . $tax->id)));
         }
     }
     return $messages;
 }
示例#4
0
文件: view.php 项目: rrsc/beansbooks
 /**
  * Adds a few Beans_ calls to each view ( such as company settings ).
  */
 protected function _beans_default_calls()
 {
     // Get Version
     $b = new Beans();
     $this->_view->beansbooks_version = $b->get_version();
     // Only if logged in.
     if (!strlen(Session::instance()->get('auth_uid')) or !strlen(Session::instance()->get('auth_key')) or !strlen(Session::instance()->get('auth_expiration'))) {
         return FALSE;
     }
     $setup_company_list = new Beans_Setup_Company_List($this->_beans_data_auth());
     $setup_company_list_result = $setup_company_list->execute();
     if ($this->_beans_result_check($setup_company_list_result)) {
         $this->_view->setup_company_list_result = $setup_company_list_result;
     }
     $account_chart = new Beans_Account_Chart($this->_beans_data_auth());
     $account_chart_result = $account_chart->execute();
     if ($this->_beans_result_check($account_chart_result)) {
         $this->_view->account_chart_result = $account_chart_result;
     }
     $account_type_search = new Beans_Account_Type_Search($this->_beans_data_auth());
     $account_type_search_result = $account_type_search->execute();
     if ($this->_beans_result_check($account_type_search_result)) {
         $this->_view->account_type_search_result = $account_type_search_result;
     }
     // We don't want to override something set elsewhere - like in Controller_View_Setup -> action_taxes()
     if (!isset($this->_view->tax_search_result)) {
         $tax_search = new Beans_Tax_Search($this->_beans_data_auth((object) array('search_include_hidden' => TRUE)));
         $tax_search_result = $tax_search->execute();
         if ($this->_beans_result_check($tax_search_result)) {
             $this->_view->tax_search_result = $tax_search_result;
         }
     }
 }
示例#5
0
文件: setup.php 项目: rrsc/beansbooks
 public function action_taxes()
 {
     $tax_search = new Beans_Tax_Search($this->_beans_data_auth((object) array('search_include_hidden' => TRUE)));
     $tax_search_result = $tax_search->execute();
     if ($this->_beans_result_check($tax_search_result)) {
         $this->_view->tax_search_result = $tax_search_result;
     }
 }