Merge remote-tracking branch 'upstream/develop' into develop
This commit is contained in:
commit
0add51b7cb
@ -164,10 +164,14 @@ class Skeleton_Class extends CommonObject
|
||||
$sql .= ' t.field2';
|
||||
//...
|
||||
$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) {
|
||||
$sql .= ' WHERE t.ref = ' . '\'' . $ref . '\'';
|
||||
$sql .= ' AND t.ref = ' . '\'' . $ref . '\'';
|
||||
} else {
|
||||
$sql .= ' WHERE t.rowid = ' . $id;
|
||||
$sql .= ' AND t.rowid = ' . $id;
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -236,16 +240,20 @@ class Skeleton_Class extends CommonObject
|
||||
$sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||
}
|
||||
}
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere);
|
||||
$sql.= ' WHERE 1 = 1';
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("skeleton", 1) . ")";
|
||||
}
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' AND ' . implode(' '.$filtermode.' ', $sqlwhere);
|
||||
}
|
||||
|
||||
if (!empty($sortfield)) {
|
||||
$sql .= $this->db->order($sortfield,$sortorder);
|
||||
}
|
||||
if (!empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$this->lines = array();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -491,7 +499,7 @@ class Skeleton_Class extends CommonObject
|
||||
* Return the 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
|
||||
*/
|
||||
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 == 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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -79,9 +79,11 @@ if ($action == 'delete') {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxheader('', $langs->trans('AccountAccounting'));
|
||||
|
||||
$formaccounting = new FormAccounting($db);
|
||||
@ -126,6 +128,7 @@ dol_fiche_end();
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
if ($action == 'display' || $action == 'delete') {
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
@ -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="action" value="update">';
|
||||
|
||||
/*
|
||||
* Define Chart of accounts
|
||||
*/
|
||||
// Define Chart of accounts
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ if (! $user->rights->accounting->bind->write)
|
||||
accessforbidden();
|
||||
|
||||
// search & action GETPOST
|
||||
$action = GETPOST('action');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$codeventil_buy = GETPOST('codeventil_buy', 'array');
|
||||
$codeventil_sell = GETPOST('codeventil_sell', 'array');
|
||||
$chk_prod = GETPOST('chk_prod', 'array');
|
||||
@ -65,28 +65,34 @@ $accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
|
||||
$btn_changeaccount = GETPOST('changeaccount');
|
||||
$btn_changetype = GETPOST('changetype');
|
||||
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
if ($page < 0)
|
||||
$page = 0;
|
||||
$limit = GETPOST("limit")?GETPOST("limit","int"):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
// bug in page limit if ACCOUNTING_LIMIT_LIST_VENTILATION < $conf->liste_limit there is no pagination displayed !
|
||||
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) && $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION >= $conf->liste_limit) {
|
||||
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
|
||||
} else {
|
||||
$limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
if (! $sortfield) $sortfield="p.ref";
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
|
||||
if (! $sortfield) {
|
||||
$sortfield = "p.ref";
|
||||
if (empty($action)) $action='list';
|
||||
|
||||
$arrayfields=array();
|
||||
|
||||
|
||||
/*
|
||||
* 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 = '';
|
||||
}
|
||||
if (! $sortorder) {
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
|
||||
|
||||
// Sales or Purchase mode ?
|
||||
if ($action == 'update') {
|
||||
if (! empty($btn_changetype)) {
|
||||
@ -158,6 +164,12 @@ if ($action == 'update') {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new FormVentilation($db);
|
||||
|
||||
// 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_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"));
|
||||
|
||||
print '<script type="text/javascript">
|
||||
$(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>';
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
$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 .= " WHERE (";
|
||||
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') {
|
||||
$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
|
||||
@ -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
|
||||
(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 .= ")";
|
||||
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql.= ' AND p.entity IN ('.getEntity('product', 1).')';
|
||||
}
|
||||
// Add search filter like
|
||||
if (strlen(trim($search_ref))) {
|
||||
$sql .= " AND (p.ref like '" . $search_ref . "%')";
|
||||
$sql .= natural_search("p.ref",$search_ref);
|
||||
}
|
||||
if (strlen(trim($search_label))) {
|
||||
$sql .= " AND (p.label like '" . $search_label . "%')";
|
||||
$sql .= natural_search("p.label",$search_label);
|
||||
}
|
||||
if (strlen(trim($search_desc))) {
|
||||
$sql .= " AND (p.description like '%" . $search_desc . "%')";
|
||||
$sql .= natural_search("p.description",$search_desc);
|
||||
}
|
||||
$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);
|
||||
|
||||
dol_syslog("/accountancy/admin/productaccount.php:: sql=" . $sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num_lines = $db->num_rows($result);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy');
|
||||
$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.="&search_desc=".urlencode($search_ref);
|
||||
if ($search_label > 0) $param.="&search_desc=".urlencode($search_label);
|
||||
if ($search_desc > 0) $param.="&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 '<br>';
|
||||
|
||||
print $langs->trans("InitAccountancyDesc") . '<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
// Select mode
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>' . $langs->trans('Options') . '</td><td>' . $langs->trans('Description') . '</td>';
|
||||
@ -270,11 +270,17 @@ if ($result) {
|
||||
print '<div align="center"><input type="submit" class="button" value="' . $langs->trans('Refresh') . '" name="changetype"></div>';
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
// Filter on categories
|
||||
$moreforfilter='';
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
print_barre_liste($langs->trans("ListOfProductsWithoutAccountingAccount"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines, '', '');
|
||||
$texte=$langs->trans("ListOfProductsWithoutAccountingAccount");
|
||||
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
|
||||
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("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
@ -292,12 +298,11 @@ if ($result) {
|
||||
print '</tr>';
|
||||
|
||||
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="20" name="search_label" value="' . $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="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="' . dol_escape_htmltag($search_label) . '"></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"> </td>';
|
||||
print '<td align="center" class="liste_titre">';
|
||||
print '<td align="right" class="liste_titre">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(1, 'checkforselect', 1);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
@ -305,7 +310,8 @@ if ($result) {
|
||||
|
||||
$var = true;
|
||||
|
||||
while ( $i < min($num_lines, 250) ) {
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var = ! $var;
|
||||
|
||||
@ -374,14 +380,15 @@ if ($result) {
|
||||
}
|
||||
|
||||
// Checkbox select
|
||||
print '<td align="center">';
|
||||
print '<td align="right">';
|
||||
print '<input type="checkbox" class="checkforselect" name="chk_prod[]" value="' . $obj->rowid . '"/></td>';
|
||||
|
||||
print "</tr>";
|
||||
$i ++;
|
||||
}
|
||||
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>';
|
||||
|
||||
$db->free($result);
|
||||
|
||||
@ -110,7 +110,7 @@ class BookKeeping extends CommonObject
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
public function create(User $user, $notrigger = false) {
|
||||
global $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
@ -184,6 +184,9 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " WHERE doc_type = '" . $this->doc_type . "'";
|
||||
$sql .= " AND fk_docdet = " . $this->fk_docdet;
|
||||
$sql .= " AND numero_compte = '" . $this->numero_compte . "'";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -197,6 +200,9 @@ class BookKeeping extends CommonObject
|
||||
$sqlnum .= " WHERE doc_type = '" . $this->doc_type . "'";
|
||||
$sqlnum .= " AND fk_docdet = '" . $this->fk_docdet . "'";
|
||||
$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);
|
||||
$resqlnum = $this->db->query($sqlnum);
|
||||
@ -208,7 +214,10 @@ class BookKeeping extends CommonObject
|
||||
if (empty($this->piece_num)) {
|
||||
$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
|
||||
$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);
|
||||
$resqlnum = $this->db->query($sqlnum);
|
||||
if ($resqlnum) {
|
||||
@ -470,11 +479,12 @@ class BookKeeping extends CommonObject
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $ref = null) {
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
global $conf;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
|
||||
$sql .= " t.doc_date,";
|
||||
$sql .= " t.doc_type,";
|
||||
$sql .= " t.doc_ref,";
|
||||
@ -491,7 +501,6 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " t.import_key,";
|
||||
$sql .= " t.code_journal,";
|
||||
$sql .= " t.piece_num";
|
||||
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
$sql .= ' WHERE 1 = 1';
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
@ -556,11 +565,12 @@ class BookKeeping extends CommonObject
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') {
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
global $conf;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
|
||||
$sql .= " t.doc_date,";
|
||||
$sql .= " t.doc_type,";
|
||||
$sql .= " t.doc_ref,";
|
||||
@ -577,9 +587,6 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " t.import_key,";
|
||||
$sql .= " t.code_journal,";
|
||||
$sql .= " t.piece_num";
|
||||
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
|
||||
// Manage filter
|
||||
$sqlwhere = array ();
|
||||
if (count($filter) > 0) {
|
||||
@ -601,7 +608,6 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql.= ' WHERE 1 = 1';
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
@ -672,11 +678,12 @@ class BookKeeping extends CommonObject
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') {
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
global $conf;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
|
||||
$sql .= " t.doc_date,";
|
||||
$sql .= " t.doc_type,";
|
||||
$sql .= " t.doc_ref,";
|
||||
@ -693,9 +700,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " t.import_key,";
|
||||
$sql .= " t.code_journal,";
|
||||
$sql .= " t.piece_num";
|
||||
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
|
||||
// Manage filter
|
||||
$sqlwhere = array ();
|
||||
if (count($filter) > 0) {
|
||||
@ -715,7 +720,6 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql.= ' WHERE 1 = 1';
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
@ -784,16 +788,15 @@ class BookKeeping extends CommonObject
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') {
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
global $conf;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= " t.numero_compte,";
|
||||
$sql .= " SUM(t.debit) as debit,";
|
||||
$sql .= " SUM(t.credit) as credit";
|
||||
|
||||
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
|
||||
// Manage filter
|
||||
$sqlwhere = array ();
|
||||
if (count($filter) > 0) {
|
||||
@ -813,11 +816,14 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' WHERE ' . implode(' ' . $filtermode . ' ', $sqlwhere);
|
||||
$sql.= ' WHERE 1 = 1';
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere);
|
||||
}
|
||||
|
||||
$sql .= ' GROUP BY t.numero_compte';
|
||||
|
||||
if (! empty($sortfield)) {
|
||||
@ -917,7 +923,6 @@ class BookKeeping extends CommonObject
|
||||
|
||||
// Update request
|
||||
$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_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") . ',';
|
||||
@ -934,7 +939,6 @@ class BookKeeping extends CommonObject
|
||||
$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 .= ' piece_num = ' . (isset($this->piece_num) ? $this->piece_num : "null");
|
||||
|
||||
$sql .= ' WHERE rowid=' . $this->id;
|
||||
|
||||
$this->db->begin();
|
||||
@ -1049,11 +1053,13 @@ class BookKeeping extends CommonObject
|
||||
/**
|
||||
* Delete bookkepping by year
|
||||
*
|
||||
* @param string $delyear Year to delete
|
||||
* @param string $journal Journal to delete
|
||||
* @return int Result
|
||||
* @param string $delyear Year to delete
|
||||
* @param string $journal Journal to delete
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function deleteByYearAndJournal($delyear='', $journal='') {
|
||||
global $conf;
|
||||
|
||||
if (empty($delyear) && empty($journal))
|
||||
{
|
||||
return -1;
|
||||
@ -1067,6 +1073,9 @@ class BookKeeping extends CommonObject
|
||||
$sql.= " WHERE 1 = 1";
|
||||
if (! empty($delyear)) $sql.= " AND YEAR(doc_date) = " . $delyear; // FIXME Must use between
|
||||
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);
|
||||
|
||||
if (! $resql) {
|
||||
@ -1090,12 +1099,17 @@ class BookKeeping extends CommonObject
|
||||
* @return int Result
|
||||
*/
|
||||
function deleteMvtNum($piecenum) {
|
||||
global $conf;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// first check if line not yet in bookkeeping
|
||||
$sql = "DELETE";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
$sql .= " WHERE piece_num = " . $piecenum;
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -1193,9 +1207,14 @@ class BookKeeping extends CommonObject
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchPerMvt($piecenum) {
|
||||
$sql = "SELECT piece_num,doc_date,code_journal,doc_ref,doc_type";
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT piece_num,doc_date,code_journal,doc_ref,doc_type";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
$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);
|
||||
$result = $this->db->query($sql);
|
||||
@ -1223,8 +1242,13 @@ class BookKeeping extends CommonObject
|
||||
*/
|
||||
public function getNextNumMvt()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$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);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
@ -1247,12 +1271,17 @@ class BookKeeping extends CommonObject
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch_all_per_mvt($piecenum) {
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT rowid, doc_date, doc_type,";
|
||||
$sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,";
|
||||
$sql .= " numero_compte, label_compte, debit, credit,";
|
||||
$sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
$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);
|
||||
$result = $this->db->query($sql);
|
||||
@ -1297,11 +1326,16 @@ class BookKeeping extends CommonObject
|
||||
* @return int Result
|
||||
*/
|
||||
function export_bookkeping($model = 'ebp') {
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT rowid, doc_date, doc_type,";
|
||||
$sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,";
|
||||
$sql .= " numero_compte, label_compte, debit, credit,";
|
||||
$sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num";
|
||||
$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);
|
||||
|
||||
@ -1345,75 +1379,76 @@ class BookKeeping extends CommonObject
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return list of accounts with label by chart of accounts
|
||||
*
|
||||
* @param string $selectid Preselected chart of accounts
|
||||
* @param string $htmlname Name of field in html form
|
||||
* @param int $showempty Add an empty field
|
||||
* @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_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
|
||||
*
|
||||
* @return string String with HTML select
|
||||
*/
|
||||
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') {
|
||||
global $conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
$sql = "SELECT DISTINCT ab.numero_compte as account_number, aa.label as label, aa.rowid as rowid, aa.fk_pcg_version";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = ab.numero_compte";
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = " . $pcgver;
|
||||
$sql .= " ORDER BY account_number ASC";
|
||||
|
||||
dol_syslog(get_class($this) . "::select_account", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if (!$resql) {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::select_account " . $this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$out = ajax_combobox($htmlname, $event);
|
||||
|
||||
$options = array();
|
||||
$selected = null;
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$label = length_accountg($obj->account_number) . ' - ' . $obj->label;
|
||||
$label = dol_trunc($label, $trunclength);
|
||||
|
||||
$select_value_in = $obj->rowid;
|
||||
$select_value_out = $obj->rowid;
|
||||
|
||||
if ($select_in == 1) {
|
||||
$select_value_in = $obj->account_number;
|
||||
}
|
||||
if ($select_out == 1) {
|
||||
$select_value_out = $obj->account_number;
|
||||
}
|
||||
|
||||
// Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number
|
||||
// Because same account_number can be share between different accounting_system and do have the same meaning
|
||||
if (($selectid != '') && $selectid == $select_value_in) {
|
||||
$selected = $select_value_out;
|
||||
}
|
||||
|
||||
$options[$select_value_out] = $label;
|
||||
}
|
||||
|
||||
$out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300');
|
||||
$this->db->free($resql);
|
||||
return $out;
|
||||
}
|
||||
/**
|
||||
* Return list of accounts with label by chart of accounts
|
||||
*
|
||||
* @param string $selectid Preselected chart of accounts
|
||||
* @param string $htmlname Name of field in html form
|
||||
* @param int $showempty Add an empty field
|
||||
* @param array $event Event options
|
||||
* @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 $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
|
||||
*/
|
||||
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') {
|
||||
global $conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
$sql = "SELECT DISTINCT ab.numero_compte as account_number, aa.label as label, aa.rowid as rowid, aa.fk_pcg_version";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = ab.numero_compte";
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = " . $pcgver;
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND ab.entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$sql .= " ORDER BY account_number ASC";
|
||||
|
||||
dol_syslog(get_class($this) . "::select_account", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if (! $resql) {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::select_account " . $this->error, LOG_ERR);
|
||||
return - 1;
|
||||
}
|
||||
|
||||
$out = ajax_combobox($htmlname, $event);
|
||||
|
||||
$options = array();
|
||||
$selected = null;
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$label = length_accountg($obj->account_number) . ' - ' . $obj->label;
|
||||
|
||||
$select_value_in = $obj->rowid;
|
||||
$select_value_out = $obj->rowid;
|
||||
|
||||
if ($select_in == 1) {
|
||||
$select_value_in = $obj->account_number;
|
||||
}
|
||||
if ($select_out == 1) {
|
||||
$select_value_out = $obj->account_number;
|
||||
}
|
||||
|
||||
// Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number
|
||||
// Because same account_number can be share between different accounting_system and do have the same meaning
|
||||
if (($selectid != '') && $selectid == $select_value_in) {
|
||||
$selected = $select_value_out;
|
||||
}
|
||||
|
||||
$options[$select_value_out] = $label;
|
||||
}
|
||||
|
||||
$out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300');
|
||||
$this->db->free($resql);
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1421,25 +1456,26 @@ class BookKeeping extends CommonObject
|
||||
* Description of a root accounting account
|
||||
*
|
||||
* @param string $account Accounting account
|
||||
* @return string
|
||||
* @return string Root account
|
||||
*/
|
||||
function get_compte_racine($account = null)
|
||||
{
|
||||
global $conf;
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
|
||||
$sql = "SELECT root.account_number, root.label as label";
|
||||
$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 .= " AND asy.rowid = " . $pcgver;
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as parent ON aa.account_parent = parent.rowid";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as root ON parent.account_parent = root.rowid";
|
||||
$sql .= " WHERE aa.account_number = '" . $account . "'";
|
||||
$sql .= " AND parent.active = 1";
|
||||
$sql .= " AND root.active = 1";
|
||||
|
||||
|
||||
|
||||
$sql = "SELECT root.account_number, root.label as label";
|
||||
$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 .= " AND asy.rowid = " . $pcgver;
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as parent ON aa.account_parent = parent.rowid";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as root ON parent.account_parent = root.rowid";
|
||||
$sql .= " WHERE aa.account_number = '" . $account . "'";
|
||||
$sql .= " AND parent.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);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -1463,11 +1499,12 @@ class BookKeeping extends CommonObject
|
||||
* Description of accounting account
|
||||
*
|
||||
* @param string $account Accounting account
|
||||
* @return string
|
||||
* @return string Account desc
|
||||
*/
|
||||
function get_compte_desc($account = null)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
$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 ";
|
||||
@ -1476,6 +1513,10 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " AND asy.rowid = " . $pcgver;
|
||||
$sql .= " AND aa.active = 1";
|
||||
$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);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -1499,6 +1540,7 @@ class BookKeeping extends CommonObject
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class BookKeepingLine
|
||||
*/
|
||||
|
||||
@ -80,23 +80,21 @@ print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step,
|
||||
print "<br>\n";
|
||||
print "<br>\n";
|
||||
$step++;
|
||||
//$textlink='<strong>'.$langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Modules")."-".$langs->transnoentitiesnoconv("Accountancy").'</strong>';
|
||||
$textlink='<strong>'.$langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("MenuBankCash").'</strong>';
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, $textlink);
|
||||
print "<br>\n";
|
||||
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++;
|
||||
$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 "<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))
|
||||
{
|
||||
$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++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
|
||||
print "<br>\n";
|
||||
@ -118,9 +116,6 @@ if (! empty($conf->don->enabled))
|
||||
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++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("ProductsBinding").'</strong>')."<br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
@ -55,7 +55,9 @@ $confirm=GETPOST('confirm','alpha');
|
||||
$id=GETPOST('id','int');
|
||||
$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[1] = "disable";
|
||||
@ -76,7 +78,6 @@ $pagenext = $page + 1;
|
||||
|
||||
$search_country_id = GETPOST('search_country_id','int');
|
||||
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('admin'));
|
||||
|
||||
@ -673,8 +674,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
}
|
||||
|
||||
// Clean some parameters
|
||||
if (isset($_POST["localtax1"]) && 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["localtax1_type"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='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_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
|
||||
@ -720,7 +721,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
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]])."'";
|
||||
$i++;
|
||||
}
|
||||
@ -769,7 +770,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
}
|
||||
if ($i) $sql.=",";
|
||||
$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]])."'";
|
||||
$i++;
|
||||
}
|
||||
@ -992,12 +993,12 @@ if ($id)
|
||||
if ($fieldlist[$field]=='taux') {
|
||||
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow=$langs->trans("Rate");
|
||||
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') { $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') { $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]=='lang') { $valuetoshow=$langs->trans("Language"); }
|
||||
if ($fieldlist[$field]=='type') {
|
||||
@ -1072,7 +1073,7 @@ if ($id)
|
||||
{
|
||||
foreach ($fieldlist as $key=>$val)
|
||||
{
|
||||
if (GETPOST($val))
|
||||
if (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
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
|
||||
if ($id == 3) unset($fieldlist[2]);
|
||||
if ($id == 3) unset($fieldlist[2]); // Remove field ??? if ???
|
||||
|
||||
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);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
@ -1174,12 +1175,12 @@ if ($id)
|
||||
if ($fieldlist[$field]=='taux') {
|
||||
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow=$langs->trans("Rate");
|
||||
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') { $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') { $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]=='lang') { $valuetoshow=$langs->trans("Language"); }
|
||||
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
|
||||
@ -1282,8 +1283,11 @@ if ($id)
|
||||
|
||||
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit');
|
||||
|
||||
print '<td colspan="3" align="right"><a name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"> </a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print ' <input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
|
||||
print '<td colspan="3" align="center">';
|
||||
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
|
||||
{
|
||||
@ -1430,24 +1434,26 @@ if ($id)
|
||||
$key = $langs->trans('SizeUnit'.strtolower($obj->unit));
|
||||
$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') {
|
||||
if ($obj->localtax1 != 0)
|
||||
if ($obj->localtax1 != 0)
|
||||
$valuetoshow=$localtax_typeList[$valuetoshow];
|
||||
else
|
||||
$valuetoshow = '';
|
||||
$align="right";
|
||||
$align="center";
|
||||
}
|
||||
else if ($fieldlist[$field]=='localtax2_type') {
|
||||
if ($obj->localtax2 != 0)
|
||||
$valuetoshow=$localtax_typeList[$valuetoshow];
|
||||
else
|
||||
$valuetoshow = '';
|
||||
$align="right";
|
||||
$align="center";
|
||||
}
|
||||
else if ($fieldlist[$field]=='taux') {
|
||||
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
|
||||
$align="right";
|
||||
$align="center";
|
||||
}
|
||||
else if (in_array($fieldlist[$field],array('recuperableonly')))
|
||||
{
|
||||
@ -1509,7 +1515,11 @@ if ($id)
|
||||
else print '<td> </td>';
|
||||
|
||||
// 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> </td>';
|
||||
|
||||
print "</tr>\n";
|
||||
@ -1700,9 +1710,9 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
}
|
||||
elseif (in_array($fieldlist[$field],array('nbjour','decalage','taux','localtax1','localtax2'))) {
|
||||
$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 '<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>';
|
||||
}
|
||||
elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
|
||||
@ -1770,10 +1780,10 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
$size=''; $class='';
|
||||
if ($fieldlist[$field]=='code') $size='size="8" ';
|
||||
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]=='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].'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,30 +92,35 @@ if ($negpage)
|
||||
if ($page > GETPOST("nbpage")) $page = GETPOST("nbpage");
|
||||
}
|
||||
|
||||
$sortfield = "b.datev, b.datec, b.rowid";
|
||||
|
||||
$object = new Account($db);
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$paiementtype="";
|
||||
$req_nb="";
|
||||
$thirdparty="";
|
||||
$req_desc="";
|
||||
$req_debit="";
|
||||
$req_credit="";
|
||||
$req_stdtmonth="";
|
||||
$req_stdtday="";
|
||||
$req_stdtyear="";
|
||||
$req_stdt = "";
|
||||
$req_enddtmonth="";
|
||||
$req_enddtday="";
|
||||
$req_enddtyear="";
|
||||
$req_enddt = "";
|
||||
$search_reconciled = '';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$paiementtype="";
|
||||
$req_nb="";
|
||||
$thirdparty="";
|
||||
$req_desc="";
|
||||
$req_debit="";
|
||||
$req_credit="";
|
||||
$req_stdtmonth="";
|
||||
$req_stdtday="";
|
||||
$req_stdtyear="";
|
||||
$req_stdt = "";
|
||||
$req_enddtmonth="";
|
||||
$req_enddtday="";
|
||||
$req_enddtyear="";
|
||||
$req_enddt = "";
|
||||
$search_reconciled = '';
|
||||
}
|
||||
|
||||
$dateop=-1;
|
||||
|
||||
if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banque->modifier)
|
||||
@ -340,23 +345,10 @@ if ($id > 0 || ! empty($ref))
|
||||
$head=bank_prepare_head($object);
|
||||
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>';
|
||||
|
||||
// Ref
|
||||
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_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
@ -507,7 +499,7 @@ if ($id > 0 || ! empty($ref))
|
||||
// Ligne de titre tableau des ecritures
|
||||
print '<tr class="liste_titre">';
|
||||
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("Numero").'</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 ba.entity IN (".getEntity('bank_account', 1).")";
|
||||
$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);
|
||||
|
||||
dol_syslog("account.php get transactions -", LOG_DEBUG);
|
||||
|
||||
@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$langs->load("banks");
|
||||
$langs->load("categories");
|
||||
|
||||
$id=GETPOST('account');
|
||||
$id=GETPOST('account')?GETPOST('account','alpha'):GETPOST('id');
|
||||
$ref=GETPOST('ref');
|
||||
|
||||
// Security check
|
||||
@ -60,16 +60,16 @@ llxHeader('',$title,$helpurl);
|
||||
$form = new Form($db);
|
||||
|
||||
// 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
|
||||
{
|
||||
$result=$acct->fetch($id);
|
||||
$id=$acct->id;
|
||||
$result=$object->fetch($id);
|
||||
$id=$object->id;
|
||||
}
|
||||
if (! empty($ref))
|
||||
{
|
||||
$result=$acct->fetch(0, $ref);
|
||||
$id=$acct->id;
|
||||
$result=$object->fetch(0, $ref);
|
||||
$id=$object->id;
|
||||
}
|
||||
|
||||
|
||||
@ -134,58 +134,38 @@ else
|
||||
|
||||
|
||||
// Onglets
|
||||
$head=bank_prepare_head($acct);
|
||||
$head=bank_prepare_head($object);
|
||||
dol_fiche_head($head,'annual',$langs->trans("FinancialAccount"),0,'account');
|
||||
|
||||
$title=$langs->trans("FinancialAccount")." : ".$acct->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>":"");
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
$title=$langs->trans("FinancialAccount")." : ".$object->label;
|
||||
$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>":"");
|
||||
|
||||
$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 (! preg_match('/,/', $id))
|
||||
{
|
||||
print $form->showrefnav($acct, 'ref', $linkback, 1, 'ref');
|
||||
}
|
||||
else
|
||||
{
|
||||
$bankaccount=new Account($db);
|
||||
$listid=explode(',', $id);
|
||||
foreach($listid as $key => $aId)
|
||||
{
|
||||
$bankaccount->fetch($aId);
|
||||
$bankaccount->label=$bankaccount->ref;
|
||||
print $bankaccount->getNomUrl(1);
|
||||
if ($key < (count($listid)-1)) print ', ';
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
if (! preg_match('/,/', $id))
|
||||
{
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
}
|
||||
else
|
||||
{
|
||||
$bankaccount=new Account($db);
|
||||
$listid=explode(',', $id);
|
||||
foreach($listid as $key => $aId)
|
||||
{
|
||||
$bankaccount->fetch($aId);
|
||||
$bankaccount->label=$bankaccount->ref;
|
||||
print $bankaccount->getNomUrl(1);
|
||||
if ($key < (count($listid)-1)) print ', ';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("AllAccounts");
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
@ -655,31 +655,6 @@ else
|
||||
if ($object->url) print '</a>';
|
||||
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
|
||||
print '<tr class="liste_titre_add"><td class="titlefield">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td>';
|
||||
@ -697,6 +672,31 @@ else
|
||||
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>';
|
||||
|
||||
|
||||
|
||||
@ -139,6 +139,7 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes') {
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("Documents");
|
||||
$helpurl = "";
|
||||
llxHeader('',$title,$helpurl);
|
||||
@ -152,8 +153,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
|
||||
// Onglets
|
||||
$head = bank_prepare_head($object);
|
||||
dol_fiche_head($head, 'document', $langs->trans("FinancialAccount"), 0,
|
||||
'account');
|
||||
dol_fiche_head($head, 'document', $langs->trans("FinancialAccount"), 0, 'account');
|
||||
|
||||
|
||||
// Construit liste des fichiers
|
||||
@ -166,29 +166,25 @@ if ($id > 0 || !empty($ref)) {
|
||||
}
|
||||
|
||||
$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 '<table class="border"width="100%">';
|
||||
|
||||
// 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 '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="titlefield">' . $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 "</table>\n";
|
||||
print "</div>\n";
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
dol_htmloutput_mesg($mesg, $mesgs);
|
||||
|
||||
|
||||
/*
|
||||
* Confirmation suppression fichier
|
||||
*/
|
||||
|
||||
@ -67,15 +67,15 @@ if (! empty($_GET["year"])) $year=sprintf("%04d",$_GET["year"]);
|
||||
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
|
||||
{
|
||||
$result=$acct->fetch($_GET["account"]);
|
||||
$result=$object->fetch($_GET["account"]);
|
||||
}
|
||||
if ($_GET["ref"])
|
||||
{
|
||||
$result=$acct->fetch(0,$_GET["ref"]);
|
||||
$account=$acct->id;
|
||||
$result=$object->fetch(0,$_GET["ref"]);
|
||||
$account=$object->id;
|
||||
}
|
||||
|
||||
$result=dol_mkdir($conf->bank->dir_temp);
|
||||
@ -202,8 +202,8 @@ else
|
||||
{
|
||||
$datas[$i] = $solde + $subtotal;
|
||||
}
|
||||
$datamin[$i] = $acct->min_desired;
|
||||
$dataall[$i] = $acct->min_allowed;
|
||||
$datamin[$i] = $object->min_desired;
|
||||
$dataall[$i] = $object->min_allowed;
|
||||
//$labels[$i] = strftime("%d",$day);
|
||||
$labels[$i] = $xday;
|
||||
|
||||
@ -230,15 +230,15 @@ else
|
||||
foreach($datas as $i => $val)
|
||||
{
|
||||
$graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]);
|
||||
if ($acct->min_desired) array_push($graph_datas[$i],$datamin[$i]);
|
||||
if ($acct->min_allowed) array_push($graph_datas[$i],$dataall[$i]);
|
||||
if ($object->min_desired) array_push($graph_datas[$i],$datamin[$i]);
|
||||
if ($object->min_allowed) array_push($graph_datas[$i],$dataall[$i]);
|
||||
}
|
||||
|
||||
$px1 = new DolGraph();
|
||||
$px1->SetData($graph_datas);
|
||||
$arraylegends=array($langs->transnoentities("Balance"));
|
||||
if ($acct->min_desired) array_push($arraylegends,$langs->transnoentities("BalanceMinimalDesired"));
|
||||
if ($acct->min_allowed) array_push($arraylegends,$langs->transnoentities("BalanceMinimalAllowed"));
|
||||
if ($object->min_desired) array_push($arraylegends,$langs->transnoentities("BalanceMinimalDesired"));
|
||||
if ($object->min_allowed) array_push($arraylegends,$langs->transnoentities("BalanceMinimalAllowed"));
|
||||
$px1->SetLegend($arraylegends);
|
||||
$px1->SetLegendWidthMin(180);
|
||||
$px1->SetMaxValue($px1->GetCeilMaxValue()<0?0:$px1->GetCeilMaxValue());
|
||||
@ -346,8 +346,8 @@ else
|
||||
{
|
||||
$datas[$i] = $solde + $subtotal;
|
||||
}
|
||||
$datamin[$i] = $acct->min_desired;
|
||||
$dataall[$i] = $acct->min_allowed;
|
||||
$datamin[$i] = $object->min_desired;
|
||||
$dataall[$i] = $object->min_allowed;
|
||||
if ($xday == '15')
|
||||
{
|
||||
$labels[$i] = dol_print_date($day,"%b");
|
||||
@ -367,14 +367,14 @@ else
|
||||
foreach($datas as $i => $val)
|
||||
{
|
||||
$graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]);
|
||||
if ($acct->min_desired) array_push($graph_datas[$i],$datamin[$i]);
|
||||
if ($acct->min_allowed) array_push($graph_datas[$i],$dataall[$i]);
|
||||
if ($object->min_desired) array_push($graph_datas[$i],$datamin[$i]);
|
||||
if ($object->min_allowed) array_push($graph_datas[$i],$dataall[$i]);
|
||||
}
|
||||
$px2 = new DolGraph();
|
||||
$px2->SetData($graph_datas);
|
||||
$arraylegends=array($langs->transnoentities("Balance"));
|
||||
if ($acct->min_desired) array_push($arraylegends,$langs->transnoentities("BalanceMinimalDesired"));
|
||||
if ($acct->min_allowed) array_push($arraylegends,$langs->transnoentities("BalanceMinimalAllowed"));
|
||||
if ($object->min_desired) array_push($arraylegends,$langs->transnoentities("BalanceMinimalDesired"));
|
||||
if ($object->min_allowed) array_push($arraylegends,$langs->transnoentities("BalanceMinimalAllowed"));
|
||||
$px2->SetLegend($arraylegends);
|
||||
$px2->SetLegendWidthMin(180);
|
||||
$px2->SetMaxValue($px2->GetCeilMaxValue()<0?0:$px2->GetCeilMaxValue());
|
||||
@ -462,8 +462,8 @@ else
|
||||
{
|
||||
$datas[$i] = '' + $solde + $subtotal;
|
||||
}
|
||||
$datamin[$i] = $acct->min_desired;
|
||||
$dataall[$i] = $acct->min_allowed;
|
||||
$datamin[$i] = $object->min_desired;
|
||||
$dataall[$i] = $object->min_allowed;
|
||||
if (substr($textdate,6,2) == '01' || $i == 0)
|
||||
{
|
||||
$labels[$i] = substr($textdate,4,2);
|
||||
@ -482,15 +482,15 @@ else
|
||||
foreach($datas as $i => $val)
|
||||
{
|
||||
$graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]);
|
||||
if ($acct->min_desired) array_push($graph_datas[$i],$datamin[$i]);
|
||||
if ($acct->min_allowed) array_push($graph_datas[$i],$dataall[$i]);
|
||||
if ($object->min_desired) array_push($graph_datas[$i],$datamin[$i]);
|
||||
if ($object->min_allowed) array_push($graph_datas[$i],$dataall[$i]);
|
||||
}
|
||||
|
||||
$px3 = new DolGraph();
|
||||
$px3->SetData($graph_datas);
|
||||
$arraylegends=array($langs->transnoentities("Balance"));
|
||||
if ($acct->min_desired) array_push($arraylegends,$langs->transnoentities("BalanceMinimalDesired"));
|
||||
if ($acct->min_allowed) array_push($arraylegends,$langs->transnoentities("BalanceMinimalAllowed"));
|
||||
if ($object->min_desired) array_push($arraylegends,$langs->transnoentities("BalanceMinimalDesired"));
|
||||
if ($object->min_allowed) array_push($arraylegends,$langs->transnoentities("BalanceMinimalAllowed"));
|
||||
$px3->SetLegend($arraylegends);
|
||||
$px3->SetLegendWidthMin(180);
|
||||
$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_debit[$i] = isset($debits[substr("0".($i+1),-2)]) ? $debits[substr("0".($i+1),-2)] : 0;
|
||||
$labels[$i] = sprintf("%02d",$i+1);
|
||||
$datamin[$i] = $acct->min_desired;
|
||||
$datamin[$i] = $object->min_desired;
|
||||
}
|
||||
|
||||
// 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_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");
|
||||
$datamin[$i] = $acct->min_desired;
|
||||
$datamin[$i] = $object->min_desired;
|
||||
}
|
||||
|
||||
// Fabrication tableau 4b
|
||||
@ -754,36 +754,33 @@ else
|
||||
|
||||
|
||||
// Onglets
|
||||
$head=bank_prepare_head($acct);
|
||||
$head=bank_prepare_head($object);
|
||||
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>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3">';
|
||||
if ($account)
|
||||
{
|
||||
if (! preg_match('/,/',$account))
|
||||
{
|
||||
$moreparam='&month='.$month.'&year='.$year.($mode=='showalltime'?'&mode=showalltime':'');
|
||||
|
||||
if ($_GET["option"]!='all')
|
||||
{
|
||||
$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
|
||||
{
|
||||
$morehtml='<a href="'.$_SERVER["PHP_SELF"].'?account='.$account.$moreparam.'">'.$langs->trans("BackToAccount").'</a>';
|
||||
print $langs->trans("All");
|
||||
print $langs->trans("AllAccounts");
|
||||
//print $morehtml;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$bankaccount=new Account($db);
|
||||
$bankaccount=new Account($db);
|
||||
$listid=explode(',',$account);
|
||||
foreach($listid as $key => $id)
|
||||
{
|
||||
@ -795,25 +792,9 @@ if ($account)
|
||||
}
|
||||
}
|
||||
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 '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
@ -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.'/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("bills");
|
||||
$langs->load("categories");
|
||||
@ -61,6 +71,8 @@ $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
$pageplusone = GETPOST("pageplusone",'int');
|
||||
if ($pageplusone) $page = $pageplusone - 1;
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
@ -68,6 +80,16 @@ $pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
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
|
||||
$contextpage='banktransactionlist';
|
||||
|
||||
@ -81,15 +103,16 @@ $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search
|
||||
|
||||
$arrayfields=array(
|
||||
'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.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1),
|
||||
'type'=>array('label'=>$langs->trans("Type"), '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),
|
||||
'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>1, 'position'=>1000),
|
||||
'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
|
||||
'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),
|
||||
);
|
||||
// Extra fields
|
||||
@ -148,22 +171,35 @@ if (empty($reshook))
|
||||
* View
|
||||
*/
|
||||
|
||||
$companystatic=new Societe($db);
|
||||
$bankaccountstatic=new Account($db);
|
||||
|
||||
llxHeader('', $langs->trans("BankTransactions"), '', '', 0, 0, array(), array(), $param);
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
if ($vline) $viewline = $vline;
|
||||
else $viewline = 50;
|
||||
$companystatic=new Societe($db);
|
||||
$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.= " b.fk_account, b.fk_type,";
|
||||
$sql.= " ba.rowid as bankid, ba.ref as bankref,";
|
||||
$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
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||
// 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 ($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_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 (! empty($type)) $sql.= " AND b.fk_type = '".$db->escape($type)."' ";
|
||||
// Search period criteria
|
||||
@ -219,6 +256,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
$nbtotalofpages = ceil($nbtotalofrecords/$limit);
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit+1,$offset);
|
||||
@ -280,14 +318,20 @@ if ($resql)
|
||||
|
||||
// Title
|
||||
$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"))
|
||||
{
|
||||
$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
|
||||
{
|
||||
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 = '';
|
||||
@ -320,16 +364,17 @@ if ($resql)
|
||||
// Fields title
|
||||
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['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.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['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['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.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['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['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);
|
||||
// Extra fields
|
||||
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 '</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']))
|
||||
{
|
||||
print '<td class="liste_titre"> </td>';
|
||||
@ -367,7 +418,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['type']['checked']))
|
||||
{
|
||||
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>';
|
||||
}
|
||||
if (! empty($arrayfields['b.num_chq']['checked']))
|
||||
@ -375,16 +426,16 @@ if ($resql)
|
||||
// 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>';
|
||||
}
|
||||
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']))
|
||||
{
|
||||
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']))
|
||||
{
|
||||
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 '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['ba.ref']['checked']))
|
||||
if (! empty($arrayfields['balance']['checked']))
|
||||
{
|
||||
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>';
|
||||
}
|
||||
if (! empty($arrayfields['b.num_releve']['checked']))
|
||||
{
|
||||
// Numero
|
||||
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>';
|
||||
// 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="3"></td>';
|
||||
}
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
||||
@ -415,168 +467,346 @@ if ($resql)
|
||||
print "</tr>\n";
|
||||
|
||||
// Loop on each record
|
||||
$total = 0; // For balance
|
||||
$sign = 1;
|
||||
|
||||
$totalarray=array();
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
// Why this ?
|
||||
$printline=false;
|
||||
//Search Description
|
||||
if ($description) {
|
||||
preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthese on tente recherche de traduction
|
||||
if ($reg[1]) {
|
||||
if ($langs->transnoentities($reg[1])==$description) {
|
||||
$printline=true;
|
||||
}
|
||||
} elseif ($objp->label==$description) {
|
||||
$printline=true;
|
||||
}
|
||||
} else {
|
||||
$printline=true;
|
||||
$total = price2num($total + ($sign * $objp->amount),'MT');
|
||||
|
||||
if (empty($cachebankaccount[$objp->bankid]))
|
||||
{
|
||||
$bankaccounttmp = new Account($db);
|
||||
$bankaccounttmp->fetch($objp->bankid);
|
||||
$cachebankaccount[$objp->bankid]=$bankaccounttmp;
|
||||
$bankaccount = $bankaccounttmp;
|
||||
}
|
||||
if ($printline) {
|
||||
|
||||
$var=!$var;
|
||||
else
|
||||
{
|
||||
$bankaccount = $cachebankaccount[$objp->bankid];
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Ref
|
||||
if (! empty($arrayfields['b.rowid']['checked']))
|
||||
{
|
||||
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> ";
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date ope
|
||||
if (! empty($arrayfields['b.dateo']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($objp->do),"day")."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Date value
|
||||
if (! empty($arrayfields['b.datev']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($objp->dv),"day")."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Payment type
|
||||
if (! empty($arrayfields['type']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
$labeltype=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$langs->getLabelFromKey($db,$objp->fk_type,'c_paiement','code','libelle');
|
||||
if ($labeltype == 'SOLD') print ' '; //$langs->trans("InitialBankBalance");
|
||||
else print $labeltype;
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Num cheque
|
||||
if (! empty($arrayfields['b.num_releve']['checked']))
|
||||
{
|
||||
print '<td class="nowrap" align="center">'.($objp->num_chq?$objp->num_chq:"")."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Description
|
||||
if (! empty($arrayfields['description']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
|
||||
print "<a href=\"ligne.php?rowid=".$objp->rowid."&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> ";
|
||||
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Third party
|
||||
if (! empty($arrayfields['bu.label']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
if ($objp->url_id)
|
||||
{
|
||||
$companystatic->id=$objp->url_id;
|
||||
$companystatic->name=$objp->nom;
|
||||
$companystatic->name_alias=$objp->name_alias;
|
||||
$companystatic->client=$objp->client;
|
||||
$companystatic->fournisseur=$objp->fournisseur;
|
||||
$companystatic->code_client=$objp->code_client;
|
||||
$companystatic->code_fournisseur=$objp->code_fournisseur;
|
||||
print $companystatic->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
// Ref
|
||||
if (! empty($arrayfields['b.rowid']['checked']))
|
||||
{
|
||||
print '<td align="left" class="nowrap">';
|
||||
print "<a href=\"ligne.php?rowid=".$objp->rowid.'">'.img_object($langs->trans("ShowPayment").': '.$objp->rowid, 'account', 'class="classfortooltip"').' '.$objp->rowid."</a> ";
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Debit
|
||||
if (! empty($arrayfields['b.debit']['checked']))
|
||||
{
|
||||
print '<td align="right">';
|
||||
if ($objp->amount < 0)
|
||||
{
|
||||
print price($objp->amount * -1);
|
||||
$totalarray['totaldeb'] += $objp->amount;
|
||||
}
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totaldebfield']=$totalarray['nbfield'];
|
||||
}
|
||||
// Credit
|
||||
if (! empty($arrayfields['b.credit']['checked']))
|
||||
{
|
||||
print '<td align="right">';
|
||||
if ($objp->amount > 0)
|
||||
{
|
||||
print price($objp->amount);
|
||||
$totalarray['totalcred'] += $objp->amount;
|
||||
}
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalcredfield']=$totalarray['nbfield'];
|
||||
}
|
||||
|
||||
// Bank account
|
||||
if (! empty($arrayfields['ba.ref']['checked']))
|
||||
{
|
||||
print '<td align="right" class="nowrap">';
|
||||
$bankaccountstatic->id=$objp->bankid;
|
||||
$bankaccountstatic->label=$objp->bankref;
|
||||
print $bankaccountstatic->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
}
|
||||
|
||||
// Description
|
||||
if (! empty($arrayfields['description']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
|
||||
//print "<a href=\"ligne.php?rowid=".$objp->rowid."&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> ";
|
||||
|
||||
// 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
|
||||
if (! empty($arrayfields['b.dateo']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($objp->do),"day")."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['b.num_releve']['checked']))
|
||||
{
|
||||
print '<td class="nowrap" align="center">'.($objp->num_releve?$objp->num_releve:"")."</td>\n";
|
||||
}
|
||||
|
||||
// Date value
|
||||
if (! empty($arrayfields['b.datev']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($objp->dv),"day")."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Action column
|
||||
print '<td class="nowrap" align="center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
$selected=0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Payment type
|
||||
if (! empty($arrayfields['type']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
$labeltype=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$langs->getLabelFromKey($db,$objp->fk_type,'c_paiement','code','libelle');
|
||||
if ($labeltype == 'SOLD') print ' '; //$langs->trans("InitialBankBalance");
|
||||
else print $labeltype;
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Num cheque
|
||||
if (! empty($arrayfields['b.num_releve']['checked']))
|
||||
{
|
||||
print '<td class="nowrap" align="center">'.($objp->num_chq?$objp->num_chq:"")."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Third party
|
||||
if (! empty($arrayfields['bu.label']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
if ($objp->url_id)
|
||||
{
|
||||
$companystatic->id=$objp->url_id;
|
||||
$companystatic->name=$objp->nom;
|
||||
$companystatic->name_alias=$objp->name_alias;
|
||||
$companystatic->client=$objp->client;
|
||||
$companystatic->fournisseur=$objp->fournisseur;
|
||||
$companystatic->code_client=$objp->code_client;
|
||||
$companystatic->code_fournisseur=$objp->code_fournisseur;
|
||||
$companystatic->code_compta=$objp->code_compta;
|
||||
$companystatic->code_compta_fournisseur=$objp->code_compta_fournisseur;
|
||||
print $companystatic->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
if (! empty($arrayfields['b.debit']['checked']))
|
||||
{
|
||||
print '<td align="right">';
|
||||
if ($objp->amount < 0)
|
||||
{
|
||||
print price($objp->amount * -1);
|
||||
$totalarray['totaldeb'] += $objp->amount;
|
||||
}
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totaldebfield']=$totalarray['nbfield'];
|
||||
}
|
||||
// Credit
|
||||
if (! empty($arrayfields['b.credit']['checked']))
|
||||
{
|
||||
print '<td align="right">';
|
||||
if ($objp->amount > 0)
|
||||
{
|
||||
print price($objp->amount);
|
||||
$totalarray['totalcred'] += $objp->amount;
|
||||
}
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalcredfield']=$totalarray['nbfield'];
|
||||
}
|
||||
|
||||
// Balance
|
||||
if (! empty($arrayfields['balance']['checked']))
|
||||
{
|
||||
if ($mode_balance_ok)
|
||||
{
|
||||
if ($total >= 0)
|
||||
{
|
||||
print '<td align="right" class="nowrap"> '.price($total).'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="right" class="error nowrap"> '.price($total).'</td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="right">-</td>';
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction reconciliated or edit link
|
||||
if ($objp->rappro && $bankaccount->canBeConciliated() > 0) // If line not conciliated and account can be conciliated
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&account='.$object->id.'&page='.$page.'">';
|
||||
print img_edit();
|
||||
print '</a>';
|
||||
print " ";
|
||||
print '<a href="releve.php?num='.$objp->num_releve.'&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.'&account='.$object->id.'&page='.$page.'">';
|
||||
print img_edit();
|
||||
print '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&account='.$object->id.'&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 ' ';
|
||||
if ($user->rights->banque->modifier)
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&rowid='.$objp->rowid.'&id='.$object->id.'&page='.$page.'">';
|
||||
print img_delete();
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Action column
|
||||
print '<td class="nowrap" align="center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
$selected=0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
/**
|
||||
* \file htdocs/compta/bank/treso.php
|
||||
* \ingroup banque
|
||||
* \brief Page de detail du budget de tresorerie
|
||||
* \brief Page to estimate future balance
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
@ -77,42 +77,32 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
|
||||
$viewline = 20;
|
||||
}
|
||||
|
||||
$acct = new Account($db);
|
||||
$object = new Account($db);
|
||||
if ($_GET["account"])
|
||||
{
|
||||
$result=$acct->fetch($_GET["account"]);
|
||||
$result=$object->fetch($_GET["account"]);
|
||||
}
|
||||
if ($_GET["ref"])
|
||||
{
|
||||
$result=$acct->fetch(0,$_GET["ref"]);
|
||||
$_GET["account"]=$acct->id;
|
||||
$result=$object->fetch(0,$_GET["ref"]);
|
||||
$_GET["account"]=$object->id;
|
||||
}
|
||||
|
||||
|
||||
// Onglets
|
||||
$head=bank_prepare_head($acct);
|
||||
$head=bank_prepare_head($object);
|
||||
dol_fiche_head($head,'cash',$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>';
|
||||
|
||||
// Ref
|
||||
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_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
$solde = $acct->solde(0);
|
||||
$solde = $object->solde(0);
|
||||
|
||||
/*
|
||||
* 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.= " WHERE f.entity = ".$conf->entity;
|
||||
$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";
|
||||
|
||||
// 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.= " WHERE ff.entity = ".$conf->entity;
|
||||
$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";
|
||||
|
||||
// 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.= " WHERE cs.entity = ".$conf->entity;
|
||||
$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";
|
||||
|
||||
$error=0;
|
||||
@ -332,8 +322,8 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
|
||||
// Solde actuel
|
||||
$var=!$var;
|
||||
print '<tr class="liste_total">';
|
||||
print '<td align="left" colspan="5">'.$langs->trans("FutureBalance").' ('.$acct->currency_code.')</td>';
|
||||
print '<td align="right" class="nowrap">'.price($solde, 0, $langs, 0, 0, -1, $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, $object->currency_code).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
@ -2814,9 +2814,10 @@ class Form
|
||||
* @param int $noadmininfo 0=Add admin info, 1=Disable admin info
|
||||
* @param int $maxlength Max length of label
|
||||
* @param int $active Active or not, -1 = all
|
||||
* @param string $morecss Add more css
|
||||
* @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;
|
||||
|
||||
@ -2829,7 +2830,7 @@ class Form
|
||||
|
||||
$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=""> </option>';
|
||||
foreach($this->cache_types_paiements as $id => $arraytypes)
|
||||
{
|
||||
|
||||
@ -943,11 +943,12 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
|
||||
// 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("/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/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/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/productaccount.php?mainmenu=accountancy&leftmenu=accountancy", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 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', 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', 40);
|
||||
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&leftmenu=accountancy", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 50);
|
||||
|
||||
// Binding
|
||||
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&mainmenu=accountancy",$langs->trans("CustomersVentilation"),1,$user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer');
|
||||
if (preg_match('/accountancy_dispatch_customer/',$leftmenu)) $newmenu->add("/accountancy/customer/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer",$langs->trans("ToBind"),2,$user->rights->accounting->bind->write);
|
||||
|
||||
@ -377,92 +377,16 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
$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=(! empty($conf->global->$paramfreetext))?$outputlangs->convToOutputCharset($conf->global->$paramfreetext):"";
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 3);
|
||||
$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>";
|
||||
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);
|
||||
}
|
||||
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
|
||||
$newfreetext='';
|
||||
$paramfreetext='BANK_CHEQUERECEIPT_FREE_TEXT';
|
||||
if (! empty($conf->global->$paramfreetext))
|
||||
{
|
||||
$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);
|
||||
$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
return pdf_pagefoot($pdf,$outputlangs,$newfreetext,$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -590,8 +590,6 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
$this->error=$langs->trans("ErrorUnknown");
|
||||
return 0; // Erreur par defaut
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -406,8 +406,6 @@ class pdf_strato extends ModelePDFContract
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","CONTRACT_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
$this->error=$langs->trans("ErrorUnknown");
|
||||
return 0; // Erreur par defaut
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -269,8 +269,6 @@ class html_cerfafr extends ModeleDon
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","DON_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
$this->error=$langs->trans("ErrorUnknown");
|
||||
return 0; // Error by default
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -482,8 +482,6 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","EXPENSEREPORT_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
$this->error=$langs->trans("ErrorUnknown");
|
||||
return 0; // Erreur par defaut
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -405,8 +405,6 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","FICHEINTER_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
$this->error=$langs->trans("ErrorUnknown");
|
||||
return 0; // Erreur par defaut
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -763,9 +763,6 @@ class pdf_azur extends ModelePDFPropales
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","PROP_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
|
||||
$this->error=$langs->trans("ErrorUnknown");
|
||||
return 0; // Erreur par defaut
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -549,8 +549,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","SUPPLIER_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
$this->error=$langs->trans("ErrorUnknown");
|
||||
return 0; // Erreur par defaut
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -572,8 +572,6 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","SUPPLIER_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
$this->error=$langs->trans("ErrorUnknown");
|
||||
return 0; // Erreur par defaut
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -198,8 +198,6 @@ class InterfaceLogevents extends DolibarrTriggers
|
||||
dol_syslog(get_class($this).": ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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 (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);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -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_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;
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@ create table llx_commande_fournisseurdet
|
||||
ref varchar(50), -- supplier product ref
|
||||
label varchar(255), -- product label
|
||||
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
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
|
||||
@ -28,7 +28,8 @@ create table llx_commandedet
|
||||
fk_product integer NULL,
|
||||
label varchar(255) DEFAULT NULL,
|
||||
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_type varchar(10) NULL, -- localtax1 type
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||
|
||||
@ -31,6 +31,7 @@ create table llx_facture_fourn_det
|
||||
pu_ttc double(24,8), -- unit price with tax
|
||||
qty real, -- quantity of product/service
|
||||
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
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
|
||||
@ -26,15 +26,16 @@ create table llx_facturedet
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_facture integer NOT NULL,
|
||||
fk_parent_line integer NULL,
|
||||
fk_parent_line integer NULL,
|
||||
fk_product integer NULL, -- Doit pouvoir etre nul pour ligne detail sans produits
|
||||
label varchar(255) DEFAULT NULL,
|
||||
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%)
|
||||
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_type varchar(10) NULL, -- localtax2 type
|
||||
localtax2_type varchar(10) NULL, -- localtax2 type
|
||||
qty real, -- Quantity (exemple 2)
|
||||
remise_percent real DEFAULT 0, -- % de la remise ligne (exemple 20%)
|
||||
remise real DEFAULT 0, -- Montant calcule de la remise % sur PU HT (exemple 20)
|
||||
@ -43,13 +44,13 @@ create table llx_facturedet
|
||||
price double(24,8), -- Deprecated (Do not use)
|
||||
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_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_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_ttc double(24,8), -- Total TTC de la ligne toute quantite et incluant remise ligne et globale
|
||||
product_type integer DEFAULT 0,
|
||||
date_start datetime DEFAULT NULL, -- date debut si service
|
||||
date_end datetime DEFAULT NULL, -- date fin si service
|
||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||
date_start datetime DEFAULT NULL, -- date start if service
|
||||
date_end datetime DEFAULT NULL, -- date end if service
|
||||
info_bits integer DEFAULT 0, -- VAT NPR or not (for france only)
|
||||
|
||||
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)
|
||||
@ -58,19 +59,19 @@ create table llx_facturedet
|
||||
|
||||
special_code integer DEFAULT 0, -- code pour les lignes speciales
|
||||
rang integer DEFAULT 0, -- position of line
|
||||
fk_contract_line integer NULL, -- id of contract line when invoice comes from contract lines
|
||||
fk_contract_line integer NULL, -- id of contract line when invoice comes from contract lines
|
||||
import_key varchar(14),
|
||||
|
||||
situation_percent real, -- % progression of lines invoicing
|
||||
fk_prev_id integer, -- id of the line in the previous situation,
|
||||
fk_unit integer DEFAULT NULL, -- id of the unit code¡
|
||||
situation_percent real, -- % progression of lines invoicing
|
||||
fk_prev_id integer, -- id of the line in the previous situation,
|
||||
fk_unit integer DEFAULT NULL, -- id of the unit code¡
|
||||
|
||||
fk_multicurrency integer,
|
||||
fk_multicurrency integer,
|
||||
multicurrency_code varchar(255),
|
||||
multicurrency_subprice double(24,8) DEFAULT 0,
|
||||
multicurrency_total_ht double(24,8) DEFAULT 0,
|
||||
multicurrency_total_tva double(24,8) DEFAULT 0,
|
||||
multicurrency_total_ttc double(24,8) DEFAULT 0
|
||||
multicurrency_total_tva double(24,8) DEFAULT 0,
|
||||
multicurrency_total_ttc double(24,8) DEFAULT 0
|
||||
)ENGINE=innodb;
|
||||
|
||||
--
|
||||
|
||||
@ -28,7 +28,8 @@ create table llx_propaldet
|
||||
label varchar(255) DEFAULT NULL,
|
||||
description text,
|
||||
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_type varchar(10) NULL, -- localtax1 type
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||
|
||||
@ -23,7 +23,8 @@ CREATE TABLE llx_supplier_proposaldet (
|
||||
label varchar(255) DEFAULT NULL,
|
||||
description text,
|
||||
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_type varchar(10) DEFAULT NULL,
|
||||
localtax2_tx double(6,3) DEFAULT 0,
|
||||
@ -45,7 +46,6 @@ CREATE TABLE llx_supplier_proposaldet (
|
||||
special_code integer DEFAULT 0,
|
||||
rang integer DEFAULT 0,
|
||||
ref_fourn varchar(30) DEFAULT NULL,
|
||||
|
||||
fk_multicurrency integer,
|
||||
multicurrency_code varchar(255),
|
||||
multicurrency_subprice double(24,8) DEFAULT 0,
|
||||
|
||||
@ -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
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
@ -46,6 +46,7 @@ AccountAccounting=Accounting account
|
||||
AccountAccountingShort=Account
|
||||
AccountAccountingSuggest=Accounting account suggest
|
||||
MenuDefaultAccounts=Default accounts
|
||||
MenuVatAccounts=Vat accounts
|
||||
MenuProductsAccounts=Product accounts
|
||||
ProductsBinding=Products accounts
|
||||
Ventilation=Binding to accounts
|
||||
|
||||
@ -86,6 +86,7 @@ Refund=Refund
|
||||
SocialContributionsPayments=Social/fiscal taxes payments
|
||||
ShowVatPayment=Show VAT payment
|
||||
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
|
||||
SupplierAccountancyCode=Supplier accountancy code
|
||||
CustomerAccountancyCodeShort=Cust. account. code
|
||||
|
||||
@ -335,23 +335,23 @@ else
|
||||
}
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($search_categ > 0) $param.="&search_categ=".$search_categ;
|
||||
if ($sref) $param="&sref=".$sref;
|
||||
if ($search_ref_supplier) $param="&search_ref_supplier=".$search_ref_supplier;
|
||||
if ($sbarcode) $param.=($sbarcode?"&sbarcode=".$sbarcode:"");
|
||||
if ($snom) $param.="&snom=".$snom;
|
||||
if ($sall) $param.="&sall=".$sall;
|
||||
if ($tosell != '') $param.="&tosell=".$tosell;
|
||||
if ($tobuy != '') $param.="&tobuy=".$tobuy;
|
||||
if ($fourn_id) $param.=($fourn_id?"&fourn_id=".$fourn_id:"");
|
||||
if ($seach_categ) $param.=($search_categ?"&search_categ=".$search_categ:"");
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($search_categ > 0) $param.="&search_categ=".urlencode($search_categ);
|
||||
if ($sref) $param="&sref=".urlencode($sref);
|
||||
if ($search_ref_supplier) $param="&search_ref_supplier=".urlencode($search_ref_supplier);
|
||||
if ($sbarcode) $param.=($sbarcode?"&sbarcode=".urlencode($sbarcode):"");
|
||||
if ($snom) $param.="&snom=".urlencode($snom);
|
||||
if ($sall) $param.="&sall=".urlencode($sall);
|
||||
if ($tosell != '') $param.="&tosell=".urlencode($tosell);
|
||||
if ($tobuy != '') $param.="&tobuy=".urlencode($tobuy);
|
||||
if ($fourn_id > 0) $param.=($fourn_id?"&fourn_id=".$fourn_id:"");
|
||||
if ($seach_categ) $param.=($search_categ?"&search_categ=".urlencode($search_categ):"");
|
||||
if ($type != '') $param.='&type='.urlencode($type);
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if ($search_tobatch) $param="&search_ref_supplier=".$search_ref_supplier;
|
||||
if ($search_accountancy_code_sell) $param="&search_accountancy_code_sell=".$search_accountancy_code_sell;
|
||||
if ($search_accountancy_code_buy) $param="&search_accountancy_code_buy=".$search_accountancy_code_buy;
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
if ($search_tobatch) $param="&search_ref_supplier=".urlencode($search_ref_supplier);
|
||||
if ($search_accountancy_code_sell) $param="&search_accountancy_code_sell=".urlencode($search_accountancy_code_sell);
|
||||
if ($search_accountancy_code_buy) $param="&search_accountancy_code_buy=".urlencode($search_accountancy_code_buy);
|
||||
// Add $param from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
|
||||
@ -260,7 +260,6 @@ abstract class ActionsCardCommon
|
||||
return;
|
||||
}
|
||||
}
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1904,7 +1904,11 @@ class Societe extends CommonObject
|
||||
$label.= '<br><b>' . $langs->trans('CustomerCode') . ':</b> '. $this->code_client;
|
||||
if (! empty($this->code_fournisseur) && $this->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))
|
||||
{
|
||||
$label.= '</br><div class="photointooltip">';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user