Anda di halaman 1dari 6

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



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

Anda mungkin juga menyukai