Skip to content

Commit

Permalink
Merge pull request #9659 from hmislk/issue#9658_StockLedger_ClosingSt…
Browse files Browse the repository at this point in the history
…ock_Improvements

Issue#9658 stock ledger closing stock improvements  Closes #9658
  • Loading branch information
Irani96 authored Dec 17, 2024
2 parents 3de8a03 + 0706e00 commit 54d6697
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1944,8 +1944,10 @@ public void processStockLedgerReport() {
}
jpql += ")";
}
if (item != null) {
jpql += " and s.item=:itm ";
if (amp != null) {
item = amp;
System.out.println("item = " + item);
jpql += "and s.item=:itm ";
m.put("itm", item);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/persistence.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<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/hmis</jta-data-source>
<jta-data-source>jdbc/ruhunu</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.logging.level" value="WARNING"/>
Expand Down
82 changes: 69 additions & 13 deletions src/main/webapp/reports/inventoryReports/closing_stock_report.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@


<p:spacer width="20"></p:spacer>

<h:panelGroup layout="block" styleClass="form-group">
<h:outputText styleClass="fa fa-boxes mr-2" />
<p:outputLabel value="Report type" for="phmRepType" class="m-3">
Expand Down Expand Up @@ -105,14 +106,69 @@
<p:outputLabel value="Department" for="phmDept" class="m-3">
</p:outputLabel>
</h:panelGroup>
<p:selectOneMenu
id="phmDept"
class="w-100"
value="#{pharmacyReportController.department}"
filter="true">
<f:selectItem itemLabel="All Departments" />
<f:selectItems value="#{departmentController.getDepartmentsOfInstitutionAndSite(pharmacyReportController.institution, pharmacyReportController.site)}" var="dept" itemLabel="#{dept.name}" itemValue="#{dept}" />
</p:selectOneMenu>
<h:panelGroup id="phmDept">

<!-- Component 1: Without Institution and Site -->
<p:selectOneMenu
rendered="#{pharmacyReportController.institution eq null and pharmacyReportController.site eq null}"
styleClass="w-100 form-control"
value="#{pharmacyReportController.department}"
filterMatchMode="contains"
filter="true">
<f:selectItem itemLabel="All Departments" />
<f:selectItems
value="#{departmentController.getDepartmentsOfInstitutionAndSite()}"
var="dept"
itemLabel="#{dept.name}"
itemValue="#{dept}" />
</p:selectOneMenu>

<!-- Component 2: With Site Only -->
<p:selectOneMenu
rendered="#{pharmacyReportController.institution eq null and pharmacyReportController.site ne null}"
styleClass="w-100 form-control"
value="#{pharmacyReportController.department}"
filterMatchMode="contains"
filter="true">
<f:selectItem itemLabel="All Departments" />
<f:selectItems
value="#{departmentController.getDepartmentsOfInstitutionAndSite(pharmacyReportController.site)}"
var="dept"
itemLabel="#{dept.name}"
itemValue="#{dept}" />
</p:selectOneMenu>

<!-- Component 3: With Institution Only -->
<p:selectOneMenu
rendered="#{pharmacyReportController.institution ne null and pharmacyReportController.site eq null}"
styleClass="w-100 form-control"
value="#{pharmacyReportController.department}"
filterMatchMode="contains"
filter="true">
<f:selectItem itemLabel="All Departments" />
<f:selectItems
value="#{departmentController.getDepartmentsOfInstitutionAndSite(pharmacyReportController.institution)}"
var="dept"
itemLabel="#{dept.name}"
itemValue="#{dept}" />
</p:selectOneMenu>

<!-- Component 4: With Both Institution and Site -->
<p:selectOneMenu
rendered="#{pharmacyReportController.institution ne null and pharmacyReportController.site ne null}"
styleClass="w-100 form-control"
value="#{pharmacyReportController.department}"
filterMatchMode="contains"
filter="true">
<f:selectItem itemLabel="All Departments" />
<f:selectItems
value="#{departmentController.getDepartmentsOfInstitutionAndSite(pharmacyReportController.institution, pharmacyReportController.site)}"
var="dept"
itemLabel="#{dept.name}"
itemValue="#{dept}" />
</p:selectOneMenu>

</h:panelGroup>



Expand Down Expand Up @@ -238,17 +294,17 @@
<p:column headerText="Qty">
<!--Item Batch Stock for Selected Department-->
<h:outputText value="#{f.stockHistory.stockQty}"><f:convertNumber pattern="#,##0" /></h:outputText>

<!--Item Stock for Selected Department-->
<h:outputText value="#{f.stockHistory.itemStock}"><f:convertNumber pattern="#,##0" /></h:outputText>

<!--Item Stock for Selected Institution-->
<h:outputText value="#{f.stockHistory.institutionItemStock}"><f:convertNumber pattern="#,##0" /></h:outputText>

<!--Item Stock for All Institutions-->
<h:outputText value="#{f.stockHistory.totalItemStock}"><f:convertNumber pattern="#,##0" /></h:outputText>


<f:facet name="footer">
<h:outputText value="#{pharmacyReportController.stockTotal}">
<f:convertNumber pattern="#,##0" />
Expand Down
152 changes: 103 additions & 49 deletions src/main/webapp/reports/inventoryReports/stock_ledger.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,26 @@
/>

<p:spacer width="20"></p:spacer>
<p:spacer width="20"></p:spacer>
<p:spacer width="20"></p:spacer>


<h:panelGroup layout="block" styleClass="form-group">
<h:outputText styleClass="fa fa-file-alt mr-2" />
<p:outputLabel value="Document Type" for="phmDocType" class="m-3" >
</p:outputLabel>
</h:panelGroup>
<p:selectOneMenu
id="phmDocType"
value="#{pharmacyReportController.documentType}"
class="w-100">
<f:selectItem itemLabel="All Document Types"/>
<f:selectItem itemLabel="OP Sale" itemValue="opSaleDoc"/>
<f:selectItem itemLabel="IP Sale" itemValue="ipSaleDoc"/>
<f:selectItem itemLabel="Transfer Issue" itemValue="transferIssueDoc"/>
<f:selectItem itemLabel="Transfer Receive" itemValue="transferReceiveDoc"/>
<f:selectItem itemLabel="Consumption" itemValue="consumptionDoc"/>
<f:selectItem itemLabel="Purchase" itemValue="purchaseDoc"/>
<f:selectItem itemLabel="GRN" itemValue="grnDoc"/>
</p:selectOneMenu>

<h:panelGroup layout="block" styleClass="form-group">
<h:outputText styleClass="fa fa-university mr-2" />
Expand Down Expand Up @@ -84,65 +102,95 @@
</p:selectOneMenu>



<p:spacer width="20"></p:spacer>


<h:panelGroup layout="block" styleClass="form-group">
<h:outputText styleClass="fa fa-building mr-2" />
<p:outputLabel value="Department" for="phmDept" class="m-3">
</p:outputLabel>
</h:panelGroup>
<p:selectOneMenu
id="phmDept"
class="w-100"
value="#{pharmacyReportController.department}"
filter="true">
<f:selectItem itemLabel="All Departments" />
<f:selectItems value="#{departmentController.getDepartmentsOfInstitutionAndSite(pharmacyReportController.institution, pharmacyReportController.site)}" var="dept" itemLabel="#{dept.name}" itemValue="#{dept}" />
</p:selectOneMenu>


<p:spacer width="20"></p:spacer>



<h:panelGroup layout="block" styleClass="form-group">
<h:outputText styleClass="fa fa-file-alt mr-2" />
<p:outputLabel value="Document Type" for="phmDocType" class="m-3" >
</p:outputLabel>
<h:panelGroup id="phmDept">

<!-- Component 1: Without Institution and Site -->
<p:selectOneMenu
rendered="#{pharmacyReportController.institution eq null and pharmacyReportController.site eq null}"
styleClass="w-100 form-control"
value="#{pharmacyReportController.department}"
filterMatchMode="contains"
filter="true">
<f:selectItem itemLabel="All Departments" />
<f:selectItems
value="#{departmentController.getDepartmentsOfInstitutionAndSite()}"
var="dept"
itemLabel="#{dept.name}"
itemValue="#{dept}" />
</p:selectOneMenu>

<!-- Component 2: With Site Only -->
<p:selectOneMenu
rendered="#{pharmacyReportController.institution eq null and pharmacyReportController.site ne null}"
styleClass="w-100 form-control"
value="#{pharmacyReportController.department}"
filterMatchMode="contains"
filter="true">
<f:selectItem itemLabel="All Departments" />
<f:selectItems
value="#{departmentController.getDepartmentsOfInstitutionAndSite(pharmacyReportController.site)}"
var="dept"
itemLabel="#{dept.name}"
itemValue="#{dept}" />
</p:selectOneMenu>

<!-- Component 3: With Institution Only -->
<p:selectOneMenu
rendered="#{pharmacyReportController.institution ne null and pharmacyReportController.site eq null}"
styleClass="w-100 form-control"
value="#{pharmacyReportController.department}"
filterMatchMode="contains"
filter="true">
<f:selectItem itemLabel="All Departments" />
<f:selectItems
value="#{departmentController.getDepartmentsOfInstitutionAndSite(pharmacyReportController.institution)}"
var="dept"
itemLabel="#{dept.name}"
itemValue="#{dept}" />
</p:selectOneMenu>

<!-- Component 4: With Both Institution and Site -->
<p:selectOneMenu
rendered="#{pharmacyReportController.institution ne null and pharmacyReportController.site ne null}"
styleClass="w-100 form-control"
value="#{pharmacyReportController.department}"
filterMatchMode="contains"
filter="true">
<f:selectItem itemLabel="All Departments" />
<f:selectItems
value="#{departmentController.getDepartmentsOfInstitutionAndSite(pharmacyReportController.institution, pharmacyReportController.site)}"
var="dept"
itemLabel="#{dept.name}"
itemValue="#{dept}" />
</p:selectOneMenu>
</h:panelGroup>
<p:selectOneMenu
id="phmDocType"
value="#{pharmacyReportController.documentType}"
class="w-100">
<f:selectItem itemLabel="All Document Types"/>
<f:selectItem itemLabel="OP Sale" itemValue="opSaleDoc"/>
<f:selectItem itemLabel="IP Sale" itemValue="ipSaleDoc"/>
<f:selectItem itemLabel="Transfer Issue" itemValue="transferIssueDoc"/>
<f:selectItem itemLabel="Transfer Receive" itemValue="transferReceiveDoc"/>
<f:selectItem itemLabel="Consumption" itemValue="consumptionDoc"/>
<f:selectItem itemLabel="Purchase" itemValue="purchaseDoc"/>
<f:selectItem itemLabel="GRN" itemValue="grnDoc"/>
</p:selectOneMenu>


<p:spacer width="20"></p:spacer>



<h:panelGroup layout="block" styleClass="form-group">
<h:outputText styleClass="fa fa-box mr-2" />
<p:outputLabel value="Item" for="phmItem" class="m-3" >
<p:outputLabel value="Item Name" for="phmItem" class="m-3">
</p:outputLabel>
</h:panelGroup>
<p:selectOneMenu
<p:autoComplete
id="phmItem"
value="#{pharmacyReportController.amp}"
completeMethod="#{ampController.completeAmp}"
var="item"
class="w-100"
value="#{pharmacyReportController.item}"
filter="true">
<f:selectItem itemLabel="All Items" ></f:selectItem>
<f:selectItems value="#{ampController.items}" var="item" itemLabel="#{item.name}" itemValue="#{item}" />
</p:selectOneMenu>

minQueryLength="3"
maxResults="20"
inputStyleClass="w-100"
itemLabel="#{item.name}"
itemValue="#{item}"
></p:autoComplete>



Expand All @@ -152,8 +200,14 @@
</h:panelGrid>

<div class="d-flex align-items-center mt-5">
<p:commandButton class="ui-button-warning mx-1" icon="fas fa-cogs" ajax="false" value="Process" action="#{pharmacyReportController.processStockLedgerReport()}" >
<p:commandButton
class="ui-button-warning mx-1"
icon="fas fa-cogs"
ajax="false"
value="Process"
action="#{pharmacyReportController.processStockLedgerReport()}" >
</p:commandButton>

<p:commandButton class="ui-button- mx-1" icon="fas fa-print" ajax="false" value="Print All"><p:printer target="tbl" />
</p:commandButton>
<p:commandButton class="ui-button-success mx-1" icon="fas fa-file-excel" ajax="false" value="Download"><p:dataExporter type="xlsx" fileName="Stock Ledger Report" target="tbl" />
Expand All @@ -172,7 +226,7 @@
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
currentPageReportTemplate="Showing {startRecord} to {endRecord} of {totalRecords}"
rowsPerPageTemplate="5,10,15,25,50,100,500,1000">


<p:column headerText="S.No." width="5em">
<h:outputText value="#{n+1}" />
Expand Down Expand Up @@ -258,7 +312,7 @@
<h:outputText value="#{f.pbItem.billItem.bill.creater.name}" />
</p:column>


</p:dataTable>

</p:panel>
Expand Down

0 comments on commit 54d6697

Please sign in to comment.