

/*

https://app-v2.focusnfe.com.br
see the suppliers liste

Authentique
support@bitcarvers.com
sdjkauAhT.11

//https://wifi1.impacthub.community/hotspot/?ap=fc:ec:da:fc:5b:d5&id=test:22:fb:27:d8:d8&t=1594985233&url=http://captive.apple.com%2fhotspot-detect.html&ssid=ImpactHub_2G
//http://46.28.110.128/hotspot/?ap=fc:ec:da:fc:5b:d5&id=test:22:fb:27:d8:d8&t=1594985233&url=http://captive.apple.com%2fhotspot-detect.html&ssid=ImpactHub_2G

*/

	
	$DOMAIN["name"] = 'Floripa';
	$DOMAIN["currency"] = 'R$';
	$DOMAIN['invoiceName'] = "Invoice No. ";
	$DOMAIN['invoice2Name'] = "Correction receipt Nr. ";
	$DOMAIN["stornoService"] = 26;
	$DOMAIN["changeService"] = 25;
	$DOMAIN['manualAccounts'] = array();
	$DOMAIN['manualSymbols'] = array();
	
	$DOMAIN['swift'] = "GIBAATWMXXX";
	$DOMAIN['iban'] = "BR302011129251651600";
	
	// Invoicing details
	define('DEBIT_ROUNDING_LIMIT', 5); // Minimal amount of account's debt to be allowed for direct debit
	define('INVOICE_ROUNDING_LIMIT', 0.5); // Minimum unpaid invoice amount to indicate it as unpaid
	define('DEFAULT_DUE_INTERVAL', 7); // Default invoice due to interval (adds to invoice's issued date)
	define('MINIMUM_FIRST_NOTIFICATION_INTERVAL', 14); // Interval from invoice's issued date to notify account the invoice is not paid
	define('INVOICE_NOTIFY_INTERVAL', 4); // Minimum interval between 2 unpaid invoice notifications
	
	
	
	function locationToEntity($obj, $forceNew = false) {
	    $e = 1; // Default
	    
	    if ($obj['location'] == 2) {
	        $e = 2;
	    } else if ($obj['location'] == 4) {
	        $e = 3;
	    } else if ($obj['service']['serviceEntity'] == 4 || $obj['location'] == 6) {
	        // bewiky
	        $e = 4;
	    } else if ($obj['service']['serviceEntity'] == 5 || $obj['location'] == 8) {
	        // trajano, centro
	        $e = 5;
	    } else if ($obj['service']['serviceEntity'] == 6 || $obj['location'] == 10) {
	        // Porto alegre
	        $e = 6;
	    } else if ($obj['service']['serviceEntity'] == 7 || $obj['location'] == 7) {
	        // sapiens -> primavera
	        //if ($forceNew || (isset($obj['account']['organisation']['newerInvoicingEntities']) && $obj['account']['organisation']['newerInvoicingEntities'])) {
	        $e = 7; // sapiens je pouzity pro kontrakty
	        //} else {
	        //    $e = 1;
	        //}
	    } else if ($obj['location'] == 12) {
	        // seo-pejota -> primavera
	        $e = 1;
	    } else if (isset($obj['service']['taxCode']) && in_array($obj['service']['taxCode'], ['8440/8599604', '8718/7020400'])) {
	        // BRAVA
	        $e = 8;
	    }
	    
	    return $e;
	}
	
	
	function floripaSetReceivedDate() {
	    
	    // Set date received HUBLE-26575
	    
	    SQL::query("UPDATE payment SET receivedWhen = paidWhen WHERE method NOT IN (".comma(PaymentMethod::CARD_ASAAS, PaymentMethod::BLIMBOO, PaymentMethod::BLIMBOO_DEBIT).") AND receivedWhen IS NULL AND paidWhen IS NOT NULL");
	    
	    
	    $mapping = [];
	    foreach (mysqlObjects("SELECT id, name FROM entity WHERE id != 4") as $entity) {
	        dbg("floripaSetReceivedDate for entity $entity[id]");
	        
	        $asaasKeys = getAsaasKeysForEntity($entity['id']);
	        
	        $offset = 0;
	        $pageLength = 100;
	        
	        getAsaasnewPaymentsxxx:
	        $asaasKeys = getAsaasKeysForEntity($entity['id']);
	        
	        if (startsWith($asaasKeys['token'], '?')) continue; // skip if it is with ?
	        
	        
	        $params = [
	            'creditDate[ge]' => rToday(ST(rToday().' - 60 DAY')),
	            'creditDate[le]' => rToday(),
	            'limit' => $pageLength,
	            'offset' => $offset
	        ];
	        $result = asaasCall($asaasKeys, 'GET:v3/payments', $params);
	        if ($result['http_code'] == 200) {
	            
	            //echoh2("Offset: $offset (page per $pageLength)");
	            
	            $data = json_decode($result['content'], true);
	            
	            
	            foreach ($data['data'] as $did => $d) {
	                if (in_array($d['billingType'], ['CREDIT_CARD'])) {
	                    if ($d['status'] == 'RECEIVED' && $d['value'] > 0) {
	                        $mapping[$d['confirmedDate']] = $d['creditDate'];
	                        //echo('<tr><td>'.$d['billingType'].'</td><td>'.$d['confirmedDate'].'</td><td>'.$d['paymentDate'].'</td><td>'.$d['creditDate'].'</td></tr>');
	                    }
	                }
	            }
	            
	            if ($data['hasMore']) {
	                $offset += $pageLength;
	                goto getAsaasnewPaymentsxxx;
	            }
	            
	        }
	        
	        
	    }
	    
	    
	    foreach ($mapping as $paidWhen => $receivedWhen) {
	        echodiv("$paidWhen -> $receivedWhen");
	        SQL::update("payment", "method = ".PaymentMethod::CARD_ASAAS." AND receivedWhen IS NULL AND paidWhen = '".escape($paidWhen)."'", ['receivedWhen' => $receivedWhen]);
	    }
	    
	}
	
	
	function filterCEP($cep) {
		$cep = normalizeCEP($cep);
		if (mb_strlen($cep) <= 7) {
			return false;
		}
		if (sqlCount("organisation", "zip = '$cep' OR zip = '".escape(normalizeCEP($cep))."'") > 0) return true;
		/*
		 rErrorReporting(false);
		 $content = file_get_contents("http://cep.republicavirtual.com.br/web_cep.php?formato=xml&cep=$cep");
		 rErrorReporting(true);
		 if (!$content) return true;
		 if (strpos($content, "cep completo") === false) {
		 return false;
		 }
		 */
		return true;
	}
		
	function normalizeCEP($cep) {
		$cep = generateFriendly($cep, "0-9", "");
		return $cep;
	}
	
	function filterCPF($cpf) {
	
		$cpf = preg_replace('/\D/', '', $cpf);
	
		if ( strlen( $cpf ) != 11 ) {
			return false;
		}
	
		if( preg_match( '/^(\d{1})\1{10}$/', $cpf ) ) {
			return false;
		}
	
		$sum = 0;
		for( $i = 0; $i < 9; $i++ ) {
			$sum += $cpf[$i] * (10-$i);
		}
		$mod = $sum % 11;
		$digit = ($mod > 1) ? (11 - $mod) : 0;
	
		if ($cpf[9] != $digit) {
			return false;
		}
	
		$sum = 0;
		for ($i = 0; $i < 10; $i++) {
			$sum += $cpf[$i] * (11-$i);
		}
		$mod = $sum % 11;
		$digit = ($mod > 1) ? (11 - $mod) : 0;
	
		if ($cpf[10] != $digit){
			return false;
		}
		return true;
	}
	
	
	function cardType($number) {

		$number = str_replace("*", "0", $number);
	
		$number=preg_replace('/[^\d]/','',$number);
		if (preg_match('/^3[47][0-9]{13}$/',$number))
		{
			return 'amex'; //::AMEX;
		}
		elseif (preg_match('/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/',$number))
		{
			return 'diners'; //::DINERS;
		}
		elseif (preg_match('/^6(?:011|5[0-9][0-9])[0-9]{12}$/',$number))
		{
			return 'discover'; //::DISCOVER;
		}
		elseif (preg_match('/^(?:2131|1800|35\d{3})\d{11}$/',$number))
		{
			return 'jcb'; //::JCB;
		}
		elseif (preg_match('/^5[1-5][0-9]{14}$/',$number))
		{
			return 'mastercard'; //::MASTERCARD;
		}
		elseif (preg_match('/^4[0-9]{12}(?:[0-9]{3})?$/',$number))
		{
			return 'visa'; //PaymentMethod::VISA;
		}
		else
		{
			return 'visa'; // Other
			exit;
		}
	}
	
	
	function outNFF($num) {
		return number_format($num, 2, '.', '');
	}


	function getIGPMForMonth($dateStart, $dateEnd) {
		$fromCache = true;
		if (strtotime($dateEnd) > strtotime(rToday())) {
			$fromCache = false;
			$dateEnd = rToday();
		}
		
		$dateStart = explode('-', $dateStart);
		$dateEnd = explode('-', $dateEnd);
		
		$cache = mysqlSimpleObjectCond("brazil_igpm_cache", "
			year1 = $dateStart[0] AND month1 = $dateStart[1] 
			AND year2 = $dateEnd[0] AND month2 = $dateEnd[1] 
			");
		
		if ($cache) return $cache['value'];
		
		$result = rcurl_get_web_page("https://www3.bcb.gov.br/CALCIDADAO/publico/corrigirPorIndice.do?method=corrigirPorIndice", array(
			'aba' => 1,
			'selIndice' => '00189IGP-',
			'dataInicial' => $dateStart[1].'/'.$dateStart[0],
			'dataFinal' => $dateEnd[1].'/'.$dateEnd[0],
			'valorCorrecao' => '100,00'
		));
	
		if ($result['http_code'] != 200) {
			rSupportEmail("Problem calling https://www3.bcb.gov.br/CALCIDADAO/publico/corrigirPorIndice.do", $result);
			return null;
		}
	
		$val = (float) str_replace(",", '.', mb_strbetween('">', " %", mb_strbetween("percentual", "%</td>", $result['content'])));
	
		$val = $val / 100;
		
		
		mysqlUpdateObject("brazil_igpm_cache", null, array(
			'year1' => $dateStart[0],
			'month1' => $dateStart[1],
			'year2' => $dateEnd[0],
			'month2' => $dateEnd[1],
			'value' => $val	
		));
		
		return $val;
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	

	$NFECodesData = array();
	$NFECodesData[] = array(
			array('11689/8230001', uf_strict('SERVIÇOS DE ORGANIZAÇÃO DE FEIRAS, CONGRESSOS, EXPOSIÇÕES E FESTAS')),
			array('8230001', ''),
			2
	);
	$NFECodesData[] = array(
			array('2511/8211300', 'Serviço de espaços para desenvolvimento organizacional'),
			array('8211300', ''),
			2
	);
	$NFECodesData[] = array(
			array('8440/8599604', 'Treinamento em desenvolvimento profissional e gerencial'),
			array('8599604', ''),
			3
	);
	$NFECodesData[] = array(
			array('8718/7020400', 'Atividades de Consultoria em gestão empresarial, exceto consultoria técnica especifíca'),
			array('7020400', ''),
			5
	);
	$NFECodesData[] = array(
			array('9001901/9001901', 'Produção teatral'),
			array('9001901', ''),
			2
	);
	$NFECodesData[] = array(
		array('9001902/9001902', 'Produção musical'),
		array('9001902', ''),
		2
	);
	$NFECodesData[] = array(
		array('7311400/7311400', 'Agências de publicidade'),
		array('7311400', ''),
		2.5
	);
	// HUBLE-27878
	$NFECodesData[] = array(
		array('5819100/5819100', 'Edição de cadastros, listas e de outros produtos gráficos'),
		array('5819100', ''),
		5
	);
	$NFECodesData[] = array(
		array('6319400/6319400', 'Portais, provedores de conteúdo e outros serviços de informação na internet'),
		array('6319400', ''),
		2
	);
	$NFECodesData[] = array(
		array('5914600/5914600', 'Atividades de exibição cinematográfica'),
		array('5914600', ''),
		2
	);
	$NFECodesData[] = array(
		array('9001999/9001999', 'Artes cênicas, espetáculos e atividades complementares não especificadas anteriormente'),
		array('9001999', ''),
		2
	);
	$NFECodesData[] = array(
		array('6204000/6204000', 'Consultoria em tecnologia da informação'),
		array('6204000', ''),
		2
	);
	$NFECodesData[] = array(
		array('7410299/7410299', 'Atividades de design não especificadas anteriormente'),
		array('7410299', ''),
		3
	);
	$NFECodesData[] = array(
		array('7420001/7420001', 'Atividades de produção de fotografias, exceto aérea e submarina'),
		array('7420001', ''),
		5
	);
	$NFECodesData[] = array(
		array('74900104/74900104', 'Atividades de intermediação e agenciamento de serviços e negócios em geral, exceto imobiliários'),
		array('74900104', ''),
		3
	);
	
	// retentionType
	
	// 1 = ir/irrf
	// 2 = csfr (not used, cumulative 3+4+5)
	// 3 = pis
	// 4 = cofins
	// 5 = csll
	
	// Default Retentions
	// https://docs.google.com/spreadsheets/d/1OsZQ6cvTI5wtd73yLkPAybHf3k8aPXxq/edit?gid=1866940403#gid=1866940403
	// HUBLE-27493
	// https://docs.google.com/spreadsheets/d/1OsZQ6cvTI5wtd73yLkPAybHf3k8aPXxq/edit?gid=1866940403#gid=1866940403
	// remove after accepting HUBLE-26278
	// HUBLE-27878
	// HUBLE-27493
	
	$DomainRetentions['8718/7020400'] = [
		// OK2
		array('retentionType' => 1, 'value' => 1.50, 'minval' => 10, 'minvalGroup' => null),
		array('retentionType' => 3, 'value' => 0.65, 'minval' => 10, 'minvalGroup' => 1),
	    array('retentionType' => 4, 'value' => 3.00, 'minval' => 10, 'minvalGroup' => 1),
	    array('retentionType' => 5, 'value' => 1.00, 'minval' => 10, 'minvalGroup' => 1),
	];
	$DomainRetentions['8440/8599604'] = [
		// OK2
		array('retentionType' => 1, 'value' => 1.50, 'minval' => 10, 'minvalGroup' => null),
		array('retentionType' => 3, 'value' => 0.65, 'minval' => 10, 'minvalGroup' => 1),
	    array('retentionType' => 4, 'value' => 3.00, 'minval' => 10, 'minvalGroup' => 1),
	    array('retentionType' => 5, 'value' => 1.00, 'minval' => 10, 'minvalGroup' => 1),
	];
	$DomainRetentions['11689/8230001'] = [
		// OK2
	    // No retentions - HUBLE-41411
		// array('retentionType' => 1, 'value' => 1.50, 'minval' => 10, 'minvalGroup' => null),
		// array('retentionType' => 3, 'value' => 0.65, 'minval' => 10, 'minvalGroup' => 1),
	    // array('retentionType' => 4, 'value' => 3.00, 'minval' => 10, 'minvalGroup' => 1),
	    // array('retentionType' => 5, 'value' => 1.00, 'minval' => 10, 'minvalGroup' => 1),
	];
	$DomainRetentions['9001901/9001901'] = [
		// OK2
		array('retentionType' => 1, 'value' => 1.50, 'minval' => 10, 'minvalGroup' => null),
		array('retentionType' => 3, 'value' => 0.65, 'minval' => 10, 'minvalGroup' => 1),
	    array('retentionType' => 4, 'value' => 3.00, 'minval' => 10, 'minvalGroup' => 1),
	    array('retentionType' => 5, 'value' => 1.00, 'minval' => 10, 'minvalGroup' => 1),
	];
	$DomainRetentions['9001902/9001902'] = [
		// OK2
		array('retentionType' => 1, 'value' => 1.50, 'minval' => 10, 'minvalGroup' => null),
		array('retentionType' => 3, 'value' => 0.65, 'minval' => 10, 'minvalGroup' => 1),
	    array('retentionType' => 4, 'value' => 3.00, 'minval' => 10, 'minvalGroup' => 1),
	    array('retentionType' => 5, 'value' => 1.00, 'minval' => 10, 'minvalGroup' => 1),
	];
	$DomainRetentions['7311400/7311400'] = [
		array('retentionType' => 1, 'value' => 1.50, 'minval' => 10, 'minvalGroup' => null),
	];
	$DomainRetentions['6319400/6319400'] = [
		array('retentionType' => 1, 'value' => 1.50, 'minval' => 10, 'minvalGroup' => null),
		array('retentionType' => 3, 'value' => 0.65, 'minval' => 10, 'minvalGroup' => 1),
	    array('retentionType' => 4, 'value' => 3.00, 'minval' => 10, 'minvalGroup' => 1),
	    array('retentionType' => 5, 'value' => 1.00, 'minval' => 10, 'minvalGroup' => 1),
	];
	$DomainRetentions['5914600/5914600'] = [
		array('retentionType' => 1, 'value' => 1.50, 'minval' => 10, 'minvalGroup' => null),
		array('retentionType' => 3, 'value' => 0.65, 'minval' => 10, 'minvalGroup' => 1),
	    array('retentionType' => 4, 'value' => 3.00, 'minval' => 10, 'minvalGroup' => 1),
	    array('retentionType' => 5, 'value' => 1.00, 'minval' => 10, 'minvalGroup' => 1),
	];
	$DomainRetentions['9001999/9001999'] = [
		array('retentionType' => 1, 'value' => 1.50, 'minval' => 10, 'minvalGroup' => null),
		array('retentionType' => 3, 'value' => 0.65, 'minval' => 10, 'minvalGroup' => 1),
	    array('retentionType' => 4, 'value' => 3.00, 'minval' => 10, 'minvalGroup' => 1),
	    array('retentionType' => 5, 'value' => 1.00, 'minval' => 10, 'minvalGroup' => 1),
	];
	$DomainRetentions['6204000/6204000'] = [
		array('retentionType' => 1, 'value' => 1.50, 'minval' => 10, 'minvalGroup' => null),
		array('retentionType' => 3, 'value' => 0.65, 'minval' => 10, 'minvalGroup' => 1),
	    array('retentionType' => 4, 'value' => 3.00, 'minval' => 10, 'minvalGroup' => 1),
	    array('retentionType' => 5, 'value' => 1.00, 'minval' => 10, 'minvalGroup' => 1),
	];
	$DomainRetentions['7410299/7410299'] = [
		array('retentionType' => 1, 'value' => 1.50, 'minval' => 10, 'minvalGroup' => null),
		array('retentionType' => 3, 'value' => 0.65, 'minval' => 10, 'minvalGroup' => 1),
	    array('retentionType' => 4, 'value' => 3.00, 'minval' => 10, 'minvalGroup' => 1),
	    array('retentionType' => 5, 'value' => 1.00, 'minval' => 10, 'minvalGroup' => 1),
	];
	/*
	$DomainRetentions['7490104/7490104'] = [
		array('retentionType' => 1, 'value' => 1.50, 'minval' => 10, 'minvalGroup' => null),
	    array('retentionType' => 3, 'value' => 0.65, 'minval' => 10, 'minvalGroup' => 1),
	    array('retentionType' => 4, 'value' => 3.00, 'minval' => 10, 'minvalGroup' => 1),
	    array('retentionType' => 5, 'value' => 1.00, 'minval' => 10, 'minvalGroup' => 1),
	];
	*/
	$DomainRetentions['2511/8211300'] = [
	    // HUBLE-39184
	    // sem retentions
	];
	
	
	
	// HUBLE-38531
	// https://docs.google.com/spreadsheets/d/11gWHYk_7uB_olgrSthDt4AVdCaUOlhbNM2GGWU3T7HE/edit?gid=1610623915#gid=1610623915
	$CBSbyCNAE = [

	    //"11689/8230001" => ['codigo_nbs' => '1.1806.63.00', 'codigo_indicador_operacao' => '100301'],
	    "11689/8230001" => ['codigo_nbs' => '1.1806.63.00', 'codigo_indicador_operacao' => '040101'], // new indop, was 100301 and not worked (comment HUBLE-42854#response210691)
	    
	    '9001902/9001902' => ['codigo_nbs' => '1.2502.10.00', 'codigo_indicador_operacao' => '040101'],
	    
	    //"7054/5819100" => ['codigo_nbs' => '1.1805.31.00', 'codigo_indicador_operacao' => '100301'],
	    "7054/5819100" => ['codigo_nbs' => '1.1806.59.00', 'codigo_indicador_operacao' => '100301'],
	    
	    //"5819100/5819100" => ['codigo_nbs' => '1.1805.31.00', 'codigo_indicador_operacao' => '100301'],  
	    "5819100/5819100" => ['codigo_nbs' => '1.1806.59.00', 'codigo_indicador_operacao' => '100301'],
	    
	    //"2511/8211300" => ['codigo_nbs' => '1.1806.40.00', 'codigo_indicador_operacao' => '100301'],  
	    //"2511/8211300" => ['codigo_nbs' => '1.1806.59.00', 'codigo_indicador_operacao' => '100301'],
	    //"2511/8211300" => ['codigo_nbs' => '1.1805.31.00', 'codigo_indicador_operacao' => '020101'],
	    //"2511/8211300" => ['codigo_nbs' => '1.1806.40.00', 'codigo_indicador_operacao' => '100301'], // versao emissao platforma municipio
	    //"2511/8211300" => ['codigo_nbs' => '1.1806.40.00', 'codigo_indicador_operacao' => '020101'], // comentario de contabilidade
	    //"2511/8211300" => ['codigo_nbs' => '1.1806.40.00', 'codigo_indicador_operacao' => '100301'], // tentativa so para PB - ibs_cbs_codigo_municipio_incidencia = municipl. de tomador
       // "2511/8211300" => ['codigo_nbs' => '1.1806.63.00', 'codigo_indicador_operacao' => '020101'], // Joao testo OK
	    "2511/8211300" => ['codigo_nbs' => '1.1806.63.00', 'codigo_indicador_operacao' => '100301'], // voltando codigo velho, 8.11.2026
	    
	    //'7311400/7311400' => ['codigo_nbs' => '1.1406.20.00', 'codigo_indicador_operacao' => '100301'], 
	    '7311400/7311400' => ['codigo_nbs' => '1.1406.19.00', 'codigo_indicador_operacao' => '100301'],
	    
	    '8718/7020400' => ['codigo_nbs' => '1.1401.19.00', 'codigo_indicador_operacao' => '100301'], 
	    '8440/8599604' => ['codigo_nbs' => '1.2205.19.00', 'codigo_indicador_operacao' => '030101'],
	    
	];
	
	
	
	
	// HUBLE-38531
	// https://docs.google.com/spreadsheets/d/11gWHYk_7uB_olgrSthDt4AVdCaUOlhbNM2GGWU3T7HE/edit?gid=1610623915#gid=1610623915
	$TaxCodeToCNAE_nacional = [
	    //"9177/6204000" => "010101",
	    //"11744/6204000" => "010601",
	    //"9114/6319400" => "010801",
	    //"11794/8211300" => "030301",
	    //"11738/7410299" => "071101",
	    //"9058/6821802" => "100501",
	    //"9062/7311400" => "100801",
	    //"11130/7490104" => "100501",
	    //"9095/5914600" => "120201",
	    //"9015/5914600" => "121601",
	    //"9096/5914600" => "120201",
	    "11689/8230001" => "120801", // OK, aliquotas OK
	    //"9094/9001901" => "120101",
	    //"11699/9001901" => "121301",
	    //"11698/9001902" => "121301",
	    //"9093/9001999" => "120101",
	    //"9030/5914600" => "130301",
	    //"9024/7420001" => "130301",  
	    //"9018/9001902" => "130201",
	    
	    '6319400/6319400' => '010801', // backward compatibility, jiz nepouzivame
	    
	    '9001902/9001902' => '121301', // Producao musical, backward compatibility, jiz nepouzivame
	    '9001901/9001901' => '121301', // SERVIÇOS DE PRODUÇÃO DE EVENTOS, backward compatibility, jiz nepouzivame
	    
	    "7054/5819100" => "170201",   // OK, aliquotas ok
	    "5819100/5819100" => "170201",   // backward compatibility, jiz nepouzivame
	    
	    //"8731/6204000" => "170101",
	    //"8727/7020400" => "170101",
	    //"8750/7311400" => "170601",
	    //"2511/8211300" => "170201",  // OK
	    //"2511/8211300" => "030301",  // OK
	    //"2511/8211300" => "170201",  // versao emissao platforma municipio
	    "2511/8211300" => "030301",  // Joao
	    
	    '7311400/7311400' => '170601', // new alias, OK
	    //'7490104/7490104' => '100501', // new alias, OK - jiz nepouzivame od 3.12.2025
	    
	    '8718/7020400' => '170101', // brava, OK
	    '8440/8599604' => '080201', // brava, OK
	];
	
	
	// HUBLE-38531
	// HUBLE-42854#response211230
	foreach ([1, 3, 4, 5, 7, 9001, 9002, 9003, 9004, 9005, 9007] as $i) {
	    $TaxCodeToCNAE_nacional_entity[$i] = [
	        //"2511/8211300" => "030301"
	        //"2511/8211300" => "170201" // versao emissao platforma municipio\
	        "2511/8211300" => "30301" // versao emissao platforma municipio
	            
	    ];
	}unset($i);
	
	
	
	

	
	
	$NFSECodeList = array();
	$NFECodesMapping = array();
	foreach ($NFECodesData as $_nfditem) {
	    $NFSECodeList[$_nfditem[0][0]] = $_nfditem[0][0].' '.$_nfditem[0][1];
	    $NFECodesMapping[$_nfditem[0][0]] = $_nfditem;
	}
	
	

	
	
	
	// Continente (Palhoça, Palhoca)
	$NFECodesMappingEntity[2]['11689/8230001'] = array(
		array(1208, 'Planejamento, organização e administração de feiras, exposições, congressos e congêneres.'),
	    array(1208, ''),
		4);
	$NFECodesMappingEntity[2]['8440/8599604'] = array(
		array(802, 'Instrução, treinamento, orientação pedagógica e educacional, avaliação de conhecimentos de qualquer natureza.'),
		array(802, ''),
		2);
	$NFECodesMappingEntity[2]['2511/8211300'] = array(
		array(1702, 'Datilografia, digitação, estenografia, expediente, secretaria em geral, resposta audível, redação, edição, interpretação, revisão, tradução, apoio e infra-estrutura administrativa e congêneres.'),
		array(1702, ''),
		3);
	$NFECodesMappingEntity[2]['8718/7020400'] = array(
		array(1701, 'Assessoria ou consultoria de qualquer natureza, não contida em outros itens desta lista'),
		array(1701, ''),
		3);
	
	
	// Porto alegre
	// https://focusnfe.com.br/blog/nfse-porto-alegre/
	$NFECodesMappingEntity[6]['11689/8230001'] = array(
	    array('12.08', 'Planejamento, organização e administração de feiras, exposições, congressos e congêneres.'),
	    array(null, ''),
	    2,
	    '120800100'
	);
	$NFECodesMappingEntity[6]['8440/8599604'] = array(
	    array('8.02', 'Instrução, treinamento, orientação pedagógica e educacional, avaliação de conhecimentos de qualquer natureza.'),
	    array(null, ''),
	    2,
	    '80200100');
	$NFECodesMappingEntity[6]['2511/8211300'] = array(
	    array('17.02', 'Datilografia, digitação, estenografia, expediente, secretaria em geral, resposta audível, redação, edição, interpretação, revisão, tradução, apoio e infra-estrutura administrativa e congêneres.'),
	    array(null, ''),
	    2,
	    '170200100');
	$NFECodesMappingEntity[6]['8718/7020400'] = array(
	    array('17.01', 'Assessoria ou consultoria de qualquer natureza, não contida em outros itens desta lista'),
	    array(null, ''),
	    2,
	    '170100100');
	
	
	
    
	    
    
    
    $EntityAlternatives = [];
    foreach (SQL::objects('entity', "alternativeFor IS NOT NULL") as $e) {
        $EntityAlternatives[$e['alternativeFor']] = $e[id];
    }
    foreach ($TaxCodeToCNAE_nacional_entity as $eid => $ef) {
        if (isset($EntityAlternatives[$eid])) {
            $TaxCodeToCNAE_nacional_entity[$EntityAlternatives[$eid]] = $ef;
        }
    }
        
    foreach ($NFECodesMappingEntity as $entityId => $specialEntityData) {
        if (isset($EntityAlternatives[$entityId])) {
            $NFECodesMappingEntity[$EntityAlternatives[$entityId]] = $NFECodesMappingEntity[$entityId];
        }
    }
	    
	
	
	
	
	
	
	// ASAAS

				
				function getAsaasKeysForEntity($invoiceEntity) {
					//if (DEBUG_MODE) {
					//	$asaasKeys['token'] = '$aact_YTU5YTE0M2M2N2I4MTliNzk0YTI5N2U5MzdjNWZmNDQ6OjAwMDAwMDAwMDAwMDAwNjY3OTc6OiRhYWNoX2ZiYWNlZjY0LTdjNzgtNDEzZi1hOWZjLTY4ZGYyOWY5ZjY3YQ==';
					//	$asaasKeys['url'] = "https://sandbox.asaas.com/api/";
					//}
					
				    
				    $asaasKeystore = [
				        'novo-primavera' => '$aact_prod_000MzkwODA2MWY2OGM3MWRlMDU2NWM3MzJlNzZmNGZhZGY6OmJjNWYzYTUzLTRjNGEtNDZmNi04MDQ3LTcyMjQzODhmNmQzNzo6JGFhY2hfNTllMzBkNWEtNTI5Zi00ZGUwLTkyZTItOWViMjRlMjRlNjgz',
				        'novo-sapiens' => '$aact_prod_000MzkwODA2MWY2OGM3MWRlMDU2NWM3MzJlNzZmNGZhZGY6Ojk2MjgwNDA1LWE1NjYtNDlkMC1iNzdiLWJhNmUzZGQwZGY4YTo6JGFhY2hfNDI3MWQ4MzgtYzEyNi00YzFhLTkwMjctOWU1YjNiNGFkYjUy',
				        'novo-PedraBranca' => '$aact_prod_000MzkwODA2MWY2OGM3MWRlMDU2NWM3MzJlNzZmNGZhZGY6OjZhZTI0NjY4LWVlOTUtNDJmMC04NDFiLTlhNmZiOTJjNmIxNjo6JGFhY2hfNDRjYTA3NmQtN2M0ZS00MzExLTk5ZDctYWNiOGM4MjAzYzYy',
				        'novo-BeWiki' => '$aact_prod_000MzkwODA2MWY2OGM3MWRlMDU2NWM3MzJlNzZmNGZhZGY6OmJlOTI4YzlkLTM0NjYtNGMwNC1hMWRlLTIyN2EzZDFlOWYwMzo6JGFhY2hfMjJhMzdlYWUtMTJlOS00OGFkLTljN2MtYmE5ZTYwODc3M2Ni',
				        'novo-Centro' => '$aact_prod_000MzkwODA2MWY2OGM3MWRlMDU2NWM3MzJlNzZmNGZhZGY6OjJlZWZlYmU4LWE5ZDgtNGU0NC1hOGQzLTNhYTZjN2IyZjc1NDo6JGFhY2hfMzUxMDkyNWYtYWJlNC00OGZjLWE2YmYtNWM4NDBiZWM2MTUz',
				    ];
				    
				    $asaasKeystore['primavera'] = '$aact_YTU5YTE0M2M2N2I4MTliNzk0YTI5N2U5MzdjNWZmNDQ6OjAwMDAwMDAwMDAwMDAzNTQyNDU6OiRhYWNoXzdmYWJmYjc2LTZjZjEtNGRkZi05YmRmLWZiYTY2YTQ1Y2JhMA==';
				    $asaasKeystore['pedra-branca'] = '$aact_YTU5YTE0M2M2N2I4MTliNzk0YTI5N2U5MzdjNWZmNDQ6OjAwMDAwMDAwMDAwMDAzNTQyNDY6OiRhYWNoX2IwNTk2NmFiLTdiNTUtNDJhYS1iZGRjLTg5NzEwMDMwNGU5Mw==';
				    $asaasKeystore['beira-mar'] = '?'; //$aact_YTU5YTE0M2M2N2I4MTliNzk0YTI5N2U5MzdjNWZmNDQ6OjAwMDAwMDAwMDAwMDAzNTQyNDg6OiRhYWNoXzE1Y2Y4YmYwLTQ5ZjUtNGNlYi04MWE3LWQyNGFkNzRhMmIwMw==';
					$asaasKeystore['centro'] = '$aact_MzkwODA2MWY2OGM3MWRlMDU2NWM3MzJlNzZmNGZhZGY6OmMzNjUwMmI3LTQ0YmQtNDMxNi1hZTdhLTlkYTRiZGY3ZDM5Mzo6JGFhY2hfZGQwOGM1MzktNjJlOS00OWY1LTk0NDEtMjIxNWI2MDRlOGIx==';
					$asaasKeystore['porto-alegre'] = '$aact_prod_000MzkwODA2MWY2OGM3MWRlMDU2NWM3MzJlNzZmNGZhZGY6OmFlYzlkYWMzLWQxZmYtNDhkZi1iYmNkLWM3ZTAzZGU3NWQ4NDo6JGFhY2hfMzJhOGYwNTctMDUzOS00OTliLTkxMDctNThhMTIwMDE5MTE5'; 					// '?'; // HUBLE-42879, 
					$asaasKeystore['sapiens'] = '$aact_prod_000MzkwODA2MWY2OGM3MWRlMDU2NWM3MzJlNzZmNGZhZGY6OmU1M2Y2ZTYwLTgwY2MtNDI4Zi04ZGVkLWEwODUxMDFjNTQwZDo6JGFhY2hfZGRhOGYwYjktMDVhNi00ODExLThlOGYtMzBhMDRiZTA0YzFl';
					$asaasKeystore['brava'] = '$aact_prod_000MzkwODA2MWY2OGM3MWRlMDU2NWM3MzJlNzZmNGZhZGY6OjIzYjdiZTcwLTNkYzgtNDExMy1hMTU0LTAzN2M2NzQ4OTRhNjo6JGFhY2hfZjg3NmU1OWUtNjM3YS00OWQ3LWI1NjEtYWVjMjA2NzQzZDcx'; // HUBLE-38833
					
					
					$asaasKeys = [];
					$asaasKeys['url'] = RenDataSources::getASAASService()['url'];
					$asaasKeys['token'] = '?';
					
					if ($invoiceEntity == 1) {
						$asaasKeys['token'] = $asaasKeystore['primavera'];
					} else if ($invoiceEntity == 2) {
						$asaasKeys['token'] = $asaasKeystore['pedra-branca'];
					} else if ($invoiceEntity == 3) {
						$asaasKeys['token'] = $asaasKeystore['beira-mar'];
					} else if ($invoiceEntity == 5) {
						$asaasKeys['token'] = $asaasKeystore['centro'];
					} else if ($invoiceEntity == 6) {
					    $asaasKeys['token'] = $asaasKeystore['porto-alegre'];
					} else if ($invoiceEntity == 7) {
					    $asaasKeys['token'] = $asaasKeystore['sapiens'];
					} else if ($invoiceEntity == 8) {
					    $asaasKeys['token'] = $asaasKeystore['brava'];
					} else if ($invoiceEntity == 9007) { // sapiens parque novo
					    $asaasKeys['token'] = $asaasKeystore['novo-sapiens'];
					} else if ($invoiceEntity == 9002) { // pedra branca
					    $asaasKeys['token'] = $asaasKeystore['novo-PedraBranca'];
					} else if ($invoiceEntity == 9001) { // primavera
					    $asaasKeys['token'] = $asaasKeystore['novo-primavera'];
					} else if ($invoiceEntity == 9006) { // BeWiki
					    $asaasKeys['token'] = $asaasKeystore['novo-BeWiki'];
					} else if ($invoiceEntity == 9008) { // Centro
					    $asaasKeys['token'] = $asaasKeystore['novo-Centro'];
					}
					
					
					
					
					
					
					
					
					
					
					
					return $asaasKeys;
				}
				
				
				
				
				
				function process2paymentForFloripa($cond = '') {
				    
					global $asaasKeys;
					
					$start = time();
					
					if (DEBUG_MODE) {
					    echoreddiv("Cannot launch debit process on cards in debug mode.");
					    exit;
					}
					
					_dfv(HUBLE_DOMAIN_LASTDEBITLAUNCH, rNow());
					
					// must be 5 minutes old at least
					$list = mysqlObjects("SELECT * FROM payment WHERE method = ".PaymentMethod::CARD_ASAAS." AND createdWhen < '".rNow()."' - INTERVAL 5 MINUTE 
                            AND status = ".PaymentStatus::ISSUED." $cond ");
					
					foreach ($list as $p) {
					    if (time() - $start > 60) break; // one session max 60 s 

						$p = mysqlSimpleObject('payment', $p['id']);
						
						if ($p['debitErrorNote']) {
							echoyellowdiv("Skipping as error before ($p[debitErrorNote])");
							continue;
						}
						
						$entities = [];
						foreach (mysqlObjects("SELECT invoice.entity, invoice.account FROM payment_invoice INNER JOIN invoice ON invoice.id = invoice_id WHERE payment_id = $p[id]") as $pi) {
							$entities[$pi['entity']] = $pi['entity'];
						}
						if (count($entities) > 1) {
							mysqlUpdateObject("payment", $p['id'], array(
								'debitErrorNote' => "More entities for payment id $p[id]?"
							));
							continue;
						}
						
						$asaasKeys = getAsaasKeysForEntity(array_key_first($entities));
						
						if (!isset($asaasKeys['token'])) {
							mysqlUpdateObject("payment", $p['id'], array(
								'debitErrorNote' => "Entity not configured for ASAAS"
							));
							continue;
						}

						$organisation = rLoadTo($p['organisation'], Organisation);
						
						echodiv("Org $organisation[id]");
						
						$account = $organisation['defaultInvoiceContact'];
						
						$cardDetails = mysqlSimpleObject('paymentdetails', $account['creditCardId']);
						
						if (!$cardDetails) {
						    echoreddiv("Card not found.");
						    mysqlUpdateObject("payment", $p['id'], array(
						        'debitErrorNote' => "Card not found."
						    ));
						} else {
						
    						$cardDetailsData = json_decode($cardDetails['data'], true);
    						
    						if (!$cardDetailsData) {
    							echoreddiv("Card not found.");
    							mysqlUpdateObject("payment", $p['id'], array(
    								'debitErrorNote' => "Card not found."
    							));
    							
    						} else {
    						    sleep(rand(5, 15));
    						    
    							$document_number = $organisation['taxId'] && $organisation['type'] == OrganisationType::COMPANY ? $organisation['taxId'] : ($account['enterpreneurId'] ? $account['enterpreneurId'] : $account['documentId']);
    							echodiv("Searching for customer ".implode(', ', [$organisation['country'], $account['email'], $document_number]));
    							
    							$customerId = assasGetExistingCustomer($organisation['country'], $account['email'], $document_number);
    							
    							if (!$customerId) {
    							    echodiv("Adding new customer ad-hoc");
    							    $customerId = asaasConstructCustomer(asaasCustomerPayloadByOrganisationAndAccount($organisation, $account), [
                                            'organisation' => $organisation,
        							        'account' => $account
                                        ], $account);
    							}
    							
    							if (!$customerId) {
    								echoreddiv("Customer not found...");
    								rUrgentEmail("cannot register customer", asaasCustomerPayloadByOrganisationAndAccount($organisation, $account));
    								mysqlUpdateObject("payment", $p['id'], array(
    									'debitErrorNote' => "Customer cannot be registered."
    								));
    								continue;
    							}
    							
    							echolimediv("Customer ID:".$customerId);
    							//echovar($cardDetailsData);
    							
    							$expDate = strtotime(rToday().' + 2 DAY');
    							$params = [
    								'billingType' => 'CREDIT_CARD',
    								'customer' => $customerId,
    								'value' => $p['amount'],
    								'dueDate' => rToday($expDate),
    								'description' => $p['description'],
    								'externalReference' => 'D'.$p['id'],
    							];
    							$result = asaasCall($asaasKeys, 'POST:v3/payments', $params);
    							
    							
    							if ($result['http_code'] == 200) {
    								//echovar($result);
    								$data = json_decode($result['content'], true);
    								$cobrancaId = $data['id'];
    								
    								echovar($data);
    								echohr();
    								
    								// use card to pay
    								$result2 = asaasCall($asaasKeys, 'POST:v3/payments/'.$cobrancaId.'/payWithCreditCard', json_encode([
    									'creditCard' => [
    										'number' => $cardDetailsData['card_number'],
    										'holderName' => $cardDetailsData['name'],
    										'expiryMonth' => $cardDetailsData['card_expiration_month'],
    										'expiryYear' => $cardDetailsData['card_expiration_year'],
    										'ccv' => $cardDetailsData['card_cvv'],
    									],
    									'creditCardHolderInfo' => [
    										'name' => $cardDetailsData['name'],
    										'email' => $cardDetailsData['email'],
    										'cpfCnpj' => $cardDetailsData['cpf'],
    										'address' => $cardDetailsData['address'],
    										'addressNumber' => $cardDetailsData['addressNumber'],
    										'addressComplement' => $cardDetailsData['complement'],
    										'postalCode' => $cardDetailsData['postalCode'],
    										'phone' => $cardDetailsData['phone'],
    									]
    								]));
    								
    								//echoh1("Payment result:");
    								//echovar($result2);
    								
    								$paymentStatus = json_decode($result2['content'], true);
    								if ($result2['http_code'] == 200 && $paymentStatus['status'] == 'CONFIRMED') {
    									echovar($result2);
    									echohr();
    									echolimediv("Charged OK");
    									
    									mysqlUpdateObject("payment", $p['id'], array(
    										'description' => 'ASAAS debit',
    									    'paidWhen' => rToday(),
    										//'identification' => $paymentStatus['id'],
    										'status' => 16,
    										'netValue' => $paymentStatus['netValue'],
    									));
    									
    								} else {
    									echoreddiv("Error2");
    									echovar($result2);
    									echohr();
    									
    									$errors = '';
    									if ($paymentStatus) {
        									foreach ($paymentStatus['errors'] as $e) {
        										$errors .= $e['description']."<br />";
        									}
    									}
    									if (!$errors) $errors = '?';
    									mysqlUpdateObject("payment", $p['id'], array(
    										'debitErrorNote' => "Problem with output status occured ($errors)."
    									));
    									
    								}
    								
    							} else {
    								echoreddiv("Error1");
    								echovar($result);
    								echohr();
    								
    								$errors = "The transaction was not able to be processed.";
    								mysqlUpdateObject("payment", $p['id'], array(
    									'debitErrorNote' => "Problem with output status occured ($errors)."
    								));
    								
    								
    							}
    							
    							
    					
    						}
						}
						
						// end after 1
						break;
					}
					
					
				}
				
				
				
				
				
				
	function domainCron($force = false) {
	    global $CoworkAccountFacade;
	    global $MailFacade;
	    
	    if (Timer::morning() && ST(_dfv(HUBLE_DOMAIN_LAST_DEBIT_PROCESSED)) < ST(rNow().' - 3 DAY - 8 HOUR')) { // try every 3 days
	        mysqlTxBegin();
	        $method = PaymentMethod::CARD_ASAAS;
	        $t = $CoworkAccountFacade()->getIssueDate();
	        _dfv(HUBLE_DOMAIN_LAST_DEBIT_PROCESSED, rNow());
	        $CoworkAccountFacade()->processPayments($t, $method);
	        _dfv(HUBLE_DOMAIN_TASKS_PENDING_DEBIT_PROCESS, 0);
	        mysqlTxCommit();
	    }
	    
	    // launch randomly the debits
        if (date('G', strtotime(rNow())) >= 7 || $force) {
            if (date('G', strtotime(rNow())) <= 22 || $force) {
                if (ST(_dfv(HUBLE_DOMAIN_LASTDEBITLAUNCH)) < ST(rNow()." - ".rand(1, 6)." MINUTE") || $force) {
                    // try 10 payments each iteration
                    for ($i = 0; $i <= 15; $i++) {
                        process2paymentForFloripa();
                    }
                }
            }
        }
        
        
        echoh1("Cancellation of debits...");
        $hoursLimit = 6;
        $payments = getDebitLongFails(true);
        foreach ($payments as $payment) {
            $tryAgain = false;
            if ($payment['debitErrorNote']) {
                // Cancel immediatellyss
                echoreddiv($payment['id'].' of '.$payment['organisation'].' - errorous: '.$payment['debitErrorNote']);
                $tryAgain = true;
            } else if (ST($payment['createdWhen']) < ST(rNow().' - '.$hoursLimit.' HOUR')) {
                echoreddiv($payment['id'].' of '.$payment['organisation'].' - late: '.$payment['createdWhen']);
                $tryAgain = true;
            }
            
            if ($tryAgain) {
                //Dev::tell("Trying again a debit of org. $payment[organisation]");
                $invoices = mysqlObjects("SELECT invoice.* FROM invoice INNER JOIN payment_invoice ON payment_id = $payment[id] AND invoice.id = invoice_id");
                foreach ($invoices as $invoice) {
                    mysqlUpdateObject("invoice", $invoice['id'], array(
                        'notifyLevel' => $invoice['notifyLevel'] + 1,
                        'notifiedWhen' => rNow()
                    ));
                }
                $CoworkAccountFacade()->unasignPayment($payment['id']);
                mysqlUpdateObject('payment', $payment['id'], array(
                    'status' => PaymentStatus::CANCELLED
                ));
            }
        }
        
        
        echoh1('Automatic cancelling debit methods');
        if (_dfv(HUBLE_DOMAIN_DEBIT_CANCEL_ALL_AUTOCHARGE_AUTOMATICLY)) {
            $payments = getDebitLongFails();
            foreach ($payments as $p) {
                if ($p['method'] != PaymentMethod::CARD_ASAAS) continue;
                Dev::tell("Cancelling debit of org. $p[organisation]");
                cancelPaymentDebitAndEmail($p);
            }
            _dfv(HUBLE_DOMAIN_DEBIT_FAIL_COUNT, 0);
        }
        
        
        echoh1("Sending NFSe");
        if (_dfv(HUBLE_DOMAIN_FOCUS_NFE_AUTO_SEND) && Timer::day() && Timer::workday()) {
            foreach (mysqlSimpleObjects('nfse', "status = 10 AND createdWhen >= '".rNow()."' - INTERVAL 3 MONTH AND createdWhen < '".rNow()."' - INTERVAL 10 MINUTE", 'ORDER BY id DESC LIMIT 5') as $nfse) {
                if (count(mysqlObjects("SELECT invoice.id FROM invoiceitem INNER JOIN invoice ON invoice.id = invoiceitem.invoice WHERE
            		invoiceitem.nfse = $nfse[id] AND invoice.sent > 0")) > 0 ) {
            		if ($MailFacade()->nfse($nfse)) {
            		    mysqlUpdateObject('nfse', $nfse['id'], array('status' => 20));
            		}
                }
            }
        }
        
	}

	
	function isSimpleNacional($organisation) {
		$organisation = mysqlSimpleObject('organisation', $organisation['id']);
		
		if (ST($organisation['fetchBillingDetailsRegisterLast']) < ST(rNow().' - 14 DAY')) {
			return $organisation['brazil_simplesNactional'];
		}
		
		$out = false;
		if (!$organisation['taxId']) {
			$out = false;
		} else {
			$r = rcurl_get_web_page('https://server11.bitcarvers.com/cnpj', ['q' => $organisation['taxId']]);
			if ($r['http_code'] == 200) {
				echovar(json_decode($r['content'], true));
				if (isset($r['content']['simples']) && $r['content']['simples'] == 'sim') {
					$out = true;
				}
			} else {
				$out = false; // not found
			}
		}
		
		mysqlUpdateObject('organisation', $organisation['id'], [
			'brazil_simplesNactional' => $out,
			'fetchBillingDetailsRegisterLast' => rNow()
		]);
		
		return $out;
	}
	
	
	
	
	function getTokenForNfse($nfseId) {
	    global $EntityObjects;
	    $nfo = mysqlObject("SELECT entity FROM nfse WHERE id = $nfseId", false);
	    if (!$nfo) {
	        echoreddiv("Cannot fetch nfse #$nfseId");
	        exit;
	    }
	    return $EntityObjects[$nfo['entity']]['nfse_token'];
	}
	
	
	function getNFSe($nfseHubleRefId) {
	    $nfseHubleRefId = SQL::id($nfseHubleRefId);
	    $fnfeurl = _dfv(HUBLE_DOMAIN_FOCUS_HOMOLOGACAO) ? RenDataSources::getBrazilianNFSEEmissionService()['urlTesting'] : RenDataSources::getBrazilianNFSEEmissionService()['url'];
	    $url = $fnfeurl."/v2/nfsen/".$nfseHubleRefId."?token=".getTokenForNfse($nfseHubleRefId);
	    $r = rcurl_get_web_page($url, null, null, 10, null, true, 'Huble', DEBUG_MODE ? false : true);
	    if ($r['success']) {
	        return JSON::from($r['content']);
	    }
	    return null;
	}
	
	
	function deleteNFSe($nfseHubleRefId) {
	    $fnfeurl = _dfv(HUBLE_DOMAIN_FOCUS_HOMOLOGACAO) ? RenDataSources::getBrazilianNFSEEmissionService()['urlTesting'] : RenDataSources::getBrazilianNFSEEmissionService()['url'];
	    $r = CURL::delete($fnfeurl."/v2/nfsen/".$nfseHubleRefId."?token=".getTokenForNfse($nfseHubleRefId));
	    if ($r['success']) {
	        return $r;
	    }
	    return false;
	}
	
	
	function createNfse($nfseHubleRefId, $newData) {
	    $fnfeurl = _dfv(HUBLE_DOMAIN_FOCUS_HOMOLOGACAO) ? RenDataSources::getBrazilianNFSEEmissionService()['urlTesting'] : RenDataSources::getBrazilianNFSEEmissionService()['url'];
	    
	    $newData = json_encode($newData);
	    $newDataX = str_replace("\/", "\u002f", $newData);
	    $ch = curl_init();
	    curl_setopt($ch, CURLOPT_URL, $fnfeurl."/v2/nfsen?token=".getTokenForNfse($nfseHubleRefId)."&ref=" . $nfseHubleRefId);
	    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	    curl_setopt($ch, CURLOPT_POST, 1);
	    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
	    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
	    curl_setopt($ch, CURLOPT_POSTFIELDS, $newDataX);
	    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));
	    $body = curl_exec($ch);
	    $result = curl_getinfo($ch, CURLINFO_HTTP_CODE);
	    curl_close($ch);
	    
	    if ($result == 202) {
	        return true;
	    }
	    
	    echoh1('ERROR - '.$nfseHubleRefId);
	    echovar($newData);
	    echovar($body);
	    
	    rSupportEmail("NFE generation problem", json_encode($newData, JSON_HEX_QUOT)."\n\n\nERROR: ref $nfseHubleRefId ".$body."\n\n");
	    
	    return false;
	}
	
	
	
	
	@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{from{opacity:1}to{opacity:0}}.redactor-animate-hide{display:none!important}.redactor-fadeIn{opacity:0;animation:fadeIn .2s ease-in-out}.redactor-fadeOut{opacity:1;animation:fadeOut .2s ease-in-out}@font-face{font-family:Redactor;src:url("data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT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f/ABAQDwAAAAAgAAgAAAAAAAAABAAADwP/AAAAEAP/x//wEBAABAAAAAAAAAAAAAAAAAAAALgQAAAAAAAAAAAAAAAIAAAAEAAAABAAAAAQAAAAEAAEZBAAAwAQAAEAEAABABAAAgAQAAEAEAABABAAAQAQAAD8EAAA/BAAAwAQA//EEAABABAAAQAQAAEAEAAAABAAAAAQAAMAEAAGzBAAAAAQAAAAEAAAaBAAAAAQAAAAEAAAABAAAwAQAAEAEAACABAABFQQAARUEAABABAAAgAQAAQAEAADQBAAAwAQAAAAEAABeBAAAAAQAAEAAAAAAAAoAFAAeAGwAugEIAXgBxAImApIDPAOOA8QD+ATUBRAFWAV6BeIGYAbaBxYHcAfYB+YIBgiuCUAJmgoSCpwK8AtEDEAMmAzwDSANnA3ADhAOWg7wELYRNhIgAAAAAQAAAC4BcQAKAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAgAAAABAAAAAAACAAcAaQABAAAAAAADAAgAOQABAAAAAAAEAAgAfgABAAAAAAAFAAsAGAABAAAAAAAGAAgAUQABAAAAAAAKABoAlgADAAEECQABABAACAADAAEECQACAA4AcAADAAEECQADABAAQQADAAEECQAEABAAhgADAAEECQAFABYAIwADAAEECQAGABAAWQADAAEECQAKADQAsFJlZGFjdG9yAFIAZQBkAGEAYwB0AG8AclZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMFJlZGFjdG9yAFIAZQBkAGEAYwB0AG8AclJlZGFjdG9yAFIAZQBkAGEAYwB0AG8AclJlZ3VsYXIAUgBlAGcAdQBsAGEAclJlZGFjdG9yAFIAZQBkAGEAYwB0AG8AckZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=") format("truetype");font-weight:400;font-style:normal}[class*=" re-icon-"],[class^=re-icon-]{font-family:Redactor!important;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.re-icon-aligncenter:before{content:"\e900"}.re-icon-alignleft:before,.re-icon-alignment:before{content:"\e901"}.re-icon-alignright:before{content:"\e902"}.re-icon-bold:before{content:"\e903"}.re-icon-bookmark:before{content:"\e904"}.re-icon-clips:before{content:"\e905"}.re-icon-codesnippets:before{content:"\e906"}.re-icon-deleted:before{content:"\e907"}.re-icon-expand:before{content:"\e908"}.re-icon-file:before{content:"\e909"}.re-icon-fontcolor:before{content:"\e90a"}.re-icon-fontfamily:before{content:"\e90b"}.re-icon-fontsize:before{content:"\e90c"}.re-icon-format:before{content:"\e90d"}.re-icon-html:before{content:"\e90e"}.re-icon-imagecenter:before{content:"\e90f"}.re-icon-imageleft:before{content:"\e910"}.re-icon-imageright:before{content:"\e911"}.re-icon-image:before{content:"\e912"}.re-icon-indent:before{content:"\e913"}.re-icon-inline:before{content:"\e914"}.re-icon-italic:before{content:"\e915"}.re-icon-horizontalrule:before,.re-icon-line:before{content:"\e916"}.re-icon-link:before{content:"\e917"}.re-icon-ol:before,.re-icon-ordered:before{content:"\e918"}.re-icon-outdent:before{content:"\e919"}.re-icon-properties:before{content:"\e91a"}.re-icon-readmore:before{content:"\e91b"}.re-icon-redo:before{content:"\e91c"}.re-icon-retract:before{content:"\e91d"}.re-icon-specialcharacters:before{content:"\e91e"}.re-icon-sub:before{content:"\e91f"}.re-icon-sup:before{content:"\e920"}.re-icon-table:before{content:"\e921"}.re-icon-textdirection:before{content:"\e922"}.re-icon-toggle:before{content:"\e923"}.re-icon-underline:before{content:"\e924"}.re-icon-undo:before{content:"\e925"}.re-icon-lists:before,.re-icon-ul:before,.re-icon-unordered:before{content:"\e926"}.re-icon-variable:before{content:"\e927"}.re-icon-video:before{content:"\e928"}.re-icon-widget:before{content:"\e929"}.redactor-box,.redactor-box textarea{z-index:999990auto}.redactor-box{position:relative;box-sizing:border-box}.redactor-box.redactor-styles-on{margin:0;padding:0;background:#fff;border:1px solid rgba(0,0,0,.075);border-radius:3px;box-shadow:none}.redactor-box.redactor-inline{position:static}.redactor-focus.redactor-styles-on,.redactor-focus:focus.redactor-styles-on{border-color:#82b7ec!important}.redactor-over:hover.redactor-styles-on{border-color:#ee698a!important}.redactor-source-view,.redactor-source-view.redactor-styles-on{border-color:#000!important}.redactor-in{position:relative;overflow:auto;white-space:normal;box-sizing:border-box}.redactor-in:focus{outline:0}.redactor-inline .redactor-in{overflow:hidden}.redactor-in *,.redactor-read-only *{outline:0!important}.redactor-in blockquote:empty,.redactor-in div[data-redactor-tag=br]:empty,.redactor-in div[data-redactor-tag=tbr]:empty,.redactor-in h1:empty,.redactor-in h2:empty,.redactor-in h3:empty,.redactor-in h4:empty,.redactor-in h5:empty,.redactor-in h6:empty,.redactor-in p:empty{min-height:1.5em}.redactor-in div[data-redactor-tag=br],.redactor-in div[data-redactor-tag=tbr]{margin-top:0;margin-bottom:0}.redactor-in b:empty,.redactor-in em:empty,.redactor-in i:empty,.redactor-in ins:empty,.redactor-in span:empty,.redactor-in strong:empty,.redactor-in sub:empty,.redactor-in sup:empty,.redactor-in u:empty{display:inline-block;min-width:1px;min-height:1rem}.redactor-in table{empty-cells:show}.redactor-in li figure{width:auto;display:inline-block;margin:0;vertical-align:top}.redactor-in figcaption:focus,.redactor-in figure code:focus,.redactor-in figure pre:focus,.redactor-in table td:focus,.redactor-in table th:focus{outline:0}.redactor-in figure[data-redactor-type=line]{margin-top:1em;padding:6px 0;vertical-align:baseline}.redactor-in figure[data-redactor-type=line] hr{margin:0;height:3px;border:none;background:rgba(0,0,0,.1)}.redactor-script-tag{display:none!important}.redactor-component{position:relative}.redactor-component[data-redactor-type=video]:before,.redactor-component[data-redactor-type=widget]:before{width:100%;height:100%;content:"";display:block;position:absolute;z-index:9999901}.redactor-component[data-redactor-type=image],.redactor-component[data-redactor-type=widget]{clear:both}.redactor-component[data-redactor-type=variable]{white-space:nowrap;background:rgba(0,125,255,.75);color:#fff;display:inline-block;padding:3px 6px;line-height:1;border-radius:4px;cursor:pointer}.redactor-component-active{outline:5px solid rgba(0,125,255,.5)!important}.redactor-component-active[data-redactor-type=image]{outline:0!important}.redactor-component-active[data-redactor-type=image] img{outline:5px solid rgba(0,125,255,.5)!important}.redactor-component-active[data-redactor-type=variable]{outline:0!important;background:#ee698a}.redactor-component-active[data-redactor-type=video]{outline:0!important}.redactor-component-active[data-redactor-type=video] iframe{outline:5px solid rgba(0,125,255,.5)!important}.redactor-blur.redactor-styles-on .redactor-component-active{outline:5px solid #ddd!important}.redactor-blur.redactor-styles-on .redactor-component-active[data-redactor-type=image]{outline:0!important}.redactor-blur.redactor-styles-on .redactor-component-active[data-redactor-type=image] img{outline:5px solid #ddd!important}.redactor-blur.redactor-styles-on .redactor-component-active[data-redactor-type=video]{outline:0!important}.redactor-blur.redactor-styles-on .redactor-component-active[data-redactor-type=video] iframe{outline:5px solid #ddd!important}.redactor-blur.redactor-styles-on .redactor-component-active[data-redactor-type=variable]{outline:0!important;background:#ddd}.redactor-component-caret{position:absolute;left:-9999px}.redactor-textnodes-wrapper{display:inline-block}#redactor-image-resizer{position:absolute;z-index:9999901050;background-color:rgba(0,125,255,.9);width:13px;height:13px;border:1px solid #fff;cursor:move;cursor:nwse-resize}.redactor-file-item{display:inline-block;line-height:1;padding:4px 12px;border-radius:16px;border:1px solid rgba(0,0,0,.2)}.redactor-file-remover{margin-left:2px;position:relative;right:-3px;display:inline-block;padding:0 3px;cursor:pointer;opacity:.5}.redactor-file-remover:hover{opacity:1}#redactor-overlay{position:fixed;z-index:9999901051;top:0;left:0;right:0;bottom:0;background-color:rgba(16,16,18,.3)}#redactor-overlay>.redactor-close{position:fixed;top:1rem;right:1rem}.redactor-source,.redactor-source:focus,.redactor-source:hover{text-align:left;box-sizing:border-box;font-family:Consolas,Menlo,Monaco,"Courier New",monospace;width:100%;display:block;margin:0;border:none;box-shadow:none;border-radius:0;background:#252525;color:#ccc;font-size:15px;outline:0;padding:10px 18px 20px 18px;line-height:1.5;resize:vertical}.redactor-box[dir=rtl] .redactor-source{direction:ltr}.redactor-placeholder:before{position:absolute;content:attr(placeholder);color:rgba(0,0,0,.4);font-weight:400;cursor:text}.redactor-in figcaption[placeholder]:empty:before{content:attr(placeholder);color:rgba(0,0,0,.4);font-weight:400}.redactor-in figcaption[placeholder]:empty:focus:before{content:""}.redactor-statusbar{font-family:Consolas,Menlo,Monaco,"Courier New",monospace;margin:0;padding:8px 10px;position:relative;overflow:hidden;list-style:none;background:#f8f8f8;box-sizing:border-box;border:none}.redactor-statusbar li{float:left;font-size:12px;color:rgba(0,0,0,.5);padding:0 10px;line-height:16px;border-right:1px solid rgba(0,0,0,.1)}.redactor-statusbar li:last-child{border-right-color:transparent}.redactor-statusbar a{color:rgba(0,0,0,.5);text-decoration:underline}.redactor-statusbar a:hover{color:#f03c69;text-decoration:underline}.redactor-statusbar:empty{display:none}.redactor-toolbar-wrapper{position:relative}.redactor-air,.redactor-toolbar{z-index:999990100;position:relative;margin:0!important;padding:0;list-style:none!important;line-height:1!important;background:0 0;border:none;box-sizing:border-box}.redactor-box.redactor-styles-on .redactor-toolbar{padding:18px 16px 0 16px}.redactor-air a,.redactor-toolbar a{display:inline-block;box-sizing:border-box;font-size:14px;text-align:center;padding:10px 15px 9px 15px;cursor:pointer;outline:0;border:none;vertical-align:middle;text-decoration:none;zoom:1;position:relative;color:rgba(0,0,0,.85);border-radius:2px;background:rgba(255,255,255,.97);box-shadow:0 1px 2px rgba(0,0,0,.22);margin-right:5px;margin-bottom:4px}.redactor-air a.re-button-icon,.redactor-toolbar a.re-button-icon{font-size:16px;padding:9px 15px 6px 15px}.redactor-air a:hover,.redactor-toolbar a:hover{outline:0;color:#fff;background:#449aef}.redactor-toolbar a.redactor-button-active{background:rgba(245,245,245,.95);color:rgba(0,0,0,.4)}.redactor-air a.redactor-button-disabled,.redactor-toolbar a.redactor-button-disabled{opacity:.3}.redactor-air a.redactor-button-disabled:hover,.redactor-toolbar a.redactor-button-disabled:hover{color:#333;outline:0;background-color:transparent!important;cursor:default}.redactor-source-view .redactor-toolbar{background:#252525}.redactor-source-view .redactor-toolbar a{background:#000;color:#fff}.redactor-source-view .redactor-toolbar a:hover{background:#449aef}.redactor-source-view .redactor-toolbar a.redactor-button-disabled:hover{color:#fff!important;background-color:#000!important}.re-button-tooltip{display:none;position:absolute;white-space:nowrap;top:0;z-index:9999901052;background:rgba(0,0,0,.9);border-radius:3px;padding:5px 9px;color:rgba(255,255,255,.8);font-size:12px;line-height:1;font-family:Consolas,Menlo,Monaco,"Courier New",monospace}.re-button-tooltip:after{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none;border-color:none;border-bottom-color:rgba(0,0,0,.9);border-width:4px;margin-left:-4px}.redactor-toolbar-wrapper-air{position:absolute;z-index:999990100}.redactor-air{padding:6px 3px 2px 8px;max-width:576px;min-width:200px;border-radius:4px;background:rgba(0,0,0,.97)}.redactor-air a{background:rgba(37,37,37,.95);box-shadow:none;color:rgba(255,255,255,.9)}.redactor-air a:hover{background:#3d79f2}.redactor-air a.redactor-button-active{background-color:rgba(255,255,255,.15);color:#fff}.redactor-air a.redactor-button-disabled:hover{color:#fff}.redactor-air-helper{position:absolute;right:0;top:0;line-height:1;font-size:15px;color:#000;background:rgba(255,255,255,.85);border-bottom-left-radius:4px;padding:7px 10px 6px 10px;cursor:pointer}.redactor-air-helper:hover{background:#fff}.redactor-voice-label{display:none}.redactor-context-toolbar{position:absolute;top:0;left:0;z-index:9999901051;background-color:rgba(0,0,0,.95);color:#555;border-radius:4px;padding:6px 18px 7px 18px;line-height:1.5;font-family:Consolas,Menlo,Monaco,"Courier New",monospace}.redactor-context-toolbar a{font-size:12px;color:#ccc;text-decoration:none;display:inline-block;padding:2px 0 1px 12px}.redactor-context-toolbar a:first-child{padding-left:0}.redactor-context-toolbar a i{position:relative;top:3px;font-size:16px}.redactor-context-toolbar a:before{content:'';padding-left:10px;border-left:1px solid rgba(255,255,255,.3)}.redactor-context-toolbar a:hover{color:#fff}.redactor-context-toolbar a:first-child:before{padding-left:0;border-left:none}.redactor-context-toolbar[dir=rtl] a{padding:2px 12px 1px 0}.redactor-context-toolbar[dir=rtl] a:first-child{padding-right:0}.redactor-context-toolbar[dir=rtl] a:before{padding-left:0;padding-right:10px;border-right:1px solid rgba(255,255,255,.3);border-left:none}.redactor-context-toolbar[dir=rtl] a:first-child:before{padding-right:0;border-right:none}.redactor-dropdown{display:none;position:absolute;z-index:9999901051;background-color:#fff;box-shadow:0 4px 14px rgba(0,0,0,.2);border-radius:2px;width:264px;min-height:40px;max-height:250px;margin:0;margin-top:-1px;overflow:auto;font-size:15px;padding:0}.redactor-dropdown a span{display:inline-block;line-height:1;padding:2px 4px;border-radius:3px}.redactor-dropdown a{display:block;text-decoration:none;padding:10px 8px;white-space:nowrap;border-bottom:1px solid rgba(0,0,0,.05)}.redactor-dropdown a:last-child{border-bottom-color:transparent}.redactor-dropdown a{color:#000}.redactor-dropdown a:hover{color:#fff!important;background-color:#449aef!important}.redactor-dropdown a.redactor-dropdown-item-disabled{color:rgba(0,0,0,.4);background:#fff}.redactor-dropdown-cells{margin:10px auto}.redactor-dropdown-cells a,.redactor-dropdown-cells span{float:left;cursor:pointer;box-sizing:border-box;text-align:center;padding:0;margin:0;font-size:14px}.redactor-dropdown-selector{display:flex;text-align:center}.redactor-dropdown-selector span{flex-grow:1;font-size:12px;padding:8px;cursor:pointer}.redactor-dropdown-selector span:hover{background:#eee}.redactor-dropdown-selector span.active{cursor:text;color:rgba(0,0,0,.3);background:#eee}.redactor-dropdown-format .redactor-dropdown-item-blockquote{color:rgba(0,0,0,.4);font-style:italic}.redactor-dropdown-format .redactor-dropdown-item-pre{font-family:monospace,sans-serif}.redactor-dropdown-format .redactor-dropdown-item-h1{font-size:40px;font-weight:700;line-height:32px}.redactor-dropdown-format .redactor-dropdown-item-h2{font-size:32px;font-weight:700;line-height:32px}.redactor-dropdown-format .redactor-dropdown-item-h3{font-size:24px;font-weight:700;line-height:24px}.redactor-dropdown-format .redactor-dropdown-item-h4{font-size:21px;font-weight:700;line-height:24px}.redactor-dropdown-format .redactor-dropdown-item-h5{font-size:18px;font-weight:700;line-height:24px}.redactor-dropdown-format .redactor-dropdown-item-h6{font-size:14px;text-transform:uppercase;font-weight:700;line-height:24px}.redactor-modal-box{position:fixed;top:0;left:0;bottom:0;right:0;overflow-x:hidden;overflow-y:auto;z-index:9999901051;line-height:24px}.redactor-modal{position:relative;margin:16px auto;padding:0;background:#fff;box-shadow:0 0 0 1px rgba(0,0,0,.07),0 2px 15px rgba(80,80,80,.25);border-radius:3px;color:#000}.redactor-modal form{margin:0;padding:0;box-sizing:border-box}.redactor-modal input,.redactor-modal select,.redactor-modal textarea{box-sizing:border-box;display:block;width:100%;font-family:inherit;font-size:16px;height:40px;outline:0;vertical-align:middle;background-color:#fff;border:1px solid #cacfd4;border-radius:.1875em;box-shadow:none;padding:0 .5em}.redactor-modal textarea{padding:.5em;height:auto;line-height:1.5;vertical-align:top}.redactor-modal select{-webkit-appearance:none;background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="9" height="12" viewBox="0 0 9 12"><path fill="rgba(0, 0, 0, .4);" d="M0.722,4.823L-0.01,4.1,4.134-.01,4.866,0.716Zm7.555,0L9.01,4.1,4.866-.01l-0.732.726ZM0.722,7.177L-0.01,7.9,4.134,12.01l0.732-.726Zm7.555,0L9.01,7.9,4.866,12.01l-0.732-.726Z"/></svg>');background-repeat:no-repeat;background-position:right .65em center;padding-right:28px}.redactor-modal select[multiple]{background-image:none;height:auto;padding:.5em .75em}.redactor-modal input[type=file]{width:auto;border:none;padding:0;height:auto;background:0 0;box-shadow:none;display:inline-block}.redactor-modal input[type=checkbox],.redactor-modal input[type=radio]{display:inline-block;width:auto;height:auto;padding:0;vertical-align:middle;position:relative;bottom:.15rem;font-size:115%;margin-right:3px}.redactor-modal .form-item{margin-bottom:20px}.redactor-modal .form-item:last-child{margin-bottom:0}.redactor-modal fieldset{border:1px solid rgba(0,0,0,.1);border-radius:3px;padding:16px;padding-bottom:20px;margin-bottom:20px}.redactor-modal fieldset .form-item{margin-bottom:12px}.redactor-modal label{display:block;color:#555;margin-bottom:.25em;font-size:14px}.redactor-modal label .desc,.redactor-modal label .error,.redactor-modal label .success{text-transform:none;font-weight:400}.redactor-modal label.checkbox{font-size:16px;line-height:1.5;cursor:pointer;color:inherit}.redactor-modal .form-checkboxes label.checkbox{display:inline-block;margin-right:1em}.redactor-modal input:hover,.redactor-modal select:hover,.redactor-modal textarea:hover{outline:0;background-color:#fff;border-color:#969fa9;box-shadow:none}.redactor-modal input:focus,.redactor-modal select:focus,.redactor-modal textarea:focus{transition:all linear .2s;outline:0;background-color:#fff;border-color:rgba(0,125,255,.5);box-shadow:0 0 3px rgba(0,125,255,.5)}.redactor-modal input.error,.redactor-modal select.error,.redactor-modal textarea.error{background-color:rgba(255,50,101,.1);border:1px solid #ff7f9e}.redactor-modal input.error:focus,.redactor-modal select.error:focus,.redactor-modal textarea.error:focus{border-color:#ff3265;box-shadow:0 0 1px #ff3265}.redactor-modal input.success,.redactor-modal select.success,.redactor-modal textarea.success{background-color:rgba(47,196,182,.1);border:1px solid #65dacf}.redactor-modal input.success:focus,.redactor-modal select.success:focus,.redactor-modal textarea.success:focus{border-color:#2fc4b6;box-shadow:0 0 1px #2fc4b6}.redactor-modal input.disabled,.redactor-modal input.disabled:hover,.redactor-modal input:disabled,.redactor-modal input:disabled:hover,.redactor-modal select.disabled,.redactor-modal select.disabled:hover,.redactor-modal select:disabled,.redactor-modal select:disabled:hover,.redactor-modal textarea.disabled,.redactor-modal textarea.disabled:hover,.redactor-modal textarea:disabled,.redactor-modal textarea:disabled:hover{resize:none;opacity:.6;cursor:default;font-style:italic;color:rgba(0,0,0,.5);border:1px solid #cacfd4;box-shadow:none;background-color:#fff}.redactor-modal .req{position:relative;top:1px;font-weight:700;color:#ff3265;font-size:110%}.redactor-modal .desc{color:rgba(51,51,51,.5);font-size:12px}.redactor-modal span.desc{margin-left:.25em}.redactor-modal div.desc{margin-top:.25em}.redactor-modal span.error,.redactor-modal span.success{font-size:12px;margin-left:.25em}.redactor-modal div.desc{margin-bottom:-.5em}.redactor-modal .redactor-close{position:absolute;top:16px;right:12px;font-size:30px;line-height:30px;padding:0 4px;color:#000;opacity:.3;cursor:pointer}.redactor-modal .redactor-close:hover{opacity:1}.redactor-modal .redactor-close:before{content:'\00d7'}.redactor-modal button{display:inline-flex;align-items:center;text-decoration:none;text-align:center;font-family:inherit;font-size:15px;font-weight:500;color:#007dff;background-color:#fff;border-radius:3px;border:2px solid #007dff;min-height:40px;outline:0;padding:.5em 1.25em;cursor:pointer;line-height:1.2;vertical-align:middle;-webkit-appearance:none}.redactor-modal button:hover{outline:0;text-decoration:none;background:0 0;color:rgba(0,125,255,.6);border-color:rgba(0,125,255,.5)}.redactor-modal button.redactor-button-secondary{border-color:#2a2e34;color:#2a2e34}.redactor-modal button.redactor-button-secondary:hover{color:rgba(42,46,52,.6);border-color:rgba(42,46,52,.5)}.redactor-modal button.redactor-button-danger,.redactor-modal button.redactor-button-unstyled{background:0 0;border-color:transparent;color:rgba(42,46,52,.6)}.redactor-modal button.redactor-button-danger:hover,.redactor-modal button.redactor-button-unstyled:hover{background:0 0;border-color:transparent;color:#ff3265;text-decoration:underline}.redactor-modal .redactor-modal-group:after{content:"";display:table;clear:both}.redactor-modal .redactor-modal-side{float:left;width:30%;margin-right:4%}.redactor-modal .redactor-modal-side img{max-width:100%;height:auto;display:block}.redactor-modal .redactor-modal-area{float:left;width:66%}.redactor-modal[dir=rtl] .redactor-close{left:12px;right:auto}.redactor-modal[dir=rtl] textarea{direction:ltr;text-align:left}.redactor-modal[dir=rtl] .redactor-modal-footer button.redactor-button-unstyled{float:left;margin-left:0}.redactor-modal-header{padding:20px;font-size:18px;line-height:24px;font-weight:700;color:#000;border-bottom:1px solid rgba(0,0,0,.05)}.redactor-modal-header:empty{display:none}.redactor-modal-body{padding:32px 48px;padding-bottom:40px}.redactor-modal-footer{padding:24px;border-top:1px solid rgba(0,0,0,.05);overflow:hidden}.redactor-modal-footer button{margin-right:4px}.redactor-modal-footer button.redactor-button-unstyled{margin-right:0;float:right}.redactor-modal-footer:empty{display:none}.redactor-modal-tabs{display:flex;border-bottom:2px solid rgba(0,0,0,.05);margin-bottom:1em}.redactor-modal-tabs a{font-size:15px;padding:2px 0;text-decoration:none;color:rgba(0,0,0,.5);border-bottom:2px solid transparent;margin-bottom:-2px;margin-right:14px}.redactor-modal-tabs a:hover{transition:all linear .2s}.redactor-modal-tabs a.active,.redactor-modal-tabs a:hover{font-weight:500;color:#007dff;border-bottom-color:#007dff}.redactor-styles{margin:0;padding:16px 18px;color:#333;font-size:1em;line-height:1.5;box-sizing:border-box}.redactor-styles *,.redactor-styles :after,.redactor-styles :before{box-sizing:inherit}.redactor-styles[dir=rtl]{direction:rtl;unicode-bidi:embed}.redactor-styles[dir=rtl] ol li,.redactor-styles[dir=rtl] ul li{text-align:right}.redactor-styles[dir=rtl] ol,.redactor-styles[dir=rtl] ol ol,.redactor-styles[dir=rtl] ol ul,.redactor-styles[dir=rtl] ul,.redactor-styles[dir=rtl] ul ol,.redactor-styles[dir=rtl] ul ul{margin:0 1.5em 0 0}.redactor-styles[dir=rtl] figcaption{text-align:right}.redactor-styles ol[dir=rtl],.redactor-styles ol[dir=rtl] ol,.redactor-styles ol[dir=rtl] ul,.redactor-styles ul[dir=rtl],.redactor-styles ul[dir=rtl] ol,.redactor-styles ul[dir=rtl] ul{margin:0 1.5em 0 0}.redactor-styles ol[dir=rtl] li,.redactor-styles ul[dir=rtl] li{text-align:right}.redactor-styles a,.redactor-styles a:hover{color:#3397ff}.redactor-styles address,.redactor-styles blockquote,.redactor-styles dl,.redactor-styles figure,.redactor-styles hr,.redactor-styles p,.redactor-styles pre,.redactor-styles table{padding:0;margin:0;margin-bottom:1em}.redactor-styles ol,.redactor-styles ul{padding:0}.redactor-styles ol,.redactor-styles ol ol,.redactor-styles ol ul,.redactor-styles ul,.redactor-styles ul ol,.redactor-styles ul ul{margin:0 0 0 1.5em}.redactor-styles ol li,.redactor-styles ul li{text-align:left}.redactor-styles ol ol li{list-style-type:lower-alpha}.redactor-styles ol ol ol li{list-style-type:lower-roman}.redactor-styles ol,.redactor-styles ul{margin-bottom:1em}.redactor-styles h1,.redactor-styles h2,.redactor-styles h3,.redactor-styles h4,.redactor-styles h5,.redactor-styles h6{font-weight:700;color:#111;text-rendering:optimizeLegibility;margin:0;padding:0;margin-bottom:.5em;line-height:1.2}.redactor-styles h1{font-size:2.0736em}.redactor-styles h2{font-size:1.728em}.redactor-styles h3{font-size:1.44em}.redactor-styles h4{font-size:1.2em}.redactor-styles h5{font-size:1em}.redactor-styles h6{font-size:.83333em;text-transform:uppercase;letter-spacing:.035em}.redactor-styles blockquote{font-style:italic;color:rgba(0,0,0,.5);border:none}.redactor-styles table{width:100%}.redactor-styles code,.redactor-styles kbd,.redactor-styles mark,.redactor-styles small,.redactor-styles time,.redactor-styles var{display:inline-block;font-family:Consolas,Menlo,Monaco,"Courier New",monospace;font-size:87.5%;line-height:1;color:rgba(51,51,51,.9)}.redactor-styles cite,.redactor-styles var{opacity:.6}.redactor-styles var{font-style:normal}.redactor-styles abbr,.redactor-styles dfn{text-transform:uppercase}.redactor-styles abbr[title],.redactor-styles dfn[title]{text-decoration:none;border-bottom:1px dotted rgba(0,0,0,.5);cursor:help}.redactor-styles code,.redactor-styles kbd{position:relative;top:-1px;padding:.25em;padding-bottom:.2em;border-radius:2px}.redactor-styles code{background-color:#eff1f2}.redactor-styles mark{border-radius:2px;padding:.125em .25em;background-color:#fdb833}.redactor-styles kbd{border:1px solid #e5e7e9}.redactor-styles sub,.redactor-styles sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}.redactor-styles sub{bottom:-.25em}.redactor-styles sup{top:-.5em}.redactor-styles pre{font-family:Consolas,Menlo,Monaco,"Courier New",monospace;font-size:.9em}.redactor-styles pre,.redactor-styles pre code{background-color:#f6f7f8;padding:0;top:0;display:block;line-height:1.5;color:rgba(51,51,51,.85);overflow:none;white-space:pre-wrap}.redactor-styles pre{padding:1rem}.redactor-styles table{border-collapse:collapse;max-width:100%;width:100%}.redactor-styles table caption{text-transform:uppercase;padding:0;color:rgba(0,0,0,.5);font-size:11px}.redactor-styles table td,.redactor-styles table th{border:1px solid #eee;padding:16px;padding-bottom:15px}.redactor-styles table tfoot td,.redactor-styles table tfoot th{color:rgba(0,0,0,.5)}.redactor-styles audio,.redactor-styles embed,.redactor-styles img,.redactor-styles object,.redactor-styles video{max-width:100%}.redactor-styles embed,.redactor-styles img,.redactor-styles object,.redactor-styles video{height:auto!important}.redactor-styles img{vertical-align:middle;-ms-interpolation-mode:bicubic}.redactor-styles figcaption{display:block;opacity:.6;font-size:12px;font-style:italic;text-align:left}.upload-redactor-box{display:flex;flex-direction:column;justify-content:center;align-items:center;box-sizing:border-box;border:5px dashed rgba(0,125,255,.15);position:relative;width:100%;min-height:220px;background:#fff;cursor:pointer;overflow:hidden;text-align:center}.upload-redactor-placeholder{font-size:15px;line-height:1.5;color:rgba(0,0,0,.3);font-style:italic}.upload-redactor-hover{background-color:rgba(0,125,255,.075)}.upload-redactor-error{background-color:rgba(255,50,101,.075)}.upload-redactor-box-hover{outline:5px dashed rgba(0,125,255,.3)}.upload-redactor-box-error{outline:5px dashed rgba(255,50,101,.3)}.redactor-structure div,.redactor-structure h1,.redactor-structure h2,.redactor-structure h3,.redactor-structure h4,.redactor-structure h5,.redactor-structure h6{position:relative}.redactor-structure div:before,.redactor-structure h1:before,.redactor-structure h2:before,.redactor-structure h3:before,.redactor-structure h4:before,.redactor-structure h5:before,.redactor-structure h6:before{width:24px;position:absolute;font-size:10px;font-weight:400;opacity:.5;left:-26px;top:50%;margin-top:-7px;text-align:right}.redactor-structure h1:before{content:"h1"}.redactor-structure h2:before{content:"h2"}.redactor-structure h3:before{content:"h3"}.redactor-structure h4:before{content:"h4"}.redactor-structure h5:before{content:"h5"}.redactor-structure h6:before{content:"h6"}.redactor-structure div:before{content:"div"}#redactor-progress{position:fixed;top:0;left:0;width:100%;z-index:9999901000000;height:10px}#redactor-progress span{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.2) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.2) 50%,rgba(255,255,255,.2) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.2) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.2) 50%,rgba(255,255,255,.2) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.2) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.2) 50%,rgba(255,255,255,.2) 75%,transparent 75%,transparent);-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite;display:block;width:100%;height:100%;background-color:#007dff;background-size:40px 40px}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.redactor-box-fullscreen{z-index:9999901051;position:fixed;top:0;left:0;width:100%}.redactor-box-fullscreen-target{position:absolute!important}.redactor-body-fullscreen .redactor-context-toolbar,.redactor-body-fullscreen .redactor-dropdown{z-index:9999901052}.redactor-body-fullscreen #redactor-overlay{z-index:9999901098}.redactor-body-fullscreen #redactor-modal{z-index:9999901099}



.redactor-box.redactor-styles-on .redactor-toolbar {
	padding: 6px
}

.redactor-box.redactor-styles-on {
	 -webkit-box-shadow: inset 0 1px 3px rgba(0,0,0,.1);
     -moz-box-shadow: inset 0 1px 3px rgba(0,0,0,.1);
          box-shadow: inset 0 1px 3px rgba(0,0,0,.1);
     border-color: gray;
     background: rgb(250, 250, 250);
}

.redactor-dropdown-format .redactor-dropdown-item-h2 {
	font-size: 18px;
}


.redactor-dropdown a {
	padding: 3px 5px;
}