noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
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 *@var $obj = Acc_Operation
13 *@var $str_anc = HTML for analytic
14 */
15bcscale(2);
17$select_box=new \Select_Box("sb_".$jr_id, _("Autre action"));
18$select_box->set_position("normal");
19$cn=Dossier::connect();
20// Contains all the linked actions
22//
23// Contains all the linked operations
26$aRap=$oRap->get();
27
28// Detail of operation
29 $detail = new Acc_Misc($cn, $obj->jr_id);
30 $detail->get();
31
32 // find out exercice
33 $periode_id=new Periode($cn,$detail->det->jr_tech_per);
34 $exercice=$periode_id->get_exercice();
35
36// @var $nb_document (int) number of doc
37$nb_document=($detail->det->jr_pj_name != "")?1:0;
38// @var $str_nb_doc (string) HTML span number of doc
39$str_nb_doc=($nb_document==0)?span(""):span($nb_document,'class="nb-round"');
40
41// @var $nb_aRap (int) number of reconciliation
42$nb_aRap=(is_array($aRap))?count($aRap):0;
43// @var $str_nb_rap (string) HTML span for number of reconciliation
44$str_nb_rap=($nb_aRap==0)?span(""):span($nb_aRap,'class="nb-round"');
45
46//@var $nb_sup_doc (int) number of supplementary documents
47$nb_sup_doc=$cn->get_value("select count(*) from jrn_sup_document where jr_id=$1",[$jr_id]);
48
49// @var $str_nb_sup_doc (string) HTML span for the number of supplementary documents
50$x=sprintf('id="%s_%s"',"doc_supp",$div);
51$str_nb_sup_doc=($nb_sup_doc==0)?span("",$x):span($nb_sup_doc,'class="nb-round" '.$x);
52
53// @var $nb_fu (int) number of event in follow-up
55// @var $str_nb_fu (string) HTML span for the number of followup
56$str_nb_fu=($nb_fu==0)?span(""):span($nb_fu,'class="nb-round"');
57
58// Array of tab
59//
60$a_tab['writing_div']=array('id'=>'writing_div'.$div,'label'=>_('Ecriture Comptable'),'display'=>'none');
61$a_tab['info_operation_div']=array('id'=>'info_operation_div'.$div,'label'=>_('Information'),'display'=>'none');
62$a_tab['linked_operation_div']=array('id'=>'linked_operation_div'.$div,'label'=>_('Opérations liées').$str_nb_rap,'display'=>'none');
63$a_tab['document_operation_div']=array('id'=>'document_operation_div'.$div,'label'=>_('Document').$str_nb_doc,'display'=>'block');
64$a_tab['linked_action_div']=array('id'=>'linked_action_div'.$div,'label'=>_('Actions Gestion').$str_nb_fu,'display'=>'none');
65$a_tab['analytic_div']=array('id'=>'analytic_div'.$div,'label'=>_('Comptabilité Analytique'),'display'=>'none');
66$a_tab['supplemental_doc_div']=array('id'=>'supplemental_doc_div'.$div,'label'=>_('Documents supplémentaires').$str_nb_sup_doc,'display'=>'none');
67//var $g_parameter \Noalyss_Parameter_Folder
69
70
71
72// show tabs
73if ( $div != "popup") :
74 $a_tab['document_operation_div']['display']='block';
75 $tabs=array_column($a_tab,"id");
76
77?>
78<input type="hidden" id="<?=$div?>tab" value="<?=join(",",$tabs)?>">
79<ul class="tabs">
80 <?php foreach ($a_tab as $idx=>$a_value): ?>
81 <?php
82 $class=($a_value['display']=='block') ?"tabs_selected":"tabs"
83 ?>
84 <li class="<?php echo $class?>">
85 <?php $div_tab_id=$a_value['id'];?>
86 <?php if ( $div_tab_id == "supplemental_doc_div".$div):?>
87 <a href="javascript:void(0)" onclick="unselect_other_tab(this.parentNode.parentNode);this.parentNode.className='tabs_selected' ;Supplement_Document.refresh_list('<?=\Dossier::id()?>','<?=$div?>','<?=$obj->jr_id?>');show_tabs($F('<?=$div?>tab').split(','),'<?php echo $div_tab_id; ?>');"><?php echo _($a_value['label'])?></a>
88 <?php else: ?>
89 <a href="javascript:void(0)" onclick="unselect_other_tab(this.parentNode.parentNode);this.parentNode.className='tabs_selected' ;show_tabs($F('<?=$div?>tab').split(','),'<?php echo $div_tab_id; ?>');"><?php echo _($a_value['label'])?></a>
90 <?php endif; ?>
91 </li>
92 <?php endforeach; ?>
93</ul>
94<div style="clear:both"></div>
95<?php
97 foreach ($a_tab as $idx=>$a_value):
98 $a_tab[$idx]['display']='block';
101?>
102
103
104<?php
105 $cmd=new IText('BON_COMMANDE',$obj->info->command);
106 $other=new IText('OTHER',$obj->info->other);
107?>
108 <div id="writing_div<?php echo $div;?>" class="myfieldset" style="display:<?php echo $a_tab['writing_div']['display']?>">
109 <?php
110 // display title only in popup
111 if ($div == 'popup') :
112 ?>
113 <h1 class="legend"><?php echo $a_tab['writing_div']['label']?></h1>
114 <?php endif; ?>
115
116<div class="content">
117 <?php
118
119 ?>
120 <table class="result">
121 <tr>
122 <?php
123 echo th(_('Poste Comptable'));
124 echo th(_('Quick Code'));
125 echo th(_('Libellé'));
126 echo th(_('Débit'), ' style="text-align:right"');
127 echo th(_('Crédit'), ' style="text-align:right"');
128 echo '</tr>';
129 for ($e = 0; $e < count($detail->det->array); $e++)
130 {
131 $row = '';
132 $q = $detail->det->array;
133 $view_history = HtmlInput::history_account($q[$e]['j_poste'], $q[$e]['j_poste'], "", $exercice);
134
135 $row.=td($view_history);
136 if ($q[$e]['j_qcode'] != '')
137 {
138 $fiche = new Fiche($cn);
139 $fiche->get_by_qcode($q[$e]['j_qcode']);
140 $view_history = HtmlInput::history_card($fiche->id, $q[$e]['j_qcode'],"",$exercice);
141 } else
142 $view_history = '';
143 $row.=td($view_history);
144
145 if ($q[$e]['j_text']=="")
146 {
147 if ($q[$e]['j_qcode'] != '')
148 {
149 // nom de la fiche
150 $ff = new Fiche($cn);
151 $ff->get_by_qcode($q[$e]['j_qcode']);
152 $row.=td($ff->get_attribute(h(ATTR_DEF_NAME)));
153 } else
154 {
155 // libellé du compte
156 $name = $cn->get_value('select pcm_lib from tmp_pcmn where pcm_val=$1', array($q[$e]['j_poste']));
157 $row.=td(h($name));
158 }
159 }
160 else
161 $row.=td(h($q[$e]['j_text']));
162
163 $montant = td(nbm($q[$e]['j_montant']), 'class="num"');
164 $row.=($q[$e]['j_debit'] == 't') ? $montant : td('');
165 $row.=($q[$e]['j_debit'] == 'f') ? $montant : td('');
166 $class=($e%2==0)?' class="even"':'class="odd"';
167
168 echo tr($row,$class);
169 }
170 ?>
171 </table>
172 </div>
173</div>
174<div id="info_operation_div<?php echo $div;?>" class="myfieldset" style="display:<?php echo $a_tab['info_operation_div']['display']?>">
175 <?php
176 // display title only in popup
177 if ($div == 'popup') :
178 ?>
179 <h1 class="legend"><?php echo $a_tab['info_operation_div']['label']?></h1>
180 <?php endif; ?>
181 <table>
182 <tr>
183 <td><?php echo _(" Bon de commande")?> :</td><td> <?php echo Icon_Action::infobulle(31)." ".$cmd->input(); ?></td>
184 </tr>
185 <tr>
186 <td> <?php echo _("Autre information")?> : </td><td><?php echo Icon_Action::infobulle(30)." ".$other->input();?></td>
187 </tr>
188 <tr>
189 <td>
190 <?=_("Type opération")?>
191 </td>
192 <td>
193 <?php
194 // Opération type
195
196 echo Acc_Operation::select_operation_type($detail->det->jr_optype)->input();
197 ?>
198 </td>
199 </tr>
200 </table>
201</div>
202<div id="linked_operation_div<?php echo $div;?>" style="display:<?php echo $a_tab['linked_operation_div']['display']?>" class="myfieldset">
203 <?php
204 // display title only in popup
205 if ($div == 'popup') :
206 ?> er
207 <h1 class="legend"><?php echo $a_tab['linked_operation_div']['label']?></h1>
208 <?php endif; ?>
209<?php
210
211if ($aRap != null ) {
212 $amount_tva_include=(isset($total_tvac))?$total_tvac:$detail->det->jr_montant;
213 $tableid="tb".$div;
214 $total_rec=0;
216 $operation->set_id($jr_id);
217 echo '<table id="'.$tableid.'">';
218 for ($e=0;$e<count($aRap);$e++) {
219 $opRap=new Acc_Operation($cn);
220 $opRap->jr_id=$aRap[$e];
221 $internal=$opRap->get_internal();
222 $array_jr=$cn->get_array('select jr_date,jr_pj_number,jr_montant,jr_comment , jr_internal ,jr_optype
223 from jrn where jr_id=$1',
224 array($aRap[$e]));
225 $amount=$array_jr[0]['jr_montant'];
226 switch (substr($array_jr[0]['jr_internal'],0,1)) {
227 case 'A':
228 $amount = $cn->get_value("select sum(qp_price+qp_vat+qp_nd_tva+qp_nd_tva_recup-qp_vat_sided) from quant_purchase qp
229 where qp_internal=$1",
230 array($internal));
231 // add additional tax if any
232 $add=$operation->get_sum_other_tax();
234 break;
235 case 'V':
236 $amount=$cn->get_value("select sum(qs_price+qs_vat-qs_vat_sided) from quant_sold qs
237 where qs_internal=$1",
238 array($internal));
239 // add additional tax if any
240 $add=$operation->get_sum_other_tax();
241 $amount=bcadd($amount??0,$add??0,2);
242 break;
243 }
244 $total_rec=bcadd($total_rec,$amount??0);
245 $str="modifyOperation(".$aRap[$e].",".$gDossier.")";
246
247 // If write access , allow to drop Reconciles operations
248 if ( $access=='W') {
249 $js="return confirm_box(null,'"._("vous confirmez?")."',";
250 $js.=sprintf('function () { dropLink(\'%s\',\'%s\',\'%s\',\'%s\');deleteRowRec(\'%s\',$(\'row%d\'));})',
251 $gDossier,
252 $div,
253 $jr_id,
254 $aRap[$e],
255 $tableid,
256 $e
257 );
258 $remove=Icon_Action::trash(uniqid(), $js);
259 }
260 else
261 $remove='';
262
263 $comment=strip_tags($array_jr[0]['jr_comment']??"");
264 $pj_nb=h($array_jr[0]['jr_pj_number']);
265 echo tr (td(format_date($array_jr[0]['jr_date'])).
266 td('<a class="line" href="javascript:void(0)" onclick="'.$str.'" >'.$internal.'</A>').
267 td($pj_nb).
268 td($comment).
269 td(_('montant').'='.nbm($amount)).
270 td(_('delta').'='.nbm(bcsub(abs($amount_tva_include),abs($total_rec)))).
271 td($remove),' id = "row'.$e.'"');
272 }
273 echo '</table>';
274}
275?>
276<?php
277if ( $access=='W') {
278 $wConcerned=new IConcerned("rapt".$div);
279 $wConcerned->amount_id=$obj->det->jr_montant;
280 $wConcerned->div="search_reconcile";
281 $wConcerned->set_hideOperation( $obj->jr_id);
282 echo $wConcerned->input();
283
284}
285?>
286</div>
287<div id="linked_action_div<?php echo $div;?>" style="display:<?php echo $a_tab['linked_action_div']['display']?>" class="myfieldset">
288 <?php
289 // display title only in popup
290 if ($div == 'popup') :
291 ?>
292 <h1 class="legend"><?php echo $a_tab['linked_action_div']['label']?></h1>
293 <?php endif; ?>
294<?php
295/**
296 * show possible linked actions
297 */
298echo '<ul style="list-style-type:square;">';
299for ($i = 0; $i < count($a_followup); $i++)
300{
301 $remove='';
303 if ( $div == 'popup')
304 {
305 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>';
306 }
307 else
308 {
309 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>';
310 }
311}
312echo '</ul>';
313$related=new IRelated_Action('related');
314$related->id='related'.$div;
315 if ( $access=='W') echo $related->input();
316echo '</div>';
317?>
318
319<?php
320//------------------------------------------------
321// Receipt
322//------------------------------------------------
323require_once NOALYSS_TEMPLATE.'/ledger_detail_file.php';
324?>
325<?php
326//------------------------------------------------
327// Receipt supplemental_doc_div
328//------------------------------------------------
329require_once NOALYSS_TEMPLATE."/ledger_detail_sup_files.php";
330?>
331
332
333<div id="analytic_div<?php echo $div;?>" style="overflow:auto;display:<?php echo $a_tab['analytic_div']['display']?>">
334 <?php
335 if ($div == 'popup') :
336 ?>
337 <h1 class="legend"><?php echo $a_tab['analytic_div']['label']?></h1>
338 <?php endif; ?>
339 <?php if ( $owner->MY_ANALYTIC != "nu") :
340 if ( strpos($str_anc,'<td>') == true ):
341 ?>
342
343 <table class="result">
344 <?php echo $str_anc;?>
345 </table>
346 <?php else: ?>
347 <span class="notice">
348 <?php echo _('Aucune donnée'); ?>
349 </span>
350 <?php endif;?>
351<?php else:?>
352 <span class="notice">
353 <?php echo _('Non utilisée'); ?>
354 </span>
355<?php endif;?>
356</div>
357<?php
358 echo '<p style="text-align:center">';
359
360if ( $div != 'popup' ) {
361 $a=new IButton('Fermer',_('Fermer'));
362 $a->label=_("Fermer");
363 $a->javascript="removeDiv('".$div."')";
364 echo $a->input();
365} else {
366 echo HtmlInput::hidden('p_jrn',$oLedger->id);
367}
368
369?>
370
371<?php
372
373/**
374 * if you can write
375 */
376 if ( $access=='W') {
377 echo HtmlInput::submit('save',_('Sauver'),'onClick="return verify_ca(\'popup\');"');
379 if ($owner->MY_ANALYTIC != 'nu' /*&& $div=='popup' */){
380
381 $select_box->add_javascript(_("Vérification CA"), sprintf("verify_ca('%s')",$div));
382 }
383
384 $per=new Periode($cn,$obj->det->jr_tech_per);
385 if ( $per->is_closed() == 0 && $owner->MY_STRICT=='N' && $g_user->check_action(RMOPER)==1)
386 {
387 $javascript="return confirm_box(null,content[50],function () {removeOperation('".$obj->det->jr_id."',".dossier::id().",'".$div."')})";
388 $select_box->add_javascript(_("Supprimer"), $javascript);
389 }
390 //----------------------------------------------------
391 // Extourne
392 //----------------------------------------------------
393 $select_box->add_javascript(_("Extourne"), sprintf("g('ext%s').style.display='block'",$div));
394
395 //-------------------------------------------------------------------
396 // Duplicate
397 //-------------------------------------------------------------------
398 $select_box->add_javascript(_("Dupliquer"),sprintf("duplicate_operation('%s','%s')",Dossier::id(),$obj->jr_id));
399
400 //-------------------------------------------------------------------
401 // Export PDF
402 //-------------------------------------------------------------------
403 $select_box->add_url(_("Export PDF"), "export.php?".
404 http_build_query(array("act"=>"PDF:operation_detail","gDossier"=>Dossier::id(),"operation_id"=>$obj->jr_id)));
405
406
407echo $select_box->input();
408echo '</p>';
409echo '</form>';
410
411 echo '<div id="ext'.$div.'" class="inner_box" style="position:absolute;top:40px;display:none">';
412 $date=new IDate('ext_date');
413 $extourne_label=new IText("ext_label");
414 $extourne_label->size=40;
415 $r="<form id=\"form_".$div."\" onsubmit=\"return false;\">";
416 $r.=HtmlInput::hidden('jr_id',$obj->jr_id)
417 . HtmlInput::hidden('div',$div).dossier::hidden().HtmlInput::hidden('act','reverseop');
418 $r.=HtmlInput::title_box(_('Extourner'), 'ext'.$div, 'hide');
419 $r.="<p>";
420 $r.= _("Extourner une opération vous permet de l'annuler par son écriture inverse");
421 $r.="</p>";
422
423 $r.="<p>";
424 $r.=_("entrez une date")." :".$date->input();
425 $r.="</p>";
426
427 $r.="<p>";
428 $r.=_("Libellé")." :".$extourne_label->input();
429 $r.="</p>";
430
431
432 $r.='<p style="text-align:center">';
433 $r.=HtmlInput::submit('x','accepter',
434 'onclick="confirm_box($(\'form_'.$div.'\'),content[50],function () {$(\'form_'.$div.'\').divname=\''.$div.'\';reverseOperation($(\'form_'.$div.'\'))}); return false"');
435 $r.=HtmlInput::button_hide( "ext".$div);
436 $r.="</p>";
437 $r.='</form>';
438 echo $r;
439 echo '</div>';
440
441
442
443}else {
444 echo '</p>';
445}
446
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
noalyss_bcadd($p_first, $p_second, $p_decimal=4)
th($p_string, $p_extra='', $raw='')
Definition ac_common.php:58
span($p_string, $p_extra='')
Definition ac_common.php:43
p($p_string, $p_extra='')
Definition ac_common.php:39
h1($p_string, $p_class="")
Definition ac_common.php:72
tr($p_string, $p_extra='')
Definition ac_common.php:88
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.
global $g_parameter
if(isset($tot['tva'][$a]))($tot['tva'][$a])?></td ><?php else endforeach
global $g_user
if no group available , then stop
if(headers_sent() &&DEBUGNOALYSS > 0) else
catch(Exception $e) $obj
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
h( $row[ 'oa_description'])
catch(Exception $e) $exercice
if($ledger=="") $access
$jr_id
$opd_description style
$periode_id
_("actif, passif,charge,...")
$input_from type
else $card content[$j]['j_montant']
$class
Display the Plugin and for each profile were it is installed or not.
$tabs
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,...
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
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 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', $raw="", $refresh='')
Title for boxes, you can customize the symbol thanks symbol with the mode "custom".
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...
Html Input Text member :
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...)
$all table
const ATTR_DEF_NAME
Definition constant.php:223
const RMOPER