Dental Invoices implementation completed

merge-requests/352/head
haroon amjad 3 years ago
parent a32501f3dc
commit e28fdaade1

@ -608,6 +608,12 @@ const GET_DOCTOR_LIST_CALCULATION =
const GET_ALL_APPOINTMENTS_FOR_DENTAL_CLINIC = const GET_ALL_APPOINTMENTS_FOR_DENTAL_CLINIC =
"Services/Patients.svc/REST/GetDentalAppointments"; "Services/Patients.svc/REST/GetDentalAppointments";
const GET_DENTAL_APPOINTMENT_INVOICE =
"Services/Patients.svc/REST/HIS_eInvoiceForDentalByAppointmentNo";
const SEND_DENTAL_APPOINTMENT_INVOICE_EMAIL =
"Services/Notifications.svc/REST/SendInvoiceForDental";
class AppGlobal { class AppGlobal {
static var context; static var context;

@ -0,0 +1,489 @@
class DentalInvoiceDetailResponse {
List<ListEInvoiceForDental> listEInvoiceForDental;
DentalInvoiceDetailResponse({this.listEInvoiceForDental});
DentalInvoiceDetailResponse.fromJson(Map<String, dynamic> json) {
if (json['List_eInvoiceForDental'] != null) {
listEInvoiceForDental = new List<ListEInvoiceForDental>();
json['List_eInvoiceForDental'].forEach((v) {
listEInvoiceForDental.add(new ListEInvoiceForDental.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.listEInvoiceForDental != null) {
data['List_eInvoiceForDental'] =
this.listEInvoiceForDental.map((v) => v.toJson()).toList();
}
return data;
}
}
class ListEInvoiceForDental {
int projectID;
int doctorID;
dynamic grandTotal;
dynamic quantity;
dynamic total;
dynamic discount;
dynamic subTotal;
int invoiceNo;
String createdOn;
dynamic procedureID;
dynamic procedureName;
dynamic procedureNameN;
dynamic procedurePrice;
dynamic patientShare;
dynamic companyShare;
dynamic totalPatientShare;
dynamic totalCompanyShare;
dynamic totalShare;
dynamic discountAmount;
dynamic vATPercentage;
dynamic patientVATAmount;
dynamic companyVATAmount;
dynamic totalVATAmount;
dynamic price;
int patientID;
String patientName;
dynamic patientNameN;
String nationalityID;
String doctorName;
dynamic doctorNameN;
int clinicID;
String clinicDescription;
dynamic clinicDescriptionN;
String appointmentDate;
int appointmentNo;
String insuranceID;
int companyID;
String companyName;
dynamic companyNameN;
String companyAddress;
dynamic companyAddressN;
String companyGroupAddress;
String groupName;
dynamic groupNameN;
String patientAddress;
String vATNo;
String paymentDate;
String projectName;
dynamic totalDiscount;
dynamic totalPatientShareWithQuantity;
String legalName;
dynamic legalNameN;
dynamic advanceAdjustment;
String doctorImageURL;
List<ListConsultation> listConsultation;
ListEInvoiceForDental(
{this.projectID,
this.doctorID,
this.grandTotal,
this.quantity,
this.total,
this.discount,
this.subTotal,
this.invoiceNo,
this.createdOn,
this.procedureID,
this.procedureName,
this.procedureNameN,
this.procedurePrice,
this.patientShare,
this.companyShare,
this.totalPatientShare,
this.totalCompanyShare,
this.totalShare,
this.discountAmount,
this.vATPercentage,
this.patientVATAmount,
this.companyVATAmount,
this.totalVATAmount,
this.price,
this.patientID,
this.patientName,
this.patientNameN,
this.nationalityID,
this.doctorName,
this.doctorNameN,
this.clinicID,
this.clinicDescription,
this.clinicDescriptionN,
this.appointmentDate,
this.appointmentNo,
this.insuranceID,
this.companyID,
this.companyName,
this.companyNameN,
this.companyAddress,
this.companyAddressN,
this.companyGroupAddress,
this.groupName,
this.groupNameN,
this.patientAddress,
this.vATNo,
this.paymentDate,
this.projectName,
this.totalDiscount,
this.totalPatientShareWithQuantity,
this.legalName,
this.legalNameN,
this.advanceAdjustment,
this.doctorImageURL,
this.listConsultation});
ListEInvoiceForDental.fromJson(Map<String, dynamic> json) {
projectID = json['ProjectID'];
doctorID = json['DoctorID'];
grandTotal = json['GrandTotal'];
quantity = json['Quantity'];
total = json['Total'];
discount = json['Discount'];
subTotal = json['SubTotal'];
invoiceNo = json['InvoiceNo'];
createdOn = json['CreatedOn'];
procedureID = json['ProcedureID'];
procedureName = json['ProcedureName'];
procedureNameN = json['ProcedureNameN'];
procedurePrice = json['ProcedurePrice'];
patientShare = json['PatientShare'];
companyShare = json['CompanyShare'];
totalPatientShare = json['TotalPatientShare'];
totalCompanyShare = json['TotalCompanyShare'];
totalShare = json['TotalShare'];
discountAmount = json['DiscountAmount'];
vATPercentage = json['VATPercentage'];
patientVATAmount = json['PatientVATAmount'];
companyVATAmount = json['CompanyVATAmount'];
totalVATAmount = json['TotalVATAmount'];
price = json['Price'];
patientID = json['PatientID'];
patientName = json['PatientName'];
patientNameN = json['PatientNameN'];
nationalityID = json['NationalityID'];
doctorName = json['DoctorName'];
doctorNameN = json['DoctorNameN'];
clinicID = json['ClinicID'];
clinicDescription = json['ClinicDescription'];
clinicDescriptionN = json['ClinicDescriptionN'];
appointmentDate = json['AppointmentDate'];
appointmentNo = json['AppointmentNo'];
insuranceID = json['InsuranceID'];
companyID = json['CompanyID'];
companyName = json['CompanyName'];
companyNameN = json['CompanyNameN'];
companyAddress = json['CompanyAddress'];
companyAddressN = json['CompanyAddressN'];
companyGroupAddress = json['CompanyGroupAddress'];
groupName = json['GroupName'];
groupNameN = json['GroupNameN'];
patientAddress = json['PatientAddress'];
vATNo = json['VATNo'];
paymentDate = json['PaymentDate'];
projectName = json['ProjectName'];
totalDiscount = json['TotalDiscount'];
totalPatientShareWithQuantity = json['TotalPatientShareWithQuantity'];
legalName = json['LegalName'];
legalNameN = json['LegalNameN'];
advanceAdjustment = json['AdvanceAdjustment'];
doctorImageURL = json['DoctorImageURL'];
if (json['listConsultation'] != null) {
listConsultation = new List<ListConsultation>();
json['listConsultation'].forEach((v) {
listConsultation.add(new ListConsultation.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ProjectID'] = this.projectID;
data['DoctorID'] = this.doctorID;
data['GrandTotal'] = this.grandTotal;
data['Quantity'] = this.quantity;
data['Total'] = this.total;
data['Discount'] = this.discount;
data['SubTotal'] = this.subTotal;
data['InvoiceNo'] = this.invoiceNo;
data['CreatedOn'] = this.createdOn;
data['ProcedureID'] = this.procedureID;
data['ProcedureName'] = this.procedureName;
data['ProcedureNameN'] = this.procedureNameN;
data['ProcedurePrice'] = this.procedurePrice;
data['PatientShare'] = this.patientShare;
data['CompanyShare'] = this.companyShare;
data['TotalPatientShare'] = this.totalPatientShare;
data['TotalCompanyShare'] = this.totalCompanyShare;
data['TotalShare'] = this.totalShare;
data['DiscountAmount'] = this.discountAmount;
data['VATPercentage'] = this.vATPercentage;
data['PatientVATAmount'] = this.patientVATAmount;
data['CompanyVATAmount'] = this.companyVATAmount;
data['TotalVATAmount'] = this.totalVATAmount;
data['Price'] = this.price;
data['PatientID'] = this.patientID;
data['PatientName'] = this.patientName;
data['PatientNameN'] = this.patientNameN;
data['NationalityID'] = this.nationalityID;
data['DoctorName'] = this.doctorName;
data['DoctorNameN'] = this.doctorNameN;
data['ClinicID'] = this.clinicID;
data['ClinicDescription'] = this.clinicDescription;
data['ClinicDescriptionN'] = this.clinicDescriptionN;
data['AppointmentDate'] = this.appointmentDate;
data['AppointmentNo'] = this.appointmentNo;
data['InsuranceID'] = this.insuranceID;
data['CompanyID'] = this.companyID;
data['CompanyName'] = this.companyName;
data['CompanyNameN'] = this.companyNameN;
data['CompanyAddress'] = this.companyAddress;
data['CompanyAddressN'] = this.companyAddressN;
data['CompanyGroupAddress'] = this.companyGroupAddress;
data['GroupName'] = this.groupName;
data['GroupNameN'] = this.groupNameN;
data['PatientAddress'] = this.patientAddress;
data['VATNo'] = this.vATNo;
data['PaymentDate'] = this.paymentDate;
data['ProjectName'] = this.projectName;
data['TotalDiscount'] = this.totalDiscount;
data['TotalPatientShareWithQuantity'] = this.totalPatientShareWithQuantity;
data['LegalName'] = this.legalName;
data['LegalNameN'] = this.legalNameN;
data['AdvanceAdjustment'] = this.advanceAdjustment;
data['DoctorImageURL'] = this.doctorImageURL;
if (this.listConsultation != null) {
data['listConsultation'] =
this.listConsultation.map((v) => v.toJson()).toList();
}
return data;
}
}
class ListConsultation {
dynamic projectID;
dynamic doctorID;
dynamic grandTotal;
int quantity;
int total;
dynamic discount;
int subTotal;
dynamic invoiceNo;
dynamic createdOn;
String procedureID;
String procedureName;
dynamic procedureNameN;
dynamic procedurePrice;
int patientShare;
dynamic companyShare;
int totalPatientShare;
dynamic totalCompanyShare;
dynamic totalShare;
dynamic discountAmount;
int vATPercentage;
int patientVATAmount;
dynamic companyVATAmount;
dynamic totalVATAmount;
int price;
dynamic patientID;
dynamic patientName;
dynamic patientNameN;
dynamic nationalityID;
dynamic doctorName;
dynamic doctorNameN;
dynamic clinicID;
dynamic clinicDescription;
dynamic clinicDescriptionN;
dynamic appointmentDate;
dynamic appointmentNo;
dynamic insuranceID;
dynamic companyID;
dynamic companyName;
dynamic companyNameN;
dynamic companyAddress;
dynamic companyAddressN;
dynamic companyGroupAddress;
dynamic groupName;
dynamic groupNameN;
dynamic patientAddress;
String vATNo;
dynamic paymentDate;
dynamic projectName;
dynamic totalDiscount;
dynamic totalPatientShareWithQuantity;
dynamic legalName;
dynamic legalNameN;
int advanceAdjustment;
ListConsultation(
{this.projectID,
this.doctorID,
this.grandTotal,
this.quantity,
this.total,
this.discount,
this.subTotal,
this.invoiceNo,
this.createdOn,
this.procedureID,
this.procedureName,
this.procedureNameN,
this.procedurePrice,
this.patientShare,
this.companyShare,
this.totalPatientShare,
this.totalCompanyShare,
this.totalShare,
this.discountAmount,
this.vATPercentage,
this.patientVATAmount,
this.companyVATAmount,
this.totalVATAmount,
this.price,
this.patientID,
this.patientName,
this.patientNameN,
this.nationalityID,
this.doctorName,
this.doctorNameN,
this.clinicID,
this.clinicDescription,
this.clinicDescriptionN,
this.appointmentDate,
this.appointmentNo,
this.insuranceID,
this.companyID,
this.companyName,
this.companyNameN,
this.companyAddress,
this.companyAddressN,
this.companyGroupAddress,
this.groupName,
this.groupNameN,
this.patientAddress,
this.vATNo,
this.paymentDate,
this.projectName,
this.totalDiscount,
this.totalPatientShareWithQuantity,
this.legalName,
this.legalNameN,
this.advanceAdjustment});
ListConsultation.fromJson(Map<String, dynamic> json) {
projectID = json['ProjectID'];
doctorID = json['DoctorID'];
grandTotal = json['GrandTotal'];
quantity = json['Quantity'];
total = json['Total'];
discount = json['Discount'];
subTotal = json['SubTotal'];
invoiceNo = json['InvoiceNo'];
createdOn = json['CreatedOn'];
procedureID = json['ProcedureID'];
procedureName = json['ProcedureName'];
procedureNameN = json['ProcedureNameN'];
procedurePrice = json['ProcedurePrice'];
patientShare = json['PatientShare'];
companyShare = json['CompanyShare'];
totalPatientShare = json['TotalPatientShare'];
totalCompanyShare = json['TotalCompanyShare'];
totalShare = json['TotalShare'];
discountAmount = json['DiscountAmount'];
vATPercentage = json['VATPercentage'];
patientVATAmount = json['PatientVATAmount'];
companyVATAmount = json['CompanyVATAmount'];
totalVATAmount = json['TotalVATAmount'];
price = json['Price'];
patientID = json['PatientID'];
patientName = json['PatientName'];
patientNameN = json['PatientNameN'];
nationalityID = json['NationalityID'];
doctorName = json['DoctorName'];
doctorNameN = json['DoctorNameN'];
clinicID = json['ClinicID'];
clinicDescription = json['ClinicDescription'];
clinicDescriptionN = json['ClinicDescriptionN'];
appointmentDate = json['AppointmentDate'];
appointmentNo = json['AppointmentNo'];
insuranceID = json['InsuranceID'];
companyID = json['CompanyID'];
companyName = json['CompanyName'];
companyNameN = json['CompanyNameN'];
companyAddress = json['CompanyAddress'];
companyAddressN = json['CompanyAddressN'];
companyGroupAddress = json['CompanyGroupAddress'];
groupName = json['GroupName'];
groupNameN = json['GroupNameN'];
patientAddress = json['PatientAddress'];
vATNo = json['VATNo'];
paymentDate = json['PaymentDate'];
projectName = json['ProjectName'];
totalDiscount = json['TotalDiscount'];
totalPatientShareWithQuantity = json['TotalPatientShareWithQuantity'];
legalName = json['LegalName'];
legalNameN = json['LegalNameN'];
advanceAdjustment = json['AdvanceAdjustment'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ProjectID'] = this.projectID;
data['DoctorID'] = this.doctorID;
data['GrandTotal'] = this.grandTotal;
data['Quantity'] = this.quantity;
data['Total'] = this.total;
data['Discount'] = this.discount;
data['SubTotal'] = this.subTotal;
data['InvoiceNo'] = this.invoiceNo;
data['CreatedOn'] = this.createdOn;
data['ProcedureID'] = this.procedureID;
data['ProcedureName'] = this.procedureName;
data['ProcedureNameN'] = this.procedureNameN;
data['ProcedurePrice'] = this.procedurePrice;
data['PatientShare'] = this.patientShare;
data['CompanyShare'] = this.companyShare;
data['TotalPatientShare'] = this.totalPatientShare;
data['TotalCompanyShare'] = this.totalCompanyShare;
data['TotalShare'] = this.totalShare;
data['DiscountAmount'] = this.discountAmount;
data['VATPercentage'] = this.vATPercentage;
data['PatientVATAmount'] = this.patientVATAmount;
data['CompanyVATAmount'] = this.companyVATAmount;
data['TotalVATAmount'] = this.totalVATAmount;
data['Price'] = this.price;
data['PatientID'] = this.patientID;
data['PatientName'] = this.patientName;
data['PatientNameN'] = this.patientNameN;
data['NationalityID'] = this.nationalityID;
data['DoctorName'] = this.doctorName;
data['DoctorNameN'] = this.doctorNameN;
data['ClinicID'] = this.clinicID;
data['ClinicDescription'] = this.clinicDescription;
data['ClinicDescriptionN'] = this.clinicDescriptionN;
data['AppointmentDate'] = this.appointmentDate;
data['AppointmentNo'] = this.appointmentNo;
data['InsuranceID'] = this.insuranceID;
data['CompanyID'] = this.companyID;
data['CompanyName'] = this.companyName;
data['CompanyNameN'] = this.companyNameN;
data['CompanyAddress'] = this.companyAddress;
data['CompanyAddressN'] = this.companyAddressN;
data['CompanyGroupAddress'] = this.companyGroupAddress;
data['GroupName'] = this.groupName;
data['GroupNameN'] = this.groupNameN;
data['PatientAddress'] = this.patientAddress;
data['VATNo'] = this.vATNo;
data['PaymentDate'] = this.paymentDate;
data['ProjectName'] = this.projectName;
data['TotalDiscount'] = this.totalDiscount;
data['TotalPatientShareWithQuantity'] = this.totalPatientShareWithQuantity;
data['LegalName'] = this.legalName;
data['LegalNameN'] = this.legalNameN;
data['AdvanceAdjustment'] = this.advanceAdjustment;
return data;
}
}

@ -1,8 +1,14 @@
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/models/MyInvoices/DentalInvoiceDetailResponse.dart';
import 'package:diplomaticquarterapp/models/MyInvoices/GetDentalAppointmentsResponse.dart'; import 'package:diplomaticquarterapp/models/MyInvoices/GetDentalAppointmentsResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart';
import 'package:diplomaticquarterapp/services/my_invoice_service/my_invoice_services.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -10,8 +16,17 @@ import 'package:provider/provider.dart';
class InvoiceDetail extends StatelessWidget { class InvoiceDetail extends StatelessWidget {
final DoctorList doctor; final DoctorList doctor;
final ListDentalAppointments listDentalAppointments; final ListDentalAppointments listDentalAppointments;
final DentalInvoiceDetailResponse dentalInvoiceDetailResponse;
final BuildContext context;
InvoiceDetail(this.doctor, this.listDentalAppointments); int totalServiceRate = 0;
int totalDiscount = 0;
int totalVAT = 0;
int subTotal = 0;
int grandTotal = 0;
InvoiceDetail(this.doctor, this.listDentalAppointments,
this.dentalInvoiceDetailResponse, this.context);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -20,13 +35,18 @@ class InvoiceDetail extends StatelessWidget {
appBarTitle: TranslationBase.of(context).myInvoice, appBarTitle: TranslationBase.of(context).myInvoice,
isShowAppBar: true, isShowAppBar: true,
isShowDecPage: false, isShowDecPage: false,
body: Container( body: SingleChildScrollView(
child: Container(
child: Column( child: Column(
children: [ children: [
DoctorView(doctor: doctor, isLiveCareAppointment: false, isShowFlag: false), DoctorView(
doctor: doctor,
isLiveCareAppointment: false,
isShowFlag: false),
Container( Container(
margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), margin: EdgeInsets.only(left: 10.0, right: 10.0),
padding: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0, bottom: 10.0), padding: EdgeInsets.only(
top: 10.0, left: 10.0, right: 10.0, bottom: 10.0),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.grey[800], color: Colors.grey[800],
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
@ -34,18 +54,286 @@ class InvoiceDetail extends StatelessWidget {
topRight: Radius.circular(8), topRight: Radius.circular(8),
), ),
), ),
child: Row( child: Table(
children: [
TableRow(children: [
Text("Description",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold)),
Text("Quantity",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold)),
Text("Price",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold)),
Text("Total",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold)),
]),
],
),
),
Container(
margin: EdgeInsets.only(top: 0.0, left: 10.0, right: 10.0),
padding: EdgeInsets.only(
top: 10.0, left: 10.0, right: 10.0, bottom: 15.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(8),
bottomRight: Radius.circular(8),
)),
child: Table(children: fullData(context)),
),
Container(
margin: EdgeInsets.only(top: 3.0, left: 12.0, right: 12.0),
child: Divider(
color: Colors.grey[400],
thickness: 0.7,
),
),
Container(
child: AppExpandableNotifier(
title: "Total Price: " + grandTotal.toString() + " SAR",
isExpand: true,
bodyWidget: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text("Description", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)), Table(
Text("Quantity", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)), children: [
Text("Price", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)), TableRow(children: [
Text("Total", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)), Container(
margin: EdgeInsets.only(top: 10.0),
child: Text("Discount: ",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold)),
),
Container(
margin: EdgeInsets.only(top: 10.0),
child: Text(totalDiscount.toString() + " SAR",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold)),
),
]),
TableRow(children: [
Container(
margin: EdgeInsets.only(top: 10.0),
child: Text(
"VAT (" +
dentalInvoiceDetailResponse
.listEInvoiceForDental[0]
.listConsultation[0]
.vATPercentage
.toString() +
"%)",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold)),
),
Container(
margin: EdgeInsets.only(top: 10.0),
child: Text(totalVAT.toString() + " SAR",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold)),
),
]),
TableRow(children: [
Container(
margin: EdgeInsets.only(top: 10.0),
child: Text("Total: ",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold)),
),
Container(
margin: EdgeInsets.only(top: 10.0),
child: Text(grandTotal.toString() + " SAR",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold)),
),
]),
TableRow(children: [
Container(
margin: EdgeInsets.only(top: 10.0),
child: Text("Paid: ",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold)),
),
Container(
margin:
EdgeInsets.only(top: 10.0, bottom: 10.0),
child: Text(grandTotal.toString() + " SAR",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold)),
),
]),
], ],
), ),
]),
),
),
Container(
margin: EdgeInsets.only(top: 3.0, left: 12.0, right: 12.0),
child: Divider(
color: Colors.grey[400],
thickness: 0.7,
),
),
Container(
margin: EdgeInsets.only(top: 0.0, left: 10.0, right: 10.0),
padding: EdgeInsets.only(
top: 10.0, left: 10.0, right: 10.0, bottom: 15.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(8))),
child: Table(children: [
TableRow(children: [
Container(
margin: EdgeInsets.only(top: 10.0),
child: Text("Insurance: ",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold)),
),
Container(
margin: EdgeInsets.only(top: 10.0, bottom: 5.0),
child: Text(
dentalInvoiceDetailResponse
.listEInvoiceForDental[0].companyName,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold)),
),
]),
TableRow(children: [
Container(
margin: EdgeInsets.only(top: 10.0),
child: Text("Insurance ID: ",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold)),
),
Container(
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
child: Text(
dentalInvoiceDetailResponse
.listEInvoiceForDental[0].insuranceID,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold)),
),
]),
]),
),
SizedBox(
height: 100.0,
), ),
], ],
), ),
)); ),
),
bottomSheet: Container(
width: MediaQuery.of(context).size.width,
height: 70.0,
margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0),
child: Button(
onTap: () {
sendInvoiceEmail();
},
label: TranslationBase.of(context).sendEmail,
backgroundColor: Colors.red[900],
),
),
);
}
sendInvoiceEmail() {
GifLoaderDialogUtils.showMyDialog(context);
MyInvoicesService myInvoicesService = new MyInvoicesService();
myInvoicesService
.sendDentalAppointmentInvoiceEmail(
12, listDentalAppointments.appointmentNo, context)
.then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res['MessageStatus'] == 1) {
AppToast.showSuccessToast(
message: TranslationBase.of(context).emailSentSuccessfully);
} else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
AppToast.showErrorToast(message: err);
Navigator.of(context).pop();
});
}
List<TableRow> fullData(context) {
List<TableRow> tableRow = [];
dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation
.forEach((lab) {
tableRow.add(
TableRow(children: [
Container(
margin: EdgeInsets.only(top: 10.0),
child: Text(lab.procedureName,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black, fontWeight: FontWeight.w400)),
),
Container(
margin: EdgeInsets.only(top: 10.0),
child: Text(lab.quantity.toString(),
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black, fontWeight: FontWeight.w400)),
),
Container(
margin: EdgeInsets.only(top: 10.0),
child: Text(lab.price.toString() + " SAR",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black, fontWeight: FontWeight.w400)),
),
Container(
margin: EdgeInsets.only(top: 10.0),
child: Text(lab.total.toString() + " SAR",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black, fontWeight: FontWeight.w400)),
),
]),
);
});
return tableRow;
} }
} }

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart' import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'
as DoctorListResponse; as DoctorListResponse;
import 'package:diplomaticquarterapp/models/MyInvoices/DentalInvoiceDetailResponse.dart';
import 'package:diplomaticquarterapp/models/MyInvoices/GetDentalAppointmentsResponse.dart'; import 'package:diplomaticquarterapp/models/MyInvoices/GetDentalAppointmentsResponse.dart';
import 'package:diplomaticquarterapp/pages/medical/my_invoices/invoice_detail_page.dart'; import 'package:diplomaticquarterapp/pages/medical/my_invoices/invoice_detail_page.dart';
import 'package:diplomaticquarterapp/services/my_invoice_service/my_invoice_services.dart'; import 'package:diplomaticquarterapp/services/my_invoice_service/my_invoice_services.dart';
@ -21,6 +22,7 @@ class MyInvoices extends StatefulWidget {
class _MyInvoicesState extends State<MyInvoices> { class _MyInvoicesState extends State<MyInvoices> {
bool isDataLoaded = false; bool isDataLoaded = false;
GetDentalAppointmentsResponse getDentalAppointmentsResponse; GetDentalAppointmentsResponse getDentalAppointmentsResponse;
DentalInvoiceDetailResponse dentalInvoiceDetailResponse;
@override @override
void initState() { void initState() {
@ -36,7 +38,7 @@ class _MyInvoicesState extends State<MyInvoices> {
return AppScaffold( return AppScaffold(
appBarTitle: TranslationBase.of(context).myInvoice, appBarTitle: TranslationBase.of(context).myInvoice,
isShowAppBar: true, isShowAppBar: true,
isShowDecPage: false, isShowDecPage: true,
body: Container( body: Container(
child: SingleChildScrollView( child: SingleChildScrollView(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
@ -186,6 +188,9 @@ class _MyInvoicesState extends State<MyInvoices> {
} }
openInvoiceDetailsPage(ListDentalAppointments listDentalAppointments) { openInvoiceDetailsPage(ListDentalAppointments listDentalAppointments) {
GifLoaderDialogUtils.showMyDialog(context);
MyInvoicesService myInvoicesService = new MyInvoicesService();
DoctorListResponse.DoctorList doctor = new DoctorListResponse.DoctorList(); DoctorListResponse.DoctorList doctor = new DoctorListResponse.DoctorList();
doctor.name = listDentalAppointments.doctorName; doctor.name = listDentalAppointments.doctorName;
@ -197,13 +202,33 @@ class _MyInvoicesState extends State<MyInvoices> {
doctor.doctorTitle = "Dr."; doctor.doctorTitle = "Dr.";
doctor.clinicName = "InvoiceNo: " + listDentalAppointments.invoiceNo.toString(); doctor.clinicName = "InvoiceNo: " + listDentalAppointments.invoiceNo.toString();
myInvoicesService.getDentalAppointmentInvoice(12, listDentalAppointments.appointmentNo, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
setState(() {
if (res['MessageStatus'] == 1) {
dentalInvoiceDetailResponse =
DentalInvoiceDetailResponse.fromJson(res);
print(dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation.length);
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: InvoiceDetail( page: InvoiceDetail(
doctor, doctor,
listDentalAppointments, listDentalAppointments,
dentalInvoiceDetailResponse,
context
))); )));
} else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
}
isDataLoaded = true;
});
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
AppToast.showErrorToast(message: err.toString());
Navigator.of(context).pop();
});
} }
getDentalAppointments() { getDentalAppointments() {
@ -216,9 +241,6 @@ class _MyInvoicesState extends State<MyInvoices> {
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
getDentalAppointmentsResponse = getDentalAppointmentsResponse =
GetDentalAppointmentsResponse.fromJson(res); GetDentalAppointmentsResponse.fromJson(res);
print(getDentalAppointmentsResponse.listDentalAppointments.length);
print(getDentalAppointmentsResponse
.listDentalAppointments[0].appointmentNo);
} else { } else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']); AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
} }

@ -13,8 +13,7 @@ class MyInvoicesService extends BaseService {
AuthenticatedUser authUser = new AuthenticatedUser(); AuthenticatedUser authUser = new AuthenticatedUser();
AuthProvider authProvider = new AuthProvider(); AuthProvider authProvider = new AuthProvider();
Future<Map> getAllDentalAppointments(int projectID, Future<Map> getAllDentalAppointments(int projectID, context) async {
context) async {
Map<String, dynamic> request; Map<String, dynamic> request;
var languageID = var languageID =
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
@ -45,9 +44,78 @@ class MyInvoicesService extends BaseService {
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
throw error; throw error;
}, body: request); }, body: request);
return Future.value( return Future.value(localRes);
localRes }
);
Future<Map> getDentalAppointmentInvoice(int projectID, int appoNo, context) async {
Map<String, dynamic> request;
var languageID =
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
Request req = appGlobal.getPublicRequest();
request = {
"LanguageID": languageID == 'ar' ? 1 : 2,
"IPAdress": "10.20.10.20",
"VersionID": req.VersionID,
"Channel": req.Channel,
"generalid": 'Cs2020@2016\$2958',
"PatientOutSA": authUser.outSA,
"DeviceTypeID": req.DeviceTypeID,
"SessionID": null,
"PatientID": authUser.patientID,
"License": true,
"AppointmentNo": appoNo,
"IsRegistered": true,
"ProjectID": projectID,
"PatientTypeID": authUser.patientIdentificationType,
"PatientType": authUser.patientType,
"isDentalAllowedBackend": false
};
dynamic localRes;
await baseAppClient.post(GET_DENTAL_APPOINTMENT_INVOICE,
onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
Future<Map> sendDentalAppointmentInvoiceEmail(int projectID, int appoNo, context) async {
Map<String, dynamic> request;
var languageID =
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
Request req = appGlobal.getPublicRequest();
request = {
"LanguageID": languageID == 'ar' ? 1 : 2,
"IPAdress": "10.20.10.20",
"VersionID": req.VersionID,
"Channel": req.Channel,
"generalid": 'Cs2020@2016\$2958',
"PatientOutSA": authUser.outSA,
"DeviceTypeID": req.DeviceTypeID,
"SessionID": null,
"PatientID": authUser.patientID,
"License": true,
"AppointmentNo": appoNo,
"To": authUser.emailAddress,
"IsRegistered": true,
"ProjectID": projectID,
"PatientTypeID": authUser.patientIdentificationType,
"PatientType": authUser.patientType,
"isDentalAllowedBackend": false
};
dynamic localRes;
await baseAppClient.post(SEND_DENTAL_APPOINTMENT_INVOICE_EMAIL,
onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
} }
} }
Loading…
Cancel
Save