diff --git a/include/class/acc_currency.class.php b/include/class/acc_currency.class.php index bd58afe45..e1ebf3a62 100644 --- a/include/class/acc_currency.class.php +++ b/include/class/acc_currency.class.php @@ -42,6 +42,11 @@ class Acc_Currency $this->currency=new V_Currency_Last_Value_SQL($p_cn, $p_id); } + public function __toString(): string + { + return "Acc_Currency [".$this->currency->__toString()."]"; + } + /** * Retrieve a V_Currency_Last_Value_SQL thanks its iso_code * @param string $p_iso diff --git a/include/class/acc_operation.class.php b/include/class/acc_operation.class.php index 676953b9c..07701c5b9 100644 --- a/include/class/acc_operation.class.php +++ b/include/class/acc_operation.class.php @@ -66,6 +66,28 @@ class Acc_Operation $this->currency_rate_ref=1; $this->currency_id=NULL; } + + function __toString(): string + { + $r=<<db} + qcode {$this->qcode} + user {$this->user} + periode {$this->periode} + jr_id {$this->jr_id} + jr_optype {$this->jr_optype} + amount {$this->amount} + currency_rate {$this->amount} + currency_rate_ref {$this->amount} + currency_id {$this->amount} + ] +EOF; + return $r; + + } + /** *@brief retrieve the grpt_id from jrn for a jr_id *@return jrn.jr_grpt_id or an empty string if not found diff --git a/include/class/anc_operation.class.php b/include/class/anc_operation.class.php index 48d574ba1..6bd88313f 100644 --- a/include/class/anc_operation.class.php +++ b/include/class/anc_operation.class.php @@ -58,6 +58,29 @@ class Anc_Operation return $this->currency_rate; } + public function __toString(): string + { + $r=<<$this->row, + \$list=> $this->list, + \$id => $this->id, + \$po_id => $this->po_id, + \$oa_amount $this->oa_amount, + \$oa_description => $this->oa_description, + \$oa_debit => $this->oa_debit, + \$j_id => $this->j_id, + \$oa_group => $this->oa_group, + \$oa_date => $this->oa_date, + \$pa_id => $this->pa_id, + \$card => $this->card , + private \$currency_rate => $this->currency_rate, + ] +EOF; + return $r; + + } + public function set_currency_rate($currency_rate) { $this->currency_rate=$currency_rate; @@ -778,20 +801,87 @@ class Anc_Operation * \param $p_item if the item nb for each item (purchase or selling * merchandise) * \param $p_array structure - * \verbatim - nb_tA A is the number of the item it contains the number of + + nb_tx x is the number of the item it contains the number of rows of CA for this card - valAlR amount for the CA (item A row R) +

val double array : amount for the CA row ACC => sub row ANC

+ here Operation 0 has 2 row for a total of 10.31 and 1 + here Operation 1 has 1 row for a total of 430 + \verbatim + [val] => Array + ( + [0] => Array + ( + [0] => 10.31 + [1] => 1 + ) + + [1] => Array + ( + [0] => 430 + ) + + ) +\endverbatim +

amount_tx the amount for each row

+ It is the amount to split per accounting, it is possible that it is different from the sum of the given amount ( + see val) per row + \verbatim + [amount_t0] => 11.31 + [amount_t1] => 430 + \endverbatim ta_AoCrow_R contains the value of the pa_id and po_id for this row with the form pa_id_po_id %d_%d +

hplan = Double array operation

+

Double array operation => all the amount but in linear form

+ +

Example if the amount of the operation 0 is splitted in 2 rows and 2 cols (because 2 analytic plan, means 2 cols) + we have an array of 4 values for operation 0, it gives the poste_analytique.po_id (from DB).

+

Here is the operation 0 + (one row of the accounting) is splitted in po_id = 1 (pa_id see in tables or array pa_id) and po_id=5 (second pa_id) + for 10.31 (see array val) and for 1 is set for po_id 1 and 4, p +

+ \verbatim + [hplan] => Array + ( + [0] => Array + ( + [0] => 1 + [1] => 5 + [2] => 1 + [3] => 4 + ) + + [1] => Array + ( + [0] => 1 + [1] => 6 + ) + + ) + \endverbatim + +

pa_id

+ pa_id array of plan_analytic.pa_id (1 per column), always ordered by pa_id + + \verbatim + [pa_id] => Array + ( + [0] => 1 + [1] => 2 + ) + *\endverbatim + * * \attention The idea is one j_id matches several oa_id, - * serveral data are set before the call : - * -j_id - * -oa_debit - * -oa_group - * -oa_date - * -oa_description + * serveral data must be set before the call : + * + * * */ function save_form_plan($p_array,$p_item,$p_j_id) diff --git a/include/class/periode.class.php b/include/class/periode.class.php index 1e18583b9..d42d5dc41 100644 --- a/include/class/periode.class.php +++ b/include/class/periode.class.php @@ -47,6 +47,21 @@ class Periode $this->jrn_def_id=0; } + public function __toString(): string + { + $r=<<$jrn_def_id, + \$p_id=>$p_id, + \$status => $status, + \$p_start => $p_start, + \$p_end => $p_end, +] +EOF; + return $r; + + } + function set_ledger($p_jrn) { $this->jrn_def_id=$p_jrn; diff --git a/include/lib/dbg.php b/include/lib/dbg.php index e17af5121..f71bba927 100644 --- a/include/lib/dbg.php +++ b/include/lib/dbg.php @@ -5,39 +5,45 @@ require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; class Dbg { - public static function echo_var($n_level, $msg) + public static function echo_var($n_level, $msg,$print=true) { if (DEBUGNOALYSS > $n_level) { - echo ''; + $r= ''; $type = gettype($msg); if (in_array($type, ["string", "integer", "double"])) { - echo $msg; + $r.= $msg; } else { - echo "
DBG";
-                var_export($msg);
-                echo '
'; + $r.= "
DBG";
+                $r.=print_r($msg,true);
+                $r.='
'; } - echo '
'; + $r.='
'; + if ($print) { echo $r;} + return $r; } } - public static function echo_function($msg) + public static function echo_function($msg,$print=true) { if (DEBUGNOALYSS > 1) { - echo ''; - echo "[FILE: $msg]"; + $r = ''; + $r.="[FILE: $msg]"; - echo ''; + $r.= ''; + if ($print) { echo $r;} + return $r; } } - public static function echo_file($msg) + public static function echo_file($msg,$print=true) { if (DEBUGNOALYSS > 1) { - echo ''; - echo "[FILE: $msg]"; + $r = ''; + $r.="[FILE: $msg]"; - echo ''; + $r.= ''; + if ($print) { echo $r;} + return $r; } }