Skip to content

Commit

Permalink
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
Browse files Browse the repository at this point in the history
  • Loading branch information
buddhika75 committed Jan 25, 2025
1 parent bd69926 commit c34099b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
16 changes: 15 additions & 1 deletion src/main/java/com/divudi/bean/pharmacy/SaleReturnController.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,19 @@ public class SaleReturnController implements Serializable {

PaymentMethodData paymentMethodData;

public String navigateToReturnItemsAndPaymentsForPharmacyRetailSale() {
if (bill == null) {
JsfUtil.addErrorMessage("Please select a bill to return");
return null;
}
if (bill.isCancelled()) {
JsfUtil.addErrorMessage("Cancelled Bills CAN NOT BE returned");
return null;
}

return "/pharmacy/pharmacy_bill_return_retail?faces-redirect=true";
}

public PaymentMethodData getPaymentMethodData() {
if (paymentMethodData == null) {
paymentMethodData = new PaymentMethodData();
Expand All @@ -107,6 +120,7 @@ public void setBill(Bill bill) {
makeNull();
this.bill = bill;
generateBillComponent();
returnPaymentMethod = bill.getPaymentMethod();
}

public Bill getReturnBill() {
Expand Down Expand Up @@ -507,7 +521,7 @@ public void generateBillComponent() {
//System.err.println("Refund " + rFund);
// //System.err.println("Cancelled "+rCacnelled);
// //System.err.println("Net "+(rBilled-rCacnelled));
tmp.setQtyInUnit((double) (Math.abs(i.getQty()) - Math.abs(rFund)));
tmp.setQty((double) (Math.abs(i.getQty()) - Math.abs(rFund)));

bi.setPharmaceuticalBillItem(tmp);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@
</h:panelGroup>
</p:column>

<p:column headerText="Payment Method" >
<h:outputLabel value="#{bill.paymentMethod.label}" >
</h:outputLabel>
</p:column>

<p:column headerText="Net Value" >
<h:outputLabel value="#{bill.netTotal}" >
<f:convertNumber pattern="#,##0.00"/>
Expand All @@ -117,17 +122,18 @@
ajax="false"
id="viewBill"
icon="fas fa-file-invoice"
value="View Bill"
class="m-1 ui-button-success"
value="View"
class="mx-1 ui-button-success"
action="pharmacy_reprint_bill_sale?faces-redirect=true">
<f:setPropertyActionListener value="#{bill.referenceBill}" target="#{pharmacyBillSearch.bill}"/>
</p:commandButton>
<p:tooltip for="viewBill" value="View Bill" showDelay="0" hideDelay="0"></p:tooltip>
<p:commandButton
ajax="false"
class="m-1 ui-button-warning"
value="Return Item and Cash"
action="pharmacy_bill_return_retail?faces-redirect=true"
class="mx-1 ui-button-warning"
value="Return"
title="Return Items and Payments"
action="#{saleReturnController.navigateToReturnItemsAndPaymentsForPharmacyRetailSale()}"
disabled="#{bill.cancelled eq true}">
<f:setPropertyActionListener value="#{bill}" target="#{saleReturnController.bill}"/>
</p:commandButton>
Expand Down

0 comments on commit c34099b

Please sign in to comment.