mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 12:11:08 -04:00
Fix PDF issues
This commit is contained in:
@ -41,10 +41,18 @@ function clean_slug($string)
|
|||||||
* @param $money
|
* @param $money
|
||||||
* @return formated_money
|
* @return formated_money
|
||||||
*/
|
*/
|
||||||
function format_money_pdf($money)
|
function format_money_pdf($money, $getCurrency = null)
|
||||||
{
|
{
|
||||||
$money = $money / 100;
|
$money = $money / 100;
|
||||||
|
|
||||||
|
$currency = null;
|
||||||
|
|
||||||
|
if ($getCurrency == null) {
|
||||||
$currency = Currency::findOrFail(CompanySetting::getSetting('currency', 1));
|
$currency = Currency::findOrFail(CompanySetting::getSetting('currency', 1));
|
||||||
|
} else {
|
||||||
|
$currency = $getCurrency;
|
||||||
|
}
|
||||||
|
|
||||||
$format_money = number_format(
|
$format_money = number_format(
|
||||||
$money,
|
$money,
|
||||||
$currency->precision,
|
$currency->precision,
|
||||||
|
|||||||
@ -55,6 +55,7 @@
|
|||||||
v-model="currency"
|
v-model="currency"
|
||||||
:options="currencies"
|
:options="currencies"
|
||||||
:searchable="true"
|
:searchable="true"
|
||||||
|
:allow-empty="false"
|
||||||
:show-labels="false"
|
:show-labels="false"
|
||||||
:placeholder="$t('customers.select_currency')"
|
:placeholder="$t('customers.select_currency')"
|
||||||
label="name"
|
label="name"
|
||||||
|
|||||||
@ -47,7 +47,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="no-borde" style="color: #55547A; padding-left:10px; font-size:12px;">Subtotal</td>
|
<td class="no-borde" style="color: #55547A; padding-left:10px; font-size:12px;">Subtotal</td>
|
||||||
<td class="no-border items"
|
<td class="no-border items"
|
||||||
style="padding-right:10px; text-align: right; font-size:12px; color: #040405; font-weight: 500;">{!! format_money_pdf($estimate->sub_total) !!}</td>
|
style="padding-right:10px; text-align: right; font-size:12px; color: #040405; font-weight: 500;">{!! format_money_pdf($estimate->sub_total, $estimate->user->currency) !!}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@if ($estimate->tax_per_item === 'YES')
|
@if ($estimate->tax_per_item === 'YES')
|
||||||
@ -57,7 +57,7 @@
|
|||||||
{{$labels[$i]}}
|
{{$labels[$i]}}
|
||||||
</td>
|
</td>
|
||||||
<td class="no-border items padd2" style="padding-right:10px; font-weight: 500; text-align: right; font-size:12px; color: #040405">
|
<td class="no-border items padd2" style="padding-right:10px; font-weight: 500; text-align: right; font-size:12px; color: #040405">
|
||||||
{!! format_money_pdf($taxes[$i]) !!}
|
{!! format_money_pdf($taxes[$i], $estimate->user->currency) !!}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endfor
|
@endfor
|
||||||
@ -68,7 +68,7 @@
|
|||||||
{{$tax->name.' ('.$tax->percent.'%)'}}
|
{{$tax->name.' ('.$tax->percent.'%)'}}
|
||||||
</td>
|
</td>
|
||||||
<td class="no-border items padd2" style="padding-right:10px; font-weight: 500; text-align: right; font-size:12px; color: #040405">
|
<td class="no-border items padd2" style="padding-right:10px; font-weight: 500; text-align: right; font-size:12px; color: #040405">
|
||||||
{!! format_money_pdf($tax->amount) !!}
|
{!! format_money_pdf($tax->amount, $estimate->user->currency) !!}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
@ -77,14 +77,19 @@
|
|||||||
@if ($estimate->discount_per_item === 'NO')
|
@if ($estimate->discount_per_item === 'NO')
|
||||||
<tr>
|
<tr>
|
||||||
<td class="no-border" style="padding-left:10px; text-align:left; font-size:12px; color: #55547A;">
|
<td class="no-border" style="padding-left:10px; text-align:left; font-size:12px; color: #55547A;">
|
||||||
|
@if($estimate->discount_type === 'fixed')
|
||||||
|
Discount
|
||||||
|
@endif
|
||||||
|
@if($estimate->discount_type === 'percentage')
|
||||||
Discount ({{$estimate->discount}}%)
|
Discount ({{$estimate->discount}}%)
|
||||||
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td class="no-border items padd2" style="padding-right:10px; font-weight: 500; text-align: right; font-size:12px; color: #040405">
|
<td class="no-border items padd2" style="padding-right:10px; font-weight: 500; text-align: right; font-size:12px; color: #040405">
|
||||||
@if($estimate->discount_type === 'fixed')
|
@if($estimate->discount_type === 'fixed')
|
||||||
{!! format_money_pdf($estimate->discount_val) !!}
|
{!! format_money_pdf($estimate->discount_val, $estimate->user->currency) !!}
|
||||||
@endif
|
@endif
|
||||||
@if($estimate->discount_type === 'percentage')
|
@if($estimate->discount_type === 'percentage')
|
||||||
{!! format_money_pdf($estimate->discount_val) !!}
|
{!! format_money_pdf($estimate->discount_val, $estimate->user->currency) !!}
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -103,7 +108,7 @@
|
|||||||
class="no-border total-border-right items padd8"
|
class="no-border total-border-right items padd8"
|
||||||
style="padding-right:10px; font-weight: 500; text-align: right; font-size:12px; padding-top:20px; color: #5851DB"
|
style="padding-right:10px; font-weight: 500; text-align: right; font-size:12px; padding-top:20px; color: #5851DB"
|
||||||
>
|
>
|
||||||
{!! format_money_pdf($estimate->total)!!}
|
{!! format_money_pdf($estimate->total, $estimate->user->currency)!!}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@ -47,7 +47,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="no-borde" style="color: #55547A; padding-left:10px; font-size:12px;">Subtotal</td>
|
<td class="no-borde" style="color: #55547A; padding-left:10px; font-size:12px;">Subtotal</td>
|
||||||
<td class="no-border items"
|
<td class="no-border items"
|
||||||
style="padding-right:10px; text-align: right; font-size:12px; color: #040405; font-weight: 500;">{!! format_money_pdf($invoice->sub_total) !!}</td>
|
style="padding-right:10px; text-align: right; font-size:12px; color: #040405; font-weight: 500;">{!! format_money_pdf($invoice->sub_total, $invoice->user->currency) !!}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@if ($invoice->tax_per_item === 'YES')
|
@if ($invoice->tax_per_item === 'YES')
|
||||||
@ -57,7 +57,7 @@
|
|||||||
{{$labels[$i]}}
|
{{$labels[$i]}}
|
||||||
</td>
|
</td>
|
||||||
<td class="no-border items padd2" style="padding-right:10px; font-weight: 500; text-align: right; font-size:12px; color: #040405">
|
<td class="no-border items padd2" style="padding-right:10px; font-weight: 500; text-align: right; font-size:12px; color: #040405">
|
||||||
{!! format_money_pdf($taxes[$i]) !!}
|
{!! format_money_pdf($taxes[$i], $invoice->user->currency) !!}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endfor
|
@endfor
|
||||||
@ -68,7 +68,7 @@
|
|||||||
{{$tax->name.' ('.$tax->percent.'%)'}}
|
{{$tax->name.' ('.$tax->percent.'%)'}}
|
||||||
</td>
|
</td>
|
||||||
<td class="no-border items padd2" style="padding-right:10px; font-weight: 500; text-align: right; font-size:12px; color: #040405">
|
<td class="no-border items padd2" style="padding-right:10px; font-weight: 500; text-align: right; font-size:12px; color: #040405">
|
||||||
{!! format_money_pdf($tax->amount) !!}
|
{!! format_money_pdf($tax->amount, $invoice->user->currency) !!}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
@ -77,14 +77,19 @@
|
|||||||
@if ($invoice->discount_per_item === 'NO')
|
@if ($invoice->discount_per_item === 'NO')
|
||||||
<tr>
|
<tr>
|
||||||
<td class="no-border" style="padding-left:10px; text-align:left; font-size:12px; color: #55547A;">
|
<td class="no-border" style="padding-left:10px; text-align:left; font-size:12px; color: #55547A;">
|
||||||
|
@if($invoice->discount_type === 'fixed')
|
||||||
|
Discount
|
||||||
|
@endif
|
||||||
|
@if($invoice->discount_type === 'percentage')
|
||||||
Discount ({{$invoice->discount}}%)
|
Discount ({{$invoice->discount}}%)
|
||||||
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td class="no-border items padd2" style="padding-right:10px; font-weight: 500; text-align: right; font-size:12px; color: #040405">
|
<td class="no-border items padd2" style="padding-right:10px; font-weight: 500; text-align: right; font-size:12px; color: #040405">
|
||||||
@if($invoice->discount_type === 'fixed')
|
@if($invoice->discount_type === 'fixed')
|
||||||
{!! format_money_pdf($invoice->discount_val) !!}
|
{!! format_money_pdf($invoice->discount_val, $invoice->user->currency) !!}
|
||||||
@endif
|
@endif
|
||||||
@if($invoice->discount_type === 'percentage')
|
@if($invoice->discount_type === 'percentage')
|
||||||
{!! format_money_pdf($invoice->discount_val) !!}
|
{!! format_money_pdf($invoice->discount_val, $invoice->user->currency) !!}
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -103,7 +108,7 @@
|
|||||||
class="no-border total-border-right items padd8"
|
class="no-border total-border-right items padd8"
|
||||||
style="padding-right:10px; font-weight: 500; text-align: right; font-size:12px; padding-top:20px; color: #5851DB"
|
style="padding-right:10px; font-weight: 500; text-align: right; font-size:12px; padding-top:20px; color: #5851DB"
|
||||||
>
|
>
|
||||||
{!! format_money_pdf($invoice->total)!!}
|
{!! format_money_pdf($invoice->total, $invoice->user->currency)!!}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user