Skip to content

Commit

Permalink
10137 refunds not shown in cashier summary (#10150)
Browse files Browse the repository at this point in the history
* Signed-off-by: Dr M H B Ariyaratne <buddhika.ari@gmail.com>

* 9964 staff welfare bug fixes

* Signed-off-by: Isuru Ranaweera <isuru.udara.ranaweera@gmail.com>

* Signed-off-by: Isuru Ranaweera <isuru.udara.ranaweera@gmail.com>

* Signed-off-by: Pubudu-Piyankara <pubudupiyankara.me@gmail.com>

* Closed #10050
Signed-off-by: Pubudu-Piyankara <pubudupiyankara.me@gmail.com>

* Signed-off-by: Pubudu-Piyankara <pubudupiyankara.me@gmail.com>

* Signed-off-by: Pubudu-Piyankara <pubudupiyankara.me@gmail.com>

* Signed-off-by: Pubudu-Piyankara <pubudupiyankara.me@gmail.com>

* Closed #10036
Signed-off-by: Pubudu-Piyankara <pubudupiyankara.me@gmail.com>

* Signed-off-by: DamithDeshan <hkddrajapaksha@gmail.com>

* closes #10062
Signed-off-by: DamithDeshan <hkddrajapaksha@gmail.com>

* Signed-off-by: DamithDeshan <hkddrajapaksha@gmail.com>

* Signed-off-by: Dr M H B Ariyaratne <buddhika.ari@gmail.com>

* 9964 staff welfare bug fixes

* 10034 discount report bug fixes

* changed css file printOnly
Signed-off-by: Isuru Ranaweera <isuru.udara.ranaweera@gmail.com>

* Added a new table to print it without filter boxes
Signed-off-by: Isuru Ranaweera <isuru.udara.ranaweera@gmail.com>

* 10034 staff welfare report bug fixes

* 10034 discount report bug fixes

* Signed-off-by: Sandith Pivithuru <sandithpivithuru@gmail.com>

* Signed-off-by: Sandith Pivithuru <sandithpivithuru@gmail.com>

* Signed-off-by: Sandith Pivithuru <sandithpivithuru@gmail.com>

* Signed-off-by: Sandith Pivithuru <sandithpivithuru@gmail.com>

* Pharmacy purchase order list ui improvement.

Signed-off-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad@users.noreply.github.com>

* Signed-off-by: DamithDeshan <hkddrajapaksha@gmail.com>

* Signed-off-by: Dr M H B Ariyaratne <buddhika.ari@gmail.com>

* 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 <buddhika.ari@gmail.com>

* Signed-off-by: Dr M H B Ariyaratne <buddhika.ari@gmail.com>

* Signed-off-by: Dr M H B Ariyaratne <buddhika.ari@gmail.com>

* Merge pull request #10063

* Signed-off-by: DamithDeshan <hkddrajapaksha@gmail.com>

* Fixed #10013

* Signed-off-by: Lawan Samarasekara <lawan.chaamindu1234@gmail.com>

* Signed-off-by: Lawan Samarasekara <lawan.chaamindu1234@gmail.com>

* 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 <hkddrajapaksha@gmail.com>

* closes #10079
Signed-off-by: DamithDeshan <hkddrajapaksha@gmail.com>

* closes #10081
Signed-off-by: DamithDeshan <hkddrajapaksha@gmail.com>

* Signed-off-by: DamithDeshan <hkddrajapaksha@gmail.com>

* https://youtu.be/GDWy_tlJ2Gk
Closes #10086
Signed-off-by: Dr M H B Ariyaratne <buddhika.ari@gmail.com>

* Update rh_prod_ci_cd.yml

* Signed-off-by: Dr M H B Ariyaratne <buddhika.ari@gmail.com>

* Closes #10097
Signed-off-by: Buddhika Ariyaratne <buddhika.ari@gmail.com>
**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 <buddhika.ari@gmail.com>

* Signed-off-by: Buddhika Ariyaratne <buddhika.ari@gmail.com>

* Signed-off-by: Buddhika Ariyaratne <buddhika.ari@gmail.com>

* Signed-off-by: Buddhika Ariyaratne <buddhika.ari@gmail.com>

* Closes #10077
Signed-off-by: Buddhika Ariyaratne <buddhika.ari@gmail.com>

* Closes with Production persistance.xml
Signed-off-by: Buddhika Ariyaratne <buddhika.ari@gmail.com>

* fix: Expenses added to the GRN payment

Signed-off-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad@users.noreply.github.com>

* Closes #10102
Signed-off-by: Dr M H Buddhika Ariyaratne <buddhika.ari@gmail.com>

* Signed-off-by: Dr M H Buddhika Ariyaratne <buddhika.ari@gmail.com>

* Closes #10111

Signed-off-by: Dr M H Buddhika Ariyaratne <buddhika.ari@gmail.com>

* Signed-off-by: Dr M H B Ariyaratne <buddhika.ari@gmail.com>

* Closes #10114
Signed-off-by: Dr M H B Ariyaratne <buddhika.ari@gmail.com>

* fact: add expense section to direct purchase and update bill with net total

Signed-off-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad@users.noreply.github.com>

* fact:improve purchase bill adding expenses and ui improvements.

Signed-off-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad@users.noreply.github.com>

* Signed-off-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad@users.noreply.github.com>

* Signed-off-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad@users.noreply.github.com>

* Signed-off-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad@users.noreply.github.com>

* Closes #10114
Signed-off-by: Dr M H B Ariyaratne <buddhika.ari@gmail.com>

* Signed-off-by: Dr M H Buddhika Ariyaratne <buddhika.ari@gmail.com>

* Closes #10125
Signed-off-by: Dr M H Buddhika Ariyaratne <buddhika.ari@gmail.com>

* Signed-off-by: Dr M H Buddhika Ariyaratne <buddhika.ari@gmail.com>

* Signed-off-by: Dr M H Buddhika Ariyaratne <buddhika.ari@gmail.com>

* Closes #10031
Signed-off-by: Dr M H Buddhika Ariyaratne <buddhika.ari@gmail.com>

* Closes #10137
Signed-off-by: Dr M H Buddhika Ariyaratne <buddhika.ari@gmail.com>

* Signed-off-by: Dr M H Buddhika Ariyaratne <buddhika.ari@gmail.com>

* Signed-off-by: Dr M H Buddhika Ariyaratne <buddhika.ari@gmail.com>

---------

Signed-off-by: Dr M H B Ariyaratne <buddhika.ari@gmail.com>
Signed-off-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad@users.noreply.github.com>
Signed-off-by: Buddhika Ariyaratne <buddhika.ari@gmail.com>
Signed-off-by: Dr M H Buddhika Ariyaratne <buddhika.ari@gmail.com>
Co-authored-by: imexh <chandikaranawella@gmail.com>
Co-authored-by: Isuru Ranaweera <isuru.udara.ranaweera@gmail.com>
Co-authored-by: Pubudu-Piyankara <pubudupiyankara.me@gmail.com>
Co-authored-by: DamithDeshan <hkddrajapaksha@gmail.com>
Co-authored-by: Sandith Pivithuru <sandithpivithuru@gmail.com>
Co-authored-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad@users.noreply.github.com>
Co-authored-by: H.K. Damith Deshan <108138918+DamithDeshan@users.noreply.github.com>
Co-authored-by: Geeth Sandaru Madhushan <geeth.gsm@gmail.com>
  • Loading branch information
9 people authored Jan 20, 2025
1 parent 576f30a commit ec71f8a
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 338 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.divudi</groupId>
<artifactId>digasiriNew</artifactId>
<artifactId>rh</artifactId>
<version>3.0.0</version>
<packaging>war</packaging>
<name>digasiriNew</name>
<name>rh</name>

<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
Expand Down
62 changes: 58 additions & 4 deletions src/main/java/com/divudi/bean/common/SearchController.java
Original file line number Diff line number Diff line change
Expand Up @@ -13393,6 +13393,58 @@ public ReportTemplateRowBundle generatePaymentColumnForCollections(List<BillType
return b;
}

public ReportTemplateRowBundle generateTotalPaymentColumnByDepartment(List<BillTypeAtomic> bts, List<PaymentMethod> pms) {
ReportTemplateRowBundle b = new ReportTemplateRowBundle();

Map<String, Object> parameters = new HashMap<>();
String jpql = "SELECT new com.divudi.data.ReportTemplateRow("
+ "bill.department, sum(p.paidValue) ) "
+ "FROM Payment p "
+ "JOIN p.bill bill "
+ "WHERE p.retired <> :bfr "
+ "AND bill.retired <> :br "
+ "AND bill.billTypeAtomic in :bts "
+ "AND p.paymentMethod in :pms ";

parameters.put("bfr", true);
parameters.put("br", true);
parameters.put("bts", bts);
parameters.put("pms", pms);

if (institution != null) {
jpql += "AND bill.department.institution = :ins ";
parameters.put("ins", institution);
}
if (department != null) {
jpql += "AND bill.department = :dep ";
parameters.put("dep", department);
}
if (site != null) {
jpql += "AND bill.department.site = :site ";
parameters.put("site", site);
}
if (webUser != null) {
jpql += "AND bill.creater = :wu ";
parameters.put("wu", webUser);
}
if (paymentMethod != null) {
jpql += "AND p.paymentMethod = :pm ";
parameters.put("pm", paymentMethod);
}

jpql += "AND p.createdAt BETWEEN :fd AND :td ";
parameters.put("fd", fromDate);
parameters.put("td", toDate);

jpql += "GROUP BY bill.department";

List<ReportTemplateRow> rs = (List<ReportTemplateRow>) paymentFacade.findLightsByJpql(jpql, parameters, TemporalType.TIMESTAMP);

b.setReportTemplateRows(rs);
b.calculateTotalsByAddingRowTotals();
return b;
}

public void generateMyCashierSummary() {
institution = null;
department = null;
Expand Down Expand Up @@ -13493,7 +13545,7 @@ public void generateCashierSummary() {

// Generate Pharmacy Collection and add to the main bundle
List<BillTypeAtomic> pharmacyCollectionBillTypes = BillTypeAtomic.findByServiceTypeAndFinanceType(ServiceType.PHARMACY, BillFinanceType.CASH_IN);
ReportTemplateRowBundle pharmacyCollection = generatePaymentColumnForCollections(pharmacyCollectionBillTypes, nonCreditPaymentMethods);
ReportTemplateRowBundle pharmacyCollection = generateTotalPaymentColumnByDepartment(pharmacyCollectionBillTypes, nonCreditPaymentMethods);
pharmacyCollection.setBundleType("pharmacyCollection");
pharmacyCollection.setName("Pharmacy Collection");
bundle.getBundles().add(pharmacyCollection);
Expand All @@ -13503,7 +13555,7 @@ public void generateCashierSummary() {
List<BillTypeAtomic> pharmacyCancellations = new ArrayList<>();
pharmacyCancellations.add(BillTypeAtomic.PHARMACY_RETAIL_SALE_CANCELLED);
pharmacyCancellations.add(BillTypeAtomic.PHARMACY_WHOLESALE_CANCELLED);
ReportTemplateRowBundle pharmacyServiceCancellations = generatePaymentMethodColumnsByBills(pharmacyCancellations);
ReportTemplateRowBundle pharmacyServiceCancellations = generatePaymentMethodColumnsByBills(pharmacyCancellations, nonCreditPaymentMethods);
pharmacyServiceCancellations.setBundleType("pharmacyServiceCancellations");
pharmacyServiceCancellations.setName("Pharmacy Service Cancellations");
bundle.getBundles().add(pharmacyServiceCancellations);
Expand All @@ -13512,8 +13564,10 @@ public void generateCashierSummary() {
// Generate Pharmacy service refunds and add to the main bundle
List<BillTypeAtomic> pharmacyRefunds = new ArrayList<>();
pharmacyRefunds.add(BillTypeAtomic.PHARMACY_RETAIL_SALE_REFUND);
pharmacyRefunds.add(BillTypeAtomic.PHARMACY_WHOLESALE_GRN_BILL_REFUND);
ReportTemplateRowBundle pharmacyServiceRefunds = generatePaymentMethodColumnsByBills(pharmacyRefunds);
pharmacyRefunds.add(BillTypeAtomic.PHARMACY_RETAIL_SALE_RETURN_ITEMS_AND_PAYMENTS);
pharmacyRefunds.add(BillTypeAtomic.PHARMACY_WHOLESALE_REFUND);

ReportTemplateRowBundle pharmacyServiceRefunds = generatePaymentMethodColumnsByBills(pharmacyRefunds, nonCreditPaymentMethods);
pharmacyServiceRefunds.setBundleType("pharmacyServiceRefunds");
pharmacyServiceRefunds.setName("Pharmacy Service Refunds");
bundle.getBundles().add(pharmacyServiceRefunds);
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/divudi/data/ReportTemplateRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ public ReportTemplateRow(Institution institution, Double itemTotal) {
this.institution = institution;
}



public ReportTemplateRow(Institution institution, Long itemCount, Double itemHospitalFee, Double itemCollectingCentreFee, Double itemProfessionalFee, Double itemNetTotal) {
this.itemCount = itemCount;
this.itemHospitalFee = itemHospitalFee;
Expand Down Expand Up @@ -231,8 +233,8 @@ public ReportTemplateRow(SessionInstance sessionInstance) {
this.sessionInstance = sessionInstance;
}

public ReportTemplateRow(Department department, Double rowValue) {
this.rowValue = rowValue;
public ReportTemplateRow(Department department, Double total) {
this.total = total;
this.department = department;
}

Expand Down
17 changes: 15 additions & 2 deletions src/main/java/com/divudi/data/ReportTemplateRowBundle.java
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,19 @@ public void calculateTotals() {

}

public void calculateTotalsByAddingRowTotals() {
total =0.0;
if (this.reportTemplateRows != null && !this.reportTemplateRows.isEmpty()) {
// Aggregate values from each row and update transaction flags
for (ReportTemplateRow row : this.reportTemplateRows) {
if(row.getTotal()!=null){
total += row.getTotal();
}
}
}

}

public void calculateTotalsWithCredit() {
System.out.println("calculateTotals = ");
resetTotalsAndFlags();
Expand Down Expand Up @@ -1078,8 +1091,8 @@ public void calculateTotalByReferenceBills(final boolean isOutpatient) {
if (row.getBillItem() == null) {
continue;
}
Double amount = safeDouble(isOutpatient ? row.getBillItem().getReferenceBill().getNetTotal() :
row.getBillItem().getPatientEncounter().getFinalBill().getNetTotal());
Double amount = safeDouble(isOutpatient ? row.getBillItem().getReferenceBill().getNetTotal()
: row.getBillItem().getPatientEncounter().getFinalBill().getNetTotal());
total += amount;
}
}
Expand Down
36 changes: 21 additions & 15 deletions src/main/resources/META-INF/persistence.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.2" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd">
<persistence-unit name="hmisPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>${JDBC_DATASOURCE}</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.logging.level.sql" value="SEVERE"/>
</properties>
</persistence-unit>
<persistence-unit name="hmisAuditPU" transaction-type="JTA">
<jta-data-source>${JDBC_AUDIT_DATASOURCE}</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.logging.level.sql" value="SEVERE"/>
</properties>
</persistence-unit>
<persistence-unit name="hmisPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>${JDBC_DATASOURCE}</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.logging.level.sql" value="SEVERE"/>
<property name="eclipselink.logging.parameters" value="true"/>
<property name="eclipselink.ddl-generation" value="create-or-extend-tables"/>
<property name="eclipselink.ddl-generation.output-mode" value="both"/>
<property name="eclipselink.ddl-generation.validation" value="true"/>
</properties>
</persistence-unit>
<persistence-unit name="hmisAuditPU" transaction-type="JTA">
<jta-data-source>${JDBC_AUDIT_DATASOURCE}</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.logging.level.sql" value="SEVERE"/>
<property name="eclipselink.logging.parameters" value="false"/>
<property name="javax.persistence.schema-generation.database.action" value="create-or-extend-tables"/>
</properties>
</persistence-unit>
</persistence>
8 changes: 6 additions & 2 deletions src/main/webapp/pharmacy/pharmacy_bill_return_retail.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,12 @@


<p:column headerText="Returning Qty in Unit" style="width:25px!important;">
<p:inputText autocomplete="off" value="#{ph.qty}" >
<f:ajax event="blur" render="@this :#{p:resolveFirstComponentWithId('total',view).clientId}" execute="@this" listener="#{saleReturnController.onEdit(ph)}" ></f:ajax>
<p:inputText autocomplete="off" value="#{ph.qty}" onfocus="this.select();">
<f:ajax
event="blur"
render="@this :#{p:resolveFirstComponentWithId('total',view).clientId}"
execute="@this"
listener="#{saleReturnController.onEdit(ph)}" ></f:ajax>
</p:inputText>
</p:column>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
id="tblBills"
value="#{searchController.bills}"
var="bill"
rowKey="#{bill.id}"
paginator="true"
paginatorPosition="bottom"
rows="10"
Expand Down
23 changes: 8 additions & 15 deletions src/main/webapp/resources/ezcomp/bundles/pharmacyCollection.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,18 @@
emptyMessage="No #{cc.attrs.bundle.name}"
var="row" value="#{cc.attrs.bundle.reportTemplateRows}" styleClass="w-100" rowStyleClass="#{row.department ne null ? 'table-primary' : 'table-light'}">
<f:facet name="header">
<p:row>
<p:column colspan="2" styleClass="bg-dark text-light">
<h:outputText value="Pharmacy Collection" />
<h:outputText styleClass="text-end" value="#{cc.attrs.bundle.total}">
<f:convertNumber pattern="#,##0.00" />
</h:outputText>
</p:column>
</p:row>
<p:row>
<p:column headerText="Department" />
<p:column headerText="Collection" styleClass="text-end" />
</p:row>
<h:outputText value="Pharmacy Collection" />
<p:spacer width="10em" ></p:spacer>
<h:outputText styleClass="text-end" value="#{cc.attrs.bundle.total}">
<f:convertNumber pattern="#,##0.00" />
</h:outputText>
</f:facet>

<p:column>
<p:column headerText="Department">
<h:outputText value="#{row.department.name}" />
</p:column>
<p:column styleClass="text-end">
<h:outputText value="#{row.rowValue}">
<p:column headerText="Collection" styleClass="text-end">
<h:outputText value="#{row.total}">
<f:convertNumber pattern="#,##0.00" />
</h:outputText>
</p:column>
Expand Down
Loading

0 comments on commit ec71f8a

Please sign in to comment.