VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Object = "{69F9D01E-F1DE-11D4-9536-002018603DA2}#7.0#0"; "MiControl.ocx"
Begin VB.Form FClienteGarantia 
   BorderStyle     =   1  'Fixed Single
   ClientHeight    =   3405
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6900
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3405
   ScaleWidth      =   6900
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton cmdcancelar 
      Cancel          =   -1  'True
      Caption         =   "Cancelar"
      Height          =   735
      Left            =   5400
      Picture         =   "FClienteGarantia.frx":0000
      Style           =   1  'Graphical
      TabIndex        =   8
      Top             =   2520
      Width           =   1215
   End
   Begin VB.TextBox txtDescGarantia 
      Height          =   285
      Left            =   1800
      TabIndex        =   2
      Top             =   840
      Width           =   4695
   End
   Begin VB.CommandButton cmdBusMonedaGar 
      Height          =   375
      Left            =   4440
      MouseIcon       =   "FClienteGarantia.frx":030A
      MousePointer    =   99  'Custom
      Picture         =   "FClienteGarantia.frx":045C
      Style           =   1  'Graphical
      TabIndex        =   4
      ToolTipText     =   "Buscar Tipo de Moneda"
      Top             =   1320
      Width           =   375
   End
   Begin VB.CommandButton cmdBusTipoGar 
      Height          =   375
      Left            =   4440
      MouseIcon       =   "FClienteGarantia.frx":098E
      MousePointer    =   99  'Custom
      Picture         =   "FClienteGarantia.frx":0AE0
      Style           =   1  'Graphical
      TabIndex        =   1
      ToolTipText     =   "Buscar Tipo de Garantia"
      Top             =   360
      Width           =   375
   End
   Begin MSComCtl2.DTPicker dtpFecha 
      Height          =   285
      Left            =   5160
      TabIndex        =   6
      Top             =   1800
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   503
      _Version        =   393216
      Format          =   50200577
      CurrentDate     =   37578
   End
   Begin MiControl.CtrlNumber ctnMontoGar 
      Height          =   255
      Left            =   1800
      TabIndex        =   5
      Top             =   1800
      Width           =   1695
      _ExtentX        =   2990
      _ExtentY        =   450
      BackColor       =   -2147483643
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin MSDataListLib.DataCombo dtcMonedaGar 
      Height          =   315
      Left            =   1800
      TabIndex        =   3
      Top             =   1320
      Width           =   2535
      _ExtentX        =   4471
      _ExtentY        =   556
      _Version        =   393216
      Style           =   2
      Text            =   ""
   End
   Begin MSDataListLib.DataCombo dtcTipoGarantia 
      Height          =   315
      Left            =   1800
      TabIndex        =   0
      Top             =   360
      Width           =   2535
      _ExtentX        =   4471
      _ExtentY        =   556
      _Version        =   393216
      Style           =   2
      Text            =   ""
   End
   Begin VB.CommandButton cmdaceptar 
      Caption         =   "&Grabar"
      Height          =   735
      Left            =   4080
      Picture         =   "FClienteGarantia.frx":1012
      Style           =   1  'Graphical
      TabIndex        =   7
      Top             =   2520
      Width           =   1335
   End
   Begin VB.Image Image1 
      Height          =   480
      Left            =   5400
      Picture         =   "FClienteGarantia.frx":131C
      Top             =   240
      Width           =   480
   End
   Begin VB.Line Line2 
      X1              =   240
      X2              =   6600
      Y1              =   2400
      Y2              =   2400
   End
   Begin VB.Line Line1 
      X1              =   240
      X2              =   6600
      Y1              =   120
      Y2              =   120
   End
   Begin VB.Label lblTipoGar 
      AutoSize        =   -1  'True
      Caption         =   "Tipo de Garantía"
      Height          =   195
      Left            =   360
      TabIndex        =   13
      Top             =   360
      Width           =   1215
   End
   Begin VB.Label lblDescrGar 
      Caption         =   "Descripción de Garantía"
      Height          =   435
      Left            =   360
      TabIndex        =   12
      Top             =   840
      Width           =   1020
   End
   Begin VB.Label lblMonedaGar 
      Caption         =   "Moneda"
      Height          =   255
      Left            =   360
      TabIndex        =   11
      Top             =   1360
      Width           =   735
   End
   Begin VB.Label lblMontoGar 
      Caption         =   "Monto"
      Height          =   255
      Left            =   360
      TabIndex        =   10
      Top             =   1800
      Width           =   855
   End
   Begin VB.Label lblFechaVenGar 
      Caption         =   "Fecha de Vencimiento"
      Height          =   495
      Left            =   3960
      TabIndex        =   9
      Top             =   1800
      Width           =   975
   End
End
Attribute VB_Name = "FClienteGarantia"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public GrecibeUbicacion As BookmarkEnum
Public GrecibeColumnaID As String
Public GrecibeColumnaOpcional As String
Public GrecibeColumnaOpcional2 As String
Public GrecibeColumnaOpcional3 As String
Public objMoneda As DB_MA_MANTENIMIENTOS.C_MONEDA
Public objCliente As DB_MA_MANTENIMIENTOS.C_CLIENTE
Public GlngCorrelativo As Long
Public GstrcodCliente As String
Public GstrTipoGarantia As String
Public GblnModificando As Boolean


Private Sub cmdAceptar_Click()
On Error GoTo ErrorHandler

  If Trim(dtcTipoGarantia.Text) = Empty Then
     MsgBox "Ingrese Tipo de Garantia", vbDefaultButton1 + vbExclamation, "Faltan Parámetros"
     dtcTipoGarantia.SetFocus
     Exit Sub
  End If
  
  If Trim(txtDescGarantia.Text) = Empty Then
     MsgBox "Ingrese Descripción de Garantía", vbDefaultButton1 + vbExclamation, "Faltan Parámetros"
     txtDescGarantia.SetFocus
     Exit Sub
  End If
  
    If Not GblnModificando Then
       '           AgregarGarantiaEnTmp
        objCliente.AgregarGarantiaEnTmp GlngCorrelativo, dtcTipoGarantia.BoundText, GFormatodeNumero(CDbl(ctnMontoGar.Text), GintDecResultado), Trim(txtDescGarantia.Text), dtpFecha.Value, dtcMonedaGar.BoundText
    Else
        objCliente.ActualizarGarantiaEnTmp GlngCorrelativo, dtcTipoGarantia.BoundText, GFormatodeNumero(CDbl(ctnMontoGar.Text), GintDecResultado), Trim(txtDescGarantia.Text), dtpFecha.Value, dtcMonedaGar.BoundText
    End If

  Unload Me

Exit Sub

ErrorHandler:
    
    MsgBox MensajedeError(ERR.Number, ERR.Description), vbCritical + vbDefaultButton1, "Advertencia"
End Sub

Private Sub cmdBusMonedaGar_Click()
    'Lineas que llaman al Formulario de Búsqueda
     
     Dim ArrayBusqueda(1 To 2, 1 To 3) As Variant
     ArrayBusqueda(1, 1) = "CuryId"
     ArrayBusqueda(1, 2) = "Código "
     ArrayBusqueda(1, 3) = 1000
     ArrayBusqueda(2, 1) = "Descr"
     ArrayBusqueda(2, 2) = "Descripción "
     ArrayBusqueda(2, 3) = 4000
       
     FBusquedasMa2.GObtenerRegistros objMoneda.ListarMonedas, ArrayBusqueda, 2, 2
     FBusquedasMa2.GnroPantalla = 0
     FBusquedasMa2.Show vbModal
     
     If GrecibeUbicacion <> 0 Then
         dtcMonedaGar.BoundText = GrecibeColumnaID
     End If
End Sub

Private Sub cmdBusTipoGar_Click()
    'Lineas que llaman al Formulario de Búsqueda
     
     Dim ArrayBusqueda(1 To 2, 1 To 3) As Variant
     ArrayBusqueda(1, 1) = "CUSTWARRANTYTYPEID"
     ArrayBusqueda(1, 2) = "Código "
     ArrayBusqueda(1, 3) = 1000
     ArrayBusqueda(2, 1) = "DECRCUSTWARRANTY"
     ArrayBusqueda(2, 2) = "Descripción "
     ArrayBusqueda(2, 3) = 4000
       
     FBusquedasMa2.GObtenerRegistros objCliente.ListarGarantiasAyuda, ArrayBusqueda, 2, 2
     FBusquedasMa2.GnroPantalla = 0
     FBusquedasMa2.Show vbModal
     
     If GrecibeUbicacion <> 0 Then
         dtcTipoGarantia.BoundText = GrecibeColumnaID
     End If
End Sub
Public Sub CargaDataCombo(objDataCombo As DataCombo, rsSource As ADODB.Recordset, istrCampo1 As String, istrCampo2 As String)
    If rsSource.RecordCount <> 0 Then
        Set objDataCombo.DataSource = rsSource
        objDataCombo.DataField = istrCampo2
        Set objDataCombo.RowSource = rsSource
        objDataCombo.ListField = istrCampo2
        objDataCombo.BoundColumn = istrCampo1
        objDataCombo.BoundText = rsSource.Fields(istrCampo2)
    End If
End Sub

Private Sub cmdCancelar_Click()
  Unload Me
  Set objCliente = Nothing
End Sub


Private Sub ctnMontoGar_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        dtpFecha.SetFocus
    End If
End Sub

Private Sub dtcMonedaGar_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        ctnMontoGar.SetFocus
    End If
End Sub

Private Sub dtcTipoGarantia_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        txtDescGarantia.SetFocus
    End If
End Sub

Private Sub dtpFecha_KeyDown(KeyCode As Integer, Shift As Integer)
   If KeyCode = 13 Then
        cmdaceptar.SetFocus
    End If
End Sub

Private Sub Form_Load()
    
    ctnMontoGar.Enteros = 8
    ctnMontoGar.Decimales = GintDecResultado
    
    Set objMoneda = New DB_MA_MANTENIMIENTOS.C_MONEDA
    Set objCliente = New DB_MA_MANTENIMIENTOS.C_CLIENTE
    Call CargaDataCombo(dtcTipoGarantia, objCliente.ListarGarantiasAyuda, "CUSTWARRANTYTYPEID", "DECRCUSTWARRANTY")
    Call CargaDataCombo(dtcMonedaGar, objMoneda.ListarMonedas, "Curyid", "Descr")
    
    dtcTipoGarantia.BoundText = GstrTipoGarantia
    dtcTipoGarantia.Enabled = Not GblnModificando

End Sub

Private Sub Form_Unload(Cancel As Integer)
    GstrTipoGarantia = Empty
    GblnModificando = False
End Sub

Private Sub txtDescGarantia_KeyPress(KeyAscii As Integer)
    KeyAscii = GBloqueaCaracter(KeyAscii)
    If KeyAscii = 13 Then
        dtcMonedaGar.SetFocus
    End If
End Sub
