mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-06-05 22:09:38 +02:00
Sostituzione della funzione get_next_code
This commit is contained in:
@@ -1029,6 +1029,7 @@ function filelist_and_upload($id_module, $id_record, $label = 'Nuovo allegato:',
|
|||||||
*
|
*
|
||||||
* @param unknown $path
|
* @param unknown $path
|
||||||
*
|
*
|
||||||
|
* @deprecated 2.3
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function deltree($path)
|
function deltree($path)
|
||||||
@@ -1058,6 +1059,7 @@ function deltree($path)
|
|||||||
/**
|
/**
|
||||||
* Carica gli script JavaScript inclusi nell'array indicato.
|
* Carica gli script JavaScript inclusi nell'array indicato.
|
||||||
*
|
*
|
||||||
|
* @deprecated 2.3
|
||||||
* @param array $jscript_modules_array
|
* @param array $jscript_modules_array
|
||||||
*/
|
*/
|
||||||
function loadJscriptModules($array)
|
function loadJscriptModules($array)
|
||||||
@@ -1077,6 +1079,7 @@ function loadJscriptModules($array)
|
|||||||
/**
|
/**
|
||||||
* Carica i file di stile CSS inclusi nell'array indicato.
|
* Carica i file di stile CSS inclusi nell'array indicato.
|
||||||
*
|
*
|
||||||
|
* @deprecated 2.3
|
||||||
* @param array $css_modules_array
|
* @param array $css_modules_array
|
||||||
*/
|
*/
|
||||||
function loadCSSModules($array)
|
function loadCSSModules($array)
|
||||||
@@ -1097,3 +1100,19 @@ function loadCSSModules($array)
|
|||||||
|
|
||||||
echo $result;
|
echo $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Individua il codice successivo.
|
||||||
|
*
|
||||||
|
* @deprecated 2.4
|
||||||
|
*
|
||||||
|
* @param string $str
|
||||||
|
* @param int $qty
|
||||||
|
* @param string $mask
|
||||||
|
*/
|
||||||
|
function get_next_code($str, $qty = 1, $mask = '')
|
||||||
|
{
|
||||||
|
trigger_error(tr('Funzione deprecata!'), E_USER_DEPRECATED);
|
||||||
|
|
||||||
|
return Util\Generator::generate($mask, $str, $qty);
|
||||||
|
}
|
||||||
|
@@ -337,56 +337,6 @@ function getOS()
|
|||||||
return tr('Altro');
|
return tr('Altro');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Legge una stringa presumibilmente codificata (tipo "8D001") e, se possibile, restituisce il codice successivo ("8D002").
|
|
||||||
*
|
|
||||||
* @param $str string
|
|
||||||
* Codice di partenza da incrementare
|
|
||||||
* @param $qty int
|
|
||||||
* Unità da aggiungere alla parte numerica del codice (di default incrementa di 1)
|
|
||||||
* @param $mask string
|
|
||||||
* Specifica i caratteri da sostituire con numeri nel caso di generazione di codici complessi (esempio: se un codice attuale fosse 56/D e volessi calcolare il successivo (57/D), dovrei usare una maschera. La maschera in questo caso potrebbe essere ##/D. In questo modo so che i caratteri ## vanno sostituiti da numeri e il totale di caratteri sarà 2. Quindi il primo codice non sarebbe 1/D, ma 01/D)
|
|
||||||
*/
|
|
||||||
function get_next_code($str, $qty = 1, $mask = '')
|
|
||||||
{
|
|
||||||
// Se è il primo codice che sto inserendo sostituisco gli zeri al carattere jolly #
|
|
||||||
if ($str == '') {
|
|
||||||
$str = str_replace('#', '0', $mask);
|
|
||||||
}
|
|
||||||
// Se non uso una maschera, estraggo l'ultima parte numerica a destra della stringa e la incremento
|
|
||||||
if ($mask == '') {
|
|
||||||
preg_match("/(.*?)([\d]*$)/", $str, $m);
|
|
||||||
$first_part = $m[1];
|
|
||||||
$numeric_part = $m[2];
|
|
||||||
// Se non c'è una parte numerica ritorno stringa vuota
|
|
||||||
if ($numeric_part == '') {
|
|
||||||
return '';
|
|
||||||
} else {
|
|
||||||
$pad_length = strlen($numeric_part);
|
|
||||||
$second_part = str_pad(intval($numeric_part) + $qty, $pad_length, '0', STR_PAD_LEFT);
|
|
||||||
|
|
||||||
return $first_part.$second_part;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Utilizzo della maschera
|
|
||||||
else {
|
|
||||||
// Calcolo prima parte (se c'è)
|
|
||||||
$pos1 = strpos($mask, '#');
|
|
||||||
$first_part = substr($str, 0, $pos1);
|
|
||||||
// Calcolo terza parte (se c'è)
|
|
||||||
$pos2 = strlen($str) - strpos(strrev($mask), '#');
|
|
||||||
$third_part = substr($str, $pos2, strlen($mask));
|
|
||||||
// Calcolo parte numerica
|
|
||||||
$numeric_part = substr($str, $pos1, $pos2);
|
|
||||||
$pad_length = intval(strlen($numeric_part));
|
|
||||||
$first_part_length = intval(strlen($first_part));
|
|
||||||
$third_part_length = intval(strlen($third_part));
|
|
||||||
$numeric_part = str_pad(intval($numeric_part) + intval($qty), $pad_length, '0', STR_PAD_LEFT);
|
|
||||||
// $numeric_part = str_pad( intval($numeric_part)+intval($qty), ( $pad_length - $third_part_length ), "0", STR_PAD_LEFT );
|
|
||||||
return $first_part.$numeric_part.$third_part;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verifica che il nome del file non sia già usato nella cartella inserita, nel qual caso aggiungo un suffisso.
|
* Verifica che il nome del file non sia già usato nella cartella inserita, nel qual caso aggiungo un suffisso.
|
||||||
*
|
*
|
||||||
|
@@ -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 = get_next_code($rs[0]['codice'], 1, get_var('Formato codice anagrafica'));
|
$codice = Util\Generator(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
|
||||||
|
@@ -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 = get_next_code($rs[0]['codice'], 1, get_var('Formato codice anagrafica'));
|
$codice = Util\Generator(get_var('Formato codice anagrafica'), $rs[0]['codice']);
|
||||||
|
|
||||||
// Inserisco l'anagrafica
|
// Inserisco l'anagrafica
|
||||||
$dbo->insert('an_anagrafiche', [
|
$dbo->insert('an_anagrafiche', [
|
||||||
|
@@ -78,7 +78,7 @@ switch ($resource) {
|
|||||||
$where[] = 'idarticolo='.prepare($superselect['idarticolo']);
|
$where[] = 'idarticolo='.prepare($superselect['idarticolo']);
|
||||||
|
|
||||||
foreach ($elements as $element) {
|
foreach ($elements as $element) {
|
||||||
$filter[] = 'lotto='.prepare($element).'';
|
$filter[] = 'lotto='.prepare($element);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($search)) {
|
if (!empty($search)) {
|
||||||
@@ -96,7 +96,7 @@ switch ($resource) {
|
|||||||
$where[] = 'lotto='.prepare($superselect['lotto']);
|
$where[] = 'lotto='.prepare($superselect['lotto']);
|
||||||
|
|
||||||
foreach ($elements as $element) {
|
foreach ($elements as $element) {
|
||||||
$filter[] = 'serial='.prepare($element).'';
|
$filter[] = 'serial='.prepare($element);
|
||||||
}
|
}
|
||||||
if (!empty($search)) {
|
if (!empty($search)) {
|
||||||
$search_fields[] = 'serial LIKE '.prepare('%'.$search.'%');
|
$search_fields[] = 'serial LIKE '.prepare('%'.$search.'%');
|
||||||
@@ -114,7 +114,7 @@ switch ($resource) {
|
|||||||
$where[] = 'serial='.prepare($superselect['serial']);
|
$where[] = 'serial='.prepare($superselect['serial']);
|
||||||
|
|
||||||
foreach ($elements as $element) {
|
foreach ($elements as $element) {
|
||||||
$filter[] = 'altro='.prepare($element).'';
|
$filter[] = 'altro='.prepare($element);
|
||||||
}
|
}
|
||||||
if (!empty($search)) {
|
if (!empty($search)) {
|
||||||
$search_fields[] = 'altro LIKE '.prepare('%'.$search.'%');
|
$search_fields[] = 'altro LIKE '.prepare('%'.$search.'%');
|
||||||
@@ -159,7 +159,7 @@ switch ($resource) {
|
|||||||
$query = 'SELECT valore AS id, valore AS descrizione FROM mg_unitamisura |where| ORDER BY valore';
|
$query = 'SELECT valore AS id, valore AS descrizione FROM mg_unitamisura |where| ORDER BY valore';
|
||||||
|
|
||||||
foreach ($elements as $element) {
|
foreach ($elements as $element) {
|
||||||
$filter[] = 'valore='.prepare($element).'';
|
$filter[] = 'valore='.prepare($element);
|
||||||
}
|
}
|
||||||
if (!empty($search)) {
|
if (!empty($search)) {
|
||||||
$search_fields[] = 'valore LIKE '.prepare('%'.$search.'%');
|
$search_fields[] = 'valore LIKE '.prepare('%'.$search.'%');
|
||||||
|
@@ -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 = get_next_code($rs[0]['numero'], 1, get_var('Formato codice contratti'));
|
$numero = Util\Generator(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));
|
||||||
|
@@ -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 = get_next_code($rs[0]['codice'], 1, $formato);
|
$codice = Util\Generator($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 = get_next_code($rs[0]['codice'], 1, $formato);
|
$codice = Util\Generator($formato, $rs[0]['codice']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creo intervento
|
// Creo intervento
|
||||||
|
@@ -37,7 +37,6 @@ function get_new_numerosecondarioddt($data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($formato_numero_secondario != '' && $dir == 'entrata') {
|
if ($formato_numero_secondario != '' && $dir == 'entrata') {
|
||||||
//$numero_esterno = get_next_code($numero_secondario, 1, $formato_numero_secondario);
|
|
||||||
$numero_esterno = Util\Generator::generate($formato_numero_secondario, $numero_secondario);
|
$numero_esterno = Util\Generator::generate($formato_numero_secondario, $numero_secondario);
|
||||||
} else {
|
} else {
|
||||||
$numero_esterno = '';
|
$numero_esterno = '';
|
||||||
|
@@ -201,7 +201,7 @@ if ($dir == 'uscita') {
|
|||||||
$query2 = 'SELECT id FROM co_movimenti WHERE iddocumento='.$id_record.' AND primanota=1';
|
$query2 = 'SELECT id FROM co_movimenti WHERE iddocumento='.$id_record.' AND primanota=1';
|
||||||
$n2 = $dbo->fetchNum($query2);
|
$n2 = $dbo->fetchNum($query2);
|
||||||
|
|
||||||
$query3 = 'SELECT SUM(da_pagare-pagato) AS differenza, SUM(da_pagare) FROM co_scadenziario GROUP BY iddocumento HAVING iddocumento='.$id_record.'';
|
$query3 = 'SELECT SUM(da_pagare-pagato) AS differenza, SUM(da_pagare) FROM co_scadenziario GROUP BY iddocumento HAVING iddocumento='.$id_record;
|
||||||
$rs3 = $dbo->fetchArray($query3);
|
$rs3 = $dbo->fetchArray($query3);
|
||||||
$differenza = $rs3[0]['differenza'];
|
$differenza = $rs3[0]['differenza'];
|
||||||
$da_pagare = $rs3[0]['da_pagare'];
|
$da_pagare = $rs3[0]['da_pagare'];
|
||||||
|
@@ -29,17 +29,7 @@ function get_new_numerofattura($data)
|
|||||||
|
|
||||||
$rs_ultima_fattura = $dbo->fetchArray($query);
|
$rs_ultima_fattura = $dbo->fetchArray($query);
|
||||||
|
|
||||||
//$numero = get_next_code( $rs_ultima_fattura[0]['numero'], 1, $maschera );
|
|
||||||
$numero = Util\Generator::generate($maschera, $rs_ultima_fattura[0]['numero']);
|
$numero = Util\Generator::generate($maschera, $rs_ultima_fattura[0]['numero']);
|
||||||
|
|
||||||
// sostituisco anno nella maschera
|
|
||||||
$anno = substr(date('Y', strtotime($data)), -strlen($m2[0])); // nel caso ci fosse YY
|
|
||||||
$numero = str_replace($m2[0], $anno, $numero);
|
|
||||||
|
|
||||||
/*echo $numero;
|
|
||||||
echo $maschera;
|
|
||||||
echo $query;
|
|
||||||
exit;*/
|
|
||||||
} else {
|
} else {
|
||||||
$query = "SELECT IFNULL(MAX(numero),'0') AS max_numerofattura FROM co_documenti WHERE DATE_FORMAT( data, '%Y' ) = ".prepare(date('Y', strtotime($data))).' AND idtipodocumento IN(SELECT id FROM co_tipidocumento WHERE dir = '.prepare($dir).') ORDER BY CAST(numero AS UNSIGNED) DESC LIMIT 0, 1';
|
$query = "SELECT IFNULL(MAX(numero),'0') AS max_numerofattura FROM co_documenti WHERE DATE_FORMAT( data, '%Y' ) = ".prepare(date('Y', strtotime($data))).' AND idtipodocumento IN(SELECT id FROM co_tipidocumento WHERE dir = '.prepare($dir).') ORDER BY CAST(numero AS UNSIGNED) DESC LIMIT 0, 1';
|
||||||
$rs = $dbo->fetchArray($query);
|
$rs = $dbo->fetchArray($query);
|
||||||
@@ -82,20 +72,8 @@ function get_new_numerosecondariofattura($data)
|
|||||||
|
|
||||||
$rs_ultima_fattura = $dbo->fetchArray($query);
|
$rs_ultima_fattura = $dbo->fetchArray($query);
|
||||||
|
|
||||||
//$numero_esterno = get_next_code( $rs_ultima_fattura[0]['numero_esterno'], 1, $maschera );
|
|
||||||
$numero_esterno = Util\Generator::generate($maschera, $rs_ultima_fattura[0]['numero_esterno']);
|
$numero_esterno = Util\Generator::generate($maschera, $rs_ultima_fattura[0]['numero_esterno']);
|
||||||
|
|
||||||
/*echo $id_segment."<br>";
|
|
||||||
echo $query."<br>";
|
|
||||||
echo $rs_ultima_fattura[0]['numero_esterno']."<br>";
|
|
||||||
echo $maschera."<br>";
|
|
||||||
echo $numero_esterno."<br>";
|
|
||||||
exit;*/
|
|
||||||
|
|
||||||
// sostituisco anno nella maschera
|
|
||||||
$anno = substr(date('Y', strtotime($data)), -strlen($m2[0])); // nel caso ci fosse YY
|
|
||||||
$numero_esterno = str_replace($m2[0], $anno, $numero_esterno);
|
|
||||||
|
|
||||||
return $numero_esterno;
|
return $numero_esterno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -202,7 +202,7 @@ switch (post('op')) {
|
|||||||
// Controlli sul codice
|
// Controlli sul codice
|
||||||
$count = -1;
|
$count = -1;
|
||||||
do {
|
do {
|
||||||
$new_codice = ($count < 0) ? $codice : get_next_code($codice, 1, get_var('Formato codice intervento'));
|
$new_codice = ($count < 0) ? $codice : Util\Generator(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 = get_next_code($rs[0]['codice'], 1, $formato);
|
$codice = Util\Generator($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 = get_next_code($rs[0]['codice'], 1, $formato);
|
$codice = Util\Generator($formato, $rs[0]['codice']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Informazioni di base
|
// Informazioni di base
|
||||||
@@ -412,7 +412,7 @@ switch (post('op')) {
|
|||||||
$sconto = $sconto * $qta;
|
$sconto = $sconto * $qta;
|
||||||
|
|
||||||
//Calcolo iva
|
//Calcolo iva
|
||||||
$rs_iva = $dbo->fetchArray("SELECT * FROM co_iva WHERE id=".prepare($idiva)."");
|
$rs_iva = $dbo->fetchArray('SELECT * FROM co_iva WHERE id='.prepare($idiva));
|
||||||
$desc_iva = $rs_iva[0]['descrizione'];
|
$desc_iva = $rs_iva[0]['descrizione'];
|
||||||
|
|
||||||
$iva = (($prezzo_vendita * $qta) - $sconto) * $rs_iva[0]['percentuale'] / 100;
|
$iva = (($prezzo_vendita * $qta) - $sconto) * $rs_iva[0]['percentuale'] / 100;
|
||||||
@@ -436,7 +436,7 @@ switch (post('op')) {
|
|||||||
$sconto = $sconto * $qta;
|
$sconto = $sconto * $qta;
|
||||||
|
|
||||||
//Calcolo iva
|
//Calcolo iva
|
||||||
$rs_iva = $dbo->fetchArray("SELECT * FROM co_iva WHERE id=".prepare($idiva)."");
|
$rs_iva = $dbo->fetchArray('SELECT * FROM co_iva WHERE id='.prepare($idiva));
|
||||||
$desc_iva = $rs_iva[0]['descrizione'];
|
$desc_iva = $rs_iva[0]['descrizione'];
|
||||||
|
|
||||||
$iva = (($prezzo_vendita * $qta) - $sconto) * $rs_iva[0]['percentuale'] / 100;
|
$iva = (($prezzo_vendita * $qta) - $sconto) * $rs_iva[0]['percentuale'] / 100;
|
||||||
@@ -521,7 +521,7 @@ switch (post('op')) {
|
|||||||
$prezzo_acquisto = $rsart[0]['prezzo_acquisto'];
|
$prezzo_acquisto = $rsart[0]['prezzo_acquisto'];
|
||||||
|
|
||||||
//Calcolo iva
|
//Calcolo iva
|
||||||
$rs_iva = $dbo->fetchArray("SELECT * FROM co_iva WHERE id=".prepare($idiva)."");
|
$rs_iva = $dbo->fetchArray('SELECT * FROM co_iva WHERE id='.prepare($idiva));
|
||||||
$desc_iva = $rs_iva[0]['descrizione'];
|
$desc_iva = $rs_iva[0]['descrizione'];
|
||||||
|
|
||||||
$iva = (($prezzo_vendita * $qta) - $sconto) * $rs_iva[0]['percentuale'] / 100;
|
$iva = (($prezzo_vendita * $qta) - $sconto) * $rs_iva[0]['percentuale'] / 100;
|
||||||
|
@@ -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 = get_next_code($rs[0]['codice'], 1, get_var('Formato codice intervento'));
|
$new_codice = Util\Generator(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 = get_next_code($rs[0]['codice'], 1, get_var('Formato codice intervento'));
|
$new_codice = Util\Generator(get_var('Formato codice intervento'), $rs[0]['codice']);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@@ -159,7 +159,7 @@ if (!empty($rs2)) {
|
|||||||
<div class="panel panel-'.($same ? 'default' : 'primary').'">
|
<div class="panel panel-'.($same ? 'default' : 'primary').'">
|
||||||
<div class="panel-heading'.($same ? ' mini' : '').'">
|
<div class="panel-heading'.($same ? ' mini' : '').'">
|
||||||
<h4 class="panel-title'.($same ? ' mini' : '').'">
|
<h4 class="panel-title'.($same ? ' mini' : '').'">
|
||||||
<a data-toggle="collapse" data-parent="#accordion" href="#collapse_'.$j.'">'.($same ? '<small>' : '').''.$nome_componente.' ('.$statocomponente.')'.($same ? '</small>' : '').'</a>
|
<a data-toggle="collapse" data-parent="#accordion" href="#collapse_'.$j.'">'.($same ? '<small>' : '').$nome_componente.' ('.$statocomponente.')'.($same ? '</small>' : '').'</a>
|
||||||
</h4>
|
</h4>
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
|
@@ -37,7 +37,7 @@ function get_new_numerosecondarioordine($data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($formato_numero_secondario != '' && $dir == 'entrata') {
|
if ($formato_numero_secondario != '' && $dir == 'entrata') {
|
||||||
$numero_esterno = get_next_code($numero_secondario, 1, $formato_numero_secondario);
|
$numero_esterno = Util\Generator($formato_numero_secondario, $numero_secondario);
|
||||||
} else {
|
} else {
|
||||||
$numero_esterno = '';
|
$numero_esterno = '';
|
||||||
}
|
}
|
||||||
|
@@ -23,19 +23,16 @@ switch (post('op')) {
|
|||||||
$idpagamento = $rs[0]['idpagamento'];
|
$idpagamento = $rs[0]['idpagamento'];
|
||||||
|
|
||||||
// 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 ORDER BY id DESC LIMIT 0,1");
|
|
||||||
// $numero = get_next_code( $rs[0]['numero'], 1, get_var("Formato codice preventivi") );
|
|
||||||
|
|
||||||
$numeropreventivo_template = get_var('Formato codice preventivi');
|
$numeropreventivo_template = get_var('Formato codice preventivi');
|
||||||
$numeropreventivo_template = str_replace('#', '%', $numeropreventivo_template);
|
$numeropreventivo_template = str_replace('#', '%', $numeropreventivo_template);
|
||||||
|
|
||||||
// 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 = get_next_code($rs[0]['numero'], 1, get_var('Formato codice preventivi'));
|
$numero = Util\Generator(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 = get_next_code($rs[0]['numero'], 1, get_var('Formato codice preventivi'));
|
$numero = Util\Generator(get_var('Formato codice preventivi'), $rs[0]['numero']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$idiva = get_var('Iva predefinita');
|
$idiva = get_var('Iva predefinita');
|
||||||
|
@@ -7,7 +7,7 @@ switch ($resource) {
|
|||||||
$query = 'SELECT id AS id, name AS descrizione FROM zz_smtp |where| ORDER BY name';
|
$query = 'SELECT id AS id, name AS descrizione FROM zz_smtp |where| ORDER BY name';
|
||||||
|
|
||||||
foreach ($elements as $element) {
|
foreach ($elements as $element) {
|
||||||
$filter[] = 'id = '.prepare($element).'';
|
$filter[] = 'id = '.prepare($element);
|
||||||
}
|
}
|
||||||
if (!empty($search)) {
|
if (!empty($search)) {
|
||||||
$search_fields[] = 'name LIKE '.prepare('%'.$search.'%');
|
$search_fields[] = 'name LIKE '.prepare('%'.$search.'%');
|
||||||
|
@@ -24,7 +24,7 @@ switch (post('op')) {
|
|||||||
$colore = post('colore');
|
$colore = post('colore');
|
||||||
|
|
||||||
//controllo idstatointervento che non sia duplicato
|
//controllo idstatointervento che non sia duplicato
|
||||||
if (count($dbo->fetchArray('SELECT idstatointervento FROM in_statiintervento WHERE idstatointervento='.prepare($idstatointervento).'')) > 0) {
|
if (count($dbo->fetchArray('SELECT idstatointervento FROM in_statiintervento WHERE idstatointervento='.prepare($idstatointervento))) > 0) {
|
||||||
$_SESSION['errors'][] = tr('Stato di intervento già esistente.');
|
$_SESSION['errors'][] = tr('Stato di intervento già esistente.');
|
||||||
} else {
|
} else {
|
||||||
$query = 'INSERT INTO in_statiintervento(idstatointervento, descrizione, colore) VALUES ('.prepare($idstatointervento).', '.prepare($descrizione).', '.prepare($colore).')';
|
$query = 'INSERT INTO in_statiintervento(idstatointervento, descrizione, colore) VALUES ('.prepare($idstatointervento).', '.prepare($descrizione).', '.prepare($colore).')';
|
||||||
@@ -38,7 +38,7 @@ switch (post('op')) {
|
|||||||
case 'delete':
|
case 'delete':
|
||||||
|
|
||||||
//scelgo se settare come eliminato o cancellare direttamente la riga se non è stato utilizzato negli interventi
|
//scelgo se settare come eliminato o cancellare direttamente la riga se non è stato utilizzato negli interventi
|
||||||
if (count($dbo->fetchArray('SELECT id FROM in_interventi WHERE idstatointervento='.prepare($id_record).'')) > 0) {
|
if (count($dbo->fetchArray('SELECT id FROM in_interventi WHERE idstatointervento='.prepare($id_record))) > 0) {
|
||||||
$query = 'UPDATE in_statiintervento SET deleted = 1 WHERE idstatointervento='.prepare($id_record).' AND `can_delete`=1';
|
$query = 'UPDATE in_statiintervento SET deleted = 1 WHERE idstatointervento='.prepare($id_record).' AND `can_delete`=1';
|
||||||
} else {
|
} else {
|
||||||
$query = 'DELETE FROM in_statiintervento WHERE idstatointervento='.prepare($id_record).' AND `can_delete`=1';
|
$query = 'DELETE FROM in_statiintervento WHERE idstatointervento='.prepare($id_record).' AND `can_delete`=1';
|
||||||
|
@@ -64,7 +64,7 @@ switch (post('op')) {
|
|||||||
.' costo_ore_tecnico=(SELECT costo_orario_tecnico FROM in_tipiintervento WHERE idtipointervento='.prepare(post('idtipointervento')).'), '
|
.' costo_ore_tecnico=(SELECT costo_orario_tecnico FROM in_tipiintervento WHERE idtipointervento='.prepare(post('idtipointervento')).'), '
|
||||||
.' costo_km_tecnico=(SELECT costo_km_tecnico FROM in_tipiintervento WHERE idtipointervento='.prepare(post('idtipointervento')).'), '
|
.' costo_km_tecnico=(SELECT costo_km_tecnico FROM in_tipiintervento WHERE idtipointervento='.prepare(post('idtipointervento')).'), '
|
||||||
.' costo_dirittochiamata_tecnico=(SELECT costo_diritto_chiamata_tecnico FROM in_tipiintervento WHERE idtipointervento='.prepare(post('idtipointervento')).') '
|
.' costo_dirittochiamata_tecnico=(SELECT costo_diritto_chiamata_tecnico FROM in_tipiintervento WHERE idtipointervento='.prepare(post('idtipointervento')).') '
|
||||||
.' WHERE idtecnico='.prepare(post('idtecnico')).' AND idtipointervento='.prepare(post('idtipointervento')).'');
|
.' WHERE idtecnico='.prepare(post('idtecnico')).' AND idtipointervento='.prepare(post('idtipointervento')));
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$_SESSION['infos'][] = tr('Informazioni salvate correttamente!');
|
$_SESSION['infos'][] = tr('Informazioni salvate correttamente!');
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user