| 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());
|
|
|
19 |
logixModel.setType(fofoOrder.getCancelledTimestamp() == null ? "SALE" : "RETURN");
|
|
|
20 |
//logixModel.setTax();
|
|
|
21 |
logixModel.setSale(fofoOrder.getTotalAmount());
|
|
|
22 |
logixModel.setDiscount(0);
|
|
|
23 |
logixModel.setBillNumber(fofoOrder.getInvoiceNumber());
|
|
|
24 |
return logixModel;
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
@Override
|
|
|
28 |
public String toString() {
|
|
|
29 |
return "LogixModel{" +
|
|
|
30 |
"billDate='" + billDate + '\'' +
|
|
|
31 |
", billNumber='" + billNumber + '\'' +
|
|
|
32 |
", sale=" + sale +
|
|
|
33 |
", tax=" + tax +
|
|
|
34 |
", discount=" + discount +
|
|
|
35 |
", type='" + type + '\'' +
|
|
|
36 |
'}';
|
|
|
37 |
}
|
|
|
38 |
|
|
|
39 |
public LocalDateTime getBillDate() {
|
|
|
40 |
return billDate;
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
public void setBillDate(LocalDateTime billDate) {
|
|
|
44 |
this.billDate = billDate;
|
|
|
45 |
}
|
|
|
46 |
|
|
|
47 |
public String getBillNumber() {
|
|
|
48 |
return billNumber;
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
public void setBillNumber(String billNumber) {
|
|
|
52 |
this.billNumber = billNumber;
|
|
|
53 |
}
|
|
|
54 |
|
|
|
55 |
public double getSale() {
|
|
|
56 |
return sale;
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
public void setSale(double sale) {
|
|
|
60 |
this.sale = sale;
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
public double getTax() {
|
|
|
64 |
return tax;
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
public void setTax(double tax) {
|
|
|
68 |
this.tax = tax;
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
public double getDiscount() {
|
|
|
72 |
return discount;
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
public void setDiscount(double discount) {
|
|
|
76 |
this.discount = discount;
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
public String getType() {
|
|
|
80 |
return type;
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
public void setType(String type) {
|
|
|
84 |
this.type = type;
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
@Override
|
|
|
88 |
public boolean equals(Object o) {
|
|
|
89 |
if (this == o) return true;
|
|
|
90 |
if (o == null || getClass() != o.getClass()) return false;
|
|
|
91 |
LogixModel that = (LogixModel) o;
|
|
|
92 |
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);
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
@Override
|
|
|
96 |
public int hashCode() {
|
|
|
97 |
return Objects.hash(billDate, billNumber, sale, tax, discount, type);
|
|
|
98 |
}
|
|
|
99 |
}
|