• Viernes 3 de Mayo de 2024, 23:19

Autor Tema:  Re: Software De Administracion  (Leído 1733 veces)

the_blade

  • Nuevo Miembro
  • *
  • Mensajes: 1
    • Ver Perfil
Re: Software De Administracion
« en: Martes 16 de Enero de 2007, 01:31 »
0
Hola mi nombre es andrés, escrivo porque estoy desarrollando en visual basic 6.0 y DAO 3.51, un software para la administración de instituciones,y entre los ultimos retoques surgieron un par de incovenientes con algunas funciones del mismo, queria saber si alguien me podria ayudar en esto, desde luego que figuraria en los creditos del programa como programador adicional, y porsupuesto le voy a estar muy agradecido.

El software cuenta con un formulario para agregar socios, en el que a traves de textboxs se agregan campos como nombre, apellido, numero de documento, etc. Cuenta con DTPicker para tomar la fecha de ingreso(*), y atraves de checkbox se puede seleccionar el tipo de pago de cuotas, las cuales son:
-Pagar Mes
-Pagar Todo el Año
-Poner como Pago
-Poner Pago Hasta

* Cuando en la fecha del DTPicker se especifica una menor que la actual, automaticamente se activa la opcion de pago "Poner Pago Hasta", y a traves de 1 caja de texto,  se especifica el año y el mes en un Combobox, para que el socio pueda permanecer pago hasta el mes y año especificado(Esta funcion se creo para poder agregar a los socios que ingresaron antes de que se utilizara el soft, y se quisieran pasar al mismo)
cuando el socio se agregar todos sus datos menos los de la forma de pago, se agregan en una tabla(SOCIOS), luego en otra tabla(CUOTAS), si el año y mes hasta el cual permanecera pago es igual al actual, se guardara el valor "PAGO", la fecha y el año actual, en otra tabla(MESESPAGOS), se agregaran en distintas fila el MES y AÑO de cada mes hasta el cual esta pago, junto con el numero del socio(Por Ejemplo: si esta pago de diciembre del 2006 a febrero del 2007 el socio 1,en la tabla se agregara asi:
id   numsocio  mes        año
1    1         Diciembre  2006
2    1         Enero      2007
3    1         Febrero    2007).
En otra tabla(MESES), funciona exactamente igual que MESESPAGOS, pero la diferencia es que agrega los meses impagos hasta el año actual, por ejemplo si se puso como pago de octubre del 2006 hasta noviembre del 2006, y actualmente estamos en enero del 2007, se agregaran:
id   numsocio  mes        año
1    1         Diciembre  2006
2    1         Enero      2007
ya que hasta la fecha actual serian los dos meses impagos.
en otra tabla IMPAGOS se agregan el total de impagos del socio, en numero, es decir tamando el ejemplo anterior el total de impagos hasta la fecha actual seria de 2(diciembre y enero), y se agregaria de esta manera:
id   numsocio  Total        
1    1         2
finalmente, el problema es que no se como desarrollar un función o procedimiento publico o privado, que se encargue de comprobar si el socio esta habilitado para votar(para poder votar en una institucion, se deben cumplir una serie de condiciones, una fecha de ingreso antrior a una fecha especificada, y una antiguedad con meses pagos hasta una fecha especificada, por ejemplo ingreso anterior al 31 de diciembre del año anterior, y pago hasta el 30 junio del año actual, estos valores se pueden establecer a traves del formulario de opciones del programa, y sus valores se pueden obtener a traves de las siguiente funciones publicas Carga_Dia_De_Ingreso, Carga_Mes_De_Ingreso, Carga_Hasta_Dia, y Carga_Hasta_Mes, no hace falta descrivirlas ya que sus nombre son bastante entendibles, simplemente devuelven el valor decada campo).
Entonces para realizar esta comprobación la funcion deberia comprobar los siguientes datos,
si el mes de ingreso(Tomado de el DTPICKER del formulario de agregar socios) es menor o igual que  Carga_Mes_De_Ingreso y el dia de ingreso(tambien tomado del DTPICKER) es menor o igual que Carga_Dia_De_Ingreso y año de ingreso(tambien tomado del DTPICKER) es menor que el año actual, y mes hasta(tomado del combobox mes) es igual a Carga_Hasta_Mes y año hasta(tomado de la caja de texto año) es igual al año actual, deberia habilitar al socio, o deshabilitarno(Nota: Si cumplen las condiciones, se agrega al socio en la tabla HABILITADOS y si no se cumplen se agrega en la tabla NOHABILITADOS, yo habia creado este procedimiento:

Public Sub Comprueba_Habilitados(ItemSHab As Integer)
If MI <= Convierte_Mes_A_Num(Carga_Mes_Ingreso) And DI <= Carga_Dia_De_Ingreso And AI < CInt(Year(Now)) And MH = Convierte_Mes_A_Num(Carga_Hasta_Mes) And AH = CInt(Year(Now)) Then
Habilita_Socio ItemSHab
Else
Deshabilita_Socio ItemSHab
End If
end sub

ItemSHab tomaria el numero del socio a agregar

pero funcionaba cuando agregaba uno o dos socios, despues es como que ya no comprobaba mas nada, osea agregaba todos los demas datos en las demas tablas, pero ya no lo habilitaba ni deshabilitaba.

Nota: la funcion habilitar_socio es la siguiente:

Public Sub Habilita_Socio(ByVal ItemH As Integer)
On Error Resume Next
'nos conectamos a socios para obtener los datos del socio
'que pago y asi poder habilitarlo para votar
Set ConnPublic = New ADODB.Connection
Set rsPublic = New ADODB.Recordset
'cadena de seleccion del socio
iSql = "select * from SOCIOS where NUMSOCIO like '" & ItemH & "' and USUARIO= '" & Usuario & "' "
ConnPublic.ConnectionString = Cadena
ConnPublic.Open Cadena

rsPublic.CursorLocation = adUseClient
rsPublic.CursorType = adOpenDynamic
rsPublic.LockType = adLockOptimistic

rsPublic.Open iSql, ConnPublic

With rsPublic
HNombre = !NOMBRE
HApellido = !APELLIDO
HDocumento = !DOCUMENTO
HNumsocio = !NUMSOCIO
HNSolicsocio = !IDSOLICITUDN
HTelefono = !TEL
HTelefono2 = !TEL2
HFnac = !FECHANAC
HDia = !DIA
HMes = !MES
HAño = !AÑO
HCalle = !CALLE
HNumero = !NUMERO
HPiso = !PISO
HDepto = !DEPTO
.Close
End With

Set ConnPublic = New ADODB.Connection
Set rsPublic = New ADODB.Recordset
'cadena de seleccion del socio
iSql = "select * from habilitados"

ConnPublic.ConnectionString = Cadena
ConnPublic.Open Cadena

rsPublic.CursorLocation = adUseClient
rsPublic.CursorType = adOpenDynamic
rsPublic.LockType = adLockOptimistic

rsPublic.Open iSql, ConnPublic

With rsPublic
.AddNew
!NOMBRE = HNombre
!APELLIDO = HApellido
!NUMSOCIO = HNumsocio
!DOCUMENTO = HDocumento
!IDSOLICITUDN = HNSolicsocio
!TEL = HTelefono
!TEL2 = HTelefono2
!FECHANAC = HFnac
!DIA = HDia
!MES = HMes
!AÑO = HAño
!CALLE = HCalle
!NUMERO = HNumero
!PISO = HPiso
!DEPTO = HDepto
!CUOTPAGAS = VTMeses
!DETALLECUOTAS = VDMeses
!Usuario = Usuario
.Update
.Close
End With

'nos conectamos a la tabla de nohabilitados
Set ConnPublic = New ADODB.Connection
Set rsPublic = New ADODB.Recordset

iSql = "select * from nohabilitados where NUMSOCIO like '" & ItemH & "'  and USUARIO= '" & Usuario & "' "
ConnPublic.ConnectionString = Cadena
ConnPublic.Open Cadena

rsPublic.CursorLocation = adUseClient
rsPublic.CursorType = adOpenDynamic
rsPublic.LockType = adLockOptimistic

rsPublic.Open iSql, ConnPublic

With rsPublic
If .RecordCount = 0 Then Exit Sub 'si el recordset esta vacio sale del procedimiento
    .Delete
    .Update
 .Close
End With
End Sub

Nota: VTMeses y VDMeses, son 2 variables, que almacenan el total de cuotas pagas y su detalle(los nombres de cada mes pago separado por comas)respectivamente.
La funcion deshabilita_socio, no la pongo porque hace exacatamente lo mismo, solo que en ves de agregarlos en la tabla HABILITADOS y sacarlo de la de NOHABILITADOS, hace lo contrario.


*************************************************************

otra de las funciones que me faltaria desarrollar seria una que cada ves que se inicie el programa compruebe en cada socio si esta habilitado o no y haga las modificaciones necesarias en las distintas tablas, tener en cuenta que quizas la persona no utiliza el software por mucho tiempo, asi que seguramente figurarian muchos mas impagos.

abajo te descrivo cada control del formulario agregar, y el valor que almacena, ademas del codigo completo del formulario agregar socios(Nota: algunas de las variables estan definidas en un modulo).
text1:apellido
text2:nombre
text3:nacionalidad
text4:numreo de documento
text5:tipo(por ejemplo D.N.I)
text6:calle
text7:numero
text8:piso
text9:depto
text10:año(dentro de una frame, que agrupa tambien al combobox del la forma de pago "Poner Pago Hasta")
text12:numero de socio
text13:telefono
text14:telefono 2
dtpicker1: fecha de nacimiento
dtpicker2: fecha de ingreso
combo1:estado civil
picture1:foto del socio
combo2: mes(dentro de una frame, que agrupa tambien al textboxdel la forma de pago "Poner Pago Hasta")
formas de pago:
check1:pagar mes
check2:pagar todo el año
check3:poner pago hasta
check4:poner como pago
command1: ...(carga la foto del socio)
command2:Agregar
command3:Nuevo
command4:Imprimir comp. Pago
command5:Imprimir Credencial
command6:Aceptar
************************************************************************************
codigo del formulario:
Option Explicit
'variable que almacena la ruta en donde se encuentra
'la imagen seleccionada
Dim RutaImg As String

Dim CPI As Integer
Dim i As Integer
Dim FAÑO As Integer
Dim DetalleCuot As String


Dim AñooIng As Integer
Dim MessIng As Integer
Dim AñoHasta As Integer
Dim MesHasta As Integer
Dim TotalDeMeses As Integer
Dim CuotasEnDetalle As String
Dim TotalDeCuotasEnDetalle As Integer
'variables para el correcto funcionamiento en la tabla de
'cuotas y meses, en el caso de agregar socios con la opcion
'de "poner como pago hasta"
Dim MesesRestantes As Integer
Dim AñosRestantes As Integer
Dim MesHastaRest As Integer
Dim AñoHastaRest As Integer
Dim VarMesesImpRest As Integer

Private Sub Check1_Click()
'si el checkbox1 esta checkeado
If Check1.Value = Checked Then
Check2.Enabled = False 'inabilitamos el checkbox2
Check3.Enabled = False
Check4.Enabled = False
Combo2.Enabled = False
Text10.Enabled = False
DTPicker2.Value = Date
Else 'sino esta checkeado
Check2.Enabled = True 'lo habilitamos
Check3.Enabled = True
Check4.Enabled = True
End If
End Sub

Private Sub Check2_Click()
'si el checkbox2 esta checkeado
If Check2.Value = Checked Then
Check1.Enabled = False 'inabilitamos el checkbox1
Check3.Enabled = False
Check4.Enabled = False
Combo2.Enabled = False
Text10.Enabled = False
DTPicker2.Value = Date
Else 'sino esta checkeado
Check1.Enabled = True 'lo habilitamos
Check3.Enabled = True
Check4.Enabled = True
End If
End Sub

Private Sub Check3_Click()
'si el checkbox3 esta checkeado
If Check3.Value = Checked Then
Check1.Enabled = False
Check2.Enabled = False
Check4.Enabled = False
Combo2.Enabled = True
Text10.Enabled = True
Else 'sino esta checkeado
Check1.Enabled = True 'lo habilitamos
Check2.Enabled = True
Check4.Enabled = True
Combo2.Enabled = False
Text10.Enabled = False
DTPicker2.Value = Date
End If
End Sub

Private Sub Check4_Click()
'si el checkbox4 esta checkeado
If Check4.Value = Checked Then
Check1.Enabled = False 'inhabilitamos el checkbox1
Check3.Enabled = False
Combo2.Enabled = False
Text10.Enabled = False
Check2.Enabled = False
DTPicker2.Value = Date
Else 'sino esta checkeado
Check1.Enabled = True 'lo habilitamos
Check3.Enabled = True
Check2.Enabled = True
End If
End Sub

Private Sub Combo2_Validate(Cancel As Boolean)
If Convierte_Mes_A_Num(Combo2.Text) > Month(Now) And Text10.Text = Year(Now) Then Combo2.Text = Convierte_Num_A_Mes(Month(Now))
If Convierte_Mes_A_Num(Combo2.Text) < DTPicker2.Month And Text10.Text = DTPicker2.Year Then
Combo2.Text = Convierte_Num_A_Mes(Month(Now))
Text10.Text = Year(Now)
End If
End Sub

Private Sub Command1_Click()
'abrimos el commondialog para seleccionar una imagen
CommonDialog1.ShowOpen
Picture1.Picture = LoadPicture(CommonDialog1.FileName)
RutaImg = CommonDialog1.FileName 'asignamos la direccion del archivo a RutaImg
End Sub

Private Sub Command2_Click()
On Error Resume Next
VarMesHA = "NO"
FechaIngHA = "NO"
NumSCont = CInt(Text12.Text)

CPI = Month(Now)
FAÑO = Year(Now)

AñooIng = DTPicker2.Year
MessIng = DTPicker2.Month

'comprobamos que los campos de textos no esten vacios
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Or Text7.Text = "" Or Text8.Text = "" Or Text9.Text = "" Or Text12.Text = "" Or Text13.Text = "" Or Text14.Text = "" Then
MsgBox "Uno o mas cuadros de textos estan vacios, asegurese de completarlos, si no son necesarios asigneles un No o un 0, segun sea el caso", vbInformation, "Cuadros de texto sin completar"
Exit Sub
Else

If Check3.Value = Checked Then
If Text10.Text = "" Or Combo2.Text = "" Then
MsgBox "Debe ingresar el año y el mes hasta el cual permanecera pago el socio", vbInformation, "Falta Información"
Exit Sub
Else
TotalDeCuotasEnDetalle = 0
AñoHasta = Text10.Text
MesHasta = Convierte_Mes_A_Num(Combo2.Text)

TotalDeMeses = (CInt(AñoHasta - AñooIng) * CInt(12)) - (CInt(MesHasta) - CInt(MessIng))

MesHastaRest = CInt(MesHasta + 1)
AñoHastaRest = AñoHasta
VarMesesImpRest = 0
End If
End If

'seleccionamos una tabla para luego agregar datos en ella
Set ConnPublic = New ADODB.Connection
Set rsPublic = New ADODB.Recordset

iSql = "select * from socios"
ConnPublic.ConnectionString = Cadena
ConnPublic.Open Cadena

rsPublic.CursorLocation = adUseClient
rsPublic.CursorType = adOpenDynamic
rsPublic.LockType = adLockOptimistic

rsPublic.Open iSql, ConnPublic
'agregamos los datos a la basededatos
With rsPublic
If .EOF = False Then
Do While Not .EOF
If !Usuario = Usuario And !NUMSOCIO = Text12.Text Then
MsgBox "Al parecer el numero de socio que esta intentando ingresar, ya lo tiene algun otro socio, lo mas recomendable es que lo cambie por otro", vbInformation, "Codigo Existente"
Command2.Enabled = True
Exit Sub
End If
.MoveNext
Loop
End If
  .AddNew
  !IDSOLICITUDN = Label2.Caption
  !NUMSOCIO = Text12.Text
  !NOMBRE = Text2.Text
  !APELLIDO = Text1.Text
  !NACIONALIDAD = Text3.Text
  !DOCUMENTO = Text4.Text
  !TIPO = Text5.Text
  !FECHANAC = DTPicker1.Value
  'esto es para el tema de los cumpleaños
  !DIA = DTPicker1.Day
  !MES = DTPicker1.Month
  !AÑO = DTPicker1.Year
  !ESTADOCIVIL = Combo1.Text
  !CALLE = Text6.Text
  !NUMERO = Text7.Text
  !PISO = Text8.Text
  !TEL = Text13.Text
  !TEL2 = Text14.Text
  !FECHAINSC = DTPicker2.Value
  !AÑOINGRESO = DTPicker2.Year
  !MESINGRESO = DTPicker2.Month
  !DIAINGRESO = DTPicker2.Day
  !DEPTO = Text9.Text
  !FOTO = RutaImg
  !Usuario = Usuario 'agregamos los datos al usuario
  .Update 'alcualizamos la base de datos
  .Close 'cerramos la base de datos
  If (DTPicker2.Day <= Carga_Dia_De_Ingreso) And (DTPicker2.Month <= (Convierte_Mes_A_Num(Carga_Mes_Ingreso))) And (DTPicker2.Year < (CInt(Year(Now)))) Then FechaIngHA = "SI"
  End With
 
'seleccionamos una tabla para luego agregar datos en ella
Set ConnPublic = New ADODB.Connection
Set rsPublic = New ADODB.Recordset

iSql = "select * from solicitudes"
ConnPublic.ConnectionString = Cadena
ConnPublic.Open Cadena

rsPublic.CursorLocation = adUseClient
rsPublic.CursorType = adOpenDynamic
rsPublic.LockType = adLockOptimistic

rsPublic.Open iSql, ConnPublic
'agregamos los datos a la basededatos
With rsPublic
.AddNew
!SOCIO = Text1.Text & " " & Text2.Text
!Usuario = Usuario 'agregamos los datos al usuario
.Update 'alcualizamos la base de datos
Label2.Caption = .RecordCount
.Close 'cerramos la base de datos
End With

'seleccionamos una tabla para luego agregar datos en ella
Set ConnPublic = New ADODB.Connection
Set rsPublic = New ADODB.Recordset

iSql = "select * from cuotas"
ConnPublic.ConnectionString = Cadena
ConnPublic.Open Cadena

rsPublic.CursorLocation = adUseClient
rsPublic.CursorType = adOpenDynamic
rsPublic.LockType = adLockOptimistic

rsPublic.Open iSql, ConnPublic
'agregamos los datos a la basededatos
With rsPublic
  .AddNew
  !NOMBRE = Text2.Text
  !APELLIDO = Text1.Text
  !NUMSOCIO = Text12.Text
  'si esta checkeado Pagar el Mes ejecuta esto
  If Check1.Value = Checked Then
  !DIA = DTPicker2.Day
  !MES = Month(Now)
  !AÑO = Year(Now)
  !PAGA = "SI"
  !AÑOPAGO = "NO"
   End If
  'si esta checkeado el checkbox2 ejecuta esto(esta checkeado Pagar todo el Año)
  If Check2.Value = Checked Then
  !AÑOPAGO = "SI"
  !PAGA = "SI"
  !DIA = DTPicker2.Day
  !MES = Month(Now)
  !AÑO = Year(Now)
  End If
  'si esta checkeado check3
  If Check3.Value = Checked Then
  !DIA = DTPicker2.Day
  If Convierte_Mes_A_Num(Combo2.Text) < Month(Now) Then MesesRestantes = CInt(Month(Now)) - CInt(Convierte_Mes_A_Num(Combo2.Text))
  !MES = Month(Now)
  If CInt(Text10.Text) < Year(Now) Then AñosRestantes = CInt(Year(Now)) - CInt(Text10.Text)
  !AÑO = Year(Now)
  !AÑOPAGO = "NO"
  If CInt(Text10.Text) = Year(Now) And Convierte_Mes_A_Num(Combo2.Text) = Month(Now) Then
  !PAGA = "SI"
  Else
  !PAGA = "NO"
  End If
  End If
  'si esta esta checkeado check4
  If Check4.Value = Checked Then
  !DIA = DTPicker2.Day
  !MES = Month(Now)
  !AÑO = Year(Now)
  !PAGA = "SI"
  !AÑOPAGO = "NO"
   End If
  'si ninguna de las cajas esta checkeada
  If Check1.Value = 0 And Check2.Value = 0 And Check3.Value = 0 And Check4.Value = 0 Then
  !DIA = DTPicker2.Day
  !MES = Month(Now)
  !AÑO = Year(Now)
  !AÑOPAGO = "NO"
  !PAGA = "NO"
  End If
  !Usuario = Usuario 'agregamos los datos al usuario
.Update 'alcualizamos la base de datos
.Close 'cerramos la base de datos
End With

'seleccionamos una tabla para luego agregar datos en ella
Set ConnPublic = New ADODB.Connection
Set rsPublic = New ADODB.Recordset

iSql = "select * from mesespagos"
ConnPublic.ConnectionString = Cadena
ConnPublic.Open Cadena

rsPublic.CursorLocation = adUseClient
rsPublic.CursorType = adOpenDynamic
rsPublic.LockType = adLockOptimistic

rsPublic.Open iSql, ConnPublic
'agregamos los datos a la basededatos
With rsPublic
If Check1.Value = Checked Then
.AddNew
!NUMSOCIO = Text12.Text
!MES = Month(Now)
!AÑO = Year(Now)
!Usuario = Usuario
.Update
End If
If Check2.Value = Checked Then
Do Until i = 13
If CPI = 13 Then
.AddNew
!NUMSOCIO = Text12.Text
!MES = 1
!AÑO = Year(Now) + 1
CPI = 1
FAÑO = Year(Now) + 1
!Usuario = Usuario
DetalleCuot = DetalleCuot & CStr(Convierte_Num_A_Mes(CStr(CPI))) & CStr("/") & CStr(FAÑO) & CStr(",")
Else
.AddNew
!NUMSOCIO = Text12.Text
!MES = CPI
!AÑO = FAÑO
!Usuario = Usuario
DetalleCuot = DetalleCuot & CStr(Convierte_Num_A_Mes(CStr(CPI))) & CStr("/") & CStr(FAÑO) & CStr(",")
End If
.Update
i = i + 1
CPI = CPI + 1
.MoveNext
Loop
.Update
End If

If Check3.Value = Checked Then
Do Until AñooIng = AñoHasta And MessIng = MesHasta + 1
If MessIng = Month(Now) And AñooIng = Year(Now) Then
CuotasEnDetalle = CuotasEnDetalle & CStr(Convierte_Num_A_Mes(CStr(MessIng))) & "/" & CStr(AñooIng) & CStr(",")
TotalDeCuotasEnDetalle = TotalDeCuotasEnDetalle + 1
End If
'verificar que este codigo funciones correctamente, ya
'que es probable que no sea asi
If VarMesHA = "NO" Then
If MessIng = (Convierte_Mes_A_Num(Carga_Hasta_Mes)) And (AñooIng = (CInt(Year(Now)))) Then
VarMesHA = "SI"
End If
End If
If MessIng = 13 Then
.AddNew
!NUMSOCIO = Text12.Text
!MES = 1
!AÑO = AñooIng + 1
MessIng = 1
AñooIng = AñooIng + 1
!Usuario = Usuario
DetalleCuot = DetalleCuot & CStr(Convierte_Num_A_Mes(CStr(MessIng))) & CStr("/") & CStr(AñooIng) & CStr(",")
Else
.AddNew
!NUMSOCIO = Text12.Text
!MES = MessIng
!AÑO = AñooIng
!Usuario = Usuario
DetalleCuot = DetalleCuot & CStr(Convierte_Num_A_Mes(CStr(MessIng))) & CStr("/") & CStr(AñooIng) & CStr(",")
End If
.Update
MessIng = MessIng + 1
.MoveNext
Loop
.Update
End If
If Check4.Value = Checked Then
.AddNew
!NUMSOCIO = Text12.Text
!MES = Month(Now)
!AÑO = Year(Now)
!Usuario = Usuario
.Update
End If
.Close
End With


Set ConnPublic = New ADODB.Connection
Set rsPublic = New ADODB.Recordset

iSql = "select * from meses"
ConnPublic.ConnectionString = Cadena
ConnPublic.Open Cadena

rsPublic.CursorLocation = adUseClient
rsPublic.CursorType = adOpenDynamic
rsPublic.LockType = adLockOptimistic

rsPublic.Open iSql, ConnPublic
'agregamos los datos a la basededatos
With rsPublic
If Check3.Value = Checked Then
Do Until MesHastaRest = Month(Now) + 1 And AñoHastaRest = Year(Now)
If MesHastaRest = 13 Then
.AddNew
!NUMSOCIO = Text12.Text
!MES = 1
!AÑO = AñoHastaRest + 1
!Usuario = Usuario
.Update
AñoHastaRest = AñoHastaRest + 1
MesHastaRest = 1
Else
.AddNew
!NUMSOCIO = Text12.Text
!MES = MesHastaRest
!AÑO = AñoHastaRest
!Usuario = Usuario
.Update
End If
.Update
MesHastaRest = MesHastaRest + 1
VarMesesImpRest = VarMesesImpRest + 1
.MoveNext
Loop
.Update
End If

'si ninguna de las cajas esta checkeada
If Check1.Value = 0 And Check2.Value = 0 And Check3.Value = 0 And Check4.Value = 0 Then
.AddNew
!NUMSOCIO = Text12.Text
!MES = Month(Now)
!AÑO = Year(Now)
!Usuario = Usuario
.Update
End If
.Close
End With

'seleccionamos la tabla de impagos y la ponemos a 0 para que
'cada ves que se abra el programa, este compruebe en la tabla
'de cuotas si se vencio el mes y le sume al total de la tabla
'de impagos 1 (total + 1)
Set ConnPublic = New ADODB.Connection
Set rsPublic = New ADODB.Recordset

iSql = "select * from impagos"
ConnPublic.ConnectionString = Cadena
ConnPublic.Open Cadena

rsPublic.CursorLocation = adUseClient
rsPublic.CursorType = adOpenDynamic
rsPublic.LockType = adLockOptimistic

rsPublic.Open iSql, ConnPublic
'agregamos los datos a la basededatos
With rsPublic
If Check1.Value = Checked Then
.AddNew
!NOMBRE = Text2.Text
!APELLIDO = Text1.Text
!NUMSOCIO = Text12.Text
!TOTAL = "0" 'al total se le asigna 0(la cuota esta paga)
!Usuario = Usuario
.Update
End If
If Check2.Value = Checked Then
.AddNew
!NOMBRE = Text2.Text
!APELLIDO = Text1.Text
!NUMSOCIO = Text12.Text
!TOTAL = "0" 'al total se le asigna 0(la cuota esta paga)
!Usuario = Usuario
.Update
End If
If Check3.Value = Checked Then
.AddNew
!NOMBRE = Text2.Text
!APELLIDO = Text1.Text
!NUMSOCIO = Text12.Text
!TOTAL = CLng(VarMesesImpRest)
!Usuario = Usuario
.Update
End If
If Check4.Value = Checked Then
.AddNew
!NOMBRE = Text2.Text
!APELLIDO = Text1.Text
!NUMSOCIO = Text12.Text
!TOTAL = CLng(VarMesesImpRest)
!Usuario = Usuario
.Update
End If
If Check1.Value = 0 And Check2.Value = 0 And Check3.Value = 0 And Check4.Value = 0 Then
.AddNew
!NOMBRE = Text2.Text
!APELLIDO = Text1.Text
!NUMSOCIO = Text12.Text
!TOTAL = 1
!Usuario = Usuario
.Update
End If
.Close
End With

'seleccionamos una tabla para luego agregar datos en ella
Set ConnPublic = New ADODB.Connection
Set rsPublic = New ADODB.Recordset

iSql = "select * from cuotasoc"
ConnPublic.ConnectionString = Cadena
ConnPublic.Open Cadena

rsPublic.CursorLocation = adUseClient
rsPublic.CursorType = adOpenDynamic
rsPublic.LockType = adLockOptimistic

rsPublic.Open iSql, ConnPublic
'agregamos los datos a la basededatos
With rsPublic
'si esta checkeado pagar mes
If Check1.Value = Checked Then
.AddNew
!NUMSOCIO = Text12.Text
!APELLIDO = Text1.Text
!NOMBRE = Text2.Text
!MES = Convierte_Num_A_Mes(CStr(Month(Now)))
!AÑO = Year(Now)
!CUOTAS = 1
!DETALLECUOTAS = CStr(Convierte_Num_A_Mes(CStr(Month(Now)))) & CStr("/") & CStr(Year(Now))
!IMPORTE = Carga_Importe
!Usuario = Usuario
End If
'si esta checkeado pagar año
If Check2.Value = Checked Then
.AddNew
!NUMSOCIO = Text12.Text
!APELLIDO = Text1.Text
!NOMBRE = Text2.Text
!MES = Convierte_Num_A_Mes(CStr(Month(Now)))
!AÑO = Year(Now)
!CUOTAS = 12
!DETALLECUOTAS = DetalleCuot
!IMPORTE = 12 * Carga_Importe
!Usuario = Usuario
End If
'si esta checkeado poner pago hasta
If Check3.Value = Checked Then
.AddNew
!NUMSOCIO = Text12.Text
!APELLIDO = Text1.Text
!NOMBRE = Text2.Text
!MES = Convierte_Num_A_Mes(CStr(Month(Now)))
!AÑO = Year(Now)
!CUOTAS = TotalDeCuotasEnDetalle
!DETALLECUOTAS = CuotasEnDetalle
!IMPORTE = TotalDeCuotasEnDetalle * Carga_Importe
!Usuario = Usuario
End If
.Update
.Close
End With

'seleccionamos una tabla para luego agregar datos en ella
Set ConnPublic = New ADODB.Connection
Set rsPublic = New ADODB.Recordset

iSql = "select * from totalingresos"
ConnPublic.ConnectionString = Cadena
ConnPublic.Open Cadena

rsPublic.CursorLocation = adUseClient
rsPublic.CursorType = adOpenDynamic
rsPublic.LockType = adLockOptimistic

rsPublic.Open iSql, ConnPublic
'agregamos los datos a la basededatos
With rsPublic
If .EOF = False Then
.MoveFirst
If Check1.Value = Checked Then
!CUOTASSOC = !CUOTASSOC + Carga_Importe
!TOTAL = !TOTAL + Carga_Importe
VTMeses = CLng(1)
VDMeses = Convierte_Num_A_Mes(CStr(Month(Now))) & "/" & Year(Now) & ","
End If
If Check2.Value = Checked Then
!CUOTASSOC = !CUOTASSOC + (12 * Carga_Importe) 'importe anual(Carga_Importe(cuota) * 12(meses))
!TOTAL = !TOTAL + (12 * Carga_Importe)
VTMeses = CLng(12)
VDMeses = DetalleCuot
End If
If Check3.Value = Checked Then
!CUOTASSOC = !CUOTASSOC + (TotalDeCuotasEnDetalle * Carga_Importe)
!TOTAL = !TOTAL + (TotalDeCuotasEnDetalle * Carga_Importe)
VTMeses = TotalDeMeses
VDMeses = DetalleCuot
End If
End If
.Update
.Close
End With

If Check4.Value = Checked Then
VTMeses = CLng(1)
VDMeses = Convierte_Num_A_Mes(CStr(Month(Now))) & "/" & Year(Now) & ","
End If

'habilitacion de botones segun la opcion de pago seleccionada
'desabilitamos el boton de agregar
Command2.Enabled = False
'habilito el boton nuevo
Command3.Enabled = True

If Check1.Value = Checked Or Check2.Value = Checked Then
'habilito los botones para poder imprimir la credencial
'y el comprobante de pago del socio
Command4.Enabled = True
Command5.Enabled = True
Deshabilita_Socio (NumSCont)
End If

If Check4.Value = Checked Then
'deshabilito los botones para poder imprimir la credencial
'y el comprobante de pago del socio
Command4.Enabled = False
Command5.Enabled = False
Deshabilita_Socio (NumSCont)
End If

If Check1.Value = 0 And Check2.Value = 0 And Check3.Value = 0 And Check4.Value = 0 Then
'deshabilito los botones para poder imprimir la credencial
'y el comprobante de pago del socio
Command4.Enabled = False
Command5.Enabled = False
Deshabilita_Socio (NumSCont)
End If

If Check3.Value = Checked Then
'deshabilito los botones para poder imprimir la credencial
'y el comprobante de pago del socio
Command4.Enabled = False
Command5.Enabled = False
Comprueba_Habilitados NumSCont
End If
End If
End Sub

Private Sub Command3_Click()
'deshabilito los botones para poder imprimir la credencial
'y el comprobante de pago del socio
Command4.Enabled = False
Command5.Enabled = False
'Vaciamos las cajas de texto
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text13.Text = ""
Text14.Text = ""
'vaciamos la caja de imagen
Picture1.Picture = LoadPicture()

'seleccionamos la tabla de solicitudes para obtener el numero
Set ConnPublic = New ADODB.Connection
Set rsPublic = New ADODB.Recordset

iSql = "select * from solicitudes"
ConnPublic.ConnectionString = Cadena
ConnPublic.Open Cadena

rsPublic.CursorLocation = adUseClient
rsPublic.CursorType = adOpenDynamic
rsPublic.LockType = adLockOptimistic

rsPublic.Open iSql, ConnPublic
'agregamos los datos a la basededatos
With rsPublic
Label2.Caption = .RecordCount + 1
.Close 'cerramos la base de datos
End With

'seleccionamos la tabla de socio para obtener el numero
Set ConnPublic = New ADODB.Connection
Set rsPublic = New ADODB.Recordset

iSql = "select * from socios"
ConnPublic.ConnectionString = Cadena
ConnPublic.Open Cadena

rsPublic.CursorLocation = adUseClient
rsPublic.CursorType = adOpenDynamic
rsPublic.LockType = adLockOptimistic

rsPublic.Open iSql, ConnPublic
'agregamos los datos a la basededatos
With rsPublic
Text12.Text = .RecordCount + 1
.Close 'cerramos la base de datos
End With
'habilitamos el boton de agregar
Command2.Enabled = True
End Sub

Private Sub Command4_Click()
'si el boton de agregar esta desabilitado
If Command2.Enabled = False Then
'si esta checkeado pagar mes
If Check1.Value = Checked Then
VarCuotasPagas = 1
VarDetalleDeLasCuotasPagas = CStr(Convierte_Num_A_Mes(Month(Now)) & "/" & Year(Now))
CompPago Text12.Text
End If
'si esta checkeado pagar año
If Check2.Value = Checked Then
VarDetalleDeLasCuotasPagas = CStr(DetalleCuot)
VarCuotasPagas = 12
CompPago Text12.Text
End If
End If
VarCuotasPagas = 0
End Sub

Private Sub Command5_Click()
'si el boton de agregar esta desabilitado
If Command2.Enabled = False Then
frmcredencial.Label2.Caption = Text12.Text
frmcredencial.Label4.Caption = Text2.Text
frmcredencial.Label6.Caption = Text1.Text
frmcredencial.Label8.Caption = Text4.Text
frmcredencial.Label9.Caption = Text5.Text
frmcredencial.Picture1 = LoadPicture(RutaImg)
frmcredencial.Show
End If
End Sub

Private Sub Command6_Click()
'cerramos y descargamos de la memoria el formulario actual
Unload Me
End Sub

Private Sub DTPicker2_Change()
If DTPicker2.Value < Date Then
Check3.Enabled = True
Check3.Value = 1
Check1.Enabled = False
Check1.Value = 0
Check2.Enabled = False
Check2.Value = 0
Check4.Enabled = False
Check4.Value = 0
Else
DTPicker2.Value = Date
Check3.Enabled = False
Check3.Value = 0
Check1.Value = 1
Check1.Enabled = True
Check4.Enabled = False
Check4.Value = 0
End If
End Sub

Private Sub Form_Load()
'establecemos el ancho y el alto del formulario
Me.Width = 8640
Me.Height = 8820

'asignamos la fecha actual
DTPicker2.Value = Date

'valores en poner pago hasta
'asiganos un valor al combo de los meses
Combo2.Text = Convierte_Num_A_Mes(Month(Now))
'asignamos al textbox del año un valor
Text10.Text = Year(Now)

'nos conectamos a la tabla de solicitudes
Set ConnPublic = New ADODB.Connection
Set rsPublic = New ADODB.Recordset

iSql = "select * from solicitudes"
ConnPublic.ConnectionString = Cadena
ConnPublic.Open Cadena

rsPublic.CursorLocation = adUseClient
rsPublic.CursorType = adOpenDynamic
rsPublic.LockType = adLockOptimistic

rsPublic.Open iSql, ConnPublic
'asiganmos un numero de solicitud
With rsPublic
Label2.Caption = .RecordCount + 1 'asignamos a la etiqueta de solicitud el numero segun la base de datos
.Close
End With

'nos conectamos a la tabla de socios
Set ConnPublic = New ADODB.Connection
Set rsPublic = New ADODB.Recordset

iSql = "select * from socios"
ConnPublic.ConnectionString = Cadena
ConnPublic.Open Cadena

rsPublic.CursorLocation = adUseClient
rsPublic.CursorType = adOpenDynamic
rsPublic.LockType = adLockOptimistic

rsPublic.Open iSql, ConnPublic
'asiganmos un numero de solicitud
With rsPublic
Text12.Text = .RecordCount + 1 'asignamos a la etiqueta de socio el numero segun la base de datos
.Close
End With
End Sub


Private Sub Text10_Change()
If IsNumeric(Text10.Text) = False Then
Text10.Text = ""
Else
If Len(Text10.Text) > 4 Then Text10.Text = CStr(Year(Now))
End If
End Sub

Private Sub Text10_Validate(Cancel As Boolean)
If Text10.Text < DTPicker2.Year Then Text10.Text = CStr(Year(Now))
If Text10.Text > Year(Now) Then Text10.Text = CStr(Year(Now))
If Len(Text10.Text) < 4 Then Text10.Text = CStr(Year(Now))
End Sub

Private Sub Text12_Change()
If IsNumeric(Text12.Text) = False Then Text12.Text = ""
End Sub

Private Sub Text13_Change()
If IsNumeric(Text13.Text) = False Then Text13.Text = ""
End Sub

Private Sub Text14_Change()
If IsNumeric(Text14.Text) = False Then Text14.Text = ""
End Sub

Private Sub Text4_Change()
If IsNumeric(Text4.Text) = False Then Text4.Text = ""
End Sub

Private Sub Text7_Change()
If IsNumeric(Text7.Text) = False Then Text7.Text = ""
End Sub

Nota: si pueden solucionar alguno de los problemas por favor avisenme(salvatico_andres@yahoo.com.ar), o por cualquier duda, les agredeceria mucho que me ayudaran.
Notas finales: en el codigo figuran alguna tablas como totalingresos y cuotas sociales, pero no le den importancia, ya que tienen que ver con otros aspectos contables del programa, nuevamente les agredesco su atención, y ademas les promento que si me ayudan, pondre sus creditos en el programa, y les enviare una copia del software, para que lo vean finalizado, o lo pondre en internet para que lo descarguen.

ElNapster

  • Moderador
  • ******
  • Mensajes: 727
    • Ver Perfil
Re: Software De Administracion
« Respuesta #1 en: Jueves 18 de Enero de 2007, 19:59 »
0
Con mucho gusto te voy a ayudar.. estamos en contacto mi correo es jou007@itelgua.com

 :comp:
"Somos lo que imaginamos ser"
-- --------------------------------------------------------------
-ElNapster
-Designer / Developer Software
-GuaTemALa