|
|
@ -1,228 +1,228 @@ |
|
|
|
<?php |
|
|
|
|
|
|
|
include ("../core.php"); |
|
|
|
|
|
|
|
|
|
|
|
function ultime_fatture(){ |
|
|
|
global $dbo; |
|
|
|
$rw = $dbo->fetchArray( "select * , co_documenti.id as id_doc from co_documenti left join an_anagrafiche on co_documenti.idanagrafica=an_anagrafiche.idanagrafica
|
|
|
|
left join co_tipidocumento on co_documenti.idtipodocumento=co_tipidocumento.id |
|
|
|
where co_tipidocumento.dir='entrata' order by co_documenti.id desc limit 0,10");
|
|
|
|
|
|
|
|
for($i = 0; $i < sizeof($rw); $i ++) { |
|
|
|
$sale_id=$rw[$i][id_doc]; |
|
|
|
$rw_tot = $dbo->fetchArray( "select SUM(subtotale - sconto + iva + rivalsainps - ritenutaacconto) as totale FROM co_righe_documenti where iddocumento = $sale_id "); |
|
|
|
$sale_number=$rw[$i]['numero']; |
|
|
|
$idanagrafica=$rw[$i]['idanagrafica']; |
|
|
|
$customer_name=$rw[$i]['ragione_sociale']; |
|
|
|
$descrizione=$rw[$i]['descrizione']; |
|
|
|
$date_added=$rw[$i]['data']; |
|
|
|
list($date,$hora)=explode(" ",$date_added); |
|
|
|
list($Y,$m,$d)=explode("-",$date); |
|
|
|
$data=$d."-".$m."-".$Y; |
|
|
|
$total=$rw_tot[0]['totale'] +$rw[$i]['bollo'] + $rw[$i]['iva_rivalsainps'] ; |
|
|
|
|
|
|
|
?>
|
|
|
|
<tr> |
|
|
|
<td><a href="editor.php?id_module=14&id_record=<?php echo $sale_id;?>"><?php echo $sale_number;?></a></td>
|
|
|
|
<td><?php echo $descrizione;?></td>
|
|
|
|
<td><?php echo $customer_name;?></td>
|
|
|
|
<td><?php echo $data;?></td>
|
|
|
|
<td class='text-right'><?php echo number_format($total,2);?></td>
|
|
|
|
</tr> |
|
|
|
<?php |
|
|
|
; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function ultime_fatture_acq(){ |
|
|
|
global $dbo; |
|
|
|
$rw = $dbo->fetchArray( "select * , co_documenti.id as id_doc from co_documenti left join an_anagrafiche on co_documenti.idanagrafica=an_anagrafiche.idanagrafica
|
|
|
|
left join co_tipidocumento on co_documenti.idtipodocumento=co_tipidocumento.id |
|
|
|
where co_tipidocumento.dir='uscita' order by co_documenti.id desc limit 0,10");
|
|
|
|
|
|
|
|
for($i = 0; $i < sizeof($rw); $i ++) { |
|
|
|
$sale_id=$rw[$i][id_doc]; |
|
|
|
$rw_tot = $dbo->fetchArray( "select SUM(subtotale - sconto + iva + rivalsainps - ritenutaacconto) as totale FROM co_righe_documenti where iddocumento = $sale_id "); |
|
|
|
$sale_number=$rw[$i]['numero']; |
|
|
|
$idanagrafica=$rw[$i]['idanagrafica']; |
|
|
|
$customer_name=$rw[$i]['ragione_sociale']; |
|
|
|
$descrizione=$rw[$i]['descrizione']; |
|
|
|
$date_added=$rw[$i]['data']; |
|
|
|
list($date,$hora)=explode(" ",$date_added); |
|
|
|
list($Y,$m,$d)=explode("-",$date); |
|
|
|
$data=$d."-".$m."-".$Y; |
|
|
|
$total=$rw_tot[0]['totale'] +$rw[$i]['bollo'] + $rw[$i]['iva_rivalsainps'] ; |
|
|
|
|
|
|
|
?>
|
|
|
|
<tr> |
|
|
|
<td><a href="editor.php?id_module=14&id_record=<?php echo $sale_id;?>"><?php echo $sale_number;?></a></td>
|
|
|
|
<td><?php echo $descrizione;?></td>
|
|
|
|
<td><?php echo $customer_name;?></td>
|
|
|
|
<td><?php echo $data;?></td>
|
|
|
|
<td class='text-right'><?php echo number_format($total,2);?></td>
|
|
|
|
</tr> |
|
|
|
<?php |
|
|
|
; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function articoli_recenti(){ |
|
|
|
global $dbo; |
|
|
|
$rw = $dbo->fetchArray( "select * from mg_articoli order by id desc limit 0, 5"); |
|
|
|
?>
|
|
|
|
<ul class="products-list product-list-in-box"> |
|
|
|
<?php |
|
|
|
|
|
|
|
$module_name1="Articoli"; |
|
|
|
$id_modulo_art=query_secca("","id","zz_modules","where name ='".$module_name1."'"); |
|
|
|
|
|
|
|
|
|
|
|
for($i = 0; $i < sizeof($rw); $i ++) { |
|
|
|
$product_id=$rw[$i]['id']; |
|
|
|
$codice= $rw[$i]['codice']; |
|
|
|
$prezzo_vendita= $rw[$i]['prezzo_vendita']; |
|
|
|
$descrizione= $rw[$i]['descrizione']; |
|
|
|
$image_path = "files/articoli/".$rw[$i]['immagine01']; |
|
|
|
if ($rw[$i]['immagine01'] == '') $image_path = "modules/pannello/icon.png"; |
|
|
|
?>
|
|
|
|
<li class="item"> |
|
|
|
<div class="product-img"> |
|
|
|
<img src="<?php echo $image_path;?>" alt="Immagine"> |
|
|
|
</div> |
|
|
|
<div class="product-info"> |
|
|
|
<a href="editor.php?id_module=<?php echo $id_modulo_art ?>&id_record=<?php echo $product_id;?>" class="product-title"><?php echo "Codice " .$codice;?> <span class="label label-info pull-right"><?php echo number_format($prezzo_vendita,2);?></span></a>
|
|
|
|
<span class="product-description"> |
|
|
|
<?php echo $descrizione;?>
|
|
|
|
</span> |
|
|
|
</div> |
|
|
|
</li><!-- /.item --> |
|
|
|
<?php |
|
|
|
} |
|
|
|
?>
|
|
|
|
</ul> |
|
|
|
<?php |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
function sum_purchases_month($month){ |
|
|
|
|
|
|
|
global $dbo; |
|
|
|
$year=date('Y'); |
|
|
|
$rw = $dbo->fetchArray( "select SUM(subtotale - co_righe_documenti.sconto + iva + co_righe_documenti.rivalsainps - co_righe_documenti.ritenutaacconto) as totale FROM co_righe_documenti
|
|
|
|
left join co_documenti on co_righe_documenti.iddocumento=co_documenti.id |
|
|
|
left join co_tipidocumento on co_documenti.idtipodocumento=co_tipidocumento.id |
|
|
|
where co_tipidocumento.dir='uscita' and co_tipidocumento.mod_sta='1' and year(co_documenti.data) = '$year' and month(co_documenti.data)= '$month'");
|
|
|
|
$rw1 = $dbo->fetchArray( "select SUM(bollo + iva_rivalsainps) as totale FROM co_documenti
|
|
|
|
left join co_tipidocumento on co_documenti.idtipodocumento=co_tipidocumento.id |
|
|
|
where co_tipidocumento.dir='uscita' and co_tipidocumento.mod_sta='1' and year(co_documenti.data) = '$year' and month(co_documenti.data)= '$month'");
|
|
|
|
echo $total=number_format($rw[0]['totale'] + $rw1[0]['totale'] ,2,'.',''); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function sum_sales_month($month){ |
|
|
|
global $dbo; |
|
|
|
$year=date('Y'); |
|
|
|
|
|
|
|
$rw = $dbo->fetchArray( "select SUM(subtotale - co_righe_documenti.sconto + iva + co_righe_documenti.rivalsainps - co_righe_documenti.ritenutaacconto) as totale FROM co_righe_documenti
|
|
|
|
left join co_documenti on co_righe_documenti.iddocumento=co_documenti.id |
|
|
|
left join co_tipidocumento on co_documenti.idtipodocumento=co_tipidocumento.id |
|
|
|
where co_tipidocumento.dir='entrata' and co_tipidocumento.mod_sta='1' and year(co_documenti.data) = '$year' and month(co_documenti.data)= '$month'");
|
|
|
|
$rw1 = $dbo->fetchArray( "select SUM(bollo + iva_rivalsainps) as totale FROM co_documenti
|
|
|
|
left join co_tipidocumento on co_documenti.idtipodocumento=co_tipidocumento.id |
|
|
|
where co_tipidocumento.dir='uscita' and co_tipidocumento.mod_sta='1' and year(co_documenti.data) = '$year' and month(co_documenti.data)= '$month'");
|
|
|
|
echo $total=number_format($rw[0]['totale'] + $rw1[0]['totale'] ,2,'.',''); |
|
|
|
} |
|
|
|
|
|
|
|
function scadenze(){ |
|
|
|
global $dbo; |
|
|
|
$year=date('Y'); |
|
|
|
$month=date('m'); |
|
|
|
$module_name1="Scadenzario"; |
|
|
|
$id_modulo_scad=query_secca("","id","zz_modules","where name ='".$module_name1."'"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$rw = $dbo->fetchArray( "SELECT * , co_tipidocumento.descrizione as des_doc
|
|
|
|
FROM (co_scadenziario INNER JOIN (((co_documenti INNER JOIN an_anagrafiche ON co_documenti.idanagrafica=an_anagrafiche.idanagrafica) |
|
|
|
INNER JOIN co_pagamenti ON co_documenti.idpagamento=co_pagamenti.id) |
|
|
|
INNER JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id) ON co_scadenziario.iddocumento=co_documenti.id) |
|
|
|
INNER JOIN co_statidocumento ON co_documenti.idstatodocumento=co_statidocumento.id HAVING 1=1 AND (ABS(`pagato`) < ABS(`da_pagare`) AND co_statidocumento.descrizione IN('Emessa','Parzialmente pagato')) |
|
|
|
and co_tipidocumento.dir='entrata' and year(scadenza) = '$year' and month(scadenza)= '$month' |
|
|
|
ORDER BY `scadenza` ASC");
|
|
|
|
for($i = 0; $i < sizeof($rw); $i ++) { |
|
|
|
$sale_id=$rw[$i][id]; |
|
|
|
$sale_number=$rw[$i]['numero']; |
|
|
|
$idanagrafica=$rw[$i]['idanagrafica']; |
|
|
|
$customer_name=$rw[$i]['ragione_sociale']; |
|
|
|
$descrizione=$rw[$i]['des_doc']; |
|
|
|
$date_added=$rw[$i]['scadenza']; |
|
|
|
list($date,$hora)=explode(" ",$date_added); |
|
|
|
list($Y,$m,$d)=explode("-",$date); |
|
|
|
$data=$d."-".$m."-".$Y; |
|
|
|
$total=$rw[$i]['da_pagare'] ; |
|
|
|
|
|
|
|
?>
|
|
|
|
<tr> |
|
|
|
<td><a href="editor.php?id_module=<?php echo $id_modulo_scad ?>&id_record=<?php echo $sale_id;?>"><?php echo $sale_number;?></a></td>
|
|
|
|
<td><?php echo $descrizione;?></td>
|
|
|
|
<td><?php echo $customer_name;?></td>
|
|
|
|
<td><?php echo $data;?></td>
|
|
|
|
<td class='text-right'><?php echo number_format($total,2);?></td>
|
|
|
|
</tr> |
|
|
|
<?php |
|
|
|
; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function scadenze_insoluti(){ |
|
|
|
global $dbo; |
|
|
|
$year=date('Y'); |
|
|
|
$month=date('m'); |
|
|
|
$data_odierna=date('Y/m/d'); |
|
|
|
$module_name1="Scadenzario"; |
|
|
|
$id_modulo_scad=query_secca("","id","zz_modules","where name ='".$module_name1."'"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$rw = $dbo->fetchArray( "SELECT * , co_tipidocumento.descrizione as des_doc
|
|
|
|
FROM (co_scadenziario INNER JOIN (((co_documenti INNER JOIN an_anagrafiche ON co_documenti.idanagrafica=an_anagrafiche.idanagrafica) |
|
|
|
INNER JOIN co_pagamenti ON co_documenti.idpagamento=co_pagamenti.id) |
|
|
|
INNER JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id) ON co_scadenziario.iddocumento=co_documenti.id) |
|
|
|
INNER JOIN co_statidocumento ON co_documenti.idstatodocumento=co_statidocumento.id HAVING 1=1 AND (ABS(`pagato`) < ABS(`da_pagare`) AND co_statidocumento.descrizione IN('Emessa','Parzialmente pagato')) |
|
|
|
and co_tipidocumento.dir='entrata' and scadenza <= '$data_odierna' |
|
|
|
ORDER BY `scadenza` ASC");
|
|
|
|
for($i = 0; $i < sizeof($rw); $i ++) { |
|
|
|
$sale_id=$rw[$i][id]; |
|
|
|
$sale_number=$rw[$i]['numero']; |
|
|
|
$idanagrafica=$rw[$i]['idanagrafica']; |
|
|
|
$customer_name=$rw[$i]['ragione_sociale']; |
|
|
|
$descrizione=$rw[$i]['des_doc']; |
|
|
|
$date_added=$rw[$i]['scadenza']; |
|
|
|
list($date,$hora)=explode(" ",$date_added); |
|
|
|
list($Y,$m,$d)=explode("-",$date); |
|
|
|
$data=$d."-".$m."-".$Y; |
|
|
|
$total=$rw[$i]['da_pagare'] ; |
|
|
|
|
|
|
|
?>
|
|
|
|
<tr> |
|
|
|
<td><a href="editor.php?id_module=<?php echo $id_modulo_scad ?>&id_record=<?php echo $sale_id;?>"><?php echo $sale_number;?></a></td>
|
|
|
|
<td><?php echo $descrizione;?></td>
|
|
|
|
<td><?php echo $customer_name;?></td>
|
|
|
|
<td><?php echo $data;?></td>
|
|
|
|
<td class='text-right'><?php echo number_format($total,2);?></td>
|
|
|
|
</tr> |
|
|
|
<?php |
|
|
|
; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?php |
|
|
|
|
|
|
|
include ("../core.php"); |
|
|
|
|
|
|
|
|
|
|
|
function ultime_fatture(){ |
|
|
|
global $dbo; |
|
|
|
$rw = $dbo->fetchArray( "select * , co_documenti.id as id_doc from co_documenti left join an_anagrafiche on co_documenti.idanagrafica=an_anagrafiche.idanagrafica
|
|
|
|
left join co_tipidocumento on co_documenti.idtipodocumento=co_tipidocumento.id |
|
|
|
where co_tipidocumento.dir='entrata' order by co_documenti.id desc limit 0,10");
|
|
|
|
|
|
|
|
for($i = 0; $i < sizeof($rw); $i ++) { |
|
|
|
$sale_id=$rw[$i][id_doc]; |
|
|
|
$rw_tot = $dbo->fetchArray( "select SUM(subtotale - sconto + iva + rivalsainps - ritenutaacconto) as totale FROM co_righe_documenti where iddocumento = $sale_id "); |
|
|
|
$sale_number=$rw[$i]['numero']; |
|
|
|
$idanagrafica=$rw[$i]['idanagrafica']; |
|
|
|
$customer_name=$rw[$i]['ragione_sociale']; |
|
|
|
$descrizione=$rw[$i]['descrizione']; |
|
|
|
$date_added=$rw[$i]['data']; |
|
|
|
list($date,$hora)=explode(" ",$date_added); |
|
|
|
list($Y,$m,$d)=explode("-",$date); |
|
|
|
$data=$d."-".$m."-".$Y; |
|
|
|
$total=$rw_tot[0]['totale'] +$rw[$i]['bollo'] + $rw[$i]['iva_rivalsainps'] ; |
|
|
|
|
|
|
|
?>
|
|
|
|
<tr> |
|
|
|
<td><a href="editor.php?id_module=14&id_record=<?php echo $sale_id;?>"><?php echo $sale_number;?></a></td>
|
|
|
|
<td><?php echo $descrizione;?></td>
|
|
|
|
<td><?php echo $customer_name;?></td>
|
|
|
|
<td><?php echo $data;?></td>
|
|
|
|
<td class='text-right'><?php echo number_format($total,2);?></td>
|
|
|
|
</tr> |
|
|
|
<?php |
|
|
|
; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function ultime_fatture_acq(){ |
|
|
|
global $dbo; |
|
|
|
$rw = $dbo->fetchArray( "select * , co_documenti.id as id_doc from co_documenti left join an_anagrafiche on co_documenti.idanagrafica=an_anagrafiche.idanagrafica
|
|
|
|
left join co_tipidocumento on co_documenti.idtipodocumento=co_tipidocumento.id |
|
|
|
where co_tipidocumento.dir='uscita' order by co_documenti.id desc limit 0,10");
|
|
|
|
|
|
|
|
for($i = 0; $i < sizeof($rw); $i ++) { |
|
|
|
$sale_id=$rw[$i][id_doc]; |
|
|
|
$rw_tot = $dbo->fetchArray( "select SUM(subtotale - sconto + iva + rivalsainps - ritenutaacconto) as totale FROM co_righe_documenti where iddocumento = $sale_id "); |
|
|
|
$sale_number=$rw[$i]['numero']; |
|
|
|
$idanagrafica=$rw[$i]['idanagrafica']; |
|
|
|
$customer_name=$rw[$i]['ragione_sociale']; |
|
|
|
$descrizione=$rw[$i]['descrizione']; |
|
|
|
$date_added=$rw[$i]['data']; |
|
|
|
list($date,$hora)=explode(" ",$date_added); |
|
|
|
list($Y,$m,$d)=explode("-",$date); |
|
|
|
$data=$d."-".$m."-".$Y; |
|
|
|
$total=$rw_tot[0]['totale'] +$rw[$i]['bollo'] + $rw[$i]['iva_rivalsainps'] ; |
|
|
|
|
|
|
|
?>
|
|
|
|
<tr> |
|
|
|
<td><a href="editor.php?id_module=14&id_record=<?php echo $sale_id;?>"><?php echo $sale_number;?></a></td>
|
|
|
|
<td><?php echo $descrizione;?></td>
|
|
|
|
<td><?php echo $customer_name;?></td>
|
|
|
|
<td><?php echo $data;?></td>
|
|
|
|
<td class='text-right'><?php echo number_format($total,2);?></td>
|
|
|
|
</tr> |
|
|
|
<?php |
|
|
|
; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function articoli_recenti(){ |
|
|
|
global $dbo; |
|
|
|
$rw = $dbo->fetchArray( "select * from mg_articoli order by id desc limit 0, 5"); |
|
|
|
?>
|
|
|
|
<ul class="products-list product-list-in-box"> |
|
|
|
<?php |
|
|
|
|
|
|
|
$module_name1="Articoli"; |
|
|
|
$id_modulo_art=query_secca("","id","zz_modules","where name ='".$module_name1."'"); |
|
|
|
|
|
|
|
|
|
|
|
for($i = 0; $i < sizeof($rw); $i ++) { |
|
|
|
$product_id=$rw[$i]['id']; |
|
|
|
$codice= $rw[$i]['codice']; |
|
|
|
$prezzo_vendita= $rw[$i]['prezzo_vendita']; |
|
|
|
$descrizione= $rw[$i]['descrizione']; |
|
|
|
$image_path = "files/articoli/".$rw[$i]['immagine01']; |
|
|
|
if ($rw[$i]['immagine01'] == '') $image_path = "modules/pannello/icon.png"; |
|
|
|
?>
|
|
|
|
<li class="item"> |
|
|
|
<div class="product-img"> |
|
|
|
<img src="<?php echo $image_path;?>" alt="Immagine"> |
|
|
|
</div> |
|
|
|
<div class="product-info"> |
|
|
|
<a href="editor.php?id_module=<?php echo $id_modulo_art ?>&id_record=<?php echo $product_id;?>" class="product-title"><?php echo "Codice " .$codice;?> <span class="label label-info pull-right"><?php echo number_format($prezzo_vendita,2);?></span></a>
|
|
|
|
<span class="product-description"> |
|
|
|
<?php echo $descrizione;?>
|
|
|
|
</span> |
|
|
|
</div> |
|
|
|
</li><!-- /.item --> |
|
|
|
<?php |
|
|
|
} |
|
|
|
?>
|
|
|
|
</ul> |
|
|
|
<?php |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
function sum_purchases_month($month){ |
|
|
|
|
|
|
|
global $dbo; |
|
|
|
$year=date('Y'); |
|
|
|
$rw = $dbo->fetchArray( "select SUM(subtotale - co_righe_documenti.sconto + iva + co_righe_documenti.rivalsainps - co_righe_documenti.ritenutaacconto) as totale FROM co_righe_documenti
|
|
|
|
left join co_documenti on co_righe_documenti.iddocumento=co_documenti.id |
|
|
|
left join co_tipidocumento on co_documenti.idtipodocumento=co_tipidocumento.id |
|
|
|
where co_tipidocumento.dir='uscita' and co_tipidocumento.mod_sta='1' and year(co_documenti.data) = '$year' and month(co_documenti.data)= '$month'");
|
|
|
|
$rw1 = $dbo->fetchArray( "select SUM(bollo + iva_rivalsainps) as totale FROM co_documenti
|
|
|
|
left join co_tipidocumento on co_documenti.idtipodocumento=co_tipidocumento.id |
|
|
|
where co_tipidocumento.dir='uscita' and co_tipidocumento.mod_sta='1' and year(co_documenti.data) = '$year' and month(co_documenti.data)= '$month'");
|
|
|
|
echo $total=number_format($rw[0]['totale'] + $rw1[0]['totale'] ,2,'.',''); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function sum_sales_month($month){ |
|
|
|
global $dbo; |
|
|
|
$year=date('Y'); |
|
|
|
|
|
|
|
$rw = $dbo->fetchArray( "select SUM(subtotale - co_righe_documenti.sconto + iva + co_righe_documenti.rivalsainps - co_righe_documenti.ritenutaacconto) as totale FROM co_righe_documenti
|
|
|
|
left join co_documenti on co_righe_documenti.iddocumento=co_documenti.id |
|
|
|
left join co_tipidocumento on co_documenti.idtipodocumento=co_tipidocumento.id |
|
|
|
where co_tipidocumento.dir='entrata' and co_tipidocumento.mod_sta='1' and year(co_documenti.data) = '$year' and month(co_documenti.data)= '$month'");
|
|
|
|
$rw1 = $dbo->fetchArray( "select SUM(bollo + iva_rivalsainps) as totale FROM co_documenti
|
|
|
|
left join co_tipidocumento on co_documenti.idtipodocumento=co_tipidocumento.id |
|
|
|
where co_tipidocumento.dir='uscita' and co_tipidocumento.mod_sta='1' and year(co_documenti.data) = '$year' and month(co_documenti.data)= '$month'");
|
|
|
|
echo $total=number_format($rw[0]['totale'] + $rw1[0]['totale'] ,2,'.',''); |
|
|
|
} |
|
|
|
|
|
|
|
function scadenze(){ |
|
|
|
global $dbo; |
|
|
|
$year=date('Y'); |
|
|
|
$month=date('m'); |
|
|
|
$module_name1="Scadenzario"; |
|
|
|
$id_modulo_scad=query_secca("","id","zz_modules","where name ='".$module_name1."'"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$rw = $dbo->fetchArray( "SELECT *, co_scadenziario.id as sid, co_tipidocumento.descrizione as des_doc
|
|
|
|
FROM (co_scadenziario INNER JOIN (((co_documenti INNER JOIN an_anagrafiche ON co_documenti.idanagrafica=an_anagrafiche.idanagrafica) |
|
|
|
INNER JOIN co_pagamenti ON co_documenti.idpagamento=co_pagamenti.id) |
|
|
|
INNER JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id) ON co_scadenziario.iddocumento=co_documenti.id) |
|
|
|
INNER JOIN co_statidocumento ON co_documenti.idstatodocumento=co_statidocumento.id HAVING 1=1 AND (ABS(`pagato`) < ABS(`da_pagare`) AND co_statidocumento.descrizione IN('Emessa','Parzialmente pagato')) |
|
|
|
and co_tipidocumento.dir='entrata' and year(scadenza) = '$year' and month(scadenza)= '$month' |
|
|
|
ORDER BY `scadenza` ASC");
|
|
|
|
for($i = 0; $i < sizeof($rw); $i ++) { |
|
|
|
$sale_id=$rw[$i]['sid']; |
|
|
|
$sale_number=$rw[$i]['numero']; |
|
|
|
$idanagrafica=$rw[$i]['idanagrafica']; |
|
|
|
$customer_name=$rw[$i]['ragione_sociale']; |
|
|
|
$descrizione=$rw[$i]['des_doc']; |
|
|
|
$date_added=$rw[$i]['scadenza']; |
|
|
|
list($date,$hora)=explode(" ",$date_added); |
|
|
|
list($Y,$m,$d)=explode("-",$date); |
|
|
|
$data=$d."-".$m."-".$Y; |
|
|
|
$total=$rw[$i]['da_pagare'] ; |
|
|
|
|
|
|
|
?>
|
|
|
|
<tr> |
|
|
|
<td><a href="editor.php?id_module=<?php echo $id_modulo_scad ?>&id_record=<?php echo $sale_id;?>"><?php echo $sale_number;?></a></td>
|
|
|
|
<td><?php echo $descrizione;?></td>
|
|
|
|
<td><?php echo $customer_name;?></td>
|
|
|
|
<td><?php echo $data;?></td>
|
|
|
|
<td class='text-right'><?php echo number_format($total,2);?></td>
|
|
|
|
</tr> |
|
|
|
<?php |
|
|
|
; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function scadenze_insoluti(){ |
|
|
|
global $dbo; |
|
|
|
$year=date('Y'); |
|
|
|
$month=date('m'); |
|
|
|
$data_odierna=date('Y/m/d'); |
|
|
|
$module_name1="Scadenzario"; |
|
|
|
$id_modulo_scad=query_secca("","id","zz_modules","where name ='".$module_name1."'"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$rw = $dbo->fetchArray( "SELECT *, co_scadenziario.id as sid, co_tipidocumento.descrizione as des_doc
|
|
|
|
FROM (co_scadenziario INNER JOIN (((co_documenti INNER JOIN an_anagrafiche ON co_documenti.idanagrafica=an_anagrafiche.idanagrafica) |
|
|
|
INNER JOIN co_pagamenti ON co_documenti.idpagamento=co_pagamenti.id) |
|
|
|
INNER JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id) ON co_scadenziario.iddocumento=co_documenti.id) |
|
|
|
INNER JOIN co_statidocumento ON co_documenti.idstatodocumento=co_statidocumento.id HAVING 1=1 AND (ABS(`pagato`) < ABS(`da_pagare`) AND co_statidocumento.descrizione IN('Emessa','Parzialmente pagato')) |
|
|
|
and co_tipidocumento.dir='entrata' and scadenza <= '$data_odierna' |
|
|
|
ORDER BY `scadenza` ASC");
|
|
|
|
for($i = 0; $i < sizeof($rw); $i ++) { |
|
|
|
$sale_id=$rw[$i]['sid']; |
|
|
|
$sale_number=$rw[$i]['numero']; |
|
|
|
$idanagrafica=$rw[$i]['idanagrafica']; |
|
|
|
$customer_name=$rw[$i]['ragione_sociale']; |
|
|
|
$descrizione=$rw[$i]['des_doc']; |
|
|
|
$date_added=$rw[$i]['scadenza']; |
|
|
|
list($date,$hora)=explode(" ",$date_added); |
|
|
|
list($Y,$m,$d)=explode("-",$date); |
|
|
|
$data=$d."-".$m."-".$Y; |
|
|
|
$total=$rw[$i]['da_pagare'] ; |
|
|
|
|
|
|
|
?>
|
|
|
|
<tr> |
|
|
|
<td><a href="editor.php?id_module=<?php echo $id_modulo_scad ?>&id_record=<?php echo $sale_id;?>"><?php echo $sale_number;?></a></td>
|
|
|
|
<td><?php echo $descrizione;?></td>
|
|
|
|
<td><?php echo $customer_name;?></td>
|
|
|
|
<td><?php echo $data;?></td>
|
|
|
|
<td class='text-right'><?php echo number_format($total,2);?></td>
|
|
|
|
</tr> |
|
|
|
<?php |
|
|
|
; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|