VERSION 5.00
Object = "{90F3D7B3-92E7-44BA-B444-6A8E2A3BC375}#1.0#0"; "actskin4.ocx"
Begin VB.Form FSeleccionTurno 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Cambio de Turno"
   ClientHeight    =   2145
   ClientLeft      =   6630
   ClientTop       =   2295
   ClientWidth     =   5880
   Icon            =   "FSeleccionTurno.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2145
   ScaleWidth      =   5880
   Begin VB.TextBox lblturnoaCambiar 
      Appearance      =   0  'Flat
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      Left            =   2400
      Locked          =   -1  'True
      TabIndex        =   3
      Top             =   360
      Width           =   3135
   End
   Begin VB.CommandButton CMD_CANCELAR 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Cancelar"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1000
      Left            =   4440
      Picture         =   "FSeleccionTurno.frx":0442
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   960
      Width           =   1200
   End
   Begin ACTIVESKINLibCtl.SkinLabel SkinLabel1 
      Height          =   255
      Left            =   240
      OleObjectBlob   =   "FSeleccionTurno.frx":04DF
      TabIndex        =   2
      Top             =   400
      Width           =   2055
   End
   Begin ACTIVESKINLibCtl.Skin sknTurno 
      Left            =   840
      OleObjectBlob   =   "FSeleccionTurno.frx":0561
      Top             =   1560
   End
   Begin VB.CommandButton CMD_ACEPTAR 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Aceptar"
      Default         =   -1  'True
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1000
      Left            =   3240
      Picture         =   "FSeleccionTurno.frx":0795
      Style           =   1  'Graphical
      TabIndex        =   0
      Tag             =   "R ASDASD"
      Top             =   960
      Width           =   1200
   End
   Begin VB.Shape Shape1 
      Height          =   615
      Left            =   120
      Top             =   240
      Width           =   5535
   End
End
Attribute VB_Name = "FSeleccionTurno"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Se retiraron los Fuentes de la red el 24/04/2003
Dim MConGasBoy  As ADODB.Connection
Dim Mrstranspend As ADODB.Recordset
Dim MobjVentasPlaya As DB_OP_FACTURACION.C_VENTASPLAYA
Dim objCarasVendedor As DB_OP_MANTENIMIENTOS.C_CARAS_VENDEDOR
Dim rs_temporal As ADODB.Recordset

Private Sub cmd_aceptar_Click()
Dim LintCara As Integer
Dim BlnPendientes As Boolean
Dim LStrCadenaPtoVta As String

BlnPendientes = False

  If MsgBox("Se va ha Realizar el Cambio de Turno, Desea Continuar", vbQuestion + vbYesNo, "Cambio de Turno") = vbYes Then
         
     ' Verificar si se han realizado los Cierres X
         
'     Set rs_temporal = MobjVentasPlaya.FaltanCierreX
'
'     If Not rs_temporal.EOF Then
'        rs_temporal.MoveFirst
'        LStrCadenaPtoVta = " Falta realizar el Cierre X en las Sgtes Cajas : " & vbCrLf
'        Do While Not rs_temporal.EOF
'            LStrCadenaPtoVta = LStrCadenaPtoVta & vbCrLf & Trim(rs_temporal!SALESPOINT)
'            rs_temporal.MoveNext
'        Loop
'        MsgBox LStrCadenaPtoVta, vbDefaultButton1 + vbExclamation, "No se puede realizar Cambio de Turno"
'        Exit Sub
'     End If
         
     ' Verificación de Transacciones Pendientes
     
     If GIntVentaAutoCombust = 1 Then
        Set Mrstranspend = New ADODB.Recordset
        For LintCara = 1 To GintCantidadCaras
'            Mrstranspend.Open " Select * FROM tran" & Format(LintCara, "00") & " WHERE ESTADO!='CANCEL' " & _
'                              " Order by Fecha,Hora ASC", MConGasBoy, adOpenStatic

            Mrstranspend.Open " Select * FROM ventadia  WHERE ESTADO!='CANCEL' " & _
                              " Order by Fecha,Hora ASC", MConGasBoy, adOpenStatic
            If Not Mrstranspend.EOF Then
               BlnPendientes = True
            End If
            Mrstranspend.Close
        Next
     End If
     ' -----------------------------------------
     ' Si existen Transacciones Pendientes
     ' Se puede Ingresar a la Opcion si es que no se han confirmado todos los vendedores
     ' del nuevo turno
     ' -----------------------------------------
     Set objCarasVendedor = New DB_OP_MANTENIMIENTOS.C_CARAS_VENDEDOR
     Set rs_temporal = objCarasVendedor.CargaVendedores(GstrSiteProce, GDatFechaProcesoVentas, GintTurnoaCambiar)
     If rs_temporal.EOF Then
        MsgBox "No existen Vendedores a Confirmar en este Turno", vbDefaultButton1 + vbExclamation, "Mensaje"
        Exit Sub
     Else
        'Hay vendedores a Configurar para este turno (no se han configurados todos)
        If BlnPendientes = True Then
           MsgBox "Existen Transaciones Pendientes, estas será consideradas para el Turno " & Str(GintTurnoaCambiar), vbDefaultButton1 + vbExclamation, "No se Puede realizar el Cambio de Turno"
           'Exit Sub
        Else
           'MsgBox "No hay Transacciones Pendientes", vbDefaultButton1 + vbExclamation, "Mensaje"
        End If
     End If
          
     Set rs_temporal = Nothing
     Set objCarasVendedor = Nothing
     
     FApro_CarasVendedor.MintTurno = GintTurnoaCambiar
     Unload Me
     FApro_CarasVendedor.Show vbModal
     
  End If
End Sub

Private Sub CMD_CANCELAR_Click()
  Unload Me
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = 27 Then
     Unload Me
  End If
End Sub

Private Sub Form_Load()
  
  Me.KeyPreview = True
  Me.Top = (Screen.Width - Me.Width) / 2
  Me.Left = (Screen.Height - Me.Height) / 2
    
    sknTurno.LoadSkin (App.Path & "\Skins\" & gstrSkin)
sknTurno.ApplySkin (Me.hWnd)
    
    
  Set MConGasBoy = New ADODB.Connection
  Set MobjVentasPlaya = New DB_OP_FACTURACION.C_VENTASPLAYA
  
   
  If GINTCONECTAR = 1 Then
     MConGasBoy.ConnectionString = GSTRCADENACONECTA
  Else
     MConGasBoy.Provider = "MSDASQL"
     MConGasBoy.ConnectionString = GSTRCADENACONECTA
  End If
     
     
  If GIntVentaAutoCombust = 1 Then ' Si la Facturacion Está en Automática
     MConGasBoy.Open
  End If
    
  lblturnoaCambiar.Text = "Turno " & Str(GintTurnoaCambiar)
        
End Sub

Private Sub Form_Unload(Cancel As Integer)
  
  Set Mrstranspend = Nothing
  Set MConGasBoy = Nothing
  Set MobjVentasPlaya = Nothing
  
End Sub
