<?xml version="1.0" encoding="utf-8" ?>
<select>
  <selectstr>
SELECT mattressid
	,mattressname
	,deptid
	,mattresstypeid
	,mattresscode
	,mattress_width
	,mattress_length
	,mattress_height
	,packtype
	,packqty
	,woodpallettype
	,total_hr_cost
	,total_material_cost
	,fees_dscrp
	,total_fees_cost
	,total_cost
	,taxrate
	,taxes
	,commissionrate
	,commission
	,fob
	,profitrate
	,nottax_factory_cost
	,nottax_dept_cost
	,dept_cost
	,foreign_cost
	,extras_cost
	,dept_profitrate
	,moneyrate
	,mattressrelcode
	,flag
	,auditingrep
	,auditingdate
	,createtime
	,createby
	,yw_flag
	,yw_auditingrep
	,yw_auditingdate
	,js1_flag
	,js1_auditingrep
	,js1_auditingdate
	,js2_flag
	,js2_auditingrep
	,js2_auditingdate
	,creatmtrl_flag
	,creatmtrl_auditingrep
	,creatmtrl_auditingdate
	,creatmtrlqd_flag
	,creatmtrlqd_auditingrep
	,creatmtrlqd_auditingdate
	,erp_mtrlcode AS erp_mtrlcode
	,erp_mtrlid
	,nottax_factory_cost / (dept_profitrate + dept_profitrate_rangli / 100) AS dijia_cost
	,erp_mtrlengname
	,0 AS yongjin
FROM u_mattress
  </selectstr>
  <where>
	<when notnull="@arg_deptid">
		u_mattress.deptid = @arg_deptid
	</when>
	<when>
		u_mattress.createby in ($$user_outrepstr$$)
	</when>
	<when>
		u_mattress.deptid in ($$user_deptstr$$)
	</when>
  </where>
  <displayfields>
    <field field="pid" compute="getrow()">序</field>
    <field field="erp_mtrlcode">L1物料编码</field>
    <field field="mattresscode">报价唯一码</field>
    <field field="mattressrelcode">床垫编码</field>
    <field field="mattressname">床垫名称</field>
    <field field="mattresstypeid" mapper="">床垫类别</field>
    <field field="mattress_width" datatype="number">床垫宽/CM</field>
    <field field="mattress_length" datatype="number">床垫长/CM</field>
    <field field="mattress_height" datatype="number">床垫高/CM</field>
    <field field="createby">登记人</field>
    <field field="createtime" datatype="datetime">登记时间</field>
    <field field="deptid" mapper="">部门</field>
    <field field="yw_auditingrep">业务审核人</field>
    <field field="yw_auditingdate" datatype="datetime">业务审核时间</field>
    <field field="js1_auditingrep">产品补充审核人</field>
    <field field="js1_auditingdate" datatype="datetime">产品补充审核时间</field>
    <field field="js2_auditingrep">清单补充审核人</field>
    <field field="js2_auditingdate" datatype="datetime">清单补充审核时间</field>
    <field field="creatmtrl_auditingrep">生成L1产品人</field>
    <field field="creatmtrl_auditingdate" datatype="datetime">生成L1产品时间</field>
    <field field="creatmtrlqd_auditingrep">生成L1清单人</field>
    <field field="creatmtrlqd_auditingdate" datatype="datetime">生成L1清单时间</field>
    <field field="dijia_cost" datatype="number">底价</field>
    <field field="yongjin" datatype="number">佣金</field>
    <field field="taxrate" datatype="number">税率</field>
    <field field="fob" datatype="number">Fob</field>
    <field field="taxes" datatype="number">税金</field>
    <field field="erp_mtrlengname">原来物料编码</field>
  </displayfields>
</select>
