java酒店管理毕业设计源代码

更新时间:2024-06-11 11:34:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

悠悠同学网www.uuclass.com

酒店管理系统C++源代码----仅供参考学习,切勿用于任何商业用途

# include # include # include # include # include # include # include # include # include

//*****************************************************************

//*****************************************************************

// CLASS NAME : MENU

// DETAILS

一 需求分析 (1)顾客

1 查看房间信息(空房号,等级,床位数) 2 入住(房号,姓名,身份证) 3 退房(结账) (2) 管理员

1 查看房间信息(空房号,房间状态,等级,床位数) 2 入住(房号,改变房间状态,登记人) 3 退房(结账,登记人) 二 实体 1 房间:: 号码 c_room 等级 c_dank 床数 c_nbed 状态 c_statds 价格 c_rate

2 顾客:: 身份证 id 人数 m 要求等级 r 入住房间 room

//这个时候不知道是设计类还是功能模块

悠悠同学网www.uuclass.com

三 程序流程

1. 管理员登陆 2. 选择功能

1. 登记入住 void check_in(); 2. 退房 void check_out(); 3. 定房 void book(); 4. 订房

3. 管理员退出 四 功能模块 1 顾客模块 1)登记入住

1 输入人数m和房间等级要求r 2 按r搜索空房 再按m搜索 3 如果有符合条件的显示 4 如果没有则给出优化方案 5 选择房间

6 给出每个人每天要付的费用dayrent 7 登记个人信息 8 改变房间状态 2)退房

1 计算每人应付费用和总共费用 2 改变房间状态 3)订房

1 输入人数m 房间等级要求r 2 按r搜索空房 再按m搜索 3 如果有符合条件的显示 4 如果没有则给出优化方案 5 选择房间 2 管理员模块 1)登录系统

1 输入用户名和密码 2 检验密码

3 通过/重新输入 2)登记入住(同上) 3)退房(同上) 4)订房(同上) 5)房间信息管理

1 显示空房及对应的等级空房 2 显示已订房号码及开始入住日期

悠悠同学网www.uuclass.com

: IT CONTROLS OVER ALL THE FUNCTIONS //*****************************************************************

class menu

{ public :

void main_menu(void); void startup(void); void box(void);

void line_hor(int, int, int, char); void line_ver(int, int, int, char);

};

//*****************************************************************

// CLASS NAME : HKEEP

// DETAILS : IT CONTROLS OVER ALL FUNCTIONS

// RELATED TO HKEEP //*****************************************************************

class hkeep

{ public :

hkeep(void); ~hkeep(void); void add(void); void modify(void); void deletion(void); void display_list(void);

private :

void display_record(int); int found_record(int); void delete_record(int); void modify_record(int);

int recordno(int); int last_code(void);

int code;

char name[20],roomno[10],order[99];

};

//*****************************************************************

// CLASS NAME : MENU // FUNCTION NAME : LINE_HOR

// DETAILS : IT ACCEPTS THE ROWS AND COLUMNS AND

// DRAWS HORIZONTAL LINES

悠悠同学网www.uuclass.com

//*****************************************************************

void menu :: line_hor(int column1, int column2, int row, char c)

{

for(column1;column1<=column2;column1++)

{

//gotoxy(column1,row);

cout<

} }

//*****************************************************************

// CLASS NAME : MENU // FUNCTION NAME : LINE_VER

// DETAILS : IT ACCEPTS ROWS AND COLUMNS AND

// DRAWS THE VERTICAL LINE //*****************************************************************

void menu :: line_ver(int row1, int row2, int column, char c)

{

for(row1;row1<=row2;row1++)

{

gotoxy(column, row1);

cout << c;

} }

//*****************************************************************

// CLASS NAME : MENU // FUNCTION NAME : STARTUP

// DETAILS : IT CREATES THE STARTING SCREEN //*****************************************************************

void menu :: startup(void)

{ // clrscr(); int i,j,s;

char a[] = \ char b[] = \M*A*N*A*G*E*M*E*N*T\

for(i=0;i<=79;i++) line_ver(1,25,i,179); // gotoxy(1,11);clreol();

悠悠同学网www.uuclass.com gotoxy(1,13);clreol();

j = 63; s = 100; for(i=1;i<=43;i++)

{ sound(s); s = s+20; delay(50); gotoxy(1,12); clreol(); gotoxy(i,12); cout< } // nosound(); delay(100); char ch = 219;

s = 500; for(i=0;i<=79;i++)

{ sound(s); s =s+10; gotoxy(i,10); cout<

} nosound(); delay(200); ch = 219; s = 1290; for(i = 79; i>=1;i--)

{ sound(s); s = s- 10; gotoxy(i,14); cout<

} nosound(); delay(1000);

悠悠同学网www.uuclass.com

clrscr(); cout<<\made by :\ char jklf[]=\ cout<<\ for(int u=0;u<7;u++) { cout<

{ char ch; while (1) { clrscr(); textmode(C40); clrscr(); box(); gotoxy(12,5); cout<<\Keeping \ gotoxy(12,6); cout<<\ gotoxy(12,10); cout<<\1 : Store Customer Order\ gotoxy(12,11); cout<<\2 : Display customer Order\ gotoxy(12,12); cout<<\3 : Delete Order\ gotoxy(12,13); cout<<\4 : Modify Order\ gotoxy(12,14); cout<<\0 : Quit\ gotoxy(11,18); cout<<\Enter your choice\ ch = getch(); textmode(C80); clrscr(); if ( ch == '1') { hkeep d; d.add(); } else if ( ch == '2') { hkeep d; d.display_list(); } else if ( ch == '3') { hkeep d; d.deletion(); } 悠悠同学网www.uuclass.com

else if( ch == '4') { hkeep d; d.modify(); } else if(ch == '0') break; } } //***************************************************************** // CLASS NAME :HKEEP // FUNCTION NAME : HKEEP (CONSTRUCTOR) // DETAILS : IT IS A CONSTRUCTOR FUNCTION, GIVING // DEFAULT VALUES //***************************************************************** hkeep :: hkeep (void) { code = 0; name[0] = '\\0'; roomno[0] = '\\0'; order[0] = '\\0'; } //***************************************************************** // CLASS NAME : HKEEP // FUNCTION NAME : ~HKEEP (DESTRUCTOR) // DETAILS : IT IS A DESTRUCTOR FUNCTION //***************************************************************** hkeep :: ~hkeep (void) { } //***************************************************************** // CLASS NAME : HKEEP // FUNCTION NAME : DISPLAY_LIST // DETAILS : IT DISPLAYS LIST OF THE PERSON'S // RECORDS //***************************************************************** void hkeep:: display_list(void) 悠悠同学网www.uuclass.com

{ clrscr(); menu m; char *t_name, *t1_name = NULL; gotoxy(3,5); cout<<\Enter the character(s) for selective list \ gotoxy(3,6); cout<<\or press for whole list or '0' to exit : \ gets(t_name); if (t_name[0] == '0') return; int len = strlen(t_name); clrscr(); fstream file; file.open(\ios :: binary | ios :: in); file.seekg(0, ios :: beg); int row = 4; int found = 0; int pageno = 1; int flag = 1; char ch; gotoxy(1,2); cout<<\Order Serial No.\ m.line_hor(1,79,3,196); m.line_hor(1,79,24,196); while (file.read((char *)this , sizeof (hkeep))) { flag = 1; for(int i=0;i to exit or any key to continue... \ ch = getch(); if(ch == 27) return ; clrscr(); gotoxy(1,2); cout<<\Order Serial No.\ m.line_hor(1,79,3,196); m.line_hor(1,79,24,196); } else row = row + 2; } } if ( !found ) { sound(500); delay(100); nosound(); gotoxy(1,5); cout<<\not found\; } if (flag) { gotoxy(66,1); cout<<\age No. : \ gotoxy(1,25); cout<<\ress any key to continue...\ getch(); } file.close(); } //***************************************************************** // CLASS NAME : HKEEP

悠悠同学网www.uuclass.com

// FUNCTION NAME : DISPLAY_RECORD // DETAILS : IT DISPLAYS SINGLE RECORD FOR THE // GIVEN RECORD //***************************************************************** void hkeep :: display_record(int t_code) { fstream file; file.open(\:: binary | ios::in); file.seekg(0,ios::beg); while( file.read((char *) this, sizeof(hkeep))) { if(t_code == code) { gotoxy(3,3); cout<<\serial No.\ gotoxy(3,5); cout<<\ : \ puts(name); gotoxy(3,6); cout<<\No. : \ gotoxy(3,7); gotoxy(3,7); cout<<\ : \ puts(order); break; } } file.close(); } //***************************************************************** // CLASS NAME : HKEEP // FUNCTION NAME : LAST_CODE // DETAILS : IT COUNTS THE RECORD IN THE FILE AND // RETURNS THE LAST CODE //***************************************************************** int hkeep :: last_code() { fstream file; file.open(\:: binary | ios::in); file.seekg(0,ios::beg); int t=0; while(file.read((char*) this, sizeof(hkeep))) 悠悠同学网www.uuclass.com

t++; file.close(); return t; } //***************************************************************** // CLASS NAME : HKEEP // FUNCTION NAME : FOUND_RECORD // DETAILS : IT RETURNS THAT RECORD IS FOUND FOR THE // GIVEN CODE NO. OR NOT //***************************************************************** int hkeep :: found_record(int t_code) { fstream file; file.open(\ios :: binary | ios :: in ); file.seekg(0,ios::beg); int found = 0; while(file.read((char *) this, sizeof(hkeep))) { if(t_code == code) { found++; break; } } file.close(); return found; } //***************************************************************** // CLASS NAME : HKEEP // FUNCTION NAME : ADD // DETAILS : IT ADDS THE RECORD IN THE HKEEP'S FILE //***************************************************************** void hkeep :: add(void) { menu m; int valid, saved=0 ; int t_code; t_code = last_code(); t_code++; if(t_code == 1) 悠悠同学网www.uuclass.com

{ code = t_code; strcpy(name,\ strcpy(roomno,\ strcpy(order,\ fstream file; file.open(\ios :: binary | ios :: app); file.write((char *)this, sizeof(hkeep)); file.close(); delete_record(t_code); } char ch; do { clrscr(); gotoxy(3,3); cout<<\serial No.\ gotoxy(3,5); cout<<\ : \ gotoxy(3,6); cout<<\no. : \ gotoxy(3,7); gotoxy(3,7); cout<<\ : \ m.line_hor(1,79,23,196); do { valid = 1; gotoxy(1,25);clreol(); gotoxy(3,25); cout<<\THE NAME OF THE PERSON\ gotoxy(13,5); gets(name); strupr(name); if(strlen(name) > 19 || strlen(name) == 0) { valid = 0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<\SHOULD NOT BE BLANK OR GREATER THAN 19 \ gotoxy(1,25); 悠悠同学网www.uuclass.com

cout<<\ress any key to continue ... \ getch(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(13,5); clreol(); } }while(!valid); do { valid = 1; gotoxy(1,25); clreol(); gotoxy(3,25); cout<<\THE ROOM NO. OF THE CUSTOMER, FOR BLANK\ gotoxy(13,6); gets(roomno); }while(!valid); if(strlen(roomno) == 0) strcpy(roomno,\ do { valid = 1; gotoxy(1,25); clreol(); gotoxy(3,25); cout<<\THE ORDER OF THE CUSTOMER\ gotoxy(13,7); gets(order); if(strlen(order) >99 || strlen(order) == 0) { valid = 0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<\NOT BE BLANK OF GREATER THAN 99\ gotoxy(1,25); cout<<\any key to continue... \ getch(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(13,10); clreol(); 悠悠同学网www.uuclass.com

} }while(!valid); gotoxy(1,25); clreol(); gotoxy(1,23); clreol(); gotoxy(1,13); cout<<\you want to save the record (y/n) : \ do { valid = 1; gotoxy(41,13); ch = getche(); ch = toupper(ch); if(ch != 'Y' && ch != 'N') { valid = 0; sound(500); delay(100); nosound(); gotoxy(41,13); clreol(); } }while( !valid); if (ch == 'Y') { saved =1 ; code = t_code; fstream file; file.open(\ios :: binary | ios:: app); file.write((char *) this, sizeof(hkeep)); file.close(); t_code++; } gotoxy(1,14); cout<<\you want to add more records (y/n) : \ do { valid = 1; gotoxy(41,14); ch = getche(); ch = toupper(ch); if(ch != 'Y' && ch != 'N') { valid = 0; sound(500); delay(100);

悠悠同学网www.uuclass.com nosound(); gotoxy(41,14); clreol(); } }while(!valid); }while(ch == 'Y'); } //***************************************************************** // CLASS NAME : HKEEP // FUNCTION NAME : DELETE_RECORD // DETAILS : IT DELETES THE RECORD IN THE HKEEP'S FILE // FOR THE GIVEN CODE //***************************************************************** void hkeep :: delete_record(int t_code) { fstream file; file.open(\:: binary | ios :: in); fstream temp; temp.open(\:: binary | ios: file.seekg(0,ios::beg); while(file.read((char *) this, sizeof(hkeep))) { if(code != t_code) temp.write((char *) this, sizeof(hkeep)); } file.close(); temp.close(); file.open(\:: binary | ios: t_code = 1; while(temp.read((char *)this,sizeof(hkeep))) { code = t_code; file.write((char *)this, sizeof(hkeep)); t_code++; } file.close(); temp.close(); } ut); ut); temp.open(\:: binary | ios::in); 悠悠同学网www.uuclass.com

//***************************************************************** // CLASS NAME : HKEEP // FUNCTION NAME : DELETION // DETAILS : IT GIVES THE CODE NO. TO DELETE THE // RECORD IN HKEEP'S FILE //***************************************************************** void hkeep :: deletion(void) { menu m; clrscr(); int valid; int t_code = 0, t; char t1_code[5], t2_code[5]; char ch; gotoxy(3,3); cout<<\Enter Order Serial No. of the record to be deleted \ gotoxy(3,4); cout<<\or Press to see from the list or '0' to exit : \ gets(t1_code); t = atoi(t1_code); t_code = t; if(t1_code[0] == '0') return; if(t1_code[0] != '\\0') { clrscr(); if(!found_record(t_code)) { sound(500); delay(100); nosound(); gotoxy(3,15); cout<<\not found\ m.line_hor(1,79,24,196); gotoxy(1,25); cout<<\any key to continue... \ getch(); return; } display_record(t_code); gotoxy(3,12); cout<<\you want to delete this record (y/n) : \悠悠同学网www.uuclass.com

do { valid = 1; gotoxy(45,12); ch = getch(); ch = toupper(ch); if (ch != 'Y' && ch != 'N') { valid = 0; sound(500); delay(100); nosound(); gotoxy(45,12); clreol(); } }while(! valid); if (ch == 'N') return; gotoxy(1,25); cout<<\ delete_record(t_code); clrscr(); gotoxy(1,14); cout<<\Deleted\\n\ m.line_hor(1,79,24,196); gotoxy(1,25); cout<<\any key to continue...\ getch(); return; } display_list(); gotoxy(1,25); clreol(); gotoxy(3,25); cout<<\Order Serial No. of the record or to exit \;gets(t2_code); t = atoi(t2_code); t_code = t; if(t2_code[0] == '\\0') return; clrscr(); if(! found_record(t_code)) { sound(500); delay(100); nosound(); gotoxy(3,15); 悠悠同学网www.uuclass.com cout<<\not found\ m.line_hor(1,79,24,196); gotoxy(1,25); cout<<\any key to continue...\ getch(); return; } display_record(t_code); gotoxy(3,12); cout<<\you want to delete this Record (y/n) : \ do { valid = 1; gotoxy(45,12); ch = getche(); ch = toupper(ch); if(ch != 'Y' && ch != 'N') { valid = 0; sound(500); delay(100); nosound(); gotoxy(45,12); clreol(); } }while(!valid); if(ch == 'N') return; gotoxy(1,25); cout<<\ delete_record(t_code); clrscr(); gotoxy(1,14); cout<<\Deleted\\n\ m.line_hor(1,79,24,196); gotoxy(1,25); cout<<\any key to continue...\ getch(); } //***************************************************************** // CLASS NAME : HKEEP // FUNCTION NAME : MODIFY_RECORD // DETAILS : IT MODIFIES THE RECORD IN THE HKEEP'S // FILE FOR THE GIVEN CODE 悠悠同学网www.uuclass.com

//***************************************************************** void hkeep :: modify_record(int t_code) { menu m; int valid,modified = 0; char ch; m.line_hor(1,79,12,196); gotoxy(3,14); cout<<\Serial No.\ gotoxy(3,16); cout<<\ : \ gotoxy(3,17); cout<<\No. : \ gotoxy(3,18); cout<<\ : \ m.line_hor(1,79,23,196); gotoxy(13,16); cout<<\(y/n) : \ do { valid =1; gotoxy(28,16); ch = getche(); ch = toupper(ch); if (ch != 'Y' && ch != 'N') { valid = 0; sound(500); delay(100); nosound(); gotoxy(45,12); clreol(); } } while(!valid); valid = 0; while(!valid && ch == 'Y') { modified = 1; valid = 1; gotoxy(13,16);clreol(); gotoxy(3,25); cout<<\THE NAME OF THE PERSON\ gotoxy(13,16);

悠悠同学网www.uuclass.com

gets(name); strupr(name); if(strlen(name) > 19 || strlen(name) == 0) { valid = 0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<\SHOULD NOT BE BLANK OR GREATER THAN 19 \ gotoxy(1,25); cout<<\any key to continue ... \ getch(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(13,16); clreol(); } } gotoxy(1,25); clreol(); gotoxy(13,17); cout<<\(y/n) : \ do { valid = 1; gotoxy(28,17); ch = getche(); ch = toupper(ch); if(ch != 'Y' && ch != 'N') { valid = 0; sound(500); delay(100); nosound(); gotoxy(28,17); clreol(); } }while(!valid); valid = 0; while ( !valid && ch == 'Y') { modified = 1; valid = 1; gotoxy(13,17); clreol(); gotoxy(3,25); 悠悠同学网www.uuclass.com

cout<<\THE ROOM NO. OF THE CUSTOMER, FOR BLANK\ gotoxy(13,17); gets(roomno); if (strlen(roomno) == 0) strcpy(roomno,\ } gotoxy(1,25); clreol(); gotoxy(13,18); cout<<\(y/n) : \ do { valid = 1; gotoxy(28,18); ch = getche(); ch = toupper(ch); if(ch != 'Y' && ch != 'N') { valid = 0; sound(500); delay(100); nosound(); gotoxy(28,18); clreol(); } }while(!valid); valid = 0; while(!valid && ch == 'Y') { modified = 1; valid = 1; gotoxy(13,21); clreol(); gotoxy(3,21); cout<<\THE ORDER OF THE CUSTOMER, FOR BLANK\ gotoxy(13,18);clreol(); gets(order); if(strlen(order) >99 || strlen(order) == 0) { valid = 0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<\NOT BE BLANK OF GREATER THAN 99\悠悠同学网www.uuclass.com gotoxy(1,25); cout<<\any key to continue... \ getch(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(13,21); clreol(); } } if(! modified) return; gotoxy(1,25); clreol(); cout<<\you want to save the record (y/n) : \ do { valid = 1; gotoxy(41,23); ch = getche(); ch = toupper(ch); if(ch != 'Y' && ch != 'N') { valid = 0; sound(500); delay(100); nosound(); gotoxy(41,23); clreol(); } }while( !valid); if (ch == 'N') return; fstream file; file.open(\ios :: binary | ios: int recno; recno = t_code; int location; location = (recno -1) * sizeof(hkeep); file.seekp(location); file.write((char*) this, sizeof(hkeep)); file.close(); clrscr(); sound(500); delay(100); nosound(); gotoxy(1,14); ut | ios::ate); 悠悠同学网www.uuclass.com cout<<\modified \ m.line_hor(1,79,24,196); gotoxy(1,25); cout<<\any key to continue...\ getch(); } //***************************************************************** // CLASS NAME : HKEEP // FUNTION NAME : MODIFY // DETAILS : IT TAKES THE ORDER SERIAL NO. TO MODIFY THE // RECORD IN SYSTEM'S FILE //***************************************************************** void hkeep :: modify(void) { menu m; clrscr(); int valid; int t_code = 0,t; char t1_code[5], t2_code[5]; char ch; gotoxy(3,3); cout<<\Enter the Order Serial No. of the record to be modified : \ gotoxy(3,4); cout<<\or Press to see form the list or '0' to exit : \ gets(t1_code); t = atoi(t1_code); t_code = t; if(t1_code[0] == '0') return; if(t1_code[0] != '\\0') { clrscr(); if(!found_record(t_code)) { sound(500); delay(100); nosound(); gotoxy(3,15); cout<<\not found\ m.line_hor(1,79,24,196); gotoxy(1,25); cout<<\any key to continue ... \ getch(); 悠悠同学网www.uuclass.com

return; } display_record(t_code); gotoxy(3,12); cout<<\you want to modify this record (y/n) : \ do { valid =1 ; gotoxy(45,12); ch = getche(); ch = toupper(ch); if(ch != 'Y' && ch != 'N') { valid = 0; sound(500); delay(100); nosound(); gotoxy(45,12); clreol(); } }while(! valid); if( ch == 'N') return; modify_record(t_code); return; } display_list(); gotoxy(1,25); clreol(); gotoxy(3,25); cout<<\Order Serial No. of the record or to exit : \ gets(t2_code); t = atoi(t2_code); t_code = t; if(t2_code[0] == '0') return; if(t2_code[0] != '\\0') clrscr(); if(!found_record(t_code)) { sound(500); delay(100); nosound(); gotoxy(3,15); cout<<\not found\

悠悠同学网www.uuclass.com m.line_hor(1,79,24,196); gotoxy(1,25); cout<<\any key to continue ... \ getch(); return; } display_record(t_code); gotoxy(3,12); cout<<\you want to modify this record (y/n) : \ do { valid =1 ; gotoxy(45,12); ch = getche(); ch = toupper(ch); if(ch != 'Y' && ch != 'N') { valid = 0; sound(500); delay(100); nosound(); gotoxy(45,12); clreol(); } }while(! valid); if( ch == 'N') return; modify_record(t_code); } //***************************************************************** // FUNCTION NAME : MAIN // DETAILS : IT CALLS THE STARTUP FUNCTION AND // MENU FUNCTION. //***************************************************************** void main(void) { menu m; m.startup(); m.main_menu(); }

悠悠同学网www.uuclass.com

附录

Base.Dlg.cpp程序: #include \#include \#include \#include \#include \

#ifdef _DEBUG

#define new DEBUG_NEW #undef THIS_FILE

static char THIS_FILE[] = __FILE__; #endif

///////////////////////////////////////////////////////////////////////////// // CBaseDlg dialog

CBaseDlg::CBaseDlg(CWnd* pParent /*=NULL*/) { }

//{{AFX_DATA_INIT(CBaseDlg)

// NOTE: the ClassWizard will add member initialization here : CDialog(CBaseDlg::IDD, pParent)

//}}AFX_DATA_INIT

悠悠同学网www.uuclass.com

void CBaseDlg::DoDataExchange(CDataExchange* pDX) { }

BEGIN_MESSAGE_MAP(CBaseDlg, CDialog)

//{{AFX_MSG_MAP(CBaseDlg) //}}AFX_MSG_MAP

CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CBaseDlg)

DDX_Control(pDX, IDC_TAB_BASE, m_oTabBase); //}}AFX_DATA_MAP

END_MESSAGE_MAP()

///////////////////////////////////////////////////////////////////////////// // CBaseDlg message handlers

BOOL CBaseDlg::OnInitDialog() {

CDialog::OnInitDialog();

// TODO: Add extra initialization here

m_oTabBase.AddPage(\商品类别\m_oTabBase.AddPage(\商品资料\TERIEL); m_oTabBase.AddPage(\付款方式\m_oTabBase.Show();

return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE

悠悠同学网www.uuclass.com

}

CallDlg.cpp程序: #include \#include \#include \

#ifdef _DEBUG

#define new DEBUG_NEW #undef THIS_FILE

static char THIS_FILE[] = __FILE__; #endif

///////////////////////////////////////////////////////////////////////////// // CCallDlg dialog

extern CMyPosApp theApp;

CCallDlg::CCallDlg(CWnd* pParent /*=NULL*/) { }

void CCallDlg::DoDataExchange(CDataExchange* pDX) {

CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CCallDlg) //{{AFX_DATA_INIT(CCallDlg)

// NOTE: the ClassWizard will add member initialization here : CDialog(CCallDlg::IDD, pParent)

//}}AFX_DATA_INIT

悠悠同学网www.uuclass.com

}

DDX_Control(pDX, IDC_STATIC_CALL, m_oCallstatic); DDX_Control(pDX, IDC_EDIT_CALLBILLID, m_oCallbillid); //}}AFX_DATA_MAP

BEGIN_MESSAGE_MAP(CCallDlg, CDialog)

//{{AFX_MSG_MAP(CCallDlg) //}}AFX_MSG_MAP

END_MESSAGE_MAP()

///////////////////////////////////////////////////////////////////////////// // CCallDlg message handlers

void CCallDlg::OnOK() { }

BOOL CCallDlg::OnInitDialog() {

CDialog::OnOK(); if(dowhat==\{ }

if(dowhat==\

m_oCallbillid.GetWindowText(dowhat); theApp.scallid=\

m_oCallbillid.GetWindowText(theApp.scallid);

悠悠同学网www.uuclass.com

}

}

_variant_t vtemp = m_pRecordset->GetCollect(\if(vtemp.dblVal>0) else

ftotal=0;

ftotal=(float)m_pRecordset->GetCollect(\

stotal.Format(\m_oTotalm.SetWindowText(stotal); m_oConsume.SetWindowText(stotal);

catch(_com_error e)///捕捉异常 { }

CString temp;

temp.Format(\结帐]计算单据商品金额出错:%s\AfxMessageBox(temp);

return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE

void CCheckDlg::OnButtonCheckok() {

m_oConsume.GetWindowText(stotal); m_oTotalm.GetWindowText(sbilltotal); int nselect=m_oCombopay.GetCurSel(); m_oCombopay.GetLBText(nselect,spaymode); CString stotal,sbilltotal,spayID,sql,spaymode,snowtime; long lpayID;

_RecordsetPtr m_pRecordset;

悠悠同学网www.uuclass.com

lpayID=GetPaymodeID(spaymode); spayID.Format(\

if(fchange<0)

return;

//得到系统时间

CTime now=CTime::GetCurrentTime();

snowtime=now.Format(_T(\sql=\

SALEBILL

set

ENDDATE='\

+stotal+\已结帐',PAYMODE=\

where ID='\

try { }

catch(_com_error e)///捕捉异常 { }

//output the checkout time and paymode to the print. theApp.snowtimep=snowtime; theApp.spaymodep=spaymode; theApp.sconsume=stotal; theApp.sactsum=sbilltotal;

CString temp;

temp.Format(\结帐]单据头更新数据库出错:%s\AfxMessageBox(temp); return;

_variant_t RecordsAffected;

theApp.m_pConnection->Execute((_bstr_t)sql,&RecordsAffected,adCmdText);

悠悠同学网www.uuclass.com

//Insert data into PAYDETAIL.

CString sclass,scontotal,sdiscount,sacttotal,svaltotal; int nItemCount=m_oChecklist.GetItemCount();//表项总数 for(int i=0;i

sclass=m_oChecklist.GetItemText(i,0); scontotal=m_oChecklist.GetItemText(i,1); sdiscount=m_oChecklist.GetItemText(i,3); sacttotal=m_oChecklist.GetItemText(i,4); float fvaltotal=atof(scontotal)-atof(sacttotal); svaltotal.Format(\sql=\

into

PAYDETAIL(BILLID,CLASS,TOTAL,DISCOUNT,ACTTOTAL,VALTOTAL) values('\

try { }

catch(_com_error e)///捕捉异常 {

CString temp;

temp.Format(\结帐]付款明细(PAYDETAIL)插入数据出_variant_t RecordsAffected;

theApp.m_pConnection->Execute((_bstr_t)sql,&RecordsAffected,adCmdText); \

错:%s\

}

}

AfxMessageBox(temp); return;

悠悠同学网www.uuclass.com

}

//When the check button is click down,send a message(WM_CHECKOUT) to the CPosDlg. LRESULT Res=::SendMessage(theApp.pWnd, WM_CHECKOUT, 0, 0);

CDialog::OnOK();

long CCheckDlg::GetPaymodeID(CString payname) {

m_pRecordset->Open((_variant_t)sql,_variant_t((IDispatch*)theApp.m_pConnection,true),along paymodeID;

_RecordsetPtr m_pRecordset;

CString sql=\try {

m_pRecordset.CreateInstance(\

dOpenStatic,adLockOptimistic,adCmdText); }

void CCheckDlg::OnChangeEditReceive()

}

catch(_com_error e)///捕捉异常 { }

return paymodeID;

CString temp;

temp.Format(\结帐]获取付款方式ID出错:%s\AfxMessageBox(temp);

paymodeID=(long)m_pRecordset->GetCollect(\

悠悠同学网www.uuclass.com

{ // TODO: If this is a RICHEDIT control, the control will not

// send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask.

CString sreceive,schange,stotal;

m_oChange.SetWindowText(\ m_oReceive.GetWindowText(sreceive); m_oTotalm.GetWindowText(stotal); fchange=atof(sreceive)-atof(stotal); if(fchange>=0) { schange.Format(\ m_oChange.SetWindowText(schange);

}

}

void CCheckDlg::ReadtoList(CString sbillid) { _RecordsetPtr m_pRecordset; //Must define it in function!!!! CString sql,sclassname,sclassname1,sctotal; long lclassid; float fctotal=0;

sql=\Sum(ITEMTOTAL) as XXX,CLASSID from BILLID='\ //删除所有list中的数据。

m_oChecklist.DeleteAllItems();

SALEDETAIL where

本文来源:https://www.bwwdw.com/article/tu86.html

Top