VERSION 5.00
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "msdatlst.ocx"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmConsultaCtaCteCliente 
   Caption         =   "Consulta Cuenta Corriente x Cliente"
   ClientHeight    =   7905
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   11955
   LinkTopic       =   "Form3"
   ScaleHeight     =   7905
   ScaleWidth      =   11955
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdImprimir 
      Caption         =   "Ver Reporte"
      Height          =   375
      Left            =   7560
      TabIndex        =   13
      Top             =   240
      Width           =   1455
   End
   Begin VB.CommandButton cmdConsultar 
      Caption         =   "Consultar"
      Height          =   375
      Left            =   5760
      TabIndex        =   12
      Top             =   240
      Width           =   1575
   End
   Begin VB.Frame Frame1 
      Caption         =   " Datos del Cliente "
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1650
      Left            =   120
      TabIndex        =   0
      Top             =   0
      Width           =   5325
      Begin VB.TextBox txtTarjeta 
         Alignment       =   2  'Center
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   405
         Left            =   1440
         MaxLength       =   8
         TabIndex        =   5
         Top             =   225
         Width           =   1710
      End
      Begin VB.TextBox txtNombres 
         BackColor       =   &H80000009&
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   11.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   420
         Left            =   1440
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   4
         Top             =   720
         Width           =   3615
      End
      Begin VB.CommandButton txtBuscaCliente 
         Caption         =   "..."
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   315
         Left            =   3840
         TabIndex        =   3
         Top             =   240
         Width           =   450
      End
      Begin VB.TextBox txtLocal 
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   405
         Left            =   3360
         MaxLength       =   1
         TabIndex        =   1
         Top             =   225
         Width           =   375
      End
      Begin MSDataListLib.DataCombo dcbLocal 
         Height          =   315
         Left            =   1440
         TabIndex        =   2
         Top             =   1200
         Width           =   3615
         _ExtentX        =   6376
         _ExtentY        =   556
         _Version        =   393216
         Enabled         =   0   'False
         Style           =   2
         Text            =   "DataCombo1"
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "Nro. &Tarjeta:"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Left            =   120
         TabIndex        =   9
         Top             =   285
         Width           =   1230
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "&Nombres:"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   11.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   270
         Left            =   180
         TabIndex        =   8
         Top             =   780
         Width           =   960
      End
      Begin VB.Label lblLocal 
         AutoSize        =   -1  'True
         Caption         =   "&Local:"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   11.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   270
         Left            =   240
         TabIndex        =   7
         Top             =   1260
         Width           =   555
      End
      Begin VB.Label Label28 
         Alignment       =   2  'Center
         Caption         =   "_"
         Height          =   375
         Left            =   3120
         TabIndex        =   6
         Top             =   240
         Width           =   255
      End
   End
   Begin MSDataGridLib.DataGrid DgdDocumento 
      Height          =   2415
      Left            =   120
      TabIndex        =   10
      Top             =   1920
      Width           =   11655
      _ExtentX        =   20558
      _ExtentY        =   4260
      _Version        =   393216
      BackColor       =   -2147483624
      HeadLines       =   1
      RowHeight       =   19
      FormatLocked    =   -1  'True
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   16
      BeginProperty Column00 
         DataField       =   "cCodVta"
         Caption         =   "cCodVta"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   "TipoDoc"
         Caption         =   "TipoDoc"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column02 
         DataField       =   "DscTipoDoc"
         Caption         =   "DscTipoDoc"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column03 
         DataField       =   "cSerieDoc"
         Caption         =   "cSerieDoc"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column04 
         DataField       =   "NroDoc"
         Caption         =   "NroDoc"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column05 
         DataField       =   "DscCliente"
         Caption         =   "DscCliente"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column06 
         DataField       =   "NroRuc"
         Caption         =   "NroRuc"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column07 
         DataField       =   "TotVta"
         Caption         =   "TotVta"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column08 
         DataField       =   "TotVtaUSD"
         Caption         =   "TotVtaUSD"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column09 
         DataField       =   "Moneda"
         Caption         =   "Moneda"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column10 
         DataField       =   "cCodTipoCredito"
         Caption         =   "cCodTipoCredito"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column11 
         DataField       =   "DscTipoCredito"
         Caption         =   "DscTipoCredito"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column12 
         DataField       =   "FechaEmision"
         Caption         =   "FechaEmision"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column13 
         DataField       =   "TotalPagos"
         Caption         =   "TotalPagos"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column14 
         DataField       =   "TotalPagosUSD"
         Caption         =   "TotalPagosUSD"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column15 
         DataField       =   "Estado"
         Caption         =   "Estado"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         MarqueeStyle    =   3
         BeginProperty Column00 
            ColumnWidth     =   959.811
         EndProperty
         BeginProperty Column01 
            ColumnWidth     =   1154.835
         EndProperty
         BeginProperty Column02 
            ColumnWidth     =   1574.929
         EndProperty
         BeginProperty Column03 
            ColumnWidth     =   1755.213
         EndProperty
         BeginProperty Column04 
            ColumnWidth     =   3509.858
         EndProperty
         BeginProperty Column05 
            Object.Visible         =   -1  'True
            ColumnWidth     =   3509.858
         EndProperty
         BeginProperty Column06 
            ColumnWidth     =   14.74
         EndProperty
         BeginProperty Column07 
         EndProperty
         BeginProperty Column08 
         EndProperty
         BeginProperty Column09 
         EndProperty
         BeginProperty Column10 
         EndProperty
         BeginProperty Column11 
         EndProperty
         BeginProperty Column12 
         EndProperty
         BeginProperty Column13 
         EndProperty
         BeginProperty Column14 
         EndProperty
         BeginProperty Column15 
         EndProperty
      EndProperty
   End
   Begin MSDataGridLib.DataGrid dgdPagos 
      Height          =   2535
      Left            =   120
      TabIndex        =   11
      Top             =   4680
      Width           =   11655
      _ExtentX        =   20558
      _ExtentY        =   4471
      _Version        =   393216
      AllowUpdate     =   0   'False
      BackColor       =   -2147483624
      HeadLines       =   1
      RowHeight       =   19
      RowDividerStyle =   5
      FormatLocked    =   -1  'True
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   15
      BeginProperty Column00 
         DataField       =   "cSerieDocPago"
         Caption         =   "Serie PADE"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   "NroDocPago"
         Caption         =   "Nro PADE"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column02 
         DataField       =   "fechapago"
         Caption         =   "Fecha Pago"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column03 
         DataField       =   "FormaPagoDsc"
         Caption         =   "Forma Pago"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column04 
         DataField       =   "DocFormaPago"
         Caption         =   "Anx"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column05 
         DataField       =   "monto"
         Caption         =   "Monto"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column06 
         DataField       =   "moneda"
         Caption         =   "Moneda"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column07 
         DataField       =   "IdTarjeta"
         Caption         =   "IdTarjeta"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column08 
         DataField       =   "IdBanco"
         Caption         =   "IdBanco"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column09 
         DataField       =   "NroCtaBancaria"
         Caption         =   "NroCtaBancaria"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column10 
         DataField       =   "NroOperacion"
         Caption         =   "NroOperacion"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column11 
         DataField       =   "NroCertificadoRetencion"
         Caption         =   "NroCertificadoRetencion"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column12 
         DataField       =   "NroDepositoDetraccion"
         Caption         =   "NroDepositoDetraccion"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column13 
         DataField       =   "cClieCode"
         Caption         =   "cClieCode"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column14 
         DataField       =   "IdLocal"
         Caption         =   "IdLocal"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         MarqueeStyle    =   3
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
         EndProperty
         BeginProperty Column02 
            ColumnWidth     =   1635.024
         EndProperty
         BeginProperty Column03 
            ColumnWidth     =   1785.26
         EndProperty
         BeginProperty Column04 
            ColumnWidth     =   2085.166
         EndProperty
         BeginProperty Column05 
         EndProperty
         BeginProperty Column06 
         EndProperty
         BeginProperty Column07 
            Object.Visible         =   0   'False
         EndProperty
         BeginProperty Column08 
            Object.Visible         =   0   'False
         EndProperty
         BeginProperty Column09 
            Object.Visible         =   0   'False
         EndProperty
         BeginProperty Column10 
            Object.Visible         =   0   'False
         EndProperty
         BeginProperty Column11 
            Object.Visible         =   0   'False
         EndProperty
         BeginProperty Column12 
            Object.Visible         =   0   'False
         EndProperty
         BeginProperty Column13 
            Object.Visible         =   0   'False
         EndProperty
         BeginProperty Column14 
            Object.Visible         =   0   'False
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "frmConsultaCtaCteCliente"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CargarDocumentosxCliente(ByVal nCodCli As Integer, ByVal nLocal As Integer)
Dim cnSQL As ADODB.Connection
Dim ADORS As ADODB.Recordset
Dim sSQL As String


If Not oDBAdmin.AbrirBD(cnSQL, psConnectString) Then GoTo Salir 'OMNISYS


sSQL = "usp_sel_CtaCtexCliente " & nCodCli & "," & nLocal & ""


If Not oDBAdmin.EjecutarConsulta(cnSQL, sSQL, ADORS) Then GoTo Salir


Set DgdDocumento.DataSource = ADORS


Salir:
Set cnSQL = Nothing
End Sub
Private Sub CargarPagosxDocumento(ByVal sTipoDoc As String, ByVal sSerieDoc As String, ByVal sNroDoc As String)
Dim cnSQL As ADODB.Connection
Dim ADORS As ADODB.Recordset
Dim sSQL As String

sSQL = "select cSerieDocPago,NroDocPago,fechapago,FormaPagoDsc=(select vDscTipoPago from tipoformapago where cCodTipoPago=P.FormaPago), " _
& "DocFormaPago= " _
& "Case FormaPago " _
& "when '02' then (select descrip from tipo_tarjeta where cod_tar=P.IdTarjeta) " _
& "when '03' then P.NroCertificadoRetencion " _
& "when '04' then P.NroDepositoDetraccion " _
& "when '05' then(select vDscBanco from banco where cCodBanco= P.IdBanco) " _
& "Else '' end, monto, " _
& "moneda= Case moneda when 'N' then 'Soles' Else 'Dolares' End, " _
& "P.IdTarjeta,P.IdBanco,P.NroCtaBancaria,P.NroOperacion,P.NroCertificadoRetencion,P.NroDepositoDetraccion,P.cClieCode,p.idLocal " _
& "from pagos P Where P.TipoDoc='" & sTipoDoc & "' and P.cSerieDoc='" & sSerieDoc & "' and P.NroDoc='" & sNroDoc & "' order by P.NroItem "

If Not oDBAdmin.AbrirBD(cnSQL, psConnectString) Then GoTo Salir 'OMNISYS

If Not oDBAdmin.EjecutarConsulta(cnSQL, sSQL, ADORS) Then GoTo Salir


Set dgdPagos.DataSource = ADORS

Salir:
Set cnSQL = Nothing
End Sub

Private Sub cmdConsultar_Click()
    If Not IsNumeric(txtTarjeta.Text) Or Not IsNumeric(txtLocal.Text) Then Exit Sub

      If IsNumeric(CInt(txtTarjeta.Text)) And IsNumeric(txtLocal.Text) And (val(txtLocal.Text) = 1 Or val(txtLocal.Text) = 2) Then
        CargarDocumentosxCliente CInt(txtTarjeta.Text), CInt(txtLocal.Text)
      End If
End Sub

Private Sub DgdDocumento_Click()

CargarPagosxDocumento DgdDocumento.Columns(1).Value, DgdDocumento.Columns(3).Value, DgdDocumento.Columns(4).Value

End Sub

Private Sub Form_Load()

CargarCombos

End Sub


Private Sub CargarCombos()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sSQL As String

Set cn = New ADODB.Connection
 
  'Conectar a BD (SQL)
  If Not oDBAdmin.AbrirBD(cn, psCadenaConexionSQLServer) Then GoTo Salir
  sSQL = "SELECT idlocal,dsclocal FROM local"
  If Not oDBAdmin.EjecutarConsulta(cn, sSQL, rs) Then GoTo Salir
  With dcbLocal
    Set dcbLocal.RowSource = rs
    dcbLocal.BoundColumn = "idlocal"
    dcbLocal.ListField = "dsclocal"
  End With


Salir:
Set rs = Nothing
Set cn = Nothing

End Sub


Private Sub LlamarCliente()
  On Error GoTo LineaError
  
  If frmBusquedaArticulos.Visible Then Exit Sub
  
  Dim sSQL As String
  Dim ADORS As ADODB.Recordset
  Dim i As Long, j As Long
  Dim sTarjeta As String
  'sw To SQL Server era >>> nIdLocal
  Dim idLocal As Integer
  
  If Trim(txtTarjeta.Text) = "" Then
    txtNombres = ""
    dcbLocal.BoundText = -1
    GoTo Salir
  End If
  
  sTarjeta = Right("00000000" + Trim(txtTarjeta.Text), 8)
  'sw To SQL Server era >>> nIdLocal
  idLocal = val(txtLocal.Text)
  
  txtTarjeta.Text = sTarjeta
  
'  sSQL = "SELECT a.cClieCode, sClieApel + ' ' + sClieName AS sName, dNacmDate, " + _
'         "nPuntCant, nTickCant, dUltTDate, sTranDesc " + _
'         "FROM Cliente a, Transaccion b, Tarjeta c " + _
'         "WHERE a.cTranCode = b.cTranCode AND " + _
'         "a.cClieCode = c.cClieCode AND " + _
'         "nTarjNumb = '$'"
         
  'sw To SQL Server era >>> nIdLocal >>> Date()
  sSQL = " SELECT a.cClieCode, sClieApel , sClieName , dNacmDate, a.IdLocal, " + _
         "        nPuntCant, nTickCant, dUltTDate" + _
         "   FROM Cliente a, Tarjeta c " + _
         "  WHERE a.cClieCode = c.cClieCode and a.IdLocal=c.IdLocal and (c.cTarjActi=1 and Convert(Char(10), dcadudate,112)>=Convert(Char(10), getdate(),112)) " + _
         "    AND nTarjNumb = '$'"
       
  'sw To SQL Server era >>> nIdLocal
  If idLocal = 1 Or idLocal = 2 Then
    sSQL = sSQL + "    AND a.IdLocal = $ "
  End If
  
  'sw To SQL Server era >>> nIdLocal
  sSQL = VBsprintf(sSQL, sTarjeta, CInt(idLocal))
  
  If bolExistenProblemasConexionBDCliente = False Then
    ConectarBDCliente     'Abrimos conexion
  End If
  
  If Not oDBAdmin.EjecutarConsulta(ADOCnn2, sSQL, ADORS) Then GoTo Salir
  
  If ADORS.RecordCount = 0 Then
    txtTarjeta.Text = ""
    txtNombres.Text = ""
    dcbLocal.BoundText = -1
    txtLocal.Text = ""
    MsgBox "El Código de cliente no existe o la tarjeta se encuentra inactiva"
    txtTarjeta.SetFocus
  ElseIf ADORS.RecordCount = 1 Then
    'lblLocal.Visible = False
    'dcbLocal.Visible = False
    txtNombres.Text = LeerCampo(ADORS("sClieApel")) + " " + LeerCampo(ADORS("sClieName"))
    'lblLocal.Visible = True: dcbLocal.Visible = True
    'sw To SQL Server eran >>> nIdLocal
    dcbLocal.BoundText = ADORS("IdLocal")
    txtLocal.Text = ADORS("IdLocal")
  ElseIf ADORS.RecordCount = 2 Then
    txtNombres.Text = ""
    lblLocal.Visible = True: dcbLocal.Visible = True
    'MsgBox "Seleccione local al cual pertenece!!", vbInformation + vbOKOnly, "Mensaje"
    dcbLocal.BoundText = -1
    'dcbLocal.SetFocus
    txtBuscaCliente_Click
  End If
  
  GoTo Salir
  
LineaError:
  MsgBox Err.Description, vbOKOnly + vbInformation
  Screen.MousePointer = vbDefault

Salir:
  Set ADORS = Nothing
End Sub


Private Sub txtBuscaCliente_Click()
  frmBusquedaArticulos.frmPadre = "frmConsultaCtaCteCliente"
  frmBusquedaArticulos.pOpcion = "Cliente"
  frmBusquedaArticulos.inicio
  frmBusquedaArticulos.txtBuscar.Text = txtTarjeta.Text
  frmBusquedaArticulos.cmdBuscar_Click
  frmBusquedaArticulos.Show vbModal
  txtNombres.Enabled = (Trim(txtTarjeta.Text) = "")
  txtNombres.Locked = Not (Trim(txtTarjeta.Text) = "")
End Sub

Private Sub txtLocal_KeyDown(KeyCode As Integer, Shift As Integer)
  Select Case KeyCode
    Case 13
      If IsNumeric(txtLocal.Text) And (val(txtLocal.Text) = 1 Or val(txtLocal.Text) = 2) Then
        'Call txtTarjeta_LostFocus
        Call LlamarCliente
        
      End If
  End Select
End Sub

Private Sub txtTarjeta_KeyDown(KeyCode As Integer, Shift As Integer)
  Select Case KeyCode
    Case vbKeyF5
      'txtBuscaCliente_Click
    Case 13
      'Call txtTarjeta_LostFocus
      Call LlamarCliente
  End Select
End Sub
