noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
history_operation.inc.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  *   This file is part of NOALYSS.
00005  *
00006  *   NOALYSS is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   NOALYSS is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with NOALYSS; if not, write to the Free Software
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00022 
00023 /**\file
00024  *
00025  *
00026  * \brief
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 // Check privilege
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 // UPdate the payment
00088 //------------------------------
00089 if (isset($_GET ['paid']))
00090 {
00091         $Ledger->update_paid($_GET);
00092 }
00093 
00094 
00095 $msg="";
00096 /* by default we should use the default period */
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 /*  compute the sql stmt */
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  * Export to csv
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 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations