<?xml version="1.0" encoding="utf-8" ?>
<select>
  <selectstr>
SELECT u_semi_finished_product_mx.billid
	,u_semi_finished_product_mx.printid
	,u_semi_finished_product_mx.mtrlid
	,u_semi_finished_product_mx.formulaid
	,u_semi_finished_product_mx.chastr
	,u_semi_finished_product_mx.thickness
	,u_semi_finished_product_mx.qty
	,u_semi_finished_product_mx.erp_mtrlid
	,u_semi_finished_product_mx.usenum
	,u_semi_finished_product_mx.usedenom
	,ISNULL(u_mtrl_price.name,'') AS mtrlname
	,u_mattress_formula.if_mtrl
	,u_mattress_formula.formula
	,u_mattress_formula.formulatype
	,u_mattress_formula.formulakind
FROM u_semi_finished_product_mx
LEFT OUTER JOIN u_mtrl_price ON u_semi_finished_product_mx.mtrlid = u_mtrl_price.mtrlid
INNER JOIN u_mattress_formula ON u_semi_finished_product_mx.formulaid = u_mattress_formula.formulaid
  </selectstr>
  <where>
	<when notnull="@billid">
		u_semi_finished_product_mx.billid = @billid
	</when>
  </where>
  <displayfields>
    <field field="pid" compute="getrow()">序</field>
    <field field="chastr">位置</field>
    <field field="formula">公式名</field>
    <field field="if_mtrl">按物料</field>
    <field field="thickness">厚度</field>
    <field field="mtrlname">核价物料</field>
    <field field="qty">数量/长度</field>
    <field field="usenum">用量分子</field>
    <field field="usedenom">用量分母</field>
  </displayfields>
</select>