ut.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
. addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.RELATED)
. addGroup (layout.createParallelGroup (javax.swing.GroupLayout.Alignment.BASELINE)
. addComponent (spinQuantity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
. addComponent (jLabel1))
. addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.RELATED)
. addGroup (layout.createParallelGroup (javax.swing.GroupLayout.Alignment.CENTER)
. addComponent (dateChooser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
. addComponent (jLabel2))
. addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.RELATED)
. addGroup (layout.createParallelGroup (javax.swing.GroupLayout.Alignment.BASELINE)
. addComponent (dropdownPerson, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
. addComponent (jLabel3))
. addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.RELATED)
. addComponent (lblStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
. addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.RELATED)
. addComponent (btnRegister, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
. addContainerGap ())
); ();
}// lt;/editor-fold gt; void btnRegisterMouseClicked (java.awt.event.MouseEvent evt) {product=(Product) dropdownProduct.getSelectedItem (); quantity=(Integer) spinQuantity.getValue (); date=dateChooser.getDate (); person=(Employee) dropdownPerson.getSelectedItem (); (quantity lt;=0) {.setText ( Quantity must be positive ) ;;
} (product == null) {.setText ( Select a product please ) ;;
} (person == null) {.setText ( Select a responsive person please ) ;;
}
//Positive for incoming goods, negative for outcoming=quantityRatio * quantity; p=StockDatabase.getInstance (). getProducts (). GetProductById (product.getId ()); (quantity lt; 0 amp; amp; .getQuantityinstock () lt; Math.abs (quantity)) {
//trying to take TOO MUCH from stock .... setText ( There are only + p.getQuantityinstock () + items of this product in stock. ); ;
} shipment=new Shipment();.setProductid(product);.setQuantity(quantity);.setDatetime(date);.setResponsiblepersonid(person);(StockDatabase.getInstance().getShipments().InsertShipment(shipment)) {
//success (false);
} else {.setText ( An error occured ) ;;
}
}
/**
*param args the command line arguments
*/static void main (String args []) {.awt.EventQueue.invokeLater (new Runnable () {void run () {AddShipmentDialog (). setVisible (true);
}
});
}
//Variables declaration - do not modify javax.swing.JButton btnRegister; com.toedter.calendar.JDateChooser dateChooser; javax.swing.JComboBox dropdownPerson; javax.swing.JComboBox dropdownProduct; javax.swing. JLabel jLabel1; javax.swing.JLabel jLabel2; javax.swing.JLabel jLabel3; javax.swing.JLabel jLabel4; javax.swing.JLabel lblStatus; javax.swing.JSpinner spinQuantity;
//End of variables declaration
}