diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php
index d8be1a78a5c..c40c99b6c2a 100644
--- a/htdocs/compta/bank/account.php
+++ b/htdocs/compta/bank/account.php
@@ -38,7 +38,7 @@ require_once(DOL_DOCUMENT_ROOT."/fourn/facture/paiementfourn.class.php");
// Security check
if (!$user->rights->banque->lire)
- accessforbidden();
+accessforbidden();
$langs->load("bills");
@@ -59,27 +59,27 @@ $mesg='';
/*
-* Action
-*/
+ * Action
+ */
$dateop=-1;
if ($_POST["action"] == 'add' && $account && ! isset($_POST["cancel"]) && $user->rights->banque->modifier)
{
if (price2num($_POST["credit"]) > 0)
- {
- $amount = price2num($_POST["credit"]);
- }
- else
- {
- $amount = - price2num($_POST["debit"]);
- }
+ {
+ $amount = price2num($_POST["credit"]);
+ }
+ else
+ {
+ $amount = - price2num($_POST["debit"]);
+ }
- $dateop = dol_mktime(12,0,0,$_POST["opmonth"],$_POST["opday"],$_POST["opyear"]);
- $operation=$_POST["operation"];
- $num_chq=$_POST["num_chq"];
- $label=$_POST["label"];
- $cat1=$_POST["cat1"];
+ $dateop = dol_mktime(12,0,0,$_POST["opmonth"],$_POST["opday"],$_POST["opyear"]);
+ $operation=$_POST["operation"];
+ $num_chq=$_POST["num_chq"];
+ $label=$_POST["label"];
+ $cat1=$_POST["cat1"];
if (! $dateop) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Date"));
if (! $operation) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Type"));
@@ -87,17 +87,17 @@ if ($_POST["action"] == 'add' && $account && ! isset($_POST["cancel"]) && $user-
if (! $mesg)
{
- $acct=new Account($db,$account);
- $insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user);
- if ($insertid > 0)
- {
- Header("Location: account.php?account=" . $account);
- exit;
- }
- else
- {
- dol_print_error($db,$acct->error);
- }
+ $acct=new Account($db,$account);
+ $insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user);
+ if ($insertid > 0)
+ {
+ Header("Location: account.php?account=" . $account);
+ exit;
+ }
+ else
+ {
+ dol_print_error($db,$acct->error);
+ }
}
else
{
@@ -113,8 +113,8 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"]=='yes' && $user->r
/*
-* View
-*/
+ * View
+ */
llxHeader();
@@ -271,8 +271,8 @@ if ($account || $_GET["ref"])
/**
- * Search form
- */
+ * Search form
+ */
// Define transaction list navigation string
$navig='';
@@ -364,9 +364,9 @@ if ($account || $_GET["ref"])
}
/*
- * Affiche tableau des transactions bancaires
- *
- */
+ * Affiche tableau des transactions bancaires
+ *
+ */
// Ligne de titre tableau des ecritures
print '
';
@@ -399,9 +399,9 @@ if ($account || $_GET["ref"])
print "\n";
/* Another solution
- * create temporary table solde type=heap select amount from llx_bank limit 100 ;
- * select sum(amount) from solde ;
- */
+ * create temporary table solde type=heap select amount from llx_bank limit 100 ;
+ * select sum(amount) from solde ;
+ */
$sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do,".$db->pdate("b.datev")." as dv,";
$sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type";
@@ -444,53 +444,53 @@ if ($account || $_GET["ref"])
if ($result)
{
$total = 0;
- $time = time();
+ $time = time();
- $var=true;
+ $var=true;
- $num = $db->num_rows($result);
- $i = 0; $total = 0; $sep = 0;
+ $num = $db->num_rows($result);
+ $i = 0; $total = 0; $sep = 0;
- while ($i < $num)
- {
- $objp = $db->fetch_object($result);
- $total = $total + $objp->amount;
- if ($i >= ($nbline - $viewline))
- {
- $var=!$var;
+ while ($i < $num)
+ {
+ $objp = $db->fetch_object($result);
+ $total = $total + $objp->amount;
+ if ($i >= ($nbline - $viewline))
+ {
+ $var=!$var;
- if ($objp->do > $time && !$sep)
- {
- $sep = 1 ;
- print "
| | ";
- print "".price($total - $objp->amount)." | ";
- print " | ";
- print '
';
- }
+ if ($objp->do > $time && !$sep)
+ {
+ $sep = 1 ;
+ print "| | ";
+ print "".price($total - $objp->amount)." | ";
+ print " | ";
+ print '
';
+ }
- print "";
+ print "
";
- print "| ".dol_print_date($objp->do,"day")." | \n";
+ print "".dol_print_date($objp->do,"day")." | \n";
- print " ".dol_print_date($objp->dv,"day")." | \n";
+ print " ".dol_print_date($objp->dv,"day")." | \n";
- print " ".$langs->trans($objp->fk_type)." ".($objp->num_chq?$objp->num_chq:"")." | \n";
+ print " ".$langs->trans($objp->fk_type)." ".($objp->num_chq?$objp->num_chq:"")." | \n";
- // Description
- print '';
+ // Description
+ print ' | ';
- $links = $acct->get_url($objp->rowid);
+ $links = $acct->get_url($objp->rowid);
- $isbanktransfert=false;
- foreach($links as $key=>$val) { if ($val['type']=='banktransfert') $isbanktransfert=true; }
- $issocialcontrib=false;
- foreach($links as $key=>$val) { if ($val['type']=='sc') $issocialcontrib=true; }
+ $isbanktransfert=false;
+ foreach($links as $key=>$val) { if ($val['type']=='banktransfert') $isbanktransfert=true; }
+ $issocialcontrib=false;
+ foreach($links as $key=>$val) { if ($val['type']=='sc') $issocialcontrib=true; }
- $showlabel=true;
- //if (sizeof($links) == 0) $showlabel=true;
- //if ($isbanktransfert || $issocialcontrib) $showlabel=true;
- if ($showlabel)
- {
+ $showlabel=true;
+ //if (sizeof($links) == 0) $showlabel=true;
+ //if ($isbanktransfert || $issocialcontrib) $showlabel=true;
+ if ($showlabel)
+ {
if (eregi('^\((.*)\)$',$objp->label,$reg))
{
// Genereic description because between (). We show it after translating.
@@ -498,28 +498,29 @@ if ($account || $_GET["ref"])
}
else
{
- print dol_trunc($objp->label,60);
- }
- }
+ print dol_trunc($objp->label,60);
+ }
+ }
- // Add links in description field
- foreach($links as $key=>$val)
- {
- if ($links[$key]['type']=='payment') {
- $paymentstatic->id=$links[$key]['url_id'];
- print ' '.$paymentstatic->getNomUrl(2);
- }
- else if ($links[$key]['type']=='payment_supplier') {
- $paymentsupplierstatic->id=$links[$key]['url_id'];
- $paymentsupplierstatic->ref=$links[$key]['url_id'];
- print ' '.$paymentsupplierstatic->getNomUrl(2);
- }
- else if ($links[$key]['type']=='company') {
- }
+ // Add links in description field
+ foreach($links as $key=>$val)
+ {
+ if ($links[$key]['type']=='payment') {
+ $paymentstatic->id=$links[$key]['url_id'];
+ print ' '.$paymentstatic->getNomUrl(2);
+ }
+ else if ($links[$key]['type']=='payment_supplier') {
+ $paymentsupplierstatic->id=$links[$key]['url_id'];
+ $paymentsupplierstatic->ref=$links[$key]['url_id'];
+ print ' '.$paymentsupplierstatic->getNomUrl(2);
+ }
+ else if ($links[$key]['type']=='company') {
+ }
else if ($links[$key]['type']=='sc') { // This is waiting for card to link to payment_sc
- $chargestatic->id=$links[$key]['url_id'];
- $chargestatic->ref=$links[$key]['url_id'];
- print ' '.$chargestatic->getNomUrl(2);
+ $chargestatic->id=$links[$key]['url_id'];
+ $chargestatic->ref=$links[$key]['url_id'];
+ $chargestatic->lib=$langs->trans("SocialContribution");
+ print ' '.$chargestatic->getNomUrl(2);
}
else if ($links[$key]['type']=='payment_sc')
{
@@ -533,9 +534,9 @@ if ($account || $_GET["ref"])
}
else if ($links[$key]['type']=='payment_vat')
{
- $paymentvatstatic->id=$links[$key]['url_id'];
+ $paymentvatstatic->id=$links[$key]['url_id'];
$paymentvatstatic->ref=$links[$key]['url_id'];
- print ' '.$paymentvatstatic->getNomUrl(2);
+ print ' '.$paymentvatstatic->getNomUrl(2);
}
else if ($links[$key]['type']=='banktransfert') {
/* Do not show this link (avoid confusion). Can already be accessed from transaction detail */
@@ -544,7 +545,7 @@ if ($account || $_GET["ref"])
}
else {
//print ' - ';
- print '';
+ print '';
if (eregi('^\((.*)\)$',$links[$key]['label'],$reg))
{
// Label générique car entre parenthèses. On l'affiche en le traduisant
@@ -553,111 +554,111 @@ if ($account || $_GET["ref"])
}
else
{
- print $links[$key]['label'];
- }
- print '';
- }
- }
- print ' | ';
+ print $links[$key]['label'];
+ }
+ print '';
+ }
+ }
+ print '';
- // Add third party column
+ // Add third party column
print '';
foreach($links as $key=>$val)
- {
- if ($links[$key]['type']=='company') {
- $societestatic->id=$links[$key]['url_id'];
+ {
+ if ($links[$key]['type']=='company') {
+ $societestatic->id=$links[$key]['url_id'];
$societestatic->nom=$links[$key]['label'];
print $societestatic->getNomUrl(1,'',16);
- }
+ }
/*else if ($links[$key]['type']=='sc') {
- $chargestatic->id=$links[$key]['url_id'];
+ $chargestatic->id=$links[$key]['url_id'];
if (eregi('^\((.*)\)$',$links[$key]['label'],$reg))
{
- if ($reg[1]=='socialcontribution') $reg[1]='SocialContribution';
- $chargestatic->lib=$langs->trans($reg[1]);
+ if ($reg[1]=='socialcontribution') $reg[1]='SocialContribution';
+ $chargestatic->lib=$langs->trans($reg[1]);
}
else
{
- $chargestatic->lib=$links[$key]['label'];
+ $chargestatic->lib=$links[$key]['label'];
}
print $chargestatic->getNomUrl(1,'',16);
- }*/
+ }*/
else if ($links[$key]['type']=='member') {
- $memberstatic->id=$links[$key]['url_id'];
+ $memberstatic->id=$links[$key]['url_id'];
$memberstatic->ref=$links[$key]['label'];
print $memberstatic->getNomUrl(1,16,'card');
}
- }
- print ' | ';
+ }
+ print '';
- if ($objp->amount < 0)
- {
- print "".price($objp->amount * -1)." | | \n";
- }
- else
- {
- print " | ".price($objp->amount)." | \n";
- }
+ if ($objp->amount < 0)
+ {
+ print "".price($objp->amount * -1)." | | \n";
+ }
+ else
+ {
+ print " | ".price($objp->amount)." | \n";
+ }
- if ($action != 'search')
- {
- if ($total >= 0)
- {
- print ' '.price($total).' | ';
- }
- else
- {
- print ' '.price($total).' | ';
- }
- }
- else
- {
- print '- | ';
- }
-
- // Relevé rappro ou lien edition
- if ($objp->rappro && $acct->type != 2) // Si non compte cash
- {
- print "";
- print '';
- print img_view();
- print '';
- print " ";
- print "num_releve&account=$acct->id\">$objp->num_releve";
- print " | ";
- }
- else
- {
- print '';
- if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
- {
- print '';
- print img_edit();
- print '';
+ if ($action != 'search')
+ {
+ if ($total >= 0)
+ {
+ print ' | '.price($total).' | ';
}
else
{
- print '';
- print img_view();
- print '';
+ print ' '.price($total).' | ';
+ }
+ }
+ else
+ {
+ print '- | ';
+ }
+
+ // Relevé rappro ou lien edition
+ if ($objp->rappro && $acct->type != 2) // Si non compte cash
+ {
+ print "";
+ print '';
+ print img_view();
+ print '';
+ print " ";
+ print "num_releve&account=$acct->id\">$objp->num_releve";
+ print " | ";
+ }
+ else
+ {
+ print '';
+ if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
+ {
+ print '';
+ print img_edit();
+ print '';
+ }
+ else
+ {
+ print '';
+ print img_view();
+ print '';
}
print ' ';
- if ($user->rights->banque->modifier)
- {
- print '';
- print img_delete();
- print '';
- }
+ if ($user->rights->banque->modifier)
+ {
+ print '';
+ print img_delete();
+ print '';
+ }
print ' | ';
- }
+ }
- print "
";
+ print "";
- }
+ }
- $i++;
- }
+ $i++;
+ }
// Affichage total
if ($page == 0 && ! $mode_search)
@@ -680,8 +681,8 @@ if ($account || $_GET["ref"])
print "\n\n";
/*
- * Boutons actions
- */
+ * Boutons actions
+ */
if ($_GET["action"] != 'addline' && $_GET["action"] != 'delete')
{
print '';
diff --git a/htdocs/compta/bank/rappro.php b/htdocs/compta/bank/rappro.php
index 1dc10c8dd31..79093fbe799 100644
--- a/htdocs/compta/bank/rappro.php
+++ b/htdocs/compta/bank/rappro.php
@@ -25,6 +25,13 @@
*/
require("./pre.inc.php");
+require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/societe.class.php");
+require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
+require_once(DOL_DOCUMENT_ROOT."/chargesociales.class.php");
+require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
+require_once(DOL_DOCUMENT_ROOT."/compta/tva/tva.class.php");
+require_once(DOL_DOCUMENT_ROOT."/fourn/facture/paiementfourn.class.php");
$langs->load("banks");
$langs->load("bills");
@@ -54,17 +61,17 @@ if ($user->rights->banque->consolidate && $_POST["action"] == 'rappro')
{
// Definition, nettoyage parametres
$num_releve=trim($_POST["num_releve"]);
-
+
if ($num_releve)
{
$bankline=new AccountLine($db);
$result=$bankline->fetch($_POST["rowid"]);
$bankline->num_releve=$_POST["num_releve"];
-
+
$result=$bankline->update_conciliation($user,$_POST["cat"]);
if ($result < 0) $mesg=$bankline->error;
}
- else
+ else
{
$langs->load("errors");
$mesg='
'.$langs->trans("ErrorPleaseTypeBankTransactionReportName").'
';
@@ -111,6 +118,13 @@ $form=new Form($db);
llxHeader();
+$societestatic=new Societe($db);
+$chargestatic=new ChargeSociales($db);
+$memberstatic=new Adherent($db);
+$paymentstatic=new Paiement($db);
+$paymentsupplierstatic=new PaiementFourn($db);
+$paymentvatstatic=new TVA($db);
+
$acct = new Account($db);
$acct->fetch($_GET["account"]);
@@ -189,7 +203,7 @@ if ($resql)
// Date op
print '
'.dol_print_date($objp->do,"day").' | ';
-
+
// Date value
if (! $objp->rappro && ($user->rights->banque->modifier || $user->rights->banque->consolidate))
{
@@ -208,7 +222,7 @@ if ($resql)
print dol_print_date($objp->dv,"day");
print '';
}
-
+
// Number
print '
'.$objp->type.($objp->num_chq?' '.$objp->num_chq:'').' | ';
@@ -219,7 +233,7 @@ if ($resql)
if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]);
else print $objp->label;
print '';
-
+
/*
* Ajout les liens (societe, company...)
*/
@@ -230,26 +244,14 @@ if ($resql)
if (! $newline) print ' - ';
else print '
';
if ($links[$key]['type']=='payment') {
- print '
';
- print img_object($langs->trans('ShowPayment'),'payment').' ';
- print $langs->trans("Payment");
- print '';
+ $paymentstatic->id=$links[$key]['url_id'];
+ print ' '.$paymentstatic->getNomUrl(2);
$newline=0;
}
elseif ($links[$key]['type']=='payment_supplier') {
- print '
';
- if (eregi('^\((.*)\)$',$links[$key]['label'],$reg))
- {
- // Label générique car entre parenthèses. On l'affiche en le traduisant
- if ($reg[1]=='paiement') $reg[1]='Payment';
- print img_object($langs->trans('ShowPayment'),'payment').' ';
- print $langs->trans($reg[1]);
- }
- else
- {
- print $links[$key]['label'];
- }
- print '';
+ $paymentsupplierstatic->id=$links[$key]['url_id'];
+ $paymentsupplierstatic->ref=$links[$key]['label'];
+ print ' '.$paymentsupplierstatic->getNomUrl(1);
$newline=0;
}
elseif ($links[$key]['type']=='company') {
@@ -260,16 +262,33 @@ if ($resql)
$newline=0;
}
else if ($links[$key]['type']=='sc') {
- print '
';
- print img_object($langs->trans('ShowBill'),'bill').' ';
- print $langs->trans("SocialContribution");
- print '';
+ $chargestatic->id=$links[$key]['url_id'];
+ $chargestatic->ref=$links[$key]['url_id'];
+ $chargestatic->lib=$langs->trans("SocialContribution");
+ print ' '.$chargestatic->getNomUrl(1);
}
- else if ($links[$key]['type']=='payment_sc') {
+ else if ($links[$key]['type']=='payment_sc')
+ {
+ //print ' - ';
+ /*
print '
';
- print img_object($langs->trans('ShowPayment'),'payment').' ';
+ //print img_object($langs->trans('ShowPayment'),'payment').' ';
print $langs->trans("SocialContributionPayment");
print '';
+ */
+ }
+ else if ($links[$key]['type']=='payment_vat')
+ {
+ $paymentvatstatic->id=$links[$key]['url_id'];
+ $paymentvatstatic->ref=$links[$key]['url_id'];
+ $paymentvatstatic->ref=$langs->trans("VATPayment");
+ print ' '.$paymentvatstatic->getNomUrl(1);
+ }
+ else if ($links[$key]['type']=='banktransfert') {
+ print '
';
+ print img_object($langs->trans('ShowTransaction'),'payment').' ';
+ print $langs->trans("TransactionOnTheOtherAccount");
+ print '';
}
else if ($links[$key]['type']=='member') {
print '
';
@@ -277,16 +296,20 @@ if ($resql)
print $links[$key]['label'];
print '';
}
- else if ($links[$key]['type']=='banktransfert') {
- print '
';
- print img_object($langs->trans('ShowTransaction'),'payment').' ';
- print $langs->trans("TransactionOnTheOtherAccount");
+ else {
+ //print ' - ';
+ print '';
+ if (eregi('^\((.*)\)$',$links[$key]['label'],$reg))
+ {
+ // Label générique car entre parenthèses. On l'affiche en le traduisant
+ if ($reg[1]=='paiement') $reg[1]='Payment';
+ print $langs->trans($reg[1]);
+ }
+ else
+ {
+ print $links[$key]['label'];
+ }
print '';
- }
- else {
- print '
';
- print $links[$key]['label'];
- print '';
$newline=0;
}
}
diff --git a/htdocs/fourn/facture/paiementfourn.class.php b/htdocs/fourn/facture/paiementfourn.class.php
index de92415a2ef..f9666be8017 100644
--- a/htdocs/fourn/facture/paiementfourn.class.php
+++ b/htdocs/fourn/facture/paiementfourn.class.php
@@ -482,11 +482,20 @@ class PaiementFourn
$lien = '
';
$lienfin='';
+ $text=$this->ref; // Sometimes ref contains label
+ if (eregi('^\((.*)\)$',$text,$reg))
+ {
+ // Label générique car entre parenthèses. On l'affiche en le traduisant
+ if ($reg[1]=='paiement') $reg[1]='Payment';
+ $text=$langs->trans($reg[1]);
+ }
+
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowPayment"),'payment').$lienfin);
if ($withpicto && $withpicto != 2) $result.=' ';
- if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
+ if ($withpicto != 2) $result.=$lien.$text.$lienfin;
return $result;
}
+
/**
* \brief Updates the payment number
* \param string New num