Skip to content

Commit

Permalink
Merge branch 'master' into Issue#6733
Browse files Browse the repository at this point in the history
  • Loading branch information
PasinduW99 authored Aug 7, 2024
2 parents 87bc9c8 + c80d5c6 commit 7673559
Show file tree
Hide file tree
Showing 18 changed files with 777 additions and 414 deletions.
2 changes: 1 addition & 1 deletion .github/counter.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5
2
2 changes: 1 addition & 1 deletion .github/last_date.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20240803
20240807
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ Developed using Java Enterprise Edition, the system offers both a web applicatio

## Current Version



Current Version: 3.0.0.20240803.5 (This line will be automatically updated to reflect the latest version)


Current Version: 3.0.0.20240807.2 (This line will be automatically updated to reflect the latest version)

## History

Expand Down Expand Up @@ -77,7 +73,7 @@ The features available to different roles of the users are stated in detail in t
* Dr M H B Ariyaratne - Initiated the Project, Product owner, System Architect, Lead Developer since 2004 to date

## Project Management
* Mr.K.M.G.T.R. Waidyarathne - Project Management from 2013 to date
* Mr.K.M.G.T.R. Waidyarathne - Recruitment Management from 2013 to 2022, Project Management from 2022 to 2024

## Business Analyst
* Miss Binuthi Nilakna Ariyaratne - From 2024 to date
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ public class CollectingCentreBillController implements Serializable, ControllerW
StaffBean staffBean;
@Inject
CategoryController categoryController;
@Inject
ConfigOptionApplicationController configOptionApplicationController;
/**
* Properties
*/
Expand Down Expand Up @@ -1089,14 +1091,15 @@ private boolean errorCheck() {
JsfUtil.addErrorMessage("Please select a collecting centre");
return true;
}
if (referralId == null || referralId.trim().equals("")) {
JsfUtil.addErrorMessage("Please enter a referrance number");
return true;
boolean collectingCentreBillingRequiresReferanceNumbers = configOptionApplicationController.getBooleanValueByKey("Collecting Centre Billing Requires Referance Numbers", true);
boolean collectingCentreBillingRequiresCreditBalanceManagement = configOptionApplicationController.getBooleanValueByKey("Collecting Centre Billing Requires Credit Balance Management", true);

if (collectingCentreBillingRequiresReferanceNumbers) {
if (referralId == null || referralId.trim().equals("")) {
JsfUtil.addErrorMessage("Please enter a referrance number");
return true;
}
}
// else if (collectingCenterReferranceNumberAlreadyUsed(collectingCentre)) {
// JsfUtil.addErrorMessage("Referral number alredy entered");
// return true;
// }

if (getLstBillEntries().isEmpty()) {
JsfUtil.addErrorMessage("Please Add tests before billing");
Expand All @@ -1110,31 +1113,25 @@ private boolean errorCheck() {
}
}

///not wanted
// if ((collectingCentre.getBallance() - Math.abs(feeTotalExceptCcfs)) < 0 - collectingCentre.getStandardCreditLimit()) {
// JsfUtil.addErrorMessage("This bill excees the Collecting Centre Limit");
// return true;
// }
double awailableBalance = Math.abs(collectingCentre.getBallance() + Math.abs(collectingCentre.getAllowedCredit()));

if (awailableBalance < Math.abs(feeTotalExceptCcfs)) {
JsfUtil.addErrorMessage("Collecting Centre Balance is Not Enough");
return true;
}
double awailableBalance = Math.abs(collectingCentre.getBallance() + Math.abs(collectingCentre.getAllowedCredit()));

// if (agentReferenceBookController.numberHasBeenIssuedToTheAgent(getReferralId())) {
// JsfUtil.addErrorMessage("Invaild Reference Number.");
// return true;
// }
if (agentReferenceBookController.agentReferenceNumberIsAlredyUsed(getReferralId(), collectingCentre, BillType.CollectingCentreBill, PaymentMethod.Agent)) {
JsfUtil.addErrorMessage("This Reference Number is alredy Used.");
setReferralId("");
return true;
if (collectingCentreBillingRequiresCreditBalanceManagement) {
if (awailableBalance < Math.abs(feeTotalExceptCcfs)) {
JsfUtil.addErrorMessage("Collecting Centre Balance is Not Enough");
return true;
}
}

if (!agentReferenceBookController.numberHasBeenIssuedToTheAgent(collectingCentre, getReferralId())) {
JsfUtil.addErrorMessage("This Reference Number is Blocked Or This channel Book is Not Issued.");
return true;
if (collectingCentreBillingRequiresReferanceNumbers) {
if (agentReferenceBookController.agentReferenceNumberIsAlredyUsed(getReferralId(), collectingCentre, BillType.CollectingCentreBill, PaymentMethod.Agent)) {
JsfUtil.addErrorMessage("This Reference Number is alredy Used.");
setReferralId("");
return true;
}
if (!agentReferenceBookController.numberHasBeenIssuedToTheAgent(collectingCentre, getReferralId())) {
JsfUtil.addErrorMessage("This Reference Number is Blocked Or This channel Book is Not Issued.");
return true;
}
}

return false;
Expand Down Expand Up @@ -1533,7 +1530,7 @@ public String navigateToCollectingCenterBillingromCollectingCenterBilling() {
setPatient(getPatient());
return "/collecting_centre/bill?faces-redirect=true";
}

public String navigateToCollectingCenterBillingfromBillPriview() {
prepareNewBillKeepingCollectingCenter();
fillAvailableAgentReferanceNumbers(collectingCentre);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ public String navigateToCourierHandoverSamplesToLab() {
public String navigateToCourierViewReports() {
return "/collecting_centre/courier/viewReports.xhtml?faces-redirect=true";
}

public String navigateToCourierIndex() {
return "/collecting_centre/courier/index.xhtml?faces-redirect=true";
}

public String navigateToCourierPrintReports() {
return "/collecting_centre/courier/printReports.xhtml?faces-redirect=true";
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/divudi/bean/common/SearchController.java
Original file line number Diff line number Diff line change
Expand Up @@ -992,11 +992,11 @@ public void fillCollectingCentreCourierPatientInvestigations() {
temMap.put("dep", getReportKeyWord().getDepartment());

if(institution==null){
jpql += " b.collectingCentre in :ccs ";
jpql += " and b.collectingCentre in :ccs ";
temMap.put("ccs", sessionController.getLoggableCollectingCentres());
}else{
jpql += " b.collectingCentre=:cc ";
temMap.put("ccs", sessionController.getLoggableCollectingCentres());
jpql += " and b.collectingCentre=:cc ";
temMap.put("cc", sessionController.getLoggableCollectingCentres());
}

if (getSearchKeyword().getPatientName() != null && !getSearchKeyword().getPatientName().trim().equals("")) {
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/divudi/bean/common/SessionController.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package com.divudi.bean.common;

import com.divudi.bean.channel.BookingController;
import com.divudi.bean.collectingCentre.CourierController;
import com.divudi.bean.pharmacy.PharmacySaleController;
import com.divudi.data.InstitutionType;
import com.divudi.data.Privileges;
Expand Down Expand Up @@ -123,6 +124,8 @@ public class SessionController implements Serializable, HttpSessionListener {
BookingController bookingController;
@Inject
ConfigOptionApplicationController configOptionApplicationController;
@Inject
CourierController courierController;
/**
* Properties
*/
Expand Down Expand Up @@ -1277,6 +1280,8 @@ public String navigateToLoginPageByUsersDefaultLoginPage() {
return opdTokenController.navigateToManageOpdTokensCalled();
case PHARMACY_TOKEN_DISPLAY:
return tokenController.navigateToManagePharmacyTokensCalled();
case COURIER_LANDING_PAGE:
return courierController.navigateToCourierIndex();
case HOME:
default:
return "/home?faces-redirect=true";
Expand Down
115 changes: 115 additions & 0 deletions src/main/java/com/divudi/bean/emr/DataUploadController.java
Original file line number Diff line number Diff line change
Expand Up @@ -3201,6 +3201,121 @@ private List<Institution> readSuppliersFromExcel(InputStream inputStream) throws

return suppliersList;
}

private List<ItemFee> readCollectingCentrePriceListFromXcel(InputStream inputStream) throws IOException {
Workbook workbook = new XSSFWorkbook(inputStream);
Sheet sheet = workbook.getSheetAt(0);
Iterator<Row> rowIterator = sheet.rowIterator();

itemFees = new ArrayList<>();

// Assuming the first row contains headers, skip it
if (rowIterator.hasNext()) {
rowIterator.next();
}
Institution runningIns = null;
Department runningDept = null;
while (rowIterator.hasNext()) {
Row row = rowIterator.next();
Institution institution;
Department department;
Item item=null;
String departmentName=null;
Category category = null;
String institutionName = null;
String itemCode =null;
String itemName=null;
String feeListType=null;
Double price=0.0;

Cell insCell = row.getCell(4);
if (insCell != null && insCell.getCellType() == CellType.STRING) {
institutionName = insCell.getStringCellValue();
}
if (institutionName == null || institutionName.trim().equals("")) {
institutionName = "Other";
}
if (runningIns == null) {
institution = institutionController.findAndSaveInstitutionByName(institutionName);
runningIns = institution;
} else if (runningIns.getName().equals(institutionName)) {
institution = runningIns;
} else {
institution = institutionController.findAndSaveInstitutionByName(institutionName);
runningIns = institution;
}

Cell deptCell = row.getCell(5);
if (deptCell != null && deptCell.getCellType() == CellType.STRING) {
departmentName = deptCell.getStringCellValue();
}
if (departmentName == null || departmentName.trim().equals("")) {
departmentName = institutionName;
}
if (runningDept == null) {
department = departmentController.findAndSaveDepartmentByName(departmentName);
runningDept = department;
} else if (runningDept.getName().equals(departmentName)) {
department = runningDept;
} else {
department = departmentController.getDefaultDepatrment(institution);
runningDept = department;
}

// Column A: Department Code (Required)
Cell itemCodeCell = row.getCell(0);
if (itemCodeCell != null && itemCodeCell.getCellType() == CellType.STRING) {
itemCode = itemCodeCell.getStringCellValue();
}
if (itemCode != null) {
item=itemController.findItemByCode(itemCode);
}
if (itemCode == null || itemCode.trim().isEmpty()) {
continue;
}

// Column B: Department Name (Required)
Cell itemNameCell = row.getCell(1);
if (itemNameCell != null && itemNameCell.getCellType() == CellType.STRING) {
itemName = itemNameCell.getStringCellValue();
}
if (itemName == null || itemName.trim().isEmpty()) {
continue;
}

// Column C: Bill Prefix (Optional)
Cell priceCell = row.getCell(3);
if (priceCell != null && priceCell.getCellType() == CellType.NUMERIC) {
price = priceCell.getNumericCellValue();
}

Cell itemFeeListCell = row.getCell(2);
if (itemFeeListCell != null && itemFeeListCell.getCellType() == CellType.STRING) {
feeListType = itemFeeListCell.getStringCellValue();
}
if (feeListType != null) {
System.out.println("itemFeeListCell = " + feeListType);
category=categoryController.findAndCreateCategoryByName(feeListType);
category.setSymanticType(SymanticHyrachi.Fee_List_Type);
categoryFacade.edit(category);
}

ItemFee fee=new ItemFee();
fee.setCreatedAt(new Date());
fee.setCreater(sessionController.getLoggedUser());
fee.setForInstitution(null);
fee.setForCategory(category);
fee.setItem(item);
fee.setFee(price);
fee.setInstitution(institution);
fee.setDepartment(department);
itemFeeFacade.create(fee);

}

return itemFees;

}


private List<ItemFee> readCollectingCentrePriceListFromXcel(InputStream inputStream) throws IOException {
Expand Down
32 changes: 4 additions & 28 deletions src/main/java/com/divudi/bean/pharmacy/GrnController.java
Original file line number Diff line number Diff line change
Expand Up @@ -1078,34 +1078,27 @@ public void onEdit(RowEditEvent event) {
}

public void checkQty(BillItem bi) {

if (bi.getTmpQty() < 0.0) {
bi.setTmpQty(0.0);
}

if (bi.getTmpFreeQty() < 0.0) {
bi.setTmpFreeQty(0.0);
}

onEdit(bi);
}

public void onEdit(BillItem tmp) {
setBatch(tmp);
double remains = getPharmacyCalculation().getRemainingQty(tmp.getPharmaceuticalBillItem());

// System.err.println("1 " + tmp.getTmpQty());
// System.err.println("2 " + tmp.getQty());
// System.err.println("3 " + tmp.getPharmaceuticalBillItem().getQty());
// System.err.println("4 " + tmp.getPharmaceuticalBillItem().getQtyInUnit());
//System.out.println("remains = " + remains);
// System.out.println("tmp.getPharmaceuticalBillItem().getQtyInUnit() = " + tmp.getPharmaceuticalBillItem().getQtyInUnit());

if (remains < tmp.getPharmaceuticalBillItem().getQtyInUnit()) {
tmp.setTmpQty(remains);
JsfUtil.addErrorMessage("You cant Change Qty than Remaining qty");
}
// System.out.println("tmp.getPreviousRecieveQtyInUnit() = " + tmp.getPreviousRecieveQtyInUnit());
// if(tmp.getPreviousRecieveQtyInUnit() < tmp.getPharmaceuticalBillItem().getQtyInUnit()){
// tmp.setTmpQty(tmp.getPreviousRecieveQtyInUnit());
// JsfUtil.addErrorMessage("You cant Order Qty than Remaining qty to recieve");
// }

if (tmp.getPharmaceuticalBillItem().getPurchaseRate() > tmp.getPharmaceuticalBillItem().getRetailRate()) {
tmp.getPharmaceuticalBillItem().setRetailRate(getRetailPrice(tmp.getPharmaceuticalBillItem().getBillItem()));
Expand All @@ -1119,8 +1112,6 @@ public void onEdit(BillItem tmp) {
// return;
}
}
// manually set Wholesale Rate**************
// tmp.getPharmaceuticalBillItem().setWholesaleRate((tmp.getPharmaceuticalBillItem().getPurchaseRate() * 1.08)* (tmp.getPharmaceuticalBillItem().getQtyInUnit())/(tmp.getPharmaceuticalBillItem().getQtyInUnit() + tmp.getPharmaceuticalBillItem().getFreeQtyInUnit()) );

calGrossTotal();
calDifference();
Expand All @@ -1133,21 +1124,6 @@ public void onEditPurchaseRate(BillItem tmp) {

}

// private List<Item> getSuggession(Item item) {
// List<Item> suggessions = new ArrayList<>();
//
// if (item instanceof Amp) {
// suggessions = getPharmacyBillBean().findItem((Amp) item, suggessions);
// } else if (item instanceof Ampp) {
// suggessions = getPharmacyBillBean().findItem((Ampp) item, suggessions);
// } else if (item instanceof Vmp) {
// suggessions = getPharmacyBillBean().findItem((Vmp) item, suggessions);
// } else if (item instanceof Vmpp) {
// suggessions = getPharmacyBillBean().findItem((Vmpp) item, suggessions);
// }
//
// return suggessions;
// }
public void calGrossTotal() {
double tmp = 0.0;
int serialNo = 0;
Expand Down
Loading

0 comments on commit 7673559

Please sign in to comment.