Me.Label17.ForeColor = RGB(Rnd * (20), Rnd * (20), Rnd * (30)) End Sub Private Sub lblSearch_Click() Dim optionvalue As String Dim datavalue As String Dim sflag As Boolean Dim rsee As Recordset 'combo choice optionvalue = Me.cmbSearch Set rsee = New Recordset 'the search input datavalue = Trim$(Me.txtSearch.Text) Select Case optionvalue$ Case "No. do Aluno" Cmaster.getSearchAction = 2 sflag = Cmaster.searchCategeories(rsee, datavalue)
Case "Sobrenome" Cmaster.getSearchAction = 1 sflag = Cmaster.searchCategeories(rsee, datavalue)
Case "Nome" Cmaster.getSearchAction = 3 sflag = Cmaster.searchCategeories(rsee, datavalue)
Case "Curso" Cmaster.getSearchAction = 4 sflag = Cmaster.searchCategeories(rsee, datavalue)
Case "Selecione" MsgBox "Selecione a categoria" Me.txtSearch.SetFocus Me.cmbSearch.SetFocus Exit Sub End Select If sflag Then MsgBox "Registro encontrado!", vbInformation, ("Procurar!!!") showSearch rsee, datavalue Me.lblRefresh.Caption = "Mostrar Lista" Else MsgBox "Registro no encontrado!" End If End Sub Private Sub lblRefresh_Click() Me.lblRefresh.Caption = "Atualiza Lista" Me.listStudents.ListItems.Clear showMaster End Sub Private Sub lblRefresh_MouseMove(Button As Integer, Shift As Integer, X As Singl e, y As Single) Me.lblRefresh.FontUnderline = True End Sub Private Sub GetvaluesToSave() Cmaster.getSN = Trim$(Me.txtSN.Text) Cmaster.getLN = Trim$(Me.txtLN.Text) Cmaster.getFN = Trim$(Me.txtFN.Text) Cmaster.getMid = Trim$(Me.txtMI.Text) Cmaster.getSx = Trim$(Me.cmbSex) Cmaster.getAds = Trim$(Me.txtAddress.Text) Cmaster.getCont = Trim$(Me.txtContact.Text) Cmaster.getSch = Trim$(Me.txtSchool.Text) Cmaster.getCrs = Trim$(Me.cmbCourse) End Sub Private Sub lblModify_MouseMove(Button As Integer, Shift As Integer, X As Single , y As Single) Me.lblModify.FontUnderline = True End Sub Private Sub getValuesfromList() Me.txtSN.Text = Me.listStudents.ListItems.Item(Me.listStudents.SelectedItem.Inde x).Text Me.txtLN.Text = Me.listStudents.ListItems.Item(Me.listStudents.SelectedItem.Inde x).SubItems(1) Me.txtFN.Text = Me.listStudents.ListItems.Item(Me.listStudents.SelectedItem.Inde x).SubItems(2) Me.txtMI.Text = Me.listStudents.ListItems.Item(Me.listStudents.SelectedItem.Inde x).SubItems(3) Me.cmbSex = Me.listStudents.ListItems.Item(Me.listStudents.SelectedItem.Index).S ubItems(4) Me.txtAddress.Text = Me.listStudents.ListItems.Item(Me.listStudents.SelectedItem .Index).SubItems(5) Me.txtContact.Text = Me.listStudents.ListItems.Item(Me.listStudents.SelectedItem .Index).SubItems(6) Me.txtSchool.Text = Me.listStudents.ListItems.Item(Me.listStudents.SelectedItem. Index).SubItems(7) Me.cmbCourse = Me.listStudents.ListItems.Item(Me.listStudents.SelectedItem.Index ).SubItems(8) End Sub Private Sub lblDelete_MouseMove(Button As Integer, Shift As Integer, X As Single , y As Single) Me.lblDelete.FontUnderline = True End Sub Private Sub lblModify_Click() Dim y As String y = MsgBox("Tem certeza que deseja atualizar este registro", vbYesNo, ("Atualiza ou No!")) If y = 6 Then getValuesfromList Me.lblAdd.Caption = "Atualiza Registro" Else MsgBox "Atualizao no confirmada!" Exit Sub End If End Sub Private Sub lblClose_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single) Me.lblClose.FontUnderline = True End Sub Private Sub lblDelete_Click() Dim dId As String Dim dflag As Boolean Set Cmaster = New clsMaster Dim msg As String msg = MsgBox("Deseja deletar este registro?", vbYesNo) If msg = 6 Then dId = Me.listStudents.ListItems.Item(Me.listStudents.SelectedItem.Index).Text getValuesfromList dflag = Cmaster.deleteStud(dId) Else dflag = False MsgBox "No confirmado" End If If dflag Then MsgBox "Registro deletado!" cleartext End If End Sub Private Sub lblcancelS_Click() Me.txtSearch.Text = "" Me.cmbSearch.Text = "Selecione" End Sub Private Sub lblcancelS_MouseMove(Button As Integer, Shift As Integer, X As Singl e, y As Single) Me.lblcancelS.FontUnderline = True End Sub Private Sub lblClose_Click() Dim xy As String xy = MsgBox("Deseja sair ?", vbYesNo, ("Log off!!!")) If xy = 6 Then destroyConnection End Else Exit Sub End If End Sub Private Sub lblAdd_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single) Me.lblAdd.FontUnderline = True End Sub Private Sub lblCancel_Click() cleartext Me.lblAdd.Caption = "&Incluir Registro" overrallflag = False End Sub Private Sub lblCancel_MouseMove(Button As Integer, Shift As Integer, X As Single , y As Single) Me.lblCancel.FontUnderline = True End Sub Private Sub cleartext() With Me .txtSN.Text = "" .txtLN.Text = "" .txtFN.Text = "" .txtMI.Text = "" .txtContact.Text = "" .txtAddress.Text = "" .txtSchool.Text = "" .cmbCourse = "" .cmbSex = "" End With End Sub Private Sub lblAdd_Click() Dim rflag As Boolean Dim rone As Recordset Dim checkid As String Dim myprevID As String Dim newid As String Set Cmaster = New clsMaster Set rone = New Recordset 'verifica ID existente rflag = overrallflag If Me.lblAdd.Caption = "Incluir Registro" Then
checkid = Trim$(Me.txtSN.Text) rflag = Cmaster.searchOneStud(rone, checkid) If rflag Then MsgBox "ID j existe, no pode ser duplicado !" Exit Sub Else
MsgBox "Verificando...:Preparando par salvar!" GetvaluesToSave rflag = Cmaster.newStud
MsgBox "Registro atualizado com sucesso !" cleartext Me.lblAdd.Caption = "Incluir Registro" Else Me.lblAdd.Caption = "Incluir Registro" rflag = False overrallflag = rflag MsgBox "Registro no pode ser atualizado!" End If
End If End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, y A s Single) With Me .lblRefresh.FontUnderline = False .lblDelete.FontUnderline = False .lblClose.FontUnderline = False .lblModify.FontUnderline = False .lblAdd.FontUnderline = False .lblSearch.FontUnderline = False .lblCancel.FontUnderline = False .lblcancelS.FontUnderline = False End With End Sub Private Sub showMaster() Dim res As Recordset Dim rflag As Boolean Dim m As ListItem 'values for counting Dim countF As Integer Dim countcs As Integer Dim countIT As Integer Dim countDCET As Integer Dim countDEP As Integer Dim countNUR As Integer Dim countCCT As Integer Dim countHRM As Integer Dim countCoE As Integer Dim countOTher As Integer Set res = New Recordset Set Cmaster = New clsMaster rflag = Cmaster.getAllList(res) If rflag Then Do While Not (res.EOF Or res.BOF) Set m = Me.listStudents.ListItems.Add(, , res.Fields("Studentno")) m.SubItems(1) = res.Fields("Lname") m.SubItems(2) = res.Fields("Fname") m.SubItems(3) = res.Fields("MI") m.SubItems(4) = res.Fields("Sex") m.SubItems(5) = res.Fields("Address") m.SubItems(6) = res.Fields("Contactno") m.SubItems(7) = res.Fields("School") m.SubItems(8) = res.Fields("Course")
If res.Fields("sex") = "F" Then countF = countF + 1 End If
If res.Fields("Course") = "BSCS" Then countcs = countcs + 1 End If
If res.Fields("Course") = "BSIT" Then countIT = countIT + 1 End If
If res.Fields("Course") = "DEP" Then countDEP = countDEP + 1 End If
If res.Fields("Course") = "BSN" Then countNUR = countNUR + 1 End If
If res.Fields("Course") = "DCET" Then countDCET = countDCET + 1 End If
If res.Fields("Course") = "CCT" Then countCCT = countCCT + 1 End If
If res.Fields("Course") = "HRM" Then countHRM = countHRM + 1 End If
If res.Fields("Course") = "CoE" Then countCoE = countCoE + 1 End If
If res.Fields("Course") = "-" Then countOTher = countOTher + 1 End If
res.MoveNext Loop End If 'display counts Me.lblTS.Caption = Me.listStudents.ListItems.Count Me.lblF.Caption = countF Me.lblM.Caption = Me.lblTS - countF Me.lblCS.Caption = countcs Me.lblIT.Caption = countIT Me.lblDEP.Caption = countDEP Me.lblDCET.Caption = countDCET Me.lblBSN.Caption = countNUR Me.lblCCT.Caption = countCCT Me.lblHRM.Caption = countHRM Me.lblCoe.Caption = countCoE Me.lblOther.Caption = countOTher End Sub Private Sub showSearch(rss As Recordset, thevalue As String) Dim s As ListItem Me.listStudents.ListItems.Clear Dim myformattedid As String Dim countYear As Integer Do While Not (rss.BOF Or rss.EOF) Set s = Me.listStudents.ListItems.Add(, , rss.Fields("Studentno")) s.SubItems(1) = rss.Fields("Lname") s.SubItems(2) = rss.Fields("Fname") s.SubItems(3) = rss.Fields("MI") s.SubItems(4) = rss.Fields("Sex") s.SubItems(5) = rss.Fields("Address") s.SubItems(6) = rss.Fields("Contactno") s.SubItems(7) = rss.Fields("School") s.SubItems(8) = rss.Fields("Course") myformatedID = mid$(rss.Fields("Studentno"), 5, 4) 'myformatedID = Format$(Right$(myformatedID, 4), "####") Cmaster.getfNum = myformatedID
If myformatedID = Me.txtSearch.Text Then countYear = countYear + 1 End If rss.MoveNext Loop Me.lblYearS.Caption = countYear End Sub Private Sub lblSearch_MouseMove(Button As Integer, Shift As Integer, X As Single , y As Single) Me.lblSearch.FontUnderline = True End Sub Private Sub Timer1_Timer() If Label17.Visible = False Then Label16.Visible = True Label17.Visible = False Else Label16.Visible = False End If If Label16.Visible = True Then Label17.Visible = True Label16.Visible = False Else Label16.Visible = True Label17.Visible = False End If Me.Label17.ForeColor = RGB(Rnd * (10), Rnd * (20), Rnd * (10)) Me.Label17.ForeColor = RGB(Rnd * (20), Rnd * (20), Rnd * (30)) End Sub Private Sub lblSearch_Click() Dim optionvalue As String Dim datavalue As String Dim sflag As Boolean Dim rsee As Recordset 'combo choice optionvalue = Me.cmbSearch Set rsee = New Recordset 'the search input datavalue = Trim$(Me.txtSearch.Text) Select Case optionvalue$ Case "No. do Aluno" Cmaster.getSearchAction = 2 sflag = Cmaster.searchCategeories(rsee, datavalue)
Case "Sobrenome" Cmaster.getSearchAction = 1 sflag = Cmaster.searchCategeories(rsee, datavalue)
Case "Nome" Cmaster.getSearchAction = 3 sflag = Cmaster.searchCategeories(rsee, datavalue)
Case "Curso" Cmaster.getSearchAction = 4 sflag = Cmaster.searchCategeories(rsee, datavalue)
Case "Selecione" MsgBox "Selecione a categoria" Me.txtSearch.SetFocus Me.cmbSearch.SetFocus Exit Sub End Select If sflag Then MsgBox "Registro encontrado!", vbInformation, ("Procurar!!!") showSearch rsee, datavalue Me.lblRefresh.Caption = "Mostrar Lista" Else MsgBox "Registro no encontrado!" End If End Sub Private Sub lblRefresh_Click() Me.lblRefresh.Caption = "Atualiza Lista" Me.listStudents.ListItems.Clear showMaster End Sub Private Sub lblRefresh_MouseMove(Button As Integer, Shift As Integer, X As Singl e, y As Single) Me.lblRefresh.FontUnderline = True End Sub Private Sub GetvaluesToSave() Cmaster.getSN = Trim$(Me.txtSN.Text) Cmaster.getLN = Trim$(Me.txtLN.Text) Cmaster.getFN = Trim$(Me.txtFN.Text) Cmaster.getMid = Trim$(Me.txtMI.Text) Cmaster.getSx = Trim$(Me.cmbSex) Cmaster.getAds = Trim$(Me.txtAddress.Text) Cmaster.getCont = Trim$(Me.txtContact.Text) Cmaster.getSch = Trim$(Me.txtSchool.Text) Cmaster.getCrs = Trim$(Me.cmbCourse) End Sub Private Sub lblModify_MouseMove(Button As Integer, Shift As Integer, X As Single , y As Single) Me.lblModify.FontUnderline = True End Sub Private Sub getValuesfromList() Me.txtSN.Text = Me.listStudents.ListItems.Item(Me.listStudents.SelectedItem.Inde x).Text Me.txtLN.Text = Me.listStudents.ListItems.Item(Me.listStudents.SelectedItem.Inde x).SubItems(1) Me.txtFN.Text = Me.listStudents.ListItems.Item(Me.listStudents.SelectedItem.Inde x).SubItems(2) Me.txtMI.Text = Me.listStudents.ListItems.Item(Me.listStudents.SelectedItem.Inde x).SubItems(3) Me.cmbSex = Me.listStudents.ListItems.Item(Me.listStudents.SelectedItem.Index).S ubItems(4) Me.txtAddress.Text = Me.listStudents.ListItems.Item(Me.listStudents.SelectedItem .Index).SubItems(5) Me.txtContact.Text = Me.listStudents.ListItems.Item(Me.listStudents.SelectedItem .Index).SubItems(6) Me.txtSchool.Text = Me.listStudents.ListItems.Item(Me.listStudents.SelectedItem. Index).SubItems(7) Me.cmbCourse = Me.listStudents.ListItems.Item(Me.listStudents.SelectedItem.Index ).SubItems(8) End Sub Private Sub lblDelete_MouseMove(Button As Integer, Shift As Integer, X As Single , y As Single) Me.lblDelete.FontUnderline = True End Sub Private Sub lblModify_Click() Dim y As String y = MsgBox("Tem certeza que deseja atualizar este registro", vbYesNo, ("Atualiza ou No!")) If y = 6 Then getValuesfromList Me.lblAdd.Caption = "Atualiza Registro" Else MsgBox "Atualizao no confirmada!" Exit Sub End If End Sub Private Sub lblClose_Click() Dim xy As String xy = MsgBox("Deseja sair ?", vbYesNo, ("Log off!!!")) If xy = 6 Then destroyConnection End Else Exit Sub End If End Sub Private Sub lblClose_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single) Me.lblClose.FontUnderline = True End Sub Private Sub lblDelete_Click() Dim dId As String Dim dflag As Boolean Set Cmaster = New clsMaster Dim msg As String msg = MsgBox("Deseja deletar este registro?", vbYesNo) If msg = 6 Then dId = Me.listStudents.ListItems.Item(Me.listStudents.SelectedItem.Index).Text getValuesfromList dflag = Cmaster.deleteStud(dId) Else dflag = False MsgBox "No confirmado" End If If dflag Then MsgBox "Registro deletado!" cleartext End If End Sub Private Sub lblCancel_MouseMove(Button As Integer, Shift As Integer, X As Single , y As Single) Me.lblCancel.FontUnderline = True End Sub Private Sub lblcancelS_Click() Me.txtSearch.Text = "" Me.cmbSearch.Text = "Selecione" End Sub Private Sub lblcancelS_MouseMove(Button As Integer, Shift As Integer, X As Singl e, y As Single) Me.lblcancelS.FontUnderline = True End Sub Private Sub cleartext() With Me .txtSN.Text = "" .txtLN.Text = "" .txtFN.Text = "" .txtMI.Text = "" .txtContact.Text = "" .txtAddress.Text = "" .txtSchool.Text = "" .cmbCourse = "" .cmbSex = "" End With End Sub Private Sub lblAdd_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single) Me.lblAdd.FontUnderline = True End Sub Private Sub lblCancel_Click() cleartext Me.lblAdd.Caption = "&Incluir Registro" overrallflag = False End Sub With Me .lblRefresh.FontUnderline = False .lblDelete.FontUnderline = False .lblClose.FontUnderline = False .lblModify.FontUnderline = False .lblAdd.FontUnderline = False .lblSearch.FontUnderline = False .lblCancel.FontUnderline = False .lblcancelS.FontUnderline = False End With End Sub Private Sub lblAdd_Click() Dim rflag As Boolean Dim rone As Recordset Dim checkid As String Dim myprevID As String Dim newid As String Set Cmaster = New clsMaster Set rone = New Recordset 'verifica ID existente rflag = overrallflag If Me.lblAdd.Caption = "Incluir Registro" Then
checkid = Trim$(Me.txtSN.Text) rflag = Cmaster.searchOneStud(rone, checkid) If rflag Then MsgBox "ID j existe, no pode ser duplicado !" Exit Sub Else
MsgBox "Verificando...:Preparando par salvar!" GetvaluesToSave rflag = Cmaster.newStud
MsgBox "Registro atualizado com sucesso !" cleartext Me.lblAdd.Caption = "Incluir Registro" Else Me.lblAdd.Caption = "Incluir Registro" rflag = False overrallflag = rflag MsgBox "Registro no pode ser atualizado!" End If
End If End Sub Me.cmbSex.AddItem ("M") Me.cmbSex.AddItem ("F") Me.cmbCourse.AddItem ("BSCS") Me.cmbCourse.AddItem ("BSIT") Me.cmbCourse.AddItem ("DEP") Me.cmbCourse.AddItem ("DCET") Me.cmbCourse.AddItem ("BSN") Me.cmbCourse.AddItem ("HRM") Me.cmbCourse.AddItem ("CoE") Me.cmbCourse.AddItem ("CCT") Me.cmbSearch.AddItem ("Ano") Me.cmbSearch.AddItem ("No. do Aluno") Me.cmbSearch.AddItem ("Sobrenome") Me.cmbSearch.AddItem ("Nome") Me.cmbSearch.AddItem ("Curso") Me.cmbSearch.Text = "Selecione" showMaster End Sub Private Sub showMaster() Dim res As Recordset Dim rflag As Boolean Dim m As ListItem 'values for counting Dim countF As Integer Dim countcs As Integer Dim countIT As Integer Dim countDCET As Integer Dim countDEP As Integer Dim countNUR As Integer Dim countCCT As Integer Dim countHRM As Integer Dim countCoE As Integer Dim countOTher As Integer Set res = New Recordset Set Cmaster = New clsMaster rflag = Cmaster.getAllList(res) If rflag Then Do While Not (res.EOF Or res.BOF) Set m = Me.listStudents.ListItems.Add(, , res.Fields("Studentno")) m.SubItems(1) = res.Fields("Lname") m.SubItems(2) = res.Fields("Fname") m.SubItems(3) = res.Fields("MI") m.SubItems(4) = res.Fields("Sex") m.SubItems(5) = res.Fields("Address") m.SubItems(6) = res.Fields("Contactno") m.SubItems(7) = res.Fields("School") m.SubItems(8) = res.Fields("Course")
If res.Fields("sex") = "F" Then countF = countF + 1 End If
If res.Fields("Course") = "BSCS" Then countcs = countcs + 1 End If
If res.Fields("Course") = "BSIT" Then countIT = countIT + 1 End If
If res.Fields("Course") = "DEP" Then countDEP = countDEP + 1 End If
If res.Fields("Course") = "BSN" Then countNUR = countNUR + 1 End If
If res.Fields("Course") = "DCET" Then countDCET = countDCET + 1 End If
If res.Fields("Course") = "CCT" Then countCCT = countCCT + 1 End If
If res.Fields("Course") = "HRM" Then countHRM = countHRM + 1 End If
If res.Fields("Course") = "CoE" Then countCoE = countCoE + 1 End If
If res.Fields("Course") = "-" Then countOTher = countOTher + 1 End If
res.MoveNext Loop End If 'display counts Me.lblTS.Caption = Me.listStudents.ListItems.Count Me.lblF.Caption = countF Me.lblM.Caption = Me.lblTS - countF Me.lblCS.Caption = countcs Me.lblIT.Caption = countIT Me.lblDEP.Caption = countDEP Me.lblDCET.Caption = countDCET Me.lblBSN.Caption = countNUR Me.lblCCT.Caption = countCCT Me.lblHRM.Caption = countHRM Me.lblCoe.Caption = countCoE Me.lblOther.Caption = countOTher End Sub Private Sub txtHistoriaHasta_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtBuscar.SetFocus 'SendKeys ("{tab}") KeyAscii = 0 End If End Sub Private Sub mnuImprimir_Click() If MsgBox("Imprimir Listado?", vbYesNo + vbInformation, "Impresin") = vbYes Th en 'IniciarImpresion End If End Sub Private Sub VerCuentaCorriente() titulos = "ID|N FACT.|FECHA|DESCRIPCIN|DEBE|HABER" frmClientes.MSHFlexGrid1.Clear With frmClientes.MSHFlexGrid1 .Rows = 2 .FixedRows = 1 .Col = 0 .ColSel = 0 .Row = 1 .RowSel = 1 .FormatString = titulos .ColWidth(0) = 0 .ColWidth(1) = 1000 .ColWidth(2) = 1200 .ColWidth(3) = 2500 .ColWidth(4) = 1500 .ColWidth(5) = 1500 .Visible = True .AllowBigSelection = True .AllowUserResizing = flexResizeColumns .SelectionMode = flexSelectionByRow .ColAlignmentFixed = 3 End With Dim rsCons As New Recordset strSql = "Select * From CuentasCorrientes Where Codcliente=" & Val(frmClientes.t xtCodDist) rsCons.Open strSql, DB, adOpenKeyset, adLockOptimistic, adCmdText TotDebe = "0" TotHaber = "0" While Not rsCons.EOF i = i + 1
MSHFlexGrid1.AddItem linea, i rs.MoveNext Wend lblTotalRef = rs.RecordCount End Sub Private Sub MSHFlexGrid1_DblClick() On Error Resume Next Dim nrolista As Long MSHFlexGrid1.Col = 0 nrolista = MSHFlexGrid1.Text 'frmClientes.txtCodDist.SetFocus Dim rs1 As New Recordset strSql = "Select * From Proveedores Where ID=" & Val(nrolista) AbrirBase rs1.Open strSql, DB, adOpenKeyset, adLockOptimistic, adCmdText If Not rs.EOF Then 'traigo campos frmProveedores.txtCodDist = Val(nrolista) frmProveedores.txtFechaAlta = rs1!FechaAlta frmProveedores.txtNombre = rs1!nombre frmProveedores.txtDomicilio = rs1!domicilio frmProveedores.txtLocalidad = rs1!Localidad frmProveedores.txtCodPost = rs1!CodPost frmProveedores.txtTelefono = rs1!telefono frmProveedores.ComboCategIva = rs1!categiva frmProveedores.txtEmail = rs1!Email frmProveedores.txtCuit = rs1!cuit 'Habilito desabilito 'frmProveedores.txtCodDist.Enabled = False 'frmProveedores.txtFechaAlta.Enabled = True 'frmProveedores.txtNombre.Enabled = True 'frmProveedores.txtDomicilio.Enabled = True 'frmProveedores.txtLocalidad.Enabled = True 'frmProveedores.txtCodPost.Enabled = True 'frmProveedores.txtTelefono.Enabled = True 'frmProveedores.ComboCategIva.Enabled = True 'frmProveedores.txtEmail.Enabled = True 'frmProveedores.txtCuit.Enabled = True 'frmProveedores.txtNombre.SetFocus frmProveedores.cmdBuscar.Visible = False frmProveedores.CmdContinuar.Visible = True frmProveedores.CmdActualizar.Visible = False frmProveedores.CmdCancelar.Visible = False frmProveedores.CmdModificar.Visible = True frmProveedores.CmdEliminar.Visible = True 'frmProveedores.cmdImprimir.Visible = True frmProveedores.Command1.Visible = True frmProveedores.CmdContinuar.SetFocus VerCuentaCorriente End If CerrarBase Unload Me End Sub Private Sub FiltrarHistoria() LimpioFlex AbrirBase Dim strSql As String strSql = "Select * From Proveedores Where ID BETWEEN " & Val(txtDesde) & " AND " & Val(txtHasta) & " ORDER BY ID Asc" rs.Open strSql, DB, adOpenKeyset, adLockOptimistic, adCmdText HacerLinea CerrarBase End Sub Private Sub dtp1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys ("{tab}") KeyAscii = 0 End If End Sub Private Sub txtHistoriaDesde_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys ("{tab}") KeyAscii = 0 End If End Sub Private Sub AceptarBuscar(ByVal txtBuscar As Variant) LimpioFlex AbrirBase Dim strSql As String strSql = "Select * From Proveedores" rs.Open strSql, DB, adOpenKeyset, adLockOptimistic, adCmdText Select Case comboCriterio.Text Case "Nombre" If txtBuscar <> "" Then rs.Filter = "Nombre LIKE '*" + txtBuscar + "*'" Else rs.Filter = "" End If Case "Codigo" If txtBuscar <> "" Then rs.Filter = "ID =" & Val(txtBuscar) Else rs.Filter = "" End If Case "Cuit" If txtBuscar <> "" Then rs.Filter = "Cuit LIKE '*" + txtBuscar + "*'" Else rs.Filter = "" End If Case Else End Select HacerLinea CerrarBase End Sub Private Sub dtp1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys ("{tab}") KeyAscii = 0 End If End Sub Private Sub txtHistoriaDesde_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys ("{tab}") KeyAscii = 0 End If End Sub Private Sub txtHistoriaHasta_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtBuscar.SetFocus 'SendKeys ("{tab}") KeyAscii = 0 End If End Sub Private Sub mnuImprimir_Click() If MsgBox("Imprimir Listado?", vbYesNo + vbInformation, "Impresin") = vbYes Th en 'IniciarImpresion End If End Sub Private Sub MSHFlexGrid1_DblClick() On Error Resume Next Dim nrolista As Long MSHFlexGrid1.Col = 0 nrolista = MSHFlexGrid1.Text 'frmClientes.txtCodDist.SetFocus Dim rs1 As New Recordset strSql = "Select * From Clientes Where ID=" & Val(nrolista) AbrirBase rs1.Open strSql, DB, adOpenKeyset, adLockOptimistic, adCmdText If Not rs.EOF Then 'traigo campos If frmFacturacion.Visible = True Then frmFacturacion.txtCodCliente = Val(nrolista) frmFacturacion.txtNombre = rs1!nombre frmFacturacion.txtDomicilio = rs1!domicilio frmFacturacion.txtTelefono = rs1!telefono frmFacturacion.ComboCategIva = rs1!categiva frmFacturacion.txtCuit = rs1!cuit 'Habilito desabilito frmFacturacion.txtCodCliente.Enabled = False frmFacturacion.txtNombre.Enabled = True frmFacturacion.txtDomicilio.Enabled = True frmFacturacion.txtTelefono.Enabled = True frmFacturacion.ComboCategIva.Enabled = True frmFacturacion.txtCuit.Enabled = True frmFacturacion.txtNombre.SetFocus frmFacturacion.txtCodArticulo.Enabled = True ElseIf frmOrdenPedido.Visible = True Then 'traigo campos frmOrdenPedido.txtCodCliente = Val(nrolista) frmOrdenPedido.txtNombre = rs1!nombre frmOrdenPedido.txtDomicilio = rs1!domicilio frmOrdenPedido.txtTelefono = rs1!telefono frmOrdenPedido.ComboCategIva = rs1!categiva frmOrdenPedido.txtCuit = rs1!cuit 'Habilito desabilito frmOrdenPedido.txtCodCliente.Enabled = False frmOrdenPedido.txtNombre.Enabled = True frmOrdenPedido.txtDomicilio.Enabled = True frmOrdenPedido.txtTelefono.Enabled = True frmOrdenPedido.ComboCategIva.Enabled = True frmOrdenPedido.txtCuit.Enabled = True frmOrdenPedido.txtNombre.SetFocus frmOrdenPedido.txtCodArticulo.Enabled = True ElseIf frmPresupuestos.Visible = True Then 'traigo campos frmPresupuestos.txtCodCliente = Val(nrolista) frmPresupuestos.txtNombre = rs1!nombre frmPresupuestos.txtDomicilio = rs1!domicilio frmPresupuestos.txtTelefono = rs1!telefono frmPresupuestos.ComboCategIva = rs1!categiva frmPresupuestos.txtCuit = rs1!cuit 'Habilito desabilito frmPresupuestos.txtCodCliente.Enabled = False frmPresupuestos.txtNombre.Enabled = True frmPresupuestos.txtDomicilio.Enabled = True frmPresupuestos.txtTelefono.Enabled = True frmPresupuestos.ComboCategIva.Enabled = True frmPresupuestos.txtCuit.Enabled = True frmPresupuestos.txtNombre.SetFocus frmPresupuestos.txtCodArticulo.Enabled = True End If End If CerrarBase Unload Me End Sub Private Sub ActualizarDescripcionEnPreciosClientes() strSql = "Select * From PreciosClientes Where CodArticulo=" & Val(txtID) Dim rs2 As New Recordset rs2.Open (strSql), DB, adOpenKeyset, adLockOptimistic, adCmdText If Not rs2.EOF Then While Not rs2.EOF rs2!Descripcion = txtDescripcion rs2!Marca = txtMarca rs2.MoveNext Wend End If End Sub '################# Habilitar / Deshabilitar ################ Private Sub HabilitarNuevo()
Dim saveNroSoc As Variant
saveNroSoc = txtID 'Primero vaco los controles For i = 1 To Me.Controls.Count - 1 If TypeOf Me.Controls(i) Is TextBox Then Me.Controls(i).Text = "" End If Next i txtID = saveNroSoc End Sub Private Sub HabilitarEdicion() ' Habilito todos los textBox For i = 1 To Me.Controls.Count - 1 If TypeOf Me.Controls(i) Is TextBox Then Me.Controls(i).Enabled = True End If Next i
txtExistencias.Enabled = False 'Habilito todos los Combobox
' For i = 1 To Me.Controls.Count - 1 ' If TypeOf Me.Controls(i) Is ComboBox Then ' Me.Controls(i).Enabled = True ' End If ' Next i
' Deshabilito el campo clave 'txtID.Enabled = False 'Y pongo el Foco en el Campo Nombre txtDescripcion.SetFocus BotoneraEdicion End Sub ' ################ G U A R D A R ############################# '############################################################## Private Sub Guardar() If txtID <> "" Then GuardarTodo End If End Sub Private Sub GuardarTodo() 'On Error GoTo Error_Guardar AbrirBase 'DB.BeginTrans ActualizarRegistro 'Error_Guardar: ' If Err.Number <> 0 Then ' DB.RollbackTrans ' MsgBox "Error: " & Err.Number & " - " & Err.Description ' CerrarBase ' Else ' DB.CommitTrans CerrarBase DeshabilitarEdicion ' End If RefreshGrid MSHFlexGrid1, "Articulos" End Sub Private Sub ActualizarRegistro() strSql = "SELECT * FROM Articulos WHERE ID =" & Val(txtID) rs.Open (strSql), DB, adOpenKeyset, adLockOptimistic, adCmdText 'Si no existe que lo agregue If rs.BOF And rs.EOF Then rs.AddNew GuardarRegistros ActualizarDescripcionEnPreciosClientes Else GuardarRegistros ActualizarDescripcionEnPreciosClientes End If End Sub Private Sub GuardarRegistros() On Error Resume Next rs!id = txtID 'rs!FechaAlta = dtp1 rs!Descripcion = IIf((txtDescripcion = ""), "---", txtDescripcion) rs!Marca = IIf((txtMarca = ""), "---", txtMarca) rs!Talle = IIf((txtTalle = ""), "---", txtTalle) rs!Precio = Val(txtPrecio) rs!PrecioProv = Val(txtPrecioProv) rs!Existencias = Val(txtExistencias) rs!StockMinimo = Val(txtStockMinimo) rs.Update End Sub Private Sub Modebarcode(cadena As String) Picture1.Cls Picture1.ScaleMode = 3 Picture1.Height = Picture1.Height * (2.4 * 40 / Picture1.ScaleHeight) Picture1.FontSize = 10 Call DrawBarcode(cadena, Picture1, txtMarca & " - " & txtTalle) Clipboard.Clear Clipboard.SetData Picture1.Image, 2 End Sub Private Sub GeneroBarCode(cadena As String) 'ModeFree3of9 cadena Modebarcode cadena End Sub Private Sub ModeFree3of9(cadena As String) cadena = "*" & cadena & "*" Text1 = "" Text1.Font.Name = "Free 3 of 9" Text1.Font.Size = 72 Text1 = cadena Text2 = cadena Clipboard.Clear Clipboard.SetText cadena End Sub Private Sub TraigoDatos() On Error Resume Next 'Traigo textos
txtID.Text = RTrim(rs!id) 'dtp1 = rs!FechaAlta txtDescripcion.Text = RTrim(rs!Descripcion) txtMarca.Text = RTrim(rs!Marca) txtTalle.Text = RTrim(rs!Talle) txtPrecio.Text = Replace(Format(rs!Precio, "fixed"), ",", ".") txtPrecioProv.Text = Replace(Format(rs!PrecioProv, "fixed"), ",", ".") txtExistencias = rs!Existencias txtStockMinimo = rs!StockMinimo End Sub Private Sub Aceptar(ByVal txtID As Variant) 'On Error GoTo Error_Guardar AbrirBase 'DB.BeginTrans AceptarRegistro 'Error_Guardar: ' If Err.Number <> 0 Then ' DB.RollbackTrans ' CerrarBase ' MsgBox "Error: " & Err.Number & " - " & Err.Description, vbCritical ' Else ' DB.CommitTrans CerrarBase HabilitarEdicion ' RellenoCombo ' End If End Sub Private Sub AceptarRegistro() Dim strSql As String strSql = "SELECT * FROM Articulos WHERE ID =" & Val(txtID) rs.Open (strSql), DB, adOpenKeyset, adLockOptimistic, adCmdText
' Si existe If Not (rs.BOF And rs.EOF) Then TraigoDatos 'GeneroBarCode Val(txtID) 'BotoneraExploracion Else 'HabilitarNuevo HabilitarEdicion PreparoTemplate End If End Sub Private Sub showMaster() Dim res As Recordset Dim rflag As Boolean Dim m As ListItem 'values for counting Dim countF As Integer Dim countcs As Integer Dim countIT As Integer Dim countDCET As Integer Dim countDEP As Integer Dim countNUR As Integer Dim countCCT As Integer Dim countHRM As Integer Dim countCoE As Integer Dim countOTher As Integer Set res = New Recordset Set Cmaster = New clsMaster rflag = Cmaster.getAllList(res) If rflag Then Do While Not (res.EOF Or res.BOF) Set m = Me.listStudents.ListItems.Add(, , res.Fields("Studentno")) m.SubItems(1) = res.Fields("Lname") m.SubItems(2) = res.Fields("Fname") m.SubItems(3) = res.Fields("MI") m.SubItems(4) = res.Fields("Sex") m.SubItems(5) = res.Fields("Address") m.SubItems(6) = res.Fields("Contactno") m.SubItems(7) = res.Fields("School") m.SubItems(8) = res.Fields("Course")
If res.Fields("sex") = "F" Then countF = countF + 1 End If
If res.Fields("Course") = "BSCS" Then countcs = countcs + 1 End If
If res.Fields("Course") = "BSIT" Then countIT = countIT + 1 End If
If res.Fields("Course") = "DEP" Then countDEP = countDEP + 1 End If
If res.Fields("Course") = "BSN" Then countNUR = countNUR + 1 End If
If res.Fields("Course") = "DCET" Then countDCET = countDCET + 1 End If
If res.Fields("Course") = "CCT" Then countCCT = countCCT + 1 End If
If res.Fields("Course") = "HRM" Then countHRM = countHRM + 1 End If
If res.Fields("Course") = "CoE" Then countCoE = countCoE + 1 End If
If res.Fields("Course") = "-" Then countOTher = countOTher + 1 End If