gest366/modules/contratti/row-list-contratti.php

60 lines
1.8 KiB
PHP
Raw Permalink Normal View History

2021-02-24 20:40:04 +00:00
<?php
include_once(__DIR__."/../../core.php");
$name="Tipi di canone";
$id_contratto =$records[0]['id'];
$id_anagrafica =$records[0]['idanagrafica'];
$rs_contratto = $dbo->fetchArray("SELECT id_tipocanone FROM co_contratti WHERE id=\"".$records[0]['id']."\"");
$id_tipocontratto=$rs_contratto[0]['id_tipocanone'];
$q = "SELECT * FROM `co_contratti_tipi_righe_qta` WHERE idtipocontratto='".$rs_contratto[0]['id_tipocanone']."' ORDER BY ordine";
$rs = $dbo->fetchArray( $q );
$tot = sizeof($rs);
if( $tot>0 ){
for( $i=0; $i<$tot; $i++ ){
if( $rs[$i]['idarticolo'] != 0 ){
echo "<tr><td>\n";
echo "<a href='".$rootdir."/editor.php?id_module=".$modules_info['Articoli']['id']."&id_record=".$rs[$i]['idarticolo']."' target=\"_blank\">".nl2br( $rs[$i]['codice_articolo']."".$rs[$i]['descrizione'] )."</a>\n";
//Qta dispo
echo "<td class='text-center'>\n";
echo number_format( $rs[$i]['qta'], get_var("Cifre decimali"), ",", "." )."\n";
echo "</td>\n";
$qta_consumata=cerca_canone_qta($id_contratto,$rs[$i]['idarticolo']);
if( $qta_consumata > $rs[$i]['qta'] ){
$qta_consumata = $rs[$i]['qta'] ;
}
//Qta consumata
echo "<td class='text-center'>\n";
echo number_format( $qta_consumata, get_var("Cifre decimali"), ",", "." )."\n";
echo "</td>\n";
//Qta dispo
echo "<td class='text-center'>\n";
// echo number_format( ($rs[$i]['qta'] - $qta_consumata ), get_var("Cifre decimali"), ",", "." )."\n";
if( ($rs[$i]['qta'] - $qta_consumata ) == 0 ){
echo "<small class='label label-danger'>ESAURITO ".$testo."</small>\n";
} else{
echo number_format( ($rs[$i]['qta'] - $qta_consumata ), get_var("Cifre decimali"), ",", "." )."\n";
}
echo "</td>\n";
echo "</td>\n";
echo "</td></tr>\n";
}
else{
}
}
}
?>