Merge branch 'master' of https://github.com/devcode-it/openstamanager
This commit is contained in:
commit
45171b4b67
|
@ -27,6 +27,31 @@ class Referente extends Model
|
||||||
use SimpleModelTrait;
|
use SimpleModelTrait;
|
||||||
|
|
||||||
protected $table = 'an_referenti';
|
protected $table = 'an_referenti';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Crea un nuovo referente.
|
||||||
|
*
|
||||||
|
* @param string $nome
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
|
public static function build($idanagrafica, $nome, $idmansione, $idsede)
|
||||||
|
{
|
||||||
|
$model = new static();
|
||||||
|
|
||||||
|
|
||||||
|
$model->idanagrafica = $idanagrafica;
|
||||||
|
|
||||||
|
$model->nome = $nome;
|
||||||
|
|
||||||
|
$model->idmansione = $idmansione;
|
||||||
|
$model->idsede = $idsede;
|
||||||
|
|
||||||
|
$model->save();
|
||||||
|
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that aren't mass assignable.
|
* The attributes that aren't mass assignable.
|
||||||
|
|
|
@ -135,7 +135,7 @@ if (!empty($note_accredito)) {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<br>'.Modules::link('Fatture di vendita', $nota['id'], $text, $text);
|
<br>'.Modules::link( ($dir == 'entrata' ? 'Fatture di vendita' : 'Fatture di acquisto' ), $nota['id'], $text, $text);
|
||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
</div>';
|
</div>';
|
||||||
|
|
|
@ -34,6 +34,7 @@ switch (post('op')) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'update':
|
case 'update':
|
||||||
|
$idanagrafica = post('idanagrafica');
|
||||||
$tipo = post('tipo');
|
$tipo = post('tipo');
|
||||||
$descrizione = post('descrizione');
|
$descrizione = post('descrizione');
|
||||||
$iddocumento = post('iddocumento') ?: 0;
|
$iddocumento = post('iddocumento') ?: 0;
|
||||||
|
@ -79,6 +80,7 @@ switch (post('op')) {
|
||||||
$id_scadenza = post('id_scadenza')[$id];
|
$id_scadenza = post('id_scadenza')[$id];
|
||||||
if (!empty($id_scadenza)) {
|
if (!empty($id_scadenza)) {
|
||||||
$database->update('co_scadenziario', [
|
$database->update('co_scadenziario', [
|
||||||
|
'idanagrafica' => $idanagrafica,
|
||||||
'descrizione' => $descrizione,
|
'descrizione' => $descrizione,
|
||||||
'da_pagare' => $da_pagare,
|
'da_pagare' => $da_pagare,
|
||||||
'pagato' => $pagato,
|
'pagato' => $pagato,
|
||||||
|
|
|
@ -31,6 +31,7 @@ echo '
|
||||||
<input type="hidden" name="tipo" value="'.$record['tipo'].'">
|
<input type="hidden" name="tipo" value="'.$record['tipo'].'">
|
||||||
<input type="hidden" name="descrizione" value="'.$record['descrizione'].'">
|
<input type="hidden" name="descrizione" value="'.$record['descrizione'].'">
|
||||||
<input type="hidden" name="iddocumento" value="'.$record['iddocumento'].'">
|
<input type="hidden" name="iddocumento" value="'.$record['iddocumento'].'">
|
||||||
|
<input type="hidden" name="idanagrafica" value="'.$record['idanagrafica'].'">
|
||||||
|
|
||||||
<div class="panel panel-primary">
|
<div class="panel panel-primary">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
|
|
|
@ -474,7 +474,7 @@ $(document).ready(function() {
|
||||||
data: {
|
data: {
|
||||||
labels: months,
|
labels: months,
|
||||||
datasets: [
|
datasets: [
|
||||||
'.$dataset.'
|
'.($dataset? :'{ label: "", backgroundColor: "transparent", data: [ 0,0,0,0,0,0,0,0,0,0,0,0 ] }').'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
|
@ -549,7 +549,6 @@ INNER JOIN an_tipianagrafiche_anagrafiche ON an_anagrafiche.idanagrafica=an_tipi
|
||||||
INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica
|
INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica
|
||||||
WHERE an_tipianagrafiche.descrizione = "Cliente" AND co_tipidocumento.dir = "entrata" AND an_anagrafiche.created_at BETWEEN '.prepare($start).' AND '.prepare($end).' GROUP BY YEAR(an_anagrafiche.created_at), MONTH(an_anagrafiche.created_at) ORDER BY YEAR(an_anagrafiche.created_at) ASC, MONTH(an_anagrafiche.created_at) ASC');
|
WHERE an_tipianagrafiche.descrizione = "Cliente" AND co_tipidocumento.dir = "entrata" AND an_anagrafiche.created_at BETWEEN '.prepare($start).' AND '.prepare($end).' GROUP BY YEAR(an_anagrafiche.created_at), MONTH(an_anagrafiche.created_at) ORDER BY YEAR(an_anagrafiche.created_at) ASC, MONTH(an_anagrafiche.created_at) ASC');
|
||||||
|
|
||||||
$clienti = Stats::monthly($clienti, $start, $end);
|
|
||||||
|
|
||||||
//Random color
|
//Random color
|
||||||
$background = '#'.dechex(rand(256, 16777215));
|
$background = '#'.dechex(rand(256, 16777215));
|
||||||
|
|
|
@ -19,26 +19,30 @@
|
||||||
|
|
||||||
include_once __DIR__.'/../../core.php';
|
include_once __DIR__.'/../../core.php';
|
||||||
|
|
||||||
|
use Modules\Anagrafiche\Referente;
|
||||||
|
|
||||||
$operazione = filter('op');
|
$operazione = filter('op');
|
||||||
|
|
||||||
switch ($operazione) {
|
switch ($operazione) {
|
||||||
case 'addreferente':
|
case 'addreferente':
|
||||||
if (!empty(post('nome'))) {
|
if (!empty(post('nome'))) {
|
||||||
$opt_out_newsletter = post('disable_newsletter');
|
|
||||||
|
|
||||||
$dbo->insert('an_referenti', [
|
$nome = post('nome');
|
||||||
'idanagrafica' => $id_parent,
|
$idmansione = post('idmansione');
|
||||||
'nome' => post('nome'),
|
$idsede = post('idsede');
|
||||||
'idmansione' => post('idmansione'),
|
$opt_out_newsletter = post('disable_newsletter');
|
||||||
'telefono' => post('telefono'),
|
|
||||||
'email' => post('email'),
|
$referente = Referente::build($id_parent, $nome, $idmansione, $idsede);
|
||||||
'idsede' => post('idsede'),
|
$id_record = $referente->id;
|
||||||
'enable_newsletter' => empty($opt_out_newsletter),
|
|
||||||
]);
|
$referente->telefono = post('telefono');
|
||||||
$id_record = $dbo->lastInsertedID();
|
$referente->email = post('email');
|
||||||
|
$referente->enable_newsletter = empty($opt_out_newsletter);
|
||||||
|
|
||||||
|
$referente->save();
|
||||||
|
|
||||||
if (isAjaxRequest() && !empty($id_record)) {
|
if (isAjaxRequest() && !empty($id_record)) {
|
||||||
echo json_encode(['id' => $id_record, 'text' => post('nome')]);
|
echo json_encode(['id' => $id_record, 'text' => $referente->nome]);
|
||||||
}
|
}
|
||||||
|
|
||||||
flash()->info(tr('Aggiunto nuovo referente!'));
|
flash()->info(tr('Aggiunto nuovo referente!'));
|
||||||
|
|
Loading…
Reference in New Issue