Imports System.Data.SqlClient
Imports System.Data
Imports System.text
Imports System.Web.UI.Control
Imports System.Reflection
Public Class Asistencias
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents Image1 As System.Web.UI.WebControls.Image
Protected WithEvents Label3 As System.Web.UI.WebControls.Label
Protected WithEvents Label12 As System.Web.UI.WebControls.Label
Protected WithEvents Label4 As System.Web.UI.WebControls.Label
Protected WithEvents Label11 As System.Web.UI.WebControls.Label
Protected WithEvents Label8 As System.Web.UI.WebControls.Label
Protected WithEvents cmb_rut As System.Web.UI.WebControls.DropDownList
Protected WithEvents cmb_peri As System.Web.UI.WebControls.DropDownList
Protected WithEvents lbl_rut As System.Web.UI.WebControls.Label
Protected WithEvents lbl_accion As System.Web.UI.WebControls.Label
Protected WithEvents btn_Cancelar As System.Web.UI.WebControls.ImageButton
Protected WithEvents btn_Ingresar As System.Web.UI.WebControls.ImageButton
Protected WithEvents RegularExpressionValidator1 As System.Web.UI.WebControls.RegularExpressionValidator
Protected WithEvents Regularexpressionvalidator2 As System.Web.UI.WebControls.RegularExpressionValidator
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Dim unRegistro As DataRow
Dim unaTabla As New DataTable
Dim unReader As SqlDataReader
Dim Con1 As New gestran.Parametros
Dim conexion As New SqlConnection(Con1.StrConexion)
Dim SSQL As String
Dim valor As String
Dim i As Integer
Dim Mensaje As New gestran.Mensaje
Dim rut As String
Dim a As Integer
Dim ano As String
Dim mes As String
Dim dia As String
Dim Mes_ceros As String
Dim Dia_ceros As String
Private hora_E As String
Private hora_S As String
Private hrr_ini As String
Private hrr_fin As String
'*********************CARGA LA PAGINA*************************************************
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Request.Cookies("Usuario") Is Nothing Then
Response.Redirect("login.aspx")
End If
If Not IsPostBack Then
'mostrarDatos()
'*****************************EXTRAE LA HORA DEL SISTEMA Y LA ASIGNA A UN LABEL******************************
'Dim x = Now
'Label12.Text = Now
'Label12.Text = Date.Now.ToLongDateString
'Label12.Text = Date.Now.ToLongDateString & " " & Date.Now.ToLongTimeString
Label12.Text = Date.Now
poblarRut()
'verifica_entrada()
End If
End Sub
Public Sub poblarRut()
'*****************************************CREA CONEXION CON LA BASE DE DATOS****************************
SSQL = "Select Distinct rut from BGTM_TBL..personalcajas"
Dim micommand As New SqlCommand(SSQL, conexion)
Try
conexion.Open()
unReader = micommand.ExecuteReader
Catch ex As Exception
Response.Redirect("Error.aspx")
End Try
cmb_rut.Items.Add("--")
cmb_rut.Items(0).Value = "--"
i = 1
While unReader.Read
valor = Trim(unReader(0))
cmb_rut.Items.Add(Trim(unReader(0)))
cmb_rut.Items(i).Value = valor
i += 1
End While
conexion.Close()
unReader.Close()
End Sub
Public Sub msg(ByVal texto As String)
Dim frameScript As String = "<script language='JavaScript'>" & _
"alert('" & texto & "');</script>"
Page.RegisterStartupScript("Alert", frameScript)
End Sub
Private Sub cmb_rut_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_rut.SelectedIndexChanged
lbl_rut.Text = cmb_rut.SelectedItem.Text
lbl_rut.Visible = True
cmb_rut.Visible = False
End Sub
Private Sub cmb_peri_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_peri.SelectedIndexChanged
lbl_accion.Text = cmb_peri.SelectedItem.Text
lbl_accion.Visible = True
cmb_peri.Visible = False
End Sub
'Private Sub btn_Ingresar_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btn_Ingresar.Click
' If Regularexpressionvalidator2.IsValid = True And RegularExpressionValidator1.IsValid = True Then
' If Trim(cmb_rut.SelectedItem.Text) = "" Or Trim(cmb_peri.SelectedItem.Text) = "" Then
' Mensaje.msg("No debe quedar ningún campo en blanco", Me)
' Exit Sub
' End If
' Else
' Actualiza_ingresa()
' End If
'End Sub
'Public Sub Actualiza_ingresa()
' rut = cmb_rut.SelectedItem.Text
' a = cmb_peri.SelectedValue
' Mensaje.msg("Su entr " & a & " ya se Encuentra en Nuestra Base de Datos ", Me)
' Mensaje.msg("La transacción " & a & " ha sido Modificada Satisfactoriamente", Me)
' Mensaje.msg("La transacción " & a & " ha sido Ingresada Satisfactoriamente", Me)
'Me.Label12.Text = Now ' asi asignaste ¿no?
' MsgBox("FECHA: " & Format(Convert.ToDateTime(Me.Label12.Text), "dd/MM/yyyy") & vbCrLf & _
' "HORA: " & Format(Convert.ToDateTime(Me.Label12.Text), "hh:mm:ss tt"))
'End Sub
'qui muestro la fecha y hora en un MSGBOX
'MsgBox("FECHA: " & Date.Now.ToString("dd/MM/yyyy") & vbCrLf & _
'"HORA: " & Date.Now.ToString("hh:mm:ss tt"))
'Para la hora si pones HH sera la hora corrida 1=13, 2=14, etc
'y el tt es para mostrar el a.m. y p.m.
End Class
asi tengo definod lo expuesto no me funciona con el codigo que recibi, alguna orientacion ke es la primera vez que programo con visual NET 2003
Label12.Text = Date.Now ------asi le asigne la fecha al label mela muestra por pantalla de la sigte manera --- 12/12/2007 21:59:44----, ahora lo que intento hacer y no se es tomar segun elformato de datos del SQL yyyymmdd-- toamr el año e dejarlo en a variable ano, mes en la variable mes etc y la hora ahora ley por hay un metodo date diff , tenog que validar que al hora de entrada sea menor que la de salida , despues calcular horas trabajas , no trabajadas, etc pero eso es harina de otro costal asi que si me puede orientar te lo agradesco no me resuelvas solso orientame
salu2