1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-19 16:01:34 +02:00

Enabled manually setting invoices and quotes as sent

This commit is contained in:
Hillel Coren 2014-10-14 22:04:48 +03:00
parent 65f58c64d6
commit 919f13b0d4
15 changed files with 90 additions and 42 deletions

View File

@ -259,6 +259,7 @@ class AccountController extends \BaseController {
$client->name = 'Sample Client';
$invoice->invoice_number = Auth::user()->account->getNextInvoiceNumber();
$invoice->invoice_date = date_create()->format('Y-m-d');
$invoice->account = Auth::user()->account;
$invoice->amount = $invoice->balance = 100;

View File

@ -271,7 +271,7 @@ class InvoiceController extends \BaseController {
$action = Input::get('action');
$entityType = Input::get('entityType');
if ($action == 'archive' || $action == 'delete')
if ($action == 'archive' || $action == 'delete' || $action == 'mark')
{
return InvoiceController::bulk($entityType);
}
@ -413,12 +413,14 @@ class InvoiceController extends \BaseController {
public function bulk($entityType = ENTITY_INVOICE)
{
$action = Input::get('action');
$statusId = Input::get('statusId');
$ids = Input::get('id') ? Input::get('id') : Input::get('ids');
$count = $this->invoiceRepo->bulk($ids, $action);
$count = $this->invoiceRepo->bulk($ids, $action, $statusId);
if ($count > 0)
{
$message = Utils::pluralize("{$action}d_{$entityType}", $count);
$key = $action == 'mark' ? "updated_{$entityType}" : "{$action}d_{$entityType}";
$message = Utils::pluralize($key, $count);
Session::flash('message', $message);
}

View File

@ -433,5 +433,6 @@ return array(
'share_invoice_counter' => 'Share invoice counter',
'invoice_issued_to' => 'Invoice issued to',
'invalid_counter' => 'To prevent a possible conflict please set either an invoice or quote number prefix',
'mark_sent' => 'Mark sent',
);

View File

@ -440,7 +440,9 @@ return array(
'quote_number_counter' => 'Quote Number Counter',
'share_invoice_counter' => 'Share invoice counter',
'invoice_issued_to' => 'Invoice issued to',
'invalid_counter' => 'To prevent a possible conflict please set either an invoice or quote number prefix',
'invalid_counter' => 'To prevent a possible conflict please set either an invoice or quote number prefix',
'mark_sent' => 'Mark sent',
);

View File

@ -431,5 +431,7 @@ return array(
'share_invoice_counter' => 'Share invoice counter',
'invoice_issued_to' => 'Invoice issued to',
'invalid_counter' => 'To prevent a possible conflict please set either an invoice or quote number prefix',
'mark_sent' => 'Mark sent',
);

View File

@ -434,5 +434,7 @@ return array(
'share_invoice_counter' => 'Share invoice counter',
'invoice_issued_to' => 'Invoice issued to',
'invalid_counter' => 'To prevent a possible conflict please set either an invoice or quote number prefix',
'mark_sent' => 'Mark sent',
);

View File

@ -433,6 +433,8 @@ return array(
'share_invoice_counter' => 'Share invoice counter',
'invoice_issued_to' => 'Invoice issued to',
'invalid_counter' => 'To prevent a possible conflict please set either an invoice or quote number prefix',
'mark_sent' => 'Mark sent',
);

View File

@ -441,6 +441,8 @@ return array(
'share_invoice_counter' => 'Share invoice counter',
'invoice_issued_to' => 'Invoice issued to',
'invalid_counter' => 'To prevent a possible conflict please set either an invoice or quote number prefix',
'mark_sent' => 'Mark sent',
);

View File

@ -441,6 +441,8 @@ return array(
'share_invoice_counter' => 'Share invoice counter',
'invoice_issued_to' => 'Invoice issued to',
'invalid_counter' => 'To prevent a possible conflict please set either an invoice or quote number prefix',
'mark_sent' => 'Mark sent',
);

View File

@ -434,6 +434,8 @@ return array(
'share_invoice_counter' => 'Share invoice counter',
'invoice_issued_to' => 'Invoice issued to',
'invalid_counter' => 'To prevent a possible conflict please set either an invoice or quote number prefix',
'mark_sent' => 'Mark sent',
);

View File

@ -422,6 +422,8 @@ return array(
'share_invoice_counter' => 'Share invoice counter',
'invoice_issued_to' => 'Invoice issued to',
'invalid_counter' => 'To prevent a possible conflict please set either an invoice or quote number prefix',
'mark_sent' => 'Mark sent',
);

View File

@ -20,7 +20,7 @@ class InvoiceRepository
->where('contacts.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', 'clients.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email', 'quote_id', 'quote_invoice_id');
->select('clients.public_id as client_public_id', 'invoice_number', 'invoice_status_id', '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', 'quote_id', 'quote_invoice_id');
if (!\Session::get('show_trash:invoice'))
{
@ -121,32 +121,40 @@ class InvoiceRepository
<ul class="dropdown-menu" role="menu">
<li><a href="' . \URL::to("{$entityType}s/".$model->public_id.'/edit') . '">'.trans("texts.edit_{$entityType}").'</a></li>
<li><a href="' . \URL::to("{$entityType}s/".$model->public_id.'/clone') . '">'.trans("texts.clone_{$entityType}").'</a></li>
<li class="divider"></li><li>';
if ($entityType == ENTITY_INVOICE)
{
$str .= '<a href="' . \URL::to('payments/create/' . $model->client_public_id . '/' . $model->public_id ) . '">'.trans('texts.enter_payment').'</a></li>';
<li class="divider"></li>';
if ($model->quote_id)
if ($model->invoice_status_id < INVOICE_STATUS_SENT)
{
$str .= '<li><a href="' . \URL::to("quotes/{$model->quote_id}/edit") . '">' . trans("texts.view_quote") . '</a></li>';
}
}
else if ($entityType == ENTITY_QUOTE)
{
if ($model->quote_invoice_id)
$str .= '<li><a href="javascript:markEntity(' . $model->public_id . ', ' . INVOICE_STATUS_SENT . ')">'.trans("texts.mark_sent").'</a></li>';
}
if ($entityType == ENTITY_INVOICE)
{
$str .= '<li><a href="' . \URL::to("invoices/{$model->quote_invoice_id}/edit") . '">' . trans("texts.view_invoice") . '</a></li>';
if ($model->invoice_status_id < INVOICE_STATUS_PAID)
{
$str .= '<li><a href="' . \URL::to('payments/create/' . $model->client_public_id . '/' . $model->public_id ) . '">'.trans('texts.enter_payment').'</a></li>';
}
if ($model->quote_id)
{
$str .= '<li><a href="' . \URL::to("quotes/{$model->quote_id}/edit") . '">' . trans("texts.view_quote") . '</a></li>';
}
}
}
return $str . '<li class="divider"></li>
<li><a href="javascript:archiveEntity(' . $model->public_id . ')">'.trans("texts.archive_{$entityType}").'</a></li>
<li><a href="javascript:deleteEntity(' . $model->public_id . ')">'.trans("texts.delete_{$entityType}").'</a></li>
</ul>
</div>';
})
->make();
else if ($entityType == ENTITY_QUOTE)
{
if ($model->quote_invoice_id)
{
$str .= '<li><a href="' . \URL::to("invoices/{$model->quote_invoice_id}/edit") . '">' . trans("texts.view_invoice") . '</a></li>';
}
}
return $str . '<li class="divider"></li>
<li><a href="javascript:archiveEntity(' . $model->public_id . ')">'.trans("texts.archive_{$entityType}").'</a></li>
<li><a href="javascript:deleteEntity(' . $model->public_id . ')">'.trans("texts.delete_{$entityType}").'</a></li>
</ul>
</div>';
})
->make();
}
@ -431,7 +439,7 @@ class InvoiceRepository
}
public function bulk($ids, $action)
public function bulk($ids, $action, $statusId = false)
{
if (!$ids)
{
@ -442,13 +450,21 @@ class InvoiceRepository
foreach ($invoices as $invoice)
{
if ($action == 'delete')
{
$invoice->is_deleted = true;
$invoice->save();
}
if ($action == 'mark')
{
$invoice->invoice_status_id = $statusId;
$invoice->save();
}
else
{
if ($action == 'delete')
{
$invoice->is_deleted = true;
$invoice->save();
}
$invoice->delete();
$invoice->delete();
}
}
return count($invoices);

View File

@ -8,8 +8,15 @@
<style type="text/css">
body {
/* background-color: #F6F6F6; */
background-color: #EEEEEE;
padding-top: 114px;
}
/* Fix for header covering stuff when the screen is narrower */
@media screen and (min-width: 1200px) {
body {
padding-top: 50px;
}
}
</style>
@ -35,8 +42,6 @@
@section('body')
<p>&nbsp;</p>
<p>&nbsp;</p>
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">

View File

@ -5,6 +5,7 @@
{{ Former::open($entityType . 's/bulk')->addClass('listForm') }}
<div style="display:none">
{{ Former::text('action') }}
{{ Former::text('statusId') }}
{{ Former::text('id') }}
</div>
@ -67,6 +68,12 @@
submitForm('archive');
}
function markEntity(id, statusId) {
$('#id').val(id);
$('#statusId').val(statusId);
submitForm('mark');
}
function setTrashVisible() {
var checked = $('#trashed').is(':checked');
window.location = '{{ URL::to('view_archive/' . $entityType) }}' + (checked ? '/true' : '/false');

View File

@ -93,8 +93,8 @@
paid: d3.sum(d, function(g) {
return g.invoice && g.invoice.invoice_status_id == 5 ? (g.qty * g.cost) : 0;
}),
age: d3.median(d, function(g) {
return calculateInvoiceAge(g.invoice) || null;
age: d3.mean(d, function(g) {
return calculateInvoiceAge(g.invoice) || null;
}),
}})
.entries(products);
@ -168,8 +168,8 @@
.padding(12);
var svg = d3.select(".svg-div").append("svg")
.attr("width", "100%")
.attr("height", "1140px")
.attr("width", "1142px")
.attr("height", "1142px")
.attr("class", "bubble");
svg.append("rect")