Task #1762 , printtva peut mettre donner les totaux de tva
suivant l'exigibilité configuré par Code TVA , par date de paiement ou par date d'opération
This commit is contained in:
parent
6b96cb0a44
commit
096169b987
39 changed files with 694 additions and 228 deletions
|
|
@ -63,7 +63,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
var $id; /**< jrn_def.jrn_def_id */
|
||||
var $db; /**< database connextion */
|
||||
var $row; /**< row of the ledger */
|
||||
var $type; /**< type of the ledger ACH ODS FIN VEN or GL */
|
||||
var $ledger_type; /**< type of the ledger ACH ODS FIN VEN or GL */
|
||||
var $nb; /**< default number of rows by
|
||||
default 10 */
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
if ($this->id==0)
|
||||
{
|
||||
$this->ledger_name=_(" Tous les journaux");
|
||||
$this->type="GL";
|
||||
$this->ledger_type="GL";
|
||||
return "GL";
|
||||
}
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
if ($Max==0)
|
||||
return null;
|
||||
$ret=Database::fetch_array($Res, 0);
|
||||
$this->type=$ret['jrn_def_type'];
|
||||
$this->ledger_type=$ret['jrn_def_type'];
|
||||
return $ret['jrn_def_type'];
|
||||
}
|
||||
|
||||
|
|
@ -452,6 +452,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
*/
|
||||
function get_solde($p_from, $p_to)
|
||||
{
|
||||
bcscale(4);
|
||||
$ledger="";
|
||||
if ($this->id!=0)
|
||||
{
|
||||
|
|
@ -471,9 +472,9 @@ class Acc_Ledger extends jrn_def_sql
|
|||
{
|
||||
|
||||
if ($line['deb']=='t')
|
||||
$deb+=$line['montant'];
|
||||
$deb=bcadd($deb,$line['montant']);
|
||||
else
|
||||
$cred+=$line['montant'];
|
||||
$cred=bcadd($cred,$line['montant']);
|
||||
}
|
||||
$response=array($deb, $cred);
|
||||
return $response;
|
||||
|
|
@ -1359,14 +1360,6 @@ class Acc_Ledger extends jrn_def_sql
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get all the data from request and build the object
|
||||
*/
|
||||
function get_request()
|
||||
{
|
||||
$this->id=$_REQUEST['p_jrn'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief retrieve the next number for this type of ledger
|
||||
* @param p_cn connx
|
||||
|
|
@ -1773,18 +1766,30 @@ class Acc_Ledger extends jrn_def_sql
|
|||
*/
|
||||
public function existing_vat()
|
||||
{
|
||||
if ($this->type=='ACH')
|
||||
$array=[];
|
||||
if ($this->get_type()=='ACH')
|
||||
{
|
||||
$array=$this->db->get_array("select tva_id,tva_label,tva_poste from tva_rate where tva_rate != 0.0000 ".
|
||||
" and exists (select qp_vat_code from quant_purchase
|
||||
where qp_vat_code=tva_id and exists (select j_id from jrnx where j_jrn_def = $1)) order by tva_id",
|
||||
$array=$this->db->get_array("select tva_id,tva_label,tva_poste
|
||||
from tva_rate
|
||||
where tva_rate != 0.0000
|
||||
and exists (select qp_vat_code from quant_purchase
|
||||
where
|
||||
qp_vat_code=tva_id
|
||||
and exists (select j_id
|
||||
from jrnx where j_jrn_def = $1))
|
||||
order by tva_id",
|
||||
array($this->id));
|
||||
}
|
||||
if ($this->type=='VEN')
|
||||
if ($this->get_type()=='VEN')
|
||||
{
|
||||
$array=$this->db->get_array("select tva_id,tva_label,tva_poste from tva_rate where tva_rate != 0.0000 ".
|
||||
" and exists (select qs_vat_code from quant_sold
|
||||
where qs_vat_code=tva_id and exists (select j_id from jrnx where j_jrn_def = $1)) order by tva_id",
|
||||
$array=$this->db->get_array("select tva_id,tva_label,tva_poste
|
||||
from tva_rate
|
||||
where tva_rate != 0.0000
|
||||
and exists (select qs_vat_code from quant_sold
|
||||
where qs_vat_code=tva_id
|
||||
and
|
||||
exists (select j_id from jrnx where j_jrn_def = $1))
|
||||
order by tva_id",
|
||||
array($this->id));
|
||||
}
|
||||
return $array;
|
||||
|
|
@ -1808,7 +1813,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
*/
|
||||
function get_other_amount($p_jr_id)
|
||||
{
|
||||
if ($this->type=='ACH')
|
||||
if ($this->get_type()=='ACH')
|
||||
{
|
||||
$array=$this->db->get_array('select sum(qp_price) as price,sum(qp_vat) as vat '.
|
||||
',sum(coalesce(qp_nd_amount,0)+coalesce(qp_dep_priv,0)) as priv'.
|
||||
|
|
@ -1818,7 +1823,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
where j_grpt=$1 ', array($p_jr_id));
|
||||
$ret=$array[0];
|
||||
}
|
||||
if ($this->type=='VEN')
|
||||
if ($this->get_type()=='VEN')
|
||||
{
|
||||
$array=$this->db->get_array('select sum(qs_price) as price,sum(qs_vat) as vat '.
|
||||
',0 as priv'.
|
||||
|
|
@ -1844,14 +1849,14 @@ class Acc_Ledger extends jrn_def_sql
|
|||
*/
|
||||
function vat_operation($p_jr_id)
|
||||
{
|
||||
if ($this->type=='ACH')
|
||||
if ($this->get_type()=='ACH')
|
||||
{
|
||||
$array=$this->db->get_array('select coalesce(sum(qp_vat),0) as sum_vat,tva_id
|
||||
from quant_purchase as p right join tva_rate on (qp_vat_code=tva_id) join jrnx using(j_id)
|
||||
where tva_rate !=0.0 and j_grpt=$1 group by tva_id',
|
||||
array($p_jr_id));
|
||||
}
|
||||
if ($this->type=='VEN')
|
||||
if ($this->get_type()=='VEN')
|
||||
{
|
||||
$array=$this->db->get_array('select coalesce(sum(qs_vat),0) as sum_vat,tva_id
|
||||
from quant_sold as p right join tva_rate on (qs_vat_code=tva_id) join jrnx using(j_id)
|
||||
|
|
@ -1903,7 +1908,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
$max_date=$periode_max->first_day();
|
||||
bcscale(2);
|
||||
// min periode
|
||||
if ($this->type=='ACH')
|
||||
if ($this->get_type()=='ACH')
|
||||
{
|
||||
/* get all amount exclude vat */
|
||||
$sql="select coalesce(sum(qp_price),0) as price".
|
||||
|
|
@ -1928,7 +1933,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
array($min_date, $max_date, $this->id));
|
||||
$ret['tva']=$array;
|
||||
}
|
||||
if ($this->type=='VEN')
|
||||
if ($this->get_type()=='VEN')
|
||||
{
|
||||
/* get all amount exclude vat */
|
||||
$sql="select coalesce(sum(qs_price),0) as price".
|
||||
|
|
@ -1953,7 +1958,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
array($min_date, $max_date, $this->id));
|
||||
$ret['tva']=$array;
|
||||
}
|
||||
if ($this->type=="FIN")
|
||||
if ($this->get_type()=="FIN")
|
||||
{
|
||||
|
||||
/* find the quick code of this ledger */
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ abstract class Acc_Ledger_History
|
|||
protected $ma_ledger; //!< Array of ledger id : jrn_def.jrn_def_id
|
||||
protected $m_mode; //!< mode of export L : one line, E accounting writing , D : Detail
|
||||
public $db; //!< database connx
|
||||
protected $ledger_type; //! type of ledger VEN , ACH , ODS, FIN
|
||||
protected $filter_operation; //!< to filter paid, unpaid or all operation
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -61,6 +63,7 @@ abstract class Acc_Ledger_History
|
|||
$this->m_from=$p_from;
|
||||
$this->m_to=$p_to;
|
||||
$this->m_mode=$p_mode;
|
||||
$this->filter_operation='all';
|
||||
}
|
||||
/**
|
||||
* setter / getter
|
||||
|
|
@ -70,6 +73,22 @@ abstract class Acc_Ledger_History
|
|||
{
|
||||
return $this->m_from;
|
||||
}
|
||||
public function get_ledger_type()
|
||||
{
|
||||
return $this->ledger_type;
|
||||
}
|
||||
|
||||
public function set_ledger_type($ledger_type)
|
||||
{
|
||||
if (! in_array($ledger_type,['ACH','ODS','VEN','FIN'])) {
|
||||
record_log('Acc_Ledger_History:set_ledger_type '.var_export($ledger_type,TRUE));
|
||||
throw new Exception (_("Donnée invalide",EXC_PARAM_VALUE));
|
||||
}
|
||||
|
||||
$this->ledger_type=$ledger_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* setter / getter
|
||||
* @returns m_to (periode id)
|
||||
|
|
@ -141,9 +160,10 @@ abstract class Acc_Ledger_History
|
|||
* @param integer $p_from periode id
|
||||
* @param integer $p_to periode id
|
||||
* @param char $p_mode L (list operation) E (extended detail) A (accouting writing) D (Detailled VAT)
|
||||
* @param $p_paid values are all means all operations, paid only paid operation, unpaid for only unpaid
|
||||
* @return Acc_Ledger_History_Generic Acc_Ledger_History_Sale Acc_Ledger_History_Financial Acc_Ledger_History_Purchase
|
||||
*/
|
||||
static function factory(Database $cn, $pa_ledger, $p_from, $p_to, $p_mode)
|
||||
static function factory(Database $cn, $pa_ledger, $p_from, $p_to, $p_mode,$p_paid)
|
||||
{
|
||||
// For Accounting writing , we use Acc_Ledger_History
|
||||
if ($p_mode=="A")
|
||||
|
|
@ -183,6 +203,7 @@ abstract class Acc_Ledger_History
|
|||
case "ACH":
|
||||
$ret=new Acc_Ledger_History_Purchase($cn, $pa_ledger, $p_from,
|
||||
$p_to, $p_mode);
|
||||
$ret->set_filter_operation($p_paid);
|
||||
return $ret;
|
||||
break;
|
||||
case "FIN":
|
||||
|
|
@ -193,6 +214,7 @@ abstract class Acc_Ledger_History
|
|||
case "VEN":
|
||||
$ret=new Acc_Ledger_History_Sale($cn, $pa_ledger, $p_from,
|
||||
$p_to, $p_mode);
|
||||
$ret->set_filter_operation($p_paid);
|
||||
return $ret;
|
||||
break;
|
||||
|
||||
|
|
@ -233,11 +255,17 @@ abstract class Acc_Ledger_History
|
|||
switch ($p_jrn_type)
|
||||
{
|
||||
case 'VEN':
|
||||
$tiers=$this->db->get_value('select max(qs_client) from quant_sold join jrnx using (j_id) join jrn on (jr_grpt_id=j_grpt) where jrn.jr_id=$1',
|
||||
$tiers=$this->db->get_value('select max(qs_client) '
|
||||
. 'from quant_sold join jrnx using (j_id) '
|
||||
. 'join jrn on (jr_grpt_id=j_grpt) where jrn.jr_id=$1',
|
||||
array($jr_id));
|
||||
break;
|
||||
case 'ACH':
|
||||
$tiers=$this->db->get_value('select max(qp_supplier) from quant_purchase join jrnx using (j_id) join jrn on (jr_grpt_id=j_grpt) where jrn.jr_id=$1',
|
||||
$tiers=$this->db->get_value('select max(qp_supplier) '
|
||||
. ' from quant_purchase '
|
||||
. ' join jrnx using (j_id) '
|
||||
. ' join jrn on (jr_grpt_id=j_grpt) '
|
||||
. ' where jrn.jr_id=$1',
|
||||
array($jr_id));
|
||||
|
||||
break;
|
||||
|
|
@ -287,4 +315,49 @@ abstract class Acc_Ledger_History
|
|||
abstract function export_html();
|
||||
|
||||
abstract function get_row($p_limit, $p_offset);
|
||||
|
||||
/**
|
||||
* Build a SQL clause to filter operation depending if they are paid, unpaid or no filter
|
||||
* @return string SQL Clause
|
||||
*/
|
||||
protected function build_filter_operation()
|
||||
{
|
||||
switch ( $this->get_filter_operation() )
|
||||
{
|
||||
case 'all':
|
||||
$sql_filter="";
|
||||
break;
|
||||
case 'paid':
|
||||
$sql_filter=" and (jr_date_paid is not null or jr_rapt ='paid' ) ";
|
||||
break;
|
||||
case 'unpaid':
|
||||
$sql_filter=" and (jr_date_paid is null and coalesce(jr_rapt,'x') <> 'paid' ) ";
|
||||
break;
|
||||
default:
|
||||
throw new Exception(_("Filtre invalide",5));
|
||||
|
||||
}
|
||||
return $sql_filter;
|
||||
}
|
||||
/**
|
||||
* Filter operation
|
||||
*/
|
||||
function get_filter_operation()
|
||||
{
|
||||
return $this->filter_operation;
|
||||
}
|
||||
/**
|
||||
* Filter operation ,
|
||||
* @param string $filter_operation, valid : all, paid, unpaid
|
||||
*/
|
||||
|
||||
public function set_filter_operation($filter_operation)
|
||||
{
|
||||
if (in_array($filter_operation,['all','paid','unpaid']))
|
||||
{
|
||||
$this->filter_operation=$filter_operation;
|
||||
return $this;
|
||||
}
|
||||
throw new Exception(_("Filter invalide ".$filter_operation),5);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,11 @@ require_once NOALYSS_INCLUDE."/class/acc_ledger_history.class.php";
|
|||
|
||||
class Acc_Ledger_History_Financial extends Acc_Ledger_History
|
||||
{
|
||||
|
||||
function __construct(Database $cn, $pa_ledger, $p_from, $p_to, $p_mode)
|
||||
{
|
||||
parent::__construct($cn, $pa_ledger, $p_from, $p_to, $p_mode);
|
||||
$this->ledger_type='FIN';
|
||||
}
|
||||
/**
|
||||
* @brief display the accounting
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ class Acc_Ledger_History_Generic extends Acc_Ledger_History
|
|||
{
|
||||
parent::__construct($cn, $pa_ledger, $p_from, $p_to, $p_mode);
|
||||
$this->data=[];
|
||||
$this->ledger_type='ODS';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -39,7 +39,14 @@ class Acc_Ledger_History_Purchase extends Acc_Ledger_History
|
|||
$p_mode)
|
||||
{
|
||||
parent::__construct($cn, $pa_ledger, $p_from, $p_to, $p_mode);
|
||||
$this->filter_operation='all';
|
||||
$this->ledger_type='ACH';
|
||||
}
|
||||
public function get_filter_operation()
|
||||
{
|
||||
return $this->filter_operation;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief display the accounting
|
||||
|
|
@ -115,7 +122,7 @@ class Acc_Ledger_History_Purchase extends Acc_Ledger_History
|
|||
'jr_tech_per');
|
||||
|
||||
$cond_limite=($p_limit!=-1)?" limit ".$p_limit." offset ".$p_offset:"";
|
||||
|
||||
$sql_filter=$this->build_filter_operation();
|
||||
$ledger_list=join(",", $this->ma_ledger);
|
||||
$sql="
|
||||
with row_purchase as
|
||||
|
|
@ -142,6 +149,7 @@ class Acc_Ledger_History_Purchase extends Acc_Ledger_History
|
|||
jr_id,
|
||||
jr_pj_number,
|
||||
to_char(jr_date,'DD.MM.YYYY') as str_date,
|
||||
to_char(jr_date,'DDMMYY') as str_date_short,
|
||||
to_char(jr_date_paid,'DD.MM.YYYY') as str_date_paid,
|
||||
jr_internal,
|
||||
qp_supplier,
|
||||
|
|
@ -154,7 +162,8 @@ class Acc_Ledger_History_Purchase extends Acc_Ledger_History
|
|||
noded_vat,
|
||||
private_amount,
|
||||
novat+vat-tva_sided as tvac,
|
||||
n_text
|
||||
n_text,
|
||||
jr_grpt_id
|
||||
from
|
||||
jrn
|
||||
join row_purchase on (qp_internal=jr_internal)
|
||||
|
|
@ -162,6 +171,7 @@ class Acc_Ledger_History_Purchase extends Acc_Ledger_History
|
|||
left join jrn_note using (jr_id)
|
||||
where
|
||||
jr_def_id in ({$ledger_list})
|
||||
{$sql_filter}
|
||||
and {$periode}
|
||||
{$cond_limite}
|
||||
order by jrn.jr_date, substring(jr_pj_number,'[0-9]+$')::numeric ";
|
||||
|
|
@ -185,7 +195,7 @@ class Acc_Ledger_History_Purchase extends Acc_Ledger_History
|
|||
quant_purchase
|
||||
where
|
||||
qp_internal = $1
|
||||
group by qp_vat_code,qp_internal order by qp_vat_code");
|
||||
group by qp_vat_code order by qp_vat_code");
|
||||
}
|
||||
|
||||
$nb_row=count($this->data);
|
||||
|
|
|
|||
|
|
@ -34,10 +34,13 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
|
|||
|
||||
private $data; //!< Contains rows from SQL
|
||||
|
||||
|
||||
public function __construct(\Database $cn, $pa_ledger, $p_from, $p_to,
|
||||
$p_mode)
|
||||
{
|
||||
parent::__construct($cn, $pa_ledger, $p_from, $p_to, $p_mode);
|
||||
$this->filter_operation='all';
|
||||
$this->ledger_type='VEN';
|
||||
}
|
||||
/**
|
||||
* Display the operation of sales with detailled VAT
|
||||
|
|
@ -100,6 +103,7 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
|
|||
");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the rows from jrnx and quant* tables
|
||||
* @param int $p_limit max of rows to returns
|
||||
|
|
@ -112,6 +116,8 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
|
|||
|
||||
$cond_limite=($p_limit!=-1)?" limit ".$p_limit." offset ".$p_offset:"";
|
||||
|
||||
$sql_filter=$this->build_filter_operation();
|
||||
|
||||
$ledger_list=join(",", $this->ma_ledger);
|
||||
$sql="
|
||||
with row_sale as
|
||||
|
|
@ -143,13 +149,16 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
|
|||
vat,
|
||||
tva_sided,
|
||||
novat,
|
||||
novat+vat-tva_sided as tvac
|
||||
novat+vat-tva_sided as tvac,
|
||||
to_char(jr_date,'DDMMYY') as str_date_short,
|
||||
jr_grpt_id
|
||||
from
|
||||
jrn
|
||||
join row_sale on (qs_internal=jr_internal)
|
||||
join client_detail on (qs_client=f_id)
|
||||
where
|
||||
jr_def_id in ({$ledger_list})
|
||||
{$sql_filter}
|
||||
and {$periode}
|
||||
{$cond_limite}
|
||||
order by jr_date, substring(jr_pj_number,'[0-9]+$')::numeric ";
|
||||
|
|
@ -172,7 +181,7 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
|
|||
quant_sold
|
||||
where
|
||||
qs_internal = $1
|
||||
group by qs_vat_code,qs_internal order by qs_vat_code");
|
||||
group by qs_vat_code order by qs_vat_code");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1803,14 +1803,26 @@ EOF;
|
|||
* @param $p_end jrn.jr_tech_per to
|
||||
* @return handle to database result
|
||||
*/
|
||||
function get_detail_purchase($p_from,$p_end)
|
||||
function get_detail_purchase($p_from,$p_end,$p_filter_operation='all')
|
||||
{
|
||||
global $g_user;
|
||||
// Journal valide
|
||||
if ( $this->id == 0 ) die (__FILE__.":".__LINE__." Journal invalide");
|
||||
switch ( $p_filter_operation)
|
||||
{
|
||||
case 'all':
|
||||
$sql_filter="";
|
||||
break;
|
||||
case 'paid':
|
||||
$sql_filter=" and (jr_date_paid is not null or jr_rapt ='paid' ) ";
|
||||
break;
|
||||
case 'unpaid':
|
||||
$sql_filter=" and (jr_date_paid is null and coalesce(jr_rapt,'x') <> 'paid' ) ";
|
||||
break;
|
||||
default:
|
||||
throw new Exception(_("Filtre invalide",5));
|
||||
|
||||
// Securite
|
||||
if ( $g_user->get_ledger_access($this->id) == 'X' ) return null;
|
||||
}
|
||||
|
||||
// get the data from the view
|
||||
$sql = "select *
|
||||
|
|
@ -1818,6 +1830,7 @@ EOF;
|
|||
where
|
||||
jr_def_id = $1
|
||||
and jr_date >= (select p_start from parm_periode where p_id = $2)
|
||||
{$sql_filter}
|
||||
and jr_date <= (select p_end from parm_periode where p_id = $3) "
|
||||
.' order by jr_date,substring(jr_pj_number,\'[0-9]+$\')::numeric asc ';
|
||||
$ret = $this->db->exec_sql($sql, array($this->id,$p_from, $p_end));
|
||||
|
|
|
|||
|
|
@ -1333,13 +1333,15 @@ EOF;
|
|||
return $r;
|
||||
}
|
||||
/**
|
||||
* Retrieve data from the view v_detail_sale
|
||||
* Retrieve data from the view v_detail_sale , gives all the row of an operation
|
||||
*
|
||||
* @remark $g_user connected user
|
||||
* @param $p_from jrn.jr_tech_per from
|
||||
* @param type $p_end jrn.jr_tech_per to
|
||||
* @param $p_filter_operation valid option : all, paid, unpaid
|
||||
* @return type
|
||||
*/
|
||||
function get_detail_sale($p_from,$p_end)
|
||||
function get_detail_sale($p_from,$p_end,$p_filter_operation='all')
|
||||
{
|
||||
global $g_user;
|
||||
// Journal valide
|
||||
|
|
@ -1348,12 +1350,28 @@ EOF;
|
|||
// Securite
|
||||
if ( $g_user->get_ledger_access($this->id) == 'X' ) return null;
|
||||
|
||||
switch ( $p_filter_operation)
|
||||
{
|
||||
case 'all':
|
||||
$sql_filter="";
|
||||
break;
|
||||
case 'paid':
|
||||
$sql_filter=" and (jr_date_paid is not null or jr_rapt ='paid' ) ";
|
||||
break;
|
||||
case 'unpaid':
|
||||
$sql_filter=" and (jr_date_paid is null and coalesce(jr_rapt,'x') <> 'paid' ) ";
|
||||
break;
|
||||
default:
|
||||
throw new Exception(_("Filtre invalide",5));
|
||||
|
||||
}
|
||||
// get the data from the view
|
||||
$sql = "select *
|
||||
from v_detail_sale
|
||||
where
|
||||
jr_def_id = $1
|
||||
and jr_date >= (select p_start from parm_periode where p_id = $2)
|
||||
{$sql_filter}
|
||||
and jr_date <= (select p_end from parm_periode where p_id = $3) "
|
||||
.' order by jr_date,substring(jr_pj_number,\'[0-9]+$\')::numeric asc ';
|
||||
$ret = $this->db->exec_sql($sql, array($this->id,$p_from, $p_end));
|
||||
|
|
|
|||
|
|
@ -141,5 +141,35 @@ class PDF extends PDF_Core
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public function set_filter_operation($filter_operation)
|
||||
{
|
||||
if (in_array($filter_operation, ['all', 'paid', 'unpaid']))
|
||||
{
|
||||
$this->filter_operation=$filter_operation;
|
||||
return $this;
|
||||
}
|
||||
throw new Exception(_("Filter invalide ".$filter_operation), 5);
|
||||
}
|
||||
/**
|
||||
* Build a SQL clause to filter operation depending if they are paid, unpaid or no filter
|
||||
* @return string SQL Clause
|
||||
*/
|
||||
protected function build_filter_operation()
|
||||
{
|
||||
switch ($this->get_filter_operation())
|
||||
{
|
||||
case 'all':
|
||||
$sql_filter="";
|
||||
break;
|
||||
case 'paid':
|
||||
$sql_filter=" and (jr_date_paid is not null or jr_rapt ='paid' ) ";
|
||||
break;
|
||||
case 'unpaid':
|
||||
$sql_filter=" and (jr_date_paid is null and coalesce(jr_rapt,'x') <> 'paid' ) ";
|
||||
break;
|
||||
default:
|
||||
throw new Exception(_("Filtre invalide", 5));
|
||||
}
|
||||
return $sql_filter;
|
||||
}
|
||||
}
|
||||
|
|
@ -36,7 +36,17 @@ require_once NOALYSS_INCLUDE.'/class/print_ledger_detail_item.class.php';
|
|||
*
|
||||
*/
|
||||
class Print_Ledger {
|
||||
protected $filter_operation; // See Acc_Ledger_History::filter_operation
|
||||
|
||||
public function set_filter_operation($filter_operation)
|
||||
{
|
||||
if (in_array($filter_operation,['all','paid','unpaid']))
|
||||
{
|
||||
$this->filter_operation=$filter_operation;
|
||||
return $this;
|
||||
}
|
||||
throw new Exception(_("Filter invalide ".$filter_operation),5);
|
||||
}
|
||||
/**
|
||||
* Create an object Print_Ledger* depending on $p_type_export ( 0 => accounting
|
||||
* 1-> one row per operation 2-> detail of item)
|
||||
|
|
@ -45,7 +55,8 @@ class Print_Ledger {
|
|||
* @param type $p_format_output CSV or PDF
|
||||
* @param Acc_Ledger $ledger
|
||||
*/
|
||||
static function factory(Database $cn, $p_type_export, $p_format_output, Acc_Ledger $p_ledger) {
|
||||
static function factory(Database $cn, $p_type_export, $p_format_output, Acc_Ledger $p_ledger,$p_filter_operation)
|
||||
{
|
||||
/**
|
||||
* For PDF output
|
||||
*/
|
||||
|
|
@ -67,19 +78,19 @@ class Print_Ledger {
|
|||
)
|
||||
{
|
||||
$pdf=new Print_Ledger_Simple_without_vat($cn,
|
||||
$p_ledger);
|
||||
$p_ledger,$p_filter_operation);
|
||||
$pdf->set_error(_('Ce journal ne peut être imprimé en mode simple'));
|
||||
return $pdf;
|
||||
}
|
||||
if ($own->MY_TVA_USE=='Y')
|
||||
{
|
||||
$pdf=new Print_Ledger_Simple($cn, $p_ledger);
|
||||
$pdf=new Print_Ledger_Simple($cn, $p_ledger,$p_filter_operation);
|
||||
return $pdf;
|
||||
}
|
||||
if ($own->MY_TVA_USE=='N')
|
||||
{
|
||||
$pdf=new Print_Ledger_Simple_without_vat($cn,
|
||||
$p_ledger);
|
||||
$p_ledger,$p_filter_operation);
|
||||
return $pdf;
|
||||
}
|
||||
}
|
||||
|
|
@ -111,19 +122,19 @@ class Print_Ledger {
|
|||
)
|
||||
{
|
||||
$pdf=new Print_Ledger_Simple_without_vat($cn,
|
||||
$p_ledger);
|
||||
$p_ledger,$p_filter_operation);
|
||||
$pdf->set_error(_('Ce journal ne peut être imprimé en mode simple'));
|
||||
return $pdf;
|
||||
}
|
||||
if ($own->MY_TVA_USE=='Y')
|
||||
{
|
||||
$pdf=new Print_Ledger_Simple($cn, $p_ledger);
|
||||
$pdf=new Print_Ledger_Simple($cn, $p_ledger,$p_filter_operation);
|
||||
return $pdf;
|
||||
}
|
||||
if ($own->MY_TVA_USE=='N')
|
||||
{
|
||||
$pdf=new Print_Ledger_Simple_without_vat($cn,
|
||||
$p_ledger);
|
||||
$p_ledger,$p_filter_operation);
|
||||
return $pdf;
|
||||
}
|
||||
}
|
||||
|
|
@ -162,11 +173,11 @@ class Print_Ledger {
|
|||
==0)
|
||||
)
|
||||
{
|
||||
$pdf=new Print_Ledger_Simple_without_vat($cn, $p_ledger);
|
||||
$pdf=new Print_Ledger_Simple_without_vat($cn, $p_ledger,$p_filter_operation);
|
||||
$pdf->set_error('Ce journal ne peut être imprimé en mode simple');
|
||||
return $pdf;
|
||||
}
|
||||
$pdf=new Print_Ledger_Detail_Item($cn, $p_ledger);
|
||||
$pdf=new Print_Ledger_Detail_Item($cn, $p_ledger,$p_filter_operation);
|
||||
return $pdf;
|
||||
case 'A':
|
||||
/***********************************************************
|
||||
|
|
@ -206,7 +217,10 @@ class Print_Ledger {
|
|||
and uj_priv in ('R','W')
|
||||
and ( jrn_enable=1
|
||||
or
|
||||
exists (select 1 from jrn where jr_def_id=jrn_def_id and jr_tech_per in (select p_id from parm_periode where p_exercice=$2)))
|
||||
exists (select 1 from jrn
|
||||
where
|
||||
jr_def_id=jrn_def_id
|
||||
and jr_tech_per in (select p_id from parm_periode where p_exercice=$2)))
|
||||
order by jrn_def_name
|
||||
";
|
||||
$a_jrn=$cn->get_array($sql, array($g_user->login, $exercice));
|
||||
|
|
@ -216,7 +230,11 @@ class Print_Ledger {
|
|||
$a_jrn=$cn->get_array("select jrn_def_id
|
||||
from jrn_def join jrn_type on jrn_def_type=jrn_type_id
|
||||
where
|
||||
jrn_enable=1 or exists(select 1 from jrn where jr_def_id=jrn_def_id and jr_tech_per in (select p_id from parm_periode where p_exercice=$1))
|
||||
jrn_enable=1
|
||||
or exists(select 1 from jrn
|
||||
where
|
||||
jr_def_id=jrn_def_id
|
||||
and jr_tech_per in (select p_id from parm_periode where p_exercice=$1))
|
||||
order by jrn_def_name
|
||||
", [$exercice]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ require_once NOALYSS_INCLUDE.'/class/pdf_land.class.php';
|
|||
|
||||
class Print_Ledger_Detail_Item extends PDFLand
|
||||
{
|
||||
public function __construct (Database $p_cn,Acc_Ledger $p_jrn)
|
||||
public function __construct (Database $p_cn,Acc_Ledger $p_jrn,$p_filter_operation)
|
||||
{
|
||||
|
||||
if($p_cn == null) die("No database connection. Abort.");
|
||||
|
|
@ -37,6 +37,7 @@ class Print_Ledger_Detail_Item extends PDFLand
|
|||
parent::__construct($p_cn,'L', 'mm', 'A4');
|
||||
$this->ledger=$p_jrn;
|
||||
$this->show_col=true;
|
||||
$this->filter_operation=$p_filter_operation;
|
||||
}
|
||||
|
||||
function setDossierInfo($dossier = "n/a")
|
||||
|
|
@ -93,21 +94,23 @@ class Print_Ledger_Detail_Item extends PDFLand
|
|||
bcscale(2);
|
||||
$jrn_type=$this->ledger->get_type();
|
||||
$http=new HttpInput();
|
||||
|
||||
switch ($jrn_type)
|
||||
{
|
||||
case 'VEN':
|
||||
$ledger=new Acc_Ledger_Sold($this->cn, $this->ledger->jrn_def_id);
|
||||
$ret_detail=$ledger->get_detail_sale($http->get('from_periode','number'),$http->get('to_periode','number'));
|
||||
$ret_detail=$ledger->get_detail_sale($http->get('from_periode','number'),$http->get('to_periode','number'), $this->filter_operation);
|
||||
break;
|
||||
case 'ACH':
|
||||
$ledger=new Acc_Ledger_Purchase($this->cn, $this->ledger->jrn_def_id);
|
||||
$ret_detail=$ledger->get_detail_purchase($http->get('from_periode','number'),$http->get('to_periode','number'));
|
||||
$ret_detail=$ledger->get_detail_purchase($http->get('from_periode','number'),$http->get('to_periode','number'),$this->filter_operation);
|
||||
break;
|
||||
default:
|
||||
die (__FILE__.":".__LINE__.'Journal invalide');
|
||||
break;
|
||||
}
|
||||
if ( $ret_detail == null ) return;
|
||||
|
||||
$prepared_query=new Prepared_Query($this->ledger->db);
|
||||
$prepared_query->prepare_reconcile_date();
|
||||
|
||||
|
|
|
|||
|
|
@ -28,10 +28,11 @@ require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
|
|||
|
||||
class Print_Ledger_Simple extends PDF
|
||||
{
|
||||
public function __construct ($p_cn, Acc_Ledger $p_jrn)
|
||||
public function __construct ($p_cn, Acc_Ledger $p_jrn,$p_filter_operation)
|
||||
{
|
||||
|
||||
$http=new HttpInput();
|
||||
$this->filter_operation=$p_filter_operation;
|
||||
if($p_cn == null) die("No database connection. Abort.");
|
||||
|
||||
parent::__construct($p_cn,'L', 'mm', 'A4');
|
||||
|
|
@ -123,7 +124,10 @@ class Print_Ledger_Simple extends PDF
|
|||
|
||||
$this->SetFont('DejaVu','',6);
|
||||
// page Header
|
||||
if ( ! $flag_tva)
|
||||
$this->Cell(143,6,'report',0,0,'R');
|
||||
else
|
||||
$this->Cell(78,6,'report',0,0,'R');
|
||||
$this->Cell(15,6,nbm($this->rap_htva),0,0,'R'); /* HTVA */
|
||||
if ( $this->jrn_type != 'VEN')
|
||||
{
|
||||
|
|
@ -157,7 +161,12 @@ class Print_Ledger_Simple extends PDF
|
|||
//Position at 3 cm from bottom
|
||||
$this->SetY(-20);
|
||||
/* write reporting */
|
||||
$flag_tva=(count($this->a_Tva) > 4)?true:false;
|
||||
if ( ! $flag_tva)
|
||||
$this->Cell(143,6,'Total page ','T',0,'R'); /* HTVA */
|
||||
else
|
||||
$this->Cell(78,6,'Total page ','T',0,'R'); /* HTVA */
|
||||
|
||||
$this->Cell(15,6,nbm($this->tp_htva),'T',0,'R'); /* HTVA */
|
||||
if ( $this->jrn_type !='VEN')
|
||||
{
|
||||
|
|
@ -173,8 +182,13 @@ class Print_Ledger_Simple extends PDF
|
|||
|
||||
$this->Cell(15,6,nbm($this->tp_tvac),'T',0,'R'); /* Tvac */
|
||||
$this->Ln(2);
|
||||
$flag_tva=(count($this->a_Tva) > 4)?true:false;
|
||||
|
||||
if ( ! $flag_tva)
|
||||
$this->Cell(143,6,'report',0,0,'R');
|
||||
else
|
||||
$this->Cell(78,6,'report',0,0,'R');
|
||||
|
||||
$this->Cell(143,6,'report',0,0,'R'); /* HTVA */
|
||||
$this->Cell(15,6,nbm($this->rap_htva),0,0,'R'); /* HTVA */
|
||||
if ( $this->jrn_type !='VEN')
|
||||
{
|
||||
|
|
@ -208,11 +222,20 @@ class Print_Ledger_Simple extends PDF
|
|||
bcscale(2);
|
||||
$http=new HttpInput();
|
||||
|
||||
$a_jrn=$this->ledger->get_operation($http->get('from_periode',"number"),
|
||||
$http->get('to_periode',"number"));
|
||||
$ledger_history=Acc_Ledger_History::factory($this->cn,
|
||||
array($this->ledger->id),
|
||||
$http->get('from_periode','number'),
|
||||
$http->get('to_periode','number'),
|
||||
'D',
|
||||
$this->filter_operation);
|
||||
$ledger_history->get_row();
|
||||
$a_jrn=$ledger_history->get_data();
|
||||
|
||||
if ( $a_jrn == null ) return;
|
||||
|
||||
// Count the number of VAT cols
|
||||
$flag_tva=(count($this->a_Tva) > 4)?true:false;
|
||||
|
||||
// Prepare the query for reconcile date
|
||||
$prepared_query=new Prepared_Query($this->ledger->db);
|
||||
$prepared_query->prepare_reconcile_date();
|
||||
|
|
@ -239,22 +262,23 @@ class Print_Ledger_Simple extends PDF
|
|||
|
||||
}
|
||||
$row=$a_jrn[$i];
|
||||
$ret_reconcile=$this->ledger->db->execute('reconcile_date',array($row['id']));
|
||||
$this->LongLine(15,5,($row['pj']),0);
|
||||
$this->write_cell(10,5,$row['date_fmt'],0,0);
|
||||
$this->write_cell(13,5,$row['internal'],0,0);
|
||||
list($qc,$name)=$this->get_tiers($row['id'],$this->jrn_type);
|
||||
$ret_reconcile=$this->ledger->db->execute('reconcile_date',array($row['jr_id']));
|
||||
$this->LongLine(15,5,($row['jr_pj_number']),0);
|
||||
$this->write_cell(10,5,$row['str_date_short'],0,0);
|
||||
$this->write_cell(13,5,$row['jr_internal'],0,0);
|
||||
list($qc,$name)=$this->get_tiers($row['jr_id'],$this->jrn_type);
|
||||
$this->LongLine(40,5,"[".$qc."]".$name,0,'L');
|
||||
|
||||
$this->LongLine(65,5,mb_substr($row['comment'],0,150),0,'L');
|
||||
if ( !$flag_tva ) {
|
||||
$this->LongLine(65,5,mb_substr($row['jr_comment'],0,150),0,'L');
|
||||
}
|
||||
|
||||
/* get other amount (without vat, total vat included, private, ND */
|
||||
$other=$this->ledger->get_other_amount($a_jrn[$i]['jr_grpt_id']);
|
||||
|
||||
|
||||
|
||||
$this->write_cell(15,5,nbm($other['price']),0,0,'R');
|
||||
if ( $this->jrn_type !='VEN')
|
||||
|
||||
if ( $ledger_history->get_ledger_type() !='VEN')
|
||||
{
|
||||
$this->write_cell(15,5,nbm($other['priv']),0,0,'R');
|
||||
$this->write_cell(15,5,nbm($other['tva_nd']),0,0,'R');
|
||||
|
|
@ -271,11 +295,11 @@ class Print_Ledger_Simple extends PDF
|
|||
$l_tvac=bcadd($l_tvac,$other['tva_nd']);
|
||||
$this->write_cell(15,5,nbm($l_tvac),0,0,'R');
|
||||
$this->line_new(2);
|
||||
$this->write_cell(15,5, _("Payé par"));
|
||||
// Add the payment information on another row
|
||||
$max=Database::num_row($ret_reconcile);
|
||||
$str_payment="";
|
||||
if ($max > 0) {
|
||||
$this->write_cell(15,5, _("Payé par"));
|
||||
$sep="";
|
||||
for ($e=0;$e<$max;$e++) {
|
||||
$row=Database::fetch_array($ret_reconcile, $e);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
|
|||
|
||||
class Print_Ledger_Simple_Without_Vat extends PDF
|
||||
{
|
||||
public function __construct ($p_cn,$p_jrn)
|
||||
private $filter_operation;
|
||||
public function __construct ($p_cn,$p_jrn,$p_filter_operation)
|
||||
{
|
||||
|
||||
if($p_cn == null) die("No database connection. Abort.");
|
||||
|
|
@ -47,7 +48,7 @@ class Print_Ledger_Simple_Without_Vat extends PDF
|
|||
$this->rap_htva=$this->previous['price'];
|
||||
$this->rap_tvac=$this->previous['price'];
|
||||
$this->rap_priv=$this->previous['priv'];
|
||||
|
||||
$this->filter_operation=$p_filter_operation;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -142,7 +143,13 @@ class Print_Ledger_Simple_Without_Vat extends PDF
|
|||
function export()
|
||||
{
|
||||
$http=new HttpInput;
|
||||
$a_jrn=$this->ledger->get_operation($http->get('from_periode','number'),$http->get('to_periode','number'));
|
||||
$ledger_history=Acc_Ledger_History::factory($this->cn,
|
||||
array($this->ledger->id),
|
||||
$http->get('from_periode','number'),
|
||||
$http->get('to_periode','number'),
|
||||
'D',
|
||||
$this->filter_operation);
|
||||
$a_jrn=$ledger_history->get_row();
|
||||
|
||||
if ( $a_jrn == null ) return;
|
||||
|
||||
|
|
@ -154,14 +161,14 @@ class Print_Ledger_Simple_Without_Vat extends PDF
|
|||
{
|
||||
|
||||
$row=$a_jrn[$i];
|
||||
$this->LongLine(15,5,($row['pj']),0);
|
||||
$this->write_cell(15,5,$row['date_fmt'],0,0);
|
||||
$this->write_cell(20,5,$row['internal'],0,0);
|
||||
list($qc,$name)=$this->get_tiers($row['id'],$this->jrn_type);
|
||||
$this->LongLine(15,5,($row['jr_pj_number']),0);
|
||||
$this->write_cell(15,5,$row['str_date_short'],0,0);
|
||||
$this->write_cell(20,5,$row['jr_internal'],0,0);
|
||||
list($qc,$name)=$this->get_tiers($row['jr_id'],$this->jrn_type);
|
||||
$this->write_cell(20,5,$qc,0,0);
|
||||
$this->LongLine(40,5,$name,0,'L');
|
||||
|
||||
$this->LongLine(105,5,$row['comment'],0,'L');
|
||||
$this->LongLine(105,5,$row['jr_comment'],0,'L');
|
||||
|
||||
/* get other amount (without vat, total vat included, private, ND */
|
||||
$other=$this->ledger->get_other_amount($a_jrn[$i]['jr_grpt_id']);
|
||||
|
|
@ -171,7 +178,7 @@ class Print_Ledger_Simple_Without_Vat extends PDF
|
|||
$this->rap_priv+=$other['priv'];
|
||||
|
||||
|
||||
if ( $this->jrn_type !='VEN')
|
||||
if ( $ledger_history->get_ledger_type() !='VEN')
|
||||
{
|
||||
$this->write_cell(15,5,sprintf("%.2f",$other['priv']),0,0,'R');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) {
|
|||
if ( ! defined ("SYSINFO_DISPLAY")) {
|
||||
define ("SYSINFO_DISPLAY",TRUE);
|
||||
}
|
||||
define ("DBVERSION",139);
|
||||
define ("DBVERSION",140);
|
||||
define ("MONO_DATABASE",25);
|
||||
define ("DBVERSIONREPO",18);
|
||||
define ('NOTFOUND','--not found--');
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ try
|
|||
$get_option=$http->get('p_simple', "string");
|
||||
$get_from_periode=$http->get('from_periode', 'number');
|
||||
$get_to_periode=$http->get('to_periode', 'number');
|
||||
$filter_operation=$http->get("operation_type");
|
||||
}
|
||||
catch (Exception $exc)
|
||||
{
|
||||
|
|
@ -119,14 +120,14 @@ if ( $get_option=="E")
|
|||
case 'VEN':
|
||||
$ledger=new Acc_Ledger_Sold($cn, $get_jrn);
|
||||
$ret_detail=$ledger->get_detail_sale($get_from_periode,
|
||||
$get_to_periode);
|
||||
$get_to_periode,$filter_operation);
|
||||
$a_heading=Acc_Ledger_Sold::heading_detail_sale();
|
||||
|
||||
break;
|
||||
case 'ACH':
|
||||
$ledger=new Acc_Ledger_Purchase($cn, $get_jrn);
|
||||
$ret_detail=$ledger->get_detail_purchase($get_from_periode,
|
||||
$get_to_periode);
|
||||
$get_to_periode,$filter_operation);
|
||||
$a_heading=Acc_Ledger_Purchase::heading_detail_purchase();
|
||||
break;
|
||||
default:
|
||||
|
|
@ -199,6 +200,7 @@ if ($get_option=='A')
|
|||
$get_from_periode, $get_to_periode, 'A');
|
||||
|
||||
}
|
||||
$acc_ledger_history->set_filter_operation($filter_operation);
|
||||
$acc_ledger_history->export_csv();
|
||||
exit;
|
||||
}
|
||||
|
|
@ -298,6 +300,7 @@ if ($get_option=="L" || $get_option == 'D')
|
|||
$get_from_periode, $get_to_periode, 'D');
|
||||
|
||||
}
|
||||
$acc_ledger_history->set_filter_operation($filter_operation);
|
||||
$acc_ledger_history->export_csv();
|
||||
return;
|
||||
}
|
||||
|
|
@ -309,12 +312,14 @@ if ($get_option=="L" || $get_option == 'D')
|
|||
{
|
||||
$acc_ledger_history=new Acc_Ledger_History_Purchase($cn, [$Jrn->id],
|
||||
$get_from_periode, $get_to_periode, 'D');
|
||||
$acc_ledger_history->set_filter_operation($filter_operation);
|
||||
$acc_ledger_history->export_csv();
|
||||
}
|
||||
if ($jrn_type=="VEN")
|
||||
{
|
||||
$acc_ledger_history=new Acc_Ledger_History_Sale($cn, [$Jrn->id],
|
||||
$get_from_periode, $get_to_periode, 'D');
|
||||
$acc_ledger_history->set_filter_operation($filter_operation);
|
||||
$acc_ledger_history->export_csv();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ try
|
|||
{
|
||||
$jrn_id=$http->get('jrn_id',"number");
|
||||
$p_simple=$http->get('p_simple',"string");
|
||||
|
||||
$filter_operation=$http->get("operation_type");
|
||||
|
||||
}
|
||||
catch (Exception $exc)
|
||||
|
|
@ -74,8 +74,8 @@ $ret = "";
|
|||
|
||||
$jrn_type = $Jrn->get_type();
|
||||
|
||||
$pdf = Print_Ledger::factory($cn, $p_simple, "PDF", $Jrn);
|
||||
|
||||
$pdf = Print_Ledger::factory($cn, $p_simple, "PDF", $Jrn,$filter_operation);
|
||||
$pdf->set_filter_operation($filter_operation);
|
||||
$pdf->setDossierInfo($Jrn->jrn_def_name);
|
||||
$pdf->AliasNbPages();
|
||||
$pdf->AddPage();
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ for ($i = 0; $i < $nb_sale; $i++) {
|
|||
}
|
||||
$pdf->line_new();
|
||||
|
||||
$nb_array = count($array);
|
||||
$nb_array = count($a_sum);
|
||||
// initialize totals
|
||||
for ($e=2;$e<$nb_col;$e++){
|
||||
$a_tot[$a_col[$e]]=0;
|
||||
|
|
@ -187,14 +187,14 @@ for ($i = 0; $i < $nb_array; $i++) {
|
|||
$colname=$a_col[$e];
|
||||
if ( $e ==0 ) {
|
||||
// first column TVA_LABEL
|
||||
$pdf->write_cell(40, 5, $array[$i][$colname], 1, 0, 'L');
|
||||
$pdf->write_cell(40, 5, $a_sum[$i][$colname], 1, 0, 'L');
|
||||
} elseif ($e == 1 ){
|
||||
// Secund col. tva rate
|
||||
$pdf->write_cell(40, 5, nbm($array[$i][$colname]*100), 1, 0, 'R');
|
||||
$pdf->write_cell(40, 5, nbm($a_sum[$i][$colname]*100), 1, 0, 'R');
|
||||
}else {
|
||||
// Other cols,display amount and compute total
|
||||
$a_tot[$colname] = bcadd($a_tot[$colname], $array[$i][$colname]);
|
||||
$pdf->write_cell(40, 5, nbm($array[$i][$colname]), 1, 0, 'R');
|
||||
$a_tot[$colname] = bcadd($a_tot[$colname], $a_sum[$i][$colname]);
|
||||
$pdf->write_cell(40, 5, nbm($a_sum[$i][$colname]), 1, 0, 'R');
|
||||
}
|
||||
}
|
||||
$pdf->line_new();
|
||||
|
|
@ -328,6 +328,7 @@ for ($e=0;$e<$nb_col;$e++){
|
|||
}
|
||||
$pdf->line_new();
|
||||
|
||||
$array=$tax_summary->get_summary_purchase();
|
||||
$nb_array = count($array);
|
||||
// initialize totals
|
||||
for ($e=2;$e<$nb_col;$e++){
|
||||
|
|
|
|||
|
|
@ -150,6 +150,20 @@ $a = array(
|
|||
);
|
||||
$w->selected = 1;
|
||||
print '</TR>';
|
||||
/// All operation
|
||||
$s_operation = new ISelect("operation_type");
|
||||
$s_operation->value=array(
|
||||
array("label"=>_("Toutes les opérations"),"value"=>"all"),
|
||||
array("label"=>_("Uniquement payées"),"value"=>"paid"),
|
||||
array("label"=>_("Uniquement non payées"),"value"=>"unpaid")
|
||||
);
|
||||
$s_operation->selected=$http->get("operation_type","string","all");
|
||||
echo "<tr>";
|
||||
echo td(_("Uniquement pour journaux vente et achat").Icon_Action::infobulle(75));
|
||||
echo td($s_operation->input());
|
||||
echo '</tr>';
|
||||
|
||||
/// Type of printing
|
||||
print '<TR>';
|
||||
$simple=$http->get("p_simple","string","L");
|
||||
$w->selected = $simple;
|
||||
|
|
@ -182,6 +196,7 @@ if (isset($_REQUEST['bt_html']))
|
|||
$hid->input("jrn_id", $jrn_id) .
|
||||
$hid->input("from_periode", $from_periode) .
|
||||
$hid->input("to_periode", $to_periode);
|
||||
echo $hid->input("operation_type", $s_operation->selected);
|
||||
echo $hid->input("p_simple", $simple);
|
||||
echo HtmlInput::get_to_hidden(array('ac', 'type'));
|
||||
echo "</form>";
|
||||
|
|
@ -195,6 +210,7 @@ if (isset($_REQUEST['bt_html']))
|
|||
$hid->input("from_periode", $from_periode) .
|
||||
$hid->input("to_periode", $to_periode);
|
||||
echo $hid->input("p_simple", $simple);
|
||||
echo $hid->input("operation_type", $s_operation->selected);
|
||||
echo HtmlInput::get_to_hidden(array('ac', 'type'));
|
||||
echo "</form></TD>";
|
||||
|
||||
|
|
@ -220,7 +236,7 @@ if (isset($_REQUEST['bt_html']))
|
|||
$a_ledger=[$jrn_id];
|
||||
}
|
||||
|
||||
$ledger_history=Acc_Ledger_History::factory($cn,$a_ledger,$from_periode,$to_periode,$simple);
|
||||
$ledger_history=Acc_Ledger_History::factory($cn,$a_ledger,$from_periode,$to_periode,$simple,$s_operation->selected);
|
||||
|
||||
$ledger_history->export_html();
|
||||
|
||||
|
|
|
|||
|
|
@ -105,4 +105,5 @@ content[71]="<?php echo _('Limite le type de fiche si vous choisissez la fiche
|
|||
content[72]="<?php echo _("Pour les journaux FIN, ce sera la fiche du journal");?>";
|
||||
content[73]="<?php echo _("Mettre à oui pour un journal dédié uniquement aux notes de crédit ou de débit, il affichera un avertissement si le montant n'est pas en négatif");?>";
|
||||
content[74]="<?php echo _('TVA due ou récupérable quand l\'opération est payée ou exécutée')?>";
|
||||
content[75]="<?php echo _('Journaux Achat ou vente en mode simple, TVA ou détaillé')?>";
|
||||
</script>
|
||||
119
include/sql/patch/upgrade139.sql
Normal file
119
include/sql/patch/upgrade139.sql
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
begin;
|
||||
DROP VIEW public.v_detail_sale;
|
||||
DROP VIEW public.v_detail_purchase;
|
||||
|
||||
CREATE OR REPLACE VIEW public.v_detail_sale
|
||||
AS WITH m AS (
|
||||
SELECT sum(quant_sold_1.qs_price) AS htva,
|
||||
sum(quant_sold_1.qs_vat) AS tot_vat,
|
||||
sum(quant_sold_1.qs_vat_sided) AS tot_tva_np,
|
||||
jrn_1.jr_id
|
||||
FROM quant_sold quant_sold_1
|
||||
JOIN jrnx jrnx_1 USING (j_id)
|
||||
JOIN jrn jrn_1 ON jrnx_1.j_grpt = jrn_1.jr_grpt_id
|
||||
GROUP BY jrn_1.jr_id
|
||||
)
|
||||
SELECT jrn.jr_id,
|
||||
jrn.jr_date,
|
||||
jrn.jr_date_paid,
|
||||
jrn.jr_ech,
|
||||
jrn.jr_tech_per,
|
||||
jrn.jr_comment,
|
||||
jrn.jr_pj_number,
|
||||
jrn.jr_internal,
|
||||
jrn.jr_def_id,
|
||||
jrnx.j_poste,
|
||||
jrnx.j_text,
|
||||
jrnx.j_qcode,
|
||||
jrn.jr_rapt,
|
||||
quant_sold.qs_fiche AS item_card,
|
||||
a.name AS item_name,
|
||||
quant_sold.qs_client,
|
||||
b.vw_name AS tiers_name,
|
||||
b.quick_code,
|
||||
tva_rate.tva_label,
|
||||
tva_rate.tva_comment,
|
||||
tva_rate.tva_both_side,
|
||||
quant_sold.qs_vat_sided AS vat_sided,
|
||||
quant_sold.qs_vat_code AS vat_code,
|
||||
quant_sold.qs_vat AS vat,
|
||||
quant_sold.qs_price AS price,
|
||||
quant_sold.qs_quantite AS quantity,
|
||||
quant_sold.qs_price / quant_sold.qs_quantite AS price_per_unit,
|
||||
m.htva,
|
||||
m.tot_vat,
|
||||
m.tot_tva_np,
|
||||
oc.oc_amount,
|
||||
oc.oc_vat_amount,
|
||||
( SELECT currency.cr_code_iso
|
||||
FROM currency
|
||||
WHERE jrn.currency_id = currency.id) AS cr_code_iso
|
||||
FROM jrn
|
||||
JOIN jrnx ON jrn.jr_grpt_id = jrnx.j_grpt
|
||||
JOIN quant_sold USING (j_id)
|
||||
JOIN vw_fiche_name a ON quant_sold.qs_fiche = a.f_id
|
||||
JOIN vw_fiche_attr b ON quant_sold.qs_client = b.f_id
|
||||
JOIN tva_rate ON quant_sold.qs_vat_code = tva_rate.tva_id
|
||||
JOIN m ON m.jr_id = jrn.jr_id
|
||||
LEFT JOIN operation_currency oc ON oc.j_id = jrnx.j_id;
|
||||
|
||||
|
||||
CREATE OR REPLACE VIEW public.v_detail_purchase
|
||||
AS WITH m AS (
|
||||
SELECT sum(quant_purchase_1.qp_price) AS htva,
|
||||
sum(quant_purchase_1.qp_vat) AS tot_vat,
|
||||
sum(quant_purchase_1.qp_vat_sided) AS tot_tva_np,
|
||||
jrn_1.jr_id
|
||||
FROM quant_purchase quant_purchase_1
|
||||
JOIN jrnx jrnx_1 USING (j_id)
|
||||
JOIN jrn jrn_1 ON jrnx_1.j_grpt = jrn_1.jr_grpt_id
|
||||
GROUP BY jrn_1.jr_id
|
||||
)
|
||||
SELECT jrn.jr_id,
|
||||
jrn.jr_date,
|
||||
jrn.jr_date_paid,
|
||||
jrn.jr_ech,
|
||||
jrn.jr_tech_per,
|
||||
jrn.jr_comment,
|
||||
jrn.jr_pj_number,
|
||||
jrn.jr_internal,
|
||||
jrn.jr_def_id,
|
||||
jrnx.j_poste,
|
||||
jrnx.j_text,
|
||||
jrnx.j_qcode,
|
||||
jrn.jr_rapt,
|
||||
quant_purchase.qp_fiche AS item_card,
|
||||
a.name AS item_name,
|
||||
quant_purchase.qp_supplier,
|
||||
b.vw_name AS tiers_name,
|
||||
b.quick_code,
|
||||
tva_rate.tva_label,
|
||||
tva_rate.tva_comment,
|
||||
tva_rate.tva_both_side,
|
||||
quant_purchase.qp_vat_sided AS vat_sided,
|
||||
quant_purchase.qp_vat_code AS vat_code,
|
||||
quant_purchase.qp_vat AS vat,
|
||||
quant_purchase.qp_price AS price,
|
||||
quant_purchase.qp_quantite AS quantity,
|
||||
quant_purchase.qp_price / quant_purchase.qp_quantite AS price_per_unit,
|
||||
quant_purchase.qp_nd_amount AS non_ded_amount,
|
||||
quant_purchase.qp_nd_tva AS non_ded_tva,
|
||||
quant_purchase.qp_nd_tva_recup AS non_ded_tva_recup,
|
||||
m.htva,
|
||||
m.tot_vat,
|
||||
m.tot_tva_np,
|
||||
oc.oc_amount,
|
||||
oc.oc_vat_amount,
|
||||
( SELECT currency.cr_code_iso
|
||||
FROM currency
|
||||
WHERE jrn.currency_id = currency.id) AS cr_code_iso
|
||||
FROM jrn
|
||||
JOIN jrnx ON jrn.jr_grpt_id = jrnx.j_grpt
|
||||
JOIN quant_purchase USING (j_id)
|
||||
JOIN vw_fiche_name a ON quant_purchase.qp_fiche = a.f_id
|
||||
JOIN vw_fiche_attr b ON quant_purchase.qp_supplier = b.f_id
|
||||
JOIN tva_rate ON quant_purchase.qp_vat_code = tva_rate.tva_id
|
||||
JOIN m ON m.jr_id = jrn.jr_id
|
||||
LEFT JOIN operation_currency oc ON oc.j_id = jrnx.j_id;
|
||||
insert into version (val,v_description) values (140,'Filter operation PRINTJRN');
|
||||
commit ;
|
||||
|
|
@ -3,5 +3,5 @@
|
|||
DOSSIER_TEST=rel70dossier25
|
||||
|
||||
createdb $DOSSIER_TEST
|
||||
pg_restore -Fc --no-owner --no-privilege --verbose -d $DOSSIER_TEST db/dossiertest191101-2109.bin
|
||||
pg_restore -Fc --no-owner --no-privilege --verbose -d $DOSSIER_TEST db/dossiertest191112-1806.bin
|
||||
|
||||
|
|
|
|||
|
|
@ -201,10 +201,10 @@ class Acc_Account_LedgerTest extends TestCase
|
|||
function DataBelong_ledger()
|
||||
{
|
||||
return array(
|
||||
array(0, -1),
|
||||
array(-1, 0),
|
||||
array(1, -1),
|
||||
array(3, -1),
|
||||
array(2, 0),
|
||||
array(3, 0),
|
||||
array(2, -1),
|
||||
array(4, 0)
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class Acc_BalanceTest extends TestCase
|
|||
$min=$g_connection->get_value("select min(p_id) from parm_periode");
|
||||
$this->object->jrn=NULL;
|
||||
$array=$this->object->get_row($min,$max);
|
||||
$this->assertEquals(29,count($array));
|
||||
$this->assertEquals(31,count($array));
|
||||
$this->object->jrn=[2,4];
|
||||
$array=$this->object->get_row($min,$max);
|
||||
$this->assertEquals(10,count($array));
|
||||
|
|
@ -64,9 +64,9 @@ class Acc_BalanceTest extends TestCase
|
|||
$this->object->filter_cat(array());
|
||||
$this->assertEquals($this->object->jrn,null);
|
||||
$this->object->filter_cat(array('2'=>'FIN'));
|
||||
$this->assertEquals($this->object->jrn,[1]);
|
||||
$this->assertEquals([1,83],$this->object->jrn);
|
||||
$this->object->filter_cat(array('1'=>'ACH','2'=>'FIN'));
|
||||
$this->assertEquals($this->object->jrn,[3,35,1]);
|
||||
$this->assertEquals($this->object->jrn,[3,35,1,83]);
|
||||
}
|
||||
/**
|
||||
*@covers Acc_Balance::summary_add
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ class Acc_BilanTest extends TestCase
|
|||
|
||||
$this->assertTrue(isset($this->object->C70));
|
||||
$this->assertTrue(isset($this->object->C60));
|
||||
$this->assertEquals($this->object->C70,445.6);
|
||||
$this->assertEquals($this->object->C70,456.8);
|
||||
$this->assertEquals($this->object->C60,0);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2014-11-09 at 12:39:58.
|
||||
* @coversDefaultClass Acc_Ledger
|
||||
*/
|
||||
class Acc_LedgerTest extends TestCase
|
||||
{
|
||||
|
|
@ -61,23 +61,44 @@ class Acc_LedgerTest extends TestCase
|
|||
{
|
||||
|
||||
}
|
||||
/**
|
||||
* covers ::existing_vat
|
||||
* covers ::get_type
|
||||
*/
|
||||
public function testExisting_vat()
|
||||
{
|
||||
$this->object->set_ledger_id(2);
|
||||
$this->assertEquals($this->object->get_type(),'VEN',"Sales ledger");
|
||||
$a_vat=$this->object->existing_vat();
|
||||
$this->assertEquals(2,count($a_vat));
|
||||
|
||||
$this->object->set_ledger_id(3);
|
||||
$this->assertEquals($this->object->get_type(),'ACH',"Purchases ledger");
|
||||
$a_vat=$this->object->existing_vat();
|
||||
$this->assertEquals(5,count($a_vat));
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Ledger::get_last_pj
|
||||
* @todo Implement testGet_last_pj().
|
||||
*/
|
||||
public function testGet_last_pj()
|
||||
{
|
||||
|
||||
$this->object->id=2;
|
||||
$sPj=$this->object->get_last_pj(2);
|
||||
$this->assertEquals(9,$sPj);
|
||||
$this->assertEquals(40,$sPj);
|
||||
$this->object->id=0;
|
||||
|
||||
try {
|
||||
$this->object->get_last_pj();
|
||||
$this->assertTrue(FALSE,"get_last_pj exception non lancée");
|
||||
} catch (Exception $ex) {
|
||||
$this->assertTrue(TRUE,"Exception si id =0");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_type
|
||||
* @todo Implement testGet_type().
|
||||
*/
|
||||
public function testGet_type()
|
||||
{
|
||||
|
|
@ -96,6 +117,10 @@ class Acc_LedgerTest extends TestCase
|
|||
$this->object->id=3;
|
||||
$type=$this->object->get_type();
|
||||
$this->assertEquals('ACH',$type);
|
||||
|
||||
$this->object->id=999;
|
||||
$type=$this->object->get_type();
|
||||
$this->assertEquals(null,$type);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -138,7 +163,6 @@ class Acc_LedgerTest extends TestCase
|
|||
}
|
||||
/**
|
||||
* @covers Acc_Ledger::display_warning
|
||||
* @todo Implement testDisplay_warning().
|
||||
*/
|
||||
public function testDisplay_warning()
|
||||
{
|
||||
|
|
@ -148,7 +172,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::reverse
|
||||
* @todo Implement testReverse().
|
||||
*/
|
||||
public function testReverse()
|
||||
{
|
||||
|
|
@ -170,18 +193,24 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_name
|
||||
* @todo Implement testGet_name().
|
||||
*/
|
||||
public function testGet_name()
|
||||
{
|
||||
$this->object->id=3;
|
||||
$name=$this->object->get_name();
|
||||
$this->assertEquals('Achat',$name);
|
||||
|
||||
$this->object->id=0;
|
||||
$name=$this->object->get_name();
|
||||
$this->assertEquals('Grand Livre',$name);
|
||||
|
||||
$this->object->id=1000;
|
||||
$name=$this->object->get_name();
|
||||
$this->assertEquals(null,$name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_rowSimple
|
||||
* @todo Implement testGet_rowSimple().
|
||||
*/
|
||||
public function testGet_rowSimple()
|
||||
{
|
||||
|
|
@ -199,18 +228,16 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::guess_pj
|
||||
* @todo Implement testGuess_pj().
|
||||
*/
|
||||
public function testGuess_pj()
|
||||
{
|
||||
$this->object->id=2;
|
||||
$r=$this->object->guess_pj();
|
||||
$this->assertEquals("VEN10",$r);
|
||||
$this->assertEquals("VEN40",$r);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_propertie
|
||||
* @todo Implement testGet_propertie().
|
||||
*/
|
||||
public function testGet_propertie()
|
||||
{
|
||||
|
|
@ -219,6 +246,9 @@ class Acc_LedgerTest extends TestCase
|
|||
$array=$this->object->get_propertie();
|
||||
// there are 16 columns in jrn_def
|
||||
$this->assertEquals(count($array),20);
|
||||
$this->object->id=0;
|
||||
$array=$this->object->get_propertie();
|
||||
$this->assertEquals(null,$array);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -255,7 +285,6 @@ class Acc_LedgerTest extends TestCase
|
|||
}
|
||||
/**
|
||||
* @covers Acc_Ledger::get_solde
|
||||
* @todo Implement testGet_solde().
|
||||
*/
|
||||
public function testGet_solde()
|
||||
{
|
||||
|
|
@ -264,23 +293,21 @@ class Acc_LedgerTest extends TestCase
|
|||
$max=$g_connection->get_value("select max(p_id) from parm_periode");
|
||||
$min=$g_connection->get_value("select min(p_id) from parm_periode");
|
||||
$solde=$ledger->get_solde($min,$max);
|
||||
$this->assertEquals($solde[0],490.77);
|
||||
$this->assertEquals($solde[1],490.77);
|
||||
$this->assertEquals($solde[0],4175.02);
|
||||
$this->assertEquals($solde[1],4175.02);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::select_ledger
|
||||
* @todo Implement testSelect_ledger().
|
||||
*/
|
||||
public function testSelect_ledger()
|
||||
{
|
||||
$select_available=$this->object->select_ledger();
|
||||
$this->assertEquals(4,count($select_available->value));
|
||||
$this->assertEquals(7,count($select_available->value));
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Ledger::get_fiche_def
|
||||
* @todo Implement testGet_fiche_def().
|
||||
*/
|
||||
public function testGet_fiche_def()
|
||||
{
|
||||
|
|
@ -293,7 +320,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_class_def
|
||||
* @todo Implement testGet_class_def().
|
||||
*/
|
||||
public function testGet_class_def()
|
||||
{
|
||||
|
|
@ -306,7 +332,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::confirm
|
||||
* @todo Implement testConfirm().
|
||||
*/
|
||||
public function testConfirm()
|
||||
{
|
||||
|
|
@ -358,7 +383,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_min_row
|
||||
* @todo Implement testGet_min_row().
|
||||
*/
|
||||
public function testGet_min_row()
|
||||
{
|
||||
|
|
@ -375,7 +399,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::input
|
||||
* @todo Implement testInput().
|
||||
*/
|
||||
public function testInput()
|
||||
{
|
||||
|
|
@ -406,7 +429,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::is_closed
|
||||
* @todo Implement testIs_closed().
|
||||
*/
|
||||
public function testIs_closed()
|
||||
{
|
||||
|
|
@ -418,7 +440,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::verify
|
||||
* @todo Implement testVerify().
|
||||
*/
|
||||
public function testVerify_Ledger()
|
||||
{
|
||||
|
|
@ -451,7 +472,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::compute_internal_code
|
||||
* @todo Implement testCompute_internal_code().
|
||||
*/
|
||||
public function testCompute_internal_code()
|
||||
{
|
||||
|
|
@ -506,6 +526,8 @@ class Acc_LedgerTest extends TestCase
|
|||
$this->assertEquals(1,$cnt);
|
||||
|
||||
$ledger->delete();
|
||||
$g_connection->exec_sql("alter sequence s_jrn_pj4 restart with 43");
|
||||
|
||||
$cnt=$g_connection->get_value("select count(*) from jrn where jr_mt=$1",[$array['mt']]);
|
||||
$this->assertEquals(0,$cnt);
|
||||
|
||||
|
|
@ -513,7 +535,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::next_number
|
||||
* @todo Implement testNext_number().
|
||||
*/
|
||||
public function testNext_number()
|
||||
{
|
||||
|
|
@ -524,7 +545,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_first
|
||||
* @todo Implement testGet_first().
|
||||
*/
|
||||
public function testGet_first()
|
||||
{
|
||||
|
|
@ -536,7 +556,9 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_all_fiche_def
|
||||
* @todo Implement testGet_all_fiche_def().
|
||||
* @todo
|
||||
* $this->object->set_ledger_id(3);
|
||||
$this->assertEquals($this->object->is_enable(),TRUE); Implement testGet_all_fiche_def().
|
||||
*/
|
||||
public function testGet_all_fiche_def()
|
||||
{
|
||||
|
|
@ -547,16 +569,15 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_saldo_exercice
|
||||
* @todo Implement testGet_saldo_exercice().
|
||||
*/
|
||||
public function testGet_saldo_exercice()
|
||||
{
|
||||
$result=[
|
||||
["solde"=> 658.2500 , "j_poste"=> "4400004", "j_qcode"=> "FOURNI"],
|
||||
["solde"=> 658.25 , "j_poste"=> "4400004", "j_qcode"=> "FOURNI"],
|
||||
["solde"=> 490.7700 , "j_poste"=> "4000005", "j_qcode"=> "CLIENT1"],
|
||||
["solde"=> 21.9600, "j_poste"=> "4112", "j_qcode"=> ""],
|
||||
["solde"=> 87.8400, "j_poste"=> "4112", "j_qcode"=> ""],
|
||||
["solde"=>-85.1700 , "j_poste"=> "4511", "j_qcode"=> ""],
|
||||
["solde"=> -863.2100 , "j_poste"=>"4400005", "j_qcode"=> "FOURNI1"]
|
||||
["solde"=> -1496.3400 , "j_poste"=>"4400005", "j_qcode"=> "FOURNI1"]
|
||||
];
|
||||
$get=$this->object->get_saldo_exercice("2018");
|
||||
$nb_get=count($get);
|
||||
|
|
@ -580,18 +601,16 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_last_date
|
||||
* @todo Implement testGet_last_date().
|
||||
*/
|
||||
public function testGet_last_date()
|
||||
{
|
||||
$this->object->set_ledger_id(2);
|
||||
$last_date=$this->object->get_last_date();
|
||||
$this->assertEquals("24.04.2018",$last_date);
|
||||
$this->assertEquals("24.04.2019",$last_date);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_id
|
||||
* @todo Implement testGet_id().
|
||||
*/
|
||||
public function testGet_id()
|
||||
{
|
||||
|
|
@ -603,7 +622,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::array_cat
|
||||
* @todo Implement testArray_cat().
|
||||
*/
|
||||
public function testArray_cat()
|
||||
{
|
||||
|
|
@ -613,7 +631,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_tiers
|
||||
* @todo Implement testGet_tiers().
|
||||
*/
|
||||
public function testGet_tiers()
|
||||
{
|
||||
|
|
@ -631,6 +648,9 @@ class Acc_LedgerTest extends TestCase
|
|||
$this->assertTrue($this->object->get_tiers("VEN",$jr_id)!=' ');
|
||||
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Ledger::get_tiers_id
|
||||
*/
|
||||
public function testGet_tiers_id()
|
||||
{
|
||||
global $g_connection;
|
||||
|
|
@ -650,7 +670,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::verify_ledger
|
||||
* @todo Implement testVerify_ledger().
|
||||
*/
|
||||
public function testVerify_Operation()
|
||||
{
|
||||
|
|
@ -751,7 +770,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::input_new
|
||||
* @todo Implement testInput_new().
|
||||
*/
|
||||
public function testInput_new()
|
||||
{
|
||||
|
|
@ -802,7 +820,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::delete_ledger
|
||||
* @todo Implement testDelete_ledger().
|
||||
*/
|
||||
public function testDelete_ledger()
|
||||
{
|
||||
|
|
@ -832,7 +849,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_operation_date
|
||||
* @todo Implement testGet_operation_date().
|
||||
*/
|
||||
public function testGet_operation_date()
|
||||
{
|
||||
|
|
@ -849,7 +865,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_supplier_now
|
||||
* @todo Implement testGet_supplier_now().
|
||||
*/
|
||||
public function testGet_supplier_now()
|
||||
{
|
||||
|
|
@ -858,7 +873,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_supplier_late
|
||||
* @todo Implement testGet_supplier_late().
|
||||
*/
|
||||
public function testGet_supplier_late()
|
||||
{
|
||||
|
|
@ -867,7 +881,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_customer_now
|
||||
* @todo Implement testGet_customer_now().
|
||||
*/
|
||||
public function testGet_customer_now()
|
||||
{
|
||||
|
|
@ -876,11 +889,26 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_customer_late
|
||||
* @todo Implement testGet_customer_late().
|
||||
*/
|
||||
public function testGet_customer_late()
|
||||
{
|
||||
$this->assertTrue(is_array($this->object->get_customer_late()));
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Ledger::set_ledger_id
|
||||
* @covers Acc_Ledger::is_enable
|
||||
*/
|
||||
public function testIs_Enable()
|
||||
{
|
||||
$this->object->set_ledger_id(83);
|
||||
$this->assertEquals($this->object->is_enable(),0);
|
||||
|
||||
$this->object->set_ledger_id(4);
|
||||
$this->assertEquals($this->object->is_enable(),1);
|
||||
$this->object->set_ledger_id(2);
|
||||
$this->assertEquals($this->object->is_enable(),1);
|
||||
$this->object->set_ledger_id(3);
|
||||
$this->assertEquals($this->object->is_enable(),1);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ class Acc_Ledger_FinTest extends TestCase
|
|||
$this->assertContains('<INPUT TYPE="hidden" id="dateop1" NAME="dateop1" VALUE="">',$result);
|
||||
$this->assertContains('<INPUT TYPE="hidden" id="chdate" NAME="chdate" VALUE="1">',$result);
|
||||
|
||||
|
||||
}
|
||||
private function clean_operation()
|
||||
{
|
||||
|
|
@ -125,6 +126,8 @@ class Acc_Ledger_FinTest extends TestCase
|
|||
[ '1572695340.6768']
|
||||
);
|
||||
$g_connection->exec_sql(' delete from jrnx where j_grpt not in (select jr_grpt_id from jrn)');
|
||||
$g_connection->exec_sql("alter sequence s_jrn_pj1 restart with 48");
|
||||
|
||||
$g_connection->commit();
|
||||
|
||||
}
|
||||
|
|
@ -154,7 +157,7 @@ class Acc_Ledger_FinTest extends TestCase
|
|||
$ret=$this->object->insert($array);
|
||||
$this->assertContains('<table class="result" ><tr ><th >Date</th>',$ret);
|
||||
$this->assertContains(' HREF="javascript:modifyOperation',$ret);
|
||||
$this->assertContains('-935,91',$ret);
|
||||
$this->assertContains('-1.095,39',$ret);
|
||||
|
||||
$this->clean_operation();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ use PHPUnit\Framework\TestCase;
|
|||
/**
|
||||
* @file
|
||||
* @brief concerne acc_ledger_history_financialTest.class
|
||||
* @coversDefaultClass Acc_History_Financial
|
||||
*/
|
||||
class Acc_Ledger_History_FinancialTest extends TestCase
|
||||
{
|
||||
|
|
@ -63,7 +64,7 @@ class Acc_Ledger_History_FinancialTest extends TestCase
|
|||
function testGet__row()
|
||||
{
|
||||
$this->object->get_row();
|
||||
$this->assertEquals(5, count($this->object->get_data()));
|
||||
$this->assertEquals(7, count($this->object->get_data()));
|
||||
}
|
||||
|
||||
//@covers Acc_Ledger_History_Financial::export_html
|
||||
|
|
@ -93,4 +94,12 @@ class Acc_Ledger_History_FinancialTest extends TestCase
|
|||
$this->assertFileExists(__DIR__."/file/".$name);
|
||||
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Ledger_History::get_ledger_type
|
||||
*/
|
||||
|
||||
function testGet_Ledger_type()
|
||||
{
|
||||
$this->assertEquals($this->object->get_ledger_type(),'FIN');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,5 +113,12 @@ class Acc_Ledger_History_GenericTest extends TestCase
|
|||
$this->save_file($name, $content);
|
||||
$this->assertFileExists(__DIR__."/file/".$name);
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Ledger_History::get_ledger_type
|
||||
*/
|
||||
|
||||
function testGet_Ledger_type()
|
||||
{
|
||||
$this->assertEquals($this->object->get_ledger_type(),'ODS');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ class Acc_Ledger_History_PurchaseTest extends TestCase
|
|||
function testGet_Row()
|
||||
{
|
||||
$this->object->get_row();
|
||||
$this->assertSame(count($this->object->get_data()),65);
|
||||
$this->assertSame(count($this->object->get_data()),14);
|
||||
|
||||
}
|
||||
//@covers Acc_Ledger_History_Financial::export_oneline_html
|
||||
|
|
@ -112,5 +112,12 @@ class Acc_Ledger_History_PurchaseTest extends TestCase
|
|||
$this->save_file($name, $content);
|
||||
$this->assertFileExists(__DIR__."/file/".$name);
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Ledger_History::get_ledger_type
|
||||
*/
|
||||
|
||||
function testGet_Ledger_type()
|
||||
{
|
||||
$this->assertEquals($this->object->get_ledger_type(),'ACH');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class Acc_Ledger_History_SaleTest extends TestCase
|
|||
function testGet_row()
|
||||
{
|
||||
$this->object->get_row();
|
||||
$this->assertSame(count($this->object->get_data()),4);
|
||||
$this->assertSame(count($this->object->get_data()),6);
|
||||
}
|
||||
private function save_file($p_name,$content)
|
||||
{
|
||||
|
|
@ -110,4 +110,12 @@ class Acc_Ledger_History_SaleTest extends TestCase
|
|||
$this->save_file($name, $content);
|
||||
$this->assertFileExists(__DIR__."/file/".$name);
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Ledger_History::get_ledger_type
|
||||
*/
|
||||
|
||||
function testGet_Ledger_type()
|
||||
{
|
||||
$this->assertEquals($this->object->get_ledger_type(),'VEN');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,9 @@
|
|||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2014-11-08 at 14:20:36.
|
||||
* @backupGlobals enabled
|
||||
* @coversDefaultClass Acc_Ledger_Purchase
|
||||
*
|
||||
*/
|
||||
class Acc_Ledger_PurchaseTest extends TestCase
|
||||
{
|
||||
|
|
@ -102,7 +103,6 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger_Purchase::insert
|
||||
* @todo Implement testInsert().
|
||||
*/
|
||||
public function testInsert()
|
||||
{
|
||||
|
|
@ -128,7 +128,6 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger_Purchase::input
|
||||
* @todo Implement testInput().
|
||||
*/
|
||||
public function testInput()
|
||||
{
|
||||
|
|
@ -138,7 +137,7 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
"acc_ledger_purchase_input.html",
|
||||
\Noalyss\Facility::page_start().$res);
|
||||
$this->assertContains(
|
||||
'<OPTION VALUE="3" SELECTED>Achat</SELECT>',
|
||||
'<OPTION VALUE="3" SELECTED>Achat',
|
||||
$res);
|
||||
$this->assertContains('<INPUT TYPE="hidden" id="jrn_type" NAME="jrn_type" VALUE="ACH"',$res);
|
||||
$this->assertContains('<td class="num"> <span id="tvac" >0.0</span> </td>',$res);
|
||||
|
|
@ -147,7 +146,6 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger_Purchase::confirm
|
||||
* @todo Implement testConfirm().
|
||||
*/
|
||||
public function testConfirm()
|
||||
{
|
||||
|
|
@ -167,8 +165,23 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
global $g_connection;
|
||||
$g_connection->exec_sql("delete from jrn where jr_mt=$1", ["1572704002.1732"]);
|
||||
$g_connection->exec_sql("delete from jrnx where j_grpt not in (select jr_grpt_id from jrn)");
|
||||
}
|
||||
|
||||
|
||||
$g_connection->exec_sql("alter sequence s_jrn_pj3 restart with 52");
|
||||
|
||||
}
|
||||
/**
|
||||
* @covers ::get_detail_purchase
|
||||
*/
|
||||
public function testget_detail_purchase()
|
||||
{
|
||||
// 92 = 1.1.2018 and 103 = 31.12.2018
|
||||
$ret=$this->object->get_detail_purchase(92,103,'all');
|
||||
$this->assertEquals(7,Database::num_row($ret),"all operation (no filter)");
|
||||
|
||||
|
||||
$ret=$this->object->get_detail_purchase(92,103,'paid');
|
||||
$this->assertEquals(2,Database::num_row($ret),'only paid operations');
|
||||
|
||||
$ret=$this->object->get_detail_purchase(92,103,'unpaid');
|
||||
$this->assertEquals(5,Database::num_row($ret),'only unpaid operations');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2014-11-08 at 14:20:37.
|
||||
* @backupGlobals enabled
|
||||
* @coversDefaultClass Acc_Ledger_Sold
|
||||
*/
|
||||
class Acc_Ledger_SoldTest extends TestCase
|
||||
{
|
||||
|
|
@ -83,6 +83,7 @@ class Acc_Ledger_SoldTest extends TestCase
|
|||
global $g_connection;
|
||||
$g_connection->exec_sql("delete from jrn where jr_mt=$1", ["1572714478.3155"]);
|
||||
$g_connection->exec_sql("delete from jrnx where j_grpt not in (select jr_grpt_id from jrn)");
|
||||
$g_connection->exec_sql("alter sequence s_jrn_pj2 restart with 40");
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Ledger_Sold::verify
|
||||
|
|
@ -90,6 +91,7 @@ class Acc_Ledger_SoldTest extends TestCase
|
|||
public function testVerify()
|
||||
{
|
||||
$this->object->verify_operation($this->array);
|
||||
$this->assertTrue(TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -157,17 +159,6 @@ class Acc_Ledger_SoldTest extends TestCase
|
|||
$this->assertContains('ID="add_item" VALUE="Ajout article" onClick="ledger_add_row()">', $info);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger_Sold::get_detail_sale
|
||||
* @todo Implement testGet_detail_sale().
|
||||
*/
|
||||
public function testGet_detail_sale()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger_Sold::heading_detail_sale
|
||||
|
|
@ -175,10 +166,23 @@ class Acc_Ledger_SoldTest extends TestCase
|
|||
*/
|
||||
public function testHeading_detail_sale()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$a=$this->object->heading_detail_sale();
|
||||
$this->assertEquals(28,count($a));
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Ledger_Sold::get_detail_sale
|
||||
*/
|
||||
public function testget_detail_sale()
|
||||
{
|
||||
// 92 = 1.1.2018 and 103 = 31.12.2018
|
||||
$ret=$this->object->get_detail_sale(92,103,'all');
|
||||
$this->assertEquals(7,Database::num_row($ret),"all operation (no filter)");
|
||||
|
||||
|
||||
$ret=$this->object->get_detail_sale(92,103,'paid');
|
||||
$this->assertEquals(2,Database::num_row($ret),'only paid operations');
|
||||
|
||||
$ret=$this->object->get_detail_sale(92,103,'unpaid');
|
||||
$this->assertEquals(5,Database::num_row($ret),'only unpaid operations');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ $a_result = array (
|
|||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1',
|
||||
'amount_vat' => '38.4300',
|
||||
'amount_wovat' => '183.0000',
|
||||
'amount_vat' => '44.5300',
|
||||
'amount_wovat' => '212.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
|
|
@ -46,6 +46,21 @@ $a_result = array (
|
|||
'amount_private' => '0.0000',
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Achat',
|
||||
'tva_label' => '6%',
|
||||
'tva_rate' => '0.0600',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '3',
|
||||
'amount_vat' => '5.2800',
|
||||
'amount_wovat' => '88.3200',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
4 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Achat',
|
||||
'tva_label' => 'ART44',
|
||||
|
|
@ -60,7 +75,7 @@ $a_result = array (
|
|||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
4 =>
|
||||
5 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Achat',
|
||||
'tva_label' => 'EXPORT',
|
||||
|
|
@ -75,7 +90,7 @@ $a_result = array (
|
|||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
5 =>
|
||||
6 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Achat',
|
||||
'tva_label' => 'IMMO',
|
||||
|
|
@ -90,7 +105,7 @@ $a_result = array (
|
|||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
6 =>
|
||||
7 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Achat',
|
||||
'tva_label' => 'VOIT',
|
||||
|
|
@ -105,22 +120,22 @@ $a_result = array (
|
|||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
7 =>
|
||||
8 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Frais Divers',
|
||||
'tva_label' => '21%',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1',
|
||||
'amount_vat' => '140.0400',
|
||||
'amount_wovat' => '666.8600',
|
||||
'amount_vat' => '244.5500',
|
||||
'amount_wovat' => '1164.5400',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
8 =>
|
||||
9 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Frais Divers',
|
||||
'tva_label' => 'EXPORT',
|
||||
|
|
@ -135,7 +150,7 @@ $a_result = array (
|
|||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
9 =>
|
||||
10 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Frais Divers',
|
||||
'tva_label' => 'IMMO',
|
||||
|
|
@ -150,7 +165,7 @@ $a_result = array (
|
|||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
10 =>
|
||||
11 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Frais Divers',
|
||||
'tva_label' => 'INTRA',
|
||||
|
|
@ -165,7 +180,7 @@ $a_result = array (
|
|||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
11 =>
|
||||
12 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Frais Divers',
|
||||
'tva_label' => 'VOIT',
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ array (
|
|||
'qs_vat_code' => '1',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '16.8000',
|
||||
'amount_wovat' => '80.0000',
|
||||
'amount_vat' => '219.5700',
|
||||
'amount_wovat' => '1045.6000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_type' => 'P',
|
||||
),
|
||||
|
|
@ -44,8 +44,8 @@ array (
|
|||
'qs_vat_code' => '1003',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '10.7500',
|
||||
'amount_wovat' => '51.2000',
|
||||
'amount_vat' => '19.1500',
|
||||
'amount_wovat' => '91.2000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_type' => 'P',
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
$a_result = array (
|
||||
0 =>
|
||||
array (
|
||||
|
|
@ -35,8 +34,8 @@ $a_result = array (
|
|||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1',
|
||||
'amount_vat' => '178.4700',
|
||||
'amount_wovat' => '849.8600',
|
||||
'amount_vat' => '289.0800',
|
||||
'amount_wovat' => '1376.5400',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
|
|
@ -44,6 +43,20 @@ $a_result = array (
|
|||
'amount_private' => '0.0000',
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'tva_label' => '6%',
|
||||
'tva_rate' => '0.0600',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '3',
|
||||
'amount_vat' => '5.2800',
|
||||
'amount_wovat' => '88.3200',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
4 =>
|
||||
array (
|
||||
'tva_label' => 'ART44',
|
||||
'tva_rate' => '0.0000',
|
||||
|
|
@ -57,7 +70,7 @@ $a_result = array (
|
|||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
4 =>
|
||||
5 =>
|
||||
array (
|
||||
'tva_label' => 'EXPORT',
|
||||
'tva_rate' => '0.0000',
|
||||
|
|
@ -71,7 +84,7 @@ $a_result = array (
|
|||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
5 =>
|
||||
6 =>
|
||||
array (
|
||||
'tva_label' => 'IMMO',
|
||||
'tva_rate' => '0.2100',
|
||||
|
|
@ -85,7 +98,7 @@ $a_result = array (
|
|||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
6 =>
|
||||
7 =>
|
||||
array (
|
||||
'tva_label' => 'INTRA',
|
||||
'tva_rate' => '0.0000',
|
||||
|
|
@ -99,7 +112,7 @@ $a_result = array (
|
|||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
7 =>
|
||||
8 =>
|
||||
array (
|
||||
'tva_label' => 'VOIT',
|
||||
'tva_rate' => '0.2100',
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ array (
|
|||
'qs_vat_code' => '1',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '16.8000',
|
||||
'amount_wovat' => '80.0000',
|
||||
'amount_vat' => '219.5700',
|
||||
'amount_wovat' => '1045.6000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_payment_sale' => 'P',
|
||||
'tva_payment_sale' => 'O',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
|
|
@ -40,9 +40,9 @@ array (
|
|||
'qs_vat_code' => '1003',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '10.7500',
|
||||
'amount_wovat' => '51.2000',
|
||||
'amount_vat' => '19.1500',
|
||||
'amount_wovat' => '91.2000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_payment_sale' => 'P',
|
||||
'tva_payment_sale' => 'O',
|
||||
),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class Tax_SummaryTest extends TestCase
|
|||
{
|
||||
$nb_result=count($p_array_expected);
|
||||
$nb_array=count($p_array);
|
||||
$this->assertEquals($nb_result, $nb_array);
|
||||
$this->assertEquals($nb_result, $nb_array,$p_scenario);
|
||||
$ix=0;
|
||||
switch ($jrn_type)
|
||||
{
|
||||
|
|
@ -215,7 +215,7 @@ class Tax_SummaryTest extends TestCase
|
|||
$this->object->set_tva_type("T");
|
||||
$array=$this->object->get_summary_purchase();
|
||||
//-- For creating the array
|
||||
// Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_getsummary_purchase_t.txt", var_export($array, TRUE));
|
||||
Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_getsummary_purchase_t.txt", var_export($array, TRUE));
|
||||
require __DIR__."/data/tax_summary_getsummary_purchase_t.php";
|
||||
$this->check_result("tva_type = T , get_summary_purchase",$array,$a_result,'SMRACH');
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ class Tax_SummaryTest extends TestCase
|
|||
$this->object->set_tva_type("T");
|
||||
$array=$this->object->get_summary_sale();
|
||||
//-- For creating the array
|
||||
//Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_getsummary_sale_t.txt", var_export($array, TRUE));
|
||||
Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_getsummary_sale_t.txt", var_export($array, TRUE));
|
||||
require __DIR__."/data/tax_summary_getsummary_sale_t.php";
|
||||
$this->check_result("tva_type = T , get_summary_sale",$array,$a_result,'SMRVEN');
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ if [ ! -z "$FUNCTION" ] ; then
|
|||
$PHPUNIT --bootstrap bootstrap.php --verbose --color --filter $FUNCTION $FILETOTEST
|
||||
else
|
||||
|
||||
$PHPUNIT --bootstrap bootstrap.php --color $FILETOTEST
|
||||
# $PHPUNIT --bootstrap bootstrap.php --whitelist $FILETOTEST --coverage-text=${FILETOTEST%.php}.txt --color $FILETOTEST
|
||||
$PHPUNIT --bootstrap bootstrap.php --whitelist=../include/class --coverage-html=coverage --color $FILETOTEST
|
||||
#$PHPUNIT --bootstrap bootstrap.php $FILETOTEST --testdox-html ${FILETOTEST%.php}-testdox.html --color $FILETOTEST
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue