Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

10260 after grn is canceled it must be removed from the suppler payment list #10407

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
134 commits
Select commit Hold shift + click to select a range
5067af2
fact: add expense section to direct purchase and update bill with net…
ChinthakaPrasad Jan 16, 2025
a4f73ff
fact:improve purchase bill adding expenses and ui improvements.
ChinthakaPrasad Jan 16, 2025
5513d7f
Signed-off-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad…
ChinthakaPrasad Jan 16, 2025
2eb4ed7
Signed-off-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad…
ChinthakaPrasad Jan 16, 2025
a4f5914
Signed-off-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad…
ChinthakaPrasad Jan 16, 2025
91c170b
Closes #10114
buddhika75 Jan 17, 2025
bd7bf2d
Merge branch '10125-inpatient-pharmacy-issue-summery-do-not-exclude-c…
buddhika75 Jan 17, 2025
34ca1b7
Merge branch '6264-add-expences-for-pharmacy-direct-purchase' of http…
buddhika75 Jan 17, 2025
f7b5688
Merge branch 'coop-prod' of https://github.com/hmislk/hmis.git into 1…
buddhika75 Jan 17, 2025
d9fb98e
Signed-off-by: Dr M H B Ariyaratne <[email protected]>
buddhika75 Jan 19, 2025
c07a30e
Closes #10116
buddhika75 Jan 19, 2025
4cd0883
Merge branch '10114-different-bill-number-generation-strategies-for-o…
buddhika75 Jan 19, 2025
bc24c68
Merge branch '10116-different-bill-number-generation-strategies-for-c…
buddhika75 Jan 19, 2025
12f0446
Signed-off-by: Dr M H B Ariyaratne <[email protected]>
buddhika75 Jan 23, 2025
baa6c28
Closes #10187
buddhika75 Jan 23, 2025
9b37a80
Closes #10176
buddhika75 Jan 23, 2025
f04df4e
Merge branch '10187-when-returning-pharmacy-items-for-inpatients-the-…
buddhika75 Jan 23, 2025
d4a7648
add department wise filter for inward pharmacy issue summery
ChinthakaPrasad Jan 23, 2025
1e621bb
Merge branch 'development' of https://github.com/hmislk/hmis.git into…
ChinthakaPrasad Jan 23, 2025
58aa9ad
Signed-off-by: Dr M H B Ariyaratne <[email protected]>
buddhika75 Jan 23, 2025
5760973
Merge branch '#10036_Grn_report' of https://github.com/hmislk/hmis.gi…
buddhika75 Jan 23, 2025
dfa9faf
Merge branch 'Hotfix-add-filter-for-pharmacy-issue-summery' of https:…
buddhika75 Jan 23, 2025
c7ba43a
Closes #10191
buddhika75 Jan 23, 2025
4d2604f
Signed-off-by: Dr M H B Ariyaratne <[email protected]>
buddhika75 Jan 23, 2025
f2f6c3a
Merge pull request #10203 from hmislk/development
GSMgeeth Jan 23, 2025
0a7f64b
Merge pull request #10245 from hmislk/10239-improve-search-in-pharmac…
buddhika75 Jan 26, 2025
891a3ae
Update mp_prod_ci_cd.yml
GSMgeeth Jan 26, 2025
5bcf09d
Merge pull request #10247 from hmislk/10239-improve-search-in-pharmac…
buddhika75 Jan 26, 2025
6da7f83
Merge branch 'mp-prod' of https://github.com/hmislk/hmis.git into 101…
buddhika75 Jan 27, 2025
7dab412
Signed-off-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad…
ChinthakaPrasad Jan 29, 2025
0057d1a
Merge branch 'development' of https://github.com/hmislk/hmis.git into…
ChinthakaPrasad Jan 29, 2025
3805a09
Signed-off-by: Dr M H B Ariyaratne <[email protected]>
buddhika75 Jan 29, 2025
d0fcdb4
Merge branch '10176-grn-print-not-working-properly' into 10191-prise-…
buddhika75 Jan 29, 2025
932330c
fix: pharmacy tranfer bill improvement done.
ChinthakaPrasad Jan 29, 2025
3b1f31e
Merge branch '9668-assign-data-capture-form-templates-to-process-acti…
buddhika75 Jan 29, 2025
396f6d9
Signed-off-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad…
ChinthakaPrasad Jan 29, 2025
2b774b0
Signed-off-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad…
ChinthakaPrasad Jan 29, 2025
8061eda
Signed-off-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad…
ChinthakaPrasad Jan 29, 2025
eb3de3d
Signed-off-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad…
ChinthakaPrasad Jan 29, 2025
595b64c
Merge pull request #10287 from hmislk/10285-stock-history-update
buddhika75 Jan 29, 2025
b9f049b
Merge pull request #10288 from hmislk/10285-stock-history-update
buddhika75 Jan 29, 2025
a5c33b8
Payment Approval Basics Completed
buddhika75 Jan 30, 2025
61055b3
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Jan 30, 2025
514a108
Closes #10291
buddhika75 Jan 30, 2025
55b815f
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Jan 30, 2025
a09a238
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Jan 30, 2025
47cabc8
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Jan 30, 2025
9e28bfa
Closes #10259
buddhika75 Jan 30, 2025
a50aa1b
Closes #10259
buddhika75 Jan 30, 2025
bfdf4be
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Jan 30, 2025
2b14386
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Jan 30, 2025
9e1b7de
Merge branch '10291-grn-payment-autherization-and-completion' into 99…
buddhika75 Jan 30, 2025
bae6112
GRN No, Invoice No added
buddhika75 Jan 30, 2025
aa34c0a
Closes #9986
buddhika75 Jan 30, 2025
d9a49d7
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Jan 30, 2025
2bba42b
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Jan 30, 2025
d88d657
Closes #9939
buddhika75 Jan 30, 2025
107cf62
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Jan 30, 2025
549337a
Merge branch '9986-improvement-of-dealer-payments' into 7830-cannot-s…
buddhika75 Jan 30, 2025
8038937
Merge branch '9939-need-bill-number-and-grn-no-for-supplier-payment' …
buddhika75 Jan 30, 2025
49553d0
Merge branch '10230-navigation-button-back-to-po-list-required-in-grn…
buddhika75 Jan 30, 2025
ebb7e8a
Merge branch '10285-stock-history-update' into 7830-cannot-search-usi…
buddhika75 Jan 30, 2025
b11a12f
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Jan 30, 2025
43c7295
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Jan 30, 2025
46d4d06
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Jan 30, 2025
6e8340d
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Jan 31, 2025
d31deae
Merge branch '10176-grn-print-not-working-properly' into 7830-cannot-…
buddhika75 Jan 31, 2025
5e7422e
Merge branch '10191-prise-matrix-configuration-for-inpatient-direct-i…
buddhika75 Jan 31, 2025
d1f09b7
Signed-off-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad…
ChinthakaPrasad Jan 31, 2025
120b603
Signed-off-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad…
ChinthakaPrasad Jan 31, 2025
72374d2
Merge branch 'development' of https://github.com/hmislk/hmis.git into…
ChinthakaPrasad Jan 31, 2025
328ff6b
Signed-off-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad…
ChinthakaPrasad Jan 31, 2025
0b916f7
Signed-off-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad…
ChinthakaPrasad Jan 31, 2025
97569a8
Signed-off-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad…
ChinthakaPrasad Jan 31, 2025
ffb1b3e
Merge branch '10313-pharmacy-retail-sale-search-optimization' of http…
buddhika75 Jan 31, 2025
29803f6
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Jan 31, 2025
3c036fc
Merge pull request #10322 from hmislk/development
buddhika75 Jan 31, 2025
527cdc0
Signed-off-by: Dr M H B Ariyaratne <[email protected]>
buddhika75 Feb 1, 2025
5b4eb82
Merge branch '7830-cannot-search-using-grn-no-in-dealer-payment' of h…
buddhika75 Feb 1, 2025
f9611c7
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Feb 1, 2025
69b10af
Merge branch '7830-cannot-search-using-grn-no-in-dealer-payment' into…
buddhika75 Feb 1, 2025
5427f35
Closes #10334
buddhika75 Feb 1, 2025
fc5398e
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Feb 1, 2025
0ac1a16
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Feb 1, 2025
74caa90
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Feb 1, 2025
844fd97
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Feb 1, 2025
bb11a54
Merge branch '10334-patient-report---retired-reports-are-also-called'…
buddhika75 Feb 1, 2025
e248095
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Feb 1, 2025
14b0c6c
Merge branch '10329-cannot-be-add-more-than-one-bht-in-inward' into 7…
buddhika75 Feb 1, 2025
2cbc11a
Merge branch 'development' of https://github.com/hmislk/hmis.git into…
buddhika75 Feb 1, 2025
45bcfc4
Closes #7830
buddhika75 Feb 1, 2025
51c157c
Closes #10337
buddhika75 Feb 1, 2025
98ca05c
Merge pull request #10340 from hmislk/10337-pharmacy-retail-sale-canc…
buddhika75 Feb 2, 2025
bef801a
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Feb 2, 2025
d1c66fe
Merge branch '10337-pharmacy-retail-sale-cancellation---multiple-paym…
buddhika75 Feb 2, 2025
01f74a8
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Feb 2, 2025
2e80d84
Merge pull request #10343 from hmislk/3832-dealer-payment-by-bill
buddhika75 Feb 2, 2025
337f7e9
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Feb 2, 2025
8b897ba
Closes #3832
buddhika75 Feb 2, 2025
028a70a
Merge branch 'development' of https://github.com/hmislk/hmis.git into…
buddhika75 Feb 2, 2025
c53c61d
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Feb 2, 2025
aca862a
Merge branch '3832-dealer-payment-by-bill' into 9681-improvements-in-…
buddhika75 Feb 2, 2025
29babbe
Improved supplier payment management where Approval is necessary
buddhika75 Feb 2, 2025
1d956a3
Closes #9681
buddhika75 Feb 2, 2025
693abfa
Merge pull request #10348 from hmislk/development
buddhika75 Feb 2, 2025
5638780
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Feb 3, 2025
a85eff9
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Feb 3, 2025
43d38ea
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Feb 3, 2025
42cf556
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Feb 3, 2025
58c9ee4
Merge branch 'development' into 10334-patient-report---retired-report…
buddhika75 Feb 3, 2025
a31a437
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Feb 3, 2025
b17067d
Merge branch '10334-patient-report---retired-reports-are-also-called'…
buddhika75 Feb 3, 2025
3de87b6
Merge pull request #10380 from hmislk/development
GSMgeeth Feb 3, 2025
199aba5
Merge pull request #10381 from hmislk/development
GSMgeeth Feb 3, 2025
1419110
Merge pull request #10382 from hmislk/development
GSMgeeth Feb 3, 2025
25b66e9
Merge pull request #10383 from hmislk/development
GSMgeeth Feb 3, 2025
77409bf
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Feb 4, 2025
5a11922
Merge branch 'development' of https://github.com/hmislk/hmis.git into…
buddhika75 Feb 4, 2025
891699d
Closes #9681
buddhika75 Feb 5, 2025
0625ebf
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Feb 5, 2025
9424151
Merge branch '7830-cannot-search-using-grn-no-in-dealer-payment' into…
buddhika75 Feb 5, 2025
9f2ba1f
Merge branch '9681-improvements-in-supplier-payment-management' of ht…
buddhika75 Feb 5, 2025
5725c9f
Signed-off-by: Dr M H B Ariyaratne <[email protected]>
buddhika75 Feb 5, 2025
5a4d292
Signed-off-by: Dr M H B Ariyaratne <[email protected]>
buddhika75 Feb 5, 2025
9c12c91
Merge branch 'development' of https://github.com/hmislk/hmis.git into…
buddhika75 Feb 5, 2025
cfca59c
Signed-off-by: Dr M H B Ariyaratne <[email protected]>
buddhika75 Feb 5, 2025
f9c6c2d
Merge branch 'coop-dev' of https://github.com/hmislk/hmis.git into 10…
buddhika75 Feb 5, 2025
e652486
Merge branch 'coop-prod' of https://github.com/hmislk/hmis.git into 1…
buddhika75 Feb 5, 2025
6398821
Merge branch 'ruhunu-dev' of https://github.com/hmislk/hmis.git into …
buddhika75 Feb 5, 2025
8799d70
Merge branch 'coop-stg' of https://github.com/hmislk/hmis.git into 10…
buddhika75 Feb 5, 2025
5785a44
Merge branch 'mp-prod' of https://github.com/hmislk/hmis.git into 102…
buddhika75 Feb 5, 2025
9206d2d
Merge branch 'Hotfix-pharmacy-transfer-issue-print' of https://github…
buddhika75 Feb 5, 2025
ef02564
Signed-off-by: Dr M H B Ariyaratne <[email protected]>
buddhika75 Feb 5, 2025
163a6f4
Closes #10260
buddhika75 Feb 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/java/com/divudi/bean/common/BillController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2837,8 +2837,9 @@ public List<Bill> findUnpaidBills(Date frmDate, Date toDate, List<BillTypeAtomic

public List<Bill> findUnpaidBills(Date frmDate, Date toDate, List<BillTypeAtomic> billTypes,
PaymentMethod pm, Double balanceGraterThan, Boolean omitPaymentGeneratedBills) {
String jpql = "SELECT b FROM Bill b WHERE b.retired = :ret AND b.cancelled = :can "
+ "AND b.createdAt BETWEEN :frm AND :to";
String jpql = "SELECT b FROM Bill b WHERE b.retired = :ret "
+ " AND b.cancelled = :can " //Cancelled bills are no longer listed here
+ " AND b.createdAt BETWEEN :frm AND :to";

HashMap<String, Object> params = new HashMap<>();
params.put("frm", frmDate);
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/com/divudi/bean/common/ReportsController.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
import java.text.SimpleDateFormat;
import java.util.stream.Collectors;
import java.text.DecimalFormat;

import org.apache.poi.xssf.usermodel.XSSFCellStyle;

/**
Expand Down Expand Up @@ -2651,7 +2650,7 @@ public void generateDebtorBalanceReport(final boolean onlyDueBills) {
}

public ReportTemplateRowBundle generateDebtorBalanceReportBills(List<BillTypeAtomic> bts, List<PaymentMethod> billPaymentMethods,
boolean onlyDueBills) {
boolean onlyDueBills) {
Map<String, Object> parameters = new HashMap<>();
String jpql = "SELECT new com.divudi.data.ReportTemplateRow(bill) "
+ "FROM Bill bill "
Expand Down Expand Up @@ -3594,7 +3593,7 @@ public void exportOpdAndInwardOPToPdf() {
table.setWidths(columnWidths);

String[] headers = {"S. No", "Invoice Date", "Invoice No", "Customer Reference No", "MRNO", "Patient Name",
"Gross Amt", "Disc Amt", "Net Amt", "Patient Share", "Sponsor Share", "Due Amt"};
"Gross Amt", "Disc Amt", "Net Amt", "Patient Share", "Sponsor Share", "Due Amt"};
for (String header : headers) {
PdfPCell cell = new PdfPCell(new Phrase(header, boldFont));
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
Expand Down Expand Up @@ -3817,7 +3816,7 @@ public void exportOpdAndInwardIPToPdf() {
table.setWidths(columnWidths);

String[] headers = {"S. No", "BHT No", "Invoice Date", "Invoice No", "Customer Reference No", "MRNO", "Patient Name",
"Gross Amt", "Disc Amt", "Net Amt", "Patient Share", "Sponsor Share", "Due Amt"};
"Gross Amt", "Disc Amt", "Net Amt", "Patient Share", "Sponsor Share", "Due Amt"};
for (String header : headers) {
PdfPCell cell = new PdfPCell(new Phrase(header, boldFont));
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
Expand Down Expand Up @@ -4859,8 +4858,8 @@ public void exportDetailedWeeklyOPDReportToPDF() {
}

private void addWeeklyReportSection(Document document, String sectionTitle, List<String> itemList,
List<Integer> daysOfWeek, Map<Integer, Map<String, Map<Integer, Double>>> weeklyDailyBillItemMap,
int week, com.itextpdf.text.Font headerFont, com.itextpdf.text.Font regularFont) throws DocumentException {
List<Integer> daysOfWeek, Map<Integer, Map<String, Map<Integer, Double>>> weeklyDailyBillItemMap,
int week, com.itextpdf.text.Font headerFont, com.itextpdf.text.Font regularFont) throws DocumentException {
document.add(new com.itextpdf.text.Paragraph(sectionTitle, headerFont));
document.add(com.itextpdf.text.Chunk.NEWLINE);

Expand Down
203 changes: 192 additions & 11 deletions src/main/java/com/divudi/bean/pharmacy/SupplierPaymentController.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public class SupplierPaymentController implements Serializable {
private Bill current;
private Bill currentCancellationBill;
private List<Bill> currentReturnBills;
private List<BillItem> currentPaymentBills;
private List<BillItem> currentPaymentBillItems;
private List<Bill> currentPaymentRefundBills;
private List<BillItem> currentSummeryBillItems;
private double currentSummaryPurchaseTotalValue;
Expand Down Expand Up @@ -667,6 +667,17 @@ public void updateReferanceBillBalances(List<BillItem> billItemsWithReferanceToS
// getCurrent().setNetTotal(n);
}

public void updateReferanceBillCompletionStatus(List<BillItem> billItemsWithReferanceToSettlingBills) {
for (BillItem payingBillItem : billItemsWithReferanceToSettlingBills) {
Bill originalBill = payingBillItem.getReferenceBill();
if (originalBill == null) {
continue;
}
originalBill.setPaymentGenerated(false);
billFacade.edit(originalBill);
}
}

public void updateReferanceBillAsPaymentApproved(List<BillItem> billItemsWithReferanceToSettlingBills) {
for (BillItem payingBillItem : billItemsWithReferanceToSettlingBills) {
Bill originalBill = payingBillItem.getReferenceBill();
Expand Down Expand Up @@ -805,6 +816,27 @@ private boolean errorCheckForSettlingApprovedPayments() {
return false;
}

private boolean errorCheckForCompletingApprovedAndSettledPayment() {
if (getCurrent() == null) {
JsfUtil.addErrorMessage("Nothing to settle");
return true;
}
if (getCurrent().getBillItems().isEmpty()) {
JsfUtil.addErrorMessage("No Bill Item ");
return true;
}

if (getCurrent().getToInstitution() == null) {
JsfUtil.addErrorMessage("Select Cant settle without Dealor");
return true;
}

if (getCurrent().getPaymentMethod() == null) {
return true;
}
return false;
}

private boolean errorCheckForSettlingSelectedSupplierBills() {
if (getSelectedBillItems() == null || getSelectedBillItems().isEmpty()) {
JsfUtil.addErrorMessage("No Bill is selected to pay");
Expand Down Expand Up @@ -1578,6 +1610,65 @@ public void fillSupplierPayments(Boolean completed, Boolean paymentCompleted) {
netTotal = bills.stream().mapToDouble(Bill::getNetTotal).sum();
}

public void fillSupplierPayments(Boolean completed, Boolean paymentApproved, Boolean paymentCompleted) {
bills = null;
netTotal = 0.0;
StringBuilder jpql = new StringBuilder("select b from Bill b "
+ " where b.retired=:retired "
+ " and b.cancelled=:cancelled "
+ " and b.createdAt between :fromDate and :toDate"
+ " and b.billTypeAtomic in :btas ");

Map<String, Object> params = new HashMap<>();
List<BillTypeAtomic> btas = Arrays.asList(
BillTypeAtomic.SUPPLIER_PAYMENT_PREPERATION);

params.put("btas", btas);
params.put("cancelled", false);
params.put("retired", false);
params.put("fromDate", fromDate);
params.put("toDate", toDate);

// Conditionally append paymentApproved if parameter is not null
if (completed != null) {
if (completed) {
jpql.append(" and b.completed = :completed ");
params.put("completed", true);
} else {
jpql.append(" and b.completed = :completed ");
params.put("completed", false);
}
}

// Conditionally append paymentCompleted if parameter is not null
if (paymentCompleted != null) {
if (paymentCompleted) {
jpql.append(" and b.paymentCompleted = :completed ");
params.put("completed", true);
} else {
jpql.append(" and b.paymentCompleted = :completed ");
params.put("completed", false);
}
}

// Conditionally append paymentCompleted if parameter is not null
if (paymentApproved != null) {
if (paymentApproved) {
jpql.append(" and b.paymentApproved = :paymentApproved ");
params.put("paymentApproved", true);
} else {
jpql.append(" and b.paymentApproved = :paymentApproved ");
params.put("paymentApproved", false);
}
}

System.out.println("jpql = " + jpql);
System.out.println("params = " + params);
bills = getBillFacade().findByJpql(jpql.toString(), params, TemporalType.TIMESTAMP);
System.out.println("bills = " + bills);
netTotal = bills.stream().mapToDouble(Bill::getNetTotal).sum();
}

public void fillApprovedSupplierPaymentsToSettle() {
supplierPaymentStatus = "Pending Settling";
fillSupplierPayments(false, null);
Expand All @@ -1595,7 +1686,7 @@ public void fillApprovedSupplierPaymentsSettledOrPending() {

public void fillApprovedSupplierPaymentsToComplete() {
supplierPaymentStatus = "Pending Completion";
fillSupplierPayments(true, false);
fillSupplierPayments(null, true, false);
}

public void fillSupplierPaymentsIgnoringApprovealAndCompletion() {
Expand Down Expand Up @@ -1935,13 +2026,13 @@ public String navigateToViewProcurementBill(Bill originalBill) {
}
currentSummeryBillItems = createSummeryBillItems(current, currentReturnBills);

currentPaymentBills = billService.fetchPaymentBills(current);
currentPaymentBillItems = billService.fetchPaymentBillItems(current);
currentSummaryPurchaseTotalValue = current.getTotal();
currentSummaryPurchaseReturnTotalValue = calculateTotalGrossTotalValue(currentReturnBills);
currentSummaryPurchaseNetTotalValue = Math.abs(currentSummaryPurchaseTotalValue) - Math.abs(currentSummaryPurchaseReturnTotalValue);
currentTotalPaymentSettledValue = calculateTotalValue(currentPaymentBills);
currentTotalPaymentSettledValue = calculateTotalValue(currentPaymentBillItems);

currentTotalPaymentToSettleValue = Math.abs(currentSummaryPurchaseNetTotalValue) - Math.abs(currentTotalPaymentSettledValue);
currentTotalPaymentToSettleValue = Math.abs(currentSummaryPurchaseNetTotalValue) - Math.abs(currentTotalPaymentSettledValue);

return "/dealerPayment/view_purchase_bill?faces-redirect=true";
}
Expand Down Expand Up @@ -2032,7 +2123,7 @@ private double calculateTotalValue(List<BillItem> billItems) {

double totalPurchaseValue = 0.0;
for (BillItem billItem : billItems) {
totalPurchaseValue += billItem.getGrossValue();
totalPurchaseValue += billItem.getNetValue();
}
return totalPurchaseValue;
}
Expand Down Expand Up @@ -2134,6 +2225,24 @@ public String navigateToSettleSupplierPayment(Bill approvalBill) {
return "/dealerPayment/settle_approved_supplier_payment?faces-redirect=true";
}

public String navigateToCompleteSupplierPayment(Bill approvedAndSettledPaymentBill) {
makeNull();
if (approvedAndSettledPaymentBill == null) {
JsfUtil.addErrorMessage("No Bill Is Selected");
return null;
}
if (!approvedAndSettledPaymentBill.isPaymentApproved()) {
JsfUtil.addErrorMessage("Not Approved. Can not complete.");
return null;
}
if (!approvedAndSettledPaymentBill.isPaymentCompleted()) {
JsfUtil.addErrorMessage("Already Completed. Can not complete again.");
return null;
}
current = billService.reloadBill(approvedAndSettledPaymentBill);
return "/dealerPayment/complete_approved_and_settled_supplier_payment?faces-redirect=true";
}

public String navigateToStartSupplierPaymentOfSelectedBills() {
prepareForNewSupplierPayment();
if (getSelectedBills().isEmpty()) {
Expand Down Expand Up @@ -2165,6 +2274,49 @@ public String navigateToStartSupplierPaymentOfSelectedBills() {
return "/dealerPayment/pay_supplier?faces-redirect=true";
}

public String navigateToPrepareSupplierPaymentForAllSelectedBills() {
if (selectedBills == null) {
JsfUtil.addErrorMessage("No Bills are Selected");
return null;
}
if (selectedBills.isEmpty()) {
JsfUtil.addErrorMessage("No Bills are Selected");
return null;
}
Institution payingSupplier = null;
for (Bill b : getSelectedBills()) {
if (b.getFromInstitution() == null) {
JsfUtil.addErrorMessage("One purchase or GRN bill does not have a Supplier. Can not proceed.");
return null;
}
if (payingSupplier == null) {
payingSupplier = b.getFromInstitution();
} else {
if (!payingSupplier.equals(b.getFromInstitution())) {
JsfUtil.addErrorMessage("Can not settle purchase or GRN bills from more than one supplier at once.");
return null;
}
}

}
prepareForNewSupplierPaymentGeneration();
current.setFromInstitution(sessionController.getInstitution());
current.setFromDepartment(sessionController.getDepartment());
current.setToInstitution(payingSupplier);

for (Bill billsPaymentsWillBeCreated : selectedBills) {
currentBillItem = new BillItem();
currentBillItem.setSearialNo(1);
currentBillItem.setReferenceBill(billsPaymentsWillBeCreated);
double settlingValue = Math.abs(billsPaymentsWillBeCreated.getNetTotal()) - (Math.abs(billsPaymentsWillBeCreated.getRefundAmount()) + Math.abs(billsPaymentsWillBeCreated.getPaidAmount()));
currentBillItem.setNetValue(-settlingValue);
currentBillItem.setGrossValue(-settlingValue);
getSelectedBillItems().add(currentBillItem);
}
calculateTotalBySelectedBillItems();
return "/dealerPayment/generate_supplier_payment?faces-redirect=true";
}

public void settleSupplierPaymentForApprovedPayment() {
if (errorCheckForSettlingPaymentForApprovedPayment()) {
return;
Expand Down Expand Up @@ -2326,6 +2478,24 @@ public void settleApprovedSupplierPayment() {

}

public void completeApprovedAndSettledSupplierPayment() {
if (errorCheckForCompletingApprovedAndSettledPayment()) {
return;
}
current = billService.reloadBill(current);

getCurrent().setPaymentCompleted(true);
getCurrent().setPaymentCompletedAt(new Date());
getCurrent().setPaymentCompletedBy(sessionController.getLoggedUser());
getBillFacade().edit(getCurrent());

updateReferanceBillCompletionStatus(current.getBillItems());

JsfUtil.addSuccessMessage("Bill Payment Completed");
printPreview = true;

}

public void settleApproveSupplierPayment() {
if (errorCheckForApprovingSupplierPayment()) {
return;
Expand All @@ -2341,6 +2511,17 @@ public void settleApproveSupplierPayment() {
}
updateReferanceBillAsPaymentApproved(getCurrent().getBillItems());

for (BillItem bi : getCurrent().getBillItems()) {
bi.setBill(current);
if (bi.getId() == null) {
bi.setCreatedAt(new Date());
bi.setCreater(sessionController.getLoggedUser());
billItemFacade.create(bi);
} else {
billItemFacade.edit(bi);
}
}

JsfUtil.addSuccessMessage("Payment Approved");
printPreview = true;

Expand Down Expand Up @@ -2388,7 +2569,7 @@ public void settleGenerateSupplierPayment() {
}

updateReferanceBillAsPaymentGenerated(selectedBillItems);

current= billService.reloadBill(current);
JsfUtil.addSuccessMessage("Payment Generated");
printPreview = true;

Expand Down Expand Up @@ -2911,12 +3092,12 @@ public void setCurrentReturnBills(List<Bill> currentReturnBills) {
this.currentReturnBills = currentReturnBills;
}

public List<BillItem> getCurrentPaymentBills() {
return currentPaymentBills;
public List<BillItem> getCurrentPaymentBillItems() {
return currentPaymentBillItems;
}

public void setCurrentPaymentBills(List<BillItem> currentPaymentBills) {
this.currentPaymentBills = currentPaymentBills;
public void setCurrentPaymentBillItems(List<BillItem> currentPaymentBillItems) {
this.currentPaymentBillItems = currentPaymentBillItems;
}

public List<Bill> getCurrentPaymentRefundBills() {
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/com/divudi/ejb/BillNumberGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -1498,6 +1498,9 @@ public String departmentBillNumberGenerator(Institution ins, Department dep, Bil
}

public String departmentBillNumberGeneratorYearly(Department dep, BillTypeAtomic billType) {
System.out.println("departmentBillNumberGeneratorYearly = ");
System.out.println("billType = " + billType);
System.out.println("dep = " + dep);
if (dep == null) {
return "";
}
Expand All @@ -1506,7 +1509,7 @@ public String departmentBillNumberGeneratorYearly(Department dep, BillTypeAtomic
}
BillNumber billNumber;
String billSuffix = configOptionApplicationController.getLongTextValueByKey("Bill Number Suffix for " + billType, "");

System.out.println("billSuffix = " + billSuffix);
boolean commonBillNumberForAllDepartmentsInstitutionsBillTypeAtomic
= configOptionApplicationController.getBooleanValueByKey("Bill Number Generation Strategy - Common Bill Number for All Departments, Institutions and Bill Types", false);
boolean separateBillNumberForAllDepartmentsInstitutionsBillTypeAtomic
Expand Down Expand Up @@ -1534,7 +1537,7 @@ public String departmentBillNumberGeneratorYearly(Department dep, BillTypeAtomic

// Get the last bill number
Long dd = billNumber.getLastBillNumber();

System.out.println("dd = " + dd);
// Increment the bill number
dd++;

Expand Down
Loading