Skip to content

Commit 8d51f3e

Browse files
authored
Merge pull request #9921 from hmislk/two_persons_are_created_for_each_patient_#9919
Two persons are created for each patient #9919
2 parents 7eb42dd + e8d95fd commit 8d51f3e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+347
-92
lines changed

src/main/java/com/divudi/bean/common/DataAdministrationController.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,9 @@ private <T> int retireEntities(List<T> entities, Date retiredAt, WebUser retirer
565565
retirable.setRetirer(retirer);
566566
retirable.setRetireComments(uuid);
567567
facade.edit(entity); // Use the specific facade passed as a parameter
568+
}else{
569+
System.out.println("Entity that does not implement retirable");
570+
System.out.println("entity = " + entity);
568571
}
569572
processedRecords++;
570573
updateProgress();

src/main/java/com/divudi/bean/common/PatientController.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,7 +1995,7 @@ public void quickSearchPatientLongPhoneNumber(ControllerWithPatient controller)
19951995
quickSearchPatientList = findPatientUsingPhnNumber(quickSearchPhoneNumber);
19961996
usePHN = true;
19971997
}
1998-
controller.setPaymentMethod(null);
1998+
// controller.setPaymentMethod(null);
19991999
if (quickSearchPatientList == null) {
20002000

20012001
controller.setPatient(null);
@@ -2021,7 +2021,7 @@ public void quickSearchPatientLongPhoneNumber(ControllerWithPatient controller)
20212021

20222022
controller.setPatient(patientSearched);
20232023
controller.setPatientDetailsEditable(false);
2024-
controller.setPaymentMethod(null);
2024+
// controller.setPaymentMethod(null);
20252025

20262026
admissionController.fillCurrentPatientAllergies(current);//TODO
20272027

@@ -2031,9 +2031,9 @@ public void quickSearchPatientLongPhoneNumber(ControllerWithPatient controller)
20312031
if (controller.getPatient().getHasAnAccount() && automaticallySetPatientDeposit) {
20322032
controller.setPatient(controller.getPatient());
20332033
controller.setPaymentMethod(PaymentMethod.PatientDeposit);
2034-
controller.listnerForPaymentMethodChange();
20352034
}
20362035
}
2036+
controller.listnerForPaymentMethodChange();
20372037
quickSearchPatientList = null;
20382038
} else {
20392039
controller.setPatient(null);
@@ -2061,7 +2061,7 @@ public void selectQuickOneFromQuickSearchPatient(ControllerWithPatient controlle
20612061

20622062
controller.setPatient(current);
20632063
controller.setPatientDetailsEditable(false);
2064-
controller.setPaymentMethod(null);
2064+
// controller.setPaymentMethod(null);
20652065

20662066
admissionController.fillCurrentPatientAllergies(current); //TODO
20672067

@@ -2992,13 +2992,13 @@ public boolean saveSelected(Patient p) {
29922992
return false;
29932993
}
29942994
}
2995-
if (p.getPerson().getId() == null) {
2996-
p.getPerson().setCreatedAt(Calendar.getInstance().getTime());
2997-
p.getPerson().setCreater(getSessionController().getLoggedUser());
2998-
getPersonFacade().create(p.getPerson());
2999-
} else {
3000-
getPersonFacade().edit(p.getPerson());
3001-
}
2995+
// if (p.getPerson().getId() == null) {
2996+
// p.getPerson().setCreatedAt(Calendar.getInstance().getTime());
2997+
// p.getPerson().setCreater(getSessionController().getLoggedUser());
2998+
// getPersonFacade().create(p.getPerson());
2999+
// } else {
3000+
// getPersonFacade().edit(p.getPerson());
3001+
// }
30023002
if (p.getId() == null) {
30033003
p.setCreatedAt(new Date());
30043004
p.setCreater(getSessionController().getLoggedUser());

src/main/java/com/divudi/bean/common/PriceMatrixController.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,11 @@ public OpdMemberShipDiscount getOpdMemberDisCount(PaymentMethod paymentMethod, M
351351
}
352352

353353
public PaymentSchemeDiscount getPaymentSchemeDiscount(PaymentMethod paymentMethod, PaymentScheme paymentScheme, Department department, Item item) {
354+
System.out.println("getPaymentSchemeDiscount");
355+
System.out.println("paymentMethod = " + paymentMethod);
356+
System.out.println("paymentScheme = " + paymentScheme);
357+
System.out.println("department = " + department);
358+
System.out.println("item = " + item);
354359
PaymentSchemeDiscount paymentSchemeDiscount = null;
355360
Category category = null;
356361

@@ -360,7 +365,8 @@ public PaymentSchemeDiscount getPaymentSchemeDiscount(PaymentMethod paymentMetho
360365

361366
//Get Discount From Item
362367
paymentSchemeDiscount = fetchPaymentSchemeDiscount(paymentScheme, paymentMethod, item);
363-
368+
System.out.println("paymentSchemeDiscount = " + paymentSchemeDiscount);
369+
364370
//Get Discount From Category
365371
if (paymentSchemeDiscount == null) {
366372
paymentSchemeDiscount = fetchPaymentSchemeDiscount(paymentScheme, paymentMethod, category);
@@ -376,6 +382,7 @@ public PaymentSchemeDiscount getPaymentSchemeDiscount(PaymentMethod paymentMetho
376382
if (paymentSchemeDiscount == null) {
377383
paymentSchemeDiscount = fetchPaymentSchemeDiscount(paymentScheme, paymentMethod, department);
378384
}
385+
System.out.println("paymentSchemeDiscount = " + paymentSchemeDiscount);
379386

380387
return paymentSchemeDiscount;
381388
}
@@ -429,6 +436,7 @@ public OpdMemberShipDiscount fetchOpdMemberShipDiscount(MembershipScheme members
429436
}
430437

431438
public PaymentSchemeDiscount fetchPaymentSchemeDiscount(PaymentScheme paymentScheme, PaymentMethod paymentMethod, Category category) {
439+
System.out.println("fetchPaymentSchemeDiscount = ");
432440
String sql;
433441
HashMap hm = new HashMap();
434442
hm.put("p", paymentMethod);
@@ -439,7 +447,8 @@ public PaymentSchemeDiscount fetchPaymentSchemeDiscount(PaymentScheme paymentSch
439447
+ " and i.paymentScheme=:m "
440448
+ " and i.paymentMethod=:p"
441449
+ " and i.category=:cat ";
442-
450+
System.out.println("hm = " + hm);
451+
System.out.println("sql = " + sql);
443452
return (PaymentSchemeDiscount) getPriceMatrixFacade().findFirstByJpql(sql, hm);
444453

445454
}

src/main/java/com/divudi/bean/common/RelationController.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
import java.io.Serializable;
1010
import java.util.Date;
11+
import java.util.HashMap;
1112
import java.util.List;
13+
import java.util.Map;
1214
import java.util.ResourceBundle;
1315
import java.util.logging.Level;
1416
import java.util.logging.Logger;
@@ -89,15 +91,19 @@ public List<Relation> getItems() {
8991
}
9092

9193
public Relation fetchRelationByName(String relationName) {
92-
String j = "select r from Relation r where r.retired=false and r.name=:relationName order by r.orderNo";
93-
Relation relation = getFacade().findFirstByJpql(j);
94+
String j = "select r from Relation r where r.name=:relationName";
95+
Map m = new HashMap();
96+
m.put("relationName", relationName);
97+
Relation relation = getFacade().findFirstByJpql(j,m);
9498
if (relation == null) {
9599
relation = new Relation();
96100
relation.setName(relationName);
97101
relation.setCreatedAt(new Date());
98102
relation.setCreater(sessionController.getLoggedUser());
99103
getFacade().create(relation);
100104
}
105+
relation.setRetired(false);
106+
getFacade().edit(relation);
101107
return relation;
102108
}
103109

src/main/java/com/divudi/bean/pharmacy/PharmacySaleController.java

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ public PharmacySaleController() {
134134
TokenController tokenController;
135135
@Inject
136136
DrawerController drawerController;
137+
@Inject
138+
PaymentSchemeController paymentSchemeController;
137139
////////////////////////
138140
@EJB
139141
private BillFacade billFacade;
@@ -219,6 +221,8 @@ public PharmacySaleController() {
219221
private Department counter;
220222
Token currentToken;
221223

224+
PaymentMethod paymentMethod;
225+
222226
public Token getCurrentToken() {
223227
return currentToken;
224228
}
@@ -395,6 +399,7 @@ public void onTabChange(TabChangeEvent event) {
395399

396400
}
397401

402+
@Override
398403
public double calculatRemainForMultiplePaymentTotal() {
399404

400405
if (paymentMethod == PaymentMethod.MultiplePaymentMethods) {
@@ -413,6 +418,7 @@ public double calculatRemainForMultiplePaymentTotal() {
413418
return getPreBill().getTotal();
414419
}
415420

421+
@Override
416422
public void recieveRemainAmountAutomatically() {
417423
double remainAmount = calculatRemainForMultiplePaymentTotal();
418424
if (paymentMethod == PaymentMethod.MultiplePaymentMethods) {
@@ -1071,6 +1077,7 @@ public void addBillItem() {
10711077
}
10721078

10731079
public void processBillItems() {
1080+
System.out.println("processBillItems");
10741081
calculateAllRates();
10751082
calculateTotals();
10761083
}
@@ -1084,6 +1091,7 @@ public void calculateAllRates() {
10841091
}
10851092

10861093
public void calculateRates(BillItem bi) {
1094+
System.out.println("calculateRates = ");
10871095
PharmaceuticalBillItem pharmBillItem = bi.getPharmaceuticalBillItem();
10881096
if (pharmBillItem != null && pharmBillItem.getStock() != null) {
10891097
ItemBatch itemBatch = pharmBillItem.getStock().getItemBatch();
@@ -1439,15 +1447,15 @@ public void setBillItem(BillItem billItem) {
14391447
// return false;
14401448
//
14411449
// }
1442-
@Inject
1443-
PaymentSchemeController paymentSchemeController;
1444-
PaymentMethod paymentMethod;
1445-
1450+
@Override
14461451
public PaymentMethod getPaymentMethod() {
1452+
System.out.println("get paymentMethod = " + paymentMethod);
14471453
return paymentMethod;
14481454
}
14491455

1456+
@Override
14501457
public void setPaymentMethod(PaymentMethod paymentMethod) {
1458+
System.out.println("setPaymentMethod = " + paymentMethod);
14511459
this.paymentMethod = paymentMethod;
14521460
}
14531461

@@ -2496,6 +2504,7 @@ public void setPriceMatrixController(PriceMatrixController priceMatrixController
24962504

24972505
// TO check the functionality
24982506
public double calculateBillItemDiscountRate(BillItem bi) {
2507+
System.out.println("calculateBillItemDiscountRate");
24992508
if (bi == null) {
25002509
return 0.0;
25012510
}
@@ -2512,7 +2521,7 @@ public double calculateBillItemDiscountRate(BillItem bi) {
25122521
double retailRate = bi.getPharmaceuticalBillItem().getStock().getItemBatch().getRetailsaleRate();
25132522
double discountRate = 0;
25142523
boolean discountAllowed = bi.getItem().isDiscountAllowed();
2515-
2524+
System.out.println("discountAllowed = " + discountAllowed);
25162525
// MembershipScheme membershipScheme = membershipSchemeController.fetchPatientMembershipScheme(getPatient(), getSessionController().getApplicationPreference().isMembershipExpires());
25172526
//MEMBERSHIPSCHEME DISCOUNT
25182527
// if (membershipScheme != null && discountAllowed) {
@@ -2530,17 +2539,25 @@ public double calculateBillItemDiscountRate(BillItem bi) {
25302539
// }
25312540
//
25322541
//PAYMENTSCHEME DISCOUNT
2542+
2543+
System.out.println("getPaymentScheme() = " + getPaymentScheme());
25332544
if (getPaymentScheme() != null && discountAllowed) {
2545+
System.out.println("getPaymentMethod() = " + getPaymentMethod());
2546+
System.out.println("getPaymentScheme() = " + getPaymentScheme());
2547+
System.out.println("getSessionController().getDepartment() = " + getSessionController().getDepartment());
2548+
System.out.println("bi.getItem() = " + bi.getItem());
25342549
PriceMatrix priceMatrix = getPriceMatrixController().getPaymentSchemeDiscount(getPaymentMethod(), getPaymentScheme(), getSessionController().getDepartment(), bi.getItem());
25352550

2536-
// //System.err.println("tr = " + tr);
2551+
System.err.println("priceMatrix = " + priceMatrix);
25372552
if (priceMatrix != null) {
25382553
bi.setPriceMatrix(priceMatrix);
25392554
discountRate = priceMatrix.getDiscountPercent();
2555+
System.out.println("discountRate = " + discountRate);
25402556
}
25412557

25422558
double dr;
25432559
dr = (retailRate * discountRate) / 100;
2560+
System.out.println("1 dr = " + dr);
25442561
return dr;
25452562

25462563
}
@@ -2556,7 +2573,7 @@ public double calculateBillItemDiscountRate(BillItem bi) {
25562573

25572574
double dr;
25582575
dr = (retailRate * discountRate) / 100;
2559-
2576+
System.out.println("2 dr = " + dr);
25602577
return dr;
25612578

25622579
}
@@ -2567,10 +2584,10 @@ public double calculateBillItemDiscountRate(BillItem bi) {
25672584

25682585
double dr;
25692586
dr = (retailRate * discountRate) / 100;
2570-
2587+
System.out.println("3 dr = " + dr);
25712588
return dr;
25722589
}
2573-
2590+
System.out.println("no dr");
25742591
return 0;
25752592

25762593
}
@@ -2920,15 +2937,11 @@ public void setPaymentSchemeController(PaymentSchemeController PaymentSchemeCont
29202937
}
29212938

29222939
public PaymentScheme getPaymentScheme() {
2923-
System.err.println("GEtting Paymen");
2924-
System.out.println("paymentScheme = " + paymentScheme);
29252940
return paymentScheme;
29262941
}
29272942

29282943
public void setPaymentScheme(PaymentScheme paymentScheme) {
2929-
System.err.println("Setting Pay");
29302944
this.paymentScheme = paymentScheme;
2931-
System.out.println("paymentScheme = " + paymentScheme);
29322945
}
29332946

29342947
public StockHistoryFacade getStockHistoryFacade() {

src/main/java/com/divudi/entity/Bill.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55
package com.divudi.entity;
66

7+
import com.divudi.bean.common.RetirableEntity;
78
import com.divudi.data.BillClassType;
89
import com.divudi.data.BillType;
910
import com.divudi.data.BillTypeAtomic;
@@ -48,7 +49,7 @@
4849
*/
4950
@Entity
5051
@Inheritance
51-
public class Bill implements Serializable {
52+
public class Bill implements Serializable, RetirableEntity {
5253

5354
@Id
5455
@GeneratedValue(strategy = GenerationType.AUTO)

src/main/java/com/divudi/entity/BillComponent.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package com.divudi.entity;
66

77
import com.divudi.bean.cashTransaction.PaymentMethodValue;
8+
import com.divudi.bean.common.RetirableEntity;
89
import java.io.Serializable;
910
import java.util.Date;
1011
import javax.persistence.Entity;
@@ -19,7 +20,7 @@
1920
* @author buddhika
2021
*/
2122
@Entity
22-
public class BillComponent implements Serializable {
23+
public class BillComponent implements Serializable, RetirableEntity {
2324

2425
static final long serialVersionUID = 1L;
2526
@Id

0 commit comments

Comments
 (0)