Now there are different products with different calculation formulas, such as product A, the calculation formula is: quantity X duration X unit price. Product B: unit price * quantity.
Please store the calculation formula and match it by yourself.
怪我咯2017-06-08 11:04:08
$math = '%s*%s';
$str = sprintf($math, 5, 6);
$result=eval("return $str;");
var_dump($result);
typecho2017-06-08 11:04:08
Give each product a flag directly, and then save the company in turn. When matching, you only need to match the flag to find the formula.
淡淡烟草味2017-06-08 11:04:08
Constructor, determines the execution content based on the parameters passed in
扔个三星炸死你2017-06-08 11:04:08
select 商品A "商品名", 数量X时长X单价 "总计"
from table
where 商品=商品A
union all
select 商品B "商品名", 数量X单价 "总计"
from table
where 商品=商品B
If it is product A
select 商品B "商品名", 数量X单价 "总计"
from table
where 商品=商品B
No result will be returned