function create() { if ($_POST) { unset($_POST['send']); unset($_POST['_wysihtml5_mode']); $invoice = Invoice::create($_POST); $new_invoice_reference = $_POST['reference'] + 1; $invoice_reference = Setting::first(); $invoice_reference->update_attributes(array('invoice_reference' => $new_invoice_reference)); if (!$invoice) { $this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_create_invoice_error')); } else { $this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_create_invoice_success')); } redirect('invoices'); } else { $this->view_data['invoices'] = Invoice::all(); $this->view_data['next_reference'] = Invoice::last(); $this->view_data['companies'] = Company::find('all', array('conditions' => array('inactive=?', '0'))); $this->theme_view = 'modal'; $this->view_data['title'] = $this->lang->line('application_create_invoice'); $this->view_data['form_action'] = 'invoices/create'; $this->content_view = 'invoices/_invoice'; } }
/** * Display a listing of quotes * * @return Response */ public function index() { if (!Sentry::getUser()) { return Redirect::route('sessions.create'); } $quotes = Invoice::all(); return View::make('invoices.index', compact('quotes')); }
/** * @param array|null $params * * @return array An array of the customer's Invoices. */ public function invoices($params = null) { if (!$params) { $params = array(); } $params['customer'] = $this->id; $invoices = Invoice::all($params, $this->_opts); return $invoices; }
/** * Display a listing of finances * * @return Response */ public function index() { if (!Sentry::getUser()) { return Redirect::route('sessions.create'); } $timecards = Timecard::all(); $quotes = Quote::all(); $invoices = Invoice::all(); return View::make('finances.index', compact('timecards', 'quotes', 'invoices')); }
public static function index() { $user = self::get_user_logged_in(); $reservations = null; $invoices = null; $utilization_rates = null; if ($user) { $reservations = $user->manager ? Reservation::all_future(null, 5, false) : Reservation::all_future($user->id, 5, false); $invoices = $user->manager ? Invoice::all(5) : Invoice::all_for_user($user->id, 5); $utilization_rates = $user->manager ? Service::utilization_rates() : null; } View::make('index.html', array('reservations' => $reservations, 'invoices' => $invoices, 'utilization_rates' => $utilization_rates)); }
function view($id = FALSE) { $this->view_data['submenu'] = array($this->lang->line('application_back') => 'cprojects', $this->lang->line('application_overview') => 'cprojects/view/' . $id, $this->lang->line('application_media') => 'cprojects/media/' . $id); $this->view_data['project'] = Project::find($id); $this->view_data['project_has_invoices'] = Invoice::all(array('conditions' => array('project_id = ?', $id))); if (!isset($this->view_data['project_has_invoices'])) { $this->view_data['project_has_invoices'] = array(); } if ($this->view_data['project']->company_id != $this->client->company->id) { redirect('cprojects'); } $this->content_view = 'projects/client_views/view'; }
public static function index() { $user = self::get_user_logged_in(); $users = $user->manager ? User::all() : null; $invoices = null; $selected_user = null; if ($user->manager) { if (isset($_GET['user'])) { $invoice_user = User::find($_GET['user']); if ($invoice_user) { $invoices = Invoice::all_for_user($invoice_user->id); $selected_user = $invoice_user->id; } else { $invoices = Invoice::all(); } } else { $invoices = Invoice::all(); } } else { $invoices = Invoice::all_for_user($user->id); } View::make('invoice/index.html', array('invoices' => $invoices, 'users' => $users, 'selected_user' => $selected_user)); }
/** * @before _secure */ public function bills() { $this->seo(array("title" => "Bills")); $view = $this->getActionView(); $start = RM::get("start", date("Y-m-d", strtotime('-7 day'))); $end = RM::get("end", date("Y-m-d", strtotime('now'))); $query = ['user_id = ?' => $this->user->_id, 'created = ?' => Db::dateQuery($start, $end)]; $performances = \Performance::all($query, [], 'created', 'desc'); $invoices = \Invoice::all(['user_id = ?' => $this->user->_id]); $view->set("performances", $performances)->set("invoices", $invoices); $view->set("start", $start); $view->set("end", $end); }
public function testAll() { self::authorizeFromEnv(); $invoices = Invoice::all(); $this->assertTrue(count($invoices) > 0); }
public static function getTotalIncome() { $totalIncome = Invoice::all()->sum('total'); return $totalIncome; }
/** * Show the form for creating a new resource. * GET /invoice/create * * @return Response */ public function create() { $invoices = Invoice::all(); $receivables = Receivable::all(); return View::make('backend.code.invoicedetail.create', compact('invoices', 'receivables')); }
/** * Display a listing of invoices * * @return Response */ public function index() { $invoices = Invoice::all(); return View::make('invoices.index', compact('invoices')); }
/** * @before _secure */ public function advertisers() { $this->seo(array("title" => "Billing")); $view = $this->getActionView(); $start = RM::get("start", strftime("%Y-%m-%d", strtotime('-7 day'))); $end = RM::get("end", strftime("%Y-%m-%d", strtotime('now'))); $invoices = \Invoice::all(['utype = ?' => 'advertiser', 'org_id' => $this->org->_id]); $view->set('invoices', $invoices)->set('start', $start)->set('end', $end); }
/** * @before _secure */ public function account() { $this->seo(array("title" => "Account")); $view = $this->getActionView(); $invoices = \Invoice::all(['user_id = ?' => $this->user->_id], ['start', 'end', 'amount', 'live', 'created']); $payments = \Payment::all(['user_id = ?' => $this->user->_id], ['type', 'amount', 'meta', 'live', 'created']); $user = $this->user; $view->set("errors", []); if (RM::type() == 'POST') { $action = RM::post('action', ''); switch ($action) { case 'account': $fields = ['name', 'phone', 'currency', 'username']; foreach ($fields as $f) { $user->{$f} = RM::post($f); } $user->save(); $view->set('message', 'Account Info updated!!'); break; case 'password': $old = RM::post('password'); $new = RM::post('npassword'); $view->set($user->updatePassword($old, $new)); break; case 'bank': $user->getMeta()['bank'] = ['name' => RM::post('account_bank', ''), 'ifsc' => RM::post('account_code', ''), 'account_no' => RM::post('account_number', ''), 'account_owner' => RM::post('account_owner', '')]; $user->save(); $view->set('message', 'Bank Info Updated!!'); break; case 'payout': $user->getMeta()['payout'] = ['paypal' => RM::post('paypal', ''), 'payquicker' => RM::post('payquicker', ''), 'payoneer' => RM::post('payoneer', ''), 'paytm' => RM::post('paytm', ''), 'mobicash' => RM::post('mobicash', ''), 'easypaisa' => RM::post('easypaisa', '')]; $user->save(); $view->set('message', 'Payout Info Updated!!'); break; case 'custom': $output = Shared\Services\User::customFields($user, $this->org); if (!$output['success']) { return $view->set($output); } $user->save(); $view->set('user', $user); $view->set('message', 'Custom field updated!!'); break; default: $this->_postback('add'); break; } $this->setUser($user); } if (RM::type() === 'DELETE') { $this->_postback('delete'); } $this->_postback('show'); $afields = Meta::search('customField', $this->org); $view->set('afields', $afields)->set("invoices", $invoices)->set("payments", $payments); }
function view($id = FALSE) { $this->view_data['submenu'] = array(); $this->view_data['project'] = Project::find($id); $this->view_data['project_has_invoices'] = Invoice::all(array('conditions' => array('project_id = ? AND estimate != ?', $id, 1))); if (!isset($this->view_data['project_has_invoices'])) { $this->view_data['project_has_invoices'] = array(); } $tasks = ProjectHasTask::count(array('conditions' => 'project_id = ' . $id)); $this->view_data['alltasks'] = $tasks; $this->view_data['opentasks'] = ProjectHasTask::count(array('conditions' => array('status != ? AND project_id = ?', 'done', $id))); $this->view_data['usercountall'] = User::count(array('conditions' => array('status = ?', 'active'))); $this->view_data['usersassigned'] = ProjectHasWorker::count(array('conditions' => array('project_id = ?', $id))); $this->view_data['assigneduserspercent'] = round($this->view_data['usersassigned'] / $this->view_data['usercountall'] * 100); $this->view_data['time_days'] = round((human_to_unix($this->view_data['project']->end . ' 00:00') - human_to_unix($this->view_data['project']->start . ' 00:00')) / 3600 / 24); $this->view_data['time_left'] = $this->view_data['time_days']; $this->view_data['timeleftpercent'] = 100; if (human_to_unix($this->view_data['project']->start . ' 00:00') < time() && human_to_unix($this->view_data['project']->end . ' 00:00') > time()) { $this->view_data['time_left'] = round((human_to_unix($this->view_data['project']->end . ' 00:00') - time()) / 3600 / 24); $this->view_data['timeleftpercent'] = $this->view_data['time_left'] / $this->view_data['time_days'] * 100; } if (human_to_unix($this->view_data['project']->end . ' 00:00') < time()) { $this->view_data['time_left'] = 0; $this->view_data['timeleftpercent'] = 0; } $this->view_data['mytasks'] = ProjectHasTask::count(array('conditions' => array('status != ? AND project_id = ? AND user_id = ?', 'done', $id, $this->user->id))); $tasks_done = ProjectHasTask::count(array('conditions' => array('status = ? AND project_id = ?', 'done', $id))); $this->view_data['progress'] = $this->view_data['project']->progress; if ($this->view_data['project']->progress_calc == 1) { if ($tasks) { @($this->view_data['progress'] = round($tasks_done / $tasks * 100)); } $attr = array('progress' => $this->view_data['progress']); $this->view_data['project']->update_attributes($attr); } @($this->view_data['opentaskspercent'] = $tasks == 0 ? 0 : $tasks_done / $tasks * 100); $projecthasworker = ProjectHasWorker::all(array('conditions' => array('user_id = ? AND project_id = ?', $this->user->id, $id))); if (!$projecthasworker && $this->user->admin != 1) { $this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_no_access_error')); redirect('projects'); } $tracking = $this->view_data['project']->time_spent; if (!empty($this->view_data['project']->tracking)) { $tracking = time() - $this->view_data['project']->tracking + $this->view_data['project']->time_spent; } $this->view_data['timertime'] = $tracking; $this->view_data['time_spent_from_today'] = time() - $this->view_data['project']->time_spent; $tracking = floor($tracking / 60); $tracking_hours = floor($tracking / 60); $tracking_minutes = $tracking - $tracking_hours * 60; $this->view_data['time_spent'] = $tracking_hours . " " . $this->lang->line('application_hours') . " " . $tracking_minutes . " " . $this->lang->line('application_minutes'); $this->view_data['time_spent_counter'] = sprintf("%02s", $tracking_hours) . ":" . sprintf("%02s", $tracking_minutes); $this->content_view = 'projects/view'; }
function view($id = FALSE) { $this->view_data['submenu'] = array(); $this->view_data['project'] = Project::find($id); $this->view_data['project_has_invoices'] = Invoice::all(array('conditions' => array('project_id = ?', $id))); if (!isset($this->view_data['project_has_invoices'])) { $this->view_data['project_has_invoices'] = array(); } $tasks = ProjectHasTask::count(array('conditions' => 'project_id = ' . $id)); $tasks_done = ProjectHasTask::count(array('conditions' => array('status = ? AND project_id = ?', 'done', $id))); $this->view_data['progress'] = $this->view_data['project']->progress; if ($this->view_data['project']->progress_calc == 1) { if ($tasks) { $this->view_data['progress'] = round($tasks_done / $tasks * 100); } $attr = array('progress' => $this->view_data['progress']); $this->view_data['project']->update_attributes($attr); } $projecthasworker = ProjectHasWorker::all(array('conditions' => array('user_id = ? AND project_id = ?', $this->user->id, $id))); if (!$projecthasworker && $this->user->admin != 1) { $this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_no_access_error')); redirect('projects'); } $tracking = $this->view_data['project']->time_spent; if (!empty($this->view_data['project']->tracking)) { $tracking = time() - $this->view_data['project']->tracking + $this->view_data['project']->time_spent; } $this->view_data['time_spent_from_today'] = time() - $this->view_data['project']->time_spent; $tracking = floor($tracking / 60); $tracking_hours = floor($tracking / 60); $tracking_minutes = $tracking - $tracking_hours * 60; $this->view_data['time_spent'] = $tracking_hours . " " . $this->lang->line('application_hours') . " " . $tracking_minutes . " " . $this->lang->line('application_minutes'); $this->view_data['time_spent_counter'] = sprintf("%02s", $tracking_hours) . ":" . sprintf("%02s", $tracking_minutes); $this->content_view = 'projects/view'; }