Subversion Repositories SmartDukaan

Rev

Rev 27381 | Rev 29926 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27381 Rev 29578
Line 8... Line 8...
8
import javax.persistence.EnumType;
8
import javax.persistence.EnumType;
9
import javax.persistence.Enumerated;
9
import javax.persistence.Enumerated;
10
import javax.persistence.GeneratedValue;
10
import javax.persistence.GeneratedValue;
11
import javax.persistence.GenerationType;
11
import javax.persistence.GenerationType;
12
import javax.persistence.Id;
12
import javax.persistence.Id;
-
 
13
import javax.persistence.NamedQueries;
-
 
14
import javax.persistence.NamedQuery;
13
import javax.persistence.Table;
15
import javax.persistence.Table;
14
import javax.persistence.Transient;
16
import javax.persistence.Transient;
15
 
17
 
16
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
18
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
17
import com.spice.profitmandi.dao.enumuration.transaction.SchemePayoutStatus;
19
import com.spice.profitmandi.dao.enumuration.transaction.SchemePayoutStatus;
18
 
20
 
19
@Entity
21
@Entity
20
@Table(name = "fofo.scheme_in_out", schema = "fofo")
22
@Table(name = "fofo.scheme_in_out", schema = "fofo")
-
 
23
 
-
 
24
@NamedQueries({
-
 
25
 
-
 
26
		@NamedQuery(name = "SchemeInOut.selectPendingActivationGroupByBrandYearMonth", query = "select new com.spice.profitmandi.dao.model.ActivationYearMonthModel(i.brand, "
-
 
27
				+ "   DATE_FORMAT(sio.createTimestamp, '%m-%Y'),sum(cast(sio.amount As int)) ) from Scheme sc join  SchemeInOut sio  on"
-
 
28
				+ " sc.id = sio.schemeId join InventoryItem ii  on ii.id = sio.inventoryItemId"
-
 
29
				+ " join Item i on i.id = ii.itemId where sc.type = 'ACTIVATION' and sio.status ='PENDING' and sio.createTimestamp >= :startDate and ii.fofoId = :fofoId  "
-
 
30
				+ "  group by i.brand, DATE_FORMAT(sio.createTimestamp, '%m-%Y')"),
-
 
31
 
-
 
32
		@NamedQuery(name = "SchemeInOut.selectByYearMonthActivationGroupByBrand", query = "select new com.spice.profitmandi.dao.model.ActivationBrandModel(i.brand, "
-
 
33
				+ "  sum(cast(sio.amount As int)) ) from Scheme sc join  SchemeInOut sio  on"
-
 
34
				+ " sc.id = sio.schemeId join InventoryItem ii  on ii.id = sio.inventoryItemId"
-
 
35
				+ " join Item i on i.id = ii.itemId where sc.type = 'ACTIVATION' and sio.status ='PENDING' and sio.createTimestamp <= :endDate and ii.fofoId = :fofoId  "
-
 
36
				+ "  group by i.brand"),
-
 
37
 
-
 
38
		@NamedQuery(name = "SchemeInOut.selectBrandPendingActivationItemDetails", query = "select new com.spice.profitmandi.dao.model.ActivationItemDetailModel(i.brand, "
-
 
39
				+ "  i.modelName,i.modelNumber,cast(sio.amount As int),ii.serialNumber, ii.id) from Scheme sc join SchemeInOut sio  on"
-
 
40
				+ "	 sc.id = sio.schemeId join InventoryItem ii  on ii.id = sio.inventoryItemId"
-
 
41
				+ "	 join Item i on i.id = ii.itemId where sc.type = 'ACTIVATION' and sio.status ='PENDING' and "
-
 
42
				+ "  ii.fofoId = :fofoId and i.brand = :brand and  DATE_FORMAT(sio.createTimestamp, '%m-%Y') = :yearMonthValue"),
-
 
43
 
-
 
44
		@NamedQuery(name = "SchemeInOut.selectBrandPendingActivationItemDetailByYearMonth", query = "select new com.spice.profitmandi.dao.model.ActivationItemDetailModel(i.brand, "
-
 
45
				+ "  i.modelName,i.modelNumber,cast(sio.amount As int),ii.serialNumber, ii.id) from Scheme sc join SchemeInOut sio  on"
-
 
46
				+ "	 sc.id = sio.schemeId join InventoryItem ii  on ii.id = sio.inventoryItemId"
-
 
47
				+ "	 join Item i on i.id = ii.itemId where sc.type = 'ACTIVATION' and sio.status ='PENDING' and "
-
 
48
				+ "  ii.fofoId = :fofoId and i.brand = :brand and sio.createTimestamp <= :endDate"),
-
 
49
 
-
 
50
})
21
public class SchemeInOut implements Serializable {
51
public class SchemeInOut implements Serializable {
22
 
52
 
23
	public SchemeInOut(int schemeId, int inventoryItemId) {
53
	public SchemeInOut(int schemeId, int inventoryItemId) {
24
		this.schemeId = schemeId;
54
		this.schemeId = schemeId;
25
		this.inventoryItemId = inventoryItemId;
55
		this.inventoryItemId = inventoryItemId;