Skip to content

Commit

Permalink
10233 direct purchase last purchase rate not get automatically (#10248)
Browse files Browse the repository at this point in the history
* Signed-off-by: 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 <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>

* Signed-off-by: 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 <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>

* Signed-off-by: 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 <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>

* Signed-off-by: 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 <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>

* Signed-off-by: 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 <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>

* Signed-off-by: Dr M H B Ariyaratne <[email protected]>

* 9964 staff welfare bug fixes

* Signed-off-by: Isuru Ranaweera <[email protected]>

* Signed-off-by: Isuru Ranaweera <[email protected]>

* Signed-off-by: Pubudu-Piyankara <[email protected]>

* Closed #10050
Signed-off-by: Pubudu-Piyankara <[email protected]>

* Signed-off-by: Pubudu-Piyankara <[email protected]>

* Signed-off-by: Pubudu-Piyankara <[email protected]>

* Signed-off-by: Pubudu-Piyankara <[email protected]>

* Closed #10036
Signed-off-by: Pubudu-Piyankara <[email protected]>

* Signed-off-by: DamithDeshan <[email protected]>

* closes #10062
Signed-off-by: DamithDeshan <[email protected]>

* Signed-off-by: DamithDeshan <[email protected]>

* Signed-off-by: Dr M H B Ariyaratne <[email protected]>

* 9964 staff welfare bug fixes

* 10034 discount report bug fixes

* changed css file printOnly
Signed-off-by: Isuru Ranaweera <[email protected]>

* Added a new table to print it without filter boxes
Signed-off-by: Isuru Ranaweera <[email protected]>

* 10034 staff welfare report bug fixes

* 10034 discount report bug fixes

* Signed-off-by: Sandith Pivithuru <[email protected]>

* Signed-off-by: Sandith Pivithuru <[email protected]>

* Signed-off-by: Sandith Pivithuru <[email protected]>

* Signed-off-by: Sandith Pivithuru <[email protected]>

* Pharmacy purchase order list ui improvement.

Signed-off-by: Chinthaka Prasad Wijerathna <[email protected]>

* Signed-off-by: DamithDeshan <[email protected]>

* Signed-off-by: Dr M H B Ariyaratne <[email protected]>

* Closes #10064
Until now, the atomic bill type for Cancelleation of Pharmacy Direct Issue toi BHTs were not recorded.
Now the bill type atomic is recorded.

But for past data, have to do to admin functions and click the add missing bill type atomics to correct old data.

Signed-off-by: Dr M H B Ariyaratne <[email protected]>

* Signed-off-by: Dr M H B Ariyaratne <[email protected]>

* Signed-off-by: Dr M H B Ariyaratne <[email protected]>

* Merge pull request #10063

* Signed-off-by: DamithDeshan <[email protected]>

* Fixed #10013

* Signed-off-by: Lawan Samarasekara <[email protected]>

* Signed-off-by: Lawan Samarasekara <[email protected]>

* Merge branch 'coop-prod' of https://github.com/hmislk/hmis.git into I…

* Merge branch 'Issue#10013-Bug_Fix_on_OPD_Card_Can't_Add_Drug' of http…

* closes #10062

* Signed-off-by: DamithDeshan <[email protected]>

* closes #10079
Signed-off-by: DamithDeshan <[email protected]>

* closes #10081
Signed-off-by: DamithDeshan <[email protected]>

* Signed-off-by: DamithDeshan <[email protected]>

* https://youtu.be/GDWy_tlJ2Gk
Closes #10086
Signed-off-by: Dr M H B Ariyaratne <[email protected]>

* Update rh_prod_ci_cd.yml

* Signed-off-by: Dr M H B Ariyaratne <[email protected]>

* Closes #10097
Signed-off-by: Buddhika Ariyaratne <[email protected]>
**Pull Request Comment**

**Summary of Changes**
- **Type Visibility**: Restricted the “Type” column to be visible only for admin users.
- **True/False Replacement**: Replaced the boolean “true”/“false” text with appropriate icons (“✓” for true, “✕” for false).
- **Enhanced Search**: Extended the search functionality to include the “Value” column, making it easier to find specific application options.

**Verification & Testing**
1. **Login as Admin**: Confirm that the “Type” column is visible, and icons replace the previous true/false text.
2. **Login as Non-Admin**: Verify that the “Type” column is hidden.
3. **Search**: Ensure searching by the option’s key or value (including yes/no) yields expected results.

All changes have been completed and verified locally.

Signed-off-by: Buddhika Ariyaratne <[email protected]>

* Signed-off-by: Buddhika Ariyaratne <[email protected]>

* Signed-off-by: Buddhika Ariyaratne <[email protected]>

* Signed-off-by: Buddhika Ariyaratne <[email protected]>

* Closes #10077
Signed-off-by: Buddhika Ariyaratne <[email protected]>

* Closes with Production persistance.xml
Signed-off-by: Buddhika Ariyaratne <[email protected]>

* fix: Expenses added to the GRN payment

Signed-off-by: Chinthaka Prasad Wijerathna <[email protected]>

* Closes #10102
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>

* Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>

* Closes #10111

Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>

* Signed-off-by: Dr M H B Ariyaratne <[email protected]>

* Closes #10114
Signed-off-by: Dr M H B Ariyaratne <[email protected]>

* Signed-off-by: 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 <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>

* Closes #10114
Signed-off-by: Dr M H B Ariyaratne <[email protected]>

* Closes #4834
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>

* Closes #10155
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>

* Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>

* Closes #9988
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>

* Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>

* Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>

* # Fixed Purchase Rate Adjustment BillItem Double Issue
Signed-off-by: DamithDeshan <[email protected]>

* #Fixed Store Sale Rate Adjustment BillItem Bug
Signed-off-by: DamithDeshan <[email protected]>

* #Fixed Staff Stock Adjustment Bug
Signed-off-by: DamithDeshan <[email protected]>

* closes #10221
Signed-off-by: DamithDeshan <[email protected]>

* Signed-off-by: DamithDeshan <[email protected]>

* Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>

* Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>

* Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>

* Closes #10227
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>

* Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>

* Signed-off-by: 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 <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>

* Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>

* Closes #10243
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>

* Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>

* Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>

* Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>

* Closes #10239
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>

* Closes #10233
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>

---------

Signed-off-by: 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 <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>
Signed-off-by: Dr M H B Ariyaratne <[email protected]>
Signed-off-by: Chinthaka Prasad Wijerathna <[email protected]>
Signed-off-by: Buddhika Ariyaratne <[email protected]>
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
Co-authored-by: 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 <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>
Co-authored-by: imexh <[email protected]>
Co-authored-by: Isuru Ranaweera <[email protected]>
Co-authored-by: Pubudu-Piyankara <[email protected]>
Co-authored-by: DamithDeshan <[email protected]>
Co-authored-by: Sandith Pivithuru <[email protected]>
Co-authored-by: Chinthaka Prasad Wijerathna <[email protected]>
Co-authored-by: H.K. Damith Deshan <[email protected]>
Co-authored-by: Geeth Sandaru Madhushan <[email protected]>
  • Loading branch information
9 people authored Jan 27, 2025
1 parent e30fee6 commit 0398e36
Show file tree
Hide file tree
Showing 8 changed files with 181 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import javax.inject.Inject;
import javax.inject.Named;
import javax.persistence.TemporalType;
import org.primefaces.event.SelectEvent;

/**
*
Expand Down Expand Up @@ -110,7 +111,7 @@ public class PharmacyPurchaseController implements Serializable {
private BilledBill bill;
private BillItem currentBillItem;
private boolean printPreview;

private String warningMessage;

double saleRate;
Expand All @@ -130,12 +131,12 @@ public class PharmacyPurchaseController implements Serializable {
private Institution site;
private Institution toInstitution;
private PaymentMethod paymentMethod;

private BillItem currentExpense;
private List<BillItem> billExpenses;

public List<BillItem> getBillExpenses() {
if(billExpenses == null){
if (billExpenses == null) {
billExpenses = new ArrayList<>();
}
return billExpenses;
Expand All @@ -146,7 +147,7 @@ public void setBillExpenses(List<BillItem> billExpenses) {
}

public BillItem getCurrentExpense() {
if(currentExpense == null){
if (currentExpense == null) {
currentExpense = new BillItem();
}
return currentExpense;
Expand All @@ -155,7 +156,14 @@ public BillItem getCurrentExpense() {
public void setCurrentExpense(BillItem currentExpense) {
this.currentExpense = currentExpense;
}


public void onItemSelect(SelectEvent event) {
// Item selectedItem = (Item) event.getObject();
// System.out.println("selectedItem = " + selectedItem);
// System.out.println("getCurrentBillItem().getItem() = " + getCurrentBillItem().getItem());
getCurrentBillItem().getPharmaceuticalBillItem().setPurchaseRate(getPharmacyBean().getLastPurchaseRate(getCurrentBillItem().getItem(), getSessionController().getDepartment()));
getCurrentBillItem().getPharmaceuticalBillItem().setRetailRate(getPharmacyBean().getLastRetailRate(getCurrentBillItem().getItem(), getSessionController().getDepartment()));
}

public void createGrnAndPurchaseBillsWithCancellsAndReturnsOfSingleDepartment() {
Date startTime = new Date();
Expand Down Expand Up @@ -292,7 +300,7 @@ public void makeNull() {
billItems = null;
billExpenses = null;
currentExpense = null;
warningMessage=null;
warningMessage = null;
}

public String navigateToAddNewPharmacyWholesaleDirectPurchaseBill() {
Expand Down Expand Up @@ -474,8 +482,7 @@ public void calNetTotal() {
}

}



public void addExpense() {
if (getBill().getId() == null) {
getBillFacade().create(getBill());
Expand Down Expand Up @@ -580,18 +587,18 @@ public void settle() {
JsfUtil.addErrorMessage("Please Add Item Quantities To Bill");
return;
}

//check and calculate expenses separately
if(billExpenses != null && !billExpenses.isEmpty()){
if (billExpenses != null && !billExpenses.isEmpty()) {
getBill().setBillExpenses(billExpenses);

double totalForExpenses = 0;
for(BillItem expense : getBillExpenses()){
for (BillItem expense : getBillExpenses()) {
totalForExpenses += expense.getNetValue();
}

getBill().setExpenseTotal(-totalForExpenses);
getBill().setNetTotal(getBill().getNetTotal()-totalForExpenses);
getBill().setNetTotal(getBill().getNetTotal() - totalForExpenses);
}

getPharmacyBillBean().calculateRetailSaleValueAndFreeValueAtPurchaseRate(getBill());
Expand Down Expand Up @@ -742,7 +749,7 @@ public void addItem() {
getCurrentBillItem().getPharmaceuticalBillItem().setFreeQty(getCurrentBillItem().getPharmaceuticalBillItem().getFreeQtyPacks() * getCurrentBillItem().getItem().getDblValue());
getCurrentBillItem().getPharmaceuticalBillItem().setPurchaseRate(getCurrentBillItem().getPharmaceuticalBillItem().getPurchaseRatePack() / getCurrentBillItem().getItem().getDblValue());
}

System.out.println("getBillItems().size() = " + getBillItems().size());

getCurrentBillItem().setSearialNo(getBillItems().size());
Expand All @@ -756,7 +763,7 @@ public void addItem() {
public void saveBill() {

String deptId = billNumberBean.departmentBillNumberGeneratorYearly(getSessionController().getDepartment(), BillTypeAtomic.PHARMACY_DIRECT_PURCHASE);

getBill().setDeptId(deptId);
getBill().setInsId(deptId);
getBill().setBillTypeAtomic(BillTypeAtomic.PHARMACY_DIRECT_PURCHASE);
Expand Down Expand Up @@ -1057,6 +1064,4 @@ public void setPaymentMethod(PaymentMethod paymentMethod) {
this.paymentMethod = paymentMethod;
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ public void addItem() {
}

getCurrentBillItem().setSearialNo(getBillItems().size());
getCurrentBillItem().getPharmaceuticalBillItem().setPurchaseRateInUnit(getPharmacyBean().getLastPurchaseRate(getCurrentBillItem().getItem(), getSessionController().getDepartment()));
getCurrentBillItem().getPharmaceuticalBillItem().setRetailRateInUnit(getPharmacyBean().getLastRetailRate(getCurrentBillItem().getItem(), getSessionController().getDepartment()));
getCurrentBillItem().getPharmaceuticalBillItem().setPurchaseRate(getPharmacyBean().getLastPurchaseRate(getCurrentBillItem().getItem(), getSessionController().getDepartment()));
getCurrentBillItem().getPharmaceuticalBillItem().setRetailRate(getPharmacyBean().getLastRetailRate(getCurrentBillItem().getItem(), getSessionController().getDepartment()));

getBillItems().add(getCurrentBillItem());

Expand Down
76 changes: 62 additions & 14 deletions src/main/java/com/divudi/ejb/PharmacyService.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
import com.divudi.entity.Item;
import com.divudi.entity.Patient;
import com.divudi.entity.clinical.ClinicalFindingValue;
import com.divudi.entity.pharmacy.Amp;
import com.divudi.entity.pharmacy.Ampp;
import com.divudi.entity.pharmacy.Vmp;
import com.divudi.entity.pharmacy.Vtm;
import com.divudi.facade.ClinicalFindingValueFacade;
import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -47,10 +51,10 @@ public List<ClinicalFindingValue> getAllergyListForPatient(Patient patient) {

public boolean isAllergyForPatient(Patient patient, BillItem billItem, List<ClinicalFindingValue> allergyListOfPatient) {

if(allergyListOfPatient == null || allergyListOfPatient.isEmpty()){
allergyListOfPatient = getAllergyListForPatient(patient);
if (allergyListOfPatient == null || allergyListOfPatient.isEmpty()) {
allergyListOfPatient = getAllergyListForPatient(patient);
}

if (allergyListOfPatient.isEmpty()) {
return false;
}
Expand Down Expand Up @@ -80,16 +84,16 @@ public boolean isAllergyForPatient(Patient patient, BillItem billItem, List<Clin
}

public String isAllergyForPatient(Patient patient, List<BillItem> items, List<ClinicalFindingValue> allergyLisForPatient) {

boolean hasAllergicMedicines = false;
List<Item> allergyItems = new ArrayList<>();
StringBuilder allergyMsg = new StringBuilder();
if(allergyLisForPatient == null || allergyLisForPatient.isEmpty()){

if (allergyLisForPatient == null || allergyLisForPatient.isEmpty()) {
allergyLisForPatient = getAllergyListForPatient(patient);
}
if(allergyLisForPatient.isEmpty()){

if (allergyLisForPatient.isEmpty()) {
return "";
}

Expand All @@ -104,18 +108,62 @@ public String isAllergyForPatient(Patient patient, List<BillItem> items, List<Cl

if (hasAllergicMedicines) {
allergyMsg.append("This patient should be allergy of ");
for(Item i : allergyItems){
allergyMsg.append(i.getName() +" , ");

for (Item i : allergyItems) {
allergyMsg.append(i.getName() + " , ");
}
if(allergyMsg.length() >0){
allergyMsg.setLength(allergyMsg.length()-2);

if (allergyMsg.length() > 0) {
allergyMsg.setLength(allergyMsg.length() - 2);
}
return allergyMsg.toString();
}

return "";
}

public void addBillItemInstructions(BillItem billItem) {
if (billItem == null) {
return;
}
if (billItem.getPharmaceuticalBillItem() == null) {
return;
}
Item item = billItem.getItem();
if (item == null) {
return;
}
String instrcutions = item.getInstructions();
Amp amp = null;
Vmp vmp = null;
Vtm vtm = null;
if (instrcutions == null || instrcutions.trim().isEmpty()) {

if (item instanceof Ampp) {
Ampp ampp = (Ampp) item;
amp = ampp.getAmp();
} else if (item instanceof Amp) {
amp = (Amp) item;
}
if (amp != null) {
vmp = amp.getVmp();
if (vmp != null) {
instrcutions = vmp.getInstructions();
}
}
}
if (instrcutions == null || instrcutions.trim().isEmpty()) {
if (vmp != null) {
if (vmp.getVtm() instanceof Vtm) {
vtm = (Vtm) vmp.getVtm();
}
if (vtm != null) {
instrcutions = vtm.getInstructions();
}
}

}
billItem.setInstructions(instrcutions);
}

}
14 changes: 13 additions & 1 deletion src/main/java/com/divudi/entity/BillItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* @author buddhika
*/
@Entity
public class BillItem implements Serializable, RetirableEntity {
public class BillItem implements Serializable, RetirableEntity {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
Expand Down Expand Up @@ -146,6 +146,8 @@ public class BillItem implements Serializable, RetirableEntity {
private Department requestedToDepartment;
@ManyToOne
private Department peformedDepartment;
@Lob
private String instructions;

// @Transient
int searialNo;
Expand Down Expand Up @@ -1074,4 +1076,14 @@ public void setPeformedDepartment(Department peformedDepartment) {
this.peformedDepartment = peformedDepartment;
}

public String getInstructions() {
return instructions;
}

public void setInstructions(String instructions) {
this.instructions = instructions;
}



}
13 changes: 13 additions & 0 deletions src/main/java/com/divudi/entity/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ public class Item implements Serializable, Comparable<Item>, RetirableEntity {

@Lob
private String forGender;

@Lob
private String instructions;

@Column(name = "DTYPE", insertable = false, updatable = false)
private String clazz;
Expand Down Expand Up @@ -1498,6 +1501,16 @@ public void setCanUploadPatinrtReport(boolean canUploadPatinrtReport) {
this.canUploadPatinrtReport = canUploadPatinrtReport;
}

public String getInstructions() {
return instructions;
}

public void setInstructions(String instructions) {
this.instructions = instructions;
}



static class ReportItemComparator implements Comparator<ReportItem> {

@Override
Expand Down
11 changes: 9 additions & 2 deletions src/main/webapp/pharmacy/admin/vtm.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:se="http://xmlns.jcp.org/jsf/composite/pharmacy/search">
xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:body>
<ui:composition template="/pharmacy/admin/index.xhtml">
<ui:define name="subcontent">
Expand Down Expand Up @@ -77,6 +76,14 @@
value="#{vtmController.current.descreption}"
required="false"
class="form-control" ></h:inputTextarea>


<p:outputLabel for="txtIns" value="Instructions" class="form-label"></p:outputLabel>
<h:inputTextarea
id="txtIns"
value="#{vtmController.current.instructions}"
required="false"
class="form-control" ></h:inputTextarea>
<p:commandButton
id="btnSave"
value="Save"
Expand Down
Loading

0 comments on commit 0398e36

Please sign in to comment.