11<?php
22/**
33 * This file is part of FacturaScripts
4- * Copyright (C) 2017-2023 Carlos Garcia Gomez <carlos@facturascripts.com>
4+ * Copyright (C) 2017-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
55 *
66 * This program is free software: you can redistribute it and/or modify
77 * it under the terms of the GNU Lesser General Public License as
@@ -45,7 +45,7 @@ public function getPageData(): array
4545 return $ data ;
4646 }
4747
48- protected function createViews ()
48+ protected function createViews (): void
4949 {
5050 // listado de facturas de proveedor
5151 $ this ->createViewPurchases ('ListFacturaProveedor ' , 'FacturaProveedor ' , 'invoices ' );
@@ -65,10 +65,13 @@ protected function createViews()
6565 $ this ->createViewRefunds ();
6666 }
6767
68- protected function createViewPurchases (string $ viewName , string $ modelName , string $ label )
68+ protected function createViewPurchases (string $ viewName , string $ modelName , string $ label ): void
6969 {
7070 parent ::createViewPurchases ($ viewName , $ modelName , $ label );
71- $ this ->addSearchFields ($ viewName , ['codigorect ' ]);
71+
72+ $ this ->listView ($ viewName )
73+ ->addOrderBy (['idfactura ' ], 'id ' )
74+ ->addSearchFields (['codigorect ' ]);
7275
7376 // filtros
7477 $ i18n = Tools::lang ();
@@ -94,15 +97,16 @@ protected function createViewPurchases(string $viewName, string $modelName, stri
9497 }
9598 }
9699
97- protected function createViewReceipts (string $ viewName = 'ListReciboProveedor ' )
100+ protected function createViewReceipts (string $ viewName = 'ListReciboProveedor ' ): void
98101 {
99- $ this ->addView ($ viewName , 'ReciboProveedor ' , 'receipts ' , 'fa-solid fa-dollar-sign ' );
100- $ this ->addOrderBy ($ viewName , ['codproveedor ' ], 'supplier-code ' );
101- $ this ->addOrderBy ($ viewName , ['fecha ' , 'idrecibo ' ], 'date ' );
102- $ this ->addOrderBy ($ viewName , ['fechapago ' ], 'payment-date ' );
103- $ this ->addOrderBy ($ viewName , ['vencimiento ' ], 'expiration ' , 2 );
104- $ this ->addOrderBy ($ viewName , ['importe ' ], 'amount ' );
105- $ this ->addSearchFields ($ viewName , ['codigofactura ' , 'observaciones ' ]);
102+ $ this ->addView ($ viewName , 'ReciboProveedor ' , 'receipts ' , 'fa-solid fa-dollar-sign ' )
103+ ->addOrderBy (['codproveedor ' ], 'supplier-code ' )
104+ ->addOrderBy (['fecha ' , 'idrecibo ' ], 'date ' )
105+ ->addOrderBy (['fechapago ' ], 'payment-date ' )
106+ ->addOrderBy (['vencimiento ' ], 'expiration ' , 2 )
107+ ->addOrderBy (['importe ' ], 'amount ' )
108+ ->addSearchFields (['codigofactura ' , 'observaciones ' ])
109+ ->setSettings ('btnNew ' , false );
106110
107111 // filtros
108112 $ this ->addFilterPeriod ($ viewName , 'expiration ' , 'expiration ' , 'vencimiento ' );
@@ -131,17 +135,16 @@ protected function createViewReceipts(string $viewName = 'ListReciboProveedor')
131135
132136 // botones
133137 $ this ->addButtonPayReceipt ($ viewName );
134-
135- // desactivamos el botón nuevo
136- $ this ->setSettings ($ viewName , 'btnNew ' , false );
137138 }
138139
139- protected function createViewRefunds (string $ viewName = 'ListFacturaProveedor-rect ' )
140+ protected function createViewRefunds (string $ viewName = 'ListFacturaProveedor-rect ' ): void
140141 {
141- $ this ->addView ($ viewName , 'FacturaProveedor ' , 'refunds ' , 'fa-solid fa-share-square ' );
142- $ this ->addSearchFields ($ viewName , ['codigo ' , 'codigorect ' , 'numproveedor ' , 'observaciones ' ]);
143- $ this ->addOrderBy ($ viewName , ['fecha ' , 'idfactura ' ], 'date ' , 2 );
144- $ this ->addOrderBy ($ viewName , ['total ' ], 'total ' );
142+ $ this ->addView ($ viewName , 'FacturaProveedor ' , 'refunds ' , 'fa-solid fa-share-square ' )
143+ ->addSearchFields (['codigo ' , 'codigorect ' , 'numproveedor ' , 'observaciones ' ])
144+ ->addOrderBy (['fecha ' , 'idfactura ' ], 'date ' , 2 )
145+ ->addOrderBy (['total ' ], 'total ' )
146+ ->disableColumn ('original ' , false )
147+ ->setSettings ('btnNew ' , false );
145148
146149 // filtro de fecha
147150 $ this ->addFilterPeriod ($ viewName , 'date ' , 'period ' , 'fecha ' );
@@ -153,12 +156,6 @@ protected function createViewRefunds(string $viewName = 'ListFacturaProveedor-re
153156 'where ' => [new DataBaseWhere ('idfacturarect ' , null , 'IS NOT ' )]
154157 ]
155158 ]);
156-
157- // desactivamos el botón nuevo
158- $ this ->setSettings ($ viewName , 'btnNew ' , false );
159-
160- // mostramos la columna original
161- $ this ->views [$ viewName ]->disableColumn ('original ' , false );
162159 }
163160
164161 /**
0 commit comments