Смекни!
smekni.com

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

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