@@ -66,11 +66,10 @@ public class Billing extends Stage {
66
66
TextField search = new TextField ("Search Appointments" );
67
67
68
68
//Buttons
69
- Button addBilling = new Button ("Add Bill" );
70
69
Button refreshTable = new Button ("Refresh Appointments" );
71
70
//Containers
72
71
HBox searchContainer = new HBox (choiceBox , search );
73
- HBox buttonContainer = new HBox (addBilling , refreshTable , searchContainer );
72
+ HBox buttonContainer = new HBox (refreshTable , searchContainer );
74
73
VBox tableContainer = new VBox (table , buttonContainer );
75
74
76
75
//</editor-fold>
@@ -107,12 +106,7 @@ public void handle(ActionEvent e) {
107
106
// addAppointment();
108
107
// }
109
108
// });
110
- addBilling .setOnAction (new EventHandler <ActionEvent >() {
111
- @ Override
112
- public void handle (ActionEvent e ) {
113
- addBilling ();
114
- }
115
- });
109
+
116
110
refreshTable .setOnAction (new EventHandler <ActionEvent >() {
117
111
@ Override
118
112
public void handle (ActionEvent e ) {
@@ -193,13 +187,13 @@ private void loadCenter() {
193
187
delAppt .setCellValueFactory (new PropertyValueFactory <>("placeholder1" ));
194
188
makePayment .setCellValueFactory (new PropertyValueFactory <>("button" ));
195
189
//Set Column Widths
196
- apptIDCol .prefWidthProperty ().bind (table .widthProperty ().multiply (0.05 ));
197
- patientIDCol .prefWidthProperty ().bind (table .widthProperty ().multiply (0.04 ));
190
+ apptIDCol .prefWidthProperty ().bind (table .widthProperty ().multiply (0.09 ));
191
+ patientIDCol .prefWidthProperty ().bind (table .widthProperty ().multiply (0.09 ));
198
192
firstNameCol .prefWidthProperty ().bind (table .widthProperty ().multiply (0.1 ));
199
193
timeCol .prefWidthProperty ().bind (table .widthProperty ().multiply (0.06 ));
200
194
orderCol .prefWidthProperty ().bind (table .widthProperty ().multiply (0.2 ));
201
- updateAppt .prefWidthProperty ().bind (table .widthProperty ().multiply (0.1 ));
202
- status .prefWidthProperty ().bind (table .widthProperty ().multiply (0.1 ));
195
+ updateAppt .prefWidthProperty ().bind (table .widthProperty ().multiply (0.08 ));
196
+ status .prefWidthProperty ().bind (table .widthProperty ().multiply (0.08 ));
203
197
totalCost .prefWidthProperty ().bind (table .widthProperty ().multiply (0.1 ));
204
198
205
199
//Add columns to table
@@ -303,10 +297,6 @@ private void logOut() {
303
297
// }
304
298
//On button press, open up a new stage (calls private nested class)
305
299
306
- private void addBilling () {
307
-
308
- }
309
-
310
300
private float calculateTotalCost (Appointment appt ) {
311
301
312
302
String sql = "Select orderCodes.cost "
@@ -352,16 +342,18 @@ private void viewBill(Appointment appt) {
352
342
// code goes here
353
343
//header
354
344
HBox header = new HBox ();
355
- Label patientName = new Label (appt .getFullName ());
356
- Label patientEmail = new Label (getEmail (appt .getPatientID ()));
357
- Label patientAddress = new Label (getAddress (appt .getPatientID ()));
358
- Label patientInsurance = new Label (getInsurance (appt .getPatientID ()));
345
+ Label patientName = new Label ("Patient Name: \n " + appt .getFullName ());
346
+ Label patientEmail = new Label ("Email: \n " + getEmail (appt .getPatientID ()));
347
+ Label patientAddress = new Label ("Address: \n " + getAddress (appt .getPatientID ()));
348
+ Label patientInsurance = new Label ("Insurance: \n " + getInsurance (appt .getPatientID ()));
359
349
header .getChildren ().addAll (patientName , patientEmail , patientAddress , patientInsurance );
360
350
bp .setTop (header );
361
351
//end header
362
352
//center
363
353
float paybox = 0 ;
364
354
GridPane grid = new GridPane ();
355
+ grid .setGridLinesVisible (true );
356
+
365
357
VBox center = new VBox (grid );
366
358
ScrollPane sp = new ScrollPane (center );
367
359
String order [] = appt .getOrder ().split ("," );
@@ -375,7 +367,8 @@ private void viewBill(Appointment appt) {
375
367
paybox += a .getCost ();
376
368
}
377
369
}
378
- HBox he = new HBox (tempOrder , tempCost );
370
+ Label apptDate = new Label (appt .getTime ().split (" " )[0 ]);
371
+ grid .add (apptDate , 1 , i );
379
372
grid .add (tempOrder , 0 , i );
380
373
grid .add (tempCost , 2 , i );
381
374
counter = i ;
@@ -389,7 +382,22 @@ private void viewBill(Appointment appt) {
389
382
byWhom .setText ("Insurance Paid" );
390
383
}
391
384
Label tempPaymentDate = new Label (p .getTime ());
392
- Label tempPayment = new Label ("" + p .getPayment ());
385
+ float num = -1 * p .getPayment ();
386
+ String positive = "" ;
387
+ if (num > 0 ) {
388
+ positive = "+" ;
389
+ }
390
+ Label tempPayment = new Label (positive + num );
391
+ if (num > 0 ) {
392
+ byWhom .setId ("shadeRed" );
393
+ tempPaymentDate .setId ("shadeRed" );
394
+ tempPayment .setId ("shadeRed" );
395
+ } else {
396
+ byWhom .setId ("shadeGreen" );
397
+ tempPaymentDate .setId ("shadeGreen" );
398
+ tempPayment .setId ("shadeGreen" );
399
+
400
+ }
393
401
394
402
grid .add (byWhom , 0 , counter );
395
403
grid .add (tempPaymentDate , 1 , counter );
@@ -400,10 +408,29 @@ private void viewBill(Appointment appt) {
400
408
bp .setCenter (sp );
401
409
//end center
402
410
//footer
411
+ Button btn = new Button ("Go Back" );
412
+ btn .setId ("cancel" );
413
+ btn .setOnAction (new EventHandler <ActionEvent >() {
414
+ @ Override
415
+ public void handle (ActionEvent eh ) {
416
+ x .close ();
417
+ }
418
+ });
419
+ Button btn1 = new Button ("Make Payment" );
420
+ btn1 .setId ("complete" );
421
+ btn1 .setOnAction (new EventHandler <ActionEvent >() {
422
+ @ Override
423
+ public void handle (ActionEvent eh ) {
424
+ makePayment (appt );
425
+ x .close ();
426
+ viewBill (appt );
427
+ }
428
+ });
403
429
HBox footer = new HBox ();
404
430
Label blank = new Label ("Total Bill Remaining: " );
405
431
Label tc = new Label ("" + paybox );
406
- footer .getChildren ().addAll (blank , tc );
432
+
433
+ footer .getChildren ().addAll (btn , blank , tc , btn1 );
407
434
bp .setBottom (footer );
408
435
//end footer
409
436
x .show ();
@@ -561,7 +588,6 @@ private void makePayment(Appointment appt) {
561
588
Button b = new Button ("Submit" );
562
589
hello .getChildren ().addAll (enterpay , ep , dropdown , b );
563
590
container .getChildren ().addAll (hello );
564
- x .show ();
565
591
b .setOnAction (new EventHandler <ActionEvent >() {
566
592
@ Override
567
593
public void handle (ActionEvent eh ) {
@@ -581,6 +607,7 @@ public void handle(ActionEvent eh) {
581
607
//sql = "INSERT INTO patientPayments(apptID, time, patientPayment, byPatient) VALUES ('"+appt.getApptID()+"', '"+LocalDate.now() +"' , '"+ep.getText()+"', '1' )";
582
608
}
583
609
});
610
+ x .showAndWait ();
584
611
}
585
612
586
613
private void removeAppointment (Appointment appt ) {
0 commit comments