   @invoices_dbf        "SIINV.DBF"
   @invoice_details_dbf "SIDETINV.DBF"
   @pdcs_dbf            "FIPDC.DBF"
-  @postings_dbf        "FIT1610.dbf"
 
   def generate_file_paths(root_folder, year) do
     year_suffix = year |> to_string |> String.slice(2..3)

      Logger.info fn -> "Invoices  upserted: #{invoices}" end
      Logger.info fn -> "InvDetail upserted: #{inv_details}" end
      Logger.info fn -> "Pdcs      upserted: #{pdcs}" end
    else
      unexpected ->
        Logger.error "Error occurred #{inspect(unexpected)}"
    end

    p = generate_postings_file_paths(@root_folder, year)

    # TODO check avaliable FIN files and populate existing months only
    # with {oct, nil} <- populate_postings(postings_dbf),
    #      {nov, nil} <- populate_postings(postings_dbf),
    #      {dec, nil} <- populate_postings(postings_dbf),
    #      {jan, nil} <- populate_postings(postings_dbf),
    #      {feb, nil} <- populate_postings(postings_dbf),
    #      {mar, nil} <- populate_postings(postings_dbf),
    #      {apr, nil} <- populate_postings(postings_dbf),
    #      {may, nil} <- populate_postings(postings_dbf),
    #      {jun, nil} <- populate_postings(postings_dbf),
    #      {jul, nil} <- populate_postings(postings_dbf),
    #      {aug, nil} <- populate_postings(postings_dbf),
    #      {sep, nil} <- populate_postings(postings_dbf) do
    #   Logger.info fn -> "FIN Oct upserted: #{oct}" end
    #   Logger.info fn -> "FIN Nov upserted: #{nov}" end
    #   Logger.info fn -> "FIN Dec upserted: #{dec}" end
    #   Logger.info fn -> "FIN Jan upserted: #{jan}" end
    #   Logger.info fn -> "FIN Feb upserted: #{feb}" end
    #   Logger.info fn -> "FIN Mar upserted: #{mar}" end
    #   Logger.info fn -> "FIN Apr upserted: #{apr}" end
    #   Logger.info fn -> "FIN May upserted: #{may}" end
    #   Logger.info fn -> "FIN Jun upserted: #{jun}" end
    #   Logger.info fn -> "FIN Jul upserted: #{jul}" end
    #   Logger.info fn -> "FIN Aug upserted: #{aug}" end
    #   Logger.info fn -> "FIN Sep upserted: #{sep}" end
    # else
    #   unexpected ->
    #     Logger.error "Error occurred #{inspect(unexpected)}"
    # end
  end

  # PRODUCTS


    stream
    |> IO.binstream(:line)
    |> Stream.map(fn(x) -> clean_line(x) end)
    |> MyParser.parse_stream(headers: false)
    |> Stream.filter(fn(x) -> Enum.at(x, 6) == "203000" end)
    |> Stream.map(fn(x) ->
      case {Enum.at(x, 9), Enum.at(x, 10)} do
        {"D", ""} ->
          [posting_id(Enum.at(x,  5), Enum.at(x,  0), Enum.at(x,  1),
                      Enum.at(x,  3), Enum.at(x,  2), Enum.at(x, 4)),
           Enum.at(x,  5), Enum.at(x,  7), Enum.at(x, 28),
           Enum.at(x, 11),
           Enum.at(x, 54), Enum.at(x, 55), Enum.at(x, 56)]
