This commit is contained in:
Beppe 2022-02-28 09:19:38 +01:00
commit 699227c7c5
19 changed files with 76 additions and 44 deletions

View File

@ -305,9 +305,6 @@ class CSV extends CSVImporter
$articolo->idiva_vendita = $aliquota->id;
$articolo->attivo = 1;
// Prezzo di vendita
$articolo->setPrezzoVendita($record['prezzo_vendita'], $aliquota->id ? $aliquota->id : setting('Iva predefinita'));
// Esportazione della quantità indicata
$qta_registrata = (float) ($record['qta']);
$nome_sede = $record['nome_sede'];
@ -386,6 +383,9 @@ class CSV extends CSVImporter
'id_sottocategoria' => $sottocategoria->id ?: $articolo['id_sottocategoria'],
]);
// Prezzo di vendita
$articolo->setPrezzoVendita($record['prezzo_vendita'], $aliquota->id ? $aliquota->id : setting('Iva predefinita'));
$articolo->save();
// Movimentazione della quantità registrata

View File

@ -7,8 +7,7 @@ echo '
<input type="hidden" name="op" value="add">
<input type="hidden" name="backto" value="record-edit">
<!-- Fix per generazione da record esistente -->
<input type="hidden" name="id_record" value="">
<div class="row">
<div class="col-md-6">

View File

@ -28,9 +28,6 @@ echo '
<input type="hidden" name="op" value="add">
<input type="hidden" name="backto" value="record-edit">
<!-- Fix creazione da Anagrafica -->
<input type="hidden" name="id_record" value="">
<div class="row">
<div class="col-md-6">
{[ "type": "text", "label": "'.tr('Nome').'", "name": "nome", "required": 1 ]}

View File

@ -44,9 +44,6 @@ $id_anagrafica = !empty(get('idanagrafica')) ? get('idanagrafica') : '';
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="dir" value="<?php echo $dir; ?>">
<!-- Fix creazione da Anagrafica -->
<input type="hidden" name="id_record" value="">
<div class="row">
<div class="col-md-4">
{[ "type": "date", "label": "<?php echo tr('Data'); ?>", "name": "data", "required": 1, "value": "-now-" ]}

View File

@ -42,9 +42,6 @@ $idtipodocumento = $dbo->selectOne('co_tipidocumento', ['id'], [
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="dir" value="<?php echo $dir; ?>">
<!-- Fix creazione da Anagrafica -->
<input type="hidden" name="id_record" value="">
<div class="row">
<?php

View File

@ -53,7 +53,7 @@ switch (post('op')) {
foreach ($fatture as $r) {
$print = Prints::getModulePredefinedPrint($id_module);
Prints::render($print['id'], $r['id'], $dir.'tmp/');
Prints::render($print['id'], $r['id'], $dir.'tmp/', false, false);
}
// Creazione zip

View File

@ -149,10 +149,7 @@ echo '
<form action="" method="post" id="add-form">
<input type="hidden" name="op" value="add">
<input type="hidden" name="ref" value="'.get('ref').'">
<input type="hidden" name="backto" value="record-edit">
<!-- Fix creazione da Anagrafica -->
<input type="hidden" name="id_record" value="">';
<input type="hidden" name="backto" value="record-edit">';
if (!empty($id_promemoria_contratto)) {
echo '<input type="hidden" name="idcontratto_riga" value="'.$id_promemoria_contratto.'">';

View File

@ -56,7 +56,7 @@ switch (post('op')) {
foreach ($interventi as $r) {
$print = Prints::getModulePredefinedPrint($id_module);
Prints::render($print['id'], $r['id'], $dir.'tmp/');
Prints::render($print['id'], $r['id'], $dir.'tmp/', false, false);
}
$dir = slashes($dir);

View File

@ -52,7 +52,7 @@ if (!empty($righe)) {
echo '
<div class="alert alert-danger">
'.tr('Ci sono _NUM_ righe collegate', [
'_NUM_' => count($righe),
'_NUM_' => $righe,
]).'.
</div>';
}

View File

@ -40,9 +40,6 @@ $id_anagrafica = !empty(get('idanagrafica')) ? get('idanagrafica') : $user['idan
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="dir" value="<?php echo $dir; ?>">
<!-- Fix creazione da Anagrafica -->
<input type="hidden" name="id_record" value="">
<div class="row">
<div class="col-md-6">
{[ "type": "date", "label": "<?php echo tr('Data'); ?>", "name": "data", "required": 1, "value": "-now-" ]}

View File

@ -25,9 +25,6 @@ $id_anagrafica = !empty(get('idanagrafica')) ? get('idanagrafica') : $user['idan
<input type="hidden" name="op" value="add">
<input type="hidden" name="backto" value="record-edit">
<!-- Fix creazione da Anagrafica -->
<input type="hidden" name="id_record" value="">
<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 ]}

View File

@ -25,9 +25,6 @@ echo '
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="op" value="add">
<!-- Fix creazione da Anagrafica -->
<input type="hidden" name="id_record" value="">
<div class="row">
<div class="col-md-4">

View File

@ -908,7 +908,7 @@ class FatturaElettronica
$percentuale = database()->fetchOne('SELECT percentuale FROM co_ritenutaacconto WHERE id = '.prepare($id_ritenuta))['percentuale'];
// Con la nuova versione in vigore dal 01/01/2021, questo nodo diventa ripetibile.
$result['DatiRitenuta'] = [
'TipoRitenuta' => (Validate::isValidTaxCode($azienda['codice_fiscale']) and $cliente['tipo'] == 'Privato') ? 'RT01' : 'RT02',
'TipoRitenuta' => ($azienda['piva'] != $azienda['codice_fiscale'] & $azienda['tipo'] != 'Ente pubblico') ? 'RT01' : 'RT02',
'ImportoRitenuta' => $totale_ritenutaacconto,
'AliquotaRitenuta' => $percentuale,
'CausalePagamento' => setting("Causale ritenuta d'acconto"),

View File

@ -29,6 +29,8 @@ if ($modulo == 'Anagrafiche') {
$movimenti = $dbo->fetchArray('SELECT co_movimenti.*, SUM(totale) AS totale, co_pianodeiconti3.descrizione, co_pianodeiconti3.numero AS conto3, co_pianodeiconti2.numero AS conto2 FROM co_movimenti LEFT JOIN co_pianodeiconti3 ON co_movimenti.idconto=co_pianodeiconti3.id LEFT JOIN co_pianodeiconti2 ON co_pianodeiconti3.idpianodeiconti2=co_pianodeiconti2.id WHERE iddocumento='.prepare($id_record).' GROUP BY idmastrino, idconto ORDER BY data, idmastrino');
}
$idmastrini_processati = [-1];
if (!empty($movimenti)) {
echo '
<table class="table table-hover table-condensed table-bordered table-striped" style="font-size:11pt;">
@ -61,6 +63,33 @@ if (!empty($movimenti)) {
<td class="text-right">'.($movimento['totale']<0 ? moneyFormat(abs($movimento['totale'])) : "").'</td>
<td class="text-right">'.moneyFormat($scalare).'</td>
</tr>';
$idmastrini_processati[] = $movimento['idmastrino'];
}
// Altri movimenti del mastrino collegati ma non direttamente collegati alla fattura (es. spese bancarie)
if ($modulo != 'Anagrafiche') {
$altri_movimenti = $dbo->fetchArray('SELECT co_movimenti.*, SUM(totale) AS totale, co_pianodeiconti3.descrizione, co_pianodeiconti3.numero AS conto3, co_pianodeiconti2.numero AS conto2 FROM co_movimenti LEFT JOIN co_pianodeiconti3 ON co_movimenti.idconto=co_pianodeiconti3.id LEFT JOIN co_pianodeiconti2 ON co_pianodeiconti3.idpianodeiconti2=co_pianodeiconti2.id WHERE iddocumento=0 AND idmastrino IN('.implode(',', $idmastrini_processati).') GROUP BY idmastrino, idconto ORDER BY data, idmastrino');
foreach ($altri_movimenti as $altro_movimento) {
$documento = $modulo == 'Anagrafiche' ? Fattura::find($altro_movimento['iddocumento']) : null;
$scalare += $altro_movimento['totale'];
$descrizione = $altro_movimento['conto2'].'.'.$altro_movimento['conto3'].' - '.$altro_movimento['descrizione'];
if( $altro_movimento['primanota']==1 ){
$descrizione = Modules::link('Prima nota',$altro_movimento['idmastrino'],$descrizione);
}
echo '
<tr>
<td class="text-center">'.Translator::dateToLocale($altro_movimento['data']).'</td>
<td>'.$descrizione.'<small class="pull-right text-right text-muted" style="font-size:8pt;">'.($documento ? $documento->getReference() : '').'</small></td>
<td class="text-right">'.($altro_movimento['totale']>0 ? moneyFormat(abs($altro_movimento['totale'])) : "").'</td>
<td class="text-right">'.($altro_movimento['totale']<0 ? moneyFormat(abs($altro_movimento['totale'])) : "").'</td>
<td class="text-right">'.moneyFormat($scalare).'</td>
</tr>';
}
}
echo '
</tbody>

View File

@ -25,9 +25,6 @@ echo '
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="op" value="addreferente">
<!-- Fix creazione da Anagrafica -->
<input type="hidden" name="id_record" value="">
<div class="row">
<div class="col-md-6">
{[ "type": "text", "label": "'.tr('Nominativo').'", "name": "nome", "required": 1 ]}

View File

@ -25,9 +25,6 @@ echo '
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="op" value="addsede">
<!-- Fix creazione da Anagrafica -->
<input type="hidden" name="id_record" value="">
<div class="row">
<div class="col-md-6">
{[ "type": "select", "label": "'.tr('Anagrafica').'", "name": "id_anagrafica", "required": "1", "value": "'.$id_parent.'", "ajax-source": "anagrafiche", "disabled": 1 ]}

View File

@ -55,7 +55,7 @@ class SelectHandler implements HandlerInterface
// Inizializzazione del codice HTML
$result = '
<select |attr|>';
<select autocomplete="off" |attr|>';
// Delega della generazione del codice HTML in base alle caratteristiche del formato
// Gestione delle richieste AJAX (se il campo "ajax-source" è impostato)

View File

@ -139,7 +139,7 @@ class Prints
* @param string $directory
* @param bool $return_string
*/
public static function render($print, $id_record, $directory = null, $return_string = false)
public static function render($print, $id_record, $directory = null, $return_string = false, $overwrite = true)
{
//ob_end_clean(); // Compatibilità con versioni vecchie delle stampe
$dbo = $database = database();
@ -186,9 +186,9 @@ class Prints
if (self::isCompletelyCustom($print)) {
return self::customLoader($infos['id'], $id_record, $directory, $return_string);
} elseif (self::isOldStandard($print)) {
return self::oldLoader($infos['id'], $id_record, $directory, $return_string);
return self::oldLoader($infos['id'], $id_record, $directory, $return_string, $overwrite);
} else {
return self::loader($infos['id'], $id_record, $directory, $return_string);
return self::loader($infos['id'], $id_record, $directory, $return_string, $overwrite);
}
}
@ -354,7 +354,7 @@ class Prints
* @param string $directory
* @param bool $return_string
*/
protected static function oldLoader($id_print, $id_record, $directory = null, $return_string = false)
protected static function oldLoader($id_print, $id_record, $directory = null, $return_string = false, $overwrite = true)
{
$format = 'A4';
@ -415,6 +415,20 @@ class Prints
$html2pdf->writeHTML($report);
$html2pdf->pdf->setTitle($title);
// Ridenominazione file se l'impostazione è disattivata
if (!$overwrite) {
$index = 1;
$file_parts = pathinfo($path);
$filename_no_extension = $file_parts['filename'];
while (file_exists($directory.'/'.$file_parts['basename'])) {
$path = $file_parts['dirname'].'/'.$filename_no_extension.'_'.$index++.'.'.$file_parts['extension'];
$file_parts = pathinfo($path);
}
}
$pdf = $html2pdf->output($path, $mode);
$file['pdf'] = $pdf;
}else{
@ -458,7 +472,7 @@ class Prints
* @param string $directory
* @param bool $return_string
*/
protected static function loader($id_print, $id_record, $directory = null, $return_string = false)
protected static function loader($id_print, $id_record, $directory = null, $return_string = false, $overwrite = true)
{
$infos = self::get($id_print);
$options = self::readOptions($infos['options']);
@ -650,6 +664,20 @@ class Prints
$title = $file['name'];
$path = $file['path'];
// Ridenominazione file se l'impostazione è disattivata
if (!$overwrite) {
$index = 1;
$file_parts = pathinfo($path);
$filename_no_extension = $file_parts['filename'];
while (file_exists($directory.'/'.$file_parts['basename'])) {
$path = $file_parts['dirname'].'/'.$filename_no_extension.'_'.$index++.'.'.$file_parts['extension'];
$file_parts = pathinfo($path);
}
}
// Impostazione del titolo del PDF
$mpdf->SetTitle($title);

View File

@ -29,4 +29,7 @@ INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `
-- Aggiunta opzione formattazione HTML nelle viste per la gestione dei campi CKeditor
ALTER TABLE `zz_views` ADD `html_format` TINYINT NOT NULL DEFAULT '1' AFTER `format`;
UPDATE `zz_views` SET `html_format` = '1';
UPDATE `zz_views` SET `html_format` = '1';
-- Correzione widget valore magazzino
UPDATE `zz_widgets` SET `query` = 'SELECT CONCAT_WS(\" \", REPLACE(REPLACE(REPLACE(FORMAT(SUM(prezzo_acquisto*qta),2), \",\", \"#\"), \".\", \",\"), \"#\", \".\"), \"&euro;\") AS dato FROM mg_articoli WHERE qta>0 AND deleted_at IS NULL AND servizio=0' WHERE `zz_widgets`.`name` = 'Valore magazzino';