# -*- coding: utf-8 -*-
def stock_type_helper(stock_type_A, stock_type_B)
  if stock_type_A == "660" || stock_type_A == "706"
  	return '0'
  else
  	return stock_type_B
  end
end

csv = '/tmp/adjustment_details.csv'

open(csv) do |file|
  while line = file.gets()
    array = line.split(',')
    array[3] = stock_type_helper(array[3],array[4])
    array.delete_at(4)
    puts array.inject{|r,i| r + "," + i}
  end
end
