STORAGE COLUMN ANALYSIS
- Quantity purchases: Total quantity of purchases
- Exit quantity: Total quantity of sales
- Purchases: Total value of purchases before VAT
- Sales: Total value of sales before VAT
- Gross profit%: (Sale price – Purchase value) * 100 / Sale price
- MT market: Average market price
- MT selling price: Average selling price
- Profit margin: Sale price – Purchase value
- Profit margin%: (Sale price – Purchase value) * 100 / Purchase price
Average price calculation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
select sum( case when "eidhpar"."Xrevstiko" in (0, 5) then "grammes"."Posothta"*("grammes"."Timh" - (("grammes"."Timh" * "grammes"."Ekptvsh") / 100)) end) / sum( case when "eidhpar"."Xrevstiko" in (0, 5) then "grammes"."Posothta" end) as "mesh_a", sum( case when "eidhpar"."Xrevstiko" in (1, 6) then "grammes"."Posothta"*("grammes"."Timh" - (("grammes"."Timh" * "grammes"."Ekptvsh") / 100)) end) / sum( case when "eidhpar"."Xrevstiko" in (1, 6) then "grammes"."Posothta" end) as "mesh_p" , "grammes"."Eidos" from "grammes", "pvlhseis", "eidhpar" where "grammes"."Aapar" = "pvlhseis"."Aa" and "pvlhseis"."Parastatiko" = "eidhpar"."Aa" and "grammes"."Timh" <> 0 and "grammes"."Timh" is not null and "grammes"."Eidos" is not null and "grammes"."fpa_" is not null and "grammes"."KvdikosEidoys" is not null and "grammes"."PerigrafhEidoys" is not null and "eidhpar"."Emf_timvn" = 1 and "eidhpar"."Xrevstiko" in (0, 1, 5, 6) and "pvlhseis"."Hmeromhnia" <= '12/31/2021 23:59:59' group by "grammes"."Eidos" |