1 forward 2 global type w_xx_dyn_dor_weilante from w_xx_base 3 end type 4 type cb_3 from commandbutton within w_xx_dyn_dor_weilante 5 end type 6 type cb_2 from commandbutton within w_xx_dyn_dor_weilante 7 end type 8 type cb_1 from commandbutton within w_xx_dyn_dor_weilante 9 end type 10 type dw_1 from datawindow within w_xx_dyn_dor_weilante 11 end type 12 type msg from uo_text within w_xx_dyn_dor_weilante 13 end type 14 type cb_close from commandbutton within w_xx_dyn_dor_weilante 15 end type 16 type cb_logoff from commandbutton within w_xx_dyn_dor_weilante 17 end type 18 type cb_read from commandbutton within w_xx_dyn_dor_weilante 19 end type 20 type cb_make from commandbutton within w_xx_dyn_dor_weilante 21 end type 22 type gb_1 from groupbox within w_xx_dyn_dor_weilante 23 end type 24 end forward 25 26 global type w_xx_dyn_dor_weilante from w_xx_base //from xx base是何用意 27 integer x = 1056 28 integer y = 484 29 integer width = 3899 30 integer height = 2032 31 string title = "门卡发行" 32 cb_3 cb_3 33 cb_2 cb_2 34 cb_1 cb_1 35 dw_1 dw_1 36 msg msg 37 cb_close cb_close 38 cb_logoff cb_logoff 39 cb_read cb_read 40 cb_make cb_make 41 gb_1 gb_1 42 end type 43 global w_xx_dyn_dor_weilante w_xx_dyn_dor_weilante 44 45 type prototypes 46 47 48 49 Function boolean GetErrorStatus(REF long ErrorCode,REF string ErrorString) LIBRARY "mbt2005.DLL" 50 51 Function boolean CancelCard(boolean MandatoryCancel) LIBRARY "mbt2005.DLL" 52 53 Function boolean SetConfiguration(string server_name,string account_name,string password) LIBRARY "mbt2005.DLL" 54 55 Function boolean EncodeCard(string room_name,string CheckInDate,string CheckOutDate,string IdCardNo,string Memo) LIBRARY "mbt2005.DLL" 56 57 Function boolean ReadCard( REF string room_no, REF string start_date, REF string expire_date, REF int card_no) LIBRARY "mbt2005.DLL" 58 59 Function boolean RenewGuestInfo(string room_name) LIBRARY "mbt2005.DLL" 60 61 Function boolean GetCardSnrAfterEncode(REF string CardSnr) LIBRARY "mbt2005.DLL" 62 63 Function boolean GetDllVersion(REF string VersionString) LIBRARY "mbt2005.DLL" 64 65 Function boolean ConnectionType(int aConnection) LIBRARY "mbt2005.DLL" 66 end prototypes 67 68 type variables 69 public string is_accnt 70 public string iroomno 71 public string ista 72 public string igname 73 74 75 76 string is_server 77 string is_user 78 string is_pass 79 string is_text 80 81 end variables 82 83 on w_xx_dyn_dor_weilante.create 84 int iCurrent 85 call super::create 86 this.cb_3=create cb_3 87 this.cb_2=create cb_2 88 this.cb_1=create cb_1 89 this.dw_1=create dw_1 90 this.msg=create msg 91 this.cb_close=create cb_close 92 this.cb_logoff=create cb_logoff 93 this.cb_read=create cb_read 94 this.cb_make=create cb_make 95 this.gb_1=create gb_1 96 iCurrent=UpperBound(this.Control) 97 this.Control[iCurrent+1]=this.cb_3 98 this.Control[iCurrent+2]=this.cb_2 99 this.Control[iCurrent+3]=this.cb_1 100 this.Control[iCurrent+4]=this.dw_1 101 this.Control[iCurrent+5]=this.msg 102 this.Control[iCurrent+6]=this.cb_close 103 this.Control[iCurrent+7]=this.cb_logoff 104 this.Control[iCurrent+8]=this.cb_read 105 this.Control[iCurrent+9]=this.cb_make 106 this.Control[iCurrent+10]=this.gb_1 107 end on 108 109 on w_xx_dyn_dor_weilante.destroy 110 call super::destroy 111 destroy(this.cb_3) 112 destroy(this.cb_2) 113 destroy(this.cb_1) 114 destroy(this.dw_1) 115 destroy(this.msg) 116 destroy(this.cb_close) 117 destroy(this.cb_logoff) 118 destroy(this.cb_read) 119 destroy(this.cb_make) 120 destroy(this.gb_1) 121 end on 122 123 event open;f_center_window(this) 124 is_accnt = message.stringparm 125 dw_1.settransobject(sqlca) 126 dw_1.retrieve(is_accnt) 127 128 int li_row,li_ext 129 string ls_accnt 130 datetime ldt_date 131 132 select value into :is_server from sys_option where catalog='door' and item='server'; 133 if sqlca.sqlcode<>0 or is_server='' then 134 f_err("请先到维护系统设置门锁软件所在的服务器名") 135 close(this) 136 end if 137 138 select value into :is_user from sys_option where catalog='door' and item='user'; 139 if sqlca.sqlcode<>0 or is_user='' then 140 f_err("请先到维护系统设置门锁软件用户名") 141 end if 142 select value into :is_pass from sys_option where catalog='door' and item='password'; 143 144 is_text = message.stringparm 145 if is_text = 'breakfast' then 146 cb_read.postevent("clicked") 147 end if 148 149 150 ldt_date=datetime(today(),now()) 151 for li_row=1 to dw_1.rowcount() 152 ls_accnt=dw_1.getitemstring(li_row,"accnt") 153 select count(1) into :li_ext from door_record where accnt=:ls_accnt and datediff(dd,:ldt_date,date)<1; 154 if li_ext > 0 then 155 dw_1.setitem(li_row,"flag","F") 156 end if 157 next 158 //页面Open时间 初始化程序 159 //if dw_1.rowcount()=0 then 160 // int li_row 161 // li_row = dw_1.insertrow(0) 162 // dw_1.SetFocus() 163 //// dw_1.ScrollToRow(li_row) 164 //// dw_1.selectrow(0,false) 165 //// dw_1.selectrow(li_row,true) 166 //// dw_1.SetColumn(2) 167 // dw_1.setitem(li_row,"flag","T") 168 // dw_1.setitem(li_row,"name","<无名>") 169 // dw_1.setitem(li_row,"sta","I") 170 // dw_1.setitem(li_row,"ocsta","OC") 171 // dw_1.setitem(li_row,"arr",datetime(today(),now())) 172 // dw_1.setitem(li_row,"dep",datetime(relativedate(today(),1),time("14:00"))) 173 // dw_1.setitem(li_row,"number",1) 174 // dw_1.setitem(li_row,"type","1") 175 //end if 176 177 178 179 180 181 end event 182 183 type cb_3 from commandbutton within w_xx_dyn_dor_weilante 184 integer x = 951 185 integer y = 1480 186 integer width = 402 187 integer height = 112 188 integer taborder = 60 189 integer textsize = -10 190 integer weight = 400 191 fontcharset fontcharset = ansi! 192 fontpitch fontpitch = variable! 193 fontfamily fontfamily = swiss! 194 string facename = "Tahoma" 195 string text = "反选" 196 end type 197 198 event clicked; 199 string ls_flag 200 integer li_row 201 202 203 for li_row = 1 to dw_1.rowcount() 204 ls_flag=parent.dw_1.getitemstring(li_row,"flag") 205 if ls_flag="T" then 206 parent.dw_1.setitem(li_row,"flag","F") 207 else 208 parent.dw_1.setitem(li_row,"flag","T") 209 end if 210 next 211 212 return 213 end event 214 215 type cb_2 from commandbutton within w_xx_dyn_dor_weilante 216 integer x = 512 217 integer y = 1480 218 integer width = 402 219 integer height = 112 220 integer taborder = 50 221 integer textsize = -10 222 integer weight = 400 223 fontcharset fontcharset = ansi! 224 fontpitch fontpitch = variable! 225 fontfamily fontfamily = swiss! 226 string facename = "Tahoma" 227 string text = "全选" 228 end type 229 230 event clicked;integer li_row 231 232 for li_row = 1 to dw_1.rowcount() 233 dw_1.setitem(li_row,"flag","T") 234 next 235 236 return 237 end event 238 239 type cb_1 from commandbutton within w_xx_dyn_dor_weilante 240 integer x = 73 241 integer y = 1480 242 integer width = 402 243 integer height = 112 244 integer taborder = 50 245 integer textsize = -10 246 integer weight = 400 247 fontcharset fontcharset = ansi! 248 fontpitch fontpitch = variable! 249 fontfamily fontfamily = swiss! 250 string facename = "Tahoma" 251 string text = "独自" 252 end type 253 254 event clicked; 255 string ls_accnt 256 integer li_row 257 258 259 for li_row = 1 to dw_1.rowcount() 260 ls_accnt=parent.dw_1.getitemstring(li_row,"accnt") 261 if ls_accnt=is_accnt then 262 parent.dw_1.setitem(li_row,"flag","T") 263 else 264 parent.dw_1.setitem(li_row,"flag","F") 265 end if 266 next 267 268 return 269 end event 270 271 type dw_1 from datawindow within w_xx_dyn_dor_weilante 272 integer x = 23 273 integer y = 20 274 integer width = 3131 275 integer height = 1580 276 integer taborder = 10 277 string dataobject = "d_xx_dyn_dor_jiweimen" 278 boolean vscrollbar = true 279 boolean livescroll = true 280 borderstyle borderstyle = stylelowered! 281 end type 282 283 event doubleclicked;//integer li_row 284 // 285 //for li_row = 1 to rowcount() 286 // setitem(li_row,"flag","T") 287 //next 288 // 289 //return 290 end event 291 292 event itemchanged;string ls_columnname 293 string ls_type 294 string ls_flag 295 integer li_number 296 integer li_row 297 datetime ldt_arr 298 datetime ldt_dep 299 300 ls_columnname = getcolumnname() 301 302 if ls_columnname = "number" then 303 li_number = integer(data) 304 305 if rowcount() > 1 then 306 307 if messagebox("修改发卡数量","其余房间是否也做同样处理?",question!,okcancel!,2) = 2 then 308 return 309 end if 310 311 for li_row = 1 to rowcount() 312 setitem(li_row,"number",li_number) 313 next 314 315 end if 316 317 else 318 319 if ls_columnname = "type" then 320 ls_type = data 321 322 if rowcount() > 1 then 323 324 if messagebox("修改发卡类型","其余房间是否也做同样处理?",question!,okcancel!,2) = 2 then 325 return 326 end if 327 328 for li_row = 1 to rowcount() 329 setitem(li_row,"type",ls_type) 330 next 331 332 end if 333 334 else 335 336 if ls_columnname = "arr" then 337 ldt_arr = datetime(date(mid(data,1,10)),time(mid(data,12,5) + ":00")) 338 if rowcount() > 1 then 339 340 if messagebox("修改发卡开始时间","其余房间是否也做同样处理?",question!,okcancel!,2) = 2 then 341 return 342 end if 343 344 for li_row = 1 to rowcount() 345 setitem(li_row,"arr",ldt_arr) 346 next 347 348 end if 349 350 else 351 352 if ls_columnname = "dep" then 353 ldt_dep = datetime(date(mid(data,1,10)),time(mid(data,12,5) + ":00")) 354 355 if rowcount() > 1 then 356 357 if messagebox("修改发卡截止时间","其余房间是否也做同样处理?",question!,okcancel!,2) = 2 then 358 return 359 end if 360 361 for li_row = 1 to rowcount() 362 setitem(li_row,"dep",ldt_dep) 363 next 364 365 end if 366 367 end if 368 369 end if 370 371 end if 372 373 end if 374 375 return 376 end event 377 378 event rbuttondown;//string ls_choose 379 //integer li_row 380 // 381 //for li_row = 1 to rowcount() 382 // ls_choose = getitemstring(li_row,"flag") 383 // 384 // if ls_choose = "T" then 385 // setitem(li_row,"flag","F") 386 // else 387 // setitem(li_row,"flag","T") 388 // end if 389 // 390 //next 391 // 392 //return 393 end event 394 395 type msg from uo_text within w_xx_dyn_dor_weilante 396 integer x = 27 397 integer y = 1676 398 integer width = 3113 399 integer height = 144 400 integer textsize = -12 401 fontcharset fontcharset = ansi! 402 fontfamily fontfamily = swiss! 403 string facename = "Tahoma" 404 long textcolor = 255 405 long backcolor = 67108864 406 boolean enabled = false 407 long bordercolor = 16777215 408 end type 409 410 type cb_close from commandbutton within w_xx_dyn_dor_weilante 411 integer x = 3301 412 integer y = 1372 413 integer width = 402 414 integer height = 120 415 integer taborder = 40 416 integer textsize = -10 417 integer weight = 400 418 fontcharset fontcharset = ansi! 419 fontpitch fontpitch = variable! 420 fontfamily fontfamily = swiss! 421 string facename = "Tahoma" 422 string text = "&C.关闭" 423 boolean cancel = true 424 end type 425 426 event clicked;close(parent) 427 return 428 end event 429 430 type cb_logoff from commandbutton within w_xx_dyn_dor_weilante 431 integer x = 3301 432 integer y = 1220 433 integer width = 402 434 integer height = 120 435 integer taborder = 30 436 integer textsize = -10 437 integer weight = 400 438 fontcharset fontcharset = ansi! 439 fontpitch fontpitch = variable! 440 fontfamily fontfamily = swiss! 441 string facename = "Tahoma" 442 string text = "&L.注销" 443 end type 444 445 event clicked;boolean lb_ret 446 long ll_errcode 447 string ls_errmsg 448 449 ConnectionType(1) 450 lb_ret=SetConfiguration(is_server,is_user,is_pass) 451 lb_ret=CancelCard(true) 452 453 if lb_ret=true then 454 msg.text="注销成功!" 455 else 456 ls_errmsg=space(255) 457 GetErrorStatus(ll_errcode,ls_errmsg) 458 msg.text="注销失败,错误原因:"+ls_errmsg 459 end if 460 461 end event 462 463 type cb_read from commandbutton within w_xx_dyn_dor_weilante 464 integer x = 3301 465 integer y = 1068 466 integer width = 402 467 integer height = 120 468 integer taborder = 20 469 integer textsize = -10 470 integer weight = 400 471 fontcharset fontcharset = ansi! 472 fontpitch fontpitch = variable! 473 fontfamily fontfamily = swiss! 474 string facename = "Tahoma" 475 string text = "&R.读卡" 476 end type 477 478 event clicked;long ll_cardno 479 string ls_roomno 480 string ls_arr 481 string ls_dep 482 long ll_errcode 483 string ls_errmsg 484 boolean lb_ret 485 int li_cardno 486 string ls_doorid 487 string ls_accnt,ls_cardno 488 datetime ldt_arr 489 int li_ext 490 string ls_accnt1 491 string ls_stas 492 string ls_sta 493 string ls_arr1 494 495 ls_arr=space(16) 496 ls_dep=space(16) 497 ls_doorid=space(10) 498 499 ConnectionType(1) 500 SetConfiguration(is_server,is_user,is_pass) 501 502 lb_ret=ReadCard(ls_doorid,ls_arr,ls_dep,li_cardno) 503 504 505 if lb_ret=true then 506 select roomno into :ls_roomno from room_doorid where doorid=:ls_doorid; 507 ldt_arr = datetime(ls_arr) 508 ls_cardno=string(li_cardno)+trim(ls_roomno) 509 //f_tips("房号:"+ls_doorid+'~r~n'+"开始时间:"+ls_arr+'~r~n'+"截止时间:"+ls_dep) 510 msg.text="房号:"+ls_roomno+space(4)+"开始时间:"+ls_arr+space(4)+"截止时间:"+ls_dep+space(4)+"卡号:"+ls_cardno 511 if is_text = 'breakfast' then 512 select count(1) into :li_ext from door_record where cardno = :ls_cardno and roomno = :ls_roomno using sqlca; 513 if li_ext = 1 then 514 select accnt into :ls_accnt from door_record where cardno = :ls_cardno using sqlca; 515 else //有重复的卡号时,再加一个抵达时间的判断 516 ls_arr1 = mid(ls_arr,1,4)+mid(ls_arr,6,2)+mid(ls_arr,9,2) 517 select accnt into :ls_accnt from door_record where cardno = :ls_cardno and roomno = :ls_roomno and convert(char(8),arr,112) =:ls_arr1 using sqlca; 518 end if 519 select sta into :ls_sta from mstinfo where accnt = :ls_accnt; 520 if pos(ls_sta,'I') = 0 and pos(ls_sta,'R') = 0 then 521 select min(accnt) into :ls_accnt from mstinfo where sta = 'I' and roomno = :ls_roomno; 522 if sqlca.sqlcode<>0 then 523 closewithreturn(parent,'no') 524 return 525 end if 526 end if 527 closewithreturn(parent,ls_accnt) 528 return 529 end if 530 else 531 ls_errmsg=space(255) 532 GetErrorStatus(ll_errcode,ls_errmsg) 533 //f_err("读卡失败,错误原因:"+ls_errmsg) 534 msg.text="读卡失败,错误原因:"+ls_errmsg 535 if is_text = 'breakfast' then 536 closewithreturn(parent,'no') 537 return 538 end if 539 end if 540 541 542 543 end event 544 545 type cb_make from commandbutton within w_xx_dyn_dor_weilante 546 integer x = 3301 547 integer y = 916 548 integer width = 402 549 integer height = 120 550 integer taborder = 10 551 integer textsize = -10 552 integer weight = 700 553 fontcharset fontcharset = ansi! 554 fontpitch fontpitch = variable! 555 fontfamily fontfamily = swiss! 556 string facename = "Tahoma" 557 string text = "&M.制卡" 558 end type 559 560 event clicked;integer li_ttl 561 integer li_cnt 562 integer li_number 563 integer li_row 564 string ls_accnt 565 string ls_roomno 566 string ls_name 567 string ls_type 568 string ls_sta 569 string ls_flag 570 datetime ldt_arr 571 datetime ldt_dep 572 string ls_arr,ls_dep 573 string ls_doorid 574 string ls_idno 575 string ls_memo 576 boolean lb_sta 577 boolean lb_ret 578 string ls_errmsg 579 long ll_errcode 580 long ll_doorid 581 long ll_cardno,ll_roomno 582 string ls_cardno 583 int li_cardno 584 585 586 parent.dw_1.accepttext() 587 li_ttl = parent.dw_1.rowcount() 588 589 if li_ttl = 0 then 590 return 591 end if 592 593 li_cnt = 0 594 595 for li_row = 1 to li_ttl 596 ls_flag = parent.dw_1.getitemstring(li_row,"flag") 597 598 if ls_flag = "F" then 599 else 600 li_cnt ++ 601 ls_roomno = parent.dw_1.getitemstring(li_row,"roomno") 602 ls_type = parent.dw_1.getitemstring(li_row,"type") 603 ls_sta = parent.dw_1.getitemstring(li_row,"sta") 604 li_number = parent.dw_1.getitemnumber(li_row,"number") 605 ldt_arr = parent.dw_1.getitemdatetime(li_row,"arr") 606 ldt_dep = parent.dw_1.getitemdatetime(li_row,"dep") 607 ls_accnt=parent.dw_1.getitemstring(li_row,"accnt") 608 609 if isnull(ls_roomno) or ls_roomno='' then 610 beep(2) 611 f_tips('请检查房号') 612 return 613 end if 614 615 if isnull(ldt_dep) or ldt_dep<datetime(today(),now()) then 616 beep(2) 617 f_tips('请输入正确的有效时间 !') 618 return 619 end if 620 621 select doorid into :ls_doorid from room_doorid where roomno=:ls_roomno; 622 if sqlca.sqlcode<>0 or ls_doorid='' then 623 f_err("房号:"+ls_roomno+"对应的锁号未设置,请联系管理员!") 624 continue 625 end if 626 if not isnumber(ls_doorid) then 627 f_err("锁号设置有误,请检查!") 628 end if 629 630 ls_arr=string(ldt_arr,"yyyy-mm-dd hh:mm") 631 ls_dep=string(ldt_dep,"yyyy-mm-dd hh:mm") 632 ls_idno=is_accnt 633 ls_memo='酒店管理系统发卡' 634 635 lb1: 636 ConnectionType(1) 637 638 lb_ret=SetConfiguration(is_server,is_user,is_pass) 639 if not lb_ret then 640 ls_errmsg=space(255) 641 GetErrorStatus(ll_errcode,ls_errmsg) 642 messagebox("",ls_errmsg) 643 end if 644 CancelCard(true) 645 646 if ls_type='1' then //新卡 647 lb_sta=true ////旧卡作废 648 if not RenewGuestInfo(ls_doorid) then 649 msg.text="注销原卡失败!" 650 end if 651 else 652 lb_sta=false 653 end if 654 655 lb_ret=EncodeCard(ls_doorid,ls_arr,ls_dep,ls_idno,ls_memo) 656 657 if lb_ret=true then 658 ls_arr=space(16) 659 ls_dep=space(16) 660 ls_doorid=space(20) 661 lb_ret=ReadCard(ls_doorid,ls_arr,ls_dep,li_cardno) 662 if lb_ret then 663 ls_cardno=string(li_cardno)+trim(ls_roomno) 664 665 insert door_record select :ls_accnt,:ls_roomno,:ls_name,:ldt_arr,:ldt_dep,'新卡',1 666 ,1,'T',:op_name,getdate(),:ip,:ls_cardno; 667 else 668 msg.text="制卡信息未做记录!" 669 end if 670 if f_msg("房号:"+ls_roomno+"制卡成功!是否继续?")=2 then 671 exit 672 return 673 end if 674 msg.text="房号:"+ls_roomno+"制卡成功!" 675 676 li_number=li_number - 1 677 if li_number <> 0 then 678 ls_type='0' 679 goto lb1 680 end if 681 682 dw_1.setitem(li_row,"flag","F") 683 684 else 685 ls_errmsg=space(255) 686 GetErrorStatus(ll_errcode,ls_errmsg) 687 msg.text="房号:"+ls_roomno+"制卡失败,错误原因:"+ls_errmsg 688 if f_msg("房号:"+ls_roomno+"制卡失败,错误原因:"+ls_errmsg+space(2)+"是否重做?")=2 then 689 exit 690 return 691 end if 692 goto lb1 693 end if 694 end if 695 next 696 697 if li_cnt = 0 then 698 f_tips("没有制卡请求") 699 parent.dw_1.setfocus() 700 return 701 end if 702 703 //parent.dw_1.retrieve(parent.is_accnt) 704 return 705 end event 706 707 type gb_1 from groupbox within w_xx_dyn_dor_weilante 708 integer x = 3200 709 integer y = 812 710 integer width = 603 711 integer height = 752 712 integer taborder = 20 713 integer textsize = -8 714 integer weight = 400 715 fontcharset fontcharset = ansi! 716 fontpitch fontpitch = variable! 717 fontfamily fontfamily = swiss! 718 string facename = "Tahoma" 719 long textcolor = 255 720 long backcolor = 67108864 721 string text = "操作" 722 end type
pb是比较原始的东东了;
有需要的就联系我吧
posted on
浙公网安备 33010602011771号