Skip to content

Commit

Permalink
Merge pull request #6772 from hmislk/Issue#6771
Browse files Browse the repository at this point in the history
Issue#6771 Closes #6771
  • Loading branch information
DeshaniPubudu authored Aug 7, 2024
2 parents 00b24c9 + 9db068b commit 4cf24a2
Show file tree
Hide file tree
Showing 8 changed files with 331 additions and 253 deletions.
5 changes: 5 additions & 0 deletions src/main/java/com/divudi/bean/common/SearchController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2426,6 +2426,11 @@ public void listPharmacyBills(BillType bt, Class bc) {
sql += " and ((b.department.name) like :dep )";
m.put("dep", "%" + getSearchKeyword().getDepartment().trim().toUpperCase() + "%");
}

if (getSearchKeyword().getToDepartment() != null && !getSearchKeyword().getToDepartment().trim().equals("")) {
sql += " and ((b.toDepartment.name) like :dep )";
m.put("dep", "%" + getSearchKeyword().getToDepartment().trim().toUpperCase() + "%");
}

if (getSearchKeyword().getNetTotal() != null && !getSearchKeyword().getNetTotal().trim().equals("")) {
sql += " and ((b.netTotal) like :netTotal )";
Expand Down
33 changes: 33 additions & 0 deletions src/main/java/com/divudi/bean/store/StoreAdjustmentController.java
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,39 @@ public void setStk(List<Stock> stk) {
this.stk = stk;
}

public void fillSelectStock() {
List<Stock> items = new ArrayList<>();
if (stock == null) {
stk = items;
return;
}
String sql;
Map<String, Object> m = new HashMap<>();

sql = "select i "
+ " from Stock i "
+ " where i.department=:d "
+ " and i.itemBatch.item.code=:stationary "
+ " order by i.stock desc";

m.put("d", sessionController.getDepartment());
m.put("stationary", stock.getItemBatch().getItem().getCode()); // Assuming stk contains the item

items = getStockFacade().findByJpql(sql, m);

if (items != null) {
stk = items;
}
}

public List<Stock> getStk() {
return stk;
}

public void setStk(List<Stock> stk) {
this.stk = stk;
}

public void fillSelectStock(){
List<Stock> items = new ArrayList<>();

Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/divudi/bean/store/StoreIssueController.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import com.divudi.facade.StockFacade;
import com.divudi.facade.StockHistoryFacade;
import com.divudi.bean.common.util.JsfUtil;
import com.divudi.data.BillTypeAtomic;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
Expand Down Expand Up @@ -414,6 +415,8 @@ private void savePreBillFinally() {
getPreBill().setBillTime(new Date());
getPreBill().setFromDepartment(getSessionController().getLoggedUser().getDepartment());
getPreBill().setFromInstitution(getSessionController().getLoggedUser().getDepartment().getInstitution());
getPreBill().setBillType(BillType.StoreIssue);
getPreBill().setBillTypeAtomic(BillTypeAtomic.STORE_ORDER);

if (getPreBill().getId() == null) {
getBillFacade().create(getPreBill());
Expand Down Expand Up @@ -542,7 +545,7 @@ public void settleBill() {
}

getPreBill().setPaidAmount(getPreBill().getTotal());
// ////System.out.println("getPreBill().getPaidAmount() = " + getPreBill().getPaidAmount());

List<BillItem> tmpBillItems = getPreBill().getBillItems();
getPreBill().setBillItems(null);

Expand Down Expand Up @@ -973,7 +976,6 @@ public PreBill getPreBill() {
if (preBill == null) {
preBill = new PreBill();
preBill.setBillType(BillType.StoreIssue);
// preBill.setPaymentScheme(getPaymentSchemeController().getItems().get(0));
}
return preBill;
}
Expand Down
16 changes: 3 additions & 13 deletions src/main/webapp/resources/store/issue.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,12 @@
</td>
<td styleClass="itemsBlockRight" style="text-align: right; padding-right: 30px;" >
<h:outputLabel value="#{bip.netRate}" >
<f:convertNumber pattern="#,####0.0000" />
<f:convertNumber pattern="#,####0.00" />
</h:outputLabel>
</td>
<td styleClass="itemsBlockRight" style="text-align: right; padding-right: 30px;" >
<h:outputLabel value="#{bip.netValue}" >
<f:convertNumber pattern="#,####0.0000" />
<f:convertNumber pattern="#,####0.00" />
</h:outputLabel>
</td>

Expand Down Expand Up @@ -306,7 +306,7 @@
</td>
<td class="totalsBlock" style="text-align: right!important;font-weight: bold; ; padding-right: 30px; ">
<h:outputLabel value="#{cc.attrs.bill.netTotal}">
<f:convertNumber pattern="#,##0.0000" />
<f:convertNumber pattern="#,##0.00" />
</h:outputLabel>
</td>
</tr>
Expand All @@ -326,16 +326,6 @@

</div>


<div class="footer">
<br/>
THANK YOU. PLEASE COME AGAIN<br/>
Returns Accepted only within 3 days<br/>
Software by www.lakmedi.com - 0715812399<br/>
</div>



</div>
</cc:implementation>
</html>
2 changes: 1 addition & 1 deletion src/main/webapp/store/store_adjustment_department.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<h:outputLabel value="Batches" class="my-2"></h:outputLabel>
<p:dataTable
id="tblStock"
value="#{storeAdjustmentController.stock}"
value="#{storeAdjustmentController.stk}"
var="i"
rows="10"
selectionMode="single"
Expand Down
152 changes: 75 additions & 77 deletions src/main/webapp/store/store_issue.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@

<ui:define name="content">



<h:form id="bill" >
<p:growl id="panelError" />
<p:commandButton id="nullButton2" value="No Action" action="#" style="display: none;" ></p:commandButton>
<p:defaultCommand target="btnAdd" />

<p:panel rendered="#{!storeIssueController.billPreview}" >
Expand All @@ -37,80 +34,6 @@
</p:commandButton>
</f:facet>
<div class="row">
<div class="col-4">
<p:panel>
<f:facet name="header">
<h:outputText styleClass="fas fa-share-square" />
<h:outputText class="mx-4" value="Issue Details" />
</f:facet>
<h:panelGrid columns="2" class="w-100">
<h:outputLabel value="Issuing Department"/>
<p:autoComplete
class="w-100"
inputStyleClass="w-100"
completeMethod="#{departmentController.completeDept}"
forceSelection="true"
var="w"
itemLabel="#{w.name}"
itemValue="#{w}"
value="#{storeIssueController.toDepartment}"
id="acDept">
<p:column headerText="Department Name">
#{w.name}
</p:column>
<p:column headerText="Institution Name">
#{w.institution.name}
</p:column>
<p:ajax process="acDept" update=":#{p:resolveFirstComponentWithId('pBillDetails',view).clientId} #{p:resolveFirstComponentWithId('tblBillItem',view).clientId} "
event="itemSelect" listener="#{storeIssueController.calculateAllRates}" />
</p:autoComplete>

<h:outputLabel value="Request Number"/>
<p:inputText class="w-100" value="#{storeIssueController.preBill.invoiceNumber}" id="req"/>

<h:outputLabel value="Comment"/>
<p:inputTextarea class="w-100" value="#{storeIssueController.preBill.comments}" id="comment"/>

<p:watermark value="Request Number" for="req"/>
<p:watermark value="Issuing Department" for="acDept"/>
<p:watermark value="Comment" for="comment"/>
</h:panelGrid>


<p:commandButton
accesskey="s"
value="Issue"
ajax="false"
icon="fas fa-check"
action="#{storeIssueController.settleBill()}"
class="w-25 ui-button-warning"
actionListener="#{storeIssueController.calculateAllRates}">

</p:commandButton>
</p:panel>
<p:panel header="Bill Details" id="pBillDetails" class="my-1" >
<f:facet name="header">
<h:outputText styleClass="fas fa-file-invoice"/>
<h:outputText class="mx-4" value="Bill Details" />
</f:facet>
<h:panelGrid columns="2" columnClasses="numberCol, textCol" id="total" >
<h:outputLabel value="Total" ></h:outputLabel>
<h:outputLabel value="#{storeIssueController.preBill.total}" >
<f:convertNumber pattern="#,##0.00" />
</h:outputLabel>

<h:outputLabel value="Margin" ></h:outputLabel>
<h:outputLabel value="#{storeIssueController.preBill.margin}" >
<f:convertNumber pattern="#,##0.00" />
</h:outputLabel>

<h:outputLabel value="Net Total" ></h:outputLabel>
<h:outputLabel value="#{storeIssueController.preBill.netTotal}" >
<f:convertNumber pattern="#,##0.00" />
</h:outputLabel>
</h:panelGrid>
</p:panel>
</div>
<div class="col-8">
<p:panel>
<f:facet name="header">
Expand Down Expand Up @@ -278,6 +201,81 @@
</p:panel>

</div>

<div class="col-4">
<p:panel>
<f:facet name="header">
<h:outputText styleClass="fas fa-share-square" />
<h:outputText class="mx-4" value="Issue Details" />
</f:facet>
<h:panelGrid columns="2" class="w-100">
<h:outputLabel value="Issuing Department"/>
<p:autoComplete
class="w-100"
inputStyleClass="w-100"
completeMethod="#{departmentController.completeDept}"
forceSelection="true"
var="w"
itemLabel="#{w.name}"
itemValue="#{w}"
value="#{storeIssueController.toDepartment}"
id="acDept">
<p:column headerText="Department Name">
#{w.name}
</p:column>
<p:column headerText="Institution Name">
#{w.institution.name}
</p:column>
<p:ajax process="acDept" update=":#{p:resolveFirstComponentWithId('pBillDetails',view).clientId} #{p:resolveFirstComponentWithId('tblBillItem',view).clientId} "
event="itemSelect" listener="#{storeIssueController.calculateAllRates}" />
</p:autoComplete>

<h:outputLabel value="Request Number"/>
<p:inputText class="w-100" value="#{storeIssueController.preBill.invoiceNumber}" id="req"/>

<h:outputLabel value="Comment"/>
<p:inputTextarea class="w-100" value="#{storeIssueController.preBill.comments}" id="comment"/>

<p:watermark value="Request Number" for="req"/>
<p:watermark value="Issuing Department" for="acDept"/>
<p:watermark value="Comment" for="comment"/>
</h:panelGrid>


<p:commandButton
accesskey="s"
value="Issue"
ajax="false"
icon="fas fa-check"
action="#{storeIssueController.settleBill()}"
class="w-25 ui-button-warning"
actionListener="#{storeIssueController.calculateAllRates}">

</p:commandButton>
</p:panel>
<p:panel header="Bill Details" id="pBillDetails" class="my-1" >
<f:facet name="header">
<h:outputText styleClass="fas fa-file-invoice"/>
<h:outputText class="mx-4" value="Bill Details" />
</f:facet>
<h:panelGrid columns="2" columnClasses="numberCol, textCol" id="total" >
<h:outputLabel value="Total" ></h:outputLabel>
<h:outputLabel value="#{storeIssueController.preBill.total}" >
<f:convertNumber pattern="#,##0.00" />
</h:outputLabel>

<h:outputLabel value="Margin" ></h:outputLabel>
<h:outputLabel value="#{storeIssueController.preBill.margin}" >
<f:convertNumber pattern="#,##0.00" />
</h:outputLabel>

<h:outputLabel value="Net Total" ></h:outputLabel>
<h:outputLabel value="#{storeIssueController.preBill.netTotal}" >
<f:convertNumber pattern="#,##0.00" />
</h:outputLabel>
</h:panelGrid>
</p:panel>
</div>
</div>
</p:panel>

Expand Down
Loading

0 comments on commit 4cf24a2

Please sign in to comment.