You are on page 1of 7

Private Sub ImpTitulos()

Titulo = "Lista de Precios"


'Imprime el Template de la hoja
Printer.ScaleMode = vbCentimeters
Printer.PaperSize = 9
Printer.Orientation = 1
Printer.FontName = "ARIAL"
Printer.DrawStyle = 0
Printer.Font.Size = 14
Printer.PaintPicture frmLogo.Picture1.Picture, 1, 1
Printer.Font.Size = 8
Printer.CurrentX = 18.8
Printer.CurrentY = 1
Printer.Print "Pgina " & Printer.Page
Printer.CurrentX = 18.5
Printer.CurrentY = 1.5
Printer.Print Date '& " " & Format(Time, "hh:nn am/pm")
Printer.CurrentX = 1
Printer.CurrentY = 2
'Printer.Print "TEL:4744-4416 - E-mail: dyvcom@hotmail.com"
Printer.Font.Size = 14
x = 21 / 2
Printer.CurrentX = x - (Printer.TextWidth(Titulo)) + (Printer.TextWidth(Titulo))
/ 2
Printer.CurrentY = 3
Printer.Print Titulo
Printer.Font.Size = 8
'LINEAS HORIZONTALES
Printer.Line (1, 3.9)-(20, 3.9)
Printer.Line (1, 29)-(20, 29)
'LINEAS VERTICALES
Printer.Line (1, 3.9)-(1, 29)
'Aqui codigo
Printer.Line (2, 3.9)-(2, 29)
'Aqui Descripcion
Printer.Line (9, 3.9)-(9, 29)
'Aqui colores
Printer.Line (13, 3.9)-(13, 29)
'Aqui Talles
'Printer.Line (16, 3.9)-(16, 29)
'Aqui p.unit
Printer.Line (18, 3.9)-(18, 29)
'Aqui p. docena
Printer.Line (20, 3.9)-(20, 29)
' TITULO DE LOS CAMPOS
Printer.CurrentY = 4
Printer.CurrentX = 1.2
Printer.Print "ART.";
Printer.CurrentX = 4.2
Printer.Print "DESCRIPCIN";
Printer.CurrentX = 10.2
Printer.Print "Color";
'
Printer.CurrentX = 13.9
Printer.Print "TALLES";
'
'Printer.CurrentX = 16.5
'Printer.Print "P/UNIT";
Printer.CurrentX = 18.3
Printer.Print "Precio U."
'Printer.CurrentX = 14
'Printer.Print "TotalVenta";
'Printer.CurrentX = 17.5
'Printer.Print "Costo.M.";
'Printer.CurrentX = 19.2
'Printer.Print "Utilidad"

Printer.Line (1, (Printer.CurrentY + espacioCelda))-(20, (Printer.CurrentY + esp
acioCelda))
End Sub
Private Sub ImprimirSeleccion()

' cd1.ShowPrinter


Dim rsArticulos As New Recordset
rsArticulos.CursorLocation = adUseClient


strSql = "Select * From Articulos ORDER BY ID"
rsArticulos.Open strSql, DB, adOpenDynamic, adLockOptimistic
ImpTitulos

ContRay = 0
ContLin = 0
espacioCelda = 0.4


Do While Not rsArticulos.EOF

If ContRay > 0 Then
Printer.CurrentY = Printer.CurrentY + espacioCelda
End If

Dim CadenaCod As String
Dim LongitudCod As Long
CadenaCod = Format(CadenaCod, "0###")
LongitudCod = Len(CadenaCod)
Printer.CurrentX = 1.8 + (Val(LongitudCod)) - (Printer.TextWidth(Format(rsArticu
los!id, "0###")))
Printer.Print Format(rsArticulos!id, "0###");

Printer.CurrentX = 2.1
Printer.Print Left(rsArticulos!Descripcion, 30);
Printer.CurrentX = 9.1
Printer.Print Left(rsArticulos!Marca, 30);
Printer.CurrentX = 13.1
Printer.Print Left(rsArticulos!Talle, 30);


Dim Cadena2 As String
Dim Longitud2 As Long
Cadena2 = Format(Cadena2, "#,###.#0")
Longitud2 = Len(Cadena2)
Printer.CurrentX = 19.3 + (Val(Longitud2)) - (Printer.TextWidth(Format(rsArticul
os!Precio, "#,###.#0")))
'Printer.CurrentX = 17.3 + (Val(Longitud2)) - (Printer.TextWidth(Format(rsArticu
los!Precio, "#,###.#0")))
Printer.Print Format(rsArticulos!Precio, "#,###.#0");
'Dim Cadena3 As String
'Dim Longitud3 As Long
'Cadena3 = Format(Cadena3, "#,###.#0")
'Longitud3 = Len(Cadena3)
'Printer.CurrentX = 19.3 + (Val(Longitud3)) - (Printer.TextWidth(Format(rsArticu
los!PrecioDocena, "#,###.#0")))
'Printer.Print Format(rsArticulos!PrecioDocena, "#,###.#0");
ContRay = ContRay + 1
ContLin = ContLin + 1

If Printer.CurrentY > 28 Then
Printer.NewPage
ImpTitulos
ContLin = 0
ContRay = 0
End If

If ContRay = 5 Then
'Printer.DrawStyle = 2
Printer.CurrentY = Printer.CurrentY + espacioCelda
' Printer.Line (1, Printer.CurrentY)-(20, Printer.CurrentY)
ContRay = 0
End If
rsArticulos.MoveNext
Loop
Printer.Line (1, Printer.CurrentY + espacioCelda)-(20, Printer.CurrentY + es
pacioCelda)
Printer.EndDoc
'MsgBox "Lista Imprimiendose", vbInformation
End Sub
Private Sub AceptarBuscar(ByVal txtBuscar As Variant)
LimpioFlex
Private Sub cmdBuscar_Click()
AceptarBuscar txtBuscar.Text
End Sub
Private Sub MSHFlexGrid1_Click()
MSHFlexGrid1.Col = 0
txtID = MSHFlexGrid1.Text
txtID.Locked = True
Aceptar txtID.Text
GeneroBarCode txtID
End Sub
'##################### IMPRESION #######################
Private Sub ImprimirListado()
AbrirBase
ImprimirSeleccion
CerrarBase
End Sub
AbrirBase
Dim strSql As String
strSql = "Select * From Articulos"
Dim rsRef As New Recordset
rsRef.Open strSql, DB, adOpenKeyset, adLockOptimistic, adCmdText
Select Case comboCriterio.Text
Case "Descripcion"
If txtBuscar <> "" Then
rsRef.Filter = "Descripcion LIKE '*" + txtBuscar + "*'"
End If
Case "Codigo"
If txtBuscar <> "" Then
rsRef.Filter = "ID =" & Val(txtBuscar)
End If
Case "Marca"
If txtBuscar <> "" Then
rsRef.Filter = "Marca LIKE '*" + txtBuscar + "*'"
End If
Case Else
rsRef.Filter = ""
End Select
Do While Not rsRef.EOF
i = i + 1

linea = rsRef!id _
& Chr(9) & rsRef!Descripcion _
& Chr(9) & rsRef!Marca _
& Chr(9) & rsRef!Talle _
& Chr(9) & Format(rsRef!Precio, "fixed") _
& Chr(9) & Format(rsRef!PrecioProv, "fixed") _
& Chr(9) & Val(rsRef!Existencias) _
& Chr(9) & Val(rsRef!StockMinimo) _
MSHFlexGrid1.AddItem linea, i
rsRef.MoveNext
Loop
lblTotalRef = rsRef.RecordCount
CerrarBase
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

You might also like