Add files via upload

This commit is contained in:
gopi17701 2018-07-18 16:08:48 -04:00 committed by GitHub
parent 28e43377ee
commit fb1a27e450
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 22 deletions

View File

@ -1,13 +1,17 @@
package com.astute.dao; package com.astute.dao;
import com.astute.exceptions.AstuteException;
import com.astute.exceptions.AstuteException; import com.astute.exceptions.AstuteException;
import com.astute.model.*; import com.astute.model.*;
import java.io.*; import java.io.File;
import java.sql.*; import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.Date; import java.sql.Date;
import java.util.*; import java.sql.ResultSet;
import java.util.List;
import java.util.Properties;
public abstract class DAO { public abstract class DAO {
public static DAO dao; public static DAO dao;
@ -94,11 +98,11 @@ public abstract class DAO {
public abstract void updatePOMaster(String PONum, String contractNum, java.sql.Date PODate, Double contractAmt) throws AstuteException; public abstract void updatePOMaster(String PONum, String contractNum, java.sql.Date PODate, Double contractAmt) throws AstuteException;
public abstract void updatePODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, int serviceTypeId, String schedule, java.sql.Date deiverBy) throws AstuteException; public abstract void updatePODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, int serviceTypeId) throws AstuteException;
public abstract void createPOMaster(String PONum, String contractNum, java.sql.Date PODate, Double contractAmt, int customerId) throws AstuteException; public abstract void createPOMaster(String PONum, String contractNum, java.sql.Date PODate, Double contractAmt, int customerId) throws AstuteException;
public abstract void createPODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, int serviceTypeId, String schedule, java.sql.Date deiverBy) throws AstuteException; public abstract void createPODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, int serviceTypeId) throws AstuteException;
public abstract List<Invoice> getInvoiceMaster(String invoiceNumber, int pmtStatus) throws AstuteException; public abstract List<Invoice> getInvoiceMaster(String invoiceNumber, int pmtStatus) throws AstuteException;
@ -144,5 +148,10 @@ public abstract class DAO {
public abstract int createChangeOrder(String poNum, int changeOrderNum, double changeOrderAmt, Date changeOrderDate, String description) throws AstuteException; public abstract int createChangeOrder(String poNum, int changeOrderNum, double changeOrderAmt, Date changeOrderDate, String description) throws AstuteException;
public abstract List<InvoicePayment> getInvoicePayments(String invoiceNum) throws AstuteException;
public abstract void updateInvoicePayment(String invoiceNum, int invoicePaymentId, Double paymentAmount, Date paymentDate) throws AstuteException;
public abstract void createInvoicePayment(String invoiceNum, int invoicePaymentTypeId, Double paymentAmount, Date paymentDate) throws AstuteException;
} }

View File

@ -1,8 +1,6 @@
package com.astute.dao; package com.astute.dao;
import com.astute.exceptions.AstuteException; import com.astute.exceptions.AstuteException;
import com.astute.exceptions.AstuteException;
import com.astute.model.*; import com.astute.model.*;
import javax.crypto.SecretKeyFactory; import javax.crypto.SecretKeyFactory;
@ -13,7 +11,6 @@ import java.security.SecureRandom;
import java.security.spec.InvalidKeySpecException; import java.security.spec.InvalidKeySpecException;
import java.sql.*; import java.sql.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@ -75,7 +72,7 @@ public class SqlDAO extends DAO {
Statement stmt = conn.createStatement(); Statement stmt = conn.createStatement();
String whereClause = " WHERE "; String whereClause = " WHERE ";
boolean whereClauseCriteria = false; boolean whereClauseCriteria = false;
String sql = "SELECT PO_num, line_item_no, service_desc, fee_type_id, qty, service_type_id, get_remaining_qty(PO_num, line_item_no) as get_remaining_qty FROM PO_DETAIL "; String sql = "SELECT PO_num, line_item_no, service_desc, fee_type_id, qty, service_type_id, get_remaining_qty_fun(PO_num, line_item_no) as get_remaining_qty FROM PO_DETAIL ";
if (PONum != null) { if (PONum != null) {
whereClause = whereClause + " UPPER(PO_num) = '" + PONum.toUpperCase() + "'"; whereClause = whereClause + " UPPER(PO_num) = '" + PONum.toUpperCase() + "'";
whereClauseCriteria = true; whereClauseCriteria = true;
@ -152,7 +149,7 @@ public class SqlDAO extends DAO {
} }
public void updatePODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, int serviceTypeId, String schedule, Date deiverBy) throws AstuteException { public void updatePODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, int serviceTypeId) throws AstuteException {
try { try {
String sql = "UPDATE PO_DETAIL "; String sql = "UPDATE PO_DETAIL ";
String updateClause = " SET "; String updateClause = " SET ";
@ -177,13 +174,6 @@ public class SqlDAO extends DAO {
if (serviceTypeId > 0) { if (serviceTypeId > 0) {
updateClause += " service_type_id = " + serviceTypeId + ","; updateClause += " service_type_id = " + serviceTypeId + ",";
} }
if (schedule != null && !schedule.isEmpty()) {
updateClause += " schedule = '" + schedule + "',";
}
if (deiverBy != null) {
updateClause += " deiver_by = " + deiverBy;
}
if (!updateClause.equalsIgnoreCase(" SET ")) { if (!updateClause.equalsIgnoreCase(" SET ")) {
sql = sql + trimLastCharacter(updateClause, ",") + whereClause; sql = sql + trimLastCharacter(updateClause, ",") + whereClause;
@ -214,19 +204,17 @@ public class SqlDAO extends DAO {
} }
} }
public void createPODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, int serviceTypeId, String schedule, Date deiverBy) throws AstuteException { public void createPODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, int serviceTypeId) throws AstuteException {
try { try {
System.out.println("Calling create_po_detail Procedure"); System.out.println("Calling create_po_detail Procedure");
System.out.println("POnum is " + POnum); System.out.println("POnum is " + POnum);
CallableStatement stmt = conn.prepareCall("{call create_po_detail(?,?,?,?,?,?,?,?)}"); CallableStatement stmt = conn.prepareCall("{call create_po_detail(?,?,?,?,?,?)}");
stmt.setString(1, POnum); stmt.setString(1, POnum);
stmt.setInt(2, lineItemNo); stmt.setInt(2, lineItemNo);
stmt.setString(3, serviceDesc); stmt.setString(3, serviceDesc);
stmt.setInt(4, feeTypeId); stmt.setInt(4, feeTypeId);
stmt.setDouble(5, qty); stmt.setDouble(5, qty);
stmt.setInt(6, serviceTypeId); stmt.setInt(6, serviceTypeId);
stmt.setString(7, schedule);
stmt.setDate(8, deiverBy);
stmt.executeUpdate(); stmt.executeUpdate();
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();