From 377bb1b9a551d2c713893dc4c685d9ca167ece82 Mon Sep 17 00:00:00 2001 From: Frankie <40104356+idraulicadueci@users.noreply.github.com> Date: Thu, 8 Dec 2022 20:17:41 +0100 Subject: [PATCH 1/6] Miglioria minore: corretta forma della valuta --- lib/helpers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/helpers.php b/lib/helpers.php index ae18b01aa..a86d611bd 100755 --- a/lib/helpers.php +++ b/lib/helpers.php @@ -274,7 +274,7 @@ function currency() */ function moneyFormat($number, $decimals = null) { - return tr('_TOTAL_ _CURRENCY_', [ + return tr('_CURRENCY_ _TOTAL_', [ '_TOTAL_' => numberFormat($number, $decimals), '_CURRENCY_' => currency(), ]); From 8543f9636d9cea1d4929582be622eef6898eeef7 Mon Sep 17 00:00:00 2001 From: Luca Date: Wed, 1 Feb 2023 20:05:39 +0100 Subject: [PATCH 2/6] Fix duplicazione fatture attraverso sezionali diversi --- modules/fatture/bulk.php | 10 +++++++--- modules/fatture/src/Fattura.php | 2 +- update/2_4_40.sql | 5 ++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/modules/fatture/bulk.php b/modules/fatture/bulk.php index 5a96f1c3d..6a69b8662 100755 --- a/modules/fatture/bulk.php +++ b/modules/fatture/bulk.php @@ -308,7 +308,6 @@ switch (post('op')) { $list = []; foreach ($id_records as $id) { $fattura = Fattura::find($id); - array_push($list, $fattura->numero_esterno); $id_segment = (post('id_segment') ? post('id_segment') : $fattura->id_segment); $dir = $dbo->fetchOne('SELECT dir FROM co_tipidocumento WHERE id='.prepare($fattura->idtipodocumento))['dir']; @@ -332,9 +331,10 @@ switch (post('op')) { if (post('skip_time') == 'Anno') { $data = date('Y-m-d', strtotime('+1 year', strtotime($fattura->data))); } - + + $new = $fattura->replicate(); - + $new->data = $data; $new->id_segment = $id_segment; $new->numero = Fattura::getNextNumero($data, $dir, $id_segment); @@ -360,6 +360,10 @@ switch (post('op')) { $new_riga->movimenta($new_riga->qta); } } + + if (!empty($fattura->numero_esterno)){ + array_push($list, $fattura->numero_esterno); + } } flash()->info(tr('Fatture _LIST_ duplicate correttamente!', [ diff --git a/modules/fatture/src/Fattura.php b/modules/fatture/src/Fattura.php index 0e2e78169..57ce9441a 100755 --- a/modules/fatture/src/Fattura.php +++ b/modules/fatture/src/Fattura.php @@ -694,7 +694,7 @@ class Fattura extends Document // In fase di duplicazione di una fattura non deve essere calcolato il numero progressivo ma questo deve // essere generato in fase di emissione della stessa. - $new->numero_esterno = ''; + $new->numero_esterno = null; $new->numero = Fattura::getNextNumero($now, $new->direzione, $new->id_segment); // Rimozione informazioni di Fattura Elettronica diff --git a/update/2_4_40.sql b/update/2_4_40.sql index 1a44fd4ea..e0e9c153e 100644 --- a/update/2_4_40.sql +++ b/update/2_4_40.sql @@ -152,4 +152,7 @@ ORDER BY `scadenza` ASC" WHERE `name` = 'Scadenzario'; -- Aggiunta impostazione Movimentazione articoli da fatture di acquisto -INSERT INTO zz_settings(nome, valore, tipo, editable, sezione) VALUES ('Movimenta magazzino da fatture di acquisto','1','boolean','1','Fatturazione Elettronica'); \ No newline at end of file +INSERT INTO zz_settings(nome, valore, tipo, editable, sezione) VALUES ('Movimenta magazzino da fatture di acquisto','1','boolean','1','Fatturazione Elettronica'); + +-- Permetto valore null per numero_esterno di co_documenti +ALTER TABLE `co_documenti` CHANGE `numero_esterno` `numero_esterno` VARCHAR(100) NULL DEFAULT NULL; \ No newline at end of file From 1694a9e0def1522958d0f66e8af7a42975d88a8c Mon Sep 17 00:00:00 2001 From: MatteoPistorello Date: Thu, 2 Feb 2023 11:23:09 +0100 Subject: [PATCH 3/6] Aggiunta gestione dichiarazione d'intento predefinita --- modules/anagrafiche/actions.php | 1 + modules/anagrafiche/edit.php | 5 +++++ modules/fatture/src/Fattura.php | 8 +++++++- update/2_4_40.sql | 5 ++++- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/modules/anagrafiche/actions.php b/modules/anagrafiche/actions.php index 40896fdd1..f283909e4 100755 --- a/modules/anagrafiche/actions.php +++ b/modules/anagrafiche/actions.php @@ -94,6 +94,7 @@ switch (post('op')) { $anagrafica->riferimento_amministrazione = post('riferimento_amministrazione'); $anagrafica->colore = post('colore'); $anagrafica->idtipointervento_default = post('idtipointervento_default') ?: null; + $anagrafica->id_dichiarazione_intento_default = post('id_dichiarazione_intento_default') ?: null; $anagrafica->provvigione_default = post('provvigione_default'); $anagrafica->id_ritenuta_acconto_acquisti = post('id_ritenuta_acconto_acquisti'); $anagrafica->id_ritenuta_acconto_vendite = post('id_ritenuta_acconto_vendite'); diff --git a/modules/anagrafiche/edit.php b/modules/anagrafiche/edit.php index 5b643e635..721a17c6d 100755 --- a/modules/anagrafiche/edit.php +++ b/modules/anagrafiche/edit.php @@ -17,6 +17,7 @@ * along with this program. If not, see . */ +use Carbon\Carbon; use Modules\Anagrafiche\Anagrafica; use Modules\Banche\Banca; @@ -529,6 +530,10 @@ if ($is_cliente or $is_fornitore or $is_tecnico) {
{[ "type": "select", "label": "'.tr('Tipo attività predefinita').'", "name": "idtipointervento_default", "values": "query=SELECT idtipointervento AS id, descrizione FROM in_tipiintervento ORDER BY descrizione ASC", "value": "$idtipointervento_default$" ]} +
+ +
+ {[ "type": "select", "label": "'.tr("Dichiarazione d'intento").'", "name": "id_dichiarazione_intento_default", "ajax-source": "dichiarazioni_intento", "select-options": {"idanagrafica": '.$id_record.', "data": "'.Carbon::now().'"},"value": "$id_dichiarazione_intento_default$" ]}
'; // Collegamento con il conto diff --git a/modules/fatture/src/Fattura.php b/modules/fatture/src/Fattura.php index 0e2e78169..70b7bae78 100755 --- a/modules/fatture/src/Fattura.php +++ b/modules/fatture/src/Fattura.php @@ -188,9 +188,15 @@ class Fattura extends Document $model->split_payment = $split_payment; } - // Gestione della Dichiarazione d'Intento associata all'anargafica Controparte + // Gestione della Dichiarazione d'Intento associata all'anagrafica Controparte $now = new Carbon(); $dichiarazione = $anagrafica->dichiarazioni() + ->where('massimale', '>', 'totale') + ->where('data_inizio', '<', $now) + ->where('data_fine', '>', $now) + ->where('id', $anagrafica->id_dichiarazione_intento_default) + ->first(); + $dichiarazione = $dichiarazione ?: $anagrafica->dichiarazioni() ->where('massimale', '>', 'totale') ->where('data_inizio', '<', $now) ->where('data_fine', '>', $now) diff --git a/update/2_4_40.sql b/update/2_4_40.sql index 75ec2e461..953f6bb99 100644 --- a/update/2_4_40.sql +++ b/update/2_4_40.sql @@ -149,4 +149,7 @@ WHERE HAVING 2=2 ORDER BY - `scadenza` ASC" WHERE `name` = 'Scadenzario'; \ No newline at end of file + `scadenza` ASC" WHERE `name` = 'Scadenzario'; + +-- Aggiunta dichiarazione d'intento predefinita +ALTER TABLE `an_anagrafiche` ADD `id_dichiarazione_intento_default` INT NULL AFTER `idtipointervento_default`, ADD FOREIGN KEY (`id_dichiarazione_intento_default`) REFERENCES `co_dichiarazioni_intento`(`id`); \ No newline at end of file From 6e89a4a9b8fa346c0e079188ec3859057aafd023 Mon Sep 17 00:00:00 2001 From: Pek5892 Date: Thu, 2 Feb 2023 11:59:03 +0100 Subject: [PATCH 4/6] Aggiunta impostazione posizione simbolo valuta --- lib/helpers.php | 15 +++++++++++---- update/2_4_40.sql | 3 +++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/helpers.php b/lib/helpers.php index a86d611bd..85ee4e4b4 100755 --- a/lib/helpers.php +++ b/lib/helpers.php @@ -274,10 +274,17 @@ function currency() */ function moneyFormat($number, $decimals = null) { - return tr('_CURRENCY_ _TOTAL_', [ - '_TOTAL_' => numberFormat($number, $decimals), - '_CURRENCY_' => currency(), - ]); + if (setting('Posizione del simbolo valuta') == 'Prima'){ + return tr('_CURRENCY_ _TOTAL_', [ + '_CURRENCY_' => currency(), + '_TOTAL_' => numberFormat($number, $decimals), + ]); + } else { + return tr('_TOTAL_ _CURRENCY_', [ + '_TOTAL_' => numberFormat($number, $decimals), + '_CURRENCY_' => currency(), + ]); + } } /** diff --git a/update/2_4_40.sql b/update/2_4_40.sql index 70900bc0d..25a67d341 100644 --- a/update/2_4_40.sql +++ b/update/2_4_40.sql @@ -159,3 +159,6 @@ INSERT INTO zz_settings(nome, valore, tipo, editable, sezione) VALUES ('Moviment -- Permetto valore null per numero_esterno di co_documenti ALTER TABLE `co_documenti` CHANGE `numero_esterno` `numero_esterno` VARCHAR(100) NULL DEFAULT NULL; + +-- Aggiunta impostazione Posizione della valuta +INSERT INTO zz_settings(nome, valore, tipo, editable, sezione) VALUES ('Posizione del simbolo valuta','Dopo','list[Prima,Dopo]','1','Generali'); \ No newline at end of file From 53278cc7176f8770caf41955ddb952ee00a98deb Mon Sep 17 00:00:00 2001 From: Pek5892 Date: Thu, 2 Feb 2023 12:01:21 +0100 Subject: [PATCH 5/6] =?UTF-8?q?Ottimizzazione=20velocit=C3=A0=20di=20caric?= =?UTF-8?q?amento=20widget=20rate=20contrattuali?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widgets/rate_contrattuali.php | 36 +------------------ 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/plugins/pianificazione_fatturazione/widgets/rate_contrattuali.php b/plugins/pianificazione_fatturazione/widgets/rate_contrattuali.php index e17830e0e..8d40106c0 100644 --- a/plugins/pianificazione_fatturazione/widgets/rate_contrattuali.php +++ b/plugins/pianificazione_fatturazione/widgets/rate_contrattuali.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -use Plugins\PianificazioneFatturazione\Pianificazione; + include_once __DIR__.'/../../../core.php'; @@ -36,40 +36,6 @@ $mesi = [ 12 => 'Dicembre', ]; -$pianificazioni = Pianificazione::doesntHave('fattura') - ->whereHas('contratto', function ($q) { - $q->whereHas('stato', function ($q) { - $q - ->where('is_fatturabile', 1) - ->where('descrizione', '<>', 'Concluso'); - }); - })->get(); - - - if ($pianificazioni->isEmpty()) { - echo '

'.tr('Non ci sono fatture da emettere').'.

'; - return; - } - - $conteggio = Pianificazione::doesntHave('fattura') - ->selectRaw('month(co_fatturazione_contratti.data_scadenza) mese, count(*) conto') - ->whereHas('contratto', function ($q) { - $q->whereHas('stato', function ($q) { - $q - ->where('is_fatturabile', 1) - ->where('descrizione', '<>', 'Concluso'); - }); - }) - ->whereYear('co_fatturazione_contratti.data_scadenza', date('Y')) - ->groupBy('mese') - ->get(); - - $raggruppamenti = $pianificazioni->groupBy(function ($item) { - return ucfirst($item->data_scadenza->formatLocalized('%B %Y')); - }); - - - echo '
From ef31eacd30a0251757d1412c7130a86aa3ea0739 Mon Sep 17 00:00:00 2001 From: Pek5892 Date: Thu, 2 Feb 2023 16:10:37 +0100 Subject: [PATCH 6/6] Aggiunta scadenzario autofatture #1169 --- update/2_4_40.sql | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/update/2_4_40.sql b/update/2_4_40.sql index 25a67d341..369f3beef 100644 --- a/update/2_4_40.sql +++ b/update/2_4_40.sql @@ -161,4 +161,9 @@ INSERT INTO zz_settings(nome, valore, tipo, editable, sezione) VALUES ('Moviment ALTER TABLE `co_documenti` CHANGE `numero_esterno` `numero_esterno` VARCHAR(100) NULL DEFAULT NULL; -- Aggiunta impostazione Posizione della valuta -INSERT INTO zz_settings(nome, valore, tipo, editable, sezione) VALUES ('Posizione del simbolo valuta','Dopo','list[Prima,Dopo]','1','Generali'); \ No newline at end of file +INSERT INTO zz_settings(nome, valore, tipo, editable, sezione) VALUES ('Posizione del simbolo valuta','Dopo','list[Prima,Dopo]','1','Generali'); + +-- Miglioria segmenti scadenzario +UPDATE `zz_segments` SET `name` = 'Scadenzario completo' WHERE `zz_segments`.`name` = 'Scadenziaro completo'; +UPDATE `zz_segments` SET `clause` = '(`co_scadenziario`.`scadenza` BETWEEN \'|period_start|\' AND \'|period_end|\' AND idtipodocumento < 14)' WHERE `zz_segments`.`name` = 'Scadenzario completo'; +INSERT INTO `zz_segments` (`id_module`, `name`, `clause`, `position`, `pattern`,`note`, `dicitura_fissa`,`predefined`, `predefined_accredito`, `predefined_addebito`, `autofatture`, `is_sezionale`) VALUES ((SELECT `id` FROM `zz_modules` WHERE `name` = 'Scadenzario'), 'Scadenzario autofatture', '(idtipodocumento >= 14)', 'WHR', '####', '', '', 0, 0, 0, 0, 0); \ No newline at end of file