Beruflich Dokumente
Kultur Dokumente
Count
columna = 1
ProgressBar1.Value = 0
For Each dr In ds.Tables(0).Rows
columna = 1
For Each dc In ds.Tables(0).Columns
objHojaExcel.Range(nombreColumna(columna) & fila).Value = dr(dc.
ColumnName)
columna += 1
Next
fila += 1
ProgressBar1.Value += 1
Next
'//////////////////////////////////////
'// Ajustamos automaticamente el ancho
'// de todas las columnas utilizada
'//////////////////////////////////////
objRango = objHojaExcel.Range("A1:" & nombreColumna(ds.Tables(0).Columns
.Count) & ds.Tables(0).Rows.Count.ToString)
objRango.Select()
objRango.Columns.AutoFit()
'/////////////////////////////////////////////
'// Le damos formato a la fila de los ttulos
'/////////////////////////////////////////////
Dim objRango As Excel.Range = objHojaExcel.Range("A1:" & nombreColumna(d
s.Tables(0).Columns.Count) & "1")
objRango.Font.Bold = True
objRango.Cells.Interior.ColorIndex = 35
objRango.Cells.Borders(Excel.XlBordersIndex.xlDiagonalDown).LineStyle =
Excel.XlLineStyle.xlLineStyleNone
objRango.Cells.Borders(Excel.XlBordersIndex.xlDiagonalUp).LineStyle = Ex
cel.XlLineStyle.xlLineStyleNone
objRango.Cells.Borders(Excel.XlBordersIndex.xlEdgeLeft).LineStyle = Exce
l.XlLineStyle.xlLineStyleNone
objRango.Cells.Borders(Excel.XlBordersIndex.xlEdgeRight).LineStyle = Exc
el.XlLineStyle.xlContinuous
objRango.Cells.Borders(Excel.XlBordersIndex.xlEdgeTop).LineStyle = Excel
.XlLineStyle.xlContinuous
objRango.Cells.Borders(Excel.XlBordersIndex.xlEdgeBottom).LineStyle = Ex
cel.XlLineStyle.xlContinuous
'//////////////////////////////////////////
'// Cargamos todas las filas del datatable
'//////////////////////////////////////////
'/////////////////////////////////////////////////////////
'// Definimos dos variables para controlar fila y columna
'/////////////////////////////////////////////////////////
Dim fila As Integer = 1
Dim columna As Integer = 1
'/////////////////////////////////////////////////
'// Armamos la linea con los ttulos de columnas
'/////////////////////////////////////////////////
objHojaExcel.Range("A1").Select()
For Each dc In ds.Tables(0).Columns
Y = Printer.CurrentY
Printer.CurrentX = 3.9 * TW - Printer.TextWidth(Left(RS1!Descripcion, 25))
Printer.Print Left(RS1!Descripcion, 25)
Printer.CurrentY = Y
If RS1!cantidad - Int(RS1!cantidad) <> 0 Then
Printer.CurrentX = 4.9 * TW - Printer.TextWidth(Format(RS1!cantidad, "##,##0.00"
))
Printer.Print Format(RS1!cantidad, "##,##0.0")
Else
Printer.CurrentX = 4.9 * TW - Printer.TextWidth(Format(RS1!cantidad, "##,##0.00"
))
Printer.Print Format(RS1!cantidad, "##,##0")
End If
Printer.CurrentY = Y
Printer.CurrentX = 5.5 * TW - Printer.TextWidth(Format(RS1!Precio, "##,##0.00"))
Printer.Print Format(RS1!Precio, "##,##0.00")
Printer.CurrentY = Y
Printer.CurrentX = 7 * TW - Printer.TextWidth(Format(RS1!total, "##,##0.00"))
Printer.Print Format(RS1!total, "##,##0.00")
Suma = Suma + RS1!total
RS1.MoveNext
Wend
'------------------------------------------------------------------'Imprime el pie del ticket
'------------------------------------------------------------------Printer.Print ""
Y = Printer.CurrentY
Printer.CurrentY = Y
Y = Printer.CurrentY
Printer.FontBold = True
Printer.FontSize = 10
Printer.CurrentX = 7 * TW - Printer.TextWidth("Total iva includo " & Format(Suma,
"##,##0.00"))
Printer.Print "Total iva includo " & Format(Suma, "##,##0.00")
Printer.FontBold = False
Printer.FontSize = 7
Printer.Print
Printer.CurrentX = (7 * TW - Printer.TextWidth(Saludo)) / 2
Printer.Print Saludo
Printer.Print ""
Printer.CurrentX = (7 * TW - Printer.TextWidth("Telfono +34 942.213.066")) / 2
Printer.Print "Telfono +34 942.213.066"
Printer.CurrentX = (7 * TW - Printer.TextWidth(" Fax +34 942.032.617")) / 2
Printer.Print " Fax +34 942.032.617"
Printer.CurrentX = (7 * TW - Printer.TextWidth("restaurante@mesongoya.com")) / 2
Printer.Print "restaurante@mesongoya.com"
Printer.CurrentX = (7 * TW - Printer.TextWidth("www.mesongoya.com")) / 2
Printer.Print "www.mesongoya.com"
Printer.Print ""
Printer.Print ""
Printer.Print ""
Printer.Print ""
Printer.Print ""
Printer.Print ""
Printer.Print ""
Printer.Print ""
Printer.Print ""
Printer.Print ""
Printer.Print ""
Printer.CurrentX = (7 * TW - Printer.TextWidth(".")) / 2
Printer.Print "."
Printer.EndDoc
Next i
Printer.EndDoc
CamareroNum = 0
lblSumaTicket.Caption = ""
ApagaTodo
Exit Sub
ErrHandler:
' El usuario ha hecho clic en el botn Cancelar
Exit Sub
End Sub
i = 1: j = 0
Do While Not rs.EOF
'Format(flex.TextMatrix(flex.Row, 2), "#,###,###,#0.00")
flex.TextMatrix(i, j) = rs!branc
flex.TextMatrix(i, j + 1) = rs!n_ofici
flex.TextMatrix(i, j + 2) = Format(rs!PAG_U + rs!PAG_C + rs!PAG_N +
rs!PAG_CH + rs!PAG_R + rs!PAG_M + rs!PAG_E, "#,###,###,#0.00")
'flex.TextMatrix(i, j + 3) = rs!INVPU + rs!INVPC + rs!INVPN + rs!INV
PCH + rs!INVPR + rs!INVPM + rs!INVPE
'flex.TextMatrix(i, j + 4) = Format$(rs!PAG_Up + rs!PAG_Cp + rs!PAG_
Np + rs!PAG_CHp + rs!PAG_Rp + rs!PAG_Mp + rs!PAG_Ep, "0.00")
'flex.TextMatrix(i, j + 5) = rs!INVPU + rs!INVPCp + rs!INVPNp + rs!I
NVPCHp + rs!INVPRp + rs!INVPMp + rs!INVPEp
'flex.TextMatrix(i,
'flex.TextMatrix(i,
'flex.TextMatrix(i,
'flex.TextMatrix(i,
'flex.TextMatrix(i,
'flex.TextMatrix(i,
'flex.TextMatrix(i,
'flex.TextMatrix(i,
'flex.TextMatrix(i,
'flex.TextMatrix(i,
'flex.TextMatrix(i,
'flex.TextMatrix(i,
'flex.TextMatrix(i,
'flex.TextMatrix(i,
j
j
j
j
j
j
j
j
j
j
j
j
j
j
+
+
+
+
+
+
+
+
+
+
+
+
+
+
6) = Format$(rs!PAG_U, "0.00")
7) = rs!INVPU
8) = Format$(rs!PAG_C, "0.00")
9) = rs!INVPC
10) = Format$(rs!PAG_E, "0.00")
11) = rs!INVPE
12) = Format$(rs!PAG_N, "0.00")
13) = rs!INVPN
14) = Format$(rs!PAG_CH, "0.00")
15) = rs!INVPCH
16) = Format$(rs!PAG_R, "0.00")
17) = rs!INVPR
18) = Format$(rs!PAG_M, "0.00")
19) = rs!INVPM
'flex.TextMatrix(i, j
'flex.TextMatrix(i,
'flex.TextMatrix(i,
'flex.TextMatrix(i,
'flex.TextMatrix(i,
'flex.TextMatrix(i,
'flex.TextMatrix(i,
'flex.TextMatrix(i,
'flex.TextMatrix(i,
'flex.TextMatrix(i,
'flex.TextMatrix(i,
'flex.TextMatrix(i,
+
j
j
j
j
j
j
j
j
j
j
j
20) =
+ 21)
+ 22)
+ 23)
+ 24)
+ 25)
+ 26)
+ 27)
+ 28)
+ 29)
+ 30)
+ 31)
Format$(rs!PAG_Up, "0.00")
= rs!INVPUp
= Format$(rs!PAG_Cp, "0.00")
= rs!INVPCp
= Format$(rs!PAG_Ep, "0.00")
= rs!INVPEp
= Format$(rs!PAG_Np, "0.00")
= rs!INVPNp
= Format$(rs!PAG_CHp, "0.00")
= rs!INVPCHp
= Format$(rs!PAG_Rp, "0.00")
= rs!INVPRp
Screen.MousePointer = vbHourglass
' Deshabilita el repintado del Flexgrid
MSFlexGrid1.Redraw = False
' Mueve el recordset al primer registro
Rs.MoveFirst