public function view($customerId = null) { $this->load->model('Customer_model', 'customerModel'); $customerDetails = $this->customerModel->fetchById($customerId); $creditService = new CreditService(); $creditsAndPayments = $creditService->fetchCreditsAndPaymentsForCustomer($customerId); if ($customerDetails == null) { $this->renderView('/common/general_error', array('errorMessage' => "Oops, this customer does not exist.")); return; } Debug::log($creditsAndPayments); $this->renderView('view', array('customer' => $customerDetails, 'creditsAndPayments' => $creditsAndPayments)); }
public function index() { $this->view->addCss('dashboard/index.css'); $stockService = new StockService(); $itemsLowInStock = $stockService->fetchLowInStock(); $currentDate = date('Y-m-d'); $totalExpenses = $this->_getTotalExpense($currentDate); $totalSales = 0; $overdueCredits = array(); $salesTransactionService = new SalesTransactionService(); $totalSales = $salesTransactionService->fetchTotalSales($currentDate); $creditService = new CreditService(); $overdueCredits = $creditService->fetchOverdueCredits(); $this->renderView('index', array('itemsLowInStock' => $itemsLowInStock, 'totalExpenses' => $totalExpenses, 'totalSales' => $totalSales, 'overdueCredits' => $overdueCredits)); }