Go to the documentation of this file.00001 <?php
00002
00003
00004 ?><?php
00005 require_once ('class_acc_operation.php');
00006 require_once ('class_acc_reconciliation.php');
00007
00008 $gDossier=dossier::id();
00009 if ( count($this->content) == 0 ) :
00010 ?>
00011 <h2 class="info2"><?php echo _('Désolé aucun résultat trouvé')?></h2>
00012
00013 <?php
00014 else :
00015 $delta=0;
00016 ?>
00017 <table class="result">
00018 <tr>
00019 <th>
00020 </th>
00021 <th>
00022 <?php echo _('Lettrage')?>
00023 </th>
00024 <th>
00025 <?php echo _('Date')?>
00026 </th>
00027 <th>
00028 <?php echo _('Ref')?>
00029 </th>
00030 <th>
00031 <?php echo _('Description')?>
00032 </th>
00033 <th style="text-align:right">
00034 <?php echo _('Débit')?>
00035 </th>
00036 <th style="text-align:right">
00037 <?php echo _('Crédit')?>
00038 </th>
00039 <th style="text-align:center">
00040 <?php echo _('Op. concernée')?>
00041 </th>
00042 </tr>
00043
00044 <?php
00045 $this->content=array_merge($this->linked,$this->content);
00046 $amount_deb=($j_debit=='t')?$amount_init:0;
00047 $amount_cred=($j_debit=='f')?$amount_init:0;
00048
00049 $linked_limit=count($this->linked);
00050
00051 for ($i=0;$i<count($this->content);$i++):
00052 $class="";
00053 $class= ( ($i % 2) == 0 ) ? "odd":"even";
00054 if ( $i < $linked_limit ) $class="even";
00055 if ($linked_limit != 0 && $i==$linked_limit)
00056 {
00057 ?>
00058 <tr>
00059 <th>
00060 </th>
00061 <th>
00062 <?php echo _('Lettrage')?>
00063 </th>
00064 <th>
00065 <?php echo _('Date')?>
00066 </th>
00067 <th>
00068 <?php echo _('Ref')?>
00069 </th>
00070 <th>
00071 <?php echo _('Description')?>
00072 </th>
00073 <th style="text-align:right">
00074 <?php echo _('Débit')?>
00075 </th>
00076 <th style="text-align:right">
00077 <?php echo _('Crédit')?>
00078 </th>
00079 <th style="text-align:center">
00080 <?php echo _('Op. concernée')?>
00081 </th>
00082 </tr>
00083 <?php
00084
00085 }
00086 ?>
00087 <tr <?php echo "class=\"$class\""; ?> >
00088 <td>
00089 <?php
00090
00091 if ($this->content[$i]['j_id']==$p_jid) continue;
00092 if ( $jnt_id == $this->content[$i]['letter'] && $i >= $linked_limit) continue;
00093
00094 $check=new ICheckbox('ck[]',$this->content[$i]['j_id']);
00095 if ( $jnt_id == $this->content[$i]['letter'] && $i < $linked_limit) $check->selected=true; else $check->selected=false;
00096
00097 if ( $this->content[$i]['letter'] < 0 || $check->selected == true )
00098 echo $check->input();
00099 echo HtmlInput::hidden('letter_j_id[]',$this->content[$i]['j_id']);
00100 ?>
00101 </td>
00102 <td>
00103 <?php
00104 $letter=($this->content[$i]['letter']< 0)?" ":strtoupper(base_convert($this->content[$i]['letter'],10,36));
00105 ?>
00106 <?php echo $letter?>
00107 </td>
00108 <td> <?php echo smaller_date($this->content[$i]['j_date_fmt'])?> </td>
00109 <?php
00110 $r=sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:viewOperation(\'%s\',\'%s\')" >%s</A>',
00111 $this->content[$i]['jr_id'], $gDossier, $this->content[$i]['jr_internal']);
00112 ?>
00113 <td> <?php echo $r?> </td>
00114 <td> <?php echo $this->content[$i]['jr_comment']?> </td>
00115 <?php if ($this->content[$i]['j_debit']=='t') : ?>
00116 <td style="text-align:right"> <?php echo nb($this->content[$i]['j_montant'])?> </td>
00117 <td></td>
00118 <?php else : ?>
00119 <td></td>
00120 <td style="text-align:right"> <?php echo nb($this->content[$i]['j_montant'])?> </td>
00121 <?php endif ?>
00122 <td style="text-align:center">
00123 <?php
00124
00125 $rec=new Acc_Reconciliation($this->db);
00126 $rec->set_jr_id($this->content[$i]['jr_id']);
00127 $a=$rec->get();
00128 if ( $a != null ) {
00129 foreach ($a as $key => $element)
00130 {
00131 $operation=new Acc_Operation($this->db);
00132 $operation->jr_id=$element;
00133 $l_amount=$this->db->get_value("select jr_montant from jrn ".
00134 " where jr_id=$element");
00135 echo "<A class=\"detail\" HREF=\"javascript:viewOperation('".$element."',".$gDossier.")\" > ".$operation->get_internal()." [ $l_amount € ]</A>";
00136 }
00137 }
00138
00139 ?>
00140 </td>
00141
00142 </tr>
00143 <?php
00144 if ($i<$linked_limit)
00145 {
00146 $amount_deb+=( $jnt_id == $this->content[$i]['letter'] && $this->content[$i]['j_debit']=='t')?$this->content[$i]['j_montant']:0;
00147 $amount_cred+=( $jnt_id == $this->content[$i]['letter'] && $this->content[$i]['j_debit']=='f')?$this->content[$i]['j_montant']:0;
00148 }
00149 endfor;
00150 $delta = bcsub($amount_deb, $amount_cred);
00151 $side = _('Créditeur');
00152 if ($delta < 0 ) {
00153 $side = _("Débiteur");
00154 $delta = abs($delta);
00155 }
00156 ?>
00157 </TABLE>
00158 <h2 class="info"> <?php echo _("Total lettré")?></h2>
00159 <span style="display:block;font-size:14px"><?php echo _('Total Debit')?> <?php echo $amount_deb?></span>
00160 <span style="display:block;font-size:14px"><?php echo _('Total Credit')?> <?php echo $amount_cred?></span>
00161 <span style="display:block;font-size:14px"><?php echo _('Total')." ".$side?> <?php echo $delta?></span>
00162
00163 <?php endif;?>
00164 <?php echo HtmlInput::button('check_all',_('Sélectionner tout'),' onclick="select_checkbox(\'letter_form\')"');?>
00165 <?php echo HtmlInput::button('check_none',_('Tout Désélectionner'),' onclick="unselect_checkbox(\'letter_form\')"');?>