diff --git a/contrib/document_test/all_tags.odt b/contrib/document_test/all_tags.odt index 6e92ecdc5..cddfeaba0 100644 Binary files a/contrib/document_test/all_tags.odt and b/contrib/document_test/all_tags.odt differ diff --git a/doc/developper/Doxyfile b/doc/developper/Doxyfile index f3849ae72..bcec9d4aa 100644 --- a/doc/developper/Doxyfile +++ b/doc/developper/Doxyfile @@ -585,7 +585,8 @@ WARN_LOGFILE = doxygen-warn.log # with spaces. INPUT = ../../include \ - ../../html + ../../html + # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is @@ -660,7 +661,7 @@ EXCLUDE = ../../html/addon ../../include/tfpdf # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. -EXCLUDE_SYMLINKS = YES +EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude diff --git a/doc/manuel-fr.odt b/doc/manuel-fr.odt index 7c31854c3..e0bf35e4b 100644 Binary files a/doc/manuel-fr.odt and b/doc/manuel-fr.odt differ diff --git a/doc/manuel-fr.pdf b/doc/manuel-fr.pdf index 5e1524705..91afdb627 100644 Binary files a/doc/manuel-fr.pdf and b/doc/manuel-fr.pdf differ diff --git a/html/admin/setup.php b/html/admin/setup.php index 6ca87ccb7..e1b5a6bfb 100644 --- a/html/admin/setup.php +++ b/html/admin/setup.php @@ -461,11 +461,21 @@ $MaxDossier=$cn->size($Resdossier); //---------------------------------------------------------------------- for ($e=0;$e < $MaxDossier;$e++) { - $db_row=$cn->fetch($e); + $db_row=Database::fetch_array($Resdossier,$e); echo "

Patching ".$db_row['dos_name'].'

'; - $db=new Database($db_row['dos_id'],'dos'); - $db->apply_patch($db_row['dos_name']); - Dossier::synchro_admin($db_row['dos_id']); + + $name=$cn->format_name($db_row['dos_id'],'dos'); + + if ( $cn->exist_database($name)> 0 ) + { + $db=new Database($db_row['dos_id'],'dos'); + $db->apply_patch($db_row['dos_name']); + Dossier::synchro_admin($db_row['dos_id']); + + } else + { + echo_warning(_("Dossier inexistant")." $name"); + } } //---------------------------------------------------------------------- @@ -476,10 +486,18 @@ $MaxDossier=$cn->size(); echo "

Mise à jour modèle

"; for ($e=0;$e < $MaxDossier;$e++) { - $db_row=$cn->fetch($e); + $db_row=Database::fetch_array($Resdossier,$e); echo "

Patching ".$db_row['mod_name']."

"; - $db=new Database($db_row['mod_id'],'mod'); - $db->apply_patch($db_row['mod_name']); + $name=$cn->format_name($db_row['mod_id'],'mod'); + + if ( $cn->exist_database($name)> 0 ) + { + $db=new Database($db_row['mod_id'],'mod'); + $db->apply_patch($db_row['mod_name']); + } else + { + echo_warning(_("Modèle inexistant")." $name"); + } } //---------------------------------------------------------------------- diff --git a/html/admin/sql/mod2/data.sql b/html/admin/sql/mod2/data.sql index 26c680e36..9779ce0ac 100644 --- a/html/admin/sql/mod2/data.sql +++ b/html/admin/sql/mod2/data.sql @@ -578,10 +578,10 @@ INSERT INTO document_type (dt_id, dt_value) VALUES (22, 'Réception magazine'); -INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (2, '400', 'Client', true, 9); +INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (2, '410', 'Client', true, 9); INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (1, '604', 'Marchandises', true, 2); -INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (3, '5500', 'Banque', true, 4); -INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (4, '440', 'Fournisseur', true, 8); +INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (3, '51', 'Banque', true, 4); +INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (4, '400', 'Fournisseur', true, 8); INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (5, '61', 'S & B D', true, 3); INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (6, '700', 'Vente', true, 1); diff --git a/html/admin/sql/patch/upgrade103.sql b/html/admin/sql/patch/upgrade103.sql new file mode 100644 index 000000000..f09d0a0b2 --- /dev/null +++ b/html/admin/sql/patch/upgrade103.sql @@ -0,0 +1,37 @@ +begin; +CREATE OR REPLACE FUNCTION comptaproc.format_account(p_account account_type) + RETURNS account_type AS +$BODY$ + +declare + +sResult account_type; + +begin +sResult := lower(p_account); + +sResult := translate(sResult,E'éèêëàâäïîüûùöôç','eeeeaaaiiuuuooc'); +sResult := translate(sResult,E' $€µ£%.+-/\\!(){}(),;_&|"#''^<>*',''); + +return upper(sResult); + +end; +$BODY$ + LANGUAGE plpgsql ; + +COMMENT ON FUNCTION comptaproc.format_account(account_type) IS 'format the accounting : +- upper case +- remove space and special char. +'; + +update tmp_pcmn set pcm_val_parent = '62' where pcm_val='6202'; + +update fiche_detail set ad_value = (to_number(ad_value,'9.99')*100)::text where ad_id in (21,22,20,31) and ad_value is not null and ad_value <> ''; + +update menu_ref set me_code='ACHISTO' WHERE me_code='ACHIMP'; +update menu_ref set me_code='VEHISTO' WHERE me_code='VENIMP'; +update menu_ref set me_code='FIHISTO' WHERE me_code='FIMP'; +update menu_ref set me_code='ODHISTO' WHERE me_code='ODSIMP'; +update version set val=104; + +commit; \ No newline at end of file diff --git a/html/admin/sql/patch/upgrade104.sql b/html/admin/sql/patch/upgrade104.sql new file mode 100644 index 000000000..0df65216a --- /dev/null +++ b/html/admin/sql/patch/upgrade104.sql @@ -0,0 +1,105 @@ +begin; +CREATE OR REPLACE FUNCTION comptaproc.insert_quick_code(nf_id integer, tav_text text) + RETURNS integer AS +$BODY$ + declare + ns integer; + nExist integer; + tText text; + begin + tText := lower(trim(tav_text)); + tText := replace(tText,' ',''); + tText := translate(tText,E' $€µ£%.+-/\\!(){}(),;_&|"#''^<>*',''); + tText := translate(tText,E'éèêëàâäïîüûùöôç','eeeeaaaiiuuuooc'); + + + loop + -- take the next sequence + select nextval('s_jnt_fic_att_value') into ns; + if length (tText) = 0 or tText is null then + tText := 'FID'||ns; + end if; + -- av_text already used ? + select count(*) into nExist + from fiche_detail + where + ad_id=23 and ad_value=upper(tText); + + if nExist = 0 then + exit; + end if; + tText:='FID'||ns; + end loop; + + + insert into fiche_detail(jft_id,f_id,ad_id,ad_value) values (ns,nf_id,23,upper(tText)); + return ns; + end; +$BODY$ +LANGUAGE plpgsql; + + + +CREATE OR REPLACE FUNCTION comptaproc.update_quick_code(njft_id integer, tav_text text) + RETURNS integer AS +$BODY$ + declare + ns integer; + nExist integer; + tText text; + old_qcode varchar; + begin + -- get current value + select ad_value into old_qcode from fiche_detail where jft_id=njft_id; + -- av_text didn't change so no update + if tav_text = upper( trim(old_qcode)) then + return 0; + end if; + + tText := trim(lower(tav_text)); + tText := replace(tText,' ',''); + tText := translate(tText,E' $€µ£%.+-/\\!(){}(),;_&|"#''^<>*',''); + tText := translate(tText,E'éèêëàâäïîüûùöôç','eeeeaaaiiuuuooc'); + tText := upper(tText); + if length ( tText) = 0 or tText is null then + return 0; + end if; + + ns := njft_id; + + loop + -- av_text already used ? + select count(*) into nExist + from fiche_detail + where + ad_id=23 and ad_value=tText; + + if nExist = 0 then + exit; + end if; + if tText = 'FID'||ns then + -- take the next sequence + select nextval('s_jnt_fic_att_value') into ns; + end if; + tText :='FID'||ns; + + end loop; + update fiche_detail set ad_value = tText where jft_id=njft_id; + + -- update also the contact + update fiche_detail set ad_value = tText + where jft_id in + ( select jft_id + from fiche_detail + where ad_id=25 and ad_value=old_qcode); + + + update jrnx set j_qcode=tText where j_qcode = old_qcode; + return ns; + end; +$BODY$ +LANGUAGE plpgsql; + +update version set val=105; + +commit; \ No newline at end of file diff --git a/html/admin/sql/patch/upgrade105.sql b/html/admin/sql/patch/upgrade105.sql new file mode 100644 index 000000000..784e8cca4 --- /dev/null +++ b/html/admin/sql/patch/upgrade105.sql @@ -0,0 +1,109 @@ +begin; + +CREATE OR REPLACE FUNCTION comptaproc.insert_quick_code(nf_id integer, tav_text text) + RETURNS integer AS +$BODY$ + declare + ns integer; + nExist integer; + tText text; + begin + tText := lower(trim(tav_text)); + tText := replace(tText,' ',''); + tText := translate(tText,E' $€µ£%.+-/\\!(){}(),;_&|"#''^<>*',''); + tText := translate(tText,E'éèêëàâäïîüûùöôç','eeeeaaaiiuuuooc'); + + + loop + -- take the next sequence + select nextval('s_jnt_fic_att_value') into ns; + if length (tText) = 0 or tText is null then + tText := 'FID'||ns; + end if; + -- av_text already used ? + select count(*) into nExist + from fiche_detail + where + ad_id=23 and ad_value=upper(tText); + + if nExist = 0 then + exit; + end if; + tText:='FID'||ns; + end loop; + + + insert into fiche_detail(jft_id,f_id,ad_id,ad_value) values (ns,nf_id,23,upper(tText)); + return ns; + end; +$BODY$ + LANGUAGE plpgsql; + +CREATE OR REPLACE FUNCTION comptaproc.update_quick_code(njft_id integer, tav_text text) + RETURNS integer AS +$BODY$ + declare + ns integer; + nExist integer; + tText text; + old_qcode varchar; + begin + -- get current value + select ad_value into old_qcode from fiche_detail where jft_id=njft_id; + -- av_text didn't change so no update + if tav_text = upper( trim(old_qcode)) then + return 0; + end if; + + tText := trim(lower(tav_text)); + tText := replace(tText,' ',''); + tText := translate(tText,E' $€µ£%.+-/\\!(){}(),;_&|"#''^<>*',''); + tText := translate(tText,E'éèêëàâäïîüûùöôç','eeeeaaaiiuuuooc'); + tText := upper(tText); + if length ( tText) = 0 or tText is null then + return 0; + end if; + + ns := njft_id; + + loop + -- av_text already used ? + select count(*) into nExist + from fiche_detail + where + ad_id=23 and ad_value=tText; + + if nExist = 0 then + exit; + end if; + if tText = 'FID'||ns then + -- take the next sequence + select nextval('s_jnt_fic_att_value') into ns; + end if; + tText :='FID'||ns; + + end loop; + update fiche_detail set ad_value = tText where jft_id=njft_id; + + -- update also the contact + update fiche_detail set ad_value = tText + where jft_id in + ( select jft_id + from fiche_detail + where ad_id=25 and ad_value=old_qcode); + + + update jrnx set j_qcode=tText where j_qcode = old_qcode; + return ns; + end; +$BODY$ + LANGUAGE plpgsql; + + +alter table document_state add s_status char(1); + +update document_state set s_status='C' where s_id in (1,4); + +update version set val=106; + +commit; diff --git a/html/ajax_card.php b/html/ajax_card.php index cf03203f2..c53290995 100644 --- a/html/ajax_card.php +++ b/html/ajax_card.php @@ -116,7 +116,7 @@ case 'rmfa': echo $e->getMessage(); } $html=ob_get_contents(); - ob_clean(); + ob_end_clean(); break; /* ------------------------------------------------------------ */ /* Display card detail */ @@ -327,9 +327,11 @@ case 'fs': $r.='
'; $q=new IText('query'); $q->value=(isset($query))?$query:''; - $r.=_('Fiche contenant'); + $r.=''; + $r.=_('Fiche contenant').HtmlInput::infobulle(19); $r.=$q->input(); $r.=HtmlInput::submit('fs',_('Recherche')); + $r.=''; $r.=dossier::hidden().HtmlInput::hidden('op','fs'); $array=array(); foreach (array('query','inp','jrn','label','typecard','price','tvaid') as $i) @@ -393,7 +395,7 @@ case 'fs': ob_start(); require_once('template/card_result.php'); $r.=ob_get_contents(); - ob_clean(); + ob_end_clean(); $ctl=$ctl.'_content'; $html=$r; break; @@ -442,7 +444,7 @@ case 'ac': ob_start(); require('template/category_of_card.php'); $html.=ob_get_contents(); - ob_clean(); + ob_end_clean(); } else @@ -511,7 +513,7 @@ case 'upc': ob_start(); $f->update($_GET); $html.=ob_get_contents(); - ob_clean(); + ob_end_clean(); $html.=$f->Display(true); $html.=HtmlInput::button('close_'.$ctl,'Fermer',"onclick=\"removeDiv('$ctl')\""); } diff --git a/html/ajax_history.php b/html/ajax_history.php index ec3451c3d..86949ea1c 100644 --- a/html/ajax_history.php +++ b/html/ajax_history.php @@ -115,7 +115,7 @@ if ( isset($_GET['f_id'])) echo $old; $html=ob_get_contents(); - ob_clean(); + ob_end_clean(); } } /////////////////////////////////////////////////////////////////////////// @@ -185,7 +185,7 @@ if ( isset($_REQUEST['pcm_val'])) echo $old; $html=ob_get_contents(); - ob_clean(); + ob_end_clean(); } } $html=escape_xml($html); diff --git a/html/ajax_ledger.php b/html/ajax_ledger.php index 6f464a2a2..4c3e4f501 100644 --- a/html/ajax_ledger.php +++ b/html/ajax_ledger.php @@ -71,8 +71,9 @@ if ( $g_user->check_dossier(dossier::id(),true)=='X' ) { ob_start(); require_once ('template/ledger_detail_forbidden.php'); + echo HtmlInput::button_close($div); $html=ob_get_contents(); - ob_clean(); + ob_end_clean(); $html=escape_xml($html); header('Content-type: text/xml; charset=UTF-8'); echo <<rollback; } $html=ob_get_contents(); - ob_clean(); + ob_end_clean(); } break; ////////////////////////////////////////////////////////////////////// @@ -197,7 +199,7 @@ case 'de': echo '

Désolé il y a une erreur

'; } $html=ob_get_contents(); - ob_clean(); + ob_end_clean(); break; ///////////////////////////////////////////////////////////////////////////// @@ -221,7 +223,7 @@ case 'file': echo "
"; } - echo "

Document

"; + echo "

Document

"; if ( $access=='W') { echo ''; @@ -278,7 +280,7 @@ case 'file': echo "
"; } - 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"); + +
+ +
+

Ajout d'un état

- input()?> - +

+ Nom de l'état input()?> +

+

+ Cochez la case si cet état ferme une action input()?> + +

\ 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()); +?> +
+ + :input()?> + +
+'; $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 '
' . _('Choississez un autre exercice') . ''; +; echo 'Choississez un autre exercice :'; -$ex=new Exercice($cn); -$wex=$ex->select('exercice',$exercice,' onchange="submit(this)"'); +$ex = new Exercice($cn); +$wex = $ex->select('exercice', $exercice, ' onchange="submit(this)"'); echo $wex->input(); echo dossier::hidden(); -echo HtmlInput::get_to_hidden(array('ac','type')); -echo ''; +echo HtmlInput::get_to_hidden(array('ac', 'type')); echo '
'; +echo ''; -echo '
'.dossier::hidden(); -echo HtmlInput::get_to_hidden(array('ac','type')); -echo HtmlInput::hidden('type','jrn'); +echo '' . dossier::hidden(); +echo HtmlInput::get_to_hidden(array('ac', 'type')); +echo HtmlInput::hidden('type', 'jrn'); echo HtmlInput::get_to_hidden(array('exercice')); echo ''; -$w=new ISelect(); -$w->table=1; -$label="Choississez le journal"; -$w->selected=(isset($_GET['jrn_id']))?$_GET['jrn_id']:''; -print td($label).$w->input("jrn_id",$ret); +$w = new ISelect(); +$w->table = 1; +$label = "Choississez le journal"; +$w->selected = (isset($_GET['jrn_id'])) ? $_GET['jrn_id'] : ''; +print td($label) . $w->input("jrn_id", $ret); print ''; print ''; // filter on the current year -$filter_year=" where p_exercice='".sql_string($exercice)."'"; +$filter_year = " where p_exercice='" . sql_string($exercice) . "'"; -$periode_start=$cn->make_array("select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end"); -$w->selected=(isset($_GET['from_periode']))?$_GET['from_periode']:''; -print td('Depuis').$w->input('from_periode',$periode_start); +$periode_start = $cn->make_array("select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end"); +$w->selected = (isset($_GET['from_periode'])) ? $_GET['from_periode'] : ''; +print td('Depuis') . $w->input('from_periode', $periode_start); print ''; print ''; -$periode_end=$cn->make_array("select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end"); -$w->selected=(isset($_GET['to_periode']))?$_GET['to_periode']:''; -print td('Jusque ').$w->input('to_periode',$periode_end); +$periode_end = $cn->make_array("select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end"); +$w->selected = (isset($_GET['to_periode'])) ? $_GET['to_periode'] : ''; +print td('Jusque ') . $w->input('to_periode', $periode_end); print ""; -$a=array( - array('value'=>0,'label'=>'Detaillé'), - array('value'=>1,'label'=>'Simple') - ); -$w->selected=1; +$a = array( + array('value' => 0, 'label' => 'Ecriture comptable'), + array('value' => 1, 'label' => 'Liste opérations'), + array('value' => 2, 'label' => 'Avec Détails opérations ') +); +$w->selected = 1; print ''; print ''; -$w->selected=(isset($_GET['p_simple']))?$_GET['p_simple']:''; -echo td('Style d\'impression').$w->input('p_simple',$a); +$w->selected = (isset($_GET['p_simple'])) ? $_GET['p_simple'] : ''; +echo td('Style d\'impression') . $w->input('p_simple', $a); print ""; echo '
'; -print HtmlInput::submit('bt_html','Visualisation'); +print HtmlInput::submit('bt_html', 'Visualisation'); 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 "
'.dossier::hidden(). - $hid->input("type","jrn").$hid->input('p_action','impress')."
"; + echo ''; + if ($_GET['p_simple'] == 0 || $_GET['p_simple'] == 1) + { + echo '"; - echo '"; + echo '"; - echo '"; + echo '"; + } echo ''; - echo ""; + echo ""; - echo "
' . dossier::hidden() . + $hid->input("type", "jrn") . $hid->input('p_action', 'impress') . "
'.dossier::hidden(). - HtmlInput::submit('bt_pdf',"Export PDF"). - HtmlInput::hidden('act','PDF:ledger'). - $hid->input("type","jrn"). - $hid->input("jrn_id",$Jrn->id). - $hid->input("from_periode",$_GET['from_periode']). - $hid->input("to_periode",$_GET['to_periode']); - echo $hid->input("p_simple",$_GET['p_simple']); - echo HtmlInput::get_to_hidden(array('ac','type')); - echo "
' . dossier::hidden() . + HtmlInput::submit('bt_pdf', "Export PDF") . + HtmlInput::hidden('act', 'PDF:ledger') . + $hid->input("type", "jrn") . + $hid->input("jrn_id", $Jrn->id) . + $hid->input("from_periode", $_GET['from_periode']) . + $hid->input("to_periode", $_GET['to_periode']); + echo $hid->input("p_simple", $_GET['p_simple']); + echo HtmlInput::get_to_hidden(array('ac', 'type')); + echo "
'.dossier::hidden(). - HtmlInput::submit('bt_csv',"Export CSV"). - HtmlInput::hidden('act','CSV:ledger'). - $hid->input("type","jrn"). - $hid->input("jrn_id",$Jrn->id). - $hid->input("from_periode",$_GET['from_periode']). - $hid->input("to_periode",$_GET['to_periode']); - echo $hid->input("p_simple",$_GET['p_simple']); - echo HtmlInput::get_to_hidden(array('ac','type')); - echo "
' . dossier::hidden() . + HtmlInput::submit('bt_csv', "Export CSV") . + HtmlInput::hidden('act', 'CSV:ledger') . + $hid->input("type", "jrn") . + $hid->input("jrn_id", $Jrn->id) . + $hid->input("from_periode", $_GET['from_periode']) . + $hid->input("to_periode", $_GET['to_periode']); + echo $hid->input("p_simple", $_GET['p_simple']); + echo HtmlInput::get_to_hidden(array('ac', 'type')); + echo "
'; echo HtmlInput::print_window(); 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 ""; - echo ""; + echo "
".$op['j_date']."".$op['jr_pj_number']."
"; + 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 "". - "". - "". - "". - ""; - }// end loop - } // if - else - { - // Simple printing - //--- + echo ""; - echo "". - "". - "". - "". - th('Tiers'). - "". - "". - ""; - // set a filter for the FIN - - foreach ($Row as $line) - { - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - $tiers=$Jrn->get_tiers($line['jrn_def_type'],$line['jr_id']); - echo td($tiers); - echo ""; + echo ""; + echo ""; - // echo ""; - // 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 ""; + else + echo td(); - echo ""; - } - else - { - echo ""; - } + echo "" . + "" . + "" . + "" . + ""; + }// end loop + echo "
".$op['poste']."".$op['description']."".nbm($op['deb_montant'])."".nbm($op['cred_montant'])."
operation ". - "Date n° de pièce internalCommentaire montant
".$line['num']."".$line['date']."".h($line['jr_pj_number'])."".HtmlInput::detail_op($line['jr_id'],$line['jr_internal'])."".h($line['comment'])."" . $op['j_date'] . "" . $op['jr_pj_number'] . "".$line['pj']."" . HtmlInput::detail_op($op['jr_id'], $op['internal']) . ""; - echo ( $positive != 0 )?" - ".nbm($line['montant'])."":nbm($line['montant']); - echo "".nbm($line['montant'])."" . $op['poste'] . "" . $op['description'] . "" . nbm($op['deb_montant']) . "" . nbm($op['cred_montant']) . "
"; + // 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 "" . + "" . + "" . + "" . + th('Tiers') . + "" . + "" . + ""; + // set a filter for the FIN + $i = 0; + foreach ($Row as $line) + { + $i++; + $class = ($i % 2 == 0) ? ' class="even" ' : ' class="odd" '; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + $tiers = $Jrn->get_tiers($line['jrn_def_type'], $line['jr_id']); + echo td($tiers); + echo ""; - } //else - echo "
operation " . + "Date n° de pièce internalCommentaireTotal opération
" . $line['num'] . "" . $line['date'] . "" . h($line['jr_pj_number']) . "" . HtmlInput::detail_op($line['jr_id'], $line['jr_internal']) . "" . h($line['comment']) . "
"; - // 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 '"; + echo '"; + echo '"; + $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 ''; + echo ''; + echo '"; + echo '"; + echo ""; + echo '
' . $line['date'] . "' . h($line['jr_pj_number']) . "' . HtmlInput::detail_op($line['jr_id'], $line['jr_internal']) . "' . h($ledger_name) . ' ' . h($tiers) . ' ' . h($line['comment']) . "'; + 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 "
'; + ////////////////////////////////////////////////////////////////////////////////////////////////////// + // 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 HtmlInput::request_to_hidden(array('ac')); echo $ledger->confirm($_POST,false); diff --git a/include/operation_ods_new.inc.php b/include/operation_ods_new.inc.php index 65a2206ff..c81ba25cb 100644 --- a/include/operation_ods_new.inc.php +++ b/include/operation_ods_new.inc.php @@ -28,7 +28,7 @@ require_once 'class_pre_op_ods.php'; require_once 'class_iconcerned.php'; -global $g_user; +global $g_user,$g_parameter; $cn=new Database(dossier::id()); $id = (isset($_REQUEST['p_jrn'])) ? $_REQUEST['p_jrn'] : -1; @@ -59,7 +59,7 @@ echo $op->form_get(); 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 ' - +
+ +

- +

jr_id=$jr_id; @@ -36,17 +37,45 @@ if ($aRap != null ) { echo ''; } ?> - amount_id=$obj->det->jr_montant; - echo $wConcerned->input(); - -} + echo $wConcerned->input(); +} ?> - +
+ 0) +{ + ?> +
+

Actions liées

+ '; + for ($i = 0; $i < count($array); $i++) + { + if ( $div == 'popup') + { + echo '
  • '.HtmlInput::detail_action($array[$i]['ag_id'], h($array[$i]['ag_ref']." ".$array[$i]['ag_title']),0).'
  • '; + } + else + { + echo '
  • '.HtmlInput::detail_action($array[$i]['ag_id'], h($array[$i]['ag_ref']." ".$array[$i]['ag_title']),1).'
  • '; + } + } + echo ''; + + echo '
    '; +} +?> + -MY_ANALYTIC != 'nu' && $div=='popup'){ diff --git a/include/template/ledger_detail_fin.php b/include/template/ledger_detail_fin.php index d698b8532..fd58baee2 100644 --- a/include/template/ledger_detail_fin.php +++ b/include/template/ledger_detail_fin.php @@ -88,14 +88,14 @@ echo $inote->input(); -
    - +
    +

    jr_id); $detail->get(); ?> - +

    '; } ?>
    -
    + diff --git a/include/template/ledger_detail_misc.php b/include/template/ledger_detail_misc.php index bcd9aeb7e..38a827e2c 100644 --- a/include/template/ledger_detail_misc.php +++ b/include/template/ledger_detail_misc.php @@ -72,14 +72,12 @@ require_once ('class_anc_plan.php'); -
    - - +
    +

    - 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; } ?>
    -
    - + 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 @@ - -
    +
    +

    + +

    '; $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);
    - -
    -
    - + +
    +

    - - + '; ?>

    -
    + 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 ) : - +
    - - - @@ -47,14 +47,14 @@ if ( ($i % 2) == 0 ) $class="odd"; > @@ -67,9 +67,14 @@ $r=sprintf(' content[$i]['j_montant'])?> - - + + + + +
    @@ -28,14 +28,14 @@ endif;?> - + + - + + - + +
    content[$i]['letter']==-1)?"x":$this->content[$i]['letter']; +$letter=($this->content[$i]['letter']==-1)?" aucun lettrage ":strtoupper(base_convert($this->content[$i]['letter'],10,36)); $js="this.gDossier=".dossier::id(). ";this.j_id=".$this->content[$i]['j_id']. ";this.obj_type='".$this->object_type."'". ";dsp_letter(this)"; ?> - + content[$i]['letter_diff'] != 0) echo $g_failed; ?> content[$i]['j_debit']=='t')?'D':'C'?> + content[$i]['j_montant'])?> db); @@ -97,14 +102,14 @@ $amount_cred+=($this->content[$i]['j_debit']=='f')?$this->content[$i]['j_montant endfor; ?>
    -

    Solde débit : -

    Solde crédit : +

    Solde débit :

    +

    Solde crédit :

    0 ) : ?> -

    Solde débiteur : +

    Solde débiteur :

    -

    Solde créditeur : +

    Solde créditeur :

    diff --git a/include/template/letter_prop.php b/include/template/letter_prop.php index 5997d7195..29edf9f82 100644 --- a/include/template/letter_prop.php +++ b/include/template/letter_prop.php @@ -3,7 +3,6 @@ require_once ('class_acc_operation.php'); require_once ('class_acc_reconciliation.php'); $gDossier=dossier::id(); - if ( count($this->content) == 0 ) : ?>

    @@ -27,14 +26,14 @@ if ( count($this->content) == 0 ) : - - + + - - + + - - + + @@ -67,14 +66,14 @@ if ($linked_limit != 0 && $i==$linked_limit) - - + + - - + + - - + + content[$i]['j_id']); content[$i]['letter']< 0)?" ":$this->content[$i]['letter']; +$letter=($this->content[$i]['letter']< 0)?" ":strtoupper(base_convert($this->content[$i]['letter'],10,36)); ?> @@ -109,9 +108,14 @@ $r=sprintf('
    content[$i]['j_montant'])?> + + + + content[$i]['j_montant'])?> + + db); diff --git a/include/template/module.php b/include/template/module.php index 4519e439d..0f1b1f68f 100644 --- a/include/template/module.php +++ b/include/template/module.php @@ -78,7 +78,8 @@ endif;?> $url="do.php?gDossier=".Dossier::id()."&ac=".$row['me_code']; } ?> - > + + > diff --git a/include/template/operation_detail_ach.php b/include/template/operation_detail_ach.php new file mode 100644 index 000000000..98fdedf10 --- /dev/null +++ b/include/template/operation_detail_ach.php @@ -0,0 +1,124 @@ + + + MY_TVA_USE == 'Y') + { + echo th(_('Taux TVA'), 'style="text-align:right"'); + } + else + { + echo th(''); + } + echo th(_('Prix/Un.'), 'style="text-align:right"'); + echo th(_('Quantité'), 'style="text-align:right"'); + echo th(_('Personnel'), 'style="text-align:right"'); + echo th(_('Non ded'), 'style="text-align:right"'); + + if ($g_parameter->MY_TVA_USE == 'Y') + { + echo th(_('HTVA'), 'style="text-align:right"'); + echo th(_('TVA'), 'style="text-align:right"'); + echo th(_('TVAC'), 'style="text-align:right"'); + }else + echo th(_('Total'), 'style="text-align:right"'); + + echo ''; + for ($e = 0; $e < count($obj->det->array); $e++) + { + $row = ''; + $q = $obj->det->array[$e]; + $fiche = new Fiche($cn, $q['qp_fiche']); + $view_card_detail = HtmlInput::card_detail($fiche->strAttribut(ATTR_DEF_QUICKCODE), "", ' class="line" '); + $row = td($view_card_detail); + $sym_tva = ''; + + if ($g_parameter->MY_TVA_USE == 'Y' && $q['qp_vat_code'] != '') + { + /* retrieve TVA symbol */ + $tva = new Acc_Tva($cn, $q['qp_vat_code']); + $tva->load(); + $sym_tva = h($tva->get_parameter('label')); + } + $input = new ISpan("e_march" . $q['j_id'] . "_label"); + $hidden = HtmlInput::hidden("j_id[]", $q['j_id']); + $input->value = $fiche->strAttribut(ATTR_DEF_NAME); + $row.=td($input->input() . $hidden); + $row.=td($sym_tva, 'style="text-align:center"'); + $pu = 0; + if ($q['qp_quantite'] != 0) + $pu = bcdiv($q['qp_price'], $q['qp_quantite']); + $row.=td(nbm($pu), 'class="num"'); + $row.=td(nbm($q['qp_quantite']), 'class="num"'); + + $no_ded = $q['qp_nd_amount']; + $row.=td(nbm($q['qp_dep_priv']), 'style="text-align:right"'); + $row.=td(nbm($no_ded), ' style="text-align:right"'); + $htva = $q['qp_price']; + + + $row.=td(nbm($htva), 'class="num"'); + $tvac = bcadd($htva, $q['qp_vat']); + $tvac = bcadd($tvac, $q['qp_nd_tva']); + $tvac = bcadd($tvac, $q['qp_nd_tva_recup']); + + + if ($g_parameter->MY_TVA_USE == 'Y') + { + $tva_amount = bcadd($q['qp_vat'], $q['qp_nd_tva']); + $tva_amount = bcadd($tva_amount, $q['qp_nd_tva_recup']); + $class = ""; + if ($q['qp_vat_sided'] <> 0) + { + $class = ' style="text-decoration:line-through"'; + $tvac = bcsub($tvac, $q['qp_vat']); + } + $row.=td(nbm($tva_amount), 'class="num" ' . $class); + $row.=td(nbm($tvac), 'class="num"'); + } + $total_tvac+=$tvac; + $total_htva+=$htva; + echo tr($row); + } + if ($g_parameter->MY_TVA_USE == 'Y') + $row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;width:auto" colspan="6"'); + else + $row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;width:auto" colspan="6"'); + $row.=td(nbm($total_htva), 'class="num" style="font-style:italic;font-weight: bolder;"'); + if ($g_parameter->MY_TVA_USE == 'Y') + $row.=td("") . td(nbm($total_tvac), 'class="num" style="font-style:italic;font-weight: bolder;"'); + echo tr($row); + ?> +
    diff --git a/include/template/operation_detail_fin.php b/include/template/operation_detail_fin.php new file mode 100644 index 000000000..fdb183de3 --- /dev/null +++ b/include/template/operation_detail_fin.php @@ -0,0 +1,50 @@ +'; +echo ''; +echo th('Compte en banque'); +echo th('Tiers'); +echo th('Libellé'); +echo th('Montant'); +echo ''; + +echo ''; +$bk = new Fiche($cn, $obj->det->array[0]['qf_bank']); +$view_card_detail = HtmlInput::card_detail($bk->get_quick_code(), h($bk->getName()), ' class="line" '); +echo td($view_card_detail); +$other = new Fiche($cn, $obj->det->array[0]['qf_other']); +$view_card_detail = HtmlInput::card_detail($other->get_quick_code(), h($other->getName()), ' class="line" '); +echo td($view_card_detail); +$comment = strip_tags($obj->det->jr_comment); +echo td($comment); +echo td(nbm($obj->det->array[0]['qf_amount']), ' class="inum"'); +echo ''; +echo ''; +?> + diff --git a/include/template/operation_detail_misc.php b/include/template/operation_detail_misc.php new file mode 100644 index 000000000..7b0f95636 --- /dev/null +++ b/include/template/operation_detail_misc.php @@ -0,0 +1,86 @@ + + + +'; +$amount_idx=0; +for ($e = 0; $e < count($obj->det->array); $e++) +{ + $row = ''; + $q = $obj->det->array; + $view_history = sprintf('%s', $q[$e]['j_poste'], $gDossier, $q[$e]['j_poste']); + + $row.=td($view_history); + + if ($q[$e]['j_qcode'] != '') + { + $fiche = new Fiche($cn); + $fiche->get_by_qcode($q[$e]['j_qcode']); + $view_history = sprintf('%s', $fiche->id, $gDossier, $q[$e]['j_qcode']); + } + else + $view_history = ''; + $row.=td($view_history); + $l_lib = $q[$e]['j_text']; + + if ($l_lib != '') + { + $l_lib = $q[$e]['j_text']; + } + else if ($q[$e]['j_qcode'] != '') + { + // nom de la fiche + $ff = new Fiche($cn); + $ff->get_by_qcode($q[$e]['j_qcode']); + $l_lib = $ff->strAttribut(ATTR_DEF_NAME); + } + else + { + // libellé du compte + $name = $cn->get_value('select pcm_lib from tmp_pcmn where pcm_val=$1', array($q[$e]['j_poste'])); + $l_lib = $name; + } + $l_lib = strip_tags($l_lib); + $input = new ISpan("e_march" . $q[$e]['j_id'] . "_label"); + $input->value = $l_lib; + $hidden = HtmlInput::hidden("j_id[]", $q[$e]['j_id']); + $row.=td($input->input() . $hidden); + $montant = td(nbm($q[$e]['j_montant']), 'class="num"'); + $row.=($q[$e]['j_debit'] == 't') ? $montant : td(''); + $row.=($q[$e]['j_debit'] == 'f') ? $montant : td(''); + echo tr($row); +} +?> +
    \ No newline at end of file diff --git a/include/template/operation_detail_ven.php b/include/template/operation_detail_ven.php new file mode 100644 index 000000000..40a456f8c --- /dev/null +++ b/include/template/operation_detail_ven.php @@ -0,0 +1,107 @@ + + +MY_TVA_USE == 'Y') + echo th(_('Taux TVA'), 'style="text-align:right"'); +else + echo th(''); +if ( $g_parameter->MY_TVA_USE == 'Y') { + echo th(_('HTVA'), 'style="text-align:right"'); + echo th(_('TVA'), 'style="text-align:right"'); + echo th(_('TVAC'), 'style="text-align:right"'); +} else + echo th(_('Total'), 'style="text-align:right"'); + + +echo ''; + for ($e=0;$edet->array);$e++) { + $row=''; + $q=$obj->det->array[$e]; + $fiche=new Fiche($cn,$q['qs_fiche']); + $view_card_detail=HtmlInput::card_detail($fiche->strAttribut(ATTR_DEF_QUICKCODE),"", ' class="line" '); + $row.=td($view_card_detail); + $input = new ISpan("e_march" . $q['j_id'] . "_label"); + $hidden = HtmlInput::hidden("j_id[]", $q['j_id']); + $input->value = $fiche->strAttribut(ATTR_DEF_NAME); + + $row.=td($input->input().$hidden); + $sym_tva=''; + $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=''; + if ( $g_parameter->MY_TVA_USE=='Y' && $q['qs_vat_code'] != '') { + /* retrieve TVA symbol */ + $tva=new Acc_Tva($cn,$q['qs_vat_code']); + $tva->load(); + $sym_tva=(h($tva->get_parameter('label'))); + // $sym_tva=$sym + } + + $row.=td($sym_tva,'style="text-align:center"'); + + $htva=$q['qs_price']; + + $row.=td(nbm($htva),'class="num"'); + $tvac=bcadd($htva,$q['qs_vat']); + if ($g_parameter->MY_TVA_USE=='Y') + { + $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); + echo tr($row); + + } + if ($g_parameter->MY_TVA_USE=='Y') + $row= td(_('Total'),' style="font-style:italic;text-align:right;font-weight: bolder;" colspan="5"'); + else + $row= td(_('Total'),' style="font-style:italic;text-align:right;font-weight: bolder;" colspan="5"'); +$row.=td(nbm($total_htva),'class="num" style="font-style:italic;font-weight: bolder;"'); +if ($g_parameter->MY_TVA_USE=='Y') + $row.=td("").td(nbm($total_tvac),'class="num" style="font-style:italic;font-weight: bolder;"'); +echo tr($row); +?> +
    \ No newline at end of file diff --git a/include/template/periode_add_exercice.php b/include/template/periode_add_exercice.php index 875180057..dc1f44361 100644 --- a/include/template/periode_add_exercice.php +++ b/include/template/periode_add_exercice.php @@ -2,8 +2,11 @@
    • Exercice en 12 périodes : Ajout d'un exercice comptable de 12 périodes, commençant le 1 janvier et terminant le 31 décembre.
    • -
    • Exercice en 13 périodes: Ajout d'une période d'un jour le 31/12. Cette période est utilisée +
    • Exercice en 13 périodes: Ajout d'une période d'un jour le 31/12. Cette période est utilisée pour faire toutes les écritures de fin d'exercice: amortissements, régulations de compte... Avec une 13ième période, cela simplifie les prévisions, les rapports...
    • +
    • + Pour ajouter des années, ne commençant pas en janvier ou comptant un nombre de mois supérieur à 12, utilisez le plugin "Outils Comptables" +
    diff --git a/include/template/search_top.php b/include/template/search_top.php index 8460266f3..192a31117 100644 --- a/include/template/search_top.php +++ b/include/template/search_top.php @@ -21,7 +21,7 @@ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr -/* !\file +/**\file * * * \brief diff --git a/include/template/user_sec_profile.php b/include/template/user_sec_profile.php index 78e6177ec..6dd430a73 100644 --- a/include/template/user_sec_profile.php +++ b/include/template/user_sec_profile.php @@ -32,7 +32,7 @@ - + diff --git a/include/tfpdf/tfpdf.php b/include/tfpdf/tfpdf.php index e1727f017..698e7a549 100644 --- a/include/tfpdf/tfpdf.php +++ b/include/tfpdf/tfpdf.php @@ -1279,7 +1279,7 @@ function _checkoutput() if(preg_match('/^(\xEF\xBB\xBF)?\s*$/',ob_get_contents())) { // It contains only a UTF-8 BOM and/or whitespace, let's clean it - ob_clean(); + ob_end_clean(); } else $this->Error("Some data has already been output, can't send PDF file"); diff --git a/include/tva.inc.php b/include/tva.inc.php index f9bfc4b9e..85de5de20 100644 --- a/include/tva.inc.php +++ b/include/tva.inc.php @@ -18,7 +18,7 @@ */ /* $Revision$ */ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr -/* ! \file +/** \file * \brief included file for customizing with the vat (account,rate...) */ require_once('class_own.php'); @@ -100,6 +100,7 @@ $Res = $cn->exec_sql($sql); ?>
    + @@ -123,7 +124,9 @@ foreach ($val as $row) echo ""; echo ''; - + echo ''; echo "
    Id Label Taux Commentaire
    '; + echo $row['tva_id']; + echo '"; echo HtmlInput::hidden('tva_id', $row['tva_id']); diff --git a/include/user_detail.inc.php b/include/user_detail.inc.php index 66df77c60..007c5aaee 100644 --- a/include/user_detail.inc.php +++ b/include/user_detail.inc.php @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr -/* ! \file +/** \file * \brief Users Security */ include_once("ac_common.php"); @@ -75,8 +75,12 @@ if (isset($_POST['SAVE'])) { $db_id = mb_substr($name, 4); $cn = new Database(); - $UserChange->set_folder_access($db_id, $elem); - Dossier::synchro_admin($db_id); + $name=$cn->format_name($db_id, "dos"); + if ( $cn->exist_database($name) == 1 ) + { + $UserChange->set_folder_access($db_id, $elem); + Dossier::synchro_admin($db_id); + } } } } diff --git a/include/user_menu.php b/include/user_menu.php index a1d6699f3..23f3caeca 100644 --- a/include/user_menu.php +++ b/include/user_menu.php @@ -135,15 +135,15 @@ function menu_acc_plan($p_start=1) $base="?ac=".$_REQUEST['ac']; $str_dossier="&".dossier::get(); echo ''; - echo ''; - echo ''; + echo ''; + echo ''; echo ''; echo ''; echo ''; - echo ''; - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; + echo ''; + echo ''; echo ''; echo "
    0'._(' Hors Bilan').'
    1'._(' Immobilisé').'
    0 '._(' Hors Bilan').'
    1 '._(' Immobilisé').'
    2 '._('Actif a un an au plus').'
    3 '._('Stock et commande').'
    4 '._('Compte tiers').'
    5'._('Actif').'
    6'._('Charges').'
    7'._('Produits').'
    8'._('Hors Comptabilité').'
    5 '._('Financier').'
    6 '._('Charges').'
    7 '._('Produits').'
    8 '._('Hors Comptabilité').'
    9 '._('Hors Comptabilité').'
    "; } diff --git a/sql/upgrade.sql b/sql/upgrade.sql index e69de29bb..dbda2d191 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -0,0 +1,104 @@ + +CREATE OR REPLACE FUNCTION comptaproc.insert_quick_code(nf_id integer, tav_text text) + RETURNS integer AS +$BODY$ + declare + ns integer; + nExist integer; + tText text; + begin + tText := lower(trim(tav_text)); + tText := replace(tText,' ',''); + tText := translate(tText,E' $€µ£%.+-/\\!(){}(),;_&|"#''^<>*',''); + tText := translate(tText,E'éèêëàâäïîüûùöôç','eeeeaaaiiuuuooc'); + + + loop + -- take the next sequence + select nextval('s_jnt_fic_att_value') into ns; + if length (tText) = 0 or tText is null then + tText := 'FID'||ns; + end if; + -- av_text already used ? + select count(*) into nExist + from fiche_detail + where + ad_id=23 and ad_value=upper(tText); + + if nExist = 0 then + exit; + end if; + tText:='FID'||ns; + end loop; + + + insert into fiche_detail(jft_id,f_id,ad_id,ad_value) values (ns,nf_id,23,upper(tText)); + return ns; + end; +$BODY$ + LANGUAGE plpgsql; + +CREATE OR REPLACE FUNCTION comptaproc.update_quick_code(njft_id integer, tav_text text) + RETURNS integer AS +$BODY$ + declare + ns integer; + nExist integer; + tText text; + old_qcode varchar; + begin + -- get current value + select ad_value into old_qcode from fiche_detail where jft_id=njft_id; + -- av_text didn't change so no update + if tav_text = upper( trim(old_qcode)) then + return 0; + end if; + + tText := trim(lower(tav_text)); + tText := replace(tText,' ',''); + tText := translate(tText,E' $€µ£%.+-/\\!(){}(),;_&|"#''^<>*',''); + tText := translate(tText,E'éèêëàâäïîüûùöôç','eeeeaaaiiuuuooc'); + tText := upper(tText); + if length ( tText) = 0 or tText is null then + return 0; + end if; + + ns := njft_id; + + loop + -- av_text already used ? + select count(*) into nExist + from fiche_detail + where + ad_id=23 and ad_value=tText; + + if nExist = 0 then + exit; + end if; + if tText = 'FID'||ns then + -- take the next sequence + select nextval('s_jnt_fic_att_value') into ns; + end if; + tText :='FID'||ns; + + end loop; + update fiche_detail set ad_value = tText where jft_id=njft_id; + + -- update also the contact + update fiche_detail set ad_value = tText + where jft_id in + ( select jft_id + from fiche_detail + where ad_id=25 and ad_value=old_qcode); + + + update jrnx set j_qcode=tText where j_qcode = old_qcode; + return ns; + end; +$BODY$ + LANGUAGE plpgsql; + + +alter table document_state add s_status char(1); + +update document_state set s_status='C' where s_id in (1,4) \ No newline at end of file