...actual deletes on the table by using the flag
Update the remaining records with the header date.
Example for the view select statement:
select * from detail_file df1 inner join
(select df2.customer as c,df2.item as i,max(df2.date) as d from detail_file df2 group by df2.customer,df2.item)...