Dim rot as Variant 
Dim TableOut[12]
dim frameOUT as wxMDIChildFrame = new wxMDIChildFrame(myFrame, -1, "Pérdidas post-hervor", wxPoint(-1, -1), wxSize(233, 316), wxCAPTION | wxSYSTEM_MENU | wxMINIMIZE_BOX ) 
frameOUT.show(FALSE)
Dim panelOUT as wxPanel = new wxPanel(frameOUT, -1) ,
ButtonO1 as wxButton = new wxButton(panelOUT, 2,"&Calcular", wxPoint(145, 250), wxSize(72, 24)),
TextCtrlO1 as wxTextCtrl = new wxTextCtrl(panelOUT, 3,"Hervor - Decantación", wxPoint(8, 56), wxSize(96, 24)),
TextCtrlO2 as wxTextCtrl = new wxTextCtrl(panelOUT, 4,"Decantación - Fermentador", wxPoint(8, 88), wxSize(96, 24)),
TextCtrlO3 as wxTextCtrl = new wxTextCtrl(panelOUT, 5,"Fermentador - Carbonatación", wxPoint(8, 120), wxSize(96, 24)),
TextCtrlO4 as wxTextCtrl = new wxTextCtrl(panelOUT, 6,"Carbonatación - Envase", wxPoint(8, 152), wxSize(96, 24)),
TextCtrlO5 as wxTextCtrl = new wxTextCtrl(panelOUT, 7,"Otras", wxPoint(8, 184), wxSize(96, 24)),
TextCtrlO6 as wxTextCtrl = new wxTextCtrl(panelOUT, 8,"Otras", wxPoint(8, 216), wxSize(96, 24)),
StaticTextO1 as wxStaticText = new wxStaticText(panelOUT, 9,"Pérdidas en:", wxPoint(8, 32), wxSize(56, 16)),
StaticTextO2 as wxStaticText = new wxStaticText(panelOUT, 10,"% [Ej: 10]", wxPoint(120, 32), wxSize(80, 16)),
TextCtrlO7 as wxTextCtrl = new wxTextCtrl(panelOUT, 11,"2", wxPoint(120, 56), wxSize(96, 24)),
TextCtrlO8 as wxTextCtrl = new wxTextCtrl(panelOUT, 12,"2", wxPoint(120, 88), wxSize(96, 24)),
TextCtrlO9 as wxTextCtrl = new wxTextCtrl(panelOUT, 13,"2", wxPoint(120, 120), wxSize(96, 24)),
TextCtrlO10 as wxTextCtrl = new wxTextCtrl(panelOUT, 14,"2", wxPoint(120, 152), wxSize(96, 24)),
TextCtrlO11 as wxTextCtrl = new wxTextCtrl(panelOUT, 15,"1", wxPoint(120, 184), wxSize(96, 24)),
TextCtrlO12 as wxTextCtrl = new wxTextCtrl(panelOUT, 16,"1", wxPoint(120, 216), wxSize(96, 24))
ButtonO1.setDefault()

Dim myBmpP As wxEmptyBitmap = New wxEmptyBitmap( 0, 0 )
myBmpP.LoadFile( RPath & "/" & "pdeclare.sbi" , wxBITMAP_TYPE_PNG )
Dim imgP = New wxBitmapButton( panelOUT, -1, myBMPP, wxPoint(-1, -1), wxSize(-1, -1), wxNO_3D )


Sub outw (event)
Dim msgPREVENT1 as Variant
X = val(TextCtrl1.GetValue()) 
if ComboBox2.getValue() = "Galón" Then
X = X/0.2642008
End If
if ComboBox2.getValue() = "Pinta" Then
X = X/2.1141649
End If
if ComboBox2.getValue() = "Quart" Then
X = X/1.0570825
End If

TableOut[1] = TextCtrlO1.getvalue() : TableOut[7] = val(TextCtrlO7.getvalue())
TableOut[2] = TextCtrlO2.getvalue() : TableOut[8] = val(TextCtrlO8.getvalue())
TableOut[3] = TextCtrlO3.getvalue() : TableOut[9] = val(TextCtrlO9.getvalue())
TableOut[4] = TextCtrlO4.getvalue() : TableOut[10] = val(TextCtrlO10.getvalue())
TableOut[5] = TextCtrlO4.getvalue() : TableOut[11] = val(TextCtrlO11.getvalue())
TableOut[6] = TextCtrlO6.getvalue() : TableOut[12] = val(TextCtrlO12.getvalue())

PER = X/((100-TableOut[7])/100)/((100-TableOut[8])/100)/((100-TableOut[9])/100)/((100-TableOut[10])/100)/((100-TableOut[11])/100)/((100-TableOut[12])/100)	
		
		PPH = int((PER - X)*100)/100
		WW = val(TextCtrl2.GetValue()) 
        VDH = PER 
        VAH = ((VDH) / ((100 - WW) / 100))

        C = val(TextCtrl5.GetValue())
        M = val(TextCtrl9.GetValue())
        T = val(TextCtrl7.GetValue())
        A = val(TextCtrl11.GetValue())
        R = val(TextCtrl13.GetValue())
        msgPREVENT1 = X + PER + WW + C + M + T + A + R
		
		IF msgPREVENT1 = 0 then
         wxMessageBox("Porfavor, introduzca valores.")
		end if
		
		if msgPREVENT1 > 0 then
		if combobox1.getvalue() = "lb" then
		A = A/2.203
		C = C/2.203
		M = M/2.203
		T = T/2.203
		R = R/2.203
		End If
		if combobox1.getvalue() = "g" then
		A = A/1000
		C = C/1000
		M = M/1000
		T = T/1000
		R = R/1000
		End If
		if combobox1.getvalue() = "onza" then
		A = A/35.2734
		C = C/35.2734
		M = M/35.2734
		T = T/35.2734
		R = R/35.2734
		End If
		if combobox1.getvalue() = "T" then
		A = A*1000
		C = C*1000
		M = M*1000
		T = T*1000
		R = R*1000
		End If
		
		IbuAct = 1
		CCR = A + C + M + T + R
        REP = 4 
        VEM = int((CCR * REP)*100) /100 
		
		VEM1 = Int(VEM * 100) / 100
        VAH1 = Int(VAH * 100) / 100

        RC = val(TextCtrl4.GetValue())
        RM = val(TextCtrl8.GetValue())
        RT = val(TextCtrl6.GetValue())
        RA = val(TextCtrl10.GetValue())
        RR = val(TextCtrl12.GetValue())
		
If VDH = 0 Then
VDH = 1
End If
        P = (((C * (RC / 100)) + (M * (RM / 100)) + (T * (RM / 100)) + (A * (RA / 100)) + (R * (RR / 100))) * 100) / VDH
        VEM1 = Int(VEM * 100) / 100
        PAH = (((C * (RC / 100)) + (M * (RM / 100)) + (T * (RM / 100)) + (A * (RA / 100)) + (R * (RR / 100))) * 100) / VAH
        P1 = Int(P * 100) / 100
      
		PF = ((((C * (RC / 100)) * 0.64) + ((M * (RM / 100)) * 0.64) + ((T * (RM / 100)) * 0.64) + ((A * (RA / 100)) * 0.64) + ((R * (RR / 100)) * 0.99))*100)  / VDH
        PFIN = P - PF
        DI = (P * 4) + 1000 : DF = (PFIN * 4) + 1000 : DAH = (PAH * 4) + 1000
        VALP = Int(((DI - DF) * 0.13125) * 100) / 100
        		
ListControl.SetStringItem(0,1,P1) 
ListControl.SetStringItem(5,1,int(DI*100)/100)
ListControl.SetStringItem(6,1,int(DAH*100)/100)
ListControl.SetStringItem(7,1,VALP)
ListControl.SetStringItem(8,1, VAH1)
ListControl.SetStringItem(9,1, VEM)
ListControl.SetStringItem(10,1,PPH)
myMenu1.Enable(5,TRUE) 
				
		end if
End Sub

Sub outSHOW (event)
frameOUT.activate()
frameOUT.center()
frameOUT.show(TRUE)
End Sub

Sub closeOUT (event)
frameOUT.show(FALSE)
End Sub

Sub close1 (event)
myMenu1.Enable(5,FALSE)
myChildFrame1.show(FALSE)
frameReport.show(FALSE)
frame1.show(FALSE)
frameOUT.show(FALSE)
Enablek1 = 0
End sub

Connect( ButtonO1, wxEVT_COMMAND_BUTTON_CLICKED, "outw")
Connect( frameOUT, wxEVT_CLOSE_WINDOW, "closeOUT" )
Connect( Button2, wxEVT_COMMAND_BUTTON_CLICKED, "outSHOW" )

