public function view() { if (!$this->loadData()) { $this->dataError(); sendBack(); } $account = $this->_uses[$this->modeltype]; $glbalance = $account->glbalance(); $this->view->set('glbalance', $glbalance); $sidebar = new SidebarController($this->view); $sidebarlist = array(); $sidebarlist['view_all'] = array('tag' => 'View All Accounts', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'index')); $sidebarlist['receiveany'] = array('link' => array('modules' => $this->_modules, 'controller' => 'cbtransactions', 'action' => 'receive_payment', 'cb_account_id' => $account->id), 'tag' => 'receive_payment'); $sidebarlist['makeany'] = array('link' => array('modules' => $this->_modules, 'controller' => 'cbtransactions', 'action' => 'make_payment', 'cb_account_id' => $account->id), 'tag' => 'make_payment'); $sidebarlist['moveany'] = array('link' => array('modules' => $this->_modules, 'controller' => 'cbtransactions', 'action' => 'move_money'), 'tag' => 'move_money'); $sidebar->addList('actions', $sidebarlist); $sidebarlist = array(); $idfield = $account->idField; $idfieldValue = $account->{$account->idField}; $sidebarlist[$account->name] = array('tag' => $account->name, 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'view', $idfield => $idfieldValue)); $sidebarlist['reconcile'] = array('tag' => 'reconcile', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'reconcile', $idfield => $idfieldValue)); $sidebarlist['viewtrans'] = array('link' => array('modules' => $this->_modules, 'controller' => 'cbtransactions', 'action' => 'index', 'cb_account_id' => $idfieldValue), 'tag' => 'view_transactions'); $sidebarlist['receive_payment'] = array('link' => array('modules' => $this->_modules, 'controller' => 'cbtransactions', 'action' => 'receive_payment', 'cb_account_id' => $idfieldValue, 'currency_id' => $account->currency_id), 'tag' => 'receive_payment'); $sidebarlist['make_payment'] = array('link' => array('modules' => $this->_modules, 'controller' => 'cbtransactions', 'action' => 'make_payment', 'cb_account_id' => $idfieldValue, 'currency_id' => $account->currency_id), 'tag' => 'make_payment'); $sidebarlist['move_money'] = array('link' => array('modules' => $this->_modules, 'controller' => 'cbtransactions', 'action' => 'move_money', 'cb_account_id' => $idfieldValue), 'tag' => 'move_money'); $params = new GLParams(); if ($params->base_currency() != $account->currency_id) { $sidebarlist['revaluation'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'revaluation', $idfield => $idfieldValue), 'tag' => 'revaluation'); } $sidebar->addList($account->name, $sidebarlist); $this->view->register('sidebar', $sidebar); $this->view->set('sidebar', $sidebar); }
function populate() { $orders = new SInvoiceCollection(new SInvoice()); $customersales = $orders->getSalesHistory(); $db =& DB::Instance(); $param = new GLParams(); $currency_symbol = utf8_decode($param->base_currency_symbol()); $options = array(); $options['header']['text'] = 'Sales this month ' . $param->base_currency_symbol() . $customersales['current']['this_month_to_date']['value']; $options['header']['text'] .= ' : this week ' . $param->base_currency_symbol() . $customersales['current']['this_week']['value']; $options['header']['text'] .= ' : last week ' . $param->base_currency_symbol() . $customersales['current']['last_week']['value']; $options['header']['textStyle']['font-size'] = '14pt'; ksort($customersales['previous']); $options['date_axis'] = TRUE; $sales_counter = 0; // build up data array foreach ($customersales['previous'] as $period => $value) { $date = explode('/', $period); $data['x'][] = $date[1] . "/1/" . $date[0]; $data['y'][] = (double) $value['value']; $label[0][$sales_counter++] = number_format($value['value'], 2); } $options['seriesList'][] = array('legendEntry' => FALSE, 'data' => $data, 'date_axis' => array('x' => TRUE), 'markers' => array('visible' => TRUE, 'type' => 'circle')); $options['type'] = 'line'; $options['identifier'] = __CLASS__; $options['labels'] = $label; $this->contents = json_encode($options); }
/** * Build the line * */ public static function makeLine($order, $orderline, &$errors) { $despatchline = array(); if ($order->isLoaded()) { if ($order->customerdetails->accountStopped()) { $errors['id' . $order->id] = 'Cannot despatch order ' . $order->order_number . ' (' . $order->customerdetails->name . ') Account Stopped'; } else { $despatchline['order_id'] = $order->id; $despatchline['orderline_id'] = $orderline->id; $despatchline['slmaster_id'] = $order->slmaster_id; $despatchline['stuom_id'] = $orderline->stuom_id; if ($orderline->stitem_id) { $despatchline['stitem_id'] = $orderline->stitem_id; } if ($orderline->productline_id) { $despatchline['productline_id'] = $orderline->productline_id; } $despatchline['despatch_qty'] = $orderline->os_qty; $despatchline['despatch_date'] = date(DATE_FORMAT); $despatchline['despatch_action'] = $order->despatch_action; $despatchline['status'] = 'N'; $stitem = new STItem(); $stitem->load($data['stitem_id']); $param = new GLParams(); $net_mass_uom_id = $param->intrastat_net_mass(); if ($stitem->isLoaded() && !empty($net_mass_uom_id)) { $despatchline['net_mass'] = $stitem->convertToUoM($despatchline['stuom_id'], $net_mass_uom_id, $despatchline['despatch_qty']); } } } if (empty($despatchline['net_mass']) || $despatchline['net_mass'] === false) { $despatchline['net_mass'] = 0; } return $despatchline; }