Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update from development branch #9999

Merged
merged 46 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
338b5ec
Merge branch 'development' of https://github.com/hmislk/hmis.git into…
ChinthakaPrasad Dec 26, 2024
b21ae75
Merge branch '#9851_Fix_Report_Format_Excel_Download' of https://gith…
ChinthakaPrasad Dec 26, 2024
c3811c8
Merge branch 'development' of https://github.com/hmislk/hmis.git into…
ChinthakaPrasad Dec 27, 2024
eb29616
Merge branch 'improvements_in_search_family_membership_#9857' of http…
ChinthakaPrasad Dec 27, 2024
7a31b4a
Signed-off-by: SandithP2001 <sandithpivithuru@gmail.com>
SandithP2001 Dec 29, 2024
c098066
fix:disbursement recieve issues fixed.
ChinthakaPrasad Dec 29, 2024
c4de5ee
Merge branch 'development' of https://github.com/hmislk/hmis.git into…
ChinthakaPrasad Dec 29, 2024
de043fd
Merge branch 'po_approval_improvements_#9903' of https://github.com/h…
ChinthakaPrasad Dec 29, 2024
f6a783c
Signed-off-by: Chinthaka Prasad <chinthakaprasad30@gmail.com>
ChinthakaPrasad Dec 29, 2024
9e7acf6
Signed-off-by: Chinthaka Prasad <chinthakaprasad30@gmail.com>
ChinthakaPrasad Dec 29, 2024
6426e98
fix: add validation for cant issue more than requested medicine quant…
ChinthakaPrasad Dec 29, 2024
083fed3
Signed-off-by: SandithP2001 <sandithpivithuru@gmail.com>
SandithP2001 Dec 30, 2024
6b29521
Merge branch '9836-pharmacy_disbursement_and_suplier_isses' of https:…
SandithP2001 Dec 30, 2024
94bf47e
Merge branch 'Issue#9905_Disposal_cancellation' of https://github.com…
SandithP2001 Dec 30, 2024
3cc6c24
Merge branch 'retire_all_pharmacy_related_data_for_admin_#9914' of ht…
SandithP2001 Dec 30, 2024
d9f3e40
Merge branch 'two_persons_are_created_for_each_patient_#9919' of http…
SandithP2001 Dec 30, 2024
94e2ab7
Signed-off-by: SandithP2001 <sandithpivithuru@gmail.com>
SandithP2001 Dec 30, 2024
79ea94f
Signed-off-by: SandithP2001 <sandithpivithuru@gmail.com>
SandithP2001 Dec 30, 2024
23fc5d2
Merge branch 'Issue#9852_Consumption_report' of https://github.com/hm…
SandithP2001 Dec 30, 2024
4a75dfc
Signed-off-by: SandithP2001 <sandithpivithuru@gmail.com>
SandithP2001 Dec 30, 2024
1fa86f0
Signed-off-by: SandithP2001 <sandithpivithuru@gmail.com>
SandithP2001 Dec 30, 2024
19e1b7a
Signed-off-by: SandithP2001 <sandithpivithuru@gmail.com>
SandithP2001 Dec 30, 2024
605ac7c
Signed-off-by: SandithP2001 <sandithpivithuru@gmail.com>
SandithP2001 Dec 30, 2024
002dc08
Signed-off-by: SandithP2001 <sandithpivithuru@gmail.com>
SandithP2001 Dec 30, 2024
6a664d7
Signed-off-by: SandithP2001 <sandithpivithuru@gmail.com>
SandithP2001 Dec 30, 2024
19d530b
Signed-off-by: Pubudu-Piyankara <pubudupiyankara.me@gmail.com>
Pubudu-Piyankara Dec 31, 2024
244c0f9
Signed-off-by: Pubudu-Piyankara <pubudupiyankara.me@gmail.com>
Pubudu-Piyankara Dec 31, 2024
871a01d
Merge branch 'development' into issue#9412_Expiry_Item_Report
ChinthakaPrasad Jan 1, 2025
135d5a7
Merge branch 'development' into issue#9931_Expiry_Item_Improvement
ChinthakaPrasad Jan 1, 2025
3ab01f3
Merge branch 'development' of https://github.com/hmislk/hmis.git into…
Pubudu-Piyankara Jan 1, 2025
adb22e3
Merge pull request #9959 from hmislk/development
GSMgeeth Jan 1, 2025
aa78cf8
Create rh_prod_ci_cd.yml
GSMgeeth Jan 1, 2025
51b34a7
Merge branch 'development' into ruhunu-dev
GSMgeeth Jan 1, 2025
7adb794
Merge pull request #9930 from hmislk/issue#9412_Expiry_Item_Report
Irani96 Jan 2, 2025
cdfb89f
Merge branch 'development' into issue#9931_Expiry_Item_Improvement
SandithP2001 Jan 2, 2025
d11e20e
Merge pull request #9932 from hmislk/issue#9931_Expiry_Item_Improvement
Irani96 Jan 2, 2025
362a146
Merge pull request #9943 from hmislk/Issue#9940_Grn_report_improment
Irani96 Jan 2, 2025
50c2858
Pharmacy retail sale bill error (#9944)
buddhika75 Jan 6, 2025
82b907a
9836 pharmacy disbursement and suplier isses (#9946)
ChinthakaPrasad Jan 6, 2025
d091400
Issue#9949 disbursement issue receive bill improvements (#9950)
Pubudu-Piyankara Jan 6, 2025
dcfb2ee
Issue#9822 discount report (#9954)
ImeshRanawellaSG Jan 6, 2025
629ba10
OPD Weekly Report #9886 (#9955)
ImeshRanawellaSG Jan 6, 2025
2823561
#9960 pharmacy retail sale not available even after starting a new sh…
buddhika75 Jan 6, 2025
f9fd297
Issue#9834/opd and inward due report (#9971)
IsuruUdaraRanaweera Jan 6, 2025
170b108
Merge pull request #9998 from hmislk/development
GSMgeeth Jan 6, 2025
f284119
Merge pull request #10000 from hmislk/ruhunu-dev
GSMgeeth Jan 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/custom_deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- warning
- debug
tags:
description: 'Tags for the workflow'
description: 'Tags of the workflow'
required: true
type: string

Expand Down
260 changes: 208 additions & 52 deletions src/main/java/com/divudi/bean/common/ReportsController.java

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/java/com/divudi/bean/common/SearchController.java
Original file line number Diff line number Diff line change
Expand Up @@ -4265,7 +4265,7 @@ public void createPharmacyAdjustmentBillItemTable() {

sql += " order by bi.id desc";

billItems = getBillItemFacade().findByJpql(sql, m, TemporalType.TIMESTAMP, 50);
billItems = getBillItemFacade().findByJpql(sql, m, TemporalType.TIMESTAMP);

}

Expand Down
55 changes: 23 additions & 32 deletions src/main/java/com/divudi/bean/pharmacy/PharmacyController.java
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,7 @@ public String generateFileNameForReport(String reportName) {
return reportName.trim();
}

@Deprecated
public void generateGRNReportTableByBillItem(List<BillType> bt) {
bills = null;
totalCreditPurchaseValue = 0.0;
Expand Down Expand Up @@ -847,44 +848,44 @@ public void generateGRNReportTableByBillItem(List<BillType> bt) {
}

public String navigateToPrinteGeneratedGrnDetailedRportTable() {
if(bills==null){
if (bills == null) {
JsfUtil.addErrorMessage("No Bills");
return null;
}
if(bills.isEmpty()){
if (bills.isEmpty()) {
JsfUtil.addErrorMessage("Bill List Empty");
return null;
}
for(Bill b:bills){
if(b.getBillItems()==null || b.getBillItems().isEmpty()){
b.setBillItems(billService.fetchBillItems(b));
for (Bill b : bills) {
if (b.getBillItems() == null || b.getBillItems().isEmpty()) {
b.setBillItems(billService.fetchBillItems(b));
}
}
return "/reports/inventoryReports/grn_report_detail_print?faces-redirect=true";
}

public String navigateToPrinteGeneratedGrnReturnReportTable() {
if(bills==null){
if (bills == null) {
JsfUtil.addErrorMessage("No Bills");
return null;
}
if(bills.isEmpty()){
if (bills.isEmpty()) {
JsfUtil.addErrorMessage("Bill List Empty");
return null;
}
for(Bill b:bills){
if(b.getBillItems()==null || b.getBillItems().isEmpty()){
b.setBillItems(billService.fetchBillItems(b));
for (Bill b : bills) {
if (b.getBillItems() == null || b.getBillItems().isEmpty()) {
b.setBillItems(billService.fetchBillItems(b));
}
}
return "/reports/inventoryReports/grn_report_return_print?faces-redirect=true";
}

public String navigateBackToGeneratedGrnDetailedRportTable() {
return "/reports/inventoryReports/grn_report?faces-redirect=true";
}


public void generateGRNReportTable() {
}

public void generateGrnReportTable() {
bills = null;
totalCreditPurchaseValue = 0.0;
totalCashPurchaseValue = 0.0;
Expand All @@ -893,10 +894,8 @@ public void generateGRNReportTable() {
List<BillType> bt = new ArrayList<>();
if ("detailReport".equals(reportType)) {
bt.add(BillType.PharmacyGrnBill);
generateGRNReportTableByBillItem(bt);
} else if ("returnReport".equals(reportType)) {
bt.add(BillType.PharmacyGrnReturn);
generateGRNReportTableByBillItem(bt);
} else if ("summeryReport".equals(reportType)) {
bt.add(BillType.PharmacyGrnBill);
bt.add(BillType.PharmacyGrnReturn);
Expand Down Expand Up @@ -936,10 +935,14 @@ public void generateGRNReportTable() {
tmp.put("pm", paymentMethod);
}

if (fromInstitution != null) {
if (fromInstitution != null && "detailReport".equals(reportType)) {
sql += " AND b.fromInstitution = :supplier";
tmp.put("supplier", fromInstitution);
}
if (fromInstitution != null && "returnReport".equals(reportType)) {
sql += " AND b.toInstitution = :supplier";
tmp.put("supplier", fromInstitution);
}

sql += " order by b.id desc";

Expand Down Expand Up @@ -983,8 +986,8 @@ private void resetFields() {
}

public void generateConsumptionReportTableByBill(BillType billType) {
List<BillType> bt = new ArrayList<>();
bt.add(BillType.PharmacyIssue);
// List<BillType> bt = new ArrayList<>();
// bt.add(BillType.PharmacyIssue);
bills = new ArrayList<>();

String sql = "SELECT b FROM Bill b WHERE b.retired = false"
Expand Down Expand Up @@ -1091,7 +1094,6 @@ public void generateConsumptionReportTableByBillItems(BillType billType) {
}
}

@Deprecated
public void generateConsumptionReportTableAsSummary(BillType billType) {
// Initialize bill types
List<BillType> bt = new ArrayList<>();
Expand Down Expand Up @@ -1488,6 +1490,7 @@ public List<String1Value1> calculateTotalsForBillItems(List<BillItem> billItemLi
}

public void createStockTransferReport() {
resetFields();
BillType bt;

if ("issue".equals(transferType)) {
Expand All @@ -1497,24 +1500,12 @@ public void createStockTransferReport() {
}

if ("summeryReport".equals(reportType)) {

bills = null;
departmentSummaries = null;
issueDepartmentCategoryWiseItems = null;
generateConsumptionReportTableAsSummary(bt);

} else if ("detailReport".equals(reportType)) {

billItems = null;
departmentSummaries = null;
issueDepartmentCategoryWiseItems = null;
generateConsumptionReportTableByBillItems(bt);

} else if ("byBill".equals(reportType)) {

bills = null;
billItems = null;
issueDepartmentCategoryWiseItems = null;
generateConsumptionReportTableByBill(bt);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2069,10 +2069,6 @@ public List<Payment> createMultiplePayments(Bill bill, PaymentMethod pm) {
}

public void settleBillWithPay() {
Date startTime = new Date();
Date fromDate = null;
Date toDate = null;

editingQty = null;

if (sessionController.getApplicationPreference().isCheckPaymentSchemeValidation()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ private void savePreReturnBill() {
getReturnBill().copy(getBill());

getReturnBill().setBillType(BillType.PharmacyPre);
//getReturnBill().setBillTypeAtomic(BillTypeAtomic.PHARMACY_RETAIL_SALE_RETURN_ITEMS_AND_PAYMENTS);

getReturnBill().setBilledBill(getBill());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,21 @@ public String navigateToPharmacyIssueForRequests() {
return "/pharmacy/pharmacy_transfer_issue";
}

// public boolean isFullyIssued() {
// for (BillItem originalItem : billItems) {
//
// if (originalItem.getIssuedPhamaceuticalItemQty() == originalItem.getQty()) {
// if (originalItem.getPharmaceuticalBillItem().getItemBatch() == null) {
// continue;
// }
// System.out.println(originalItem.getIssuedPhamaceuticalItemQty() + " originalItem.getIssuedPhamaceuticalItemQty " + originalItem.getQty() + " originalItem.getQty()");
// return true;
// }
// }
//
// return false;
// }

public boolean isFullyIssued(Bill bill) {
if (bill == null || bill.getBillItems() == null || bill.getBillItems().isEmpty()) {
return false; // Null or empty bills are not considered fully issued
Expand All @@ -114,7 +129,9 @@ public boolean isFullyIssued(Bill bill) {
for (BillItem originalItem : billItems) {

if (originalItem.getPharmaceuticalBillItem().getQty() > 0) {
return false; // If any item's issued quantity is less than its original quantity
return false;
}else if(originalItem.getPharmaceuticalBillItem().getItemBatch() == null){
return false;
}
}

Expand Down Expand Up @@ -251,13 +268,14 @@ public void generateBillComponent() {

double issuableQty = i.getQty() - (Math.abs(billedIssue) - Math.abs(cancelledIssue));

//i.setIssuedPhamaceuticalItemQty(i.getQty() - issuableQty);
List<StockQty> stockQtys = pharmacyBean.getStockByQty(i.getItem(), issuableQty, getSessionController().getDepartment());

for (StockQty sq : stockQtys) {

if (sq.getQty() == 0) {
continue;
}
// if (sq.getQty() == 0) {
// continue;
// }

//Checking User Stock Entity
if (!userStockController.isStockAvailable(sq.getStock(), sq.getQty(), getSessionController().getLoggedUser())) {
Expand All @@ -271,6 +289,15 @@ public void generateBillComponent() {
bItem.setReferanceBillItem(i);
bItem.setQty(i.getQty());
bItem.setTmpQty(sq.getQty());
bItem.setIssuedPhamaceuticalItemQty(i.getQty() - sq.getQty());

if (stockQtys.size() > 1) {
double billedIssueByItemBatch = getPharmacyCalculation().getBilledIssuedByRequestedItemBatch(i, BillType.PharmacyTransferIssue, sq.getStock().getItemBatch());
System.out.println(billedIssueByItemBatch + " billedIssueByItemBatch");
double cancelledIssueByItemBatch = getPharmacyCalculation().getCancelledIssuedByRequestedItemBatch(i, BillType.PharmacyTransferIssue, sq.getStock().getItemBatch());
System.out.println(cancelledIssueByItemBatch + " cancelledIssueByItemBatch");
bItem.setIssuedPhamaceuticalItemQty(Math.abs(billedIssueByItemBatch) + Math.abs(cancelledIssueByItemBatch));
}

// s bItem.setTmpSuggession(getSuggession(i.getBillItem().getItem()));
// //System.err.println("List "+bItem.getTmpSuggession());
Expand All @@ -290,6 +317,15 @@ public void generateBillComponent() {
UserStock us = userStockController.saveUserStock(bItem, getSessionController().getLoggedUser(), usc);
bItem.setTransUserStock(us);

// double totalIssueAmount = 0;
//
// if (stockQtys.size() > 1) {
// for (StockQty s : stockQtys) {
// totalIssueAmount += s.getQty();
// }
// bItem.setIssuedPhamaceuticalItemQty(totalIssueAmount);
//
// }
getBillItems().add(bItem);
flagStockFound = true;

Expand Down Expand Up @@ -512,6 +548,25 @@ public void settle() {
return;
}

for (BillItem bi : getBillItems()) {
if (bi.getPharmaceuticalBillItem().getItemBatch() != null) {
if (bi.getPharmaceuticalBillItem().getStock().getStock() < bi.getPharmaceuticalBillItem().getQty()) {
JsfUtil.addErrorMessage("Available quantity is less than issued quantity in " + bi.getPharmaceuticalBillItem().getItemBatch().getItem().getName());
return;
}
} else if (bi.getPharmaceuticalBillItem().getItemBatch() == null) {
if (bi.getPharmaceuticalBillItem().getQty() > 0) {
JsfUtil.addErrorMessage(bi.getItem().getName() + " is not available in the stock");
return;
}
}

if (bi.getReferanceBillItem().getQty() < (bi.getPharmaceuticalBillItem().getQty()+bi.getIssuedPhamaceuticalItemQty())) {
JsfUtil.addErrorMessage("Issued quantity is higher than requested quantity in " + bi.getItem().getName());
return;
}
}

saveBill();
for (BillItem i : getBillItems()) {

Expand Down Expand Up @@ -580,9 +635,13 @@ public void settle() {
}

getIssuedBill().setInstitution(getSessionController().getInstitution());
getIssuedBill().setDepartment(getIssuedBill().getFromDepartment());
//
getIssuedBill().setToInstitution(getIssuedBill().getToDepartment().getInstitution());
getIssuedBill().setDepartment(getSessionController().getDepartment());

getIssuedBill().setFromInstitution(getSessionController().getInstitution());
getIssuedBill().setFromDepartment(getSessionController().getDepartment());

getIssuedBill().setToInstitution(getRequestedBill().getFromInstitution());
getIssuedBill().setToDepartment(getRequestedBill().getFromDepartment());

getIssuedBill().setCreater(getSessionController().getLoggedUser());
getIssuedBill().setCreatedAt(Calendar.getInstance().getTime());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@ public void saveBill() {
getReceivedBill().setFromStaff(getIssuedBill().getToStaff());
getReceivedBill().setFromInstitution(getIssuedBill().getInstitution());
getReceivedBill().setFromDepartment(getIssuedBill().getDepartment());
getReceivedBill().setToInstitution(sessionController.getInstitution());
getReceivedBill().setToDepartment(sessionController.getDepartment());

if (getReceivedBill().getId() == null) {
getBillFacade().create(getReceivedBill());
Expand Down
21 changes: 17 additions & 4 deletions src/main/java/com/divudi/bean/report/PharmacyReportController.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import org.hl7.fhir.r5.model.Bundle;
import java.time.temporal.ChronoUnit;


/**
*
Expand Down Expand Up @@ -2172,7 +2174,7 @@ public void processExpiryItemReport() {
m.put("td", toDate);

jpql = "select s"
+ " from StockHistory s "
+ " from Stock s "
+ " where s.itemBatch.dateOfExpire between :fd and :td ";
if (institution != null) {
jpql += " and s.institution=:ins ";
Expand All @@ -2193,10 +2195,21 @@ public void processExpiryItemReport() {
m.put("itm", item);
}

jpql += " order by s.createdAt ";
stocks = facade.findByJpql(jpql, m, TemporalType.TIMESTAMP);
jpql += " order by s.id ";
stocks = stockFacade.findByJpql(jpql, m, TemporalType.TIMESTAMP);
}


public long calculateDaysRemaining(Date dateOfExpire) {
if (dateOfExpire == null) {
return 0; // Default behavior for null dates
}
// Convert Date to LocalDate
LocalDate today = LocalDate.now();
LocalDate expiryDate = dateOfExpire.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();

// Calculate the difference in days
return ChronoUnit.DAYS.between(today, expiryDate);
}
public void processLabTestWiseCountReport() {
String jpql = "select new com.divudi.data.TestWiseCountReport("
+ "bi.item.name, "
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/divudi/ejb/PharmacyBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -611,9 +611,9 @@ public List<ItemBatchQty> deductFromStock(Item item, double qty, Department depa
}

public List<StockQty> getStockByQty(Item item, double qty, Department department) {
if (qty <= 0) {
return new ArrayList<>();
}
// if (qty <= 0) {
// return new ArrayList<>();
// }
String sql = "";
Map m = new HashMap();

Expand Down
Loading