Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

package com.spice.profitmandi.web.model;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;

/**
 * One row of the Sale Returns action-pending queue. A pending return can exist in two shapes -
 * a debit note the warehouse has not received yet (no purchase return order at all), or a return
 * order that is received/rejected but not settled - so the screen needs a single flattened row
 * rather than the two entity types.
 */
public class SaleReturnRow {

        public static final String ACTION_RECEIVE = "RECEIVE";
        public static final String ACTION_REFUND = "REFUND";
        public static final String ACTION_ACKNOWLEDGE = "ACKNOWLEDGE";
        public static final String ACTION_APPROVE = "APPROVE";

        private Integer debitNoteId;
        private String debitNoteNumber;
        private Integer purchaseReturnOrderId;
        private String invoiceNumber;
        private String partnerName;
        private String warehouseName;
        private String statusLabel;
        private String statusStyle;
        private String dateLabel;
        private LocalDateTime pendingSince;
        private String pendingAction;

        public Integer getDebitNoteId() {
                return debitNoteId;
        }

        public void setDebitNoteId(Integer debitNoteId) {
                this.debitNoteId = debitNoteId;
        }

        public String getDebitNoteNumber() {
                return debitNoteNumber;
        }

        public void setDebitNoteNumber(String debitNoteNumber) {
                this.debitNoteNumber = debitNoteNumber;
        }

        public Integer getPurchaseReturnOrderId() {
                return purchaseReturnOrderId;
        }

        public void setPurchaseReturnOrderId(Integer purchaseReturnOrderId) {
                this.purchaseReturnOrderId = purchaseReturnOrderId;
        }

        public String getInvoiceNumber() {
                return invoiceNumber;
        }

        public void setInvoiceNumber(String invoiceNumber) {
                this.invoiceNumber = invoiceNumber;
        }

        public String getPartnerName() {
                return partnerName;
        }

        public void setPartnerName(String partnerName) {
                this.partnerName = partnerName;
        }

        public String getWarehouseName() {
                return warehouseName;
        }

        public void setWarehouseName(String warehouseName) {
                this.warehouseName = warehouseName;
        }

        public String getStatusLabel() {
                return statusLabel;
        }

        public void setStatusLabel(String statusLabel) {
                this.statusLabel = statusLabel;
        }

        public String getStatusStyle() {
                return statusStyle;
        }

        public void setStatusStyle(String statusStyle) {
                this.statusStyle = statusStyle;
        }

        public String getDateLabel() {
                return dateLabel;
        }

        public void setDateLabel(String dateLabel) {
                this.dateLabel = dateLabel;
        }

        public LocalDateTime getPendingSince() {
                return pendingSince;
        }

        public void setPendingSince(LocalDateTime pendingSince) {
                this.pendingSince = pendingSince;
        }

        public String getPendingAction() {
                return pendingAction;
        }

        public void setPendingAction(String pendingAction) {
                this.pendingAction = pendingAction;
        }

        public String getFormattedPendingSince() {
                if (pendingSince == null) return null;
                return pendingSince.format(DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm"));
        }

        public long getPendingDays() {
                if (pendingSince == null) return 0;
                return ChronoUnit.DAYS.between(pendingSince, LocalDateTime.now());
        }
}