|
@@ -148,15 +148,19 @@ class BillResource extends Resource
|
148
|
148
|
$offeringId = $state;
|
149
|
149
|
$offeringRecord = Offering::with(['purchaseTaxes', 'purchaseDiscounts'])->find($offeringId);
|
150
|
150
|
|
151
|
|
- if ($offeringRecord) {
|
152
|
|
- $set('description', $offeringRecord->description);
|
153
|
|
- $set('unit_price', $offeringRecord->price);
|
154
|
|
- $set('purchaseTaxes', $offeringRecord->purchaseTaxes->pluck('id')->toArray());
|
155
|
|
-
|
156
|
|
- $discountMethod = DocumentDiscountMethod::parse($get('../../discount_method'));
|
157
|
|
- if ($discountMethod->isPerLineItem()) {
|
158
|
|
- $set('purchaseDiscounts', $offeringRecord->purchaseDiscounts->pluck('id')->toArray());
|
159
|
|
- }
|
|
151
|
+ if (! $offeringRecord) {
|
|
152
|
+ return;
|
|
153
|
+ }
|
|
154
|
+
|
|
155
|
+ $unitPrice = CurrencyConverter::convertToFloat($offeringRecord->price, $get('../../currency_code') ?? CurrencyAccessor::getDefaultCurrency());
|
|
156
|
+
|
|
157
|
+ $set('description', $offeringRecord->description);
|
|
158
|
+ $set('unit_price', $unitPrice);
|
|
159
|
+ $set('purchaseTaxes', $offeringRecord->purchaseTaxes->pluck('id')->toArray());
|
|
160
|
+
|
|
161
|
+ $discountMethod = DocumentDiscountMethod::parse($get('../../discount_method'));
|
|
162
|
+ if ($discountMethod->isPerLineItem()) {
|
|
163
|
+ $set('purchaseDiscounts', $offeringRecord->purchaseDiscounts->pluck('id')->toArray());
|
160
|
164
|
}
|
161
|
165
|
}),
|
162
|
166
|
Forms\Components\TextInput::make('description'),
|