mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 02:57:33 -05:00 
			
		
		
		
	Clarified partial labels
This commit is contained in:
		
							parent
							
								
									9b9e99ee78
								
							
						
					
					
						commit
						c3c7f25b32
					
				@ -760,7 +760,7 @@ class AccountController extends BaseController
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $labels = [];
 | 
			
		||||
            foreach (['item', 'description', 'unit_cost', 'quantity', 'line_total', 'terms'] as $field) {
 | 
			
		||||
            foreach (['item', 'description', 'unit_cost', 'quantity', 'line_total', 'terms', 'balance_due', 'partial_due'] as $field) {
 | 
			
		||||
                $labels[$field] = Input::get("labels_{$field}");
 | 
			
		||||
            }
 | 
			
		||||
            $account->invoice_labels = json_encode($labels);
 | 
			
		||||
 | 
			
		||||
@ -683,7 +683,7 @@ class Account extends Eloquent
 | 
			
		||||
            'subtotal',
 | 
			
		||||
            'paid_to_date',
 | 
			
		||||
            'balance_due',
 | 
			
		||||
            'amount_due',
 | 
			
		||||
            'partial_due',
 | 
			
		||||
            'terms',
 | 
			
		||||
            'your_invoice',
 | 
			
		||||
            'quote',
 | 
			
		||||
 | 
			
		||||
@ -19,7 +19,7 @@ class InvoicePresenter extends Presenter {
 | 
			
		||||
    public function balanceDueLabel()
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->entity->partial) {
 | 
			
		||||
            return 'amount_due';
 | 
			
		||||
            return 'partial_due';
 | 
			
		||||
        } elseif ($this->entity->is_quote) {
 | 
			
		||||
            return 'total';
 | 
			
		||||
        } else {
 | 
			
		||||
 | 
			
		||||
@ -31183,7 +31183,7 @@ NINJA.decodeJavascript = function(invoice, javascript)
 | 
			
		||||
            var value = getDescendantProp(invoice, field);
 | 
			
		||||
            if (match.indexOf('?') < 0 || value) {
 | 
			
		||||
                if (invoice.partial && field == 'balance_due') {
 | 
			
		||||
                    field = 'amount_due';
 | 
			
		||||
                    field = 'partial_due';
 | 
			
		||||
                } else if (invoice.is_quote) {
 | 
			
		||||
                    field = field.replace('invoice', 'quote');
 | 
			
		||||
                }
 | 
			
		||||
@ -31440,21 +31440,31 @@ NINJA.subtotals = function(invoice, hideBalance)
 | 
			
		||||
        data.push([{text:invoiceLabels.paid_to_date}, {text:formatMoneyInvoice(paid, invoice)}]);        
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!hideBalance) {
 | 
			
		||||
    var isPartial = NINJA.parseFloat(invoice.partial);
 | 
			
		||||
        
 | 
			
		||||
    if (!hideBalance || isPartial) {
 | 
			
		||||
        data.push([
 | 
			
		||||
            {text: isPartial ? invoiceLabels.amount_due : invoiceLabels.balance_due, style:['balanceDueLabel']},
 | 
			
		||||
            {text: formatMoneyInvoice(invoice.balance_amount, invoice), style:['balanceDue']}
 | 
			
		||||
            { text: invoiceLabels.balance_due, style: [isPartial ? '' : 'balanceDueLabel'] },
 | 
			
		||||
            { text: formatMoneyInvoice(invoice.total_amount, invoice), style: [isPartial ? '' : 'balanceDue'] }
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    if (!hideBalance) {
 | 
			
		||||
        if (isPartial) {
 | 
			
		||||
            data.push([
 | 
			
		||||
                { text: invoiceLabels.partial_due, style: ['balanceDueLabel'] },
 | 
			
		||||
                { text: formatMoneyInvoice(invoice.balance_amount, invoice), style: ['balanceDue'] }
 | 
			
		||||
            ]);
 | 
			
		||||
        }
 | 
			
		||||
    }        
 | 
			
		||||
 | 
			
		||||
    return NINJA.prepareDataPairs(data, 'subtotals');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
NINJA.subtotalsBalance = function(invoice) {
 | 
			
		||||
    var isPartial = NINJA.parseFloat(invoice.partial);
 | 
			
		||||
    return [[
 | 
			
		||||
        {text: isPartial ? invoiceLabels.amount_due : invoiceLabels.balance_due, style:['balanceDueLabel']},
 | 
			
		||||
        {text: isPartial ? invoiceLabels.partial_due : invoiceLabels.balance_due, style:['balanceDueLabel']},
 | 
			
		||||
        {text: formatMoneyInvoice(invoice.balance_amount, invoice), style:['balanceDue']}
 | 
			
		||||
    ]];
 | 
			
		||||
}
 | 
			
		||||
@ -31532,18 +31542,18 @@ NINJA.invoiceDetails = function(invoice) {
 | 
			
		||||
    
 | 
			
		||||
    if (NINJA.parseFloat(invoice.balance) < NINJA.parseFloat(invoice.amount)) {
 | 
			
		||||
        data.push([
 | 
			
		||||
            {text: invoiceLabels.total},
 | 
			
		||||
            {text: invoiceLabels.balance_due},
 | 
			
		||||
            {text: formatMoneyInvoice(invoice.amount, invoice)}
 | 
			
		||||
        ]);
 | 
			
		||||
    } else if (isPartial) {
 | 
			
		||||
        data.push([
 | 
			
		||||
            {text: invoiceLabels.total},
 | 
			
		||||
            {text: invoiceLabels.balance_due},
 | 
			
		||||
            {text: formatMoneyInvoice(invoice.total_amount, invoice)}
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    data.push([
 | 
			
		||||
        {text: isPartial ? invoiceLabels.amount_due : invoiceLabels.balance_due, style: ['invoiceDetailBalanceDueLabel']},
 | 
			
		||||
        {text: isPartial ? invoiceLabels.partial_due : invoiceLabels.balance_due, style: ['invoiceDetailBalanceDueLabel']},
 | 
			
		||||
        {text: formatMoneyInvoice(invoice.balance_amount, invoice), style: ['invoiceDetailBalanceDue']}
 | 
			
		||||
    ])
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -190,7 +190,7 @@ NINJA.decodeJavascript = function(invoice, javascript)
 | 
			
		||||
            var value = getDescendantProp(invoice, field);
 | 
			
		||||
            if (match.indexOf('?') < 0 || value) {
 | 
			
		||||
                if (invoice.partial && field == 'balance_due') {
 | 
			
		||||
                    field = 'amount_due';
 | 
			
		||||
                    field = 'partial_due';
 | 
			
		||||
                } else if (invoice.is_quote) {
 | 
			
		||||
                    field = field.replace('invoice', 'quote');
 | 
			
		||||
                }
 | 
			
		||||
@ -447,21 +447,31 @@ NINJA.subtotals = function(invoice, hideBalance)
 | 
			
		||||
        data.push([{text:invoiceLabels.paid_to_date}, {text:formatMoneyInvoice(paid, invoice)}]);        
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!hideBalance) {
 | 
			
		||||
    var isPartial = NINJA.parseFloat(invoice.partial);
 | 
			
		||||
        
 | 
			
		||||
    if (!hideBalance || isPartial) {
 | 
			
		||||
        data.push([
 | 
			
		||||
            {text: isPartial ? invoiceLabels.amount_due : invoiceLabels.balance_due, style:['balanceDueLabel']},
 | 
			
		||||
            {text: formatMoneyInvoice(invoice.balance_amount, invoice), style:['balanceDue']}
 | 
			
		||||
            { text: invoiceLabels.balance_due, style: [isPartial ? '' : 'balanceDueLabel'] },
 | 
			
		||||
            { text: formatMoneyInvoice(invoice.total_amount, invoice), style: [isPartial ? '' : 'balanceDue'] }
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    if (!hideBalance) {
 | 
			
		||||
        if (isPartial) {
 | 
			
		||||
            data.push([
 | 
			
		||||
                { text: invoiceLabels.partial_due, style: ['balanceDueLabel'] },
 | 
			
		||||
                { text: formatMoneyInvoice(invoice.balance_amount, invoice), style: ['balanceDue'] }
 | 
			
		||||
            ]);
 | 
			
		||||
        }
 | 
			
		||||
    }        
 | 
			
		||||
 | 
			
		||||
    return NINJA.prepareDataPairs(data, 'subtotals');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
NINJA.subtotalsBalance = function(invoice) {
 | 
			
		||||
    var isPartial = NINJA.parseFloat(invoice.partial);
 | 
			
		||||
    return [[
 | 
			
		||||
        {text: isPartial ? invoiceLabels.amount_due : invoiceLabels.balance_due, style:['balanceDueLabel']},
 | 
			
		||||
        {text: isPartial ? invoiceLabels.partial_due : invoiceLabels.balance_due, style:['balanceDueLabel']},
 | 
			
		||||
        {text: formatMoneyInvoice(invoice.balance_amount, invoice), style:['balanceDue']}
 | 
			
		||||
    ]];
 | 
			
		||||
}
 | 
			
		||||
@ -539,18 +549,18 @@ NINJA.invoiceDetails = function(invoice) {
 | 
			
		||||
    
 | 
			
		||||
    if (NINJA.parseFloat(invoice.balance) < NINJA.parseFloat(invoice.amount)) {
 | 
			
		||||
        data.push([
 | 
			
		||||
            {text: invoiceLabels.total},
 | 
			
		||||
            {text: invoiceLabels.balance_due},
 | 
			
		||||
            {text: formatMoneyInvoice(invoice.amount, invoice)}
 | 
			
		||||
        ]);
 | 
			
		||||
    } else if (isPartial) {
 | 
			
		||||
        data.push([
 | 
			
		||||
            {text: invoiceLabels.total},
 | 
			
		||||
            {text: invoiceLabels.balance_due},
 | 
			
		||||
            {text: formatMoneyInvoice(invoice.total_amount, invoice)}
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    data.push([
 | 
			
		||||
        {text: isPartial ? invoiceLabels.amount_due : invoiceLabels.balance_due, style: ['invoiceDetailBalanceDueLabel']},
 | 
			
		||||
        {text: isPartial ? invoiceLabels.partial_due : invoiceLabels.balance_due, style: ['invoiceDetailBalanceDueLabel']},
 | 
			
		||||
        {text: formatMoneyInvoice(invoice.balance_amount, invoice), style: ['invoiceDetailBalanceDue']}
 | 
			
		||||
    ])
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1074,6 +1074,7 @@ $LANG = array(
 | 
			
		||||
    'user_edit_all' => 'Edit all clients, invoices, etc.',
 | 
			
		||||
    'gateway_help_20' => ':link to sign up for Sage Pay.',
 | 
			
		||||
    'gateway_help_21' => ':link to sign up for Sage Pay.',
 | 
			
		||||
    'partial_due' => 'Partial Due',
 | 
			
		||||
    
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -60,7 +60,16 @@
 | 
			
		||||
      @else
 | 
			
		||||
        NINJA.headerFont = NINJA.bodyFont = 'Roboto';
 | 
			
		||||
      @endif
 | 
			
		||||
      var fields = ['item', 'description', 'unit_cost', 'quantity', 'line_total', 'terms'];
 | 
			
		||||
      var fields = [
 | 
			
		||||
          'item', 
 | 
			
		||||
          'description', 
 | 
			
		||||
          'unit_cost', 
 | 
			
		||||
          'quantity', 
 | 
			
		||||
          'line_total', 
 | 
			
		||||
          'terms', 
 | 
			
		||||
          'balance_due', 
 | 
			
		||||
          'partial_due'
 | 
			
		||||
      ];
 | 
			
		||||
      invoiceLabels.old = {};
 | 
			
		||||
      for (var i=0; i<fields.length; i++) {
 | 
			
		||||
        var field = fields[i];
 | 
			
		||||
@ -181,11 +190,13 @@
 | 
			
		||||
                              {!! Former::text('labels_item')->label(trans('texts.item')) !!}
 | 
			
		||||
                              {!! Former::text('labels_description')->label(trans('texts.description')) !!}
 | 
			
		||||
                              {!! Former::text('labels_unit_cost')->label(trans('texts.unit_cost')) !!}
 | 
			
		||||
                              {!! Former::text('labels_quantity')->label(trans('texts.quantity')) !!}
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="col-md-6">
 | 
			
		||||
                              {!! Former::text('labels_quantity')->label(trans('texts.quantity')) !!}
 | 
			
		||||
                              {!! Former::text('labels_line_total')->label(trans('texts.line_total')) !!}
 | 
			
		||||
                              {!! Former::text('labels_terms')->label(trans('texts.terms')) !!}
 | 
			
		||||
                              {!! Former::text('labels_balance_due')->label(trans('texts.balance_due')) !!}
 | 
			
		||||
                              {!! Former::text('labels_partial_due')->label(trans('texts.partial_due')) !!}
 | 
			
		||||
                        </div>
 | 
			
		||||
                      </div>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -385,11 +385,18 @@
 | 
			
		||||
				</tr>
 | 
			
		||||
			@endif
 | 
			
		||||
 | 
			
		||||
			<tr style="font-size:1.05em">
 | 
			
		||||
			<tr data-bind="style: { 'font-weight': partial() ? 'normal' : 'bold', 'font-size': partial() ? '1em' : '1.05em' }">
 | 
			
		||||
				<td class="hide-border" colspan="3"/>
 | 
			
		||||
				<td class="hide-border" style="display:none" data-bind="visible: $root.invoice_item_taxes.show"/>
 | 
			
		||||
				<td class="hide-border" colspan="{{ $account->hide_quantity ? 1 : 2 }}"><b>{{ trans($entityType == ENTITY_INVOICE ? 'texts.balance_due' : 'texts.total') }}</b></td>
 | 
			
		||||
				<td class="hide-border" style="text-align: right"><span data-bind="text: totals.total"></span></td>
 | 
			
		||||
				<td class="hide-border" data-bind="css: {'hide-border': !partial()}" colspan="{{ $account->hide_quantity ? 1 : 2 }}">{{ $entityType == ENTITY_INVOICE ? $invoiceLabels['balance_due'] : trans('texts.total') }}</td>
 | 
			
		||||
				<td class="hide-border" data-bind="css: {'hide-border': !partial()}" style="text-align: right"><span data-bind="text: totals.total"></span></td>
 | 
			
		||||
			</tr>
 | 
			
		||||
 | 
			
		||||
			<tr style="font-size:1.05em; display:none; font-weight:bold" data-bind="visible: partial">
 | 
			
		||||
				<td class="hide-border" colspan="3"/>
 | 
			
		||||
				<td class="hide-border" style="display:none" data-bind="visible: $root.invoice_item_taxes.show"/>
 | 
			
		||||
				<td class="hide-border" colspan="{{ $account->hide_quantity ? 1 : 2 }}">{{ $invoiceLabels['partial_due'] }}</td>
 | 
			
		||||
				<td class="hide-border" style="text-align: right"><span data-bind="text: totals.partial"></span></td>
 | 
			
		||||
			</tr>
 | 
			
		||||
 | 
			
		||||
		</tfoot>
 | 
			
		||||
 | 
			
		||||
@ -512,7 +512,11 @@ function InvoiceModel(data) {
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    self.totals.total = ko.computed(function() {
 | 
			
		||||
        return self.formatMoney(self.partial() ? self.partial() : self.totals.rawTotal());
 | 
			
		||||
        return self.formatMoney(self.totals.rawTotal());
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    self.totals.partial = ko.computed(function() {
 | 
			
		||||
        return self.formatMoney(self.partial());
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    self.onDragged = function(item) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user