Skip to content

Commit d04e0da

Browse files
committed
creados projectos
1 parent ab3ddb3 commit d04e0da

12 files changed

+485
-49
lines changed
4.3 KB
Binary file not shown.
4.17 KB
Binary file not shown.

src/electricity_bills_system/BillSearch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class BillSearch extends JFrame implements ActionListener {
2121
this.NIF=NIF;
2222
this.ID_USER=ID_USER;
2323

24-
setContentPane(new BackgroundPanel("images/Fichas3.jpg"));
24+
setContentPane(new BackgroundPanel("images/Fichas3.png"));
2525
setLayout(new BorderLayout());
2626
Font fuente=new Font("Roboto", Font.PLAIN, 20);
2727
Font fuente2=new Font("Roboto", Font.PLAIN, 15);

src/electricity_bills_system/CalculateProject.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ public class CalculateProject extends JFrame implements ActionListener {
3838
this.ID_USER = ID_USER;
3939
this.PROYECTO = PROYECTO;
4040
setContentPane(new BackgroundPanel("images/Fichas3.png"));
41-
42-
for(int i=0;i<PROYECTO.length;i++){
43-
System.out.println(PROYECTO[i]);
44-
}
45-
41+
4642
JPanel panel = new JPanel(new GridBagLayout());
4743
panel.setOpaque(false);
4844
GridBagConstraints gbc = new GridBagConstraints();
@@ -537,7 +533,8 @@ public void actionPerformed(ActionEvent ae){
537533
String bill_true="bill";
538534

539535
if(ae.getSource()==materiales_agregar){
540-
new MaterialFrame(ID,client,NIF,ID_USER);
536+
String clase="proyecto";
537+
new MaterialFrame(ID,client,NIF,ID_USER,clase,PROYECTO);
541538
setVisible(false);
542539
}
543540

src/electricity_bills_system/MaterialFrame.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,19 @@ public class MaterialFrame extends JFrame implements ActionListener {
2525
JLabel total_materiales,numero_parte;
2626
double total_final=0;
2727
double numero_parte2;
28-
String selectedID,ID_info,client_info,NIF,ID_USER;
28+
String selectedID,ID_info,client_info,NIF,ID_USER,Clase;
2929
boolean existe=true;
30+
String[] PROYECTO;
3031

31-
public MaterialFrame(String ID_info, String client_info,String NIF,String ID_USER) {
32+
public MaterialFrame(String ID_info, String client_info,String NIF,String ID_USER,String Clase,String[] PROYECTO) {
3233
super("Añadir Materiales");
3334
setLayout(new BorderLayout());
3435
this.ID_info = ID_info;
3536
this.client_info = client_info;
3637
this.NIF = NIF;
3738
this.ID_USER = ID_USER;
39+
this.Clase = Clase;
40+
this.PROYECTO = PROYECTO;
3841
Color gris=new Color(210,210,210);
3942

4043
JPanel inputPanel = new JPanel(new GridBagLayout());
@@ -421,9 +424,13 @@ public void actionPerformed(ActionEvent e) {
421424
} catch (Exception ea) {
422425
ea.printStackTrace();
423426
}
424-
if(ID_info.length()>1){
427+
428+
if(ID_info.length()>1 && !Clase.equals("proyecto")){
425429
new calculateBill(ID_info, client_info,NIF,ID_USER);
426430
}
431+
if(Clase.equals("proyecto")){
432+
new CalculateProject(ID_info, client_info,NIF,ID_USER,PROYECTO);
433+
}
427434
}else if (e.getSource() == salir){
428435
setVisible(false);
429436

@@ -433,6 +440,6 @@ public void actionPerformed(ActionEvent e) {
433440

434441

435442
public static void main(String[] args) {
436-
new MaterialFrame("","","","");
443+
new MaterialFrame("","","","","",new String[] {});
437444
}
438445
}

src/electricity_bills_system/PayBill.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public class PayBill extends JFrame implements ActionListener {
3131
ArrayList<String> NUMBERa = new ArrayList<>();
3232
ArrayList<String> NAMEa = new ArrayList<>();
3333
ArrayList<String> ADDRESSa = new ArrayList<>();
34+
ArrayList<String> STATUSa = new ArrayList<>();
3435
ArrayList<String> HOURa = new ArrayList<>();
3536
ArrayList<String> NUMBERPa = new ArrayList<>();
3637
ArrayList<String> TOTALMa = new ArrayList<>();
@@ -193,7 +194,7 @@ public void actionPerformed(ActionEvent e) {
193194
gbc.gridy = 7;
194195
inputPanel.add(salir, gbc);
195196

196-
String[] columnNames = {"Nº Factura","Nombre", "Direccion","Horas","Nº Parte Material","Total Material","Total Factura"};
197+
String[] columnNames = {"Nº Factura","Nombre", "Direccion","Estado","Horas","Nº Parte Material","Total Material","Total Factura"};
197198
tableModel = new DefaultTableModel(columnNames, 0);
198199
tabla_cliente = new JTable(tableModel);
199200
JScrollPane scrollPane = new JScrollPane(tabla_cliente);
@@ -263,6 +264,7 @@ public void actionPerformed(ActionEvent ae) {
263264
TOTALa.clear();
264265
IDa.clear();
265266
CODEa.clear();
267+
STATUSa.clear();
266268
boolean datos=true;
267269
try{
268270

@@ -288,10 +290,10 @@ public void actionPerformed(ActionEvent ae) {
288290
filtro4=" AND DATE LIKE '%-"+YEAR+"'";
289291
}
290292

291-
String query="SELECT NUMBER_FACTURA,NAME,ADDRESS,HOUR,NUMBER_MATERIAL,TOTAL_MATERIAL,TOTAL_BILL,ID_CLIENT,CODE FROM bill_standard where NIF='"+NIF+"'"+filtro1+filtro2+filtro3+filtro4;
293+
String query="SELECT NUMBER_FACTURA,NAME,ADDRESS,HOUR,NUMBER_MATERIAL,TOTAL_MATERIAL,TOTAL_BILL,ID_CLIENT,CODE,STATUS FROM bill_standard where NIF='"+NIF+"'"+filtro1+filtro2+filtro3+filtro4;
292294

293295
if(ID_CLIENT.equals("Cualquiera") && !NAME.equals("todos")){
294-
query="SELECT NUMBER_FACTURA,NAME,ADDRESS,HOUR,NUMBER_MATERIAL,TOTAL_MATERIAL,TOTAL_BILL,ID_CLIENT,CODE FROM bill_standard where NIF='"+NIF+"' AND NAME LIKE '"+NAME+"%'"+filtro2+filtro3+filtro4;
296+
query="SELECT NUMBER_FACTURA,NAME,ADDRESS,HOUR,NUMBER_MATERIAL,TOTAL_MATERIAL,TOTAL_BILL,ID_CLIENT,CODE,STATUS FROM bill_standard where NIF='"+NIF+"' AND NAME LIKE '"+NAME+"%'"+filtro2+filtro3+filtro4;
295297
ID_choice.setEnabled(true);
296298
}
297299
ResultSet rs = c.s.executeQuery(query);
@@ -311,6 +313,7 @@ public void actionPerformed(ActionEvent ae) {
311313
String total = rs.getString("TOTAL_BILL");
312314
String idclient = rs.getString("ID_CLIENT");
313315
String code2=rs.getString("CODE");
316+
String estado2=rs.getString("STATUS");
314317

315318
NUMBERa.add(number_factura);
316319
NAMEa.add(name);
@@ -321,6 +324,7 @@ public void actionPerformed(ActionEvent ae) {
321324
TOTALa.add(total);
322325
IDa.add(idclient);
323326
CODEa.add(code2);
327+
STATUSa.add(estado2);
324328

325329
} while (rs.next());
326330
rs.close();
@@ -341,12 +345,13 @@ public void actionPerformed(ActionEvent ae) {
341345
String number2=" "+NUMBERa.get(i);
342346
String nombre2 =" "+ NAMEa.get(i);
343347
String direccion2 =" "+ ADDRESSa.get(i);
348+
String estado2 =" "+ STATUSa.get(i);
344349
String horas2 =" "+ HOURa.get(i);
345350
String numero_material2 =" "+ NUMBERPa.get(i);
346351
String total_material2 =" "+ TOTALMa.get(i);
347352
String total2 =" "+ TOTALa.get(i);
348353

349-
tableModel.addRow(new Object[]{number2,nombre2, direccion2, horas2, numero_material2, total_material2, total2});
354+
tableModel.addRow(new Object[]{number2,nombre2, direccion2,estado2, horas2, numero_material2, total_material2, total2});
350355
}
351356
}
352357

src/electricity_bills_system/Project.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
public class Project extends JFrame implements ActionListener{
99
JMenuItem cliente,generar,material,factura_detalle,cliente_detalles, factura,cliente_modificar,salir;
10-
JMenuItem pago,Finanzas,clientes_grafico,calculo;
10+
JMenuItem pago,Finanzas,clientes_grafico,calculo,buscar_proyecto;
1111
String NIF,ID_USER;
1212
JMenuBar navegador;
1313
boolean visible=true;
@@ -119,20 +119,8 @@ public class Project extends JFrame implements ActionListener{
119119
accion.add(factura_detalle);
120120
factura_detalle.addActionListener(this);
121121

122-
JMenu add_accion=new JMenu("Añadir ");
123-
add_accion.setFont(menufont);
124-
ImageIcon icon5= new ImageIcon(ClassLoader.getSystemResource("images/add.png"));
125-
Image image5 = icon5.getImage().getScaledInstance(22, 22, Image.SCALE_DEFAULT);
126-
add_accion.setIcon(new ImageIcon(image5));
127-
navegador.add(add_accion);
128122

129123

130-
JMenuItem nota=new JMenuItem("Añadir notas ");
131-
nota.setFont(menufont);
132-
nota.setMnemonic('N');
133-
nota.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK));
134-
add_accion.add(nota);
135-
136124
JMenu proyectos=new JMenu("Proyecto ");
137125
proyectos.setFont(menufont);
138126
ImageIcon icon6= new ImageIcon(ClassLoader.getSystemResource("images/proyecto.png"));
@@ -154,6 +142,13 @@ public class Project extends JFrame implements ActionListener{
154142
calculo.addActionListener(this);
155143
proyectos.add(calculo);
156144

145+
buscar_proyecto=new JMenuItem("Buscar Proyecto");
146+
buscar_proyecto.setFont(menufont);
147+
buscar_proyecto.setMnemonic('L');
148+
buscar_proyecto.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK));
149+
buscar_proyecto.addActionListener(this);
150+
proyectos.add(buscar_proyecto);
151+
157152
salir=new JMenuItem("Salir ");
158153
salir.setFont(menufont);
159154
salir.setMnemonic('S');
@@ -176,7 +171,7 @@ public void actionPerformed(ActionEvent ae){
176171
new calculateBill("","",NIF,ID_USER);
177172
}
178173
if(ae.getSource()==material){
179-
new MaterialFrame("","",NIF,ID_USER);
174+
new MaterialFrame("","",NIF,ID_USER,"",new String[0]);
180175
}
181176
if(ae.getSource()==factura_detalle){
182177
new BillSearch(NIF,ID_USER);
@@ -196,6 +191,9 @@ public void actionPerformed(ActionEvent ae){
196191
if(ae.getSource()==calculo){
197192
new SaveProject(NIF, ID_USER);
198193
}
194+
if(ae.getSource()==buscar_proyecto){
195+
new ProjectSearch(NIF, ID_USER);
196+
}
199197
if(ae.getSource()==clientes_grafico){
200198
new GraphClient(NIF, ID_USER);
201199
}

0 commit comments

Comments
 (0)