add work order improvements.

merge-requests/31/merge
Sikander Saleem 3 years ago
parent 5d4da1961f
commit 74b7fc4130

@ -319,11 +319,11 @@ class ServiceRequestsProvider extends ChangeNotifier {
"reason": report.reason?.toMap(), "reason": report.reason?.toMap(),
"startofWorkTime": report.startDate?.toIso8601String() ?? "", "startofWorkTime": report.startDate?.toIso8601String() ?? "",
"endofWorkTime": report.endDate?.toIso8601String() ?? "", "endofWorkTime": report.endDate?.toIso8601String() ?? "",
"workingHours": report.timer?.durationInSecond, "workingHours": ((report?.endDate?.difference(report?.startDate)?.inMinutes ?? 0) / 60),
"travelingHours": report.travelingHours, "travelingHours": report.travelingHours,
"travelingExpenses": report.travelingExpense ?? 0, "travelingExpenses": report.travelingExpense ?? 0,
"faultDescription": { "faultDescription": {
"id": report.faultDescriptionId ?? 0, "id": report.faultDescriptionId,
"defectName": report.type?.name, "defectName": report.type?.name,
"workPerformed": report.workPreformed, "workPerformed": report.workPreformed,
"estimatedTime": report.operatingHours, "estimatedTime": report.operatingHours,
@ -331,8 +331,8 @@ class ServiceRequestsProvider extends ChangeNotifier {
"sparePartsWorkOrders": report.parts "sparePartsWorkOrders": report.parts
?.map( ?.map(
(p) => { (p) => {
"id": p.id, "id": p.reportPartID ?? 0,
"sparePart": {"id": p.reportPartID ?? 0, "partNo": p.code, "partName": p.name}, "sparePart": {"id": p.id, "partNo": p.code, "partName": p.name},
"qty": p.quantity "qty": p.quantity
}, },
) )

@ -10,7 +10,7 @@ import 'package:test_sa/models/timer_model.dart';
class ServiceReport { class ServiceReport {
int id; int id;
String operatingHours; double operatingHours;
DateTime visitDate; DateTime visitDate;
DateTime endDate; DateTime endDate;
DateTime startDate; DateTime startDate;
@ -25,7 +25,7 @@ class ServiceReport {
String workPreformed; String workPreformed;
//String workHours; //String workHours;
String travelingHours; double travelingHours;
String invoiceNumber; String invoiceNumber;
String invoiceCode; String invoiceCode;
List<Part> parts; List<Part> parts;
@ -89,7 +89,7 @@ class ServiceReport {
_map["endofWorkTime"] = (timer.endAt ?? DateTime.now()).toIso8601String(); _map["endofWorkTime"] = (timer.endAt ?? DateTime.now()).toIso8601String();
_map["workingHours"] = (timer.durationInSecond / 60 / 60).toStringAsFixed(5); _map["workingHours"] = (timer.durationInSecond / 60 / 60).toStringAsFixed(5);
} }
if (travelingHours != null && travelingHours.isNotEmpty) _map["traveling_hours"] = travelingHours; if (travelingHours != null && travelingHours.toString().isNotEmpty) _map["traveling_hours"] = travelingHours;
// if(workPreformed != null && workPreformed.isNotEmpty){ // if(workPreformed != null && workPreformed.isNotEmpty){
// _map["faultDescription"] = { // _map["faultDescription"] = {
// //"id":faultDescriptionId ?? 0, // //"id":faultDescriptionId ?? 0,

Loading…
Cancel
Save