VERSION 5.00
Begin VB.Form frmTotal 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Total"
   ClientHeight    =   6735
   ClientLeft      =   4350
   ClientTop       =   6840
   ClientWidth     =   10350
   Icon            =   "frmTotal.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Moveable        =   0   'False
   ScaleHeight     =   449
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   690
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton Command1 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   24
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1215
      Left            =   6720
      Picture         =   "frmTotal.frx":0E42
      Style           =   1  'Graphical
      TabIndex        =   26
      Top             =   5400
      Width           =   1215
   End
   Begin VB.CommandButton Comma 
      Caption         =   "00"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1215
      Left            =   8880
      TabIndex        =   24
      Top             =   3840
      Width           =   1215
   End
   Begin VB.CommandButton bNumero 
      Caption         =   "0"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1215
      Index           =   0
      Left            =   7680
      TabIndex        =   13
      Top             =   3840
      Width           =   1215
   End
   Begin VB.CommandButton bNumero 
      Caption         =   "3"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1215
      Index           =   3
      Left            =   8880
      TabIndex        =   16
      Top             =   2640
      Width           =   1215
   End
   Begin VB.CommandButton bNumero 
      Caption         =   "2"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1215
      Index           =   2
      Left            =   7680
      TabIndex        =   15
      Top             =   2640
      Width           =   1215
   End
   Begin VB.CommandButton bNumero 
      Caption         =   "1"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1215
      Index           =   1
      Left            =   6480
      TabIndex        =   14
      Top             =   2640
      Width           =   1215
   End
   Begin VB.CommandButton bNumero 
      Caption         =   "6"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1215
      Index           =   6
      Left            =   8880
      TabIndex        =   19
      Top             =   1440
      Width           =   1215
   End
   Begin VB.CommandButton bNumero 
      Caption         =   "5"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1215
      Index           =   5
      Left            =   7680
      TabIndex        =   18
      Top             =   1440
      Width           =   1215
   End
   Begin VB.CommandButton bNumero 
      Caption         =   "4"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1215
      Index           =   4
      Left            =   6480
      TabIndex        =   17
      Top             =   1440
      Width           =   1215
   End
   Begin VB.CommandButton bNumero 
      Caption         =   "9"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1215
      Index           =   9
      Left            =   8880
      TabIndex        =   22
      Top             =   240
      Width           =   1215
   End
   Begin VB.CommandButton bNumero 
      Caption         =   "8"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1215
      Index           =   8
      Left            =   7680
      TabIndex        =   21
      Top             =   240
      Width           =   1215
   End
   Begin VB.CommandButton bNumero 
      Caption         =   "7"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1215
      Index           =   7
      Left            =   6480
      TabIndex        =   20
      Top             =   240
      Width           =   1215
   End
   Begin VB.Frame Frame3 
      Caption         =   "ENTREGADO"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2640
      TabIndex        =   12
      Top             =   1800
      Width           =   3615
   End
   Begin VB.Frame Frame2 
      Caption         =   "TOTAL"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2640
      TabIndex        =   11
      Top             =   0
      Width           =   3615
   End
   Begin VB.Frame Frame1 
      Caption         =   "FALTAN"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2640
      TabIndex        =   10
      Top             =   3600
      Width           =   3615
   End
   Begin VB.CommandButton btnCancelar 
      Cancel          =   -1  'True
      Height          =   1215
      Left            =   8640
      Picture         =   "frmTotal.frx":5984
      Style           =   1  'Graphical
      TabIndex        =   6
      Top             =   5400
      Width           =   1215
   End
   Begin VB.CommandButton btnImprimir 
      Caption         =   "Imprimir Ticket"
      Default         =   -1  'True
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   21.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1215
      Left            =   2640
      TabIndex        =   5
      Top             =   5400
      Width           =   3615
   End
   Begin VB.CommandButton btnDinero 
      Caption         =   "5"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   1.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1335
      Index           =   4
      Left            =   120
      Picture         =   "frmTotal.frx":649D
      Style           =   1  'Graphical
      TabIndex        =   4
      Top             =   5280
      Width           =   2415
   End
   Begin VB.CommandButton btnDinero 
      Caption         =   "10"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   1.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1335
      Index           =   3
      Left            =   120
      Picture         =   "frmTotal.frx":745F
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   3960
      Width           =   2415
   End
   Begin VB.CommandButton btnDinero 
      Caption         =   "20"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   1.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1335
      Index           =   2
      Left            =   120
      Picture         =   "frmTotal.frx":86A1
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   2640
      Width           =   2415
   End
   Begin VB.CommandButton btnDinero 
      Caption         =   "50"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   1.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1335
      Index           =   1
      Left            =   120
      Picture         =   "frmTotal.frx":99CC
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   1320
      Width           =   2415
   End
   Begin VB.CommandButton btnDinero 
      Caption         =   "100"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   1.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1335
      Index           =   0
      Left            =   120
      Picture         =   "frmTotal.frx":A9DE
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   0
      Width           =   2415
   End
   Begin VB.Frame Frame4 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   5295
      Left            =   6360
      TabIndex        =   23
      Top             =   0
      Width           =   3855
      Begin VB.CommandButton DEL 
         Caption         =   "<<"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   36
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1215
         Left            =   120
         TabIndex        =   25
         TabStop         =   0   'False
         Top             =   3840
         Width           =   1215
      End
   End
   Begin VB.Label LCambio 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00000000&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "0"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   48
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   1215
      Left            =   2640
      TabIndex        =   7
      ToolTipText     =   "Cambio"
      Top             =   4080
      Width           =   3615
   End
   Begin VB.Label LRecibido 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00000000&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "0"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   48
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FF00&
      Height          =   1215
      Left            =   2640
      TabIndex        =   9
      Top             =   2280
      Width           =   3615
   End
   Begin VB.Label LTotal 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00000000&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "0"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   48
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FF00&
      Height          =   1215
      Left            =   2640
      TabIndex        =   8
      Top             =   480
      Width           =   3615
   End
End
Attribute VB_Name = "frmTotal"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public billetes As Double
Public dinero As Double


Private Sub bNumero_Click(Index As Integer)
    dinero = (dinero * 10) + ((bNumero(Index).Caption) / 100)
    LRecibido = billetes + dinero
    
End Sub

Private Sub btnCancelar_Click()
    Unload Me
End Sub

Private Sub btnDinero_Click(Index As Integer)
    billetes = billetes + CDbl(btnDinero(Index).Caption)
'    LRecibido = LRecibido + CDbl(btnDinero(Index).Caption)
    LRecibido = billetes + dinero
    LCambio = LTotal - LRecibido
End Sub


Private Sub btnImprimir_Click()

           
    If Frame1.Caption = "CAMBIO" Then
        

        
        
        
      
       
        
        If MesaActual < 60 Then ' si es una mesa
        If mesa(MesaActual, 0, 2) = 1 Then
        mesa(MesaActual, 0, 2) = 0
        
        
        
                Open "COM3" For Output As #1
       
       ' Open Printer.Port For Output As #1
        
        Print #1, Chr(27) + Chr(112) + Chr(0) + Chr(40) + Chr(40) 'Abrir cajon
        
        Close #1
        
        ' Introducir datos en la base de datos
        Dim j As Integer
        For j = 0 To Panel.MSFlexGrid1.Rows - 1
        Do While Panel.MSFlexGrid1.TextMatrix(j, 0) > 0
            Panel.Data1.Recordset.AddNew
            Panel.Data1.Recordset.Fields(1) = Panel.MSFlexGrid1.TextMatrix(j, 1)
            Panel.Data1.Recordset.Fields(2) = Panel.MSFlexGrid1.TextMatrix(j, 2)
            Panel.Data1.Recordset.Fields(3) = j + 1
            Panel.Data1.Recordset.Fields(4) = Panel.MSFlexGrid1.TextMatrix(j, 3) 'nombre
            Panel.Data1.Recordset.Fields(5) = Panel.MSFlexGrid1.TextMatrix(j, 4)
            Panel.Data1.Recordset.Fields(6) = Panel.MSFlexGrid1.TextMatrix(j, 6)
             
             If Panel.Mesa2 = "B" Then
              Panel.Data1.Recordset.Fields(7) = 60 '60 es el valor que toma cuando es en barra
            Else
             Panel.Data1.Recordset.Fields(7) = Panel.Mesa2 'almancena numero de mesa
            End If
    
            Panel.Data1.UpdateRecord
            Panel.Data1.Refresh
            'Panel.Data1.Recordset.MoveLast
                Panel.MSFlexGrid1.TextMatrix(j, 0) = Panel.MSFlexGrid1.TextMatrix(j, 0) - 1
            Loop
        Next j
        
        'aumentar numero de ticket para el siguiente
        If Panel.MSFlexGrid1.Rows <> 0 Then
            ticket = ticket + 1
        End If
        Panel.Label1.Caption = ticket
        
             'pone lista a cero
          actualizalista
          
            'vaciar array de la mesa de productos
            For I = 0 To 999
                mesa(MesaActual, I, 0) = 0
            Next I
    '     Panel.lblMesa(MesaActual - 1).Visible = False
        
        Else
        
        ImprimirTicketMesa
      
        mesa(MesaActual, 0, 2) = 1
        End If
        
        Else ' si es en barra
        
        ImprimirTicket
        
                ' Introducir datos en la base de datos
       ' Dim j As Integer
        For j = 0 To Panel.MSFlexGrid1.Rows - 1
        Do While Panel.MSFlexGrid1.TextMatrix(j, 0) > 0
            Panel.Data1.Recordset.AddNew
            Panel.Data1.Recordset.Fields(1) = Panel.MSFlexGrid1.TextMatrix(j, 1)
            Panel.Data1.Recordset.Fields(2) = Panel.MSFlexGrid1.TextMatrix(j, 2)
            Panel.Data1.Recordset.Fields(3) = j + 1
            Panel.Data1.Recordset.Fields(4) = Panel.MSFlexGrid1.TextMatrix(j, 3) 'nombre
            Panel.Data1.Recordset.Fields(5) = Panel.MSFlexGrid1.TextMatrix(j, 4)
            Panel.Data1.Recordset.Fields(6) = Panel.MSFlexGrid1.TextMatrix(j, 6)
             
             If Panel.Mesa2 = "B" Then
              Panel.Data1.Recordset.Fields(7) = 60 '60 es el valor que toma cuando es en barra
            Else
             Panel.Data1.Recordset.Fields(7) = Panel.Mesa2 'almancena numero de mesa
            End If
    
            Panel.Data1.UpdateRecord
            Panel.Data1.Refresh
            'Panel.Data1.Recordset.MoveLast
                Panel.MSFlexGrid1.TextMatrix(j, 0) = Panel.MSFlexGrid1.TextMatrix(j, 0) - 1
            Loop
        Next j
        
                'aumentar numero de ticket para el siguiente
        If Panel.MSFlexGrid1.Rows <> 0 Then
            ticket = ticket + 1
        End If
        Panel.Label1.Caption = ticket
        
             'pone lista a cero
          actualizalista
          
            'vaciar array de la mesa de productos
            For I = 0 To 999
                mesa(MesaActual, I, 0) = 0
            Next I
    '     Panel.lblMesa(MesaActual - 1).Visible = False
        
        End If
        
        Unload Me
        

    
    End If
End Sub





Private Sub comma_Click()
    dinero = (dinero * 100)
    LRecibido = billetes + dinero

End Sub

Private Sub Command1_Click()
    billetes = 0
    dinero = 0
            LRecibido = billetes + dinero

End Sub

Private Sub DEL_Click()
    dinero = (Int(dinero * 10)) / 100
        LRecibido = billetes + dinero

End Sub

Private Sub Form_Load()
    billetes = 0
    dinero = 0
End Sub

Private Sub LCambio_Change()

    
    If CDbl(LTotal) <= CDbl(LRecibido) Then
        
        LCambio.ForeColor = &HFF00&
        Frame1.Caption = "CAMBIO"
        btnImprimir.Enabled = True
        
    
    Else
        Frame1.Caption = "FALTAN"
        btnImprimir.Enabled = False
        LCambio.ForeColor = &HFF&
    End If
    
    
        LCambio = (Format(Abs(LCambio), "###0.00")) '"###0.00")

'     LCambio = Abs(LCambio)
     
End Sub

Private Sub LTotal_Change()
     LTotal = Format(LTotal, "###0.00") '"###0.00")

End Sub


Private Sub LRecibido_Change()
    LCambio = LTotal - LRecibido

    LRecibido = Format(LRecibido, "###0.00") '"###0.00")

End Sub

