Skip to content

Commit

Permalink
Merge branch 'master' into Issue#6449
Browse files Browse the repository at this point in the history
  • Loading branch information
DamithDeshan authored Jul 21, 2024
2 parents 4f63a20 + acd4671 commit fd2b31d
Show file tree
Hide file tree
Showing 53 changed files with 2,293 additions and 709 deletions.
2 changes: 1 addition & 1 deletion .github/counter.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7
1
2 changes: 1 addition & 1 deletion .github/last_date.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20240719
20240721
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Developed using Java Enterprise Edition, the system offers both a web applicatio

## Current Version

Current Version: 3.0.0.20240719.7 (This line will be automatically updated to reflect the latest version)
Current Version: 3.0.0.20240721.1 (This line will be automatically updated to reflect the latest version)

## History

Expand Down
1 change: 1 addition & 0 deletions nb-configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ That way multiple projects can share the same settings (useful for formatting ru
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
<netbeans.compile.on.save>none</netbeans.compile.on.save>
<org-netbeans-modules-maven-j2ee.netbeans_2e_deploy_2e_on_2e_save>false</org-netbeans-modules-maven-j2ee.netbeans_2e_deploy_2e_on_2e_save>

</properties>
Expand Down
2 changes: 0 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.divudi</groupId>

<artifactId>sethma</artifactId>

<version>3.0.0</version>
<packaging>war</packaging>
<name>sethma</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.divudi.data.PaymentMethodValues;
import com.divudi.data.ReportTemplateRow;
import com.divudi.data.ReportTemplateRowBundle;
import com.divudi.entity.WebUser;
import com.divudi.java.CommonFunctions;
import javax.inject.Named;
import javax.enterprise.context.SessionScoped;
Expand All @@ -35,6 +36,7 @@
import java.util.stream.Collectors;
import javax.ejb.EJB;
import javax.inject.Inject;
import javax.persistence.TemporalType;
import org.bouncycastle.mail.smime.handlers.pkcs7_mime;

/**
Expand Down Expand Up @@ -71,6 +73,7 @@ public class FinancialTransactionController implements Serializable {
private Payment removingPayment;
private List<Payment> currentBillPayments;
private List<Bill> currentBills;
private List<Bill> shiaftStartBills;
private List<Bill> fundTransferBillsToReceive;
private List<Bill> fundBillsForClosureBills;
private Bill selectedBill;
Expand Down Expand Up @@ -124,6 +127,13 @@ public class FinancialTransactionController implements Serializable {
private double additions;

private int fundTransferBillsToReceiveCount;
private Date fromDate;
private Date toDate;

private Date fromDate;
private Date toDate;

private ReportTemplateRowBundle paymentSummaryBundle;

private Date fromDate;
private Date toDate;
Expand All @@ -149,6 +159,27 @@ public String navigateToCreateNewInitialFundBill() {
return "/cashier/initial_fund_bill?faces-redirect=true;";
}

public String navigateToListShiftEndSummaries() {
resetClassVariables();
shiaftStartBills = new ArrayList<>();
return "/cashier/initial_fund_bill_list?faces-redirect=true;";
}

public void listShiftStartBills() {
String jpql = "select b "
+ " from Bill b "
+ " where b.retired=:ret"
+ " and b.billTypeAtomic=:bta "
+ " and b.createdAt between :fd and :td "
+ " order by b.id ";
Map params = new HashMap<>();
params.put("ret", false);
params.put("bta", BillTypeAtomic.FUND_SHIFT_START_BILL);
params.put("fd", fromDate);
params.put("td", toDate);
shiaftStartBills = billFacade.findByJpql(jpql, params, TemporalType.TIMESTAMP);
}

public String navigateToFundTransferBill() {
resetClassVariables();
prepareToAddNewFundTransferBill();
Expand Down Expand Up @@ -565,6 +596,7 @@ public void processDayEndSummary() {
private void createPaymentSummery() {
System.out.println("createPaymentSummery");
System.out.println("paymentsFromShiftSratToNow = " + paymentsFromShiftSratToNow);

if (paymentsFromShiftSratToNow == null) {
return;
}
Expand All @@ -574,26 +606,85 @@ private void createPaymentSummery() {

for (Payment p : paymentsFromShiftSratToNow) {
System.out.println("p = " + p);

if (p == null || p.getBill() == null) {
continue; // Skip this iteration if p or p.getBill() is null
}

ReportTemplateRow row = new ReportTemplateRow();
row.setCategory(p.getBill().getCategory());
row.setBillTypeAtomic(p.getBill().getBillTypeAtomic());
row.setCreditCompany(p.getBill().getCreditCompany());
row.setToDepartment(p.getBill().getToDepartment());
row.setServiceType(p.getBill().getBillTypeAtomic().getServiceType());

if (p.getBill().getCategory() != null) {
row.setCategory(p.getBill().getCategory());
}

if (p.getBill().getBillTypeAtomic() != null) {
row.setBillTypeAtomic(p.getBill().getBillTypeAtomic());

if (p.getBill().getBillTypeAtomic().getServiceType() != null) {
row.setServiceType(p.getBill().getBillTypeAtomic().getServiceType());
}
}

if (p.getBill().getCreditCompany() != null) {
row.setCreditCompany(p.getBill().getCreditCompany());
}

if (p.getBill().getToDepartment() != null) {
row.setToDepartment(p.getBill().getToDepartment());
}

row.setRowValue(p.getPaidValue());

String keyString = row.getCustomKey();
keyMap.putIfAbsent(keyString, row);
aggregatedPayments.merge(keyString, p.getPaidValue(), Double::sum);

if (keyString != null) {
keyMap.putIfAbsent(keyString, row);
aggregatedPayments.merge(keyString, p.getPaidValue(), Double::sum);
}

}

List<ReportTemplateRow> rows = aggregatedPayments.entrySet().stream().map(entry -> {
ReportTemplateRow row = keyMap.get(entry.getKey());
row.setRowValue(entry.getValue());

if (row != null) {
row.setRowValue(entry.getValue());
}

return row;
}).collect(Collectors.toList());

paymentSummaryBundle.getReportTemplateRows().addAll(rows);
if (paymentSummaryBundle != null) {
paymentSummaryBundle.getReportTemplateRows().addAll(rows);
}
}

public String navigateToViewEndOfSelectedShiftStartSummaryBill(Bill startBill) {
resetClassVariables();
if (startBill == null) {
JsfUtil.addErrorMessage("No Start Bill");
return null;
}
nonClosedShiftStartFundBill = startBill;
fillPaymentsFromShiftStartToNow(startBill, startBill.getCreater());
return "/cashier/shift_end_summery_bill_of_selected_user_not_closed?faces-redirect=true";
}

public String navigateToViewStartToEndOfSelectedShiftStartSummaryBill(Bill startBill) {
resetClassVariables();
if (startBill == null) {
JsfUtil.addErrorMessage("No Start Bill");
return null;
}
Bill endBill;
if (startBill.getReferenceBill() == null) {
JsfUtil.addErrorMessage("No Start Bill");
return null;
}
endBill = startBill.getReferenceBill();
nonClosedShiftStartFundBill = startBill;
fillPaymentsFromShiftStartToEnd(startBill, endBill, startBill.getCreater());
return "/cashier/shift_end_summery_bill_of_selected_user_not_closed?faces-redirect=true";
}

public String navigateToCreateShiftEndSummaryBillByBills() {
Expand Down Expand Up @@ -644,20 +735,62 @@ public void fillPaymentsFromShiftStartToNow() {

}

public void fillPaymentsForDateRange() {
System.out.println("fillPaymentsForDateRange");
public void fillPaymentsFromShiftStartToNow(Bill startBill, WebUser user) {
paymentsFromShiftSratToNow = new ArrayList<>();
if (startBill == null) {
JsfUtil.addErrorMessage("No Start Bill");
return;
}
if (user == null) {
JsfUtil.addErrorMessage("No User");
return;
}
Long shiftStartBillId = startBill.getId();
String jpql = "SELECT p "
+ "FROM Payment p "
+ "WHERE p.bill.retired <> :ret "
+ "AND p.bill.createdAt between :fd and :td "
+ "WHERE p.creater = :cr "
+ "AND p.retired = :ret "
+ "AND p.id > :cid "
+ "ORDER BY p.id DESC";
Map<String, Object> m = new HashMap<>();
m.put("fd", getFromDate());
m.put("td", getToDate());
m.put("ret", true);
System.out.println("m = " + m);
System.out.println("jpql = " + jpql);
m.put("cr", user);
m.put("ret", false);
m.put("cid", shiftStartBillId);
paymentsFromShiftSratToNow = paymentFacade.findByJpql(jpql, m);
atomicBillTypeTotalsByPayments = new AtomicBillTypeTotals();
for (Payment p : paymentsFromShiftSratToNow) {
if (p.getBill().getBillTypeAtomic() == null) {
} else {
atomicBillTypeTotalsByPayments.addOrUpdateAtomicRecord(p.getBill().getBillTypeAtomic(), p.getPaymentMethod(), p.getPaidValue());
}
}
financialReportByPayments = new FinancialReport(atomicBillTypeTotalsByPayments);
}

public void fillPaymentsFromShiftStartToEnd(Bill startBill, Bill endBill, WebUser user) {
paymentsFromShiftSratToNow = new ArrayList<>();
if (startBill == null) {
JsfUtil.addErrorMessage("No Start Bill");
return;
}
if (user == null) {
JsfUtil.addErrorMessage("No User");
return;
}
Long shiftStartBillId = startBill.getId();
Long shiftEndBillId = endBill.getId();
String jpql = "SELECT p "
+ "FROM Payment p "
+ "WHERE p.creater = :cr "
+ "AND p.retired = :ret "
+ "AND p.id > :sid "
+ "AND p.id < :eid "
+ "ORDER BY p.id DESC";
Map<String, Object> m = new HashMap<>();
m.put("cr", user);
m.put("ret", false);
m.put("sid", shiftStartBillId);
m.put("eid", shiftEndBillId);
paymentsFromShiftSratToNow = paymentFacade.findByJpql(jpql, m);
atomicBillTypeTotalsByPayments = new AtomicBillTypeTotals();
for (Payment p : paymentsFromShiftSratToNow) {
Expand Down Expand Up @@ -1482,5 +1615,12 @@ public ReportTemplateRowBundle getPaymentSummaryBundle() {
public void setPaymentSummaryBundle(ReportTemplateRowBundle paymentSummaryBundle) {
this.paymentSummaryBundle = paymentSummaryBundle;
}
public List<Bill> getShiaftStartBills() {
return shiaftStartBills;
}

public void setShiaftStartBills(List<Bill> shiaftStartBills) {
this.shiaftStartBills = shiaftStartBills;
}

}
Loading

0 comments on commit fd2b31d

Please sign in to comment.