Esempio n. 1
0
  public int e_voucher_entry(
      String paid_to_name,
      String reason_paid_amount,
      String payment_type,
      String cash_cheque_no,
      float cash_cheque_amount,
      Object sysdate1,
      String prepare_by)
      throws SQLException {

    Connection con = null;
    Statement stmt = null;
    int rs = 0;
    String prepare_by1 = prepare_by;

    String empDataAry[] = prepare_by1.split("\\@");
    String prepared_by = empDataAry[0];

    // String sysdate="sysdate";
    Date date = new Date();
    SimpleDateFormat sdf;
    sdf = new SimpleDateFormat("dd/MMM/yyyy");
    Object creation_date = sdf.format(date);
    System.out.println(creation_date);

    String e_voucher_entry_qry =
        "insert into E_VOUCHER(PAID_TO,REASON_TO_PAY,PAYMENT_TYPE,CASH_OR_CHECK_NO,AMOUNT,ENTER_DATE,PREPARED_BY,in_date) "
            + " VALUES ('"
            + paid_to_name
            + "','"
            + reason_paid_amount
            + "','"
            + payment_type
            + "','"
            + cash_cheque_no
            + "','"
            + cash_cheque_amount
            + "','"
            + sysdate1
            + "','"
            + prepared_by
            + "','"
            + creation_date
            + "')";

    System.out.println("e_voucher_entry_qry.." + e_voucher_entry_qry);
    try {
      con = GetConnection.getConnection();
      stmt = con.createStatement();

      rs = stmt.executeUpdate(e_voucher_entry_qry);

      // System.out.println("calling pdf");

      if (rs > 0) {
        // System.out.println("Result set of the  in e voucher:::::"+rs);

      } else {

        // e_voucher_ret="not saved";
      }

    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      stmt.close();
      con.close();
    }

    return rs;
  }
Esempio n. 2
0
  public ArrayList<String> getting_data_voucher() throws SQLException {
    ArrayList<String> voucher = new ArrayList<String>();
    Connection con_ph3 = null;
    Statement st_ph3 = null;
    ResultSet rs_ph32 = null;

    String fetch_phase3_sql =
        "select v.VOUCHER_NO ,v.PAID_TO ,v.REASON_TO_PAY ,v.PAYMENT_TYPE ,v.CASH_OR_CHECK_NO ,v.AMOUNT ,"
            + "v.ENTER_DATE ,v.PREPARED_BY ,v.IN_DATE from E_VOUCHER v  where v.VOUCHER_NO in (select max( VOUCHER_NO) from E_VOUCHER e1)";

    /*String fetch_phase3_sql="select v.VOUCHER_NO ,v.EMP_NAME ,v.REASON_TO_PAY ,v.PAYMENT_TYPE ,v.CASH_OR_CHECK_NO ,v.AMOUNT ,"
    + "v.ENTER_DATE ,v.PREPARED_BY ,v.IN_DATE from E_VOUCHER v where VOUCHER_NO=1 ";*/

    int voucher_no = 0;
    String emp_name = "";
    String reason_to_pay = "";
    String payment_type = "";

    String cheque_no = "";
    int amount = 0;
    Date enter_date;
    String prepared_by = "";

    Date sys_date;
    String final_data;

    try {
      con_ph3 = GetConnection.getConnection();
      st_ph3 = con_ph3.createStatement();
      rs_ph32 = st_ph3.executeQuery(fetch_phase3_sql);
      while (rs_ph32.next()) {

        voucher_no = rs_ph32.getInt(1);
        emp_name = rs_ph32.getString(2);
        reason_to_pay = rs_ph32.getString(3);
        payment_type = rs_ph32.getString(4);

        cheque_no = rs_ph32.getString(5);
        if (cheque_no == null) {

          cheque_no = " ";
        }
        amount = rs_ph32.getInt(6);
        enter_date = rs_ph32.getDate(7);
        prepared_by = rs_ph32.getString(8);

        sys_date = rs_ph32.getDate(9);
        System.out.println("cheque no." + cheque_no);

        final_data =
            voucher_no
                + "^"
                + emp_name
                + "^"
                + reason_to_pay
                + "^"
                + payment_type
                + "^"
                + cheque_no
                + "^"
                + amount
                + "^"
                + enter_date
                + "^"
                + prepared_by
                + "^"
                + sys_date;
        voucher.add(final_data);
      }

    } catch (Exception e) {
      System.out.println("problem for geeting values e voucher");
      e.printStackTrace();
    } finally {
      rs_ph32.close();
      st_ph3.close();
      con_ph3.close();
    }
    return voucher;
  }