|
250 | 250 | </tbody> |
251 | 251 | </table> |
252 | 252 |
|
| 253 | + @php |
| 254 | + $hasTaxes = $invoice->tax_label || $invoice->totalTaxAmount()->isPositive(); |
| 255 | + @endphp |
| 256 | + |
253 | 257 | <table class="mb-5 w-full"> |
254 | 258 | <thead> |
255 | 259 | <tr class="text-gray-500"> |
|
262 | 266 | <th class="whitespace-nowrap border-b p-2 text-left text-xs font-normal"> |
263 | 267 | {{ __('invoices::invoice.unit_price') }} |
264 | 268 | </th> |
265 | | - <th class="whitespace-nowrap border-b p-2 text-left text-xs font-normal"> |
266 | | - {{ __('invoices::invoice.tax') }} |
267 | | - </th> |
| 269 | + |
| 270 | + @if ($hasTaxes) |
| 271 | + <th class="whitespace-nowrap border-b p-2 text-left text-xs font-normal"> |
| 272 | + {{ __('invoices::invoice.tax') }} |
| 273 | + </th> |
| 274 | + @else |
| 275 | + <th class="p-0"></th> |
| 276 | + @endif |
| 277 | + |
268 | 278 | <th class="whitespace-nowrap border-b py-2 pl-2 text-right text-xs font-normal"> |
269 | 279 | {{ __('invoices::invoice.amount') }} |
270 | 280 | </th> |
|
285 | 295 | <td class="whitespace-nowrap border-b p-2 align-top text-xs"> |
286 | 296 | <p>{{ $item->formatMoney($item->unit_price) }}</p> |
287 | 297 | </td> |
288 | | - <td class="whitespace-nowrap border-b p-2 align-top text-xs"> |
289 | | - @if ($item->unit_tax && $item->tax_percentage) |
290 | | - <p>{{ $item->formatMoney($item->unit_tax) }} |
291 | | - ({{ $item->formatPercentage($item->tax_percentage) }}) |
292 | | - </p> |
293 | | - @elseif ($item->unit_tax) |
294 | | - <p>{{ $item->formatMoney($item->unit_tax) }}</p> |
295 | | - @else |
296 | | - <p>{{ $item->formatPercentage($item->tax_percentage) }}</p> |
297 | | - @endif |
298 | | - </td> |
| 298 | + |
| 299 | + @if ($hasTaxes) |
| 300 | + <td class="whitespace-nowrap border-b p-2 align-top text-xs"> |
| 301 | + @if ($item->unit_tax !== null && $item->tax_percentage !== null) |
| 302 | + <p> |
| 303 | + {{ $item->formatMoney($item->unit_tax) }} |
| 304 | + ({{ $item->formatPercentage($item->tax_percentage) }}) |
| 305 | + </p> |
| 306 | + @elseif ($item->unit_tax !== null) |
| 307 | + <p>{{ $item->formatMoney($item->unit_tax) }}</p> |
| 308 | + @elseif($item->tax_percentage !== null) |
| 309 | + <p>{{ $item->formatPercentage($item->tax_percentage) }}</p> |
| 310 | + @else |
| 311 | + <p>-</p> |
| 312 | + @endif |
| 313 | + </td> |
| 314 | + @else |
| 315 | + <td class="p-0"></td> |
| 316 | + @endif |
| 317 | + |
299 | 318 | <td class="whitespace-nowrap border-b py-2 pl-2 text-right align-top text-xs"> |
300 | 319 | <p>{{ $item->formatMoney($item->totalAmount()) }}</p> |
301 | 320 | </td> |
|
311 | 330 | {{ $invoice->formatMoney($invoice->subTotalAmount()) }} |
312 | 331 | </td> |
313 | 332 | </tr> |
314 | | - @if ($invoice->discounts) |
315 | | - @foreach ($invoice->discounts as $discount) |
316 | | - <tr> |
317 | | - {{-- empty space --}} |
318 | | - <td class="py-2 pr-2"></td> |
319 | | - <td class="border-b p-2 text-xs" colspan="3"> |
320 | | - {{ __($discount->name) ?? __('invoices::invoice.discount_name') }} |
321 | | - @if ($discount->percent_off) |
322 | | - ({{ $discount->formatPercentage($discount->percent_off) }}) |
323 | | - @endif |
324 | | - </td> |
325 | | - <td class="whitespace-nowrap border-b py-2 pl-2 text-right text-xs"> |
326 | | - {{ $invoice->formatMoney($discount->computeDiscountAmountOn($invoice->subTotalAmount())?->multipliedBy(-1)) }} |
327 | | - </td> |
328 | | - </tr> |
329 | | - @endforeach |
330 | | - @endif |
331 | 333 |
|
332 | | - <tr> |
333 | | - {{-- empty space --}} |
334 | | - <td class="py-2 pr-2"></td> |
335 | | - <td class="border-b p-2 text-xs" colspan="3"> |
336 | | - {{ $invoice->tax_label ?? __('invoices::invoice.tax_label') }} |
337 | | - </td> |
338 | | - <td class="whitespace-nowrap border-b py-2 pl-2 text-right text-xs"> |
339 | | - {{ $invoice->formatMoney($invoice->totalTaxAmount()) }} |
340 | | - </td> |
341 | | - </tr> |
| 334 | + @foreach ($invoice->discounts as $discount) |
| 335 | + <tr> |
| 336 | + {{-- empty space --}} |
| 337 | + <td class="py-2 pr-2"></td> |
| 338 | + <td class="border-b p-2 text-xs" colspan="3"> |
| 339 | + {{ __($discount->name) ?? __('invoices::invoice.discount_name') }} |
| 340 | + @if ($discount->percent_off) |
| 341 | + ({{ $discount->formatPercentage($discount->percent_off) }}) |
| 342 | + @endif |
| 343 | + </td> |
| 344 | + <td class="whitespace-nowrap border-b py-2 pl-2 text-right text-xs"> |
| 345 | + {{ $invoice->formatMoney($discount->computeDiscountAmountOn($invoice->subTotalAmount())?->multipliedBy(-1)) }} |
| 346 | + </td> |
| 347 | + </tr> |
| 348 | + @endforeach |
| 349 | + |
| 350 | + @if ($hasTaxes) |
| 351 | + <tr> |
| 352 | + {{-- empty space --}} |
| 353 | + <td class="py-2 pr-2"></td> |
| 354 | + <td class="border-b p-2 text-xs" colspan="3"> |
| 355 | + {{ $invoice->tax_label ?? __('invoices::invoice.tax_label') }} |
| 356 | + </td> |
| 357 | + <td class="whitespace-nowrap border-b py-2 pl-2 text-right text-xs"> |
| 358 | + {{ $invoice->formatMoney($invoice->totalTaxAmount()) }} |
| 359 | + </td> |
| 360 | + </tr> |
| 361 | + @endif |
342 | 362 |
|
343 | 363 | <tr> |
344 | 364 | {{-- empty space --}} |
|
0 commit comments