groovy:銷退單拉客戶資料
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 a.\"客戶全名\", a.\"客戶英文全名\",b.\"統一編號\",b.\"聯絡人\",b.\"客戶送貨地址\",c.\"稅別碼_id\" FROM \"客戶\" a LEFT OUTER JOIN \"客戶註記\" b ON a.\"客戶_id\"=b.\"客戶_id\" LEFT OUTER JOIN \"客戶交易註記\" c ON a.\"客戶_id\"=c.\"客戶_id\" WHERE a.\"客戶_id\"=? ";
PreparedStatement pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, id);
ResultSet rs = pstmt.executeQuery();
// 只作 1筆 if (rs.next()) {
if (rs.next()) {
if (rs.getString("客戶全名") != null) A_Tab.setValue("客戶全名",rs. getString ("客戶全名"));
if (rs.getString("客戶英文全名") != null) A_Tab.setValue("客戶英文全名",rs. getString ("客戶英文全名"));
if (rs.getString("統一編號") != null) A_Tab.setValue("統一編號",rs. getString ("統一編號"));
if (rs.getInt("稅別碼_id") > 0) A_Tab.setValue("稅別碼_id",new Integer(rs.getInt("稅別碼_id")));
if (rs.getString("聯絡人") != null) A_Tab.setValue("聯絡人",rs. getString ("聯絡人"));
if (rs.getString("客戶送貨地址") != null) A_Tab.setValue("取貨地址",rs. getString ("客戶送貨地址"));
}
rs.close();
pstmt.close();
}
result=""
沒有留言:
張貼留言