精华内容
下载资源
问答
  • 摘要:学习了一个月左右的Qt,想实际编写一个小程序,偶然产生一个想法,根据记账APP,可以分析各类消费数据,但是微信账单不存在分析类功能,所以编写这样一个程序,套用了网上的一些模板代码,以及Qt自带典例,...


                                                      关于微信账单分析报表程序
              摘要:学习了一个月左右的Qt,想实际编写一个小程序,偶然产生一个想法,根据记账APP,可以分析各类消费数据,但是微信账单不存在分析类功能,所以编写这样一个程序,套用了网上的一些模板代码,以及Qt自带典例,进行修改,本程序仍存在一些小问题,没有想到解决办法,待日后更深刻理解后,重新拾起再行修改。
              创作思路:
            1.编写界面框架:添加注册、登陆、忘记密码、退出等基础模块
            2.编写数据库模型框架:文档信息、注册人员信息表、所导入微信账单数据、以及数据修改查找功能
            3.加载数据图表功能:根据所导入数据,进行简单运算,绘制成图表,饼状图、以及柱形图

    在加载数据的时候,通过读取文本文件,提取所需信息,从而创建表,插入数据以及对数据的处理

     

     

                                                                               主界面框架界面


          

    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H
    //主界面
    #include <QMainWindow>
    #include <QCloseEvent>
    #include <QSqlQuery>
    namespace Ui {
    class MainWindow;
    }
    
    class MainWindow : public QMainWindow
    {
        Q_OBJECT
    
    public:
         static MainWindow* getIntance();
       // explicit MainWindow(QWidget *parent = 0);
        ~MainWindow();
         QString name;//注册者姓名
         QString passward;注册者密码
         QString identify;注册者编号
         QSqlQuery *query;
    
      //   void closeEvent(QCloseEvent *event);
    
    private slots:
        void on_pushButton_clicked();//注册按键
    
        void on_pushButton_2_clicked();//登陆按键
    
        void on_pushButton_3_clicked();//忘记密码按键
    
        void on_pushButton_4_clicked();//退出按键
    
    private:
        explicit MainWindow(QWidget *parent = 0);
        static MainWindow* MW;
        Ui::MainWindow *ui;
    };
    
    #endif // MAINWINDOW_H
    

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include"register.h"
    #include"logging.h"
    #include <QInputDialog>
    #include "mysql.h"
    #include <QSqlQuery>
    #include<QDebug>
    #include "sqlmodel.h"
    
    //主窗口
    MainWindow * MainWindow::MW=NULL;
    
    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
        QFont labelFont,buttonFont;//设置字体
        labelFont.setFamily("华文行楷");
        ui->label->setFont(labelFont);
        buttonFont.setPointSize(18);
        buttonFont.setBold(true);
        ui->pushButton->setFont(buttonFont);
        ui->pushButton_2->setFont(buttonFont);
        ui->pushButton_3->setFont(buttonFont);
        ui->pushButton_4->setFont(buttonFont);
    }
    
    
    MainWindow *MainWindow::getIntance()
    {
        if(MW == NULL)
        {
            MW = new MainWindow();
        }
        return MW;
    }
    MainWindow::~MainWindow()
    {
        MySql* mysql = new MySql;
        mysql->deleteDatas();
        delete mysql;
    
        qDebug()<<"delete";
        delete ui;
    
    
    }
    
    
    void MainWindow::on_pushButton_clicked()//注册
    {
          Register *reg = new Register(this);//弹出注册窗口
          reg->resize(390,300);
          reg->setWindowModality(Qt::WindowModal);
          reg->setWindowTitle("注册");
          reg->show();
    
    }
    
    void MainWindow::on_pushButton_2_clicked()//登陆
    {
        logging *log = new logging(this);//弹出登陆窗口
        log->resize(300,190);
        log->setWindowModality(Qt::WindowModal);
        log->setWindowTitle("登陆");
        log->show();
    }
    
    void MainWindow::on_pushButton_3_clicked()//忘记密码
    {
        bool ok;
        QInputDialog ecf;
        name = ecf.getText(this,tr("忘记密码"),tr("请输入用户名:"),QLineEdit::Normal,NULL,&ok);
        identify=ecf.getText(this,tr("忘记密码"),tr("请输入证件号:"),QLineEdit::Normal,NULL,&ok);
        MySql mysql;
        bool ret=mysql.forgetpassward(name,identify);
        if(!ret)
            {
                QMessageBox::information(this,tr("消息"),tr("消息不匹配!"),QMessageBox::Ok);
                return;
            }
        QMessageBox::information(this,tr("消息"),tr("请妥善保管您的密码:%1").arg(passward),QMessageBox::Ok);
        return;
    }
    
    void MainWindow::on_pushButton_4_clicked()//退出
    {
    
    
       //这里是想退出的时候删除掉之前创建的表,却保证每一次都产生唯一的表,保证数据的唯一性
       //如果不删除表,会造成再登陆账户使用原来的表,新添加的数据会产生冲突
        MySql* mysql = new MySql;
        mysql->closedb();
        mysql->deleteDatas();
        mysql->deleteProcessTables(sqlmodel::minMonth,sqlmodel::maxMonth,sqlmodel::Months);
        delete mysql;
    
        query=new QSqlQuery;
        while(query->next()){
            static QString deletestrnumberall = QString("drop table MonthTradeTypeNumberall%1").arg(sqlmodel::Months);
            static QString deletestrAmountOfMoneyall = QString("drop table MonthTradeTypeAmountOfMoneyall%1").arg(sqlmodel::Months);
            static QString deletestrIncomeall = QString("drop table MonthIncomeall%1").arg(sqlmodel::Months);
            static QString deletestrSpendingall = QString("drop table MonthSpendingall%1").arg(sqlmodel::Months);
    
            query->exec(deletestrnumberall);
            query->exec(deletestrAmountOfMoneyall);
            query->exec(deletestrIncomeall);
            query->exec(deletestrSpendingall);
        }
        close();
    }
    
    
    

                                                                                        注册界面

     

    #ifndef REGISTER_H
    #define REGISTER_H
    
    #include <QMainWindow>
    #include<QPushButton>
    #include<QMessageBox>
    #include"mysql.h"
    #include <QProgressDialog>
    
    //注册界面
    
    
    namespace Ui {
    class Register;
    }
    
    class Register : public QMainWindow
    {
        Q_OBJECT
    
    public:
        explicit Register(QWidget *parent = 0);
        ~Register();
    
    private slots:
        void on_yesOrNoBox_clicked(QAbstractButton *button);//只有一组按钮
    
    private:
        Ui::Register *ui;
    };
    
    #endif // REGISTER_H
    
    #include "register.h"
    #include "ui_register.h"
    
    Register::Register(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::Register)
    {
        ui->setupUi(this);
        ui->passwd->setEchoMode(QLineEdit::Password);//设置为密码模式不可见
        ui->passwd2->setEchoMode(QLineEdit::Password);
    }
    
    Register::~Register()
    {
        delete ui;
    }
    
    
    //检测是否为空,以及密码两行是否正确
    void Register::on_yesOrNoBox_clicked(QAbstractButton *button)//注册
    {
        if(ui->yesOrNoBox->button(QDialogButtonBox::Ok) == button)
        {
            if((ui->name->text() == "") || (ui->ID->text() == "") || (ui->passwd->text() == "") || (ui->passwd2->text() == ""))
            {
                QMessageBox::information(this, tr("警告"), tr("输入不能为空!!"), QMessageBox::Ok);
                return;
            }
            if(ui->passwd->text() != ui->passwd2->text())
            {
                QMessageBox::information(this, tr("警告"), tr("输入密码错误!!"), QMessageBox::Ok);
                return;
            }
    
            QString name = ui->name->text();
            QString ids = ui->ID->text();
            int id = ids.toInt();
            QString teacher = ui->passwd->text();
    
            QProgressDialog dialog(tr("正在注册"),tr("取消"), 0, 3000, this);
            dialog.setWindowTitle(tr("进度"));
            dialog.setWindowModality(Qt::WindowModal);
            dialog.show();
            for(int k = 0; k < 3000; k++)
            {
                dialog.setValue(k);
                QCoreApplication::processEvents();
                if(dialog.wasCanceled())
                {
                    break;
                }
            }
            dialog.setValue(3000);
    
    
    
    //检查用户信息表中是否存在,如存在不能注册,不存在可以正常注册
    //并会弹出提示框
            MySql* mysql = new MySql;
            bool ret = mysql->initcourses(id,name,teacher);
            if(ret == false)
            {
                QMessageBox::information(this, tr("消息"), tr("用户已被注册!"), QMessageBox::Ok);
                this->close();
                return;
            }
            QMessageBox::information(this, tr("消息"), tr("注册成功!"), QMessageBox::Ok);
            this->close();
        }
        else if(ui->yesOrNoBox->button(QDialogButtonBox::Cancel) == button)
        {
            this->close();
            QProgressDialog dialog(tr("正在返回主界面"),tr("取消"), 0, 3000, this);
            dialog.setWindowTitle(tr("进度"));
            dialog.setWindowModality(Qt::WindowModal);
            dialog.show();
            for(int k = 0; k < 3000; k++)
            {
                dialog.setValue(k);
                QCoreApplication::processEvents();
                if(dialog.wasCanceled())
                {
                    break;
                }
            }
            dialog.setValue(3000);
        }
    }
    
    
    
                                                     登陆界面

     

    #ifndef LOGGING_H
    #define LOGGING_H
    #include <QMainWindow>
    #include <QPushButton>
    #include <QMessageBox>
    #include <QProgressDialog>
    #include "mysql.h"
    
    
    //登陆界面
    
    
    #include <QAbstractButton>
    namespace Ui {
    class logging;
    }
    
    class logging : public QMainWindow
    {
        Q_OBJECT
    
    public:
        explicit logging(QWidget *parent = 0);
        ~logging();
    
    private slots:
        void on_yesOrNoBox_clicked(QAbstractButton *button);
    
    
    private:
        Ui::logging *ui;
    };
    
    #endif // LOGGING_H
    
    #include "logging.h"
    #include "ui_logging.h"
    #include <QCompleter>
    #include <QMessageBox>
    #include"sqlmodel.h"
    //登陆界面
    logging::logging(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::logging)
    {
    
    
    //这里原本添加了一个自动补全功能,后来没有用上
        ui->setupUi(this);
        QStringList wordlist;
        wordlist<<"数学"<<"英语"<<"计算机";
        QCompleter *completer = new QCompleter(wordlist,this);
        completer->setCaseSensitivity(Qt::CaseInsensitive);
        ui->lineinput->setCompleter(completer);
        ui->passward->setEchoMode(QLineEdit::Password);  //密码方式显示文本
    }
    
    logging::~logging()
    {
        delete ui;
    }
    
    
    //如果账号密码相同则可以登陆弹出数据模型界面
    //如不匹配则返回上一个窗口
    void logging::on_yesOrNoBox_clicked(QAbstractButton *button)
    {
        if(ui->yesOrNoBox->button(QDialogButtonBox::Ok)==button)
            {
                if((ui->lineinput->text()=="")||(ui->passward->text()==""))
                    {
                        QMessageBox::information(this,tr("警告"),tr("输入不能为空!"),QMessageBox::Ok);
                        return;
                    }
                QString name= ui->lineinput->text();
                QString password=ui->passward->text();
    
                QProgressDialog dialog(tr("正在登录"),tr("取消"),0,3000,this);
                dialog.setWindowTitle(tr("进度"));
                dialog.setWindowModality(Qt::WindowModal);
                dialog.show();
                for(int k=0;k<3000;k++)
                    {
                        dialog.setValue(k);
                        QCoreApplication::processEvents();
                        if(dialog.wasCanceled())
                            {
                                break;
                            }
                    }
                dialog.setValue(3000);
    
                MySql *mysql=new MySql;
                bool ret=mysql->loguser(name,password);
                if(!ret)
                    {
                        QMessageBox::information(this,tr("消息"),tr("帐号密码不匹配!"),QMessageBox::Ok);
                        this->close();
                      //  Mparent->show();   //回到上一个窗口
                        return;
                    }
                QMessageBox::information(this,tr("消息"),tr("登录成功!"),QMessageBox::Ok);
                this->close();
                sqlmodel *sql=new sqlmodel(this);
    
    //            sql->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint);
    
                sql->show();
                return;
               }
        else if(ui->yesOrNoBox->button(QDialogButtonBox::Cancel)==button)
            {
                this->close();
                QProgressDialog dialog(tr("正在返回主界面"),tr("取消"),0,3000,this);
                dialog.setWindowTitle(tr("进度"));
                dialog.setWindowModality(Qt::WindowModal);
                dialog.show();
                for(int k=0;k<3000;k++)
                    {
                        dialog.setValue(k);
                        QCoreApplication::processEvents();
                        if(dialog.wasCanceled())
                            {
                                break;
                            }
                    }
                dialog.setValue(3000);
            }
    }
    
    
    
    

    这里忘记密码和退出就不介绍了,代码再mainWindow里面

    下面介绍数据库的使用

    #ifndef MYSQL_H
    #define MYSQL_H
    #include<QSqlTableModel>
    #include <QSql>
    #include <QSqlDatabase>
    #include <QDebug>
    #include <QSqlQuery>
    #include <QMessageBox>
    #include "mainwindow.h"
    class QSqlTableModel;
    class MySql
    {
    public:
        MySql();
        void initsql();//配置数据库
        bool loguser(QString name,QString passward);//检验账号密码
        void createtable();            //建用户信息密码表
        void createnewtable();         //创建数据表微信账单所包含的信息
        bool forgetpassward(QString name,QString identify);//忘记密码处理
        void dataProcessingTable(int minMonth,int maxMonth,int Months);//删除所有数据表
        void theDataProcess(int minMonth,int maxMonth,int Months);//数据计算
    
    //bool inituser(int id,QString name,QString teacher);
    bool initcourses(int id,QString name,QString teacher);//添加注册信息
    void initdatas(int id,QString TradingHours ,QString TradeType ,QString CounterParty,QString Goods ,
                           QString IncomeAndExpenses ,QString Sum ,QString MethodOfPayment ,
                           QString TheCurrentState ,QString TransactionNumber,
                           QString GoodsNumber ,QString Note );//添加微信账单所包含的信息
    void deleteDatas();//清除数据表(微信账单的所有数据)
    //void deleteProcessTable(int months);
    void deleteProcessTables(int minMonth,int maxMonth,int Months );//清除所产生的分析数据
    void closedb();//关闭数据库
    
    
    
    private:
        QSqlQuery *query;
        QSqlTableModel *model;
        QSqlDatabase db;
    
    };
    
    #endif // MYSQL_H
    
    #include "mysql.h"
    //数据库
    MySql::MySql()
    {
    
    }
    
    void MySql::initsql()
    {
    
    //由于Qt自带数据库驱动支持QSQLITE,所以选择这个数据库,基本连接方式,翻书参考教程
        QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
        db.setHostName("127.0.0.1");//本地主机
        db.setUserName("root");
        db.setPassword("123456");
        db.setDatabaseName("Stu.db");//数据库名称”Stu“
    
    //数据库打开,则控制台输出"Database connected successfully!"否则弹出警告窗口
    
        if(db.open())
        {
            qDebug()<<"Database connected successfully!";
    
            return;
        }
        else
        {
            QMessageBox::critical(0,"Cannot open database","Unable to establish a database connection.",QMessageBox::Cancel);
        }
    
    }
    
    bool MySql::loguser(QString name,QString passward)
    {
    
    //检测账号密码是否正确
    //运用查找语句以及数据表的数据对比,有的地方需要格式转换如toInt(),toString()需要什么种类的数据
    //自行筛选转换
        bool check = false;
        query=new QSqlQuery;
        query->exec("select * from courses");
    
        while(query->next()){
            qDebug()<<query->value(0).toInt()<<query->value(1).toString()<<query->value(2).toString();
            if((name==query->value(1).toString())&&(passward==query->value(2).toString()))
            {
                      check =true;
            }
        }
        if(check==true){
            return true;
        }
        else
            return false;
    }
    
    void MySql::createtable()
    {
    
        QSqlQuery query;
    
         //创建表,这张表用来储存用户信息
         // 创建courses表
        query.exec("create table courses (id int primary key, "
                           "name varchar, teacher varchar)");
    
    
    
    }
    
    void MySql::createnewtable()
    {
        QSqlQuery query;
        //创建数据表datas
        //这张表用来储存从微信账单中读出的每一条数据,
      bool ret =    query.exec("create table datas (id int primary key, "
                           "TradingHours varchar, TradeType varchar,CounterParty varchar,Goods varchar,"
                   "IncomeAndExpenses varchar,Sum varchar,MethodOfPayment varchar,"
                   "TheCurrentState varchar,TransactionNumber varchar,"
                   "GoodsNumber varchar,Note varchar)");
      qDebug()<<ret<<"datas";
    
    }
    
    bool MySql::forgetpassward(QString name, QString identify)
    {
    
    //这里是密码找回功能,如忘记密码,提供账号以及编号可获取密码
        bool check = false;
        query=new QSqlQuery;
        query->exec("select * from courses");
        QString ids = identify;
        int id = ids.toInt();
    
        while(query->next()){
            qDebug()<<query->value(0).toInt()<<query->value(1).toString()<<query->value(2).toString();
            if((name==query->value(1).toString())||(id==query->value(0).toInt()))
            {
                      check =true;
                      MainWindow *MW=MainWindow::getIntance();
                      MW->passward=query->value(2).toString();
            }
        }
        if(check==true){
            return true;
        }
        else
            return false;
    }
    
    void MySql::dataProcessingTable(int minMonth, int maxMonth, int Months)//创建数据处理表
    {
        QSqlQuery query;
    //这里是创建数据处理表,每一份微信账单可能有1-4个月份,因此根据月份不同自动识别创建表
    //有类型数据表,类型价格表,收入价格表,支出价格表
    //创建表都是重复过程代码量有些长,看第一个case(1)就好了
        switch(Months){
        case (1):{
           static QString strnumber1 = QString("create table MonthTradeTypeNumber%1(id int primary key,consumption int,"
                                  "transfer int,other int,transferTheRefund int,"
                                  "changeWithDraeal int,scanningQrCodeToPay int,"
                                  "weChatLuckyMoney int,ChangeToPrepaidPhone int)").arg(minMonth);
           static QString strAmountOfMoney1 = QString("create table MonthTradeTypeAmountOfMoney%1(id int primary key,consumption double,"
                                  "transfer double,other double,transferTheRefund double,"
                                  "changeWithDraeal double,scanningQrCodeToPay double,"
                                  "weChatLuckyMoney double,ChangeToPrepaidPhone double)").arg(minMonth);
           static QString strIncome1 = QString("create table MonthIncome%1(id int primary key,IncomeNumber double)").arg(minMonth);
           static QString strSpending1 = QString("create table MonthSpending%1(id int primary key,IncomeNumber double)").arg(minMonth);
    
    
        bool strn1 =    query.exec(strnumber1);
        bool stra1 =    query.exec(strAmountOfMoney1);
        bool stri1 =    query.exec(strIncome1);
        bool strs1 =    query.exec(strSpending1);
            qDebug()<<strn1<<stra1<<stri1<<strs1<<"成功创建四个处理数据表单";
    
        } break;
        case(2):{
    
            //总表
            static QString strnumberall = QString("create table MonthTradeTypeNumberall%1(id int primary key,consumption int,"
                                   "transfer int,other int,transferTheRefund int,"
                                   "changeWithDraeal int,scanningQrCodeToPay int,"
                                   "weChatLuckyMoney int,ChangeToPrepaidPhone int)").arg(Months);
            static QString strAmountOfMoneyall = QString("create table MonthTradeTypeAmountOfMoneyall%1(id int primary key,consumption double,"
                                   "transfer double,other double,transferTheRefund double,"
                                   "changeWithDraeal double,scanningQrCodeToPay double,"
                                   "weChatLuckyMoney double,ChangeToPrepaidPhone double)").arg(Months);
            static QString strIncomeall = QString("create table MonthIncomeall%1(id int primary key,IncomeNumber double)").arg(Months);
            static QString strSpendingall = QString("create table MonthSpendingall%1(id int primary key,IncomeNumber double)").arg(Months);
    
    
    
    
            //小月份
            static QString strnumber1 = QString("create table MonthTradeTypeNumber%1(id int primary key,consumption int,"
                                   "transfer int,other int,transferTheRefund int,"
                                   "changeWithDraeal int,scanningQrCodeToPay int,"
                                   "weChatLuckyMoney int,ChangeToPrepaidPhone int)").arg(minMonth);
            static QString strAmountOfMoney1 = QString("create table MonthTradeTypeAmountOfMoney%1(id int primary key,consumption double,"
                                   "transfer double,other double,transferTheRefund double,"
                                   "changeWithDraeal double,scanningQrCodeToPay double,"
                                   "weChatLuckyMoney double,ChangeToPrepaidPhone double)").arg(minMonth);
            static QString strIncome1 = QString("create table MonthIncome%1(id int primary key,IncomeNumber double)").arg(minMonth);
            static QString strSpending1 = QString("create table MonthSpending%1(id int primary key,IncomeNumber double)").arg(minMonth);
    
    
    
            //大月份
            static QString strnumber2 = QString("create table MonthTradeTypeNumber%1(id int primary key,consumption int,"
                                   "transfer int,other int,transferTheRefund int,"
                                   "changeWithDraeal int,scanningQrCodeToPay int,"
                                   "weChatLuckyMoney int,ChangeToPrepaidPhone int)").arg(maxMonth);
            static QString strAmountOfMoney2 = QString("create table MonthTradeTypeAmountOfMoney%1(id int primary key,consumption double,"
                                   "transfer double,other double,transferTheRefund double,"
                                   "changeWithDraeal double,scanningQrCodeToPay double,"
                                   "weChatLuckyMoney double,ChangeToPrepaidPhone double)").arg(maxMonth);
            static QString strIncome2 = QString("create table MonthIncome%1(id int primary key,IncomeNumber double)").arg(maxMonth);
            static QString strSpending2 = QString("create table MonthSpending%1(id int primary key,IncomeNumber double)").arg(maxMonth);
    
            query.exec(strnumberall);
            query.exec(strAmountOfMoneyall);
            query.exec(strIncomeall);
            query.exec(strSpendingall);
    
    
    
    
            query.exec(strnumber1);
            query.exec(strAmountOfMoney1);
            query.exec(strIncome1);
            query.exec(strSpending1);
            query.exec(strnumber2);
            query.exec(strAmountOfMoney2);
            query.exec(strIncome2);
            query.exec(strSpending2);
    
        }break;
        case(3):{
    
            //总表
            static QString strnumberall = QString("create table MonthTradeTypeNumberall%1(id int primary key,consumption int,"
                                   "transfer int,other int,transferTheRefund int,"
                                   "changeWithDraeal int,scanningQrCodeToPay int,"
                                   "weChatLuckyMoney int,ChangeToPrepaidPhone int)").arg(Months);
            static QString strAmountOfMoneyall = QString("create table MonthTradeTypeAmountOfMoneyall%1(id int primary key,consumption double,"
                                   "transfer double,other double,transferTheRefund double,"
                                   "changeWithDraeal double,scanningQrCodeToPay double,"
                                   "weChatLuckyMoney double,ChangeToPrepaidPhone double)").arg(Months);
            static QString strIncomeall = QString("create table MonthIncomeall%1(id int primary key,IncomeNumber double)").arg(Months);
            static QString strSpendingall = QString("create table MonthSpendingall%1(id int primary key,IncomeNumber double)").arg(Months);
    
    
            //小月份
            static QString strnumber1 = QString("create table MonthTradeTypeNumber%1(id int primary key,consumption int,"
                                   "transfer int,other int,transferTheRefund int,"
                                   "changeWithDraeal int,scanningQrCodeToPay int,"
                                   "weChatLuckyMoney int,ChangeToPrepaidPhone int)").arg(minMonth);
            static QString strAmountOfMoney1 = QString("create table MonthTradeTypeAmountOfMoney%1(id int primary key,consumption double,"
                                   "transfer double,other double,transferTheRefund double,"
                                   "changeWithDraeal double,scanningQrCodeToPay double,"
                                   "weChatLuckyMoney double,ChangeToPrepaidPhone double)").arg(minMonth);
            static QString strIncome1 = QString("create table MonthIncome%1(id int primary key,IncomeNumber double)").arg(minMonth);
            static QString strSpending1 = QString("create table MonthSpending%1(id int primary key,IncomeNumber double)").arg(minMonth);
    
    
    
            //中月份
            static QString strnumber2 = QString("create table MonthTradeTypeNumber%1(id int primary key,consumption int,"
                                   "transfer int,other int,transferTheRefund int,"
                                   "changeWithDraeal int,scanningQrCodeToPay int,"
                                   "weChatLuckyMoney int,ChangeToPrepaidPhone int)").arg(minMonth+1);
            static QString strAmountOfMoney2 = QString("create table MonthTradeTypeAmountOfMoney%1(id int primary key,consumption double,"
                                   "transfer double,other double,transferTheRefund double,"
                                   "changeWithDraeal double,scanningQrCodeToPay double,"
                                   "weChatLuckyMoney double,ChangeToPrepaidPhone double)").arg(minMonth+1);
            static QString strIncome2 = QString("create table MonthIncome%1(id int primary key,IncomeNumber double)").arg(minMonth+1);
            static QString strSpending2 = QString("create table MonthSpending%1(id int primary key,IncomeNumber double)").arg(minMonth+1);
    
    
    
    
            //大月份
            static QString strnumber3 = QString("create table MonthTradeTypeNumber%1(id int primary key,consumption int,"
                                   "transfer int,other int,transferTheRefund int,"
                                   "changeWithDraeal int,scanningQrCodeToPay int,"
                                   "weChatLuckyMoney int,ChangeToPrepaidPhone int)").arg(maxMonth);
            static QString strAmountOfMoney3 = QString("create table MonthTradeTypeAmountOfMoney%1(id int primary key,consumption double,"
                                   "transfer double,other double,transferTheRefund double,"
                                   "changeWithDraeal double,scanningQrCodeToPay double,"
                                   "weChatLuckyMoney double,ChangeToPrepaidPhone double)").arg(maxMonth);
            static QString strIncome3 = QString("create table MonthIncome%1(id int primary key,IncomeNumber double)").arg(maxMonth);
            static QString strSpending3 = QString("create table MonthSpending%1(id int primary key,IncomeNumber double)").arg(maxMonth);
    
            query.exec(strnumberall);
            query.exec(strAmountOfMoneyall);
            query.exec(strIncomeall);
            query.exec(strSpendingall);
    
    
            query.exec(strnumber1);
            query.exec(strAmountOfMoney1);
            query.exec(strIncome1);
            query.exec(strSpending1);
            query.exec(strnumber2);
            query.exec(strAmountOfMoney2);
            query.exec(strIncome2);
            query.exec(strSpending2);
            query.exec(strnumber3);
            query.exec(strAmountOfMoney3);
            query.exec(strIncome3);
            query.exec(strSpending3);
    
    
    
        } break;
        case(4):{
    
    
    
            //总表
            static QString strnumberall = QString("create table MonthTradeTypeNumberall%1(id int primary key,consumption int,"
                                   "transfer int,other int,transferTheRefund int,"
                                   "changeWithDraeal int,scanningQrCodeToPay int,"
                                   "weChatLuckyMoney int,ChangeToPrepaidPhone int)").arg(Months);
            static QString strAmountOfMoneyall = QString("create table MonthTradeTypeAmountOfMoneyall%1(id int primary key,consumption double,"
                                   "transfer double,other double,transferTheRefund double,"
                                   "changeWithDraeal double,scanningQrCodeToPay double,"
                                   "weChatLuckyMoney double,ChangeToPrepaidPhone double)").arg(Months);
            static QString strIncomeall = QString("create table MonthIncomeall%1(id int primary key,IncomeNumber double)").arg(Months);
            static QString strSpendingall = QString("create table MonthSpendingall%1(id int primary key,IncomeNumber double)").arg(Months);
    
    
            //小1月
            static QString strnumber1 = QString("create table MonthTradeTypeNumber%1(id int primary key,consumption int,"
                                   "transfer int,other int,transferTheRefund int,"
                                   "changeWithDraeal int,scanningQrCodeToPay int,"
                                   "weChatLuckyMoney int,ChangeToPrepaidPhone int)").arg(minMonth);
            static QString strAmountOfMoney1 = QString("create table MonthTradeTypeAmountOfMoney%1(id int primary key,consumption double,"
                                   "transfer double,other double,transferTheRefund double,"
                                   "changeWithDraeal double,scanningQrCodeToPay double,"
                                   "weChatLuckyMoney double,ChangeToPrepaidPhone double)").arg(minMonth);
            static QString strIncome1 = QString("create table MonthIncome%1(id int primary key,IncomeNumber double)").arg(minMonth);
            static QString strSpending1 = QString("create table MonthSpending%1(id int primary key,IncomeNumber double)").arg(minMonth);
    
    
    
    
            //小2月
            static QString strnumber2 = QString("create table MonthTradeTypeNumber%1(id int primary key,consumption int,"
                                   "transfer int,other int,transferTheRefund int,"
                                   "changeWithDraeal int,scanningQrCodeToPay int,"
                                   "weChatLuckyMoney int,ChangeToPrepaidPhone int)").arg(minMonth+1);
            static QString strAmountOfMoney2 = QString("create table MonthTradeTypeAmountOfMoney%1(id int primary key,consumption double,"
                                   "transfer double,other double,transferTheRefund double,"
                                   "changeWithDraeal double,scanningQrCodeToPay double,"
                                   "weChatLuckyMoney double,ChangeToPrepaidPhone double)").arg(minMonth+1);
            static QString strIncome2 = QString("create table MonthIncome%1(id int primary key,IncomeNumber double)").arg(minMonth+1);
            static QString strSpending2 = QString("create table MonthSpending%1(id int primary key,IncomeNumber double)").arg(minMonth+1);
    
    
    
    
            //大3月
            static QString strnumber3 = QString("create table MonthTradeTypeNumber%1(id int primary key,consumption int,"
                                   "transfer int,other int,transferTheRefund int,"
                                   "changeWithDraeal int,scanningQrCodeToPay int,"
                                   "weChatLuckyMoney int,ChangeToPrepaidPhone int)").arg(maxMonth-1);
            static QString strAmountOfMoney3 = QString("create table MonthTradeTypeAmountOfMoney%1(id int primary key,consumption double,"
                                   "transfer double,other double,transferTheRefund double,"
                                   "changeWithDraeal double,scanningQrCodeToPay double,"
                                   "weChatLuckyMoney double,ChangeToPrepaidPhone double)").arg(maxMonth-1);
            static QString strIncome3 = QString("create table MonthIncome%1(id int primary key,IncomeNumber double)").arg(maxMonth-1);
            static QString strSpending3 = QString("create table MonthSpending%1(id int primary key,IncomeNumber double)").arg(maxMonth-1);
    
            //大4月
            static QString strnumber4 = QString("create table MonthTradeTypeNumber%1(id int primary key,consumption int,"
                                   "transfer int,other int,transferTheRefund int,"
                                   "changeWithDraeal int,scanningQrCodeToPay int,"
                                   "weChatLuckyMoney int,ChangeToPrepaidPhone int)").arg(maxMonth);
            static QString strAmountOfMoney4 = QString("create table MonthTradeTypeAmountOfMoney%1(id int primary key,consumption double,"
                                   "transfer double,other double,transferTheRefund double,"
                                   "changeWithDraeal double,scanningQrCodeToPay double,"
                                   "weChatLuckyMoney double,ChangeToPrepaidPhone double)").arg(maxMonth);
            static QString strIncome4 = QString("create table MonthIncome%1(id int primary key,IncomeNumber double)").arg(maxMonth);
            static QString strSpending4 = QString("create table MonthSpending%1(id int primary key,IncomeNumber double)").arg(maxMonth);
    
    
    
    
            query.exec(strnumberall);
            query.exec(strAmountOfMoneyall);
            query.exec(strIncomeall);
            query.exec(strSpendingall);
    
    
    
    
            query.exec(strnumber1);
            query.exec(strAmountOfMoney1);
            query.exec(strIncome1);
            query.exec(strSpending1);
            query.exec(strnumber2);
            query.exec(strAmountOfMoney2);
            query.exec(strIncome2);
            query.exec(strSpending2);
            query.exec(strnumber3);
            query.exec(strAmountOfMoney3);
            query.exec(strIncome3);
            query.exec(strSpending3);
            query.exec(strnumber4);
            query.exec(strAmountOfMoney4);
            query.exec(strIncome4);
            query.exec(strSpending4);
    
    
        } break;
    
        }
    
    }
    
    void MySql::theDataProcess(int minMonth, int maxMonth, int Months)
    {
    
    
    //这里是对创建完的数据分析表进行运算添加数据,为后面的图表做数据基础准备
    //这里只是运用了累加的方法处理数据,可以进行适当拓展,只要提供EXCEL表格公式
    //是可以实现多功能运算
        query=new QSqlQuery;
        qDebug()<<"theDataProcess";
    
    
        if(Months==1){
            int c1=0,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0;
            int a1=1;
            double d1=0,d2=0,d3=0,d4=0,d5=0,d6=0,d7=0,d8=0;
            double e1=0,e2=0;
           qDebug()<<"1";
           query->exec("select * from datas");
           while(query->next()){
    
    
    
    
           if(query->value(5)=="收入"){
               e1+=query->value(6).toString().remove(0,1).toDouble();
    
           }else if (query->value(5)!="") {
               e2+=query->value(6).toString().remove(0,1).toDouble();
           }
           if(query->value(2).toString()=="商户消费")
           {
               c1++;//consumption
    
              d1+=query->value(6).toString().remove(0,1).toDouble();
    
           }else if (query->value(2).toString()=="转账") {
    
               c2++;//transfer
    
               d2+=query->value(6).toString().remove(0,1).toDouble();
    
           }else if (query->value(2).toString()=="转账-退款") {
    \
               c3++;//transferTheRefund
               d3+=query->value(6).toString().remove(0,1).toDouble();
              // qDebug()<<d3;
           }else if (query->value(2).toString()=="零钱提现") {
    
               c4++;//changeWithDraeal
               d4+=query->value(6).toString().remove(0,1).toDouble();
             //  qDebug()<<d4;
           }else if (query->value(2).toString()=="扫二维码付款") {
    
               c5++;//scanningQrCodeToPay
               d5+=query->value(6).toString().remove(0,1).toDouble();
             //  qDebug()<<d5;
           }else if (query->value(2).toString()=="微信红包") {
    
               c6++;//weChatLuckyMoney
               d6+=query->value(6).toString().remove(0,1).toDouble();
              // qDebug()<<d6;
           }else if (query->value(2).toString()=="零钱充值") {
    
               c7++;//ChangeToPrepaidPhone
               d7+=query->value(6).toString().remove(0,1).toDouble();
             //  qDebug()<<d7;
           }else if(query->value(2).toString()!=""){
               c8++;//other
               d8+=query->value(6).toString().remove(0,1).toDouble();
             //  qDebug()<<d8;
                 }
           }
    
    
    
    
           query->exec(QString("insert into MonthTradeTypeNumber%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(minMonth).arg(a1)
                       .arg(c1).arg(c2).arg(c8).arg(c3).arg(c4).arg(c5).arg(c6).arg(c7));
           qDebug()<<QString("insert into MonthTradeTypeNumber%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(minMonth).arg(a1)
                     .arg(c1).arg(c2).arg(c8).arg(c3).arg(c4).arg(c5).arg(c6).arg(c7);
           qDebug()<<d1<<d2<<d3<<d4<<d5<<d6<<d7<<d8;
    
           query->exec(QString("insert into MonthTradeTypeAmountOfMoney%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(minMonth).arg(a1)
                       .arg(d1).arg(d2).arg(d8).arg(d3).arg(d4).arg(d5).arg(d6).arg(d7));
           qDebug()<<QString("insert into MonthTradeTypeAmountOfMoney%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(minMonth).arg(a1)
                     .arg(d1).arg(d2).arg(d8).arg(d3).arg(d4).arg(d5).arg(d6).arg(d7);
    
    
           query->exec(QString("insert into MonthIncome%1 values('%2','%3')").arg(minMonth).arg(a1)
                       .arg(e1));
           query->exec(QString("insert into MonthSpending%1 values('%2','%3')").arg(minMonth).arg(a1)
                       .arg(e2));
           qDebug()<<QString("insert into MonthIncome%1 values('%2','%3')").arg(minMonth).arg(a1)
                     .arg(e1);
           qDebug()<<QString("insert into MonthSpending%1 values('%2','%3')").arg(minMonth).arg(a1)
                     .arg(e2);
           qDebug()<<"收入"<<e1<<"支出"<<e2;
    
    
    
        }
    
        if(Months==2){
    
    
            int c1=0,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0;//类型统计数目表
            int f1=0,f2=0,f3=0,f4=0,f5=0,f6=0,f7=0,f8=0;
            int all1=0,all2=0,all3=0,all4=0,all5=0,all6=0,all7=0,all8=0;
    
            int a1=1;
            double d1=0,d2=0,d3=0,d4=0,d5=0,d6=0,d7=0,d8=0;//类型统计钱数表
            double g1=0,g2=0,g3=0,g4=0,g5=0,g6=0,g7=0,g8=0;
            double alm1,alm2,alm3,alm4,alm5,alm6,alm7,alm8;
    
            double e1=0,e2=0;//收入总钱数e1,支出总钱数e2
            double h1=0,h2=0;
            double almm1=0,almm2=0;
    
            qDebug()<<"2";
            query->exec("select * from datas");
            while(query->next()){
                if(   qAbs(query->value(1).toString().mid(4,3).remove(QChar ('/')).toInt())==minMonth)
                {
                    if(query->value(5)=="收入"){
                        e1+=query->value(6).toString().remove(0,1).toDouble();
    
                    }else if (query->value(5)!="") {
                        e2+=query->value(6).toString().remove(0,1).toDouble();
                    }
                    if(query->value(2).toString()=="商户消费")
                    {
                        c1++;//consumption
                    //  qDebug()<<query->value(6).toString().remove(0,1).toDouble();
                       d1+=query->value(6).toString().remove(0,1).toDouble();
                    //  qDebug()<<d1;
                    }else if (query->value(2).toString()=="转账") {
    
                        c2++;//transfer
                        //qDebug()<<query->value(6).toString().remove(0,1).toDouble();
                        d2+=query->value(6).toString().remove(0,1).toDouble();
                        //qDebug()<<d2;
                    }else if (query->value(2).toString()=="转账-退款") {
             \
                        c3++;//transferTheRefund
                        d3+=query->value(6).toString().remove(0,1).toDouble();
                       // qDebug()<<d3;
                    }else if (query->value(2).toString()=="零钱提现") {
    
                        c4++;//changeWithDraeal
                        d4+=query->value(6).toString().remove(0,1).toDouble();
                      //  qDebug()<<d4;
                    }else if (query->value(2).toString()=="扫二维码付款") {
    
                        c5++;//scanningQrCodeToPay
                        d5+=query->value(6).toString().remove(0,1).toDouble();
                      //  qDebug()<<d5;
                    }else if (query->value(2).toString()=="微信红包") {
    
                        c6++;//weChatLuckyMoney
                        d6+=query->value(6).toString().remove(0,1).toDouble();
                       // qDebug()<<d6;
                    }else if (query->value(2).toString()=="零钱充值") {
    
                        c7++;//ChangeToPrepaidPhone
                        d7+=query->value(6).toString().remove(0,1).toDouble();
                      //  qDebug()<<d7;
                    }else if(query->value(2).toString()!=""){
                        c8++;//other
                        d8+=query->value(6).toString().remove(0,1).toDouble();
                      //  qDebug()<<d8;
                          }
                    }
    
    
    
    
                else if(qAbs(query->value(1).toString().mid(4,3).remove(QChar ('/')).toInt())==maxMonth)
                {
                if(query->value(5)=="收入"){
                    h1+=query->value(6).toString().remove(0,1).toDouble();
    
                }else if (query->value(5)!="") {
                    h2+=query->value(6).toString().remove(0,1).toDouble();
                }
                if(query->value(2).toString()=="商户消费")
                {
                    f1++;//consumption
    
                   g1+=query->value(6).toString().remove(0,1).toDouble();
    
                }else if (query->value(2).toString()=="转账") {
    
                    f2++;//transfer
    
                    g2+=query->value(6).toString().remove(0,1).toDouble();
        
                }else if (query->value(2).toString()=="转账-退款") {
         \
                    f3++;//transferTheRefund
                    g3+=query->value(6).toString().remove(0,1).toDouble();
       
                }else if (query->value(2).toString()=="零钱提现") {
    
                    f4++;//changeWithDraeal
                    g4+=query->value(6).toString().remove(0,1).toDouble();
         
                }else if (query->value(2).toString()=="扫二维码付款") {
    
                    f5++;//scanningQrCodeToPay
                    g5+=query->value(6).toString().remove(0,1).toDouble();
             
                }else if (query->value(2).toString()=="微信红包") {
    
                    f6++;//weChatLuckyMoney
                    g6+=query->value(6).toString().remove(0,1).toDouble();
               
                }else if (query->value(2).toString()=="零钱充值") {
    
                    f7++;//ChangeToPrepaidPhone
                    g7+=query->value(6).toString().remove(0,1).toDouble();
            
                }else if(query->value(2).toString()!=""){
                    f8++;//other
                    g8+=query->value(6).toString().remove(0,1).toDouble();
               
                      }
                }
    
                }
    
            all1=c1+f1;
            all2=c2+f2;
            all3=c3+f3;
            all4=c4+f4;
            all5=c5+f5;
            all6=c6+f6;
            all7=c7+f7;
            all8=c8+f8;
    
            alm1=d1+g1;
            alm2=d2+g2;
            alm3=d3+g3;
            alm4=d4+g4;
            alm5=d5+g5;
            alm6=d6+g6;
            alm7=d7+g7;
            alm8=d8+g8;
    
            almm1=e1+h1;
            almm2=e2+h2;
           //小月份
            query->exec(QString("insert into MonthTradeTypeNumber%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(minMonth).arg(a1)
                        .arg(c1).arg(c2).arg(c8).arg(c3).arg(c4).arg(c5).arg(c6).arg(c7));
            query->exec(QString("insert into MonthTradeTypeAmountOfMoney%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(minMonth).arg(a1)
                        .arg(d1).arg(d2).arg(d8).arg(d3).arg(d4).arg(d5).arg(d6).arg(d7));
            query->exec(QString("insert into MonthIncome%1 values('%2','%3')").arg(minMonth).arg(a1)
                        .arg(e1));
            query->exec(QString("insert into MonthSpending%1 values('%2','%3')").arg(minMonth).arg(a1)
                       .arg(e2));
    
    
            //大月份
           query->exec(QString("insert into MonthTradeTypeNumber%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(maxMonth).arg(a1)
                                    .arg(f1).arg(f2).arg(f8).arg(f3).arg(f4).arg(f5).arg(f6).arg(f7));
           query->exec(QString("insert into MonthTradeTypeAmountOfMoney%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(maxMonth).arg(a1)
                       .arg(alm1).arg(alm2).arg(alm8).arg(alm3).arg(alm4).arg(alm5).arg(alm6).arg(alm7));
           query->exec(QString("insert into MonthIncome%1 values('%2','%3')").arg(maxMonth).arg(a1)
                       .arg(h1));
           query->exec(QString("insert into MonthSpending%1 values('%2','%3')").arg(maxMonth).arg(a1)
                      .arg(h2));
    
    
           //总表
           query->exec(QString("insert into MonthTradeTypeNumberall%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(Months).arg(a1)
                                    .arg(all1).arg(all2).arg(all8).arg(all3).arg(all4).arg(all5).arg(all6).arg(all7));
           query->exec(QString("insert into MonthTradeTypeAmountOfMoneyall%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(Months).arg(a1)
                       .arg(g1).arg(g2).arg(g8).arg(g3).arg(g4).arg(g5).arg(g6).arg(g7));
           query->exec(QString("insert into MonthIncomeall%1 values('%2','%3')").arg(Months).arg(a1)
                       .arg(almm1));
           query->exec(QString("insert into MonthSpendingall%1 values('%2','%3')").arg(Months).arg(a1)
                      .arg(almm2));
    
    
    
        }
        if(Months==3){
    
            int z1=1;
    
            int a1=0,a2=0,a3=0,a4=0,a5=0,a6=0,a7=0,a8=0;//类型统计数目表
            int b1=0,b2=0,b3=0,b4=0,b5=0,b6=0,b7=0,b8=0;
            int c1=0,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0;
            int all1=0,all2=0,all3=0,all4=0,all5=0,all6=0,all7=0,all8=0;
    
    
            double f1=0,f2=0,f3=0,f4=0,f5=0,f6=0,f7=0,f8=0;//类型统计钱数表
            double g1=0,g2=0,g3=0,g4=0,g5=0,g6=0,g7=0,g8=0;
            double h1=0,h2=0,h3=0,h4=0,h5=0,h6=0,h7=0,h8=0;
            double alm1,alm2,alm3,alm4,alm5,alm6,alm7,alm8;
    
    
            double j1=0,j2=0;//收入总钱数e1,支出总钱数e2
            double k1=0,k2=0;
            double l1=0,l2=0;
            double almm1=0,almm2=0;
    
            qDebug()<<"3";
            query->exec("select * from datas");
            while(query->next()){
                if( qAbs(query->value(1).toString().mid(4,3).remove(QChar ('/')).toInt())==minMonth)
                {
                    if(query->value(5)=="收入"){
                        j1+=query->value(6).toString().remove(0,1).toDouble();
    
                    }else if (query->value(5)!="") {
                        j2+=query->value(6).toString().remove(0,1).toDouble();
                    }
                    if(query->value(2).toString()=="商户消费")
                    {
                        a1++;//consumption
               
                       f1+=query->value(6).toString().remove(0,1).toDouble();
              
                    }else if (query->value(2).toString()=="转账") {
    
                        a2++;//transfer
                    
                        f2+=query->value(6).toString().remove(0,1).toDouble();
                 
                    }else if (query->value(2).toString()=="转账-退款") {
             \
                        a3++;//transferTheRefund
                        f3+=query->value(6).toString().remove(0,1).toDouble();
                
                    }else if (query->value(2).toString()=="零钱提现") {
    
                        a4++;//changeWithDraeal
                        f4+=query->value(6).toString().remove(0,1).toDouble();
               
                    }else if (query->value(2).toString()=="扫二维码付款") {
    
                        a5++;//scanningQrCodeToPay
                        f5+=query->value(6).toString().remove(0,1).toDouble();
                  
                    }else if (query->value(2).toString()=="微信红包") {
    
                        a6++;//weChatLuckyMoney
                        f6+=query->value(6).toString().remove(0,1).toDouble();
                   
                    }else if (query->value(2).toString()=="零钱充值") {
    
                        a7++;//ChangeToPrepaidPhone
                        f7+=query->value(6).toString().remove(0,1).toDouble();
                   
                    }else if(query->value(2).toString()!=""){
                        a8++;//other
                        f8+=query->value(6).toString().remove(0,1).toDouble();
                
                          }
                    }
    
    
    
    
                else if(qAbs(query->value(1).toString().mid(4,3).remove(QChar ('/')).toInt())==(minMonth)+1)
                {
                if(query->value(5)=="收入"){
                    k1+=query->value(6).toString().remove(0,1).toDouble();
    
                }else if (query->value(5)!="") {
                    k2+=query->value(6).toString().remove(0,1).toDouble();
                }
                if(query->value(2).toString()=="商户消费")
                {
         
                   g1+=query->value(6).toString().remove(0,1).toDouble();
            
                }else if (query->value(2).toString()=="转账") {
    
                    b2++;//transfer
                 
                    g2+=query->value(6).toString().remove(0,1).toDouble();
                  
                }else if (query->value(2).toString()=="转账-退款") {
         \
                    b3++;//transferTheRefund
                    g3+=query->value(6).toString().remove(0,1).toDouble();
                  
                }else if (query->value(2).toString()=="零钱提现") {
    
                    b4++;//changeWithDraeal
                    g4+=query->value(6).toString().remove(0,1).toDouble();
               
                }else if (query->value(2).toString()=="扫二维码付款") {
    
                    b5++;//scanningQrCodeToPay
                    g5+=query->value(6).toString().remove(0,1).toDouble();
               
                }else if (query->value(2).toString()=="微信红包") {
    
                    b6++;//weChatLuckyMoney
                    g6+=query->value(6).toString().remove(0,1).toDouble();
              
                }else if (query->value(2).toString()=="零钱充值") {
    
                    b7++;//ChangeToPrepaidPhone
                    g7+=query->value(6).toString().remove(0,1).toDouble();
                
                }else if(query->value(2).toString()!=""){
                    b8++;//other
                    g8+=query->value(6).toString().remove(0,1).toDouble();
                  
                      }
                }
                else if (qAbs(query->value(1).toString().mid(4,3).remove(QChar ('/')).toInt())==maxMonth) {
    
                    if(query->value(5)=="收入"){
                        l1+=query->value(6).toString().remove(0,1).toDouble();
    
                    }else if (query->value(5)!="") {
                        l2+=query->value(6).toString().remove(0,1).toDouble();
                    }
                    if(query->value(2).toString()=="商户消费")
                    {
                        c1++;//consumption
          
                        h1+=query->value(6).toString().remove(0,1).toDouble();
              
                    }else if (query->value(2).toString()=="转账") {
    
                        c2++;//transfer
            
                        h2+=query->value(6).toString().remove(0,1).toDouble();
             
                    }else if (query->value(2).toString()=="转账-退款") {
             \
                        c3++;//transferTheRefund
                        h3+=query->value(6).toString().remove(0,1).toDouble();
              
                    }else if (query->value(2).toString()=="零钱提现") {
    
                        c4++;//changeWithDraeal
                        h4+=query->value(6).toString().remove(0,1).toDouble();
                 
                    }else if (query->value(2).toString()=="扫二维码付款") {
    
                        c5++;//scanningQrCodeToPay
                        h5+=query->value(6).toString().remove(0,1).toDouble();
                 
                    }else if (query->value(2).toString()=="微信红包") {
    
                        c6++;//weChatLuckyMoney
                        h6+=query->value(6).toString().remove(0,1).toDouble();
               
                    }else if (query->value(2).toString()=="零钱充值") {
    
                        c7++;//ChangeToPrepaidPhone
                        h7+=query->value(6).toString().remove(0,1).toDouble();
                 
                    }else if(query->value(2).toString()!=""){
                        c8++;//other
                        h8+=query->value(6).toString().remove(0,1).toDouble();
           
                          }
    
    
    
    
                }
    
                }
    
            all1=a1+b1+c1;
            all2=a2+b2+c2;
            all3=a3+b3+c3;
            all4=a4+b4+c4;
            all5=a5+b5+c5;
            all6=a6+b6+c6;
            all7=a7+b7+c7;
            all8=a8+b8+c8;
    
            alm1=f1+g1+h1;
            alm2=f2+g2+h2;
            alm3=f3+g3+h3;
            alm4=f4+g4+h4;
            alm5=f5+g5+h5;
            alm6=f6+g6+h6;
            alm7=f7+g7+h7;
            alm8=f8+g8+h8;
    
            almm1=j1+k1+l1;
            almm2=j2+k2+l2;
    
    
    
            //小月份
            query->exec(QString("insert into MonthTradeTypeNumber%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(minMonth).arg(z1)
                        .arg(a1).arg(a2).arg(a8).arg(a3).arg(a4).arg(a5).arg(a6).arg(a7));
            query->exec(QString("insert into MonthTradeTypeAmountOfMoney%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(minMonth).arg(z1)
                        .arg(f1).arg(f2).arg(f8).arg(f3).arg(f4).arg(f5).arg(f6).arg(f7));
            query->exec(QString("insert into MonthIncome%1 values('%2','%3')").arg(minMonth).arg(z1)
                        .arg(j1));
            query->exec(QString("insert into MonthSpending%1 values('%2','%3')").arg(minMonth).arg(z1)
                       .arg(j2));
    
    
            //中月份
           query->exec(QString("insert into MonthTradeTypeNumber%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(minMonth+1).arg(z1)
                                    .arg(b1).arg(b2).arg(b8).arg(b3).arg(b4).arg(b5).arg(b6).arg(b7));
           query->exec(QString("insert into MonthTradeTypeAmountOfMoney%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(minMonth+1).arg(z1)
                       .arg(g1).arg(g2).arg(g8).arg(g3).arg(g4).arg(g5).arg(g6).arg(g7));
           query->exec(QString("insert into MonthIncome%1 values('%2','%3')").arg(minMonth+1).arg(z1)
                       .arg(k1));
           query->exec(QString("insert into MonthSpending%1 values('%2','%3')").arg(minMonth+1).arg(z1)
                      .arg(k2));
    
    
           //大月份
           query->exec(QString("insert into MonthTradeTypeNumber%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(maxMonth).arg(z1)
                                    .arg(c1).arg(c2).arg(c8).arg(c3).arg(c4).arg(c5).arg(c6).arg(c7));
           query->exec(QString("insert into MonthTradeTypeAmountOfMoney%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(maxMonth).arg(z1)
                       .arg(h1).arg(h2).arg(h8).arg(h3).arg(h4).arg(h5).arg(h6).arg(h7));
           query->exec(QString("insert into MonthIncome%1 values('%2','%3')").arg(maxMonth).arg(z1)
                       .arg(l1));
           query->exec(QString("insert into MonthSpending%1 values('%2','%3')").arg(maxMonth).arg(z1)
                      .arg(l2));
    
    
           //总月份
           query->exec(QString("insert into MonthTradeTypeNumberall%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(Months).arg(z1)
                                    .arg(c1).arg(c2).arg(c8).arg(c3).arg(c4).arg(c5).arg(c6).arg(c7));
           query->exec(QString("insert into MonthTradeTypeAmountOfMoneyall%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(Months).arg(z1)
                       .arg(h1).arg(h2).arg(h8).arg(h3).arg(h4).arg(h5).arg(h6).arg(h7));
           query->exec(QString("insert into MonthIncomeall%1 values('%2','%3')").arg(Months).arg(z1)
                       .arg(l1));
           query->exec(QString("insert into MonthSpendingall%1 values('%2','%3')").arg(Months).arg(z1)
                      .arg(l2));
    
    
    
    
    
    
        }
        if(Months==4){
    
    
            int z1=1;
    
            int a1=0,a2=0,a3=0,a4=0,a5=0,a6=0,a7=0,a8=0;//类型统计数目表
            int b1=0,b2=0,b3=0,b4=0,b5=0,b6=0,b7=0,b8=0;
            int c1=0,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0;
            int d1=0,d2=0,d3=0,d4=0,d5=0,d6=0,d7=0,d8=0;
            int t1=0,t2=0,t3=0,t4=0,t5=0,t6=0,t7=0,t8=0;
    
    
            double f1=0,f2=0,f3=0,f4=0,f5=0,f6=0,f7=0,f8=0;//类型统计钱数表
            double g1=0,g2=0,g3=0,g4=0,g5=0,g6=0,g7=0,g8=0;
            double h1=0,h2=0,h3=0,h4=0,h5=0,h6=0,h7=0,h8=0;
            double i1=0,i2=0,i3=0,i4=0,i5=0,i6=0,i7=0,i8=0;
            double u1=0,u2=0,u3=0,u4=0,u5=0,u6=0,u7=0,u8=0;
    
    
            double j1=0,j2=0;//收入总钱数e1,支出总钱数e2
            double k1=0,k2=0;
            double l1=0,l2=0;
            double m1=0,m2=0;
            double v1=0,v2=0;
    
            qDebug()<<"4";
            query->exec("select * from datas");
            while(query->next()){
    
     
                if(qAbs(query->value(1).toString().mid(4,3).remove(QChar('/')).toInt())==minMonth)
                {
                
                    if(query->value(5)=="收入"){
                        j1+=query->value(6).toString().remove(0,1).toDouble();
    
                    }else if (query->value(5)!="") {
                        j2+=query->value(6).toString().remove(0,1).toDouble();
                    }
                    if(query->value(2).toString()=="商户消费")
                    {
                        a1++;//consumption
       
                       f1+=query->value(6).toString().remove(0,1).toDouble();
                
                    }else if (query->value(2).toString()=="转账") {
    
                        a2++;//transfer
           
                        f2+=query->value(6).toString().remove(0,1).toDouble();
               
                    }else if (query->value(2).toString()=="转账-退款") {
             \
                        a3++;//transferTheRefund
                        f3+=query->value(6).toString().remove(0,1).toDouble();
         
                    }else if (query->value(2).toString()=="零钱提现") {
    
                        a4++;//changeWithDraeal
                        f4+=query->value(6).toString().remove(0,1).toDouble();
                   
                    }else if (query->value(2).toString()=="扫二维码付款") {
    
                        a5++;//scanningQrCodeToPay
                        f5+=query->value(6).toString().remove(0,1).toDouble();
             
                    }else if (query->value(2).toString()=="微信红包") {
    
                        a6++;//weChatLuckyMoney
                        f6+=query->value(6).toString().remove(0,1).toDouble();
           
                    }else if (query->value(2).toString()=="零钱充值") {
    
                        a7++;//ChangeToPrepaidPhone
                        f7+=query->value(6).toString().remove(0,1).toDouble();
              
                    }else if(query->value(2).toString()!=""){
                        a8++;//other
                        f8+=query->value(6).toString().remove(0,1).toDouble();
            
                          }
                    }
    
    
    
    
                else if(qAbs(query->value(1).toString().mid(4,3).remove(QChar ('/')).toInt())==(minMonth)+1)
                {
    
         
                if(query->value(5)=="收入"){
                    k1+=query->value(6).toString().remove(0,1).toDouble();
    
                }else if (query->value(5)!="") {
                    k2+=query->value(6).toString().remove(0,1).toDouble();
                }
                if(query->value(2).toString()=="商户消费")
                {
                    b1++;//consumption
    
                   g1+=query->value(6).toString().remove(0,1).toDouble();
     
                }else if (query->value(2).toString()=="转账") {
    
                    b2++;//transfer
      
                    g2+=query->value(6).toString().remove(0,1).toDouble();
    
                }else if (query->value(2).toString()=="转账-退款") {
         \
                    b3++;//transferTheRefund
                    g3+=query->value(6).toString().remove(0,1).toDouble();
        
                }else if (query->value(2).toString()=="零钱提现") {
    
                    b4++;//changeWithDraeal
                    g4+=query->value(6).toString().remove(0,1).toDouble();
                
                }else if (query->value(2).toString()=="扫二维码付款") {
    
                    b5++;//scanningQrCodeToPay
                    g5+=query->value(6).toString().remove(0,1).toDouble();
              
                }else if (query->value(2).toString()=="微信红包") {
    
                    b6++;//weChatLuckyMoney
                    g6+=query->value(6).toString().remove(0,1).toDouble();
                
                }else if (query->value(2).toString()=="零钱充值") {
    
                    b7++;//ChangeToPrepaidPhone
                    g7+=query->value(6).toString().remove(0,1).toDouble();
                
                }else if(query->value(2).toString()!=""){
                    b8++;//other
                    g8+=query->value(6).toString().remove(0,1).toDouble();
             
                      }
                }
                else if (qAbs(query->value(1).toString().mid(4,3).remove(QChar ('/')).toInt())==(maxMonth-1)) {
    
    
               
                    if(query->value(5)=="收入"){
                        l1+=query->value(6).toString().remove(0,1).toDouble();
    
                    }else if (query->value(5)!="") {
                        l2+=query->value(6).toString().remove(0,1).toDouble();
                    }
                    if(query->value(2).toString()=="商户消费")
                    {
                        c1++;//consumption
              
                        h1+=query->value(6).toString().remove(0,1).toDouble();
          
                    }else if (query->value(2).toString()=="转账") {
    
                        c2++;//transfer
             
                        h2+=query->value(6).toString().remove(0,1).toDouble();
                  
                    }else if (query->value(2).toString()=="转账-退款") {
             \
                        c3++;//transferTheRefund
                        h3+=query->value(6).toString().remove(0,1).toDouble();
                     
                    }else if (query->value(2).toString()=="零钱提现") {
    
                        c4++;//changeWithDraeal
                        h4+=query->value(6).toString().remove(0,1).toDouble();
                 
                    }else if (query->value(2).toString()=="扫二维码付款") {
    
                        c5++;//scanningQrCodeToPay
                        h5+=query->value(6).toString().remove(0,1).toDouble();
             
                    }else if (query->value(2).toString()=="微信红包") {
    
                        c6++;//weChatLuckyMoney
                        h6+=query->value(6).toString().remove(0,1).toDouble();
                
                    }else if (query->value(2).toString()=="零钱充值") {
    
                        c7++;//ChangeToPrepaidPhone
                        h7+=query->value(6).toString().remove(0,1).toDouble();
                
                    }else if(query->value(2).toString()!=""){
                        c8++;//other
                        h8+=query->value(6).toString().remove(0,1).toDouble();
               
                          }
    
    
    
    
                }
    
            else if(qAbs(query->value(1).toString().mid(4,3).remove(QChar ('/')).toInt())==maxMonth){
    
                    if(query->value(5)=="收入"){
                        m1+=query->value(6).toString().remove(0,1).toDouble();
    
                    }else if (query->value(5)!="") {
                        m2+=query->value(6).toString().remove(0,1).toDouble();
                    }
                    if(query->value(2).toString()=="商户消费")
                    {
                        d1++;//consumption
     
                        i1+=query->value(6).toString().remove(0,1).toDouble();
            
                    }else if (query->value(2).toString()=="转账") {
    
                        d2++;//transfer
          
                        i2+=query->value(6).toString().remove(0,1).toDouble();
           
                    }else if (query->value(2).toString()=="转账-退款") {
             \
                        d3++;//transferTheRefund
                        i3+=query->value(6).toString().remove(0,1).toDouble();
                
                    }else if (query->value(2).toString()=="零钱提现") {
    
                        d4++;//changeWithDraeal
                        i4+=query->value(6).toString().remove(0,1).toDouble();
          
                    }else if (query->value(2).toString()=="扫二维码付款") {
    
                        d5++;//scanningQrCodeToPay
                        i5+=query->value(6).toString().remove(0,1).toDouble();
             
                    }else if (query->value(2).toString()=="微信红包") {
    
                        d6++;//weChatLuckyMoney
                        i6+=query->value(6).toString().remove(0,1).toDouble();
      
                    }else if (query->value(2).toString()=="零钱充值") {
    
                        d7++;//ChangeToPrepaidPhone
                        i7+=query->value(6).toString().remove(0,1).toDouble();
           
                    }else if(query->value(2).toString()!=""){
                        d8++;//other
                        i8+=query->value(6).toString().remove(0,1).toDouble();
                
                          }
            }
    }
    
    
    
            t1=a1+b1+c1+d1;
            t2=a2+b2+c2+d2;
            t3=a3+b3+c3+d3;
            t4=a4+b4+c4+d4;
            t5=a5+b5+c5+d5;
            t6=a6+b6+c6+d6;
            t7=a7+b7+c7+d7;
            t8=a8+b8+c8+d8;
    
            u1=f1+g1+h1+i1;
            u2=f2+g2+h2+i2;
            u3=f3+g3+h3+i3;
            u4=f4+g4+h4+i4;
            u5=f5+g5+h5+i5;
            u6=f6+g6+h6+i6;
            u7=f7+g7+h7+i7;
            u8=f8+g8+h8+i8;
    
            v1=j1+k1+l1+m1;
            v2=j2+k2+l2+m2;
         //总月份
    
      qDebug()<<t1<<t2<<t3<<t4<<t5<<t6<<t7<<t8;
      qDebug()<<u1<<u2<<u3<<u4<<u5<<u6<<u7<<u8;
      qDebug()<<v1<<v2<<"总的钱数";
      qDebug()<<j1<<k1<<l1<<m1;
      qDebug()<<j1<<k2<<l2<<m2;
      qDebug()<<"各项钱数";
    
    
    
    
            //小月份
            query->exec(QString("insert into MonthTradeTypeNumber%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(minMonth).arg(z1)
                        .arg(a1).arg(a2).arg(a8).arg(a3).arg(a4).arg(a5).arg(a6).arg(a7));
            query->exec(QString("insert into MonthTradeTypeAmountOfMoney%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(minMonth).arg(z1)
                        .arg(f1).arg(f2).arg(f8).arg(f3).arg(f4).arg(f5).arg(f6).arg(f7));
            query->exec(QString("insert into MonthIncome%1 values('%2','%3')").arg(minMonth).arg(z1)
                        .arg(j1));
            query->exec(QString("insert into MonthSpending%1 values('%2','%3')").arg(minMonth).arg(z1)
                       .arg(j2));
    
    
            //中月份
           query->exec(QString("insert into MonthTradeTypeNumber%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(minMonth+1).arg(z1)
                                    .arg(b1).arg(b2).arg(b8).arg(b3).arg(b4).arg(b5).arg(b6).arg(b7));
           query->exec(QString("insert into MonthTradeTypeAmountOfMoney%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(minMonth+1).arg(z1)
                       .arg(g1).arg(g2).arg(g8).arg(g3).arg(g4).arg(g5).arg(g6).arg(g7));
           query->exec(QString("insert into MonthIncome%1 values('%2','%3')").arg(minMonth+1).arg(z1)
                       .arg(k1));
           query->exec(QString("insert into MonthSpending%1 values('%2','%3')").arg(minMonth+1).arg(z1)
                      .arg(k2));
    
    
           //大月份
           query->exec(QString("insert into MonthTradeTypeNumber%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(maxMonth-1).arg(z1)
                                    .arg(c1).arg(c2).arg(c8).arg(c3).arg(c4).arg(c5).arg(c6).arg(c7));
           query->exec(QString("insert into MonthTradeTypeAmountOfMoney%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(maxMonth-1).arg(z1)
                       .arg(h1).arg(h2).arg(h8).arg(h3).arg(h4).arg(h5).arg(h6).arg(h7));
           query->exec(QString("insert into MonthIncome%1 values('%2','%3')").arg(maxMonth-1).arg(z1)
                       .arg(l1));
           query->exec(QString("insert into MonthSpending%1 values('%2','%3')").arg(maxMonth-1).arg(z1)
                      .arg(l2));
    
    
           //最大月份
           query->exec(QString("insert into MonthTradeTypeNumber%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(maxMonth).arg(z1)
                                    .arg(d1).arg(d2).arg(d8).arg(d3).arg(d4).arg(d5).arg(d6).arg(d7));
           query->exec(QString("insert into MonthTradeTypeAmountOfMoney%1 values('%2','%3','%4','%5','%6','%7','%8','%9','%10')").arg(maxMonth).arg(z1)
                       .arg(i1).arg(i2).arg(i8).arg(i3).arg(i4).arg(i5).arg(i6).arg(i7));
           query->exec(QString("insert into MonthIncome%1 values('%2','%3')").arg(maxMonth).arg(z1)
                       .arg(m1));
           query->exec(QString("insert into MonthSpending%1 values('%2','%3')").arg(maxMonth).arg(z1)
                      .arg(m2));
    
    //zong
           query->exec(QString("insert into MonthTradeTypeNumberall4 values('1','%2','%3','%4','%5','%6','%7','%8','%9')")
                                    .arg(t1).arg(t2).arg(t8).arg(t3).arg(t4).arg(t5).arg(t6).arg(t7));
           query->exec(QString("insert into MonthTradeTypeAmountOfMoneyall4 values('1','%2','%3','%4','%5','%6','%7','%8','%9')")
                       .arg(u1).arg(u2).arg(u8).arg(u3).arg(u4).arg(u5).arg(u6).arg(u7));
           query->exec(QString("insert into MonthIncomeall%1 values('%2','%3')").arg(Months).arg(z1)
                       .arg(v1));
           query->exec(QString("insert into MonthSpendingall%1 values('%2','%3')").arg(Months).arg(z1)
                      .arg(v2));
    
    
    
    
           query->exec(QString("select * from MonthTradeTypeAmountOfMoneyall%1").arg(Months));
           if(query->first()){
    
               qDebug()<<query->value(1).toDouble();
               qDebug()<<query->value(2).toDouble();
               qDebug()<<query->value(3).toDouble();
               qDebug()<<query->value(4).toDouble();
               qDebug()<<query->value(5).toDouble();
               qDebug()<<query->value(6).toDouble();
               qDebug()<<query->value(7).toDouble();
               qDebug()<<query->value(8).toDouble();
    
    
      }
    
           query->exec(QString("select * from MonthTradeTypeNumberall%1").arg(Months));
           if(query->first()){
    
               qDebug()<<query->value(1).toInt();
               qDebug()<<query->value(2).toInt();
               qDebug()<<query->value(3).toInt();
               qDebug()<<query->value(4).toInt();
               qDebug()<<query->value(5).toInt();
               qDebug()<<query->value(6).toInt();
               qDebug()<<query->value(7).toInt();
               qDebug()<<query->value(8).toInt();
    
    
      }
    
    
    
    
    
    
        }
    
    
    
    
    
    
    
    
    
    }
    
    bool MySql::initcourses(int id, QString name, QString teacher)
    {
    
    //添加用户信息数据
        query=new QSqlQuery;
        QString str=QString("insert into courses values('%1','%2','%3')").arg(id).arg(name).arg(teacher);
        bool ret=query->exec(str);
        return ret;
    }
    
    void MySql::initdatas(int id, QString TradingHours, QString TradeType, QString CounterParty, QString Goods, QString IncomeAndExpenses, QString Sum,
                     QString MethodOfPayment, QString TheCurrentState, QString TransactionNumber, QString GoodsNumber, QString Note)
    {
    
    //添加用户数据
        query=new QSqlQuery;
        QString str = QString("insert into datas values('%1','%2','%3','%4','%5','%6','%7','%8','%9','%10','%11','%12')").arg(id).arg(TradingHours).arg(TradeType).arg(CounterParty).arg(Goods).arg(IncomeAndExpenses).arg(Sum)
                .arg(MethodOfPayment).arg(TheCurrentState).arg(TransactionNumber).arg(GoodsNumber).arg(Note);
    
        query->exec(str);
    
    
    
    }
    
    void MySql::deleteDatas()
    {
    
    
    //这里是删除数据表
        query=new QSqlQuery;
        static QString str = QString("drop table datas");
        bool ti = query->exec(str);
        qDebug()<<str<<"deleteDatas"<<ti;
     bool str1 =   query->exec("drop table MonthTradeTypeNumber4");
     bool str2 =   query->exec("drop table MonthTradeTypeAmountOfMoney4");
      bool str3 =  query->exec("drop table MonthIncome4");
      bool str4 =  query->exec("drop table MonthSpending4");
    
      qDebug()<<str1<<str2<<str3<<str4;
    
    
    }
    
    
    
    void MySql::deleteProcessTables(int minMonth, int maxMonth, int Months)
    {
    
    //这里是删除产生的数据处理的表
        query=new QSqlQuery;
        qDebug()<<"deleteProcessTables"<<minMonth<<maxMonth<<Months;
    
    
        if(Months==1){
           static QString deletestrnumber1 = QString("drop table MonthTradeTypeNumber%1").arg(minMonth);
           static QString deletestrAmountOfMoney1 = QString("drop table MonthTradeTypeAmountOfMoney%1").arg(minMonth);
           static QString deletestrIncome1 = QString("drop table MonthIncome%1").arg(minMonth);
           static QString deletestrSpending1 = QString("drop table MonthSpending%1").arg(minMonth);
    
           static QString str = QString("drop table datas");
    
    
    
        bool strn1 =    query->exec(deletestrnumber1);
        bool stra1 =    query->exec(deletestrAmountOfMoney1);
        bool stri1 =    query->exec(deletestrIncome1);
        bool strs1 =    query->exec(deletestrSpending1);
    
        bool ti = query->exec(str);
        qDebug()<<strn1<<stra1<<stri1<<strs1<<"成功清除四个处理数据表单"<<ti;
    
    
        }
        if(Months==2){
    
            //总表
            static QString deletestrnumberall = QString("drop table MonthTradeTypeNumberall%1").arg(Months);
            static QString deletestrAmountOfMoneyall = QString("drop table MonthTradeTypeAmountOfMoneyall%1").arg(Months);
            static QString deletestrIncomeall = QString("drop table MonthIncomeall%1").arg(Months);
            static QString deletestrSpendingall = QString("drop table MonthSpendingall%1").arg(Months);
    
    
    
    
            //小月份
            static QString deletestrnumber1 = QString("drop table MonthTradeTypeNumber%1").arg(minMonth);
            static QString deletestrAmountOfMoney1 = QString("drop table MonthTradeTypeAmountOfMoney%1").arg(minMonth);
            static QString deletestrIncome1 = QString("drop table MonthIncome%1").arg(minMonth);
            static QString deletestrSpending1 = QString("drop table MonthSpending%1").arg(minMonth);
    
    
    
            //大月份
            static QString deletestrnumber2 = QString("drop table MonthTradeTypeNumber%1").arg(maxMonth);
            static QString deletestrAmountOfMoney2 = QString("drop table MonthTradeTypeAmountOfMoney%1").arg(maxMonth);
            static QString deletestrIncome2 = QString("drop table MonthIncome%1").arg(maxMonth);
            static QString deletestrSpending2 = QString("drop table MonthSpending%1").arg(maxMonth);
    
            query->exec(deletestrnumberall);
            query->exec(deletestrAmountOfMoneyall);
            query->exec(deletestrIncomeall);
            query->exec(deletestrSpendingall);
    
    
    
    
            query->exec(deletestrnumber1);
            query->exec(deletestrAmountOfMoney1);
            query->exec(deletestrIncome1);
            query->exec(deletestrSpending1);
            query->exec(deletestrnumber2);
            query->exec(deletestrAmountOfMoney2);
            query->exec(deletestrIncome2);
            query->exec(deletestrSpending2);
    
            static QString str = QString("drop table datas");
    
            bool ti = query->exec(str);
    
        }
       if(Months==3){
    
            //总表
            static QString deletestrnumberall = QString("drop table MonthTradeTypeNumberall%1").arg(Months);
            static QString deletestrAmountOfMoneyall = QString("drop table MonthTradeTypeAmountOfMoneyall%1").arg(Months);
            static QString deletestrIncomeall = QString("drop table MonthIncomeall%1").arg(Months);
            static QString deletestrSpendingall = QString("drop table MonthSpendingall%1").arg(Months);
    
    
            //小月份
            static QString deletestrnumber1 = QString("drop table MonthTradeTypeNumber%1").arg(minMonth);
            static QString deletestrAmountOfMoney1 = QString("drop table MonthTradeTypeAmountOfMoney%1").arg(minMonth);
            static QString deletestrIncome1 = QString("drop table MonthIncome%1").arg(minMonth);
            static QString deletestrSpending1 = QString("drop table MonthSpending%1").arg(minMonth);
    
    
    
            //中月份
            static QString deletestrnumber2 = QString("drop table MonthTradeTypeNumber%1").arg(minMonth+1);
            static QString deletestrAmountOfMoney2 = QString("drop table MonthTradeTypeAmountOfMoney%1").arg(minMonth+1);
            static QString deletestrIncome2 = QString("drop table MonthIncome%1").arg(minMonth+1);
            static QString deletestrSpending2 = QString("drop table MonthSpending%1").arg(minMonth+1);
    
    
    
    
            //大月份
            static QString deletestrnumber3 = QString("drop table MonthTradeTypeNumber%1").arg(maxMonth);
            static QString deletestrAmountOfMoney3 = QString("drop table MonthTradeTypeAmountOfMoney%1").arg(maxMonth);
            static QString deletestrIncome3 = QString("drop table MonthIncome%1").arg(maxMonth);
            static QString deletestrSpending3 = QString("drop table MonthSpending%1").arg(maxMonth);
    
            query->exec(deletestrnumberall);
            query->exec(deletestrAmountOfMoneyall);
            query->exec(deletestrIncomeall);
            query->exec(deletestrSpendingall);
    
    
            query->exec(deletestrnumber1);
            query->exec(deletestrAmountOfMoney1);
            query->exec(deletestrIncome1);
            query->exec(deletestrSpending1);
            query->exec(deletestrnumber2);
            query->exec(deletestrAmountOfMoney2);
            query->exec(deletestrIncome2);
            query->exec(deletestrSpending2);
            query->exec(deletestrnumber3);
            query->exec(deletestrAmountOfMoney3);
            query->exec(deletestrIncome3);
            query->exec(deletestrSpending3);
    
    
            static QString str = QString("drop table datas");
    
            bool ti = query->exec(str);
    
    
    
        }
        if(Months==4){
    
      qDebug()<<"case 4";
    
            //总表
            static QString deletestrnumberall = QString("drop table MonthTradeTypeNumberall%1").arg(Months);
            static QString deletestrAmountOfMoneyall = QString("drop table MonthTradeTypeAmountOfMoneyall%1").arg(Months);
            static QString deletestrIncomeall = QString("drop table MonthIncomeall%1").arg(Months);
            static QString deletestrSpendingall = QString("drop table MonthSpendingall%1").arg(Months);
    
    
            //小1月
            static QString deletestrnumber1 = QString("drop table MonthTradeTypeNumber%1").arg(minMonth);
            static QString deletestrAmountOfMoney1 = QString("drop table MonthTradeTypeAmountOfMoney%1").arg(minMonth);
            static QString deletestrIncome1 = QString("drop table MonthIncome%1").arg(minMonth);
            static QString deletestrSpending1 = QString("drop table MonthSpending%1").arg(minMonth);
    
    
    
    
            //小2月
            static QString deletestrnumber2 = QString("drop table MonthTradeTypeNumber%1").arg(minMonth+1);
            static QString deletestrAmountOfMoney2 = QString("drop table MonthTradeTypeAmountOfMoney%1").arg(minMonth+1);
            static QString deletestrIncome2 = QString("drop table MonthIncome%1").arg(minMonth+1);
            static QString deletestrSpending2 = QString("drop table MonthSpending%1").arg(minMonth+1);
    
    
    
    
            //大3月
            static QString deletestrnumber3 = QString("drop table MonthTradeTypeNumber%1").arg(maxMonth-1);
            static QString deletestrAmountOfMoney3 = QString("drop table MonthTradeTypeAmountOfMoney%1").arg(maxMonth-1);
            static QString deletestrIncome3 = QString("drop table MonthIncome%1").arg(maxMonth-1);
            static QString deletestrSpending3 = QString("drop table MonthSpending%1").arg(maxMonth-1);
    
            //大4月
            static QString deletestrnumber4 = QString("drop table MonthTradeTypeNumber%1").arg(maxMonth);
            static QString deletestrAmountOfMoney4 = QString("drop table MonthTradeTypeAmountOfMoney%1").arg(maxMonth);
            static QString deletestrIncome4 = QString("drop table MonthIncome%1").arg(maxMonth);
            static QString deletestrSpending4 = QString("drop table MonthSpending%1").arg(maxMonth);
    
    
    
    
         bool str1=   query->exec(deletestrnumberall);
         bool str2=   query->exec(deletestrAmountOfMoneyall);
         bool str3=   query->exec(deletestrIncomeall);
         bool str4=   query->exec(deletestrSpendingall);
    
    
    qDebug()<<str1<<str2<<str3<<str4;
    
            query->exec(deletestrnumber1);
            query->exec(deletestrAmountOfMoney1);
            query->exec(deletestrIncome1);
            query->exec(deletestrSpending1);
            query->exec(deletestrnumber2);
            query->exec(deletestrAmountOfMoney2);
            query->exec(deletestrIncome2);
            query->exec(deletestrSpending2);
            query->exec(deletestrnumber3);
            query->exec(deletestrAmountOfMoney3);
            query->exec(deletestrIncome3);
            query->exec(deletestrSpending3);
            query->exec(deletestrnumber4);
            query->exec(deletestrAmountOfMoney4);
            query->exec(deletestrIncome4);
            query->exec(deletestrSpending4);
    
    
            static QString str = QString("drop table datas");
    
            bool ti = query->exec(str);
    
    
    
        }
    
        }
    
    
    
    
    void MySql::closedb()
    {
    
    //数据库的关闭
        db.close();
    }
    
    
    

     

    数据库模型界面

     

    数据库模型代码

    这一块主要使用了书上的模块,修改查询Qt自带模块,大家可以翻书查阅,对于文件信息读取那,运用了QFile类读取文本文件,从读取的文本中自动分析月份,以及调用数据库,对数据的处理。


     

    #ifndef SQLMODEL_H
    #define SQLMODEL_H
    #include <QSqlTableModel>
    #include <QMainWindow>
    #include <QMessageBox>
    #include <QSqlError>
    #include"mysql.h"
    #include <QSqlQuery>
    #include <QtWidgets/QApplication>
    #include <QtWidgets/QMainWindow>
    #include <QtWidgets/QStatusBar>
    #include <QtCharts/QChartView>
    #include "donutbreakdowncharts.h"
    #include "barchart.h"
    
    
    //数据库模型界面
    
    
    class QSqlTableModel;
    namespace Ui {
    class sqlmodel;
    }
    
    class sqlmodel : public QMainWindow
    {
        Q_OBJECT
    
    public:
        explicit sqlmodel(QWidget *parent = 0);
        ~sqlmodel();
    
       void closeEvent(QCloseEvent *event);
    
        static QString tempall;
    
    //这里定义好静态变量月份起止,以及存在几个月份
        static int minMonth;
        static int maxMonth;
        static int Months;
        static  QString setTables;
    private slots:
        void on_pushButton_clicked();
    
        void on_pushButton_2_clicked();
    
        void on_pushButton_3_clicked();
    
        void on_pushButton_4_clicked();
    
        void on_pushButton_5_clicked();
    
        void on_pushButton_6_clicked();
    
        void on_pushButton_7_clicked();
    
    
    
        void on_pushButton_8_clicked();
    
        void on_pushButton_11_clicked();
    
        void on_pushButton_9_clicked();
    
        void on_pushButton_12_clicked();
    
    private:
        Ui::sqlmodel *ui;
        QSqlTableModel *model;
        QSqlTableModel *model1;
        QSqlTableModel *model2;
        QSqlTableModel *model3;
    
        barChart *bar;
    
        QSqlQuery *query;
        DonutBreakdownCharts *donutBreakdown;
    
    
    
    };
    
    
    #endif // SQLMODEL_H
    
    #include "sqlmodel.h"
    #include "ui_sqlmodel.h"
    #include <QFileDialog>
    #include <QDebug>
    #include <QTextStream>
    #include"mysql.h"
    #include <QProgressDialog>
    #include "themewidget.h"
    #include "barchart.h"
    
    //数据库模型界面
    QString sqlmodel::tempall = "";
    int sqlmodel::maxMonth=0;
    int sqlmodel::minMonth=0;
    int sqlmodel::Months=0;
    QString sqlmodel::setTables = "";
    sqlmodel::sqlmodel(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::sqlmodel)
    {
        ui->setupUi(this);
    
    //界面一 读取微信账单用户数据
        model = new QSqlTableModel(this);
        model->setTable("courses");
        model->select();
        model->setEditStrategy(QSqlTableModel::OnManualSubmit);
        ui->tableView->setModel(model);
    
       setTables= QString("MonthTradeTypeNumber%1").arg(sqlmodel::minMonth);
        qDebug()<<setTables<<"2";
    
    
    //界面二读取用户注册信息界面
       model1 = new QSqlTableModel(this);
    
    
        model1->setTable("datas");
        model1->select();
        ui->tableView_2->setModel(model1);
        ui->textEdit->setText(tempall);
    
    
    
    
    }
    
    sqlmodel::~sqlmodel()
    {
        delete ui;
        qDebug()<<"sqlmodel";
        MySql* mysql = new MySql;
        mysql->deleteDatas();
        mysql->deleteProcessTables(sqlmodel::minMonth,sqlmodel::maxMonth,sqlmodel::Months);
        delete mysql;
    }
    
    void sqlmodel::closeEvent(QCloseEvent *event)
    {
    
    //窗口关闭函数,因为原来想通过关闭这个窗口,删除产生的数据表,为再次登陆做基础准备
    //但是由于不明原因删除不掉数据表,从而会导致重新加载数据会产生冲突
    
    
        qDebug()<<"关闭函数";
    
    
        MySql* mysql = new MySql;
        mysql->deleteDatas();
        mysql->deleteProcessTables(sqlmodel::minMonth,sqlmodel::maxMonth,sqlmodel::Months);
        mysql->closedb();
        QFile::remove("Stu.db");
        delete mysql;
         event->accept();
    
    
    }
    
    void sqlmodel::on_pushButton_clicked()
    {
        QString TradeType = ui->lineEdit->text();
    
        // 根据姓名进行筛选,一定要使用单引号
        model1->setFilter(QString("TradeType = '%1'").arg(TradeType));
        model1->select();
    }
    
    void sqlmodel::on_pushButton_2_clicked()
    {
       // qDebug()<<setTables<<"3";
        model1->setTable("datas");
        model1->select();
    
    }
    
    void sqlmodel::on_pushButton_3_clicked()
    {
        // 开始事务操作
        model1->database().transaction();
        if (model1->submitAll()) {
            if(model1->database().commit()) // 提交
                QMessageBox::information(this, tr("tableModel"),
                                         tr("数据修改成功!"));
        } else {
            model1->database().rollback(); // 回滚
            QMessageBox::warning(this, tr("tableModel"),
                                 tr("数据库错误: %1").arg(model1->lastError().text()),
                                 QMessageBox::Ok);
        }
    }
    
    void sqlmodel::on_pushButton_4_clicked()
    {
          model1->revertAll();
    }
    
    void sqlmodel::on_pushButton_5_clicked()
    {
        // 获得表的行数
        int rowNum = model->rowCount();
        int id = 10;
    
        // 添加一行
        model1->insertRow(rowNum);
        model1->setData(model1->index(rowNum, 0), id);
    }
    
    void sqlmodel::on_pushButton_6_clicked()
    {
        // 获取选中的行
        int curRow = ui->tableView_2->currentIndex().row();
    
        // 删除该行
        model1->removeRow(curRow);
        int ok = QMessageBox::warning(this,tr("删除当前行!"),
                                      tr("你确定删除当前行吗?"), QMessageBox::Yes, QMessageBox::No);
        if(ok == QMessageBox::No)
        { // 如果不删除,则撤销
            model1->revertAll();
        } else { // 否则提交,在数据库中删除该行
            model1->submitAll();
        }
    }
    
    void sqlmodel::on_pushButton_7_clicked()
    {
    
    
    //加载文件窗口,典型调用文件对话框选择所需文件
    //读取微信账单,主要思路来源于网上修改,读取文本文件,读取每一行然后存入数据表
    //因为17行之后才是数据的读取,所以17行之前是用户的信息,
    //在这里通过对字符串的读取分析来自动存储
        QFileDialog* fd = new QFileDialog(this);//创建打开文件对话框
    
        QString fileName = fd->getOpenFileName(this,tr("Open File"),"/home",tr("Excel(*.csv)"));
    
        if(fileName == "")
    
              return;
    
        QDir dir = QDir::current();
    
        QFile file(dir.filePath(fileName));
    
        if(!file.open(QIODevice::ReadOnly))
    
             qDebug()<<"OPEN FILE FAILED";
    
        QTextStream * out = new QTextStream(&file);//文本流
    
        QStringList tempOption = out->readAll().split("\n",QString::SkipEmptyParts);//每行以\n区分
    //    QString tempOption0 = out->readAll();//每行以\n区分
    
        QProgressDialog dialog(tr("正在加载"),tr("取消"), 0, tempOption.count(), this);
        dialog.setCancelButton(0);
        dialog.setWindowTitle(tr("进度"));
        dialog.setWindowModality(Qt::WindowModal);
        dialog.show();
          MySql* mysql = new MySql;
        for(int i = 0 ; i <tempOption.count() ; i++)
    
        {
    
             QStringList tempbar = tempOption.at(i).split(",");//一行中的单元格以,区分
    // QString tempbar0 = tempOption0.at(i);//一行中的单元格以,区分
           //  ...//省略具体对数据的操作
             if(i==2){
                 qDebug()<<tempbar.join("");
                 QString temdispose=tempbar.join("");
                 qDebug()<<temdispose.mid(11,2).toInt()<<temdispose.mid(38,2).toInt();
    
                 minMonth=temdispose.mid(11,2).toInt();
                 maxMonth=temdispose.mid(38,2).toInt();
                 Months=maxMonth-minMonth+1;
                 qDebug()<<minMonth<<maxMonth<<Months;
                 mysql->dataProcessingTable(minMonth,maxMonth,Months);
                 setTables= QString("MonthTradeTypeNumber%1").arg(sqlmodel::minMonth);
                 qDebug()<<setTables<<"1";
             }
    
    
    
             static int id=1;
             if(i<=15){
    
    
             QString tem=tempbar.join("");
             tempall.append(tem);
    
             ui->textEdit->append(tempall);
             if(i==15){
      //         qDebug()<< tempall;
             ui->textEdit->setText(tempall);
             }
             }
             if(i>=17){
    
    
               mysql->initdatas(id,tempbar.at(0),tempbar.at(1),tempbar.at(2),tempbar.at(3),tempbar.at(4)
                                ,tempbar.at(5),tempbar.at(6),tempbar.at(7),tempbar.at(8)
                                ,tempbar.at(9),tempbar.at(10));
    
    
    
    
    
               //处理数据
    
              id++;
    //           for (int i = 0; i < tempbar.size(); ++i)
    
    //                     qDebug() << tempbar.at(i) << endl;
             }
    //         qDebug()<<tempbar;
    
                 dialog.setValue(i);
                 QCoreApplication::processEvents();
                 if(dialog.wasCanceled())
                 {
                     break;
                 }
    
    
    
             }
          dialog.setValue(tempOption.count());
         QMessageBox::information(this,tr("加载"),tr("加载成功!"),QMessageBox::Ok);
         ui->pushButton_8->setEnabled(true);
         ui->pushButton_9->setEnabled(true);
    //     ui->pushButton_10->setEnabled(true);
    
    
    //         ui->textEdit->setText(tempbar);
    
    
       ui->pushButton_7->setEnabled(false);
    
    
       //数据表处理
        mysql->theDataProcess(minMonth,maxMonth,Months);
      //  query=new QSqlQuery;
    
    
        switch(Months){
    
    
        case(1):{
    //        int a1 = 11;
    
            ui->comboBox->addItem(QString("%1Month").arg(minMonth));
    
    //        QComboBox *themeComboBox = new QComboBox();
    
    //        themeComboBox->addItem(QString("%1Month").arg(minMonth), a1);
    //       // qDebug()<<"11""createThemeBox";
    //        return themeComboBox;
    
    
        }break;
        case(2):{
    //        int b1 = 21,b2 = 22,b3 = 23;
            ui->comboBox->addItem(QString("%1Month").arg(minMonth));
            ui->comboBox->addItem(QString("%1Month").arg(maxMonth));
            ui->comboBox->addItem("AllMonth");
    //        QComboBox *themeComboBox = new QComboBox();
    //        themeComboBox->addItem(QString("%1Month").arg(minMonth), b1);
    //        themeComboBox->addItem(QString("%1Month").arg(maxMonth), b2);
    //        themeComboBox->addItem("AllMonth", b3);
    //         return themeComboBox;
        }break;
        case(3):{
    
    
    
            ui->comboBox->addItem(QString("%1Month").arg(minMonth));
            ui->comboBox->addItem(QString("%1Month").arg(minMonth+1));
            ui->comboBox->addItem(QString("%1Month").arg(maxMonth));
            ui->comboBox->addItem("AllMonth");
        }break;
    
        case(4):{
    
    //        qDebug()<<"123123";
    //        int d1 = 41,d2 = 42,d3 = 43,d4 = 44,d5 = 45;
    //        QComboBox *themeComboBox = new QComboBox();
    //        themeComboBox->addItem(QString("%1Month").arg(minMonth), d1);
    //        themeComboBox->addItem(QString("%1Month").arg(minMonth+1), d2);
    //        themeComboBox->addItem(QString("%1Month").arg(maxMonth-1), d3);
    //        themeComboBox->addItem(QString("%1Month").arg(maxMonth), d4);
    //        themeComboBox->addItem("AllMonth", d5);
    //        return themeComboBox;
    
            ui->comboBox->addItem(QString("%1Month").arg(minMonth));
            ui->comboBox->addItem(QString("%1Month").arg(minMonth+1));
            ui->comboBox->addItem(QString("%1Month").arg(maxMonth-1));
            ui->comboBox->addItem(QString("%1Month").arg(maxMonth));
            ui->comboBox->addItem("AllMonth");
    
    
        }break;
    
        }
    
        file.close();//操作完成后记得关闭文件
    
    
    
    }
    
    
    
    
    
    void sqlmodel::on_pushButton_8_clicked()
    {
    
        QString str = ui->comboBox->currentText();
    ThemeWidget *widg = new ThemeWidget(str,sqlmodel::minMonth,sqlmodel::maxMonth,sqlmodel::Months) ;
    widg->resize(1600,1000);
    widg->show();
    }
    
    void sqlmodel::on_pushButton_11_clicked()
    {
    
    
            model3 = new QSqlTableModel(this);
            model3->setTable(QString("MonthTradeTypeAmountOfMoneyall4"));
            model3->select();
            ui->tableView_3->setModel(model3);
    }
    
    void sqlmodel::on_pushButton_9_clicked()
    {
        barChart *bar =new barChart(sqlmodel::minMonth,sqlmodel::maxMonth,sqlmodel::Months);
    
    
    }
    
    void sqlmodel::on_pushButton_12_clicked()
    {
        QSqlQuery query;
        qDebug()<<"on_pushButton_12_clicked"<<minMonth<<maxMonth<<Months;
    
         bool str1 =   query.exec("drop table MonthTradeTypeNumber4");
         bool str2 =   query.exec("drop table MonthTradeTypeAmountOfMoney4");
         bool str3 =  query.exec("drop table MonthIncome4");
         bool str4 =  query.exec("drop table MonthSpending4");
    
         qDebug()<<str1<<str2<<str3<<str4;
    }
    

    最后一部分是数据图表的显示,模型来自Qt自典例documentbreakdown、chartthemes、lineandbar可以通过查阅帮助文档理解模型的使用,我所做的就是创建接口将数据传输上去从而实现图表功能





     

    #ifndef BARCHART_H
    #define BARCHART_H
    
    #include <QMainWindow>
    #include <QChart>
    #include <QSqlQuery>
    
    #include <QtWidgets/QApplication>
    #include <QtWidgets/QMainWindow>
    #include <QtCharts/QChartView>
    #include <QtCharts/QBarSeries>
    #include <QtCharts/QBarSet>
    #include <QtCharts/QLegend>
    #include <QtCharts/QBarCategoryAxis>
    
    
    
    //柱状图
    QT_CHARTS_BEGIN_NAMESPACE
    class QChart;
    QT_CHARTS_END_NAMESPACE
    
    
    QT_CHARTS_USE_NAMESPACE
    
    class barChart : public QMainWindow
    {
        Q_OBJECT
    public:
        explicit barChart(int minMonth, int maxMonth, int Months,QWidget *parent = nullptr);
        QChart *dataChart(int minMonth, int maxMonth, int Months)const;
        QSqlQuery  *query;
    
    signals:
    
    public slots:
    };
    
    #endif // BARCHART_H
    
    #include "barchart.h"
    //柱状图
    
    
    //柱状图初始化
    barChart::barChart(int minMonth, int maxMonth, int Months, QWidget *parent) : QMainWindow(parent)
    {
    
        //dataChart(minMonth,maxMonth,Months);
    //    dataChart(minMonth,maxMonth,Months)->createDefaultAxes();
        QChartView *chartView = new QChartView(dataChart(minMonth,maxMonth,Months));//放置图表
        chartView->setRenderHint(QPainter::Antialiasing);
        chartView->resize(1600,1000);
        chartView->show();
    }
    
    QChart *barChart::dataChart(int minMonth, int maxMonth, int Months) const//创建图表
    {
        QSqlQuery  *query = new QSqlQuery;
    
        switch (Months){
    
    
            case(1):{
    
            //![1]
    
    
    
    
                QBarSet *set1 = new QBarSet("商户消费");
                QBarSet *set2 = new QBarSet("转账");
                QBarSet *set3 = new QBarSet("其他");
                QBarSet *set4 = new QBarSet("转账-退款");
                QBarSet *set5 = new QBarSet("零钱提现");
                QBarSet *set6 = new QBarSet("扫二维码付款");
                QBarSet *set7 = new QBarSet("微信红包");
                QBarSet *set8 = new QBarSet("零钱充值");
    
    
                query->exec(QString("select * from MonthTradeTypeAmountOfMoney%1").arg(minMonth));
                if(query->first())
            {
                *set1 << query->value(1).toDouble();
                *set2 << query->value(2).toDouble();
                *set3 << query->value(3).toDouble();
                *set4 << query->value(4).toDouble();
                *set5 << query->value(5).toDouble();
                *set6 << query->value(6).toDouble();
                *set7 << query->value(7).toDouble();
                *set8 << query->value(8).toDouble();
    
                }
    
    
    
            //![1]
    
            //![2]
                QBarSeries *series = new QBarSeries();
    
                series->append(set1);
                series->append(set2);
                series->append(set3);
                series->append(set4);
                series->append(set5);
                series->append(set6);
                series->append(set7);
                series->append(set8);
    
            //![2]
    
            //![3]
                QChart *chart = new QChart();
                chart->addSeries(series);
                chart->setTitle("交易类型各类型金额统计表");
                chart->setAnimationOptions(QChart::SeriesAnimations);
            //![3]
    
            //![4]
                QStringList categories;
                categories << QString("%1Month").arg(minMonth);
                QBarCategoryAxis *axis = new QBarCategoryAxis();
                axis->append(categories);
                chart->createDefaultAxes();
                chart->setAxisX(axis, series);
            //![4]
    
            //![5]
                chart->legend()->setVisible(true);
                chart->legend()->setAlignment(Qt::AlignBottom);
            //![5]
    
    
                return chart;
    //                    ![6]
    
    //                    ![6]
        };
            case(2):{
            //![1]
    
    
    
    
                QBarSet *set1 = new QBarSet("商户消费");
                QBarSet *set2 = new QBarSet("转账");
                QBarSet *set3 = new QBarSet("其他");
                QBarSet *set4 = new QBarSet("转账-退款");
                QBarSet *set5 = new QBarSet("零钱提现");
                QBarSet *set6 = new QBarSet("扫二维码付款");
                QBarSet *set7 = new QBarSet("微信红包");
                QBarSet *set8 = new QBarSet("零钱充值");
    
    
    
                double a1,a2,a3,a4,a5,a6,a7,a8;
                double b1,b2,b3,b4,b5,b6,b7,b8;
                double c1,c2,c3,c4,c5,c6,c7,c8;
    
    
                query->exec(QString("select * from MonthTradeTypeAmountOfMoney%1").arg(minMonth));
                if(query->first())
                {
                 a1=query->value(1).toDouble();
                 a2=query->value(2).toDouble();
                 a3=query->value(3).toDouble();
                 a4=query->value(4).toDouble();
                 a5=query->value(5).toDouble();
                 a6=query->value(6).toDouble();
                 a7=query->value(7).toDouble();
                 a8=query->value(8).toDouble();
    
    
                }
                query->exec(QString("select * from MonthTradeTypeAmountOfMoney%1").arg(maxMonth));
                if(query->first())
                {
                    b1=query->value(1).toDouble();
                    b2=query->value(2).toDouble();
                    b3=query->value(3).toDouble();
                    b4=query->value(4).toDouble();
                    b5=query->value(5).toDouble();
                    b6=query->value(6).toDouble();
                    b7=query->value(7).toDouble();
                    b8=query->value(8).toDouble();
    
    
                }
                query->exec(QString("select * from MonthTradeTypeAmountOfMoneyall%1").arg(Months));
                if(query->first())
                {
    
    
                    c1=query->value(1).toDouble();
                    c2=query->value(2).toDouble();
                    c3=query->value(3).toDouble();
                    c4=query->value(4).toDouble();
                    c5=query->value(5).toDouble();
                    c6=query->value(6).toDouble();
                    c7=query->value(7).toDouble();
                    c8=query->value(8).toDouble();
    
                }
    
    
    
    
    
    
                *set1 << a1<<b1<<c1;
                *set2 << a2<<b2<<c2;
                *set3 << a3<<b3<<c3;
                *set4 << a4<<b4<<c4;
                *set5 << a5<<b5<<c5;
                *set6 << a6<<b6<<c6;
                *set7 << a7<<b7<<c7;
                *set8 << a8<<b8<<c8;
    
            //![1]
    
            //![2]
                QBarSeries *series = new QBarSeries();
    
                series->append(set1);
                series->append(set2);
                series->append(set3);
                series->append(set4);
                series->append(set5);
                series->append(set6);
                series->append(set7);
                series->append(set8);
    
            //![2]
    
            //![3]
                QChart *chart = new QChart();
                chart->addSeries(series);
                chart->setTitle("交易类型各类型金额统计表");
                chart->setAnimationOptions(QChart::SeriesAnimations);
            //![3]
    
            //![4]
                QStringList categories;
                categories << QString("%1Month").arg(minMonth)<<QString("%2Month").arg(maxMonth)<<"AllMonths";
                QBarCategoryAxis *axis = new QBarCategoryAxis();
                axis->append(categories);
                chart->createDefaultAxes();
                chart->setAxisX(axis, series);
            //![4]
    
            //![5]
                chart->legend()->setVisible(true);
                chart->legend()->setAlignment(Qt::AlignBottom);
            //![5]
                 a1=0;a2=0;a3=0;a4=0;a5=0;a6=0;a7=0;a8=0;
                 b1=0;b2=0;b3=0;b4=0;b5=0;b6=0;b7=0;b8=0;
                 c1=0;c2=0;c3=0;c4=0;c5=0;c6=0;c7=0;c8=0;
    
    
                return chart;
        };
            case(3):{
            //![1]
    
    
    
    
                QBarSet *set1 = new QBarSet("商户消费");
                QBarSet *set2 = new QBarSet("转账");
                QBarSet *set3 = new QBarSet("其他");
                QBarSet *set4 = new QBarSet("转账-退款");
                QBarSet *set5 = new QBarSet("零钱提现");
                QBarSet *set6 = new QBarSet("扫二维码付款");
                QBarSet *set7 = new QBarSet("微信红包");
                QBarSet *set8 = new QBarSet("零钱充值");
    
    
    
                double a1,a2,a3,a4,a5,a6,a7,a8;
                double b1,b2,b3,b4,b5,b6,b7,b8;
                double c1,c2,c3,c4,c5,c6,c7,c8;
                double d1,d2,d3,d4,d5,d6,d7,d8;
    
    
                query->exec(QString("select * from MonthTradeTypeAmountOfMoney%1").arg(minMonth));
                if(query->first())
                {
                 a1=query->value(1).toDouble();
                 a2=query->value(2).toDouble();
                 a3=query->value(3).toDouble();
                 a4=query->value(4).toDouble();
                 a5=query->value(5).toDouble();
                 a6=query->value(6).toDouble();
                 a7=query->value(7).toDouble();
                 a8=query->value(8).toDouble();
    
    
                }
                query->exec(QString("select * from MonthTradeTypeAmountOfMoney%1").arg(minMonth+1));
                if(query->first())
                {
                    b1=query->value(1).toDouble();
                    b2=query->value(2).toDouble();
                    b3=query->value(3).toDouble();
                    b4=query->value(4).toDouble();
                    b5=query->value(5).toDouble();
                    b6=query->value(6).toDouble();
                    b7=query->value(7).toDouble();
                    b8=query->value(8).toDouble();
    
    
                }
                query->exec(QString("select * from MonthTradeTypeAmountOfMoney%1").arg(maxMonth));
                if(query->first())
                {
    
    
                    c1=query->value(1).toDouble();
                    c2=query->value(2).toDouble();
                    c3=query->value(3).toDouble();
                    c4=query->value(4).toDouble();
                    c5=query->value(5).toDouble();
                    c6=query->value(6).toDouble();
                    c7=query->value(7).toDouble();
                    c8=query->value(8).toDouble();
    
                }
                query->exec(QString("select * from MonthTradeTypeAmountOfMoneyall%1").arg(Months));
                if(query->first())
                {
    
    
                    d1=query->value(1).toDouble();
                    d2=query->value(2).toDouble();
                    d3=query->value(3).toDouble();
                    d4=query->value(4).toDouble();
                    d5=query->value(5).toDouble();
                    d6=query->value(6).toDouble();
                    d7=query->value(7).toDouble();
                    d8=query->value(8).toDouble();
    
                }
    
    
    
    
    
    
                *set1 << a1<<b1<<c1<<d1;
                *set2 << a2<<b2<<c2<<d2;
                *set3 << a3<<b3<<c3<<d3;
                *set4 << a4<<b4<<c4<<d4;
                *set5 << a5<<b5<<c5<<d5;
                *set6 << a6<<b6<<c6<<d6;
                *set7 << a7<<b7<<c7<<d7;
                *set8 << a8<<b8<<c8<<d8;
    
            //![1]
    
            //![2]
                QBarSeries *series = new QBarSeries();
    
                series->append(set1);
                series->append(set2);
                series->append(set3);
                series->append(set4);
                series->append(set5);
                series->append(set6);
                series->append(set7);
                series->append(set8);
    
            //![2]
    
            //![3]
                QChart *chart = new QChart();
                chart->addSeries(series);
                chart->setTitle("交易类型各类型金额统计表");
                chart->setAnimationOptions(QChart::SeriesAnimations);
            //![3]
    
            //![4]
                QStringList categories;
                categories << QString("%1Month").arg(minMonth)<< QString("%2Month").arg(minMonth+1)<<QString("%3Month").arg(maxMonth)<<"AllMonths";
                QBarCategoryAxis *axis = new QBarCategoryAxis();
                axis->append(categories);
                chart->createDefaultAxes();
                chart->setAxisX(axis, series);
            //![4]
    
            //![5]
                chart->legend()->setVisible(true);
                chart->legend()->setAlignment(Qt::AlignBottom);
            //![5]
    
    
                a1=0;a2=0;a3=0;a4=0;a5=0;a6=0;a7=0;a8=0;
                b1=0;b2=0;b3=0;b4=0;b5=0;b6=0;b7=0;b8=0;
                c1=0;c2=0;c3=0;c4=0;c5=0;c6=0;c7=0;c8=0;
                d1=0;d2=0;d3=0;d4=0;d5=0;d6=0;d7=0;d8=0;
    
                return chart;
        };
            case(4):{
            //![1]
    
    
    
    
                QBarSet *set1 = new QBarSet("商户消费");
                QBarSet *set2 = new QBarSet("转账");
                QBarSet *set3 = new QBarSet("其他");
                QBarSet *set4 = new QBarSet("转账-退款");
                QBarSet *set5 = new QBarSet("零钱提现");
                QBarSet *set6 = new QBarSet("扫二维码付款");
                QBarSet *set7 = new QBarSet("微信红包");
                QBarSet *set8 = new QBarSet("零钱充值");
    
    
    
                double a1,a2,a3,a4,a5,a6,a7,a8;
                double b1,b2,b3,b4,b5,b6,b7,b8;
                double c1,c2,c3,c4,c5,c6,c7,c8;
                double d1,d2,d3,d4,d5,d6,d7,d8;
                double e1,e2,e3,e4,e5,e6,e7,e8;
    
    
                query->exec(QString("select * from MonthTradeTypeAmountOfMoney%1").arg(minMonth));
                if(query->first())
                {
                 a1=query->value(1).toDouble();
                 a2=query->value(2).toDouble();
                 a3=query->value(3).toDouble();
                 a4=query->value(4).toDouble();
                 a5=query->value(5).toDouble();
                 a6=query->value(6).toDouble();
                 a7=query->value(7).toDouble();
                 a8=query->value(8).toDouble();
    
    
                }
                query->exec(QString("select * from MonthTradeTypeAmountOfMoney%1").arg(minMonth+1));
                if(query->first())
                {
                    b1=query->value(1).toDouble();
                    b2=query->value(2).toDouble();
                    b3=query->value(3).toDouble();
                    b4=query->value(4).toDouble();
                    b5=query->value(5).toDouble();
                    b6=query->value(6).toDouble();
                    b7=query->value(7).toDouble();
                    b8=query->value(8).toDouble();
    
    
                }
                query->exec(QString("select * from MonthTradeTypeAmountOfMoney%1").arg(maxMonth-1));
                if(query->first())
                {
    
    
                    c1=query->value(1).toDouble();
                    c2=query->value(2).toDouble();
                    c3=query->value(3).toDouble();
                    c4=query->value(4).toDouble();
                    c5=query->value(5).toDouble();
                    c6=query->value(6).toDouble();
                    c7=query->value(7).toDouble();
                    c8=query->value(8).toDouble();
    
                }
                query->exec(QString("select * from MonthTradeTypeAmountOfMoney%1").arg(maxMonth));
                if(query->first())
                {
    
    
                    d1=query->value(1).toDouble();
                    d2=query->value(2).toDouble();
                    d3=query->value(3).toDouble();
                    d4=query->value(4).toDouble();
                    d5=query->value(5).toDouble();
                    d6=query->value(6).toDouble();
                    d7=query->value(7).toDouble();
                    d8=query->value(8).toDouble();
    
                }
                query->exec(QString("select * from MonthTradeTypeAmountOfMoneyall%1").arg(Months));
                if(query->first())
                {
    
    
                    e1=query->value(1).toDouble();
                    e2=query->value(2).toDouble();
                    e3=query->value(3).toDouble();
                    e4=query->value(4).toDouble();
                    e5=query->value(5).toDouble();
                    e6=query->value(6).toDouble();
                    e7=query->value(7).toDouble();
                    e8=query->value(8).toDouble();
    
                }
    
    
    
    
    
    
                *set1 << a1<<b1<<c1<<d1<<e1;
                *set2 << a2<<b2<<c2<<d2<<e2;
                *set3 << a3<<b3<<c3<<d3<<e3;
                *set4 << a4<<b4<<c4<<d4<<e4;
                *set5 << a5<<b5<<c5<<d5<<e5;
                *set6 << a6<<b6<<c6<<d6<<e6;
                *set7 << a7<<b7<<c7<<d7<<e7;
                *set8 << a8<<b8<<c8<<d8<<e8;
    
            //![1]
    
            //![2]
                QBarSeries *series = new QBarSeries();
    
                series->append(set1);
                series->append(set2);
                series->append(set3);
                series->append(set4);
                series->append(set5);
                series->append(set6);
                series->append(set7);
                series->append(set8);
    
            //![2]
    
            //![3]
                QChart *chart = new QChart();
                chart->addSeries(series);
                chart->setTitle("交易类型各类型金额统计表");
                chart->setAnimationOptions(QChart::SeriesAnimations);
            //![3]
    
            //![4]
                QStringList categories;
                categories << QString("%1Month").arg(minMonth)<< QString("%2Month").arg(minMonth+1)<< QString("%3Month").arg(maxMonth-1)<<QString("%4Month").arg(maxMonth)<<"AllMonths";
                QBarCategoryAxis *axis = new QBarCategoryAxis();
                axis->append(categories);
                chart->createDefaultAxes();
                chart->setAxisX(axis, series);
            //![4]
    
            //![5]
                chart->legend()->setVisible(true);
                chart->legend()->setAlignment(Qt::AlignBottom);
            //![5]
    
    
    //            a1=0;a2=0;a3=0;a4=0;a5=0;a6=0;a7=0;a8=0;
    //            b1=0;b2=0;b3=0;b4=0;b5=0;b6=0;b7=0;b8=0;
    //            c1=0;c2=0;c3=0;c4=0;c5=0;c6=0;c7=0;c8=0;
    //            d1=0;d2=0;d3=0;d4=0;d5=0;d6=0;d7=0;d8=0;
    //            e1=0;e2=0;e3=0;e4=0;e5=0;e6=0;e7=0;e8=0;
    
                return chart;
        };
    
        }
    
    }
    
    /****************************************************************************
    **
    ** Copyright (C) 2016 The Qt Company Ltd.
    ** Contact: https://www.qt.io/licensing/
    **
    ** This file is part of the Qt Charts module of the Qt Toolkit.
    **
    ** $QT_BEGIN_LICENSE:GPL$
    ** Commercial License Usage
    ** Licensees holding valid commercial Qt licenses may use this file in
    ** accordance with the commercial license agreement provided with the
    ** Software or, alternatively, in accordance with the terms contained in
    ** a written agreement between you and The Qt Company. For licensing terms
    ** and conditions see https://www.qt.io/terms-conditions. For further
    ** information use the contact form at https://www.qt.io/contact-us.
    **
    ** GNU General Public License Usage
    ** Alternatively, this file may be used under the terms of the GNU
    ** General Public License version 3 or (at your option) any later version
    ** approved by the KDE Free Qt Foundation. The licenses are as published by
    ** the Free Software Foundation and appearing in the file LICENSE.GPL3
    ** included in the packaging of this file. Please review the following
    ** information to ensure the GNU General Public License requirements will
    ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
    **
    ** $QT_END_LICENSE$
    **
    ****************************************************************************/
    #ifndef DONUTBREAKDOWNCHART_H
    #define DONUTBREAKDOWNCHART_H
    
    
    //饼状图
    #include <QtCharts/QChart>
    #include <QtCharts/QPieSeries>
    
    QT_CHARTS_USE_NAMESPACE
    
    class DonutBreakdownCharts : public QChart
    {
    public:
        DonutBreakdownCharts(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
        void addBreakdownSeries(QPieSeries *series, QColor color);
    
    private:
        void recalculateAngles();
        void updateLegendMarkers();
    
    private:
        QPieSeries *m_mainSeries;
    };
    
    #endif // DONUTBREAKDOWNCHART_H
    
    /****************************************************************************
    **
    ** Copyright (C) 2016 The Qt Company Ltd.
    ** Contact: https://www.qt.io/licensing/
    **
    ** This file is part of the Qt Charts module of the Qt Toolkit.
    **
    ** $QT_BEGIN_LICENSE:GPL$
    ** Commercial License Usage
    ** Licensees holding valid commercial Qt licenses may use this file in
    ** accordance with the commercial license agreement provided with the
    ** Software or, alternatively, in accordance with the terms contained in
    ** a written agreement between you and The Qt Company. For licensing terms
    ** and conditions see https://www.qt.io/terms-conditions. For further
    ** information use the contact form at https://www.qt.io/contact-us.
    **
    ** GNU General Public License Usage
    ** Alternatively, this file may be used under the terms of the GNU
    ** General Public License version 3 or (at your option) any later version
    ** approved by the KDE Free Qt Foundation. The licenses are as published by
    ** the Free Software Foundation and appearing in the file LICENSE.GPL3
    ** included in the packaging of this file. Please review the following
    ** information to ensure the GNU General Public License requirements will
    ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
    **
    ** $QT_END_LICENSE$
    **
    ****************************************************************************/
    #include "donutbreakdowncharts.h"
    #include "mainslice.h"
    #include <QtCharts/QPieSlice>
    #include <QtCharts/QPieLegendMarker>
    //饼状图
    QT_CHARTS_USE_NAMESPACE
    
    //![1]
    DonutBreakdownCharts::DonutBreakdownCharts(QGraphicsItem *parent, Qt::WindowFlags wFlags)
        : QChart(QChart::ChartTypeCartesian, parent, wFlags)
    {
        // create the series for main center pie
        m_mainSeries = new QPieSeries();
        m_mainSeries->setPieSize(0.7);
        QChart::addSeries(m_mainSeries);
    }
    //![1]
    
    //![2]
    void DonutBreakdownCharts::addBreakdownSeries(QPieSeries *breakdownSeries, QColor color)
    {
        QFont font("Arial", 10);
    
        // add breakdown series as a slice to center pie
        MainSlice *mainSlice = new MainSlice(breakdownSeries);
        mainSlice->setName(breakdownSeries->name());
        mainSlice->setValue(breakdownSeries->sum());
        m_mainSeries->append(mainSlice);
    
        // customize the slice
        mainSlice->setBrush(color);
        mainSlice->setLabelVisible();
        mainSlice->setLabelColor(Qt::white);
        mainSlice->setLabelPosition(QPieSlice::LabelInsideHorizontal);
        mainSlice->setLabelFont(font);
    
        // position and customize the breakdown series
        breakdownSeries->setPieSize(0.7);
        breakdownSeries->setHoleSize(0.6);
        breakdownSeries->setLabelsVisible();
        const auto slices = breakdownSeries->slices();
        for (QPieSlice *slice : slices) {
            color = color.lighter(115);
            slice->setBrush(color);
            slice->setLabelFont(font);
        }
    
        // add the series to the chart
        QChart::addSeries(breakdownSeries);
    
        // recalculate breakdown donut segments
        recalculateAngles();
    
        // update customize legend markers
        updateLegendMarkers();
    }
    //![2]
    
    //![3]
    void DonutBreakdownCharts::recalculateAngles()
    {
        qreal angle = 0;
        const auto slices = m_mainSeries->slices();
        for (QPieSlice *slice : slices) {
            QPieSeries *breakdownSeries = qobject_cast<MainSlice *>(slice)->breakdownSeries();
            breakdownSeries->setPieStartAngle(angle);
            angle += slice->percentage() * 360.0; // full pie is 360.0
            breakdownSeries->setPieEndAngle(angle);
        }
    }
    //![3]
    
    //![4]
    void DonutBreakdownCharts::updateLegendMarkers()
    {
        // go through all markers
        const auto allseries = series();
        for (QAbstractSeries *series : allseries) {
            const auto markers = legend()->markers(series);
            for (QLegendMarker *marker : markers) {
                QPieLegendMarker *pieMarker = qobject_cast<QPieLegendMarker *>(marker);
                if (series == m_mainSeries) {
                    // hide markers from main series
                    pieMarker->setVisible(false);
                } else {
                    // modify markers from breakdown series
                    pieMarker->setLabel(QString("%1 %2%")
                                        .arg(pieMarker->slice()->label())
                                        .arg(pieMarker->slice()->percentage() * 100, 0, 'f', 2));
                    pieMarker->setFont(QFont("Arial", 10));
                }
            }
        }
    }
    //![4]
    
    /****************************************************************************
    **
    ** Copyright (C) 2016 The Qt Company Ltd.
    ** Contact: https://www.qt.io/licensing/
    **
    ** This file is part of the Qt Charts module of the Qt Toolkit.
    **
    ** $QT_BEGIN_LICENSE:GPL$
    ** Commercial License Usage
    ** Licensees holding valid commercial Qt licenses may use this file in
    ** accordance with the commercial license agreement provided with the
    ** Software or, alternatively, in accordance with the terms contained in
    ** a written agreement between you and The Qt Company. For licensing terms
    ** and conditions see https://www.qt.io/terms-conditions. For further
    ** information use the contact form at https://www.qt.io/contact-us.
    **
    ** GNU General Public License Usage
    ** Alternatively, this file may be used under the terms of the GNU
    ** General Public License version 3 or (at your option) any later version
    ** approved by the KDE Free Qt Foundation. The licenses are as published by
    ** the Free Software Foundation and appearing in the file LICENSE.GPL3
    ** included in the packaging of this file. Please review the following
    ** information to ensure the GNU General Public License requirements will
    ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
    **
    ** $QT_END_LICENSE$
    **
    ****************************************************************************/
    
    #ifndef MAINSLICE_H
    #define MAINSLICE_H
    
    
    
    //饼状图
    
    
    #include <QtCharts/QPieSlice>
    #include <QtCharts/QPieSeries>
    
    QT_CHARTS_USE_NAMESPACE
    
    class MainSlice : public QPieSlice
    {
        Q_OBJECT
    public:
        MainSlice(QPieSeries *breakdownSeries, QObject *parent = 0);
    
        QPieSeries *breakdownSeries() const;
    
        void setName(QString name);
        QString name() const;
    
    public Q_SLOTS:
        void updateLabel();
    
    private:
        QPieSeries *m_breakdownSeries;
        QString m_name;
    };
    
    #endif // MAINSLICE_H
    
    /****************************************************************************
    **
    ** Copyright (C) 2016 The Qt Company Ltd.
    ** Contact: https://www.qt.io/licensing/
    **
    ** This file is part of the Qt Charts module of the Qt Toolkit.
    **
    ** $QT_BEGIN_LICENSE:GPL$
    ** Commercial License Usage
    ** Licensees holding valid commercial Qt licenses may use this file in
    ** accordance with the commercial license agreement provided with the
    ** Software or, alternatively, in accordance with the terms contained in
    ** a written agreement between you and The Qt Company. For licensing terms
    ** and conditions see https://www.qt.io/terms-conditions. For further
    ** information use the contact form at https://www.qt.io/contact-us.
    **
    ** GNU General Public License Usage
    ** Alternatively, this file may be used under the terms of the GNU
    ** General Public License version 3 or (at your option) any later version
    ** approved by the KDE Free Qt Foundation. The licenses are as published by
    ** the Free Software Foundation and appearing in the file LICENSE.GPL3
    ** included in the packaging of this file. Please review the following
    ** information to ensure the GNU General Public License requirements will
    ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
    **
    ** $QT_END_LICENSE$
    **
    ****************************************************************************/
    //饼状图
    #include "mainslice.h"
    
    QT_CHARTS_USE_NAMESPACE
    
    //![1]
    MainSlice::MainSlice(QPieSeries *breakdownSeries, QObject *parent)
        : QPieSlice(parent),
          m_breakdownSeries(breakdownSeries)
    {
        connect(this, &MainSlice::percentageChanged, this, &MainSlice::updateLabel);
    }
    //![1]
    
    QPieSeries *MainSlice::breakdownSeries() const
    {
        return m_breakdownSeries;
    }
    
    void MainSlice::setName(QString name)
    {
        m_name = name;
    }
    
    QString MainSlice::name() const
    {
        return m_name;
    }
    
    //![2]
    void MainSlice::updateLabel()
    {
        this->setLabel(QString("%1 %2%").arg(m_name).arg(percentage() * 100, 0, 'f', 2));
    }
    //![2]
    
    #include "moc_mainslice.cpp"
    
    
    /****************************************************************************
    **
    ** Copyright (C) 2016 The Qt Company Ltd.
    ** Contact: https://www.qt.io/licensing/
    **
    ** This file is part of the Qt Charts module of the Qt Toolkit.
    **
    ** $QT_BEGIN_LICENSE:GPL$
    ** Commercial License Usage
    ** Licensees holding valid commercial Qt licenses may use this file in
    ** accordance with the commercial license agreement provided with the
    ** Software or, alternatively, in accordance with the terms contained in
    ** a written agreement between you and The Qt Company. For licensing terms
    ** and conditions see https://www.qt.io/terms-conditions. For further
    ** information use the contact form at https://www.qt.io/contact-us.
    **
    ** GNU General Public License Usage
    ** Alternatively, this file may be used under the terms of the GNU
    ** General Public License version 3 or (at your option) any later version
    ** approved by the KDE Free Qt Foundation. The licenses are as published by
    ** the Free Software Foundation and appearing in the file LICENSE.GPL3
    ** included in the packaging of this file. Please review the following
    ** information to ensure the GNU General Public License requirements will
    ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
    **
    ** $QT_END_LICENSE$
    **
    ****************************************************************************/
    
    #ifndef THEMEWIDGET_H
    #define THEMEWIDGET_H
    
    
    //换肤窗口界面
    
    
    #include <QtWidgets/QWidget>
    #include <QtCharts/QChartGlobal>
    #include "donutbreakdowncharts.h"
    #include "mainslice.h"
    
    QT_BEGIN_NAMESPACE
    class QComboBox;
    class QCheckBox;
    QT_END_NAMESPACE
    
    QT_CHARTS_BEGIN_NAMESPACE
    class QChartView;
    class QChart;
    QT_CHARTS_END_NAMESPACE
    
    typedef QPair<QPointF, QString> Data;
    typedef QList<Data> DataList;
    typedef QList<DataList> DataTable;
    
    QT_CHARTS_USE_NAMESPACE
    
    class ThemeWidget: public QWidget
    {
        Q_OBJECT
    public:
        explicit ThemeWidget(QString Month,int minMonth, int maxMonth, int Months, QWidget *parent = 0);
        ~ThemeWidget();
    
    private Q_SLOTS:
        void updateUI();
    
    private:
        DataTable generateRandomData(int listCount, int valueMax, int valueCount) const;
        QComboBox *createThemeBox() const;
        QComboBox *createAnimationBox(int minMonth, int maxMonth, int Months) const;
        QComboBox *createLegendBox() const;
        void connectSignals();
        DonutBreakdownCharts *createAreaChart(QString Month,int minMonth, int maxMonth, int Months) const;
    
    private:
        int m_listCount;
        int m_valueMax;
        int m_valueCount;
        QList<QChartView *> m_charts;
        DataTable m_dataTable;
    
        QComboBox *m_themeComboBox;
        QCheckBox *m_antialiasCheckBox;
        QComboBox *m_animatedComboBox;
    
        DonutBreakdownCharts *donutBreakdown11;
    
        DonutBreakdownCharts *donutBreakdown21;
        DonutBreakdownCharts *donutBreakdown22;
        DonutBreakdownCharts *donutBreakdown23;
    
        DonutBreakdownCharts *donutBreakdown31;
        DonutBreakdownCharts *donutBreakdown32;
        DonutBreakdownCharts *donutBreakdown33;
        DonutBreakdownCharts *donutBreakdown34;
    
        DonutBreakdownCharts *donutBreakdown41;
        DonutBreakdownCharts *donutBreakdown42;
        DonutBreakdownCharts *donutBreakdown43;
        DonutBreakdownCharts *donutBreakdown44;
        DonutBreakdownCharts *donutBreakdown45;
    
    };
    
    #endif /* THEMEWIDGET_H */
    
    /****************************************************************************
    **
    ** Copyright (C) 2016 The Qt Company Ltd.
    ** Contact: https://www.qt.io/licensing/
    **
    ** This file is part of the Qt Charts module of the Qt Toolkit.
    **
    ** $QT_BEGIN_LICENSE:GPL$
    ** Commercial License Usage
    ** Licensees holding valid commercial Qt licenses may use this file in
    ** accordance with the commercial license agreement provided with the
    ** Software or, alternatively, in accordance with the terms contained in
    ** a written agreement between you and The Qt Company. For licensing terms
    ** and conditions see https://www.qt.io/terms-conditions. For further
    ** information use the contact form at https://www.qt.io/contact-us.
    **
    ** GNU General Public License Usage
    ** Alternatively, this file may be used under the terms of the GNU
    ** General Public License version 3 or (at your option) any later version
    ** approved by the KDE Free Qt Foundation. The licenses are as published by
    ** the Free Software Foundation and appearing in the file LICENSE.GPL3
    ** included in the packaging of this file. Please review the following
    ** information to ensure the GNU General Public License requirements will
    ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
    **
    ** $QT_END_LICENSE$
    **
    ****************************************************************************/
    
    #include "themewidget.h"
    
    #include <QtCharts/QChartView>
    #include <QtCharts/QPieSeries>
    #include <QtCharts/QPieSlice>
    #include <QtCharts/QAbstractBarSeries>
    #include <QtCharts/QPercentBarSeries>
    #include <QtCharts/QStackedBarSeries>
    #include <QtCharts/QBarSeries>
    #include <QtCharts/QBarSet>
    #include <QtCharts/QLineSeries>
    #include <QtCharts/QSplineSeries>
    #include <QtCharts/QScatterSeries>
    #include <QtCharts/QAreaSeries>
    #include <QtCharts/QLegend>
    #include <QtWidgets/QGridLayout>
    #include <QtWidgets/QFormLayout>
    #include <QtWidgets/QComboBox>
    #include <QtWidgets/QSpinBox>
    #include <QtWidgets/QCheckBox>
    #include <QtWidgets/QGroupBox>
    #include <QtWidgets/QLabel>
    #include <QtCore/QTime>
    #include <QtCharts/QBarCategoryAxis>
    #include<QDebug>
    #include "donutbreakdowncharts.h"
    #include <QSqlQuery>
    
    //主题窗口
    ThemeWidget::ThemeWidget(QString Month, int minMonth, int maxMonth, int Months, QWidget *parent) :
        QWidget(parent),
        m_listCount(3),
        m_valueMax(10),
        m_valueCount(7),
        m_dataTable(generateRandomData(m_listCount, m_valueMax, m_valueCount)),
        m_themeComboBox(createThemeBox()),
        m_antialiasCheckBox(new QCheckBox("Anti-aliasing")),
        m_animatedComboBox(createAnimationBox(minMonth,maxMonth,Months))
    
    {
        connectSignals();
    
    
        // create layout
        QGridLayout *baseLayout = new QGridLayout();
        QHBoxLayout *settingsLayout = new QHBoxLayout();
        settingsLayout->addWidget(new QLabel("Theme:"));
        settingsLayout->addWidget(m_themeComboBox);
        settingsLayout->addWidget(new QLabel("Animation:"));
        settingsLayout->addWidget(m_animatedComboBox);
    
        settingsLayout->addStretch();
        baseLayout->addLayout(settingsLayout, 0, 0, 1, 3);
    
        //create charts
    
        QChartView *chartView;
        chartView = new QChartView(createAreaChart(Month,minMonth,maxMonth,Months));
        baseLayout->addWidget(chartView, 1, 0);
        m_charts << chartView;
    
    
    
        setLayout(baseLayout);
    
        // Set defaults
        m_antialiasCheckBox->setChecked(true);
        updateUI();
    }
    
    ThemeWidget::~ThemeWidget()
    {
    }
    
    void ThemeWidget::connectSignals()
    {
        connect(m_themeComboBox,
                static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
                this, &ThemeWidget::updateUI);
    //    connect(m_antialiasCheckBox, &QCheckBox::toggled, this, &ThemeWidget::updateUI);
    //    connect(m_animatedComboBox,
    //            static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
    //            this, &ThemeWidget::updateUI);
    
    }
    
    DonutBreakdownCharts *ThemeWidget::createAreaChart(QString Month, int minMonth, int maxMonth, int Months) const
    {
    
    
    
    
         QSqlQuery  *query = new QSqlQuery;
         switch (Months) {
    
         case(1):{
    
    
            // qDebug()<<minMonth<<query->value(1).toInt()<<query->value(5).toInt();
    
              QPieSeries *series1 = new QPieSeries();
              QPieSeries *series2 = new QPieSeries();
              QPieSeries *series3 = new QPieSeries();
             query->exec(QString("select * from MonthTradeTypeNumber%1").arg(minMonth));
             if(query->first()){
    
     //         static QPieSeries *series1 = new QPieSeries();
     //         static QPieSeries *series2 = new QPieSeries();
     //         static QPieSeries *series3 = new QPieSeries();
             series1->setName("第一类");
             series1->append("商户消费", query->value(1).toInt());
             series1->append("零钱提现", query->value(5).toInt());
     //        qDebug()<<"第一类""商户消费""零钱提现";
     //        qDebug()<<minMonth<<query->value(1).toInt()<<query->value(5).toInt();
    
    
    
    
             series2->setName("第二类");
             series2->append("转账", query->value(2).toInt());
             series2->append("转账-退款", query->value(4).toInt());
             series2->append("零钱充值", query->value(8).toInt());
     //        qDebug()<<"第二类""转账""转账-退款""零钱充值";
     //        qDebug()<<query->value(2).toInt()<<query->value(4).toInt()<<query->value(8).toInt();
    
    
             series3->setName("第三类");
             series3->append("扫二维码付款", query->value(6).toInt());
             series3->append("微信红包", query->value(7).toInt());
             series3->append("其它", query->value(3).toInt());
    
     //         qDebug()<<"第三类""扫二维码付款""微信红包""其它";
     //         qDebug()<<query->value(6).toInt()<<query->value(7).toInt()<<query->value(3).toInt();
              }
             DonutBreakdownCharts *donutBreakdown11 = new DonutBreakdownCharts();
             donutBreakdown11->setAnimationOptions(QChart::AllAnimations);
             donutBreakdown11->setTitle(QString("%1Month交易类型数目表").arg(minMonth));
             donutBreakdown11->legend()->setAlignment(Qt::AlignRight);
             donutBreakdown11->addBreakdownSeries(series1, Qt::red);
             donutBreakdown11->addBreakdownSeries(series2, Qt::darkGreen);
             donutBreakdown11->addBreakdownSeries(series3, Qt::darkBlue);
    
    return donutBreakdown11;
    
          }
       case(2):{
    
             if(Month==QString("%1Month").arg(minMonth)){
    
    
             QPieSeries *series1 = new QPieSeries();
             QPieSeries *series2 = new QPieSeries();
             QPieSeries *series3 = new QPieSeries();
            query->exec(QString("select * from MonthTradeTypeNumber%1").arg(minMonth));
            if(query->first()){
    
    
            series1->setName("第一类");
            series1->append("商户消费", query->value(1).toInt());
            series1->append("零钱提现", query->value(5).toInt());
    
    
    
    
            series2->setName("第二类");
            series2->append("转账", query->value(2).toInt());
            series2->append("转账-退款", query->value(4).toInt());
            series2->append("零钱充值", query->value(8).toInt());
    
    
    
            series3->setName("第三类");
            series3->append("扫二维码付款", query->value(6).toInt());
            series3->append("微信红包", query->value(7).toInt());
            series3->append("其它", query->value(3).toInt());
    
             }
            DonutBreakdownCharts *donutBreakdown21 = new DonutBreakdownCharts();
            donutBreakdown21->setAnimationOptions(QChart::AllAnimations);
            donutBreakdown21->setTitle(QString("%1Month交易类型数目表").arg(minMonth));
            donutBreakdown21->legend()->setAlignment(Qt::AlignRight);
            donutBreakdown21->addBreakdownSeries(series1, Qt::red);
            donutBreakdown21->addBreakdownSeries(series2, Qt::darkGreen);
            donutBreakdown21->addBreakdownSeries(series3, Qt::darkBlue);
    
    
            return donutBreakdown21;
            }
    
    
    
             else if (Month==QString("%1Month").arg(maxMonth)) {
    
    
            QPieSeries *series21 = new QPieSeries();
            QPieSeries *series22 = new QPieSeries();
            QPieSeries *series23 = new QPieSeries();
           query->exec(QString("select * from MonthTradeTypeNumber%1").arg(maxMonth));
           if(query->first()){
           series21->setName("第一类");
           series21->append("商户消费", query->value(1).toInt());
           series21->append("零钱提现", query->value(5).toInt());
    
           series22->setName("第二类");
           series22->append("转账", query->value(2).toInt());
           series22->append("转账-退款", query->value(4).toInt());
           series22->append("零钱充值", query->value(8).toInt());
    
           series23->setName("第三类");
           series23->append("扫二维码付款", query->value(6).toInt());
           series23->append("微信红包", query->value(7).toInt());
           series23->append("其它", query->value(3).toInt());
    
    
            }
           DonutBreakdownCharts *donutBreakdown22 = new DonutBreakdownCharts();
           donutBreakdown22->setAnimationOptions(QChart::AllAnimations);
           donutBreakdown22->setTitle(QString("%1Month交易类型数目表").arg(maxMonth));
           donutBreakdown22->legend()->setAlignment(Qt::AlignRight);
           donutBreakdown22->addBreakdownSeries(series21, Qt::red);
           donutBreakdown22->addBreakdownSeries(series22, Qt::darkGreen);
           donutBreakdown22->addBreakdownSeries(series23, Qt::darkBlue);
    
           return donutBreakdown22;
    
             }
    
    
             else {
    
    
           QPieSeries *series31 = new QPieSeries();
           QPieSeries *series32 = new QPieSeries();
           QPieSeries *series33 = new QPieSeries();
          query->exec(QString("select * from MonthTradeTypeNumberall%1").arg(Months));
          if(query->first()){
    
    
          series31->setName("第一类");
          series31->append("商户消费", query->value(1).toInt());
          series31->append("零钱提现", query->value(5).toInt());
    
    
    
    
    
          series32->setName("第二类");
          series32->append("转账", query->value(2).toInt());
          series32->append("转账-退款", query->value(4).toInt());
          series32->append("零钱充值", query->value(8).toInt());
    
    
    
          series33->setName("第三类");
          series33->append("扫二维码付款", query->value(6).toInt());
          series33->append("微信红包", query->value(7).toInt());
          series33->append("其它", query->value(3).toInt());
    
    
           }
          DonutBreakdownCharts *donutBreakdown23 = new DonutBreakdownCharts();
          donutBreakdown23->setAnimationOptions(QChart::AllAnimations);
          donutBreakdown23->setTitle(QString("总交易类型数目表"));
          donutBreakdown23->legend()->setAlignment(Qt::AlignRight);
          donutBreakdown23->addBreakdownSeries(series31, Qt::red);
          donutBreakdown23->addBreakdownSeries(series32, Qt::darkGreen);
          donutBreakdown23->addBreakdownSeries(series33, Qt::darkBlue);
    
    
    
         return donutBreakdown23;
             }
    
         }
       case(3):{
    
            if(Month==QString("%1Month").arg(minMonth)){
             QPieSeries *series11 = new QPieSeries();
             QPieSeries *series12 = new QPieSeries();
             QPieSeries *series13 = new QPieSeries();
            query->exec(QString("select * from MonthTradeTypeNumber%1").arg(minMonth));
            if(query->first()){
    
    //         static QPieSeries *series1 = new QPieSeries();
    //         static QPieSeries *series2 = new QPieSeries();
    //         static QPieSeries *series3 = new QPieSeries();
            series11->setName("第一类");
            series11->append("商户消费", query->value(1).toInt());
            series11->append("零钱提现", query->value(5).toInt());
    //        qDebug()<<"第一类""商户消费""零钱提现";
    //        qDebug()<<minMonth<<query->value(1).toInt()<<query->value(5).toInt();
    
    
    
    
            series12->setName("第二类");
            series12->append("转账", query->value(2).toInt());
            series12->append("转账-退款", query->value(4).toInt());
            series12->append("零钱充值", query->value(8).toInt());
    //        qDebug()<<"第二类""转账""转账-退款""零钱充值";
    //        qDebug()<<query->value(2).toInt()<<query->value(4).toInt()<<query->value(8).toInt();
    
    
            series13->setName("第三类");
            series13->append("扫二维码付款", query->value(6).toInt());
            series13->append("微信红包", query->value(7).toInt());
            series13->append("其它", query->value(3).toInt());
             }
            DonutBreakdownCharts *donutBreakdown31 = new DonutBreakdownCharts();
            donutBreakdown31->setAnimationOptions(QChart::AllAnimations);
            donutBreakdown31->setTitle(QString("%1Month交易类型数目表").arg(minMonth));
            donutBreakdown31->legend()->setAlignment(Qt::AlignRight);
            donutBreakdown31->addBreakdownSeries(series11, Qt::red);
            donutBreakdown31->addBreakdownSeries(series12, Qt::darkGreen);
            donutBreakdown31->addBreakdownSeries(series13, Qt::darkBlue);
    
    
            return donutBreakdown31;
            }
    
    
            else if (Month==QString("%1Month").arg(minMonth+1)) {
    
    
            QPieSeries *series21 = new QPieSeries();
            QPieSeries *series22 = new QPieSeries();
            QPieSeries *series23 = new QPieSeries();
           query->exec(QString("select * from MonthTradeTypeNumber%1").arg(minMonth+1));
           if(query->first()){
    
    
           series21->setName("第一类");
           series21->append("商户消费", query->value(1).toInt());
           series21->append("零钱提现", query->value(5).toInt());
    
    
    
    
    
           series22->setName("第二类");
           series22->append("转账", query->value(2).toInt());
           series22->append("转账-退款", query->value(4).toInt());
           series22->append("零钱充值", query->value(8).toInt());
    
    
    
           series23->setName("第三类");
           series23->append("扫二维码付款", query->value(6).toInt());
           series23->append("微信红包", query->value(7).toInt());
           series23->append("其它", query->value(3).toInt());
    
    
            }
           DonutBreakdownCharts *donutBreakdown32 = new DonutBreakdownCharts();
           donutBreakdown32->setAnimationOptions(QChart::AllAnimations);
           donutBreakdown32->setTitle(QString("%1Month交易类型数目表").arg(minMonth+1));
           donutBreakdown32->legend()->setAlignment(Qt::AlignRight);
           donutBreakdown32->addBreakdownSeries(series21, Qt::red);
           donutBreakdown32->addBreakdownSeries(series22, Qt::darkGreen);
           donutBreakdown32->addBreakdownSeries(series23, Qt::darkBlue);
    
           return donutBreakdown32;
            }
    
    
            else if (Month==QString("%1Month").arg(maxMonth)) {
    
    
           QPieSeries *series31 = new QPieSeries();
           QPieSeries *series32 = new QPieSeries();
           QPieSeries *series33 = new QPieSeries();
          query->exec(QString("select * from MonthTradeTypeNumber%1").arg(maxMonth));
          if(query->first()){
    
    
          series31->setName("第一类");
          series31->append("商户消费", query->value(1).toInt());
          series31->append("零钱提现", query->value(5).toInt());
    
    
    
    
    
          series32->setName("第二类");
          series32->append("转账", query->value(2).toInt());
          series32->append("转账-退款", query->value(4).toInt());
          series32->append("零钱充值", query->value(8).toInt());
    
    
    
          series33->setName("第三类");
          series33->append("扫二维码付款", query->value(6).toInt());
          series33->append("微信红包", query->value(7).toInt());
          series33->append("其它", query->value(3).toInt());
    
    
           }
          DonutBreakdownCharts *donutBreakdown33 = new DonutBreakdownCharts();
          donutBreakdown33->setAnimationOptions(QChart::AllAnimations);
          donutBreakdown33->setTitle(QString("%1Month交易类型数目表").arg(maxMonth));
          donutBreakdown33->legend()->setAlignment(Qt::AlignRight);
          donutBreakdown33->addBreakdownSeries(series31, Qt::red);
          donutBreakdown33->addBreakdownSeries(series32, Qt::darkGreen);
          donutBreakdown33->addBreakdownSeries(series33, Qt::darkBlue);
    
          return donutBreakdown33;
    
            }
    
    
            else {
    
    
          QPieSeries *series40 = new QPieSeries();
          QPieSeries *series41 = new QPieSeries();
          QPieSeries *series42 = new QPieSeries();
         query->exec(QString("select * from MonthTradeTypeNumberall%1").arg(Months));
         if(query->first()){
    
    
         series40->setName("第一类");
         series40->append("商户消费", query->value(1).toInt());
         series40->append("零钱提现", query->value(5).toInt());
    
    
    
    
    
         series41->setName("第二类");
         series41->append("转账", query->value(2).toInt());
         series41->append("转账-退款", query->value(4).toInt());
         series41->append("零钱充值", query->value(8).toInt());
    
    
    
         series42->setName("第三类");
         series42->append("扫二维码付款", query->value(6).toInt());
         series42->append("微信红包", query->value(7).toInt());
         series42->append("其它", query->value(3).toInt());
    
    
          }
         DonutBreakdownCharts *donutBreakdown34 = new DonutBreakdownCharts();
         donutBreakdown34->setAnimationOptions(QChart::AllAnimations);
         donutBreakdown34->setTitle(QString("总交易类型数目表"));
         donutBreakdown34->legend()->setAlignment(Qt::AlignRight);
         donutBreakdown34->addBreakdownSeries(series40, Qt::red);
         donutBreakdown34->addBreakdownSeries(series41, Qt::darkGreen);
         donutBreakdown34->addBreakdownSeries(series42, Qt::darkBlue);
    
    
    
          return donutBreakdown34;
    
    
    }
         }
         case(4):{
    
    
    
             if(Month==QString("%1Month").arg(minMonth)){
    
    
             QPieSeries *series11 = new QPieSeries();
             QPieSeries *series12 = new QPieSeries();
             QPieSeries *series13 = new QPieSeries();
            query->exec(QString("select * from MonthTradeTypeNumber%1").arg(minMonth));
            if(query->first()){
    
    
            series11->setName("第一类");
            series11->append("商户消费", query->value(1).toInt());
            series11->append("零钱提现", query->value(5).toInt());
    
    
    
    
            series12->setName("第二类");
            series12->append("转账", query->value(2).toInt());
            series12->append("转账-退款", query->value(4).toInt());
            series12->append("零钱充值", query->value(8).toInt());
    
    
            series13->setName("第三类");
            series13->append("扫二维码付款", query->value(6).toInt());
            series13->append("微信红包", query->value(7).toInt());
            series13->append("其它", query->value(3).toInt());
    
             }
            DonutBreakdownCharts *donutBreakdown41 = new DonutBreakdownCharts;
    
            donutBreakdown41->setAnimationOptions(QChart::AllAnimations);
            donutBreakdown41->setTitle(QString("%1Month交易类型数目表").arg(minMonth));
            donutBreakdown41->legend()->setAlignment(Qt::AlignRight);
            donutBreakdown41->addBreakdownSeries(series11, Qt::red);
            donutBreakdown41->addBreakdownSeries(series12, Qt::darkGreen);
            donutBreakdown41->addBreakdownSeries(series13, Qt::darkBlue);
    
    
    
            return donutBreakdown41;
             }
    
    
             else if (Month==QString("%1Month").arg(minMonth+1)) {
    
    
            QPieSeries *series21 = new QPieSeries();
            QPieSeries *series22 = new QPieSeries();
            QPieSeries *series23 = new QPieSeries();
           query->exec(QString("select * from MonthTradeTypeNumber%1").arg(minMonth+1));
           if(query->first()){
    
    
           series21->setName("第一类");
           series21->append("商户消费", query->value(1).toInt());
           series21->append("零钱提现", query->value(5).toInt());
    
    
    
    
    
           series22->setName("第二类");
           series22->append("转账", query->value(2).toInt());
           series22->append("转账-退款", query->value(4).toInt());
           series22->append("零钱充值", query->value(8).toInt());
    
    
    
           series23->setName("第三类");
           series23->append("扫二维码付款", query->value(6).toInt());
           series23->append("微信红包", query->value(7).toInt());
           series23->append("其它", query->value(3).toInt());
    
    
            }
           DonutBreakdownCharts *donutBreakdown42 = new DonutBreakdownCharts ;
           donutBreakdown42->setAnimationOptions(QChart::AllAnimations);
           donutBreakdown42->setTitle(QString("%1Month交易类型数目表").arg(minMonth+1));
           donutBreakdown42->legend()->setAlignment(Qt::AlignRight);
           donutBreakdown42->addBreakdownSeries(series21, Qt::red);
           donutBreakdown42->addBreakdownSeries(series22, Qt::darkGreen);
           donutBreakdown42->addBreakdownSeries(series23, Qt::darkBlue);
    
    
           return   donutBreakdown42;
             }
    
    
    
             else if (Month==QString("%1Month").arg(maxMonth-1)) {
    
    
    
           QPieSeries *series31 = new QPieSeries();
           QPieSeries *series32 = new QPieSeries();
           QPieSeries *series33 = new QPieSeries();
          query->exec(QString("select * from MonthTradeTypeNumber%1").arg(maxMonth-1));
          if(query->first()){
    
    
          series31->setName("第一类");
          series31->append("商户消费", query->value(1).toInt());
          series31->append("零钱提现", query->value(5).toInt());
    
    
    
    
    
          series32->setName("第二类");
          series32->append("转账", query->value(2).toInt());
          series32->append("转账-退款", query->value(4).toInt());
          series32->append("零钱充值", query->value(8).toInt());
    
    
    
          series33->setName("第三类");
          series33->append("扫二维码付款", query->value(6).toInt());
          series33->append("微信红包", query->value(7).toInt());
          series33->append("其它", query->value(3).toInt());
    
    
           }
          DonutBreakdownCharts *donutBreakdown43 =new DonutBreakdownCharts;
          donutBreakdown43->setAnimationOptions(QChart::AllAnimations);
          donutBreakdown43->setTitle(QString("%1Month交易类型数目表").arg(maxMonth-1));
          donutBreakdown43->legend()->setAlignment(Qt::AlignRight);
          donutBreakdown43->addBreakdownSeries(series31, Qt::red);
          donutBreakdown43->addBreakdownSeries(series32, Qt::darkGreen);
          donutBreakdown43->addBreakdownSeries(series33, Qt::darkBlue);
    
          return donutBreakdown43;
             }
    
    
    
             else if (Month==QString("%1Month").arg(maxMonth)) {
    
    
    
          QPieSeries *series40 = new QPieSeries();
          QPieSeries *series41 = new QPieSeries();
          QPieSeries *series42 = new QPieSeries();
         query->exec(QString("select * from MonthTradeTypeNumber%1").arg(maxMonth));
         if(query->first()){
    
    
         series40->setName("第一类");
         series40->append("商户消费", query->value(1).toInt());
         series40->append("零钱提现", query->value(5).toInt());
    
    
    
    
    
         series41->setName("第二类");
         series41->append("转账", query->value(2).toInt());
         series41->append("转账-退款", query->value(4).toInt());
         series41->append("零钱充值", query->value(8).toInt());
    
    
    
         series42->setName("第三类");
         series42->append("扫二维码付款", query->value(6).toInt());
         series42->append("微信红包", query->value(7).toInt());
         series42->append("其它", query->value(3).toInt());
    
    
          }
         DonutBreakdownCharts *donutBreakdown44 =new DonutBreakdownCharts;
         donutBreakdown44->setAnimationOptions(QChart::AllAnimations);
         donutBreakdown44->setTitle(QString("%1Month交易类型数目表").arg(maxMonth));
         donutBreakdown44->legend()->setAlignment(Qt::AlignRight);
         donutBreakdown44->addBreakdownSeries(series40, Qt::red);
         donutBreakdown44->addBreakdownSeries(series41, Qt::darkGreen);
         donutBreakdown44->addBreakdownSeries(series42, Qt::darkBlue);
    
    
    
             return  donutBreakdown44;
             }
    
    
    
    
             else {
    
    
         QPieSeries *series50 = new QPieSeries();
         QPieSeries *series51 = new QPieSeries();
         QPieSeries *series52 = new QPieSeries();
     bool str =   query->exec(QString("select * from MonthTradeTypeNumberall%1").arg(Months));
     qDebug()<<str;
        if(query->first()){
    
    
        series50->setName("第一类");
        series50->append("商户消费", query->value(1).toInt());
        series50->append("零钱提现", query->value(5).toInt());
    
    
    
    
    
        series51->setName("第二类");
        series51->append("转账", query->value(2).toInt());
        series51->append("转账-退款", query->value(4).toInt());
        series51->append("零钱充值", query->value(8).toInt());
    
    
    
        series52->setName("第三类");
        series52->append("扫二维码付款", query->value(6).toInt());
        series52->append("微信红包", query->value(7).toInt());
        series52->append("其它", query->value(3).toInt());
    
    
    
        qDebug()<<"123111111111"<<"总表数据"<<query->value(1).toInt()<<query->value(5).toInt();
         }
        DonutBreakdownCharts *donutBreakdown45 = new DonutBreakdownCharts;
        donutBreakdown45->setAnimationOptions(QChart::AllAnimations);
        donutBreakdown45->setTitle(QString("总交易类型数目表"));
        donutBreakdown45->legend()->setAlignment(Qt::AlignRight);
        donutBreakdown45->addBreakdownSeries(series50, Qt::red);
        donutBreakdown45->addBreakdownSeries(series51, Qt::darkGreen);
        donutBreakdown45->addBreakdownSeries(series52, Qt::darkBlue);
    
    
           return donutBreakdown45;
    
         }
        }
    
    
    }
    }
    
    DataTable ThemeWidget::generateRandomData(int listCount, int valueMax, int valueCount) const
    {
        DataTable dataTable;
    
        // set seed for random stuff
        qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime()));
    
        // generate random data
        for (int i(0); i < listCount; i++) {
            DataList dataList;
            qreal yValue(0);
            for (int j(0); j < valueCount; j++) {
                yValue = yValue + (qreal)(qrand() % valueMax) / (qreal) valueCount;
                QPointF value((j + (qreal) rand() / (qreal) RAND_MAX) * ((qreal) m_valueMax / (qreal) valueCount),
                              yValue);
                QString label = "Slice " + QString::number(i) + ":" + QString::number(j);
                dataList << Data(value, label);
            }
            dataTable << dataList;
        }
    
        return dataTable;
    }
    
    QComboBox *ThemeWidget::createThemeBox() const
    {
    
     // settings layout
        QComboBox *themeComboBox = new QComboBox();
        themeComboBox->addItem("Light", QChart::ChartThemeLight);
        themeComboBox->addItem("Blue Cerulean", QChart::ChartThemeBlueCerulean);
        themeComboBox->addItem("Dark", QChart::ChartThemeDark);
        themeComboBox->addItem("Brown Sand", QChart::ChartThemeBrownSand);
        themeComboBox->addItem("Blue NCS", QChart::ChartThemeBlueNcs);
        themeComboBox->addItem("High Contrast", QChart::ChartThemeHighContrast);
        themeComboBox->addItem("Blue Icy", QChart::ChartThemeBlueIcy);
        themeComboBox->addItem("Qt", QChart::ChartThemeQt);
        return themeComboBox;
    }
    
    QComboBox *ThemeWidget::createAnimationBox(int minMonth, int maxMonth, int Months) const
    {
        // settings layout
        switch(Months){
    
    
        case(1):{
            int a1 = 11;
    
    
    
            QComboBox *themeComboBox = new QComboBox();
            themeComboBox->addItem(QString("%1Month").arg(minMonth), a1);
           // qDebug()<<"11""createThemeBox";
            return themeComboBox;
    
    
        }
        case(2):{
            int b1 = 21,b2 = 22,b3 = 23;
    
    
            QComboBox *themeComboBox = new QComboBox();
            themeComboBox->addItem(QString("%1Month").arg(minMonth), b1);
            themeComboBox->addItem(QString("%1Month").arg(maxMonth), b2);
            themeComboBox->addItem("AllMonth", b3);
             return themeComboBox;
    
             }
        case(3):{
            int c1 = 31,c2 = 32,c3 = 33,c4 = 34;
            QComboBox *themeComboBox = new QComboBox();
            themeComboBox->addItem(QString("%1Month").arg(minMonth), c1);
            themeComboBox->addItem(QString("%1Month").arg(minMonth+1), c2);
            themeComboBox->addItem(QString("%1Month").arg(maxMonth), c3);
            themeComboBox->addItem("AllMonth", c4);
            return themeComboBox;
                 }
    
        case(4):{
    
            qDebug()<<"123123";
            int d1 = 41,d2 = 42,d3 = 43,d4 = 44,d5 = 45;
            QComboBox *themeComboBox = new QComboBox();
            themeComboBox->addItem(QString("%1Month").arg(minMonth), d1);
            themeComboBox->addItem(QString("%1Month").arg(minMonth+1), d2);
            themeComboBox->addItem(QString("%1Month").arg(maxMonth-1), d3);
            themeComboBox->addItem(QString("%1Month").arg(maxMonth), d4);
            themeComboBox->addItem("AllMonth", d5);
            return themeComboBox;
    
    
                  }
    
        }
    }
    
    
    
    
    
    
    
    void ThemeWidget::updateUI()
    {
        QChart::ChartTheme theme = static_cast<QChart::ChartTheme>(
                    m_themeComboBox->itemData(m_themeComboBox->currentIndex()).toInt());
    
        const auto charts = m_charts;
        if (m_charts.at(0)->chart()->theme() != theme) {
            for (QChartView *chartView : charts)
                chartView->chart()->setTheme(theme);
    
            QPalette pal = window()->palette();
            if (theme == QChart::ChartThemeLight) {
                pal.setColor(QPalette::Window, QRgb(0xf0f0f0));
                pal.setColor(QPalette::WindowText, QRgb(0x404044));
            } else if (theme == QChart::ChartThemeDark) {
                pal.setColor(QPalette::Window, QRgb(0x121218));
                pal.setColor(QPalette::WindowText, QRgb(0xd6d6d6));
            } else if (theme == QChart::ChartThemeBlueCerulean) {
                pal.setColor(QPalette::Window, QRgb(0x40434a));
                pal.setColor(QPalette::WindowText, QRgb(0xd6d6d6));
            } else if (theme == QChart::ChartThemeBrownSand) {
                pal.setColor(QPalette::Window, QRgb(0x9e8965));
                pal.setColor(QPalette::WindowText, QRgb(0x404044));
            } else if (theme == QChart::ChartThemeBlueNcs) {
                pal.setColor(QPalette::Window, QRgb(0x018bba));
                pal.setColor(QPalette::WindowText, QRgb(0x404044));
            } else if (theme == QChart::ChartThemeHighContrast) {
                pal.setColor(QPalette::Window, QRgb(0xffab03));
                pal.setColor(QPalette::WindowText, QRgb(0x181818));
            } else if (theme == QChart::ChartThemeBlueIcy) {
                pal.setColor(QPalette::Window, QRgb(0xcee7f0));
                pal.setColor(QPalette::WindowText, QRgb(0x404044));
            } else {
                pal.setColor(QPalette::Window, QRgb(0xf0f0f0));
                pal.setColor(QPalette::WindowText, QRgb(0x404044));
            }
            window()->setPalette(pal);
        }
    
        bool checked = m_antialiasCheckBox->isChecked();
        for (QChartView *chart : charts)
            chart->setRenderHint(QPainter::Antialiasing, checked);
    
        QChart::AnimationOptions options(
                    m_animatedComboBox->itemData(m_animatedComboBox->currentIndex()).toInt());
        if (m_charts.at(0)->chart()->animationOptions() != options) {
            for (QChartView *chartView : charts)
                chartView->chart()->setAnimationOptions(options);
        }
    
    
    }
    
    

     

     

    展开全文
  • 微信小程序 demo 微信小程序记账
  • 这里写自定义目录标题微信小程序 模拟支付宝账单的个人记账小程序一、准备阶段二、写代码1、登录界面2、记账界面3、账单界面4、统计界面三、总结 微信小程序 模拟支付宝账单的个人记账小程序 初学微信小程序开发,...

    微信小程序 模拟支付宝账单的个人记账小程序

    初学微信小程序开发,为了锻炼自己的开发能力,一共写了两个小程序,一个是个人相册小程序,一个是这篇文章要介绍的模拟支付宝账单的个人记账小程序。

    一、准备阶段

    首先得了解支付宝账单的界面:
    支付宝账单界面
    账单界面就是几个筛选分类的按钮和消费记录的列表,统计界面有一个一月的日消费、支出折线图和消费、收入的环形图,还有消费、支出的榜单。
    所以用小程序模拟这个账单也是不难的,大致要用到tabBar、weui、选择器picker、icon、wx:for渲染和绘图插件echarts或者wx-charts,这里我选用了echarts。
    其次就是icon的选用,weui里的icon不能满足消费类别图标的需求,可以使用阿里矢量图标库https://www.iconfont.cn/,搜索官方的支付宝图标。

    二、写代码

    1、登录界面

    登录界面使用weui的From表单输入框,简单写一个页面就好了。
    登录界面
    这里没有写注册界面,直接登录,识别到不在云数据库里的用户名就直接算作注册。

    2、记账界面

    记账界面和登录界面差不多,不过输入框旁边的变成了picker选择框,选择消费类别和支出/收入。
    记账界面

    3、账单界面

    账单界面要做到与支付宝账单界面相同还是用一定难度的,支付宝账单界面顶部的筛选、分类下拉栏要在微信小程序实现的话要写挺多的代码,所以这里我就改为了一个weui的navbar,然后用picker和九宫格嵌入弹出式菜单实现时间选择和类别选择。
    账单列表使用wx:for渲染。
    账单界面

    4、统计界面

    统计界面需要用到echarts(在使用echarts时遇到一个坑,使用在echarts官方下载的精简版的插件时,真机调试图表无法显示,需要下载比较全的js包:https://github.com/WsmDyj/echarts-for-taro/tree/master/src/components/ec-canvas)
    关于echarts的使用可以看下载的echarts包里的例子。在制作收入/支出日数据折线图时得要动态加载数据,教程可以参考:https://blog.csdn.net/hao_0420/article/details/80931339?utm_source=blogxgwz9
    多个图表的加载参考:https://www.jianshu.com/p/d71d8ea3cb1b
    在这里插入图片描述

    5、云数据库设计

    user集合
    账单及统计集合

    三、总结

    从开始到完成这个小程序共用了近4天,期间遇到各种bug,幸好都一一解决的,其中遇到的最大的问题就是云函数的使用,在测试云函数的时候获取到的都是undefine,怎么调整都搞不定,在快完成这个小程序时,发现应该是异步的问题,下次可以用promise设置返回时间试试。
    最后项目地址:https://github.com/ccc-hhh/Wechat-MiniProgram-Personal-Accounting-Program

    展开全文
  • 在国内,几乎每个用户都安装有微信,并且可能几乎每个用户都关注过1个以上微信公众号或者打开过一个以上的小程序,比如自己开店的,需要通过微信支付收款,查看账单数据,打开的就是小程序平台。微

    除了微信平台有小程序,其他平台也推出了自己的小程序,我总结了目前主流平台的小程序平台,并分析与微信小程序开发技术上面的差异及发展前景,方便客户及时作出线上运营调整。

    1.微信小程序
    腾讯公司最近发布了2019年的微信平台增长数据,2019年,微信用户规模达到了11.64亿,微信小程序年交易额达到了8000亿。在国内,几乎每个用户都安装有微信,并且可能几乎每个用户都关注过1个以上微信公众号或者打开过一个以上的小程序,比如自己开店的,需要通过微信支付收款,查看账单数据,打开的就是小程序平台。微信小程序的SDK功能非常完善,近期还推出了直播功能,而且插件市场有成千上万强大的插件可供开发者使用,满足大部分的开发需求。杭谐科技小程序开发公司团队认为,微信小程序无疑是软件开发服务行业的下一个风口,对于企业来说,上线一个属于自己的小程序版,已经成为一种趋势。

    2.支付宝小程序
    支付宝用户已经超10亿,用户规模虽然相对于微信来说少了一点,但是同样几乎每个国人都有安装支付宝,支付宝也推出了自己的小程序平台,而且根据开发人员反应,支付宝小程序的SDK与微信小程序大同小异,很多代码存在重合的情况,总体的结构和开发模式差不多,也就是开发好一个微信小程序,再移植到支付宝小程序,无需从头开发,只需要对代码稍作修改即可,大大节约开发时间和开发成本。但是支付宝小程序相对于微信小程序来说,可以实现的功能会少一些,没有微信小程序强大和完善。比如微信小程序已支持直播功能,而支付宝没有,但是相信随着直播带货越来越火,未来支付宝小程序推出直播功能是迟早的事情。

    3.今日头条小程序
    今日头条属于字节跳动旗下产品,字节跳动旗下公司还包括抖音、火山小视频、西瓜视频、懂车帝等,尤其是抖音,全球用户规模甚至不比微信和支付宝低,着看直播、看直播买货、打赏网红等已经成为越来越多的国人的一种生活习惯或消费习惯,而且字节跳动小程序可以无缝对接今日头条、抖音等平台。抖音、今日头条可以挂上小程序的连接,对于企业来说,以前需要一个企业官网,而现在越来越多的企业需要一个头条号或者抖音号。开通头条号或者抖音号,自然需要一个小程序展示企业的产品或者服务。总的来说,微信小程序发展前景非常大,而字节跳动小程序,发展前景也非常大。至于开发上面的区别,就像支付宝小程序相对于微信小程序一样,字节跳动小程序整体的一个代码结构和开发模式和微信小程序大同小异,也就是开发好一个微信小程序,再移植到字节跳动小程序,非常方便,无需做大规模的修改,而且官方也为开发者提供了一键将微信小程序移植到头条小程序的工具。

    4.华为/小米应用市场小程序
    使用华为手机或者小米手机的用户都知道,在应用市场搜索app,会向用户推荐快应用入口,快应用其实就是华为/小米版的小程序。目前国内主流手机厂商已经定格,分别是:华为、小米、oppo、vivo、苹果、三星。除了苹果和三星,国内10大安卓手机厂商联合一起,推出了快应用服务平台。手机厂商推出的小程序相对于微信小程序有更多优势,可以更好的和手机系统和手机硬件对接,在推送方面,相对于微信小程序的诸多限制,快应用明显是有很大优势的。至于三星,其实已经和微信小程序达成了合作,2019年8月21日,微信与三星手机共同宣布,推出“负一屏卡片”和“微信小程序侧屏”两个进入小程序的快捷功能,用户只需在三星手机桌面轻轻“右滑”或“左拉”就能体验“即开即用”服务。这也是微信与手机厂商首次进行的系统级合作。至于苹果系统,也有小程序,名叫App Clips,用户不需要完全安装它们,用户通过扫描二维码来体验应用程序的部分功能,在iOS 14中有小程序的Clips的新API,允许开发者从他们的应用程序中提供互动和动态内容。

    展开全文
  • 蓝色生活账单记录微信小程序源码下载.zip
  • 上周接了公司的需求,在微信和百度小程序中开发支付功能以及定时对账功能。花了快一周时间,看了大家的不少经验,终于把这个需求给做完了,微信支付流程以及对账流程已经走通,百度的还没有进行测试,现将一些注意...

    上周接了公司的需求,在微信和百度小程序中开发支付功能以及定时对账功能。花了快一周时间,看了大家的不少经验,终于把这个需求给做完了,微信支付流程以及对账流程已经走通,百度的还没有进行测试,现将一些注意事项写出来,后续会将一些大概的代码进行分享。
    微信相关逻辑流程代码梳理:
    微信后端代码
    百度小程序逻辑流程代码梳理:
    百度后端代码

    微信小程序支付开发文档:
    https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_4&index=3

    一、小程序后端负责生成根据用户的信息,已经购买的相关信息生成订单的编号等信息,通过这个初步的订单信息去微信统一下单接口进行预订单生成。
    二、微信会根据商户发送的信息给商户生成预订单,小程序后端接收到的预订单信息需要打包后提供给前端,前端拿着这些信息才能去微信支付接口发起支付。
    三、支付成功后,前端会收到微信通知,后端也会收到信息,二者之间没有交互。且后端需要给微信后台反馈是否已经消费过消息。

    A.注意签名的问题:
    ①向微信预订单接口发送请求时,要根据请求的信息生成签名;
    ②微信返回信息时要对微信返回的签名进行校验(需要根据微信返回的所有信息重新生成签名进行比较);
    ③在向前端返回信息时,要根据给前端的信息有哪些来生成签名,前端需要拿着这些信息去微信请求支付;
    B.注意随机字符串:
    ①预订单请求时商户随机生成一个字符串;
    ②微信预订单请求返回信息时也会返回一个随机字符串;
    ③后端给前端返回信息时的随机字符串是微信预订单返回的随机字符串;

    C.处理回调时候注意:
    ①微信回调时,如果返回信息超时或者应答不规范,微信是会持续进行回调,此时要注意幂等性的问题,处理过的消息不能再进行处理;
    ②为了资金安全,在微信回调时要对回调消息的参数签名等信息进行校验;

    对账单:
    微信下载的账单格式已经和文档中的不一样了,对应信息的位置也已经发生了改变,需要下载完账单后对照表头信息进行重新解析。
    这是我对账时候下载账单的格式:

    交易时间,公众账号ID,商户号,特约商户号,设备号,微信订单号,商户订单号,用户标识,交易类型,交易状态,付款银行,货币种类,应结订单金额,代金券金额,商品名称,商户数据包,手续费,费率,订单金额,费率备注`

    最后一行信息的格式为:

    总交易单数,应结订单总金额,退款总金额,充值券退款总金额,手续费总金额,订单总金额,申请退款总金额

    本人当时对账单时只对了SUCCESS类型的账单,这些信息也是该请求下返回的微信账单格式,其他类型没研究过。

    百度开发文档:
    https://smartprogram.baidu.com/docs/develop/function/invoke_process/
    百度支付那边生成订单更简单一些,不需要和百度进行交互,而且签名的生成有现成的工具类,同时和前端传递信息时用的都是JSON,只不过在下载对账单时比较麻烦,需要去拿一个access_token,但是需要注意的是,这个token对于平台来说全局唯一,下载账单请求token也会导致其他地方的token失效,所以最好有一个统一的地方去获取token。

    展开全文
  • 小程序的支付系统,系统功能测试完了之后,把这部分资源开源一下吧。内容包括有微信小程序支付、退款等。开发平台在linux上,在makefile上编进去就可以用了。
  • 微信小程序通过小程序云实现微信支付功能。 一、开通微信支付1.1 关联商户号1.2 添加商户号二、云函数开发2.1 新建云函数2.2 云函数代码2.3 云函数上传并部署三、小程序调用3.1 统一下单3.2 调起微信支付界面3.2 ...
  • 微信小程序微信支付

    千次阅读 多人点赞 2018-07-24 18:10:51
    - -微信支付之小程序- - 哈喽 我是你们的KingYiFan,一直说把微信支付给分享出来一直没有机会。终于闲下来了。听着音乐给你们分享一下。不懂可以随时联系我。。 -~~ 本文介绍小程序微信支付的java服务端~~。 ...
  • 微信小程序和支付宝小程序的开发记录
  • 近来要做一个年账单页面,类似于支付宝年账单,就是对一年下单的总结,但是支付宝页面滑动的效果在小程序上是有些bug的,柚子也是研究了很久了,但自认还算完美吧,下面把过程说一下,希望能对某些朋友有所帮助: ...
  • 支付宝是咋做的 咱也不知道 先把效果实现了再说 效果图如下: js代码后端根据最后的时间 向后查询size条数据 getData() { const params = { ... type: this.data.navActive + 1 ... const mon...
  • 基于微信小程序的各种简单工具合集 开源地址 (欢迎 Star ~ ~ ( ̄▽ ̄)) GitHub: Gitee: 工具目录 :calendar: 表示计划中 日常生活类 | | | | 职场工具 | 其他 | 在线体验 左侧为小程序二维码 系列博文 微信小...
  • 微信小程序,服务端接口支持 微信认证服务号,服务端接口支持 微信支付(账单、卡券、红包、退款、转账、App支付、JSAPI支付、Web支付、扫码支付等) 支付宝支付(账单、转账、App支付、刷卡支付、扫码支付、Web支付...
  • '微信' : '支付宝'}}</view> <view class="subItem_time">{{subItem.date}}</view> </view> <view class="subItem_info"> ;">{{subItem.number}}</view> ;">申请中</view> </view> </view> </block> 暂无提现记录~...
  • 微信小程序,服务端接口支持 微信认证服务号,服务端接口支持 微信支付(账单、卡券、红包、退款、转账、App支付、JSAPI支付、Web支付、扫码支付等) 支付宝支付(账单、转账、App支付、刷卡支付、扫码支付、W
  • 微信(WeChat)在 iPhone面世10周年之际向苹果公司(Apple Inc.,AAPL)致敬,并在同一天发布了新的应用小程序,而这一平台可能在未来10年挑战苹果在应用领域的地位。  微信创始人张小龙(Allan Zhang)在其社交媒体...
  • 这是理财系统的前端,江苏海洋大学微信小程序比赛,最后获得了一等奖 GitHub:https://github.com/GeorgeLeoo/finance 1. 项目描述 (1). 此项目为记账小程序 (2). 包括账单、图表、搜索、用户等多个子模块 (3). 使用...
  • 微信小程序 - 蓝牙打印机、支持账单模式、标签模式、查询打印机状态、分包发送、打印数量、蓝牙搜索、获取蓝牙设备信息、开始连接蓝牙设置、启用低功耗蓝牙设备特征值变化时的 notify 功能
  • 微信支付JSAPI下单和微信小程序调起支付(V2版本)。 一、前文; 二、流程图; 三、SpringBoot接口实现; 2.1 微信调起支付所需数据; 2.2 下单接口; 2.3 支付回调接口; 三、微信小程序实现; 3.1 JSAP统一下单; ...
  • 我司于上周三(11月6日上线研习屋-一款服务于共享自习室的微信小程序),相关信息请前往这里查看:共享自习室小程序-研习屋内测开启 今天正式上线开启公开测试,欢迎大家垂询!谢谢大家!下面展示一些小程序截图: ...
  • * appid 小程序id 微信公众平台 设置中的开发设置中可以查到,相当于qq的qq号 建议单独创建一个配置文件储存此类值和函数 */ public static final String APPID = "APPID"; /** * AppSecret 小程序密钥...
  • 微信小程序怎么用和小程序有什么用的问题是从微信小程序一出来就伴随着的。微信小程序怎么用:**1、打开微信的『发现』,在最底下有『小程序』,进入界面后搜索对应的小程序名称,如:极乐商店 2、在极乐小程序商店...
  • 1.申请微信小程序支付 在微信商户号中申请小程序支付,小程序支付申请成功后关联到商户号 2.hbuilderx中manifest.json设置开启支付功能 3.uniapp拉取支付接口 async billOpre(item){ if(item.billStatus==2){ ...
  • 微信小程序 微信支付 + Java后台接口 这块的内容比较复杂。在网上找了很多的文章,发现很多都不是能在我做的这个项目中跑起来。最终借助公司大佬的力量才勉强的把这块的内容完成。实属不易。 ...index=1 ...
  • 微信小程序支付 退款 订单查询 退款查询 整理的很全面 包括证书的使用 配置简单明了

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 1,344
精华内容 537
关键字:

微信账单小程序