/**
   * 此方法用于查询付款单的头部信息 NOTE: real_pay: 表示实际应支付金额( 已扣除"补税差应付调整金额" 及 "电汇费" )
   *
   * @return XML element.
   * @throws SQLException
   * @throws IOException
   */
  public Element getHead() throws SQLException, IOException {
    String sql =
        " SELECT "
            + " p.sheetid,  b.bookname, b.booktitle,b.booklogofname,"
            + " p.venderid, v.vendername, vb.bankname, vb.accno bankaccno, p.finamt,"
            + " paymode.paymodename paymodename, p.payableamt, suspayamt,chequeamt,"
            + " p.chargeamt, p.planpaydate,p.TaxAmt17,p.TaxAmt13, "
            + " p.invtotalamt17,p.invtotalamt13,p.invtotalamt0,p.payamt, p.note, p.editor, p.editdate, '"
            + SqlUtil.toLocal(PayamtToChinese())
            + "' as real_pay FROM "
            + this.tab_head
            + " p "
            + " JOIN book b ON (b.bookno=p.payshopid) "
            + " LEFT JOIN paymode ON (p.paymodeid=paymode.paymodeid) "
            + " JOIN vender v ON (v.venderid=p.venderid) "
            + " LEFT JOIN vender_bank vb ON (vb.venderid=p.venderid) "
            + " WHERE sheetid = ? ";
    System.out.println(sql);
    PreparedStatement pstmt = conn.prepareStatement(sql);
    pstmt.setString(1, sheetid);
    ResultSet rs = pstmt.executeQuery();

    XResultAdapter adapter = new XResultAdapter(rs);
    Element elm_sheethead = adapter.getRowSetElement("head", "rows");
    rs.close();
    pstmt.close();
    return elm_sheethead;
  }
Exemple #2
0
  /**
   * 取打印的烟草公司名称
   *
   * @return
   */
  private void setPrintInfo() throws SQLException {
    String company = null;
    String shopid = null;
    int controltype = 0;
    int majorid = 0;
    // controltype 门店控制符合,MR公司用
    // 取得门店和课类,抬头公司
    String sql_sel_shop =
        "select a.shopid,a.sgroupid,s.controltype,s.shopname from purchase"
            + month
            + " a "
            + " inner join shop s on s.shopid=a.shopid "
            + " where sheetid=?";
    ResultSet rs = SqlUtil.queryPS(conn, sql_sel_shop, sheetid);
    if (rs.next()) {
      shopid = rs.getString("shopid") + "X";
      majorid = rs.getInt("sgroupid");
      controltype = rs.getInt("controltype");
      company = SqlUtil.toLocal(rs.getString("shopname"));
      // this.logo = rs.getString("booklogofname");
    }
    SqlUtil.close(rs);

    // 如果是烟草课类,则修改打印抬头和logo
    /*if( majorid == VSSConfig.getInstance().getTobatoMajorid() && !shopid.equals("") ){
    String sql_sel_headshopid = "select b.booktitle,b.booklogofname from shop s " +
    		" inner join book b on (b.bookno=s.bookno and s.shopstatus=1) " +
    		" where s.shopid=? ";*/
    String sql_sel_headshopid = "select s.shopname from shop s " + " where s.shopid=? ";
    rs = SqlUtil.queryPS(conn, sql_sel_headshopid, sheetid);
    if (rs.next()) {
      company = SqlUtil.toLocal(rs.getString("shopname"));
      // this.logo = rs.getString("booklogofname");
    }
    SqlUtil.close(rs);
    // 民润店
    /*}else if(controltype==2){
    	company="MR";
    	this.logo = VSSConfig.getInstance().getPrintTobatoLogo();
    }*/

    this.title = company + "订货通知单";
    this.logo = "../img/" + this.logo;
  }