mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-03-06 12:17:58 +01:00
Formattazione stile codice
This commit is contained in:
parent
9e63a1bc90
commit
6f3140bba5
1
.php-cs-fixer.cache
Normal file
1
.php-cs-fixer.cache
Normal file
File diff suppressed because one or more lines are too long
26
.php-cs-fixer.php
Normal file
26
.php-cs-fixer.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
$finder = PhpCsFixer\Finder::create()
|
||||
->files()
|
||||
->exclude('.couscous')
|
||||
->exclude('node_modules')
|
||||
->exclude('vendor')
|
||||
->exclude('tests')
|
||||
->ignoreDotFiles(true)
|
||||
->ignoreVCS(true)
|
||||
->in(__DIR__);
|
||||
|
||||
$config = new PhpCsFixer\Config();
|
||||
$config->setRules([
|
||||
'@Symfony' => true,
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'yoda_style' => false,
|
||||
'echo_tag_syntax' => ['format' => 'long'],
|
||||
'ordered_imports' => true,
|
||||
'no_alternative_syntax' => true,
|
||||
'ordered_class_elements' => true,
|
||||
'phpdoc_order' => true,
|
||||
])
|
||||
->setFinder($finder);
|
||||
|
||||
return $config;
|
33
.php_cs
33
.php_cs
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
$finder = PhpCsFixer\Finder::create()
|
||||
->files()
|
||||
->exclude('.couscous')
|
||||
->exclude('node_modules')
|
||||
->exclude('vendor')
|
||||
->exclude('tests')
|
||||
->ignoreDotFiles(true)
|
||||
->ignoreVCS(true)
|
||||
->in(__DIR__);
|
||||
|
||||
$config = PhpCsFixer\Config::create()
|
||||
->setRules([
|
||||
'@Symfony' => true,
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'yoda_style' => false,
|
||||
'no_short_echo_tag' => true,
|
||||
'ordered_imports' => true,
|
||||
'no_alternative_syntax' => true,
|
||||
'ordered_class_elements' => true,
|
||||
'phpdoc_order' => true,
|
||||
//'no_superfluous_phpdoc_tags' => [
|
||||
// 'allow_mixed' => true,
|
||||
// 'allow_unused_params' => true,
|
||||
//],
|
||||
//'phpdoc_add_missing_param_annotation' => [
|
||||
// 'only_untyped' => false,
|
||||
//],
|
||||
])
|
||||
->setFinder($finder);
|
||||
|
||||
return $config;
|
44
actions.php
44
actions.php
@ -54,26 +54,22 @@ if (filter('op') == 'aggiungi-allegato' || filter('op') == 'rimuovi-allegato') {
|
||||
|
||||
// Gestione delle operazioni
|
||||
else {
|
||||
|
||||
//UPLOAD PER CKEDITOR
|
||||
if (filter('op') == 'aggiungi-allegato' && !empty($_FILES) && !empty($_FILES['upload']['name'])) {
|
||||
|
||||
$CKEditor = get('CKEditor');
|
||||
$funcNum = get('CKEditorFuncNum');
|
||||
|
||||
|
||||
$allowed_extension = array(
|
||||
"png","jpg","jpeg"
|
||||
);
|
||||
$allowed_extension = [
|
||||
'png', 'jpg', 'jpeg',
|
||||
];
|
||||
|
||||
//Maximum file limit (unit: byte)
|
||||
$max_size='2097152'; //2MB
|
||||
$max_size = '2097152'; //2MB
|
||||
|
||||
// Get image file extension
|
||||
$file_extension = pathinfo($_FILES["upload"]["name"], PATHINFO_EXTENSION);
|
||||
|
||||
if(in_array(strtolower($file_extension),$allowed_extension) && $_FILES["upload"]['size']<$max_size){
|
||||
$file_extension = pathinfo($_FILES['upload']['name'], PATHINFO_EXTENSION);
|
||||
|
||||
if (in_array(strtolower($file_extension), $allowed_extension) && $_FILES['upload']['size'] < $max_size) {
|
||||
$upload = Uploads::upload($_FILES['upload'], [
|
||||
'name' => filter('nome_allegato'),
|
||||
'category' => filter('categoria'),
|
||||
@ -82,12 +78,12 @@ if (filter('op') == 'aggiungi-allegato' || filter('op') == 'rimuovi-allegato') {
|
||||
]);
|
||||
|
||||
// Upload da form
|
||||
if (!empty($funcNum) ){
|
||||
if (!empty($funcNum)) {
|
||||
echo '
|
||||
<link rel="stylesheet" type="text/css" href="'.$baseurl.'/assets/dist/css/app.min.css" />
|
||||
<script src="'.$baseurl.'/assets/dist/js/app.min.js"></script>';
|
||||
}
|
||||
|
||||
|
||||
// Creazione file fisico
|
||||
if (!empty($upload)) {
|
||||
//flash()->info(tr('File caricato correttamente!'));
|
||||
@ -98,11 +94,11 @@ if (filter('op') == 'aggiungi-allegato' || filter('op') == 'rimuovi-allegato') {
|
||||
$response = [
|
||||
'fileName' => basename($upload->filepath),
|
||||
'uploaded' => 1,
|
||||
'url' => $upload->filepath
|
||||
'url' => $upload->filepath,
|
||||
];
|
||||
|
||||
// Upload da form
|
||||
if (!empty($funcNum) ){
|
||||
if (!empty($funcNum)) {
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
@ -111,26 +107,20 @@ if (filter('op') == 'aggiungi-allegato' || filter('op') == 'rimuovi-allegato') {
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
|
||||
// Copia-incolla
|
||||
else {
|
||||
echo json_encode($response);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
//flash()->error(tr('Errore durante il caricamento del file!'));
|
||||
echo '<script type="text/javascript"> window.parent.toastr.error("'.tr('Errore durante il caricamento del file!').'"); </script>';
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
} else {
|
||||
//flash()->error(tr('Estensione non permessa!'));
|
||||
echo '<script type="text/javascript"> window.parent.toastr.error("'.tr('Estensione non permessa').'"); </script>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
@ -184,7 +174,7 @@ elseif (filter('op') == 'download-allegato') {
|
||||
|
||||
// Zip allegati
|
||||
elseif (filter('op') == 'download-zip-allegati') {
|
||||
$rs = $dbo->fetchArray('SELECT * FROM zz_files WHERE id_module='.prepare($id_module).' AND id IN('.implode(',',json_decode(filter('id'))).')');
|
||||
$rs = $dbo->fetchArray('SELECT * FROM zz_files WHERE id_module='.prepare($id_module).' AND id IN('.implode(',', json_decode(filter('id'))).')');
|
||||
|
||||
$dir = base_dir().'/'.$module->upload_directory;
|
||||
directory($dir.'tmp/');
|
||||
@ -223,8 +213,8 @@ elseif (filter('op') == 'download-zip-allegati') {
|
||||
|
||||
// Modifica dati di un allegato
|
||||
elseif (filter('op') == 'modifica-allegato') {
|
||||
$id_allegati = explode(';',filter('id_allegati'));
|
||||
|
||||
$id_allegati = explode(';', filter('id_allegati'));
|
||||
|
||||
if (sizeof($id_allegati) == 1) {
|
||||
$upload = Upload::find($id_allegati[0]);
|
||||
$upload->name = post('nome_allegato');
|
||||
@ -477,7 +467,7 @@ HTMLBuilder\HTMLBuilder::setRecord($record);
|
||||
|
||||
if ($structure->permission == 'rw') {
|
||||
// Esecuzione delle operazioni di gruppo
|
||||
if (!empty(post('id_records'))){
|
||||
if (!empty(post('id_records'))) {
|
||||
$id_records = post('id_records');
|
||||
$id_records = is_array($id_records) ? $id_records : explode(';', $id_records);
|
||||
$id_records = array_clean($id_records);
|
||||
|
@ -80,7 +80,7 @@ if (!empty($query)) {
|
||||
$align = [];
|
||||
$row = isset($rows[0]) ? $rows[0] : [];
|
||||
foreach ($row as $field => $value) {
|
||||
if (!empty($value)){
|
||||
if (!empty($value)) {
|
||||
$value = trim($value);
|
||||
}
|
||||
|
||||
|
@ -65,4 +65,4 @@ if (json_last_error() == JSON_ERROR_NONE) {
|
||||
// Stampa dei risultati
|
||||
echo $response;
|
||||
|
||||
Auth::logout();
|
||||
Auth::logout();
|
||||
|
@ -27,7 +27,6 @@ $db_options = [
|
||||
//'sort_buffer_size' => '2M',
|
||||
];
|
||||
|
||||
|
||||
// Percorso della cartella di backup
|
||||
$backup_dir = __DIR__.'/backup/';
|
||||
|
||||
|
2
cron.php
2
cron.php
@ -68,7 +68,7 @@ $in_esecuzione = Cache::pool('Cron in esecuzione');
|
||||
$cron_id = Cache::pool('ID del cron');
|
||||
|
||||
$disattiva = Cache::pool('Disabilita cron');
|
||||
if ($disattiva->content || (in_array($_SERVER['HTTP_HOST'],['localhost', '127.0.0.1']) && !$forza_cron_localhost)) {
|
||||
if ($disattiva->content || (in_array($_SERVER['HTTP_HOST'], ['localhost', '127.0.0.1']) && !$forza_cron_localhost)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
10
editor.php
10
editor.php
@ -40,7 +40,7 @@ if (!empty($id_record)) {
|
||||
Util\Query::setSegments(true);
|
||||
}
|
||||
// Rimozione della condizione deleted_at IS NULL per visualizzare anche i record eliminati
|
||||
if (!empty($query)){
|
||||
if (!empty($query)) {
|
||||
if (preg_match('/[`]*([a-z0-9_]*)[`]*[\.]*([`]*deleted_at[`]* IS NULL)/i', $query, $m)) {
|
||||
$conditions_to_remove = [];
|
||||
|
||||
@ -170,12 +170,12 @@ if (empty($record) || !$has_access) {
|
||||
|
||||
{( "name": "button", "type": "email", "id_module": "'.$id_module.'", "id_plugin": "'.$id_plugin.'", "id_record": "'.$id_record.'" )}';
|
||||
|
||||
if (Modules::get('Account SMS')) {
|
||||
echo '
|
||||
if (Modules::get('Account SMS')) {
|
||||
echo '
|
||||
{( "name": "button", "type": "sms", "id_module": "'.$id_module.'", "id_plugin": "'.$id_plugin.'", "id_record": "'.$id_record.'" )}';
|
||||
}
|
||||
}
|
||||
|
||||
echo '
|
||||
echo '
|
||||
|
||||
<div class="btn-group" id="save-buttons">
|
||||
<a class="btn btn-success" id="'.(!empty($record['deleted_at']) ? 'restore' : 'save').'">
|
||||
|
@ -329,12 +329,12 @@ foreach ($righe as $i => $riga) {
|
||||
|
||||
echo ' '.nl2br($descrizione);
|
||||
|
||||
if( $riga->isArticolo() ){
|
||||
if ($riga->isArticolo()) {
|
||||
$dettaglio_fornitore = DettaglioFornitore::where('id_articolo', $riga->idarticolo)
|
||||
->where('id_fornitore', $documento->idanagrafica)
|
||||
->first();
|
||||
|
||||
if( !empty($dettaglio_fornitore->codice_fornitore) ){
|
||||
if (!empty($dettaglio_fornitore->codice_fornitore)) {
|
||||
echo '
|
||||
<br><small class="text-muted">'.tr('Codice fornitore ').': '.$dettaglio_fornitore->codice_fornitore.'</small>';
|
||||
}
|
||||
@ -352,7 +352,6 @@ foreach ($righe as $i => $riga) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
|
@ -36,7 +36,7 @@ echo '
|
||||
// Quantità
|
||||
echo '
|
||||
<div class="col-md-'.$width.'">
|
||||
{[ "type": "number", "label": "'.tr('Q.tà').'", "name": "qta", "required": 1, "value": "'.abs((float) $result['qta']).'", "decimals": "qta"'.(isset($result['max_qta']) ? ', "icon-after": "<span class=\"tip\" title=\"'.tr("L'elemento è collegato a un documento: la quantità massima ammessa è relativa allo stato di evasione dell'elemento nel documento di origine (quantità dell'elemento / quantità massima ammessa)").'\">/ '.numberFormat(abs((float) $result['max_qta']), 'qta').' <i class=\"fa fa-question-circle-o\"></i></span>"' : '').', "min-value": "'.abs((float) $result['qta_evasa']).'" ]}
|
||||
{[ "type": "number", "label": "'.tr('Q.tà').'", "name": "qta", "required": 1, "value": "'.abs((float) $result['qta']).'", "decimals": "qta"'.(isset($result['max_qta']) ? ', "icon-after": "<span class=\"tip\" title=\"'.tr("L'elemento è collegato a un documento: la quantità massima ammessa è relativa allo stato di evasione dell'elemento nel documento di origine (quantità dell'elemento / quantità massima ammessa)").'\">/ '.numberFormat(abs((float) $result['max_qta']), 'qta').' <i class=\"fa fa-question-circle-o\"></i></span>"' : '').', "min-value": "'.abs((float) $result['qta_evasa']).'" ]}
|
||||
</div>';
|
||||
|
||||
// Unità di misura
|
||||
@ -47,9 +47,9 @@ echo '
|
||||
|
||||
// Unità di misura
|
||||
if ($options['dir'] == 'uscita' && $articolo['fattore_um_secondaria']) {
|
||||
echo '
|
||||
echo '
|
||||
<div class="col-md-3">
|
||||
{[ "type": "number", "label": "'.tr('Q.tà secondaria').'", "name": "fattore_um_secondaria", "value": "'.abs((float)$articolo['fattore_um_secondaria'] * $result['qta']).'", "icon-after": "'.$articolo['um_secondaria'].'" ]}
|
||||
{[ "type": "number", "label": "'.tr('Q.tà secondaria').'", "name": "fattore_um_secondaria", "value": "'.abs((float) $articolo['fattore_um_secondaria'] * $result['qta']).'", "icon-after": "'.$articolo['um_secondaria'].'" ]}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@ -216,9 +216,9 @@ if ($options['dir'] == 'entrata') {
|
||||
<div class="row">
|
||||
<div class="col-md-4 margine"></div>
|
||||
<div class="col-md-4 prezzi"></div>';
|
||||
|
||||
// Provvigione
|
||||
echo '
|
||||
|
||||
// Provvigione
|
||||
echo '
|
||||
<div class="col-md-4">
|
||||
<div class="sconto"></div>
|
||||
{[ "type": "number", "label": "'.tr('Provvigione unitaria').'", "name": "provvigione", "value": "'.($result['provvigione_percentuale'] ?: ($result['provvigione_unitaria'] ?: $result['provvigione_default'])).'", "icon-after": "choice|untprc|'.($result['tipo_provvigione'] ?: $result['tipo_provvigione_default']).'", "help": "'.tr('Provvigione destinata all\'agente.').'", "min-value": "0" ]}
|
||||
@ -378,4 +378,4 @@ if (in_array($module['name'], ['Fatture di vendita', 'Fatture di acquisto'])) {
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
}
|
||||
}
|
||||
|
@ -179,19 +179,14 @@ if (post('db_host') !== null) {
|
||||
}
|
||||
// Continua con l'esecuzione delle operazioni previste
|
||||
else {
|
||||
|
||||
// Creazione manifest.json
|
||||
include_once App::filepath('include/init', 'manifest.php');
|
||||
redirect(base_path().'/index.php');
|
||||
exit();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Controlla che i parametri di configurazione permettano l'accesso al database
|
||||
if ((file_exists('config.inc.php') || $valid_config) && !$dbo->isConnected()) {
|
||||
echo '
|
||||
@ -200,7 +195,7 @@ if ((file_exists('config.inc.php') || $valid_config) && !$dbo->isConnected()) {
|
||||
<h3 class="box-title">'.tr('Impossibile connettersi al database').'</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<p>'.tr("Si è verificato un errore durante la connessione al database").'.</p>
|
||||
<p>'.tr('Si è verificato un errore durante la connessione al database').'.</p>
|
||||
<p>'.tr('Controllare di aver inserito correttamente i dati di accesso, e che il database atto ad ospitare i dati del gestionale sia esistente').'.</p>
|
||||
<a class="btn btn-info" href="'.base_path().'/index.php"><i class="fa fa-repeat"></i> '.tr('Riprova').'</a>
|
||||
</div>
|
||||
|
@ -20,15 +20,14 @@
|
||||
$creation = file_put_contents('manifest.json', '');
|
||||
|
||||
if (!$creation) {
|
||||
|
||||
$manifest = '{
|
||||
|
||||
"dir" : "ltr",
|
||||
"lang" : "'.((empty($lang) || $lang == '|lang|') ? 'it-IT' : str_replace('_','-',$lang)).'",
|
||||
"lang" : "'.((empty($lang) || $lang == '|lang|') ? 'it-IT' : str_replace('_', '-', $lang)).'",
|
||||
"name" : "'.tr('OpenSTAManager').'",
|
||||
"scope" : "'.((empty(base_path()) || base_path()=='/') ? '' : '.').'",
|
||||
"scope" : "'.((empty(base_path()) || base_path() == '/') ? '' : '.').'",
|
||||
"display" : "fullscreen",
|
||||
"start_url" : "'.((empty(base_path()) || base_path()=='/') ? '/' : './').'",
|
||||
"start_url" : "'.((empty(base_path()) || base_path() == '/') ? '/' : './').'",
|
||||
"short_name" : "OSM",
|
||||
"theme_color" : "transparent",
|
||||
"description" : "'.tr('OpenSTAManager').'",
|
||||
@ -44,11 +43,8 @@ if (!$creation) {
|
||||
]
|
||||
}';
|
||||
|
||||
|
||||
file_put_contents('manifest.json', $manifest);
|
||||
|
||||
}else{
|
||||
|
||||
} else {
|
||||
echo '
|
||||
<div class="box box-center box-danger box-solid text-center">
|
||||
<div class="box-header with-border">
|
||||
@ -61,5 +57,3 @@ if (!$creation) {
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,7 +45,6 @@ foreach ($modules as $name => $values) {
|
||||
|
||||
//PHP
|
||||
$settings = [
|
||||
|
||||
'php_version' => [
|
||||
'type' => 'version',
|
||||
'description' => '7.3.x - 8.0.x, consigliato almeno 7.4.x',
|
||||
@ -107,7 +106,7 @@ $settings = [
|
||||
'type' => 'value',
|
||||
'description' => 1,
|
||||
],
|
||||
|
||||
|
||||
'upload_max_filesize' => [
|
||||
'type' => 'value',
|
||||
'description' => '>32M',
|
||||
@ -122,7 +121,6 @@ $settings = [
|
||||
'type' => 'value',
|
||||
'description' => '>5000',
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
$php = [];
|
||||
@ -130,14 +128,12 @@ foreach ($settings as $name => $values) {
|
||||
$description = $values['description'];
|
||||
|
||||
if ($values['type'] == 'version') {
|
||||
|
||||
$description = tr('Valore consigliato: _VALUE_ (Valore attuale: _PHP_VERSION_)', [
|
||||
'_VALUE_' => $description,
|
||||
'_PHP_VERSION_' => phpversion(),
|
||||
]);
|
||||
|
||||
$status = ((version_compare(phpversion(), $values['minimum'], ">=") && version_compare(phpversion(), $values['maximum'], "<=")) ? 1 : 0);
|
||||
|
||||
$status = ((version_compare(phpversion(), $values['minimum'], '>=') && version_compare(phpversion(), $values['maximum'], '<=')) ? 1 : 0);
|
||||
} elseif ($values['type'] == 'ext') {
|
||||
$status = extension_loaded($name);
|
||||
} else {
|
||||
@ -166,12 +162,12 @@ foreach ($settings as $name => $values) {
|
||||
|
||||
$type = ($values['type'] == 'ext') ? tr('Estensione') : tr('Impostazione');
|
||||
|
||||
if ($values['type'] == 'ext'){
|
||||
$type = tr('Estensione');
|
||||
}elseif ($values['type'] == 'version') {
|
||||
$type = tr('Versione');
|
||||
}else{
|
||||
$type = tr('Impostazione');
|
||||
if ($values['type'] == 'ext') {
|
||||
$type = tr('Estensione');
|
||||
} elseif ($values['type'] == 'version') {
|
||||
$type = tr('Versione');
|
||||
} else {
|
||||
$type = tr('Impostazione');
|
||||
}
|
||||
|
||||
$php[] = [
|
||||
@ -183,26 +179,23 @@ foreach ($settings as $name => $values) {
|
||||
}
|
||||
|
||||
// MySQL
|
||||
if ($database->isInstalled()){
|
||||
if ($database->isInstalled()) {
|
||||
$db = [
|
||||
|
||||
'mysql_version' => [
|
||||
'type' => 'version',
|
||||
'description' => '5.7.x - 8.0.x',
|
||||
'minimum' => '5.7.0',
|
||||
'maximum' => '8.0.99',
|
||||
],
|
||||
|
||||
|
||||
'sort_buffer_size' => [
|
||||
'type' => 'value',
|
||||
'description' => '>2M',
|
||||
],
|
||||
|
||||
|
||||
];
|
||||
|
||||
/*foreach (App::getConfig()['db_options'] as $n => $v){
|
||||
|
||||
|
||||
switch ($n){
|
||||
case 'sort_buffer_size':
|
||||
$db[$n] = [
|
||||
@ -211,40 +204,36 @@ if ($database->isInstalled()){
|
||||
];
|
||||
break;
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
}*/
|
||||
}
|
||||
|
||||
foreach ($db as $name => $values) {
|
||||
|
||||
$description = $values['description'];
|
||||
|
||||
if ($values['type'] == 'version') {
|
||||
|
||||
$type = tr('Versione');
|
||||
$type = tr('Versione');
|
||||
$description = tr('Valore consigliato: _VALUE_ (Valore attuale: _MYSQL_VERSION_)', [
|
||||
'_VALUE_' => $description,
|
||||
'_MYSQL_VERSION_' => $database->getMySQLVersion(),
|
||||
]);
|
||||
|
||||
$status = ((version_compare($database->getMySQLVersion(), $values['minimum'], ">=") && version_compare($database->getMySQLVersion(), $values['maximum'], "<=")) ? 1 : 0);
|
||||
$status = ((version_compare($database->getMySQLVersion(), $values['minimum'], '>=') && version_compare($database->getMySQLVersion(), $values['maximum'], '<=')) ? 1 : 0);
|
||||
} else {
|
||||
$type = tr('Impostazione');
|
||||
|
||||
} else{
|
||||
$type = tr('Impostazione');
|
||||
|
||||
//Vedo se riesco a recuperare l'impostazione dalle variabili di sessione o globali di mysql
|
||||
$rs_session_variabile = $dbo->fetchArray('SHOW SESSION VARIABLES LIKE '.prepare($name));
|
||||
$rs_global_variabile = $dbo->fetchArray('SHOW GLOBAL VARIABLES LIKE '.prepare($name));
|
||||
|
||||
if (!empty($rs_session_variabile[0]['Value']))
|
||||
if (!empty($rs_session_variabile[0]['Value'])) {
|
||||
$inc = $rs_session_variabile[0]['Value'];
|
||||
else if (!empty($rs_global_variabile[0]['Value']))
|
||||
} elseif (!empty($rs_global_variabile[0]['Value'])) {
|
||||
$inc = $rs_global_variabile[0]['Value'];
|
||||
else
|
||||
} else {
|
||||
$inc = str_replace(['k', 'M'], ['000', '000000'], App::getConfig()['db_options'][$name]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
$real = str_replace(['k', 'M'], ['000', '000000'], $description);
|
||||
|
||||
if (string_starts_with($real, '>')) {
|
||||
@ -261,12 +250,10 @@ foreach ($db as $name => $values) {
|
||||
$description = str_replace(['>', '<'], '', $description);
|
||||
}
|
||||
|
||||
|
||||
$description = tr('Valore consigliato: _VALUE_ (Valore attuale: _INC_)', [
|
||||
'_VALUE_' => $description,
|
||||
'_INC_' => \Util\FileSystem::formatBytes($inc),
|
||||
'_INC_' => \Util\FileSystem::formatBytes($inc),
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
$mysql[] = [
|
||||
@ -277,7 +264,6 @@ foreach ($db as $name => $values) {
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
// Percorsi di servizio
|
||||
$dirs_to_check = [
|
||||
'backup' => tr('Necessario per il salvataggio dei backup'),
|
||||
@ -298,7 +284,6 @@ foreach ($dirs_to_check as $name => $description) {
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
// File di servizio
|
||||
$files_to_check = [
|
||||
'manifest.json' => tr('Necessario per l\'aggiunta a schermata home da terminale (creato al termine della configurazione)'),
|
||||
@ -319,7 +304,6 @@ foreach ($files_to_check as $name => $description) {
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
// Configurazioni OSM
|
||||
$config_to_check = [
|
||||
'lang' => [
|
||||
@ -349,42 +333,36 @@ $config_to_check = [
|
||||
'value_to_check' => '|time|',
|
||||
'suggested_value' => 'H:i',
|
||||
'section' => 'formatter',
|
||||
]
|
||||
|
||||
],
|
||||
];
|
||||
|
||||
$config = [];
|
||||
|
||||
foreach ($config_to_check as $name => $values) {
|
||||
|
||||
foreach ($config_to_check as $name => $values) {
|
||||
$type = $values['type'];
|
||||
|
||||
|
||||
if ($type == 'value') {
|
||||
$description = tr('Valore consigliato: _SUGGESTED_ (Valore attuale: _ACTUAL_)', [
|
||||
'_SUGGESTED_' => $values['suggested_value'],
|
||||
'_ACTUAL_' => (!empty($values['section'])? ${$values['section']}[$name] : $$name),
|
||||
'_ACTUAL_' => (!empty($values['section']) ? ${$values['section']}[$name] : $$name),
|
||||
]);
|
||||
}
|
||||
|
||||
$status = ($values['operator']((!empty($values['section']) ? ${$values['section']}[$name] : $$name), $values['value_to_check']) ? 1 : 0);
|
||||
|
||||
|
||||
$config[] = [
|
||||
'name' => $name,
|
||||
'description' => $description,
|
||||
'status' => $status,
|
||||
'type' => tr('Configurazione'),
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
$requirements = [
|
||||
tr('Apache') => $apache,
|
||||
tr('PHP (_VERSION_ _SUPPORTED_)', [
|
||||
'_VERSION_' => phpversion(),
|
||||
'_SUPPORTED_' => ( ( version_compare(phpversion(), $settings['php_version']['minimum'], ">=") && version_compare(phpversion(), $settings['php_version']['maximum'], "<=") ) ? '' : '<small><small class="label label-danger" ><i class="fa fa-warning"></i> '.tr('versioni supportate:').' '.$settings['php_version']['description'].'</small></small>')
|
||||
'_SUPPORTED_' => ((version_compare(phpversion(), $settings['php_version']['minimum'], '>=') && version_compare(phpversion(), $settings['php_version']['maximum'], '<=')) ? '' : '<small><small class="label label-danger" ><i class="fa fa-warning"></i> '.tr('versioni supportate:').' '.$settings['php_version']['description'].'</small></small>'),
|
||||
]) => $php,
|
||||
tr('MySQL') => $mysql,
|
||||
tr('Percorsi di servizio') => $directories,
|
||||
@ -392,11 +370,10 @@ $requirements = [
|
||||
tr('Configurazioni') => $config,
|
||||
];
|
||||
|
||||
if (!$database->isInstalled() || empty($mysql)){
|
||||
if (!$database->isInstalled() || empty($mysql)) {
|
||||
unset($requirements['MySQL']);
|
||||
}
|
||||
|
||||
|
||||
// Tabelle di riepilogo
|
||||
foreach ($requirements as $key => $values) {
|
||||
$statuses = array_column($values, 'status');
|
||||
|
@ -123,7 +123,7 @@ if (filter('action') == 'do_update') {
|
||||
<h3 class="box-title">'.tr('Aggiornamento in corso!').'</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<p>'.tr("Il software si trova attualmente nella fase di aggiornamento, potrebbero volerci fino a 10 minuti, siete pregati di attendere sino alla sua conclusione").'.</p>
|
||||
<p>'.tr('Il software si trova attualmente nella fase di aggiornamento, potrebbero volerci fino a 10 minuti, siete pregati di attendere sino alla sua conclusione').'.</p>
|
||||
<p>'.tr("In caso di problemi rivolgersi all'amministratore di sistema o all'assistenza del gestionale").'.</p>
|
||||
<a class="btn btn-info" href="'.base_path().'/index.php"><i class="fa fa-repeat"></i> '.tr('Riprova').'</a>
|
||||
</div>
|
||||
|
@ -19,12 +19,12 @@
|
||||
|
||||
use Models\Upload;
|
||||
|
||||
$id_allegati = (array)json_decode(filter('id_allegati'));
|
||||
$id_allegati = (array) json_decode(filter('id_allegati'));
|
||||
|
||||
// Form di inserimento riga documento
|
||||
echo '
|
||||
<form action="" method="post" id="modifica-allegato">
|
||||
<input type="hidden" name="id_allegati" value="'.implode(';',$id_allegati).'">
|
||||
<input type="hidden" name="id_allegati" value="'.implode(';', $id_allegati).'">
|
||||
<input type="hidden" name="backto" value="record-edit">
|
||||
<input type="hidden" name="op" value="modifica-allegato">
|
||||
|
||||
|
@ -26,7 +26,7 @@ $user = Auth::user();
|
||||
|
||||
$pageTitle = !empty($pageTitle) ? $pageTitle : $structure->title;
|
||||
|
||||
$lang = (empty($lang) || $lang == '|lang|' ) ? 'it_IT' : $lang;
|
||||
$lang = (empty($lang) || $lang == '|lang|') ? 'it_IT' : $lang;
|
||||
|
||||
$messages = flash()->getMessages();
|
||||
|
||||
@ -406,8 +406,8 @@ if (Auth::check()) {
|
||||
<p style="padding:10px 15px;"> </p>
|
||||
</li>';
|
||||
|
||||
if ($user->gruppo == 'Amministratori') {
|
||||
echo '
|
||||
if ($user->gruppo == 'Amministratori') {
|
||||
echo '
|
||||
<li class="dropdown notifications-menu nav-button">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-bell-o"></i>
|
||||
@ -433,9 +433,9 @@ if (Auth::check()) {
|
||||
<li class="nav-button"><a href="'.base_path().'/log.php" class="tip nav-button" title="'.tr('Log accessi').'">
|
||||
<i class="fa fa-book"></i>
|
||||
</a></li>';
|
||||
}
|
||||
}
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<li class="nav-button"><a data-href="'.base_path().'/shortcuts.php" data-title="'.tr('Scorciatoie da tastiera').'" class="tip nav-button" title="'.tr('Scorciatoie').'">
|
||||
<i class="fa fa-keyboard-o"></i>
|
||||
</a></li>
|
||||
@ -518,18 +518,16 @@ if (Auth::check()) {
|
||||
if (!empty($id_record)) {
|
||||
$plugins = $dbo->fetchArray('SELECT id, title, options, options2 FROM zz_plugins WHERE idmodule_to='.prepare($id_module)." AND position='tab' AND enabled = 1 ORDER BY zz_plugins.order DESC");
|
||||
foreach ($plugins as $plugin) {
|
||||
|
||||
|
||||
//Badge count per record plugin
|
||||
$count = 0;
|
||||
$opt = '';
|
||||
if (!empty($plugin['options2'])){
|
||||
if (!empty($plugin['options2'])) {
|
||||
$opt = json_decode($plugin['options2'], true);
|
||||
}else if (!empty($plugin['options'])){
|
||||
} elseif (!empty($plugin['options'])) {
|
||||
$opt = json_decode($plugin['options'], true);
|
||||
}
|
||||
|
||||
if (!empty($opt)){
|
||||
if (!empty($opt)) {
|
||||
$q = str_replace('|id_parent|', $id_record, $opt['main_query'][0]['query']);
|
||||
$count = $dbo->fetchNum($q);
|
||||
}
|
||||
@ -538,7 +536,7 @@ if (Auth::check()) {
|
||||
<li data-toggle="control-sidebar" class="btn-default" >
|
||||
<a data-toggle="tab" href="#tab_'.$plugin['id'].'" id="link-tab_'.$plugin['id'].'">
|
||||
'.$plugin['title'].'
|
||||
<span class="badge pull-right">'.($count>0 ? $count: '').'</span>
|
||||
<span class="badge pull-right">'.($count > 0 ? $count : '').'</span>
|
||||
</a>
|
||||
</li>';
|
||||
}
|
||||
@ -557,7 +555,6 @@ if (Auth::check()) {
|
||||
</li>';
|
||||
}
|
||||
|
||||
|
||||
// Tab per le checklist
|
||||
if ($structure->permission != '-' && $structure->use_checklists) {
|
||||
$checklists_unchecked = $structure->recordChecks($id_record)->where('checked_at', null);
|
||||
@ -567,7 +564,7 @@ if (Auth::check()) {
|
||||
<li data-toggle="control-sidebar" class="btn-default">
|
||||
<a class="bg-info" data-toggle="tab" href="#tab_checks" id="link-tab_checks">
|
||||
'.tr('Checklist').'
|
||||
'.(($checklists_total->count() > 0) ?
|
||||
'.(($checklists_total->count() > 0) ?
|
||||
'<span class="badge pull-right">'.$checklists_unchecked->count().tr(' / ').($checklists_total->count()).'</span>' : '').'
|
||||
</a>
|
||||
</li>';
|
||||
@ -680,6 +677,6 @@ if ($free_space < ($space_limit * (1024 ** 3))) {
|
||||
'_TOT_' => FileSystem::formatBytes($free_space),
|
||||
]).'.</p>
|
||||
<p>'.tr('Questo può risultare un serio problema per la continuità di funzionamento del software, poiché le operazioni più espansive che richiedono spazio di archiviazione possono causare malfunzionamenti imprevisti').'. '.tr('Ad esempio, le attività di backup, caricamento di allegati o anche l\'utilizzo normale del gestionale potrebbero rendere i dati inaffidabili, provocando pertanto una perdita delle informazioni salvate').'.</p>
|
||||
<p>'.tr("Contatta gli amministratori di sistema per risolvere al più presto il problema").'.</p>
|
||||
<p>'.tr('Contatta gli amministratori di sistema per risolvere al più presto il problema').'.</p>
|
||||
</div>';
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ switch ($op) {
|
||||
Auth::logout();
|
||||
|
||||
redirect(base_path().'/index.php');
|
||||
exit();
|
||||
exit();
|
||||
}
|
||||
|
||||
if (Auth::check() && isset($dbo) && $dbo->isConnected() && $dbo->isInstalled()) {
|
||||
|
@ -245,4 +245,3 @@ function getSegmentPredefined($id_module)
|
||||
|
||||
return $id_segment;
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,8 @@ function copyr($source, $destination, $ignores = [])
|
||||
|
||||
try {
|
||||
$fs->chmod($destination, 0777, 0000, true);
|
||||
} catch (IOException $e) {}
|
||||
} catch (IOException $e) {
|
||||
}
|
||||
|
||||
foreach ($files as $file) {
|
||||
$filename = rtrim($destination, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$file->getRelativePathname();
|
||||
|
@ -274,7 +274,7 @@ function currency()
|
||||
*/
|
||||
function moneyFormat($number, $decimals = null)
|
||||
{
|
||||
if (setting('Posizione del simbolo valuta') == 'Prima'){
|
||||
if (setting('Posizione del simbolo valuta') == 'Prima') {
|
||||
return tr('_CURRENCY_ _TOTAL_', [
|
||||
'_CURRENCY_' => currency(),
|
||||
'_TOTAL_' => numberFormat($number, $decimals),
|
||||
|
10
lib/util.php
10
lib/util.php
@ -29,8 +29,8 @@ if (!function_exists('array_column')) {
|
||||
/**
|
||||
* Pluck an array of values from an array.
|
||||
*
|
||||
* @param $array - data
|
||||
* @param $key - value you want to pluck from array
|
||||
* @param $array - data
|
||||
* @param $key - value you want to pluck from array
|
||||
*
|
||||
* @since 2.3
|
||||
*
|
||||
@ -48,7 +48,7 @@ if (!function_exists('array_clean')) {
|
||||
/**
|
||||
* Pulisce i contenuti vuoti di un array.
|
||||
*
|
||||
* @param $array
|
||||
* @param $array
|
||||
*
|
||||
* @since 2.3.2
|
||||
*
|
||||
@ -56,7 +56,7 @@ if (!function_exists('array_clean')) {
|
||||
*/
|
||||
function array_clean($array)
|
||||
{
|
||||
if (!empty($array)){
|
||||
if (!empty($array)) {
|
||||
return array_unique(array_values(array_filter($array, function ($value) {
|
||||
return !empty($value);
|
||||
})));
|
||||
@ -68,7 +68,7 @@ if (!function_exists('array_deep_clean')) {
|
||||
/**
|
||||
* Pulisce i contenuti vuoti di un array.
|
||||
*
|
||||
* @param $array
|
||||
* @param $array
|
||||
*
|
||||
* @since 2.4.11
|
||||
*
|
||||
|
11
mail.php
11
mail.php
@ -35,7 +35,7 @@ $subject = $module->replacePlaceholders($id_record, $template['subject'], $place
|
||||
$emails = [];
|
||||
if ($module->replacePlaceholders($id_record, '{email}')) {
|
||||
$emails = explode(';', $module->replacePlaceholders($id_record, '{email}', $placeholder_options));
|
||||
}
|
||||
}
|
||||
|
||||
$id_anagrafica = $module->replacePlaceholders($id_record, '{id_anagrafica}', $placeholder_options);
|
||||
|
||||
@ -50,15 +50,14 @@ foreach ($mansioni as $mansione) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Aggiungo email tecnici assegnati quando sono sul template Notifica intervento
|
||||
if ($template->name == 'Notifica intervento'){
|
||||
if ($template->name == 'Notifica intervento') {
|
||||
$tecnici = $dbo->select('in_interventi_tecnici_assegnati', 'id_tecnico', ['id_intervento' => $id_record]);
|
||||
foreach ($tecnici as $tecnico) {
|
||||
$anagrafica = $dbo->table('an_anagrafiche')->where('idanagrafica', $tecnico['id_tecnico'])->where('email', '!=', '')->first();
|
||||
if (!in_array($anagrafica->email, $emails)) {
|
||||
$emails[] = $anagrafica->email;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,8 +179,8 @@ echo '
|
||||
'id' => 'body_'.rand(0, 999),
|
||||
'value' => $body,
|
||||
]);
|
||||
|
||||
echo'
|
||||
|
||||
echo '
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
|
@ -21,11 +21,11 @@ include_once __DIR__.'/../../core.php';
|
||||
|
||||
use Models\Cache;
|
||||
use Modules\Aggiornamenti\Controlli\ColonneDuplicateViste;
|
||||
use Modules\Aggiornamenti\Controlli\ReaValidi;
|
||||
use Modules\Aggiornamenti\Controlli\PluginDuplicati;
|
||||
use Modules\Aggiornamenti\Controlli\Controllo;
|
||||
use Modules\Aggiornamenti\Controlli\DatiFattureElettroniche;
|
||||
use Modules\Aggiornamenti\Controlli\PianoConti;
|
||||
use Modules\Aggiornamenti\Controlli\PluginDuplicati;
|
||||
use Modules\Aggiornamenti\Controlli\ReaValidi;
|
||||
use Modules\Aggiornamenti\UpdateHook;
|
||||
|
||||
$id = post('id');
|
||||
@ -46,9 +46,9 @@ switch (filter('op')) {
|
||||
break;
|
||||
|
||||
case 'upload':
|
||||
if (setting('Attiva aggiornamenti')){
|
||||
if (setting('Attiva aggiornamenti')) {
|
||||
include base_dir().'/modules/aggiornamenti/upload_modules.php';
|
||||
}else{
|
||||
} else {
|
||||
flash()->error(tr('Non è permesso il caricamento di aggiornamenti o moduli!'));
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ $(document).ready(function () {
|
||||
$mysql_min_version = '5.7.0';
|
||||
$mysql_max_version = '5.7.99';
|
||||
|
||||
$contents = ((version_compare($database->getMySQLVersion(), $mysql_min_version, ">=") && version_compare($database->getMySQLVersion(), $mysql_max_version, "<=")) ? $file_to_check_database = 'database_5_7.json' : $file_to_check_database = 'database.json' );
|
||||
$contents = ((version_compare($database->getMySQLVersion(), $mysql_min_version, '>=') && version_compare($database->getMySQLVersion(), $mysql_max_version, '<=')) ? $file_to_check_database = 'database_5_7.json' : $file_to_check_database = 'database.json');
|
||||
$contents = file_get_contents(base_dir().'/'.$file_to_check_database);
|
||||
$data = json_decode($contents, true);
|
||||
|
||||
|
@ -185,8 +185,7 @@ function search(button) {
|
||||
|
||||
<div class="row">';
|
||||
|
||||
|
||||
echo'
|
||||
echo '
|
||||
<div class="col-md-4">
|
||||
<div class="box box-success">
|
||||
<div class="box-header with-border">
|
||||
@ -198,13 +197,13 @@ echo'
|
||||
<form action="'.base_path().'/controller.php?id_module='.$id_module.'" method="post" enctype="multipart/form-data" id="update">
|
||||
<input type="hidden" name="op" value="upload">
|
||||
|
||||
{[ "type": "file", "name": "blob", "required": 1, "accept": ".zip", "disabled": '.(setting('Attiva aggiornamenti')? 0 : 1).' ]}
|
||||
{[ "type": "file", "name": "blob", "required": 1, "accept": ".zip", "disabled": '.(setting('Attiva aggiornamenti') ? 0 : 1).' ]}
|
||||
|
||||
';
|
||||
|
||||
if (!empty($custom) || !empty($tables)) {
|
||||
$disabled = 'disabled';
|
||||
echo ' <input type="checkbox" id="aggiorna_custom" class="pull-left" style="margin-top:10px;" value="1" >
|
||||
$disabled = 'disabled';
|
||||
echo ' <input type="checkbox" id="aggiorna_custom" class="pull-left" style="margin-top:10px;" value="1" >
|
||||
<label for="aggiorna_custom" style="margin-top:7px;" >'.tr("Desidero comunque procedere all'aggiornamento").'.</label>
|
||||
<script>
|
||||
$("#aggiorna_custom").change(function() {
|
||||
@ -228,7 +227,6 @@ echo '
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
|
||||
echo '
|
||||
<div class="col-md-4">
|
||||
<div class="box box-warning">
|
||||
|
@ -67,7 +67,6 @@ class ReaValidi extends Controllo
|
||||
GROUP BY an_anagrafiche.idanagrafica');
|
||||
|
||||
foreach ($anagrafiche_interessate as $anagrafica) {
|
||||
|
||||
/*$tipi = explode(',', $anagrafica['tipi_anagrafica']);
|
||||
$cliente = in_array('Cliente', $tipi) && empty($anagrafica['idconto_cliente']);
|
||||
$fornitore = in_array('Fornitore', $tipi) && empty($anagrafica['idconto_fornitore']);*/
|
||||
@ -79,7 +78,6 @@ class ReaValidi extends Controllo
|
||||
'_REA_' => $anagrafica['codicerea'],
|
||||
]),
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +86,7 @@ class ReaValidi extends Controllo
|
||||
$anagrafica = Anagrafica::find($record['id']);
|
||||
$anagrafica->codicerea = null;
|
||||
$anagrafica->save();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ switch ($resource) {
|
||||
foreach ($rs as $r) {
|
||||
$results[] = [
|
||||
'value' => $r['email'],
|
||||
'label' => $r['ragione_sociale'].($r['sede']!=''?' ('.$r['sede'].')':'').' <'.$r['email'].'>',
|
||||
'label' => $r['ragione_sociale'].($r['sede'] != '' ? ' ('.$r['sede'].')' : '').' <'.$r['email'].'>',
|
||||
];
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ switch ($resource) {
|
||||
}
|
||||
|
||||
// Tutti gli agenti del cliente
|
||||
$q = "SELECT DISTINCT(email), ragione_sociale, idanagrafica FROM an_anagrafiche WHERE email != '' AND (idanagrafica=(SELECT idagente FROM an_anagrafiche AS agenti WHERE 1=1 ".$where.") OR idanagrafica IN (SELECT idagente FROM an_anagrafiche_agenti WHERE 1=1 ".$where."))";
|
||||
$q = "SELECT DISTINCT(email), ragione_sociale, idanagrafica FROM an_anagrafiche WHERE email != '' AND (idanagrafica=(SELECT idagente FROM an_anagrafiche AS agenti WHERE 1=1 ".$where.') OR idanagrafica IN (SELECT idagente FROM an_anagrafiche_agenti WHERE 1=1 '.$where.'))';
|
||||
|
||||
$rs = $dbo->fetchArray($q);
|
||||
foreach ($rs as $r) {
|
||||
|
@ -17,8 +17,6 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
include_once __DIR__.'/../../../core.php';
|
||||
|
||||
$filter_agente = Auth::user()['gruppo'] == 'Agenti';
|
||||
@ -59,10 +57,10 @@ switch ($resource) {
|
||||
ON an_anagrafiche.idpagamento_vendite=co_pagamenti.id
|
||||
LEFT JOIN
|
||||
co_banche banca_vendite
|
||||
ON co_pagamenti.idconto_vendite = banca_vendite.id_pianodeiconti3 AND banca_vendite.id_anagrafica = ".prepare($id_azienda)." AND banca_vendite.deleted_at IS NULL AND banca_vendite.predefined = 1
|
||||
ON co_pagamenti.idconto_vendite = banca_vendite.id_pianodeiconti3 AND banca_vendite.id_anagrafica = ".prepare($id_azienda).' AND banca_vendite.deleted_at IS NULL AND banca_vendite.predefined = 1
|
||||
|where|
|
||||
ORDER BY
|
||||
ragione_sociale";
|
||||
ragione_sociale';
|
||||
|
||||
foreach ($elements as $element) {
|
||||
$filter[] = 'an_anagrafiche.idanagrafica='.prepare($element);
|
||||
@ -77,8 +75,6 @@ switch ($resource) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!empty($search)) {
|
||||
$search_fields[] = 'ragione_sociale LIKE '.prepare('%'.$search.'%');
|
||||
$search_fields[] = 'citta LIKE '.prepare('%'.$search.'%');
|
||||
@ -92,12 +88,10 @@ switch ($resource) {
|
||||
$rs = $data['results'];
|
||||
|
||||
foreach ($rs as $k => $r) {
|
||||
|
||||
$rs[$k] = array_merge($r, [
|
||||
'text' => $r['descrizione'],
|
||||
'disabled' => $r['is_bloccata'],
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
$results = [
|
||||
@ -110,7 +104,7 @@ switch ($resource) {
|
||||
case 'fornitori':
|
||||
$id_azienda = setting('Azienda predefinita');
|
||||
|
||||
$query = "SELECT an_anagrafiche.idanagrafica AS id, CONCAT(ragione_sociale, IF(citta IS NULL OR citta = '', '', CONCAT(' (', citta, ')')), IF(an_anagrafiche.deleted_at IS NULL, '', ' (".tr('eliminata').")'),' - ', an_anagrafiche.codice) AS descrizione, idtipointervento_default AS idtipointervento, co_pagamenti.id AS id_pagamento, co_pagamenti.descrizione AS desc_pagamento, banca_acquisti.id AS id_banca_acquisti, CONCAT(banca_acquisti.nome, ' - ', banca_acquisti.iban) AS descrizione_banca_acquisti FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica LEFT JOIN co_pagamenti ON an_anagrafiche.idpagamento_acquisti=co_pagamenti.id LEFT JOIN co_banche banca_acquisti ON co_pagamenti.idconto_acquisti = banca_acquisti.id_pianodeiconti3 AND banca_acquisti.id_anagrafica = ".prepare($id_azienda)." AND banca_acquisti.deleted_at IS NULL AND banca_acquisti.predefined = 1 |where| ORDER BY ragione_sociale";
|
||||
$query = "SELECT an_anagrafiche.idanagrafica AS id, CONCAT(ragione_sociale, IF(citta IS NULL OR citta = '', '', CONCAT(' (', citta, ')')), IF(an_anagrafiche.deleted_at IS NULL, '', ' (".tr('eliminata').")'),' - ', an_anagrafiche.codice) AS descrizione, idtipointervento_default AS idtipointervento, co_pagamenti.id AS id_pagamento, co_pagamenti.descrizione AS desc_pagamento, banca_acquisti.id AS id_banca_acquisti, CONCAT(banca_acquisti.nome, ' - ', banca_acquisti.iban) AS descrizione_banca_acquisti FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica LEFT JOIN co_pagamenti ON an_anagrafiche.idpagamento_acquisti=co_pagamenti.id LEFT JOIN co_banche banca_acquisti ON co_pagamenti.idconto_acquisti = banca_acquisti.id_pianodeiconti3 AND banca_acquisti.id_anagrafica = ".prepare($id_azienda).' AND banca_acquisti.deleted_at IS NULL AND banca_acquisti.predefined = 1 |where| ORDER BY ragione_sociale';
|
||||
|
||||
foreach ($elements as $element) {
|
||||
$filter[] = 'an_anagrafiche.idanagrafica='.prepare($element);
|
||||
@ -447,7 +441,6 @@ switch ($resource) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'relazioni':
|
||||
$query = "SELECT id, CONCAT(descrizione, IF(an_relazioni.deleted_at IS NULL, '', ' (".tr('eliminata').")')) AS descrizione, colore AS _bgcolor_ FROM an_relazioni |where| ORDER BY descrizione";
|
||||
@ -465,7 +458,7 @@ switch ($resource) {
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 'provenienze':
|
||||
$query = 'SELECT id, descrizione, colore AS bgcolor FROM an_provenienze |where| ORDER BY descrizione';
|
||||
|
||||
@ -479,7 +472,6 @@ switch ($resource) {
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 'settori':
|
||||
$query = 'SELECT id, descrizione FROM an_settori |where| ORDER BY descrizione';
|
||||
|
||||
@ -497,20 +489,16 @@ switch ($resource) {
|
||||
* Opzioni utilizzate:
|
||||
* - idanagrafica
|
||||
*/
|
||||
|
||||
case 'dichiarazioni_intento':
|
||||
|
||||
case 'dichiarazioni_intento':
|
||||
if (isset($superselect['idanagrafica']) && isset($superselect['data'])) {
|
||||
//$query = "SELECT id, CONCAT('N. prot. ', numero_protocollo, ' (periodo dal ', DATE_FORMAT(data_inizio, '%d/%m/%Y'), ' al ' ,DATE_FORMAT(data_fine, '%d/%m/%Y'),') (utilizzati ',REPLACE(REPLACE(REPLACE(FORMAT(SUM(totale),2), ',', '#'), '.', ','), '#', '.'), ' su ' , REPLACE(REPLACE(REPLACE(FORMAT(SUM(massimale),2), ',', '#'), '.', ','), '#', '.'), ' €)' ) AS descrizione, data_inizio, data_fine FROM co_dichiarazioni_intento |where| ORDER BY `data`, `id`";
|
||||
|
||||
$query = "SELECT id, numero_protocollo, data_inizio, data_fine, massimale, totale FROM co_dichiarazioni_intento |where| ORDER BY data";
|
||||
|
||||
|
||||
$query = 'SELECT id, numero_protocollo, data_inizio, data_fine, massimale, totale FROM co_dichiarazioni_intento |where| ORDER BY data';
|
||||
|
||||
foreach ($elements as $element) {
|
||||
$filter[] = 'id='.prepare($element);
|
||||
}
|
||||
|
||||
|
||||
//$where[] = '( '.prepare($superselect['data']).' BETWEEN data_inizio AND data_fine)';
|
||||
|
||||
@ -531,9 +519,8 @@ switch ($resource) {
|
||||
$data = AJAX::selectResults($query, $where, $filter, $search_fields, $limit, $custom);
|
||||
$rs = $data['results'];
|
||||
|
||||
foreach ($rs as $k => $r) {
|
||||
|
||||
$currentDate = date('Y-m-d', strtotime($superselect['data']));
|
||||
foreach ($rs as $k => $r) {
|
||||
$currentDate = date('Y-m-d', strtotime($superselect['data']));
|
||||
$startDate = date('Y-m-d', strtotime($r['data_inizio']));
|
||||
$endDate = date('Y-m-d', strtotime($r['data_fine']));
|
||||
|
||||
|
@ -87,7 +87,6 @@ switch (post('op')) {
|
||||
$anagrafica->idrelazione = $idrelazione;
|
||||
|
||||
$anagrafica->save();
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -74,10 +74,10 @@ if (in_array($id_cliente, $tipi_anagrafica) or in_array($id_fornitore, $tipi_ana
|
||||
echo '
|
||||
</ul>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($id_agente, $tipi_anagrafica)) {
|
||||
//Aggiunta liquidazione provvigioni per agente
|
||||
echo'
|
||||
echo '
|
||||
<button type="button" class="btn btn-primary" data-title="'.tr('Liquida Provvigioni').'" data-href="'.base_path().'/modules/anagrafiche/liquida_provvigioni.php?nome_stampa=Provvigioni&id_record='.$id_record.'" ><i class="fa fa-print"></i>'.tr(' Liquida Provvigioni').'</button>';
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ echo '
|
||||
<h3 class="panel-title"> '.tr('Geolocalizzazione').'</h3>
|
||||
</div>
|
||||
<div class="panel-body">';
|
||||
|
||||
|
||||
// Area caricamento mappa
|
||||
echo '
|
||||
<div id="map-edit" style="width: 100%;"></div>
|
||||
@ -261,42 +261,37 @@ echo '
|
||||
<br>';
|
||||
|
||||
if (!empty($sede_cliente->gaddress) || (!empty($sede_cliente->lat) && !empty($sede_cliente->lng))) {
|
||||
|
||||
// Modifica manuale delle informazioni
|
||||
echo '
|
||||
<a class="btn btn-info btn-block" onclick="modificaPosizione()">
|
||||
<i class="fa fa-map"></i> ' . tr('Aggiorna posizione') . '
|
||||
<i class="fa fa-map"></i> '.tr('Aggiorna posizione').'
|
||||
</a>';
|
||||
} else {
|
||||
|
||||
// Definizione manuale delle informazioni
|
||||
echo '
|
||||
<a class="btn btn-primary btn-block" onclick="modificaPosizione()">
|
||||
<i class="fa fa-map"></i> ' . tr('Definisci posizione') . '
|
||||
<i class="fa fa-map"></i> '.tr('Definisci posizione').'
|
||||
</a>';
|
||||
}
|
||||
|
||||
// Navigazione diretta verso l'indirizzo
|
||||
echo '
|
||||
<a class="btn btn-info btn-block '.((empty($sede_cliente->lat) && empty($sede_cliente->lng))? "disabled" : "").'" onclick="$(\'#map-edit\').height(235); caricaMappa(); $(this).hide();">
|
||||
<i class="fa fa-compass"></i> ' . tr('Carica mappa') . '
|
||||
<a class="btn btn-info btn-block '.((empty($sede_cliente->lat) && empty($sede_cliente->lng)) ? 'disabled' : '').'" onclick="$(\'#map-edit\').height(235); caricaMappa(); $(this).hide();">
|
||||
<i class="fa fa-compass"></i> '.tr('Carica mappa').'
|
||||
</a>';
|
||||
|
||||
|
||||
|
||||
|
||||
// Navigazione diretta verso l'indirizzo
|
||||
echo '
|
||||
<a class="btn btn-info btn-block '.(($anagrafica->isAzienda() || (empty($sede_cliente->lat) || empty($sede_cliente->lng))|| (empty($sede_azienda->lat) || empty($sede_azienda->lng)) ) ? "disabled": "").'" onclick="calcolaPercorso()">
|
||||
<a class="btn btn-info btn-block '.(($anagrafica->isAzienda() || (empty($sede_cliente->lat) || empty($sede_cliente->lng)) || (empty($sede_azienda->lat) || empty($sede_azienda->lng))) ? 'disabled' : '').'" onclick="calcolaPercorso()">
|
||||
<i class="fa fa-map-signs"></i> '.tr('Calcola percorso').'
|
||||
'.((!empty($sede_cliente->lat) && !empty($sede_azienda->lat)) ? tr('(GPS)'): '' ).'
|
||||
'.((!empty($sede_cliente->lat) && !empty($sede_azienda->lat)) ? tr('(GPS)') : '').'
|
||||
</a>';
|
||||
|
||||
// Ricerca diretta su Mappa
|
||||
echo '
|
||||
<a class="btn btn-info btn-block" onclick="cercaOpenStreetMap()">
|
||||
<i class="fa fa-map-marker"></i> '.tr('Cerca su Mappa').'
|
||||
'.((!empty($sede_cliente->lat)) ? tr(' (GPS)'): '' ).'
|
||||
'.((!empty($sede_cliente->lat)) ? tr(' (GPS)') : '').'
|
||||
</a>';
|
||||
|
||||
echo '
|
||||
@ -350,10 +345,10 @@ echo '
|
||||
var map = null;
|
||||
function caricaMappa() {
|
||||
const lat = parseFloat("'.$sede_cliente->lat.'");
|
||||
const lng = parseFloat("'.$sede_cliente->lng. '");
|
||||
const lng = parseFloat("'.$sede_cliente->lng.'");
|
||||
|
||||
if (typeof lat === "undefined" || typeof lng === "undefined"){
|
||||
swal("' . tr('Errore') . '", "' . tr("La posizione non è stata definita. Impossibile caricare la mappa.") . '", "error");
|
||||
swal("'.tr('Errore').'", "'.tr('La posizione non è stata definita. Impossibile caricare la mappa.').'", "error");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -369,7 +364,7 @@ echo '
|
||||
gestureHandling: true
|
||||
});
|
||||
|
||||
L.tileLayer("'.setting("Tile server OpenStreetMap").'", {
|
||||
L.tileLayer("'.setting('Tile server OpenStreetMap').'", {
|
||||
maxZoom: 17,
|
||||
attribution: "© OpenStreetMap"
|
||||
}).addTo(map);
|
||||
@ -648,7 +643,7 @@ if ($is_cliente or $is_fornitore or $is_tecnico) {
|
||||
</div>
|
||||
<?php
|
||||
if ($is_agente) {
|
||||
?>
|
||||
?>
|
||||
<div class="col-md-3">
|
||||
{[ "type": "number", "label": "<?php echo tr('Provvigione predefinita'); ?>", "name": "provvigione_default", "value": "$provvigione_default$", "icon-after": "%" ]}
|
||||
</div>
|
||||
|
@ -19,8 +19,8 @@
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
use Models\Module;
|
||||
use Carbon\Carbon;
|
||||
use Models\Module;
|
||||
|
||||
$id_record = filter('id_record');
|
||||
$dir = filter('dir');
|
||||
@ -40,7 +40,7 @@ echo '
|
||||
|
||||
<form action="" method="post" id="form" >
|
||||
<div class="row">';
|
||||
echo '
|
||||
echo '
|
||||
<div class="col-md-4">
|
||||
{[ "type": "date", "label": "'.tr('Data inizio').'", "required": "1", "name": "date_start", "value": "'.$_SESSION['period_start'].'" ]}
|
||||
</div>
|
||||
@ -67,7 +67,7 @@ echo '
|
||||
</div>
|
||||
';
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<div class="col-md-4 pull-right">
|
||||
<p style="line-height:14px;"> </p>
|
||||
<button type="button" class="btn btn-primary btn-block" onclick="if($(\'#form\').parsley().validate()) { return avvia_stampa(); }">
|
||||
@ -108,9 +108,9 @@ echo '
|
||||
input("date_start").disable();
|
||||
input("date_end").disable();
|
||||
}';
|
||||
if ($nome_stampa != 'Liquidazione IVA') {
|
||||
echo 'eseguiControlli();';
|
||||
}
|
||||
echo '
|
||||
if ($nome_stampa != 'Liquidazione IVA') {
|
||||
echo 'eseguiControlli();';
|
||||
}
|
||||
echo '
|
||||
});
|
||||
</script>';
|
||||
|
@ -32,15 +32,15 @@ echo '
|
||||
|
||||
<div class="col-md-2">
|
||||
<label> </label>
|
||||
<br><button type="button" class="btn btn-primary" onclick="initGeocomplete();"><i class="fa fa-search"></i> '.tr('Cerca'). '</button>
|
||||
<br><button type="button" class="btn btn-primary" onclick="initGeocomplete();"><i class="fa fa-search"></i> '.tr('Cerca').'</button>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
{[ "type": "text", "label": "' . tr('Latitudine') . '", "name": "lat", "value": "' . $record['lat'] . '", "extra": "data-geo=\'lat\'", "class": "text-right", "readonly": true ]}
|
||||
{[ "type": "text", "label": "'.tr('Latitudine').'", "name": "lat", "value": "'.$record['lat'].'", "extra": "data-geo=\'lat\'", "class": "text-right", "readonly": true ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
{[ "type": "text", "label": "' . tr('Longitudine') . '", "name": "lng", "value": "' . $record['lng'] . '", "extra": "data-geo=\'lng\'", "class": "text-right", "readonly": true ]}
|
||||
{[ "type": "text", "label": "'.tr('Longitudine').'", "name": "lng", "value": "'.$record['lng'].'", "extra": "data-geo=\'lng\'", "class": "text-right", "readonly": true ]}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -102,7 +102,7 @@ function caricaMappa() {
|
||||
gestureHandling: true
|
||||
});
|
||||
|
||||
L.tileLayer("'.setting("Tile server OpenStreetMap").'", {
|
||||
L.tileLayer("'.setting('Tile server OpenStreetMap').'", {
|
||||
maxZoom: 17,
|
||||
attribution: "© OpenStreetMap"
|
||||
}).addTo(map);
|
||||
|
@ -41,7 +41,6 @@ if (empty($_GET['visualizza_allegati'])) {
|
||||
</div>
|
||||
</div>';
|
||||
} else {
|
||||
|
||||
//Controllo i permessi dei modulo per la visualizzazione degli allegati
|
||||
$rs = $dbo->table('zz_permissions')->where('idgruppo', $user->idgruppo)->get();
|
||||
$permessi = [];
|
||||
|
@ -409,12 +409,13 @@ class Anagrafica extends Model
|
||||
|
||||
if ($this->isTipo('Cliente')) {
|
||||
$database->update('co_pianodeiconti3', ['descrizione' => $this->ragione_sociale], ['id' => $this->idconto_cliente]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($this->isTipo('Fornitore')) {
|
||||
$database->update('co_pianodeiconti3', ['descrizione' => $this->ragione_sociale], ['id' => $this->idconto_fornitore]);
|
||||
}
|
||||
}
|
||||
|
||||
protected function fixRagioneSociale()
|
||||
{
|
||||
if (!empty($this->cognome) || !empty($this->nome)) {
|
||||
|
@ -27,8 +27,15 @@ class Referente extends Model
|
||||
use SimpleModelTrait;
|
||||
|
||||
protected $table = 'an_referenti';
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* The attributes that aren't mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* Crea un nuovo referente.
|
||||
*
|
||||
* @param string $nome
|
||||
@ -39,7 +46,6 @@ class Referente extends Model
|
||||
{
|
||||
$model = new static();
|
||||
|
||||
|
||||
$model->idanagrafica = $idanagrafica;
|
||||
|
||||
$model->nome = $nome;
|
||||
@ -52,14 +58,6 @@ class Referente extends Model
|
||||
return $model;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The attributes that aren't mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $guarded = [];
|
||||
|
||||
public function anagrafica()
|
||||
{
|
||||
return $this->belongsTo(Anagrafica::class, 'idanagrafica');
|
||||
|
@ -39,4 +39,4 @@ return [
|
||||
'id_anagrafica' => $anagrafica->idanagrafica,
|
||||
'conto' => $conto,
|
||||
'conto_descrizione' => $conto_descrizione,
|
||||
];
|
||||
];
|
||||
|
@ -72,7 +72,7 @@ switch (post('op')) {
|
||||
$articolo->um = post('um');
|
||||
$articolo->um_secondaria = post('um_secondaria');
|
||||
$articolo->fattore_um_secondaria = post('fattore_um_secondaria');
|
||||
|
||||
|
||||
$articolo->save();
|
||||
|
||||
// Aggiornamento delle varianti per i campi comuni
|
||||
@ -244,7 +244,7 @@ switch (post('op')) {
|
||||
// Duplica articolo
|
||||
case 'copy':
|
||||
$new = $articolo->replicate();
|
||||
|
||||
|
||||
//Se non specifico il codice articolo lo imposto uguale all'id della riga
|
||||
if (empty(post('codice'))) {
|
||||
$codice = $dbo->fetchOne('SELECT MAX(id) as codice FROM mg_articoli')['codice'] + 1;
|
||||
@ -374,7 +374,6 @@ switch (post('op')) {
|
||||
break;
|
||||
|
||||
case 'add-movimento':
|
||||
|
||||
$articolo = Articolo::find(post('idarticolo'));
|
||||
$tipo_movimento = post('tipo_movimento');
|
||||
$descrizione = post('movimento');
|
||||
@ -399,7 +398,6 @@ switch (post('op')) {
|
||||
$articolo->movimenta($qta, $descrizione, $data, 1, [
|
||||
'idsede' => $id_sede_azienda,
|
||||
]);
|
||||
|
||||
} elseif ($tipo_movimento == 'spostamento') {
|
||||
// Registrazione del movimento verso la sede di destinazione
|
||||
$articolo->registra($qta, $descrizione, $data, 1, [
|
||||
|
@ -126,7 +126,7 @@ $aliquota_predefinita = floatval(Aliquota::find($iva_predefinita)->percentuale);
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "checkbox", "label": "<?php echo tr('Abilita serial number'); ?>", "name": "abilita_serial", "help": "<?php echo tr('Abilita serial number in fase di aggiunta articolo in fattura o ddt'); ?>", "value": "<?php echo setting('Serial number abilitato di default') ?>","placeholder": "<?php echo tr('Serial number'); ?>" ]}
|
||||
{[ "type": "checkbox", "label": "<?php echo tr('Abilita serial number'); ?>", "name": "abilita_serial", "help": "<?php echo tr('Abilita serial number in fase di aggiunta articolo in fattura o ddt'); ?>", "value": "<?php echo setting('Serial number abilitato di default'); ?>","placeholder": "<?php echo tr('Serial number'); ?>" ]}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -56,7 +56,7 @@ foreach ($rs as $r) {
|
||||
$result['link'] = base_path().'/editor.php?id_module='.$link_id.'&id_record='.$r['id'];
|
||||
$result['title'] = $r['codice'].' - '.$r['descrizione'].'<br>
|
||||
<small>'.
|
||||
( $show_prezzi ? '<strong>'.tr('Prezzo di vendita').':</strong> '.moneyFormat( $prezzi_ivati ? $r['prezzo_vendita_ivato'] : $r['prezzo_vendita']).'<br>' : '' ).'
|
||||
($show_prezzi ? '<strong>'.tr('Prezzo di vendita').':</strong> '.moneyFormat($prezzi_ivati ? $r['prezzo_vendita_ivato'] : $r['prezzo_vendita']).'<br>' : '').'
|
||||
<strong>'.tr('Q.tà').':</strong> '.Translator::numberToLocale($r['qta'], 'qta').' '.$r['um'].'
|
||||
</small>';
|
||||
$result['category'] = 'Articoli';
|
||||
|
@ -42,9 +42,9 @@ switch ($resource) {
|
||||
IF(`categoria`.`nome` IS NOT NULL, CONCAT(`categoria`.`nome`, IF(`sottocategoria`.`nome` IS NOT NULL, CONCAT(' (', `sottocategoria`.`nome`, ')'), '-')), '<i>".tr('Nessuna categoria')."</i>') AS optgroup,
|
||||
`mg_articoli`.`barcode`,
|
||||
|
||||
`mg_articoli`.".($prezzi_ivati ? '`prezzo_vendita_ivato`' : '`prezzo_vendita`')." AS prezzo_vendita,
|
||||
`mg_articoli`.".($prezzi_ivati ? '`prezzo_vendita_ivato`' : '`prezzo_vendita`').' AS prezzo_vendita,
|
||||
`mg_articoli`.`prezzo_vendita_ivato` AS prezzo_vendita_ivato,
|
||||
`mg_articoli`.".($prezzi_ivati ? '`minimo_vendita_ivato`' : '`minimo_vendita`')." AS minimo_vendita,";
|
||||
`mg_articoli`.'.($prezzi_ivati ? '`minimo_vendita_ivato`' : '`minimo_vendita`').' AS minimo_vendita,';
|
||||
|
||||
// Informazioni relative al fornitore specificato dal documenti di acquisto
|
||||
if ($usare_dettaglio_fornitore) {
|
||||
|
@ -66,7 +66,7 @@ switch (post('op')) {
|
||||
foreach ($id_records as $id) {
|
||||
$articolo = Articolo::find($id);
|
||||
|
||||
if (empty((int)$articolo->coefficiente)) {
|
||||
if (empty((int) $articolo->coefficiente)) {
|
||||
$prezzo_partenza = post('prezzo_partenza') == 'vendita' ? $articolo->prezzo_vendita : $articolo->prezzo_acquisto;
|
||||
$aliquota_iva = floatval(Aliquota::find($articolo->idiva_vendita)->percentuale);
|
||||
|
||||
@ -92,7 +92,7 @@ switch (post('op')) {
|
||||
$articolo->setPrezzoVendita($new_prezzo_vendita, $articolo->idiva_vendita);
|
||||
$articolo->save();
|
||||
} else {
|
||||
$articoli_coeff++;
|
||||
++$articoli_coeff;
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ switch (post('op')) {
|
||||
$coefficiente = post('coefficiente');
|
||||
|
||||
$articolo->coefficiente = $coefficiente;
|
||||
$articolo->prezzo_vendita = $articolo->prezzo_acquisto*$coefficiente;
|
||||
$articolo->prezzo_vendita = $articolo->prezzo_acquisto * $coefficiente;
|
||||
$articolo->save();
|
||||
}
|
||||
|
||||
@ -156,7 +156,6 @@ switch (post('op')) {
|
||||
redirect(base_path().'/pdfgen.php?id_print='.$id_print.'&id_record='.Articolo::where('codice', '!=', '')->first()->id);
|
||||
exit();
|
||||
|
||||
|
||||
case 'change-qta':
|
||||
$descrizione = post('descrizione');
|
||||
$data = post('data');
|
||||
@ -221,7 +220,6 @@ switch (post('op')) {
|
||||
redirect(base_path().'/editor.php?id_module='.Modules::get('Preventivi')['id'].'&id_record='.$id_preventivo);
|
||||
exit();
|
||||
|
||||
|
||||
case 'export-csv':
|
||||
$file = temp_file();
|
||||
$exporter = new CSV($file);
|
||||
@ -286,14 +284,14 @@ switch (post('op')) {
|
||||
foreach ($id_records as $id) {
|
||||
$articolo = Articolo::find($id);
|
||||
|
||||
if ($articolo->prezzo_acquisto==0 && empty($articolo->idfornitore)) {
|
||||
if ($articolo->prezzo_acquisto == 0 && empty($articolo->idfornitore)) {
|
||||
$new_prezzo_acquisto = $dbo->fetchOne('SELECT (prezzo_unitario-sconto_unitario) AS prezzo_acquisto FROM co_righe_documenti LEFT JOIN co_documenti ON co_righe_documenti.iddocumento=co_documenti.id LEFT JOIN co_tipidocumento ON co_tipidocumento.id=co_documenti.idtipodocumento WHERE idarticolo='.prepare($id).' AND dir="uscita" ORDER BY co_documenti.data DESC, co_righe_documenti.id DESC LIMIT 0,1')['prezzo_acquisto'];
|
||||
|
||||
$articolo->prezzo_acquisto = $new_prezzo_acquisto;
|
||||
$articolo->save();
|
||||
|
||||
if ($new_prezzo_acquisto!=0) {
|
||||
$n_art++;
|
||||
if ($new_prezzo_acquisto != 0) {
|
||||
++$n_art;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -389,7 +387,7 @@ switch (post('op')) {
|
||||
'tipo_provvigione' => post('tipo_provvigione'),
|
||||
]);
|
||||
}
|
||||
$n_art++;
|
||||
++$n_art;
|
||||
}
|
||||
|
||||
flash()->info(tr('Provvigioni inserite correttamente!', [
|
||||
@ -489,7 +487,7 @@ $operations['crea-preventivo'] = [
|
||||
'msg' => tr('Ogni articolo selezionato, verrà aggiunto al preventivo').'
|
||||
<br><br>{[ "type": "text", "label": "'.tr('Nome preventivo').'", "name": "nome", "required": 1 ]}
|
||||
{[ "type": "select", "label": "'.tr('Cliente').'", "name": "id_cliente", "ajax-source": "clienti", "required": 1 ]}
|
||||
{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "ajax-source": "segmenti", "select-options": '.json_encode(["id_module" => $id_preventivi, 'is_sezionale' => 1]).', "value": "'.$id_segment.'", "select-options-escape": true ]}
|
||||
{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "ajax-source": "segmenti", "select-options": '.json_encode(['id_module' => $id_preventivi, 'is_sezionale' => 1]).', "value": "'.$id_segment.'", "select-options-escape": true ]}
|
||||
{[ "type": "select", "label": "'.tr('Tipo di attività').'", "name": "id_tipo", "ajax-source": "tipiintervento", "required": 1 ]}
|
||||
{[ "type": "date", "label": "'.tr('Data').'", "name": "data", "required": 1, "value": "-now-" ]}',
|
||||
'button' => tr('Procedi'),
|
||||
|
@ -50,8 +50,8 @@ use Modules\Iva\Aliquota;
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<?php echo ((!empty($record['id_categoria'])) ?
|
||||
Modules::link('Categorie articoli', $record['id_categoria'], null, null, 'class="pull-right"') : '') ?>
|
||||
<?php echo (!empty($record['id_categoria'])) ?
|
||||
Modules::link('Categorie articoli', $record['id_categoria'], null, null, 'class="pull-right"') : ''; ?>
|
||||
{[ "type": "select", "label": "<?php echo tr('Categoria'); ?>", "name": "categoria", "required": 0, "value": "$id_categoria$", "ajax-source": "categorie", "icon-after": "add|<?php echo Modules::get('Categorie articoli')['id']; ?>" ]}
|
||||
</div>
|
||||
|
||||
@ -107,7 +107,7 @@ use Modules\Iva\Aliquota;
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "number", "label": "<?php echo tr('Quantità'); ?>", "name": "qta", "required": 1, "value": "$qta$", "readonly": 1, "decimals": "qta", "min-value": "undefined", "icon-after": "<?php echo (!empty($record['um']) ? $record['um']: ''); ?>" ]}
|
||||
{[ "type": "number", "label": "<?php echo tr('Quantità'); ?>", "name": "qta", "required": 1, "value": "$qta$", "readonly": 1, "decimals": "qta", "min-value": "undefined", "icon-after": "<?php echo !empty($record['um']) ? $record['um'] : ''; ?>" ]}
|
||||
<input type="hidden" id="old_qta" value="<?php echo $record['qta']; ?>">
|
||||
</div>
|
||||
|
||||
@ -127,7 +127,7 @@ use Modules\Iva\Aliquota;
|
||||
|
||||
<div class="alert alert-info">
|
||||
<p><?php echo tr('Le modifiche alle quantità in questa schermata prevedono la generazione di un movimento relativo alla sede legale'); ?>. <?php echo tr('Se si desidera effettuare movimenti per altre sedi, utilizzare il modulo _MODULO_ ', [
|
||||
'_MODULO_' => Modules::link('Movimenti', null, tr('Movimenti'))
|
||||
'_MODULO_' => Modules::link('Movimenti', null, tr('Movimenti')),
|
||||
]); ?>.</p>
|
||||
</div>
|
||||
|
||||
@ -182,8 +182,8 @@ use Modules\Iva\Aliquota;
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<?php echo ((!empty($record['id_fornitore'])) ?
|
||||
Plugins::link('Listino Fornitori', $id_record, null, null, 'class="pull-right" onclick="modificaFornitore('.$id_record.','.$record['id_fornitore'].')"', null): ''); ?>
|
||||
<?php echo (!empty($record['id_fornitore'])) ?
|
||||
Plugins::link('Listino Fornitori', $id_record, null, null, 'class="pull-right" onclick="modificaFornitore('.$id_record.','.$record['id_fornitore'].')"', null) : ''; ?>
|
||||
{[ "type": "select", "label": "<?php echo tr('Fornitore predefinito'); ?>", "name": "id_fornitore", "ajax-source": "fornitori-articolo", "select-options": <?php echo json_encode(['id_articolo' => $id_record]); ?>, "value":"$id_fornitore$", "help": "<?php echo tr('Fornitore predefinito selezionabile tra i fornitori presenti nel plugin \"Listino fornitori\"'); ?>." ]}
|
||||
</div>
|
||||
</div>
|
||||
@ -230,13 +230,13 @@ $iva_predefinita = setting('Iva predefinita');
|
||||
$aliquota_predefinita = floatval(Aliquota::find($iva_predefinita)->percentuale);
|
||||
if (empty($prezzi_ivati)) {
|
||||
echo '
|
||||
<button type="button" class="btn btn-info btn-xs pull-right tip pull-right '.(!empty((int)$articolo->coefficiente) ? 'disabled' : '').'" title="'.tr('Scorpora l\'IVA dal prezzo di vendita.').'" id="scorporaIva">
|
||||
<button type="button" class="btn btn-info btn-xs pull-right tip pull-right '.(!empty((int) $articolo->coefficiente) ? 'disabled' : '').'" title="'.tr('Scorpora l\'IVA dal prezzo di vendita.').'" id="scorporaIva">
|
||||
<i class="fa fa-calculator"></i>
|
||||
</button>';
|
||||
}
|
||||
|
||||
echo '
|
||||
{[ "type": "number", "label": "'.tr('Prezzo di vendita').'", "name": "prezzo_vendita", "value": "'.($prezzi_ivati ? $articolo->prezzo_vendita_ivato : $articolo->prezzo_vendita).'", "icon-after": "'.currency().'", "help": "'.($prezzi_ivati ? tr('Importo IVA inclusa') : '').'", "disabled": "'.(!empty((int)$articolo->coefficiente) ? 1 : 0).'" ]}
|
||||
{[ "type": "number", "label": "'.tr('Prezzo di vendita').'", "name": "prezzo_vendita", "value": "'.($prezzi_ivati ? $articolo->prezzo_vendita_ivato : $articolo->prezzo_vendita).'", "icon-after": "'.currency().'", "help": "'.($prezzi_ivati ? tr('Importo IVA inclusa') : '').'", "disabled": "'.(!empty((int) $articolo->coefficiente) ? 1 : 0).'" ]}
|
||||
</div>';
|
||||
|
||||
?>
|
||||
@ -274,7 +274,7 @@ echo '
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "number", "label": "<?php echo tr('Minimo di vendita'); ?>", "name": "minimo_vendita", "value": "<?php echo ($prezzi_ivati ? $articolo->minimo_vendita_ivato : $articolo->minimo_vendita); ?>", "icon-after": "<?php echo currency(); ?>", "help": "<?php echo ($prezzi_ivati ? tr('Importo IVA inclusa') : ''); ?>" ]}
|
||||
{[ "type": "number", "label": "<?php echo tr('Minimo di vendita'); ?>", "name": "minimo_vendita", "value": "<?php echo $prezzi_ivati ? $articolo->minimo_vendita_ivato : $articolo->minimo_vendita; ?>", "icon-after": "<?php echo currency(); ?>", "help": "<?php echo $prezzi_ivati ? tr('Importo IVA inclusa') : ''; ?>" ]}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -29,7 +29,7 @@ include_once __DIR__.'/../../../core.php';
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
{["type": "select", "label": "<?php echo tr('Articolo'); ?>", "name": "idarticolo", "ajax-source": "articoli", "value": "<?php echo get('id_articolo');?>", "required": 1, "readonly": 1, "select-options": {"permetti_movimento_a_zero": 1, "idanagrafica": <?php echo setting('Azienda predefinita'); ?>, "idsede_partenza": 0, "idsede_destinazione": 0 } ]}
|
||||
{["type": "select", "label": "<?php echo tr('Articolo'); ?>", "name": "idarticolo", "ajax-source": "articoli", "value": "<?php echo get('id_articolo'); ?>", "required": 1, "readonly": 1, "select-options": {"permetti_movimento_a_zero": 1, "idanagrafica": <?php echo setting('Azienda predefinita'); ?>, "idsede_partenza": 0, "idsede_destinazione": 0 } ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
|
@ -50,11 +50,11 @@ echo '
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<span><b>'.tr("Codice: ").'</b>'.$articolo->codice.'</span>
|
||||
<span><b>'.tr('Codice: ').'</b>'.$articolo->codice.'</span>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<span><b>'.tr("Descrizione: ").'</b>'.$articolo->descrizione.'</span>
|
||||
<span><b>'.tr('Descrizione: ').'</b>'.$articolo->descrizione.'</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -296,4 +296,4 @@ function getDettagli(idsede) {
|
||||
openModal("'.tr('Dettagli').'", "'.$rootdir.'/modules/articoli/plugins/dettagli_giacenze.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&idsede=" + idsede );
|
||||
}
|
||||
|
||||
</script>';
|
||||
</script>';
|
||||
|
@ -99,23 +99,23 @@ echo '
|
||||
|
||||
// Elenco
|
||||
if (empty(get('modal'))) {
|
||||
echo '
|
||||
echo '
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">'.tr('Elenco seriali').'</h3>
|
||||
</div>
|
||||
<div class="box-body">';
|
||||
|
||||
// Conteggio totale prodotti
|
||||
$rs = $dbo->fetchArray('SELECT COUNT(id) AS tot FROM mg_prodotti WHERE id_articolo='.prepare($id_record));
|
||||
$tot_prodotti = $rs[0]['tot'];
|
||||
// Conteggio totale prodotti
|
||||
$rs = $dbo->fetchArray('SELECT COUNT(id) AS tot FROM mg_prodotti WHERE id_articolo='.prepare($id_record));
|
||||
$tot_prodotti = $rs[0]['tot'];
|
||||
|
||||
// Visualizzazione di tutti i prodotti
|
||||
$search_serial = get('search_serial');
|
||||
$query = 'SELECT id, serial, created_at FROM mg_prodotti WHERE serial IS NOT NULL AND id_articolo='.prepare($id_record).(!empty($search_serial) ? ' AND serial LIKE '.prepare('%'.$search_serial.'%') : '').' GROUP BY serial ORDER BY created_at DESC, serial DESC, lotto DESC, altro DESC';
|
||||
$rs2 = $dbo->fetchArray($query);
|
||||
// Visualizzazione di tutti i prodotti
|
||||
$search_serial = get('search_serial');
|
||||
$query = 'SELECT id, serial, created_at FROM mg_prodotti WHERE serial IS NOT NULL AND id_articolo='.prepare($id_record).(!empty($search_serial) ? ' AND serial LIKE '.prepare('%'.$search_serial.'%') : '').' GROUP BY serial ORDER BY created_at DESC, serial DESC, lotto DESC, altro DESC';
|
||||
$rs2 = $dbo->fetchArray($query);
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<table id="table-serials" class="table table-striped table-hover table-condensed table-bordered text-center datatables">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -130,201 +130,199 @@ echo '
|
||||
</thead>
|
||||
<tbody>';
|
||||
|
||||
for ($i = 0; $i < count($rs2); ++$i) {
|
||||
echo '
|
||||
for ($i = 0; $i < count($rs2); ++$i) {
|
||||
echo '
|
||||
<tr>
|
||||
|
||||
<td>'.$rs2[$i]['serial'].'</td>';
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<td>'.Translator::timestampToLocale($rs2[$i]['created_at']).'</td>';
|
||||
|
||||
// Ricerca acquisti
|
||||
$acquisti = $dbo->fetchArray('SELECT * FROM mg_prodotti WHERE dir=\'uscita\' AND id_articolo='.prepare($id_record).' AND (id_riga_documento IS NOT NULL OR id_riga_ordine IS NOT NULL OR id_riga_ddt IS NOT NULL) AND serial='.prepare($rs2[$i]['serial']));
|
||||
// Ricerca acquisti
|
||||
$acquisti = $dbo->fetchArray('SELECT * FROM mg_prodotti WHERE dir=\'uscita\' AND id_articolo='.prepare($id_record).' AND (id_riga_documento IS NOT NULL OR id_riga_ordine IS NOT NULL OR id_riga_ddt IS NOT NULL) AND serial='.prepare($rs2[$i]['serial']));
|
||||
|
||||
if (!empty($acquisti)) {
|
||||
echo '
|
||||
if (!empty($acquisti)) {
|
||||
echo '
|
||||
<td>';
|
||||
|
||||
$totali = [];
|
||||
$totali = [];
|
||||
|
||||
foreach ($acquisti as $acquisto) {
|
||||
// Acquistato su fatture
|
||||
if (!empty($acquisto['id_riga_documento'])) {
|
||||
$module_id = Modules::get('Fatture di acquisto')['id'];
|
||||
foreach ($acquisti as $acquisto) {
|
||||
// Acquistato su fatture
|
||||
if (!empty($acquisto['id_riga_documento'])) {
|
||||
$module_id = Modules::get('Fatture di acquisto')['id'];
|
||||
|
||||
// Ricerca vendite su fatture
|
||||
$query = 'SELECT *, ( SELECT descrizione FROM co_tipidocumento WHERE id=(SELECT idtipodocumento FROM co_documenti WHERE id=iddocumento) ) AS tipo_documento, ( SELECT `dir` FROM co_tipidocumento WHERE id=(SELECT idtipodocumento FROM co_documenti WHERE id=iddocumento) ) AS `dir`, ( SELECT numero FROM co_documenti WHERE id=iddocumento ) AS numero, ( SELECT numero_esterno FROM co_documenti WHERE id=iddocumento ) AS numero_esterno, ( SELECT data FROM co_documenti WHERE id=iddocumento ) AS data FROM co_righe_documenti WHERE co_righe_documenti.id='.prepare($acquisto['id_riga_documento']);
|
||||
$data = $dbo->fetchArray($query);
|
||||
// Ricerca vendite su fatture
|
||||
$query = 'SELECT *, ( SELECT descrizione FROM co_tipidocumento WHERE id=(SELECT idtipodocumento FROM co_documenti WHERE id=iddocumento) ) AS tipo_documento, ( SELECT `dir` FROM co_tipidocumento WHERE id=(SELECT idtipodocumento FROM co_documenti WHERE id=iddocumento) ) AS `dir`, ( SELECT numero FROM co_documenti WHERE id=iddocumento ) AS numero, ( SELECT numero_esterno FROM co_documenti WHERE id=iddocumento ) AS numero_esterno, ( SELECT data FROM co_documenti WHERE id=iddocumento ) AS data FROM co_righe_documenti WHERE co_righe_documenti.id='.prepare($acquisto['id_riga_documento']);
|
||||
$data = $dbo->fetchArray($query);
|
||||
|
||||
$id = $data[0]['iddocumento'];
|
||||
}
|
||||
$id = $data[0]['iddocumento'];
|
||||
}
|
||||
|
||||
// Acquistato su ddt
|
||||
elseif (!empty($acquisto['id_riga_ddt'])) {
|
||||
$module_id = Modules::get('Ddt di acquisto')['id'];
|
||||
// Acquistato su ddt
|
||||
elseif (!empty($acquisto['id_riga_ddt'])) {
|
||||
$module_id = Modules::get('Ddt di acquisto')['id'];
|
||||
|
||||
$query = 'SELECT *, ( SELECT descrizione FROM dt_tipiddt WHERE id=(SELECT idtipoddt FROM dt_ddt WHERE id=idddt) ) AS tipo_documento, ( SELECT `dir` FROM dt_tipiddt WHERE id=(SELECT idtipoddt FROM dt_ddt WHERE id=idddt) ) AS `dir`, ( SELECT numero FROM dt_ddt WHERE id=idddt ) AS numero, ( SELECT numero_esterno FROM dt_ddt WHERE id=idddt ) AS numero_esterno, ( SELECT data FROM dt_ddt WHERE id=idddt ) AS data FROM dt_righe_ddt WHERE dt_righe_ddt.id='.prepare($acquisto['id_riga_ddt']);
|
||||
$data = $dbo->fetchArray($query);
|
||||
$query = 'SELECT *, ( SELECT descrizione FROM dt_tipiddt WHERE id=(SELECT idtipoddt FROM dt_ddt WHERE id=idddt) ) AS tipo_documento, ( SELECT `dir` FROM dt_tipiddt WHERE id=(SELECT idtipoddt FROM dt_ddt WHERE id=idddt) ) AS `dir`, ( SELECT numero FROM dt_ddt WHERE id=idddt ) AS numero, ( SELECT numero_esterno FROM dt_ddt WHERE id=idddt ) AS numero_esterno, ( SELECT data FROM dt_ddt WHERE id=idddt ) AS data FROM dt_righe_ddt WHERE dt_righe_ddt.id='.prepare($acquisto['id_riga_ddt']);
|
||||
$data = $dbo->fetchArray($query);
|
||||
|
||||
$id = $data[0]['idddt'];
|
||||
}
|
||||
$id = $data[0]['idddt'];
|
||||
}
|
||||
|
||||
// Inserito su ordini
|
||||
elseif (!empty($acquisto['id_riga_ordine'])) {
|
||||
$module_id = Modules::get('Ordini cliente')['id'];
|
||||
// Inserito su ordini
|
||||
elseif (!empty($acquisto['id_riga_ordine'])) {
|
||||
$module_id = Modules::get('Ordini cliente')['id'];
|
||||
|
||||
// Ricerca inserimenti su ordini
|
||||
$query = 'SELECT *, ( SELECT descrizione FROM or_tipiordine WHERE id=(SELECT idtipoordine FROM or_ordini WHERE id=idordine) ) AS tipo_documento, ( SELECT `dir` FROM or_tipiordine WHERE id=(SELECT idtipoordine FROM or_ordini WHERE id=idordine) ) AS `dir`, ( SELECT numero FROM or_ordini WHERE id=idordine ) AS numero, ( SELECT numero_esterno FROM or_ordini WHERE id=idordine ) AS numero_esterno, ( SELECT data FROM or_ordini WHERE id=idordine ) AS data FROM or_righe_ordini WHERE or_righe_ordini.id='.prepare($acquisto['id_riga_ordine']);
|
||||
$data = $dbo->fetchArray($query);
|
||||
// Ricerca inserimenti su ordini
|
||||
$query = 'SELECT *, ( SELECT descrizione FROM or_tipiordine WHERE id=(SELECT idtipoordine FROM or_ordini WHERE id=idordine) ) AS tipo_documento, ( SELECT `dir` FROM or_tipiordine WHERE id=(SELECT idtipoordine FROM or_ordini WHERE id=idordine) ) AS `dir`, ( SELECT numero FROM or_ordini WHERE id=idordine ) AS numero, ( SELECT numero_esterno FROM or_ordini WHERE id=idordine ) AS numero_esterno, ( SELECT data FROM or_ordini WHERE id=idordine ) AS data FROM or_righe_ordini WHERE or_righe_ordini.id='.prepare($acquisto['id_riga_ordine']);
|
||||
$data = $dbo->fetchArray($query);
|
||||
|
||||
$id = $data[0]['idordine'];
|
||||
}
|
||||
$id = $data[0]['idordine'];
|
||||
}
|
||||
|
||||
$totali[] = [($data[0]['prezzo_unitario']-$data[0]['sconto_unitario']), $data[0]['iva_unitaria']];
|
||||
$totali[] = [($data[0]['prezzo_unitario'] - $data[0]['sconto_unitario']), $data[0]['iva_unitaria']];
|
||||
|
||||
$numero = !empty($data[0]['numero_esterno']) ? $data[0]['numero_esterno'] : $data[0]['numero'];
|
||||
$numero = !empty($data[0]['numero_esterno']) ? $data[0]['numero_esterno'] : $data[0]['numero'];
|
||||
|
||||
$text = tr('_DOC_ num. _NUM_ del _DATE_', [
|
||||
$text = tr('_DOC_ num. _NUM_ del _DATE_', [
|
||||
'_DOC_' => $data[0]['tipo_documento'],
|
||||
'_NUM_' => $numero,
|
||||
'_DATE_' => Translator::dateToLocale($data[0]['data']),
|
||||
]).(!empty($extra) ? ' '.$extra : '');
|
||||
|
||||
echo
|
||||
Modules::link($module_id, $id, $text).'<br>';
|
||||
}
|
||||
|
||||
echo '
|
||||
echo Modules::link($module_id, $id, $text).'<br>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</td>
|
||||
|
||||
<td class="text-center">';
|
||||
foreach ($totali as $value) {
|
||||
$subtotale = $value[0];
|
||||
$iva = $value[1];
|
||||
foreach ($totali as $value) {
|
||||
$subtotale = $value[0];
|
||||
$iva = $value[1];
|
||||
|
||||
echo '
|
||||
<span>'.moneyFormat($subtotale + $iva).'</span>';
|
||||
if (!empty($subtotale) && !empty($iva)) {
|
||||
echo '
|
||||
<span>'.moneyFormat($subtotale + $iva).'</span>';
|
||||
if (!empty($subtotale) && !empty($iva)) {
|
||||
echo '
|
||||
<small style="color:#555;">('.Translator::numberToLocale($subtotale).' + '.Translator::numberToLocale($iva).')</small>';
|
||||
}
|
||||
echo '
|
||||
}
|
||||
echo '
|
||||
<br>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</td>';
|
||||
}
|
||||
}
|
||||
|
||||
// Non venduto
|
||||
else {
|
||||
echo '
|
||||
echo '
|
||||
</td>';
|
||||
}
|
||||
|
||||
// Non venduto
|
||||
else {
|
||||
echo '
|
||||
<td></td>
|
||||
<td></td>';
|
||||
}
|
||||
}
|
||||
|
||||
// Ricerca vendite
|
||||
$vendite = $dbo->fetchArray('SELECT * FROM mg_prodotti WHERE dir=\'entrata\' AND id_articolo='.prepare($id_record).' AND serial='.prepare($rs2[$i]['serial']));
|
||||
// Ricerca vendite
|
||||
$vendite = $dbo->fetchArray('SELECT * FROM mg_prodotti WHERE dir=\'entrata\' AND id_articolo='.prepare($id_record).' AND serial='.prepare($rs2[$i]['serial']));
|
||||
|
||||
if (!empty($vendite)) {
|
||||
echo '
|
||||
if (!empty($vendite)) {
|
||||
echo '
|
||||
<td>';
|
||||
|
||||
$totali = [];
|
||||
$totali = [];
|
||||
|
||||
foreach ($vendite as $vendita) {
|
||||
// Venduto su fatture
|
||||
if (!empty($vendita['id_riga_documento'])) {
|
||||
$module_id = Modules::get('Fatture di vendita')['id'];
|
||||
foreach ($vendite as $vendita) {
|
||||
// Venduto su fatture
|
||||
if (!empty($vendita['id_riga_documento'])) {
|
||||
$module_id = Modules::get('Fatture di vendita')['id'];
|
||||
|
||||
// Ricerca vendite su fatture
|
||||
$query = 'SELECT *, ( SELECT descrizione FROM co_tipidocumento WHERE id=(SELECT idtipodocumento FROM co_documenti WHERE id=iddocumento) ) AS tipo_documento, ( SELECT `dir` FROM co_tipidocumento WHERE id=(SELECT idtipodocumento FROM co_documenti WHERE id=iddocumento) ) AS `dir`, ( SELECT numero FROM co_documenti WHERE id=iddocumento ) AS numero, ( SELECT numero_esterno FROM co_documenti WHERE id=iddocumento ) AS numero_esterno, ( SELECT data FROM co_documenti WHERE id=iddocumento ) AS data FROM co_righe_documenti WHERE co_righe_documenti.id='.prepare($vendita['id_riga_documento']);
|
||||
$data = $dbo->fetchArray($query);
|
||||
// Ricerca vendite su fatture
|
||||
$query = 'SELECT *, ( SELECT descrizione FROM co_tipidocumento WHERE id=(SELECT idtipodocumento FROM co_documenti WHERE id=iddocumento) ) AS tipo_documento, ( SELECT `dir` FROM co_tipidocumento WHERE id=(SELECT idtipodocumento FROM co_documenti WHERE id=iddocumento) ) AS `dir`, ( SELECT numero FROM co_documenti WHERE id=iddocumento ) AS numero, ( SELECT numero_esterno FROM co_documenti WHERE id=iddocumento ) AS numero_esterno, ( SELECT data FROM co_documenti WHERE id=iddocumento ) AS data FROM co_righe_documenti WHERE co_righe_documenti.id='.prepare($vendita['id_riga_documento']);
|
||||
$data = $dbo->fetchArray($query);
|
||||
|
||||
$id = $data[0]['iddocumento'];
|
||||
}
|
||||
$id = $data[0]['iddocumento'];
|
||||
}
|
||||
|
||||
// Venduto su ddt
|
||||
elseif (!empty($vendita['id_riga_ddt'])) {
|
||||
$module_id = Modules::get('Ddt di vendita')['id'];
|
||||
// Venduto su ddt
|
||||
elseif (!empty($vendita['id_riga_ddt'])) {
|
||||
$module_id = Modules::get('Ddt di vendita')['id'];
|
||||
|
||||
$query = 'SELECT *, ( SELECT descrizione FROM dt_tipiddt WHERE id=(SELECT idtipoddt FROM dt_ddt WHERE id=idddt) ) AS tipo_documento, ( SELECT `dir` FROM dt_tipiddt WHERE id=(SELECT idtipoddt FROM dt_ddt WHERE id=idddt) ) AS `dir`, ( SELECT numero FROM dt_ddt WHERE id=idddt ) AS numero, ( SELECT numero_esterno FROM dt_ddt WHERE id=idddt ) AS numero_esterno, ( SELECT data FROM dt_ddt WHERE id=idddt ) AS data FROM dt_righe_ddt WHERE dt_righe_ddt.id='.prepare($vendita['id_riga_ddt']);
|
||||
$data = $dbo->fetchArray($query);
|
||||
$query = 'SELECT *, ( SELECT descrizione FROM dt_tipiddt WHERE id=(SELECT idtipoddt FROM dt_ddt WHERE id=idddt) ) AS tipo_documento, ( SELECT `dir` FROM dt_tipiddt WHERE id=(SELECT idtipoddt FROM dt_ddt WHERE id=idddt) ) AS `dir`, ( SELECT numero FROM dt_ddt WHERE id=idddt ) AS numero, ( SELECT numero_esterno FROM dt_ddt WHERE id=idddt ) AS numero_esterno, ( SELECT data FROM dt_ddt WHERE id=idddt ) AS data FROM dt_righe_ddt WHERE dt_righe_ddt.id='.prepare($vendita['id_riga_ddt']);
|
||||
$data = $dbo->fetchArray($query);
|
||||
|
||||
$id = $data[0]['idddt'];
|
||||
}
|
||||
$id = $data[0]['idddt'];
|
||||
}
|
||||
|
||||
// Inserito su ordini
|
||||
elseif (!empty($vendita['id_riga_ordine'])) {
|
||||
$module_id = Modules::get('Ordini cliente')['id'];
|
||||
// Inserito su ordini
|
||||
elseif (!empty($vendita['id_riga_ordine'])) {
|
||||
$module_id = Modules::get('Ordini cliente')['id'];
|
||||
|
||||
// Ricerca inserimenti su ordini
|
||||
$query = 'SELECT *, ( SELECT descrizione FROM or_tipiordine WHERE id=(SELECT idtipoordine FROM or_ordini WHERE id=idordine) ) AS tipo_documento, ( SELECT `dir` FROM or_tipiordine WHERE id=(SELECT idtipoordine FROM or_ordini WHERE id=idordine) ) AS `dir`, ( SELECT numero FROM or_ordini WHERE id=idordine ) AS numero, ( SELECT numero_esterno FROM or_ordini WHERE id=idordine ) AS numero_esterno, ( SELECT data FROM or_ordini WHERE id=idordine ) AS data FROM or_righe_ordini WHERE or_righe_ordini.id='.prepare($vendita['id_riga_ordine']);
|
||||
$data = $dbo->fetchArray($query);
|
||||
// Ricerca inserimenti su ordini
|
||||
$query = 'SELECT *, ( SELECT descrizione FROM or_tipiordine WHERE id=(SELECT idtipoordine FROM or_ordini WHERE id=idordine) ) AS tipo_documento, ( SELECT `dir` FROM or_tipiordine WHERE id=(SELECT idtipoordine FROM or_ordini WHERE id=idordine) ) AS `dir`, ( SELECT numero FROM or_ordini WHERE id=idordine ) AS numero, ( SELECT numero_esterno FROM or_ordini WHERE id=idordine ) AS numero_esterno, ( SELECT data FROM or_ordini WHERE id=idordine ) AS data FROM or_righe_ordini WHERE or_righe_ordini.id='.prepare($vendita['id_riga_ordine']);
|
||||
$data = $dbo->fetchArray($query);
|
||||
|
||||
$id = $data[0]['idordine'];
|
||||
}
|
||||
$id = $data[0]['idordine'];
|
||||
}
|
||||
|
||||
// Inserito su intervento
|
||||
elseif (!empty($vendita['id_riga_intervento'])) {
|
||||
$module_id = Modules::get('Interventi')['id'];
|
||||
// Inserito su intervento
|
||||
elseif (!empty($vendita['id_riga_intervento'])) {
|
||||
$module_id = Modules::get('Interventi')['id'];
|
||||
|
||||
// Ricerca inserimenti su interventi
|
||||
$query = 'SELECT in_righe_interventi.*, in_interventi.codice, ( SELECT orario_inizio FROM in_interventi_tecnici WHERE idintervento=in_righe_interventi.idintervento LIMIT 0,1 ) AS data FROM in_righe_interventi JOIN in_interventi ON in_interventi.id = in_righe_interventi.idintervento WHERE in_righe_interventi.id='.prepare($vendita['id_riga_intervento']);
|
||||
$data = $dbo->fetchArray($query);
|
||||
// Ricerca inserimenti su interventi
|
||||
$query = 'SELECT in_righe_interventi.*, in_interventi.codice, ( SELECT orario_inizio FROM in_interventi_tecnici WHERE idintervento=in_righe_interventi.idintervento LIMIT 0,1 ) AS data FROM in_righe_interventi JOIN in_interventi ON in_interventi.id = in_righe_interventi.idintervento WHERE in_righe_interventi.id='.prepare($vendita['id_riga_intervento']);
|
||||
$data = $dbo->fetchArray($query);
|
||||
|
||||
$id = $data[0]['idintervento'];
|
||||
$id = $data[0]['idintervento'];
|
||||
|
||||
$data[0]['tipo_documento'] = tr('Intervento').' '.$data[0]['codice'];
|
||||
$data[0]['tipo_documento'] = tr('Intervento').' '.$data[0]['codice'];
|
||||
|
||||
$extra = tr('(q.tà _QTA_)', [
|
||||
$extra = tr('(q.tà _QTA_)', [
|
||||
'_QTA_' => $data[0]['qta'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
$totali[] = [($data[0]['prezzo_unitario']-$data[0]['sconto_unitario']), $data[0]['iva_unitaria']];
|
||||
$totali[] = [($data[0]['prezzo_unitario'] - $data[0]['sconto_unitario']), $data[0]['iva_unitaria']];
|
||||
|
||||
$numero = !empty($data[0]['numero_esterno']) ? $data[0]['numero_esterno'] : $data[0]['numero'];
|
||||
$numero = !empty($data[0]['numero_esterno']) ? $data[0]['numero_esterno'] : $data[0]['numero'];
|
||||
|
||||
$text = tr('_DOC_ num. _NUM_ del _DATE_', [
|
||||
$text = tr('_DOC_ num. _NUM_ del _DATE_', [
|
||||
'_DOC_' => $data[0]['tipo_documento'],
|
||||
'_NUM_' => $numero,
|
||||
'_DATE_' => Translator::dateToLocale($data[0]['data']),
|
||||
]).(!empty($extra) ? ' '.$extra : '');
|
||||
|
||||
echo
|
||||
Modules::link($module_id, $id, $text).'<br>';
|
||||
}
|
||||
]).(!empty($extra) ? ' '.$extra : '');
|
||||
|
||||
echo '
|
||||
echo Modules::link($module_id, $id, $text).'<br>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</td>
|
||||
|
||||
<td class="text-center">';
|
||||
foreach ($totali as $value) {
|
||||
$subtotale = $value[0];
|
||||
$iva = $value[1];
|
||||
foreach ($totali as $value) {
|
||||
$subtotale = $value[0];
|
||||
$iva = $value[1];
|
||||
|
||||
echo '
|
||||
<span>'.moneyFormat($subtotale + $iva).'</span>';
|
||||
if (!empty($subtotale) && !empty($iva)) {
|
||||
echo '
|
||||
<span>'.moneyFormat($subtotale + $iva).'</span>';
|
||||
if (!empty($subtotale) && !empty($iva)) {
|
||||
echo '
|
||||
<small style="color:#555;">('.Translator::numberToLocale($subtotale).' + '.Translator::numberToLocale($iva).')</small>';
|
||||
}
|
||||
echo '
|
||||
}
|
||||
echo '
|
||||
<br>';
|
||||
}
|
||||
}
|
||||
|
||||
echo '
|
||||
echo '
|
||||
</td>
|
||||
|
||||
<td></td>';
|
||||
}
|
||||
}
|
||||
|
||||
// Non venduto
|
||||
else {
|
||||
// Documento di vendita
|
||||
echo '
|
||||
// Non venduto
|
||||
else {
|
||||
// Documento di vendita
|
||||
echo '
|
||||
<td></td>
|
||||
<td></td>
|
||||
|
||||
@ -333,11 +331,11 @@ for ($i = 0; $i < count($rs2); ++$i) {
|
||||
<i class="fa fa-trash"></i>
|
||||
</a>
|
||||
</td>';
|
||||
}
|
||||
echo '
|
||||
</tr>';
|
||||
}
|
||||
echo '
|
||||
</tr>';
|
||||
}
|
||||
echo '
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -28,11 +28,11 @@ echo '
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<span><b>'.tr("Codice: ").'</b>'.$articolo->codice.'</span>
|
||||
<span><b>'.tr('Codice: ').'</b>'.$articolo->codice.'</span>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<span><b>'.tr("Descrizione: ").'</b>'.$articolo->descrizione.'</span>
|
||||
<span><b>'.tr('Descrizione: ').'</b>'.$articolo->descrizione.'</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -143,7 +143,7 @@ if (!empty($movimenti)) {
|
||||
</td>';
|
||||
|
||||
// Data
|
||||
$utente = $dbo->table('zz_users')->where('id',$movimento->idutente)->first();
|
||||
$utente = $dbo->table('zz_users')->where('id', $movimento->idutente)->first();
|
||||
$data = ($movimento->data ? $movimento->data : $movimento->data_movimento);
|
||||
echo '
|
||||
<td class="text-center">'.dateFormat($data).' <span class="tip" title="'.tr('Creazione movimento: _DATE_ <br>Creatore movimento: _USER_', [
|
||||
|
@ -25,7 +25,7 @@ $articolo = Articolo::find($id_record);
|
||||
|
||||
$idsede = (empty(get('idsede')) ? 0 : get('idsede'));
|
||||
$movimenti = $articolo->movimentiComposti()
|
||||
->where('idsede',$idsede)
|
||||
->where('idsede', $idsede)
|
||||
->orderBy('mg_movimenti.data', 'DESC')
|
||||
->orderBy('mg_movimenti.id', 'DESC');
|
||||
|
||||
@ -104,7 +104,7 @@ if (!empty($movimenti)) {
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
<th class="text-right">'.tr('Totale').'</th>
|
||||
<th class="text-right" width="17.9%">'.Translator::numberToLocale($totale,'qta').' '.$articolo->um.'</th>
|
||||
<th class="text-right" width="17.9%">'.Translator::numberToLocale($totale, 'qta').' '.$articolo->um.'</th>
|
||||
</tr>
|
||||
</table>';
|
||||
} else {
|
||||
@ -113,4 +113,4 @@ if (!empty($movimenti)) {
|
||||
<i class="fa fa-info-circle"></i>
|
||||
'.tr('Questo articolo non è ancora stato movimentato').'.
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ class Articolo extends Model
|
||||
$prezzo_vendita = $prezzo_vendita * (1 + $percentuale_aliquota / 100);
|
||||
}
|
||||
|
||||
$this->setPrezzoVendita(round($prezzo_vendita,2), $this->idiva_vendita);
|
||||
$this->setPrezzoVendita(round($prezzo_vendita, 2), $this->idiva_vendita);
|
||||
}
|
||||
}
|
||||
|
||||
@ -296,7 +296,7 @@ class Articolo extends Model
|
||||
'idsede',
|
||||
database()->raw('SUM(qta) AS qta')
|
||||
)->groupBy(['idsede']);
|
||||
|
||||
|
||||
if (!empty($data)) {
|
||||
$movimenti = $movimenti->where('data', '<=', \Carbon\Carbon::parse($data)->format('Y-m-d'));
|
||||
}
|
||||
@ -306,7 +306,7 @@ class Articolo extends Model
|
||||
return [$item->idsede => (float) $item->attributes['qta']];
|
||||
})
|
||||
->toArray();
|
||||
|
||||
|
||||
return $movimenti;
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ class CSV extends CSVImporter
|
||||
// Count the numbers of rows in a CSV
|
||||
$number = 0;
|
||||
foreach ($this->csv as $row) {
|
||||
$number++;
|
||||
++$number;
|
||||
}
|
||||
|
||||
// Lettura primo record: se non c'è la pulizia listini da fare, esco, altrimenti
|
||||
@ -417,7 +417,7 @@ class CSV extends CSVImporter
|
||||
$id_sede = $sede->id ?: 0;
|
||||
}
|
||||
|
||||
if( isset($record['qta']) ) {
|
||||
if (isset($record['qta'])) {
|
||||
$giacenze = $articolo->getGiacenze($record['data_qta']);
|
||||
$qta_movimento = $nuova_qta - $giacenze[$id_sede][0];
|
||||
|
||||
@ -480,10 +480,10 @@ class CSV extends CSVImporter
|
||||
$fornitore->save();
|
||||
}
|
||||
|
||||
// Imposto fornitore e prezzo predefinito
|
||||
// Imposto fornitore e prezzo predefinito
|
||||
$listino_id_fornitore = DettaglioPrezzo::dettaglioPredefinito($articolo->id, $dettagli['id_fornitore'], 'uscita')->first();
|
||||
if (!empty($listino_id_fornitore)) {
|
||||
$prezzo_acquisto = $listino_id_fornitore->prezzo_unitario - ($listino_id_fornitore->prezzo_unitario*$listino_id_fornitore->sconto_percentuale) / 100;
|
||||
$prezzo_acquisto = $listino_id_fornitore->prezzo_unitario - ($listino_id_fornitore->prezzo_unitario * $listino_id_fornitore->sconto_percentuale) / 100;
|
||||
$articolo->prezzo_acquisto = $prezzo_acquisto;
|
||||
$articolo->id_fornitore = $dettagli['id_fornitore'];
|
||||
$articolo->save();
|
||||
|
@ -99,8 +99,7 @@ if (filter('op') == 'restore') {
|
||||
$backups = Backup::getList();
|
||||
$path = $backups[$number];
|
||||
}
|
||||
|
||||
|
||||
Backup::restore($path, is_file($path));
|
||||
$database->beginTransaction();
|
||||
|
||||
}
|
||||
|
@ -41,14 +41,13 @@ switch (filter('op')) {
|
||||
}
|
||||
|
||||
// Redirect alla categoria se si sta modificando una sottocategoria
|
||||
if($id_original != null) {
|
||||
if ($id_original != null) {
|
||||
$database->commitTransaction();
|
||||
redirect(base_path().'/editor.php?id_module='.$id_module.'&id_record='.($id_original ?: $id_record));
|
||||
exit();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 'add':
|
||||
$nome = filter('nome');
|
||||
|
@ -22,15 +22,14 @@ include_once __DIR__.'/../../core.php';
|
||||
use Modules\Checklists\Check;
|
||||
use Modules\Checklists\ChecklistItem;
|
||||
|
||||
switch(post('op')){
|
||||
|
||||
case "delete_check":
|
||||
switch (post('op')) {
|
||||
case 'delete_check':
|
||||
$id = post('id');
|
||||
$main_check = post('main_check');
|
||||
|
||||
if($main_check){
|
||||
if ($main_check) {
|
||||
$record = ChecklistItem::find($id);
|
||||
}else{
|
||||
} else {
|
||||
$record = Check::find($id);
|
||||
}
|
||||
|
||||
@ -38,25 +37,23 @@ switch(post('op')){
|
||||
|
||||
break;
|
||||
|
||||
case "update_position":
|
||||
|
||||
case 'update_position':
|
||||
$main_check = post('main_check');
|
||||
$order = explode(',', post('order', true));
|
||||
|
||||
if($main_check){
|
||||
foreach($order as $i => $id){
|
||||
$dbo->query("UPDATE zz_checklist_items SET `order`=".prepare($i)." WHERE id=".prepare($id));
|
||||
if ($main_check) {
|
||||
foreach ($order as $i => $id) {
|
||||
$dbo->query('UPDATE zz_checklist_items SET `order`='.prepare($i).' WHERE id='.prepare($id));
|
||||
}
|
||||
}else{
|
||||
foreach($order as $i => $id){
|
||||
$dbo->query("UPDATE zz_checks SET `order`=".prepare($i)." WHERE id=".prepare($id));
|
||||
} else {
|
||||
foreach ($order as $i => $id) {
|
||||
$dbo->query('UPDATE zz_checks SET `order`='.prepare($i).' WHERE id='.prepare($id));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "save_checkbox":
|
||||
|
||||
case 'save_checkbox':
|
||||
$id = post('id');
|
||||
|
||||
$record = Check::find($id);
|
||||
@ -66,7 +63,7 @@ switch(post('op')){
|
||||
|
||||
break;
|
||||
|
||||
case "save_note":
|
||||
case 'save_note':
|
||||
$note = post('note');
|
||||
$id = post('id');
|
||||
|
||||
@ -78,24 +75,23 @@ switch(post('op')){
|
||||
|
||||
break;
|
||||
|
||||
case "remove_checkbox":
|
||||
|
||||
case 'remove_checkbox':
|
||||
$id = post('id');
|
||||
|
||||
$record = Check::find($id);
|
||||
$record->checked_by = NULL;
|
||||
$record->checked_at = NULL;
|
||||
$record->checked_by = null;
|
||||
$record->checked_at = null;
|
||||
$record->save();
|
||||
|
||||
break;
|
||||
|
||||
case "edit_check":
|
||||
case 'edit_check':
|
||||
$id_record = post('id_record');
|
||||
$main_check = post('main_check');
|
||||
|
||||
if($main_check){
|
||||
if ($main_check) {
|
||||
$record = ChecklistItem::find($id_record);
|
||||
}else{
|
||||
} else {
|
||||
$record = Check::find($id_record);
|
||||
}
|
||||
|
||||
@ -107,5 +103,3 @@ switch(post('op')){
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
@ -39,7 +39,7 @@ echo '
|
||||
'label' => tr('Contenuto'),
|
||||
'name' => 'content',
|
||||
'required' => 1,
|
||||
'value' => ''
|
||||
'value' => '',
|
||||
]).'
|
||||
</div>
|
||||
</div>
|
||||
|
@ -18,15 +18,15 @@
|
||||
*/
|
||||
|
||||
include_once __DIR__.'/../../../core.php';
|
||||
use Modules\Checklists\ChecklistItem;
|
||||
use Modules\Checklists\Check;
|
||||
use Modules\Checklists\ChecklistItem;
|
||||
|
||||
$id_record = get("id_record");
|
||||
$main_check = get("main_check");
|
||||
$id_record = get('id_record');
|
||||
$main_check = get('main_check');
|
||||
|
||||
if($main_check){
|
||||
if ($main_check) {
|
||||
$record = ChecklistItem::find($id_record);
|
||||
}else{
|
||||
} else {
|
||||
$record = Check::find($id_record);
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ if($main_check){
|
||||
'label' => tr('Descrizione'),
|
||||
'name' => 'content_edit',
|
||||
'required' => 1,
|
||||
'value' => htmlentities($record->content)
|
||||
'value' => htmlentities($record->content),
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
@ -48,7 +48,7 @@ if($main_check){
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
{[ "type": "checkbox", "label": "<?php echo tr('Utilizza come titolo'); ?>", "name": "is_titolo", "value": "<?php echo $record->is_titolo ?>" ]}
|
||||
{[ "type": "checkbox", "label": "<?php echo tr('Utilizza come titolo'); ?>", "name": "is_titolo", "value": "<?php echo $record->is_titolo; ?>" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-8 text-right">
|
||||
@ -64,10 +64,10 @@ if($main_check){
|
||||
|
||||
$.post('<?php echo $rootdir; ?>/modules/checklists/ajax.php', {
|
||||
op: "edit_check",
|
||||
id_record: "<?=$id_record?>",
|
||||
id_record: "<?php echo $id_record; ?>",
|
||||
content: input('content_edit').get(),
|
||||
is_titolo: input('is_titolo').get(),
|
||||
main_check: "<?=$main_check?>",
|
||||
main_check: "<?php echo $main_check; ?>",
|
||||
}, function(){
|
||||
location.reload();
|
||||
});
|
||||
|
@ -96,7 +96,7 @@ echo '
|
||||
'label' => tr('Contenuto'),
|
||||
'name' => 'content',
|
||||
'required' => 1,
|
||||
'value' => ''
|
||||
'value' => '',
|
||||
]).'
|
||||
</div>
|
||||
|
||||
@ -119,8 +119,8 @@ echo " <table class='table'>
|
||||
foreach ($checks as $check) {
|
||||
echo renderChecklistInserimento($check);
|
||||
}
|
||||
echo " </tbody>
|
||||
</table>";
|
||||
echo ' </tbody>
|
||||
</table>';
|
||||
|
||||
echo '
|
||||
</ul>
|
||||
@ -221,4 +221,4 @@ function edit_check(id){
|
||||
launch_modal("Modifica checklist", "'.$checklist_module->fileurl('components/edit-check.php').'?id_record="+id+"&main_check=1", 1);
|
||||
}
|
||||
|
||||
</script>';
|
||||
</script>';
|
||||
|
@ -25,4 +25,4 @@ $checklist_module = Modules::get('Checklists');
|
||||
|
||||
if (isset($id_record)) {
|
||||
$record = Checklist::find($id_record);
|
||||
}
|
||||
}
|
||||
|
@ -17,14 +17,14 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
function renderChecklist($check, $level = 1, $parent = 0) {
|
||||
|
||||
function renderChecklist($check, $level = 1, $parent = 0)
|
||||
{
|
||||
global $structure;
|
||||
|
||||
$user = auth()->getUser();
|
||||
$enabled = $check->assignedUsers ? ($check->assignedUsers->pluck('id')->search($user->id) !== false || ($user->idgruppo) == 1): true;
|
||||
$enabled = $check->assignedUsers ? ($check->assignedUsers->pluck('id')->search($user->id) !== false || ($user->idgruppo) == 1) : true;
|
||||
|
||||
$margin = ($level*20);
|
||||
$margin = ($level * 20);
|
||||
|
||||
$result = '
|
||||
<tr id="check_'.$check->id.'" data-id="'.$check->id.'" class="sortablerow sonof_'.$parent.'" >
|
||||
@ -41,11 +41,11 @@ function renderChecklist($check, $level = 1, $parent = 0) {
|
||||
$result .= '
|
||||
<td style="width:40px;text-align:center;border-top:0px;border-left:3px solid #eaeaea;">
|
||||
<input type="checkbox" class="checkbox unblockable" data-id="'.$check->id.'" value="'.(!empty($check->checked_at) ? '1' : '0').'" '.(!empty($check->checked_at) ? 'checked' : '').' '.(!$enabled ? 'disabled' : '').'>
|
||||
</td>';
|
||||
</td>';
|
||||
|
||||
$result .= '
|
||||
<td style="border-top:0px;">
|
||||
<span class="text unblockable" style="'.(!empty($check->checked_at)?'text-decoration:line-through;':'').'">'.$check->content.' </span>
|
||||
<span class="text unblockable" style="'.(!empty($check->checked_at) ? 'text-decoration:line-through;' : '').'">'.$check->content.' </span>
|
||||
</td>';
|
||||
|
||||
$result .= '
|
||||
@ -56,14 +56,14 @@ function renderChecklist($check, $level = 1, $parent = 0) {
|
||||
$result .= '
|
||||
<td style="width:250px;border-top:0px;">';
|
||||
|
||||
if (intval($check->assignedUsers->pluck('id')->toArray())>0) {
|
||||
$result .= ' <span class="label label-info pull-right" style="padding:6px 8px;" data-toggle="tooltip" title="Assegnato a '. implode(', ', $check->assignedUsers->pluck('username')->toArray()).'"><i class="fa fa-user"></i></span>';
|
||||
if (intval($check->assignedUsers->pluck('id')->toArray()) > 0) {
|
||||
$result .= ' <span class="label label-info pull-right" style="padding:6px 8px;" data-toggle="tooltip" title="Assegnato a '.implode(', ', $check->assignedUsers->pluck('username')->toArray()).'"><i class="fa fa-user"></i></span>';
|
||||
} else {
|
||||
$result .= ' <span class="label label-danger pull-right" style="padding:6px 8px;">'. tr('Nessun utente assegnato').'</span>';
|
||||
$result .= ' <span class="label label-danger pull-right" style="padding:6px 8px;">'.tr('Nessun utente assegnato').'</span>';
|
||||
}
|
||||
|
||||
if (!empty($check->checked_at)) {
|
||||
$result .= '
|
||||
$result .= '
|
||||
<span class="label label-default pull-right" style="margin-right:5px;padding:6px 8px;">'.(!empty($check->checked_at) ? tr('Verificato da _NAME_ il _DATE_', [
|
||||
'_NAME_' => $check->checkUser->username,
|
||||
'_DATE_' => timestampFormat($check->checked_at),
|
||||
@ -72,7 +72,7 @@ function renderChecklist($check, $level = 1, $parent = 0) {
|
||||
}
|
||||
$result .= '
|
||||
</td>';
|
||||
}
|
||||
}
|
||||
|
||||
$result .= '
|
||||
<td style="width:10px;text-align:center;border-top:0px;">
|
||||
@ -86,16 +86,16 @@ function renderChecklist($check, $level = 1, $parent = 0) {
|
||||
$result .= '
|
||||
</tr>';
|
||||
|
||||
if(sizeof($check->children)>0){
|
||||
if (sizeof($check->children) > 0) {
|
||||
$result .= '
|
||||
<tr>
|
||||
<td colspan="5" style="padding-left:'.$margin.'px;padding-right:10px;padding-top:0px;padding-bottom:0px;border-top:0px;">
|
||||
<table class="table" style="margin-bottom:0px;">
|
||||
<tbody class="sort" data-sonof="'.$check->id.'">';
|
||||
$children = $structure->checks()->where('id_parent', $check->id)->orderBy('order')->get();
|
||||
foreach ($children as $child) {
|
||||
$result .= renderChecklist($child, $level + 1, $check->id);
|
||||
}
|
||||
$children = $structure->checks()->where('id_parent', $check->id)->orderBy('order')->get();
|
||||
foreach ($children as $child) {
|
||||
$result .= renderChecklist($child, $level + 1, $check->id);
|
||||
}
|
||||
$result .= '
|
||||
</tbody>
|
||||
</table>
|
||||
@ -113,10 +113,9 @@ function renderChecklist($check, $level = 1, $parent = 0) {
|
||||
|
||||
function renderChecklistInserimento($check, $level = 1, $parent = 0)
|
||||
{
|
||||
|
||||
global $record;
|
||||
|
||||
$margin = ($level*20);
|
||||
|
||||
$margin = ($level * 20);
|
||||
|
||||
$result = '
|
||||
<tr id="check_'.$check->id.'" data-id="'.$check->id.'" class="sortablerow sonof_'.$parent.'" >
|
||||
@ -129,7 +128,7 @@ function renderChecklistInserimento($check, $level = 1, $parent = 0)
|
||||
$result .= '
|
||||
<span class="text">'.$check->content.'</span>';
|
||||
$result .= '
|
||||
</td>';
|
||||
</td>';
|
||||
|
||||
$result .= '
|
||||
<td style="width:40px;text-align:right;border-top:0px;">
|
||||
@ -139,21 +138,19 @@ function renderChecklistInserimento($check, $level = 1, $parent = 0)
|
||||
</div>
|
||||
</td>';
|
||||
|
||||
|
||||
|
||||
$result .= '
|
||||
</tr>';
|
||||
|
||||
if(sizeof($check->children)>0){
|
||||
if (sizeof($check->children) > 0) {
|
||||
$result .= '
|
||||
<tr>
|
||||
<td colspan="4" style="padding-left:'.$margin.'px;padding-right:0px;padding-top:0px;padding-bottom:0px;border-top:0px;">
|
||||
<table class="table" style="margin-bottom:0px;">
|
||||
<tbody class="sort" data-sonof="'.$check->id.'">';
|
||||
$children = $record->checks()->where('id_parent', $check->id)->orderBy('order')->get();
|
||||
foreach ($children as $child) {
|
||||
$result .= renderChecklistInserimento($child, $level + 1, $check->id);
|
||||
}
|
||||
$children = $record->checks()->where('id_parent', $check->id)->orderBy('order')->get();
|
||||
foreach ($children as $child) {
|
||||
$result .= renderChecklistInserimento($child, $level + 1, $check->id);
|
||||
}
|
||||
$result .= '
|
||||
</tbody>
|
||||
</table>
|
||||
@ -181,15 +178,15 @@ function renderChecklistHtml($check, $level = 0)
|
||||
$user = auth()->getUser();
|
||||
$enabled = $check->assignedUsers ? $check->assignedUsers->pluck('id')->search($user->id) !== false : true;
|
||||
|
||||
$width = 10+20*$level;
|
||||
$width = 10 + 20 * $level;
|
||||
|
||||
$result = '
|
||||
<tr>
|
||||
<td class="text-center" style="width:30px;">
|
||||
'.(!empty($check->checked_at)?'<img src="'.ROOTDIR.'/templates/interventi/check.png" style="width:10px;">':'').'
|
||||
'.(!empty($check->checked_at) ? '<img src="'.ROOTDIR.'/templates/interventi/check.png" style="width:10px;">' : '').'
|
||||
</td>
|
||||
<td style="padding-left:'.$width.'px;">
|
||||
<span class="text"><b>'.$check->content.'</b>'.(!empty($check->value)?': '.$check->value:'').'</span>
|
||||
<span class="text"><b>'.$check->content.'</b>'.(!empty($check->value) ? ': '.$check->value : '').'</span>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
@ -199,4 +196,4 @@ function renderChecklistHtml($check, $level = 0)
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
@ -48,8 +48,8 @@ switch (filter('op')) {
|
||||
$id_articolo = filter('id_articolo');
|
||||
|
||||
$database->delete('mg_articolo_attributo', ['id_articolo' => $id_articolo]);
|
||||
|
||||
foreach ($valori as $valore){
|
||||
|
||||
foreach ($valori as $valore) {
|
||||
$database->insert('mg_articolo_attributo', [
|
||||
'id_articolo' => $id_articolo,
|
||||
'id_valore' => $valore,
|
||||
|
@ -45,7 +45,7 @@ class Combinazione extends Model
|
||||
public function delete()
|
||||
{
|
||||
$database = database();
|
||||
|
||||
|
||||
// Rimozione articoli collegati
|
||||
$articoli = $this->articoli;
|
||||
foreach ($articoli as $articolo) {
|
||||
@ -116,7 +116,7 @@ class Combinazione extends Model
|
||||
$articolo->codice = $this->codice.'-'.implode('|', $variante);
|
||||
$articolo->save();
|
||||
}
|
||||
|
||||
|
||||
// Uso di un articolo già esistente
|
||||
else {
|
||||
$articolo = Articolo::find($id_articolo);
|
||||
|
@ -273,8 +273,8 @@ switch (post('op')) {
|
||||
|
||||
// Eliminazione riga
|
||||
case 'delete_riga':
|
||||
$id_righe = (array)post('righe');
|
||||
|
||||
$id_righe = (array) post('righe');
|
||||
|
||||
foreach ($id_righe as $id_riga) {
|
||||
$riga = Articolo::find($id_riga) ?: Riga::find($id_riga);
|
||||
$riga = $riga ?: Descrizione::find($id_riga);
|
||||
@ -290,8 +290,8 @@ switch (post('op')) {
|
||||
|
||||
// Duplicazione riga
|
||||
case 'copy_riga':
|
||||
$id_righe = (array)post('righe');
|
||||
|
||||
$id_righe = (array) post('righe');
|
||||
|
||||
foreach ($id_righe as $id_riga) {
|
||||
$riga = Articolo::find($id_riga) ?: Riga::find($id_riga);
|
||||
$riga = $riga ?: Descrizione::find($id_riga);
|
||||
@ -546,7 +546,7 @@ switch (post('op')) {
|
||||
$dir = 'entrata';
|
||||
|
||||
if (!empty($barcode)) {
|
||||
$id_articolo = $dbo->selectOne('mg_articoli', 'id', ['deleted_at' => null, 'attivo' => 1, 'barcode' => $barcode])['id'];
|
||||
$id_articolo = $dbo->selectOne('mg_articoli', 'id', ['deleted_at' => null, 'attivo' => 1, 'barcode' => $barcode])['id'];
|
||||
}
|
||||
|
||||
if (!empty($id_articolo)) {
|
||||
@ -566,7 +566,7 @@ switch (post('op')) {
|
||||
$id_iva = ($contratto->anagrafica->idiva_vendite ?: $originale->idiva_vendita) ?: setting('Iva predefinita');
|
||||
$id_anagrafica = $contratto->idanagrafica;
|
||||
$prezzi_ivati = setting('Utilizza prezzi di vendita comprensivi di IVA');
|
||||
|
||||
|
||||
// CALCOLO PREZZO UNITARIO
|
||||
$prezzo_unitario = 0;
|
||||
$sconto = 0;
|
||||
@ -589,7 +589,7 @@ switch (post('op')) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (empty($prezzo_unitario)) {
|
||||
// Prezzi listini clienti
|
||||
$listino = $dbo->fetchOne('SELECT sconto_percentuale AS sconto_percentuale_listino, '.($prezzi_ivati ? 'prezzo_unitario_ivato' : 'prezzo_unitario').' AS prezzo_unitario_listino
|
||||
@ -617,7 +617,6 @@ switch (post('op')) {
|
||||
$articolo->setProvvigione($provvigione ?: 0, 'PRC');
|
||||
$articolo->save();
|
||||
|
||||
|
||||
flash()->info(tr('Nuovo articolo aggiunto!'));
|
||||
} else {
|
||||
$response['error'] = tr('Nessun articolo corrispondente a magazzino');
|
||||
@ -653,7 +652,7 @@ switch (post('op')) {
|
||||
$articolo = Articolo::build($fattura, $originale);
|
||||
$articolo->id_dettaglio_fornitore = post('id_dettaglio_fornitore') ?: null;
|
||||
}
|
||||
|
||||
|
||||
if ($articolo['prezzo_unitario'] != $riga['price']) {
|
||||
$articolo->setPrezzoUnitario($riga['price'], $articolo->idiva);
|
||||
$articolo->save();
|
||||
@ -665,7 +664,7 @@ switch (post('op')) {
|
||||
flash()->info(tr('_NUM_ prezzi modificati!', [
|
||||
'_NUM_' => $numero_totale,
|
||||
]));
|
||||
} else if ($numero_totale == 1) {
|
||||
} elseif ($numero_totale == 1) {
|
||||
flash()->info(tr('_NUM_ prezzo modificato!', [
|
||||
'_NUM_' => $numero_totale,
|
||||
]));
|
||||
@ -674,4 +673,4 @@ switch (post('op')) {
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -130,13 +130,12 @@ switch (post('op')) {
|
||||
case 'renew_contratto':
|
||||
$numero_totale = 0;
|
||||
|
||||
|
||||
// Lettura righe selezionate
|
||||
foreach ($id_records as $id) {
|
||||
$contratto = Contratto::find($id);
|
||||
$rinnova = !empty($contratto->data_accettazione) && !empty($contratto->data_conclusione) && $contratto->data_accettazione != '0000-00-00' && $contratto->data_conclusione != '0000-00-00' && $contratto->stato->is_completato && $contratto->rinnovabile;
|
||||
|
||||
if($rinnova) {
|
||||
if ($rinnova) {
|
||||
$diff = $contratto->data_conclusione->diffAsCarbonInterval($contratto->data_accettazione);
|
||||
|
||||
$new_contratto = $contratto->replicate();
|
||||
@ -208,7 +207,7 @@ switch (post('op')) {
|
||||
// Cambio stato precedente contratto in concluso (non più pianificabile)
|
||||
$dbo->query('UPDATE `co_contratti` SET `rinnovabile`= 0, `idstato`= (SELECT id FROM co_staticontratti WHERE descrizione = \'Concluso\') WHERE `id` = '.prepare($contratto->id));
|
||||
|
||||
$numero_totale++;
|
||||
++$numero_totale;
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,20 +222,20 @@ switch (post('op')) {
|
||||
|
||||
case 'cambia_stato':
|
||||
$id_stato = post('id_stato');
|
||||
|
||||
|
||||
$n_contratti = 0;
|
||||
$stato = StatoContratto::find($id_stato);
|
||||
|
||||
|
||||
// Lettura righe selezionate
|
||||
foreach ($id_records as $id) {
|
||||
$contratto = Contratto::find($id);
|
||||
|
||||
|
||||
$contratto->stato()->associate($stato);
|
||||
$contratto->save();
|
||||
|
||||
|
||||
++$n_contratti;
|
||||
}
|
||||
|
||||
|
||||
if ($n_contratti > 0) {
|
||||
flash()->info(tr('Stato aggiornato a _NUM_ contratti!', [
|
||||
'_NUM_' => $n_contratti,
|
||||
@ -244,7 +243,7 @@ switch (post('op')) {
|
||||
} else {
|
||||
flash()->warning(tr('Nessuno stato aggiornato!'));
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -253,7 +252,7 @@ $operations['crea_fattura'] = [
|
||||
'data' => [
|
||||
'title' => tr('Fatturare i _TYPE_ selezionati?', ['_TYPE_' => strtolower($module['name'])]),
|
||||
'msg' => '{[ "type": "checkbox", "label": "<small>'.tr('Aggiungere alle fatture di vendita non ancora emesse?').'</small>", "placeholder": "'.tr('Aggiungere alle fatture esistenti non ancora emesse?').'", "name": "accodare" ]}<br>
|
||||
{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "ajax-source": "segmenti", "select-options": '.json_encode(["id_module" => $id_fatture, 'is_sezionale' => 1]).', "value": "'.$id_segment.'", "select-options-escape": true ]}<br>
|
||||
{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "ajax-source": "segmenti", "select-options": '.json_encode(['id_module' => $id_fatture, 'is_sezionale' => 1]).', "value": "'.$id_segment.'", "select-options-escape": true ]}<br>
|
||||
{[ "type": "select", "label": "'.tr('Tipo documento').'", "name": "idtipodocumento", "required": 1, "values": "query=SELECT id, CONCAT(codice_tipo_documento_fe, \' - \', descrizione) AS descrizione FROM co_tipidocumento WHERE enabled = 1 AND dir =\'entrata\' ORDER BY codice_tipo_documento_fe", "value": "'.$idtipodocumento.'" ]}',
|
||||
'button' => tr('Procedi'),
|
||||
'class' => 'btn btn-lg btn-warning',
|
||||
|
@ -52,4 +52,4 @@ echo '
|
||||
echo '
|
||||
<button type="button" class="btn btn-primary ask" data-title="'.tr('Duplicare questo contratto?').'" data-msg="'.tr('Clicca su tasto duplica per procedere.').'" data-op="copy" data-button="'.tr('Duplica').'" data-class="btn btn-lg btn-primary" data-backto="record-edit">
|
||||
<i class="fa fa-copy"></i> '.tr('Duplica contratto').'
|
||||
</button>';
|
||||
</button>';
|
||||
|
@ -21,7 +21,7 @@ include_once __DIR__.'/../../core.php';
|
||||
|
||||
$block_edit = $record['is_completato'];
|
||||
|
||||
if (strtotime($record['data_conclusione']) < strtotime($record['data_accettazione']) && !empty(strtotime($record['data_accettazione'])) && !empty(strtotime($record['data_conclusione'])) ) {
|
||||
if (strtotime($record['data_conclusione']) < strtotime($record['data_accettazione']) && !empty(strtotime($record['data_accettazione'])) && !empty(strtotime($record['data_conclusione']))) {
|
||||
echo '
|
||||
<div class="alert alert-warning"><a class="clickable" onclick="$(\'.alert\').hide();"><i class="fa fa-times"></i></a> '.tr('Attenzione! La data di accettazione supera la data di conclusione del contratto. Verificare le informazioni inserite.').'</div>';
|
||||
}
|
||||
@ -135,15 +135,14 @@ echo '
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<?php
|
||||
echo input([
|
||||
<?php echo input([
|
||||
'type' => 'ckeditor',
|
||||
'use_full_ckeditor' => 0,
|
||||
'label' => tr('Condizioni generali di fornitura'),
|
||||
'name' => 'condizioni_fornitura',
|
||||
'value' => $record['condizioni_fornitura'],
|
||||
]);
|
||||
?>
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -88,8 +88,8 @@ $righe = $dbo->fetchArray(
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td><?= $riga['codice'] ?></td>
|
||||
<td><?= $riga['descrizione'] ?></td>
|
||||
<td><?php echo $riga['codice']; ?></td>
|
||||
<td><?php echo $riga['descrizione']; ?></td>
|
||||
<td>
|
||||
<div>
|
||||
{[ "type": "number", "label": "", "data-id":"<?php echo $riga['id']; ?>","name": "nuovo_prezzo_unitario[]", "value": "<?php echo numberFormat($riga['prezzo_unitario'], 2); ?>"]}
|
||||
@ -97,14 +97,14 @@ $righe = $dbo->fetchArray(
|
||||
</td>
|
||||
<td class="text-center"><?php
|
||||
if (isset($ultimo_prezzo_preventivo)) {
|
||||
echo moneyFormat($ultimo_prezzo_preventivo['prezzo_unitario'], 2) . (!empty($ultimo_prezzo_preventivo['updated_at']) ? ' <br><small class="help-block tip" title="'.dateFormat($ultimo_prezzo_preventivo['updated_at']).'">' . (new Carbon($ultimo_prezzo_preventivo['updated_at']))->diffForHumans().'</small>' : '');
|
||||
echo moneyFormat($ultimo_prezzo_preventivo['prezzo_unitario'], 2).(!empty($ultimo_prezzo_preventivo['updated_at']) ? ' <br><small class="help-block tip" title="'.dateFormat($ultimo_prezzo_preventivo['updated_at']).'">'.(new Carbon($ultimo_prezzo_preventivo['updated_at']))->diffForHumans().'</small>' : '');
|
||||
} else {
|
||||
echo 'n.d.';
|
||||
}
|
||||
?></td>
|
||||
<td class="text-center"><?php
|
||||
if (isset($ultimo_prezzo_vendita)) {
|
||||
echo moneyFormat($ultimo_prezzo_vendita['prezzo_unitario'], 2) . (!empty($ultimo_prezzo_vendita['updated_at']) ? ' <br><small class="help-block tip" title="'.dateFormat($ultimo_prezzo_vendita['updated_at']).'">' . (new Carbon($ultimo_prezzo_vendita['updated_at']))->diffForHumans().'</small>' : '');
|
||||
echo moneyFormat($ultimo_prezzo_vendita['prezzo_unitario'], 2).(!empty($ultimo_prezzo_vendita['updated_at']) ? ' <br><small class="help-block tip" title="'.dateFormat($ultimo_prezzo_vendita['updated_at']).'">'.(new Carbon($ultimo_prezzo_vendita['updated_at']))->diffForHumans().'</small>' : '');
|
||||
} else {
|
||||
echo 'n.d.';
|
||||
}
|
||||
|
@ -23,9 +23,8 @@ use Modules\Contratti\Contratto;
|
||||
use Modules\Interventi\Intervento;
|
||||
|
||||
/**
|
||||
* Calcolo imponibile contratto (totale_righe - sconto)
|
||||
* Calcolo imponibile contratto (totale_righe - sconto).
|
||||
*/
|
||||
|
||||
function get_imponibile_contratto($idcontratto)
|
||||
{
|
||||
$contratto = Contratto::find($idcontratto);
|
||||
@ -33,10 +32,8 @@ function get_imponibile_contratto($idcontratto)
|
||||
return $contratto->totale_imponibile;
|
||||
}
|
||||
|
||||
|
||||
function get_totale_interventi_contratto($idcontratto)
|
||||
{
|
||||
|
||||
$interventi = Intervento::where('id_contratto', $idcontratto)->get();
|
||||
$array_interventi = $interventi->toArray();
|
||||
|
||||
|
@ -57,7 +57,7 @@ if (!empty($interventi)) {
|
||||
</td>
|
||||
|
||||
<td class="text-right">
|
||||
'.($intervento->ore_totali<=0 ? '<i class="fa fa-warning tip" style="position:relative;margin-left:-16px;" title="'.tr("Questa sessione è vuota").'" ></i> ': '' ).numberFormat($intervento->ore_totali).'
|
||||
'.($intervento->ore_totali <= 0 ? '<i class="fa fa-warning tip" style="position:relative;margin-left:-16px;" title="'.tr('Questa sessione è vuota').'" ></i> ' : '').numberFormat($intervento->ore_totali).'
|
||||
</td>
|
||||
|
||||
<td class="text-right">
|
||||
@ -119,7 +119,7 @@ if (!empty($interventi)) {
|
||||
$tipologie[$sessione->tipo->descrizione]['ore'] += $sessione->ore;
|
||||
$tipologie[$sessione->tipo->descrizione]['costo'] += $sessione->costo_manodopera + $sessione->costo_viaggio + $sessione->costo_diritto_chiamata;
|
||||
$tipologie[$sessione->tipo->descrizione]['ricavo'] += $sessione->prezzo_manodopera - $sessione->sconto_totale_manodopera + $sessione->prezzo_viaggio - $sessione->sconto_totale_viaggio + $sessione->prezzo_diritto_chiamata - $sessione->sconto_totale_viaggio;
|
||||
|
||||
|
||||
// Raggruppamento per tecnico
|
||||
$tecnici[$sessione->anagrafica->ragione_sociale]['ore'] += $sessione->ore;
|
||||
$tecnici[$sessione->anagrafica->ragione_sociale]['km'] += $sessione->km;
|
||||
@ -340,18 +340,18 @@ if (empty($totale_ore_contratto)) {
|
||||
<th width="10%">'.tr('Ricarico').'</th>
|
||||
</tr>';
|
||||
ksort($tipologie);
|
||||
foreach ($tipologie as $key => $tipologia){
|
||||
foreach ($tipologie as $key => $tipologia) {
|
||||
$margine = $tipologia['ricavo'] - $tipologia['costo'];
|
||||
$margine_prc = (int)(1 - ($tipologia['costo'] / $tipologia['ricavo'])) * 100;
|
||||
$ricarico_prc = ($tipologia['ricavo'] && $tipologia['costo']) ? (int)((($tipologia['ricavo'] / $tipologia['costo']) - 1) * 100) : 100;
|
||||
$margine_prc = (int) (1 - ($tipologia['costo'] / $tipologia['ricavo'])) * 100;
|
||||
$ricarico_prc = ($tipologia['ricavo'] && $tipologia['costo']) ? (int) ((($tipologia['ricavo'] / $tipologia['costo']) - 1) * 100) : 100;
|
||||
echo '
|
||||
<tr>
|
||||
<td>'.$key.'</td>
|
||||
<td class="text-right">'.Translator::numberToLocale($tipologia['ore']).'</td>
|
||||
<td class="text-right">'.Translator::numberToLocale($tipologia['costo']).' €</td>
|
||||
<td class="text-right">'.Translator::numberToLocale($tipologia['ricavo']).' €</td>
|
||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||
<td class="text-right '.($margine > 0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||
<td class="text-right '.($margine > 0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||
</tr>';
|
||||
}
|
||||
echo '
|
||||
@ -370,19 +370,19 @@ if (empty($totale_ore_contratto)) {
|
||||
<th width="10%">'.tr('Ricarico').'</th>
|
||||
</tr>';
|
||||
ksort($tecnici);
|
||||
foreach ($tecnici as $key => $tecnico){
|
||||
foreach ($tecnici as $key => $tecnico) {
|
||||
$margine = $tecnico['ricavo'] - $tecnico['costo'];
|
||||
$margine_prc = (int)(1 - ($tecnico['costo'] / $tecnico['ricavo'])) * 100;
|
||||
$ricarico_prc = ($tecnico['ricavo'] && $tecnico['costo']) ? (int)((($tecnico['ricavo'] / $tecnico['costo']) - 1) * 100) : 100;
|
||||
$margine_prc = (int) (1 - ($tecnico['costo'] / $tecnico['ricavo'])) * 100;
|
||||
$ricarico_prc = ($tecnico['ricavo'] && $tecnico['costo']) ? (int) ((($tecnico['ricavo'] / $tecnico['costo']) - 1) * 100) : 100;
|
||||
echo '
|
||||
<tr>
|
||||
<td>'.$key.'</td>
|
||||
<td class="text-right">'.(int)$tecnico['km'].'</td>
|
||||
<td class="text-right">'.(int) $tecnico['km'].'</td>
|
||||
<td class="text-right">'.Translator::numberToLocale($tecnico['ore']).'</td>
|
||||
<td class="text-right">'.Translator::numberToLocale($tecnico['costo']).' €</td>
|
||||
<td class="text-right">'.Translator::numberToLocale($tecnico['ricavo']).' €</td>
|
||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||
<td class="text-right '.($margine > 0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||
<td class="text-right '.($margine > 0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||
</tr>';
|
||||
}
|
||||
echo '
|
||||
@ -402,18 +402,18 @@ if (empty($totale_ore_contratto)) {
|
||||
<th width="10%">'.tr('Ricarico').'</th>
|
||||
</tr>';
|
||||
ksort($stati_intervento);
|
||||
foreach ($stati_intervento as $key => $stato){
|
||||
foreach ($stati_intervento as $key => $stato) {
|
||||
$margine = $stato['ricavo'] - $stato['costo'];
|
||||
$margine_prc = (int)(1 - ($stato['costo'] / $stato['ricavo'])) * 100;
|
||||
$ricarico_prc = ($stato['ricavo'] && $stato['costo']) ? (int)((($stato['ricavo'] / $stato['costo']) - 1) * 100) : 100;
|
||||
$margine_prc = (int) (1 - ($stato['costo'] / $stato['ricavo'])) * 100;
|
||||
$ricarico_prc = ($stato['ricavo'] && $stato['costo']) ? (int) ((($stato['ricavo'] / $stato['costo']) - 1) * 100) : 100;
|
||||
echo '
|
||||
<tr>
|
||||
<td><div class="img-circle" style="width:18px; height:18px; position:relative; bottom:-2px; background:'.$stato['colore'].'; float:left;"></div> '.$key.'</td>
|
||||
<td class="text-right">'.Translator::numberToLocale($stato['ore']).'</td>
|
||||
<td class="text-right">'.Translator::numberToLocale($stato['costo']).' €</td>
|
||||
<td class="text-right">'.Translator::numberToLocale($stato['ricavo']).' €</td>
|
||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||
<td class="text-right '.($margine > 0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||
<td class="text-right '.($margine > 0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||
</tr>';
|
||||
}
|
||||
echo '
|
||||
@ -431,38 +431,38 @@ if (empty($totale_ore_contratto)) {
|
||||
<th width="10%">'.tr('Ricarico').'</th>
|
||||
</tr>';
|
||||
ksort($materiali_art);
|
||||
foreach ($materiali_art as $key => $materiali_array1){
|
||||
foreach ($materiali_array1 as $materiali_array2){
|
||||
foreach ($materiali_array2 as $materiale){
|
||||
foreach ($materiali_art as $key => $materiali_array1) {
|
||||
foreach ($materiali_array1 as $materiali_array2) {
|
||||
foreach ($materiali_array2 as $materiale) {
|
||||
$margine = $materiale['ricavo'] - $materiale['costo'];
|
||||
$margine_prc = (int)(1 - ($materiale['costo'] / $materiale['ricavo'])) * 100;
|
||||
$ricarico_prc = ($materiale['ricavo'] && $materiale['costo']) ? (int)((($materiale['ricavo'] / $materiale['costo']) - 1) * 100) : 100;
|
||||
echo '
|
||||
$margine_prc = (int) (1 - ($materiale['costo'] / $materiale['ricavo'])) * 100;
|
||||
$ricarico_prc = ($materiale['ricavo'] && $materiale['costo']) ? (int) ((($materiale['ricavo'] / $materiale['costo']) - 1) * 100) : 100;
|
||||
echo '
|
||||
<tr>
|
||||
<td>'.Modules::link('Articoli', $materiale['id'], $key).'</td>
|
||||
<td class="text-center">'.$materiale['qta'].'</td>
|
||||
<td class="text-right">'.Translator::numberToLocale($materiale['costo']).' €</td>
|
||||
<td class="text-right">'.Translator::numberToLocale($materiale['ricavo']).' €</td>
|
||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||
<td class="text-right '.($margine > 0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||
<td class="text-right '.($margine > 0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ksort($materiali_righe);
|
||||
foreach ($materiali_righe as $key => $materiale){
|
||||
foreach ($materiali_righe as $key => $materiale) {
|
||||
$margine = $materiale['ricavo'] - $materiale['costo'];
|
||||
$margine_prc = (int)(1 - ($materiale['costo'] / $materiale['ricavo'])) * 100;
|
||||
$ricarico_prc = ($materiale['ricavo'] && $materiale['costo']) ? (int)((($materiale['ricavo'] / $materiale['costo']) - 1) * 100) : 100;
|
||||
$margine_prc = (int) (1 - ($materiale['costo'] / $materiale['ricavo'])) * 100;
|
||||
$ricarico_prc = ($materiale['ricavo'] && $materiale['costo']) ? (int) ((($materiale['ricavo'] / $materiale['costo']) - 1) * 100) : 100;
|
||||
echo '
|
||||
<tr>
|
||||
<td>'.$key.'</td>
|
||||
<td class="text-center">'.$materiale['qta'].'</td>
|
||||
<td class="text-right">'.Translator::numberToLocale($materiale['costo']).' €</td>
|
||||
<td class="text-right">'.Translator::numberToLocale($materiale['ricavo']).' €</td>
|
||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||
<td class="text-right '.($margine > 0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||
<td class="text-right '.($margine > 0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||
</tr>';
|
||||
}
|
||||
echo '
|
||||
|
@ -56,7 +56,7 @@ $result = [
|
||||
];
|
||||
|
||||
// Leggo la provvigione predefinita per l'anagrafica
|
||||
$result['provvigione_default'] = $dbo->fetchOne('SELECT provvigione_default FROM an_anagrafiche WHERE idanagrafica='.prepare($documento->idagente))['provvigione_default'];
|
||||
$result['provvigione_default'] = $dbo->fetchOne('SELECT provvigione_default FROM an_anagrafiche WHERE idanagrafica='.prepare($documento->idagente))['provvigione_default'];
|
||||
|
||||
// Leggo l'iva predefinita per l'anagrafica e se non c'è leggo quella predefinita generica
|
||||
$iva = $dbo->fetchArray('SELECT idiva_vendite AS idiva FROM an_anagrafiche WHERE idanagrafica='.prepare($documento['idanagrafica']));
|
||||
|
@ -59,11 +59,11 @@ foreach ($righe as $riga) {
|
||||
echo '
|
||||
<tr data-id="'.$riga->id.'" data-type="'.get_class($riga).'">
|
||||
<td class="text-center">';
|
||||
if (!$block_edit) {
|
||||
echo '
|
||||
if (!$block_edit) {
|
||||
echo '
|
||||
<input class="check" type="checkbox"/>';
|
||||
}
|
||||
echo '
|
||||
}
|
||||
echo '
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
@ -90,13 +90,13 @@ foreach ($righe as $riga) {
|
||||
if ($riga->isArticolo() && !empty($riga->articolo->barcode)) {
|
||||
echo '
|
||||
<br><small><i class="fa fa-barcode"></i> '.$riga->articolo->barcode.'</small>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!empty($riga->note)) {
|
||||
echo '
|
||||
<br><small class="label label-default">'.nl2br($riga->note).'</small>';
|
||||
}
|
||||
echo '
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
if ($riga->isDescrizione()) {
|
||||
@ -106,38 +106,38 @@ foreach ($righe as $riga) {
|
||||
<td></td>
|
||||
<td></td>';
|
||||
} else {
|
||||
// Quantità e unità di misura
|
||||
echo '
|
||||
// Quantità e unità di misura
|
||||
echo '
|
||||
<td class="text-center">
|
||||
{[ "type": "number", "name": "qta_'.$riga->id.'", "value": "'.$riga->qta.'", "min-value": "0", "onchange": "aggiornaInline($(this).closest(\'tr\').data(\'id\'))", "icon-after": "<span class=\'tip\' title=\''.tr('Quantità evasa').' / '.tr('totale').': '.tr('_QTA_ / _TOT_', ['_QTA_' => numberFormat($riga->qta_evasa, 'qta'), '_TOT_' => numberFormat($riga->qta, 'qta')]).'\'>'.$riga->um.' <small><i class=\'text-muted fa fa-info-circle\'></i></small></span>", "disabled": "'.($riga->isSconto() ? 1 : 0).'", "disabled": "'.$block_edit.'" ]}
|
||||
<div class="progress" style="height:4px;">';
|
||||
// Visualizzazione evasione righe per documento
|
||||
$evasione_bar = [];
|
||||
$evasione_bar['dt_righe_ddt'] = 'info';
|
||||
$evasione_bar['co_righe_documenti'] = 'primary';
|
||||
$evasione_bar['in_righe_interventi'] = 'warning';
|
||||
$evasione_bar['or_righe_ordini'] = 'success';
|
||||
foreach ($evasione_bar as $table => $color) {
|
||||
$righe_ev = $dbo->table($table)->where('original_id', $riga->id)->where('original_type', get_class($riga))->get();
|
||||
$perc_ev = $righe_ev->sum('qta') * 100 / $riga->qta;
|
||||
if ($perc_ev > 0) {
|
||||
echo '
|
||||
// Visualizzazione evasione righe per documento
|
||||
$evasione_bar = [];
|
||||
$evasione_bar['dt_righe_ddt'] = 'info';
|
||||
$evasione_bar['co_righe_documenti'] = 'primary';
|
||||
$evasione_bar['in_righe_interventi'] = 'warning';
|
||||
$evasione_bar['or_righe_ordini'] = 'success';
|
||||
foreach ($evasione_bar as $table => $color) {
|
||||
$righe_ev = $dbo->table($table)->where('original_id', $riga->id)->where('original_type', get_class($riga))->get();
|
||||
$perc_ev = $righe_ev->sum('qta') * 100 / $riga->qta;
|
||||
if ($perc_ev > 0) {
|
||||
echo '
|
||||
<div class="progress-bar progress-bar-'.$color.'" style="width:'.$perc_ev.'%"></div>';
|
||||
}
|
||||
}
|
||||
echo '
|
||||
}
|
||||
}
|
||||
echo '
|
||||
</div>
|
||||
</td>';
|
||||
|
||||
// Prezzi unitari
|
||||
echo '
|
||||
<td class="text-right">';
|
||||
// Provvigione riga
|
||||
if (abs($riga->provvigione_unitaria) > 0) {
|
||||
$text = provvigioneInfo($riga);
|
||||
echo '<span class="pull-left text-info" title="'.$text.'"><i class="fa fa-handshake-o"></i></span>';
|
||||
}
|
||||
echo moneyFormat($riga->prezzo_unitario_corrente);
|
||||
// Provvigione riga
|
||||
if (abs($riga->provvigione_unitaria) > 0) {
|
||||
$text = provvigioneInfo($riga);
|
||||
echo '<span class="pull-left text-info" title="'.$text.'"><i class="fa fa-handshake-o"></i></span>';
|
||||
}
|
||||
echo moneyFormat($riga->prezzo_unitario_corrente);
|
||||
|
||||
if ($dir == 'entrata' && $riga->costo_unitario != 0) {
|
||||
echo '
|
||||
@ -155,7 +155,7 @@ foreach ($righe as $riga) {
|
||||
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
|
||||
// Sconto unitario
|
||||
if (!$block_edit) {
|
||||
echo '
|
||||
@ -169,8 +169,8 @@ foreach ($righe as $riga) {
|
||||
<td class="text-right">
|
||||
'.moneyFormat($riga->importo);
|
||||
|
||||
// Iva
|
||||
echo '
|
||||
// Iva
|
||||
echo '
|
||||
<br><small class="'.(($riga->aliquota->deleted_at) ? 'text-red' : '').' text-muted">'.$riga->aliquota->descrizione.(($riga->aliquota->esente) ? ' ('.$riga->aliquota->codice_natura_fe.')' : null).'</small>
|
||||
</td>';
|
||||
}
|
||||
@ -304,7 +304,7 @@ if ($totale != $netto_a_pagare) {
|
||||
}
|
||||
|
||||
// Provvigione
|
||||
if(!empty($contratto->provvigione)) {
|
||||
if (!empty($contratto->provvigione)) {
|
||||
echo '
|
||||
<tr>
|
||||
<td colspan="'.$colspan.'" class="text-right">
|
||||
@ -325,7 +325,7 @@ if(!empty($contratto->provvigione)) {
|
||||
'.moneyFormat($netto_a_pagare - $contratto->provvigione, 2).'
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>';
|
||||
</tr>';
|
||||
}
|
||||
|
||||
echo '
|
||||
|
@ -257,7 +257,7 @@ class Contratto extends Document
|
||||
$interventi = $this->interventi;
|
||||
$stato_intervento = \Modules\Interventi\Stato::where('codice', $codice_intervento)->first();
|
||||
foreach ($interventi as $intervento) {
|
||||
if ($intervento->stato->is_completato==1) {
|
||||
if ($intervento->stato->is_completato == 1) {
|
||||
$intervento->stato()->associate($stato_intervento);
|
||||
$intervento->save();
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ if (!empty($rs)) {
|
||||
}
|
||||
} else {
|
||||
$scadenza = tr('scaduto da _DAYS_ giorni');
|
||||
}
|
||||
}
|
||||
|
||||
$scadenza = str_replace('_DAYS_', abs($r['giorni_rimanenti']), $scadenza);
|
||||
|
||||
|
@ -42,14 +42,14 @@ include_once __DIR__.'/../../core.php';
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<?php
|
||||
echo input([
|
||||
echo input([
|
||||
'type' => 'textarea',
|
||||
'label' => tr('Codice'),
|
||||
'name' => 'content',
|
||||
'required' => 1,
|
||||
'required' => 1,
|
||||
'value' => '{[ "type": "text", "label": "|label|", "name": "|name|", "value": "|value|" ]}',
|
||||
]);
|
||||
?>
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -58,13 +58,13 @@ include_once __DIR__.'/../../core.php';
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<?php
|
||||
echo input([
|
||||
'type' => 'textarea',
|
||||
'label' => tr('Codice'),
|
||||
'name' => 'content',
|
||||
'value' => $record['content'],
|
||||
]);
|
||||
?>
|
||||
echo input([
|
||||
'type' => 'textarea',
|
||||
'label' => tr('Codice'),
|
||||
'name' => 'content',
|
||||
'value' => $record['content'],
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -189,11 +189,11 @@ switch (filter('op')) {
|
||||
WHERE
|
||||
`zz_events`.`is_bank_holiday` = 0
|
||||
AND (`zz_events`.`is_recurring` = 1 AND
|
||||
DAYOFYEAR(`zz_events`.`data`) BETWEEN DAYOFYEAR('.prepare($start).') AND IF(YEAR('.prepare($start).') = YEAR('.prepare($end).'), DAYOFYEAR('.prepare($end).'), DAYOFYEAR('.prepare(date('Y-m-d', strtotime($end. '-1 day'))).'))
|
||||
DAYOFYEAR(`zz_events`.`data`) BETWEEN DAYOFYEAR('.prepare($start).') AND IF(YEAR('.prepare($start).') = YEAR('.prepare($end).'), DAYOFYEAR('.prepare($end).'), DAYOFYEAR('.prepare(date('Y-m-d', strtotime($end.'-1 day'))).'))
|
||||
)
|
||||
OR
|
||||
(`zz_events`.`is_recurring` = 0 AND `zz_events`.`data` >= '.prepare($start).' AND `zz_events`.`data` <= '.prepare($end).')';
|
||||
|
||||
|
||||
//echo $query;
|
||||
|
||||
$eventi = $dbo->fetchArray($query);
|
||||
@ -202,7 +202,7 @@ switch (filter('op')) {
|
||||
$results[] = [
|
||||
'id' => $modulo_eventi->id.'_'.$evento['id'],
|
||||
'title' => '<b>'.tr('Evento').':</b> '.$evento['nome'].'</b>',
|
||||
'start' => ($evento['is_recurring'] ? date('Y-', strtotime($start)).date('m-d', strtotime($evento['data'])): $evento['data']),
|
||||
'start' => ($evento['is_recurring'] ? date('Y-', strtotime($start)).date('m-d', strtotime($evento['data'])) : $evento['data']),
|
||||
//'end' => $evento['data'],
|
||||
'extendedProps' => [
|
||||
'link' => base_path().'/editor.php?id_module='.$modulo_eventi->id.'&id_record='.$evento['id'],
|
||||
@ -343,14 +343,13 @@ switch (filter('op')) {
|
||||
|
||||
$rs = $dbo->fetchArray($query);
|
||||
|
||||
if (!empty($rs[0]['cliente'])){
|
||||
if (!empty($rs[0]['cliente'])) {
|
||||
$tooltip = '<b>Prev. '.$rs[0]['numero'].'</b> '.$rs[0]['nome'].''.(($rs[0]['have_attachments']) ? ' <i class="fa fa-paperclip" aria-hidden="true"></i>' : '').'<br><b>'.tr('Cliente').':</b> '.$rs[0]['cliente'];
|
||||
}else{
|
||||
$tooltip = tr('Rilascia per aggiungere l\'attività...');
|
||||
} else {
|
||||
$tooltip = tr('Rilascia per aggiungere l\'attività...');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$tooltip .= '
|
||||
<script type="text/javascript">
|
||||
$(".shorten").shorten({
|
||||
@ -359,10 +358,8 @@ switch (filter('op')) {
|
||||
showChars : 200
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
||||
|
||||
echo $tooltip;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
@ -479,7 +476,6 @@ switch (filter('op')) {
|
||||
break;
|
||||
|
||||
case 'calendario_eventi':
|
||||
|
||||
$start = filter('start');
|
||||
$end = filter('end');
|
||||
|
||||
@ -488,20 +484,20 @@ switch (filter('op')) {
|
||||
WHERE `zz_events`.`is_bank_holiday` = 1
|
||||
AND
|
||||
(`zz_events`.`is_recurring` = 1
|
||||
AND DAYOFYEAR(`zz_events`.`data`) BETWEEN DAYOFYEAR('.prepare($start).') AND IF(YEAR('.prepare($start).') = YEAR('.prepare($end).'), DAYOFYEAR('.prepare($end).'), DAYOFYEAR('.prepare(date('Y-m-d', strtotime($end. '-1 day'))).')) )
|
||||
AND DAYOFYEAR(`zz_events`.`data`) BETWEEN DAYOFYEAR('.prepare($start).') AND IF(YEAR('.prepare($start).') = YEAR('.prepare($end).'), DAYOFYEAR('.prepare($end).'), DAYOFYEAR('.prepare(date('Y-m-d', strtotime($end.'-1 day'))).')) )
|
||||
OR
|
||||
(`zz_events`.`is_recurring` = 0 AND `zz_events`.`data` >= '.prepare($start).' AND `zz_events`.`data` <= '.prepare($end).')';
|
||||
|
||||
$eventi = $dbo->fetchArray($query);
|
||||
|
||||
|
||||
$results = [];
|
||||
foreach ($eventi as $evento) {
|
||||
$results[] = [
|
||||
'id' => $evento['id'],
|
||||
'title' => $evento['nome'],
|
||||
'start' => ($evento['is_recurring'] ? date('Y-', strtotime($start)).date('m-d', strtotime($evento['data'])): $evento['data']),
|
||||
'start' => ($evento['is_recurring'] ? date('Y-', strtotime($start)).date('m-d', strtotime($evento['data'])) : $evento['data']),
|
||||
//'end' => date('Y-m-d', strtotime($evento['data']. '+1 day')),
|
||||
'display' => "background",
|
||||
'display' => 'background',
|
||||
'allDay' => true,
|
||||
'overlap' => true,
|
||||
];
|
||||
|
@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
// Individuazione dati selezionabili
|
||||
@ -47,7 +48,7 @@ if (!isset($_SESSION['dashboard']['idtecnici'])) {
|
||||
$_SESSION['dashboard']['idtecnici'] = ["'-1'"];
|
||||
|
||||
foreach ($tecnici_disponibili as $tecnico) {
|
||||
if(($user['gruppo']=='Tecnici' && $user['idanagrafica']==$tecnico['id']) || $user['gruppo']!='Tecnici'){
|
||||
if (($user['gruppo'] == 'Tecnici' && $user['idanagrafica'] == $tecnico['id']) || $user['gruppo'] != 'Tecnici') {
|
||||
$_SESSION['dashboard']['idtecnici'][] = "'".$tecnico['id']."'";
|
||||
}
|
||||
}
|
||||
@ -315,9 +316,8 @@ WHERE (SELECT COUNT(*) FROM in_interventi_tecnici WHERE in_interventi_tecnici.id
|
||||
$chiave = $data->format('mY');
|
||||
$testo = $data->formatLocalized('%B %Y');
|
||||
|
||||
|
||||
if (checkdate($data->format('m'), $data->format('d'), $data->format('Y'))){
|
||||
echo '
|
||||
if (checkdate($data->format('m'), $data->format('d'), $data->format('Y'))) {
|
||||
echo '
|
||||
<option value="'.$chiave.'">'.ucfirst($testo).'</option>';
|
||||
}
|
||||
}
|
||||
@ -347,15 +347,15 @@ $days = [
|
||||
4 => 'Giovedì',
|
||||
5 => 'Venerdì',
|
||||
6 => 'Sabato',
|
||||
0 => 'Domenica'
|
||||
0 => 'Domenica',
|
||||
];
|
||||
$working_days = explode(",",setting('Giorni lavorativi'));
|
||||
$working_days = explode(',', setting('Giorni lavorativi'));
|
||||
$non_working_days = [];
|
||||
|
||||
foreach ($days as $key => $day) {
|
||||
if (!in_array($day, $working_days)) {
|
||||
array_push($non_working_days, $key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$modulo_interventi = Modules::get('Interventi');
|
||||
@ -671,7 +671,7 @@ globals.dashboard = {
|
||||
});
|
||||
},';
|
||||
|
||||
if(isMobile() && setting('Utilizzare i tooltip sul calendario')){
|
||||
if (isMobile() && setting('Utilizzare i tooltip sul calendario')) {
|
||||
echo '
|
||||
eventClick: function(info) {
|
||||
let link = info.event.extendedProps.link;
|
||||
@ -688,7 +688,7 @@ if(isMobile() && setting('Utilizzare i tooltip sul calendario')){
|
||||
location.href = link;
|
||||
}
|
||||
},';
|
||||
}else{
|
||||
} else {
|
||||
echo '
|
||||
eventClick: function(info) {
|
||||
if (info.event.extendedProps.link !== undefined) {
|
||||
|
@ -58,7 +58,7 @@ foreach ($moduli as $module_id => $note) {
|
||||
<table class="table table-hover">
|
||||
<tr>
|
||||
<th width="15%" >'.tr('Riferimento').'</th>
|
||||
<th width="20%" >'.(($modulo->title == 'Fatture di acquisto' || $modulo->title == 'Ordini fornitore' || $modulo->title == 'Ddt in entrata') ? tr('Fornitore'): tr('Cliente')).'</th>
|
||||
<th width="20%" >'.(($modulo->title == 'Fatture di acquisto' || $modulo->title == 'Ordini fornitore' || $modulo->title == 'Ddt in entrata') ? tr('Fornitore') : tr('Cliente')).'</th>
|
||||
<th>'.tr('Contenuto').'</th>
|
||||
<th width="20%" class="text-center">'.tr('Data di notifica').'</th>
|
||||
<th class="text-center">#</th>
|
||||
@ -66,33 +66,33 @@ foreach ($moduli as $module_id => $note) {
|
||||
|
||||
foreach ($note as $nota) {
|
||||
$class = (strtotime($nota->notification_date) < strtotime(date('Y-m-d')) && !empty($nota->notification_date)) ? 'danger' : '';
|
||||
|
||||
|
||||
$documento = '';
|
||||
if ($modulo->title == 'Attività') {
|
||||
$documento = $dbo->fetchOne("SELECT in_interventi.codice AS numero, ragione_sociale FROM zz_notes INNER JOIN in_interventi ON (in_interventi.id = zz_notes.id_record AND zz_notes.id_module=(SELECT id FROM zz_modules WHERE title = 'Attività')) INNER JOIN an_anagrafiche ON an_anagrafiche.idanagrafica = in_interventi.idanagrafica");
|
||||
} else if ($modulo->title == 'Fatture di vendita') {
|
||||
} elseif ($modulo->title == 'Fatture di vendita') {
|
||||
$documento = $dbo->fetchOne("SELECT numero_esterno AS numero, ragione_sociale FROM zz_notes INNER JOIN co_documenti ON (co_documenti.id = zz_notes.id_record AND zz_notes.id_module=(SELECT id FROM zz_modules WHERE title = 'Fatture di vendita')) INNER JOIN an_anagrafiche ON an_anagrafiche.idanagrafica = co_documenti.idanagrafica");
|
||||
} else if ($modulo->title == 'Fatture di acquisto') {
|
||||
} elseif ($modulo->title == 'Fatture di acquisto') {
|
||||
$documento = $dbo->fetchOne("SELECT numero, ragione_sociale FROM zz_notes INNER JOIN co_documenti ON (co_documenti.id = zz_notes.id_record AND zz_notes.id_module=(SELECT id FROM zz_modules WHERE title = 'Fatture di acquisto')) INNER JOIN an_anagrafiche ON an_anagrafiche.idanagrafica = co_documenti.idanagrafica");
|
||||
} else if ($modulo->title == 'Preventivi') {
|
||||
} elseif ($modulo->title == 'Preventivi') {
|
||||
$documento = $dbo->fetchOne("SELECT numero, ragione_sociale FROM zz_notes INNER JOIN co_preventivi ON (co_preventivi.id = zz_notes.id_record AND zz_notes.id_module=(SELECT id FROM zz_modules WHERE title = 'Preventivi')) INNER JOIN an_anagrafiche ON an_anagrafiche.idanagrafica = co_preventivi.idanagrafica");
|
||||
} else if ($modulo->title == 'Contratti') {
|
||||
} elseif ($modulo->title == 'Contratti') {
|
||||
$documento = $dbo->fetchOne("SELECT numero, ragione_sociale FROM zz_notes INNER JOIN co_contratti ON (co_contratti.id = zz_notes.id_record AND zz_notes.id_module=(SELECT id FROM zz_modules WHERE title = 'Contratti')) INNER JOIN an_anagrafiche ON an_anagrafiche.idanagrafica = co_contratti.idanagrafica");
|
||||
} else if ($modulo->title == 'Ordini cliente') {
|
||||
} elseif ($modulo->title == 'Ordini cliente') {
|
||||
$documento = $dbo->fetchOne("SELECT numero_esterno as numero, ragione_sociale FROM zz_notes INNER JOIN or_ordini ON (or_ordini.id = zz_notes.id_record AND zz_notes.id_module=(SELECT id FROM zz_modules WHERE title = 'Ordini cliente')) INNER JOIN an_anagrafiche ON an_anagrafiche.idanagrafica = or_ordini.idanagrafica");
|
||||
} else if ($modulo->title == 'Ordini fornitore') {
|
||||
} elseif ($modulo->title == 'Ordini fornitore') {
|
||||
$documento = $dbo->fetchOne("SELECT numero, ragione_sociale FROM zz_notes INNER JOIN or_ordini ON (or_ordini.id = zz_notes.id_record AND zz_notes.id_module=(SELECT id FROM zz_modules WHERE title = 'Ordini fornitore')) INNER JOIN an_anagrafiche ON an_anagrafiche.idanagrafica = or_ordini.idanagrafica");
|
||||
} else if ($modulo->title == 'Ddt in uscita') {
|
||||
} elseif ($modulo->title == 'Ddt in uscita') {
|
||||
$documento = $dbo->fetchOne("SELECT numero_esterno as numero, ragione_sociale FROM zz_notes INNER JOIN dt_ddt ON (dt_ddt.id = zz_notes.id_record AND zz_notes.id_module=(SELECT id FROM zz_modules WHERE title = 'Ddt in uscita')) INNER JOIN an_anagrafiche ON an_anagrafiche.idanagrafica = dt_ddt.idanagrafica");
|
||||
} else if ($modulo->title == 'Ddt in entrata') {
|
||||
} elseif ($modulo->title == 'Ddt in entrata') {
|
||||
$documento = $dbo->fetchOne("SELECT numero, ragione_sociale FROM zz_notes INNER JOIN dt_ddt ON (dt_ddt.id = zz_notes.id_record AND zz_notes.id_module=(SELECT id FROM zz_modules WHERE title = 'Ddt in uscita')) INNER JOIN an_anagrafiche ON an_anagrafiche.idanagrafica = dt_ddt.idanagrafica");
|
||||
} else if ($modulo->title == 'Articoli') {
|
||||
} elseif ($modulo->title == 'Articoli') {
|
||||
$documento = $dbo->fetchOne("SELECT codice AS numero FROM zz_notes INNER JOIN mg_articoli ON (mg_articoli.id = zz_notes.id_record AND zz_notes.id_module=(SELECT id FROM zz_modules WHERE title = 'Articoli'))");
|
||||
} else if ($modulo->title == 'Impianti') {
|
||||
} elseif ($modulo->title == 'Impianti') {
|
||||
$documento = $dbo->fetchOne("SELECT matricola AS numero, ragione_sociale FROM zz_notes INNER JOIN my_impianti ON (my_impianti.id = zz_notes.id_record AND zz_notes.id_module=(SELECT id FROM zz_modules WHERE title = 'Impianti')) INNER JOIN an_anagrafiche ON an_anagrafiche.idanagrafica = my_impianti.idanagrafica");
|
||||
} else {
|
||||
$documento['numero'] = ' ';
|
||||
};
|
||||
}
|
||||
|
||||
echo '
|
||||
<tr class="'.$class.'">
|
||||
|
@ -19,8 +19,6 @@
|
||||
|
||||
include_once __DIR__.'/../../../core.php';
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
// Trovo id_print della stampa
|
||||
$id_print = Prints::getPrints()['Stampa calendario settimanale'];
|
||||
|
||||
|
@ -178,7 +178,7 @@ switch (filter('op')) {
|
||||
if ($dir == 'entrata') {
|
||||
$articolo->setProvvigione(post('provvigione'), post('tipo_provvigione'));
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
$articolo->qta = post('qta');
|
||||
} catch (UnexpectedValueException $e) {
|
||||
@ -322,7 +322,7 @@ switch (filter('op')) {
|
||||
$ddt->save();
|
||||
|
||||
$evadi_qta_parent = true;
|
||||
if ($documento->tipo->descrizione=='Ddt in uscita' || $documento->tipo->descrizione=='Ddt in entrata') {
|
||||
if ($documento->tipo->descrizione == 'Ddt in uscita' || $documento->tipo->descrizione == 'Ddt in entrata') {
|
||||
$evadi_qta_parent = false;
|
||||
}
|
||||
|
||||
@ -335,11 +335,11 @@ switch (filter('op')) {
|
||||
|
||||
// Aggiornamento seriali dalla riga dell'ordine
|
||||
if ($copia->isArticolo()) {
|
||||
if ($documento->tipo->descrizione=='Ddt in uscita' || $documento->tipo->descrizione=='Ddt in entrata') {
|
||||
if ($documento->tipo->descrizione == 'Ddt in uscita' || $documento->tipo->descrizione == 'Ddt in entrata') {
|
||||
// TODO: estrarre il listino corrispondente se presente
|
||||
$originale = ArticoloOriginale::find($riga->idarticolo);
|
||||
|
||||
$prezzo = $documento->tipo->descrizione=='Ddt in entrata' ? $originale->prezzo_vendita : $originale->prezzo_acquisto;
|
||||
$prezzo = $documento->tipo->descrizione == 'Ddt in entrata' ? $originale->prezzo_vendita : $originale->prezzo_acquisto;
|
||||
if ($dir == 'entrata') {
|
||||
$id_iva = ($ddt->anagrafica->idiva_vendite ?: setting('Iva predefinita'));
|
||||
} else {
|
||||
@ -375,8 +375,8 @@ switch (filter('op')) {
|
||||
|
||||
// Eliminazione riga
|
||||
case 'delete_riga':
|
||||
$id_righe = (array)post('righe');
|
||||
|
||||
$id_righe = (array) post('righe');
|
||||
|
||||
foreach ($id_righe as $id_riga) {
|
||||
$riga = Articolo::find($id_riga) ?: Riga::find($id_riga);
|
||||
$riga = $riga ?: Descrizione::find($id_riga);
|
||||
@ -397,8 +397,8 @@ switch (filter('op')) {
|
||||
|
||||
// Duplicazione riga
|
||||
case 'copy_riga':
|
||||
$id_righe = (array)post('righe');
|
||||
|
||||
$id_righe = (array) post('righe');
|
||||
|
||||
foreach ($id_righe as $id_riga) {
|
||||
$riga = Articolo::find($id_riga) ?: Riga::find($id_riga);
|
||||
$riga = $riga ?: Descrizione::find($id_riga);
|
||||
@ -434,7 +434,7 @@ switch (filter('op')) {
|
||||
$riga_trasporto->movimenta(-$riga_trasporto->qta);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$ddt->delete();
|
||||
|
||||
flash()->info(tr('Ddt eliminato!'));
|
||||
@ -554,7 +554,7 @@ switch (filter('op')) {
|
||||
$barcode = post('barcode');
|
||||
|
||||
if (!empty($barcode)) {
|
||||
$id_articolo = $dbo->selectOne('mg_articoli', 'id', ['deleted_at' => null, 'attivo' => 1, 'barcode' => $barcode])['id'];
|
||||
$id_articolo = $dbo->selectOne('mg_articoli', 'id', ['deleted_at' => null, 'attivo' => 1, 'barcode' => $barcode])['id'];
|
||||
}
|
||||
|
||||
if (!empty($id_articolo)) {
|
||||
@ -582,7 +582,7 @@ switch (filter('op')) {
|
||||
}
|
||||
$id_anagrafica = $ddt->idanagrafica;
|
||||
$prezzi_ivati = setting('Utilizza prezzi di vendita comprensivi di IVA');
|
||||
|
||||
|
||||
// CALCOLO PREZZO UNITARIO
|
||||
$prezzo_unitario = 0;
|
||||
$sconto = 0;
|
||||
@ -605,7 +605,7 @@ switch (filter('op')) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (empty($prezzo_unitario)) {
|
||||
// Prezzi listini clienti
|
||||
$listino = $dbo->fetchOne('SELECT sconto_percentuale AS sconto_percentuale_listino, '.($prezzi_ivati ? 'prezzo_unitario_ivato' : 'prezzo_unitario').' AS prezzo_unitario_listino
|
||||
@ -624,7 +624,7 @@ switch (filter('op')) {
|
||||
} else {
|
||||
$prezzo_unitario = $prezzo_unitario ?: $originale->prezzo_acquisto;
|
||||
}
|
||||
|
||||
|
||||
// Aggiunta sconto combinato se è presente un piano di sconto nell'anagrafica
|
||||
$join = ($dir == 'entrata' ? 'id_piano_sconto_vendite' : 'id_piano_sconto_acquisti');
|
||||
$piano_sconto = $dbo->fetchOne('SELECT prc_guadagno FROM an_anagrafiche INNER JOIN mg_piani_sconto ON an_anagrafiche.'.$join.'=mg_piani_sconto.id WHERE idanagrafica='.prepare($id_anagrafica));
|
||||
@ -636,7 +636,6 @@ switch (filter('op')) {
|
||||
$articolo->setSconto($sconto, 'PRC');
|
||||
$articolo->save();
|
||||
|
||||
|
||||
flash()->info(tr('Nuovo articolo aggiunto!'));
|
||||
}
|
||||
} else {
|
||||
@ -673,7 +672,7 @@ switch (filter('op')) {
|
||||
$articolo = Articolo::build($fattura, $originale);
|
||||
$articolo->id_dettaglio_fornitore = post('id_dettaglio_fornitore') ?: null;
|
||||
}
|
||||
|
||||
|
||||
if ($articolo['prezzo_unitario'] != $riga['price']) {
|
||||
$articolo->setPrezzoUnitario($riga['price'], $articolo->idiva);
|
||||
$articolo->save();
|
||||
@ -685,7 +684,7 @@ switch (filter('op')) {
|
||||
flash()->info(tr('_NUM_ prezzi modificati!', [
|
||||
'_NUM_' => $numero_totale,
|
||||
]));
|
||||
} else if ($numero_totale == 1) {
|
||||
} elseif ($numero_totale == 1) {
|
||||
flash()->info(tr('_NUM_ prezzo modificato!', [
|
||||
'_NUM_' => $numero_totale,
|
||||
]));
|
||||
@ -696,7 +695,6 @@ switch (filter('op')) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Aggiornamento stato degli ordini presenti in questa fattura in base alle quantità totali evase
|
||||
if (!empty($id_record) && setting('Cambia automaticamente stato ordini fatturati')) {
|
||||
$rs = $dbo->fetchArray('SELECT idordine FROM dt_righe_ddt WHERE idddt='.prepare($id_record).' AND idordine!=0');
|
||||
|
@ -182,7 +182,7 @@ $operations['crea_fattura'] = [
|
||||
'data' => [
|
||||
'title' => tr('Fatturare i _TYPE_ selezionati?', ['_TYPE_' => strtolower($module['name'])]),
|
||||
'msg' => '{[ "type": "checkbox", "label": "<small>'.tr('Aggiungere alle _TYPE_ non ancora emesse?', ['_TYPE_' => strtolower($module_fatture)]).'", "placeholder": "'.tr('Aggiungere alle _TYPE_ nello stato bozza?', ['_TYPE_' => strtolower($module_fatture)]).'</small>", "name": "accodare" ]}<br>
|
||||
{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "ajax-source": "segmenti", "select-options": '.json_encode(["id_module" => $id_fatture, 'is_sezionale' => 1]).', "value": "'.$id_segment.'", "select-options-escape": true ]}<br>
|
||||
{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "ajax-source": "segmenti", "select-options": '.json_encode(['id_module' => $id_fatture, 'is_sezionale' => 1]).', "value": "'.$id_segment.'", "select-options-escape": true ]}<br>
|
||||
{[ "type": "select", "label": "'.tr('Tipo documento').'", "name": "idtipodocumento", "required": 1, "values": "query=SELECT id, CONCAT(codice_tipo_documento_fe, \' - \', descrizione) AS descrizione FROM co_tipidocumento WHERE enabled = 1 AND dir ='.prepare($dir).' ORDER BY codice_tipo_documento_fe", "value": "'.$idtipodocumento.'" ]}',
|
||||
'button' => tr('Procedi'),
|
||||
'class' => 'btn btn-lg btn-warning',
|
||||
|
@ -43,7 +43,7 @@ if (!empty($ddt->id_ddt_trasporto_interno)) {
|
||||
function completaTrasporto() {
|
||||
swal({
|
||||
title: "'.tr('Completare il trasporto?').'",
|
||||
html: "'.tr('Sei sicuro di voler completare il trasporto interno tramite un DDT in direzione opposta?').'" + `<br><br>{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "ajax-source": "segmenti", "select-options": '.json_encode(["id_module" => $id_module_collegamento, 'is_sezionale' => 1]).', "value": "'.$_SESSION['module_'.$id_module_collegamento]['id_segment'].'" ]}`,
|
||||
html: "'.tr('Sei sicuro di voler completare il trasporto interno tramite un DDT in direzione opposta?').'" + `<br><br>{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "ajax-source": "segmenti", "select-options": '.json_encode(['id_module' => $id_module_collegamento, 'is_sezionale' => 1]).', "value": "'.$_SESSION['module_'.$id_module_collegamento]['id_segment'].'" ]}`,
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonClass: "btn btn-lg btn-success",
|
||||
@ -88,4 +88,3 @@ echo '
|
||||
<button type="button" class="btn btn-primary ask" data-title="'.tr('Duplicare questo Ddt?').'" data-msg="'.tr('Clicca su tasto duplica per procedere.').'" data-op="copy" data-button="'.tr('Duplica').'" data-class="btn btn-lg btn-primary" data-backto="record-edit">
|
||||
<i class="fa fa-copy"></i> '.tr('Duplica ddt').'
|
||||
</button>';
|
||||
|
||||
|
@ -29,7 +29,7 @@ if ($module['name'] == 'Ddt di acquisto') {
|
||||
$dir = 'entrata';
|
||||
}
|
||||
|
||||
if ($dir=='entrata') {
|
||||
if ($dir == 'entrata') {
|
||||
$numero_previsto = verifica_numero_ddt($ddt);
|
||||
if (!empty($numero_previsto)) {
|
||||
echo '
|
||||
@ -123,12 +123,12 @@ if ($dir=='entrata') {
|
||||
</div>
|
||||
<?php
|
||||
if ($dir == 'entrata') {
|
||||
echo '
|
||||
echo '
|
||||
<div class="col-md-3">';
|
||||
if ($record['idagente'] != 0) {
|
||||
echo Modules::link('Anagrafiche', $record['idagente'], null, null, 'class="pull-right"');
|
||||
}
|
||||
echo '
|
||||
echo '
|
||||
{[ "type": "select", "label": "'.tr('Agente').'", "name": "idagente", "ajax-source": "agenti", "select-options": {"idanagrafica": '.$record['idanagrafica'].'}, "value": "$idagente$" ]}
|
||||
</div>';
|
||||
}
|
||||
@ -668,4 +668,4 @@ input("ordinamento").on("change", function(){
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>';
|
||||
</script>';
|
||||
|
@ -89,8 +89,8 @@ $righe = $dbo->fetchArray(
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td><?= $riga['codice'] ?></td>
|
||||
<td><?= $riga['descrizione'] ?></td>
|
||||
<td><?php echo $riga['codice']; ?></td>
|
||||
<td><?php echo $riga['descrizione']; ?></td>
|
||||
<td>
|
||||
<div>
|
||||
{[ "type": "number", "label": "", "data-id":"<?php echo $riga['id']; ?>","name": "nuovo_prezzo_unitario[]", "value": "<?php echo numberFormat($riga['prezzo_unitario'], 2); ?>"]}
|
||||
@ -98,14 +98,14 @@ $righe = $dbo->fetchArray(
|
||||
</td>
|
||||
<td class="text-center"><?php
|
||||
if (isset($ultimo_prezzo_preventivo)) {
|
||||
echo moneyFormat($ultimo_prezzo_preventivo['prezzo_unitario'], 2) . (!empty($ultimo_prezzo_preventivo['updated_at']) ? ' <br><small class="help-block tip" title="'.dateFormat($ultimo_prezzo_preventivo['updated_at']).'">' . (new Carbon($ultimo_prezzo_preventivo['updated_at']))->diffForHumans().'</small>' : '');
|
||||
echo moneyFormat($ultimo_prezzo_preventivo['prezzo_unitario'], 2).(!empty($ultimo_prezzo_preventivo['updated_at']) ? ' <br><small class="help-block tip" title="'.dateFormat($ultimo_prezzo_preventivo['updated_at']).'">'.(new Carbon($ultimo_prezzo_preventivo['updated_at']))->diffForHumans().'</small>' : '');
|
||||
} else {
|
||||
echo 'n.d.';
|
||||
}
|
||||
?></td>
|
||||
<td class="text-center"><?php
|
||||
if (isset($ultimo_prezzo_vendita)) {
|
||||
echo moneyFormat($ultimo_prezzo_vendita['prezzo_unitario'], 2) . (!empty($ultimo_prezzo_vendita['updated_at']) ? ' <br><small class="help-block tip" title="'.dateFormat($ultimo_prezzo_vendita['updated_at']).'">' . (new Carbon($ultimo_prezzo_vendita['updated_at']))->diffForHumans().'</small>' : '');
|
||||
echo moneyFormat($ultimo_prezzo_vendita['prezzo_unitario'], 2).(!empty($ultimo_prezzo_vendita['updated_at']) ? ' <br><small class="help-block tip" title="'.dateFormat($ultimo_prezzo_vendita['updated_at']).'">'.(new Carbon($ultimo_prezzo_vendita['updated_at']))->diffForHumans().'</small>' : '');
|
||||
} else {
|
||||
echo 'n.d.';
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ function verifica_numero_ddt(DDT $ddt)
|
||||
'YEAR(data) = '.prepare(date('Y', strtotime($data))),
|
||||
'idtipoddt = '.prepare($tipo->id),
|
||||
], $data);
|
||||
|
||||
|
||||
do {
|
||||
$numero = Generator::generate($maschera, $ultimo, 1, Generator::dateToPattern($data));
|
||||
|
||||
@ -259,4 +259,4 @@ function verifica_numero_ddt(DDT $ddt)
|
||||
} while ($numero != $ddt->numero_esterno);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ $result = [
|
||||
];
|
||||
|
||||
// Leggo la provvigione predefinita per l'anagrafica
|
||||
$result['provvigione_default'] = $dbo->fetchOne('SELECT provvigione_default FROM an_anagrafiche WHERE idanagrafica='.prepare($documento->idagente))['provvigione_default'];
|
||||
$result['provvigione_default'] = $dbo->fetchOne('SELECT provvigione_default FROM an_anagrafiche WHERE idanagrafica='.prepare($documento->idagente))['provvigione_default'];
|
||||
|
||||
// Leggo l'iva predefinita per l'anagrafica e se non c'è leggo quella predefinita generica
|
||||
$iva = $dbo->fetchArray('SELECT idiva_'.($dir == 'uscita' ? 'acquisti' : 'vendite').' AS idiva FROM an_anagrafiche WHERE idanagrafica='.prepare($documento['idanagrafica']));
|
||||
|
@ -74,11 +74,11 @@ foreach ($righe as $riga) {
|
||||
echo '
|
||||
<tr data-id="'.$riga->id.'" data-type="'.get_class($riga).'">
|
||||
<td class="text-center">';
|
||||
if (!$block_edit) {
|
||||
echo '
|
||||
if (!$block_edit) {
|
||||
echo '
|
||||
<input class="check" type="checkbox"/>';
|
||||
}
|
||||
echo '
|
||||
}
|
||||
echo '
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
@ -88,53 +88,52 @@ foreach ($righe as $riga) {
|
||||
<td>
|
||||
<small class="pull-right text-right text-muted">';
|
||||
|
||||
$numero_riferimenti_riga = $riga->referenceTargets()->count();
|
||||
$numero_riferimenti_collegati = $riga->referenceSources()->count();
|
||||
$riferimenti_presenti = $numero_riferimenti_riga;
|
||||
$testo_aggiuntivo = $riferimenti_presenti ? $numero_riferimenti_riga : '';
|
||||
echo '
|
||||
$numero_riferimenti_riga = $riga->referenceTargets()->count();
|
||||
$numero_riferimenti_collegati = $riga->referenceSources()->count();
|
||||
$riferimenti_presenti = $numero_riferimenti_riga;
|
||||
$testo_aggiuntivo = $riferimenti_presenti ? $numero_riferimenti_riga : '';
|
||||
echo '
|
||||
<button type="button" class="btn btn-xs btn-'.($riferimenti_presenti ? 'primary' : 'info').'" onclick="apriRiferimenti(this)">
|
||||
<i class="fa fa-chevron-right"></i> '.tr('Riferimenti').' '.$testo_aggiuntivo.'
|
||||
</button>';
|
||||
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if ($riga->hasOriginalComponent()) {
|
||||
echo '
|
||||
<br>'.reference($riga->getOriginalComponent()->getDocument(), tr('Origine'));
|
||||
}
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if ($riga->hasOriginalComponent()) {
|
||||
echo '
|
||||
<br>'.reference($riga->getOriginalComponent()->getDocument(), tr('Origine'));
|
||||
}
|
||||
echo '
|
||||
</small>';
|
||||
|
||||
if ($riga->isArticolo()) {
|
||||
echo Modules::link('Articoli', $riga->idarticolo, $riga->codice.' - '.$riga->descrizione);
|
||||
} else {
|
||||
echo nl2br($riga->descrizione);
|
||||
}
|
||||
if ($riga->isArticolo()) {
|
||||
echo Modules::link('Articoli', $riga->idarticolo, $riga->codice.' - '.$riga->descrizione);
|
||||
} else {
|
||||
echo nl2br($riga->descrizione);
|
||||
}
|
||||
|
||||
if ($riga->isArticolo() && !empty($riga->abilita_serial)) {
|
||||
if (!empty($mancanti)) {
|
||||
echo '
|
||||
if ($riga->isArticolo() && !empty($riga->abilita_serial)) {
|
||||
if (!empty($mancanti)) {
|
||||
echo '
|
||||
<br><b><small class="text-danger">'.tr('_NUM_ serial mancanti', [
|
||||
'_NUM_' => $mancanti,
|
||||
]).'</small></b>';
|
||||
}
|
||||
if (!empty($serials)) {
|
||||
echo '
|
||||
<br>'.tr('SN').': '.implode(', ', $serials);
|
||||
}
|
||||
}
|
||||
|
||||
if ($riga->isArticolo() && !empty($riga->articolo->barcode)) {
|
||||
if (!empty($serials)) {
|
||||
echo '
|
||||
<br><small><i class="fa fa-barcode"></i> '.$riga->articolo->barcode.'</small>';
|
||||
<br>'.tr('SN').': '.implode(', ', $serials);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!empty($riga->note)) {
|
||||
echo '
|
||||
<br><small class="label label-default">'.nl2br($riga->note).'</small>';
|
||||
}
|
||||
if ($riga->isArticolo() && !empty($riga->articolo->barcode)) {
|
||||
echo '
|
||||
<br><small><i class="fa fa-barcode"></i> '.$riga->articolo->barcode.'</small>';
|
||||
}
|
||||
|
||||
if (!empty($riga->note)) {
|
||||
echo '
|
||||
<br><small class="label label-default">'.nl2br($riga->note).'</small>';
|
||||
}
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
if ($riga->isDescrizione()) {
|
||||
@ -144,38 +143,38 @@ foreach ($righe as $riga) {
|
||||
<td></td>
|
||||
<td></td>';
|
||||
} else {
|
||||
// Quantità e unità di misura
|
||||
echo '
|
||||
// Quantità e unità di misura
|
||||
echo '
|
||||
<td class="text-center">
|
||||
{[ "type": "number", "name": "qta_'.$riga->id.'", "value": "'.$riga->qta.'", "min-value": "0", "onchange": "aggiornaInline($(this).closest(\'tr\').data(\'id\'))", "icon-after": "<span class=\'tip\' title=\''.tr('Quantità evasa').' / '.tr('totale').': '.tr('_QTA_ / _TOT_', ['_QTA_' => numberFormat($riga->qta_evasa, 'qta'), '_TOT_' => numberFormat($riga->qta, 'qta')]).'\'>'.$riga->um.' <small><i class=\'text-muted fa fa-info-circle\'></i></small></span>", "disabled": "'.($riga->isSconto() ? 1 : 0).'", "disabled": "'.$block_edit.'" ]}
|
||||
<div class="progress" style="height:4px;">';
|
||||
// Visualizzazione evasione righe per documento
|
||||
$evasione_bar = [];
|
||||
$evasione_bar['dt_righe_ddt'] = 'info';
|
||||
$evasione_bar['co_righe_documenti'] = 'primary';
|
||||
$evasione_bar['in_righe_interventi'] = 'warning';
|
||||
$evasione_bar['or_righe_ordini'] = 'success';
|
||||
foreach ($evasione_bar as $table => $color) {
|
||||
$righe_ev = $dbo->table($table)->where('original_id', $riga->id)->where('original_type', get_class($riga))->get();
|
||||
$perc_ev = $righe_ev->sum('qta') * 100 / $riga->qta;
|
||||
if ($perc_ev > 0) {
|
||||
echo '
|
||||
// Visualizzazione evasione righe per documento
|
||||
$evasione_bar = [];
|
||||
$evasione_bar['dt_righe_ddt'] = 'info';
|
||||
$evasione_bar['co_righe_documenti'] = 'primary';
|
||||
$evasione_bar['in_righe_interventi'] = 'warning';
|
||||
$evasione_bar['or_righe_ordini'] = 'success';
|
||||
foreach ($evasione_bar as $table => $color) {
|
||||
$righe_ev = $dbo->table($table)->where('original_id', $riga->id)->where('original_type', get_class($riga))->get();
|
||||
$perc_ev = $righe_ev->sum('qta') * 100 / $riga->qta;
|
||||
if ($perc_ev > 0) {
|
||||
echo '
|
||||
<div class="progress-bar progress-bar-'.$color.'" style="width:'.$perc_ev.'%"></div>';
|
||||
}
|
||||
}
|
||||
echo '
|
||||
}
|
||||
}
|
||||
echo '
|
||||
</div>
|
||||
</td>';
|
||||
|
||||
// Prezzi unitari
|
||||
echo '
|
||||
<td class="text-right">';
|
||||
// Provvigione riga
|
||||
if (abs($riga->provvigione_unitaria) > 0) {
|
||||
$text = provvigioneInfo($riga);
|
||||
echo '<span class="pull-left text-info" title="'.$text.'"><i class="fa fa-handshake-o"></i></span>';
|
||||
}
|
||||
echo moneyFormat($riga->prezzo_unitario_corrente);
|
||||
// Provvigione riga
|
||||
if (abs($riga->provvigione_unitaria) > 0) {
|
||||
$text = provvigioneInfo($riga);
|
||||
echo '<span class="pull-left text-info" title="'.$text.'"><i class="fa fa-handshake-o"></i></span>';
|
||||
}
|
||||
echo moneyFormat($riga->prezzo_unitario_corrente);
|
||||
|
||||
if ($dir == 'entrata' && $riga->costo_unitario != 0) {
|
||||
echo '
|
||||
@ -193,7 +192,7 @@ foreach ($righe as $riga) {
|
||||
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
|
||||
// Sconto unitario
|
||||
if (!$block_edit) {
|
||||
echo '
|
||||
@ -207,28 +206,28 @@ foreach ($righe as $riga) {
|
||||
<td class="text-right">
|
||||
'.moneyFormat($riga->importo);
|
||||
|
||||
// Iva
|
||||
echo '
|
||||
// Iva
|
||||
echo '
|
||||
<br><small class="'.(($riga->aliquota->deleted_at) ? 'text-red' : '').' text-muted">'.$riga->aliquota->descrizione.(($riga->aliquota->esente) ? ' ('.$riga->aliquota->codice_natura_fe.')' : null).'</small>
|
||||
</td>';
|
||||
}
|
||||
|
||||
// Possibilità di rimuovere una riga solo se il ddt non è evaso
|
||||
echo '
|
||||
// Possibilità di rimuovere una riga solo se il ddt non è evaso
|
||||
echo '
|
||||
<td class="text-center">';
|
||||
|
||||
if ($record['flag_completato'] == 0) {
|
||||
echo '
|
||||
if ($record['flag_completato'] == 0) {
|
||||
echo '
|
||||
<div class="input-group-btn">';
|
||||
|
||||
if ($riga->isArticolo() && !empty($riga->abilita_serial)) {
|
||||
echo '
|
||||
if ($riga->isArticolo() && !empty($riga->abilita_serial)) {
|
||||
echo '
|
||||
<a class="btn btn-primary btn-xs" title="'.tr('Modifica seriali della riga').'" onclick="modificaSeriali(this)">
|
||||
<i class="fa fa-barcode"></i>
|
||||
</a>';
|
||||
}
|
||||
}
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<a class="btn btn-xs btn-warning" title="'.tr('Modifica riga').'" onclick="modificaRiga(this)">
|
||||
<i class="fa fa-edit"></i>
|
||||
</a>
|
||||
@ -241,9 +240,9 @@ foreach ($righe as $riga) {
|
||||
<i class="fa fa-sort"></i>
|
||||
</a>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
echo '
|
||||
echo '
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
@ -351,7 +350,7 @@ if ($totale != $netto_a_pagare) {
|
||||
}
|
||||
|
||||
// Provvigione
|
||||
if(!empty($ddt->provvigione)) {
|
||||
if (!empty($ddt->provvigione)) {
|
||||
echo '
|
||||
<tr>
|
||||
<td colspan="'.$colspan.'" class="text-right">
|
||||
@ -372,7 +371,7 @@ if(!empty($ddt->provvigione)) {
|
||||
'.moneyFormat($ddt->totale_imponibile - $ddt->provvigione).'
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>';
|
||||
</tr>';
|
||||
}
|
||||
|
||||
echo '
|
||||
@ -387,12 +386,13 @@ if (!$block_edit && sizeof($righe) > 0) {
|
||||
<button type="button" class="btn btn-xs btn-default disabled" id="elimina_righe" onclick="rimuoviRiga(getSelectData());">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>';
|
||||
if ($dir == 'entrata') {
|
||||
echo'
|
||||
if ($dir == 'entrata') {
|
||||
echo '
|
||||
<button type="button" class="btn btn-xs btn-default disabled" id="confronta_righe" onclick="confrontaRighe(getSelectData());">
|
||||
Confronta prezzi
|
||||
</button>';
|
||||
} echo'
|
||||
}
|
||||
echo '
|
||||
</div>';
|
||||
}
|
||||
echo '
|
||||
|
@ -90,7 +90,7 @@ class DDT extends Document
|
||||
$model->stato()->associate($stato_documento);
|
||||
$model->id_segment = $id_segment;
|
||||
$model->idagente = $anagrafica->idagente;
|
||||
|
||||
|
||||
$model->save();
|
||||
|
||||
// Salvataggio delle informazioni
|
||||
|
@ -116,15 +116,14 @@ echo '
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<?php
|
||||
echo input([
|
||||
<?php echo input([
|
||||
'type' => 'ckeditor',
|
||||
'use_full_ckeditor' => 1,
|
||||
'label' => tr('Contenuto'),
|
||||
'name' => 'body',
|
||||
'value' => $record['body'],
|
||||
]);
|
||||
?>
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -19,17 +19,15 @@
|
||||
|
||||
namespace Modules\Emails;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Notifications\EmailNotification;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
use Tasks\Manager;
|
||||
|
||||
class EmailTask extends Manager
|
||||
{
|
||||
|
||||
public function needsExecution()
|
||||
{
|
||||
$lista = database()->fetchArray("SELECT * FROM em_emails WHERE (sent_at IS NULL OR failed_at IS NOT NULL) AND attempt<".prepare(setting('Numero massimo di tentativi'))." ORDER BY created_at");
|
||||
$lista = database()->fetchArray('SELECT * FROM em_emails WHERE (sent_at IS NULL OR failed_at IS NOT NULL) AND attempt<'.prepare(setting('Numero massimo di tentativi')).' ORDER BY created_at');
|
||||
$remaining = sizeof($lista);
|
||||
|
||||
return !empty($remaining);
|
||||
@ -37,10 +35,9 @@ class EmailTask extends Manager
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$lista = database()->fetchArray("SELECT * FROM em_emails WHERE (sent_at IS NULL OR failed_at IS NOT NULL) AND attempt<".prepare(setting('Numero massimo di tentativi'))." ORDER BY created_at LIMIT 0,".setting('Numero email da inviare in contemporanea per account'));
|
||||
$lista = database()->fetchArray('SELECT * FROM em_emails WHERE (sent_at IS NULL OR failed_at IS NOT NULL) AND attempt<'.prepare(setting('Numero massimo di tentativi')).' ORDER BY created_at LIMIT 0,'.setting('Numero email da inviare in contemporanea per account'));
|
||||
|
||||
foreach ($lista as $mail) {
|
||||
|
||||
$mail = Mail::find($mail['id']);
|
||||
|
||||
try {
|
||||
@ -53,4 +50,4 @@ class EmailTask extends Manager
|
||||
|
||||
return $lista;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,13 +27,12 @@ switch (post('op')) {
|
||||
$id_regione = post('id_regione');
|
||||
$is_recurring = post('is_recurring');
|
||||
$is_bank_holiday = post('is_bank_holiday');
|
||||
|
||||
|
||||
if ($dbo->fetchNum('SELECT * FROM `zz_events` WHERE `nome`='.prepare($nome).' AND `id`!='.prepare($id_record)) == 0) {
|
||||
|
||||
$dbo->update('zz_events', [
|
||||
'nome' => $nome,
|
||||
'data' => $data,
|
||||
'id_nazione' =>$id_nazione,
|
||||
'id_nazione' => $id_nazione,
|
||||
'id_regione' => $id_regione,
|
||||
'is_recurring' => $is_recurring,
|
||||
'is_bank_holiday' => $is_bank_holiday,
|
||||
@ -41,7 +40,6 @@ switch (post('op')) {
|
||||
'id' => $id_record,
|
||||
]);
|
||||
|
||||
|
||||
flash()->info(tr('Salvataggio completato.'));
|
||||
} else {
|
||||
flash()->error(tr("E' già presente un _TYPE_ con lo stesso nome", [
|
||||
@ -56,7 +54,6 @@ switch (post('op')) {
|
||||
$data = post('data');
|
||||
$id_nazione = post('id_nazione');
|
||||
if ($dbo->fetchNum('SELECT * FROM `zz_events` WHERE `id_nazione` = '.prepare($id_nazione).' AND `nome`='.prepare($nome).' AND `data`='.prepare($data)) == 0) {
|
||||
|
||||
$dbo->insert('zz_events', [
|
||||
'nome' => $nome,
|
||||
'data' => $data,
|
||||
@ -81,7 +78,6 @@ switch (post('op')) {
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
|
||||
$dbo->delete('zz_events', [
|
||||
'id' => $id_record,
|
||||
]);
|
||||
|
@ -17,7 +17,6 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Carbon\Carbon;
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
//$block_edit = $record['is_predefined'];
|
||||
|
@ -29,14 +29,13 @@ switch (post('op')) {
|
||||
$is_predefined = post('is_predefined');
|
||||
|
||||
if ($dbo->fetchNum('SELECT * FROM `in_fasceorarie` WHERE `nome`='.prepare($nome).' AND `id`!='.prepare($id_record)) == 0) {
|
||||
|
||||
if (!empty($is_predefined)) {
|
||||
$dbo->query('UPDATE in_fasceorarie SET is_predefined = 0');
|
||||
}
|
||||
|
||||
|
||||
$dbo->update('in_fasceorarie', [
|
||||
'nome' => $nome,
|
||||
'giorni' => $giorni ? implode(',' , $giorni) : null,
|
||||
'giorni' => $giorni ? implode(',', $giorni) : null,
|
||||
'ora_inizio' => $ora_inizio,
|
||||
'ora_fine' => $ora_fine,
|
||||
'include_bank_holidays' => $include_bank_holidays,
|
||||
@ -60,7 +59,6 @@ switch (post('op')) {
|
||||
$ora_fine = post('ora_fine');
|
||||
|
||||
if ($dbo->fetchNum('SELECT * FROM `in_fasceorarie` WHERE `nome`='.prepare($nome)) == 0) {
|
||||
|
||||
$dbo->insert('in_fasceorarie', [
|
||||
'nome' => $nome,
|
||||
'ora_inizio' => $ora_inizio,
|
||||
|
@ -17,7 +17,6 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
//$block_edit = $record['is_predefined'];
|
||||
@ -79,7 +78,6 @@ include_once __DIR__.'/../../core.php';
|
||||
$results = $dbo->fetchArray('SELECT * FROM `co_pagamenti` WHERE descrizione='.prepare($record['descrizione']).' ORDER BY `num_giorni` ASC');
|
||||
$numero_data = 1;
|
||||
foreach ($results as $result) {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@ -162,12 +160,11 @@ if (!empty($elementi)) {
|
||||
'_TIPO_INTERVENTO_' => $elemento['codice'],
|
||||
]);
|
||||
|
||||
$modulo = 'Tipi di intervento';
|
||||
$id = $elemento['idtipointervento'];
|
||||
$modulo = 'Tipi di intervento';
|
||||
$id = $elemento['idtipointervento'];
|
||||
|
||||
echo '
|
||||
<li>'.Modules::link($modulo, $id, $descrizione).'</li>';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
@ -178,6 +175,6 @@ if (!empty($elementi)) {
|
||||
|
||||
?>
|
||||
|
||||
<a class="btn btn-danger ask <?php echo (intval($record['can_delete'])==0 ? 'disabled' : ''); ?>" data-backto="record-list">
|
||||
<a class="btn btn-danger ask <?php echo intval($record['can_delete']) == 0 ? 'disabled' : ''; ?>" data-backto="record-list">
|
||||
<i class="fa fa-trash"></i> <?php echo tr('Elimina'); ?>
|
||||
</a>
|
||||
|
@ -42,7 +42,7 @@ if ($module['name'] == 'Fatture di vendita') {
|
||||
}
|
||||
|
||||
// Controllo se la fattura è già stata inviata allo SDI
|
||||
$stato_fe= $dbo->fetchOne('SELECT codice_stato_fe FROM co_documenti WHERE id = '.$fattura->id);
|
||||
$stato_fe = $dbo->fetchOne('SELECT codice_stato_fe FROM co_documenti WHERE id = '.$fattura->id);
|
||||
|
||||
$ops = ['update', 'add_intervento', 'manage_documento_fe', 'manage_riga_fe', 'manage_articolo', 'manage_sconto', 'manage_riga', 'manage_descrizione', 'unlink_intervento', 'delete_riga', 'copy_riga', 'add_serial', 'add_articolo', 'edit-price'];
|
||||
|
||||
@ -94,7 +94,7 @@ switch ($op) {
|
||||
WHERE
|
||||
co_statidocumento.descrizione = "Emessa" AND co_tipidocumento.dir="entrata" AND co_documenti.id_segment='.$fattura->id_segment);
|
||||
|
||||
if ((setting('Data emissione fattura automatica') == 1) && ($dir == 'entrata') && ($stato->descrizione == 'Emessa') && (Carbon::parse($data)->lessThan(Carbon::parse($data_fattura_precedente['datamax']))) && (!empty($data_fattura_precedente['datamax']))){
|
||||
if ((setting('Data emissione fattura automatica') == 1) && ($dir == 'entrata') && ($stato->descrizione == 'Emessa') && (Carbon::parse($data)->lessThan(Carbon::parse($data_fattura_precedente['datamax']))) && (!empty($data_fattura_precedente['datamax']))) {
|
||||
$fattura->data = $data_fattura_precedente['datamax'];
|
||||
$fattura->data_competenza = $data_fattura_precedente['datamax'];
|
||||
flash()->info(tr('Data di emissione aggiornata, come da impostazione!'));
|
||||
@ -173,7 +173,7 @@ switch ($op) {
|
||||
$fattura->setScontoFinale(post('sconto_finale'), post('tipo_sconto_finale'));
|
||||
|
||||
$anagrafica = Anagrafica::find($fattura->idanagrafica);
|
||||
if ($anagrafica->tipo === "Privato" && $fattura->is_fattura_conto_terzi) {
|
||||
if ($anagrafica->tipo === 'Privato' && $fattura->is_fattura_conto_terzi) {
|
||||
flash()->warning(tr('L\'anagrafica selezionata è del tipo "Privato", correggere la tipologia dalla scheda anagrafica!'));
|
||||
} else {
|
||||
$results = $fattura->save();
|
||||
@ -181,7 +181,6 @@ switch ($op) {
|
||||
flash()->info(tr('Fattura modificata correttamente!'));
|
||||
}
|
||||
|
||||
|
||||
foreach ($results as $numero => $result) {
|
||||
foreach ($result as $title => $links) {
|
||||
foreach ($links as $link => $errors) {
|
||||
@ -243,7 +242,7 @@ switch ($op) {
|
||||
->where('id', '!=', $id_record)
|
||||
->where('data', '>=', $_SESSION['period_start'])
|
||||
->where('data', '<=', $_SESSION['period_end'])
|
||||
->where('numero_esterno', '!=', NULL)
|
||||
->where('numero_esterno', '!=', null)
|
||||
->whereHas('tipo', function ($query) use ($direzione) {
|
||||
$query->where('dir', '=', $direzione);
|
||||
})->count();
|
||||
@ -281,15 +280,14 @@ switch ($op) {
|
||||
}
|
||||
|
||||
$totale_documento = abs($totale_documento);
|
||||
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
echo json_encode([
|
||||
'stored' => round($totale_documento,2),
|
||||
'calculated' => round($fattura->totale,2),
|
||||
'stored' => round($totale_documento, 2),
|
||||
'calculated' => round($fattura->totale, 2),
|
||||
]);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
// Elenco fatture in stato Bozza per il cliente
|
||||
@ -322,7 +320,7 @@ switch ($op) {
|
||||
->where('co_documenti.idanagrafica', $id_anagrafica)
|
||||
->whereIn('idstatodocumento', [$stato1->id, $stato2->id])
|
||||
->join('co_scadenziario', 'co_documenti.id', '=', 'co_scadenziario.iddocumento')
|
||||
->join('co_tipidocumento', 'co_tipidocumento.id','=','co_documenti.idtipodocumento')
|
||||
->join('co_tipidocumento', 'co_tipidocumento.id', '=', 'co_documenti.idtipodocumento')
|
||||
->whereRaw('co_scadenziario.da_pagare > co_scadenziario.pagato')
|
||||
->whereRaw('co_scadenziario.scadenza < NOW()')
|
||||
->groupBy('co_scadenziario.iddocumento')
|
||||
@ -416,7 +414,7 @@ switch ($op) {
|
||||
$riga->idintervento = $id_intervento;
|
||||
$riga->save();
|
||||
}
|
||||
|
||||
|
||||
aggiungi_intervento_in_fattura($id_intervento, $id_record, post('descrizione'), post('idiva'), post('idconto'), post('id_rivalsa_inps'), post('id_ritenuta_acconto'), post('calcolo_ritenuta_acconto'));
|
||||
|
||||
flash()->info(tr('Intervento _NUM_ aggiunto!', [
|
||||
@ -446,7 +444,7 @@ switch ($op) {
|
||||
$fattura->save();
|
||||
|
||||
flash()->info(tr('Dati FE aggiornati correttamente!'));
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 'manage_riga_fe':
|
||||
@ -524,7 +522,7 @@ switch ($op) {
|
||||
} else {
|
||||
flash()->info(tr('Articolo aggiunto!'));
|
||||
}
|
||||
|
||||
|
||||
// Ricalcolo inps, ritenuta e bollo
|
||||
ricalcola_costiagg_fattura($id_record);
|
||||
|
||||
@ -536,7 +534,7 @@ switch ($op) {
|
||||
} else {
|
||||
$sconto = Sconto::build($fattura);
|
||||
}
|
||||
|
||||
|
||||
$sconto->idconto = post('idconto');
|
||||
|
||||
$sconto->calcolo_ritenuta_acconto = post('calcolo_ritenuta_acconto') ?: null;
|
||||
@ -554,10 +552,9 @@ switch ($op) {
|
||||
} else {
|
||||
flash()->info(tr('Sconto/maggiorazione aggiunto!'));
|
||||
}
|
||||
|
||||
|
||||
// Ricalcolo inps, ritenuta e bollo
|
||||
ricalcola_costiagg_fattura($id_record);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
@ -568,7 +565,6 @@ switch ($op) {
|
||||
$riga = Riga::build($fattura);
|
||||
}
|
||||
|
||||
|
||||
$qta = post('qta');
|
||||
|
||||
$riga->descrizione = post('descrizione');
|
||||
@ -598,10 +594,10 @@ switch ($op) {
|
||||
} else {
|
||||
flash()->info(tr('Riga aggiunta!'));
|
||||
}
|
||||
|
||||
|
||||
// Ricalcolo inps, ritenuta e bollo
|
||||
ricalcola_costiagg_fattura($id_record);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 'manage_descrizione':
|
||||
@ -614,7 +610,6 @@ switch ($op) {
|
||||
$riga->descrizione = post('descrizione');
|
||||
$riga->note = post('note');
|
||||
|
||||
|
||||
$riga->save();
|
||||
|
||||
if (post('idriga') != null) {
|
||||
@ -622,7 +617,7 @@ switch ($op) {
|
||||
} else {
|
||||
flash()->info(tr('Riga descrittiva aggiunta!'));
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
// Scollegamento intervento da documento
|
||||
@ -644,18 +639,18 @@ switch ($op) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
// Scollegamento riga generica da documento
|
||||
case 'delete_riga':
|
||||
$id_righe = (array)post('righe');
|
||||
|
||||
$id_righe = (array) post('righe');
|
||||
|
||||
foreach ($id_righe as $id_riga) {
|
||||
$riga = Articolo::find($id_riga) ?: Riga::find($id_riga);
|
||||
$riga = $riga ?: Descrizione::find($id_riga);
|
||||
$riga = $riga ?: Sconto::find($id_riga);
|
||||
|
||||
|
||||
try {
|
||||
$riga->delete();
|
||||
|
||||
@ -668,13 +663,13 @@ switch ($op) {
|
||||
$riga = null;
|
||||
flash()->info(tr('Righe eliminate!'));
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
// Duplicazione riga
|
||||
case 'copy_riga':
|
||||
$id_righe = (array)post('righe');
|
||||
|
||||
$id_righe = (array) post('righe');
|
||||
|
||||
foreach ($id_righe as $id_riga) {
|
||||
$riga = Articolo::find($id_riga) ?: Riga::find($id_riga);
|
||||
$riga = $riga ?: Descrizione::find($id_riga);
|
||||
@ -741,7 +736,6 @@ switch ($op) {
|
||||
$fattura->idpagamento = setting('Tipo di pagamento predefinito');
|
||||
}
|
||||
|
||||
|
||||
$idsede = ($documento->idsede_destinazione ? $documento->idsede_destinazione : $documento->idsede);
|
||||
|
||||
$fattura->idsede_destinazione = $idsede;
|
||||
@ -855,7 +849,6 @@ switch ($op) {
|
||||
|
||||
$id_record = $nota->id;
|
||||
aggiorna_sedi_movimenti('documenti', $id_record);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
@ -914,7 +907,7 @@ switch ($op) {
|
||||
|
||||
break;
|
||||
|
||||
case 'controlla_serial':
|
||||
case 'controlla_serial':
|
||||
if (post('is_rientrabile')) {
|
||||
// Controllo che i serial entrati e usciti siano uguali in modo da poterli registrare nuovamente.
|
||||
$serial_uscita = $dbo->fetchOne('SELECT COUNT(id) AS `tot` FROM mg_prodotti WHERE serial='.prepare(post('serial')).' AND dir="uscita" AND id_articolo='.prepare(post('id_articolo')))['tot'];
|
||||
@ -923,17 +916,17 @@ switch ($op) {
|
||||
} else {
|
||||
$has_serial = $dbo->fetchOne('SELECT id FROM mg_prodotti WHERE serial='.prepare(post('serial')).' AND dir="uscita" AND id_articolo='.prepare(post('id_articolo')).' AND (id_riga_documento IS NOT NULL OR id_riga_ordine IS NOT NULL OR id_riga_ddt IS NOT NULL)')['id'];
|
||||
}
|
||||
|
||||
|
||||
echo json_encode($has_serial);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 'add_articolo':
|
||||
$id_articolo = post('id_articolo');
|
||||
$barcode = post('barcode');
|
||||
|
||||
|
||||
if (!empty($barcode)) {
|
||||
$id_articolo = $dbo->selectOne('mg_articoli', 'id', ['deleted_at' => null, 'attivo' => 1, 'barcode' => $barcode])['id'];
|
||||
$id_articolo = $dbo->selectOne('mg_articoli', 'id', ['deleted_at' => null, 'attivo' => 1, 'barcode' => $barcode])['id'];
|
||||
}
|
||||
|
||||
if (!empty($id_articolo)) {
|
||||
@ -961,7 +954,7 @@ switch ($op) {
|
||||
$id_conto = $originale->idconto_acquisto;
|
||||
}
|
||||
$articolo->idconto = $id_conto;
|
||||
|
||||
|
||||
if ($dir == 'entrata') {
|
||||
$id_iva = ($fattura->anagrafica->idiva_vendite ?: $originale->idiva_vendita) ?: setting('Iva predefinita');
|
||||
} else {
|
||||
@ -969,7 +962,7 @@ switch ($op) {
|
||||
}
|
||||
$id_anagrafica = $fattura->idanagrafica;
|
||||
$prezzi_ivati = setting('Utilizza prezzi di vendita comprensivi di IVA');
|
||||
|
||||
|
||||
// CALCOLO PREZZO UNITARIO
|
||||
$prezzo_unitario = 0;
|
||||
$sconto = 0;
|
||||
@ -992,7 +985,7 @@ switch ($op) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (empty($prezzo_unitario)) {
|
||||
// Prezzi listini clienti
|
||||
$listino = $dbo->fetchOne('SELECT sconto_percentuale AS sconto_percentuale_listino, '.($prezzi_ivati ? 'prezzo_unitario_ivato' : 'prezzo_unitario').' AS prezzo_unitario_listino
|
||||
@ -1020,7 +1013,6 @@ switch ($op) {
|
||||
$articolo->setProvvigione($provvigione ?: 0, 'PRC');
|
||||
$articolo->save();
|
||||
|
||||
|
||||
flash()->info(tr('Nuovo articolo aggiunto!'));
|
||||
}
|
||||
} else {
|
||||
@ -1029,10 +1021,10 @@ switch ($op) {
|
||||
}
|
||||
break;
|
||||
|
||||
// Controllo se impostare anagrafica azienda in base a tipologia documento
|
||||
// Controllo se impostare anagrafica azienda in base a tipologia documento
|
||||
case 'check_tipodocumento':
|
||||
$idtipodocumento = post('idtipodocumento');
|
||||
$tipologie = Tipo::wherein('codice_tipo_documento_fe', ['TD21','TD27'])->where('dir', 'entrata')->get()->pluck('id')->toArray();
|
||||
$tipologie = Tipo::wherein('codice_tipo_documento_fe', ['TD21', 'TD27'])->where('dir', 'entrata')->get()->pluck('id')->toArray();
|
||||
$azienda = Anagrafica::find(setting('Azienda predefinita'));
|
||||
|
||||
$result = false;
|
||||
@ -1048,7 +1040,7 @@ switch ($op) {
|
||||
}
|
||||
$result = [
|
||||
'id' => $azienda->id,
|
||||
'ragione_sociale' => $azienda->ragione_sociale
|
||||
'ragione_sociale' => $azienda->ragione_sociale,
|
||||
];
|
||||
}
|
||||
|
||||
@ -1068,7 +1060,7 @@ switch ($op) {
|
||||
$articolo = Articolo::build($fattura, $originale);
|
||||
$articolo->id_dettaglio_fornitore = post('id_dettaglio_fornitore') ?: null;
|
||||
}
|
||||
|
||||
|
||||
if ($articolo['prezzo_unitario'] != $riga['price']) {
|
||||
$articolo->setPrezzoUnitario($riga['price'], $articolo->idiva);
|
||||
$articolo->save();
|
||||
@ -1080,7 +1072,7 @@ switch ($op) {
|
||||
flash()->info(tr('_NUM_ prezzi modificati!', [
|
||||
'_NUM_' => $numero_totale,
|
||||
]));
|
||||
} else if ($numero_totale == 1) {
|
||||
} elseif ($numero_totale == 1) {
|
||||
flash()->info(tr('_NUM_ prezzo modificato!', [
|
||||
'_NUM_' => $numero_totale,
|
||||
]));
|
||||
@ -1088,7 +1080,6 @@ switch ($op) {
|
||||
flash()->warning(tr('Nessun prezzo modificato!'));
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ $idtipodocumento = $dbo->selectOne('co_tipidocumento', ['id'], [
|
||||
<div id="info-title-bozza" class="box">
|
||||
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">'.tr("Fatture in stato Bozza del cliente").'</h3>
|
||||
<h3 class="box-title">'.tr('Fatture in stato Bozza del cliente').'</h3>
|
||||
<div class="box-tools pull-right">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse">
|
||||
<i class="fa fa-minus"></i>
|
||||
@ -100,7 +100,7 @@ $idtipodocumento = $dbo->selectOne('co_tipidocumento', ['id'], [
|
||||
<div class="col-md-6">
|
||||
<div id="info-title-scadute" class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">'.tr("Fatture con termini di pagamento trascorsi").'</h3>
|
||||
<h3 class="box-title">'.tr('Fatture con termini di pagamento trascorsi').'</h3>
|
||||
<div class="box-tools pull-right">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse">
|
||||
<i class="fa fa-minus"></i>
|
||||
@ -116,7 +116,7 @@ $idtipodocumento = $dbo->selectOne('co_tipidocumento', ['id'], [
|
||||
<!-- DETTAGLI CLIENTE -->
|
||||
<div class="box box-info collapsable collapsed-box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">'.tr("Dettagli cliente").'</h3>
|
||||
<h3 class="box-title">'.tr('Dettagli cliente').'</h3>
|
||||
<div class="box-tools pull-right">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse">
|
||||
<i class="fa fa-plus"></i>
|
||||
@ -125,7 +125,7 @@ $idtipodocumento = $dbo->selectOne('co_tipidocumento', ['id'], [
|
||||
</div>
|
||||
|
||||
<div class="box-body" id="dettagli_cliente">
|
||||
'.tr("Seleziona prima un cliente").'...
|
||||
'.tr('Seleziona prima un cliente').'...
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
|
@ -82,8 +82,8 @@ foreach ($rs as $key => $value) {
|
||||
$prezzo = $intervento->totale;
|
||||
|
||||
$rs[$key]['prezzo'] = Translator::numberToLocale($prezzo);
|
||||
$rs[$key]['descrizione_intervento'] = str_replace("'", " ", strip_tags($rs[$key]['descrizione_intervento']));
|
||||
$rs[$key]['info'] = str_replace("'", " ", strip_tags($module_interventi->replacePlaceholders($value['id'], setting('Descrizione personalizzata in fatturazione')))) ?: $rs[$key]['info'];
|
||||
$rs[$key]['descrizione_intervento'] = str_replace("'", ' ', strip_tags($rs[$key]['descrizione_intervento']));
|
||||
$rs[$key]['info'] = str_replace("'", ' ', strip_tags($module_interventi->replacePlaceholders($value['id'], setting('Descrizione personalizzata in fatturazione')))) ?: $rs[$key]['info'];
|
||||
}
|
||||
|
||||
// Intervento
|
||||
|
@ -19,17 +19,17 @@
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Modules\Aggiornamenti\Controlli\DatiFattureElettroniche;
|
||||
use Modules\Anagrafiche\Anagrafica;
|
||||
use Modules\Fatture\Export\CSV;
|
||||
use Modules\Fatture\Fattura;
|
||||
use Modules\Fatture\Stato;
|
||||
use Plugins\ExportFE\FatturaElettronica;
|
||||
use Plugins\ExportFE\Interaction;
|
||||
use Plugins\ReceiptFE\Ricevuta;
|
||||
use Util\XML;
|
||||
use Util\Zip;
|
||||
use Modules\Fatture\Stato;
|
||||
use Plugins\ReceiptFE\Ricevuta;
|
||||
use Carbon\Carbon;
|
||||
|
||||
$anagrafica_azienda = Anagrafica::find(setting('Azienda predefinita'));
|
||||
$stato_emessa = $dbo->selectOne('co_statidocumento', 'id', ['descrizione' => 'Emessa'])['id'];
|
||||
@ -97,7 +97,7 @@ switch (post('op')) {
|
||||
|
||||
if (!empty($id_records)) {
|
||||
foreach ($id_records as $id_record) {
|
||||
Prints::render( $id_print, $id_record, $dir.'tmp/', false, true);
|
||||
Prints::render($id_print, $id_record, $dir.'tmp/', false, true);
|
||||
}
|
||||
|
||||
// Creazione zip
|
||||
@ -333,10 +333,9 @@ switch (post('op')) {
|
||||
if (post('skip_time') == 'Anno') {
|
||||
$data = date('Y-m-d', strtotime('+1 year', strtotime($fattura->data)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
$new = $fattura->replicate();
|
||||
|
||||
|
||||
$new->data = $data;
|
||||
$new->id_segment = $id_segment;
|
||||
$new->numero = Fattura::getNextNumero($data, $dir, $id_segment);
|
||||
@ -363,7 +362,7 @@ switch (post('op')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($fattura->numero_esterno)){
|
||||
if (!empty($fattura->numero_esterno)) {
|
||||
array_push($list, $fattura->numero_esterno);
|
||||
}
|
||||
}
|
||||
@ -487,7 +486,7 @@ switch (post('op')) {
|
||||
WHERE
|
||||
co_statidocumento.descrizione = "Emessa" AND co_tipidocumento.dir="entrata" AND co_documenti.id_segment='.$fattura->id_segment);
|
||||
|
||||
if ((setting('Data emissione fattura automatica') == 1) && ($dir == 'entrata') && (Carbon::parse($data)->lessThan(Carbon::parse($data_fattura_precedente['datamax']))) && (!empty($data_fattura_precedente['datamax']))){
|
||||
if ((setting('Data emissione fattura automatica') == 1) && ($dir == 'entrata') && (Carbon::parse($data)->lessThan(Carbon::parse($data_fattura_precedente['datamax']))) && (!empty($data_fattura_precedente['datamax']))) {
|
||||
$fattura->data = $data_fattura_precedente['datamax'];
|
||||
$fattura->data_competenza = $data_fattura_precedente['datamax'];
|
||||
}
|
||||
@ -556,11 +555,9 @@ switch (post('op')) {
|
||||
|
||||
case 'verify-notifiche':
|
||||
foreach ($id_records as $id) {
|
||||
|
||||
$documento = Fattura::find($id);
|
||||
|
||||
if($documento->codice_stato_fe == 'GEN' || $documento->codice_stato_fe == 'WAIT'){
|
||||
|
||||
if ($documento->codice_stato_fe == 'GEN' || $documento->codice_stato_fe == 'WAIT') {
|
||||
$result = Interaction::getInvoiceRecepits($id);
|
||||
$last_recepit = $result['results'][0];
|
||||
if (!empty($last_recepit)) {
|
||||
@ -577,12 +574,12 @@ switch (post('op')) {
|
||||
|
||||
foreach ($id_records as $id) {
|
||||
$documento = Fattura::find($id);
|
||||
++ $count;
|
||||
++$count;
|
||||
|
||||
if($documento->stato->descrizione == 'Bozza') {
|
||||
if ($documento->stato->descrizione == 'Bozza') {
|
||||
$documento->id_segment = post('id_segment');
|
||||
$documento->save();
|
||||
++ $n_doc;
|
||||
++$n_doc;
|
||||
}
|
||||
}
|
||||
|
||||
@ -597,7 +594,7 @@ switch (post('op')) {
|
||||
'_NUM_' => $count - $n_doc,
|
||||
]));
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -620,7 +617,7 @@ $operations['export-csv'] = [
|
||||
$operations['copy-bulk'] = [
|
||||
'text' => '<span><i class="fa fa-copy"></i> '.tr('Duplica selezionati').'</span>',
|
||||
'data' => [
|
||||
'msg' => tr('Vuoi davvero duplicare le righe selezionate?').'<br><br>{[ "type": "select", "label": "'.tr('Fattura in avanti di').'", "name": "skip_time", "required": 1, "values": "list=\"Giorno\":\"'.tr('Un giorno').'\", \"Settimana\":\"'.tr('Una settimana').'\", \"Mese\":\"'.tr('Un mese').'\", \"Anno\":\"'.tr('Un anno').'\" ", "value": "Giorno" ]}<br>{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "ajax-source": "segmenti", "select-options": '.json_encode(["id_module" => $id_module, 'is_sezionale' => 1]).', "value": "'.$_SESSION['module_'.$id_module]['id_segment'].'", "select-options-escape": true ]}<br>{[ "type": "checkbox", "label": "'.tr('Aggiungere i riferimenti ai documenti esterni?').'", "placeholder": "'.tr('Aggiungere i riferimenti ai documenti esterni?').'", "name": "riferimenti" ]}',
|
||||
'msg' => tr('Vuoi davvero duplicare le righe selezionate?').'<br><br>{[ "type": "select", "label": "'.tr('Fattura in avanti di').'", "name": "skip_time", "required": 1, "values": "list=\"Giorno\":\"'.tr('Un giorno').'\", \"Settimana\":\"'.tr('Una settimana').'\", \"Mese\":\"'.tr('Un mese').'\", \"Anno\":\"'.tr('Un anno').'\" ", "value": "Giorno" ]}<br>{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "ajax-source": "segmenti", "select-options": '.json_encode(['id_module' => $id_module, 'is_sezionale' => 1]).', "value": "'.$_SESSION['module_'.$id_module]['id_segment'].'", "select-options-escape": true ]}<br>{[ "type": "checkbox", "label": "'.tr('Aggiungere i riferimenti ai documenti esterni?').'", "placeholder": "'.tr('Aggiungere i riferimenti ai documenti esterni?').'", "name": "riferimenti" ]}',
|
||||
'button' => tr('Procedi'),
|
||||
'class' => 'btn btn-lg btn-warning',
|
||||
],
|
||||
@ -733,7 +730,7 @@ $operations['cambia-sezionale'] = [
|
||||
'title' => tr('Cambia sezionale'),
|
||||
'msg' => tr('Scegli il sezionale _TIPOLOGIA_ in cui spostare le fatture in stato "Bozza" selezionate', [
|
||||
'_TIPOLOGIA_' => $is_fiscale ? tr('fiscale') : tr('non fiscale'),
|
||||
]).':<br><br>{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "ajax-source": "segmenti", "select-options": '.json_encode(["id_module" => $id_module, 'is_sezionale' => 1, 'is_fiscale' => $is_fiscale, 'escludi_id' => $_SESSION['module_'.$id_module]['id_segment']]).', "select-options-escape": true ]}',
|
||||
]).':<br><br>{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "ajax-source": "segmenti", "select-options": '.json_encode(['id_module' => $id_module, 'is_sezionale' => 1, 'is_fiscale' => $is_fiscale, 'escludi_id' => $_SESSION['module_'.$id_module]['id_segment']]).', "select-options-escape": true ]}',
|
||||
'button' => tr('Procedi'),
|
||||
'class' => 'btn btn-lg btn-warning',
|
||||
'blank' => false,
|
||||
|
@ -29,14 +29,14 @@ if ($module->name == 'Fatture di vendita') {
|
||||
}
|
||||
|
||||
if ($dir == 'entrata' || !empty($abilita_autofattura)) {
|
||||
echo '
|
||||
echo '
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary unblockable dropdown-toggle '.(((!empty($record['ref_documento']) || $record['stato'] != 'Bozza') and (empty($record['is_reversed']) || !empty($abilita_autofattura))) ? '' : 'disabled').'" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fa fa-magic"></i> '.tr('Crea').'
|
||||
<span class="caret"></span>
|
||||
</button>';
|
||||
if ($dir == 'entrata') {
|
||||
echo '
|
||||
echo '
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
<li><a href="'.base_path().'/editor.php?id_module='.$id_module.'&id_record='.$id_record.'&op=nota_addebito&backto=record-edit">
|
||||
'.tr('Nota di debito').'
|
||||
@ -47,19 +47,19 @@ echo '
|
||||
</a></li>
|
||||
</ul>';
|
||||
} elseif (!empty($abilita_autofattura)) {
|
||||
echo '
|
||||
echo '
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
<li><a data-href="'.base_path().'/modules/fatture/crea_autofattura.php?id_module='.$id_module.'&id_record='.$id_record.'&iddocumento='.$id_record.'" data-title="Aggiungi autofattura">
|
||||
'.tr('Autofattura').'
|
||||
</a></li>
|
||||
</ul>';
|
||||
</ul>';
|
||||
}
|
||||
echo '
|
||||
echo '
|
||||
</div>';
|
||||
}
|
||||
|
||||
if (empty($record['is_fiscale'])) {
|
||||
$msg = '<br>{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "ajax-source": "segmenti", "select-options": '.json_encode(["id_module" => $id_module, 'is_sezionale' => 1, 'is_fiscale' => 1]).', "select-options-escape": true ]}
|
||||
$msg = '<br>{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "ajax-source": "segmenti", "select-options": '.json_encode(['id_module' => $id_module, 'is_sezionale' => 1, 'is_fiscale' => 1]).', "select-options-escape": true ]}
|
||||
{[ "type": "date", "label": "'.tr('Data').'", "name": "data", "required": 1, "value": "-now-" ]}';
|
||||
|
||||
echo '
|
||||
@ -93,7 +93,6 @@ if (!empty($record['is_fiscale'])) {
|
||||
// Aggiunta prima nota solo se non c'è già, se non si è in bozza o se il pagamento non è completo
|
||||
$prima_nota_presente = $dbo->fetchNum('SELECT id FROM co_movimenti WHERE iddocumento = '.prepare($id_record).' AND primanota = 1');
|
||||
|
||||
|
||||
$registrazione_contabile = 0;
|
||||
if ($differenza != 0 || (!$prima_nota_presente && $record['stato'] == 'Emessa')) {
|
||||
$registrazione_contabile = 1;
|
||||
|
@ -29,33 +29,29 @@ $services_enable = Interaction::isEnabled();
|
||||
if ($module->name == 'Fatture di vendita' && $services_enable) {
|
||||
$documenti_scarto = [];
|
||||
$documenti_invio = [];
|
||||
$codici_scarto = ['EC02','ERR','ERVAL','NS'];
|
||||
$codici_invio = ['GEN','QUEUE'];
|
||||
$codici_scarto = ['EC02', 'ERR', 'ERVAL', 'NS'];
|
||||
$codici_invio = ['GEN', 'QUEUE'];
|
||||
$data_limite = (new Carbon())->subMonths(6);
|
||||
$data_limite_invio = (new Carbon())->subDays(10);
|
||||
$data_setting = Carbon::createFromFormat('d/m/Y', setting('Data inizio controlli su stati FE'))->format('Y-m-d');
|
||||
|
||||
|
||||
$documenti = Fattura::where('data', '>', $data_limite)->where('data', '>', $data_setting)->whereIn('codice_stato_fe', ['EC02','ERR','ERVAL','NS','GEN','QUEUE'])->get();
|
||||
$documenti = Fattura::where('data', '>', $data_limite)->where('data', '>', $data_setting)->whereIn('codice_stato_fe', ['EC02', 'ERR', 'ERVAL', 'NS', 'GEN', 'QUEUE'])->get();
|
||||
|
||||
foreach ($documenti as $documento) {
|
||||
|
||||
$stato_fe = $database->fetchOne('SELECT descrizione, icon FROM fe_stati_documento WHERE codice = '.prepare($documento->codice_stato_fe));
|
||||
|
||||
|
||||
if (in_array($documento->codice_stato_fe, $codici_scarto)) {
|
||||
|
||||
// In caso di NS verifico che non sia semplicemente un codice 00404 (Fattura duplicata)
|
||||
if ($documento->codice_stato_fe == 'NS'){
|
||||
|
||||
if ($documento->codice_stato_fe == 'NS') {
|
||||
$ricevuta_principale = $documento->getRicevutaPrincipale();
|
||||
|
||||
|
||||
if (!empty($ricevuta_principale)) {
|
||||
$contenuto_ricevuta = XML::readFile($ricevuta_principale->filepath);
|
||||
$lista_errori = $contenuto_ricevuta['ListaErrori'];
|
||||
if ($lista_errori) {
|
||||
$lista_errori = $lista_errori[0] ? $lista_errori : [$lista_errori];
|
||||
$errore = $lista_errori[0]['Errore'];
|
||||
if ($errore['Codice'] == '00404'){
|
||||
if ($errore['Codice'] == '00404') {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -69,15 +65,13 @@ if ($module->name == 'Fatture di vendita' && $services_enable) {
|
||||
]));
|
||||
|
||||
$show_avviso = $show_avviso ?: ($documento->data_stato_fe < (new Carbon())->subDays(4) ? 1 : 0);
|
||||
|
||||
|
||||
} elseif (in_array($documento->codice_stato_fe, $codici_invio)) {
|
||||
$is_estera = false;
|
||||
|
||||
|
||||
if (setting('Rimuovi avviso fatture estere')) {
|
||||
$is_estera = $database->fetchOne('SELECT idanagrafica FROM an_anagrafiche INNER JOIN an_nazioni ON an_anagrafiche.id_nazione = an_nazioni.id WHERE an_nazioni.nome != "Italia" AND an_anagrafiche.idanagrafica = '.prepare($documento->idanagrafica));
|
||||
}
|
||||
|
||||
|
||||
if ($documento->data <= $data_limite_invio && !$is_estera) {
|
||||
$documenti_invio[] = Modules::link('Fatture di vendita', $documento->id, tr('_ICON_ Fattura numero _NUM_ del _DATE_ : <b>_STATO_</b>', [
|
||||
'_ICON_' => '<i class="'.$stato_fe['icon'].'"></i>',
|
||||
@ -92,16 +86,16 @@ if ($module->name == 'Fatture di vendita' && $services_enable) {
|
||||
if (sizeof($documenti_scarto) > 0) {
|
||||
echo '
|
||||
<div class="alert alert-danger">
|
||||
<i class="fa fa-warning"></i> '.tr("<b>ATTENZIONE:</b> le seguenti fatture riscontrano problemi").':<ul>';
|
||||
foreach ($documenti_scarto as $documento) {
|
||||
echo '
|
||||
<i class="fa fa-warning"></i> '.tr('<b>ATTENZIONE:</b> le seguenti fatture riscontrano problemi').':<ul>';
|
||||
foreach ($documenti_scarto as $documento) {
|
||||
echo '
|
||||
<li><b>'.$documento.'</b></li>';
|
||||
}
|
||||
}
|
||||
echo '
|
||||
</ul>';
|
||||
if ($show_avviso) {
|
||||
echo tr('Cosa fare in caso di fattura elettronica scartata? Dovrai correggere la fattura e inviarla di nuovo al SdI <b>entro 5 giorni dalla data di notifica dello scarto</b>, mantenendo lo stesso numero e data del documento.');
|
||||
}
|
||||
if ($show_avviso) {
|
||||
echo tr('Cosa fare in caso di fattura elettronica scartata? Dovrai correggere la fattura e inviarla di nuovo al SdI <b>entro 5 giorni dalla data di notifica dello scarto</b>, mantenendo lo stesso numero e data del documento.');
|
||||
}
|
||||
echo '
|
||||
</div>';
|
||||
}
|
||||
@ -109,11 +103,11 @@ if ($module->name == 'Fatture di vendita' && $services_enable) {
|
||||
if (sizeof($documenti_invio) > 0) {
|
||||
echo '
|
||||
<div class="alert alert-warning">
|
||||
<i class="fa fa-clock-o"></i> '.tr("Le seguenti fatture sono in attesa di essere inviate").':<ul>';
|
||||
foreach ($documenti_invio as $documento) {
|
||||
echo '
|
||||
<i class="fa fa-clock-o"></i> '.tr('Le seguenti fatture sono in attesa di essere inviate').':<ul>';
|
||||
foreach ($documenti_invio as $documento) {
|
||||
echo '
|
||||
<li><b>'.$documento.'</b></li>';
|
||||
}
|
||||
}
|
||||
echo '
|
||||
</ul>
|
||||
</div>';
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Modules\Anagrafiche\Anagrafica;
|
||||
use Modules\Anagrafiche\Nazione;
|
||||
use Modules\Fatture\Fattura;
|
||||
use Modules\Fatture\Gestori\Bollo;
|
||||
use Modules\Interventi\Intervento;
|
||||
@ -39,7 +38,7 @@ if ($dir == 'entrata') {
|
||||
}
|
||||
|
||||
// Informazioni sulla dichiarazione d'intento, visibili solo finchè la fattura è in bozza
|
||||
if ($dir == 'entrata' && !empty($fattura->dichiarazione) ) {
|
||||
if ($dir == 'entrata' && !empty($fattura->dichiarazione)) {
|
||||
$diff = $fattura->dichiarazione->massimale - $fattura->dichiarazione->totale;
|
||||
$diff_in_days = Carbon::parse($fattura->dichiarazione->data_fine)->diffAsCarbonInterval($fattura->data);
|
||||
|
||||
@ -47,7 +46,6 @@ if ($dir == 'entrata' && !empty($fattura->dichiarazione) ) {
|
||||
$iva = Aliquota::find($id_iva);
|
||||
|
||||
if (!empty($iva)) {
|
||||
|
||||
if ($diff == 0) {
|
||||
echo '
|
||||
<div class="alert alert-info">
|
||||
@ -64,8 +62,7 @@ if ($dir == 'entrata' && !empty($fattura->dichiarazione) ) {
|
||||
'_PROTOCOLLO_' => $fattura->dichiarazione->numero_protocollo,
|
||||
]).'.</b>
|
||||
</div>';
|
||||
}
|
||||
elseif ($diff_in_days < 0) {
|
||||
} elseif ($diff_in_days < 0) {
|
||||
echo '
|
||||
<div class="alert alert-warning">
|
||||
<i class="fa fa-warning"></i> '.tr("La dichiarazione d'intento _PROTOCOLLO_ ha come data fine validità _SCADENZA_ mentre la fattura ha data _DATA_", [
|
||||
@ -75,7 +72,6 @@ if ($dir == 'entrata' && !empty($fattura->dichiarazione) ) {
|
||||
]).'.</b>
|
||||
</div>';
|
||||
}
|
||||
|
||||
} else {
|
||||
//TODO link ad impostazioni con nuova ricerca rapida
|
||||
echo '
|
||||
@ -116,7 +112,7 @@ if ($abilita_autofattura) {
|
||||
} elseif ($autofattura_collegata != null) {
|
||||
echo '
|
||||
<div class="alert alert-info">
|
||||
<i class="fa fa-info"></i> '.tr("Questa autofattura è già stata importata come fattura di acquisto").':
|
||||
<i class="fa fa-info"></i> '.tr('Questa autofattura è già stata importata come fattura di acquisto').':
|
||||
<b>'.Modules::link('Fatture di acquisto', $autofattura_collegata->id, tr('Fattura num. _NUM_ del _DATE_', [
|
||||
'_NUM_' => $autofattura_collegata->numero_esterno,
|
||||
'_DATE_' => dateFormat($autofattura_collegata->data),
|
||||
@ -135,7 +131,7 @@ if (!empty($note_accredito)) {
|
||||
]);
|
||||
|
||||
echo '
|
||||
<br>'.Modules::link( ($dir == 'entrata' ? 'Fatture di vendita' : 'Fatture di acquisto' ), $nota['id'], $text, $text);
|
||||
<br>'.Modules::link(($dir == 'entrata' ? 'Fatture di vendita' : 'Fatture di acquisto'), $nota['id'], $text, $text);
|
||||
}
|
||||
echo '
|
||||
</div>';
|
||||
@ -146,7 +142,7 @@ if (!empty($fattura->ref_documento) && $fattura->isNota()) {
|
||||
$nota = Fattura::find($fattura->ref_documento);
|
||||
echo '
|
||||
<div class="alert alert-info">
|
||||
<i class="fa fa-info"></i> '.tr("Questa è una _TIPO_ generata dalla seguente fattura", [
|
||||
<i class="fa fa-info"></i> '.tr('Questa è una _TIPO_ generata dalla seguente fattura', [
|
||||
'_TIPO_' => $fattura->tipo->descrizione,
|
||||
]).':
|
||||
<b>'.Modules::link($module->name, $fattura->ref_documento, tr('Fattura num. _NUM_ del _DATE_', [
|
||||
@ -157,14 +153,12 @@ if (!empty($fattura->ref_documento) && $fattura->isNota()) {
|
||||
}
|
||||
|
||||
// Ricordo che si sta emettendo una fattura conto terzi
|
||||
if ($dir == 'entrata' && $fattura->stato->descrizione == 'Bozza' ) {
|
||||
if ($fattura->is_fattura_conto_terzi){
|
||||
|
||||
if ($dir == 'entrata' && $fattura->stato->descrizione == 'Bozza') {
|
||||
if ($fattura->is_fattura_conto_terzi) {
|
||||
echo '
|
||||
<div class="alert alert-info">
|
||||
<i class="fa fa-info"></i> '.tr("Questa è una fattura per conto di terzi. Nell'XML della Fattura Elettronica sarà indicato il fornitore _FORNITORE_ come cessionario e il cliente come cedente/prestatore", ['_FORNITORE_' => '"<b>'.stripslashes($database->fetchOne('SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica = '.prepare(setting('Azienda predefinita')))['ragione_sociale']).'</b>"',]).'.</b>
|
||||
<i class="fa fa-info"></i> '.tr("Questa è una fattura per conto di terzi. Nell'XML della Fattura Elettronica sarà indicato il fornitore _FORNITORE_ come cessionario e il cliente come cedente/prestatore", ['_FORNITORE_' => '"<b>'.stripslashes($database->fetchOne('SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica = '.prepare(setting('Azienda predefinita')))['ragione_sociale']).'</b>"']).'.</b>
|
||||
</div>';
|
||||
|
||||
}
|
||||
}
|
||||
// Verifica aggiuntive sulla sequenzialità dei numeri
|
||||
@ -312,7 +306,7 @@ elseif ($record['stato'] == 'Bozza') {
|
||||
if ($record['idagente'] != 0) {
|
||||
echo Modules::link('Anagrafiche', $record['idagente_fattura'], null, null, 'class="pull-right"');
|
||||
}
|
||||
echo '
|
||||
echo '
|
||||
{[ "type": "select", "label": "'.tr('Agente di riferimento').'", "name": "idagente", "ajax-source": "agenti", "select-options": {"idanagrafica": '.$record['idanagrafica'].'}, "value": "$idagente_fattura$" ]}
|
||||
</div>';
|
||||
}
|
||||
@ -371,10 +365,9 @@ echo '
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<?php
|
||||
if ($record['id_banca_azienda'] != 0) {
|
||||
echo Modules::link('Banche', $record['id_banca_azienda'], null, null, 'class="pull-right"');
|
||||
}
|
||||
<?php if ($record['id_banca_azienda'] != 0) {
|
||||
echo Modules::link('Banche', $record['id_banca_azienda'], null, null, 'class="pull-right"');
|
||||
}
|
||||
?>
|
||||
{[ "type": "select", "label": "<?php echo tr('Banca azienda'); ?>", "name": "id_banca_azienda", "ajax-source": "banche", "select-options": <?php echo json_encode(['id_anagrafica' => $anagrafica_azienda->id]); ?>, "value": "$id_banca_azienda$", "icon-after": "add|<?php echo Modules::get('Banche')['id']; ?>|id_anagrafica=<?php echo $anagrafica_azienda->id; ?>", "extra": " <?php echo (intval($block_edit)) ? 'disabled' : ''; ?> " ]}
|
||||
</div>
|
||||
@ -457,7 +450,6 @@ echo '
|
||||
echo '<div class="col-md-3">
|
||||
{[ "type": "number", "label": "'.tr('Sconto in fattura').'", "name": "sconto_finale", "value": "'.($fattura->sconto_finale_percentuale ?: $fattura->sconto_finale).'", "icon-after": "choice|untprc|'.(empty($fattura->sconto_finale) ? 'PRC' : 'UNT').'", "help": "'.tr('Sconto in fattura, utilizzabile per applicare sconti sul Netto a pagare del documento e le relative scadenze').'. '.tr('Per utilizzarlo in relazione a una riga della Fattura Elettronica, inserire il tipo di dato in \'\'Attributi avanzati\'\' -> \'\'Altri Dati Gestionali\'\' -> \'\'TipoDato\'\' e il testo di descrizione in \'\'Attributi avanzati\'\' -> \'\'Altri Dati Gestionali\'\' -> \'\'RiferimentoTesto\'\' della specifica riga').'. '.tr('Nota: lo sconto in fattura non influenza i movimenti contabili').'." ]}
|
||||
</div>';
|
||||
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
@ -555,13 +547,12 @@ if ($record['descrizione_tipo'] == 'Fattura accompagnatoria di vendita') {
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">';
|
||||
if (!empty($record['idvettore'])) {
|
||||
echo Modules::link('Anagrafiche', $record['idvettore'], null, null, 'class="pull-right"');
|
||||
}
|
||||
$esterno = $dbo->selectOne('dt_spedizione', 'esterno', [
|
||||
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'];
|
||||
?>
|
||||
])['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-after": "add|<?php echo Modules::get('Anagrafiche')['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>
|
||||
@ -693,22 +684,18 @@ echo '
|
||||
</form>';
|
||||
|
||||
//Dich. intento collegata
|
||||
if ($dir == 'entrata' && !empty($fattura->dichiarazione)){
|
||||
|
||||
$ive_accettate = $dbo->table('co_iva')->where('codice_natura_fe','N3.5')->get();
|
||||
foreach($ive_accettate as $iva_accettata){
|
||||
if ($dir == 'entrata' && !empty($fattura->dichiarazione)) {
|
||||
$ive_accettate = $dbo->table('co_iva')->where('codice_natura_fe', 'N3.5')->get();
|
||||
foreach ($ive_accettate as $iva_accettata) {
|
||||
$descrizione_iva_accettata .= '<li>'.$iva_accettata->descrizione.'</li>';
|
||||
}
|
||||
|
||||
if ($fattura->stato->descrizione == 'Bozza'){
|
||||
|
||||
|
||||
if ($fattura->stato->descrizione == 'Bozza') {
|
||||
echo '
|
||||
<div class="alert alert-info">
|
||||
<i class="fa fa-info"></i> '.tr("La fattura è collegata ad una dichiarazione d'intento con diponibilità residura pari a _MONEY_.", [ '_MONEY_' => moneyFormat($diff),]).'<br>'.tr("Per collegare una riga alla dichiarazione è sufficiente specificare come IVA <ul>_IVA_</ul>", ['_IVA_' => $descrizione_iva_accettata]).'</b>
|
||||
<i class="fa fa-info"></i> '.tr("La fattura è collegata ad una dichiarazione d'intento con diponibilità residura pari a _MONEY_.", ['_MONEY_' => moneyFormat($diff)]).'<br>'.tr('Per collegare una riga alla dichiarazione è sufficiente specificare come IVA <ul>_IVA_</ul>', ['_IVA_' => $descrizione_iva_accettata]).'</b>
|
||||
</div>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
@ -774,8 +761,8 @@ if (!$block_edit) {
|
||||
$ordini = $dbo->fetchArray($ordini_query)[0]['tot'];
|
||||
}
|
||||
|
||||
// Form di inserimento riga documento
|
||||
echo '
|
||||
// Form di inserimento riga documento
|
||||
echo '
|
||||
<form id="link_form" action="" method="post">
|
||||
<input type="hidden" name="op" value="add_articolo">
|
||||
<input type="hidden" name="backto" value="record-edit">
|
||||
@ -815,9 +802,9 @@ if (!$block_edit) {
|
||||
<i class="fa fa-plus"></i> '.tr('Sconto/maggiorazione').'
|
||||
</a>
|
||||
</li>';
|
||||
if (empty($record['ref_documento'])) {
|
||||
if ($dir == 'entrata') {
|
||||
echo '
|
||||
if (empty($record['ref_documento'])) {
|
||||
if ($dir == 'entrata') {
|
||||
echo '
|
||||
<li>
|
||||
<a class="'.(!empty($interventi) ? '' : ' disabled').'" style="cursor:pointer" data-href="'.$structure->fileurl('add_intervento.php').'?id_module='.$id_module.'&id_record='.$id_record.'" data-toggle="modal" data-title="'.tr('Aggiungi Attività').'" onclick="saveForm()">
|
||||
<i class="fa fa-plus"></i> '.tr('Attività').'
|
||||
@ -835,8 +822,8 @@ if (!$block_edit) {
|
||||
<i class="fa fa-plus"></i> '.tr('Contratto').'
|
||||
</a>
|
||||
</li>';
|
||||
}
|
||||
echo '
|
||||
}
|
||||
echo '
|
||||
<li>
|
||||
<a class="'.(!empty($ddt) ? '' : ' disabled').'" style="cursor:pointer" data-href="'.$structure->fileurl('add_ddt.php').'?id_module='.$id_module.'&id_record='.$id_record.'" data-toggle="modal" data-title="'.tr('Aggiungi Ddt').'" onclick="saveForm()">
|
||||
<i class="fa fa-plus"></i> '.tr('Ddt').'
|
||||
@ -848,8 +835,8 @@ if (!$block_edit) {
|
||||
<i class="fa fa-plus"></i> '.tr('Ordine').'
|
||||
</a>
|
||||
</li>';
|
||||
}
|
||||
echo '
|
||||
}
|
||||
echo '
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -946,8 +933,6 @@ echo '
|
||||
.selectSetNew(data.id_pagamento, data.desc_pagamento, {"id_banca_vendite": data.id_banca_vendite, "id_banca_acquisti": data.id_banca_acquisti, "descrizione_banca_vendite": data.descrizione_banca_vendite, "descrizione_banca_acquisti": data.descrizione_banca_acquisti});
|
||||
}
|
||||
}';
|
||||
|
||||
|
||||
|
||||
if ($dir == 'entrata') {
|
||||
echo '$("#idsede_destinazione").selectReset();';
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user