SELECT
	id,
	1 as rev_number,
	input_date,
	receiving_date as target_date,
	35 as user_id,
	19 as section_id,
	dealer_id as customer_id,
	dealer_group_id as customer_group_id,
	receiving_date as cutoff_date,
	credit_timing_id as credit_timing_code,
	cutoff_date as cutoff_date_code,
	total_amount,
	close_flag_id as state_code,
	receiving_note as note,
	0 as invalid_flag_code,
	NULL as deleted_at,
	NOW() as created_at,
	NOW() as updated_at
FROM receivings
INTO OUTFILE "/tmp/receivings.csv" FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"';