diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index aee7d7172c6..4174ee7809f 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -369,22 +369,23 @@ class AccountingAccount extends CommonObject */ function getNomUrl($withpicto = 0) { global $langs; - + $result = ''; - + $link = ''; $linkend = ''; - + $picto = 'billr'; - + $label = $langs->trans("Show") . ': ' . $this->account_number . ' - ' . $this->label; - + if ($withpicto) $result .= ($link . img_object($label, $picto) . $linkend); if ($withpicto && $withpicto != 2) $result .= ' '; if ($withpicto != 2) - $result .= $link . $this->account_number . $linkend; + require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; + $result .= $link . length_accountg($this->account_number) . ' - ' . $this->label . $linkend; return $result; } diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 94bf08867e4..2cbd75146df 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -97,6 +97,7 @@ class PaymentVarious extends CommonObject $sql.= " num_payment='".$this->num_payment."',"; $sql.= " label='".$this->db->escape($this->label)."',"; $sql.= " note='".$this->db->escape($this->note)."',"; + $sql.= " accountancy_code='".$this->db->escape($this->accountancy_code)."',"; $sql.= " fk_bank=".($this->fk_bank > 0 ? "'".$this->fk_bank."'":"null").","; $sql.= " fk_user_author='".$this->fk_user_author."',"; $sql.= " fk_user_modif='".$this->fk_user_modif."'"; @@ -154,6 +155,7 @@ class PaymentVarious extends CommonObject $sql.= " v.num_payment,"; $sql.= " v.label,"; $sql.= " v.note,"; + $sql.= " v.accountancy_code,"; $sql.= " v.fk_bank,"; $sql.= " v.fk_user_author,"; $sql.= " v.fk_user_modif,"; @@ -173,23 +175,25 @@ class PaymentVarious extends CommonObject { $obj = $this->db->fetch_object($resql); - $this->id = $obj->rowid; - $this->ref = $obj->rowid; - $this->tms = $this->db->jdate($obj->tms); - $this->fk_user = $obj->fk_user; - $this->datep = $this->db->jdate($obj->datep); - $this->datev = $this->db->jdate($obj->datev); - $this->amount = $obj->amount; - $this->type_payement = $obj->fk_typepayment; - $this->num_payment = $obj->num_payment; - $this->label = $obj->label; - $this->note = $obj->note; - $this->fk_bank = $obj->fk_bank; - $this->fk_user_author = $obj->fk_user_author; - $this->fk_user_modif = $obj->fk_user_modif; - $this->fk_account = $obj->fk_account; - $this->fk_type = $obj->fk_type; - $this->rappro = $obj->rappro; + $this->id = $obj->rowid; + $this->ref = $obj->rowid; + $this->tms = $this->db->jdate($obj->tms); + $this->fk_user = $obj->fk_user; + $this->datep = $this->db->jdate($obj->datep); + $this->datev = $this->db->jdate($obj->datev); + $this->sens = $obj->sens; + $this->amount = $obj->amount; + $this->type_payement = $obj->fk_typepayment; + $this->num_payment = $obj->num_payment; + $this->label = $obj->label; + $this->note = $obj->note; + $this->accountancy_code = $obj->accountancy_code; + $this->fk_bank = $obj->fk_bank; + $this->fk_user_author = $obj->fk_user_author; + $this->fk_user_modif = $obj->fk_user_modif; + $this->fk_account = $obj->fk_account; + $this->fk_type = $obj->fk_type; + $this->rappro = $obj->rappro; } $this->db->free($resql); @@ -356,12 +360,14 @@ class PaymentVarious extends CommonObject if ($result <= 0) dol_print_error($this->db); // Insert payment into llx_bank - // Add link 'payment_salary' in bank_url between payment and bank transaction + // Add link 'payment_various' in bank_url between payment and bank transaction + if ($this->sens == '0') $sign='-'; + $bank_line_id = $acc->addline( $this->datep, $this->type_payment, $this->label, - -abs($this->amount), + $sign.abs($this->amount), $this->num_payment, '', $user diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index e5c6e81eba8..1c3e1c0ac93 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -382,7 +382,7 @@ if ($result) else if ($links[$key]['type']=='payment_various') { print ''; print img_object($langs->trans('ShowVariousPayment'),'payment').' '; - print $langs->trans("SalaryPayment"); + print $langs->trans("VariousPayment"); print ''; } else { diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 0c2b5256c2c..9e32941bab9 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -26,8 +26,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; -if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; $langs->load("compta"); $langs->load("banks"); @@ -317,7 +317,7 @@ if ($id) $linkback = ''.$langs->trans("BackToList").''; print ""; - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', ''); print ''; @@ -325,15 +325,35 @@ if ($id) print ''.$langs->trans("Label").''.$object->label.''; print ""; - print ''.$langs->trans("DatePayment").''; + print ''.$langs->trans("DatePayment").''; print dol_print_date($object->datep,'day'); print ''; - print ''.$langs->trans("DateValue").''; + print ''.$langs->trans("DateValue").''; print dol_print_date($object->datev,'day'); print ''; - print ''.$langs->trans("Amount").''.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).''; + // Debit / Credit + if ($object->sens == '1') $sens = $langs->trans("Credit"); else $sens = $langs->trans("Debit"); + print ''.$langs->trans("Sens").''.$sens.''; + + print ''.$langs->trans("Amount").''.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).''; + + // Accountancy code + print ''; + print $langs->trans("AccountAccounting"); + print ''; + if (! empty($conf->accounting->enabled)) + { + $accountancyaccount = new AccountingAccount($db); + $accountancyaccount->fetch('',$object->accountancy_code); + + print $accountancyaccount->getNomUrl(1); + // print length_accountg($object->accountancy_code); + } else { + print $object->accountancy_code; + } + print ''; if (! empty($conf->banque->enabled)) { @@ -352,7 +372,7 @@ if ($id) } // Other attributes - $parameters=array('colspan' => ' colspan="3"'); + $parameters=array('colspan' => ' colspan="1"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print ''; @@ -366,7 +386,7 @@ if ($id) print '
'."\n"; if ($object->rappro == 0) { - if (! empty($user->rights->salaries->delete)) + if (! empty($user->rights->banque->delete)) { print ''.$langs->trans("Delete").''; } diff --git a/htdocs/compta/bank/various_payment/index.php b/htdocs/compta/bank/various_payment/index.php index 1747e5db855..7366c0cf2a5 100644 --- a/htdocs/compta/bank/various_payment/index.php +++ b/htdocs/compta/bank/various_payment/index.php @@ -26,7 +26,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->load("compta"); -$langs->load("salaries"); +$langs->load("banks"); $langs->load("bills"); // Security check @@ -142,7 +142,7 @@ if ($result) print ''; print ''; - print_barre_liste($langs->trans("SalariesPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit); + print_barre_liste($langs->trans("VariousPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit); print '
'; print ''."\n"; @@ -153,7 +153,8 @@ if ($result) print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"v.datep","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("BankAccount"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Sens"),$_SERVER["PHP_SELF"],"v.sens","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; @@ -179,6 +180,8 @@ if ($result) } // Amount print ''; + // Sens + print ''; print '"; + // Sens + if ($obj->sens == '1') $sens = $langs->trans("Credit"); else $sens = $langs->trans("Debit"); + print ""; print ""; print "\n"; @@ -231,7 +237,7 @@ if ($result) $i++; } - $colspan=5; + $colspan=4; if (! empty($conf->banque->enabled)) $colspan++; print ''; print '"; diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 00c0b26bb4b..d054220825f 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -152,4 +152,5 @@ DocumentModelSepaMandate=Template of SEPA mandate. Usefull for european countrie DocumentModelBan=Template to print a page with BAN information. NewVariousPayment=New various payment VariousPayment=Various payment +VariousPayments=Various payments ShowVariousPayment=Show various payment
 '; $searchpicto=$form->showFilterAndCheckAddButtons(0); @@ -223,6 +226,9 @@ if ($result) } // Amount print "".price($obj->amount)."".$sens."
'.$langs->trans("Total").''.price($total)."