|
11 | 11 | margin: 0; |
12 | 12 | padding: 0; |
13 | 13 | } |
14 | | - .tex-center{ |
15 | | - text-align: center; |
| 14 | + .text-right{ |
| 15 | + text-align: right; |
16 | 16 | } |
17 | 17 | table { |
18 | 18 | width: 100%; |
|
39 | 39 | .pt-0{ |
40 | 40 | padding-top: 0; |
41 | 41 | } |
| 42 | + .pb-0{ |
| 43 | + padding-bottom: 0; |
| 44 | + } |
42 | 45 | .font-bold{ |
43 | 46 | font-weight: bold; |
44 | 47 | } |
|
59 | 62 | font-size: 10px; |
60 | 63 | margin-top: 10mm; |
61 | 64 | } |
| 65 | + .text-center{ |
| 66 | + text-align: center |
| 67 | + } |
62 | 68 | .border-b-d{ |
63 | 69 | border-bottom: 1px dashed #999; |
64 | 70 | } |
|
77 | 83 | font-family: 'Courier New', Courier, monospace; |
78 | 84 | font-size: 12px; |
79 | 85 | } |
| 86 | + .mt-0{ |
| 87 | + margin-top: 0; |
| 88 | + } |
80 | 89 | </style> |
81 | 90 | </head> |
82 | 91 | <body> |
|
105 | 114 | </tr> |
106 | 115 | </thead> |
107 | 116 | <tbody> |
108 | | - @php $i = 0; @endphp |
| 117 | + @php |
| 118 | + $i = 0; |
| 119 | + $total_price = 0; |
| 120 | + $total_tax = []; |
| 121 | + $grand_total = 0; |
| 122 | + @endphp |
109 | 123 | @foreach($items as $item) |
110 | 124 | @php $i++; @endphp |
111 | 125 | <tr> |
|
115 | 129 | <td class="pt-0">VAT {{(int)$item['tax']}}%</td> |
116 | 130 | <td class="tex-center pt-0">{{ number_format($item['price'], 2, '.', '') }}</td> |
117 | 131 | <td class="tex-center pt-0">{{ $item['quantity'] }}</td> |
118 | | - <td class="tex-center pt-0">{{ number_format( ($item['price'] * $item['quantity']), 2, '.', '') }}</td> |
| 132 | + @php |
| 133 | + $tax = $item['tax']; |
| 134 | + $item_total = $item->price * $item->quantity; |
| 135 | + $tax_amount = ($item_total * $tax) / 100; |
| 136 | + $item_total_with_tax = $item_total + $tax_amount; |
| 137 | + $total_price += $item_total; |
| 138 | + $total_tax[$tax] = ($total_tax[$tax] ?? 0) + $tax_amount; |
| 139 | + $grand_total += $item_total_with_tax; |
| 140 | + @endphp |
| 141 | + <td class="tex-center pt-0">{{ number_format( $item_total_with_tax , 2, '.', '') }}</td> |
119 | 142 | </tr> |
120 | 143 | <tr> |
121 | 144 | <td class="border-b-d" colspan="4" style="height: 0; padding:0;"></td> |
122 | 145 | </tr> |
123 | 146 | @endforeach |
| 147 | + |
124 | 148 | <tr> |
125 | | - <td colspan="3" style="font-size:16px"> |
| 149 | + <td class="text-center " colspan="4" style="padding-top:3mm; padding-bottom:0; font-size:16px"> |
| 150 | + INVOICE SUMMARY |
| 151 | + </td> |
| 152 | + </tr> |
| 153 | + |
| 154 | + <tr> |
| 155 | + <td class="mt-2" colspan="3" style="font-size:16px;"> |
126 | 156 | Total |
127 | 157 | </td> |
128 | | - <td style="text-align: center; font-size:16px"> |
| 158 | + <td class="pt-0" style="text-align: right; font-size:16px"> |
129 | 159 | {{$currency_symbol}}{{$order->total_price}} |
130 | 160 | </td> |
131 | 161 | </tr> |
| 162 | + |
| 163 | + @foreach ($total_tax as $rate => $amount) |
| 164 | + <tr> |
| 165 | + <td colspan="3" style="font-size:16px; padding-top:0; padding-bottom:0"> |
| 166 | + VAT/GST @ {{ $rate }}% |
| 167 | + </td> |
| 168 | + <td class="pt-0 pb-0" class="text-right" style=" padding-top:0; padding-bottom:0; font-size:16px"> |
| 169 | + {{$rate}} |
| 170 | + </td> |
| 171 | + </tr> |
| 172 | + @endforeach |
| 173 | + <tr> |
| 174 | + <td class="border-b-d" colspan="4" style="height: 0; padding:0; padding-top:2mm"></td> |
| 175 | + </tr> |
| 176 | + <tr> |
| 177 | + <td colspan="3" style="font-size:16px"> |
| 178 | + Grand Total |
| 179 | + </td> |
| 180 | + <td class="text-right" style=" font-size:16px"> |
| 181 | + {{ $currency_symbol }}{{ number_format($grand_total, 2) }} |
| 182 | + </td> |
| 183 | + <tr> |
132 | 184 | <tr> |
133 | 185 | <td class="border-b-d" colspan="4" style="height: 0; padding:0;"></td> |
134 | 186 | </tr> |
|
0 commit comments