Смекни!
smekni.com

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

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) <> "&bsol;" Then s_folder = s_folder + "&bsol;"

s_folder = s_folder + "blanks&bsol;"

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)