Advertisement
Pandaaaa906

Untitled

Aug 12th, 2022
1,438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- SELECT
  2. -- prd.id,
  3. -- prd.brand,
  4. -- prd.cat_no,
  5. -- pkg.package,
  6. -- pkg.origin_cost,
  7. -- pkg.cost,
  8. -- pkg.price,
  9. -- pkg.delivery,
  10. -- pkg.created_at,
  11. -- pkg.modified_at,
  12. -- prd.shipping_group
  13. -- SELECT round(79 * 9.4936)
  14.  
  15. UPDATE "product_package" pkg
  16. SET cost = case
  17. when shipping_group ilike any(array['A1A', 'G1A', 'L']) then round((origin_cost + 2.5) * 7.12 * 1.13*1.045)
  18. when shipping_group ilike 'B1A' then round((origin_cost + 2.5) * 7.12 * 1.13*1.045) + 85
  19. when shipping_group ilike 'C1A' then round((origin_cost + 2.5) * 7.12 * 1.13*1.045) + 50
  20. else null end,
  21. price = case
  22. when shipping_group ilike any(array['A1A', 'G1A', 'L']) then round(origin_cost * 16)
  23. when shipping_group ilike 'B1A' then round((origin_cost + 5) * 16)
  24. when shipping_group ilike 'C1A' then round((origin_cost + 5) * 16)
  25. else null end,
  26. price_expiry_date = now() + interval '37days'
  27. FROM public.rawdata prd
  28. WHERE pkg.brand = prd.brand
  29. AND pkg.cat_no = prd.cat_no
  30. AND pkg.brand = 'ep'
  31. ;
  32. --
  33. -- SELECT
  34. -- *
  35. -- FROM product_package
  36. UPDATE product_package
  37. set cost = (origin_cost) * 8.4 * 1.13 * 1.045,
  38. price = origin_cost * 16,
  39. price_expiry_date = now() + interval '37days'
  40. where brand='bp';
  41.  
  42.  
  43. -- SELECT
  44. -- *
  45. -- FROM product_package
  46. UPDATE product_package
  47. set cost = origin_cost * 8.3,
  48. price = origin_cost * 16,
  49. price_expiry_date = now() + interval '187days'
  50. where brand='usp';
  51.  
  52.  
  53. -- SELECT
  54. -- *
  55. -- FROM product_package
  56. UPDATE product_package pkg
  57. set cost = case
  58. when (
  59.     prd.info2 ilike '-86'
  60.     or (attrs ->> 'shipping_condition') ilike 'dry ice'
  61.     or (attrs ->> 'iata_regulations') ilike 'dangerous'
  62.     or (attrs ->> 'controlled_prd') is not null
  63.     or (attrs ->> 'un_code') is not null
  64. ) then round((origin_cost * 6.1)::numeric, 2)
  65. else round((origin_cost * 0.7 * 6.8 * 1.13 * 1.045)::numeric, 2)
  66. end,
  67. price = case
  68. when (
  69.     prd.info2 ilike '-86'
  70.     or (attrs ->> 'shipping_condition') ilike 'dry ice'
  71.     or (attrs ->> 'iata_regulations') ilike 'dangerous'
  72.     or (attrs ->> 'controlled_prd') is not null
  73.     or (attrs ->> 'un_code') is not null
  74. ) then round((origin_cost * 16.8)::numeric, 2)
  75. else round((origin_cost * 16)::numeric, 2)
  76. end,
  77. delivery = case
  78. when delivery not ilike 'In Stock' then delivery
  79. when (
  80.     info2 ilike '-86'
  81.     or (attrs ->> 'shipping_condition') ilike 'dry ice'
  82.     or (attrs ->> 'iata_regulations') ilike 'dangerous'
  83.     or (attrs ->> 'controlled_prd') is not null
  84.     or (attrs ->> 'un_code') is not null
  85. ) then '70'
  86. else '42'
  87. end,
  88. price_expiry_date = now() + interval '37days'
  89. FROM rawdata prd
  90. where pkg.brand = prd.brand
  91. AND pkg.cat_no = prd.cat_no
  92. AND pkg.brand='trc'
  93.  
  94. ;
  95.  
  96.  
  97.  
  98.  
  99. -- SELECT
  100. -- *
  101. -- FROM product_package
  102. UPDATE product_package
  103. set cost = origin_cost * 9,
  104. price = origin_cost * 16,
  105. delivery = 56,
  106. price_expiry_date = now() + interval '37days'
  107. where brand='nist';
  108.  
  109.  
  110.  
  111.  
  112.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement