I tried to fix that code many times, i don't know that syntax is not valid for SQL Server 2012. So please fix it
WHERE
invoice_register.trans_type_id IN (1, 2, 3, 6, 7, 8, 9) AND
invoice_register.store_id = invoice_detail.store_id AND
invoice_register.invoice_register_id = invoice_detail.invoice_register_id AND
ii.item_id = invoice_detail.item_id AND
ii.style_master_id *= sm.style_master_id AND /*Incorrect Syntax*/
(@a_category_id = -9999 OR ii.category_id = @a_category_id ) AND
(@a_store_id is NULL OR invoice_register.store_id = @a_store_id ) AND
(invoice_register.trans_date between @a_Start_Date and @a_End_Date)) A
GROUP BY
A.store_id, A.category_id,
A.type_id, A.item_id, A.item_code,
A.name, A.cost, A.price_sold,
A.manufacturer, A.style_number,
A.comments, A.UPC
Please fix my syntax. I think my syntax is old