Check type of invoice

Calculate date depending on selected type of the invoice. Invoice type
IDs are defined as fixed and have to be set for the actual installation
of SI. Added some spaces to make JS code better readable.