Aggiunta selezione sezionale in fase di aggiunta fattura
Aggiunto anche controllo ortografico per ckeditor
This commit is contained in:
parent
f75a8a066b
commit
dcab3c1336
5
bug.php
5
bug.php
|
@ -165,7 +165,10 @@ echo '
|
|||
var firstFocus = 1;
|
||||
|
||||
CKEDITOR.replace("body", {
|
||||
toolbar: globals.ckeditorToolbar
|
||||
toolbar: globals.ckeditorToolbar,
|
||||
language: globals.locale,
|
||||
scayt_autoStartup: true,
|
||||
scayt_sLang: globals.scayt_sLang
|
||||
});
|
||||
|
||||
CKEDITOR.instances.body.on("key", function() {
|
||||
|
|
|
@ -116,12 +116,13 @@ if (Auth::check()) {
|
|||
search: search,
|
||||
translations: translations,
|
||||
locale: \''.$lang.'\',
|
||||
scayt_sLang: \''.$lang."_".strtoupper($lang).'\',
|
||||
|
||||
start_date: \''.Translator::dateToLocale($_SESSION['period_start']).'\',
|
||||
end_date: \''.Translator::dateToLocale($_SESSION['period_end']).'\',
|
||||
|
||||
ckeditorToolbar: [
|
||||
[ "Bold", "Italic", "Underline", "Superscript", "-", "NumberedList", "BulletedList", "Outdent", "Indent", "Blockquote", "-", "Format"],
|
||||
["Undo","Redo","-","Cut","Copy","Paste","PasteText","PasteFromWord","-","Scayt", "-","Link","Unlink","-","Bold","Italic","Underline","Superscript","SpecialChar","HorizontalRule","-","NumberedList","BulletedList","Outdent","Indent","Blockquote","-","Styles","Format","Image","Table", "TextColor", "BGColor" ],
|
||||
],
|
||||
};
|
||||
</script>';
|
||||
|
|
6
mail.php
6
mail.php
|
@ -129,7 +129,11 @@ echo '
|
|||
});
|
||||
|
||||
CKEDITOR.replace("body", {
|
||||
toolbar: globals.ckeditorToolbar
|
||||
toolbar: globals.ckeditorToolbar,
|
||||
language: globals.locale,
|
||||
scayt_autoStartup: true,
|
||||
scayt_sLang: globals.scayt_sLang
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -130,7 +130,11 @@ if (sizeof($variables) > 0) {
|
|||
<script>
|
||||
$(document).ready(function(){
|
||||
CKEDITOR.replace("body", {
|
||||
toolbar: globals.ckeditorToolbar
|
||||
toolbar: globals.ckeditorToolbar,
|
||||
language: globals.locale,
|
||||
scayt_autoStartup: true,
|
||||
scayt_sLang: globals.scayt_sLang
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -19,17 +19,44 @@ if ($module['name'] == 'Fatture di vendita') {
|
|||
<input type="hidden" name="dir" value="<?php echo $dir; ?>">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "date", "label": "<?php echo tr('Data'); ?>", "name": "data", "required": 1, "value": "-now-" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "<?php echo $tipo_anagrafica; ?>", "name": "idanagrafica", "required": 1, "values": "query=SELECT an_anagrafiche.idanagrafica AS id, 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='<?php echo $tipo_anagrafica; ?>' AND deleted=0 ORDER BY ragione_sociale", "value": "<?php echo $idanagrafica; ?>", "icon-after": "add|<?php echo Modules::get('Anagrafiche')['id']; ?>|tipoanagrafica=<?php echo $tipo_anagrafica; ?>" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "<?php echo tr('Tipo fattura'); ?>", "name": "idtipodocumento", "required": 1, "values": "query=SELECT id, descrizione FROM co_tipidocumento WHERE dir='<?php echo $dir; ?>'", "value": "" ]}
|
||||
</div>
|
||||
<?php
|
||||
if( $dir == "entrata" ){
|
||||
|
||||
if (isset($_SESSION[$dir]['idsezionale'])){
|
||||
$idsezionale_default = $_SESSION[$dir]['idsezionale'];
|
||||
}
|
||||
else{
|
||||
|
||||
(!empty($_SESSION['idsezionale'])) ? $idsezionale_default = $_SESSION['idsezionale'] :$idsezionale_default = get_var("Sezionale predefinito fatture di vendita");
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "<?php echo tr('Sezionale'); ?>", "name": "idsezionale", "required": 1, "class": "", "values": "query=SELECT id, nome AS descrizione FROM co_sezionali WHERE dir='entrata' ORDER BY nome", "value": "<?= $idsezionale_default ?>", "extra": "" ]}
|
||||
</div>
|
||||
<?php
|
||||
}else{
|
||||
?>
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "<?php echo tr('Numero fattura del fornitore'); ?>", "name": "numero_esterno", "required": 1, "class": "", "value": "", "extra": "" ]}
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<!-- PULSANTI -->
|
||||
|
|
|
@ -24,25 +24,45 @@ function get_new_numerosecondariofattura($data)
|
|||
global $dbo;
|
||||
global $dir;
|
||||
global $idtipodocumento;
|
||||
global $idsezionale;
|
||||
|
||||
// DATE_FORMAT( data, '%Y' ) = '".date("Y", strtotime($data))."'
|
||||
$query = "SELECT numero_esterno 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_esterno AS UNSIGNED) DESC LIMIT 0,1';
|
||||
$rs = $dbo->fetchArray($query);
|
||||
$numero_secondario = $rs[0]['numero_esterno'];
|
||||
// recupero maschera per questo sezionale
|
||||
$maschera = $dbo->fetchArray("SELECT * FROM co_sezionali WHERE id='".$idsezionale."'");
|
||||
// esempio: ####YYYY
|
||||
$numero_esterno = $maschera[0]['maschera'];
|
||||
|
||||
// Calcolo il numero secondario se stabilito dalle impostazioni e se documento di vendita
|
||||
$formato_numero_secondario = get_var('Formato numero secondario fattura');
|
||||
// estraggo blocchi di caratteri standard da sostituire
|
||||
preg_match('/[#]+/', $numero_esterno, $m1 );
|
||||
preg_match('/[Y]+/', $numero_esterno, $m2 );
|
||||
|
||||
if ($numero_secondario == '') {
|
||||
$numero_secondario = $formato_numero_secondario;
|
||||
}
|
||||
// potrei inserire una fattura per l'anno scorso, quindi recupero l'anno dalla data impostata
|
||||
$anno = substr( $data, 0, 4); // questo valore serve nella query
|
||||
|
||||
if ($formato_numero_secondario != '' && $dir == 'entrata') {
|
||||
$numero_esterno = get_next_code($numero_secondario, 1, $formato_numero_secondario);
|
||||
} else {
|
||||
$numero_esterno = '';
|
||||
}
|
||||
// recupero ultimo numero di fattura per questo sezionale (idtipodocumento va considerato o no?)
|
||||
//AND idtipodocumento IN (SELECT id FROM co_tipidocumento WHERE dir = '".$dir."')
|
||||
$query = "SELECT numero_esterno FROM co_documenti WHERE DATE_FORMAT(data,'%Y')='".$anno."' AND idsezionale='".$idsezionale."' ";
|
||||
// Marzo 2017
|
||||
// nel caso ci fossero lettere prima della maschera ### per il numero (es. FT-0001-2017)
|
||||
// è necessario l'ordinamento alfabetico "ORDER BY numero_esterno" altrimenti
|
||||
// nel caso di maschere del tipo 001-2017 è necessario l'ordinamento numerico "ORDER BY CAST(numero_esterno AS UNSIGNED)"
|
||||
$pos1 = strpos( $numero_esterno, $m1[0] );
|
||||
if( $pos1==0 ):
|
||||
$query .= " ORDER BY CAST(numero_esterno AS UNSIGNED) DESC LIMIT 0,1";
|
||||
else:
|
||||
$query .= " ORDER BY numero_esterno DESC LIMIT 0,1";
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
$ultima_fattura = $dbo->fetchArray( $query );
|
||||
|
||||
$numero_esterno = get_next_code( $ultima_fattura[0]['numero_esterno'], 1, $numero_esterno );
|
||||
|
||||
// sostituisco anno nella maschera
|
||||
$anno_ = substr( $anno, -strlen($m2[0]) ); // nel caso ci fosse YY
|
||||
$numero_esterno = str_replace( $m2[0], $anno_, $numero_esterno );
|
||||
|
||||
|
||||
return $numero_esterno;
|
||||
}
|
||||
|
||||
|
|
|
@ -202,7 +202,7 @@ if (!empty($rs2)) {
|
|||
</div>';
|
||||
}
|
||||
|
||||
$interventi = $dbo->fetchArray('SELECT *, (SELECT descrizione FROM in_tipiintervento WHERE idtipointervento=in_interventi.idtipointervento) AS tipo, (SELECT descrizione FROM in_statiintervento WHERE idstatointervento=in_interventi.idstatointervento) AS stato, (SELECT colore FROM in_statiintervento WHERE idstatointervento=in_interventi.idstatointervento) AS colore FROM in_interventi INNER JOIN my_componenti_interventi ON my_componenti_interventi.id_intervento=in_interventi.id WHERE id_componente='.prepare($rs2[$j]['id']).' ORDER BY id_intervento');
|
||||
$interventi = $dbo->fetchArray('SELECT *, DATE_FORMAT(data_richiesta,"%d/%m/%Y") AS data_richiesta, (SELECT descrizione FROM in_tipiintervento WHERE idtipointervento=in_interventi.idtipointervento) AS tipo, (SELECT descrizione FROM in_statiintervento WHERE idstatointervento=in_interventi.idstatointervento) AS stato, (SELECT colore FROM in_statiintervento WHERE idstatointervento=in_interventi.idstatointervento) AS colore FROM in_interventi INNER JOIN my_componenti_interventi ON my_componenti_interventi.id_intervento=in_interventi.id WHERE id_componente='.prepare($rs2[$j]['id']).' ORDER BY id_intervento');
|
||||
if ($interventi != null) {
|
||||
// Collegamento a intervento se c'è
|
||||
echo '
|
||||
|
@ -220,7 +220,7 @@ if (!empty($rs2)) {
|
|||
foreach ($interventi as $intervento) {
|
||||
echo '
|
||||
<tr bgcolor="'.$intervento['colore'].'">
|
||||
<td>'.$intervento['id_intervento'].'</td>
|
||||
<td>'.$intervento['codice'].'</td>
|
||||
<td>'.$intervento['tipo'].'</td>
|
||||
<td>'.$intervento['stato'].'</td>
|
||||
<td>'.$intervento['data_richiesta'].'</td>
|
||||
|
|
Loading…
Reference in New Issue