bump
This commit is contained in:
BIN
AquanticoLogo_Horizontal.png
Normal file
BIN
AquanticoLogo_Horizontal.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 86 KiB |
@@ -23,6 +23,9 @@ public class TallyEntry extends PanacheEntityBase {
|
||||
@JoinColumn(name = "product_id", nullable = false)
|
||||
public Product product;
|
||||
|
||||
@Column(name = "price_cents_at_booking", nullable = false)
|
||||
public int priceCentsAtBooking;
|
||||
|
||||
@Column(name = "month_key", nullable = false, length = 7)
|
||||
public String monthKey;
|
||||
|
||||
|
||||
@@ -171,9 +171,9 @@ public class CompanyAdminResource {
|
||||
String monthKey = month != null ? month : LocalDateTime.now().format(MONTH_FORMAT);
|
||||
|
||||
List<MonthlyTallyDto> tallies = TallyEntry.find(
|
||||
"SELECT t.product.name, t.product.priceCents, COUNT(t), COUNT(t) * t.product.priceCents " +
|
||||
"SELECT t.product.name, t.priceCentsAtBooking, COUNT(t), SUM(t.priceCentsAtBooking) " +
|
||||
"FROM TallyEntry t WHERE t.employee.id = ?1 AND t.monthKey = ?2 " +
|
||||
"GROUP BY t.product.id, t.product.name, t.product.priceCents",
|
||||
"GROUP BY t.product.id, t.product.name, t.priceCentsAtBooking",
|
||||
employeeId, monthKey)
|
||||
.project(MonthlyTallyDto.class)
|
||||
.list();
|
||||
|
||||
@@ -57,6 +57,7 @@ public class PublicResource {
|
||||
TallyEntry entry = new TallyEntry();
|
||||
entry.employee = employee;
|
||||
entry.product = product;
|
||||
entry.priceCentsAtBooking = product.priceCents;
|
||||
entry.persist();
|
||||
|
||||
return Response.status(Response.Status.CREATED).build();
|
||||
@@ -83,9 +84,9 @@ public class PublicResource {
|
||||
String monthKey = month != null ? month : LocalDateTime.now().format(MONTH_FORMAT);
|
||||
|
||||
return TallyEntry.find(
|
||||
"SELECT t.product.name, t.product.priceCents, COUNT(t), COUNT(t) * t.product.priceCents " +
|
||||
"SELECT t.product.name, t.priceCentsAtBooking, COUNT(t), SUM(t.priceCentsAtBooking) " +
|
||||
"FROM TallyEntry t WHERE t.employee.id = ?1 AND t.monthKey = ?2 " +
|
||||
"GROUP BY t.product.id, t.product.name, t.product.priceCents",
|
||||
"GROUP BY t.product.id, t.product.name, t.priceCentsAtBooking",
|
||||
employeeId, monthKey)
|
||||
.project(MonthlyTallyDto.class)
|
||||
.list();
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE tally_entry ADD COLUMN price_cents_at_booking INT NOT NULL DEFAULT 0;
|
||||
Reference in New Issue
Block a user