" LEFT JOIN ( SELECT * FROM Set_KanBanSettle ) B ON A.Kanban = B.Kanban \n"+
" AND A.MaterialCode = B.MaterialCode\n"+
" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode \n"+
" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode {0}\n"+
" ) TEMP1\n"+
" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT MAX( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode";
stringstr=string.Empty;
str+=" where 1=1 ";
if(!string.IsNullOrEmpty(begintime))
{
str+=string.Format(" and BeginDate >='{0}'",begintime);
}
if(string.IsNullOrEmpty(endtime))
{
str+=string.Format(" and BeginDate<='{0}'",endtime);