VERSION 5.00
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form FControlPDiario 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Control de Parte Diario (95.220.00)"
   ClientHeight    =   5055
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   11925
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   ScaleHeight     =   5055
   ScaleWidth      =   11925
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   495
      Left            =   5400
      TabIndex        =   4
      Top             =   4200
      Visible         =   0   'False
      Width           =   495
   End
   Begin VB.CommandButton cmdCancelar 
      Caption         =   "&Salir"
      Height          =   735
      Left            =   9960
      Picture         =   "FControlPDiario.frx":0000
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   4080
      Width           =   1095
   End
   Begin VB.CommandButton cmdmodificar 
      Caption         =   "Modificar"
      Height          =   735
      Left            =   8880
      Picture         =   "FControlPDiario.frx":030A
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   4080
      Width           =   1095
   End
   Begin VB.CommandButton cmdnuevocodcomp 
      Caption         =   "Nuevo"
      Height          =   735
      Left            =   7800
      Picture         =   "FControlPDiario.frx":074C
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   4080
      Width           =   1095
   End
   Begin MSDataGridLib.DataGrid DBGCPD 
      Height          =   3855
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   11655
      _ExtentX        =   20558
      _ExtentY        =   6800
      _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
      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
End
Attribute VB_Name = "FControlPDiario"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Variables para el Manejo de Seguridad
    Public pb_editar As Boolean
    Public pb_agregar As Boolean
    Public pb_primerregistro As Boolean
    Public pb_ultimoregistro As Boolean
    
    Public pbderecho_agregar As Boolean
    Public pbderecho_consultar As Boolean
    Public pbderecho_editar As Boolean
    Public pbderecho_borrar As Boolean
    Public pbderecho_imprimir As Boolean
    Public pb_tiposcreen As String
' ***************************************


Private MobjCPDiario As UTIL_SETUP.C_SETUP
Private MrsCpDiario As ADODB.Recordset
Private MstrCadena As String

Sub instanciarObjetos()

  Set MobjCPDiario = New UTIL_SETUP.C_SETUP
  
End Sub

Sub DestruirObjetos()
  
  Set MobjCPDiario = Nothing

End Sub

Private Sub cmdCancelar_Click()
    Unload Me
End Sub

Private Sub cmdModificar_Click()
    
    FRegistroCtrlPD.MblnAgregarModificar = "M"
     
    If Not MrsCpDiario.EOF Then
       FRegistroCtrlPD.DtcAlmacen.Enabled = False
       FRegistroCtrlPD.cmdBuscar.Enabled = False
       
       FRegistroCtrlPD.DtcAlmacen.BoundText = DBGCPD.Columns(0).Text
       FRegistroCtrlPD.DTPFechaProceso.Enabled = False
       FRegistroCtrlPD.DTPFechaProceso.Value = DBGCPD.Columns(2).Text
       
       If Trim(DBGCPD.Columns(3).Text) = "OK" Then
          FRegistroCtrlPD.ChkBancos = 1
       Else
          FRegistroCtrlPD.ChkBancos = 0
       End If
       
       If Trim(DBGCPD.Columns(5).Text) = "OK" Then
          FRegistroCtrlPD.ChkFisico = 1
       Else
          FRegistroCtrlPD.ChkFisico = 0
       End If
   
       FRegistroCtrlPD.TxtObservacion = DBGCPD.Columns(8).Text
       FRegistroCtrlPD.Show vbModal
       CargarGrilla
       
    Else
       MsgBox "No existen registros para Modificar", vbDefaultButton1 + vbExclamation, "Mensaje"
    End If
    
End Sub

Private Sub cmdnuevocodcomp_Click()

    FRegistroCtrlPD.MblnAgregarModificar = "A"
    FRegistroCtrlPD.Show vbModal
    CargarGrilla
    
End Sub

Private Sub Command1_Click()

    MsgBox DBGCPD.Columns(0).Width
    MsgBox DBGCPD.Columns(1).Width
    MsgBox DBGCPD.Columns(2).Width
    MsgBox DBGCPD.Columns(3).Width
    MsgBox DBGCPD.Columns(4).Width
    MsgBox DBGCPD.Columns(5).Width
    MsgBox DBGCPD.Columns(6).Width
    MsgBox DBGCPD.Columns(7).Width
    MsgBox DBGCPD.Columns(8).Width
    MsgBox DBGCPD.Columns(9).Width
    
    
End Sub

Private Sub Form_Activate()
    
    Call gactualizaopcion(pbderecho_agregar, pbderecho_editar, pbderecho_borrar, pbderecho_imprimir)
    Call gactualiza_barra(Me)
    
    If pbderecho_consultar = False Then
        Unload Me
    End If
    
End Sub

Private Sub Form_Initialize()
   ' Call gHabilitarReg(Me, False)
End Sub

Private Sub Form_Load()
      
    Call gseguridad(Me)
    
    If pbderecho_consultar Then
                
       instanciarObjetos
       CargarGrilla
       Me.Top = 1300
       Me.Left = (Screen.Width - Me.Width) / 2
    Else
        MsgBox ("No tiene Derechos de Consultar en este formulario"), vbCritical + vbDefaultButton1, "Mensaje"
    End If
   
End Sub

Public Sub CargarGrilla()

       MstrCadena = " SELECT OP_CTRLPDAY.SITEID as Cod_Alm,SITE.NAME as Nombre_Almacen,DATEPROCe AS Fecha_Proceso, " & _
                    " CASE BANKOK WHEN 0 THEN '' WHEN 1 THEN 'OK' END AS Bancos_OK," & _
                    " DateBankOk as Fecha_Bancos," & _
                    " CASE PHYSICALOK WHEN 0 THEN '' WHEN 1 THEN 'OK' END AS Físico_Ok," & _
                    " DATEPHYSICALOK  as Fecha_Físico,OP_CTRLPDAY.USERID as Usuario, " & _
                    " OBSERVATION As Observación " & _
                    " FROM OP_CTRLPDAY  INNER JOIN SITE " & _
                    " ON  OP_CTRLPDAY.SITEID=SITE.SITEID " & _
                    " ORDER BY DATEPROCe DESC,OP_CTRLPDAY.SITEID "
       
       Set MrsCpDiario = MobjCPDiario.Auxiliar3(MstrCadena)
       Set DBGCPD.DataSource = MrsCpDiario
       FormatoGrilla
       DBGCPD.Refresh

End Sub

Sub salir_formulario()
    ' validar que no haya procesos pendientes
    ' si no hay problemas
    MDIFUtilitarios.Toolbar1.Buttons(18).Caption = "Salir"    ' boton salir
    Unload Me
End Sub


Sub actualizar_registro()

       Screen.MousePointer = 11
       
       CargarGrilla
       
       Screen.MousePointer = 0

End Sub

Sub FormatoGrilla()

    DBGCPD.Columns(0).Width = 434.8347
    DBGCPD.Columns(1).Width = 1934.929
    DBGCPD.Columns(2).Width = 1230.236
    DBGCPD.Columns(3).Width = 989.8583
    DBGCPD.Columns(4).Width = 1739.906
    DBGCPD.Columns(5).Width = 870.2363
    DBGCPD.Columns(6).Width = 1739.906
    DBGCPD.Columns(7).Width = 1005.165
    DBGCPD.Columns(8).Width = 8820.284

End Sub


