<?php

// TODO: sa se poata configura daca o coloana este de tipul "array" - sa se faca array2string sau unserialize ca sa se poata extrage o informatie de acolo.


// TODO: sa ascundem sursele vechi de aici si sa le stergem si din config personale
///////////////////////////////////////////////////////////////////////////////////////////////////
// LIST OF SOURCES - FOR REPORTS //////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
$CFG['reportsManagement']['adminReport']['sourcesList']['clientInvoices']			= ['active' => true, 'category' => 'financial'];
$CFG['reportsManagement']['adminReport']['sourcesList']['clientInvoiceRows']		= ['active' => true, 'category' => 'financial'];
$CFG['reportsManagement']['adminReport']['sourcesList']['invoicedServices']			= ['active' => true, 'category' => 'financial'];
$CFG['reportsManagement']['adminReport']['sourcesList']['invoiceCashingDocs']		= ['active' => true, 'category' => 'financial'];
$CFG['reportsManagement']['adminReport']['sourcesList']['supplierInvoices']			= ['active' => true, 'category' => 'financial'];
$CFG['reportsManagement']['adminReport']['sourcesList']['supplierInvoiceRows']		= ['active' => true, 'category' => 'financial'];
$CFG['reportsManagement']['adminReport']['sourcesList']['invoicePaymentDocs']		= ['active' => true, 'category' => 'financial'];
$CFG['reportsManagement']['adminReport']['sourcesList']['balancesList']				= ['active' => true, 'category' => 'financial'];
$CFG['reportsManagement']['adminReport']['sourcesList']['balancedRows']				= ['active' => true, 'category' => 'financial'];
$CFG['reportsManagement']['adminReport']['sourcesList']['unbalancedRows']			= ['active' => true, 'category' => 'financial'];
$CFG['reportsManagement']['adminReport']['sourcesList']['importedDocs']				= ['active' => true, 'category' => 'financial'];
$CFG['reportsManagement']['adminReport']['sourcesList']['cashingPaymentDocs']		= ['active' => true, 'category' => 'financial'];
$CFG['reportsManagement']['adminReport']['sourcesList']['orderServices']			= ['active' => true, 'category' => 'operational'];
$CFG['reportsManagement']['adminReport']['sourcesList']['ordersList']				= ['active' => true, 'category' => 'operational'];
$CFG['reportsManagement']['adminReport']['sourcesList']['ticketing']				= ['active' => true, 'category' => 'operational'];
$CFG['reportsManagement']['adminReport']['sourcesList']['docsList']					= ['active' => true, 'category' => 'operational'];
$CFG['reportsManagement']['adminReport']['sourcesList']['tasks']					= ['active' => true, 'category' => 'operational'];
$CFG['reportsManagement']['adminReport']['sourcesList']['importedServices']			= ['active' => true, 'category' => 'operational'];
$CFG['reportsManagement']['adminReport']['sourcesList']['corporates']				= ['active' => true, 'category' => 'lists'];
$CFG['reportsManagement']['adminReport']['sourcesList']['corporateOffices']			= ['active' => true, 'category' => 'lists'];
$CFG['reportsManagement']['adminReport']['sourcesList']['suppliers']				= ['active' => true, 'category' => 'lists'];
$CFG['reportsManagement']['adminReport']['sourcesList']['supplierProducts']			= ['active' => true, 'category' => 'lists'];
$CFG['reportsManagement']['adminReport']['sourcesList']['customers']				= ['active' => true, 'category' => 'lists'];
$CFG['reportsManagement']['adminReport']['sourcesList']['corporateContactPersons']	= ['active' => true, 'category' => 'lists'];
$CFG['reportsManagement']['adminReport']['sourcesList']['supplierContactPersons']	= ['active' => true, 'category' => 'lists'];
$CFG['reportsManagement']['adminReport']['sourcesList']['corporateContracts']		= ['active' => true, 'category' => 'lists'];
$CFG['reportsManagement']['adminReport']['sourcesList']['supplierContracts']		= ['active' => true, 'category' => 'lists'];
$CFG['reportsManagement']['adminReport']['sourcesList']['corporateContacts']		= ['active' => true, 'category' => 'lists'];
$CFG['reportsManagement']['adminReport']['sourcesList']['usersAccess']				= ['active' => true, 'category' => 'lists'];
$CFG['reportsManagement']['adminReport']['sourcesList']['usersProfilesAccess']		= ['active' => true, 'category' => 'lists'];
$CFG['reportsManagement']['adminReport']['sourcesList']['users']					= ['active' => true, 'category' => 'lists'];
$CFG['reportsManagement']['adminReport']['sourcesList']['usersVisits']				= ['active' => true, 'category' => 'misc'];
$CFG['reportsManagement']['adminReport']['sourcesList']['generatedReports']			= ['active' => true, 'category' => 'misc'];

///////////////////////////////////////////////////////////////////////////////////////////////////
// NAME OF FILES //////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

// NAME OF THE REPORT INPUT FILE (storing the serialized data) ------------------------------------
$CFG['reportsGeneration']['generation']['inputDataFileName']="input.ser";
// NAME OF THE REPORT OUTPUT FILE (only used on CLI) ----------------------------------------------
$CFG['reportsGeneration']['generation']['outputLogFileName']="output.log";




///////////////////////////////////////////////////////////////////////////////////////////////////
// PHASES AND STEPS ///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

// START PHASES ///////////////////////////////////////////////////////////////////////////////////
$CFG['reportsManagement']['adminReport']['startPhases']= [
	'start'=> [
		'prepareVars'=>100,
	]
];


// ENDING PHASES //////////////////////////////////////////////////////////////////////////////////
$CFG['reportsManagement']['adminReport']['endingPhases']= [
	'customColumns'=> [
		'populateCustomColumns'=>100,
	],
	'customFilters'=> [
		'applyCustomFilters'=>100,
	],
	'writeReport'=> [
		'indexingColumns'=>7,
		'initialize'=>3,
		'writeFile'=>90,
	],
	'pivotTables'=> [
		'generatingPivots'=>100,
	],
	'extraOptions'=> [
		'sendReportsByEmail'=>100,
	],
];


///////////////////////////////////////////////////////////////////////////////////////////////////
// REPORT FILES STORED ON DISK ////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
$CFG['reportsGeneration']['outputFileNameByFormat']['xlsXml']='report.xls';
$CFG['reportsGeneration']['outputFileNameByFormat']['html']='report.html';


///////////////////////////////////////////////////////////////////////////////////////////////////
// CHECK SERVER LOAD (if above this value, sleeps for x seconds) //////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
$CFG['reportsGeneration']['serverLoad']['sleepTime']=20; // in seconds


///////////////////////////////////////////////////////////////////////////////////////////////////
// LIMIT CONCURRENT GENERATION OF REPORTS /////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
$CFG['reportsGeneration']['concurrentGeneration']['manualGenerationsPerUser']=3;
$CFG['reportsGeneration']['concurrentGeneration']['manualGenerationsGlobal']=10;
$CFG['reportsGeneration']['concurrentGeneration']['autoGenerationsGlobal']=5;


///////////////////////////////////////////////////////////////////////////////////////////////////
// SEND REPORTS BY EMAIL //////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

// REPORT FILE MAX SIZE [B] FOR SENDING BY EMAIL (IF SIZE IS EXCEEDED, THE REPORT IS NOT ATTACHED)/
// THE MAX SIZE APPLIES TO REPORT, PIVOTS, EXTRA REPORTS. /////////////////////////////////////////
$CFG['reportsGeneration']['sendEmail']['emailMaxFileSize']=20971520; // 20MB

// REPORTS ARCHIVE NAME ///////////////////////////////////////////////////////////////////////////
$CFG['reportsGeneration']['sendEmail']['emailRecipients']['archiveFileName']="reports.zip";

// ALWAYS SEND ARCHIVE VIA EMAIL //////////////////////////////////////////////////////////////////
$CFG['reportsGeneration']['sendEmail']['emailRecipients']['alwaysArchiveViaEmail'] = true;


// only these sources are tested by re-generating using the new format and the initial generation must take less than this number of seconds;
// you can input 0 in order to skip a certain report source
$CFG['reportsGeneration']['compatibleRefactor']['allowSources'] = [ // time [seconds], cells [number of cells]
	'clientInvoices'			=> ['time'=>300, 'cells'=>800000],
	'clientInvoiceRows'			=> ['time'=>300, 'cells'=>800000],
 	'invoicedServices'			=> ['time'=>400, 'cells'=>800000],
	'invoiceCashingDocs'		=> ['time'=>180, 'cells'=>800000],
	'supplierInvoices'			=> ['time'=>180, 'cells'=>800000],
	'supplierInvoiceRows'		=> ['time'=>300, 'cells'=>800000],
 	'invoicePaymentDocs'		=> ['time'=>240, 'cells'=>800000],
	'balancesList'				=> ['time'=>240, 'cells'=>800000],
 	'balancedRows'				=> ['time'=>240, 'cells'=>800000],
 	'unbalancedRows'			=> ['time'=>240, 'cells'=>800000],
 	'importedDocs'				=> ['time'=>240, 'cells'=>800000],
	'cashingPaymentDocs'		=> ['time'=>240, 'cells'=>800000],
 	'orderServices'				=> ['time'=>300, 'cells'=>800000],
	'ordersList'				=> ['time'=>300, 'cells'=>800000],
 	'ticketing'					=> ['time'=>360, 'cells'=>800000],
 	'docsList'					=> ['time'=>180, 'cells'=>800000],
 	'tasks'						=> ['time'=>60,  'cells'=>800000],
 	'importedServices'			=> ['time'=>300, 'cells'=>800000],
 	'corporates'				=> ['time'=>180, 'cells'=>800000],
 	'corporateOffices'			=> ['time'=>120, 'cells'=>800000],
 	'suppliers'					=> ['time'=>90,  'cells'=>800000],
 	'supplierProducts'			=> ['time'=>90,  'cells'=>800000],
 	'customers'					=> ['time'=>180, 'cells'=>800000],
 	'corporateContactPersons'	=> ['time'=>180, 'cells'=>800000],
 	'supplierContactPersons'	=> ['time'=>180, 'cells'=>800000],
 	'corporateContracts'		=> ['time'=>180, 'cells'=>800000],
 	'supplierContracts'			=> ['time'=>180, 'cells'=>800000],
 	'corporateContacts'			=> ['time'=>180, 'cells'=>800000],
 	'usersAccess'				=> ['time'=>45,  'cells'=>800000],
 	'usersProfilesAccess'		=> ['time'=>45,  'cells'=>800000],
 	'users'						=> ['time'=>45,  'cells'=>800000],
	'usersVisits'				=> ['time'=>240, 'cells'=>800000],
 	'generatedReports'			=> ['time'=>90,  'cells'=>800000],
];

