📄 kjw.cpp
字号:
// KJW.cpp : implementation file
//
#include "stdafx.h"
#include "BprConfig.h" //kjw
#include "KJW.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
UINT new_prn_count2; //kjw
BOOLEAN connectResult;
/////////////////////////////////////////////////////////////////////////////
// CKJW dialog
CKJW::CKJW(CWnd* pParent /*=NULL*/)
: CDialog(CKJW::IDD, pParent)
{
//{{AFX_DATA_INIT(CKJW)
m_stredit = _T("");
m_stredit2 = _T("");
//}}AFX_DATA_INIT
}
void CKJW::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CKJW)
DDX_Control(pDX, IDC_BUTTON23, m_order);
DDX_Control(pDX, IDC_CHECK8, m_chkAutoconnect);
DDX_Control(pDX, IDC_CHECK7, m_chkDessert);
DDX_Control(pDX, IDC_CHECK6, m_chkDrink);
DDX_Control(pDX, IDC_CHECK5, m_chkTea);
DDX_Control(pDX, IDC_CHECK4, m_chkWine);
DDX_Control(pDX, IDC_CHECK3, m_chkSoup);
DDX_Control(pDX, IDC_CHECK2, m_chkFish);
DDX_Control(pDX, IDC_CHECK1, m_chkMeat);
DDX_Text(pDX, IDC_EDIT1, m_stredit);
DDX_Text(pDX, IDC_EDIT2, m_stredit2);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CKJW, CDialog)
//{{AFX_MSG_MAP(CKJW)
ON_WM_PAINT()
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON10, OnButton10)
ON_BN_CLICKED(IDC_BUTTON11, OnButton11)
ON_BN_CLICKED(IDC_BUTTON12, OnButton12)
ON_BN_CLICKED(IDC_BUTTON13, OnButton13)
ON_BN_CLICKED(IDC_BUTTON14, OnButton14)
ON_BN_CLICKED(IDC_BUTTON15, OnButton15)
ON_BN_CLICKED(IDC_BUTTON16, OnButton16)
ON_BN_CLICKED(IDC_BUTTON17, OnButton17)
ON_BN_CLICKED(IDC_BUTTON18, OnButton18)
ON_BN_CLICKED(IDC_BUTTON19, OnButton19)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
ON_BN_CLICKED(IDC_BUTTON20, OnButton20)
ON_BN_CLICKED(IDC_BUTTON21, OnButton21)
ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
ON_BN_CLICKED(IDC_BUTTON6, OnButton6)
ON_BN_CLICKED(IDC_BUTTON7, OnButton7)
ON_BN_CLICKED(IDC_BUTTON8, OnButton8)
ON_BN_CLICKED(IDC_BUTTON9, OnButton9)
ON_BN_CLICKED(IDC_BUTTON22, OnButton22)
ON_BN_CLICKED(IDC_BUTTON23, OnButton23)
ON_BN_CLICKED(IDC_CHECK8, OnCheck8)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CKJW message handlers
BOOL CKJW::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
UpdateData(TRUE);
// init variables
m_Meat1 = m_Meat2 = m_Meat3=0; //KJW
m_Fish1 = m_Fish2 = m_Fish3=0;
m_Soup1 = m_Soup2 = m_Soup3=0;
m_Wine1 = m_Wine2 = m_Wine3=0;
m_Tea1 = m_Tea2 = m_Tea3=0;
m_Drink1= m_Drink2= m_Drink3=0;
m_Dessert1= m_Dessert2= m_Dessert3=0;
if(cur_config.AutoConnect == TRUE) // auto connection checked
{
m_chkAutoconnect.SetCheck(TRUE);
m_chkDessert.EnableWindow(FALSE);
m_chkDrink.EnableWindow(FALSE);
m_chkFish.EnableWindow(FALSE);
m_chkMeat.EnableWindow(FALSE);
m_chkSoup.EnableWindow(FALSE);
m_chkTea.EnableWindow(FALSE);
m_chkWine.EnableWindow(FALSE);
m_chkDessert.SetCheck(TRUE);
m_chkDrink.SetCheck(TRUE);
m_chkFish.SetCheck(TRUE);
m_chkMeat.SetCheck(TRUE);
m_chkSoup.SetCheck(TRUE);
m_chkTea.SetCheck(TRUE);
m_chkWine.SetCheck(TRUE);
}
else
{
m_chkAutoconnect.SetCheck(FALSE);
m_chkDessert.EnableWindow(FALSE);
m_chkDrink.EnableWindow(FALSE);
m_chkFish.EnableWindow(FALSE);
m_chkMeat.EnableWindow(FALSE);
m_chkSoup.EnableWindow(FALSE);
m_chkTea.EnableWindow(FALSE);
m_chkWine.EnableWindow(FALSE);
new_prn_count2 = new_prn_count;
if(new_prn_count >= 1){
m_chkMeat.EnableWindow(TRUE);
m_chkMeat.SetCheck(TRUE);
new_prn_count -= 1;
}
if(new_prn_count >= 1){
m_chkFish.EnableWindow(TRUE);
m_chkFish.SetCheck(TRUE);
new_prn_count -= 1;
}
if(new_prn_count >= 1){
m_chkSoup.EnableWindow(TRUE);
m_chkSoup.SetCheck(TRUE);
new_prn_count -= 1;
}
if(new_prn_count >= 1){
m_chkWine.EnableWindow(TRUE);
m_chkWine.SetCheck(TRUE);
new_prn_count -= 1;
}
if(new_prn_count >= 1){
m_chkTea.EnableWindow(TRUE);
m_chkTea.SetCheck(TRUE);
new_prn_count -= 1;
}
if(new_prn_count >= 1){
m_chkDrink.EnableWindow(TRUE);
m_chkDrink.SetCheck(TRUE);
new_prn_count -= 1;
}
if(new_prn_count >= 1){
m_chkDessert.EnableWindow(TRUE);
m_chkDessert.SetCheck(TRUE);
new_prn_count -= 1;
}
new_prn_count = new_prn_count2;
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CKJW::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
// Do not call CDialog::OnPaint() for painting messages
}
void CKJW::OnButton1()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_Meat1 = m_Meat1 + 1;
m_stredit = "";
strtemp = "";
strtemp1 = "";
if (m_Meat1 !=0) {strtemp.Format(" Beef : %2.0f %5.2f",m_Meat1,m_Meat1 * 15); strtemp1 += strtemp + "\r\n";}
if (m_Meat2 !=0) {strtemp.Format(" Pork : %2.0f %5.2f",m_Meat2,m_Meat2 * 7); strtemp1 += strtemp + "\r\n";}
if (m_Meat3 !=0) {strtemp.Format(" Mutton : %2.0f %5.2f",m_Meat3,m_Meat3 * 11); strtemp1 += strtemp + "\r\n";}
m_stredit += strtemp1;
m_stredit += strtemp2;
m_stredit += strtemp3;
m_stredit += strtemp4;
m_stredit += strtemp5;
m_stredit += strtemp6;
m_stredit += strtemp7;
m_Total = m_Meat1 * 15 + m_Meat2 * 7 + m_Meat3 * 11 +
m_Fish1 * 14 + m_Fish2 * 20 + m_Fish3 * 5 +
m_Soup1 * 1 + m_Soup2 * 1 + m_Soup3 * 1 +
m_Wine1 * 100 + m_Wine2 * 200 + m_Wine3 * 170 +
m_Tea1 * 2 + m_Tea2 * 2 + m_Tea3 * 2 +
m_Drink1 * 2 + m_Drink2 * 3 + m_Drink3 * 3 +
m_Dessert1 * 2 + m_Dessert2 * 2 + m_Dessert3 * 2;
strtemp8.Format("%6.2f",m_Total);
m_stredit2 = strtemp8;
UpdateData(FALSE);
}
void CKJW::OnButton2()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_Meat2 = m_Meat2 + 1;
m_stredit = "";
strtemp = "";
strtemp1 = "";
if (m_Meat1 !=0) {strtemp.Format(" Beef : %2.0f %5.2f",m_Meat1,m_Meat1 * 15); strtemp1 += strtemp + "\r\n";}
if (m_Meat2 !=0) {strtemp.Format(" Pork : %2.0f %5.2f",m_Meat2,m_Meat2 * 7); strtemp1 += strtemp + "\r\n";}
if (m_Meat3 !=0) {strtemp.Format(" Mutton : %2.0f %5.2f",m_Meat3,m_Meat3 * 11); strtemp1 += strtemp + "\r\n";}
m_stredit += strtemp1;
m_stredit += strtemp2;
m_stredit += strtemp3;
m_stredit += strtemp4;
m_stredit += strtemp5;
m_stredit += strtemp6;
m_stredit += strtemp7;
m_Total = m_Meat1 * 15 + m_Meat2 * 7 + m_Meat3 * 11 +
m_Fish1 * 14 + m_Fish2 * 20 + m_Fish3 * 5 +
m_Soup1 * 1 + m_Soup2 * 1 + m_Soup3 * 1 +
m_Wine1 * 100 + m_Wine2 * 200 + m_Wine3 * 170 +
m_Tea1 * 2 + m_Tea2 * 2 + m_Tea3 * 2 +
m_Drink1 * 2 + m_Drink2 * 3 + m_Drink3 * 3 +
m_Dessert1 * 2 + m_Dessert2 * 2 + m_Dessert3 * 2;
strtemp8.Format("%6.2f",m_Total);
m_stredit2 = strtemp8;
UpdateData(FALSE);
}
void CKJW::OnButton3()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_Meat3 = m_Meat3 + 1;
m_stredit = "";
strtemp = "";
strtemp1 = "";
if (m_Meat1 !=0) {strtemp.Format(" Beef : %2.0f %5.2f",m_Meat1,m_Meat1 * 15); strtemp1 += strtemp + "\r\n";}
if (m_Meat2 !=0) {strtemp.Format(" Pork : %2.0f %5.2f",m_Meat2,m_Meat2 * 7); strtemp1 += strtemp + "\r\n";}
if (m_Meat3 !=0) {strtemp.Format(" Mutton : %2.0f %5.2f",m_Meat3,m_Meat3 * 11); strtemp1 += strtemp + "\r\n";}
m_stredit += strtemp1;
m_stredit += strtemp2;
m_stredit += strtemp3;
m_stredit += strtemp4;
m_stredit += strtemp5;
m_stredit += strtemp6;
m_stredit += strtemp7;
m_Total = m_Meat1 * 15 + m_Meat2 * 7 + m_Meat3 * 11 +
m_Fish1 * 14 + m_Fish2 * 20 + m_Fish3 * 5 +
m_Soup1 * 1 + m_Soup2 * 1 + m_Soup3 * 1 +
m_Wine1 * 100 + m_Wine2 * 200 + m_Wine3 * 170 +
m_Tea1 * 2 + m_Tea2 * 2 + m_Tea3 * 2 +
m_Drink1 * 2 + m_Drink2 * 3 + m_Drink3 * 3 +
m_Dessert1 * 2 + m_Dessert2 * 2 + m_Dessert3 * 2;
strtemp8.Format("%6.2f",m_Total);
m_stredit2 = strtemp8;
UpdateData(FALSE);
}
void CKJW::OnButton4()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_Fish1 = m_Fish1 + 1;
m_stredit = "";
strtemp = "";
strtemp2 = "";
if (m_Fish1 !=0) {strtemp.Format(" Salmon : %2.0f %5.2f",m_Fish1,m_Fish1 * 14); strtemp2 += strtemp + "\r\n";}
if (m_Fish2 !=0) {strtemp.Format(" Bluefin tuna : %2.0f %5.2f",m_Fish2,m_Fish2 * 20); strtemp2 += strtemp + "\r\n";}
if (m_Fish3 !=0) {strtemp.Format(" Cuttlefish : %2.0f %5.2f",m_Fish3,m_Fish3 * 5); strtemp2 += strtemp + "\r\n";}
m_stredit += strtemp1;
m_stredit += strtemp2;
m_stredit += strtemp3;
m_stredit += strtemp4;
m_stredit += strtemp5;
m_stredit += strtemp6;
m_stredit += strtemp7;
m_Total = m_Meat1 * 15 + m_Meat2 * 7 + m_Meat3 * 11 +
m_Fish1 * 14 + m_Fish2 * 20 + m_Fish3 * 5 +
m_Soup1 * 1 + m_Soup2 * 1 + m_Soup3 * 1 +
m_Wine1 * 100 + m_Wine2 * 200 + m_Wine3 * 170 +
m_Tea1 * 2 + m_Tea2 * 2 + m_Tea3 * 2 +
m_Drink1 * 2 + m_Drink2 * 3 + m_Drink3 * 3 +
m_Dessert1 * 2 + m_Dessert2 * 2 + m_Dessert3 * 2;
strtemp8.Format("%6.2f",m_Total);
m_stredit2 = strtemp8;
UpdateData(FALSE);
}
void CKJW::OnButton5()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_Fish2 = m_Fish2 + 1;
m_stredit = "";
strtemp = "";
strtemp2 = "";
if (m_Fish1 !=0) {strtemp.Format(" Salmon : %2.0f %5.2f",m_Fish1,m_Fish1 * 14); strtemp2 += strtemp + "\r\n";}
if (m_Fish2 !=0) {strtemp.Format(" Bluefin tuna : %2.0f %5.2f",m_Fish2,m_Fish2 * 20); strtemp2 += strtemp + "\r\n";}
if (m_Fish3 !=0) {strtemp.Format(" Cuttlefish : %2.0f %5.2f",m_Fish3,m_Fish3 * 5); strtemp2 += strtemp + "\r\n";}
m_stredit += strtemp1;
m_stredit += strtemp2;
m_stredit += strtemp3;
m_stredit += strtemp4;
m_stredit += strtemp5;
m_stredit += strtemp6;
m_stredit += strtemp7;
m_Total = m_Meat1 * 15 + m_Meat2 * 7 + m_Meat3 * 11 +
m_Fish1 * 14 + m_Fish2 * 20 + m_Fish3 * 5 +
m_Soup1 * 1 + m_Soup2 * 1 + m_Soup3 * 1 +
m_Wine1 * 100 + m_Wine2 * 200 + m_Wine3 * 170 +
m_Tea1 * 2 + m_Tea2 * 2 + m_Tea3 * 2 +
m_Drink1 * 2 + m_Drink2 * 3 + m_Drink3 * 3 +
m_Dessert1 * 2 + m_Dessert2 * 2 + m_Dessert3 * 2;
strtemp8.Format("%6.2f",m_Total);
m_stredit2 = strtemp8;
UpdateData(FALSE);
}
void CKJW::OnButton6()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_Fish3 = m_Fish3 + 1;
m_stredit = "";
strtemp = "";
strtemp2 = "";
if (m_Fish1 !=0) {strtemp.Format(" Salmon : %2.0f %5.2f",m_Fish1,m_Fish1 * 14); strtemp2 += strtemp + "\r\n";}
if (m_Fish2 !=0) {strtemp.Format(" Bluefin tuna : %2.0f %5.2f",m_Fish2,m_Fish2 * 20); strtemp2 += strtemp + "\r\n";}
if (m_Fish3 !=0) {strtemp.Format(" Cuttlefish : %2.0f %5.2f",m_Fish3,m_Fish3 * 5); strtemp2 += strtemp + "\r\n";}
m_stredit += strtemp1;
m_stredit += strtemp2;
m_stredit += strtemp3;
m_stredit += strtemp4;
m_stredit += strtemp5;
m_stredit += strtemp6;
m_stredit += strtemp7;
m_Total = m_Meat1 * 15 + m_Meat2 * 7 + m_Meat3 * 11 +
m_Fish1 * 14 + m_Fish2 * 20 + m_Fish3 * 5 +
m_Soup1 * 1 + m_Soup2 * 1 + m_Soup3 * 1 +
m_Wine1 * 100 + m_Wine2 * 200 + m_Wine3 * 170 +
m_Tea1 * 2 + m_Tea2 * 2 + m_Tea3 * 2 +
m_Drink1 * 2 + m_Drink2 * 3 + m_Drink3 * 3 +
m_Dessert1 * 2 + m_Dessert2 * 2 + m_Dessert3 * 2;
strtemp8.Format("%6.2f",m_Total);
m_stredit2 = strtemp8;
UpdateData(FALSE);
}
void CKJW::OnButton7()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_Soup1 = m_Soup1 + 1;
m_stredit = "";
strtemp = "";
strtemp3 = "";
if (m_Soup1 !=0) {strtemp.Format(" Vegetables : %2.0f %5.2f",m_Soup1,m_Soup1 * 1); strtemp3 += strtemp + "\r\n";}
if (m_Soup2 !=0) {strtemp.Format(" Tomato : %2.0f %5.2f",m_Soup2,m_Soup2 * 1); strtemp3 += strtemp + "\r\n";}
if (m_Soup3 !=0) {strtemp.Format(" Onion : %2.0f %5.2f",m_Soup3,m_Soup3 * 1); strtemp3 += strtemp + "\r\n";}
m_stredit += strtemp1;
m_stredit += strtemp2;
m_stredit += strtemp3;
m_stredit += strtemp4;
m_stredit += strtemp5;
m_stredit += strtemp6;
m_stredit += strtemp7;
m_Total = m_Meat1 * 15 + m_Meat2 * 7 + m_Meat3 * 11 +
m_Fish1 * 14 + m_Fish2 * 20 + m_Fish3 * 5 +
m_Soup1 * 1 + m_Soup2 * 1 + m_Soup3 * 1 +
m_Wine1 * 100 + m_Wine2 * 200 + m_Wine3 * 170 +
m_Tea1 * 2 + m_Tea2 * 2 + m_Tea3 * 2 +
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -