Beispiel #1
0
echo '</form>';
//-----------------------------------------------------
// Display search result
//-----------------------------------------------------
if (isset($_GET['viewsearch'])) {
    // Navigation bar
    $step = $_SESSION['g_pagesize'];
    $page = isset($_GET['offset']) ? $_GET['page'] : 1;
    $offset = isset($_GET['offset']) ? $_GET['offset'] : 0;
    if (count($_GET) == 0) {
        $array = null;
    } else {
        $array = $_GET;
    }
    $array['p_action'] = 'ALL';
    list($sql, $where) = $ledger->build_search_sql($array);
    // Count nb of line
    $max_line = $cn->count_sql($sql);
    list($count, $a) = $ledger->list_operation($sql, $offset, 0);
    $bar = navigation_bar($offset, $max_line, $step, $page);
    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);
        }
 *   You should have received a copy of the GNU General Public License
 *   along with NOALYSS; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/*!\file
 * \brief  history of the accountancy exported in CSV
 */
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
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,'[0-9]+\$')::numeric asc ";
$res = $cn->get_array($sql . $order);
printf('"%s";', "Internal");
printf('"%s";', "Journal");
printf('"%s";', "Date");
printf('"%s";', "Echeance");
printf('"%s";', "Paiement");
printf('"%s";', "Piece");
printf('"%s";"";', "Tiers");
printf('"%s";', "Description");
printf('"%s";', "Note");
printf('"%s"', "Montant opération");
printf("\r\n");
for ($i = 0; $i < count($res); $i++) {
    printf('"%s";', $res[$i]['jr_internal']);