| Line 24... |
Line 24... |
| 24 |
+ " join SchemeItem si on si.schemeId = s.id" + " join SchemeRegion sr on sr.schemeId = s.id"
|
24 |
+ " join SchemeItem si on si.schemeId = s.id" + " join SchemeRegion sr on sr.schemeId = s.id"
|
| 25 |
+ " join PartnerRegion pr on pr.regionId=sr.regionId"
|
25 |
+ " join PartnerRegion pr on pr.regionId=sr.regionId"
|
| 26 |
+ " where pr.fofoId in :fofoIds and s.partnerType in :partnerTypes" + " and si.catalogId in :catalogIds"
|
26 |
+ " where pr.fofoId in :fofoIds and s.partnerType in :partnerTypes" + " and si.catalogId in :catalogIds"
|
| 27 |
+ " and :onDate between s.startDateTime and s.endDateTime" +
|
27 |
+ " and :onDate between s.startDateTime and s.endDateTime" +
|
| 28 |
// " and s.endDateTime >= :onDate" +
|
28 |
// " and s.endDateTime >= :onDate" +
|
| 29 |
" and s.activeTimestamp is not null")
|
29 |
" and s.activeTimestamp is not null"),
|
| - |
|
30 |
|
| - |
|
31 |
@NamedQuery(name = "Scheme.selectSchemesByBrandsAndFofoRegion", query = "select distinct s from Scheme s"
|
| - |
|
32 |
+ " join SchemeItem si on si.schemeId = s.id"
|
| - |
|
33 |
+ " join Item i on i.catalogItemId = si.catalogId"
|
| - |
|
34 |
+ " join SchemeRegion sr on sr.schemeId = s.id"
|
| - |
|
35 |
+ " where i.brand in :brands"
|
| - |
|
36 |
+ " and s.activeTimestamp is not null"
|
| - |
|
37 |
+ " and s.partnerType in :partnerTypes"
|
| - |
|
38 |
+ " and s.startDateTime <= :onDate"
|
| - |
|
39 |
+ " and COALESCE(s.expireTimestamp, s.endDateTime) >= :onDate"
|
| - |
|
40 |
+ " and (si.endDate is null or si.endDate >= :onDate)"
|
| - |
|
41 |
+ " and (sr.regionId = 5 or sr.regionId in :regionIds)"
|
| - |
|
42 |
+ " order by s.id desc"),
|
| - |
|
43 |
|
| - |
|
44 |
@NamedQuery(name = "Scheme.selectSchemesByBrands", query = "select distinct s from Scheme s"
|
| - |
|
45 |
+ " join SchemeItem si on si.schemeId = s.id"
|
| - |
|
46 |
+ " join Item i on i.catalogItemId = si.catalogId"
|
| - |
|
47 |
+ " where i.brand in :brands"
|
| - |
|
48 |
+ " and s.activeTimestamp is not null"
|
| - |
|
49 |
+ " and s.partnerType in :partnerTypes"
|
| - |
|
50 |
+ " and s.startDateTime <= :onDate"
|
| - |
|
51 |
+ " and COALESCE(s.expireTimestamp, s.endDateTime) >= :onDate"
|
| - |
|
52 |
+ " and (si.endDate is null or si.endDate >= :onDate)"
|
| - |
|
53 |
+ " order by s.id desc"),
|
| - |
|
54 |
|
| - |
|
55 |
@NamedQuery(name = "Scheme.selectActiveSchemesByFofoRegion", query = "select distinct s from Scheme s"
|
| - |
|
56 |
+ " join SchemeItem si on si.schemeId = s.id"
|
| - |
|
57 |
+ " join SchemeRegion sr on sr.schemeId = s.id"
|
| - |
|
58 |
+ " where s.activeTimestamp is not null"
|
| - |
|
59 |
+ " and s.partnerType in :partnerTypes"
|
| - |
|
60 |
+ " and s.startDateTime <= :onDate"
|
| - |
|
61 |
+ " and COALESCE(s.expireTimestamp, s.endDateTime) >= :onDate"
|
| - |
|
62 |
+ " and (si.endDate is null or si.endDate >= :onDate)"
|
| - |
|
63 |
+ " and (sr.regionId = 5 or sr.regionId in :regionIds)"
|
| - |
|
64 |
+ " order by s.id desc"),
|
| - |
|
65 |
|
| - |
|
66 |
@NamedQuery(name = "Scheme.selectAllActiveSchemes", query = "select distinct s from Scheme s"
|
| - |
|
67 |
+ " join SchemeItem si on si.schemeId = s.id"
|
| - |
|
68 |
+ " where s.activeTimestamp is not null"
|
| - |
|
69 |
+ " and s.partnerType in :partnerTypes"
|
| - |
|
70 |
+ " and s.startDateTime <= :onDate"
|
| - |
|
71 |
+ " and COALESCE(s.expireTimestamp, s.endDateTime) >= :onDate"
|
| - |
|
72 |
+ " and (si.endDate is null or si.endDate >= :onDate)"
|
| - |
|
73 |
+ " order by s.id desc")
|
| 30 |
|
74 |
|
| 31 |
/*
|
75 |
/*
|
| 32 |
* ,
|
76 |
* ,
|
| 33 |
*
|
77 |
*
|
| 34 |
* @NamedQuery(name="scheme.getImeiMarginsPaidOnBillingMonth", query=
|
78 |
* @NamedQuery(name="scheme.getImeiMarginsPaidOnBillingMonth", query=
|
| Line 387... |
Line 431... |
| 387 |
public void setRetailerIds(Set<Integer> retailerIds) {
|
431 |
public void setRetailerIds(Set<Integer> retailerIds) {
|
| 388 |
this.retailerIds = retailerIds;
|
432 |
this.retailerIds = retailerIds;
|
| 389 |
}
|
433 |
}
|
| 390 |
|
434 |
|
| 391 |
public String getRetailerIdsString() {
|
435 |
public String getRetailerIdsString() {
|
| - |
|
436 |
if (retailerIds == null || retailerIds.isEmpty()) {
|
| - |
|
437 |
return "";
|
| - |
|
438 |
}
|
| 392 |
Set<String> stringRetailerIds = new HashSet<>();
|
439 |
Set<String> stringRetailerIds = new HashSet<>();
|
| 393 |
if (!retailerIds.isEmpty()) {
|
- |
|
| 394 |
for (int retailerId : retailerIds) {
|
440 |
for (int retailerId : retailerIds) {
|
| 395 |
stringRetailerIds.add(String.valueOf(retailerId));
|
441 |
stringRetailerIds.add(String.valueOf(retailerId));
|
| 396 |
}
|
- |
|
| 397 |
}
|
442 |
}
|
| 398 |
return String.join(", ", stringRetailerIds);
|
443 |
return String.join(", ", stringRetailerIds);
|
| 399 |
}
|
444 |
}
|
| 400 |
|
445 |
|
| 401 |
public boolean isBasePlusGstCalc() {
|
446 |
public boolean isBasePlusGstCalc() {
|