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

Организационно-экономическая характеристика предметной области. Описание компании ООО "Алеф", анализ административной и хозяйственной деятельности предприятия. Автоматизация процесса учета основных средств с помощью комплекса комплекс УСН 1С Бухгалтерия.

Рубрика Программирование, компьютеры и кибернетика
Вид дипломная работа
Язык русский
Дата добавления 01.06.2010
Размер файла 3,6 M

Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже

Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.

Application. SysCmd acSysCmdInitMeter, "Вывод информации о товарах", 100

oApp. ActiveWorkbook. Sheets (1). Select

StrItog = 0

Set RecList = db. OpenRecordset ("select * from запрос_ВнутренниеНаклТовары where НомерНакл = " & nomer, dbOpenSnapshot)

NRecord = RecList. RecordCount

If NRecord > 0 Then

RecList. MoveLast

NRecord = RecList. RecordCount

RecList. MoveFirst

i = 0

oApp. ActiveWorkbook. Sheets (1). Select

p = rSh1_1 - 1: p2 = rSh1_2

While Not RecList. EOF

i = i + 1

p = p + 1

Application. SysCmd acSysCmdUpdateMeter, i / NRecord * 100

If p > p2 Then

oApp. ActiveWorkbook. Sheets (2). Select

p = rSh2_1: p2 = rSh2_2

End If

s_Sum = Nz (RecList. Fields ("Сумма"). Value, 0)

oApp. Cells (p, cNomer). Value = i

oApp. Cells (p, cTovar). Value = Nz (RecList. Fields ("Товар"). Value, "")

oApp. Cells (p, cYear). Value = Nz (RecList. Fields ("ГодВыпуска"). Value, Year (Date))

oApp. Cells (p, cInv). Value = Nz (RecList. Fields ("ИнвКод"). Value, Year (Date))

oApp. Cells (p, cKol). Value = Nz (RecList. Fields ("Количество"). Value, 0)

oApp. Cells (p, cCena). Value = Format$ (Nz (RecList. Fields ("ЦенаРозн"). Value, 0), "0.00")

oApp. Cells (p, cSum). Value = Format$ (s_Sum, "0.00")

StrItog = StrItog + s_Sum

RecList. MoveNext

Wend

Else

MsgBox "Для накладной №" & nomer & " нет перечня товаров!", vbCritical + vbOKOnly

Exit Sub

End If

Set RecList = Nothing

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

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

oApp. Cells (rPodrazdName1, cPodrazdName1). Value = StrPodrazdName1

oApp. Cells (rPodrazdOKPO1, cPodrazdOKPO1). Value = StrPodrazdOKPO1

oApp. Cells (rPodrazdName2, cPodrazdName2). Value = StrPodrazdName2

oApp. Cells (rPodrazdOKPO2, cPodrazdOKPO2). Value = StrPodrazdOKPO2

oApp. Cells (rNomerNakl, cNomerNakl). Value = StrNomer

oApp. Cells (rDateNakl, cDateNakl). Value = Format$ (StrDate, "dd. mm. yyyy")

oApp. ActiveWorkbook. Sheets (2). Select

oApp. Cells (rSumItog, cSumItog). Value = " " & Format$ (StrItog, "0.00")

oApp. Cells (rSotrDolzh1, cSotrDolzh1). Value = StrSotrDolzh1

oApp. Cells (rSotrName1, cSotrName1). Value = StrSotrName1

oApp. Cells (rSotrNomer1, cSotrNomer1). Value = StrSotrNomer1

oApp. Cells (rDatDay1, cDatDay1). Value = Format$ (StrDate_s, "dd")

oApp. Cells (rDatMonth1, cDatMonth1). Value = StrMonth1

oApp. Cells (rDatYear1, cDatYear1). Value = Right$ (Format$ (StrDate_s, "yyyy"),

1)

oApp. Cells (rSotrDolzh2, cSotrDolzh2). Value = StrSotrDolzh2

oApp. Cells (rSotrName2, cSotrName2). Value = StrSotrName2

oApp. Cells (rSotrNomer2, cSotrNomer2). Value = StrSotrNomer2

oApp. Cells (rDatDay2, cDatDay2). Value = Format$ (StrDate_p, "dd")

oApp. Cells (rDatMonth2, cDatMonth2). Value = StrMonth2

oApp. Cells (rDatYear2, cDatYear2). Value = Right$ (Format$ (StrDate_p, "yyyy"),

1)

oApp. Cells (rPrim1, cPrim). Value = Left$ (StrPrim, nSymbPrim)

StrPrim = Mid$ (StrPrim, nSymbPrim + 1)

i = rPrim2_1

While Len (StrPrim) > 0

oApp. Cells (i, cPrim2). Value = Left$ (StrPrim, nSymbPrim2)

StrPrim = Mid$ (StrPrim, nSymbPrim2 + 1)

i = i + 1

If i > rPrim2_2 Then GoTo lb_ex

Wend

lb_ex:

oApp. Cells (rGlBuch, cGlBuch). Value = StrGlBuch

ex:

Application. SysCmd acSysCmdRemoveMeter

If Not (oApp Is Nothing) Then oApp. Visible = True

Set Rec = Nothing

Set RecList = Nothing

Set oApp = Nothing

Set db = Nothing

Exit Sub

LblErr:

MsgBox Err. Description, vbCritical + vbOKOnly

GoTo ex

End Sub

Код модуля OS3

Option Compare Database

Option Explicit

Private Const NomerForm As Long = 5

Private Const cFirmName As Byte = 7

Private Const rFirmName As Integer = 7

Private Const cFirmOKPO As Byte = 88

Private Const rFirmOKPO As Integer = 7

Private Const cNomer As Byte = 36

Private Const rNomer As Integer = 15

Private Const cDat As Byte = 48

Private Const rDat As Integer = 15

Private Const cIsp As Integer = 13

Private Const rIsp As Integer = 11

Private Const cIspOKPO As Integer = 88

Private Const rIspOKPO As Integer = 11

Private Const cdNomer As Integer = 88

Private Const rdNomer As Integer = 12

Private Const cdDate As Integer = 88

Private Const rdDate As Integer = 13

Private Const cPDate1 As Integer = 88

Private Const rPDate1 As Integer = 14

Private Const cPDate2 As Integer = 88

Private Const rPDate2 As Integer = 15

Private Const cFDate1 As Integer = 88

Private Const rFDate1 As Integer = 16

Private Const cFDate2 As Integer = 88

Private Const rFDate2 As Integer = 17

Private Const cRukDolzh As Byte = 61

Private Const rRukDolzh As Integer = 20

Private Const cRukName As Byte = 85

Private Const rRukName As Integer = 20

Private Const cDatRukDay As Byte = 54

Private Const rDatRukDay As Integer = 22

Private Const cDatRukMon As Byte = 58

Private Const rDatRukMon As Integer = 22

Private Const cDatRukYear As Byte = 71

Private Const rDatRukYear As Integer = 22

Private Const cTovar As Byte = 6

Private Const rTovar As Integer = 29

Private Const cInv As Byte = 30

Private Const rInv As Integer = 29

Private Const cPasp As Byte = 45

Private Const rPasp As Integer = 29

Private Const cZav As Byte = 60

Private Const rZav As Integer = 29

Private Const cOstStoim As Byte = 75

Private Const rOstStoim As Integer = 29

Private Const cFaktSrok As Byte = 90

Private Const rFaktSrok As Integer = 29

Private Const cTovar2 As Byte = 6

Private Const rTovar2 As Integer = 39

Private Const cOper As Byte = 20

Private Const rOper As Integer = 39

Private Const cDemStoim As Byte = 30

Private Const rDemStoim As Integer = 39

Private Const cPlRab As Byte = 40

Private Const rPlRab As Integer = 39

Private Const cPlRab2 As Byte = 50

Private Const rPlRab2 As Integer = 39

Private Const cFtRab As Byte = 60

Private Const rFtRab As Integer = 39

Private Const cFtRab2 As Byte = 70

Private Const rFtRab2 As Integer = 39

Private Const cTransp As Byte = 80

Private Const rTransp As Integer = 39

Private Const ciDemStoim As Byte = 30

Private Const riDemStoim As Integer = 41

Private Const ciPlRab As Byte = 40

Private Const riPlRab As Integer = 41

Private Const ciPlRab2 As Byte = 50

Private Const riPlRab2 As Integer = 41

Private Const ciFtRab As Byte = 60

Private Const riFtRab As Integer = 41

Private Const ciFtRab2 As Byte = 70

Private Const riFtRab2 As Integer = 41

Private Const ciTransp As Byte = 80

Private Const riTransp As Integer = 41

Private Const cVip1 As Byte = 34

Private Const rVip1 As Integer = 3

Private Const cVip2 As Byte = 34

Private Const rVip2 As Integer = 4

Private Const cVipInf As Byte = 44

Private Const rVipInf As Integer = 3

Private Const cPredsDolzh As Byte = 17

Private Const rPredsDolzh As Integer = 13

Private Const cChl1Dolzh As Byte = 17

Private Const rChl1Dolzh As Integer = 15

Private Const cChl2Dolzh As Byte = 17

Private Const rChl2Dolzh As Integer = 17

Private Const cPredsName As Byte = 51

Private Const rPredsName As Integer = 13

Private Const cChl1Name As Byte = 51

Private Const rChl1Name As Integer = 15

Private Const cChl2Name As Byte = 51

Private Const rChl2Name As Integer = 17

Private Const cPrinDolzh As Byte = 17

Private Const rPrinDolzh As Integer = 30

Private Const cPrinName As Byte = 51

Private Const rPrinName As Integer = 30

Private Const cDatPrinDay As Byte = 79

Private Const rDatPrinDay As Integer = 30

Private Const cDatPrinMon As Byte = 83

Private Const rDatPrinMon As Integer = 30

Private Const cDatPrinYear As Byte = 96

Private Const rDatPrinYear As Integer = 30

Private Const cSdalDolzh As Byte = 17

Private Const rSdalDolzh As Integer = 22

Private Const cSdalName As Byte = 51

Private Const rSdalName As Integer = 22

Private Const cDatSdalDay As Byte = 79

Private Const rDatSdalDay As Integer = 22

Private Const cDatSdalMon As Byte = 83

Private Const rDatSdalMon As Integer = 22

Private Const cDatSdalYear As Byte = 96

Private Const rDatSdalYear As Integer = 22

Private Const сGlBuch As Byte = 30

Private Const rGlBuch As Integer = 38

Sub PrintFormOS3 (ByVal nomer As Long)

Dim db As Database, Rec As DAO. Recordset, RecList As DAO. Recordset

Dim oApp As Object

Dim StrFormName As String

Dim StrFile As String, s_folder As String, StrPath As String

Dim StrGlBuch As String

Dim StrFirmName As String, StrFirmOKPO As String, StrFirmAddr As String, StrFirmReq As String

Dim NomerVnutr As String, StrDate As Date

Dim StrTovar As String, StrInv As String

Dim StrPasp As String, StrZav As String

Dim StrIsp As String, StrIspOKPO As String

Dim StrOper As String, StrdNomer As String, StrdDate As Date

Dim StrPDate1 As Date, StrPDate2 As Date

Dim StrFDate1 As Date, StrFDate2 As Date

Dim StrRukName As String, StrRukDolzh As String

Dim StrDatePodp As Date

Dim StrOstStoim As Double, StrFaktSrok As Long

Dim StrDemStoim As Double, StrPlRab As Double, StrPlRab2 As Double

Dim StrFtRab As Double, StrFtRab2 As Double, StrTransp As Double

Dim vbVip As Boolean, StrNoVip As String

Dim StrPredsName As String, StrPredsDolzh As String

Dim StrChl1Name As String, StrChl1Dolzh As String

Dim StrChl2Name As String, StrChl2Dolzh As String

Dim StrPrinName As String, StrPrinDolzh As String

Dim StrSdalName As String, StrSdalDolzh As String

Dim StrPrinDate As Date, StrSdalDate As Date

Dim StrMonthPodp As String, StrMonthPrin As String, StrMonthSdal As String

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 + vbOKOnly

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

oApp. Cells (rdDate, cdDate). Value = Format$ (StrdDate, "dd. mm. yyyy")

oApp. Cells (rPDate1, cPDate1). Value = Format$ (StrPDate1, "dd. mm. yyyy")

oApp. Cells (rPDate2, cPDate2). Value = Format$ (StrPDate2, "dd. mm. yyyy")

oApp. Cells (rFDate1, cFDate1). Value = Format$ (StrFDate1, "dd. mm. yyyy")

oApp. Cells (rFDate2, cFDate2). Value = Format$ (StrFDate2, "dd. mm. yyyy")

oApp. Cells (rRukName, cRukName). Value = StrRukName

oApp. Cells (rRukDolzh, cRukDolzh). Value = StrRukDolzh

oApp. Cells (rDatRukDay, cDatRukDay). Value = Format$ (StrDatePodp, "dd")

oApp. Cells (rDatRukMon, cDatRukMon). Value = StrMonthPodp

oApp. Cells (rDatRukYear, cDatRukYear). Value = Right$ (Format$ (StrDatePodp, "yyyy"),

1)

oApp. Cells (rInv, cInv). Value = StrInv

oApp. Cells (rPasp, cPasp). Value = StrPasp

oApp. Cells (rZav, cZav). Value = StrZav

oApp. Cells (rTovar, cTovar). Value = StrTovar

oApp. Cells (rTovar2, cTovar2). Value = StrTovar

oApp. Cells (rOstStoim, cOstStoim). Value = Format$ (StrOstStoim, "0.00")

oApp. Cells (rFaktSrok, cFaktSrok). Value = StrFaktSrok & "мес."

oApp. Cells (rOper, cOper). Value = StrOper

oApp. Cells (rDemStoim, cDemStoim). Value = Format$ (StrDemStoim, "0.00")

oApp. Cells (rPlRab, cPlRab). Value = Format$ (StrPlRab, "0.00")

oApp. Cells (rPlRab2, cPlRab2). Value = Format$ (StrPlRab2, "0.00")

oApp. Cells (rFtRab, cFtRab). Value = Format$ (StrFtRab, "0.00")

oApp. Cells (rFtRab2, cFtRab2). Value = Format$ (StrFtRab2, "0.00")

oApp. Cells (rTransp, cTransp). Value = Format$ (StrTransp, "0.00")

oApp. Cells (riDemStoim, ciDemStoim). Value = Format$ (StrDemStoim, "0.00")

oApp. Cells (riPlRab, ciPlRab). Value = Format$ (StrPlRab, "0.00")

oApp. Cells (riPlRab2, ciPlRab2). Value = Format$ (StrPlRab2, "0.00")

oApp. Cells (riFtRab, ciFtRab). Value = Format$ (StrFtRab, "0.00")

oApp. Cells (riFtRab2, ciFtRab2). Value = Format$ (StrFtRab2, "0.00")

oApp. Cells (riTransp, ciTransp). Value = Format$ (StrTransp, "0.00")

oApp. ActiveWorkbook. Sheets (2). Select

If vbVip = True Then

oApp. Cells (rVip1, cVip1). Font. Bold = True

oApp. Cells (rVip2, cVip2). Font. Bold = False

oApp. Cells (rVipInf, cVipInf). Value = ""

Else

oApp. Cells (rVip1, cVip1). Font. Bold = False

oApp. Cells (rVip2, cVip2). Font. Bold = True

oApp. Cells (rVipInf, cVipInf). Value = StrNoVip

End If

oApp. Cells (rPredsName, cPredsName). Value = StrPredsName

oApp. Cells (rPredsDolzh, cPredsDolzh). Value = StrPredsDolzh

oApp. Cells (rChl1Name, cChl1Name). Value = StrChl1Name

oApp. Cells (rChl1Dolzh, cChl1Dolzh). Value = StrChl1Dolzh

oApp. Cells (rChl2Name, cChl2Name). Value = StrChl2Name

oApp. Cells (rChl2Dolzh, cChl2Dolzh). Value = StrChl2Dolzh

oApp. Cells (rPrinName, cPrinName). Value = StrPrinName

oApp. Cells (rPrinDolzh, cPrinDolzh). Value = StrPrinDolzh

oApp. Cells (rDatPrinDay, cDatPrinDay). Value = Format$ (StrPrinDate, "dd")

oApp. Cells (rDatPrinMon, cDatPrinMon). Value = StrMonthPrin

oApp. Cells (rDatPrinYear, cDatPrinYear). Value = Right$ (Format$ (StrPrinDate, "yyyy"),

1)

oApp. Cells (rSdalName, cSdalName). Value = StrSdalName

oApp. Cells (rSdalDolzh, cSdalDolzh). Value = StrSdalDolzh

oApp. Cells (rDatSdalDay, cDatSdalDay). Value = Format$ (StrSdalDate, "dd")

oApp. Cells (rDatSdalMon, cDatSdalMon). Value = StrMonthSdal

oApp. Cells (rDatSdalYear, cDatSdalYear). Value = Right$ (Format$ (StrSdalDate, "yyyy"),

1)

oApp. Cells (rGlBuch, сGlBuch). Value = StrGlBuch

ex:

Application. SysCmd acSysCmdRemoveMeter

If Not (oApp Is Nothing) Then oApp. Visible = True

Set Rec = Nothing

Set RecList = Nothing

Set oApp = Nothing

Set db = Nothing

Exit Sub

LblErr:

MsgBox Err. Description, vbCritical + vbOKOnly

GoTo ex

End Sub

Код модуля OS4

Option Compare Database

Option Explicit

Private Const NomerForm As Long = 6

Private Const cFirmName As Byte = 1

Private Const rFirmName As Integer = 7

Private Const cFirmOKPO As Byte = 88

Private Const rFirmOKPO As Integer = 7

Private Const cNomer As Byte = 53

Private Const rNomer As Integer = 23

Private Const cDat As Byte = 65

Private Const rDat As Integer = 23

Private Const cRukDolzh As Byte = 61

Private Const rRukDolzh As Integer = 19

Private Const cRukName As Byte = 85

Private Const rRukName As Integer = 19

Private Const cDatRukDay As Byte = 78

Private Const rDatRukDay As Integer = 23

Private Const cDatRukMon As Byte = 83

Private Const rDatRukMon As Integer = 23

Private Const cDatRukYear As Byte = 96

Private Const rDatRukYear As Integer = 23

Private Const cStruct As Byte = 1

Private Const rStruct As Integer = 9

Private Const cOsn As Byte = 19

Private Const rOsn As Integer = 12

Private Const cDateOsn As Byte = 88

Private Const rDateOsn As Integer = 13

Private Const cNomerOsn As Byte = 88

Private Const rNomerOsn As Integer = 12

Private Const cDateSpis As Byte = 88

Private Const rDateSpis As Integer = 10

Private Const cMatSotr As Byte = 20

Private Const rMatSotr As Integer = 15

Private Const cMatNomer As Byte = 88

Private Const rMatNomer As Integer = 15

Private Const cPri4ina As Byte = 12

Private Const rPri4ina As Integer = 27

Private Const cTovar As Byte = 1

Private Const rTovar As Integer = 38

Private Const cInv As Byte = 20

Private Const rInv As Integer = 38

Private Const cZav As Byte = 30

Private Const rZav As Integer = 38

Private Const cDateVip As Byte = 40

Private Const rDateVip As Integer = 38

Private Const cDatePriem As Byte = 53

Private Const rDatePriem As Integer = 38

Private Const cFaktSrok As Byte = 60

Private Const rFaktSrok As Integer = 38

Private Const cPerv As Byte = 70

Private Const rPerv As Integer = 38

Private Const cAmort As Byte = 80

Private Const rAmort As Integer = 38

Private Const cOstStoim As Byte = 90

Private Const rOstStoim As Integer = 38

Private Const cZakl As Integer = 61

Private Const rZakl1 As Integer = 13

Private Const cZakl2 As Integer = 1

Private Const rZakl2_1 As Integer = 14

Private Const rZakl2_2 As Integer = 15

Private Const nSymbZakl As Byte = 40

Private Const nSymbZakl2 As Byte = 110

Private Const cPredsDolzh As Byte = 17

Private Const rPredsDolzh As Integer = 17

Private Const cChl1Dolzh As Byte = 17

Private Const rChl1Dolzh As Integer = 19

Private Const cChl2Dolzh As Byte = 17

Private Const rChl2Dolzh As Integer = 21

Private Const cPredsName As Byte = 51

Private Const rPredsName As Integer = 17

Private Const cChl1Name As Byte = 51

Private Const rChl1Name As Integer = 19

Private Const cChl2Name As Byte = 51

Private Const rChl2Name As Integer = 21

Private Const сGlBuch As Byte = 30

Private Const rGlBuch As Integer = 40

Private Const rSh1_1 As Integer = 7

Private Const rSh1_2 As Integer = 10

Private Const cKompl As Byte = 1

Private Const cKol As Byte = 30

Sub PrintFormOS4 (ByVal nomer As Long)

Dim db As Database, Rec As DAO. Recordset, RecList As DAO. Recordset

Dim oApp As Object

Dim StrFormName As String

Dim StrFile As String, s_folder As String, StrPath As String

Dim StrGlBuch As String

Dim StrFirmName As String, StrFirmOKPO As String, StrFirmAddr As String, StrFirmReq As String

Dim NomerVnutr As String, StrDate As Date

Dim StrPredsName As String, StrPredsDolzh As String

Dim StrChl1Name As String, StrChl1Dolzh As String

Dim StrChl2Name As String, StrChl2Dolzh As String

Dim StrDatePodp As Date, StrDateSpis As Date

Dim StrOstStoim As Double, StrFaktSrok As Long

Dim StrTovar As String, StrInv As String, StrZav As String

Dim StrRukName As String, StrRukDolzh As String

Dim StrStruct As String

Dim StrOsn As String, StrDateOsn As Date, StrNomerOsn As String

Dim StrMatSotr As String, StrMatNomer As String

Dim StrPri4ina As String

Dim StrDateVip As Date, StrDatePriem As Date

Dim StrPervStoim As Double, StrAmort As Double

Dim StrZakl As String, StrMonthPodp As String

Dim i As Long, NRecord As Long, p As Long

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 + vbOKOnly

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, "")

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

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

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

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

StrDateSpis = Nz (Rec. Fields ("ДатаСписания"). Value, Date)

StrStruct = Nz (Rec. Fields ("СтруктурноеПодразделение"). Value, "")

StrOsn = Nz (Rec. Fields ("Основание"). Value, "")

StrDateOsn = Nz (Rec. Fields ("ДатаОсн"). Value, Date)

StrNomerOsn = Nz (Rec. Fields ("НомерОсн"). Value, "")

StrMatSotr = Nz (Rec. Fields ("mat_name"). Value, "")

StrMatNomer = Nz (Rec. Fields ("mat_nomer"). Value, "")

StrPri4ina = Nz (Rec. Fields ("Причина"). Value, "")

StrDateVip = Nz (Rec. Fields ("ДатаВыпуск"). Value, Date)

StrDatePriem = Nz (Rec. Fields ("ДатаПринятия"). Value, Date)

StrPervStoim = Nz (Rec. Fields ("ПервСтоииость"). Value, 0)

StrAmort = Nz (Rec. Fields ("Аморт"). Value, 0)

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

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

StrZakl = 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, "")

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 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 (rRukName, cRukName). Value = StrRukName

oApp. Cells (rRukDolzh, cRukDolzh). Value = StrRukDolzh

oApp. Cells (rDatRukDay, cDatRukDay). Value = Format$ (StrDatePodp, "dd")

oApp. Cells (rDatRukMon, cDatRukMon). Value = StrMonthPodp

oApp. Cells (rDatRukYear, cDatRukYear). Value = Right$ (Format$ (StrDatePodp, "yyyy"),

1)

oApp. Cells (rStruct, cStruct). Value = StrStruct

oApp. Cells (rOsn, cOsn). Value = StrOsn

oApp. Cells (rDateOsn, cDateOsn). Value = StrDateOsn

oApp. Cells (rNomerOsn, cNomerOsn). Value = StrNomerOsn

oApp. Cells (rDateSpis, cDateSpis). Value = Format$ (StrDateSpis, "dd. mm. yyyy")

oApp. Cells (rMatSotr, cMatSotr). Value = StrMatSotr

oApp. Cells (rMatNomer, cMatNomer). Value = StrMatNomer

oApp. Cells (rPri4ina, cPri4ina). Value = StrOsn

oApp. Cells (rTovar, cTovar). Value = StrTovar

oApp. Cells (rInv, cInv). Value = StrInv

oApp. Cells (rZav, cZav). Value = StrZav

oApp. Cells (rDateVip, cDateVip). Value = Format$ (StrDateVip, "yyyy")

oApp. Cells (rDatePriem, cDatePriem). Value = Format$ (StrDatePriem, "dd. mm. yyyy")

oApp. Cells (rFaktSrok, cFaktSrok). Value = StrFaktSrok & "мес."

oApp. Cells (rPerv, cPerv). Value = Format$ (StrPervStoim, "0.00")

oApp. Cells (rAmort, cAmort). Value = Format$ (StrAmort, "0.00")

oApp. Cells (rOstStoim, cOstStoim). Value = Format$ (StrOstStoim, "0.00")

oApp. ActiveWorkbook. Sheets (2). Select

oApp. Cells (rZakl1, cZakl). Value = Left$ (StrZakl, nSymbZakl)

StrZakl = Mid$ (StrZakl, nSymbZakl + 1)

i = rZakl2_1

While Len (StrZakl) > 0

oApp. Cells (i, cZakl2). Value = Left$ (StrZakl, nSymbZakl2)

StrZakl = Mid$ (StrZakl, nSymbZakl2 + 1)

i = i + 1

If i > rZakl2_2 Then GoTo lb_ex

Wend

lb_ex:

oApp. Cells (rPredsName, cPredsName). Value = StrPredsName

oApp. Cells (rPredsDolzh, cPredsDolzh). Value = StrPredsDolzh

oApp. Cells (rChl1Name, cChl1Name). Value = StrChl1Name

oApp. Cells (rChl1Dolzh, cChl1Dolzh). Value = StrChl1Dolzh

oApp. Cells (rChl2Name, cChl2Name). Value = StrChl2Name

oApp. Cells (rChl2Dolzh, cChl2Dolzh). Value = StrChl2Dolzh

oApp. Cells (rGlBuch, сGlBuch). Value = StrGlBuch

Application. SysCmd acSysCmdInitMeter, "Вывод информации о товарах", 100

Set RecList = db. OpenRecordset ("select * from запрос_АктыСписанияТовары where НомерАкт = " & nomer, dbOpenSnapshot)

NRecord = RecList. RecordCount

If NRecord > 0 Then

RecList. MoveLast

NRecord = RecList. RecordCount

RecList. MoveFirst

i = 0

p = rSh1_1 - 1

While Not RecList. EOF

i = i + 1

p = p + 1

If p > rSh1_2 Then GoTo ex

Application. SysCmd acSysCmdUpdateMeter, i / NRecord * 100

oApp. Cells (p, cKompl). Value = Nz (RecList. Fields ("НаименованиеКомп"). Value, "")

oApp. Cells (p, cKol). Value = Nz (RecList. Fields ("Количество"). Value, 0) & "шт."

RecList. MoveNext

Wend

End If

ex:

Application. SysCmd acSysCmdRemoveMeter

If Not (oApp Is Nothing) Then oApp. Visible = True

Set Rec = Nothing

Set RecList = Nothing

Set oApp = Nothing

Set db = Nothing

Exit Sub

LblErr:

MsgBox Err. Description, vbCritical + vbOKOnly

GoTo ex

End Sub

Код модуля OS6

Option Compare Database

Option Explicit

Private Const NomerForm As Long = 4

Private Const cFirmName As Byte = 1

Private Const rFirmName As Integer = 7

Private Const cFirmOKPO As Byte = 53

Private Const rFirmOKPO As Integer = 7

Private Const cNomer As Byte = 20

Private Const rNomer As Integer = 14

Private Const cDat As Byte = 26

Private Const rDat As Integer = 14

Private Const cTovar As Byte = 6

Private Const rTovar As Integer = 15

Private Const cMest As Byte = 27

Private Const rMest As Integer = 20

Private Const cSchet As Byte = 53

Private Const rSchet As Integer = 18

Private Const cAmort As Byte = 53

Private Const rAmort As Integer = 12

Private Const cInv As Byte = 53

Private Const rInv As Integer = 14

Private Const cDatePriem As Byte = 53

Private Const rDatePriem As Integer = 16

Private Const cDateSpis As Byte = 53

Private Const rDateSpis As Integer = 17

Private Const cPost As Byte = 17

Private Const rPost As Integer = 21

Private Const cPerv As Byte = 53

Private Const rPerv As Integer = 35

Private Const cSrok As Byte = 59

Private Const rSrok As Integer = 35

Private Const cOsn As Byte = 1

Private Const rOsn As Integer = 59

Private Const cOper As Byte = 10

Private Const rOper As Integer = 59

Private Const cStruct As Byte = 19

Private Const rStruct As Integer = 59

Private Const cOstStoim As Byte = 39

Private Const rOstStoim As Integer = 59

Private Const cOtvSotr As Byte = 49

Private Const rOtvSotr As Integer = 59

Private Const cTovar2 As Byte = 1

Private Const rTovar2 As Integer = 19

Private Const cKol As Byte = 32

Private Const rKol As Integer = 19

Private Const cInvDolzh As Byte = 33

Private Const rInvDolzh As Integer = 36

Private Const cInvName As Byte = 67

Private Const rInvName As Integer = 36

Sub PrintFormOS6 (ByVal nomer As Long)

Dim db As Database, Rec As DAO. Recordset, RecList As DAO. Recordset

Dim oApp As Object

Dim StrFormName As String

Dim StrFile As String, s_folder As String, StrPath As String

Dim StrGlBuch As String

Dim StrFirmName As String, StrFirmOKPO As String, StrFirmAddr As String, StrFirmReq As String

Dim StrSchet As String, StrAmot As String

Dim NomerVnutr As String, StrDate As Date

Dim StrTovar As String, StrInv As String

Dim StrStoim As Double, StrOstStoim As Double, StrSroki As Long

Dim StrMest As String, StrKol As Long

Dim StrDatePriem As Date, StrDateSpis As Date

Dim StrPost As String, StrOsn As String, StrOper As String, StrStruct As String

Dim StrOtvSotr As String, StrInvSotr As String, StrInvSotrDolzhn As String

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 + vbOKOnly

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

StrSchet = Nz (Rec. Fields ("Счет"). Value, "")

StrAmot = Nz (Rec. Fields ("НомерАмортГруппы"). Value, "")

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

StrDate = Nz (Rec. Fields ("ДатаИнвКарты"). Value, Date)

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

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

StrStoim = Nz (Rec. Fields ("ПервСтоииость"). Value, 0)

StrSroki = Nz (Rec. Fields ("СрокИспользования"). Value, 0)

StrMest = Nz (Rec. Fields ("Местонахождение"). Value, "")

StrKol = Nz (Rec. Fields ("Количество"). Value,

1)

StrDatePriem = Nz (Rec. Fields ("ДатаПринятия"). Value, Date)

StrDateSpis = Nz (Rec. Fields ("ДатаСписания"). Value, Date)

StrPost = Nz (Rec. Fields ("НаименованиеПост"). Value, "")

StrOsn = Nz (Rec. Fields ("ОснованиеПриема"). Value, "")

StrOper = Nz (Rec. Fields ("ВидОперации"). Value, "")

StrStruct = Nz (Rec. Fields ("СтруктурноеПодразделение"). Value, "")

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

StrOtvSotr = Nz (Rec. Fields ("ОтвСотр"). Value, "")

StrInvSotr = Nz (Rec. Fields ("ИнвСотр"). Value, "")

StrInvSotrDolzhn = Nz (Rec. Fields ("Должность"). Value, "")

Else

MsgBox "Инвентарная карточка №" & nomer & " не найдена!", vbCritical + vbOKOnly

Exit Sub

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 (rTovar, cTovar). Value = StrTovar

oApp. Cells (rMest, cMest). Value = StrMest

oApp. Cells (rSchet, cSchet). Value = StrSchet

oApp. Cells (rAmort, cAmort). Value = StrAmot

oApp. Cells (rInv, cInv). Value = StrInv

oApp. Cells (rDatePriem, cDatePriem). Value = Format$ (StrDatePriem, "dd. mm. yyyy")

oApp. Cells (rDateSpis, cDateSpis). Value = Format$ (StrDateSpis, "dd. mm. yyyy")

oApp. Cells (rPost, cPost). Value = StrPost

oApp. Cells (rPerv, cPerv). Value = Format$ (StrStoim, "0.00")

oApp. Cells (rSrok, cSrok). Value = StrSroki & " мес."

oApp. Cells (rOsn, cOsn). Value = StrOsn

oApp. Cells (rOper, cOper). Value = StrOper

oApp. Cells (rStruct, cStruct). Value = StrStruct

oApp. Cells (rOstStoim, cOstStoim). Value = Format$ (StrOstStoim, "0.00")

oApp. Cells (rOtvSotr, cOtvSotr). Value = StrOtvSotr

oApp. ActiveWorkbook. Sheets (2). Select

oApp. Cells (rTovar2, cTovar2). Value = StrTovar

oApp. Cells (rKol, cKol). Value = StrKol & " шт."

oApp. Cells (rInvDolzh, cInvDolzh). Value = StrInvSotrDolzhn

oApp. Cells (rInvName, cInvName). Value = StrInvSotr

ex:

Application. SysCmd acSysCmdRemoveMeter

If Not (oApp Is Nothing) Then oApp. Visible = True

Set Rec = Nothing

Set RecList = Nothing

Set oApp = Nothing

Set db = Nothing

Exit Sub

LblErr:

MsgBox Err. Description, vbCritical + vbOKOnly

GoTo ex

End Sub

Код модуля OS6b

Option Compare Database

Option Explicit

Private Const NomerForm As Long = 7

Private Const cFirmName As Byte = 1

Private Const rFirmName As Integer = 7

Private Const cFirmOKPO As Byte = 88

Private Const rFirmOKPO As Integer = 7

Private Const cStruct As Byte = 1

Private Const rStruct As Integer = 9

Private Const cDat1Day As Byte = 30

Private Const rDat1Day As Integer = 23

Private Const cDat1Mon As Byte = 34

Private Const rDat1Mon As Integer = 23

Private Const cDat1Year As Byte = 49

Private Const rDat1Year As Integer = 23

Private Const cDat2Day As Byte = 57

Private Const rDat2Day As Integer = 23

Private Const cDat2Mon As Byte = 61

Private Const rDat2Mon As Integer = 23

Private Const cDat2Year As Byte = 76

Private Const rDat2Year As Integer = 23

Private Const cInvName As Byte = 48

Private Const rInvName As Integer = 33

Private Const cInvDolzhn As Byte = 24

Private Const rInvDolzhn As Integer = 33

Private Const cInvNomer As Byte = 88

Private Const rInvNomer As Integer = 33

Private Const rSh1_1 As Integer = 8

Private Const rSh1_2 As Integer = 35

Private Const cNomer As Byte = 1

Private Const cTovar As Byte = 5

Private Const cInv As Byte = 20

Private Const cOsn As Byte = 30

Private Const cDatePrin As Byte = 43

Private Const cStructTov As Byte = 52

Private Const cOtv As Byte = 61

Private Const cPervStoim As Byte = 70

Private Const cSrok As Byte = 80

Private Const cAmort As Byte = 90

Private Const cOstStoim As Byte = 1

Sub PrintFormOS6b (ByVal v_dat1 As Date, _

ByVal v_dat2 As Date, _

ByVal nomer_struct As Long, ByVal StrStruct As String)

Dim db As Database, qry As DAO. QueryDef, Rec As DAO. Recordset, RecList As DAO. Recordset

Dim oApp As Object

Dim StrFormName As String

Dim StrFile As String, s_folder As String, StrPath As String

Dim StrFirmName As String, StrFirmOKPO As String

Dim StrInvOtvName As String, StrInvOtvDolzhn As String, StrInvOtvNomer As String

Dim StrMonth1 As String, StrMonth2 As String

Dim i As Long, NRecord As Long, p As Long

On Error GoTo LblErr

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 + vbOKOnly

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 ( (Должности RIGHT JOIN Сотрудники ON Должности. НомерДолжн = Сотрудники. НомерДолжн) RIGHT JOIN Параметры ON Сотрудники. НомерСотр = Параметры. ИнвОтвеств)", dbOpenSnapshot)

If Rec. RecordCount > 0 Then

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

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

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

StrInvOtvDolzhn = Nz (Rec. Fields ("Должность"). Value, "")

StrInvOtvNomer = Nz (Rec. Fields ("ТабельныйНомер"). Value, "")

Else

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

Exit Sub

End If

Set Rec = Nothing

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

If Rec. RecordCount > 0 Then

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

Else

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

End If

Set Rec = Nothing

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

If Rec. RecordCount > 0 Then

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

Else

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

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 (rStruct, cStruct). Value = StrStruct

oApp. Cells (rDat1Day, cDat1Day). Value = Format$ (v_dat1, "dd")

oApp. Cells (rDat1Mon, cDat1Mon). Value = StrMonth1

oApp. Cells (rDat1Year, cDat1Year). Value = Right$ (Format$ (v_dat1, "yyyy"),

1)

oApp. Cells (rDat2Day, cDat2Day). Value = Format$ (v_dat2, "dd")

oApp. Cells (rDat2Mon, cDat2Mon). Value = StrMonth2

oApp. Cells (rDat2Year, cDat2Year). Value = Right$ (Format$ (v_dat2, "yyyy"),

1)

oApp. Cells (rInvName, cInvName). Value = StrInvOtvName

oApp. Cells (rInvDolzhn, cInvDolzhn). Value = StrInvOtvDolzhn

oApp. Cells (rInvNomer, cInvNomer). Value = StrInvOtvNomer

Application. SysCmd acSysCmdInitMeter, "Вывод информации о товарах", 100

If nomer_struct = 0 Then

Set qry = db. QueryDefs ("запрос_ИнвКнига2")

qry. Parameters (0) = v_dat1

qry. Parameters (1) = v_dat2

Else

Set qry = db. QueryDefs ("запрос_ИнвКнига")

qry. Parameters (0) = v_dat1

qry. Parameters (1) = nomer_struct

qry. Parameters (2) = v_dat2

End If

Set RecList = qry. OpenRecordset (dbOpenSnapshot)

NRecord = RecList. RecordCount

If NRecord > 0 Then

RecList. MoveLast

NRecord = RecList. RecordCount

RecList. MoveFirst

i = 0

p = rSh1_1 - 1

While Not RecList. EOF

i = i + 1

p = p + 1

If p > rSh1_2 Then GoTo ex

Application. SysCmd acSysCmdUpdateMeter, i / NRecord * 100

With oApp. ActiveWorkbook. Sheets (2)

. Cells (p, cNomer). Value = i

. Cells (p, cTovar). Value = Nz (RecList. Fields ("Наименование"). Value, "")

. Cells (p, cInv). Value = Nz (RecList. Fields ("ИнвНомер"). Value, "")

. Cells (p, cOsn). Value = Nz (RecList. Fields ("ОснованиеПринятия"). Value, "")

. Cells (p, cDatePrin). Value = Format$ (Nz (RecList. Fields ("ДатаПринятияКУчету"). Value, Date), "dd. mm. yyyy")

. Cells (p, cStructTov). Value = Nz (RecList. Fields ("СтруктурноеПодразделение"). Value, "")

. Cells (p, cOtv). Value = Nz (RecList. Fields ("Сотрудник"). Value, "")

. Cells (p, cPervStoim). Value = Nz (RecList. Fields ("ПервСтоииость"). Value, 0)

. Cells (p, cSrok). Value = Nz (RecList. Fields ("СрокИспользования"). Value, 0) & "мес."

. Cells (p, cAmort). Value = Nz (RecList. Fields ("Аморт"). Value, 0)

End With

oApp. ActiveWorkbook. Sheets (3). Cells (p, cOstStoim). Value = _

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

RecList. MoveNext

Wend

End If

ex:

Application. SysCmd acSysCmdRemoveMeter

If Not (oApp Is Nothing) Then oApp. Visible = True

Set qry = Nothing

Set RecList = Nothing

Set oApp = Nothing

Set db = Nothing

Exit Sub

LblErr:

MsgBox Err. Description, vbCritical + vbOKOnly

GoTo ex

End Sub

Код модуля общий

Option Compare Database

Option Explicit

Function translateNumber (ByVal Num As Long) As String

On Error GoTo LblErr

Dim num_str As String

Dim razr_count As Long

Dim razr_all As Long

Dim tri_count As Long

Dim tri_all As Long

Dim cur_dig As Byte

Dim point_pos As Long

Dim mg As Boolean

Dim mgl As Boolean

Dim kstr1 As Long

translateNumber = ""

num_str = Trim (Str (Num))

tri_count = 1

razr_all = Len (num_str)

If razr_all = 0 Then

translateNumber = "ноль"

Exit Function

End If

If Num = 0 Then

translateNumber = "ноль"

Exit Function

End If

For razr_count = 1 To razr_all Step 3

kstr1 = Mid (num_str, razr_all - razr_count + 1,1)

If razr_count = 1 Then mgl = True

If razr_count = 4 Then

mgl = True

If razr_count >= razr_all Then GoTo m1

If Mid (num_str, razr_all - razr_count,

1) = "1" Then

translateNumber = " тысяч" & translateNumber

Else

m1: If kstr1 = "1" Then translateNumber = " тысяча" & translateNumber

If kstr1 = "2" Then translateNumber = " тысячи" & translateNumber

If kstr1 = "3" Then translateNumber = " тысячи" & translateNumber

If kstr1 = "4" Then translateNumber = " тысячи" & translateNumber

If (Val (kstr1) >= 5) Or (kstr1 = "0") Then translateNumber = " тысяч" & translateNumber

End If

End If

If razr_count = 7 Then

mgl = False

If kstr1 = "1" Then translateNumber = " миллион" & translateNumber

If kstr1 = "2" Then translateNumber = " миллиона" & translateNumber

If kstr1 = "3" Then translateNumber = " миллиона" & translateNumber

If kstr1 = "4" Then translateNumber = " миллиона" & translateNumber

If (Val (kstr1) >= 5) Or (kstr1 = "0") Then translateNumber = " миллионов" & translateNumber

End If

If razr_count = 10 Then

mgl = False

If kstr1 = "1" Then translateNumber = " миллиард" & translateNumber

If kstr1 = "2" Then translateNumber = " миллиарда" & translateNumber

If kstr1 = "3" Then translateNumber = " миллиарда" & translateNumber

If kstr1 = "4" Then translateNumber = " миллиарда" & translateNumber

If (Val (kstr1) >= 5) Or (kstr1 = "0") Then translateNumber = " миллиардов" & translateNumber

End If

If razr_count = 13 Then

mgl = False

If kstr1 = "1" Then translateNumber = " триллион" & translateNumber

If kstr1 = "2" Then translateNumber = " триллиона" & translateNumber

If kstr1 = "3" Then translateNumber = " триллиона" & translateNumber

If kstr1 = "4" Then translateNumber = " триллиона" & translateNumber

If (Val (kstr1) >= 5) Or (kstr1 = "0") Then translateNumber = " триллионов" & translateNumber

End If

If razr_all - razr_count - 1 < 1 Then

translateNumber = triade (Mid (num_str, 1, razr_all - razr_count + 1), mgl) & translateNumber

Else

translateNumber = triade (Mid (num_str, razr_all - razr_count - 1,3), mgl) & translateNumber

End If

Next razr_count

translateNumber = ucasefirst (translateNumber)

Exit Function

LblErr:

MsgBox Err. Description

End Function

Function triade (ByVal in_str As String, mg As Boolean) As String

On Error GoTo LblErr

Dim out_tri2 As String

Dim out_tri1 As String

Dim out_tri3 As String

Dim di As String, kstr1 As String

triade = ""

If Len (in_str) < 3 Then in_str = "0" & in_str

If Len (in_str) < 3 Then in_str = "0" & in_str

kstr1 = Mid (in_str, 1,1)

If kstr1 = "0" Then out_tri3 = ""

If kstr1 = "1" Then out_tri3 = " сто"

If kstr1 = "2" Then out_tri3 = " двести"

If kstr1 = "3" Then out_tri3 = " триста"

If kstr1 = "4" Then out_tri3 = " четыреста"

If kstr1 = "5" Then out_tri3 = " пятьсот"

If kstr1 = "6" Then out_tri3 = " шестьсот"

If kstr1 = "7" Then out_tri3 = " семьсот"

If kstr1 = "8" Then out_tri3 = " восемьсот"

If kstr1 = "9" Then out_tri3 = " девятьсот"

'оцениваем на 11

di = Right (in_str,

2): kstr1 = Mid (in_str, 2,1)

If kstr1 = "1" Then

If di = "10" Then out_tri2 = " десять"

If di = "11" Then out_tri2 = " одиннадцать"

If di = "12" Then out_tri2 = " двенадцать"

If di = "13" Then out_tri2 = " тринадцать"

If di = "14" Then out_tri2 = " четырнадцать"

If di = "15" Then out_tri2 = " пятнадцать"

If di = "16" Then out_tri2 = " шестнадцать"

If di = "17" Then out_tri2 = " семнадцать"

If di = "18" Then out_tri2 = " восемнадцать"

If di = "19" Then out_tri2 = " девятнадцать"

triade = out_tri3 & out_tri2

Exit Function

End If

If kstr1 = "0" Then out_tri2 = ""

If kstr1 = "2" Then out_tri2 = " двадцать"

If kstr1 = "3" Then out_tri2 = " тридцать"

If kstr1 = "4" Then out_tri2 = " сорок"

If kstr1 = "5" Then out_tri2 = " пятьдесят"

If kstr1 = "6" Then out_tri2 = " шестьдесят"

If kstr1 = "7" Then out_tri2 = " семдесят"

If kstr1 = "8" Then out_tri2 = " восемдесят"

If kstr1 = "9" Then out_tri2 = " девяносто"

kstr1 = Mid (in_str, 3,1)

If kstr1 = "0" Then out_tri1 = ""

If mg = False Then

If kstr1 = "1" Then out_tri1 = " один"

If kstr1 = "2" Then out_tri1 = " два"

Else

If kstr1 = "1" Then out_tri1 = " одна"

If kstr1 = "2" Then out_tri1 = " две"

End If

If kstr1 = "3" Then out_tri1 = " три"

If kstr1 = "4" Then out_tri1 = " четыре"

If kstr1 = "5" Then out_tri1 = " пять"

If kstr1 = "6" Then out_tri1 = " шесть"

If kstr1 = "7" Then out_tri1 = " семь"

If kstr1 = "8" Then out_tri1 = " восемь"

If kstr1 = "9" Then out_tri1 = " девять"

triade = out_tri3 & out_tri2 & out_tri1

Exit Function

LblErr:

MsgBox Err. Description, vbCritical + vbOKOnly

End Function

Function ucasefirst (in_str As String) As String

On Error GoTo LblErr

Dim fs As String

Dim ns As String

If Nz (in_str, "") = "" Then ucasefirst = ""

in_str = Trim (in_str)

fs = Left (in_str,

1)

ns = Right (in_str, Len (in_str) - 1)

ucasefirst = UCase (fs) & ns

Exit Function

LblErr:

MsgBox Err. Description, vbCritical + vbOKOnly

End Function


Подобные документы

  • Характеристика и функциональные возможности программы "1С:Предприятие" по автоматизации участка учёта движения и наличия основных средств. Структура информации и технология выполнения работ (работа со справочниками, документами, отчётными формами).

    курсовая работа [1,9 M], добавлен 04.11.2013

  • Описание складского учета ООО "Курочка рядом". Проведение инвентаризации на предприятии и возможности его автоматизации. Разработка программного обеспечения подсистемы складского учета. Описание задач разработанной подсистемы и средств ее взаимодействия.

    дипломная работа [3,8 M], добавлен 12.04.2012

  • Автоматизация учета закупки и реализации продукции. Сущность задач учета операций товародвижения. Характеристика входной, постоянной, промежуточной и результатной информации. Структура программных средств. Руководство программиста и пользователя.

    курсовая работа [2,4 M], добавлен 23.12.2013

  • Разработка проекта автоматизации учета основных средств на сельскохозяйственных предприятиях. Состав технических и программных средств, необходимых для реализации проекта автоматизации учета. Предполагаемые результаты внедрения данного проекта.

    курсовая работа [23,4 K], добавлен 14.08.2010

  • Склад ОАО "Ориенбанк", его специфика и структура. Описание структуры базы данных складского учета для предприятия. Разработка пользовательского интерфейса программы. Инструкция к применению базы данных. Автоматизация операций и учета средств банка.

    курсовая работа [4,7 M], добавлен 26.02.2010

  • Экономическая эффективность внедрения программного продукта "1С: Бухгалтерия 8.0". Назначение технологической платформы "1С: Предприятие" и конфигурации "Бухгалтерия предприятия". Создание подсистем, справочников, документов, отчетов и интерфейса.

    реферат [967,0 K], добавлен 15.06.2015

  • Краткая характеристика организационной структуры управления ООО "Строительная компания "Инжтех". Использование программных средств "ГАРАНТ" и "1С:Бухгалтерия" на предприятии. Расчет экономической эффективности системы автоматизации на предприятии.

    курсовая работа [1,2 M], добавлен 11.11.2015

  • Формирование и предоставление бухгалтерской информации в электронном виде внешним контролирующим органам. Сущность комплекса задач по автоматизации учета банковских операций, ее реализация программе "1С: Бухгалтерия". Особенности технология автоматизации.

    курсовая работа [1,2 M], добавлен 23.09.2016

  • Программная реализация средства "Автоматизация учета транспортных средств ГАИ" для упрощения работы инспектора ГАИ: отслеживания информации об автомобилях, регистрации, информации о марке, технических характеристиках, владельцах и страховках автомобилей.

    курсовая работа [1,3 M], добавлен 12.02.2016

  • Разработка кодификатора, классификатора кадровых ресурсов, входных документов "Прием на работу", "Кадровое перемещение", "Увольнение" и выходных документов учета кадров организации для автоматизации учета кадров на предприятии с помощью 1С:Предприятие.

    курсовая работа [72,1 K], добавлен 02.07.2012

Работы в архивах красиво оформлены согласно требованиям ВУЗов и содержат рисунки, диаграммы, формулы и т.д.
PPT, PPTX и PDF-файлы представлены только в архивах.
Рекомендуем скачать работу.