updates & fixes

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

@ -99,8 +99,10 @@ class InsuranceCardService extends BaseService {
} }
Future getSharedRecordByStatus() async { Future getSharedRecordByStatus() async {
if (await sharedPref.getObject(FAMILY_FILE) != null) { var myFamily = await sharedPref.getObject(FAMILY_FILE);
return Future.value(GetAllSharedRecordsByStatusResponse.fromJson(await sharedPref.getObject(FAMILY_FILE))); if (myFamily != null) {
getAllSharedRecordsByStatusResponse = GetAllSharedRecordsByStatusResponse.fromJson(myFamily);
return Future.value(GetAllSharedRecordsByStatusResponse.fromJson(myFamily));
} else { } else {
try { try {
dynamic localRes; 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), margin: EdgeInsets.only(left: 20, right: 20, top: 8, bottom: 6),
child: SliderView( child: SliderView(
onLoginClick: () { onLoginClick: () {
// widget.onLoginClick(); widget.onLoginClick();
navigateTo(context, CallHomePage()); // navigateTo(context, CallHomePage());
}, },
), ),
// height: MediaQuery.of(context).size.width / 2.6, // height: MediaQuery.of(context).size.width / 2.6,

@ -212,6 +212,16 @@ class _ReminderPageState extends State<ReminderPage> {
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
// Expanded(
// child: DefaultButton(
// TranslationBase.of(context).cancel,
// () {
// Navigator.pop(context);
// },
// color: Color(0xffC5272D),
// ),
// ),
// SizedBox(width: 10),
Expanded( Expanded(
child: DefaultButton( child: DefaultButton(
TranslationBase.of(context).ok.toUpperCase(), TranslationBase.of(context).ok.toUpperCase(),
@ -221,16 +231,6 @@ class _ReminderPageState extends State<ReminderPage> {
color: Color(0xff359846), 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( NewTextFields(
hintText: TranslationBase.of(context).fileNumber, hintText: TranslationBase.of(context).fileNumber,
controller: _fileTextController, controller: _fileTextController,
readOnly: true,
), ),
if (beneficiaryType == BeneficiaryType.OtherAccount) if (beneficiaryType == BeneficiaryType.OtherAccount)
SizedBox( SizedBox(

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

@ -94,7 +94,7 @@ class _EyeHomePageState extends State<EyeHomePage> with SingleTickerProviderStat
projectName: widget.appointmentAllHistoryResultList.projectName, projectName: widget.appointmentAllHistoryResultList.projectName,
projectID: widget.appointmentAllHistoryResultList.projectID); projectID: widget.appointmentAllHistoryResultList.projectID);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
}, model.user.emailAddress); }, projectViewModel.user.emailAddress);
}, },
), ),
Container( 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: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';
import 'package:diplomaticquarterapp/extensions/list_extension.dart';
class InvoiceDetail extends StatelessWidget { class InvoiceDetail extends StatelessWidget {
final DoctorList doctor; final DoctorList doctor;
@ -31,6 +32,7 @@ class InvoiceDetail extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
generateInvoiceDetails();
return AppScaffold( return AppScaffold(
appBarTitle: TranslationBase.of(context).myInvoice, appBarTitle: TranslationBase.of(context).myInvoice,
isShowAppBar: true, isShowAppBar: true,
@ -83,7 +85,7 @@ class InvoiceDetail extends StatelessWidget {
), ),
Container( Container(
child: AppExpandableNotifier( 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, isExpand: true,
bodyWidget: Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ bodyWidget: Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Table( Table(
@ -95,19 +97,21 @@ class InvoiceDetail extends StatelessWidget {
), ),
Container( Container(
margin: EdgeInsets.only(top: 10.0), 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)), textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold)),
), ),
]), ]),
TableRow(children: [ TableRow(children: [
Container( Container(
margin: EdgeInsets.only(top: 10.0), margin: EdgeInsets.only(top: 10.0),
child: Text(TranslationBase.of(context).totalVAT.toString() + " (" + dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[0].vATPercentage.toString() + "%): ", child: Text(
textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold)), TranslationBase.of(context).totalVAT.toString() + " (" + dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[0].vATPercentage.toString() + "%): ",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold)),
), ),
Container( Container(
margin: EdgeInsets.only(top: 10.0), 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)), textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold)),
), ),
]), ]),
@ -118,8 +122,8 @@ class InvoiceDetail extends StatelessWidget {
), ),
Container( Container(
margin: EdgeInsets.only(top: 10.0), margin: EdgeInsets.only(top: 10.0),
child: Text(dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[0].totalPatientShare.toString() + " " + TranslationBase.of(context).sar, child:
textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold)), Text(this.subTotal.toString() + " " + TranslationBase.of(context).sar, textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold)),
), ),
]), ]),
TableRow(children: [ TableRow(children: [
@ -129,7 +133,7 @@ class InvoiceDetail extends StatelessWidget {
), ),
Container( Container(
margin: EdgeInsets.only(top: 10.0, bottom: 10.0), 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)), textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold)),
), ),
]), ]),
@ -181,7 +185,7 @@ class InvoiceDetail extends StatelessWidget {
), ),
bottomSheet: Container( bottomSheet: Container(
width: MediaQuery.of(context).size.width, 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), margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0, bottom: 20.0),
child: DefaultButton(TranslationBase.of(context).sendEmail, () { child: DefaultButton(TranslationBase.of(context).sendEmail, () {
showDialog( 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() { sendInvoiceEmail() {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
MyInvoicesService myInvoicesService = new MyInvoicesService(); MyInvoicesService myInvoicesService = new MyInvoicesService();

@ -25,7 +25,8 @@ class BloodPressureWeeklyPage extends StatelessWidget {
body: ListView( body: ListView(
children: [ children: [
Container( 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, color: Colors.white,
child: CurvedChartBloodPressure( child: CurvedChartBloodPressure(
horizontalInterval: 3.0, horizontalInterval: 3.0,

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

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

Loading…
Cancel
Save