Advertisement
Guest User

Untitled

a guest
Jul 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 2.09 KB | None | 0 0
  1. SELECT
  2.   o0_.id AS id_0,
  3.   o0_.SUM AS sum_1,
  4.   o0_.draft AS draft_2,
  5.   o0_.income_or_outcome AS income_or_outcome_3,
  6.   o0_.STATUS AS status_4,
  7.   o0_.created_at AS created_at_5,
  8.   o0_.number_ppo AS number_ppo_6,
  9.   o0_.page_number AS page_number_7,
  10.   o0_.document_id AS document_id_8,
  11.   o0_.receiver_passport_data AS receiver_passport_data_9,
  12.   o0_.responsible_passport_data AS responsible_passport_data_10,
  13.   o0_.reason AS reason_11,
  14.   o0_.account_code AS account_code_12,
  15.   o0_.discriminator AS discriminator_13,
  16.   o0_.from_id AS from_id_14,
  17.   o0_.destination_id AS destination_id_15,
  18.   o0_.type_id AS type_id_16,
  19.   o0_.contract_id AS contract_id_17,
  20.   o0_.subcategory_id AS subcategory_id_18,
  21.   o0_.responsible_id AS responsible_id_19,
  22.   o0_.receiver_id AS receiver_id_20,
  23.   o0_.payment_id AS payment_id_21
  24. FROM
  25.   operation o0_
  26.   INNER JOIN cash_box c1_ ON o0_.from_id = c1_.id
  27.   INNER JOIN cash_box c2_ ON o0_.destination_id = c2_.id
  28.   INNER JOIN site s3_ ON c1_.department_id = s3_.id
  29.   INNER JOIN site s4_ ON c2_.department_id = s4_.id
  30. WHERE
  31.   (
  32.     (
  33.       (
  34.         s3_.id IN (
  35.           SELECT
  36.             IFNULL(s5_.id, 0) AS sclr_22
  37.           FROM
  38.             site s5_
  39.           WHERE
  40.             s5_.ip_address LIKE ?
  41.             AND (
  42.               s5_.regional_director_id = ?
  43.               OR s5_.regional_manager_id = ?
  44.             )
  45.           ORDER BY
  46.             s5_.id DESC
  47.         )
  48.       )
  49.       OR (
  50.         s4_.id IN (
  51.           SELECT
  52.             IFNULL(s6_.id, 0) AS sclr_23
  53.           FROM
  54.             site s6_
  55.           WHERE
  56.             s6_.ip_address LIKE ?
  57.             AND (
  58.               s6_.regional_director_id = ?
  59.               OR s6_.regional_manager_id = ?
  60.             )
  61.           ORDER BY
  62.             s6_.id DESC
  63.         )
  64.       )
  65.     )
  66.     AND (
  67.       (
  68.         s3_.accountant_id = ?
  69.         OR s3_.cashier_id = ?
  70.       )
  71.       OR (
  72.         s4_.accountant_id = ?
  73.         OR s4_.cashier_id = ?
  74.       )
  75.     )
  76.   )
  77.   AND o0_.discriminator IN ('Movement')
  78. ORDER BY
  79.   o0_.id ASC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement