VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form_Est_deuda 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Form2"
   ClientHeight    =   2325
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6435
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2325
   ScaleWidth      =   6435
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   Begin VB.Frame Frame1 
      Caption         =   "Seleccion de Mes y Año"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   2055
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   6135
      Begin VB.CommandButton Command2 
         Caption         =   "&Estimación de Morasidad"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   360
         TabIndex        =   6
         Top             =   1200
         Width           =   2295
      End
      Begin VB.CommandButton Command1 
         Caption         =   "&Resumen Contable"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   3360
         TabIndex        =   3
         Top             =   1200
         Width           =   2295
      End
      Begin MSComctlLib.ImageCombo cbimes 
         Height          =   345
         Left            =   360
         TabIndex        =   1
         Top             =   600
         Width           =   2295
         _ExtentX        =   4048
         _ExtentY        =   609
         _Version        =   393216
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Locked          =   -1  'True
      End
      Begin MSComctlLib.ImageCombo cbiagno 
         Height          =   345
         Left            =   3360
         TabIndex        =   2
         Top             =   600
         Width           =   2295
         _ExtentX        =   4048
         _ExtentY        =   609
         _Version        =   393216
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Locked          =   -1  'True
      End
      Begin VB.Label Label2 
         Alignment       =   2  'Center
         Caption         =   "Año"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   255
         Left            =   3360
         TabIndex        =   5
         Top             =   360
         Width           =   2295
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         Caption         =   "Mes"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   255
         Left            =   360
         TabIndex        =   4
         Top             =   360
         Width           =   2295
      End
   End
End
Attribute VB_Name = "Form_Est_deuda"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub llenarcmbimgsql(cmbi As ImageCombo, constr As String)
    Dim tablaconsulta As ADODB.Recordset
    Dim contador As Integer
    cmbi.ComboItems.Clear
    contador = 0
    
    Set tablaconsulta = New ADODB.Recordset

    tablaconsulta.Open constr, conn
    contador = 1
    cmbi.ComboItems.Clear
   While Not tablaconsulta.EOF
        
        cmbi.ComboItems.Add contador, , tablaconsulta!texto
        contador = contador + 1
        tablaconsulta.MoveNext
    Wend
    tablaconsulta.Close
    Set cmbi.SelectedItem = cmbi.ComboItems.Item(1)
End Sub

Private Sub cbimes_Change()
    llenarcmbimgsql Me.cbiagno, "Select agno as texto from hist_deudaxcur where mes=" & Trim(Me.cbimes.Text) & " group by agno"
End Sub

Private Sub Command1_Click()
If Me.cbiagno.Text <> "" And Me.cbimes.Text <> "" Then
   
   Form_main.CrystalReport.ReportFileName = App.Path & "\rpt\estadisticasdeudasxmes.rpt"
   Form_main.CrystalReport.WindowState = crptMaximized
   Form_main.CrystalReport.WindowTitle = "Reporte de Deudas al Mes"
   Form_main.CrystalReport.ReplaceSelectionFormula ("")
   Form_main.CrystalReport.ReplaceSelectionFormula ("{hist_deudaxcurxmes.mes}=" & Me.cbimes.Text & " and {hist_deudaxcurxmes.agno}=" & Me.cbiagno.Text)
   Form_main.CrystalReport.Destination = crptToWindow
   Form_main.CrystalReport.Action = 1
Else
   Form_main.CrystalReport.ReportFileName = App.Path & "\rpt\estadisticasdeudasxmes.rpt"
   Form_main.CrystalReport.WindowState = crptMaximized
   Form_main.CrystalReport.WindowTitle = "Reporte de Deudas al Mes"
   Form_main.CrystalReport.ReplaceSelectionFormula ("")
   Form_main.CrystalReport.ReplaceSelectionFormula ("{hist_deudaxcurxmes.mes}=" & str(Month(Date) - 1) & " and {hist_deudaxcurxmes.agno}=" & str(Year(Date)))
   Form_main.CrystalReport.Destination = crptToWindow
   Form_main.CrystalReport.Action = 1
End If
End Sub

Private Sub Command2_Click()
If Me.cbiagno.Text <> "" And Me.cbimes.Text <> "" Then
 Form_main.CrystalReport.ReportFileName = App.Path & "\rpt\estadisticasdeudas.rpt"
   Form_main.CrystalReport.WindowState = crptMaximized
   Form_main.CrystalReport.WindowTitle = "Estadísticas De Deudas"
   Form_main.CrystalReport.ReplaceSelectionFormula ("")
   Form_main.CrystalReport.ReplaceSelectionFormula ("{hist_deudaxcur.mes}=" & Me.cbimes.Text & " and {hist_deudaxcur.agno}=" & Me.cbiagno.Text)
   Form_main.CrystalReport.Destination = crptToWindow
   Form_main.CrystalReport.Action = 1
End If
End Sub

Private Sub Form_Load()
    llenarcmbimgsql Me.cbimes, "Select mes as texto from hist_deudaxcur group by mes"
    llenarcmbimgsql Me.cbiagno, "Select agno as texto from hist_deudaxcur where mes=" & Trim(Me.cbimes.Text) & " group by agno"

End Sub
