<?php
// DOCUMENTS LIST REPORT //////////////////////////////////////////////////////////////////////////
$CFG['reportsManagement']['adminReport']['columnsList']['docsList'] = [
	'currentRowIndex'			=> [ 'type' => 'numeric',   'dbCol' => "INT(10) UNSIGNED NOT NULL DEFAULT '0'",             'cat' => "general"],
	'doc_id' 					=> [ 'type' => 'numeric',	'dbCol' => "BIGINT(15) UNSIGNED NOT NULL DEFAULT '0'", 			'cat' => "general"],
	'doc_typeCode' 				=> [ 'type' => 'string',	'dbCol' => "VARCHAR(50) NOT NULL DEFAULT ''", 					'cat' => "general"],
	'doc_typeName' 				=> [ 'type' => 'string', 	'dbCol' => "VARCHAR(100) NOT NULL DEFAULT ''", 					'cat' => "general"],
	'doc_number' 				=> [ 'type' => 'numeric', 	'dbCol' => "BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", 			'cat' => "general"],
	'doc_date' 					=> [ 'type' => 'date', 		'dbCol' => "DATE NULL", 										'cat' => "general"],
	'doc_dateYM' 				=> [ 'type' => 'yearMonth', 'dbCol' => "DATE NULL", 										'cat' => "general"],
	'doc_dateY' 				=> [ 'type' => 'year', 		'dbCol' => "DATE NULL", 										'cat' => "general"],
	'doc_format' 				=> [ 'type' => 'string', 	'dbCol' => "VARCHAR(10) NOT NULL DEFAULT ''", 					'cat' => "general"],
	'doc_generationType'		=> [ 'type' => 'string', 	'dbCol' => "ENUM ('manual', 'auto') NOT NULL DEFAULT 'manual'", 'cat' => "general"],
	'doc_idTemplate' 			=> [ 'type' => 'numeric', 	'dbCol' => "MEDIUMINT(8) NOT NULL DEFAULT '0'", 				'cat' => "general"],
	'doc_templateName' 			=> [ 'type' => 'string', 	'dbCol' => "VARCHAR(150) NOT NULL DEFAULT ''", 					'cat' => "general"],
	'doc_idSeries' 				=> [ 'type' => 'numeric', 	'dbCol' => "MEDIUMINT(8) NOT NULL DEFAULT '0'", 				'cat' => "general"],
	'doc_seriesCode' 			=> [ 'type' => 'string', 	'dbCol' => "VARCHAR(100) NOT NULL DEFAULT ''", 					'cat' => "general"],
	'doc_idAutoProcessRule'		=> [ 'type' => 'numeric', 	'dbCol' => "MEDIUMINT(8) NOT NULL DEFAULT '0'", 				'cat' => "general"],
	'doc_autoProcessRuleName'	=> [ 'type' => 'string', 	'dbCol' => "VARCHAR(100) NOT NULL DEFAULT ''", 					'cat' => "general"],
	'doc_comments' 				=> [ 'type' => 'string',    'dbCol' => "TEXT NOT NULL",                              		'cat' => "general"],
	'doc_isPreview' 			=> [ 'type' => 'boolean', 	'dbCol' => "TINYINT(1) UNSIGNED NOT NULL DEFAULT '0'",			'cat' => "general"],

	'pivot_id' 			=> [ 'type' => 'numeric',	'dbCol' => "BIGINT(15) UNSIGNED NOT NULL DEFAULT '0'",			'cat' => "general"],
	'pivot_code' 		=> [ 'type' => 'string',	'dbCol' => "ENUM('order','service','invoice','cashing','payment','balance','cashBookDoc','importedService','importedDocument') NOT NULL", 			'cat' => "general"],
	'pivot_name' 		=> [ 'type' => 'string',	'dbCol' => "VARCHAR(50) NOT NULL DEFAULT ''",					'cat' => "general"],

	'email_sent' 					=> [ 'type' => 'boolean',	'dbCol' => "TINYINT(1) UNSIGNED NOT NULL DEFAULT '0'",	'cat' => "emailDetails"],
	'email_senderEmailAddress'		=> [ 'type' => 'string', 	'dbCol' => "VARCHAR(150) NOT NULL DEFAULT ''", 			'cat' => "emailDetails", 'formula' => ['type' => 'entityValue', 'entType' => 'User', 'idEnt' => 'doc_addUserId', 'attr' => 'email']],
	'email_recipientsToEmailAddress'=> [ 'type' => 'string', 	'dbCol' => "VARCHAR(150) NOT NULL DEFAULT ''", 			'cat' => "emailDetails", 'formula' => ['type' => 'entityValue', 'entType' => 'Document', 'idEnt' => 'doc_id', 'attr' => 'email_recipientsToList']],
	'email_recipientsCcEmailAddress'=> [ 'type' => 'string', 	'dbCol' => "VARCHAR(150) NOT NULL DEFAULT ''", 			'cat' => "emailDetails", 'formula' => ['type' => 'entityValue', 'entType' => 'Document', 'idEnt' => 'doc_id', 'attr' => 'email_recipientsCcList']],
	'email_sendingDate' 			=> [ 'type' => 'datetime', 	'dbCol' => "DATETIME NULL DEFAULT NULL",  				'cat' => "emailDetails", 'formula' => ['type' => 'entityValue', 'entType' => 'Document', 'idEnt' => 'doc_id', 'attr' => 'email_sendingDate']],
	'email_hasAttachments' 			=> [ 'type' => 'boolean', 	'dbCol' => "TINYINT(1) UNSIGNED NOT NULL DEFAULT '0'",	'cat' => "emailDetails", 'formula' => ['type' => 'entityValue', 'entType' => 'Document', 'idEnt' => 'doc_id', 'attr' => 'email_hasAttachments']],
	'email_subject' 				=> [ 'type' => 'string', 	'dbCol' => "VARCHAR(150) NOT NULL DEFAULT ''", 			'cat' => "emailDetails", 'formula' => ['type' => 'entityValue', 'entType' => 'Document', 'idEnt' => 'doc_id', 'attr' => 'email_subject']],

	'doc_addUserId' 		=> [ 'type' => 'numeric',	'dbCol' => "SMALLINT(5) NOT NULL DEFAULT '0'", 			'cat' => "addDetails"],
	'doc_addUserName' 		=> [ 'type' => 'string', 	'dbCol' => "VARCHAR(101) NOT NULL DEFAULT ''", 			'cat' => "addDetails"],
	'doc_addUserOffId' 		=> [ 'type' => 'numeric', 	'dbCol' => "SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0'", 'cat' => "addDetails"],
	'doc_addUserOffName' 	=> [ 'type' => 'string', 	'dbCol' => "VARCHAR(150) NOT NULL DEFAULT ''", 			'cat' => "addDetails"],
	'doc_addUserDeptId' 	=> [ 'type' => 'numeric', 	'dbCol' => "SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0'", 'cat' => "addDetails"],
	'doc_addUserDeptName' 	=> [ 'type' => 'string', 	'dbCol' => "VARCHAR(100) NOT NULL DEFAULT ''", 			'cat' => "addDetails"],
	'doc_addTime' 			=> [ 'type' => 'datetime', 	'dbCol' => "DATETIME NULL", 							'cat' => "addDetails"],


	'customText01_name'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(100) NOT NULL DEFAULT ''",	'cat'=>"customTexts"],
	'customText01_val'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(500) NOT NULL DEFAULT ''",	'cat'=>"customTexts"],
	'customText02_name'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(100) NOT NULL DEFAULT ''",	'cat'=>"customTexts"],
	'customText02_val'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(500) NOT NULL DEFAULT ''",	'cat'=>"customTexts"],
	'customText03_name'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(100) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText03_val'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(500) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText04_name'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(100) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText04_val'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(500) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText05_name'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(100) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText05_val'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(500) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText06_name'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(100) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText06_val'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(500) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText07_name'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(100) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText07_val'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(500) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText08_name'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(100) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText08_val'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(500) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText09_name'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(100) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText09_val'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(500) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText10_name'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(100) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText10_val'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(500) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText11_name'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(100) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText11_val'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(500) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText12_name'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(100) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText12_val'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(500) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText13_name'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(100) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText13_val'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(500) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText14_name'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(100) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText14_val'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(500) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText15_name'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(100) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText15_val'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(500) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText16_name'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(100) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText16_val'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(500) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText17_name'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(100) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText17_val'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(500) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText18_name'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(100) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText18_val'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(500) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText19_name'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(100) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText19_val'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(500) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText20_name'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(100) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'customText20_val'	=> ['type'=>'string', 	'dbCol'=>"VARCHAR(500) NOT NULL DEFAULT ''", 	'cat'=>"customTexts"],
	'doc_fieldsDetails'	=> ['type'=>'string',	'dbCol'=>"TEXT NOT NULL", 						'cat'=>"customTexts", 'disabled' => true,],
];



// DATABASE FORCED COLUMNS ////////////////////////////////////////////////////////////////////////
$CFG['reportsManagement']['adminReport']['addForcedColumns']['docsList'] = [
	'doc_id'
];

// DATABASE COLUMNS DEPENDENCIES //////////////////////////////////////////////////////////////////
$CFG['reportsManagement']['adminReport']['columnsDependencies']['docsList'] = [
	'doc_typeName' => 				['doc_typeCode'],
	'doc_templateName' => 			['doc_idTemplate'],
	'doc_seriesCode' => 			['doc_idSeries'],
	'doc_autoProcessRuleName' => 	['doc_idAutoProcessRule'],
	'pivot_name' => 				['pivot_code'],
	'email_senderEmailAddress' => 	['doc_addUserId'],
	'doc_addUserOffName' => 		['doc_addUserOffId'],
	'doc_addUserDeptName' => 		['doc_addUserDeptId'],

	'customText01_val'	=> ['doc_fieldsDetails'],
	'customText01_name'	=> ['doc_fieldsDetails'],
	'customText02_val'	=> ['doc_fieldsDetails'],
	'customText02_name'	=> ['doc_fieldsDetails'],
	'customText03_val'	=> ['doc_fieldsDetails'],
	'customText03_name'	=> ['doc_fieldsDetails'],
	'customText04_val'	=> ['doc_fieldsDetails'],
	'customText04_name'	=> ['doc_fieldsDetails'],
	'customText05_val'	=> ['doc_fieldsDetails'],
	'customText05_name'	=> ['doc_fieldsDetails'],
	'customText06_val'	=> ['doc_fieldsDetails'],
	'customText06_name'	=> ['doc_fieldsDetails'],
	'customText07_val'	=> ['doc_fieldsDetails'],
	'customText07_name'	=> ['doc_fieldsDetails'],
	'customText08_val'	=> ['doc_fieldsDetails'],
	'customText08_name'	=> ['doc_fieldsDetails'],
	'customText09_val'	=> ['doc_fieldsDetails'],
	'customText09_name'	=> ['doc_fieldsDetails'],
	'customText10_val'	=> ['doc_fieldsDetails'],
	'customText10_name'	=> ['doc_fieldsDetails'],
	'customText11_val'	=> ['doc_fieldsDetails'],
	'customText11_name'	=> ['doc_fieldsDetails'],
	'customText12_val'	=> ['doc_fieldsDetails'],
	'customText12_name'	=> ['doc_fieldsDetails'],
	'customText13_val'	=> ['doc_fieldsDetails'],
	'customText13_name'	=> ['doc_fieldsDetails'],
	'customText14_val'	=> ['doc_fieldsDetails'],
	'customText14_name'	=> ['doc_fieldsDetails'],
	'customText15_val'	=> ['doc_fieldsDetails'],
	'customText15_name'	=> ['doc_fieldsDetails'],
	'customText16_val'	=> ['doc_fieldsDetails'],
	'customText16_name'	=> ['doc_fieldsDetails'],
	'customText17_val'	=> ['doc_fieldsDetails'],
	'customText17_name'	=> ['doc_fieldsDetails'],
	'customText18_val'	=> ['doc_fieldsDetails'],
	'customText18_name'	=> ['doc_fieldsDetails'],
	'customText19_val'	=> ['doc_fieldsDetails'],
	'customText19_name'	=> ['doc_fieldsDetails'],
	'customText20_val'	=> ['doc_fieldsDetails'],
	'customText20_name'	=> ['doc_fieldsDetails'],
];

// TABLE PRIMARY KEY (can be more columns, separated by comma) ////////////////////////////////////
$CFG['reportsManagement']['adminReport']['tablePrimaryKey']['docsList']='`doc_id`';
