Aggiunta ora evasione negli ordini e in stampa

This commit is contained in:
MatteoPistorello 2021-04-08 12:18:38 +02:00
parent 7a295d5f11
commit c887cb687f
6 changed files with 127 additions and 40 deletions

View File

@ -121,31 +121,54 @@ if (in_array($module['name'], ['Ordini cliente', 'Ordini fornitore'])) {
$confermato = $result['confermato'];
}
echo '
<div class="box box-warning collapsable collapsed-box">
<div class="box-header with-border">
<h3 class="box-title">'.tr('Informazioni aggiuntive').'</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i></button>
<div class="box box-warning collapsable collapsed-box">
<div class="box-header with-border">
<h3 class="box-title">'.tr('Informazioni aggiuntive').'</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i></button>
</div>
</div>
<div class="box-body">
<div class="row">
<div class="col-md-4">
{[ "type": "date", "label": "'.tr('Data prevista evasione').'", "name": "data_evasione", "value": "'.$result['data_evasione'].'" ]}
</div>
<div class="col-md-4">
{[ "type": "time", "label": "'.tr('Ora prevista evasione').'", "name": "ora_evasione", "value": "'.$result['ora_evasione'].'", "disabled": 1 ]}
</div>
<div class="col-md-4">
{[ "type": "checkbox", "label": "'.tr('Cambia data a tutte le righe').'", "name": "data_evasione_all", "value": "" ]}
</div>
</div>
<div class="row">
<div class="col-md-4">
</div>
<div class="col-md-4">
{[ "type": "checkbox", "label": "'.tr('Articolo confermato').'", "name": "confermato", "value": "'.$confermato.'" ]}
</div>
<div class="col-md-4">
{[ "type": "checkbox", "label": "'.tr('Cambia stato a tutte le righe').'", "name": "confermato_all", "value": "" ]}
</div>
</div>
</div>
</div>
<div class="box-body">
<div class="row">
<div class="col-md-4">
{[ "type": "date", "label": "'.tr('Data prevista evasione').'", "name": "data_evasione", "value": "'.$result['data_evasione'].'" ]}
</div>
<div class="col-md-4">
{[ "type": "checkbox", "label": "'.tr('Cambia data a tutte le righe').'", "name": "data_evasione_all", "value": "" ]}
</div>
</div>
<div class="row">
<div class="col-md-4">
{[ "type": "checkbox", "label": "'.tr('Articolo confermato').'", "name": "confermato", "value": "'.$confermato.'" ]}
</div>
<div class="col-md-4">
{[ "type": "checkbox", "label": "'.tr('Cambia stato a tutte le righe').'", "name": "confermato_all", "value": "" ]}
</div>
</div>
</div>
</div>';
}
<script>
$(document).ready(function() {
if(input("data_evasione").get()){
input("ora_evasione").enable();
}
});
$("#data_evasione").on("change", function() {
if(input("data_evasione").get()){
input("ora_evasione").enable();
} else{
input("ora_evasione").disable();
input("ora_evasione").set();
}
});
</script>';
}

View File

@ -180,6 +180,7 @@ switch (post('op')) {
$articolo->costo_unitario = post('costo_unitario') ?: 0;
$articolo->data_evasione = post('data_evasione') ?: null;
$articolo->ora_evasione = post('ora_evasione') ?: null;
$articolo->confermato = post('confermato') ?: 0;
$articolo->setPrezzoUnitario(post('prezzo_unitario'), post('idiva'));
$articolo->setSconto(post('sconto'), post('tipo_sconto'));
@ -194,16 +195,17 @@ switch (post('op')) {
// Impostare data evasione su tutte le righe
if (post('data_evasione_all') == 1) {
$righe = $ordine->getRighe();
$righe = $ordine->getRighe()->where('is_descrizione', '=', '0');;
foreach ($righe as $riga) {
$riga->data_evasione = post('data_evasione') ?: null;
$riga->ora_evasione = post('ora_evasione') ?: null;
$riga->save();
}
}
// Impostare confermato su tutte le righe
if (post('confermato_all') == 1) {
$righe = $ordine->getRighe();
$righe = $ordine->getRighe()->where('is_descrizione', '=', '0');;
foreach ($righe as $riga) {
$riga->confermato = post('confermato') ?: 0;
@ -257,6 +259,7 @@ switch (post('op')) {
$riga->costo_unitario = post('costo_unitario') ?: 0;
$riga->data_evasione = post('data_evasione') ?: null;
$riga->ora_evasione = post('ora_evasione') ?: null;
$riga->confermato = post('confermato') ?: 0;
$riga->setPrezzoUnitario(post('prezzo_unitario'), post('idiva'));
$riga->setSconto(post('sconto'), post('tipo_sconto'));
@ -265,6 +268,26 @@ switch (post('op')) {
$riga->save();
// Impostare data evasione su tutte le righe
if (post('data_evasione_all') == 1) {
$righe = $ordine->getRighe()->where('is_descrizione', '=', '0');
foreach ($righe as $riga) {
$riga->data_evasione = post('data_evasione') ?: null;
$riga->ora_evasione = post('ora_evasione') ?: null;
$riga->save();
}
}
// Impostare confermato su tutte le righe
if (post('confermato_all') == 1) {
$righe = $ordine->getRighe()->where('is_descrizione', '=', '0');
foreach ($righe as $riga) {
$riga->confermato = post('confermato') ?: 0;
$riga->save();
}
}
if (post('idriga') != null) {
flash()->info(tr('Riga modificata!'));
} else {

View File

@ -129,7 +129,13 @@ foreach ($righe as $riga) {
);
}
$info_evasione = '<span class="tip" title="'.$evasione_help.'"><i class="'.$evasione_icon.'"></i> '.Translator::dateToLocale($riga->data_evasione).'</span>';
if (!empty($riga->ora_evasione)) {
$ora_evasione = '<br>'.Translator::timeToLocale($riga->ora_evasione).'';
} else{
$ora_evasione = '';
}
$info_evasione = '<span class="tip" title="'.$evasione_help.'"><i class="'.$evasione_icon.'"></i> '.Translator::dateToLocale($riga->data_evasione).$ora_evasione.'</span>';
}
echo '

View File

@ -22,7 +22,7 @@ include_once __DIR__.'/../../core.php';
// Righe documento
$righe = $documento->getRighe();
$columns = 6;
$columns = 7;
//Immagine solo per documenti di vendita
if ($documento->direzione == 'entrata') {
@ -76,11 +76,12 @@ if ($options['pricing']) {
<th class='text-center' style='width:10%'>".tr('IVA', [], ['upper' => true]).' (%)</th>';
}
echo '
echo "
<th class='text-center' style='width:10%'>".tr('Data evasione', [], ['upper' => true])."</th>
</tr>
</thead>
<tbody>';
<tbody>";
$num = 0;
foreach ($righe as $riga) {
@ -121,14 +122,16 @@ foreach ($righe as $riga) {
'.nl2br($r['descrizione']);
if ($riga->isArticolo()) {
// Codice articolo
$text = tr('COD. _COD_', [
'_COD_' => $riga->codice,
]);
echo '
<br><small>'.$text.'</small>';
if($documento->direzione == 'entrata'){
// Codice articolo
$text = tr('COD. _COD_', [
'_COD_' => $riga->codice,
]);
echo '
<br><small>'.$text.'</small>';
$autofill->count($text, true);
$autofill->count($text, true);
}
// Seriali
$seriali = $riga->serials;
@ -188,6 +191,11 @@ foreach ($righe as $riga) {
'.Translator::numberToLocale($riga->aliquota->percentuale, 0).'
</td>';
}
echo '
<td class="text-center">
<small>'.Translator::dateToLocale($riga->data_evasione).($riga->ora_evasione ? '<br>'.Translator::timeToLocale($riga->ora_evasione).'' : '').'</small>
</td>';
} else {
echo '
<td></td>';
@ -221,7 +229,7 @@ $netto_a_pagare = $documento->netto;
$show_sconto = $sconto > 0;
$colspan = 4;
$colspan = 5;
($documento->direzione == 'uscita' ? $colspan++ : $colspan);
($has_image ? $colspan++ : $colspan);

View File

@ -0,0 +1,24 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* 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/>.
*/
$settings = [
'font-size' => 9,
];
return $settings;

View File

@ -145,4 +145,7 @@ SELECT `zz_groups`.`id`, `zz_views`.`id` FROM `zz_groups`, `zz_views` INNER JOIN
INSERT INTO `zz_group_view` (`id_gruppo`, `id_vista`) (
SELECT `zz_groups`.`id`, `zz_views`.`id` FROM `zz_groups`, `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` WHERE `zz_modules`.`name`='Ordini cliente' AND (`zz_views`.`name` = 'icon_title_Prev. evasione' OR `zz_views`.`name` = 'icon_Prev. evasione')
);
);
-- Aggiunto campo ora evasione in ordini
ALTER TABLE `or_righe_ordini` ADD `ora_evasione` TIME NULL AFTER `data_evasione`;