This commit is contained in:
Beppe 2024-09-30 14:54:30 +02:00
commit df469372ff
2 changed files with 33 additions and 31 deletions

View File

@ -38,20 +38,15 @@ switch ($operazione) {
if (post('scadenza') == 'Mensile') {
$timeing = '+1 month';
}
if (post('scadenza') == 'Bimestrale') {
} else if (post('scadenza') == 'Bimestrale') {
$timeing = '+2 month';
}
if (post('scadenza') == 'Trimestrale') {
} else if (post('scadenza') == 'Trimestrale') {
$timeing = '+3 month';
}
if (post('scadenza') == 'Quadrimestrale') {
} else if (post('scadenza') == 'Quadrimestrale') {
$timeing = '+4 month';
}
if (post('scadenza') == 'Semestrale') {
} else if (post('scadenza') == 'Semestrale') {
$timeing = '+6 month';
}
if (post('scadenza') == 'Annuale') {
} else if (post('scadenza') == 'Annuale') {
$timeing = '+12 month';
}
@ -61,12 +56,15 @@ switch ($operazione) {
$numero_fatture = 0;
$date_pianificazioni = [];
$pianificazioni = [];
$cadenza_fatturazione = post('cadenza_fatturazione');
foreach ($selezioni as $key => $selezione) {
$date = new DateTime($periodi[$key]);
if (post('cadenza_fatturazione') == 'Inizio') {
if ($cadenza_fatturazione == 'Inizio') {
$date->modify('first day of this month');
} elseif (post('cadenza_fatturazione') == 'Giorno' && !empty(post('giorno_fisso'))) {
} elseif ($cadenza_fatturazione == 'Giorno' && !empty(post('giorno_fisso'))) {
$date->modify('last day of this month');
$last_day = $date->format('d');
$day = post('giorno_fisso') > $last_day ? $last_day : post('giorno_fisso');
@ -98,10 +96,13 @@ switch ($operazione) {
$qta_evasa = $r->qta_evasa;
$data_scadenza = '';
$inizio = $date_pianificazioni[0];
if ($cadenza_fatturazione == 'Fine') {
$inizio = Carbon\Carbon::parse($inizio)->startOfMonth()->format('Y-m-d');
$fine = Carbon\Carbon::parse($inizio)->endOfMonth()->format('Y-m-d');
} else {
$fine = date('Y-m-d', strtotime($inizio.' '.$timeing));
$fine = date('Y-m-d', strtotime($fine.' -1 days'));
if ($cadenza_fatturazione == 'Fine') {
$fine = Carbon\Carbon::parse($fine)->endOfMonth()->format('Y-m-d');
}
for ($rata = 1; $rata <= $numero_fatture; ++$rata) {
if ($qta_evasa < $r->qta) {

View File

@ -121,8 +121,8 @@ echo '
<div class="info-box">
<span class="info-box-icon bg-'.($preventivi->count() == 0 ? 'gray' : 'info').'"><i class="fa fa-question"></i></span>
<div class="info-box-content">
<span class="info-box-text pull-left">'.tr('Preventivi').'</span>
'.($preventivi->count() > 0 ? '<span class="info-box-text pull-right"><a href="'.base_path().'/controller.php?id_module='.Module::where('name', 'Preventivi')->first()->id.'&search_Cliente='.rawurlencode((string) $anagrafica['ragione_sociale']).'">'.tr('Visualizza').' <i class="fa fa-chevron-circle-right"></i></a></span>' : '').'
<span class="info-box-text pull-left">'.tr('Preventivi').'
'.($preventivi->count() > 0 ? '<a class="pull-right" href="'.base_path().'/controller.php?id_module='.Module::where('name', 'Preventivi')->first()->id.'&search_Cliente='.rawurlencode((string) $anagrafica['ragione_sociale']).'">'.tr('Visualizza').' <i class="fa fa-chevron-circle-right"></i></a></span>' : '</span>').'
<br class="clearfix">
<span class="info-box-number">
<big>'.$preventivi->count().'</big><br>
@ -136,8 +136,8 @@ echo '
<div class="info-box">
<span class="info-box-icon bg-'.($contratti->count() == 0 ? 'gray' : 'purple').'"><i class="fa fa-refresh"></i></span>
<div class="info-box-content">
<span class="info-box-text pull-left">'.tr('Contratti').'</span>
'.($contratti->count() > 0 ? '<span class="info-box-text pull-right"><a href="'.base_path().'/controller.php?id_module='.Module::where('name', 'Contratti')->first()->id.'&search_Cliente='.rawurlencode((string) $anagrafica['ragione_sociale']).'">'.tr('Visualizza').' <i class="fa fa-chevron-circle-right"></i></a></span>' : '').'
<span class="info-box-text pull-left">'.tr('Contratti').'
'.($contratti->count() > 0 ? '<a class="pull-right" href="'.base_path().'/controller.php?id_module='.Module::where('name', 'Contratti')->first()->id.'&search_Cliente='.rawurlencode((string) $anagrafica['ragione_sociale']).'">'.tr('Visualizza').' <i class="fa fa-chevron-circle-right"></i></a></span>' : '</span>').'
<br class="clearfix">
<span class="info-box-number">
<big>'.$contratti->count().'</big><br>
@ -151,8 +151,8 @@ echo '
<div class="info-box">
<span class="info-box-icon bg-'.($ordini_cliente->count() == 0 ? 'gray' : 'blue').'"><i class="fa fa-file-text"></i></span>
<div class="info-box-content">
<span class="info-box-text pull-left">'.tr('Ordini cliente').'</span>
'.($ordini_cliente->count() > 0 ? '<span class="info-box-text pull-right"><a href="'.base_path().'/controller.php?id_module='.Module::where('name', 'Ordini cliente')->first()->id.'&search_Ragione-sociale='.rawurlencode((string) $anagrafica['ragione_sociale']).'">'.tr('Visualizza').' <i class="fa fa-chevron-circle-right"></i></a></span>' : '').'
<span class="info-box-text pull-left">'.tr('Ordini cliente').'
'.($ordini_cliente->count() > 0 ? '<a class="pull-right" href="'.base_path().'/controller.php?id_module='.Module::where('name', 'Ordini cliente')->first()->id.'&search_Ragione-sociale='.rawurlencode((string) $anagrafica['ragione_sociale']).'">'.tr('Visualizza').' <i class="fa fa-chevron-circle-right"></i></a></span>' : '</span>').'
<br class="clearfix">
<span class="info-box-number">
<big>'.$ordini_cliente->count().'</big><br>
@ -166,13 +166,13 @@ echo '
<div class="info-box">
<span class="info-box-icon bg-'.($interventi->count() == 0 ? 'gray' : 'red').'"><i class="fa fa-cog"></i></span>
<div class="info-box-content">
<span class="info-box-text pull-left">'.tr('Attività').'</span>';
<span class="info-box-text pull-left">'.tr('Attività');
if ($anagrafica->isTipo('Cliente')) {
echo '
'.($interventi->count() > 0 ? '<span class="info-box-text pull-right"><a href="'.base_path().'/controller.php?id_module='.Module::where('name', 'Interventi')->first()->id.'&search_Ragione-sociale='.rawurlencode((string) $anagrafica['ragione_sociale']).'">'.tr('Visualizza').' <i class="fa fa-chevron-circle-right"></i></a></span>' : '').'';
'.($interventi->count() > 0 ? '<a class="pull-right" href="'.base_path().'/controller.php?id_module='.Module::where('name', 'Interventi')->first()->id.'&search_Ragione-sociale='.rawurlencode((string) $anagrafica['ragione_sociale']).'">'.tr('Visualizza').' <i class="fa fa-chevron-circle-right"></i></a></span>' : '</span>');
} else {
echo '
'.($interventi->count() > 0 ? '<span class="info-box-text pull-right"><a href="'.base_path().'/controller.php?id_module='.Module::where('name', 'Interventi')->first()->id.'&search_Tecnici='.rawurlencode((string) $anagrafica['ragione_sociale']).'">'.tr('Visualizza').' <i class="fa fa-chevron-circle-right"></i></a></span>' : '').'';
'.($interventi->count() > 0 ? '<a class="pull-right" href="'.base_path().'/controller.php?id_module='.Module::where('name', 'Interventi')->first()->id.'&search_Tecnici='.rawurlencode((string) $anagrafica['ragione_sociale']).'">'.tr('Visualizza').' <i class="fa fa-chevron-circle-right"></i></a></span>' : '</span>');
}
echo '
<br class="clearfix">
@ -188,8 +188,8 @@ echo '
<div class="info-box">
<span class="info-box-icon bg-'.($ddt_uscita->count() == 0 ? 'gray' : 'maroon').'"><i class="fa fa-truck"></i></span>
<div class="info-box-content">
<span class="info-box-text pull-left">'.tr('Ddt in uscita').'</span>
'.($ddt_uscita->count() > 0 ? '<span class="info-box-text pull-right"><a href="'.base_path().'/controller.php?id_module='.Module::where('name', 'Ddt in uscita')->first()->id.'&search_Ragione-sociale='.rawurlencode((string) $anagrafica['ragione_sociale']).'">'.tr('Visualizza').' <i class="fa fa-chevron-circle-right"></i></a></span>' : '').'
<span class="info-box-text pull-left">'.tr('Ddt in uscita').'
'.($ddt_uscita->count() > 0 ? '<a class="pull-right"href="'.base_path().'/controller.php?id_module='.Module::where('name', 'Ddt in uscita')->first()->id.'&search_Ragione-sociale='.rawurlencode((string) $anagrafica['ragione_sociale']).'">'.tr('Visualizza').' <i class="fa fa-chevron-circle-right"></i></a></span>' : '</span>').'
<br class="clearfix">
<span class="info-box-number">
<big>'.$ddt_uscita->count().'</big><br>
@ -203,8 +203,8 @@ echo '
<div class="info-box">
<span class="info-box-icon bg-'.($fatture_vendita->count() + $note_credito->count() == 0 ? 'gray' : 'green').'"><i class="fa fa-money"></i></span>
<div class="info-box-content">
<span class="info-box-text pull-left">'.tr('Fatture').'</span>
'.($fatture_vendita->count() + $note_credito->count() > 0 ? '<span class="info-box-text pull-right"><a href="'.base_path().'/controller.php?id_module='.Module::where('name', 'Fatture di vendita')->first()->id.'&search_Ragione-sociale='.rawurlencode((string) $anagrafica['ragione_sociale']).'">'.tr('Visualizza').' <i class="fa fa-chevron-circle-right"></i></a></span>' : '').'
<span class="info-box-text pull-left">'.tr('Fatture').'
'.($fatture_vendita->count() + $note_credito->count() > 0 ? '<a class="pull-right" href="'.base_path().'/controller.php?id_module='.Module::where('name', 'Fatture di vendita')->first()->id.'&search_Ragione-sociale='.rawurlencode((string) $anagrafica['ragione_sociale']).'">'.tr('Visualizza').' <i class="fa fa-chevron-circle-right"></i></a></span>' : '</span>').'
<br class="clearfix">
<span class="info-box-number">
<big>'.($fatture_vendita->count() + $note_credito->count()).'</big><br>
@ -219,18 +219,19 @@ echo '
<div class="info-box">
<span class="info-box-icon bg-'.(!empty($sessioni) ? 'warning' : 'gray').'"><i class="fa fa-wrench"></i></span>
<div class="info-box-content">
<span class="info-box-text pull-left">'.tr('Ore lavorate').'</span>';
<span class="info-box-text pull-left">'.tr('Ore lavorate');
if ($anagrafica->isTipo('Cliente')) {
echo '
'.($sessioni ? '<span class="info-box-text pull-right"><a href="'.base_path().'/controller.php?id_module='.Module::where('name', 'Interventi')->first()->id.'&search_Ragione-sociale='.rawurlencode((string) $anagrafica['ragione_sociale']).'">'.tr('Visualizza').' <i class="fa fa-chevron-circle-right"></i></a></span>' : '').'';
'.($sessioni ? '<a class="pull-right" href="'.base_path().'/controller.php?id_module='.Module::where('name', 'Interventi')->first()->id.'&search_Ragione-sociale='.rawurlencode((string) $anagrafica['ragione_sociale']).'">'.tr('Visualizza').' <i class="fa fa-chevron-circle-right"></i></a></span>' : '</span>');
} else {
echo '
'.($sessioni ? '<span class="info-box-text pull-right"><a href="'.base_path().'/controller.php?id_module='.Module::where('name', 'Interventi')->first()->id.'&search_Tecnici='.rawurlencode((string) $anagrafica['ragione_sociale']).'">'.tr('Visualizza').' <i class="fa fa-chevron-circle-right"></i></a></span>' : '').'';
'.($sessioni ? '<a class="pull-right" href="'.base_path().'/controller.php?id_module='.Module::where('name', 'Interventi')->first()->id.'&search_Tecnici='.rawurlencode((string) $anagrafica['ragione_sociale']).'">'.tr('Visualizza').' <i class="fa fa-chevron-circle-right"></i></a></span>' : '</span>');
}
echo '
<br class="clearfix">
<span class="info-box-number">
<big>'.numberFormat($totale_ore_lavorate, 0).'</big>
<br><br>
</span>
</div>
</div>