public function view_allocations()
 {
     $flash = Flash::Instance();
     $collection = new SLTransactionCollection($this->_templateobject);
     $this->_templateobject->setAdditional('payment_value', 'numeric');
     $allocation = DataObjectFactory::Factory('SLAllocation');
     $allocationcollection = new SLAllocationCollection($allocation);
     $collection->_tablename = $allocationcollection->_tablename;
     $sh = $this->setSearchHandler($collection);
     $fields = array("our_reference||'-'||transaction_type as id", 'customer', 'slmaster_id', 'transaction_date', 'transaction_type', 'our_reference', 'ext_reference', 'currency', 'gross_value', 'allocation_date');
     $sh->setGroupBy($fields);
     $fields[] = 'sum(payment_value) as payment_value';
     $sh->setFields($fields);
     if (isset($this->_data['trans_id'])) {
         $allocation->identifierField = 'allocation_id';
         $cc = new ConstraintChain();
         $cc->add(new Constraint('transaction_id', '=', $this->_data['trans_id']));
         $alloc_ids = $allocation->getAll($cc);
         if (count($alloc_ids) > 0) {
             $sh->addConstraint(new Constraint('allocation_id', 'in', '(' . implode(',', $alloc_ids) . ')'));
         } else {
             $flash->addError('Error loading allocation');
             sendBack();
         }
     }
     parent::index($collection, $sh);
     $this->view->set('collection', $collection);
     $this->view->set('invoice_module', 'sales_invoicing');
     $this->view->set('invoice_controller', 'sinvoices');
     $this->view->set('clickaction', 'view');
     $this->view->set('clickcontroller', 'slcustomers');
     $this->view->set('linkvaluefield', 'slmaster_id');
 }
 public function makePayments()
 {
     $flash = Flash::Instance();
     $errors = array();
     // set context from calling module
     $defaults = array();
     if (isset($this->_data['cb_account_id'])) {
         $defaults['cb_account_id'] = $this->_data['cb_account_id'];
     }
     if (isset($this->_data['company_id'])) {
         $defaults['company_id'] = $this->_data['company_id'];
     }
     if (isset($this->_data['source'])) {
         $defaults['source'] = $this->_data['source'];
     }
     if (isset($this->_data['status'])) {
         $defaults['status'] = $this->_data['status'];
     }
     if (isset($this->_data['frequency'])) {
         $defaults['frequency'] = $this->_data['frequency'];
     }
     if (isset($this->_data['from_date'])) {
         $defaults['next_due_date']['from'] = un_fix_date($this->_data['from_date']);
         $defaults['next_due_date']['to'] = un_fix_date($this->_data['from_date']);
     }
     if (isset($this->_data['to_date'])) {
         $defaults['next_due_date']['to'] = un_fix_date($this->_data['to_date']);
         if (!isset($this->_data['from_date'])) {
             $defaults['next_due_date']['from'] = un_fix_date($this->_data['to_date']);
         }
     }
     $this->setSearch('PeriodicPaymentsSearch', 'makePayments', $defaults);
     parent::index(new PeriodicPaymentCollection($this->_templateobject));
     $this->view->set('clickaction', 'view');
 }
 public function index()
 {
     $s_data = array();
     // Set context from calling module
     if (isset($this->_data['slmaster_id'])) {
         $s_data['slmaster_id'] = $this->_data['slmaster_id'];
     }
     if (isset($this->_data['status'])) {
         $s_data['status'] = $this->_data['status'];
     } else {
         $s_data['status'] = 'N';
     }
     if (isset($this->_data['order_number'])) {
         $s_data['order_number'] = $this->_data['order_number'];
     }
     if (isset($this->_data['invoice_number'])) {
         $s_data['invoice_number'] = $this->_data['invoice_number'];
     }
     $this->setSearch('sodespatchSearch', 'useDefault', $s_data);
     $this->view->set('clickaction', 'view');
     $coll = new SODespatchLineCollection($this->_templateobject);
     $coll->orderby = array('despatch_date', 'despatch_number');
     $coll->direction = array('DESC', 'DESC');
     parent::index($coll);
     $sidebar = new SidebarController($this->view);
     $actions = array();
     $actions['viewOrders'] = array('link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'viewByOrders')), 'tag' => 'View Orders for Despatch');
     $actions['print'] = array('link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'viewAwaitingDespatch', 'type' => 'print')), 'tag' => 'Print Despatch Notes');
     $actions['confirm'] = array('link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'viewAwaitingDespatch', 'type' => 'confirm')), 'tag' => 'Confirm Despatches');
     $actions['cancel'] = array('link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'viewAwaitingDespatch', 'type' => 'cancel')), 'tag' => 'Cancel Despatches');
     $actions['invoice'] = array('link' => array('module' => 'sales_order', 'controller' => 'sorders', 'action' => 'select_for_invoicing'), 'tag' => 'invoice_despatched_orders');
     $sidebar->addList('Actions', $actions);
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
 public function index()
 {
     $defaults = array();
     if (isset($this->_data['cb_account_id'])) {
         $defaults['cb_account_id'] = $this->_data['cb_account_id'];
         $defaults['reference'] = '';
     }
     $errors = array();
     $this->setSearch('cbtransactionsSearch', 'useDefault', $defaults);
     // Disable user display field selection, see: BaseSearch
     $this->search->disable_field_selection = TRUE;
     $this->view->set('clickaction', 'view');
     parent::index(new CBTransactionCollection($this->_templateobject));
     $sidebar = new SidebarController($this->view);
     if (isset($this->_data['cb_account_id'])) {
         $account = DataObjectFactory::Factory('CBAccount');
         $account->load($this->_data['cb_account_id']);
         $this->view->set('account', $account->name);
         $this->view->set('currency', $account->currency);
         $this->sidebar($sidebar, $account);
     } else {
         $this->sidebar($sidebar);
     }
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
Example #5
0
 function index()
 {
     $this->view->set('clickaction', 'view');
     $s_data = array();
     $s_data['owner'] = EGS_USERNAME;
     $this->setSearch('CalendarSearch', 'useDefault', $s_data);
     parent::index(new CalendarCollection($this->_templateobject));
     $calendar = new CalendarCollection($this->_templateobject);
     $sh = new SearchHandler($calendar, false);
     $sh->addConstraint(new Constraint('owner', '=', EGS_USERNAME));
     $sh->setOrderby('name', 'ASC');
     $calendar->load($sh);
     if (isset($this->search) && ($this->isPrintDialog() || $this->isPrinting())) {
         $this->printCollection($calendar);
     }
     $this->view->set('calendar', $calendar);
     $this->view->set('num_records', $calendar->num_records);
     $sidebar = new SidebarController($this->view);
     $sidebar->addList('Events', array('new_event' => array('link' => array('module' => 'calendar', 'controller' => 'calendarevents', 'action' => 'new'), 'tag' => 'new_event'), 'view_events' => array('link' => array('module' => 'calendar', 'controller' => 'calendarevents', 'action' => 'index'), 'tag' => 'view_events')));
     $sidebar->addList('Tasks', array('new_task' => array('link' => array('module' => 'projects', 'controller' => 'tasks', 'action' => 'new'), 'tag' => 'new_task'), 'view_tasks' => array('link' => array('module' => 'projects', 'controller' => 'tasks', 'action' => 'index'), 'tag' => 'view_tasks')));
     $sidebar->addList('calendar_views', array('view_calendar' => array('link' => array('module' => 'calendar'), 'tag' => 'View Calendar')));
     $sidebar->addList('calendars', array('new_personal_calendar' => array('link' => array('module' => 'calendar', 'controller' => 'calendars', 'action' => 'new_personal'), 'tag' => 'new_personal_calendar'), 'new_group_calendar' => array('link' => array('module' => 'calendar', 'controller' => 'calendars', 'action' => 'new_group'), 'tag' => 'new_group_calendar'), 'add_google_calendar' => array('link' => array('module' => 'calendar', 'controller' => 'calendars', 'action' => 'new_gcal'), 'tag' => 'add_google_calendar')));
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
Example #6
0
 public function index()
 {
     $this->view->set('clickaction', 'edit');
     parent::index(new SOrderLineCollection($this->_templateobject));
     $sidebar = new SidebarController($this->view);
     $sidebar->addList('Actions', array('new' => array('link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'new')), 'tag' => 'new_SOrderLine')));
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
Example #7
0
 public function index()
 {
     $this->setSearch('ActivitySearch', 'useDefault');
     $this->view->set('clickaction', 'view');
     $this->view->set('page_title', 'CRM Activities');
     parent::index($a = new ActivityCollection($this->_templateobject));
     $sidebar = new SidebarController($this->view);
     $sidebar->addList('Actions', array('new' => array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'new'), 'tag' => 'New Activity')));
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
Example #8
0
 public function index()
 {
     $this->view->set('clickaction', 'view');
     $s_data = array();
     $this->setSearch('CompanySearch', 'leads', $s_data);
     parent::index($t = new LeadCollection($this->_templateobject));
     $sidebar = new SidebarController($this->view);
     $sidebar->addList('Actions', array('new' => array('link' => array('module' => 'contacts', 'controller' => 'companys', 'action' => 'new'), 'tag' => 'new_account'), 'new_lead' => array('link' => array('module' => 'contacts', 'controller' => 'leads', 'action' => 'new'), 'tag' => 'new_lead'), 'new_person' => array('link' => array('module' => 'contacts', 'controller' => 'persons', 'action' => 'new'), 'tag' => 'new_person')));
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
Example #9
0
 public function index()
 {
     $errors = array();
     $this->setSearch('glcentresSearch', 'useDefault');
     $this->view->set('clickaction', 'view');
     parent::index(new GLCentreCollection($this->_templateobject));
     $sidebar = new SidebarController($this->view);
     $sidebar->addList('Actions', array('viewall' => array('link' => array_merge($this->_modules, array('controller' => 'glaccounts', 'action' => 'index')), 'tag' => 'View All Accounts'), 'viewbalances' => array('link' => array_merge($this->_modules, array('controller' => 'glbalances', 'action' => 'index')), 'tag' => 'View Balances'), 'viewtransactions' => array('link' => array_merge($this->_modules, array('controller' => 'gltransactions', 'action' => 'index')), 'tag' => 'View Transactions')));
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
 public function index()
 {
     if (!$this->checkParams('order_id')) {
         sendBack();
     }
     $this->view->set('clickaction', 'view');
     parent::index(new SOPackingSlipCollection($this->_templateobject));
     $sidebar = new SidebarController($this->view);
     $sidebar->addList('Actions', array('new' => array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'new', 'order_id' => $this->_data['order_id']), 'tag' => 'new_SO_Packing_Slip')));
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
 public function index()
 {
     // when an item is clicked go the the view action
     $this->view->set('clickaction', 'view');
     parent::index(new CRMCalendarEventCollection($this->_templateobject));
     // set sidebar
     $sidebar = new SidebarController($this->view);
     $sidebar->addList('Actions', array('view_calendar' => array('link' => array('modules' => $this->_modules, 'controller' => 'crmcalendars', 'action' => 'index'), 'tag' => 'View CRM Calendar')));
     $sidebar->addList('Events', array('new_event' => array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'new_event', 'calendar_id' => $this->_data['id']), 'tag' => 'New Event')));
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
Example #12
0
 public function index()
 {
     $this->view->set('clickaction', 'view');
     $s_data = array();
     // Set context from calling module
     $this->setSearch('pltransactionsSearch', 'payments', $s_data);
     parent::index(new PLPaymentCollection($this->_templateobject));
     $sidebar = new SidebarController($this->view);
     $sidebarlist = array();
     $this->sidebarIndex($sidebarlist);
     $sidebar->addList('Actions', $sidebarlist);
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
Example #13
0
 public function index()
 {
     $flash = Flash::Instance();
     $errors = array();
     $s_data = array();
     // Set context from calling module
     $this->setSearch('AdminSearch', 'Users', $s_data);
     $this->view->set('clickaction', 'view');
     parent::index(new UserCollection($this->_templateobject));
     $sidebar = new SidebarController($this->view);
     $sidebar->addList('Actions', array('new' => array('link' => array('module' => 'admin', 'controller' => 'users', 'action' => 'new'), 'tag' => 'New User'), 'view' => array('link' => array('module' => 'admin', 'controller' => 'hasroles', 'action' => 'index'), 'tag' => 'Users by Role'), 'reset_passwords' => array('link' => array('module' => 'admin', 'controller' => 'users', 'action' => 'reset_passwords'), 'tag' => 'Reset Passwords')));
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
Example #14
0
 public function view_calendars()
 {
     // when an item is clicked go the the view action
     $this->view->set('clickaction', 'view');
     parent::index(new CRMCalendarCollection($this->_templateobject));
     // parent::index is going to set the template to index, we need it to be view_calendars
     $this->_templateName = $this->getTemplateName('view_calendars');
     // set sidebar
     $sidebar = new SidebarController($this->view);
     $sidebar->addList('Actions', array('view_calendar' => array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'index'), 'tag' => 'View CRM Calendar')));
     $sidebar->addList('Calendar', array('new_calendar' => array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'new'), 'tag' => 'New Calendar')));
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
Example #15
0
 public function index()
 {
     $errors = array();
     $defaults = array();
     // Set context from calling module
     if (isset($this->_data['stitem_id'])) {
         $defaults['stitem_id'] = $this->_data['stitem_id'];
     }
     $this->setSearch('stcostsSearch', 'useDefault', $defaults);
     $this->view->set('clickaction', 'costSheet');
     $this->view->set('linkfield', 'stitem_id');
     $this->view->set('linkvaluefield', 'stitem_id');
     parent::index(new STCostCollection($this->_templateobject));
 }
Example #16
0
 public function index()
 {
     $errors = array();
     $this->setSearch('glbalancesSearch', 'useDefault');
     $this->view->set('clickaction', '#');
     parent::index(new GLBudgetCollection($this->_templateobject));
     $sidebar = new SidebarController($this->view);
     $sidebarlist = array();
     $sidebarlist['viewaccounts'] = array('tag' => 'View All Accounts', 'link' => array_merge($this->_modules, array('controller' => 'glaccounts', 'action' => 'index')));
     $sidebarlist['viewcentres'] = array('tag' => 'View All Centres', 'link' => array_merge($this->_modules, array('controller' => 'glcentres', 'action' => 'index')));
     $sidebarlist['budgetdatagrid'] = array('tag' => 'Enter Data Grid', 'link' => array_merge($this->_modules, array('controller' => 'glbudgets', 'action' => 'inputdatagrid')));
     $sidebar->addList('Actions', $sidebarlist);
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
 public function index()
 {
     $id = isset($this->_data['id']) ? $this->_data['id'] : 0;
     $type = isset($this->_data['transtype']) ? $this->_data['transtype'] : '';
     $errors = array();
     $defaults = array();
     if (!isset($this->_data['Search'])) {
         // set context from calling module if no search criteria set
         if (isset($this->_data['glperiods_id'])) {
             $defaults['glperiods_id'] = array($this->_data['glperiods_id']);
         }
         if (isset($this->_data['docref'])) {
             $defaults['docref'] = $this->_data['docref'];
         }
         if (isset($this->_data['source'])) {
             $defaults['source'] = array($this->_data['source']);
         }
         if (isset($this->_data['type'])) {
             $defaults['type'] = array($this->_data['type']);
         }
         if (isset($this->_data['glcentre_id'])) {
             $defaults['glcentre_id'] = array($this->_data['glcentre_id']);
         }
         if (isset($this->_data['glaccount_id'])) {
             $defaults['glaccount_id'] = array($this->_data['glaccount_id']);
         }
     }
     $this->setSearch('gltransactionsSearch', 'useDefault', $defaults);
     $this->view->set('clickaction', 'view');
     $gltransactions = new GLTransactionCollection($this->_templateobject);
     parent::index($gltransactions);
     $page_credit_total = 0;
     $page_debit_total = 0;
     foreach ($gltransactions->getArray() as $row) {
         $page_credit_total = bcadd($page_credit_total, $row['credit']);
         $page_debit_total = bcadd($page_debit_total, $row['debit']);
     }
     $this->view->set('page_total', number_format(bcsub($page_debit_total, $page_credit_total), 2));
     $this->view->set('page_credit_total', number_format($page_credit_total, 2));
     $this->view->set('page_debit_total', number_format($page_debit_total, 2));
     $sidebar = new SidebarController($this->view);
     $sidebarlist = array();
     $sidebarlist['viewaccounts'] = array('tag' => 'View All Accounts', 'link' => array('modules' => $this->_modules, 'controller' => 'glaccounts', 'action' => 'index'));
     $sidebarlist['viewcentres'] = array('tag' => 'View All Centres', 'link' => array('modules' => $this->_modules, 'controller' => 'glcentres', 'action' => 'index'));
     $sidebar->addList('Actions', $sidebarlist);
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
Example #18
0
 public function index()
 {
     $this->view->set('clickaction', 'view');
     $s_data = array();
     $this->setSearch('CompanySearch', 'useDefault', $s_data);
     $collection = new CompanyCollection($this->_templateobject);
     $sh = $this->setSearchHandler($collection);
     $systemCompany = DataObjectFactory::Factory('Company');
     $systemCompany->load(COMPANY_ID);
     $_company_ids = $systemCompany->getSystemRelatedCompanies(array($systemCompany->id => $systemCompany->getIdentifierValue()));
     $sh->addConstraint(new Constraint('id', 'NOT IN', '(' . implode(',', array_keys($_company_ids)) . ')'));
     parent::index($collection, $sh);
     $sidebar = new SidebarController($this->view);
     $sidebar->addList('Actions', array('new' => array('link' => array('module' => 'contacts', 'controller' => 'companys', 'action' => 'new'), 'tag' => 'new_account'), 'new_lead' => array('link' => array('module' => 'contacts', 'controller' => 'leads', 'action' => 'new'), 'tag' => 'new_lead'), 'new_person' => array('link' => array('module' => 'contacts', 'controller' => 'persons', 'action' => 'new'), 'tag' => 'new_person')));
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
Example #19
0
 public function viewWHTransfers()
 {
     $this->view->set('clickcontroller', 'whtransferlines');
     $this->view->set('clickaction', 'view');
     $s_data = array();
     $s_data['status'] = WHTransfer::transferredStatus();
     $this->setSearch('whtransfersSearch', 'useDefault', $s_data);
     parent::index(new WHTransferCollection($this->_templateobject));
     $sidebar = new SidebarController($this->view);
     $sidebarlist = array();
     $sidebarlist['awaiting'] = array('link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'selectWHTransfers')), 'tag' => 'View Transfers Awaiting Despatch');
     $sidebar->addList('Actions', $sidebarlist);
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
     $this->view->set('page_title', $this->getPageName('', 'View'));
     $this->_templateName = $this->getTemplateName('selectwhtransfers');
 }
Example #20
0
 public function index()
 {
     $this->view->set('clickaction', 'view');
     // Search
     $errors = array();
     $s_data = array();
     // Set context from calling module
     $this->setSearch('assetsSearch', 'useDefault', $s_data);
     $collection = new AssetCollection($this->_templateobject);
     $sh = $this->setSearchHandler($collection);
     parent::index($collection, $sh);
     $sidebar = new SidebarController($this->view);
     $sidebarlist = array();
     $this->sidebarAll($sidebarlist);
     $sidebar->addList('Actions', $sidebarlist);
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
Example #21
0
 public function index()
 {
     $s_data = array();
     $this->setSearch('PeopleSearch', 'useDefault', $s_data);
     $this->view->set('clickaction', 'view');
     $people = new PersonCollection($this->_templateobject);
     $sh = $this->setSearchHandler($people);
     $systemCompany = DataObjectFactory::Factory('Company');
     $systemCompany->load(COMPANY_ID);
     $_company_ids = $systemCompany->getSystemRelatedCompanies(array($systemCompany->id => $systemCompany->getIdentifierValue()));
     // Exclude people attached to system Company accounts but include people with no company
     $cc = new ConstraintChain();
     $cc->add(new Constraint('company_id', 'NOT IN', '(' . implode(',', array_keys($_company_ids)) . ')'));
     $cc->add(new Constraint('company_id', 'IS', 'NULL'), 'OR');
     $sh->addConstraint($cc);
     parent::index($people, $sh);
     $sidebar = new SidebarController($this->view);
     $sidebar->addList('Actions', array('new' => array('link' => array('module' => 'contacts', 'controller' => 'persons', 'action' => 'new'), 'tag' => 'new_person'), 'new_account' => array('link' => array('module' => 'contacts', 'controller' => 'companys', 'action' => 'new'), 'tag' => 'new_account'), 'new_lead' => array('link' => array('module' => 'contacts', 'controller' => 'leads', 'action' => 'new'), 'tag' => 'new_lead')));
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
 public function index()
 {
     $s_data = array();
     // Set context from calling module
     if (isset($this->_data['plmaster_id'])) {
         $s_data['plmaster_id'] = $this->_data['plmaster_id'];
     }
     if (isset($this->_data['status'])) {
         $s_data['status'] = $this->_data['status'];
     }
     if (isset($this->_data['order_number'])) {
         $s_data['order_number'] = $this->_data['order_number'];
     }
     if (!empty($this->_data['invoice_number'])) {
         $s_data['invoice_number'] = $this->_data['invoice_number'];
     }
     $this->setSearch('pogoodsreceivedSearch', 'useDefault', $s_data);
     $this->view->set('clickaction', 'view');
     parent::index(new POReceivedLineCollection($this->_templateobject));
     $sidebar = new SidebarController($this->view);
     $sidebar->addList('Actions', array('confirm' => array('link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'viewAwaitingDelivery', 'type' => 'confirm')), 'tag' => 'Confirm Delivery')));
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
Example #23
0
 public function index()
 {
     $errors = array();
     $this->setSearch('glbalancesSearch', 'useDefault');
     $this->view->set('clickaction', '#');
     $glbalances = new GLBalanceCollection($this->_templateobject);
     parent::index($glbalances);
     $page_credit_total = 0;
     $page_debit_total = 0;
     foreach ($glbalances->getArray() as $row) {
         $page_credit_total = bcadd($page_credit_total, $row['credit']);
         $page_debit_total = bcadd($page_debit_total, $row['debit']);
     }
     $this->view->set('page_total', number_format(bcsub($page_debit_total, $page_credit_total), 2));
     $this->view->set('page_credit_total', number_format($page_credit_total, 2));
     $this->view->set('page_debit_total', number_format($page_debit_total, 2));
     $sidebar = new SidebarController($this->view);
     $sidebarlist = array();
     $sidebarlist['viewaccounts'] = array('tag' => 'View All Accounts', 'link' => array('modules' => $this->_modules, 'controller' => 'glaccounts', 'action' => 'index'));
     $sidebarlist['viewcentres'] = array('tag' => 'View All Centres', 'link' => array('modules' => $this->_modules, 'controller' => 'glcentres', 'action' => 'index'));
     $sidebar->addList('Actions', $sidebarlist);
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
Example #24
0
 public function index()
 {
     $this->view->set('clickaction', 'view');
     parent::index(new WHStoreCollection($this->_templateobject));
 }
Example #25
0
 public function viewBalances()
 {
     if ($this->isPrintDialog()) {
         // set options
         $options = $this->reportOptions();
         // we use status in other print functions, however here we base it on if ajax print is or isn't set
         if (!$this->isPrinting()) {
             return $options;
         }
     }
     if (!$this->loadData()) {
         $this->dataError();
         sendBack();
     }
     $id = $this->_data['id'];
     $transaction = $this->_uses[$this->modeltype];
     $s_data = array();
     if (isset($this->_data['id'])) {
         $id = $this->_data['id'];
         $s_data['whlocation_id'] = $id;
     } elseif (isset($this->_data['Search']['whlocation_id'])) {
         $id = $this->_data['Search']['whlocation_id'];
         $s_data['whlocation_id'] = $id;
     }
     if (isset($this->_data['stitem_id'])) {
         $s_data['stitem_id'] = $this->_data['stitem_id'];
     } elseif (isset($this->_data['Search']['stitem_id'])) {
         $s_data['stitem_id'] = $this->_data['Search']['stitem_id'];
     }
     $this->setSearch('whlocationsSearch', 'withinLocation', $s_data);
     $this->view->set('transaction', $transaction);
     $this->view->set('page_title', $this->getPageName('Location', 'View Balances for'));
     $stbalances = new STBalanceCollection();
     $sh = $this->setSearchHandler($stbalances);
     $sh->setOrderby('stitem');
     parent::index($stbalances, $sh);
     $this->view->set('clickaction', 'viewTransactions');
     $this->view->set('clickcontroller', 'WHLocations');
     $this->view->set('linkvaluefield', 'whlocation_id');
     $this->view->set('no_ordering', TRUE);
     $sidebar = new SidebarController($this->view);
     $sidebarlist = array();
     $sidebarlist['stores'] = array('tag' => 'All Stores', 'link' => array('modules' => $this->_modules, 'controller' => 'WHStores', 'action' => 'index'));
     $sidebarlist['locations'] = array('tag' => 'Locations for Store ' . $transaction->whstore, 'link' => array('modules' => $this->_modules, 'controller' => 'WHStores', 'action' => 'index', 'id' => $transaction->whstore_id));
     $sidebarlist['thisLocation'] = array('tag' => 'Location Detail', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'view', 'id' => $id));
     $sidebar->addList('Show', $sidebarlist);
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
 public function view_so_product()
 {
     if (!isset($this->_data['productline_header_id']) && !isset($this->_data['Search']['productline_header_id'])) {
         $this->DataError();
         sendBack();
     }
     $this->view->set('clickaction', 'edit');
     $s_data = array();
     // Set context from calling module
     if (!isset($this->_data['Search']) || isset($this->_data['Search']['clear'])) {
         $s_data['start_date/end_date'] = date(DATE_FORMAT);
         $s_data['productline_header_id'] = $this->_data['productline_header_id'];
     }
     if (isset($this->_data['productline_header_id'])) {
         $productline_header_id = $this->_data['productline_header_id'];
     } elseif (isset($this->_data['Search']['productline_header_id'])) {
         $productline_header_id = $this->_data['Search']['productline_header_id'];
     }
     $this->setSearch('productlinesSearch', 'soheaderLines', $s_data);
     // Load the Product Header
     $product = DataObjectFactory::Factory('SOProductlineHeader');
     $product->load($productline_header_id);
     $this->view->set('SOProductlineHeader', $product);
     // Load the associated lines
     parent::index(new SOProductlineCollection($this->_templateobject));
     $sidebar = new SidebarController($this->view);
     $sidebarlist = array();
     $sidebarlist['view_all_products'] = array('link' => array('modules' => $this->_modules, 'controller' => 'soproductlineheaders', 'action' => 'index'), 'tag' => 'View All Products');
     $sidebarlist['view_all_lines'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'index'), 'tag' => 'View All Product Lines');
     $sidebar->addList('All Products', $sidebarlist);
     $sidebarlist = array();
     $sidebarlist['view'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'view_so_product', 'productline_header_id' => $productline_header_id), 'tag' => 'view');
     $sidebarlist['new'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'new', 'productline_header_id' => $productline_header_id), 'tag' => 'new price');
     $sidebarlist['orders'] = array('link' => array('modules' => $this->_modules, 'controller' => 'soproductlineheaders', 'action' => 'view_orders', 'id' => $productline_header_id), 'tag' => 'view orders');
     $sidebarlist['invoices'] = array('link' => array('modules' => $this->_modules, 'controller' => 'soproductlineheaders', 'action' => 'view_invoices', 'id' => $productline_header_id), 'tag' => 'view invoices');
     $sidebarlist['prices'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'price_uplift', 'productline_header_id' => $productline_header_id), 'tag' => 'amend prices');
     $sidebar->addList('this Product', $sidebarlist);
     $sidebarlist = array();
     if (SelectorCollection::TypeDetailsExist($this->modeltype)) {
         $sidebarlist['items'] = array('link' => array('modules' => $this->_modules, 'controller' => 'soproductselectors', 'action' => 'used_by', 'target_id' => $productline_header_id), 'new' => array('modules' => $this->_modules, 'controller' => 'soproductselectors', 'action' => 'select_items', 'target_id' => $productline_header_id), 'tag' => 'used by');
     }
     $sidebar->addList('related_items', $sidebarlist);
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
     $this->view->set('linkmodule', $this->module);
     $this->view->set('linkcontroller', 'soproductlineheaders');
 }
 public function view_transactions()
 {
     if (!$this->loadData()) {
         $this->dataError();
         sendBack();
     }
     $works_order = $this->_uses[$this->modeltype];
     $transaction = DataObjectFactory::Factory('STTransaction');
     $transaction->setDefaultDisplayFields(array('stitem' => 'stock_item', 'created', 'flocation' => 'from_location', 'fbin' => 'from_bin', 'whlocation' => 'to_location', 'whbin' => 'to_bin', 'qty', 'error_qty', 'balance', 'status', 'remarks'));
     $related_collection = new STTransactionCollection($transaction);
     $sh = $this->setSearchHandler($related_collection);
     $sh->addConstraint(new Constraint('process_id', '=', $works_order->id));
     $sh->addConstraint(new Constraint('process_name', '=', $this->_templateobject->transaction_type()));
     $sh->addConstraint(new Constraint('qty', '>=', 0));
     $sh->addConstraint(new Constraint('error_qty', '>=', 0));
     parent::index($related_collection, $sh);
     $this->view->set('clickaction', 'view');
     $this->view->set('clickcontroller', 'stitems');
     $this->view->set('linkvaluefield', 'stitem_id');
     $this->view->set('collection', $related_collection);
     $this->view->set('no_ordering', true);
 }
Example #28
0
 function view_collection()
 {
     if (!isset($this->_data) || !$this->loadData()) {
         $this->dataError();
         sendBack();
     }
     $dataset = $this->_uses[$this->modeltype];
     $model = $this->newModel($dataset);
     $title = $model->getTitle();
     $s_data = array();
     $this->setSearch('datasetsSearch', 'useDefault', $s_data);
     $this->search->setSearchFields($dataset);
     $this->search->setSearchData($s_data, $errors);
     $collection = new DataObjectCollection($model, $this->_schema . '.' . $dataset->name . '_overview');
     $collection->setTitle($title);
     $this->setTemplateName('view_collection');
     parent::index($collection);
     $this->view->set('title', 'Viewing ' . $title);
     $sidebar = new SidebarController($this->view);
     $actions = array();
     $actions['viewall'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'index'), 'tag' => 'View All Datasets');
     $actions['viewthis'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'view', $dataset->idField => $dataset->{$dataset->idField}), 'tag' => 'Edit Dataset Definition');
     $actions['newdata'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'edit_data', 'dataset_id' => $dataset->{$dataset->idField}), 'tag' => 'new ' . $title);
     $actions['listreports'] = array('link' => array('module' => 'reporting', 'controller' => 'reports', 'action' => 'index', 'tablename' => $this->getViewname($dataset->name)), 'tag' => 'list_reports');
     $sidebar->addList('Actions', $actions);
     $this->sidebarRelatedItems($sidebar, $dataset);
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
     $this->view->set('clickaction', 'edit_data');
     $this->view->set('linkdata', array('dataset_id' => $dataset->{$dataset->idField}));
 }
Example #29
0
 private function viewEuTransactions($collection, $sh)
 {
     $errors = array();
     $s_data = array();
     $flash = Flash::Instance();
     $this->view->set('page_title', $collection->title);
     if (isset($this->search)) {
         if ($this->isPrintDialog()) {
             $_SESSION['printing'][$this->_data['index_key']]['search_id'] = $sh->search_id;
             return $this->printCollection();
         } elseif ($this->isPrinting()) {
             $_SESSION['printing'][$this->_data['index_key']]['search_id'] = $sh->search_id;
             $sh->setLimit(0);
             $collection->load($sh);
             //				$this->setParams();
             $this->printCollection($collection);
             exit;
         }
     }
     parent::index($collection, $sh);
     $this->view->set('transactions', $collection);
     $sidebar = new SidebarController($this->view);
     $sidebar->addList('Intrastat', $this->intrastatSidebar());
     $sidebar->addList('Actions', $this->vatReturnSidebar());
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
     $this->view->set('display_fields', '');
     $this->view->set('selected_fields', '');
     $this->setTemplateName('vieweutransactions');
 }
Example #30
0
 public function viewBalances()
 {
     if ($this->isPrintDialog()) {
         // set options
         $options = $this->reportOptions();
         // we use status in other print functions, however here we base it on if ajax print is or isn't set
         if (!$this->isPrinting()) {
             return $options;
         }
     }
     if (!$this->loadData()) {
         $this->dataError();
         sendBack();
     }
     $id = $this->_data['id'];
     $transaction = $this->_uses[$this->modeltype];
     $s_data = array();
     if (isset($this->_data['id'])) {
         $s_data['whbin_id'] = $this->_data['id'];
     } elseif (isset($this->_data['Search']['whbin_id'])) {
         $s_data['whbin_id'] = $id = $this->_data['Search']['whbin_id'];
     }
     if (isset($this->_data['stitem_id'])) {
         $s_data['stitem_id'] = $this->_data['stitem_id'];
     } elseif (isset($this->_data['Search']['stitem_id'])) {
         $s_data['stitem_id'] = $this->_data['Search']['stitem_id'];
     }
     $this->setSearch('whbinsSearch', 'withinBin', $s_data);
     $this->view->set('transaction', $transaction);
     $stbalances = new STBalanceCollection();
     $sh = $this->setSearchHandler($stbalances);
     $sh->setOrderby('stitem');
     parent::index($stbalances, $sh);
     $this->view->set('clickaction', 'viewTransactions');
     $this->view->set('clickcontroller', 'WHBins');
     $this->view->set('linkvaluefield', 'whbin_id');
     $this->view->set('no_ordering', true);
     $this->view->set('page_title', $this->getPageName('', 'View Balances for'));
     $sidebar = new SidebarController($this->view);
     $whlocation = $this->getLocation($transaction->whlocation_id);
     $sidebarlist = $this->setGeneralSidebar($whlocation, $transaction);
     $sidebar->addList('Show', $sidebarlist);
     $sidebarlist = array();
     $sidebarlist['balances'] = array('tag' => 'Stock Balances', 'link' => array('modules' => $this->_modules, 'controller' => 'WHLocations', 'action' => 'printAction', 'filename' => 'BalanceList_' . date('Y-m-d'), 'printaction' => 'printBalanceList', 'id' => $transaction->whlocation_id, 'whbin_id' => $id));
     $sidebar->addList('Reports', $sidebarlist);
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }