parent
62f107d7ac
commit
b31e685af0
|
|
@ -339,18 +339,18 @@ public class CardRefundAmanHandlerImpl implements EasyCardRefundCallbackHandler<
|
||||||
if(this.authorizationCode.equalsIgnoreCase(transaction.getAuthorizationCode())
|
if(this.authorizationCode.equalsIgnoreCase(transaction.getAuthorizationCode())
|
||||||
&& transactionNumber.equals(transaction.getTransactionNumber())
|
&& transactionNumber.equals(transaction.getTransactionNumber())
|
||||||
&& transaction.getTransactionType().equalsIgnoreCase("PAYMENT")) {
|
&& transaction.getTransactionType().equalsIgnoreCase("PAYMENT")) {
|
||||||
System.out.println("getCheck:"+ transaction.getCheck());
|
// System.out.println("getCheck:"+ transaction.getCheck());
|
||||||
System.out.println("getCheckNumber:"+ transaction.getCheckNumber());
|
// System.out.println("getCheckNumber:"+ transaction.getCheckNumber());
|
||||||
System.out.println("getAmount:"+ transaction.getAmount());
|
// System.out.println("getAmount:"+ transaction.getAmount());
|
||||||
System.out.println("getCardHolderName:"+ transaction.getCardHolderName());
|
// System.out.println("getCardHolderName:"+ transaction.getCardHolderName());
|
||||||
System.out.println("getCardType:"+ transaction.getCardType());
|
// System.out.println("getCardType:"+ transaction.getCardType());
|
||||||
System.out.println("getPrinterCheckNumber:"+ transaction.getPrinterCheckNumber());
|
// System.out.println("getPrinterCheckNumber:"+ transaction.getPrinterCheckNumber());
|
||||||
System.out.println("getTransactionNumber:"+ transaction.getTransactionNumber());
|
// System.out.println("getTransactionNumber:"+ transaction.getTransactionNumber());
|
||||||
System.out.println("getAdditionalAuthorizationCode:"+ transaction.getAdditionalAuthorizationCode());
|
// System.out.println("getAdditionalAuthorizationCode:"+ transaction.getAdditionalAuthorizationCode());
|
||||||
System.out.println("getAuthorizationCode:"+ transaction.getAuthorizationCode());
|
// System.out.println("getAuthorizationCode:"+ transaction.getAuthorizationCode());
|
||||||
System.out.println("getCardExpiryDate:"+ transaction.getCardExpiryDate());
|
// System.out.println("getCardExpiryDate:"+ transaction.getCardExpiryDate());
|
||||||
System.out.println("getTransactionType:"+ transaction.getTransactionType());
|
// System.out.println("getTransactionType:"+ transaction.getTransactionType());
|
||||||
System.out.println("getTransactionDate:"+ transaction.getTransactionDate());
|
// System.out.println("getTransactionDate:"+ transaction.getTransactionDate());
|
||||||
this.transaction = transaction;
|
this.transaction = transaction;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,14 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.flutter.plugin.common.MethodChannel;
|
import io.flutter.plugin.common.MethodChannel;
|
||||||
import kz.com.aman.kassa.bank.M4BankActivity;
|
import kz.com.aman.kassa.bank.M4BankActivity;
|
||||||
import kz.com.aman.kassa.model.AmanDao;
|
import kz.com.aman.kassa.model.AmanDao;
|
||||||
|
import kz.com.aman.kassa.model.TransactionDao;
|
||||||
import kz.com.aman.kassa.plugins.BankNfcPlugins;
|
import kz.com.aman.kassa.plugins.BankNfcPlugins;
|
||||||
import ru.m4bank.mpos.library.external.transactions.CloseDayCallbackHandler;
|
import ru.m4bank.mpos.library.external.transactions.CloseDayCallbackHandler;
|
||||||
import ru.m4bank.mpos.service.commons.data.ResultType;
|
import ru.m4bank.mpos.service.commons.data.ResultType;
|
||||||
|
|
@ -24,6 +27,7 @@ public class CloseDayHandlerImpl implements CloseDayCallbackHandler<Result> {
|
||||||
private final BankNfcPlugins plugin;
|
private final BankNfcPlugins plugin;
|
||||||
private final MethodChannel.Result result;
|
private final MethodChannel.Result result;
|
||||||
private final Gson gson = new Gson();
|
private final Gson gson = new Gson();
|
||||||
|
final SimpleDateFormat sdfDart = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
public CloseDayHandlerImpl(BankNfcPlugins plugin, MethodChannel.Result result) {
|
public CloseDayHandlerImpl(BankNfcPlugins plugin, MethodChannel.Result result) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
|
@ -54,10 +58,21 @@ public class CloseDayHandlerImpl implements CloseDayCallbackHandler<Result> {
|
||||||
@Override
|
@Override
|
||||||
public void onTransactionsListReceived(List<Transaction> transactionList, List<CloseDayResponseInfo> list1) {
|
public void onTransactionsListReceived(List<Transaction> transactionList, List<CloseDayResponseInfo> list1) {
|
||||||
plugin.getActivity().runOnUiThread(() -> {
|
plugin.getActivity().runOnUiThread(() -> {
|
||||||
AmanDao<String> dao = new AmanDao<>();
|
AmanDao<TransactionDao> dao = new AmanDao<>();
|
||||||
dao.setSuccess(true);
|
dao.setSuccess(true);
|
||||||
|
dao.setMsg("list");
|
||||||
|
for(Transaction transaction: transactionList){
|
||||||
|
TransactionDao transactionDao = new TransactionDao();
|
||||||
|
transactionDao.setAmount(transaction.getAmount());
|
||||||
|
transactionDao.setCardExpireDate(transaction.getCardExpiryDate());
|
||||||
|
transactionDao.setCardNumber(transaction.getMaskedPan());
|
||||||
|
transactionDao.setCardType(transaction.getCardType());
|
||||||
|
transactionDao.setTransactionType(transaction.getTransactionType());
|
||||||
|
transactionDao.setDate(sdfDart.format(transaction.getDate()));
|
||||||
|
dao.getRows().add(transactionDao);
|
||||||
|
}
|
||||||
this.result.success(gson.toJson(dao));
|
this.result.success(gson.toJson(dao));
|
||||||
Toast.makeText(plugin.getActivity(), "На закрытие дня: - " + transactionList, Toast.LENGTH_SHORT).show();
|
// Toast.makeText(plugin.getActivity(), "На закрытие дня: - " + transactionList, Toast.LENGTH_SHORT).show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,7 +81,7 @@ public class CloseDayHandlerImpl implements CloseDayCallbackHandler<Result> {
|
||||||
plugin.getActivity().runOnUiThread(() -> {
|
plugin.getActivity().runOnUiThread(() -> {
|
||||||
AmanDao<String> dao = new AmanDao<>();
|
AmanDao<String> dao = new AmanDao<>();
|
||||||
dao.setSuccess(ResultType.SUCCESSFUL.equals(closeDayResult.getResultType()));
|
dao.setSuccess(ResultType.SUCCESSFUL.equals(closeDayResult.getResultType()));
|
||||||
dao.setMsg((closeDayResult.getDescription() == null ? "" : closeDayResult.getDescription()));
|
dao.setMsg((closeDayResult.getDescription() == null ? "null" : closeDayResult.getDescription()));
|
||||||
this.result.success(gson.toJson(dao));
|
this.result.success(gson.toJson(dao));
|
||||||
Toast.makeText(plugin.getActivity(), closeDayResult.getResultType() + " " + (closeDayResult.getDescription() == null ? "" : closeDayResult.getDescription()), Toast.LENGTH_SHORT)
|
Toast.makeText(plugin.getActivity(), closeDayResult.getResultType() + " " + (closeDayResult.getDescription() == null ? "" : closeDayResult.getDescription()), Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
package kz.com.aman.kassa.model;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
public class TransactionDao {
|
||||||
|
String cardType;
|
||||||
|
String cardExpireDate;
|
||||||
|
String cardNumber;
|
||||||
|
String transactionType;
|
||||||
|
Long amount;
|
||||||
|
String date;
|
||||||
|
|
||||||
|
public void setDate(String date) {
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCardType() {
|
||||||
|
return cardType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCardType(String cardType) {
|
||||||
|
this.cardType = cardType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCardExpireDate() {
|
||||||
|
return cardExpireDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCardExpireDate(String cardExpireDate) {
|
||||||
|
this.cardExpireDate = cardExpireDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCardNumber() {
|
||||||
|
return cardNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCardNumber(String cardNumber) {
|
||||||
|
this.cardNumber = cardNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTransactionType() {
|
||||||
|
return transactionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransactionType(String transactionType) {
|
||||||
|
this.transactionType = transactionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAmount() {
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAmount(Long amount) {
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
|
|
@ -14,6 +14,7 @@ const String Voucher_columnUrl = 'url';
|
||||||
const String VoucherTypePayment = 'payment';
|
const String VoucherTypePayment = 'payment';
|
||||||
const String VoucherTypeReturnPay = 'returnPay';
|
const String VoucherTypeReturnPay = 'returnPay';
|
||||||
const String VoucherTypeReport = 'report';
|
const String VoucherTypeReport = 'report';
|
||||||
|
const String VoucherTypeCloseDayPosReport = 'closeDayPosReport';
|
||||||
|
|
||||||
class Voucher {
|
class Voucher {
|
||||||
int id;
|
int id;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:aman_kassa_flutter/core/models/transaction_item.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
var date = "2021-01-14T12:15:34.511Z";
|
||||||
|
|
||||||
|
String text = '{'+
|
||||||
|
'"amount": 5500,'+
|
||||||
|
'"cardExpireDate": "09/22",'+
|
||||||
|
'"cardNumber": "400303******6254",'+
|
||||||
|
'"cardType": "VISA",'+
|
||||||
|
'"date": "2021-01-14 12:22:09",'+
|
||||||
|
'"transactionType": "PAYMENT"'+
|
||||||
|
'}';
|
||||||
|
|
||||||
|
print(text);
|
||||||
|
dynamic data = json.decode(text);
|
||||||
|
TransactionItem item = TransactionItem.fromJson(data);
|
||||||
|
|
||||||
|
print(item.date);
|
||||||
|
}
|
||||||
|
|
@ -1,16 +1,17 @@
|
||||||
class AmanDao<T> {
|
class AmanDao<T> {
|
||||||
final T data;
|
final T data;
|
||||||
//final List<T> rows;
|
final dynamic rows;
|
||||||
final String msg;
|
final String msg;
|
||||||
final bool success;
|
final bool success;
|
||||||
|
|
||||||
AmanDao({this.data, this.success, this.msg});
|
AmanDao({this.data, this.success, this.msg, this.rows});
|
||||||
|
|
||||||
|
|
||||||
factory AmanDao.fromJson(Map<String, dynamic> data) {
|
factory AmanDao.fromJson(Map<String, dynamic> data) {
|
||||||
return AmanDao(
|
return AmanDao(
|
||||||
data: data['data'],
|
data: data['data'],
|
||||||
msg: data['msg'],
|
msg: data['msg'],
|
||||||
success: data['success']);
|
success: data['success'],
|
||||||
|
rows: data['rows']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
|
||||||
|
import 'package:aman_kassa_flutter/core/models/transaction_item.dart';
|
||||||
|
|
||||||
|
class CloseDayData {
|
||||||
|
final String title;
|
||||||
|
final num totalAmount;
|
||||||
|
final int totalCount;
|
||||||
|
final num paymentAmount;
|
||||||
|
final int paymentCount;
|
||||||
|
final num refundAmount;
|
||||||
|
final int refundCount;
|
||||||
|
|
||||||
|
final List<TransactionItem> items;
|
||||||
|
CloseDayData({
|
||||||
|
this.title,
|
||||||
|
this.items,
|
||||||
|
this.totalAmount, this.totalCount,
|
||||||
|
this.paymentAmount, this.paymentCount,
|
||||||
|
this.refundAmount, this.refundCount
|
||||||
|
});
|
||||||
|
|
||||||
|
static CloseDayData fromJson(Map<String, dynamic> json) {
|
||||||
|
return CloseDayData(
|
||||||
|
title: json['title'],
|
||||||
|
totalAmount: json['totalAmount'],
|
||||||
|
totalCount: json['totalCount'],
|
||||||
|
paymentAmount: json['paymentAmount'],
|
||||||
|
paymentCount: json['paymentCount'],
|
||||||
|
refundAmount: json['refundAmount'],
|
||||||
|
refundCount: json['refundCount'],
|
||||||
|
items: (json['items'] as List).map((e) => TransactionItem.fromJson(e)).toList(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Map<String, dynamic> toJson() =>
|
||||||
|
{
|
||||||
|
'title': title,
|
||||||
|
'totalAmount': totalAmount,
|
||||||
|
'totalCount': totalCount,
|
||||||
|
'paymentAmount': paymentAmount,
|
||||||
|
'paymentCount': paymentCount,
|
||||||
|
'refundAmount': refundAmount,
|
||||||
|
'refundCount': refundCount,
|
||||||
|
'items': items.map((e) => e.toJson()).toList(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
class TransactionItem {
|
||||||
|
final String cardType;
|
||||||
|
final String cardExpireDate;
|
||||||
|
final String cardNumber;
|
||||||
|
final String transactionType;
|
||||||
|
final num amount;
|
||||||
|
final DateTime date;
|
||||||
|
TransactionItem({this.cardType, this.cardExpireDate, this.cardNumber, this.transactionType, this.amount, this.date});
|
||||||
|
|
||||||
|
static TransactionItem fromJson(Map<String, dynamic> json) {
|
||||||
|
return TransactionItem(
|
||||||
|
cardType: json['cardType'],
|
||||||
|
cardExpireDate: json['cardExpireDate'],
|
||||||
|
cardNumber: json['cardNumber'],
|
||||||
|
transactionType: json['transactionType'],
|
||||||
|
amount: json['amount'],
|
||||||
|
date: json['date'] != null
|
||||||
|
? DateTime.parse(json['date'])
|
||||||
|
: null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Map<String, dynamic> toJson() =>
|
||||||
|
{
|
||||||
|
'cardType': cardType,
|
||||||
|
'cardExpireDate': cardExpireDate,
|
||||||
|
'cardNumber': cardNumber,
|
||||||
|
'transactionType': transactionType,
|
||||||
|
'amount': amount,
|
||||||
|
'date' : date !=null ? date.toString() : null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
const String LoginViewRoute = "LoginView";
|
const String LoginViewRoute = "LoginView";
|
||||||
const String HomeViewRoute = "HomeView";
|
const String HomeViewRoute = "HomeView";
|
||||||
const String ImageShowRoute = "ImageShowRoute";
|
const String ImageShowRoute = "ImageShowRoute";
|
||||||
|
const String CloseDayShowRoute = "CloseDayShowRoute";
|
||||||
const String PaymentViewRoute = "PaymentView";
|
const String PaymentViewRoute = "PaymentView";
|
||||||
const String PaymentNfcViewRoute = "PaymentNfcViewRoute";
|
const String PaymentNfcViewRoute = "PaymentNfcViewRoute";
|
||||||
const String HistoryViewRoute = "HistoryView";
|
const String HistoryViewRoute = "HistoryView";
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
|
import 'package:aman_kassa_flutter/core/models/close_day_data.dart';
|
||||||
import 'package:aman_kassa_flutter/views/bank_setting/bank_setting_view.dart';
|
import 'package:aman_kassa_flutter/views/bank_setting/bank_setting_view.dart';
|
||||||
import 'package:aman_kassa_flutter/views/bank_view/bank_view.dart';
|
import 'package:aman_kassa_flutter/views/bank_view/bank_view.dart';
|
||||||
import 'package:aman_kassa_flutter/views/check/image_show_container.dart';
|
import 'package:aman_kassa_flutter/views/check/image_show_container.dart';
|
||||||
|
import 'package:aman_kassa_flutter/views/close_day_view/close_day_show_container.dart';
|
||||||
import 'package:aman_kassa_flutter/views/history/history_view.dart';
|
import 'package:aman_kassa_flutter/views/history/history_view.dart';
|
||||||
import 'package:aman_kassa_flutter/views/info_kkm/info_kkm_view.dart';
|
import 'package:aman_kassa_flutter/views/info_kkm/info_kkm_view.dart';
|
||||||
import 'package:aman_kassa_flutter/views/payment/payment_view.dart';
|
import 'package:aman_kassa_flutter/views/payment/payment_view.dart';
|
||||||
|
|
@ -72,6 +74,12 @@ Route<dynamic> generateRoute(RouteSettings settings) {
|
||||||
routeName: settings.name,
|
routeName: settings.name,
|
||||||
viewToShow: ImageShowContainer(data),
|
viewToShow: ImageShowContainer(data),
|
||||||
);
|
);
|
||||||
|
case CloseDayShowRoute:
|
||||||
|
CloseDayData data = settings.arguments as CloseDayData;
|
||||||
|
return _getPageRoute(
|
||||||
|
routeName: settings.name,
|
||||||
|
viewToShow: CloseDayShowContainer(data),
|
||||||
|
);
|
||||||
default:
|
default:
|
||||||
return MaterialPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (_) => Scaffold(
|
builder: (_) => Scaffold(
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:aman_kassa_flutter/core/base/base_service.dart';
|
import 'package:aman_kassa_flutter/core/base/base_service.dart';
|
||||||
import 'package:aman_kassa_flutter/core/models/aman_dao.dart';
|
import 'package:aman_kassa_flutter/core/models/aman_dao.dart';
|
||||||
|
import 'package:aman_kassa_flutter/core/models/close_day_data.dart';
|
||||||
|
import 'package:aman_kassa_flutter/core/models/transaction_item.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
class BankService extends BaseService {
|
class BankService extends BaseService {
|
||||||
static const String _url = 'http://195.200.74.83:5000';
|
static const String _url = 'http://195.200.74.83:5000';
|
||||||
|
|
@ -171,5 +174,39 @@ class BankService extends BaseService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CloseDayData closeDayDataConvert(dynamic rows) {
|
||||||
|
final DateFormat formatter = DateFormat('dd.MM.yyyy');
|
||||||
|
final DateTime now = DateTime.now();
|
||||||
|
final String formatted = formatter.format(now);
|
||||||
|
List<TransactionItem> items = (rows as List).map((e) => TransactionItem.fromJson(e)).toList();
|
||||||
|
num totalAmount = 0;
|
||||||
|
int totalCount = 0;
|
||||||
|
num paymentAmount = 0;
|
||||||
|
int paymentCount = 0;
|
||||||
|
num refundAmount = 0;
|
||||||
|
int refundCount = 0;
|
||||||
|
|
||||||
|
for(TransactionItem item in items) {
|
||||||
|
if(item.transactionType == 'PAYMENT') {
|
||||||
|
paymentCount++;
|
||||||
|
paymentAmount += ( item.amount / 100 );
|
||||||
|
totalAmount += ( item.amount / 100 );
|
||||||
|
} else if(item.transactionType == 'REFUND') {
|
||||||
|
refundCount++;
|
||||||
|
refundAmount += ( item.amount / 100 );
|
||||||
|
totalAmount -= ( item.amount / 100 );
|
||||||
|
}
|
||||||
|
totalCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
CloseDayData closeDayData = new CloseDayData(
|
||||||
|
items: items,
|
||||||
|
title: 'Отчет POS от $formatted',
|
||||||
|
totalAmount: totalAmount, totalCount: totalCount,
|
||||||
|
paymentAmount: paymentAmount, paymentCount: paymentCount,
|
||||||
|
refundAmount: refundAmount, refundCount: refundCount,
|
||||||
|
);
|
||||||
|
return closeDayData;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ class _BankSettingViewState extends State<BankSettingView> {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
title: Text('Настройка Tap2Phone'),
|
title: Text('Настройка HalykPos'),
|
||||||
),
|
),
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
import 'package:aman_kassa_flutter/core/models/close_day_data.dart';
|
||||||
|
import 'package:aman_kassa_flutter/core/models/transaction_item.dart';
|
||||||
|
import 'package:aman_kassa_flutter/shared/shared_styles.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
class CloseDayShowContainer extends StatelessWidget {
|
||||||
|
final CloseDayData data;
|
||||||
|
DateFormat dateFormat = DateFormat("dd.MM.yyyy HH:mm:ss");
|
||||||
|
CloseDayShowContainer(this.data);
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text(data.title ?? 'Отчет: Закрытие дня POS'),
|
||||||
|
),
|
||||||
|
body: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text('Общий итоги', style: const TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 15) ),
|
||||||
|
Table(
|
||||||
|
children: [
|
||||||
|
TableRow(children: [
|
||||||
|
TableCell(child: Text('Оплат:', style: productTextStyle,)),
|
||||||
|
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.refundCount}', textAlign: TextAlign.center, style: productTextStyle)),
|
||||||
|
TableCell(child: Text('${data.refundAmount} T', textAlign: TextAlign.end, style: productTextStyle)),
|
||||||
|
]),
|
||||||
|
TableRow(children: [
|
||||||
|
TableCell(child: Text('Итого:', style: productTextStyle,)),
|
||||||
|
TableCell(child: Text('${data.totalCount}', textAlign: TextAlign.center, style: productTextStyle)),
|
||||||
|
TableCell(child: Text('${data.totalAmount} T', textAlign: TextAlign.end, style: productTextStyle)),
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Divider(),
|
||||||
|
Expanded(
|
||||||
|
child: ListView.separated(
|
||||||
|
itemCount: data.items.length,
|
||||||
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
|
return Divider();
|
||||||
|
},
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
TransactionItem item = data.items.elementAt(index);
|
||||||
|
return ListTile(
|
||||||
|
title: Text(item.cardNumber),
|
||||||
|
subtitle: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(dateFormat.format(item.date)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
trailing: Text('${item.amount / 100} T'),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -4,6 +4,7 @@ import 'package:aman_kassa_flutter/core/entity/Voucher.dart';
|
||||||
import 'package:aman_kassa_flutter/core/locator.dart';
|
import 'package:aman_kassa_flutter/core/locator.dart';
|
||||||
import 'package:aman_kassa_flutter/core/models/card_data.dart';
|
import 'package:aman_kassa_flutter/core/models/card_data.dart';
|
||||||
import 'package:aman_kassa_flutter/core/models/check_data.dart';
|
import 'package:aman_kassa_flutter/core/models/check_data.dart';
|
||||||
|
import 'package:aman_kassa_flutter/core/models/close_day_data.dart';
|
||||||
import 'package:aman_kassa_flutter/core/route_names.dart';
|
import 'package:aman_kassa_flutter/core/route_names.dart';
|
||||||
import 'package:aman_kassa_flutter/core/services/DbService.dart';
|
import 'package:aman_kassa_flutter/core/services/DbService.dart';
|
||||||
import 'package:aman_kassa_flutter/core/services/navigator_service.dart';
|
import 'package:aman_kassa_flutter/core/services/navigator_service.dart';
|
||||||
|
|
@ -66,18 +67,32 @@ class _HistoryViewState extends State<HistoryView> {
|
||||||
},
|
},
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
Voucher voucher = data[index];
|
Voucher voucher = data[index];
|
||||||
CheckData checkData = CheckData.fromJson(json.decode(voucher.data));
|
CardData cardData;
|
||||||
CardData cardData = checkData.cardData;
|
CloseDayData closeDayData;
|
||||||
|
if( voucher.type == VoucherTypeCloseDayPosReport ) {
|
||||||
|
closeDayData = CloseDayData.fromJson(json.decode(voucher.data));
|
||||||
|
} else if( voucher.data !=null ) {
|
||||||
|
CheckData checkData = CheckData.fromJson(json.decode(voucher.data));
|
||||||
|
cardData = checkData.cardData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return ListTile(
|
return ListTile(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_navigatorService.push(ImageShowRoute,
|
|
||||||
arguments: ImageShowModel(
|
if( voucher.type == VoucherTypeCloseDayPosReport ) {
|
||||||
|
_navigatorService.push(CloseDayShowRoute,
|
||||||
|
arguments: closeDayData);
|
||||||
|
} else {
|
||||||
|
_navigatorService.push(ImageShowRoute,
|
||||||
|
arguments: ImageShowModel(
|
||||||
data: voucher.base64Data,
|
data: voucher.base64Data,
|
||||||
title: voucher.name,
|
title: voucher.name,
|
||||||
url: voucher.url,
|
url: voucher.url,
|
||||||
cardData: cardData,
|
cardData: cardData,
|
||||||
voucher: voucher,
|
voucher: voucher,
|
||||||
));
|
));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
title: buildText(voucher),
|
title: buildText(voucher),
|
||||||
subtitle: Column(
|
subtitle: Column(
|
||||||
|
|
@ -98,6 +113,11 @@ class _HistoryViewState extends State<HistoryView> {
|
||||||
MdiIcons.backupRestore,
|
MdiIcons.backupRestore,
|
||||||
size: 40,
|
size: 40,
|
||||||
)
|
)
|
||||||
|
: voucher.type == VoucherTypeCloseDayPosReport ?
|
||||||
|
Icon(
|
||||||
|
Icons.phonelink_lock_outlined,
|
||||||
|
size: 40,
|
||||||
|
)
|
||||||
: Icon(
|
: Icon(
|
||||||
Icons.description,
|
Icons.description,
|
||||||
size: 40,
|
size: 40,
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class _PopupMenuState extends State<PopupMenu> {
|
||||||
//if (version >= 24 )
|
//if (version >= 24 )
|
||||||
// const Choice(title: 'Bank', icon: Icons.text_fields, command: 'bank'),
|
// const Choice(title: 'Bank', icon: Icons.text_fields, command: 'bank'),
|
||||||
if (version >= 24 )
|
if (version >= 24 )
|
||||||
const Choice(title: 'Настройка Tap2Phone', icon: MdiIcons.nfc, command: 'tap2phone'),
|
const Choice(title: 'Настройка HalykPos', icon: Icons.phonelink_lock_outlined, command: 'tap2phone'),
|
||||||
const Choice(title: 'Выйти', icon: Icons.exit_to_app, command: 'exit')
|
const Choice(title: 'Выйти', icon: Icons.exit_to_app, command: 'exit')
|
||||||
];
|
];
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:aman_kassa_flutter/core/entity/Voucher.dart';
|
import 'package:aman_kassa_flutter/core/entity/Voucher.dart';
|
||||||
import 'package:aman_kassa_flutter/core/locator.dart';
|
import 'package:aman_kassa_flutter/core/locator.dart';
|
||||||
import 'package:aman_kassa_flutter/core/models/aman_dao.dart';
|
import 'package:aman_kassa_flutter/core/models/aman_dao.dart';
|
||||||
|
import 'package:aman_kassa_flutter/core/models/close_day_data.dart';
|
||||||
import 'package:aman_kassa_flutter/core/models/money.dart';
|
import 'package:aman_kassa_flutter/core/models/money.dart';
|
||||||
import 'package:aman_kassa_flutter/core/models/response.dart';
|
import 'package:aman_kassa_flutter/core/models/response.dart';
|
||||||
import 'package:aman_kassa_flutter/core/models/dialog_models.dart';
|
import 'package:aman_kassa_flutter/core/models/dialog_models.dart';
|
||||||
|
|
@ -273,10 +276,24 @@ class _AdditionalTabState extends State<AdditionalTab> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_dialog.showDialog(description: 'Закрытие дня: операция прошла успешно!');
|
|
||||||
|
CloseDayData closeDayData = _bankService.closeDayDataConvert(closeDayDao.rows);
|
||||||
|
|
||||||
|
User user = Redux.store.state.userState.user;
|
||||||
|
_dataService.insertVoucher(
|
||||||
|
user: user,
|
||||||
|
name: closeDayData.title,
|
||||||
|
data: jsonEncode(closeDayData.toJson()),
|
||||||
|
total: closeDayData.totalAmount.toDouble(),
|
||||||
|
type: VoucherTypeCloseDayPosReport);
|
||||||
|
|
||||||
|
// _dialog.showDialog(description: 'Закрытие дня: операция прошла успешно!');
|
||||||
setState(() {
|
setState(() {
|
||||||
isClosePosBusy = false;
|
isClosePosBusy = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
_navigator.push(CloseDayShowRoute,
|
||||||
|
arguments: closeDayData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ class _PaymentViewState extends State<PaymentView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _nfsButtonRender() {
|
Widget _nfsButtonRender() {
|
||||||
if(!isBankApiAccess){
|
if(!isBankApiAccess || widget.model.operationType != OperationTypePay){
|
||||||
return Container();
|
return Container();
|
||||||
}
|
}
|
||||||
return StoreConnector<AppState, BankState>(
|
return StoreConnector<AppState, BankState>(
|
||||||
|
|
@ -204,36 +204,47 @@ class _PaymentViewState extends State<PaymentView> {
|
||||||
splashColor: halykColor.withOpacity(0.4),
|
splashColor: halykColor.withOpacity(0.4),
|
||||||
borderRadius: BorderRadius.circular(10.0),
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
highlightColor: halykColor.withOpacity(0.1),
|
highlightColor: halykColor.withOpacity(0.1),
|
||||||
child: Stack(
|
child: Container(
|
||||||
alignment: Alignment.center,
|
width: ScreenUtil().setSp(100.0),
|
||||||
children: [
|
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||||
Opacity(
|
decoration: BoxDecoration(
|
||||||
opacity: 0.25,
|
borderRadius: BorderRadius.circular(10.0)
|
||||||
child: Image.asset(
|
),
|
||||||
'assets/images/halyk-bank.png',
|
child: Column(
|
||||||
fit: BoxFit.cover,
|
children: [
|
||||||
|
Container(
|
||||||
width: ScreenUtil().setSp(80.0),
|
width: ScreenUtil().setSp(80.0),
|
||||||
height: ScreenUtil().setSp(90.0),
|
height: ScreenUtil().setSp(80.0),
|
||||||
|
margin: const EdgeInsets.only(bottom: 8.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: Colors.white),
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
image: DecorationImage(
|
||||||
|
image: AssetImage('assets/images/halykpos.png'), fit: BoxFit.fitWidth
|
||||||
|
),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.grey.withOpacity(0.5),
|
||||||
|
spreadRadius: 5,
|
||||||
|
blurRadius: 7,
|
||||||
|
offset: Offset(0, 3), // changes position of shadow
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
// Row(
|
||||||
Container(
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
padding: const EdgeInsets.all(8.0),
|
// children: [
|
||||||
decoration: BoxDecoration(
|
// Icon(
|
||||||
border: Border.all(color: halykColor),
|
// MdiIcons.nfc,
|
||||||
borderRadius: BorderRadius.circular(10.0)
|
// color: halykColor,
|
||||||
),
|
// size: ScreenUtil().setSp(20.0),
|
||||||
child: Column(
|
// ),
|
||||||
children: [
|
// Text('Tap2Phone',style: TextStyle(fontSize: ScreenUtil().setSp(10.0), color: halykColor, fontWeight: FontWeight.bold ),),
|
||||||
Icon(
|
// ],
|
||||||
MdiIcons.nfc,
|
// ),
|
||||||
color: halykColor,
|
],
|
||||||
size: ScreenUtil().setSp(60.0),
|
),
|
||||||
),
|
|
||||||
Text('Tap2Phone',style: TextStyle(fontSize: ScreenUtil().setSp(10.0), color: halykColor, fontWeight: FontWeight.bold ),),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,26 @@ class _PhoneViewState extends State<PhoneView> {
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Icon(MdiIcons.nfc, color: primaryColor,size: ScreenUtil().setSp(90.0),),
|
Container(
|
||||||
|
width: ScreenUtil().setSp(80.0),
|
||||||
|
height: ScreenUtil().setSp(80.0),
|
||||||
|
margin: const EdgeInsets.only(bottom: 8.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: Colors.white),
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
image: DecorationImage(
|
||||||
|
image: AssetImage('assets/images/halykpos.png'), fit: BoxFit.fitWidth
|
||||||
|
),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.grey.withOpacity(0.5),
|
||||||
|
spreadRadius: 5,
|
||||||
|
blurRadius: 7,
|
||||||
|
offset: Offset(0, 3), // changes position of shadow
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
verticalSpaceSmall,
|
verticalSpaceSmall,
|
||||||
AutoSizeText('Ожидание карты', style: TextStyle(fontWeight: FontWeight.bold),)
|
AutoSizeText('Ожидание карты', style: TextStyle(fontWeight: FontWeight.bold),)
|
||||||
],
|
],
|
||||||
|
|
@ -79,7 +98,26 @@ class _PhoneViewState extends State<PhoneView> {
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Icon(MdiIcons.shieldSearch, color: yellowColor,size: ScreenUtil().setSp(90.0),),
|
Container(
|
||||||
|
width: ScreenUtil().setSp(80.0),
|
||||||
|
height: ScreenUtil().setSp(80.0),
|
||||||
|
margin: const EdgeInsets.only(bottom: 8.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: Colors.white),
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
image: DecorationImage(
|
||||||
|
image: AssetImage('assets/images/halykpos.png'), fit: BoxFit.fitWidth
|
||||||
|
),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.grey.withOpacity(0.5),
|
||||||
|
spreadRadius: 5,
|
||||||
|
blurRadius: 7,
|
||||||
|
offset: Offset(0, 3), // changes position of shadow
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
verticalSpaceSmall,
|
verticalSpaceSmall,
|
||||||
AutoSizeText('Проверка', style: TextStyle(fontWeight: FontWeight.bold),)
|
AutoSizeText('Проверка', style: TextStyle(fontWeight: FontWeight.bold),)
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue