Пример #1
0
 private static function getViewModel()
 {
     return ['countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get()];
 }
Пример #2
0
 private static function getViewModel()
 {
     return ['account' => Auth::user()->account, 'branches' => Branch::where('account_id', '=', Auth::user()->account_id)->where('id', Auth::user()->branch_id)->orderBy('public_id')->get(), 'products' => Product::scope()->orderBy('id')->get(array('product_key', 'notes', 'cost', 'qty')), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'frequencies' => array(1 => 'Semanal', 2 => 'Cada 2 semanas', 3 => 'Cada 4 semanas', 4 => 'Mensual', 5 => 'Trimestral', 6 => 'Semestral', 7 => 'Anual')];
 }
 public function show_license_payment()
 {
     if (Input::has('return_url')) {
         Session::set('return_url', Input::get('return_url'));
     }
     if (Input::has('affiliate_key')) {
         if ($affiliate = Affiliate::where('affiliate_key', '=', Input::get('affiliate_key'))->first()) {
             Session::set('affiliate_id', $affiliate->id);
         }
     }
     if (!Session::get('affiliate_id')) {
         return Utils::fatalError();
     }
     if (Input::has('test_mode')) {
         Session::set('test_mode', Input::get('test_mode'));
     }
     $account = $this->accountRepo->getNinjaAccount();
     $account->load('account_gateways.gateway');
     $accountGateway = $account->account_gateways[0];
     $gateway = $accountGateway->gateway;
     $paymentLibrary = $gateway->paymentlibrary;
     $acceptedCreditCardTypes = $accountGateway->getCreditcardTypes();
     $affiliate = Affiliate::find(Session::get('affiliate_id'));
     $data = ['showBreadcrumbs' => false, 'hideHeader' => true, 'url' => 'license', 'amount' => LICENSE_PRICE, 'client' => false, 'contact' => false, 'paymentLibrary' => $paymentLibrary, 'gateway' => $gateway, 'acceptedCreditCardTypes' => $acceptedCreditCardTypes, 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'currencyId' => 1, 'paymentTitle' => $affiliate->payment_title, 'paymentSubtitle' => $affiliate->payment_subtitle];
     return View::make('payments.payment', $data);
 }
Пример #4
0
 private static function getViewModel()
 {
     return ['entityType' => ENTITY_QUOTE, 'account' => Auth::user()->account, 'products' => Product::scope()->orderBy('id')->get(array('product_key', 'notes', 'cost', 'qty')), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'invoiceDesigns' => InvoiceDesign::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'invoiceLabels' => Auth::user()->account->getInvoiceLabels()];
 }
Пример #5
0
 private function importFile()
 {
     $data = Session::get('data');
     Session::forget('data');
     $map = Input::get('map');
     $count = 0;
     $hasHeaders = Input::get('header_checkbox');
     $countries = Country::remember(DEFAULT_QUERY_CACHE)->get();
     $countryMap = [];
     foreach ($countries as $country) {
         $countryMap[strtolower($country->name)] = $country->id;
     }
     foreach ($data as $row) {
         if ($hasHeaders) {
             $hasHeaders = false;
             continue;
         }
         $client = Client::createNew();
         $contact = Contact::createNew();
         $contact->is_primary = true;
         $contact->send_invoice = true;
         $count++;
         foreach ($row as $index => $value) {
             $field = $map[$index];
             $value = trim($value);
             if ($field == Client::$fieldVat_number && !$client->vat_number) {
                 $client->vat_number = $value;
             } else {
                 if ($field == Client::$fieldName && !$client->name) {
                     $client->name = $value;
                 } else {
                     if ($field == Client::$fieldNit && !$client->nit) {
                         $client->nit = $value;
                     } else {
                         if ($field == Client::$fieldPhone && !$client->work_phone) {
                             $client->work_phone = $value;
                         } else {
                             if ($field == Client::$fieldAddress1 && !$client->address1) {
                                 $client->address1 = $value;
                             } else {
                                 if ($field == Client::$fieldAddress2 && !$client->address2) {
                                     $client->address2 = $value;
                                 } else {
                                     if ($field == Client::$fieldNotes && !$client->private_notes) {
                                         $client->private_notes = $value;
                                     } else {
                                         if ($field == Contact::$fieldFirstName && !$contact->first_name) {
                                             $contact->first_name = $value;
                                         } else {
                                             if ($field == Contact::$fieldLastName && !$contact->last_name) {
                                                 $contact->last_name = $value;
                                             } else {
                                                 if ($field == Contact::$fieldPhone && !$contact->phone) {
                                                     $contact->phone = $value;
                                                 } else {
                                                     if ($field == Contact::$fieldEmail && !$contact->email) {
                                                         $contact->email = strtolower($value);
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $client->save();
         $client->contacts()->save($contact);
         $client->save();
         Activity::createClient($client, false);
     }
     $message = Utils::pluralize('created_client', $count);
     Session::flash('message', $message);
     return Redirect::to('clients');
 }
 private static function getViewModel()
 {
     return ['sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'customLabel1' => Auth::user()->account->custom_client_label1, 'customLabel2' => Auth::user()->account->custom_client_label2];
 }
 private static function getViewModel()
 {
     $recurringHelp = '';
     foreach (preg_split("/((\r?\n)|(\r\n?))/", trans('texts.recurring_help')) as $line) {
         $parts = explode("=>", $line);
         if (count($parts) > 1) {
             $line = $parts[0] . ' => ' . Utils::processVariables($parts[0]);
             $recurringHelp .= '<li>' . strip_tags($line) . '</li>';
         } else {
             $recurringHelp .= $line;
         }
     }
     return ['account' => Auth::user()->account, 'products' => Product::scope()->orderBy('id')->get(array('product_key', 'notes', 'cost', 'qty')), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'invoiceDesigns' => InvoiceDesign::remember(DEFAULT_QUERY_CACHE, 'invoice_designs_cache_' . Auth::user()->maxInvoiceDesignId())->where('id', '<=', Auth::user()->maxInvoiceDesignId())->orderBy('id')->get(), 'frequencies' => array(1 => 'Weekly', 2 => 'Two weeks', 3 => 'Four weeks', 4 => 'Monthly', 5 => 'Three months', 6 => 'Six months', 7 => 'Annually'), 'recurringHelp' => $recurringHelp];
 }
Пример #8
0
 private static function getViewModel()
 {
     return ['account' => Auth::user()->account, 'branch' => Auth::user()->branch, 'products' => Product::scope()->with('prices')->orderBy('id')->get(), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get(), 'currencies' => Currency::orderBy('name')->get(), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'invoiceDesigns' => InvoiceDesign::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'invoiceLabels' => Auth::user()->account->getInvoiceLabels(), 'frequencies' => array(1 => 'Semanal', 2 => 'Cada 2 semanas', 3 => 'Cada 4 semanas', 4 => 'Mensual', 5 => 'Trimestral', 6 => 'Semestral', 7 => 'Anual')];
 }
 private static function getViewModel()
 {
     return ['account' => Auth::user()->account, 'products' => Product::scope()->orderBy('id')->get(array('product_key', 'notes', 'cost', 'qty')), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'invoiceDesigns' => InvoiceDesign::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'invoiceLabels' => Auth::user()->account->getInvoiceLabels(), 'frequencies' => array(1 => 'Weekly', 2 => 'Two weeks', 3 => 'Four weeks', 4 => 'Monthly', 5 => 'Three months', 6 => 'Six months', 7 => 'Annually')];
 }
Пример #10
0
 private static function getViewModel()
 {
     return ['industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'business_types' => BusinessType::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'groups' => Group::orderBy('name')->get(), 'zones' => Zone::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'customLabel1' => Auth::user()->account->custom_client_label1, 'customLabel2' => Auth::user()->account->custom_client_label2];
 }