Sub basicmodeOpen (event)
myChildFrame1.show(TRUE)
enablek1 = 1
end sub	  

Sub basicmodeR (event)
frameReport.show(TRUE)
end sub
	  
Connect( myFrame, 8, wxEVT_COMMAND_MENU_SELECTED, "basicmodeOpen" ) 
Connect( myFrame, 5, wxEVT_COMMAND_MENU_SELECTED, "basicmodeR" ) 	  

Sub close2 (event)
frameReport.show(FALSE)
End sub

Sub closeAll (event)
myChildFrame1.destroy()
framereport.destroy()
myframe.destroy()
End sub

Sub tabletclose (event)
frame1.show(FALSE)
xTablet = 0
End Sub

Connect( myChildFrame1, wxEVT_CLOSE_WINDOW, "close1" )
Connect( frameReport, wxEVT_CLOSE_WINDOW, "close2" )
Connect( myFrame, wxEVT_CLOSE_WINDOW, "closeAll" )


Sub repMaker (event)
Option Explicit
Dim myDialog As wxDialog = New wxDirDialog( Nothing, "Seleccione un directorio:", "Directorios" )
If myDialog.ShowModal() = wxID_OK Then
   		empty = TextCtrl2R.GetValue() 
		If empty = "" Then
		Dim msg = "Debe establecer un nombre para el reporte."
    wxMessageBox( msg, "Error(noName) Softbeer.v.1.0", wxOK + wxICON_ERROR, myFrame )
		Else
		setval = myDialog.GetPath()
		Dim repFile as Variant
repFile = setval & "/" & TextCtrl2R.GetValue()
OPEN repFile FOR OUTPUT AS #1
PRINT #1, "Reporte BasicMode [Industrial & Homebrew]\n" & 
repFile & "\n\n" &
"Tabla de variables\n" &
"------------------------------------------------------------------------\n" &
"Grado Plato                        = " & P & "\n" &
"Gramos de lúpulo 1era adición      = " & IBU1 & "\n" &
"Gramos de lúpulo 2da adición       = " & IBU2 & "\n" &
"Gramos de lúpulo total             = " & IBUF & "\n" & 
"IBU Total:                         = " & IBUss &  "\n" & 
"Densidad después del hervor        = " & DI &   "\n" &
"Densidad antes del hervor          = " & DAH & "\n" &
"% de alcohol en volumen            = " & VALP & "\n" &
"Cantidad de mosto antes del hervor = " & VAH & "\n" &
"Cantidad de agua para el empaste   = " & VEM & "\n" &
"Pérdidas post-hervor en volumen    = " & PPH & "\n" &
"------------------Cereales y/o adjuntos----------------------------\n" &
"Cebada   = " & C & "/   Rendimiento    = " & RC & "\n" &
"Trigo    = " & T & "/   Rendimiento    = " & RT & "\n" &
"Maíz     = " & M & "/   Rendimiento    = " & RM & "\n" &
"Arroz    = " & A & "/   Rendimiento    = " & RA & "\n" &
"Azúcar   = " & R & "/   Rendimiento    = " & RR & "\n" &
"------------------------------------------------------------------------\n" &
"Reporte generado por Softbeer 1.0\n" & 
"------------------------------------------------------------------------\n" 
CLOSE #1

		Dim msg1 = "Reporte generado correctamente."
		wxMessageBox( msg1, "Información", wxOK + wxICON_INFORMATION, myFrame )
		control.LoadFile( repFile )
		control.SetSelection(1,1)
		frameprev.Show(TRUE)
		TextCtrl2R.SetValue("")
		frameReport.show(FALSE)
		End If
		End If

myDialog.Finalize() : myDialog = Nothing
End Sub

Sub calcIBU (event)
if IbuAct = 0 then
wxMessageBox("Primero debe calcular el proceso.")
end If

if IbuAct = 1 then
If VDH = 0 Then
VDH = 1
End If
        AAP = val(TextCtrl15.GetValue())
        AAS = val(TextCtrl19.GetValue())
        IBUp = val(TextCtrl14.GetValue())
        IBUs = val(TextCtrl17.GetValue())
        PAP = val(TextCtrl16.GetValue())
        PAS = val(TextCtrl18.GetValue())
		Dim compIBU =  PAP * AAP
		Dim compIBU1 =  PAS * AAS
		If compIBU > 0 then
		IBU1 = calclass.GIbu(IBUp, PAP, AAP, VDH, DI)
		End If
		If compIBU1 > 0 then
		IBU2 = calclass.GIbu(IBUs, PAS, AAS, VDH, DI)
		End If
		IBUF = IBU1 + IBU2
        IBuss = IBUp + IBUs    
		ListControl.SetStringItem(4,1,IBUss)
        ListControl.SetStringItem(2,1,IBU1)
		ListControl.SetStringItem(3,1,IBU2)
		ListControl.SetStringItem(1,1,IBUF)
End If
End Sub

Connect( Checkbox2, -1, wxEVT_COMMAND_CHECKBOX_CLICKED, "onCheck2" ) 
Connect( Checkbox3, -1, wxEVT_COMMAND_CHECKBOX_CLICKED, "onCheck3" )
Connect( Checkbox4, -1, wxEVT_COMMAND_CHECKBOX_CLICKED, "onCheck4" )
Connect( Checkbox5, -1, wxEVT_COMMAND_CHECKBOX_CLICKED, "onCheck5" )
Connect( Checkbox1, -1, wxEVT_COMMAND_CHECKBOX_CLICKED, "onCheck1" )
Connect( Checkbox6, -1, wxEVT_COMMAND_CHECKBOX_CLICKED, "onCheck6" )


Connect( Button3, wxEVT_COMMAND_BUTTON_CLICKED, "tablet" )
Connect( Button4, wxEVT_COMMAND_BUTTON_CLICKED, "tablet" )
Connect( Button2R, wxEVT_COMMAND_BUTTON_CLICKED, "repMaker")
Connect( frame1, wxEVT_CLOSE_WINDOW, "tabletclose" )
Connect( Button3R, wxEVT_COMMAND_BUTTON_CLICKED, "close2")
Connect( ButtonIBU, wxEVT_COMMAND_BUTTON_CLICKED, "calcIBU")