detail
+
';
+ $('detail').show();
+ } catch(e){alert('dsp_letter '+e.message);}
+}
+
+function success_dsp_letter(req) {
+ try{
+ var answer=req.responseXML;
+ var a=answer.getElementsByTagName('code');
+ var html=answer.getElementsByTagName('value');
+ if ( a.length == 0 ) { var rec=req.responseText;alert ('erreur :'+rec);}
+ var name_ctl=a[0].firstChild.nodeValue;
+ var code_html=getNodeText(html[0]);
+ code_html=unescape_xml(code_html);
+ $('detail').innerHTML=code_html;
+ }
+ catch (e) {
+ alert(e.message);}
+ try{
+ code_html.evalScripts();}
+ catch(e){
+ alert("Impossible executer script de la reponse\n"+e.message);}
+
+}
+function error_dsp_letter(req) {
+ alert('Erreur AJAX DSP_LETTER');
+}
\ No newline at end of file
diff --git a/include/class_lettering.php b/include/class_lettering.php
new file mode 100644
index 000000000..194a46c7e
--- /dev/null
+++ b/include/class_lettering.php
@@ -0,0 +1,283 @@
+column_name,"email"=>"column_name_email","val3"=>0); */
+ protected $variable=array("account"=>"account",
+ "quick_code"=>"quick_code",
+ "start"=>"start",
+ "end"=>"end",
+ "periode"=>"periode",
+ "sql_ledger"=>"sql_ledger"
+ )
+ ;
+ function __construct ($p_init) {
+ $this->db=$p_init;
+ $a=new User($p_init);
+ $exercice=$a->get_exercice();
+ $this->start='01.01.'.$exercice;
+ $this->end='31.12.'.$exercice;
+ // available ledgers
+ $this->sql_ledger=str_replace('jrn_def_id','jr_def_id',$a->get_ledger_sql('ALL',3));
+
+ }
+ public function get_parameter($p_string) {
+ if ( array_key_exists($p_string,$this->variable) ) {
+ $idx=$this->variable[$p_string];
+ return $this->$idx;
+ }
+ else
+ throw new Exception (__FILE__.":".__LINE__.$p_string.'Erreur attribut inexistant');
+ }
+ public function set_parameter($p_string,$p_value) {
+ if ( array_key_exists($p_string,$this->variable) ) {
+ $idx=$this->variable[$p_string];
+ $this->$idx=$p_value;
+ }
+ else
+ throw new Exception (__FILE__.":".__LINE__.$p_string.'Erreur attribut inexistant');
+ }
+ public function get_info() { return var_export(self::$variable,true); }
+ public function verify() {
+ // Verify that the elt we want to add is correct
+ }
+ /**
+ *@brief save from array
+ *@param $p_array
+@code
+ 'phpsessid' => string 'a2c261a2f48b0045a8c28276afd31f5c' (length=32)
+ 'gDossier' => string '13' (length=2)
+ 'letter_j_id' =>
+ array
+ 0 => string '5' (length=1)
+ 1 => string '23' (length=2)
+ 2 => string '67' (length=2)
+ 3 => string '136' (length=3)
+ 4 => string '139' (length=3)
+ 5 => string '145' (length=3)
+ 6 => string '374' (length=3)
+ 7 => string '148' (length=3)
+ 8 => string '156' (length=3)
+ 9 => string '254' (length=3)
+ 10 => string '277' (length=3)
+ 'ck0' => string 'on' (length=2)
+ 'ck1' => string 'on' (length=2)
+ 'ck10' => string 'on' (length=2)
+ 'j_id' => string '142' (length=3)
+ 'jnt_id' => string '-2' (length=2)
+ 'record' => string 'Sauver' (length=6)
+@endcode
+ */
+ public function save($p_array) {
+ $this->db->start();
+ $this->db->exec_sql('delete from jnt_letter where jl_id=$1',array($p_array['jnt_id']));
+ $jl_id=$this->db->get_next_seq("jnt_letter_jl_id_seq");
+ $this->db->exec_sql('insert into jnt_letter(jl_id) values($1)',
+ array($jl_id));
+
+ // save the source
+ $deb=$this->db->get_value('select j_debit,j_montant from jrnx where j_id=$1',array($p_array['j_id']));
+ if ( $deb == 't') {
+ // save into letter_deb
+ $ld_id=$this->db->get_value('insert into letter_deb(j_id,jl_id) values($1,$2) returning ld_id',array($p_array['j_id'],$jl_id));
+ }else {
+ $lc_id=$this->db->get_value('insert into letter_cred(j_id,jl_id) values($1,$2) returning lc_id',array($p_array['j_id'],$jl_id));
+ }
+
+ // save dest
+ for($i=0;$i| + =_('Lettrage')?> + | ++ =_('Date')?> + | ++ =_('Ref')?> + | ++ =_('Description')?> + | ++ =_('Montant')?> + | ++ =_('Debit / Credit')?> + | +
|---|---|---|---|---|---|
| +content[$i]['letter']==-1)?"x":$this->content[$i]['letter']; +$js="this.gDossier=".dossier::id(). + ";this.phpsessid='".$_REQUEST['PHPSESSID']."'". + ";this.j_id=".$this->content[$i]['j_id']. + ";this.obj_type='".$this->object_type."'". + ";dsp_letter(this)"; + +?> +=$letter?> + | +=$this->content[$i]['j_date_fmt']?> | +=h($this->content[$i]['jr_internal'])?> | +=h($this->content[$i]['jr_comment'])?> | +=$this->content[$i]['j_montant']?> | +=($this->content[$i]['j_debit']=='t')?'D':'C'?> | +
| + | ++ =_('Lettrage')?> + | ++ =_('Date')?> + | ++ =_('Ref')?> + | ++ =_('Description')?> + | ++ =_('Montant')?> + | ++ =_('Debit / Credit')?> + | +
|---|---|---|---|---|---|---|
| +content[$i]['j_id']); + + if ($this->content[$i]['j_id']==$p_jid) continue; +$check=new ICheckbox('ck'.$i); +if ( $jnt_id == $this->content[$i]['letter'] ) $check->selected=true; else $check->selected=false; +echo $check->input(); +?> + | ++content[$i]['letter']==-1)?" ":$this->content[$i]['letter']; +?> +=$letter?> + | +=$this->content[$i]['j_date_fmt']?> | +=$this->content[$i]['jr_internal']?> | +=$this->content[$i]['jr_comment']?> | +=$this->content[$i]['j_montant']?> | +=($this->content[$i]['j_debit']=='t')?'D':'C'?> | +