anchor.diff:      end.
   
   monthly_fee(Db) ->
  +    {_, Year, Month} = kazoo_modb_util:split_account_mod(Db),
  +    DaysInMonth = calendar:last_day_of_the_month(Year, Month),
       Modb = wh_util:format_account_modb(Db, 'encoded'),
       RawModb = wh_util:format_account_modb(Db, 'raw'),
       _ = maybe_add_design_doc(Modb),
  
positive.code:     _ = process_ets(RawTableId, ResultTableId),
      ServicesList = ets:tab2list(ResultTableId),
      [lager:info("Result Table Line: ~p",[Service]) || Service <- ServicesList],
      {_, JObj} = services_to_jobj(ServicesList),
      JObj.
  
  process_daily_fee(JObj, Modb, RawTableId) ->
  
negative.code: days_glue(L) ->
      lists:foldl(fun(X,Acc) -> case Acc of <<>> -> X; _ -> <<Acc/binary, ",", X/binary>> end end, <<>>, L).
  
  services_to_jobj(ServicesList, Year, Month, DaysInMonth) ->
      lists:foldl(fun(ServiceLine, Acc) -> service_to_jobj(ServiceLine, Year, Month, DaysInMonth, Acc) end, {0, {[]}}, ServicesList).
  
  service_to_jobj({ServiceType, Item, Price, Quantity, Period, DaysQty}, Year, Month, DaysInMonth, {Num, JObj}) ->
      JLine = wh_json:set_values([{'category', ServiceType}
                                  ,{'item',Item}
                                  ,{'cost', DaysQty/DaysInMonth*Price}
                                  ,{'rate', Price}
                                  ,{'quantity', Quantity}
                                  ,{'period', Period}
                                  ,{days_quantity, DaysQty}
                                  ,{days_in_month, DaysInMonth}
                                  ,{month, Month}
                                  ,{year, Year}
                                 ]
                                 ,{[]}
                                ),
  