2025-10-27 10:43:28 +01:00

39 lines
1.2 KiB
Dart

class InputModel {
String szDocumentId;
String szUserId;
String szDate;
int nOdometer;
double mnLiters;
double mnPricePerLiter;
String szLocation;
double? mnTotalPrice;
InputModel({required this.szDocumentId, required this.szUserId, required this.szDate, required this.nOdometer, required this.mnLiters, required this.mnPricePerLiter, required this.szLocation, this.mnTotalPrice});
factory InputModel.fromJson(Map<String, dynamic> json) {
return InputModel(
szDocumentId: json['szDocumentId'] as String,
szUserId: json['szUserId'] as String,
szDate: json['szDate'] as String,
nOdometer: json['nOdometer'] as int,
mnLiters: json['mnLiters'] as double,
mnPricePerLiter: json['mnPricePerLiter'] as double,
szLocation: json['szLocation'] as String,
mnTotalPrice: (json['mnLiters'] as double) * (json['mnPricePerLiter'] as double),
);
}
Map<String, dynamic> toJson() {
return {
'szDocumentId': szDocumentId,
'szUserId': szUserId,
'szDate': szDate,
'nOdometer': nOdometer,
'mnLiters': mnLiters,
'mnPricePerLiter': mnPricePerLiter,
'szLocation': szLocation,
};
}
}