VERSION 5.00
Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
Begin VB.Form EP 
   BackColor       =   &H00FFFFFF&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Version Noviembre 2017"
   ClientHeight    =   6750
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   9645
   Icon            =   "Ep.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   6750
   ScaleWidth      =   9645
   StartUpPosition =   2  'CenterScreen
   Begin VB.TextBox Text8 
      BackColor       =   &H00C0FFC0&
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   1800
      TabIndex        =   23
      Top             =   1680
      Width           =   2055
   End
   Begin VB.Data Data2 
      Caption         =   "Data2"
      Connect         =   "Access 2000;"
      DatabaseName    =   ""
      DefaultCursorType=   0  'DefaultCursor
      DefaultType     =   2  'UseODBC
      Exclusive       =   0   'False
      Height          =   300
      Left            =   1320
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   "Empleados"
      Top             =   7080
      Width           =   3015
   End
   Begin VB.TextBox Text7 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00C0FFC0&
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   405
      Left            =   5400
      TabIndex        =   1
      Top             =   240
      Width           =   1695
   End
   Begin VB.TextBox Text6 
      BackColor       =   &H00C0FFC0&
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   4920
      TabIndex        =   4
      Top             =   1680
      Width           =   2175
   End
   Begin VB.TextBox Text5 
      BackColor       =   &H00C0FFC0&
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   405
      Left            =   1800
      TabIndex        =   3
      Top             =   1200
      Width           =   5295
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H000000FF&
      Height          =   375
      Left            =   6720
      Style           =   1  'Graphical
      TabIndex        =   7
      Top             =   6120
      Width           =   375
   End
   Begin VB.TextBox Text4 
      BackColor       =   &H00C0FFC0&
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   360
      TabIndex        =   6
      Top             =   3360
      Width           =   6735
   End
   Begin MSDBGrid.DBGrid DBGrid1 
      Bindings        =   "Ep.frx":693A
      Height          =   2295
      Left            =   360
      OleObjectBlob   =   "Ep.frx":694E
      TabIndex        =   11
      Top             =   3720
      Width           =   6735
   End
   Begin VB.Data Data1 
      Caption         =   "Empresas"
      Connect         =   "Access 2000;"
      DatabaseName    =   ""
      DefaultCursorType=   0  'DefaultCursor
      DefaultType     =   2  'UseODBC
      Exclusive       =   0   'False
      Height          =   420
      Left            =   360
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   "Empresas"
      Top             =   6120
      Width           =   3495
   End
   Begin VB.TextBox Text3 
      BackColor       =   &H00C0FFC0&
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   1800
      TabIndex        =   5
      Top             =   2040
      Width           =   5295
   End
   Begin VB.TextBox Text2 
      BackColor       =   &H00C0FFC0&
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   405
      Left            =   1800
      TabIndex        =   2
      Top             =   720
      Width           =   5295
   End
   Begin VB.TextBox Text1 
      BackColor       =   &H00C0FFC0&
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   405
      Left            =   1800
      TabIndex        =   0
      Top             =   240
      Width           =   2535
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "Telefono"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   8
      Left            =   360
      TabIndex        =   22
      Top             =   1680
      Width           =   1215
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "Actualizar"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   7
      Left            =   8520
      TabIndex        =   21
      Top             =   6240
      Visible         =   0   'False
      Width           =   855
   End
   Begin VB.Image Image4 
      Height          =   555
      Left            =   8640
      Picture         =   "Ep.frx":74E1
      Stretch         =   -1  'True
      Top             =   5760
      Visible         =   0   'False
      Width           =   525
   End
   Begin VB.Shape Shape4 
      BorderColor     =   &H00FF0000&
      Height          =   3615
      Left            =   120
      Top             =   3000
      Width           =   7215
   End
   Begin VB.Shape Shape3 
      BorderColor     =   &H00FF0000&
      Height          =   2895
      Left            =   120
      Top             =   120
      Width           =   7215
   End
   Begin VB.Shape Shape2 
      BorderColor     =   &H00C00000&
      Height          =   3135
      Left            =   7560
      Top             =   3480
      Width           =   1935
   End
   Begin VB.Shape Shape1 
      BorderColor     =   &H00C00000&
      Height          =   3255
      Left            =   7560
      Top             =   120
      Width           =   1935
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "Autor"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   6
      Left            =   7680
      TabIndex        =   20
      Top             =   6240
      Visible         =   0   'False
      Width           =   735
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "Borrar"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   5
      Left            =   7920
      TabIndex        =   19
      Top             =   4680
      Width           =   1215
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "Empleados y Boletas"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Index           =   4
      Left            =   8040
      TabIndex        =   18
      Top             =   2520
      Width           =   1215
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "Grabar"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   3
      Left            =   8040
      TabIndex        =   17
      Top             =   1200
      Width           =   1215
   End
   Begin VB.Image Image3 
      Height          =   495
      Left            =   7800
      Picture         =   "Ep.frx":96FA
      Stretch         =   -1  'True
      ToolTipText     =   "Sobre El Software"
      Top             =   5760
      Visible         =   0   'False
      Width           =   495
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "Emp N°"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   1
      Left            =   4440
      TabIndex        =   16
      Top             =   240
      Width           =   975
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "Ciudad"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   2
      Left            =   3960
      TabIndex        =   15
      Top             =   1680
      Width           =   855
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "Direccion"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   1
      Left            =   360
      TabIndex        =   14
      Top             =   1200
      Width           =   1215
   End
   Begin VB.Image Image5 
      Height          =   915
      Left            =   7920
      Picture         =   "Ep.frx":B5F8
      Stretch         =   -1  'True
      ToolTipText     =   "Empleados"
      Top             =   1560
      Width           =   1275
   End
   Begin VB.Image Image2 
      Height          =   855
      Left            =   7920
      Picture         =   "Ep.frx":D811
      Stretch         =   -1  'True
      ToolTipText     =   "Borrar la empresa marcada"
      Top             =   3720
      Width           =   1215
   End
   Begin VB.Image Image1 
      Height          =   900
      Left            =   7920
      Picture         =   "Ep.frx":FB80
      Stretch         =   -1  'True
      ToolTipText     =   "Agregar empresa"
      Top             =   360
      Width           =   1275
   End
   Begin VB.Label Label5 
      BackStyle       =   0  'Transparent
      Caption         =   "Click en el boton para activar la empresa -------------------------->"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   3960
      TabIndex        =   13
      Top             =   6120
      Width           =   2655
   End
   Begin VB.Label Label4 
      BackStyle       =   0  'Transparent
      Caption         =   "Coloque el nombre de la empresa para realizar un filtro"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   360
      TabIndex        =   12
      Top             =   3120
      Width           =   6735
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "Detalle"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   360
      TabIndex        =   10
      Top             =   2160
      Width           =   1455
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "Empresa"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   0
      Left            =   360
      TabIndex        =   9
      Top             =   720
      Width           =   1215
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "Cuit"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   0
      Left            =   360
      TabIndex        =   8
      Top             =   240
      Width           =   1215
   End
End
Attribute VB_Name = "EP"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error GoTo verlo

With Data1.Recordset
    Text1 = !cuit
    Text2 = !empresa
    Text3 = !datosextras
    Text5 = !direccion
    Text6 = Trim(Mid(!ciudad, InStr(1, !ciudad, "*") + 1))
    Text7 = !numero
    Text8 = Trim(Mid(!ciudad, 1, InStr(1, !ciudad, "*") - 1))
    razonsocial1 = !empresa
    domicilio1 = !direccion
    telefono1 = Trim(Mid(!ciudad, 1, InStr(1, !ciudad, "*") - 1))
    ciudad1 = Trim(Mid(!ciudad, InStr(1, !ciudad, "*") + 1))
    cuit1 = !cuit
    numero1 = !numero
End With
guia1 = 1
Exit Sub
verlo:
If Err.Number = 94 Then
Resume Next
End If

End Sub

Private Sub DBGrid1_DblClick()
Call Command1_Click

End Sub

Private Sub Form_Load()
EP.Caption = "Boleta CEC - Version 2.2 Noviembre 2017"
Data1.DatabaseName = camino + "\boleta.mdb"
Data2.DatabaseName = camino + "\boleta.mdb"
EP.Width = 9735
guia1 = 0
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
End
End Sub

Private Sub Image1_Click()
If Len(Trim(Text1)) = 0 Or Len(Trim(Text2)) = 0 Then
    Call mensaje1
    Exit Sub
End If
If Len(Trim(Text1)) < 11 Or Len(Trim(Text1)) > 11 Then
    Call mensaje1
    Exit Sub
End If
If Len(Trim(Text2)) = 0 Then
    MsgBox "Ingrese el nombre de la empresa", vbCritical, "Aviso"
    Exit Sub
End If
If Len(Trim(Text7)) = 0 Then
    MsgBox "Debe Obtener el numero de empresa"
    Exit Sub
End If
If Len(Trim(Text8)) = 0 Then
    MsgBox "Debe colocar numero telefonico de empresa o contador"
    Exit Sub
End If


largo = Len(Trim(Text1))
p = Trim(Text1)
For i = 1 To largo
    If Not IsNumeric(Mid(p, i, 1)) Then
        MsgBox "Error, el cuit debe ser de la forma 20132334559", vbCritical, "Error"
        Exit Sub
    End If
Next i

With Data1.Recordset
    If .RecordCount > 0 Then
        .FindFirst "cuit='" & Trim(Text1) & "'"
        If .NoMatch Then
            .AddNew
            !cuit = Trim(Text1)
            !empresa = Trim(Text2)
            !datosextras = Trim(Text3)
            !direccion = Trim(Text5)
            !ciudad = Trim(Text8) + " * " + Trim(Text6)
            !numero = Trim(Text7)
            .Update
        Else
            .Edit
                !cuit = Text1
                !empresa = Text2
                !datosextras = Text3
            !direccion = Trim(Text5)
            !ciudad = Trim(Text8) + " * " + Trim(Text6)
            !numero = Trim(Text7)
            .Update
        End If
    Else
        .AddNew
            !cuit = Text1
            !empresa = Text2
            !datosextras = Text3
            !direccion = Trim(Text5)
            !ciudad = Trim(Text8) + " * " + Trim(Text6)
            !numero = Trim(Text7)
        .Update
    End If
    
End With

Call limpiar

End Sub

Private Sub Image2_Click()
Call limpiar
With Data1.Recordset
If .EOF And .BOF Then
    Exit Sub
End If
If .RecordCount > 0 Then
coco = !cuit
.Delete
End If
End With
Data1.Refresh
With Data2.Recordset
    If .RecordCount > 0 Then
            .MoveFirst
        While Not .EOF
                If !cuit = coco Then
                    .Delete
                End If
            .MoveNext
        Wend
    End If
End With
End Sub

Public Sub mensaje1()
    MsgBox "Ingrese bien los datos, revise el manual", vbCritical, "Error"
End Sub

Private Sub Image3_Click()
Autor.Show
End Sub

Private Sub Image5_Click()
'If guia1 = 1 Then
'If Len(Trim(Text3)) = 0 Then
''    MsgBox "La empresa debe tener un numero telefonica..:", vbCritical, "Aviso"
'    guia1 = 0
'    Exit Sub
'End If

If Len(Trim(Text1)) <> 0 Then
Em.Show

End If
'Else
'MsgBox "No selecciono la Empresa a Trabajar", vbCritical, "Error"
'End If

'guia1 = 0
End Sub

Private Sub Image6_Click()

End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    SendKeys "{TAB}"
End If
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    SendKeys "{TAB}"
End If

End Sub

Private Sub Text4_Change()
cadena = "SELECT * FROM empresas WHERE empresa LIKE '" & Trim(Text4.Text) & "*'"
Data1.RecordSource = cadena
Data1.Refresh

End Sub

Public Sub limpiar()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Text8 = ""
Text1.SetFocus
End Sub

Private Sub Text5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    SendKeys "{TAB}"
End If

End Sub

Private Sub Text6_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    SendKeys "{TAB}"
End If

End Sub

Private Sub Text7_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    SendKeys "{TAB}"
End If

End Sub
