Skip to content

Commit

Permalink
Merge branch 'master' into Issue#6525
Browse files Browse the repository at this point in the history
  • Loading branch information
DamithDeshan authored Aug 5, 2024
2 parents dab9dc9 + 3a3075b commit e251fc3
Show file tree
Hide file tree
Showing 15 changed files with 220 additions and 82 deletions.
2 changes: 1 addition & 1 deletion .github/counter.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6
3
2 changes: 1 addition & 1 deletion .github/last_date.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20240804
20240805
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Developed using Java Enterprise Edition, the system offers both a web applicatio



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



Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>ruhunuDemo</artifactId>
<version>3.0.0</version>
<packaging>war</packaging>
<name>ruhunu</name>
<name>ruhunuDemo</name>

<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
Expand Down
77 changes: 62 additions & 15 deletions src/main/java/com/divudi/bean/common/BillSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
import com.divudi.data.ServiceType;
import com.divudi.entity.Doctor;
import com.divudi.facade.FeeFacade;
import com.divudi.facade.PatientFacade;
import com.divudi.facade.StaffFacade;
import com.divudi.java.CommonFunctions;
import com.divudi.light.common.BillLight;
import java.io.Serializable;
Expand Down Expand Up @@ -157,6 +159,8 @@ public class BillSearch implements Serializable {
private EmailFacade emailFacade;
@EJB
FeeFacade feeFacade;
@EJB
private StaffFacade staffFacade;
/**
* Controllers
*/
Expand Down Expand Up @@ -1267,9 +1271,9 @@ public boolean calculateRefundTotalForOpdBill() {

double refundingValue = 0;
for (BillFee rbf : i.getBillFees()) {
System.out.println("rbf.getFeeValue() name = " + rbf.getFee().getName());
System.out.println("rbf.getFeeValue() = " + rbf.getFeeValue());
System.out.println("rbf.getFeeValue() fee = " + rbf.getFee().getFee());
//System.out.println("rbf.getFeeValue() name = " + rbf.getFee().getName());
//System.out.println("rbf.getFeeValue() = " + rbf.getFeeValue());
//System.out.println("rbf.getFeeValue() fee = " + rbf.getFee().getFee());
refundingValue += rbf.getFeeValue();
}
i.setNetValue(refundingValue);
Expand Down Expand Up @@ -1569,6 +1573,13 @@ public String refundOpdBill() {
JsfUtil.addErrorMessage("One or more bill Item you are refunding has been already paid to Service Provider. Can not refund again.");
return "";
}

if (paymentMethod == PaymentMethod.Staff) {
if (getBill().getToStaff() == null) {
JsfUtil.addErrorMessage("Can't Select Staff Method");
return "";
}
}

if (refundingBill.getBillItems() != null) {
for (BillItem bi : refundingBill.getBillItems()) {
Expand Down Expand Up @@ -1602,23 +1613,36 @@ public String refundOpdBill() {
Payment p = getOpdPreSettleController().createPaymentForCancellationsAndRefunds(refundingBill, paymentMethod);

//TODO: Create Payments for Bill Items
if (getBill().getPaymentMethod() == PaymentMethod.Credit) {
if (getBill().getToStaff() != null) {
staffBean.updateStaffCredit(getBill().getToStaff(), 0 - (getBill().getNetTotal() + getBill().getVat()));
JsfUtil.addSuccessMessage("Staff Credit Updated");
} else if (getBill().getCreditCompany() != null) {
//TODO : Update Credit COmpany Bill
}
if (getBill().getPaymentMethod() == PaymentMethod.Staff) {
//System.out.println("PaymentMethod - Staff");

//System.out.println("Before Balance = " + getBill().getToStaff().getCurrentCreditValue());
getBill().getToStaff().setCurrentCreditValue(getBill().getToStaff().getCurrentCreditValue() - Math.abs(getRefundingBill().getNetTotal()));

//System.out.println("After Balance = " + getBill().getToStaff().getCurrentCreditValue());
staffFacade.edit(getBill().getToStaff());
//System.out.println("Staff Credit Updated");

} else if (getBill().getPaymentMethod() == PaymentMethod.PatientDeposit) {
//TODO: Update Patient Deposit
//System.out.println("Before Balance = " + bill.getPatient().getRunningBalance());
if (bill.getPatient().getRunningBalance() == null) {
//System.out.println("Null");
bill.getPatient().setRunningBalance(Math.abs(bill.getNetTotal()));
} else {
//System.out.println("Not Null - Add BillValue");
bill.getPatient().setRunningBalance(bill.getPatient().getRunningBalance() + Math.abs(bill.getNetTotal()));
}
patientFacade.edit(bill.getPatient());
//System.out.println("After Balance = " + bill.getPatient().getRunningBalance());
}

//TODO - Update Bill Payment Values
//TODO - Update Bill Paid Value
printPreview = true;
return "";
}

@EJB
private PatientFacade patientFacade;

public boolean sampleHasBeenCollected(Bill rf) {
boolean oneItemIsSampled = false;
for (BillItem bi : rf.getBillItems()) {
Expand Down Expand Up @@ -2162,6 +2186,13 @@ public void cancelOpdBill() {
}
}

if (paymentMethod == PaymentMethod.Staff) {
if (getBill().getToStaff() == null) {
JsfUtil.addErrorMessage("Can't Select Staff Method");
return;
}
}

if (!getWebUserController().hasPrivilege("OpdCancel")) {
JsfUtil.addErrorMessage("You have no privilege to cancel OPD bills. Please contact System Administrator.");
return;
Expand Down Expand Up @@ -2972,7 +3003,7 @@ public String navigateViewOpdBillByBillTypeAtomic() {
case PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_CHANNELING_SERVICE_RETURN:
case PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_CHANNELING_SERVICE_SESSION:
return navigateToViewChannelingProfessionalPaymentBill();

case OPD_BATCH_BILL_TO_COLLECT_PAYMENT_AT_CASHIER:
case OPD_BATCH_BILL_PAYMENT_COLLECTION_AT_CASHIER:
case OPD_BATCH_BILL_CANCELLATION:
Expand All @@ -2981,7 +3012,7 @@ public String navigateViewOpdBillByBillTypeAtomic() {
case PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_OPD_SERVICES:
case PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_OPD_SERVICES_RETURN:
return navigateToViewOpdProfessionalPaymentBill();

}
JsfUtil.addErrorMessage("Wrong Bill Type");
return "";
Expand Down Expand Up @@ -4090,6 +4121,22 @@ public void setReferredBy(Doctor referredBy) {
this.referredBy = referredBy;
}

public PatientFacade getPatientFacade() {
return patientFacade;
}

public void setPatientFacade(PatientFacade patientFacade) {
this.patientFacade = patientFacade;
}

public StaffFacade getStaffFacade() {
return staffFacade;
}

public void setStaffFacade(StaffFacade staffFacade) {
this.staffFacade = staffFacade;
}

public class PaymentSummary {

private long idCounter = 0;
Expand Down
36 changes: 29 additions & 7 deletions src/main/java/com/divudi/bean/common/OpdPreSettleController.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import com.divudi.facade.PaymentFacade;
import com.divudi.facade.PersonFacade;
import com.divudi.facade.PharmaceuticalBillItemFacade;
import com.divudi.facade.StaffFacade;
import com.divudi.facade.TokenFacade;

import java.io.Serializable;
Expand Down Expand Up @@ -122,6 +123,9 @@ public OpdPreSettleController() {
TokenFacade tokenFacade;
@EJB
StaffBean staffBean;
@EJB
private StaffFacade staffFacade;

/////////////////////////
Item selectedAlternative;

Expand Down Expand Up @@ -1703,26 +1707,36 @@ public Payment createPaymentForCancellationsforOPDBill(Bill bill, PaymentMethod
p.setCreater(getSessionController().getLoggedUser());
p.setPaymentMethod(pm);

System.out.println("pm = " + pm);
//System.out.println("pm = " + pm);

if (pm == PaymentMethod.PatientDeposit) {
System.out.println("Before Balance = " + bill.getPatient().getRunningBalance());
//System.out.println("Before Balance = " + bill.getPatient().getRunningBalance());
if (bill.getPatient().getRunningBalance() == null) {
System.out.println("Null");
//System.out.println("Null");
bill.getPatient().setRunningBalance(Math.abs(bill.getNetTotal()));
} else {
System.out.println("Not Null - Add BillValue");
//System.out.println("Not Null - Add BillValue");
bill.getPatient().setRunningBalance(bill.getPatient().getRunningBalance() + Math.abs(bill.getNetTotal()));
}
patientFacade.edit(bill.getPatient());
System.out.println("After Balance = " + bill.getPatient().getRunningBalance());
//System.out.println("After Balance = " + bill.getPatient().getRunningBalance());
}

if (pm == PaymentMethod.Staff) {
//System.out.println("PaymentMethod - Staff");
//System.out.println("Before Balance = " + bill.getToStaff().getCurrentCreditValue());
bill.getToStaff().setCurrentCreditValue( bill.getToStaff().getCurrentCreditValue() - Math.abs(bill.getNetTotal()));
//System.out.println("After Balance = " + bill.getToStaff().getCurrentCreditValue());
staffFacade.edit(bill.getToStaff());
//System.out.println("Staff Credit Updated");
}
System.out.println("001");

//System.out.println("001");
if (p.getId() == null) {
getPaymentFacade().create(p);
}
getPaymentFacade().edit(p);
System.out.println("End Payment");
//System.out.println("End Payment");
return p;
}

Expand Down Expand Up @@ -2017,4 +2031,12 @@ public void setForeigner(boolean foreigner) {
this.foreigner = foreigner;
}

public StaffFacade getStaffFacade() {
return staffFacade;
}

public void setStaffFacade(StaffFacade staffFacade) {
this.staffFacade = staffFacade;
}

}
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
54 changes: 54 additions & 0 deletions src/main/java/com/divudi/bean/store/StoreAdjustmentController.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import com.divudi.bean.common.SessionController;
import com.divudi.bean.common.util.JsfUtil;
import com.divudi.bean.pharmacy.ConsumableCategoryController;
import com.divudi.data.BillClassType;
import com.divudi.data.BillNumberSuffix;
import com.divudi.data.BillType;
Expand Down Expand Up @@ -627,5 +628,58 @@ public YearMonthDay getYearMonthDay() {
public void setYearMonthDay(YearMonthDay yearMonthDay) {
this.yearMonthDay = yearMonthDay;
}
private List<Stock> stk;

public void fillSelectStock() {
List<Stock> items = new ArrayList<>();
if (stock == null) {
stk = items;
return;
}
String sql;
Map<String, Object> m = new HashMap<>();

sql = "select i "
+ " from Stock i "
+ " where i.department=:d "
+ " and i.itemBatch.item.code=:stationary "
+ " order by i.stock desc";

m.put("d", sessionController.getDepartment());
m.put("stationary", stock.getItemBatch().getItem().getCode()); // Assuming stk contains the item

items = getStockFacade().findByJpql(sql, m);

if (items != null) {
stk = items;
}
}

public List<Stock> getStk() {
return stk;
}

public void setStk(List<Stock> stk) {
this.stk = stk;
}





public void fillSelectStock(){
List<Stock> items = new ArrayList<>();

String sql;
Map m = new HashMap();
sql = "select i "
+ " from Stock i "
+ " where i.department=:d "
+ " order by i.stock desc";
m.put("d", sessionController.getDepartment());

items = getStockFacade().findByJpql(sql, m);


}
}
Loading

0 comments on commit e251fc3

Please sign in to comment.