Solving GL issue
This commit is contained in:
parent
580e52b7ef
commit
57e872df6d
@ -66,7 +66,7 @@ public class TDS_Calculation {
|
|||||||
+ "DA.INTT_PAID,DP.PROD_CODE,DA.INTT_SOP_DATE,DA.INTT_EOP_DATE,DA.TERM_VALUE,DA.MAT_VALUE,DA.MAT_DT,DA.TERM_LENGTH,\n"
|
+ "DA.INTT_PAID,DP.PROD_CODE,DA.INTT_SOP_DATE,DA.INTT_EOP_DATE,DA.TERM_VALUE,DA.MAT_VALUE,DA.MAT_DT,DA.TERM_LENGTH,\n"
|
||||||
+ "DA.NXT_DUE_DATE,DA.INTT_PROJECTED,dp.INTT_PAYOUT_FREQ FROM DEP_ACCOUNT DA ,dep_product dp\n"
|
+ "DA.NXT_DUE_DATE,DA.INTT_PROJECTED,dp.INTT_PAYOUT_FREQ FROM DEP_ACCOUNT DA ,dep_product dp\n"
|
||||||
+ "where DA.DEP_PROD_ID=dp.ID and substr(dp.prod_code,1,1) in ('2','3') and substr(DA.GL_CLASS_CODE,9,2)='14'\n"
|
+ "where DA.DEP_PROD_ID=dp.ID and substr(dp.prod_code,1,1) in ('2','3') and substr(DA.GL_CLASS_CODE,9,2)='14'\n"
|
||||||
+ "and DA.CURR_STATUS ='O' and DA.PACS_ID in ('07190') group by DA.KEY_1,DA.PACS_ID,DA.CURR_STATUS,DA.CUSTOMER_NO,DA.ACCT_OPEN_DT,\n"
|
+ "and DA.CURR_STATUS ='O' and DA.PACS_ID in ('07544') group by DA.KEY_1,DA.PACS_ID,DA.CURR_STATUS,DA.CUSTOMER_NO,DA.ACCT_OPEN_DT,\n"
|
||||||
+ "DA.INTT_PAID,DA.INTT_SOP_DATE,DA.INTT_EOP_DATE,DA.TERM_VALUE,DA.MAT_VALUE,DA.MAT_DT,DA.TERM_LENGTH,\n"
|
+ "DA.INTT_PAID,DA.INTT_SOP_DATE,DA.INTT_EOP_DATE,DA.TERM_VALUE,DA.MAT_VALUE,DA.MAT_DT,DA.TERM_LENGTH,\n"
|
||||||
+ "DA.NXT_DUE_DATE,DA.INTT_PROJECTED,dp.INTT_PAYOUT_FREQ,DP.PROD_CODE";
|
+ "DA.NXT_DUE_DATE,DA.INTT_PROJECTED,dp.INTT_PAYOUT_FREQ,DP.PROD_CODE";
|
||||||
PreparedStatement preparedStatement = conn.prepareStatement(depAccountSql);
|
PreparedStatement preparedStatement = conn.prepareStatement(depAccountSql);
|
||||||
@ -639,6 +639,7 @@ public class TDS_Calculation {
|
|||||||
Double end_bal = 0.0;
|
Double end_bal = 0.0;
|
||||||
Double cum_curr_val = 0.0;
|
Double cum_curr_val = 0.0;
|
||||||
Double tot_cr = 0.0;
|
Double tot_cr = 0.0;
|
||||||
|
Double transaction_amount = 0.0;
|
||||||
boolean rowUpdated = false;
|
boolean rowUpdated = false;
|
||||||
|
|
||||||
try (Connection conn = DriverManager.getConnection(URL, USERNAME, PASWORD)) {
|
try (Connection conn = DriverManager.getConnection(URL, USERNAME, PASWORD)) {
|
||||||
@ -668,7 +669,7 @@ public class TDS_Calculation {
|
|||||||
long randomNumberGeneration = randomNumberGenerator();
|
long randomNumberGeneration = randomNumberGenerator();
|
||||||
|
|
||||||
//Fetch the End Balance and cumm_val from gl_txn and gl_account
|
//Fetch the End Balance and cumm_val from gl_txn and gl_account
|
||||||
String fetchLastRowSql = "Select END_BAL from GL_TXN where ACCT_NO =? ORDER BY POST_TIME DESC FETCH first 1 ROW ONLY";
|
String fetchLastRowSql = "Select COALESCE(END_BAL,TXN_AMT) from GL_TXN where ACCT_NO =? ORDER BY POST_TIME DESC FETCH first 1 ROW ONLY";
|
||||||
|
|
||||||
PreparedStatement fetchpreparestatement = conn.prepareStatement(fetchLastRowSql);
|
PreparedStatement fetchpreparestatement = conn.prepareStatement(fetchLastRowSql);
|
||||||
|
|
||||||
@ -676,14 +677,20 @@ public class TDS_Calculation {
|
|||||||
|
|
||||||
ResultSet fetchrs = fetchpreparestatement.executeQuery();
|
ResultSet fetchrs = fetchpreparestatement.executeQuery();
|
||||||
|
|
||||||
while (fetchrs.next()) {
|
if (fetchrs.next()) {
|
||||||
end_bal = fetchrs.getDouble("END_BAL");
|
end_bal = fetchrs.getDouble("END_BAL");
|
||||||
|
transaction_amount = fetchrs.getDouble("TXN_AMT");
|
||||||
|
|
||||||
if (end_bal == null) {
|
System.out.println("end_bal is : " +end_bal);
|
||||||
end_bal = tds_amount;
|
|
||||||
} else {
|
if (end_bal == 0) {
|
||||||
|
end_bal = tds_amount+transaction_amount;
|
||||||
|
} else {
|
||||||
end_bal = end_bal + tds_amount;
|
end_bal = end_bal + tds_amount;
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
end_bal = transaction_amount;
|
||||||
|
System.out.println("No rows found. Setting end_bal to transaction_amount" + transaction_amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
String fetchCumVal = "Select cum_curr_val,tot_cr from gl_account where key_1 = ? and pacs_id = ? and gl_prod_id ='061340427'";
|
String fetchCumVal = "Select cum_curr_val,tot_cr from gl_account where key_1 = ? and pacs_id = ? and gl_prod_id ='061340427'";
|
||||||
@ -698,7 +705,7 @@ public class TDS_Calculation {
|
|||||||
cum_curr_val = fetchCumRs.getDouble("cum_curr_val");
|
cum_curr_val = fetchCumRs.getDouble("cum_curr_val");
|
||||||
tot_cr = fetchCumRs.getDouble("tot_cr");
|
tot_cr = fetchCumRs.getDouble("tot_cr");
|
||||||
|
|
||||||
if (cum_curr_val == null) {
|
if (cum_curr_val == 0) {
|
||||||
cum_curr_val = tds_amount;
|
cum_curr_val = tds_amount;
|
||||||
} else {
|
} else {
|
||||||
cum_curr_val = cum_curr_val + tds_amount;
|
cum_curr_val = cum_curr_val + tds_amount;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user