noalyss Version-9
ledger_detail_bottom.php
Go to the documentation of this file.
1<hr>
2<?php
3
4/**
5//This file is part of NOALYSS and is under GPL
6//see licence.txt
7*/
8/**
9 * @brief show the common parts of operation details
10 *
11 * Variables : $div = popup or box (det[0-9]
12 *
13 */
15$select_box=new \Select_Box("sb_".$jr_id, _("Autre action"));
16$select_box->set_position("normal");
18// Contains all the linked actions
20//
21// Contains all the linked operations
24$aRap=$oRap->get();
25
26// Detail of operation
27 $detail = new Acc_Misc($cn, $obj->jr_id);
28 $detail->get();
29
30 // find out exercice
31 $periode_id=new Periode($cn,$detail->det->jr_tech_per);
32 $exercice=$periode_id->get_exercice();
33
34
35$nb_document=($detail->det->jr_pj_name != "")?1:0;
36
37$nb_aRap=(is_array($aRap))?count($aRap):0;
38// Array of tab
39//
40$a_tab['writing_div']=array('id'=>'writing_div'.$div,'label'=>_('Ecriture Comptable'),'display'=>'none');
41$a_tab['info_operation_div']=array('id'=>'info_operation_div'.$div,'label'=>_('Information'),'display'=>'none');
42$a_tab['linked_operation_div']=array('id'=>'linked_operation_div'.$div,'label'=>_('Opérations liées').'('.$nb_aRap.')','display'=>'none');
43$a_tab['document_operation_div']=array('id'=>'document_operation_div'.$div,'label'=>_('Document').'('.$nb_document.')','display'=>'block');
44$a_tab['linked_action_div']=array('id'=>'linked_action_div'.$div,'label'=>_('Actions Gestion').'('.count($a_followup).')','display'=>'none');
45$a_tab['analytic_div']=array('id'=>'analytic_div'.$div,'label'=>_('Comptabilité Analytique'),'display'=>'none');
46
47
48
49// show tabs
50if ( $div != "popup") :
51 $a_tab['document_operation_div']['display']='block';
52?>
53<ul class="tabs">
54 <?php foreach ($a_tab as $idx=>$a_value): ?>
55 <?php
56 $class=($a_value['display']=='block') ?"tabs_selected":"tabs"
57 ?>
58 <li class="<?php echo $class?>">
59 <?php $div_tab_id=$a_value['id'];?>
60 <a href="javascript:void(0)" onclick="unselect_other_tab(this.parentNode.parentNode);var tab=Array('writing_div<?php echo $div?>','info_operation_div<?php echo $div?>','linked_operation_div<?php echo $div?>','document_operation_div<?php echo $div?>','linked_action_div<?php echo $div?>','analytic_div<?php echo $div?>');this.parentNode.className='tabs_selected' ;show_tabs(tab,'<?php echo $div_tab_id; ?>');"><?php echo _($a_value['label'])?></a>
61 </li>
62 <?php endforeach; ?>
63</ul>
64<div style="clear:both"></div>
65<?php
67 foreach ($a_tab as $idx=>$a_value):
68 $a_tab[$idx]['display']='block';
71?>
72
73
74<?php
75 $cmd=new IText('BON_COMMANDE',$obj->info->command);
76 $other=new IText('OTHER',$obj->info->other);
77?>
78 <div id="writing_div<?php echo $div;?>" class="myfieldset" style="display:<?php echo $a_tab['writing_div']['display']?>">
79 <?php
80 // display title only in popup
81 if ($div == 'popup') :
82 ?>
83 <h1 class="legend"><?php echo $a_tab['writing_div']['label']?></h1>
84 <?php endif; ?>
85
86<div class="content">
87 <?php
88
89 ?>
90 <table class="result">
91 <tr>
92 <?php
93 echo th(_('Poste Comptable'));
94 echo th(_('Quick Code'));
95 echo th(_('Libellé'));
96 echo th(_('Débit'), ' style="text-align:right"');
97 echo th(_('Crédit'), ' style="text-align:right"');
98 echo '</tr>';
99 for ($e = 0; $e < count($detail->det->array); $e++)
100 {
101 $row = '';
102 $q = $detail->det->array;
103 $view_history = HtmlInput::history_account($q[$e]['j_poste'], $q[$e]['j_poste'], "", $exercice);
104
105 $row.=td($view_history);
106 if ($q[$e]['j_qcode'] != '')
107 {
108 $fiche = new Fiche($cn);
109 $fiche->get_by_qcode($q[$e]['j_qcode']);
110 $view_history = HtmlInput::history_card($fiche->id, $q[$e]['j_qcode'],"",$exercice);
111 } else
112 $view_history = '';
113 $row.=td($view_history);
114
115 if ($q[$e]['j_text']=="")
116 {
117 if ($q[$e]['j_qcode'] != '')
118 {
119 // nom de la fiche
120 $ff = new Fiche($cn);
121 $ff->get_by_qcode($q[$e]['j_qcode']);
122 $row.=td($ff->strAttribut(h(ATTR_DEF_NAME)));
123 } else
124 {
125 // libellé du compte
126 $name = $cn->get_value('select pcm_lib from tmp_pcmn where pcm_val=$1', array($q[$e]['j_poste']));
127 $row.=td(h($name));
128 }
129 }
130 else
131 $row.=td(h($q[$e]['j_text']));
132
133 $montant = td(nbm($q[$e]['j_montant']), 'class="num"');
134 $row.=($q[$e]['j_debit'] == 't') ? $montant : td('');
135 $row.=($q[$e]['j_debit'] == 'f') ? $montant : td('');
136 $class=($e%2==0)?' class="even"':'class="odd"';
137
138 echo tr($row,$class);
139 }
140 ?>
141 </table>
142 </div>
143</div>
144<div id="info_operation_div<?php echo $div;?>" class="myfieldset" style="display:<?php echo $a_tab['info_operation_div']['display']?>">
145 <?php
146 // display title only in popup
147 if ($div == 'popup') :
148 ?>
149 <h1 class="legend"><?php echo $a_tab['info_operation_div']['label']?></h1>
150 <?php endif; ?>
151 <table>
152 <tr>
153 <td><?php echo _(" Bon de commande")?> :</td><td> <?php echo Icon_Action::infobulle(31)." ".$cmd->input(); ?></td>
154 </tr>
155 <tr>
156 <td> <?php echo _("Autre information")?> : </td><td><?php echo Icon_Action::infobulle(30)." ".$other->input();?></td>
157 </tr>
158 <tr>
159 <td>
160 <?=_("Type opération")?>
161 </td>
162 <td>
163 <?php
164 // Opération type
165
166 echo Acc_Operation::select_operation_type($detail->det->jr_optype)->input();
167 ?>
168 </td>
169 </tr>
170 </table>
171</div>
172<div id="linked_operation_div<?php echo $div;?>" style="display:<?php echo $a_tab['linked_operation_div']['display']?>" class="myfieldset">
173 <?php
174 // display title only in popup
175 if ($div == 'popup') :
176 ?> er
177 <h1 class="legend"><?php echo $a_tab['linked_operation_div']['label']?></h1>
178 <?php endif; ?>
179<?php
180
181if ($aRap != null ) {
182 $amount_tva_include=(isset($total_tvac))?$total_tvac:$detail->det->jr_montant;
183 $tableid="tb".$div;
184 $total_rec=0;
186 $operation->set_id($jr_id);
187 echo '<table id="'.$tableid.'">';
188 for ($e=0;$e<count($aRap);$e++) {
189 $opRap=new Acc_Operation($cn);
190 $opRap->jr_id=$aRap[$e];
191 $internal=$opRap->get_internal();
192 $array_jr=$cn->get_array('select jr_date,jr_pj_number,jr_montant,jr_comment , jr_internal ,jr_optype
193 from jrn where jr_id=$1',
194 array($aRap[$e]));
195 $amount=$array_jr[0]['jr_montant'];
196 switch (substr($array_jr[0]['jr_internal'],0,1)) {
197 case 'A':
198 $amount = $cn->get_value("select sum(qp_price+qp_vat-qp_vat_sided) from quant_purchase qp
199 where qp_internal=$1",
200 array($internal));
201 // add additional tax if any
202 $add=$operation->get_sum_other_tax();
204 break;
205 case 'V':
206 $amount=$cn->get_value("select sum(qs_price+qs_vat-qs_vat_sided) from quant_sold qs
207 where qs_internal=$1",
208 array($internal));
209 // add additional tax if any
210 $add=$operation->get_sum_other_tax();
211 $amount=bcadd($amount??0,$add??0,2);
212 break;
213 }
214 $total_rec=bcadd($total_rec,$amount??0);
215 $str="modifyOperation(".$aRap[$e].",".$gDossier.")";
216
217 // If write access , allow to drop Reconciles operations
218 if ( $access=='W') {
219 $js="return confirm_box(null,'"._("vous confirmez?")."',";
220 $js.=sprintf('function () { dropLink(\'%s\',\'%s\',\'%s\',\'%s\');deleteRowRec(\'%s\',$(\'row%d\'));})',
221 $gDossier,
222 $div,
223 $jr_id,
224 $aRap[$e],
225 $tableid,
226 $e
227 );
228 $remove=Icon_Action::trash(uniqid(), $js);
229 }
230 else
231 $remove='';
232
233 $comment=strip_tags($array_jr[0]['jr_comment']??"");
234 $pj_nb=h($array_jr[0]['jr_pj_number']);
235 echo tr (td(format_date($array_jr[0]['jr_date'])).
236 td('<a class="line" href="javascript:void(0)" onclick="'.$str.'" >'.$internal.'</A>').
237 td($pj_nb).
238 td($comment).
239 td(_('montant').'='.nbm($amount)).
240 td(_('delta').'='.nbm(bcsub(abs($amount_tva_include),abs($total_rec)))).
241 td($remove),' id = "row'.$e.'"');
242 }
243 echo '</table>';
244}
245?>
246<?php
247if ( $access=='W') {
248 $wConcerned=new IConcerned("rapt".$div);
249 $wConcerned->amount_id=$obj->det->jr_montant;
250 $wConcerned->div="search_reconcile";
251 $wConcerned->set_hideOperation( $obj->jr_id);
252 echo $wConcerned->input();
253
254}
255?>
256</div>
257<div id="linked_action_div<?php echo $div;?>" style="display:<?php echo $a_tab['linked_action_div']['display']?>" class="myfieldset">
258 <?php
259 // display title only in popup
260 if ($div == 'popup') :
261 ?>
262 <h1 class="legend"><?php echo $a_tab['linked_action_div']['label']?></h1>
263 <?php endif; ?>
264<?php
265/**
266 * show possible linked actions
267 */
268echo '<ul style="list-style-type:square;">';
269for ($i = 0; $i < count($a_followup); $i++)
270{
271 $remove='';
273 if ( $div == 'popup')
274 {
275 echo '<li id="op'.$a_followup[$i]['ago_id'].'">'.HtmlInput::detail_action($a_followup[$i]['ag_id'], h($a_followup[$i]['ag_ref']." ".$a_followup[$i]['ag_title']),0).$remove.'</li>';
276 }
277 else
278 {
279 echo '<li id="op'.$a_followup[$i]['ago_id'].'">'.HtmlInput::detail_action($a_followup[$i]['ag_id'], h($a_followup[$i]['ag_ref']." ".$a_followup[$i]['ag_title']),1).$remove.'</li>';
280 }
281}
282echo '</ul>';
283$related=new IRelated_Action('related');
284$related->id='related'.$div;
285 if ( $access=='W') echo $related->input();
286echo '</div>';
287?>
288
289<?php
290
291require_once NOALYSS_TEMPLATE.'/ledger_detail_file.php';
292?>
293
294
295<div id="analytic_div<?php echo $div;?>" style="overflow:auto;display:<?php echo $a_tab['analytic_div']['display']?>">
296 <?php
297 if ($div == 'popup') :
298 ?>
299 <h1 class="legend"><?php echo $a_tab['analytic_div']['label']?></h1>
300 <?php endif; ?>
301 <?php if ( $owner->MY_ANALYTIC != "nu") :
302 if ( strpos($str_anc,'<td>') == true ):
303 ?>
304
305 <table class="result">
306 <?php echo $str_anc;?>
307 </table>
308 <?php else: ?>
309 <span class="notice">
310 <?php echo _('Aucune donnée'); ?>
311 </span>
312 <?php endif;?>
313<?php else:?>
314 <span class="notice">
315 <?php echo _('Non utilisée'); ?>
316 </span>
317<?php endif;?>
318</div>
319
320<hr>
321<?php
322 echo '<p style="text-align:center">';
323
324if ( $div != 'popup' ) {
325 $a=new IButton('Fermer',_('Fermer'));
326 $a->label=_("Fermer");
327 $a->javascript="removeDiv('".$div."')";
328 echo $a->input();
329} else {
330 echo HtmlInput::hidden('p_jrn',$oLedger->id);
331}
332
333?>
334
335<?php
336
337/**
338 * if you can write
339 */
340 if ( $access=='W') {
341 echo HtmlInput::submit('save',_('Sauver'),'onClick="return verify_ca(\'popup\');"');
343 if ($owner->MY_ANALYTIC != 'nu' /*&& $div=='popup' */){
344
345 $select_box->add_javascript(_("Vérification CA"), sprintf("verify_ca('%s')",$div));
346 }
347
348 $per=new Periode($cn,$obj->det->jr_tech_per);
349 if ( $per->is_closed() == 0 && $owner->MY_STRICT=='N' && $g_user->check_action(RMOPER)==1)
350 {
351 $javascript="return confirm_box(null,content[50],function () {removeOperation('".$obj->det->jr_id."',".dossier::id().",'".$div."')})";
352 $select_box->add_javascript(_("Supprimer"), $javascript);
353 }
354 //----------------------------------------------------
355 // Extourne
356 //----------------------------------------------------
357 $select_box->add_javascript(_("Extourne"), sprintf("g('ext%s').style.display='block'",$div));
358
359 //-------------------------------------------------------------------
360 // Duplicate
361 //-------------------------------------------------------------------
362 $select_box->add_javascript(_("Dupliquer"),sprintf("duplicate_operation('%s','%s')",Dossier::id(),$obj->jr_id));
363
364 //-------------------------------------------------------------------
365 // Export PDF
366 //-------------------------------------------------------------------
367 $select_box->add_url(_("Export PDF"), "export.php?".
368 http_build_query(array("act"=>"PDF:operation_detail","gDossier"=>Dossier::id(),"operation_id"=>$obj->jr_id)));
369
370
371echo $select_box->input();
372echo '</p>';
373echo '</form>';
374
375 echo '<div id="ext'.$div.'" class="inner_box" style="position:absolute;top:40px;display:none">';
376 $date=new IDate('ext_date');
377 $extourne_label=new IText("ext_label");
378 $extourne_label->size=40;
379 $r="<form id=\"form_".$div."\" onsubmit=\"return false;\">";
380 $r.=HtmlInput::hidden('jr_id',$obj->jr_id)
381 . HtmlInput::hidden('div',$div).dossier::hidden().HtmlInput::hidden('act','reverseop');
382 $r.=HtmlInput::title_box(_('Extourner'), 'ext'.$div, 'hide');
383 $r.="<p>";
384 $r.= _("Extourner une opération vous permet de l'annuler par son écriture inverse");
385 $r.="</p>";
386
387 $r.="<p>";
388 $r.=_("entrez une date")." :".$date->input();
389 $r.="</p>";
390
391 $r.="<p>";
392 $r.=_("Libellé")." :".$extourne_label->input();
393 $r.="</p>";
394
395
396 $r.='<p style="text-align:center">';
397 $r.=HtmlInput::submit('x','accepter',
398 'onclick="confirm_box($(\'form_'.$div.'\'),content[50],function () {$(\'form_'.$div.'\').divname=\''.$div.'\';reverseOperation($(\'form_'.$div.'\'))}); return false"');
399 $r.=HtmlInput::button_hide( "ext".$div);
400 $r.="</p>";
401 $r.='</form>';
402 echo $r;
403 echo '</div>';
404
405
406
407}else {
408 echo '</p>';
409}
410?>
format_date($p_date, $p_from_format='YYYY-MM-DD', $p_to_format='DD.MM.YYYY')
format the date, when taken from the database the format is MM-DD-YYYY
Definition: ac_common.php:852
noalyss_bcadd($p_first, $p_second, $p_decimal=4)
Definition: ac_common.php:1563
th($p_string, $p_extra='', $raw='')
Definition: ac_common.php:58
span($p_string, $p_extra='')
Definition: ac_common.php:43
h1($p_string, $p_class="")
Definition: ac_common.php:72
tr($p_string, $p_extra='')
Definition: ac_common.php:88
p($p_string)
Definition: ac_common.php:39
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
nbm($p_number, $p_dec=2)
format the number with a sep.
Definition: ac_common.php:137
global $g_user
if no group available , then stop
if(!headers_sent()) else
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
h( $row[ 'oa_description'])
$idx
$div
if($ledger=="") $access
$jr_id
Definition: ajax_ledger.php:44
$opd_description style
$input_from id
Definition: balance.inc.php:63
else $card content[$j]['j_montant']
$class
this class manage data from the JRNX and JRN table
this file match the tables jrn & jrnx the purpose is to remove or save accountant writing to these ta...
static select_operation_type($p_status)
Return a select object to choose the type of operation.
new class for managing the reconciliation it must be used instead of the function InsertRapt,...
static id()
return the 'gDossier' value after a check
static connect()
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
Definition: fiche.class.php:38
static get_all_operation($p_jr_id)
static detail_action($ag_id, $p_mesg, $p_modify=1)
return an anchor to view the detail of an action
static history_account($p_account, $p_mesg, $p_style="", $p_exercice="")
display a div with the history of the account
static button_action_remove_operation($p_operation)
static hidden($p_name, $p_value, $p_id="")
static title_box($p_name, $p_div, $p_mod="close", $p_js="", $p_draggable="n", $p_enlarge='n')
Title for boxes, you can customize the symbol thanks symbol with the mode "custom".
static history_card($f_id, $p_mesg, $p_style="", $p_exercice="")
display a div with the history of the card
static submit($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
Html Input.
Html Input.
Html Input : Input a date format dd.mm.yyyy The property title should be set to indicate what it is e...
Definition: idate.class.php:34
Html Input.
Definition: itext.class.php:30
static infobulle($p_comment)
Display a info in a bubble, text is in message_javascript.
static trash($p_id, $p_javascript)
Display the icon of a trashbin.
static echo_file($msg, $print=true)
display the file
Definition: dbg.php:88
Class to manage the company parameter (address, name...)
For the periode tables parm_periode and jrn_periode.
$all table
const ATTR_DEF_NAME
Definition: constant.php:216
const RMOPER
$str
Definition: fiche.inc.php:91
$a_tab['writing_div']