SELECT
	id,
	NULL as accept_order_id,
	1 as rev_number,
	input_date,
	order_date as target_date,
	35 as user_id,
	19 as section_id,
	1 as order_trigger_code,
	9 as order_type_code,
	1 as order_sheet_type_code,
	supplier_id + 1 as supplier_id,
	NULL as customer_id,
	NULL as shipment_customer_id,
	NULL as delivery_id,
	NULL as trucking_id,
	NULL as receiver_name,
	NULL as request_time,
	660 as warehouse_id,
	660 as own_warehouse_id,
	NULL as user_position_id,
	NULL as sales_user_id,
	NULL as sales_area_id,
	NULL as sales_section_id,
	NULL as operate_date,
	close_flag_id as state_code,
	NULL as order_note,
	order_note as note,
	supplier_id + 1 as payto_supplier_id,
	IF(supplier_id=1,2,1) as currency_type_code,
	NULL as exchange_rate,
	total_price as total_price,
	total_tax as total_duty,
	IF(supplier_id=3,1,0) as duty_type_code,
  IF(supplier_id=3,5,0) as duty_rate,
  0 as price_duty_type_code,
  1 as duty_calc_type_code,
  1 as frac_digit_code,
  1 as fraction_method_code,
	0 as invalid_flag_code,
	print_sheet as print_sheet_date,
	NULL as deleted_at,
	NOW() as created_at,
	NOW() as updated_at
FROM orders
WHERE id > 164
INTO OUTFILE "/tmp/orders.csv" FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"';