Skip to content

Commit

Permalink
Merge branch 'refs/heads/development' into Issue#9680-Collection-Cent…
Browse files Browse the repository at this point in the history
…er-Bill-Wise-Detail-Report

# Conflicts:
#	src/main/java/com/divudi/bean/common/ReportsController.java
  • Loading branch information
imexh committed Dec 23, 2024
2 parents f02a4bb + 91c769d commit e15beb0
Show file tree
Hide file tree
Showing 62 changed files with 5,955 additions and 923 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dev_ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ jobs:
# Check if the application is reachable
for i in {1..5}; do
RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://$SERVER_IP/rh/faces/index1.xhtml)
RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" https://dev.carecode.org/rh/faces/index1.xhtml)
if [ "$RESPONSE_CODE" == "200" ]; then
echo "Application is reachable and healthy."
break
elif [ "$i" == "5" ]; then
echo "Application is not reachable or unhealthy at http://$SERVER_IP/rh (HTTP $RESPONSE_CODE)"
echo "Application is not reachable or unhealthy at https://dev.carecode.org/rh (HTTP $RESPONSE_CODE)"
break
fi
sleep 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ public class CollectingCentreBillController implements Serializable, ControllerW
private YearMonthDay yearMonthDay;
private PaymentMethodData paymentMethodData;

private String externalDoctor;

public List<AgentReferenceBook> getAgentReferenceBooks() {
return agentReferenceBooks;
}
Expand All @@ -269,7 +271,7 @@ public double findCCBalanceAfterBilling(Bill bill) {
+ " where ah.bill =:b "
+ " and ah.bill.retired=false ";
params.put("b", bill);

AgentHistory history = agentHistoryFacade.findFirstByJpql(jpql, params);
System.out.println("history = " + history);
double billingAfterCCBalance = history.getBalanceAfterTransaction();
Expand Down Expand Up @@ -1170,6 +1172,7 @@ private Bill createCcBill(Department bt) {
ccBill.setFromInstitution(collectingCentre);

ccBill.setReferredBy(referredBy);
ccBill.setExternalDoctor(externalDoctor);
ccBill.setReferenceNumber(referralId);
ccBill.setReferredByInstitution(referredByInstitution);
ccBill.setComments(comment);
Expand Down Expand Up @@ -1603,6 +1606,7 @@ public void prepareNewBill() {
paymentMethod = PaymentMethod.Agent;
collectingCentre = null;
opdItems = null;
externalDoctor = null;
}

public void prepareNewBillKeepingCollectingCenter() {
Expand Down Expand Up @@ -2550,6 +2554,14 @@ public void listnerForPaymentMethodChange() {
// ToDo: Add Logic
}

public String getExternalDoctor() {
return externalDoctor;
}

public void setExternalDoctor(String externalDoctor) {
this.externalDoctor = externalDoctor;
}

public class CollectingCenterBookSummeryRow {

private String bookName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public void makeNull() {
selectedBillItems = null;
paymentMethodData = null;
institution = null;
recreateModel();
}

public void selectInstitutionListener() {
Expand Down Expand Up @@ -516,7 +517,7 @@ public void calulateTotalForSettlingCreditForOpdPackageBills() {
}
getCurrent().setNetTotal(n);
}

public void calulateTotalForSettlingCreditForOpdBatchBills() {
double n = 0.0;
for (BillItem b : selectedBillItems) {
Expand Down Expand Up @@ -770,7 +771,7 @@ public void settleCreditForOpdPackageBills() {
JsfUtil.addSuccessMessage("Bill Saved");
printPreview = true;
}

public void settleCreditForOpdBatchBills() {
if (getSelectedBillItems().isEmpty()) {
JsfUtil.addErrorMessage("No Bill Item ");
Expand Down Expand Up @@ -848,7 +849,7 @@ public void settleBill() {

List payments = createPayment(current, current.getPaymentMethod());
drawerController.updateDrawerForIns(payments);

JsfUtil.addSuccessMessage("Bill Saved");
printPreview = true;

Expand Down Expand Up @@ -1283,12 +1284,14 @@ private void updateSettlingCreditBillSettledValues(BillItem billItemWithReferanc
billItemWithReferanceToCreditBill.getReferenceBill().setSettledAmountBySponsor(settledCreditValueByCompanies);
System.out.println("Settled Amount By Sponsor Set: " + settledCreditValueByCompanies);

double absBillAmount = Math.abs( billItemWithReferanceToCreditBill.getReferenceBill().getNetTotal());
double absSettledAmount = Math.abs( billItemWithReferanceToCreditBill.getReferenceBill().getPaidAmount());
double absBillAmount = Math.abs(billItemWithReferanceToCreditBill.getReferenceBill().getNetTotal());
double absSettledAmount = Math.abs(billItemWithReferanceToCreditBill.getReferenceBill().getPaidAmount());
double difference = absBillAmount - absSettledAmount;
double absDifference = Math.abs(difference);
if(absDifference<1.0) billItemWithReferanceToCreditBill.getReferenceBill().setPaidAt(new Date());

if (absDifference < 1.0) {
billItemWithReferanceToCreditBill.getReferenceBill().setPaidAt(new Date());
}

getBillFacade().edit(billItemWithReferanceToCreditBill.getReferenceBill());
System.out.println("Reference Bill Updated: " + billItemWithReferanceToCreditBill.getReferenceBill());
System.out.println("Completed updateSettlingCreditBillSettledValues");
Expand Down Expand Up @@ -1343,6 +1346,10 @@ public String prepareNewBill() {
return "";
}

public String navigateToCancelCreditSettleBill() {
return "";
}

public Bill getCurrent() {
if (current == null) {
current = new BilledBill();
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/divudi/bean/common/CommonController.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ public double dateDifferenceInSeconds(Date fromDate, Date toDate) {
return timeInMs / 1000;
}

@Deprecated // Use Common Functions
public static String nameToCode(String name) {
return name.toLowerCase().replaceAll("\\s+", "_");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,44 @@ public String getShortTextValueByKey(String key, String defaultValue) {
}
return option.getOptionValue();
}

public String getColorValueByKey(String key) {
ConfigOption option = getApplicationOption(key);
if (option == null || option.getValueType() != OptionValueType.COLOR) {
option = new ConfigOption();
option.setCreatedAt(new Date());
option.setOptionKey(key);
option.setScope(OptionScope.APPLICATION);
option.setInstitution(null);
option.setDepartment(null);
option.setWebUser(null);
option.setValueType(OptionValueType.COLOR);
option.setOptionValue("");
optionFacade.create(option);
loadApplicationOptions();
}
return option.getOptionValue();
}

public String getColorValueByKey(String key, String defaultColorHashCode) {
ConfigOption option = getApplicationOption(key);
if (option == null || option.getValueType() != OptionValueType.COLOR) {
option = new ConfigOption();
option.setCreatedAt(new Date());
option.setOptionKey(key);
option.setScope(OptionScope.APPLICATION);
option.setInstitution(null);
option.setDepartment(null);
option.setWebUser(null);
option.setValueType(OptionValueType.COLOR);
option.setOptionValue(defaultColorHashCode);
optionFacade.create(option);
loadApplicationOptions();
}
return option.getOptionValue();
}

public String getEnumValueByKey(String key) {
public String getEnumValueByKey(String key ) {
ConfigOption option = getApplicationOption(key);
if (option == null || option.getValueType() != OptionValueType.ENUM) {
option = new ConfigOption();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import com.divudi.facade.StaffFacade;
import com.divudi.bean.common.util.JsfUtil;
import com.divudi.ejb.BillNumberGenerator;
import com.divudi.java.CommonFunctions;
import java.io.Serializable;
import java.sql.SQLSyntaxErrorException;
import java.text.DecimalFormat;
Expand All @@ -68,7 +69,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.ejb.EJB;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.SessionScoped;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
Expand All @@ -89,8 +89,9 @@
*/
@Named
@SessionScoped
public class DataAdministrationController implements Serializable{
private static final long serialVersionUID = 1L;
public class DataAdministrationController implements Serializable {

private static final long serialVersionUID = 1L;

/**
* EJBs
Expand Down Expand Up @@ -190,9 +191,16 @@ public class DataAdministrationController implements Serializable{

Date fromDate;
Date toDate;


private String name;
private String code;

private int tabIndex;

public void convertNameToCode() {
code = CommonFunctions.nameToCode(name);
}

public void addWholesalePrices() {
List<ItemBatch> ibs = itemBatchFacade.findAll();
for (ItemBatch ib : ibs) {
Expand Down Expand Up @@ -285,6 +293,10 @@ public String navigateToCheckMissingFields() {
return "/dataAdmin/missing_database_fields?faces-redirect=true";
}

public String navigateToNameToCode() {
return "/dataAdmin/name_to_code?faces-redirect=true";
}

public String navigateToListOpdBillsAndBillItemsFields() {
return "/dataAdmin/opd_bills_and_bill_items?faces-redirect=true";
}
Expand All @@ -295,17 +307,17 @@ public String navigateToListMissingBillDeptNumber() {

public void addMissingDeptBillNumber(Bill bill) {
Bill originalBill = billFacade.find(bill.getId());
if (originalBill.getDeptId().trim().length() != 0){

if (originalBill.getDeptId().trim().length() != 0) {
JsfUtil.addErrorMessage("Already Add Dept Bill Number");
return;
}
String genarateeddeptID = bill.getInsId();

String genarateeddeptID = bill.getInsId();

originalBill.setDeptId(genarateeddeptID);
billFacade.edit(originalBill);

JsfUtil.addSuccessMessage("Added Dept Bill Number");
}

Expand Down Expand Up @@ -1737,8 +1749,6 @@ public void setDepartmentType(DepartmentType departmentType) {
this.departmentType = departmentType;
}



public Date getFromDate() {
if (fromDate == null) {
fromDate = commonFunctionsController.getStartOfMonth(new Date());
Expand Down Expand Up @@ -1870,6 +1880,24 @@ public void setTabIndex(int tabIndex) {
this.tabIndex = tabIndex;
}

public String getCode() {
return code;
}

public void setCode(String code) {
this.code = code;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}



public class EntityFieldError {

private String entityName;
Expand Down Expand Up @@ -1905,5 +1933,7 @@ public void setMissingFields(Set<String> missingFields) {
}

}



}
28 changes: 25 additions & 3 deletions src/main/java/com/divudi/bean/common/DepartmentController.java
Original file line number Diff line number Diff line change
Expand Up @@ -545,20 +545,42 @@ public List<Department> completeDept(String qry, Institution ins) {
}

public List<Department> completeDeptPharmacy(String qry) {
List<Department> results = new ArrayList<>();
if (qry == null) {
return results;
}
if (qry.trim().equals("")) {
return results;
}
qry = qry.trim();
String sql;
HashMap hm = new HashMap();
sql = "select c from Department c "
+ " where c.retired=false "
+ " and (c.name) like :q "
+ " and c.name like :q "
+ " and c.institution=:ins "
+ " and c.departmentType=:dt"
+ " order by c.name";

hm.put("dt", DepartmentType.Pharmacy);
hm.put("ins", getSessionController().getInstitution());
hm.put("q", "%" + qry.toUpperCase() + "%");

return getFacade().findByJpql(sql, hm);
results = getFacade().findByJpql(sql, hm);

if (results != null && !results.isEmpty()) {
return results;
}
results = new ArrayList<>();
if (qry.length() > 2) {
hm = new HashMap();
sql = "select c from Department c "
+ " where c.retired=false "
+ " and c.name like :q "
+ " order by c.name";
hm.put("q", "%" + qry.toUpperCase() + "%");
results = getFacade().findByJpql(sql, hm);
}
return results;
}

public List<Department> completeDeptWithDeptOrIns(String qry) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void createNotification(Bill bill) {
}
BillTypeAtomic type = bill.getBillTypeAtomic();
switch (type) {
case INWARD_PHARMACY_REQUEST:
case REQUEST_MEDICINE_INWARD:
createInwardBHTIssueFromPharmacyRequestNotifications(bill);
break;
case PHARMACY_TRANSFER_REQUEST:
Expand Down
Loading

0 comments on commit e15beb0

Please sign in to comment.