示例#1
0
文件: dash.php 项目: rrsc/beansbooks
 private function _dash_index_messages_balancecheck()
 {
     $setup_company_list = new Beans_Setup_Company_List($this->_beans_data_auth());
     $setup_company_list_result = $setup_company_list->execute();
     $require_calibration = FALSE;
     $report_balancecheck_result = FALSE;
     if (isset($setup_company_list_result->data) && isset($setup_company_list_result->data->settings) && isset($setup_company_list_result->data->settings->calibrate_date_next) && $setup_company_list_result->data->settings->calibrate_date_next) {
         $require_calibration = TRUE;
     }
     if (!$require_calibration) {
         $customer_sale_calibrate_check = new Beans_Customer_Sale_Calibrate_Check($this->_beans_data_auth());
         $customer_sale_calibrate_check_result = $customer_sale_calibrate_check->execute();
         if (!$customer_sale_calibrate_check_result->success) {
             return array();
         }
         if (count($customer_sale_calibrate_check_result->data->ids)) {
             $require_calibration = TRUE;
         }
     }
     if (!$require_calibration) {
         $vendor_purchase_calibrate_check = new Beans_Vendor_Purchase_Calibrate_Check($this->_beans_data_auth());
         $vendor_purchase_calibrate_check_result = $vendor_purchase_calibrate_check->execute();
         if (!$vendor_purchase_calibrate_check_result->success) {
             return array();
         }
         if (count($vendor_purchase_calibrate_check_result->data->ids)) {
             $require_calibration = TRUE;
         }
     }
     if (!$require_calibration) {
         $account_calibrate_check = new Beans_Account_Calibrate_Check($this->_beans_data_auth());
         $account_calibrate_check_result = $account_calibrate_check->execute();
         if (!$account_calibrate_check_result->success) {
             return array();
         }
         if (count($account_calibrate_check_result->data->account_ids)) {
             $require_calibration = TRUE;
         }
     }
     if (!$require_calibration) {
         $report_balancecheck = new Beans_Report_Balancecheck($this->_beans_data_auth((object) array('date' => date("Y-m-d"))));
         $report_balancecheck_result = $report_balancecheck->execute();
         if (!$report_balancecheck_result->success) {
             return array();
         }
     }
     if ($require_calibration || $report_balancecheck_result && !$report_balancecheck_result->data->balanced) {
         return array((object) array('title' => "Calibration Required", 'text' => "Your books need to be calibrated due to an update\n\t\t\t\t\t\t\t\tin BeansBooks.  Your accounts will function correctly until then,\n\t\t\t\t\t\t\t\tbut may display an incorrect balance.", 'actions' => array((object) array('text' => "Calibrate Accounts", 'url' => "/setup/calibrate"))));
     }
     return array();
 }
示例#2
0
文件: setup.php 项目: rrsc/beansbooks
 public function action_calibrate()
 {
     $account_calibrate_check = new Beans_Account_Calibrate_Check($this->_beans_data_auth());
     $account_calibrate_check_result = $account_calibrate_check->execute();
     if ($this->_beans_result_check($account_calibrate_check_result)) {
         $this->_view->account_calibrate_check_result = $account_calibrate_check_result;
     }
     $report_balancecheck = new Beans_Report_Balancecheck($this->_beans_data_auth((object) array('date' => date("Y-m-d"))));
     $report_balancecheck_result = $report_balancecheck->execute();
     if ($this->_beans_result_check($report_balancecheck_result)) {
         $this->_view->report_balancecheck_result = $report_balancecheck_result;
     }
     $customer_sale_calibrate_check = new Beans_Customer_Sale_Calibrate_Check($this->_beans_data_auth());
     $customer_sale_calibrate_check_result = $customer_sale_calibrate_check->execute();
     if ($this->_beans_result_check($customer_sale_calibrate_check_result)) {
         $this->_view->customer_sale_calibrate_check_result = $customer_sale_calibrate_check_result;
     }
     $vendor_purchase_calibrate_check = new Beans_Vendor_Purchase_Calibrate_Check($this->_beans_data_auth());
     $vendor_purchase_calibrate_check_result = $vendor_purchase_calibrate_check->execute();
     if ($this->_beans_result_check($vendor_purchase_calibrate_check_result)) {
         $this->_view->vendor_purchase_calibrate_check_result = $vendor_purchase_calibrate_check_result;
     }
     $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;
     }
 }