⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dealing.cpp

📁 这是一个银行系统的管理软件
💻 CPP
字号:
/**********************************************************************************
*                                                                                 *
*  Henry Banking System ATM Module                                                *
*  Copyright (c) 2004 by Henry. All rights reserved.                              *
*                                                                                 *
*  Permission to use, copy, modify, and distribute this software for any purpose  *
*  is hereby granted without fee, provided that this copyright and permissions    *
*  notice appear in all copies and derivatives, and that no charge may be made    *
*  for the software and its documentation except to cover cost of distribution.   *
*                                                                                 *
*  This software is provided "as is" without express or implied warranty.         *
*                                                                                 *
**********************************************************************************/

/*
*  Description:
*
*    The instance of dealing.
*
*  Notes:
*
*    This code has been written to conform to standard C++ and STL. It has been
*    compiled successfully using Visual C++ 7.0.
*/


#include <string>
#include <vector>
#include "banking.h"
#include "common.h"
#include "dataSet.h"
#include "cui.h"
#include "report.h"
using namespace cui;
using namespace report;

namespace banking
{
	Dealing::Dealing() : DataSet("database/dealing.txt")
	{
	
	}
	//Dealing ID
	string Dealing::getDealingId()
	{
		return dataRow[DEALING_ID];
	}
	void Dealing::setDealingId(string dealingId)
	{
		dataRow[DEALING_ID] = dealingId;
	}
	
	//Dealer's Card Number
	string Dealing::getDealerCardNo()
	{
		return dataRow[DEALER_CARD_NO];
	}
	void Dealing::setDealerCardNo(string dealerCardNo)
	{
		dataRow[DEALER_CARD_NO] = dealerCardNo;
	}

	//Dealing Amount
	double Dealing::getDealingAmount()
	{
		return string2double(dataRow[DEALING_AMOUNT]);
	}
	void Dealing::setDealingAmount(double dealingAmount)
	{
		dataRow[DEALING_AMOUNT] = double2string(dealingAmount);
	}
	
	//Dealing Type
	string Dealing::getDealingType()
	{
		return dataRow[DEALING_TYPE];
	}
	void Dealing::setDealingType(string dealingType)
	{
		dataRow[DEALING_TYPE] = dealingType;
	}

	//Dealing DateTime
	string Dealing::getDealingDateTime()
	{
		return dataRow[DEALING_DATE_TIME];
	}
	void Dealing::setDealingDateTime(string dealingDateTime)
	{
		dataRow[DEALING_DATE_TIME] = dealingDateTime;
	}

	//Methods And Functions
	void Dealing::appendDealing(string cardNo, double amount, string type)
	{
		vector<string> vec;
		System system;
		vec.push_back(long2string(system.generateNewDealingId()));
		vec.push_back(cardNo);
		vec.push_back(double2string(amount));
		vec.push_back(type);
		vec.push_back(getNow());
		append(vec);
	}

	void Dealing::printBill()
	{
		if(!Confirm::show("Do you want to print the bill copy?", "需要打印凭条吗?")) return;
		ReportForm bill;
		bill.header  = format("AUTOMATIC TELLER MACHINE - HENRY BANKING SYSTEM", bill.size(), ALIGN_CENTER) + "\n";
		bill.header += format("CARDHOLDER BILL COPY 持卡人存根", bill.size(), ALIGN_CENTER);

		bill.footer  = format("I ACKNOWLEDGE SATISFACTORY RECEIPT OF RELATIVE SERVICES", bill.size(), ALIGN_CENTER) + "\n";
		bill.footer += format("同意义上款项/服务", bill.size(), ALIGN_CENTER);
		
		bill.appendItem("TERMINAL ID 终端机号", "10203");
		bill.appendItem("-");
		bill.appendItem("CARD TYPE 卡别", "CREDIT CARD OF HENRY BANK");
		bill.appendItem("CARD NUMBER 卡号", getDealerCardNo());
		bill.appendItem();
		switch(string2long(getDealingType()))
		{
		case 1:
			bill.appendItem("TRANS TYPE 交易类型", "OPEN ACCOUNT 银行卡开户");
			bill.appendItem("BATCH NO. 交易批号", getDealingId());
			bill.appendItem("DATE/TIME 时间/日期", getDealingDateTime());
			break;
		case 2:
			bill.appendItem("TRANS TYPE 交易类型", "DRAW CASH 现金取款");
			bill.appendItem("BATCH NO. 交易批号", getDealingId());
			bill.appendItem();
			bill.appendItem("TOTAL AMOUNT 交易金额", double2string(getDealingAmount()));
			bill.appendItem("DATE/TIME 时间/日期", getDealingDateTime());	
			break;
		case 3:
			bill.appendItem("TRANS TYPE 交易类型", "DEPOSIT CASH 现金存款");
			bill.appendItem("BATCH NO. 交易批号", getDealingId());
			bill.appendItem();
			bill.appendItem("TOTAL AMOUNT 交易金额", double2string(getDealingAmount()));
			bill.appendItem("DATE/TIME 时间/日期", getDealingDateTime());	
			break;
		}
		bill.appendItem("-");
		bill.appendItem("CARDHOLDER SINATURE");
		bill.appendItem("持卡人签名");
		bill.show();
	}

	string Dealing::toString()
	{
		string myString = "";
		myString += "Dealing ID       :  " + getDealingId() + "\n";
		myString += "Dealer Card No.  :  " + getDealerCardNo() + "\n";
		myString += "Dealing Amount   :  " + double2string(getDealingAmount()) + "\n";
		myString += "Dealing Type     :  " + getDealingType() + "\n";
		myString += "Dealing DateTime :  " + getDealingDateTime() + "\n";
		return myString;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -