Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
35033 amit 1
package com.spice.profitmandi.web.controller.logix;
2
 
3
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
4
 
5
import java.time.LocalDateTime;
6
import java.util.Objects;
7
 
8
public class LogixModel {
9
    private LocalDateTime billDate;
10
    private String billNumber;
11
    private double sale;
12
    private double tax;
13
    private double discount;
14
    private String type;
15
 
16
    public static LogixModel from(FofoOrder fofoOrder) {
17
        LogixModel logixModel = new LogixModel();
18
        logixModel.setBillDate(fofoOrder.getCreateTimestamp());
35048 amit 19
        logixModel.setType("SALE");
35033 amit 20
        //logixModel.setTax();
21
        logixModel.setSale(fofoOrder.getTotalAmount());
22
        logixModel.setDiscount(0);
23
        logixModel.setBillNumber(fofoOrder.getInvoiceNumber());
24
        return logixModel;
25
    }
26
 
35048 amit 27
    public static LogixModel fromCancelled(FofoOrder fofoOrder) {
28
        LogixModel logixModel = new LogixModel();
29
        logixModel.setBillDate(fofoOrder.getCreateTimestamp());
30
        logixModel.setType("RETURN");
31
        //logixModel.setTax();
32
        logixModel.setSale(fofoOrder.getTotalAmount());
33
        logixModel.setDiscount(0);
34
        logixModel.setBillNumber(fofoOrder.getInvoiceNumber());
35
        return logixModel;
36
    }
37
 
35033 amit 38
    @Override
39
    public String toString() {
40
        return "LogixModel{" +
41
                "billDate='" + billDate + '\'' +
42
                ", billNumber='" + billNumber + '\'' +
43
                ", sale=" + sale +
44
                ", tax=" + tax +
45
                ", discount=" + discount +
46
                ", type='" + type + '\'' +
47
                '}';
48
    }
49
 
50
    public LocalDateTime getBillDate() {
51
        return billDate;
52
    }
53
 
54
    public void setBillDate(LocalDateTime billDate) {
55
        this.billDate = billDate;
56
    }
57
 
58
    public String getBillNumber() {
59
        return billNumber;
60
    }
61
 
62
    public void setBillNumber(String billNumber) {
63
        this.billNumber = billNumber;
64
    }
65
 
66
    public double getSale() {
67
        return sale;
68
    }
69
 
70
    public void setSale(double sale) {
71
        this.sale = sale;
72
    }
73
 
74
    public double getTax() {
75
        return tax;
76
    }
77
 
78
    public void setTax(double tax) {
79
        this.tax = tax;
80
    }
81
 
82
    public double getDiscount() {
83
        return discount;
84
    }
85
 
86
    public void setDiscount(double discount) {
87
        this.discount = discount;
88
    }
89
 
90
    public String getType() {
91
        return type;
92
    }
93
 
94
    public void setType(String type) {
95
        this.type = type;
96
    }
97
 
98
    @Override
99
    public boolean equals(Object o) {
100
        if (this == o) return true;
101
        if (o == null || getClass() != o.getClass()) return false;
102
        LogixModel that = (LogixModel) o;
103
        return Double.compare(sale, that.sale) == 0 && Double.compare(tax, that.tax) == 0 && Double.compare(discount, that.discount) == 0 && Objects.equals(billDate, that.billDate) && Objects.equals(billNumber, that.billNumber) && Objects.equals(type, that.type);
104
    }
105
 
106
    @Override
107
    public int hashCode() {
108
        return Objects.hash(billDate, billNumber, sale, tax, discount, type);
109
    }
110
}