toJson method
Converts the invoice to a JSON map, suitable for serializing to JSON format.
Returns a map containing the invoice data.
Implementation
Map<String, dynamic> toJson() {
return {
"id": id,
"uuid": uuid,
"issueDate": issueDate.toIso8601String().split('T')[0],
"issuedTime": issueTime.toIso8601String().split('T')[1].split('.')[0],
"currency": currency,
"supplier": supplier,
"customer": customer,
"lines": lines.map((item) => item.toJson()).toList(),
"tax": tax.toJson(),
};
}