type='ODS'; break; case 'ALL': $Ledger=new Acc_Ledger($cn,0); $ask_pay=0; $p_array['ledger_type']='ALL'; $Ledger->type='ALL'; break; case 'VEN': $Ledger=new Acc_Ledger_Sold($cn,0); $ask_pay=1; break; case 'FIN': $Ledger=new Acc_Ledger_Fin($cn,0); $ask_pay=0; break; } echo '
'; // Check privilege $p_jrn=HtmlInput::default_value_request("p_jrn", -1); if (isset($_REQUEST['p_jrn']) && $g_user->check_jrn($_REQUEST['p_jrn']) == 'X') { NoAccess(); exit - 1; } $Ledger->id = $p_jrn; echo $Ledger->display_search_form(); //------------------------------ // UPdate the payment //------------------------------ if (isset($_GET ['paid'])) { $Ledger->update_paid($_GET); } $msg=""; /* by default we should use the default period */ if (!isset($p_array['date_start'])) { $period = $g_user->get_periode(); $per = new Periode($cn, $period); list($date_start, $date_end) = $per->get_date_limit(); $p_array['date_start'] = $date_start; $p_array['date_end'] = $date_end; $msg='

'._("Période ").$date_start._(" au ").$date_end.'

'; } else { $msg='

'._("Période ").$_GET['date_start']._(" au ").$_GET['date_end'].'

'; } /* compute the sql stmt */ list($sql, $where) = $Ledger->build_search_sql($p_array); $max_line = $cn->count_sql($sql); $step = $_SESSION['g_pagesize']; $page = (isset($_GET['offset'])) ? $_GET['page'] : 1; $offset = (isset($_GET['offset'])) ? $_GET['offset'] : 0; $bar = navigation_bar($offset, $max_line, $step, $page); echo $msg; echo '
'; echo HtmlInput::hidden("ac", $_REQUEST['ac']); echo HtmlInput::hidden('ledger_type',$ledger_type); echo dossier::hidden(); echo $bar; list($count, $html) = $Ledger->list_operation($sql, $offset, $ask_pay); echo $html; echo $bar; $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 $r; if ($ask_pay) 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_paid_start','date_paid_end', '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::hidden('act', 'CSV:histo'); echo HtmlInput::submit('viewsearch', _('Export vers CSV')); echo '
'; echo '
'; return; ?>