diff --git a/html/histo_csv.php b/html/histo_csv.php new file mode 100644 index 000000000..c755a7308 --- /dev/null +++ b/html/histo_csv.php @@ -0,0 +1,81 @@ +Check(); +$act=$user->check_dossier($gDossier); +if ( $act=='P') + { + redirect("extension.php?".dossier::get(),0); + exit(); + } +if ( $act=='X') + { + echo alert('Accès interdit'); + exit(); + } +$user->can_request(IMPJRN,0); + +header('Pragma: public'); +header('Content-type: application/csv'); +header('Content-Disposition: attachment;filename="histo-export.csv"',FALSE); + +$ledger=new Acc_Ledger($cn,0); +list($sql,$where)=$ledger->build_search_sql($_GET); + +$order=" order by jr_date_order asc,substring(jr_pj_number,'\\\d+$')::numeric asc "; + +$res=$cn->get_array($sql.$order); + +printf('"%s";',"Internal"); +printf('"%s";',"Journal"); +printf('"%s";',"Date"); +printf('"%s";',"Echeance"); +printf('"%s";',"Piece"); +printf('"%s";',"Description"); +printf('"%s";',"Note"); +printf('"%s"',"Montant"); +printf("\r\n"); + +for ($i=0;$iCheck(); - +$act=$User->check_dossier($gDossier); +if ($act =='P') +{ + redirect("extension.php?".dossier::get(),0); + exit(); +} +if ( $act=='X') + { + alert('Accès interdit'); + exit(); + } // display a search box $ledger=new Acc_Ledger($cn,0); @@ -77,7 +87,19 @@ if ( isset ($_GET['viewsearch'])) echo $bar; echo $a; echo $bar; - + /* + * Export to csv + */ + $r=HtmlInput::get_to_hidden(array('l','date_start','date_end','desc','amount_min','amount_max','qcode','accounting','unpaid','gDossier','ledger_type')); + if (isset($_GET['r_jrn'])) { + foreach ($_GET['r_jrn'] as $k=>$v) + $r.=HtmlInput::hidden('r_jrn['.$k.']',$v); + } + echo '
'; + echo $r; + echo HtmlInput::submit('viewsearch','Export vers CSV'); + echo HtmlInput::hidden('p_action','ALL'); + echo '
'; } echo ''; ?> diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php index 6423df6d8..70b8e5509 100644 --- a/include/class_acc_ledger.php +++ b/include/class_acc_ledger.php @@ -677,7 +677,7 @@ class Acc_Ledger { // date asc $sort_date="$image_sel_asc Date $image_desc"; - $order=" order by jr_date_order asc "; + $order=" order by jr_date_order asc,substring(jr_pj_number,'\\d+$')::numeric asc "; } // set a filter for the FIN $a_parm_code=$this->db->get_array("select p_value from parm_code where p_code in ('BANQUE','COMPTE_COURANT','CAISSE')"); diff --git a/include/class_html_input.php b/include/class_html_input.php index f41e6899c..6d2b3d328 100755 --- a/include/class_html_input.php +++ b/include/class_html_input.php @@ -425,5 +425,20 @@ class HtmlInput $p_qcode,$pname,$p_qcode); return $r; } + /** + *transform get to hidden + *@return html string with the hidden data + */ + static function get_to_hidden($array) + { + if ( count($_GET) == 0) return ""; + $r=""; + foreach ( $array as $a) + { + if (isset($_GET[$a])) $r.=HtmlInput::hidden($a,$_GET[$a]); + } + return $r; + } + } diff --git a/include/compta_ach.inc.php b/include/compta_ach.inc.php index 20ea2cbdf..8029f06f1 100644 --- a/include/compta_ach.inc.php +++ b/include/compta_ach.inc.php @@ -321,6 +321,19 @@ if ( $def == 2 ) echo '

'.HtmlInput::submit('paid',_('Mise à jour paiement')).IButton::select_checkbox('fpaida').IButton::unselect_checkbox('fpaida').'

'; echo ''; + /* + * Export to csv + */ + $r=HtmlInput::get_to_hidden(array('l','date_start','date_end','desc','amount_min','amount_max','qcode','accounting','unpaid','gDossier','ledger_type','p_action')); + if (isset($_GET['r_jrn'])) { + foreach ($_GET['r_jrn'] as $k=>$v) + $r.=HtmlInput::hidden('r_jrn['.$k.']',$v); + } + echo '
'; + echo $r; + echo HtmlInput::submit('viewsearch','Export vers CSV'); + + echo '
'; echo ''; exit(); diff --git a/include/compta_fin.inc.php b/include/compta_fin.inc.php index e5bf54ca7..b14fa9e0d 100644 --- a/include/compta_fin.inc.php +++ b/include/compta_fin.inc.php @@ -213,6 +213,19 @@ if ( $def == 2) list($count,$html)= $Ledger->list_operation($sql,$offset); echo $html; echo $bar; + /* + * Export to csv + */ + $r=HtmlInput::get_to_hidden(array('l','date_start','date_end','desc','amount_min','amount_max','qcode','accounting','unpaid','gDossier','ledger_type','p_action')); + if (isset($_GET['r_jrn'])) { + foreach ($_GET['r_jrn'] as $k=>$v) + $r.=HtmlInput::hidden('r_jrn['.$k.']',$v); + } + echo '
'; + echo $r; + echo HtmlInput::submit('viewsearch','Export vers CSV'); + + echo '
'; echo ''; exit(); diff --git a/include/compta_ven.inc.php b/include/compta_ven.inc.php index da98622d7..288912091 100644 --- a/include/compta_ven.inc.php +++ b/include/compta_ven.inc.php @@ -343,6 +343,20 @@ if ( $def == 2 ) echo ''; + /* + * Export to csv + */ + $r=HtmlInput::get_to_hidden(array('l','date_start','date_end','desc','amount_min','amount_max','qcode','accounting','unpaid','gDossier','ledger_type','p_action')); + if (isset($_GET['r_jrn'])) { + foreach ($_GET['r_jrn'] as $k=>$v) + $r.=HtmlInput::hidden('r_jrn['.$k.']',$v); + } + echo '
'; + echo $r; + echo HtmlInput::submit('viewsearch','Export vers CSV'); + + echo '
'; + echo ''; exit(); diff --git a/include/quick_writing.inc.php b/include/quick_writing.inc.php index 07f3dd443..9ec1cde99 100644 --- a/include/quick_writing.inc.php +++ b/include/quick_writing.inc.php @@ -191,6 +191,20 @@ if ($sa == 'l' && $id != -1) list($count,$html)= $Ledger->list_operation($sql,$offset,0); echo $html; echo $bar; + /* + * Export to csv + */ + $r=HtmlInput::get_to_hidden(array('l','date_start','date_end','desc','amount_min','amount_max','qcode','accounting','unpaid','gDossier','ledger_type','p_action')); + if (isset($_GET['r_jrn'])) { + foreach ($_GET['r_jrn'] as $k=>$v) + $r.=HtmlInput::hidden('r_jrn['.$k.']',$v); + } + echo '
'; + echo $r; + echo HtmlInput::submit('viewsearch','Export vers CSV'); + + echo '
'; + echo ''; exit(); } diff --git a/include/user_action_gl.php b/include/user_action_gl.php index 3acda3af6..16d047959 100644 --- a/include/user_action_gl.php +++ b/include/user_action_gl.php @@ -31,12 +31,6 @@ $cn=new Database($gDossier); require_once('class_iposte.php'); require_once('class_ipopup.php'); -$search_card=new IPopup('ipop_card'); -$search_card->title=_('Recherche de fiche'); -$search_card->value=''; -echo $search_card->input(); - -echo IPoste::ipopup('ipop_account'); echo '
'; @@ -48,7 +42,7 @@ if ( !isset($_REQUEST['p_jrn'])) else $Ledger->id=$_REQUEST['p_jrn']; echo $Ledger->display_search_form(); - +echo '
'; /* compute the sql stmt */ list($sql,$where)=$Ledger->build_search_sql($_GET); @@ -73,6 +67,20 @@ list($count,$html)= $Ledger->list_operation($sql,$offset); echo $html; echo $bar; +/* + * Export to csv + */ +$r=HtmlInput::get_to_hidden(array('l','date_start','date_end','desc','amount_min','amount_max','qcode','accounting','unpaid','gDossier','ledger_type')); +if (isset($_GET['r_jrn'])) { + foreach ($_GET['r_jrn'] as $k=>$v) + $r.=HtmlInput::hidden('r_jrn['.$k.']',$v); +} +echo '
'; +echo $r; +echo HtmlInput::submit('viewsearch','Export vers CSV'); +echo HtmlInput::hidden('p_action','ALL'); +echo '
'; + ?>