-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnitFormSelectores.cpp
135 lines (112 loc) · 4.82 KB
/
UnitFormSelectores.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "UnitFormSelectores.h"
#include "UnitDatos.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TFormSelectores *FormSelectores;
static int id_equipo=0;
static double pto_total = 0, tmax;
//---------------------------------------------------------------------------
__fastcall TFormSelectores::TFormSelectores(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TFormSelectores::ComboBox_EquiposChange(TObject *Sender)
{
id_equipo = ComboBox_Equipos->ItemIndex;
LeerArchivoTodo();
Edit_Temp1->Text = equipo[id_equipo].sel_tiempo1;
Edit_PiezasNegras->Text = equipo[id_equipo].sel_piezas_negras;
Edit_PiezasBlancas->Text = equipo[id_equipo].sel_piezas_blancas;
Edit_SalComp->Text = equipo[id_equipo].sel_sal_completa;
Edit_SalBox->Text = equipo[id_equipo].sel_boxes;
Edit_SalCompBox->Text = equipo[id_equipo].sel_completa_and_boxes;
Label_PtoTot->Caption = equipo[id_equipo].sel_puntos;
if(equipo[id_equipo].sel_snitch_dorada==1) CheckBoxSnitch->Checked = True;
else CheckBoxSnitch->Checked = False;
}
//---------------------------------------------------------------------------
void __fastcall TFormSelectores::Button_guardarClick(TObject *Sender)
{
equipo[id_equipo].sel_tiempo1 = Edit_Temp1->Text.ToDouble();
equipo[id_equipo].sel_piezas_negras = Edit_PiezasNegras->Text.ToInt();
equipo[id_equipo].sel_piezas_blancas = Edit_PiezasBlancas->Text.ToInt();
equipo[id_equipo].sel_sal_completa = Edit_SalComp->Text.ToInt();
equipo[id_equipo].sel_boxes = Edit_SalBox->Text.ToInt();
equipo[id_equipo].sel_completa_and_boxes = Edit_SalCompBox->Text.ToInt();
if (CheckBoxSnitch->Checked) equipo[id_equipo].sel_snitch_dorada = 1;
else equipo[id_equipo].sel_snitch_dorada = 0;
equipo[id_equipo].sel_puntos = pto_total;
equipo[id_equipo].SumPuntosTotal();
GuardarArchivoTodo();
//ShowMessage("Datos guardados!");
}
//---------------------------------------------------------------------------
void __fastcall TFormSelectores::UpDownPiezasBlancasChangingEx(TObject *Sender, bool &AllowChange,
int NewValue, TUpDownDirection Direction)
{
Edit_PiezasBlancas->Text = NewValue;
}
//---------------------------------------------------------------------------
void __fastcall TFormSelectores::UpDownSalCompChangingEx(TObject *Sender, bool &AllowChange,
int NewValue, TUpDownDirection Direction)
{
Edit_SalComp->Text = NewValue;
}
//---------------------------------------------------------------------------
void __fastcall TFormSelectores::UpDownSalBoxChangingEx(TObject *Sender, bool &AllowChange,
int NewValue, TUpDownDirection Direction)
{
Edit_SalBox->Text = NewValue;
}
//---------------------------------------------------------------------------
void __fastcall TFormSelectores::UpDownBoxCompChangingEx(TObject *Sender, bool &AllowChange,
int NewValue, TUpDownDirection Direction)
{
Edit_SalCompBox->Text = NewValue;
}
//---------------------------------------------------------------------------
void __fastcall TFormSelectores::UpDownPiezasNegrasChangingEx(TObject *Sender, bool &AllowChange,
int NewValue, TUpDownDirection Direction)
{
Edit_PiezasNegras->Text = NewValue;
}
//---------------------------------------------------------------------------
void __fastcall TFormSelectores::Button_calcClick(TObject *Sender)
{
static int piezas_negras, piezas_blancas, sal_completa, boxes, completa_and_boxes, snitch_dorada;
static double tiempo1;
piezas_negras = Edit_PiezasNegras->Text.ToInt();
tiempo1 = Edit_Temp1->Text.ToDouble();
piezas_blancas = Edit_PiezasBlancas->Text.ToInt();
sal_completa = Edit_SalComp->Text.ToInt();
boxes = Edit_SalBox->Text.ToInt();
completa_and_boxes = Edit_SalCompBox->Text.ToInt();
if (CheckBoxSnitch->Checked) snitch_dorada = 1;
else snitch_dorada = 0;
tmax = LabeledEditTmax->Text.ToDouble();
if ((pto_total = 70*((tmax)/20)*(piezas_negras/tiempo1) + snitch_dorada*20 - piezas_blancas*2 - sal_completa*3 - boxes*4 - completa_and_boxes*5) > 70)
pto_total = 70;
if(pto_total < 0)
pto_total = 0;
Label_PtoTot->Caption = pto_total;
Edit_PtoTot->Text = pto_total;
}
//---------------------------------------------------------------------------
void __fastcall TFormSelectores::Button_ExitClick(TObject *Sender)
{
FormSelectores->Close();
}
//---------------------------------------------------------------------------
void __fastcall TFormSelectores::ButtonPtoClick(TObject *Sender)
{
pto_total = Edit_PtoTot->Text.ToDouble();
equipo[id_equipo].sel_puntos = pto_total;
equipo[id_equipo].SumPuntosTotal();
GuardarArchivoTodo();
}
//---------------------------------------------------------------------------