使用读卡器实现pos消费

使用读卡器实现pos消费实时消费、语音消费、刷卡消费

/*****以下代码可实现使用读卡器实现pos消费******/

/*****按键盘录入卡号无效,复制粘贴卡号也无效*****/

/*****可以实现语音消费******************/

forward
global type main_cs from window
end type
type cb_4 from commandbutton within main_cs
end type
type st_9 from statictext within main_cs
end type
type sle_8 from singlelineedit within main_cs
end type
type cb_3 from commandbutton within main_cs
end type
type sle_6 from singlelineedit within main_cs
end type
type st_8 from statictext within main_cs
end type
type sle_5 from singlelineedit within main_cs
end type
type st_7 from statictext within main_cs
end type
type cb_2 from commandbutton within main_cs
end type
type em_2 from editmask within main_cs
end type
type dw_1 from datawindow within main_cs
end type
type sle_4 from singlelineedit within main_cs
end type
type st_6 from statictext within main_cs
end type
type sle_3 from singlelineedit within main_cs
end type
type st_5 from statictext within main_cs
end type
type st_3 from statictext within main_cs
end type
type em_1 from editmask within main_cs
end type
type sle_2 from singlelineedit within main_cs
end type
type st_2 from statictext within main_cs
end type
type sle_1 from singlelineedit within main_cs
end type
type st_1 from statictext within main_cs
end type
type gb_1 from groupbox within main_cs
end type
type p_1 from picture within main_cs
end type
type st_4 from statictext within main_cs
end type
end forward

global type main_cs from window
integer width = 4768
integer height = 2916
boolean titlebar = true
string title = “实时消费系统”
boolean controlmenu = true
boolean minbox = true
boolean maxbox = true
boolean resizable = true
windowstate windowstate = maximized!
long backcolor = 15780518
string icon = “hrms.ico”
boolean center = true
event ue_delete_dw pbm_custom09
cb_4 cb_4
st_9 st_9
sle_8 sle_8
cb_3 cb_3
sle_6 sle_6
st_8 st_8
sle_5 sle_5
st_7 st_7
cb_2 cb_2
em_2 em_2
dw_1 dw_1
sle_4 sle_4
st_6 st_6
sle_3 sle_3
st_5 st_5
st_3 st_3
em_1 em_1
sle_2 sle_2
st_2 st_2
sle_1 sle_1
st_1 st_1
gb_1 gb_1
p_1 p_1
st_4 st_4
end type
global main_cs main_cs

type prototypes
Function ulong OpenComm (int commport) Library “dascomm.dll”
Function int CloseComm (ulong icDev) Library “dascomm.dll”
Function int Hand_Shake(ulong ic_dev,int Node_Addr,string password) Library “dascomm”
Function int Hand_Shake_N(ulong icdev,int Node_Addr) Library “dascomm.dll”
Function int Real_Query(ulong icdev,int node_addrr,Ref char query_data[30]) Library “dascomm.dll”
Function int Get_Curr_Record(ulong ic_dev,ref int nodeaddr,Ref char kqdata[20]) Library “dascomm.dll”
Function int Get_Next_Record(ulong ic_dev,ref int nodeaddr,Ref char kqdata[20]) Library “dascomm.dll”
Function boolean sndPlaySoundA (string SoundName, uint Flags) Library “WINMM.DLL”
Function uint waveOutGetNumDevs () Library “WINMM.DLL”

end prototypes

type variables
string ll_chkjh, ls_dir,ls_yyxf
end variables

forward prototypes
public function integer playsound (string as_filename, integer ai_option)
public function string xx2dx (decimal ls)
public subroutine myreadmoney (decimal amoney)
end prototypes

event ue_delete_dw;Int ret

IF dw_1.getselectedrow(0) > 0 THEN
 ret = MessageBox(ProfileString(“lang1.ini”,”Idxf”,”msg1″,””),ProfileString(“lang1.ini”,”Idxf”,”msg15″,””),StopSign!,yesno!)
 IF ret = 1 THEN
  dw_1.DeleteRow(dw_1.GetRow())
  dw_1.Update()
 END IF
else
 MessageBox(‘WARNING!’,ProfileString(“lang1.ini”,”Idxf”,”msg16″,””),StopSign!,okcancel!)
END IF

end event

public function integer playsound (string as_filename, integer ai_option);uint lui_numdevs
lui_numdevs = WaveOutGetNumDevs()
If lui_numdevs > 0 Then
sndPlaySoundA(as_filename,ai_option)
return 1
Else
return -1
End If
end function

public function string xx2dx (decimal ls);String dx_sz,dx_dw,str_int,str_dec,dx_str,fu,a,b,b2,c,d,result
Long num_int,num_dec,len_int,i,a_int,pp

dx_sz = “零壹贰叁肆伍陆柒捌玖”
dx_dw = “万仟佰拾亿仟佰拾万仟佰拾元”

/*处理小于零情况*/
IF ls < 0 THEN
 ls = ls*(-1)
 fu = “负”
ELSE
 fu = “”
END IF

/*取得整数及整数串*/
dx_str = String(ls)
If (ls > 0) And (ls < 1) THEN dx_str = “0”+dx_str
pp = Pos(dx_str,”.”)
IF pp > 0 THEN
 str_int = Mid(dx_str,1,Pos(dx_str,”.”)-1)
ELSE
 str_int = dx_str
END IF
num_int = Long(str_int)

/*取得小数及小数串*/
If (ls > 0) And (ls < 1) THEN
 num_dec = ls * 100
ELSE
 num_dec = (ls – num_int) * 100
END IF
str_dec = String(num_dec)
len_int = Len(str_int)
dx_str = “”

/*转换整整部分*/
FOR i = 1 To len_int
 /*a为小写数字字符,b为对应的大写字符,c为对应大写单位,d为当前大写字符串的最后一个汉字*/
 a = Mid(str_int,i,1)
 a_int = Long(a)
 b = Mid(dx_sz,(a_int*2)+1,2)
 c = Mid(dx_dw,((13 – len_int +i – 1)*2+1),2)
 IF dx_str <> “” THEN
  d = Mid(dx_str,Len(dx_str)-1,2)
 ELSE
  d = “”
 END IF
 
 If (b = “零”) And ((d = “零”) Or (b = b2) Or (c = “元”) Or (c = “万”) Or (c = “亿”)) THEN b = “”
 If (a = “0”) And (c <> “元”) And (c <> “万”) And (c <> “亿”) THEN c = “”
 If ((c = “元”) Or (c = “万”) Or (c = “亿”)) And (d = “零”) And (a = “0”) THEN
  dx_str = Mid(dx_str,1,Len(dx_str)-2)
  d = Mid(dx_str,Len(dx_str)-1,2)
  If ((c = “元”) And (d = “万”)) Or ((c = “万”) And (d = “亿”)) THEN c = “”
 END IF
 dx_str = dx_str + b+ c
 b2 = b
NEXT

/*处理金额小于1的情况*/
IF Len(dx_str) <= 2 THEN dx_str = “”
/*转换小数部分*/
If (num_dec < 10) And (ls > 0) THEN
 a_int = Long(str_dec)
 b = Mid(dx_sz,(a_int*2+1),2)
 IF num_dec = 0 THEN dx_str = dx_str + “整”
 IF num_dec > 0 THEN dx_str = dx_str +”零”+b+”分”
END IF

IF num_dec >= 10 THEN
 a_int = Long(Mid(str_dec,1,1))
 a = Mid(dx_sz,(a_int*2+1),2)
 a_int = Long(Mid(str_dec,2,1))
 b = Mid(dx_sz,(a_int*2+1),2)
 IF a <> “零” THEN a = a+”角”
 IF b <> “零” THEN
  b = b+”分”
 ELSE
  b = “”
 END IF
 dx_str = dx_str + a + b
END IF
IF ls = 0 THEN dx_str = “零元整”
dx_str = fu+dx_str

result = dx_str
RETURN result

end function

public subroutine myreadmoney (decimal amoney);integer i,count
string ls_dxje

ls_dxje = xx2dx(Amoney)
count = len(ls_dxje)
for i= 1 to count step 2
CHOOSE CASE mid(ls_dxje,i,2)
CASE “零”
playsound(ls_dir+”0.wav”,0)
CASE “壹”
playsound(ls_dir+”1.wav”,0)
CASE “贰”
playsound(ls_dir+”2.wav”,0)
CASE “叁”
playsound(ls_dir+”3.wav”,0)
CASE “肆”
playsound(ls_dir+”4.wav”,0)
CASE “伍”
playsound(ls_dir+”5.wav”,0)
CASE “陆”
playsound(ls_dir+”6.wav”,0)
CASE “柒”
playsound(ls_dir+”7.wav”,0)
CASE “捌”
playsound(ls_dir+”8.wav”,0)
CASE “玖”
playsound(ls_dir+”9.wav”,0)
CASE “拾”
playsound(ls_dir+”num_ten.wav”,0)
CASE “佰”
playsound(ls_dir+”num_b.wav”,0)
CASE “仟”
playsound(ls_dir+”num_q.wav”,0)
CASE “万”
playsound(ls_dir+”num_w.wav”,0)
CASE “亿”
playsound(ls_dir+”num_y.wav”,0)
CASE “元”
playsound(ls_dir+”rmb_y.wav”,0)
CASE “角”
playsound(ls_dir+”rmb_j.wav”,0)
CASE “分”
playsound(ls_dir+”rmb_f.wav”,0)
CASE “整”
playsound(ls_dir+”zheng.wav”,0)
END CHOOSE
next
end subroutine

on main_cs.create
this.cb_4=create cb_4
this.st_9=create st_9
this.sle_8=create sle_8
this.cb_3=create cb_3
this.sle_6=create sle_6
this.st_8=create st_8
this.sle_5=create sle_5
this.st_7=create st_7
this.cb_2=create cb_2
this.em_2=create em_2
this.dw_1=create dw_1
this.sle_4=create sle_4
this.st_6=create st_6
this.sle_3=create sle_3
this.st_5=create st_5
this.st_3=create st_3
this.em_1=create em_1
this.sle_2=create sle_2
this.st_2=create st_2
this.sle_1=create sle_1
this.st_1=create st_1
this.gb_1=create gb_1
this.p_1=create p_1
this.st_4=create st_4
this.Control[]={this.cb_4,&
this.st_9,&
this.sle_8,&
this.cb_3,&
this.sle_6,&
this.st_8,&
this.sle_5,&
this.st_7,&
this.cb_2,&
this.em_2,&
this.dw_1,&
this.sle_4,&
this.st_6,&
this.sle_3,&
this.st_5,&
this.st_3,&
this.em_1,&
this.sle_2,&
this.st_2,&
this.sle_1,&
this.st_1,&
this.gb_1,&
this.p_1,&
this.st_4}
end on

on main_cs.destroy
destroy(this.cb_4)
destroy(this.st_9)
destroy(this.sle_8)
destroy(this.cb_3)
destroy(this.sle_6)
destroy(this.st_8)
destroy(this.sle_5)
destroy(this.st_7)
destroy(this.cb_2)
destroy(this.em_2)
destroy(this.dw_1)
destroy(this.sle_4)
destroy(this.st_6)
destroy(this.sle_3)
destroy(this.st_5)
destroy(this.st_3)
destroy(this.em_1)
destroy(this.sle_2)
destroy(this.st_2)
destroy(this.sle_1)
destroy(this.st_1)
destroy(this.gb_1)
destroy(this.p_1)
destroy(this.st_4)
end on

event open;em_2.text=string(today())
dw_1.SetTransObject(sqlca)
dw_1.reset()
em_1.setfocus()
this.title=ProfileString(“lang1.ini”,”Idxf”,”title1″,””)
gb_1.text=ProfileString(“lang1.ini”,”Idxf”,”gb_1″,””)
cb_2.text=ProfileString(“lang1.ini”,”Idxf”,”cb_2″,””)
cb_3.text=ProfileString(“lang1.ini”,”Idxf”,”cb_3″,””)
cb_4.text=ProfileString(“lang1.ini”,”Idxf”,”cb_4″,””)
st_1.text=ProfileString(“lang1.ini”,”Idxf”,”st_1″,””)
st_2.text=ProfileString(“lang1.ini”,”Idxf”,”st_2″,””)
st_3.text=ProfileString(“lang1.ini”,”Idxf”,”st_3″,””)
st_4.text=ProfileString(“lang1.ini”,”Idxf”,”msg14″,””)
st_5.text=ProfileString(“lang1.ini”,”Idxf”,”st_5″,””)
st_6.text=ProfileString(“lang1.ini”,”Idxf”,”st_2″,””)
st_7.text=ProfileString(“lang1.ini”,”Idxf”,”st_7″,””)
st_8.text=ProfileString(“lang1.ini”,”Idxf”,”st_8″,””)
st_9.text=ProfileString(“lang1.ini”,”Idxf”,”st_9″,””)
sle_8.text=ProfileString(“hrms.ini”,”Idxf”,”chkjh”,””)

f_reset_column(“xf_xfjl”,dw_1)
ll_chkjh = left(trim(sle_8.text),1)
ls_dir=ProfileString(“path.ini”,”path”,”path”,””)+’/sounds/’
ls_yyxf=ProfileString(“hrms.ini”,”consume”,”yyxf”,””)
end event

event close;string ls_filename
datetime sys_datetime
 if dw_1.rowcount()>0 then
  sys_datetime = DateTime(Today(), Now())
  ls_filename = “kqdata/xf” +sle_8.text+’-‘+ String(sys_datetime,”yymmddhhmmss”) + “.txt”
  dw_1.saveas(ls_filename,text!,false)
 end if
end event

event timer;if len(sle_2.text) < 10 then
  timer(0)
 MessageBox(ProfileString(“lang1.ini”,”Idxf”,”msg1″,””),ProfileString(“lang1.ini”,”Idxf”,”msg9″,””))
else
 sle_2.triggerevent(modified!)
end if

end event

type cb_4 from commandbutton within main_cs
integer x = 2693
integer y = 1280
integer width = 750
integer height = 136
integer taborder = 60
integer textsize = -18
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial”
string text = “撤销本次消费”
end type

event clicked;parent.TriggerEvent(“ue_delete_dw”)
setfocus(parent.em_1)

end event

type st_9 from statictext within main_cs
integer x = 2601
integer y = 92
integer width = 462
integer height = 124
integer textsize = -18
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial”
long textcolor = 33554432
long backcolor = 67108864
string text = “窗口机号”
boolean focusrectangle = false
end type

type sle_8 from singlelineedit within main_cs
integer x = 2478
integer y = 304
integer width = 672
integer height = 504
integer taborder = 60
integer textsize = -72
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial Black”
boolean enabled = false
boolean autohscroll = false
borderstyle borderstyle = styleshadowbox!
boolean hideselection = false
boolean righttoleft = true
end type

type cb_3 from commandbutton within main_cs
integer x = 3639
integer y = 1164
integer width = 937
integer height = 148
integer taborder = 50
integer textsize = -18
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial”
string text = “本窗口月消费总额”
end type

event clicked;string ls_yf,ls_year
dec ll_yxfe

ls_yf = mid(trim(em_2.text),6,2)
ls_year = mid(trim(em_2.text),1,4)
select sum(xfje) into :ll_yxfe from xf_xfjl
where  month(xfdate) = :ls_yf and year(xfdate) = :ls_year and xfjbh = :sle_8.text;
sle_6.text = string(ll_yxfe)
end event

type sle_6 from singlelineedit within main_cs
integer x = 3639
integer y = 1324
integer width = 937
integer height = 160
integer taborder = 50
integer textsize = -18
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial”
long textcolor = 33554432
boolean enabled = false
borderstyle borderstyle = stylelowered!
end type

type st_8 from statictext within main_cs
integer x = 1801
integer y = 1224
integer width = 681
integer height = 108
integer textsize = -18
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial”
long textcolor = 33554432
long backcolor = 67108864
string text = “月度消费总额”
boolean focusrectangle = false
end type

type sle_5 from singlelineedit within main_cs
integer x = 1801
integer y = 1332
integer width = 672
integer height = 128
integer taborder = 40
integer textsize = -18
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial”
long textcolor = 33554432
boolean enabled = false
borderstyle borderstyle = stylelowered!
end type

type st_7 from statictext within main_cs
integer x = 3237
integer y = 92
integer width = 366
integer height = 124
integer textsize = -18
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial”
long textcolor = 33554432
long backcolor = 67108864
string text = “日期:”
boolean focusrectangle = false
end type

type cb_2 from commandbutton within main_cs
integer x = 1230
integer y = 1300
integer width = 503
integer height = 124
integer taborder = 40
integer textsize = -14
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial”
string text = “撤销查询”
end type

event clicked;dw_1.reset()
sle_4.text=”
sle_5.text=”
end event

type em_2 from editmask within main_cs
integer x = 3771
integer y = 52
integer width = 805
integer height = 176
integer taborder = 20
integer textsize = -22
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial”
long textcolor = 33554432
string text = “none”
borderstyle borderstyle = stylelowered!
maskdatatype maskdatatype = datemask!
string mask = “yyyy-mm-dd”
boolean spin = true
end type

type dw_1 from datawindow within main_cs
integer x = 64
integer y = 1504
integer width = 4599
integer height = 1264
integer taborder = 40
string title = “none”
string dataobject = “d_xf_xfjl1”
boolean hscrollbar = true
boolean vscrollbar = true
borderstyle borderstyle = stylelowered!
end type

event clicked;String midifystring

midifystring = “DataWindow.ReadOnly=Yes”
dw_1.Modify(midifystring)

selectrow(0,false)
SelectRow(row,True)
end event

type sle_4 from singlelineedit within main_cs
integer x = 549
integer y = 1296
integer width = 626
integer height = 128
integer taborder = 30
integer textsize = -18
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial”
long textcolor = 33554432
borderstyle borderstyle = stylelowered!
end type

event getfocus;this.selecttext(1,len(this.text))
end event

event modified;string ls_filter,ls_yf,ls_kh,ls_sort,ls_year
dec ll_yxfe

IF KeyDown(KeyEnter!) THEN
 ls_kh = trim(this.text)
 ls_filter = “kh = ‘”+ls_kh+”‘”+ ” and month(xfdate) = “+mid(trim(em_2.text),6,2)+” and year(xfdate) = “+mid(trim(em_2.text),1,4)+” and left(xfjbh,1) = ‘”+ll_chkjh+”‘”
 ls_sort = “no_ber a”
 dw_1.settrans(sqlca)
 dw_1.retrieve()
 dw_1.setfilter(ls_filter)
 dw_1.filter()
 dw_1.setsort(ls_sort)
 dw_1.sort()
 ls_year = mid(trim(em_2.text),1,4)
 ls_yf = mid(trim(em_2.text),6,2)
 select sum(xfje) into :ll_yxfe from xf_xfjl
 where  kh = :ls_kh and month(xfdate) = :ls_yf and year(xfdate) = :ls_year and left(xfjbh,1) = :ll_chkjh;
 sle_5.text = string(ll_yxfe)
   this.selecttext(1,len(this.text))
   sle_4.setfocus() 
end if

end event

event losefocus;sle_4.text=”
sle_5.text=”
end event

type st_6 from statictext within main_cs
integer x = 87
integer y = 1300
integer width = 448
integer height = 124
integer textsize = -18
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial”
long textcolor = 33554432
long backcolor = 67108864
string text = “卡号:”
boolean focusrectangle = false
end type

type sle_3 from singlelineedit within main_cs
integer x = 3602
integer y = 520
integer width = 974
integer height = 128
integer taborder = 40
integer textsize = -20
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial”
long textcolor = 134217730
boolean enabled = false
borderstyle borderstyle = stylelowered!
end type

event getfocus;this.selecttext(1,len(this.text))
end event

event modified;string ls_empname,ls_code
long   ll_empbh,ll_kh//,ll_row,ret
string ls_data,ll_number,ls_database,ls_servername,ls_logId,ls_LogPassword,ls_DatabasePassword
int i
long ll_rows
transaction TTT[],SSS[]

IF KeyDown(KeyEnter!) THEN
// ll_kh = long(this.text)
// ll_number = profilestring(“hrms.ini”,”sqlca”,”Number”,”1″)
// ls_data = profilestring(“hrms.ini”,”sqlca”,”empkhbhNumber”,ll_number)
//   for i=1 to integer(ls_data)
//          SSS[i]=CREATE transaction
//          SSS[i].DBMS = ProfileString(“hrms.ini”,”sqlca”,”dbms”,””)
// 
//          ls_database= ProfileString(“hrms.ini”,”sqlca”,”Database”+string(i),””)
//        SSS[i].Database = ProfileString(“hrms.ini”,”sqlca”,”Database_empkhbh”+string(i),ls_database)
// 
//        ls_servername = ProfileString(“hrms.ini”,”sqlca”,”ServerName”+string(i),””)
//          SSS[i].ServerName = ProfileString(“hrms.ini”,”sqlca”,”ServerName_empkhbh”+string(i),ls_servername)
//         
//    ls_logId= ProfileString(“hrms.ini”,”sqlca”,”logid”+string(i),””)
//        SSS[i].LogId = ProfileString(“hrms.ini”,”sqlca”,”logid_empkhbh”+string(i),ls_logId)
//         
//        ls_LogPassword=ProfileString(“hrms.ini”,”sqlca”,”LogPassword”+string(i),””)
//        SSS[i].LogPass=ProfileString(“hrms.ini”,”sqlca”,”LogPassword_empkhbh”+string(i),ls_LogPassword)
// 
//        ls_DatabasePassword=ProfileString(“hrms.ini”,”sqlca”,”DatabasePassword”+string(i),””)
//        SSS[i].DBPass=ProfileString(“hrms.ini”,”sqlca”,”DatabasePassword_empkhbh”+string(i),ls_DatabasePassword)  
//   
//    SSS[i].AutoCommit = False
//          SSS[i].DBParm = “”
//          CONNECT USING SSS[i];
//     
//    select empbh into :ll_empbh
//          from  emp_khbh
//          where ickh=:ll_kh
//    USING SSS[i];
//     
//    if isnull(ll_empbh) or ll_empbh=0 then 
//     ll_empbh=0
//    else
//     //Messagebox(“提示”,”读取” + string(ll_empbh) +”!”)
//             st_4.text=”读取到编号为:”+ string(ll_empbh)
//     exit
//    end if
//    DISCONNECT USING SSS[i];
//        DESTROY SSS[i]     
//  next
//  if ll_empbh<>0 then
//       //ll_empbh=2001
//         ls_data = profilestring(“hrms.ini”,”sqlca”,”Number”,”1″)
//         for i=1 to integer(ls_data)
//             TTT[i]=CREATE transaction
//             TTT[i].DBMS = ProfileString(“hrms.ini”,”sqlca”,”dbms”,””)
//             TTT[i].Database = ProfileString(“hrms.ini”,”sqlca”,”Database”+string(i),””)
//             TTT[i].ServerName = ProfileString(“hrms.ini”,”sqlca”,”ServerName”+string(i),””)
//             TTT[i].LogId = ProfileString(“hrms.ini”,”sqlca”,”logid”+string(i),””)
//           TTT[i].LogPass=ProfileString(“hrms.ini”,”sqlca”,”LogPassword”+string(i),””)
//           TTT[i].DBPass=ProfileString(“hrms.ini”,”sqlca”,”DatabasePassword”+string(i),””)
//     TTT[i].AutoCommit = False
//             TTT[i].DBParm = “”
//             CONNECT USING TTT[i];
// 
         dw_1.SetTransObject(TTT[i])
           dw_1.reset()
         ll_rows=dw_1.retrieve(ll_empbh)
//         if ll_rows=-1 or ll_rows=0  then 
//          CONTINUE
//         else
//        p_1.visible=false
//        st_4.visible=false
          dw_1.setredraw(true)
//        sle_1.text=string(ll_empbh)
//           //sle_2.text=string(ll_data_number)
          sle_3.text=dw_1.getitemstring(1,”xm”)
//          exit
//         end if
//         next
//     if i>3 then st_4.text=”没有找到编号为:”+ string(ll_empbh) +”的人事档案数据!”
//      //Messagebox(“提示”,”没有找到编号为” + string(ll_empbh) +”的人事档案数据!”) 
//  else
//       //Messagebox(“提示”,”没有找到卡号为” + string(ll_data_number) +”的编号数据!”) 
//   st_4.text=”没有找到卡号为:”+ string(ll_kh) +”的编号数据!”
//      end if 
this.selecttext(1,len(this.text))
sle_2.setfocus() 
end if

end event

type st_5 from statictext within main_cs
integer x = 3237
integer y = 524
integer width = 366
integer height = 124
integer textsize = -18
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial”
long textcolor = 33554432
long backcolor = 67108864
string text = “姓名:”
boolean focusrectangle = false
end type

type st_3 from statictext within main_cs
integer x = 59
integer y = 40
integer width = 690
integer height = 124
integer textsize = -20
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial”
long textcolor = 33554432
long backcolor = 67108864
string text = “消费金额:”
boolean focusrectangle = false
end type

type em_1 from editmask within main_cs
integer x = 59
integer y = 212
integer width = 2327
integer height = 628
integer taborder = 10
integer textsize = -72
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial Black”
long textcolor = 255
string text = “none”
alignment alignment = right!
borderstyle borderstyle = stylelowered!
maskdatatype maskdatatype = decimalmask!
string mask = “###,###.00”
string minmax = “~~”
end type

event modified;IF Dec(em_1.Text) > 100 THEN
 This.SelectText(1,Len(This.Text))
 RETURN;
END IF
IF KeyDown(KeyEnter!) THEN
 IF ls_yyxf = “1” THEN
  playsound(ls_dir+”ndxf.wav”,0)
  MyReadMoney(Dec(em_1.Text))
  playsound(ls_dir+”qshk.wav”,0)
 END IF
 st_4.Text = ProfileString(“lang1.ini”,”Idxf”,”msg12″,””)
 sle_1.Text = ”
 sle_3.Text = ”
 sle_2.Text = ”
 sle_2.SetFocus()
END IF

end event

event getfocus;this.selecttext(1,len(this.text))
end event

type sle_2 from singlelineedit within main_cs
event keypress pbm_keydown
integer x = 3602
integer y = 308
integer width = 974
integer height = 128
integer taborder = 30
integer textsize = -18
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial”
long textcolor = 33554432
borderstyle borderstyle = stylelowered!
end type

event keypress;if keydown(96) or keydown(97) or  keydown(98) or keydown(99) or keydown(100) or  keydown(101) or keydown(102) or keydown(103) or keydown(104) &
or keydown(105) or keydown(KeyControl!) then
   IF ls_yyxf = “1” THEN  playsound(ls_dir+”err_jplr.wav”,0)
 messagebox(ProfileString(“lang1.ini”,”Idxf”,”msg1″,””),ProfileString(“lang1.ini”,”Idxf”,”msg9″,””))
 sle_2.text=”
   sle_2.SetFocus()
end if

IF  keydown(48) or keydown(49) or  keydown(50) or keydown(51) or keydown(52) or  keydown(53) or keydown(54) or keydown(55) or keydown(56) &
or keydown(57)   THEN    
timer(0.2)
end if
end event

event getfocus;this.selecttext(1,len(this.text))
timer(0)
end event

event modified;String ll_xm,ll_bm,ll_gh,ls_kh,ll_rzg,ll_yzg,ls_yf,ls_year,ll_zt
Long   ll_empbh,ll_newrow,ll_kh,ll_maxno
Dec ls_yxfe,ll_xfje,ll_yxfe,ls_rxfe
DateTime ll_xfdate,ll_xftime

IF KeyDown(KeyEnter!) THEN
  
 ll_kh = Long(This.Text)
 ls_kh = This.Text
 ll_xfdate = DateTime(Today())
 ll_xftime = DateTime(Today(),Now())
 ll_xfje = Dec(Trim(em_1.Text))
 ll_yxfe = 0.0;
 ls_rxfe = 0.0;
 ll_maxno = 0
 ls_year = Mid(Trim(em_2.Text),1,4)
 ls_yf = Mid(Trim(em_2.Text),6,2)
 ll_rzg = ProfileString(“hrms.ini”,”Idxf”,”rzg”,”0″)
 ll_yzg = ProfileString(“hrms.ini”,”Idxf”,”yzg”,”0″)
 
 SELECT empbh INTO :ll_empbh FROM emp_khbh
  Where ickh = :ll_kh;
 SELECT tbjl,xm,bm,jn INTO :ll_gh,:ll_xm,:ll_bm,:ll_zt FROM employee
  Where bh = :ll_empbh;
  
 SELECT sum(xfje) INTO :ls_rxfe FROM xf_xfjl
  Where kh = :ls_kh And xftime = :ll_xfdate And Left(xfjbh,1) = :ll_chkjh;
  
 SELECT sum(xfje) INTO :ls_yxfe FROM xf_xfjl
  Where  kh = :ls_kh And Month(xfdate) = :ls_yf And Year(xfdate) = :ls_year;
  
 IF IsNull(ls_yxfe) Or ls_yxfe <= 0 THEN ls_yxfe = 0.0
 IF IsNull(ls_rxfe) Or ls_rxfe <= 0 THEN ls_rxfe = 0.0
 
 ll_yxfe = ls_yxfe + ll_xfje
 
 IF IsNull(ll_xm) Or ll_xm = ” Or  ll_zt = ‘离职’ Or  ll_zt = ‘置戮’ THEN
  messagebox(ProfileString(“lang1.ini”,”Idxf”,”msg1″,””),ProfileString(“lang1.ini”,”Idxf”,”msg6″,””))
    IF ls_yyxf = “1” THEN playsound(ls_dir+”err_kff.wav”,0)
  st_4.Text =ProfileString(“lang1.ini”,”Idxf”,”msg6″,””)
 ELSE
  IF Dec(Trim(em_1.Text)) > Dec(ll_rzg) Or ls_rxfe + ll_xfje > Dec(ll_rzg) THEN
   messagebox(ProfileString(“lang1.ini”,”Idxf”,”msg1″,””),ProfileString(“lang1.ini”,”Idxf”,”msg10″,””)+ll_rzg+ProfileString(“lang1.ini”,”Idxf”,”msg13″,””))
   IF ls_yyxf = “1” THEN playsound(ls_dir+”err_rzg.wav”,0)
   st_4.Text =ProfileString(“lang1.ini”,”Idxf”,”msg10″,””)+ll_rzg+ProfileString(“lang1.ini”,”Idxf”,”msg13″,””)
  ELSE
   IF ll_yxfe > Long(ll_yzg) THEN
      messagebox(ProfileString(“lang1.ini”,”Idxf”,”msg1″,””),ProfileString(“lang1.ini”,”Idxf”,”msg11″,””)+ll_yzg+ProfileString(“lang1.ini”,”Idxf”,”msg13″,””))
    IF ls_yyxf = “1” THEN playsound(ls_dir+”err_yzg.wav”,0)
    st_4.Text =ProfileString(“lang1.ini”,”Idxf”,”msg11″,””)+ll_yzg+ProfileString(“lang1.ini”,”Idxf”,”msg13″,””)
   ELSE
    
    SELECT max(no_ber) INTO :ll_maxno FROM xf_xfjl
     Where bh = :ll_empbh;
    IF IsNull(ll_maxno) THEN ll_maxno = 0
    sle_1.Text = ll_gh;
    sle_3.Text = ll_xm;
    ll_newrow = dw_1.InsertRow(1)
    dw_1.SetItem(ll_newrow,”bh”,ll_empbh)
    dw_1.SetItem(ll_newrow,”xm”,ll_xm)
    dw_1.SetItem(ll_newrow,”bm”,ll_bm)
    dw_1.SetItem(ll_newrow,”kh”,ls_kh)
    dw_1.SetItem(ll_newrow,”no_ber”,ll_maxno + 1)
    dw_1.SetItem(ll_newrow,”xfdate”,ll_xftime)
    dw_1.SetItem(ll_newrow,”xftime”,ll_xfdate)
    dw_1.SetItem(ll_newrow,”xfje”,ll_xfje)
    dw_1.SetItem(ll_newrow,”xyje”,ll_yxfe)
    dw_1.SetItem(ll_newrow,”ysje”,ll_yxfe)
    dw_1.SetItem(ll_newrow,”xfjbh”,sle_8.Text)
    dw_1.SetItem(ll_newrow,”bz”,ll_gh)
     
    dw_1.Update()
    IF sqlca.SQLCode = 0 THEN
     COMMIT;
               st_4.Text =ProfileString(“lang1.ini”,”Idxf”,”msg7″,””) + ProfileString(“lang1.ini”,”Idxf”,”msg14″,””)
      else
               st_4.Text =ProfileString(“lang1.ini”,”Idxf”,”msg8″,””)
     return;
    END IF
   END IF
  END IF
 END IF
 IF ls_yyxf = “1” THEN playsound(ls_dir+”xxgl.wav”,0)
 em_1.SetFocus()
END IF

end event

event rbuttondown;This.Enabled = False
IF ls_yyxf = “1” THEN playsound(ls_dir+”err_jplr.wav”,0)
MessageBox(ProfileString(“lang1.ini”,”Idxf”,”msg1″,””),ProfileString(“lang1.ini”,”Idxf”,”msg9″,””))
This.Enabled = True
sle_2.Text = ”
sle_2.SetFocus()

end event

type st_2 from statictext within main_cs
integer x = 3237
integer y = 312
integer width = 366
integer height = 124
integer textsize = -18
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial”
long textcolor = 33554432
long backcolor = 67108864
string text = “卡号:”
boolean focusrectangle = false
end type

type sle_1 from singlelineedit within main_cs
integer x = 3602
integer y = 696
integer width = 974
integer height = 128
integer taborder = 20
integer textsize = -18
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial”
long textcolor = 33554432
boolean enabled = false
borderstyle borderstyle = stylelowered!
end type

event getfocus;this.selecttext(1,len(this.text))
end event

event modified;string ls_empname,ls_code
long   ll_empbh//,ll_row,ret
string ls_data
int i
long ll_rows
transaction TTT[]

IF KeyDown(KeyEnter!) THEN
// ll_empbh = long(this.text)
//   ls_data = profilestring(“hrms.ini”,”sqlca”,”Number”,””)
//   for i=1 to integer(ls_data)
//  
//       TTT[i]=CREATE transaction
//       TTT[i].DBMS = ProfileString(“hrms.ini”,”sqlca”,”dbms”,””)
//       TTT[i].Database = ProfileString(“hrms.ini”,”sqlca”,”Database”+string(i),””)
//       TTT[i].ServerName = ProfileString(“hrms.ini”,”sqlca”,”ServerName”+string(i),””)
//       TTT[i].LogId = ProfileString(“hrms.ini”,”sqlca”,”logid”+string(i),””)
//     TTT[i].LogPass=ProfileString(“hrms.ini”,”sqlca”,”LogPassword”+string(i),””)
//     TTT[i].DBPass=ProfileString(“hrms.ini”,”sqlca”,”DatabasePassword”+string(i),””)
//   TTT[i].AutoCommit = False
//       TTT[i].DBParm = “”
//       CONNECT USING TTT[i];
  
   dw_1.SetTransObject(TTT[i])
     dw_1.reset()
   ll_rows=dw_1.retrieve(ll_empbh)
//   if ll_rows=-1 or ll_rows=0  then 
//   CONTINUE
//   else
   dw_1.setredraw(true)
//   //sle_1.text=string(ll_empbh)
//    //sle_2.text=string(ll_data_number)
//   p_1.visible=false
//   st_4.visible=false
//   NO=1
   sle_3.text=dw_1.getitemstring(1,”xm”)
//   end if
//  next
this.selecttext(1,len(this.text))
sle_1.setfocus() 
end if
//dw_1.setfocus()
end event

type st_1 from statictext within main_cs
integer x = 3237
integer y = 704
integer width = 366
integer height = 124
integer textsize = -18
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial”
long textcolor = 33554432
long backcolor = 67108864
string text = “工号:”
boolean focusrectangle = false
end type

type gb_1 from groupbox within main_cs
integer x = 64
integer y = 1164
integer width = 2464
integer height = 320
integer taborder = 20
integer textsize = -14
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial”
long textcolor = 33554432
long backcolor = 67108864
string text = “查询个人消费记录”
end type

type p_1 from picture within main_cs
boolean visible = false
integer x = 59
integer y = 24
integer width = 3662
integer height = 1296
boolean bringtotop = true
string picturename = “D:/mj/back.jpg”
boolean focusrectangle = false
end type

type st_4 from statictext within main_cs
integer x = 64
integer y = 892
integer width = 4599
integer height = 236
boolean bringtotop = true
integer textsize = -36
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = “Arial”
long textcolor = 134217856
long backcolor = 134217752
string text = “请录入消费金额,并按回车键……”
alignment alignment = center!
boolean focusrectangle = false
end type

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/36010.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注