mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-08 23:58:42 +01:00
feat: gestione spedizione porto e vettore in ordini
This commit is contained in:
parent
3689537560
commit
d9cae84697
@ -304,6 +304,12 @@ switch (filter('op')) {
|
||||
$ddt->idreferente = $documento->idreferente;
|
||||
$ddt->idagente = $documento->idagente;
|
||||
|
||||
if (filter('op') == 'add_ordine') {
|
||||
$ddt->idspedizione = $documento->idspedizione;
|
||||
$ddt->idporto = $documento->idporto;
|
||||
$ddt->idvettore = $documento->idvettore;
|
||||
}
|
||||
|
||||
$ddt->save();
|
||||
|
||||
$id_record = $ddt->id;
|
||||
|
@ -274,7 +274,7 @@ $esterno = $dbo->selectOne('dt_spedizione', 'esterno', [
|
||||
'id' => $record['idspedizione'],
|
||||
])['esterno'];
|
||||
?>
|
||||
{[ "type": "select", "label": "<?php echo tr('Vettore'); ?>", "name": "idvettore", "ajax-source": "vettori", "value": "$idvettore$", "disabled": <?php echo empty($esterno) || (!empty($esterno) && !empty($record['idvettore'])) ? 1 : 0; ?>, "required": <?php echo !empty($esterno) ?: 0; ?>, "icon-": "add|<?php echo Module::where('name', 'Anagrafiche')->first()->id; ?>|tipoanagrafica=Vettore&readonly_tipo=1|btn_idvettore|<?php echo ($esterno and (intval(!$record['flag_completato']) || empty($record['idvettore']))) ? '' : 'disabled'; ?>", "class": "<?php echo empty($record['idvettore']) ? 'unblockable' : ''; ?>" ]}
|
||||
{[ "type": "select", "label": "<?php echo tr('Vettore'); ?>", "name": "idvettore", "ajax-source": "vettori", "value": "$idvettore$", "disabled": <?php echo empty($esterno) || (!empty($esterno) && !empty($record['idvettore'])) ? 1 : 0; ?>, "required": <?php echo !empty($esterno) ?: 0; ?>, "icon-after": "add|<?php echo Module::where('name', 'Anagrafiche')->first()->id; ?>|tipoanagrafica=Vettore&readonly_tipo=1|btn_idvettore|<?php echo ($esterno and (intval(!$record['flag_completato']) || empty($record['idvettore']))) ? '' : 'disabled'; ?>", "class": "<?php echo empty($record['idvettore']) ? 'unblockable' : ''; ?>" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
|
@ -94,6 +94,9 @@ switch (post('op')) {
|
||||
$ordine->idagente = post('idagente');
|
||||
$ordine->idstatoordine = $idstatoordine;
|
||||
$ordine->idpagamento = $idpagamento;
|
||||
$ordine->idspedizione = post('idspedizione');
|
||||
$ordine->idporto = post('idporto');
|
||||
$ordine->idvettore = post('idvettore');
|
||||
$ordine->idsede = $idsede;
|
||||
$ordine->idconto = post('idconto');
|
||||
$ordine->idrivalsainps = $idrivalsainps;
|
||||
|
@ -144,26 +144,77 @@ echo '
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-2" <?php echo ($dir == 'entrata') ? 'hidden' : ''; ?>>
|
||||
<div class="col-md-3" <?php echo ($dir == 'entrata') ? 'hidden' : ''; ?>>
|
||||
{[ "type": "text", "label": "<?php echo tr('Numero ordine'); ?>", "name": "numero", "required": 1, "class": "text-center", "value": "$numero$" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="col-md-3">
|
||||
{[ "type": "text", "label": "<?php echo ($dir == 'entrata') ? tr('Numero ordine') : tr('Numero ordine fornitore'); ?>", "name": "numero_esterno", "class": "text-center", "value": "$numero_esterno$" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="col-md-3">
|
||||
{[ "type": "date", "label": "<?php echo tr('Data'); ?>", "name": "data", "required": 1, "value": "$data$" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-3">
|
||||
{[ "type": "select", "label": "<?php echo tr('Pagamento'); ?>", "name": "idpagamento", "required": 0, "ajax-source": "pagamenti", "value": "$idpagamento$" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
{[ "type": "select", "label": "<?php echo tr('Tipo di spedizione'); ?>", "name": "idspedizione", "placeholder": "-", "values": "query=SELECT `dt_spedizione`.`id`, `dt_spedizione_lang`.`title` as `descrizione`, `esterno` FROM `dt_spedizione` LEFT JOIN `dt_spedizione_lang` ON (`dt_spedizione_lang`.`id_record` = `dt_spedizione`.`id` AND `dt_spedizione_lang`.`id_lang` = <?php echo prepare(Models\Locale::getDefault()->id); ?>) ORDER BY `title` ASC", "value": "$idspedizione$" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "select", "label": "<?php echo tr('Porto'); ?>", "name": "idporto", "placeholder": "-", "help": "<?php echo tr('<ul><li>Franco: pagamento del trasporto a carico del mittente</li> <li>Assegnato: pagamento del trasporto a carico del destinatario</li> </ul>'); ?>", "values": "query=SELECT `dt_porto`.`id`, `dt_porto_lang`.`title` as descrizione FROM `dt_porto` LEFT JOIN `dt_porto_lang` ON (`dt_porto`.`id` = `dt_porto_lang`.`id_record` AND `dt_porto_lang`.`id_lang` = <?php echo prepare(Models\Locale::getDefault()->id); ?>) ORDER BY `title` ASC", "value": "$idporto$" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<?php
|
||||
if (!empty($record['idvettore'])) {
|
||||
echo Modules::link('Anagrafiche', $record['idvettore'], null, null, 'class="pull-right"');
|
||||
}
|
||||
$esterno = $dbo->selectOne('dt_spedizione', 'esterno', [
|
||||
'id' => $record['idspedizione'],
|
||||
])['esterno'];
|
||||
?>
|
||||
{[ "type": "select", "label": "<?php echo tr('Vettore'); ?>", "name": "idvettore", "ajax-source": "vettori", "value": "$idvettore$", "disabled": <?php echo empty($esterno) ? 1 : 0; ?>, "required": <?php echo !empty($esterno) ?: 0; ?>, "icon-after": "add|<?php echo Module::where('name', 'Anagrafiche')->first()->id; ?>|tipoanagrafica=Vettore&readonly_tipo=1|btn_idvettore|<?php echo ($esterno and (intval(!$record['flag_completato']) || empty($record['idvettore']))) ? '' : 'disabled'; ?>", "class": "<?php echo empty($record['idvettore']) ? 'unblockable' : ''; ?>" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "number", "label": "<?php echo 'Sconto in fattura'; ?>", "name": "sconto_finale", "value": "<?php echo $ordine->sconto_finale_percentuale ?: $ordine->sconto_finale; ?>", "icon-after": "choice|untprc|<?php echo empty($ordine->sconto_finale) ? 'PRC' : 'UNT'; ?>", "help": "<?php echo tr('Sconto in fattura, utilizzabile per applicare sconti sul netto a pagare del documento'); ?>." ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$("#idspedizione").change(function() {
|
||||
if($(this).val()){
|
||||
if (!$(this).selectData().esterno) {
|
||||
$("#idvettore").attr("required", false);
|
||||
input("idvettore").disable();
|
||||
$("label[for=idvettore]").text("<?php echo tr('Vettore'); ?>");
|
||||
$("#idvettore").selectReset("<?php echo tr("Seleziona un\'opzione"); ?>");
|
||||
$(".btn_idvettore").prop("disabled", true);
|
||||
$(".btn_idvettore").addClass("disabled");
|
||||
}else{
|
||||
$("#idvettore").attr("required", true);
|
||||
input("idvettore").enable();
|
||||
$("label[for=idvettore]").text("<?php echo tr('Vettore'); ?>*");
|
||||
$(".btn_idvettore").prop("disabled", false);
|
||||
$(".btn_idvettore").removeClass("disabled");
|
||||
|
||||
}
|
||||
} else{
|
||||
$("#idvettore").attr("required", false);
|
||||
input("idvettore").disable();
|
||||
$("label[for=idvettore]").text("<?php echo tr('Vettore'); ?>");
|
||||
$("#idvettore").selectReset("<?php echo tr("Seleziona un\'opzione"); ?>");
|
||||
$(".btn_idvettore").prop("disabled", true);
|
||||
$(".btn_idvettore").addClass("disabled");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
|
||||
if ($dir == 'entrata') {
|
||||
|
@ -62,6 +62,38 @@ $columns = $options['pricing'] ? $columns : $columns - 3;
|
||||
$autofill = new Util\Autofill($columns);
|
||||
$autofill->setRows(27, 0, 31);
|
||||
|
||||
// Informazioni aggiuntive
|
||||
echo '
|
||||
<table class="table table-striped border-bottom">
|
||||
<tr>
|
||||
<td class="small-bold text-muted" style="width:33%">
|
||||
'.tr('Porto', [], ['upper' => true]).'
|
||||
</td>
|
||||
|
||||
<td class="small-bold text-muted" style="width:33%">
|
||||
'.tr('Tipo di spedizione', [], ['upper' => true]).'
|
||||
</td>
|
||||
|
||||
<td class="small-bold text-muted" style="width:33%">
|
||||
'.tr('Vettore', [], ['upper' => true]).'
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="cell-padded">
|
||||
$porto$
|
||||
</td>
|
||||
|
||||
<td class="cell-padded">
|
||||
$spedizione$
|
||||
</td>
|
||||
|
||||
<td class="cell-padded">
|
||||
$vettore$
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
// Intestazione tabella per righe
|
||||
echo "
|
||||
<table class='table table-striped border-bottom' id='contents'>
|
||||
|
@ -66,10 +66,17 @@ if (!empty($documento->idsede)) {
|
||||
$numero = !empty($documento['numero_esterno']) ? $documento['numero_esterno'] : $documento['numero'];
|
||||
$pagamento = $dbo->fetchOne('SELECT * FROM `co_pagamenti` LEFT JOIN `co_pagamenti_lang` ON (`co_pagamenti`.`id` = `co_pagamenti_lang`.`id_record` AND `co_pagamenti_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `co_pagamenti`.`id` = '.prepare($documento->idpagamento));
|
||||
|
||||
$porto = $dbo->fetchOne('SELECT `dt_porto`.*, `dt_porto_lang`.`title` as descrizione FROM `dt_porto` LEFT JOIN `dt_porto_lang` ON (`dt_porto`.`id` = `dt_porto_lang`.`id_record` AND `dt_porto_lang`.`id_lang` ='.prepare(Models\Locale::getDefault()->id).') WHERE `dt_porto`.`id` = '.prepare($documento['idporto']));
|
||||
$spedizione = $dbo->fetchOne('SELECT `dt_spedizione`.*, `dt_spedizione_lang`.`title` as descrizione FROM `dt_spedizione` LEFT JOIN `dt_spedizione_lang` ON (`dt_spedizione`.`id`=`dt_spedizione_lang`.`id_record` AND `dt_spedizione_lang`.`id_lang`='.prepare(Models\Locale::getDefault()->id).') WHERE `dt_spedizione`.`id` = '.prepare($documento['idspedizione']));
|
||||
$vettore = $dbo->fetchOne('SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica = '.prepare($documento['idvettore']));
|
||||
|
||||
// Sostituzioni specifiche
|
||||
$custom = [
|
||||
'tipo_doc' => Stringy\Stringy::create($documento->tipo->getTranslation('title'))->toUpperCase(),
|
||||
'numero' => $numero,
|
||||
'data' => Translator::dateToLocale($documento['data']),
|
||||
'pagamento' => $pagamento['descrizione'],
|
||||
];
|
||||
'porto' => $porto['descrizione'],
|
||||
'spedizione' => $spedizione['descrizione'],
|
||||
'vettore' => $vettore['ragione_sociale']
|
||||
];
|
@ -99,4 +99,7 @@ ALTER TABLE `mg_articoli` ADD `modello` VARCHAR(255) NULL AFTER `id_marchio`;
|
||||
UPDATE `zz_segments` SET `clause` = 'in_interventi.idstatointervento NOT IN(SELECT in_statiintervento.id FROM in_statiintervento WHERE is_completato=1)' WHERE `zz_segments`.`name` = 'Non completate' AND `id_module` = (SELECT `id` FROM `zz_modules` WHERE `name` = 'Interventi');
|
||||
|
||||
INSERT INTO `zz_api_resources` (`id`, `version`, `type`, `resource`, `class`, `enabled`) VALUES
|
||||
(NULL, 'v1', 'retrieve', 'pagamenti', 'Modules\\Pagamenti\\API\\v1\\Pagamenti', 1);
|
||||
(NULL, 'v1', 'retrieve', 'pagamenti', 'Modules\\Pagamenti\\API\\v1\\Pagamenti', 1);
|
||||
|
||||
-- Aggiunto spedizione porto e vettore in ordini
|
||||
ALTER TABLE `or_ordini` ADD `idspedizione` TINYINT NULL AFTER `codice_commessa`, ADD `idporto` TINYINT NULL AFTER `idspedizione`, ADD `idvettore` INT NULL AFTER `idporto`;
|
Loading…
x
Reference in New Issue
Block a user