@@ -49,27 +49,29 @@ protected function getFields(): array
4949 'idproducto ' => static ::MAIN_TABLE . '.idproducto ' ,
5050 'precio ' => 'variantes.precio ' ,
5151 'referencia ' => static ::MAIN_TABLE . '.referencia ' ,
52- 'stockfis ' => 'variantes.stockfis '
52+ 'stockfis ' => 'stocks.cantidad '
5353 ];
5454 }
5555
5656 protected function getGroupFields (): string
5757 {
5858 return static ::DOC_TABLE . '.codalmacen, ' . static ::MAIN_TABLE . '.idproducto, '
5959 . static ::MAIN_TABLE . '.referencia, productos.codfabricante, productos.codfamilia, variantes.coste, '
60- . 'productos.descripcion, variantes.precio, variantes.stockfis ' ;
60+ . 'productos.descripcion, variantes.precio, stocks.cantidad ' ;
6161 }
6262
6363 protected function getSQLFrom (): string
6464 {
6565 return static ::MAIN_TABLE
6666 . ' LEFT JOIN variantes ON ' . static ::MAIN_TABLE . '.referencia = variantes.referencia '
6767 . ' LEFT JOIN productos ON variantes.idproducto = productos.idproducto '
68- . ' LEFT JOIN facturasprov ON facturasprov.idfactura = lineasfacturasprov.idfactura ' ;
68+ . ' LEFT JOIN facturasprov ON facturasprov.idfactura = lineasfacturasprov.idfactura '
69+ . ' LEFT JOIN stocks ON stocks.referencia = ' . static ::MAIN_TABLE . '.referencia '
70+ . ' AND stocks.codalmacen = ' . static ::DOC_TABLE . '.codalmacen ' ;
6971 }
7072
7173 protected function getTables (): array
7274 {
73- return [static ::MAIN_TABLE , 'productos ' , 'variantes ' ];
75+ return [static ::MAIN_TABLE , 'productos ' , 'variantes ' , ' stocks ' ];
7476 }
7577}
0 commit comments