Replace $own by a global variable, except for ajax and export.
This variable is set in do.php
This commit is contained in:
parent
f2cbfd77d3
commit
dcc0b24904
6 changed files with 92 additions and 94 deletions
|
|
@ -48,7 +48,7 @@ if (isset ($_POST["style_user"])){$_SESSION['g_theme']=$_POST['style_user'];}
|
|||
|
||||
html_page_start($_SESSION['g_theme']);
|
||||
|
||||
global $g_user, $cn;
|
||||
global $g_user, $cn,$g_parameter;
|
||||
|
||||
|
||||
|
||||
|
|
@ -60,6 +60,7 @@ if ($g_user->check_dossier(dossier::id()) == 'P')
|
|||
redirect("extension.php?" . dossier::get(), 0);
|
||||
exit();
|
||||
}
|
||||
$g_parameter=new Own($cn);
|
||||
|
||||
load_all_script();
|
||||
/* Check Browser version if < IE6 then unsupported */
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ require_once('class_iperiod.php');
|
|||
require_once('class_fiche.php');
|
||||
require_once('class_user.php');
|
||||
require_once ('class_dossier.php');
|
||||
require_once ('class_own.php');
|
||||
require_once ('class_anc_operation.php');
|
||||
require_once ('class_acc_operation.php');
|
||||
require_once ('class_acc_account_ledger.php');
|
||||
|
|
@ -591,11 +590,11 @@ class Acc_Ledger extends jrn_def_sql
|
|||
*/
|
||||
public function list_operation_to_reconcile($sql)
|
||||
{
|
||||
global $g_parameter;
|
||||
$user=new User($this->db);
|
||||
$gDossier=dossier::id();
|
||||
$limit=" LIMIT 25";
|
||||
// Sort
|
||||
$own=new Own($this->db);
|
||||
|
||||
// Count
|
||||
$count=$this->db->count_sql($sql);
|
||||
|
|
@ -763,6 +762,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
*/
|
||||
public function list_operation($sql,$offset,$p_paid=0)
|
||||
{
|
||||
global $g_parameter;
|
||||
$table=new Sort_Table();
|
||||
$user=new User($this->db);
|
||||
$gDossier=dossier::id();
|
||||
|
|
@ -785,7 +785,6 @@ class Acc_Ledger extends jrn_def_sql
|
|||
$table->add("Description",$url,"order by jr_comment asc",
|
||||
"order by jr_comment desc","ca","cd");
|
||||
|
||||
$own=new Own($this->db);
|
||||
$ord= ( ! isset ($_GET['ord']))?'da':$_GET['ord'];
|
||||
$order=$table->get_sql_order($ord);
|
||||
|
||||
|
|
@ -1322,6 +1321,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
*/
|
||||
function confirm($p_array,$p_readonly=false)
|
||||
{
|
||||
global $g_parameter;
|
||||
if (! $p_readonly ) $this->verify($p_array);
|
||||
$this->id=$p_array['p_jrn'];
|
||||
if ( empty($p_array)) return 'Aucun résultat';
|
||||
|
|
@ -1336,7 +1336,6 @@ class Acc_Ledger extends jrn_def_sql
|
|||
{
|
||||
$lPeriode->find_periode($e_date);
|
||||
}
|
||||
$owner=new own($this->db);
|
||||
$total=0;
|
||||
bcscale(2);
|
||||
|
||||
|
|
@ -1357,7 +1356,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
$ret.="<th style=\"text-align:right\">"._("Débit")."</th>";
|
||||
$ret.="<th style=\"text-align:right\">"._("Crédit")."</th>";
|
||||
/* if we use the AC */
|
||||
if ($owner->MY_ANALYTIC!='nu')
|
||||
if ($g_parameter->MY_ANALYTIC!='nu')
|
||||
{
|
||||
$anc=new Anc_Plan($this->db);
|
||||
$a_anc=$anc->get_list();
|
||||
|
|
@ -1431,13 +1430,13 @@ class Acc_Ledger extends jrn_def_sql
|
|||
$ret.="</td>";
|
||||
// CA
|
||||
|
||||
if ( $owner->MY_ANALYTIC!='nu') // use of AA
|
||||
if ( $g_parameter->MY_ANALYTIC!='nu') // use of AA
|
||||
{
|
||||
if ( preg_match("/^[6,7]+/",$strPoste)==1)
|
||||
{
|
||||
// show form
|
||||
$op=new Anc_Operation($this->db);
|
||||
$null=($owner->MY_ANALYTIC=='op')?1:0;
|
||||
$null=($g_parameter->MY_ANALYTIC=='op')?1:0;
|
||||
$p_array['pa_id']=$a_anc;
|
||||
/* op is the operation it contains either a sequence or a jrnx.j_id */
|
||||
$ret.=HtmlInput::hidden('op[]=',$i);
|
||||
|
|
@ -1458,7 +1457,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
}
|
||||
$ret.=tr(td('').td(_('Totaux')).td($total,'class="num"').td($total,'class="num"'),'class="footer"');
|
||||
$ret.="</table>";
|
||||
if ( $owner->MY_ANALYTIC!='nu' && $p_readonly==false)
|
||||
if ( $g_parameter->MY_ANALYTIC!='nu' && $p_readonly==false)
|
||||
$ret.='<input type="button" class="button" value="'._('verifie Imputation Analytique').'" onClick="verify_ca(\'\');">';
|
||||
return $ret;
|
||||
}
|
||||
|
|
@ -1472,8 +1471,8 @@ class Acc_Ledger extends jrn_def_sql
|
|||
*/
|
||||
function input($p_array=null,$p_readonly=0)
|
||||
{
|
||||
global $g_parameter;
|
||||
$user = new User($this->db);
|
||||
$owner=new Own($this->db);
|
||||
|
||||
if ( $p_readonly == 1 )
|
||||
return $this->show_summary($p_array);
|
||||
|
|
@ -1481,7 +1480,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
if ( $p_array != null )
|
||||
extract($p_array);
|
||||
$add_js="";
|
||||
if ( $owner->MY_PJ_SUGGEST=='Y')
|
||||
if ( $g_parameter->MY_PJ_SUGGEST=='Y')
|
||||
{
|
||||
$add_js="update_pj();";
|
||||
}
|
||||
|
|
@ -1550,8 +1549,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
|
||||
/* suggest PJ ? */
|
||||
$default_pj='';
|
||||
$owner=new Own($this->db);
|
||||
if ( $owner->MY_PJ_SUGGEST=='Y')
|
||||
if ( $g_parameter->MY_PJ_SUGGEST=='Y')
|
||||
{
|
||||
$default_pj=$this->guess_pj();
|
||||
}
|
||||
|
|
@ -1857,6 +1855,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
*/
|
||||
function save ($p_array)
|
||||
{
|
||||
global $g_parameter;
|
||||
extract ($p_array);
|
||||
try
|
||||
{
|
||||
|
|
@ -1868,7 +1867,6 @@ class Acc_Ledger extends jrn_def_sql
|
|||
$internal=$this->compute_internal_code($seq);
|
||||
|
||||
$group=$this->db->get_next_seq("s_oa_group");
|
||||
$owner=new own($this->db);
|
||||
$tot_amount=0;
|
||||
$tot_deb=0;
|
||||
$tot_cred=0;
|
||||
|
|
@ -1930,7 +1928,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
$tot_amount+=round($acc_op->amount,2);
|
||||
$tot_deb+=($acc_op->type=='d')?$acc_op->amount:0;
|
||||
$tot_cred+=($acc_op->type=='c')?$acc_op->amount:0;
|
||||
if ( $owner->MY_ANALYTIC != "nu" )
|
||||
if ( $g_parameter->MY_ANALYTIC != "nu" )
|
||||
{
|
||||
if ( preg_match("/^[6,7]+/",$poste)==1)
|
||||
{
|
||||
|
|
@ -2143,9 +2141,9 @@ class Acc_Ledger extends jrn_def_sql
|
|||
*/
|
||||
function check_strict()
|
||||
{
|
||||
$owner=new Own($this->db);
|
||||
if ( $owner->MY_STRICT=='Y') return true;
|
||||
if ( $owner->MY_STRICT=='N') return false;
|
||||
global $g_parameter;
|
||||
if ( $g_parameter->MY_STRICT=='Y') return true;
|
||||
if ( $g_parameter->MY_STRICT=='N') return false;
|
||||
exit("Valeur invalid ".__FILE__.':'.__LINE__);
|
||||
}
|
||||
/*!
|
||||
|
|
@ -2155,9 +2153,9 @@ class Acc_Ledger extends jrn_def_sql
|
|||
*/
|
||||
function check_periode()
|
||||
{
|
||||
$owner=new Own($this->db);
|
||||
if ( $owner->MY_CHECK_PERIODE=='Y') return true;
|
||||
if ( $owner->MY_CHECK_PERIODE=='N') return false;
|
||||
global $g_parameter;
|
||||
if ( $g_parameter->MY_CHECK_PERIODE=='Y') return true;
|
||||
if ( $g_parameter->MY_CHECK_PERIODE=='N') return false;
|
||||
exit("Valeur invalid ".__FILE__.':'.__LINE__);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -187,9 +187,9 @@ class Acc_Ledger_Fin extends Acc_Ledger
|
|||
*/
|
||||
function input($p_array=null)
|
||||
{
|
||||
global $g_parameter;
|
||||
if ( $p_array != null)
|
||||
extract ($p_array);
|
||||
$owner=new Own($this->db);
|
||||
|
||||
$pview_only=false;
|
||||
$user = new User($this->db);
|
||||
|
|
@ -203,7 +203,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
|
|||
// The first day of the periode
|
||||
$pPeriode=new Periode($this->db);
|
||||
list ($l_date_start,$l_date_end)=$pPeriode->get_date_limit($user->get_periode());
|
||||
if ( $owner->MY_DATE_SUGGEST=='Y' )
|
||||
if ( $g_parameter->MY_DATE_SUGGEST=='Y' )
|
||||
$op_date=( ! isset($e_date) ) ?$l_date_start:$e_date;
|
||||
else
|
||||
$op_date=( ! isset($e_date) ) ?'':$e_date;
|
||||
|
|
@ -250,7 +250,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
|
|||
|
||||
$add_js='onchange="update_pj();update_bank();get_last_date();ajax_saldo(\'first_sold\');update_name();"';
|
||||
|
||||
if ( $owner->MY_DATE_SUGGEST == 'Y')
|
||||
if ( $g_parameter->MY_DATE_SUGGEST == 'Y')
|
||||
$add_js='onchange="update_pj();update_bank();get_last_date();ajax_saldo(\'first_sold\')";';
|
||||
|
||||
$wLedger=$this->select_ledger('FIN',2);
|
||||
|
|
@ -272,7 +272,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
|
|||
//-------------------------------------------------
|
||||
// Extrait
|
||||
$default_pj='';
|
||||
if ( $owner->MY_PJ_SUGGEST=='Y')
|
||||
if ( $g_parameter->MY_PJ_SUGGEST=='Y')
|
||||
{
|
||||
$default_pj=$this->guess_pj();
|
||||
}
|
||||
|
|
@ -386,11 +386,11 @@ class Acc_Ledger_Fin extends Acc_Ledger
|
|||
*/
|
||||
public function confirm($p_array)
|
||||
{
|
||||
global $g_parameter;
|
||||
$r="";
|
||||
bcscale(2);
|
||||
extract ($p_array);
|
||||
$pPeriode=new Periode($this->db);
|
||||
$owner=new Own($this->db);
|
||||
if ($this->check_periode() == true)
|
||||
{
|
||||
$pPeriode->p_id=$periode;
|
||||
|
|
@ -476,7 +476,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
|
|||
$r.='<th colspan="2"> Op. Concernée(s)</th>';
|
||||
|
||||
/* if we use the AC */
|
||||
if ($owner->MY_ANALYTIC!='nu')
|
||||
if ($g_parameter->MY_ANALYTIC!='nu')
|
||||
{
|
||||
$anc=new Anc_Plan($this->db);
|
||||
$a_anc=$anc->get_list();
|
||||
|
|
@ -525,11 +525,11 @@ class Acc_Ledger_Fin extends Acc_Ledger
|
|||
$r.=${"e_concerned".$i};
|
||||
$r.='</td>';
|
||||
// encode the pa
|
||||
if ( $owner->MY_ANALYTIC!='nu' && preg_match("/^[6,7]/",$fTiers->strAttribut(ATTR_DEF_ACCOUNT))==1 ) // use of AA
|
||||
if ( $g_parameter->MY_ANALYTIC!='nu' && preg_match("/^[6,7]/",$fTiers->strAttribut(ATTR_DEF_ACCOUNT))==1 ) // use of AA
|
||||
{
|
||||
// show form
|
||||
$anc_op=new Anc_Operation($this->db);
|
||||
$null=($owner->MY_ANALYTIC=='op')?1:0;
|
||||
$null=($g_parameter->MY_ANALYTIC=='op')?1:0;
|
||||
$r.='<td>';
|
||||
$p_mode=1;
|
||||
$p_array['pa_id']=$a_anc;
|
||||
|
|
@ -591,6 +591,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
|
|||
*/
|
||||
public function insert($p_array)
|
||||
{
|
||||
global $g_parameter;
|
||||
bcscale(2);
|
||||
$internal_code="";
|
||||
$oid=0;
|
||||
|
|
@ -600,7 +601,6 @@ class Acc_Ledger_Fin extends Acc_Ledger
|
|||
$bank_id=$this->get_bank();
|
||||
$fBank=new Fiche($this->db,$bank_id);
|
||||
$e_bank_account=$fBank->strAttribut(ATTR_DEF_QUICKCODE);
|
||||
$owner=new Own($this->db);
|
||||
// Get the saldo
|
||||
$pPeriode=new Periode($this->db);
|
||||
if ( $this->check_periode() == true )
|
||||
|
|
@ -793,7 +793,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
|
|||
*/
|
||||
$this->insert_quant_fin($fBank->id,$jr_id,$fPoste->id,${"e_other$i"."_amount"});
|
||||
|
||||
if ( $owner->MY_ANALYTIC != "nu" )
|
||||
if ( $g_parameter->MY_ANALYTIC != "nu" )
|
||||
{
|
||||
// for each item, insert into operation_analytique */
|
||||
$op=new Anc_Operation($this->db);
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
*/
|
||||
public function verify($p_array)
|
||||
{
|
||||
global $g_parameter;
|
||||
extract ($p_array);
|
||||
/* check if we can write into this ledger */
|
||||
$user=new User($this->db);
|
||||
|
|
@ -165,9 +166,8 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
if ( isNumber(${'e_quant'.$i}) == 0 )
|
||||
throw new Exception(_('La fiche ').${'e_march'.$i}._('a une quantité invalide').' ['.${'e_quant'.$i}.']',7);
|
||||
|
||||
$owner=new Own($this->db);
|
||||
// Check if the given tva id is valid
|
||||
if ( $owner->MY_TVA_USE=='Y')
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
if (${'e_march'.$i.'_tva_id'} == 0 )
|
||||
throw new Exception(_('La fiche ').${'e_march'.$i}._('a un code tva invalide').' ['.${'e_march'.$i.'_tva_id'}.']',13);
|
||||
|
|
@ -301,10 +301,10 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
*/
|
||||
public function insert($p_array)
|
||||
{
|
||||
global $g_parameter;
|
||||
extract ($p_array);
|
||||
$this->verify($p_array) ;
|
||||
|
||||
$owner=new own($this->db);
|
||||
$group=$this->db->get_next_seq("s_oa_group"); /* for analytic */
|
||||
$seq=$this->db->get_next_seq('s_grpt');
|
||||
$this->id=$p_jrn;
|
||||
|
|
@ -358,7 +358,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$fiche->get_by_qcode(${"e_march".$i});
|
||||
|
||||
/* tva */
|
||||
if ($owner->MY_TVA_USE=='Y')
|
||||
if ($g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
$idx_tva=${'e_march'.$i.'_tva_id'};
|
||||
$oTva=new Acc_Tva($this->db);
|
||||
|
|
@ -371,7 +371,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$acc_amount=new Acc_Compute();
|
||||
$acc_amount->check=false;
|
||||
$acc_amount->set_parameter('amount',$amount);
|
||||
if ( $owner->MY_TVA_USE=='Y')
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
$acc_amount->set_parameter('amount_vat_rate',$oTva->get_parameter('rate'));
|
||||
if ( strlen(trim(${'e_march'.$i.'_tva_amount'})) ==0)
|
||||
|
|
@ -453,7 +453,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
|
||||
/* Compute sum vat */
|
||||
|
||||
if ( $owner->MY_TVA_USE=='Y')
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
$tva_item=$acc_amount->amount_vat;
|
||||
|
||||
|
|
@ -477,7 +477,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
|
||||
InsertStockGoods($this->db,$j_id,${'e_march'.$i},$nNeg*${'e_quant'.$i},'d') ;
|
||||
|
||||
if ( $owner->MY_ANALYTIC != "nu" )
|
||||
if ( $g_parameter->MY_ANALYTIC != "nu" )
|
||||
{
|
||||
// for each item, insert into operation_analytique */
|
||||
$op=new Anc_Operation($this->db);
|
||||
|
|
@ -491,7 +491,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
}
|
||||
// insert into quant_purchase
|
||||
//-----
|
||||
if ( $owner->MY_TVA_USE=='Y')
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
$r=$this->db->exec_sql("select insert_quant_purchase ".
|
||||
"(null".
|
||||
|
|
@ -643,7 +643,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
|
||||
}
|
||||
|
||||
if ( $owner->MY_TVA_USE=='Y')
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
/* save all vat
|
||||
* $i contains the tva_id and value contains the vat amount
|
||||
|
|
@ -876,11 +876,11 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
*/
|
||||
public function input($p_array=null)
|
||||
{
|
||||
global $g_parameter;
|
||||
if ( $p_array != null ) extract($p_array);
|
||||
|
||||
$user = new User($this->db);
|
||||
$owner=new Own($this->db);
|
||||
$flag_tva=$owner->MY_TVA_USE;
|
||||
$flag_tva=$g_parameter->MY_TVA_USE;
|
||||
/* Add button */
|
||||
$f_add_button=new IButton('add_card');
|
||||
$f_add_button->label=_('Créer une nouvelle fiche');
|
||||
|
|
@ -901,7 +901,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
// The first day of the periode
|
||||
$oPeriode=new Periode($this->db);
|
||||
list ($l_date_start,$l_date_end)=$oPeriode->get_date_limit($user->get_periode());
|
||||
if ( $owner->MY_DATE_SUGGEST=='Y' )
|
||||
if ( $g_parameter->MY_DATE_SUGGEST=='Y' )
|
||||
$op_date=( ! isset($e_date) ) ?$l_date_start:$e_date;
|
||||
else
|
||||
$op_date=( ! isset($e_date) ) ?'':$e_date;
|
||||
|
|
@ -962,7 +962,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
//--
|
||||
/* if we suggest the next pj, then we need a javascript */
|
||||
$add_js="";
|
||||
if ( $owner->MY_PJ_SUGGEST=='Y')
|
||||
if ( $g_parameter->MY_PJ_SUGGEST=='Y')
|
||||
{
|
||||
$add_js="update_pj();";
|
||||
}
|
||||
|
|
@ -989,7 +989,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
//--
|
||||
/* suggest PJ ? */
|
||||
$default_pj='';
|
||||
if ( $owner->MY_PJ_SUGGEST=='Y')
|
||||
if ( $g_parameter->MY_PJ_SUGGEST=='Y')
|
||||
{
|
||||
$default_pj=$this->guess_pj();
|
||||
}
|
||||
|
|
@ -1074,7 +1074,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$march_price=(isset(${"e_march".$i."_price"}))?${"e_march".$i."_price"}:""
|
||||
;
|
||||
/* use vat */
|
||||
if ( $owner->MY_TVA_USE=='Y')
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
$march_tva_id=(isset(${"e_march$i"."_tva_id"}))?${"e_march$i"."_tva_id"}:""
|
||||
;
|
||||
|
|
@ -1093,7 +1093,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$fMarch->get_by_qcode($march);
|
||||
$march_label=$fMarch->strAttribut(ATTR_DEF_NAME);
|
||||
/* vat use */
|
||||
if ( ! isset($march_tva_id) && $owner->MY_TVA_USE=='Y' )
|
||||
if ( ! isset($march_tva_id) && $g_parameter->MY_TVA_USE=='Y' )
|
||||
$march_tva_id=$fMarch->strAttribut(ATTR_DEF_TVA);
|
||||
}
|
||||
// Show input
|
||||
|
|
@ -1127,12 +1127,12 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
|
||||
$array[$i]['hidden']='';
|
||||
// For computing we need some hidden field for holding the value
|
||||
if ( $owner->MY_TVA_USE=='Y')
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
$array[$i]['hidden'].=HtmlInput::hidden('tva_march'.$i,0);
|
||||
}
|
||||
|
||||
if ( $owner->MY_TVA_USE=='Y')
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
$tvac=new INum('tvac_march'.$i);
|
||||
else
|
||||
$tvac=new IHidden('tvac_march'.$i);
|
||||
|
|
@ -1158,7 +1158,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$Price->size=9;
|
||||
$Price->javascript="onBlur='format_number(this);clean_tva($i);compute_ledger($i)'";
|
||||
$array[$i]['pu']=$Price->input("e_march".$i."_price",$march_price);
|
||||
if ( $owner->MY_TVA_USE=='Y')
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
|
||||
// vat label
|
||||
|
|
@ -1204,7 +1204,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
|
||||
|
||||
/* if we suggest the pj n# the run the script */
|
||||
if ( $owner->MY_PJ_SUGGEST=='Y')
|
||||
if ( $g_parameter->MY_PJ_SUGGEST=='Y')
|
||||
{
|
||||
$r.='<script> update_pj();</script>';
|
||||
}
|
||||
|
|
@ -1230,6 +1230,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
*/
|
||||
function confirm($p_array,$p_summary=false)
|
||||
{
|
||||
global $g_parameter;
|
||||
extract ($p_array);
|
||||
|
||||
// we don't need to verify if we need only a feedback
|
||||
|
|
@ -1239,7 +1240,6 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$anc=null;
|
||||
// to show a select list for the analytic
|
||||
// if analytic is op (optionnel) there is a blank line
|
||||
$owner = new Own($this->db);
|
||||
|
||||
bcscale(4);
|
||||
$client=new Fiche($this->db);
|
||||
|
|
@ -1288,7 +1288,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$r.="<th>"._('Dénomination')."</th>";
|
||||
$r.="<th>"._('prix')."</th>";
|
||||
/* vat use */
|
||||
if ( $owner->MY_TVA_USE=='Y')
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
$r.="<th>"._('quantité')."</th>";
|
||||
$r.="<th>tva</th>";
|
||||
|
|
@ -1303,7 +1303,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
}
|
||||
|
||||
/* if we use the AC */
|
||||
if ($owner->MY_ANALYTIC!='nu')
|
||||
if ($g_parameter->MY_ANALYTIC!='nu')
|
||||
{
|
||||
$anc=new Anc_Plan($this->db);
|
||||
$a_anc=$anc->get_list();
|
||||
|
|
@ -1331,7 +1331,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$fiche->get_by_qcode(${"e_march".$i});
|
||||
$fiche_name=h($fiche->getName());
|
||||
|
||||
if ( $owner->MY_TVA_USE=='Y')
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
$idx_tva=${"e_march".$i."_tva_id"};
|
||||
$oTva=new Acc_Tva($this->db);
|
||||
|
|
@ -1340,7 +1340,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
}
|
||||
$amount=bcmul(${"e_march".$i."_price"},${'e_quant'.$i});
|
||||
|
||||
if ( $owner->MY_TVA_USE=='Y')
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
//----- if tva_amount is not given we compute the vat ----
|
||||
if ( strlen (trim (${'e_march'.$i.'_tva_amount'})) == 0)
|
||||
|
|
@ -1380,7 +1380,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$r.='<td align="right">';
|
||||
$r.=nbm(${"e_quant".$i});
|
||||
$r.='</td>';
|
||||
if ($owner->MY_TVA_USE == 'Y')
|
||||
if ($g_parameter->MY_TVA_USE == 'Y')
|
||||
{
|
||||
$r.='<td align="right">';
|
||||
$r.=$oTva->get_parameter('label');
|
||||
|
|
@ -1396,11 +1396,11 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$r.=nbm(round($tot_row,2));
|
||||
$r.='</td>';
|
||||
// encode the pa
|
||||
if ( $owner->MY_ANALYTIC!='nu') // use of AA
|
||||
if ( $g_parameter->MY_ANALYTIC!='nu') // use of AA
|
||||
{
|
||||
// show form
|
||||
$anc_op=new Anc_Operation($this->db);
|
||||
$null=($owner->MY_ANALYTIC=='op')?1:0;
|
||||
$null=($g_parameter->MY_ANALYTIC=='op')?1:0;
|
||||
$r.='<td>';
|
||||
$p_mode=($p_summary==false)?1:0;
|
||||
$p_array['pa_id']=$a_anc;
|
||||
|
|
@ -1417,7 +1417,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
|
||||
|
||||
$r.='</table>';
|
||||
if ( $owner->MY_ANALYTIC!='nu' && !$p_summary) // use of AA
|
||||
if ( $g_parameter->MY_ANALYTIC!='nu' && !$p_summary) // use of AA
|
||||
$r.='<input type="button" class="button" value="'._('Vérifiez imputation analytique').'" onClick="verify_ca(\'\');">';
|
||||
$r.='</fieldset>';
|
||||
|
||||
|
|
@ -1430,7 +1430,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$r.='<div style="position:float;float:left;text-align:right;padding-left:5%;padding-right:5%;color:blue;font-size:1.2em;font-weight:bold">';
|
||||
|
||||
$r.='<br>'._('Total HTVA');
|
||||
if ($owner->MY_TVA_USE=='Y')
|
||||
if ($g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
foreach ($tva as $i=>$value)
|
||||
{
|
||||
|
|
@ -1450,7 +1450,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$r.='<div style="position:float;float:left;text-align:right;color:blue;font-size:1.2em;font-weight:bold">';
|
||||
$r.='<br><span id="htva">'.nbm($tot_amount).'</span>';
|
||||
|
||||
if ( $owner->MY_TVA_USE=='Y')
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
foreach ($tva as $i=>$value)
|
||||
{
|
||||
|
|
@ -1498,7 +1498,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
{
|
||||
$r.=HtmlInput::hidden("e_march".$i,${"e_march".$i});
|
||||
$r.=HtmlInput::hidden("e_march".$i."_price",${"e_march".$i."_price"});
|
||||
if ( $owner->MY_TVA_USE=='Y' )
|
||||
if ( $g_parameter->MY_TVA_USE=='Y' )
|
||||
{
|
||||
$r.=HtmlInput::hidden("e_march".$i."_tva_id",${"e_march".$i."_tva_id"});
|
||||
$r.=HtmlInput::hidden('e_march'.$i.'_tva_amount', ${'e_march'.$i.'_tva_amount'});
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
*/
|
||||
public function verify($p_array)
|
||||
{
|
||||
global $g_parameter;
|
||||
extract ($p_array);
|
||||
/* check for a double reload */
|
||||
if ( isset($mt) && $this->db->count_sql('select jr_mt from jrn where jr_mt=$1',array($mt)) != 0 )
|
||||
|
|
@ -167,8 +168,7 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
throw new Exception(_('La fiche ').${'e_march'.$i}._('n\'a pas de poste comptable'),8);
|
||||
|
||||
// Check if the given tva id is valid
|
||||
$owner=new Own($this->db);
|
||||
if ( $owner->MY_TVA_USE=='Y')
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
if ( isNumber(${'e_march'.$i.'_tva_id'}) == 0 )
|
||||
throw new Exception(_('La fiche ').${'e_march'.$i}._('a un code tva invalide').' ['.${'e_march'.$i.'_tva_id'}.']',13);
|
||||
|
|
@ -236,10 +236,10 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
*/
|
||||
public function insert($p_array)
|
||||
{
|
||||
global $g_parameter;
|
||||
extract ($p_array);
|
||||
$this->verify($p_array) ;
|
||||
|
||||
$owner=new own($this->db);
|
||||
$group=$this->db->get_next_seq("s_oa_group"); /* for analytic */
|
||||
$seq=$this->db->get_next_seq('s_grpt');
|
||||
$this->id=$p_jrn;
|
||||
|
|
@ -315,7 +315,7 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
|
||||
$j_id=$acc_operation->insert_jrnx();
|
||||
|
||||
if ($owner->MY_TVA_USE == 'Y' )
|
||||
if ($g_parameter->MY_TVA_USE == 'Y' )
|
||||
{
|
||||
/* Compute sum vat */
|
||||
$oTva=new Acc_Tva($this->db);
|
||||
|
|
@ -349,7 +349,7 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
// what card need a stock management
|
||||
InsertStockGoods($this->db,$j_id,${'e_march'.$i},$nNeg*${'e_quant'.$i},'c') ;
|
||||
|
||||
if ( $owner->MY_ANALYTIC != "nu" )
|
||||
if ( $g_parameter->MY_ANALYTIC != "nu" )
|
||||
{
|
||||
// for each item, insert into operation_analytique */
|
||||
$op=new Anc_Operation($this->db);
|
||||
|
|
@ -360,7 +360,7 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
$op->oa_description=sql_string($e_comm);
|
||||
$op->save_form_plan($_POST,$i,$j_id);
|
||||
}
|
||||
if ( $owner->MY_TVA_USE=='Y')
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
/* save into quant_sold */
|
||||
$r=$this->db->exec_sql("select insert_quant_sold ($1,$2,$3,$4,$5,$6,$7,$8)",
|
||||
|
|
@ -386,7 +386,7 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
null,
|
||||
$e_client));
|
||||
|
||||
} // if ( $owner->MY_TVA_USE=='Y') {
|
||||
} // if ( $g_parameter->MY_TVA_USE=='Y') {
|
||||
}// end loop : save all items
|
||||
|
||||
/* save total customer */
|
||||
|
|
@ -406,9 +406,9 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
|
||||
/** save all vat
|
||||
* $i contains the tva_id and value contains the vat amount
|
||||
* if if ($owner->MY_TVA_USE == 'Y' )
|
||||
* if if ($g_parameter->MY_TVA_USE == 'Y' )
|
||||
*/
|
||||
if ($owner->MY_TVA_USE == 'Y' )
|
||||
if ($g_parameter->MY_TVA_USE == 'Y' )
|
||||
{
|
||||
foreach ($tva as $i => $value)
|
||||
{
|
||||
|
|
@ -432,7 +432,7 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
|
||||
|
||||
}
|
||||
} // if ($owner->MY_TVA_USE=='Y')
|
||||
} // if ($g_parameter->MY_TVA_USE=='Y')
|
||||
/* insert into jrn */
|
||||
$acc_operation=new Acc_Operation($this->db);
|
||||
$acc_operation->date=$e_date;
|
||||
|
|
@ -615,6 +615,7 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
*/
|
||||
function confirm($p_array,$p_summary=false)
|
||||
{
|
||||
global $g_parameter;
|
||||
extract ($p_array);
|
||||
|
||||
// don't need to verify for a summary
|
||||
|
|
@ -622,7 +623,6 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
$anc=null;
|
||||
// to show a select list for the analytic & VAT USE
|
||||
// if analytic is op (optionnel) there is a blank line
|
||||
$owner = new Own($this->db);
|
||||
|
||||
bcscale(4);
|
||||
$client=new Fiche($this->db);
|
||||
|
|
@ -674,13 +674,13 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
$r.="<th>"._('tva')."</th>";
|
||||
|
||||
|
||||
if ( $owner->MY_TVA_USE=='Y')
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
$r.='<th> '._('Montant TVA').'</th>';
|
||||
$r.='<th>'._('Montant HTVA').'</th>';
|
||||
}
|
||||
/* if we use the AC */
|
||||
if ($owner->MY_ANALYTIC!='nu')
|
||||
if ($g_parameter->MY_ANALYTIC!='nu')
|
||||
{
|
||||
$anc=new Anc_Plan($this->db);
|
||||
$a_anc=$anc->get_list();
|
||||
|
|
@ -702,7 +702,7 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
$fiche=new Fiche($this->db);
|
||||
$fiche->get_by_qcode(${"e_march".$i});
|
||||
$fiche_name=h($fiche->getName());
|
||||
if ( $owner->MY_TVA_USE=='Y')
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
$oTva=new Acc_Tva($this->db);
|
||||
$idx_tva=${"e_march".$i."_tva_id"};
|
||||
|
|
@ -713,7 +713,7 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
$op=new Acc_Compute();
|
||||
$amount=bcmul(${"e_march".$i."_price"},${'e_quant'.$i});
|
||||
$op->set_parameter("amount",$amount);
|
||||
if ( $owner->MY_TVA_USE=='Y')
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
$op->set_parameter('amount_vat_rate',$oTva->get_parameter('rate'));
|
||||
$op->compute_vat();
|
||||
|
|
@ -740,7 +740,7 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
$r.='<td align="right">';
|
||||
$r.=${"e_quant".$i};
|
||||
$r.='</td>';
|
||||
if ( $owner->MY_TVA_USE=='Y')
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
$r.='<td align="right">';
|
||||
$r.=$oTva->get_parameter('label');
|
||||
|
|
@ -760,11 +760,11 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
$r.='</td>';
|
||||
|
||||
// encode the pa
|
||||
if ( $owner->MY_ANALYTIC!='nu') // use of AA
|
||||
if ( $g_parameter->MY_ANALYTIC!='nu') // use of AA
|
||||
{
|
||||
// show form
|
||||
$anc_op=new Anc_Operation($this->db);
|
||||
$null=($owner->MY_ANALYTIC=='op')?1:0;
|
||||
$null=($g_parameter->MY_ANALYTIC=='op')?1:0;
|
||||
$r.='<td>';
|
||||
$p_mode=($p_summary==false)?1:0;
|
||||
$p_array['pa_id']=$a_anc;
|
||||
|
|
@ -781,7 +781,7 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
|
||||
|
||||
$r.='</table>';
|
||||
if ( $owner->MY_ANALYTIC!='nu' && $p_summary ) // use of AA
|
||||
if ( $g_parameter->MY_ANALYTIC!='nu' && $p_summary ) // use of AA
|
||||
$r.='<input type="button" class="button" value="'._('Vérifiez Imputation Analytique').'" onClick="verify_ca(\'\');">';
|
||||
$r.='</fieldset>';
|
||||
if (! $p_summary )
|
||||
|
|
@ -795,7 +795,7 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
$tot=round(bcadd($tot_amount,$tot_tva),2);
|
||||
$r.='<div style="width:40%;position:float;float:left;text-align:right;padding-left:5%;padding-right:5%;color:blue;font-size:1.2em;font-weight:bold">';
|
||||
/* use VAT */
|
||||
if ($owner->MY_TVA_USE == 'Y' )
|
||||
if ($g_parameter->MY_TVA_USE == 'Y' )
|
||||
{
|
||||
$r.='<br>Total HTVA';
|
||||
foreach ($tva as $i=>$value)
|
||||
|
|
@ -817,7 +817,7 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
$r.='<div style="position:float;float:left;text-align:right;color:blue;font-size:1.2em;font-weight:bold">';
|
||||
$r.='<br><span id="htva">'.nbm($tot_amount).'</span>';
|
||||
|
||||
if ($owner->MY_TVA_USE == 'Y' )
|
||||
if ($g_parameter->MY_TVA_USE == 'Y' )
|
||||
{
|
||||
foreach ($tva as $i=>$value)
|
||||
{
|
||||
|
|
@ -869,7 +869,7 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
{
|
||||
$r.=HtmlInput::hidden("e_march".$i,${"e_march".$i});
|
||||
$r.=HtmlInput::hidden("e_march".$i."_price",${"e_march".$i."_price"});
|
||||
if ( $owner->MY_TVA_USE=='Y')
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
$r.=HtmlInput::hidden("e_march".$i."_tva_id",${"e_march".$i."_tva_id"});
|
||||
$r.=HtmlInput::hidden("e_march".$i."_tva_amount",${"e_march".$i."_tva_amount"});
|
||||
|
|
@ -964,10 +964,10 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
*/
|
||||
function input($p_array=null)
|
||||
{
|
||||
global $g_parameter;
|
||||
if ( $p_array != null ) extract($p_array);
|
||||
$user = new User($this->db);
|
||||
$owner=new Own($this->db);
|
||||
$flag_tva=$owner->MY_TVA_USE;
|
||||
$flag_tva=$g_parameter->MY_TVA_USE;
|
||||
/* Add button */
|
||||
$f_add_button=new IButton('add_card');
|
||||
$f_add_button->label=_('Créer une nouvelle fiche');
|
||||
|
|
@ -988,7 +988,7 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
// The first day of the periode
|
||||
$oPeriode=new Periode($this->db);
|
||||
list ($l_date_start,$l_date_end)=$oPeriode->get_date_limit($user->get_periode());
|
||||
if ( $owner->MY_DATE_SUGGEST=='Y' )
|
||||
if ( $g_parameter->MY_DATE_SUGGEST=='Y' )
|
||||
$op_date=( ! isset($e_date) ) ?$l_date_start:$e_date;
|
||||
else
|
||||
$op_date=( ! isset($e_date) ) ?'':$e_date;
|
||||
|
|
@ -1042,7 +1042,7 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
}
|
||||
/* if we suggest the next pj, then we need a javascript */
|
||||
$add_js="";
|
||||
if ( $owner->MY_PJ_SUGGEST=='Y')
|
||||
if ( $g_parameter->MY_PJ_SUGGEST=='Y')
|
||||
{
|
||||
$add_js="update_pj();";
|
||||
}
|
||||
|
|
@ -1071,7 +1071,7 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
//--
|
||||
/* suggest PJ ? */
|
||||
$default_pj='';
|
||||
if ( $owner->MY_PJ_SUGGEST=='Y')
|
||||
if ( $g_parameter->MY_PJ_SUGGEST=='Y')
|
||||
{
|
||||
$default_pj=$this->guess_pj();
|
||||
}
|
||||
|
|
@ -1211,7 +1211,7 @@ class Acc_Ledger_Sold extends Acc_Ledger
|
|||
$htva->value=0;
|
||||
$array[$i]['htva']=$htva->input();
|
||||
|
||||
if ( $owner->MY_TVA_USE=='Y')
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
$tvac=new INum('tvac_march'.$i);
|
||||
else
|
||||
$tvac=new IHidden('tvac_march'.$i);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ $cn=new Database(dossier::id());
|
|||
//menu = show a list of ledger
|
||||
$str_dossier=dossier::get();
|
||||
$ac="ac=".$_REQUEST['ac'];
|
||||
|
||||
global $g_parameter;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Encode a new invoice
|
||||
|
|
@ -239,9 +239,8 @@ $ac="ac=".$_REQUEST['ac'];
|
|||
echo '</div>';
|
||||
echo "</FORM>";
|
||||
|
||||
$own=new Own($cn);
|
||||
/* if we suggest the pj n# the run the script */
|
||||
if ( $own->MY_PJ_SUGGEST=='Y')
|
||||
if ( $g_parameter->MY_PJ_SUGGEST=='Y')
|
||||
{
|
||||
echo '<script> update_pj();get_last_date()</script>';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue