Программное обеспечение пункта обмена валюты банка
Рефераты >> Программирование и компьютеры >> Программное обеспечение пункта обмена валюты банка

len(strtran(MO[TT],"~","")))

L_hidecurs()

return 0

endif

next

else

L_hidecurs()

return 0

endif

endif

if iif(ORIENT,(COLMN>=COLROW.AND.COLMN<=COLROW + ;

len(strtran( MO[INDN],"~","")) .AND. ;

ROWMN<>ROWMO).or.KEYPRESSED,(ROWMN=COLROW.AND.;

COLMN<>COLMO).or.KEYPRESSED)

T1=.F.

if ORIENT.and.KL=0

TEST=ascan(MC,ROWMN)

if TEST<>0

T1=.T.

endif

elseif .not.ORIENT.and.KL=0

TEST=INDO

for TT=1 to COUN

if COLMN>=MC[TT].and.COLMN<=MC[TT]+len(strtran(MO[TT],"~",""))

TEST=TT

T1=.T.

exit

endif

next

elseif KL>0

T1=.T.

endif

if T1

do case

case KL=5.or.KL=19

INDN=iif(INDN=1,COUN,INDN-1)

case KL=24.or.KL=4

INDN=iif(INDN=COUN,1,INDN+1)

case KL>=32.and.KL<=255

STROKE="~"+chr(KL)+"~"

for II=1 to COUN

if at(STROKE,MO[II])<>0

INDN=II

keyboard chr(13)

exit

endif

next

otherwise

INDN=TEST

endcase

setcolor(CLRN)

L_hidecurs()

@ iif(ORIENT,MC[INDO],COLROW),iif(ORIENT,COLROW,MC[INDO]);

SAY strtran(MO[INDO],"~","")

if (POS:=at("~",MO[INDO]))>0

CL=setcolor(COLORN)

@ iif(ORIENT,MC[INDO],COLROW),iif(ORIENT,COLROW+POS-1,MC[INDO]+;

POS-1) SAY substr(MO[INDO],POS+1,1)

setcolor(CL)

endif

if SAYHELP

setcolor(At_M0_N)

@ 24,(80-len(ME[INDN]))/2 SAY ME[INDN]

endif

setcolor(CLRS)

@ iif(ORIENT,MC[INDN],COLROW),iif(ORIENT,COLROW,MC[INDN]);

SAY strtran(MO[INDN],"~","")

if (POS:=at("~",MO[INDN]))>0

setcolor(COLORS)

@ iif(ORIENT,MC[INDN],COLROW),iif(ORIENT,COLROW+POS-1,MC[INDN]+POS-1)

SAY substr(MO[INDN],POS+1,1)

endif

L_showcurs()

INDO=INDN

ROWMO=ROWMN

COLMO=COLMN

if STAT=0

loop

endif

endif

elseif COLMN>=COLROW

do case

case STAT=1

for TT=1 to COUN

if iif(ORIENT,COLMN>=COLROW.and.COLMN<=COLROW+;

len(strtran(MO[TT],"~","")).and.ascan(MC,ROWMN)<>0,;

ROWMN=COLROW.and.COLMN>=MC[TT].and.COLMN<=MC[TT]+;

len(strtran(MO[TT],"~","")))

L_hidecurs()

return INDN

endif

next

case STAT=2

for TT=1 to COUN

if iif(ORIENT,COLMN>=COLROW.and.COLMN<=COLROW+;

len(strtran(MO[TT],"~","")).and.ascan(MC,ROWMN)<>0,;

ROWMN=COLROW.and.COLMN>=MC[TT].and.COLMN<=MC[TT]+;

len(strtran(MO[TT],"~","")))

L_hidecurs()

return 0

endif

next

endcase

endif

enddo

return 0

Вспомогательные функции

Функция переключения вида курсора

Function FINS

FINSERT=.not.FINSERT

readinsert(FINSERT)

if setcursor()<>0

CUR_STYLE=iif(FINSERT,2,1)

setcursor(CUR_STYLE)

endif

clear type

return 0

Функция перевода строки в верхний регистр

Function UpperR(String)

local SRC:={"а","б","в","г","д","е","ё","ж","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ч","ш","щ","ь","ы","ъ","э","ю","я"," "},;

DST:={"А","Б","В","Г","Д","Е","Ё","Ж","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","Ч","Ш","Щ","Ь","Ы","Ъ","Э","Ю","Я"," "},;

STR:="",KEY:="",INDEXKEY,I

for I=1 to len(STRING)

KEY=substr(STRING,I,1)

if (INDEXKEY:=ascan(SRC,KEY))<>0

STR=STR+DST[INDEXKEY]

else

STR=STR+KEY

endif

next

return STR

Функция контроля выхода

Function DOORS

private CLR,ME

CLR=setcolor()

clear type

ME=1

ME=_err(07,02,"Вы желаете завершить работу ?","","",;

" ~Y~es "," ~N~o ","")

if ME=1.or.ME=-1

close databases

set color to

clear

set printer to

setcursor(1)

showtime()

keyboard chr(0)

L_showcurs()

return .T.

else

setcolor(CLR)

return .F.

endif

return .T.

Функция перевода числовой величины в строку «Сумма прописью»

Function NUMSTRING

parameters NUM1,CODE_CUR

local MR:={.T.,.T.,.F.,.T.},CL,;

MG:={{"" ,"" ,"" ,"" },;

{"миллиард" ,"миллион" ,"тысяча","" },;

{"миллиарда" ,"миллиона" ,"тысячи","" },;

{"миллиардов","миллионов","тысяч" ,"" }},;

SO:=0,DE:=0,ED:=0,TX,NUM,OBL

OBL=select()

if pcount()<2

CODE_CUR=0

endif

use (DATROAD+"Currency") index (DATROAD+"Currency") alias CUR new

seek CODE_CUR

if found()

/*MG[1,4]=alltrim(LONG_NAME0)

MG[2,4]=alltrim(LONG_NAME0)

MG[3,4]=alltrim(LONG_NAME1)

MG[4,4]=alltrim(LONG_NAME2)*/

/*if upperR(substr(trim(LONG_NAME0),len(trim(LONG_NAME0)),1))="А"*/

MR:={.T.,.T.,.F.,.T.}

/*endif*/

endif

Man_Woman=.F.

STROK=""

GSTROK=""

for I=12 to 3 step -3

NUM=val(substr(str(NUM1,12),I-2,3))

Man_Woman=MR[I/3]

SO=int(NUM/100)

DE=int((NUM-SO*100)/10)

ED=NUM-SO*100-DE*10

TX=4

do case

case ED=1

TX=2

case ED>1.and.ED<=4

TX=3

otherwise

TX=4

endcase

if (DE*10+ED>4.and.DE*10+ED<21)

TX=4

endif

TITLE=GetShort_Name(CODE_CUR)

SUBTITLE=MG[TX,I/3]

STROK=num2str(NUM,Man_Woman,SO,DE,ED)

GSTROK=iif(!empty(STROK).or.I=12,STROK+" "+SUBTITLE,"")+;

" "+GSTROK

next

GSTROK=alltrim(strtran(GSTROK," "," "))

GSTROK=upperR(substr(GSTROK,1,1))+substr(GSTROK,2)

use

select(OBL)

return GSTROK+" "+TITLE

Функция построения строки «Суммы прописью»

Function NUM2STR

PARAMETERS in_num,Man_Woman,SO,DE,ED

local UNITS[37]

UNITS[ 1] = ""

UNITS[ 2] = iif(Man_Woman,"один","одна")


Страница: