Автоматизация учета основных средств на предприятии

On Error GoTo LblErr

If nomer = 0 Then Exit Sub

s_folder = CurrentProject. Path

If Right$ (s_folder,

1) <> "\" Then s_folder = s_folder + "\"

s_folder = s_folder + "blanks\"

If Len (Dir$ (s_folder, vbDirectory)) = 0 Then

MsgBox "Путь к папке с бланками " & s_folder & " не обнаружен!", vbCritical + vbOKOn

ly

Exit Sub

End If

Set db = CurrentDb

Set Rec = db. OpenRecordset ("select * from Формы where НомерФорма = " & NomerForm, dbOpenSnapshot)

If Rec. RecordCount > 0 Then

StrFormName = Rec. Fields ("Наименование"). Value

StrFile = Rec. Fields ("Файл"). Value

Else

Set Rec = Nothing

MsgBox "Нет информации о форме №" & NomerForm & "!", vbCritical + vbOKOnly

Exit Sub

End If

Set Rec = Nothing

StrPath = s_folder + StrFile

If Len (Dir$ (StrPath)) = 0 Then

MsgBox "Файл бланка формы '" & StrFormName & "' " & StrPath & " не обнаружен!", vbCritical + vbOKOnly

Exit Sub

End If

Set Rec = db. OpenRecordset ("SELECT Параметры. *, Сотрудники. Сотрудник FROM Сотрудники INNER JOIN Параметры ON Сотрудники. НомерСотр = Параметры. ГлБухгалтер", dbOpenSnapshot)

If Rec. RecordCount > 0 Then

StrFirmName = Nz (Rec. Fields ("НаименованиеФирмы"). Value, "")

StrFirmOKPO = Nz (Rec. Fields ("ОКПО"). Value, "")

StrGlBuch = Nz (Rec. Fields ("Сотрудник"). Value, "")

StrFirmAddr = Nz (Rec. Fields ("ЮрАдрес"). Value, "")

StrFirmReq = Nz (Rec. Fields ("БанкРеквизиты"). Value, "")

Else

MsgBox "Общие параметры фирмы не занесены!", vbCritical + vbOKOnly

Exit Sub

End If

Set Rec = Nothing

Set Rec = db. OpenRecordset ("select * from запрос_АктыРемонта where НомерАктаРемонта = " & nomer, dbOpenSnapshot)

If Rec. RecordCount > 0 Then

NomerVnutr = Nz (Rec. Fields ("НомерВнутр"). Value, nomer)

StrDate = Nz (Rec. Fields ("ДатаАкта"). Value, Date)

StrTovar = Nz (Rec. Fields ("Товар"). Value, "")

StrInv = Nz (Rec. Fields ("ИнвКод"). Value, "")

StrPasp = Nz (Rec. Fields ("НомерПоПаспорту"). Value, "")

StrZav = Nz (Rec. Fields ("НомерЗавод"). Value, "")

StrIsp = Nz (Rec. Fields ("Исполнитель"). Value, "")

StrIspOKPO = Nz (Rec. Fields ("isp_okpo"). Value, "")

StrOper = Nz (Rec. Fields ("ВидРаботы"). Value, "")

StrdNomer = Nz (Rec. Fields ("НомерДоговора"). Value, "")

StrdDate = Nz (Rec. Fields ("ДатаДоговора"). Value, Date)

StrPDate1 = Nz (Rec. Fields ("ПериодРемПлан1"). Value, Date)

StrPDate2 = Nz (Rec. Fields ("ПериодРемПлан2"). Value, Date)

StrFDate1 = Nz (Rec. Fields ("ПериодРемФакт1"). Value, Date)

StrFDate2 = Nz (Rec. Fields ("ПериодРемФакт2"). Value, Date)

StrRukName = Nz (Rec. Fields ("ruk_name"). Value, "")

StrRukDolzh = Nz (Rec. Fields ("ruk_dolzhn"). Value, "")

StrDatePodp = Nz (Rec. Fields ("ДатаПодписи"). Value, Date)

StrOstStoim = Nz (Rec. Fields ("ОстСтоииость"). Value, 0)

StrFaktSrok = Nz (Rec. Fields ("ФактСрокЭкспл"). Value, 0)

StrOper = Nz (Rec. Fields ("ВидРаботы"). Value, "")

StrDemStoim = Nz (Rec. Fields ("СтоимДемонт"). Value, 0)

StrPlRab = Nz (Rec. Fields ("СтоимРаботПлан"). Value, 0)

StrPlRab2 = Nz (Rec. Fields ("СтоимРаботПлан2"). Value, 0)

StrFtRab = Nz (Rec. Fields ("СтоимРаботФакт"). Value, 0)

StrFtRab2 = Nz (Rec. Fields ("СтоимРаботФакт2"). Value, 0)

StrTransp = Nz (Rec. Fields ("СтоимТрансп"). Value, 0)

vbVip = Nz (Rec. Fields ("Полностью"). Value, True)

StrNoVip = Nz (Rec. Fields ("ЧтоНеПолн"). Value, "")

StrPredsName = Nz (Rec. Fields ("preds_name"). Value, "")

StrPredsDolzh = Nz (Rec. Fields ("preds_dolzhn"). Value, "")

StrChl1Name = Nz (Rec. Fields ("chlen1_name"). Value, "")

StrChl1Dolzh = Nz (Rec. Fields ("chlen1_dolzhn"). Value, "")

StrChl2Name = Nz (Rec. Fields ("chlen2_name"). Value, "")

StrChl2Dolzh = Nz (Rec. Fields ("chlen2_dolzhn"). Value, "")

StrPrinName = Nz (Rec. Fields ("prin_name"). Value, "")

StrPrinDolzh = Nz (Rec. Fields ("prin_dolzhn"). Value, "")

StrPrinDate = Nz (Rec. Fields ("ДатаПриемки"). Value, Date)

StrSdalName = Nz (Rec. Fields ("sdal_name"). Value, "")

StrSdalDolzh = Nz (Rec. Fields ("sdal_dolzhn"). Value, "")

StrSdalDate = Nz (Rec. Fields ("ДатаСдачи"). Value, Date)

StrGlBuch = Nz (Rec. Fields ("glbuch_name"). Value, "")

Else

MsgBox "Акт сдачи-приемки отремонт. ОС №" & nomer & " не найден!", vbCritical + vbOKOnly

Exit Sub

End If

Set Rec = Nothing

Set Rec = db. OpenRecordset ("select * from ВспомДата where НомерМес = " & Month (StrDatePodp), dbOpenSnapshot)

If Rec. RecordCount > 0 Then

StrMonthPodp = Nz (Rec. Fields ("НазвМес"). Value, "")

Else

StrMonthPodp = "нет названия"

End If

Set Rec = Nothing

Set Rec = db. OpenRecordset ("select * from ВспомДата where НомерМес = " & Month (StrPrinDate), dbOpenSnapshot)

If Rec. RecordCount > 0 Then

StrMonthPrin = Nz (Rec. Fields ("НазвМес"). Value, "")

Else

StrMonthPrin = "нет названия"

End If

Set Rec = Nothing

Set Rec = db. OpenRecordset ("select * from ВспомДата where НомерМес = " & Month (StrSdalDate), dbOpenSnapshot)

If Rec. RecordCount > 0 Then

StrMonthSdal = Nz (Rec. Fields ("НазвМес"). Value, "")

Else

StrMonthSdal = "нет названия"

End If

Set Rec = Nothing

Set oApp = CreateObject ("Excel. Application")

oApp. Workbooks. Open FileName: =StrPath, ReadOnly: =True

oApp. ActiveWorkbook. Sheets (1). Select

oApp. Cells (rFirmName, cFirmName). Value = StrFirmName

oApp. Cells (rFirmOKPO, cFirmOKPO). Value = StrFirmOKPO

oApp. Cells (rNomer, cNomer). Value = NomerVnutr

oApp. Cells (rDat, cDat). Value = Format$ (StrDate, "dd. mm. yyyy")

oApp. Cells (rIsp, cIsp). Value = StrIsp

oApp. Cells (rIspOKPO, cIspOKPO). Value = StrIspOKPO

oApp. Cells (rdNomer, cdNomer). Value = StrdNomer

Страница:  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15 
 16  17  18  19  20  21  22  23  24  25  26  27  28  29  30 
 31  32  33  34  35  36  37  38  39  40  41  42 


Другие рефераты на тему «Программирование, компьютеры и кибернетика»:

Поиск рефератов

Последние рефераты раздела

Copyright © 2010-2024 - www.refsru.com - рефераты, курсовые и дипломные работы