Amélioration de la gestion des paiements clients en ajoutant page de confirmation et warning si paiement saisi supérieur au reste à payer.

This commit is contained in:
Laurent Destailleur 2006-11-10 00:28:39 +00:00
parent c586df3d02
commit 496e780434
9 changed files with 424 additions and 300 deletions

View File

@ -79,7 +79,7 @@ $NBLINES=4;
* Actions * Actions
*/ */
// Validation // Validation
if ($_GET['action'] == 'valid') if ($_GET['action'] == 'valid')
{ {
$facture = new Facture($db); $facture = new Facture($db);
@ -92,7 +92,7 @@ if ($_GET['action'] == 'valid')
if ($facture->total_ht >= 0) if ($facture->total_ht >= 0)
{ {
$mesg='<div class="error">'.$langs->trans("ErrorInvoiceAvoirMustBeNegative").'</div>'; $mesg='<div class="error">'.$langs->trans("ErrorInvoiceAvoirMustBeNegative").'</div>';
$_GET['action']=''; $_GET['action']='';
} }
} }
else else
@ -100,12 +100,12 @@ if ($_GET['action'] == 'valid')
// Si non avoir, le signe doit etre positif // Si non avoir, le signe doit etre positif
if ($facture->total_ht < 0) if ($facture->total_ht < 0)
{ {
$mesg='<div class="error">'.$langs->trans("ErrorInvoiceOfThisTypeMustBePositive").'</div>'; $mesg='<div class="error">'.$langs->trans("ErrorInvoiceOfThisTypeMustBePositive").'</div>';
$_GET['action']=''; $_GET['action']='';
} }
} }
} }
if ($_POST['action'] == 'classin') if ($_POST['action'] == 'classin')
{ {
$facture = new Facture($db); $facture = new Facture($db);
@ -201,19 +201,19 @@ if ($_GET['action'] == 'modif' && $user->rights->facture->modifier && $conf->glo
{ {
$fac = new Facture($db); $fac = new Facture($db);
$fac->fetch($_GET['facid']); $fac->fetch($_GET['facid']);
// On vérifie si la facture a des paiements // On vérifie si la facture a des paiements
$sql = 'SELECT pf.amount'; $sql = 'SELECT pf.amount';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf';
$sql.= ' WHERE pf.fk_facture = '.$fac->id; $sql.= ' WHERE pf.fk_facture = '.$fac->id;
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$i = 0; $i = 0;
$num = $db->num_rows($result); $num = $db->num_rows($result);
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
@ -221,12 +221,12 @@ if ($_GET['action'] == 'modif' && $user->rights->facture->modifier && $conf->glo
$i++; $i++;
} }
} }
$resteapayer = $fac->total_ttc - $totalpaye; $resteapayer = $fac->total_ttc - $totalpaye;
// On vérifie si les lignes de factures ont été exportées en compta et/ou ventilées // On vérifie si les lignes de factures ont été exportées en compta et/ou ventilées
$ventilExportCompta = $fac->getVentilExportCompta(); $ventilExportCompta = $fac->getVentilExportCompta();
// On vérifie si aucun paiement n'a été effectué // On vérifie si aucun paiement n'a été effectué
if ($resteapayer == $fac->total_ttc && $fac->paye == 0 && $ventilExportCompta == 0) if ($resteapayer == $fac->total_ttc && $fac->paye == 0 && $ventilExportCompta == 0)
{ {
@ -311,7 +311,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
$datefacture = mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $datefacture = mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$result=$facture->fetch($_POST['fac_replacement']); $result=$facture->fetch($_POST['fac_replacement']);
$facture->date = $datefacture; $facture->date = $datefacture;
$facture->note_public = trim($_POST['note_public']); $facture->note_public = trim($_POST['note_public']);
$facture->note = trim($_POST['note']); $facture->note = trim($_POST['note']);
@ -371,7 +371,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("CorrectInvoice")).'</div>'; $mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("CorrectInvoice")).'</div>';
} }
} }
if ($_POST['type'] == 0 && $_POST['fac_rec'] > 0) if ($_POST['type'] == 0 && $_POST['fac_rec'] > 0)
{ {
// Si facture récurrente // Si facture récurrente
@ -575,7 +575,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
} }
} }
// Fin création facture, on l'affiche // Fin création facture, on l'affiche
if ($facid > 0 && ! $error) if ($facid > 0 && ! $error)
{ {
@ -602,7 +602,7 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') &&
$ret=$fac->fetch($_POST['facid']); $ret=$fac->fetch($_POST['facid']);
$soc = new Societe($db); $soc = new Societe($db);
$ret=$soc->fetch($fac->socid); $ret=$soc->fetch($fac->socid);
$date_start=''; $date_start='';
$date_end=''; $date_end='';
// Si ajout champ produit libre // Si ajout champ produit libre
@ -637,7 +637,7 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') &&
{ {
$prod = new Product($db, $_POST['idprod']); $prod = new Product($db, $_POST['idprod']);
$prod->fetch($_POST['idprod']); $prod->fetch($_POST['idprod']);
// multiprix // multiprix
if ($conf->global->PRODUIT_MULTIPRICES == 1) if ($conf->global->PRODUIT_MULTIPRICES == 1)
{ {
@ -647,7 +647,7 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') &&
{ {
$pu=$prod->price; $pu=$prod->price;
} }
// La description de la ligne est celle saisie ou // La description de la ligne est celle saisie ou
// celle du produit si (non saisi + PRODUIT_CHANGE_PROD_DESC défini) // celle du produit si (non saisi + PRODUIT_CHANGE_PROD_DESC défini)
// \todo Ne faut-il pas rendre $conf->global->PRODUIT_CHANGE_PROD_DESC toujours a on // \todo Ne faut-il pas rendre $conf->global->PRODUIT_CHANGE_PROD_DESC toujours a on
@ -656,7 +656,7 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') &&
{ {
$desc = $prod->description; $desc = $prod->description;
} }
$tva_tx = get_default_tva($mysoc,$soc,$prod->tva_tx); $tva_tx = get_default_tva($mysoc,$soc,$prod->tva_tx);
} }
else else
@ -739,7 +739,7 @@ if ($_GET['action'] == 'deleteline' && $user->rights->facture->creer && ! $conf-
} }
else else
{ {
print $fac->error; print $fac->error;
} }
} }
@ -758,7 +758,7 @@ if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes')
else else
{ {
$mesg='<div class="error">'.$fac->error.'</div>'; $mesg='<div class="error">'.$fac->error.'</div>';
} }
} }
} }
@ -818,7 +818,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c
$file = $conf->facture->dir_output . '/' . $facref . '/' . $facref . '.pdf'; $file = $conf->facture->dir_output . '/' . $facref . '/' . $facref . '.pdf';
if (is_readable($file)) if (is_readable($file))
{ {
$soc = new Societe($db, $fac->socid); $soc = new Societe($db, $fac->socid);
if ($_POST['sendto']) { if ($_POST['sendto']) {
@ -839,7 +839,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c
$message = $_POST['message']; $message = $_POST['message'];
$sendtocc = $_POST['sendtocc']; $sendtocc = $_POST['sendtocc'];
$deliveryreceipt = $_POST['deliveryreceipt']; $deliveryreceipt = $_POST['deliveryreceipt'];
if ($_POST['action'] == 'send') if ($_POST['action'] == 'send')
{ {
if(strlen($_POST['subject'])) if(strlen($_POST['subject']))
@ -850,16 +850,16 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c
{ {
$subject = $langs->trans('Bill').' '.$fac->ref; $subject = $langs->trans('Bill').' '.$fac->ref;
} }
$actiontypeid=9; $actiontypeid=9;
$actionmsg ='Mail envoyé par '.$from.' à '.$sendto.'.<br>'; $actionmsg ='Mail envoyé par '.$from.' à '.$sendto.'.<br>';
if ($message) if ($message)
{ {
$actionmsg.='Texte utilisé dans le corps du message:<br>'; $actionmsg.='Texte utilisé dans le corps du message:<br>';
$actionmsg.=$message; $actionmsg.=$message;
} }
$actionmsg2='Envoi facture par mail'; $actionmsg2='Envoi facture par mail';
} }
if ($_POST['action'] == 'relance') if ($_POST['action'] == 'relance')
@ -892,7 +892,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c
if ($mailfile->sendfile()) if ($mailfile->sendfile())
{ {
$mesg='<div class="ok">'.$langs->trans('MailSuccessfulySent',$from,$sendto).'.</div>'; $mesg='<div class="ok">'.$langs->trans('MailSuccessfulySent',$from,$sendto).'.</div>';
// Insertion action // Insertion action
require_once(DOL_DOCUMENT_ROOT.'/contact.class.php'); require_once(DOL_DOCUMENT_ROOT.'/contact.class.php');
require_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php'); require_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php');
@ -906,9 +906,9 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c
$actioncomm->societe = new Societe($db,$fac->socid); $actioncomm->societe = new Societe($db,$fac->socid);
$actioncomm->user = $user; // User qui a fait l'action $actioncomm->user = $user; // User qui a fait l'action
$actioncomm->facid = $fac->id; $actioncomm->facid = $fac->id;
$ret=$actioncomm->add($user); // User qui saisit l'action $ret=$actioncomm->add($user); // User qui saisit l'action
if ($ret < 0) if ($ret < 0)
{ {
dolibarr_print_error($db); dolibarr_print_error($db);
@ -960,18 +960,18 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
{ {
$fac = new Facture($db, 0, $_GET['facid']); $fac = new Facture($db, 0, $_GET['facid']);
$fac->fetch($_GET['facid']); $fac->fetch($_GET['facid']);
if ($_REQUEST['model']) if ($_REQUEST['model'])
{ {
$fac->set_pdf_model($user, $_REQUEST['model']); $fac->set_pdf_model($user, $_REQUEST['model']);
} }
if ($_REQUEST['lang_id']) if ($_REQUEST['lang_id'])
{ {
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
$result=facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs); $result=facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
if ($result <= 0) if ($result <= 0)
{ {
@ -981,7 +981,7 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
else else
{ {
Header ('Location: '.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'#builddoc'); Header ('Location: '.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'#builddoc');
} }
} }
/********************************************************************* /*********************************************************************
@ -1022,11 +1022,11 @@ $html = new Form($db);
if ($_GET['action'] == 'create') if ($_GET['action'] == 'create')
{ {
$facturestatic=new Facture($db); $facturestatic=new Facture($db);
print_titre($langs->trans('NewBill')); print_titre($langs->trans('NewBill'));
if ($mesg) print $mesg; if ($mesg) print $mesg;
$soc = new Societe($db); $soc = new Societe($db);
if ($_GET['propalid']) if ($_GET['propalid'])
@ -1092,7 +1092,7 @@ if ($_GET['action'] == 'create')
// Ref // Ref
print '<tr><td>'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>'; print '<tr><td>'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>';
/* /*
\todo \todo
L'info "Reference commande client" est une carac de la commande et non de la facture. L'info "Reference commande client" est une carac de la commande et non de la facture.
@ -1107,7 +1107,7 @@ if ($_GET['action'] == 'create')
print '</td></tr>'; print '</td></tr>';
} }
// Societe // Tiers
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('Company').'</td><td colspan="2">';
print $soc->getNomUrl(1); print $soc->getNomUrl(1);
print '<input type="hidden" name="socid" value="'.$soc->id.'">'; print '<input type="hidden" name="socid" value="'.$soc->id.'">';
@ -1121,7 +1121,7 @@ if ($_GET['action'] == 'create')
{ {
$options.='<option value="'.$key.'">'.$value.'</option>'; $options.='<option value="'.$key.'">'.$value.'</option>';
} }
$facids=$facturestatic->list_avoir_invoices($soc->id); $facids=$facturestatic->list_qualified_avoir_invoices($soc->id);
$optionsav=""; $optionsav="";
foreach ($facids as $key => $value) foreach ($facids as $key => $value)
{ {
@ -1130,7 +1130,7 @@ if ($_GET['action'] == 'create')
print '<tr><td valign="top">'.$langs->trans('Type').'</td><td colspan="2">'; print '<tr><td valign="top">'.$langs->trans('Type').'</td><td colspan="2">';
print '<table class="nobordernopadding">'."\n"; print '<table class="nobordernopadding">'."\n";
print '<tr><td width="16px" valign="middle">'; print '<tr><td width="16px" valign="middle">';
print '<input type="radio" name="type" value="0"'.($_POST['type']==0?' checked="true"':'').'>'; print '<input type="radio" name="type" value="0"'.($_POST['type']==0?' checked="true"':'').'>';
print '</td><td valign="middle">'; print '</td><td valign="middle">';
@ -1158,7 +1158,7 @@ if ($_GET['action'] == 'create')
} }
$text.='</select>'; $text.='</select>';
$desc=$html->textwithhelp($text,$langs->transnoentities("InvoiceReplacementDesc"),1); $desc=$html->textwithhelp($text,$langs->transnoentities("InvoiceReplacementDesc"),1);
print $desc; print $desc;
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '<tr><td valign="middle">'; print '<tr><td valign="middle">';
@ -1183,12 +1183,12 @@ if ($_GET['action'] == 'create')
$text.='</select>'; $text.='</select>';
$desc=$html->textwithhelp($text,$langs->transnoentities("InvoiceAvoirDesc"),1); $desc=$html->textwithhelp($text,$langs->transnoentities("InvoiceAvoirDesc"),1);
//.' ('.$langs->trans("FeatureNotYetAvailable").')',$langs->transnoentities("InvoiceAvoirDesc"),1); //.' ('.$langs->trans("FeatureNotYetAvailable").')',$langs->transnoentities("InvoiceAvoirDesc"),1);
print $desc; print $desc;
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '</table>'; print '</table>';
print '</td></tr>'; print '</td></tr>';
// Ligne info remises tiers // Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
@ -1228,7 +1228,7 @@ if ($_GET['action'] == 'create')
if ($relative_discount) if ($relative_discount)
{ {
print $langs->trans("CompanyHasRelativeDiscount",$relative_discount); print $langs->trans("CompanyHasRelativeDiscount",$relative_discount);
} }
else else
{ {
print $langs->trans("CompanyHasNoRelativeDiscount"); print $langs->trans("CompanyHasNoRelativeDiscount");
@ -1248,14 +1248,14 @@ if ($_GET['action'] == 'create')
if ($absolute_discount) if ($absolute_discount)
{ {
print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie)); print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie));
} }
else else
{ {
print $langs->trans("CompanyHasNoAbsoluteDiscount"); print $langs->trans("CompanyHasNoAbsoluteDiscount");
} }
print '</td></tr>'; print '</td></tr>';
*/ */
// Projet // Projet
if ($conf->projet->enabled) if ($conf->projet->enabled)
{ {
@ -1264,7 +1264,7 @@ if ($_GET['action'] == 'create')
$html->select_projects($societe_id, $projetid, 'projetid'); $html->select_projects($societe_id, $projetid, 'projetid');
print '</td></tr>'; print '</td></tr>';
} }
// Modele PDF // Modele PDF
print '<tr><td>'.$langs->trans('Model').'</td>'; print '<tr><td>'.$langs->trans('Model').'</td>';
print '<td>'; print '<td>';
@ -1273,7 +1273,7 @@ if ($_GET['action'] == 'create')
$liste=$model->liste_modeles($db); $liste=$model->liste_modeles($db);
$html->select_array('model',$liste,$conf->global->FACTURE_ADDON_PDF); $html->select_array('model',$liste,$conf->global->FACTURE_ADDON_PDF);
print "</td></tr>"; print "</td></tr>";
// Note publique // Note publique
print '<tr>'; print '<tr>';
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>'; print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
@ -1314,7 +1314,7 @@ if ($_GET['action'] == 'create')
} }
print '</textarea></td></tr>'; print '</textarea></td></tr>';
} }
if ($_GET['propalid'] > 0) if ($_GET['propalid'] > 0)
{ {
print '<input type="hidden" name="amount" value="'.$propal->price.'">'."\n"; print '<input type="hidden" name="amount" value="'.$propal->price.'">'."\n";
@ -1367,7 +1367,7 @@ if ($_GET['action'] == 'create')
if ($conf->global->PRODUCT_SHOW_WHEN_CREATE) if ($conf->global->PRODUCT_SHOW_WHEN_CREATE)
{ {
print '<tr><td colspan="3">'; print '<tr><td colspan="3">';
// Zone de choix des produits prédéfinis à la création // Zone de choix des produits prédéfinis à la création
print '<table class="noborder">'; print '<table class="noborder">';
print '<tr><td>'.$langs->trans('ProductsAndServices').'</td>'; print '<tr><td>'.$langs->trans('ProductsAndServices').'</td>';
@ -1404,7 +1404,7 @@ if ($_GET['action'] == 'create')
} }
print "</tr>\n"; print "</tr>\n";
} }
print '</table>'; print '</table>';
print '</td></tr>'; print '</td></tr>';
} }
@ -1423,7 +1423,7 @@ if ($_GET['action'] == 'create')
{ {
$num = $db->num_rows(); $num = $db->num_rows();
$i = 0; $i = 0;
if ($num > 0) if ($num > 0)
{ {
print '<tr><td colspan="3">'.$langs->trans('CreateFromRepeatableInvoice').' : <select class="flat" name="fac_rec">'; print '<tr><td colspan="3">'.$langs->trans('CreateFromRepeatableInvoice').' : <select class="flat" name="fac_rec">';
@ -1444,7 +1444,7 @@ if ($_GET['action'] == 'create')
} }
} }
} }
// Bouton "Create Draft" // Bouton "Create Draft"
print '<tr><td colspan="3" align="center"><input type="submit" class="button" name="bouton" value="'.$langs->trans('CreateDraft').'"></td></tr>'; print '<tr><td colspan="3" align="center"><input type="submit" class="button" name="bouton" value="'.$langs->trans('CreateDraft').'"></td></tr>';
print "</table>\n"; print "</table>\n";
@ -1455,7 +1455,7 @@ if ($_GET['action'] == 'create')
if ($_GET['propalid']) if ($_GET['propalid'])
{ {
$title=$langs->trans('ProductsAndServices'); $title=$langs->trans('ProductsAndServices');
$sql = 'SELECT pt.rowid, pt.description, pt.price, pt.fk_product, pt.fk_remise_except,'; $sql = 'SELECT pt.rowid, pt.description, pt.price, pt.fk_product, pt.fk_remise_except,';
$sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,'; $sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,';
$sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid,'; $sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid,';
@ -1479,7 +1479,7 @@ if ($_GET['action'] == 'create')
if ($_GET['contratid']) if ($_GET['contratid'])
{ {
$title=$langs->trans('Services'); $title=$langs->trans('Services');
$sql = 'SELECT pt.rowid, pt.subprice, pt.tva_tx, pt.qty, pt.remise_percent, pt.description, pt.info_bits,'; $sql = 'SELECT pt.rowid, pt.subprice, pt.tva_tx, pt.qty, pt.remise_percent, pt.description, pt.info_bits,';
$sql.= ' pt.date_ouverture_prevue as date_debut_prevue, pt.date_ouverture as date_debut_reel,'; $sql.= ' pt.date_ouverture_prevue as date_debut_prevue, pt.date_ouverture as date_debut_reel,';
$sql.= ' pt.date_fin_validite as date_fin_prevue, pt.date_cloture as date_fin_reel,'; $sql.= ' pt.date_fin_validite as date_fin_prevue, pt.date_cloture as date_fin_reel,';
@ -1587,7 +1587,7 @@ else
$totalpaye = $fac->getSommePaiement(); $totalpaye = $fac->getSommePaiement();
$resteapayer = $fac->total_ttc - $totalpaye; $resteapayer = $fac->total_ttc - $totalpaye;
if ($fac->paye) $resteapayer=0; if ($fac->paye) $resteapayer=0;
$author = new User($db); $author = new User($db);
if ($fac->user_author) if ($fac->user_author)
{ {
@ -1596,7 +1596,7 @@ else
} }
$head = facture_prepare_head($fac); $head = facture_prepare_head($fac);
dolibarr_fiche_head($head, 'compta', $langs->trans('InvoiceCustomer')); dolibarr_fiche_head($head, 'compta', $langs->trans('InvoiceCustomer'));
/* /*
@ -1676,7 +1676,7 @@ else
$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('CancelBill'),$langs->trans('ConfirmCancelBill',$fac->ref),'confirm_canceled'); $html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('CancelBill'),$langs->trans('ConfirmCancelBill',$fac->ref),'confirm_canceled');
print '<br />'; print '<br />';
} }
/* /*
* Confirmation de la suppression d'une ligne produit * Confirmation de la suppression d'une ligne produit
*/ */
@ -1690,10 +1690,10 @@ else
* Facture * Facture
*/ */
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Reference // Reference
print '<tr><td width="20%">'.$langs->trans('Ref').'</td><td colspan="5">'.$fac->ref.'</td></tr>'; print '<tr><td width="20%">'.$langs->trans('Ref').'</td><td colspan="5">'.$fac->ref.'</td></tr>';
// Ref client // Ref client
/* /*
\todo \todo
@ -1724,9 +1724,9 @@ else
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
// Société // Tiers Société
print '<tr><td>'.$langs->trans('Company').'</td>'; print '<tr><td>'.$langs->trans('Company').'</td>';
print '<td colspan="5">'.$soc->getNomUrl(1,'compta').'</td>'; print '<td colspan="5">'.$soc->getNomUrl(1,'compta').'</td>';
print '</tr>'; print '</tr>';
@ -1769,7 +1769,7 @@ else
print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')'; print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
} }
print '</td></tr>'; print '</td></tr>';
// Ligne info remises tiers // Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">'; print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
@ -1789,11 +1789,11 @@ else
} }
else print $langs->trans("CompanyHasNoAbsoluteDiscount").'.'; else print $langs->trans("CompanyHasNoAbsoluteDiscount").'.';
print '</td></tr>'; print '</td></tr>';
// Dates // Dates
print '<tr><td>'.$langs->trans('Date').'</td>'; print '<tr><td>'.$langs->trans('Date').'</td>';
print '<td colspan="3">'.dolibarr_print_date($fac->date,'%A %d %B %Y').'</td>'; print '<td colspan="3">'.dolibarr_print_date($fac->date,'%A %d %B %Y').'</td>';
$nbrows=8; $nbrows=8;
if ($conf->global->FAC_USE_CUSTOMER_ORDER_REF) $nbrows++; if ($conf->global->FAC_USE_CUSTOMER_ORDER_REF) $nbrows++;
if ($conf->projet->enabled) $nbrows++; if ($conf->projet->enabled) $nbrows++;
@ -1815,13 +1815,13 @@ else
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
if ($fac->type != 2) if ($fac->type != 2)
{ {
// Liste des paiements // Liste des paiements
print '<tr class="liste_titre"><td>'.$langs->trans('Payments').'</td><td>'.$langs->trans('Type').'</td>'; print '<tr class="liste_titre"><td>'.$langs->trans('Payments').'</td><td>'.$langs->trans('Type').'</td>';
print '<td align="right">'.$langs->trans('Amount').'</td><td>&nbsp;</td></tr>'; print '<td align="right">'.$langs->trans('Amount').'</td><td>&nbsp;</td></tr>';
$var=True; $var=True;
while ($i < $num) while ($i < $num)
{ {
@ -1850,10 +1850,10 @@ else
} }
else else
{ {
// Solde avoir // Solde avoir
print '<tr><td colspan="2" align="right">'.$langs->trans('TotalTTCToYourCredit').' :</td>'; print '<tr><td colspan="2" align="right">'.$langs->trans('TotalTTCToYourCredit').' :</td>';
print '<td align="right" style="border: 1px solid;" bgcolor="#f0f0f0"><b>'.price(abs($fac->total_ttc)).'</b></td><td>'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>'; print '<td align="right" style="border: 1px solid;" bgcolor="#f0f0f0"><b>'.price(abs($fac->total_ttc)).'</b></td><td>'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
} }
print '</table>'; print '</table>';
$db->free($result); $db->free($result);
} }
@ -1862,13 +1862,13 @@ else
dolibarr_print_error($db); dolibarr_print_error($db);
} }
print '</td></tr>'; print '</td></tr>';
// Date limite reglement // Date limite reglement
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans('DateMaxPayment').'</td>'; print '<td>'.$langs->trans('DateMaxPayment').'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
if ($fac->type != 2) if ($fac->type != 2)
{ {
print dolibarr_print_date($fac->date_lim_reglement,'%A %d %B %Y'); print dolibarr_print_date($fac->date_lim_reglement,'%A %d %B %Y');
if ($fac->date_lim_reglement < (time() - $conf->facture->client->warning_delay) && ! $fac->paye && $fac->statut == 1 && ! $fac->am) print img_warning($langs->trans('Late')); if ($fac->date_lim_reglement < (time() - $conf->facture->client->warning_delay) && ! $fac->paye && $fac->statut == 1 && ! $fac->am) print img_warning($langs->trans('Late'));
@ -1900,10 +1900,10 @@ else
} }
else else
{ {
print '&nbsp;'; print '&nbsp;';
} }
print '</td></tr>'; print '</td></tr>';
// Mode de reglement // Mode de reglement
print '<tr><td width="25%">'; print '<tr><td width="25%">';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
@ -1945,10 +1945,10 @@ else
$total_lignes_ht+=$ligne_ht; $total_lignes_ht+=$ligne_ht;
$total_lignes_vat+=$ligne_vat; $total_lignes_vat+=$ligne_vat;
$total_lignes_ttc+=$ligne_ttc; $total_lignes_ttc+=$ligne_ttc;
$i++; $i++;
} }
} }
// Montants // Montants
print '<tr><td>'.$langs->trans('AmountHT').'</td>'; print '<tr><td>'.$langs->trans('AmountHT').'</td>';
print '<td align="right" colspan="2" nowrap>'.price($fac->total_ht).'</td>'; print '<td align="right" colspan="2" nowrap>'.price($fac->total_ht).'</td>';
@ -1968,7 +1968,7 @@ else
$langs->load('projects'); $langs->load('projects');
print '<tr>'; print '<tr>';
print '<td>'; print '<td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Project'); print $langs->trans('Project');
print '</td>'; print '</td>';
@ -1979,7 +1979,7 @@ else
print '</a></td>'; print '</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($_GET['action'] == 'classer') if ($_GET['action'] == 'classer')
{ {
@ -1992,7 +1992,7 @@ else
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
print '</table><br>'; print '</table><br>';
@ -2055,13 +2055,13 @@ else
print ' - '.nl2br(stripslashes($objp->product)); print ' - '.nl2br(stripslashes($objp->product));
print_date_range($objp->date_start,$objp->date_end); print_date_range($objp->date_start,$objp->date_end);
print ($objp->description && $objp->description!=$objp->product)?'<br>'.stripslashes(nl2br($objp->description)):''; print ($objp->description && $objp->description!=$objp->product)?'<br>'.stripslashes(nl2br($objp->description)):'';
// \todo Ne faut-il pas rendre $conf->global->PRODUIT_CHANGE_PROD_DESC toujours a on // \todo Ne faut-il pas rendre $conf->global->PRODUIT_CHANGE_PROD_DESC toujours a on
if ($conf->global->PRODUIT_DESC_IN_FORM && !$conf->global->PRODUIT_CHANGE_PROD_DESC) if ($conf->global->PRODUIT_DESC_IN_FORM && !$conf->global->PRODUIT_CHANGE_PROD_DESC)
{ {
print '<br>'.nl2br($objp->product_desc); print '<br>'.nl2br($objp->product_desc);
} }
print '</td>'; print '</td>';
} }
else else
@ -2221,7 +2221,7 @@ else
/* /*
* Lignes de remise * Lignes de remise
*/ */
// Réductions relatives (Remises-Ristournes-Rabbais) // Réductions relatives (Remises-Ristournes-Rabbais)
/* Une réduction doit s'appliquer obligatoirement sur des lignes de factures /* Une réduction doit s'appliquer obligatoirement sur des lignes de factures
$var=!$var; $var=!$var;
@ -2390,7 +2390,7 @@ else
print '<form name="addligne_predef" action="'.$_SERVER['PHP_SELF'].'#add" method="post">'; print '<form name="addligne_predef" action="'.$_SERVER['PHP_SELF'].'#add" method="post">';
print '<input type="hidden" name="facid" value="'.$fac->id.'">'; print '<input type="hidden" name="facid" value="'.$fac->id.'">';
print '<input type="hidden" name="action" value="addligne_predef">'; print '<input type="hidden" name="action" value="addligne_predef">';
$var=! $var; $var=! $var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td colspan="2">'; print '<td colspan="2">';
@ -2432,13 +2432,13 @@ else
if ($user->societe_id == 0 && $_GET['action'] <> 'valid' && $_GET['action'] <> 'editline') if ($user->societe_id == 0 && $_GET['action'] <> 'valid' && $_GET['action'] <> 'editline')
{ {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
// Editer une facture déjà validée, sans paiement effectué et pas exporté en compta // Editer une facture déjà validée, sans paiement effectué et pas exporté en compta
if ($fac->statut == 1) if ($fac->statut == 1)
{ {
// On vérifie si les lignes de factures ont été exportées en compta et/ou ventilées // On vérifie si les lignes de factures ont été exportées en compta et/ou ventilées
$ventilExportCompta = $fac->getVentilExportCompta(); $ventilExportCompta = $fac->getVentilExportCompta();
if ($conf->global->FACTURE_ENABLE_EDITDELETE && $user->rights->facture->modifier if ($conf->global->FACTURE_ENABLE_EDITDELETE && $user->rights->facture->modifier
&& ($resteapayer == $fac->total_ttc && $fac->paye == 0 && $ventilExportCompta == 0)) && ($resteapayer == $fac->total_ttc && $fac->paye == 0 && $ventilExportCompta == 0))
{ {
@ -2449,15 +2449,15 @@ else
// Récurrente // Récurrente
if (! $conf->global->FACTURE_DISABLE_RECUR) if (! $conf->global->FACTURE_DISABLE_RECUR)
{ {
print ' <a class="butAction" href="facture/fiche-rec.php?facid='.$fac->id.'&amp;action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>'; print '<a class="butAction" href="facture/fiche-rec.php?facid='.$fac->id.'&amp;action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>';
} }
// Valider // Valider
if ($fac->statut == 0 && $num_lignes > 0) if ($fac->statut == 0 && $num_lignes > 0)
{ {
if ($user->rights->facture->valider) if ($user->rights->facture->valider)
{ {
print ' <a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&amp;action=valid">'.$langs->trans('Validate').'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&amp;action=valid">'.$langs->trans('Validate').'</a>';
} }
} }
else else
@ -2467,11 +2467,11 @@ else
{ {
if ($fac->paye == 0) if ($fac->paye == 0)
{ {
print ' <a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&amp;action=builddoc">'.$langs->trans('BuildPDF').'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&amp;action=builddoc">'.$langs->trans('BuildPDF').'</a>';
} }
else else
{ {
print ' <a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&amp;action=builddoc">'.$langs->trans('RebuildPDF').'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&amp;action=builddoc">'.$langs->trans('RebuildPDF').'</a>';
} }
} }
} }
@ -2479,42 +2479,63 @@ else
// Envoyer // Envoyer
if ($fac->statut == 1 && $user->rights->facture->envoyer) if ($fac->statut == 1 && $user->rights->facture->envoyer)
{ {
print ' <a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&amp;action=presend">'.$langs->trans('SendByMail').'</a>'; if ($facidnext)
{
print '<span class="butActionRefused" alt="'.$langs->trans("DisabledBecauseReplacedInvoie").'">'.$langs->trans('SendByMail').'</span>';
}
else
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&amp;action=presend">'.$langs->trans('SendByMail').'</a>';
}
} }
// Envoyer une relance // Envoyer une relance
if ($fac->statut == 1 && $resteapayer > 0 && $user->rights->facture->envoyer) if ($fac->statut == 1 && $resteapayer > 0 && $user->rights->facture->envoyer)
{ {
print ' <a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&amp;action=prerelance">'.$langs->trans('SendRemindByMail').'</a>'; if ($facidnext)
{
print '<span class="butActionRefused" alt="'.$langs->trans("DisabledBecauseReplacedInvoie").'">'.$langs->trans('SendRemindByMail').'</span>';
}
else
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&amp;action=prerelance">'.$langs->trans('SendRemindByMail').'</a>';
}
} }
// Emettre paiement // Emettre paiement
if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement) if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement)
{ {
print ' <a class="butAction" href="paiement.php?facid='.$fac->id.'&amp;action=create">'.$langs->trans('DoPaiement').'</a>'; if ($facidnext)
{
print '<span class="butActionRefused" alt="'.$langs->trans("DisabledBecauseReplacedInvoie").'">'.$langs->trans('DoPaiement').'</span>';
}
else
{
print '<a class="butAction" href="paiement.php?facid='.$fac->id.'&amp;action=create">'.$langs->trans('DoPaiement').'</a>';
}
} }
// Classer 'payé' // Classer 'payé'
if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement
&& $resteapayer <= 0) && $resteapayer <= 0)
{ {
print ' <a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&amp;action=payed">'.$langs->trans('ClassifyPayed').'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&amp;action=payed">'.$langs->trans('ClassifyPayed').'</a>';
} }
// Classer 'fermée' (possible si validée et pas encore classée payée) // Classer 'fermée' (possible si validée et pas encore classée payée)
if ($fac->statut == 1 && $fac->paye == 0 && $resteapayer > 0 if ($fac->statut == 1 && $fac->paye == 0 && $resteapayer > 0
&& $user->rights->facture->paiement) && $user->rights->facture->paiement)
{ {
if ($totalpaye > 0) if ($totalpaye > 0)
{ {
print ' <a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&amp;action=payed">'.$langs->trans('ClassifyPayedPartially').'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&amp;action=payed">'.$langs->trans('ClassifyPayedPartially').'</a>';
} }
else else
{ {
print ' <a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&amp;action=canceled">'.$langs->trans('ClassifyCanceled').'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&amp;action=canceled">'.$langs->trans('ClassifyCanceled').'</a>';
// \todo // \todo
// Ajouter bouton "Annuler et Créer facture remplacement" // Ajouter bouton "Annuler et Créer facture remplacement"
} }
} }
@ -2523,7 +2544,7 @@ else
{ {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>'; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>';
} }
print '</div>'; print '</div>';
} }
@ -2722,8 +2743,8 @@ else
{ {
dolibarr_print_error($db,$result); dolibarr_print_error($db,$result);
exit; exit;
} }
} }
print '<br>'; print '<br>';
print_titre($langs->trans('SendBillByMail')); print_titre($langs->trans('SendBillByMail'));
@ -2778,9 +2799,9 @@ else
{ {
dolibarr_print_error($db,$result); dolibarr_print_error($db,$result);
exit; exit;
} }
} }
print '<br>'; print '<br>';
print_titre($langs->trans('SendReminderBillByMail')); print_titre($langs->trans('SendReminderBillByMail'));
@ -2987,7 +3008,7 @@ else
print '<td align="right" nowrap="nowrap">'; print '<td align="right" nowrap="nowrap">';
print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$objp->am); print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$objp->am);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
$total+=$objp->total; $total+=$objp->total;
$total_ttc+=$objp->total_ttc; $total_ttc+=$objp->total_ttc;

View File

@ -45,10 +45,15 @@ $sortorder = isset($_GET['sortorder'])?$_GET['sortorder']:$_POST['sortorder'];
$page=isset($_GET['page'])?$_GET['page']:$_POST['page']; $page=isset($_GET['page'])?$_GET['page']:$_POST['page'];
$amounts=array();
$amountsresttopay=array();
$addwarning=0;
/* /*
* Actions * Action add_paiement et confirm_paiement
*/ */
if ($_POST['action'] == 'add_paiement') if ($_POST['action'] == 'add_paiement' || $_POST['action'] == 'confirm_paiement')
{ {
$error = 0; $error = 0;
@ -57,16 +62,26 @@ if ($_POST['action'] == 'add_paiement')
$_POST['reday'], $_POST['reday'],
$_POST['reyear'])); $_POST['reyear']));
$paiement_id = 0; $paiement_id = 0;
$total = 0;
// Génère tableau des montants amounts // Verifie si des paiements sont supérieurs au montant facture
$amounts = array();
foreach ($_POST as $key => $value) foreach ($_POST as $key => $value)
{ {
if (substr($key,0,7) == 'amount_') if (substr($key,0,7) == 'amount_')
{ {
$other_facid = substr($key,7); $cursorfacid = substr($key,7);
$amounts[$other_facid] = $_POST[$key]; $amounts[$cursorfacid] = $_POST[$key];
$total = $total + $amounts[$other_facid]; $totalpaiement = $totalpaiement + price2num($amounts[$cursorfacid]);
$tmpfacture=new Facture($db);
$tmpfacture->fetch($cursorfacid);
$amountsresttopay[$cursorfacid]=($tmpfacture->total_ttc-$tmpfacture->getSommePaiement());
if ($amounts[$cursorfacid] && $amounts[$cursorfacid] > $amountsresttopay[$cursorfacid])
{
$addwarning=1;
$formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPay")).' Attention, le montant de paiement pour une ou plusieurs facture est supérieur au reste à payer.';
$formquestion['text'].='<br>Corriger votre saisie, sinon confirmer. Dolibarr pourra créer un avoir du trop perçu lors de la fermeture de chacune de facture.';
}
$formquestion[$i++]=array('type' => 'hidden','name' => $key, 'value' => $_POST[$key]);
} }
} }
@ -88,12 +103,31 @@ if ($_POST['action'] == 'add_paiement')
} }
} }
if ($total <= 0) if ($totalpaiement <= 0)
{ {
$fiche_erreur_message = '<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->trans('Amount')).'</div>'; $fiche_erreur_message = '<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->trans('Amount')).'</div>';
$error++; $error++;
} }
}
/*
* Action add_paiement
*/
if ($_POST['action'] == 'add_paiement')
{
if ($error)
{
$_POST['action']='';
$_GET['action'] = 'create';
}
// Le reste propre a cette action s'affiche en bas de page.
}
/*
* Action confirm_paiement
*/
if ($_POST['action'] == 'confirm_paiement' && $_POST['confirm'] == 'yes')
{
if (! $error) if (! $error)
{ {
$db->begin(); $db->begin();
@ -110,13 +144,6 @@ if ($_POST['action'] == 'add_paiement')
if ($paiement_id > 0) if ($paiement_id > 0)
{ {
// On determine le montant total du paiement
$total=0;
foreach ($paiement->amounts as $value)
{
$total += $value;
}
if ($conf->banque->enabled) if ($conf->banque->enabled)
{ {
// Insertion dans llx_bank // Insertion dans llx_bank
@ -126,7 +153,7 @@ if ($_POST['action'] == 'add_paiement')
$bank_line_id = $acc->addline($paiement->datepaye, $bank_line_id = $acc->addline($paiement->datepaye,
$paiement->paiementid, $paiement->paiementid,
$label, $label,
$total, $totalpaiement,
$paiement->num_paiement, $paiement->num_paiement,
'', '',
$user); $user);
@ -198,180 +225,220 @@ llxHeader();
$html=new Form($db); $html=new Form($db);
$facturestatic=new Facture($db); $facturestatic=new Facture($db);
if ($fiche_erreur_message)
{
print '<tr><td colspan="3" align="center">'.$fiche_erreur_message.'</td></tr>';
}
if ($_GET['action'] == 'create' || $_POST['action'] == 'add_paiement') if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_POST['action'] == 'add_paiement')
{ {
$facture = new Facture($db); $facture = new Facture($db);
$result=$facture->fetch($facid); $result=$facture->fetch($facid);
if ($result >= 0) if ($result >= 0)
{ {
$facture->fetch_client(); $facture->fetch_client();
$total = $facture->total_ttc; $title='';
if ($facture->type != 2) $title.=$langs->trans("EnterPaymentReceivedFromCustomer");
if ($facture->type == 2) $title.=$langs->trans("EnterPaymentDueToCustomer");
print_fiche_titre($title);
$title='';
if ($facture->type != 2) $title.=$langs->trans("EnterPaymentReceivedFromCustomer");
if ($facture->type == 2) $title.=$langs->trans("EnterPaymentDueToCustomer");
print_fiche_titre($title);
print '<form name="add_paiement" action="paiement.php" method="post">'; // Initialise donnees pour page de confirmation
print '<input type="hidden" name="action" value="add_paiement">'; if ($_POST["action"] == 'add_paiement')
print '<input type="hidden" name="facid" value="'.$facture->id.'">'; {
print '<input type="hidden" name="socid" value="'.$facture->socid.'">'; $i=0;
print '<input type="hidden" name="type" value="'.$facture->type.'">';
$formquestion[$i++]=array('type' => 'hidden','name' => 'facid', 'value' => $facture->id);
$formquestion[$i++]=array('type' => 'hidden','name' => 'socid', 'value' => $facture->socid);
$formquestion[$i++]=array('type' => 'hidden','name' => 'type', 'value' => $facture->type);
print '<table class="border" width="100%">';
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="2">'.$facture->client->getNomUrl(4)."</td></tr>\n"; }
print '<tr><td>'.$langs->trans('Date').'</td><td>'; print '<form name="add_paiement" action="paiement.php" method="post">';
if (!empty($_POST['remonth']) && !empty($_POST['reday']) && !empty($_POST['reyear'])) print '<input type="hidden" name="action" value="add_paiement">';
$sel_date=mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); print '<input type="hidden" name="facid" value="'.$facture->id.'">';
else print '<input type="hidden" name="socid" value="'.$facture->socid.'">';
$sel_date=''; print '<input type="hidden" name="type" value="'.$facture->type.'">';
$html->select_date($sel_date,'','','','',"add_paiement");
print '<table class="border" width="100%">';
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="2">'.$facture->client->getNomUrl(4)."</td></tr>\n";
print '<tr><td>'.$langs->trans('Date').'</td><td>';
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,'','','','',"add_paiement");
print '</td>';
print '<td>'.$langs->trans('Comments').'</td></tr>';
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
$html->select_types_paiements(empty($_POST['paiementid'])?'':$_POST['paiementid'],'paiementid');
print "</td>\n";
print '<td rowspan="3" valign="top">';
print '<textarea name="comment" wrap="soft" cols="60" rows="'.ROWS_4.'">'.(empty($_POST['comment'])?'':$_POST['comment']).'</textarea></td></tr>';
print '<tr><td>'.$langs->trans('Numero');
print ' <em>(Numéro chèque ou virement)</em>'; // \todo a traduire
print '</td>';
print '<td><input name="num_paiement" type="text" value="'.(empty($_POST['num_paiement'])?'':$_POST['num_paiement']).'"></td></tr>';
print '<tr>';
if ($conf->banque->enabled)
{
if ($facture->type != 2) print '<td>'.$langs->trans('AccountToCredit').'</td>';
if ($facture->type == 2) print '<td>'.$langs->trans('AccountToDebit').'</td>';
print '<td>';
$html->select_comptes(empty($_POST['accountid'])?'':$_POST['accountid'],'accountid',0,'',1);
print '</td>'; print '</td>';
print '<td>'.$langs->trans('Comments').'</td></tr>'; }
else
{
print '<td colspan="2">&nbsp;</td>';
}
print "</tr>\n";
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
$html->select_types_paiements(empty($_POST['paiementid'])?'':$_POST['paiementid'],'paiementid');
print "</td>\n";
print '<td rowspan="3" valign="top">'; /*
print '<textarea name="comment" wrap="soft" cols="60" rows="'.ROWS_4.'">'.(empty($_POST['comment'])?'':$_POST['comment']).'</textarea></td></tr>'; * Liste factures impayées
*/
$sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.type, ';
$sql.= $db->pdate('f.datef').' as df, ';
$sql.= ' sum(pf.amount) as am';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = 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
if ($facture->type != 2)
{
$sql .= ' AND type in (0,1)'; // Facture standard ou de remplacement
}
else
{
$sql .= ' AND type = 2';
}
$sql .= ' GROUP BY f.facnumber';
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
if ($num > 0)
{
print '<tr><td>'.$langs->trans('Numero'); $i = 0;
print ' <em>(Numéro chèque ou virement)</em>'; // \todo a traduire print '<tr><td colspan="3">';
print '</td>'; print '<table class="noborder" width="100%">';
print '<td><input name="num_paiement" type="text" value="'.(empty($_POST['num_paiement'])?'':$_POST['num_paiement']).'"></td></tr>'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Invoice').'</td>';
print '<td align="center">'.$langs->trans('Date').'</td>';
print '<td align="right">'.$langs->trans('AmountTTC').'</td>';
print '<td align="right">'.$langs->trans('Received').'</td>';
print '<td align="right">'.$langs->trans('RemainderToPay').'</td>';
print '<td align="right">'.$langs->trans('PaymentAmount').'</td>';
print '<td align="right">&nbsp;</td>';
print "</tr>\n";
print '<tr>'; $var=True;
if ($conf->banque->enabled) $total=0;
{ $totalrecu=0;
if ($facture->type != 2) print '<td>'.$langs->trans('AccountToCredit').'</td>';
if ($facture->type == 2) print '<td>'.$langs->trans('AccountToDebit').'</td>';
print '<td>';
$html->select_comptes(empty($_POST['accountid'])?'':$_POST['accountid'],'accountid',0,'',1);
print '</td>';
}
else
{
print '<td colspan="2">&nbsp;</td>';
}
print "</tr>\n";
/* while ($i < $num)
* Autres factures impayées
*/
$sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.type, ';
$sql.= $db->pdate('f.datef').' as df, ';
$sql.= ' sum(pf.amount) as am';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = 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
if ($facture->type != 2)
{
$sql .= ' AND type in (0,1)'; // Facture standard ou de remplacement
}
else
{
$sql .= ' AND type = 2';
}
$sql .= ' GROUP BY f.facnumber';
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
if ($num > 0)
{ {
$i = 0; $objp = $db->fetch_object($resql);
print '<tr><td colspan="3">'; $var=!$var;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans('Invoice').'</td>';
print '<td align="center">'.$langs->trans('Date').'</td>'; print '<td>';
print '<td align="right">'.$langs->trans('AmountTTC').'</td>'; $facturestatic->ref=$objp->facnumber;
print '<td align="right">'.$langs->trans('Received').'</td>'; $facturestatic->id=$objp->facid;
print '<td align="right">'.$langs->trans('RemainderToPay').'</td>'; $facturestatic->type=$objp->type;
print '<td align="center">'.$langs->trans('Amount').'</td>'; print $facturestatic->getNomUrl(1,'');
print "</td>\n";
// Date
print '<td align="center">'.dolibarr_print_date($objp->df)."</td>\n";
// Prix
print '<td align="right">'.price($objp->total_ttc).'</td>';
// Recu
print '<td align="right">'.price($objp->am).'</td>';
// Reste a payer
print '<td align="right">'.price($objp->total_ttc - $objp->am).'</td>';
// Montant
print '<td align="right">';
$namef = 'amount_'.$objp->facid;
print '<input type="text" size="8" name="'.$namef.'" value="'.$_POST[$namef].'">';
print "</td>";
// Warning
print '<td align="center" width="16">';
if ($amounts[$facturestatic->id] && $amounts[$facturestatic->id] > $amountsresttopay[$facturestatic->id])
{
print ' '.img_warning($langs->trans("PaymentHigherThanReminderToPay"));
}
print '</td>';
print "</tr>\n"; print "</tr>\n";
$var=True; $total+=$objp->total;
$total=0; $total_ttc+=$objp->total_ttc;
$totalrecu=0; $totalrecu+=$objp->am;
$i++;
while ($i < $num)
{
$objp = $db->fetch_object($resql);
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td><a href="facture.php?facid='.$objp->facid.'">';
$facturestatic->ref=$objp->facnumber;
$facturestatic->id=$objp->rowid;
$facturestatic->type=$objp->type;
print $facturestatic->getNomUrl(1,'');
print "</a></td>\n";
if ($objp->df > 0 )
{
print '<td align="center">';
print dolibarr_print_date($objp->df)."</td>\n";
}
else
{
print '<td align="center"><b>!!!</b></td>';
}
print '<td align="right">'.price($objp->total_ttc).'</td>';
print '<td align="right">'.price($objp->am).'</td>';
print '<td align="right">'.price($objp->total_ttc - $objp->am).'</td>';
print '<td align="center">';
$namef = 'amount_'.$objp->facid;
print '<input type="text" size="8" name="'.$namef.'">';
print "</td></tr>\n";
$total+=$objp->total;
$total_ttc+=$objp->total_ttc;
$totalrecu+=$objp->am;
$i++;
}
if ($i > 1)
{
// Print total
print '<tr class="liste_total">';
print '<td colspan="2" align="left">'.$langs->trans('TotalTTC').':</td>';
print '<td align="right"><b>'.price($total_ttc).'</b></td>';
print '<td align="right"><b>'.price($totalrecu).'</b></td>';
print '<td align="right"><b>'.price($total_ttc - $totalrecu).'</b></td>';
print '<td align="center">&nbsp;</td>';
print "</tr>\n";
}
print "</table></td></tr>\n";
} }
$db->free($resql); if ($i > 1)
} {
else // Print total
{ print '<tr class="liste_total">';
dolibarr_print_error($db); print '<td colspan="2" align="left">'.$langs->trans('TotalTTC').':</td>';
print '<td align="right"><b>'.price($total_ttc).'</b></td>';
print '<td align="right"><b>'.price($totalrecu).'</b></td>';
print '<td align="right"><b>'.price($total_ttc - $totalrecu).'</b></td>';
print '<td align="center">&nbsp;</td>';
print "</tr>\n";
}
print "</table></td></tr>\n";
} }
$db->free($resql);
}
else
{
dolibarr_print_error($db);
}
/*
* // Bouton Enregistrer
*/ if ($_POST["action"] != 'add_paiement')
{
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans('Save').'"></td></tr>'; print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans('Save').'"></td></tr>';
print '</table>'; }
print "</form>\n";
print '</table>';
// Message d'erreur
if ($fiche_erreur_message)
{
print '<tr><td colspan="3" align="center">'.$fiche_erreur_message.'</td></tr>';
}
// Formulaire confirmation
if ($_POST["action"] == 'add_paiement')
{
// print '<tr><td colspan="3">';
print '<br />';
$text=$langs->trans('ConfirmCustomerPayment',$totalpaiement,$langs->trans("Currency".$conf->monnaie));
$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$facture->id.'&socid='.$facture->socid.'&type='.$facture->type,$langs->trans('ReceivedCustomersPayments'),$text,'confirm_paiement',$formquestion);
// print '</td></tr>';
}
print "</form>\n";
} }
} }
@ -411,7 +478,7 @@ if (! $_GET['action'] && ! $_POST['action'])
print_barre_liste($langs->trans('Payments'), $page, 'paiement.php','',$sortfield,$sortorder,'',$num); print_barre_liste($langs->trans('Payments'), $page, 'paiement.php','',$sortfield,$sortorder,'',$num);
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Bill'),'paiement.php','facnumber','','','',$sortfield); print_liste_field_titre($langs->trans('Invoice'),'paiement.php','facnumber','','','',$sortfield);
print_liste_field_titre($langs->trans('Date'),'paiement.php','dp','','','',$sortfield); print_liste_field_titre($langs->trans('Date'),'paiement.php','dp','','','',$sortfield);
print_liste_field_titre($langs->trans('Type'),'paiement.php','libelle','','','',$sortfield); print_liste_field_titre($langs->trans('Type'),'paiement.php','libelle','','','',$sortfield);
print_liste_field_titre($langs->trans('Amount'),'paiement.php','fa_amount','','','align="right"',$sortfield); print_liste_field_titre($langs->trans('Amount'),'paiement.php','fa_amount','','','align="right"',$sortfield);

View File

@ -129,7 +129,7 @@ dolibarr_fiche_head($head, $hselected, $langs->trans("Payment").": ".$paiement->
*/ */
if ($_GET['action'] == 'delete') if ($_GET['action'] == 'delete')
{ {
$html->form_confirm('fiche.php?id='.$paiement->id, 'Supprimer le paiement', 'Etes-vous sûr de vouloir supprimer ce paiement ?', 'confirm_delete'); $html->form_confirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), 'Etes-vous sûr de vouloir supprimer ce paiement ?', 'confirm_delete');
print '<br>'; print '<br>';
} }
@ -139,7 +139,7 @@ if ($_GET['action'] == 'delete')
if ($_GET['action'] == 'valide') if ($_GET['action'] == 'valide')
{ {
$facid = $_GET['facid']; $facid = $_GET['facid'];
$html->form_confirm('fiche.php?id='.$paiement->id.'&amp;facid='.$facid, 'Valider le paiement', 'Etes-vous sûr de vouloir valider ce paiment, auncune modification n\'est possible une fois le paiement validé ?', 'confirm_valide'); $html->form_confirm('fiche.php?id='.$paiement->id.'&amp;facid='.$facid, $langs->trans("ValidatePayment"), 'Etes-vous sûr de vouloir valider ce paiment, auncune modification n\'est possible une fois le paiement validé ?', 'confirm_valide');
print '<br>'; print '<br>';
} }
@ -168,14 +168,26 @@ if ($conf->banque->enabled)
print '</tr>'; print '</tr>';
} }
} }
// Date
print '<tr><td valign="top" width="140">'.$langs->trans('Date').'</td><td colspan="3">'.dolibarr_print_date($paiement->date).'</td></tr>'; print '<tr><td valign="top" width="140">'.$langs->trans('Date').'</td><td colspan="3">'.dolibarr_print_date($paiement->date).'</td></tr>';
print '<tr><td valign="top">'.$langs->trans('Type').'</td><td colspan="3">'.$paiement->type_libelle.'</td></tr>';
if ($paiement->numero) // Mode
{ print '<tr><td valign="top">'.$langs->trans('Mode').'</td><td colspan="3">'.$langs->trans("PaymentType".$paiement->type_code).'</td></tr>';
// Numero
//if ($paiement->montant)
//{
print '<tr><td valign="top">'.$langs->trans('Numero').'</td><td colspan="3">'.$paiement->numero.'</td></tr>'; print '<tr><td valign="top">'.$langs->trans('Numero').'</td><td colspan="3">'.$paiement->numero.'</td></tr>';
} //}
// Montant
print '<tr><td valign="top">'.$langs->trans('Amount').'</td><td colspan="3">'.price($paiement->montant).'&nbsp;'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>'; print '<tr><td valign="top">'.$langs->trans('Amount').'</td><td colspan="3">'.price($paiement->montant).'&nbsp;'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
// Note
print '<tr><td valign="top">'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($paiement->note).'</td></tr>'; print '<tr><td valign="top">'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($paiement->note).'</td></tr>';
print '</table>'; print '</table>';

View File

@ -2278,7 +2278,7 @@ class Facture extends CommonObject
* \param socid Id societe * \param socid Id societe
* \return array Tableau des factures ($id => $ref) * \return array Tableau des factures ($id => $ref)
*/ */
function list_avoir_invoices($socid=0) function list_qualified_avoir_invoices($socid=0)
{ {
global $conf; global $conf;
@ -2287,13 +2287,13 @@ class Facture extends CommonObject
$sql = "SELECT f.rowid as rowid, f.facnumber"; $sql = "SELECT f.rowid as rowid, f.facnumber";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as ff ON f.rowid = ff.fk_facture_source AND ff.type=1"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as ff ON (f.rowid = ff.fk_facture_source AND ff.type=1)";
$sql.= " WHERE f.fk_statut >= 1 AND f.paye = 0"; $sql.= " WHERE f.fk_statut >= 1 AND f.paye = 0";
$sql.= " AND ff.type IS NULL"; // Renvoi vrai si pas facture de remplacement $sql.= " AND ff.type IS NULL"; // Renvoi vrai si pas facture de remplacement
if ($socid > 0) $sql.=" AND f.fk_soc = ".$socid; if ($socid > 0) $sql.=" AND f.fk_soc = ".$socid;
$sql.= " ORDER BY f.facnumber"; $sql.= " ORDER BY f.facnumber";
dolibarr_syslog("Facture.class::list_avoir_invoices sql=$sql"); dolibarr_syslog("Facture.class::list_qualified_avoir_invoices sql=$sql");
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {

View File

@ -1174,7 +1174,7 @@ class Form
print '<select class="flat" name="'.$htmlname.'">'; print '<select class="flat" name="'.$htmlname.'">';
if ($useempty) if ($useempty)
{ {
print '<option value="'.$obj->rowid.'">&nbsp</option>'; print '<option value="'.$obj->rowid.'">&nbsp;</option>';
} }
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);
@ -1501,7 +1501,7 @@ class Form
* \param title title * \param title title
* \param question question * \param question question
* \param action action * \param action action
* \param formquestion an array with forms compementary inputs * \param formquestion an array with forms complementary inputs
*/ */
function form_confirm($page, $title, $question, $action, $formquestion='') function form_confirm($page, $title, $question, $action, $formquestion='')
@ -1524,7 +1524,14 @@ class Form
print '<tr><td colspan="3" valign="top">'.$formquestion['text'].'</td></tr>'; print '<tr><td colspan="3" valign="top">'.$formquestion['text'].'</td></tr>';
foreach ($formquestion as $key => $input) foreach ($formquestion as $key => $input)
{ {
if ($input['type'] == 'text') print '<tr><td valign="top">'.$input['label'].'</td><td colspan="2"><input type="text" class="flat" name="'.$input['name'].'" size="'.$input['size'].'" value="'.$input['value'].'"></td></tr>'; if ($input['type'] == 'text')
{
print '<tr><td valign="top">'.$input['label'].'</td><td colspan="2"><input type="text" class="flat" name="'.$input['name'].'" size="'.$input['size'].'" value="'.$input['value'].'"></td></tr>';
}
if ($input['type'] == 'select')
{
// TODO
}
if ($input['type'] == 'radio') if ($input['type'] == 'radio')
{ {
$i=0; $i=0;
@ -1541,19 +1548,26 @@ class Form
} }
} }
} }
print '</tr></table>'; print '</table>';
print '</td>'; print '</td></tr>';
} }
// Ligne message // Ligne message
print '<tr class="valid"><td class="valid">'.$question.'</td>'; print '<tr class="valid">';
print '<td class="valid">'.$question.'</td>';
print '<td class="valid">'; print '<td class="valid">';
$this->selectyesno("confirm","no"); $this->selectyesno("confirm","no");
print '</td>'; print '</td>';
print '<td class="valid" align="center"><input class="button" type="submit" value="'.$langs->trans("Confirm").'"></td></tr>'; print '<td class="valid" align="center"><input class="button" type="submit" value="'.$langs->trans("Validate").'"></td>';
print '</tr>';
print '</table>'; print '</table>';
foreach ($formquestion as $key => $input)
{
if ($input['type'] == 'hidden') print '<input type="hidden" name="'.$input['name'].'" value="'.$input['value'].'">';
}
print "</form>\n"; print "</form>\n";
} }

View File

@ -40,13 +40,15 @@ Payments=Payments
PaymentType=Payment type PaymentType=Payment type
PaymentTypes=Payment types PaymentTypes=Payment types
ReceivedPayments=Received payments ReceivedPayments=Received payments
ReceivedCustomersPayments=Received customers payments ReceivedCustomersPayments=Payments received from customers
ReceivedCustomersPaymentsToValid=Received customers payments to validate ReceivedCustomersPaymentsToValid=Received customers payments to validate
PaymentsReportsForYear=Payments reports for %s PaymentsReportsForYear=Payments reports for %s
PaymentsReports=Payments reports PaymentsReports=Payments reports
PaymentsAlreadyDone=Payments already done PaymentsAlreadyDone=Payments already done
PaymentMode=Payment mode PaymentMode=Payment mode
PaymentConditionsShort=Payment conditions PaymentConditionsShort=Payment conditions
PaymentAmount=Payment amount
PaymentHigherThanReminderToPay=Payment higher than reminder to pay
ClassifyPayed=Classify 'Payed' ClassifyPayed=Classify 'Payed'
ClassifyPayedPartially=Classify 'Payed partially' ClassifyPayedPartially=Classify 'Payed partially'
ClassifyCanceled=Classify 'Abandonned' ClassifyCanceled=Classify 'Abandonned'
@ -119,6 +121,7 @@ ConfirmClassifyPayedPartiallyNoVat=Ce choix est possible si votre facture
ConfirmClassifyPayedPartiallyVat=Ce choix est possible si votre facture était munie de la mention adéquate. (Exemple: «seule la taxe correspondant au prix effectivement payé ouvre droit à déduction») ConfirmClassifyPayedPartiallyVat=Ce choix est possible si votre facture était munie de la mention adéquate. (Exemple: «seule la taxe correspondant au prix effectivement payé ouvre droit à déduction»)
ConfirmClassifyPayedPartiallyAvoir=Ce choix est le choix à prendre si les autres ne sont pas applicables ConfirmClassifyPayedPartiallyAvoir=Ce choix est le choix à prendre si les autres ne sont pas applicables
ConfirmClassifyPayedPartiallyAbandon=Ce choix sera celui dans le cas d'un mauvais payeur sans aucun espoir de recouvrement ConfirmClassifyPayedPartiallyAbandon=Ce choix sera celui dans le cas d'un mauvais payeur sans aucun espoir de recouvrement
ConfirmCustomerPayment=Do you confirm this paiement input for <b>%s</b> %s ?
ValidateBill=Validate invoice ValidateBill=Validate invoice
NumberOfBills=Nb of invoices NumberOfBills=Nb of invoices
NumberOfBillsByMonth=Nb of invoices by month NumberOfBillsByMonth=Nb of invoices by month

View File

@ -40,13 +40,15 @@ Payments=Paiements
PaymentType=Type de paiement PaymentType=Type de paiement
PaymentTypes=Types de paiements PaymentTypes=Types de paiements
ReceivedPayments=Paiements reçus ReceivedPayments=Paiements reçus
ReceivedCustomersPayments=Paiements clients reçus ReceivedCustomersPayments=Paiements reçus du client
ReceivedCustomersPaymentsToValid=Paiements clients reçus à valider ReceivedCustomersPaymentsToValid=Paiements clients reçus à valider
PaymentsReportsForYear=Rapports de paiements pour %s PaymentsReportsForYear=Rapports de paiements pour %s
PaymentsReports=Rapports de paiements PaymentsReports=Rapports de paiements
PaymentsAlreadyDone=Versements déjà effectués PaymentsAlreadyDone=Versements déjà effectués
PaymentMode=Mode règlement PaymentMode=Mode règlement
PaymentConditionsShort=Conditions règlement PaymentConditionsShort=Conditions règlement
PaymentAmount=Montant paiement
PaymentHigherThanReminderToPay=Paiement supérieur au reste à payer
ClassifyPayed=Classer 'Payée' ClassifyPayed=Classer 'Payée'
ClassifyPayedPartially=Classer 'Payée partiellement' ClassifyPayedPartially=Classer 'Payée partiellement'
ClassifyCanceled=Classer 'Abandonnée' ClassifyCanceled=Classer 'Abandonnée'
@ -119,6 +121,7 @@ ConfirmClassifyPayedPartiallyAvoir=Ce choix est le choix
ConfirmClassifyPayedPartiallyNoVat=Ce choix est possible si votre facture était munie de la mention adéquate. (Exemple: «escompte net de taxe») ConfirmClassifyPayedPartiallyNoVat=Ce choix est possible si votre facture était munie de la mention adéquate. (Exemple: «escompte net de taxe»)
ConfirmClassifyPayedPartiallyVat=Ce choix est possible si votre facture était munie de la mention adéquate. (Exemple: mention définissant l'escompte ou du genre «seule la taxe correspondant au prix effectivement payé ouvre droit à déduction») ConfirmClassifyPayedPartiallyVat=Ce choix est possible si votre facture était munie de la mention adéquate. (Exemple: mention définissant l'escompte ou du genre «seule la taxe correspondant au prix effectivement payé ouvre droit à déduction»)
ConfirmClassifyPayedPartiallyAbandon=Ce choix sera celui dans le cas d'un mauvais payeur sans aucun espoir de recouvrement ConfirmClassifyPayedPartiallyAbandon=Ce choix sera celui dans le cas d'un mauvais payeur sans aucun espoir de recouvrement
ConfirmCustomerPayment=Confirmez-vous la saisie de ce paiement de <b>%s</b> %s ?
ValidateBill=Valider facture ValidateBill=Valider facture
NumberOfBills=Nb de factures NumberOfBills=Nb de factures
NumberOfBillsByMonth=Nb de factures par mois NumberOfBillsByMonth=Nb de factures par mois

View File

@ -73,12 +73,12 @@ class Paiement
function fetch($id) function fetch($id)
{ {
$sql = 'SELECT p.rowid,'.$this->db->pdate('p.datep').' as dp, p.amount, p.statut, p.fk_bank'; $sql = 'SELECT p.rowid,'.$this->db->pdate('p.datep').' as dp, p.amount, p.statut, p.fk_bank';
$sql .=', c.libelle as paiement_type'; $sql.= ', c.code as type_code, c.libelle as type_libelle';
$sql .= ', p.num_paiement, p.note, b.fk_account'; $sql.= ', p.num_paiement, p.note, b.fk_account';
$sql .= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement as p'; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement as p';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid '; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid ';
$sql .= ' WHERE p.fk_paiement = c.id'; $sql.= ' WHERE p.fk_paiement = c.id';
$sql .= ' AND p.rowid = '.$id; $sql.= ' AND p.rowid = '.$id;
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
@ -93,7 +93,8 @@ class Paiement
$this->bank_line = $obj->fk_bank; $this->bank_line = $obj->fk_bank;
$this->montant = $obj->amount; $this->montant = $obj->amount;
$this->note = $obj->note; $this->note = $obj->note;
$this->type_libelle = $obj->paiement_type; $this->type_libelle = $obj->type_libelle;
$this->type_code = $obj->type_code;
$this->statut = $obj->statut; $this->statut = $obj->statut;
return 1; return 1;
} }

View File

@ -479,6 +479,9 @@ alter table llx_facturedet_rec add column total_tva real;
alter table llx_facturedet_rec add column total_ttc real; alter table llx_facturedet_rec add column total_ttc real;
update llx_facture set fk_facture_source=null where fk_facture_source is not null and type = 0;
update llx_boxes set fk_user = 0 where fk_user IS NULL; update llx_boxes set fk_user = 0 where fk_user IS NULL;
ALTER TABLE llx_boxes modify fk_user integer default 0 NOT NULL; ALTER TABLE llx_boxes modify fk_user integer default 0 NOT NULL;