VERSION 5.00
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{00025600-0000-0000-C000-000000000046}#5.2#0"; "crystl32.ocx"
Begin VB.Form frecuperartransaccion 
   Caption         =   "Recuperar Transacciones"
   ClientHeight    =   6225
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   11520
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   ScaleHeight     =   6225
   ScaleWidth      =   11520
   StartUpPosition =   3  'Windows Default
   Begin Crystal.CrystalReport crRegistroTransPend 
      Left            =   2520
      Top             =   5040
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   348160
      WindowControlBox=   -1  'True
      WindowMaxButton =   -1  'True
      WindowMinButton =   -1  'True
      PrintFileLinesPerPage=   60
   End
   Begin VB.CommandButton cmdImprimeTrans 
      Caption         =   "Imprimir"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   5400
      Picture         =   "frecuperartransaccioncstore.frx":0000
      Style           =   1  'Graphical
      TabIndex        =   6
      Tag             =   "R ASDASD"
      Top             =   5280
      Width           =   1815
   End
   Begin VB.CommandButton cmd_eliminar 
      Caption         =   "Eliminar"
      Default         =   -1  'True
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   2940
      Picture         =   "frecuperartransaccioncstore.frx":030A
      Style           =   1  'Graphical
      TabIndex        =   4
      Tag             =   "R ASDASD"
      Top             =   5280
      Width           =   1815
   End
   Begin MSDataGridLib.DataGrid DBCABEZERA 
      Height          =   1935
      Left            =   0
      TabIndex        =   2
      Top             =   600
      Width           =   11415
      _ExtentX        =   20135
      _ExtentY        =   3413
      _Version        =   393216
      HeadLines       =   1
      RowHeight       =   15
      BeginProperty HeadFont {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
      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
      Caption         =   "Ventas Pendientes"
      ColumnCount     =   2
      BeginProperty Column00 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   3082
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   3082
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
         EndProperty
      EndProperty
   End
   Begin VB.CommandButton cmd_Restaurar 
      Caption         =   "Recuperar"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   480
      Picture         =   "frecuperartransaccioncstore.frx":0614
      Style           =   1  'Graphical
      TabIndex        =   1
      Tag             =   "R ASDASD"
      Top             =   5280
      Width           =   1815
   End
   Begin VB.CommandButton CMD_CANCELAR 
      Cancel          =   -1  'True
      Caption         =   "Salir"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   9000
      Picture         =   "frecuperartransaccioncstore.frx":091E
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   5280
      Width           =   1935
   End
   Begin MSDataGridLib.DataGrid DBDetalle 
      Height          =   2295
      Left            =   0
      TabIndex        =   3
      Top             =   2640
      Width           =   11415
      _ExtentX        =   20135
      _ExtentY        =   4048
      _Version        =   393216
      AllowUpdate     =   0   'False
      Enabled         =   -1  'True
      HeadLines       =   1
      RowHeight       =   15
      BeginProperty HeadFont {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
      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
      Caption         =   "Detalle de Ventas Pendientes"
      ColumnCount     =   2
      BeginProperty Column00 
         DataField       =   ""
         Caption         =   ""
         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       =   ""
         Caption         =   ""
         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 
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
         EndProperty
      EndProperty
   End
   Begin VB.Label Label1 
      Caption         =   "[ENTER] Seleccionar  [F3] Eliminar"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   3360
      TabIndex        =   5
      Top             =   240
      Width           =   5295
   End
End
Attribute VB_Name = "frecuperartransaccion"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mobj_cventasgen As DB_OP_FACTURACION.C_VENTASGENERAL
Dim MOBJ_CVENTASCSTORE As DB_OP_FACTURACION.C_VENTASCSTORE
Dim RS_TEMP As ADODB.Recordset


Public Sub FormatoGrilladet()
DBDetalle.Columns(0).Caption = "Seq"
DBDetalle.Columns(0).Width = 380

DBDetalle.Columns(1).Caption = "Id.Producto"
DBDetalle.Columns(1).Width = 1350

DBDetalle.Columns(2).Caption = "Descripcion"
DBDetalle.Columns(2).Width = 4900

DBDetalle.Columns(3).Caption = "Precio"
DBDetalle.Columns(3).Width = 1200  'Precio
DBDetalle.Columns(3).Alignment = dbgRight
DBDetalle.Columns(3).NumberFormat = GMascara(GintDecPrecio)

DBDetalle.Columns(4).Caption = "%Impto"
DBDetalle.Columns(4).Width = 590
DBDetalle.Columns(4).Alignment = dbgRight
DBDetalle.Columns(4).NumberFormat = GMascara(GintDecPrecio)

DBDetalle.Columns(5).Caption = "Cantidad"
DBDetalle.Columns(5).Width = 920
DBDetalle.Columns(5).Alignment = dbgRight
DBDetalle.Columns(5).NumberFormat = GMascara(GintDecStock)

DBDetalle.Columns(6).Caption = "Sub Total"
DBDetalle.Columns(6).Visible = True
DBDetalle.Columns(6).Width = 1500 'Total Base
DBDetalle.Columns(6).Alignment = dbgRight
DBDetalle.Columns(6).NumberFormat = GMascara(GintDecPrecio)
DBDetalle.Columns(6).Caption = "Total"
DBDetalle.Columns(7).Visible = False
DBDetalle.Columns(8).Visible = False
DBDetalle.Columns(9).Visible = False
DBDetalle.Columns(9).Visible = False
DBDetalle.Columns(10).Visible = False
DBDetalle.Columns(10).Visible = False
DBDetalle.Columns(11).Visible = False
DBDetalle.Columns(12).Visible = False
End Sub

Private Sub cmd_Cancelar_Click()
gdouloadsales = 0
Unload Me
End Sub

Private Sub cmd_eliminar_Click()
If Not RS_TEMP.EOF Or RS_TEMP.RecordCount > 0 Then
    If InputBox("Escriba la contraseņa..", "Confirmar eliminar Transaccion Pendiente") = "AIRAM" Then
        Call borrartransaccion
    Else
        MsgBox "Imposible eliminar Transaccion Pendiente", vbExclamation, "Advertencia"
        Exit Sub
    End If
End If

End Sub
Private Sub cmd_Restaurar_Click()
If Not RS_TEMP.EOF Or RS_TEMP.RecordCount > 0 Then
        Call recuperar
End If
End Sub

Private Sub Command1_Click()

End Sub

Private Sub cmdImprimeTrans_Click()
'imprime registro de transacciones
Screen.MousePointer = 11
    crRegistroTransPend.ReportFileName = GstrReportesVta + "rpt_TransSalvadas.rpt"
    crRegistroTransPend.WindowTitle = "Reporte de Transacciones Pendientes"
    
    crRegistroTransPend.Formulas(1) = "formusuario=stringvar strusuario; strusuario:='" & GCUSERID & "'"
    
    crRegistroTransPend.WindowState = crptMaximized
    crRegistroTransPend.WindowShowPrintSetupBtn = True
    crRegistroTransPend.Connect = "DSN=SIES"
    crRegistroTransPend.RetrieveSQLQuery
    crRegistroTransPend.Action = 1
    crRegistroTransPend.Reset
      
    
Screen.MousePointer = 0
End Sub

Private Sub DBCABEZERA_DblClick()
   If Not RS_TEMP.EOF Or RS_TEMP.RecordCount > 0 Then
    Call recuperar
    End If
End Sub

Private Sub DBCABEZERA_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyEscape Then
    Call cmd_Cancelar_Click
End If

If KeyCode = vbKeyF3 Then
    If Not RS_TEMP.EOF Or RS_TEMP.RecordCount > 0 Then
       If InputBox("Escriba la contraseņa..", "Confirmar eliminar Transaccion Pendiente") = "AIRAM" Then
          Call borrartransaccion
       Else
          MsgBox "Imposible eliminar Transaccion Pendiente", vbExclamation, "Advertencia"
          Exit Sub
       End If
    End If
End If

If KeyCode = 13 Then
    If Not RS_TEMP.EOF Or RS_TEMP.RecordCount > 0 Then
        Call recuperar
    End If
End If
End Sub

Private Sub DBCABEZERA_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
Dim LDOU_CORRELATIVO As Double
If Not RS_TEMP.EOF And RS_TEMP.RecordCount > 0 Then
    LDOU_CORRELATIVO = RS_TEMP!nro_transaccion
    Set DBDetalle.DataSource = MOBJ_CVENTASCSTORE.ObtenerDatosTMPSCTORE(LDOU_CORRELATIVO, GintDecPrecio)
    Call FormatoGrilladet
End If
End Sub
Private Sub Form_Activate()
gdouloadsales = 0
DBCABEZERA.SetFocus
End Sub

Private Sub Form_Load()
Set mobj_cventasgen = New DB_OP_FACTURACION.C_VENTASGENERAL
Set MOBJ_CVENTASCSTORE = New DB_OP_FACTURACION.C_VENTASCSTORE
Call FormatoGrillacab
End Sub
Public Sub FormatoGrillacab()
Set RS_TEMP = mobj_cventasgen.obtenertransgrabadas(GstrPuntodeVenta, gstrtipoventas)
Set DBCABEZERA.DataSource = RS_TEMP

DBCABEZERA.Columns(0).Width = 1350    'nro.
DBCABEZERA.Columns(1).Width = 1400    'codigo
DBCABEZERA.Columns(2).Width = 4600   'nombre
DBCABEZERA.Columns(3).Width = 1300  'total
DBCABEZERA.Columns(3).Alignment = dbgRight
DBCABEZERA.Columns(3).NumberFormat = GMascara(GintDecPrecio)
DBCABEZERA.Columns(4).Width = 1000    'fecha
DBCABEZERA.Columns(5).Width = 1200    'vendedor
If RS_TEMP.RecordCount > 0 Then
    Call DBCABEZERA_RowColChange(1, 1)
    'rs_temp.MoveLast
    'rs_temp.MoveFirst
End If
End Sub
Public Sub borrartransaccion()
Dim ldbo_nro As Double
ldbo_nro = RS_TEMP!nro_transaccion

If MsgBox("Esta Seguro de Eliminar el documentoNo." + Str(ldbo_nro), vbYesNo, "Atencion") = vbYes Then
    MOBJ_CVENTASCSTORE.borrartransgrabadas ldbo_nro
    Call FormatoGrillacab

End If
End Sub

Public Sub recuperar()
Dim ldbo_nro As Double
ldbo_nro = RS_TEMP!nro_transaccion

If MsgBox("Esta Seguro de Recuperar el documentoNo." + Str(ldbo_nro), vbYesNo, "Atencion") = vbYes Then
    gdouloadsales = ldbo_nro
Else
    Exit Sub
End If
Unload Me
End Sub

