Subversion Repositories SmartDukaan

Rev

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

Rev 33023 Rev 33115
Line 9... Line 9...
9
import java.time.LocalDateTime;
9
import java.time.LocalDateTime;
10
import java.time.format.DateTimeFormatter;
10
import java.time.format.DateTimeFormatter;
11
import java.util.Objects;
11
import java.util.Objects;
12
 
12
 
13
@NamedQueries({
13
@NamedQueries({
14
		@NamedQuery(name = "InventoryItem.selectScannedCount", query = "select ii.itemId, sum(ii.initialQuantity) from InventoryItem ii "
14
        @NamedQuery(name = "InventoryItem.selectScannedCount", query = "select ii.itemId, sum(ii.initialQuantity) from InventoryItem ii "
15
				+ "where ii.itemId in :itemIds and ii.fofoId = :fofoId and ii.purchaseId = :purchaseId group by ii.itemId"),
15
                + "where ii.itemId in :itemIds and ii.fofoId = :fofoId and ii.purchaseId = :purchaseId group by ii.itemId"),
16
		//For Serialized models
16
        //For Serialized models
17
		@NamedQuery(name = "InventoryItem.selectAllLineItemIdsByInventoryIds", query = "select new com.spice.profitmandi.dao.model.InventoryItemSaleModel(ii.id, lii.id)   from InventoryItem ii" +
17
        @NamedQuery(name = "InventoryItem.selectAllLineItemIdsByInventoryIds", query = "select new com.spice.profitmandi.dao.model.InventoryItemSaleModel(ii.id, lii.id)   from InventoryItem ii" +
18
				" join Purchase p on p.id = ii.purchaseId join Order o on o.invoiceNumber = p.purchaseReference" +
18
                " join Purchase p on p.id = ii.purchaseId join Order o on o.invoiceNumber = p.purchaseReference" +
19
				" join LineItem li on li.orderId = o.id join LineItemImei lii on (lii.id=li.id and lii.serialNumber=ii.serialNumber)" +
19
                " join LineItem li on li.orderId = o.id join LineItemImei lii on (lii.id=li.id and lii.serialNumber=ii.serialNumber)" +
20
				"where ii.id in :inventoryItemIds")
20
                "where ii.id in :inventoryItemIds"),
-
 
21
 
-
 
22
        //int lineItemImeiId, int fofoInventoryItemId, LocalDateTime invoiceDate, String invoiceNumber, double buyPrice, double sellPrice, int item, String itemName
-
 
23
        @NamedQuery(name = "InventoryItem.selectItemSaleSummary",
-
 
24
                query = "select new com.spice.profitmandi.dao.model.InventoryItemSaleModel(" +
-
 
25
                        "lii.id, ii.id, o.billingTimestamp, o.invoiceNumber, cast(li.unitPrice as double) ,cast(foi.sellingPrice as double), li.item)   from InventoryItem ii" +
-
 
26
                        " join Purchase p on p.id = ii.purchaseId join Order o on o.invoiceNumber = p.purchaseReference" +
-
 
27
                        " join LineItem li on li.orderId = o.id join LineItemImei lii on (lii.lineItemId=li.id and lii.serialNumber=ii.serialNumber)" +
-
 
28
                        " join FofoLineItem  fli on fli.inventoryItemId=ii.id join FofoOrderItem foi on foi.id=fli.fofoOrderItemId join FofoOrder fo on fo.id = foi.orderId" +
-
 
29
                        " where ii.id in :inventoryItemIds and fo.cancelledTimestamp is null")
21
})
30
})
22
@Entity
31
@Entity
23
@Table(name = "fofo.inventory_item")
32
@Table(name = "fofo.inventory_item")
24
public class InventoryItem implements Comparable {
33
public class InventoryItem implements Comparable {
25
 
34
 
26
	public InventoryItem(String serialNumber) {
35
    public InventoryItem(String serialNumber) {
27
		this.serialNumber = serialNumber;
36
        this.serialNumber = serialNumber;
28
	}
37
    }
29
 
38
 
30
	public InventoryItem() {
39
    public InventoryItem() {
31
 
40
 
32
	}
41
    }
33
 
42
 
34
	@Id
43
    @Id
35
	@Column(name = "id", unique = true, updatable = false)
44
    @Column(name = "id", unique = true, updatable = false)
36
	@GeneratedValue(strategy = GenerationType.IDENTITY)
45
    @GeneratedValue(strategy = GenerationType.IDENTITY)
37
	private int id;
46
    private int id;
38
 
47
 
39
	@Column(name = "item_id")
48
    @Column(name = "item_id")
40
	private int itemId;
49
    private int itemId;
41
 
50
 
42
	@Column(name = "fofo_id")
51
    @Column(name = "fofo_id")
43
	private int fofoId;
52
    private int fofoId;
44
 
53
 
45
	@Column(name = "serial_number", length = 100)
54
    @Column(name = "serial_number", length = 100)
46
	private String serialNumber;
55
    private String serialNumber;
47
 
56
 
48
	@Column(name = "initial_quantity")
57
    @Column(name = "initial_quantity")
49
	private int initialQuantity;
58
    private int initialQuantity;
50
 
59
 
51
	@Column(name = "good_quantity")
60
    @Column(name = "good_quantity")
52
	private int goodQuantity;
61
    private int goodQuantity;
53
 
62
 
54
	@Column(name = "bad_quantity")
63
    @Column(name = "bad_quantity")
55
	private int badQuantity;
64
    private int badQuantity;
56
 
65
 
57
	@Column(name = "activation_timestamp")
66
    @Column(name = "activation_timestamp")
58
	private LocalDateTime activationTimestamp;
67
    private LocalDateTime activationTimestamp;
59
 
68
 
60
	@Column(name = "last_scan_type")
69
    @Column(name = "last_scan_type")
61
	@Enumerated(EnumType.STRING)
70
    @Enumerated(EnumType.STRING)
62
	private ScanType lastScanType;
71
    private ScanType lastScanType;
63
 
72
 
64
	@Column(name = "purchase_id")
73
    @Column(name = "purchase_id")
65
	private int purchaseId;
74
    private int purchaseId;
66
 
75
 
67
	@Column(name = "unit_price")
76
    @Column(name = "unit_price")
68
	private float unitPrice;
77
    private float unitPrice;
69
 
78
 
70
	@Column(name = "price_drop_amount")
79
    @Column(name = "price_drop_amount")
71
	private float priceDropAmount;
80
    private float priceDropAmount;
72
 
81
 
73
	@Column(name = "buy_back", columnDefinition = "tinyint(1) default 1")
82
    @Column(name = "buy_back", columnDefinition = "tinyint(1) default 1")
74
	private boolean buyBack;
83
    private boolean buyBack;
75
 
84
 
76
	@Column(name = "igst_rate")
85
    @Column(name = "igst_rate")
77
	private float igstRate;
86
    private float igstRate;
78
 
87
 
79
	@Column(name = "cgst_rate")
88
    @Column(name = "cgst_rate")
80
	private float cgstRate;
89
    private float cgstRate;
81
 
90
 
82
	@Column(name = "sgst_rate")
91
    @Column(name = "sgst_rate")
83
	private float sgstRate;
92
    private float sgstRate;
84
 
93
 
85
	@Column(name = "hsn_code")
94
    @Column(name = "hsn_code")
86
	private String hsnCode;
95
    private String hsnCode;
87
 
96
 
88
	@Convert(converter = LocalDateTimeAttributeConverter.class)
97
    @Convert(converter = LocalDateTimeAttributeConverter.class)
89
	@Column(name = "create_timestamp")
98
    @Column(name = "create_timestamp")
90
	private LocalDateTime createTimestamp = LocalDateTime.now();
99
    private LocalDateTime createTimestamp = LocalDateTime.now();
91
 
100
 
92
	@Convert(converter = LocalDateTimeAttributeConverter.class)
101
    @Convert(converter = LocalDateTimeAttributeConverter.class)
93
	@Column(name = "update_timestamp")
102
    @Column(name = "update_timestamp")
94
	@UpdateTimestamp
103
    @UpdateTimestamp
95
	private LocalDateTime updateTimestamp = LocalDateTime.now();
104
    private LocalDateTime updateTimestamp = LocalDateTime.now();
96
 
105
 
97
	@OneToOne(fetch = FetchType.LAZY)
106
    @OneToOne(fetch = FetchType.LAZY)
98
	@JoinColumn(name = "item_id", insertable = false, updatable = false, nullable = false, referencedColumnName = "id")
107
    @JoinColumn(name = "item_id", insertable = false, updatable = false, nullable = false, referencedColumnName = "id")
99
	private Item item;
108
    private Item item;
100
 
109
 
101
	@OneToOne(fetch = FetchType.LAZY)
110
    @OneToOne(fetch = FetchType.LAZY)
102
	@JoinColumn(name = "purchase_id", insertable = false, updatable = false, nullable = false, referencedColumnName = "id")
111
    @JoinColumn(name = "purchase_id", insertable = false, updatable = false, nullable = false, referencedColumnName = "id")
103
	private Purchase purchase;
112
    private Purchase purchase;
104
 
113
 
105
	public void setUnitPrice(float unitPrice) {
114
    public void setUnitPrice(float unitPrice) {
106
		this.unitPrice = unitPrice;
115
        this.unitPrice = unitPrice;
107
	}
116
    }
108
 
117
 
109
	@Transient
118
    @Transient
110
	private String itemDescription;
119
    private String itemDescription;
111
 
120
 
112
	@Transient
121
    @Transient
113
	private LocalDateTime activatedTimestamp;
122
    private LocalDateTime activatedTimestamp;
114
 
123
 
115
	@Transient
124
    @Transient
116
	private boolean priceDropValidated = true;
125
    private boolean priceDropValidated = true;
117
 
126
 
118
	@Transient
127
    @Transient
119
	private String pdValidationFailedReason = null;
128
    private String pdValidationFailedReason = null;
120
 
129
 
121
	@Override
130
    @Override
122
	public boolean equals(Object o) {
131
    public boolean equals(Object o) {
123
		if (this == o) return true;
132
        if (this == o) return true;
124
		if (o == null || getClass() != o.getClass()) return false;
133
        if (o == null || getClass() != o.getClass()) return false;
125
		InventoryItem that = (InventoryItem) o;
134
        InventoryItem that = (InventoryItem) o;
126
		return id == that.id && itemId == that.itemId && fofoId == that.fofoId && initialQuantity == that.initialQuantity && goodQuantity == that.goodQuantity && badQuantity == that.badQuantity && purchaseId == that.purchaseId && Float.compare(that.unitPrice, unitPrice) == 0 && Float.compare(that.priceDropAmount, priceDropAmount) == 0 && buyBack == that.buyBack && Float.compare(that.igstRate, igstRate) == 0 && Float.compare(that.cgstRate, cgstRate) == 0 && Float.compare(that.sgstRate, sgstRate) == 0 && priceDropValidated == that.priceDropValidated && pdValidationFailedReason == that.pdValidationFailedReason && Objects.equals(serialNumber, that.serialNumber) && Objects.equals(activationTimestamp, that.activationTimestamp) && lastScanType == that.lastScanType && Objects.equals(hsnCode, that.hsnCode) && Objects.equals(createTimestamp, that.createTimestamp) && Objects.equals(updateTimestamp, that.updateTimestamp) && Objects.equals(item, that.item) && Objects.equals(purchase, that.purchase) && Objects.equals(itemDescription, that.itemDescription) && Objects.equals(activatedTimestamp, that.activatedTimestamp);
135
        return id == that.id && itemId == that.itemId && fofoId == that.fofoId && initialQuantity == that.initialQuantity && goodQuantity == that.goodQuantity && badQuantity == that.badQuantity && purchaseId == that.purchaseId && Float.compare(that.unitPrice, unitPrice) == 0 && Float.compare(that.priceDropAmount, priceDropAmount) == 0 && buyBack == that.buyBack && Float.compare(that.igstRate, igstRate) == 0 && Float.compare(that.cgstRate, cgstRate) == 0 && Float.compare(that.sgstRate, sgstRate) == 0 && priceDropValidated == that.priceDropValidated && pdValidationFailedReason == that.pdValidationFailedReason && Objects.equals(serialNumber, that.serialNumber) && Objects.equals(activationTimestamp, that.activationTimestamp) && lastScanType == that.lastScanType && Objects.equals(hsnCode, that.hsnCode) && Objects.equals(createTimestamp, that.createTimestamp) && Objects.equals(updateTimestamp, that.updateTimestamp) && Objects.equals(item, that.item) && Objects.equals(purchase, that.purchase) && Objects.equals(itemDescription, that.itemDescription) && Objects.equals(activatedTimestamp, that.activatedTimestamp);
127
	}
136
    }
128
 
137
 
129
	@Override
138
    @Override
130
	public int hashCode() {
139
    public int hashCode() {
131
		return Objects.hash(id, itemId, fofoId, serialNumber, initialQuantity, goodQuantity, badQuantity, activationTimestamp, lastScanType, purchaseId, unitPrice, priceDropAmount, buyBack, igstRate, cgstRate, sgstRate, hsnCode, createTimestamp, updateTimestamp, item, purchase, itemDescription, activatedTimestamp, priceDropValidated, pdValidationFailedReason);
140
        return Objects.hash(id, itemId, fofoId, serialNumber, initialQuantity, goodQuantity, badQuantity, activationTimestamp, lastScanType, purchaseId, unitPrice, priceDropAmount, buyBack, igstRate, cgstRate, sgstRate, hsnCode, createTimestamp, updateTimestamp, item, purchase, itemDescription, activatedTimestamp, priceDropValidated, pdValidationFailedReason);
132
	}
141
    }
133
 
142
 
134
	public String getPdValidationFailedReason() {
143
    public String getPdValidationFailedReason() {
135
		return pdValidationFailedReason;
144
        return pdValidationFailedReason;
136
	}
145
    }
137
 
146
 
138
	public void setPdValidationFailedReason(String pdValidationFailedReason) {
147
    public void setPdValidationFailedReason(String pdValidationFailedReason) {
139
		this.pdValidationFailedReason = pdValidationFailedReason;
148
        this.pdValidationFailedReason = pdValidationFailedReason;
140
	}
149
    }
141
 
150
 
142
	@Override
151
    @Override
143
	public String toString() {
152
    public String toString() {
144
		return "InventoryItem{" +
153
        return "InventoryItem{" +
145
				"id=" + id +
154
                "id=" + id +
146
				", itemId=" + itemId +
155
                ", itemId=" + itemId +
147
				", fofoId=" + fofoId +
156
                ", fofoId=" + fofoId +
148
				", serialNumber='" + serialNumber + '\'' +
157
                ", serialNumber='" + serialNumber + '\'' +
149
				", initialQuantity=" + initialQuantity +
158
                ", initialQuantity=" + initialQuantity +
150
				", goodQuantity=" + goodQuantity +
159
                ", goodQuantity=" + goodQuantity +
151
				", badQuantity=" + badQuantity +
160
                ", badQuantity=" + badQuantity +
152
				", activationTimestamp=" + activationTimestamp +
161
                ", activationTimestamp=" + activationTimestamp +
153
				", lastScanType=" + lastScanType +
162
                ", lastScanType=" + lastScanType +
154
				", purchaseId=" + purchaseId +
163
                ", purchaseId=" + purchaseId +
155
				", unitPrice=" + unitPrice +
164
                ", unitPrice=" + unitPrice +
156
				", priceDropAmount=" + priceDropAmount +
165
                ", priceDropAmount=" + priceDropAmount +
157
				", buyBack=" + buyBack +
166
                ", buyBack=" + buyBack +
158
				", igstRate=" + igstRate +
167
                ", igstRate=" + igstRate +
159
				", cgstRate=" + cgstRate +
168
                ", cgstRate=" + cgstRate +
160
				", sgstRate=" + sgstRate +
169
                ", sgstRate=" + sgstRate +
161
				", hsnCode='" + hsnCode + '\'' +
170
                ", hsnCode='" + hsnCode + '\'' +
162
				", createTimestamp=" + createTimestamp +
171
                ", createTimestamp=" + createTimestamp +
163
				", updateTimestamp=" + updateTimestamp +
172
                ", updateTimestamp=" + updateTimestamp +
164
				", item=" + item +
173
                ", item=" + item +
165
				", purchase=" + purchase +
174
                ", purchase=" + purchase +
166
				", itemDescription='" + itemDescription + '\'' +
175
                ", itemDescription='" + itemDescription + '\'' +
167
				", activatedTimestamp=" + activatedTimestamp +
176
                ", activatedTimestamp=" + activatedTimestamp +
168
				", priceDropValidated=" + priceDropValidated +
177
                ", priceDropValidated=" + priceDropValidated +
169
				", pdValidationFailedReason='" + pdValidationFailedReason + '\'' +
178
                ", pdValidationFailedReason='" + pdValidationFailedReason + '\'' +
170
				'}';
179
                '}';
171
	}
180
    }
172
 
181
 
173
	public LocalDateTime getActivatedTimestamp() {
182
    public LocalDateTime getActivatedTimestamp() {
174
		return activatedTimestamp;
183
        return activatedTimestamp;
175
	}
184
    }
176
 
185
 
177
	public void setActivatedTimestamp(LocalDateTime activatedTimestamp) {
186
    public void setActivatedTimestamp(LocalDateTime activatedTimestamp) {
178
		this.activatedTimestamp = activatedTimestamp;
187
        this.activatedTimestamp = activatedTimestamp;
179
	}
188
    }
180
 
189
 
181
	public int getId() {
190
    public int getId() {
182
		return id;
191
        return id;
183
	}
192
    }
184
 
193
 
185
	public void setId(int id) {
194
    public void setId(int id) {
186
		this.id = id;
195
        this.id = id;
187
	}
196
    }
188
 
197
 
189
	public int getItemId() {
198
    public int getItemId() {
190
		return itemId;
199
        return itemId;
191
	}
200
    }
192
 
201
 
193
	public void setItemId(int itemId) {
202
    public void setItemId(int itemId) {
194
		this.itemId = itemId;
203
        this.itemId = itemId;
195
	}
204
    }
196
 
205
 
197
	public void setFofoId(int fofoId) {
206
    public void setFofoId(int fofoId) {
198
		this.fofoId = fofoId;
207
        this.fofoId = fofoId;
199
	}
208
    }
200
 
209
 
201
	public int getFofoId() {
210
    public int getFofoId() {
202
		return fofoId;
211
        return fofoId;
203
	}
212
    }
204
 
213
 
205
	public String getSerialNumber() {
214
    public String getSerialNumber() {
206
		return serialNumber==null ? serialNumber : serialNumber.toLowerCase();
215
        return serialNumber == null ? serialNumber : serialNumber.toLowerCase();
207
	}
216
    }
208
 
217
 
209
	public void setSerialNumber(String serialNumber) {
218
    public void setSerialNumber(String serialNumber) {
210
		this.serialNumber = serialNumber==null ? serialNumber : serialNumber.toLowerCase();
219
        this.serialNumber = serialNumber == null ? serialNumber : serialNumber.toLowerCase();
211
	}
220
    }
212
 
221
 
213
	public int getInitialQuantity() {
222
    public int getInitialQuantity() {
214
		return initialQuantity;
223
        return initialQuantity;
215
	}
224
    }
216
 
225
 
217
	public float getUnitPrice() {
226
    public float getUnitPrice() {
218
		return unitPrice;
227
        return unitPrice;
219
	}
228
    }
220
 
229
 
221
	public void setUnitPrice(Float unitPrice) {
230
    public void setUnitPrice(Float unitPrice) {
222
		this.unitPrice = unitPrice;
231
        this.unitPrice = unitPrice;
223
	}
232
    }
224
 
233
 
225
	public void setInitialQuantity(int initialQuantity) {
234
    public void setInitialQuantity(int initialQuantity) {
226
		this.initialQuantity = initialQuantity;
235
        this.initialQuantity = initialQuantity;
227
	}
236
    }
228
 
237
 
229
	public float getNetPrice() {
238
    public float getNetPrice() {
230
		return unitPrice - priceDropAmount;
239
        return unitPrice - priceDropAmount;
231
	}
240
    }
232
 
241
 
233
	public int getGoodQuantity() {
242
    public int getGoodQuantity() {
234
		return goodQuantity;
243
        return goodQuantity;
235
	}
244
    }
236
 
245
 
237
	public void setGoodQuantity(int goodQuantity) {
246
    public void setGoodQuantity(int goodQuantity) {
238
		this.goodQuantity = goodQuantity;
247
        this.goodQuantity = goodQuantity;
239
	}
248
    }
240
 
249
 
241
	public int getBadQuantity() {
250
    public int getBadQuantity() {
242
		return badQuantity;
251
        return badQuantity;
243
	}
252
    }
244
 
253
 
245
	public void setBadQuantity(int badQuantity) {
254
    public void setBadQuantity(int badQuantity) {
246
		this.badQuantity = badQuantity;
255
        this.badQuantity = badQuantity;
247
	}
256
    }
248
 
257
 
249
	public ScanType getLastScanType() {
258
    public ScanType getLastScanType() {
250
		return lastScanType;
259
        return lastScanType;
251
	}
260
    }
252
 
261
 
253
	public void setLastScanType(ScanType lastScanType) {
262
    public void setLastScanType(ScanType lastScanType) {
254
		this.lastScanType = lastScanType;
263
        this.lastScanType = lastScanType;
255
	}
264
    }
256
 
265
 
257
	public int getPurchaseId() {
266
    public int getPurchaseId() {
258
		return purchaseId;
267
        return purchaseId;
259
	}
268
    }
260
 
269
 
261
	public void setPurchaseId(int purchaseId) {
270
    public void setPurchaseId(int purchaseId) {
262
		this.purchaseId = purchaseId;
271
        this.purchaseId = purchaseId;
263
	}
272
    }
264
 
273
 
265
	public float getPriceDropAmount() {
274
    public float getPriceDropAmount() {
266
		return priceDropAmount;
275
        return priceDropAmount;
267
	}
276
    }
268
 
277
 
269
	public void setPriceDropAmount(float priceDropAmount) {
278
    public void setPriceDropAmount(float priceDropAmount) {
270
		this.priceDropAmount = priceDropAmount;
279
        this.priceDropAmount = priceDropAmount;
271
	}
280
    }
272
 
281
 
273
	public float getIgstRate() {
282
    public float getIgstRate() {
274
		return igstRate;
283
        return igstRate;
275
	}
284
    }
276
 
285
 
277
	public void setIgstRate(float igstRate) {
286
    public void setIgstRate(float igstRate) {
278
		this.igstRate = igstRate;
287
        this.igstRate = igstRate;
279
	}
288
    }
280
 
289
 
281
	public float getCgstRate() {
290
    public float getCgstRate() {
282
		return cgstRate;
291
        return cgstRate;
283
	}
292
    }
284
 
293
 
285
	public void setCgstRate(float cgstRate) {
294
    public void setCgstRate(float cgstRate) {
286
		this.cgstRate = cgstRate;
295
        this.cgstRate = cgstRate;
287
	}
296
    }
288
 
297
 
289
	public float getSgstRate() {
298
    public float getSgstRate() {
290
		return sgstRate;
299
        return sgstRate;
291
	}
300
    }
292
 
301
 
293
	public void setSgstRate(float sgstRate) {
302
    public void setSgstRate(float sgstRate) {
294
		this.sgstRate = sgstRate;
303
        this.sgstRate = sgstRate;
295
	}
304
    }
296
 
305
 
297
	public String getHsnCode() {
306
    public String getHsnCode() {
298
		return hsnCode;
307
        return hsnCode;
299
	}
308
    }
300
 
309
 
301
	public void setHsnCode(String hsnCode) {
310
    public void setHsnCode(String hsnCode) {
302
		this.hsnCode = hsnCode;
311
        this.hsnCode = hsnCode;
303
	}
312
    }
304
 
313
 
305
	public LocalDateTime getCreateTimestamp() {
314
    public LocalDateTime getCreateTimestamp() {
306
		return createTimestamp;
315
        return createTimestamp;
307
	}
316
    }
308
 
317
 
309
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
318
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
310
		this.createTimestamp = createTimestamp;
319
        this.createTimestamp = createTimestamp;
311
	}
320
    }
312
 
321
 
313
	public LocalDateTime getUpdateTimestamp() {
322
    public LocalDateTime getUpdateTimestamp() {
314
		return updateTimestamp;
323
        return updateTimestamp;
315
	}
324
    }
316
 
325
 
317
	public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
326
    public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
318
		this.updateTimestamp = updateTimestamp;
327
        this.updateTimestamp = updateTimestamp;
319
	}
328
    }
320
 
329
 
321
	public Item getItem() {
330
    public Item getItem() {
322
		return item;
331
        return item;
323
	}
332
    }
324
 
333
 
325
	public void setItem(Item item) {
334
    public void setItem(Item item) {
326
		this.item = item;
335
        this.item = item;
327
	}
336
    }
328
 
337
 
329
	public boolean isBuyBack() {
338
    public boolean isBuyBack() {
330
		return buyBack;
339
        return buyBack;
331
	}
340
    }
332
 
341
 
333
	public void setBuyBack(boolean buyBack) {
342
    public void setBuyBack(boolean buyBack) {
334
		this.buyBack = buyBack;
343
        this.buyBack = buyBack;
335
	}
344
    }
336
 
345
 
337
	public Purchase getPurchase() {
346
    public Purchase getPurchase() {
338
		return purchase;
347
        return purchase;
339
	}
348
    }
340
 
349
 
341
	public double getMarginPercentage(double amount) {
350
    public double getMarginPercentage(double amount) {
342
		return amount / this.getNetPrice() * (100 + this.getCgstRate() + this.getIgstRate() + this.getSgstRate());
351
        return amount / this.getNetPrice() * (100 + this.getCgstRate() + this.getIgstRate() + this.getSgstRate());
343
	}
352
    }
344
 
353
 
345
	public void setPurchase(Purchase purchase) {
354
    public void setPurchase(Purchase purchase) {
346
		this.purchase = purchase;
355
        this.purchase = purchase;
347
	}
356
    }
348
 
357
 
349
	public String getFormattedCreateTimestamp() {
358
    public String getFormattedCreateTimestamp() {
350
		if (createTimestamp == null) {
359
        if (createTimestamp == null) {
351
			return null;
360
            return null;
352
		}
361
        }
353
		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");
362
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");
354
		return createTimestamp.format(formatter);
363
        return createTimestamp.format(formatter);
355
	}
364
    }
356
 
365
 
357
	public String getItemDescription() {
366
    public String getItemDescription() {
358
		return itemDescription;
367
        return itemDescription;
359
	}
368
    }
360
 
369
 
361
	public void setItemDescription(String itemDescription) {
370
    public void setItemDescription(String itemDescription) {
362
		this.itemDescription = itemDescription;
371
        this.itemDescription = itemDescription;
363
	}
372
    }
364
 
373
 
365
	public LocalDateTime getActivationTimestamp() {
374
    public LocalDateTime getActivationTimestamp() {
366
		return activationTimestamp;
375
        return activationTimestamp;
367
	}
376
    }
368
 
377
 
369
	public void setActivationTimestamp(LocalDateTime activationTimestamp) {
378
    public void setActivationTimestamp(LocalDateTime activationTimestamp) {
370
		this.activationTimestamp = activationTimestamp;
379
        this.activationTimestamp = activationTimestamp;
371
	}
380
    }
372
 
381
 
373
	public boolean isPriceDropValidated() {
382
    public boolean isPriceDropValidated() {
374
		return priceDropValidated;
383
        return priceDropValidated;
375
	}
384
    }
376
 
385
 
377
	public void setPriceDropValidated(boolean priceDropValidated) {
386
    public void setPriceDropValidated(boolean priceDropValidated) {
378
		this.priceDropValidated = priceDropValidated;
387
        this.priceDropValidated = priceDropValidated;
379
	}
388
    }
380
 
389
 
381
	@Override
390
    @Override
382
	public int compareTo(Object o) {
391
    public int compareTo(Object o) {
383
		return o.hashCode() - this.hashCode();
392
        return o.hashCode() - this.hashCode();
384
	}
393
    }
385
 
394
 
386
}
395
}