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
BigDecimal exrate = null;
BigDecimal price = null;
BigDecimal discount = null;
if (A_Value != null && A_Field.getColumnName().equals("匯率") )
{
exrate = (BigDecimal) A_Value;
price = A_Tab.getValue("原幣進貨金額");
discount = A_Tab.getValue("原幣扣款金額");
}
if (A_Value != null && A_Field.getColumnName().equals("原幣進貨金額") )
{
price = (BigDecimal) A_Value;
exrate = A_Tab.getValue("匯率");
discount = A_Tab.getValue("原幣扣款金額");
}
if (A_Value != null && A_Field.getColumnName().equals("原幣扣款金額") )
{
discount = (BigDecimal) A_Value;
exrate = A_Tab.getValue("匯率");
price = A_Tab.getValue("原幣進貨金額");
}
if (price != null )
{
if (exrate==null) exrate = new BigDecimal(1);
BigDecimal tprice = price.multiply(exrate);
BigDecimal tdiscount = discount.multiply(exrate) ;
A_Tab.setValue("本幣進貨金額", tprice );
A_Tab.setValue("本幣扣款金額", tdiscount );
}else{
A_Tab.setValue("本幣進貨金額", null);
A_Tab.setValue("本幣扣款金額", null);
}
result=""
沒有留言:
張貼留言