Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

package com.spice.profitmandi.dao.entity.fofo;

import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * One reversed debit-note return of a single unit: the goods never reached the warehouse, so the
 * refund, the stock movement and the credit note were undone. Also the idempotency guard - one row
 * per purchase_return_item.
 */
@Entity
@Table(name = "fofo.return_reversal")
public class ReturnReversal implements Serializable {

        private static final long serialVersionUID = 1L;

        public enum GstAction {
                /** The CN's IRN was still inside NIC's 24h window and was cancelled outright. */
                IRN_CANCELLED,
                /** Past the window: a DBN was issued against the CN. */
                DEBIT_NOTE,
                /** The CN was never filed at NIC (DC, B2C, internal) - voided locally. */
                LOCAL_VOID
        }

        @Id
        @Column(name = "id")
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private int id;

        @Column(name = "serial_number")
        private String serialNumber;

        @Column(name = "fofo_id")
        private int fofoId;

        @Column(name = "purchase_return_item_id")
        private int purchaseReturnItemId;

        @Column(name = "debit_note_id")
        private int debitNoteId;

        @Column(name = "order_id")
        private int orderId;

        @Column(name = "warehouse_inventory_item_id")
        private int warehouseInventoryItemId;

        @Column(name = "reversed_scan_id")
        private int reversedScanId;

        @Column(name = "credit_note_id")
        private Integer creditNoteId;

        @Enumerated(EnumType.STRING)
        @Column(name = "gst_action")
        private GstAction gstAction;

        @Column(name = "debit_note_number")
        private String debitNoteNumber;

        @Column(name = "amount")
        private BigDecimal amount;

        @Column(name = "reason")
        private String reason;

        @Column(name = "reversed_by")
        private String reversedBy;

        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "create_timestamp")
        private LocalDateTime createTimestamp = LocalDateTime.now();

        public int getId() {
                return id;
        }

        public String getSerialNumber() {
                return serialNumber;
        }

        public void setSerialNumber(String serialNumber) {
                this.serialNumber = serialNumber;
        }

        public int getFofoId() {
                return fofoId;
        }

        public void setFofoId(int fofoId) {
                this.fofoId = fofoId;
        }

        public int getPurchaseReturnItemId() {
                return purchaseReturnItemId;
        }

        public void setPurchaseReturnItemId(int purchaseReturnItemId) {
                this.purchaseReturnItemId = purchaseReturnItemId;
        }

        public int getDebitNoteId() {
                return debitNoteId;
        }

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

        public int getOrderId() {
                return orderId;
        }

        public void setOrderId(int orderId) {
                this.orderId = orderId;
        }

        public int getWarehouseInventoryItemId() {
                return warehouseInventoryItemId;
        }

        public void setWarehouseInventoryItemId(int warehouseInventoryItemId) {
                this.warehouseInventoryItemId = warehouseInventoryItemId;
        }

        public int getReversedScanId() {
                return reversedScanId;
        }

        public void setReversedScanId(int reversedScanId) {
                this.reversedScanId = reversedScanId;
        }

        public Integer getCreditNoteId() {
                return creditNoteId;
        }

        public void setCreditNoteId(Integer creditNoteId) {
                this.creditNoteId = creditNoteId;
        }

        public GstAction getGstAction() {
                return gstAction;
        }

        public void setGstAction(GstAction gstAction) {
                this.gstAction = gstAction;
        }

        public String getDebitNoteNumber() {
                return debitNoteNumber;
        }

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

        public BigDecimal getAmount() {
                return amount;
        }

        public void setAmount(BigDecimal amount) {
                this.amount = amount;
        }

        public String getReason() {
                return reason;
        }

        public void setReason(String reason) {
                this.reason = reason;
        }

        public String getReversedBy() {
                return reversedBy;
        }

        public void setReversedBy(String reversedBy) {
                this.reversedBy = reversedBy;
        }

        public LocalDateTime getCreateTimestamp() {
                return createTimestamp;
        }
}