|
27 | 27 | use FacturaScripts\Core\Lib\ExtendedController\EditController; |
28 | 28 | use FacturaScripts\Core\Lib\SubAccountTools; |
29 | 29 | use FacturaScripts\Core\Tools; |
| 30 | +use FacturaScripts\Core\Where; |
| 31 | +use FacturaScripts\Dinamic\Model\FacturaCliente; |
| 32 | +use FacturaScripts\Dinamic\Model\FacturaProveedor; |
30 | 33 | use FacturaScripts\Dinamic\Model\RegularizacionImpuesto; |
31 | 34 | use FacturaScripts\Dinamic\Lib\Accounting\VatRegularizationToAccounting; |
32 | 35 | use FacturaScripts\Dinamic\Lib\Modelo303; |
@@ -62,6 +65,33 @@ public function getPageData(): array |
62 | 65 | return $data; |
63 | 66 | } |
64 | 67 |
|
| 68 | + protected function checkInvoicesWithoutAccounting($model): void |
| 69 | + { |
| 70 | + // si el modelo no existe, no hacemos nada |
| 71 | + if (false === $model->exists()) { |
| 72 | + return; |
| 73 | + } |
| 74 | + |
| 75 | + // construimos la consulta para buscar facturas sin asiento |
| 76 | + $where = [ |
| 77 | + Where::isNull('idasiento'), |
| 78 | + Where::eq('codejercicio', $model->codejercicio), |
| 79 | + Where::gte('fecha', $model->fechainicio), |
| 80 | + Where::lte('fecha', $model->fechafin), |
| 81 | + Where::notEq('total', 0), |
| 82 | + ]; |
| 83 | + |
| 84 | + // buscamos si hay facturas de compra sin asiento para la fecha de la regularización |
| 85 | + foreach (FacturaProveedor::all($where) as $invoice) { |
| 86 | + Tools::log()->warning('supplier-invoice-without-accounting-entry', ['%code%' => $invoice->codigo]); |
| 87 | + } |
| 88 | + |
| 89 | + // buscamos si hay facturas de venta sin asiento para la fecha de la regularización |
| 90 | + foreach (FacturaCliente::all($where) as $invoice) { |
| 91 | + Tools::log()->warning('sale-invoice-without-accounting-entry', ['%code%' => $invoice->codigo]); |
| 92 | + } |
| 93 | + } |
| 94 | + |
65 | 95 | /** |
66 | 96 | * Create accounting entry action procedure. |
67 | 97 | * |
@@ -272,6 +302,7 @@ protected function loadData($viewName, $view): void |
272 | 302 | ]); |
273 | 303 |
|
274 | 304 | $this->modelo303->loadFromResumen($view->cursor); // Load data into Modelo303 View |
| 305 | + $this->checkInvoicesWithoutAccounting($mainModel); |
275 | 306 | break; |
276 | 307 |
|
277 | 308 | case 'ListPartida': |
|
0 commit comments