diff --git a/api/src/main/java/org/openmrs/module/openhmis/inventory/api/model/ItemStock.java b/api/src/main/java/org/openmrs/module/openhmis/inventory/api/model/ItemStock.java index 0d52b142..b351ddc4 100644 --- a/api/src/main/java/org/openmrs/module/openhmis/inventory/api/model/ItemStock.java +++ b/api/src/main/java/org/openmrs/module/openhmis/inventory/api/model/ItemStock.java @@ -32,6 +32,15 @@ public class ItemStock extends BaseOpenmrsObject implements Comparable details; private String batchNumber; + private String inwardNumber; + + public String getInwardNumber() { + return inwardNumber; + } + + public void setInwardNumber(String inwardNumber) { + this.inwardNumber = inwardNumber; + } public String getBatchNumber() { return batchNumber; diff --git a/api/src/main/java/org/openmrs/module/openhmis/inventory/api/model/ItemStockDetail.java b/api/src/main/java/org/openmrs/module/openhmis/inventory/api/model/ItemStockDetail.java index 154f3999..64d4846a 100644 --- a/api/src/main/java/org/openmrs/module/openhmis/inventory/api/model/ItemStockDetail.java +++ b/api/src/main/java/org/openmrs/module/openhmis/inventory/api/model/ItemStockDetail.java @@ -54,6 +54,7 @@ public ItemStockDetail(ItemStock stock, StockOperationTransaction tx) { this.setCalculatedExpiration(tx.isCalculatedExpiration()); this.setCalculatedBatch(tx.isCalculatedBatch()); this.setQuantity(tx.getQuantity()); + this.setInwardNumber(tx.getInwardNumber()); } /** @@ -76,6 +77,7 @@ public ItemStockDetail(ItemStockDetail base) { setCalculatedBatch(base.isCalculatedBatch()); setCalculatedExpiration(base.isCalculatedExpiration()); setQuantity(base.getQuantity()); + setInwardNumber(base.getInwardNumber()); } /** diff --git a/api/src/main/java/org/openmrs/module/openhmis/inventory/api/model/ItemStockDetailBase.java b/api/src/main/java/org/openmrs/module/openhmis/inventory/api/model/ItemStockDetailBase.java index 4655dd7f..51528a6c 100644 --- a/api/src/main/java/org/openmrs/module/openhmis/inventory/api/model/ItemStockDetailBase.java +++ b/api/src/main/java/org/openmrs/module/openhmis/inventory/api/model/ItemStockDetailBase.java @@ -33,6 +33,24 @@ public class ItemStockDetailBase extends BaseOpenmrsObject { private Boolean calculatedBatch; private String batchNumber; + private String inwardNumber; + private Date inwardDate; + + public Date getInwardDate() { + return inwardDate; + } + + public void setInwardDate(Date inwardDate) { + this.inwardDate = inwardDate; + } + + public String getInwardNumber() { + return inwardNumber; + } + + public void setInwardNumber(String inwardNumber) { + this.inwardNumber = inwardNumber; + } public String getBatchNumber() { return batchNumber; diff --git a/api/src/main/java/org/openmrs/module/openhmis/inventory/api/model/StockOperation.java b/api/src/main/java/org/openmrs/module/openhmis/inventory/api/model/StockOperation.java index 6d7e334e..20449611 100644 --- a/api/src/main/java/org/openmrs/module/openhmis/inventory/api/model/StockOperation.java +++ b/api/src/main/java/org/openmrs/module/openhmis/inventory/api/model/StockOperation.java @@ -54,6 +54,8 @@ public class StockOperation extends BaseInstanceCustomizableMetadata - + @@ -180,9 +180,10 @@ + - + diff --git a/omod/src/main/resources/liquibase.xml b/omod/src/main/resources/liquibase.xml index 5eadf680..f59449df 100644 --- a/omod/src/main/resources/liquibase.xml +++ b/omod/src/main/resources/liquibase.xml @@ -1120,6 +1120,15 @@ ALTER TABLE inv_item_stock_detail ADD COLUMN batch_number VARCHAR(15) AFTER batch_operation_id; + + + SELECT COUNT(*) FROM information_schema.columns WHERE table_name = 'inv_item_stock_detail' AND column_name = 'inward_number' + + Adding Inward Number column in inv_item_stock_detail table + + ALTER TABLE inv_item_stock_detail ADD COLUMN inward_number VARCHAR(15); + + SELECT COUNT(*) FROM information_schema.columns WHERE table_name = 'inv_stock_operation' AND column_name = 'outward_id' @@ -1129,6 +1138,24 @@ ALTER TABLE inv_stock_operation ADD COLUMN outward_id VARCHAR(30); + + + SELECT COUNT(*) FROM information_schema.columns WHERE table_name = 'inv_stock_operation' AND column_name = 'institute_id' + + Adding InstituteId column in inv_stock_operation table + + ALTER TABLE inv_stock_operation ADD COLUMN institute_id VARCHAR(30); + + + + + SELECT COUNT(*) FROM information_schema.columns WHERE table_name = 'inv_stock_operation' AND column_name = 'inward_date' + + Adding inward_date column in inv_stock_operation table + + ALTER TABLE inv_stock_operation ADD COLUMN inward_date DATETIME; + + select count(*) from inv_item_attribute_type where name = 'eAushadhaID' diff --git a/omod_1.x/src/main/java/org/openmrs/module/webservices/rest/resource/ItemStockDetailBaseResource.java b/omod_1.x/src/main/java/org/openmrs/module/webservices/rest/resource/ItemStockDetailBaseResource.java index cf73a896..1a060ecc 100644 --- a/omod_1.x/src/main/java/org/openmrs/module/webservices/rest/resource/ItemStockDetailBaseResource.java +++ b/omod_1.x/src/main/java/org/openmrs/module/webservices/rest/resource/ItemStockDetailBaseResource.java @@ -56,4 +56,12 @@ public void setBatchNumber(ItemStockDetailBase instance, String batchNumber) { } instance.setBatchNumber(batchNumber); } + + @PropertySetter("inwardNumber") + public void setInwardNumber(ItemStockDetailBase instance, String inwardNumber) { + if (inwardNumber == null || inwardNumber.trim().isEmpty()) { + throw new IllegalArgumentException("Could not parse '" + inwardNumber); + } + instance.setInwardNumber(inwardNumber); + } } diff --git a/omod_1.x/src/main/java/org/openmrs/module/webservices/rest/resource/StockOperationResource.java b/omod_1.x/src/main/java/org/openmrs/module/webservices/rest/resource/StockOperationResource.java index 3934cb56..8bc9270e 100644 --- a/omod_1.x/src/main/java/org/openmrs/module/webservices/rest/resource/StockOperationResource.java +++ b/omod_1.x/src/main/java/org/openmrs/module/webservices/rest/resource/StockOperationResource.java @@ -71,6 +71,8 @@ public class StockOperationResource private boolean submitRequired = false; private boolean rollbackRequired = false; private String outwardId; + private String instituteId; + private Date inwardDate; public StockOperationResource() { this.operationService = Context.getService(IStockOperationService.class); @@ -100,6 +102,8 @@ public DelegatingResourceDescription getRepresentationDescription(Representation description.addProperty("operationOrder", Representation.DEFAULT); description.addProperty("cancelReason", Representation.DEFAULT); description.addProperty("outwardId", Representation.DEFAULT); + description.addProperty("instituteId", Representation.DEFAULT); + description.addProperty("inwardDate", Representation.DEFAULT); if (!(rep instanceof RefRepresentation)) { description.addProperty("source", Representation.REF);