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\", \"廠別_id\",\"採購人員_id\",\"幣別_id\",\"稅別碼_id\", \"訂金比率\",\"營業稅率\",\"送貨地址\",\"聯絡人\",\"交易條件_id\",\"付款條件_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.getInt("廠別_id") > 0) A_Tab.setValue("廠別_id",new Integer(rs.getInt("廠別_id")));
if (rs.getInt("採購人員_id") > 0) A_Tab.setValue("採購人員_id",new Integer(rs.getInt("採購人員_id")));
if (rs.getInt("幣別_id") > 0) A_Tab.setValue("幣別_id",new Integer(rs.getInt("幣別_id")));
if (rs.getInt("稅別碼_id") > 0) A_Tab.setValue("稅別碼_id",new Integer(rs.getInt("稅別碼_id")));
if (rs.getInt("交易條件_id") > 0) A_Tab.setValue("交易條件_id",new Integer(rs.getInt("交易條件_id")));
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.getString("送貨地址") != null) A_Tab.setValue("送貨地址",rs. getString ("送貨地址"));
if (rs.getString("聯絡人") != null) A_Tab.setValue("聯絡人",rs. getString ("聯絡人"));
}
rs.close();
pstmt.close();
}
result=""
沒有留言:
張貼留言