Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ELECT `Quotation`.`id` AS `t0_c0`,
- `Quotation`.`opportunity_id` AS `t0_c1`, `Quotation`.`quotation_number` AS
- `t0_c2`, `Quotation`.`contact_id` AS `t0_c3`, `Quotation`.`date` AS
- `t0_c4`, `Quotation`.`description` AS `t0_c5`, `Quotation`.`discount` AS
- `t0_c6`, `Quotation`.`tax` AS `t0_c7`, `Quotation`.`discount_type` AS
- `t0_c8`, `Quotation`.`owner_id` AS `t0_c9`, `Quotation`.`coordinator_id` AS
- `t0_c10`, `Quotation`.`status` AS `t0_c11`, `Quotation`.`create_date` AS
- `t0_c12`, `Quotation`.`update_date` AS `t0_c13`, `Quotation`.`deleted` AS
- `t0_c14`, ROUND(SUM(qd.selling_price * qd.quantity),2) as totalAmount,
- ROUND(SUM(qd.selling_price * qd.quantity)*(1-(Quotation.discount/100)),2)
- as totalDiscountedAmount, ROUND(SUM(qd.selling_price *
- qd.quantity)*(1-(Quotation.discount/100))*(1+(Quotation.tax/100)),2) as
- totalTaxedAmount, SUM(sls.amount) AS totalSalesCredited, `qd`.`id` AS
- `t1_c0`, `qd`.`quotation_header_id` AS `t1_c1`, `qd`.`order_column` AS
- `t1_c2`, `qd`.`quantity` AS `t1_c3`, `qd`.`selling_price` AS `t1_c4`,
- `qd`.`internal_price` AS `t1_c5`, `qd`.`description` AS `t1_c6`,
- `qd`.`discount` AS `t1_c7`, `qd`.`discount_type` AS `t1_c8`, `sls`.`id` AS
- `t2_c0`, `sls`.`sales_agent_id` AS `t2_c1`, `sls`.`amount` AS `t2_c2`,
- `sls`.`quoation_id` AS `t2_c3`, `sls`.`status` AS `t2_c4`, `sls`.`comment`
- AS `t2_c5`, `sls`.`commission` AS `t2_c6`, `sls`.`sales_manager_id` AS
- `t2_c7`, `sls`.`created_at` AS `t2_c8`, `cid`.`id` AS `t3_c0`,
- `cid`.`username` AS `t3_c1`, `cid`.`email` AS `t3_c3`, `cid`.`create_at` AS
- `t3_c9`, `cid`.`lastvisit_at` AS `t3_c6`, `cid`.`superuser` AS `t3_c7`,
- `cid`.`status` AS `t3_c8`, `cidp`.`user_id` AS `t4_c0`, `cidp`.`first_name`
- AS `t4_c1`, `cidp`.`last_name` AS `t4_c2`, `cidp`.`branch_id` AS `t4_c3`,
- `cidp`.`sales_agent` AS `t4_c4`, `cidp`.`coordinator` AS `t4_c5`,
- `cidp`.`manager` AS `t4_c6`, `cidp`.`worker` AS `t4_c7`, `opp`.`id` AS
- `t5_c0`, `opp`.`name` AS `t5_c1`, `opp`.`customer_id` AS `t5_c2`,
- `opp`.`owner_id` AS `t5_c3`, `opp`.`amount` AS `t5_c4`, `opp`.`close_date`
- AS `t5_c5`, `opp`.`probability` AS `t5_c6`, `opp`.`status` AS `t5_c7`,
- `opp`.`stage` AS `t5_c8`, `opp`.`source` AS `t5_c9`, `opp`.`create_date` AS
- `t5_c10`, `opp`.`turbo` AS `t5_c11`, `opp`.`edmel` AS `t5_c12`,
- `opp`.`fabrication` AS `t5_c13`, `opp`.`contact_id` AS `t5_c14`,
- `opp`.`update_date` AS `t5_c15`, `opp`.`deleted` AS `t5_c16`, `opcu`.`id`
- AS `t6_c0`, `opcu`.`name` AS `t6_c1`, `opcu`.`trunkline` AS `t6_c2`,
- `opcu`.`fax` AS `t6_c3`, `opcu`.`directline` AS `t6_c4`, `opcu`.`operator`
- AS `t6_c5`, `opcu`.`description` AS `t6_c6`, `opcu`.`industry` AS `t6_c7`,
- `opcu`.`number_of_employees` AS `t6_c8`, `opcu`.`annual_revenue` AS
- `t6_c9`, `opcu`.`rating` AS `t6_c10`, `opcu`.`email` AS `t6_c11`,
- `opcu`.`website` AS `t6_c12`, `opcu`.`facebook` AS `t6_c13`,
- `opcu`.`twitter` AS `t6_c14`, `opcu`.`billing_address_id` AS `t6_c15`,
- `opcu`.`shipping_address_id` AS `t6_c16`, `opcu`.`owner_id` AS `t6_c17`,
- `opcu`.`deleted` AS `t6_c18`, `opcu`.`create_date` AS `t6_c19`,
- `opcu`.`update_date` AS `t6_c20`, `ow`.`id` AS `t7_c0`, `ow`.`username` AS
- `t7_c1`, `ow`.`email` AS `t7_c3`, `ow`.`create_at` AS `t7_c9`,
- `ow`.`lastvisit_at` AS `t7_c6`, `ow`.`superuser` AS `t7_c7`, `ow`.`status`
- AS `t7_c8`, `owp`.`user_id` AS `t8_c0`, `owp`.`first_name` AS `t8_c1`,
- `owp`.`last_name` AS `t8_c2`, `owp`.`branch_id` AS `t8_c3`,
- `owp`.`sales_agent` AS `t8_c4`, `owp`.`coordinator` AS `t8_c5`,
- `owp`.`manager` AS `t8_c6`, `owp`.`worker` AS `t8_c7` FROM
- `quotation_header` `Quotation` LEFT OUTER JOIN `quotation_detail` `qd` ON
- (`qd`.`quotation_header_id`=`Quotation`.`id`) LEFT OUTER JOIN `sale` `sls`
- ON (`sls`.`quoation_id`=`Quotation`.`id`) LEFT OUTER JOIN `users` `cid` ON
- (`Quotation`.`coordinator_id`=`cid`.`id`) LEFT OUTER JOIN `profiles`
- `cidp` ON (`cidp`.`user_id`=`cid`.`id`) LEFT OUTER JOIN `opportunity`
- `opp` ON (`Quotation`.`opportunity_id`=`opp`.`id`) LEFT OUTER JOIN
- `customer` `opcu` ON (`opp`.`customer_id`=`opcu`.`id`) LEFT OUTER JOIN
- `users` `ow` ON (`Quotation`.`owner_id`=`ow`.`id`) LEFT OUTER JOIN
- `profiles` `owp` ON (`owp`.`user_id`=`ow`.`id`) GROUP BY
- qd.quotation_header_id, sls.quoation_id LIMIT 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement