diff --git a/lib/core/models/close_day_data.dart b/lib/core/models/close_day_data.dart index 10fd148..15c91b0 100644 --- a/lib/core/models/close_day_data.dart +++ b/lib/core/models/close_day_data.dart @@ -11,6 +11,8 @@ class CloseDayData { final int paymentCount; final num refundAmount; final int refundCount; + final num cancelAmount; + final int cancelCount; final List items; CloseDayData({ @@ -18,7 +20,8 @@ class CloseDayData { this.items, this.totalAmount, this.totalCount, this.paymentAmount, this.paymentCount, - this.refundAmount, this.refundCount + this.refundAmount, this.refundCount, + this.cancelAmount, this.cancelCount }); static CloseDayData fromJson(Map json) { @@ -30,6 +33,8 @@ class CloseDayData { paymentCount: json['paymentCount'], refundAmount: json['refundAmount'], refundCount: json['refundCount'], + cancelAmount: json['cancelAmount'], + cancelCount: json['cancelCount'], items: (json['items'] as List).map((e) => TransactionBean.fromMap(e)).toList(), ); } @@ -42,6 +47,8 @@ class CloseDayData { 'paymentCount': paymentCount, 'refundAmount': refundAmount, 'refundCount': refundCount, + 'cancelAmount': cancelAmount, + 'cancelCount': cancelCount, 'items': items.map((e) => e.toJson()).toList(), }; } \ No newline at end of file diff --git a/lib/core/services/BankService.dart b/lib/core/services/BankService.dart index 0339563..58e72ce 100644 --- a/lib/core/services/BankService.dart +++ b/lib/core/services/BankService.dart @@ -109,6 +109,8 @@ class BankService extends BaseService { int paymentCount = 0; num refundAmount = 0; int refundCount = 0; + num cancelAmount = 0; + int cancelCount = 0; for(Cd.TransactionBean item in items) { if(item.type == 'PAYMENT') { @@ -119,6 +121,10 @@ class BankService extends BaseService { refundCount++; refundAmount += ( item.amount / 100 ); totalAmount -= ( item.amount / 100 ); + } else if(item.type == 'REVERSAL') { + cancelCount++; + cancelAmount += ( item.amount / 100 ); + totalAmount -= ( item.amount / 100 ); } totalCount++; } @@ -129,6 +135,7 @@ class BankService extends BaseService { totalAmount: totalAmount, totalCount: totalCount, paymentAmount: paymentAmount, paymentCount: paymentCount, refundAmount: refundAmount, refundCount: refundCount, + cancelAmount: cancelAmount, cancelCount: cancelCount, ); return closeDayData; } diff --git a/lib/core/services/DataService.dart b/lib/core/services/DataService.dart index 85f286e..7932fde 100644 --- a/lib/core/services/DataService.dart +++ b/lib/core/services/DataService.dart @@ -143,7 +143,9 @@ class DataService extends BaseService { CheckData checkData, CardData cardData}) async { try { - checkData.cardData = cardData; + var json = cardData.toJson(); + json['transactionType'] = VoucherTypeReturnPay; + checkData.cardData = CardData.fromJson(json); String data = jsonEncode(checkData.toJson()); log.i('token: $token'); diff --git a/lib/views/check/image_show_container.dart b/lib/views/check/image_show_container.dart index 07eabba..235453c 100644 --- a/lib/views/check/image_show_container.dart +++ b/lib/views/check/image_show_container.dart @@ -187,8 +187,11 @@ class _MyFloatingActionButtonState extends State { double sheetHeight = 260; + + @override Widget build(BuildContext context) { + //print(widget.data.cardData.transactionType); if (showFab) { return Column( mainAxisAlignment: MainAxisAlignment.end, diff --git a/lib/views/close_day_view/close_day_show_container.dart b/lib/views/close_day_view/close_day_show_container.dart index 3aa1c32..fb0e3a0 100644 --- a/lib/views/close_day_view/close_day_show_container.dart +++ b/lib/views/close_day_view/close_day_show_container.dart @@ -32,6 +32,11 @@ class CloseDayShowContainer extends StatelessWidget { TableCell(child: Text('${data.paymentCount}', textAlign: TextAlign.center, style: productTextStyle)), TableCell(child: Text('${data.paymentAmount} T', textAlign: TextAlign.end, style: productTextStyle)), ]), + TableRow(children: [ + TableCell(child: Text('Отмен:', style: productTextStyle,)), + TableCell(child: Text('${data.cancelCount}', textAlign: TextAlign.center, style: productTextStyle)), + TableCell(child: Text('${data.cancelAmount} T', textAlign: TextAlign.end, style: productTextStyle)), + ]), TableRow(children: [ TableCell(child: Text('Возвратов:', style: productTextStyle,)), TableCell(child: Text('${data.refundCount}', textAlign: TextAlign.center, style: productTextStyle)),