diff --git a/solr/structure/conf/schema.xml b/solr/structure/conf/schema.xml index 0e3dace2..648bc155 100644 --- a/solr/structure/conf/schema.xml +++ b/solr/structure/conf/schema.xml @@ -41,6 +41,7 @@ + @@ -65,5 +66,6 @@ + \ No newline at end of file diff --git a/sql/locanda.sql b/sql/locanda.sql index b2c5fa2c..cad48a93 100644 --- a/sql/locanda.sql +++ b/sql/locanda.sql @@ -882,6 +882,7 @@ CREATE TABLE `structure` ( `notes` varchar(255) DEFAULT NULL, `id_user` int(11) DEFAULT NULL, `mobile` varchar(255) DEFAULT NULL, + `taxNumber` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; diff --git a/src/action/BookingAction.java b/src/action/BookingAction.java index 760d045d..f54c8303 100644 --- a/src/action/BookingAction.java +++ b/src/action/BookingAction.java @@ -81,7 +81,7 @@ public class BookingAction extends ActionSupport implements SessionAware,UserAwa private Double adjustmentsSubtotal = 0.0; private Double paymentsSubtotal = 0.0; private Integer idStructure; - private String dateStart = null; + private String start = null; private List listNumGuests = null; @Autowired private ExtraService extraService = null; @@ -606,10 +606,12 @@ public String findAllBookings(){ }) }) public String findAllBookingsByStartDateAndLengthOfStay(){ - if (this.getDateStart() != null && this.getDateStart().length() > 1) { - Date startDateBookings = new Date(Long.parseLong(this.getDateStart())); - this.setBookings(this.getBookingService().findBookingsByIdStructure(this.getIdStructure())); + if (this.getStart() != null && this.getStart().length() > 1) { + Date startDateBookings = new Date(Long.parseLong(this.getStart()) * 1000); + logger.info("**** data inizio2 ***" + startDateBookings); + this.setBookings(this.getBookingService().findAllBookingsByStartDateAndLengthOfStay(this.getIdStructure(), startDateBookings, 10)); + return SUCCESS; } return ERROR; @@ -1037,12 +1039,12 @@ public void setCreditCardService(CreditCardService creditCardService) { this.creditCardService = creditCardService; } - public String getDateStart() { - return dateStart; + public String getStart() { + return start; } - public void setDateStart(String dateStart) { - this.dateStart = dateStart; + public void setStart(String start) { + this.start = start; } } \ No newline at end of file diff --git a/src/global_en.properties b/src/global_en.properties index 8bbcdc57..9624e3ed 100644 --- a/src/global_en.properties +++ b/src/global_en.properties @@ -625,6 +625,8 @@ subtotalRoom = Subtotal for the Room sunday = Sunday +taxNumber = VAT + thisFileMandatory = This Field is Mandatory thursday = Thursday diff --git a/src/global_es.properties b/src/global_es.properties index f0b730d0..40e0db8f 100644 --- a/src/global_es.properties +++ b/src/global_es.properties @@ -561,6 +561,8 @@ subtotalRoom = Subtotal por habitaci\u00F3n sunday = Domingo +taxNumber = CIF/NIF + thisFileMandatory = campo obligatorio thursday = Jueves diff --git a/src/global_it.properties b/src/global_it.properties index bf8d25db..3a2f1121 100644 --- a/src/global_it.properties +++ b/src/global_it.properties @@ -627,6 +627,8 @@ subtotalRoom = Costo per la camera sunday = Domenica +taxNumber = P.IVA/CF + thisFileMandatory = campo obbligatorio thursday = Gioved\u00EC diff --git a/src/model/Structure.java b/src/model/Structure.java index d782cbc8..045de90f 100644 --- a/src/model/Structure.java +++ b/src/model/Structure.java @@ -54,6 +54,8 @@ public class Structure implements Serializable { private Integer id_user; @Field private String mobile; + @Field + private String taxNumber; private List images; private List facilities; @@ -150,6 +152,12 @@ public String getMobile() { public void setMobile(String mobile) { this.mobile = mobile; } + public String getTaxNumber() { + return taxNumber; + } + public void setTaxNumber(String taxNumber) { + this.taxNumber = taxNumber; + } } \ No newline at end of file diff --git a/src/persistence/mybatis/mappers/StructureMapper.xml b/src/persistence/mybatis/mappers/StructureMapper.xml index d955d448..9c74308b 100644 --- a/src/persistence/mybatis/mappers/StructureMapper.xml +++ b/src/persistence/mybatis/mappers/StructureMapper.xml @@ -33,18 +33,18 @@ In case of controversy the competent court is the Court of Cagliari (Italy). UPDATE structure - set name= #{name},email= #{email},url= #{url},phone= #{phone},fax= #{fax},address= #{address},city= #{city},country= #{country},zipCode= #{zipCode},notes= #{notes},id_user= #{id_user},mobile= #{mobile} + set name= #{name},email= #{email},url= #{url},phone= #{phone},fax= #{fax},address= #{address},city= #{city},country= #{country},zipCode= #{zipCode},notes= #{notes},id_user= #{id_user},mobile= #{mobile},taxNumber= #{taxNumber} WHERE id = #{id} INSERT INTO structure(name,email,url,phone,fax,address,city,country,zipCode,notes,id_user) - values(#{name}, #{email}, #{url}, #{phone}, #{fax}, #{address}, #{city}, #{country}, #{zipCode}, #{notes}, #{id_user}, #{mobile}) + values(#{name}, #{email}, #{url}, #{phone}, #{fax}, #{address}, #{city}, #{country}, #{zipCode}, #{notes}, #{id_user}, #{mobile}, #{taxNumber}) - SELECT id,name,email,url,phone,fax,address,city,country,zipCode,notes,id_user,mobile FROM structure + SELECT id,name,email,url,phone,fax,address,city,country,zipCode,notes,id_user,mobile,taxNumber FROM structure \ No newline at end of file diff --git a/src/service/BookingService.java b/src/service/BookingService.java index 40adbc5b..55a15335 100644 --- a/src/service/BookingService.java +++ b/src/service/BookingService.java @@ -47,4 +47,6 @@ public interface BookingService { public Integer updateBooking(Booking booking); public Integer deleteBooking(Integer id); + Boolean checkifExistBookingInRangeOfDates(Booking booking, Date startDate, Date endDate); + } \ No newline at end of file diff --git a/src/service/BookingServiceImpl.java b/src/service/BookingServiceImpl.java index 74765b26..1a7f4592 100644 --- a/src/service/BookingServiceImpl.java +++ b/src/service/BookingServiceImpl.java @@ -33,6 +33,7 @@ import model.listini.Season; import model.questura.HousedExport; +import org.apache.commons.lang3.time.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -125,8 +126,38 @@ public List findBookingIdsByIdStructure(Integer id_structure) { @Override public List findAllBookingsByStartDateAndLengthOfStay( Integer id_structure, Date startDate, Integer lengthOfStay) { - // TODO Auto-generated method stub - return null; + List bookings = null; + Booking booking = null; + Date endDate = DateUtils.addDays(startDate, lengthOfStay); + + bookings = new ArrayList(); + for(Integer id: this.getBookingMapper().findBookingIdsByIdStructure(id_structure)){ + booking = this.findBookingById(id); + if(this.checkifExistBookingInRangeOfDates(booking, startDate, endDate)){ + bookings.add(booking); + } + + } + return bookings; + } + + @Override + public Boolean checkifExistBookingInRangeOfDates(Booking booking, Date startDate, Date endDate){ + // dateIn|---------------------------------------------------------------------------------------------------------| dateOut + // dateIn|-------------------------| dateOut dateIn |-----|dateOut dateIn |------------| dateOut + // startDate|----------------------------------------------------------------------------|endDate + // + if(booking.getDateOut().after(endDate) && booking.getDateIn().compareTo(startDate)<=0){ + return true; + } + if(booking.getDateOut().compareTo(endDate) <=0 && (booking.getDateOut().compareTo(startDate)>= 0 ) ){ + return true; + } + if(booking.getDateIn().compareTo(startDate)>=0 && booking.getDateIn().compareTo(endDate)<=0){ + return true; + } + + return false; } @Override diff --git a/webroot/WEB-INF/jsp/templates/structure.mustache.jsp b/webroot/WEB-INF/jsp/templates/structure.mustache.jsp index 38b96409..4c3b2c4e 100644 --- a/webroot/WEB-INF/jsp/templates/structure.mustache.jsp +++ b/webroot/WEB-INF/jsp/templates/structure.mustache.jsp @@ -45,6 +45,10 @@ {{#availableCountries}}{{/availableCountries}} +
+ + +
@@ -52,16 +56,12 @@
- - -
-
- - + +
- +
@@ -69,12 +69,16 @@
- +
+ + +
+
-
+
@@ -124,12 +128,12 @@ : {{country}} - -
: {{email}} -
+
+ +
: {{url}} @@ -145,6 +149,10 @@
: {{fax}} +
+
+ : + {{fax}}
: diff --git a/webroot/js/views/planner.js b/webroot/js/views/planner.js index 8584a5c5..8d041cc6 100644 --- a/webroot/js/views/planner.js +++ b/webroot/js/views/planner.js @@ -303,7 +303,7 @@ $(function () { eventMouseover: function (calEvent, $event) {}, eventMouseout: function (calEvent, $event) {}, noEvents: function () {}, - data: "findAllBookingsJson.action" + data: "findAllBookingsByStartDateAndLengthOfStay.action" }); }, /** diff --git a/webroot/reports/bookinginvoice.rptdesign b/webroot/reports/bookinginvoice.rptdesign index 5119d87d..68b33ab7 100644 --- a/webroot/reports/bookinginvoice.rptdesign +++ b/webroot/reports/bookinginvoice.rptdesign @@ -536,6 +536,16 @@ WHERE payment.id_booking = ?]]> id_user integer + + 13 + mobile + string + + + 14 + taxNumber + string + Locanda @@ -612,6 +622,18 @@ WHERE payment.id_booking = ?]]> id_user integer + + 13 + mobile + mobile + string + + + 14 + taxNumber + taxNumber + string + - 9.989583333333334in + 9.34375in 7.947916666666667in @@ -1587,16 +1609,22 @@ WHERE adjustment.id_booking = ?]]> dataSetRow["country"] string + + Column Binding + dataSetRow["mobile"] + string + true + 50 0.11458333333333333in - 1.9375in + 1.96875in - 1.7708333333333333in + 1.7395833333333333in
@@ -1630,6 +1658,7 @@ WHERE adjustment.id_booking = ?]]> "Times New Roman" 12pt + 10pt bold italic left @@ -1652,6 +1681,7 @@ WHERE adjustment.id_booking = ?]]> "Times New Roman" 12pt + 10pt address @@ -1675,16 +1705,19 @@ WHERE adjustment.id_booking = ?]]> + 10pt zipCode + 10pt city + 10pt country @@ -1711,25 +1744,63 @@ WHERE adjustment.id_booking = ?]]> 0.3229166666666667in 2.0104166666666665in - 0.4479166666666667in + 0.3333333333333333in - 1.5625in + 1.6770833333333333in 0.3229166666666667in + 10pt + left phone + + 1.875in + + 0.75in + + + 1.125in + + + + left + + + + + + 10pt + left + Column Binding + + + + "Times New Roman" @@ -1745,11 +1816,14 @@ WHERE adjustment.id_booking = ?]]> + 10pt + left fax @@ -2134,6 +2208,7 @@ WHERE adjustment.id_booking = ?]]> 12pt 0pt + 10pt BookingDataset @@ -2390,6 +2465,7 @@ WHERE adjustment.id_booking = ?]]> firstName + 10pt BookingDataset @@ -2646,6 +2722,7 @@ WHERE adjustment.id_booking = ?]]> lastName + 10pt BookingDataset @@ -2902,6 +2979,7 @@ WHERE adjustment.id_booking = ?]]> address + 10pt BookingDataset @@ -3164,11 +3242,14 @@ WHERE adjustment.id_booking = ?]]> 0pt bottom + 10pt BookingDataset @@ -5948,7 +6029,7 @@ WHERE adjustment.id_booking = ?]]> - 2.125in + 1.8645833333333333in 2 1 @@ -6200,7 +6281,7 @@ WHERE adjustment.id_booking = ?]]> - 0.9791666666666666in + 0.59375in @@ -6278,6 +6359,18 @@ WHERE adjustment.id_booking = ?]]>dataSetRow["id_user"]integer + + mobile + mobile + dataSetRow["mobile"] + string + + + taxNumber + taxNumber + dataSetRow["taxNumber"] + string +
@@ -6354,5 +6447,200 @@ WHERE adjustment.id_booking = ?]]> +
+ solid + medium + 7.645833333333333in + StructureDataSet + + + id + id + dataSetRow["id"] + integer + + + name + name + dataSetRow["name"] + string + + + email + email + dataSetRow["email"] + string + + + url + url + dataSetRow["url"] + string + + + phone + phone + dataSetRow["phone"] + string + + + fax + fax + dataSetRow["fax"] + string + + + address + address + dataSetRow["address"] + string + + + city + city + dataSetRow["city"] + string + + + country + country + dataSetRow["country"] + string + + + zipCode + zipCode + dataSetRow["zipCode"] + string + + + notes + notes + dataSetRow["notes"] + string + + + id_user + id_user + dataSetRow["id_user"] + integer + + + Column Binding + dataSetRow["taxNumber"] + string + true + + + Column Binding_1 + row["email"] + string + true + + + Column Binding_2 + row["url"] + string + true + + + Column Binding_3 + row["phone"] + string + true + + + Column Binding_4 + dataSetRow["mobile"] + string + true + + + + + 0.3541666666666667in + + + 1.6041666666666667in + + + 1.9166666666666667in + + + 1.8854166666666667in + + + 1.8854166666666667in + +
+ + 0.07291666666666667in + + + + + + +
+ + + 0.5833333333333334in + + + + + block + Column Binding + + + + + + block + Column Binding_1 + + + + + + block + Column Binding_2 + + + + + + block + Column Binding_3 + + + Column Binding_4 + + + + +
+ + 0.15625in + + + + + + +
+