Skip to content

Commit

Permalink
Merge pull request #6408 from hmislk/Issue#6407
Browse files Browse the repository at this point in the history
Closes #6407 Closes #6407
  • Loading branch information
Irani96 authored Jul 19, 2024
2 parents b428b1f + 755b557 commit c94c1c1
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 21 deletions.
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.divudi</groupId>

<artifactId>ruhunu</artifactId>
<artifactId>digasiri</artifactId>
<version>3.0.0</version>
<packaging>war</packaging>
<name>ruhunu</name>
<name>digasiri</name>


<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,109 @@ public void calculateDueFeesOld() {
}

}


public void debugDueFees() {
Date startTime = new Date();

if (getSpeciality() == null) {
JsfUtil.addErrorMessage("Select Specility");
return;
}

if (getCurrentStaff() == null) {
JsfUtil.addErrorMessage("Select Doctor");
return;
}
if (considerDate) {
if (getToDate().getTime() > commonFunctions.getEndOfDay().getTime()) {
JsfUtil.addErrorMessage("You Can't search after current Date");
return;
}
}

BillType[] billTypes = {BillType.ChannelAgent, BillType.ChannelCash, BillType.ChannelPaid, BillType.ChannelStaff};
List<BillType> bts = Arrays.asList(billTypes);
String sql = " SELECT b FROM BillFee b "
+ " where type(b.bill)=:class "
+ " and b.bill.retired=false "
+ " and b.bill.paidAmount!=0 "
+ " and b.fee.feeType=:ftp"
+ " and b.bill.refunded=false "
+ " and b.bill.cancelled=false "
+ " and b.bill.singleBillSession.absent=false"
+ " and (b.feeValue - b.paidValue) > 0 "
+ " and b.bill.billType in :bt "
+ " and b.staff=:stf ";

HashMap hm = new HashMap();
if (getFromDate() != null && getToDate() != null && considerDate) {
sql += " and b.bill.appointmentAt between :frm and :to";
hm.put("frm", getFromDate());
hm.put("to", getToDate());
} else {
sql += " and b.bill.appointmentAt <= :nd";
hm.put("nd", commonFunctions.getEndOfDay());
}

if (getSelectedServiceSession() != null) {
sql += " and b.bill.singleBillSession.sessionInstance.originatingSession=:ss";
hm.put("ss", getSelectedServiceSession());
}

sql += " and b.bill.singleBillSession.absent=false "
+ " order by b.bill.singleBillSession.serviceSession.sessionDate,"
+ " b.bill.singleBillSession.serviceSession.sessionTime,"
+ " b.bill.singleBillSession.serialNo ";

hm.put("stf", getCurrentStaff());
//hm.put("ins", sessionController.getInstitution());
hm.put("bt", bts);
hm.put("ftp", FeeType.Staff);
hm.put("class", BilledBill.class);
dueBillFees = billFeeFacade.findByJpql(sql, hm, TemporalType.TIMESTAMP);
//// // System.out.println("dueBillFees.size() = " + dueBillFees.size());
//// // System.out.println("hm = " + hm);
//// // System.out.println("sql = " + sql);

HashMap m = new HashMap();
sql = " SELECT b FROM BillFee b "
+ " where type(b.bill)=:class "
+ " and b.bill.retired=false "
+ " and b.bill.paidAmount!=0 "
+ " and b.fee.feeType=:ftp"
+ " and b.bill.refunded=false "
+ " and b.bill.cancelled=false "
+ " and (b.feeValue - b.paidValue) > 0 "
+ " and b.bill.billType in :bt "
+ " and b.staff=:stf ";

if (getFromDate() != null && getToDate() != null && considerDate) {
sql += " and b.bill.appointmentAt between :frm and :to";
m.put("frm", getFromDate());
m.put("to", getToDate());
}

if (getSelectedServiceSession() != null) {
sql += " and b.bill.singleBillSession.serviceSession.originatingSession=:ss";
m.put("ss", getSelectedServiceSession());
}

sql += " and b.bill.singleBillSession.absent=true "
+ " and b.bill.singleBillSession.serviceSession.originatingSession.refundable=false "
+ " order by b.bill.singleBillSession.serviceSession.sessionDate,"
+ " b.bill.singleBillSession.serviceSession.sessionTime,"
+ " b.bill.singleBillSession.serialNo ";
m.put("stf", getCurrentStaff());
//hm.put("ins", sessionController.getInstitution());
m.put("bt", bts);
m.put("ftp", FeeType.Staff);
m.put("class", BilledBill.class);
List<BillFee> nonRefundableBillFees = new ArrayList<>();
nonRefundableBillFees = billFeeFacade.findByJpql(sql, m, TemporalType.TIMESTAMP);
dueBillFees.addAll(nonRefundableBillFees);

}

public void calculateDueFees() {
Date startTime = new Date();
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/divudi/ws/lims/Lims.java
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,7 @@ private JSONArray constructUnitBarcodesJson(BillItem bi, Long startBarcode, Long
while (barcode <= endBarcode) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("itemName", bi.getItem().getName() != null ? bi.getItem().getName() : "");
jsonObject.put("itemCode", bi.getItem().getCode()!= null ? bi.getItem().getCode() : "");
jsonObject.put("rate", formattedRate);
jsonObject.put("barcode", barcode);
jsonArray.put(jsonObject);
Expand Down Expand Up @@ -693,6 +694,7 @@ private JSONArray constructUnitBarcodesJson(Stock stock) {
while (barcode <= endBarcode) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("itemName", stock.getItemBatch().getItem().getName() != null ? stock.getItemBatch().getItem().getName() : "");
jsonObject.put("itemCode", stock.getItemBatch().getItem().getCode() != null ? stock.getItemBatch().getItem().getCode() : "");
jsonObject.put("rate", formattedRate);
jsonObject.put("barcode", barcode);
jsonArray.put(jsonObject);
Expand All @@ -711,6 +713,7 @@ private JSONObject constructBatchBarcodeJson(Stock stock) {
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("itemName", stock.getItemBatch().getItem().getName() != null ? stock.getItemBatch().getItem().getName() : "");
jsonObject.put("itemCode", stock.getItemBatch().getItem().getCode() != null ? stock.getItemBatch().getItem().getCode() : "");
jsonObject.put("barcode", stock.getStartBarcode());
return jsonObject;
}
Expand All @@ -721,6 +724,7 @@ private JSONObject constructItemBarcodeJson(Item item) {
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("itemName", item.getName() != null ? item.getName() : "");
jsonObject.put("itemCode", item.getCode() != null ? item.getCode() : "");
jsonObject.put("barcode", item.getBarcode());
return jsonObject;
}
Expand Down
43 changes: 24 additions & 19 deletions src/main/webapp/optician/stock_by_batch.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<h:body>

<ui:composition template="/pharmacy/pharmacy_analytics.xhtml">
<ui:composition template="/optician/stock_management.xhtml">

<ui:define name="subcontent">
<h:form id="frm">
Expand Down Expand Up @@ -79,16 +79,21 @@
value="#{reportsStock.stocks}" var="i"
rows="#{reportsStock.rows}"
paginator="#{reportsStock.paginator}"
paginatorPosition="bottom"
paginatorPosition="both"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="20, 50, 100"
>
<f:facet name="header">
<h:outputLabel value="Batch Stock Report - #{reportsStock.department.name}"/>
</f:facet>



<p:column headerText="ID"
style="text-align: left;"
sortBy="#{i.id}"
filterBy="#{i.id}"
filterMatchMode="contains">
<f:facet name="header">
<h:outputLabel value="ID"/>
</f:facet>
<h:outputLabel value="#{i.id}" >
</h:outputLabel>
</p:column>
<p:column headerText="Category"
style="text-align: left;"
sortBy="#{i.itemBatch.item.category.name}"
Expand Down Expand Up @@ -126,17 +131,17 @@
</p:column>


<!-- <p:column headerText="Code"
styleClass="averageNumericColumn"
sortBy="#{i.itemBatch.item.code}"
filterBy="#{i.itemBatch.item.code}"
filterMatchMode="contains"
style="text-align: right;">
<f:facet name="header">
<h:outputLabel value="Code"/>
</f:facet>
<h:outputLabel value="#{i.itemBatch.item.code}" style="width: 100px!important;" ></h:outputLabel>
</p:column>-->
<!-- <p:column headerText="Code"
styleClass="averageNumericColumn"
sortBy="#{i.itemBatch.item.code}"
filterBy="#{i.itemBatch.item.code}"
filterMatchMode="contains"
style="text-align: right;">
<f:facet name="header">
<h:outputLabel value="Code"/>
</f:facet>
<h:outputLabel value="#{i.itemBatch.item.code}" style="width: 100px!important;" ></h:outputLabel>
</p:column>-->

<p:column headerText="Quantity"
style="text-align: right;"
Expand Down

0 comments on commit c94c1c1

Please sign in to comment.