Example #1
0
 // 查询纳税户领购发票信息
 public ArrayList selectFplg(String sqlStr) {
   ArrayList al = null;
   Connection conn = null;
   try {
     conn = DBConnection.getConnection();
     if (conn != null) {
       String sql =
           "select a.*,b.FPMC,c.NSRMC from SKQ_FPJMX a left outer join SKQ_FP b on a.FPBM=b.FPBM left outer join SKQ_NSRXX c on a.NSRWJBM=c.NSRWJBM where 1=1 and a.SID in("
               + sqlStr
               + ") order by a.fpqsh DESC";
       PreparedStatement ps = conn.prepareStatement(sql);
       ResultSet rs = ps.executeQuery();
       al = new ArrayList();
       while (rs.next()) {
         Fpjmx fpjmx = new Fpjmx();
         fpjmx.setSid(rs.getInt("SID"));
         fpjmx.setNsrwjbm(rs.getString("NSRWJBM"));
         fpjmx.setNsrmc(Util.iso8859togbk(rs.getString("NSRMC")));
         fpjmx.setFpbm(rs.getString("FPBM"));
         fpjmx.setFpmc(Util.iso8859togbk(rs.getString("FPMC")));
         fpjmx.setFpdm(rs.getString("FPDM"));
         fpjmx.setFpqsh(rs.getInt("FPQSH"));
         fpjmx.setFpjzh(rs.getInt("FPJZH"));
         fpjmx.setFpdw(rs.getInt("FPDW"));
         fpjmx.setJqbh(rs.getString("JQBH"));
         fpjmx.setFpxfzt(rs.getInt("FPXFZT"));
         fpjmx.setFplgzt(rs.getInt("FPLGZT"));
         fpjmx.setMxsczt(rs.getInt("MXSCZT"));
         fpjmx.setFpzs(rs.getInt("FPJZH") + 1 - rs.getInt("FPQSH"));
         fpjmx.setFplgrq(rs.getString("FPLGRQ").substring(0, 10));
         String sql1 =
             "select top 1 * from SKQ_FPKJ where FPDM='"
                 + Util.zerosFront(rs.getString("FPDM"), 20)
                 + "' and JQBH='"
                 + fpjmx.getJqbh()
                 + "' and FPHM>="
                 + rs.getInt("FPQSH")
                 + " and"
                 + " FPHM<="
                 + rs.getInt("FPJZH")
                 + " order by FPHM DESC";
         System.out.println("sql1==" + sql1);
         int hasUsed = 0;
         int fpjzhm = Query.getFieldInt(sql1, "FPHM"); // 发票截至号码
         System.out.println(fpjzhm);
         if (fpjzhm == 0) {
           hasUsed = 0;
         } else {
           hasUsed = fpjzhm + 1 - fpjmx.getFpqsh();
         }
         fpjmx.setHasUsed(hasUsed);
         al.add(fpjmx);
       }
       rs.close();
       ps.close();
     }
   } catch (SQLException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } finally {
     if (conn != null) {
       try {
         conn.close();
       } catch (SQLException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
       }
     }
   }
   return al;
 }
Example #2
0
  // 查询纳税人信息及机器信息
  public ArrayList selectNsrxx() {
    Connection conn = null;
    ArrayList al = null;

    try {
      conn = DBConnection.getConnection();
      if (conn != null) {
        String sql = "select * from SERVER_TAXPAYER_USER";
        // System.out.println("sql=="+sql);
        PreparedStatement ps = conn.prepareStatement(sql);
        ResultSet rs = ps.executeQuery();
        al = new ArrayList();
        while (rs.next()) {
          HashMap hm = new HashMap();
          hm.put("sn", rs.getString("SN"));
          hm.put("nsrwjbm", rs.getString("CODE"));
          hm.put("nsrsbh", rs.getString("NO"));
          hm.put("nsrmc", rs.getString("NAME"));
          hm.put("jydz", rs.getString("ADDR"));
          hm.put("frdb", rs.getString("CORPORATION"));
          hm.put("zclxbm", "1");
          hm.put("hybm", "1");
          hm.put("hymxbm", "1");
          hm.put("zsfs", 0);
          hm.put("yhde", 0);
          hm.put("swjgbm", "00000001");
          al.add(hm);
        }
        rs.close();
        ps.close();
        // conn.close();
        if (al != null && !al.isEmpty()) {
          Iterator it = al.iterator();
          while (it.hasNext()) {
            HashMap hm = (HashMap) it.next();
            String sn = (String) hm.get("sn");
            String nsrwjbm = (String) hm.get("nsrwjbm");

            // 纳税人税种税目
            ArrayList alszsm = this.selectSzsm();
            hm.put("alNsrszsm", alszsm);

            sql =
                "select a.*,b.NO as smsy1,c.NO as smsy2,d.NO as smsy3,e.NO as smsy4,f.NO as smsy5,g.NO as smsy6 from SERVER_TAXPAYER_FISCAL a left outer join SERVER_TAXITEM b on a.INDEX_1=b.[INDEX] left outer join SERVER_TAXITEM c on a.INDEX_2=c.[INDEX] left outer join SERVER_TAXITEM d on a.INDEX_3=d.[INDEX] left outer join SERVER_TAXITEM e on a.INDEX_4=e.[INDEX] left outer join SERVER_TAXITEM f on a.INDEX_5=f.[INDEX] left outer join SERVER_TAXITEM g on a.INDEX_6=g.[INDEX] where a.USER_SN = '"
                    + sn
                    + "'";
            System.out.println("sql111==" + sql);
            ps = conn.prepareStatement(sql);
            rs = ps.executeQuery();
            ArrayList alJqxx = new ArrayList();
            String smbmStr = "";
            String jqbhStr = ",";
            while (rs.next()) {
              HashMap hm1 = new HashMap();

              String kpjzrq = Util.tobzrq(rs.getString("MAKE_END_DATE"));
              double dzkpxe = rs.getDouble("MAKE_MAX_SINGLE") / 100;
              double yljkpxe = rs.getDouble("MAKE_MAX_SUM") / 100;
              if (yljkpxe < 0) {
                yljkpxe = 42000000;
              }
              if (dzkpxe < 0) {
                dzkpxe = 42000000;
              }
              double yljtpxe = rs.getDouble("BACK_MAX_SUM") / 100;
              if (yljtpxe < 0) {
                yljtpxe = 42000000;
              }

              String smsy1 = rs.getString("smsy1");
              String smsy2 = rs.getString("smsy2");
              String smsy3 = rs.getString("smsy3");
              String smsy4 = rs.getString("smsy4");
              String smsy5 = rs.getString("smsy5");
              String smsy6 = rs.getString("smsy6");
              String skkh = rs.getString("FISCAL_CARD_NO");
              String jqbh = rs.getString("MACHINE_NO");
              String yhkh = rs.getString("FISCAL_CARD_NO");
              String jqxhbm = "1";
              String kqyrq = Util.tobzrq(rs.getString("START_DATE"));
              String kyxrq = Util.tobzrq(rs.getString("END_DATE"));
              String mxsbbz = rs.getString("DECLARE_MAKE_TYPE");
              String sbfs = rs.getString("DECLARE_TYPE");

              if (jqbhStr.indexOf(jqbh) >= 0) {

              } else {
                jqbhStr = jqbhStr + "," + jqbh;
                hm1.put("nsrwjbm", nsrwjbm);
                hm1.put("kpjzrq", kpjzrq);
                hm1.put("dzkpxe", dzkpxe);
                hm1.put("yljkpxe", yljkpxe);
                hm1.put("yljtpxe", yljtpxe);
                hm1.put("smsy1", smsy1);
                hm1.put("smsy2", smsy2);
                hm1.put("smsy3", smsy3);
                hm1.put("smsy4", smsy4);
                hm1.put("smsy5", smsy5);
                hm1.put("smsy6", smsy6);
                hm1.put("skkh", skkh);
                hm1.put("jqbh", jqbh);
                hm1.put("yhkh", yhkh);
                hm1.put("jqxhbm", jqxhbm);
                hm1.put("kqyrq", kqyrq);
                hm1.put("kyxrq", kyxrq);
                hm1.put("mxsbbz", mxsbbz);
                hm1.put("sbfs", sbfs);

                alJqxx.add(hm1);
              }
            }

            hm.put("alJqxx", alJqxx);
          }
        }
      }

    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } finally {
      if (conn != null) {
        try {
          conn.close();
        } catch (SQLException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      }
    }
    return al;
  }