Add cost/price/supplierid to service, update service report to show supplerid and overridden costs (if any)

This commit is contained in:
2025-05-16 20:36:27 +10:00
parent 8d72c1ceb5
commit b33c052995
8 changed files with 78 additions and 43 deletions

View File

@@ -412,7 +412,9 @@ class ServiceController extends Controller
'suspend_billing' => 'nullable|in:on',
'recur_schedule' => ['required',Rule::in(collect(Invoice::billing_periods)->keys())],
'invoice_next_at' => 'nullable|date',
'price' => 'nullable|numeric',
'price' => 'nullable|numeric|min:0', // Price we charge the client, if we dont charge supplied/price
'cost' => 'nullable|numeric|min:0', // Price we are charged by supplier, if we arent charged supplier/price
'supplierid' => 'nullable|string|min:1', // As used on invoices
$o->product->category => 'array|min:1',
]
)
@@ -456,6 +458,8 @@ class ServiceController extends Controller
$o->suspend_billing = ($validated->get('suspend_billing') == 'on');
$o->external_billing = ($validated->get('external_billing') == 'on');
$o->price = $validated->get('price');
$o->cost = $validated->get('cost');
$o->supplierid = $validated->get('supplierid');
// Also update our service start_at date.
// @todo We may want to make start_at/stop_at dynamic values calculated by the type records