mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-02 17:07:01 +01:00
Possibilità di calcolo progressivo preventivi su base annuale
Fix minori
This commit is contained in:
parent
528d881e16
commit
beddb78b41
@ -68,7 +68,7 @@ switch (post('op')) {
|
||||
case 'copy':
|
||||
// Copia del preventivo
|
||||
$new = $preventivo->replicate();
|
||||
$new->numero = Preventivo::getNextNumero();
|
||||
$new->numero = Preventivo::getNextNumero($new->data_bozza);
|
||||
$new->idstato = 1;
|
||||
$new->save();
|
||||
|
||||
|
@ -49,7 +49,7 @@ class Preventivo extends Document
|
||||
$model->stato()->associate($stato_documento);
|
||||
$model->tipoSessione()->associate($tipo_sessione);
|
||||
|
||||
$model->numero = static::getNextNumero();
|
||||
$model->numero = static::getNextNumero($data_bozza);
|
||||
|
||||
// Salvataggio delle informazioni
|
||||
$model->nome = $nome;
|
||||
@ -233,11 +233,20 @@ class Preventivo extends Document
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getNextNumero()
|
||||
public static function getNextNumero($data)
|
||||
{
|
||||
$maschera = setting('Formato codice preventivi');
|
||||
|
||||
$ultimo = Generator::getPreviousFrom($maschera, 'co_preventivi', 'numero');
|
||||
if ((strpos($maschera, 'YYYY') !== false) or (strpos($maschera, 'yy') !== false)) {
|
||||
|
||||
$ultimo = Generator::getPreviousFrom($maschera, 'co_preventivi', 'numero', [
|
||||
'YEAR(data_bozza) = '.prepare(date('Y', strtotime($data))),
|
||||
]);
|
||||
|
||||
}else{
|
||||
$ultimo = Generator::getPreviousFrom($maschera, 'co_preventivi', 'numero');
|
||||
}
|
||||
|
||||
$numero = Generator::generate($maschera, $ultimo);
|
||||
|
||||
return $numero;
|
||||
|
@ -442,7 +442,7 @@ class Prints
|
||||
|
||||
// Instanziamento dell'oggetto mPDF
|
||||
$mpdf = new \Mpdf\Mpdf([
|
||||
'mode' => 'utf-8',
|
||||
'mode' => 'c',
|
||||
'format' => $settings['format'],
|
||||
'orientation' => strtoupper($settings['orientation']) == 'L' ? 'L' : 'P',
|
||||
'font-size' => $settings['font-size'],
|
||||
@ -450,6 +450,7 @@ class Prints
|
||||
'margin_right' => $settings['margins']['right'],
|
||||
'setAutoBottomMargin' => 'stretch',
|
||||
'setAutoTopMargin' => 'stretch',
|
||||
'default_font' => 'helvetica',
|
||||
|
||||
// Abilitazione per lo standard PDF/A
|
||||
//'PDFA' => true,
|
||||
|
@ -107,11 +107,12 @@ echo '
|
||||
</tr>';
|
||||
|
||||
// Descrizione
|
||||
// Rimosso nl2br, non necessario con ckeditor
|
||||
echo '
|
||||
<tr>
|
||||
<td colspan="4" style="height:20mm;">
|
||||
<b>'.tr('Descrizione').':</b>
|
||||
<p>'.nl2br($documento['descrizione']).'</p>
|
||||
<p>'.($documento['descrizione']).'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
|
@ -162,3 +162,7 @@ INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`
|
||||
|
||||
-- Giorni lavorativi
|
||||
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`,`help`) VALUES (NULL, 'Giorni lavorativi', 'Lunedì,Martedì,Mercoledì,Giovedì,Venerdì', 'multiple[Lunedì,Martedì,Mercoledì,Giovedì,Venerdì,Sabato,Domenica]', '1', 'Interventi', '');
|
||||
|
||||
ALTER TABLE `zz_settings` CHANGE `help` `help` TEXT;
|
||||
|
||||
UPDATE `zz_settings` SET `help` = '<p>Impostare la maschera senza indicare l''anno per evitare il reset del contatore.</p><ul><li><b>####</b>: Numero progressivo del documento, con zeri non significativi per raggiungere il numero desiderato di caratteri</li><li><b>YYYY</b>: Anno corrente a 4 cifre</li><li><b>yy</b>: Anno corrente a 2 cifre</li></ul>' WHERE `zz_settings`.`nome` = 'Formato codice preventivi';
|
||||
|
Loading…
x
Reference in New Issue
Block a user