Advertisement
Fuzzysteve

full bill of materials Eve online

Jul 21st, 2013
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.42 KB | None | 0 0
  1. select typeid,name,sum(quantity)+(sum(perfect)*(0.25-(0.05*:pe))*max(base)) quantity from(
  2. select typeid,name,round(if(:me>=0,greatest(0,sum(quantity))+(greatest(0,sum(quantity))*((wastefactor/(:me+1))/100)),greatest(0,sum(quantity))+(greatest(0,sum(quantity))*(wastefactor/100)*(1-:ME)))) quantity,1 base,greatest(0,sum(quantity)) perfect from (
  3.   select invTypes.typeid typeid,invTypes.typeName name,quantity
  4.   from invTypes,invTypeMaterials
  5.   where invTypeMaterials.materialTypeID=invTypes.typeID
  6.    and invTypeMaterials.TypeID=:typeid
  7.   union
  8.   select invTypes.typeid typeid,invTypes.typeName name,
  9.          invTypeMaterials.quantity*r.quantity*-1 quantity
  10.   from invTypes,invTypeMaterials,ramTypeRequirements r,invBlueprintTypes bt
  11.   where invTypeMaterials.materialTypeID=invTypes.typeID
  12.    and invTypeMaterials.TypeID =r.requiredTypeID
  13.    and r.typeID = bt.blueprintTypeID
  14.    and r.activityID = 1 and bt.productTypeID=:typeid and r.recycle=1
  15. ) t join invBlueprintTypes on (invBlueprintTypes.productTypeID=:typeid) group by typeid,name
  16. union
  17. SELECT t.typeID typeid,t.typeName tn, r.quantity * r.damagePerJob quantity,0 base,r.quantity * r.damagePerJob perfect
  18. FROM ramTypeRequirements r,invTypes t,invBlueprintTypes bt,invGroups g
  19. where r.requiredTypeID = t.typeID and r.typeID = bt.blueprintTypeID
  20. and r.activityID = 1 and bt.productTypeID=:typeid and g.categoryID != 16
  21. and t.groupID = g.groupID) outside group by typeid,name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement