diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 73d905c95..74bebaf71 100755
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -44,10 +44,11 @@ class AccountController extends \BaseController {
$random = str_random(RANDOM_KEY_LENGTH);
$user = new User;
+ $user->username = $random;
$user->password = $random;
- $user->password_confirmation = $random;
- $account->users()->save($user);
-
+ $user->password_confirmation = $random;
+ $account->users()->save($user);
+
Session::forget(RECENTLY_VIEWED);
}
@@ -479,17 +480,13 @@ class AccountController extends \BaseController {
$account->industry_id = Input::get('industry_id') ? Input::get('industry_id') : null;
$account->save();
- $user = $account->users()->first();
+ $user = Auth::user();
$user->first_name = trim(Input::get('first_name'));
$user->last_name = trim(Input::get('last_name'));
- $user->username = $user->email = trim(Input::get('email'));
- $user->phone = trim(Input::get('phone'));
- $user->save();
-
- if (Input::get('timezone_id')) {
- $timezone = Timezone::findOrFail(Input::get('timezone_id'));
- Session::put('tz', $timezone->name);
- }
+ $user->username = trim(Input::get('email'));
+ $user->email = trim(Input::get('email'));
+ $user->phone = trim(Input::get('phone'));
+ $user->amend(); // need to 'amend' to avoid password validation rules
/* Logo image file */
if ($file = Input::file('logo'))
diff --git a/app/controllers/CreditController.php b/app/controllers/CreditController.php
index cf77da9da..b51293c3f 100755
--- a/app/controllers/CreditController.php
+++ b/app/controllers/CreditController.php
@@ -23,7 +23,7 @@ class CreditController extends \BaseController {
return View::make('list', array(
'entityType'=>ENTITY_CREDIT,
'title' => '- Credits',
- 'columns'=>['checkbox', 'Client', 'Credit Amount', 'Credit Date', 'Action']
+ 'columns'=>['checkbox', 'Client', 'Credit Amount', 'Credit Date', 'Private Notes', 'Action']
));
}
@@ -41,6 +41,7 @@ class CreditController extends \BaseController {
return $table->addColumn('amount', function($model){ return Utils::formatMoney($model->amount, $model->currency_id); })
->addColumn('credit_date', function($model) { return Utils::fromSqlDate($model->credit_date); })
+ ->addColumn('private_notes', function($model) { return $model->private_notes; })
->addColumn('dropdown', function($model)
{
return '
@@ -66,8 +67,8 @@ class CreditController extends \BaseController {
'method' => 'POST',
'url' => 'credits',
'title' => '- New Credit',
- 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
- 'invoices' => Invoice::scope()->with('client', 'invoice_status')->where('balance','>',0)->orderBy('invoice_number')->get(),
+ //'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
+ 'invoices' => Invoice::scope()->with('client', 'invoice_status')->orderBy('invoice_number')->get(),
'clients' => Client::scope()->with('contacts')->orderBy('name')->get());
return View::make('credits.edit', $data);
@@ -84,7 +85,7 @@ class CreditController extends \BaseController {
'method' => 'PUT',
'url' => 'credits/' . $publicId,
'title' => '- Edit Credit',
- 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
+ //'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
'clients' => Client::scope()->with('contacts')->orderBy('name')->get());
return View::make('credit.edit', $data);
}
diff --git a/app/controllers/InvoiceController.php b/app/controllers/InvoiceController.php
index 1a02a7a23..2645eab6a 100755
--- a/app/controllers/InvoiceController.php
+++ b/app/controllers/InvoiceController.php
@@ -68,6 +68,9 @@ class InvoiceController extends \BaseController {
diff --git a/app/controllers/PaymentController.php b/app/controllers/PaymentController.php
index f6fe155e8..b867e8e3c 100755
--- a/app/controllers/PaymentController.php
+++ b/app/controllers/PaymentController.php
@@ -18,7 +18,7 @@ class PaymentController extends \BaseController
return View::make('list', array(
'entityType'=>ENTITY_PAYMENT,
'title' => '- Payments',
- 'columns'=>['checkbox', 'Transaction Reference', 'Client', 'Invoice', 'Payment Amount', 'Payment Date', 'Action']
+ 'columns'=>['checkbox', 'Transaction Reference', 'Method', 'Client', 'Invoice', 'Payment Amount', 'Payment Date', 'Action']
));
}
@@ -31,7 +31,9 @@ class PaymentController extends \BaseController
$table->addColumn('checkbox', function($model) { return '
'; });
}
- $table->addColumn('transaction_reference', function($model) { return $model->transaction_reference ? $model->transaction_reference : '
Manual entry'; });
+ $table->addColumn('transaction_reference', function($model) { return $model->transaction_reference ? $model->transaction_reference : '
Manual entry'; })
+ ->addColumn('method', function($model) { return $model->payment_type ? $model->payment_type : ($model->transaction_reference ? '
Online payment' : ''); });
+
if (!$clientPublicId) {
$table->addColumn('client_name', function($model) { return link_to('clients/' . $model->client_public_id, Utils::getClientDisplayName($model)); });
@@ -62,12 +64,12 @@ class PaymentController extends \BaseController
'clientPublicId' => Input::old('client') ? Input::old('client') : $clientPublicId,
'invoicePublicId' => Input::old('invoice') ? Input::old('invoice') : $invoicePublicId,
'invoice' => null,
- 'invoices' => Invoice::scope()->with('client', 'invoice_status')->where('balance','>',0)->orderBy('invoice_number')->get(),
+ 'invoices' => Invoice::scope()->with('client', 'invoice_status')->orderBy('invoice_number')->get(),
'payment' => null,
'method' => 'POST',
'url' => "payments",
'title' => '- New Payment',
- 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
+ //'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
'paymentTypes' => PaymentType::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
'clients' => Client::scope()->with('contacts')->orderBy('name')->get());
@@ -87,7 +89,7 @@ class PaymentController extends \BaseController
'method' => 'PUT',
'url' => 'payments/' . $publicId,
'title' => '- Edit Payment',
- 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
+ //'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
'paymentTypes' => PaymentType::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
'clients' => Client::scope()->with('contacts')->orderBy('name')->get());
return View::make('payments.edit', $data);
diff --git a/app/database/migrations/2013_11_05_180133_confide_setup_users_table.php b/app/database/migrations/2013_11_05_180133_confide_setup_users_table.php
index acc0068d5..70ca02c7d 100755
--- a/app/database/migrations/2013_11_05_180133_confide_setup_users_table.php
+++ b/app/database/migrations/2013_11_05_180133_confide_setup_users_table.php
@@ -178,7 +178,7 @@ class ConfideSetupUsersTable extends Migration {
$t->string('first_name');
$t->string('last_name');
$t->string('phone');
- $t->string('username');
+ $t->string('username')->unique();
$t->string('email');
$t->string('password');
$t->string('confirmation_code');
@@ -305,7 +305,6 @@ class ConfideSetupUsersTable extends Migration {
$t->unsignedInteger('user_id');
$t->unsignedInteger('account_id')->index();
$t->unsignedInteger('invoice_status_id')->default(1);
- $t->unsignedInteger('currency_id')->default(1);
$t->timestamps();
$t->softDeletes();
@@ -334,7 +333,6 @@ class ConfideSetupUsersTable extends Migration {
$t->foreign('account_id')->references('id')->on('accounts');
$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');;
$t->foreign('invoice_status_id')->references('id')->on('invoice_statuses');
- $t->foreign('currency_id')->references('id')->on('currencies');
$t->foreign('recurring_invoice_id')->references('id')->on('invoices');
$t->unsignedInteger('public_id')->index();
@@ -441,7 +439,6 @@ class ConfideSetupUsersTable extends Migration {
$t->unsignedInteger('user_id')->nullable();
$t->unsignedInteger('account_gateway_id')->nullable();
$t->unsignedInteger('payment_type_id')->nullable();
- $t->unsignedInteger('currency_id')->default(1);
$t->timestamps();
$t->softDeletes();
@@ -457,7 +454,6 @@ class ConfideSetupUsersTable extends Migration {
$t->foreign('contact_id')->references('id')->on('contacts');
$t->foreign('account_gateway_id')->references('id')->on('account_gateways');
$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');;
- $t->foreign('currency_id')->references('id')->on('currencies');
$t->foreign('payment_type_id')->references('id')->on('payment_types');
$t->unsignedInteger('public_id')->index();
@@ -472,7 +468,6 @@ class ConfideSetupUsersTable extends Migration {
$t->unsignedInteger('client_id')->index()->nullable();
$t->unsignedInteger('invoice_id')->nullable();
$t->unsignedInteger('contact_id')->nullable();
- $t->unsignedInteger('currency_id')->default(1);
$t->timestamps();
$t->softDeletes();
@@ -480,14 +475,14 @@ class ConfideSetupUsersTable extends Migration {
$t->decimal('amount', 13, 4);
$t->date('credit_date')->nullable();
$t->string('credit_number');
+ $t->text('private_notes');
$t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
$t->foreign('client_id')->references('id')->on('clients')->onDelete('cascade');
$t->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade');
$t->foreign('contact_id')->references('id')->on('contacts');
$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');;
- $t->foreign('currency_id')->references('id')->on('currencies');
-
+
$t->unsignedInteger('public_id')->index();
$t->unique( array('account_id','public_id') );
});
@@ -505,7 +500,7 @@ class ConfideSetupUsersTable extends Migration {
$t->unsignedInteger('invoice_id');
$t->unsignedInteger('credit_id');
$t->unsignedInteger('invitation_id');
- $t->unsignedInteger('currency_id')->default(1);
+ $t->unsignedInteger('currency_id')->nullable();
$t->text('message');
$t->text('json_backup');
diff --git a/app/database/seeds/ConstantsSeeder.php b/app/database/seeds/ConstantsSeeder.php
index 29ecf642d..b056c26e8 100755
--- a/app/database/seeds/ConstantsSeeder.php
+++ b/app/database/seeds/ConstantsSeeder.php
@@ -31,10 +31,21 @@ class ConstantsSeeder extends Seeder
$client->invoices()->save($invoice);
*/
- PaymentType::create(array('name' => 'Visa'));
+ PaymentType::create(array('name' => 'Apply Credit'));
+ PaymentType::create(array('name' => 'Bank Transfer'));
+ PaymentType::create(array('name' => 'Cash'));
+ PaymentType::create(array('name' => 'Debit'));
+ PaymentType::create(array('name' => 'ACH'));
+ PaymentType::create(array('name' => 'Visa Card'));
PaymentType::create(array('name' => 'MasterCard'));
PaymentType::create(array('name' => 'American Express'));
- PaymentType::create(array('name' => 'Cash'));
+ PaymentType::create(array('name' => 'Discover Card'));
+ PaymentType::create(array('name' => 'Diners Card'));
+ PaymentType::create(array('name' => 'EuroCard'));
+ PaymentType::create(array('name' => 'Nova'));
+ PaymentType::create(array('name' => 'Credit Card Other'));
+ PaymentType::create(array('name' => 'PayPal'));
+ PaymentType::create(array('name' => 'Google Wallet'));
Theme::create(array('name' => 'amelia'));
Theme::create(array('name' => 'cerulean'));
diff --git a/app/models/Activity.php b/app/models/Activity.php
index 86e9f16f7..60f672a51 100755
--- a/app/models/Activity.php
+++ b/app/models/Activity.php
@@ -108,7 +108,7 @@ class Activity extends Eloquent
$activity = Activity::getBlank($invoice);
$activity->invoice_id = $invoice->id;
$activity->client_id = $invoice->client_id;
- $activity->currency_id = $invoice->currency_id;
+ $activity->currency_id = $invoice->client->currency_id;
$activity->activity_type_id = ACTIVITY_TYPE_CREATE_INVOICE;
$activity->message = $message;
$activity->balance = $invoice->client->balance;
@@ -289,7 +289,7 @@ class Activity extends Eloquent
}
$activity->client_id = $payment->client_id;
- $activity->currency_id = $payment->currency_id;
+ $activity->currency_id = $client->currency_id;
$activity->activity_type_id = ACTIVITY_TYPE_CREATE_PAYMENT;
$activity->balance = $client->balance;
$activity->adjustment = $payment->amount * -1;
@@ -388,11 +388,11 @@ class Activity extends Eloquent
$activity->invoice_id = $credit->invoice_id;
$invoice = $credit->invoice;
- $invoice->balance = $invoice->amount - $credit->amount;
+ $invoice->balance = $invoice->balance - $credit->amount;
$invoice->save();
}
- $activity->currency_id = $credit->currency_id;
+ $activity->currency_id = $client->currency_id;
$activity->activity_type_id = ACTIVITY_TYPE_CREATE_CREDIT;
$activity->balance = $client->balance;
$activity->adjustment = $credit->amount * -1;
diff --git a/app/models/Invoice.php b/app/models/Invoice.php
index 2b44d746f..98756ee1f 100755
--- a/app/models/Invoice.php
+++ b/app/models/Invoice.php
@@ -49,10 +49,10 @@ class Invoice extends EntityModel
public function hidePrivateFields()
{
- $this->setVisible(['invoice_number', 'discount', 'po_number', 'invoice_date', 'due_date', 'terms', 'currency_id', 'public_notes', 'amount', 'balance', 'invoice_items', 'client', 'tax_name', 'tax_rate', 'account']);
+ $this->setVisible(['invoice_number', 'discount', 'po_number', 'invoice_date', 'due_date', 'terms', 'public_notes', 'amount', 'balance', 'invoice_items', 'client', 'tax_name', 'tax_rate', 'account']);
- $this->client->setVisible(['name', 'address1', 'address2', 'city', 'state', 'postal_code', 'work_phone', 'payment_terms', 'contacts', 'country']);
- $this->account->setVisible(['name', 'address1', 'address2', 'city', 'state', 'postal_code', 'country']);
+ $this->client->setVisible(['name', 'address1', 'address2', 'city', 'state', 'postal_code', 'work_phone', 'payment_terms', 'contacts', 'country', 'currency_id' ]);
+ $this->account->setVisible(['name', 'address1', 'address2', 'city', 'state', 'postal_code', 'country', 'currency_id']);
foreach ($this->invoice_items as $invoiceItem)
{
diff --git a/app/models/User.php b/app/models/User.php
index 41bf96c35..9cf09ab4c 100755
--- a/app/models/User.php
+++ b/app/models/User.php
@@ -9,14 +9,16 @@ class User extends ConfideUser implements UserInterface, RemindableInterface
protected $softDelete = true;
public static $rules = array(
- /*
- 'username' => 'required|email|unique:users',
- 'email' => 'required|email|unique:users',
- */
+ 'username' => 'required|unique:users',
'password' => 'required|between:6,32|confirmed',
'password_confirmation' => 'between:6,32',
);
+ protected $updateRules = array(
+ 'email' => 'required|unique:users',
+ 'username' => 'required|unique:users',
+ );
+
/**
* The database table used by the model.
*
diff --git a/app/ninja/repositories/CreditRepository.php b/app/ninja/repositories/CreditRepository.php
index 5d28078d2..6f4d5c890 100755
--- a/app/ninja/repositories/CreditRepository.php
+++ b/app/ninja/repositories/CreditRepository.php
@@ -16,7 +16,7 @@ class CreditRepository
->where('clients.deleted_at', '=', null)
->where('credits.deleted_at', '=', null)
->where('contacts.is_primary', '=', true)
- ->select('credits.public_id', 'clients.name as client_name', 'clients.public_id as client_public_id', 'credits.amount', 'credits.credit_date', 'credits.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email');
+ ->select('credits.public_id', 'clients.name as client_name', 'clients.public_id as client_public_id', 'credits.amount', 'credits.credit_date', 'clients.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email', 'credits.private_notes');
if ($clientPublicId)
{
@@ -49,7 +49,8 @@ class CreditRepository
$credit->credit_date = Utils::toSqlDate($input['credit_date']);
$credit->invoice_id = isset($input['invoice']) && $input['invoice'] != "-1" ? Invoice::getPrivateId($input['invoice']) : null;
$credit->amount = Utils::parseFloat($input['amount']);
- $credit->currency_id = $input['currency_id'] ? $input['currency_id'] : null;
+ //$credit->currency_id = $input['currency_id'] ? $input['currency_id'] : null;
+ $credit->private_notes = trim($input['private_notes']);
$credit->save();
return $credit;
diff --git a/app/ninja/repositories/InvoiceRepository.php b/app/ninja/repositories/InvoiceRepository.php
index 6a6421cb0..1778eb52d 100755
--- a/app/ninja/repositories/InvoiceRepository.php
+++ b/app/ninja/repositories/InvoiceRepository.php
@@ -19,7 +19,7 @@ class InvoiceRepository
->where('clients.deleted_at', '=', null)
->where('invoices.is_recurring', '=', false)
->where('contacts.is_primary', '=', true)
- ->select('clients.public_id as client_public_id', 'invoice_number', 'clients.name as client_name', 'invoices.public_id', 'amount', 'invoices.balance', 'invoice_date', 'due_date', 'invoice_statuses.name as invoice_status_name', 'invoices.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email');
+ ->select('clients.public_id as client_public_id', 'invoice_number', 'clients.name as client_name', 'invoices.public_id', 'amount', 'invoices.balance', 'invoice_date', 'due_date', 'invoice_statuses.name as invoice_status_name', 'clients.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email');
if ($clientPublicId)
{
@@ -49,7 +49,7 @@ class InvoiceRepository
->where('invoices.deleted_at', '=', null)
->where('invoices.is_recurring', '=', true)
->where('contacts.is_primary', '=', true)
- ->select('clients.public_id as client_public_id', 'clients.name as client_name', 'invoices.public_id', 'amount', 'frequencies.name as frequency', 'start_date', 'end_date', 'invoices.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email');
+ ->select('clients.public_id as client_public_id', 'clients.name as client_name', 'invoices.public_id', 'amount', 'frequencies.name as frequency', 'start_date', 'end_date', 'clients.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email');
if ($clientPublicId)
{
@@ -122,7 +122,7 @@ class InvoiceRepository
$invoice->terms = trim($data['terms']);
$invoice->public_notes = trim($data['public_notes']);
$invoice->po_number = trim($data['po_number']);
- $invoice->currency_id = $data['currency_id'];
+ //$invoice->currency_id = $data['currency_id'];
if (isset($data['tax_rate']) && Utils::parseFloat($data['tax_rate']) > 0)
{
diff --git a/app/ninja/repositories/PaymentRepository.php b/app/ninja/repositories/PaymentRepository.php
index 5d733b7fe..f3fc0e7f7 100755
--- a/app/ninja/repositories/PaymentRepository.php
+++ b/app/ninja/repositories/PaymentRepository.php
@@ -13,11 +13,12 @@ class PaymentRepository
->join('clients', 'clients.id', '=','payments.client_id')
->join('invoices', 'invoices.id', '=','payments.invoice_id')
->join('contacts', 'contacts.client_id', '=', 'clients.id')
+ ->leftJoin('payment_types', 'payment_types.id', '=', 'payments.payment_type_id')
->where('payments.account_id', '=', \Auth::user()->account_id)
->where('payments.deleted_at', '=', null)
->where('clients.deleted_at', '=', null)
->where('contacts.is_primary', '=', true)
- ->select('payments.public_id', 'payments.transaction_reference', 'clients.name as client_name', 'clients.public_id as client_public_id', 'payments.amount', 'payments.payment_date', 'invoices.public_id as invoice_public_id', 'invoices.invoice_number', 'payments.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email');
+ ->select('payments.public_id', 'payments.transaction_reference', 'clients.name as client_name', 'clients.public_id as client_public_id', 'payments.amount', 'payments.payment_date', 'invoices.public_id as invoice_public_id', 'invoices.invoice_number', 'clients.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email', 'payment_types.name as payment_type');
if ($clientPublicId)
{
@@ -48,7 +49,7 @@ class PaymentRepository
$payment->client_id = Client::getPrivateId($input['client']);
$payment->invoice_id = isset($input['invoice']) && $input['invoice'] != "-1" ? Invoice::getPrivateId($input['invoice']) : null;
- $payment->currency_id = $input['currency_id'] ? $input['currency_id'] : null;
+ //$payment->currency_id = $input['currency_id'] ? $input['currency_id'] : null;
$payment->payment_type_id = $input['payment_type_id'] ? $input['payment_type_id'] : null;
$payment->payment_date = Utils::toSqlDate($input['payment_date']);
$payment->amount = Utils::parseFloat($input['amount']);
diff --git a/app/views/accounts/details.blade.php b/app/views/accounts/details.blade.php
index 594e9a126..fed623c42 100755
--- a/app/views/accounts/details.blade.php
+++ b/app/views/accounts/details.blade.php
@@ -16,7 +16,7 @@
'email' => 'email|required'
)); }}
- {{ Former::populate($account); }}
+ {{ Former::populate($account) }}
{{ Former::populateField('first_name', $account->users()->first()->first_name) }}
{{ Former::populateField('last_name', $account->users()->first()->last_name) }}
{{ Former::populateField('email', $account->users()->first()->email) }}
@@ -27,7 +27,7 @@
{{ Former::legend('Account') }}
{{ Former::text('name') }}
- {{ Former::file('logo')->max(2, 'MB')->accept('image')->wrap('test') }}
+ {{ Former::file('logo')->max(2, 'MB')->accept('image')->wrap('test')->inlineHelp('Recommnded size: 120px width, 80px height') }}
@if (file_exists($account->getLogoPath()))
diff --git a/app/views/accounts/export.blade.php b/app/views/accounts/export.blade.php
index fadfa26da..71b2aa1cc 100755
--- a/app/views/accounts/export.blade.php
+++ b/app/views/accounts/export.blade.php
@@ -4,7 +4,7 @@
@parent
{{ Former::open()->addClass('col-md-9 col-md-offset-1') }}
- {{ Former::legend('Export Data') }}
+ {{ Former::legend('Export Client Data') }}
{{ Button::lg_primary_submit('Download') }}
{{ Former::close() }}
diff --git a/app/views/accounts/import.blade.php b/app/views/accounts/import.blade.php
index 80bccf781..548a587c2 100755
--- a/app/views/accounts/import.blade.php
+++ b/app/views/accounts/import.blade.php
@@ -4,7 +4,7 @@
@parent
{{ Former::open_for_files('account/import_map')->addClass('col-md-9 col-md-offset-1') }}
- {{ Former::legend('Import Clients') }}
+ {{ Former::legend('Import Client Data') }}
{{ Former::file('file')->label('Select CSV file') }}
{{ Former::actions( Button::lg_primary_submit('Upload') ) }}
{{ Former::close() }}
diff --git a/app/views/accounts/settings.blade.php b/app/views/accounts/settings.blade.php
index eaaa7dafb..d8f703e1d 100755
--- a/app/views/accounts/settings.blade.php
+++ b/app/views/accounts/settings.blade.php
@@ -56,13 +56,13 @@
{{ Former::select('datetime_format_id')->addOption('','')->label('Date/Time Format')
->fromQuery($datetimeFormats, 'label', 'id') }}
- {{ Former::legend('Notifications') }}
+ {{ Former::legend('Email Notifications') }}
{{ Former::checkbox('notify_sent')->label(' ')->text('Email me when an invoice is sent') }}
{{ Former::checkbox('notify_viewed')->label(' ')->text('Email me when an invoice is viewed') }}
{{ Former::checkbox('notify_paid')->label(' ')->text('Email me when an invoice is paid') }}
- {{ Former::legend('Invoices') }}
- {{ Former::textarea('invoice_terms') }}
+ {{ Former::legend('Invoice Terms') }}
+ {{ Former::textarea('invoice_terms')->label('Terms') }}
{{ Former::actions( Button::lg_primary_submit('Save') ) }}
{{ Former::close() }}
diff --git a/app/views/clients/edit.blade.php b/app/views/clients/edit.blade.php
index f72549f81..1e5dd9a32 100755
--- a/app/views/clients/edit.blade.php
+++ b/app/views/clients/edit.blade.php
@@ -67,7 +67,7 @@
{{ Former::select('payment_terms')->addOption('','')
->fromQuery($paymentTerms, 'name', 'num_days') }}
{{ Former::select('currency_id')->addOption('','')->label('Currency')
- ->fromQuery($currencies, 'name', 'id')->select(Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY)) }}
+ ->fromQuery($currencies, 'name', 'id') }}
{{ Former::select('size_id')->addOption('','')->label('Size')
->fromQuery($sizes, 'name', 'id') }}
{{ Former::select('industry_id')->addOption('','')->label('Industry')
diff --git a/app/views/clients/show.blade.php b/app/views/clients/show.blade.php
index 90000042b..442821d7b 100755
--- a/app/views/clients/show.blade.php
+++ b/app/views/clients/show.blade.php
@@ -25,8 +25,8 @@
Navigation::links(
[
['Create Invoice', URL::to('invoices/create/' . $client->public_id )],
- ['Create Payment', URL::to('payments/create/' . $client->public_id )],
- ['Create Credit', URL::to('credits/create/' . $client->public_id )],
+ ['Enter Payment', URL::to('payments/create/' . $client->public_id )],
+ ['Enter Credit', URL::to('credits/create/' . $client->public_id )],
]
)
, ['id'=>'primaryDropDown'])->split(); }}
@@ -112,7 +112,7 @@
{{ Datatable::table()
- ->addColumn('Transaction Reference', 'Invoice', 'Payment Amount', 'Payment Date')
+ ->addColumn('Transaction Reference', 'Method', 'Invoice', 'Payment Amount', 'Payment Date')
->setUrl(url('api/payments/' . $client->public_id))
->setOptions('sPaginationType', 'bootstrap')
->setOptions('bFilter', false)
@@ -122,7 +122,7 @@
{{ Datatable::table()
- ->addColumn('Credit Amount', 'Credit Date')
+ ->addColumn('Credit Amount', 'Credit Date', 'Private Notes')
->setUrl(url('api/credits/' . $client->public_id))
->setOptions('sPaginationType', 'bootstrap')
->setOptions('bFilter', false)
diff --git a/app/views/credits/edit.blade.php b/app/views/credits/edit.blade.php
index 1c5851cb1..34e8c8acc 100755
--- a/app/views/credits/edit.blade.php
+++ b/app/views/credits/edit.blade.php
@@ -26,8 +26,9 @@
{{ Former::select('invoice')->addOption('', '')->addGroupClass('invoice-select') }}
{{ Former::text('amount') }}
{{ Former::text('credit_date')->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT)) }}
- {{ Former::select('currency_id')->addOption('','')->label('Currency')
- ->fromQuery($currencies, 'name', 'id')->select(Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY)) }}
+ {{-- Former::select('currency_id')->addOption('','')->label('Currency')
+ ->fromQuery($currencies, 'name', 'id')->select(Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY)) --}}
+ {{ Former::textarea('private_notes') }}
diff --git a/app/views/header.blade.php b/app/views/header.blade.php
index 879860352..572bffb88 100755
--- a/app/views/header.blade.php
+++ b/app/views/header.blade.php
@@ -62,11 +62,11 @@
@section('body')
-
+
-
+
+
@if (Session::has('message'))
{{ Session::get('message') }}
@endif
diff --git a/app/views/invoices/edit.blade.php b/app/views/invoices/edit.blade.php
index d44f3a8b0..02916d4d9 100755
--- a/app/views/invoices/edit.blade.php
+++ b/app/views/invoices/edit.blade.php
@@ -56,7 +56,6 @@
- {{ Former::text('invoice_number')->label('Invoice #')->data_bind("value: invoice_number, valueUpdate: 'afterkeydown'") }}
{{ Former::text('invoice_date')->data_bind("datePicker: invoice_date, valueUpdate: 'afterkeydown'")->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT)) }}
{{ Former::text('due_date')->data_bind("datePicker: due_date, valueUpdate: 'afterkeydown'")->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT)) }}
@@ -71,7 +70,7 @@
@else
- {{ Former::checkbox('recurring')->text('Enable |
Learn more')->data_bind("checked: is_recurring")
+ {{ Former::checkbox('recurring')->text('Enable |
Learn more')->data_bind("checked: is_recurring")
->inlineHelp($invoice && $invoice->last_sent_date ? 'Last invoice sent ' . Utils::dateToString($invoice->last_sent_date) : '') }}
@endif
@@ -79,9 +78,10 @@
+ {{ Former::text('invoice_number')->label('Invoice #')->data_bind("value: invoice_number, valueUpdate: 'afterkeydown'") }}
{{ Former::text('po_number')->label('PO #')->data_bind("value: po_number, valueUpdate: 'afterkeydown'") }}
{{ Former::text('discount')->data_bind("value: discount, valueUpdate: 'afterkeydown'") }}
- {{ Former::select('currency_id')->label('Currency')->addOption('', '')->fromQuery($currencies, 'name', 'id')->data_bind("value: currency_id") }}
+ {{-- Former::select('currency_id')->label('Currency')->addOption('', '')->fromQuery($currencies, 'name', 'id')->data_bind("value: currency_id") --}}
@@ -197,24 +197,14 @@
+ {{ Button::normal('Download PDF', array('onclick' => 'onDownloadClick()')) }}
+
@if ($invoice)
-
-
-
-
-
-
-
-
+
@@ -427,6 +433,32 @@
+
+
+
+
+
+
+
+
Recurring invoices are automatically sent.
+
Use :MONTH, :QUARTER or :YEAR for dynamic dates.
+
Basic math works as well. ie, :MONTH-1.
+
+
+
+
+
+
+
+
+
+
+
{{ Former::close() }}
@@ -437,6 +469,10 @@
$('#signUpModal').modal('show');
}
+ function showLearnMore() {
+ $('#recurringModal').modal('show');
+ }
+
$(function() {
$('#country_id').combobox();
@@ -492,7 +528,7 @@
})
$('#relatedActions > button:first').click(function() {
- onDownloadClick();
+ onPaymentClick();
});
$('#primaryActions > button:first').click(function() {
@@ -906,9 +942,8 @@
this.id = ko.observable('');
self.discount = ko.observable('');
self.frequency_id = ko.observable('');
- //self.currency_id = ko.observable({{ Session::get(SESSION_CURRENCY) }});
- self.currency_id = ko.observable({{ $client && $client->currency_id ? $client->currency_id : Session::get(SESSION_CURRENCY) }});
- self.terms = ko.observable(wordWrapText('{{ $account->invoice_terms }}', 340));
+ //self.currency_id = ko.observable({{ $client && $client->currency_id ? $client->currency_id : Session::get(SESSION_CURRENCY) }});
+ self.terms = ko.observable(wordWrapText('{{ str_replace("\n", '\n', $account->invoice_terms) }}', 340));
self.set_default_terms = ko.observable(false);
self.public_notes = ko.observable('');
self.po_number = ko.observable('');
@@ -1020,7 +1055,7 @@
this.totals.subtotal = ko.computed(function() {
var total = self.totals.rawSubtotal();
- return total > 0 ? formatMoney(total, self.currency_id()) : '';
+ return total > 0 ? formatMoney(total, self.client().currency_id()) : '';
});
this.totals.rawDiscounted = ko.computed(function() {
@@ -1028,7 +1063,7 @@
});
this.totals.discounted = ko.computed(function() {
- return formatMoney(self.totals.rawDiscounted(), self.currency_id());
+ return formatMoney(self.totals.rawDiscounted(), self.client().currency_id());
});
self.totals.taxAmount = ko.computed(function() {
@@ -1042,7 +1077,7 @@
var taxRate = parseFloat(self.tax_rate());
if (taxRate > 0) {
var tax = total * (taxRate/100);
- return formatMoney(tax, self.currency_id());
+ return formatMoney(tax, self.client().currency_id());
} else {
return formatMoney(0);
}
@@ -1054,7 +1089,7 @@
this.totals.paidToDate = ko.computed(function() {
var total = self.totals.rawPaidToDate();
- return total > 0 ? formatMoney(total, self.currency_id()) : '';
+ return total > 0 ? formatMoney(total, self.client().currency_id()) : '';
});
this.totals.total = ko.computed(function() {
@@ -1075,7 +1110,7 @@
total -= paid;
}
- return total != 0 ? formatMoney(total, self.currency_id()) : '';
+ return total != 0 ? formatMoney(total, self.client().currency_id()) : '';
});
self.onDragged = function(item) {
@@ -1311,8 +1346,8 @@
this.totals.total = ko.computed(function() {
var total = self.totals.rawTotal();
- if (window.hasOwnProperty('model') && model.invoice && model.invoice()) {
- return total ? formatMoney(total, model.invoice().currency_id()) : '';
+ if (window.hasOwnProperty('model') && model.invoice && model.invoice() && model.invoice().client()) {
+ return total ? formatMoney(total, model.invoice().client().currency_id()) : '';
} else {
return total ? formatMoney(total, 1) : '';
}
@@ -1410,7 +1445,7 @@
for (var i=0; i
0 ? formatMoney(item.cost(), model.invoice().currency_id(), true) : '');
+ item.cost(parseFloat(item.cost()) > 0 ? formatMoney(item.cost(), model.invoice().client().currency_id(), true) : '');
}
onTaxRateChange();
diff --git a/app/views/payments/edit.blade.php b/app/views/payments/edit.blade.php
index b6fdfe1b0..922bf22bd 100755
--- a/app/views/payments/edit.blade.php
+++ b/app/views/payments/edit.blade.php
@@ -29,8 +29,8 @@
{{ Former::select('payment_type_id')->addOption('','')->label('Payment type')
->fromQuery($paymentTypes, 'name', 'id') }}
{{ Former::text('payment_date')->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT)) }}
- {{ Former::select('currency_id')->addOption('','')->label('Currency')
- ->fromQuery($currencies, 'name', 'id')->select(Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY)) }}
+ {{-- Former::select('currency_id')->addOption('','')->label('Currency')
+ ->fromQuery($currencies, 'name', 'id')->select(Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY)) --}}
diff --git a/bootstrap/start.php b/bootstrap/start.php
index 762ae1ddd..7382448fa 100755
--- a/bootstrap/start.php
+++ b/bootstrap/start.php
@@ -63,16 +63,21 @@ $app = new Illuminate\Foundation\Application;
$env = $app->detectEnvironment(function ()
{
- return require __DIR__.'/environment.php';
+ if (file_exists(__DIR__.'/environment.php'))
+ {
+ return require __DIR__.'/environment.php';
+ }
+ else if (isset($_SERVER['LARAVEL_ENV']))
+ {
+ return $_SERVER['LARAVEL_ENV'];
+ }
+ else
+ {
+ return 'development';
+ }
});
-/*
-$env = $app->detectEnvironment(function () {
- return isset($_SERVER['LARAVEL_ENV']) ? $_SERVER['LARAVEL_ENV'] : 'development';
-});
-*/
-
/*
$env = $app->detectEnvironment(array(
'development' => ['precise64', 'ubuntu-server-12042-x64-vbox4210'],
diff --git a/public/js/script.js b/public/js/script.js
index 390586b63..d93105cdd 100755
--- a/public/js/script.js
+++ b/public/js/script.js
@@ -8,7 +8,7 @@ var isIE = /*@cc_on!@*/false || !!document.documentMode; // At least IE6
function generatePDF(invoice, checkMath) {
var client = invoice.client;
var account = invoice.account;
- var currencyId = invoice.currency_id;
+ var currencyId = client.currency_id;
var invoiceNumber = invoice.invoice_number;
var invoiceDate = invoice.invoice_date ? invoice.invoice_date : '';
var dueDate = invoice.due_date ? invoice.due_date : '';
@@ -150,7 +150,7 @@ function generatePDF(invoice, checkMath) {
doc.setFontType("bold");
doc.text(headerLeft, headerY, 'Amount Due');
- var balance = formatMoney(invoice.balance, currencyId, true);
+ var balance = formatMoney(invoice.balance, currencyId);
balanceX = headerRight - (doc.getStringUnitWidth(balance) * doc.internal.getFontSize());
doc.text(balanceX, headerY, balance);
@@ -341,6 +341,7 @@ function generatePDF(invoice, checkMath) {
if (invoice.client) {
+
var clientX = headerRight - (doc.getStringUnitWidth(invoice.client.name) * doc.internal.getFontSize());
}
var numberX = headerRight - (doc.getStringUnitWidth(invoice.invoice_number) * doc.internal.getFontSize());