1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-06-05 22:09:38 +02:00
This commit is contained in:
Thomas Zilio
2018-03-25 19:10:49 +02:00
parent 3db010e53f
commit 3d77d5a45a
8 changed files with 13 additions and 13 deletions

View File

@@ -151,7 +151,7 @@ switch (post('op')) {
// Inserimento anagrafica base // Inserimento anagrafica base
// Leggo l'ultimo codice anagrafica per calcolare il successivo // Leggo l'ultimo codice anagrafica per calcolare il successivo
$rs = $dbo->fetchArray('SELECT codice FROM an_anagrafiche ORDER BY CAST(codice AS SIGNED) DESC LIMIT 0, 1'); $rs = $dbo->fetchArray('SELECT codice FROM an_anagrafiche ORDER BY CAST(codice AS SIGNED) DESC LIMIT 0, 1');
$codice = Util\Generator(get_var('Formato codice anagrafica'), $rs[0]['codice']); $codice = Util\Generator::generate(get_var('Formato codice anagrafica'), $rs[0]['codice']);
// Se ad aggiungere un cliente è un agente, lo imposto come agente di quel cliente // Se ad aggiungere un cliente è un agente, lo imposto come agente di quel cliente
// Lettura tipologia dell'utente loggato // Lettura tipologia dell'utente loggato

View File

@@ -3,7 +3,7 @@
switch ($resource) { switch ($resource) {
case 'add_anagrafica': case 'add_anagrafica':
$rs = $dbo->fetchArray('SELECT codice FROM an_anagrafiche ORDER BY CAST(codice AS SIGNED) DESC LIMIT 0, 1'); $rs = $dbo->fetchArray('SELECT codice FROM an_anagrafiche ORDER BY CAST(codice AS SIGNED) DESC LIMIT 0, 1');
$codice = Util\Generator(get_var('Formato codice anagrafica'), $rs[0]['codice']); $codice = Util\Generator::generate(get_var('Formato codice anagrafica'), $rs[0]['codice']);
// Inserisco l'anagrafica // Inserisco l'anagrafica
$dbo->insert('an_anagrafiche', [ $dbo->insert('an_anagrafiche', [

View File

@@ -16,7 +16,7 @@ switch (post('op')) {
// Codice contratto: calcolo il successivo in base al formato specificato // Codice contratto: calcolo il successivo in base al formato specificato
$rs = $dbo->fetchArray('SELECT numero FROM co_contratti ORDER BY id DESC LIMIT 0,1'); $rs = $dbo->fetchArray('SELECT numero FROM co_contratti ORDER BY id DESC LIMIT 0,1');
$numero = Util\Generator(get_var('Formato codice contratti'), $rs[0]['numero']); $numero = Util\Generator::generate(get_var('Formato codice contratti'), $rs[0]['numero']);
// Uso il tipo di pagamento specificato in anagrafica se c'è, altrimenti quello di default // Uso il tipo di pagamento specificato in anagrafica se c'è, altrimenti quello di default
$rsa = $dbo->fetchArray('SELECT idpagamento_vendite AS idpagamento FROM an_anagrafiche WHERE idanagrafica='.prepare($idanagrafica)); $rsa = $dbo->fetchArray('SELECT idpagamento_vendite AS idpagamento FROM an_anagrafiche WHERE idanagrafica='.prepare($idanagrafica));

View File

@@ -104,12 +104,12 @@ switch (filter('op')) {
$template = str_replace('#', '%', $formato); $template = str_replace('#', '%', $formato);
$rs = $dbo->fetchArray('SELECT codice FROM in_interventi WHERE codice=(SELECT MAX(CAST(codice AS SIGNED)) FROM in_interventi) AND codice LIKE '.prepare($template).' ORDER BY codice DESC LIMIT 0,1'); $rs = $dbo->fetchArray('SELECT codice FROM in_interventi WHERE codice=(SELECT MAX(CAST(codice AS SIGNED)) FROM in_interventi) AND codice LIKE '.prepare($template).' ORDER BY codice DESC LIMIT 0,1');
$codice = Util\Generator($formato, $rs[0]['codice']); $codice = Util\Generator::generate($formato, $rs[0]['codice']);
if (empty($codice)) { if (empty($codice)) {
$rs = $dbo->fetchArray('SELECT codice FROM in_interventi WHERE codice LIKE '.prepare($template).' ORDER BY codice DESC LIMIT 0,1'); $rs = $dbo->fetchArray('SELECT codice FROM in_interventi WHERE codice LIKE '.prepare($template).' ORDER BY codice DESC LIMIT 0,1');
$codice = Util\Generator($formato, $rs[0]['codice']); $codice = Util\Generator::generate($formato, $rs[0]['codice']);
} }
// Creo intervento // Creo intervento

View File

@@ -202,7 +202,7 @@ switch (post('op')) {
// Controlli sul codice // Controlli sul codice
$count = -1; $count = -1;
do { do {
$new_codice = ($count < 0) ? $codice : Util\Generator(get_var('Formato codice intervento'), $codice); $new_codice = ($count < 0) ? $codice : Util\Generator::generate(get_var('Formato codice intervento'), $codice);
$rs = $dbo->fetchArray('SELECT codice FROM in_interventi WHERE codice='.prepare($new_codice)); $rs = $dbo->fetchArray('SELECT codice FROM in_interventi WHERE codice='.prepare($new_codice));
++$count; ++$count;
} while (!empty($rs) || empty($new_codice)); } while (!empty($rs) || empty($new_codice));
@@ -220,12 +220,12 @@ switch (post('op')) {
$template = str_replace('#', '%', $formato); $template = str_replace('#', '%', $formato);
$rs = $dbo->fetchArray('SELECT codice FROM in_interventi WHERE codice=(SELECT MAX(CAST(codice AS SIGNED)) FROM in_interventi) AND codice LIKE '.prepare($template).' ORDER BY codice DESC LIMIT 0,1'); $rs = $dbo->fetchArray('SELECT codice FROM in_interventi WHERE codice=(SELECT MAX(CAST(codice AS SIGNED)) FROM in_interventi) AND codice LIKE '.prepare($template).' ORDER BY codice DESC LIMIT 0,1');
$codice = Util\Generator($formato, $rs[0]['codice']); $codice = Util\Generator::generate($formato, $rs[0]['codice']);
if (empty($codice)) { if (empty($codice)) {
$rs = $dbo->fetchArray('SELECT codice FROM in_interventi WHERE codice LIKE '.prepare($template).' ORDER BY codice DESC LIMIT 0,1'); $rs = $dbo->fetchArray('SELECT codice FROM in_interventi WHERE codice LIKE '.prepare($template).' ORDER BY codice DESC LIMIT 0,1');
$codice = Util\Generator($formato, $rs[0]['codice']); $codice = Util\Generator::generate($formato, $rs[0]['codice']);
} }
// Informazioni di base // Informazioni di base

View File

@@ -92,11 +92,11 @@ $idintervento_template = str_replace('#', '%', $idintervento_template);
// Calcolo codice intervento successivo // Calcolo codice intervento successivo
$rs = $dbo->fetchArray('SELECT codice FROM in_interventi WHERE codice=(SELECT MAX(CAST(codice AS SIGNED)) FROM in_interventi) AND codice LIKE '.prepare($idintervento_template).' ORDER BY codice DESC LIMIT 0,1'); $rs = $dbo->fetchArray('SELECT codice FROM in_interventi WHERE codice=(SELECT MAX(CAST(codice AS SIGNED)) FROM in_interventi) AND codice LIKE '.prepare($idintervento_template).' ORDER BY codice DESC LIMIT 0,1');
$new_codice = Util\Generator(get_var('Formato codice intervento'), $rs[0]['codice']); $new_codice = Util\Generator::generate(get_var('Formato codice intervento'), $rs[0]['codice']);
if (empty($new_codice)) { if (empty($new_codice)) {
$rs = $dbo->fetchArray('SELECT codice FROM in_interventi WHERE codice LIKE '.prepare($idintervento_template).' ORDER BY codice DESC LIMIT 0,1'); $rs = $dbo->fetchArray('SELECT codice FROM in_interventi WHERE codice LIKE '.prepare($idintervento_template).' ORDER BY codice DESC LIMIT 0,1');
$new_codice = Util\Generator(get_var('Formato codice intervento'), $rs[0]['codice']); $new_codice = Util\Generator::generate(get_var('Formato codice intervento'), $rs[0]['codice']);
} }
?> ?>

View File

@@ -37,7 +37,7 @@ function get_new_numerosecondarioordine($data)
} }
if ($formato_numero_secondario != '' && $dir == 'entrata') { if ($formato_numero_secondario != '' && $dir == 'entrata') {
$numero_esterno = Util\Generator($formato_numero_secondario, $numero_secondario); $numero_esterno = Util\Generator::generate($formato_numero_secondario, $numero_secondario);
} else { } else {
$numero_esterno = ''; $numero_esterno = '';
} }

View File

@@ -28,11 +28,11 @@ switch (post('op')) {
// Codice preventivo: calcolo il successivo in base al formato specificato // Codice preventivo: calcolo il successivo in base al formato specificato
$rs = $dbo->fetchArray('SELECT numero FROM co_preventivi WHERE numero=(SELECT MAX(CAST(numero AS SIGNED)) FROM co_preventivi) AND numero LIKE('.prepare($numeropreventivo_template).') ORDER BY numero DESC LIMIT 0,1'); $rs = $dbo->fetchArray('SELECT numero FROM co_preventivi WHERE numero=(SELECT MAX(CAST(numero AS SIGNED)) FROM co_preventivi) AND numero LIKE('.prepare($numeropreventivo_template).') ORDER BY numero DESC LIMIT 0,1');
$numero = Util\Generator(get_var('Formato codice preventivi'), $rs[0]['numero']); $numero = Util\Generator::generate(get_var('Formato codice preventivi'), $rs[0]['numero']);
if (!is_numeric($numero)) { if (!is_numeric($numero)) {
$rs = $dbo->fetchArray('SELECT numero FROM co_preventivi WHERE numero LIKE('.prepare($numeropreventivo_template).') ORDER BY numero DESC LIMIT 0,1'); $rs = $dbo->fetchArray('SELECT numero FROM co_preventivi WHERE numero LIKE('.prepare($numeropreventivo_template).') ORDER BY numero DESC LIMIT 0,1');
$numero = Util\Generator(get_var('Formato codice preventivi'), $rs[0]['numero']); $numero = Util\Generator::generate(get_var('Formato codice preventivi'), $rs[0]['numero']);
} }
$idiva = get_var('Iva predefinita'); $idiva = get_var('Iva predefinita');