mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-13 01:50:46 +01:00
Modulo per gestire banche
This commit is contained in:
parent
9262a910d5
commit
2ee08c59e0
@ -12,15 +12,14 @@ switch (filter('op')) {
|
|||||||
$array = [
|
$array = [
|
||||||
'nome' => $nome,
|
'nome' => $nome,
|
||||||
'filiale' => $post['filiale'],
|
'filiale' => $post['filiale'],
|
||||||
'IBAN' => $post['IBAN'],
|
'iban' => $post['iban'],
|
||||||
'BIC' => $post['BIC'],
|
'bic' => $post['bic'],
|
||||||
'idconto_vendite' => $post['idconto_vendite'],
|
'id_pianodeiconti3' => $post['id_pianodeiconti3'],
|
||||||
'idconto_acquisti' => $post['idconto_acquisti'],
|
|
||||||
'note' => $post['note'],
|
'note' => $post['note'],
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!empty($id_record)) {
|
if (!empty($id_record)) {
|
||||||
$dbo->update('co_banche', $array, ['id_record' => $id_record]);
|
$dbo->update('co_banche', $array, ['id' => $id_record]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$_SESSION['infos'][] = tr('Salvataggio completato!');
|
$_SESSION['infos'][] = tr('Salvataggio completato!');
|
||||||
@ -47,12 +46,28 @@ switch (filter('op')) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'delete':
|
case 'delete':
|
||||||
if (!empty($id_record)) {
|
|
||||||
|
$documenti = $dbo->fetchNum('SELECT idanagrafica FROM an_anagrafiche WHERE idbanca_vendite='.prepare($id_record).'
|
||||||
|
UNION SELECT idanagrafica FROM an_anagrafiche WHERE idbanca_acquisti='.prepare($id_record));
|
||||||
|
|
||||||
|
if (isset($id_record) && empty($documenti)) {
|
||||||
$dbo->query('DELETE FROM `co_banche` WHERE `id`='.prepare($id_record));
|
$dbo->query('DELETE FROM `co_banche` WHERE `id`='.prepare($id_record));
|
||||||
$_SESSION['infos'][] = tr('_TYPE_ eliminata con successo!', [
|
$_SESSION['infos'][] = tr('_TYPE_ eliminata con successo!', [
|
||||||
'_TYPE_' => 'Banca',
|
'_TYPE_' => 'Banca',
|
||||||
]);
|
]);
|
||||||
}
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$array = [
|
||||||
|
'deleted' => 1,
|
||||||
|
];
|
||||||
|
|
||||||
|
$dbo->update('co_banche', $array, ['id' => $id_record]);
|
||||||
|
|
||||||
|
$_SESSION['infos'][] = tr('_TYPE_ eliminata con successo!', [
|
||||||
|
'_TYPE_' => 'Banca',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ include_once __DIR__.'/../../core.php';
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
{[ "type": "text", "label": "<?php echo tr('Descrizione'); ?>", "name": "descrizione", "value": "" ]}
|
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "nome", "value": "" ]}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -2,7 +2,10 @@
|
|||||||
|
|
||||||
include_once __DIR__.'/../../core.php';
|
include_once __DIR__.'/../../core.php';
|
||||||
|
|
||||||
?><form action="" method="post" id="edit-form">
|
?>
|
||||||
|
|
||||||
|
<form action="" method="post" id="edit-form">
|
||||||
|
|
||||||
<input type="hidden" name="backto" value="record-edit">
|
<input type="hidden" name="backto" value="record-edit">
|
||||||
<input type="hidden" name="op" value="update">
|
<input type="hidden" name="op" value="update">
|
||||||
|
|
||||||
@ -15,185 +18,51 @@ include_once __DIR__.'/../../core.php';
|
|||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
{[ "type": "text", "label": "<?php echo tr('Descrizione'); ?>", "name": "descrizione", "value": "$descrizione$" ]}
|
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "nome", "value": "$nome$" ]}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
<div class="col-md-4">
|
{[ "type": "text", "label": "<?php echo tr('Filiale'); ?>", "name": "filiale", "value": "$filiale$" ]}
|
||||||
{[ "type": "select", "label": "<?php echo tr('Conto predefinito per le vendite'); ?>", "name": "idconto_vendite", "value": "$idconto_vendite$", "ajax-source": "conti" ]}
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
{[ "type": "select", "label": "<?php echo tr('Conto predefinito'); ?>", "name": "id_pianodeiconti3", "value": "$id_pianodeiconti3$", "ajax-source": "conti" ]}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-md-4">
|
<div class="row">
|
||||||
{[ "type": "select", "label": "<?php echo tr('Conto predefinito per gli acquisti'); ?>", "name": "idconto_acquisti", "value": "$idconto_acquisti$", "ajax-source": "conti" ]}
|
<div class="col-md-8">
|
||||||
|
{[ "type": "text", "label": "<?php echo tr('IBAN'); ?>", "name": "iban", "value": "$iban$" ]}
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
{[ "type": "text", "label": "<?php echo tr('BIC'); ?>", "name": "bic", "value": "$bic$" ]}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
{[ "type": "textarea", "label": "<?php echo tr('Note'); ?>", "name": "note", "required": 0, "class": "", "value": "$note$", "extra": "" ]}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="panel panel-primary">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<h3 class="panel-title"><?php echo tr('Rate'); ?></h3>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="panel-body">
|
|
||||||
<div class="data">
|
|
||||||
<?php
|
|
||||||
$values = '';
|
|
||||||
for ($i = 1; $i <= 31; ++$i) {
|
|
||||||
$values .= '\"'.$i.'\": \"'.$i.'\"';
|
|
||||||
if ($i != 31) {
|
|
||||||
$values .= ',';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$results = $dbo->fetchArray('SELECT * FROM `co_pagamenti` WHERE descrizione='.prepare($records[0]['descrizione']).' ORDER BY `num_giorni` ASC');
|
|
||||||
$cont = 1;
|
|
||||||
foreach ($results as $result) {
|
|
||||||
echo '
|
|
||||||
<div class="box box-success">
|
|
||||||
<div class="box-header with-border">
|
|
||||||
<h3 class="box-title">'.tr('Rata _NUMBER_', [
|
|
||||||
'_NUMBER_' => $cont,
|
|
||||||
]).'</h3>
|
|
||||||
<a class="btn btn-danger pull-right" onclick="';
|
|
||||||
echo "if(confirm('".tr('Eliminare questo elemento?')."')){ location.href='".$rootdir.'/editor.php?id_module='.$id_module.'&id_record='.$id_record.'&op=delete_rata&id='.$result['id']."'; }";
|
|
||||||
echo '"><i class="fa fa-trash"></i> '.tr('Elimina').'</a>
|
|
||||||
</div>
|
|
||||||
<div class="box-body">
|
|
||||||
<input type="hidden" value="'.$result['id'].'" name="id[]">
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
{[ "type": "number", "label": "'.tr('Percentuale').'", "name": "percentuale[]", "value": "'.$result['prc'].'", "icon-after": "<i class=\"fa fa-percent\"></i>" ]}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-6">
|
|
||||||
{[ "type": "select", "label": "'.tr('Scadenza').'", "name": "scadenza[]", "values": "list=\"1\":\"'.tr('Data fatturazione').'\",\"2\":\"'.tr('Data fatturazione fine mese').'\",\"3\":\"'.tr('Data fatturazione giorno fisso').'\",\"4\":\"'.tr('Data fatturazione fine mese (giorno fisso)').'\"", "value": "';
|
|
||||||
|
|
||||||
if ($result['giorno'] == 0) {
|
|
||||||
$select = 1;
|
|
||||||
} elseif ($result['giorno'] == -1) {
|
|
||||||
$select = 2;
|
|
||||||
} elseif ($result['giorno'] < -1) {
|
|
||||||
$select = 4;
|
|
||||||
} elseif ($result['giorno'] > 0) {
|
|
||||||
$select = 3;
|
|
||||||
}
|
|
||||||
echo $select;
|
|
||||||
echo '" ]}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
{[ "type": "select", "label": "'.tr('Giorno').'", "name": "giorno[]", "values": "list='.$values.'", "value": "';
|
|
||||||
if ($result['giorno'] != 0 && $result['giorno'] != -1) {
|
|
||||||
echo ($result['giorno'] < -1) ? -$result['giorno'] - 1 : $result['giorno'];
|
|
||||||
}
|
|
||||||
echo '", "extra": "';
|
|
||||||
if ($result['giorno'] == 0 || $result['giorno'] == -1) {
|
|
||||||
echo ' disabled';
|
|
||||||
}
|
|
||||||
echo '" ]}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-6">
|
|
||||||
{[ "type": "number", "label": "'.tr('Distanza in giorni').'", "name": "distanza[]", "decimals": "0", "value": "'.$result['num_giorni'].'" ]}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>';
|
|
||||||
++$cont;
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
<div class="pull-right">
|
|
||||||
<button type="button" class="btn btn-info" id="add"><i class="fa fa-plus"></i> <?php echo tr('Aggiungi'); ?></button>
|
|
||||||
<button type="submit" class="btn btn-success"><i class="fa fa-check"></i> <?php echo tr('Salva'); ?></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="box box-warning box-solid text-center hide" id="wait">
|
<?php
|
||||||
<div class="box-header with-border">
|
$documenti = $dbo->fetchNum('SELECT idanagrafica FROM an_anagrafiche WHERE idbanca_vendite='.prepare($id_record).'
|
||||||
<h3 class="box-title"><i class="fa fa-warning"></i> <?php echo tr('Attenzione!'); ?></h3>
|
UNION SELECT idanagrafica FROM an_anagrafiche WHERE idbanca_acquisti='.prepare($id_record));
|
||||||
</div>
|
|
||||||
<div class="box-body">
|
if (!empty($documenti)){
|
||||||
<p><?php echo tr('Prima di poter continuare con il salvataggio è necessario che i valori percentuali raggiungano in totale il 100%'); ?>.</p>
|
echo '
|
||||||
</div>
|
<div class="alert alert-danger">
|
||||||
</div>
|
'.tr('Ci sono _NUM_ documenti collegati', [
|
||||||
|
'_NUM_' => count($documenti),
|
||||||
|
]).'.
|
||||||
|
</div>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
<a class="btn btn-danger ask" data-backto="record-list">
|
<a class="btn btn-danger ask" data-backto="record-list">
|
||||||
<i class="fa fa-trash"></i> <?php echo tr('Elimina'); ?>
|
<i class="fa fa-trash"></i> <?php echo tr('Elimina'); ?>
|
||||||
</a>
|
</a>
|
||||||
<?php
|
|
||||||
echo '
|
|
||||||
<form class="hide" id="template">
|
|
||||||
<div class="box">
|
|
||||||
<div class="box-header with-border">
|
|
||||||
<h3 class="box-title">'.tr('Nuova rata').'</h3>
|
|
||||||
</div>
|
|
||||||
<div class="box-body">
|
|
||||||
<input type="hidden" value="" name="id[]">
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
{[ "type": "number", "label": "'.tr('Percentuale').'", "name": "percentuale[]", "icon-after": "<i class=\"fa fa-percent\"></i>" ]}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-6">
|
|
||||||
{[ "type": "select", "label": "'.tr('Scadenza').'", "name": "scadenza[]", "values": "list=\"1\":\"'.tr('Data fatturazione').'\",\"2\":\"'.tr('Data fatturazione fine mese').'\",\"3\":\"'.tr('Data fatturazione giorno fisso').'\",\"4\":\"'.tr('Data fatturazione fine mese (giorno fisso)').'\"", "value": 1 ]}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
{[ "type": "select", "label": "'.tr('Giorno').'", "name": "giorno[]", "values": "list='.$values.'" ]}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-6">
|
|
||||||
{[ "type": "number", "label": "'.tr('Distanza in giorni').'", "name": "distanza[]", "decimals": "0" ]}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>';
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
$(document).ready(function(){
|
|
||||||
$(document).on('click', '#add', function(){
|
|
||||||
$("#template .superselect, #template_filter .superselectajax").select2().select2("destroy");
|
|
||||||
|
|
||||||
$(this).parent().parent().find('.data').append($('#template').html());
|
|
||||||
|
|
||||||
start_superselect();
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).on('change', '[id*=scadenza]', function(){
|
|
||||||
if($(this).val() == 1 || $(this).val() == 2){
|
|
||||||
$(this).parentsUntil('.box').find('[id*=giorno]').prop('disabled', true);
|
|
||||||
}else{
|
|
||||||
$(this).parentsUntil('.box').find('[id*=giorno]').prop('disabled', false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#edit-form').submit(function(event) {
|
|
||||||
var tot = 0;
|
|
||||||
|
|
||||||
$(this).find('[id*=percentuale]').each(function(){
|
|
||||||
prc = $(this).val().toEnglish();
|
|
||||||
prc = !isNaN(prc) ? prc : 0;
|
|
||||||
|
|
||||||
tot += prc;
|
|
||||||
});
|
|
||||||
|
|
||||||
if(tot != 100) {
|
|
||||||
$('#wait').removeClass("hide");
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
@ -313,8 +313,10 @@ CREATE TABLE IF NOT EXISTS `co_banche` (
|
|||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`nome` varchar(255) NOT NULL,
|
`nome` varchar(255) NOT NULL,
|
||||||
`filiale` varchar(255) NOT NULL,
|
`filiale` varchar(255) NOT NULL,
|
||||||
`iban` varchar(50) NOT NULL,
|
`iban` varchar(32) NOT NULL,
|
||||||
|
`bic` varchar(11) NOT NULL,
|
||||||
`id_pianodeiconti3` int(11) DEFAULT NULL,
|
`id_pianodeiconti3` int(11) DEFAULT NULL,
|
||||||
|
`note` text NOT NULL,
|
||||||
`deleted` tinyint(1) NOT NULL DEFAULT '0',
|
`deleted` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;
|
||||||
@ -333,3 +335,6 @@ INSERT INTO `zz_group_view` (`id_gruppo`, `id_vista`) VALUES
|
|||||||
((SELECT `id` FROM `zz_groups` WHERE `nome` = 'Amministratori'), (SELECT `id` FROM `zz_views` WHERE `id_module` = (SELECT `id` FROM `zz_modules` WHERE `name` = 'Banche') AND `name` = 'Nome')),
|
((SELECT `id` FROM `zz_groups` WHERE `nome` = 'Amministratori'), (SELECT `id` FROM `zz_views` WHERE `id_module` = (SELECT `id` FROM `zz_modules` WHERE `name` = 'Banche') AND `name` = 'Nome')),
|
||||||
((SELECT `id` FROM `zz_groups` WHERE `nome` = 'Amministratori'), (SELECT `id` FROM `zz_views` WHERE `id_module` = (SELECT `id` FROM `zz_modules` WHERE `name` = 'Banche') AND `name` = 'Filiale')),
|
((SELECT `id` FROM `zz_groups` WHERE `nome` = 'Amministratori'), (SELECT `id` FROM `zz_views` WHERE `id_module` = (SELECT `id` FROM `zz_modules` WHERE `name` = 'Banche') AND `name` = 'Filiale')),
|
||||||
((SELECT `id` FROM `zz_groups` WHERE `nome` = 'Amministratori'), (SELECT `id` FROM `zz_views` WHERE `id_module` = (SELECT `id` FROM `zz_modules` WHERE `name` = 'Banche') AND `name` = 'IBAN'));
|
((SELECT `id` FROM `zz_groups` WHERE `nome` = 'Amministratori'), (SELECT `id` FROM `zz_views` WHERE `id_module` = (SELECT `id` FROM `zz_modules` WHERE `name` = 'Banche') AND `name` = 'IBAN'));
|
||||||
|
|
||||||
|
-- Aggiungo campi in an_anagrafiche con riferimento banche
|
||||||
|
ALTER TABLE `an_anagrafiche` ADD `idbanca_vendite` INT(11) NOT NULL AFTER `idconto_cliente`, ADD `idbanca_acquisti` INT(11) NOT NULL AFTER `idbanca_vendite`;
|
Loading…
x
Reference in New Issue
Block a user