Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
philippe-opendsi 2016-10-21 17:12:44 +02:00
commit 0add51b7cb
39 changed files with 926 additions and 758 deletions

View File

@ -164,10 +164,14 @@ class Skeleton_Class extends CommonObject
$sql .= ' t.field2'; $sql .= ' t.field2';
//... //...
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
$sql.= ' WHERE 1 = 1';
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND entity IN (" . getEntity("skeleton", 1) . ")";
}
if (null !== $ref) { if (null !== $ref) {
$sql .= ' WHERE t.ref = ' . '\'' . $ref . '\''; $sql .= ' AND t.ref = ' . '\'' . $ref . '\'';
} else { } else {
$sql .= ' WHERE t.rowid = ' . $id; $sql .= ' AND t.rowid = ' . $id;
} }
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -236,16 +240,20 @@ class Skeleton_Class extends CommonObject
$sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; $sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
} }
} }
if (count($sqlwhere) > 0) { $sql.= ' WHERE 1 = 1';
$sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere); if (! empty($conf->multicompany->enabled)) {
$sql .= " AND entity IN (" . getEntity("skeleton", 1) . ")";
}
if (count($sqlwhere) > 0) {
$sql .= ' AND ' . implode(' '.$filtermode.' ', $sqlwhere);
} }
if (!empty($sortfield)) { if (!empty($sortfield)) {
$sql .= $this->db->order($sortfield,$sortorder); $sql .= $this->db->order($sortfield,$sortorder);
} }
if (!empty($limit)) { if (!empty($limit)) {
$sql .= ' ' . $this->db->plimit($limit + 1, $offset); $sql .= ' ' . $this->db->plimit($limit + 1, $offset);
} }
$this->lines = array(); $this->lines = array();
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -491,7 +499,7 @@ class Skeleton_Class extends CommonObject
* Return the status * Return the status
* *
* @param int $status Id status * @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto
* @return string Label of status * @return string Label of status
*/ */
static function LibStatut($status,$mode=0) static function LibStatut($status,$mode=0)
@ -529,6 +537,11 @@ class Skeleton_Class extends CommonObject
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
} }
if ($mode == 6)
{
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
}
} }

View File

@ -79,9 +79,11 @@ if ($action == 'delete') {
} }
} }
/* /*
* View * View
*/ */
llxheader('', $langs->trans('AccountAccounting')); llxheader('', $langs->trans('AccountAccounting'));
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
@ -126,6 +128,7 @@ dol_fiche_end();
print '</form>'; print '</form>';
if ($action == 'display' || $action == 'delete') { if ($action == 'display' || $action == 'delete') {
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';

View File

@ -126,9 +126,7 @@ print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
/* // Define Chart of accounts
* Define Chart of accounts
*/
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';

View File

@ -49,7 +49,7 @@ if (! $user->rights->accounting->bind->write)
accessforbidden(); accessforbidden();
// search & action GETPOST // search & action GETPOST
$action = GETPOST('action'); $action = GETPOST('action', 'alpha');
$codeventil_buy = GETPOST('codeventil_buy', 'array'); $codeventil_buy = GETPOST('codeventil_buy', 'array');
$codeventil_sell = GETPOST('codeventil_sell', 'array'); $codeventil_sell = GETPOST('codeventil_sell', 'array');
$chk_prod = GETPOST('chk_prod', 'array'); $chk_prod = GETPOST('chk_prod', 'array');
@ -65,26 +65,32 @@ $accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
$btn_changeaccount = GETPOST('changeaccount'); $btn_changeaccount = GETPOST('changeaccount');
$btn_changetype = GETPOST('changetype'); $btn_changetype = GETPOST('changetype');
$sortfield = GETPOST('sortfield', 'alpha'); $limit = GETPOST("limit")?GETPOST("limit","int"):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortorder = GETPOST('sortorder', 'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$page = GETPOST('page', 'int'); $sortorder = GETPOST("sortorder",'alpha');
if ($page < 0) $page = GETPOST("page",'int');
$page = 0; if ($page == -1) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
// bug in page limit if ACCOUNTING_LIMIT_LIST_VENTILATION < $conf->liste_limit there is no pagination displayed ! if (! $sortfield) $sortfield="p.ref";
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) && $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION >= $conf->liste_limit) { if (! $sortorder) $sortorder="ASC";
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else {
$limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
}
$offset = $limit * $page;
if (! $sortfield) { if (empty($action)) $action='list';
$sortfield = "p.ref";
} $arrayfields=array();
if (! $sortorder) {
$sortorder = "ASC";
/*
* Actions
*/
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
{
$search_ref = '';
$search_label = '';
$search_desc = '';
} }
// Sales or Purchase mode ? // Sales or Purchase mode ?
@ -158,6 +164,12 @@ if ($action == 'update') {
} }
} }
/*
* View
*/
$form = new FormVentilation($db); $form = new FormVentilation($db);
// Defaut AccountingAccount RowId Product / Service // Defaut AccountingAccount RowId Product / Service
@ -175,44 +187,13 @@ $aacompta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $c
$aacompta_servsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); $aacompta_servsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); $aacompta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
{
$search_ref = '';
$search_label = '';
$search_desc = '';
}
/*
* View
*/
llxHeader('', $langs->trans("ProductsBinding")); llxHeader('', $langs->trans("ProductsBinding"));
print '<script type="text/javascript"> $pcgver = $conf->global->CHARTOFACCOUNTS;
$(function () {
$(\'#select-all\').click(function(event) {
// Iterate each checkbox
$(\':checkbox\').each(function() {
this.checked = true;
});
});
$(\'#unselect-all\').click(function(event) {
// Iterate each checkbox
$(\':checkbox\').each(function() {
this.checked = false;
});
});
});
</script>';
$sql = "SELECT p.rowid, p.ref, p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type"; $sql = "SELECT p.rowid, p.ref, p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type";
$sql .= " FROM " . MAIN_DB_PREFIX . "product as p"; $sql .= " FROM " . MAIN_DB_PREFIX . "product as p";
$sql .= " WHERE ("; $sql .= " WHERE (";
$pcgver = $conf->global->CHARTOFACCOUNTS;
if ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') { if ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') {
$sql .= " p.accountancy_code_buy ='' OR p.accountancy_code_buy IS NULL"; $sql .= " p.accountancy_code_buy ='' OR p.accountancy_code_buy IS NULL";
$sql .= " OR (p.accountancy_code_buy IS NOT NULL AND p.accountancy_code_buy != '' AND p.accountancy_code_buy NOT IN $sql .= " OR (p.accountancy_code_buy IS NOT NULL AND p.accountancy_code_buy != '' AND p.accountancy_code_buy NOT IN
@ -222,39 +203,58 @@ if ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') {
$sql .= " OR (p.accountancy_code_sell IS NOT NULL AND p.accountancy_code_sell != '' AND p.accountancy_code_sell NOT IN $sql .= " OR (p.accountancy_code_sell IS NOT NULL AND p.accountancy_code_sell != '' AND p.accountancy_code_sell NOT IN
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))"; (SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))";
} }
$sql .= ")"; $sql .= ")";
if (! empty($conf->multicompany->enabled)) {
$sql.= ' AND p.entity IN ('.getEntity('product', 1).')';
}
// Add search filter like // Add search filter like
if (strlen(trim($search_ref))) { if (strlen(trim($search_ref))) {
$sql .= " AND (p.ref like '" . $search_ref . "%')"; $sql .= natural_search("p.ref",$search_ref);
} }
if (strlen(trim($search_label))) { if (strlen(trim($search_label))) {
$sql .= " AND (p.label like '" . $search_label . "%')"; $sql .= natural_search("p.label",$search_label);
} }
if (strlen(trim($search_desc))) { if (strlen(trim($search_desc))) {
$sql .= " AND (p.description like '%" . $search_desc . "%')"; $sql .= natural_search("p.description",$search_desc);
} }
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql .= $db->plimit($limit + 1, $offset); $sql .= $db->plimit($limit + 1, $offset);
dol_syslog("/accountancy/admin/productaccount.php:: sql=" . $sql, LOG_DEBUG); dol_syslog("/accountancy/admin/productaccount.php:: sql=" . $sql, LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result)
$num_lines = $db->num_rows($result); {
$num = $db->num_rows($result);
$i = 0; $i = 0;
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($search_ref > 0) $param.="&amp;search_desc=".urlencode($search_ref);
if ($search_label > 0) $param.="&amp;search_desc=".urlencode($search_label);
if ($search_desc > 0) $param.="&amp;search_desc=".urlencode($search_desc);
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy'); print load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy');
print '<br>'; print '<br>';
print $langs->trans("InitAccountancyDesc") . '<br>'; print $langs->trans("InitAccountancyDesc") . '<br>';
print '<br>'; print '<br>';
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">'; // Select mode
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="update">';
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('Options') . '</td><td>' . $langs->trans('Description') . '</td>'; print '<td>' . $langs->trans('Options') . '</td><td>' . $langs->trans('Description') . '</td>';
@ -272,9 +272,15 @@ if ($result) {
print "<br>\n"; print "<br>\n";
print_barre_liste($langs->trans("ListOfProductsWithoutAccountingAccount"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines, '', ''); // Filter on categories
$moreforfilter='';
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="noborder" width="100%">'; $texte=$langs->trans("ListOfProductsWithoutAccountingAccount");
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit);
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
@ -292,12 +298,11 @@ if ($result) {
print '</tr>'; print '</tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_ref" value="' . $search_ref . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . $search_desc . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td align="center" class="liste_titre">'; print '<td align="right" class="liste_titre">';
$searchpitco=$form->showFilterAndCheckAddButtons(1, 'checkforselect', 1); $searchpitco=$form->showFilterAndCheckAddButtons(1, 'checkforselect', 1);
print $searchpitco; print $searchpitco;
print '</td>'; print '</td>';
@ -305,7 +310,8 @@ if ($result) {
$var = true; $var = true;
while ( $i < min($num_lines, 250) ) { while ($i < min($num,$limit))
{
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$var = ! $var; $var = ! $var;
@ -374,14 +380,15 @@ if ($result) {
} }
// Checkbox select // Checkbox select
print '<td align="center">'; print '<td align="right">';
print '<input type="checkbox" class="checkforselect" name="chk_prod[]" value="' . $obj->rowid . '"/></td>'; print '<input type="checkbox" class="checkforselect" name="chk_prod[]" value="' . $obj->rowid . '"/></td>';
print "</tr>"; print "</tr>";
$i ++; $i ++;
} }
print '</table>'; print '</table>';
print '<br><div align="right"><input type="submit" class="butAction" name="changeaccount" value="' . $langs->trans("Save") . '"></div>';
print '<br><div align="center"><input type="submit" class="butAction" name="changeaccount" value="' . $langs->trans("Save") . '"></div>';
print '</form>'; print '</form>';
$db->free($result); $db->free($result);

View File

@ -110,7 +110,7 @@ class BookKeeping extends CommonObject
* @return int <0 if KO, Id of created object if OK * @return int <0 if KO, Id of created object if OK
*/ */
public function create(User $user, $notrigger = false) { public function create(User $user, $notrigger = false) {
global $langs; global $conf, $langs;
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
@ -184,6 +184,9 @@ class BookKeeping extends CommonObject
$sql .= " WHERE doc_type = '" . $this->doc_type . "'"; $sql .= " WHERE doc_type = '" . $this->doc_type . "'";
$sql .= " AND fk_docdet = " . $this->fk_docdet; $sql .= " AND fk_docdet = " . $this->fk_docdet;
$sql .= " AND numero_compte = '" . $this->numero_compte . "'"; $sql .= " AND numero_compte = '" . $this->numero_compte . "'";
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
}
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -197,6 +200,9 @@ class BookKeeping extends CommonObject
$sqlnum .= " WHERE doc_type = '" . $this->doc_type . "'"; $sqlnum .= " WHERE doc_type = '" . $this->doc_type . "'";
$sqlnum .= " AND fk_docdet = '" . $this->fk_docdet . "'"; $sqlnum .= " AND fk_docdet = '" . $this->fk_docdet . "'";
$sqlnum .= " AND doc_ref = '" . $this->doc_ref . "'"; $sqlnum .= " AND doc_ref = '" . $this->doc_ref . "'";
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
}
dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG); dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG);
$resqlnum = $this->db->query($sqlnum); $resqlnum = $this->db->query($sqlnum);
@ -208,6 +214,9 @@ class BookKeeping extends CommonObject
if (empty($this->piece_num)) { if (empty($this->piece_num)) {
$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum"; $sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
$sqlnum .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sqlnum .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
if (! empty($conf->multicompany->enabled)) {
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
}
dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG); dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG);
$resqlnum = $this->db->query($sqlnum); $resqlnum = $this->db->query($sqlnum);
@ -470,11 +479,12 @@ class BookKeeping extends CommonObject
* @return int <0 if KO, 0 if not found, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
public function fetch($id, $ref = null) { public function fetch($id, $ref = null) {
global $conf;
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$sql = 'SELECT'; $sql = 'SELECT';
$sql .= ' t.rowid,'; $sql .= ' t.rowid,';
$sql .= " t.doc_date,"; $sql .= " t.doc_date,";
$sql .= " t.doc_type,"; $sql .= " t.doc_type,";
$sql .= " t.doc_ref,"; $sql .= " t.doc_ref,";
@ -491,7 +501,6 @@ class BookKeeping extends CommonObject
$sql .= " t.import_key,"; $sql .= " t.import_key,";
$sql .= " t.code_journal,"; $sql .= " t.code_journal,";
$sql .= " t.piece_num"; $sql .= " t.piece_num";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
$sql .= ' WHERE 1 = 1'; $sql .= ' WHERE 1 = 1';
if (! empty($conf->multicompany->enabled)) { if (! empty($conf->multicompany->enabled)) {
@ -556,11 +565,12 @@ class BookKeeping extends CommonObject
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') {
global $conf;
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$sql = 'SELECT'; $sql = 'SELECT';
$sql .= ' t.rowid,'; $sql .= ' t.rowid,';
$sql .= " t.doc_date,"; $sql .= " t.doc_date,";
$sql .= " t.doc_type,"; $sql .= " t.doc_type,";
$sql .= " t.doc_ref,"; $sql .= " t.doc_ref,";
@ -577,9 +587,6 @@ class BookKeeping extends CommonObject
$sql .= " t.import_key,"; $sql .= " t.import_key,";
$sql .= " t.code_journal,"; $sql .= " t.code_journal,";
$sql .= " t.piece_num"; $sql .= " t.piece_num";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
// Manage filter // Manage filter
$sqlwhere = array (); $sqlwhere = array ();
if (count($filter) > 0) { if (count($filter) > 0) {
@ -601,7 +608,6 @@ class BookKeeping extends CommonObject
} }
} }
} }
$sql.= ' WHERE 1 = 1'; $sql.= ' WHERE 1 = 1';
if (! empty($conf->multicompany->enabled)) { if (! empty($conf->multicompany->enabled)) {
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
@ -672,11 +678,12 @@ class BookKeeping extends CommonObject
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') {
global $conf;
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$sql = 'SELECT'; $sql = 'SELECT';
$sql .= ' t.rowid,'; $sql .= ' t.rowid,';
$sql .= " t.doc_date,"; $sql .= " t.doc_date,";
$sql .= " t.doc_type,"; $sql .= " t.doc_type,";
$sql .= " t.doc_ref,"; $sql .= " t.doc_ref,";
@ -693,9 +700,7 @@ class BookKeeping extends CommonObject
$sql .= " t.import_key,"; $sql .= " t.import_key,";
$sql .= " t.code_journal,"; $sql .= " t.code_journal,";
$sql .= " t.piece_num"; $sql .= " t.piece_num";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
// Manage filter // Manage filter
$sqlwhere = array (); $sqlwhere = array ();
if (count($filter) > 0) { if (count($filter) > 0) {
@ -715,7 +720,6 @@ class BookKeeping extends CommonObject
} }
} }
} }
$sql.= ' WHERE 1 = 1'; $sql.= ' WHERE 1 = 1';
if (! empty($conf->multicompany->enabled)) { if (! empty($conf->multicompany->enabled)) {
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
@ -784,16 +788,15 @@ class BookKeeping extends CommonObject
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') {
global $conf;
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$sql = 'SELECT'; $sql = 'SELECT';
$sql .= " t.numero_compte,"; $sql .= " t.numero_compte,";
$sql .= " SUM(t.debit) as debit,"; $sql .= " SUM(t.debit) as debit,";
$sql .= " SUM(t.credit) as credit"; $sql .= " SUM(t.credit) as credit";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
// Manage filter // Manage filter
$sqlwhere = array (); $sqlwhere = array ();
if (count($filter) > 0) { if (count($filter) > 0) {
@ -813,9 +816,12 @@ class BookKeeping extends CommonObject
} }
} }
} }
$sql.= ' WHERE 1 = 1';
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
}
if (count($sqlwhere) > 0) { if (count($sqlwhere) > 0) {
$sql .= ' WHERE ' . implode(' ' . $filtermode . ' ', $sqlwhere); $sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere);
} }
$sql .= ' GROUP BY t.numero_compte'; $sql .= ' GROUP BY t.numero_compte';
@ -917,7 +923,6 @@ class BookKeeping extends CommonObject
// Update request // Update request
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET'; $sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
$sql .= ' doc_date = ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) != 0 ? "'" . $this->db->idate($this->doc_date) . "'" : 'null') . ','; $sql .= ' doc_date = ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) != 0 ? "'" . $this->db->idate($this->doc_date) . "'" : 'null') . ',';
$sql .= ' doc_type = ' . (isset($this->doc_type) ? "'" . $this->db->escape($this->doc_type) . "'" : "null") . ','; $sql .= ' doc_type = ' . (isset($this->doc_type) ? "'" . $this->db->escape($this->doc_type) . "'" : "null") . ',';
$sql .= ' doc_ref = ' . (isset($this->doc_ref) ? "'" . $this->db->escape($this->doc_ref) . "'" : "null") . ','; $sql .= ' doc_ref = ' . (isset($this->doc_ref) ? "'" . $this->db->escape($this->doc_ref) . "'" : "null") . ',';
@ -934,7 +939,6 @@ class BookKeeping extends CommonObject
$sql .= ' import_key = ' . (isset($this->import_key) ? "'" . $this->db->escape($this->import_key) . "'" : "null") . ','; $sql .= ' import_key = ' . (isset($this->import_key) ? "'" . $this->db->escape($this->import_key) . "'" : "null") . ',';
$sql .= ' code_journal = ' . (isset($this->code_journal) ? "'" . $this->db->escape($this->code_journal) . "'" : "null") . ','; $sql .= ' code_journal = ' . (isset($this->code_journal) ? "'" . $this->db->escape($this->code_journal) . "'" : "null") . ',';
$sql .= ' piece_num = ' . (isset($this->piece_num) ? $this->piece_num : "null"); $sql .= ' piece_num = ' . (isset($this->piece_num) ? $this->piece_num : "null");
$sql .= ' WHERE rowid=' . $this->id; $sql .= ' WHERE rowid=' . $this->id;
$this->db->begin(); $this->db->begin();
@ -1051,9 +1055,11 @@ class BookKeeping extends CommonObject
* *
* @param string $delyear Year to delete * @param string $delyear Year to delete
* @param string $journal Journal to delete * @param string $journal Journal to delete
* @return int Result * @return int <0 if KO, >0 if OK
*/ */
function deleteByYearAndJournal($delyear='', $journal='') { function deleteByYearAndJournal($delyear='', $journal='') {
global $conf;
if (empty($delyear) && empty($journal)) if (empty($delyear) && empty($journal))
{ {
return -1; return -1;
@ -1067,6 +1073,9 @@ class BookKeeping extends CommonObject
$sql.= " WHERE 1 = 1"; $sql.= " WHERE 1 = 1";
if (! empty($delyear)) $sql.= " AND YEAR(doc_date) = " . $delyear; // FIXME Must use between if (! empty($delyear)) $sql.= " AND YEAR(doc_date) = " . $delyear; // FIXME Must use between
if (! empty($journal)) $sql.= " AND code_journal = '".$journal."'"; if (! empty($journal)) $sql.= " AND code_journal = '".$journal."'";
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
}
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) { if (! $resql) {
@ -1090,12 +1099,17 @@ class BookKeeping extends CommonObject
* @return int Result * @return int Result
*/ */
function deleteMvtNum($piecenum) { function deleteMvtNum($piecenum) {
global $conf;
$this->db->begin(); $this->db->begin();
// first check if line not yet in bookkeeping // first check if line not yet in bookkeeping
$sql = "DELETE"; $sql = "DELETE";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE piece_num = " . $piecenum; $sql .= " WHERE piece_num = " . $piecenum;
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
}
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -1193,9 +1207,14 @@ class BookKeeping extends CommonObject
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function fetchPerMvt($piecenum) { public function fetchPerMvt($piecenum) {
global $conf;
$sql = "SELECT piece_num,doc_date,code_journal,doc_ref,doc_type"; $sql = "SELECT piece_num,doc_date,code_journal,doc_ref,doc_type";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE piece_num = " . $piecenum; $sql .= " WHERE piece_num = " . $piecenum;
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
}
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG); dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
@ -1223,7 +1242,12 @@ class BookKeeping extends CommonObject
*/ */
public function getNextNumMvt() public function getNextNumMvt()
{ {
global $conf;
$sql = "SELECT MAX(piece_num)+1 as max FROM " . MAIN_DB_PREFIX . $this->table_element; $sql = "SELECT MAX(piece_num)+1 as max FROM " . MAIN_DB_PREFIX . $this->table_element;
if (! empty($conf->multicompany->enabled)) {
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
}
dol_syslog(get_class($this) . "getNextNumMvt sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this) . "getNextNumMvt sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
@ -1247,12 +1271,17 @@ class BookKeeping extends CommonObject
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch_all_per_mvt($piecenum) { function fetch_all_per_mvt($piecenum) {
global $conf;
$sql = "SELECT rowid, doc_date, doc_type,"; $sql = "SELECT rowid, doc_date, doc_type,";
$sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,"; $sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,";
$sql .= " numero_compte, label_compte, debit, credit,"; $sql .= " numero_compte, label_compte, debit, credit,";
$sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num"; $sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE piece_num = " . $piecenum; $sql .= " WHERE piece_num = " . $piecenum;
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
}
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG); dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
@ -1297,11 +1326,16 @@ class BookKeeping extends CommonObject
* @return int Result * @return int Result
*/ */
function export_bookkeping($model = 'ebp') { function export_bookkeping($model = 'ebp') {
global $conf;
$sql = "SELECT rowid, doc_date, doc_type,"; $sql = "SELECT rowid, doc_date, doc_type,";
$sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,"; $sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,";
$sql .= " numero_compte, label_compte, debit, credit,"; $sql .= " numero_compte, label_compte, debit, credit,";
$sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num"; $sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
if (! empty($conf->multicompany->enabled)) {
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
}
dol_syslog(get_class($this) . "::export_bookkeping", LOG_DEBUG); dol_syslog(get_class($this) . "::export_bookkeping", LOG_DEBUG);
@ -1352,10 +1386,9 @@ class BookKeeping extends CommonObject
* @param string $htmlname Name of field in html form * @param string $htmlname Name of field in html form
* @param int $showempty Add an empty field * @param int $showempty Add an empty field
* @param array $event Event options * @param array $event Event options
* @param int $select_in $selectid value is a aa.rowid (0 default) or aa.account_number (1) * @param int $select_in Value is a aa.rowid (0 default) or aa.account_number (1)
* @param int $select_out set value returned by select 0=rowid (default), 1=account_number * @param int $select_out Set value returned by select 0=rowid (default), 1=account_number
* @param int $aabase set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number * @param int $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number
*
* @return string String with HTML select * @return string String with HTML select
*/ */
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') { function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') {
@ -1371,6 +1404,9 @@ class BookKeeping extends CommonObject
$sql .= " AND aa.active = 1"; $sql .= " AND aa.active = 1";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $pcgver; $sql .= " AND asy.rowid = " . $pcgver;
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND ab.entity IN (" . getEntity("accountancy", 1) . ")";
}
$sql .= " ORDER BY account_number ASC"; $sql .= " ORDER BY account_number ASC";
dol_syslog(get_class($this) . "::select_account", LOG_DEBUG); dol_syslog(get_class($this) . "::select_account", LOG_DEBUG);
@ -1389,7 +1425,6 @@ class BookKeeping extends CommonObject
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {
$label = length_accountg($obj->account_number) . ' - ' . $obj->label; $label = length_accountg($obj->account_number) . ' - ' . $obj->label;
$label = dol_trunc($label, $trunclength);
$select_value_in = $obj->rowid; $select_value_in = $obj->rowid;
$select_value_out = $obj->rowid; $select_value_out = $obj->rowid;
@ -1421,14 +1456,13 @@ class BookKeeping extends CommonObject
* Description of a root accounting account * Description of a root accounting account
* *
* @param string $account Accounting account * @param string $account Accounting account
* @return string * @return string Root account
*/ */
function get_compte_racine($account = null) function get_compte_racine($account = null)
{ {
global $conf; global $conf;
$pcgver = $conf->global->CHARTOFACCOUNTS; $pcgver = $conf->global->CHARTOFACCOUNTS;
$sql = "SELECT root.account_number, root.label as label"; $sql = "SELECT root.account_number, root.label as label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
@ -1438,7 +1472,9 @@ class BookKeeping extends CommonObject
$sql .= " WHERE aa.account_number = '" . $account . "'"; $sql .= " WHERE aa.account_number = '" . $account . "'";
$sql .= " AND parent.active = 1"; $sql .= " AND parent.active = 1";
$sql .= " AND root.active = 1"; $sql .= " AND root.active = 1";
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND aa.entity IN (" . getEntity("accountancy", 1) . ")";
}
dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -1463,11 +1499,12 @@ class BookKeeping extends CommonObject
* Description of accounting account * Description of accounting account
* *
* @param string $account Accounting account * @param string $account Accounting account
* @return string * @return string Account desc
*/ */
function get_compte_desc($account = null) function get_compte_desc($account = null)
{ {
global $conf; global $conf;
$pcgver = $conf->global->CHARTOFACCOUNTS; $pcgver = $conf->global->CHARTOFACCOUNTS;
$sql = "SELECT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version, cat.label as category"; $sql = "SELECT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version, cat.label as category";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa "; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa ";
@ -1476,6 +1513,10 @@ class BookKeeping extends CommonObject
$sql .= " AND asy.rowid = " . $pcgver; $sql .= " AND asy.rowid = " . $pcgver;
$sql .= " AND aa.active = 1"; $sql .= " AND aa.active = 1";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid";
if (! empty($conf->multicompany->enabled)) {
$sql .= " WHERE aa.entity IN (" . getEntity("accountancy", 1) . ")";
}
dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
@ -1499,6 +1540,7 @@ class BookKeeping extends CommonObject
} }
/** /**
* Class BookKeepingLine * Class BookKeepingLine
*/ */

View File

@ -80,23 +80,21 @@ print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step,
print "<br>\n"; print "<br>\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
//$textlink='<strong>'.$langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Modules")."-".$langs->transnoentitiesnoconv("Accountancy").'</strong>'; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, '<strong>'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>')."<br>\n";
$textlink='<strong>'.$langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("MenuBankCash").'</strong>';
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, $textlink);
print "<br>\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
$textlink = '<strong>'.$langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("Dictionaries")."-".$langs->transnoentitiesnoconv("DictionaryVAT").'</strong>'; $textlink = '<strong>'.$langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("Dictionaries")."-".$langs->transnoentitiesnoconv("DictionaryVAT").'</strong>';
//$textlink.= ' '.$langs->trans("and").' ';
//$textlink.= '<strong>'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>';
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
print "<br>\n"; print "<br>\n";
print "<br>\n"; print "<br>\n";
$step++;
$textlink='<strong>'.$langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("MenuBankCash").'</strong>';
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, $textlink);
print "<br>\n";
print "<br>\n";
if (! empty($conf->tax->enabled)) if (! empty($conf->tax->enabled))
{ {
$textlink = '<strong>'.$langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("Dictionaries")."-".$langs->transnoentitiesnoconv("DictionarySocialContributions").'</strong>'; $textlink = '<strong>'.$langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("Dictionaries")."-".$langs->transnoentitiesnoconv("DictionarySocialContributions").'</strong>';
//$textlink.= ' '.$langs->trans("and").' ';
//$textlink.= '<strong>'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>';
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
print "<br>\n"; print "<br>\n";
@ -118,9 +116,6 @@ if (! empty($conf->don->enabled))
print "<br>\n"; print "<br>\n";
}*/ }*/
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, '<strong>'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>')."<br>\n";
print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("ProductsBinding").'</strong>')."<br>\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("ProductsBinding").'</strong>')."<br>\n";
print "<br>\n"; print "<br>\n";

View File

@ -55,7 +55,9 @@ $confirm=GETPOST('confirm','alpha');
$id=GETPOST('id','int'); $id=GETPOST('id','int');
$rowid=GETPOST('rowid','alpha'); $rowid=GETPOST('rowid','alpha');
if (!$user->admin) accessforbidden(); $allowed=$user->admin;
if ($id == 10 && ! empty($user->rights->accounting->chartofaccount)) $allowed=1; // Vat page allowed to manager of chart account
if (! $allowed) accessforbidden();
$acts[0] = "activate"; $acts[0] = "activate";
$acts[1] = "disable"; $acts[1] = "disable";
@ -76,7 +78,6 @@ $pagenext = $page + 1;
$search_country_id = GETPOST('search_country_id','int'); $search_country_id = GETPOST('search_country_id','int');
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('admin')); $hookmanager->initHooks(array('admin'));
@ -673,8 +674,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
} }
// Clean some parameters // Clean some parameters
if (isset($_POST["localtax1"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0 if (! empty($_POST["localtax1_type"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0
if (isset($_POST["localtax2"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0 if (! empty($_POST["localtax2_type"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
@ -720,7 +721,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$_POST[$listfieldvalue[$i]] = $conf->entity; $_POST[$listfieldvalue[$i]] = $conf->entity;
} }
if ($i) $sql.=","; if ($i) $sql.=",";
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'"; else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
$i++; $i++;
} }
@ -769,7 +770,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
} }
if ($i) $sql.=","; if ($i) $sql.=",";
$sql.= $field."="; $sql.= $field."=";
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'"; else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
$i++; $i++;
} }
@ -992,12 +993,12 @@ if ($id)
if ($fieldlist[$field]=='taux') { if ($fieldlist[$field]=='taux') {
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow=$langs->trans("Rate"); if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow=$langs->trans("Rate");
else $valuetoshow=$langs->trans("Amount"); else $valuetoshow=$langs->trans("Amount");
$align='right'; $align='center';
} }
if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$langs->trans("UseLocalTax")." 2"; $align="center"; $sortable=0; } if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$langs->trans("UseLocalTax")." 2"; $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2";} if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2"; $align="center"; }
if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$langs->trans("UseLocalTax")." 3"; $align="center"; $sortable=0; } if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$langs->trans("UseLocalTax")." 3"; $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3";} if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3"; $align="center"; }
if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); } if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); }
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
if ($fieldlist[$field]=='type') { if ($fieldlist[$field]=='type') {
@ -1072,7 +1073,7 @@ if ($id)
{ {
foreach ($fieldlist as $key=>$val) foreach ($fieldlist as $key=>$val)
{ {
if (GETPOST($val)) if (GETPOST($val) != '')
$obj->$val=GETPOST($val); $obj->$val=GETPOST($val);
} }
} }
@ -1082,7 +1083,7 @@ if ($id)
$reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors; $error=$hookmanager->error; $errors=$hookmanager->errors;
if ($id == 3) unset($fieldlist[2]); if ($id == 3) unset($fieldlist[2]); // Remove field ??? if ???
if (empty($reshook)) if (empty($reshook))
{ {
@ -1127,7 +1128,7 @@ if ($id)
// List of available values in database // List of available recod in database
dol_syslog("htdocs/admin/dict", LOG_DEBUG); dol_syslog("htdocs/admin/dict", LOG_DEBUG);
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
@ -1174,12 +1175,12 @@ if ($id)
if ($fieldlist[$field]=='taux') { if ($fieldlist[$field]=='taux') {
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow=$langs->trans("Rate"); if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow=$langs->trans("Rate");
else $valuetoshow=$langs->trans("Amount"); else $valuetoshow=$langs->trans("Amount");
$align='right'; $align='center';
} }
if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$langs->trans("UseLocalTax")." 2"; $align="center"; $sortable=0; } if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$langs->trans("UseLocalTax")." 2"; $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2"; $sortable=0; } if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2"; $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$langs->trans("UseLocalTax")." 3"; $align="center"; $sortable=0; } if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$langs->trans("UseLocalTax")." 3"; $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3"; $sortable=0; } if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3"; $align="center"; $sortable=0; }
if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); } if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); }
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
@ -1282,8 +1283,11 @@ if ($id)
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit'); if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit');
print '<td colspan="3" align="right"><a name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'">&nbsp;</a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">'; print '<td colspan="3" align="center">';
print '&nbsp;<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>'; print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
} }
else else
{ {
@ -1430,24 +1434,26 @@ if ($id)
$key = $langs->trans('SizeUnit'.strtolower($obj->unit)); $key = $langs->trans('SizeUnit'.strtolower($obj->unit));
$valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->{$fieldlist[$field]}); $valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->{$fieldlist[$field]});
} }
else if ($fieldlist[$field]=='localtax1' || $fieldlist[$field]=='localtax2') {
$align="center";
}
else if ($fieldlist[$field]=='localtax1_type') { else if ($fieldlist[$field]=='localtax1_type') {
if ($obj->localtax1 != 0) if ($obj->localtax1 != 0)
$valuetoshow=$localtax_typeList[$valuetoshow]; $valuetoshow=$localtax_typeList[$valuetoshow];
else else
$valuetoshow = ''; $valuetoshow = '';
$align="right"; $align="center";
} }
else if ($fieldlist[$field]=='localtax2_type') { else if ($fieldlist[$field]=='localtax2_type') {
if ($obj->localtax2 != 0) if ($obj->localtax2 != 0)
$valuetoshow=$localtax_typeList[$valuetoshow]; $valuetoshow=$localtax_typeList[$valuetoshow];
else else
$valuetoshow = ''; $valuetoshow = '';
$align="right"; $align="center";
} }
else if ($fieldlist[$field]=='taux') { else if ($fieldlist[$field]=='taux') {
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0); $valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
$align="right"; $align="center";
} }
else if (in_array($fieldlist[$field],array('recuperableonly'))) else if (in_array($fieldlist[$field],array('recuperableonly')))
{ {
@ -1509,7 +1515,11 @@ if ($id)
else print '<td>&nbsp;</td>'; else print '<td>&nbsp;</td>';
// Delete link // Delete link
if ($iserasable) print '<td align="center"><a href="'.$url.'action=delete">'.img_delete().'</a></td>'; if ($iserasable)
{
if ($user->admin) print '<td align="center"><a href="'.$url.'action=delete">'.img_delete().'</a></td>';
//else print '<td align="center"><a href="#">'.img_delete().'</a></td>'; // Some dictionnary can be edited by other profile than admin
}
else print '<td>&nbsp;</td>'; else print '<td>&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
@ -1700,7 +1710,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
} }
elseif (in_array($fieldlist[$field],array('nbjour','decalage','taux','localtax1','localtax2'))) { elseif (in_array($fieldlist[$field],array('nbjour','decalage','taux','localtax1','localtax2'))) {
$align="left"; $align="left";
if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) $align="right"; // Fields aligned on right if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) $align="center"; // Fields aligned on right
print '<td align="'.$align.'">'; print '<td align="'.$align.'">';
print '<input type="text" class="flat" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" size="3" name="'.$fieldlist[$field].'">'; print '<input type="text" class="flat" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" size="3" name="'.$fieldlist[$field].'">';
print '</td>'; print '</td>';
@ -1770,7 +1780,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
$size=''; $class=''; $size=''; $class='';
if ($fieldlist[$field]=='code') $size='size="8" '; if ($fieldlist[$field]=='code') $size='size="8" ';
if ($fieldlist[$field]=='position') $size='size="4" '; if ($fieldlist[$field]=='position') $size='size="4" ';
if ($fieldlist[$field]=='libelle') $size='centpercent'; if ($fieldlist[$field]=='libelle') $class='centpercent';
if ($fieldlist[$field]=='tracking') $class='centpercent'; if ($fieldlist[$field]=='tracking') $class='centpercent';
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" '; if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">'; print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';

View File

@ -92,9 +92,17 @@ if ($negpage)
if ($page > GETPOST("nbpage")) $page = GETPOST("nbpage"); if ($page > GETPOST("nbpage")) $page = GETPOST("nbpage");
} }
$sortfield = "b.datev, b.datec, b.rowid";
$object = new Account($db); $object = new Account($db);
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
/*
* Action
*/
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
{ {
$paiementtype=""; $paiementtype="";
$req_nb=""; $req_nb="";
@ -113,9 +121,6 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_reconciled = ''; $search_reconciled = '';
} }
/*
* Action
*/
$dateop=-1; $dateop=-1;
if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banque->modifier) if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banque->modifier)
@ -340,22 +345,9 @@ if ($id > 0 || ! empty($ref))
$head=bank_prepare_head($object); $head=bank_prepare_head($object);
dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account'); dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account');
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
// Ref dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref');
print '</td></tr>';
// Label
print '<tr><td>'.$langs->trans("Label").'</td>';
print '<td colspan="3">'.$object->label.'</td></tr>';
print '</table>';
dol_fiche_end(); dol_fiche_end();
@ -507,7 +499,7 @@ if ($id > 0 || ! empty($ref))
// Ligne de titre tableau des ecritures // Ligne de titre tableau des ecritures
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Date").'</td>'; print '<td>'.$langs->trans("Date").'</td>';
print '<td>'.$langs->trans("Value").'</td>'; print_liste_field_titre($langs->trans("Value"), '', 'b.datev, b.datec, b.rowid','',$param,'',$sortfield,$sortorder);
print '<td>'.$langs->trans("Type").'</td>'; print '<td>'.$langs->trans("Type").'</td>';
print '<td>'.$langs->trans("Numero").'</td>'; print '<td>'.$langs->trans("Numero").'</td>';
print '<td>'.$langs->trans("Description").'</td>'; print '<td>'.$langs->trans("Description").'</td>';
@ -603,7 +595,7 @@ if ($id > 0 || ! empty($ref))
$sql.= " AND b.fk_account = ba.rowid"; $sql.= " AND b.fk_account = ba.rowid";
$sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")"; $sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")";
$sql.= $sql_rech; $sql.= $sql_rech;
$sql.= $db->order("b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day $sql.= $db->order($sortfield, "ASC"); // We add date of creation to have correct order when everything is done the same day
$sql.= $db->plimit($limitsql, 0); $sql.= $db->plimit($limitsql, 0);
dol_syslog("account.php get transactions -", LOG_DEBUG); dol_syslog("account.php get transactions -", LOG_DEBUG);

View File

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$langs->load("banks"); $langs->load("banks");
$langs->load("categories"); $langs->load("categories");
$id=GETPOST('account'); $id=GETPOST('account')?GETPOST('account','alpha'):GETPOST('id');
$ref=GETPOST('ref'); $ref=GETPOST('ref');
// Security check // Security check
@ -60,16 +60,16 @@ llxHeader('',$title,$helpurl);
$form = new Form($db); $form = new Form($db);
// Get account informations // Get account informations
$acct = new Account($db); $object = new Account($db);
if ($id > 0 && ! preg_match('/,/', $id)) // if for a particular account and not a list if ($id > 0 && ! preg_match('/,/', $id)) // if for a particular account and not a list
{ {
$result=$acct->fetch($id); $result=$object->fetch($id);
$id=$acct->id; $id=$object->id;
} }
if (! empty($ref)) if (! empty($ref))
{ {
$result=$acct->fetch(0, $ref); $result=$object->fetch(0, $ref);
$id=$acct->id; $id=$object->id;
} }
@ -134,24 +134,20 @@ else
// Onglets // Onglets
$head=bank_prepare_head($acct); $head=bank_prepare_head($object);
dol_fiche_head($head,'annual',$langs->trans("FinancialAccount"),0,'account'); dol_fiche_head($head,'annual',$langs->trans("FinancialAccount"),0,'account');
$title=$langs->trans("FinancialAccount")." : ".$acct->label; $title=$langs->trans("FinancialAccount")." : ".$object->label;
$link=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year_start=".($year_start-1)."'>".img_previous()."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year_start=".($year_start+1)."'>".img_next()."</a>":""); $link=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?account=".$object->id."&year_start=".($year_start-1)."'>".img_previous()."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year_start=".($year_start+1)."'>".img_next()."</a>":"");
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
if (!empty($id)) if (!empty($id))
{ {
if (! preg_match('/,/', $id)) if (! preg_match('/,/', $id))
{ {
print $form->showrefnav($acct, 'ref', $linkback, 1, 'ref'); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
} }
else else
{ {
@ -167,25 +163,9 @@ if (!empty($id))
} }
} }
else else
{
print $langs->trans("ALL");
}
print '</td></tr>';
// Label
print '<tr><td>'.$langs->trans("Label").'</td>';
print '<td colspan="3">';
if (! empty($id))
{
print $acct->label;
}
else
{ {
print $langs->trans("AllAccounts"); print $langs->trans("AllAccounts");
} }
print '</td></tr>';
print '</table>';
dol_fiche_end(); dol_fiche_end();

View File

@ -655,31 +655,6 @@ else
if ($object->url) print '</a>'; if ($object->url) print '</a>';
print "</td></tr>\n"; print "</td></tr>\n";
// Categories
if ($conf->categorie->enabled) {
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($object->id,'account',1);
print "</td></tr>";
}
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
print '<td>'.dol_htmlentitiesbr($object->comment).'</td></tr>';
// Other attributes
$cols = 2;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>';
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
// Accountancy code // Accountancy code
print '<tr class="liste_titre_add"><td class="titlefield">'.$langs->trans("AccountancyCode").'</td>'; print '<tr class="liste_titre_add"><td class="titlefield">'.$langs->trans("AccountancyCode").'</td>';
print '<td>'; print '<td>';
@ -697,6 +672,31 @@ else
print '<td>'.$object->accountancy_journal.'</td></tr>'; print '<td>'.$object->accountancy_journal.'</td></tr>';
} }
// Other attributes
$cols = 2;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>';
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
// Categories
if ($conf->categorie->enabled) {
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($object->id,'account',1);
print "</td></tr>";
}
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
print '<td>'.dol_htmlentitiesbr($object->comment).'</td></tr>';
print '</table>'; print '</table>';

View File

@ -139,6 +139,7 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes') {
/* /*
* View * View
*/ */
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("Documents"); $title = $langs->trans("FinancialAccount").' - '.$langs->trans("Documents");
$helpurl = ""; $helpurl = "";
llxHeader('',$title,$helpurl); llxHeader('',$title,$helpurl);
@ -152,8 +153,7 @@ if ($id > 0 || !empty($ref)) {
// Onglets // Onglets
$head = bank_prepare_head($object); $head = bank_prepare_head($object);
dol_fiche_head($head, 'document', $langs->trans("FinancialAccount"), 0, dol_fiche_head($head, 'document', $langs->trans("FinancialAccount"), 0, 'account');
'account');
// Construit liste des fichiers // Construit liste des fichiers
@ -167,28 +167,24 @@ if ($id > 0 || !empty($ref)) {
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td class="titlefield">' . $langs->trans("NbOfAttachedFiles") . '</td><td colspan="3">' . count($filearray) . '</td></tr>';
// Ref
print '<tr><td valign="top" width="25%">' . $langs->trans("Ref") . '</td>';
print '<td colspan="3">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref');
print '</td></tr>';
// Label
print '<tr><td valign="top">' . $langs->trans("Label") . '</td>';
print '<td colspan="3">' . $object->label . '</td></tr>';
// Status
print '<tr><td valign="top">' . $langs->trans("Status") . '</td>';
print '<td colspan="3">' . $object->getLibStatut(4) . '</td></tr>';
print '<tr><td>' . $langs->trans("NbOfAttachedFiles") . '</td><td colspan="3">' . count($filearray) . '</td></tr>';
print '<tr><td>' . $langs->trans("TotalSizeOfAttachedFiles") . '</td><td colspan="3">' . $totalsize . ' ' . $langs->trans("bytes") . '</td></tr>'; print '<tr><td>' . $langs->trans("TotalSizeOfAttachedFiles") . '</td><td colspan="3">' . $totalsize . ' ' . $langs->trans("bytes") . '</td></tr>';
print "</table>\n"; print "</table>\n";
print "</div>\n";
print '</div>';
dol_fiche_end();
dol_htmloutput_mesg($mesg, $mesgs); dol_htmloutput_mesg($mesg, $mesgs);
/* /*
* Confirmation suppression fichier * Confirmation suppression fichier
*/ */

View File

@ -67,15 +67,15 @@ if (! empty($_GET["year"])) $year=sprintf("%04d",$_GET["year"]);
if (! empty($_GET["month"])) $month=sprintf("%02d",$_GET["month"]); if (! empty($_GET["month"])) $month=sprintf("%02d",$_GET["month"]);
$acct = new Account($db); $object = new Account($db);
if ($_GET["account"] && ! preg_match('/,/',$_GET["account"])) // if for a particular account and not a list if ($_GET["account"] && ! preg_match('/,/',$_GET["account"])) // if for a particular account and not a list
{ {
$result=$acct->fetch($_GET["account"]); $result=$object->fetch($_GET["account"]);
} }
if ($_GET["ref"]) if ($_GET["ref"])
{ {
$result=$acct->fetch(0,$_GET["ref"]); $result=$object->fetch(0,$_GET["ref"]);
$account=$acct->id; $account=$object->id;
} }
$result=dol_mkdir($conf->bank->dir_temp); $result=dol_mkdir($conf->bank->dir_temp);
@ -202,8 +202,8 @@ else
{ {
$datas[$i] = $solde + $subtotal; $datas[$i] = $solde + $subtotal;
} }
$datamin[$i] = $acct->min_desired; $datamin[$i] = $object->min_desired;
$dataall[$i] = $acct->min_allowed; $dataall[$i] = $object->min_allowed;
//$labels[$i] = strftime("%d",$day); //$labels[$i] = strftime("%d",$day);
$labels[$i] = $xday; $labels[$i] = $xday;
@ -230,15 +230,15 @@ else
foreach($datas as $i => $val) foreach($datas as $i => $val)
{ {
$graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]); $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]);
if ($acct->min_desired) array_push($graph_datas[$i],$datamin[$i]); if ($object->min_desired) array_push($graph_datas[$i],$datamin[$i]);
if ($acct->min_allowed) array_push($graph_datas[$i],$dataall[$i]); if ($object->min_allowed) array_push($graph_datas[$i],$dataall[$i]);
} }
$px1 = new DolGraph(); $px1 = new DolGraph();
$px1->SetData($graph_datas); $px1->SetData($graph_datas);
$arraylegends=array($langs->transnoentities("Balance")); $arraylegends=array($langs->transnoentities("Balance"));
if ($acct->min_desired) array_push($arraylegends,$langs->transnoentities("BalanceMinimalDesired")); if ($object->min_desired) array_push($arraylegends,$langs->transnoentities("BalanceMinimalDesired"));
if ($acct->min_allowed) array_push($arraylegends,$langs->transnoentities("BalanceMinimalAllowed")); if ($object->min_allowed) array_push($arraylegends,$langs->transnoentities("BalanceMinimalAllowed"));
$px1->SetLegend($arraylegends); $px1->SetLegend($arraylegends);
$px1->SetLegendWidthMin(180); $px1->SetLegendWidthMin(180);
$px1->SetMaxValue($px1->GetCeilMaxValue()<0?0:$px1->GetCeilMaxValue()); $px1->SetMaxValue($px1->GetCeilMaxValue()<0?0:$px1->GetCeilMaxValue());
@ -346,8 +346,8 @@ else
{ {
$datas[$i] = $solde + $subtotal; $datas[$i] = $solde + $subtotal;
} }
$datamin[$i] = $acct->min_desired; $datamin[$i] = $object->min_desired;
$dataall[$i] = $acct->min_allowed; $dataall[$i] = $object->min_allowed;
if ($xday == '15') if ($xday == '15')
{ {
$labels[$i] = dol_print_date($day,"%b"); $labels[$i] = dol_print_date($day,"%b");
@ -367,14 +367,14 @@ else
foreach($datas as $i => $val) foreach($datas as $i => $val)
{ {
$graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]); $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]);
if ($acct->min_desired) array_push($graph_datas[$i],$datamin[$i]); if ($object->min_desired) array_push($graph_datas[$i],$datamin[$i]);
if ($acct->min_allowed) array_push($graph_datas[$i],$dataall[$i]); if ($object->min_allowed) array_push($graph_datas[$i],$dataall[$i]);
} }
$px2 = new DolGraph(); $px2 = new DolGraph();
$px2->SetData($graph_datas); $px2->SetData($graph_datas);
$arraylegends=array($langs->transnoentities("Balance")); $arraylegends=array($langs->transnoentities("Balance"));
if ($acct->min_desired) array_push($arraylegends,$langs->transnoentities("BalanceMinimalDesired")); if ($object->min_desired) array_push($arraylegends,$langs->transnoentities("BalanceMinimalDesired"));
if ($acct->min_allowed) array_push($arraylegends,$langs->transnoentities("BalanceMinimalAllowed")); if ($object->min_allowed) array_push($arraylegends,$langs->transnoentities("BalanceMinimalAllowed"));
$px2->SetLegend($arraylegends); $px2->SetLegend($arraylegends);
$px2->SetLegendWidthMin(180); $px2->SetLegendWidthMin(180);
$px2->SetMaxValue($px2->GetCeilMaxValue()<0?0:$px2->GetCeilMaxValue()); $px2->SetMaxValue($px2->GetCeilMaxValue()<0?0:$px2->GetCeilMaxValue());
@ -462,8 +462,8 @@ else
{ {
$datas[$i] = '' + $solde + $subtotal; $datas[$i] = '' + $solde + $subtotal;
} }
$datamin[$i] = $acct->min_desired; $datamin[$i] = $object->min_desired;
$dataall[$i] = $acct->min_allowed; $dataall[$i] = $object->min_allowed;
if (substr($textdate,6,2) == '01' || $i == 0) if (substr($textdate,6,2) == '01' || $i == 0)
{ {
$labels[$i] = substr($textdate,4,2); $labels[$i] = substr($textdate,4,2);
@ -482,15 +482,15 @@ else
foreach($datas as $i => $val) foreach($datas as $i => $val)
{ {
$graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]); $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]);
if ($acct->min_desired) array_push($graph_datas[$i],$datamin[$i]); if ($object->min_desired) array_push($graph_datas[$i],$datamin[$i]);
if ($acct->min_allowed) array_push($graph_datas[$i],$dataall[$i]); if ($object->min_allowed) array_push($graph_datas[$i],$dataall[$i]);
} }
$px3 = new DolGraph(); $px3 = new DolGraph();
$px3->SetData($graph_datas); $px3->SetData($graph_datas);
$arraylegends=array($langs->transnoentities("Balance")); $arraylegends=array($langs->transnoentities("Balance"));
if ($acct->min_desired) array_push($arraylegends,$langs->transnoentities("BalanceMinimalDesired")); if ($object->min_desired) array_push($arraylegends,$langs->transnoentities("BalanceMinimalDesired"));
if ($acct->min_allowed) array_push($arraylegends,$langs->transnoentities("BalanceMinimalAllowed")); if ($object->min_allowed) array_push($arraylegends,$langs->transnoentities("BalanceMinimalAllowed"));
$px3->SetLegend($arraylegends); $px3->SetLegend($arraylegends);
$px3->SetLegendWidthMin(180); $px3->SetLegendWidthMin(180);
$px3->SetMaxValue($px3->GetCeilMaxValue()<0?0:$px3->GetCeilMaxValue()); $px3->SetMaxValue($px3->GetCeilMaxValue()<0?0:$px3->GetCeilMaxValue());
@ -605,7 +605,7 @@ else
$data_credit[$i] = isset($credits[substr("0".($i+1),-2)]) ? $credits[substr("0".($i+1),-2)] : 0; $data_credit[$i] = isset($credits[substr("0".($i+1),-2)]) ? $credits[substr("0".($i+1),-2)] : 0;
$data_debit[$i] = isset($debits[substr("0".($i+1),-2)]) ? $debits[substr("0".($i+1),-2)] : 0; $data_debit[$i] = isset($debits[substr("0".($i+1),-2)]) ? $debits[substr("0".($i+1),-2)] : 0;
$labels[$i] = sprintf("%02d",$i+1); $labels[$i] = sprintf("%02d",$i+1);
$datamin[$i] = $acct->min_desired; $datamin[$i] = $object->min_desired;
} }
// Fabrication tableau 4a // Fabrication tableau 4a
@ -714,7 +714,7 @@ else
$data_credit[$i] = isset($credits[substr("0".($i+1),-2)]) ? $credits[substr("0".($i+1),-2)] : 0; $data_credit[$i] = isset($credits[substr("0".($i+1),-2)]) ? $credits[substr("0".($i+1),-2)] : 0;
$data_debit[$i] = isset($debits[substr("0".($i+1),-2)]) ? $debits[substr("0".($i+1),-2)] : 0; $data_debit[$i] = isset($debits[substr("0".($i+1),-2)]) ? $debits[substr("0".($i+1),-2)] : 0;
$labels[$i] = dol_print_date(dol_mktime(12,0,0,$i+1,1,2000),"%b"); $labels[$i] = dol_print_date(dol_mktime(12,0,0,$i+1,1,2000),"%b");
$datamin[$i] = $acct->min_desired; $datamin[$i] = $object->min_desired;
} }
// Fabrication tableau 4b // Fabrication tableau 4b
@ -754,30 +754,27 @@ else
// Onglets // Onglets
$head=bank_prepare_head($acct); $head=bank_prepare_head($object);
dol_fiche_head($head,'graph',$langs->trans("FinancialAccount"),0,'account'); dol_fiche_head($head,'graph',$langs->trans("FinancialAccount"),0,'account');
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
if ($account) if ($account)
{ {
if (! preg_match('/,/',$account)) if (! preg_match('/,/',$account))
{ {
$moreparam='&month='.$month.'&year='.$year.($mode=='showalltime'?'&mode=showalltime':''); $moreparam='&month='.$month.'&year='.$year.($mode=='showalltime'?'&mode=showalltime':'');
if ($_GET["option"]!='all') if ($_GET["option"]!='all')
{ {
$morehtml='<a href="'.$_SERVER["PHP_SELF"].'?account='.$account.'&option=all'.$moreparam.'">'.$langs->trans("ShowAllAccounts").'</a>'; $morehtml='<a href="'.$_SERVER["PHP_SELF"].'?account='.$account.'&option=all'.$moreparam.'">'.$langs->trans("ShowAllAccounts").'</a>';
print $form->showrefnav($acct, 'ref', $linkback, 1, 'ref', 'ref', '', $moreparam); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', '', $moreparam);
} }
else else
{ {
$morehtml='<a href="'.$_SERVER["PHP_SELF"].'?account='.$account.$moreparam.'">'.$langs->trans("BackToAccount").'</a>'; $morehtml='<a href="'.$_SERVER["PHP_SELF"].'?account='.$account.$moreparam.'">'.$langs->trans("BackToAccount").'</a>';
print $langs->trans("All"); print $langs->trans("AllAccounts");
//print $morehtml; //print $morehtml;
} }
} }
@ -795,25 +792,9 @@ if ($account)
} }
} }
else else
{
print $langs->trans("All");
}
print '</td></tr>';
// Label
print '<tr><td>'.$langs->trans("Label").'</td>';
print '<td colspan="3">';
if ($account && $_GET["option"]!='all')
{
print $acct->label;
}
else
{ {
print $langs->trans("AllAccounts"); print $langs->trans("AllAccounts");
} }
print '</td></tr>';
print '</table>';
dol_fiche_end(); dol_fiche_end();

View File

@ -33,6 +33,16 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
$langs->load("banks"); $langs->load("banks");
$langs->load("bills"); $langs->load("bills");
$langs->load("categories"); $langs->load("categories");
@ -61,6 +71,8 @@ $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
$pageplusone = GETPOST("pageplusone",'int');
if ($pageplusone) $page = $pageplusone - 1;
if ($page == -1) { $page = 0; } if ($page == -1) { $page = 0; }
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
@ -68,6 +80,16 @@ $pagenext = $page + 1;
if (! $sortorder) $sortorder='DESC'; if (! $sortorder) $sortorder='DESC';
if (! $sortfield) $sortfield='b.dateo'; if (! $sortfield) $sortfield='b.dateo';
$mode_balance_ok=false;
//if (($sortfield == 'b.datev' || $sortfield == 'b.datev, b.dateo, b.rowid')) // TODO Manage balance when account not selected
if (($sortfield == 'b.datev' || $sortfield == 'b.datev, b.dateo, b.rowid') && $account > 0)
{
$sortfield = 'b.datev, b.dateo, b.rowid';
$mode_balance_ok = true;
}
if (strtolower($sortorder) == 'desc') $mode_balance_ok = false;
// Initialize technical object to manage context to save list fields // Initialize technical object to manage context to save list fields
$contextpage='banktransactionlist'; $contextpage='banktransactionlist';
@ -81,15 +103,16 @@ $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search
$arrayfields=array( $arrayfields=array(
'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), 'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'description'=>array('label'=>$langs->trans("Description"), 'checked'=>1),
'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1), 'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1),
'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1), 'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1),
'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1), 'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
'b.num_chq'=>array('label'=>$langs->trans("Numero"), 'checked'=>1), 'b.num_chq'=>array('label'=>$langs->trans("Numero"), 'checked'=>1),
'description'=>array('label'=>$langs->trans("Description"), 'checked'=>1),
'bu.label'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'position'=>500), 'bu.label'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'position'=>500),
'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>1, 'position'=>1000),
'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600), 'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605), 'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
'ba.ref'=>array('label'=>$langs->trans("Account"), 'checked'=>1, 'position'=>1000), 'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1000),
'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010), 'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010),
); );
// Extra fields // Extra fields
@ -148,22 +171,35 @@ if (empty($reshook))
* View * View
*/ */
$companystatic=new Societe($db);
$bankaccountstatic=new Account($db);
llxHeader('', $langs->trans("BankTransactions"), '', '', 0, 0, array(), array(), $param);
$form = new Form($db); $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
if ($vline) $viewline = $vline; $companystatic=new Societe($db);
else $viewline = 50; $bankaccountstatic=new Account($db);
$societestatic=new Societe($db);
$userstatic=new User($db);
$chargestatic=new ChargeSociales($db);
$loanstatic=new Loan($db);
$memberstatic=new Adherent($db);
$paymentstatic=new Paiement($db);
$paymentsupplierstatic=new PaiementFourn($db);
$paymentvatstatic=new TVA($db);
$paymentsalstatic=new PaymentSalary($db);
$donstatic=new Don($db);
$expensereportstatic=new ExpenseReport($db);
$bankstatic=new Account($db);
$banklinestatic=new AccountLine($db);
$now = dol_now();
llxHeader('', $langs->trans("BankTransactions"), '', '', 0, 0, array(), array(), $param);
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq,"; $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq,";
$sql.= " b.fk_account, b.fk_type,"; $sql.= " b.fk_account, b.fk_type,";
$sql.= " ba.rowid as bankid, ba.ref as bankref,"; $sql.= " ba.rowid as bankid, ba.ref as bankref,";
$sql.= " bu.url_id,"; $sql.= " bu.url_id,";
$sql.= " s.nom, s.name_alias, s.client, s.fournisseur, s.code_client, s.code_fournisseur"; $sql.= " s.nom, s.name_alias, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
// Add fields from extrafields // Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
// Add fields from hooks // Add fields from hooks
@ -183,7 +219,8 @@ if ($search_ref) $sql.=natural_search("b.rowid", $search_ref);
if ($account > 0) $sql.=" AND b.fk_account = ".$account; if ($account > 0) $sql.=" AND b.fk_account = ".$account;
if ($search_req_nb) $sql.= natural_search("b.num_chq", $search_req_nb); if ($search_req_nb) $sql.= natural_search("b.num_chq", $search_req_nb);
if ($search_num_releve) $sql.= natural_search("b.num_releve", $search_num_releve); if ($search_num_releve) $sql.= natural_search("b.num_releve", $search_num_releve);
if ($search_thirdparty) $sql.=" AND s.nom LIKE '%".$db->escape($search_thirdparty)."%'"; if ($search_thirdparty) $sql.= natural_search("s.nom", $search_thirdparty);
if ($description) $sql.= natural_search("b.label", $description); // Warning some text are just translation keys, not translated strings
if ($bid) $sql.= " AND b.rowid=l.lineid AND l.fk_categ=".$bid; if ($bid) $sql.= " AND b.rowid=l.lineid AND l.fk_categ=".$bid;
if (! empty($type)) $sql.= " AND b.fk_type = '".$db->escape($type)."' "; if (! empty($type)) $sql.= " AND b.fk_type = '".$db->escape($type)."' ";
// Search period criteria // Search period criteria
@ -219,6 +256,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{ {
$result = $db->query($sql); $result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result); $nbtotalofrecords = $db->num_rows($result);
$nbtotalofpages = ceil($nbtotalofrecords/$limit);
} }
$sql.= $db->plimit($limit+1,$offset); $sql.= $db->plimit($limit+1,$offset);
@ -280,14 +318,20 @@ if ($resql)
// Title // Title
$bankcateg=new BankCateg($db); $bankcateg=new BankCateg($db);
$morehtml='<div data-role="fieldcontain">';
$morehtml.= '<label for="pageplusone">'.$langs->trans("Page")."</label> "; // ' Page ';
$morehtml.='<input type="text" name="pageplusone" id="pageplusone" size="1" class="flat" value="'.($page+1).'">';
$morehtml.='/'.$nbtotalofpages.' ';
$morehtml.='</div>';
if (GETPOST("bid")) if (GETPOST("bid"))
{ {
$result=$bankcateg->fetch(GETPOST("bid")); $result=$bankcateg->fetch(GETPOST("bid"));
print_barre_liste($langs->trans("BankTransactionForCategory",$bankcateg->label).' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_bank.png', 0, '', '', $limit); print_barre_liste($langs->trans("BankTransactionForCategory",$bankcateg->label).' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_bank.png', 0, $morehtml, '', $limit);
} }
else else
{ {
print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_bank.png', 0, '', '', $limit); print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_bank.png', 0, $morehtml, '', $limit);
} }
$moreforfilter = ''; $moreforfilter = '';
@ -320,15 +364,16 @@ if ($resql)
// Fields title // Fields title
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (! empty($arrayfields['b.rowid']['checked'])) print_liste_field_titre($arrayfields['b.rowid']['label'],$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['b.rowid']['checked'])) print_liste_field_titre($arrayfields['b.rowid']['label'],$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['description']['checked'])) print_liste_field_titre($arrayfields['description']['label'],$_SERVER['PHP_SELF'],'','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['b.dateo']['checked'])) print_liste_field_titre($arrayfields['b.dateo']['label'],$_SERVER['PHP_SELF'],'b.dateo','',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['b.dateo']['checked'])) print_liste_field_titre($arrayfields['b.dateo']['label'],$_SERVER['PHP_SELF'],'b.dateo','',$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['b.datev']['checked'])) print_liste_field_titre($arrayfields['b.datev']['label'],$_SERVER['PHP_SELF'],'b.datev','',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['b.datev']['checked'])) print_liste_field_titre($arrayfields['b.datev']['label'],$_SERVER['PHP_SELF'],'b.datev, b.dateo, b.rowid','',$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['type']['checked'])) print_liste_field_titre($arrayfields['type']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['type']['checked'])) print_liste_field_titre($arrayfields['type']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['b.num_chq']['checked'])) print_liste_field_titre($arrayfields['b.num_chq']['label'],$_SERVER['PHP_SELF'],'b.num_chq','',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['b.num_chq']['checked'])) print_liste_field_titre($arrayfields['b.num_chq']['label'],$_SERVER['PHP_SELF'],'b.num_chq','',$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['description']['checked'])) print_liste_field_titre($arrayfields['description']['label'],$_SERVER['PHP_SELF'],'','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['bu.label']['checked'])) print_liste_field_titre($arrayfields['bu.label']['label'],$_SERVER['PHP_SELF'],'bu.label','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['bu.label']['checked'])) print_liste_field_titre($arrayfields['bu.label']['label'],$_SERVER['PHP_SELF'],'bu.label','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'],$_SERVER['PHP_SELF'],'ba.ref','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['b.debit']['checked'])) print_liste_field_titre($arrayfields['b.debit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['b.debit']['checked'])) print_liste_field_titre($arrayfields['b.debit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'],$_SERVER['PHP_SELF'],'ba.ref','',$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER['PHP_SELF'],'balance','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['b.num_releve']['checked'])) print_liste_field_titre($arrayfields['b.num_releve']['label'],$_SERVER['PHP_SELF'],'b.num_releve','',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['b.num_releve']['checked'])) print_liste_field_titre($arrayfields['b.num_releve']['label'],$_SERVER['PHP_SELF'],'b.num_releve','',$param,'align="center"',$sortfield,$sortorder);
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
@ -356,6 +401,12 @@ if ($resql)
print '<input type="text" class="flat" name="search_ref" size="4" value="'.dol_escape_htmltag($search_ref).'">'; print '<input type="text" class="flat" name="search_ref" size="4" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['description']['checked']))
{
print '<td class="liste_titre">';
//print '<input type="text" class="flat" name="description" size="10" value="'.dol_escape_htmltag($description).'">';
print '</td>';
}
if (! empty($arrayfields['b.dateo']['checked'])) if (! empty($arrayfields['b.dateo']['checked']))
{ {
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
@ -367,7 +418,7 @@ if ($resql)
if (! empty($arrayfields['type']['checked'])) if (! empty($arrayfields['type']['checked']))
{ {
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
$form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1); $form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1, 0, 1, 'maxwidth100');
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['b.num_chq']['checked'])) if (! empty($arrayfields['b.num_chq']['checked']))
@ -375,16 +426,16 @@ if ($resql)
// Numero // Numero
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="req_nb" value="'.dol_escape_htmltag($search_req_nb).'" size="2"></td>'; print '<td class="liste_titre" align="center"><input type="text" class="flat" name="req_nb" value="'.dol_escape_htmltag($search_req_nb).'" size="2"></td>';
} }
if (! empty($arrayfields['description']['checked']))
{
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="description" size="10" value="'.dol_escape_htmltag($description).'">';
print '</td>';
}
if (! empty($arrayfields['bu.label']['checked'])) if (! empty($arrayfields['bu.label']['checked']))
{ {
print '<td class="liste_titre"><input type="text" class="flat" name="thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'" size="10"></td>'; print '<td class="liste_titre"><input type="text" class="flat" name="thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'" size="10"></td>';
} }
if (! empty($arrayfields['ba.ref']['checked']))
{
print '<td align="right">';
$form->select_comptes($account,'account',0,'',1);
print '</td>';
}
if (! empty($arrayfields['b.debit']['checked'])) if (! empty($arrayfields['b.debit']['checked']))
{ {
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
@ -397,16 +448,17 @@ if ($resql)
print '<input type="text" class="flat" name="credit" size="4" value="'.dol_escape_htmltag($credit).'">'; print '<input type="text" class="flat" name="credit" size="4" value="'.dol_escape_htmltag($credit).'">';
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['ba.ref']['checked'])) if (! empty($arrayfields['balance']['checked']))
{ {
print '<td align="right">'; print '<td align="right">';
$form->select_comptes($account,'account',0,'',1); $htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
print $form->textwithpicto('', $htmltext, 1);
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['b.num_releve']['checked'])) if (! empty($arrayfields['b.num_releve']['checked']))
{ {
// Numero // Numero statement
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_num_releve" value="'.dol_escape_htmltag($search_num_releve).'" size="2"></td>'; print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_num_releve" value="'.dol_escape_htmltag($search_num_releve).'" size="3"></td>';
} }
print '<td class="liste_titre" align="middle">'; print '<td class="liste_titre" align="middle">';
$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
@ -415,27 +467,27 @@ if ($resql)
print "</tr>\n"; print "</tr>\n";
// Loop on each record // Loop on each record
$total = 0; // For balance
$sign = 1;
$totalarray=array(); $totalarray=array();
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
// Why this ? $total = price2num($total + ($sign * $objp->amount),'MT');
$printline=false;
//Search Description if (empty($cachebankaccount[$objp->bankid]))
if ($description) { {
preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthese on tente recherche de traduction $bankaccounttmp = new Account($db);
if ($reg[1]) { $bankaccounttmp->fetch($objp->bankid);
if ($langs->transnoentities($reg[1])==$description) { $cachebankaccount[$objp->bankid]=$bankaccounttmp;
$printline=true; $bankaccount = $bankaccounttmp;
} }
} elseif ($objp->label==$description) { else
$printline=true; {
$bankaccount = $cachebankaccount[$objp->bankid];
} }
} else {
$printline=true;
}
if ($printline) {
$var=!$var; $var=!$var;
@ -445,10 +497,147 @@ if ($resql)
if (! empty($arrayfields['b.rowid']['checked'])) if (! empty($arrayfields['b.rowid']['checked']))
{ {
print '<td align="left" class="nowrap">'; print '<td align="left" class="nowrap">';
print "<a href=\"ligne.php?rowid=".$objp->rowid.'">'.img_object($langs->trans("ShowPayment").': '.$objp->rowid, 'payment', 'class="classfortooltip"').' '.$objp->rowid."</a> &nbsp; "; print "<a href=\"ligne.php?rowid=".$objp->rowid.'">'.img_object($langs->trans("ShowPayment").': '.$objp->rowid, 'account', 'class="classfortooltip"').' '.$objp->rowid."</a> &nbsp; ";
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Description
if (! empty($arrayfields['description']['checked']))
{
print "<td>";
//print "<a href=\"ligne.php?rowid=".$objp->rowid."&amp;account=".$objp->fk_account."\">";
$reg=array();
preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthee on tente recherche de traduction
if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]);
else print dol_trunc($objp->label,40);
//print "</a>&nbsp;";
// Add links after description
$links = $bankaccountstatic->get_url($objp->rowid);
$cachebankaccount=array();
foreach($links as $key=>$val)
{
if ($links[$key]['type']=='payment')
{
$paymentstatic->id=$links[$key]['url_id'];
$paymentstatic->ref=$links[$key]['url_id'];
print ' '.$paymentstatic->getNomUrl(2);
}
elseif ($links[$key]['type']=='payment_supplier')
{
$paymentsupplierstatic->id=$links[$key]['url_id'];
$paymentsupplierstatic->ref=$links[$key]['url_id'];
print ' '.$paymentsupplierstatic->getNomUrl(2);
}
elseif ($links[$key]['type']=='payment_sc')
{
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$links[$key]['url_id'].'">';
print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
//print $langs->trans("SocialContributionPayment");
print '</a>';
}
elseif ($links[$key]['type']=='payment_vat')
{
$paymentvatstatic->id=$links[$key]['url_id'];
$paymentvatstatic->ref=$links[$key]['url_id'];
print ' '.$paymentvatstatic->getNomUrl(2);
}
elseif ($links[$key]['type']=='payment_salary')
{
$paymentsalstatic->id=$links[$key]['url_id'];
$paymentsalstatic->ref=$links[$key]['url_id'];
print ' '.$paymentsalstatic->getNomUrl(2);
}
elseif ($links[$key]['type']=='payment_loan')
{
print '<a href="'.DOL_URL_ROOT.'/loan/payment/card.php?id='.$links[$key]['url_id'].'">';
print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
print '</a>';
}
elseif ($links[$key]['type']=='payment_donation')
{
print '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$links[$key]['url_id'].'">';
print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
print '</a>';
}
elseif ($links[$key]['type']=='payment_expensereport')
{
print '<a href="'.DOL_URL_ROOT.'/expensereport/payment/card.php?id='.$links[$key]['url_id'].'">';
print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
print '</a>';
}
elseif ($links[$key]['type']=='banktransfert')
{
// Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail.
if ($objp->amount > 0)
{
$banklinestatic->fetch($links[$key]['url_id']);
$bankstatic->id=$banklinestatic->fk_account;
$bankstatic->label=$banklinestatic->bank_account_ref;
print ' ('.$langs->trans("TransferFrom").' ';
print $bankstatic->getNomUrl(1,'transactions');
print ' '.$langs->trans("toward").' ';
$bankstatic->id=$objp->bankid;
$bankstatic->label=$objp->bankref;
print $bankstatic->getNomUrl(1,'');
print ')';
}
else
{
$bankstatic->id=$objp->bankid;
$bankstatic->label=$objp->bankref;
print ' ('.$langs->trans("TransferFrom").' ';
print $bankstatic->getNomUrl(1,'');
print ' '.$langs->trans("toward").' ';
$banklinestatic->fetch($links[$key]['url_id']);
$bankstatic->id=$banklinestatic->fk_account;
$bankstatic->label=$banklinestatic->bank_account_ref;
print $bankstatic->getNomUrl(1,'transactions');
print ')';
}
//var_dump($links);
}
elseif ($links[$key]['type']=='company')
{
}
elseif ($links[$key]['type']=='user')
{
}
elseif ($links[$key]['type']=='member')
{
}
elseif ($links[$key]['type']=='sc')
{
}
else
{
// Show link with label $links[$key]['label']
if (! empty($objp->label) && ! empty($links[$key]['label'])) print ' - ';
print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
if (preg_match('/^\((.*)\)$/i',$links[$key]['label'],$reg))
{
// Label generique car entre parentheses. On l'affiche en le traduisant
if ($reg[1]=='paiement') $reg[1]='Payment';
print ' '.$langs->trans($reg[1]);
}
else
{
print ' '.$links[$key]['label'];
}
print '</a>';
}
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date ope // Date ope
if (! empty($arrayfields['b.dateo']['checked'])) if (! empty($arrayfields['b.dateo']['checked']))
{ {
@ -481,22 +670,6 @@ if ($resql)
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Description
if (! empty($arrayfields['description']['checked']))
{
print "<td>";
print "<a href=\"ligne.php?rowid=".$objp->rowid."&amp;account=".$objp->fk_account."\">";
$reg=array();
preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthee on tente recherche de traduction
if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]);
else print dol_trunc($objp->label,40);
print "</a>&nbsp;";
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Third party // Third party
if (! empty($arrayfields['bu.label']['checked'])) if (! empty($arrayfields['bu.label']['checked']))
{ {
@ -510,6 +683,8 @@ if ($resql)
$companystatic->fournisseur=$objp->fournisseur; $companystatic->fournisseur=$objp->fournisseur;
$companystatic->code_client=$objp->code_client; $companystatic->code_client=$objp->code_client;
$companystatic->code_fournisseur=$objp->code_fournisseur; $companystatic->code_fournisseur=$objp->code_fournisseur;
$companystatic->code_compta=$objp->code_compta;
$companystatic->code_compta_fournisseur=$objp->code_compta_fournisseur;
print $companystatic->getNomUrl(1); print $companystatic->getNomUrl(1);
} }
else else
@ -520,6 +695,15 @@ if ($resql)
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Bank account
if (! empty($arrayfields['ba.ref']['checked']))
{
print '<td align="right" class="nowrap">';
print $bankaccount->getNomUrl(1);
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Debit // Debit
if (! empty($arrayfields['b.debit']['checked'])) if (! empty($arrayfields['b.debit']['checked']))
{ {
@ -547,21 +731,67 @@ if ($resql)
if (! $i) $totalarray['totalcredfield']=$totalarray['nbfield']; if (! $i) $totalarray['totalcredfield']=$totalarray['nbfield'];
} }
// Bank account // Balance
if (! empty($arrayfields['ba.ref']['checked'])) if (! empty($arrayfields['balance']['checked']))
{ {
print '<td align="right" class="nowrap">'; if ($mode_balance_ok)
$bankaccountstatic->id=$objp->bankid; {
$bankaccountstatic->label=$objp->bankref; if ($total >= 0)
print $bankaccountstatic->getNomUrl(1); {
print "</td>\n"; print '<td align="right" class="nowrap">&nbsp;'.price($total).'</td>';
if (! $i) $totalarray['nbfield']++; }
else
{
print '<td align="right" class="error nowrap">&nbsp;'.price($total).'</td>';
}
}
else
{
print '<td align="right">-</td>';
}
} }
if (! empty($arrayfields['b.num_releve']['checked'])) // Transaction reconciliated or edit link
if ($objp->rappro && $bankaccount->canBeConciliated() > 0) // If line not conciliated and account can be conciliated
{ {
print '<td class="nowrap" align="center">'.($objp->num_releve?$objp->num_releve:"")."</td>\n"; print '<td align="center" class="nowrap">';
if (! $i) $totalarray['nbfield']++; print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$object->id.'&amp;page='.$page.'">';
print img_edit();
print '</a>';
print "&nbsp; ";
print '<a href="releve.php?num='.$objp->num_releve.'&amp;account='.$object->id.'">'.$objp->num_releve.'</a>';
print "</td>";
}
else
{
print '<td align="center">';
if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
{
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$object->id.'&amp;page='.$page.'">';
print img_edit();
print '</a>';
}
else
{
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$object->id.'&amp;page='.$page.'">';
print img_view();
print '</a>';
}
if ($bankaccount->canBeConciliated() > 0 && empty($objp->rappro))
{
if ($db->jdate($objp->dv) < ($now - $conf->bank->rappro->warning_delay))
{
print ' '.img_warning($langs->trans("Late"));
}
}
print '&nbsp;';
if ($user->rights->banque->modifier)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&amp;rowid='.$objp->rowid.'&amp;id='.$object->id.'&amp;page='.$page.'">';
print img_delete();
print '</a>';
}
print '</td>';
} }
// Action column // Action column
@ -576,7 +806,7 @@ if ($resql)
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
print "</tr>"; print "</tr>";
}
$i++; $i++;
} }

View File

@ -22,7 +22,7 @@
/** /**
* \file htdocs/compta/bank/treso.php * \file htdocs/compta/bank/treso.php
* \ingroup banque * \ingroup banque
* \brief Page de detail du budget de tresorerie * \brief Page to estimate future balance
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
@ -77,42 +77,32 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$viewline = 20; $viewline = 20;
} }
$acct = new Account($db); $object = new Account($db);
if ($_GET["account"]) if ($_GET["account"])
{ {
$result=$acct->fetch($_GET["account"]); $result=$object->fetch($_GET["account"]);
} }
if ($_GET["ref"]) if ($_GET["ref"])
{ {
$result=$acct->fetch(0,$_GET["ref"]); $result=$object->fetch(0,$_GET["ref"]);
$_GET["account"]=$acct->id; $_GET["account"]=$object->id;
} }
// Onglets // Onglets
$head=bank_prepare_head($acct); $head=bank_prepare_head($object);
dol_fiche_head($head,'cash',$langs->trans("FinancialAccount"),0,'account'); dol_fiche_head($head,'cash',$langs->trans("FinancialAccount"),0,'account');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
// Ref dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
print $form->showrefnav($acct, 'ref', $linkback, 1, 'ref');
print '</td></tr>';
// Label
print '<tr><td>'.$langs->trans("Label").'</td>';
print '<td colspan="3">'.$acct->label.'</td></tr>';
print '</table>';
dol_fiche_end(); dol_fiche_end();
$solde = $acct->solde(0); $solde = $object->solde(0);
/* /*
* Affiche tableau des echeances a venir * Affiche tableau des echeances a venir
@ -154,7 +144,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
$sql.= " WHERE f.entity = ".$conf->entity; $sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " AND f.paye = 0 AND f.fk_statut = 1"; // Not paid $sql.= " AND f.paye = 0 AND f.fk_statut = 1"; // Not paid
$sql.= " AND (f.fk_account IN (0, ".$acct->id.") OR f.fk_account IS NULL)"; // Id bank account of invoice $sql.= " AND (f.fk_account IN (0, ".$object->id.") OR f.fk_account IS NULL)"; // Id bank account of invoice
$sql.= " ORDER BY dlr ASC"; $sql.= " ORDER BY dlr ASC";
// Supplier invoices // Supplier invoices
@ -164,7 +154,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid"; $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid";
$sql2.= " WHERE ff.entity = ".$conf->entity; $sql2.= " WHERE ff.entity = ".$conf->entity;
$sql2.= " AND ff.paye = 0 AND fk_statut = 1"; // Not paid $sql2.= " AND ff.paye = 0 AND fk_statut = 1"; // Not paid
$sql2.= " AND (ff.fk_account IN (0, ".$acct->id.") OR ff.fk_account IS NULL)"; // Id bank account of supplier invoice $sql2.= " AND (ff.fk_account IN (0, ".$object->id.") OR ff.fk_account IS NULL)"; // Id bank account of supplier invoice
$sql2.= " ORDER BY dlr ASC"; $sql2.= " ORDER BY dlr ASC";
// Social contributions // Social contributions
@ -174,7 +164,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$sql3.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id"; $sql3.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id";
$sql3.= " WHERE cs.entity = ".$conf->entity; $sql3.= " WHERE cs.entity = ".$conf->entity;
$sql3.= " AND cs.paye = 0"; // Not paid $sql3.= " AND cs.paye = 0"; // Not paid
$sql3.= " AND (cs.fk_account IN (0, ".$acct->id.") OR cs.fk_account IS NULL)"; // Id bank account of social contribution $sql3.= " AND (cs.fk_account IN (0, ".$object->id.") OR cs.fk_account IS NULL)"; // Id bank account of social contribution
$sql3.= " ORDER BY dlr ASC"; $sql3.= " ORDER BY dlr ASC";
$error=0; $error=0;
@ -332,8 +322,8 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
// Solde actuel // Solde actuel
$var=!$var; $var=!$var;
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td align="left" colspan="5">'.$langs->trans("FutureBalance").' ('.$acct->currency_code.')</td>'; print '<td align="left" colspan="5">'.$langs->trans("FutureBalance").' ('.$object->currency_code.')</td>';
print '<td align="right" class="nowrap">'.price($solde, 0, $langs, 0, 0, -1, $acct->currency_code).'</td>'; print '<td align="right" class="nowrap">'.price($solde, 0, $langs, 0, 0, -1, $object->currency_code).'</td>';
print '</tr>'; print '</tr>';
print "</table>"; print "</table>";

View File

@ -2814,9 +2814,10 @@ class Form
* @param int $noadmininfo 0=Add admin info, 1=Disable admin info * @param int $noadmininfo 0=Add admin info, 1=Disable admin info
* @param int $maxlength Max length of label * @param int $maxlength Max length of label
* @param int $active Active or not, -1 = all * @param int $active Active or not, -1 = all
* @param string $morecss Add more css
* @return void * @return void
*/ */
function select_types_paiements($selected='', $htmlname='paiementtype', $filtertype='', $format=0, $empty=0, $noadmininfo=0, $maxlength=0, $active=1) function select_types_paiements($selected='', $htmlname='paiementtype', $filtertype='', $format=0, $empty=0, $noadmininfo=0, $maxlength=0, $active=1, $morecss='')
{ {
global $langs,$user; global $langs,$user;
@ -2829,7 +2830,7 @@ class Form
$this->load_cache_types_paiements(); $this->load_cache_types_paiements();
print '<select id="select'.$htmlname.'" class="flat selectpaymenttypes" name="'.$htmlname.'">'; print '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'">';
if ($empty) print '<option value="">&nbsp;</option>'; if ($empty) print '<option value="">&nbsp;</option>';
foreach($this->cache_types_paiements as $id => $arraytypes) foreach($this->cache_types_paiements as $id => $arraytypes)
{ {

View File

@ -943,10 +943,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
// Chart of account // Chart of account
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("", $langs->trans("Setup"),1,$user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin', 1); if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("", $langs->trans("Setup"),1,$user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin', 1);
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 2); if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 10);
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 3); if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 20);
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 2); if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 40);
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&amp;leftmenu=accountancy", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 2); if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/admin/dict.php?id=10&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 30);
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&amp;leftmenu=accountancy", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 50);
// Binding // Binding
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&amp;mainmenu=accountancy",$langs->trans("CustomersVentilation"),1,$user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer'); if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&amp;mainmenu=accountancy",$langs->trans("CustomersVentilation"),1,$user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer');

View File

@ -377,92 +377,16 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$default_font_size = pdf_getPDFFontSize($outputlangs); $default_font_size = pdf_getPDFFontSize($outputlangs);
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'BANK_CHEQUERECEIPT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
$paramfreetext='BANK_CHEQUERECEIPT_FREE_TEXT';
$marge_basse=$this->marge_basse;
$marge_gauche=$this->marge_gauche;
$page_hauteur=$this->page_hauteur;
// Line of free text // Line of free text
$line=(! empty($conf->global->$paramfreetext))?$outputlangs->convToOutputCharset($conf->global->$paramfreetext):""; $newfreetext='';
$paramfreetext='BANK_CHEQUERECEIPT_FREE_TEXT';
$pdf->SetFont('','', $default_font_size - 3); if (! empty($conf->global->$paramfreetext))
$pdf->SetDrawColor(224,224,224);
// The start of the bottom of this page footer is positioned according to # of lines
$freetextheight=0;
if ($line) // Free text
{ {
//$line="eee<br>\nfd<strong>sf</strong>sdf<br>\nghfghg<br>"; $newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray);
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) // by default
{
$width=20000; $align='L'; // By default, ask a manual break: We use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text.
if (! empty($conf->global->MAIN_USE_AUTOWRAP_ON_FREETEXT)) {
$width=200; $align='C';
} }
$freetextheight=$pdf->getStringHeight($width,$line);
} return pdf_pagefoot($pdf,$outputlangs,$newfreetext,$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
else
{
$freetextheight=pdfGetHeightForHtmlContent($pdf,dol_htmlentitiesbr($line, 1, 'UTF-8', 0)); // New method (works for HTML content)
//print '<br>'.$freetextheight;exit;
} }
} }
$marginwithfooter=$marge_basse + $freetextheight;
$posy=$marginwithfooter+0;
if ($line) // Free text
{
$pdf->SetXY($dims['lm'],-$posy);
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) // by default
{
$pdf->MultiCell(0, 3, $line, 0, $align, 0);
}
else
{
$pdf->writeHTMLCell($pdf->page_largeur - $pdf->margin_left - $pdf->margin_right, $freetextheight, $dims['lm'], $dims['hk']-$marginwithfooter, dol_htmlentitiesbr($line, 1, 'UTF-8', 0));
}
$posy-=$freetextheight;
}
// On positionne le debut du bas de page selon nbre de lignes de ce bas de page
/*
$nbofline=dol_nboflines_bis($line,0,$outputlangs->charset_output);
//print 'e'.$line.'t'.dol_nboflines($line);exit;
$posy=$marge_basse + ($nbofline*3);
if ($line) // Free text
{
$pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(20000, 3, $line, 0, 'L', 0); // Use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text.
$posy-=($nbofline*3); // 6 of ligne + 3 of MultiCell
}*/
$pdf->SetY(-$posy);
$pdf->line($marge_gauche, $page_hauteur-$posy, 200, $page_hauteur-$posy);
$posy--;
/*if ($line1)
{
$pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $line1, 0, 'C', 0);
}
if ($line2)
{
$posy-=3;
$pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $line2, 0, 'C', 0);
}*/
// Show page nb only on iso languages (so default Helvetica font)
if (pdf_getPDFFont($outputlangs) == 'Helvetica')
{
$pdf->SetXY(-20,-$posy);
$pdf->MultiCell(11, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0);
}
}
}

View File

@ -590,8 +590,6 @@ class pdf_einstein extends ModelePDFCommandes
$this->error=$langs->trans("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR"); $this->error=$langs->trans("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR");
return 0; return 0;
} }
$this->error=$langs->trans("ErrorUnknown");
return 0; // Erreur par defaut
} }
/** /**

View File

@ -406,8 +406,6 @@ class pdf_strato extends ModelePDFContract
$this->error=$langs->trans("ErrorConstantNotDefined","CONTRACT_OUTPUTDIR"); $this->error=$langs->trans("ErrorConstantNotDefined","CONTRACT_OUTPUTDIR");
return 0; return 0;
} }
$this->error=$langs->trans("ErrorUnknown");
return 0; // Erreur par defaut
} }
/** /**

View File

@ -269,8 +269,6 @@ class html_cerfafr extends ModeleDon
$this->error=$langs->trans("ErrorConstantNotDefined","DON_OUTPUTDIR"); $this->error=$langs->trans("ErrorConstantNotDefined","DON_OUTPUTDIR");
return 0; return 0;
} }
$this->error=$langs->trans("ErrorUnknown");
return 0; // Error by default
} }
} }

View File

@ -482,8 +482,6 @@ class pdf_standard extends ModeleExpenseReport
$this->error=$langs->trans("ErrorConstantNotDefined","EXPENSEREPORT_OUTPUTDIR"); $this->error=$langs->trans("ErrorConstantNotDefined","EXPENSEREPORT_OUTPUTDIR");
return 0; return 0;
} }
$this->error=$langs->trans("ErrorUnknown");
return 0; // Erreur par defaut
} }
/** /**

View File

@ -405,8 +405,6 @@ class pdf_soleil extends ModelePDFFicheinter
$this->error=$langs->trans("ErrorConstantNotDefined","FICHEINTER_OUTPUTDIR"); $this->error=$langs->trans("ErrorConstantNotDefined","FICHEINTER_OUTPUTDIR");
return 0; return 0;
} }
$this->error=$langs->trans("ErrorUnknown");
return 0; // Erreur par defaut
} }
/** /**

View File

@ -763,9 +763,6 @@ class pdf_azur extends ModelePDFPropales
$this->error=$langs->trans("ErrorConstantNotDefined","PROP_OUTPUTDIR"); $this->error=$langs->trans("ErrorConstantNotDefined","PROP_OUTPUTDIR");
return 0; return 0;
} }
$this->error=$langs->trans("ErrorUnknown");
return 0; // Erreur par defaut
} }
/** /**

View File

@ -549,8 +549,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$this->error=$langs->trans("ErrorConstantNotDefined","SUPPLIER_OUTPUTDIR"); $this->error=$langs->trans("ErrorConstantNotDefined","SUPPLIER_OUTPUTDIR");
return 0; return 0;
} }
$this->error=$langs->trans("ErrorUnknown");
return 0; // Erreur par defaut
} }
/** /**

View File

@ -572,8 +572,6 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$this->error=$langs->trans("ErrorConstantNotDefined","SUPPLIER_OUTPUTDIR"); $this->error=$langs->trans("ErrorConstantNotDefined","SUPPLIER_OUTPUTDIR");
return 0; return 0;
} }
$this->error=$langs->trans("ErrorUnknown");
return 0; // Erreur par defaut
} }

View File

@ -198,8 +198,6 @@ class InterfaceLogevents extends DolibarrTriggers
dol_syslog(get_class($this).": ".$this->error, LOG_ERR); dol_syslog(get_class($this).": ".$this->error, LOG_ERR);
return -1; return -1;
} }
return 0;
} }
} }

View File

@ -333,3 +333,7 @@ INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (20
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2321,232, '0','0','No VAT',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2321,232, '0','0','No VAT',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2322,232, '12','0','VAT 12%',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2322,232, '12','0','VAT 12%',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2323,232, '8','0','VAT 8%',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2323,232, '8','0','VAT 8%',1);

View File

@ -140,3 +140,13 @@ ALTER TABLE llx_accounting_bookkeeping ADD COLUMN tms timestamp;
ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (account_number, entity, fk_pcg_version); ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (account_number, entity, fk_pcg_version);
ALTER TABLE llx_c_payment_term change fdm type_cdr tinyint ALTER TABLE llx_c_payment_term change fdm type_cdr tinyint
ALTER TABLE llx_facturedet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
ALTER TABLE llx_facture_fourn_det ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
ALTER TABLE llx_commandedet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
ALTER TABLE llx_commande_fournisseurdet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
ALTER TABLE llx_propaldet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
ALTER TABLE llx_supplier_proposaldet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;

View File

@ -28,6 +28,7 @@ create table llx_commande_fournisseurdet
ref varchar(50), -- supplier product ref ref varchar(50), -- supplier product ref
label varchar(255), -- product label label varchar(255), -- product label
description text, description text,
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
tva_tx double(6,3) DEFAULT 0, -- taux tva tva_tx double(6,3) DEFAULT 0, -- taux tva
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
localtax1_type varchar(10) NULL, -- localtax1 type localtax1_type varchar(10) NULL, -- localtax1 type

View File

@ -28,7 +28,8 @@ create table llx_commandedet
fk_product integer NULL, fk_product integer NULL,
label varchar(255) DEFAULT NULL, label varchar(255) DEFAULT NULL,
description text, description text,
tva_tx double(6,3), -- vat rate vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
tva_tx double(6,3), -- Vat rate
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
localtax1_type varchar(10) NULL, -- localtax1 type localtax1_type varchar(10) NULL, -- localtax1 type
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate

View File

@ -31,6 +31,7 @@ create table llx_facture_fourn_det
pu_ttc double(24,8), -- unit price with tax pu_ttc double(24,8), -- unit price with tax
qty real, -- quantity of product/service qty real, -- quantity of product/service
remise_percent real DEFAULT 0, -- % de la remise ligne (exemple 20%) remise_percent real DEFAULT 0, -- % de la remise ligne (exemple 20%)
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
tva_tx double(6,3), -- TVA taux product/service tva_tx double(6,3), -- TVA taux product/service
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
localtax1_type varchar(10) NULL, -- localtax1 type localtax1_type varchar(10) NULL, -- localtax1 type

View File

@ -30,6 +30,7 @@ create table llx_facturedet
fk_product integer NULL, -- Doit pouvoir etre nul pour ligne detail sans produits fk_product integer NULL, -- Doit pouvoir etre nul pour ligne detail sans produits
label varchar(255) DEFAULT NULL, label varchar(255) DEFAULT NULL,
description text, description text,
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
tva_tx double(6,3), -- Vat rate (example 20%) tva_tx double(6,3), -- Vat rate (example 20%)
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
localtax1_type varchar(10) NULL, -- localtax1 type localtax1_type varchar(10) NULL, -- localtax1 type
@ -44,12 +45,12 @@ create table llx_facturedet
total_ht double(24,8), -- Total HT de la ligne toute quantite et incluant remise ligne et globale total_ht double(24,8), -- Total HT de la ligne toute quantite et incluant remise ligne et globale
total_tva double(24,8), -- Total TVA de la ligne toute quantite et incluant remise ligne et globale total_tva double(24,8), -- Total TVA de la ligne toute quantite et incluant remise ligne et globale
total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1 for total quantity of line total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1 for total quantity of line
total_localtax2 double(24,8) DEFAULT 0, -- total LocalTax2 for total quantity of line total_localtax2 double(24,8) DEFAULT 0, -- Total LocalTax2 for total quantity of line
total_ttc double(24,8), -- Total TTC de la ligne toute quantite et incluant remise ligne et globale total_ttc double(24,8), -- Total TTC de la ligne toute quantite et incluant remise ligne et globale
product_type integer DEFAULT 0, product_type integer DEFAULT 0,
date_start datetime DEFAULT NULL, -- date debut si service date_start datetime DEFAULT NULL, -- date start if service
date_end datetime DEFAULT NULL, -- date fin si service date_end datetime DEFAULT NULL, -- date end if service
info_bits integer DEFAULT 0, -- TVA NPR ou non info_bits integer DEFAULT 0, -- VAT NPR or not (for france only)
buy_price_ht double(24,8) DEFAULT 0, -- buying price buy_price_ht double(24,8) DEFAULT 0, -- buying price
fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created) fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created)

View File

@ -28,7 +28,8 @@ create table llx_propaldet
label varchar(255) DEFAULT NULL, label varchar(255) DEFAULT NULL,
description text, description text,
fk_remise_except integer NULL, -- Lien vers table des remises fixes fk_remise_except integer NULL, -- Lien vers table des remises fixes
tva_tx double(6,3) DEFAULT 0, -- taux tva vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
tva_tx double(6,3) DEFAULT 0, -- Vat rate
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
localtax1_type varchar(10) NULL, -- localtax1 type localtax1_type varchar(10) NULL, -- localtax1 type
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate

View File

@ -23,7 +23,8 @@ CREATE TABLE llx_supplier_proposaldet (
label varchar(255) DEFAULT NULL, label varchar(255) DEFAULT NULL,
description text, description text,
fk_remise_except integer DEFAULT NULL, fk_remise_except integer DEFAULT NULL,
tva_tx double(6,3) DEFAULT 0, vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
tva_tx double(6,3) DEFAULT 0, -- Vat rate
localtax1_tx double(6,3) DEFAULT 0, localtax1_tx double(6,3) DEFAULT 0,
localtax1_type varchar(10) DEFAULT NULL, localtax1_type varchar(10) DEFAULT NULL,
localtax2_tx double(6,3) DEFAULT 0, localtax2_tx double(6,3) DEFAULT 0,
@ -45,7 +46,6 @@ CREATE TABLE llx_supplier_proposaldet (
special_code integer DEFAULT 0, special_code integer DEFAULT 0,
rang integer DEFAULT 0, rang integer DEFAULT 0,
ref_fourn varchar(30) DEFAULT NULL, ref_fourn varchar(30) DEFAULT NULL,
fk_multicurrency integer, fk_multicurrency integer,
multicurrency_code varchar(255), multicurrency_code varchar(255),
multicurrency_subprice double(24,8) DEFAULT 0, multicurrency_subprice double(24,8) DEFAULT 0,

View File

@ -24,7 +24,7 @@ AccountancyAreaDescActionFreq=The following actions are usually executed every m
AccountancyAreaDescChartModel=STEP %s: Create a model of chart of account from menu %s AccountancyAreaDescChartModel=STEP %s: Create a model of chart of account from menu %s
AccountancyAreaDescChart=STEP %s: Create or check content of your chart of account from menu %s AccountancyAreaDescChart=STEP %s: Create or check content of your chart of account from menu %s
AccountancyAreaDescBank=STEP %s: Check the binding between bank accounts and accounting account is done. Complete missing bindings. This will save you time in future for the next steps by suggesting you the correct default accounting account on your payment lines.<br>For this, go on the card of each financial account. You can start from page %s. AccountancyAreaDescBank=STEP %s: Check the binding between bank accounts and accounting account is done. Complete missing bindings. This will save you time in future for the next steps by suggesting you the correct default accounting account on your payment lines.<br>For this, go on the card of each financial account. You can start from page %s.
AccountancyAreaDescVat=STEP %s: Check the binding between vat payment and accounting account is done. Complete missing bindings. This will save you time in future for the next steps by suggesting you the correct default accounting account on record related to VAT payments.<br>You can set accounting accounts to use for each VAT from page %s. AccountancyAreaDescVat=STEP %s: Check the binding between vat rates and accounting account is done. Complete missing bindings. This will save you time in future for the next steps by suggesting you the correct default accounting account on record related to VAT lines.<br>You can set accounting accounts to use for each VAT from page %s.
AccountancyAreaDescSal=STEP %s: Check the binding between salaries payment and accounting account is done. Complete missing bindings. This will save you time in future for the next steps by suggesting you the correct default accounting account on record related to payment of salaries.<br>For this you can use the menu entry %s. AccountancyAreaDescSal=STEP %s: Check the binding between salaries payment and accounting account is done. Complete missing bindings. This will save you time in future for the next steps by suggesting you the correct default accounting account on record related to payment of salaries.<br>For this you can use the menu entry %s.
AccountancyAreaDescContrib=STEP %s: Check the binding between special expences (miscellaneous taxes) and accounting account is done. Complete missing bindings. This will save you time in future for the next steps by suggesting you the correct default accounting account on record related to payments of taxes.<br>For this you can use the menu entry %s. AccountancyAreaDescContrib=STEP %s: Check the binding between special expences (miscellaneous taxes) and accounting account is done. Complete missing bindings. This will save you time in future for the next steps by suggesting you the correct default accounting account on record related to payments of taxes.<br>For this you can use the menu entry %s.
AccountancyAreaDescDonation=STEP %s: Check the binding between donation and accounting account is done. Complete missing bindings. This will save you time in future for the next steps by suggesting you the correct default accounting account on record related to payments of donation.<br>You can set the account dedicated for that from the menu entry %s. AccountancyAreaDescDonation=STEP %s: Check the binding between donation and accounting account is done. Complete missing bindings. This will save you time in future for the next steps by suggesting you the correct default accounting account on record related to payments of donation.<br>You can set the account dedicated for that from the menu entry %s.
@ -46,6 +46,7 @@ AccountAccounting=Accounting account
AccountAccountingShort=Account AccountAccountingShort=Account
AccountAccountingSuggest=Accounting account suggest AccountAccountingSuggest=Accounting account suggest
MenuDefaultAccounts=Default accounts MenuDefaultAccounts=Default accounts
MenuVatAccounts=Vat accounts
MenuProductsAccounts=Product accounts MenuProductsAccounts=Product accounts
ProductsBinding=Products accounts ProductsBinding=Products accounts
Ventilation=Binding to accounts Ventilation=Binding to accounts

View File

@ -86,6 +86,7 @@ Refund=Refund
SocialContributionsPayments=Social/fiscal taxes payments SocialContributionsPayments=Social/fiscal taxes payments
ShowVatPayment=Show VAT payment ShowVatPayment=Show VAT payment
TotalToPay=Total to pay TotalToPay=Total to pay
BalanceVisibilityDependsOnSortAndFilters=Balance is visible in this list only if table is sorted ascending on %s and filtered for 1 bank account
CustomerAccountancyCode=Customer accountancy code CustomerAccountancyCode=Customer accountancy code
SupplierAccountancyCode=Supplier accountancy code SupplierAccountancyCode=Supplier accountancy code
CustomerAccountancyCodeShort=Cust. account. code CustomerAccountancyCodeShort=Cust. account. code

View File

@ -335,23 +335,23 @@ else
} }
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($search_categ > 0) $param.="&amp;search_categ=".$search_categ; if ($search_categ > 0) $param.="&amp;search_categ=".urlencode($search_categ);
if ($sref) $param="&amp;sref=".$sref; if ($sref) $param="&amp;sref=".urlencode($sref);
if ($search_ref_supplier) $param="&amp;search_ref_supplier=".$search_ref_supplier; if ($search_ref_supplier) $param="&amp;search_ref_supplier=".urlencode($search_ref_supplier);
if ($sbarcode) $param.=($sbarcode?"&amp;sbarcode=".$sbarcode:""); if ($sbarcode) $param.=($sbarcode?"&amp;sbarcode=".urlencode($sbarcode):"");
if ($snom) $param.="&amp;snom=".$snom; if ($snom) $param.="&amp;snom=".urlencode($snom);
if ($sall) $param.="&amp;sall=".$sall; if ($sall) $param.="&amp;sall=".urlencode($sall);
if ($tosell != '') $param.="&amp;tosell=".$tosell; if ($tosell != '') $param.="&amp;tosell=".urlencode($tosell);
if ($tobuy != '') $param.="&amp;tobuy=".$tobuy; if ($tobuy != '') $param.="&amp;tobuy=".urlencode($tobuy);
if ($fourn_id) $param.=($fourn_id?"&amp;fourn_id=".$fourn_id:""); if ($fourn_id > 0) $param.=($fourn_id?"&amp;fourn_id=".$fourn_id:"");
if ($seach_categ) $param.=($search_categ?"&amp;search_categ=".$search_categ:""); if ($seach_categ) $param.=($search_categ?"&amp;search_categ=".urlencode($search_categ):"");
if ($type != '') $param.='&amp;type='.urlencode($type); if ($type != '') $param.='&amp;type='.urlencode($type);
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
if ($search_tobatch) $param="&amp;search_ref_supplier=".$search_ref_supplier; if ($search_tobatch) $param="&amp;search_ref_supplier=".urlencode($search_ref_supplier);
if ($search_accountancy_code_sell) $param="&amp;search_accountancy_code_sell=".$search_accountancy_code_sell; if ($search_accountancy_code_sell) $param="&amp;search_accountancy_code_sell=".urlencode($search_accountancy_code_sell);
if ($search_accountancy_code_buy) $param="&amp;search_accountancy_code_buy=".$search_accountancy_code_buy; if ($search_accountancy_code_buy) $param="&amp;search_accountancy_code_buy=".urlencode($search_accountancy_code_buy);
// Add $param from extra fields // Add $param from extra fields
foreach ($search_array_options as $key => $val) foreach ($search_array_options as $key => $val)
{ {

View File

@ -260,7 +260,6 @@ abstract class ActionsCardCommon
return; return;
} }
} }
exit;
} }
else else
{ {

View File

@ -1904,6 +1904,10 @@ class Societe extends CommonObject
$label.= '<br><b>' . $langs->trans('CustomerCode') . ':</b> '. $this->code_client; $label.= '<br><b>' . $langs->trans('CustomerCode') . ':</b> '. $this->code_client;
if (! empty($this->code_fournisseur) && $this->fournisseur) if (! empty($this->code_fournisseur) && $this->fournisseur)
$label.= '<br><b>' . $langs->trans('SupplierCode') . ':</b> '. $this->code_fournisseur; $label.= '<br><b>' . $langs->trans('SupplierCode') . ':</b> '. $this->code_fournisseur;
if (! empty($conf->accounting->enabled) && $this->client)
$label.= '<br><b>' . $langs->trans('CustomerAccountancyCode') . ':</b> '. $this->code_compta_client;
if (! empty($conf->accounting->enabled) && $this->fournisseur)
$label.= '<br><b>' . $langs->trans('SupplierAccountancyCode') . ':</b> '. $this->code_compta_fournisseur;
if (! empty($this->logo)) if (! empty($this->logo))
{ {