mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-01 16:36:45 +01:00
Formattazione del codice
This commit is contained in:
parent
4a1244c9a1
commit
84ddf4de32
21
ajax.php
21
ajax.php
@ -46,15 +46,14 @@ switch (get('op')) {
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'list_attachments':
|
||||
|
||||
$id_module = get('id_module');
|
||||
$id_record = get('id_record');
|
||||
$id_plugin = get('id_plugin');
|
||||
|
||||
echo '{( "name": "filelist_and_upload", "id_module": "'.$id_module.'", "id_record": "'.$id_record.'", "id_plugin": "'.$id_plugin.'", "ajax": "true" )}';
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 'list_attachments':
|
||||
|
||||
$id_module = get('id_module');
|
||||
$id_record = get('id_record');
|
||||
$id_plugin = get('id_plugin');
|
||||
|
||||
echo '{( "name": "filelist_and_upload", "id_module": "'.$id_module.'", "id_record": "'.$id_record.'", "id_plugin": "'.$id_plugin.'", "ajax": "true" )}';
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ if (empty($creation) && (!file_exists('config.inc.php') || !$valid_config)) {
|
||||
|
||||
if($(this).closest("form").parsley().validate()){
|
||||
prev_html = $("#install").html();
|
||||
$("#install").html("<i class=\'fa fa-spinner fa-pulse fa-fw\'></i> '.tr("Attendere").'...");
|
||||
$("#install").html("<i class=\'fa fa-spinner fa-pulse fa-fw\'></i> '.tr('Attendere').'...");
|
||||
$("#install").prop(\'disabled\', true);
|
||||
$("#test").prop(\'disabled\', true);
|
||||
|
||||
@ -251,7 +251,7 @@ if (empty($creation) && (!file_exists('config.inc.php') || !$valid_config)) {
|
||||
$("#test").on("click", function(){
|
||||
if($(this).closest("form").parsley().validate()){
|
||||
prev_html = $("#test").html();
|
||||
$("#test").html("<i class=\'fa fa-spinner fa-pulse fa-fw\'></i> '.tr("Attendere").'...");
|
||||
$("#test").html("<i class=\'fa fa-spinner fa-pulse fa-fw\'></i> '.tr('Attendere').'...");
|
||||
$("#test").prop(\'disabled\', true);
|
||||
$("#install").prop(\'disabled\', true);
|
||||
$(this).closest("form").ajaxSubmit({
|
||||
|
@ -1030,6 +1030,7 @@ function filelist_and_upload($id_module, $id_record, $label = 'Nuovo allegato:',
|
||||
* @param unknown $path
|
||||
*
|
||||
* @deprecated 2.3
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function deltree($path)
|
||||
@ -1060,6 +1061,7 @@ function deltree($path)
|
||||
* Carica gli script JavaScript inclusi nell'array indicato.
|
||||
*
|
||||
* @deprecated 2.3
|
||||
*
|
||||
* @param array $jscript_modules_array
|
||||
*/
|
||||
function loadJscriptModules($array)
|
||||
@ -1080,6 +1082,7 @@ function loadJscriptModules($array)
|
||||
* Carica i file di stile CSS inclusi nell'array indicato.
|
||||
*
|
||||
* @deprecated 2.3
|
||||
*
|
||||
* @param array $css_modules_array
|
||||
*/
|
||||
function loadCSSModules($array)
|
||||
@ -1107,7 +1110,7 @@ function loadCSSModules($array)
|
||||
* @deprecated 2.4
|
||||
*
|
||||
* @param string $str
|
||||
* @param int $qty
|
||||
* @param int $qty
|
||||
* @param string $mask
|
||||
*/
|
||||
function get_next_code($str, $qty = 1, $mask = '')
|
||||
|
@ -407,7 +407,7 @@ function create_thumbnails($tmp, $filename, $dir)
|
||||
function get_client_ip()
|
||||
{
|
||||
$ipaddress = '';
|
||||
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
||||
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
||||
$ipaddress = $_SERVER['HTTP_CLIENT_IP'];
|
||||
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
@ -417,10 +417,10 @@ function get_client_ip()
|
||||
$ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
|
||||
} elseif (!empty($_SERVER['HTTP_FORWARDED'])) {
|
||||
$ipaddress = $_SERVER['HTTP_FORWARDED'];
|
||||
} elseif (!empty($_SERVER['REMOTE_ADDR']) AND $_SERVER['REMOTE_ADDR']!='127.0.0.1' ) {
|
||||
} elseif (!empty($_SERVER['REMOTE_ADDR']) and $_SERVER['REMOTE_ADDR'] != '127.0.0.1') {
|
||||
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
} elseif (!empty(getHostByName(getHostName()))){
|
||||
$ipaddress = getHostByName(getHostName());
|
||||
} elseif (!empty(gethostbyname(gethostname()))) {
|
||||
$ipaddress = gethostbyname(gethostname());
|
||||
} else {
|
||||
$ipaddress = 'UNKNOWN';
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ foreach ($modules as $module) {
|
||||
|
||||
if ($comp) {
|
||||
$compatible = '<i class="fa fa-check-circle text-success" data-toggle="tooltip" title="'.tr('Compatibile').'"></i>';
|
||||
($module['enabled']) ? $class = 'success': $class = 'warning';
|
||||
($module['enabled']) ? $class = 'success' : $class = 'warning';
|
||||
} else {
|
||||
$compatible = '<i class="fa fa-warning text-danger" data-toggle="tooltip" title="'.tr('Non compatibile!').tr('Questo modulo è compatibile solo con le versioni').': '.$module['compatibility'].'"></i>';
|
||||
$class = 'danger';
|
||||
@ -198,7 +198,7 @@ foreach ($modules as $module) {
|
||||
|
||||
if ($comp) {
|
||||
$compatible = '<i class="fa fa-check-circle text-success" data-toggle="tooltip" title="'.tr('Compatibile').'"></i>';
|
||||
($sub['enabled']) ? $class = 'success': $class = 'warning';
|
||||
($sub['enabled']) ? $class = 'success' : $class = 'warning';
|
||||
} else {
|
||||
$compatible = '<i class="fa fa-warning text-danger" data-toggle="tooltip" title="'.tr('Non compatibile!').tr('Questo modulo è compatibile solo con le versioni').': '.$sub['compatibility'].'"></i>';
|
||||
$class = 'danger';
|
||||
|
@ -93,12 +93,11 @@ switch ($resource) {
|
||||
$where[] = "descrizione='Tecnico'";
|
||||
$where[] = 'deleted=0';
|
||||
|
||||
//come tecnico posso aprire attività solo a mio nome
|
||||
$user = Auth::user();
|
||||
if ($user['gruppo'] == 'Tecnici' AND !empty($user['idanagrafica']) ) {
|
||||
$where[] = 'an_anagrafiche.idanagrafica='.$user['idanagrafica'];
|
||||
}
|
||||
|
||||
//come tecnico posso aprire attività solo a mio nome
|
||||
$user = Auth::user();
|
||||
if ($user['gruppo'] == 'Tecnici' and !empty($user['idanagrafica'])) {
|
||||
$where[] = 'an_anagrafiche.idanagrafica='.$user['idanagrafica'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($search)) {
|
||||
|
@ -13,9 +13,9 @@ switch ($resource) {
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'clienti':
|
||||
$q = "SELECT AN.idanagrafica,
|
||||
|
||||
case 'clienti':
|
||||
$q = 'SELECT AN.idanagrafica,
|
||||
AN.ragione_sociale,
|
||||
AN.piva,
|
||||
AN.codice_fiscale,
|
||||
@ -41,14 +41,14 @@ switch ($resource) {
|
||||
HAVING 1=1 AND
|
||||
AN.deleted=0 AND
|
||||
AN.idanagrafica IN (SELECT idanagrafica FROM an_tipianagrafiche_anagrafiche WHERE idtipoanagrafica=1)
|
||||
ORDER BY AN.ragione_sociale";
|
||||
ORDER BY AN.ragione_sociale';
|
||||
|
||||
$results = $dbo->fetchArray( $q );
|
||||
$results = $dbo->fetchArray($q);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return [
|
||||
'an_anagrafiche',
|
||||
'clienti',
|
||||
'an_anagrafiche',
|
||||
'clienti',
|
||||
];
|
||||
|
@ -4,24 +4,24 @@ include_once __DIR__.'/../../core.php';
|
||||
|
||||
switch (post('op')) {
|
||||
case 'delete-bulk':
|
||||
|
||||
if ($debug){
|
||||
$id_azienda = $dbo->fetchArray("SELECT idtipoanagrafica FROM an_tipianagrafiche WHERE descrizione='Azienda'")[0]['idtipoanagrafica'];
|
||||
|
||||
foreach ($id_records as $id) {
|
||||
$records = $dbo->fetchArray('SELECT an_tipianagrafiche.idtipoanagrafica FROM an_tipianagrafiche INNER JOIN an_tipianagrafiche_anagrafiche ON an_tipianagrafiche.idtipoanagrafica=an_tipianagrafiche_anagrafiche.idtipoanagrafica WHERE idanagrafica='.prepare($id));
|
||||
$tipi = array_column($records, 'idtipoanagrafica');
|
||||
if ($debug) {
|
||||
$id_azienda = $dbo->fetchArray("SELECT idtipoanagrafica FROM an_tipianagrafiche WHERE descrizione='Azienda'")[0]['idtipoanagrafica'];
|
||||
|
||||
// Se l'anagrafica non è l'azienda principale, la disattivo
|
||||
if (!in_array($id_azienda, $tipi)) {
|
||||
$dbo->query('UPDATE an_anagrafiche SET deleted = 1 WHERE idanagrafica = '.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
}
|
||||
}
|
||||
foreach ($id_records as $id) {
|
||||
$records = $dbo->fetchArray('SELECT an_tipianagrafiche.idtipoanagrafica FROM an_tipianagrafiche INNER JOIN an_tipianagrafiche_anagrafiche ON an_tipianagrafiche.idtipoanagrafica=an_tipianagrafiche_anagrafiche.idtipoanagrafica WHERE idanagrafica='.prepare($id));
|
||||
$tipi = array_column($records, 'idtipoanagrafica');
|
||||
|
||||
$_SESSION['infos'][] = tr('Anagrafiche eliminate!');
|
||||
}else{
|
||||
$_SESSION['warnings'][] = tr('Procedura in fase di sviluppo. Nessuna modifica apportata.');
|
||||
}
|
||||
// Se l'anagrafica non è l'azienda principale, la disattivo
|
||||
if (!in_array($id_azienda, $tipi)) {
|
||||
$dbo->query('UPDATE an_anagrafiche SET deleted = 1 WHERE idanagrafica = '.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
}
|
||||
}
|
||||
|
||||
$_SESSION['infos'][] = tr('Anagrafiche eliminate!');
|
||||
} else {
|
||||
$_SESSION['warnings'][] = tr('Procedura in fase di sviluppo. Nessuna modifica apportata.');
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -156,8 +156,8 @@ if (!$cliente) {
|
||||
|
||||
<?php
|
||||
|
||||
if ($cliente || $fornitore) {
|
||||
?>
|
||||
if ($cliente || $fornitore) {
|
||||
?>
|
||||
|
||||
|
||||
<!-- ACQUISTI -->
|
||||
@ -239,8 +239,8 @@ if (!$cliente) {
|
||||
<div class="clearfix" ></div>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
@ -284,9 +284,9 @@ if (!$cliente) {
|
||||
</div>
|
||||
|
||||
<?php
|
||||
//se non è l'anagrafica azienda, ma cliente o fornitore
|
||||
if ((!str_contains($records[0]['idtipianagrafica'], $id_azienda)) or (($cliente or $fornitore))) {
|
||||
?>
|
||||
//se non è l'anagrafica azienda, ma cliente o fornitore
|
||||
if ((!str_contains($records[0]['idtipianagrafica'], $id_azienda)) or (($cliente or $fornitore))) {
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
{[ "type": "text", "label": "<?php echo tr('Appoggio bancario'); ?>", "name": "appoggiobancario", "value": "$appoggiobancario$" ]}
|
||||
@ -305,8 +305,8 @@ if (!$cliente) {
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<div class="row">
|
||||
@ -338,25 +338,25 @@ if (!$cliente) {
|
||||
<div class="col-md-12">
|
||||
{[ "type": "select", "multiple": "1", "label": "<?php echo tr('Tipo di anagrafica'); ?>", "name": "idtipoanagrafica[]", "values": "query=SELECT idtipoanagrafica AS id, descrizione FROM an_tipianagrafiche WHERE idtipoanagrafica NOT IN (SELECT DISTINCT(x.idtipoanagrafica) FROM an_tipianagrafiche_anagrafiche x INNER JOIN an_tipianagrafiche t ON x.idtipoanagrafica = t.idtipoanagrafica INNER JOIN an_anagrafiche ON an_anagrafiche.idanagrafica = x.idanagrafica WHERE t.descrizione = 'Azienda' AND deleted = 0) ORDER BY descrizione", "value": "$idtipianagrafica$" ]}
|
||||
<?php
|
||||
if (str_contains($records[0]['idtipianagrafica'], $id_azienda)) {
|
||||
echo '
|
||||
if (str_contains($records[0]['idtipianagrafica'], $id_azienda)) {
|
||||
echo '
|
||||
<p class=\'badge badge-info\' >'.tr('Questa anagrafica appartiene alla tipologia "Azienda"').'.</p>';
|
||||
}
|
||||
?>
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<?php
|
||||
if (in_array('Tecnico', explode(',', $records[0]['tipianagrafica']))) {
|
||||
?>
|
||||
if (in_array('Tecnico', explode(',', $records[0]['tipianagrafica']))) {
|
||||
?>
|
||||
<div class="col-md-3">
|
||||
{[ "type": "text", "label": "<?php echo tr('Colore'); ?>", "name": "colore", "class": "colorpicker text-center", "value": "$colore$", "extra": "maxlength='7'", "icon-after": "<div class='img-circle square'></div>" ]}
|
||||
</div>
|
||||
<?php
|
||||
} ?>
|
||||
} ?>
|
||||
<?php
|
||||
if (in_array('Cliente', explode(',', $records[0]['tipianagrafica']))) {
|
||||
?>
|
||||
if (in_array('Cliente', explode(',', $records[0]['tipianagrafica']))) {
|
||||
?>
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "Agenti secondari", "multiple": "1", "name": "idagenti[]", "values": "query=SELECT an_anagrafiche.idanagrafica AS id, IF(deleted=1, CONCAT(ragione_sociale, ' (Eliminato)'), ragione_sociale ) AS descrizione 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 WHERE (descrizione='Agente' AND deleted=0 AND an_anagrafiche.idanagrafica NOT IN (SELECT idagente FROM an_anagrafiche WHERE idanagrafica = <?php echo prepare($records[0]['idanagrafica']); ?> )) OR (an_anagrafiche.idanagrafica IN (SELECT idagente FROM an_anagrafiche_agenti WHERE idanagrafica = <?php echo prepare($records[0]['idanagrafica']); ?> ) ) ORDER BY ragione_sociale", "value": "$idagenti$" ]}
|
||||
</div>
|
||||
@ -365,7 +365,7 @@ if (!$cliente) {
|
||||
{[ "type": "select", "label": "<?php echo tr('Relazione con il cliente'); ?>", "name": "idrelazione", "values": "query=SELECT id, descrizione, colore AS _bgcolor_ FROM an_relazioni ORDER BY descrizione", "value": "$idrelazione$" ]}
|
||||
</div>
|
||||
<?php
|
||||
} ?>
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
|
||||
@ -428,10 +428,9 @@ if (!empty($google)) {
|
||||
|
||||
<?php
|
||||
|
||||
if (!$records[0]['deleted']){
|
||||
|
||||
//fatture, ddt, preventivi, contratti, ordini, interventi, utenti collegati a questa anagrafica
|
||||
$elementi = $dbo->fetchArray('SELECT `co_documenti`.`id`, `co_documenti`.`data`, `co_documenti`.`numero`, `co_documenti`.`numero_esterno`, `co_tipidocumento`.`descrizione` AS tipo_documento, `co_tipidocumento`.`dir` FROM `co_documenti` JOIN `co_tipidocumento` ON `co_tipidocumento`.`id` = `co_documenti`.`idtipodocumento` WHERE `co_documenti`.`id` IN (SELECT `iddocumento` FROM `co_righe_documenti` WHERE `idanagrafica` = '.prepare($id_record).')
|
||||
if (!$records[0]['deleted']) {
|
||||
//fatture, ddt, preventivi, contratti, ordini, interventi, utenti collegati a questa anagrafica
|
||||
$elementi = $dbo->fetchArray('SELECT `co_documenti`.`id`, `co_documenti`.`data`, `co_documenti`.`numero`, `co_documenti`.`numero_esterno`, `co_tipidocumento`.`descrizione` AS tipo_documento, `co_tipidocumento`.`dir` FROM `co_documenti` JOIN `co_tipidocumento` ON `co_tipidocumento`.`id` = `co_documenti`.`idtipodocumento` WHERE `co_documenti`.`id` IN (SELECT `iddocumento` FROM `co_righe_documenti` WHERE `idanagrafica` = '.prepare($id_record).')
|
||||
|
||||
UNION
|
||||
SELECT `zz_users`.`id`, `zz_users`.`created_at` AS data, `zz_users`.`username` AS numero, 0 AS `numero_esterno`, "Utente" AS tipo_documento, 0 AS `dir` FROM `zz_users` WHERE `zz_users`.`idanagrafica` = '.prepare($id_record).'
|
||||
@ -451,76 +450,64 @@ if (!$records[0]['deleted']){
|
||||
UNION
|
||||
SELECT `co_preventivi`.`id`, `co_preventivi`.`data_bozza`, `co_preventivi`.`numero`, 0 AS numero_esterno , "Preventivo" AS tipo_documento, 0 AS dir FROM `co_preventivi` WHERE `co_preventivi`.`id` IN (SELECT `idpreventivo` FROM `co_righe_preventivi` WHERE `idanagrafica` = '.prepare($id_record).') ORDER BY `data`');
|
||||
|
||||
if (!empty($elementi)) {
|
||||
echo '
|
||||
if (!empty($elementi)) {
|
||||
echo '
|
||||
<div class="alert alert-warning">
|
||||
<p>'.tr('_NUM_ altr_I_ document_I_ collegat_I_', [
|
||||
'_NUM_' => count($elementi),
|
||||
'_I_' => (count($elementi) > 1) ? tr('i') : tr('o'),
|
||||
]).':</p>
|
||||
'_NUM_' => count($elementi),
|
||||
'_I_' => (count($elementi) > 1) ? tr('i') : tr('o'),
|
||||
]).':</p>
|
||||
<ul>';
|
||||
|
||||
foreach ($elementi as $elemento) {
|
||||
$descrizione = tr('_DOC_ _NUM_ del _DATE_', [
|
||||
'_DOC_' => $elemento['tipo_documento'],
|
||||
'_NUM_' => !empty($elemento['numero_esterno']) ? $elemento['numero_esterno'] : $elemento['numero'],
|
||||
'_DATE_' => Translator::dateToLocale($elemento['data']),
|
||||
]);
|
||||
foreach ($elementi as $elemento) {
|
||||
$descrizione = tr('_DOC_ _NUM_ del _DATE_', [
|
||||
'_DOC_' => $elemento['tipo_documento'],
|
||||
'_NUM_' => !empty($elemento['numero_esterno']) ? $elemento['numero_esterno'] : $elemento['numero'],
|
||||
'_DATE_' => Translator::dateToLocale($elemento['data']),
|
||||
]);
|
||||
|
||||
//se non è un preventivo è un ddt o una fattura
|
||||
//se non è un ddt è una fattura.
|
||||
if (in_array($elemento['tipo_documento'], ['Utente'])) {
|
||||
$modulo = 'Utenti e permessi';
|
||||
}
|
||||
elseif (in_array($elemento['tipo_documento'], ['Intervento'])) {
|
||||
$modulo = 'Interventi';
|
||||
}
|
||||
elseif (in_array($elemento['tipo_documento'], ['Preventivo'])) {
|
||||
$modulo = 'Preventivi';
|
||||
}
|
||||
elseif (in_array($elemento['tipo_documento'], ['Contratto'])) {
|
||||
$modulo = 'Contratti';
|
||||
}
|
||||
elseif (in_array($elemento['tipo_documento'], ['Ordine cliente', 'Ordine fornitore'])) {
|
||||
$modulo = ($elemento['dir'] == 'entrata') ? 'Ordini cliente' : 'Ordini fornitore';
|
||||
}
|
||||
elseif (in_array($elemento['tipo_documento'], ['Ddt di vendita', 'Ddt di acquisto'])) {
|
||||
$modulo = ($elemento['dir'] == 'entrata') ? 'Ddt di vendita' : 'Ddt di acquisto';
|
||||
}
|
||||
else {
|
||||
$modulo = ($elemento['dir'] == 'entrata') ? 'Fatture di vendita' : 'Fatture di acquisto';
|
||||
}
|
||||
//se non è un preventivo è un ddt o una fattura
|
||||
//se non è un ddt è una fattura.
|
||||
if (in_array($elemento['tipo_documento'], ['Utente'])) {
|
||||
$modulo = 'Utenti e permessi';
|
||||
} elseif (in_array($elemento['tipo_documento'], ['Intervento'])) {
|
||||
$modulo = 'Interventi';
|
||||
} elseif (in_array($elemento['tipo_documento'], ['Preventivo'])) {
|
||||
$modulo = 'Preventivi';
|
||||
} elseif (in_array($elemento['tipo_documento'], ['Contratto'])) {
|
||||
$modulo = 'Contratti';
|
||||
} elseif (in_array($elemento['tipo_documento'], ['Ordine cliente', 'Ordine fornitore'])) {
|
||||
$modulo = ($elemento['dir'] == 'entrata') ? 'Ordini cliente' : 'Ordini fornitore';
|
||||
} elseif (in_array($elemento['tipo_documento'], ['Ddt di vendita', 'Ddt di acquisto'])) {
|
||||
$modulo = ($elemento['dir'] == 'entrata') ? 'Ddt di vendita' : 'Ddt di acquisto';
|
||||
} else {
|
||||
$modulo = ($elemento['dir'] == 'entrata') ? 'Fatture di vendita' : 'Fatture di acquisto';
|
||||
}
|
||||
|
||||
$id = $elemento['id'];
|
||||
$id = $elemento['id'];
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<li>'.Modules::link($modulo, $id, $descrizione).'</li>';
|
||||
}
|
||||
}
|
||||
|
||||
echo '
|
||||
echo '
|
||||
</ul>
|
||||
<p>'.tr('Eliminando questo documento si potrebbero verificare problemi nelle altre sezioni del gestionale.').'</p>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!str_contains($records[0]['idtipianagrafica'], $id_azienda)) {
|
||||
echo '
|
||||
if (!str_contains($records[0]['idtipianagrafica'], $id_azienda)) {
|
||||
echo '
|
||||
<a class="btn btn-danger ask" data-backto="record-list">
|
||||
<i class="fa fa-trash"></i> '.tr('Elimina').'
|
||||
</a>';
|
||||
}else{
|
||||
|
||||
echo '
|
||||
} else {
|
||||
echo '
|
||||
<div class=\'alert alert-warning\' >'.tr('Questa è l\'anagrafica "Azienda" e non è possibile eliminarla').'.</div>';
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
echo '
|
||||
}
|
||||
} else {
|
||||
echo '
|
||||
<div class=\'alert alert-danger\' >'.tr('Questa anagrafica è stata eliminata').'.</div>';
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -58,9 +58,9 @@ switch (post('op')) {
|
||||
if ($movimento != 0) {
|
||||
$descrizione_movimento = post('descrizione_movimento');
|
||||
$data_movimento = post('data_movimento');
|
||||
if($descrizione_movimento!='' && $data_movimento!=''){
|
||||
if ($descrizione_movimento != '' && $data_movimento != '') {
|
||||
add_movimento_magazzino($id_record, $movimento, [], $descrizione_movimento, $data_movimento);
|
||||
}else{
|
||||
} else {
|
||||
add_movimento_magazzino($id_record, $movimento);
|
||||
}
|
||||
}
|
||||
|
@ -16,13 +16,12 @@ $rst = $dbo->fetchArray('SELECT COUNT(mg_movimenti.id) AS row, SUM(qta) AS qta_t
|
||||
$qta_totale = $rst[0]['qta_totale'];
|
||||
$qta_totale_attuale = $rst[0]['qta_totale_attuale'];
|
||||
|
||||
if ( $rst[0]['row']>0){
|
||||
echo '
|
||||
if ($rst[0]['row'] > 0) {
|
||||
echo '
|
||||
<p>'.tr('Quantità calcolata dai movimenti').': <b>'.Translator::numberToLocale($qta_totale).' '.$records[0]['um'].'</b> <span class=\'tip\' title=\''.tr('Quantità calcolata da tutti i movimenti registrati').'.\' ><i class="fa fa-question-circle-o"></i></span></p>';
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<p>'.tr('Quantità calcolata attuale').': <b>'.Translator::numberToLocale($qta_totale_attuale).' '.$records[0]['um'].'</b> <span class=\'tip\' title=\''.tr('Quantità calcolata secondo i movimenti registrati con data oggi o date trascorse').'.\' ><i class="fa fa-question-circle-o"></i></span></p>';
|
||||
|
||||
}
|
||||
|
||||
// Elenco movimenti magazzino
|
||||
@ -56,18 +55,15 @@ if (!empty($rs2)) {
|
||||
<tr>
|
||||
<td class="text-right">'.Translator::numberToLocale($r['qta']).' '.$records[0]['um'].'</td>';
|
||||
|
||||
|
||||
|
||||
|
||||
// Causale
|
||||
$dir = ($r['qta']<0) ? 'vendita' : 'acquisto';
|
||||
|
||||
$dir = ($r['qta'] < 0) ? 'vendita' : 'acquisto';
|
||||
|
||||
echo '
|
||||
<td>'.$r['movimento'].'
|
||||
'.((!empty($r['idintervento'])) ? Modules::link('Interventi', $r['idintervento']) :'').'
|
||||
'.((!empty($r['idautomezzo'])) ? Modules::link('Automezzi', $r['idautomezzo']) :'').'
|
||||
'.((!empty($r['iddt'])) ? Modules::link('DDt di '.$dir.'', $r['iddt']) :'').'
|
||||
'.((!empty($r['iddocumento'])) ? Modules::link('Fatture di '.$dir.'', $r['iddocumento']) :'').'
|
||||
'.((!empty($r['idintervento'])) ? Modules::link('Interventi', $r['idintervento']) : '').'
|
||||
'.((!empty($r['idautomezzo'])) ? Modules::link('Automezzi', $r['idautomezzo']) : '').'
|
||||
'.((!empty($r['iddt'])) ? Modules::link('DDt di '.$dir.'', $r['iddt']) : '').'
|
||||
'.((!empty($r['iddocumento'])) ? Modules::link('Fatture di '.$dir.'', $r['iddocumento']) : '').'
|
||||
</td>';
|
||||
|
||||
// Data
|
||||
@ -78,7 +74,7 @@ if (!empty($rs2)) {
|
||||
echo '
|
||||
<td class="text-center">';
|
||||
|
||||
if (Auth::admin() && $r['manuale']=='1') {
|
||||
if (Auth::admin() && $r['manuale'] == '1') {
|
||||
echo '
|
||||
<a class="btn btn-danger btn-sm ask" data-backto="record-edit" data-op="delmovimento" data-idmovimento="'.$r['id'].'">
|
||||
<i class="fa fa-trash"></i>
|
||||
@ -92,16 +88,11 @@ if (!empty($rs2)) {
|
||||
echo '
|
||||
</table>';
|
||||
} else {
|
||||
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<div class="alert alert-info">
|
||||
<i class="fa fa-info-circle"></i>
|
||||
'.tr('Questo articolo non è ancora stato movimentato', []).'.
|
||||
</div>';
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
|
@ -55,8 +55,8 @@ include_once __DIR__.'/../../core.php';
|
||||
<input type="hidden" name="op" value="">
|
||||
|
||||
<?php
|
||||
include $docroot.'/modules/automezzi/row-list-tecnici.php';
|
||||
?>
|
||||
include $docroot.'/modules/automezzi/row-list-tecnici.php';
|
||||
?>
|
||||
</form>
|
||||
|
||||
<a href="javascript:;" class="btn btn-sm btn-success pull-right" title="Aggiorna date" onclick="$('#updatetech-form input[name=op]').val('savetech'); $('#updatetech-form').submit();"><i class="fa fa-edit"></i> <?php echo tr('Salva date'); ?></a>
|
||||
@ -87,8 +87,8 @@ include_once __DIR__.'/../../core.php';
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<?php
|
||||
include $docroot.'/modules/automezzi/row-list-articoli.php';
|
||||
?>
|
||||
include $docroot.'/modules/automezzi/row-list-articoli.php';
|
||||
?>
|
||||
|
||||
<div class="pull-left">
|
||||
<a class="btn btn-sm btn-primary" data-href="<?php echo $rootdir; ?>/modules/automezzi/add_articolo.php?idautomezzo=<?php echo $id_record; ?>" data-toggle="modal" data-title="Aggiungi articoli" data-target="#bs-popup"><i class="fa fa-plus"></i> <?php echo tr('Articolo magazzino'); ?></a><br>
|
||||
|
@ -5,7 +5,7 @@ include_once __DIR__.'/../../core.php';
|
||||
/*
|
||||
TECNICI ASSEGNATI ALL'AUTOMEZZO
|
||||
*/
|
||||
$q_art = "SELECT *, (SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica=dt_automezzi_tecnici.idtecnico) AS nometecnico FROM dt_automezzi_tecnici WHERE idautomezzo=".prepare($id_record);
|
||||
$q_art = 'SELECT *, (SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica=dt_automezzi_tecnici.idtecnico) AS nometecnico FROM dt_automezzi_tecnici WHERE idautomezzo='.prepare($id_record);
|
||||
$rs_art = $dbo->fetchArray($q_art);
|
||||
|
||||
if (!empty($rs_art)) {
|
||||
|
@ -12,7 +12,6 @@ if (!extension_loaded('zip')) {
|
||||
</div>';
|
||||
}
|
||||
|
||||
|
||||
if (starts_with($backup_dir, $docroot)) {
|
||||
echo '
|
||||
<div class="alert alert-warning">
|
||||
@ -28,7 +27,6 @@ if (!is_writable($backup_dir)) {
|
||||
</div>';
|
||||
}
|
||||
|
||||
|
||||
echo '
|
||||
<div class="callout callout-success">
|
||||
<p>';
|
||||
@ -55,7 +53,6 @@ echo '
|
||||
</div>
|
||||
</div-->';
|
||||
|
||||
|
||||
//Lettura file di backup
|
||||
if (file_exists($backup_dir)) {
|
||||
$backups_zip = [];
|
||||
|
@ -4,24 +4,23 @@ include_once __DIR__.'/../../core.php';
|
||||
|
||||
switch (filter('op')) {
|
||||
case 'update':
|
||||
|
||||
|
||||
$nome = filter('nome');
|
||||
|
||||
if (isset($nome)) {
|
||||
|
||||
$array = [
|
||||
'nome' => $nome,
|
||||
'filiale' => $post['filiale'],
|
||||
'iban' => $post['iban'],
|
||||
'bic' => $post['bic'],
|
||||
'id_pianodeiconti3' => $post['id_pianodeiconti3'],
|
||||
'note' => $post['note'],
|
||||
];
|
||||
$array = [
|
||||
'nome' => $nome,
|
||||
'filiale' => $post['filiale'],
|
||||
'iban' => $post['iban'],
|
||||
'bic' => $post['bic'],
|
||||
'id_pianodeiconti3' => $post['id_pianodeiconti3'],
|
||||
'note' => $post['note'],
|
||||
];
|
||||
|
||||
if (!empty($id_record)) {
|
||||
$dbo->update('co_banche', $array, ['id' => $id_record]);
|
||||
}
|
||||
|
||||
if (!empty($id_record)) {
|
||||
$dbo->update('co_banche', $array, ['id' => $id_record]);
|
||||
}
|
||||
|
||||
$_SESSION['infos'][] = tr('Salvataggio completato!');
|
||||
} else {
|
||||
$_SESSION['errors'][] = tr('Ci sono stati alcuni errori durante il salvataggio!');
|
||||
@ -35,11 +34,11 @@ switch (filter('op')) {
|
||||
if (isset($nome)) {
|
||||
$dbo->query('INSERT INTO `co_banche` (`nome`) VALUES ('.prepare($nome).')');
|
||||
$id_record = $dbo->lastInsertedID();
|
||||
|
||||
if (isAjaxRequest()) {
|
||||
echo json_encode(['id' => $id_record, 'text' => $nome]);
|
||||
}
|
||||
|
||||
|
||||
if (isAjaxRequest()) {
|
||||
echo json_encode(['id' => $id_record, 'text' => $nome]);
|
||||
}
|
||||
|
||||
$_SESSION['infos'][] = tr('Aggiunta nuova _TYPE_', [
|
||||
'_TYPE_' => 'banca',
|
||||
]);
|
||||
@ -47,32 +46,29 @@ switch (filter('op')) {
|
||||
$_SESSION['errors'][] = tr('Ci sono stati alcuni errori durante il salvataggio!');
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
|
||||
$documenti = $dbo->fetchNum('SELECT idanagrafica FROM an_anagrafiche WHERE idbanca_vendite='.prepare($id_record).'
|
||||
|
||||
$documenti = $dbo->fetchNum('SELECT idanagrafica FROM an_anagrafiche WHERE idbanca_vendite='.prepare($id_record).'
|
||||
UNION SELECT idanagrafica FROM an_anagrafiche WHERE idbanca_acquisti='.prepare($id_record));
|
||||
|
||||
|
||||
if (isset($id_record) && empty($documenti)) {
|
||||
$dbo->query('DELETE FROM `co_banche` WHERE `id`='.prepare($id_record));
|
||||
$_SESSION['infos'][] = tr('_TYPE_ eliminata con successo!', [
|
||||
'_TYPE_' => 'Banca',
|
||||
]);
|
||||
|
||||
}else{
|
||||
|
||||
$array = [
|
||||
'deleted' => 1,
|
||||
];
|
||||
|
||||
$dbo->update('co_banche', $array, ['id' => $id_record]);
|
||||
|
||||
$_SESSION['infos'][] = tr('_TYPE_ eliminata con successo!', [
|
||||
} else {
|
||||
$array = [
|
||||
'deleted' => 1,
|
||||
];
|
||||
|
||||
$dbo->update('co_banche', $array, ['id' => $id_record]);
|
||||
|
||||
$_SESSION['infos'][] = tr('_TYPE_ eliminata con successo!', [
|
||||
'_TYPE_' => 'Banca',
|
||||
]);
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -49,8 +49,8 @@ include_once __DIR__.'/../../core.php';
|
||||
$documenti = $dbo->fetchNum('SELECT idanagrafica FROM an_anagrafiche WHERE idbanca_vendite='.prepare($id_record).'
|
||||
UNION SELECT idanagrafica FROM an_anagrafiche WHERE idbanca_acquisti='.prepare($id_record));
|
||||
|
||||
if (!empty($documenti)){
|
||||
echo '
|
||||
if (!empty($documenti)) {
|
||||
echo '
|
||||
<div class="alert alert-danger">
|
||||
'.tr('Ci sono _NUM_ documenti collegati', [
|
||||
'_NUM_' => count($documenti),
|
||||
|
@ -40,14 +40,13 @@ switch (post('op')) {
|
||||
|
||||
$documenti = $dbo->fetchNum('SELECT id FROM dt_ddt WHERE idaspettobeni='.prepare($id_record).'
|
||||
UNION SELECT id FROM co_documenti WHERE idaspettobeni='.prepare($id_record));
|
||||
|
||||
|
||||
if (isset($id_record) && empty($documenti)) {
|
||||
$dbo->query('DELETE FROM `dt_aspettobeni` WHERE `id`='.prepare($id_record));
|
||||
$_SESSION['infos'][] = tr('Tipologia di _TYPE_ eliminata con successo.', [
|
||||
'_TYPE_' => 'bene',
|
||||
]);
|
||||
}else{
|
||||
|
||||
} else {
|
||||
$_SESSION['errors'][] = tr('Sono presenti dei documenti collegati a questo aspetto beni.');
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,8 @@ include_once __DIR__.'/../../core.php';
|
||||
$documenti = $dbo->fetchNum('SELECT id FROM dt_ddt WHERE idaspettobeni='.prepare($id_record).'
|
||||
UNION SELECT id FROM co_documenti WHERE idaspettobeni='.prepare($id_record));
|
||||
|
||||
if (!empty($documenti)){
|
||||
echo '
|
||||
if (!empty($documenti)) {
|
||||
echo '
|
||||
<div class="alert alert-danger">
|
||||
'.tr('Ci sono _NUM_ documenti collegati', [
|
||||
'_NUM_' => count($documenti),
|
||||
|
@ -44,7 +44,7 @@ switch (filter('op')) {
|
||||
$id = $id_record;
|
||||
}
|
||||
|
||||
if ( $dbo->fetchNum('SELECT * FROM `mg_articoli` WHERE `id_categoria`='.prepare($id).' OR `id_sottocategoria`='.prepare($id).' OR `id_sottocategoria` IN (SELECT id FROM `mg_categorie` WHERE `parent`='.prepare($id).')') == 0 ) {
|
||||
if ($dbo->fetchNum('SELECT * FROM `mg_articoli` WHERE `id_categoria`='.prepare($id).' OR `id_sottocategoria`='.prepare($id).' OR `id_sottocategoria` IN (SELECT id FROM `mg_categorie` WHERE `parent`='.prepare($id).')') == 0) {
|
||||
$dbo->query('DELETE FROM `mg_categorie` WHERE `id`='.prepare($id));
|
||||
$_SESSION['infos'][] = tr('Tipologia di _TYPE_ eliminata con successo!', [
|
||||
'_TYPE_' => 'categoria',
|
||||
|
@ -50,14 +50,11 @@ switch (filter('op')) {
|
||||
UNION SELECT id FROM co_documenti WHERE idcausalet='.prepare($id_record));
|
||||
|
||||
if (isset($id_record) && empty($documenti)) {
|
||||
|
||||
$dbo->query('DELETE FROM `dt_causalet` WHERE `id`='.prepare($id_record));
|
||||
$_SESSION['infos'][] = tr('Tipologia di _TYPE_ eliminata con successo.', [
|
||||
'_TYPE_' => 'causale',
|
||||
]);
|
||||
|
||||
}else{
|
||||
|
||||
} else {
|
||||
$_SESSION['errors'][] = tr('Sono presenti dei documenti collegati a questa causale.');
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,8 @@ include_once __DIR__.'/../../core.php';
|
||||
$documenti = $dbo->fetchNum('SELECT id FROM dt_ddt WHERE idcausalet='.prepare($id_record).'
|
||||
UNION SELECT id FROM co_documenti WHERE idcausalet='.prepare($id_record));
|
||||
|
||||
if (!empty($documenti)){
|
||||
echo '
|
||||
if (!empty($documenti)) {
|
||||
echo '
|
||||
<div class="alert alert-danger">
|
||||
'.tr('Ci sono _NUM_ documenti collegati', [
|
||||
'_NUM_' => count($documenti),
|
||||
|
@ -2,13 +2,13 @@
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
$rs_documento = $dbo->fetchArray("SELECT * FROM co_righe_documenti WHERE idcontratto=".prepare($id_record));
|
||||
if(sizeof($rs_documento)>0){
|
||||
echo "
|
||||
<button type=\"button\" class=\"btn btn-info\" disabled>
|
||||
<i class=\"fa fa-magic\"></i> ".tr('Crea fattura').'...
|
||||
$rs_documento = $dbo->fetchArray('SELECT * FROM co_righe_documenti WHERE idcontratto='.prepare($id_record));
|
||||
if (sizeof($rs_documento) > 0) {
|
||||
echo '
|
||||
<button type="button" class="btn btn-info" disabled>
|
||||
<i class="fa fa-magic"></i> '.tr('Crea fattura').'...
|
||||
</button>';
|
||||
}else{
|
||||
} else {
|
||||
echo "
|
||||
<button type=\"button\" class=\"btn btn-info\" onclick=\"if( confirm('Creare una fattura per questo contratto?') ){fattura_da_contratto();}\">
|
||||
<i class=\"fa fa-magic\"></i> ".tr('Crea fattura').'...
|
||||
|
@ -13,14 +13,11 @@ for ($i = 0; $i < count($rs); ++$i) {
|
||||
$idriga = get('idriga');
|
||||
//$idautomezzo = (get('idautomezzo') == 'undefined') ? '' : get('idautomezzo');
|
||||
|
||||
|
||||
// Lettura idanagrafica cliente e percentuale di sconto/rincaro in base al listino
|
||||
$rs = $dbo->fetchArray('SELECT idanagrafica FROM co_contratti WHERE id='.prepare($id_record));
|
||||
|
||||
$idanagrafica = $rs[0]['idanagrafica'];
|
||||
|
||||
|
||||
|
||||
if (empty($idriga)) {
|
||||
$op = 'addarticolo';
|
||||
$button = '<i class="fa fa-plus"></i> '.tr('Aggiungi');
|
||||
@ -41,9 +38,8 @@ if (empty($idriga)) {
|
||||
$sconto_unitario = $listino[0]['prc_guadagno'];
|
||||
$tipo_sconto = 'PRC';
|
||||
}
|
||||
|
||||
(empty($idcontratto_riga)) ? $idcontratto_riga = $dbo->fetchArray('SELECT MAX(id) AS max_idcontratto_riga FROM `co_righe_contratti`')[0]['max_idcontratto_riga'] : '';
|
||||
|
||||
|
||||
(empty($idcontratto_riga)) ? $idcontratto_riga = $dbo->fetchArray('SELECT MAX(id) AS max_idcontratto_riga FROM `co_righe_contratti`')[0]['max_idcontratto_riga'] : '';
|
||||
} else {
|
||||
$op = 'editarticolo';
|
||||
$button = '<i class="fa fa-edit"></i> '.tr('Modifica');
|
||||
@ -58,7 +54,7 @@ if (empty($idriga)) {
|
||||
$qta = $rsr[0]['qta'];
|
||||
$um = $rsr[0]['um'];
|
||||
$idiva = $rsr[0]['idiva'];
|
||||
|
||||
|
||||
$prezzo_vendita = $rsr[0]['prezzo_vendita'];
|
||||
|
||||
$sconto_unitario = $rsr[0]['sconto_unitario'];
|
||||
@ -67,7 +63,7 @@ if (empty($idriga)) {
|
||||
$idautomezzo = $rsr[0]['idautomezzo'];
|
||||
|
||||
$idimpianto = $rsr[0]['idimpianto'];
|
||||
$idcontratto_riga = $rsr[0]['id_riga_contratto'];
|
||||
$idcontratto_riga = $rsr[0]['id_riga_contratto'];
|
||||
}
|
||||
|
||||
/*
|
||||
@ -80,8 +76,6 @@ echo '
|
||||
<input type="hidden" name="idriga" value="'.$idriga.'">
|
||||
|
||||
<input type="hidden" name="idcontratto_riga" value="'.$idcontratto_riga.'">';
|
||||
|
||||
|
||||
|
||||
if (!empty($idarticolo)) {
|
||||
echo '
|
||||
@ -124,7 +118,7 @@ echo '
|
||||
{[ "type": "select", "multiple": "0", "label": "'.tr('Impianto').'", "name": "idimpianto", "values": "query=SELECT my_impianti.id AS id, my_impianti.nome AS descrizione FROM my_impianti_contratti INNER JOIN my_impianti ON my_impianti_contratti.idimpianto = my_impianti.id WHERE my_impianti_contratti.idcontratto = '.$id_record.' ORDER BY descrizione", "value": "'.$matricoleimpianti.'", "extra":"'.$readonly.'" ]}
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
|
||||
// Iva
|
||||
echo '
|
||||
<div class="row">
|
||||
|
@ -29,7 +29,6 @@ echo '
|
||||
{[ "type": "select", "label": "'.tr('Tipo di fattura').'", "name": "idtipodocumento", "required": 1, "values": "query=SELECT * FROM co_tipidocumento WHERE dir=\'entrata\'" ]}
|
||||
</div>';
|
||||
|
||||
|
||||
// Sezionale
|
||||
echo '
|
||||
<div class="col-md-4">
|
||||
|
@ -2,15 +2,13 @@
|
||||
|
||||
include_once __DIR__.'/../../../core.php';
|
||||
|
||||
if (!empty($get['idcontratto_riga']))
|
||||
$idcontratto_riga = $get['idcontratto_riga'];
|
||||
if (!empty($get['idcontratto_riga'])) {
|
||||
$idcontratto_riga = $get['idcontratto_riga'];
|
||||
}
|
||||
|
||||
$query = 'SELECT * FROM co_righe_contratti_materiali WHERE id_riga_contratto='.prepare($idcontratto_riga).' '.Modules::getAdditionalsQuery('Magazzino').' ORDER BY id ASC';
|
||||
$rs2 = $dbo->fetchArray($query);
|
||||
|
||||
|
||||
|
||||
|
||||
if (count($rs2) > 0) {
|
||||
echo '
|
||||
<table class="table table-striped table-condensed table-hover table-bordered">
|
||||
@ -89,7 +87,7 @@ if (count($rs2) > 0) {
|
||||
|
||||
// Pulsante per riportare nel magazzino centrale.
|
||||
// Visibile solo se l'intervento non è stato nè fatturato nè completato.
|
||||
if (empty($readonly)) {
|
||||
if (empty($readonly)) {
|
||||
echo '
|
||||
<td>
|
||||
|
||||
|
@ -124,9 +124,9 @@ if (!empty($rsp)) {
|
||||
echo '
|
||||
<td>';
|
||||
if (empty($r['idintervento'])) {
|
||||
echo '<button type="button" class="btn btn-primary btn-sm" onclick="launch_modal( \'Crea fattura\', \''.$rootdir.'/modules/contratti/plugins/addfattura.php?idcontratto='.$r['idcontratto'].'&idpianificazione='.$r['id'].'&importo='.$importo.'&n_rata='.$n_rata[$r['idzona']][$r['idcontratto']].'\', 1 );">
|
||||
echo '<button type="button" class="btn btn-primary btn-sm" onclick="launch_modal( \'Crea fattura\', \''.$rootdir.'/modules/contratti/plugins/addfattura.php?idcontratto='.$r['idcontratto'].'&idpianificazione='.$r['id'].'&importo='.$importo.'&n_rata='.$n_rata[$r['idzona']][$r['idcontratto']].'\', 1 );">
|
||||
<i class="fa fa-euro"></i> Crea fattura
|
||||
</button>';
|
||||
</button>';
|
||||
}
|
||||
echo '
|
||||
</td>
|
||||
|
@ -132,41 +132,38 @@ switch (get('op')) {
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 'load_intreventi':
|
||||
|
||||
|
||||
$mese = $_GET['mese'];
|
||||
|
||||
|
||||
//Righe inserite
|
||||
$qp = "SELECT co_righe_contratti.id, idcontratto, richiesta, DATE_FORMAT( data_richiesta, '%m%Y') AS mese, data_richiesta, an_anagrafiche.ragione_sociale, 'intervento' AS ref, (SELECT descrizione FROM in_tipiintervento WHERE idtipointervento=co_righe_contratti.idtipointervento) AS tipointervento FROM (co_righe_contratti INNER JOIN co_contratti ON co_righe_contratti.idcontratto=co_contratti.id) INNER JOIN an_anagrafiche ON co_contratti.idanagrafica=an_anagrafiche.idanagrafica WHERE idcontratto IN( SELECT id FROM co_contratti WHERE idstato IN(SELECT id FROM co_staticontratti WHERE pianificabile = 1) ) AND idintervento IS NULL
|
||||
UNION SELECT co_ordiniservizio.id, idcontratto, '', data_scadenza, DATE_FORMAT( data_scadenza, '%m%Y') AS mese, an_anagrafiche.ragione_sociale, 'ordine' AS ref, (SELECT descrizione FROM in_tipiintervento WHERE idtipointervento='ODS') AS tipointervento FROM (co_ordiniservizio INNER JOIN co_contratti ON co_ordiniservizio.idcontratto=co_contratti.id) INNER JOIN an_anagrafiche ON co_contratti.idanagrafica=an_anagrafiche.idanagrafica WHERE idcontratto IN( SELECT id FROM co_contratti WHERE idstato IN(SELECT id FROM co_staticontratti WHERE pianificabile = 1) ) AND idintervento IS NULL ORDER BY data_richiesta ASC";
|
||||
$rsp = $dbo->fetchArray($qp);
|
||||
$tot_dapianificare = sizeof($rsp);
|
||||
$da_pianificare = 0;
|
||||
|
||||
if( $tot_dapianificare>0 ){
|
||||
|
||||
if ($tot_dapianificare > 0) {
|
||||
$prev_mese = '';
|
||||
|
||||
//Elenco interventi da pianificare
|
||||
foreach ($rsp as $r) {
|
||||
if($r['mese']==$mese){
|
||||
|
||||
if(date('Ymd', strtotime($r['data_richiesta']))<date('Ymd')){
|
||||
if ($r['mese'] == $mese) {
|
||||
if (date('Ymd', strtotime($r['data_richiesta'])) < date('Ymd')) {
|
||||
$class = 'fc-event-danger';
|
||||
}else{
|
||||
} else {
|
||||
$class = 'fc-event-primary';
|
||||
}
|
||||
|
||||
|
||||
echo '
|
||||
<div class="fc-event '.$class.'" data-id="'.$r['id'].'" data-idcontratto="'.$r['idcontratto'].'"><b>'.$r['ragione_sociale'].'</b><br>'.Translator::dateToLocale($r['data_richiesta']).' ('.$r['tipointervento'].')'.(!empty($r['richiesta']) ? ' - '.$r['richiesta'] : '').'</div>';
|
||||
$da_pianificare ++;
|
||||
++$da_pianificare;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if($da_pianificare==0){
|
||||
} elseif ($da_pianificare == 0) {
|
||||
echo '<br><small class="help-block">'.tr('Non ci sono interventi da pianificare per questo mese').'</small>';
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -31,13 +31,10 @@ echo '
|
||||
</div>
|
||||
|
||||
</form>';
|
||||
|
||||
|
||||
|
||||
echo '<script src="'.$rootdir.'/lib/init.js"></script>';
|
||||
echo '<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css">';
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<style>
|
||||
.ui-datepicker-calendar, .ui-datepicker-current{
|
||||
@ -48,7 +45,7 @@ echo '<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/aj
|
||||
<script>
|
||||
|
||||
function stampa_calendario (){
|
||||
window.open('<?php echo $rootdir ?>/pdfgen.php?id_print=<?php echo $id_print; ?>');
|
||||
window.open('<?php echo $rootdir; ?>/pdfgen.php?id_print=<?php echo $id_print; ?>');
|
||||
//$('button[type=submit]').removeAttr("disabled");
|
||||
//$('button[type=submit]').prop("disabled", false);
|
||||
return false;
|
||||
|
@ -3,11 +3,8 @@
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
if (!in_array($records[0]['stato'], ['Bozza', 'Fatturato'])) {
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<a class="btn btn-info" data-href="'.$rootdir.'/modules/fatture/crea_documento.php?id_module='.$id_module.'&id_record='.$id_record.'&documento=fattura" data-toggle="modal" data-title="Crea fattura" data-target="#bs-popup">
|
||||
<i class="fa fa-magic"></i>.'.tr('Crea fattura').'</i>
|
||||
</a>';
|
||||
|
||||
}
|
||||
|
@ -73,18 +73,18 @@ if ($module['name'] == 'Ddt di vendita') {
|
||||
|
||||
<div class="col-md-3">
|
||||
<?php
|
||||
if(get_var("Cambia automaticamente stato ddt fatturati")){
|
||||
if($records[0]['stato']=='Fatturato' || $records[0]['stato']=='Parzialmente fatturato'){
|
||||
?>
|
||||
if (get_var('Cambia automaticamente stato ddt fatturati')) {
|
||||
if ($records[0]['stato'] == 'Fatturato' || $records[0]['stato'] == 'Parzialmente fatturato') {
|
||||
?>
|
||||
{[ "type": "select", "label": "<?php echo tr('Stato'); ?>", "name": "idstatoddt", "required": 1, "values": "query=SELECT * FROM dt_statiddt", "value": "$idstatoddt$", "extra": "readonly" ]}
|
||||
<?php
|
||||
}else{
|
||||
?>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
{[ "type": "select", "label": "<?php echo tr('Stato'); ?>", "name": "idstatoddt", "required": 1, "values": "query=SELECT * FROM dt_statiddt WHERE descrizione IN('Bozza', 'Evaso', 'Parzialmente evaso')", "value": "$idstatoddt$" ]}
|
||||
<?php
|
||||
}
|
||||
}else{
|
||||
?>
|
||||
} else {
|
||||
?>
|
||||
{[ "type": "select", "label": "<?php echo tr('Stato'); ?>", "name": "idstatoddt", "required": 1, "values": "query=SELECT * FROM dt_statiddt", "value": "$idstatoddt$" ]}
|
||||
<?php
|
||||
}
|
||||
@ -178,15 +178,14 @@ if ($module['name'] == 'Ddt di vendita') {
|
||||
<div class="pull-left">
|
||||
<?php
|
||||
|
||||
if ($records[0]['flag_completato']==0) {
|
||||
if ($records[0]['flag_completato'] == 0) {
|
||||
// Lettura ordini
|
||||
$ordini_query = 'SELECT COUNT(*) AS tot FROM or_ordini WHERE idanagrafica='.prepare($records[0]['idanagrafica']).' AND idstatoordine IN (SELECT id FROM or_statiordine WHERE descrizione IN(\'Bozza\', \'Evaso\', \'Parzialmente evaso\', \'Parzialmente fatturato\')) AND idtipoordine=(SELECT id FROM or_tipiordine WHERE dir='.prepare($dir).') AND or_ordini.id IN (SELECT idordine FROM or_righe_ordini WHERE or_righe_ordini.idordine = or_ordini.id AND (qta - qta_evasa) > 0)';
|
||||
$ordini = $dbo->fetchArray($ordini_query)[0]['tot'];
|
||||
echo '
|
||||
<a class="btn btn-primary'.(!empty($ordini) ? '' : ' disabled').'" data-href="'.$rootdir.'/modules/ddt/add_ordine.php?id_module='.$id_module.'&id_record='.$id_record.'" data-toggle="modal" data-title="Aggiungi ordine" data-target="#bs-popup">
|
||||
<i class="fa fa-plus"></i> '.tr('Ordine').'
|
||||
</a>';
|
||||
?>
|
||||
</a>'; ?>
|
||||
<a class="btn btn-primary" data-href="<?php echo $rootdir; ?>/modules/ddt/row-add.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>&is_articolo" data-toggle="modal" data-title="Aggiungi articolo" data-target="#bs-popup">
|
||||
<i class="fa fa-plus"></i> <?php echo tr('Articolo'); ?>
|
||||
</a>
|
||||
@ -269,8 +268,8 @@ if (!empty($fatture)) {
|
||||
|
||||
<script>
|
||||
<?php
|
||||
if ( $records[0]['flag_completato'] ) {
|
||||
?>
|
||||
if ($records[0]['flag_completato']) {
|
||||
?>
|
||||
$('#tipo_sconto_generico').prop('disabled', true);
|
||||
<?php
|
||||
}
|
||||
|
@ -98,9 +98,9 @@ function rimuovi_articolo_daddt($idarticolo, $idddt, $idrigaddt)
|
||||
|
||||
// Elimino la riga dal ddt
|
||||
$dbo->query('DELETE FROM `dt_righe_ddt` WHERE id='.prepare($idrigaddt).' AND idddt='.prepare($idddt));
|
||||
|
||||
|
||||
//Aggiorno lo stato dell'ordine
|
||||
if(get_var('Cambia automaticamente stato ordini fatturati') && !empty($idordine)){
|
||||
if (get_var('Cambia automaticamente stato ordini fatturati') && !empty($idordine)) {
|
||||
$dbo->query('UPDATE or_ordini SET idstatoordine=(SELECT id FROM or_statiordine WHERE descrizione="'.get_stato_ordine($idordine).'") WHERE id = '.prepare($idordine));
|
||||
}
|
||||
|
||||
@ -324,7 +324,7 @@ function add_articolo_inddt($idddt, $idarticolo, $descrizione, $idiva, $qta, $id
|
||||
// Decremento la quantità dal magazzino centrale
|
||||
add_movimento_magazzino($idarticolo, $qta, ['idddt' => $idddt]);
|
||||
}
|
||||
|
||||
|
||||
// Inserisco il riferimento dell'ordine alla riga
|
||||
$dbo->query('UPDATE dt_righe_ddt SET idordine='.prepare($idordine).' WHERE id='.prepare($idriga));
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ switch (post('op')) {
|
||||
|
||||
$iddocumento = $r['id'];
|
||||
$ptype = 'fatture';
|
||||
|
||||
|
||||
$print = $dbo->fetchArray('SELECT id, previous FROM zz_prints WHERE directory = '.prepare($ptype).' ORDER BY main DESC LIMIT 1');
|
||||
$id_print = $print[0]['id'];
|
||||
|
||||
@ -52,26 +52,25 @@ switch (post('op')) {
|
||||
break;
|
||||
|
||||
case 'delete-bulk':
|
||||
|
||||
if ($debug){
|
||||
foreach ($id_records as $id) {
|
||||
$dbo->query('DELETE FROM co_documenti WHERE id = '.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
$dbo->query('DELETE FROM co_righe_documenti WHERE iddocumento='.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
$dbo->query('DELETE FROM co_scadenziario WHERE iddocumento='.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
$dbo->query('DELETE FROM mg_movimenti WHERE iddocumento='.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
}
|
||||
|
||||
$_SESSION['infos'][] = tr('Fatture eliminate!');
|
||||
}else{
|
||||
$_SESSION['warnings'][] = tr('Procedura in fase di sviluppo. Nessuna modifica apportata.');
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
foreach ($id_records as $id) {
|
||||
$dbo->query('DELETE FROM co_documenti WHERE id = '.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
$dbo->query('DELETE FROM co_righe_documenti WHERE iddocumento='.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
$dbo->query('DELETE FROM co_scadenziario WHERE iddocumento='.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
$dbo->query('DELETE FROM mg_movimenti WHERE iddocumento='.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
}
|
||||
|
||||
$_SESSION['infos'][] = tr('Fatture eliminate!');
|
||||
} else {
|
||||
$_SESSION['warnings'][] = tr('Procedura in fase di sviluppo. Nessuna modifica apportata.');
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return [
|
||||
|
||||
'delete-bulk' => tr('Elimina selezionati'),
|
||||
'delete-bulk' => tr('Elimina selezionati'),
|
||||
|
||||
'export-bulk' => [
|
||||
'text' => tr('Esporta stampe'),
|
||||
|
@ -98,7 +98,7 @@ if (!empty($rs)) {
|
||||
{[ "type": "date", "label": "'.tr('Data del documento').'", "name": "data", "required": 1, "value": "-now-" ]}
|
||||
</div>';
|
||||
|
||||
if ($module_name=='Fatture di vendita' || $module_name == 'Fatture di acquisto'){
|
||||
if ($module_name == 'Fatture di vendita' || $module_name == 'Fatture di acquisto') {
|
||||
echo '
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "values": "query=SELECT id, name AS descrizione FROM zz_segments WHERE id_module='.prepare(Modules::get($module_name)['id']).' ORDER BY name", "value": "'.$_SESSION['m'.Modules::get($module_name)['id']]['id_segment'].'" ]}
|
||||
|
@ -670,7 +670,7 @@ function add_articolo_infattura($iddocumento, $idarticolo, $descrizione, $idiva,
|
||||
if (empty($idddt)) {
|
||||
$idddt = 0;
|
||||
}
|
||||
|
||||
|
||||
if (empty($idordine)) {
|
||||
$idordine = 0;
|
||||
}
|
||||
@ -716,7 +716,7 @@ function add_articolo_infattura($iddocumento, $idarticolo, $descrizione, $idiva,
|
||||
|
||||
// Inserisco il riferimento del ddt alla riga
|
||||
$dbo->query('UPDATE co_righe_documenti SET idddt='.prepare($idddt).' WHERE id='.prepare($idriga));
|
||||
|
||||
|
||||
// Inserisco il riferimento dell'ordine alla riga
|
||||
$dbo->query('UPDATE co_righe_documenti SET idordine='.prepare($idordine).' WHERE id='.prepare($idriga));
|
||||
}
|
||||
@ -787,14 +787,14 @@ function rimuovi_articolo_dafattura($idarticolo, $iddocumento, $idrigadocumento)
|
||||
}
|
||||
// Elimino la riga dal documento
|
||||
$dbo->query('DELETE FROM `co_righe_documenti` WHERE id='.prepare($idrigadocumento).' AND iddocumento='.prepare($iddocumento));
|
||||
|
||||
|
||||
//Aggiorno lo stato dell'ordine
|
||||
if(get_var('Cambia automaticamente stato ordini fatturati') && !empty($idordine)){
|
||||
if (get_var('Cambia automaticamente stato ordini fatturati') && !empty($idordine)) {
|
||||
$dbo->query('UPDATE or_ordini SET idstatoordine=(SELECT id FROM or_statiordine WHERE descrizione="'.get_stato_ordine($idordine).'") WHERE id = '.prepare($idordine));
|
||||
}
|
||||
|
||||
|
||||
//Aggiorno lo stato del ddt
|
||||
if(get_var('Cambia automaticamente stato ddt fatturati') && !empty($idddt)){
|
||||
if (get_var('Cambia automaticamente stato ddt fatturati') && !empty($idddt)) {
|
||||
$dbo->query('UPDATE dt_ddt SET idstatoddt=(SELECT id FROM dt_statiddt WHERE descrizione="'.get_stato_ddt($idddt).'") WHERE id = '.prepare($idddt));
|
||||
}
|
||||
|
||||
|
@ -13,17 +13,17 @@ $idconto = $rs[0]['idconto'];
|
||||
if ($module['name'] == 'Fatture di vendita') {
|
||||
$dir = 'entrata';
|
||||
$conti = 'conti-vendite';
|
||||
|
||||
|
||||
// Se non ho letto un conto dall'ultima riga inserita, lo leggo dalle impostazioni
|
||||
if (empty($idconto )) {
|
||||
if (empty($idconto)) {
|
||||
$idconto = get_var('Conto predefinito fatture di vendita');
|
||||
}
|
||||
} else {
|
||||
$dir = 'uscita';
|
||||
$conti = 'conti-acquisti';
|
||||
|
||||
|
||||
// Se non ho letto un conto dall'ultima riga inserita, lo leggo dalle impostazioni
|
||||
if (empty($idconto )) {
|
||||
if (empty($idconto)) {
|
||||
$idconto = get_var('Conto predefinito fatture di acquisto');
|
||||
}
|
||||
}
|
||||
|
@ -17,10 +17,10 @@ $idstatointervento = null;
|
||||
$richiesta = null;
|
||||
$impianti = [];
|
||||
//come tecnico posso aprire attività solo a mio nome
|
||||
if ($user['gruppo'] == 'Tecnici' AND !empty($user['idanagrafica']) ) {
|
||||
$idtecnico = $user['idanagrafica'];
|
||||
}else{
|
||||
$idtecnico = null;
|
||||
if ($user['gruppo'] == 'Tecnici' and !empty($user['idanagrafica'])) {
|
||||
$idtecnico = $user['idanagrafica'];
|
||||
} else {
|
||||
$idtecnico = null;
|
||||
}
|
||||
|
||||
if (!empty($idanagrafica)) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
if (file_exists( __DIR__.'/../../../core.php')) {
|
||||
include_once __DIR__.'/../../../core.php';
|
||||
}else {
|
||||
include_once __DIR__.'/../../core.php';
|
||||
if (file_exists(__DIR__.'/../../../core.php')) {
|
||||
include_once __DIR__.'/../../../core.php';
|
||||
} else {
|
||||
include_once __DIR__.'/../../core.php';
|
||||
}
|
||||
|
||||
// Prezzo modificabile solo se l'utente loggato è un tecnico (+ può vedere i prezzi) o se è amministratore
|
||||
@ -57,7 +57,7 @@ if (empty($idriga)) {
|
||||
$qta = $rsr[0]['qta'];
|
||||
$um = $rsr[0]['um'];
|
||||
$idiva = $rsr[0]['idiva'];
|
||||
|
||||
|
||||
$prezzo_vendita = $rsr[0]['prezzo_vendita'];
|
||||
|
||||
$sconto_unitario = $rsr[0]['sconto_unitario'];
|
||||
@ -118,7 +118,7 @@ echo '
|
||||
{[ "type": "select", "label": "'.tr('Impianto su cui installare').'", "name": "idimpianto", "value": "'.$idimpianto.'", "ajax-source": "impianti-intervento" ]}
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
|
||||
// Iva
|
||||
echo '
|
||||
<div class="row">
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
if (file_exists( __DIR__.'/../../../core.php')) {
|
||||
include_once __DIR__.'/../../../core.php';
|
||||
}else {
|
||||
include_once __DIR__.'/../../core.php';
|
||||
if (file_exists(__DIR__.'/../../../core.php')) {
|
||||
include_once __DIR__.'/../../../core.php';
|
||||
} else {
|
||||
include_once __DIR__.'/../../core.php';
|
||||
}
|
||||
$module_name = 'Interventi';
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
if (file_exists( __DIR__.'/../../../core.php')) {
|
||||
include_once __DIR__.'/../../../core.php';
|
||||
}else {
|
||||
include_once __DIR__.'/../../core.php';
|
||||
if (file_exists(__DIR__.'/../../../core.php')) {
|
||||
include_once __DIR__.'/../../../core.php';
|
||||
} else {
|
||||
include_once __DIR__.'/../../core.php';
|
||||
}
|
||||
|
||||
$idriga = filter('idriga');
|
||||
@ -42,7 +42,7 @@ if (empty($idriga)) {
|
||||
$idiva = $rsr[0]['idiva'];
|
||||
$prezzo_vendita = $rsr[0]['prezzo_vendita'];
|
||||
$prezzo_acquisto = $rsr[0]['prezzo_acquisto'];
|
||||
|
||||
|
||||
$sconto_unitario = $rsr[0]['sconto_unitario'];
|
||||
$tipo_sconto = $rsr[0]['tipo_sconto'];
|
||||
}
|
||||
@ -76,7 +76,7 @@ echo '
|
||||
<div class="col-md-4">
|
||||
{[ "type": "select", "label": "'.tr('Unità di misura').'", "icon-after": "add|'.Modules::get('Unità di misura')['id'].'", "name": "um", "value": "'.$um.'", "ajax-source": "misure" ]}
|
||||
</div>';
|
||||
|
||||
|
||||
// Iva
|
||||
echo '
|
||||
<div class="col-md-4">
|
||||
|
@ -12,8 +12,8 @@ switch ($resource) {
|
||||
if (!empty($search)) {
|
||||
$search_fields[] = 'descrizione LIKE '.prepare('%'.$search.'%');
|
||||
}
|
||||
|
||||
$custom['tempo_standard'] = 'tempo_standard';
|
||||
|
||||
$custom['tempo_standard'] = 'tempo_standard';
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
if (file_exists( __DIR__.'/../../../core.php')) {
|
||||
include_once __DIR__.'/../../../core.php';
|
||||
}else {
|
||||
include_once __DIR__.'/../../core.php';
|
||||
if (file_exists(__DIR__.'/../../../core.php')) {
|
||||
include_once __DIR__.'/../../../core.php';
|
||||
} else {
|
||||
include_once __DIR__.'/../../core.php';
|
||||
}
|
||||
|
||||
include_once Modules::filepath('Interventi', 'modutil.php');
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
if (file_exists( __DIR__.'/../../../core.php')) {
|
||||
include_once __DIR__.'/../../../core.php';
|
||||
}else {
|
||||
include_once __DIR__.'/../../core.php';
|
||||
if (file_exists(__DIR__.'/../../../core.php')) {
|
||||
include_once __DIR__.'/../../../core.php';
|
||||
} else {
|
||||
include_once __DIR__.'/../../core.php';
|
||||
}
|
||||
|
||||
$query = 'SELECT * FROM in_righe_interventi WHERE idintervento='.prepare($id_record).' '.Modules::getAdditionalsQuery('Magazzino').' ORDER BY id ASC';
|
||||
|
@ -46,14 +46,14 @@ switch ($resource) {
|
||||
|
||||
// per APP ufficiale OpenSTAManager
|
||||
case 'interventi':
|
||||
|
||||
|
||||
// periodo per selezionare interventi
|
||||
// in questo modo recupero sempre tutti gli interventi che non vengono chiusi
|
||||
// vedi anche lista degli stati intervento presenti nella query
|
||||
// se un intervento è stato pre-chiuso dal tecnico oppure chiuso dall'ufficio non viene scaricato da APP
|
||||
$today = date("Y-m-d");
|
||||
$period_start = "2000-01-01" ;
|
||||
$period_end = date('Y-m-d', strtotime($today . " +7 days"));
|
||||
$today = date('Y-m-d');
|
||||
$period_start = '2000-01-01';
|
||||
$period_end = date('Y-m-d', strtotime($today.' +7 days'));
|
||||
|
||||
$q = "SELECT `in_interventi`.id,
|
||||
`in_interventi`.codice,
|
||||
@ -95,19 +95,18 @@ switch ($resource) {
|
||||
|
||||
// TODO: rimosse seguenti clausole:
|
||||
|
||||
// WHERE `in_interventi`.idstatointervento IN(SELECT idstatointervento FROM in_statiintervento WHERE app_download=1)
|
||||
// WHERE `in_interventi`.idstatointervento IN(SELECT idstatointervento FROM in_statiintervento WHERE app_download=1)
|
||||
// nel database ufficiale manca in_statiintervento.app_download
|
||||
|
||||
// AND `in_interventi_tecnici`.`idtecnico`='".$tecnico[0]['idanagrafica']."'
|
||||
// nell'inner join con in_interventi_tecnici -> ad oggi 16-05-2018 non gestisco ancora idtecnico
|
||||
|
||||
$results = $dbo->fetchArray( $q );
|
||||
|
||||
$results = $dbo->fetchArray($q);
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return [
|
||||
'sync',
|
||||
'interventi',
|
||||
];
|
||||
'interventi',
|
||||
];
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
if (file_exists( __DIR__.'/../../../core.php')) {
|
||||
include_once __DIR__.'/../../../core.php';
|
||||
}else {
|
||||
include_once __DIR__.'/../../core.php';
|
||||
if (file_exists(__DIR__.'/../../../core.php')) {
|
||||
include_once __DIR__.'/../../../core.php';
|
||||
} else {
|
||||
include_once __DIR__.'/../../core.php';
|
||||
}
|
||||
|
||||
include_once Modules::filepath('Fatture di vendita', 'modutil.php');
|
||||
|
@ -159,16 +159,16 @@ $_SESSION['superselect']['idanagrafica'] = $records[0]['idanagrafica'];
|
||||
<div class="row">
|
||||
<div class="col-md-12" id="tecnici">
|
||||
<?php
|
||||
if (file_exists($docroot.'/modules/interventi/custom/ajax_tecnici.php')) {
|
||||
?>
|
||||
if (file_exists($docroot.'/modules/interventi/custom/ajax_tecnici.php')) {
|
||||
?>
|
||||
<script>$('#tecnici').load('<?php echo $rootdir; ?>/modules/interventi/custom/ajax_tecnici.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>');</script>
|
||||
<?php
|
||||
}else{
|
||||
?>
|
||||
} else {
|
||||
?>
|
||||
<script>$('#tecnici').load('<?php echo $rootdir; ?>/modules/interventi/ajax_tecnici.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>');</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -184,19 +184,19 @@ $_SESSION['superselect']['idanagrafica'] = $records[0]['idanagrafica'];
|
||||
<div class="panel-body">
|
||||
<div id="articoli">
|
||||
<?php
|
||||
if (file_exists($docroot.'/modules/interventi/custom/ajax_articoli.php')) {
|
||||
include $docroot.'/modules/interventi/custom/ajax_articoli.php';
|
||||
}else{
|
||||
include $docroot.'/modules/interventi/ajax_articoli.php';
|
||||
}
|
||||
?>
|
||||
if (file_exists($docroot.'/modules/interventi/custom/ajax_articoli.php')) {
|
||||
include $docroot.'/modules/interventi/custom/ajax_articoli.php';
|
||||
} else {
|
||||
include $docroot.'/modules/interventi/ajax_articoli.php';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php if (!$records[0]['flag_completato']) {
|
||||
?>
|
||||
?>
|
||||
<button type="button" class="btn btn-primary" onclick="launch_modal( '<?php echo tr('Aggiungi articolo'); ?>', '<?php echo $rootdir; ?>/modules/interventi/add_articolo.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>&idriga=0&idautomezzo='+$('#idautomezzo').find(':selected').val(), 1);"><i class="fa fa-plus"></i> <?php echo tr('Aggiungi articolo'); ?>...</button>
|
||||
<?php
|
||||
} ?>
|
||||
} ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -209,19 +209,19 @@ $_SESSION['superselect']['idanagrafica'] = $records[0]['idanagrafica'];
|
||||
<div class="panel-body">
|
||||
<div id="righe">
|
||||
<?php
|
||||
if (file_exists($docroot.'/modules/interventi/custom/ajax_righe.php')) {
|
||||
include $docroot.'/modules/interventi/custom/ajax_righe.php';
|
||||
}else{
|
||||
include $docroot.'/modules/interventi/ajax_righe.php';
|
||||
}
|
||||
?>
|
||||
if (file_exists($docroot.'/modules/interventi/custom/ajax_righe.php')) {
|
||||
include $docroot.'/modules/interventi/custom/ajax_righe.php';
|
||||
} else {
|
||||
include $docroot.'/modules/interventi/ajax_righe.php';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php if (!$records[0]['flag_completato']) {
|
||||
?>
|
||||
?>
|
||||
<button type="button" class="btn btn-primary" onclick="launch_modal( '<?php echo tr('Aggiungi altre spese'); ?>', '<?php echo $rootdir; ?>/modules/interventi/add_righe.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>', 1 );"><i class="fa fa-plus"></i> <?php echo tr('Aggiungi altre spese'); ?>...</button>
|
||||
<?php
|
||||
} ?>
|
||||
} ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -235,16 +235,16 @@ $_SESSION['superselect']['idanagrafica'] = $records[0]['idanagrafica'];
|
||||
<div class="row">
|
||||
<div class="col-md-12" id="costi">
|
||||
<?php
|
||||
if (file_exists($docroot.'/modules/interventi/custom/ajax_costi.php')) {
|
||||
?>
|
||||
if (file_exists($docroot.'/modules/interventi/custom/ajax_costi.php')) {
|
||||
?>
|
||||
<script>$('#costi').load('<?php echo $rootdir; ?>/modules/interventi/custom/ajax_costi.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>');</script>
|
||||
<?php
|
||||
}else{
|
||||
?>
|
||||
} else {
|
||||
?>
|
||||
<script>$('#costi').load('<?php echo $rootdir; ?>/modules/interventi/ajax_costi.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>');</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -58,7 +58,7 @@ function add_tecnico($idintervento, $idtecnico, $inizio, $fine, $idcontratto)
|
||||
$idanagrafica = $rs[0]['idanagrafica'];
|
||||
$idsede = $rs[0]['idsede'];
|
||||
$idtipointervento = $rs[0]['idtipointervento'];
|
||||
|
||||
|
||||
// Calcolo km in base a quelli impostati nell'anagrafica
|
||||
// Nessuna sede
|
||||
if ($idsede == '-1') {
|
||||
@ -161,7 +161,7 @@ function get_costi_intervento($id_intervento)
|
||||
$dbo = Database::getConnection();
|
||||
|
||||
$decimals = Settings::get('Cifre decimali per importi');
|
||||
|
||||
|
||||
$idiva = get_var('Iva predefinita');
|
||||
$rs_iva = $dbo->fetchArray('SELECT descrizione, percentuale, indetraibile FROM co_iva WHERE id='.prepare($idiva));
|
||||
|
||||
@ -255,63 +255,63 @@ function get_costi_intervento($id_intervento)
|
||||
$result['ricambi_scontato'],
|
||||
$result['altro_scontato'],
|
||||
]);
|
||||
|
||||
|
||||
$result['iva_costo'] = sum([
|
||||
$result['manodopera_costo']*$rs_iva[0]['percentuale']/100,
|
||||
$result['dirittochiamata_costo']*$rs_iva[0]['percentuale']/100,
|
||||
$result['viaggio_costo']*$rs_iva[0]['percentuale']/100,
|
||||
$result['ricambi_costo']*$result['ricambi_iva']/100,
|
||||
$result['altro_costo']*$result['altro_iva']/100,
|
||||
$result['manodopera_costo'] * $rs_iva[0]['percentuale'] / 100,
|
||||
$result['dirittochiamata_costo'] * $rs_iva[0]['percentuale'] / 100,
|
||||
$result['viaggio_costo'] * $rs_iva[0]['percentuale'] / 100,
|
||||
$result['ricambi_costo'] * $result['ricambi_iva'] / 100,
|
||||
$result['altro_costo'] * $result['altro_iva'] / 100,
|
||||
]);
|
||||
|
||||
$result['iva_addebito'] = sum([
|
||||
$result['manodopera_addebito']*$rs_iva[0]['percentuale']/100,
|
||||
$result['dirittochiamata_addebito']*$rs_iva[0]['percentuale']/100,
|
||||
$result['viaggio_addebito']*$rs_iva[0]['percentuale']/100,
|
||||
$result['ricambi_addebito']*$result['ricambi_iva']/100,
|
||||
$result['altro_addebito']*$result['altro_iva']/100,
|
||||
$result['manodopera_addebito'] * $rs_iva[0]['percentuale'] / 100,
|
||||
$result['dirittochiamata_addebito'] * $rs_iva[0]['percentuale'] / 100,
|
||||
$result['viaggio_addebito'] * $rs_iva[0]['percentuale'] / 100,
|
||||
$result['ricambi_addebito'] * $result['ricambi_iva'] / 100,
|
||||
$result['altro_addebito'] * $result['altro_iva'] / 100,
|
||||
]);
|
||||
|
||||
$result['iva_totale'] = sum([
|
||||
$result['manodopera_scontato']*$rs_iva[0]['percentuale']/100,
|
||||
$result['dirittochiamata_scontato']*$rs_iva[0]['percentuale']/100,
|
||||
$result['viaggio_scontato']*$rs_iva[0]['percentuale']/100,
|
||||
$result['ricambi_scontato']*$result['ricambi_iva']/100,
|
||||
$result['altro_scontato']*$result['altro_iva']/100,
|
||||
$result['manodopera_scontato'] * $rs_iva[0]['percentuale'] / 100,
|
||||
$result['dirittochiamata_scontato'] * $rs_iva[0]['percentuale'] / 100,
|
||||
$result['viaggio_scontato'] * $rs_iva[0]['percentuale'] / 100,
|
||||
$result['ricambi_scontato'] * $result['ricambi_iva'] / 100,
|
||||
$result['altro_scontato'] * $result['altro_iva'] / 100,
|
||||
]);
|
||||
|
||||
|
||||
$result['totaleivato_costo'] = sum([
|
||||
$result['manodopera_costo']+($result['manodopera_costo']*$rs_iva[0]['percentuale']/100),
|
||||
$result['dirittochiamata_costo']+($result['dirittochiamata_costo']*$rs_iva[0]['percentuale']/100),
|
||||
$result['viaggio_costo']+($result['viaggio_costo']*$rs_iva[0]['percentuale']/100),
|
||||
$result['ricambi_costo']+($result['ricambi_costo']*$result['ricambi_iva']/100),
|
||||
$result['altro_costo']+($result['altro_costo']*$result['altro_iva']/100),
|
||||
$result['manodopera_costo'] + ($result['manodopera_costo'] * $rs_iva[0]['percentuale'] / 100),
|
||||
$result['dirittochiamata_costo'] + ($result['dirittochiamata_costo'] * $rs_iva[0]['percentuale'] / 100),
|
||||
$result['viaggio_costo'] + ($result['viaggio_costo'] * $rs_iva[0]['percentuale'] / 100),
|
||||
$result['ricambi_costo'] + ($result['ricambi_costo'] * $result['ricambi_iva'] / 100),
|
||||
$result['altro_costo'] + ($result['altro_costo'] * $result['altro_iva'] / 100),
|
||||
]);
|
||||
|
||||
$result['totaleivato_addebito'] = sum([
|
||||
$result['manodopera_addebito']+($result['manodopera_addebito']*$rs_iva[0]['percentuale']/100),
|
||||
$result['dirittochiamata_addebito']+($result['dirittochiamata_addebito']*$rs_iva[0]['percentuale']/100),
|
||||
$result['viaggio_addebito']+($result['viaggio_addebito']*$rs_iva[0]['percentuale']/100),
|
||||
$result['ricambi_addebito']+($result['ricambi_addebito']*$result['ricambi_iva']/100),
|
||||
$result['altro_addebito']+($result['altro_addebito']*$result['altro_iva']/100),
|
||||
$result['manodopera_addebito'] + ($result['manodopera_addebito'] * $rs_iva[0]['percentuale'] / 100),
|
||||
$result['dirittochiamata_addebito'] + ($result['dirittochiamata_addebito'] * $rs_iva[0]['percentuale'] / 100),
|
||||
$result['viaggio_addebito'] + ($result['viaggio_addebito'] * $rs_iva[0]['percentuale'] / 100),
|
||||
$result['ricambi_addebito'] + ($result['ricambi_addebito'] * $result['ricambi_iva'] / 100),
|
||||
$result['altro_addebito'] + ($result['altro_addebito'] * $result['altro_iva'] / 100),
|
||||
]);
|
||||
|
||||
$result['totale'] = sum([
|
||||
$result['manodopera_scontato']+($result['manodopera_scontato']*$rs_iva[0]['percentuale']/100),
|
||||
$result['dirittochiamata_scontato']+($result['dirittochiamata_scontato']*$rs_iva[0]['percentuale']/100),
|
||||
$result['viaggio_scontato']+($result['viaggio_scontato']*$rs_iva[0]['percentuale']/100),
|
||||
$result['ricambi_scontato']+($result['ricambi_scontato']*$result['ricambi_iva']/100),
|
||||
$result['altro_scontato']+($result['altro_scontato']*$result['altro_iva']/100),
|
||||
$result['manodopera_scontato'] + ($result['manodopera_scontato'] * $rs_iva[0]['percentuale'] / 100),
|
||||
$result['dirittochiamata_scontato'] + ($result['dirittochiamata_scontato'] * $rs_iva[0]['percentuale'] / 100),
|
||||
$result['viaggio_scontato'] + ($result['viaggio_scontato'] * $rs_iva[0]['percentuale'] / 100),
|
||||
$result['ricambi_scontato'] + ($result['ricambi_scontato'] * $result['ricambi_iva'] / 100),
|
||||
$result['altro_scontato'] + ($result['altro_scontato'] * $result['altro_iva'] / 100),
|
||||
]);
|
||||
|
||||
// Calcolo dello sconto incondizionato
|
||||
$sconto = $dbo->fetchArray('SELECT sconto_globale, tipo_sconto_globale FROM in_interventi WHERE id='.prepare($id_intervento))[0];
|
||||
$result['sconto_globale'] = ($sconto['tipo_sconto_globale'] == 'PRC') ? $result['totale'] * $sconto['sconto_globale'] / 100 : $sconto['sconto_globale'];
|
||||
$result['sconto_globale'] = round($result['sconto_globale'], $decimals);
|
||||
|
||||
|
||||
$result['totale_scontato'] = sum($result['totale_scontato'], -$result['sconto_globale']);
|
||||
$result['iva_totale'] = sum($result['iva_totale'], -($result['sconto_globale']*$rs_iva[0]['percentuale']/100));
|
||||
$result['totale'] = sum($result['totale'], -($result['sconto_globale']+($result['sconto_globale']*$rs_iva[0]['percentuale']/100)));
|
||||
$result['iva_totale'] = sum($result['iva_totale'], -($result['sconto_globale'] * $rs_iva[0]['percentuale'] / 100));
|
||||
$result['totale'] = sum($result['totale'], -($result['sconto_globale'] + ($result['sconto_globale'] * $rs_iva[0]['percentuale'] / 100)));
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
@ -49,7 +49,6 @@ if (!empty($results)) {
|
||||
echo ' </td>';
|
||||
echo ' </tr>';
|
||||
|
||||
|
||||
echo '
|
||||
</table>';
|
||||
} else {
|
||||
|
@ -50,7 +50,6 @@ switch (filter('op')) {
|
||||
|
||||
case 'delete':
|
||||
|
||||
|
||||
$righe = $dbo->fetchNum('SELECT id FROM co_righe_documenti WHERE um='.prepare($records[0]['valore']).'
|
||||
UNION SELECT id FROM dt_righe_ddt WHERE um='.prepare($records[0]['valore']).'
|
||||
UNION SELECT id FROM or_righe_ordini WHERE um='.prepare($records[0]['valore']).'
|
||||
@ -58,14 +57,12 @@ switch (filter('op')) {
|
||||
UNION SELECT id FROM mg_articoli WHERE um='.prepare($records[0]['valore']).'
|
||||
UNION SELECT id FROM co_righe_preventivi WHERE um='.prepare($records[0]['valore']));
|
||||
|
||||
|
||||
if (isset($id_record) && empty($righe)) {
|
||||
$dbo->query('DELETE FROM `mg_unitamisura` WHERE `id`='.prepare($id_record));
|
||||
$_SESSION['infos'][] = tr('Tipologia di _TYPE_ eliminata con successo!', [
|
||||
'_TYPE_' => 'unità di misura',
|
||||
]);
|
||||
}else{
|
||||
|
||||
} else {
|
||||
$_SESSION['errors'][] = tr('Sono presenti righe collegate a questa unità di misura.');
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,8 @@ $righe = $dbo->fetchNum('SELECT id FROM co_righe_documenti WHERE um='.prepare($r
|
||||
UNION SELECT id FROM mg_articoli WHERE um='.prepare($records[0]['valore']).'
|
||||
UNION SELECT id FROM co_righe_preventivi WHERE um='.prepare($records[0]['valore']));
|
||||
|
||||
if (!empty($righe)){
|
||||
echo '
|
||||
if (!empty($righe)) {
|
||||
echo '
|
||||
<div class="alert alert-danger">
|
||||
'.tr('Ci sono _NUM_ righe collegate', [
|
||||
'_NUM_' => count($righe),
|
||||
|
@ -85,8 +85,8 @@ switch ($op) {
|
||||
|
||||
$id_record = $dbo->lastInsertedID();
|
||||
|
||||
if (isAjaxRequest() && post('source')!='') {
|
||||
echo json_encode(['id' => $id_record, 'text' => $matricola." - ".$nome]);
|
||||
if (isAjaxRequest() && post('source') != '') {
|
||||
echo json_encode(['id' => $id_record, 'text' => $matricola.' - '.$nome]);
|
||||
}
|
||||
|
||||
$_SESSION['infos'][] = tr('Aggiunto nuovo impianto!');
|
||||
|
@ -35,15 +35,15 @@ switch ($resource) {
|
||||
break;
|
||||
|
||||
case 'impianti-intervento':
|
||||
if( isset($superselect['idintervento']) ){
|
||||
if (isset($superselect['idintervento'])) {
|
||||
$query = 'SELECT id, CONCAT(matricola, " - ", nome) AS descrizione FROM my_impianti INNER JOIN my_impianti_interventi ON my_impianti.id=my_impianti_interventi.idimpianto |where| ORDER BY idsede';
|
||||
|
||||
foreach ($elements as $element) {
|
||||
$filter[] = 'id='.prepare($element);
|
||||
}
|
||||
|
||||
|
||||
$where[] = 'my_impianti_interventi.idintervento='.prepare($superselect['idintervento']);
|
||||
|
||||
|
||||
if (!empty($search)) {
|
||||
$search_fields[] = 'nome LIKE '.prepare('%'.$search.'%');
|
||||
$search_fields[] = 'matricola LIKE '.prepare('%'.$search.'%');
|
||||
|
@ -6,13 +6,13 @@ function genera_form_componente($contenuto)
|
||||
{
|
||||
$fields = \Util\Ini::getFields($contenuto);
|
||||
$title = array_shift($fields);
|
||||
|
||||
|
||||
foreach ($fields as $key => $value) {
|
||||
$fields[$key] = '<div class="col-md-4">'.$value.'</div>';
|
||||
}
|
||||
|
||||
|
||||
echo $title;
|
||||
echo '<div class="row">';
|
||||
echo PHP_EOL.implode(PHP_EOL, $fields).PHP_EOL.'<script>start_inputmask( "#info_componente" );</script>';
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,7 @@
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
if (!in_array($records[0]['stato'], ['Evaso', 'Fatturato', 'Parzialmente fatturato'])) {
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-info dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||
<i class="fa fa-magic"></i> '.tr('Crea').'...
|
||||
@ -24,5 +23,4 @@ echo '
|
||||
|
||||
</ul>
|
||||
</div>';
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ $data = [
|
||||
'rows' => 'co_righe_preventivi',
|
||||
'id' => 'idpreventivo',
|
||||
'condition' => '',
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
$documento = get('documento');
|
||||
@ -20,13 +20,12 @@ $op = 'ordine_da_preventivo';
|
||||
|
||||
$head = tr('Preventivo numero _NUM_');
|
||||
|
||||
|
||||
$table = $data[$pos]['table'];
|
||||
$rows = $data[$pos]['rows'];
|
||||
$id = $data[$pos]['id'];
|
||||
$row = str_replace('id', 'id_riga_', $id);
|
||||
|
||||
$module_name = "Ordini cliente";
|
||||
$module_name = 'Ordini cliente';
|
||||
|
||||
$op = !empty($get['op']) ? $get['op'] : $op;
|
||||
|
||||
@ -46,7 +45,6 @@ $idconto = $rs[0]['idconto'];
|
||||
echo '
|
||||
<p>'.str_replace('_NUM_', $numero, $head).'.</p>';
|
||||
|
||||
|
||||
// Selezione articoli del preventivo da copiare nell'ordine, usando l'ordinamento scelto dall'utente
|
||||
$rs = $dbo->fetchArray('SELECT * FROM '.$table.' INNER JOIN '.$rows.' ON '.$table.'.id='.$rows.'.'.$id.' WHERE '.$table.'.id='.prepare($id_record).' ORDER BY `order`');
|
||||
|
||||
@ -103,8 +101,10 @@ if (!empty($rs)) {
|
||||
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
if ($r['is_descrizione']) continue;
|
||||
|
||||
if ($r['is_descrizione']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Q.tà rimanente
|
||||
echo '
|
||||
|
@ -36,18 +36,18 @@ if ($module['name'] == 'Ordini cliente') {
|
||||
|
||||
<div class="col-md-3">
|
||||
<?php
|
||||
if(get_var("Cambia automaticamente stato ordini fatturati")){
|
||||
if($records[0]['stato']=='Evaso' || $records[0]['stato']=='Parzialmente evaso' || $records[0]['stato']=='Fatturato' || $records[0]['stato']=='Parzialmente fatturato'){
|
||||
?>
|
||||
if (get_var('Cambia automaticamente stato ordini fatturati')) {
|
||||
if ($records[0]['stato'] == 'Evaso' || $records[0]['stato'] == 'Parzialmente evaso' || $records[0]['stato'] == 'Fatturato' || $records[0]['stato'] == 'Parzialmente fatturato') {
|
||||
?>
|
||||
{[ "type": "select", "label": "<?php echo tr('Stato'); ?>", "name": "idstatoordine", "required": 1, "values": "query=SELECT * FROM or_statiordine", "value": "$idstatoordine$", "extra": "readonly" ]}
|
||||
<?php
|
||||
}else{
|
||||
?>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
{[ "type": "select", "label": "<?php echo tr('Stato'); ?>", "name": "idstatoordine", "required": 1, "values": "query=SELECT * FROM or_statiordine WHERE descrizione IN('Bozza')", "value": "$idstatoordine$" ]}
|
||||
<?php
|
||||
}
|
||||
}else{
|
||||
?>
|
||||
} else {
|
||||
?>
|
||||
{[ "type": "select", "label": "<?php echo tr('Stato'); ?>", "name": "idstatoordine", "required": 1, "values": "query=SELECT * FROM or_statiordine", "value": "$idstatoordine$" ]}
|
||||
<?php
|
||||
}
|
||||
@ -112,18 +112,16 @@ if ($module['name'] == 'Ordini cliente') {
|
||||
<div class="pull-left">
|
||||
<?php
|
||||
|
||||
if ( $records[0]['flag_completato'] == 0 ) {
|
||||
|
||||
?>
|
||||
if ($records[0]['flag_completato'] == 0) {
|
||||
?>
|
||||
<a class="btn btn-primary" data-href="<?php echo $rootdir; ?>/modules/ordini/row-add.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>&is_articolo" data-toggle="modal" data-title="Aggiungi articolo" data-target="#bs-popup"><i class="fa fa-plus"></i> <?php echo tr('Articolo'); ?></a>
|
||||
|
||||
<a class="btn btn-primary" data-href="<?php echo $rootdir; ?>/modules/ordini/row-add.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>&is_riga" data-toggle="modal" data-title="Aggiungi riga" data-target="#bs-popup"><i class="fa fa-plus"></i> <?php echo tr('Riga'); ?></a>
|
||||
|
||||
<a class="btn btn-primary" data-href="<?php echo $rootdir; ?>/modules/ordini/row-add.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>&is_descrizione" data-toggle="modal" data-title="Aggiungi descrizione" data-target="#bs-popup"><i class="fa fa-plus"></i> <?php echo tr('Descrizione'); ?></a>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
@ -186,8 +184,8 @@ if (!empty($elementi)) {
|
||||
|
||||
<script>
|
||||
<?php
|
||||
if ( $records[0]['flag_completato'] ) {
|
||||
?>
|
||||
if ($records[0]['flag_completato']) {
|
||||
?>
|
||||
$('#tipo_sconto_generico').prop('disabled', true);
|
||||
<?php
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ include_once __DIR__.'/../../core.php';
|
||||
|
||||
if (isset($id_record)) {
|
||||
// Aggiornamento stato di questo ordine (?)
|
||||
if (!empty(get_stato_ordine($id_record)) && get_var('Cambia automaticamente stato ordini fatturati')){
|
||||
$dbo->query( 'UPDATE or_ordini SET idstatoordine=(SELECT id FROM or_statiordine WHERE descrizione="'.get_stato_ordine($id_record).'") WHERE id='.prepare($id_record) );
|
||||
if (!empty(get_stato_ordine($id_record)) && get_var('Cambia automaticamente stato ordini fatturati')) {
|
||||
$dbo->query('UPDATE or_ordini SET idstatoordine=(SELECT id FROM or_statiordine WHERE descrizione="'.get_stato_ordine($id_record).'") WHERE id='.prepare($id_record));
|
||||
}
|
||||
|
||||
$records = $dbo->fetchArray('SELECT *, or_ordini.note, or_ordini.idpagamento, or_ordini.id AS idordine, or_statiordine.descrizione AS `stato`, or_tipiordine.descrizione AS `descrizione_tipodoc`, (SELECT completato FROM or_statiordine WHERE or_statiordine.id=or_ordini.idstatoordine) AS flag_completato FROM ((or_ordini LEFT OUTER JOIN or_statiordine ON or_ordini.idstatoordine=or_statiordine.id) INNER JOIN an_anagrafiche ON or_ordini.idanagrafica=an_anagrafiche.idanagrafica) INNER JOIN or_tipiordine ON or_ordini.idtipoordine=or_tipiordine.id WHERE or_ordini.id='.prepare($id_record));
|
||||
|
@ -44,7 +44,7 @@ switch (filter('op')) {
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
|
||||
|
||||
$documenti = $dbo->fetchNum('SELECT id FROM dt_ddt WHERE idporto='.prepare($id_record).'
|
||||
UNION SELECT id FROM co_documenti WHERE idporto='.prepare($id_record).'
|
||||
UNION SELECT id FROM co_preventivi WHERE idporto='.prepare($id_record));
|
||||
@ -55,9 +55,7 @@ switch (filter('op')) {
|
||||
'_TYPE_' => 'porto',
|
||||
]);
|
||||
} else {
|
||||
|
||||
$_SESSION['errors'][] = tr('Sono presenti dei documenti collegati a questo porto.');
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -27,8 +27,8 @@ $documenti = $dbo->fetchNum('SELECT id FROM dt_ddt WHERE idporto='.prepare($id_r
|
||||
UNION SELECT id FROM co_documenti WHERE idporto='.prepare($id_record).'
|
||||
UNION SELECT id FROM co_preventivi WHERE idporto='.prepare($id_record));
|
||||
|
||||
if (!empty($documenti)){
|
||||
echo '
|
||||
if (!empty($documenti)) {
|
||||
echo '
|
||||
<div class="alert alert-danger">
|
||||
'.tr('Ci sono _NUM_ documenti collegati', [
|
||||
'_NUM_' => count($documenti),
|
||||
|
@ -2,9 +2,8 @@
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
if (!in_array($records[0]['stato'], ['Bozza','Rifiutato','In attesa di conferma'])) {
|
||||
|
||||
echo '
|
||||
if (!in_array($records[0]['stato'], ['Bozza', 'Rifiutato', 'In attesa di conferma'])) {
|
||||
echo '
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-info dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||
<i class="fa fa-magic"></i> '.tr('Crea').'...
|
||||
@ -19,5 +18,4 @@ echo '
|
||||
|
||||
</ul>
|
||||
</div>';
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ switch (post('op')) {
|
||||
|
||||
//Creo il modello di prima nota
|
||||
|
||||
if(post('crea_modello')=='1'){
|
||||
if (post('crea_modello') == '1') {
|
||||
$idmastrino = get_new_idmastrino('co_movimenti_modelli');
|
||||
|
||||
for ($i = 0; $i < sizeof($post['idconto']); ++$i) {
|
||||
|
@ -70,9 +70,8 @@ include_once __DIR__.'/../../core.php';
|
||||
</tr>';
|
||||
|
||||
for ($i = 0; $i < 10; ++$i) {
|
||||
|
||||
($i<=1) ? $required = 1 : $required = 0;
|
||||
|
||||
($i <= 1) ? $required = 1 : $required = 0;
|
||||
|
||||
// Conto
|
||||
echo '
|
||||
<tr>
|
||||
|
@ -32,7 +32,7 @@ switch (post('op')) {
|
||||
case 'add':
|
||||
$pattern = str_contains(post('pattern'), '#') ? post('pattern') : '####';
|
||||
$predefined = post('predefined');
|
||||
|
||||
|
||||
$module = post('module');
|
||||
|
||||
if (empty(Modules::getSegments($module))) {
|
||||
|
@ -107,34 +107,34 @@ if (strpos($table[0], 'co_documenti') !== false) {
|
||||
|
||||
<?php
|
||||
if ($tot > 0) {
|
||||
echo "<div class='alert alert-danger' style='margin:0px;'>";
|
||||
echo "<div class='alert alert-danger' style='margin:0px;'>";
|
||||
|
||||
echo tr("Ci sono _TOT_ righe collegate al segmento per il modulo '_MODULO_'. Il comando elimina è stato disattivato, eliminare le righe per attivare il comando 'Elimina segmento'.", [
|
||||
echo tr("Ci sono _TOT_ righe collegate al segmento per il modulo '_MODULO_'. Il comando elimina è stato disattivato, eliminare le righe per attivare il comando 'Elimina segmento'.", [
|
||||
'_TOT_' => $tot,
|
||||
'_MODULO_' => $records[0]['modulo'],
|
||||
]);
|
||||
|
||||
echo '</div>';
|
||||
} elseif ($records[0]['predefined']) {
|
||||
echo "<div class='alert alert-danger' style='margin:0px;'>";
|
||||
echo '</div>';
|
||||
} elseif ($records[0]['predefined']) {
|
||||
echo "<div class='alert alert-danger' style='margin:0px;'>";
|
||||
|
||||
echo tr("Questo è il segmento predefinito per il modulo '_MODULO_'. Il comando elimina è stato disattivato.", [
|
||||
echo tr("Questo è il segmento predefinito per il modulo '_MODULO_'. Il comando elimina è stato disattivato.", [
|
||||
'_MODULO_' => $records[0]['modulo'],
|
||||
]);
|
||||
|
||||
echo '</div>';
|
||||
} elseif ($records[0]['n_sezionali'] < 2) {
|
||||
echo "<div class='alert alert-danger' style='margin:0px;'>";
|
||||
echo '</div>';
|
||||
} elseif ($records[0]['n_sezionali'] < 2) {
|
||||
echo "<div class='alert alert-danger' style='margin:0px;'>";
|
||||
|
||||
echo tr("Questo è l'unico segmento per il modulo '_MODULO_'. Il comando elimina è stato disattivato.", [
|
||||
echo tr("Questo è l'unico segmento per il modulo '_MODULO_'. Il comando elimina è stato disattivato.", [
|
||||
'_MODULO_' => $records[0]['modulo'],
|
||||
]);
|
||||
|
||||
echo '</div>';
|
||||
} else {
|
||||
echo '
|
||||
echo '</div>';
|
||||
} else {
|
||||
echo '
|
||||
<a class="btn btn-danger ask" data-backto="record-list">
|
||||
<i class="fa fa-trash"></i> '.tr('Elimina').'
|
||||
</a>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -6,7 +6,7 @@ switch (post('op')) {
|
||||
case 'update':
|
||||
$descrizione = post('descrizione');
|
||||
$colore = post('colore');
|
||||
$completato = post('completato');
|
||||
$completato = post('completato');
|
||||
|
||||
// Aggiorna
|
||||
$query = 'UPDATE in_statiintervento SET descrizione='.prepare($descrizione).', colore='.prepare($colore).', completato='.prepare($completato).' WHERE idstatointervento='.prepare($id_record);
|
||||
|
@ -2,9 +2,9 @@
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
if ($records[0]['can_delete']) {
|
||||
$attr = '';
|
||||
}else{
|
||||
$attr = "readonly";
|
||||
$attr = '';
|
||||
} else {
|
||||
$attr = 'readonly';
|
||||
echo '<div class="alert alert-warning">'.tr('Alcune impostazioni non possono essere modificate per questo stato intervento.').'</div>';
|
||||
}
|
||||
?>
|
||||
|
@ -12,9 +12,9 @@ switch (post('op')) {
|
||||
$costo_orario_tecnico = post('costo_orario_tecnico');
|
||||
$costo_km_tecnico = post('costo_km_tecnico');
|
||||
$costo_diritto_chiamata_tecnico = post('costo_diritto_chiamata_tecnico');
|
||||
|
||||
$tempo_standard = (empty(post('tempo_standard'))) ? 'NULL' : prepare(round((force_decimal($_POST['tempo_standard'])/2.5),1)*2.5);
|
||||
|
||||
|
||||
$tempo_standard = (empty(post('tempo_standard'))) ? 'NULL' : prepare(round((force_decimal($_POST['tempo_standard']) / 2.5), 1) * 2.5);
|
||||
|
||||
$query = 'UPDATE in_tipiintervento SET'.
|
||||
' descrizione='.prepare($descrizione).','.
|
||||
' costo_orario='.prepare($costo_orario).','.
|
||||
@ -23,7 +23,7 @@ switch (post('op')) {
|
||||
' costo_orario_tecnico='.prepare($costo_orario_tecnico).','.
|
||||
' costo_km_tecnico='.prepare($costo_km_tecnico).','.
|
||||
' costo_diritto_chiamata_tecnico='.prepare($costo_diritto_chiamata_tecnico).','.
|
||||
' tempo_standard='.$tempo_standard.
|
||||
' tempo_standard='.$tempo_standard.
|
||||
' WHERE idtipointervento='.prepare($id_record);
|
||||
|
||||
$dbo->query($query);
|
||||
@ -34,9 +34,9 @@ switch (post('op')) {
|
||||
case 'add':
|
||||
$idtipointervento = post('idtipointervento');
|
||||
$descrizione = post('descrizione');
|
||||
|
||||
$tempo_standard = (empty(post('tempo_standard'))) ? 'NULL' : prepare(round((force_decimal($_POST['tempo_standard'])/2.5),1)*2.5);
|
||||
|
||||
|
||||
$tempo_standard = (empty(post('tempo_standard'))) ? 'NULL' : prepare(round((force_decimal($_POST['tempo_standard']) / 2.5), 1) * 2.5);
|
||||
|
||||
$query = 'INSERT INTO in_tipiintervento(idtipointervento, descrizione, costo_orario, costo_km, tempo_standard) VALUES ('.prepare($idtipointervento).', '.prepare($descrizione).', 0.00, 0.00, '.$tempo_standard.')';
|
||||
$dbo->query($query);
|
||||
|
||||
|
@ -5,13 +5,13 @@ include_once __DIR__.'/../../../core.php';
|
||||
switch ($resource) {
|
||||
case 'anagrafiche_utenti':
|
||||
$query = 'SELECT CONCAT(`an_tipianagrafiche`.`idtipoanagrafica`, "-", `an_anagrafiche`.`idanagrafica`) AS id, `ragione_sociale` AS "descrizione", `descrizione` AS optgroup FROM `an_tipianagrafiche` INNER JOIN `an_tipianagrafiche_anagrafiche` ON `an_tipianagrafiche`.`idtipoanagrafica`=`an_tipianagrafiche_anagrafiche`.`idtipoanagrafica` INNER JOIN `an_anagrafiche` ON `an_anagrafiche`.`idanagrafica`=`an_tipianagrafiche_anagrafiche`.`idanagrafica` |where| ORDER BY `optgroup` ASC';
|
||||
|
||||
|
||||
$where[] = 'an_anagrafiche.deleted= 0';
|
||||
|
||||
|
||||
if (!empty($search)) {
|
||||
$search_fields[] = 'an_anagrafiche.ragione_sociale LIKE '.prepare('%'.$search.'%');
|
||||
}
|
||||
|
||||
|
||||
if (!empty($search_fields)) {
|
||||
$where[] = '('.implode(' OR ', $search_fields).')';
|
||||
}
|
||||
@ -19,22 +19,20 @@ switch ($resource) {
|
||||
if (!empty($filter)) {
|
||||
$where[] = '('.implode(' OR ', $filter).')';
|
||||
}
|
||||
|
||||
|
||||
$wh = '';
|
||||
if (count($where) != 0) {
|
||||
$wh = 'WHERE '.implode(' AND ', $where);
|
||||
}
|
||||
$query = str_replace('|where|', $wh, $query);
|
||||
|
||||
|
||||
$rs = $dbo->fetchArray($query);
|
||||
foreach ($rs as $r) {
|
||||
if ($prev != $r['optgroup']) {
|
||||
|
||||
$results[] = ['text' => $r['optgroup'], 'children' => []];
|
||||
$prev = $r['optgroup'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
$results[count($results) - 1]['children'][] = [
|
||||
'id' => $r['id'],
|
||||
'text' => $r['descrizione'],
|
||||
|
@ -55,7 +55,7 @@ if (!empty($utenti)) {
|
||||
echo '
|
||||
<a href="javascript:;" onclick="swal({ title: \''.tr('Disabilitare questo utente?').'\', type: \'info\', showCancelButton: true, confirmButtonText: \''.tr('Sì').'\' }).then(function (result) { location.href=\''.$rootdir.'/editor.php?id_module='.$id_module.'&id_record='.$id_record.'&op=disable&id_utente='.$utente['id'].'&idgruppo='.$record['id'].'\'; }) " title="Disabilita utente" class="text-danger tip"><i class="fa fa-2x fa-eye-slash"></i></a>';
|
||||
} else {
|
||||
echo '
|
||||
echo '
|
||||
<a href="javascript:;" onclick="swal({ title: \''.tr('Abilitare questo utente?').'\', type: \'info\', showCancelButton: true, confirmButtonText: \''.tr('Sì').'\' }).then(function (result) { location.href=\''.$rootdir.'/editor.php?id_module='.$id_module.'&id_record='.$id_record.'&op=enable&id_utente='.$utente['id'].'&idgruppo='.$record['id'].'\'; }) " title="Abilita utente" class="text-success tip"><i class="fa fa-2x fa-eye"></i></a>';
|
||||
}
|
||||
} else {
|
||||
@ -69,10 +69,8 @@ if (!empty($utenti)) {
|
||||
|
||||
// Eliminazione utente, se diverso da id_utente #1 (admin)
|
||||
if ($utente['id'] != '1') {
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<a href="javascript:;" onclick="swal({ title: \''.tr('Eliminare questo utente?').'\', type: \'info\', showCancelButton: true, confirmButtonText: \''.tr('Sì').'\' }).then(function (result) { location.href=\''.$rootdir.'/editor.php?id_module='.$id_module.'&id_record='.$id_record.'&op=delete&id_utente='.$utente['id'].'&idgruppo='.$record['id'].'\'; }) " title="Elimina utente" class="text-danger tip"><i class="fa fa-2x fa-trash"></i></a>';
|
||||
|
||||
} else {
|
||||
echo '
|
||||
<span onclick="alert(\"'.tr("Non è possibile eliminare l'utente admin").'\")" class="text-muted tip"><i class="fa fa-2x fa-trash"></i></span>';
|
||||
|
@ -16,16 +16,15 @@ if ($self_edit) {
|
||||
} else {
|
||||
$idgruppo = intval(filter('idgruppo'));
|
||||
$id_utente = filter('id_utente');
|
||||
|
||||
//gruppo della selezione
|
||||
$nome_gruppo = $dbo->fetchArray('SELECT nome FROM zz_groups WHERE id='.prepare($idgruppo))[0]['nome'];
|
||||
$gruppi = [
|
||||
'Clienti' => 'Cliente',
|
||||
'Tecnici' => 'Tecnico',
|
||||
'Agenti' => 'Agente',
|
||||
];
|
||||
$nome_gruppo = $gruppi[$nome_gruppo];
|
||||
|
||||
//gruppo della selezione
|
||||
$nome_gruppo = $dbo->fetchArray('SELECT nome FROM zz_groups WHERE id='.prepare($idgruppo))[0]['nome'];
|
||||
$gruppi = [
|
||||
'Clienti' => 'Cliente',
|
||||
'Tecnici' => 'Tecnico',
|
||||
'Agenti' => 'Agente',
|
||||
];
|
||||
$nome_gruppo = $gruppi[$nome_gruppo];
|
||||
}
|
||||
|
||||
if (!empty($id_utente)) {
|
||||
@ -88,7 +87,7 @@ if (!$self_edit) {
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "select", "label": "'.tr('Collega ad una anagrafica').'", "name": "idanag", "required": 1, "ajax-source": "anagrafiche_utenti", "value": "'.$id_anagrafica.'", "icon-after": "add|'.Modules::get("Anagrafiche")["id"].'|tipoanagrafica='.$nome_gruppo.'" ]}
|
||||
{[ "type": "select", "label": "'.tr('Collega ad una anagrafica').'", "name": "idanag", "required": 1, "ajax-source": "anagrafiche_utenti", "value": "'.$id_anagrafica.'", "icon-after": "add|'.Modules::get('Anagrafiche')['id'].'|tipoanagrafica='.$nome_gruppo.'" ]}
|
||||
</div>
|
||||
</div>';
|
||||
} else {
|
||||
@ -118,15 +117,15 @@ echo '
|
||||
else if( $("#password1").val().length < min_length )
|
||||
swal({
|
||||
title: "'.tr('La password deve essere lunga minimo _MIN_ caratteri!', [
|
||||
'_MIN_' => $min_length_password,
|
||||
]).'",
|
||||
'_MIN_' => $min_length_password,
|
||||
]).'",
|
||||
type: "error",
|
||||
});
|
||||
else if( $("#username").val().length < min_length_username )
|
||||
swal({
|
||||
title: "'.tr('L\'username deve essere lungo minimo _MIN_ caratteri.', [
|
||||
'_MIN_' => $min_length_username,
|
||||
]).'",
|
||||
'_MIN_' => $min_length_username,
|
||||
]).'",
|
||||
type: "error",
|
||||
});
|
||||
else
|
||||
|
@ -93,7 +93,7 @@ switch (filter('op')) {
|
||||
|
||||
if (check_query($post['query'][$c])) {
|
||||
$array = [
|
||||
'name' => $post['name'][$c],
|
||||
'name' => $post['name'][$c],
|
||||
'idgruppo' => $post['gruppo'][$c],
|
||||
'idmodule' => $id_record,
|
||||
'clause' => $post['query'][$c],
|
||||
|
@ -372,10 +372,10 @@ if (!empty($options) && $options != 'custom') {
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "textarea", "label": "'.tr('Query').'", "name": "query['.$num.']", "value": "'.prepareToField($additional['clause']).'"';
|
||||
if (!$editable) {
|
||||
echo ', "readonly": "1"';
|
||||
}
|
||||
echo ' ]}
|
||||
if (!$editable) {
|
||||
echo ', "readonly": "1"';
|
||||
}
|
||||
echo ' ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -37,16 +37,14 @@ switch (post('op')) {
|
||||
$dbo->query($query);
|
||||
|
||||
$id_record = $dbo->lastInsertedID();
|
||||
|
||||
if (isAjaxRequest()) {
|
||||
echo json_encode(['id' => $id_record, 'text' => $nome.' - '.$descrizione]);
|
||||
}
|
||||
|
||||
|
||||
if (isAjaxRequest()) {
|
||||
echo json_encode(['id' => $id_record, 'text' => $nome.' - '.$descrizione]);
|
||||
}
|
||||
|
||||
$_SESSION['infos'][] = tr('Aggiunta una nuova zona!');
|
||||
}
|
||||
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
|
@ -480,7 +480,7 @@ echo '
|
||||
<table class="table table-bordered" style="display:none;">';
|
||||
|
||||
if ($show) {
|
||||
echo ' <tr>
|
||||
echo ' <tr>
|
||||
<td colspan="3" class="text-right border-top" >
|
||||
<b>'.tr('Imponibile', [], ['upper' => true]).':</b>
|
||||
</td>
|
||||
@ -490,10 +490,9 @@ if ($show) {
|
||||
</th>
|
||||
</tr>';
|
||||
|
||||
|
||||
// Eventuale sconto incondizionato
|
||||
if (!empty($sconto)) {
|
||||
echo '
|
||||
// Eventuale sconto incondizionato
|
||||
if (!empty($sconto)) {
|
||||
echo '
|
||||
<tr>
|
||||
<td colspan="3" class="text-right border-top">
|
||||
<b>'.tr('Sconto', [], ['upper' => true]).':</b>
|
||||
@ -504,8 +503,8 @@ if (!empty($sconto)) {
|
||||
</th>
|
||||
</tr>';
|
||||
|
||||
// Imponibile scontato
|
||||
echo '
|
||||
// Imponibile scontato
|
||||
echo '
|
||||
<tr>
|
||||
<td colspan="3" class="text-right border-top">
|
||||
<b>'.tr('Imponibile scontato', [], ['upper' => true]).':</b>
|
||||
@ -515,15 +514,14 @@ if (!empty($sconto)) {
|
||||
<b>'.Translator::numberToLocale($totale).' €</b>
|
||||
</th>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// IVA
|
||||
$rs = $dbo->fetchArray('SELECT * FROM co_iva WHERE co_iva.id = '.prepare(get_var('Iva predefinita')));
|
||||
$percentuale_iva = $rs[0]['percentuale'];
|
||||
$iva = $totale / 100 * $percentuale_iva;
|
||||
// IVA
|
||||
$rs = $dbo->fetchArray('SELECT * FROM co_iva WHERE co_iva.id = '.prepare(get_var('Iva predefinita')));
|
||||
$percentuale_iva = $rs[0]['percentuale'];
|
||||
$iva = $totale / 100 * $percentuale_iva;
|
||||
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<tr>
|
||||
<td colspan="3" class="text-right border-top">
|
||||
<b>'.tr('Iva (_PRC_%)', [
|
||||
@ -535,13 +533,10 @@ echo '
|
||||
<b>'.Translator::numberToLocale($iva).' €</b>
|
||||
</th>
|
||||
</tr>';
|
||||
|
||||
//$totale = sum($totale, $iva);
|
||||
|
||||
|
||||
//$totale = sum($totale, $iva);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// TOTALE
|
||||
echo '
|
||||
<tr>
|
||||
@ -553,7 +548,6 @@ echo '
|
||||
</th>
|
||||
</tr>';
|
||||
|
||||
|
||||
// BUDGET
|
||||
echo '
|
||||
<tr>
|
||||
|
@ -62,6 +62,6 @@ $custom = [
|
||||
// - cliente se è impostato l'idanagrafica di un Cliente
|
||||
// - utente qualsiasi con permessi almeno in lettura sul modulo
|
||||
// - admin
|
||||
if ( ( $_SESSION['gruppo'] == 'Clienti' && $id_cliente != Auth::user()['idanagrafica'] && !Auth::admin()) || Modules::getPermission($module_name)=='-') {
|
||||
if (($_SESSION['gruppo'] == 'Clienti' && $id_cliente != Auth::user()['idanagrafica'] && !Auth::admin()) || Modules::getPermission($module_name) == '-') {
|
||||
die(tr('Non hai i permessi per questa stampa!'));
|
||||
}
|
||||
|
@ -9,11 +9,13 @@ $body = file_get_contents($docroot.'/templates/magazzino_inventario/magazzino_in
|
||||
$search_codice = $_GET['search_codice'];
|
||||
$search_descrizione = $_GET['search_descrizione'];
|
||||
|
||||
if ($_GET['search_subcategoria']=='undefined')
|
||||
$_GET['search_subcategoria'] = '';
|
||||
if ($_GET['search_subcategoria'] == 'undefined') {
|
||||
$_GET['search_subcategoria'] = '';
|
||||
}
|
||||
|
||||
if (!empty( $_GET['search_categoria'] ) or !empty( $_GET['search_subcategoria'] ) )
|
||||
$search_categoria = $_GET['search_categoria'].' '.$_GET['search_subcategoria'];
|
||||
if (!empty($_GET['search_categoria']) or !empty($_GET['search_subcategoria'])) {
|
||||
$search_categoria = $_GET['search_categoria'].' '.$_GET['search_subcategoria'];
|
||||
}
|
||||
|
||||
$search_tipo = $_GET['search_tipo'];
|
||||
|
||||
@ -29,18 +31,18 @@ if ($search_tipo == 'solo prodotti attivi') {
|
||||
$add_where = '';
|
||||
}
|
||||
|
||||
if ($search_codice != '') {
|
||||
$add_where .= " AND ( replace(codice,'.','') LIKE \"%$search_codice%\" OR codice LIKE \"%$search_codice%\" )";
|
||||
}
|
||||
|
||||
if ($search_codice!='')
|
||||
$add_where .= " AND ( replace(codice,'.','') LIKE \"%$search_codice%\" OR codice LIKE \"%$search_codice%\" )";
|
||||
|
||||
if ($search_descrizione!='')
|
||||
$add_where .= " AND replace(descrizione,'.','') LIKE \"%$search_descrizione%\"";
|
||||
if ($search_descrizione != '') {
|
||||
$add_where .= " AND replace(descrizione,'.','') LIKE \"%$search_descrizione%\"";
|
||||
}
|
||||
|
||||
$add_having = '';
|
||||
if (!empty($search_categoria))
|
||||
$add_having .= " AND CONCAT_WS( ' ', categoria, subcategoria ) LIKE '%".$search_categoria."%' ";
|
||||
|
||||
|
||||
if (!empty($search_categoria)) {
|
||||
$add_having .= " AND CONCAT_WS( ' ', categoria, subcategoria ) LIKE '%".$search_categoria."%' ";
|
||||
}
|
||||
|
||||
include_once $docroot.'/templates/pdfgen_variables.php';
|
||||
|
||||
@ -48,12 +50,10 @@ include_once $docroot.'/templates/pdfgen_variables.php';
|
||||
// LEFT OUTER JOIN mg_unitamisura ON mg_unitamisura.id=mg_articoli.idum
|
||||
// mg_unitamisura.valore AS um
|
||||
// LEFT OUTER JOIN mg_categorie ON (mg_categorie.id=mg_articoli.id_categoria AND mg_categorie.parent = 0) OR (mg_categorie.id=mg_articoli.id_sottocategoria AND mg_categorie.parent = 1)
|
||||
$query = "SELECT *, mg_articoli.id AS id_articolo, (SELECT nome FROM mg_categorie WHERE mg_categorie.parent = 0 AND mg_categorie.id = mg_articoli.id_categoria) AS categoria, (SELECT nome FROM mg_categorie WHERE mg_categorie.parent = 1 AND mg_categorie.id = mg_articoli.id_sottocategoria) AS subcategoria FROM mg_articoli WHERE 1=1 ".$add_where." AND qta > 0 HAVING 2=2 ".$add_having." ORDER BY codice ASC";
|
||||
$query = 'SELECT *, mg_articoli.id AS id_articolo, (SELECT nome FROM mg_categorie WHERE mg_categorie.parent = 0 AND mg_categorie.id = mg_articoli.id_categoria) AS categoria, (SELECT nome FROM mg_categorie WHERE mg_categorie.parent = 1 AND mg_categorie.id = mg_articoli.id_sottocategoria) AS subcategoria FROM mg_articoli WHERE 1=1 '.$add_where.' AND qta > 0 HAVING 2=2 '.$add_having.' ORDER BY codice ASC';
|
||||
$rs = $dbo->fetchArray($query);
|
||||
$totrows = sizeof($rs);
|
||||
|
||||
|
||||
|
||||
$body .= '<h3>INVENTARIO AL '.date('d/m/Y')."</h3>\n";
|
||||
|
||||
$body .= "<table cellspacing='0' style='table-layout:fixed;'>\n";
|
||||
|
@ -470,8 +470,8 @@ $rapporto = floatval($budget) - floatval($totale);
|
||||
echo '
|
||||
<table class="table table-bordered">';
|
||||
|
||||
if ($show){
|
||||
echo '<tr>
|
||||
if ($show) {
|
||||
echo '<tr>
|
||||
<td colspan="3" class="text-right border-top">
|
||||
<b>'.tr('Imponibile', [], ['upper' => true]).':</b>
|
||||
</td>
|
||||
@ -481,11 +481,9 @@ if ($show){
|
||||
</th>
|
||||
</tr>';
|
||||
|
||||
|
||||
|
||||
// Eventuale sconto incondizionato
|
||||
if (!empty($sconto)) {
|
||||
echo '
|
||||
// Eventuale sconto incondizionato
|
||||
if (!empty($sconto)) {
|
||||
echo '
|
||||
<tr>
|
||||
<td colspan="3" class="text-right border-top">
|
||||
<b>'.tr('Sconto', [], ['upper' => true]).':</b>
|
||||
@ -496,8 +494,8 @@ if (!empty($sconto)) {
|
||||
</th>
|
||||
</tr>';
|
||||
|
||||
// Imponibile scontato
|
||||
echo '
|
||||
// Imponibile scontato
|
||||
echo '
|
||||
<tr>
|
||||
<td colspan="3" class="text-right border-top">
|
||||
<b>'.tr('Imponibile scontato', [], ['upper' => true]).':</b>
|
||||
@ -507,14 +505,14 @@ if (!empty($sconto)) {
|
||||
<b>'.Translator::numberToLocale($totale).' €</b>
|
||||
</th>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// IVA
|
||||
$rs = $dbo->fetchArray('SELECT * FROM co_iva WHERE co_iva.id = '.prepare(get_var('Iva predefinita')));
|
||||
$percentuale_iva = $rs[0]['percentuale'];
|
||||
$iva = $totale / 100 * $percentuale_iva;
|
||||
// IVA
|
||||
$rs = $dbo->fetchArray('SELECT * FROM co_iva WHERE co_iva.id = '.prepare(get_var('Iva predefinita')));
|
||||
$percentuale_iva = $rs[0]['percentuale'];
|
||||
$iva = $totale / 100 * $percentuale_iva;
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<tr>
|
||||
<td colspan="3" class="text-right border-top">
|
||||
<b>'.tr('Iva (_PRC_%)', [
|
||||
@ -527,8 +525,7 @@ echo '
|
||||
</th>
|
||||
</tr>';
|
||||
|
||||
//$totale = sum($totale, $iva);
|
||||
|
||||
//$totale = sum($totale, $iva);
|
||||
}
|
||||
|
||||
// TOTALE
|
||||
|
@ -17,7 +17,7 @@ if (is_array($_SESSION['module_'.$id_module])) {
|
||||
if ($field_value != '') {
|
||||
$field_name = str_replace('search_', '', $field_name);
|
||||
$field_name = str_replace('__', ' ', $field_name);
|
||||
$field_name = str_replace('-', ' ', $field_name);
|
||||
$field_name = str_replace('-', ' ', $field_name);
|
||||
array_push($search_filters, '`'.$field_name.'` LIKE "%'.$field_value.'%"');
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +1,21 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
|
||||
// Script per aggiornare le date dei movimenti con le date dei documenti
|
||||
|
||||
$rs = $dbo->fetchArray("SELECT * FROM mg_movimenti");
|
||||
$rs = $dbo->fetchArray('SELECT * FROM mg_movimenti');
|
||||
|
||||
for($i=0;$i<sizeof($rs);$i++){
|
||||
if($rs[$i]['idintervento']!=''){
|
||||
for ($i = 0; $i < sizeof($rs); ++$i) {
|
||||
if ($rs[$i]['idintervento'] != '') {
|
||||
$rs_data = $dbo->fetchArray("SELECT IFNULL(MAX(orario_fine), data_richiesta) AS data FROM in_interventi LEFT JOIN in_interventi_tecnici ON in_interventi.id=in_interventi_tecnici.idintervento WHERE in_interventi.id='".$rs[$i]['idintervento']."'");
|
||||
$data = $rs_data[0]['data'];
|
||||
$dbo->query("UPDATE mg_movimenti SET data='".$data."' WHERE id='".$rs[$i]['id']."'");
|
||||
}
|
||||
else if($rs[$i]['idddt']!='0'){
|
||||
} elseif ($rs[$i]['idddt'] != '0') {
|
||||
$rs_data = $dbo->fetchArray("SELECT data FROM dt_ddt WHERE id='".$rs[$i]['idddt']."'");
|
||||
$data = $rs_data[0]['data'];
|
||||
$dbo->query("UPDATE mg_movimenti SET data='".$data."' WHERE id='".$rs[$i]['id']."'");
|
||||
}
|
||||
else if($rs[$i]['iddocumento']!='0'){
|
||||
} elseif ($rs[$i]['iddocumento'] != '0') {
|
||||
$rs_data = $dbo->fetchArray("SELECT data FROM co_documenti WHERE id='".$rs[$i]['iddocumento']."'");
|
||||
$data = $rs_data[0]['data'];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user