<?php

///////////////////////////////////////////////////////////////////////////////////////////////////
// THE TOLERANCE FOR SERVICE FIN STATUS (IN ABSOLUTE VALUE); IF THE DIFFERENCE BETWEEN ////////////
// offerTotal AND invoicedTotal IS LESS THAN THIS TOLERANCE, THE  SERVICE IS CONSIDERED INVOICED //
// The value is always positive ///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
$CFG['invoices']['serviceFinStatusTolerance']=0.000099; // practicaly we allow values like 0.0001 or greater



///////////////////////////////////////////////////////////////////////////////////////////////////
// ROW TYPES THAT ALLOW ROUNDING //////////////////////////////////////////////////////////////////
// can be: 'advance', 'price', 'commission', 'discount', 'serviceFee', 'tax', 'penalty' ///////////
// also reversed/reversal rows can't be rounded ///////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
$CFG['invoices']['allowRoundingByRowType']['advance']=true;
$CFG['invoices']['allowRoundingByRowType']['price']=true;
$CFG['invoices']['allowRoundingByRowType']['serviceFee']=true;
$CFG['invoices']['allowRoundingByRowType']['commission']=true;
$CFG['invoices']['allowRoundingByRowType']['discount']=true;
$CFG['invoices']['allowRoundingByRowType']['tax']=true;
$CFG['invoices']['allowRoundingByRowType']['penalty']=true;


///////////////////////////////////////////////////////////////////////////////////////////////////
// INVOICE RESTRICTIONS OR SPECIAL CONFIGS (default the values are false - commented) /////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

// adjust and refresh the invoice rows so that large invoices with grouped rows keep an acurate VAT percent
//$CFG['invoices']['restrictions']['adjustInvoiceRowsVatsForLargeGroupedRowsInvoices']=false; // TODO: move it to Invoice Entity object

// block invoice if the total is exactly 0
//$CFG['invoices']['restrictions']['blockInvoiceIfTotalIsZero']=false; // TODO: de mutat acest config in config-ul clasei Invoice - e folosit numai de BG


///////////////////////////////////////////////////////////////////////////////////////////////////
// CASHED VALUE TOLERANCE (value represents the percent of invoice total - absolute value) - 0.01 means 1%
///////////////////////////////////////////////////////////////////////////////////////////////////
$CFG['invoiceCashing']['statusTolerancePercent']=0.0005; // 0.05 %


///////////////////////////////////////////////////////////////////////////////////////////////////
// DEFAULT FULFILLMENT DATE: value can be: 'servicesEndDate', 'maxOrderDate' or any other fixed value (null, TODAY_ISO, etc)
///////////////////////////////////////////////////////////////////////////////////////////////////
$CFG['invoices']['defaultFulfillmentDate']='servicesEndDate';


///////////////////////////////////////////////////////////////////////////////////////////////////
// SUPPLIER INVOICES CONFIGS //////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

// PAYED VALUE TOLERANCE (value is percent of invoice total - absolute value) -0.01 means 1% //////
$CFG['supplierInvoicePayment']['statusTolerancePercent']=0.0001;


///////////////////////////////////////////////////////////////////////////////////////////////////
// CORPORATE COLLECTION ATTACHMENTS ///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
$CFG['corporateCollectionProfiles']['attachmentsList'] = ['DefaultXlsx', 'ExtendedXlsx'];
$CFG['corporateCollectionProfiles']['variablesList'] = ['overdueTotalDefCurr', 'dueInDaysTotalDefCurr', 'overdueTotalOrgCurr', 'dueInDaysTotalOrgCurr', 'overdueInvoicesMinDate', 'overdueInvoicesMaxDate', 'importedDocumentsBalanceDefCurr', 'corporateFullName', 'corporateAlias'];

///////////////////////////////////////////////////////////////////////////////////////////////////
// CUSTOMER COLLECTION ////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
$CFG['customerCollectionProfiles']['variablesList'] = [
	'invoiceId', 'invoiceNumber', 'invoiceSeries', 'invoiceDateIso', 'invoiceDate',
	'invoiceDueDateIso', 'invoiceDueDate', 'invoiceDueInDays', 'invoiceOverdueDays',
	'invoiceCurrency', 'invoiceTotalInvCurr', 'invoiceCashedInvCurr', 'invoiceNotCashedInvCurr',
	'customerLastName', 'customerFirstName', 'customerTitle', 'customerEmail'
];

///////////////////////////////////////////////////////////////////////////////////////////////////
// CASHBOOK SETTINGS //////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

// MANUAL DOCUMENT TYPES //////////////////////////////////////////////////////////////////////////
$CFG['cashBook']['documentTypes']['cashing']= [
	'receipt'=> ['active'=>true, 'includeInCashbook'=>true],
	'cashReceiveDocument'=> ['active'=>true, 'includeInCashbook'=>true],
	'bankWithdrawl'=> ['active'=>true, 'includeInCashbook'=>true],
	'adjustment'=> ['active'=>true, 'includeInCashbook'=>true],
	'exchRateDifference'=> ['active'=>false, 'includeInCashbook'=>true],
	'depreciation'=> ['active'=>false, 'includeInCashbook'=>true],
	'credit'=> ['active'=>false, 'includeInCashbook'=>true],
	'cheque'=> ['active'=>false, 'includeInCashbook'=>false],
	'cashDepositFromBank'=> ['active'=>true, 'includeInCashbook'=>true],
	'travelVoucher'=> ['active'=>false, 'includeInCashbook'=>false],
	'giftVoucher'=> ['active'=>false, 'includeInCashbook'=>false],
	'user2user'=> ['active'=>false, 'includeInCashbook'=>false], // is not treated as a normal document type, after eliminating cashbok per user
];
$CFG['cashBook']['documentTypes']['payment']= [
	'receipt'=> ['active'=>true, 'includeInCashbook'=>true],
	'cashOut'=> ['active'=>false, 'includeInCashbook'=>true],
	'cashReturnDocument'=> ['active'=>true, 'includeInCashbook'=>true],
	'fiscalTicket'=> ['active'=>true, 'includeInCashbook'=>true],
	'cashOrder'=> ['active'=>true, 'includeInCashbook'=>true],
	'paymentPaper'=> ['active'=>true, 'includeInCashbook'=>true],
	'adjustment'=> ['active'=>true, 'includeInCashbook'=>true],
	'exchRateDifference'=> ['active'=>false, 'includeInCashbook'=>true],
	'depreciation'=> ['active'=>false, 'includeInCashbook'=>true],
	'credit'=> ['active'=>false, 'includeInCashbook'=>true],
	'settlement'=> ['active'=>false, 'includeInCashbook'=>true],
	'cheque'=> ['active'=>false, 'includeInCashbook'=>false],
	'bankDepositFromCash'=> ['active'=>true, 'includeInCashbook'=>true],
	'travelVoucher'=> ['active'=>false, 'includeInCashbook'=>false],
	'giftVoucher'=> ['active'=>false, 'includeInCashbook'=>false],
	'user2user'=> ['active'=>false, 'includeInCashbook'=>false], // is not treated as a normal document type, after eliminating cashbok per user
];

///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
// ADD/EDIT INVOICE PREVIEW VISUAL STRUCTURE: INDICATES THE POSITION OF THE BOXES (INVOICE, ///////
// CLIENT, SUPPLIER) //////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

// 'boxLeft' CAN HAVE THE VALUES: 'supplierAndInvoice' OR 'client' ////////////////////////////////
$CFG['generateInvoice']['visualStructure']['invoiceTop']['boxLeft']="supplierAndInvoice";

// 'boxTop' CAN HAVE THE VALUES: 'supplier' OR 'invoice' //////////////////////////////////////////
$CFG['generateInvoice']['visualStructure']['invoiceTop']['boxTop']="supplier";

// INDICATES IF THE CURRENCY DATE OF SERVICES ON AN INVOICE IS COMPARED WITH THE INVOICE DATE /////
$CFG['invoices']['compareServiceCurrencyDateWithInvoiceDate']=true;


// balance supplier invoices should be confirmed
$CFG['balances']['supplierInvoiceConfirmed']=false;

