Sha256: 32f0380c6a519ad9b4f9782ad72b4ab9fcbadc3b3deb937889a307c45229b4e4
Contents?: true
Size: 1.8 KB
Versions: 174
Compression:
Stored size: 1.8 KB
Contents
all_businesses_count = 0 area_ids = EducodeSales::Common.where(clazz: 'area').ids.sort.to_s json.data do json.array! @places do |d| json.id d.id json.name d.name # json.area_id d.areas.present? ? d.areas.pluck(:name).join("、") : '' if d.areas.present? if d.areas.ids.sort.to_s == area_ids json.area_id '全国' else json.area_id d.areas.pluck(:name).join("、") end else json.area_id '' end business_count = EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", @x).where("educode_sales_follow_ups.place_id = #{d.id}").count json.businesses_count business_count all_businesses_count += business_count # json.amount EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", @x).where("educode_sales_follow_ups.place_id = #{d.id} AND educode_sales_follow_ups.stage_id IN (?)", @stage_ids).sum("actual_amount - divide_amount").round(2) json.total_amount EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", @x).where("educode_sales_follow_ups.place_id = #{d.id} AND educode_sales_follow_ups.stage_id IN (?)", @stage_ids).sum("total_amount").round(2) json.divide_amount EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", @x).where("educode_sales_follow_ups.place_id = #{d.id} AND educode_sales_follow_ups.stage_id IN (?)", @stage_ids).sum("divide_amount").round(2) json.return_mount EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", @x).where("educode_sales_follow_ups.place_id = #{d.id}").sum(:return_money).round(2) end end json.totalRow do json.businesses_count all_businesses_count.to_s end json.code 0 json.count @places.total_count
Version data entries
174 entries across 174 versions & 1 rubygems