.


:




:

































 

 

 

 


Java




:

,

;

;

;

%;

%;

. %;

. %;

.

NetBeans IDE 8.1., MySQL Workbench 6.2

1. MySQL Workbench. Navigartor, , Create Scheme.

.1.1.

 

.1.1.

(.1.2), . Apply.

 

.1.2.

Navigator , , ..

2. : , , .

3. , 2.1. .. Tables / Create Table


.2.1.

 

4. , . employees. .2.2.

.2.2.

id_employees INT
surname VARCHAR
name VARCHAR
date DATE
address VARCHAR
phone VARCHAR
email VARCHAR
post_id INT

 

 

5. : posts, grafik. 2.2,2.3

2.2. .

idposts INT
post_id VARCHAR
wage VARCHAR

 

2.3. .

idgrafik INT
employer_id VARCHAR
postid VARCHAR
wtime TINYINT
premia INT

 

6. . , - , . , , .

, MySQL :

employees

Foreign Keys

Foreign Key Name

(.2.4)

.2.4.

 

Foreign Key Options, / , .. , , .

Apply

7. .

Java

1. NetBeans

2. , (.2.5)

.2.5. Java

3. . JFrame. -> JFrame .2.6.

.2.6.

4. (.2.7.) .

.2.7.

 

5. , .2.8. .

.2.8.

. JXDatePicker ( ) :

a. -> -> Swing/AWT

b. JAR

c. , NetBeans.

[NETBEANS HOME]\ide\modules\ext swingx-x.x.x.jar ( NetBeans)

d. JXDatePicker

 

e. Swing,

 

 

f.

 

 

6. .

7. . , MySQL

Select

8. .

9. .

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

try {

Integer ktime = Integer.parseInt(ktimeField.getText());

Integer prof_souz = Integer.parseInt(souzField.getText());

Integer prof_vznos = Integer.parseInt(vznosField.getText());

Integer soc_fond = Integer.parseInt(fondField.getText());

ResultSet rs = connection.select("a.employer_id, a.wtime, a.premia, b.wage,d.surname,d.name", "grafik as a, posts as b, employees as d", "a.postid = b.idposts and a.employer_id = d.id_employees");

 

DefaultTableModel dtm = new DefaultTableModel();

int i=0;

while(rs.next()){

String id = rs.getString("employer_id");

String surname = rs.getString("surname");

String name = rs.getString("name");

Double oklad = rs.getDouble("wage");

Integer premia = rs.getInt("premia");

Integer wtime = rs.getInt("wtime");

Double a = (oklad / ktime)*wtime;

Double b = (a * premia)/100;

Double k = (a+b);

Double psouz = (k * prof_souz)/100;

Double pvznos = (k * prof_vznos)/100;

Double sfond = (k * soc_fond)/100;

Double c = psouz + pvznos + sfond;

Double wage = k-c;

 

String row[] = {"","",".",".",".","" };

dtm.setColumnIdentifiers(row);

dtm.setColumnCount(6);

dtm.setRowCount(i+1);

dtm.setValueAt(i+1, i, 0);

dtm.setValueAt(surname + " " + name, i, 1);

dtm.setValueAt(Math.round(sfond), i, 2);

dtm.setValueAt(Math.round(psouz), i, 3);

dtm.setValueAt(Math.round(pvznos), i, 4);

dtm.setValueAt(Math.round(wage), i, 5);

i++;

}

 

}

rs.close();

ds.close();

} catch (Exception e) {

}

 

}

// : . ., .

. .

.





:


: 2016-11-20; !; : 1358 |


:

:

! . .
==> ...

1672 - | 1465 -


© 2015-2024 lektsii.org - -

: 0.024 .