Download - Manual de Sistema
INTEGRANTES
DENNIS CABRERA LECHUGA GERARDO MELENDEZ FIDEL LETICIA CRUZ CARBALLO
AL
UM
NO
S D
E I
NF
OR
MA
TIC
A
AD
MIN
IST
RA
TIV
A
20
10
MA
NU
AL
DE
USO
DE
L SI
STE
MA
EL MANUAL DE USO DEL SISTEMA ES UN METODO PARA DAR A CONOCER LOS PUNTOS MÁS COMPLEJOS DE COMO ESTA ESTRUCTURADO EL PROYECTO PARA QUE LOS NUEVOS USUARIOS ESTEN IDENTIFICADOS CON CADA UNA DE LAS FUNCIONES QUE REALIZA EL PROGRAMA.
MUEBLERIA BUDDY
764 767 16 25 http:\\muebleria-buddy.blogspot.com
INGENIERIA DEL SOFTWARE
MUEBLERIA BUDDY Página 2
M A N U A L DE S I S T E M A MUEBLERIA BUDDY
PANTALLA DE INICIO
Ilustración 1
Private Sub Command1_Click() If Text1.Text <> "" Then Tira = "Select * From Tabla1" Set rs = BaseDatos.OpenRecordset(Tira) With rs .FindFirst "Usuario ='" & Text1.Text & "'" If .NoMatch Then MsgBox ("Este usuario no esta registrado en las bases de datos"), vbInformation, "MUEBLERIA BUDDY" Else If rs(2) = "1" Then Form2.cmdnuevo.Visible = True Else Form2.cmdnuevo.Visible = False End If If rs(3) = "1" Then Form2.cmdentradas.Visible = True Else Form2.cmdentradas.Visible = False
End If If rs(4) = "1" Then Form2.cmdsalidas.Visible = True Else Form2.cmdsalidas.Visible = False End If If rs(5) = "1" Then Form2.cmdinventario.Visible = True Else Form2.cmdinventario.Visible = False End If If rs(6) = "1" Then Form2.cmdmodificar.Visible = True Else Form2.cmdmodificar.Visible = False End If If rs(7) = "1" Then Form2.cmdcredito.Visible = True Else
Form2.cmdcredito.Visible = False End If If rs(8) = "1" Then Form2.nuevo.Visible = True Else Form2.nuevo.Visible = False End If If rs(9) = "1" Then Form2.cliente_modificar2.Enabled = True Else Form2.cliente_modificar2.Enabled = False End If If rs(10) = "1" Then Form2.usuario.Enabled = True Else Form2.usuario.Enabled = False End If If rs(11) = "1" Then
INGENIERIA DEL SOFTWARE
MUEBLERIA BUDDY Página 3
Form2.reg_movimientos.Visible = True Else Form2.reg_movimientos.Visible = False End If inicial.Show If rs(12) = "1" Then Form2.cmdpagos.Visible = True Else Form2.cmdpagos.Visible = False End If inicial.Show Unload Me End If End With Else MsgBox ("INGRESAR USURIO"), vbInformation, "MUEBLERIA BUDDY" Text1.SetFocus End If End Sub Private Sub Form_Load() Direccion = App.Path & "\bd_data.mdb" Set BaseDatos = OpenDatabase(Direccion) End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If Text1.Text <> "" Then Tira = "Select * From Tabla1" Set rs = BaseDatos.OpenRecordset(Tira) With rs .FindFirst "Usuario ='" & Text1.Text & "'" If .NoMatch Then MsgBox ("Este usuario no esta registrado en las bases de datos"), vbInformation, "MUEBLERIA BUDDY" Else
If rs(2) = "1" Then Form2.cmdnuevo.Visible = True Else Form2.cmdnuevo.Visible = False End If If rs(3) = "1" Then Form2.cmdentradas.Visible = True Else Form2.cmdentradas.Visible = False End If If rs(4) = "1" Then Form2.cmdsalidas.Visible = True Else Form2.cmdsalidas.Visible = False End If If rs(5) = "1" Then Form2.cmdinventario.Visible = True Else Form2.cmdinventario.Visible = False End If If rs(6) = "1" Then Form2.cmdmodificar.Visible = True Else Form2.cmdmodificar.Visible = False End If If rs(7) = "1" Then Form2.cmdcredito.Visible = True Else Form2.cmdcredito.Visible = False End If If rs(8) = "1" Then Form2.nuevo.Visible = True Else Form2.nuevo.Visible = False End If If rs(9) = "1" Then Form2.cliente_modificar2.Enabled = True Else
Form2.cliente_modificar2.Enabled = False End If If rs(10) = "1" Then Form2.usuario.Enabled = True Else Form2.usuario.Enabled = False End If If rs(11) = "1" Then Form2.reg_movimientos.Visible = True Else Form2.reg_movimientos.Visible = False End If inicial.Show If rs(12) = "1" Then Form2.cmdpagos.Visible = True Else Form2.cmdpagos.Visible = False End If If rs(13) = "1" Then Form2.reg_entrantes.Visible = True Else Form2.reg_entrantes.Visible = False End If inicial.Show Unload Me End If End With Else MsgBox ("INGRESAR USUARIO"), vbInformation, "MUEBLERIA BUDDY" Text1.SetFocus End If End If End Sub
INGENIERIA DEL SOFTWARE
MUEBLERIA BUDDY Página 4
Pantalla: inicial
Ilustración 2
Private Sub Form_Load() ShockwaveFlash1.Movie = App.Path & "\ani.swf" End Sub Private Sub Movie1_GotFocus() End Sub Private Sub Timer1_Timer() If Timer1.Interval = 3000 Then Unload Me Form2.Show End If End Sub
Pantalla: Principal
Ilustración 3
Dim x, Y, xt, wt As Integer Dim accion As String Dim abrir As String Public ope As Integer Public opcion As Integer
Option Explicit Private Sub cambio_usuario_Click() contra.Show Unload Me
End Sub Private Sub cliente_modificar2_Click() mod_cliente.Show
INGENIERIA DEL SOFTWARE
MUEBLERIA BUDDY Página 5
End Sub Private Sub cmdcredito_Click() creditos.Show End Sub Private Sub cmdentradas_Click() agregar.Show End Sub Private Sub cmdinventario_Click() inventario.Show End Sub Private Sub cmdmodificar_Click() modificar.Show End Sub Private Sub cmdnuevo_Click() entradas.Show End Sub Private Sub cmdpagos_Click() ope = 1 opcion = 0 pagos.Show End Sub Private Sub cmdsalidas_Click() salidas.Show End Sub Private Sub Command1_Click() Form1.Show End Sub Private Sub Form_Load() Text1.Text = Date Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=..\MUEBLERIA BUDDY\sub_base_datos." & _ "MDB;Persist Security Info=False" With Adodc1 .CommandType = adCmdText .RecordSource = "Select codigo, cliente, producto, cantidad, deuda, fecha_de_pago From creditos" .Refresh Set DataGrid1.DataSource = Adodc1.Recordset DataGrid1.MarqueeStyle = dbgHighlightRowRaiseCell .Visible = False End With error_Handler: On Error GoTo error_Handler With Adodc1
If Text1 <> "" Then .Recordset.Filter = Combo1 & " LIKE '*" + Text1 + "*'" Set DataGrid1.DataSource = Adodc1.Recordset Else .Recordset.Filter = "" End If .Refresh End With Exit Sub If Err.Number = 3265 Then MsgBox "ERROR", vbCritical, "MUEBLERIA BUDDY" Else MsgBox Err.Description, vbCritical, "MUEBLERIA BUDDY" End If End Sub Private Sub new_credito_Click() End Sub Private Sub nuevo_Click() new_cliente.Show End Sub Private Sub reg_entrantes_Click() reg_entradas.Show End Sub Private Sub reg_movimientos_Click() reg_mov.Show End Sub Private Sub salir_Click() End End Sub Private Sub Timer1_Timer() Text1.Text = Date Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=..\MUEBLERIA BUDDY\sub_base_datos." & _ "MDB;Persist Security Info=False" With Adodc1 .CommandType = adCmdText .RecordSource = "Select codigo, cliente, producto, cantidad, deuda, fecha_de_pago From creditos" .Refresh
Set DataGrid1.DataSource = Adodc1.Recordset DataGrid1.MarqueeStyle = dbgHighlightRowRaiseCell .Visible = False End With On Error GoTo error_Handler With Adodc1 If Text1 <> "" Then .Recordset.Filter = Combo1 & " LIKE '*" + Text1 + "*'" Set DataGrid1.DataSource = Adodc1.Recordset Else .Recordset.Filter = "" End If .Refresh End With Exit Sub error_Handler: If Error.Number = 3265 Then MsgBox "el campo seleccionado no es válido", vbCritical, "MUEBLERIA BUDDY" Else MsgBox Err.Description, vbCritical, "MUEBLERIA BUDDY" End If End Sub Private Sub usu_modificar_Click() cuentas.usu.Visible = False cuentas.txtpa.Visible = True cuentas.cmddescargar.Visible = True cuentas.cmdnuevo.Visible = False cuentas.Show End Sub Private Sub usu_nuevo_Click() cuentas.usu.Visible = True cuentas.txtpa.Visible = False cuentas.cmddescargar.Visible = False cuentas.Show End Sub Private Sub Adodc1_Error( _ ByVal ErrorNumber As Long, _ Description As String, _ ByVal Scode As Long, _ ByVal Source As String, _ ByVal HelpFile As String, _ ByVal HelpContext As Long, _ fCancelDisplay As Boolean) MsgBox " DEscripción del Error :" & Description End Sub
INGENIERIA DEL SOFTWARE
MUEBLERIA BUDDY Página 6
Private Sub Adodc2_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset) Adodc1.Caption = " Registro actual: " & CStr(Adodc1.Recordset.AbsolutePosition) End Sub
Private Sub Adodc2_WillChangeRecord(ByVal adReason As ADODB.EventReasonEnum, ByVal cRecords As Long, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset) Dim bCancel As Boolean Select Case adReason Case adRsnAddNew Case adRsnClose Case adRsnDelete
Case adRsnFirstChange Case adRsnMove Case adRsnRequery Case adRsnResynch Case adRsnUndoAddNew Case adRsnUndoDelete Case adRsnUndoUpdate Case adRsnUpdate End Select If bCancel Then adStatus = adStatusCancel End Sub
Pago de clientes
Ilustración 4
Dim tabla3, Table As Recordset Public opcion As Integer Public vaar As String Sub Recupera() recepcion_pagos.Show With tabla3 recepcion_pagos.lblcodigo.Caption = !codigo recepcion_pagos.lblcliente.Caption = !cliente recepcion_pagos.lblproducto.Caption = !producto recepcion_pagos.lbldeuda.Caption = !deuda recepcion_pagos.txtcantidad.Text = !cantidad recepcion_pagos.lblfecha.Caption = !fecha_de_pago recepcion_pagos.txtutilidad.Text = !utilidad End With End Sub Sub SSQL() sentencia = "Select * From creditos Where codigo = '" & txtcodigo.Text & "'"
Set tabla3 = based.OpenRecordset(sentencia) End Sub Sub buscar() Call SSQL With tabla3 If tabla3.RecordCount <> 0 Then If Form2.ope = 1 Then Call Recupera End If Else x = MsgBox("ERROR EN LA BUSQUEDA", vbInformation, "MUEBLERIA BUDDY") End If End With End Sub Private Sub Command1_Click() If txtcodigo.Text = "" Then MsgBox (" NO VALIDO"), "MUEBLERIA BUDDY" Else If Form2.ope = 1 Then If Form2.opcion = 0 Then Call buscar Unload Me
End If End If If Form2.ope = 0 Then If Form2.opcion = 1 Then Call prestamos.buscar2 Unload Me End If End If If Form2.ope = 0 Then If Form2.opcion = 2 Then Call prestamos.Buscar3 Unload Me End If End If vaar = txtcodigo.Text End If End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub Form_Load() Call leer End Sub
INGENIERIA DEL SOFTWARE
MUEBLERIA BUDDY Página 7
Pantalla: nuevo producto
Ilustración 5
Dim progA As Recordset Dim tabla4 As Recordset Dim opera As Integer Public sw As Integer Private Sub Command1_Click() If txtnombre.Text = "" Or txtcompra.Text = "" Or txtventa.Text = "" Or txtcantidad.Text = "" Then x = MsgBox("FALTAN DATOS PARA FUNCIONAR", vbCritical, "MUEBLERIA BUDDY") Else sw = 2 Call Guardar Unload Me End If End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub Form_Load() Call leer opera = 1 Label4.Caption = Date End Sub Sub Guardar() Call Sentencia_SQL If opera = 1 Then If progA.RecordCount = 0 Then progA.AddNew Call EscribirEnBase x = MsgBox("AGREGADO CON EXITO", vbInformation, "MUEBLERIA BUDDY") Else
x = MsgBox("REGISTRO EXISTENTE", vbExclamation, "MUEBLERIA BUDDY") End If End If If opera = 2 Then If prog_A.RecordCount <> 0 Then prog_A.Edit Call EscribirEnBase Else x = MsgBox("REGISTRO EXISTENTE", vbInformation, "MUEBLERIA BUDDY") End If End If End Sub Sub Sentencia_SQL() sentencia = " SELECT * FROM ingresos WHERE nombre = '" & txtnombre.Text & "'" & "" Set progA = based.OpenRecordset(sentencia) End Sub Sub EscribirEnBase() With progA !nombre = txtnombre.Text !precio_de_compra = txtcompra.Text !precio_de_venta = txtventa.Text !utilidad = txtventa.Text - txtcompra.Text !cantidad = txtcantidad.Text !utilidad = txtventa.Text - txtcompra.Text .Update End With End Sub Private Sub txtcantidad_KeyPress(KeyAscii As Integer)
a = KeyAscii If a = 46 Then KeyAscii = 0 ElseIf a < 0 Or a > 57 Then KeyAscii = 0 End If End Sub Sub Sentencia_SQL4() sentencia = "Select * From movimientos Where fecha = '" & txtfecha.Text & "'" Set tabla4 = based.OpenRecordset(sentencia) End Sub Private Sub txtcompra_KeyPress(KeyAscii As Integer) a = KeyAscii If a = 46 Then KeyAscii = 0 ElseIf a < 0 Or a > 57 Then KeyAscii = 0 End If End Sub Private Sub txtventa_KeyPress(KeyAscii As Integer) a = KeyAscii If a = 46 Then KeyAscii = 0 ElseIf a < 0 Or a > 57 Then KeyAscii = 0 End If End Sub
INGENIERIA DEL SOFTWARE
MUEBLERIA BUDDY Página 8
Pantalla: ingreso de
mercancia
Ilustración 6
Public tabla As Recordset Public tabla2, tabla3 As Recordset Public tabla4 As Recordset Public sw As Integer Public var1 As Single Public var2 As Single Dim opera As Integer Private Sub cmddescargar_Click() If txtpa.Text = "" Or txtactual.Text = "" Or txtagregar.Text = "" Then x = MsgBox("FALTAN DATOS PARA FUNCIONAR", vbCritical, "MUEBLERIA BUDDY") Else sw = 2 Call Guardar Call Guardar2 Unload Me End If End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub Form_Load() Call leer sw = 1 opera = 1 crearLista Label6.Caption = Date End Sub Sub crearLista() Set tabla2 = based.OpenRecordset("ingresos") If tabla2.RecordCount <> 0 Then tabla2.MoveFirst Do While Not tabla2.EOF txtpa.AddItem tabla2!nombre tabla2.MoveNext Loop End If End Sub
Private Sub txtactual_KeyPress(KeyAscii As Integer) a = KeyAscii If a < 0 Or a > 57 Then KeyAscii = 0 End If End Sub Private Sub txtagregar_KeyPress(KeyAscii As Integer) a = KeyAscii If a = 46 Then KeyAscii = 0 ElseIf a < 0 Or a > 57 Then KeyAscii = 0 End If End Sub Private Sub txtpa_Click() Call DesplegarLista End Sub Sub Sentencia_SQL() sentencia = "Select * From ingresos WHERE nombre = '" & txtpa.Text & "'" Set tabla = based.OpenRecordset(sentencia) End Sub Sub DesplegarLista() Call Sentencia_SQL2 With tabla2 txtpa.Text = !nombre txtactual.Text = !cantidad End With End Sub Sub Sentencia_SQL2() sentencia = "Select * From ingresos Where nombre = '" & txtpa.Text & "'"
Set tabla2 = based.OpenRecordset(sentencia) End Sub Sub Sentencia_SQL3() sentencia = "Select * From entradas Where producto = '" & txtpa.Text & "'" Set tabla3 = based.OpenRecordset(sentencia) End Sub Sub Guardar() Call Sentencia_SQL If sw = 1 Then If tabla.RecordCount = 0 Then tabla.AddNew Call Escribir x = MsgBox("Operacion Exítosa", vbInformation, "MUEBLERIA BUDDY") Else x = MsgBox("El registro ya existe", vbInformation, "MUEBLERIA BUDDY") End If End If If sw = 2 Then If tabla.RecordCount <> 0 Then tabla.Edit Call Escribir x = MsgBox("Operacion Exítosa", vbInformation, "MUEBLERIA BUDDY") Else x = MsgBox("El registro no existe", vbCritical, "MUEBLERIA BUDDY") End If End If End Sub Sub Guardar2() Call Sentencia_SQL3 tabla3.AddNew Call Escribir2 End Sub Sub Escribir()
INGENIERIA DEL SOFTWARE
MUEBLERIA BUDDY Página 9
With tabla var1 = txtactual.Text var2 = txtagregar.Text !cantidad = var1 + var2 !nombre = txtpa.Text .Update End With End Sub
Sub Escribir2() With tabla3 Dim var1 As Long Dim var2 As Long var1 = txtactual.Text var2 = txtagregar.Text !fecha = Label6.Caption
!producto = txtpa.Text !cantidad_anterior = txtactual.Text !cantidad_entrante = txtagregar.Text !cantidad_total = var1 + var2 .Update End With End Sub
Pantalla: venta de
mercancias
Ilustración 7
Public tabla As Recordset Public tabla2, tabla3 As Recordset Public tabla4 As Recordset Public tabla5 As Recordset Public sw As Integer Public var1 As Single Public var2 As Single Dim opera As Integer Private Sub cmddescargar_Click() If txtretirar.Text = "" Or txtventa.Text = "" Then x = MsgBox("FALTAN DATOS PARA INICIAR", vbCritical, "MUEBLERIA BUDDY") Else sw = 2 Call Guardar Call Guardarmov Unload Me End If End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub Form_Load() Call leer sw = 1 opera = 1 crearLista
crearLista2 Label8.Caption = Date End Sub Sub crearLista() Set tabla2 = based.OpenRecordset("ingresos") If tabla2.RecordCount <> 0 Then tabla2.MoveFirst Do While Not tabla2.EOF txtpa.AddItem tabla2!nombre tabla2.MoveNext Loop End If End Sub Sub crearLista2() Set tabla5 = based.OpenRecordset("clientes") If tabla5.RecordCount <> 0 Then tabla5.MoveFirst Do While Not tabla5.EOF txtclientes.AddItem tabla5!nombre tabla5.MoveNext Loop End If End Sub Private Sub txtactual_KeyPress(KeyAscii As Integer)
a = KeyAscii If a < 0 Or a > 57 Then KeyAscii = 0 End If End Sub Private Sub txtagregar_KeyPress(KeyAscii As Integer) a = KeyAscii If a = 46 Then KeyAscii = 0 ElseIf a < 0 Or a > 57 Then KeyAscii = 0 End If End Sub Private Sub txtpa_Click() Call DesplegarLista End Sub Sub Sentencia_SQL() sentencia = "Select * From ingresos Where nombre = '" & txtpa.Text & "'" Set tabla = based.OpenRecordset(sentencia) End Sub Sub Sentencia_SQL2()
INGENIERIA DEL SOFTWARE
MUEBLERIA BUDDY Página 10
sentencia = "Select * From ingresos Where nombre = '" & txtpa.Text & "'" Set tabla2 = based.OpenRecordset(sentencia) End Sub Sub Sentencia_SQL3() sentencia = "Select * From mov" Set tabla5 = based.OpenRecordset(sentencia) End Sub Sub Sentencia_SQL4() sentencia = "Select * From clientes Where nombre = '" & txtclientes.Text & "'" Set tabla4 = based.OpenRecordset(sentencia) End Sub Sub DesplegarLista() Call Sentencia_SQL2 With tabla2 txtpa.Text = !nombre txtactual.Text = !cantidad txtutilidad.Text = !utilidad txtventa.Text = !precio_de_venta End With End Sub Sub Desplegar() Call Sentencia_SQL4 With tabla4
txtclientes.Text = !no txtempresa.Text = !empresa End With End Sub Sub Guardar() Call Sentencia_SQL If sw = 1 Then If tabla.RecordCount = 0 Then tabla.AddNew Call Escribir x = MsgBox("Nuevo registro guardado", vbInformation, "MUEBLERIA BUDDY") Else x = MsgBox("El registro ya existe", vbInformation, "MUEBLERIA BUDDY") End If End If If sw = 2 Then If tabla.RecordCount <> 0 Then tabla.Edit Call Escribir x = MsgBox("SENTENCIA EJECUTADA", vbInformation, "MUEBLERIA BUDDY") Else x = MsgBox("ERROR, NO EXISTE", vbCritical, "MUEBLERIA BUDDY") End If End If
End Sub Sub Guardarmov() Call Sentencia_SQL3 tabla5.AddNew Call Escribirmov End Sub Sub Escribir() With tabla var1 = txtactual.Text var2 = txtretirar.Text !cantidad = var1 - var2 !precio_de_venta = txtventa.Text !nombre = txtpa.Text .Update End With End Sub Sub Escribirmov() With tabla5 !fecha = Label8.Caption !articulo = txtpa.Text !cantidad = txtretirar.Text !VALOR = txtretirar.Text * txtventa.Text !vendido_a = txtclientes.Text !valor_unitario = txtventa.Text !utilidad = txtutilidad.Text * txtretirar.Text .Update End With End Sub
Pantalla: inventario
Ilustración 8
Option Explicit
INGENIERIA DEL SOFTWARE
MUEBLERIA BUDDY Página 11
Private Declare Function SetErrorMode Lib "kernel32" (ByVal wMode As Long) As Long Private Declare Sub InitCommonControls Lib "Comctl32" () Private Sub cmdall_Click() infoinventario.Show End Sub Private Sub Command1_Click() Unload Me End Sub Private Sub Form_Initialize() Call SetErrorMode(2) Call InitCommonControls End Sub Private Sub Adodc1_Error( _ ByVal ErrorNumber As Long, _ Description As String, _ ByVal Scode As Long, _ ByVal Source As String, _ ByVal HelpFile As String, _ ByVal HelpContext As Long, _ fCancelDisplay As Boolean) MsgBox " DEscripción del Error :" & Description, "MUEBLERIA BUDDY" End Sub Private Sub Adodc2_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset) Adodc1.Caption = " Registro actual: " &
CStr(Adodc1.Recordset.AbsolutePosition) End Sub Private Sub Adodc2_WillChangeRecord(ByVal adReason As ADODB.EventReasonEnum, ByVal cRecords As Long, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset) Dim bCancel As Boolean Select Case adReason Case adRsnAddNew Case adRsnClose Case adRsnDelete Case adRsnFirstChange Case adRsnMove Case adRsnRequery Case adRsnResynch Case adRsnUndoAddNew Case adRsnUndoDelete Case adRsnUndoUpdate Case adRsnUpdate End Select If bCancel Then adStatus = adStatusCancel End Sub Private Sub Form_Load() Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=..\MUEBLERIA BUDDY\sub_base_datos." & _ "MDB;Persist Security Info=False" With Adodc1
.CommandType = adCmdText .RecordSource = "Select * From ingresos" .Refresh Set DataGrid1.DataSource = Adodc1.Recordset DataGrid1.MarqueeStyle = dbgHighlightRowRaiseCell .Visible = False End With End Sub Private Sub Timer1_Timer() Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=..\MUEBLERIA BUDDDY\sub_base_datos." & _ "MDB;Persist Security Info=False" With Adodc1 .CommandType = adCmdText .RecordSource = "Select * From ingresos" .Refresh Set DataGrid1.DataSource = Adodc1.Recordset DataGrid1.MarqueeStyle = dbgHighlightRowRaiseCell .Visible = False End With End Sub
INGENIERIA DEL SOFTWARE
MUEBLERIA BUDDY Página 12
Modificar o eliminar
Ilustración 9
Public tabla As Recordset Public tabla2, tabla3 As Recordset Public tabla4 As Recordset Public sw As Integer Dim opera As Integer Private Sub cmddescargar_Click() sw = 2 Call Guardar Unload Me End Sub Private Sub Command1_Click() sw = 2 Call Eliminar Unload Me End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub Form_Load() Call leer sw = 1 opera = 1 crearLista End Sub Sub crearLista() Set tabla2 = based.OpenRecordset("clientes") If tabla2.RecordCount <> 0 Then tabla2.MoveFirst Do While Not tabla2.EOF txtpa.AddItem tabla2!nombre tabla2.MoveNext Loop End If End Sub
Private Sub txtactual_KeyPress(KeyAscii As Integer) a = KeyAscii If a < 0 Or a > 57 Then KeyAscii = 0 End If End Sub Private Sub txtcantidad_KeyPress(KeyAscii As Integer) a = KeyAscii If a = 46 Then KeyAscii = 0 ElseIf a < 0 Or a > 57 Then KeyAscii = 0 End If End Sub Private Sub txtcompra_KeyPress(KeyAscii As Integer) a = KeyAscii If a = 46 Then KeyAscii = 0 ElseIf a < 0 Or a > 57 Then KeyAscii = 0 End If End Sub Private Sub txtpa_Click() Call DesplegarLista End Sub Sub Sentencia_SQL() sentencia = "Select * From clientes WHERE nombre = '" & txtpa.Text & "'"
Set tabla = based.OpenRecordset(sentencia) End Sub Sub DesplegarLista() Call Sentencia_SQL2 With tabla2 txtpa.Text = !nombre txtnew.Text = !nombre txtempresa.Text = !empresa txttelefono.Text = !telefono txtdireccion.Text = !Direccion End With End Sub Sub Sentencia_SQL2() sentencia = "Select * From clientes Where nombre = '" & txtpa.Text & "'" Set tabla2 = based.OpenRecordset(sentencia) End Sub Private Sub txtutilidad_KeyPress(KeyAscii As Integer) a = KeyAscii If a = 46 Then KeyAscii = 0 ElseIf a < 0 Or a > 57 Then KeyAscii = 0 End If End Sub Private Sub txtventa_KeyPress(KeyAscii As Integer) a = KeyAscii If a = 46 Then KeyAscii = 0 ElseIf a < 0 Or a > 57 Then
INGENIERIA DEL SOFTWARE
MUEBLERIA BUDDY Página 13
KeyAscii = 0 End If End Sub Sub Eliminar() Call Sentencia_SQL If tabla.RecordCount <> o Then x = MsgBox("¿ELIMENAR REGISTRO?", vbYesNo, "MUEBLERIA BUDDY") If x = vbYes Then tabla.Delete If tabla.BOF Then tabla.MoveNext Else If tabla.EOF Then tabla.MovePrevious Else tabla.MoveNext End If x = MsgBox("REGISTRO ELIMINADO", vbInformation, "MUEBLERIA BUDDY")
End If End If End If End Sub Sub Guardar() Call Sentencia_SQL If sw = 1 Then If tabla.RecordCount = 0 Then tabla.AddNew Call Escribir x = MsgBox("GUARDADO", vbInformation) Else x = MsgBox("ERROR: EL REGISTRO YA EXISTE", vbInformation, "MUEBLERIA BUDDY") End If End If If sw = 2 Then If tabla.RecordCount <> 0 Then tabla.Edit Call Escribir
x = MsgBox("MODIFICADO CON EXITO", vbInformation, "MUEBLERIA BUDDY") Else x = MsgBox("ERROR", vbCritical) End If End If End Sub Sub Escribir() With tabla !nombre = txtpa.Text !nombre = txtnew.Text !empresa = txtempresa.Text !telefono = txttelefono.Text !Direccion = txtdireccion.Text .Update End With End Sub
Pantalla: ventas a credito
Ilustración 10
Public tabla As Recordset Public tabla2, tabla3 As Recordset Public tabla4 As Recordset Public sw As Integer Public var1 As Single Public var2 As Single Dim opera As Integer
Dim sentencia As Variant Dim x As Variant Option Explicit
Private Declare Function SetErrorMode Lib "kernel32" (ByVal wMode As Long) As Long Private Declare Sub InitCommonControls Lib "Comctl32" ()
INGENIERIA DEL SOFTWARE
MUEBLERIA BUDDY Página 14
Private Sub Command1_Click() mod_credito.Show Unload Me End Sub Private Sub Command2_Click() registro_movimientos.Show End Sub Private Sub Command12_Click() cartera.Show End Sub Private Sub Form_Initialize() Call SetErrorMode(2) Call InitCommonControls End Sub Private Sub Adodc1_Error( _ ByVal ErrorNumber As Long, _ Description As String, _ ByVal Scode As Long, _ ByVal Source As String, _ ByVal HelpFile As String, _ ByVal HelpContext As Long, _ fCancelDisplay As Boolean) MsgBox " DEscripción del Error :" & Description, "MUEBLERIA BUDDY" End Sub Private Sub Adodc2_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset) Adodc1.Caption = " Registro actual: " & CStr(Adodc1.Recordset.AbsolutePosition) End Sub Private Sub Adodc2_WillChangeRecord(ByVal adReason As ADODB.EventReasonEnum, ByVal cRecords As Long, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset) Dim bCancel As Boolean Select Case adReason Case adRsnAddNew Case adRsnClose Case adRsnDelete Case adRsnFirstChange Case adRsnMove Case adRsnRequery Case adRsnResynch Case adRsnUndoAddNew Case adRsnUndoDelete Case adRsnUndoUpdate
Case adRsnUpdate End Select If bCancel Then adStatus = adStatusCancel End Sub Private Sub Form_Load() Call leer sw = 1 opera = 1 crearLista crearLista2 Label8.Caption = Date Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=..\MUEBLERIA BUDDY\sub_base_datos." & _ "MDB;Persist Security Info=False" With Adodc1 .CommandType = adCmdText .RecordSource = "Select * From creditos" .Refresh Set DataGrid1.DataSource = Adodc1.Recordset DataGrid1.MarqueeStyle = dbgHighlightRowRaiseCell .Visible = False End With With Combo1 End With Text1 = "" With Adodc1.Recordset Dim total As Long Do While Not .EOF total = total + !deuda .MoveNext Label13.Caption = total Loop End With End Sub Private Sub Text1_Change() On Error GoTo error_Handler With Adodc1 If Text1 <> "" Then .Recordset.Filter = Combo1 & " LIKE '*" + Text1 + "*'" Set DataGrid1.DataSource = Adodc1.Recordset
Else .Recordset.Filter = "" End If .Refresh End With Exit Sub error_Handler: If Err.Number = 3265 Then MsgBox "ERROR", vbCritical, "MUEBLERIA BUDDY" Else MsgBox "Err.Description", vbCritical, "MUEBLERIA BUDDY" End If End Sub Private Sub cmddescargar_Click() If txtpa.Text = "" Or txtclientes.Text = "" Or txtventa.Text = "" Or txtutilidad.Text = "" Or txtactual.Text = "" Or txtretirar.Text = "" Or txtcodigo.Text = "" Then x = MsgBox("FALTAN DATOS PARA FUNCIONAR", vbCritical, "MUEBLERIA BUDDY") Else sw = 1 Call Guardar Call Guardar2 Unload Me End If End Sub Private Sub Command10_Click() Unload Me End Sub Sub crearLista() Set tabla2 = based.OpenRecordset("ingresos") If tabla2.RecordCount <> 0 Then tabla2.MoveFirst Do While Not tabla2.EOF txtpa.AddItem tabla2!nombre tabla2.MoveNext Loop End If End Sub Sub crearLista2() Set tabla = based.OpenRecordset("clientes") If tabla.RecordCount <> 0 Then tabla.MoveFirst Do While Not tabla.EOF txtclientes.AddItem tabla!nombre tabla.MoveNext Loop End If End Sub Private Sub txtpa_Click() Call DesplegarLista End Sub Sub Sentencia_SQL()
INGENIERIA DEL SOFTWARE
MUEBLERIA BUDDY Página 15
sentencia = "Select * From clientes WHERE nombre = '" & txtpa.Text & "'" Set tabla = based.OpenRecordset(sentencia) End Sub Sub DesplegarLista() Call Sentencia_SQL2 With tabla2 txtventa.Text = !precio_de_venta txtutilidad.Text = !utilidad txtactual.Text = !cantidad End With End Sub Sub Sentencia_SQL2() sentencia = "Select * From ingresos Where nombre = '" & txtpa.Text & "'" Set tabla2 = based.OpenRecordset(sentencia) End Sub Sub Sentencia_SQL3() sentencia = "Select * From creditos "
Set tabla3 = based.OpenRecordset(sentencia) End Sub Sub Guardar() Call Sentencia_SQL3 tabla3.AddNew Call Escribir End Sub Sub Guardar2() Call Sentencia_SQL2 If tabla2.RecordCount <> 0 Then tabla2.Edit Call Escribir2 x = MsgBox("EXCELENTE", vbInformation, "MUEBLERIA BUDDY") Else x = MsgBox("NO EXISTE", vbCritical, "MUEBLERIA BUDDY") End If End Sub Sub Escribir() With tabla3
!codigo = txtcodigo.Text !cliente = txtclientes.Text !producto = txtpa.Text !cantidad = txtretirar.Text !deuda = txtretirar.Text * txtventa.Text !fecha_de_pago = DTPicker1.Value !utilidad = txtutilidad.Text .Update End With End Sub Sub Escribir2() With tabla2 var1 = txtactual.Text var2 = txtretirar.Text !cantidad = var1 - var2 !precio_de_venta = txtventa.Text !nombre = txtpa.Text .Update End With End Sub
Pantalla: movimientos
Private Declare Function SetErrorMode Lib "kernel32" (ByVal wMode As Long) As Long Private Declare Sub InitCommonControls Lib "Comctl32" () Private Sub Command10_Click() Unload Me End Sub Private Sub Command2_Click() registro_movimientos.Show End Sub Private Sub Form_Initialize() Call SetErrorMode(2) Call InitCommonControls End Sub Private Sub Adodc1_Error( _ ByVal ErrorNumber As Long, _ Description As String, _ ByVal Scode As Long, _ ByVal Source As String, _ ByVal HelpFile As String, _ ByVal HelpContext As Long, _ fCancelDisplay As Boolean) MsgBox " DESCRIPCION DEL ERROR" & Description, "MUEBLERIA BUDDY" End Sub
Ilustración 11
INGENIERIA DEL SOFTWARE
MUEBLERIA BUDDY Página 16
Private Sub Adodc2_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset) Adodc1.Caption = " Registro actual: " & CStr(Adodc1.Recordset.AbsolutePosition) End Sub Private Sub Adodc2_WillChangeRecord(ByVal adReason As ADODB.EventReasonEnum, ByVal cRecords As Long, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset) Dim bCancel As Boolean Select Case adReason Case adRsnAddNew Case adRsnClose Case adRsnDelete Case adRsnFirstChange Case adRsnMove Case adRsnRequery Case adRsnResynch Case adRsnUndoAddNew Case adRsnUndoDelete Case adRsnUndoUpdate Case adRsnUpdate End Select If bCancel Then adStatus = adStatusCancel End Sub Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=..\MUEBLERIA BUDDY\sub_base_datos." & _ "MDB;Persist Security Info=False" With Adodc1 .CommandType = adCmdText .RecordSource = "Select * From mov" .Refresh Set DataGrid1.DataSource = Adodc1.Recordset DataGrid1.MarqueeStyle = dbgHighlightRowRaiseCell .Visible = False End With With Combo1 End With Text1 = "" With Adodc1.Recordset Dim total As Long Dim total2 As Long Dim total3 As Long Do While Not .EOF total = total + !VALOR total2 = total2 + !utilidad total3 = total3 + !cantidad .MoveNext Label2.Caption = total Label6.Caption = total2 Label8.Caption = total3 Loop
End With End Sub Private Sub Text1_Change() On Error GoTo error_Handler With Adodc1 If Text1 <> "" Then .Recordset.Filter = Combo1 & " LIKE '*" + Text1 + "*'" Set DataGrid1.DataSource = Adodc1.Recordset With Adodc1.Recordset Dim total As Long Do While Not .EOF total = total + !VALOR .MoveNext Label5.Caption = total Loop End With Else .Recordset.Filter = "" End If .Refresh End With Exit Sub error_Handler: If Err.Number = 3265 Then MsgBox "DATOS NO VALIDOS", vbCritical, "MUEBLERIA BUDDY" Else MsgBox Err.Description, vbCritical, "MUEBLERIA BUDDY" End If End Sub
ACCESO con permisos restringidos
En esta pantalla el usuario tendra acceso solo a ver los registros de entrada, siempre y cuando no se modifiquen los permisos de usuario. Esto solo es el modelo de cómo podria ser el acceso a usuarios con permisos restringidos.
Ilustración 12
INGENIERIA DEL SOFTWARE
MUEBLERIA BUDDY Página 17
Otro ejemplo de pantalla son los demas tipos de usuarios que en seguida se muestran USUARIO RESTRINGIDO USUARIO RESTRINGIDO X USUARIO RESTRINGIDO Y