
- •Содержание
- •1.Теоретическая часть
- •1.1 Характеристика предприятия
- •1.2 Экономическая сущность задачи
- •1.3 Характеристика первичной документации
- •1.4 Техническое задание на разработку
- •Требования к входным данным
- •Требования к выходным данным:
- •2 Практическая часть
- •2.1 Проектирование ис
- •2.1.1 Проектирование структуры ис
- •2.1.2 Проектирование структуры бд
- •2.2 Программная реализация ис
- •2.2.1 Создание метаданных бд
- •2.2.2 Разработка интерфейса пользователя
- •2.2.3 Разработка форм ввода
- •2.2.4 Программы формирования выходных документов
- •2.2.5 Реализация сервисных функций
- •Создание справочной системы
2.2.3 Разработка форм ввода
Рис.2.11 Форма: sved_pred.scx
Формa INIT:
PUBLIC put
put=SYS(5)+ALLTRIM(SYS(2003))
SET PATH TO &put
SET TALK OFF
OPEN DATABASE 1
USE table1 EXCLUSIVE
thisform.Closable= .F.
WITH thisform
.grid1.RecordSource=.null.
.grid1.RecordSource="table1"
.txtpr.value=""
.txtad.value=""
.txtt.value=0
.txtinn.value=0
.txtrs.value=0
.txtkr.value=0
.txtnr.value=0
.txtdt.value={}
.txtgn.value=""
.txtgb.value=""
.txtpr.readonly=.t.
.txtad.readonly=.t.
.txtt.readonly=.t.
.txtinn.readonly=.t.
.txtrs.readonly=.t.
.txtkr.readonly=.t.
.txtnr.readonly=.t.
.txtgn.readonly=.t.
.txtgb.readonly=.t.
.txtdt.readonly=.t.
ENDWITH
WITH thisform.grid1
.coLUMN1.width=100
.coLUMN2.width=100
.coLUMN3.width=100
.coLUMN4.width=100
.coLUMN5.width=100
.coLUMN6.width=100
.coLUMN7.width=100
.coLUMN8.width=100
.coLUMN9.width=100
.coLUMN10.width=100
ENDWITH
thisform.Refresh
Формa KeyPress:
LPARAMETERS nKeyCode, nShiftAltCtrl
IF nKeyCode=27
IF MESSAGEBOX("Вы хотите выйти ?",4,"Внимание")=6
thisform.Release
ELSE
thisform.Refresh
ENDIF
ENDIF
Кнопка «Новая » (click):
WITH thisform
.txtpr.value=""
.txtad.value=""
.txtt.value=0
.txtinn.value=0
.txtrs.value=0
.txtkr.value=0
.txtnr.value=0
.txtgn.value=""
.txtgb.value=""
.txtdt.value={}
.txtpr.readonly=.f.
.txtad.readonly=.f.
.txtt.readonly=.f.
.txtinn.readonly=.f.
.txtrs.readonly=.f.
.txtkr.readonly=.f.
.txtnr.readonly=.f.
.txtgn.readonly=.f.
.txtgb.readonly=.f.
.txtdt.readonly=.f.
.refresh
ENDWITH
Кнопка «Сохранить» (click):
SET SAFETY OFF
IF thisform.txtpr.ReadOnly= .T.
MESSAGEBOX("Нажмите кнопку 'Новая'...",0,"Внимание !!!")
thisform.Refresh
ELSE
IF EMPTY(thisform.txtpr.Value)=.f. AND EMPTY(thisform.txtad.Value)=.f. AND EMPTY(thisform.txtt.Value)=.f. AND EMPTY(thisform.txtinn.Value)=.f. AND EMPTY(thisform.txtrs.Value)=.f. AND EMPTY(thisform.txtkr.Value)=.f. AND EMPTY(thisform.txtnr.Value)=.f.AND EMPTY(thisform.txtgn.Value)=.f.AND EMPTY(thisform.txtgb.Value)=.f. AND EMPTY(thisform.txtdt.Value)=.f.
SELECT table1
INDEX on pr TO table1.idx
IF SEEK(thisform.txtpr.Value)
IF MESSAGEBOX("Запись существует. Заменить ?",4,"Внимание !!!")=6
REPLACE pr WITH thisform.txtpr.Value, ad WITH thisform.txtad.Value,;
t WITH thisform.txtt.Value, inn WITH thisform.txtinn.Value,;
rs WITH thisform.txtrs.Value, kr WITH thisform.txtkr.Value,;
nr WITH thisform.txtnr.Value, gn WITH thisform.txtgn.Value, gb WITH thisform.txtgb.Value, dt WITH thisform.txtdt.Value
thisform.Refresh
WITH thisform
.txtpr.value=""
.txtad.value=""
.txtt.value=0
.txtinn.value=0
.txtrs.value=0
.txtkr.value=0
.txtnr.value=0
.txtgn.value=""
.txtgb.value=""
.txtdt.value={}
.txtpr.readonly=.t.
.txtad.readonly=.t.
.txtt.readonly=.t.
.txtinn.readonly=.t.
.txtrs.readonly=.t.
.txtkr.readonly=.t.
.txtnr.readonly=.t.
.txtgn.readonly=.t.
.txtgb.readonly=.t.
.txtdt.readonly=.t.
.refresh
ENDWITH
ELSE
WITH thisform
.txtpr.value=""
.txtad.value=""
.txtt.value=0
.txtinn.value=0
.txtrs.value=0
.txtkr.value=0
.txtnr.value=0
.txtgn.value=""
.txtgb.value=""
.txtdt.value={}
ENDWITH
thisform.Refresh
ENDIF
ELSE
pr1=thisform.txtpr.Value
ad1=thisform.txtad.Value
t1=thisform.txtt.Value
inn1=thisform.txtinn.Value
rs1=thisform.txtrs.Value
kr1=thisform.txtkr.Value
nr1=thisform.txtnr.Value
gn1=thisform.txtgn.Value
gb1=thisform.txtgb.Value
dt1=thisform.txtdt.Value
INSERT INTO table1(pr,ad,t,inn,rs,kr,nr,gn,gb,dt) VALUES (pr1,ad1,t1,inn1,rs1,kr1,nr1,gn1,gb1,dt1)
WITH thisform
.txtpr.value=""
.txtad.value=""
.txtt.value=0
.txtinn.value=0
.txtrs.value=0
.txtkr.value=0
.txtnr.value=0
.txtgn.value=""
.txtgb.value=""
.txtdt.value={}
.txtpr.readonly=.t.
.txtad.readonly=.t.
.txtt.readonly=.t.
.txtinn.readonly=.t.
.txtrs.readonly=.t.
.txtkr.readonly=.t.
.txtnr.readonly=.t.
.txtgn.readonly=.t.
.txtgb.readonly=.t.
.txtdt.readonly=.t.
.refresh
ENDWITH
ENDIF
ELSE
MESSAGEBOX("Заполните все поля...",0,"Внимание !!!")
WITH thisform
.txtpr.value=""
.txtad.value=""
.txtt.value=0
.txtinn.value=0
.txtrs.value=0
.txtkr.value=0
.txtnr.value=0
.txtgn.value=""
.txtgb.value=""
.txtdt.value={}
.refresh
ENDWITH
ENDIF
ENDIF
Кнопка «Удалить» (click):
IF MESSAGEBOX("Вы хотите удалить запись ?",4,"Внимание !!!")=6
SELECT table1
IF DELETED()
PACK
WITH thisform
.grid1.RecordSource=.null.
.grid1.RecordSource="table1"
.txtpr.value=""
.txtad.value=""
.txtt.value=0
.txtinn.value=0
.txtrs.value=0
.txtkr.value=0
.txtnr.value=0
.txtgn.value=""
.txtgb.value=""
.txtdt.value={}
.txtpr.readonly=.t.
.txtad.readonly=.t.
.txtt.readonly=.t.
.txtinn.readonly=.t.
.txtrs.readonly=.t.
.txtkr.readonly=.t.
.txtnr.readonly=.t.
.txtgn.readonly=.t.
.txtgb.readonly=.t.
.txtdt.readonly=.t.
.refresh
ENDWITH
WITH thisform.grid1
.coLUMN1.width=100
.coLUMN2.width=100
.coLUMN3.width=100
.coLUMN4.width=100
.coLUMN5.width=100
.coLUMN6.width=100
.coLUMN7.width=100
.coLUMN8.width=100
.coLUMN9.width=100
.coLUMN10.width=100
ENDWITH
ELSE
DELETE
PACK
WITH thisform
.grid1.RecordSource=.null.
.grid1.RecordSource="table1"
.txtpr.value=""
.txtad.value=""
.txtt.value=0
.txtinn.value=0
.txtrs.value=0
.txtkr.value=0
.txtnr.value=0
.txtgn.value=""
.txtgb.value=""
.txtdt.value={}
.txtpr.readonly=.t.
.txtad.readonly=.t.
.txtt.readonly=.t.
.txtinn.readonly=.t.
.txtrs.readonly=.t.
.txtkr.readonly=.t.
.txtnr.readonly=.t.
.txtgn.readonly=.t.
.txtgb.readonly=.t.
.txtdt.readonly=.t.
.refresh
ENDWITH
WITH thisform.grid1
.coLUMN1.width=100
.coLUMN2.width=100
.coLUMN3.width=100
.coLUMN4.width=100
.coLUMN5.width=100
.coLUMN6.width=100
.coLUMN7.width=100
.coLUMN8.width=100
.coLUMN9.width=100
.coLUMN10.width=100
ENDWITH
ENDIF
ELSE
WITH thisform
.txtpr.value=""
.txtad.value=""
.txtt.value=0
.txtinn.value=0
.txtrs.value=0
.txtkr.value=0
.txtnr.value=0
.txtgn.value=""
.txtgb.value=""
.txtdt.value={}
.txtpr.readonly=.t.
.txtad.readonly=.t.
.txtt.readonly=.t.
.txtinn.readonly=.t.
.txtrs.readonly=.t.
.txtkr.readonly=.t.
.txtnr.readonly=.t.
.txtgn.readonly=.t.
.txtgb.readonly=.t.
.txtdt.readonly=.t.
.refresh
ENDWITH
WITH thisform.grid1
.coLUMN1.width=100
.coLUMN2.width=100
.coLUMN3.width=100
.coLUMN4.width=100
.coLUMN5.width=100
.coLUMN6.width=100
.coLUMN7.width=100
.coLUMN8.width=100
.coLUMN9.width=100
.coLUMN10.width=100
ENDWITH
ENDIF
Кнопка «Выйти» (click):
IF MESSAGEBOX("Вы хотите выйти ?",4,"Внимание")=6
thisform.Release
ELSE
thisform.Refresh
ENDIF
Рис.2.12 Форма: sprav_sotr.scx
Формa INIT:
USE Таблица1 EXCLUSIVE
thisform.grid1.RecordSource=.null.
thisform.grid1.RecordSource='Таблица1'
thisform.grid1.column1.Width=100
thisform.grid1.column2.Width=300
thisform.grid1.column3.Width=160
thisform.grid1.column4.Width=160
thisform.grid1.ReadOnly= .T.
thisform.Text1.ReadOnly= .T.
thisform.Text2.ReadOnly= .T.
thisform.Text3.ReadOnly= .T.
thisform.Text4.ReadOnly= .T.
thisform.Text5.ReadOnly= .T.
thisform.Text7.ReadOnly= .T.
thisform.Text8.ReadOnly= .T.
thisform.Text9.ReadOnly= .f.
thisform.text1.Value=0
thisform.text2.Value=''
thisform.text3.Value=''
thisform.text4.Value=0
thisform.text5.Value=0
thisform.text7.Value=''
thisform.text8.Value=''
Thisform.Refresh()
Кнопка «Поиск» (click):
IF EMPTY (ALLTRIM(Thisform.Text9.Value))= .F.
SELECT Таблица1
CLOSE INDEXES
DELETE FILE Таблица1.idx
INDEX on tn TO Таблица1.idx
IF SEEK(ALLTRIM(Thisform.Text9.Value))
Thisform.Text9.Value=''
Thisform.Refresh()
ELSE
IF MESSAGEBOX('Запись ненайдена (Проверте регистры символов...)! Создать новую запись? ',8,'внимание !!!')=10
thisform.Text1.ReadOnly= .F.
thisform.Text2.ReadOnly= .f.
thisform.Text3.ReadOnly= .f.
thisform.Text4.ReadOnly= .f.
thisform.Text5.ReadOnly= .f.
thisform.Text7.ReadOnly= .f.
thisform.Text8.ReadOnly= .T.
thisform.Text1.Value=0
thisform.Text2.Value=''
thisform.Text3.Value=''
thisform.Text4.Value=0
thisform.Text5.Value=0
thisform.Text7.Value=''
thisform.Text8.Value=''
thisform.Refresh()
ELSE
thisform.Text9.readonly= .F.
thisform.Text9.Value=''
thisform.Refresh()
ENDIF
ENDIF
ELSE
MESSAGEBOX('Запись ненайдена (Проверте регистры символов...)! Введите данные !!!',0,'Внимание!!!')
thisform.Text9.Value=''
ENDIF
Кнопка «Новая » (click):
thisform.grid1.ReadOnly= .T.
thisform.text1.ReadOnly= .f.
thisform.text2.ReadOnly= .f.
thisform.text3.ReadOnly= .f.
thisform.text4.ReadOnly= .f.
thisform.text5.ReadOnly= .f.
thisform.text7.ReadOnly= .f.
thisform.text8.ReadOnly= .f.
thisform.text9.ReadOnly= .T.
thisform.text1.Value=0
thisform.text2.Value=''
thisform.text3.Value=''
thisform.text4.Value=0
thisform.text5.Value=0
thisform.text7.Value=''
thisform.text8.Value=''
Thisform.Refresh()
Кнопка «Сохранить» (click):
IF EMPTY (Thisform.Text1.Value)= .f.
CLOSE INDEXES
DELETE FILE Таблица1.idx
INDEX on tn TO Таблица1.idx
IF SEEK(Thisform.Text1.Value)
IF MESSAGEBOX('Запись существует !!! Заменить её ? ',8,'Внимание !!!')=10
SELECT Таблица1
REPLACE tn WITH thisform.Text1.Value, fio WITH thisform.Text2.Value, dol WITH thisform.Text3.Value, kold WITH thisform.Text4.Value, Stz WITH thisform.Text5.Value, adr WITH thisform.Text7.Value, obr WITH thisform.Text8.Value
thisform.grid1.ReadOnly= .T.
thisform.Text1.Value=0
thisform.Text2.Value=''
thisform.Text3.Value=''
thisform.Text4.Value=0
thisform.Text5.Value=0
thisform.Text7.Value=''
thisform.Text8.Value=''
MESSAGEBOX('Запись заменена !!! ',0,'Внимание !!!')
thisform.Refresh()
ELSE
SELECT Таблица1
APPEND BLANK
REPLACE tn WITH thisform.Text1.Value, fio WITH thisform.Text2.Value, dol WITH thisform.Text3.Value, kold WITH thisform.Text4.Value, Stz WITH thisform.Text5.Value, adr WITH thisform.Text7.Value, obr WITH thisform.Text8.Value
thisform.Refresh()
thisform.grid1.ReadOnly= .T.
thisform.Text1.Value=0
thisform.Text2.Value=''
thisform.Text3.Value=''
thisform.Text4.Value=0
thisform.Text5.Value=0
thisform.Text7.Value=''
thisform.Text8.Value=''
ENDIF
ELSE
SELECT Таблица1
APPEND BLANK
REPLACE tn WITH thisform.Text1.Value, fio WITH thisform.Text2.Value, dol WITH thisform.Text3.Value, kold WITH thisform.Text4.Value, Stz WITH thisform.Text5.Value, adr WITH thisform.Text7.Value, obr WITH thisform.Text8.Value
thisform.grid1.ReadOnly= .T.
thisform.Text1.Value=0
thisform.Text2.Value=''
thisform.Text3.Value=''
thisform.Text4.Value=0
thisform.Text5.Value=0
thisform.Text7.Value=''
thisform.Text8.Value=''
MESSAGEBOX('Запись добавленна !!! ',0,'Внимание !!!')
thisform.Refresh()
ENDIF
ELSE
MESSAGEBOX('Введите код !!! ',0,'Внимание !!!')
ENDIF
Кнопка «Отмена» (click):
thisform.grid1.ReadOnly= .T.
thisform.text1.ReadOnly= .T.
thisform.text2.ReadOnly= .T.
thisform.text3.ReadOnly= .T.
thisform.text4.ReadOnly= .T.
thisform.text5.ReadOnly= .T.
thisform.text7.ReadOnly= .T.
thisform.text8.ReadOnly= .T.
thisform.text9.ReadOnly= .F.
thisform.text1.Value=0
thisform.text2.Value=''
thisform.text3.Value=''
thisform.text4.Value=0
thisform.text5.Value=0
thisform.text7.Value=''
thisform.text8.Value=''
thisform.text9.Value=''
Кнопка «Выйти» (click):
CLOSE TABLES
Thisform.Release()
Рис.2.13 Форма: redsprav_sotr.scx
Кнопка «Изменить»(click):
IF MESSAGEBOX('Вы действительно хотите изменить запись ??? ',4,'Внимание !!!')=6
SELECT таблица1
tn1=tn
fio1=fio
dol1=dol
kold1=kold
stz1=stz
adr1=adr
obr1=obr
thisform.Text1.Value=tn1
thisform.Text2.Value=fio1
thisform.Text3.Value=dol1
thisform.Text4.Value=kold1
thisform.Text5.Value=stz1
thisform.Text7.Value=adr1
thisform.Text8.Value=obr1
WITH thisform
.Text1.readonly=.f.
.Text2.readonly=.f.
.Text3.readonly=.f.
.Text4.readonly=.f.
.Text5.readonly=.f.
.Text7.readonly=.f.
.Text8.readonly=.f.
.refresh
endwith
ELSE
thisform.Refresh
ENDIF
Кнопка «Удалить» (click):
IF MESSAGEBOX('Вы хотите удалить запись?',4,'ВНИМАНИЕ !!!')=6
SELECT Таблица1
DELETE
pack
thisform.grid1.RecordSource=.null.
thisform.grid1.RecordSource='Таблица1'
thisform.grid1.column1.Width=100
thisform.grid1.column2.Width=300
thisform.grid1.column3.Width=100
thisform.Grid1.ReadOnly= .T.
thisform.text1.ReadOnly= .T.
thisform.text2.ReadOnly= .T.
thisform.text3.ReadOnly= .T.
thisform.text4.ReadOnly= .T.
thisform.text5.ReadOnly= .T.
thisform.text7.ReadOnly= .T.
thisform.text8.ReadOnly= .T.
thisform.Text1.Value=0
thisform.Text2.Value=''
thisform.Text3.Value=''
thisform.Text4.Value=0
thisform.Text5.Value=0
thisform.Text7.Value=''
thisform.Text8.Value=''
thisform.Refresh()
ELSE
SELECT Таблица1
thisform.grid1.ReadOnly= .T.
thisform.text1.ReadOnly= .T.
thisform.text2.ReadOnly= .T.
thisform.text3.ReadOnly= .T.
thisform.text4.ReadOnly= .T.
thisform.text5.ReadOnly= .T.
thisform.text7.ReadOnly= .T.
thisform.text8.ReadOnly= .T.
thisform.Text1.Value=0
thisform.Text2.Value=''
thisform.Text3.Value=''
thisform.Text4.Value=0
thisform.Text5.Value=0
thisform.Text7.Value=''
thisform.Text8.Value=''
thisform.Refresh()
ENDIF
Кнопка «Отмена» (click):
thisform.grid1.ReadOnly= .T.
thisform.text1.ReadOnly= .T.
thisform.text2.ReadOnly= .T.
thisform.text3.ReadOnly= .T.
thisform.text4.ReadOnly= .T.
thisform.text5.ReadOnly= .T.
thisform.text7.ReadOnly= .T.
thisform.text8.ReadOnly= .T.
thisform.text9.ReadOnly= .F.
thisform.text1.Value=0
thisform.text2.Value=''
thisform.text3.Value=''
thisform.text4.Value=0
thisform.text5.Value=0
thisform.text7.Value=''
thisform.text8.Value=''
thisform.text9.Value=''
Кнопка «Применить»(click):
IF EMPTY(thisform.Text1.Value)=.t. AND thisform.Text1.ReadOnly= .T.
MESSAGEBOX("Нет объекта для сохранения...Нажмите 'изменить' !!!",0,"ВНИМАНИЕ !!!")
ELSE
IF MESSAGEBOX("Вы хотите применить изменения ?",4,"Внимание...")=6
SELECT Таблица1
REPLACE tn WITH thisform.Text1.Value, fio WITH thisform.Text2.Value, dol WITH thisform.Text3.Value, kold with thisform.Text4.Value, stz WITH thisform.Text5.Value, adr WITH thisform.Text7.Value, obr WITH thisform.Text8.Value
WITH thisform
.Text1.value=0
.Text2.value=""
.Text3.value=""
.Text4.value=0
.Text5.value=0
.Text7.value=""
.Text8.value=""
.Text1.readonly=.t.
.Text2.readonly=.t.
.Text3.readonly=.t.
.Text4.readonly=.t.
.Text5.readonly=.t.
.Text7.readonly=.t.
.Text8.readonly=.t.
.refresh
ENDWITH
ELSE
WITH thisform
.Text1.value=0
.Text2.value=""
.Text3.value=""
.Text4.value=0
.Text5.value=0
.Text7.value=""
.Text8.value=""
.Text1.readonly=.t.
.Text2.readonly=.t.
.Text3.readonly=.t.
.Text4.readonly=.t.
.Text5.readonly=.t.
.Text7.readonly=.t.
.Text8.readonly=.t.
.refresh
ENDWITH
ENDIF
endif
thisform.Refresh
Кнопка «Выход» (click):
CLOSE TABLES
Thisform.Release(
Рис.2.14 Форма: narad.scx
Формa INIT:
PUBLIC put
put=SYS(5)+ALLTRIM(SYS(2003))
SET PATH TO &put
SET TALK OFF
OPEN DATABASE 1
USE table2 EXCLUSIVE
thisform.Closable= .F.
WITH thisform
.grid1.RecordSource=.null.
.grid1.RecordSource="table2"
.txttn.value=0
.txtcex.value=0
.txtrab.value=""
.txtpr.value=""
.txtraz.value=0
.txtn.value=0
.txtrabo.value=""
.txted.value=""
.txtkol.value=0
.txtdt.value={}
.txttn.readonly=.t.
.txtcex.readonly=.t.
.txtrab.readonly=.t.
.txtpr.readonly=.t.
.txtraz.readonly=.t.
.txtn.readonly=.t.
.txtrabo.readonly=.t.
.txted.readonly=.t.
.txtkol.readonly=.t.
.txtdt.readonly=.t.
ENDWITH
WITH thisform.grid1
.coLUMN1.width=100
.coLUMN2.width=100
.coLUMN3.width=100
.coLUMN4.width=100
.coLUMN5.width=100
.coLUMN6.width=100
.coLUMN7.width=100
.coLUMN8.width=100
.coLUMN9.width=100
.coLUMN10.width=100
ENDWITH
thisform.Refresh
Формa KeyPress:
LPARAMETERS nKeyCode, nShiftAltCtrl
IF nKeyCode=27
IF MESSAGEBOX("Вы хотите выйти ?",4,"Внимание")=6
thisform.Release
ELSE
thisform.Refresh
ENDIF
ENDIF
Кнопка «Новая » (click):
WITH thisform
.txttn.value=0
.txtcex.value=0
.txtrab.value=""
.txtpr.value=""
.txtraz.value=0
.txtn.value=0
.txtrabo.value=""
.txted.value=""
.txtkol.value=0
.txtdt.value={}
.txttn.readonly=.f.
.txtcex.readonly=.f.
.txtrab.readonly=.f.
.txtpr.readonly=.f.
.txtraz.readonly=.f.
.txtn.readonly=.f.
.txtrabo.readonly=.f.
.txted.readonly=.f.
.txtkol.readonly=.f.
.txtdt.readonly=.f.
.refresh
ENDWITH
Кнопка «Сохранить» (click):
SET SAFETY OFF
IF thisform.txtn.ReadOnly= .T.
MESSAGEBOX("Нажмите кнопку 'Новая'...",0,"Внимание !!!")
thisform.Refresh
ELSE
IF EMPTY(thisform.txtn.Value)=.f. AND EMPTY(thisform.txttn.Value)=.f. AND EMPTY(thisform.txtcex.Value)=.f. AND EMPTY(thisform.txtrab.Value)=.f. AND EMPTY(thisform.txtpr.Value)=.f. AND EMPTY(thisform.txtraz.Value)=.f. AND EMPTY(thisform.txtkol.Value)=.f.AND EMPTY(thisform.txtrabo.Value)=.f.AND EMPTY(thisform.txted.Value)=.f. AND EMPTY(thisform.txtdt.Value)=.f.
SELECT table2
INDEX on n TO table2.idx
IF SEEK(thisform.txtn.Value)
IF MESSAGEBOX("Запись существует. Заменить ?",4,"Внимание !!!")=6
REPLACE n WITH thisform.txtn.Value, tn WITH thisform.txttn.Value,;
cex WITH thisform.txtcex.Value, rab WITH thisform.txtrab.Value,;
pr WITH thisform.txtpr.Value, raz WITH thisform.txtraz.Value,;
kol WITH thisform.txtkol.Value, rabo WITH thisform.txtrabo.Value, ed WITH thisform.txted.Value, dt WITH thisform.txtdt.Value
thisform.Refresh
WITH thisform
.txttn.value=0
.txtcex.value=0
.txtrab.value=""
.txtpr.value=""
.txtraz.value=0
.txtn.value=0
.txtrabo.value=""
.txted.value=""
.txtkol.value=0
.txtdt.value={}
.txttn.readonly=.t.
.txtcex.readonly=.t.
.txtrab.readonly=.t.
.txtpr.readonly=.t.
.txtraz.readonly=.t.
.txtn.readonly=.t.
.txtrabo.readonly=.t.
.txted.readonly=.t.
.txtkol.readonly=.t.
.txtdt.readonly=.t.
.refresh
ENDWITH
ELSE
WITH thisform
.txttn.value=0
.txtcex.value=0
.txtrab.value=""
.txtpr.value=""
.txtraz.value=0
.txtn.value=0
.txtrabo.value=""
.txted.value=""
.txtkol.value=0
.txtdt.value={}
ENDWITH
thisform.Refresh
ENDIF
ELSE
tn1=thisform.txttn.Value
cex1=thisform.txtcex.Value
rab1=thisform.txtrab.Value
pr1=thisform.txtpr.Value
raz1=thisform.txtraz.Value
n1=thisform.txtn.Value
rabo1=thisform.txtrabo.Value
ed1=thisform.txted.Value
kol1=thisform.txtkol.Value
dt1=thisform.txtdt.Value
INSERT INTO table2(tn,cex,rab,pr,raz,n,kol,rabo,ed,dt) VALUES (tn1,cex1,rab1,pr1,raz1,n1,kol1,rabo1,ed1,dt1)
WITH thisform
.txttn.value=0
.txtcex.value=0
.txtrab.value=""
.txtpr.value=""
.txtraz.value=0
.txtn.value=0
.txtrabo.value=""
.txted.value=""
.txtkol.value=0
.txtdt.value={}
.txttn.readonly=.t.
.txtcex.readonly=.t.
.txtrab.readonly=.t.
.txtpr.readonly=.t.
.txtraz.readonly=.t.
.txtn.readonly=.t.
.txtrabo.readonly=.t.
.txted.readonly=.t.
.txtkol.readonly=.t.
.txtdt.readonly=.t.
.refresh
ENDWITH
ENDIF
ELSE
MESSAGEBOX("Заполните все поля...",0,"Внимание !!!")
WITH thisform
.txttn.value=0
.txtcex.value=0
.txtrab.value=""
.txtpr.value=""
.txtraz.value=0
.txtn.value=0
.txtrabo.value=""
.txted.value=""
.txtkol.value=0
.txtdt.value={}
.refresh
ENDWITH
ENDIF
ENDIF
Кнопка «Отмена» (click):
WITH thisform
.txttn.value=0
.txtcex.value=0
.txtrab.value=""
.txtpr.value=""
.txtraz.value=0
.txtn.value=0
.txtdt.value={}
.txtrabo.value=""
.txted.value=""
.txtkol.value=0
.txttn.readonly=.t.
.txtcex.readonly=.t.
.txtrab.readonly=.t.
.txtpr.readonly=.t.
.txtraz.readonly=.t.
.txtn.readonly=.t.
.txtdt.readonly=.t.
.txtrabo.readonly=.t.
.txted.readonly=.t.
.txtkol.readonly=.t.
.refresh
ENDWITH
Кнопка «Удалить» (click):
IF MESSAGEBOX("Вы хотите удалить запись ?",4,"Внимание !!!")=6
SELECT table2
IF DELETED()
PACK
WITH thisform
.grid1.RecordSource=.null.
.grid1.RecordSource="table2"
.txttn.value=0
.txtcex.value=0
.txtrab.value=""
.txtpr.value=""
.txtraz.value=0
.txtn.value=0
.txtdt.value={}
.txtrabo.value=""
.txted.value=""
.txtkol.value=0
.txttn.readonly=.t.
.txtcex.readonly=.t.
.txtrab.readonly=.t.
.txtpr.readonly=.t.
.txtraz.readonly=.t.
.txtn.readonly=.t.
.txtdt.readonly=.t.
.txtrabo.readonly=.t.
.txted.readonly=.t.
.txtkol.readonly=.t.
.refresh
ENDWITH
WITH thisform.grid1
.coLUMN1.width=100
.coLUMN2.width=100
.coLUMN3.width=100
.coLUMN4.width=100
.coLUMN5.width=100
.coLUMN6.width=100
.coLUMN7.width=100
.coLUMN8.width=100
.coLUMN9.width=100
.coLUMN10.width=100
ENDWITH
ELSE
DELETE
PACK
WITH thisform
.grid1.RecordSource=.null.
.grid1.RecordSource="table2"
.txttn.value=0
.txtcex.value=0
.txtrab.value=""
.txtpr.value=""
.txtraz.value=0
.txtn.value=0
.txtdt.value={}
.txtrabo.value=""
.txted.value=""
.txtkol.value=0
.txttn.readonly=.t.
.txtcex.readonly=.t.
.txtrab.readonly=.t.
.txtpr.readonly=.t.
.txtraz.readonly=.t.
.txtn.readonly=.t.
.txtdt.readonly=.t.
.txtrabo.readonly=.t.
.txted.readonly=.t.
.txtkol.readonly=.t.
.refresh
ENDWITH
WITH thisform.grid1
.coLUMN1.width=100
.coLUMN2.width=100
.coLUMN3.width=100
.coLUMN4.width=100
.coLUMN5.width=100
.coLUMN6.width=100
.coLUMN7.width=100
.coLUMN8.width=100
.coLUMN9.width=100
.coLUMN10.width=100
ENDWITH
ENDIF
ELSE
WITH thisform
.txttn.value=0
.txtcex.value=0
.txtrab.value=""
.txtpr.value=""
.txtraz.value=0
.txtn.value=0
.txtdt.value={}
.txtrabo.value=""
.txted.value=""
.txtkol.value=0
.txttn.readonly=.t.
.txtcex.readonly=.t.
.txtrab.readonly=.t.
.txtpr.readonly=.t.
.txtraz.readonly=.t.
.txtn.readonly=.t.
.txtdt.readonly=.t.
.txtrabo.readonly=.t.
.txted.readonly=.t.
.txtkol.readonly=.t.
.refresh
ENDWITH
WITH thisform.grid1
.coLUMN1.width=100
.coLUMN2.width=100
.coLUMN3.width=100
.coLUMN4.width=100
.coLUMN5.width=100
.coLUMN6.width=100
.coLUMN7.width=100
.coLUMN8.width=100
.coLUMN9.width=100
.coLUMN10.width=100
ENDWITH
ENDIF
Кнопка «Изменить»(click):
IF MESSAGEBOX("Вы хотите изменить запись ?",4,"Внимание...")=6
SELECT table2
tn1=tn
cex1=cex
rab1=rab
pr1=pr
raz1=raz
n1=n
dt1=dt
rabo1=rabo
ed1=ed
kol1=kol
thisform.txttn.Value=tn1
thisform.txtcex.Value=cex1
thisform.txtrab.Value=rab1
thisform.txtpr.Value=pr1
thisform.txtraz.Value=raz1
thisform.txtn.Value=n1
thisform.txtdt.Value=dt1
thisform.txtrabo.Value=rabo1
thisform.txted.Value=ed1
thisform.txtkol.Value=kol1
WITH thisform
.txttn.readonly=.f.
.txtcex.readonly=.f.
.txtrab.readonly=.f.
.txtpr.readonly=.f.
.txtraz.readonly=.f.
.txtn.readonly=.f.
.txtdt.readonly=.f.
.txtrabo.readonly=.f.
.txted.readonly=.f.
.txtkol.readonly=.f.
.refresh
ENDWITH
ELSE
thisform.Refresh
ENDIF
Кнопка «Применить»(click):
IF EMPTY(thisform.txtn.Value)=.t. AND thisform.txtn.ReadOnly= .T.
MESSAGEBOX("Нет объекта для сохранения...Нажмите 'изменить' !!!",0,"ВНИМАНИЕ !!!")
ELSE
IF MESSAGEBOX("Вы хотите применить изменения ?",4,"Внимание...")=6
SELECT table2
REPLACE n WITH thisform.txtn.Value, tn WITH thisform.txttn.Value,;
cex WITH thisform.txtcex.Value, rab WITH thisform.txtrab.Value,;
pr WITH thisform.txtpr.Value, raz WITH thisform.txtraz.Value,;
dt WITH thisform.txtdt.Value, rabo WITH thisform.txtrabo.Value, ed WITH thisform.txted.Value, kol WITH thisform.txtkol.Value
WITH thisform
.txttn.value=0
.txtcex.value=0
.txtrab.value=""
.txtpr.value=""
.txtraz.value=0
.txtn.value=0
.txtdt.value={}
.txtrabo.value=""
.txted.value=""
.txtkol.value=0
.txttn.readonly=.t.
.txtcex.readonly=.t.
.txtrab.readonly=.t.
.txtpr.readonly=.t.
.txtraz.readonly=.t.
.txtn.readonly=.t.
.txtdt.readonly=.t.
.txtrabo.readonly=.t.
.txted.readonly=.t.
.txtkol.readonly=.t.
.refresh
ENDWITH
ELSE
WITH thisform
.txttn.value=0
.txtcex.value=0
.txtrab.value=""
.txtpr.value=""
.txtraz.value=0
.txtn.value=0
.txtdt.value={}
.txtrabo.value=""
.txted.value=""
.txtkol.value=0
.txttn.readonly=.t.
.txtcex.readonly=.t.
.txtrab.readonly=.t.
.txtpr.readonly=.t.
.txtraz.readonly=.t.
.txtn.readonly=.t.
.txtdt.readonly=.t.
.txtrabo.readonly=.t.
.txted.readonly=.t.
.txtkol.readonly=.t.
.refresh
ENDWITH
ENDIF
ENDIF
Кнопка «Поиск» (click):
SET SAFETY OFF
IF EMPTY(thisform.text1.Value)=.t.
MESSAGEBOX("Введите данные для поиска...",0,"Внимание!")
ELSE
CLOSE INDEXES
SELECT table2
INDEX on n TO table2.idx
*stroka=upper(thisform.text1.Value)
stroka=thisform.text1.Value
IF seek (stroka)
MESSAGEBOX("Запись найдена!",0,"Внимание!")
thisform.text1.Value=0
thisform.Refresh
ELSE
MESSAGEBOX("Запись ненайдена!",0,"Внимание!")
thisform.text1.Value=0
thisform.Refresh
ENDIF
ENDIF
Кнопка «Export в HTML» (click):
codepage=1251
ctxtfile = PUTFILE('Имя файла:', 'report', 'html')
htxtfile = FCREATE(ctxtfile)
SELECT table2
coutstring ="<html><head><title>Отчёт</title></head><body bgcolor=#bcdbcd><table border=1>" +;
"<tr><td>Наряд №</td><td>Таб.ном.</td><td>Цех</td><td>Сотрудник</td><td>Профессия</td><td>Разряд</td><td>Дата</td><td>Работа</td><td>ед.изм.</td><td>Количество</td></tr>"
SCAN
coutstring =coutstring+ "<tr><td>"+STR(n) + "</td><td>"+STR(tn) + "</td><td>"+STR(cex) + "</td><td>"+rab + "</td><td>"+pr + "</td><td>"+STR(raz) + "</td><td>"+DTOC(dt) + "</td><td>"+rabo + "</td><td>"+ed + "</td><td>"+STR(kol) + "</td></tr>"
ENDSCAN
coutstring =coutstring+ "</table></body></html>"
nWriteResult = FPUTS(htxtfile,coutstring)
FCLOSE(htxtfile)
browser=CREATEOBJECT('InternetExplorer.Application')
browser.visible=.t.
browser.Navigate('&ctxtfile')
Кнопка «Отчет в Excel» (click) :
PUBLIC w
w=SYS(5)+ALLTRIM(SYS(2003))
SET PATH TO &w
SELECT table2
xls1=CREATEOBJECT("Excel.Application")
xls1.visible=.t.
xls1.workbooks.add
xls1=xls1.Sheets[1]
SELECT table2
xls1.cells(1,1).value='Наряд №'
xls1.cells(1,2).value='Таб.ном.'
xls1.cells(1,3).value='Цех'
xls1.cells(1,4).value='Сотрудник'
xls1.cells(1,5).value='Профессия'
xls1.cells(1,6).value='Разряд'
xls1.cells(1,7).value='Дата'
xls1.cells(1,8).value='Работа'
xls1.cells(1,9).value='ед.изм.'
xls1.cells(1,10).value='Количество'
nRov=1
SCAN
nRov=nRov+1
xls1.cells(nRov,1).value=table2.n
xls1.cells(nRov,2).value=table2.tn
xls1.cells(nRov,3).value=table2.cex
xls1.cells(nRov,4).value=table2.rab
xls1.cells(nRov,5).value=table2.pr
xls1.cells(nRov,6).value=table2.raz
xls1.cells(nRov,7).value=table2.dt
xls1.cells(nRov,8).value=table2.rabo
xls1.cells(nRov,9).value=table2.ed
xls1.cells(nRov,10).value=table2.kol
ENDSCAN
Поле Got Focus:
IF thisform.txtTn.ReadOnly=.f.
SELECT таблица1
index on tn to tn.idx
LOCATE FOR tn=thisform.txttn.Value
a=fio
b=dol
c=stz
thisform.txtrab.Value=a
thisform.txtpr.Value=b
thisform.txtRaz.Value=c
ENDIF
Рис.2.15 Форма: m_list.scx
Формa INIT:
PUBLIC put
put=SYS(5)+ALLTRIM(SYS(2003))
SET PATH TO &put
SET TALK OFF
OPEN DATABASE 1
USE table3 EXCLUSIVE
thisform.Closable= .F.
WITH thisform
.grid1.RecordSource=.null.
.grid1.RecordSource="table3"
.txttn.value=0
.txtn_par.value=0
.txtrabo.value=""
.txtraz.value=0
.txtkol.value=0
.txtdetal.value=""
.txtrab.value=""
.txtvrem.value=0
.txtrac.value=0
.txtdt.value={}
.txtn.value=0
.txttn.readonly=.t.
.txtn_par.readonly=.t.
.txtrabo.readonly=.t.
.txtraz.readonly=.t.
.txtkol.readonly=.t.
.txtdetal.readonly=.t.
.txtrab.readonly=.t.
.txtvrem.readonly=.t.
.txtrac.readonly=.t.
.txtdt.readonly=.t.
.txtn.readonly=.t.
ENDWITH
WITH thisform.grid1
.coLUMN1.width=100
.coLUMN2.width=100
.coLUMN3.width=100
.coLUMN4.width=100
.coLUMN5.width=100
.coLUMN6.width=100
.coLUMN7.width=100
.coLUMN8.width=100
.coLUMN9.width=100
.coLUMN10.width=100
.coLUMN11.width=100
ENDWITH
thisform.Refresh
Формa KeyPress:
LPARAMETERS nKeyCode, nShiftAltCtrl
IF nKeyCode=27
IF MESSAGEBOX("Вы хотите выйти ?",4,"Внимание")=6
thisform.Release
ELSE
thisform.Refresh
ENDIF
ENDIF
Кнопка «Новая » (click):
WITH thisform
.txttn.value=0
.txtn_par.value=0
.txtrabo.value=""
.txtraz.value=0
.txtkol.value=0
.txtdetal.value=""
.txtrab.value=""
.txtvrem.value=0
.txtrac.value=0
.txtdt.value={}
.txtn.value=0
.txttn.readonly=.f.
.txtn_par.readonly=.f.
.txtrabo.readonly=.f.
.txtraz.readonly=.f.
.txtkol.readonly=.f.
.txtdetal.readonly=.f.
.txtrab.readonly=.f.
.txtvrem.readonly=.f.
.txtrac.readonly=.f.
.txtdt.readonly=.f.
.txtn.readonly=.f.
.refresh
ENDWITH
Кнопка «Сохранить» (click):
SET SAFETY OFF
IF thisform.txttn.ReadOnly= .T.
MESSAGEBOX("Нажмите кнопку 'Новая'...",0,"Внимание !!!")
thisform.Refresh
ELSE
IF EMPTY(thisform.txtn.Value)=.f. AND EMPTY(thisform.txttn.Value)=.f. AND EMPTY(thisform.txtn_par.Value)=.f. AND EMPTY(thisform.txtrabo.Value)=.f. AND EMPTY(thisform.txtraz.Value)=.f. AND EMPTY(thisform.txtkol.Value)=.f. AND EMPTY(thisform.txtdetal.Value)=.f.AND EMPTY(thisform.txtrab.Value)=.f.AND EMPTY(thisform.txtvrem.Value)=.f. AND EMPTY(thisform.txtrac.Value)=.f. AND EMPTY(thisform.txtdt.Value)=.f.
SELECT table3
INDEX on tn TO table3.idx
IF SEEK(thisform.txttn.Value)
IF MESSAGEBOX("Запись существует. Заменить ?",4,"Внимание !!!")=6
REPLACE n WITH thisform.txtn.Value, tn WITH thisform.txttn.Value,;
rabo WITH thisform.txtrabo.Value, raz WITH thisform.txtraz.Value,;
kol WITH thisform.txtkol.Value, detal WITH thisform.txtdetal.Value,;
rab WITH thisform.txtrab.Value, vrem WITH thisform.txtvrem.Value, rac WITH thisform.txtrac.Value, dt WITH thisform.txtdt.Value, n_par WITH thisform.txtn_par.Value
thisform.Refresh
WITH thisform
.txttn.value=0
.txtn_par.value=0
.txtrabo.value=""
.txtraz.value=0
.txtkol.value=0
.txtdetal.value=""
.txtrab.value=""
.txtvrem.value=0
.txtrac.value=0
.txtdt.value={}
.txtn.value=0
.txttn.readonly=.t.
.txtn_par.readonly=.t.
.txtrabo.readonly=.t.
.txtraz.readonly=.t.
.txtkol.readonly=.t.
.txtdetal.readonly=.t.
.txtrab.readonly=.t.
.txtvrem.readonly=.t.
.txtrac.readonly=.t.
.txtdt.readonly=.t.
.txtn.readonly=.t.
.refresh
ENDWITH
ELSE
WITH thisform
.txttn.value=0
.txtn_par.value=0
.txtrabo.value=""
.txtraz.value=0
.txtkol.value=0
.txtdetal.value=""
.txtrab.value=""
.txtvrem.value=0
.txtrac.value=0
.txtdt.value={}
.txtn.value=0
ENDWITH
thisform.Refresh
ENDIF
ELSE
tn1=thisform.txttn.Value
n_par1=thisform.txtn_par.Value
rab1=thisform.txtrab.Value
detal1=thisform.txtdetal.Value
raz1=thisform.txtraz.Value
n1=thisform.txtn.Value
rabo1=thisform.txtrabo.Value
rac1=thisform.txtrac.Value
kol1=thisform.txtkol.Value
dt1=thisform.txtdt.Value
vrem1=thisform.txtvrem.Value
INSERT INTO table3(tn,n_par,rab,detal,raz,n,rabo,rac,kol,dt,vrem) VALUES (tn1,n_par1,rab1,detal1,raz1,n1,rabo1,rac1,kol1,dt1,vrem1)
WITH thisform
.txttn.value=0
.txtn_par.value=0
.txtrabo.value=""
.txtraz.value=0
.txtkol.value=0
.txtdetal.value=""
.txtrab.value=""
.txtvrem.value=0
.txtrac.value=0
.txtdt.value={}
.txtn.value=0
.txttn.readonly=.t.
.txtn_par.readonly=.t.
.txtrabo.readonly=.t.
.txtraz.readonly=.t.
.txtkol.readonly=.t.
.txtdetal.readonly=.t.
.txtrab.readonly=.t.
.txtvrem.readonly=.t.
.txtrac.readonly=.t.
.txtdt.readonly=.t.
.txtn.readonly=.t.
.refresh
ENDWITH
ENDIF
ELSE
MESSAGEBOX("Заполните все поля...",0,"Внимание !!!")
WITH thisform
.txttn.value=0
.txtn_par.value=0
.txtrabo.value=""
.txtraz.value=0
.txtkol.value=0
.txtdetal.value=""
.txtrab.value=""
.txtvrem.value=0
.txtrac.value=0
.txtdt.value={}
.txtn.value=0
.refresh
ENDWITH
ENDIF
ENDIF
Кнопка «Отмена» (click):
WITH thisform
.txttn.value=0
.txtn_par.value=0
.txtrabo.value=""
.txtraz.value=0
.txtkol.value=0
.txtdetal.value=""
.txtrab.value=""
.txtvrem.value=0
.txtrac.value=0
.txtdt.value={}
.txtn.value=0
.txttn.readonly=.t.
.txtn_par.readonly=.t.
.txtrabo.readonly=.t.
.txtraz.readonly=.t.
.txtkol.readonly=.t.
.txtdetal.readonly=.t.
.txtrab.readonly=.t.
.txtvrem.readonly=.t.
.txtrac.readonly=.t.
.txtdt.readonly=.t.
.txtn.readonly=.t.
.refresh
ENDWITH
Кнопка «Удалить» (click):
IF MESSAGEBOX("Вы хотите удалить запись ?",4,"Внимание !!!")=6
SELECT table3
IF DELETED()
PACK
WITH thisform
.grid1.RecordSource=.null.
.grid1.RecordSource="table3"
.txttn.value=0
.txtn_par.value=0
.txtrabo.value=""
.txtraz.value=0
.txtkol.value=0
.txtdetal.value=""
.txtrab.value=""
.txtvrem.value=0
.txtrac.value=0
.txtdt.value={}
.txtn.value=0
.txttn.readonly=.t.
.txtn_par.readonly=.t.
.txtrabo.readonly=.t.
.txtraz.readonly=.t.
.txtkol.readonly=.t.
.txtdetal.readonly=.t.
.txtrab.readonly=.t.
.txtvrem.readonly=.t.
.txtrac.readonly=.t.
.txtdt.readonly=.t.
.txtn.readonly=.t.
.refresh
ENDWITH
WITH thisform.grid1
.coLUMN1.width=100
.coLUMN2.width=100
.coLUMN3.width=100
.coLUMN4.width=100
.coLUMN5.width=100
.coLUMN6.width=100
.coLUMN7.width=100
.coLUMN8.width=100
.coLUMN9.width=100
.coLUMN10.width=100
.coLUMN11.width=100
ENDWITH
ELSE
DELETE
PACK
WITH thisform
.grid1.RecordSource=.null.
.grid1.RecordSource="table3"
.txttn.value=0
.txtn_par.value=0
.txtrabo.value=""
.txtraz.value=0
.txtkol.value=0
.txtdetal.value=""
.txtrab.value=""
.txtvrem.value=0
.txtrac.value=0
.txtdt.value={}
.txtn.value=0
.txttn.readonly=.t.
.txtn_par.readonly=.t.
.txtrabo.readonly=.t.
.txtraz.readonly=.t.
.txtkol.readonly=.t.
.txtdetal.readonly=.t.
.txtrab.readonly=.t.
.txtvrem.readonly=.t.
.txtrac.readonly=.t.
.txtdt.readonly=.t.
.txtn.readonly=.t.
.refresh
ENDWITH
WITH thisform.grid1
.coLUMN1.width=100
.coLUMN2.width=100
.coLUMN3.width=100
.coLUMN4.width=100
.coLUMN5.width=100
.coLUMN6.width=100
.coLUMN7.width=100
.coLUMN8.width=100
.coLUMN9.width=100
.coLUMN10.width=100
.coLUMN11.width=100
ENDWITH
ENDIF
ELSE
WITH thisform
.txttn.value=0
.txtn_par.value=0
.txtrabo.value=""
.txtraz.value=0
.txtkol.value=0
.txtdetal.value=""
.txtrab.value=""
.txtvrem.value=0
.txtrac.value=0
.txtdt.value={}
.txtn.value=0
.txttn.readonly=.t.
.txtn_par.readonly=.t.
.txtrabo.readonly=.t.
.txtraz.readonly=.t.
.txtkol.readonly=.t.
.txtdetal.readonly=.t.
.txtrab.readonly=.t.
.txtvrem.readonly=.t.
.txtrac.readonly=.t.
.txtdt.readonly=.t.
.txtn.readonly=.t.
.refresh
ENDWITH
WITH thisform.grid1
.coLUMN1.width=100
.coLUMN2.width=100
.coLUMN3.width=100
.coLUMN4.width=100
.coLUMN5.width=100
.coLUMN6.width=100
.coLUMN7.width=100
.coLUMN8.width=100
.coLUMN9.width=100
.coLUMN10.width=100
.coLUMN11.width=100
ENDWITH
ENDIF
Кнопка «Изменить»(click):
IF MESSAGEBOX("Вы хотите изменить запись ?",4,"Внимание...")=6
SELECT table3
tn1=tn
n_par1=n_par
rab1=rab
detal1=detal
raz1=raz
n1=tn
rabo1=rabo
rac1=rac
kol1=kol
dt1=dt
vrem1=vrem
thisform.txttn.Value=tn1
thisform.txtn_par.Value=n_par1
thisform.txtrab.Value=rab1
thisform.txtdetal.Value=detal1
thisform.txtraz.Value=raz1
thisform.txtn.Value=n1
thisform.txtrabo.Value=rabo1
thisform.txtrac.Value=rac1
thisform.txtkol.Value=kol1
thisform.txtdt.Value=dt1
thisform.txtvrem.Value=vrem1
WITH thisform
.txttn.readonly=.f.
.txtn_par.readonly=.f.
.txtrabo.readonly=.f.
.txtraz.readonly=.f.
.txtkol.readonly=.f.
.txtdetal.readonly=.f.
.txtrab.readonly=.f.
.txtvrem.readonly=.f.
.txtrac.readonly=.f.
.txtdt.readonly=.f.
.txtn.readonly=.f.
.refresh
ENDWITH
ELSE
thisform.Refresh
ENDIF
Кнопка «Применить»(click):
IF EMPTY(thisform.txtn.Value)=.t. AND thisform.txtn.ReadOnly= .T.
MESSAGEBOX("Нет объекта для сохранения...Нажмите 'изменить' !!!",0,"ВНИМАНИЕ !!!")
ELSE
IF MESSAGEBOX("Вы хотите применить изменения ?",4,"Внимание...")=6
SELECT table3
REPLACE n WITH thisform.txtn.Value, tn WITH thisform.txttn.Value,;
rabo WITH thisform.txtrabo.Value, raz WITH thisform.txtraz.Value,;
kol WITH thisform.txtkol.Value, detal WITH thisform.txtdetal.Value,;
rab WITH thisform.txtrab.Value, vrem WITH thisform.txtvrem.Value, rac WITH thisform.txtrac.Value, dt WITH thisform.txtdt.Value, n_par WITH thisform.txtn_par.Value
WITH thisform
.txttn.value=0
.txtn_par.value=0
.txtrabo.value=""
.txtraz.value=0
.txtkol.value=0
.txtdetal.value=""
.txtrab.value=""
.txtvrem.value=0
.txtrac.value=0
.txtdt.value={}
.txtn.value=0
.txttn.readonly=.t.
.txtn_par.readonly=.t.
.txtrabo.readonly=.t.
.txtraz.readonly=.t.
.txtkol.readonly=.t.
.txtdetal.readonly=.t.
.txtrab.readonly=.t.
.txtvrem.readonly=.t.
.txtrac.readonly=.t.
.txtdt.readonly=.t.
.txtn.readonly=.t.
.refresh
ENDWITH
ELSE
WITH thisform
.txttn.value=0
.txtn_par.value=0
.txtrabo.value=""
.txtraz.value=0
.txtkol.value=0
.txtdetal.value=""
.txtrab.value=""
.txtvrem.value=0
.txtrac.value=0
.txtdt.value={}
.txtn.value=0
.txttn.readonly=.t.
.txtn_par.readonly=.t.
.txtrabo.readonly=.t.
.txtraz.readonly=.t.
.txtkol.readonly=.t.
.txtdetal.readonly=.t.
.txtrab.readonly=.t.
.txtvrem.readonly=.t.
.txtrac.readonly=.t.
.txtdt.readonly=.t.
.txtn.readonly=.t.
.refresh
ENDWITH
ENDIF
ENDIF
Кнопка «Выход» (click):
IF MESSAGEBOX("Вы хотите выйти ?",4,"Внимание")=6
thisform.Release
ELSE
thisform.Refresh
ENDIF
Кнопка «Поиск » (click):
SET SAFETY OFF
IF EMPTY(thisform.text1.Value)=.t.
MESSAGEBOX("Введите данные для поиска...",0,"Внимание!")
ELSE
CLOSE INDEXES
SELECT table3
INDEX on n TO table3.idx
*stroka=upper(thisform.text1.Value)
stroka=thisform.text1.Value
IF seek (stroka)
MESSAGEBOX("Запись найдена!",0,"Внимание!")
thisform.text1.Value=0
thisform.Refresh
ELSE
MESSAGEBOX("Запись ненайдена!",0,"Внимание!")
thisform.text1.Value=0
thisform.Refresh
ENDIF
ENDIF
Кнопка «Export в HTML» (click):
codepage=1251
ctxtfile = PUTFILE('Имя файла:', 'report', 'html')
htxtfile = FCREATE(ctxtfile)
SELECT table3
coutstring ="<html><head><title>Отчёт</title></head><body bgcolor=#bcdbcd><table border=1>" +;
"<tr><td>Маршрутный лист №</td><td>Таб.ном.</td><td>Ном.партии</td><td>Процесс</td><td>Разряд</td><td>Количество</td><td>Деталь</td><td>Рабочий</td><td>Время</td><td>Расценка</td><td>Дата</td></tr>"
SCAN
coutstring =coutstring+ "<tr><td>"+STR(n) + "</td><td>"+STR(tn) + "</td><td>"+STR(n_par) + "</td><td>"+rabo + "</td><td>"+STR(raz) + "</td><td>"+STR(kol) + "</td><td>"+detal + "</td><td>"+rab + "</td><td>"+STR(vrem) + "</td><td>"+STR(rac)+ "</td><td>"+dtoc(dt) + "</td></tr>"
ENDSCAN
coutstring =coutstring+ "</table></body></html>"
nWriteResult = FPUTS(htxtfile,coutstring)
FCLOSE(htxtfile)
browser=CREATEOBJECT('InternetExplorer.Application')
browser.visible=.t.
browser.Navigate('&ctxtfile')
Кнопка «Отчет в Excel» (click) :
PUBLIC w
w=SYS(5)+ALLTRIM(SYS(2003))
SET PATH TO &w
SELECT table3
xls1=CREATEOBJECT("Excel.Application")
xls1.visible=.t.
xls1.workbooks.add
xls1=xls1.Sheets[1]
SELECT table3
xls1.cells(1,1).value='Маршрутный лист №'
xls1.cells(1,2).value='Таб.ном.'
xls1.cells(1,3).value='Номер партии'
xls1.cells(1,4).value='Процесс'
xls1.cells(1,5).value='Разряд'
xls1.cells(1,6).value='Количество'
xls1.cells(1,7).value='Деталь'
xls1.cells(1,8).value='Рабочий'
xls1.cells(1,9).value='Время'
xls1.cells(1,10).value='Расценка'
xls1.cells(1,11).value='Дата'
nRov=1
SCAN
nRov=nRov+1
xls1.cells(nRov,1).value=table3.n
xls1.cells(nRov,2).value=table3.tn
xls1.cells(nRov,3).value=table3.n_par
xls1.cells(nRov,4).value=table3.rabo
xls1.cells(nRov,5).value=table3.raz
xls1.cells(nRov,6).value=table3.kol
xls1.cells(nRov,7).value=table3.detal
xls1.cells(nRov,8).value=table3.rab
xls1.cells(nRov,9).value=table3.vrem
xls1.cells(nRov,10).value=table3.rac
xls1.cells(nRov,11).value=table3.dt
ENDSCAN
Поле Got Focus:
IF thisform.txttn.ReadOnly=.f.
SELECT таблица1
index on tn to tn.idx
LOCATE FOR tn=thisform.txttn.Value
a=fio
b=stz
thisform.txtRab.Value=a
thisform.txtRaz.Value=b
ENDIF
Рис.2.16 Форма:
otchet.scx
Поле Text2:
m2=''
m1=0
m1=MONTH(thisform.Text1.Value)
IF m1<=12
*****
IF m1=1
m2='ЯНВАРЬ'
ENDIF
IF m1=2
m2='ФЕВРАЛЬ'
ENDIF
IF m1=3
m2='МАРТ'
ENDIF
IF m1=4
m2='АПРЕЛЬ'
ENDIF
IF m1=5
m2='МАЙ'
ENDIF
IF m1=6
m2='ИЮНЬ'
ENDIF
IF m1=7
m2='ИЮЛЬ'
ENDIF
IF m1=8
m2='АВГУСТ'
ENDIF
IF m1=9
m2='СЕНТЯБРЬ'
ENDIF
IF m1=10
m2='ОКТЯБРЬ'
ENDIF
IF m1=11
m2='НОЯБРЬ'
ENDIF
IF m1=12
m2='ДЕКАБРЬ'
ENDIF
Thisform.Refresh()
****
ELSE
MESSAGEBOX('Такого Месяца НЕТ !!!',0,'ВНИМАНИЕ!!!')
m2=''
Thisform.Refresh()