Skip to content

Commit

Permalink
Merge pull request #4656 from hmislk/Issue#4654
Browse files Browse the repository at this point in the history
Closes #4654
  • Loading branch information
Senula88 authored Apr 19, 2024
2 parents e0c13d2 + ff76371 commit f59233f
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 41 deletions.
9 changes: 3 additions & 6 deletions src/main/java/com/divudi/bean/pharmacy/GrnController.java
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ public void onEditPurchaseRate(BillItem tmp) {
//
// return suggessions;
// }
private void calGrossTotal() {
public void calGrossTotal() {
double tmp = 0.0;
int serialNo = 0;
for (BillItem p : getBillItems()) {
Expand All @@ -792,12 +792,9 @@ public void netDiscount() {
//getGrnBill().setNetTotal(getGrnBill().getTotal() + getGrnBill().getDiscount());
double grossTotal = 0.0;
if (getGrnBill().getDiscount() > 0) {
grossTotal = getGrnBill().getTotal() + getGrnBill().getDiscount();
////// // System.out.println("gross" + grossTotal);
////// // System.out.println("net1" + getBill().getNetTotal());
getGrnBill().setNetTotal(grossTotal);
////// // System.out.println("net2" + getBill().getNetTotal());
ChangeDiscountLitener();
}
calDifference();
}

public void saveBillFee(BillItem bi, Payment p) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,16 @@ public void saveBillComponent() {
i.setCreatedAt(Calendar.getInstance().getTime());
i.setCreater(getSessionController().getLoggedUser());
i.setNetValue(i.getPharmaceuticalBillItem().getQty() * i.getPharmaceuticalBillItem().getPurchaseRate());

double qty = 0.0;
qty = i.getTmpQty() + i.getPharmaceuticalBillItem().getFreeQty();
if (qty <= 0.0) {
i.setRetired(true);
i.setRetirer(sessionController.getLoggedUser());
i.setRetiredAt(new Date());
i.setRetireComments("Retired at Approving PO");

}

PharmaceuticalBillItem phItem = i.getPharmaceuticalBillItem();
i.setPharmaceuticalBillItem(null);
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/arogya</jta-data-source>
<jta-data-source>jdbc/arogyaNew</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.logging.level.sql" value="SEVERE"/>
Expand Down
14 changes: 7 additions & 7 deletions src/main/webapp/pharmacy/pharmacy_grn.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<h:outputLabel value="#{bi.pharmaceuticalBillItem.qtyInUnit}" />
</f:facet>
<f:facet name="input">
<p:inputText autocomplete="off" value="#{bi.tmpQty}" />
<p:inputText autocomplete="off" value="#{bi.tmpQty}" onfocus="this.select()"/>
</f:facet>
</p:cellEditor>
</p:column>
Expand All @@ -123,7 +123,7 @@
<h:outputLabel id="freeQty" value="#{bi.pharmaceuticalBillItem.freeQtyInUnit}"/>
</f:facet>
<f:facet name="input">
<p:inputText autocomplete="off" value="#{bi.tmpFreeQty}" />
<p:inputText autocomplete="off" value="#{bi.tmpFreeQty}" onfocus="this.select()"/>
</f:facet>
</p:cellEditor>
</p:column>
Expand Down Expand Up @@ -155,7 +155,7 @@
</h:panelGroup>
</f:facet>
<f:facet name="input">
<p:inputText autocomplete="off" value="#{bi.pharmaceuticalBillItem.retailRate}" >
<p:inputText autocomplete="off" value="#{bi.pharmaceuticalBillItem.retailRate}" onfocus="this.select()">
<f:convertNumber pattern="#,##0.00" />
</p:inputText>
</f:facet>
Expand Down Expand Up @@ -193,7 +193,7 @@
<h:outputLabel value="#{bi.pharmaceuticalBillItem.stringValue}" id="txtBatch"/>
</f:facet>
<f:facet name="input">
<p:inputText autocomplete="off" value="#{bi.pharmaceuticalBillItem.stringValue}">
<p:inputText autocomplete="off" value="#{bi.pharmaceuticalBillItem.stringValue}" onfocus="this.select()">
</p:inputText>
</f:facet>
</p:cellEditor>
Expand Down Expand Up @@ -238,8 +238,8 @@
<f:convertNumber pattern="#,##0.00" />
</p:outputLabel>
<p:outputLabel value="Discount"/>
<p:inputText autocomplete="off" id="dis" value="#{grnController.grnBill.discount}" >
<p:ajax process="@this" update="net ins" event="keyup"
<p:inputText autocomplete="off" id="dis" value="#{grnController.grnBill.discount}" onfocus="this.select()">
<p:ajax process="@this" update="net ins diff" event="keyup"
listener="#{grnController.netDiscount()}"/>
</p:inputText>
<p:outputLabel value="Net Total"/>
Expand All @@ -250,7 +250,7 @@

<p:panelGrid columns="2" id="ins">
<p:outputLabel value="Invoice Total"/>
<p:inputText id="insv" value="#{grnController.insTotal}" >
<p:inputText id="insv" value="#{grnController.insTotal}" onfocus="this.select()">
<f:convertNumber pattern="#,##0.00" />
<p:ajax process="@this" update="diff" event="keyup"
listener="#{grnController.calDifference()}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@
</p:inputText>
</p:column>
<p:column headerText="Free Qty" styleClass="averageNumericColumn" >
<p:inputText autocomplete="off" id="freeQty" value="#{bi.pharmaceuticalBillItem.freeQty}" style="width:100%">
<p:inputText autocomplete="off" id="freeQty" value="#{bi.pharmaceuticalBillItem.freeQty}" style="width:100%" onfocus="this.select()">
<f:convertNumber pattern="#,#00"/>
<f:ajax event="blur" render="total :#{p:resolveFirstComponentWithId('tot',view).clientId}" execute="@this price" listener="#{purchaseOrderController.onEdit(bi)}" ></f:ajax>
<f:ajax event="focus" render=":#{p:resolveFirstComponentWithId('tab',view).clientId}" listener="#{purchaseOrderController.onFocus(bi)}" />
</p:inputText>
</p:column>
<p:column headerText="Purchse Price" styleClass="averageNumericColumn" >
<h:panelGroup id="price">
<p:inputText autocomplete="off" value="#{bi.pharmaceuticalBillItem.purchaseRate}">
<p:inputText autocomplete="off" value="#{bi.pharmaceuticalBillItem.purchaseRate}" onfocus="this.select()">
<f:convertNumber pattern="#00.00"/>
<f:ajax event="blur" render="total :#{p:resolveFirstComponentWithId('tot',view).clientId}" execute="@this qty" listener="#{purchaseOrderController.onEdit(bi)}" ></f:ajax>
<f:ajax event="focus" render=":#{p:resolveFirstComponentWithId('tab',view).clientId}" listener="#{purchaseOrderController.onFocus(bi)}" />
Expand Down
52 changes: 27 additions & 25 deletions src/main/webapp/resources/pharmacy/po.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -99,31 +99,33 @@
</thead>
<tbody>
<ui:repeat value="#{cc.attrs.bill.billItems}" var="bip" varStatus="status">
<tr>
<td style="width: 30px; text-align: right; padding-right: 5px; border: 1px solid black;">#{status.index + 1}</td>
<td style="text-align: left; min-width: 400px; border: 1px solid black;">#{bip.item.name}</td>
<td style="width: 100px; text-align: right; padding-right: 5px; border: 1px solid black;">
<h:outputText value="#{bip.pharmaceuticalBillItem.purchaseRate}">
<f:convertNumber pattern="#,##0.00" />
</h:outputText>
</td>
<td style="width: 100px; text-align: right; padding-right: 5px; border: 1px solid black;">
<h:outputText value="#{bip.pharmaceuticalBillItem.qty}">
<f:convertNumber />
</h:outputText>
</td>
<td style="width: 100px; text-align: right; padding-right: 5px; border: 1px solid black;">
<h:outputText value="#{bip.pharmaceuticalBillItem.freeQty}">
<f:convertNumber />
</h:outputText>
</td>

<td style="width: 100px; text-align: right; padding-right: 5px; border: 1px solid black;">
<h:outputText value="#{bip.pharmaceuticalBillItem.purchaseRate * bip.pharmaceuticalBillItem.qty}">
<f:convertNumber pattern="#,###.00" />
</h:outputText>
</td>
</tr>
<h:panelGroup rendered="#{not bip.retired}" >
<tr>
<td style="width: 30px; text-align: right; padding-right: 5px; border: 1px solid black;">#{status.index + 1}</td>
<td style="text-align: left; min-width: 400px; border: 1px solid black;">#{bip.item.name}</td>
<td style="width: 100px; text-align: right; padding-right: 5px; border: 1px solid black;">
<h:outputText value="#{bip.pharmaceuticalBillItem.purchaseRate}">
<f:convertNumber pattern="#,##0.00" />
</h:outputText>
</td>
<td style="width: 100px; text-align: right; padding-right: 5px; border: 1px solid black;">
<h:outputText value="#{bip.pharmaceuticalBillItem.qty}">
<f:convertNumber />
</h:outputText>
</td>
<td style="width: 100px; text-align: right; padding-right: 5px; border: 1px solid black;">
<h:outputText value="#{bip.pharmaceuticalBillItem.freeQty}">
<f:convertNumber />
</h:outputText>
</td>

<td style="width: 100px; text-align: right; padding-right: 5px; border: 1px solid black;">
<h:outputText value="#{bip.pharmaceuticalBillItem.purchaseRate * bip.pharmaceuticalBillItem.qty}">
<f:convertNumber pattern="#,###.00" />
</h:outputText>
</td>
</tr>
</h:panelGroup>
</ui:repeat>
</tbody>
</table>
Expand Down

0 comments on commit f59233f

Please sign in to comment.