|
|
|
@ -7,7 +7,7 @@ import 'package:diplomaticquarterapp/services/my_invoice_service/my_invoice_serv
|
|
|
|
|
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/widgets/buttons/button.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
@ -19,14 +19,13 @@ class InvoiceDetail extends StatelessWidget {
|
|
|
|
|
final DentalInvoiceDetailResponse dentalInvoiceDetailResponse;
|
|
|
|
|
final BuildContext context;
|
|
|
|
|
|
|
|
|
|
int totalServiceRate = 0;
|
|
|
|
|
int totalDiscount = 0;
|
|
|
|
|
int totalVAT = 0;
|
|
|
|
|
int subTotal = 0;
|
|
|
|
|
int grandTotal = 0;
|
|
|
|
|
dynamic totalServiceRate = 0;
|
|
|
|
|
dynamic totalDiscount = 0;
|
|
|
|
|
dynamic totalVAT = 0;
|
|
|
|
|
dynamic subTotal = 0;
|
|
|
|
|
dynamic grandTotal = 0;
|
|
|
|
|
|
|
|
|
|
InvoiceDetail(this.doctor, this.listDentalAppointments,
|
|
|
|
|
this.dentalInvoiceDetailResponse, this.context);
|
|
|
|
|
InvoiceDetail(this.doctor, this.listDentalAppointments, this.dentalInvoiceDetailResponse, this.context);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
@ -35,18 +34,16 @@ class InvoiceDetail extends StatelessWidget {
|
|
|
|
|
appBarTitle: TranslationBase.of(context).myInvoice,
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
isShowDecPage: false,
|
|
|
|
|
showNewAppBar: true,
|
|
|
|
|
showNewAppBarTitle: true,
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
child: Container(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
DoctorView(
|
|
|
|
|
doctor: doctor,
|
|
|
|
|
isLiveCareAppointment: false,
|
|
|
|
|
isShowFlag: false),
|
|
|
|
|
DoctorView(doctor: doctor, isLiveCareAppointment: false, isShowFlag: false),
|
|
|
|
|
Container(
|
|
|
|
|
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(
|
|
|
|
|
color: Colors.grey[800],
|
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
@ -57,34 +54,17 @@ class InvoiceDetail extends StatelessWidget {
|
|
|
|
|
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)),
|
|
|
|
|
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),
|
|
|
|
|
padding: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0, bottom: 15.0),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
@ -102,97 +82,59 @@ class InvoiceDetail extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: AppExpandableNotifier(
|
|
|
|
|
title: "Total Price: " + grandTotal.toString() + " SAR",
|
|
|
|
|
title: "Total Price: " + dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[0].grandTotal.toString() + " SAR",
|
|
|
|
|
isExpand: true,
|
|
|
|
|
bodyWidget: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
bodyWidget: Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
|
|
|
|
Table(
|
|
|
|
|
children: [
|
|
|
|
|
Table(
|
|
|
|
|
children: [
|
|
|
|
|
TableRow(children: [
|
|
|
|
|
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)),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
TableRow(children: [
|
|
|
|
|
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(dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[0].discountAmount.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(dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[0].patientVATAmount.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(dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[0].totalPatientShare.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(dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[0].totalPatientShare.toString() + " SAR",
|
|
|
|
|
textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold)),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
@ -204,50 +146,27 @@ class InvoiceDetail extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
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))),
|
|
|
|
|
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)),
|
|
|
|
|
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)),
|
|
|
|
|
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)),
|
|
|
|
|
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)),
|
|
|
|
|
child: Text(dentalInvoiceDetailResponse.listEInvoiceForDental[0].insuranceID, textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold)),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
]),
|
|
|
|
@ -261,15 +180,9 @@ class InvoiceDetail extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
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],
|
|
|
|
|
),
|
|
|
|
|
// height: 70.0,
|
|
|
|
|
margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0, bottom: 20.0),
|
|
|
|
|
child: DefaultButton(TranslationBase.of(context).sendEmail, () => {sendInvoiceEmail()}),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
@ -278,14 +191,10 @@ class InvoiceDetail extends StatelessWidget {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
MyInvoicesService myInvoicesService = new MyInvoicesService();
|
|
|
|
|
|
|
|
|
|
myInvoicesService
|
|
|
|
|
.sendDentalAppointmentInvoiceEmail(
|
|
|
|
|
12, listDentalAppointments.appointmentNo, context)
|
|
|
|
|
.then((res) {
|
|
|
|
|
myInvoicesService.sendDentalAppointmentInvoiceEmail(listDentalAppointments.projectID, listDentalAppointments.appointmentNo, context).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
AppToast.showSuccessToast(
|
|
|
|
|
message: TranslationBase.of(context).emailSentSuccessfully);
|
|
|
|
|
AppToast.showSuccessToast(message: TranslationBase.of(context).emailSentSuccessfully);
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
}
|
|
|
|
@ -299,37 +208,24 @@ class InvoiceDetail extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
List<TableRow> fullData(context) {
|
|
|
|
|
List<TableRow> tableRow = [];
|
|
|
|
|
dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation
|
|
|
|
|
.forEach((lab) {
|
|
|
|
|
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)),
|
|
|
|
|
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)),
|
|
|
|
|
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)),
|
|
|
|
|
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)),
|
|
|
|
|
child: Text(lab.total.toString() + " SAR", textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontWeight: FontWeight.w400)),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
);
|
|
|
|
|