<?php

namespace App\ReportsData\EntityList;

class SupplierInvoiceRows extends GeneralAbstract
{

	/**
	 * {@inheritDoc}
	 * @see \App\EntityList\GeneralAbstract::loadDbTablesCfgs()
	 */
	protected function loadDbTablesCfgs(): void
	{
		// store the table name
		global $DBTRd_supplierInvoices, $DBTRd_supplierInvoiceRows;

		$this->setMainTable($DBTRd_supplierInvoiceRows, 'suppInvRow');
		$this->addAllowedTable($DBTRd_supplierInvoices, 'suppInv', 'suppInv.id=suppInvRow.idInvoice', 'INNER');
	}

	/**
	 * This is a special case, as we need to filter the deleted invoices, so we will always join with this table.
	 */
	public function setDefaultFilters(): void
	{
		$this->setFilter("suppInv.deleted", '=', '0');
	}

}

