Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
37378 amit 1
package com.spice.profitmandi.web.model;
2
 
3
import java.time.LocalDateTime;
4
import java.time.format.DateTimeFormatter;
5
import java.time.temporal.ChronoUnit;
6
 
7
/**
8
 * One row of the Sale Returns action-pending queue. A pending return can exist in two shapes -
9
 * a debit note the warehouse has not received yet (no purchase return order at all), or a return
10
 * order that is received/rejected but not settled - so the screen needs a single flattened row
11
 * rather than the two entity types.
12
 */
13
public class SaleReturnRow {
14
 
15
	public static final String ACTION_RECEIVE = "RECEIVE";
16
	public static final String ACTION_REFUND = "REFUND";
17
	public static final String ACTION_ACKNOWLEDGE = "ACKNOWLEDGE";
18
	public static final String ACTION_APPROVE = "APPROVE";
19
 
20
	private Integer debitNoteId;
21
	private String debitNoteNumber;
22
	private Integer purchaseReturnOrderId;
23
	private String invoiceNumber;
24
	private String partnerName;
25
	private String warehouseName;
26
	private String statusLabel;
27
	private String statusStyle;
28
	private String dateLabel;
29
	private LocalDateTime pendingSince;
30
	private String pendingAction;
37791 amit 31
	/** NIC has refused this return for a cancelled/invalid buyer GSTIN - from then on only Finance acts on it. */
32
	private boolean irnFailed;
33
	/** The latest refusal was today, so Finance may still refund it as B2C. */
34
	private boolean b2cAvailable;
35
	private String irnFailureReason;
37378 amit 36
 
37791 amit 37
	public boolean isIrnFailed() {
38
		return irnFailed;
39
	}
40
 
41
	public void setIrnFailed(boolean irnFailed) {
42
		this.irnFailed = irnFailed;
43
	}
44
 
45
	public boolean isB2cAvailable() {
46
		return b2cAvailable;
47
	}
48
 
49
	public void setB2cAvailable(boolean b2cAvailable) {
50
		this.b2cAvailable = b2cAvailable;
51
	}
52
 
53
	public String getIrnFailureReason() {
54
		return irnFailureReason;
55
	}
56
 
57
	public void setIrnFailureReason(String irnFailureReason) {
58
		this.irnFailureReason = irnFailureReason;
59
	}
60
 
37378 amit 61
	public Integer getDebitNoteId() {
62
		return debitNoteId;
63
	}
64
 
65
	public void setDebitNoteId(Integer debitNoteId) {
66
		this.debitNoteId = debitNoteId;
67
	}
68
 
69
	public String getDebitNoteNumber() {
70
		return debitNoteNumber;
71
	}
72
 
73
	public void setDebitNoteNumber(String debitNoteNumber) {
74
		this.debitNoteNumber = debitNoteNumber;
75
	}
76
 
77
	public Integer getPurchaseReturnOrderId() {
78
		return purchaseReturnOrderId;
79
	}
80
 
81
	public void setPurchaseReturnOrderId(Integer purchaseReturnOrderId) {
82
		this.purchaseReturnOrderId = purchaseReturnOrderId;
83
	}
84
 
85
	public String getInvoiceNumber() {
86
		return invoiceNumber;
87
	}
88
 
89
	public void setInvoiceNumber(String invoiceNumber) {
90
		this.invoiceNumber = invoiceNumber;
91
	}
92
 
93
	public String getPartnerName() {
94
		return partnerName;
95
	}
96
 
97
	public void setPartnerName(String partnerName) {
98
		this.partnerName = partnerName;
99
	}
100
 
101
	public String getWarehouseName() {
102
		return warehouseName;
103
	}
104
 
105
	public void setWarehouseName(String warehouseName) {
106
		this.warehouseName = warehouseName;
107
	}
108
 
109
	public String getStatusLabel() {
110
		return statusLabel;
111
	}
112
 
113
	public void setStatusLabel(String statusLabel) {
114
		this.statusLabel = statusLabel;
115
	}
116
 
117
	public String getStatusStyle() {
118
		return statusStyle;
119
	}
120
 
121
	public void setStatusStyle(String statusStyle) {
122
		this.statusStyle = statusStyle;
123
	}
124
 
125
	public String getDateLabel() {
126
		return dateLabel;
127
	}
128
 
129
	public void setDateLabel(String dateLabel) {
130
		this.dateLabel = dateLabel;
131
	}
132
 
133
	public LocalDateTime getPendingSince() {
134
		return pendingSince;
135
	}
136
 
137
	public void setPendingSince(LocalDateTime pendingSince) {
138
		this.pendingSince = pendingSince;
139
	}
140
 
141
	public String getPendingAction() {
142
		return pendingAction;
143
	}
144
 
145
	public void setPendingAction(String pendingAction) {
146
		this.pendingAction = pendingAction;
147
	}
148
 
149
	public String getFormattedPendingSince() {
150
		if (pendingSince == null) return null;
151
		return pendingSince.format(DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm"));
152
	}
153
 
154
	public long getPendingDays() {
155
		if (pendingSince == null) return 0;
156
		return ChronoUnit.DAYS.between(pendingSince, LocalDateTime.now());
157
	}
158
}