-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathBoard.cpp
84 lines (77 loc) · 2.04 KB
/
Board.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include "Board.h"
#include <ctime>
double CBoard::m_dDailySales = 0;
unsigned short CBoard::m_unBoardCount =0;
double CBoard::m_dDrinkSales = 0;
double CBoard::m_dEntreeSales = 0;
double CBoard::m_dSnackSales = 0;
CBoard::CBoard(const unsigned short & unNumber/*=0*/):m_unNumber(unNumber){
this->m_bFlags = 0;
this->SetConsume(0);
this->m_uManCount =0;
this->pNextBoard = NULL;
this->m_pBoardMenu = NULL;
this->m_lStartTime =0; //time(&m_lStartTime);
this->m_unBoardCount++;
}
bool CBoard::SetManCount(const unsigned & uManCount){
if (uManCount>20){
return false;
}
else{
this->m_uManCount = uManCount;
return true;
}
}
void CBoard::SetStartTime(){
time_t rtime;
time(&rtime);
this->m_lStartTime = rtime;
}
char * CBoard::GetStartTime()const{
struct tm * timeTmp = localtime(&m_lStartTime);
static char buffer[255]={0};
if(true == m_bFlags)
sprintf(buffer,"%02d:%02d:%02d",timeTmp->tm_hour,timeTmp->tm_min,timeTmp->tm_sec);
else
sprintf(buffer,"%02d:%02d:%02d",0,0,0);
return buffer;
}
void CBoard::SetConsume(const double & dConsume){
this->m_dConsume = dConsume;
}
void CBoard::AddConsume(const double & dMoney){
this->m_dConsume += dMoney;
}
void CBoard::RedConsume(const double & dMoney){
this->m_dConsume -= dMoney;
}
double CBoard::GetConsume()const{
return this->m_dConsume;
}
void CBoard::Clean(){
this->m_bFlags = 0;
this->m_dDailySales += GetConsume();
this->SetConsume(0);
this->m_uManCount =0;
DelBoardMenuAll(this->m_pBoardMenu);
this->m_pBoardMenu = NULL;
this->m_lStartTime =0; //time(&m_lStartTime);
}
void CBoard::DelBoardMenuAll(CBoardMenu * current){
CBoardMenu * pNext;
pNext = current->m_pNextBoardFood;
if(NULL != pNext)
DelBoardMenuAll(pNext);
//添加到各类型菜肴消费记录中
if(SNACK == current->m_Food.m_uFoodType){
this->m_dSnackSales += current->m_dMoney;
}
else if(DRINK == current->m_Food.m_uFoodType){
this->m_dDrinkSales += current->m_dMoney;
}
else{
this->m_dEntreeSales += current->m_dMoney;
}
delete current;
}