"SELECT r.c_date,f.f_type,r.c_color,r.c_pu,r.c_che,r.c_paper,r.c_waste,r.c_gas,r.c_total,ISNULL(p.pt_produc,0),(ISNULL(r.c_total,0))*100/ISNULL(p.pt_produc,0) as tnetdiff FROM PTrawmat r left join PTdeptpr f on r.c_type = f.f_type left join PTsum p on r.c_type=p.pt_typed where p.pt_date = r.c_date and p.pt_typed = r.c_type and r.c_type= '" & cmbdept.SelectedValue.ToString() & "' and r.c_date between '" & dtgdates.Value.ToString("yyyy-MM-dd") & "' and '" & dtgdate2.Value.ToString("yyyy-MM-dd") & "'