Andrew Wallo 6 月之前
父節點
當前提交
953fa48792

+ 13
- 9
app/Filament/Company/Resources/Sales/EstimateResource.php 查看文件

153
                                         $offeringId = $state;
153
                                         $offeringId = $state;
154
                                         $offeringRecord = Offering::with(['salesTaxes', 'salesDiscounts'])->find($offeringId);
154
                                         $offeringRecord = Offering::with(['salesTaxes', 'salesDiscounts'])->find($offeringId);
155
 
155
 
156
-                                        if ($offeringRecord) {
157
-                                            $set('description', $offeringRecord->description);
158
-                                            $set('unit_price', $offeringRecord->price);
159
-                                            $set('salesTaxes', $offeringRecord->salesTaxes->pluck('id')->toArray());
160
-
161
-                                            $discountMethod = DocumentDiscountMethod::parse($get('../../discount_method'));
162
-                                            if ($discountMethod->isPerLineItem()) {
163
-                                                $set('salesDiscounts', $offeringRecord->salesDiscounts->pluck('id')->toArray());
164
-                                            }
156
+                                        if (! $offeringRecord) {
157
+                                            return;
158
+                                        }
159
+
160
+                                        $unitPrice = CurrencyConverter::convertToFloat($offeringRecord->price, $get('../../currency_code') ?? CurrencyAccessor::getDefaultCurrency());
161
+
162
+                                        $set('description', $offeringRecord->description);
163
+                                        $set('unit_price', $unitPrice);
164
+                                        $set('salesTaxes', $offeringRecord->salesTaxes->pluck('id')->toArray());
165
+
166
+                                        $discountMethod = DocumentDiscountMethod::parse($get('../../discount_method'));
167
+                                        if ($discountMethod->isPerLineItem()) {
168
+                                            $set('salesDiscounts', $offeringRecord->salesDiscounts->pluck('id')->toArray());
165
                                         }
169
                                         }
166
                                     }),
170
                                     }),
167
                                 Forms\Components\TextInput::make('description'),
171
                                 Forms\Components\TextInput::make('description'),

+ 13
- 9
app/Filament/Company/Resources/Sales/InvoiceResource.php 查看文件

167
                                         $offeringId = $state;
167
                                         $offeringId = $state;
168
                                         $offeringRecord = Offering::with(['salesTaxes', 'salesDiscounts'])->find($offeringId);
168
                                         $offeringRecord = Offering::with(['salesTaxes', 'salesDiscounts'])->find($offeringId);
169
 
169
 
170
-                                        if ($offeringRecord) {
171
-                                            $set('description', $offeringRecord->description);
172
-                                            $set('unit_price', $offeringRecord->price);
173
-                                            $set('salesTaxes', $offeringRecord->salesTaxes->pluck('id')->toArray());
174
-
175
-                                            $discountMethod = DocumentDiscountMethod::parse($get('../../discount_method'));
176
-                                            if ($discountMethod->isPerLineItem()) {
177
-                                                $set('salesDiscounts', $offeringRecord->salesDiscounts->pluck('id')->toArray());
178
-                                            }
170
+                                        if (! $offeringRecord) {
171
+                                            return;
172
+                                        }
173
+
174
+                                        $unitPrice = CurrencyConverter::convertToFloat($offeringRecord->price, $get('../../currency_code') ?? CurrencyAccessor::getDefaultCurrency());
175
+
176
+                                        $set('description', $offeringRecord->description);
177
+                                        $set('unit_price', $unitPrice);
178
+                                        $set('salesTaxes', $offeringRecord->salesTaxes->pluck('id')->toArray());
179
+
180
+                                        $discountMethod = DocumentDiscountMethod::parse($get('../../discount_method'));
181
+                                        if ($discountMethod->isPerLineItem()) {
182
+                                            $set('salesDiscounts', $offeringRecord->salesDiscounts->pluck('id')->toArray());
179
                                         }
183
                                         }
180
                                     }),
184
                                     }),
181
                                 Forms\Components\TextInput::make('description'),
185
                                 Forms\Components\TextInput::make('description'),

+ 12
- 8
app/Filament/Company/Resources/Sales/RecurringInvoiceResource.php 查看文件

137
                                         $offeringId = $state;
137
                                         $offeringId = $state;
138
                                         $offeringRecord = Offering::with(['salesTaxes', 'salesDiscounts'])->find($offeringId);
138
                                         $offeringRecord = Offering::with(['salesTaxes', 'salesDiscounts'])->find($offeringId);
139
 
139
 
140
-                                        if ($offeringRecord) {
141
-                                            $set('description', $offeringRecord->description);
142
-                                            $set('unit_price', $offeringRecord->price);
143
-                                            $set('salesTaxes', $offeringRecord->salesTaxes->pluck('id')->toArray());
140
+                                        if (! $offeringRecord) {
141
+                                            return;
142
+                                        }
143
+
144
+                                        $unitPrice = CurrencyConverter::convertToFloat($offeringRecord->price, $get('../../currency_code') ?? CurrencyAccessor::getDefaultCurrency());
144
 
145
 
145
-                                            $discountMethod = DocumentDiscountMethod::parse($get('../../discount_method'));
146
-                                            if ($discountMethod->isPerLineItem()) {
147
-                                                $set('salesDiscounts', $offeringRecord->salesDiscounts->pluck('id')->toArray());
148
-                                            }
146
+                                        $set('description', $offeringRecord->description);
147
+                                        $set('unit_price', $unitPrice);
148
+                                        $set('salesTaxes', $offeringRecord->salesTaxes->pluck('id')->toArray());
149
+
150
+                                        $discountMethod = DocumentDiscountMethod::parse($get('../../discount_method'));
151
+                                        if ($discountMethod->isPerLineItem()) {
152
+                                            $set('salesDiscounts', $offeringRecord->salesDiscounts->pluck('id')->toArray());
149
                                         }
153
                                         }
150
                                     }),
154
                                     }),
151
                                 Forms\Components\TextInput::make('description'),
155
                                 Forms\Components\TextInput::make('description'),

Loading…
取消
儲存