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
BigDecimal price = null;
BigDecimal taxrate = null;
if (A_Value != null && A_Field.getColumnName().equals("訂單金額") )
{
price = (BigDecimal) A_Value;
taxrate = A_Tab.getValue("營業稅率");
}
if (A_Value != null && A_Field.getColumnName().equals("營業稅率") )
{
taxrate = (BigDecimal) A_Value;
price = A_Tab.getValue("訂單金額");
}
if (price != null)
{
if (taxrate ==null) disrate = new BigDecimal(0);
taxrate = (taxrate.divide(new BigDecimal(100)));
BigDecimal amt = price.multiply(taxrate);
A_Tab.setValue("稅額", amt);
}else{
A_Tab.setValue("稅額", null);
}
result=""
沒有留言:
張貼留言