当前位置: 首页>>代码示例>>PHP>>正文


PHP models\InvoiceDesign类代码示例

本文整理汇总了PHP中app\models\InvoiceDesign的典型用法代码示例。如果您正苦于以下问题:PHP InvoiceDesign类的具体用法?PHP InvoiceDesign怎么用?PHP InvoiceDesign使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了InvoiceDesign类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     $this->command->info('Running UserTableSeeder');
     Eloquent::unguard();
     $faker = Faker\Factory::create();
     $company = Company::create();
     $account = Account::create(['name' => $faker->name, 'address1' => $faker->streetAddress, 'address2' => $faker->secondaryAddress, 'city' => $faker->city, 'state' => $faker->state, 'postal_code' => $faker->postcode, 'country_id' => Country::all()->random()->id, 'account_key' => str_random(RANDOM_KEY_LENGTH), 'invoice_terms' => $faker->text($faker->numberBetween(50, 300)), 'work_phone' => $faker->phoneNumber, 'work_email' => $faker->safeEmail, 'invoice_design_id' => min(InvoiceDesign::all()->random()->id, 10), 'header_font_id' => min(Font::all()->random()->id, 17), 'body_font_id' => min(Font::all()->random()->id, 17), 'primary_color' => $faker->hexcolor, 'timezone_id' => 1, 'company_id' => $company->id]);
     User::create(['email' => TEST_USERNAME, 'username' => TEST_USERNAME, 'account_id' => $account->id, 'password' => Hash::make(TEST_PASSWORD), 'registered' => true, 'confirmed' => true, 'notify_sent' => false, 'notify_paid' => false]);
     Affiliate::create(['affiliate_key' => SELF_HOST_AFFILIATE_KEY]);
 }
开发者ID:medea61,项目名称:invoiceninja,代码行数:10,代码来源:UserTableSeeder.php

示例2: createInvoiceDesigns

 private function createInvoiceDesigns()
 {
     $designs = ['Clean', 'Bold', 'Modern', 'Plain', 'Business', 'Creative', 'Elegant', 'Hipster', 'Playful', 'Photo'];
     for ($i = 0; $i < count($designs); $i++) {
         $design = $designs[$i];
         $fileName = storage_path() . '/templates/' . strtolower($design) . '.js';
         if (file_exists($fileName)) {
             $pdfmake = file_get_contents($fileName);
             if ($pdfmake) {
                 $record = InvoiceDesign::whereName($design)->first();
                 if (!$record) {
                     $record = new InvoiceDesign();
                     $record->id = $i + 1;
                     $record->name = $design;
                 }
                 $record->pdfmake = $pdfmake;
                 $record->save();
             }
         }
     }
 }
开发者ID:njmube,项目名称:invoice-ninja,代码行数:21,代码来源:PaymentLibrariesSeeder.php

示例3: run

 public function run()
 {
     $this->command->info('Running UserTableSeeder');
     Eloquent::unguard();
     $faker = Faker\Factory::create();
     $company = Company::create();
     $account = Account::create(['name' => $faker->name, 'address1' => $faker->streetAddress, 'address2' => $faker->secondaryAddress, 'city' => $faker->city, 'state' => $faker->state, 'postal_code' => $faker->postcode, 'country_id' => Country::all()->random()->id, 'account_key' => str_random(RANDOM_KEY_LENGTH), 'invoice_terms' => $faker->text($faker->numberBetween(50, 300)), 'work_phone' => $faker->phoneNumber, 'work_email' => $faker->safeEmail, 'invoice_design_id' => InvoiceDesign::where('id', '<', CUSTOM_DESIGN)->get()->random()->id, 'header_font_id' => min(Font::all()->random()->id, 17), 'body_font_id' => min(Font::all()->random()->id, 17), 'primary_color' => $faker->hexcolor, 'timezone_id' => 1, 'company_id' => $company->id]);
     $user = User::create(['first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'email' => TEST_USERNAME, 'username' => TEST_USERNAME, 'account_id' => $account->id, 'password' => Hash::make(TEST_PASSWORD), 'registered' => true, 'confirmed' => true, 'notify_sent' => false, 'notify_paid' => false, 'is_admin' => 1]);
     $client = Client::create(['user_id' => $user->id, 'account_id' => $account->id, 'public_id' => 1, 'name' => $faker->name, 'address1' => $faker->streetAddress, 'address2' => $faker->secondaryAddress, 'city' => $faker->city, 'state' => $faker->state, 'postal_code' => $faker->postcode, 'country_id' => DEFAULT_COUNTRY, 'currency_id' => DEFAULT_CURRENCY]);
     Contact::create(['user_id' => $user->id, 'account_id' => $account->id, 'client_id' => $client->id, 'public_id' => 1, 'email' => env('TEST_EMAIL', TEST_USERNAME), 'is_primary' => true]);
     Product::create(['user_id' => $user->id, 'account_id' => $account->id, 'public_id' => 1, 'product_key' => 'ITEM', 'notes' => 'Something nice...', 'cost' => 10]);
     Affiliate::create(['affiliate_key' => SELF_HOST_AFFILIATE_KEY]);
 }
开发者ID:hillelcoren,项目名称:invoice-ninja,代码行数:13,代码来源:UserTableSeeder.php

示例4: getViewModel

 private static function getViewModel()
 {
     // Tax rate $options
     $account = Auth::user()->account;
     $rates = TaxRate::scope()->orderBy('name')->get();
     $options = [];
     $defaultTax = false;
     foreach ($rates as $rate) {
         $options[$rate->rate . ' ' . $rate->name] = $rate->name . ' ' . ($rate->rate + 0) . '%';
         // load default invoice tax
         if ($rate->id == $account->default_tax_rate_id) {
             $defaultTax = $rate;
         }
     }
     return ['entityType' => ENTITY_QUOTE, 'account' => Auth::user()->account, 'products' => Product::scope()->orderBy('id')->get(['product_key', 'notes', 'cost', 'qty']), 'taxRateOptions' => $options, 'defaultTax' => $defaultTax, 'countries' => Cache::get('countries'), 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get(), 'currencies' => Cache::get('currencies'), 'sizes' => Cache::get('sizes'), 'paymentTerms' => Cache::get('paymentTerms'), 'languages' => Cache::get('languages'), 'industries' => Cache::get('industries'), 'invoiceDesigns' => InvoiceDesign::getDesigns(), 'invoiceFonts' => Cache::get('fonts'), 'invoiceLabels' => Auth::user()->account->getInvoiceLabels(), 'isRecurring' => false];
 }
开发者ID:hillelcoren,项目名称:invoice-ninja,代码行数:16,代码来源:QuoteController.php

示例5: showInvoiceDesign

 /**
  * @param $section
  * @return \Illuminate\Contracts\View\View
  */
 private function showInvoiceDesign($section)
 {
     $account = Auth::user()->account->load('country');
     $invoice = new stdClass();
     $client = new stdClass();
     $contact = new stdClass();
     $invoiceItem = new stdClass();
     $document = new stdClass();
     $client->name = 'Sample Client';
     $client->address1 = trans('texts.address1');
     $client->city = trans('texts.city');
     $client->state = trans('texts.state');
     $client->postal_code = trans('texts.postal_code');
     $client->work_phone = trans('texts.work_phone');
     $client->work_email = trans('texts.work_id');
     $invoice->invoice_number = '0000';
     $invoice->invoice_date = Utils::fromSqlDate(date('Y-m-d'));
     $invoice->account = json_decode($account->toJson());
     $invoice->amount = $invoice->balance = 100;
     $invoice->terms = trim($account->invoice_terms);
     $invoice->invoice_footer = trim($account->invoice_footer);
     $contact->first_name = 'Test';
     $contact->last_name = 'Contact';
     $contact->email = 'contact@gmail.com';
     $client->contacts = [$contact];
     $invoiceItem->cost = 100;
     $invoiceItem->qty = 1;
     $invoiceItem->notes = 'Notes';
     $invoiceItem->product_key = 'Item';
     $document->base64 = 'data:image/jpeg;base64,/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAAAyAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNBCUAAAAAABAAAAAAAAAAAAAAAAAAAAAA/+4AIUFkb2JlAGTAAAAAAQMAEAMDBgkAAAW8AAALrQAAEWf/2wCEAAgGBgYGBggGBggMCAcIDA4KCAgKDhANDQ4NDRARDA4NDQ4MEQ8SExQTEg8YGBoaGBgjIiIiIycnJycnJycnJycBCQgICQoJCwkJCw4LDQsOEQ4ODg4REw0NDg0NExgRDw8PDxEYFhcUFBQXFhoaGBgaGiEhICEhJycnJycnJycnJ//CABEIAGQAlgMBIgACEQEDEQH/xADtAAABBQEBAAAAAAAAAAAAAAAAAQIDBAUGBwEBAAMBAQEAAAAAAAAAAAAAAAIDBAUBBhAAAQQCAQMDBQEAAAAAAAAAAgABAwQRBRIQIBMwIQYxIiMUFUARAAIBAgMFAwgHBwUBAAAAAAECAwARIRIEMUFRYROhIkIgcYGRsdFSIzDBMpKyFAVA4WJyM0MkUPGiU3OTEgABAgQBCQYEBwAAAAAAAAABEQIAITESAyBBUWFxkaGxIhAwgdEyE8HxYnLw4UJSgiMUEwEAAgIBAwQCAwEBAAAAAAABABEhMVF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qcHWMXuExr0VmhZdW7FsLT+gynKYpXXjGV7wreJppoapXL7oQD0sBYvCAX4tIpESrHmFyooWQqCbMCN1vpBgtacBgtAYVZcF7afsYf9lQisQlRdvDkWyqGZBthXx7RPvKkUrlb5Q/CrdFT5neoWdIZSWgR/VBQwZ0nUGPeBAJdZvWE38qghbIlumjVcdMzdAL5o/BAVDYFa5xT2qVhDQIAA5pB+5aemryoxhX0jk3pALPvUXhzAK5y/XUnskCEqEqMLSHNUwwLAQBRotLMeIdlDn5FpRZUUm5R2ZJ7EpNZRMobAO5K5hOAUuBYHYG+8SddNHz0+EKEOCcKzlT1BZYb4uB90OpYUAVM2rcL3vCknNK+bjWGKs6bZa9oVhmRdpg/YWAAlUVJkcjdXD11Lgke0VcU2MbHfygaFKWEnTL5GJZzMyGuGMPMbSQlbPagPOZaKOHjusEyaLtXgeW3iK4+oDc4bNYnwcKiQaks/Caxh5wK7kdeZvb3LEJhAMqbKrhAqim522Qv5gPgqp9FxlL7mnZpXi3MxIMgDkG/ug65qHbsEF8zXvjwBFAU4jmwArRmKjV6XLdNd1TvoiF1X5vX/fMHBChWDvd+4paeJz4FDgzLjs70CdhHznQBjzv7Sxo8bd2NfcZmYNWs8RxQGYGe1+olGV9n7Z+0UPFyYwlYvmDNJctGQPGwnyQAWPv0haPhQ4abtsUxZfaFBalqvypK8pGizJpYO+aShBw+h2xgHf3CNeSAXzRnTRxS/szKo3P+IMAszsGE7iUiOwZy99tXZg3BCqz2L+qH0gU09RzxfaMDrstvwgKoDsPRrCLj7jcKSy6oH5pLZC0I+L/UPAvRNDQUa9oMU7aNedH3NWIKBWuO+m4lsAS60VfopKsCajNR6AT7l8D418EaQCisod0YIUK9U/PBh6loQegqKly/QfkBmNzMzM/i+jOk/9k=';
     $invoice->client = $client;
     $invoice->invoice_items = [$invoiceItem];
     //$invoice->documents = $account->hasFeature(FEATURE_DOCUMENTS) ? [$document] : [];
     $invoice->documents = [];
     $data['account'] = $account;
     $data['invoice'] = $invoice;
     $data['invoiceLabels'] = json_decode($account->invoice_labels) ?: [];
     $data['title'] = trans('texts.invoice_design');
     $data['invoiceDesigns'] = InvoiceDesign::getDesigns();
     $data['invoiceFonts'] = Cache::get('fonts');
     $data['section'] = $section;
     $data['pageSizes'] = array_combine(InvoiceDesign::$pageSizes, InvoiceDesign::$pageSizes);
     $design = false;
     foreach ($data['invoiceDesigns'] as $item) {
         if ($item->id == $account->invoice_design_id) {
             $design = $item->javascript;
             break;
         }
     }
     if ($section == ACCOUNT_CUSTOMIZE_DESIGN) {
         $data['customDesign'] = $account->custom_design && !$design ? $account->custom_design : $design;
         // sample invoice to help determine variables
         $invoice = Invoice::scope()->invoiceType(INVOICE_TYPE_STANDARD)->with('client', 'account')->where('is_recurring', '=', false)->first();
         if ($invoice) {
             $invoice->hidePrivateFields();
             unset($invoice->account);
             unset($invoice->invoice_items);
             unset($invoice->client->contacts);
             $data['sampleInvoice'] = $invoice;
         }
     }
     return View::make("accounts.{$section}", $data);
 }
开发者ID:rafaelsisweb,项目名称:invoice-ninja,代码行数:67,代码来源:AccountController.php

示例6: showInvoiceDesign

 private function showInvoiceDesign($section)
 {
     $account = Auth::user()->account->load('country');
     $invoice = new stdClass();
     $client = new stdClass();
     $contact = new stdClass();
     $invoiceItem = new stdClass();
     $client->name = 'Sample Client';
     $client->address1 = '';
     $client->city = '';
     $client->state = '';
     $client->postal_code = '';
     $client->work_phone = '';
     $client->work_email = '';
     $invoice->invoice_number = '0000';
     $invoice->invoice_date = Utils::fromSqlDate(date('Y-m-d'));
     $invoice->account = json_decode($account->toJson());
     $invoice->amount = $invoice->balance = 100;
     $invoice->terms = trim($account->invoice_terms);
     $invoice->invoice_footer = trim($account->invoice_footer);
     $contact->email = 'contact@gmail.com';
     $client->contacts = [$contact];
     $invoiceItem->cost = 100;
     $invoiceItem->qty = 1;
     $invoiceItem->notes = 'Notes';
     $invoiceItem->product_key = 'Item';
     $invoice->client = $client;
     $invoice->invoice_items = [$invoiceItem];
     $data['account'] = $account;
     $data['invoice'] = $invoice;
     $data['invoiceLabels'] = json_decode($account->invoice_labels) ?: [];
     $data['title'] = trans('texts.invoice_design');
     $data['invoiceDesigns'] = InvoiceDesign::getDesigns();
     $data['section'] = $section;
     $design = false;
     foreach ($data['invoiceDesigns'] as $item) {
         if ($item->id == $account->invoice_design_id) {
             $design = $item->javascript;
             break;
         }
     }
     if ($section == ACCOUNT_CUSTOMIZE_DESIGN) {
         $data['customDesign'] = $account->custom_design && !$design ? $account->custom_design : $design;
     }
     return View::make("accounts.{$section}", $data);
 }
开发者ID:jroblesc,项目名称:invoiceninja,代码行数:46,代码来源:AccountController.php

示例7: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     // Set up trusted X-Forwarded-Proto proxies
     // TRUSTED_PROXIES accepts a comma delimited list of subnets
     // ie, TRUSTED_PROXIES='10.0.0.0/8,172.16.0.0/12,192.168.0.0/16'
     if (isset($_ENV['TRUSTED_PROXIES'])) {
         Request::setTrustedProxies(array_map('trim', explode(',', env('TRUSTED_PROXIES'))));
     }
     // Ensure all request are over HTTPS in production
     if (Utils::requireHTTPS() && !Request::secure()) {
         return Redirect::secure(Request::path());
     }
     // If the database doens't yet exist we'll skip the rest
     if (!Utils::isNinja() && !Utils::isDatabaseSetup()) {
         return $next($request);
     }
     // Check if a new version was installed
     if (!Utils::isNinja()) {
         $file = storage_path() . '/version.txt';
         $version = @file_get_contents($file);
         if ($version != NINJA_VERSION) {
             $handle = fopen($file, 'w');
             fwrite($handle, NINJA_VERSION);
             fclose($handle);
             return Redirect::to('/update');
         }
     }
     // Check the application is up to date and for any news feed messages
     if (Auth::check()) {
         $count = Session::get(SESSION_COUNTER, 0);
         Session::put(SESSION_COUNTER, ++$count);
         if (isset($_SERVER['REQUEST_URI']) && !Utils::startsWith($_SERVER['REQUEST_URI'], '/news_feed') && !Session::has('news_feed_id')) {
             $data = false;
             if (Utils::isNinja()) {
                 $data = Utils::getNewsFeedResponse();
             } else {
                 $file = @file_get_contents(NINJA_APP_URL . '/news_feed/' . Utils::getUserType() . '/' . NINJA_VERSION);
                 $data = @json_decode($file);
             }
             if ($data) {
                 if (version_compare(NINJA_VERSION, $data->version, '<')) {
                     $params = ['user_version' => NINJA_VERSION, 'latest_version' => $data->version, 'releases_link' => link_to(RELEASES_URL, 'Invoice Ninja', ['target' => '_blank'])];
                     Session::put('news_feed_id', NEW_VERSION_AVAILABLE);
                     //Session::flash('news_feed_message', trans('texts.new_version_available', $params));
                 } else {
                     Session::put('news_feed_id', $data->id);
                     if ($data->message && $data->id > Auth::user()->news_feed_id) {
                         Session::flash('news_feed_message', $data->message);
                     }
                 }
             } else {
                 Session::put('news_feed_id', true);
             }
         }
     }
     // Check if we're requesting to change the account's language
     if (Input::has('lang')) {
         $locale = Input::get('lang');
         App::setLocale($locale);
         Session::set(SESSION_LOCALE, $locale);
         if (Auth::check()) {
             if ($language = Language::whereLocale($locale)->first()) {
                 $account = Auth::user()->account;
                 $account->language_id = $language->id;
                 $account->save();
             }
         }
     } elseif (Auth::check()) {
         $locale = Auth::user()->account->language ? Auth::user()->account->language->locale : DEFAULT_LOCALE;
         App::setLocale($locale);
     } elseif (session(SESSION_LOCALE)) {
         App::setLocale(session(SESSION_LOCALE));
     }
     // Make sure the account/user localization settings are in the session
     if (Auth::check() && !Session::has(SESSION_TIMEZONE)) {
         Event::fire(new UserSettingsChanged());
     }
     // Check if the user is claiming a license (ie, additional invoices, white label, etc.)
     if (isset($_SERVER['REQUEST_URI'])) {
         $claimingLicense = Utils::startsWith($_SERVER['REQUEST_URI'], '/claim_license');
         if (!$claimingLicense && Input::has('license_key') && Input::has('product_id')) {
             $licenseKey = Input::get('license_key');
             $productId = Input::get('product_id');
             $data = trim(file_get_contents((Utils::isNinjaDev() ? SITE_URL : NINJA_APP_URL) . "/claim_license?license_key={$licenseKey}&product_id={$productId}"));
             if ($productId == PRODUCT_INVOICE_DESIGNS) {
                 if ($data = json_decode($data)) {
                     foreach ($data as $item) {
                         $design = new InvoiceDesign();
                         $design->id = $item->id;
                         $design->name = $item->name;
                         $design->pdfmake = $item->pdfmake;
                         $design->save();
                     }
//.........这里部分代码省略.........
开发者ID:madonion,项目名称:facturi,代码行数:101,代码来源:StartupCheck.php

示例8: invoiceHistory

 public function invoiceHistory($publicId)
 {
     $invoice = Invoice::withTrashed()->scope($publicId)->firstOrFail();
     $invoice->load('user', 'invoice_items', 'account.country', 'client.contacts', 'client.country');
     $invoice->invoice_date = Utils::fromSqlDate($invoice->invoice_date);
     $invoice->due_date = Utils::fromSqlDate($invoice->due_date);
     $invoice->is_pro = Auth::user()->isPro();
     $invoice->is_quote = intval($invoice->is_quote);
     $activityTypeId = $invoice->is_quote ? ACTIVITY_TYPE_UPDATE_QUOTE : ACTIVITY_TYPE_UPDATE_INVOICE;
     $activities = Activity::scope(false, $invoice->account_id)->where('activity_type_id', '=', $activityTypeId)->where('invoice_id', '=', $invoice->id)->orderBy('id', 'desc')->get(['id', 'created_at', 'user_id', 'json_backup']);
     $versionsJson = [];
     $versionsSelect = [];
     $lastId = false;
     foreach ($activities as $activity) {
         $backup = json_decode($activity->json_backup);
         $backup->invoice_date = Utils::fromSqlDate($backup->invoice_date);
         $backup->due_date = Utils::fromSqlDate($backup->due_date);
         $backup->is_pro = Auth::user()->isPro();
         $backup->is_quote = isset($backup->is_quote) && intval($backup->is_quote);
         $backup->account = $invoice->account->toArray();
         $versionsJson[$activity->id] = $backup;
         $key = Utils::timestampToDateTimeString(strtotime($activity->created_at)) . ' - ' . $activity->user->getDisplayName();
         $versionsSelect[$lastId ? $lastId : 0] = $key;
         $lastId = $activity->id;
     }
     $versionsSelect[$lastId] = Utils::timestampToDateTimeString(strtotime($invoice->created_at)) . ' - ' . $invoice->user->getDisplayName();
     $data = ['invoice' => $invoice, 'versionsJson' => json_encode($versionsJson), 'versionsSelect' => $versionsSelect, 'invoiceDesigns' => InvoiceDesign::getDesigns()];
     return View::make('invoices.history', $data);
 }
开发者ID:saratonite,项目名称:invoiceninja,代码行数:29,代码来源:InvoiceController.php

示例9: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     // Ensure all request are over HTTPS in production
     if (App::environment() == ENV_PRODUCTION) {
         if (!Request::secure()) {
             return Redirect::secure(Request::getRequestUri());
         }
     }
     // If the database doens't yet exist we'll skip the rest
     if (!Utils::isNinja() && !Utils::isDatabaseSetup()) {
         return $next($request);
     }
     // Check data has been cached
     $cachedTables = ['currencies' => 'App\\Models\\Currency', 'sizes' => 'App\\Models\\Size', 'industries' => 'App\\Models\\Industry', 'timezones' => 'App\\Models\\Timezone', 'dateFormats' => 'App\\Models\\DateFormat', 'datetimeFormats' => 'App\\Models\\DatetimeFormat', 'languages' => 'App\\Models\\Language', 'paymentTerms' => 'App\\Models\\PaymentTerm', 'paymentTypes' => 'App\\Models\\PaymentType', 'countries' => 'App\\Models\\Country'];
     foreach ($cachedTables as $name => $class) {
         if (Input::has('clear_cache')) {
             Session::flash('message', 'Cache cleared');
         }
         if (Input::has('clear_cache') || !Cache::has($name)) {
             if ($name == 'paymentTerms') {
                 $orderBy = 'num_days';
             } elseif (in_array($name, ['currencies', 'sizes', 'industries', 'languages', 'countries'])) {
                 $orderBy = 'name';
             } else {
                 $orderBy = 'id';
             }
             $tableData = $class::orderBy($orderBy)->get();
             if (count($tableData)) {
                 Cache::forever($name, $tableData);
             }
         }
     }
     // check the application is up to date and for any news feed messages
     if (Auth::check()) {
         $count = Session::get(SESSION_COUNTER, 0);
         Session::put(SESSION_COUNTER, ++$count);
         if (!Utils::startsWith($_SERVER['REQUEST_URI'], '/news_feed') && !Session::has('news_feed_id')) {
             $data = false;
             if (Utils::isNinja()) {
                 $data = Utils::getNewsFeedResponse();
             } else {
                 $file = @file_get_contents(NINJA_APP_URL . '/news_feed/' . Utils::getUserType() . '/' . NINJA_VERSION);
                 $data = @json_decode($file);
             }
             if ($data) {
                 if (version_compare(NINJA_VERSION, $data->version, '<')) {
                     $params = ['user_version' => NINJA_VERSION, 'latest_version' => $data->version, 'releases_link' => link_to(RELEASES_URL, 'Invoice Ninja', ['target' => '_blank'])];
                     Session::put('news_feed_id', NEW_VERSION_AVAILABLE);
                     Session::put('news_feed_message', trans('texts.new_version_available', $params));
                 } else {
                     Session::put('news_feed_id', $data->id);
                     if ($data->message && $data->id > Auth::user()->news_feed_id) {
                         Session::put('news_feed_message', $data->message);
                     }
                 }
             } else {
                 Session::put('news_feed_id', true);
             }
         }
     }
     // Check if we're requesting to change the account's language
     if (Input::has('lang')) {
         $locale = Input::get('lang');
         App::setLocale($locale);
         Session::set(SESSION_LOCALE, $locale);
         if (Auth::check()) {
             if ($language = Language::whereLocale($locale)->first()) {
                 $account = Auth::user()->account;
                 $account->language_id = $language->id;
                 $account->save();
             }
         }
     } elseif (Auth::check()) {
         $locale = Session::get(SESSION_LOCALE, DEFAULT_LOCALE);
         App::setLocale($locale);
     }
     // Make sure the account/user localization settings are in the session
     if (Auth::check() && !Session::has(SESSION_TIMEZONE)) {
         Event::fire(new UserSettingsChanged());
     }
     // Check if the user is claiming a license (ie, additional invoices, white label, etc.)
     $claimingLicense = Utils::startsWith($_SERVER['REQUEST_URI'], '/claim_license');
     if (!$claimingLicense && Input::has('license_key') && Input::has('product_id')) {
         $licenseKey = Input::get('license_key');
         $productId = Input::get('product_id');
         $data = trim(file_get_contents((Utils::isNinjaDev() ? 'http://www.ninja.dev' : NINJA_APP_URL) . "/claim_license?license_key={$licenseKey}&product_id={$productId}"));
         if ($productId == PRODUCT_INVOICE_DESIGNS) {
             if ($data = json_decode($data)) {
                 foreach ($data as $item) {
                     $design = new InvoiceDesign();
                     $design->id = $item->id;
                     $design->name = $item->name;
                     $design->javascript = $item->javascript;
//.........这里部分代码省略.........
开发者ID:josemvarghese,项目名称:invoice-ninja,代码行数:101,代码来源:StartupCheck.php

示例10: invoiceHistory

 public function invoiceHistory(InvoiceRequest $request)
 {
     $invoice = $request->entity();
     $invoice->load('user', 'invoice_items', 'documents', 'expenses', 'expenses.documents', 'account.country', 'client.contacts', 'client.country');
     $invoice->invoice_date = Utils::fromSqlDate($invoice->invoice_date);
     $invoice->due_date = Utils::fromSqlDate($invoice->due_date);
     $invoice->features = ['customize_invoice_design' => Auth::user()->hasFeature(FEATURE_CUSTOMIZE_INVOICE_DESIGN), 'remove_created_by' => Auth::user()->hasFeature(FEATURE_REMOVE_CREATED_BY), 'invoice_settings' => Auth::user()->hasFeature(FEATURE_INVOICE_SETTINGS)];
     $invoice->invoice_type_id = intval($invoice->invoice_type_id);
     $activityTypeId = $invoice->isType(INVOICE_TYPE_QUOTE) ? ACTIVITY_TYPE_UPDATE_QUOTE : ACTIVITY_TYPE_UPDATE_INVOICE;
     $activities = Activity::scope(false, $invoice->account_id)->where('activity_type_id', '=', $activityTypeId)->where('invoice_id', '=', $invoice->id)->orderBy('id', 'desc')->get(['id', 'created_at', 'user_id', 'json_backup']);
     $versionsJson = [];
     $versionsSelect = [];
     $lastId = false;
     foreach ($activities as $activity) {
         if ($backup = json_decode($activity->json_backup)) {
             $backup->invoice_date = Utils::fromSqlDate($backup->invoice_date);
             $backup->due_date = Utils::fromSqlDate($backup->due_date);
             $backup->features = ['customize_invoice_design' => Auth::user()->hasFeature(FEATURE_CUSTOMIZE_INVOICE_DESIGN), 'remove_created_by' => Auth::user()->hasFeature(FEATURE_REMOVE_CREATED_BY), 'invoice_settings' => Auth::user()->hasFeature(FEATURE_INVOICE_SETTINGS)];
             $backup->invoice_type_id = isset($backup->invoice_type_id) && intval($backup->invoice_type_id) == INVOICE_TYPE_QUOTE;
             $backup->account = $invoice->account->toArray();
             $versionsJson[$activity->id] = $backup;
             $key = Utils::timestampToDateTimeString(strtotime($activity->created_at)) . ' - ' . $activity->user->getDisplayName();
             $versionsSelect[$lastId ? $lastId : 0] = $key;
             $lastId = $activity->id;
         } else {
             Utils::logError('Failed to parse invoice backup');
         }
     }
     if ($lastId) {
         $versionsSelect[$lastId] = Utils::timestampToDateTimeString(strtotime($invoice->created_at)) . ' - ' . $invoice->user->getDisplayName();
     }
     $data = ['invoice' => $invoice, 'versionsJson' => json_encode($versionsJson), 'versionsSelect' => $versionsSelect, 'invoiceDesigns' => InvoiceDesign::getDesigns(), 'invoiceFonts' => Cache::get('fonts')];
     return View::make('invoices.history', $data);
 }
开发者ID:hillelcoren,项目名称:invoice-ninja,代码行数:34,代码来源:InvoiceController.php

示例11: getViewModel

 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' => Cache::get('countries'), 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get(), 'currencies' => Cache::get('currencies'), 'sizes' => Cache::get('sizes'), 'paymentTerms' => Cache::get('paymentTerms'), 'industries' => Cache::get('industries'), 'invoiceDesigns' => InvoiceDesign::availableDesigns(), 'invoiceLabels' => Auth::user()->account->getInvoiceLabels()];
 }
开发者ID:biggtfish,项目名称:invoiceNinja-1,代码行数:4,代码来源:QuoteController.php

示例12: showSection

 public function showSection($section = ACCOUNT_DETAILS, $subSection = false)
 {
     if ($section == ACCOUNT_DETAILS) {
         $primaryUser = Auth::user()->account->users()->orderBy('id')->first();
         $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id), 'countries' => Cache::get('countries'), 'sizes' => Cache::get('sizes'), 'industries' => Cache::get('industries'), 'timezones' => Cache::get('timezones'), 'dateFormats' => Cache::get('dateFormats'), 'datetimeFormats' => Cache::get('datetimeFormats'), 'currencies' => Cache::get('currencies'), 'languages' => Cache::get('languages'), 'showUser' => Auth::user()->id === $primaryUser->id, 'title' => trans('texts.company_details'), 'primaryUser' => $primaryUser];
         return View::make('accounts.details', $data);
     } elseif ($section == ACCOUNT_PAYMENTS) {
         $account = Auth::user()->account;
         $account->load('account_gateways');
         $count = count($account->account_gateways);
         if ($count == 0) {
             return Redirect::to('gateways/create');
         } else {
             return View::make('accounts.payments', ['showAdd' => $count < 3, 'title' => trans('texts.online_payments')]);
         }
     } elseif ($section == ACCOUNT_NOTIFICATIONS) {
         $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id), 'title' => trans('texts.notifications')];
         return View::make('accounts.notifications', $data);
     } elseif ($section == ACCOUNT_IMPORT_EXPORT) {
         return View::make('accounts.import_export', ['title' => trans('texts.import_export')]);
     } elseif ($section == ACCOUNT_ADVANCED_SETTINGS) {
         $account = Auth::user()->account->load('country');
         $data = ['account' => $account, 'feature' => $subSection, 'title' => trans('texts.invoice_settings')];
         if ($subSection == ACCOUNT_INVOICE_DESIGN || $subSection == ACCOUNT_CUSTOMIZE_DESIGN) {
             $invoice = new stdClass();
             $client = new stdClass();
             $contact = new stdClass();
             $invoiceItem = new stdClass();
             $client->name = 'Sample Client';
             $client->address1 = '';
             $client->city = '';
             $client->state = '';
             $client->postal_code = '';
             $client->work_phone = '';
             $client->work_email = '';
             $invoice->invoice_number = $account->getNextInvoiceNumber();
             $invoice->invoice_date = Utils::fromSqlDate(date('Y-m-d'));
             $invoice->account = json_decode($account->toJson());
             $invoice->amount = $invoice->balance = 100;
             $invoice->terms = trim($account->invoice_terms);
             $invoice->invoice_footer = trim($account->invoice_footer);
             $contact->email = 'contact@gmail.com';
             $client->contacts = [$contact];
             $invoiceItem->cost = 100;
             $invoiceItem->qty = 1;
             $invoiceItem->notes = 'Notes';
             $invoiceItem->product_key = 'Item';
             $invoice->client = $client;
             $invoice->invoice_items = [$invoiceItem];
             $data['account'] = $account;
             $data['invoice'] = $invoice;
             $data['invoiceLabels'] = json_decode($account->invoice_labels) ?: [];
             $data['title'] = trans('texts.invoice_design');
             $data['invoiceDesigns'] = InvoiceDesign::getDesigns($subSection == ACCOUNT_CUSTOMIZE_DESIGN);
             $design = false;
             foreach ($data['invoiceDesigns'] as $item) {
                 if ($item->id == $account->invoice_design_id) {
                     $design = $item->javascript;
                     break;
                 }
             }
             if ($subSection == ACCOUNT_CUSTOMIZE_DESIGN) {
                 $data['customDesign'] = $account->custom_design && !$design ? $account->custom_design : $design;
             }
         } else {
             if ($subSection == ACCOUNT_EMAIL_TEMPLATES) {
                 $data['invoiceEmail'] = $account->getEmailTemplate(ENTITY_INVOICE);
                 $data['quoteEmail'] = $account->getEmailTemplate(ENTITY_QUOTE);
                 $data['paymentEmail'] = $account->getEmailTemplate(ENTITY_PAYMENT);
                 $data['emailFooter'] = $account->getEmailFooter();
                 $data['title'] = trans('texts.email_templates');
             } else {
                 if ($subSection == ACCOUNT_USER_MANAGEMENT) {
                     $data['title'] = trans('texts.users_and_tokens');
                 }
             }
         }
         return View::make("accounts.{$subSection}", $data);
     } elseif ($section == ACCOUNT_PRODUCTS) {
         $data = ['account' => Auth::user()->account, 'title' => trans('texts.product_library')];
         return View::make('accounts.products', $data);
     }
 }
开发者ID:rogerapras,项目名称:invoice-ninja,代码行数:83,代码来源:AccountController.php

示例13: showSection

 public function showSection($section = ACCOUNT_DETAILS, $subSection = false)
 {
     if ($section == ACCOUNT_DETAILS) {
         $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id), 'countries' => Cache::get('countries'), 'sizes' => Cache::get('sizes'), 'industries' => Cache::get('industries'), 'timezones' => Cache::get('timezones'), 'dateFormats' => Cache::get('dateFormats'), 'datetimeFormats' => Cache::get('datetimeFormats'), 'currencies' => Cache::get('currencies'), 'languages' => Cache::get('languages'), 'showUser' => Auth::user()->id === Auth::user()->account->users()->first()->id];
         return View::make('accounts.details', $data);
     } elseif ($section == ACCOUNT_PAYMENTS) {
         $account = Auth::user()->account;
         $account->load('account_gateways');
         $count = count($account->account_gateways);
         if ($count == 0) {
             return Redirect::to('gateways/create');
         } else {
             return View::make('accounts.payments', ['showAdd' => $count < 3]);
         }
     } elseif ($section == ACCOUNT_NOTIFICATIONS) {
         $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id)];
         return View::make('accounts.notifications', $data);
     } elseif ($section == ACCOUNT_IMPORT_EXPORT) {
         return View::make('accounts.import_export');
     } elseif ($section == ACCOUNT_ADVANCED_SETTINGS) {
         $account = Auth::user()->account;
         $data = ['account' => $account, 'feature' => $subSection];
         if ($subSection == ACCOUNT_INVOICE_DESIGN) {
             $invoice = new stdClass();
             $client = new stdClass();
             $invoiceItem = new stdClass();
             $client->name = 'Sample Client';
             $client->address1 = '';
             $client->city = '';
             $client->state = '';
             $client->postal_code = '';
             $client->work_phone = '';
             $client->work_email = '';
             $invoice->invoice_number = Auth::user()->account->getNextInvoiceNumber();
             $invoice->invoice_date = date_create()->format('Y-m-d');
             $invoice->account = json_decode(Auth::user()->account->toJson());
             $invoice->amount = $invoice->balance = 100;
             $invoiceItem->cost = 100;
             $invoiceItem->qty = 1;
             $invoiceItem->notes = 'Notes';
             $invoiceItem->product_key = 'Item';
             $invoice->client = $client;
             $invoice->invoice_items = [$invoiceItem];
             $data['invoice'] = $invoice;
             $data['invoiceDesigns'] = InvoiceDesign::availableDesigns();
         } else {
             if ($subSection == ACCOUNT_EMAIL_TEMPLATES) {
                 $data['invoiceEmail'] = $account->getEmailTemplate(ENTITY_INVOICE);
                 $data['quoteEmail'] = $account->getEmailTemplate(ENTITY_QUOTE);
                 $data['paymentEmail'] = $account->getEmailTemplate(ENTITY_PAYMENT);
                 $data['emailFooter'] = $account->getEmailFooter();
             }
         }
         return View::make("accounts.{$subSection}", $data);
     } elseif ($section == ACCOUNT_PRODUCTS) {
         $data = ['account' => Auth::user()->account];
         return View::make('accounts.products', $data);
     }
 }
开发者ID:biggtfish,项目名称:invoiceNinja-1,代码行数:59,代码来源:AccountController.php

示例14: showInvoiceDesign

 private function showInvoiceDesign($section)
 {
     $account = Auth::user()->account->load('country');
     $invoice = new stdClass();
     $client = new stdClass();
     $contact = new stdClass();
     $invoiceItem = new stdClass();
     $client->name = 'Sample Client';
     $client->address1 = trans('texts.address1');
     $client->city = trans('texts.city');
     $client->state = trans('texts.state');
     $client->postal_code = trans('texts.postal_code');
     $client->work_phone = trans('texts.work_phone');
     $client->work_email = trans('texts.work_id');
     $invoice->invoice_number = '0000';
     $invoice->invoice_date = Utils::fromSqlDate(date('Y-m-d'));
     $invoice->account = json_decode($account->toJson());
     $invoice->amount = $invoice->balance = 100;
     $invoice->terms = trim($account->invoice_terms);
     $invoice->invoice_footer = trim($account->invoice_footer);
     $contact->email = 'contact@gmail.com';
     $client->contacts = [$contact];
     $invoiceItem->cost = 100;
     $invoiceItem->qty = 1;
     $invoiceItem->notes = 'Notes';
     $invoiceItem->product_key = 'Item';
     $invoice->client = $client;
     $invoice->invoice_items = [$invoiceItem];
     $data['account'] = $account;
     $data['invoice'] = $invoice;
     $data['invoiceLabels'] = json_decode($account->invoice_labels) ?: [];
     $data['title'] = trans('texts.invoice_design');
     $data['invoiceDesigns'] = InvoiceDesign::getDesigns();
     $data['invoiceFonts'] = Cache::get('fonts');
     $data['section'] = $section;
     $design = false;
     foreach ($data['invoiceDesigns'] as $item) {
         if ($item->id == $account->invoice_design_id) {
             $design = $item->javascript;
             break;
         }
     }
     if ($section == ACCOUNT_CUSTOMIZE_DESIGN) {
         $data['customDesign'] = $account->custom_design && !$design ? $account->custom_design : $design;
         // sample invoice to help determine variables
         $invoice = Invoice::scope()->with('client', 'account')->where('is_quote', '=', false)->where('is_recurring', '=', false)->first();
         if ($invoice) {
             $invoice->hidePrivateFields();
             unset($invoice->account);
             unset($invoice->invoice_items);
             unset($invoice->client->contacts);
             $data['sampleInvoice'] = $invoice;
         }
     }
     return View::make("accounts.{$section}", $data);
 }
开发者ID:sseshachala,项目名称:invoiceninja,代码行数:56,代码来源:AccountController.php


注:本文中的app\models\InvoiceDesign类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。