updates & fixes

merge-requests/400/head
haroon amjad 3 years ago
parent bbcf22ddfa
commit 4ac0845003

@ -99,8 +99,10 @@ class InsuranceCardService extends BaseService {
}
Future getSharedRecordByStatus() async {
if (await sharedPref.getObject(FAMILY_FILE) != null) {
return Future.value(GetAllSharedRecordsByStatusResponse.fromJson(await sharedPref.getObject(FAMILY_FILE)));
var myFamily = await sharedPref.getObject(FAMILY_FILE);
if (myFamily != null) {
getAllSharedRecordsByStatusResponse = GetAllSharedRecordsByStatusResponse.fromJson(myFamily);
return Future.value(GetAllSharedRecordsByStatusResponse.fromJson(myFamily));
} else {
try {
dynamic localRes;

@ -0,0 +1,8 @@
extension Unique<E, Id> on List<E> {
List<E> unique([Id Function(E element) id, bool inplace = true]) {
final ids = Set();
var list = inplace ? this : List<E>.from(this);
list.retainWhere((x) => ids.add(id != null ? id(x) : x as Id));
return list;
}
}

@ -96,8 +96,8 @@ class _HomePageFragment2State extends State<HomePageFragment2> {
margin: EdgeInsets.only(left: 20, right: 20, top: 8, bottom: 6),
child: SliderView(
onLoginClick: () {
// widget.onLoginClick();
navigateTo(context, CallHomePage());
widget.onLoginClick();
// navigateTo(context, CallHomePage());
},
),
// height: MediaQuery.of(context).size.width / 2.6,

@ -212,6 +212,16 @@ class _ReminderPageState extends State<ReminderPage> {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
// Expanded(
// child: DefaultButton(
// TranslationBase.of(context).cancel,
// () {
// Navigator.pop(context);
// },
// color: Color(0xffC5272D),
// ),
// ),
// SizedBox(width: 10),
Expanded(
child: DefaultButton(
TranslationBase.of(context).ok.toUpperCase(),
@ -221,16 +231,6 @@ class _ReminderPageState extends State<ReminderPage> {
color: Color(0xff359846),
),
),
SizedBox(width: 10),
Expanded(
child: DefaultButton(
TranslationBase.of(context).cancel,
() {
Navigator.pop(context);
},
color: Color(0xffC5272D),
),
),
],
),
),

@ -155,6 +155,7 @@ class _AdvancePaymentPageState extends State<AdvancePaymentPage> {
NewTextFields(
hintText: TranslationBase.of(context).fileNumber,
controller: _fileTextController,
readOnly: true,
),
if (beneficiaryType == BeneficiaryType.OtherAccount)
SizedBox(

@ -10,6 +10,8 @@ class SelectPatientFamilyDialog extends StatefulWidget {
final Function(GetAllSharedRecordsByStatusList) onValueSelected;
GetAllSharedRecordsByStatusList selectedPatientFamily;
List<GetAllSharedRecordsByStatusList> getAllSharedRecordsByStatusApprovedList = new List();
SelectPatientFamilyDialog({Key key, this.getAllSharedRecordsByStatusList, this.onValueSelected, this.selectedPatientFamily});
@override
@ -21,6 +23,11 @@ class _SelectPatientFamilyDialogState extends State<SelectPatientFamilyDialog> {
void initState() {
super.initState();
widget.selectedPatientFamily = widget.selectedPatientFamily ?? widget.getAllSharedRecordsByStatusList[0];
if (widget.getAllSharedRecordsByStatusList.isNotEmpty)
widget.getAllSharedRecordsByStatusList.forEach((element) {
if (element.status == 3) widget.getAllSharedRecordsByStatusApprovedList.add(element);
});
}
@override
@ -31,7 +38,7 @@ class _SelectPatientFamilyDialogState extends State<SelectPatientFamilyDialog> {
children: [
Divider(),
...List.generate(
widget.getAllSharedRecordsByStatusList.length,
widget.getAllSharedRecordsByStatusApprovedList.length,
(index) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -45,12 +52,12 @@ class _SelectPatientFamilyDialogState extends State<SelectPatientFamilyDialog> {
child: InkWell(
onTap: () {
setState(() {
widget.selectedPatientFamily = widget.getAllSharedRecordsByStatusList[index];
widget.selectedPatientFamily = widget.getAllSharedRecordsByStatusApprovedList[index];
});
},
child: ListTile(
title: Text(
widget.getAllSharedRecordsByStatusList[index].patientName,
widget.getAllSharedRecordsByStatusApprovedList[index].patientName,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
@ -58,7 +65,7 @@ class _SelectPatientFamilyDialogState extends State<SelectPatientFamilyDialog> {
),
),
leading: Radio(
value: widget.getAllSharedRecordsByStatusList[index],
value: widget.getAllSharedRecordsByStatusApprovedList[index],
groupValue: widget.selectedPatientFamily,
activeColor: secondaryColor,
onChanged: (value) {

@ -94,7 +94,7 @@ class _EyeHomePageState extends State<EyeHomePage> with SingleTickerProviderStat
projectName: widget.appointmentAllHistoryResultList.projectName,
projectID: widget.appointmentAllHistoryResultList.projectID);
GifLoaderDialogUtils.hideDialog(context);
}, model.user.emailAddress);
}, projectViewModel.user.emailAddress);
},
),
Container(

@ -13,6 +13,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/extensions/list_extension.dart';
class InvoiceDetail extends StatelessWidget {
final DoctorList doctor;
@ -31,6 +32,7 @@ class InvoiceDetail extends StatelessWidget {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
generateInvoiceDetails();
return AppScaffold(
appBarTitle: TranslationBase.of(context).myInvoice,
isShowAppBar: true,
@ -83,7 +85,7 @@ class InvoiceDetail extends StatelessWidget {
),
Container(
child: AppExpandableNotifier(
title: TranslationBase.of(context).patientShareTotal.toString() + " " + dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[0].grandTotal.toString() + " SAR",
title: TranslationBase.of(context).patientShareTotal.toString() + " " + this.grandTotal.toString() + " " + TranslationBase.of(context).sar,
isExpand: true,
bodyWidget: Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Table(
@ -95,19 +97,21 @@ class InvoiceDetail extends StatelessWidget {
),
Container(
margin: EdgeInsets.only(top: 10.0),
child: Text(dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[0].discountAmount.toString() + " " + TranslationBase.of(context).sar,
child: Text(this.totalDiscount.toString() + " " + TranslationBase.of(context).sar,
textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold)),
),
]),
TableRow(children: [
Container(
margin: EdgeInsets.only(top: 10.0),
child: Text(TranslationBase.of(context).totalVAT.toString() + " (" + dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[0].vATPercentage.toString() + "%): ",
textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold)),
child: Text(
TranslationBase.of(context).totalVAT.toString() + " (" + 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() + " " + TranslationBase.of(context).sar,
child: Text(num.tryParse(this.totalVAT.toString()).toStringAsFixed(2) + " " + TranslationBase.of(context).sar,
textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold)),
),
]),
@ -118,8 +122,8 @@ class InvoiceDetail extends StatelessWidget {
),
Container(
margin: EdgeInsets.only(top: 10.0),
child: Text(dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[0].totalPatientShare.toString() + " " + TranslationBase.of(context).sar,
textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold)),
child:
Text(this.subTotal.toString() + " " + TranslationBase.of(context).sar, textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold)),
),
]),
TableRow(children: [
@ -129,7 +133,7 @@ class InvoiceDetail extends StatelessWidget {
),
Container(
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
child: Text(dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[0].totalPatientShare.toString() + " " + TranslationBase.of(context).sar,
child: Text(this.grandTotal.toString() + " " + TranslationBase.of(context).sar,
textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold)),
),
]),
@ -181,7 +185,7 @@ class InvoiceDetail extends StatelessWidget {
),
bottomSheet: Container(
width: MediaQuery.of(context).size.width,
// height: 70.0,
color: Theme.of(context).scaffoldBackgroundColor,
margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0, bottom: 20.0),
child: DefaultButton(TranslationBase.of(context).sendEmail, () {
showDialog(
@ -198,6 +202,33 @@ class InvoiceDetail extends StatelessWidget {
);
}
void generateInvoiceDetails() {
totalServiceRate = 0;
totalDiscount = 0;
totalVAT = 0;
subTotal = 0;
grandTotal = 0;
List<ListConsultation> listConsultations = new List();
dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation.forEach((item) {
var i = listConsultations.indexWhere((x) => x.procedureID == item.procedureID);
if (i <= -1) {
listConsultations.add(item);
}
});
listConsultations.forEach((element) {
print(element.procedureID);
this.totalServiceRate += element.total;
this.totalDiscount += element.discountAmount;
this.totalVAT += element.totalVATAmount;
});
this.subTotal = this.totalServiceRate - this.totalDiscount;
this.grandTotal = this.subTotal + this.totalVAT;
}
sendInvoiceEmail() {
GifLoaderDialogUtils.showMyDialog(context);
MyInvoicesService myInvoicesService = new MyInvoicesService();

@ -25,7 +25,8 @@ class BloodPressureWeeklyPage extends StatelessWidget {
body: ListView(
children: [
Container(
margin: EdgeInsets.only(top: 12, left: 8, right: 8),
margin: EdgeInsets.only(top: 12, left: 8, right: 8, bottom: 12.0),
padding: EdgeInsets.only(bottom: 12.0),
color: Colors.white,
child: CurvedChartBloodPressure(
horizontalInterval: 3.0,

@ -99,7 +99,7 @@ class MyInvoicesService extends BaseService {
"PatientID": authUser.patientID,
"License": true,
"AppointmentNo": appoNo,
"To": authUser.emailAddress,
"To": authProvider.authenticatedUserObject.user.emailAddress,
"IsRegistered": true,
"ProjectID": projectID,
"PatientTypeID": authUser.patientIdentificationType,

@ -41,11 +41,11 @@ class _AppExpandableNotifier extends State<AppExpandableNotifier> {
String _subTitle = _mainTitle.replaceAll(_title, "").trim();
if (_subTitle.length < 1) {
_subTitle = _title.toLowerCase().capitalizeFirstofEach;
_subTitle = double.tryParse(_subTitle) != null ? _title : _title.toLowerCase().capitalizeFirstofEach;
_title = "";
} else {
_subTitle = _subTitle.toLowerCase().capitalizeFirstofEach;
_title = _title.toLowerCase().capitalizeFirstofEach;
_subTitle = double.tryParse(_subTitle) == null ? _subTitle : _subTitle.toLowerCase().capitalizeFirstofEach;
_title = double.tryParse(_subTitle) == null ? _title : _title.toLowerCase().capitalizeFirstofEach;
}
return ExpandableNotifier(
child: Container(

Loading…
Cancel
Save