Skip to content

Commit

Permalink
added reporting center features
Browse files Browse the repository at this point in the history
  • Loading branch information
spbogui committed Jan 10, 2021
1 parent 08ec0d6 commit 2cb0975
Show file tree
Hide file tree
Showing 38 changed files with 1,778 additions and 499 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class ProductAttributeOtherFlux extends AbstractPharmacyObject {
private String label;

@Column(name = "quantity", nullable = false)
private Integer quantity;
private Double quantity;

@ManyToOne
@JoinColumn(name = "operation_id", nullable = false)
Expand Down Expand Up @@ -74,11 +74,11 @@ public void setLabel(String label) {
this.label = label;
}

public Integer getQuantity() {
public Double getQuantity() {
return quantity;
}

public void setQuantity(Integer quantity) {
public void setQuantity(Double quantity) {
this.quantity = quantity;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,6 @@ public interface ProductAttributeFluxService extends OpenmrsService {
Integer getAllProductAttributeOtherFluxByOperationAndProductCount(ProductOperation operation, Product product);
@Authorized(value = {PrivilegeConstants.VIEW_FLUX})
ProductAttributeOtherFlux getOneProductAttributeOtherFluxByProductAndOperation(Product product, ProductOperation productOperation);
@Authorized(value = {PrivilegeConstants.VIEW_FLUX})
ProductAttributeOtherFlux getOneProductAttributeOtherFluxByProductAndOperationAndLabel(Product product, ProductOperation productOperation, String label);
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.openmrs.api.OpenmrsService;
import org.openmrs.module.pharmacy.Product;
import org.openmrs.module.pharmacy.ProductInventory;
import org.openmrs.module.pharmacy.ProductProgram;
import org.openmrs.module.pharmacy.ProductReport;
import org.openmrs.module.pharmacy.models.ProductReportLineDTO;
import org.openmrs.module.pharmacy.utils.PrivilegeConstants;
Expand Down Expand Up @@ -58,6 +59,8 @@ public interface ProductReportService extends OpenmrsService {
List<ProductReport> getAllProductReports(Boolean includeVoided);
@Authorized(value = {PrivilegeConstants.VIEW_REPORT})
ProductReport getOneProductReportById(Integer id);
@Authorized(value = {PrivilegeConstants.VIEW_REPORT})
ProductReport getOneProductReportByReportPeriodAndProgram(String reportPeriod, ProductProgram productProgram, Location location, Boolean includeVoided);
@Authorized(value = {PrivilegeConstants.SAVE_REPORT})
ProductReport saveProductReport(ProductReport productReport);
@Authorized(value = {PrivilegeConstants.SAVE_REPORT})
Expand All @@ -73,11 +76,27 @@ public interface ProductReportService extends OpenmrsService {
@Authorized(value = {PrivilegeConstants.VIEW_REPORT})
Integer getProductQuantityInStockInLastOperationByProduct(Product product, ProductInventory inventory, Location location);
@Authorized(value = {PrivilegeConstants.VIEW_REPORT})
Integer getProductQuantityInStockOperationByProduct(Product product, ProductInventory inventory, Location location);
@Authorized(value = {PrivilegeConstants.VIEW_REPORT})
Integer getProductQuantityLostInLastOperationByProduct(Product product, ProductInventory inventory, Location location);
@Authorized(value = {PrivilegeConstants.VIEW_REPORT})
Integer getProductQuantityAdjustmentInLastOperationByProduct(Product product, ProductInventory inventory, Location location);
@Authorized(value = {PrivilegeConstants.VIEW_REPORT})
Integer getProductQuantityDistributedInLastOperationByProduct(Product product, ProductInventory inventory, Location userLocation);
@Authorized(value = {PrivilegeConstants.VIEW_REPORT})
Integer getChildLocationsThatKnownRupture(Product product, ProductInventory inventory, Location location);
@Authorized(value = {PrivilegeConstants.VIEW_REPORT})
Integer getProductQuantityDistributedInAgo1MonthOperationByProduct(Product product, ProductInventory inventory, Location location);
@Authorized(value = {PrivilegeConstants.VIEW_REPORT})
Integer getProductQuantityDistributedInAgo2MonthOperationByProduct(Product product, ProductInventory inventory, Location location);
@Authorized(value = {PrivilegeConstants.VIEW_REPORT})
Double getProductAverageMonthlyConsumption(Product product, ProductProgram productProgram, Location location, Boolean includeVoided);
@Authorized(value = {PrivilegeConstants.VIEW_REPORT})
List<Product> getAllActivityProducts(ProductInventory inventory);
@Authorized(value = {PrivilegeConstants.VIEW_REPORT})
ProductReport getLastProductReport(Location location, ProductProgram productProgram);
@Authorized(value = {PrivilegeConstants.VIEW_REPORT})
ProductReport getLastProductReportByDate(Location location, ProductProgram productProgram, Date reportDate);
// List<ProductReportReturnDTO> getProductReportReturnDTOs(ProductReport productReport);
// ProductReportReturnDTO getOneProductReportReturnDTO(ProductReport reception, ProductAttribute productAttribute);
// List<ProductReportListDTO> getProductReportListDTOs();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,6 @@ public interface ProductAttributeFluxDAO {
Integer getAllProductAttributeOtherFluxByOperationAndProductCount(ProductOperation operation, Product product);

ProductAttributeOtherFlux getOneProductAttributeOtherFluxByProductAndOperation(Product product, ProductOperation productOperation);

ProductAttributeOtherFlux getOneProductAttributeOtherFluxByProductAndOperationAndLabel(Product product, ProductOperation productOperation, String label);
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,25 @@ public interface ProductReportDAO {
List<ProductReport> getAllSubmittedChildProductReports(Location location, Boolean includeVoided);
List<ProductReport> getAllTreatedChildProductReports(Location location, Boolean includeVoided);
ProductReport getOneProductReportById(Integer id);
ProductReport getOneProductReportByReportPeriodAndProgram(String reportPeriod, ProductProgram productProgram, Location location, Boolean includeVoided);
ProductReport saveProductReport(ProductReport productReport);
ProductReport editProductReport(ProductReport productReport);
void removeProductReport(ProductReport productReport);
ProductReport getOneProductReportByUuid(String uuid);
List<ProductReportLineDTO> getProductReportFluxDTOs(ProductReport productReport);
Integer getProductQuantityInStockOperationByProduct(Product product, ProductInventory inventory, Location location);
Integer getProductReceivedQuantityInLastOperationByProduct(Product product, ProductInventory inventory, Location location);
Integer getProductQuantityInStockInLastOperationByProduct(Product product, ProductInventory inventory, Location location);
Integer getProductInitialQuantityByProduct(Product product, ProductInventory inventory, Location location);
Integer getProductQuantityLostInLastOperationByProduct(Product product, ProductInventory inventory, Location location);
Integer getProductQuantityAdjustmentInLastOperationByProduct(Product product, ProductInventory inventory, Location location);
Integer getProductQuantityDistributedInLastOperationByProduct(Product product, ProductInventory inventory, Location location);
Integer getChildLocationsThatKnownRupture(Product product, ProductInventory inventory, Location location);
Integer getProductQuantityDistributedInAgo1MonthOperationByProduct(Product product, ProductInventory inventory, Location location);
Integer getProductQuantityDistributedInAgo2MonthOperationByProduct(Product product, ProductInventory inventory, Location location);
Double getProductAverageMonthlyConsumption(Product product, ProductProgram productProgram, Location location, Boolean includeVoided);
List<Product> getAllActivityProducts(ProductInventory inventory);
ProductReport getLastProductReport(Location location, ProductProgram productProgram);
ProductReport getLastProductReportByDate(Location location, ProductProgram productProgram, Date reportDate);

// List<ProductReportReturnDTO> getProductReportReturnDTOs(ProductReport productReport);
// ProductReportReturnDTO getOneProductReportReturnDTO(ProductReport reception, ProductAttribute productAttribute);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public Integer getAllProductAttributeOtherFluxByOperationAndProductCount(Product
List<ProductAttributeOtherFlux> fluxes = query.list();
Integer quantity = 0;
for (ProductAttributeOtherFlux flux : fluxes) {
quantity += flux.getQuantity();
quantity += flux.getQuantity().intValue();
}
return quantity;
}
Expand All @@ -242,4 +242,13 @@ public ProductAttributeOtherFlux getOneProductAttributeOtherFluxByProductAndOper
return (ProductAttributeOtherFlux) query.setMaxResults(1).uniqueResult();
}

@Override
public ProductAttributeOtherFlux getOneProductAttributeOtherFluxByProductAndOperationAndLabel(Product product, ProductOperation productOperation, String label) {
Query query = sessionFactory.getCurrentSession().createQuery("FROM ProductAttributeOtherFlux s WHERE s.product = :product AND s.productOperation = :operation AND s.label = :label");
query.setParameter("product", product)
.setParameter("operation", productOperation)
.setParameter("label", label);
return (ProductAttributeOtherFlux) query.setMaxResults(1).uniqueResult();
}

}
Loading

0 comments on commit 2cb0975

Please sign in to comment.