New: Can input a payment back onto an credit note.

This commit is contained in:
Laurent Destailleur 2012-12-09 18:39:42 +01:00
parent 8a5485c9b6
commit 77ca4241a5
13 changed files with 134 additions and 63 deletions

View File

@ -9,6 +9,7 @@ For users:
- New: Add field "signature" into thirdparty card. If filled, text is added - New: Add field "signature" into thirdparty card. If filled, text is added
at end of predefined email texts. If option MAIL_DO_NOT_USE_SIGN is on, this at end of predefined email texts. If option MAIL_DO_NOT_USE_SIGN is on, this
feature is disabled. feature is disabled.
- New: Can input a payment back onto an credit note.
- New: Add link "Back to list" on all cards. - New: Add link "Back to list" on all cards.
- New: After first install, warning are visible onto mandatory setup not - New: After first install, warning are visible onto mandatory setup not
configured. Show also total number of activated modules. configured. Show also total number of activated modules.

View File

@ -42,13 +42,13 @@ $langs->load('compta');
*/ */
//init var //init var
$invoice_type = GETPOST('invoice_type','int');
$amountPayment = $_POST['amountPayment']; $amountPayment = $_POST['amountPayment'];
$amounts = $_POST['amounts']; // from text inputs : invoice amount payment (check required) $amounts = $_POST['amounts']; // from text inputs : invoice amount payment (check required)
$remains = $_POST['remains']; // from dolibarr's object (no need to check) $remains = $_POST['remains']; // from dolibarr's object (no need to check)
$currentInvId = $_POST['imgClicked']; // from DOM elements : imgId (equals invoice id) $currentInvId = $_POST['imgClicked']; // from DOM elements : imgId (equals invoice id)
// Getting the posted keys=>values, sanitize the ones who are from text inputs // Getting the posted keys=>values, sanitize the ones who are from text inputs
// from text inputs : total amount
$amountPayment = $amountPayment!='' ? ( is_numeric(price2num($amountPayment)) ? price2num($amountPayment) : '' ) : ''; // keep void if not a valid entry $amountPayment = $amountPayment!='' ? ( is_numeric(price2num($amountPayment)) ? price2num($amountPayment) : '' ) : ''; // keep void if not a valid entry
// Clean checkamounts // Clean checkamounts
@ -62,7 +62,7 @@ foreach ($amounts as $key => $value)
foreach ($remains as $key => $value) foreach ($remains as $key => $value)
{ {
$value = price2num($value); $value = price2num($value);
$remains[$key]=$value; $remains[$key]=(($invoice_type)==2?-1:1)*$value;
if (empty($value)) unset($remains[$key]); if (empty($value)) unset($remains[$key]);
} }

View File

@ -2647,6 +2647,9 @@ else if ($id > 0 || ! empty($ref))
* List of payments * List of payments
*/ */
$sign=1;
if ($object->type == 2) $sign=-1;
$nbrows=8; $nbcols=2; $nbrows=8; $nbcols=2;
if (! empty($conf->projet->enabled)) $nbrows++; if (! empty($conf->projet->enabled)) $nbrows++;
if (! empty($conf->banque->enabled)) $nbcols++; if (! empty($conf->banque->enabled)) $nbcols++;
@ -2687,8 +2690,8 @@ else if ($id > 0 || ! empty($ref))
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
if ($object->type != 2) //if ($object->type != 2)
{ //{
if ($num > 0) if ($num > 0)
{ {
while ($i < $num) while ($i < $num)
@ -2709,7 +2712,7 @@ else if ($id > 0 || ! empty($ref))
if ($bankaccountstatic->id) print $bankaccountstatic->getNomUrl(1,'transactions'); if ($bankaccountstatic->id) print $bankaccountstatic->getNomUrl(1,'transactions');
print '</td>'; print '</td>';
} }
print '<td align="right">'.price($objp->amount).'</td>'; print '<td align="right">'.price($sign * $objp->amount).'</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '</tr>'; print '</tr>';
$i++; $i++;
@ -2719,7 +2722,7 @@ else if ($id > 0 || ! empty($ref))
{ {
print '<tr '.$bc[$var].'><td colspan="'.$nbcols.'">'.$langs->trans("None").'</td><td></td><td></td></tr>'; print '<tr '.$bc[$var].'><td colspan="'.$nbcols.'">'.$langs->trans("None").'</td><td></td><td></td></tr>';
} }
} //}
$db->free($result); $db->free($result);
} }
else else
@ -2819,11 +2822,27 @@ else if ($id > 0 || ! empty($ref))
print '<td align="right" style="border: 1px solid;" bgcolor="#f0f0f0"><b>'.price($resteapayeraffiche).'</b></td>'; print '<td align="right" style="border: 1px solid;" bgcolor="#f0f0f0"><b>'.price($resteapayeraffiche).'</b></td>';
print '<td nowrap="nowrap">&nbsp;</td></tr>'; print '<td nowrap="nowrap">&nbsp;</td></tr>';
} }
else else // Credit note
{ {
// Total already paid back
print '<tr><td colspan="'.$nbcols.'" align="right">';
print $langs->trans('AlreadyPaidBack');
print ' :</td><td align="right">'.price($sign * $totalpaye).'</td><td>&nbsp;</td></tr>';
// Billed
print '<tr><td colspan="'.$nbcols.'" align="right">'.$langs->trans("Billed").' :</td><td align="right" style="border: 1px solid;">'.price($sign * $object->total_ttc).'</td><td>&nbsp;</td></tr>';
// Remainder to pay back
print '<tr><td colspan="'.$nbcols.'" align="right">';
if ($resteapayeraffiche <= 0) print $langs->trans('RemainderToPayBack');
else print $langs->trans('ExcessPaydBack');
print ' :</td>';
print '<td align="right" style="border: 1px solid;" bgcolor="#f0f0f0"><b>'.price($sign * $resteapayeraffiche).'</b></td>';
print '<td nowrap="nowrap">&nbsp;</td></tr>';
// Sold credit note // Sold credit note
print '<tr><td colspan="'.$nbcols.'" align="right">'.$langs->trans('TotalTTC').' :</td>'; //print '<tr><td colspan="'.$nbcols.'" align="right">'.$langs->trans('TotalTTC').' :</td>';
print '<td align="right" style="border: 1px solid;" bgcolor="#f0f0f0"><b>'.price(abs($object->total_ttc)).'</b></td><td>&nbsp;</td></tr>'; //print '<td align="right" style="border: 1px solid;" bgcolor="#f0f0f0"><b>'.price($sign * $object->total_ttc).'</b></td><td>&nbsp;</td></tr>';
} }
print '</table>'; print '</table>';

View File

@ -83,7 +83,7 @@ if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='ye
$tmpfacture=new Facture($db); $tmpfacture=new Facture($db);
$tmpfacture->fetch($cursorfacid); $tmpfacture->fetch($cursorfacid);
$amountsresttopay[$cursorfacid]=price2num($tmpfacture->total_ttc-$tmpfacture->getSommePaiement()); $amountsresttopay[$cursorfacid]=price2num($tmpfacture->total_ttc-$tmpfacture->getSommePaiement());
if ($amounts[$cursorfacid] && $amounts[$cursorfacid] > $amountsresttopay[$cursorfacid]) if ($amounts[$cursorfacid] && (abs($amounts[$cursorfacid]) > abs($amountsresttopay[$cursorfacid])))
{ {
$addwarning=1; $addwarning=1;
$formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPay")).' '.$langs->trans("HelpPaymentHigherThanReminderToPay"); $formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPay")).' '.$langs->trans("HelpPaymentHigherThanReminderToPay");
@ -147,6 +147,16 @@ if ($action == 'confirm_paiement' && $confirm == 'yes')
$db->begin(); $db->begin();
// Clean parameters amount if payment is for a credit note
if (GETPOST('type') == 2)
{
foreach ($amounts as $key => $value) // How payment is dispatch
{
$newvalue = price2num($value,'MT');
$amounts[$key] = -$newvalue;
}
}
// Creation of payment line // Creation of payment line
$paiement = new Paiement($db); $paiement = new Paiement($db);
$paiement->datepaye = $datepaye; $paiement->datepaye = $datepaye;
@ -157,7 +167,7 @@ if ($action == 'confirm_paiement' && $confirm == 'yes')
if (! $error) if (! $error)
{ {
$paiement_id = $paiement->create($user,(GETPOST('closepaidinvoices')=='on'?1:0)); $paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0));
if ($paiement_id < 0) if ($paiement_id < 0)
{ {
$errmsg=$paiement->error; $errmsg=$paiement->error;
@ -167,7 +177,9 @@ if ($action == 'confirm_paiement' && $confirm == 'yes')
if (! $error) if (! $error)
{ {
$result=$paiement->addPaymentToBank($user,'payment','(CustomerInvoicePayment)',$_POST['accountid'],$_POST['chqemetteur'],$_POST['chqbank']); $label='(CustomerInvoicePayment)';
if (GETPOST('type') == 2) $label='(CustomerInvoicePaymentBack)';
$result=$paiement->addPaymentToBank($user,'payment',$label,$_POST['accountid'],$_POST['chqemetteur'],$_POST['chqbank']);
if ($result < 0) if ($result < 0)
{ {
$errmsg=$paiement->error; $errmsg=$paiement->error;
@ -227,15 +239,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
dol_htmloutput_errors($errmsg); dol_htmloutput_errors($errmsg);
// Bouchon
if ($facture->type == 2)
{
$langs->load('other');
print $langs->trans("FeatureNotYetAvailable");
llxFooter();
exit;
}
// Initialize data for confirmation (this is used because data can be change during confirmation) // Initialize data for confirmation (this is used because data can be change during confirmation)
if ($action == 'add_paiement') if ($action == 'add_paiement')
{ {
@ -253,6 +256,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
if (! empty($conf->global->PAYPAL_BANK_ACCOUNT)) $accountid=$conf->global->PAYPAL_BANK_ACCOUNT; if (! empty($conf->global->PAYPAL_BANK_ACCOUNT)) $accountid=$conf->global->PAYPAL_BANK_ACCOUNT;
$paymentnum=$facture->ref_int; $paymentnum=$facture->ref_int;
} }
// Add realtime total information
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript" language="javascript">';
@ -296,6 +301,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
var json = {}; var json = {};
var form = $("#payment_form"); var form = $("#payment_form");
json["invoice_type"] = $("#invoice_type").val();
json["amountPayment"] = $("#amountpayment").attr("value"); json["amountPayment"] = $("#amountpayment").attr("value");
json["amounts"] = _elemToJson(form.find("input[name*=\"amount_\"]")); json["amounts"] = _elemToJson(form.find("input[name*=\"amount_\"]"));
json["remains"] = _elemToJson(form.find("input[name*=\"remain_\"]")); json["remains"] = _elemToJson(form.find("input[name*=\"remain_\"]"));
@ -336,7 +342,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
}); });
'; ';
if (! empty($conf->global->MAIN_JS_ON_PAYMENT)) // Add user helper to input amount on invoices
if (! empty($conf->global->MAIN_JS_ON_PAYMENT) && $facture->type != 2)
{ {
print ' $("#payment_form").find("img").click(function() { print ' $("#payment_form").find("img").click(function() {
callForResult(jQuery(this).attr("id")); callForResult(jQuery(this).attr("id"));
@ -356,7 +363,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<input type="hidden" name="action" value="add_paiement">'; print '<input type="hidden" name="action" value="add_paiement">';
print '<input type="hidden" name="facid" value="'.$facture->id.'">'; print '<input type="hidden" name="facid" value="'.$facture->id.'">';
print '<input type="hidden" name="socid" value="'.$facture->socid.'">'; print '<input type="hidden" name="socid" value="'.$facture->socid.'">';
print '<input type="hidden" name="type" value="'.$facture->type.'">'; print '<input type="hidden" name="type" id="invoice_type" value="'.$facture->type.'">';
print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($facture->client->name).'">'; print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($facture->client->name).'">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -462,17 +469,26 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
if ($num > 0) if ($num > 0)
{ {
$sign=1;
if ($facture->type == 2) $sign=-1;
$arraytitle=$langs->trans('Invoice');
if ($facture->type == 2) $arraytitle=$langs->trans("CreditNotes");
$alreadypayedlabel=$langs->trans('Received');
if ($facture->type == 2) $alreadypayedlabel=$langs->trans("PaidBack");
$remaindertopay=$langs->trans('RemainderToTake');
if ($facture->type == 2) $remaindertopay=$langs->trans("RemainderToPayBack");
$i = 0; $i = 0;
//print '<tr><td colspan="3">'; //print '<tr><td colspan="3">';
print '<br>'; print '<br>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Invoice').'</td>'; print '<td>'.$arraytitle.'</td>';
print '<td align="center">'.$langs->trans('Date').'</td>'; print '<td align="center">'.$langs->trans('Date').'</td>';
print '<td align="right">'.$langs->trans('AmountTTC').'</td>'; print '<td align="right">'.$langs->trans('AmountTTC').'</td>';
print '<td align="right">'.$langs->trans('Received').'</td>'; print '<td align="right">'.$alreadypayedlabel.'</td>';
print '<td align="right">'.$langs->trans('RemainderToPay').'</td>'; print '<td align="right">'.$remaindertopay.'</td>';
print '<td align="right">'.$langs->trans('PaymentAmount').'</td>'; print '<td align="right">'.$langs->trans('PaymentAmount').'</td>';
print '<td align="right">&nbsp;</td>'; print '<td align="right">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
@ -505,18 +521,18 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Date // Date
print '<td align="center">'.dol_print_date($db->jdate($objp->df),'day')."</td>\n"; print '<td align="center">'.dol_print_date($db->jdate($objp->df),'day')."</td>\n";
// Prix // Price
print '<td align="right">'.price($objp->total_ttc).'</td>'; print '<td align="right">'.price($sign * $objp->total_ttc).'</td>';
// Recu // Received or paid back
print '<td align="right">'.price($paiement); print '<td align="right">'.price($sign * $paiement);
if ($creditnotes) print '+'.price($creditnotes); if ($creditnotes) print '+'.price($creditnotes);
if ($deposits) print '+'.price($deposits); if ($deposits) print '+'.price($deposits);
print '</td>'; print '</td>';
// Remain to pay // Remain to take or to pay back
print '<td align="right">'.price($remaintopay).'</td>'; print '<td align="right">'.price($sign * $remaintopay).'</td>';
$test= price(price2num($objp->total_ttc - $paiement - $creditnotes - $deposits)); //$test= price(price2num($objp->total_ttc - $paiement - $creditnotes - $deposits));
// Amount // Amount
print '<td align="right">'; print '<td align="right">';
@ -543,7 +559,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Warning // Warning
print '<td align="center" width="16">'; print '<td align="center" width="16">';
if ($amounts[$invoice->id] && $amounts[$invoice->id] > $amountsresttopay[$invoice->id]) //print "xx".$amounts[$invoice->id]."-".$amountsresttopay[$invoice->id]."<br>";
if ($amounts[$invoice->id] && (abs($amounts[$invoice->id]) > abs($amountsresttopay[$invoice->id])))
{ {
print ' '.img_warning($langs->trans("PaymentHigherThanReminderToPay")); print ' '.img_warning($langs->trans("PaymentHigherThanReminderToPay"));
} }
@ -564,12 +581,12 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Print total // Print total
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td colspan="2" align="left">'.$langs->trans('TotalTTC').'</td>'; 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($sign * $total_ttc).'</b></td>';
print '<td align="right"><b>'.price($totalrecu); print '<td align="right"><b>'.price($sign * $totalrecu);
if ($totalrecucreditnote) print '+'.price($totalrecucreditnote); if ($totalrecucreditnote) print '+'.price($totalrecucreditnote);
if ($totalrecudeposits) print '+'.price($totalrecudeposits); if ($totalrecudeposits) print '+'.price($totalrecudeposits);
print '</b></td>'; print '</b></td>';
print '<td align="right"><b>'.price(price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).'</b></td>'; print '<td align="right"><b>'.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).'</b></td>';
print '<td align="right" id="result" style="font-weight: bold;"></td>'; print '<td align="right" id="result" style="font-weight: bold;"></td>';
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
@ -588,15 +605,20 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Bouton Enregistrer // Bouton Enregistrer
if ($action != 'add_paiement') if ($action != 'add_paiement')
{ {
// print '<tr><td colspan="3" align="center">'; $checkboxlabel=$langs->trans("ClosePaidInvoicesAutomatically");
print '<center><br><input type="checkbox" checked="checked" name="closepaidinvoices"> '.$langs->trans("ClosePaidInvoicesAutomatically"); if ($facture->type == 2) $checkboxlabel=$langs->trans("ClosePaidCreditNotesAutomatically");
$buttontitle=$langs->trans('ToMakePayment');
if ($facture->type == 2) $buttontitle=$langs->trans('ToMakePaymentBack');
print '<center><br>';
print '<input type="checkbox" checked="checked" name="closepaidinvoices"> '.$checkboxlabel;
/*if (! empty($conf->prelevement->enabled)) /*if (! empty($conf->prelevement->enabled))
{ {
$langs->load("withdrawals"); $langs->load("withdrawals");
if (! empty($conf->global->WITHDRAW_DISABLE_AUTOCREATE_ONPAYMENTS)) print '<br>'.$langs->trans("IfInvoiceNeedOnWithdrawPaymentWontBeClosed"); if (! empty($conf->global->WITHDRAW_DISABLE_AUTOCREATE_ONPAYMENTS)) print '<br>'.$langs->trans("IfInvoiceNeedOnWithdrawPaymentWontBeClosed");
}*/ }*/
print '<br><input type="submit" class="button" value="'.$langs->trans('Save').'"><br><br></center>'; print '<br><input type="submit" class="button" value="'.dol_escape_htmltag($buttontitle).'"><br><br>';
// print '</td></tr>'; print '</center>';
} }

View File

@ -121,7 +121,8 @@ class Paiement extends CommonObject
/** /**
* Create payment of invoices into database. * Create payment of invoices into database.
* Use this->amounts to have list of invoices for the payment * Use this->amounts to have list of invoices for the payment.
* For payment of a customer invoice, amounts are postive, for payment of credit note, amounts are negative
* *
* @param User $user Object user * @param User $user Object user
* @param int $closepaidinvoices 1=Also close payed invoices to paid, 0=Do nothing more * @param int $closepaidinvoices 1=Also close payed invoices to paid, 0=Do nothing more
@ -189,6 +190,9 @@ class Paiement extends CommonObject
$deposits=$invoice->getSumDepositsUsed(); $deposits=$invoice->getSumDepositsUsed();
$alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT'); $alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT');
$remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT'); $remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT');
//var_dump($invoice->total_ttc.' - '.$paiement.' -'.$creditnotes.' - '.$deposits.' - '.$remaintopay);exit;
// If there is withdrawals request to do and not done yet, we wait before closing. // If there is withdrawals request to do and not done yet, we wait before closing.
$mustwait=0; $mustwait=0;
$listofpayments=$invoice->getListOfPayments(); $listofpayments=$invoice->getListOfPayments();
@ -205,7 +209,7 @@ class Paiement extends CommonObject
} }
} }
if ($invoice->type != 0 && $invoice->type != 1) dol_syslog("Invoice ".$facid." is not a standard nor replacement invoice. We do nothing more."); if ($invoice->type != 0 && $invoice->type != 1 && $invoice->type != 2) dol_syslog("Invoice ".$facid." is not a standard, nor replacement invoice, nor credit note. We do nothing more.");
else if ($remaintopay) dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing more."); else if ($remaintopay) dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing more.");
else if ($mustwait) dol_syslog("There is ".$mustwait." differed payment to process, we do nothing more."); else if ($mustwait) dol_syslog("There is ".$mustwait." differed payment to process, we do nothing more.");
else $result=$invoice->set_paid($user,'',''); else $result=$invoice->set_paid($user,'','');
@ -363,7 +367,7 @@ class Paiement extends CommonObject
/** /**
* A record into bank for payment with links between this bank record and invoices of payment. * A record into bank for payment with links between this bank record and invoices of payment.
* All payment properties must have been set first like after a call to create(). * All payment properties (this->amount, this->amounts, ...) must have been set first like after a call to create().
* *
* @param User $user Object of user making payment * @param User $user Object of user making payment
* @param string $mode 'payment', 'payment_supplier' * @param string $mode 'payment', 'payment_supplier'
@ -401,7 +405,7 @@ class Paiement extends CommonObject
$this->datepaye, $this->datepaye,
$this->paiementid, // Payment mode id or code ("CHQ or VIR for example") $this->paiementid, // Payment mode id or code ("CHQ or VIR for example")
$label, $label,
$totalamount, $totalamount, // Sign must be positive when we receive money (customer payment), negative when you give money (supplier invoice or credit note)
$this->num_paiement, $this->num_paiement,
'', '',
$user, $user,

View File

@ -108,11 +108,11 @@ else
else $sql.= " AND f.fk_user_author = ".$userid; else $sql.= " AND f.fk_user_author = ".$userid;
} }
// Search criteria // Search criteria
if ($_REQUEST["search_ref"]) $sql .=" AND p.rowid=".$_REQUEST["search_ref"]; if (GETPOST("search_ref")) $sql .=" AND p.rowid=".GETPOST("search_ref",'int');
if ($_REQUEST["search_account"]) $sql .=" AND b.fk_account=".$_REQUEST["search_account"]; if (GETPOST("search_account") > 0) $sql .=" AND b.fk_account=".GETPOST("search_account",'int');
if ($_REQUEST["search_paymenttype"]) $sql .=" AND c.code='".$_REQUEST["search_paymenttype"]."'"; if (GETPOST("search_paymenttype") > 0) $sql .=" AND c.code='".GETPOST("search_paymenttype",'int')."'";
if ($_REQUEST["search_amount"]) $sql .=" AND p.amount=".price2num($_REQUEST["search_amount"]); if (GETPOST("search_amount")) $sql .=" AND p.amount=".price2num(GETPOST("search_amount"));
if ($_REQUEST["search_company"]) $sql .=" AND s.nom LIKE '%".$db->escape($_REQUEST["search_company"])."%'"; if (GETPOST("search_company")) $sql .=" AND s.nom LIKE '%".$db->escape(GETPOST("search_company"))."%'";
} }
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1, $offset); $sql.= $db->plimit($limit+1, $offset);

View File

@ -524,7 +524,12 @@ class pdf_crabe extends ModelePDFFactures
*/ */
function _tableau_versements(&$pdf, $object, $posy, $outputlangs) function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
{ {
$tab3_posx = 120; global $conf;
$sign=1;
if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
$tab3_posx = 120;
$tab3_top = $posy + 8; $tab3_top = $posy + 8;
$tab3_width = 80; $tab3_width = 80;
$tab3_height = 4; $tab3_height = 4;
@ -535,9 +540,12 @@ class pdf_crabe extends ModelePDFFactures
$default_font_size = pdf_getPDFFontSize($outputlangs); $default_font_size = pdf_getPDFFontSize($outputlangs);
$title=$outputlangs->transnoentities("PaymentsAlreadyDone");
if ($object->type == 2) $title=$outputlangs->transnoentities("PaymentsBackAlreadyDone");
$pdf->SetFont('','', $default_font_size - 3); $pdf->SetFont('','', $default_font_size - 3);
$pdf->SetXY($tab3_posx, $tab3_top - 4); $pdf->SetXY($tab3_posx, $tab3_top - 4);
$pdf->MultiCell(60, 3, $outputlangs->transnoentities("PaymentsAlreadyDone"), 0, 'L', 0); $pdf->MultiCell(60, 3, $title, 0, 'L', 0);
$pdf->line($tab3_posx, $tab3_top, $tab3_posx+$tab3_width, $tab3_top); $pdf->line($tab3_posx, $tab3_top, $tab3_posx+$tab3_width, $tab3_top);
@ -620,7 +628,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($tab3_posx, $tab3_top+$y); $pdf->SetXY($tab3_posx, $tab3_top+$y);
$pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->date),'day',false,$outputlangs,true), 0, 'L', 0); $pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->date),'day',false,$outputlangs,true), 0, 'L', 0);
$pdf->SetXY($tab3_posx+21, $tab3_top+$y); $pdf->SetXY($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 3, price($row->amount), 0, 'L', 0); $pdf->MultiCell(20, 3, price($sign * $row->amount), 0, 'L', 0);
$pdf->SetXY($tab3_posx+40, $tab3_top+$y); $pdf->SetXY($tab3_posx+40, $tab3_top+$y);
$oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $row->code); $oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $row->code);
@ -1042,7 +1050,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_ttc), $useborder, 'R', 1);
} }
} }

View File

@ -103,6 +103,7 @@ ConciliatedBy=Reconciled by
DateConciliating=Reconcile date DateConciliating=Reconcile date
BankLineConciliated=Transaction reconciled BankLineConciliated=Transaction reconciled
CustomerInvoicePayment=Customer payment CustomerInvoicePayment=Customer payment
CustomerInvoicePaymentBack=Customer payment back
SupplierInvoicePayment=Supplier payment SupplierInvoicePayment=Supplier payment
WithdrawalPayment=Withdrawal payment WithdrawalPayment=Withdrawal payment
SocialContributionPayment=Social contribution payment SocialContributionPayment=Social contribution payment

View File

@ -58,6 +58,7 @@ Payment=Payment
PaymentBack=Payment back PaymentBack=Payment back
Payments=Payments Payments=Payments
PaymentsBack=Payments back PaymentsBack=Payments back
PaidBack=Paid back
DatePayment=Payment date DatePayment=Payment date
DeletePayment=Delete payment DeletePayment=Delete payment
ConfirmDeletePayment=Are you sure you want to delete this payment ? ConfirmDeletePayment=Are you sure you want to delete this payment ?
@ -69,6 +70,7 @@ 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
PaymentsBackAlreadyDone=Payments back already done
PaymentRule=Payment rule PaymentRule=Payment rule
PaymentMode=Payment type PaymentMode=Payment type
PaymentConditions=Payment term PaymentConditions=Payment term
@ -181,10 +183,12 @@ ShowInvoiceDeposit=Show deposit invoice
ShowPayment=Show payment ShowPayment=Show payment
File=File File=File
AlreadyPaid=Already paid AlreadyPaid=Already paid
AlreadyPaidBack=Already paid back
AlreadyPaidNoCreditNotesNoDeposits=Already paid (without credit notes and deposits) AlreadyPaidNoCreditNotesNoDeposits=Already paid (without credit notes and deposits)
Abandoned=Abandoned Abandoned=Abandoned
RemainderToPay=Remainder to pay RemainderToPay=Remainder to pay
RemainderToTake=Remainder to take RemainderToTake=Remainder to take
RemainderToPayBack=Remainder to pay back
AmountExpected=Amount claimed AmountExpected=Amount claimed
ExcessReceived=Excess received ExcessReceived=Excess received
EscompteOffered=Discount offered (payment before term) EscompteOffered=Discount offered (payment before term)
@ -381,7 +385,10 @@ CantRemovePaymentWithOneInvoicePaid=Can't remove payment since there is at least
ExpectedToPay=Expected payment ExpectedToPay=Expected payment
PayedByThisPayment=Payed by this payment PayedByThisPayment=Payed by this payment
ClosePaidInvoicesAutomatically=Classify "Payed" all standard or replacement invoices entierely payed. ClosePaidInvoicesAutomatically=Classify "Payed" all standard or replacement invoices entierely payed.
ClosePaidCreditNotesAutomatically=Classify "Payed" all credit notes entierely paid back.
AllCompletelyPayedInvoiceWillBeClosed=All invoice with no remain to pay will be automatically closed to status "Payed". AllCompletelyPayedInvoiceWillBeClosed=All invoice with no remain to pay will be automatically closed to status "Payed".
ToMakePayment=Pay
ToMakePaymentBack=Pay back
##### Types de contacts ##### ##### Types de contacts #####
TypeContact_facture_internal_SALESREPFOLL=Representative following-up customer invoice TypeContact_facture_internal_SALESREPFOLL=Representative following-up customer invoice
TypeContact_facture_external_BILLING=Customer invoice contact TypeContact_facture_external_BILLING=Customer invoice contact

View File

@ -80,7 +80,6 @@ TotalToPay=Total to pay
TotalVATReceived=Total VAT received TotalVATReceived=Total VAT received
CustomerAccountancyCode=Customer accountancy code CustomerAccountancyCode=Customer accountancy code
SupplierAccountancyCode=Supplier accountancy code SupplierAccountancyCode=Supplier accountancy code
AlreadyPaid=Already paid
AccountNumberShort=Account number AccountNumberShort=Account number
AccountNumber=Account number AccountNumber=Account number
NewAccount=New account NewAccount=New account
@ -109,8 +108,9 @@ AnnualByCompaniesDueDebtMode=Balance of income and expenses, detail by third par
AnnualByCompaniesInputOutputMode=Balance of income and expenses, detail by third parties, mode <b>%sIncomes-Expenses%s</b> said <b>cash accounting</b>. AnnualByCompaniesInputOutputMode=Balance of income and expenses, detail by third parties, mode <b>%sIncomes-Expenses%s</b> said <b>cash accounting</b>.
SeeReportInInputOutputMode=See report <b>%sIncomes-Expenses%s</b> said <b>cash accounting</b> for a calculation on actual payments made SeeReportInInputOutputMode=See report <b>%sIncomes-Expenses%s</b> said <b>cash accounting</b> for a calculation on actual payments made
SeeReportInDueDebtMode=See report <b>%sClaims-Debts%s</b> said <b>commitment accounting</b> for a calculation on issued invoices SeeReportInDueDebtMode=See report <b>%sClaims-Debts%s</b> said <b>commitment accounting</b> for a calculation on issued invoices
RulesResultDue=- Amounts shown are with all taxes included<br>- It includes outstanding invoices, expenses and VAT whether they are paid or not. <br>- It is based on the validation date of invoices and VAT and on the due date for expenses. RulesAmountWithTaxIncluded=- Amounts shown are with all taxes included
RulesResultInOut=- Amounts shown are with all taxes included<br>- It includes the real payments made on invoices, expenses and VAT. <br>- It is based on the payment dates of the invoices, expenses anf VAT.<br> RulesResultDue=- It includes outstanding invoices, expenses and VAT whether they are paid or not. <br>- It is based on the validation date of invoices and VAT and on the due date for expenses.
RulesResultInOut=- It includes the real payments made on invoices, expenses and VAT. <br>- It is based on the payment dates of the invoices, expenses anf VAT.
RulesCADue=- It includes the client's due invoices whether they are paid or not. <br>- It is based on the validation date of these invoices. <br> RulesCADue=- It includes the client's due invoices whether they are paid or not. <br>- It is based on the validation date of these invoices. <br>
RulesCAIn=- It includes all the effective payments of invoices received from clients.<br>- It is based on the payment date of these invoices<br> RulesCAIn=- It includes all the effective payments of invoices received from clients.<br>- It is based on the payment date of these invoices<br>
DepositsAreNotIncluded=- Deposit invoices are nor included DepositsAreNotIncluded=- Deposit invoices are nor included

View File

@ -103,6 +103,7 @@ ConciliatedBy=Rapproché par
DateConciliating=Date rapprochement DateConciliating=Date rapprochement
BankLineConciliated=Écriture rapprochée BankLineConciliated=Écriture rapprochée
CustomerInvoicePayment=Règlement client CustomerInvoicePayment=Règlement client
CustomerInvoicePaymentBack=Remboursement client
SupplierInvoicePayment=Règlement fournisseur SupplierInvoicePayment=Règlement fournisseur
WithdrawalPayment=Règlement bon de prélèvement WithdrawalPayment=Règlement bon de prélèvement
SocialContributionPayment=Règlement charge sociale SocialContributionPayment=Règlement charge sociale

View File

@ -47,12 +47,14 @@ InvoiceCustomer=Facture client
CustomerInvoice=Facture client CustomerInvoice=Facture client
CustomersInvoices=Factures clients CustomersInvoices=Factures clients
SupplierInvoice=Facture fournisseur SupplierInvoice=Facture fournisseur
SuppliersInvoices=Factures fournisseurs
SupplierBill=Facture fournisseur SupplierBill=Facture fournisseur
SupplierBills=Factures fournisseurs SupplierBills=Factures fournisseurs
Payment=Règlement Payment=Règlement
PaymentBack=Remboursement PaymentBack=Remboursement
Payments=Règlements Payments=Règlements
PaymentsBack=Remboursements PaymentsBack=Remboursements
PaidBack=Remboursé
DatePayment=Date paiement DatePayment=Date paiement
DeletePayment=Supprimer le paiement DeletePayment=Supprimer le paiement
ConfirmDeletePayment=Êtes-vous sûr de vouloir supprimer ce paiement ? ConfirmDeletePayment=Êtes-vous sûr de vouloir supprimer ce paiement ?
@ -64,6 +66,7 @@ ReceivedCustomersPaymentsToValid=Règlements clients reçus à valider
PaymentsReportsForYear=Rapports de règlements pour %s PaymentsReportsForYear=Rapports de règlements pour %s
PaymentsReports=Rapports de règlements PaymentsReports=Rapports de règlements
PaymentsAlreadyDone=Versements déjà effectués PaymentsAlreadyDone=Versements déjà effectués
PaymentsBackAlreadyDone=Remboursements déjà effectués
PaymentMode=Mode de règlement PaymentMode=Mode de règlement
PaymentConditions=Conditions de règlement PaymentConditions=Conditions de règlement
PaymentConditionsShort=Conditions règlement PaymentConditionsShort=Conditions règlement
@ -86,7 +89,7 @@ DoPayment=Émettre règlement
DoPaymentBack=Émettre remboursement DoPaymentBack=Émettre remboursement
ConvertToReduc=Convertir en réduction future ConvertToReduc=Convertir en réduction future
EnterPaymentReceivedFromCustomer=Saisie d'un règlement reçu du client EnterPaymentReceivedFromCustomer=Saisie d'un règlement reçu du client
EnterPaymentDueToCustomer=Réaliser règlement d'avoirs dus au client EnterPaymentDueToCustomer=Saisie d'un remboursement d'un avoir client
DisabledBecauseRemainderToPayIsZero=Désactivé car reste à payer est nul DisabledBecauseRemainderToPayIsZero=Désactivé car reste à payer est nul
Amount=Montant Amount=Montant
PriceBase=Base du prix PriceBase=Base du prix
@ -175,10 +178,12 @@ ShowInvoiceDeposit=Afficher facture d'acompte
ShowPayment=Afficher règlement ShowPayment=Afficher règlement
File=Fichier File=Fichier
AlreadyPaid=Déjà réglé AlreadyPaid=Déjà réglé
AlreadyPaidBack=Déjà remboursé
AlreadyPaidNoCreditNotesNoDeposits=Déjà réglé (hors avoirs et acomptes) AlreadyPaidNoCreditNotesNoDeposits=Déjà réglé (hors avoirs et acomptes)
Abandoned=Abandonné Abandoned=Abandonné
RemainderToPay=Reste à payer RemainderToPay=Reste à payer
RemainderToTake=Reste à encaisser RemainderToTake=Reste à encaisser
RemainderToPayBack=Reste à rembourser
AmountExpected=Montant réclamé AmountExpected=Montant réclamé
ExcessReceived=Trop perçu ExcessReceived=Trop perçu
EscompteOffered=Escompte (règlement avant échéance) EscompteOffered=Escompte (règlement avant échéance)
@ -377,7 +382,10 @@ CantRemovePaymentWithOneInvoicePaid=Suppression impossible quand il existe au mo
ExpectedToPay=Paiement attendu ExpectedToPay=Paiement attendu
PayedByThisPayment=Règlé par ce paiement PayedByThisPayment=Règlé par ce paiement
ClosePaidInvoicesAutomatically=Classer automatiquement à "Payé" les factures standards et de remplacement entièrement payées. ClosePaidInvoicesAutomatically=Classer automatiquement à "Payé" les factures standards et de remplacement entièrement payées.
ClosePaidCreditNotesAutomatically=Classer automatiquement à "Payé" les factures avoirs entièrement remboursées.
AllCompletelyPayedInvoiceWillBeClosed=Toutes les factures avec un reste à payer nul seront automatiquement fermées au statut "Payé". AllCompletelyPayedInvoiceWillBeClosed=Toutes les factures avec un reste à payer nul seront automatiquement fermées au statut "Payé".
ToMakePayment=Payer
ToMakePaymentBack=Rembourser
##### Types de contacts ##### ##### Types de contacts #####
TypeContact_facture_internal_SALESREPFOLL=Responsable suivi facture client TypeContact_facture_internal_SALESREPFOLL=Responsable suivi facture client
TypeContact_facture_external_BILLING=Contact client facturation TypeContact_facture_external_BILLING=Contact client facturation

View File

@ -80,7 +80,6 @@ TotalToPay=Total à payer
TotalVATReceived=Total TVA perçue TotalVATReceived=Total TVA perçue
CustomerAccountancyCode=Compte comptable client CustomerAccountancyCode=Compte comptable client
SupplierAccountancyCode=Compte comptable fournisseur SupplierAccountancyCode=Compte comptable fournisseur
AlreadyPaid=Déjà réglé
AccountNumberShort=N° du compte AccountNumberShort=N° du compte
AccountNumber=Numéro du compte AccountNumber=Numéro du compte
NewAccount=Nouveau compte NewAccount=Nouveau compte
@ -109,8 +108,9 @@ AnnualByCompaniesDueDebtMode=Bilan des recettes et dépenses, détail par tiers,
AnnualByCompaniesInputOutputMode=Bilan des recettes et dépenses, détail par tiers, en mode <b>%sRecettes-Dépenses%s</b> dit <b>comptabilité de caisse</b>. AnnualByCompaniesInputOutputMode=Bilan des recettes et dépenses, détail par tiers, en mode <b>%sRecettes-Dépenses%s</b> dit <b>comptabilité de caisse</b>.
SeeReportInInputOutputMode=Voir le rapport <b>%sRecettes-Dépenses%s</b> dit <b>comptabilité de caisse</b> pour un calcul sur les paiements effectivement réalisés SeeReportInInputOutputMode=Voir le rapport <b>%sRecettes-Dépenses%s</b> dit <b>comptabilité de caisse</b> pour un calcul sur les paiements effectivement réalisés
SeeReportInDueDebtMode=Voir le rapport <b>%sCréances-Dettes%s</b> dit <b>comptabilité d'engagement</b> pour un calcul sur les factures émises SeeReportInDueDebtMode=Voir le rapport <b>%sCréances-Dettes%s</b> dit <b>comptabilité d'engagement</b> pour un calcul sur les factures émises
RulesResultDue=- Les montants affichés sont les montants taxe incluse<br>- Il inclut les factures, charges et tva dues, qu'elles soient payées ou non.<br>- Il se base sur la date de validation pour les factures et la tva et sur la date d'échéance pour les charges.<br> RulesAmountWithTaxIncluded=- Les montants affichés sont les montants taxe incluse
RulesResultInOut=- Les montants affichés sont les montants taxe incluse<br>- Il inclut les règlements effectivement réalisés pour les factures, les charges et la TVA.<br>- Il se base sur la date de règlement de ces factures, charges et TVA.<br> RulesResultDue=- Il inclut les factures, charges et tva dues, qu'elles soient payées ou non.<br>- Il se base sur la date de validation pour les factures et la tva et sur la date d'échéance pour les charges.
RulesResultInOut=- Il inclut les règlements effectivement réalisés pour les factures, les charges et la TVA.<br>- Il se base sur la date de règlement de ces factures, charges et TVA.
RulesCADue=- Il inclut les factures clients dues, qu'elles soient payées ou non.<br>- Il se base sur la date de validation de ces factures.<br> RulesCADue=- Il inclut les factures clients dues, qu'elles soient payées ou non.<br>- Il se base sur la date de validation de ces factures.<br>
RulesCAIn=- Il inclut les règlements effectivement reçus des factures clients.<br>- Il se base sur la date de règlement de ces factures<br> RulesCAIn=- Il inclut les règlements effectivement reçus des factures clients.<br>- Il se base sur la date de règlement de ces factures<br>
DepositsAreNotIncluded=- Les factures d'accomptes ne sont pas incluses DepositsAreNotIncluded=- Les factures d'accomptes ne sont pas incluses