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