groovy: 報價單明細_ID帶出報價單明細資料
Callout
=================================
import java.sql.Timestamp
import java.math.BigDecimal
import java.sql.PreparedStatement
import java.sql.ResultSet
import org.compiere.util.DB
import org.compiere.model.MUser
//@script:groovy:getQuotationForOrder
if (A_Value != null )
{
int id = ((Integer) A_Value).intValue();
String sql ="SELECT \"品號_id\", \"數量\",\"贈品量\",\"單價\",\"折扣率\" FROM \"報價單明細\" WHERE \"報價單明細_id\"=? ";
PreparedStatement pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, id);
ResultSet rs = pstmt.executeQuery();
// 只作 1筆 while (rs.next()){
if (rs.next()) {
if (rs.getInt("品號_id") > 0) A_Tab.setValue("品號_id",new Integer(rs.getInt("品號_id")));
if (rs.getBigDecimal ("數量") != null) A_Tab.setValue("數量",rs.getBigDecimal ("數量"));
if (rs.getBigDecimal ("贈品量") != null) A_Tab.setValue("贈品量",rs.getBigDecimal ("贈品量"));
if (rs.getBigDecimal ("單價") != null) A_Tab.setValue("單價",rs.getBigDecimal ("單價"));
if (rs.getBigDecimal ("折扣率") != null) A_Tab.setValue("折扣率",rs.getBigDecimal ("折扣率"));
}
rs.close();
pstmt.close();
}
result=""
沒有留言:
張貼留言