@ -27,8 +27,7 @@ class InvoiceDetail extends StatefulWidget {
final DentalInvoiceDetailResponse dentalInvoiceDetailResponse ;
final BuildContext context ;
InvoiceDetail ( this . doctor , this . listDentalAppointments ,
this . dentalInvoiceDetailResponse , this . context ) ;
InvoiceDetail ( this . doctor , this . listDentalAppointments , this . dentalInvoiceDetailResponse , this . context ) ;
@ override
_InvoiceDetailState createState ( ) = > _InvoiceDetailState ( ) ;
@ -50,11 +49,7 @@ class _InvoiceDetailState extends State<InvoiceDetail> {
ProjectViewModel projectViewModel = Provider . of ( context ) ;
generateInvoiceDetails ( ) ;
return AppScaffold (
appBarTitle: widget . doctor . doctorTitle ! = null
? widget . doctor . doctorTitle . toString ( )
: TranslationBase . of ( context ) . dr +
" " +
widget . doctor . name . toString ( ) ,
appBarTitle: widget . doctor . doctorTitle ! = null ? widget . doctor . doctorTitle . toString ( ) : TranslationBase . of ( context ) . dr + " " + widget . doctor . name . toString ( ) ,
isShowAppBar: true ,
isShowDecPage: false ,
showNewAppBar: true ,
@ -67,6 +62,7 @@ class _InvoiceDetailState extends State<InvoiceDetail> {
DoctorHeader (
headerModel: HeaderModel (
widget . doctor . name ,
widget . doctor . doctorID ,
widget . doctor . doctorImageURL ,
widget . doctor . speciality ,
widget . doctor . clinicName ,
@ -76,7 +72,7 @@ class _InvoiceDetailState extends State<InvoiceDetail> {
widget . doctor . nationalityFlagURL ,
widget . doctor . doctorRate ,
widget . doctor . actualDoctorRate ,
widget . doctor . noOfPatientsRate ,
widget . doctor . noOfPatientsRate ? ? 0 ,
projectViewModel . user . emailAddress ) ,
onTap: ( ) {
sendInvoiceEmail ( ) ;
@ -86,8 +82,7 @@ class _InvoiceDetailState extends State<InvoiceDetail> {
child: Card (
elevation: 3.0 ,
shape: cardRadius ( 12 ) ,
margin: EdgeInsets . only (
left: 16 , top: 8 , right: 16 , bottom: 16 ) ,
margin: EdgeInsets . only ( left: 16 , top: 8 , right: 16 , bottom: 16 ) ,
child: Padding (
padding: const EdgeInsets . all ( 12.0 ) ,
child: Column (
@ -112,8 +107,7 @@ class _InvoiceDetailState extends State<InvoiceDetail> {
child: Card (
elevation: 3.0 ,
shape: cardRadius ( 12 ) ,
margin: EdgeInsets . only (
left: 16 , top: 8 , right: 16 , bottom: 16 ) ,
margin: EdgeInsets . only ( left: 16 , top: 8 , right: 16 , bottom: 16 ) ,
child: Padding (
padding: const EdgeInsets . all ( 15.0 ) ,
child: Column (
@ -121,29 +115,12 @@ class _InvoiceDetailState extends State<InvoiceDetail> {
children: [
Container (
margin: EdgeInsets . only ( bottom: 10.0 ) ,
child: Text ( TranslationBase . of ( context ) . cardDetail ,
style: TextStyle (
color: Colors . black ,
letterSpacing: - 0.64 ,
fontSize: 18.0 ,
fontWeight: FontWeight . bold ) ) ,
child: Text ( TranslationBase . of ( context ) . cardDetail , style: TextStyle ( color: Colors . black , letterSpacing: - 0.64 , fontSize: 18.0 , fontWeight: FontWeight . bold ) ) ,
) ,
myRichText (
TranslationBase . of ( context ) . insuranceCompany +
" : " ,
widget . dentalInvoiceDetailResponse
. listEInvoiceForDental [ 0 ] . companyName ,
projectViewModel . isArabic ) ,
myRichText ( TranslationBase . of ( context ) . insuranceCompany + " : " , widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ] . companyName , projectViewModel . isArabic ) ,
myRichText (
TranslationBase . of ( context ) . insuranceID + " : " ,
widget
. dentalInvoiceDetailResponse
. listEInvoiceForDental [ 0 ]
. insuranceID ! =
null
? widget . dentalInvoiceDetailResponse
. listEInvoiceForDental [ 0 ] . insuranceID
: " N/A " ,
widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ] . insuranceID ! = null ? widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ] . insuranceID : " N/A " ,
projectViewModel . isArabic ) ,
] ,
) ,
@ -155,8 +132,7 @@ class _InvoiceDetailState extends State<InvoiceDetail> {
child: Card (
elevation: 3.0 ,
shape: cardRadius ( 12 ) ,
margin: EdgeInsets . only (
left: 16 , top: 8 , right: 16 , bottom: 16 ) ,
margin: EdgeInsets . only ( left: 16 , top: 8 , right: 16 , bottom: 16 ) ,
child: Padding (
padding: const EdgeInsets . all ( 15.0 ) ,
child: Column (
@ -164,13 +140,7 @@ class _InvoiceDetailState extends State<InvoiceDetail> {
children: [
Container (
margin: EdgeInsets . only ( bottom: 10.0 ) ,
child: Text (
TranslationBase . of ( context ) . totalBalance ,
style: TextStyle (
letterSpacing: - 0.64 ,
color: Colors . black ,
fontSize: 18.0 ,
fontWeight: FontWeight . bold ) ) ,
child: Text ( TranslationBase . of ( context ) . totalBalance , style: TextStyle ( letterSpacing: - 0.64 , color: Colors . black , fontSize: 18.0 , fontWeight: FontWeight . bold ) ) ,
) ,
Container (
width: double . infinity ,
@ -178,15 +148,10 @@ class _InvoiceDetailState extends State<InvoiceDetail> {
child: Row (
children: [
Expanded (
child: _getNormalText (
TranslationBase . of ( context ) . discount ) ,
child: _getNormalText ( TranslationBase . of ( context ) . discount ) ,
) ,
Expanded (
child: _getNormalText (
this . totalDiscount . toString ( ) +
" " +
TranslationBase . of ( context ) . sar ,
isBold: true ) ,
child: _getNormalText ( this . totalDiscount . toString ( ) + " " + TranslationBase . of ( context ) . sar , isBold: true ) ,
)
] ,
) ,
@ -198,26 +163,13 @@ class _InvoiceDetailState extends State<InvoiceDetail> {
child: Row (
children: [
Expanded (
child: _getNormalText (
TranslationBase . of ( context )
. totalVAT
. toString ( ) +
child: _getNormalText ( TranslationBase . of ( context ) . totalVAT . toString ( ) +
" ( " +
widget
. dentalInvoiceDetailResponse
. listEInvoiceForDental [ 0 ]
. listConsultation [ 0 ]
. vATPercentage
. toString ( ) +
widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ] . listConsultation [ 0 ] . vATPercentage . toString ( ) +
" %): " ) ,
) ,
Expanded (
child: _getNormalText (
num . tryParse ( this . totalVAT . toString ( ) )
. toStringAsFixed ( 2 ) +
" " +
TranslationBase . of ( context ) . sar ,
isBold: true ) ,
child: _getNormalText ( num . tryParse ( this . totalVAT . toString ( ) ) . toStringAsFixed ( 2 ) + " " + TranslationBase . of ( context ) . sar , isBold: true ) ,
)
] ,
) ,
@ -229,15 +181,10 @@ class _InvoiceDetailState extends State<InvoiceDetail> {
child: Row (
children: [
Expanded (
child: _getNormalText (
TranslationBase . of ( context ) . total ) ,
child: _getNormalText ( TranslationBase . of ( context ) . total ) ,
) ,
Expanded (
child: _getNormalText (
this . subTotal . toString ( ) +
" " +
TranslationBase . of ( context ) . sar ,
isBold: true ) ,
child: _getNormalText ( this . subTotal . toString ( ) + " " + TranslationBase . of ( context ) . sar , isBold: true ) ,
)
] ,
) ,
@ -249,15 +196,10 @@ class _InvoiceDetailState extends State<InvoiceDetail> {
child: Row (
children: [
Expanded (
child: _getNormalText (
TranslationBase . of ( context ) . paid ) ,
child: _getNormalText ( TranslationBase . of ( context ) . paid ) ,
) ,
Expanded (
child: _getNormalText (
this . grandTotal . toString ( ) +
" " +
TranslationBase . of ( context ) . sar ,
isBold: true ) ,
child: _getNormalText ( this . grandTotal . toString ( ) + " " + TranslationBase . of ( context ) . sar , isBold: true ) ,
)
] ,
) ,
@ -284,10 +226,8 @@ class _InvoiceDetailState extends State<InvoiceDetail> {
List < ListConsultation > listConsultations = new List ( ) ;
widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ] . listConsultation
. forEach ( ( item ) {
var i = listConsultations
. indexWhere ( ( x ) = > x . procedureID = = item . procedureID ) ;
widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ] . listConsultation . forEach ( ( item ) {
var i = listConsultations . indexWhere ( ( x ) = > x . procedureID = = item . procedureID ) ;
if ( i < = - 1 ) {
listConsultations . add ( item ) ;
}
@ -308,16 +248,10 @@ class _InvoiceDetailState extends State<InvoiceDetail> {
GifLoaderDialogUtils . showMyDialog ( widget . context ) ;
MyInvoicesService myInvoicesService = new MyInvoicesService ( ) ;
myInvoicesService
. sendDentalAppointmentInvoiceEmail (
widget . listDentalAppointments . projectID ,
widget . listDentalAppointments . appointmentNo ,
widget . context )
. then ( ( res ) {
myInvoicesService . sendDentalAppointmentInvoiceEmail ( widget . listDentalAppointments . projectID , widget . listDentalAppointments . appointmentNo , widget . context ) . then ( ( res ) {
GifLoaderDialogUtils . hideDialog ( widget . context ) ;
if ( res [ ' MessageStatus ' ] = = 1 ) {
AppToast . showSuccessToast (
message: TranslationBase . of ( widget . context ) . emailSentSuccessfully ) ;
AppToast . showSuccessToast ( message: TranslationBase . of ( widget . context ) . emailSentSuccessfully ) ;
} else {
AppToast . showErrorToast ( message: res [ ' ErrorEndUserMessage ' ] ) ;
}
@ -342,37 +276,17 @@ class _InvoiceDetailState extends State<InvoiceDetail> {
] ,
) ,
) ;
for ( int i = 0 ;
i <
widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ]
. listConsultation . length ;
i + + ) {
for ( int i = 0 ; i < widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ] . listConsultation . length ; i + + ) {
tableRow . add (
TableRow ( children: [
Utils . tableColumnValue (
' ${ widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ] . listConsultation [ i ] . procedureName } ' ,
isLast: i = =
( widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ]
. listConsultation . length -
1 ) ) ,
Utils . tableColumnValue (
' ${ widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ] . listConsultation [ i ] . quantity } ' ,
isLast: i = =
( widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ]
. listConsultation . length -
1 ) ) ,
Utils . tableColumnValue (
' ${ widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ] . listConsultation [ i ] . price . toString ( ) + " " + TranslationBase . of ( context ) . sar } ' ,
isLast: i = =
( widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ]
. listConsultation . length -
1 ) ) ,
Utils . tableColumnValue (
' ${ widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ] . listConsultation [ i ] . total . toString ( ) + " " + TranslationBase . of ( context ) . sar } ' ,
isLast: i = =
( widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ]
. listConsultation . length -
1 ) ) ,
Utils . tableColumnValue ( ' ${ widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ] . listConsultation [ i ] . procedureName } ' ,
isLast: i = = ( widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ] . listConsultation . length - 1 ) ) ,
Utils . tableColumnValue ( ' ${ widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ] . listConsultation [ i ] . quantity } ' ,
isLast: i = = ( widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ] . listConsultation . length - 1 ) ) ,
Utils . tableColumnValue ( ' ${ widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ] . listConsultation [ i ] . price . toString ( ) + " " + TranslationBase . of ( context ) . sar } ' ,
isLast: i = = ( widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ] . listConsultation . length - 1 ) ) ,
Utils . tableColumnValue ( ' ${ widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ] . listConsultation [ i ] . total . toString ( ) + " " + TranslationBase . of ( context ) . sar } ' ,
isLast: i = = ( widget . dentalInvoiceDetailResponse . listEInvoiceForDental [ 0 ] . listConsultation . length - 1 ) ) ,
] ) ,
) ;
}