2013-04-21 10:19:07 +02:00
< ? php
2016-11-28 19:30:55 +01:00
/* Copyright ( C ) 2013 Antoine Iauch < aiauch @ gpcsolutions . fr >
* Copyright ( C ) 2013 - 2016 Laurent Destailleur < eldy @ users . sourceforge . net >
* Copyright ( C ) 2015 Raphaël Doursenaud < rdoursenaud @ gpcsolutions . fr >
2013-04-21 10:19:07 +02:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 3 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program . If not , see < http :// www . gnu . org / licenses />.
*/
/**
2015-06-22 19:22:13 +02:00
* \file htdocs / compta / stats / cabyprodserv . php
* \brief Page reporting TO by Products & Services
2013-04-21 10:19:07 +02:00
*/
require '../../main.inc.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/tax.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php' ;
2017-08-31 15:44:36 +02:00
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php' ;
2013-04-21 10:19:07 +02:00
2018-05-27 09:27:09 +02:00
// Load translation files required by the page
2018-05-15 17:51:19 +02:00
$langs -> loadLangs ( array ( " products " , " categories " , " errors " , 'accountancy' ));
2013-04-21 10:19:07 +02:00
// Security pack (data & check)
$socid = GETPOST ( 'socid' , 'int' );
if ( $user -> societe_id > 0 ) $socid = $user -> societe_id ;
if ( ! empty ( $conf -> comptabilite -> enabled )) $result = restrictedArea ( $user , 'compta' , '' , '' , 'resultat' );
if ( ! empty ( $conf -> accounting -> enabled )) $result = restrictedArea ( $user , 'accounting' , '' , '' , 'comptarapport' );
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
2014-09-21 20:30:55 +02:00
$modecompta = $conf -> global -> ACCOUNTING_MODE ;
2013-04-21 10:19:07 +02:00
if ( GETPOST ( " modecompta " )) $modecompta = GETPOST ( " modecompta " );
$sortorder = isset ( $_GET [ " sortorder " ]) ? $_GET [ " sortorder " ] : $_POST [ " sortorder " ];
$sortfield = isset ( $_GET [ " sortfield " ]) ? $_GET [ " sortfield " ] : $_POST [ " sortfield " ];
if ( ! $sortorder ) $sortorder = " asc " ;
2015-06-22 19:22:13 +02:00
if ( ! $sortfield ) $sortfield = " ref " ;
2013-04-21 10:19:07 +02:00
// Category
2013-04-25 13:01:38 +02:00
$selected_cat = ( int ) GETPOST ( 'search_categ' , 'int' );
2013-04-21 10:19:07 +02:00
$subcat = false ;
if ( GETPOST ( 'subcat' , 'alpha' ) === 'yes' ) {
2015-06-22 19:22:13 +02:00
$subcat = true ;
2013-04-21 10:19:07 +02:00
}
2016-04-07 14:57:41 +02:00
// product/service
$selected_type = GETPOST ( 'search_type' , 'int' );
if ( $selected_type == '' ) $selected_type = - 1 ;
2013-04-21 10:19:07 +02:00
// Date range
$year = GETPOST ( " year " );
$month = GETPOST ( " month " );
$date_startyear = GETPOST ( " date_startyear " );
$date_startmonth = GETPOST ( " date_startmonth " );
$date_startday = GETPOST ( " date_startday " );
$date_endyear = GETPOST ( " date_endyear " );
$date_endmonth = GETPOST ( " date_endmonth " );
$date_endday = GETPOST ( " date_endday " );
if ( empty ( $year ))
{
$year_current = strftime ( " %Y " , dol_now ());
$month_current = strftime ( " %m " , dol_now ());
$year_start = $year_current ;
} else {
$year_current = $year ;
$month_current = strftime ( " %m " , dol_now ());
$year_start = $year ;
}
2018-05-15 17:51:19 +02:00
$date_start = dol_mktime ( 0 , 0 , 0 , GETPOST ( " date_startmonth " ), GETPOST ( " date_startday " ), GETPOST ( " date_startyear " ));
$date_end = dol_mktime ( 23 , 59 , 59 , GETPOST ( " date_endmonth " ), GETPOST ( " date_endday " ), GETPOST ( " date_endyear " ));
2013-04-21 10:19:07 +02:00
// Quarter
if ( empty ( $date_start ) || empty ( $date_end )) // We define date_start and date_end
{
2018-05-15 17:51:19 +02:00
$q = GETPOST ( " q " , " int " );
if ( empty ( $q ))
2013-04-21 10:19:07 +02:00
{
// We define date_start and date_end
$month_start = GETPOST ( " month " ) ? GETPOST ( " month " ) : ( $conf -> global -> SOCIETE_FISCAL_MONTH_START ? ( $conf -> global -> SOCIETE_FISCAL_MONTH_START ) : 1 );
$year_end = $year_start ;
$month_end = $month_start ;
if ( ! GETPOST ( " month " )) // If month not forced
{
if ( ! GETPOST ( 'year' ) && $month_start > $month_current )
{
$year_start -- ;
$year_end -- ;
}
$month_end = $month_start - 1 ;
if ( $month_end < 1 ) $month_end = 12 ;
else $year_end ++ ;
}
$date_start = dol_get_first_day ( $year_start , $month_start , false ); $date_end = dol_get_last_day ( $year_end , $month_end , false );
}
2018-05-15 17:51:19 +02:00
else
{
if ( $q == 1 ) { $date_start = dol_get_first_day ( $year_start , 1 , false ); $date_end = dol_get_last_day ( $year_start , 3 , false ); }
if ( $q == 2 ) { $date_start = dol_get_first_day ( $year_start , 4 , false ); $date_end = dol_get_last_day ( $year_start , 6 , false ); }
if ( $q == 3 ) { $date_start = dol_get_first_day ( $year_start , 7 , false ); $date_end = dol_get_last_day ( $year_start , 9 , false ); }
if ( $q == 4 ) { $date_start = dol_get_first_day ( $year_start , 10 , false ); $date_end = dol_get_last_day ( $year_start , 12 , false ); }
}
2013-04-21 10:19:07 +02:00
} else {
// TODO We define q
}
2018-04-30 00:24:47 +02:00
// $date_start and $date_end are defined. We force $year_start and $nbofyear
$tmps = dol_getdate ( $date_start );
$year_start = $tmps [ 'year' ];
$tmpe = dol_getdate ( $date_end );
$year_end = $tmpe [ 'year' ];
$nbofyear = ( $year_end - $year_start ) + 1 ;
2013-04-21 10:19:07 +02:00
$commonparams = array ();
$commonparams [ 'modecompta' ] = $modecompta ;
$commonparams [ 'sortorder' ] = $sortorder ;
$commonparams [ 'sortfield' ] = $sortfield ;
$headerparams = array ();
$headerparams [ 'date_startyear' ] = $date_startyear ;
$headerparams [ 'date_startmonth' ] = $date_startmonth ;
$headerparams [ 'date_startday' ] = $date_startday ;
$headerparams [ 'date_endyear' ] = $date_endyear ;
$headerparams [ 'date_endmonth' ] = $date_endmonth ;
$headerparams [ 'date_endday' ] = $date_endday ;
$headerparams [ 'q' ] = $q ;
$tableparams = array ();
$tableparams [ 'search_categ' ] = $selected_cat ;
2016-04-07 14:57:41 +02:00
$tableparams [ 'search_type' ] = $selected_type ;
2013-04-21 10:19:07 +02:00
$tableparams [ 'subcat' ] = ( $subcat === true ) ? 'yes' : '' ;
// Adding common parameters
$allparams = array_merge ( $commonparams , $headerparams , $tableparams );
$headerparams = array_merge ( $commonparams , $headerparams );
$tableparams = array_merge ( $commonparams , $tableparams );
foreach ( $allparams as $key => $value ) {
2015-06-22 19:22:13 +02:00
$paramslink .= '&' . $key . '=' . $value ;
2013-04-21 10:19:07 +02:00
}
2014-11-21 23:45:56 +01:00
2013-04-21 10:19:07 +02:00
/*
* View
*/
2017-08-31 15:44:36 +02:00
2013-04-21 10:19:07 +02:00
llxHeader ();
2017-08-31 15:44:36 +02:00
2013-04-21 10:19:07 +02:00
$form = new Form ( $db );
$formother = new FormOther ( $db );
2018-06-26 11:18:31 +02:00
// TODO Report from bookkeeping not yet available, so we switch on report on business events
if ( $modecompta == " BOOKKEEPING " ) $modecompta = " CREANCES-DETTES " ;
if ( $modecompta == " BOOKKEEPINGCOLLECTED " ) $modecompta = " RECETTES-DEPENSES " ;
2013-04-21 10:19:07 +02:00
2018-06-26 11:18:31 +02:00
// Show report header
2013-04-21 10:19:07 +02:00
if ( $modecompta == " CREANCES-DETTES " ) {
2018-06-26 11:18:31 +02:00
$name = $langs -> trans ( " Turnover " ) . ', ' . $langs -> trans ( " ByProductsAndServices " );
2013-10-10 19:26:07 +02:00
$calcmode = $langs -> trans ( " CalcModeDebt " );
2018-06-26 11:18:31 +02:00
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
2013-04-21 10:19:07 +02:00
2015-06-22 19:22:13 +02:00
$description = $langs -> trans ( " RulesCADue " );
2013-04-21 10:19:07 +02:00
if ( ! empty ( $conf -> global -> FACTURE_DEPOSITS_ARE_JUST_PAYMENTS )) {
2015-06-22 19:22:13 +02:00
$description .= $langs -> trans ( " DepositsAreNotIncluded " );
2013-04-21 10:19:07 +02:00
} else {
2015-06-22 19:22:13 +02:00
$description .= $langs -> trans ( " DepositsAreIncluded " );
2013-04-21 10:19:07 +02:00
}
2017-09-05 09:43:22 +02:00
$builddate = dol_now ();
2018-06-26 11:18:31 +02:00
}
else if ( $modecompta == " RECETTES-DEPENSES " )
{
$name = $langs -> trans ( " TurnoverCollected " ) . ', ' . $langs -> trans ( " ByProductsAndServices " );
2013-10-10 19:26:07 +02:00
$calcmode = $langs -> trans ( " CalcModeEngagement " );
2018-06-26 11:18:31 +02:00
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
2013-04-21 10:19:07 +02:00
2015-06-22 19:22:13 +02:00
$description = $langs -> trans ( " RulesCAIn " );
$description .= $langs -> trans ( " DepositsAreIncluded " );
2013-04-21 10:19:07 +02:00
2017-09-05 09:43:22 +02:00
$builddate = dol_now ();
2013-04-21 10:19:07 +02:00
}
2018-06-26 11:18:31 +02:00
else if ( $modecompta == " BOOKKEEPING " )
{
}
else if ( $modecompta == " BOOKKEEPINGCOLLECTED " )
{
}
2018-05-01 10:35:12 +02:00
$period = $form -> select_date ( $date_start , 'date_start' , 0 , 0 , 0 , '' , 1 , 0 , 1 ) . ' - ' . $form -> select_date ( $date_end , 'date_end' , 0 , 0 , 0 , '' , 1 , 0 , 1 );
if ( $date_end == dol_time_plus_duree ( $date_start , 1 , 'y' ) - 1 ) $periodlink = '<a href="' . $_SERVER [ " PHP_SELF " ] . '?year=' . ( $year_start - 1 ) . '&modecompta=' . $modecompta . '">' . img_previous () . '</a> <a href="' . $_SERVER [ " PHP_SELF " ] . '?year=' . ( $year_start + 1 ) . '&modecompta=' . $modecompta . '">' . img_next () . '</a>' ;
else $periodlink = '' ;
2013-04-21 10:19:07 +02:00
2017-08-31 15:44:36 +02:00
report_header ( $name , $namelink , $period , $periodlink , $description , $builddate , $exportlink , $tableparams , $calcmode );
2013-04-21 10:19:07 +02:00
2017-08-31 15:44:36 +02:00
if ( ! empty ( $conf -> accounting -> enabled ) && $modecompta != 'BOOKKEEPING' )
2016-10-10 21:22:28 +02:00
{
2018-05-15 17:51:19 +02:00
print info_admin ( $langs -> trans ( " WarningReportNotReliable " ), 0 , 0 , 1 );
2016-10-10 21:22:28 +02:00
}
2013-04-21 10:19:07 +02:00
2017-08-31 18:29:57 +02:00
$name = array ();
2013-04-21 10:19:07 +02:00
// SQL request
$catotal = 0 ;
2016-04-28 09:10:22 +02:00
$catotal_ht = 0 ;
$qtytotal = 0 ;
2013-04-21 10:19:07 +02:00
2014-11-21 23:45:56 +01:00
if ( $modecompta == 'CREANCES-DETTES' )
2014-01-03 18:16:21 +01:00
{
2016-04-07 14:57:41 +02:00
$sql = " SELECT DISTINCT p.rowid as rowid, p.ref as ref, p.label as label, p.fk_product_type as product_type, " ;
2015-06-22 19:22:13 +02:00
$sql .= " SUM(l.total_ht) as amount, SUM(l.total_ttc) as amount_ttc, " ;
$sql .= " SUM(CASE WHEN f.type = 2 THEN -l.qty ELSE l.qty END) as qty " ;
2018-05-15 17:51:19 +02:00
$sql .= " FROM " . MAIN_DB_PREFIX . " facture as f, " . MAIN_DB_PREFIX . " facturedet as l " ;
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " product as p ON l.fk_product = p.rowid " ;
2014-11-21 23:45:56 +01:00
if ( $selected_cat === - 2 ) // Without any category
2014-01-03 18:16:21 +01:00
{
2018-05-15 17:51:19 +02:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " categorie_product as cp ON p.rowid = cp.fk_product " ;
2014-01-03 18:16:21 +01:00
}
else if ( $selected_cat ) // Into a specific category
{
2015-06-22 19:22:13 +02:00
$sql .= " , " . MAIN_DB_PREFIX . " categorie as c, " . MAIN_DB_PREFIX . " categorie_product as cp " ;
2013-04-21 10:19:07 +02:00
}
2018-05-15 17:51:19 +02:00
$sql .= " WHERE l.fk_facture = f.rowid " ;
2015-06-22 19:22:13 +02:00
$sql .= " AND f.fk_statut in (1,2) " ;
if ( ! empty ( $conf -> global -> FACTURE_DEPOSITS_ARE_JUST_PAYMENTS )) {
$sql .= " AND f.type IN (0,1,2,5) " ;
} else {
2014-11-14 16:43:49 +01:00
$sql .= " AND f.type IN (0,1,2,3,5) " ;
2015-06-22 19:22:13 +02:00
}
if ( $date_start && $date_end ) {
$sql .= " AND f.datef >= ' " . $db -> idate ( $date_start ) . " ' AND f.datef <= ' " . $db -> idate ( $date_end ) . " ' " ;
}
2016-04-07 14:57:41 +02:00
if ( $selected_type >= 0 )
{
$sql .= " AND l.product_type = " . $selected_type ;
}
2014-11-21 23:45:56 +01:00
if ( $selected_cat === - 2 ) // Without any category
2014-01-03 18:16:21 +01:00
{
2015-06-22 19:22:13 +02:00
$sql .= " AND cp.fk_product is null " ;
2014-01-03 18:16:21 +01:00
}
else if ( $selected_cat ) { // Into a specific category
2015-06-22 19:22:13 +02:00
$sql .= " AND (c.rowid = " . $selected_cat ;
if ( $subcat ) $sql .= " OR c.fk_parent = " . $selected_cat ;
$sql .= " ) " ;
2014-01-03 18:16:21 +01:00
$sql .= " AND cp.fk_categorie = c.rowid AND cp.fk_product = p.rowid " ;
}
2015-06-22 19:22:13 +02:00
$sql .= " AND f.entity = " . $conf -> entity ;
2016-04-12 09:39:48 +02:00
$sql .= " GROUP BY p.rowid, p.ref, p.label, p.fk_product_type " ;
2015-06-22 19:22:13 +02:00
$sql .= $db -> order ( $sortfield , $sortorder );
dol_syslog ( " cabyprodserv " , LOG_DEBUG );
$result = $db -> query ( $sql );
if ( $result ) {
$num = $db -> num_rows ( $result );
$i = 0 ;
while ( $i < $num ) {
$obj = $db -> fetch_object ( $result );
$amount_ht [ $obj -> rowid ] = $obj -> amount ;
$amount [ $obj -> rowid ] = $obj -> amount_ttc ;
$qty [ $obj -> rowid ] = $obj -> qty ;
$name [ $obj -> rowid ] = $obj -> ref . ' - ' . $obj -> label ;
2016-04-07 14:57:41 +02:00
$type [ $obj -> rowid ] = $obj -> product_type ;
2015-06-22 19:22:13 +02:00
$catotal_ht += $obj -> amount ;
$catotal += $obj -> amount_ttc ;
$qtytotal += $obj -> qty ;
$i ++ ;
}
} else {
dol_print_error ( $db );
}
// Show Array
2013-04-21 10:19:07 +02:00
$i = 0 ;
2015-06-22 19:22:13 +02:00
print '<form method="POST" action="' . $_SERVER [ " PHP_SELF " ] . '">' ;
// Extra parameters management
foreach ( $headerparams as $key => $value )
{
print '<input type="hidden" name="' . $key . '" value="' . $value . '">' ;
}
2016-11-28 19:30:55 +01:00
$moreforfilter = '' ;
print '<div class="div-table-responsive">' ;
print '<table class="tagtable liste' . ( $moreforfilter ? " listwithfilterbefore " : " " ) . '">' . " \n " ;
2017-08-31 15:44:36 +02:00
2015-06-22 19:22:13 +02:00
// Category filter
print '<tr class="liste_titre">' ;
print '<td>' ;
print $langs -> trans ( " Category " ) . ': ' . $formother -> select_categories ( Categorie :: TYPE_PRODUCT , $selected_cat , 'search_categ' , true );
print ' ' ;
print $langs -> trans ( " SubCats " ) . '? ' ;
print '<input type="checkbox" name="subcat" value="yes"' ;
if ( $subcat ) {
print ' checked' ;
}
2016-04-07 14:57:41 +02:00
print '>' ;
// type filter (produit/service)
print ' ' ;
print $langs -> trans ( " Type " ) . ': ' ;
$form -> select_type_of_lines ( isset ( $selected_type ) ? $selected_type :- 1 , 'search_type' , 1 , 1 , 1 );
print '</td>' ;
2017-08-31 15:44:36 +02:00
2016-04-07 14:57:41 +02:00
print '<td colspan="5" align="right">' ;
2015-06-22 19:22:13 +02:00
print '<input type="image" class="liste_titre" name="button_search" src="' . img_picto ( $langs -> trans ( " Search " ), 'search.png' , '' , '' , 1 ) . '" value="' . dol_escape_htmltag ( $langs -> trans ( " Search " )) . '" title="' . dol_escape_htmltag ( $langs -> trans ( " Search " )) . '">' ;
print '</td></tr>' ;
2017-08-31 15:44:36 +02:00
2015-06-22 19:22:13 +02:00
// Array header
print " <tr class= \" liste_titre \" > " ;
print_liste_field_titre (
$langs -> trans ( " Product " ),
$_SERVER [ " PHP_SELF " ],
" ref " ,
" " ,
$paramslink ,
" " ,
$sortfield ,
$sortorder
);
print_liste_field_titre (
$langs -> trans ( 'Quantity' ),
$_SERVER [ " PHP_SELF " ],
" qty " ,
" " ,
$paramslink ,
'align="right"' ,
$sortfield ,
$sortorder
);
print_liste_field_titre (
$langs -> trans ( " Percentage " ),
$_SERVER [ " PHP_SELF " ],
" qty " ,
" " ,
$paramslink ,
'align="right"' ,
$sortfield ,
$sortorder
);
print_liste_field_titre (
$langs -> trans ( 'AmountHT' ),
$_SERVER [ " PHP_SELF " ],
" amount " ,
" " ,
$paramslink ,
'align="right"' ,
$sortfield ,
$sortorder
);
print_liste_field_titre (
$langs -> trans ( " AmountTTC " ),
$_SERVER [ " PHP_SELF " ],
" amount_ttc " ,
" " ,
$paramslink ,
'align="right"' ,
$sortfield ,
$sortorder
);
print_liste_field_titre (
$langs -> trans ( " Percentage " ),
$_SERVER [ " PHP_SELF " ],
" amount_ttc " ,
" " ,
$paramslink ,
'align="right"' ,
$sortfield ,
$sortorder
);
print " </tr> \n " ;
if ( count ( $name )) {
foreach ( $name as $key => $value ) {
2017-08-31 15:44:36 +02:00
2017-04-14 11:22:48 +02:00
print '<tr class="oddeven">' ;
2015-06-22 19:22:13 +02:00
// Product
2018-05-15 17:51:19 +02:00
print " <td> " ;
2015-06-22 19:22:13 +02:00
$fullname = $name [ $key ];
2018-05-15 17:51:19 +02:00
if ( $key > 0 ) {
2016-04-07 14:57:41 +02:00
$linkname = '<a href="' . DOL_URL_ROOT . '/product/card.php?id=' . $key . '">' . img_object ( $langs -> trans ( " ShowProduct " ), $type [ $key ] == 0 ? 'product' : 'service' ) . ' ' . $fullname . '</a>' ;
2015-06-22 19:22:13 +02:00
} else {
$linkname = $langs -> trans ( " PaymentsNotLinkedToProduct " );
}
2018-05-15 17:51:19 +02:00
print $linkname ;
print " </td> \n " ;
2017-08-31 15:44:36 +02:00
2015-06-22 19:22:13 +02:00
// Quantity
print '<td align="right">' ;
print $qty [ $key ];
print '</td>' ;
2017-08-31 15:44:36 +02:00
2015-06-22 19:22:13 +02:00
// Percent;
print '<td align="right">' . ( $qtytotal > 0 ? round ( 100 * $qty [ $key ] / $qtytotal , 2 ) . '%' : ' ' ) . '</td>' ;
2017-08-31 15:44:36 +02:00
2015-06-22 19:22:13 +02:00
// Amount w/o VAT
print '<td align="right">' ;
/* if ( $key > 0 ) {
print '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php?productid=' . $key . '">' ;
} else {
print '<a href="#">' ;
} */
print price ( $amount_ht [ $key ]);
//print '</a>';
print '</td>' ;
2017-08-31 15:44:36 +02:00
2015-06-22 19:22:13 +02:00
// Amount with VAT
print '<td align="right">' ;
/* if ( $key > 0 ) {
print '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php?productid=' . $key . '">' ;
} else {
print '<a href="#">' ;
} */
print price ( $amount [ $key ]);
//print '</a>';
print '</td>' ;
2017-08-31 15:44:36 +02:00
2015-06-22 19:22:13 +02:00
// Percent;
print '<td align="right">' . ( $catotal > 0 ? round ( 100 * $amount [ $key ] / $catotal , 2 ) . '%' : ' ' ) . '</td>' ;
2017-08-31 15:44:36 +02:00
2015-06-22 19:22:13 +02:00
// TODO: statistics?
2017-08-31 15:44:36 +02:00
2015-06-22 19:22:13 +02:00
print " </tr> \n " ;
$i ++ ;
}
// Total
print '<tr class="liste_total">' ;
print '<td>' . $langs -> trans ( " Total " ) . '</td>' ;
2018-05-15 17:51:19 +02:00
print '<td align="right">' . $qtytotal . '</td>' ;
print '<td align="right">100%</td>' ;
2015-06-22 19:22:13 +02:00
print '<td align="right">' . price ( $catotal_ht ) . '</td>' ;
print '<td align="right">' . price ( $catotal ) . '</td>' ;
2018-05-15 17:51:19 +02:00
print '<td align="right">100%</td>' ;
2015-06-22 19:22:13 +02:00
print '</tr>' ;
$db -> free ( $result );
2013-04-21 10:19:07 +02:00
}
2015-06-22 19:22:13 +02:00
print " </table> " ;
2016-11-28 19:30:55 +01:00
print '</div>' ;
2017-08-31 15:44:36 +02:00
2015-06-22 19:22:13 +02:00
print '</form>' ;
2013-04-21 10:19:07 +02:00
} else {
2015-06-22 19:22:13 +02:00
// $modecompta != 'CREANCES-DETTES'
// "Calculation of part of each product for accountancy in this mode is not possible. When a partial payment (for example 5 euros) is done on an
// invoice with 2 product (product A for 10 euros and product B for 20 euros), what is part of paiment for product A and part of paiment for product B ?
// Because there is no way to know this, this report is not relevant.
2014-01-03 18:28:00 +01:00
print '<br>' . $langs -> trans ( " TurnoverPerProductInCommitmentAccountingNotRelevant " ) . '<br>' ;
2013-04-21 10:19:07 +02:00
}
llxFooter ();
$db -> close ();