ok
Direktori : /home2/selectio/www/mm-tailor-billing/app/controllers/ |
Current File : /home2/selectio/www/mm-tailor-billing/app/controllers/old get_sales_query.php |
/* Query Here */ if /*tec_sales.id, DATE_FORMAT(date, '%d-%m-%Y') as date, customer_name, customer_phone_no, hold_ref, total, total_tax, total_discount, grand_total, paid, status, DATE_FORMAT(deliver_date, '%d-%m-%Y') as deliver_date, DATE_FORMAT(due_date, '%d-%m-%Y') as due_date, DATE_FORMAT(sale_date, '%d-%m-%Y') as sale_date, total_items,unit_process_status, (SELECT FORMAT((SUM(tec_sale_items.quantity)),0) from tec_sale_items LEFT JOIN tec_products ON tec_sale_items.product_id=tec_products.id where tec_sale_items.sale_id=tec_sales.id and tec_products.pant_shirt_category=1) as pant_count, (SELECT FORMAT((SUM(tec_sale_items.quantity)),0) from tec_sale_items LEFT JOIN tec_products ON tec_sale_items.product_id=tec_products.id where tec_sale_items.sale_id=tec_sales.id and tec_products.pant_shirt_category=2) as shirt_count, sells,(grand_total-(paid+discount)) as balance, discount, IF(((SELECT sum(tec_sale_items.quantity) FROM tec_sale_items WHERE tec_sale_items.sale_id=tec_sales.id and product_type='service')-(SELECT sum(tec_work_units.quantity) FROM tec_work_units WHERE tec_work_units.sale_id=tec_sales.id and tec_work_units.type=1 and tec_work_units.assign_or_not='assign')) is NULL,(SELECT sum(tec_sale_items.quantity) FROM tec_sale_items WHERE tec_sale_items.sale_id=tec_sales.id and product_type='service'), (SELECT sum(tec_sale_items.quantity) FROM tec_sale_items WHERE tec_sale_items.sale_id=tec_sales.id and product_type='service')-(SELECT sum(tec_work_units.quantity) FROM tec_work_units WHERE tec_work_units.sale_id=tec_sales.id and tec_work_units.type=1 and tec_work_units.assign_or_not='assign')) as neww_musthafa_cutting, IF(((SELECT sum(tec_sale_items.quantity) FROM tec_sale_items WHERE tec_sale_items.sale_id=tec_sales.id and product_type='service')-(SELECT sum(tec_work_units.quantity) FROM tec_work_units WHERE tec_work_units.sale_id=tec_sales.id and tec_work_units.type=2 and tec_work_units.assign_or_not='assign')) is NULL,(SELECT sum(tec_sale_items.quantity) FROM tec_sale_items WHERE tec_sale_items.sale_id=tec_sales.id and product_type='service'),((SELECT sum(tec_sale_items.quantity) FROM tec_sale_items WHERE tec_sale_items.sale_id=tec_sales.id and product_type='service')-(SELECT sum(tec_work_units.quantity) FROM tec_work_units WHERE tec_work_units.sale_id=tec_sales.id and tec_work_units.type=2 and tec_work_units.assign_or_not='assign'))) as neww_musthafa_stitching, (SELECT phone FROM tec_customers WHERE tec_sales.customer_id=tec_customers.id) as customer_phone, (SELECT name FROM tec_customers WHERE tec_sales.customer_id=tec_customers.id) as customer_names, tec_customers.name as cus_name*/ else