mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-22 14:27:42 +01:00
Formattazione codice
This commit is contained in:
parent
fc0d100d7b
commit
68ae1bd206
@ -31,7 +31,7 @@ switch (post('op')) {
|
||||
if ($dbo->fetchNum('SELECT targa FROM an_sedi WHERE targa='.prepare($targa)) == 0) {
|
||||
$dbo->insert('an_sedi', [
|
||||
'idanagrafica' => setting('Azienda predefinita'),
|
||||
'nomesede' => $nome." - ".$targa,
|
||||
'nomesede' => $nome.' - '.$targa,
|
||||
'is_automezzo' => 1,
|
||||
'targa' => $targa,
|
||||
'nome' => $nome,
|
||||
@ -59,7 +59,7 @@ switch (post('op')) {
|
||||
$data_fine = isset($data_fine) ? $data_fine : '0000-00-00';
|
||||
|
||||
// Inserisco il tecnico
|
||||
$dbo->insert('an_sedi_tecnici',[
|
||||
$dbo->insert('an_sedi_tecnici', [
|
||||
'idtecnico' => $idtecnico,
|
||||
'idsede' => $id_record,
|
||||
'data_inizio' => $data_inizio,
|
||||
@ -86,12 +86,12 @@ switch (post('op')) {
|
||||
}
|
||||
$data_fine = isset($data_fine) ? $data_fine : '0000-00-00';
|
||||
|
||||
$dbo->update('an_sedi_tecnici',[
|
||||
$dbo->update('an_sedi_tecnici', [
|
||||
'idtecnico' => $idtecnico,
|
||||
'idsede' => $id_record,
|
||||
'data_inizio' => $data_inizio,
|
||||
'data_fine' => $data_fine,
|
||||
],['id' => $idautomezzotecnico]);
|
||||
], ['id' => $idautomezzotecnico]);
|
||||
|
||||
if (!$dbo->query($query)) {
|
||||
++$errors;
|
||||
@ -122,15 +122,15 @@ switch (post('op')) {
|
||||
$qta = post('qta');
|
||||
|
||||
$articolo = Articolo::find($idarticolo);
|
||||
$automezzo = $dbo->table("an_sedi")->where('id',$id_record)->first();
|
||||
$automezzo = $dbo->table('an_sedi')->where('id', $id_record)->first();
|
||||
|
||||
// Registrazione del movimento verso la sede di destinazione
|
||||
$articolo->registra($qta, tr('Carico dal magazzino sull\'automezzo _SEDE_',['_SEDE_' => $automezzo->nomesede]), Carbon::now(), 1, [
|
||||
$articolo->registra($qta, tr('Carico dal magazzino sull\'automezzo _SEDE_', ['_SEDE_' => $automezzo->nomesede]), Carbon::now(), 1, [
|
||||
'idsede' => $id_record,
|
||||
]);
|
||||
|
||||
// Registrazione del movimento dalla sede di origine
|
||||
$articolo->registra(-$qta, tr('Scarico nel magazzino dall\'automezzo _SEDE_',['_SEDE_' => $automezzo->nomesede]), Carbon::now(), 1, [
|
||||
$articolo->registra(-$qta, tr('Scarico nel magazzino dall\'automezzo _SEDE_', ['_SEDE_' => $automezzo->nomesede]), Carbon::now(), 1, [
|
||||
'idsede' => 0,
|
||||
]);
|
||||
|
||||
@ -141,17 +141,17 @@ switch (post('op')) {
|
||||
$idarticolo = post('idarticolo');
|
||||
|
||||
$articolo = Articolo::find($idarticolo);
|
||||
$automezzo = $dbo->table("an_sedi")->where('id',$id_record)->first();
|
||||
$automezzo = $dbo->table('an_sedi')->where('id', $id_record)->first();
|
||||
|
||||
$qta = post('qta') - $dbo->fetchOne("SELECT SUM(mg_movimenti.qta) AS qta FROM mg_movimenti WHERE mg_movimenti.idarticolo=".prepare($idarticolo)." AND mg_movimenti.idsede=".prepare($id_record))['qta'];
|
||||
$qta = post('qta') - $dbo->fetchOne('SELECT SUM(mg_movimenti.qta) AS qta FROM mg_movimenti WHERE mg_movimenti.idarticolo='.prepare($idarticolo).' AND mg_movimenti.idsede='.prepare($id_record))['qta'];
|
||||
|
||||
// Registrazione del movimento verso la sede di destinazione
|
||||
$articolo->registra($qta, tr('Carico dal magazzino sull\'automezzo _SEDE_',['_SEDE_' => $automezzo->nomesede]), Carbon::now(), 1, [
|
||||
$articolo->registra($qta, tr('Carico dal magazzino sull\'automezzo _SEDE_', ['_SEDE_' => $automezzo->nomesede]), Carbon::now(), 1, [
|
||||
'idsede' => $id_record,
|
||||
]);
|
||||
|
||||
// Registrazione del movimento dalla sede di origine
|
||||
$articolo->registra(-$qta, tr('Scarico nel magazzino dall\'automezzo _SEDE_',['_SEDE_' => $automezzo->nomesede]), Carbon::now(), 1, [
|
||||
$articolo->registra(-$qta, tr('Scarico nel magazzino dall\'automezzo _SEDE_', ['_SEDE_' => $automezzo->nomesede]), Carbon::now(), 1, [
|
||||
'idsede' => 0,
|
||||
]);
|
||||
|
||||
@ -164,17 +164,17 @@ switch (post('op')) {
|
||||
$idautomezzotecnico = post('idautomezzotecnico');
|
||||
|
||||
$articolo = Articolo::find($idarticolo);
|
||||
$automezzo = $dbo->table("an_sedi")->where('id',$idautomezzotecnico)->first();
|
||||
$qta = $dbo->fetchOne("SELECT SUM(qta) AS qta FROM mg_movimenti WHERE idarticolo=".prepare($idarticolo)." AND idsede=".prepare($idautomezzotecnico))['qta'];
|
||||
$automezzo = $dbo->table('an_sedi')->where('id', $idautomezzotecnico)->first();
|
||||
$qta = $dbo->fetchOne('SELECT SUM(qta) AS qta FROM mg_movimenti WHERE idarticolo='.prepare($idarticolo).' AND idsede='.prepare($idautomezzotecnico))['qta'];
|
||||
|
||||
// Registrazione del movimento verso la sede di destinazione
|
||||
$articolo->registra($qta, tr('Carico nel magazzino dall\'automezzo _SEDE_',['_SEDE_' => $automezzo->nomesede]), Carbon::now(), 1, [
|
||||
$articolo->registra($qta, tr('Carico nel magazzino dall\'automezzo _SEDE_', ['_SEDE_' => $automezzo->nomesede]), Carbon::now(), 1, [
|
||||
'idsede' => 0,
|
||||
]);
|
||||
|
||||
// Registrazione del movimento dalla sede di origine
|
||||
$descrizione = tr('Scarico dall\'automezzo _SEDE_ nel magazzino',[
|
||||
'_SEDE_' => $automezzo->nomesede
|
||||
$descrizione = tr('Scarico dall\'automezzo _SEDE_ nel magazzino', [
|
||||
'_SEDE_' => $automezzo->nomesede,
|
||||
]);
|
||||
$articolo->registra(-$qta, $descrizione, Carbon::now(), 1, [
|
||||
'idsede' => $idautomezzotecnico,
|
||||
@ -183,7 +183,6 @@ switch (post('op')) {
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
|
||||
$dbo->query('DELETE FROM `an_sedi` WHERE `id`='.prepare($id_record));
|
||||
|
||||
flash()->info(tr('Automezzo eliminato e articoli riportati in magazzino!'));
|
||||
|
@ -4,12 +4,12 @@ include_once __DIR__.'/../../core.php';
|
||||
|
||||
$idautomezzo = get('idautomezzo');
|
||||
$idarticolo = get('idarticolo');
|
||||
$op = "addrow";
|
||||
$op = 'addrow';
|
||||
$qta = 1;
|
||||
|
||||
if( !empty($idarticolo) && !empty($idautomezzo) ){
|
||||
$qta = $dbo->fetchOne("SELECT SUM(mg_movimenti.qta) AS qta FROM mg_movimenti WHERE mg_movimenti.idarticolo=".prepare($idarticolo)." AND mg_movimenti.idsede=".prepare($idautomezzo))['qta'];
|
||||
$op = "editrow";
|
||||
if (!empty($idarticolo) && !empty($idautomezzo)) {
|
||||
$qta = $dbo->fetchOne('SELECT SUM(mg_movimenti.qta) AS qta FROM mg_movimenti WHERE mg_movimenti.idarticolo='.prepare($idarticolo).' AND mg_movimenti.idsede='.prepare($idautomezzo))['qta'];
|
||||
$op = 'editrow';
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3,8 +3,7 @@
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
// Elenco articoli caricati sull'automezzo
|
||||
$rs2 = $dbo->fetchArray("SELECT mg_movimenti.idsede AS id, mg_articoli.codice AS codice, idarticolo, SUM(mg_movimenti.qta) AS qta_automezzo, mg_articoli.qta AS qta_magazzino, mg_articoli.descrizione, mg_articoli.prezzo_vendita, (SELECT percentuale FROM co_iva WHERE id=mg_articoli.idiva_vendita) AS prciva_vendita FROM mg_movimenti INNER JOIN mg_articoli ON mg_movimenti.idarticolo=mg_articoli.id WHERE mg_movimenti.idsede=".prepare($id_record)." GROUP BY idarticolo HAVING qta_automezzo>0 ORDER BY mg_articoli.descrizione");
|
||||
|
||||
$rs2 = $dbo->fetchArray('SELECT mg_movimenti.idsede AS id, mg_articoli.codice AS codice, idarticolo, SUM(mg_movimenti.qta) AS qta_automezzo, mg_articoli.qta AS qta_magazzino, mg_articoli.descrizione, mg_articoli.prezzo_vendita, (SELECT percentuale FROM co_iva WHERE id=mg_articoli.idiva_vendita) AS prciva_vendita FROM mg_movimenti INNER JOIN mg_articoli ON mg_movimenti.idarticolo=mg_articoli.id WHERE mg_movimenti.idsede='.prepare($id_record).' GROUP BY idarticolo HAVING qta_automezzo>0 ORDER BY mg_articoli.descrizione');
|
||||
|
||||
if (!empty($rs2)) {
|
||||
echo '
|
||||
@ -17,34 +16,34 @@ if (!empty($rs2)) {
|
||||
<th width="10%"></th>
|
||||
</tr>';
|
||||
|
||||
foreach ($rs2 as $r) {
|
||||
echo '
|
||||
foreach ($rs2 as $r) {
|
||||
echo '
|
||||
<tr>';
|
||||
// Articolo
|
||||
echo '
|
||||
// Articolo
|
||||
echo '
|
||||
<td class="text-left">
|
||||
'.Modules::link('Articoli', $r['idarticolo'], $r['codice'].' - '.$r['descrizione']).'
|
||||
</td>';
|
||||
|
||||
// Quantità
|
||||
echo '
|
||||
// Quantità
|
||||
echo '
|
||||
<td class="first_cell center">
|
||||
<span><big>'.Translator::numberToLocale($r['qta_automezzo']).'</big></span><br/>
|
||||
<small>'.tr('Q.tà magazzino').': '.Translator::numberToLocale($r['qta_magazzino']).'</small><br/>
|
||||
</td>';
|
||||
|
||||
// Prezzo di vendita
|
||||
$netto = $r['prezzo_vendita'];
|
||||
$iva = $r['prezzo_vendita'] / 100 * $r['prciva_vendita'];
|
||||
echo '
|
||||
// Prezzo di vendita
|
||||
$netto = $r['prezzo_vendita'];
|
||||
$iva = $r['prezzo_vendita'] / 100 * $r['prciva_vendita'];
|
||||
echo '
|
||||
<td class="table_cell center">
|
||||
<span>'.Translator::numberToLocale($netto + $iva).' €</span><br/>
|
||||
<small>'.tr('Netto').': '.Translator::numberToLocale($netto).' €</small><br/>
|
||||
<small>'.tr('Iva').': '.Translator::numberToLocale($iva).' €</small><br/>
|
||||
</td>';
|
||||
|
||||
// Pulsanti
|
||||
echo '
|
||||
// Pulsanti
|
||||
echo '
|
||||
<td class="text-center">
|
||||
<a class="btn btn-warning btn-xs" data-href="'.$structure->fileurl('add_articolo.php').'?idautomezzo='.$id_record.'&idarticolo='.$r['idarticolo'].'" data-toggle="modal" data-title="'.tr('Aggiungi articoli').'">
|
||||
<i class="fa fa-edit"></i>
|
||||
@ -55,10 +54,10 @@ if (!empty($rs2)) {
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
$tot_articoli += $r['qta_automezzo'];
|
||||
}
|
||||
$tot_articoli += $r['qta_automezzo'];
|
||||
}
|
||||
|
||||
echo '
|
||||
echo '
|
||||
</table>
|
||||
</div>';
|
||||
} else {
|
||||
|
@ -28,27 +28,26 @@ if (!empty($rs_art)) {
|
||||
'.$r['ragione_sociale'].'
|
||||
</td>';
|
||||
|
||||
// Data di inizio
|
||||
echo '
|
||||
// Data di inizio
|
||||
echo '
|
||||
<td>
|
||||
{[ "type": "date", "name": "data_inizio['.$r['id'].']", "required": 1, "value": "'.$r['data_inizio'].'" ]}
|
||||
</td>';
|
||||
|
||||
// Data di fine
|
||||
echo '
|
||||
// Data di fine
|
||||
echo '
|
||||
<td>
|
||||
{[ "type": "date", "name": "data_fine['.$r['id'].']", "required": 1, "value": "'.$r['data_fine'].'", "min-date": "'.$r['data_inizio'].'" ]}
|
||||
</td>';
|
||||
|
||||
// Pulsanti per aggiornamento date tecnici
|
||||
echo '
|
||||
// Pulsanti per aggiornamento date tecnici
|
||||
echo '
|
||||
<td>
|
||||
<a class="btn btn-danger ask" data-backto="record-edit" data-op="deltech" data-id="'.$r['id'].'" data-msg="'.tr("Rimuovere il tecnico responsabile dell'automezzo?").'">
|
||||
<i class="fa fa-trash"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
|
@ -128,7 +128,7 @@ class CSV extends CSVImporter
|
||||
} else {
|
||||
$stato = Stato::where('descrizione', $record['stato'])->first();
|
||||
}
|
||||
|
||||
|
||||
if (empty($stato)) {
|
||||
$stato = Stato::build($record['stato']);
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ echo '
|
||||
{[ "type": "checkbox", "label": "'.tr('Opt-out per newsletter').'", "name": "disable_newsletter", "id": "disable_newsletter_m", "value": "0", "help": "'.tr("Blocco per l'invio delle email.").'" ]}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
{[ "type": "checkbox", "label": "'.tr('Automezzo').'", "name": "is_automezzo", "id": "is_automezzo", "value": "0", "help": "'.tr("Seleziona se questa sede rappresenta un automezzo.").'" ]}
|
||||
{[ "type": "checkbox", "label": "'.tr('Automezzo').'", "name": "is_automezzo", "id": "is_automezzo", "value": "0", "help": "'.tr('Seleziona se questa sede rappresenta un automezzo.').'" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -94,7 +94,7 @@ echo '
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "checkbox", "label": "'.tr('Automezzo').'", "name": "is_automezzo", "id": "is_automezzo", "value": "'.$record['is_automezzo'].'", "help": "'.tr("Seleziona se questa sede rappresenta un automezzo.").'" ]}
|
||||
{[ "type": "checkbox", "label": "'.tr('Automezzo').'", "name": "is_automezzo", "id": "is_automezzo", "value": "'.$record['is_automezzo'].'", "help": "'.tr('Seleziona se questa sede rappresenta un automezzo.').'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
|
@ -302,26 +302,26 @@ abstract class Article extends Accounting
|
||||
$id_sede = $id_sede ?: 0;
|
||||
$qta_finale = $qta_movimento;
|
||||
|
||||
if( !setting('Permetti selezione articoli con quantità minore o uguale a zero in Documenti di Vendita') && $documento->direzione == 'entrata' ){
|
||||
if (!setting('Permetti selezione articoli con quantità minore o uguale a zero in Documenti di Vendita') && $documento->direzione == 'entrata') {
|
||||
$qta_sede = Movimento::where('idarticolo', $this->articolo->id)
|
||||
->where('idsede',$id_sede)
|
||||
->where('idsede', $id_sede)
|
||||
->groupBy('idarticolo')
|
||||
->sum('qta');
|
||||
|
||||
//Se la quantità supera la giacenza in sede allora movimento solo quello che resta
|
||||
if( ($qta_sede + $qta_finale) < 0 && $qta_sede >= 0 ){
|
||||
if (($qta_sede + $qta_finale) < 0 && $qta_sede >= 0) {
|
||||
$qta_finale = -$qta_sede;
|
||||
$this->attributes['qta'] = $this->original['qta'] + abs($qta_finale);
|
||||
}
|
||||
|
||||
|
||||
// Se la quantità sede per qualche motivo è negativa correggo la quantità della riga con la differenza
|
||||
elseif($qta_sede < 0 && $this->original['qta'] >= abs($qta_sede) ){
|
||||
elseif ($qta_sede < 0 && $this->original['qta'] >= abs($qta_sede)) {
|
||||
$qta_finale = abs($qta_sede);
|
||||
$this->attributes['qta'] = $this->original['qta'] - abs($qta_sede);
|
||||
}
|
||||
|
||||
|
||||
// Se la quantità sede per qualche motivo è negativa e supera la quantià della riga azzero quest'ultima
|
||||
elseif($qta_sede < 0 && $this->original['qta'] < abs($qta_sede) ){
|
||||
elseif ($qta_sede < 0 && $this->original['qta'] < abs($qta_sede)) {
|
||||
$qta_finale = $this->original['qta'];
|
||||
$this->attributes['qta'] = 0;
|
||||
}
|
||||
|
@ -1,29 +1,28 @@
|
||||
<?php
|
||||
|
||||
echo "
|
||||
<br><br><span><big><b>CARICO SUGLI AUTOMEZZI IL ".date("d/m/Y", strtotime($dt_carico))."</b></big></span><br>";
|
||||
echo '
|
||||
<br><br><span><big><b>CARICO SUGLI AUTOMEZZI IL '.date('d/m/Y', strtotime($dt_carico)).'</b></big></span><br>';
|
||||
|
||||
$targa = "";
|
||||
$targa = '';
|
||||
$totale_qta = 0.000;
|
||||
$totale_ven = 0.00;
|
||||
for( $r=0; $r<sizeof($rs); $r++ ){
|
||||
for ($r = 0; $r < sizeof($rs); ++$r) {
|
||||
if ($targa != $rs[$r]['targa']) {
|
||||
|
||||
if ($targa != "") {
|
||||
if ($targa != '') {
|
||||
echo "
|
||||
<table cellspacing='0' style='table-layout:fixed;'>
|
||||
<col width='35'><col width='275'><col width='50'><col width='70'><col width='45'><col width='65'><col width='65'>
|
||||
<tr>
|
||||
<td class='first_cell cell-padded'>"." "."</td>
|
||||
<td class='table_cell cell-padded'>"." "."</td>
|
||||
<td class='table_cell cell-padded'>"." "."</td>
|
||||
<td class='table_cell text-right cell-padded'>".number_format( $totale_qta, 3, ",", "." )." kg</td>
|
||||
<td class='table_cell text-right cell-padded'>"." "."</td>
|
||||
<td class='table_cell text-right cell-padded'>".number_format( $totale_ven, 2, ",", "." )." €</td>
|
||||
<td class='table_cell cell-padded'>"." "."</td>
|
||||
<td class='first_cell cell-padded'>".' '."</td>
|
||||
<td class='table_cell cell-padded'>".' '."</td>
|
||||
<td class='table_cell cell-padded'>".' '."</td>
|
||||
<td class='table_cell text-right cell-padded'>".number_format($totale_qta, 3, ',', '.')." kg</td>
|
||||
<td class='table_cell text-right cell-padded'>".' '."</td>
|
||||
<td class='table_cell text-right cell-padded'>".number_format($totale_ven, 2, ',', '.')." €</td>
|
||||
<td class='table_cell cell-padded'>".' '.'</td>
|
||||
</tr>
|
||||
</table>";
|
||||
}
|
||||
</table>';
|
||||
}
|
||||
|
||||
echo "
|
||||
<br/>
|
||||
@ -31,9 +30,9 @@
|
||||
<col width='150'><col width='250'>
|
||||
<tr>
|
||||
<th bgcolor='#ffffff' class='full_cell1 cell-padded' width='150'>Targa: ".$rs[$r]['targa']."</th>
|
||||
<th bgcolor='#ffffff' class='full_cell cell-padded' width='250'>Automezzo: ".$rs[$r]['nome']."</th>
|
||||
<th bgcolor='#ffffff' class='full_cell cell-padded' width='250'>Automezzo: ".$rs[$r]['nome'].'</th>
|
||||
</tr>
|
||||
</table>";
|
||||
</table>';
|
||||
|
||||
echo "
|
||||
<table class='table table-bordered' cellspacing='0' style='table-layout:fixed;'>
|
||||
@ -51,46 +50,44 @@
|
||||
$totale_qta = 0.000;
|
||||
$totale_ven = 0.00;
|
||||
}
|
||||
echo "
|
||||
<tr>";
|
||||
$qta = number_format( $rs[$r]['qta'], 3, ",", "." )." ".$rs[$r]['um'];
|
||||
echo '
|
||||
<tr>';
|
||||
$qta = number_format($rs[$r]['qta'], 3, ',', '.').' '.$rs[$r]['um'];
|
||||
|
||||
$prz_vendita = number_format($rs[$r]['prezzo_vendita'], 2);
|
||||
$prz_vendita += ($prz_vendita /100) * $rs[$r]['iva'];
|
||||
$totv = number_format($prz_vendita,2) * $rs[$r]['qta'];
|
||||
$prz_vendita += ($prz_vendita / 100) * $rs[$r]['iva'];
|
||||
$totv = number_format($prz_vendita, 2) * $rs[$r]['qta'];
|
||||
|
||||
echo "
|
||||
<td class='first_cell cell-padded'>".$rs[$r]['codice']."</td>
|
||||
<td class='table_cell cell-padded'>".$rs[$r]['descrizione']."</td>
|
||||
<td class='table_cell cell-padded'>".$rs[$r]['subcategoria']."</td>
|
||||
<td class='table_cell text-right cell-padded'>".$qta."</td>
|
||||
<td class='table_cell text-right cell-padded'>".number_format( $prz_vendita, 2, ",", "." )." €</td>
|
||||
<td class='table_cell text-right cell-padded'>".number_format( $totv, 2, ",", "." )." €</td>
|
||||
<td class='table_cell cell-padded'>".ucfirst($rs[$r]['username'])."</td>
|
||||
</tr>";
|
||||
<td class='table_cell text-right cell-padded'>".number_format($prz_vendita, 2, ',', '.')." €</td>
|
||||
<td class='table_cell text-right cell-padded'>".number_format($totv, 2, ',', '.')." €</td>
|
||||
<td class='table_cell cell-padded'>".ucfirst($rs[$r]['username']).'</td>
|
||||
</tr>';
|
||||
|
||||
$totale_ven = $totale_ven + $totv;
|
||||
if ($rs[$r]['um']=='kg') {
|
||||
if ($rs[$r]['um'] == 'kg') {
|
||||
$totale_qta = $totale_qta + $rs[$r]['qta'];
|
||||
}
|
||||
}
|
||||
|
||||
echo "
|
||||
</table>";
|
||||
echo '
|
||||
</table>';
|
||||
|
||||
if ($targa != "") {
|
||||
if ($targa != '') {
|
||||
echo "
|
||||
<table cellspacing='0' style='table-layout:fixed;'>
|
||||
<tr>
|
||||
<td class='first_cell cell-padded'>"." "."</td>
|
||||
<td class='table_cell cell-padded'>"." "."</td>
|
||||
<td class='table_cell cell-padded'>"." "."</td>
|
||||
<td class='table_cell text-right cell-padded'>".number_format( $totale_qta, 3, ",", "." )." kg</td>
|
||||
<td class='table_cell text-right cell-padded'>"." "."</td>
|
||||
<td class='table_cell text-right cell-padded'>".number_format( $totale_ven, 2, ",", "." )." €</td>
|
||||
<td class='table_cell cell-padded'>"." "."</td>
|
||||
<td class='first_cell cell-padded'>".' '."</td>
|
||||
<td class='table_cell cell-padded'>".' '."</td>
|
||||
<td class='table_cell cell-padded'>".' '."</td>
|
||||
<td class='table_cell text-right cell-padded'>".number_format($totale_qta, 3, ',', '.')." kg</td>
|
||||
<td class='table_cell text-right cell-padded'>".' '."</td>
|
||||
<td class='table_cell text-right cell-padded'>".number_format($totale_ven, 2, ',', '.')." €</td>
|
||||
<td class='table_cell cell-padded'>".' '.'</td>
|
||||
</tr>
|
||||
</table>";
|
||||
</table>';
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -22,9 +22,9 @@ include_once __DIR__.'/../../core.php';
|
||||
$search_targa = get('search_targa');
|
||||
$search_nome = get('search_nome');
|
||||
$dt_carico = get('data_carico');
|
||||
$data_carico = strtotime(str_replace('/', '-', $dt_carico));
|
||||
$startTM = date("Y-m-d", $data_carico) . " 00:00:00";
|
||||
$endTM = date("Y-m-d", $data_carico) . " 23:59:59";
|
||||
$data_carico = strtotime(str_replace('/', '-', $dt_carico));
|
||||
$startTM = date('Y-m-d', $data_carico).' 00:00:00';
|
||||
$endTM = date('Y-m-d', $data_carico).' 23:59:59';
|
||||
|
||||
$query = "
|
||||
SELECT
|
||||
@ -50,11 +50,11 @@ $query = "
|
||||
INNER JOIN an_sedi ON mg_movimenti.idsede=an_sedi.id
|
||||
WHERE
|
||||
(mg_movimenti.idsede > 0) AND (mg_movimenti.idintervento IS NULL) AND
|
||||
((mg_movimenti.data BETWEEN ".prepare($startTM)." AND ".prepare($endTM).") AND (zz_groups.nome IN ('Titolari', 'Amministratori')))";
|
||||
((mg_movimenti.data BETWEEN ".prepare($startTM).' AND '.prepare($endTM).") AND (zz_groups.nome IN ('Titolari', 'Amministratori')))";
|
||||
|
||||
$query .= " AND (an_sedi.targa LIKE ".prepare('%'.$search_targa.'%').") AND (an_sedi.nome LIKE ".prepare('%'.$search_nome.'%').") ";
|
||||
$query .= " ORDER BY an_sedi.targa, mg_articoli.descrizione";
|
||||
$query .= ' AND (an_sedi.targa LIKE '.prepare('%'.$search_targa.'%').') AND (an_sedi.nome LIKE '.prepare('%'.$search_nome.'%').') ';
|
||||
$query .= ' ORDER BY an_sedi.targa, mg_articoli.descrizione';
|
||||
|
||||
$rs = $dbo->fetchArray($query);
|
||||
$totrows = sizeof($rs);
|
||||
$azienda = $dbo->fetchOne("SELECT * FROM an_anagrafiche WHERE idanagrafica=".prepare(setting('Azienda predefinita')));
|
||||
$azienda = $dbo->fetchOne('SELECT * FROM an_anagrafiche WHERE idanagrafica='.prepare(setting('Azienda predefinita')));
|
||||
|
@ -1,15 +1,16 @@
|
||||
<?php
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
echo "<br>";
|
||||
|
||||
$targa = "";
|
||||
for( $r=0; $r<sizeof($rs); $r++ ){
|
||||
echo '<br>';
|
||||
|
||||
$targa = '';
|
||||
for ($r = 0; $r < sizeof($rs); ++$r) {
|
||||
if ($targa != $rs[$r]['targa']) {
|
||||
if ($targa != "") {
|
||||
echo "
|
||||
if ($targa != '') {
|
||||
echo '
|
||||
</table>
|
||||
<br/>";
|
||||
<br/>';
|
||||
}
|
||||
echo "
|
||||
<table cellspacing='0' style='table-layout:fixed;'>
|
||||
@ -31,10 +32,10 @@
|
||||
</tr>";
|
||||
$targa = $rs[$r]['targa'];
|
||||
}
|
||||
echo "
|
||||
<tr>";
|
||||
|
||||
$qta = number_format( $rs[$r]['qta'], 3, ",", "." )." ".$rs[$r]['um'];
|
||||
echo '
|
||||
<tr>';
|
||||
|
||||
$qta = number_format($rs[$r]['qta'], 3, ',', '.').' '.$rs[$r]['um'];
|
||||
|
||||
echo "
|
||||
<td class='first_cell cell-padded'>".$rs[$r]['codice']."</td>
|
||||
@ -44,9 +45,7 @@
|
||||
<td class='table_cell cell-padded'></td>
|
||||
</tr>";
|
||||
}
|
||||
if ($targa != "") {
|
||||
echo "
|
||||
</table>";
|
||||
if ($targa != '') {
|
||||
echo '
|
||||
</table>';
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -19,23 +19,23 @@
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
$azienda = $dbo->fetchOne("SELECT * FROM an_anagrafiche WHERE idanagrafica=".prepare(setting('Azienda predefinita')));
|
||||
$azienda = $dbo->fetchOne('SELECT * FROM an_anagrafiche WHERE idanagrafica='.prepare(setting('Azienda predefinita')));
|
||||
|
||||
$where = [];
|
||||
$search_targa = get('search_targa');
|
||||
$search_nome = get('search_nome');
|
||||
$search_nome = get('search_nome');
|
||||
|
||||
$where[] = "movimenti.qta > 0";
|
||||
$where[] = "movimenti.qta > 0";
|
||||
if( $search_targa ){
|
||||
$where[] = "an_sedi.targa like ".prepare('%'.$search_targa.'%');
|
||||
$where[] = 'movimenti.qta > 0';
|
||||
$where[] = 'movimenti.qta > 0';
|
||||
if ($search_targa) {
|
||||
$where[] = 'an_sedi.targa like '.prepare('%'.$search_targa.'%');
|
||||
}
|
||||
if( $search_nome ){
|
||||
$where[] = "an_sedi.nome like ".prepare('%'.$search_nome.'%');
|
||||
if ($search_nome) {
|
||||
$where[] = 'an_sedi.nome like '.prepare('%'.$search_nome.'%');
|
||||
}
|
||||
|
||||
//Ciclo tra gli articoli selezionati
|
||||
$query = "
|
||||
$query = '
|
||||
SELECT
|
||||
an_sedi.targa, an_sedi.nome,
|
||||
mg_articoli.codice, mg_articoli.descrizione,
|
||||
@ -46,10 +46,9 @@ $query = "
|
||||
INNER JOIN (SELECT SUM(mg_movimenti.qta) AS qta, idarticolo, idsede FROM mg_movimenti GROUP BY idsede,idarticolo) AS movimenti ON movimenti.idsede = an_sedi.id
|
||||
INNER JOIN mg_articoli ON movimenti.idarticolo = mg_articoli.id
|
||||
WHERE
|
||||
".implode(" AND ", $where)."
|
||||
'.implode(' AND ', $where).'
|
||||
ORDER BY
|
||||
an_sedi.targa, an_sedi.descrizione";
|
||||
an_sedi.targa, an_sedi.descrizione';
|
||||
|
||||
$rs = $dbo->fetchArray($query);
|
||||
$totrows = sizeof($rs);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user