Correzioni per la stampa calendario

This commit is contained in:
Thomas Zilio 2019-11-22 16:28:03 +01:00
parent 3d94b0d005
commit f4a9c365d5
14 changed files with 171 additions and 244 deletions

View File

@ -94,7 +94,7 @@ $_SESSION['superselect']['id_categoria'] = $record['id_categoria'];
</div>
<div class="col-md-3">
{[ "type": "checkbox", "label": "<?php echo tr("Attivo"); ?>", "name": "attivo", "help": "<?php echo tr('Seleziona per rendere attivo l\'articolo'); ?>", "value": "$attivo$", "placeholder": "<?php echo tr('Articolo attivo'); ?>" ]}
{[ "type": "checkbox", "label": "<?php echo tr('Attivo'); ?>", "name": "attivo", "help": "<?php echo tr('Seleziona per rendere attivo l\'articolo'); ?>", "value": "$attivo$", "placeholder": "<?php echo tr('Articolo attivo'); ?>" ]}
</div>
</div>

View File

@ -9,77 +9,58 @@ echo '
<form action="" method="post" onsubmit="if($(this).parsley().validate()) { return stampa_calendario(); }" >
<div class="row">
<div class="col-md-4">
{[ "type": "text", "label": "'.tr('Anno Mese').'", "name": "anno-mese", "required": "1", "extra":"readonly", "value": "'.$_SESSION['period']['month'].'" ]}
{[ "type": "text", "label": "'.tr('Mese e anno').'", "name": "date", "required": "1", "value": "'.$_SESSION['dashboard']['date'].'" ]}
</div>
<div class="col-md-2">
{[ "type": "select", "label": "'.tr('Formato').'", "name": "format", "required": "1", "values": "list=\"A4\": \"'.tr('A4').'\", \"A3\": \"'.tr('A3').'\"", "value": "'.$_SESSION['settings']['format'].'" ]}
{[ "type": "select", "label": "'.tr('Formato').'", "name": "format", "required": "1", "values": "list=\"A4\": \"'.tr('A4').'\", \"A3\": \"'.tr('A3').'\"", "value": "'.$_SESSION['dashboard']['format'].'" ]}
</div>
<div class="col-md-4">
{[ "type": "select", "label": "'.tr('Orientamento').'", "name": "orientation", "required": "1", "values": "list=\"L\": \"'.tr('Orizzontale').'\", \"P\": \"'.tr('Verticale').'\"", "value": "'.$_SESSION['settings']['orientation'].'" ]}
{[ "type": "select", "label": "'.tr('Orientamento').'", "name": "orientation", "required": "1", "values": "list=\"L\": \"'.tr('Orizzontale').'\", \"P\": \"'.tr('Verticale').'\"", "value": "'.$_SESSION['dashboard']['orientation'].'" ]}
</div>
<div class="col-md-2">
<p style="line-height:14px;">&nbsp;</p>
<button type="submit" class="btn btn-primary btn-block"><i class="fa fa-print"></i> '.tr('Stampa').'</button>
<button type="submit" class="btn btn-primary btn-block">
<i class="fa fa-print"></i> '.tr('Stampa').'
</button>
</div>
</div>
</form>';
</form>
echo '<script>$(document).ready(init)</script>';
echo '<link rel="stylesheet" type="text/css" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css">';
<script>$(document).ready(init)</script>';
?>
<style>
.ui-datepicker-calendar, .ui-datepicker-current{
display:none;
}
</style>
<script>
function stampa_calendario (){
window.open('<?php echo $rootdir; ?>/pdfgen.php?id_print=<?php echo $id_print; ?>');
//$('button[type=submit]').removeAttr("disabled");
//$('button[type=submit]').prop("disabled", false);
return false;
}
$( '#format' ).change(function() {
$('#format').change(function() {
session_set('settings,format', $(this).val(), 0, 0);
});
$( '#orientation' ).change(function() {
$('#orientation').change(function() {
session_set('settings,orientation', $(this).val(), 0, 0);
});
$(function() {
$('#date').datetimepicker({
format: 'MMMM YYYY',
locale: globals.locale,
useCurrent: false,
});
$('#anno-mese').datepicker( {
changeMonth: true,
changeYear: true,
showButtonPanel: true,
dateFormat: 'MM yy',
todayBtn: false,
onClose: function(dateText, inst) {
$(this).datepicker('setDate', new Date(inst.selectedYear, inst.selectedMonth, 1));
session_set('period,month', $('#anno-mese').val(), 0, 0);
},
beforeShow : function(input, inst) {
session_set('period,month', '', 1, 0);
}
$('#date').on('dp.change', function(e) {
session_set('dashboard,date', e.date.format("YYYY-MM-DD"), 0, 0);
});
});
</script>

View File

@ -116,10 +116,10 @@ echo '
$('#bs-popup').modal('hide');
// Ricarico le righe
$('#righe').load('<?php echo $module->fileurl('ajax_righe.php');?>?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>');
$('#righe').load('<?php echo $module->fileurl('ajax_righe.php'); ?>?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>');
// Ricarico la tabella dei costi
$('#costi').load('<?php echo $module->fileurl('ajax_costi.php');?>?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>');
$('#costi').load('<?php echo $module->fileurl('ajax_costi.php'); ?>?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>');
}
});
});

View File

@ -161,10 +161,10 @@ if (!$righe->isEmpty()) {
}, function(data, result){
if(result == 'success'){
// Ricarico le righe
$('#righe').load('<?php echo $module->fileurl('ajax_righe.php');?>?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>');
$('#righe').load('<?php echo $module->fileurl('ajax_righe.php'); ?>?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>');
// Ricarico la tabella dei costi
$('#costi').load('<?php echo $module->fileurl('ajax_costi.php');?>?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>');
$('#costi').load('<?php echo $module->fileurl('ajax_costi.php'); ?>?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>');
// Toast

View File

@ -155,7 +155,7 @@ if (!empty($rs2)) {
// Per più "versioni" dello stesso componente mostro un riga meno evidente
// per non confonderlo come componente in uso in questo momento
$same = ($prev_componente == $nome_componente);
if (get('id') == $rs2[$j]['id']) {
$collapsed = '';
$icon = 'minus';

View File

@ -13,7 +13,7 @@ $id_anagrafica = !empty(get('idanagrafica')) ? get('idanagrafica') : $user['idan
<div class="row">
<div class="col-md-6">
{[ "type": "date", "label": "<?php echo tr('Data bozza'); ?>", "name": "data_bozza", "value": "<?php echo '-now-' ?>", "required": 1 ]}
{[ "type": "date", "label": "<?php echo tr('Data bozza'); ?>", "name": "data_bozza", "value": "<?php echo '-now-'; ?>", "required": 1 ]}
</div>
<div class="col-md-6">
{[ "type": "text", "label": "<?php echo tr('Nome preventivo'); ?>", "name": "nome", "required": 1 ]}

View File

@ -53,12 +53,13 @@ class Preventivo extends Document
// Salvataggio delle informazioni
$model->nome = $nome;
if (empty($data_bozza))
if (empty($data_bozza)) {
$model->data_bozza = Carbon::now();
else
} else {
$model->data_bozza = $data_bozza;
}
$model->data_conclusione = Carbon::now()->addMonth();
if (!empty($id_sede)) {
$model->idsede = $id_sede;
}

View File

@ -4,7 +4,7 @@ include_once __DIR__.'/../../../core.php';
switch ($resource) {
case 'zone':
$query = 'SELECT `id`, CONCAT(`nome`, \' - \', `descrizione`) AS `descrizione` FROM an_zone |where| ORDER BY descrizione ASC';
foreach ($elements as $element) {

View File

@ -4,7 +4,6 @@ include_once __DIR__.'/../../core.php';
$google = setting('Google Maps API key');
/*
if (!empty($google)) {
echo '
@ -131,8 +130,6 @@ if (!empty($google)) {
</div>';
}
// Permetto eliminazione tipo sede solo se non è utilizzata da nessun'altra parte nel gestionale
$elementi = $dbo->fetchArray('SELECT `zz_user_sedi`.`id_user` AS `id` FROM `zz_user_sedi` WHERE `zz_user_sedi`.`idsede` = '.prepare($id_record).'
UNION
@ -146,8 +143,8 @@ if (!empty($elementi)) {
'_NUM_' => count($elementi),
]).'.
</div>';
$disabled = 'disabled';
$disabled = 'disabled';
}
echo '
@ -176,4 +173,4 @@ $(document).ready( function(){
$("#form_sedi #lng_").val(result.geometry.location.lng());
});
});
</script>';
</script>';

View File

@ -13,4 +13,4 @@ if (isset($id_record)) {
if (isset($id_parent)) {
$record['tipo_anagrafica'] = $dbo->fetchOne('SELECT tipo FROM an_anagrafiche WHERE an_anagrafiche.idanagrafica ='.prepare($id_parent))['tipo'];
$record['iso2'] = $dbo->fetchOne('SELECT iso2 FROM an_nazioni INNER JOIN an_anagrafiche ON an_nazioni.id = an_anagrafiche.id_nazione WHERE an_anagrafiche.idanagrafica ='.prepare($id_parent))['iso2'];
}
}

View File

@ -81,10 +81,17 @@ class Translator extends Util\Singleton
$this->translator->setLocale($locale);
$this->locale = $locale;
$reduced = explode('_', $locale)[0];
Carbon::setUtf8(true);
setlocale(LC_TIME, $reduced);
Carbon::setLocale($reduced);
$result = setlocale(LC_TIME, $locale);
Carbon::setLocale($locale);
if (empty($result)) {
$reduced = explode('_', $locale)[0];
$result = setlocale(LC_TIME, $reduced);
Carbon::setLocale($reduced);
}
self::setFormatter($locale, $formatter);
}

View File

@ -2,29 +2,15 @@
include_once __DIR__.'/../../core.php';
$height = '80';
use Carbon\Carbon;
if (isset($_SESSION['period']['month'])) {
$period = explode(' ', $_SESSION['period']['month']);
$month = $period[0];
$year = $period[1];
$calendar = $_SESSION['dashboard'];
$months = ['Gennaio' => '01', 'Febbraio' => '02', 'Marzo' => '03', 'Aprile' => '04', 'Maggio' => '05', 'Giugno' => '06', 'Luglio' => '07', 'Agosto' => '08', 'Settembre' => '09', 'Ottobre' => '10', 'Novembre' => '11', 'Dicembre' => '12'];
$month = $months[$month];
$date = $calendar['date'];
$date = new Carbon($date);
$title = $_SESSION['period']['month'];
//numero di giorni nel mese
$maxday = cal_days_in_month(CAL_GREGORIAN, $month, $year) + 1;
$mindate = $year.'-'.$month.'-'.'01';
$maxdate = $year.'-'.$month.'-'.$maxday;
$where = ' (in_interventi_tecnici.orario_inizio) <= '.prepare($maxdate).' AND (in_interventi_tecnici.orario_inizio) >= '.prepare($mindate).' AND ';
}
if (isset($_SESSION['period']['week'])) {
$period = explode(' ', $_SESSION['period']['week']);
if ($calendar['format'] == 'week') {
$period = explode(' ', $_SESSION['dashboard']['week']);
$day = $period[0];
@ -48,179 +34,133 @@ if (isset($_SESSION['period']['week'])) {
$month = $months[$month];
$maxmonth = $months[$maxmonth];
$title = $_SESSION['period']['week'];
$title = $_SESSION['dashboard']['week'];
//numero di giorni nel mese
$maxday = cal_days_in_month(CAL_GREGORIAN, $month, $year) + 1;
$mindate = $year.'-'.$month.'-'.$day;
$maxdate = $year.'-'.$maxmonth.'-'.$maxday_;
$min_date = $year.'-'.$month.'-'.$day;
$max_date = $year.'-'.$maxmonth.'-'.$maxday_;
//aggiungo un giorno
$maxdate = date('Y-m-d', date(strtotime('+1 day', strtotime($maxdate))));
$max_date = date('Y-m-d', date(strtotime('+1 day', strtotime($max_date))));
$where = ' (in_interventi_tecnici.orario_inizio) <= '.prepare($maxdate).' AND (in_interventi_tecnici.orario_inizio) >= '.prepare($mindate).' AND ';
$where = ' (in_interventi_tecnici.orario_inizio) <= '.prepare($max_date).' AND (in_interventi_tecnici.orario_inizio) >= '.prepare($min_date).' AND ';
} else {
$title = $date->formatLocalized('%B %Y');
$min_date = $date->copy()->startOfMonth();
$max_date = $date->copy()->endOfMonth();
$where = ' (in_interventi_tecnici.orario_inizio) <= '.prepare($max_date).' AND (in_interventi_tecnici.orario_inizio) >= '.prepare($min_date).' AND ';
}
$custom = [
'periodo' => $month.'-'.$year,
];
$height = '80';
//$date_start = $_SESSION['period_start'];
//$date_end = $_SESSION['period_end'];
$stati = (array) $_SESSION['dashboard']['idstatiintervento'];
$tipi = (array) $_SESSION['dashboard']['idtipiintervento'];
$tecnici = (array) $_SESSION['dashboard']['idtecnici'];
//in_interventi_tecnici.idintervento, colore, in_interventi_tecnici.id, idtecnico, orario_inizio, orario_fine,(SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica=idtecnico) AS nome_tecnico, (SELECT colore FROM an_anagrafiche WHERE idanagrafica=idtecnico) AS colore_tecnico,
$query = 'SELECT DAY(in_interventi_tecnici.orario_inizio) AS giorno, orario_inizio AS data, GROUP_CONCAT(CONCAT((SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica=in_interventi.idanagrafica), \'<br><small>\', (SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica=in_interventi_tecnici.idtecnico), \'</small>\' ) SEPARATOR \'<br>\') AS attivita FROM in_interventi_tecnici INNER JOIN (in_interventi LEFT OUTER JOIN in_statiintervento ON in_interventi.idstatointervento=in_statiintervento.idstatointervento) ON in_interventi_tecnici.idintervento=in_interventi.id WHERE '.$where.' idtecnico IN('.implode(',', $tecnici).') AND in_interventi.idstatointervento IN('.implode(',', $stati).') AND in_interventi_tecnici.idtipointervento IN('.implode(',', $tipi).') '.Modules::getAdditionalsQuery('Interventi').' GROUP BY giorno ORDER BY CAST(giorno AS UNSIGNED)';
//echo $query;
$stati = (array) $calendar['idstatiintervento'];
$tipi = (array) $calendar['idtipiintervento'];
$tecnici = (array) $calendar['idtecnici'];
$query = 'SELECT
DATE(orario_inizio) AS data,
(SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica=in_interventi.idanagrafica) AS anagrafica,
(SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica=in_interventi_tecnici.idtecnico) AS tecnico
FROM in_interventi_tecnici
INNER JOIN in_interventi ON in_interventi_tecnici.idintervento=in_interventi.id
LEFT OUTER JOIN in_statiintervento ON in_interventi.idstatointervento=in_statiintervento.idstatointervento
WHERE '.$where.'
idtecnico IN('.implode(',', $tecnici).') AND
in_interventi.idstatointervento IN('.implode(',', $stati).') AND
in_interventi_tecnici.idtipointervento IN('.implode(',', $tipi).') '.Modules::getAdditionalsQuery('Interventi');
$sessioni = $dbo->fetchArray($query);
//echo $query;
$rs = [];
for ($i = 0; $i < 33; ++$i) {
$rs[$sessioni[$i]['giorno']]['cliente'] = $sessioni[$i]['attivita'];
$rs[$sessioni[$i]['giorno']]['data'] = $sessioni[$i]['data'];
}
$sessioni = collect($sessioni)->groupBy('data');
function showMonth($month, $year, &$rs, &$height)
{
$date = mktime(12, 0, 0, $month, 1, $year);
$daysInMonth = date('t', $date);
// calculate the position of the first day in the calendar (sunday = 1st column, etc)
$offset = (date('w', $date) - 1) % 7;
if ($offset < 0) {
$offset = 7 + $offset;
}
//echo $date."<br>";
//echo date("w", $date)."<br>";
//echo $offset;
$rows = 1;
//echo "<h1>Displaying calendar for " . date("F Y", $date) . "</h1>\n";
$header = [];
$row = [];
//$table .= "<table border=\"1\">\n";
//echo "\t<tr><th>Su</th><th>M</th><th>Tu</th><th>W</th><th>Th</th><th>F</th><th>Sa</th></tr>";
// $table .= "\t<tr><th>Lun</th><th>Mar</th><th>Mer</th><th>Gio</th><th>Ven</th><th>Sab</th><th>Dom</th></tr>";
//$header[$rows] = "\n\t<tr>";
//$row[$rows] = "\n\t<tr>";
//giorni prima
for ($i = 1; $i <= $offset; ++$i) {
$current_month = $month;
if ($current_month == 1) {
$current_month = 12;
$current_year = $year - 1;
} else {
$current_month = $month - 1;
$current_year = $year;
}
$lastdateofmonth = date('t', $current_month);
//$lastdate = $lastdateofmonth."/".$current_month."/".$current_year;
$day = (($lastdateofmonth - $offset) + ($i));
$weekday = date('l', strtotime($current_year.'-'.$current_month.'-'.(sprintf('%02d', $day))));
$weekdays = ['Monday' => 'Lunedi\'', 'Tuesday' => 'Martedi\'', 'Wednesday' => 'Mercoledi\'', 'Thursday' => 'Giovedi\'', 'Friday' => 'Venerdi\'', 'Saturday' => 'Sabato', 'Sunday' => 'Domenica'];
$weekday = $weekdays[$weekday];
$header[$rows] .= '<th>'.tr($weekday.' '.(sprintf('%02d', $day)).'/'.(sprintf('%02d', $current_month)), [], ['upper' => true])."</th>\n";
$row[$rows] .= "<td style=\"background:lightgray;\" ><b> </b></td>\n";
}
//giorni del mese
for ($day = 1; $day <= $daysInMonth; ++$day) {
if (($day + $offset - 1) % 7 == 0 && $day != 1) {
// $table .= "\t<tr><th>Lun ".$day."</th><th>Mar ".($day+1)."</th><th>Mer ".($day+2)."</th><th>Gio ".($day+3)."</th><th>Ven ".($day+4)."</th><th>Sab ".($day+5)."</th><th>Dom ".($day+6)."</th></tr>";
// $header[$rows] .= "</tr>\n\t<tr>";
//$row[$rows] .= "</tr>\n\t<tr>";
++$rows;
}
$weekday = date('l', strtotime($year.'-'.$month.'-'.(sprintf('%02d', $day))));
$weekdays = ['Monday' => 'Lunedi\'', 'Tuesday' => 'Martedi\'', 'Wednesday' => 'Mercoledi\'', 'Thursday' => 'Giovedi\'', 'Friday' => 'Venerdi\'', 'Saturday' => 'Sabato', 'Sunday' => 'Domenica'];
$weekday = $weekdays[$weekday];
$header[$rows] .= '<th>'.tr($weekday.' '.(sprintf('%02d', $day)).'/'.$month, [], ['upper' => true])."</th>\n";
if (empty($rs[$day]['cliente'])) {
$rs[$day]['cliente'] = ' ';
}
$row[$rows] .= "<td style='height:".$height."px' >".'<b>'.$rs[$day]['cliente']."</b></td>\n";
}
//$i = 1;
//giorni dopo
//while( ($day + $offset) <= $rows * 7){
for ($i = 1; ($day + $offset) <= ($rows * 7); ++$i) {
$current_month = $month;
if ($current_month == 12) {
$current_month = 1;
$current_year = $year + 1;
} else {
$current_month = $month + 1;
$current_year = $year;
}
//$lastdateofmonth = date('t',$current_month);
//$lastdate = $lastdateofmonth."/".$current_month."/".$current_year;
$weekday = date('l', strtotime($current_year.'-'.$current_month.'-'.(sprintf('%02d', $i))));
$weekdays = ['Monday' => 'Lunedi\'', 'Tuesday' => 'Martedi\'', 'Wednesday' => 'Mercoledi\'', 'Thursday' => 'Giovedi\'', 'Friday' => 'Venerdi\'', 'Saturday' => 'Sabato', 'Sunday' => 'Domenica'];
$weekday = $weekdays[$weekday];
$header[$rows] .= '<th> '.tr($weekday.' '.(sprintf('%02d', $i)).'/'.(sprintf('%02d', $current_month)), [], ['upper' => true])." </th>\n";
//$row[$rows] .= "<td> ".($offset+$day)."<br>".($rows * 7)." </td>\n";
$row[$rows] .= "<td style=\"background:lightgray;\" ><b> </b> </td>\n";
++$day;
}
//$header[$rows] .= "</tr>";
//$row[$rows] .= "</tr>";
//print_r($header);
//echo "<br>";
//print_r($row);
echo '<table class="table table-bordered">\n';
//creo righe
for ($i = 1; $i <= count($row); ++$i) {
echo "<tr>\n";
echo $header[$i];
echo "</tr>\n";
echo "<tr>\n";
echo $row[$i];
echo "</tr>\n";
}
echo '</table>';
//$table .= "</table>\n";
//echo $table;
}
// Intestazione tabella per righe
echo "
<h3 class='text-bold'>".tr('Calendario _PERIOD_', [
// Intestazione tabella
echo '
<h3 class="text-bold">'.tr('Calendario _PERIOD_', [
'_PERIOD_' => $title,
], ['upper' => true]).'</h3>';
showMonth($month, $year, $rs, $height);
// Elenco per la gestione
$list = [];
// Filler per i giorni non inclusi della settimana iniziale
$week_start = $min_date->startOfWeek();
$current_day = $week_start;
while ($current_day->lessThan($min_date)) {
$list[] = [
'date' => $current_day->copy(),
'contents' => [],
];
$current_day->addDay();
}
// Elenco del periodo indicato
while ($current_day->lessThan($max_date)) {
$list[] = [
'date' => $current_day->copy(),
'contents' => $sessioni[$current_day->toDateString()] ?: [],
];
$current_day->addDay();
}
// Filler per i giorni non inclusi della settimana finale
$week_end = $max_date->endOfWeek();
while ($current_day->lessThan($week_end)) {
$list[] = [
'date' => $current_day->copy(),
'contents' => [],
];
$current_day->addDay();
}
// Stampa della tabella
echo '
<table class="table table-bordered">';
$count = count($list);
for ($i = 0; $i < $count; $i = $i + 7) {
echo '
<tr>';
for ($c = 0; $c < 7; ++$c ) {
$element = $list[$i + $c];
echo '
<th class="text-capitalize">'.$element['date']->formatLocalized('%A %d/%m').'</th>';
}
echo '
</tr>';
echo '
<tr>';
for ($c = 0; $c < 7; ++$c ) {
$element = $list[$i + $c];
$clienti = '';
foreach ($element['contents'] as $sessione) {
$clienti .= $sessione['anagrafica'].'<br>
<small>'.$sessione['tecnico'].'</small><br>';
}
$background = '#ffffff';
if (empty($clienti)) {
$background = 'lightgray';
}
echo '
<td style="height:'.$height.'px;background:'.$background.'">'.$clienti.'</td>';
}
echo '
</tr>';
}
echo '
</table>';

View File

@ -1,7 +1,8 @@
<?php
$format = (isset($_SESSION['settings']['format'])) ? $_SESSION['settings']['format'] : 'A4';
$orientation = (isset($_SESSION['settings']['orientation'])) ? $_SESSION['settings']['orientation'] : 'L';
$format = (isset($_SESSION['dashboard']['format'])) ? $_SESSION['dashboard']['format'] : 'A4';
$orientation = (isset($_SESSION['dashboard']['orientation'])) ? $_SESSION['dashboard']['orientation'] : 'L';
return [
'format' => $format,

View File

@ -23,10 +23,10 @@ class Fattura extends Document
/**
* Crea una nuova fattura.
*
* @param Anagrafica $anagrafica
* @param TipoFattura $tipo_documento
* @param string $data
* @param int $id_segment
* @param Anagrafica $anagrafica
* @param TipoFattura $tipo_documento
* @param string $data
* @param int $id_segment
*
* @return self
*/