00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00030 require_once 'class_acc_ledger_purchase.php';
00031 require_once 'class_acc_ledger_fin.php';
00032 require_once 'class_acc_ledger_sold.php';
00033 require_once 'class_acc_ledger.php';
00034 global $g_user,$cn;
00035 $p_array = $_GET;
00036 if ( isset ($_GET['ledger_type']))
00037 {
00038 $ledger_type=$_GET['ledger_type'];
00039 switch($ledger_type)
00040 {
00041 case 'ACH':
00042 $Ledger = new Acc_Ledger_Purchase($cn, 0);
00043 $ask_pay=1;
00044 break;
00045 case 'ODS':
00046 $Ledger=new Acc_Ledger($cn,0);
00047 $ask_pay=0;
00048 $p_array['ledger_type']='ODS';
00049 $Ledger->type='ODS';
00050 break;
00051 case 'ALL':
00052 $Ledger=new Acc_Ledger($cn,0);
00053 $ask_pay=0;
00054 $p_array['ledger_type']='ALL';
00055 $Ledger->type='ALL';
00056 break;
00057 case 'VEN':
00058 $Ledger=new Acc_Ledger_Sold($cn,0);
00059 $ask_pay=1;
00060 break;
00061 case 'FIN':
00062 $Ledger=new Acc_Ledger_Fin($cn,0);
00063 $ask_pay=0;
00064 break;
00065
00066 }
00067 }
00068 echo '<div class="content">';
00069
00070 if (isset($_REQUEST['p_jrn']) &&
00071 $g_user->check_jrn($_REQUEST['p_jrn']) == 'X')
00072 {
00073
00074 NoAccess();
00075 exit - 1;
00076 }
00077
00078
00079 if (!isset($_REQUEST['p_jrn']))
00080 {
00081 $Ledger->id = -1;
00082 }
00083 else
00084 $Ledger->id = $_REQUEST['p_jrn'];
00085 echo $Ledger->display_search_form();
00086
00087
00088
00089 if (isset($_GET ['paid']))
00090 {
00091 $Ledger->update_paid($_GET);
00092 }
00093
00094
00095 $msg="";
00096
00097 if (!isset($p_array['date_start']))
00098 {
00099 $period = $g_user->get_periode();
00100 $per = new Periode($cn, $period);
00101 list($date_start, $date_end) = $per->get_date_limit();
00102 $p_array['date_start'] = $date_start;
00103 $p_array['date_end'] = $date_end;
00104 $msg='<h2 class="info2">'."Période ".$date_start." au ".$date_end.'</h2>';
00105 }
00106 else
00107 {
00108 $msg='<h2 class="info2">'."Période ".$_GET['date_start']." au ".$_GET['date_end'].'</h2>';
00109
00110 }
00111
00112 list($sql, $where) = $Ledger->build_search_sql($p_array);
00113
00114 $max_line = $cn->count_sql($sql);
00115
00116 $step = $_SESSION['g_pagesize'];
00117 $page = (isset($_GET['offset'])) ? $_GET['page'] : 1;
00118 $offset = (isset($_GET['offset'])) ? $_GET['offset'] : 0;
00119 $bar = navigation_bar($offset, $max_line, $step, $page);
00120
00121 echo $msg;
00122 echo '<form method="GET" id="fpaida" class="print">';
00123 echo HtmlInput::hidden("ac", $_REQUEST['ac']);
00124 echo HtmlInput::hidden('ledger_type',$_REQUEST['ledger_type']);
00125 echo dossier::hidden();
00126 echo $bar;
00127
00128 list($count, $html) = $Ledger->list_operation($sql, $offset, $ask_pay);
00129 echo $html;
00130 echo $bar;
00131 $r = HtmlInput::get_to_hidden(array('l', 'date_start', 'date_end', 'desc', 'amount_min', 'amount_max', 'qcode', 'accounting', 'unpaid', 'gDossier', 'ledger_type', 'p_action'));
00132 if (isset($_GET['r_jrn']))
00133 {
00134 foreach ($_GET['r_jrn'] as $k => $v)
00135 $r.=HtmlInput::hidden('r_jrn[' . $k . ']', $v);
00136 }
00137 echo $r;
00138
00139 if ($ask_pay)
00140 echo '<p>' . HtmlInput::submit('paid', _('Mise à jour paiement')) . IButton::select_checkbox('fpaida') . IButton::unselect_checkbox('fpaida') . '</p>';
00141
00142 echo '</form>';
00143
00144
00145
00146 $r = HtmlInput::get_to_hidden(array('l', 'date_paid_start','date_paid_end',
00147 'date_start', 'date_end', 'desc', 'amount_min', 'amount_max', 'qcode',
00148 'accounting', 'unpaid', 'gDossier', 'ledger_type', 'p_action'));
00149 if (isset($_GET['r_jrn']))
00150 {
00151 foreach ($_GET['r_jrn'] as $k => $v)
00152 $r.=HtmlInput::hidden('r_jrn[' . $k . ']', $v);
00153 }
00154 echo '<form action="export.php" method="get">';
00155 echo $r;
00156 echo HtmlInput::hidden('act', 'CSV:histo');
00157 echo HtmlInput::submit('viewsearch', 'Export vers CSV');
00158
00159 echo '</form>';
00160
00161 echo '</div>';
00162 exit();
00163 ?>