mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-15 22:11:36 +01:00
Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -87,7 +87,7 @@ $offset = $limit * $page;
|
|||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if ($sortorder == "") $sortorder = "ASC";
|
if ($sortorder == "") $sortorder = "ASC";
|
||||||
if ($sortfield == "") $sortfield = "t.rowid";
|
if ($sortfield == "") $sortfield = "t.piece_num,t.rowid";
|
||||||
|
|
||||||
|
|
||||||
$object = new BookKeeping($db);
|
$object = new BookKeeping($db);
|
||||||
@@ -98,9 +98,12 @@ $form = new Form($db);
|
|||||||
|
|
||||||
if (! in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && GETPOST('page','int') == '' && ! GETPOST('noreset','int'))
|
if (! in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && GETPOST('page','int') == '' && ! GETPOST('noreset','int'))
|
||||||
{
|
{
|
||||||
|
if (empty($search_date_start) && empty($search_date_end))
|
||||||
|
{
|
||||||
$query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
$query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
||||||
$query.= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";
|
$query.= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";
|
||||||
$res = $db->query($query);
|
$res = $db->query($query);
|
||||||
|
|
||||||
if ($res->num_rows > 0) {
|
if ($res->num_rows > 0) {
|
||||||
$fiscalYear = $db->fetch_object($res);
|
$fiscalYear = $db->fetch_object($res);
|
||||||
$search_date_start = strtotime($fiscalYear->date_start);
|
$search_date_start = strtotime($fiscalYear->date_start);
|
||||||
@@ -108,6 +111,7 @@ if (! in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !
|
|||||||
} else {
|
} else {
|
||||||
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||||
$year_start = dol_print_date(dol_now(), '%Y');
|
$year_start = dol_print_date(dol_now(), '%Y');
|
||||||
|
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||||
$year_end = $year_start + 1;
|
$year_end = $year_start + 1;
|
||||||
$month_end = $month_start - 1;
|
$month_end = $month_start - 1;
|
||||||
if ($month_end < 1)
|
if ($month_end < 1)
|
||||||
@@ -118,13 +122,14 @@ if (! in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !
|
|||||||
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||||
$search_date_end = dol_get_last_day($year_end, $month_end);
|
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$arrayfields=array(
|
$arrayfields=array(
|
||||||
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
|
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
|
||||||
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
|
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
|
||||||
't.doc_ref'=>array('label'=>$langs->trans("Docref"), 'checked'=>1),
|
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
|
||||||
't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1),
|
't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1),
|
||||||
't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
|
't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
|
||||||
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||||
@@ -430,7 +435,7 @@ else $button.= $langs->trans("ExportList");
|
|||||||
$button.= '</a>';
|
$button.= '</a>';
|
||||||
|
|
||||||
|
|
||||||
$groupby = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php"">' . $langs->trans("GroupByAccountAccounting") . '</a>';
|
$groupby = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param.'">' . $langs->trans("GroupByAccountAccounting") . '</a>';
|
||||||
$addbutton = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a>';
|
$addbutton = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a>';
|
||||||
|
|
||||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, $groupby.$addbutton, '', $limit);
|
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, $groupby.$addbutton, '', $limit);
|
||||||
@@ -576,17 +581,17 @@ print '</td>';
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
if (! empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
|
if (! empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
|
if (! empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
|
if (! empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['t.numero_compte']['checked'])) print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
if (! empty($arrayfields['t.numero_compte']['checked'])) print_liste_field_titre($arrayfields['t.numero_compte']['label'], $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['t.subledger_account']['checked'])) print_liste_field_titre("SubledgerAccount", $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
|
if (! empty($arrayfields['t.subledger_account']['checked'])) print_liste_field_titre($arrayfields['t.subledger_account']['label'], $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
|
if (! empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
|
if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
|
if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
|
if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre("DateCreation", $_SERVER['PHP_SELF'], "t.date_creation", "", $param, 'align="center"', $sortfield, $sortorder);
|
if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre($arrayfields['t.date_creation']['label'], $_SERVER['PHP_SELF'], "t.date_creation", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre("DateModification", $_SERVER['PHP_SELF'], "t.tms", "", $param, 'align="center"', $sortfield, $sortorder);
|
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
@@ -677,14 +682,14 @@ if ($num > 0)
|
|||||||
// Creation operation date
|
// Creation operation date
|
||||||
if (! empty($arrayfields['t.date_creation']['checked']))
|
if (! empty($arrayfields['t.date_creation']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="center">' . dol_print_date($line->date_creation, 'day') . '</td>';
|
print '<td align="center">' . dol_print_date($line->date_creation, 'dayhour') . '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modification operation date
|
// Modification operation date
|
||||||
if (! empty($arrayfields['t.tms']['checked']))
|
if (! empty($arrayfields['t.tms']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="center">' . dol_print_date($line->date_modification, 'day') . '</td>';
|
print '<td align="center">' . dol_print_date($line->date_modification, 'dayhour') . '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -704,6 +709,7 @@ if ($num > 0)
|
|||||||
if (isset($totalarray['totaldebitfield']) || isset($totalarray['totalcreditfield']))
|
if (isset($totalarray['totaldebitfield']) || isset($totalarray['totalcreditfield']))
|
||||||
{
|
{
|
||||||
$i=0;
|
$i=0;
|
||||||
|
print '<tr class="liste_total">';
|
||||||
while ($i < $totalarray['nbfield'])
|
while ($i < $totalarray['nbfield'])
|
||||||
{
|
{
|
||||||
$i++;
|
$i++;
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ $pagenext = $page + 1;
|
|||||||
if ($sortorder == "") $sortorder = "ASC";
|
if ($sortorder == "") $sortorder = "ASC";
|
||||||
if ($sortfield == "") $sortfield = "t.rowid";
|
if ($sortfield == "") $sortfield = "t.rowid";
|
||||||
|
|
||||||
if (empty($search_date_start)) {
|
if (empty($search_date_start) && empty($search_date_end)) {
|
||||||
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
||||||
$sql.= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
|
$sql.= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
|
||||||
$sql.= $db->plimit(1);
|
$sql.= $db->plimit(1);
|
||||||
@@ -81,6 +81,7 @@ if (empty($search_date_start)) {
|
|||||||
} else {
|
} else {
|
||||||
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||||
$year_start = dol_print_date(dol_now(), '%Y');
|
$year_start = dol_print_date(dol_now(), '%Y');
|
||||||
|
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||||
$year_end = $year_start + 1;
|
$year_end = $year_start + 1;
|
||||||
$month_end = $month_start - 1;
|
$month_end = $month_start - 1;
|
||||||
if ($month_end < 1)
|
if ($month_end < 1)
|
||||||
@@ -225,14 +226,13 @@ if ($action == 'delbookkeepingyear') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$param=$options;
|
||||||
|
|
||||||
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||||
|
|
||||||
$viewflat = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">' . $langs->trans("ViewFlatList") . '</a>';
|
$viewflat = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param.'">' . $langs->trans("ViewFlatList") . '</a>';
|
||||||
$addbutton = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a>';
|
$addbutton = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a>';
|
||||||
|
|
||||||
$param=$options;
|
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||||
|
|
||||||
|
|||||||
@@ -781,7 +781,8 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " t.code_journal,";
|
$sql .= " t.code_journal,";
|
||||||
$sql .= " t.journal_label,";
|
$sql .= " t.journal_label,";
|
||||||
$sql .= " t.piece_num,";
|
$sql .= " t.piece_num,";
|
||||||
$sql .= " t.date_creation";
|
$sql .= " t.date_creation,";
|
||||||
|
$sql .= " t.tms as date_modification";
|
||||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||||
// Manage filter
|
// Manage filter
|
||||||
$sqlwhere = array ();
|
$sqlwhere = array ();
|
||||||
@@ -849,7 +850,8 @@ class BookKeeping extends CommonObject
|
|||||||
$line->code_journal = $obj->code_journal;
|
$line->code_journal = $obj->code_journal;
|
||||||
$line->journal_label = $obj->journal_label;
|
$line->journal_label = $obj->journal_label;
|
||||||
$line->piece_num = $obj->piece_num;
|
$line->piece_num = $obj->piece_num;
|
||||||
$line->date_creation = $obj->date_creation;
|
$line->date_creation = $this->db->jdate($obj->date_creation);
|
||||||
|
$line->date_modification = $this->db->jdate($obj->date_modification);
|
||||||
|
|
||||||
$this->lines[] = $line;
|
$this->lines[] = $line;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -303,6 +303,7 @@ if ($result) {
|
|||||||
}
|
}
|
||||||
$chargestatic->ref = $chargestatic->lib;
|
$chargestatic->ref = $chargestatic->lib;
|
||||||
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
|
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
|
||||||
|
$tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id;
|
||||||
|
|
||||||
$sqlmid = 'SELECT cchgsoc.accountancy_code';
|
$sqlmid = 'SELECT cchgsoc.accountancy_code';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
|
||||||
@@ -401,7 +402,9 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
foreach ( $tabpay as $key => $val ) { // $key is rowid into llx_bank
|
foreach ( $tabpay as $key => $val ) // $key is rowid into llx_bank
|
||||||
|
{
|
||||||
|
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||||
|
|
||||||
$ref = getSourceDocRef($val, $tabtype[$key]);
|
$ref = getSourceDocRef($val, $tabtype[$key]);
|
||||||
|
|
||||||
@@ -423,7 +426,14 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
// Line into bank account
|
// Line into bank account
|
||||||
foreach ( $tabbq[$key] as $k => $mt )
|
foreach ( $tabbq[$key] as $k => $mt )
|
||||||
{
|
{
|
||||||
if ($mt) {
|
if ($mt)
|
||||||
|
{
|
||||||
|
$reflabel = $langs->trans("Bank");
|
||||||
|
$reflabel.= ' '.$val['bank_account_ref'];
|
||||||
|
if (! empty($val['soclib'])) {
|
||||||
|
$reflabel .= " - " . dol_string_nohtmltag($val['soclib']);
|
||||||
|
}
|
||||||
|
|
||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->doc_ref = $ref;
|
$bookkeeping->doc_ref = $ref;
|
||||||
@@ -442,31 +452,8 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->date_create = $now;
|
||||||
|
|
||||||
// No subledger_account value for the bank line but add a specific label_operation
|
// No subledger_account value for the bank line but add a specific label_operation
|
||||||
if ($tabtype[$key] == 'payment') {
|
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
|
$bookkeeping->label_operation = $reflabel;
|
||||||
} else if ($tabtype[$key] == 'payment_supplier') {
|
|
||||||
$bookkeeping->subledger_account = '';
|
|
||||||
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
|
|
||||||
} else if ($tabtype[$key] == 'payment_expensereport') {
|
|
||||||
$bookkeeping->subledger_account = '';
|
|
||||||
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
|
|
||||||
} else if ($tabtype[$key] == 'payment_salary') {
|
|
||||||
$bookkeeping->subledger_account = '';
|
|
||||||
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
|
|
||||||
} else if ($tabtype[$key] == 'payment_vat') {
|
|
||||||
$bookkeeping->subledger_account = '';
|
|
||||||
$bookkeeping->label_operation = $ref;
|
|
||||||
} else if ($tabtype[$key] == 'payment_donation') {
|
|
||||||
$bookkeeping->subledger_account = '';
|
|
||||||
$bookkeeping->label_operation = $ref;
|
|
||||||
} else if ($tabtype[$key] == 'payment_various') {
|
|
||||||
$bookkeeping->subledger_account = '';
|
|
||||||
$bookkeeping->label_operation = $ref;
|
|
||||||
} else if ($tabtype[$key] == 'unknown') {
|
|
||||||
// ???
|
|
||||||
$bookkeeping->subledger_account = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$totaldebit += $bookkeeping->debit;
|
$totaldebit += $bookkeeping->debit;
|
||||||
$totalcredit += $bookkeeping->credit;
|
$totalcredit += $bookkeeping->credit;
|
||||||
@@ -491,11 +478,16 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
if (! $errorforline && is_array($tabtp[$key]))
|
if (! $errorforline)
|
||||||
|
{
|
||||||
|
if (is_array($tabtp[$key]))
|
||||||
{
|
{
|
||||||
// Line into thirdparty account
|
// Line into thirdparty account
|
||||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||||
if ($mt) {
|
if ($mt)
|
||||||
|
{
|
||||||
|
$reflabel = dol_string_nohtmltag($val['soclib']);
|
||||||
|
|
||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->doc_ref = $ref;
|
$bookkeeping->doc_ref = $ref;
|
||||||
@@ -512,55 +504,46 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->date_create = $now;
|
||||||
|
|
||||||
if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
|
if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
|
||||||
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
|
|
||||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||||
$bookkeeping->label_compte = '';
|
$bookkeeping->label_compte = '';
|
||||||
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
|
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
|
||||||
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
|
|
||||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||||
$bookkeeping->label_compte = '';
|
$bookkeeping->label_compte = '';
|
||||||
} else if ($tabtype[$key] == 'payment_expensereport') {
|
} else if ($tabtype[$key] == 'payment_expensereport') {
|
||||||
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
|
|
||||||
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
||||||
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
||||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||||
$bookkeeping->label_compte = '';
|
$bookkeeping->label_compte = '';
|
||||||
} else if ($tabtype[$key] == 'payment_salary') {
|
} else if ($tabtype[$key] == 'payment_salary') {
|
||||||
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
|
|
||||||
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
||||||
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
||||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||||
$bookkeeping->label_compte = '';
|
$bookkeeping->label_compte = '';
|
||||||
} else if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
|
} else if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
|
||||||
$bookkeeping->label_operation = $ref;
|
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_compte = $objmid->labelc;
|
$bookkeeping->label_compte = $objmid->labelc;
|
||||||
} else if ($tabtype[$key] == 'payment_vat') {
|
} else if ($tabtype[$key] == 'payment_vat') {
|
||||||
$bookkeeping->label_operation = $ref;
|
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_compte = '';
|
$bookkeeping->label_compte = '';
|
||||||
} else if ($tabtype[$key] == 'payment_donation') {
|
} else if ($tabtype[$key] == 'payment_donation') {
|
||||||
$bookkeeping->label_operation = $ref;
|
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_compte = '';
|
$bookkeeping->label_compte = '';
|
||||||
} else if ($tabtype[$key] == 'payment_various') {
|
} else if ($tabtype[$key] == 'payment_various') {
|
||||||
$bookkeeping->label_operation = $ref;
|
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_compte = '';
|
$bookkeeping->label_compte = '';
|
||||||
} else if ($tabtype[$key] == 'banktransfert') {
|
} else if ($tabtype[$key] == 'banktransfert') {
|
||||||
$bookkeeping->label_operation = $ref;
|
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
@@ -569,7 +552,6 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
if ($tabtype[$key] == 'unknown') // Unknown transaction, we will use a waiting account for thirdparty.
|
if ($tabtype[$key] == 'unknown') // Unknown transaction, we will use a waiting account for thirdparty.
|
||||||
{
|
{
|
||||||
// Temporary account
|
// Temporary account
|
||||||
$bookkeeping->label_operation = '';
|
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE;
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE;
|
||||||
@@ -577,6 +559,8 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$bookkeeping->label_operation = $reflabel;
|
||||||
|
|
||||||
$totaldebit += $bookkeeping->debit;
|
$totaldebit += $bookkeeping->debit;
|
||||||
$totalcredit += $bookkeeping->credit;
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
@@ -598,6 +582,52 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else { // If thirdparty unkown, output the waiting account
|
||||||
|
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||||
|
if ($mt)
|
||||||
|
{
|
||||||
|
$reflabel = 'WaitingAccount';
|
||||||
|
|
||||||
|
$bookkeeping = new BookKeeping($db);
|
||||||
|
$bookkeeping->doc_date = $val["date"];
|
||||||
|
$bookkeeping->doc_ref = $ref;
|
||||||
|
$bookkeeping->doc_type = 'bank';
|
||||||
|
$bookkeeping->fk_doc = $key;
|
||||||
|
$bookkeeping->fk_docdet = $val["fk_bank"];
|
||||||
|
$bookkeeping->montant = $mt;
|
||||||
|
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||||
|
$bookkeeping->debit = ($mt < 0 ? - $mt : 0);
|
||||||
|
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
||||||
|
$bookkeeping->code_journal = $journal;
|
||||||
|
$bookkeeping->journal_label = $journal_label;
|
||||||
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
$bookkeeping->date_create = $now;
|
||||||
|
$bookkeeping->label_compte = '';
|
||||||
|
|
||||||
|
$bookkeeping->label_operation = $reflabel;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
|
$result = $bookkeeping->create($user);
|
||||||
|
if ($result < 0) {
|
||||||
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($totaldebit != $totalcredit)
|
if ($totaldebit != $totalcredit)
|
||||||
{
|
{
|
||||||
@@ -662,61 +692,59 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||||
|
|
||||||
$companystatic = new Client($db);
|
// CSV header line
|
||||||
$userstatic = new User($db);
|
print '"' . $langs->trans("BankId").'"' . $sep;
|
||||||
|
print '"' . $langs->trans("Date") . '"' . $sep;
|
||||||
|
print '"' . $langs->trans("PaymentMode") . '"' . $sep;
|
||||||
|
print '"' . $langs->trans("AccountAccounting") . '"' . $sep;
|
||||||
|
print '"' . $langs->trans("LedgerAccount") . '"' . $sep;
|
||||||
|
print '"' . $langs->trans("SubledgerAccount") . '"' . $sep;
|
||||||
|
print '"' . $langs->trans("Label"). '"' . $sep;
|
||||||
|
print '"' . $langs->trans("Amount") . '"' . $sep;
|
||||||
|
print '"' . $langs->trans("Amount") . '"' . $sep;
|
||||||
|
print '"' . $langs->trans("Journal") . '"' . $sep;
|
||||||
|
print '"' . $langs->trans("Note") . '"' . $sep;
|
||||||
|
print "\n";
|
||||||
|
|
||||||
foreach ( $tabpay as $key => $val ) {
|
|
||||||
|
foreach ( $tabpay as $key => $val )
|
||||||
|
{
|
||||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||||
|
|
||||||
$ref = getSourceDocRef($val, $tabtype[$key]);
|
$ref = getSourceDocRef($val, $tabtype[$key]);
|
||||||
|
|
||||||
//
|
|
||||||
if (! empty($tabcompany[$key]['id']))
|
|
||||||
{
|
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$companystatic->id = 0;
|
|
||||||
$companystatic->name = '';
|
|
||||||
}
|
|
||||||
if (! empty($tabuser[$key]['id']))
|
|
||||||
{
|
|
||||||
$userstatic->id = $tabuser[$key]['id'];
|
|
||||||
$userstatic->lastname = $tabuser[$key]['lastname'];
|
|
||||||
$userstatic->firstname = $tabuser[$key]['firstname'];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$userstatic->id = 0;
|
|
||||||
$userstatic->lastname = '';
|
|
||||||
$userstatic->firstname = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bank
|
// Bank
|
||||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||||
|
if ($mt)
|
||||||
|
{
|
||||||
|
$reflabel = $langs->trans("Bank");
|
||||||
|
$reflabel.= ' '.$val['bank_account_ref'];
|
||||||
|
if (! empty($val['soclib'])) {
|
||||||
|
$reflabel .= " - " . dol_string_nohtmltag($val['soclib']);
|
||||||
|
}
|
||||||
|
|
||||||
print '"' . $key . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["type_payment"] . '"' . $sep;
|
print '"' . $val["type_payment"] . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print " " . $sep;
|
print " " . $sep;
|
||||||
if ($companystatic->name == '') {
|
print '"' . $reflabel . '"' . $sep;
|
||||||
print '"' . $val['bank_account_ref'] . " - " . utf8_decode($reflabel) . '"' . $sep;
|
|
||||||
} else {
|
|
||||||
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
|
||||||
}
|
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
print '"' . $journal . '"' . $sep;
|
print '"' . $journal . '"' . $sep;
|
||||||
|
print '"' . dol_string_nohtmltag($ref) . '"' . $sep;
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
if (is_array($tabtp[$key])) {
|
if (is_array($tabtp[$key])) {
|
||||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||||
if ($mt) {
|
if ($mt)
|
||||||
|
{
|
||||||
|
$reflabel = dol_string_nohtmltag($val['soclib']);
|
||||||
|
|
||||||
print '"' . $key . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["type_payment"] . '"' . $sep;
|
print '"' . $val["type_payment"] . '"' . $sep;
|
||||||
@@ -725,41 +753,44 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
||||||
} else if($tabtype[$key] == 'payment') {
|
} else if($tabtype[$key] == 'payment') {
|
||||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
|
print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
|
||||||
|
} else if($tabtype[$key] == 'payment_expensereport') {
|
||||||
|
print '"' . $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT . '"' . $sep;
|
||||||
|
} else if($tabtype[$key] == 'payment_salary') {
|
||||||
|
print '"' . $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT . '"' . $sep;
|
||||||
} else {
|
} else {
|
||||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
}
|
}
|
||||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
if ($companystatic->name == '') {
|
print '"' . $reflabel . '"' . $sep;
|
||||||
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($reflabel) . '"' . $sep;
|
|
||||||
} else {
|
|
||||||
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($companystatic->name) . '"' . $sep;
|
|
||||||
}
|
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . $journal . '"' . $sep;
|
print '"' . $journal . '"' . $sep;
|
||||||
|
print '"' . dol_string_nohtmltag($ref) . '"' . $sep;
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else { // If thirdparty unkown, output the waiting account
|
||||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||||
|
if ($mt)
|
||||||
|
{
|
||||||
|
$reflabel = 'WaitingAccount';
|
||||||
|
|
||||||
print '"' . $key . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["type_payment"] . '"' . $sep;
|
print '"' . $val["type_payment"] . '"' . $sep;
|
||||||
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
||||||
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
||||||
print " " . $sep;
|
print "" . $sep;
|
||||||
if ($companystatic->name == '') {
|
print '"' . $reflabel . '"' . $sep;
|
||||||
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($reflabel) . '"' . $sep;
|
|
||||||
} else {
|
|
||||||
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
|
||||||
}
|
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . $journal . '"' . $sep;
|
print '"' . $journal . '"' . $sep;
|
||||||
|
print '"' . dol_string_nohtmltag($ref) . '"' . $sep;
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -862,7 +893,8 @@ if (empty($action) || $action == 'view') {
|
|||||||
|
|
||||||
$r = '';
|
$r = '';
|
||||||
|
|
||||||
foreach ( $tabpay as $key => $val ) { // $key is rowid in llx_bank
|
foreach ( $tabpay as $key => $val ) // $key is rowid in llx_bank
|
||||||
|
{
|
||||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||||
|
|
||||||
$ref = getSourceDocRef($val, $tabtype[$key]);
|
$ref = getSourceDocRef($val, $tabtype[$key]);
|
||||||
@@ -870,6 +902,14 @@ if (empty($action) || $action == 'view') {
|
|||||||
// Bank
|
// Bank
|
||||||
foreach ( $tabbq[$key] as $k => $mt )
|
foreach ( $tabbq[$key] as $k => $mt )
|
||||||
{
|
{
|
||||||
|
if ($mt)
|
||||||
|
{
|
||||||
|
$reflabel = $langs->trans("Bank");
|
||||||
|
$reflabel.= ' '.$val['bank_account_ref'];
|
||||||
|
if (! empty($val['soclib'])) {
|
||||||
|
$reflabel .= " - " . $val['soclib'];
|
||||||
|
}
|
||||||
|
|
||||||
//var_dump($tabpay[$key]);
|
//var_dump($tabpay[$key]);
|
||||||
print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
|
print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
@@ -895,23 +935,22 @@ if (empty($action) || $action == 'view') {
|
|||||||
else print $accounttoshow;*/
|
else print $accounttoshow;*/
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print "<td>";
|
print "<td>";
|
||||||
//var_dump($tabpay[$key]);
|
print $reflabel;
|
||||||
print $langs->trans("Bank");
|
|
||||||
print ' '.$val['bank_account_ref'];
|
|
||||||
if (! empty($val['soclib'])) {
|
|
||||||
print " - " . $val['soclib'];
|
|
||||||
}
|
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print "<td>" . $val["type_payment"] . "</td>";
|
print "<td>" . $val["type_payment"] . "</td>";
|
||||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
if (is_array($tabtp[$key])) {
|
if (is_array($tabtp[$key])) {
|
||||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||||
if ($k != 'type') {
|
if ($mt)
|
||||||
|
{
|
||||||
|
$reflabel = $val['soclib'];
|
||||||
|
|
||||||
print '<!-- Thirdparty bank.rowid='.$key.' -->';
|
print '<!-- Thirdparty bank.rowid='.$key.' -->';
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td></td>";
|
print "<td></td>";
|
||||||
@@ -974,15 +1013,19 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print "<td>" . $reflabel . ' ' . $val['soclib'] . "</td>";
|
print "<td>" . $reflabel . "</td>";
|
||||||
print "<td>" . $val["type_payment"] . "</td>";
|
print "<td>" . $val["type_payment"] . "</td>";
|
||||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else { // Waiting account
|
||||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||||
|
if ($mt)
|
||||||
|
{
|
||||||
|
$reflabel = 'WaitingAccount';
|
||||||
|
|
||||||
print '<!-- Wait bank.rowid='.$key.' -->';
|
print '<!-- Wait bank.rowid='.$key.' -->';
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td></td>";
|
print "<td></td>";
|
||||||
@@ -1013,6 +1056,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@@ -1089,6 +1133,13 @@ function getSourceDocRef($val, $typerecord)
|
|||||||
$sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"];
|
$sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"];
|
||||||
$ref = $langs->trans("SalaryPayment");
|
$ref = $langs->trans("SalaryPayment");
|
||||||
}
|
}
|
||||||
|
elseif ($typerecord == 'sc')
|
||||||
|
{
|
||||||
|
$sqlmid = 'SELECT sc.rowid as ref';
|
||||||
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementcharge as sc";
|
||||||
|
$sqlmid .= " WHERE sc.rowid=" . $val["paymentscid"];
|
||||||
|
$ref = $langs->trans("SocialContribution");
|
||||||
|
}
|
||||||
elseif ($typerecord == 'payment_vat')
|
elseif ($typerecord == 'payment_vat')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT v.rowid as ref';
|
$sqlmid = 'SELECT v.rowid as ref';
|
||||||
|
|||||||
@@ -39,8 +39,7 @@ $action = GETPOST('action', 'alpha');
|
|||||||
|
|
||||||
// Other parameters SALARIES_*
|
// Other parameters SALARIES_*
|
||||||
$list = array (
|
$list = array (
|
||||||
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
|
'SALARIES_XXX',
|
||||||
'SALARIES_ACCOUNTING_ACCOUNT_CHARGE'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -423,9 +423,11 @@ class pdf_einstein extends ModelePDFCommandes
|
|||||||
{
|
{
|
||||||
$pdf->commitTransaction();
|
$pdf->commitTransaction();
|
||||||
}
|
}
|
||||||
|
$posYAfterDescription=$pdf->GetY();
|
||||||
|
|
||||||
$nexY = $pdf->GetY();
|
$nexY = $pdf->GetY();
|
||||||
$pageposafter=$pdf->getPage();
|
$pageposafter=$pdf->getPage();
|
||||||
|
|
||||||
$pdf->setPage($pageposbefore);
|
$pdf->setPage($pageposbefore);
|
||||||
$pdf->setTopMargin($this->marge_haute);
|
$pdf->setTopMargin($this->marge_haute);
|
||||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||||
@@ -614,13 +616,13 @@ class pdf_einstein extends ModelePDFCommandes
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
|
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR");
|
$this->error=$langs->transnoentities("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,11 +122,10 @@ abstract class ModeleNumRefExpenseReport
|
|||||||
/**
|
/**
|
||||||
* Renvoie prochaine valeur attribuee
|
* Renvoie prochaine valeur attribuee
|
||||||
*
|
*
|
||||||
* @param Societe $objsoc Object thirdparty
|
|
||||||
* @param Object $object Object we need next value for
|
* @param Object $object Object we need next value for
|
||||||
* @return string Valeur
|
* @return string Valeur
|
||||||
*/
|
*/
|
||||||
function getNextValue($objsoc,$object)
|
function getNextValue($object)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
return $langs->trans("NotAvailable");
|
return $langs->trans("NotAvailable");
|
||||||
|
|||||||
@@ -67,7 +67,8 @@ class modSalaries extends DolibarrModules
|
|||||||
$this->dirs = array("/salaries/temp");
|
$this->dirs = array("/salaries/temp");
|
||||||
|
|
||||||
// Config pages
|
// Config pages
|
||||||
$this->config_page_url = array('salaries.php');
|
//$this->config_page_url = array('salaries.php');
|
||||||
|
$this->config_page_url = array();
|
||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
$this->depends = array();
|
$this->depends = array();
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/core/modules/project/doc/pdf_baleine.modules.php
|
* \file htdocs/core/modules/project/doc/pdf_baleine.modules.php
|
||||||
* \ingroup project
|
* \ingroup project
|
||||||
* \brief Fichier de la classe permettant de generer les projets au modele Baleine
|
* \brief File of class to generate project document Baleine
|
||||||
* \author Regis Houssin
|
* \author Regis Houssin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classe permettant de generer les projets au modele Baleine
|
* Class to manage generation of project document Baleine
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class pdf_baleine extends ModelePDFProjects
|
class pdf_baleine extends ModelePDFProjects
|
||||||
@@ -78,10 +78,19 @@ class pdf_baleine extends ModelePDFProjects
|
|||||||
// Defini position des colonnes
|
// Defini position des colonnes
|
||||||
$this->posxref=$this->marge_gauche+1;
|
$this->posxref=$this->marge_gauche+1;
|
||||||
$this->posxlabel=$this->marge_gauche+25;
|
$this->posxlabel=$this->marge_gauche+25;
|
||||||
$this->posxworkload=$this->marge_gauche+100;
|
$this->posxworkload=$this->marge_gauche+120;
|
||||||
$this->posxprogress=$this->marge_gauche+130;
|
$this->posxprogress=$this->marge_gauche+140;
|
||||||
$this->posxdatestart=$this->marge_gauche+150;
|
$this->posxdatestart=$this->marge_gauche+152;
|
||||||
$this->posxdateend=$this->marge_gauche+170;
|
$this->posxdateend=$this->marge_gauche+170;
|
||||||
|
if ($this->page_largeur < 210) // To work with US executive format
|
||||||
|
{
|
||||||
|
$this->posxref-=20;
|
||||||
|
$this->posxlabel-=20;
|
||||||
|
$this->posxworkload-=20;
|
||||||
|
$this->posxprogress-=20;
|
||||||
|
$this->posxdatestart-=20;
|
||||||
|
$this->posxdateend-=20;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -136,12 +145,14 @@ class pdf_baleine extends ModelePDFProjects
|
|||||||
global $action;
|
global $action;
|
||||||
$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
|
// Create pdf instance
|
||||||
$pdf=pdf_getInstance($this->format);
|
$pdf=pdf_getInstance($this->format);
|
||||||
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
|
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
|
||||||
$heightforinfotot = 50; // Height reserved to output the info and total part
|
$pdf->SetAutoPageBreak(1,0);
|
||||||
|
|
||||||
|
$heightforinfotot = 40; // Height reserved to output the info and total part
|
||||||
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
|
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
|
||||||
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
|
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
|
||||||
$pdf->SetAutoPageBreak(1,0);
|
|
||||||
|
|
||||||
if (class_exists('TCPDF'))
|
if (class_exists('TCPDF'))
|
||||||
{
|
{
|
||||||
@@ -149,6 +160,12 @@ class pdf_baleine extends ModelePDFProjects
|
|||||||
$pdf->setPrintFooter(false);
|
$pdf->setPrintFooter(false);
|
||||||
}
|
}
|
||||||
$pdf->SetFont(pdf_getPDFFont($outputlangs));
|
$pdf->SetFont(pdf_getPDFFont($outputlangs));
|
||||||
|
// Set path to the background PDF File
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
|
||||||
|
{
|
||||||
|
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
|
||||||
|
$tplidx = $pdf->importPage(1);
|
||||||
|
}
|
||||||
|
|
||||||
// Complete object by loading several other informations
|
// Complete object by loading several other informations
|
||||||
$task = new Task($this->db);
|
$task = new Task($this->db);
|
||||||
@@ -177,6 +194,7 @@ class pdf_baleine extends ModelePDFProjects
|
|||||||
|
|
||||||
// New page
|
// New page
|
||||||
$pdf->AddPage();
|
$pdf->AddPage();
|
||||||
|
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||||
$pagenb++;
|
$pagenb++;
|
||||||
$this->_pagehead($pdf, $object, 1, $outputlangs);
|
$this->_pagehead($pdf, $object, 1, $outputlangs);
|
||||||
$pdf->SetFont('','', $default_font_size - 1);
|
$pdf->SetFont('','', $default_font_size - 1);
|
||||||
@@ -184,21 +202,28 @@ class pdf_baleine extends ModelePDFProjects
|
|||||||
$pdf->SetTextColor(0,0,0);
|
$pdf->SetTextColor(0,0,0);
|
||||||
|
|
||||||
$tab_top = 50;
|
$tab_top = 50;
|
||||||
$tab_height = 200;
|
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
|
||||||
$tab_top_newpage = 40;
|
$tab_height = 170;
|
||||||
$tab_height_newpage = 210;
|
$tab_height_newpage = 190;
|
||||||
|
|
||||||
// Affiche notes
|
// Show public note
|
||||||
if (! empty($object->note_public))
|
$notetoshow=empty($object->note_public)?'':$object->note_public;
|
||||||
|
if ($notetoshow)
|
||||||
{
|
{
|
||||||
|
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
|
||||||
|
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||||
|
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
|
||||||
|
|
||||||
|
$tab_top -= 2;
|
||||||
|
|
||||||
$pdf->SetFont('','', $default_font_size - 1);
|
$pdf->SetFont('','', $default_font_size - 1);
|
||||||
$pdf->writeHTMLCell(190, 3, $this->posxref-1, $tab_top-2, dol_htmlentitiesbr($object->note_public), 0, 1);
|
$pdf->writeHTMLCell(190, 3, $this->posxref-1, $tab_top-2, dol_htmlentitiesbr($notetoshow), 0, 1);
|
||||||
$nexY = $pdf->GetY();
|
$nexY = $pdf->GetY();
|
||||||
$height_note=$nexY-($tab_top-2);
|
$height_note=$nexY-$tab_top;
|
||||||
|
|
||||||
// Rect prend une longueur en 3eme param
|
// Rect prend une longueur en 3eme param
|
||||||
$pdf->SetDrawColor(192,192,192);
|
$pdf->SetDrawColor(192,192,192);
|
||||||
$pdf->Rect($this->marge_gauche, $tab_top-3, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
|
$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
|
||||||
|
|
||||||
$tab_height = $tab_height - $height_note;
|
$tab_height = $tab_height - $height_note;
|
||||||
$tab_top = $nexY+6;
|
$tab_top = $nexY+6;
|
||||||
@@ -208,44 +233,126 @@ class pdf_baleine extends ModelePDFProjects
|
|||||||
$height_note=0;
|
$height_note=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$iniY = $tab_top + 7;
|
$heightoftitleline = 10;
|
||||||
$curY = $tab_top + 7;
|
$iniY = $tab_top + $heightoftitleline + 1;
|
||||||
$nexY = $tab_top + 7;
|
$curY = $tab_top + $heightoftitleline + 1;
|
||||||
|
$nexY = $tab_top + $heightoftitleline + 1;
|
||||||
|
|
||||||
// Boucle sur les lignes
|
// Loop on each lines
|
||||||
for ($i = 0 ; $i < $nblignes ; $i++)
|
for ($i = 0 ; $i < $nblignes ; $i++)
|
||||||
{
|
{
|
||||||
$curY = $nexY;
|
$curY = $nexY;
|
||||||
|
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
|
||||||
|
$pdf->SetTextColor(0,0,0);
|
||||||
|
|
||||||
// Description of ligne
|
$pdf->setTopMargin($tab_top_newpage);
|
||||||
|
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
|
||||||
|
$pageposbefore=$pdf->getPage();
|
||||||
|
|
||||||
|
// Description of line
|
||||||
$ref=$object->lines[$i]->ref;
|
$ref=$object->lines[$i]->ref;
|
||||||
$libelleline=$object->lines[$i]->label;
|
$libelleline=$object->lines[$i]->label;
|
||||||
$progress=$object->lines[$i]->progress.'%';
|
$progress=($object->lines[$i]->progress?$object->lines[$i]->progress.'%':'');
|
||||||
$datestart=dol_print_date($object->lines[$i]->date_start,'day');
|
$datestart=dol_print_date($object->lines[$i]->date_start,'day');
|
||||||
$dateend=dol_print_date($object->lines[$i]->date_end,'day');
|
$dateend=dol_print_date($object->lines[$i]->date_end,'day');
|
||||||
$planned_workload=convertSecondToTime((int) $object->lines[$i]->planned_workload,'allhourmin');
|
$planned_workload=convertSecondToTime((int) $object->lines[$i]->planned_workload,'allhourmin');
|
||||||
|
|
||||||
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
|
$showpricebeforepagebreak=1;
|
||||||
|
|
||||||
$pdf->SetXY($this->posxref, $curY);
|
$pdf->startTransaction();
|
||||||
$pdf->MultiCell($this->posxlabel-$this->posxref, 3, $outputlangs->convToOutputCharset($ref), 0, 'L');
|
// Label
|
||||||
$pdf->SetXY($this->posxlabel, $curY);
|
$pdf->SetXY($this->posxlabel, $curY);
|
||||||
$pdf->MultiCell($this->posxworkload-$this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L');
|
$pdf->MultiCell($this->posxworkload-$this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L');
|
||||||
|
$pageposafter=$pdf->getPage();
|
||||||
|
if ($pageposafter > $pageposbefore) // There is a pagebreak
|
||||||
|
{
|
||||||
|
$pdf->rollbackTransaction(true);
|
||||||
|
$pageposafter=$pageposbefore;
|
||||||
|
//print $pageposafter.'-'.$pageposbefore;exit;
|
||||||
|
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||||
|
// Label
|
||||||
|
$pdf->SetXY($this->posxlabel, $curY);
|
||||||
|
$posybefore=$pdf->GetY();
|
||||||
|
$pdf->MultiCell($this->posxworkload-$this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L');
|
||||||
|
$pageposafter=$pdf->getPage();
|
||||||
|
$posyafter=$pdf->GetY();
|
||||||
|
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
|
||||||
|
{
|
||||||
|
if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page
|
||||||
|
{
|
||||||
|
$pdf->AddPage('','',true);
|
||||||
|
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||||
|
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||||
|
$pdf->setPage($pageposafter+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We found a page break
|
||||||
|
$showpricebeforepagebreak=0;
|
||||||
|
$forcedesconsamepage=1;
|
||||||
|
if ($forcedesconsamepage)
|
||||||
|
{
|
||||||
|
$pdf->rollbackTransaction(true);
|
||||||
|
$pageposafter=$pageposbefore;
|
||||||
|
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||||
|
|
||||||
|
$pdf->AddPage('','',true);
|
||||||
|
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||||
|
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||||
|
$pdf->setPage($pageposafter+1);
|
||||||
|
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
|
||||||
|
$pdf->MultiCell(0, 3, ''); // Set interline to 3
|
||||||
|
$pdf->SetTextColor(0,0,0);
|
||||||
|
|
||||||
|
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||||
|
$curY = $tab_top_newpage + $heightoftitleline + 1;
|
||||||
|
|
||||||
|
// Label
|
||||||
|
$pdf->SetXY($this->posxlabel, $curY);
|
||||||
|
$posybefore=$pdf->GetY();
|
||||||
|
$pdf->MultiCell($this->posxworkload-$this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L');
|
||||||
|
$pageposafter=$pdf->getPage();
|
||||||
|
$posyafter=$pdf->GetY();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//var_dump($i.' '.$posybefore.' '.$posyafter.' '.($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)).' '.$showpricebeforepagebreak);
|
||||||
|
}
|
||||||
|
else // No pagebreak
|
||||||
|
{
|
||||||
|
$pdf->commitTransaction();
|
||||||
|
}
|
||||||
|
$posYAfterDescription=$pdf->GetY();
|
||||||
|
|
||||||
|
$nexY = $pdf->GetY();
|
||||||
|
$pageposafter=$pdf->getPage();
|
||||||
|
$pdf->setPage($pageposbefore);
|
||||||
|
$pdf->setTopMargin($this->marge_haute);
|
||||||
|
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||||
|
|
||||||
|
// We suppose that a too long description is moved completely on next page
|
||||||
|
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
|
||||||
|
//var_dump($pageposbefore.'-'.$pageposafter.'-'.$showpricebeforepagebreak);
|
||||||
|
$pdf->setPage($pageposafter); $curY = $tab_top_newpage + $heightoftitleline + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
|
||||||
|
|
||||||
|
// Ref of task
|
||||||
|
$pdf->SetXY($this->posxref, $curY);
|
||||||
|
$pdf->MultiCell($this->posxlabel-$this->posxref, 3, $outputlangs->convToOutputCharset($ref), 0, 'L');
|
||||||
|
// Workload
|
||||||
$pdf->SetXY($this->posxworkload, $curY);
|
$pdf->SetXY($this->posxworkload, $curY);
|
||||||
$pdf->MultiCell($this->posxprogress-$this->posxworkload, 3, $planned_workload, 0, 'R');
|
$pdf->MultiCell($this->posxprogress-$this->posxworkload, 3, $planned_workload?$planned_workload:'', 0, 'R');
|
||||||
|
// Progress
|
||||||
$pdf->SetXY($this->posxprogress, $curY);
|
$pdf->SetXY($this->posxprogress, $curY);
|
||||||
$pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, $progress, 0, 'R');
|
$pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, $progress, 0, 'R');
|
||||||
|
// Date
|
||||||
$pdf->SetXY($this->posxdatestart, $curY);
|
$pdf->SetXY($this->posxdatestart, $curY);
|
||||||
$pdf->MultiCell($this->posxdateend-$this->posxdatestart, 3, $datestart, 0, 'C');
|
$pdf->MultiCell($this->posxdateend-$this->posxdatestart, 3, $datestart, 0, 'C');
|
||||||
$pdf->SetXY($this->posxdateend, $curY);
|
$pdf->SetXY($this->posxdateend, $curY);
|
||||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxdateend, 3, $dateend, 0, 'C');
|
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxdateend, 3, $dateend, 0, 'C');
|
||||||
|
|
||||||
$pageposafter=$pdf->getPage();
|
|
||||||
|
|
||||||
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
|
|
||||||
$nexY = $pdf->GetY();
|
|
||||||
|
|
||||||
// Add line
|
// Add line
|
||||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
|
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
|
||||||
{
|
{
|
||||||
@@ -274,6 +381,7 @@ class pdf_baleine extends ModelePDFProjects
|
|||||||
$pagenb++;
|
$pagenb++;
|
||||||
$pdf->setPage($pagenb);
|
$pdf->setPage($pagenb);
|
||||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||||
|
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||||
}
|
}
|
||||||
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
|
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
|
||||||
{
|
{
|
||||||
@@ -290,41 +398,30 @@ class pdf_baleine extends ModelePDFProjects
|
|||||||
$pdf->AddPage();
|
$pdf->AddPage();
|
||||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||||
$pagenb++;
|
$pagenb++;
|
||||||
|
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show square
|
// Show square
|
||||||
if ($pagenb == 1)
|
if ($pagenb == 1)
|
||||||
{
|
|
||||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
|
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
|
||||||
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
|
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
|
||||||
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
// Pied de page
|
||||||
* Pied de page
|
$this->_pagefoot($pdf, $object, $outputlangs);
|
||||||
*/
|
if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
|
||||||
$this->_pagefoot($pdf,$object,$outputlangs);
|
|
||||||
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
|
|
||||||
|
|
||||||
$pdf->Close();
|
$pdf->Close();
|
||||||
|
|
||||||
$pdf->Output($file,'F');
|
$pdf->Output($file, 'F');
|
||||||
|
|
||||||
// Add pdfgeneration hook
|
// Add pdfgeneration hook
|
||||||
if (! is_object($hookmanager))
|
|
||||||
{
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
|
||||||
$hookmanager=new HookManager($this->db);
|
|
||||||
}
|
|
||||||
$hookmanager->initHooks(array('pdfgeneration'));
|
$hookmanager->initHooks(array('pdfgeneration'));
|
||||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
$parameters=array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
|
||||||
global $action;
|
global $action;
|
||||||
$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_UMASK))
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||||
@@ -339,10 +436,12 @@ class pdf_baleine extends ModelePDFProjects
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
$this->error=$langs->transnoentities("ErrorConstantNotDefined","LIVRAISON_OUTPUTDIR");
|
{
|
||||||
|
$this->error=$langs->transnoentities("ErrorConstantNotDefined","PROJECT_OUTPUTDIR");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -361,14 +460,17 @@ class pdf_baleine extends ModelePDFProjects
|
|||||||
{
|
{
|
||||||
global $conf,$mysoc;
|
global $conf,$mysoc;
|
||||||
|
|
||||||
|
$heightoftitleline = 10;
|
||||||
|
|
||||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||||
|
|
||||||
$pdf->SetDrawColor(128,128,128);
|
$pdf->SetDrawColor(128,128,128);
|
||||||
|
|
||||||
// Rect prend une longueur en 3eme param
|
// Draw rect of all tab (title + lines). Rect prend une longueur en 3eme param
|
||||||
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
|
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
|
||||||
|
|
||||||
// line prend une position y en 3eme param
|
// line prend une position y en 3eme param
|
||||||
$pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6);
|
$pdf->line($this->marge_gauche, $tab_top+$heightoftitleline, $this->page_largeur-$this->marge_droite, $tab_top+$heightoftitleline);
|
||||||
|
|
||||||
$pdf->SetTextColor(0,0,0);
|
$pdf->SetTextColor(0,0,0);
|
||||||
$pdf->SetFont('','', $default_font_size);
|
$pdf->SetFont('','', $default_font_size);
|
||||||
@@ -390,7 +492,6 @@ class pdf_baleine extends ModelePDFProjects
|
|||||||
|
|
||||||
$pdf->SetXY($this->posxdateend, $tab_top+1);
|
$pdf->SetXY($this->posxdateend, $tab_top+1);
|
||||||
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C');
|
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -447,10 +548,18 @@ class pdf_baleine extends ModelePDFProjects
|
|||||||
$pdf->SetXY($posx,$posy);
|
$pdf->SetXY($posx,$posy);
|
||||||
$pdf->SetTextColor(0,0,60);
|
$pdf->SetTextColor(0,0,60);
|
||||||
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateStart")." : " . dol_print_date($object->date_start,'day',false,$outputlangs,true), '', 'R');
|
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateStart")." : " . dol_print_date($object->date_start,'day',false,$outputlangs,true), '', 'R');
|
||||||
|
|
||||||
$posy+=6;
|
$posy+=6;
|
||||||
$pdf->SetXY($posx,$posy);
|
$pdf->SetXY($posx,$posy);
|
||||||
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : " . dol_print_date($object->date_end,'day',false,$outputlangs,true), '', 'R');
|
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : " . dol_print_date($object->date_end,'day',false,$outputlangs,true), '', 'R');
|
||||||
|
|
||||||
|
if (is_object($object->thirdparty))
|
||||||
|
{
|
||||||
|
$posy+=6;
|
||||||
|
$pdf->SetXY($posx,$posy);
|
||||||
|
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("ThirdParty")." : " . $object->thirdparty->getFullName($outputlangs), '', 'R');
|
||||||
|
}
|
||||||
|
|
||||||
$pdf->SetTextColor(0,0,60);
|
$pdf->SetTextColor(0,0,60);
|
||||||
|
|
||||||
// Add list of linked objects
|
// Add list of linked objects
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Dolibarr language file - Source file is en_US - salaries
|
# Dolibarr language file - Source file is en_US - salaries
|
||||||
SALARIES_ACCOUNTING_ACCOUNT_PAYMENT=Accounting account used for user third parties
|
SALARIES_ACCOUNTING_ACCOUNT_PAYMENT=Accounting account used for user third parties
|
||||||
SALARIES_ACCOUNTING_ACCOUNT_PAYMENT_Desc=The dedicated accounting account defined on user card will be used for Subledger accouting only. This one will be used for General Ledger and as default value of Subledger accounting if dedicated user accouting account on user is not defined.
|
SALARIES_ACCOUNTING_ACCOUNT_PAYMENT_Desc=The dedicated accounting account defined on user card will be used for Subledger accouting only. This one will be used for General Ledger and as default value of Subledger accounting if dedicated user accouting account on user is not defined.
|
||||||
SALARIES_ACCOUNTING_ACCOUNT_CHARGE=Accounting account by default for personnel expenses
|
SALARIES_ACCOUNTING_ACCOUNT_CHARGE=Accounting account by default for wage payments
|
||||||
Salary=Salary
|
Salary=Salary
|
||||||
Salaries=Salaries
|
Salaries=Salaries
|
||||||
NewSalaryPayment=New salary payment
|
NewSalaryPayment=New salary payment
|
||||||
|
|||||||
Reference in New Issue
Block a user