Subversion Repositories SmartDukaan

Rev

Rev 35054 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
35054 amit 1
package com.spice.profitmandi.dao.model;
2
 
35102 amit 3
import com.spice.profitmandi.common.util.FileUtil;
4
import com.spice.profitmandi.common.util.FormattingUtils;
35054 amit 5
import com.spice.profitmandi.dao.enumuration.inventory.CatalogMovingEnum;
6
 
35102 amit 7
import java.io.Serializable;
35054 amit 8
import java.time.Duration;
9
import java.time.LocalDateTime;
35102 amit 10
import java.util.Arrays;
11
import java.util.List;
35054 amit 12
 
13
public class WarehouseItemAgeingModel {
14
    private int itemId;
15
    private int purchaseId;
16
    private String brand;
17
    private String supplierName;
18
    private String modelNumber;
19
    private String modelName;
20
    private String color;
21
    private LocalDateTime invoiceDate;
22
    private LocalDateTime created;
23
    private String warehouseName;
24
    private CatalogMovingEnum status;
25
    private long currentQuantity;
26
 
27
    public WarehouseItemAgeingModel(int itemId, int purchaseId, String brand, String supplierName,
28
                                    String modelNumber, String modelName, String color, LocalDateTime invoiceDate,
29
                                    LocalDateTime created, String warehouseName, CatalogMovingEnum status, long currentQuantity) {
30
        this.itemId = itemId;
31
        this.purchaseId = purchaseId;
32
        this.brand = brand;
33
        this.supplierName = supplierName;
34
        this.modelNumber = modelNumber;
35
        this.modelName = modelName;
36
        this.color = color;
37
        this.invoiceDate = invoiceDate;
38
        this.created = created;
39
        this.warehouseName = warehouseName;
40
        this.status = status;
41
        this.currentQuantity = currentQuantity;
42
    }
43
 
44
    // Getters and setters
45
    public int getItemId() { return itemId; }
46
    public void setItemId(int itemId) { this.itemId = itemId; }
47
 
48
    public int getPurchaseId() { return purchaseId; }
49
    public void setPurchaseId(int purchaseId) { this.purchaseId = purchaseId; }
50
 
51
    public String getBrand() { return brand; }
52
    public void setBrand(String brand) { this.brand = brand; }
53
 
54
    public String getSupplierName() { return supplierName; }
55
    public void setSupplierName(String supplierName) { this.supplierName = supplierName; }
56
 
57
    public String getModelNumber() { return modelNumber; }
58
    public void setModelNumber(String modelNumber) { this.modelNumber = modelNumber; }
59
 
60
    public String getModelName() { return modelName; }
61
    public void setModelName(String modelName) { this.modelName = modelName; }
62
 
63
    public String getColor() { return color; }
64
    public void setColor(String color) { this.color = color; }
65
 
66
    public LocalDateTime getInvoiceDate() { return invoiceDate; }
67
    public void setInvoiceDate(LocalDateTime invoiceDate) { this.invoiceDate = invoiceDate; }
68
 
69
    public LocalDateTime getCreated() { return created; }
70
    public void setCreated(LocalDateTime created) { this.created = created; }
71
 
72
    public String getWarehouseName() { return warehouseName; }
73
    public void setWarehouseName(String warehouseName) { this.warehouseName = warehouseName; }
74
 
75
    public CatalogMovingEnum getStatus() { return status; }
76
    public void setStatus(CatalogMovingEnum status) { this.status = status; }
77
 
78
    public long getCurrentQuantity() { return currentQuantity; }
79
    public void setCurrentQuantity(long currentQuantity) { this.currentQuantity = currentQuantity; }
80
 
81
    @Override
82
    public String toString() {
83
        return "WarehouseItemAgeingModel{" +
84
                "itemId=" + itemId +
85
                ", purchaseId=" + purchaseId +
86
                ", brand='" + brand + '\'' +
87
                ", supplierName='" + supplierName + '\'' +
88
                ", modelNumber='" + modelNumber + '\'' +
89
                ", modelName='" + modelName + '\'' +
90
                ", color='" + color + '\'' +
91
                ", invoiceDate=" + invoiceDate +
92
                ", created=" + created +
93
                ", warehouseName='" + warehouseName + '\'' +
94
                ", status=" + status +
95
                ", currentQuantity=" + currentQuantity +
96
                '}';
97
    }
98
 
99
    public int getAge() {
100
        return (int) Duration.between(this.invoiceDate, LocalDateTime.now()).toDays();
101
    }
35102 amit 102
    public List<? extends Serializable> toRow() {
103
        return Arrays.asList(this.getSupplierName(), this.getStatus(), this.getBrand(), this.getModelName() + " " + this.getModelNumber(), this.getColor(), this.getAge(),
104
                this.getWarehouseName(), FormattingUtils.formatDate(this.getCreated()), this.getCurrentQuantity());
105
    }
35054 amit 106
}