Sie sind auf Seite 1von 13

VERSION 5.00 Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX" Object = "{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0"; "FM20.DLL" Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX" Begin VB.

Form JournalCa BorderStyle = 1 'Fixed Single Caption = "Journal - Transaction" ClientHeight = 6030 ClientLeft = 45 ClientTop = 330 ClientWidth = 7890 Icon = "JournalCA.frx":0000 KeyPreview = -1 'True LinkTopic = "Form1" MaxButton = 0 'False MDIChild = -1 'True Picture = "JournalCA.frx":0442 ScaleHeight = 6030 ScaleWidth = 7890 Begin VB.TextBox Text1 BackColor = &H8000000F& Height = 1815 Left = 240 Locked = -1 'True MultiLine = -1 'True TabIndex = 22 Text = "JournalCA.frx":074C Top = 4080 Width = 7455 End Begin VB.TextBox Txt Height = 555 Index = 4 Left = 1440 MaxLength = 200 MultiLine = -1 'True ScrollBars = 2 'Vertical TabIndex = 19 ToolTipText = "Enter narration for journal transaction ...." Top = 3000 Width = 4695 End Begin VB.ListBox lstGrp Height = 450 Index = 1 Left = 4800 TabIndex = 17 Top = 2280 Visible = 0 'False Width = 855 End Begin VB.ListBox lstGrp Height = 450 Index = 0 Left = 3840 TabIndex = 16 Top = 2280 Visible = 0 'False Width = 855 End

Begin VB.TextBox Txt Alignment = 1 'Right Justify BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 2 Left = 1440 MaxLength = 10 TabIndex = 5 ToolTipText = "Enter amount here ...." Top = 2400 Width = 1815 End Begin VB.TextBox Txt Height = 315 Index = 1 Left = 5880 MaxLength = 15 TabIndex = 2 ToolTipText = "Reference number...." Top = 600 Width = 1815 End Begin VB.TextBox Txt Height = 315 Index = 0 Left = 720 Locked = -1 'True TabIndex = 0 ToolTipText = "Voucher number.,,(Auto number)" Top = 600 Width = 1095 End Begin MSMask.MaskEdBox Eddate Height = 315 Left = 3360 TabIndex = 1 ToolTipText = "Enter date..." Top = 600 Width = 1215 _ExtentX = 2143 _ExtentY = 556 _Version = 393216 BackColor = 16777215 AutoTab = -1 'True MaxLength = 10 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Arial" Size = 9 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False

Strikethrough = 0 'False EndProperty Format = "dd/mm/yyyy" Mask = "##/##/####" PromptChar = "_" End Begin MSComctlLib.StatusBar STbar Height = 255 Left = 240 TabIndex = 13 Top = 3720 Width = 7575 _ExtentX = 13361 _ExtentY = 450 _Version = 393216 BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} NumPanels = 2 BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} Bevel = 2 Object.Width = 3528 MinWidth = 3528 Object.ToolTipText = "Displays record status..." EndProperty BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} AutoSize = 1 Bevel = 2 Object.Width = 9763 Object.ToolTipText = "Displays field description..." EndProperty EndProperty End Begin VB.Label LBLcr BackStyle = 0 'Transparent Caption = "Group and address" Height = 1275 Left = 6240 TabIndex = 21 Top = 2280 Width = 1485 WordWrap = -1 'True End Begin VB.Label Label2 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Narration:" Height = 195 Index = 5 Left = 240 TabIndex = 20 Top = 3060 Width = 690 End Begin VB.Label LblArea AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Address" Height = 195 Left = 1440 TabIndex = 18 Top = 1200

Width = 570 End Begin VB.Label LblBal Alignment = 1 'Right Justify AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "0.00" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00800000& Height = 195 Index = 1 Left = 7335 TabIndex = 15 Top = 2040 Width = 390 End Begin VB.Label LblBal Alignment = 1 'Right Justify AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "0.00" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00800000& Height = 195 Index = 0 Left = 7335 TabIndex = 14 Top = 1500 Width = 390 End Begin MSForms.ComboBox Cmb Height = 315 Index = 1 Left = 1440 TabIndex = 4 ToolTipText = "Select account head from list,,," Top = 1920 Width = 4695 VariousPropertyBits= 746604571 DisplayStyle = 3 Size = "8281;556" MatchEntry = 1 ShowDropButtonWhen= 2 FontHeight = 165

FontCharSet = 0 FontPitchAndFamily= 2 End Begin VB.Label Label2 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Amount Rs:" Height = 195 Index = 2 Left = 240 TabIndex = 12 Top = 2460 Width = 825 End Begin VB.Label Label2 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Credit:" Height = 195 Index = 1 Left = 240 TabIndex = 11 Top = 1980 Width = 450 End Begin MSForms.ComboBox Cmb Height = 315 Index = 0 Left = 1440 TabIndex = 3 ToolTipText = "Select account head from list,,," Top = 1440 Width = 4695 VariousPropertyBits= 746604571 DisplayStyle = 3 Size = "8281;556" MatchEntry = 1 ShowDropButtonWhen= 2 FontHeight = 165 FontCharSet = 0 FontPitchAndFamily= 2 End Begin VB.Label Label2 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Debit:" Height = 195 Index = 0 Left = 240 TabIndex = 10 Top = 1500 Width = 420 End Begin VB.Line Line1 BorderColor = &H00808080& BorderStyle = 6 'Inside Solid Index = 6 X1 = 0 X2 = 8000 Y1 = 1080

Y2 = End Begin VB.Label Label1 AutoSize = BackStyle = Caption = Height = Index = Left = TabIndex = Top = Width = End Begin VB.Label Label1 AutoSize = BackStyle = Caption = Height = Index = Left = TabIndex = Top = Width = End Begin VB.Label Label1 AutoSize = BackStyle = Caption = Height = Index = Left = TabIndex = Top = Width = End Begin VB.Label LblCom Alignment = AutoSize = BackStyle = Caption = BeginProperty Font Name Size Charset Weight Underline Italic Strikethrough EndProperty ForeColor = Height = Left = TabIndex = Top = Width = End Begin VB.Shape ShpCom BorderColor = BorderStyle = FillColor =

1080 -1 'True 0 'Transparent "Ref no:" 195 2 5280 9 660 525 -1 'True 0 'Transparent "Date:" 195 1 2880 8 660 390 -1 'True 0 'Transparent "Vno:" 195 0 240 7 660 330 2 'Center -1 'True 0 'Transparent "Journal" = = = = = = = "Arial" 11.25 0 700 0 'False 0 'False 0 'False &H00C00000& 270 3540 6 120 810 &H00FF0000& 6 'Inside Solid &H00C0FFFF&

FillStyle Height Left Top Width

= = = = =

0 'Solid 495 -120 0 9255 &H00FFFFFF& 2 7 0 8000 1095 1080

End Begin VB.Line Line1 BorderColor = BorderWidth = Index = X1 = X2 = Y1 = Y2 = End

End Attribute VB_Name = "JournalCa" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Dim sngHead2 As Long Dim sngHead1 As Long Dim sngOldHead1 As Long Dim sngOldHead2 As Long Dim sngActualDRCR As Single Dim strOldgrp1 As String Dim strOldgrp2 As String Dim RSf As ADODB.Recordset Dim maxNo As Long Const conVtype = "Jou" Private Sub Cmb_Change(Index As Integer) With Cmb(Index) If .ListIndex = -1 Then LBLcr = "" LblArea = "" LblBal(Index) = "0.00" Exit Sub End If lstGrp(Index).ListIndex = Cmb(Index).ListIndex Select Case Index Case 0 sngHead1 = Val(Right(Cmb(0).Text, 5)) LblBal(Index) = FindingOPbalance(sngHead1, 7) Case 1 sngHead2 = Val(Right(Cmb(1).Text, 5)) LblBal(Index) = FindingOPbalance(sngHead2, 8) End Select End With End Sub Private Sub Cmb_GotFocus(Index As Integer) Cmb(Index).DropDown STbar.Panels(2).Text = Cmb(Index).ToolTipText End Sub Private Sub Eddate_GotFocus() Eddate.SelStart = 0 Eddate.SelLength = 2

STbar.Panels(2).Text = Eddate.ToolTipText End Sub Private Sub Eddate_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys vbTab End Sub Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 33 Then cmdPrevious ElseIf KeyCode = 34 Then cmdNext End If If KeyCode = 27 Then If MSG(DoYouCloseWindowX) = conYes Then Unload Me End If End If End Sub Private Sub Form_Load() LBLcr = "" LblArea = "" If Val(bytOtherPic) > 0 Then If Dir(App.Path & "\pic\" & "bg" & bytOtherPic & ".jpg") <> "" Then Me.Picture = LoadPicture(App.Path & "\pic\" & "bg" & bytOtherPic & ".jp g") End If End If STbar.Visible = Mainfrm.StbarChildwindowMnu.Checked Top = 600 Left = 1395 Set RSf = New ADODB.Recordset RSf.Open "zheads", DB, adOpenKeyset, adLockReadOnly, adCmdTable STbar.Panels(1).Text = conAddmode Txt(0) = TransactionFilesVno(conVtype) maxNo = Val(Txt(0)) Eddate.Text = Format(Now, "dd/mm/yyyy") refreshMe End Sub Private Sub Txt_GotFocus(Index As Integer) Txt(Index).SelStart = 0 Txt(Index).SelLength = Len(Txt(Index)) STbar.Panels(2).Text = Txt(Index).ToolTipText End Sub Private Sub Txt_KeyPress(Index As Integer, KeyAscii As Integer) If KeyAscii = 39 Then KeyAscii = 0 Exit Sub End If Select Case Index Case 0 To 1 If KeyAscii = 13 Then SendKeys vbTab Case 2 KeyAscii = AllowandConvert(0, KeyAscii) If KeyAscii = 13 Then Txt(Index) = Format(Txt(Index), "0.00") SendKeys vbTab

End If Case 3 If KeyAscii = 13 Then SendKeys vbTab Case 4 If KeyAscii = 13 Then If MSG(DoyouWanttoSavex) = conYes Then Mainfrm.OpenMnu_Click (3) End If End If End Select End Sub Public Sub cmdSave() Dim i% i = CheckWithinFyear(Eddate.Text) If i <> 88 Then Eddate.SetFocus Exit Sub End If If Cmb(0).ListIndex = -1 Then MSG InvalidDataX Cmb(0).SetFocus Exit Sub End If If Cmb(1).ListIndex = -1 Then MSG InvalidDataX Cmb(1).SetFocus Exit Sub End If If LCase(Cmb(0).Text) = LCase(Cmb(1).Text) Then MSG SameHeadx Cmb(0).SetFocus Exit Sub End If If Val(Txt(2)) <= 0 Then MSG InvalidDataX Txt(2).SetFocus Exit Sub End If Dim rsS As New ADODB.Recordset With rsS If STbar.Panels(1).Text = conEditmode Then DeleteXX End If .Open "ztrans", DB, adOpenDynamic, adLockPessimistic, adCmdTable Dim Ka% For Ka = 0 To 1 .AddNew .Fields("vno") = Txt(0) .Fields("vdate") = Format(Eddate, "dd/MM/yyyy") .Fields("refno") = StrConv(Trim(Txt(1)), vbProperCase) .Fields("narr") = Trim(Txt(4)) If Ka = 0 Then .Fields("hcode") = Right(Cmb(0), 5) 'debit head .Fields("amount") = Val(Txt(2))

.Fields("drcr") = "d" .Fields("refcode") = Right(Cmb(1), 5) .Fields("refdrcr") = "c" .Fields("seq") = 1 Else .Fields("hcode") = Right(Cmb(1), 5) 'credit head .Fields("amount") = (Val(Txt(2)) * -1) .Fields("drcr") = "c" .Fields("refcode") = Right(Cmb(0), 5) .Fields("refdrcr") = "d" .Fields("seq") = 1 End If .Fields("passed") = "0" .Fields("vtype") = conVtype .Update Next updateHeads False, sngHead1, Val(Txt(2)) updateGroups False, lstGrp(0).Text, Val(Txt(2)) updateHeads False, sngHead2, (Val(Txt(2)) * -1) updateGroups False, lstGrp(1).Text, (Val(Txt(2)) * -1) 'cmdClear Select Case caAfterSave Case 0 cmdClear Case 1 cmdNext Case 2 cmdPrevious End Select Eddate.SetFocus End With End Sub Private Function FindingOPbalance(headCode As Long, Optional LblDis7 As Byte) As String Dim sngOX As String With RSf .MoveFirst .Find "code =" & headCode Select Case Val(.Fields("clobal")) Case 0 sngOX = "0.00" Case Is > 0 sngOX = Format(.Fields("clobal"), "0.00") & " Dr" Case Is < 0 sngOX = Format(.Fields("clobal"), "0.00") & " Cr" sngOX = Mid(sngOX, 2, Len(sngOX)) End Select If LblDis7 = 7 Then LblArea = .Fields("add1") & " (" & .Fields("group") & ")" ElseIf LblDis7 = 8 Then LBLcr = .Fields("add1") & " (" & .Fields("group") & ")" End If End With FindingOPbalance = sngOX End Function Public Sub cmdClear() STbar.Panels(1).Text = conAddmode RSf.Requery Txt(0) = TransactionFilesVno(conVtype)

maxNo = Val(Txt(0)) Cmb(0).Text = "" Cmb(1).Text = "" Txt(2) = 0 Txt(1) = "" Txt(4) = "" LblArea = "" LBLcr = "" Eddate.SetFocus End Sub Public Sub cmdDelete() If STbar.Panels(1).Text = conAddmode Then MSG Norecordx Exit Sub End If DeleteXX cmdClear End Sub Public Sub fillInTextJournal(Vnoa As Long) sngOldHead1 = 0 sngOldHead2 = 0 Txt(2) = 0 Txt(1) = "" Txt(4) = "" STbar.Panels(1).Text = conEditmode Screen.MousePointer = 11 Dim rsU As New ADODB.Recordset Dim kk As Integer Dim lngCCC As Long Dim i% With rsU .Open "select * from ztrans where vno =" & Vnoa & " and vtype ='" & conVtype & " '", DB, adOpenForwardOnly, adLockReadOnly kk = 0 If .EOF = True Then MSG Norecordx STbar.Panels(1) = conAddmode .Close Exit Sub End If While .EOF = False If kk = 0 Then Txt(0) = .Fields("vno") Eddate.Text = Format(.Fields("vdate"), "dd/mm/yyyy") If .Fields("refno") <> "" Then Txt(1) = .Fields("refno") If .Fields("narr") <> "" Then Txt(4) = .Fields("narr") If .Fields("amount") <= 0 Then Txt(2) = Format(.Fields("amount"), "0.00") Txt(2) = Mid(Txt(2), 2, Len(Txt(2))) Else Txt(2) = Format(.Fields("amount"), "0.00") End If sngActualDRCR = Val(Txt(2))

End If lngCCC = .Fields("hcode") If kk = 0 Then sngOldHead1 = lngCCC Else sngOldHead2 = lngCCC End If RSf.MoveFirst RSf.Find "code =" & lngCCC Cmb(kk).Text = RSf.Fields("name") & " | " & RSf.Fields("code") If kk = 0 Then sngOldHead1 = Val(Right(Cmb(0).Text, 5)) strOldgrp1 = lstGrp(0).Text Else strOldgrp2 = lstGrp(1).Text sngOldHead2 = Val(Right(Cmb(1).Text, 5)) End If kk = kk + 1 .MoveNext Wend .Close End With Txt(0).SetFocus Screen.MousePointer = 0 End Sub Private Sub DeleteXX() DB.Execute "delete from ztrans where vno =" & Txt(0) & " and vtype ='" & conV type & "'" updateHeads False, sngOldHead1, updateHeads False, sngOldHead2, updateGroups False, strOldgrp1, updateGroups False, strOldgrp2, sngActualDRCR, (sngActualDRCR sngActualDRCR, (sngActualDRCR , * , * , 8 -1), , , 8 , 8 -1), , , 8

RSf.Requery End Sub Public Sub cmdFind() Dim xx xx = InputBox("Enter voucher number", "Find") If Val(xx) > 0 Then fillInTextJournal Val(xx) End If End Sub Public Sub cmdQS() cmdFind End Sub Private Sub refreshMe(Optional xxxT As String) Screen.MousePointer = 11 Cmb(0).Clear Cmb(1).Clear lstGrp(1).Clear lstGrp(0).Clear Dim rs As New ADODB.Recordset With rs

.Open "zqJour", DB, adOpenForwardOnly, adLockReadOnly, adCmdStoredProc While .EOF = False Cmb(0).AddItem .Fields(0) & " | " & .Fields(1) Cmb(1).AddItem .Fields(0) & " | " & .Fields(1) lstGrp(0).AddItem .Fields("group") lstGrp(1).AddItem .Fields("group") .MoveNext Wend .Close End With Screen.MousePointer = 0 End Sub Public Sub cmdPrevious() Screen.MousePointer = vbHourglass Dim tmpSng As Long If Val(Txt(0).Text) <> 1 Then For tmpSng = (Val(Txt(0).Text) - 1) To 1 Step -1 If ExData(tmpSng) = True Then fillInTextJournal tmpSng Exit For Exit Sub End If Next Else MSG (FirstRecordX) Screen.MousePointer = vbNormal End If End Sub Public Sub cmdNext() Dim tmpSng As Long If Val(Txt(0).Text) < Val(maxNo) - 1 Then For tmpSng = (Val(Txt(0).Text) + 1) To maxNo - 1 If ExData(tmpSng) = True Then fillInTextJournal tmpSng Exit For Exit Sub End If Next Else MSG (LastRecordX) End If Exit Sub End Sub Private Function ExData(xxVno As Long) As Boolean ExData = False Dim rs As New ADODB.Recordset With rs .Open "select vno from ztrans where vno =" & xxVno & " and vtype ='" & conVtype & "'", DB, adOpenForwardOnly, adLockReadOnly If .EOF = True Then ExData = False Else ExData = True End If End With End Function