Skip to content

Commit

Permalink
Merge branch 'development' into Issue#9680-Collection-Center-Bill-Wis…
Browse files Browse the repository at this point in the history
…e-Detail-Report
  • Loading branch information
DamithDeshan authored Dec 24, 2024
2 parents e15beb0 + 02c548b commit d800550
Show file tree
Hide file tree
Showing 13 changed files with 412 additions and 38 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/divudi/bean/common/BillBeanController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2267,9 +2267,9 @@ public void updateInwardDipositList(PatientEncounter patientEncounter, Bill bill
patientEncounter.getFinalBill().setBalance(patientEncounter.getFinalBill().getBalance() - bill.getNetTotal());
patientEncounter.getFinalBill().setPaidAmount(patientEncounter.getFinalBill().getPaidAmount() + bill.getNetTotal());

if(bill.getPaymentMethod() != PaymentMethod.Credit){
if(bill.getBillTypeAtomic() == BillTypeAtomic.INWARD_DEPOSIT){
patientEncounter.getFinalBill().setSettledAmountByPatient(patientEncounter.getFinalBill().getSettledAmountByPatient() + bill.getNetTotal());
}else if(bill.getPaymentMethod() == PaymentMethod.Credit){
}else if(bill.getBillTypeAtomic()== BillTypeAtomic.INPATIENT_CREDIT_COMPANY_PAYMENT_RECEIVED){
patientEncounter.getFinalBill().setSettledAmountBySponsor(patientEncounter.getFinalBill().getSettledAmountBySponsor()+ bill.getNetTotal());
}
getBillFacade().edit(patientEncounter.getFinalBill());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,33 @@ public void setComment(String comment) {
@Inject
private AdmissionController admissionController;

// public void selectInstitutionListenerBht() {
// Institution ins = institution;
// makeNull();
//
// List<Admission> list = getAdmissionController().getCreditBillsBht(ins);
// for (PatientEncounter b : list) {
// getCurrentBillItem().setPatientEncounter(b);
// selectBhtListener();
// addToBht();
// }
// if (billItems != null) {
// selectedBillItems.addAll(billItems);
// }
// calTotal();
// }

public void selectInstitutionListenerBht() {
Institution ins = institution;
makeNull();

List<Admission> list = getAdmissionController().getCreditBillsBht(ins);
for (PatientEncounter b : list) {
getCurrentBillItem().setPatientEncounter(b);
selectBhtListener();
List<Bill> list = getAdmissionController().getCreditPaymentBillsBht(ins);
for (Bill b : list) {
getCurrentBillItem().setPatientEncounter(b.getPatientEncounter());
getCurrentBillItem().setNetValue(b.getNetTotal());
getCurrentBillItem().getPatientEncounter().setCreditCompany(b.getCreditCompany());
getCurrentBillItem().setBill(b);
// selectBhtListener();
addToBht();
}
if (billItems != null) {
Expand Down Expand Up @@ -1034,15 +1053,26 @@ public void settleBillBht() {
getCurrent().setTotal(getCurrent().getNetTotal());

saveBill(BillType.CashRecieveBill, BillTypeAtomic.INPATIENT_CREDIT_COMPANY_PAYMENT_RECEIVED);
updateReferanceBills();
saveBillItemBht();



WebUser wb = getCashTransactionBean().saveBillCashInTransaction(getCurrent(), getSessionController().getLoggedUser());
getSessionController().setLoggedUser(wb);
// savePayments();
JsfUtil.addSuccessMessage("Bill Saved");
printPreview = true;

}

public void updateReferanceBills(){
for(BillItem b : getSelectedBillItems()){
b.getBill().setPaid(true);
b.getBill().setPaidAmount(b.getNetValue());
b.getBill().setPaidBill(getCurrent());
billFacade.edit(b.getBill());
}
}

public List<Payment> createPayment(Bill bill, PaymentMethod pm) {
List<Payment> ps = new ArrayList<>();
Expand Down Expand Up @@ -1250,6 +1280,7 @@ private void saveBillItemBht() {
getCurrent().getBillItems().add(tmp);
getBillItemFacade().create(tmp);

getBillBean().updateInwardDipositList(tmp.getPatientEncounter(), getCurrent());
updateReferenceBht(tmp);

}
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/com/divudi/bean/common/ReportsController.java
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ public class ReportsController implements Serializable {
Map<Integer, Map<String, Map<Integer, Double>>> weeklyDailyBillItemMap7to1;
Map<Integer, Map<String, Map<Integer, Double>>> weeklyDailyBillItemMap1to7;


private boolean showChart;

public String getDischargedStatus() {
Expand Down Expand Up @@ -403,6 +402,7 @@ public void setSelectedDateType(String selectedDateType) {
this.selectedDateType = selectedDateType;
}


public Investigation getInvestigation() {
return investigation;
}
Expand Down Expand Up @@ -3506,7 +3506,7 @@ private void groupBills() {
bundle.setGroupedBillItemsByInstitution(billMap);
}

public Double calculateNetAmountSubTotalByBills(List<Bill> bills) {
public Double calculateNetTotalByBills(List<Bill> bills) {
Double netTotal = 0.0;

for (Bill bill : bills) {
Expand All @@ -3516,7 +3516,7 @@ public Double calculateNetAmountSubTotalByBills(List<Bill> bills) {
return netTotal;
}

public Double calculateDiscountSubTotalByBills(List<Bill> bills) {
public Double calculateDiscountByBills(List<Bill> bills) {
Double discount = 0.0;

for (Bill bill : bills) {
Expand All @@ -3526,7 +3526,6 @@ public Double calculateDiscountSubTotalByBills(List<Bill> bills) {
return discount;
}


public Double calculateNetAmountNetTotal() {
double netAmountNetTotal = 0.0;
Map<Institution, List<Bill>> billMap = bundle.getGroupedBillItemsByInstitution();
Expand Down Expand Up @@ -3639,10 +3638,10 @@ public Double calculateSponsorShareNetTotal() {
for (Map.Entry<Institution, List<Bill>> entry : billMap.entrySet()) {
List<Bill> bills = entry.getValue();

sponsorShareNetTotal += calculateSponsorShareSubTotalByBills(bills);
subTotal += calculateNetTotalByBills(bills);
}

return sponsorShareNetTotal;
return subTotal;
}

public void generateDiscountReport() {
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/com/divudi/bean/inward/AdmissionController.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import com.divudi.facade.RoomFacade;
import com.divudi.bean.common.util.JsfUtil;
import com.divudi.bean.pharmacy.PharmacyRequestForBhtController;
import com.divudi.data.BillTypeAtomic;
import com.divudi.data.clinical.ClinicalFindingValueType;
import com.divudi.entity.Department;
import com.divudi.entity.Staff;
Expand Down Expand Up @@ -362,6 +363,23 @@ public List<Admission> getCreditBillsBht(Institution institution) {

return lst;
}

public List<Bill> getCreditPaymentBillsBht(Institution institution) {
String sql;
HashMap hash = new HashMap();

sql = "select b from Bill b "
+ " where b.retired=false "
+ " and b.creditCompany=:ins"
+ " and b.billTypeAtomic=:bta ";

hash.put("ins", institution);
hash.put("bta", BillTypeAtomic.INWARD_FINAL_BILL_PAYMENT_BY_CREDIT_COMPANY);
// hash.put("pm", PaymentMethod.Credit);
List<Bill> lst = getBillFacade().findByJpql(sql, hash);
System.out.println("lst = " + lst);
return lst;
}

// public List<Admission> completePatientPaymentDue(String qry) {
// String sql = "Select b.patientEncounter From "
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/com/divudi/bean/lab/InvestigationController.java
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,23 @@ public String navigateToEditFormatSingle() {
return investigationItemController.toEditInvestigationFormat();
}

public String navigateExportReoirtFormat() {
if (current == null) {
JsfUtil.addErrorMessage("Please select investigation");
return "";
}
if (current.getId() == null) {
JsfUtil.addErrorMessage("Please save investigation first.");
return "";
}
if (current.getReportedAs() == null) {
current.setReportedAs(current);
}
investigationItemController.setCurrentInvestigation((Investigation) current.getReportedAs());
investigationItemController.listInvestigationItem();
return "/admin/lims/export?faces-redirect=true";
}

public String navigateToEditFormatSinglePastData() {
if (current == null) {
JsfUtil.addErrorMessage("Please select investigation");
Expand Down
Loading

0 comments on commit d800550

Please sign in to comment.