72 $this->
user=$_SESSION[SESSION_KEY.
'g_user'];
73 $this->periode=
$g_user->get_periode();
75 $this->jr_optype=
"NOR";
77 $this->currency_rate=1;
78 $this->currency_rate_ref=1;
79 $this->currency_id=NULL;
90 periode {$this->periode}
92 jr_optype {$this->jr_optype}
93 amount {$this->amount}
94 currency_rate {$this->currency_rate}
95 currency_rate_ref {$this->currency_rate_ref}
96 currency_id {$this->currency_id}
109 $ret=$this->
db->get_value(
'select jr_grpt_id from jrn where jr_id=$1',
110 array($this->
jr_id));
121 $this->
db->prepare(
'prep_tiers',
"select fiche_detail.f_id,ad_value from
123 join (select qf_other as f_id
128 select qp_supplier as f_id
130 where quant_purchase.j_id=$2
132 select qs_client as f_id
134 where quant_sold.j_id=$2 ) as v_fiche on (fiche_detail.f_id=v_fiche.f_id) where ad_id=23 ");
144 $this->
db->prepare(
'prep_counterpart',
"select fiche_detail.f_id,ad_value from
146 join (select qf_bank as f_id
151 select qp_fiche as f_id
153 where quant_purchase.j_id=$2
155 select qs_fiche as f_id
157 where quant_sold.j_id=$2 ) as v_fiche on (fiche_detail.f_id=v_fiche.f_id) where ad_id=23 ");
176 $res_tiers=$this->
db->execute(
'prep_tiers',
177 array($pn_jrn_id,$pn_jrnx_id));
180 $tiers=$atiers[
'ad_value'];
185 $res_counterpart=$this->
db->execute(
'prep_counterpart',
186 array($pn_jrn_id,$pn_jrnx_id));
190 $tiers=$atiers[
'ad_value'];
216 if ( $this->poste ==
"") {
throw new Exception (__FILE__.
':'.__LINE__.
' Poste comptable vide');
return false; }
218 if ( $this->amount < 0 )
220 $this->
type=($this->
type==
'd')?
'c':
'd';
222 if ( DEBUGNOALYSS > 1 ) {
223 echo
"insert_jrnx = [{ $this->poste}] {$this->amount} rounded ".round($this->amount,2).
" type {$this->type}<br>";
225 $this->amount=abs($this->amount);
227 $this->desc=(isset($this->desc))?$this->desc:
'';
228 $this->amount=(trim($this->amount)==
''||$this->amount==NULL)?0:
$this->amount;
229 $Res=$this->
db->exec_sql(
"select insert_jrnx
230 ($1::text,abs($2)::numeric,$3::account_type,$4::integer,$5::integer,$6::bool,$7::text,$8::integer,upper($9),$10::text)",
233 round($this->amount,2),
242 if (
$Res===FALSE)
return FALSE;
243 $this->jrnx_id=$this->
db->get_current_seq(
's_jrn_op');
252 if ( $this->
jr_id == 0 ) {
return 0;}
253 $sum=$this->
db->get_value(
"select
254 sum(case when j_debit is false and jrn_def.jrn_def_type='ACH'
255 then 0-j_montant when j_debit is true and jrn_def.jrn_def_type='VEN'
257 else j_montant end) sum_tax
259 jrn_tax join jrnx j1 using (j_id)
260 join jrn on (jr_grpt_id=j1.j_grpt)
261 join jrn_def on (jrn.jr_def_id=jrn_def.jrn_def_id)
263 jrn.jr_id=$1",[$this->
jr_id]);
265 if ( $this->
db->count()==0) {
return 0;}
278 $sql=
"update jrn set jr_pj_number=$1 where jr_id=$2";
279 $this->
db->exec_sql(
$sql,array(
null,$this->
jr_id));
283 if ( $this->
db->count_sql(
"select jr_id from jrn
284 where jr_pj_number=$1 and jr_def_id=$2
286 array($this->pj,$this->
jrn,$this->
jr_id)
290 $sql=
"update jrn set jr_pj_number=$1 where jr_id=$2";
291 $this->
db->exec_sql(
$sql,array($this->pj,$this->
jr_id));
296 $pref=$this->
db->get_value(
"select jrn_def_pj_pref from jrn_def where jrn_def_id=$1",
311 $padding=$this->
db->get_value(
"select jrn_def_pj_padding from jrn_def where jrn_def_id=$1",
314 $seq=$this->
db->get_next_seq(
's_jrn_pj'.$this->
jrn);
317 $this->pj=$pref.str_pad(
$seq,$padding??0,
'0',STR_PAD_LEFT);
320 $c=$this->
db->count_sql(
"select jr_id from jrn where jr_pj_number=$1 and jr_def_id=$2
322 array($this->pj,$this->
jrn,$this->
jr_id)
334 $sql=
"update jrn set jr_pj_number=$1 where jr_id=$2";
335 $this->
db->exec_sql(
$sql,array($this->pj,$this->
jr_id));
352 if ( DEBUGNOALYSS > 1 ) {
353 echo
"insert_jrn = {$this->amount} <br>";
355 $diff=$this->
db->get_value(
"select check_balance ($1)",array($this->grpt));
359 printf (
_(
"Erreur : balance incorrecte :diff = %s"),
$diff);
364 if ( ! isset($this->mt) )
366 $this->mt=microtime(
true);
371 $this->amount=(trim($this->amount)==
''||$this->amount==NULL)?0:
$this->amount;
372 $Res=$this->
db->exec_sql(
"insert into jrn (jr_def_id,jr_montant,jr_comment,".
373 "jr_date,jr_ech,jr_grpt_id,jr_tech_per,jr_mt,jr_optype,currency_id,currency_rate,currency_rate_ref) values (".
375 "to_date($4,'DD.MM.YYYY'),to_date($5,'DD.MM.YYYY'),$6,$7,$8,$9,$10,$11,$12)",
376 array ($this->
jrn, $this->amount,$p_comment,
377 $this->date,
$echeance,$this->grpt,$this->periode,$this->mt,$this->jr_optype,
378 $this->currency_id,$this->currency_rate,$this->currency_rate_ref)
384 $this->
jr_id=$this->
db->get_current_seq(
's_jrn');
395 if ( ! isset($this->
jr_id) )
396 throw new Exception(
'jr_id is not set',1);
397 $Res=$this->
db->exec_sql(
"select jr_internal from jrn where jr_id=$1",[$this->
jr_id]);
400 $this->jr_internal= $l_line[
'jr_internal'];
410 $res=$this->
db->exec_sql(
'select jr_id from jrn where jr_internal=$1',
424 $filter_sql=
$g_user->get_ledger_sql(
'ALL',3);
426 if ( $this->
jr_id==0 )
return;
427 $sql=
" select jr_id,j_id,jr_date,j_qcode,j_poste,j_montant,jr_internal,case when j_debit = 'f' then 'C' else 'D' end as debit,jr_comment as description,
428 vw_name,pcm_lib,j_debit,coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter,jr_def_id ".
429 " from jrnx join jrn on (jr_grpt_id=j_grpt)
430 join tmp_pcmn on (j_poste=pcm_val)
431 left join vw_fiche_attr on (j_qcode=quick_code)
433 jr_id=$1 and $filter_sql order by j_debit desc";
444 $sql=
"update jrnx set j_text=$1 where j_id=$2";
445 $this->
db->exec_sql(
$sql,array($p_text,$this->jrnx_id));
452 $sql=
"update jrn set jr_comment=$1 where jr_id=$2";
453 $this->
db->exec_sql(
$sql,array($p_text,$this->
jr_id));
460 if (
isDate($p_text) ==
null )
464 $sql=
"update jrn set jr_ech=to_date($1,'DD.MM.YYYY') where jr_id=$2";
465 $this->
db->exec_sql(
$sql,array($p_text,$this->
jr_id));
472 $sql=
"select jr_def_id from jrn where jr_id=$1";
491 if (
$l[
'j_poste'] == $this->poste || (
$l[
'j_qcode']==$this->qcode && trim($this->qcode) !=
''))
492 $border=
' class="highlight"';
493 $r.=
'<tr '.$border.
'>';
502 $r.=
'<td '.$border.
'>';
509 $r.=
'<td '.$border.
'>';
517 $r.=
'<td '.$border.
'>';
524 $r.=
'<td '.$border.
'>';
532 $r.=
'<td '.$border.
'>';
533 $a=(
$l[
'letter']!=-1)?
$l[
'letter']:
'';
555 return "ERROR PARAMETRE";
591 $Res=$this->
db->exec_sql(
"select
592 to_char(j_date,'DD.MM.YYYY') as j_date,
596 coalesce(j_qcode,'-') as qcode,
600 to_char(jr_ech,'DD.MM.YYYY') as jr_ech,
601 to_char(jr_date,'DD.MM.YYYY') as jr_date,
602 jr_id,jr_internal,jr_def_id,jr_pj
603 from jrnx inner join jrn on j_grpt=jr_grpt_id where j_grpt=$1",array($p_grpt));
605 if ( $MaxLine == 0 )
return null;
608 for (
$i=0;
$i < $MaxLine;
$i++)
612 $l_array[
'op_date']=$l_line[
'j_date'];
613 if ( $l_line[
'j_debit'] ==
't' )
615 $l_class=sprintf(
"class_deb%d",
$deb);
616 $l_montant=sprintf(
"mont_deb%d",
$deb);
617 $l_text=sprintf(
"text_deb%d",
$deb);
618 $l_qcode=sprintf(
"qcode_deb%d",
$deb);
619 $l_array[$l_class]=$l_line[
'j_poste'];
620 $l_array[$l_montant]=$l_line[
'j_montant'];
621 $l_array[$l_text]=$l_line[
'j_text'];
622 $l_array[$l_qcode]=$l_line[
'qcode'];
623 $l_id=sprintf(
"op_deb%d",
$deb);
624 $l_array[$l_id]=$l_line[
'j_id'];
627 if ( $l_line[
'j_debit'] ==
'f' )
629 $l_class=sprintf(
"class_cred%d",
$cred);
630 $l_montant=sprintf(
"mont_cred%d",
$cred);
631 $l_array[$l_class]=$l_line[
'j_poste'];
632 $l_array[$l_montant]=$l_line[
'j_montant'];
633 $l_id=sprintf(
"op_cred%d",
$cred);
634 $l_array[$l_id]=$l_line[
'j_id'];
635 $l_text=sprintf(
"text_cred%d",
$cred);
636 $l_array[$l_text]=$l_line[
'j_text'];
637 $l_qcode=sprintf(
"qcode_cred%d",
$cred);
638 $l_array[$l_qcode]=$l_line[
'qcode'];
641 $l_array[
'jr_internal']=$l_line[
'jr_internal'];
642 $l_array[
'comment']=$l_line[
'jr_comment'];
643 $l_array[
'ech']=$l_line[
'jr_ech'];
644 $l_array[
'jr_id']=$l_line[
'jr_id'];
645 $l_array[
'jr_def_id']=$l_line[
'jr_def_id'];
673 if (
$ledger_id==
'')
throw new Exception(
_(
'Journal non trouvé'));
679 switch($oledger->get_type())
695 if ( empty(
$ret->det->array))
710 if ( $this->det->currency_id == 0 ) {
714 if (
$ledger_id==
'')
throw new Exception(
_(
'Journal non trouvé'));
720 switch($oledger->get_type())
725 sum(oc_amount)+sum(oc_vat_amount )
726 from operation_currency oc
727 join quant_sold qs using(j_id)
729 oc.j_id in (select j_id
730 from jrnx join jrn on (jr_grpt_id=j_grpt)
737 sum(oc_amount)+sum(oc_vat_amount )
738 from operation_currency oc
739 join quant_purchase qs using(j_id)
741 oc.j_id in (select j_id
742 from jrnx join jrn on (jr_grpt_id=j_grpt)
749 sum(oc_amount)+sum(oc_vat_amount )
750 from operation_currency oc
751 join quant_fin qs using(j_id)
753 oc.j_id in (select j_id
754 from jrnx join jrn on (jr_grpt_id=j_grpt)
761 sum(oc_amount)+sum(oc_vat_amount )
762 from operation_currency oc
763 join jrnx using(j_id)
764 join jrn on (jr_grpt_id=j_grpt)
766 jr_id=$1 and j_debit='t';
780 $this->info=
new stdClass();
782 $array=$this->
db->get_value(
"select ji_value from jrn_info where
783 jr_id=$1 and id_type=$2",array($this->
jr_id,
'OTHER'));
784 $this->info->other=
$array;
787 $array=$this->
db->get_value(
"select ji_value from jrn_info where
788 jr_id=$1 and id_type=$2",array($this->
jr_id,
'BON_COMMANDE'));
789 $this->info->command=
$array;
799 if ( ! in_array(
$p_type,array(
'OTHER',
'BON_COMMANDE')))
return;
800 if (trim($p_info)==
"") {
801 $this->
db->exec_sql(
'delete from jrn_info where jr_id=$1 and id_type=$2',array($this->
jr_id,
$p_type));
804 $exist=$this->
db->get_value(
'select count(ji_id) from jrn_info where jr_id=$1 and id_type=$2',array($this->
jr_id,
$p_type));
805 if ( $exist ==
"0" ) {
807 $this->
db->exec_sql(
'insert into jrn_info(jr_id,id_type,ji_value) values ($1,$2,$3)',
811 $this->
db->exec_sql(
'update jrn_info set ji_value=$3 where jr_id=$1 and id_type=$2',
818 if ($p_string ==
"")
return;
819 $a_action=explode(
',',$p_string);
820 for (
$i=0;
$i<count($a_action);
$i++)
834 throw new Exception(
_(
'Acc_Operation::set_id , id invalide '));
844 if ( $this->
jr_id == 0 )
845 throw new Exception(
_(
'Object invalide, id incorrect'));
847 $this->
db->get_value(
'select count(*) from jrn where jr_id=$1',
848 array($this->
jr_id)) == 0 )
849 throw new Exception(
_(
'Object invalide, id incorrect'));
851 $this->
db->exec_sql(
"update jrn set jr_rapt = 'paid' where jr_id = $1",
852 array($this->
jr_id));
859 if ( $this->
jr_id == 0 )
860 throw new Exception(
_(
'Object invalide, id incorrect'));
861 $amount=$this->
db->get_value(
'select jr_montant from jrn where jr_id=$1',
862 array($this->
jr_id));
868 $cn=Dossier::connect();
873 echo
h1(
'contain of get_quant() ');
875 echo
h1(
'contain of get_jrnx_detail()');
876 var_dump(
$a->get_jrnx_detail());
889 $type_operation=
new ISelect(
"jr_optype");
890 $type_operation->value=array(
891 array((
"label")=>
_(
"Normal"),
"value"=>
"NOR"),
892 array((
"label")=>
_(
"Ouverture"),
"value"=>
"OPE"),
893 array((
"label")=>
_(
"Fermeture"),
"value"=>
"CLO"),
894 array((
"label")=>
_(
"Extourne"),
"value"=>
"EXT")
897 $type_operation->selected=$p_status;
898 return $type_operation;
915 $a_code=$this->
db->get_array(
"select code from v_menu_dependency vmd where me_code=$1 and p_id=$2",
917 if ( empty ($a_code)) {
918 $r=
_(
"Menu invalide");
924 $r=sprintf(
'<form id="%s" method="POST" ACTION="%s">',
$p_id,NOALYSS_URL.
"/do.php?".http_build_query([
925 "ac"=>$a_code[0][
'code'],
"gDossier"=>Dossier::id()
927 $r.=Dossier::hidden();
932 $r.=
"<ul style=\"margin-left:2rem;padding-left:0;list-style:none;\">";
933 $r.=sprintf(
"<li>%s %s</li>",
_(
"Date"),
$operation->det->jr_pj_number);
934 $r.=sprintf(
"<li>%s %s</li>",
_(
"Libellé"),
$operation->det->jr_comment);
938 $currency=$this->
db->get_value(
"select cr_code_iso from currency where id=$1",[
$operation->det->currency_id]);
940 $r.=sprintf(
"<li>%s %s</li>",
_(
"Taux"),
$operation->det->currency_rate);
946 if (count($a_code) == 1 ) {
947 $r.=HtmlInput::hidden(
"ac",$a_code[0][
'code']);
948 $r.=sprintf(
_(
"Voulez-vous aller à %s pour dupliquer cette opération ?"),$a_code[0][
'code']);
953 $nb_code=count($a_code);
955 for (
$i=0;
$i<$nb_code;
$i++) {
956 $select->value[]=array(
"label"=>$a_code[
$i][
'code'],
"value"=>$a_code[
$i][
'code']);
958 $r.=sprintf(
_(
"Voulez-vous aller à %s pour dupliquer cette opération ?"),
$select->input());
988 $array[
'e_march'.$idx.
'_tva_amount']=$item[
'oc_vat_amount'];
989 $array[
'e_march'.$idx.
'_tva_amount']=$item[
'oc_amount'];
990 $array[
'e_march'.$idx.
'_price']=$item[
'oc_price_unit'];
993 if ( isset ($item[
'qs_vat_sided']) && $item[
'qs_vat_sided'] != 0 ) {
994 $array[
'e_march'.$idx.
'_tva_amount']=0;
995 }
elseif (isset ($item[
'qp_vat_sided']) && $item[
'qp_vat_sided'] != 0 ){
996 $array[
'e_march'.$idx.
'_tva_amount']=0;
1005 $array[
'e_other' .
$idx .
'_amount'] = $item[
'oc_amount'];
1011 if ( DEBUGNOALYSS>1) {
1012 echo \Noalyss\Dbg::hidden_info(
"operation->det_array",
$operation->det->array);
1013 echo \Noalyss\Dbg::hidden_info(
"operation->det",
$operation->det);
1014 echo \Noalyss\Dbg::hidden_info(
"array",
$array);
1017 $r.=HtmlInput::simple_array_to_hidden(
$array);
1018 $r.=HtmlInput::hidden(
"e_comm",
$operation->det->jr_comment);
1019 $r.=HtmlInput::submit(uniqid(),
_(
"Dupliquer"));
1020 $r.=HtmlInput::button_close(
"duplicate_operation_div");
1075 parent::__construct($p_cn);
1076 $this->
jr_id=$p_jrid;
1077 $this->det=
new stdClass();
1113 FROM jrn where jr_id=$1";
1115 if ( count(
$array) == 0 )
throw new Exception(
'Aucune ligne trouvée');
1116 foreach (
$array[0] as $key=>$val)
1118 $this->det->$key=$val;
1120 $sql=
"select n_text,n_html from jrn_note where jr_id=$1";
1123 $this->det->note=
"";
1124 $this->det->note_html=
null;
1126 $this->det->note=strip_tags(
$a[
'n_text']??
"");
1127 $this->det->note_html=(
$a[
'n_html'] ==
"")?
$a[
'n_text']:
$a[
'n_html'];
1136 $array[
'desc']=$this->det->jr_comment;
1139 $array[
'p_jrn']=$this->det->jr_def_id;
1146 $r.=
"this->signature ".$this->signature.
"\n";
1147 $r.=
"this->det ".print_r($this->det,
true);
1166 parent::__construct($p_cn,$p_jrid);
1167 $this->signature=
'ODS';
1168 $this->det=
new stdClass();
1192 left join operation_currency oc1 using(j_id)
1195 order by jx1.j_debit desc,jx1.j_poste
1197 $this->det->array=$this->
db->get_array(
$sql,array($this->det->jr_grpt_id));
1206 $array=parent::compute_array();
1211 $array[
"qc_".$i]=$this->det->array[
$i][
'j_qcode'];
1212 $array[
"poste".$i]=$this->det->array[
$i][
'j_poste'];
1213 $array[
"amount".$i]=$this->det->array[
$i][
'j_montant'];
1214 if ( $this->det->array[
$i][
'j_debit'] ==
't') {
1217 $array[
"ld".$i]=$this->det->array[
$i][
'j_text'];
1226 $r.=
"this->signature ".$this->signature.
"\n";
1227 $r.=
"this->det ".print_r($this->det,
true);
1244 parent::__construct($p_cn,$p_jrid);
1245 $this->signature=
'VEN';
1246 $this->det->array=
new stdClass();
1252 select qs_id, qs_internal
1269 join jrnx jx1 using(j_id)
1270 left join operation_currency oc1 using(j_id)
1271 where jx1.j_grpt = $1
1274 $this->det->array=$this->
db->get_array(
$sql,array($this->det->jr_grpt_id));
1283 $array=parent::compute_array();
1288 $array[
"e_client"]=$this->
db->get_value(
"select ad_value from fiche_detail where f_id=$1 and ad_id=23",
1289 array($this->det->array[0][
'qs_client']));
1292 $array[
"e_march".$i]=$this->
db->get_value(
"select ad_value from fiche_detail where f_id=$1 and ad_id=23",
1293 array($this->det->array[
$i][
'qs_fiche']));
1295 $array[
"e_march".$i.
"_price"]=$this->det->array[
$i][
'qs_unit'];
1296 $array[
"e_march".$i.
"_label"]=$this->det->array[
$i][
'j_text'];
1297 $array[
"e_march".$i.
"_tva_id"]=$this->det->array[
$i][
'qs_vat_code'];
1298 $array[
"e_march".$i.
"_tva_amount"]=$this->det->array[
$i][
'qs_vat'];
1299 $array[
"e_quant".$i]=$this->det->array[
$i][
'qs_quantite'];
1308 $r.=
"this->signature ".$this->signature.
"\n";
1309 $r.=
"this->det ".print_r($this->det,
true);
1327 parent::__construct($p_cn,$p_jrid);
1328 $this->signature=
'ACH';
1335 select qp_id, qp_internal
1344, qp1.qp_nd_tva_recup
1355from quant_purchase qp1
1356join jrnx jx1 using(j_id)
1357left join operation_currency oc1 using(j_id)
1358where jx1.j_grpt = $1
1361 $this->det->array=$this->
db->get_array(
$sql,array($this->det->jr_grpt_id));
1372 $array=parent::compute_array();
1377 $array[
"e_client"]=$this->
db->get_value(
"select ad_value from fiche_detail where f_id=$1 and ad_id=23",
1378 array($this->det->array[0][
'qp_supplier']));
1381 $array[
"e_march".$i]=$this->
db->get_value(
"select ad_value from fiche_detail where f_id=$1 and ad_id=23",
1382 array($this->det->array[
$i][
'qp_fiche']));
1384 $array[
"e_march".$i.
"_price"]=$this->det->array[
$i][
'qp_unit'];
1385 $array[
"e_march".$i.
"_label"]=$this->det->array[
$i][
'j_text'];
1386 $array[
"e_march".$i.
"_tva_id"]=$this->det->array[
$i][
'qp_vat_code'];
1387 $array[
"e_march".$i.
"_tva_amount"]=$this->det->array[
$i][
'qp_vat'];
1388 $array[
"e_quant".$i]=$this->det->array[
$i][
'qp_quantite'];
1399 $r.=
"this->signature ".$this->signature.
"\n";
1400 $r.=
"this->det ".print_r($this->det,
true);
1418 parent::__construct($p_cn,$p_jrid);
1419 $this->signature=
'FIN';
1434 left join operation_currency oc1 using(j_id)
1437 $this->det->array=$this->
db->get_array(
$sql,array($this->
jr_id));
1446 $array=parent::compute_array();
1452 $array[
"e_other".$i]=$this->
db->get_value(
"select ad_value from fiche_detail where f_id=$1 and ad_id=23",
1453 array($this->det->array[
$i][
'qf_other']));
1455 $array[
"e_other".$i.
"_amount"]=$this->det->array[
$i][
'qf_amount'];
1456 $array[
"e_other".$i.
"_comment"]=$this->det->jr_comment;
1465 $r.=
"this->signature ".$this->signature.
"\n";
1466 $r.=
"this->det ".print_r($this->det,
true);
isDate($p_date)
Verifie qu'une date est bien formaté en d.m.y et est valable.
noalyss_strlentrim($p_string)
h1($p_string, $p_class="")
noalyss_str_replace($search, $replace, $string)
nbm($p_number, $p_dec=2)
format the number with a sep.
global $g_user
if no group available , then stop
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
h( $row[ 'oa_description'])
if(isNumber($jr_id)==0) $ledger_id
_("actif, passif,charge,...")
for($j=0;$j< $nb_row;$j++)($j%2==0)? 'even' $show
display currency , convert to euro , and save them if used.
Contains the detail of an operation Acc_Operation propery :
$det
Object with columns from JRN.
__construct($p_cn, $p_jrid=0)
constructor set automatically the attributes user and periode
$info
$jr_id (int) JRN.JR_ID
this class manage data from the QUANT_FIN table
compute_array()
Compute an array for using with Acc_Ledger::insert.
__construct($p_cn, $p_jrid=0)
constructor set automatically the attributes user and periode
Class for jrn, class acc_ledger for manipulating the ledger AND some acc.
this class manage data from the JRNX and JRN table
compute_array()
Compute an array for using with Acc_Ledger::insert.
__construct($p_cn, $p_jrid=0)
constructor set automatically the attributes user and periode
this file match the tables jrn & jrnx the purpose is to remove or save accountant writing to these ta...
prepare_sql_tiers()
prepare the query for getting the qcode of the tiers, when executing this SQL , an array of (jrn....
get_sum_other_tax()
get the sum of other tax linked to this operation
operation_update_comment($p_text)
add a comment to the operation (jrn.jr_text)
get_quant()
retrieve data from the table QUANT_*
form_clone_operation($p_id)
create a form to recreate the operation and returns it, it works the same as when you want to correct...
__construct($p_cn, $p_jrid=0)
constructor set automatically the attributes user and periode
insert_jrnx()
Insert into the table Jrn The needed data are :
static select_operation_type($p_status)
Return a select object to choose the type of operation.
get_internal()
Return the internal value, the property jr_id must be set before.
get_data($p_grpt)
Get data from jrnx where p_grpt=jrnx(j_grpt)
get_amount()
return amount of the jr_id
set_paid()
flag the operation as paid
update_receipt()
set the pj of a operation in jrn. the jr_id must be set
get_ledger()
return the jrn_def_id from jrn
insert_jrn()
Insert into the table Jrn, the amount is computed from jrnx thanks the group id ($p_grpt)
operation_update_date_limit($p_text)
add a limit of payment to the operation (jrn.jr_ech)
update_comment($p_text)
add a comment to the line (jrnx.j_text)
save_info($p_info, $p_type)
Save into jrn_info.
get_jrnx_detail()
retrieve data from jrnx
prepare_sql_counterpart()
prepare the query for getting the qcode of the tiers, when executing this SQL , an array of (jrn....
get_currency_amount()
retrieve amount in currency for the operation
get_info()
retrieve info from the jrn_info, create 2 new arrays obj->info->command and obj->info->other the colu...
display_jrnx_detail($p_table)
display_jrnx_detail : get the data from get_jrnx_data and return a string with HTML code
find_tiers($pn_jrn_id, $pn_jrnx_id, $p_code)
Find the tiers of an operation , thanks the SQL prepared query prep_tiers and prep_counterpart.
set_id($p_id)
set the operation id (jrn.jr_id)
seek_internal($p_internal)
search an operation thankx it internal code
insert_related_action($p_string)
seek_group()
retrieve the grpt_id from jrn for a jr_id
this class manage data from the QUANT_PURCHASE table
__construct($p_cn, $p_jrid=0)
constructor set automatically the attributes user and periode
compute_array()
Compute an array for using with Acc_Ledger::insert.
this class manage data from the QUANT_SOLD table
__construct($p_cn, $p_jrid=0)
constructor set automatically the attributes user and periode
compute_array()
Compute an array for using with Acc_Ledger::insert.
static fetch_result($ret, $p_row=0, $p_col=0)
wrapper for the function pg_fetch_all
static fetch_array($ret, $p_indice=0, $p_mode=PGSQL_ASSOC)
wrapper for the function pg_fetch_array
static fetch_all($ret, $p_mode=PGSQL_ASSOC)
wrapper for the function pg_fetch_all
static num_row($ret)
wrapper for the function pg_num_rows
class_action for manipulating actions action can be :
Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...
if( $delta< 0) elseif( $delta==0)
for($i=0;$i< $nb_jrn;$i++) $deb