mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 21:20:57 +00:00
Enhance contract management by adding booking windows section and updating invoice logic for offloaded cargo
This commit is contained in:
@@ -395,14 +395,20 @@ export class GlOperationsService {
|
||||
}
|
||||
if (!file) throw new BadRequestException('Attach the invoice document.');
|
||||
|
||||
// Invoiceable once cargo is offloaded, or — for export, where OFFLOADED is a
|
||||
// DJ doc milestone that may never be recorded — once the Djibouti gate pass
|
||||
// is secured. The invoice itself stays optional; nothing forces GL DJ to send one.
|
||||
const milestones = await this.milestoneService.listForBooking(bookingId);
|
||||
const offloaded = milestones.find(
|
||||
(m) => m.milestoneCode === 'OFFLOADED' && m.status === 'COMPLETED',
|
||||
);
|
||||
if (!offloaded) {
|
||||
throw new BadRequestException(
|
||||
'Cargo must be offloaded before the final invoice can be raised.',
|
||||
);
|
||||
const gatepass = await this.gatepassForBooking(bookingId);
|
||||
if (!gatepass.granted) {
|
||||
throw new BadRequestException(
|
||||
'Cargo must be offloaded (or the gate pass secured) before the final invoice can be raised.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const existing = await this.billingService.findInvoice(
|
||||
|
||||
Reference in New Issue
Block a user