diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 2c1434879cb..bdc37ec7f75 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Éric Seigne + * Copyright (C) 2004 Eric Seigne * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley / Ocebo @@ -21,13 +21,12 @@ */ /** - \file htdocs/fourn/facture/paiement.php - \ingroup fournisseur,facture - \brief Paiements des factures fournisseurs - \version $Id$ + \file htdocs/fourn/facture/paiement.php + \ingroup fournisseur,facture + \brief Paiements des factures fournisseurs + \version $Id$ */ - require('./pre.inc.php'); require(DOL_DOCUMENT_ROOT.'/fourn/facture/paiementfourn.class.php'); @@ -42,12 +41,12 @@ $sortfield = isset($_GET['sortfield'])?$_GET['sortfield']:$_POST['sortfield']; $sortorder = isset($_GET['sortorder'])?$_GET['sortorder']:$_POST['sortorder']; $page=isset($_GET['page'])?$_GET['page']:$_POST['page']; -// Sécurité accés client +// Sécurité accés client $socid=0; if ($user->societe_id > 0) { - $action = ''; - $socid = $user->societe_id; + $action = ''; + $socid = $user->societe_id; } @@ -56,131 +55,130 @@ if ($user->societe_id > 0) */ if ($action == 'add_paiement') { - $error = 0; - - $datepaye = dolibarr_mktime(12, 0 , 0, - $_POST['remonth'], - $_POST['reday'], - $_POST['reyear']); - $paiement_id = 0; - $total = 0; - // Génère tableau des montants amounts - $amounts = array(); - foreach ($_POST as $key => $value) + $error = 0; + + $datepaye = dolibarr_mktime(12, 0 , 0, + $_POST['remonth'], + $_POST['reday'], + $_POST['reyear']); + $paiement_id = 0; + $total = 0; + // Génère tableau des montants amounts + $amounts = array(); + foreach ($_POST as $key => $value) + { + if (substr($key,0,7) == 'amount_') { - if (substr($key,0,7) == 'amount_') + $other_facid = substr($key,7); + $amounts[$other_facid] = $_POST[$key]; + $total = $total + $amounts[$other_facid]; + } + } + + // Effectue les vérifications des parametres + if ($_POST['paiementid'] <= 0) + { + $mesg = '
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('PaymentMode')).'
'; + $error++; + } + + if ($conf->banque->enabled) + { + // Si module bank actif, un compte est obligatoire lors de la saisie + // d'un paiement + if (! $_POST['accountid']) + { + $mesg = '
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')).'
'; + $error++; + } + } + + /* + \TODO A activer qd gestion avoir active et que creation facture fournisseur negative interdit + if ($total <= 0) + { + $mesg = '
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Amount')).'
'; + $error++; + } + */ + + if (! $error) + { + $db->begin(); + + // Creation de la ligne paiement + $paiement = new PaiementFourn($db); + $paiement->datepaye = $datepaye; + $paiement->amounts = $amounts; // Array of amounts + $paiement->paiementid = $_POST['paiementid']; + $paiement->num_paiement = $_POST['num_paiement']; + $paiement->note = mysql_real_escape_string($_POST['comment']); + + $paiement_id = $paiement->create($user); + if ($paiement_id > 0) + { + if ($conf->banque->enabled) + { + // Insertion dans llx_bank + $label = "(SupplierInvoicePayment)"; + $acc = new Account($db, $_POST['accountid']); + //paiementid contient "CHQ ou VIR par exemple" + $bank_line_id = $acc->addline($paiement->datepaye, + $paiement->paiementid, + $label, + 0.0 - $paiement->total, + $paiement->num_paiement, + '', + $user); + + // Mise a jour fk_bank dans llx_paiement. + // On connait ainsi le paiement qui a généré l'écriture bancaire + if ($bank_line_id > 0) { - $other_facid = substr($key,7); - $amounts[$other_facid] = $_POST[$key]; - $total = $total + $amounts[$other_facid]; + $paiement->update_fk_bank($bank_line_id); + // Mise a jour liens (pour chaque facture concernées par le paiement) + foreach ($paiement->amounts as $key => $value) + { + $facid = $key; + $fac = new FactureFournisseur($db); + $fac->fetch($facid); + $fac->fetch_fournisseur(); + $acc->add_url_line($bank_line_id, + $paiement_id, + DOL_URL_ROOT.'/fourn/paiement/fiche.php?id=', + '(paiement)', + 'payment_supplier'); + $acc->add_url_line($bank_line_id, + $fac->fournisseur->id, + DOL_URL_ROOT.'/fourn/fiche.php?socid=', + $fac->fournisseur->nom, + 'company'); + } } + else + { + $error++; + } + } + } + else + { + $mesg = '
'.$langs->trans($paiement->error).'
'; + $error++; } - - // Effectue les vérifications des parametres - if ($_POST['paiementid'] <= 0) + if ($error == 0) { - $mesg = '
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('PaymentMode')).'
'; - $error++; + $loc = DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$paiement_id; + $db->commit(); + Header('Location: '.$loc); + exit; } - - if ($conf->banque->enabled) + else { - // Si module bank actif, un compte est obligatoire lors de la saisie - // d'un paiement - if (! $_POST['accountid']) - { - $mesg = '
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')).'
'; - $error++; - } - } - -/* - \TODO A activer qd gestion avoir active et que creation facture fournisseur negative interdit - if ($total <= 0) - { - $mesg = '
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Amount')).'
'; - $error++; - } -*/ - - if (! $error) - { - $db->begin(); - - // Creation de la ligne paiement - $paiement = new PaiementFourn($db); - $paiement->datepaye = $datepaye; - $paiement->amounts = $amounts; // Array of amounts - $paiement->paiementid = $_POST['paiementid']; - $paiement->num_paiement = $_POST['num_paiement']; - $paiement->note = $_POST['comment']; - - $paiement_id = $paiement->create($user); - if ($paiement_id > 0) - { - if ($conf->banque->enabled) - { - // Insertion dans llx_bank - $label = "(SupplierInvoicePayment)"; - $acc = new Account($db, $_POST['accountid']); - //paiementid contient "CHQ ou VIR par exemple" - $bank_line_id = $acc->addline($paiement->datepaye, - $paiement->paiementid, - $label, - 0.0 - $paiement->total, - $paiement->num_paiement, - '', - $user); - - // Mise a jour fk_bank dans llx_paiement. - // On connait ainsi le paiement qui a généré l'écriture bancaire - if ($bank_line_id > 0) - { - $paiement->update_fk_bank($bank_line_id); - // Mise a jour liens (pour chaque facture concernées par le paiement) - foreach ($paiement->amounts as $key => $value) - { - $facid = $key; - $fac = new FactureFournisseur($db); - $fac->fetch($facid); - $fac->fetch_fournisseur(); - $acc->add_url_line($bank_line_id, - $paiement_id, - DOL_URL_ROOT.'/fourn/paiement/fiche.php?id=', - '(paiement)', - 'payment_supplier'); - $acc->add_url_line($bank_line_id, - $fac->fournisseur->id, - DOL_URL_ROOT.'/fourn/fiche.php?socid=', - $fac->fournisseur->nom, - 'company'); - } - } - else - { - $error++; - } - } - } - else - { - $mesg = '
'.$langs->trans($paiement->error).'
'; - $error++; - } - - if ($error == 0) - { - $loc = DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$paiement_id; - $db->commit(); - Header('Location: '.$loc); - exit; - } - else - { - $db->rollback(); - } + $db->rollback(); } + } } /* @@ -193,158 +191,158 @@ $html=new Form($db); if ($mesg) { - print ''.$mesg.''; + print ''.$mesg.''; } if ($action == 'create' || $action == 'add_paiement') { - $facture = new FactureFournisseur($db); - $facture->fetch($facid); + $facture = new FactureFournisseur($db); + $facture->fetch($facid); - $sql = 'SELECT s.nom, s.rowid as socid,'; - $sql.= ' f.rowid as ref, f.facnumber, f.amount, f.total_ttc as total'; - if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; - $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'facture_fourn as f'; - if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= ' WHERE f.fk_soc = s.rowid'; - $sql .= ' AND f.rowid = '.$facid; - if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - $resql = $db->query($sql); - if ($resql) + $sql = 'SELECT s.nom, s.rowid as socid,'; + $sql.= ' f.rowid as ref, f.facnumber, f.amount, f.total_ttc as total'; + if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; + $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'facture_fourn as f'; + if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql .= ' WHERE f.fk_soc = s.rowid'; + $sql .= ' AND f.rowid = '.$facid; + if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + if ($num) { - $num = $db->num_rows($resql); - if ($num) + $obj = $db->fetch_object($resql); + $total = $obj->total; + + print_fiche_titre($langs->trans('DoPayment')); + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if ($conf->banque->enabled) + { + print ''; + } + else + { + print ''; + } + /* + * Autres factures impayées + */ + $sql = 'SELECT f.rowid as facid,f.rowid as ref,f.facnumber,f.total_ttc,'.$db->pdate('f.datef').' as df'; + $sql .= ', sum(pf.amount) as am'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid'; + $sql .= ' WHERE f.fk_soc = '.$facture->socid; + $sql .= ' AND f.paye = 0'; + $sql .= ' AND f.fk_statut = 1'; // Statut=0 => non validée, Statut=2 => annulée + $sql .= ' GROUP BY f.facnumber'; + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + if ($num > 0) { - $obj = $db->fetch_object($resql); - $total = $obj->total; + $i = 0; + print ''; + print ''; + print ''; + print '\n"; + $total+=$objp->total; + $total_ttc+=$objp->total_ttc; + $totalrecu+=$objp->am; + $i++; + } + if ($i > 1) + { + // Print total + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + } + print "
'.$langs->trans('Payment').'
'.$langs->trans('Company').''.$obj->nom.'
'.$langs->trans('Date').''; + if (!empty($_POST['remonth']) && !empty($_POST['reday']) && !empty($_POST['reyear'])) + $sel_date=mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + else + $sel_date=''; + $html->select_date($sel_date,'','','','',"addpaiement"); + print ''.$langs->trans('Comments').'
'.$langs->trans('PaymentMode').''; + $html->select_types_paiements(empty($_POST['paiementid'])?'':$_POST['paiementid'],'paiementid'); + print ''; + print '
'.$langs->trans('Numero').'
'.$langs->trans('Account').''; + $html->select_comptes(empty($_POST['accountid'])?'':$_POST['accountid'],'accountid',0,'',1); + print '
 
'; + print $langs->trans('Invoices').'
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - print_fiche_titre($langs->trans('DoPayment')); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print '
'.$langs->trans('Ref').''.$langs->trans('RefSupplier').''.$langs->trans('Date').''.$langs->trans('AmountTTC').''.$langs->trans('AlreadyPayed').''.$langs->trans('RemainderToPay').''.$langs->trans('Amount').'
'; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - if ($conf->banque->enabled) + $var=True; + $total=0; + $totalrecu=0; + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print ''; + print ''; + print ''; + if ($objp->df > 0 ) { - print ''; + print ''; } - else + else { - print ''; + print ''; } - /* - * Autres factures impayées - */ - $sql = 'SELECT f.rowid as facid,f.rowid as ref,f.facnumber,f.total_ttc,'.$db->pdate('f.datef').' as df'; - $sql .= ', sum(pf.amount) as am'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f'; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid'; - $sql .= ' WHERE f.fk_soc = '.$facture->socid; - $sql .= ' AND f.paye = 0'; - $sql .= ' AND f.fk_statut = 1'; // Statut=0 => non validée, Statut=2 => annulée - $sql .= ' GROUP BY f.facnumber'; - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - if ($num > 0) - { - $i = 0; - print '\n"; - } - $db->free($resql); - } - else - { - dolibarr_print_error($db); - } - - /* - * - */ - print ''; - print '
'.$langs->trans('Payment').'
'.$langs->trans('Company').''.$obj->nom.'
'.$langs->trans('Date').''; - if (!empty($_POST['remonth']) && !empty($_POST['reday']) && !empty($_POST['reyear'])) - $sel_date=mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); - else - $sel_date=''; - $html->select_date($sel_date,'','','','',"addpaiement"); - print ''.$langs->trans('Comments').'
'.$langs->trans('PaymentMode').''; - $html->select_types_paiements(empty($_POST['paiementid'])?'':$_POST['paiementid'],'paiementid'); - print ''; - print '
'.$langs->trans('Numero').'
'.img_object($langs->trans('ShowBill'),'bill').' '.$objp->ref; + print ''.$objp->facnumber.'
'.$langs->trans('Account').''; - $html->select_comptes(empty($_POST['accountid'])?'':$_POST['accountid'],'accountid',0,'',1); - print '
'; + print dolibarr_print_date($objp->df).'
 
!!!
'; - print $langs->trans('Invoices').'
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $var=True; - $total=0; - $totalrecu=0; - while ($i < $num) - { - $objp = $db->fetch_object($resql); - $var=!$var; - print ''; - print ''; - print ''; - if ($objp->df > 0 ) - { - print ''; - } - else - { - print ''; - } - print ''; - print ''; - print ''; - print '\n"; - $total+=$objp->total; - $total_ttc+=$objp->total_ttc; - $totalrecu+=$objp->am; - $i++; - } - if ($i > 1) - { - // Print total - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - } - print "
'.$langs->trans('Ref').''.$langs->trans('RefSupplier').''.$langs->trans('Date').''.$langs->trans('AmountTTC').''.$langs->trans('AlreadyPayed').''.$langs->trans('RemainderToPay').''.$langs->trans('Amount').'
'.img_object($langs->trans('ShowBill'),'bill').' '.$objp->ref; - print ''.$objp->facnumber.''; - print dolibarr_print_date($objp->df).'!!!'.price($objp->total_ttc).''.price($objp->am).''.price($objp->total_ttc - $objp->am).''; - $namef = 'amount_'.$objp->facid; - print ''; - print "
'.$langs->trans('TotalTTC').':'.price($total_ttc).''.price($totalrecu).''.price($total_ttc - $totalrecu).' 
'; - print ''; + print '
'.price($objp->total_ttc).''.price($objp->am).''.price($objp->total_ttc - $objp->am).''; + $namef = 'amount_'.$objp->facid; + print ''; + print "
'.$langs->trans('TotalTTC').':'.price($total_ttc).''.price($totalrecu).''.price($total_ttc - $totalrecu).' 
\n"; } + $db->free($resql); + } + else + { + dolibarr_print_error($db); + } + + /* + * + */ + print ''; + print ''; + print ''; } + } } /* @@ -352,89 +350,89 @@ if ($action == 'create' || $action == 'add_paiement') */ if (! $_GET['action'] && ! $_POST['action']) { - if ($page == -1) $page = 0 ; - $limit = $conf->liste_limit; - $offset = $limit * $page ; + if ($page == -1) $page = 0 ; + $limit = $conf->liste_limit; + $offset = $limit * $page ; - if (! $sortorder) $sortorder='DESC'; - if (! $sortfield) $sortfield='p.datep'; + if (! $sortorder) $sortorder='DESC'; + if (! $sortfield) $sortfield='p.datep'; - $sql = 'SELECT p.rowid, p.rowid as pid, '.$db->pdate('p.datep').' as dp, p.amount as pamount,'; - $sql.= ' f.rowid as facid, f.rowid as ref, f.facnumber, f.amount,'; - $sql.= ' s.rowid as socid, s.nom,'; - $sql.= ' c.libelle as paiement_type, p.num_paiement,'; - $sql.= ' ba.rowid as bid, ba.label'; - if (!$user->rights->societe->client->voir) $sql .= ", sc.fk_soc, sc.fk_user "; - $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn AS p'; - if (!$user->rights->societe->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn AS pf ON p.rowid=pf.fk_paiementfourn'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn AS f ON f.rowid=pf.fk_facturefourn '; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement AS c ON p.fk_paiement = c.id'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON s.rowid = f.fk_soc'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid'; - if (!$user->rights->societe->client->voir) $sql .= " WHERE s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socid) + $sql = 'SELECT p.rowid, p.rowid as pid, '.$db->pdate('p.datep').' as dp, p.amount as pamount,'; + $sql.= ' f.rowid as facid, f.rowid as ref, f.facnumber, f.amount,'; + $sql.= ' s.rowid as socid, s.nom,'; + $sql.= ' c.libelle as paiement_type, p.num_paiement,'; + $sql.= ' ba.rowid as bid, ba.label'; + if (!$user->rights->societe->client->voir) $sql .= ", sc.fk_soc, sc.fk_user "; + $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn AS p'; + if (!$user->rights->societe->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn AS pf ON p.rowid=pf.fk_paiementfourn'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn AS f ON f.rowid=pf.fk_facturefourn '; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement AS c ON p.fk_paiement = c.id'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON s.rowid = f.fk_soc'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid'; + if (!$user->rights->societe->client->voir) $sql .= " WHERE s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($socid) + { + $sql .= ' WHERE f.fk_soc = '.$socid; + } + $sql .= ' ORDER BY '.$sortfield.' '.$sortorder; + $sql .= $db->plimit($limit + 1 ,$offset); + + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + $var=True; + + print_barre_liste($langs->trans('SupplierPayments'), $page, 'paiement.php','',$sortfield,$sortorder,'',$num); + print ''; + print ''; + print_liste_field_titre($langs->trans('RefPayment'),'paiement.php','rowid','','','',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Invoice'),'paiement.php','facnumber','','','',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Date'),'paiement.php','dp','','','',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('ThirdParty'),'paiement.php','s.nom','','','',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Type'),'paiement.php','c.libelle','','','',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Account'),'paiement.php','ba.label','','','',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('AmountTTC'),'paiement.php','f.amount','','','align="right"',$sortfield,$sortorder); + print ''; + print "\n"; + + while ($i < min($num,$limit)) { - $sql .= ' WHERE f.fk_soc = '.$socid; - } - $sql .= ' ORDER BY '.$sortfield.' '.$sortorder; - $sql .= $db->plimit($limit + 1 ,$offset); - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - $var=True; - - print_barre_liste($langs->trans('SupplierPayments'), $page, 'paiement.php','',$sortfield,$sortorder,'',$num); - print '
 
'; - print ''; - print_liste_field_titre($langs->trans('RefPayment'),'paiement.php','rowid','','','',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Invoice'),'paiement.php','facnumber','','','',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Date'),'paiement.php','dp','','','',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('ThirdParty'),'paiement.php','s.nom','','','',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Type'),'paiement.php','c.libelle','','','',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Account'),'paiement.php','ba.label','','','',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('AmountTTC'),'paiement.php','f.amount','','','align="right"',$sortfield,$sortorder); - print ''; - print "\n"; - - while ($i < min($num,$limit)) - { - $objp = $db->fetch_object($resql); - $var=!$var; - print ''; + $objp = $db->fetch_object($resql); + $var=!$var; + print ''; - // Ref payment - print ''; + // Ref payment + print ''; - // Ref invoice - print ''; + // Ref invoice + print ''; - // Date - print '\n"; + // Date + print '\n"; - print ''; - print '\n"; - print ''; - print ''; - print ''; - $i++; - } - print "
 
'.img_object($langs->trans('ShowPayment'),'payment').' '.$objp->pid.''.img_object($langs->trans('ShowPayment'),'payment').' '.$objp->pid.''.dolibarr_trunc($objp->facnumber,12).''.dolibarr_trunc($objp->facnumber,12).''.dolibarr_print_date($objp->dp,'day')."'.dolibarr_print_date($objp->dp,'day')."'; - if ($objp->socid) print ''.img_object($langs->trans('ShowCompany'),'company').' '.dolibarr_trunc($objp->nom,32).''; - else print ' '; - print ''.dolibarr_trunc($objp->paiement_type.' '.$objp->num_paiement,32)."'; - if ($objp->bid) print ''.img_object($langs->trans("ShowAccount"),'account').' '.dolibarr_trunc($objp->label,24).''; - else print ' '; - print ''.price($objp->pamount).' 
"; - } - else - { - dolibarr_print_error($db); + print ''; + if ($objp->socid) print ''.img_object($langs->trans('ShowCompany'),'company').' '.dolibarr_trunc($objp->nom,32).''; + else print ' '; + print ''; + print ''.dolibarr_trunc($objp->paiement_type.' '.$objp->num_paiement,32)."\n"; + print ''; + if ($objp->bid) print ''.img_object($langs->trans("ShowAccount"),'account').' '.dolibarr_trunc($objp->label,24).''; + else print ' '; + print ''; + print ''.price($objp->pamount).' '; + print ''; + $i++; } + print ""; + } + else + { + dolibarr_print_error($db); + } } $db->close();