diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart index 5abb4122..9c03e92c 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart @@ -852,8 +852,8 @@ class _AnicllaryOrdersState extends State with SingleTic addAdvancedNumberRequest(String advanceNumber, String paymentReference, dynamic appointmentID, AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, localContext).then((res) { - // autoGenerateInvoice(); - showAlertDialog("123123123", widget.projectID); + autoGenerateInvoice(); + // showAlertDialog("123123123", widget.projectID); }).catchError((err) { GifLoaderDialogUtils.hideDialog(localContext); AppToast.showErrorToast(message: err.toString()); diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 8e1914b4..65b321ea 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -1220,7 +1220,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { showNfcReader(context, onNcfScan: (String nfcId) { Future.delayed(const Duration(milliseconds: 100), () { print(nfcId); - autoGenerateInvoice(ancillaryOrderList, projectID); + generateQueueNumber(ancillaryOrderList, projectID); // getProjectIDFromNFC(nfcId, true); // Navigator.push(context, FadePage(page: EROnlineCheckInPaymentDetails())); }); @@ -1237,7 +1237,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { String onlineCheckInQRCode = (await BarcodeScanner.scan().then((value) => value.rawContent)); if (onlineCheckInQRCode != "") { print(onlineCheckInQRCode); - autoGenerateInvoice(ancillaryOrderList, projectID); + generateQueueNumber(ancillaryOrderList, projectID); // getProjectIDFromNFC(onlineCheckInQRCode, true); // sendNfcCheckInRequest(onlineCheckInQRCode, 2); } else {} @@ -1267,7 +1267,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { print(dist); if (dist <= projectDetailListModel.geofenceRadius!) { GifLoaderDialogUtils.hideDialog(context); - autoGenerateInvoice(ancillaryOrderList, projectID); + generateQueueNumber(ancillaryOrderList, projectID); // sendNfcCheckInRequest(projectDetailListModel.checkInQrCode!, 2); } else { GifLoaderDialogUtils.hideDialog(context); @@ -1681,23 +1681,16 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { }); } - autoGenerateInvoice(AncillaryOrderList ancillaryOrderList, int projectID) { - List selectedProcListAPI = []; - - ancillaryOrderList.ancillaryProcedureListModels!.forEach((element) { - selectedProcListAPI.add({ - "ApprovalLineItemNo": element.approvalLineItemNo, - "OrderLineItemNo": element.orderLineItemNo, - "ProcedureID": element.procedureID, - }); - }); - + generateQueueNumber(AncillaryOrderList ancillaryOrderList, int projectID) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.autoGenerateAncillaryOrdersInvoice(ancillaryOrderList.orderNo, projectID, ancillaryOrderList.appointmentNo, selectedProcListAPI, projectViewModel.isArabic ? 1 : 2, context).then((res) { + service + .getLabQueueNumber(projectID, projectViewModel.authenticatedUserObject.user.patientID!, Utils.isVidaPlusProject(projectViewModel, projectID), ancillaryOrderList.orderNo.toString(), + ancillaryOrderList.orderNo.toString()) + .then((res) { GifLoaderDialogUtils.hideDialog(context); - showAlertDialog(res['AncillaryOrderInvoiceList'][0]['PatientCallNo']); + showAlertDialog(res['QLineResponse']['PatientCallNo']); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: err); @@ -1705,6 +1698,30 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { }); } + // autoGenerateInvoice(AncillaryOrderList ancillaryOrderList, int projectID) { + // List selectedProcListAPI = []; + // + // ancillaryOrderList.ancillaryProcedureListModels!.forEach((element) { + // selectedProcListAPI.add({ + // "ApprovalLineItemNo": element.approvalLineItemNo, + // "OrderLineItemNo": element.orderLineItemNo, + // "ProcedureID": element.procedureID, + // }); + // }); + // + // GifLoaderDialogUtils.showMyDialog(context); + // + // DoctorsListService service = new DoctorsListService(); + // service.autoGenerateAncillaryOrdersInvoice(ancillaryOrderList.orderNo, projectID, ancillaryOrderList.appointmentNo, selectedProcListAPI, projectViewModel.isArabic ? 1 : 2, context).then((res) { + // GifLoaderDialogUtils.hideDialog(context); + // showAlertDialog(res['AncillaryOrderInvoiceList'][0]['PatientCallNo']); + // }).catchError((err) { + // GifLoaderDialogUtils.hideDialog(context); + // AppToast.showErrorToast(message: err); + // print(err); + // }); + // } + showAlertDialog(dynamic queueNo) { AlertDialogBox( context: context, diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 54cdc11a..92ed6590 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -2001,4 +2001,23 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + + Future getLabQueueNumber(int projectID, int patientID, bool isVidaPlus, String invoiceNo, String orderNo) async { + Map request; + request = { + "LanguageID": 1, + "QLineLabPatientCallNoGetModel": {"projectID": projectID, "patientID": patientID, "isVidaPlus": isVidaPlus, "invoiceNo": invoiceNo, "orderNo": orderNo} + }; + + hasError = false; + dynamic localRes; + await baseAppClient.post(GET_PATIENT_LAB_QUEUE_NUMBER, onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); + + return Future.value(localRes); + } }