1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-02 17:07:01 +01:00

Aggiunta descrizione revisione

This commit is contained in:
MatteoPistorello 2021-04-26 13:24:35 +02:00
parent d65d879eae
commit 49e660f10a
6 changed files with 64 additions and 24 deletions

View File

@ -1,7 +1,7 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
* Copyright (C) DevCode s.n.c.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -61,20 +61,18 @@ switch (post('op')) {
$preventivo->idporto = post('idporto');
$preventivo->tempi_consegna = post('tempi_consegna');
$preventivo->numero = post('numero');
$preventivo->condizioni_fornitura = post('condizioni_fornitura');
// Informazioni sulle date del documento
$preventivo->data_bozza = post('data_bozza') ?: null;
$preventivo->data_rifiuto = post('data_rifiuto') ?: null;
$preventivo->data_bozza = post('data_bozza');
$preventivo->data_rifiuto = post('data_rifiuto');
// Dati relativi alla validità del documento
$preventivo->validita = post('validita');
$preventivo->tipo_validita = post('tipo_validita');
$preventivo->data_accettazione = post('data_accettazione') ?: null;
$preventivo->data_conclusione = post('data_conclusione') ?: null;
$preventivo->data_accettazione = post('data_accettazione');
$preventivo->data_conclusione = post('data_conclusione');
$preventivo->esclusioni = post('esclusioni');
$preventivo->garanzia = post('garanzia');
$preventivo->descrizione = post('descrizione');
$preventivo->id_documento_fe = post('id_documento_fe');
$preventivo->num_item = post('num_item');
@ -326,6 +324,7 @@ switch (post('op')) {
$new->default_revision = 1;
$new->numero_revision = $new->ultima_revisione + 1;
$new->descrizione_revision = post('descrizione');
$new->save();
$id_record = $new->id;
@ -347,7 +346,7 @@ switch (post('op')) {
$order = explode(',', post('order', true));
foreach ($order as $i => $id_riga) {
$dbo->query('UPDATE `co_righe_preventivi` SET `order` = '.prepare($i + 1).' WHERE id='.prepare($id_riga));
$dbo->query('UPDATE `co_righe_preventivi` SET `order` = '.prepare($i).' WHERE id='.prepare($id_riga));
}
break;

View File

@ -1,7 +1,7 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
* Copyright (C) DevCode s.n.c.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -31,8 +31,8 @@ echo '
<div class="tip" data-toggle="tooltip" title="'.tr('Per creare una nuova revisione lo stato del preventivo deve essere tra: _STATE_LIST_', [
'_STATE_LIST_' => $stati_abilitati,
]).'">
<button type="button" class="btn btn-warning '.($record['is_revisionabile'] ? '' : 'disabled').'" onclick="if(confirm(\''.tr('Creare un nuova revisione?').'\')){$(\'#crea-revisione\').submit();}">
<i class="fa fa-plus-square"></i> '.tr('Crea nuova revisione...').'
<button type="button" class="btn btn-warning '.($record['is_revisionabile'] ? '' : 'disabled').'" onclick="openModal(\''.tr('Crea revisione').'\', \''.$module->fileurl('crea_revisione.php').'?id_module='.$id_module.'&id_record='.$id_record.'\')">
<i class="fa fa-edit"></i> '.tr('Crea nuova revisione...').'
</button>
</div>';
@ -84,11 +84,3 @@ echo '
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="op" value="copy">
</form>';
// Crea revisione
echo '
<form action="" method="post" id="crea-revisione">
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="op" value="add_revision">
<input type="hidden" name="id_record" value="'.$id_record.'">
</form>';

View File

@ -0,0 +1,44 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.n.c.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
include_once __DIR__.'/../../core.php';
use Modules\Preventivi\Preventivo;
$revisione = Preventivo::find($id_record)->ultima_revisione;
?>
<form action="" method="post">
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="op" value="add_revision">
<div class="row">
<div class="col-md-12">
{[ "type": "text", "label": "<?php echo tr('Descrizione'); ?>", "name": "descrizione", "required": 1, "value": "Revisione n. <?php echo $revisione+1; ?>" ]}
</div>
</div>
<div class="row">
<div class="col-md-12 text-right">
<button type="submit" class="btn btn-primary">
<i class="fa fa-plus"></i><?php echo tr(' Aggiungi'); ?>
</button>
</div>
</div>
</form>

View File

@ -22,7 +22,7 @@ $r = $dbo->fetchOne('SELECT *,
IF( (an_referenti.email IS NOT NULL AND an_referenti.email!=""), an_referenti.email, an_anagrafiche.email) AS email
FROM co_preventivi INNER JOIN an_anagrafiche ON co_preventivi.idanagrafica=an_anagrafiche.idanagrafica LEFT OUTER JOIN an_referenti ON an_referenti.id=co_preventivi.idreferente WHERE co_preventivi.id='.prepare($id_record));
$revisione = $dbo->fetchNum('SELECT * FROM co_preventivi WHERE master_revision = (SELECT master_revision FROM co_preventivi WHERE id = '.prepare($id_record).') AND id < '.prepare($id_record)) + 1;
$revisione = $dbo->fetchNum('SELECT * FROM co_preventivi WHERE master_revision = (SELECT master_revision FROM co_preventivi WHERE id = '.prepare($id_record).') AND id < '.prepare($id_record));
// Variabili da sostituire
return [

View File

@ -1,7 +1,7 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
* Copyright (C) DevCode s.n.c.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -61,8 +61,9 @@ foreach ($revisioni as $i => $revisione) {
<input type='radio' class='revision_changer' name='idrevisione' value='".$revisione['id']."' ".$cheched.'>
</td>
<td>
'.tr('Revisione _NUM_ creata il _DATE_ alle _TIME_', [
'.tr('(REV. _NUM_) _DESC_ creata il _DATE_ alle _TIME_', [
'_NUM_' => ($revisione['numero_revision']),
'_DESC_' => ($revisione['descrizione_revision']),
'_DATE_' => dateFormat($revisione['created_at']),
'_TIME_' => timeFormat($revisione['created_at']),
])."

View File

@ -168,3 +168,7 @@ INSERT INTO `zz_group_module` (`idgruppo`, `idmodule`, `name`, `clause`, `positi
-- Fix widget crediti clienti
UPDATE `zz_widgets` SET `query` = 'SELECT \n CONCAT_WS(\' \', REPLACE(REPLACE(REPLACE(FORMAT((\n SELECT SUM(da_pagare-pagato)), 2), \',\', \'#\'), \'.\', \',\'),\'#\', \'.\'), \'&euro;\') AS dato FROM (co_scadenziario INNER JOIN co_documenti ON co_scadenziario.iddocumento=co_documenti.id) INNER JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id WHERE co_tipidocumento.dir=\'entrata\' AND co_documenti.idstatodocumento!=1 |segment| AND 1=1' WHERE `zz_widgets`.`name` = 'Crediti da clienti';
-- Aggiunto campo descrizione revisione in preventivi
ALTER TABLE `co_preventivi` ADD `descrizione_revision` VARCHAR(255) NOT NULL AFTER `default_revision`;
UPDATE `zz_prints` SET `filename` = 'Preventivo num. {numero} del {data} rev {revisione}' WHERE `zz_prints`.`name` = 'Preventivo';