mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-20 21:40:48 +01:00
Merge branch 'master' of https://github.com/devcode-it/openstamanager
This commit is contained in:
commit
4185bc603d
39
actions.php
39
actions.php
@ -57,18 +57,21 @@ if (filter('op') == 'aggiungi-allegato' || filter('op') == 'rimuovi-allegato') {
|
|||||||
//UPLOAD PER CKEDITOR
|
//UPLOAD PER CKEDITOR
|
||||||
if (filter('op') == 'aggiungi-allegato' && !empty($_FILES) && !empty($_FILES['upload']['name'])) {
|
if (filter('op') == 'aggiungi-allegato' && !empty($_FILES) && !empty($_FILES['upload']['name'])) {
|
||||||
|
|
||||||
$CKEditor = $_GET['CKEditor'];
|
$CKEditor = get('CKEditor');
|
||||||
$funcNum = $_GET['CKEditorFuncNum'];
|
$funcNum = get('CKEditorFuncNum');
|
||||||
|
|
||||||
|
|
||||||
$allowed_extension = array(
|
$allowed_extension = array(
|
||||||
"png","jpg","jpeg"
|
"png","jpg","jpeg"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//Maximum file limit (unit: byte)
|
||||||
|
$max_size='2097152'; //2MB
|
||||||
|
|
||||||
// Get image file extension
|
// Get image file extension
|
||||||
$file_extension = pathinfo($_FILES["upload"]["name"], PATHINFO_EXTENSION);
|
$file_extension = pathinfo($_FILES["upload"]["name"], PATHINFO_EXTENSION);
|
||||||
|
|
||||||
if(in_array(strtolower($file_extension),$allowed_extension)){
|
if(in_array(strtolower($file_extension),$allowed_extension) && $_FILES["upload"]['size']<$max_size){
|
||||||
|
|
||||||
$upload = Uploads::upload($_FILES['upload'], [
|
$upload = Uploads::upload($_FILES['upload'], [
|
||||||
'name' => filter('nome_allegato'),
|
'name' => filter('nome_allegato'),
|
||||||
@ -77,24 +80,42 @@ if (filter('op') == 'aggiungi-allegato' || filter('op') == 'rimuovi-allegato') {
|
|||||||
'id_record' => $id_record,
|
'id_record' => $id_record,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<link rel="stylesheet" type="text/css" href="'.$baseurl.'/assets/dist/css/app.min.css" />';
|
||||||
|
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<script src="'.$baseurl.'/assets/dist/js/app.min.js"></script>';
|
||||||
|
|
||||||
|
|
||||||
// Creazione file fisico
|
// Creazione file fisico
|
||||||
if (!empty($upload)) {
|
if (!empty($upload)) {
|
||||||
flash()->info(tr('File caricato correttamente!'));
|
//flash()->info(tr('File caricato correttamente!'));
|
||||||
|
|
||||||
$id_allegato = $dbo->lastInsertedID();
|
$id_allegato = $dbo->lastInsertedID();
|
||||||
$upload = Upload::find($id_allegato);
|
$upload = Upload::find($id_allegato);
|
||||||
|
|
||||||
echo '<script>window.parent.CKEDITOR.tools.callFunction('.$funcNum.', "'.$baseurl.'/'.$upload->filepath.'", "'.$message.'")</script>';
|
echo '
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
window.parent.toastr.success("'.tr('Caricamento riuscito').'");
|
||||||
|
window.parent.CKEDITOR.tools.callFunction('.$funcNum.', "'.$baseurl.'/'.$upload->filepath.'");
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
flash()->error(tr('Errore durante il caricamento del file!'));
|
|
||||||
|
//flash()->error(tr('Errore durante il caricamento del file!'));
|
||||||
|
echo '<script type="text/javascript"> window.parent.toastr.error("'.tr('Errore durante il caricamento del file!').'"); </script>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
//flash()->error(tr('Estensione non permessa!'));
|
//flash()->error(tr('Estensione non permessa!'));
|
||||||
//toastr["error"]("'.tr('Estensione non permessa').'");
|
echo '<script type="text/javascript"> window.parent.toastr.error("'.tr('Estensione non permessa').'"); </script>';
|
||||||
echo '<script> alert("'.tr('Estensione non permessa').'"); </script>';
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,10 +38,15 @@ function initCharCounter(input) {
|
|||||||
postText: '',
|
postText: '',
|
||||||
showMaxLength: true,
|
showMaxLength: true,
|
||||||
placement: 'bottom-right-inside',
|
placement: 'bottom-right-inside',
|
||||||
utf8: true,
|
utf8: false, //Default: false
|
||||||
appendToParent: true,
|
appendToParent: true,
|
||||||
alwaysShow: false,
|
alwaysShow: true,
|
||||||
threshold: 150
|
//threshold: 150,
|
||||||
|
twoCharLinebreak: false, //count linebreak as 2 characters to match IE/Chrome textarea validation. Default: true.
|
||||||
|
warningClass: "small form-text text-muted",
|
||||||
|
limitReachedClass: "small form-text text-warning",
|
||||||
|
limitExceededClass: "small form-text text-danger",
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -52,12 +57,17 @@ function initCharCounter(input) {
|
|||||||
limitReachedClass: "help-block text-danger",
|
limitReachedClass: "help-block text-danger",
|
||||||
showMaxLength: false,
|
showMaxLength: false,
|
||||||
placement: 'bottom-right-inside',
|
placement: 'bottom-right-inside',
|
||||||
utf8: true,
|
utf8: false, //Default: false
|
||||||
|
twoCharLinebreak: false, //count linebreak as 2 characters to match IE/Chrome textarea validation. Default: true.
|
||||||
appendToParent: true,
|
appendToParent: true,
|
||||||
alwaysShow: true
|
alwaysShow: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$input.on('autosize:resized', function() {
|
||||||
|
$(this).trigger('maxlength.reposition');
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ use Modules\Iva\Aliquota;
|
|||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{[ "type": "number", "label": "<?php echo tr('Quantità'); ?>", "name": "qta", "required": 1, "value": "$qta$", "readonly": 1, "decimals": "qta", "min-value": "undefined" ]}
|
{[ "type": "number", "label": "<?php echo tr('Quantità'); ?>", "name": "qta", "required": 1, "value": "$qta$", "readonly": 1, "decimals": "qta", "min-value": "undefined", "icon-after": "<?php echo (!empty($record['um']) ? $record['um']: ''); ?>" ]}
|
||||||
<input type="hidden" id="old_qta" value="<?php echo $record['qta']; ?>">
|
<input type="hidden" id="old_qta" value="<?php echo $record['qta']; ?>">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -125,7 +125,9 @@ use Modules\Iva\Aliquota;
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="alert alert-info">
|
<div class="alert alert-info">
|
||||||
<p><?php echo tr('Le modifiche alle quantità in questa schermata prevedono la generazione di un movimento relativo per la Sede legale'); ?>. <?php echo tr('Per effettuare movimenti in altre Sedi, utilizzare il modulo Movimenti relativo'); ?>.</p>
|
<p><?php echo tr('Le modifiche alle quantità in questa schermata prevedono la generazione di un movimento relativo alla sede legale'); ?>. <?php echo tr('Se si desidera effettuare movimenti per altre sedi, utilizzare il modulo _MODULO_ ', [
|
||||||
|
'_MODULO_' => Modules::link('Movimenti', null, tr('Movimenti'))
|
||||||
|
]); ?>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -25,7 +25,7 @@ include_once __DIR__.'/../../core.php';
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
{[ "type": "text", "label": "<?php echo tr('Descrizione'); ?>", "name": "descrizione", "required": 1 ]}
|
{[ "type": "text", "label": "<?php echo tr('Descrizione'); ?>", "name": "descrizione", "required": 1, "charcounter": 1, "maxlength": "100" ]}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ include_once __DIR__.'/../../core.php';
|
|||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
{[ "type": "text", "label": "<?php echo tr('Descrizione'); ?>", "name": "descrizione", "required": 1, "value": "$descrizione$" ]}
|
{[ "type": "text", "label": "<?php echo tr('Descrizione'); ?>", "name": "descrizione", "required": 1, "value": "$descrizione$", "charcounter": 1, "maxlength": "100" ]}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -547,7 +547,7 @@ echo '
|
|||||||
?>
|
?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
{[ "type": "textarea", "label": "<?php echo tr('Note'); ?>", "name": "note", "help": "<?php echo tr('Note visibili anche in fattura.'); ?>", "value": "$note$" ]}
|
{[ "type": "textarea", "label": "<?php echo tr('Note'); ?>", "name": "note", "help": "<?php echo tr('Note visibili anche in fattura.'); ?>", "value": "$note$", "charcounter": 1 ]}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ if (!$is_completato) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<script src="'.base_path().'/assets/src/js/functions/functions.js"></script>
|
<script src="'.base_path().'/assets/dist/js/functions.min.js"></script>
|
||||||
<script>$(document).ready(init)</script>
|
<script>$(document).ready(init)</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -1037,7 +1037,15 @@ class FatturaElettronica
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($causale)) {
|
if (!empty($causale)) {
|
||||||
$result['CausaleTrasporto'] = $causale;
|
|
||||||
|
/**
|
||||||
|
* Id SdI: 2.1.9.3
|
||||||
|
* Caratteri min-max: 1 - 100 caretteri
|
||||||
|
* Ripetibile: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
$result['CausaleTrasporto'] = safe_truncate(html_entity_decode($causale), 100, null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($documento['n_colli'])) {
|
if (!empty($documento['n_colli'])) {
|
||||||
@ -1337,163 +1345,169 @@ class FatturaElettronica
|
|||||||
})->aliquota;
|
})->aliquota;
|
||||||
|
|
||||||
foreach ($righe as $idx => $riga) {
|
foreach ($righe as $idx => $riga) {
|
||||||
$dati_aggiuntivi = $riga->dati_aggiuntivi_fe;
|
|
||||||
|
|
||||||
$dettaglio = [
|
// Righe - Descrizione della causale del documento (2.2.1.4)
|
||||||
'NumeroLinea' => $riga['order'],
|
$descrizioni = self::chunkSplit($riga['descrizione'], 1000);
|
||||||
];
|
|
||||||
|
|
||||||
// 2.2.1.2
|
foreach ($descrizioni as $descrizione) {
|
||||||
if (!empty($dati_aggiuntivi['tipo_cessione_prestazione'])) {
|
|
||||||
$dettaglio['TipoCessionePrestazione'] = $dati_aggiuntivi['tipo_cessione_prestazione'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2.2.1.3
|
$dati_aggiuntivi = $riga->dati_aggiuntivi_fe;
|
||||||
if (empty($riga->isDescrizione())) {
|
|
||||||
if (!empty($riga->codice) || (!empty($dati_aggiuntivi['codice_tipo']) && !empty($dati_aggiuntivi['codice_valore']))) {
|
$dettaglio = [
|
||||||
$codice_articolo = [
|
'NumeroLinea' => $riga['order'],
|
||||||
'CodiceTipo' => $dati_aggiuntivi['codice_tipo'] ?: 'COD',
|
];
|
||||||
'CodiceValore' => $dati_aggiuntivi['codice_valore'] ?: $riga->codice,
|
|
||||||
|
// 2.2.1.2
|
||||||
|
if (!empty($dati_aggiuntivi['tipo_cessione_prestazione'])) {
|
||||||
|
$dettaglio['TipoCessionePrestazione'] = $dati_aggiuntivi['tipo_cessione_prestazione'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2.2.1.3
|
||||||
|
if (empty($riga->isDescrizione())) {
|
||||||
|
if (!empty($riga->codice) || (!empty($dati_aggiuntivi['codice_tipo']) && !empty($dati_aggiuntivi['codice_valore']))) {
|
||||||
|
$codice_articolo = [
|
||||||
|
'CodiceTipo' => $dati_aggiuntivi['codice_tipo'] ?: 'COD',
|
||||||
|
'CodiceValore' => $dati_aggiuntivi['codice_valore'] ?: $riga->codice,
|
||||||
|
];
|
||||||
|
|
||||||
|
$dettaglio['CodiceArticolo'] = $codice_articolo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//$descrizione = $riga['descrizione'];
|
||||||
|
|
||||||
|
// Aggiunta dei riferimenti ai documenti
|
||||||
|
if (setting('Riferimento dei documenti in Fattura Elettronica') && $riga->hasOriginalComponent()) {
|
||||||
|
$descrizione .= "\n".$riga->getOriginalComponent()->getDocument()->getReference();
|
||||||
|
}
|
||||||
|
|
||||||
|
$dettaglio['Descrizione'] = $descrizione;
|
||||||
|
|
||||||
|
$qta = abs($riga->qta) ?: 1;
|
||||||
|
$dettaglio['Quantita'] = $qta;
|
||||||
|
|
||||||
|
if (!empty($riga['um'])) {
|
||||||
|
$dettaglio['UnitaMisura'] = $riga['um'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($dati_aggiuntivi['data_inizio_periodo'])) {
|
||||||
|
$dettaglio['DataInizioPeriodo'] = $dati_aggiuntivi['data_inizio_periodo'];
|
||||||
|
}
|
||||||
|
if (!empty($dati_aggiuntivi['data_fine_periodo'])) {
|
||||||
|
$dettaglio['DataFinePeriodo'] = $dati_aggiuntivi['data_fine_periodo'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$dettaglio['PrezzoUnitario'] = $riga->prezzo_unitario ?: 0;
|
||||||
|
|
||||||
|
// Sconto (2.2.1.10)
|
||||||
|
$sconto_unitario = (float) $riga->sconto_unitario;
|
||||||
|
|
||||||
|
if (!empty($sconto_unitario)) {
|
||||||
|
$sconto = [
|
||||||
|
'Tipo' => $sconto_unitario > 0 ? 'SC' : 'MG',
|
||||||
];
|
];
|
||||||
|
|
||||||
$dettaglio['CodiceArticolo'] = $codice_articolo;
|
if ($riga['tipo_sconto'] == 'PRC') {
|
||||||
}
|
$sconto['Percentuale'] = abs($riga->sconto_percentuale);
|
||||||
}
|
} else {
|
||||||
|
$sconto['Importo'] = abs($sconto_unitario);
|
||||||
|
}
|
||||||
|
|
||||||
// Non ammesso ’
|
$dettaglio['ScontoMaggiorazione'] = $sconto;
|
||||||
$descrizione = $riga['descrizione'];
|
|
||||||
|
|
||||||
// Aggiunta dei riferimenti ai documenti
|
|
||||||
if (setting('Riferimento dei documenti in Fattura Elettronica') && $riga->hasOriginalComponent()) {
|
|
||||||
$descrizione .= "\n".$riga->getOriginalComponent()->getDocument()->getReference();
|
|
||||||
}
|
|
||||||
|
|
||||||
$dettaglio['Descrizione'] = $descrizione;
|
|
||||||
|
|
||||||
$qta = abs($riga->qta) ?: 1;
|
|
||||||
$dettaglio['Quantita'] = $qta;
|
|
||||||
|
|
||||||
if (!empty($riga['um'])) {
|
|
||||||
$dettaglio['UnitaMisura'] = $riga['um'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($dati_aggiuntivi['data_inizio_periodo'])) {
|
|
||||||
$dettaglio['DataInizioPeriodo'] = $dati_aggiuntivi['data_inizio_periodo'];
|
|
||||||
}
|
|
||||||
if (!empty($dati_aggiuntivi['data_fine_periodo'])) {
|
|
||||||
$dettaglio['DataFinePeriodo'] = $dati_aggiuntivi['data_fine_periodo'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$dettaglio['PrezzoUnitario'] = $riga->prezzo_unitario ?: 0;
|
|
||||||
|
|
||||||
// Sconto (2.2.1.10)
|
|
||||||
$sconto_unitario = (float) $riga->sconto_unitario;
|
|
||||||
|
|
||||||
if (!empty($sconto_unitario)) {
|
|
||||||
$sconto = [
|
|
||||||
'Tipo' => $sconto_unitario > 0 ? 'SC' : 'MG',
|
|
||||||
];
|
|
||||||
|
|
||||||
if ($riga['tipo_sconto'] == 'PRC') {
|
|
||||||
$sconto['Percentuale'] = abs($riga->sconto_percentuale);
|
|
||||||
} else {
|
|
||||||
$sconto['Importo'] = abs($sconto_unitario);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$dettaglio['ScontoMaggiorazione'] = $sconto;
|
$aliquota = $riga->aliquota ?: $iva_descrizioni;
|
||||||
}
|
// Se sono presenti solo righe descrittive uso l'iva da impostazioni
|
||||||
|
if (empty($aliquota)) {
|
||||||
$aliquota = $riga->aliquota ?: $iva_descrizioni;
|
$aliquota_predefinita = Aliquota::find(setting("Iva predefinita"));
|
||||||
// Se sono presenti solo righe descrittive uso l'iva da impostazioni
|
$aliquota = $aliquota_predefinita;
|
||||||
if (empty($aliquota)) {
|
|
||||||
$aliquota_predefinita = Aliquota::find(setting("Iva predefinita"));
|
|
||||||
$aliquota = $aliquota_predefinita;
|
|
||||||
}
|
|
||||||
$percentuale = floatval($aliquota->percentuale);
|
|
||||||
|
|
||||||
$prezzo_totale = $riga->totale_imponibile;
|
|
||||||
$prezzo_totale = $prezzo_totale ?: 0;
|
|
||||||
$dettaglio['PrezzoTotale'] = $prezzo_totale;
|
|
||||||
|
|
||||||
$dettaglio['AliquotaIVA'] = $percentuale;
|
|
||||||
|
|
||||||
if (!empty($riga['idritenutaacconto']) && empty($riga['is_descrizione'])) {
|
|
||||||
$dettaglio['Ritenuta'] = 'SI';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Controllo aggiuntivo codice_natura_fe per evitare che venga riportato il tag vuoto
|
|
||||||
if (empty($percentuale) && !empty($aliquota['codice_natura_fe'])) {
|
|
||||||
$dettaglio['Natura'] = $aliquota['codice_natura_fe'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($dati_aggiuntivi['riferimento_amministrazione'])) {
|
|
||||||
$dettaglio['RiferimentoAmministrazione'] = $dati_aggiuntivi['riferimento_amministrazione'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// AltriDatiGestionali (2.2.1.16) - Ritenuta ENASARCO
|
|
||||||
// https://forum.italia.it/uploads/default/original/2X/d/d35d721c3a3a601d2300378724a270154e23af52.jpeg
|
|
||||||
if (!empty($riga['ritenuta_contributi'])) {
|
|
||||||
$dettaglio[]['AltriDatiGestionali'] = [
|
|
||||||
'TipoDato' => 'CASSA-PREV',
|
|
||||||
'RiferimentoTesto' => setting('Tipo Cassa Previdenziale').' - '.$ritenuta_contributi->descrizione.' ('.Translator::numberToLocale($ritenuta_contributi->percentuale).'%)',
|
|
||||||
'RiferimentoNumero' => $riga->ritenuta_contributi,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$rs_ritenuta = $database->fetchOne('SELECT percentuale_imponibile FROM co_ritenutaacconto WHERE id='.prepare($riga['idritenutaacconto']));
|
|
||||||
if (!empty($rs_ritenuta['percentuale_imponibile'])) {
|
|
||||||
$dettaglio[]['AltriDatiGestionali'] = [
|
|
||||||
'TipoDato' => 'IMPON-RACC',
|
|
||||||
'RiferimentoTesto' => 'Imponibile % ritenuta d\'acconto',
|
|
||||||
'RiferimentoNumero' => $rs_ritenuta['percentuale_imponibile'],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dichiarazione d'intento
|
|
||||||
//Il numero di protocollo della dichiarazione d’intento, rilevabile dalla ricevuta telematica rilasciata dall’Agenzia delle entrate, è composto da 2 parti 17+6 (protocollo di ricezione della dichiarazione d’intento e il suo progressivo)
|
|
||||||
//$id_iva_dichiarazione = setting("Iva per lettere d'intento");
|
|
||||||
$dichiarazione = $documento->dichiarazione;
|
|
||||||
$ive_accettate = [];
|
|
||||||
$rs = $database->table('co_iva')->where('codice_natura_fe','N3.5')->get();
|
|
||||||
foreach($rs as $r){
|
|
||||||
$ive_accettate[] = $r->id;
|
|
||||||
}
|
|
||||||
if (!empty($dichiarazione) && in_array($riga->aliquota->id, $ive_accettate) ) {
|
|
||||||
$dettaglio[]['AltriDatiGestionali'] = [
|
|
||||||
'TipoDato' => 'INTENTO',
|
|
||||||
'RiferimentoTesto' => $dichiarazione->numero_protocollo,
|
|
||||||
'RiferimentoData' => $dichiarazione->data_protocollo,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dati aggiuntivi dinamici
|
|
||||||
if (!empty($dati_aggiuntivi['altri_dati'])) {
|
|
||||||
foreach ($dati_aggiuntivi['altri_dati'] as $dato) {
|
|
||||||
$altri_dati = [];
|
|
||||||
|
|
||||||
if (!empty($dato['tipo_dato'])) {
|
|
||||||
$altri_dati['TipoDato'] = $dato['tipo_dato'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($dato['riferimento_testo'])) {
|
|
||||||
$altri_dati['RiferimentoTesto'] = $dato['riferimento_testo'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($dato['riferimento_numero'])) {
|
|
||||||
$altri_dati['RiferimentoNumero'] = $dato['riferimento_numero'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($dato['riferimento_data'])) {
|
|
||||||
$altri_dati['RiferimentoData'] = $dato['riferimento_data'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$dettaglio[]['AltriDatiGestionali'] = $altri_dati;
|
|
||||||
}
|
}
|
||||||
}
|
$percentuale = floatval($aliquota->percentuale);
|
||||||
|
|
||||||
$result[] = [
|
$prezzo_totale = $riga->totale_imponibile;
|
||||||
'DettaglioLinee' => $dettaglio,
|
$prezzo_totale = $prezzo_totale ?: 0;
|
||||||
];
|
$dettaglio['PrezzoTotale'] = $prezzo_totale;
|
||||||
|
|
||||||
|
$dettaglio['AliquotaIVA'] = $percentuale;
|
||||||
|
|
||||||
|
if (!empty($riga['idritenutaacconto']) && empty($riga['is_descrizione'])) {
|
||||||
|
$dettaglio['Ritenuta'] = 'SI';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Controllo aggiuntivo codice_natura_fe per evitare che venga riportato il tag vuoto
|
||||||
|
if (empty($percentuale) && !empty($aliquota['codice_natura_fe'])) {
|
||||||
|
$dettaglio['Natura'] = $aliquota['codice_natura_fe'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($dati_aggiuntivi['riferimento_amministrazione'])) {
|
||||||
|
$dettaglio['RiferimentoAmministrazione'] = $dati_aggiuntivi['riferimento_amministrazione'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// AltriDatiGestionali (2.2.1.16) - Ritenuta ENASARCO
|
||||||
|
// https://forum.italia.it/uploads/default/original/2X/d/d35d721c3a3a601d2300378724a270154e23af52.jpeg
|
||||||
|
if (!empty($riga['ritenuta_contributi'])) {
|
||||||
|
$dettaglio[]['AltriDatiGestionali'] = [
|
||||||
|
'TipoDato' => 'CASSA-PREV',
|
||||||
|
'RiferimentoTesto' => setting('Tipo Cassa Previdenziale').' - '.$ritenuta_contributi->descrizione.' ('.Translator::numberToLocale($ritenuta_contributi->percentuale).'%)',
|
||||||
|
'RiferimentoNumero' => $riga->ritenuta_contributi,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$rs_ritenuta = $database->fetchOne('SELECT percentuale_imponibile FROM co_ritenutaacconto WHERE id='.prepare($riga['idritenutaacconto']));
|
||||||
|
if (!empty($rs_ritenuta['percentuale_imponibile'])) {
|
||||||
|
$dettaglio[]['AltriDatiGestionali'] = [
|
||||||
|
'TipoDato' => 'IMPON-RACC',
|
||||||
|
'RiferimentoTesto' => 'Imponibile % ritenuta d\'acconto',
|
||||||
|
'RiferimentoNumero' => $rs_ritenuta['percentuale_imponibile'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dichiarazione d'intento
|
||||||
|
//Il numero di protocollo della dichiarazione d’intento, rilevabile dalla ricevuta telematica rilasciata dall’Agenzia delle entrate, è composto da 2 parti 17+6 (protocollo di ricezione della dichiarazione d’intento e il suo progressivo)
|
||||||
|
//$id_iva_dichiarazione = setting("Iva per lettere d'intento");
|
||||||
|
$dichiarazione = $documento->dichiarazione;
|
||||||
|
$ive_accettate = [];
|
||||||
|
$rs = $database->table('co_iva')->where('codice_natura_fe','N3.5')->get();
|
||||||
|
foreach($rs as $r){
|
||||||
|
$ive_accettate[] = $r->id;
|
||||||
|
}
|
||||||
|
if (!empty($dichiarazione) && in_array($riga->aliquota->id, $ive_accettate) ) {
|
||||||
|
$dettaglio[]['AltriDatiGestionali'] = [
|
||||||
|
'TipoDato' => 'INTENTO',
|
||||||
|
'RiferimentoTesto' => $dichiarazione->numero_protocollo,
|
||||||
|
'RiferimentoData' => $dichiarazione->data_protocollo,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dati aggiuntivi dinamici
|
||||||
|
if (!empty($dati_aggiuntivi['altri_dati'])) {
|
||||||
|
foreach ($dati_aggiuntivi['altri_dati'] as $dato) {
|
||||||
|
$altri_dati = [];
|
||||||
|
|
||||||
|
if (!empty($dato['tipo_dato'])) {
|
||||||
|
$altri_dati['TipoDato'] = $dato['tipo_dato'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($dato['riferimento_testo'])) {
|
||||||
|
$altri_dati['RiferimentoTesto'] = $dato['riferimento_testo'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($dato['riferimento_numero'])) {
|
||||||
|
$altri_dati['RiferimentoNumero'] = $dato['riferimento_numero'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($dato['riferimento_data'])) {
|
||||||
|
$altri_dati['RiferimentoData'] = $dato['riferimento_data'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$dettaglio[]['AltriDatiGestionali'] = $altri_dati;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$result[] = [
|
||||||
|
'DettaglioLinee' => $dettaglio,
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Riepiloghi per IVA per percentuale
|
// Riepiloghi per IVA per percentuale
|
||||||
|
@ -636,6 +636,7 @@ class Validator
|
|||||||
$output = htmlspecialchars($output, ENT_NOQUOTES | ENT_XML1 | ENT_SUBSTITUTE, 'UTF-8', false);
|
$output = htmlspecialchars($output, ENT_NOQUOTES | ENT_XML1 | ENT_SUBSTITUTE, 'UTF-8', false);
|
||||||
|
|
||||||
// Gestione dei caratteri non supportati e sostituzione con alternativi
|
// Gestione dei caratteri non supportati e sostituzione con alternativi
|
||||||
|
// Problemi noti: sostituendo 1 carattere con 2 o più potrebbero verificarsi problemi se, per il testo di quel nodo, si era raggiunta la lunghezza massima prevista dal tracciato
|
||||||
$output = replace($output, [
|
$output = replace($output, [
|
||||||
'€' => 'euro',
|
'€' => 'euro',
|
||||||
'—' => '-',
|
'—' => '-',
|
||||||
|
@ -26,3 +26,7 @@ UPDATE `zz_segments` SET `clause` = 'co_pagamenti.codice_modalita_pagamento_fe=
|
|||||||
-- Aggiunta filtri per agente in preventivi
|
-- Aggiunta filtri per agente in preventivi
|
||||||
INSERT INTO `zz_group_module` (`idgruppo`, `idmodule`, `name`, `clause`, `position`, `enabled`, `default`) VALUES ((SELECT `id` FROM `zz_groups` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_modules` WHERE `name`='Preventivi'), 'Mostra agli agenti solo i preventivi dei clienti dei quali si è agenti', 'an_anagrafiche.idagente=|id_anagrafica|', 'WHR', 1, 0);
|
INSERT INTO `zz_group_module` (`idgruppo`, `idmodule`, `name`, `clause`, `position`, `enabled`, `default`) VALUES ((SELECT `id` FROM `zz_groups` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_modules` WHERE `name`='Preventivi'), 'Mostra agli agenti solo i preventivi dei clienti dei quali si è agenti', 'an_anagrafiche.idagente=|id_anagrafica|', 'WHR', 1, 0);
|
||||||
INSERT INTO `zz_group_module` (`idgruppo`, `idmodule`, `name`, `clause`, `position`, `enabled`, `default`) VALUES ((SELECT `id` FROM `zz_groups` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_modules` WHERE `name`='Preventivi'), 'Mostra agli agenti solo i preventivi di cui sono agenti', 'co_preventivi.idagente=|id_anagrafica|', 'WHR', 1, 0);
|
INSERT INTO `zz_group_module` (`idgruppo`, `idmodule`, `name`, `clause`, `position`, `enabled`, `default`) VALUES ((SELECT `id` FROM `zz_groups` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_modules` WHERE `name`='Preventivi'), 'Mostra agli agenti solo i preventivi di cui sono agenti', 'co_preventivi.idagente=|id_anagrafica|', 'WHR', 1, 0);
|
||||||
|
|
||||||
|
-- Aggiornamento title e icona per Causali (Causali trasporto) e Causali movimenti
|
||||||
|
UPDATE `zz_modules` SET `title` = 'Causali trasporto', `icon` = 'fa fa-truck' WHERE `zz_modules`.`name` = 'Causali';
|
||||||
|
UPDATE `zz_modules` SET `icon` = 'fa fa-exchange' WHERE `zz_modules`.`name` = 'Causali movimenti';
|
Loading…
x
Reference in New Issue
Block a user