Andrew Wallo 10 mesi fa
parent
commit
4926a072f2

+ 9
- 8
app/Concerns/ManagesLineItems.php Vedi File

@@ -3,6 +3,7 @@
3 3
 namespace App\Concerns;
4 4
 
5 5
 use App\Enums\Accounting\AdjustmentComputation;
6
+use App\Enums\Accounting\DocumentDiscountMethod;
6 7
 use App\Models\Accounting\DocumentLineItem;
7 8
 use App\Models\Accounting\Invoice;
8 9
 use App\Utilities\Currency\CurrencyConverter;
@@ -49,10 +50,10 @@ trait ManagesLineItems
49 50
         }
50 51
     }
51 52
 
52
-    protected function handleLineItemAdjustments(DocumentLineItem $lineItem, array $itemData, string $discountMethod): void
53
+    protected function handleLineItemAdjustments(DocumentLineItem $lineItem, array $itemData, DocumentDiscountMethod $discountMethod): void
53 54
     {
54 55
         $adjustmentIds = collect($itemData['salesTaxes'] ?? [])
55
-            ->merge($discountMethod === 'line_items' ? ($itemData['salesDiscounts'] ?? []) : [])
56
+            ->merge($discountMethod->isPerLineItem() ? ($itemData['salesDiscounts'] ?? []) : [])
56 57
             ->filter()
57 58
             ->unique();
58 59
 
@@ -60,11 +61,11 @@ trait ManagesLineItems
60 61
         $lineItem->refresh();
61 62
     }
62 63
 
63
-    protected function updateLineItemTotals(DocumentLineItem $lineItem, string $discountMethod): void
64
+    protected function updateLineItemTotals(DocumentLineItem $lineItem, DocumentDiscountMethod $discountMethod): void
64 65
     {
65 66
         $lineItem->updateQuietly([
66 67
             'tax_total' => $lineItem->calculateTaxTotal()->getAmount(),
67
-            'discount_total' => $discountMethod === 'line_items'
68
+            'discount_total' => $discountMethod->isPerLineItem()
68 69
                 ? $lineItem->calculateDiscountTotal()->getAmount()
69 70
                 : 0,
70 71
         ]);
@@ -75,7 +76,7 @@ trait ManagesLineItems
75 76
         $subtotalCents = $record->lineItems()->sum('subtotal');
76 77
         $taxTotalCents = $record->lineItems()->sum('tax_total');
77 78
         $discountTotalCents = $this->calculateDiscountTotal(
78
-            $data['discount_method'],
79
+            DocumentDiscountMethod::parse($data['discount_method']),
79 80
             AdjustmentComputation::parse($data['discount_computation']),
80 81
             $data['discount_rate'] ?? null,
81 82
             $subtotalCents,
@@ -93,17 +94,17 @@ trait ManagesLineItems
93 94
     }
94 95
 
95 96
     protected function calculateDiscountTotal(
96
-        string $discountMethod,
97
+        DocumentDiscountMethod $discountMethod,
97 98
         ?AdjustmentComputation $discountComputation,
98 99
         ?string $discountRate,
99 100
         int $subtotalCents,
100 101
         Invoice $record
101 102
     ): int {
102
-        if ($discountMethod === 'line_items') {
103
+        if ($discountMethod->isPerLineItem()) {
103 104
             return $record->lineItems()->sum('discount_total');
104 105
         }
105 106
 
106
-        if ($discountComputation === AdjustmentComputation::Percentage) {
107
+        if ($discountComputation?->isPercentage()) {
107 108
             return (int) ($subtotalCents * ((float) $discountRate / 100));
108 109
         }
109 110
 

+ 10
- 0
app/Enums/Accounting/AdjustmentComputation.php Vedi File

@@ -16,4 +16,14 @@ enum AdjustmentComputation: string implements HasLabel
16 16
     {
17 17
         return translate($this->name);
18 18
     }
19
+
20
+    public function isPercentage(): bool
21
+    {
22
+        return $this == self::Percentage;
23
+    }
24
+
25
+    public function isFixed(): bool
26
+    {
27
+        return $this == self::Fixed;
28
+    }
19 29
 }

+ 32
- 0
app/Enums/Accounting/DocumentDiscountMethod.php Vedi File

@@ -0,0 +1,32 @@
1
+<?php
2
+
3
+namespace App\Enums\Accounting;
4
+
5
+use App\Enums\Concerns\ParsesEnum;
6
+use Filament\Support\Contracts\HasLabel;
7
+
8
+enum DocumentDiscountMethod: string implements HasLabel
9
+{
10
+    use ParsesEnum;
11
+
12
+    case PerLineItem = 'per_line_item';
13
+    case PerDocument = 'per_document';
14
+
15
+    public function getLabel(): string
16
+    {
17
+        return match ($this) {
18
+            self::PerLineItem => 'Per Line Item',
19
+            self::PerDocument => 'Per Document',
20
+        };
21
+    }
22
+
23
+    public function isPerLineItem(): bool
24
+    {
25
+        return $this == self::PerLineItem;
26
+    }
27
+
28
+    public function isPerDocument(): bool
29
+    {
30
+        return $this == self::PerDocument;
31
+    }
32
+}

+ 2
- 2
app/Filament/Company/Clusters/Settings/Resources/AdjustmentResource.php Vedi File

@@ -53,7 +53,7 @@ class AdjustmentResource extends Resource
53 53
                         ToggleButton::make('recoverable')
54 54
                             ->label('Recoverable')
55 55
                             ->default(false)
56
-                            ->visible(fn (Forms\Get $get) => AdjustmentCategory::parse($get('category')) === AdjustmentCategory::Tax && AdjustmentType::parse($get('type')) === AdjustmentType::Purchase),
56
+                            ->visible(fn (Forms\Get $get) => AdjustmentCategory::parse($get('category'))->isTax() && AdjustmentType::parse($get('type'))->isPurchase()),
57 57
                     ])
58 58
                     ->columns()
59 59
                     ->visibleOn('create'),
@@ -80,7 +80,7 @@ class AdjustmentResource extends Resource
80 80
                         Forms\Components\DateTimePicker::make('end_date'),
81 81
                     ])
82 82
                     ->columns()
83
-                    ->visible(fn (Forms\Get $get) => AdjustmentCategory::parse($get('category')) === AdjustmentCategory::Discount),
83
+                    ->visible(fn (Forms\Get $get) => AdjustmentCategory::parse($get('category'))->isDiscount()),
84 84
             ]);
85 85
     }
86 86
 

+ 10
- 12
app/Filament/Company/Resources/Sales/InvoiceResource.php Vedi File

@@ -3,6 +3,7 @@
3 3
 namespace App\Filament\Company\Resources\Sales;
4 4
 
5 5
 use App\Collections\Accounting\InvoiceCollection;
6
+use App\Enums\Accounting\DocumentDiscountMethod;
6 7
 use App\Enums\Accounting\InvoiceStatus;
7 8
 use App\Enums\Accounting\PaymentMethod;
8 9
 use App\Filament\Company\Resources\Sales\InvoiceResource\Pages;
@@ -129,16 +130,13 @@ class InvoiceResource extends Resource
129 130
                                     }),
130 131
                                 Forms\Components\Select::make('discount_method')
131 132
                                     ->label('Discount Method')
132
-                                    ->options([
133
-                                        'line_items' => 'Per Line Item Discounts',
134
-                                        'invoice' => 'Invoice Level Discount',
135
-                                    ])
133
+                                    ->options(DocumentDiscountMethod::class)
136 134
                                     ->selectablePlaceholder(false)
137
-                                    ->default('line_items')
135
+                                    ->default(DocumentDiscountMethod::PerLineItem)
138 136
                                     ->afterStateUpdated(function ($state, Forms\Set $set) {
139
-                                        $discountMethod = $state;
137
+                                        $discountMethod = DocumentDiscountMethod::parse($state);
140 138
 
141
-                                        if ($discountMethod === 'invoice') {
139
+                                        if ($discountMethod->isPerDocument()) {
142 140
                                             $set('lineItems.*.salesDiscounts', []);
143 141
                                         }
144 142
                                     })
@@ -150,7 +148,7 @@ class InvoiceResource extends Resource
150 148
                             ->saveRelationshipsUsing(null)
151 149
                             ->dehydrated(true)
152 150
                             ->headers(function (Forms\Get $get) {
153
-                                $hasDiscounts = $get('discount_method') === 'line_items';
151
+                                $hasDiscounts = DocumentDiscountMethod::parse($get('discount_method'))->isPerLineItem();
154 152
 
155 153
                                 $headers = [
156 154
                                     Header::make('Items')->width($hasDiscounts ? '15%' : '20%'),
@@ -184,8 +182,8 @@ class InvoiceResource extends Resource
184 182
                                             $set('unit_price', $offeringRecord->price);
185 183
                                             $set('salesTaxes', $offeringRecord->salesTaxes->pluck('id')->toArray());
186 184
 
187
-                                            $discountMethod = $get('../../discount_method');
188
-                                            if ($discountMethod === 'line_items') {
185
+                                            $discountMethod = DocumentDiscountMethod::parse($get('../../discount_method'));
186
+                                            if ($discountMethod->isPerLineItem()) {
189 187
                                                 $set('salesDiscounts', $offeringRecord->salesDiscounts->pluck('id')->toArray());
190 188
                                             }
191 189
                                         }
@@ -217,9 +215,9 @@ class InvoiceResource extends Resource
217 215
                                     ->multiple()
218 216
                                     ->live()
219 217
                                     ->hidden(function (Forms\Get $get) {
220
-                                        $discountMethod = $get('../../discount_method');
218
+                                        $discountMethod = DocumentDiscountMethod::parse($get('../../discount_method'));
221 219
 
222
-                                        return $discountMethod === 'invoice';
220
+                                        return $discountMethod->isPerDocument();
223 221
                                     })
224 222
                                     ->searchable(),
225 223
                                 Forms\Components\Placeholder::make('total')

+ 9
- 0
app/Models/Accounting/Bill.php Vedi File

@@ -3,9 +3,12 @@
3 3
 namespace App\Models\Accounting;
4 4
 
5 5
 use App\Casts\MoneyCast;
6
+use App\Casts\RateCast;
6 7
 use App\Concerns\Blamable;
7 8
 use App\Concerns\CompanyOwned;
9
+use App\Enums\Accounting\AdjustmentComputation;
8 10
 use App\Enums\Accounting\BillStatus;
11
+use App\Enums\Accounting\DocumentDiscountMethod;
9 12
 use App\Enums\Accounting\JournalEntryType;
10 13
 use App\Enums\Accounting\TransactionType;
11 14
 use App\Filament\Company\Resources\Purchases\BillResource;
@@ -42,6 +45,9 @@ class Bill extends Model
42 45
         'paid_at',
43 46
         'status',
44 47
         'currency_code',
48
+        'discount_method',
49
+        'discount_computation',
50
+        'discount_rate',
45 51
         'subtotal',
46 52
         'tax_total',
47 53
         'discount_total',
@@ -57,6 +63,9 @@ class Bill extends Model
57 63
         'due_date' => 'date',
58 64
         'paid_at' => 'datetime',
59 65
         'status' => BillStatus::class,
66
+        'discount_method' => DocumentDiscountMethod::class,
67
+        'discount_computation' => AdjustmentComputation::class,
68
+        'discount_rate' => RateCast::class,
60 69
         'subtotal' => MoneyCast::class,
61 70
         'tax_total' => MoneyCast::class,
62 71
         'discount_total' => MoneyCast::class,

+ 3
- 1
app/Models/Accounting/Invoice.php Vedi File

@@ -8,6 +8,7 @@ use App\Collections\Accounting\InvoiceCollection;
8 8
 use App\Concerns\Blamable;
9 9
 use App\Concerns\CompanyOwned;
10 10
 use App\Enums\Accounting\AdjustmentComputation;
11
+use App\Enums\Accounting\DocumentDiscountMethod;
11 12
 use App\Enums\Accounting\InvoiceStatus;
12 13
 use App\Enums\Accounting\JournalEntryType;
13 14
 use App\Enums\Accounting\TransactionType;
@@ -75,6 +76,7 @@ class Invoice extends Model
75 76
         'paid_at' => 'datetime',
76 77
         'last_sent' => 'datetime',
77 78
         'status' => InvoiceStatus::class,
79
+        'discount_method' => DocumentDiscountMethod::class,
78 80
         'discount_computation' => AdjustmentComputation::class,
79 81
         'discount_rate' => RateCast::class,
80 82
         'subtotal' => MoneyCast::class,
@@ -293,7 +295,7 @@ class Invoice extends Model
293 295
                 ]);
294 296
             }
295 297
 
296
-            if ($this->discount_method === 'invoice' && $totalLineItemSubtotal > 0) {
298
+            if ($this->discount_method->isPerDocument() && $totalLineItemSubtotal > 0) {
297 299
                 $lineItemSubtotalCents = (int) $lineItem->getRawOriginal('subtotal');
298 300
 
299 301
                 if ($index === $this->lineItems->count() - 1) {

+ 11
- 2
app/Services/ReportService.php Vedi File

@@ -177,6 +177,8 @@ class ReportService
177 177
 
178 178
             $accountTransactions = [];
179 179
             $currentBalance = $account->starting_balance;
180
+            $periodDebitTotal = 0;
181
+            $periodCreditTotal = 0;
180 182
 
181 183
             $accountTransactions[] = new AccountTransactionDTO(
182 184
                 id: null,
@@ -192,6 +194,13 @@ class ReportService
192 194
             foreach ($account->journalEntries as $journalEntry) {
193 195
                 $transaction = $journalEntry->transaction;
194 196
                 $signedAmount = $journalEntry->signed_amount;
197
+                $amount = $journalEntry->getRawOriginal('amount');
198
+
199
+                if ($journalEntry->type->isDebit()) {
200
+                    $periodDebitTotal += $amount;
201
+                } else {
202
+                    $periodCreditTotal += $amount;
203
+                }
195 204
 
196 205
                 if ($account->category->isNormalDebitBalance()) {
197 206
                     $currentBalance += $signedAmount;
@@ -219,8 +228,8 @@ class ReportService
219 228
                 id: null,
220 229
                 date: 'Totals and Ending Balance',
221 230
                 description: '',
222
-                debit: money($account->total_debit, $defaultCurrency)->format(),
223
-                credit: money($account->total_credit, $defaultCurrency)->format(),
231
+                debit: money($periodDebitTotal, $defaultCurrency)->format(),
232
+                credit: money($periodCreditTotal, $defaultCurrency)->format(),
224 233
                 balance: money($currentBalance, $defaultCurrency)->format(),
225 234
                 type: null,
226 235
                 tableAction: null

+ 5
- 4
app/View/Models/InvoiceTotalViewModel.php Vedi File

@@ -3,6 +3,7 @@
3 3
 namespace App\View\Models;
4 4
 
5 5
 use App\Enums\Accounting\AdjustmentComputation;
6
+use App\Enums\Accounting\DocumentDiscountMethod;
6 7
 use App\Models\Accounting\Adjustment;
7 8
 use App\Models\Accounting\Invoice;
8 9
 use App\Utilities\Currency\CurrencyConverter;
@@ -39,9 +40,9 @@ class InvoiceTotalViewModel
39 40
         }, 0);
40 41
 
41 42
         // Calculate discount based on method
42
-        $discountMethod = $this->data['discount_method'] ?? 'line_items';
43
+        $discountMethod = DocumentDiscountMethod::parse($this->data['discount_method']) ?? DocumentDiscountMethod::PerLineItem;
43 44
 
44
-        if ($discountMethod === 'line_items') {
45
+        if ($discountMethod->isPerLineItem()) {
45 46
             $discountTotal = $lineItems->reduce(function ($carry, $item) {
46 47
                 $quantity = max((float) ($item['quantity'] ?? 0), 0);
47 48
                 $unitPrice = max((float) ($item['unit_price'] ?? 0), 0);
@@ -55,10 +56,10 @@ class InvoiceTotalViewModel
55 56
                 return $carry + $discountAmount;
56 57
             }, 0);
57 58
         } else {
58
-            $discountComputation = $this->data['discount_computation'] ?? AdjustmentComputation::Percentage;
59
+            $discountComputation = AdjustmentComputation::parse($this->data['discount_computation']) ?? AdjustmentComputation::Percentage;
59 60
             $discountRate = (float) ($this->data['discount_rate'] ?? 0);
60 61
 
61
-            if (AdjustmentComputation::parse($discountComputation) === AdjustmentComputation::Percentage) {
62
+            if ($discountComputation->isPercentage()) {
62 63
                 $discountTotal = $subtotal * ($discountRate / 100);
63 64
             } else {
64 65
                 $discountTotal = $discountRate;

+ 1
- 1
composer.json Vedi File

@@ -17,7 +17,7 @@
17 17
         "andrewdwallo/transmatic": "^1.1",
18 18
         "awcodes/filament-table-repeater": "^3.0",
19 19
         "barryvdh/laravel-snappy": "^1.0",
20
-        "filament/filament": "^3.2.115",
20
+        "filament/filament": "v3.2.129",
21 21
         "guava/filament-clusters": "^1.1",
22 22
         "guzzlehttp/guzzle": "^7.8",
23 23
         "jaocero/radio-deck": "^1.2",

+ 81
- 81
composer.lock Vedi File

@@ -4,7 +4,7 @@
4 4
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5 5
         "This file is @generated automatically"
6 6
     ],
7
-    "content-hash": "6f7204f976352f049caf598df4454ace",
7
+    "content-hash": "7301f370a98e2573adf4e6b4e7ab4a8e",
8 8
     "packages": [
9 9
         {
10 10
             "name": "akaunting/laravel-money",
@@ -497,16 +497,16 @@
497 497
         },
498 498
         {
499 499
             "name": "aws/aws-sdk-php",
500
-            "version": "3.334.4",
500
+            "version": "3.334.6",
501 501
             "source": {
502 502
                 "type": "git",
503 503
                 "url": "https://github.com/aws/aws-sdk-php.git",
504
-                "reference": "3261e515cfc1bae024bce72be3ea28708461c0a3"
504
+                "reference": "2b0be3aded849d3b7bb0b53ea3295c7cecdeeee7"
505 505
             },
506 506
             "dist": {
507 507
                 "type": "zip",
508
-                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/3261e515cfc1bae024bce72be3ea28708461c0a3",
509
-                "reference": "3261e515cfc1bae024bce72be3ea28708461c0a3",
508
+                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/2b0be3aded849d3b7bb0b53ea3295c7cecdeeee7",
509
+                "reference": "2b0be3aded849d3b7bb0b53ea3295c7cecdeeee7",
510 510
                 "shasum": ""
511 511
             },
512 512
             "require": {
@@ -589,9 +589,9 @@
589 589
             "support": {
590 590
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
591 591
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
592
-                "source": "https://github.com/aws/aws-sdk-php/tree/3.334.4"
592
+                "source": "https://github.com/aws/aws-sdk-php/tree/3.334.6"
593 593
             },
594
-            "time": "2024-12-11T19:41:47+00:00"
594
+            "time": "2024-12-13T19:18:29+00:00"
595 595
         },
596 596
         {
597 597
             "name": "aws/aws-sdk-php-laravel",
@@ -624,12 +624,12 @@
624 624
             "type": "library",
625 625
             "extra": {
626 626
                 "laravel": {
627
-                    "providers": [
628
-                        "Aws\\Laravel\\AwsServiceProvider"
629
-                    ],
630 627
                     "aliases": {
631 628
                         "AWS": "Aws\\Laravel\\AwsFacade"
632
-                    }
629
+                    },
630
+                    "providers": [
631
+                        "Aws\\Laravel\\AwsServiceProvider"
632
+                    ]
633 633
                 }
634 634
             },
635 635
             "autoload": {
@@ -1662,7 +1662,7 @@
1662 1662
         },
1663 1663
         {
1664 1664
             "name": "filament/actions",
1665
-            "version": "v3.2.130",
1665
+            "version": "v3.2.129",
1666 1666
             "source": {
1667 1667
                 "type": "git",
1668 1668
                 "url": "https://github.com/filamentphp/actions.git",
@@ -1715,7 +1715,7 @@
1715 1715
         },
1716 1716
         {
1717 1717
             "name": "filament/filament",
1718
-            "version": "v3.2.130",
1718
+            "version": "v3.2.129",
1719 1719
             "source": {
1720 1720
                 "type": "git",
1721 1721
                 "url": "https://github.com/filamentphp/panels.git",
@@ -1780,7 +1780,7 @@
1780 1780
         },
1781 1781
         {
1782 1782
             "name": "filament/forms",
1783
-            "version": "v3.2.130",
1783
+            "version": "v3.2.129",
1784 1784
             "source": {
1785 1785
                 "type": "git",
1786 1786
                 "url": "https://github.com/filamentphp/forms.git",
@@ -1836,7 +1836,7 @@
1836 1836
         },
1837 1837
         {
1838 1838
             "name": "filament/infolists",
1839
-            "version": "v3.2.130",
1839
+            "version": "v3.2.129",
1840 1840
             "source": {
1841 1841
                 "type": "git",
1842 1842
                 "url": "https://github.com/filamentphp/infolists.git",
@@ -1887,7 +1887,7 @@
1887 1887
         },
1888 1888
         {
1889 1889
             "name": "filament/notifications",
1890
-            "version": "v3.2.130",
1890
+            "version": "v3.2.129",
1891 1891
             "source": {
1892 1892
                 "type": "git",
1893 1893
                 "url": "https://github.com/filamentphp/notifications.git",
@@ -1939,16 +1939,16 @@
1939 1939
         },
1940 1940
         {
1941 1941
             "name": "filament/support",
1942
-            "version": "v3.2.130",
1942
+            "version": "v3.2.129",
1943 1943
             "source": {
1944 1944
                 "type": "git",
1945 1945
                 "url": "https://github.com/filamentphp/support.git",
1946
-                "reference": "1654851f04733f48faed7235b032b2c5842b5629"
1946
+                "reference": "e8aed9684d5c58ff7dde9517c7f1af44d575d871"
1947 1947
             },
1948 1948
             "dist": {
1949 1949
                 "type": "zip",
1950
-                "url": "https://api.github.com/repos/filamentphp/support/zipball/1654851f04733f48faed7235b032b2c5842b5629",
1951
-                "reference": "1654851f04733f48faed7235b032b2c5842b5629",
1950
+                "url": "https://api.github.com/repos/filamentphp/support/zipball/e8aed9684d5c58ff7dde9517c7f1af44d575d871",
1951
+                "reference": "e8aed9684d5c58ff7dde9517c7f1af44d575d871",
1952 1952
                 "shasum": ""
1953 1953
             },
1954 1954
             "require": {
@@ -1959,7 +1959,7 @@
1959 1959
                 "illuminate/support": "^10.45|^11.0",
1960 1960
                 "illuminate/view": "^10.45|^11.0",
1961 1961
                 "kirschbaum-development/eloquent-power-joins": "^3.0|^4.0",
1962
-                "livewire/livewire": "^3.5",
1962
+                "livewire/livewire": "3.5.12",
1963 1963
                 "php": "^8.1",
1964 1964
                 "ryangjchandler/blade-capture-directive": "^0.2|^0.3|^1.0",
1965 1965
                 "spatie/color": "^1.5",
@@ -1994,20 +1994,20 @@
1994 1994
                 "issues": "https://github.com/filamentphp/filament/issues",
1995 1995
                 "source": "https://github.com/filamentphp/filament"
1996 1996
             },
1997
-            "time": "2024-12-11T12:57:14+00:00"
1997
+            "time": "2024-12-11T09:05:54+00:00"
1998 1998
         },
1999 1999
         {
2000 2000
             "name": "filament/tables",
2001
-            "version": "v3.2.130",
2001
+            "version": "v3.2.129",
2002 2002
             "source": {
2003 2003
                 "type": "git",
2004 2004
                 "url": "https://github.com/filamentphp/tables.git",
2005
-                "reference": "d7dcaa4d5f04c7e6fb7b9d457083e6fa588ca600"
2005
+                "reference": "acdec73ae82961654a52a22ed9f53207cfee2ef8"
2006 2006
             },
2007 2007
             "dist": {
2008 2008
                 "type": "zip",
2009
-                "url": "https://api.github.com/repos/filamentphp/tables/zipball/d7dcaa4d5f04c7e6fb7b9d457083e6fa588ca600",
2010
-                "reference": "d7dcaa4d5f04c7e6fb7b9d457083e6fa588ca600",
2009
+                "url": "https://api.github.com/repos/filamentphp/tables/zipball/acdec73ae82961654a52a22ed9f53207cfee2ef8",
2010
+                "reference": "acdec73ae82961654a52a22ed9f53207cfee2ef8",
2011 2011
                 "shasum": ""
2012 2012
             },
2013 2013
             "require": {
@@ -2046,11 +2046,11 @@
2046 2046
                 "issues": "https://github.com/filamentphp/filament/issues",
2047 2047
                 "source": "https://github.com/filamentphp/filament"
2048 2048
             },
2049
-            "time": "2024-12-11T12:57:12+00:00"
2049
+            "time": "2024-12-11T09:05:54+00:00"
2050 2050
         },
2051 2051
         {
2052 2052
             "name": "filament/widgets",
2053
-            "version": "v3.2.130",
2053
+            "version": "v3.2.129",
2054 2054
             "source": {
2055 2055
                 "type": "git",
2056 2056
                 "url": "https://github.com/filamentphp/widgets.git",
@@ -2980,16 +2980,16 @@
2980 2980
         },
2981 2981
         {
2982 2982
             "name": "laravel/framework",
2983
-            "version": "v11.35.0",
2983
+            "version": "v11.35.1",
2984 2984
             "source": {
2985 2985
                 "type": "git",
2986 2986
                 "url": "https://github.com/laravel/framework.git",
2987
-                "reference": "f1a7aaa3c1235b7a95ccaa58db90e0cd9d8c3fcc"
2987
+                "reference": "dcfa130ede1a6fa4343dc113410963e791ad34fb"
2988 2988
             },
2989 2989
             "dist": {
2990 2990
                 "type": "zip",
2991
-                "url": "https://api.github.com/repos/laravel/framework/zipball/f1a7aaa3c1235b7a95ccaa58db90e0cd9d8c3fcc",
2992
-                "reference": "f1a7aaa3c1235b7a95ccaa58db90e0cd9d8c3fcc",
2991
+                "url": "https://api.github.com/repos/laravel/framework/zipball/dcfa130ede1a6fa4343dc113410963e791ad34fb",
2992
+                "reference": "dcfa130ede1a6fa4343dc113410963e791ad34fb",
2993 2993
                 "shasum": ""
2994 2994
             },
2995 2995
             "require": {
@@ -3191,7 +3191,7 @@
3191 3191
                 "issues": "https://github.com/laravel/framework/issues",
3192 3192
                 "source": "https://github.com/laravel/framework"
3193 3193
             },
3194
-            "time": "2024-12-10T16:09:29+00:00"
3194
+            "time": "2024-12-12T18:25:58+00:00"
3195 3195
         },
3196 3196
         {
3197 3197
             "name": "laravel/prompts",
@@ -3706,16 +3706,16 @@
3706 3706
         },
3707 3707
         {
3708 3708
             "name": "league/csv",
3709
-            "version": "9.19.0",
3709
+            "version": "9.20.0",
3710 3710
             "source": {
3711 3711
                 "type": "git",
3712 3712
                 "url": "https://github.com/thephpleague/csv.git",
3713
-                "reference": "f81df48a012a9e86d077e74eaff666fd15bfab88"
3713
+                "reference": "553579df208641ada6ffb450b3a151e2fcfa4f31"
3714 3714
             },
3715 3715
             "dist": {
3716 3716
                 "type": "zip",
3717
-                "url": "https://api.github.com/repos/thephpleague/csv/zipball/f81df48a012a9e86d077e74eaff666fd15bfab88",
3718
-                "reference": "f81df48a012a9e86d077e74eaff666fd15bfab88",
3717
+                "url": "https://api.github.com/repos/thephpleague/csv/zipball/553579df208641ada6ffb450b3a151e2fcfa4f31",
3718
+                "reference": "553579df208641ada6ffb450b3a151e2fcfa4f31",
3719 3719
                 "shasum": ""
3720 3720
             },
3721 3721
             "require": {
@@ -3789,7 +3789,7 @@
3789 3789
                     "type": "github"
3790 3790
                 }
3791 3791
             ],
3792
-            "time": "2024-12-08T08:09:35+00:00"
3792
+            "time": "2024-12-13T15:49:27+00:00"
3793 3793
         },
3794 3794
         {
3795 3795
             "name": "league/flysystem",
@@ -4231,16 +4231,16 @@
4231 4231
         },
4232 4232
         {
4233 4233
             "name": "livewire/livewire",
4234
-            "version": "v3.5.17",
4234
+            "version": "v3.5.12",
4235 4235
             "source": {
4236 4236
                 "type": "git",
4237 4237
                 "url": "https://github.com/livewire/livewire.git",
4238
-                "reference": "7bbf80d93db9b866776bf957ca6229364bca8d87"
4238
+                "reference": "3c8d1f9d7d9098aaea663093ae168f2d5d2ae73d"
4239 4239
             },
4240 4240
             "dist": {
4241 4241
                 "type": "zip",
4242
-                "url": "https://api.github.com/repos/livewire/livewire/zipball/7bbf80d93db9b866776bf957ca6229364bca8d87",
4243
-                "reference": "7bbf80d93db9b866776bf957ca6229364bca8d87",
4242
+                "url": "https://api.github.com/repos/livewire/livewire/zipball/3c8d1f9d7d9098aaea663093ae168f2d5d2ae73d",
4243
+                "reference": "3c8d1f9d7d9098aaea663093ae168f2d5d2ae73d",
4244 4244
                 "shasum": ""
4245 4245
             },
4246 4246
             "require": {
@@ -4295,7 +4295,7 @@
4295 4295
             "description": "A front-end framework for Laravel.",
4296 4296
             "support": {
4297 4297
                 "issues": "https://github.com/livewire/livewire/issues",
4298
-                "source": "https://github.com/livewire/livewire/tree/v3.5.17"
4298
+                "source": "https://github.com/livewire/livewire/tree/v3.5.12"
4299 4299
             },
4300 4300
             "funding": [
4301 4301
                 {
@@ -4303,7 +4303,7 @@
4303 4303
                     "type": "github"
4304 4304
                 }
4305 4305
             ],
4306
-            "time": "2024-12-06T13:41:21+00:00"
4306
+            "time": "2024-10-15T19:35:06+00:00"
4307 4307
         },
4308 4308
         {
4309 4309
             "name": "masterminds/html5",
@@ -5350,16 +5350,16 @@
5350 5350
         },
5351 5351
         {
5352 5352
             "name": "phpseclib/phpseclib",
5353
-            "version": "3.0.42",
5353
+            "version": "3.0.43",
5354 5354
             "source": {
5355 5355
                 "type": "git",
5356 5356
                 "url": "https://github.com/phpseclib/phpseclib.git",
5357
-                "reference": "db92f1b1987b12b13f248fe76c3a52cadb67bb98"
5357
+                "reference": "709ec107af3cb2f385b9617be72af8cf62441d02"
5358 5358
             },
5359 5359
             "dist": {
5360 5360
                 "type": "zip",
5361
-                "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/db92f1b1987b12b13f248fe76c3a52cadb67bb98",
5362
-                "reference": "db92f1b1987b12b13f248fe76c3a52cadb67bb98",
5361
+                "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/709ec107af3cb2f385b9617be72af8cf62441d02",
5362
+                "reference": "709ec107af3cb2f385b9617be72af8cf62441d02",
5363 5363
                 "shasum": ""
5364 5364
             },
5365 5365
             "require": {
@@ -5440,7 +5440,7 @@
5440 5440
             ],
5441 5441
             "support": {
5442 5442
                 "issues": "https://github.com/phpseclib/phpseclib/issues",
5443
-                "source": "https://github.com/phpseclib/phpseclib/tree/3.0.42"
5443
+                "source": "https://github.com/phpseclib/phpseclib/tree/3.0.43"
5444 5444
             },
5445 5445
             "funding": [
5446 5446
                 {
@@ -5456,7 +5456,7 @@
5456 5456
                     "type": "tidelift"
5457 5457
                 }
5458 5458
             ],
5459
-            "time": "2024-09-16T03:06:04+00:00"
5459
+            "time": "2024-12-14T21:12:59+00:00"
5460 5460
         },
5461 5461
         {
5462 5462
             "name": "psr/cache",
@@ -9241,16 +9241,16 @@
9241 9241
     "packages-dev": [
9242 9242
         {
9243 9243
             "name": "brianium/paratest",
9244
-            "version": "v7.6.3",
9244
+            "version": "v7.7.0",
9245 9245
             "source": {
9246 9246
                 "type": "git",
9247 9247
                 "url": "https://github.com/paratestphp/paratest.git",
9248
-                "reference": "ae3c9f1aeda7daa374c904b35ece8f574f56d176"
9248
+                "reference": "4fb3f73bc5a4c3146bac2850af7dc72435a32daf"
9249 9249
             },
9250 9250
             "dist": {
9251 9251
                 "type": "zip",
9252
-                "url": "https://api.github.com/repos/paratestphp/paratest/zipball/ae3c9f1aeda7daa374c904b35ece8f574f56d176",
9253
-                "reference": "ae3c9f1aeda7daa374c904b35ece8f574f56d176",
9252
+                "url": "https://api.github.com/repos/paratestphp/paratest/zipball/4fb3f73bc5a4c3146bac2850af7dc72435a32daf",
9253
+                "reference": "4fb3f73bc5a4c3146bac2850af7dc72435a32daf",
9254 9254
                 "shasum": ""
9255 9255
             },
9256 9256
             "require": {
@@ -9261,12 +9261,12 @@
9261 9261
                 "fidry/cpu-core-counter": "^1.2.0",
9262 9262
                 "jean85/pretty-package-versions": "^2.1.0",
9263 9263
                 "php": "~8.2.0 || ~8.3.0 || ~8.4.0",
9264
-                "phpunit/php-code-coverage": "^11.0.7",
9264
+                "phpunit/php-code-coverage": "^11.0.8",
9265 9265
                 "phpunit/php-file-iterator": "^5.1.0",
9266 9266
                 "phpunit/php-timer": "^7.0.1",
9267
-                "phpunit/phpunit": "^11.5.0",
9267
+                "phpunit/phpunit": "^11.5.1",
9268 9268
                 "sebastian/environment": "^7.2.0",
9269
-                "symfony/console": "^6.4.14 || ^7.2.0",
9269
+                "symfony/console": "^6.4.14 || ^7.2.1",
9270 9270
                 "symfony/process": "^6.4.14 || ^7.2.0"
9271 9271
             },
9272 9272
             "require-dev": {
@@ -9318,7 +9318,7 @@
9318 9318
             ],
9319 9319
             "support": {
9320 9320
                 "issues": "https://github.com/paratestphp/paratest/issues",
9321
-                "source": "https://github.com/paratestphp/paratest/tree/v7.6.3"
9321
+                "source": "https://github.com/paratestphp/paratest/tree/v7.7.0"
9322 9322
             },
9323 9323
             "funding": [
9324 9324
                 {
@@ -9330,7 +9330,7 @@
9330 9330
                     "type": "paypal"
9331 9331
                 }
9332 9332
             ],
9333
-            "time": "2024-12-10T13:59:28+00:00"
9333
+            "time": "2024-12-11T14:50:44+00:00"
9334 9334
         },
9335 9335
         {
9336 9336
             "name": "fakerphp/faker",
@@ -10008,31 +10008,31 @@
10008 10008
         },
10009 10009
         {
10010 10010
             "name": "pestphp/pest",
10011
-            "version": "v3.7.0",
10011
+            "version": "v3.7.1",
10012 10012
             "source": {
10013 10013
                 "type": "git",
10014 10014
                 "url": "https://github.com/pestphp/pest.git",
10015
-                "reference": "9688b83a3d7d0acdda21c01b8aeb933ec9fcd556"
10015
+                "reference": "bf3178473dcaa53b0458f21dfdb271306ea62512"
10016 10016
             },
10017 10017
             "dist": {
10018 10018
                 "type": "zip",
10019
-                "url": "https://api.github.com/repos/pestphp/pest/zipball/9688b83a3d7d0acdda21c01b8aeb933ec9fcd556",
10020
-                "reference": "9688b83a3d7d0acdda21c01b8aeb933ec9fcd556",
10019
+                "url": "https://api.github.com/repos/pestphp/pest/zipball/bf3178473dcaa53b0458f21dfdb271306ea62512",
10020
+                "reference": "bf3178473dcaa53b0458f21dfdb271306ea62512",
10021 10021
                 "shasum": ""
10022 10022
             },
10023 10023
             "require": {
10024
-                "brianium/paratest": "^7.6.2",
10024
+                "brianium/paratest": "^7.7.0",
10025 10025
                 "nunomaduro/collision": "^8.5.0",
10026 10026
                 "nunomaduro/termwind": "^2.3.0",
10027 10027
                 "pestphp/pest-plugin": "^3.0.0",
10028 10028
                 "pestphp/pest-plugin-arch": "^3.0.0",
10029 10029
                 "pestphp/pest-plugin-mutate": "^3.0.5",
10030 10030
                 "php": "^8.2.0",
10031
-                "phpunit/phpunit": "^11.5.0"
10031
+                "phpunit/phpunit": "^11.5.1"
10032 10032
             },
10033 10033
             "conflict": {
10034 10034
                 "filp/whoops": "<2.16.0",
10035
-                "phpunit/phpunit": ">11.5.0",
10035
+                "phpunit/phpunit": ">11.5.1",
10036 10036
                 "sebastian/exporter": "<6.0.0",
10037 10037
                 "webmozart/assert": "<1.11.0"
10038 10038
             },
@@ -10104,7 +10104,7 @@
10104 10104
             ],
10105 10105
             "support": {
10106 10106
                 "issues": "https://github.com/pestphp/pest/issues",
10107
-                "source": "https://github.com/pestphp/pest/tree/v3.7.0"
10107
+                "source": "https://github.com/pestphp/pest/tree/v3.7.1"
10108 10108
             },
10109 10109
             "funding": [
10110 10110
                 {
@@ -10116,7 +10116,7 @@
10116 10116
                     "type": "github"
10117 10117
                 }
10118 10118
             ],
10119
-            "time": "2024-12-10T11:54:49+00:00"
10119
+            "time": "2024-12-12T11:52:01+00:00"
10120 10120
         },
10121 10121
         {
10122 10122
             "name": "pestphp/pest-plugin",
@@ -11061,16 +11061,16 @@
11061 11061
         },
11062 11062
         {
11063 11063
             "name": "phpunit/phpunit",
11064
-            "version": "11.5.0",
11064
+            "version": "11.5.1",
11065 11065
             "source": {
11066 11066
                 "type": "git",
11067 11067
                 "url": "https://github.com/sebastianbergmann/phpunit.git",
11068
-                "reference": "0569902506a6c0878930b87ea79ec3b50ea563f7"
11068
+                "reference": "2b94d4f2450b9869fa64a46fd8a6a41997aef56a"
11069 11069
             },
11070 11070
             "dist": {
11071 11071
                 "type": "zip",
11072
-                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0569902506a6c0878930b87ea79ec3b50ea563f7",
11073
-                "reference": "0569902506a6c0878930b87ea79ec3b50ea563f7",
11072
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2b94d4f2450b9869fa64a46fd8a6a41997aef56a",
11073
+                "reference": "2b94d4f2450b9869fa64a46fd8a6a41997aef56a",
11074 11074
                 "shasum": ""
11075 11075
             },
11076 11076
             "require": {
@@ -11142,7 +11142,7 @@
11142 11142
             "support": {
11143 11143
                 "issues": "https://github.com/sebastianbergmann/phpunit/issues",
11144 11144
                 "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
11145
-                "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.0"
11145
+                "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.1"
11146 11146
             },
11147 11147
             "funding": [
11148 11148
                 {
@@ -11158,7 +11158,7 @@
11158 11158
                     "type": "tidelift"
11159 11159
                 }
11160 11160
             ],
11161
-            "time": "2024-12-06T05:57:38+00:00"
11161
+            "time": "2024-12-11T10:52:48+00:00"
11162 11162
         },
11163 11163
         {
11164 11164
             "name": "pimple/pimple",
@@ -11272,23 +11272,23 @@
11272 11272
         },
11273 11273
         {
11274 11274
             "name": "sebastian/code-unit",
11275
-            "version": "3.0.1",
11275
+            "version": "3.0.2",
11276 11276
             "source": {
11277 11277
                 "type": "git",
11278 11278
                 "url": "https://github.com/sebastianbergmann/code-unit.git",
11279
-                "reference": "6bb7d09d6623567178cf54126afa9c2310114268"
11279
+                "reference": "ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca"
11280 11280
             },
11281 11281
             "dist": {
11282 11282
                 "type": "zip",
11283
-                "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/6bb7d09d6623567178cf54126afa9c2310114268",
11284
-                "reference": "6bb7d09d6623567178cf54126afa9c2310114268",
11283
+                "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca",
11284
+                "reference": "ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca",
11285 11285
                 "shasum": ""
11286 11286
             },
11287 11287
             "require": {
11288 11288
                 "php": ">=8.2"
11289 11289
             },
11290 11290
             "require-dev": {
11291
-                "phpunit/phpunit": "^11.0"
11291
+                "phpunit/phpunit": "^11.5"
11292 11292
             },
11293 11293
             "type": "library",
11294 11294
             "extra": {
@@ -11317,7 +11317,7 @@
11317 11317
             "support": {
11318 11318
                 "issues": "https://github.com/sebastianbergmann/code-unit/issues",
11319 11319
                 "security": "https://github.com/sebastianbergmann/code-unit/security/policy",
11320
-                "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.1"
11320
+                "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.2"
11321 11321
             },
11322 11322
             "funding": [
11323 11323
                 {
@@ -11325,7 +11325,7 @@
11325 11325
                     "type": "github"
11326 11326
                 }
11327 11327
             ],
11328
-            "time": "2024-07-03T04:44:28+00:00"
11328
+            "time": "2024-12-12T09:59:06+00:00"
11329 11329
         },
11330 11330
         {
11331 11331
             "name": "sebastian/code-unit-reverse-lookup",

+ 3
- 1
database/factories/Accounting/AdjustmentFactory.php Vedi File

@@ -30,9 +30,11 @@ class AdjustmentFactory extends Factory
30 30
     {
31 31
         $startDate = $this->faker->dateTimeBetween('now', '+1 year');
32 32
         $endDate = $this->faker->dateTimeBetween($startDate, Carbon::parse($startDate)->addYear());
33
+
34
+        /** @var AdjustmentComputation $computation */
33 35
         $computation = $this->faker->randomElement(AdjustmentComputation::class);
34 36
 
35
-        $rate = $computation === AdjustmentComputation::Fixed
37
+        $rate = $computation->isFixed()
36 38
             ? $this->faker->numberBetween(5, 100) * 100 // $5 - $100 for fixed amounts
37 39
             : $this->faker->numberBetween(3, 25) * 10000; // 3% - 25% for percentages
38 40
 

+ 3
- 0
database/migrations/2024_11_27_221657_create_bills_table.php Vedi File

@@ -22,6 +22,9 @@ return new class extends Migration
22 22
             $table->timestamp('paid_at')->nullable();
23 23
             $table->string('status')->default('unpaid');
24 24
             $table->string('currency_code')->nullable();
25
+            $table->string('discount_method')->default('per_line_item');
26
+            $table->string('discount_computation')->default('percentage');
27
+            $table->integer('discount_rate')->default(0);
25 28
             $table->integer('subtotal')->default(0);
26 29
             $table->integer('tax_total')->default(0);
27 30
             $table->integer('discount_total')->default(0);

+ 1
- 1
database/migrations/2024_11_27_223015_create_invoices_table.php Vedi File

@@ -27,7 +27,7 @@ return new class extends Migration
27 27
             $table->timestamp('last_sent')->nullable();
28 28
             $table->string('status')->default('draft');
29 29
             $table->string('currency_code')->nullable();
30
-            $table->string('discount_method')->default('line_items');
30
+            $table->string('discount_method')->default('per_line_item');
31 31
             $table->string('discount_computation')->default('percentage');
32 32
             $table->integer('discount_rate')->default(0);
33 33
             $table->integer('subtotal')->default(0);

+ 16
- 16
package-lock.json Vedi File

@@ -1014,9 +1014,9 @@
1014 1014
             }
1015 1015
         },
1016 1016
         "node_modules/browserslist": {
1017
-            "version": "4.24.2",
1018
-            "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.2.tgz",
1019
-            "integrity": "sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==",
1017
+            "version": "4.24.3",
1018
+            "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.3.tgz",
1019
+            "integrity": "sha512-1CPmv8iobE2fyRMV97dAcMVegvvWKxmq94hkLiAkUGwKVTyDLw33K+ZxiFrREKmmps4rIw6grcCFCnTMSZ/YiA==",
1020 1020
             "dev": true,
1021 1021
             "funding": [
1022 1022
                 {
@@ -1034,9 +1034,9 @@
1034 1034
             ],
1035 1035
             "license": "MIT",
1036 1036
             "dependencies": {
1037
-                "caniuse-lite": "^1.0.30001669",
1038
-                "electron-to-chromium": "^1.5.41",
1039
-                "node-releases": "^2.0.18",
1037
+                "caniuse-lite": "^1.0.30001688",
1038
+                "electron-to-chromium": "^1.5.73",
1039
+                "node-releases": "^2.0.19",
1040 1040
                 "update-browserslist-db": "^1.1.1"
1041 1041
             },
1042 1042
             "bin": {
@@ -1057,9 +1057,9 @@
1057 1057
             }
1058 1058
         },
1059 1059
         "node_modules/caniuse-lite": {
1060
-            "version": "1.0.30001687",
1061
-            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001687.tgz",
1062
-            "integrity": "sha512-0S/FDhf4ZiqrTUiQ39dKeUjYRjkv7lOZU1Dgif2rIqrTzX/1wV2hfKu9TOm1IHkdSijfLswxTFzl/cvir+SLSQ==",
1060
+            "version": "1.0.30001688",
1061
+            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001688.tgz",
1062
+            "integrity": "sha512-Nmqpru91cuABu/DTCXbM2NSRHzM2uVHfPnhJ/1zEAJx/ILBRVmz3pzH4N7DZqbdG0gWClsCC05Oj0mJ/1AWMbA==",
1063 1063
             "dev": true,
1064 1064
             "funding": [
1065 1065
                 {
@@ -1487,9 +1487,9 @@
1487 1487
             }
1488 1488
         },
1489 1489
         "node_modules/is-core-module": {
1490
-            "version": "2.15.1",
1491
-            "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz",
1492
-            "integrity": "sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==",
1490
+            "version": "2.16.0",
1491
+            "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.0.tgz",
1492
+            "integrity": "sha512-urTSINYfAYgcbLb0yDQ6egFm6h3Mo1DcF9EkyXSRjjzdHbsulg01qhwWuXdOoUBuTkbQ80KDboXa0vFJ+BDH+g==",
1493 1493
             "dev": true,
1494 1494
             "license": "MIT",
1495 1495
             "dependencies": {
@@ -2192,13 +2192,13 @@
2192 2192
             }
2193 2193
         },
2194 2194
         "node_modules/resolve": {
2195
-            "version": "1.22.8",
2196
-            "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
2197
-            "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==",
2195
+            "version": "1.22.9",
2196
+            "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.9.tgz",
2197
+            "integrity": "sha512-QxrmX1DzraFIi9PxdG5VkRfRwIgjwyud+z/iBwfRRrVmHc+P9Q7u2lSSpQ6bjr2gy5lrqIiU9vb6iAeGf2400A==",
2198 2198
             "dev": true,
2199 2199
             "license": "MIT",
2200 2200
             "dependencies": {
2201
-                "is-core-module": "^2.13.0",
2201
+                "is-core-module": "^2.16.0",
2202 2202
                 "path-parse": "^1.0.7",
2203 2203
                 "supports-preserve-symlinks-flag": "^1.0.0"
2204 2204
             },

+ 9
- 6
resources/views/filament/forms/components/invoice-totals.blade.php Vedi File

@@ -1,11 +1,14 @@
1
-@use('App\Utilities\Currency\CurrencyAccessor')
2
-
3 1
 @php
2
+    use App\Enums\Accounting\DocumentDiscountMethod;
3
+    use App\Utilities\Currency\CurrencyAccessor;
4
+    use App\View\Models\InvoiceTotalViewModel;
5
+
4 6
     $data = $this->form->getRawState();
5
-    $viewModel = new \App\View\Models\InvoiceTotalViewModel($this->record, $data);
6
-    extract($viewModel->buildViewData(), \EXTR_SKIP);
7
+    $viewModel = new InvoiceTotalViewModel($this->record, $data);
8
+    extract($viewModel->buildViewData(), EXTR_SKIP);
7 9
 
8
-    $isInvoiceLevelDiscount = $data['discount_method'] === 'invoice';
10
+    $discountMethod = DocumentDiscountMethod::parse($data['discount_method']);
11
+    $isPerDocumentDiscount = $discountMethod->isPerDocument();
9 12
 @endphp
10 13
 
11 14
 <div class="totals-summary w-full pr-14">
@@ -29,7 +32,7 @@
29 32
                 <td class="text-sm px-4 py-2 font-medium leading-6 text-gray-950 dark:text-white">Taxes:</td>
30 33
                 <td class="text-sm pl-4 py-2 leading-6">{{ $taxTotal }}</td>
31 34
             </tr>
32
-            @if($isInvoiceLevelDiscount)
35
+            @if($isPerDocumentDiscount)
33 36
                 <tr>
34 37
                     <td colspan="4" class="text-sm px-4 py-2 font-medium leading-6 text-gray-950 dark:text-white text-right">Discount:</td>
35 38
                     <td class="text-sm px-4 py-2">

Loading…
Annulla
Salva