<?xml version="1.0" encoding="utf-8" ?>
<select>
  <selectstr>
SELECT u_factory_profitrate.bednet_or_mattress 
	,u_factory_profitrate.bednettypeid_mattresstypeid 
	,u_factory_profitrate.profitrate
FROM u_factory_profitrate
  </selectstr>
  <where>
	<when>
		u_factory_profitrate.bednet_or_mattress = @bednet_or_mattress
	</when>
	<when notnull="@arg_deptid">
		u_factory_profitrate.deptid = @deptid
	</when>
	<when notnull="@bednettypeid_mattresstypeid">
		u_factory_profitrate.bednettypeid_mattresstypeid = @bednettypeid_mattresstypeid
	</when>
  </where>
  <orderstr>
  </orderstr>
  <displayfields>
  </displayfields>
</select>