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

📄 accept.cpp

📁 根据客户提供的轮胎规格,单价,完成天数计算价格,并形成记录,可根据记录自行选择轮胎种类计算某几种轮胎再一定时间内完成需要价格.共有记录添加,记录修改,计算价格三个部分
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// accept.cpp : implementation file
//

#include "stdafx.h"
#include "type.h"
#include "accept.h"
#include "fstream.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// accept dialog


accept::accept(CWnd* pParent /*=NULL*/)
	: CDialog(accept::IDD, pParent)
{

	//{{AFX_DATA_INIT(accept)
	m_mtype1 = _T("");
	m_mtype2 = _T("");
	m_mtype3 = _T("");
	m_mtype4 = _T("");
	m_mtype5 = _T("");
	m_meach1 = _T("");
	m_meach2 = _T("");
	m_meach3 = _T("");
	m_meach4 = _T("");
	m_meach5 = _T("");
	m_mtime1 = _T("");
	m_mtime2 = _T("");
	m_mtime3 = _T("");
	m_mtime4 = _T("");
	m_mtime5 = _T("");
	m_mtime6 = _T("");
	m_mtime7 = _T("");
	m_mtime8 = _T("");
	m_mtime9 = _T("");
	m_mtime10 = _T("");
	m_mprice1 = _T("");
	m_mprice2 = _T("");
	m_mprice3 = _T("");
	m_mprice4 = _T("");
	m_mprice5 = _T("");
	m_chk1 = FALSE;
	m_chk2 = FALSE;
	m_chk3 = FALSE;
	m_chk4 = FALSE;
	m_chk5 = FALSE;
	//}}AFX_DATA_INIT
}


void accept::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(accept)
	DDX_Text(pDX, IDC_EDIT1, m_mtype1);
	DDX_Text(pDX, IDC_EDIT4, m_mtype2);
	DDX_Text(pDX, IDC_EDIT7, m_mtype3);
	DDX_Text(pDX, IDC_EDIT10, m_mtype4);
	DDX_Text(pDX, IDC_EDIT13, m_mtype5);
	DDX_Text(pDX, IDC_EDIT2, m_meach1);
	DDX_Text(pDX, IDC_EDIT5, m_meach2);
	DDX_Text(pDX, IDC_EDIT8, m_meach3);
	DDX_Text(pDX, IDC_EDIT11, m_meach4);
	DDX_Text(pDX, IDC_EDIT14, m_meach5);
	DDX_Text(pDX, IDC_EDIT16, m_mtime1);
	DDX_Text(pDX, IDC_EDIT17, m_mtime2);
	DDX_Text(pDX, IDC_EDIT18, m_mtime3);
	DDX_Text(pDX, IDC_EDIT19, m_mtime4);
	DDX_Text(pDX, IDC_EDIT20, m_mtime5);
	DDX_Text(pDX, IDC_EDIT21, m_mtime6);
	DDX_Text(pDX, IDC_EDIT22, m_mtime7);
	DDX_Text(pDX, IDC_EDIT23, m_mtime8);
	DDX_Text(pDX, IDC_EDIT24, m_mtime9);
	DDX_Text(pDX, IDC_EDIT25, m_mtime10);
	DDX_Text(pDX, IDC_EDIT3, m_mprice1);
	DDX_Text(pDX, IDC_EDIT6, m_mprice2);
	DDX_Text(pDX, IDC_EDIT9, m_mprice3);
	DDX_Text(pDX, IDC_EDIT12, m_mprice4);
	DDX_Text(pDX, IDC_EDIT15, m_mprice5);
	DDX_Check(pDX, IDC_CHECK1, m_chk1);
	DDX_Check(pDX, IDC_CHECK2, m_chk2);
	DDX_Check(pDX, IDC_CHECK3, m_chk3);
	DDX_Check(pDX, IDC_CHECK4, m_chk4);
	DDX_Check(pDX, IDC_CHECK5, m_chk5);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(accept, CDialog)
	//{{AFX_MSG_MAP(accept)
	ON_BN_CLICKED(IDOK3, OnOk3)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDCANCEL2, OnCancel2)
	ON_EN_CHANGE(IDC_EDIT2, OnChangeEdit2)
	ON_EN_CHANGE(IDC_EDIT5, OnChangeEdit5)
	ON_EN_CHANGE(IDC_EDIT8, OnChangeEdit8)
	ON_EN_CHANGE(IDC_EDIT11, OnChangeEdit11)
	ON_EN_CHANGE(IDC_EDIT14, OnChangeEdit14)
	ON_EN_CHANGE(IDC_EDIT16, OnChangeEdit2)
	ON_EN_CHANGE(IDC_EDIT17, OnChangeEdit2)
	ON_EN_CHANGE(IDC_EDIT18, OnChangeEdit5)
	ON_EN_CHANGE(IDC_EDIT19, OnChangeEdit5)
	ON_EN_CHANGE(IDC_EDIT20, OnChangeEdit8)
	ON_EN_CHANGE(IDC_EDIT21, OnChangeEdit8)
	ON_EN_CHANGE(IDC_EDIT22, OnChangeEdit11)
	ON_EN_CHANGE(IDC_EDIT23, OnChangeEdit11)
	ON_EN_CHANGE(IDC_EDIT24, OnChangeEdit14)
	ON_EN_CHANGE(IDC_EDIT25, OnChangeEdit14)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// accept message handlers

void accept::OnOk3() 
{
	// TODO: Add your control notification handler code here
	GetDlgItem(IDC_BUTTON2)->EnableWindow(TRUE);
	fstream readfile;
	int i=0;
	page=0;
	CString buff;
	readfile.open("d:\\Program Files\\type\\type.typ",ios::in);
	buff=readnote(readfile);
	while(!readfile.eof()&&!(buff=="notebegin"))
	{
		buff=readnote(readfile);
		continue;
	}
	if(buff=="notebegin")
	{
		m_mtype1=readnote(readfile);
		m_meach1=readnote(readfile);
		m_mtime1=readnote(readfile);
		m_mtime2=readnote(readfile);
		m_mprice1=readnote(readfile);	
	}
	buff=readnote(readfile);
		while(!readfile.eof()&&!(buff=="notebegin"))
	{
		buff=readnote(readfile);
		continue;
	}
	if(buff=="notebegin")
	{
		m_mtype2=readnote(readfile);
		m_meach2=readnote(readfile);
		m_mtime3=readnote(readfile);
		m_mtime4=readnote(readfile);
		m_mprice2=readnote(readfile);	
	}
	buff=readnote(readfile);
		while(!readfile.eof()&&!(buff=="notebegin"))
	{
		buff=readnote(readfile);
		continue;
	}
	if(buff=="notebegin")
	{
		m_mtype3=readnote(readfile);
		m_meach3=readnote(readfile);
		m_mtime5=readnote(readfile);
		m_mtime6=readnote(readfile);
		m_mprice3=readnote(readfile);	
	}
	buff=readnote(readfile);
		while(!readfile.eof()&&!(buff=="notebegin"))
	{
		buff=readnote(readfile);
		continue;
	}
	if(buff=="notebegin")
	{
		m_mtype4=readnote(readfile);
		m_meach4=readnote(readfile);
		m_mtime7=readnote(readfile);
		m_mtime8=readnote(readfile);
		m_mprice4=readnote(readfile);	
	}
	buff=readnote(readfile);
		while(!readfile.eof()&&!(buff=="notebegin"))
	{
		buff=readnote(readfile);
		continue;
	}
	if(buff=="notebegin")
	{
		m_mtype5=readnote(readfile);
		m_meach5=readnote(readfile);
		m_mtime9=readnote(readfile);
		m_mtime10=readnote(readfile);
		m_mprice5=readnote(readfile);	
	}
	if(readfile.eof())
		GetDlgItem(IDC_BUTTON2)->EnableWindow(FALSE);
	readfile.close();
	UpdateData(FALSE);
}

CString accept::readnote(fstream &files)
{
	char input[81];
	CString buff;
	files.getline(input,81);
	buff+=input;
	return buff;
}

void accept::OnButton2() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	GetDlgItem(IDC_BUTTON1)->EnableWindow(TRUE);
	fstream readfile;
	int i=0;
	page++;
	CString buff,mtype5=m_mtype5;
	readfile.open("d:\\Program Files\\type\\type.typ",ios::in);
	buff=readnote(readfile);
	while(1)
	{
	while(!readfile.eof()&&!(buff=="notebegin"))
	{
		buff=readnote(readfile);
		continue;
	}
	if(!readfile.eof())
	{
		buff=readnote(readfile);
		if(buff==mtype5)
			break;
	}
	if(readfile.eof())
		break;
	}
	while(!readfile.eof()&&!(buff=="notebegin"))
	{
		buff=readnote(readfile);
		continue;
	}
	if(buff=="notebegin")
	{
		clean();
		m_mtype1=readnote(readfile);
		m_meach1=readnote(readfile);
		m_mtime1=readnote(readfile);
		m_mtime2=readnote(readfile);
		m_mprice1=readnote(readfile);	
	}
	buff=readnote(readfile);
		while(!readfile.eof()&&!(buff=="notebegin"))
	{
		buff=readnote(readfile);
		continue;
	}
	if(buff=="notebegin")
	{
		m_mtype2=readnote(readfile);
		m_meach2=readnote(readfile);
		m_mtime3=readnote(readfile);
		m_mtime4=readnote(readfile);
		m_mprice2=readnote(readfile);	
	}
	buff=readnote(readfile);
		while(!readfile.eof()&&!(buff=="notebegin"))
	{
		buff=readnote(readfile);
		continue;
	}
	if(buff=="notebegin")
	{
		m_mtype3=readnote(readfile);
		m_meach3=readnote(readfile);
		m_mtime5=readnote(readfile);
		m_mtime6=readnote(readfile);
		m_mprice3=readnote(readfile);	
	}
	buff=readnote(readfile);
		while(!readfile.eof()&&!(buff=="notebegin"))
	{
		buff=readnote(readfile);
		continue;
	}
	if(buff=="notebegin")
	{
		m_mtype4=readnote(readfile);
		m_meach4=readnote(readfile);
		m_mtime7=readnote(readfile);
		m_mtime8=readnote(readfile);
		m_mprice4=readnote(readfile);	
	}
	buff=readnote(readfile);
		while(!readfile.eof()&&!(buff=="notebegin"))
	{
		buff=readnote(readfile);
		continue;
	}
	if(buff=="notebegin")
	{
		m_mtype5=readnote(readfile);
		m_meach5=readnote(readfile);
		m_mtime9=readnote(readfile);
		m_mtime10=readnote(readfile);
		m_mprice5=readnote(readfile);	
	}
		if(readfile.eof())
		GetDlgItem(IDC_BUTTON2)->EnableWindow(FALSE);
	readfile.close();
		m_chk1=0;
	m_chk2=0;
	m_chk3=0;
	m_chk4=0;
	m_chk5=0;
	UpdateData(FALSE);
}

void accept::clean()
{
		m_mtype1="";
		m_meach1="";
		m_mtime1="";
		m_mtime2="";
		m_mprice1="";
		m_mtype2="";
		m_meach2="";
		m_mtime3="";
		m_mtime4="";
		m_mprice2="";	
		m_mtype3="";
		m_meach3="";
		m_mtime5="";
		m_mtime6="";
		m_mprice3="";
		m_mtype4="";
		m_meach4="";
		m_mtime7="";
		m_mtime8="";
		m_mprice4="";	
		m_mtype5="";
		m_meach5="";
		m_mtime9="";
		m_mtime10="";
		m_mprice5="";	
}

void accept::OnButton1() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	GetDlgItem(IDC_BUTTON2)->EnableWindow(TRUE);
	fstream readfile;
	int i=0;
	CString buff,buffb,mtype1=m_mtype1;
	clean();
	readfile.open("d:\\Program Files\\type\\type.typ",ios::in);
	buff=readnote(readfile);
		while(buff=="notebegin"||buff=="noteend")
			buff=readnote(readfile);
	if(buff==mtype1)
	{
			GetDlgItem(IDC_BUTTON1)->EnableWindow(FALSE);
			return;
	}
		page--;
	while(1)
	{
			i=0;
			buffb=buff;
			while(!readfile.eof()&&i<5)
			{
				buff=readnote(readfile);
				if(buff=="notebegin")
				i++;
			}	
		buff=readnote(readfile);
		if(buff==mtype1||readfile.eof())
			break;
	}
	readfile.close();
	readfile.open("d:\\Program Files\\type\\type.typ",ios::in);
	buff=readnote(readfile);

		while(1)
	{
			i=0;
			buff=readnote(readfile);
			if(buff==buffb||readfile.eof())
			break;
			while(!readfile.eof()&&i<5)
			{
				buff=readnote(readfile);
				if(buff=="notebegin")
				i++;
			}	
		
	}
		m_mtype1=buffb;
		m_meach1=readnote(readfile);
		m_mtime1=readnote(readfile);
		m_mtime2=readnote(readfile);
		m_mprice1=readnote(readfile);	
	buff=readnote(readfile);
		while(!readfile.eof()&&!(buff=="notebegin"))
	{
		buff=readnote(readfile);
		continue;
	}
	if(buff=="notebegin")
	{
		m_mtype2=readnote(readfile);
		m_meach2=readnote(readfile);
		m_mtime3=readnote(readfile);
		m_mtime4=readnote(readfile);
		m_mprice2=readnote(readfile);	
	}
	buff=readnote(readfile);
		while(!readfile.eof()&&!(buff=="notebegin"))
	{
		buff=readnote(readfile);
		continue;
	}
	if(buff=="notebegin")
	{
		m_mtype3=readnote(readfile);
		m_meach3=readnote(readfile);
		m_mtime5=readnote(readfile);
		m_mtime6=readnote(readfile);
		m_mprice3=readnote(readfile);	
	}
	buff=readnote(readfile);
		while(!readfile.eof()&&!(buff=="notebegin"))
	{
		buff=readnote(readfile);
		continue;
	}
	if(buff=="notebegin")
	{
		m_mtype4=readnote(readfile);
		m_meach4=readnote(readfile);
		m_mtime7=readnote(readfile);
		m_mtime8=readnote(readfile);
		m_mprice4=readnote(readfile);	
	}
	buff=readnote(readfile);
		while(!readfile.eof()&&!(buff=="notebegin"))
	{
		buff=readnote(readfile);
		continue;
	}
	if(buff=="notebegin")
	{
		m_mtype5=readnote(readfile);
		m_meach5=readnote(readfile);
		m_mtime9=readnote(readfile);
		m_mtime10=readnote(readfile);
		m_mprice5=readnote(readfile);	
	}
	readfile.close();
		m_chk1=0;
	m_chk2=0;
	m_chk3=0;
	m_chk4=0;

⌨️ 快捷键说明

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