Skip to content

Commit

Permalink
#9960 pharmacy retail sale not available even after starting a new sh…
Browse files Browse the repository at this point in the history
…ift (#9961)

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

* Signed-off-by: Chinthaka Prasad <chinthakaprasad30@gmail.com>

* Signed-off-by: Chinthaka Prasad <chinthakaprasad30@gmail.com>

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

* Create build.yml

* Create deploy.yml

* Update build.yml

* Update deploy.yml

* Delete .github/workflows/deploy.yml

* Update and rename build.yml to manual_deployment.yml

* Delete .github/workflows/manual_deployment.yml

* Create dev_dispatch.yml

* Delete .github/workflows/dev_dispatch.yml

* Create custom_deployment.yml

* Update custom_deployment.yml

* Signed-off-by: Chinthaka Prasad <chinthakaprasad30@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>

* Issue #9942
Signed-off-by: Lawan Samarasekara <lawan.chaamindu1234@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>

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

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

* added opd and cc bills

* added batch cancel and refund

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

* Signed-off-by: Chinthaka Prasad <chinthakaprasad30@gmail.com>

* Signed-off-by: Chinthaka Prasad <chinthakaprasad30@gmail.com>

* Update PharmacyCalculation.java

testing commit

* changed column width

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

* fixed null pointer exception bug

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

* fixed filter bug

* Create rh_prod_ci_cd.yml

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

* Closes #9960 Pharmacy_Retail_Sale_NOT_available_even_after_starting_a_new_Shift

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

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

---------

Signed-off-by: Buddhika <buddhika.ari@gmail.com>
Signed-off-by: IsuruUdaraRanaweera <isuru.udara.ranaweera@gmail.com>
Signed-off-by: Dr M H B Ariyaratne <buddhika.ari@gmail.com>
Signed-off-by: Lawan Samarasekara <lawan.chaamindu1234@gmail.com>
Signed-off-by: Isuru Ranaweera <isuru.udara.ranaweera@gmail.com>
Signed-off-by: Buddhika Ariyaratne <buddhika.ari@gmail.com>
Co-authored-by: IsuruUdaraRanaweera <isuru.udara.ranaweera@gmail.com>
Co-authored-by: Chinthaka Prasad <chinthakaprasad30@gmail.com>
Co-authored-by: Pubudu-Piyankara <pubudupiyankara.me@gmail.com>
Co-authored-by: Geeth Sandaru Madhushan <geeth.gsm@gmail.com>
Co-authored-by: Lawan Samarasekara <lawan.chaamindu1234@gmail.com>
Co-authored-by: imexh <chandikaranawella@gmail.com>
Co-authored-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad@users.noreply.github.com>
  • Loading branch information
8 people authored Jan 6, 2025
1 parent 629ba10 commit 2823561
Show file tree
Hide file tree
Showing 10 changed files with 191 additions and 112 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/custom_deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- warning
- debug
tags:
description: 'Tags for the workflow'
description: 'Tags of the workflow'
required: true
type: string

Expand Down
88 changes: 70 additions & 18 deletions src/main/java/com/divudi/bean/common/ReportsController.java
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,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 @@ -404,7 +403,6 @@ public void setSelectedDateType(String selectedDateType) {
this.selectedDateType = selectedDateType;
}


public Investigation getInvestigation() {
return investigation;
}
Expand Down Expand Up @@ -2644,7 +2642,7 @@ public void generateDebtorBalanceReport(final boolean onlyDueBills) {
}

public ReportTemplateRowBundle generateDebtorBalanceReportBills(List<BillTypeAtomic> bts, List<PaymentMethod> billPaymentMethods,
boolean onlyDueBills) {
boolean onlyDueBills) {
Map<String, Object> parameters = new HashMap<>();
String jpql = "SELECT new com.divudi.data.ReportTemplateRow(bill) "
+ "FROM Bill bill "
Expand Down Expand Up @@ -3167,7 +3165,6 @@ private ReportTemplateRowBundle generateExternalLaboratoryWorkloadBillItems(List
// + "LEFT JOIN PatientInvestigation pi ON pi.billItem = billItem "
// + "WHERE bill.billTypeAtomic IN :bts "
// + "AND bill.createdAt BETWEEN :fd AND :td ";

String jpql = "SELECT new com.divudi.data.ReportTemplateRow(billItem) "
+ "FROM PatientInvestigation pi "
+ "JOIN pi.billItem billItem "
Expand Down Expand Up @@ -3374,14 +3371,14 @@ public void generateOpdAndInwardDueReport() {
// opdBts.add(BillTypeAtomic.INWARD_FINAL_BILL);
opdBts.add(BillTypeAtomic.INWARD_FINAL_BILL_PAYMENT_BY_CREDIT_COMPANY);
} else if (visitType.equalsIgnoreCase("OP")) {
opdBts.add(BillTypeAtomic.OPD_BILL_WITH_PAYMENT);
opdBts.add(BillTypeAtomic.OPD_BILL_PAYMENT_COLLECTION_AT_CASHIER);
// opdBts.add(BillTypeAtomic.OPD_BILL_WITH_PAYMENT);
// opdBts.add(BillTypeAtomic.OPD_BILL_PAYMENT_COLLECTION_AT_CASHIER);
opdBts.add(BillTypeAtomic.OPD_BATCH_BILL_WITH_PAYMENT);
opdBts.add(BillTypeAtomic.OPD_BATCH_BILL_PAYMENT_COLLECTION_AT_CASHIER);
opdBts.add(BillTypeAtomic.PACKAGE_OPD_BATCH_BILL_WITH_PAYMENT);
opdBts.add(BillTypeAtomic.PACKAGE_OPD_BILL_PAYMENT_COLLECTION_AT_CASHIER);
opdBts.add(BillTypeAtomic.OPD_BATCH_BILL_CANCELLATION);
opdBts.add(BillTypeAtomic.OPD_BILL_CANCELLATION);
// opdBts.add(BillTypeAtomic.OPD_BILL_CANCELLATION);
opdBts.add(BillTypeAtomic.PACKAGE_OPD_BATCH_BILL_CANCELLATION);
opdBts.add(BillTypeAtomic.PACKAGE_OPD_BILL_CANCELLATION);
}
Expand Down Expand Up @@ -3581,7 +3578,7 @@ public Double calculateDueAmountSubTotalByBills(List<Bill> bills) {
Double balance = 0.0;

for (Bill bill : bills) {
balance += bill.getBalance();
balance += bill.getNetTotal() - bill.getSettledAmountBySponsor() - bill.getSettledAmountByPatient();
}

return balance;
Expand Down Expand Up @@ -3673,7 +3670,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 @@ -4030,9 +4026,7 @@ public void exportCollectionCenterBillWiseDetailReportToExcel() {
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment; filename=Collection_Center_Report.xlsx");

try (XSSFWorkbook workbook = new XSSFWorkbook();
OutputStream out = response.getOutputStream()) {

try (XSSFWorkbook workbook = new XSSFWorkbook(); OutputStream out = response.getOutputStream()) {

XSSFSheet sheet = workbook.createSheet("Report");
int rowIndex = 0;
Expand Down Expand Up @@ -4304,8 +4298,8 @@ public void exportDetailedWeeklyOPDReportToPDF() {
}

private void addWeeklyReportSection(Document document, String sectionTitle, List<String> itemList,
List<Integer> daysOfWeek, Map<Integer, Map<String, Map<Integer, Double>>> weeklyDailyBillItemMap,
int week, com.itextpdf.text.Font headerFont, com.itextpdf.text.Font regularFont) throws DocumentException {
List<Integer> daysOfWeek, Map<Integer, Map<String, Map<Integer, Double>>> weeklyDailyBillItemMap,
int week, com.itextpdf.text.Font headerFont, com.itextpdf.text.Font regularFont) throws DocumentException {
document.add(new com.itextpdf.text.Paragraph(sectionTitle, headerFont));
document.add(com.itextpdf.text.Chunk.NEWLINE);

Expand Down Expand Up @@ -4408,8 +4402,7 @@ public void exportDetailedWeeklyOPDReportToExcel() {
}
}

private void populateDataRows(Sheet sheet, int rowIndex, List<String> itemList, List<Integer> daysOfWeek, Map
<Integer, Map<String, Map<Integer, Double>>> weeklyDailyBillItemMap, int week) {
private void populateDataRows(Sheet sheet, int rowIndex, List<String> itemList, List<Integer> daysOfWeek, Map<Integer, Map<String, Map<Integer, Double>>> weeklyDailyBillItemMap, int week) {
for (String item : itemList) {
Row dataRow = sheet.createRow(rowIndex++);
int colIndex = 0;
Expand All @@ -4433,8 +4426,7 @@ public void exportRouteAnalysisDetailReportToExcel() {
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment; filename=Collecting_Center_Monthly_Report.xlsx");

try (XSSFWorkbook workbook = new XSSFWorkbook();
OutputStream out = response.getOutputStream()) {
try (XSSFWorkbook workbook = new XSSFWorkbook(); OutputStream out = response.getOutputStream()) {

XSSFSheet sheet = workbook.createSheet("Monthly Report");
int rowIndex = 0;
Expand Down Expand Up @@ -4660,4 +4652,64 @@ public void exportRouteAnalysisSummaryReportToExcel() {
e.printStackTrace();
}
}

public Double calculateIpGrossAmountSubTotalByBills(List<Bill> bills) {
Double billTotal = 0.0;

for (Bill bill : bills) {
billTotal += bill.getPatientEncounter().getFinalBill().getGrantTotal();
}

return billTotal;
}

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

for (Bill bill : bills) {
discount += bill.getPatientEncounter().getFinalBill().getDiscount();
}

return discount;
}

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

for (Bill bill : bills) {
netTotal += bill.getPatientEncounter().getFinalBill().getNetTotal();
}

return netTotal;
}

public Double calculateIpPatientShareSubTotalByBills(List<Bill> bills) {
Double settledAmountByPatient = 0.0;

for (Bill bill : bills) {
settledAmountByPatient += bill.getPatientEncounter().getFinalBill().getSettledAmountByPatient();
}

return settledAmountByPatient;
}

public Double calculateIpSponsorShareSubTotalByBills(List<Bill> bills) {
Double settledAmountBySponsor = 0.0;

for (Bill bill : bills) {
settledAmountBySponsor += bill.getPatientEncounter().getFinalBill().getSettledAmountBySponsor();
}

return settledAmountBySponsor;
}

public Double calculateIpDueAmountSubTotalByBills(List<Bill> bills) {
Double balance = 0.0;

for (Bill bill : bills) {
balance += bill.getPatientEncounter().getFinalBill().getNetTotal() - bill.getPatientEncounter().getFinalBill().getSettledAmountBySponsor() - bill.getPatientEncounter().getFinalBill().getSettledAmountByPatient();
}

return balance;
}
}
8 changes: 8 additions & 0 deletions src/main/java/com/divudi/entity/BillItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -500,34 +500,42 @@ public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}

@Override
public boolean isRetired() {
return retired;
}

@Override
public void setRetired(boolean retired) {
this.retired = retired;
}

@Override
public WebUser getRetirer() {
return retirer;
}

@Override
public void setRetirer(WebUser retirer) {
this.retirer = retirer;
}

@Override
public Date getRetiredAt() {
return retiredAt;
}

@Override
public void setRetiredAt(Date retiredAt) {
this.retiredAt = retiredAt;
}

@Override
public String getRetireComments() {
return retireComments;
}

@Override
public void setRetireComments(String retireComments) {
this.retireComments = retireComments;
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/divudi/entity/Patient.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
package com.divudi.entity;

import com.divudi.bean.common.RetirableEntity;
import com.divudi.java.CommonFunctions;
import java.io.Serializable;
import java.util.Date;
Expand Down Expand Up @@ -31,7 +32,7 @@
* @author buddhika
*/
@Entity
public class Patient implements Serializable {
public class Patient implements Serializable, RetirableEntity {

static final long serialVersionUID = 1L;
@Id
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/com/divudi/entity/Person.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
package com.divudi.entity;

import com.divudi.bean.common.RetirableEntity;
import com.divudi.data.Sex;
import com.divudi.data.Title;
import com.divudi.entity.membership.MembershipScheme;
Expand Down Expand Up @@ -36,7 +37,7 @@
* Consultant (Health Informatics)
*/
@Entity
public class Person implements Serializable {
public class Person implements Serializable, RetirableEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand Down Expand Up @@ -328,10 +329,12 @@ public void setSex(Sex sex) {
this.sex = sex;
}

@Override
public String getRetireComments() {
return retireComments;
}

@Override
public void setRetireComments(String retireComments) {
this.retireComments = retireComments;
}
Expand Down Expand Up @@ -415,26 +418,32 @@ public void setZoneCode(String zoneCode) {
this.zoneCode = zoneCode;
}

@Override
public boolean isRetired() {
return retired;
}

@Override
public void setRetired(boolean retired) {
this.retired = retired;
}

@Override
public Date getRetiredAt() {
return retiredAt;
}

@Override
public void setRetiredAt(Date retiredAt) {
this.retiredAt = retiredAt;
}

@Override
public WebUser getRetirer() {
return retirer;
}

@Override
public void setRetirer(WebUser retirer) {
this.retirer = retirer;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
*/
package com.divudi.entity.pharmacy;

import com.divudi.bean.common.RetirableEntity;
import com.divudi.bean.common.TimeUtils;
import com.divudi.entity.BillItem;
import com.divudi.entity.Category;
import com.divudi.entity.Institution;
import com.divudi.entity.WebUser;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
Expand All @@ -28,7 +26,7 @@
* @author Buddhika
*/
@Entity
public class PharmaceuticalBillItem implements Serializable, RetirableEntity {
public class PharmaceuticalBillItem implements Serializable {

@OneToOne(mappedBy = "pbItem")
private StockHistory stockHistory;
Expand Down Expand Up @@ -110,19 +108,6 @@ public class PharmaceuticalBillItem implements Serializable, RetirableEntity {
private boolean transThisIsStockOut;
@Transient
private boolean transThisIsStockIn;

private boolean retired;

@ManyToOne
private WebUser retirer;

@ManyToOne
private WebUser currentHolder;

@Temporal(javax.persistence.TemporalType.TIMESTAMP)
private Date retiredAt;

private String retireComments;

public String getSerialNo() {
return serialNo;
Expand Down Expand Up @@ -699,46 +684,6 @@ public double getRetailPackValue() {
public void setRetailPackValue(double retailPackValue) {
this.retailPackValue = retailPackValue;
}

public boolean isRetired() {
return retired;
}

public void setRetired(boolean retired) {
this.retired = retired;
}

public WebUser getRetirer() {
return retirer;
}

public void setRetirer(WebUser retirer) {
this.retirer = retirer;
}

public WebUser getCurrentHolder() {
return currentHolder;
}

public void setCurrentHolder(WebUser currentHolder) {
this.currentHolder = currentHolder;
}

public Date getRetiredAt() {
return retiredAt;
}

public void setRetiredAt(Date retiredAt) {
this.retiredAt = retiredAt;
}

public String getRetireComments() {
return retireComments;
}

public void setRetireComments(String retireComments) {
this.retireComments = retireComments;
}



Expand Down
Loading

0 comments on commit 2823561

Please sign in to comment.