Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 3.9

This commit is contained in:
Laurent Destailleur 2016-01-30 15:29:52 +01:00
commit 5212303208
20 changed files with 1758 additions and 948 deletions

View File

@ -206,7 +206,8 @@ else
print '<td>';
$listmodelcsv=array(
'1'=>$langs->trans("Modelcsv_normal"),
'2'=>$langs->trans("Modelcsv_CEGID")
'2'=>$langs->trans("Modelcsv_CEGID"),
'3'=>$langs->trans("Modelcsv_COALA")
);
print $form->selectarray("modelcsv",$listmodelcsv,$conf->global->ACCOUNTING_EXPORT_MODELCSV,0);

View File

@ -91,7 +91,7 @@ if ($action == "confirm_update") {
$book->sens = 'C';
}
$result = $book->update();
$result = $book->update($user);
if ($result < 0) {
setEventMessages($book->error, $book->errors, 'errors');
} else {
@ -136,7 +136,7 @@ else if ($action == "add") {
$book->sens = 'C';
}
$result = $book->create_std($user);
$result = $book->createStd($user);
if ($result < 0) {
setEventMessages($book->error, $book->errors, 'errors');
} else {
@ -180,7 +180,7 @@ else if ($action == "confirm_create") {
$book->montant = 0;
$result = $book->create_std($user);
$result = $book->createStd($user);
if ($result < 0) {
setEventMessages($book->error, $book->errors, 'errors');
} else {
@ -214,6 +214,18 @@ if ($action == 'create') {
$conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL => $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL
);
$sql = 'SELECT DISTINCT accountancy_journal FROM '.MAIN_DB_PREFIX.'bank_account WHERE clos=0';
$resql=$db->query($sql);
if (!$resql) {
setEventMessages($db->lasterror,null,'errors');
} else {
while ($obj_bank=$db->fetch_object($resql)) {
if (!empty($obj_bank->accountancy_journal)) {
$code_journal_array[$obj_bank->accountancy_journal]=$obj_bank->accountancy_journal;
}
}
}
$book = new BookKeeping($db);
$next_num_mvt = $book->getNextNumMvt();
@ -259,7 +271,7 @@ if ($action == 'create') {
print '</form>';
} else {
$book = new BookKeeping($db);
$result = $book->fetch_per_mvt($piece_num);
$result = $book->fetchPerMvt($piece_num);
if ($result < 0) {
setEventMessages($book->error, $book->errors, 'errors');
}

View File

@ -38,32 +38,150 @@ $page = GETPOST("page");
$sortorder = GETPOST("sortorder");
$sortfield = GETPOST("sortfield");
$action = GETPOST('action', 'alpha');
$search_mvt_num = GETPOST('search_mvt_num', 'int');
$search_doc_type = GETPOST("search_doc_type");
$search_doc_ref = GETPOST("search_doc_ref");
$search_account = GETPOST("search_account");
$search_thirdparty = GETPOST("search_thirdparty");
$search_journal = GETPOST("search_journal");
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt")) {
$action='delbookkeepingyear';
}
if (GETPOST("button_export_csv_x") || GETPOST("button_export_csv")) {
$action='export_csv';
}
$search_accountancy_code = GETPOST("search_accountancy_code");
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
if ($search_accountancy_code_start == - 1) {
$search_accountancy_code_start = '';
}
$search_accountancy_code_end = GETPOST('search_accountancy_code_end', 'alpha');
if ($search_accountancy_code_end == - 1) {
$search_accountancy_code_end = '';
}
$search_accountancy_aux_code = GETPOST("search_accountancy_aux_code");
$search_accountancy_aux_code_start = GETPOST('search_accountancy_aux_code_start', 'alpha');
if ($search_accountancy_aux_code_start == - 1) {
$search_accountancy_aux_code_start = '';
}
$search_accountancy_aux_code_end = GETPOST('search_accountancy_aux_code_end', 'alpha');
if ($search_accountancy_aux_code_end == - 1) {
$search_accountancy_aux_code_end = '';
}
$search_mvt_label = GETPOST('search_mvt_label', 'alpha');
$search_direction = GETPOST('search_direction', 'alpha');
$search_ledger_code = GETPOST('search_ledger_code', 'alpha');
$limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
if ($sortorder == "")
$sortorder = "ASC";
if ($sortfield == "")
$sortfield = "bk.rowid";
$offset = $limit * $page;
$object = new BookKeeping($db);
$formventilation = new FormVentilation($db);
$formother = new FormOther($db);
$form = new Form($db);
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_piece_num = "";
$search_doc_ref = "";
$search_account = "";
$search_thirdparty = "";
$search_journal = "";
$search_mvt_num = '';
$search_doc_type = '';
$search_doc_ref = '';
$search_doc_date = '';
$search_accountancy_code = '';
$search_accountancy_code_start = '';
$search_accountancy_code_end = '';
$search_accountancy_aux_code = '';
$search_accountancy_aux_code_start = '';
$search_accountancy_aux_code_end = '';
$search_mvt_label = '';
$search_direction = '';
$search_ledger_code = '';
$search_date_start = '';
$search_date_end = '';
}
if (empty($search_date_start)) {
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
}
if ($sortorder == "")
$sortorder = "ASC";
if ($sortfield == "")
$sortfield = "t.rowid";
$options = '';
$filter = array ();
if (! empty($search_date_start)) {
$filter['t.doc_date>='] = $search_date_start;
$options .= '&amp;date_startmonth=' . GETPOST('date_startmonth', 'int') . '&amp;date_startday=' . GETPOST('date_startday', 'int') . '&amp;date_startyear=' . GETPOST('date_startyear', 'int');
}
if (! empty($search_date_end)) {
$filter['t.doc_date<='] = $search_date_end;
$options .= '&amp;date_endmonth=' . GETPOST('date_endmonth', 'int') . '&amp;date_endday=' . GETPOST('date_endday', 'int') . '&amp;date_endyear=' . GETPOST('date_endyear', 'int');
}
if (! empty($search_doc_type)) {
$filter['t.doc_type'] = $search_doc_type;
$options .= '&amp;search_doc_type=' . $search_doc_type;
}
if (! empty($search_doc_date)) {
$filter['t.doc_date'] = $search_doc_date;
$options .= '&amp;doc_datemonth=' . GETPOST('doc_datemonth', 'int') . '&amp;doc_dateday=' . GETPOST('doc_dateday', 'int') . '&amp;doc_dateyear=' . GETPOST('doc_dateyear', 'int');
}
if (! empty($search_doc_ref)) {
$filter['t.doc_ref'] = $search_doc_ref;
$options .= '&amp;search_doc_ref=' . $search_doc_ref;
}
if (! empty($search_accountancy_code)) {
$filter['t.numero_compte'] = $search_accountancy_code;
$options .= '&amp;search_accountancy_code=' . $search_accountancy_code;
}
if (! empty($search_accountancy_code_start)) {
$filter['t.numero_compte>='] = $search_accountancy_code_start;
$options .= '&amp;search_accountancy_code_start=' . $search_accountancy_code_start;
}
if (! empty($search_accountancy_code_end)) {
$filter['t.numero_compte<='] = $search_accountancy_code_end;
$options .= '&amp;search_accountancy_code_end=' . $search_accountancy_code_end;
}
if (! empty($search_accountancy_aux_code)) {
$filter['t.code_tiers'] = $search_accountancy_aux_code;
$options .= '&amp;search_accountancy_aux_code=' . $search_accountancy_aux_code;
}
if (! empty($search_accountancy_aux_code_start)) {
$filter['t.code_tiers>='] = $search_accountancy_aux_code_start;
$options .= '&amp;search_accountancy_aux_code_start=' . $search_accountancy_aux_code_start;
}
if (! empty($search_accountancy_aux_code_end)) {
$filter['t.code_tiers<='] = $search_accountancy_aux_code_end;
$options .= '&amp;search_accountancy_aux_code_end=' . $search_accountancy_aux_code_end;
}
if (! empty($search_mvt_label)) {
$filter['t.label_compte'] = $search_mvt_label;
$options .= '&amp;search_mvt_label=' . $search_mvt_label;
}
if (! empty($search_direction)) {
$filter['t.sens'] = $search_direction;
$options .= '&amp;search_direction=' . $search_direction;
}
if (! empty($search_ledger_code)) {
$filter['t.code_journal'] = $search_ledger_code;
$options .= '&amp;search_ledger_code=' . $search_ledger_code;
}
if (! empty($search_mvt_num)) {
$filter['t.piece_num'] = $search_mvt_num;
$options .= '&amp;search_mvt_num=' . $search_mvt_num;
}
/*
* Action
*/
@ -72,96 +190,106 @@ if ($action == 'delbookkeeping') {
$import_key = GETPOST('importkey', 'alpha');
if (! empty($import_key)) {
$object = new BookKeeping($db);
$result = $object->delete_by_importkey($import_key);
Header("Location: list.php");
$result = $object->deleteByImportkey($import_key);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
Header("Location: list.php");
exit();
}
} elseif ($action == 'delbookkeepingyear') {
} elseif ($action == 'delbookkeepingyearconfirm') {
$delyear = GETPOST('delyear', 'int');
if (! empty($delyear)) {
$object = new BookKeeping($db);
$result = $object->delete_by_year($delyear);
Header("Location: list.php");
$result = $object->deleteByYear($delyear);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
} elseif ($action == 'delbookkeepingyear') {
$delyear = GETPOST('delyear', 'int');
if (! empty($delyear)) {
$object = new BookKeeping($db);
$result = $object->delete_by_year($delyear);
Header("Location: list.php");
exit();
}
} elseif ($action == 'delmouvconfirm') {
$mvt_num = GETPOST('mvt_num', 'int');
if (! empty($mvt_num)) {
$result = $object->deleteMvtNum($mvt_num);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
//if (!empty($options)) {
// Header("Location: list.php?".urldecode($options));
//} else {
Header("Location: list.php");
//}
exit();
}
} // Export
else if ($action == 'export_csv') {
} elseif ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$journal = 'bookkepping';
header('Content-Type: text/csv');
header('Content-Disposition: attachment;filename=export_csv.csv');
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
$object = new BookKeeping($db);
$result = $object->export_bookkeping('ebp');
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
// Model classic Export
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
foreach ( $object->linesexport as $line ) {
print '"' . dol_print_date($line->doc_date, '%d%m%Y') . '",';
print '"' . $line->code_journal . '",';
print '"' . $line->numero_compte . '",';
print '"' . substr($line->code_journal, 0, 2) . '",';
print '"' . substr($line->doc_ref, 0, 40) . '",';
print '"' . $line->num_piece . '",';
print '"' . $line->debit . '",';
print '"' . $line->credit . '",';
print '"' . $conf->currency . '",';
foreach ( $object->lines as $line ) {
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
{
$sep = ";";
// Model Cegid Expert Export
$date = dol_print_date($line->doc_date, '%d%m%Y');
print $date . $sep;
print $line->code_journal . $sep;
print length_accountg($line->numero_compte) . $sep;
print ' '. $sep;
print $line->sens . $sep;
print price($line->montant) . $sep;
print dol_trunc($line->label_compte, 32) . $sep;
print $line->doc_ref . $sep;
/*print $line->piece_num . $sep;
print length_accounta($line->code_tiers) . $sep;
print . $sep;
print price($line->debit) . $sep;
print price($line->credit) . $sep;*/
print "\n";
}
}
// Model cegid Export
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
foreach ( $object->linesexport as $line ) {
print $line->id . ',';
print '"' . dol_print_date($line->doc_date, '%d%m%Y') . '",';
print '"' . $line->code_journal . '",';
print '"' . $line->numero_compte . '",';
print '"' . substr($line->code_journal, 0, 2) . '",';
print '"' . substr($line->doc_ref, 0, 40) . '",';
print '"' . $line->num_piece . '",';
print '"' . $line->montant . '",';
print '"' . $line->sens . '",';
print '"' . dol_print_date($line->doc_date, '%d%m%Y') . '",';
print '"' . $conf->currency . '",';
elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
//Std export
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
print $date . $sep;
print $line->doc_ref . $sep;
print length_accounta($line->numero_compte) . $sep;
print length_accountg($line->code_tiers) . $sep;
print price($line->debit) . $sep;
print price($line->credit) . $sep;
/*print $line->piece_num . $sep;
print $line->label_compte . $sep;
print price($line->montant) . $sep;
print $line->sens . $sep;*/
print $line->code_journal . $sep;
print "\n";
}
}
// Model Coala Export
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 3) {
foreach ( $object->linesexport as $line ) {
print $line->id . ',';
print '"' . dol_print_date($line->doc_date, '%d%m%Y') . '",';
print '"' . $line->code_journal . '",';
print '"' . $line->numero_compte . '",';
print '"' . substr($line->code_journal, 0, 2) . '",';
print '"' . substr($line->doc_ref, 0, 40) . '",';
print '"' . $line->num_piece . '",';
print '"' . $line->montant . '",';
print '"' . $line->sens . '",';
print '"' . dol_print_date($line->doc_date, '%d%m%Y') . '",';
print '"' . $conf->currency . '",';
}elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 3) {
//Coala export
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date . $sep;
print $line->code_journal . $sep;
print length_accounta($line->numero_compte) . $sep;
print $line->piece_num . $sep;
print $line->doc_ref . $sep;
print price($line->debit) . $sep;
print price($line->credit) . $sep;
print 'E' . $sep;
print length_accountg($line->code_tiers) . $sep;
print "\n";
}
}
@ -169,156 +297,199 @@ else if ($action == 'export_csv') {
else {
llxHeader('', $langs->trans("Bookkeeping"));
$title_page=$langs->trans("Bookkeeping") .' '. dol_print_date($search_date_start).'-'.dol_print_date($search_date_end);
llxHeader('', $title_page);
/*
* List
*/
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num ";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
if (dol_strlen(trim($search_doc_type))) {
$sql .= " WHERE bk.piece_num LIKE '%" . $search_piece_num . "%'";
if (dol_strlen(trim($search_doc_ref))) {
$sql .= " AND bk.doc_ref LIKE '%" . $search_doc_ref . "%'";
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
if ($nbtotalofrecords < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
if (dol_strlen(trim($search_doc_ref))) {
$sql .= " WHERE bk.doc_ref LIKE '%" . $search_doc_ref . "%'";
}
if (dol_strlen(trim($search_account))) {
$sql .= " WHERE bk.numero_compte LIKE '%" . $search_account . "%'";
}
if (dol_strlen(trim($search_thirdparty))) {
$sql .= " WHERE bk.code_tiers LIKE '%" . $search_thirdparty . "%'";
}
if (dol_strlen(trim($search_journal))) {
$sql .= " WHERE bk.code_journal LIKE '%" . $search_journal . "%'";
$result = $object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit + 1, $offset);
if ($action == 'delmouv') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1);
print $formconfirm;
}
if ($action == 'delbookkeepingyear') {
$form_question=array();
$delyear=GETPOST('delyear');
if (empty($delyear)) {
$delyear=dol_print_date(dol_now(),'%Y');
}
$year_array=$formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear',0,'array');
$form_question['delyear']=array('name'=>'delyear','type'=>'select','label'=>$langs->trans('DelYear'),'values'=>$year_array,'default'=>$delyear);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1);
print $formconfirm;
}
dol_syslog('accountancy/bookkeeping/list.php:: $sql=' . $sql);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords);
/*print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="delbookkeeping">';
print $formventilation->select_bookkeeping_importkey('importkey', GETPOST('importkey'));
print '<div class="inline-block divButAction"><input type="submit" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>';
print '</form>';*/
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
print '<div class="tabsAction">'."\n";
print '<div class="inline-block divButAction"><input type="submit" name="button_delmvt" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>';
print '<a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a>';
//print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=export_csv">' . $langs->trans("Export") . '</a>';
print '<div class="inline-block divButAction"><input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" /></div>';
print '</div>';
/*print '<div class="liste_titre">';
print $langs->trans('DateStart') . ': ';
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
print $langs->trans('DateEnd') . ': ';
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
print '</div>';
print '<div class="liste_titre">';
print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': ';
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': ';
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
print '</div>';
print '<div class="liste_titre">';
print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
print '</div>';*/
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Numerocompte"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "bk_label_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
//print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "t.montant", "", $options, 'align="center"', $sortfield, $sortorder);
//print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "t.sens", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
print "</tr>\n";
print '<tr class="liste_titre">';
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="GET">';
print '<td><input type="text" name="search_mvt_num" size="8" value="' . $search_mvt_num . '"></td>';
print '<td class="liste_titre">';
print $langs->trans('From') . ': ';
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
print '<br>';
print $langs->trans('To') . ': ';
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
//print $form->select_date($search_doc_date, 'doc_date', 0, 0, 1);
print '</td>';
print '<td><input type="text" name="search_doc_ref" size="8" value="' . $search_doc_ref . '"></td>';
print '<td>';
//print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': ';
print $langs->trans('From');
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
//print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': ';
print '<br>';
print $langs->trans('To');
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
print '</td>';
//print '<td><input type="text" name="search_accountancy_code" size="8" value="' . $search_accountancy_code . '"></td>';
print '<td>';
//print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
print $langs->trans('From');
print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
//print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
print '<br>';
print $langs->trans('To');
print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
print '</td>';
//print '<td><input type="text" name="search_accountancy_aux_code" size="8" value="' . $search_accountancy_aux_code . '"></td>';
print '<td class="liste_titre">';
print '<input type="text" size=6 class="flat" name="search_mvt_label" value="'.$search_mvt_label.'"/>';
print '</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
//print '<td>&nbsp;</td>';
//print '<td>&nbsp;</td>';
print '<td align="right"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
print '<td align="right" colspan="2" class="liste_titre">';
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
print '&nbsp;';
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
print '</td>';
print '</tr>';
$var = True;
$total_debit=0;
$total_credit=0;
foreach ( $object->lines as $line ) {
$var = ! $var;
print_barre_liste($langs->trans("Bookkeeping"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num);
$total_debit+=$line->debit;
$total_credit+=$line->credit;
/*print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="delbookkeeping">';
print $formventilation->select_bookkeeping_importkey('importkey', GETPOST('importkey'));
print '<div class="inline-block divButAction"><input type="submit" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>';
print '</form>';*/
print "<tr $bc[$var]>";
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="delbookkeepingyear">';
print $formother->select_year(GETPOST('delyear'), 'delyear');
print '<div class="inline-block divButAction"><input type="submit" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>';
print '</form>';
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="export_csv">';
print '<input type="submit" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
print '</form>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "bk.piece_num", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "bk.doc_date", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "bk.doc_ref", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Numerocompte"), $_SERVER['PHP_SELF'], "bk.numero_compte", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "bk.code_tiers", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "bk_label_compte", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "bk.debit", "", "", 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "bk.credit", "", "", 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "bk.montant", "", "", 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "bk.sens", "", "", 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "bk.code_journal", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
print "</tr>\n";
print '<tr class="liste_titre">';
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="GET">';
print '<td><input type="text" name="search_doc_type" size="8" value="' . $search_piece_num . '"></td>';
print '<td>&nbsp;</td>';
print '<td><input type="text" name="search_doc_ref" size="8" value="' . $search_doc_ref . '"></td>';
print '<td><input type="text" name="search_account" size="8" value="' . $search_account . '"></td>';
print '<td><input type="text" name="search_thirdparty" size="8" value="' . $search_thirdparty . '"></td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td><input type="text" name="search_journal" size="3" value="' . $search_journal . '"></td>';
print '<td align="right" colspan="2" class="liste_titre">';
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
print '&nbsp;';
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
print '<td><a href="./card.php?piece_num=' . $line->piece_num . '">' . $line->piece_num . '</a></td>';
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
print '<td>' . $line->doc_ref . '</td>';
print '<td>' . length_accountg($line->numero_compte) . '</td>';
print '<td>' . length_accounta($line->code_tiers) . '</td>';
print '<td>' . $line->label_compte . '</td>';
print '<td align="right">' . price($line->debit) . '</td>';
print '<td align="right">' . price($line->credit) . '</td>';
//print '<td align="right">' . price($line->montant) . '</td>';
//print '<td align="center">' . $line->sens . '</td>';
print '<td align="right">' . $line->code_journal . '</td>';
print '<td align="center">';
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a>';
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num .$options.'&page='.$page.'">' . img_delete() . '</a>';
print '</td>';
print '</form>';
print '</tr>';
$var = True;
while ( $i < min($num, $conf->liste_limit) ) {
$obj = $db->fetch_object($resql);
$var = ! $var;
print "<tr $bc[$var]>";
/* if ($old_piecenum!=$obj->piece_num) {
$total_debit=0;
$total_credit=0;
} else {
$total_debit+=$obj->debit;
$total_credit+=$obj->credit;
}
*/
print '<td>' . $obj->piece_num . '</td>';
print '<td align="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
print '<td>' . $obj->doc_ref . '</td>';
print '<td>' . length_accountg($obj->numero_compte) . '</td>';
print '<td>' . length_accounta($obj->code_tiers) . '</td>';
print '<td>' . $obj->label_compte . '</td>';
print '<td align="right">' . price($obj->debit) . '</td>';
print '<td align="right">' . price($obj->credit) . '</td>';
print '<td align="right">' . price($obj->montant) . '</td>';
print '<td align="center">' . $obj->sens . '</td>';
print '<td>' . $obj->code_journal . '</td>';
print '<td align="center"><a href="./card.php?piece_num=' . $obj->piece_num . '">' . img_edit() . '</a></td>';
print "</tr>\n";
//$old_piecenum= $obj->piece_num;
$i ++;
}
print "</table>";
print '<div class="tabsAction">';
print '<a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a>';
print '</div>';
$db->free($resql);
} else {
dol_print_error($db);
print "</tr>\n";
}
print '<tr class="liste_total">';
print '<td colspan="6"></td>';
print '<td align="right">';
print price($total_debit);
print '</td>';
print '<td align="right">';
print price($total_credit);
print '</td>';
print '<td colspan="2"></td>';
print '</tr>';
print "</table>";
print '</form>';
llxFooter();
}
$db->close();

View File

@ -19,16 +19,17 @@
*/
/**
* \file htdocs/accountancy/bookkeeping/listbyyear.php
* \ingroup Accounting Expert
* \brief Book keeping by year
* \file htdocs/accountancy/bookkeeping/listbyyear.php
* \ingroup Accounting Expert
* \brief Book keeping by year
*/
require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
// Langs
$langs->load("accountancy");
@ -36,93 +37,255 @@ $langs->load("accountancy");
$page = GETPOST("page");
$sortorder = GETPOST("sortorder");
$sortfield = GETPOST("sortfield");
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
$search_doc_type=GETPOST('search_doc_type','alpha');
$search_doc_date=dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
$search_doc_ref=GETPOST('search_doc_ref','alpha');
$search_numero_compte=GETPOST('search_numero_compte','alpha');
$search_numero_compte_start=GETPOST('search_numero_compte_start','alpha');
if ($search_numero_compte_start==-1) {
$search_numero_compte_start='';
}
$search_numero_compte_end=GETPOST('search_numero_compte_end','alpha');
if ($search_numero_compte_end==-1) {
$search_numero_compte_end='';
}
$search_code_tiers=GETPOST('search_code_tiers','alpha');
$search_code_tiers_start=GETPOST('search_code_tiers_start','alpha');
if ($search_code_tiers_start==-1) {
$search_code_tiers_start='';
}
$search_code_tiers_end=GETPOST('search_code_tiers_end','alpha');
if ($search_code_tiers_end==-1) {
$search_code_tiers_end='';
}
$search_label_compte=GETPOST('search_label_compte','alpha');
$search_sens=GETPOST('search_sens','alpha');
$search_code_journal=GETPOST('search_code_journal','alpha');
$object = new BookKeeping($db);
$form = new Form($db);
$formventilation = new FormVentilation($db);
// Filter
$year = GETPOST("year", 'int');
if ($year == 0) {
$year_current = strftime("%Y", time());
$year_start = $year_current;
} else {
$year_current = $year;
$year_start = $year;
if (empty($search_date_start)) {
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
}
if ($sortorder == "")
$sortorder = "ASC";
if ($sortfield == "")
$sortfield = "bk.rowid";
$sortfield = "t.rowid";
$offset = $limit * $page;
llxHeader('', $langs->trans("Bookkeeping"));
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
$textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_doc_type = "";
$search_doc_date = "";
$search_doc_ref = "";
$search_numero_compte = "";
$search_code_tiers = "";
$search_label_compte = "";
$search_sens = "";
$search_code_journal = "";
}
$options = '';
$filter = array ();
if (! empty($search_date_start)) {
$filter['t.doc_date>='] = $search_date_start;
$options .= '&amp;date_startmonth=' . GETPOST('date_startmonth', 'int') . '&amp;date_startday=' . GETPOST('date_startday', 'int') . '&amp;date_startyear=' . GETPOST('date_startyear', 'int');
}
if (! empty($search_date_end)) {
$filter['t.doc_date<='] = $search_date_end;
$options .= '&amp;date_endmonth=' . GETPOST('date_endmonth', 'int') . '&amp;date_endday=' . GETPOST('date_endday', 'int') . '&amp;date_endyear=' . GETPOST('date_endyear', 'int');
}
if (! empty($search_doc_type)) {
$filter['t.doc_type'] = $search_doc_type;
$options .= '&amp;search_doc_type=' . $search_doc_type;
}
if (! empty($search_doc_date)) {
$filter['t.doc_date'] = $search_doc_date;
$options .= '&amp;doc_datemonth=' . GETPOST('doc_datemonth', 'int') . '&amp;doc_dateday=' . GETPOST('doc_dateday', 'int') . '&amp;doc_dateyear=' . GETPOST('doc_dateyear', 'int');
}
if (! empty($search_doc_ref)) {
$filter['t.doc_ref'] = $search_doc_ref;
$options .= '&amp;search_doc_ref=' . $search_doc_ref;
}
if (! empty($search_numero_compte)) {
$filter['t.numero_compte'] = $search_numero_compte;
$options .= '&amp;search_numero_compte=' . $search_numero_compte;
}
if (! empty($search_numero_compte_start)) {
$filter['t.numero_compte>='] = $search_numero_compte_start;
$options .= '&amp;search_numero_compte_start=' . $search_numero_compte_start;
}
if (! empty($search_numero_compte_end)) {
$filter['t.numero_compte<='] = $search_numero_compte_end;
$options .= '&amp;search_numero_compte_end=' . $search_numero_compte_end;
}
if (! empty($search_code_tiers)) {
$filter['t.code_tiers'] = $search_code_tiers;
$options .= '&amp;search_code_tiers=' . $search_code_tiers;
}
if (! empty($search_code_tiers_start)) {
$filter['t.code_tiers>='] = $search_code_tiers_start;
$options .= '&amp;search_code_tiers_start=' . $search_code_tiers_start;
}
if (! empty($search_code_tiers_end)) {
$filter['t.code_tiers<='] = $search_code_tiers_end;
$options .= '&amp;search_code_tiers_end=' . $search_code_tiers_end;
}
if (! empty($search_label_compte)) {
$filter['t.label_compte'] = $search_label_compte;
$options .= '&amp;search_label_compte=' . $search_label_compte;
}
if (! empty($search_sens)) {
$filter['t.sens'] = $search_sens;
$options .= '&amp;search_sens=' . $search_sens;
}
if (! empty($search_code_journal)) {
$filter['t.code_journal'] = $search_code_journal;
$options .= '&amp;search_code_journal=' . $search_code_journal;
}
/*
* Mode List
*/
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens, bk.code_journal";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
// $sql .= " WHERE bk.doc_date >= '".$db->idate(dol_get_first_day($y,1,false))."'";
// $sql .= " AND bk.doc_date <= '".$db->idate(dol_get_last_day($y,12,false))."'";
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit + 1, $offset);
dol_syslog('accountancy/bookkeeping/listbyyear.php:: $sql=' . $sql);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
print_barre_liste($langs->trans("Bookkeeping") . " $textprevyear " . $langs->trans("Year") . " $year_start $textnextyear", $page, $_SERVER['PHP_SELF'], "", $sortfield, $sortorder, '', $num);
print "<table class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Doctype"), $_SERVER['PHP_SELF'], "bk.doc_type", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Date"), $_SERVER['PHP_SELF'], "bk.doc_date", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "bk.doc_ref", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "bk.numero_compte", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("ThirdPartyAccount"), $_SERVER['PHP_SELF'], "bk.code_tiers", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "bk_label_compte", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "bk.debit", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "bk.credit", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "bk.montant", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "bk.sens", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "bk.code_journal", "", "", "", $sortfield, $sortorder);
print_liste_field_titre('');
print "</tr>\n";
$var = True;
while ( $i < min($num, $conf->liste_limit) ) {
$obj = $db->fetch_object($resql);
$var = ! $var;
print "<tr $bc[$var]>";
print '<td>' . $obj->doc_type . '</td>' . "\n";
print '<td>' . dol_print_date($db->jdate($obj->doc_date)) . '</td>';
print '<td>' . $obj->doc_ref . '</td>';
print '<td>' . length_accountg($obj->numero_compte) . '</td>';
print '<td>' . length_accounta($obj->code_tiers) . '</td>';
print '<td>' . $obj->label_compte . '</td>';
print '<td align="right">' . price($obj->debit) . '</td>';
print '<td align="right">' . price($obj->credit) . '</td>';
print '<td align="right">' . price($obj->montant) . '</td>';
print '<td>' . $obj->sens . '</td>';
print '<td>' . $obj->code_journal . '</td>';
print '<td><a href="./card.php?action=update&id=' . $obj->rowid . '">' . img_edit() . '</a></td>';
print "</tr>\n";
$i ++;
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0);
if ($nbtotalofrecords < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
print "</table>";
$db->free($resql);
} else {
dol_print_error($db);
}
$result = $object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
print_barre_liste($langs->trans("Bookkeeping") .' '. dol_print_date($search_date_start).'-'.dol_print_date($search_date_end), $page, $_SERVER['PHP_SELF'], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords);
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
print '<div class="liste_titre">';
print $langs->trans('DateStart') . ': ';
print $form->select_date($search_date_start, 'date_start');
print $langs->trans('DateEnd') . ': ';
print $form->select_date($search_date_end, 'date_end');
print '</div>';
print '<div class="liste_titre">';
print $langs->trans('From').' '.$langs->trans('AccountAccounting') . ': ';
print $formventilation->select_account($search_numero_compte_start,'search_numero_compte_start', 1, array (), 1, 1,'');
print $langs->trans('To').' '.$langs->trans('AccountAccounting') . ': ';
print $formventilation->select_account($search_numero_compte_end,'search_numero_compte_end', 1, array (), 1, 1,'');
print '</div>';
print '<div class="liste_titre">';
print $langs->trans('From').' '.$langs->trans('ThirdPartyAccount') . ': ';
print $formventilation->select_auxaccount($search_code_tiers_start,'search_code_tiers_start', 1);
print $langs->trans('To').' '.$langs->trans('ThirdPartyAccount') . ': ';
print $formventilation->select_auxaccount($search_code_tiers_end,'searchcode_tiers_end', 1);
print '</div>';
print "<table class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Doctype"), $_SERVER['PHP_SELF'], "t.doc_type", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Date"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("ThirdPartyAccount"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "t.montant", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "t.sens", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, "", $sortfield, $sortorder);
print '<th class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '"></td>';
print "</tr>\n";
print '<tr class="liste_titre">';
print '<td class="liste_titre">';
print '<input type="text" size=4 class="flat" name="search_piece_num" value="'.$search_piece_num.'"/>';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" size=7 class="flat" name="search_doc_type" value="'.$search_doc_type.'"/>';
print '</td>';
print '<td class="liste_titre">';
print $form->select_date($search_doc_date,'doc_date',0, 0, 1);
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" size=6 class="flat" name="search_doc_ref" value="'.$search_doc_ref.'"/>';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" size=6 class="flat" name="search_numero_compte" value="'.$search_numero_compte.'"/>';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" size=6 class="flat" name="search_code_tiers" value="'.$search_code_tiers.'"/>';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" size=6 class="flat" name="search_label_compte" value="'.$search_label_compte.'"/>';
print '</td>';
print '<td class="liste_titre">';
print '</td>';
print '<td class="liste_titre">';
print '</td>';
print '<td class="liste_titre">';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" size=2 class="flat" name="search_sens" value="'.$search_sens.'"/>';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" size=3 class="flat" name="search_code_journal" value="'.$search_code_journal.'"/>';
print '</td>';
print '<td class="liste_titre">';
print '</td>';
print "</tr>\n";
$var = True;
foreach ( $object->lines as $line ) {
$var = ! $var;
print "<tr $bc[$var]>";
print '<td>' . $line->piece_num . '</td>' . "\n";
print '<td>' . $line->doc_type . '</td>' . "\n";
print '<td>' . dol_print_date($line->doc_date) . '</td>';
print '<td>' . $line->doc_ref . '</td>';
print '<td>' . length_accountg($line->numero_compte) . '</td>';
print '<td>' . length_accounta($line->code_tiers) . '</td>';
print '<td>' . $line->label_compte . '</td>';
print '<td align="right">' . price($line->debit) . '</td>';
print '<td align="right">' . price($line->credit) . '</td>';
print '<td align="right">' . price($line->montant) . '</td>';
print '<td>' . $line->sens . '</td>';
print '<td>' . $line->code_journal . '</td>';
print '<td><a href="./card.php?action=update&amp;piece_num=' . $line->piece_num . '">' . img_edit() . '</a></td>';
print "</tr>\n";
}
print "</table>";
print '</form>';
llxFooter();
$db->close();

View File

@ -30,6 +30,11 @@
*/
class AccountingAccount extends CommonObject
{
var $db;
var $error;
var $errors;
var $id;
var $rowid;
var $datec; // Creation date

File diff suppressed because it is too large Load Diff

View File

@ -37,8 +37,7 @@ class FormVentilation extends Form
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
public function __construct($db) {
$this->db = $db;
}
@ -49,8 +48,7 @@ class FormVentilation extends Form
* @param string $selectedkey Value
* @return string HTML edit field
*/
function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey='')
{
function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '') {
$sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping';
$sql .= ' ORDER BY import_key DESC';
@ -94,12 +92,11 @@ class FormVentilation extends Form
* @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
* @param int $aabase set accountingaccount base class to display empty=all or from 1 to 8 will display only account beginning by
*
* @return string String with HTML select
*/
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '')
{
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') {
global $conf;
$out = '';
@ -128,10 +125,14 @@ class FormVentilation extends Form
$obj = $this->db->fetch_object($resql);
$label = $obj->account_number . ' - ' . $obj->label;
$label = dol_trunc($label, $trunclength);
if ($select_in == 0 ) $select_value_in = $obj->rowid;
if ($select_in == 1 ) $select_value_in = $obj->account_number;
if ($select_out == 0 ) $select_value_out = $obj->rowid;
if ($select_out == 1 ) $select_value_out = $obj->account_number;
if ($select_in == 0)
$select_value_in = $obj->rowid;
if ($select_in == 1)
$select_value_in = $obj->account_number;
if ($select_out == 0)
$select_value_out = $obj->rowid;
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) {
@ -164,8 +165,7 @@ class FormVentilation extends Form
*
* @return string String with HTML select
*/
function select_pcgtype($selectid, $htmlname = 'pcg_type', $showempty = 0, $event = array())
{
function select_pcgtype($selectid, $htmlname = 'pcg_type', $showempty = 0, $event = array()) {
global $conf;
$out = '';
@ -220,8 +220,7 @@ class FormVentilation extends Form
*
* @return string String with HTML select
*/
function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array())
{
function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array()) {
global $conf;
$out = '';
@ -342,4 +341,66 @@ class FormVentilation extends Form
return $out;
}
/**
* Return HTML combo list of years existing into book keepping
*
* @param string $selected Preselected value
* @param string $htmlname Name of HTML select object
* @param int $useempty Affiche valeur vide dans liste
* @param string $output_format (html/opton (for option html only)/array (to return options arrays
* @return string/array
*/
function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html') {
$out = '';
$out_array = array ();
if ($output_format == 'html') {
$out .= '<select class="flat" placeholder="aa" id="' . $htmlname . '" name="' . $htmlname . '"' . $option . ' >';
}
if ($useempty) {
$selected_html = '';
if ($selected == '') {
$selected_html = ' selected';
}
if ($output_format == 'html' || $output_format == 'options') {
$out .= '<option value=""' . $selected_html . '>&nbsp;</option>';
} elseif ($output_format == 'array') {
$out_array[''] = '';
}
}
$sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
$sql .= " ORDER BY doc_date";
dol_syslog(get_class($this) . "::".__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
while ( $obj = $this->db->fetch_object($resql) ) {
$selected_html = '';
if ($selected > 0 && $obj->dtyear == $selected)
$selected_html = ' selected';
if ($output_format == 'html' || $output_format == 'options') {
$out .= '<option value="' . $obj->dtyear . '"' . $selected_html . ' >' . $obj->dtyear . '</option>';
} elseif ($output_format == 'array') {
$out_array[$obj->dtyear] = $obj->dtyear;
}
}
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::".__METHOD__ . $this->error, LOG_ERR);
return - 1;
}
$this->db->free($resql);
if ($output_format == 'html') {
$out .= "</select>\n";
}
if ($output_format == 'html' || $output_format == 'options') {
return $out;
} elseif ($output_format == 'array') {
return $out_array;
}
}
}

View File

@ -238,7 +238,7 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="8" name="search_amount" value="' . $search_amount. '"></td>';
print '<td class="liste_titre" align="center">%<input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '">%</td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
print '<td class="liste_titre" colspan="2">&nbsp;</td>';
print '<td class="liste_titre" align="center"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -149,7 +149,7 @@ if ($action == 'ventil' && !empty($btn_ventil)) {
dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
if ($db->query($sql)) {
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>';
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>';
} else {
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '<br/> <pre>' . $sql . '</pre></font></div>';
}
@ -228,6 +228,9 @@ if ($result) {
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
print '<br><b>' . $langs->trans("DescVentilTodoCustomer") . '</b></br>';
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef", "", $param, '', $sortfield, $sortorder);
print '&nbsp;&nbsp;';
print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
print '<input type="hidden" name="action" value="ventil">';
@ -254,7 +257,7 @@ if ($result) {
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" align="right"><input type="text" class="flat" size="10" name="search_amount" value="' . $search_amount . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '">%</td>';
print '<td align="right" class="liste_titre" colspan="4">';
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
print '&nbsp;';

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
*
@ -343,7 +343,7 @@ if ($action == 'writebookkeeping')
}
}
$result = $bookkeeping->create();
$result = $bookkeeping->create($user);
if ($result < 0) {
$error ++;
setEventMessages($object->error, $object->errors, 'errors');
@ -421,7 +421,7 @@ if ($action == 'writebookkeeping')
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
}
$result = $bookkeeping->create();
$result = $bookkeeping->create($user);
if ($result < 0) {
$error ++;
setEventMessages($object->error, $object->errors, 'errors');
@ -571,7 +571,7 @@ else
llxHeader('', $langs->trans("FinanceJournal"));
$nom = $langs->trans("FinanceJournal" . ' - ' . $journal);
$nom = $langs->trans("FinanceJournal") . ' - ' . $journal;
$builddate = time();
$description = $langs->trans("DescFinanceJournal") . '<br>';
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);

View File

@ -182,7 +182,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
$bookkeeping->fk_user_author = $user->id;
$result = $bookkeeping->create();
$result = $bookkeeping->create($user);
if ($result < 0) {
$error ++;
setEventMessages($object->error, $object->errors, 'errors');
@ -212,7 +212,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
$bookkeeping->fk_user_author = $user->id;
$result = $bookkeeping->create();
$result = $bookkeeping->create($user);
if ($result < 0) {
$error ++;
setEventMessages($object->error, $object->errors, 'errors');
@ -243,7 +243,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
$bookkeeping->fk_user_author = $user->id;
$result = $bookkeeping->create();
$result = $bookkeeping->create($user);
if ($result < 0) {
$error ++;
setEventMessages($object->error, $object->errors, 'errors');

View File

@ -217,7 +217,7 @@ if ($action == 'writebookkeeping')
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
$bookkeeping->fk_user_author = $user->id;
$result = $bookkeeping->create();
$result = $bookkeeping->create($user);
if ($result < 0) {
$error ++;
setEventMessages($object->error, $object->errors, 'errors');
@ -247,7 +247,7 @@ if ($action == 'writebookkeeping')
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
$bookkeeping->fk_user_author = $user->id;
$result = $bookkeeping->create();
$result = $bookkeeping->create($user);
if ($result < 0) {
$error ++;
setEventMessages($object->error, $object->errors, 'errors');
@ -279,7 +279,7 @@ if ($action == 'writebookkeeping')
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
$bookkeeping->fk_user_author = $user->id;
$result = $bookkeeping->create();
$result = $bookkeeping->create($user);
if ($result < 0) {
$error ++;
setEventMessages($object->error, $object->errors, 'errors');
@ -531,6 +531,7 @@ if ($action == 'export_csv')
print "</table>";
// End of page
llxFooter();
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -225,7 +225,7 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="8" name="search_amount" value="' . $search_amount . '"></td>';
print '<td class="liste_titre" align="center">%<input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '">%</td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
print '<td class="liste_titre" colspan="2">&nbsp;</td>';
print '<td class="liste_titre" align="center"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
@ -168,7 +168,6 @@ if ($action == 'ventil' && !empty($btn_ventil)) {
/*
* Supplier Invoice Lines
*
*/
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
@ -252,11 +251,11 @@ if ($result) {
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_invoice" value="' . $search_invoice . '"></td>';
print '<td class="liste_titre">%<input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" 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" align="right"><input type="text" class="flat" size="10" name="search_amount" value="' . $search_amount . '"></td>';
print '<td class="liste_titre" align="center">%<input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '">%</td>';
print '<td class="liste_titre" align="center">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td align="right" colspan="2" class="liste_titre">';

View File

@ -422,6 +422,7 @@ if ($resql)
$notshippable=0;
$warning = 0;
$text_info='';
$text_warning='';
$nbprod=0;
$numlines = count($generic_commande->lines); // Loop on each line of order

View File

@ -913,33 +913,92 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{
$langs->load("accountancy");
$newmenu->add("/accountancy/customer/index.php?leftmenu=ventil_customer",$langs->trans("CustomersVentilation"),0,$user->rights->accounting->ventilation->read, '', $mainmenu, 'ventil_customer');
if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/customer/list.php",$langs->trans("ToDispatch"),1,$user->rights->accounting->ventilation->dispatch);
if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/customer/lines.php",$langs->trans("Dispatched"),1,$user->rights->accounting->ventilation->read);
$permtoshowmenu=(! empty($conf->accounting->enabled) || $user->rights->accounting->ventilation->read || $user->rights->accounting->ventilation->dispatch || $user->rights->compta->resultat->lire);
$newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy",$langs->trans("MenuAccountancy"), 0, $permtoshowmenu, '', $mainmenu, 'accountancy');
// Dispatch
$newmenu->add("/accountancy/customer/index.php?leftmenu=dispatch_customer&amp;mainmenu=accountancy",$langs->trans("CustomersVentilation"),1,$user->rights->accounting->ventilation->read, '', $mainmenu, 'dispatch_customer');
if (empty($leftmenu) || $leftmenu=="dispatch_customer") $newmenu->add("/accountancy/customer/list.php",$langs->trans("ToDispatch"),2,$user->rights->accounting->ventilation->dispatch);
if (empty($leftmenu) || $leftmenu=="dispatch_customer") $newmenu->add("/accountancy/customer/lines.php",$langs->trans("Dispatched"),2,$user->rights->accounting->ventilation->read);
if (! empty($conf->fournisseur->enabled))
{
$newmenu->add("/accountancy/supplier/index.php?leftmenu=ventil_supplier",$langs->trans("SuppliersVentilation"),0,$user->rights->accounting->ventilation->read, '', $mainmenu, 'ventil_supplier');
if (empty($leftmenu) || $leftmenu=="ventil_supplier") $newmenu->add("/accountancy/supplier/list.php",$langs->trans("ToDispatch"),1,$user->rights->accounting->ventilation->dispatch);
if (empty($leftmenu) || $leftmenu=="ventil_supplier") $newmenu->add("/accountancy/supplier/lines.php",$langs->trans("Dispatched"),1,$user->rights->accounting->ventilation->read);
$newmenu->add("/accountancy/supplier/index.php?leftmenu=dispatch_supplier&amp;mainmenu=accountancy",$langs->trans("SuppliersVentilation"),1,$user->rights->accounting->ventilation->read, '', $mainmenu, 'dispatch_supplier');
if (empty($leftmenu) || $leftmenu=="dispatch_supplier") $newmenu->add("/accountancy/supplier/list.php",$langs->trans("ToDispatch"),2,$user->rights->accounting->ventilation->dispatch);
if (empty($leftmenu) || $leftmenu=="dispatch_supplier") $newmenu->add("/accountancy/supplier/lines.php",$langs->trans("Dispatched"),2,$user->rights->accounting->ventilation->read);
}
// Journals
if(! empty($conf->accounting->enabled) && ! empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy')
{
$newmenu->add('',$langs->trans("Journaux"),1,$user->rights->accounting->comptarapport->lire);
$sql = "SELECT rowid, label, accountancy_journal";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
$sql.= " WHERE entity = ".$conf->entity;
$sql.= " AND clos = 0";
$sql.= " ORDER BY label";
$resql = $db->query($sql);
if ($resql)
{
$numr = $db->num_rows($resql);
$i = 0;
if ($numr > 0)
while ($i < $numr)
{
$objp = $db->fetch_object($resql);
$newmenu->add('/accountancy/journal/bankjournal.php?id_account='.$objp->rowid,$langs->trans("Journal").' - '.$objp->label,2,$user->rights->accounting->comptarapport->lire);
$i++;
}
}
else dol_print_error($db);
$db->free($resql);
// Add other journal
$newmenu->add("/accountancy/journal/sellsjournal.php?leftmenu=journal",$langs->trans("SellsJournal"),2,$user->rights->accounting->comptarapport->lire);
$newmenu->add("/accountancy/journal/purchasesjournal.php?leftmenu=journal",$langs->trans("PurchasesJournal"),2,$user->rights->accounting->comptarapport->lire);
}
// General Ledger
$newmenu->add("/accountancy/bookkeeping/list.php?leftmenu=bookkeeping",$langs->trans("Bookkeeping"),1,$user->rights->accounting->mouvements->lire, '', $mainmenu, 'bookkeeping');
if (empty($leftmenu) || preg_match('/bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/listbyyear.php",$langs->trans("ByYear"),2,$user->rights->accounting->mouvements->lire);
if (empty($leftmenu) || preg_match('/bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/balancebymonth.php",$langs->trans("AccountBalanceByMonth"),2,$user->rights->accounting->mouvements->lire);
// Reports
$langs->load("compta");
$newmenu->add("/compta/resultat/index.php?leftmenu=report&amp;mainmenu=accountancy",$langs->trans("Reportings"),1,$user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca');
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/resultat/index.php?leftmenu=report",$langs->trans("ReportInOut"),2,$user->rights->accounting->comptarapport->lire);
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire);
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/index.php?leftmenu=report",$langs->trans("ReportTurnover"),2,$user->rights->accounting->comptarapport->lire);
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire);
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=report",$langs->trans("ByUsers"),3,$user->rights->accounting->comptarapport->lire);
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report", $langs->trans("ByProductsAndServices"),3,$user->rights->accounting->comptarapport->lire);
// Admin
$langs->load("admin");
$newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy", $langs->trans("Fiscalyear"),1,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear');
$newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy", $langs->trans("Chartofaccounts"),1,$user->rights->accounting->chartofaccount, '', $mainmenu, 'chartofaccount');
}
// Rapports
if (! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled))
// Comptabilite
if (! empty($conf->comptabilite->enabled))
{
$langs->load("compta");
// Bilan, resultats
$newmenu->add("/compta/resultat/index.php?leftmenu=report&amp;mainmenu=accountancy",$langs->trans("Reportings"),0,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca');
$newmenu->add("/compta/resultat/index.php?leftmenu=report&amp;mainmenu=accountancy",$langs->trans("Reportings"),0,$user->rights->compta->resultat->lire, '', $mainmenu, 'ca');
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/resultat/index.php?leftmenu=report",$langs->trans("ReportInOut"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=report",$langs->trans("ByCompanies"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/resultat/index.php?leftmenu=report",$langs->trans("ReportInOut"),1,$user->rights->compta->resultat->lire);
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=report",$langs->trans("ByCompanies"),2,$user->rights->compta->resultat->lire);
/* On verra ca avec module compabilite expert
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/resultat/compteres.php?leftmenu=report","Compte de resultat",2,$user->rights->compta->resultat->lire);
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/resultat/bilan.php?leftmenu=report","Bilan",2,$user->rights->compta->resultat->lire);
*/
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/index.php?leftmenu=report",$langs->trans("ReportTurnover"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/index.php?leftmenu=report",$langs->trans("ReportTurnover"),1,$user->rights->compta->resultat->lire);
/*
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/cumul.php?leftmenu=report","Cumule",2,$user->rights->compta->resultat->lire);
@ -948,74 +1007,14 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/comp.php?leftmenu=report","Transforme",2,$user->rights->compta->resultat->lire);
}
*/
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=report",$langs->trans("ByCompanies"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=report",$langs->trans("ByUsers"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report", $langs->trans("ByProductsAndServices"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=report",$langs->trans("ByCompanies"),2,$user->rights->compta->resultat->lire);
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=report",$langs->trans("ByUsers"),2,$user->rights->compta->resultat->lire);
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report", $langs->trans("ByProductsAndServices"),2,$user->rights->compta->resultat->lire);
if (! empty($conf->comptabilite->enabled))
{
// Journaux
//if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journaux"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
//journaux
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report",$langs->trans("SellsJournal"),1,$user->rights->compta->resultat->lire);
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=report",$langs->trans("PurchasesJournal"),1,$user->rights->compta->resultat->lire);
}
// Report expert
if (! empty($conf->accounting->enabled))
{
$langs->load("accountancy");
// Grand livre
$newmenu->add("/accountancy/bookkeeping/list.php?leftmenu=bookkeeping",$langs->trans("Bookkeeping"),0,$user->rights->accounting->mouvements->lire, '', $mainmenu, 'bookkeeping');
if (empty($leftmenu) || preg_match('/bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/listbyyear.php",$langs->trans("ByYear"),1,$user->rights->accounting->mouvements->lire);
if (empty($leftmenu) || preg_match('/bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/balancebymonth.php",$langs->trans("AccountBalanceByMonth"),1,$user->rights->accounting->mouvements->lire);
// Accountancy journals
if (! empty($conf->accounting->enabled) && !empty($user->rights->accounting->mouvements->lire) && $mainmenu == 'accountancy')
{
$newmenu->add('/accountancy/journal/index.php?leftmenu=journal',$langs->trans("Journaux"),0,$user->rights->banque->lire);
if ($leftmenu == 'journal')
{
$sql = "SELECT rowid, label, accountancy_journal";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
$sql.= " WHERE entity = ".$conf->entity;
$sql.= " AND clos = 0";
$sql.= " ORDER BY label";
$resql = $db->query($sql);
if ($resql)
{
$numr = $db->num_rows($resql);
$i = 0;
if ($numr > 0)
while ($i < $numr)
{
$objp = $db->fetch_object($resql);
$newmenu->add('/accountancy/journal/bankjournal.php?id_account='.$objp->rowid,$langs->trans("Journal").' - '.$objp->label,1,$user->rights->accounting->comptarapport->lire);
$i++;
}
}
else dol_print_error($db);
$db->free($resql);
// Add other journal
$newmenu->add("/accountancy/journal/sellsjournal.php?leftmenu=journal",$langs->trans("SellsJournal"),1,$user->rights->accounting->comptarapport->lire);
$newmenu->add("/accountancy/journal/purchasesjournal.php?leftmenu=journal",$langs->trans("PurchasesJournal"),1,$user->rights->accounting->comptarapport->lire);
}
}
}
}
// Setup
if (! empty($conf->accounting->enabled))
{
$langs->load("admin");
$newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy", $langs->trans("Fiscalyear"),0,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear');
$newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy", $langs->trans("Chartofaccounts"),0,$user->rights->accounting->chartofaccount, '', $mainmenu, 'chartofaccount');
// Journaux
//if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journaux"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report",$langs->trans("SellsJournal"),1,$user->rights->compta->resultat->lire);
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=report",$langs->trans("PurchasesJournal"),1,$user->rights->compta->resultat->lire);
}
}

View File

@ -370,7 +370,7 @@ class ExpenseReport extends CommonObject
function set_paid($id, $fuser)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."expensereport";
$sql.= " SET fk_statut = 6";
$sql.= " SET fk_statut = 6, paid=1";
$sql.= " WHERE rowid = ".$id." AND fk_statut = 5";
dol_syslog(get_class($this)."::set_paid sql=".$sql, LOG_DEBUG);

View File

@ -35,6 +35,7 @@ AccountAccounting=Accounting account
AccountAccountingSuggest=Accounting account suggest
Ventilation=Breakdown
MenuAccountancy=Accountancy
CustomersVentilation=Breakdown customers
SuppliersVentilation=Breakdown suppliers
TradeMargin=Trade margin
@ -109,10 +110,6 @@ DelBookKeeping=Delete the records of the general ledger
DescSellsJournal=Sales journal
DescPurchasesJournal=Purchases journal
BankJournal=Bank journal
DescBankJournal=Bank journal including all the types of payments other than cash
CashJournal=Cash journal
DescCashJournal=Cash journal including the type of payment cash
FinanceJournal=Finance journal
DescFinanceJournal=Finance journal including all the types of payments by bank account

View File

@ -12,6 +12,7 @@
* Copyright (C) 2014 Henry Florian <florian.henry@open-concept.pro>
* Copyright (C) 2014 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2014 Ion agorria <ion@agorria.com>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -1673,7 +1674,7 @@ class Product extends CommonObject
$sql.= " WHERE entity IN (".getEntity('productprice', 1).")";
$sql.= " AND price_level=".$i;
$sql.= " AND fk_product = '".$this->id."'";
$sql.= " ORDER BY date_price, rowid DESC";
$sql.= " ORDER BY date_price DESC, rowid DESC";
$sql.= " LIMIT 1";
$resql = $this->db->query($sql);
if ($resql)

View File

@ -7,6 +7,7 @@
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2014 Ion Agorria <ion@agorria.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -46,7 +47,7 @@ $rowid=GETPOST('rowid','int');
$action=GETPOST('action', 'alpha');
$cancel=GETPOST('cancel', 'alpha');
$socid=GETPOST('socid', 'int');
$cost_price=GETPOST('cost_price', 'int');
$cost_price=GETPOST('cost_price', 'alpha');
$backtopage=GETPOST('backtopage','alpha');
$error=0;