Skip to content

Commit

Permalink
New Layout for Card printing!
Browse files Browse the repository at this point in the history
- Orientation changed to landscape from potrait
- Removed DOB to be searched in Old-Visitor Checkin
- Added Validity and Location Labels (Implementation Pending)
  • Loading branch information
iamKunal committed Mar 14, 2017
1 parent 21012c5 commit bcad8e4
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 38 deletions.
Binary file added images/iit_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/visMan/OldUser.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<Font name="System Bold" size="15.0" />
</font>
</Label>
<DatePicker fx:id="dateOfBirth" maxWidth="1.7976931348623157E308" promptText="01/01/1990" GridPane.columnIndex="2" GridPane.rowIndex="2" />
<DatePicker fx:id="dateOfBirth" disable="true" maxWidth="1.7976931348623157E308" promptText="01/01/1990" GridPane.columnIndex="2" GridPane.rowIndex="2" />
<Label text="Contact Number" GridPane.rowIndex="3">
<font>
<Font name="System Bold" size="15.0" />
Expand Down
12 changes: 8 additions & 4 deletions src/visMan/OldUserController.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private void checkValuesSearch(){
correct&=(!nameField.getText().trim().isEmpty());
// correct&=(!Utils.getToggleText(gender).equals("null"));
correct&=(!contactField.getText().trim().isEmpty());
correct&=!(dateOfBirth.getValue()==null);
// correct&=!(dateOfBirth.getValue()==null);
// correct&=(!addressField.getText().trim().isEmpty());
// correct&=(!Utils.getToggleText(category).equals("null"));
// correct&=(!purposeField.getText().trim().isEmpty());
Expand Down Expand Up @@ -142,7 +142,7 @@ public void openCaptureWindow(ActionEvent event) throws Exception{
public void searchUID(ActionEvent event) {
CheckIn ch = new CheckIn();
trimAll();
currentVisitor = new Visitor(nameField.getText(),"",contactField.getText(),dateOfBirth.getValue().toString(),"","","");
currentVisitor = new Visitor(nameField.getText(),"",contactField.getText(),"","","","");
Visitor tempVisitor = ch.alreadyInserted(currentVisitor);
if(tempVisitor==null){
errorLabel.setText("UID not Found. Please enter correct details\nor Checkin as New User.");
Expand All @@ -151,6 +151,8 @@ public void searchUID(ActionEvent event) {
uidField.setDisable(false);
uidField.setText(String.format("%09d", tempVisitor.getuID()));
currentVisitor.setuID(tempVisitor.getuID());
dateOfBirth.setDisable(false);
dateOfBirth.setValue(LocalDate.parse(tempVisitor.getDateOfBirth()));
addressField.setDisable(false);
addressField.setText(tempVisitor.getAddress());
toggleBox.setDisable(false);
Expand Down Expand Up @@ -225,6 +227,8 @@ public void reviewAndPrint(ActionEvent event) {
public void cancelExecute(ActionEvent event) {
if(!uidField.isDisabled()){
uidField.setText("");
dateOfBirth.setValue(null);
addressField.setDisable(true);
category.selectToggle(null);
uidField.setDisable(true);
addressField.setText("");
Expand Down Expand Up @@ -300,8 +304,8 @@ public void changed(ObservableValue<? extends String> observable, String oldValu
if(ChronoUnit.DAYS.between(newValue,localDate)<0 || ChronoUnit.YEARS.between(newValue,localDate)>150)
dateOfBirth.setValue(localDate);
}
errorLabel.setText("");
checkValuesSearch();
// errorLabel.setText("");
checkValues();
});

addressField.textProperty().addListener(new ChangeListener<String>() {
Expand Down
117 changes: 87 additions & 30 deletions src/visMan/PrintUserCard.fxml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.Cursor?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.Label?>
Expand All @@ -21,13 +22,13 @@
<children>
<BorderPane AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<center>
<SplitPane fx:id="printableRegionRoot" dividerPositions="0.5" maxHeight="720.0" maxWidth="480.0" minHeight="720.0" minWidth="480.0" orientation="VERTICAL" prefHeight="720.0" prefWidth="480.0">
<SplitPane fx:id="printableRegionRoot" dividerPositions="0.5" maxHeight="480.0" maxWidth="720.0" minHeight="480.0" minWidth="720.0" mouseTransparent="true" pickOnBounds="false" prefHeight="480.0" prefWidth="720.0" BorderPane.alignment="CENTER">
<items>
<AnchorPane minHeight="0.0" minWidth="480.0" prefHeight="0.0" prefWidth="480.0">
<AnchorPane>
<children>
<BorderPane prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<BorderPane AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<center>
<GridPane alignment="CENTER">
<GridPane alignment="CENTER" maxHeight="100.0" maxWidth="360.0" minHeight="0.0" minWidth="0.0" prefWidth="360.0">
<columnConstraints>
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0" />
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" minWidth="10.0" prefWidth="240.0" />
Expand All @@ -42,80 +43,136 @@
<Label text="Name :">
<font>
<Font name="System Bold" size="15.0" />
</font></Label>
</font>
</Label>
<Label fx:id="nameField" text="name" GridPane.columnIndex="1">
<GridPane.margin>
<Insets left="5.0" />
</GridPane.margin></Label>
</GridPane.margin>
</Label>
<Label text="Age :" GridPane.rowIndex="1">
<font>
<Font name="System Bold" size="15.0" />
</font></Label>
</font>
</Label>
<Label fx:id="ageField" text="age" GridPane.columnIndex="1" GridPane.rowIndex="1">
<GridPane.margin>
<Insets left="5.0" />
</GridPane.margin></Label>
</GridPane.margin>
</Label>
<Label text="Contact Number :" GridPane.rowIndex="2">
<font>
<Font name="System Bold" size="15.0" />
</font></Label>
</font>
</Label>
<Label fx:id="contactField" text="contact" GridPane.columnIndex="1" GridPane.rowIndex="2">
<GridPane.margin>
<Insets left="5.0" />
</GridPane.margin></Label>
</GridPane.margin>
</Label>
<Label text="Purpose of Visit :" GridPane.rowIndex="3">
<font>
<Font name="System Bold" size="15.0" />
</font></Label>
</font>
</Label>
<Label fx:id="purposeField" text="purpose" GridPane.columnIndex="1" GridPane.rowIndex="3">
<GridPane.margin>
<Insets left="5.0" />
</GridPane.margin></Label>
</GridPane.margin>
</Label>
</children>
</GridPane>
</center>
<top>
<VBox alignment="CENTER" prefHeight="200.0" prefWidth="100.0" BorderPane.alignment="CENTER">
<children>
<ImageView id="iitLogo" fitHeight="76.0" fitWidth="449.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../../images/iit.png" />
</image>
</ImageView>
<Separator prefWidth="200.0">
<HBox>
<children>
<ImageView id="iitLogo" fitHeight="76.0" fitWidth="430.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../../images/iit_logo.png" />
</image>
</ImageView>
<VBox alignment="CENTER" prefWidth="360.0">
<children>
<Label text="VISITOR PASS" textFill="RED">
<VBox.margin>
<Insets bottom="-20.0" top="-20.0" />
</VBox.margin>
<font>
<Font name="System Bold" size="20.0" />
</font>
</Label>
<Label text="INDIAN INSTITUTE OF TECHNOLOGY INDORE" textFill="#1f497d">
<font>
<Font name="System Bold" size="12.2" />
</font>
<VBox.margin>
<Insets bottom="-20.0" />
</VBox.margin>
</Label>
<Label text="Khandwa Road, Simrol , Indore – 453 552 " textFill="#1f497d">
<font>
<Font size="12.0" />
</font>
<VBox.margin>
<Insets bottom="-10.0" />
</VBox.margin>
</Label>
</children>
</VBox>
</children>
</HBox>
<Separator>
<VBox.margin>
<Insets top="2.0" />
</VBox.margin>
</Separator>
<HBox alignment="CENTER" spacing="30.0">
<HBox alignment="CENTER" maxHeight="30.0" spacing="30.0">
<children>
<Label fx:id="uidField" text="UID : " />
<Label fx:id="categoryField" text="Category : " />
</children>
<VBox.margin>
<Insets bottom="-5.0" top="-5.0" />
</VBox.margin>
</HBox>
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
<HBox alignment="CENTER" maxWidth="360.0" minHeight="216.0" prefHeight="216.0" prefWidth="200.0">
<children>
<Label alignment="CENTER" contentDisplay="CENTER" rotate="270.0" text="Visitor Card">
<font>
<Font name="System Bold Italic" size="20.0" />
</font>
<Label fx:id="validityField" alignment="CENTER" minWidth="216.0" prefWidth="216.0" rotate="270.0" text="Valid Upto : ">
<HBox.margin>
<Insets left="-75.0" right="-75.0" />
</HBox.margin>
</Label>
<ImageView fx:id="visitorImage" fitHeight="144.0" fitWidth="120.0" pickOnBounds="true" preserveRatio="true" />
<Label alignment="CENTER" contentDisplay="CENTER" rotate="90.0" text="Visitor Card">
<font>
<Font name="System Bold Italic" size="20.0" />
</font>
<ImageView fx:id="visitorImage" fitHeight="216.0" fitWidth="180.0" pickOnBounds="true" preserveRatio="true" />
<Label fx:id="locationField" alignment="CENTER" minWidth="216.0" prefWidth="216.0" rotate="270.0" text="Location : ">
<HBox.margin>
<Insets left="-75.0" right="-75.0" />
</HBox.margin>
</Label>
</children>
</HBox>
</children>
</VBox>
</top>
<bottom>
<Label text="This card is property of IIT Indore, Entry permitted till expiry. Please return to security help desk after use " textAlignment="CENTER" wrapText="true" BorderPane.alignment="CENTER">
<font>
<Font size="10.0" />
</font>
<BorderPane.margin>
<Insets bottom="-10.0" top="-10.0" />
</BorderPane.margin>
</Label>
</bottom>
</BorderPane>
</children>
</AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0" />
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="478.0" prefWidth="299.0" />
</items>
<cursor>
<Cursor fx:constant="DEFAULT" />
</cursor>
</SplitPane>
</center>
<right>
Expand Down
4 changes: 4 additions & 0 deletions src/visMan/PrintUserCardController.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ public class PrintUserCardController implements Initializable{
@FXML
private Label categoryField;
@FXML
private Label validityField;
@FXML
private Label locationField;
@FXML
private ImageView visitorImage;
@FXML
private ChoiceBox paperSize;
Expand Down
4 changes: 2 additions & 2 deletions src/visMan/database/CheckIn.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public Visitor insertNewUser(Visitor visitor){
public Visitor alreadyInserted(Visitor visitor){
PreparedStatement statement = null;
try {
statement = conn.prepareStatement("select * from userinfo where name=? and contact=? and dateofbirth=?");
statement = conn.prepareStatement("select * from userinfo where name=? and contact=?");// and dateofbirth=?");
statement.setString(1, visitor.getName());
statement.setString(2, visitor.getContact());
statement.setString(3, visitor.getDateOfBirth());
// statement.setString(3, visitor.getDateOfBirth());
ResultSet res = statement.executeQuery();
Visitor vis=Utils.toVisitor(res);
statement.close();
Expand Down
2 changes: 1 addition & 1 deletion src/visMan/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static void print(Node node, Paper paper){
// double pHeight= paper.getHeight();
// System.out.println("a" + pHeight);
Printer printer = Printer.getDefaultPrinter();
PageLayout pageLayout = printer.createPageLayout(paper, PageOrientation.PORTRAIT, 54,54,54,54);
PageLayout pageLayout = printer.createPageLayout(paper, PageOrientation.LANDSCAPE, 54,54,54,54);
// double dpi = pageLayout.getPrintableHeight()/pHeight;
// System.out.println(pageLayout.getPrintableHeight());
// double marginIn = 1.5;
Expand Down

0 comments on commit bcad8e4

Please sign in to comment.