| Internal | "; if ( $this->type=='') { $r.=th('Journal'); } $r.=$sort_date; $r.=$sort_echeance; $r.=$sort_pj; $r.=$sort_description; $r.=$sort_amount; // if $p_paid is not equal to 0 then we have a paid column if ( $p_paid != 0 ) { $r.=""._('Payé')." | "; } $r.=""._('Op. Concernée')." | "; if ($own->MY_STRICT=='N' && $user->check_action(GEOP)==1) $r.=''._('Action').' | '; $r.=""._('Document')." | "; $r.="|||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| "; // If url contains // $href=basename($_SERVER['PHP_SELF']); switch ($href) { // user_jrn.php case 'compta.php': $vue="S"; //Expert View break; case 'commercial.php': $vue="S"; //Simple View break; case 'recherche.php': $vue=(isset($_GET['expert']))?'E':'S'; break; default: echo_error('user_form_ach.php',__LINE__,'Erreur invalid request uri'); exit (-1); } //DEBUG $r.=sprintf('%s', $row['jr_id'], $gDossier, $row['jrn_def_id'],$vue, $row['jr_internal']); $r.=" | "; if ( $this->type=='') $r.=td($row['jrn_def_name']); // date $r.=""; $r.=$row['jr_date']; $r.=" | "; // echeance $r.=""; $r.=$row['jr_ech']; $r.=" | "; // pj $r.=""; $r.=$row['jr_pj_number']; $r.=" | "; // comment $r.=""; $tmp_jr_comment=h($row['jr_comment']); $r.=$tmp_jr_comment; $r.=" | "; // Amount // If the ledger is financial : // the credit must be negative and written in red $positive=0; // Check ledger type : if ( $row['jrn_def_type'] == 'FIN' ) { $positive = $this->db->count_sql("select * from jrn inner join jrnx on jr_grpt_id=j_grpt ". " where jr_id=".$row['jr_id']." and $sql_fin ". " and j_debit='f'"); } $r.=""; $tot=($positive != 0)?$tot-$row['jr_montant']:$tot+$row['jr_montant']; //STAN $positive always == 0 $r.=( $positive != 0 )?" - ".sprintf("%8.2f",$row['jr_montant'])."":sprintf("%8.2f",$row['jr_montant']); $r.=" | "; // Show the paid column if p_paid is not null if ( $p_paid !=0 ) { $w=new ICheckBox(); $w->name="rd_paid".$row['jr_id']; $w->selected=($row['jr_rapt']=='paid')?true:false; // if p_paid == 2 then readonly $w->readonly=( $p_paid == 2)?true:false; $h=new IHidden(); $h->name="set_jr_id".$row['jr_id']; $r.=''.$w->input().$h->input().' | '; if ( $row['jr_rapt']=='paid') $amount_paid+=$row['jr_montant']; else $amount_unpaid+=$row['jr_montant']; } // Rapprochement $rec=new Acc_Reconciliation($this->db); $rec->set_jr_id($row['jr_id']); $a=$rec->get(); $r.=""; if ( $a != null ) { foreach ($a as $key => $element) { $operation=new Acc_Operation($this->db); $operation->jr_id=$element; $l_amount=$this->db->get_value("select jr_montant from jrn ". " where jr_id=$element"); $r.= " ".$operation->get_internal()." [ $l_amount € ]"; }//for }// if ( $a != null ) { $r.=" | "; if ( $row['jr_valid'] == 'f' ) { $r.="Opération annulée | "; } else { // all operations can be removed either by setting to 0 the amount // or by writing the opposite operation if the period is closed $r.=""; // cancel operation if ( $user->check_action(GEOP)==1) $r.=sprintf('', _("Effacer"),$row['jr_grpt_id'],$gDossier,$row['jrn_def_id']); $r.=" | "; } // else //document if ( $row['jr_pj_name'] != "") { $image='".sprintf('%s', $row['jrn_def_id'], $row['jr_grpt_id'], $str_dossier, $image) ." | "; } else $r.=""; // end row $r.=" |
| Total | '; $r.=''.$tot." | "; $r.="||||||||||
| Payé | '; $r.=''.$amount_paid." | "; $r.="||||||||||
| Non payé | '; $r.=''.$amount_unpaid." | "; $r.="||||||||||
| "._('Date')." : | $date |
| '._('Période Comptable').' '.$date_limit['p_start'].'-'.$date_limit['p_end'].' | |
| "._('Description')." | ".h($desc)." |
| "._('PJ Num')." | ".h($e_pj)." |
| "._('Quick Code ou'); $ret.=_("Poste")." | "; $ret.=""._("Montant")." | "; $ret.=""._("Débit")." | "; $ret.="|||
|---|---|---|---|---|---|
| ". ${'qc_'.$i}.' - '. $oqc->strAttribut(ATTR_DEF_NAME).HtmlInput::hidden('qc_'.$i,${'qc_'.$i}). ' | '; } if ( trim(${'qc_'.$i})=="" && trim(${'poste'.$i}) != "") { $oposte=new Acc_Account_Ledger($this->db,${'poste'.$i}); $strPoste=$oposte->id; $ret.="".h(${"poste".$i}." - ". $oposte->get_name()).HtmlInput::hidden('poste'.$i,${'poste'.$i}). ' | '; } if ( trim(${'qc_'.$i})=="" && trim(${'poste'.$i}) == "") continue; $ret.="".h(${"ld".$i}).HtmlInput::hidden('ld'.$i,${'ld'.$i})." | "; $ret.="".${"amount".$i}.HtmlInput::hidden('amount'.$i,${'amount'.$i})." | "; $ret.=""; $ret.=(isset(${"ck$i"}))?"D":"C"; $ret.=(isset(${"ck$i"}))?HtmlInput::hidden('ck'.$i,${'ck'.$i}):""; $ret.=" | "; // CA if ( $own->MY_ANALYTIC!='nu') // use of AA { if ( myereg("^[6,7]+",$strPoste)) { // show form $op=new Anc_Operation($this->db); $null=($own->MY_ANALYTIC=='op')?1:0; $ret.=''; $ret.=$op->display_form_plan(null,$null,1,$count,round(${'amount'.$i},2)); $ret.=' | '; $count++; } } $ret.="
| '; $wDate=new IDate('date'); $wDate->readonly=$p_readonly; $date=(isset($date)&&trim($date)!='')?$date:''; if (trim($date)=='' && $owner->MY_DATE_SUGGEST=='Y') { $user=new User($this->db); $periode=new Periode($this->db); list ($l_date_start,$l_date_end)=$periode->get_date_limit($user->get_periode()); $date=$l_date_start; } $wDate->value=$date; $ret.=_("Date").' : '.$wDate->input(); $ret.= ' | '; /* insert periode if needed */ // Periode //-- if ($this->check_periode() == true) { $l_user_per=$user->get_periode(); $def=(isset($periode))?$periode:$l_user_per; $period=new IPeriod("period"); $period->user=$user; $period->cn=$this->db; $period->value=$def; $period->type=OPEN; try { $l_form_per=$period->input(); } catch (Exception $e) { if ($e->getCode() == 1 ) { echo _("Aucune période ouverte"); exit(); } } $label=HtmlInput::infobulle(3); $f_periode=_("Période comptable")." $label ".$l_form_per; $ret.=td($f_periode); } echo '|
| '._('Description'); $wDescription=new IText('desc'); $wDescription->readonly=$p_readonly; $wDescription->size=100; $wDescription->value=(isset($desc))?$desc:''; $ret.=$wDescription->input(); $ret.= ' | '; $wPJ=new IText('e_pj'); $wPJ->readonly=false; $wPJ->size=10; /* suggest PJ ? */ $default_pj=''; $own=new Own($this->db); if ( $own->MY_PJ_SUGGEST=='Y') { $default_pj=$this->guess_pj(); } $wPJ->value=(isset($e_pj))?$e_pj:$default_pj; $ret.=''._('Pièce').' : '.$wPJ->input(); $ret.=HtmlInput::hidden('e_pj_suggest',$default_pj); $ret.= ' |
| Quickcode'.$info.' | '. ''._('Poste').$info_poste.' | '. ''._('Libellé').' | '. ''._('Montant').' | '. ''._('Débit').' | '. '
|---|---|---|---|---|
| '.$quick_code->search().$quick_code->input().' | '; $ret.=''.$poste->input(). ''. ' | '; $ret.=''.$line_desc->input().' | '; $ret.=''.$amount->input().' | '; $ret.=''.$deb->input().' | '; $ret.='