Hola de nuevo... si con la solución y era culpa mía por el jaleo de fechas y los años, tenia las clausulas al revés.
Código MySQL:
Ver originalsum(sbc.total_article
) as total_article
, sum(sbc.total_partides
) as total_partides
, sum(sbc.total_pes
) as total_pes
, sum(sbc.total_cost_partides
) as total_cost_partides
, sum(sbc.total_cost_pes
) as total_cost_pes
, iva
(
".$anyf."_lin_tickets.total
as total_article
, ".$anyf."_lin_tickets.partides
as total_partides
, ".$anyf."_lin_tickets.pes
as total_pes
, ".$anyf."_lin_tickets.cost
* ".$anyf."_lin_tickets.partides
as total_cost_partides
, ".$anyf."_lin_tickets.cost
* (".$anyf."_lin_tickets.pes
/ 1000) as total_cost_pes
, iva
ON ".$anyf."_lin_tickets.id_ticket
= ".$anyf."_tickets.id_ticket
WHERE ".$anyf."_lin_tickets.id_tenda
= ".$id_tenda." AND ".$anyf."_tickets.
data <= ".$dataf." AND ".$anyf."_tickets.anulat
= 0 AND ".$anyf."_tickets.total
> 0 ".$wlin_tickets."
SELECT id_article
,".$anyd."_lin_tickets.total
as total_article
, ".$anyd."_lin_tickets.partides
as total_partides
, ".$anyd."_lin_tickets.pes
as total_pes
, ".$anyd."_lin_tickets.cost
* ".$anyd."_lin_tickets.partides
as total_cost_partides
, ".$anyd."_lin_tickets.cost
* (".$anyd."_lin_tickets.pes
/ 1000) as total_cost_pes
, iva
ON ".$anyd."_lin_tickets.id_ticket
= ".$anyd."_tickets.id_ticket
WHERE ".$anyd."_lin_tickets.id_tenda
= ".$id_tenda." AND ".$anyd."_tickets.
data >= ".$datad." AND ".$anyd."_tickets.anulat
= 0 AND ".$anyd."_tickets.total
> 0 ".$wlin_tickets."
)
muchas gracias por el seguimiento.