";
}
- echo "
Document ";
+ echo "
Document ";
echo '
';
$x='';
if ($access=='W')
@@ -477,7 +479,7 @@ case 'save':
alert( "Changement impossible: on ne peut pas changer la date dans une période fermée");
}
$html=ob_get_contents();
- ob_clean();
+ ob_end_clean();
break;
/////////////////////////////////////////////////////////////////////////////
@@ -525,7 +527,7 @@ case 'reverseop':
}
}
$html=ob_get_contents();
- ob_clean();
+ ob_end_clean();
break;
}
$html=escape_xml($html);
diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index 005168a18..18b290036 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -21,7 +21,7 @@
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-/* !\file
+/**\file
* \brief this file respond to an ajax request
* The parameters are
* - gDossier
@@ -323,14 +323,33 @@ EOF;
$line.=td($max->input());
$r.=tr($line);
+ $date_error="";
// start date
$start = new IDate('search_start');
- $start->value = (isset($search_start)) ? $search_start : $first_per->first_day();
+ /* check if date are valid */
+ if (isset($search_start) && isDate($search_start) == null)
+ {
+ ob_start();
+ alert(_('Date malformée'));
+ $date_error = ob_get_contents();
+ ob_end_clean();
+ $search_start=$first_per->first_day();
+ }
+ $start->value = (isset($search_start)) ? $search_start : $first_per->first_day();
$line = td('Date Debut') . td($start->input());
// end date
$end = new IDate('search_end');
+ /* check if date are valid */
+ if (isset($search_end) && isDate($search_end) == null)
+ {
+ ob_start();
+ alert(_('Date malformée'));
+ $date_error = ob_get_contents();
+ ob_end_clean();
+ $search_end=$last_per->last_day();
+ }
$end->value = (isset($search_end)) ? $search_end : $last_per->last_day();
$line.=td('Date Fin') . td($end->input());
$r.=tr($line);
@@ -396,27 +415,7 @@ EOF;
$form.=HtmlInput::hidden('sb', $_REQUEST['sb']);
if (isset($_REQUEST['f_id']))
$form.=HtmlInput::hidden('f_id', $_REQUEST['f_id']);
- /* check if date are valid */
- if ((isset($search_end) && isDate($search_end) == null) ||
- (isset($search_start) && isDate($search_start) == null))
- {
- ob_start();
- alert(_('Date malformée, désolé'));
- $html = ob_get_contents();
- ob_clean();
- $html = escape_xml($html);
-
- header('Content-type: text/xml; charset=UTF-8');
- echo <<
-
-detail
-$html
-
-EOF;
- exit();
- }
// display a list of operation from the other side + box button
if ($ot == 'account')
@@ -458,7 +457,9 @@ EOF;
$form.=HtmlInput::submit('record', _('Sauver')) . $ret->input();
$form.='';
$form.='
';
+
$html = $r . $form;
+ $html.=$date_error;
// echo $html;exit;
$html = escape_xml($html);
@@ -501,6 +502,9 @@ EOF;
case 'add_menu':
require_once 'ajax_add_menu.php';
break;
+ case 'cardsearch':
+ require_once 'ajax_boxcard_search.php';
+ break;
case 'add_plugin':
$me_code = new IText('me_code');
$me_file = new IText('me_file');
@@ -561,6 +565,9 @@ EOF;
case 'fddetail':
require_once 'ajax_fiche_def_detail.php';
break;
+ case 'vw_action':
+ require_once 'ajax_view_action.php';
+ break;
default:
var_dump($_GET);
}
diff --git a/html/ajax_poste.php b/html/ajax_poste.php
index 5641ab5e1..cb808da20 100644
--- a/html/ajax_poste.php
+++ b/html/ajax_poste.php
@@ -62,7 +62,7 @@ include_once ("class_user.php");
global $g_user;
$g_user=new User($cn);
$g_user->Check();
-if ($g_user->get_folder_access(dossier::id()) == 'X') exit();
+if ($g_user->check_dossier(dossier::id()) == 'X') exit();
$xml="";
switch ($op)
@@ -88,7 +88,7 @@ case "sf":
ob_start();
require_once('template/account_search.php');
$r.=ob_get_contents();
- ob_clean();
+ ob_end_clean();
$r.=dossier::hidden();
$r.=(isset ($c))?HtmlInput::hidden('account',$c):"";
$r.=(isset ($l))?HtmlInput::hidden('label',$l):"";
@@ -163,7 +163,7 @@ case "sf":
require_once('template/account_result.php');
$r.=ob_get_contents();
- ob_clean();
+ ob_end_clean();
$html=$r;
break;
diff --git a/html/do.php b/html/do.php
index dbed6bcb8..2948fa2d7 100644
--- a/html/do.php
+++ b/html/do.php
@@ -21,7 +21,7 @@
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-/* !\file
+/**\file
* \brief Main file
*/
require_once 'class_database.php';
diff --git a/html/document/fr_be/bnb.form b/html/document/fr_be/bnb.form
index 0c30bd0b1..a869337ff 100644
--- a/html/document/fr_be/bnb.form
+++ b/html/document/fr_be/bnb.form
@@ -1,147 +1,147 @@
# Les postesg*(-1)
- $C10=round([10%S],2)*(-1)
- $C100=round([100%S],2)*(-1)
- $C101=round([101%S],2)
- $C11=round([11%S],2)*(-1)
- $C12=round([12%S],2)*(-1)
- $C13=round([13%S],2)*(-1)
- $C130=round([130%S],2)*(-1)
- $C131=round([131%S],2)*(-1)
- $C1310=round([1310%S],2)*(-1)
- $C1311=round([1311%S],2)*(-1)
- $C132=round([132%S],2)*(-1)
- $C133=round([133%S],2)*(-1)
- $C14=round([14%S],2)*(-1)
- $C140=round([140%S],2)*(-1)
- $C141=round([141%S],2)
- $C15=round([15%S],2)*(-1)
- $C16=round([16%S],2)*(-1)
- $C160=round([160%S],2)*(-1)
- $C161=round([161%S],2)*(-1)
- $C162=round([162%S],2)*(-1)
- $C163=round([163%S],2)*(-1)
- $C164=round([164%S],2)*(-1)
- $C165=round([165%S],2)*(-1)
- $C168=round([168%S],2)*(-1)
-$C17=round([17%S],2)*(-1)
- $C170=round([170%S],2)*(-1)
- $C171=round([171%S],2)*(-1)
- $C172=round([172%S],2)*(-1)
- $C173=round([173%S],2)*(-1)
- $C174=round([174%S],2)*(-1)
- $C175=round([175%S],2)*(-1)
- $C176=round([176%S],2)*(-1)
- $C178=round([178%S],2)*(-1)
- $C179=round([179%S],2)*(-1)
-$C2=round([2%S],2)*(-1)
- $C20=round([20%S],2)
- $C21=round([21%S],2)
- $C22=round([22%S],2)
- $C23=round([23%S],2)
- $C24=round([24%S],2)
- $C25=round([25%S],2)
- $C26=round([26%S],2)
- $C27=round([27%S],2)
- $C28=round([28%S],2)
- $C29=round([29%S],2)
- $C290=round([290%S],2)
- $C291=round([291%S],2)
-$C3=round([3%S],2)
- $C30=round([30%S],2)
- $C31=round([31%S],2)
- $C32=round([32%S],2)
- $C33=round([33%S],2)
- $C34=round([34%S],2)
- $C35=round([35%S],2)
- $C36=round([36%S],2)
- $C37=round([37%S],2)
- $C40=round([40%S],2)
- $C41=round([41%S],2)
- $C42=round([42%S],2)*(-1)
- $C43=round([43%S],2)*(-1)
- $C439=round([439%S],2)*(-1)
- $C44=round([44%S],2)*(-1)
- $C440=round([440%S],2)*(-1)
- $C441=round([441%S],2)*(-1)
- $C444=round([444%S],2)*(-1)
- $C45=round([45%S],2)*(-1)
- $C450=round([450%S],2)*(-1)
- $C451=round([451%S],2)*(-1)
- $C452=round([452%S],2)*(-1)
- $C453=round([453%S],2)*(-1)
- $C454=round([454%S],2)*(-1)
-$C455=round([455%S],2)*(-1)
-$C456=round([456%S],2)*(-1)
-$C457=round([457%S],2)*(-1)
-$C458=round([458%S],2)*(-1)
- $C459=round([459%S],2)*(-1)
- $C46=round([46%S],2)
- $C47=round([47%S],2)*(-1)
- $C48=round([48%S],2)*(-1)
- $C49=round([49%S],2)
- $C490=round([490%S],2)
- $C491=round([491%S],2)
- $C492=round([492%S],2)*(-1)
- $C493=round([493%S],2)*(-1)
- $C50=round([50%S],2)
- $C51=round([51%S],2)
- $C52=round([52%S],2)
- $C53=round([53%S],2)
- $C54=round([54%S],2)
- $C55=round([55%S],2)
- $C56=round([56%S],2)
- $C57=round([57%S],2)
- $C58=round([58%S],2)
- $C60=round([60%S],2)
- $C61=round([61%S],2)
- $C62=round([62%S],2)
- $C63=round([63%S],2)
-$C630=round([630%S],2)
-$C631=round([631%S],2)
-$C632=round([632%S],2)
-$C633=round([633%S],2)
-$C634=round([634%S],2)
-$C635=round([635%S],2)
-$C636=round([636%S],2)
-$C637=round([637%S],2)
+ $C10=round([10%s],2)*(-1)
+ $C100=round([100%s],2)*(-1)
+ $C101=round([101%s],2)
+ $C11=round([11%s],2)*(-1)
+ $C12=round([12%s],2)*(-1)
+ $C13=round([13%s],2)*(-1)
+ $C130=round([130%s],2)*(-1)
+ $C131=round([131%s],2)*(-1)
+ $C1310=round([1310%s],2)*(-1)
+ $C1311=round([1311%s],2)*(-1)
+ $C132=round([132%s],2)*(-1)
+ $C133=round([133%s],2)*(-1)
+ $C14=round([14%s],2)*(-1)
+ $C140=round([140%s],2)*(-1)
+ $C141=round([141%s],2)
+ $C15=round([15%s],2)*(-1)
+ $C16=round([16%s],2)*(-1)
+ $C160=round([160%s],2)*(-1)
+ $C161=round([161%s],2)*(-1)
+ $C162=round([162%s],2)*(-1)
+ $C163=round([163%s],2)*(-1)
+ $C164=round([164%s],2)*(-1)
+ $C165=round([165%s],2)*(-1)
+ $C168=round([168%s],2)*(-1)
+$C17=round([17%s],2)*(-1)
+ $C170=round([170%s],2)*(-1)
+ $C171=round([171%s],2)*(-1)
+ $C172=round([172%s],2)*(-1)
+ $C173=round([173%s],2)*(-1)
+ $C174=round([174%s],2)*(-1)
+ $C175=round([175%s],2)*(-1)
+ $C176=round([176%s],2)*(-1)
+ $C178=round([178%s],2)*(-1)
+ $C179=round([179%s],2)*(-1)
+$C2=round([2%s],2)*(-1)
+ $C20=round([20%s],2)
+ $C21=round([21%s],2)
+ $C22=round([22%s],2)
+ $C23=round([23%s],2)
+ $C24=round([24%s],2)
+ $C25=round([25%s],2)
+ $C26=round([26%s],2)
+ $C27=round([27%s],2)
+ $C28=round([28%s],2)
+ $C29=round([29%s],2)
+ $C290=round([290%s],2)
+ $C291=round([291%s],2)
+$C3=round([3%s],2)
+ $C30=round([30%s],2)
+ $C31=round([31%s],2)
+ $C32=round([32%s],2)
+ $C33=round([33%s],2)
+ $C34=round([34%s],2)
+ $C35=round([35%s],2)
+ $C36=round([36%s],2)
+ $C37=round([37%s],2)
+ $C40=round([40%s],2)
+ $C41=round([41%s],2)
+ $C42=round([42%s],2)*(-1)
+ $C43=round([43%s],2)*(-1)
+ $C439=round([439%s],2)*(-1)
+ $C44=round([44%s],2)*(-1)
+ $C440=round([440%s],2)*(-1)
+ $C441=round([441%s],2)*(-1)
+ $C444=round([444%s],2)*(-1)
+ $C45=round([45%s],2)*(-1)
+ $C450=round([450%s],2)*(-1)
+ $C451=round([451%s],2)*(-1)
+ $C452=round([452%s],2)*(-1)
+ $C453=round([453%s],2)*(-1)
+ $C454=round([454%s],2)*(-1)
+$C455=round([455%s],2)*(-1)
+$C456=round([456%s],2)*(-1)
+$C457=round([457%s],2)*(-1)
+$C458=round([458%s],2)*(-1)
+ $C459=round([459%s],2)*(-1)
+ $C46=round([46%s],2)
+ $C47=round([47%s],2)*(-1)
+ $C48=round([48%s],2)*(-1)
+ $C49=round([49%s],2)
+ $C490=round([490%s],2)
+ $C491=round([491%s],2)
+ $C492=round([492%s],2)*(-1)
+ $C493=round([493%s],2)*(-1)
+ $C50=round([50%s],2)
+ $C51=round([51%s],2)
+ $C52=round([52%s],2)
+ $C53=round([53%s],2)
+ $C54=round([54%s],2)
+ $C55=round([55%s],2)
+ $C56=round([56%s],2)
+ $C57=round([57%s],2)
+ $C58=round([58%s],2)
+ $C60=round([60%s],2)
+ $C61=round([61%s],2)
+ $C62=round([62%s],2)
+ $C63=round([63%s],2)
+$C630=round([630%s],2)
+$C631=round([631%s],2)
+$C632=round([632%s],2)
+$C633=round([633%s],2)
+$C634=round([634%s],2)
+$C635=round([635%s],2)
+$C636=round([636%s],2)
+$C637=round([637%s],2)
- $C649=round([649%S],2)*(-1)
- $C64=round([64%S],2)
+ $C649=round([649%s],2)*(-1)
+ $C64=round([64%s],2)
- $C65=round([65%S],2)
- $C66=round([66%S],2)
- $C67=round([67%S],2)
- $C68=round([68%S],2)
- $C680=round([680%S],2)
-$C689=round([689%S],2)
- $C69=round([69%S],2)
- $C690=round([690%S],2)
- $C691=round([691%S],2)
- $C692=round([692%S],2)
- $C6920=round([6920%S],2)
- $C6921=round([6921%S],2)
- $C693=round([693%S],2)
- $C694=round([694%S],2)
- $C695=round([695%S],2)
- $C696=round([696%S],2)
+ $C65=round([65%s],2)
+ $C66=round([66%s],2)
+ $C67=round([67%s],2)
+ $C68=round([68%s],2)
+ $C680=round([680%s],2)
+$C689=round([689%s],2)
+ $C69=round([69%s],2)
+ $C690=round([690%s],2)
+ $C691=round([691%s],2)
+ $C692=round([692%s],2)
+ $C6920=round([6920%s],2)
+ $C6921=round([6921%s],2)
+ $C693=round([693%s],2)
+ $C694=round([694%s],2)
+ $C695=round([695%s],2)
+ $C696=round([696%s],2)
-$C7=round([7%S],2)*(-1)
- $C70=round([70%S],2)*(-1)
- $C71=round([71%S],2)*(-1)
- $C73=round([73%S],2)*(-1)
- $C72=round([72%S],2)*(-1)
- $C74=round([74%S],2)*(-1)
- $C75=round([75%S],2)*(-1)
- $C76=round([76%S],2)*(-1)
- $C77=round([77%S],2)*(-1)
-$C780=round([780%S],2)*(-1)
-$C789=round([789%S],2)*(-1)
- $C79=round([79%S],2)*(-1)
-$C790=round([790%S],2)*(-1)
-$C791=round([791%S],2)*(-1)
-$C792=round([792%S],2)*(-1)
-$C793=round([793%S],2)*(-1)
-$C794=round([794%S],2)*(-1)
+$C7=round([7%s],2)*(-1)
+ $C70=round([70%s],2)*(-1)
+ $C71=round([71%s],2)*(-1)
+ $C73=round([73%s],2)*(-1)
+ $C72=round([72%s],2)*(-1)
+ $C74=round([74%s],2)*(-1)
+ $C75=round([75%s],2)*(-1)
+ $C76=round([76%s],2)*(-1)
+ $C77=round([77%s],2)*(-1)
+$C780=round([780%s],2)*(-1)
+$C789=round([789%s],2)*(-1)
+ $C79=round([79%s],2)*(-1)
+$C790=round([790%s],2)*(-1)
+$C791=round([791%s],2)*(-1)
+$C792=round([792%s],2)*(-1)
+$C793=round([793%s],2)*(-1)
+$C794=round([794%s],2)*(-1)
# Les formules (*-1)
#
$S1=abs($C2-$C29)
diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js
index 47a540ff3..e0e7fe82b 100644
--- a/html/js/acc_ledger.js
+++ b/html/js/acc_ledger.js
@@ -324,6 +324,7 @@ function compute_ledger(p_ctl_nb)
a=trim(g("e_march"+p_ctl_nb+'_tva_amount').value);
g("e_march"+p_ctl_nb+'_tva_amount').value=a;
}
+ if ( ! document.getElementById("e_march"+p_ctl_nb)) {return;}
g("e_march"+p_ctl_nb).value=trim(g("e_march"+p_ctl_nb).value);
var qcode=g("e_march"+p_ctl_nb).value;
@@ -375,12 +376,12 @@ function refresh_ledger()
for (var i=0;i
.nicEdit-main p { margin: 0; } to your HTML
+ Add class="sortable" to any table you'd like to make sortable
+ Click on the headers to sort
+
+ Thanks to many, many people for contributions and suggestions.
+ Licenced as X11: http://www.kryogenix.org/code/browser/licence.html
+ This basically means: do what you want with it.
+
+@note
+Documentation http://www.kryogenix.org/code/browser/sorttable/
+
+Show the default order
+example:
+
+.... ▴
+
+.... ▾
+
+Sort on date
+ // format YYYYMMDD
+
+force as numeric (normally useless):
+ Part number
+
+To avoid the sort on the last row, use tfoot
+
+*/
+
+
+var stIsIE = /*@cc_on!@*/false;
+
+sorttable = {
+ init: function() {
+ // quit if this function has already been called
+ if (arguments.callee.done) return;
+ // flag this function so we don't do the same thing twice
+ arguments.callee.done = true;
+ // kill the timer
+ if (_timer) clearInterval(_timer);
+
+ if (!document.createElement || !document.getElementsByTagName) return;
+
+ sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;
+
+ forEach(document.getElementsByTagName('table'), function(table) {
+ if (table.className.search(/\bsortable\b/) != -1) {
+ sorttable.makeSortable(table);
+ }
+ });
+
+ },
+
+ makeSortable: function(table) {
+ if (table.getElementsByTagName('thead').length == 0) {
+ // table doesn't have a tHead. Since it should have, create one and
+ // put the first table row in it.
+ the = document.createElement('thead');
+ the.appendChild(table.rows[0]);
+ table.insertBefore(the,table.firstChild);
+ }
+ // Safari doesn't support table.tHead, sigh
+ if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0];
+
+ if (table.tHead.rows.length != 1) return; // can't cope with two header rows
+
+ // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as
+ // "total" rows, for example). This is B&R, since what you're supposed
+ // to do is put them in a tfoot. So, if there are sortbottom rows,
+ // for backwards compatibility, move them to tfoot (creating it if needed).
+ sortbottomrows = [];
+ for (var i=0; i5' : ' ▴';
+ this.appendChild(sortrevind);
+ return;
+ }
+ if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) {
+ // if we're already sorted by this column in reverse, just
+ // re-reverse the table, which is quicker
+ sorttable.reverse(this.sorttable_tbody);
+ this.className = this.className.replace('sorttable_sorted_reverse',
+ 'sorttable_sorted');
+ this.removeChild(document.getElementById('sorttable_sortrevind'));
+ sortfwdind = document.createElement('span');
+ sortfwdind.id = "sorttable_sortfwdind";
+ sortfwdind.innerHTML = stIsIE ? ' 6 ' : ' ▾';
+ this.appendChild(sortfwdind);
+ return;
+ }
+
+ // remove sorttable_sorted classes
+ theadrow = this.parentNode;
+ forEach(theadrow.childNodes, function(cell) {
+ if (cell.nodeType == 1) { // an element
+ cell.className = cell.className.replace('sorttable_sorted_reverse','');
+ cell.className = cell.className.replace('sorttable_sorted','');
+ }
+ });
+ sortfwdind = document.getElementById('sorttable_sortfwdind');
+ if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); }
+ sortrevind = document.getElementById('sorttable_sortrevind');
+ if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); }
+
+ this.className += ' sorttable_sorted';
+ sortfwdind = document.createElement('span');
+ sortfwdind.id = "sorttable_sortfwdind";
+ sortfwdind.innerHTML = stIsIE ? ' 6 ' : ' ▾';
+ this.appendChild(sortfwdind);
+
+ // build an array to sort. This is a Schwartzian transform thing,
+ // i.e., we "decorate" each row with the actual sort key,
+ // sort based on the sort keys, and then put the rows back in order
+ // which is a lot faster because you only do getInnerText once per row
+ row_array = [];
+ col = this.sorttable_columnindex;
+ rows = this.sorttable_tbody.rows;
+ for (var j=0; j 12) {
+ // definitely dd/mm
+ return sorttable.sort_ddmm;
+ } else if (second > 12) {
+ return sorttable.sort_mmdd;
+ } else {
+ // looks like a date, but we can't tell which, so assume
+ // that it's dd/mm (English imperialism!) and keep looking
+ sortfn = sorttable.sort_ddmm;
+ }
+ }
+ }
+ }
+ return sortfn;
+ },
+
+ getInnerText: function(node) {
+ // gets the text we want to use for sorting for a cell.
+ // strips leading and trailing whitespace.
+ // this is *not* a generic getInnerText function; it's special to sorttable.
+ // for example, you can override the cell text with a customkey attribute.
+ // it also gets .value for fields.
+
+ if (!node) return "";
+
+ hasInputs = (typeof node.getElementsByTagName == 'function') &&
+ node.getElementsByTagName('input').length;
+
+ if (node.getAttribute("sorttable_customkey") != null) {
+ return node.getAttribute("sorttable_customkey");
+ }
+ else if (typeof node.textContent != 'undefined' && !hasInputs) {
+ return node.textContent.replace(/^\s+|\s+$/g, '');
+ }
+ else if (typeof node.innerText != 'undefined' && !hasInputs) {
+ return node.innerText.replace(/^\s+|\s+$/g, '');
+ }
+ else if (typeof node.text != 'undefined' && !hasInputs) {
+ return node.text.replace(/^\s+|\s+$/g, '');
+ }
+ else {
+ switch (node.nodeType) {
+ case 3:
+ if (node.nodeName.toLowerCase() == 'input') {
+ return node.value.replace(/^\s+|\s+$/g, '');
+ }
+ case 4:
+ return node.nodeValue.replace(/^\s+|\s+$/g, '');
+ break;
+ case 1:
+ case 11:
+ var innerText = '';
+ for (var i = 0; i < node.childNodes.length; i++) {
+ innerText += sorttable.getInnerText(node.childNodes[i]);
+ }
+ return innerText.replace(/^\s+|\s+$/g, '');
+ break;
+ default:
+ return '';
+ }
+ }
+ },
+
+ reverse: function(tbody) {
+ // reverse the rows in a tbody
+ newrows = [];
+ for (var i=0; i=0; i--) {
+ tbody.appendChild(newrows[i]);
+ }
+ delete newrows;
+ },
+
+ /* sort functions
+ each sort function takes two parameters, a and b
+ you are comparing a[0] and b[0] */
+ sort_numeric: function(a,b) {
+ aa = parseFloat(a[0].replace(/[^0-9.-]/g,''));
+ if (isNaN(aa)) aa = 0;
+ bb = parseFloat(b[0].replace(/[^0-9.-]/g,''));
+ if (isNaN(bb)) bb = 0;
+ return aa-bb;
+ },
+ sort_alpha: function(a,b) {
+ if (a[0]==b[0]) return 0;
+ if (a[0] 0 ) {
+ var q = list[i]; list[i] = list[i+1]; list[i+1] = q;
+ swap = true;
+ }
+ } // for
+ t--;
+
+ if (!swap) break;
+
+ for(var i = t; i > b; --i) {
+ if ( comp_func(list[i], list[i-1]) < 0 ) {
+ var q = list[i]; list[i] = list[i-1]; list[i-1] = q;
+ swap = true;
+ }
+ } // for
+ b++;
+
+ } // while(swap)
+ }
+}
+
+/* ******************************************************************
+ Supporting functions: bundled here to avoid depending on a library
+ ****************************************************************** */
+
+// Dean Edwards/Matthias Miller/John Resig
+
+/* for Mozilla/Opera9 */
+if (document.addEventListener) {
+ document.addEventListener("DOMContentLoaded", sorttable.init, false);
+}
+
+/* for Internet Explorer */
+/*@cc_on @*/
+/*@if (@_win32)
+ document.write("';
+ echo '';
}
+ if (!isset($_POST['e_date']) && $g_parameter->MY_DATE_SUGGEST=='Y')
+ {
+ echo create_script(" get_last_date()");
+ }
exit();
diff --git a/include/config_file.php b/include/config_file.php
index 0852707cf..6199328a2 100644
--- a/include/config_file.php
+++ b/include/config_file.php
@@ -147,7 +147,7 @@ function config_file_create($p_array,$from_setup=1,$os=1)
fputs($hFile, 'define ("phpcompta_psql_host","127.0.0.1");');
fputs($hFile,"\r\n");
- fputs($hFile, 'define ("locale",'.$clocale.');');
+ fputs($hFile, 'define ("LOCALE",'.$clocale.');');
fputs($hFile,"\r\n");
fputs($hFile, 'define ("domaine","");');
diff --git a/include/constant.php b/include/constant.php
index ee7c108a3..604495f0c 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -47,7 +47,7 @@ define ("SITE_UPDATE",'http://www.phpcompta.eu/last_version.txt');
define ("SITE_UPDATE_PLUGIN",'http://www.phpcompta.eu/plugin_last_version.txt');
-define ("DBVERSION",103);
+define ("DBVERSION",106);
define ("DBVERSIONREPO",14);
define ('NOTFOUND','--not found--');
@@ -55,9 +55,13 @@ define ('NOTFOUND','--not found--');
define ("MAX_COMPTE",4);
define ('MAX_ARTICLE',12);
define ('MAX_CAT',15);
+define ('MAX_CARD_SEARCH',50);
define ('MAX_FORECAST_ITEM',10);
define ('MAX_PREDEFINED_OPERATION',30);
define ('MAX_COMPTE_CARD',4);
+define ('COMPTA_MAX_YEAR',2100);
+define ('COMPTA_MIN_YEAR',1990);
+define ('MAX_RECONCILE',25);
if ( DEBUG ) error_reporting(2147483647); else error_reporting(0);
// Erreur
diff --git a/include/contact.inc.php b/include/contact.inc.php
index 5ce60e6bf..72bed0e68 100644
--- a/include/contact.inc.php
+++ b/include/contact.inc.php
@@ -18,7 +18,7 @@
*/
/* $Revision$ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-/* !\brief include from client.inc.php and concerned only the contact card and
+/**\brief include from client.inc.php and concerned only the contact card and
* the contact category
*/
require_once("class_iselect.php");
@@ -30,7 +30,7 @@ require_once('class_fiche_def.php');
$low_action = (isset($_REQUEST['sb'])) ? $_REQUEST['sb'] : "list";
-/* ! \file
+/** \file
* \brief Called from the module "Gestion" to manage the contact
*/
$href=basename($_SERVER['PHP_SELF']);
diff --git a/include/doc_state.inc.php b/include/doc_state.inc.php
index 6d567b504..195e99f47 100644
--- a/include/doc_state.inc.php
+++ b/include/doc_state.inc.php
@@ -32,10 +32,17 @@ if ( isset($_POST['add']))
{
if (trim ($_POST['s_value'])!="")
{
- $cn->exec_sql('insert into document_state(s_value) values ($1)',array($_POST['s_value']));
+ if ( isset($_POST['s_state']))
+ {
+ $cn->exec_sql('insert into document_state(s_value,s_status) values ($1,$2)',array($_POST['s_value'],'C'));
+ }
+ else
+ {
+ $cn->exec_sql('insert into document_state(s_value) values ($1)',array($_POST['s_value']));
+ }
}
}
-$a_stat=$cn->get_array("select s_value from document_state order by 1");
+$a_stat=$cn->get_array("select s_value,s_status from document_state order by 1");
?>
@@ -45,10 +52,20 @@ $a_stat=$cn->get_array("select s_value from document_state order by 1");
=h($a_stat[$i]['s_value'])?>
+
+
+ if ($a_stat[$i]['s_status']=='C') { echo _("Ferme l'action"); } ?>
+
endfor;?>
+Ajout d'un état
\ No newline at end of file
diff --git a/include/dossier.inc.php b/include/dossier.inc.php
index 2901a755c..ef230c8da 100644
--- a/include/dossier.inc.php
+++ b/include/dossier.inc.php
@@ -195,22 +195,32 @@ if ( $sa == 'list' )
echo " ".
$Dossier['dos_id']." ".h($Dossier['dos_name'])." ";
$str_name=domaine.'dossier'.$Dossier['dos_id'];
- $size=$repocn->get_value("select pg_database_size($1)/(1024*1024)::float",
- array($str_name));
- echo " ".h($Dossier['dos_description'])." ";
- echo td(nbm($size)."MB",' style="text-align:right"');
+ echo " ".h($Dossier['dos_description'])." ";
+
+ $database_exist=$repocn->exist_database($str_name);
+
+ if ($database_exist > 0 )
+ {
+ $size=$repocn->get_value("select pg_database_size($1)/(1024*1024)::float",
+ array($str_name));
+ echo td(nbm($size)."MB",' style="text-align:right"');
+ } else {
+ echo td(_("Dossier inexistant"),'style="color:red"');
+ }
echo td($str_name);
echo "";
- echo td(HtmlInput::button_anchor(_('Effacer'),'?action=dossier_mgt&sa=del&d='.$Dossier['dos_id']));
+ if ( $database_exist > 0)
+ {
+ echo td(HtmlInput::button_anchor(_('Effacer'),'?action=dossier_mgt&sa=del&d='.$Dossier['dos_id']));
- echo td(HtmlInput::button_anchor(_('Modifier'),'?action=dossier_mgt&sa=mod&d='
- .$Dossier['dos_id']));
-
- echo td(HtmlInput::button_anchor(_('Backup'),'backup.php?action=backup&sa=b&t=d&d='
- .$Dossier['dos_id']));
- echo ' ';
+ echo td(HtmlInput::button_anchor(_('Modifier'),'?action=dossier_mgt&sa=mod&d='
+ .$Dossier['dos_id']));
+ echo td(HtmlInput::button_anchor(_('Backup'),'backup.php?action=backup&sa=b&t=d&d='
+ .$Dossier['dos_id']));
+ echo '';
+ }
echo '';
$compteur++;
diff --git a/include/export_balance_pdf.php b/include/export_balance_pdf.php
index 1186d362f..972141e71 100644
--- a/include/export_balance_pdf.php
+++ b/include/export_balance_pdf.php
@@ -215,7 +215,7 @@ if (! empty($array))
$pdf->Cell(20,6,nbm($tp_sold),'T',0,'R',0);
$pdf->Cell(20,6,nbm($tp_solc),'T',0,'R',0);
$pdf->Ln();
- } // if ! empty
+ } /** empty */
$fDate=date('dmy-Hi');
$pdf->Output('balance-'.$fDate.'.pdf','D');
diff --git a/include/export_fiche_balance_csv.php b/include/export_fiche_balance_csv.php
index ee28014f7..e7ce54a01 100644
--- a/include/export_fiche_balance_csv.php
+++ b/include/export_fiche_balance_csv.php
@@ -133,7 +133,7 @@ else
/* skip if nothing to display */
if (count($letter->content) == 0)
continue;
- printf('"%s"'."\n",$row->strAttribut(ATTR_DEF_QUICKCODE), $row->strAttribut(ATTR_DEF_NAME));
+ printf('"%s";"%s"'."\n",$row->strAttribut(ATTR_DEF_QUICKCODE), $row->strAttribut(ATTR_DEF_NAME));
printf('"%s";"%s";"%s";"%s";"%s";"%s";"%s";"%s";"%s"',
_('Date'),
@@ -175,7 +175,7 @@ else
printf ("%s;\"%s\";",abs(nb($prog)),$fic->get_amount_side($prog));
if ($row['letter'] != -1)
{
- printf('"%s";',$row['letter']);
+ printf('"%s";', strtoupper(base_convert($row['letter'],10,36)));
printf("%s",nb($row['letter_diff']));
}
else
diff --git a/include/export_fiche_balance_pdf.php b/include/export_fiche_balance_pdf.php
index d8478393e..02676b464 100644
--- a/include/export_fiche_balance_pdf.php
+++ b/include/export_fiche_balance_pdf.php
@@ -120,11 +120,11 @@ if ( $_GET['histo'] == 4 || $_GET['histo']==5)
$side='';
if(bcsub($solde['credit'],$solde['debit']) < 0) $side='Deb.';
if(bcsub($solde['credit'],$solde['debit']) > 0) $side='Cred.';
-
+
$sum_cred=bcadd($sum_cred,$solde['credit']);
$sum_deb=bcadd($sum_deb,$solde['debit']);
$sum_solde=bcsub($sum_deb,$sum_cred);
-
+
$pdf->Cell(30,7,$oCard->strAttribut(ATTR_DEF_QUICKCODE),0,0,'L',$fill);
$pdf->Cell(80,7,$oCard->strAttribut(ATTR_DEF_NAME),0,0,'L',$fill);
$pdf->Cell(20,7,nbm($solde['debit']),0,0,'R',$fill);
@@ -140,7 +140,7 @@ if ( $_GET['histo'] == 4 || $_GET['histo']==5)
$pdf->Cell(20,7,nbm($sum_cred),0,0,'R',$fill);
$pdf->Cell(20,7,nbm(abs($sum_solde)),0,0,'R',$fill);
$side=" = ";
- if ( $sum_solde > 0 )
+ if ( $sum_solde > 0 )
{
$side='Deb.';
}
@@ -148,7 +148,7 @@ if ( $_GET['histo'] == 4 || $_GET['histo']==5)
{
$side='Cred.';
}
-
+
$pdf->Cell(20,7,$side,0,0,'C',$fill);
$pdf->Ln();
}
@@ -210,7 +210,7 @@ else
continue;
$pdf->SetFont('DejaVuCond', '', 10);
$fiche = new Fiche($cn, $row_fiche['f_id']);
- $pdf->Cell(0, 7, $fiche->strAttribut(ATTR_DEF_NAME), 1, 1, 'C');
+ $pdf->Cell(0, 7, $fiche->strAttribut(ATTR_DEF_NAME)." [".$fiche->strAttribut(ATTR_DEF_QUICKCODE)."]", 1, 1, 'C');
$pdf->SetFont('DejaVuCond', '', 7);
@@ -265,7 +265,7 @@ else
}
if ($row['letter'] != -1)
{
- $pdf->Cell($tab[6], 4, $row['letter'], 0, 0, $align[6], $fill);
+ $pdf->Cell($tab[6], 4, strtoupper(base_convert($row['letter'],10,36)), 0, 0, $align[6], $fill);
// get sum for this lettering
$pdf->Cell($tab[7], 4, sprintf('%s', nbm($row['letter_diff'])), '0', '0', $align[7], $fill);
diff --git a/include/export_fiche_detail_csv.php b/include/export_fiche_detail_csv.php
index 1ae3453d6..73953813d 100644
--- a/include/export_fiche_detail_csv.php
+++ b/include/export_fiche_detail_csv.php
@@ -74,7 +74,7 @@ if ( ! isset ($_REQUEST['oper_detail']))
nb($op['deb_montant']).";".
nb($op['cred_montant']).";".
nb(abs($progress)).';'.
- '"'.(($op['letter']==-1)?'':$op['letter']).'"';
+ '"'.(($op['letter']==-1)?'':strtoupper(base_convert($op['letter'],10,36))).'"';
printf("\n");
}
diff --git a/include/export_fiche_detail_pdf.php b/include/export_fiche_detail_pdf.php
index 24a04b143..d2ef620cd 100644
--- a/include/export_fiche_detail_pdf.php
+++ b/include/export_fiche_detail_pdf.php
@@ -107,7 +107,7 @@ for ($e=0;$eLongLine($size[$l],6,($row['description'].'('.$row['jr_internal'].")"),0,$align[$l]);
$l++;
- $pdf->Cell($size[$l],6,(($row['letter']!=-1)?$row['letter']:''),0,0,$align[$l]);
+ $pdf->Cell($size[$l],6,(($row['letter']!=-1)?strtoupper(base_convert($row['letter'],10,36)):''),0,0,$align[$l]);
$l++;
$pdf->Cell($size[$l],6,(sprintf('% 12.2f',$row['deb_montant'])),0,0,$align[$l]);
$l++;
diff --git a/include/export_fiche_pdf.php b/include/export_fiche_pdf.php
index 0a37ead2c..bde7fcd86 100644
--- a/include/export_fiche_pdf.php
+++ b/include/export_fiche_pdf.php
@@ -197,7 +197,7 @@ else
}
if ($row['letter'] != -1 )
{
- $pdf->Cell($tab[5],4,$row['letter'],0,0,$align[5],$fill);
+ $pdf->Cell($tab[5],4,strtoupper(base_convert($row['letter'],10,36)),0,0,$align[5],$fill);
// get sum for this lettering
$sql="select sum(j_montant) from jrnx where j_debit=$1 and j_id in ".
" (select j_id from jnt_letter join letter_deb using (jl_id) where jl_id=$2 union ".
diff --git a/include/export_histo_csv.php b/include/export_histo_csv.php
index 3ef3e28e2..ee1cf3085 100644
--- a/include/export_histo_csv.php
+++ b/include/export_histo_csv.php
@@ -43,7 +43,7 @@ printf('"%s";',"Piece");
printf('"%s";',"Tiers");
printf('"%s";',"Description");
printf('"%s";',"Note");
-printf('"%s"',"Montant");
+printf('"%s"',"Montant opération");
printf("\r\n");
for ($i=0;$iget_value("select qf_amount from quant_fin where jr_id=$1",array($res[$i]['jr_id']));
- if ( $positive !='' ) $amount=$positive;
+ $positive = $cn->get_value("select qf_amount from quant_fin where jr_id=$1",array($res[$i]['jr_id']));
+ if ( $positive !='' ) $amount=$positive;
}
-
printf('%s',nb($amount));
printf("\r\n");
diff --git a/include/export_poste_detail_csv.php b/include/export_poste_detail_csv.php
index 0a2a4feb6..2e6e7464f 100644
--- a/include/export_poste_detail_csv.php
+++ b/include/export_poste_detail_csv.php
@@ -25,10 +25,10 @@ include_once("ac_common.php");
require_once('class_database.php');
require_once("class_acc_account_ledger.php");
require_once ('class_acc_operation.php');
-
+$fDate=date('dmy-Hi');
header('Pragma: public');
header('Content-type: application/csv');
-header('Content-Disposition: attachment;filename="poste.csv"',FALSE);
+header('Content-Disposition: attachment;filename="poste-'.$fDate.'-'.$_REQUEST['poste_id'].'.csv"',FALSE);
require_once('class_dossier.php');
$gDossier=dossier::id();
@@ -68,7 +68,8 @@ if ( ! isset ($_REQUEST['oper_detail']))
"\"Description\";".
"\"Débit\";".
"\"Crédit\";".
- "\"Prog.\"";
+ "\"Prog.\";".
+ "\"Let.\"";
printf("\n");
$prog=0;
@@ -84,7 +85,8 @@ if ( ! isset ($_REQUEST['oper_detail']))
'"'.$op['description'].'";'.
nb($op['deb_montant']).";".
nb($op['cred_montant']).";".
- nb(abs($prog));
+ nb(abs($prog)).";".
+ (($op['letter']!=-1)?strtoupper(base_convert($op['letter'],10,36)):"");
printf("\n");
@@ -109,7 +111,8 @@ else
$Poste=new Acc_Account_Ledger($cn,$pos['pcm_val']);
$Poste->get_name();
list($array,$tot_deb,$tot_cred)=$Poste->get_row_date( $_REQUEST['from_periode'],
- $_REQUEST['to_periode']
+ $_REQUEST['to_periode'],
+ $_GET['ople']
);
if ( count($Poste->row ) == 0 )
continue;
diff --git a/include/export_poste_detail_pdf.php b/include/export_poste_detail_pdf.php
index c5f7deb04..48641827f 100644
--- a/include/export_poste_detail_pdf.php
+++ b/include/export_poste_detail_pdf.php
@@ -198,5 +198,5 @@ foreach ($a_poste as $poste)
}
$fDate=date('dmy-Hi');
-$pdf->Output('poste-'.$fDate.'.pdf','D');
+$pdf->Output('poste-'.$fDate.'-'.$poste_id.'.pdf','D');
?>
diff --git a/include/fiche.inc.php b/include/fiche.inc.php
index e01f6ee44..b971ee38a 100644
--- a/include/fiche.inc.php
+++ b/include/fiche.inc.php
@@ -19,7 +19,7 @@
*/
/* $Revision$ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-/* !\file
+/**\file
* \brief printing of category of card : balance, historic
*/
include_once('class_database.php');
@@ -82,6 +82,16 @@ echo HtmlInput::hidden('ac', $_GET['ac']);
require_once('template/impress_cat_card.php');
echo HtmlInput::submit('cat_display', _('Recherche'));
echo '';
+$search_card=new IText('card_search');
+$search_card_js=sprintf('onclick="boxsearch_card(\'%d\')"',dossier::id());
+?>
+
+
+ =_('Recherche de fiche')?> =HtmlInput::infobulle(18)?> :=$search_card->input()?>
+ =HtmlInput::button_anchor("Chercher","javascript:void(0)","",$search_card_js)?>
+
+
+echo '';
$str = "if (g('histo').value==3 || g('histo').value== -1 ) {
g('trstart').style.display='none';g('trend').style.display='none';g('allcard').style.display='none';}
else {g('trstart').style.display='';g('trend').style.display='';g('allcard').style.display='';}
@@ -155,8 +165,8 @@ if ($_GET['histo'] == -1)
}
if ($msg != "")
{
- echo h2("Fiche non effacées", ' class="error" ');
- echo ''." Ces fiches n'ont pas été effacées ".$msg;
+ echo h2(_("Fiche non effacées"), ' class="error" ');
+ echo '
'._(" Ces fiches n'ont pas été effacées ").$msg;
}
}
}
@@ -172,10 +182,10 @@ if ($_GET['histo'] == -1)
}
else
{
- $cond = " where fd_id = " . sql_string($_GET['cat']);
+ $cond = " where f.fd_id = " . sql_string($_GET['cat']);
}
// Create nav bar
- $max = $cn->get_value("select count(*) from fiche " . $cond);
+ $max = $cn->get_value("select count(*) from fiche as f " . $cond);
$step = $_SESSION['g_pagesize'];
$page = (isset($_GET['offset'])) ? $_GET['page'] : 1;
@@ -185,13 +195,15 @@ if ($_GET['histo'] == -1)
$res = $cn->exec_sql("
select f_id,
(select ad_value from fiche_detail as fd1 where ad_id=1 and fd1.f_id=f.f_id) as name,
- (select ad_value from fiche_detail as fd1 where ad_id=23 and fd1.f_id=f.f_id) as qcode
- from fiche as f
- $cond order by 1 offset $offset $limit
+ (select ad_value from fiche_detail as fd1 where ad_id=23 and fd1.f_id=f.f_id) as qcode,
+ fd_label
+ from fiche as f join fiche_def as fd on (fd.fd_id=f.fd_id)
+ $cond order by 2 offset $offset $limit
");
$nb_line = Database::num_row($res);
+ if ($write != 1 || $allcard != 0 ) $str_add_card="";
require_once 'template/fiche_list.php';
- if ($write == 1 && $allcard == 0 ) echo $str_add_card;
+ echo '
'.$bar;
exit();
}
/* * *********************************************************************************************************************************
@@ -281,7 +293,7 @@ if ($_GET['histo'] == 4 || $_GET['histo'] == 5)
{
if ($allcard == 0)
{
- echo "Aucune fiche trouvée";
+ echo _("Aucune fiche trouvée");
exit;
} else
continue;
@@ -324,9 +336,9 @@ if ($_GET['histo'] == 4 || $_GET['histo'] == 5)
td(nbm(abs($solde['solde'])), 'style="text-align:right"') .
td((($solde['debit'] < $solde['credit']) ? 'CRED' : 'DEB'), 'style="text-align:right"'), $class
);
-
-
-
+
+
+
}
echo tr(
td('').
@@ -452,7 +464,7 @@ for ($e = 0; $e < count($afiche); $e++)
$span_error = "";
if ($row['letter_diff'] != 0)
$span_error = $g_failed;
- echo td($row['letter'] . $span_error);
+ echo td(strtoupper(base_convert($row['letter'],10,36)) . $span_error);
}
else
echo td('');
diff --git a/include/forecast.inc.php b/include/forecast.inc.php
index a9b0e4a4d..ce6386dcb 100644
--- a/include/forecast.inc.php
+++ b/include/forecast.inc.php
@@ -21,7 +21,7 @@
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-/* !\file
+/**\file
* \brief display, add, delete and modify forecast
*/
diff --git a/include/function_javascript.php b/include/function_javascript.php
index e0a9c0748..a0356a262 100644
--- a/include/function_javascript.php
+++ b/include/function_javascript.php
@@ -2755,6 +2755,8 @@ function load_all_script()
echo js_include('gestion.js');
echo js_include('todo_list.js');
echo js_include('anc_script.js');
+ echo js_include('sorttable.js');
+ echo js_include('nicEdit.js');
}
diff --git a/include/history_operation.inc.php b/include/history_operation.inc.php
index 1cd948e3d..b2da1636d 100644
--- a/include/history_operation.inc.php
+++ b/include/history_operation.inc.php
@@ -21,7 +21,7 @@
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-/* !\file
+/**\file
*
*
* \brief
diff --git a/include/impress_gl_comptes.inc.php b/include/impress_gl_comptes.inc.php
index eb13f793c..956b0ea6e 100644
--- a/include/impress_gl_comptes.inc.php
+++ b/include/impress_gl_comptes.inc.php
@@ -168,7 +168,8 @@ if ( isset( $_REQUEST['bt_html'] ) )
continue;
}
- echo '
+
+ echo '
'. $poste_id['pcm_val'].' '.h($Poste->label).'
@@ -189,6 +190,7 @@ if ( isset( $_REQUEST['bt_html'] ) )
$solde_d = 0.0;
$solde_c = 0.0;
bcscale(2);
+ $i=0;
foreach ($Poste->row as $detail)
{
if ($a==0) {var_dump($detail);$a=1;}
@@ -216,8 +218,10 @@ if ( isset( $_REQUEST['bt_html'] ) )
$solde_d = bcadd($solde_d,$detail['deb_montant']);
}
$side=" ".$Poste->get_amount_side($solde);
- $letter=($detail['letter']!=-1)?hi($detail['letter']):'';
- echo '
+ $letter=($detail['letter']!=-1)?hi(strtoupper(base_convert($detail['letter'],10,36))):'';
+ $i++;
+ if (($i % 2 ) == 0) $class="odd"; else $class="even";
+ echo '
'.$detail['j_date_fmt'].'
'.HtmlInput::detail_op($detail['jr_id'],$detail['jr_internal']).'
'.$detail['description'].'
@@ -228,7 +232,7 @@ if ( isset( $_REQUEST['bt_html'] ) )
'.$letter.'
';
}
- echo '
+ echo '
'.''.'
'.''.'
'.''.'Total du compte '.$poste_id['pcm_val'].' '.'
diff --git a/include/impress_jrn.inc.php b/include/impress_jrn.inc.php
index 3be4aa218..b9eacb078 100644
--- a/include/impress_jrn.inc.php
+++ b/include/impress_jrn.inc.php
@@ -1,4 +1,5 @@
Admin() == 0 && $g_user->is_local_admin()==0)
+if ($g_user->Admin() == 0 && $g_user->is_local_admin() == 0)
{
- $sql="select jrn_def_id,jrn_def_name
+ $sql = "select jrn_def_id,jrn_def_name
from jrn_def join jrn_type on jrn_def_type=jrn_type_id
join user_sec_jrn on uj_jrn_id=jrn_def_id
where
uj_login='$g_user->login'
and uj_priv in ('R','W')
+ order by jrn_def_name
";
- $ret=$cn->make_array($sql);
+ $ret = $cn->make_array($sql);
}
else
{
- $ret=$cn->make_array("select jrn_def_id,jrn_def_name
- from jrn_def join jrn_type on jrn_def_type=jrn_type_id");
-
+ $ret = $cn->make_array("select jrn_def_id,jrn_def_name
+ from jrn_def join jrn_type on jrn_def_type=jrn_type_id
+ order by jrn_def_name
+ ");
}
// Count the forbidden journaux
-$NoPriv=$cn->count_sql("select jrn_def_id,jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_type_id,jrn_desc,uj_priv,
+$NoPriv = $cn->count_sql("select jrn_def_id,jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_type_id,jrn_desc,uj_priv,
jrn_deb_max_line,jrn_cred_max_line
from jrn_def join jrn_type on jrn_def_type=jrn_type_id
join user_sec_jrn on uj_jrn_id=jrn_def_id
@@ -62,15 +65,15 @@ $NoPriv=$cn->count_sql("select jrn_def_id,jrn_def_name,jrn_def_class_deb,jrn_def
and uj_priv ='X'
");
// Pour voir tout les journal ?
-if ( $NoPriv == 0 && $ret != null )
+if ($NoPriv == 0 && $ret != null)
{
- $a=count($ret);
- $all=array('value'=>0,'label'=>'Tous les journaux');
- $ret[$a]=$all;
+ $a = count($ret);
+ $all = array('value' => 0, 'label' => 'Tous les journaux');
+ $ret[$a] = $all;
}
-if ( count($ret) < 1 )
- NoAccess();
-$exercice=(isset($_GET['exercice']))?$_GET['exercice']:$g_user->get_exercice();
+if (count($ret) < 1)
+ NoAccess();
+$exercice = (isset($_GET['exercice'])) ? $_GET['exercice'] : $g_user->get_exercice();
//-----------------------------------------------------
// Form
@@ -79,56 +82,58 @@ echo '';
/*
* Let you change the exercice
*/
-echo '
'._('Choississez un autre exercice').' ';;
echo '';
+echo HtmlInput::get_to_hidden(array('ac', 'type'));
echo '';
+echo '';
-echo '
';
@@ -139,162 +144,239 @@ echo '';
// First time in html
// after in pdf or cvs
//-----------------------------------------------------
-if ( isset( $_REQUEST['bt_html'] ) )
+if (isset($_REQUEST['bt_html']))
{
- require_once("class_acc_ledger.php");
+ require_once("class_acc_ledger.php");
- $d=var_export($_GET,true);
- $Jrn=new Acc_Ledger($cn,$_GET['jrn_id']);
- $Jrn->get_name();
- if ( $_GET['p_simple']==0 )
- {
- $Row=$Jrn->get_row( $_GET['from_periode'],
- $_GET['to_periode']
- );
- }
- else
- {
- $Row=$Jrn->get_rowSimple($_GET['from_periode'],
- $_GET['to_periode']
- );
- }
- $rep="";
- $hid=new IHidden();
- echo '
';
- echo '
'.h($Jrn->name).' ';
- echo "
";
- echo '';
- echo ' ";
+ $d = var_export($_GET, true);
+ $Jrn = new Acc_Ledger($cn, $_GET['jrn_id']);
+ $Jrn->get_name();
+ switch ($_GET['p_simple'])
+ {
+ case "0":
+ $Row = $Jrn->get_row($_GET['from_periode'], $_GET['to_periode']);
+ break;
+ case "1":
+ $Row = $Jrn->get_rowSimple($_GET['from_periode'], $_GET['to_periode']);
+ break;
+ case "2":
+ $Row = $Jrn->get_rowSimple($_GET['from_periode'], $_GET['to_periode']);
+ break;
+ default:
+ var_dump($_GET['p_simple']);
+ die(__FILE__ . ":" . __LINE__ . " error unknown style ");
+ }
+ $rep = "";
+ $hid = new IHidden();
+ echo '';
+ echo '
' . h($Jrn->name) . ' ';
+ echo "
";
+ echo '';
+ if ($_GET['p_simple'] == 0 || $_GET['p_simple'] == 1)
+ {
+ echo ' ";
- echo ' ";
+ echo ' ";
- echo ' ";
+ echo ' ";
+ }
echo '';
echo HtmlInput::print_window();
echo ' ';
- echo " ";
+ echo "";
- echo "
";
- if ( count($Jrn->row ) == 0
- && $Row==null)
- exit;
-
- echo '
';
-
- if ( $_GET['p_simple'] == 0 )
- {
- // detailled printing
- //---
- foreach ( $Jrn->row as $op )
- {
- $class="";
- if ( $op['j_date'] != '' )
- {
- $class="odd";
- }
-
- echo "";
-
- echo "".$op['j_date']." ";
- echo "".$op['jr_pj_number']." ";
+ echo "
";
+ if (count($Jrn->row) == 0
+ && $Row == null)
+ exit;
- if ( $op['internal']!='')
- echo "
".HtmlInput::detail_op($op['jr_id'],$op['internal'])." ";
- else
- echo td();
+ /////////////////////////////////////////////////////////////////////////////////////
+ // Ecriture comptable
+ /////////////////////////////////////////////////////////////////////////////////////
+ if ($_GET['p_simple'] == 0)
+ {
+ echo '
';
+ // detailled printing
+ //---
+ foreach ($Jrn->row as $op)
+ {
+ $class = "";
+ if ($op['j_date'] != '')
+ {
+ $class = "odd";
+ }
- echo "".$op['poste']." ".
- "".$op['description']." ".
- "".nbm($op['deb_montant'])." ".
- "".nbm($op['cred_montant'])." ".
- "";
- }// end loop
- } // if
- else
- {
- // Simple printing
- //---
+ echo "";
- echo " ".
- " operation ".
- " Date ".
- " n° de pièce ".
- "internal ".
- th('Tiers').
- "Commentaire ".
- " montant ".
- " ";
- // set a filter for the FIN
-
- foreach ($Row as $line)
- {
- echo "";
- echo "".$line['num']." ";
- echo "".$line['date']." ";
- echo "".h($line['jr_pj_number'])." ";
- echo "".HtmlInput::detail_op($line['jr_id'],$line['jr_internal'])." ";
- $tiers=$Jrn->get_tiers($line['jrn_def_type'],$line['jr_id']);
- echo td($tiers);
- echo "".h($line['comment'])." ";
+ echo "" . $op['j_date'] . " ";
+ echo "" . $op['jr_pj_number'] . " ";
- // echo "".$line['pj']." ";
- // If the ledger is financial :
- // the credit must be negative and written in red
- // Get the jrn type
- if ( $line['jrn_def_type'] == 'FIN' )
- {
- $positive = $cn->get_value("select qf_amount from quant_fin where jr_id=$1",
- array($line['jr_id']));
- if ($cn->count() != 0)
- $positive = 1;
- else
- $positive = ($positive > 0)?1:0;
+ if ($op['internal'] != '')
+ echo "" . HtmlInput::detail_op($op['jr_id'], $op['internal']) . " ";
+ else
+ echo td();
- echo "";
- echo ( $positive != 0 )?" - ".nbm($line['montant'])." ":nbm($line['montant']);
- echo " ";
- }
- else
- {
- echo "".nbm($line['montant'])." ";
- }
+ echo "" . $op['poste'] . " " .
+ "" . $op['description'] . " " .
+ "" . nbm($op['deb_montant']) . " " .
+ "" . nbm($op['cred_montant']) . " " .
+ " ";
+ }// end loop
+ echo "
";
+ // show the saldo
- echo "
";
- }
+ $solde = $Jrn->get_solde($_GET['from_periode'], $_GET['to_periode']);
+ echo "solde débiteur:" . $solde[0] . " ";
+ echo "solde créditeur:" . $solde[1];
+ } // if
+ /////////////////////////////////////////////////////////////////////////////////////
+ // Liste opérations
+ /////////////////////////////////////////////////////////////////////////////////////
+ elseif ($_GET['p_simple'] == 1)
+ {
+ // Simple printing
+ //---
+ echo '';
+ echo "" .
+ " operation " .
+ " Date " .
+ " n° de pièce " .
+ "internal " .
+ th('Tiers') .
+ "Commentaire " .
+ "Total opération " .
+ " ";
+ // set a filter for the FIN
+ $i = 0;
+ foreach ($Row as $line)
+ {
+ $i++;
+ $class = ($i % 2 == 0) ? ' class="even" ' : ' class="odd" ';
+ echo "";
+ echo "" . $line['num'] . " ";
+ echo "" . $line['date'] . " ";
+ echo "" . h($line['jr_pj_number']) . " ";
+ echo "" . HtmlInput::detail_op($line['jr_id'], $line['jr_internal']) . " ";
+ $tiers = $Jrn->get_tiers($line['jrn_def_type'], $line['jr_id']);
+ echo td($tiers);
+ echo "" . h($line['comment']) . " ";
- } //else
- echo "
";
- // show the saldo
- $solde=$Jrn->get_solde( $_GET['from_periode'],
- $_GET['to_periode']
- );
- echo "solde débiteur:".$solde[0]." ";
- echo "solde créditeur:".$solde[1];
+ // echo "".$line['pj']." ";
+ // If the ledger is financial :
+ // the credit must be negative and written in red
+ // Get the jrn type
+ if ($line['jrn_def_type'] == 'FIN')
+ {
+ $positive = $cn->get_value("select qf_amount from quant_fin where jr_id=$1", array($line['jr_id']));
+ if ($cn->count() == 0)
+ $positive = 1;
+ else
+ $positive = ($positive > 0) ? 1 : 0;
- echo "";
- exit;
+ echo "";
+ echo ( $positive == 0 ) ? " - " . nbm($line['montant']) . " " : nbm($line['montant']);
+ echo " ";
+ }
+ else
+ {
+ echo "" . nbm($line['montant']) . " ";
+ }
+
+ echo "";
+ }
+ echo "
";
+ }
+ /////////////////////////////////////////////////////////////////////////////////////
+ // Détaillé
+ /////////////////////////////////////////////////////////////////////////////////////
+ elseif ($_GET['p_simple'] == 2)
+ {
+ foreach ($Row as $line)
+ {
+ echo '
';
+ $class = ' class="odd" style="font-stretch: expanded;font-size:12px;"';
+ echo '
';
+ echo "";
+ echo '' . $line['date'] . " ";
+ echo '' . h($line['jr_pj_number']) . " ";
+ echo '' . HtmlInput::detail_op($line['jr_id'], $line['jr_internal']) . " ";
+ $tiers = $Jrn->get_tiers($line['jrn_def_type'], $line['jr_id']);
+ $ledger_name = $cn->get_value("select jrn_def_name from jrn_def where jrn_def_id=$1", array($line['jr_def_id']));
+ echo '' . h($ledger_name) . ' ';
+ echo '' . h($tiers) . ' ';
+ echo '' . h($line['comment']) . " ";
+ echo '';
+ if ($line['jrn_def_type'] == 'FIN')
+ {
+ $positive = $cn->get_value("select qf_amount from quant_fin where jr_id=$1", array($line['jr_id']));
+ if ($cn->count() == 0)
+ $positive = 1;
+ else
+ $positive = ($positive > 0) ? 1 : 0;
+
+ echo ( $positive == 0 ) ? " - " . nbm($line['montant']) . " " : nbm($line['montant']);
+ }
+ else
+ {
+ echo nbm($line['montant']) ;
+ }
+ echo " ";
+ echo " ";
+ echo '
';
+ //////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Add detail for each operation
+ //////////////////////////////////////////////////////////////////////////////////////////////////////
+ $op = new Acc_Operation($cn);
+ $op->jr_id = $line['jr_id'];
+ $op->get();
+ $obj = $op->get_quant();
+ switch ($obj->signature)
+ {
+ case 'FIN':
+ require 'template/operation_detail_fin.php';
+ break;
+ case 'ACH':
+ require 'template/operation_detail_ach.php';
+ break;
+ case 'VEN':
+ require 'template/operation_detail_ven.php';
+ break;
+ case 'ODS':
+ require 'template/operation_detail_misc.php';
+ break;
+ default:
+ die("unknown type of ledger");
+ break;
+ }
+ echo '
';
+ //echo '
';
+ } // end loop
+ }
+
+ echo "
";
+ exit;
}
echo '
';
diff --git a/include/impress_poste.inc.php b/include/impress_poste.inc.php
index 8aa4993e8..658d1107b 100644
--- a/include/impress_poste.inc.php
+++ b/include/impress_poste.inc.php
@@ -280,7 +280,7 @@ if ( isset( $_REQUEST['bt_html'] ) )
{
$Poste=new Acc_Account_Ledger ($cn,$poste_id['pcm_val']);
$Poste->load();
- $Poste->get_row_date( $_GET['from_periode'], $_GET['to_periode']);
+ $Poste->get_row_date( $_GET['from_periode'], $_GET['to_periode'],$_GET['ople']);
if ( empty($Poste->row)) continue;
echo ' '. $poste_id['pcm_val'].' '.h($Poste->label).' ';
diff --git a/include/lettering.account.inc.php b/include/lettering.account.inc.php
index 2d88de605..c3f2e6a66 100644
--- a/include/lettering.account.inc.php
+++ b/include/lettering.account.inc.php
@@ -54,12 +54,25 @@ $periode=new Periode($cn);
list($first_per,$last_per)=$periode->get_limit($exercice);
$start=new IDate('start');
+if ( isset ($_GET['start']) && isDate($_GET['start']) == null )
+{
+ echo alert(_('Date malformée, désolé'));
+ $_GET['start']=$first_per->first_day();
+
+}
$start->value=(isset($_GET['start']))?$_GET['start']:$first_per->first_day();
+
$r=td(_('Date début'));
$r.=td($start->input());
echo tr($r);
$end=new IDate('end');
+if ( isset($_GET['end']) && isDate($_GET['end']) == null )
+{
+ echo alert(_('Date malformée, désolé'));
+ $_GET['end']=$last_per->last_day();
+
+}
$end->value=(isset($_GET['end']))?$_GET['end']:$last_per->last_day();
$r=td(_('Date fin'));
$r.=td($end->input());
diff --git a/include/lettering.card.inc.php b/include/lettering.card.inc.php
index 2dc7fd1f0..9b4d03ebd 100644
--- a/include/lettering.card.inc.php
+++ b/include/lettering.card.inc.php
@@ -57,13 +57,28 @@ $periode=new Periode($cn);
list($first_per,$last_per)=$periode->get_limit($exercice);
$start=new IDate('start');
+if ( isset ($_GET['start']) && isDate($_GET['start']) == null )
+{
+ echo alert(_('Date malformée, désolé'));
+ $_GET['start']=$first_per->first_day();
+
+}
$start->value=(isset($_GET['start']))?$_GET['start']:$first_per->first_day();
+
+
$r=td(_('Date début'));
$r.=td($start->input());
echo tr($r);
$end=new IDate('end');
+if ( isset($_GET['end']) && isDate($_GET['end']) == null )
+{
+ echo alert(_('Date malformée, désolé'));
+ $_GET['end']=$last_per->last_day();
+
+}
$end->value=(isset($_GET['end']))?$_GET['end']:$last_per->last_day();
+
$r=td(_('Date fin'));
$r.=td($end->input());
echo tr($r);
@@ -101,11 +116,7 @@ if ( isset($_POST['record']))
// Show the result
//--------------------------------------------------------------------------------
echo '';
-if ( isDate($_GET['start']) == null || isDate($_GET['end']) == null )
-{
- echo alert(_('Date malformée, désolé'));
- exit();
-}
+
$letter=new Lettering_Card($cn);
$quick_code=strtoupper(trim($_GET['acc']));
diff --git a/include/menu.inc.php b/include/menu.inc.php
index 33ca066df..fe6aaf25f 100644
--- a/include/menu.inc.php
+++ b/include/menu.inc.php
@@ -21,7 +21,7 @@
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-/* !\file
+/**\file
*
*
* \brief Show the table menu and let you add your own
diff --git a/include/modele.inc.php b/include/modele.inc.php
index dc58b9407..0ee4155c0 100644
--- a/include/modele.inc.php
+++ b/include/modele.inc.php
@@ -20,7 +20,8 @@
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-/* !\file
+/**
+ * \file
*
*
* \brief concerne only the template
diff --git a/include/opening.inc.php b/include/opening.inc.php
index 91696dcee..f756e6ffd 100644
--- a/include/opening.inc.php
+++ b/include/opening.inc.php
@@ -20,7 +20,7 @@
/* $Revision$ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-/* !\file
+/**\file
* \brief The opening of the exercices. it takes the saldo of the
* choosen foolder / exercice and import it as a misc operation in the
* current folder
diff --git a/include/operation_ods_confirm.inc.php b/include/operation_ods_confirm.inc.php
index da94edb7d..4eddd919f 100644
--- a/include/operation_ods_confirm.inc.php
+++ b/include/operation_ods_confirm.inc.php
@@ -21,7 +21,7 @@
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
-/* !\file
+/**\file
*
*
* \brief confirm ODS operation
@@ -34,7 +34,7 @@ echo '
';
echo '
' . $ledger->get_name() . ' ';
echo '';
-echo '
';
echo '
';
echo '';
-echo '
' . $ledger->get_name() . ' ';
+echo '' . $ledger->get_name() . ' ';
echo '';
// Show the predef operation
@@ -107,8 +107,10 @@ echo '';
echo "";
-echo create_script(" get_last_date()");
-
+if ($g_parameter->MY_DATE_SUGGEST=='Y')
+{
+ echo create_script(" get_last_date()");
+}
echo '';
?>
diff --git a/include/param_pcmn.inc.php b/include/param_pcmn.inc.php
index 52d69d76f..4e63131e7 100644
--- a/include/param_pcmn.inc.php
+++ b/include/param_pcmn.inc.php
@@ -38,7 +38,8 @@ include_once ("class_user.php");
include_once ("user_menu.php");
-echo '';
+echo '
';
+echo HtmlInput::title_box("Poste comptable", "acc_update", "hide");
echo '
-
-
-=_('Détail')?>
+
+
=_('Détail')?>
require_once('class_own.php');
$owner=new Own($cn);
?>
-
@@ -152,7 +150,7 @@ $amount_idx=0;
/* Analytic accountancy */
if ( $owner->MY_ANALYTIC != "nu" && $div=='popup'){
if ( preg_match('/^(6|7)/',$q[$e]['j_poste'])) {
-
+
echo HtmlInput::hidden("amount_t".$amount_idx,$q[$e]['j_montant']);
$anc_op=new Anc_Operation($cn);
$anc_op->j_id=$q[$e]['j_id'];
@@ -168,8 +166,7 @@ $amount_idx=0;
}
?>
-
-
+
require_once('ledger_detail_bottom.php');
?>
diff --git a/include/template/ledger_detail_top.php b/include/template/ledger_detail_top.php
index b37cf85ea..4b337f58c 100644
--- a/include/template/ledger_detail_top.php
+++ b/include/template/ledger_detail_top.php
@@ -3,7 +3,7 @@
if ($div != "popup") {
$callback=$_SERVER['PHP_SELF'];
$str=$_SERVER['QUERY_STRING']."&act=$action&ajax=$callback";
- echo '
+ echo '
!pop me out ! ';
echo 'Fermer ';
}
diff --git a/include/template/ledger_detail_ven.php b/include/template/ledger_detail_ven.php
index 09b1902ff..bbcd002fb 100644
--- a/include/template/ledger_detail_ven.php
+++ b/include/template/ledger_detail_ven.php
@@ -97,8 +97,10 @@
-
- =_('Détail')?>
+
+
+=_('Détail')?>
+
bcscale(2);
@@ -152,7 +154,8 @@ echo '';
$row.=td($input->input().$hidden);
$sym_tva='';
- $pu=bcdiv($q['qs_price'],$q['qs_quantite']);
+ $pu=0;
+ if ($q['qs_quantite'] != 0) $pu=bcdiv($q['qs_price'],$q['qs_quantite']);
$row.=td(nbm($pu),'class="num"');
$row.=td(nbm($q['qs_quantite']),'class="num"');
$sym_tva='';
@@ -172,8 +175,13 @@ echo '';
$tvac=bcadd($htva,$q['qs_vat']);
if ($owner->MY_TVA_USE=='Y')
{
- $row.=td(nbm($q['qs_vat']),'class="num"');
- $row.=td(nbm($tvac),'class="num"');
+ $class="";
+ if ($q['qs_vat_sided'] != 0) {
+ $class=' style="text-decoration:line-through"';
+ $tvac=bcsub($tvac,$q['qs_vat']);
+ }
+ $row.=td(nbm($q['qs_vat']),'class="num"'.$class);
+ $row.=td(nbm($tvac),'class="num"');
}
$total_tvac=bcadd($total_tvac,$tvac);
$total_htva=bcadd($total_htva,$htva);
@@ -212,13 +220,12 @@ echo tr($row);
-
-
-
-
+
+
+
=_('Ecritures comptables')?>
-
-
+
+
/* if it is not in a popup, the details are hidden */
if ( $div != 'popup') {
$ib=new IButton ("a".$div);
@@ -281,7 +288,7 @@ echo '';
?>
-
+
require_once('ledger_detail_bottom.php');
?>
diff --git a/include/template/letter_all.php b/include/template/letter_all.php
index 841326c92..8a657b7ba 100644
--- a/include/template/letter_all.php
+++ b/include/template/letter_all.php
@@ -11,7 +11,7 @@ if ( count($this->content) == 0 ) :
exit();
endif;?>
-