Merge branch 'dev-7200'
This commit is contained in:
commit
eda776ccc8
97 changed files with 4479 additions and 3441 deletions
|
|
@ -183,7 +183,7 @@ BODY {
|
|||
|
||||
left:0px;
|
||||
top:20px;
|
||||
height: 15%;
|
||||
/*! height: 15%; */
|
||||
}
|
||||
#login_frm {
|
||||
position:absolute;
|
||||
|
|
@ -203,7 +203,7 @@ BODY {
|
|||
width: 20rem;
|
||||
}
|
||||
}
|
||||
@media only screen and (min-width : 1100px) {
|
||||
@media only screen and (max-width : 1100px) {
|
||||
#alternate_browser {
|
||||
position:absolute;
|
||||
bottom: 30px;
|
||||
|
|
@ -229,7 +229,7 @@ BODY {
|
|||
}
|
||||
#recover_link {
|
||||
position:absolute;
|
||||
top:397px;
|
||||
/*! top:397px; */
|
||||
left:539px;
|
||||
background-color: white;
|
||||
width:auto;
|
||||
|
|
@ -274,11 +274,11 @@ BODY {
|
|||
width: 24rem;
|
||||
}
|
||||
#recover_link {
|
||||
position:absolute;
|
||||
top:55%;
|
||||
position:fixed;
|
||||
left:55%;
|
||||
background-color: white;
|
||||
margin-top:0px;
|
||||
bottom: 10px;
|
||||
}
|
||||
#recover_box {
|
||||
|
||||
|
|
|
|||
|
|
@ -205,7 +205,6 @@ echo '
|
|||
</TR>';
|
||||
|
||||
|
||||
|
||||
if ( $g_captcha == true )
|
||||
{
|
||||
echo '<tr ><td colspan="2" style="width:auto">';
|
||||
|
|
@ -255,8 +254,7 @@ echo '
|
|||
Email <input type="text" class="input_text" name="email" nohistory>
|
||||
</p>
|
||||
<input type="submit" class="button" name="send_email" value="Envoi email">
|
||||
|
||||
</form>
|
||||
<input type="button" class="button" id="close_link_bt" value="Annuler">
|
||||
</div>
|
||||
<script>
|
||||
document.getElementById('recover_link').onclick=function() {
|
||||
|
|
@ -265,6 +263,9 @@ echo '
|
|||
document.getElementById('close_link').onclick=function() {
|
||||
document.getElementById('recover_box').style.display="none";
|
||||
}
|
||||
document.getElementById('close_link_bt').onclick=function() {
|
||||
document.getElementById('recover_box').style.display="none";
|
||||
}
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
|
||||
|
|
|
|||
|
|
@ -1298,7 +1298,9 @@ function manage_search_filter(p_obj) {
|
|||
* @see Acc_Ledger_Search
|
||||
*/
|
||||
function save_filter(p_div,p_dossier) {
|
||||
var elt=['ledger_type','nb_jrn','date_start','date_end','date_paid_start','date_paid_end','desc','amount_min','amount_max','qcode','accounting'];
|
||||
var elt=['ledger_type','nb_jrn','date_start','date_end',
|
||||
'date_paid_start','date_paid_end','desc','amount_min','amount_max','qcode','accounting',
|
||||
'operation_filter'];
|
||||
var eltValue={};
|
||||
eltValue['gDossier']=p_dossier;
|
||||
eltValue['op']="save_filter";
|
||||
|
|
@ -1322,8 +1324,6 @@ function save_filter(p_div,p_dossier) {
|
|||
|
||||
}
|
||||
}
|
||||
//unpaid
|
||||
eltValue['unpaid']=$(p_div+"unpaid").checked;
|
||||
new Ajax.Request('ajax_misc.php', {
|
||||
method:"POST",
|
||||
parameters:eltValue,
|
||||
|
|
@ -1361,7 +1361,8 @@ function load_filter(p_div,p_dossier,p_filter_id) {
|
|||
try {
|
||||
var answer=req.responseJSON;
|
||||
console.log(answer);
|
||||
var elt=['ledger_type','date_start','date_end','date_paid_start','date_paid_end','desc','amount_min','amount_max','qcode','accounting'];
|
||||
var elt=['ledger_type','date_start','date_end','date_paid_start','date_paid_end',
|
||||
'desc','amount_min','amount_max','qcode','accounting','operation_filter'];
|
||||
for (var i=0;i<elt.length;i++) {
|
||||
var idx=elt[i];
|
||||
$(p_div+idx).value=answer[elt[i]];
|
||||
|
|
@ -1386,12 +1387,7 @@ function load_filter(p_div,p_dossier,p_filter_id) {
|
|||
eltHidden.setAttribute("value",answer.r_jrn[i]);
|
||||
eltLedgerId.appendChild(eltHidden);
|
||||
}
|
||||
if ( answer.unpaid == 'false') {
|
||||
$(p_div+"unpaid").checked=false;
|
||||
}
|
||||
if ( answer.unpaid == 'true') {
|
||||
$(p_div+"unpaid").checked=true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch (e) {
|
||||
|
|
@ -1411,7 +1407,7 @@ identification element UL manage{div}
|
|||
*/
|
||||
|
||||
function delete_filter (p_div,p_dossier,p_filter_id) {
|
||||
new Ajax.Request("ajax_misc",{
|
||||
new Ajax.Request("ajax_misc.php",{
|
||||
parameters:{"gDossier":p_dossier,"div":p_div,"filter_id":p_filter_id,'op':"delete_search_operation"},
|
||||
method:"POST",
|
||||
onSuccess:function (req) {
|
||||
|
|
@ -1456,5 +1452,5 @@ function reset_filter(p_div) {
|
|||
eltLedgerId.appendChild(eltHidden);
|
||||
|
||||
// By default , unpaid is uncked
|
||||
$(p_div+"unpaid").checked=false;
|
||||
$(p_div+"operation_filter").value="all";
|
||||
}
|
||||
|
|
@ -59,7 +59,7 @@ if ($op=='save_filter')
|
|||
$http->post("date_paid_start", 'string', NULL));
|
||||
$new->setp("date_paid_end", $http->post("date_paid_end", 'string', NULL));
|
||||
$new->setp("ledger_type", $http->post("ledger_type", 'string'));
|
||||
$new->setp("unpaid", $http->post("unpaid", 'string', NULL));
|
||||
$new->setp("operation_filter", $http->post("operation_filter", 'string', NULL));
|
||||
$new->setp("filter_name", h($http->post("filter_name", 'string')));
|
||||
$aJrn=[];
|
||||
$max=$http->post("nb_jrn");
|
||||
|
|
|
|||
|
|
@ -260,15 +260,7 @@ class Acc_Account_Ledger
|
|||
return true;
|
||||
|
||||
}
|
||||
/*!\brief Get all the value for this object from the database
|
||||
* the data member are set
|
||||
* \return false if this account doesn't exist otherwise true
|
||||
*/
|
||||
function get()
|
||||
{
|
||||
echo "OBSOLETE Acc_Account_Ledger->get(), a remplacer par Acc_Account_Ledger->load()";
|
||||
return $this->load();
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* \brief give the balance of an account
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ require_once NOALYSS_INCLUDE.'/lib/sort_table.class.php';
|
|||
require_once NOALYSS_INCLUDE.'/database/jrn_def_sql.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/acc_payment.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/acc_ledger_history.class.php';
|
||||
//require_once NOALYSS_INCLUDE.'/class/print_ledger.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/pre_op_ods.class.php';
|
||||
|
||||
|
|
@ -63,7 +62,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 */
|
||||
|
||||
|
|
@ -79,7 +78,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
$this->db=$p_cn;
|
||||
$this->row=null;
|
||||
$this->nb=MAX_ARTICLE;
|
||||
parent::__construct($p_cn, $p_id);
|
||||
if ($p_id <> 0 ) parent::__construct($p_cn, $p_id);
|
||||
}
|
||||
|
||||
function get_last_pj()
|
||||
|
|
@ -131,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";
|
||||
}
|
||||
|
||||
|
|
@ -142,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'];
|
||||
}
|
||||
|
||||
|
|
@ -453,6 +452,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
*/
|
||||
function get_solde($p_from, $p_to)
|
||||
{
|
||||
bcscale(4);
|
||||
$ledger="";
|
||||
if ($this->id!=0)
|
||||
{
|
||||
|
|
@ -472,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;
|
||||
|
|
@ -571,7 +571,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
global $g_parameter;
|
||||
$msg=array();
|
||||
if (!$p_readonly)
|
||||
$msg=$this->verify($p_array);
|
||||
$msg=$this->verify_operation($p_array);
|
||||
$this->id=$p_array['p_jrn'];
|
||||
if (empty($p_array))
|
||||
return _("Aucun résultat");
|
||||
|
|
@ -1367,14 +1367,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
|
||||
|
|
@ -1781,18 +1773,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;
|
||||
|
|
@ -1816,7 +1820,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'.
|
||||
|
|
@ -1826,7 +1830,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'.
|
||||
|
|
@ -1852,14 +1856,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)
|
||||
|
|
@ -1911,7 +1915,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".
|
||||
|
|
@ -1929,14 +1933,18 @@ class Acc_Ledger extends jrn_def_sql
|
|||
$ret=$array[0];
|
||||
/* retrieve all vat code */
|
||||
$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 and j_date >= to_date($1,'DD.MM.YYYY') and j_date < to_date($2,'DD.MM.YYYY')
|
||||
from quant_purchase as p
|
||||
right join tva_rate on (qp_vat_code=tva_id) join jrnx using(j_id)
|
||||
where
|
||||
tva_rate !=0
|
||||
and j_date >= to_date($1,'DD.MM.YYYY')
|
||||
and j_date < to_date($2,'DD.MM.YYYY')
|
||||
and j_jrn_def = $3
|
||||
group by tva_id",
|
||||
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".
|
||||
|
|
@ -1944,7 +1952,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
',0 as priv'.
|
||||
',0 as tva_nd'.
|
||||
',coalesce(sum(qs_vat_sided),0) as reversed'.
|
||||
',coalesce(sum(qs_vat_sided),0) as tva_np'.
|
||||
',0 as tva_np'.
|
||||
' from quant_sold join jrnx using(j_id) '.
|
||||
" where j_date >= to_date($1,'DD.MM.YYYY') and j_date < to_date($2,'DD.MM.YYYY') ".
|
||||
' and j_jrn_def = $3';
|
||||
|
|
@ -1953,25 +1961,38 @@ class Acc_Ledger extends jrn_def_sql
|
|||
$ret=$array[0];
|
||||
/* retrieve all vat code */
|
||||
$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)
|
||||
where tva_rate !=0 and
|
||||
j_date >= to_date($1,'DD.MM.YYYY') and j_date < to_date($2,'DD.MM.YYYY')
|
||||
and j_jrn_def = $3
|
||||
from quant_sold as p
|
||||
right join tva_rate on (qs_vat_code=tva_id)
|
||||
join jrnx using(j_id)
|
||||
where
|
||||
tva_rate !=0 and
|
||||
j_date >= to_date($1,'DD.MM.YYYY')
|
||||
and j_date < to_date($2,'DD.MM.YYYY')
|
||||
and j_jrn_def = $3
|
||||
group by tva_id",
|
||||
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 */
|
||||
$ledger=new Acc_Ledger_Fin($this->db, $this->id);
|
||||
$qcode=$ledger->get_bank();
|
||||
$bank_card=new Fiche($this->db, $qcode);
|
||||
|
||||
$periode=new Periode($this->db);
|
||||
//$periode->find_periode($min_date);
|
||||
//$a_date=$periode->get_limit($periode->get_exercice());
|
||||
|
||||
/* add the amount from Opening Writing */
|
||||
$cond=sprintf(" j_jrn_def <> %d and j_date >= to_date('%s','DD.MM.YYYY') and j_date < to_date('%s','DD.MM.YYYY') ",
|
||||
$this->id, $min_date, $max_date);
|
||||
if ( $min_date <> $max_date)
|
||||
{
|
||||
$cond=sprintf("j_date >= to_date('%s','DD.MM.YYYY') and j_date < to_date('%s','DD.MM.YYYY') ",
|
||||
$min_date,$max_date);
|
||||
}else{
|
||||
$cond=sprintf("j_date = to_date('%s','DD.MM.YYYY') ",
|
||||
$min_date);
|
||||
}
|
||||
$saldo=$bank_card->get_bk_balance($cond);
|
||||
$ret['amount']=bcsub($saldo['debit'], $saldo['credit']);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
|
|||
function __construct($p_cn, $p_init)
|
||||
{
|
||||
parent::__construct($p_cn, $p_init);
|
||||
$this->type = 'FIN';
|
||||
$this->ledger_type = 'FIN';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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,7 +73,23 @@ 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';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -34,14 +34,21 @@ class Acc_Ledger_History_Purchase 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='ACH';
|
||||
}
|
||||
public function get_filter_operation()
|
||||
{
|
||||
return $this->filter_operation;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* @brief display the accounting
|
||||
*/
|
||||
public function export_accounting_html()
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -33,11 +33,14 @@ 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
|
||||
|
|
@ -111,7 +115,9 @@ class Acc_Ledger_History_Sale 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_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");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
{
|
||||
function __construct ($p_cn,$p_init)
|
||||
{
|
||||
$this->type='ACH';
|
||||
$this->ledger_type='ACH';
|
||||
parent::__construct($p_cn,$p_init);
|
||||
}
|
||||
/*!\brief verify that the data are correct before inserting or confirming
|
||||
|
|
@ -544,7 +544,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
for ($i=0;$i< $nb_item;$i++)
|
||||
{
|
||||
$n_both=0;
|
||||
if ( strlen(trim(${'e_march'.$i})) == 0 ) continue;
|
||||
if ( empty(${'e_march'.$i}) || empty(${'e_quant'.$i}) ) continue;
|
||||
|
||||
/* First we save all the items without vat */
|
||||
$fiche=new Fiche($this->db);
|
||||
|
|
@ -1807,14 +1807,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");
|
||||
|
||||
// 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 *
|
||||
|
|
@ -1822,6 +1834,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));
|
||||
|
|
|
|||
|
|
@ -204,15 +204,23 @@ class Acc_Ledger_Search
|
|||
$f_accounting->set_attribute('account', $this->div.'accounting');
|
||||
$info=Icon_Action::infobulle(13);
|
||||
|
||||
$f_paid=new ICheckbox('unpaid', null, $this->div.'unpaid');
|
||||
$f_paid->selected=(isset($_REQUEST['unpaid']))?true:false;
|
||||
// Status of the operation : paid, unpaid or all
|
||||
$f_paid=new ISelect('operation_filter', null, $this->div.'operation_filter');
|
||||
$f_paid->value=array(["value"=>'all',"label"=>_("Toutes")],
|
||||
["value"=>'unpaid',"label"=>_("Non payées")],
|
||||
["value"=>'paid',"label"=>_("Payées")]
|
||||
);
|
||||
$f_paid->selected=$http->request("operation_filter","string","all");
|
||||
|
||||
$r.=dossier::hidden();
|
||||
$r.=HtmlInput::hidden('ledger_type', $this->type,
|
||||
$this->div."ledger_type");
|
||||
$r.=HtmlInput::hidden('ac', $_REQUEST['ac']);
|
||||
$r.=HtmlInput::hidden('ac', $http->request('ac'));
|
||||
|
||||
// to avoid to find a given operation
|
||||
if (isset($_REQUEST['hide_operation']))
|
||||
$r.=HtmlInput::hidden("hide_operation", $_REQUEST['hide_operation']);
|
||||
$r.=HtmlInput::hidden("hide_operation", $http->request('hide_operation'));
|
||||
|
||||
ob_start();
|
||||
$search_filter=$this->build_search_filter();
|
||||
require_once NOALYSS_TEMPLATE.'/ledger_search.php';
|
||||
|
|
@ -526,12 +534,26 @@ class Acc_Ledger_Search
|
|||
$and=" and ";
|
||||
}
|
||||
|
||||
// Only the unpaid
|
||||
if (isset($unpaid))
|
||||
{
|
||||
$fil_paid=$and.SQL_LIST_UNPAID_INVOICE;
|
||||
$and=" and ";
|
||||
// Only the unpaid, paid or all
|
||||
if ( isset($operation_filter)) {
|
||||
switch ($operation_filter) {
|
||||
case "unpaid":
|
||||
$fil_paid=$and."(jr_rapt is null or jr_rapt = '') and jr_valid = true ";
|
||||
$and=" and ";
|
||||
break;
|
||||
case "all":
|
||||
$fil_paid="";
|
||||
break;
|
||||
case "paid":
|
||||
$fil_paid=$and."(jr_rapt is not null or jr_rapt = 'paid') and jr_valid = true ";
|
||||
$and=" and ";
|
||||
break;
|
||||
default:
|
||||
throw new Exception(_("ALS01 Etat inconnu"),10);
|
||||
|
||||
}
|
||||
}
|
||||
// Operations which must not be seen in the result
|
||||
if ( isset ($hide_operation) && trim($hide_operation) !="")
|
||||
{
|
||||
$fil_hide_operation=$and.sprintf( ' jr_id not in (%s)',sql_string($hide_operation));
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
|
||||
function __construct($p_cn, $p_init) {
|
||||
parent::__construct($p_cn, $p_init);
|
||||
$this->type = 'VEN';
|
||||
$this->ledger_type = 'VEN';
|
||||
}
|
||||
|
||||
/*!\brief verify that the data are correct before inserting or confirming
|
||||
|
|
@ -285,8 +285,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
/* Save all the items without vat */
|
||||
for ($i = 0; $i < $nb_item; $i++) {
|
||||
$n_both = 0;
|
||||
if (strlen(trim(${'e_march' . $i})) == 0)
|
||||
continue;
|
||||
if ( empty(${'e_march'.$i}) || empty(${'e_quant'.$i}) ) continue;
|
||||
|
||||
/* First we save all the items without vat */
|
||||
$fiche = new Fiche($this->db);
|
||||
|
|
@ -1336,13 +1335,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
|
||||
|
|
@ -1351,12 +1352,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));
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ class Document_Export
|
|||
// Create 2 temporary folders 1. convert to PDF + stamp
|
||||
// 2. store result
|
||||
$this->feedback = array();
|
||||
$this->store_convert = tempnam(sys_get_temp_dir(), 'convert_');
|
||||
$this->store_pdf = tempnam(sys_get_temp_dir(), 'pdf_');
|
||||
$this->store_convert = tempnam($_ENV['TMP'], 'convert_');
|
||||
$this->store_pdf = tempnam($_ENV['TMP'], 'pdf_');
|
||||
unlink($this->store_convert);
|
||||
unlink($this->store_pdf);
|
||||
umask(0);
|
||||
|
|
@ -277,7 +277,7 @@ class Document_Export
|
|||
|
||||
$progress->set_value(100);
|
||||
// remove files from "conversion folder"
|
||||
$this->clean_folder();
|
||||
// $this->clean_folder();
|
||||
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -140,6 +140,15 @@ class PDF extends PDF_Core
|
|||
return array($customer_qc,$customer_name,$bank_qc,$bank_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -24,137 +24,120 @@
|
|||
* @author danydb
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE.'/class/database.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/print_ledger_detail.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/print_ledger_simple.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/print_ledger_simple_without_vat.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/print_ledger_fin.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/print_ledger_misc.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/print_ledger_detail_item.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
|
||||
|
||||
/**
|
||||
* @brief Strategie class for the print_ledger class
|
||||
*
|
||||
*/
|
||||
class Print_Ledger {
|
||||
*/
|
||||
class Print_Ledger extends PDF
|
||||
{
|
||||
protected $filter_operation; // See Acc_Ledger_History::filter_operation
|
||||
private $ledger ; //!< concerned Ledger
|
||||
private $from ; //! integer parm_periode.p_id , start periode;
|
||||
private $to ; //! integer parm_periode.p_id , end periode;
|
||||
public function __construct(\Database $p_cn,
|
||||
$orientation,
|
||||
$unit,
|
||||
$format,
|
||||
Acc_Ledger $p_ledger,
|
||||
$p_from,
|
||||
$p_to,
|
||||
$p_filter_operation)
|
||||
{
|
||||
parent::__construct($p_cn, $orientation, $unit, $format);
|
||||
$this->ledger=$p_ledger;
|
||||
$this->from=$p_from;
|
||||
$this->to=$p_to;
|
||||
$this->set_filter_operation($p_filter_operation);
|
||||
}
|
||||
public function get_ledger()
|
||||
{
|
||||
return $this->ledger;
|
||||
}
|
||||
|
||||
public function get_from()
|
||||
{
|
||||
return $this->from;
|
||||
}
|
||||
|
||||
public function get_to()
|
||||
{
|
||||
return $this->to;
|
||||
}
|
||||
|
||||
public function set_ledger($ledger)
|
||||
{
|
||||
$this->ledger=$ledger;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function set_from($from)
|
||||
{
|
||||
$this->from=$from;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function set_to($to)
|
||||
{
|
||||
$this->to=$to;
|
||||
return $this;
|
||||
}
|
||||
function get_filter_operation()
|
||||
{
|
||||
return $this->filter_operation;
|
||||
}
|
||||
/**
|
||||
* Filter the operations ,
|
||||
* @param string $filter_operation : all , paid, unpaid
|
||||
* @return $this
|
||||
* @throws Exception 5 , if filter invalid
|
||||
*/
|
||||
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)
|
||||
* @param type $cn
|
||||
* @param type $p_type_export
|
||||
* @param type $p_format_output CSV or PDF
|
||||
* @param Database $cn
|
||||
* @param char $p_type_export E(xtended) L(isting) A(ccounting) D(etail)
|
||||
* @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, Acc_Ledger $p_ledger,$p_from,$p_to,$p_filter_operation)
|
||||
{
|
||||
/**
|
||||
* @Bug
|
||||
* Strange PHP Bug when autoloader is not used , the require_once doesn't seems to
|
||||
* work properly and does not include the files , except if you put them here
|
||||
*
|
||||
* if you put them on the top of this file, export_ledger_pdf.php will include the files
|
||||
* but not export_ledger_csv.php
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE.'/class/print_ledger_detail.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/print_ledger_simple.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/print_ledger_simple_without_vat.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/print_ledger_fin.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/print_ledger_misc.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/print_ledger_detail_item.class.php';
|
||||
|
||||
/**
|
||||
* For PDF output
|
||||
*/
|
||||
if ($p_format_output == 'PDF') {
|
||||
switch ($p_type_export) {
|
||||
case 'D':
|
||||
$own=new Noalyss_Parameter_Folder($cn);
|
||||
$jrn_type=$p_ledger->get_type();
|
||||
//---------------------------------------------
|
||||
// Detailled Printing (accounting )
|
||||
//---------------------------------------------
|
||||
if ($jrn_type=='ACH'||$jrn_type=='VEN')
|
||||
{
|
||||
if (
|
||||
($jrn_type=='ACH'&&$cn->get_value('select count(qp_id) from quant_purchase')
|
||||
==0)||
|
||||
($jrn_type=='VEN'&&$cn->get_value('select count(qs_id) from quant_sold')
|
||||
==0)
|
||||
)
|
||||
{
|
||||
$pdf=new Print_Ledger_Simple_without_vat($cn,
|
||||
$p_ledger);
|
||||
$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);
|
||||
return $pdf;
|
||||
}
|
||||
if ($own->MY_TVA_USE=='N')
|
||||
{
|
||||
$pdf=new Print_Ledger_Simple_without_vat($cn,
|
||||
$p_ledger);
|
||||
return $pdf;
|
||||
}
|
||||
}
|
||||
elseif ($jrn_type=='FIN')
|
||||
{
|
||||
$pdf=new Print_Ledger_Financial($cn, $p_ledger);
|
||||
return $pdf;
|
||||
} else
|
||||
{
|
||||
return new Print_Ledger_Detail($cn, $p_ledger);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
//----------------------------------------------------------------------
|
||||
// Simple Printing Purchase Ledger
|
||||
//---------------------------------------------------------------------
|
||||
$own=new Noalyss_Parameter_Folder($cn);
|
||||
$jrn_type=$p_ledger->get_type();
|
||||
|
||||
|
||||
if ($jrn_type=='ACH'||$jrn_type=='VEN')
|
||||
{
|
||||
if (
|
||||
($jrn_type=='ACH'&&$cn->get_value('select count(qp_id) from quant_purchase')
|
||||
==0)||
|
||||
($jrn_type=='VEN'&&$cn->get_value('select count(qs_id) from quant_sold')
|
||||
==0)
|
||||
)
|
||||
{
|
||||
$pdf=new Print_Ledger_Simple_without_vat($cn,
|
||||
$p_ledger);
|
||||
$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);
|
||||
return $pdf;
|
||||
}
|
||||
if ($own->MY_TVA_USE=='N')
|
||||
{
|
||||
$pdf=new Print_Ledger_Simple_without_vat($cn,
|
||||
$p_ledger);
|
||||
return $pdf;
|
||||
}
|
||||
}
|
||||
|
||||
if ($jrn_type=='FIN')
|
||||
{
|
||||
$pdf=new Print_Ledger_Financial($cn, $p_ledger);
|
||||
return $pdf;
|
||||
}
|
||||
if ($jrn_type=='ODS'||$p_ledger->id==0)
|
||||
{
|
||||
$pdf=new Print_Ledger_Misc($cn, $p_ledger);
|
||||
return $pdf;
|
||||
}
|
||||
break;
|
||||
case 'E':
|
||||
/**********************************************************
|
||||
* Print Detail Operation + Item
|
||||
* ********************************************************* */
|
||||
$own=new Noalyss_Parameter_Folder($cn);
|
||||
$jrn_type=$p_ledger->get_type();
|
||||
if ($jrn_type=='FIN')
|
||||
{
|
||||
$pdf=new Print_Ledger_Detail($cn, $p_ledger);
|
||||
return $pdf;
|
||||
}
|
||||
if ($jrn_type=='ODS'||$p_ledger->id==0)
|
||||
{
|
||||
$pdf=new Print_Ledger_Detail($cn, $p_ledger);
|
||||
return $pdf;
|
||||
}
|
||||
switch ($p_type_export) {
|
||||
case 'D':
|
||||
$own=new Noalyss_Parameter_Folder($cn);
|
||||
$jrn_type=$p_ledger->get_type();
|
||||
//---------------------------------------------
|
||||
// Detailled Printing (accounting )
|
||||
//---------------------------------------------
|
||||
if ($jrn_type=='ACH'||$jrn_type=='VEN')
|
||||
{
|
||||
if (
|
||||
($jrn_type=='ACH'&&$cn->get_value('select count(qp_id) from quant_purchase')
|
||||
==0)||
|
||||
|
|
@ -162,21 +145,113 @@ class Print_Ledger {
|
|||
==0)
|
||||
)
|
||||
{
|
||||
$pdf=new Print_Ledger_Simple_without_vat($cn, $p_ledger);
|
||||
$pdf->set_error('Ce journal ne peut être imprimé en mode simple');
|
||||
$pdf=new Print_Ledger_Simple_without_vat($cn,
|
||||
$p_ledger,$p_from,$p_to,$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);
|
||||
if ($own->MY_TVA_USE=='Y')
|
||||
{
|
||||
$pdf=new Print_Ledger_Simple($cn, $p_ledger,$p_from,$p_to,$p_filter_operation);
|
||||
return $pdf;
|
||||
}
|
||||
if ($own->MY_TVA_USE=='N')
|
||||
{
|
||||
$pdf=new Print_Ledger_Simple_without_vat($cn,
|
||||
$p_ledger,$p_from,$p_to,$p_filter_operation);
|
||||
return $pdf;
|
||||
}
|
||||
}
|
||||
elseif ($jrn_type=='FIN')
|
||||
{
|
||||
$pdf=new Print_Ledger_Financial($cn, $p_ledger,$p_from,$p_to);
|
||||
return $pdf;
|
||||
case 'A':
|
||||
/***********************************************************
|
||||
* Accounting
|
||||
*/
|
||||
$pdf=new Print_Ledger_Detail($cn, $p_ledger);
|
||||
} else
|
||||
{
|
||||
return new Print_Ledger_Detail($cn, $p_ledger,$p_from,$p_to);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
//----------------------------------------------------------------------
|
||||
// Simple Printing Purchase Ledger
|
||||
//---------------------------------------------------------------------
|
||||
$own=new Noalyss_Parameter_Folder($cn);
|
||||
$jrn_type=$p_ledger->get_type();
|
||||
|
||||
|
||||
if ($jrn_type=='ACH'||$jrn_type=='VEN')
|
||||
{
|
||||
if (
|
||||
($jrn_type=='ACH'&&$cn->get_value('select count(qp_id) from quant_purchase')
|
||||
==0)||
|
||||
($jrn_type=='VEN'&&$cn->get_value('select count(qs_id) from quant_sold')
|
||||
==0)
|
||||
)
|
||||
{
|
||||
$pdf=new Print_Ledger_Simple_without_vat($cn,
|
||||
$p_ledger,$p_from,$p_to,$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,$p_from,$p_to,$p_filter_operation);
|
||||
return $pdf;
|
||||
}
|
||||
if ($own->MY_TVA_USE=='N')
|
||||
{
|
||||
$pdf=new Print_Ledger_Simple_without_vat($cn,
|
||||
$p_ledger,$p_from,$p_to,$p_filter_operation);
|
||||
return $pdf;
|
||||
}
|
||||
}
|
||||
|
||||
if ($jrn_type=='FIN')
|
||||
{
|
||||
$pdf=new Print_Ledger_Financial($cn, $p_ledger,$p_from,$p_to);
|
||||
return $pdf;
|
||||
break;
|
||||
} // end switch
|
||||
} // end $p_format == PDF
|
||||
}
|
||||
$pdf=new Print_Ledger_Misc($cn, $p_ledger,$p_from,$p_to);
|
||||
return $pdf;
|
||||
break;
|
||||
case 'E':
|
||||
/**********************************************************
|
||||
* Print Detail Operation + Item
|
||||
* ********************************************************* */
|
||||
$own=new Noalyss_Parameter_Folder($cn);
|
||||
$jrn_type=$p_ledger->get_type();
|
||||
if ($jrn_type=='FIN')
|
||||
{
|
||||
$pdf=new Print_Ledger_Detail($cn, $p_ledger,$p_from,$p_to);
|
||||
return $pdf;
|
||||
}
|
||||
if ($jrn_type=='ODS'||$p_ledger->id==0)
|
||||
{
|
||||
$pdf=new Print_Ledger_Detail($cn, $p_ledger,$p_from,$p_to);
|
||||
return $pdf;
|
||||
}
|
||||
if (
|
||||
($jrn_type=='ACH'&&$cn->get_value('select count(qp_id) from quant_purchase')
|
||||
==0)||
|
||||
($jrn_type=='VEN'&&$cn->get_value('select count(qs_id) from quant_sold')
|
||||
==0)
|
||||
)
|
||||
{
|
||||
$pdf=new Print_Ledger_Simple_without_vat($cn, $p_ledger,$p_from,$p_to,$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,$p_from,$p_to,$p_filter_operation);
|
||||
return $pdf;
|
||||
case 'A':
|
||||
/***********************************************************
|
||||
* Accounting
|
||||
*/
|
||||
$pdf=new Print_Ledger_Detail($cn, $p_ledger,$p_from,$p_to);
|
||||
return $pdf;
|
||||
break;
|
||||
} // end switch
|
||||
}
|
||||
|
||||
// end function
|
||||
|
|
@ -206,7 +281,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,8 +294,12 @@ 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))
|
||||
order by jrn_def_name
|
||||
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]);
|
||||
}
|
||||
$a=[];
|
||||
|
|
@ -228,7 +310,28 @@ class Print_Ledger {
|
|||
}
|
||||
return $a;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -23,19 +23,16 @@
|
|||
* \brief this class extends PDF and let you export the detailled printing
|
||||
* of any ledgers
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE.'/class/pdf_land.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/print_ledger.class.php';
|
||||
|
||||
class Print_Ledger_Detail extends PDF
|
||||
|
||||
class Print_Ledger_Detail extends Print_Ledger
|
||||
{
|
||||
public function __construct ($p_cn = null, Acc_Ledger $ledger)
|
||||
public function __construct (Database $p_cn , Acc_Ledger $ledger,$p_from,$p_to)
|
||||
{
|
||||
|
||||
if($p_cn == null) die("No database connection. Abort.");
|
||||
parent::__construct($p_cn,'L', 'mm', 'A4',$ledger,$p_from,$p_to,'all');
|
||||
|
||||
parent::__construct($p_cn,'L', 'mm', 'A4');
|
||||
$this->ledger=$ledger;
|
||||
date_default_timezone_set ('Europe/Paris');
|
||||
|
||||
}
|
||||
|
||||
function setDossierInfo($dossier = "n/a")
|
||||
|
|
@ -73,7 +70,7 @@ class Print_Ledger_Detail extends PDF
|
|||
$rap_deb=0;
|
||||
$rap_cred=0;
|
||||
// take all operations from jrn
|
||||
$array=$this->ledger->get_operation($_GET['from_periode'],$_GET['to_periode']);
|
||||
$array=$this->get_ledger()->get_operation($this->get_from(),$this->get_to());
|
||||
|
||||
$this->SetFont('DejaVu','BI',7);
|
||||
$this->write_cell(215,7,'report Débit',0,0,'R');
|
||||
|
|
|
|||
|
|
@ -25,17 +25,14 @@
|
|||
*/
|
||||
require_once NOALYSS_INCLUDE.'/class/acc_ledger_sold.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/acc_ledger_purchase.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/pdf_land.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/print_ledger.class.php';
|
||||
|
||||
class Print_Ledger_Detail_Item extends PDFLand
|
||||
class Print_Ledger_Detail_Item extends Print_Ledger
|
||||
{
|
||||
public function __construct (Database $p_cn,Acc_Ledger $p_jrn)
|
||||
public function __construct (Database $p_cn,Acc_Ledger $p_jrn,$p_from,$p_to,$p_filter_operation)
|
||||
{
|
||||
|
||||
if($p_cn == null) die("No database connection. Abort.");
|
||||
|
||||
parent::__construct($p_cn,'L', 'mm', 'A4');
|
||||
$this->ledger=$p_jrn;
|
||||
parent::__construct($p_cn,'L', 'mm', 'A4',$p_jrn,$p_from,$p_to,$p_filter_operation);
|
||||
$this->show_col=true;
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +73,7 @@ class Print_Ledger_Detail_Item extends PDFLand
|
|||
{
|
||||
$this->Ln(2);
|
||||
$this->SetFont('Arial', 'I', 8);
|
||||
$this->Cell(50,8,' Journal '.$this->ledger->get_name(),0,0,'C');
|
||||
$this->Cell(50,8,' Journal '.$this->get_ledger()->get_name(),0,0,'C');
|
||||
//Arial italic 8
|
||||
//Page number
|
||||
$this->Cell(30,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'L');
|
||||
|
|
@ -91,24 +88,25 @@ class Print_Ledger_Detail_Item extends PDFLand
|
|||
function export()
|
||||
{
|
||||
bcscale(2);
|
||||
$jrn_type=$this->ledger->get_type();
|
||||
$http=new HttpInput();
|
||||
$jrn_type=$this->get_ledger()->get_type();
|
||||
|
||||
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'));
|
||||
$ledger=new Acc_Ledger_Sold($this->cn, $this->get_ledger()->jrn_def_id);
|
||||
$ret_detail=$ledger->get_detail_sale($this->get_from(),$this->get_to(), $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'));
|
||||
$ledger=new Acc_Ledger_Purchase($this->cn, $this->get_ledger()->jrn_def_id);
|
||||
$ret_detail=$ledger->get_detail_purchase($this->get_from(),$this->get_to(),$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=new Prepared_Query($this->cn);
|
||||
$prepared_query->prepare_reconcile_date();
|
||||
|
||||
$nb=Database::num_row($ret_detail);
|
||||
|
|
@ -138,7 +136,7 @@ class Print_Ledger_Detail_Item extends PDFLand
|
|||
$this->line_new(6);
|
||||
// Payment info
|
||||
// Prepare the query for reconcile date
|
||||
$ret_reconcile=$this->ledger->db->execute('reconcile_date', array($row['jr_id']));
|
||||
$ret_reconcile=$this->cn->execute('reconcile_date', array($row['jr_id']));
|
||||
$max=Database::num_row($ret_reconcile);
|
||||
for ($e=0; $e<$max; $e++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,16 +22,16 @@
|
|||
/*!\file
|
||||
* \brief print a listing of financial
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
|
||||
class Print_Ledger_Financial extends PDF
|
||||
require_once NOALYSS_INCLUDE.'/class/print_ledger.class.php';
|
||||
|
||||
class Print_Ledger_Financial extends Print_Ledger
|
||||
{
|
||||
private $rap_amount; /* amount from begining exercice */
|
||||
private $tp_amount; /* amount total page */
|
||||
|
||||
function __construct($p_cn, Acc_Ledger $p_jrn)
|
||||
function __construct(Database $p_cn, Acc_Ledger $p_jrn,$p_from,$p_to)
|
||||
{
|
||||
parent::__construct($p_cn,'P','mm','A4');
|
||||
$this->ledger=$p_jrn;
|
||||
parent::__construct($p_cn,'P','mm','A4',$p_jrn,$p_from,$p_to,'all');
|
||||
$this->jrn_type=$p_jrn->get_type();
|
||||
|
||||
// report from begin exercice
|
||||
|
|
@ -40,7 +40,7 @@ class Print_Ledger_Financial extends PDF
|
|||
// total page
|
||||
$this->tp_amount=0;
|
||||
|
||||
$amount=$this->ledger->previous_amount($_GET['from_periode']);
|
||||
$amount=$this->get_ledger()->previous_amount($this->get_from());
|
||||
$this->rap_amount=$amount['amount'];
|
||||
}
|
||||
function Header()
|
||||
|
|
@ -92,11 +92,13 @@ class Print_Ledger_Financial extends PDF
|
|||
*/
|
||||
function export()
|
||||
{
|
||||
$a_jrn=$this->ledger->get_operation($_GET['from_periode'],
|
||||
$_GET['to_periode']);
|
||||
$ledger=$this->get_ledger();
|
||||
$a_jrn=$ledger->get_operation($this->get_from(),$this->get_to());
|
||||
|
||||
$this->SetFont('DejaVu', '', 6);
|
||||
if ( $a_jrn == null ) return;
|
||||
bcscale(2);
|
||||
|
||||
for ( $i=0;$i<count($a_jrn);$i++)
|
||||
{
|
||||
$row=$a_jrn[$i];
|
||||
|
|
@ -104,7 +106,7 @@ class Print_Ledger_Financial extends PDF
|
|||
$this->write_cell(10,5,$row['date_fmt']);
|
||||
$this->write_cell(15,5,$row['internal']);
|
||||
|
||||
$name=$this->ledger->get_tiers($this->jrn_type,$row['id']);
|
||||
$name=$ledger->get_tiers($this->jrn_type,$row['id']);
|
||||
$this->write_cell(40,5,$name,0,'L');
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -22,14 +22,13 @@
|
|||
/*!\file
|
||||
* \brief print a listing of financial
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
|
||||
class Print_Ledger_Misc extends PDF
|
||||
require_once NOALYSS_INCLUDE.'/class/print_ledger.class.php';
|
||||
|
||||
class Print_Ledger_Misc extends Print_Ledger
|
||||
{
|
||||
function __construct($p_cn,$p_jrn)
|
||||
function __construct(Database $p_cn,$p_jrn,$p_from,$p_to)
|
||||
{
|
||||
parent::__construct($p_cn,'P','mm','A4');
|
||||
$this->ledger=$p_jrn;
|
||||
$this->jrn_type=$p_jrn->get_type();
|
||||
parent::__construct($p_cn,'P','mm','A4',$p_jrn,$p_from,$p_to,"all");
|
||||
}
|
||||
function Header()
|
||||
{
|
||||
|
|
@ -70,10 +69,10 @@ class Print_Ledger_Misc extends PDF
|
|||
*/
|
||||
function export()
|
||||
{
|
||||
$a_jrn=$this->ledger->get_rowSimple($_GET['from_periode'],
|
||||
$_GET['to_periode']);
|
||||
$a_jrn=$this->get_ledger()->get_rowSimple($this->get_from(),$this->get_to());
|
||||
$this->SetFont('DejaVu', '', 6);
|
||||
if ( $a_jrn == null ) return;
|
||||
$ledger=$this->get_ledger();
|
||||
for ( $i=0;$i<count($a_jrn);$i++)
|
||||
{
|
||||
$row=$a_jrn[$i];
|
||||
|
|
@ -82,7 +81,7 @@ class Print_Ledger_Misc extends PDF
|
|||
$this->LongLine(30,5,$row['jr_pj_number']);
|
||||
$this->write_cell(20,5,$row['jr_internal']);
|
||||
$type=$this->cn->get_value("select jrn_def_type from jrn_def where jrn_def_id=$1",array($a_jrn[$i]['jr_def_id']));
|
||||
$other=mb_substr($this->ledger->get_tiers($type,$a_jrn[$i]['jr_id']),0,25);
|
||||
$other=mb_substr($ledger->get_tiers($type,$a_jrn[$i]['jr_id']),0,25);
|
||||
$this->LongLine(25,5,$other,0,'L');
|
||||
$positive=$row['montant'];
|
||||
$this->LongLine(80,5,$row['comment'],0,'L');
|
||||
|
|
|
|||
|
|
@ -23,20 +23,17 @@
|
|||
* \brief this class extends PDF and let you export the detailled printing
|
||||
* of any ledgers
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/print_ledger.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
|
||||
|
||||
class Print_Ledger_Simple extends PDF
|
||||
class Print_Ledger_Simple extends \Print_Ledger
|
||||
{
|
||||
public function __construct ($p_cn, Acc_Ledger $p_jrn)
|
||||
public function __construct ($p_cn, Acc_Ledger $p_jrn,$p_from,$p_to,$p_filter_operation)
|
||||
{
|
||||
|
||||
$http=new HttpInput();
|
||||
if($p_cn == null) die("No database connection. Abort.");
|
||||
|
||||
parent::__construct($p_cn,'L', 'mm', 'A4');
|
||||
$this->ledger=$p_jrn;
|
||||
$this->a_Tva=$this->ledger->existing_vat();
|
||||
parent::__construct($p_cn,'L', 'mm', 'A4',$p_jrn,$p_from,$p_to,$p_filter_operation);
|
||||
|
||||
$this->a_Tva=$this->get_ledger()->existing_vat();
|
||||
foreach($this->a_Tva as $line_tva)
|
||||
{
|
||||
//initialize Amount TVA
|
||||
|
|
@ -50,8 +47,8 @@ class Print_Ledger_Simple extends PDF
|
|||
* get rappel to initialize amount rap_xx
|
||||
*the easiest way is to compute sum from quant_
|
||||
*/
|
||||
$from_periode=$http->get('from_periode',"number");
|
||||
$this->previous=$this->ledger->previous_amount($from_periode);
|
||||
$from_periode=$this->get_from();
|
||||
$this->previous=$this->get_ledger()->previous_amount($from_periode);
|
||||
|
||||
/* initialize the amount to report */
|
||||
foreach($this->previous['tva'] as $line_tva)
|
||||
|
|
@ -123,7 +120,10 @@ class Print_Ledger_Simple extends PDF
|
|||
|
||||
$this->SetFont('DejaVu','',6);
|
||||
// page Header
|
||||
$this->Cell(143,6,'report',0,0,'R');
|
||||
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 +157,12 @@ class Print_Ledger_Simple extends PDF
|
|||
//Position at 3 cm from bottom
|
||||
$this->SetY(-20);
|
||||
/* write reporting */
|
||||
$this->Cell(143,6,'Total page ','T',0,'R'); /* HTVA */
|
||||
$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 +178,13 @@ class Print_Ledger_Simple extends PDF
|
|||
|
||||
$this->Cell(15,6,nbm($this->tp_tvac),'T',0,'R'); /* Tvac */
|
||||
$this->Ln(2);
|
||||
|
||||
$this->Cell(143,6,'report',0,0,'R'); /* HTVA */
|
||||
$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(15,6,nbm($this->rap_htva),0,0,'R'); /* HTVA */
|
||||
if ( $this->jrn_type !='VEN')
|
||||
{
|
||||
|
|
@ -205,16 +215,24 @@ class Print_Ledger_Simple extends PDF
|
|||
*/
|
||||
function export()
|
||||
{
|
||||
bcscale(2);
|
||||
$http=new HttpInput();
|
||||
bcscale(4);
|
||||
$ledger=$this->get_ledger();
|
||||
$ledger_history=Acc_Ledger_History::factory($this->cn,
|
||||
array($ledger->id),
|
||||
$this->get_from(),
|
||||
$this->get_to(),
|
||||
'D',
|
||||
$this->get_filter_operation());
|
||||
$ledger_history->get_row();
|
||||
$a_jrn=$ledger_history->get_data();
|
||||
|
||||
$a_jrn=$this->ledger->get_operation($http->get('from_periode',"number"),
|
||||
$http->get('to_periode',"number"));
|
||||
|
||||
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=new Prepared_Query($ledger->db);
|
||||
$prepared_query->prepare_reconcile_date();
|
||||
|
||||
for ( $i=0;$i<count($a_jrn);$i++)
|
||||
|
|
@ -227,7 +245,7 @@ class Print_Ledger_Simple extends PDF
|
|||
}
|
||||
|
||||
// retrieve info from ledger
|
||||
$aAmountVat=$this->ledger->vat_operation($a_jrn[$i]['jr_grpt_id']);
|
||||
$aAmountVat=$ledger->vat_operation($a_jrn[$i]['jr_grpt_id']);
|
||||
|
||||
// put vat into array
|
||||
for ($f=0;$f<count($aAmountVat);$f++)
|
||||
|
|
@ -239,22 +257,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=$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']);
|
||||
$other=$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 +290,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);
|
||||
|
|
|
|||
|
|
@ -23,17 +23,15 @@
|
|||
* \brief this class extends PDF and let you export the detailled printing
|
||||
* of any ledgers
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/print_ledger.class.php';
|
||||
|
||||
class Print_Ledger_Simple_Without_Vat extends PDF
|
||||
class Print_Ledger_Simple_Without_Vat extends Print_Ledger
|
||||
{
|
||||
public function __construct ($p_cn,$p_jrn)
|
||||
public function __construct ($p_cn,$p_jrn,$p_from,$p_to,$p_filter_operation)
|
||||
{
|
||||
|
||||
if($p_cn == null) die("No database connection. Abort.");
|
||||
|
||||
parent::__construct($p_cn,'L', 'mm', 'A4');
|
||||
$this->ledger=$p_jrn;
|
||||
parent::__construct($p_cn,'L', 'mm', 'A4',$p_jrn,$p_from,$p_to,$p_filter_operation);
|
||||
$this->jrn_type=$p_jrn->get_type();
|
||||
//----------------------------------------------------------------------
|
||||
/* report
|
||||
|
|
@ -41,14 +39,13 @@ class Print_Ledger_Simple_Without_Vat extends PDF
|
|||
* get rappel to initialize amount rap_xx
|
||||
*the easiest way is to compute sum from quant_
|
||||
*/
|
||||
$this->previous=$this->ledger->previous_amount($_GET['from_periode']);
|
||||
$this->previous=$this->get_ledger()->previous_amount($p_from);
|
||||
|
||||
|
||||
$this->rap_htva=$this->previous['price'];
|
||||
$this->rap_tvac=$this->previous['price'];
|
||||
$this->rap_priv=$this->previous['priv'];
|
||||
|
||||
|
||||
}
|
||||
|
||||
function setDossierInfo($dossier = "n/a")
|
||||
|
|
@ -141,43 +138,53 @@ 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'));
|
||||
|
||||
if ( $a_jrn == null ) return;
|
||||
|
||||
$ledger_history=Acc_Ledger_History::factory($this->cn,
|
||||
array($this->get_ledger()->id),
|
||||
$this->get_from(),
|
||||
$this->get_to(),
|
||||
'D',
|
||||
$this->get_filter_operation());
|
||||
|
||||
$ledger_history->get_row();
|
||||
$a_jrn=$ledger_history->get_data();
|
||||
|
||||
if ( empty($a_jrn ) ) return;
|
||||
|
||||
// Prepare the query for reconcile date
|
||||
$prepared_query=new Prepared_Query($this->cn);
|
||||
$prepared_query->prepare_reconcile_date();
|
||||
|
||||
$ledger=$this->get_ledger();
|
||||
|
||||
for ( $i=0;$i<count($a_jrn);$i++)
|
||||
{
|
||||
|
||||
$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']);
|
||||
$other=$ledger->get_other_amount($a_jrn[$i]['jr_grpt_id']);
|
||||
$this->tp_htva+=$other['price'];
|
||||
$this->tp_priv+=$other['priv'];
|
||||
$this->rap_htva+=$other['price'];
|
||||
$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');
|
||||
}
|
||||
|
||||
$this->write_cell(15,5,sprintf("%.2f",$other['price']),0,0,'R');
|
||||
$ret_reconcile=$this->cn->execute('reconcile_date',array($row['id']));
|
||||
$ret_reconcile=$this->cn->execute('reconcile_date',array($row['jr_id']));
|
||||
$max=Database::num_row($ret_reconcile);
|
||||
$str_payment="";
|
||||
if ($max > 0) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
|
|
@ -16,7 +17,7 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with NOALYSS; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
*/
|
||||
|
||||
// Copyright Author Dany De Bontridder danydb@noalyss.eu
|
||||
|
||||
|
|
@ -27,16 +28,31 @@
|
|||
*/
|
||||
class Tax_Summary
|
||||
{
|
||||
|
||||
private $date_start;
|
||||
private $date_end;
|
||||
private $db;
|
||||
private $tva_type; ///< exigibility of VAT : operation , payment date or depending of setting in tva_rate
|
||||
|
||||
function __construct(Database $db,$p_start, $p_end)
|
||||
function __construct(Database $db, $p_start, $p_end)
|
||||
{
|
||||
$this->db=$db;
|
||||
$this->set_date_start($p_start);
|
||||
$this->set_date_end($p_end);
|
||||
|
||||
// By default the TVA is computed by parameter in tva_rate.tva_payment_purchase or tva_rate.tva_payment_sale
|
||||
$this->set_tva_type("T");
|
||||
}
|
||||
|
||||
public function get_tva_type()
|
||||
{
|
||||
return $this->tva_type;
|
||||
}
|
||||
|
||||
public function set_tva_type($tva_type)
|
||||
{
|
||||
$this->tva_type=$tva_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -53,7 +69,7 @@ class Tax_Summary
|
|||
*/
|
||||
public function set_db($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->db=$db;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
@ -71,8 +87,9 @@ class Tax_Summary
|
|||
*/
|
||||
public function set_date_start($date_start)
|
||||
{
|
||||
if (isDate($date_start) == NULL) throw Exception(_("Format date invalide") . $date_start);
|
||||
$this->date_start = $date_start;
|
||||
if (isDate($date_start)==NULL)
|
||||
throw Exception(_("Format date invalide").$date_start);
|
||||
$this->date_start=$date_start;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
@ -90,8 +107,9 @@ class Tax_Summary
|
|||
*/
|
||||
public function set_date_end($date_end)
|
||||
{
|
||||
if (isDate($date_end) == NULL) throw Exception(_("Format date invalide") . $date_end);
|
||||
$this->date_end = $date_end;
|
||||
if (isDate($date_end)==NULL)
|
||||
throw Exception(_("Format date invalide").$date_end);
|
||||
$this->date_end=$date_end;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
@ -101,7 +119,7 @@ class Tax_Summary
|
|||
*/
|
||||
function check()
|
||||
{
|
||||
/*-------------SALE ---------------------------------*/
|
||||
/* -------------SALE --------------------------------- */
|
||||
$sql="select count(*)
|
||||
from
|
||||
quant_sold
|
||||
|
|
@ -113,11 +131,12 @@ class Tax_Summary
|
|||
and j_date <= to_date($2,'DD.MM.YYYY')
|
||||
)
|
||||
";
|
||||
$cnt=$this->db->get_value($sql,[$this->date_start,$this->date_end]);
|
||||
if ($cnt == 0) {
|
||||
throw new Exception(_("Données manquantes"),100);
|
||||
$cnt=$this->db->get_value($sql, [$this->date_start, $this->date_end]);
|
||||
if ($cnt==0)
|
||||
{
|
||||
throw new Exception(_("Données manquantes"), 100);
|
||||
}
|
||||
/*-------------Purchase ---------------------------------*/
|
||||
/* -------------Purchase --------------------------------- */
|
||||
$sql="select count(*)
|
||||
from
|
||||
quant_purchase
|
||||
|
|
@ -129,65 +148,33 @@ class Tax_Summary
|
|||
and j_date <= to_date($2,'DD.MM.YYYY')
|
||||
)
|
||||
";
|
||||
$cnt=$this->db->get_value($sql,[$this->date_start,$this->date_end]);
|
||||
if ($cnt > 0) {
|
||||
throw new Exception(_("Données manquantes"),100);
|
||||
$cnt=$this->db->get_value($sql, [$this->date_start, $this->date_end]);
|
||||
if ($cnt>0)
|
||||
{
|
||||
throw new Exception(_("Données manquantes"), 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Total for each sales ledger
|
||||
* @return array
|
||||
*/
|
||||
function get_row_sale()
|
||||
private function build_exigibility()
|
||||
{
|
||||
global $g_user;
|
||||
$sql_ledger=$g_user->get_ledger_sql('ALL',3);
|
||||
$sql="with detail_tva as (
|
||||
select
|
||||
sum(qs_vat) as amount_vat,
|
||||
sum(qs_vat_sided) as amount_sided,
|
||||
sum(qs_price) as amount_wovat,
|
||||
qs_vat_code,
|
||||
j_jrn_def
|
||||
from
|
||||
quant_sold
|
||||
join tva_rate on (qs_vat_code=tva_rate.tva_id)
|
||||
join jrnx on (quant_sold.j_id=jrnx.j_id)
|
||||
join jrn_def on (jrn_def.jrn_def_id=jrnx.j_jrn_def)
|
||||
where
|
||||
j_date >= to_date($1,'DD.MM.YYYY')
|
||||
and j_date <= to_date($2,'DD.MM.YYYY')
|
||||
and {$sql_ledger}
|
||||
group by j_jrn_def,qs_vat_code)
|
||||
select jrn_def_name,
|
||||
tva_label ,
|
||||
qs_vat_code,
|
||||
tva_rate,
|
||||
tva_both_side,
|
||||
amount_vat,
|
||||
amount_wovat,
|
||||
amount_sided
|
||||
from
|
||||
detail_tva
|
||||
join tva_rate on (tva_rate.tva_id=qs_vat_code)
|
||||
join jrn_def on (jrn_def.jrn_def_id=j_jrn_def)
|
||||
|
||||
order by jrn_def_name,tva_label";
|
||||
$array=$this->db->get_array($sql,[$this->date_start,$this->date_end]);
|
||||
return $array;
|
||||
|
||||
$sql_ledger=$g_user->get_ledger_sql('ALL', 3);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Total for each purchase ledger
|
||||
* @return array
|
||||
* Build the SQL for sale vat
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
function get_row_purchase()
|
||||
private function build_sql_purchase($p_group_ledger)
|
||||
{
|
||||
global $g_user;
|
||||
$sql_ledger=$g_user->get_ledger_sql('ALL',3);
|
||||
$sql_ledger=$g_user->get_ledger_sql('ACH', 3);
|
||||
$group_ledger="";
|
||||
if ( $p_group_ledger )
|
||||
{
|
||||
$group_ledger='j_jrn_def,';
|
||||
}
|
||||
|
||||
$sql="with detail_tva as (
|
||||
select
|
||||
sum(qp_vat) as amount_vat,
|
||||
|
|
@ -197,18 +184,163 @@ class Tax_Summary
|
|||
sum(qp_nd_tva) as amount_noded_tax,
|
||||
sum(qp_nd_tva_recup) as amount_noded_return,
|
||||
sum(qp_dep_priv) as amount_private,
|
||||
qp_vat_code,
|
||||
j_jrn_def
|
||||
{$group_ledger}
|
||||
qp_vat_code
|
||||
from
|
||||
quant_purchase
|
||||
join tva_rate on (qp_vat_code=tva_rate.tva_id)
|
||||
join jrnx on (quant_purchase.j_id=jrnx.j_id)
|
||||
join jrn_def on (jrn_def.jrn_def_id=jrnx.j_jrn_def)
|
||||
join jrn on (jrn.jr_grpt_id=jrnx.j_grpt)
|
||||
";
|
||||
if ( $this->tva_type=="O")
|
||||
{
|
||||
$sql=$sql."
|
||||
where
|
||||
j_date >= to_date($1,'DD.MM.YYYY')
|
||||
and j_date <= to_date($2,'DD.MM.YYYY')
|
||||
and {$sql_ledger}
|
||||
group by j_jrn_def,qp_vat_code)
|
||||
group by {$group_ledger} qp_vat_code) ";
|
||||
} elseif ($this->tva_type=="P") {
|
||||
$sql=$sql."
|
||||
where
|
||||
coalesce(to_char(jr_date_paid,'YYYYMMDD'),'00000000') >=
|
||||
to_char(to_date($1,'DD.MM.YYYY'),'YYYYMMDD')
|
||||
and coalesce(to_char(jr_date_paid,'YYYYMMDD'),'99999999') <=
|
||||
to_char(to_date($2,'DD.MM.YYYY'),'YYYYMMDD')
|
||||
and {$sql_ledger}
|
||||
group by {$group_ledger} qp_vat_code) ";
|
||||
}elseif ($this->tva_type=="T") {
|
||||
$sql=$sql." where
|
||||
( tva_rate.tva_payment_purchase='P'
|
||||
and coalesce(to_char(jr_date_paid,'YYYYMMDD'),'00000000') >=
|
||||
to_char(to_date($1,'DD.MM.YYYY'),'YYYYMMDD')
|
||||
and coalesce(to_char(jr_date_paid,'YYYYMMDD'),'99999999') <=
|
||||
to_char(to_date($2,'DD.MM.YYYY'),'YYYYMMDD')
|
||||
)
|
||||
or
|
||||
( tva_rate.tva_payment_purchase='O'
|
||||
and coalesce(to_char(jr_date,'YYYYMMDD'),'00000000') >=
|
||||
to_char(to_date($1,'DD.MM.YYYY'),'YYYYMMDD')
|
||||
and coalesce(to_char(jr_date,'YYYYMMDD'),'99999999') <=
|
||||
to_char(to_date($2,'DD.MM.YYYY'),'YYYYMMDD')
|
||||
)
|
||||
and {$sql_ledger}
|
||||
group by {$group_ledger} qp_vat_code) ";
|
||||
|
||||
} else {
|
||||
throw new Exception(_("Exig TVA invalide"),1001);
|
||||
}
|
||||
return $sql;
|
||||
}
|
||||
/**
|
||||
* Build the SQL for sale vat
|
||||
*
|
||||
* @param group by ledger
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
private function build_sql_sale($p_group_ledger=TRUE)
|
||||
{
|
||||
global $g_user;
|
||||
$sql_ledger=$g_user->get_ledger_sql('VEN', 3);
|
||||
$group_ledger="";
|
||||
if ( $p_group_ledger )
|
||||
{
|
||||
$group_ledger='j_jrn_def,';
|
||||
}
|
||||
$sql="with detail_tva as (
|
||||
select
|
||||
sum(qs_vat) as amount_vat,
|
||||
sum(qs_vat_sided) as amount_sided,
|
||||
sum(qs_price) as amount_wovat,
|
||||
{$group_ledger}
|
||||
qs_vat_code
|
||||
from
|
||||
quant_sold
|
||||
join tva_rate on (qs_vat_code=tva_rate.tva_id)
|
||||
join jrnx on (quant_sold.j_id=jrnx.j_id)
|
||||
join jrn_def on (jrn_def.jrn_def_id=jrnx.j_jrn_def)
|
||||
join jrn on (jrn.jr_grpt_id=jrnx.j_grpt)";
|
||||
if ( $this->tva_type=="O")
|
||||
{
|
||||
$sql=$sql."
|
||||
where
|
||||
j_date >= to_date($1,'DD.MM.YYYY')
|
||||
and j_date <= to_date($2,'DD.MM.YYYY')
|
||||
and {$sql_ledger}
|
||||
group by {$group_ledger} qs_vat_code) ";
|
||||
|
||||
} elseif ($this->tva_type=="P") {
|
||||
$sql=$sql."
|
||||
where
|
||||
coalesce(to_char(jr_date_paid,'YYYYMMDD'),'00000000') >=
|
||||
to_char(to_date($1,'DD.MM.YYYY'),'YYYYMMDD')
|
||||
and coalesce(to_char(jr_date_paid,'YYYYMMDD'),'99999999') <=
|
||||
to_char(to_date($2,'DD.MM.YYYY'),'YYYYMMDD')
|
||||
and {$sql_ledger}
|
||||
group by {$group_ledger} qs_vat_code) ";
|
||||
|
||||
} elseif ($this->tva_type=="T") {
|
||||
$sql=$sql."
|
||||
where
|
||||
( tva_rate.tva_payment_sale='P'
|
||||
and coalesce(to_char(jr_date_paid,'YYYYMMDD'),'00000000') >=
|
||||
to_char(to_date($1,'DD.MM.YYYY'),'YYYYMMDD')
|
||||
and coalesce(to_char(jr_date_paid,'YYYYMMDD'),'99999999') <=
|
||||
to_char(to_date($2,'DD.MM.YYYY'),'YYYYMMDD')
|
||||
)
|
||||
or
|
||||
( tva_rate.tva_payment_sale='O'
|
||||
and coalesce(to_char(jr_date,'YYYYMMDD'),'00000000') >=
|
||||
to_char(to_date($1,'DD.MM.YYYY'),'YYYYMMDD')
|
||||
and coalesce(to_char(jr_date,'YYYYMMDD'),'99999999') <=
|
||||
to_char(to_date($2,'DD.MM.YYYY'),'YYYYMMDD')
|
||||
)
|
||||
and {$sql_ledger}
|
||||
group by {$group_ledger} qs_vat_code)
|
||||
";
|
||||
}
|
||||
else {
|
||||
throw new Exception(_("Exig TVA invalide"),1001);
|
||||
}
|
||||
return $sql;
|
||||
}
|
||||
/**
|
||||
* Total for each sales ledger
|
||||
* @return array
|
||||
*/
|
||||
function get_row_sale()
|
||||
{
|
||||
$sql=$this->build_sql_sale(TRUE);
|
||||
$sql.="
|
||||
select jrn_def_name,
|
||||
tva_label ,
|
||||
qs_vat_code,
|
||||
tva_rate,
|
||||
tva_both_side,
|
||||
amount_vat,
|
||||
amount_wovat,
|
||||
amount_sided,
|
||||
tva_payment_sale as tva_type
|
||||
from
|
||||
detail_tva
|
||||
join tva_rate on (tva_rate.tva_id=qs_vat_code)
|
||||
join jrn_def on (jrn_def.jrn_def_id=j_jrn_def)
|
||||
order by jrn_def_name,tva_label";
|
||||
|
||||
$array=$this->db->get_array($sql, [$this->date_start, $this->date_end]);
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total for each purchase ledger
|
||||
* @return array
|
||||
*/
|
||||
function get_row_purchase()
|
||||
{
|
||||
$sql=$this->build_sql_purchase(TRUE)."
|
||||
select jrn_def_name,
|
||||
tva_label ,
|
||||
tva_rate,
|
||||
|
|
@ -226,7 +358,7 @@ class Tax_Summary
|
|||
join tva_rate on (tva_rate.tva_id=qp_vat_code)
|
||||
join jrn_def on (jrn_def.jrn_def_id=j_jrn_def)
|
||||
order by jrn_def_name,tva_label";
|
||||
$array=$this->db->get_array($sql,[$this->date_start,$this->date_end]);
|
||||
$array=$this->db->get_array($sql, [$this->date_start, $this->date_end]);
|
||||
return $array;
|
||||
}
|
||||
|
||||
|
|
@ -235,66 +367,31 @@ class Tax_Summary
|
|||
*/
|
||||
function get_summary_sale()
|
||||
{
|
||||
global $g_user;
|
||||
$sql_ledger=$g_user->get_ledger_sql('ALL',3);
|
||||
$sql="with detail_tva as (
|
||||
select
|
||||
sum(qs_vat) as amount_vat,
|
||||
sum(qs_vat_sided) as amount_sided,
|
||||
sum(qs_price) as amount_wovat,
|
||||
qs_vat_code
|
||||
from
|
||||
quant_sold
|
||||
join tva_rate on (qs_vat_code=tva_rate.tva_id)
|
||||
join jrnx on (quant_sold.j_id=jrnx.j_id)
|
||||
join jrn_def on (jrn_def.jrn_def_id=jrnx.j_jrn_def)
|
||||
where
|
||||
j_date >= to_date($1,'DD.MM.YYYY')
|
||||
and j_date <= to_date($2,'DD.MM.YYYY')
|
||||
and {$sql_ledger}
|
||||
group by qs_vat_code)
|
||||
select
|
||||
tva_label ,
|
||||
qs_vat_code,
|
||||
tva_rate,
|
||||
$sql=$this->build_sql_sale(FALSE);
|
||||
$sql.="select
|
||||
tva_label ,
|
||||
qs_vat_code,
|
||||
tva_rate,
|
||||
tva_both_side,
|
||||
amount_vat,
|
||||
amount_wovat,
|
||||
amount_sided
|
||||
from
|
||||
detail_tva
|
||||
join tva_rate on (tva_rate.tva_id=qs_vat_code)
|
||||
amount_vat,
|
||||
amount_wovat,
|
||||
amount_sided,
|
||||
tva_rate.tva_payment_sale
|
||||
from
|
||||
detail_tva
|
||||
join tva_rate on (tva_rate.tva_id=qs_vat_code)
|
||||
order by tva_label";
|
||||
$array=$this->db->get_array($sql,[$this->date_start,$this->date_end]);
|
||||
$array=$this->db->get_array($sql, [$this->date_start, $this->date_end]);
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Summary for all purchase ledger
|
||||
*/
|
||||
function get_summary_purchase()
|
||||
{
|
||||
global $g_user;
|
||||
$sql_ledger=$g_user->get_ledger_sql('ALL',3);
|
||||
$sql="with detail_tva as (
|
||||
select
|
||||
sum(qp_vat) as amount_vat,
|
||||
sum(qp_vat_sided) as amount_sided,
|
||||
sum(qp_price) as amount_wovat,
|
||||
sum(qp_nd_amount) as amount_noded_amount,
|
||||
sum(qp_nd_tva) as amount_noded_tax,
|
||||
sum(qp_nd_tva_recup) as amount_noded_return,
|
||||
sum(qp_dep_priv) as amount_private,
|
||||
qp_vat_code
|
||||
from
|
||||
quant_purchase
|
||||
join tva_rate on (qp_vat_code=tva_rate.tva_id)
|
||||
join jrnx on (quant_purchase.j_id=jrnx.j_id)
|
||||
join jrn_def on (jrn_def.jrn_def_id=jrnx.j_jrn_def)
|
||||
where
|
||||
j_date >= to_date($1,'DD.MM.YYYY')
|
||||
and j_date <= to_date($2,'DD.MM.YYYY')
|
||||
and {$sql_ledger}
|
||||
group by qp_vat_code)
|
||||
|
||||
$sql=$this->build_sql_purchase(FALSE)."
|
||||
select
|
||||
tva_label ,
|
||||
tva_rate,
|
||||
|
|
@ -311,10 +408,11 @@ class Tax_Summary
|
|||
detail_tva
|
||||
join tva_rate on (tva_rate.tva_id=qp_vat_code)
|
||||
order by tva_label";
|
||||
$array=$this->db->get_array($sql,[$this->date_start,$this->date_end]);
|
||||
$array=$this->db->get_array($sql, [$this->date_start, $this->date_end]);
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief display the summary of VAT in the range of date
|
||||
*/
|
||||
|
|
@ -322,6 +420,7 @@ class Tax_Summary
|
|||
{
|
||||
require_once NOALYSS_INCLUDE."/template/tax_summary_display.php";
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief display a form to export in CSV
|
||||
* @see export_printtva_csv.php
|
||||
|
|
@ -330,11 +429,12 @@ class Tax_Summary
|
|||
{
|
||||
echo '<form method="GET" action="export.php">';
|
||||
echo Dossier::hidden();
|
||||
echo HtmlInput::hidden("act",'CSV:printtva');
|
||||
echo HtmlInput::hidden("date_start",$this->date_start);
|
||||
echo HtmlInput::hidden("date_end",$this->date_end);
|
||||
echo HtmlInput::hidden("act", 'CSV:printtva');
|
||||
echo HtmlInput::hidden("date_start", $this->date_start);
|
||||
echo HtmlInput::hidden("date_end", $this->date_end);
|
||||
echo HtmlInput::hidden("tva_type", $this->tva_type);
|
||||
|
||||
echo HtmlInput::submit("CSV:printtva",_("Export CSV"));
|
||||
echo HtmlInput::submit("CSV:printtva", _("Export CSV"));
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
|
|
@ -346,13 +446,12 @@ class Tax_Summary
|
|||
{
|
||||
echo '<form method="GET" action="export.php">';
|
||||
echo Dossier::hidden();
|
||||
echo HtmlInput::hidden("act",'PDF:printtva');
|
||||
echo HtmlInput::hidden("date_start",$this->date_start);
|
||||
echo HtmlInput::hidden("date_end",$this->date_end);
|
||||
|
||||
echo HtmlInput::submit("PDF:printtva",_("Export PDF"));
|
||||
echo HtmlInput::hidden("act", 'PDF:printtva');
|
||||
echo HtmlInput::hidden("date_start", $this->date_start);
|
||||
echo HtmlInput::hidden("date_end", $this->date_end);
|
||||
echo HtmlInput::hidden("tva_type", $this->tva_type);
|
||||
echo HtmlInput::submit("PDF:printtva", _("Export PDF"));
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,22 @@ class Tva_Rate_MTable extends Manage_Table_SQL
|
|||
["value"=>1, "label"=>_("Autoliquidation")]
|
||||
));
|
||||
$this->set_property_updatable("tva_id", FALSE);
|
||||
$this->a_info=["tva_purchase"=>44,"tva_both_side"=>43,"tva_sale"=>45];
|
||||
$this->set_col_label("tva_payment_purchase",_("Exigible achat"));
|
||||
$this->set_col_type("tva_payment_purchase","select",
|
||||
array(
|
||||
array("value"=>'O',"label"=>"Opération"),
|
||||
array("value"=>'P',"label"=>"Paiement")
|
||||
)
|
||||
);
|
||||
$this->set_col_label("tva_payment_sale",_("Exigible vente"));
|
||||
$this->set_col_type("tva_payment_sale","select",
|
||||
array(
|
||||
array("value"=>'O',"label"=>"Opération"),
|
||||
array("value"=>'P',"label"=>"Paiement")
|
||||
)
|
||||
);
|
||||
$this->a_info=["tva_purchase"=>44,"tva_both_side"=>43,"tva_sale"=>45
|
||||
,"tva_payment_sale"=>74,"tva_payment_purchase"=>74];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -183,6 +198,8 @@ class Tva_Rate_MTable extends Manage_Table_SQL
|
|||
$tva_purchase=(trim($this->table->tva_purchase)=="")?"#":$this->table->tva_purchase;
|
||||
$tva_sale=(trim($this->table->tva_sale)=="")?"#":$this->table->tva_sale;
|
||||
$tva_rate->setp("tva_poste", $tva_purchase.",".$tva_sale);
|
||||
$tva_rate->setp("tva_payment_sale", $this->table->tva_payment_sale);
|
||||
$tva_rate->setp("tva_payment_purchase", $this->table->tva_payment_purchase);
|
||||
$tva_rate->save();
|
||||
|
||||
// reload the row
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) {
|
|||
if ( ! defined ("SYSINFO_DISPLAY")) {
|
||||
define ("SYSINFO_DISPLAY",TRUE);
|
||||
}
|
||||
define ("DBVERSION",138);
|
||||
define ("DBVERSION",141);
|
||||
define ("MONO_DATABASE",25);
|
||||
define ("DBVERSIONREPO",18);
|
||||
define ('NOTFOUND','--not found--');
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ class Tva_rate_SQL extends Noalyss_SQL
|
|||
, "tva_comment"=>"tva_comment"
|
||||
, "tva_poste"=>"tva_poste"
|
||||
, "tva_both_side"=>"tva_both_side"
|
||||
,"tva_payment_purchase"=>"tva_payment_purchase"
|
||||
,"tva_payment_sale"=>"tva_payment_sale"
|
||||
);
|
||||
/*
|
||||
* Type of columns
|
||||
|
|
@ -56,6 +58,9 @@ class Tva_rate_SQL extends Noalyss_SQL
|
|||
, "tva_comment"=>"text"
|
||||
, "tva_poste"=>"text"
|
||||
, "tva_both_side"=>"numeric"
|
||||
,"tva_payment_purchase"=>"text"
|
||||
,"tva_payment_sale"=>"text"
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class User_filter_SQL extends Noalyss_SQL
|
|||
, "date_paid_end"=>"date_paid_end"
|
||||
, "ledger_type"=>"ledger_type"
|
||||
, "all_ledger"=>"all_ledger"
|
||||
,"unpaid"=>"unpaid"
|
||||
,"operation_filter"=>"operation_filter"
|
||||
,'filter_name'=>"filter_name"
|
||||
);
|
||||
/*
|
||||
|
|
@ -76,7 +76,7 @@ class User_filter_SQL extends Noalyss_SQL
|
|||
, "date_paid_end"=>"text"
|
||||
, "ledger_type"=>"text"
|
||||
, "all_ledger"=>"numeric"
|
||||
,"unpaid"=>"text"
|
||||
,"operation_filter"=>"text"
|
||||
,"filter_name"=>"text"
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,9 @@ class V_Tva_Rate_SQL extends Noalyss_SQL
|
|||
, "tva_purchase"=>"tva_purchase"
|
||||
, "tva_sale"=>"tva_sale"
|
||||
, "tva_both_side"=>"tva_both_side"
|
||||
,'tva_payment_purchase'=>'tva_payment_purchase'
|
||||
,'tva_payment_sale'=>'tva_payment_sale'
|
||||
|
||||
);
|
||||
/*
|
||||
* Type of columns
|
||||
|
|
@ -58,6 +61,8 @@ class V_Tva_Rate_SQL extends Noalyss_SQL
|
|||
, "tva_purchase"=>"text"
|
||||
, "tva_sale"=>"text"
|
||||
, "tva_both_side"=>"numeric"
|
||||
, 'tva_payment_purchase'=>'text'
|
||||
, 'tva_payment_sale'=>'text'
|
||||
);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,19 +28,22 @@
|
|||
*/
|
||||
if (!defined('ALLOWED'))
|
||||
die('Appel direct ne sont pas permis');
|
||||
|
||||
include_once NOALYSS_INCLUDE."/lib/ac_common.php";
|
||||
require_once NOALYSS_INCLUDE.'/class/noalyss_parameter_folder.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/acc_ledger_sold.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/acc_ledger_purchase.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/print_ledger.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
|
||||
$gDossier=dossier::id();
|
||||
|
||||
|
||||
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/database.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/noalyss_csv.class.php';
|
||||
|
||||
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
|
||||
|
||||
|
||||
$gDossier=dossier::id();
|
||||
$http=new HttpInput();
|
||||
|
||||
$export=new Noalyss_Csv(_('journal'));
|
||||
|
|
@ -57,6 +60,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)
|
||||
{
|
||||
|
|
@ -86,12 +90,13 @@ if ($get_jrn==0)
|
|||
{
|
||||
// find out all the available ledgers for the current user
|
||||
$a_jrn=Print_Ledger::available_ledger($get_from_periode);
|
||||
$Jrn=new Acc_Ledger($cn,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$a_jrn=$get_jrn;
|
||||
$Jrn=new Acc_Ledger($cn, $get_jrn);
|
||||
}
|
||||
$Jrn=new Acc_Ledger($cn, $get_jrn);
|
||||
|
||||
$Jrn->get_name();
|
||||
$jrn_type=$Jrn->get_type();
|
||||
|
|
@ -119,14 +124,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 +204,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 +304,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 +316,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,9 @@ try
|
|||
{
|
||||
$jrn_id=$http->get('jrn_id',"number");
|
||||
$p_simple=$http->get('p_simple',"string");
|
||||
|
||||
$filter_operation=$http->get("operation_type");
|
||||
$from=$http->get("from_periode","number");
|
||||
$to=$http->get("to_periode","number");
|
||||
|
||||
}
|
||||
catch (Exception $exc)
|
||||
|
|
@ -71,11 +73,10 @@ if ($jrn_id != 0 && $g_user->check_jrn($jrn_id) == 'X') {
|
|||
}
|
||||
|
||||
$ret = "";
|
||||
|
||||
if ( $jrn_id == 0 ) $Jrn->id=0;
|
||||
$jrn_type = $Jrn->get_type();
|
||||
|
||||
$pdf = Print_Ledger::factory($cn, $p_simple, "PDF", $Jrn);
|
||||
|
||||
$pdf = Print_Ledger::factory($cn, $p_simple, $Jrn,$from,$to,$filter_operation);
|
||||
$pdf->setDossierInfo($Jrn->jrn_def_name);
|
||||
$pdf->AliasNbPages();
|
||||
$pdf->AddPage();
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ require_once NOALYSS_INCLUDE."/class/tax_summary.class.php";
|
|||
require_once NOALYSS_INCLUDE."/lib/noalyss_csv.class.php";
|
||||
$http=new HttpInput();
|
||||
$tax_summary = new Tax_Summary($cn,$http->get("date_start"),$http->get("date_end"));
|
||||
$tva_type = $http->request("tva_type");
|
||||
$tax_summary->set_tva_type($tva_type);
|
||||
|
||||
try {
|
||||
$tax_summary->check();
|
||||
}catch (Exception $e)
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ $http = new HttpInput();
|
|||
|
||||
$from_periode = $http->request("date_start");
|
||||
$to_periode = $http->request("date_end");
|
||||
$tva_type = $http->request("tva_type");
|
||||
|
||||
|
||||
$gDossier = dossier::id();
|
||||
|
|
@ -41,6 +42,7 @@ $gDossier = dossier::id();
|
|||
/* Security */
|
||||
$cn = Dossier::connect();
|
||||
$tax_summary = new Tax_Summary($cn, $from_periode, $to_periode);
|
||||
$tax_summary->set_tva_type($tva_type);
|
||||
$pdf = new PDFLand($cn);
|
||||
$pdf->setDossierInfo(sprintf(_("Date") . " : %s %s", $from_periode, $to_periode));
|
||||
$pdf->AliasNbPages();
|
||||
|
|
@ -172,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;
|
||||
|
|
@ -185,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();
|
||||
|
|
@ -326,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();
|
||||
|
||||
|
|
|
|||
|
|
@ -953,7 +953,7 @@ class DatabaseCore
|
|||
static function nb_column($p_ret) {
|
||||
return pg_num_fields($p_ret);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* test::test_me(); */
|
||||
|
|
|
|||
|
|
@ -104,4 +104,6 @@ content[70]="<?php echo escape_xml(_("Votre demande est en cours de traitement")
|
|||
content[71]="<?php echo _('Limite le type de fiche si vous choisissez la fiche à la saisie, uniquement avec journaux OD');?>";
|
||||
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>
|
||||
|
|
@ -312,16 +312,17 @@ abstract class Noalyss_SQL extends Data_SQL
|
|||
return $this;
|
||||
}
|
||||
/**
|
||||
* Turn an object (row) into an array
|
||||
* Turn an object (row) into an array, and the key could be prefixed with $prefix
|
||||
* @param string $prefix before the key
|
||||
* @return array
|
||||
*/
|
||||
public function to_array()
|
||||
public function to_array($prefix="")
|
||||
{
|
||||
$array=array();
|
||||
foreach ($this->name as $key=> $value)
|
||||
{
|
||||
|
||||
$array[$key]=$this->$key;
|
||||
$nkey=$prefix.$key;
|
||||
$array[$nkey]=$this->$key;
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
|
|
|
|||
36
include/sql/patch/upgrade138.sql
Normal file
36
include/sql/patch/upgrade138.sql
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
begin;
|
||||
ALTER TABLE public.tva_rate ADD tva_payment_sale char(1) NULL DEFAULT 'O';
|
||||
update public.tva_rate set tva_payment_sale='O';
|
||||
ALTER TABLE public.tva_rate ADD CONSTRAINT tva_rate_sale_check CHECK (tva_payment_sale in ('O','P'));
|
||||
comment on column public.tva_rate.tva_payment_sale is 'Check if the VAT on Sale must be declared when at the date of payment (P) or the date of operation (O)';
|
||||
|
||||
|
||||
ALTER TABLE public.tva_rate ADD tva_payment_purchase char(1) NULL DEFAULT 'O';
|
||||
update public.tva_rate set tva_payment_purchase='O';
|
||||
ALTER TABLE public.tva_rate ADD CONSTRAINT tva_rate_purchase_check CHECK (tva_payment_purchase in ('O','P'));
|
||||
comment on column public.tva_rate.tva_payment_purchase is 'Check if the VAT on Purchase must be declared when at the date of payment (P) or the date of operation (O)';
|
||||
|
||||
|
||||
drop VIEW public.v_tva_rate;
|
||||
|
||||
CREATE OR REPLACE VIEW public.v_tva_rate
|
||||
AS SELECT tva_rate.tva_id,
|
||||
tva_rate.tva_rate,
|
||||
tva_rate.tva_label,
|
||||
tva_rate.tva_comment,
|
||||
split_part(tva_rate.tva_poste, ','::text, 1) AS tva_purchase,
|
||||
split_part(tva_rate.tva_poste, ','::text, 2) AS tva_sale,
|
||||
tva_rate.tva_both_side,
|
||||
tva_payment_purchase,
|
||||
tva_payment_sale
|
||||
FROM tva_rate;
|
||||
|
||||
COMMENT ON VIEW public.v_tva_rate IS 'Show this table to be easily used by Tva_Rate_MTable';
|
||||
COMMENT ON COLUMN public.v_tva_rate.tva_purchase IS ' VAT used for purchase';
|
||||
COMMENT ON COLUMN public.v_tva_rate.tva_sale IS ' VAT used for sale';
|
||||
COMMENT ON COLUMN public.v_tva_rate.tva_both_side IS 'if 1 , VAT avoided ';
|
||||
comment on column public.v_tva_rate.tva_payment_purchase is 'Check if the VAT on Purchase must be declared when at the date of payment (P) or the date of operation (O)';
|
||||
comment on column public.v_tva_rate.tva_payment_sale is 'Check if the VAT on Sale must be declared when at the date of payment (P) or the date of operation (O)';
|
||||
|
||||
insert into version (val,v_description) values (139,'Add VAT exigibility');
|
||||
commit ;
|
||||
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 ;
|
||||
|
|
@ -36,6 +36,15 @@ $end_periode = new IDate("end_date", $end);
|
|||
echo '<FORM METHOD="GET">';
|
||||
echo HtmlInput::array_to_hidden(['gDossier','ac'],$_GET);
|
||||
echo HtmlInput::hidden("do","display");
|
||||
$select_tva=new ISelect("tva_type");
|
||||
$select_tva->value=array(
|
||||
array("value"=>'O',"label"=>_("Opération")),
|
||||
array("value"=>'P',"label"=>_("Paiement")),
|
||||
array("value"=>'T',"label"=>_("TVA"))
|
||||
);
|
||||
$select_tva->selected=$http->get('tva_type','string','O');
|
||||
printf(_("Calcul d'après la date"));
|
||||
echo $select_tva->input();
|
||||
printf(_("Période du %s au %s"),
|
||||
$start_periode->input(),
|
||||
$end_periode->input());
|
||||
|
|
@ -46,6 +55,7 @@ echo '<hr>';
|
|||
if ( $http->get("do","string","no") == "display")
|
||||
{
|
||||
$tax_summary=new Tax_Summary($cn,$start_periode->value,$end_periode->value);
|
||||
$tax_summary->set_tva_type($select_tva->selected);
|
||||
try {
|
||||
try {
|
||||
$tax_summary->check();
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ echo $f_accounting->input(); ?>
|
|||
|
||||
<tr>
|
||||
<td style="text-align:right;width:30em">
|
||||
<?php echo _('Et uniquement non payées')?>
|
||||
<?php echo _('Statut')?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
DOSSIER_TEST=rel70dossier25
|
||||
FILE_TEST=dossiertest191124-2109.bin
|
||||
|
||||
dropdb $DOSSIER_TEST
|
||||
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/$FILE_TEST
|
||||
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ EOF;
|
|||
*/
|
||||
static function save_file($p_dir, $p_file, $p_content)
|
||||
{
|
||||
printf (" saving %s/%s please check this file \n ",$p_dir,$p_file);
|
||||
$hFile=fopen($p_dir."/".$p_file, "w+");
|
||||
fwrite($hFile, $p_content);
|
||||
fclose($hFile);
|
||||
|
|
|
|||
399
unit-test/include/class/acc_account_ledger.Test.php
Normal file
399
unit-test/include/class/acc_account_ledger.Test.php
Normal file
|
|
@ -0,0 +1,399 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2014-10-31 at 20:33:22.
|
||||
*
|
||||
*/
|
||||
class Acc_Account_LedgerTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Acc_Account_Ledger
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
global $g_connection, $g_parameter, $g_user;
|
||||
$_REQUEST['gDossier']=DOSSIER;
|
||||
$g_connection=new Database(DOSSIER);
|
||||
$g_parameter=new Noalyss_Parameter_Folder($g_connection);
|
||||
$g_user=new User($g_connection);
|
||||
$this->object=new Acc_Account_Ledger($g_connection, 400);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::get_row
|
||||
*/
|
||||
public function testGet_row()
|
||||
{
|
||||
$array=$this->object->get_row(92, 103);
|
||||
$this->assertEquals(count($array), 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::get_row_date
|
||||
*/
|
||||
public function testGet_row_date()
|
||||
{
|
||||
global $g_user, $g_connection;
|
||||
|
||||
$accounting=new Acc_Account_Ledger($g_connection, '4511');
|
||||
$a_array=$accounting->get_row_date('01.01.2018', '31.12.2018', 0);
|
||||
$expected=array(
|
||||
0=>
|
||||
array(
|
||||
0=>
|
||||
array(
|
||||
'j_id'=>'820',
|
||||
'jr_id'=>'317',
|
||||
'j_date_fmt'=>'01.01.2018',
|
||||
'j_date'=>'2018-01-01',
|
||||
'j_qcode'=>NULL,
|
||||
'deb_montant'=>'0',
|
||||
'cred_montant'=>'8.4000',
|
||||
'description'=>'Ecriture d\'ouverture 2018 TVA à payer 21%',
|
||||
'jrn_name'=>'Opération Diverses',
|
||||
'j_debit'=>'f',
|
||||
'jr_internal'=>'O000172',
|
||||
'jr_pj_number'=>'ODS44',
|
||||
'letter'=>NULL,
|
||||
'pcm_lib'=>'TVA à payer 21%',
|
||||
'jr_optype'=>'OPE',
|
||||
'jr_tech_per'=>'92',
|
||||
'p_exercice'=>'2018',
|
||||
'jrn_def_name'=>'Opération Diverses',
|
||||
'jrn_def_code'=>'O01',
|
||||
'delta_letter'=>NULL,
|
||||
),
|
||||
1=>
|
||||
array(
|
||||
'j_id'=>'6',
|
||||
'jr_id'=>'2',
|
||||
'j_date_fmt'=>'24.02.2018',
|
||||
'j_date'=>'2018-02-24',
|
||||
'j_qcode'=>NULL,
|
||||
'deb_montant'=>'0',
|
||||
'cred_montant'=>'8.4000',
|
||||
'description'=>'Déplacement',
|
||||
'jrn_name'=>'Vente',
|
||||
'j_debit'=>'f',
|
||||
'jr_internal'=>'V000002',
|
||||
'jr_pj_number'=>'VEN2',
|
||||
'letter'=>NULL,
|
||||
'pcm_lib'=>'TVA à payer 21%',
|
||||
'jr_optype'=>'NOR',
|
||||
'jr_tech_per'=>'93',
|
||||
'p_exercice'=>'2018',
|
||||
'jrn_def_name'=>'Vente',
|
||||
'jrn_def_code'=>'V01',
|
||||
'delta_letter'=>NULL,
|
||||
),
|
||||
2=>
|
||||
array(
|
||||
'j_id'=>'9',
|
||||
'jr_id'=>'3',
|
||||
'j_date_fmt'=>'24.02.2018',
|
||||
'j_date'=>'2018-02-24',
|
||||
'j_qcode'=>NULL,
|
||||
'deb_montant'=>'0',
|
||||
'cred_montant'=>'5.2900',
|
||||
'description'=>'Vente de marchandises',
|
||||
'jrn_name'=>'Vente',
|
||||
'j_debit'=>'f',
|
||||
'jr_internal'=>'V000003',
|
||||
'jr_pj_number'=>'VEN3',
|
||||
'letter'=>NULL,
|
||||
'pcm_lib'=>'TVA à payer 21%',
|
||||
'jr_optype'=>'NOR',
|
||||
'jr_tech_per'=>'93',
|
||||
'p_exercice'=>'2018',
|
||||
'jrn_def_name'=>'Vente',
|
||||
'jrn_def_code'=>'V01',
|
||||
'delta_letter'=>NULL,
|
||||
),
|
||||
3=>
|
||||
array(
|
||||
'j_id'=>'13',
|
||||
'jr_id'=>'4',
|
||||
'j_date_fmt'=>'24.02.2018',
|
||||
'j_date'=>'2018-02-24',
|
||||
'j_qcode'=>NULL,
|
||||
'deb_montant'=>'0',
|
||||
'cred_montant'=>'35.7400',
|
||||
'description'=>'Vente de marchandises',
|
||||
'jrn_name'=>'Vente',
|
||||
'j_debit'=>'f',
|
||||
'jr_internal'=>'V000004',
|
||||
'jr_pj_number'=>'VEN4',
|
||||
'letter'=>NULL,
|
||||
'pcm_lib'=>'TVA à payer 21%',
|
||||
'jr_optype'=>'NOR',
|
||||
'jr_tech_per'=>'93',
|
||||
'p_exercice'=>'2018',
|
||||
'jrn_def_name'=>'Vente',
|
||||
'jrn_def_code'=>'V01',
|
||||
'delta_letter'=>NULL,
|
||||
),
|
||||
4=>
|
||||
array(
|
||||
'j_id'=>'17',
|
||||
'jr_id'=>'5',
|
||||
'j_date_fmt'=>'24.04.2018',
|
||||
'j_date'=>'2018-04-24',
|
||||
'j_qcode'=>NULL,
|
||||
'deb_montant'=>'0',
|
||||
'cred_montant'=>'35.7400',
|
||||
'description'=>'Marchandise et Déplacement',
|
||||
'jrn_name'=>'Vente',
|
||||
'j_debit'=>'f',
|
||||
'jr_internal'=>'V000005',
|
||||
'jr_pj_number'=>'VEN5',
|
||||
'letter'=>NULL,
|
||||
'pcm_lib'=>'TVA à payer 21%',
|
||||
'jr_optype'=>'NOR',
|
||||
'jr_tech_per'=>'95',
|
||||
'p_exercice'=>'2018',
|
||||
'jrn_def_name'=>'Vente',
|
||||
'jrn_def_code'=>'V01',
|
||||
'delta_letter'=>NULL,
|
||||
),
|
||||
5=>
|
||||
array(
|
||||
'j_id'=>'818',
|
||||
'jr_id'=>'316',
|
||||
'j_date_fmt'=>'12.09.2018',
|
||||
'j_date'=>'2018-09-12',
|
||||
'j_qcode'=>NULL,
|
||||
'deb_montant'=>'0',
|
||||
'cred_montant'=>'21.0000',
|
||||
'description'=>'Vente en OD TVA à payer 21%',
|
||||
'jrn_name'=>'Opération Diverses',
|
||||
'j_debit'=>'f',
|
||||
'jr_internal'=>'O000171',
|
||||
'jr_pj_number'=>'ODS43',
|
||||
'letter'=>NULL,
|
||||
'pcm_lib'=>'TVA à payer 21%',
|
||||
'jr_optype'=>'NOR',
|
||||
'jr_tech_per'=>'100',
|
||||
'p_exercice'=>'2018',
|
||||
'jrn_def_name'=>'Opération Diverses',
|
||||
'jrn_def_code'=>'O01',
|
||||
'delta_letter'=>NULL,
|
||||
),
|
||||
),
|
||||
1=>'0',
|
||||
2=>'114.5700',
|
||||
);
|
||||
$this->assertEquals($expected, $a_array);
|
||||
}
|
||||
|
||||
function dataGet_Name()
|
||||
{
|
||||
return array(
|
||||
array('10', 'Capital '),
|
||||
array('01', 'Poste inconnu')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::get_name
|
||||
* @dataProvider dataGet_Name
|
||||
*/
|
||||
public function testGet_name($id, $result)
|
||||
{
|
||||
$this->object->id=$id;
|
||||
$this->assertEquals($this->object->get_name(), $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::do_exist
|
||||
* @dataProvider dataDo_exist
|
||||
*/
|
||||
public function testDo_exist($p_value, $result)
|
||||
{
|
||||
$this->object->id=$p_value;
|
||||
$this->assertEquals($this->object->do_exist(), $result);
|
||||
}
|
||||
|
||||
function dataDo_exist()
|
||||
{
|
||||
return array(
|
||||
array('400', 1),
|
||||
array('400A', 0),
|
||||
array('550', 1),
|
||||
array('60BXX', 0)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::load
|
||||
*/
|
||||
public function testLoad()
|
||||
{
|
||||
$this->object->load();
|
||||
$this->assertTrue($this->object->id==400, "test load");
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::get_solde
|
||||
*/
|
||||
public function testGet_solde()
|
||||
{
|
||||
global $g_connection;
|
||||
$accounting=new Acc_Account_Ledger($g_connection, '4511');
|
||||
$this->assertEquals($accounting->get_solde(),248.97);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::get_solde_detail
|
||||
*/
|
||||
public function testGet_solde_detail()
|
||||
{
|
||||
global $g_connection;
|
||||
$accounting=new Acc_Account_Ledger($g_connection, '4511');
|
||||
$expected=array (
|
||||
'debit' => '0',
|
||||
'credit' => '248.9700',
|
||||
'solde' => 248,
|
||||
);
|
||||
$this->assertEquals($accounting->get_solde_detail(),$expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::isTVA
|
||||
*/
|
||||
public function testIsTVA()
|
||||
{
|
||||
$this->object->id="4111";
|
||||
$this->assertEquals($this->object->isTVA(), 1);
|
||||
$this->object->id=10;
|
||||
$this->assertEquals($this->object->isTVA(), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::HtmlTable
|
||||
*/
|
||||
public function testHtmlTable()
|
||||
{
|
||||
$this->assertTrue(true, 'Ne peut être testé car vue HTML');
|
||||
}
|
||||
|
||||
public function dataGet_amount_side()
|
||||
{
|
||||
return array(
|
||||
array(0, "="),
|
||||
array(1000, 'D'),
|
||||
array(-1000, 'C'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::get_amount_side
|
||||
* @dataProvider dataGet_amount_side
|
||||
*/
|
||||
public function testGet_amount_side($amount, $result)
|
||||
{
|
||||
$this->assertEquals($this->object->get_amount_side($amount), $result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::belong_ledger
|
||||
* @dataProvider DataBelong_ledger
|
||||
*/
|
||||
public function testBelong_ledger($p_jrn, $result)
|
||||
{
|
||||
$this->assertEquals($this->object->belong_ledger($p_jrn), $result);
|
||||
}
|
||||
|
||||
function DataBelong_ledger()
|
||||
{
|
||||
return array(
|
||||
array(-1, 0),
|
||||
array(1, -1),
|
||||
array(3, 0),
|
||||
array(2, -1),
|
||||
array(4, 0)
|
||||
);
|
||||
}
|
||||
|
||||
public function dataGet_account_ledger()
|
||||
{
|
||||
return array(
|
||||
array(0, array()),
|
||||
array(1, array('5*', '')),
|
||||
array(2, array('4*')),
|
||||
array(3, array('6*'))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::get_account_ledger
|
||||
* @dataProvider dataGet_account_ledger
|
||||
*/
|
||||
public function testGet_account_ledger($p_jrn, $result)
|
||||
{
|
||||
$this->assertEquals($this->object->get_account_ledger($p_jrn), $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::build_sql_account
|
||||
* @dataProvider DataBuild_Sql_account
|
||||
*/
|
||||
public function testBuild_sql_account($p_jrn, $result)
|
||||
{
|
||||
$value=$this->object->build_sql_account($p_jrn);
|
||||
$this->assertEquals(trim($value), $result);
|
||||
}
|
||||
|
||||
public function DataBuild_Sql_account()
|
||||
{
|
||||
return array(
|
||||
array(0, ""),
|
||||
array(1, "pcm_val::text like '5%'"),
|
||||
array(2, "pcm_val::text like '4%'"),
|
||||
array(3, "pcm_val::text like '6%'"),
|
||||
array(4, "")
|
||||
);
|
||||
}
|
||||
|
||||
function dataFind_Card()
|
||||
{
|
||||
return array(
|
||||
array('6191', '27'),
|
||||
array('6192', '28'),
|
||||
array('4400004', '25')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::find_card
|
||||
* @todo Implement testFind_card().
|
||||
* @dataProvider dataFind_Card()
|
||||
*/
|
||||
public function testFind_card($p_value, $p_card)
|
||||
{
|
||||
$this->object->id=$p_value;
|
||||
$result=$this->object->find_card();
|
||||
$this->assertEquals($p_card, $result[0]['f_id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,280 +0,0 @@
|
|||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2014-10-31 at 20:33:22.
|
||||
* @backupGlobals enabled
|
||||
*/
|
||||
class Acc_Account_LedgerTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Acc_Account_Ledger
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
global $g_connection, $g_parameter,$g_user;
|
||||
$_REQUEST['gDossier']=DOSSIER;
|
||||
$g_connection=new Database(DOSSIER);
|
||||
$g_parameter=new Noalyss_Parameter_Folder($g_connection);
|
||||
$g_user=new User($g_connection);
|
||||
$this->object=new Acc_Account_Ledger($g_connection, 400);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::get_row
|
||||
* @todo Implement testGet_row().
|
||||
*/
|
||||
public function testGet_row()
|
||||
{
|
||||
$array=$this->object->get_row(92,103);
|
||||
$this->assertEquals(count($array),3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::get_row_date
|
||||
* @todo Implement testGet_row_date().
|
||||
*/
|
||||
public function testGet_row_date()
|
||||
{
|
||||
$this->object->get_row_date('01.01.2017', '01.02.2017', 0);
|
||||
}
|
||||
function dataGet_Name()
|
||||
{
|
||||
return array(
|
||||
array('10','Capital '),
|
||||
array('01','Poste inconnu')
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::get_name
|
||||
* @todo Implement testGet_name().
|
||||
* @dataProvider dataGet_Name
|
||||
*/
|
||||
public function testGet_name($id,$result)
|
||||
{
|
||||
$this->object->id=$id;
|
||||
$this->assertEquals($this->object->get_name(),$result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::do_exist
|
||||
* @todo Implement testDo_exist().
|
||||
* @dataProvider dataDo_exist
|
||||
*/
|
||||
public function testDo_exist($p_value, $result)
|
||||
{
|
||||
$this->object->id=$p_value;
|
||||
$this->assertEquals($this->object->do_exist(), $result);
|
||||
}
|
||||
|
||||
function dataDo_exist()
|
||||
{
|
||||
return array(
|
||||
array('400', 1),
|
||||
array('400A', 0),
|
||||
array('550', 1),
|
||||
array('60BXX', 0)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::load
|
||||
* @todo Implement testLoad().
|
||||
*/
|
||||
public function testLoad()
|
||||
{
|
||||
$this->object->load();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::get
|
||||
* @todo Implement testGet().
|
||||
*/
|
||||
public function testGet()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::get_solde
|
||||
* @todo Implement testGet_solde().
|
||||
*/
|
||||
public function testGet_solde()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::get_solde_detail
|
||||
* @todo Implement testGet_solde_detail().
|
||||
*/
|
||||
public function testGet_solde_detail()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::isTVA
|
||||
* @todo Implement testIsTVA().
|
||||
*/
|
||||
public function testIsTVA()
|
||||
{
|
||||
$this->object->id="4111";
|
||||
$this->assertEquals($this->object->isTVA(),1);
|
||||
$this->object->id=10;
|
||||
$this->assertEquals($this->object->isTVA(),0);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::HtmlTable
|
||||
* @todo Implement testHtmlTable().
|
||||
*/
|
||||
public function testHtmlTable()
|
||||
{
|
||||
$this->assertTrue(true,'Ne peut être testé car vue HTML');
|
||||
}
|
||||
public function dataGet_amount_side()
|
||||
{
|
||||
return array (
|
||||
array(0,"="),
|
||||
array(1000,'D'),
|
||||
array(-1000,'C'),
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::get_amount_side
|
||||
* @todo Implement testGet_amount_side().
|
||||
* @dataProvider dataGet_amount_side
|
||||
*/
|
||||
public function testGet_amount_side($amount,$result)
|
||||
{
|
||||
$this->assertEquals($this->object->get_amount_side($amount),$result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::HtmlTableHeader
|
||||
* @todo Implement testHtmlTableHeader().
|
||||
*/
|
||||
public function testHtmlTableHeader()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->assertTrue(true,'Ne peut être testé car vue HTML');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::belong_ledger
|
||||
* @todo Implement testBelong_ledger().
|
||||
* @dataProvider DataBelong_ledger
|
||||
*/
|
||||
public function testBelong_ledger($p_jrn, $result)
|
||||
{
|
||||
$this->assertEquals($this->object->belong_ledger($p_jrn), $result);
|
||||
}
|
||||
|
||||
function DataBelong_ledger()
|
||||
{
|
||||
return array(
|
||||
array(0, -1),
|
||||
array(1, -1),
|
||||
array(3, -1),
|
||||
array(2, 0),
|
||||
array(4, 0)
|
||||
);
|
||||
}
|
||||
public function dataGet_account_ledger()
|
||||
{
|
||||
return array(
|
||||
array(0,array()),
|
||||
array(1,array('5*','')),
|
||||
array(2,array('4*')),
|
||||
array(3,array('6*'))
|
||||
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::get_account_ledger
|
||||
* @todo Implement testGet_account_ledger().
|
||||
* @dataProvider dataGet_account_ledger
|
||||
*/
|
||||
public function testGet_account_ledger($p_jrn,$result)
|
||||
{
|
||||
echo "ledger $p_jrn";
|
||||
$this->assertEquals($this->object->get_account_ledger($p_jrn),$result);
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::build_sql_account
|
||||
* @todo Implement testBuild_sql_account().
|
||||
* @dataProvider DataBuild_Sql_account
|
||||
*/
|
||||
public function testBuild_sql_account($p_jrn, $result)
|
||||
{
|
||||
print "\n--------------------\n";
|
||||
$value=$this->object->build_sql_account($p_jrn);
|
||||
printf(" ledger %s [%s]", $p_jrn, $value);
|
||||
$this->assertEquals(trim($value), $result);
|
||||
}
|
||||
|
||||
public function DataBuild_Sql_account()
|
||||
{
|
||||
return array(
|
||||
array(0, ""),
|
||||
array(1, "pcm_val::text like '5%'"),
|
||||
array(2, "pcm_val::text like '4%'"),
|
||||
array(3, "pcm_val::text like '6%'"),
|
||||
array(4, "")
|
||||
);
|
||||
}
|
||||
|
||||
function dataFind_Card()
|
||||
{
|
||||
return array(
|
||||
array('6191', '27'),
|
||||
array('6192', '28'),
|
||||
array('4400004', '25')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::find_card
|
||||
* @todo Implement testFind_card().
|
||||
* @dataProvider dataFind_Card()
|
||||
*/
|
||||
public function testFind_card($p_value, $p_card)
|
||||
{
|
||||
$this->object->id=$p_value;
|
||||
$result=$this->object->find_card();
|
||||
$this->assertEquals($p_card, $result[0]['f_id']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -48,10 +48,10 @@ 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(32,count($array));
|
||||
$this->object->jrn=[2,4];
|
||||
$array=$this->object->get_row($min,$max);
|
||||
$this->assertEquals(10,count($array));
|
||||
$this->assertEquals(12,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
|
||||
{
|
||||
|
|
@ -11,7 +11,7 @@ class Acc_LedgerTest extends TestCase
|
|||
* @var Acc_Ledger
|
||||
*/
|
||||
protected $object;
|
||||
protected function getDataSet()
|
||||
protected function getDataSet()
|
||||
{
|
||||
$dataSet = new PHPUnit_Extensions_Database_DataSet_CsvDataSet();
|
||||
$dataSet->addTable('jrn', dirname(__FILE__)."/jrn.csv");
|
||||
|
|
@ -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(39,$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,27 +556,28 @@ 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()
|
||||
{
|
||||
global $g_connection;
|
||||
$ledger=new Acc_Ledger($g_connection,4);
|
||||
$this->assertEquals("3,2,4",$ledger->get_all_fiche_def());
|
||||
$this->assertEquals("3,2,4,5",$ledger->get_all_fiche_def());
|
||||
}
|
||||
|
||||
/**
|
||||
* @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"=> 490.7700 , "j_poste"=> "4000005", "j_qcode"=> "CLIENT1"],
|
||||
["solde"=> 21.9600, "j_poste"=> "4112", "j_qcode"=> ""],
|
||||
["solde"=>-85.1700 , "j_poste"=> "4511", "j_qcode"=> ""],
|
||||
["solde"=> -863.2100 , "j_poste"=>"4400005", "j_qcode"=> "FOURNI1"]
|
||||
["solde"=> 658.25 , "j_poste"=> "4400004", "j_qcode"=> "FOURNI"],
|
||||
["solde"=> 660.17 , "j_poste"=> "4000005", "j_qcode"=> "CLIENT1"],
|
||||
["solde"=> 87.8400, "j_poste"=> "4112", "j_qcode"=> ""],
|
||||
["solde"=>-114.57 , "j_poste"=> "4511", "j_qcode"=> ""],
|
||||
["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()
|
||||
{
|
||||
|
|
@ -776,7 +794,7 @@ class Acc_LedgerTest extends TestCase
|
|||
public function testSave_new()
|
||||
{
|
||||
global $g_connection;
|
||||
|
||||
$ledger=new Acc_Ledger($g_connection,-1);
|
||||
$array=["p_jrn_name"=>"UNITTEST",
|
||||
"p_ech_lib"=>"",
|
||||
"p_jrn_deb_max_line"=>7,
|
||||
|
|
@ -791,18 +809,19 @@ class Acc_LedgerTest extends TestCase
|
|||
// clean ledger if exists
|
||||
$g_connection->exec_sql("delete from jrn_def where jrn_def_name=$1",[$array['p_jrn_name']]);
|
||||
|
||||
$this->object->save_new($array);
|
||||
$jrn_def_id=$g_connection->get_value("select jrn_def_id from jrn_def where jrn_def_name=$1",[$array['p_jrn_name']]);
|
||||
$ledger->save_new($array);
|
||||
$jrn_def_id=$g_connection->get_value("select jrn_def_id from jrn_def where jrn_def_name=$1",
|
||||
[$array['p_jrn_name']]);
|
||||
$this->assertLessThan($jrn_def_id,0);
|
||||
$ledger=new Acc_Ledger($g_connection,$jrn_def_id);
|
||||
$ledger->delete_ledger();
|
||||
$jrn_def_id=$g_connection->get_value("select jrn_def_id from jrn_def where jrn_def_name=$1",[$array['p_jrn_name']]);
|
||||
$jrn_def_id=$g_connection->get_value("select jrn_def_id from jrn_def where jrn_def_name=$1",
|
||||
[$array['p_jrn_name']]);
|
||||
$this->assertEquals($jrn_def_id,"");
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::delete_ledger
|
||||
* @todo Implement testDelete_ledger().
|
||||
*/
|
||||
public function testDelete_ledger()
|
||||
{
|
||||
|
|
@ -821,7 +840,8 @@ class Acc_LedgerTest extends TestCase
|
|||
$g_connection->exec_sql("delete from jrn_def where jrn_def_name=$1",[$array['p_jrn_name']]);
|
||||
|
||||
// Recreate it
|
||||
$this->object->save_new($array);
|
||||
$ledger=new Acc_Ledger($g_connection,-1);
|
||||
$ledger->save_new($array);
|
||||
$jrn_def_id=$g_connection->get_value("select jrn_def_id from jrn_def where jrn_def_name=$1",[$array['p_jrn_name']]);
|
||||
$this->assertLessThan($jrn_def_id,0);
|
||||
$ledger=new Acc_Ledger($g_connection,$jrn_def_id);
|
||||
|
|
@ -832,7 +852,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_operation_date
|
||||
* @todo Implement testGet_operation_date().
|
||||
*/
|
||||
public function testGet_operation_date()
|
||||
{
|
||||
|
|
@ -849,7 +868,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_supplier_now
|
||||
* @todo Implement testGet_supplier_now().
|
||||
*/
|
||||
public function testGet_supplier_now()
|
||||
{
|
||||
|
|
@ -858,7 +876,6 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_supplier_late
|
||||
* @todo Implement testGet_supplier_late().
|
||||
*/
|
||||
public function testGet_supplier_late()
|
||||
{
|
||||
|
|
@ -867,20 +884,34 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_customer_now
|
||||
* @todo Implement testGet_customer_now().
|
||||
*/
|
||||
public function testGet_customer_now()
|
||||
{
|
||||
$this->assertTrue(is_array($this->object->get_customer_now()));
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @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();
|
||||
}
|
||||
136
unit-test/include/class/acc_ledger_historyTest.php
Normal file
136
unit-test/include/class/acc_ledger_historyTest.php
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2002-2019) Author Dany De Bontridder <danydb@noalyss.eu>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief concerne acc_ledger_historyTest.class
|
||||
* @coversDefaultClass Acc_Ledger_History
|
||||
*/
|
||||
class Acc_Ledger_HistoryTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
include 'global.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Ledger_History::factory
|
||||
* @covers ::get_ledger_type
|
||||
* @covers ::set_filter_operation
|
||||
*/
|
||||
function testFactory()
|
||||
{
|
||||
global $g_connection;
|
||||
$p_min_id=$g_connection->get_value("select p_id from parm_periode order by p_start limit 1");
|
||||
$p_max_id=$g_connection->get_value("select p_id from parm_periode order by p_start desc limit 1");
|
||||
|
||||
$object=Acc_Ledger_History::factory($g_connection, [1],$p_min_id ,$p_max_id , "D", 'all');
|
||||
$this->assertEquals('FIN',$object->get_ledger_type());
|
||||
|
||||
$object=Acc_Ledger_History::factory($g_connection, [4],$p_min_id ,$p_max_id , "D", 'all');
|
||||
$this->assertEquals('ODS',$object->get_ledger_type());
|
||||
|
||||
$object=Acc_Ledger_History::factory($g_connection, [2],$p_min_id ,$p_max_id , "D", 'all');
|
||||
$this->assertEquals('VEN',$object->get_ledger_type());
|
||||
|
||||
$object=Acc_Ledger_History::factory($g_connection, [3],$p_min_id ,$p_max_id , "D", 'all');
|
||||
$this->assertEquals('ACH',$object->get_ledger_type());
|
||||
|
||||
}
|
||||
/**
|
||||
* @covers ::get_tiers
|
||||
* @covers ::get_tiers_id
|
||||
*/
|
||||
function testGet_tiers()
|
||||
{
|
||||
global $g_connection;
|
||||
$p_min_id=$g_connection->get_value("select p_id from parm_periode order by p_start limit 1");
|
||||
$p_max_id=$g_connection->get_value("select p_id from parm_periode order by p_start desc limit 1");
|
||||
|
||||
$object=Acc_Ledger_History::factory($g_connection, [1],$p_min_id ,$p_max_id , "E", 'paid');
|
||||
$this->assertEquals(" ",$object->get_tiers('ODS',213));
|
||||
|
||||
$this->assertEquals("Client 2",trim($object->get_tiers('VEN',213)));
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* @covers ::get_filter_operation
|
||||
*/
|
||||
function testget_Filter_Operation()
|
||||
{
|
||||
global $g_connection;
|
||||
$p_min_id=$g_connection->get_value("select p_id from parm_periode order by p_start limit 1");
|
||||
$p_max_id=$g_connection->get_value("select p_id from parm_periode order by p_start desc limit 1");
|
||||
|
||||
$object=Acc_Ledger_History::factory($g_connection, [2],$p_min_id ,$p_max_id , "D", 'all');
|
||||
$this->assertEquals("all",$object->get_filter_operation()) ;
|
||||
|
||||
$object=Acc_Ledger_History::factory($g_connection, [3],$p_min_id ,$p_max_id , "D", 'all');
|
||||
$this->assertEquals("all",$object->get_filter_operation()) ;
|
||||
|
||||
$object=Acc_Ledger_History::factory($g_connection, [1],$p_min_id ,$p_max_id , "D", 'all');
|
||||
$this->assertEquals("all",$object->get_filter_operation()) ;
|
||||
}
|
||||
/**
|
||||
* @covers ::build_filter_operation
|
||||
* @covers ::set_filter_operation
|
||||
*
|
||||
*/
|
||||
function testBuild_filter_operation()
|
||||
{
|
||||
global $g_connection;
|
||||
$p_min_id=$g_connection->get_value("select p_id from parm_periode order by p_start limit 1");
|
||||
$p_max_id=$g_connection->get_value("select p_id from parm_periode order by p_start desc limit 1");
|
||||
$object=Acc_Ledger_History::factory($g_connection, [2],$p_min_id ,$p_max_id , "D", 'all');
|
||||
$object->get_row();
|
||||
$a_row=$object->get_data();
|
||||
$this->assertEquals(7,count($a_row));
|
||||
|
||||
$object->set_filter_operation("paid");
|
||||
$object->get_row();
|
||||
$a_row=$object->get_data();
|
||||
$this->assertEquals(3,count($a_row));
|
||||
|
||||
$object->set_filter_operation("unpaid");
|
||||
$object->get_row();
|
||||
$a_row=$object->get_data();
|
||||
$this->assertEquals(4,count($a_row));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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()
|
||||
{
|
||||
|
|
@ -123,12 +123,85 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
$this->assertEquals(1,
|
||||
$g_connection->get_value ("select count(*) from jrn where jr_mt=$1",["1572704002.1732"]));
|
||||
$this->clean_operation();
|
||||
|
||||
|
||||
// If some data are corruptes
|
||||
$sql="
|
||||
from quant_purchase
|
||||
join jrnx using(j_id)
|
||||
join jrn on (jr_grpt_id=j_grpt)
|
||||
where
|
||||
jr_mt='1572704002.1732'
|
||||
and j_qcode='DOCUME'
|
||||
";
|
||||
// Test space in e_quant0 instead of zero
|
||||
$array=$this->array;
|
||||
$array["mt"]="1572704002.1732";
|
||||
$array["nb_item"]=2;
|
||||
$array["pa_id"]=array(2);
|
||||
$array["op"]=array(0);
|
||||
$array["amount_t0"]=658.25;
|
||||
$array['hplan']=array(array(-1));
|
||||
$array["val"]=array(array(658.25));
|
||||
$array=array_merge($array, array("e_march1"=>"DOCUME",
|
||||
"e_march1_price"=>18.25,
|
||||
"e_quant1"=>"",
|
||||
"htva_march1"=>18.25,
|
||||
"e_march1_tva_id"=>1,
|
||||
"e_march1_tva_amount"=>22.08,
|
||||
"tva_march1"=>3.83,
|
||||
"tvac_march1"=>22.05));
|
||||
|
||||
$this->object->insert($array);
|
||||
$this->assertEquals(0,$g_connection->get_value("select count(*) ".$sql));
|
||||
$this->clean_operation();
|
||||
|
||||
// Test space in e_march0_price instead of zero must be
|
||||
$array=$this->array;
|
||||
$array["mt"]="1572704002.1732";
|
||||
$array["nb_item"]=2;
|
||||
$array["pa_id"]=array(2);
|
||||
$array["op"]=array(0);
|
||||
$array["amount_t0"]=658.25;
|
||||
$array['hplan']=array(array(-1));
|
||||
$array["val"]=array(array(658.25));
|
||||
$array=array_merge($array, array("e_march1"=>"DOCUME",
|
||||
"e_march1_price"=>18.25,
|
||||
"e_quant1"=>1,
|
||||
"htva_march1"=>18.25,
|
||||
"e_march1_tva_id"=>1,
|
||||
"e_march1_tva_amount"=>"",
|
||||
"tva_march1"=>3.83,
|
||||
"tvac_march1"=>22.05));
|
||||
$this->object->insert($array);
|
||||
$this->assertEquals(3.83,$g_connection->get_value("select qp_vat ".$sql));
|
||||
$this->clean_operation();
|
||||
|
||||
// Test space in e_march0_tva_amount instead of zero must be calculated
|
||||
$array=$this->array;
|
||||
$array["mt"]="1572704002.1732";
|
||||
$array["nb_item"]=2;
|
||||
$array["pa_id"]=array(2);
|
||||
$array["op"]=array(0);
|
||||
$array["amount_t0"]=658.25;
|
||||
$array['hplan']=array(array(-1));
|
||||
$array["val"]=array(array(658.25));
|
||||
$array=array_merge($array, array("e_march1"=>"DOCUME",
|
||||
"e_march1_price"=>18.25,
|
||||
"e_quant1"=>1,
|
||||
"htva_march1"=>18.25,
|
||||
"e_march1_tva_id"=>1,
|
||||
"e_march1_tva_amount"=>22.08,
|
||||
"tva_march1"=>"",
|
||||
"tvac_march1"=>22.05));
|
||||
|
||||
$this->object->insert($array);
|
||||
$this->assertEquals(22.08,$g_connection->get_value("select qp_vat ".$sql));
|
||||
$this->clean_operation();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger_Purchase::input
|
||||
* @todo Implement testInput().
|
||||
*/
|
||||
public function testInput()
|
||||
{
|
||||
|
|
@ -138,7 +211,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 +220,6 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger_Purchase::confirm
|
||||
* @todo Implement testConfirm().
|
||||
*/
|
||||
public function testConfirm()
|
||||
{
|
||||
|
|
@ -161,14 +233,29 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
$this->assertContains("value=\"Efface détail\" onClick=\"anc_key_clean('25','','658.25','','','0');",$ret);
|
||||
$this->assertContains('NAME="e_quant0" VALUE="1">',$ret);
|
||||
}
|
||||
|
||||
|
||||
private function clean_operation()
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -113,6 +115,55 @@ class Acc_Ledger_SoldTest extends TestCase
|
|||
$cnt=$g_connection->get_value("select count(*) from jrn where jr_mt=$1",["1572714478.3155"]);
|
||||
$this->assertEquals(1,$cnt);
|
||||
$this->clean_operation();
|
||||
|
||||
// If some data are corruptes
|
||||
$sql="
|
||||
from quant_sold
|
||||
join jrnx using(j_id)
|
||||
join jrn on (jr_grpt_id=j_grpt)
|
||||
where
|
||||
jr_mt='1572714478.3155'
|
||||
and j_qcode='MARCHA'
|
||||
";
|
||||
// Test space in e_quant1 instead of zero
|
||||
$array=$this->array;
|
||||
$array["pa_id"]=array(2);
|
||||
$array["op"]=array(0, 1);
|
||||
$array["amount_t0"]=24.2;
|
||||
$array["hplan"]=array(array(-1), array(-1));
|
||||
$array["val"]=array(array(24, 2), array(1212.5));
|
||||
$array["mt"]="1572714478.3155";
|
||||
$array['e_quant1']="";
|
||||
$this->object->insert($array);
|
||||
$this->assertEquals(0,$g_connection->get_value("select count(*) ".$sql));
|
||||
$this->clean_operation();
|
||||
|
||||
// Test space in e_march1_price instead of zero must be
|
||||
$array=$this->array;
|
||||
$array["pa_id"]=array(2);
|
||||
$array["op"]=array(0, 1);
|
||||
$array["amount_t0"]=24.2;
|
||||
$array["hplan"]=array(array(-1), array(-1));
|
||||
$array["val"]=array(array(24, 2), array(1212.5));
|
||||
$array["mt"]="1572714478.3155";
|
||||
$array['e_march1_tva_amount']="";
|
||||
$this->object->insert($array);
|
||||
$this->assertEquals(254.6250,$g_connection->get_value("select qs_vat ".$sql));
|
||||
$this->clean_operation();
|
||||
|
||||
// Test space in e_march1_tva_amount instead of zero must be calculated
|
||||
$array=$this->array;
|
||||
$array["pa_id"]=array(2);
|
||||
$array["op"]=array(0, 1);
|
||||
$array["amount_t0"]=24.2;
|
||||
$array["hplan"]=array(array(-1), array(-1));
|
||||
$array["val"]=array(array(24, 2), array(1212.5));
|
||||
$array["mt"]="1572714478.3155";
|
||||
$array['tva_march1']="";
|
||||
$this->object->insert($array);
|
||||
$this->assertEquals(254.63,$g_connection->get_value("select qs_vat ".$sql));
|
||||
$this->clean_operation();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -140,8 +191,11 @@ class Acc_Ledger_SoldTest extends TestCase
|
|||
*/
|
||||
public function testInput()
|
||||
{
|
||||
global $g_connection;
|
||||
$_REQUEST['ac']='VEN';
|
||||
$info=$this->object->input($this->array);
|
||||
$object=new Acc_Ledger_Sold($g_connection, 2);
|
||||
|
||||
$info=$object->input($this->array);
|
||||
if (!is_string($info))
|
||||
{
|
||||
$this->assertTrue(FALSE);
|
||||
|
|
@ -157,17 +211,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 +218,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');
|
||||
}
|
||||
}
|
||||
|
|
@ -32,17 +32,8 @@ class Acc_OperationTest extends TestCase
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_OperationTest::get
|
||||
* @todo Implement testGet().
|
||||
*/
|
||||
public function testGet()
|
||||
{
|
||||
$this->assertEquals(0,0);
|
||||
}
|
||||
/**
|
||||
*@covers Acc_Operation::seek_group
|
||||
* @todo Implement seek_group()
|
||||
*/
|
||||
public function testSeek_group()
|
||||
{
|
||||
|
|
@ -52,7 +43,6 @@ class Acc_OperationTest extends TestCase
|
|||
}
|
||||
/**
|
||||
* @covers Acc_Operation::set_id
|
||||
* @todo Implement testId()
|
||||
*
|
||||
*/
|
||||
public function testSet_id()
|
||||
|
|
@ -67,7 +57,6 @@ class Acc_OperationTest extends TestCase
|
|||
}
|
||||
/**
|
||||
* @covers Acc_Operation::set_paid
|
||||
* @todo Implement testSet_paid
|
||||
*/
|
||||
function testSet_Paid()
|
||||
{
|
||||
|
|
@ -85,7 +74,6 @@ class Acc_OperationTest extends TestCase
|
|||
}
|
||||
/**
|
||||
* @covers Acc_Operation::get_amount
|
||||
* @todo Implement testGet_amount
|
||||
*/
|
||||
function testGet_Amount()
|
||||
{
|
||||
33
unit-test/include/class/anc_grandlivre.Test.php
Normal file
33
unit-test/include/class/anc_grandlivre.Test.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2014-11-08 at 14:23:51.
|
||||
*/
|
||||
class Anc_GrandLivreTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Anc_GrandLivre
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
global $g_connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,114 +0,0 @@
|
|||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2014-11-08 at 14:23:51.
|
||||
*/
|
||||
class Anc_GrandLivreTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Anc_GrandLivre
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
global $g_connection;
|
||||
$this->object=new Anc_GrandLivre($g_connection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_GrandLivre::set_sql_filter
|
||||
*/
|
||||
public function testSet_sql_filter()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_GrandLivre::load
|
||||
* @todo Implement testLoad().
|
||||
*/
|
||||
public function testLoad()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_GrandLivre::load_csv
|
||||
* @todo Implement testLoad_csv().
|
||||
*/
|
||||
public function testLoad_csv()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_GrandLivre::button_export_pdf
|
||||
* @todo Implement testButton_export_pdf().
|
||||
*/
|
||||
public function testButton_export_pdf()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_GrandLivre::display_html
|
||||
* @todo Implement testDisplay_html().
|
||||
*/
|
||||
public function testDisplay_html()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_GrandLivre::show_button
|
||||
* @todo Implement testShow_button().
|
||||
*/
|
||||
public function testShow_button()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_GrandLivre::display_csv
|
||||
* @todo Implement testDisplay_csv().
|
||||
*/
|
||||
public function testDisplay_csv()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
34
unit-test/include/class/anc_key.Test.php
Normal file
34
unit-test/include/class/anc_key.Test.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2014-11-08 at 14:23:52.
|
||||
*/
|
||||
class Anc_KeyTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Anc_Key
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->object=new Anc_Key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,141 +0,0 @@
|
|||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2014-11-08 at 14:23:52.
|
||||
*/
|
||||
class Anc_KeyTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Anc_Key
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->object=new Anc_Key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Key::key_avaiable
|
||||
* @todo Implement testKey_avaiable().
|
||||
*/
|
||||
public function testKey_avaiable()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Key::display_choice
|
||||
* @todo Implement testDisplay_choice().
|
||||
*/
|
||||
public function testDisplay_choice()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Key::display_list
|
||||
* @todo Implement testDisplay_list().
|
||||
*/
|
||||
public function testDisplay_list()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Key::input
|
||||
* @todo Implement testInput().
|
||||
*/
|
||||
public function testInput()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Key::verify
|
||||
* @todo Implement testVerify().
|
||||
*/
|
||||
public function testVerify()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Key::save
|
||||
* @todo Implement testSave().
|
||||
*/
|
||||
public function testSave()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Key::fill_table
|
||||
* @todo Implement testFill_table().
|
||||
*/
|
||||
public function testFill_table()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Key::key_add
|
||||
* @todo Implement testKey_add().
|
||||
*/
|
||||
public function testKey_add()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Key::delete
|
||||
* @todo Implement testDelete().
|
||||
*/
|
||||
public function testDelete()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
34
unit-test/include/class/anc_operation.Test.php
Normal file
34
unit-test/include/class/anc_operation.Test.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2014-11-08 at 14:23:52.
|
||||
*/
|
||||
class Anc_OperationTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Anc_Operation
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
// $this->object=new Anc_Operation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,225 +0,0 @@
|
|||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2014-11-08 at 14:23:52.
|
||||
*/
|
||||
class Anc_OperationTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Anc_Operation
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->object=new Anc_Operation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Operation::add
|
||||
* @todo Implement testAdd().
|
||||
*/
|
||||
public function testAdd()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Operation::delete
|
||||
* @todo Implement testDelete().
|
||||
*/
|
||||
public function testDelete()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Operation::get_list
|
||||
* @todo Implement testGet_list().
|
||||
*/
|
||||
public function testGet_list()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Operation::html_table
|
||||
* @todo Implement testHtml_table().
|
||||
*/
|
||||
public function testHtml_table()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Operation::get_by_jid
|
||||
* @todo Implement testGet_by_jid().
|
||||
*/
|
||||
public function testGet_by_jid()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Operation::update_from_jrnx
|
||||
* @todo Implement testUpdate_from_jrnx().
|
||||
*/
|
||||
public function testUpdate_from_jrnx()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Operation::get_jrid
|
||||
* @todo Implement testGet_jrid().
|
||||
*/
|
||||
public function testGet_jrid()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Operation::get_balance
|
||||
* @todo Implement testGet_balance().
|
||||
*/
|
||||
public function testGet_balance()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Operation::display_form_plan
|
||||
* @todo Implement testDisplay_form_plan().
|
||||
*/
|
||||
public function testDisplay_form_plan()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Operation::save_form_plan_vat_nd
|
||||
* @todo Implement testSave_form_plan_vat_nd().
|
||||
*/
|
||||
public function testSave_form_plan_vat_nd()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Operation::save_form_plan
|
||||
* @todo Implement testSave_form_plan().
|
||||
*/
|
||||
public function testSave_form_plan()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Operation::save_update_form
|
||||
* @todo Implement testSave_update_form().
|
||||
*/
|
||||
public function testSave_update_form()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Operation::to_request
|
||||
* @todo Implement testTo_request().
|
||||
*/
|
||||
public function testTo_request()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Operation::delete_by_jid
|
||||
* @todo Implement testDelete_by_jid().
|
||||
*/
|
||||
public function testDelete_by_jid()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Operation::display_table
|
||||
* @todo Implement testDisplay_table().
|
||||
*/
|
||||
public function testDisplay_table()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Anc_Operation::test_me
|
||||
* @todo Implement testTest_me().
|
||||
*/
|
||||
public function testTest_me()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
199
unit-test/include/class/data/tax_summary_getrow_purchase_o.php
Normal file
199
unit-test/include/class/data/tax_summary_getrow_purchase_o.php
Normal file
|
|
@ -0,0 +1,199 @@
|
|||
<?php
|
||||
|
||||
$a_result=array (
|
||||
0 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Achat',
|
||||
'tva_label' => '0%',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '4',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '658.2500',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Achat',
|
||||
'tva_label' => '12%',
|
||||
'tva_rate' => '0.1200',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '2',
|
||||
'amount_vat' => '109.8000',
|
||||
'amount_wovat' => '915.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Achat',
|
||||
'tva_label' => '21%',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1',
|
||||
'amount_vat' => '44.5300',
|
||||
'amount_wovat' => '212.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'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',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '8',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '315.2000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
5 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Achat',
|
||||
'tva_label' => 'EXPORT',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '6',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '286.9500',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
6 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Achat',
|
||||
'tva_label' => 'IMMO',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1002',
|
||||
'amount_vat' => '319.2400',
|
||||
'amount_wovat' => '1520.2000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
7 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Achat',
|
||||
'tva_label' => 'VOIT',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1003',
|
||||
'amount_vat' => '21.0000',
|
||||
'amount_wovat' => '100.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
8 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Frais Divers',
|
||||
'tva_label' => '21%',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1',
|
||||
'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',
|
||||
),
|
||||
9 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Frais Divers',
|
||||
'tva_label' => 'EXPORT',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '6',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '259.8000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
10 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Frais Divers',
|
||||
'tva_label' => 'IMMO',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1002',
|
||||
'amount_vat' => '319.2400',
|
||||
'amount_wovat' => '1520.2000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
11 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Frais Divers',
|
||||
'tva_label' => 'INTRA',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '5',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '1250.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
12 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Frais Divers',
|
||||
'tva_label' => 'VOIT',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1003',
|
||||
'amount_vat' => '42.0000',
|
||||
'amount_wovat' => '200.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
);
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
$a_result= array (
|
||||
0 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Achat',
|
||||
'tva_label' => '0%',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '4',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '658.2500',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Achat',
|
||||
'tva_label' => '21%',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1',
|
||||
'amount_vat' => '38.4300',
|
||||
'amount_wovat' => '183.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
2 =>
|
||||
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_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
);
|
||||
198
unit-test/include/class/data/tax_summary_getrow_purchase_t.php
Normal file
198
unit-test/include/class/data/tax_summary_getrow_purchase_t.php
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
<?php
|
||||
$a_result= array (
|
||||
0 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Achat',
|
||||
'tva_label' => '0%',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '4',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '658.2500',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Achat',
|
||||
'tva_label' => '12%',
|
||||
'tva_rate' => '0.1200',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '2',
|
||||
'amount_vat' => '109.8000',
|
||||
'amount_wovat' => '915.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Achat',
|
||||
'tva_label' => '21%',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1',
|
||||
'amount_vat' => '44.5300',
|
||||
'amount_wovat' => '212.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'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',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '8',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '315.2000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
5 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Achat',
|
||||
'tva_label' => 'EXPORT',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '6',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '286.9500',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
6 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Achat',
|
||||
'tva_label' => 'IMMO',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1002',
|
||||
'amount_vat' => '319.2400',
|
||||
'amount_wovat' => '1520.2000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
7 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Achat',
|
||||
'tva_label' => 'VOIT',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1003',
|
||||
'amount_vat' => '21.0000',
|
||||
'amount_wovat' => '100.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
8 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Frais Divers',
|
||||
'tva_label' => '21%',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1',
|
||||
'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',
|
||||
),
|
||||
9 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Frais Divers',
|
||||
'tva_label' => 'EXPORT',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '6',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '259.8000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
10 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Frais Divers',
|
||||
'tva_label' => 'IMMO',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1002',
|
||||
'amount_vat' => '319.2400',
|
||||
'amount_wovat' => '1520.2000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
11 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Frais Divers',
|
||||
'tva_label' => 'INTRA',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '5',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '1250.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
12 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Frais Divers',
|
||||
'tva_label' => 'VOIT',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1003',
|
||||
'amount_vat' => '42.0000',
|
||||
'amount_wovat' => '200.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
);
|
||||
63
unit-test/include/class/data/tax_summary_getrow_sale_o.php
Normal file
63
unit-test/include/class/data/tax_summary_getrow_sale_o.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
$a_result = array (
|
||||
0 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Vente',
|
||||
'tva_label' => '21%',
|
||||
'qs_vat_code' => '1',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '219.5700',
|
||||
'amount_wovat' => '1045.6000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_type' => 'P',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Vente',
|
||||
'tva_label' => 'EXPORT',
|
||||
'qs_vat_code' => '6',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '1047.9000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_type' => 'O',
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Vente',
|
||||
'tva_label' => 'INTRA',
|
||||
'qs_vat_code' => '5',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '1800.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_type' => 'O',
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Vente',
|
||||
'tva_label' => 'VOIT',
|
||||
'qs_vat_code' => '1003',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '19.1500',
|
||||
'amount_wovat' => '91.2000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_type' => 'P',
|
||||
),
|
||||
4 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Vente différée',
|
||||
'tva_label' => 'EXPORT',
|
||||
'qs_vat_code' => '6',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '150.5600',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_type' => 'O',
|
||||
),
|
||||
);
|
||||
28
unit-test/include/class/data/tax_summary_getrow_sale_p.php
Normal file
28
unit-test/include/class/data/tax_summary_getrow_sale_p.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
$a_result =
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Vente',
|
||||
'tva_label' => '21%',
|
||||
'qs_vat_code' => '1',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '16.8000',
|
||||
'amount_wovat' => '80.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_type' => 'P',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Vente',
|
||||
'tva_label' => 'VOIT',
|
||||
'qs_vat_code' => '1003',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '10.7500',
|
||||
'amount_wovat' => '51.2000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_type' => 'P',
|
||||
),
|
||||
);
|
||||
64
unit-test/include/class/data/tax_summary_getrow_sale_t.php
Normal file
64
unit-test/include/class/data/tax_summary_getrow_sale_t.php
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
$a_result=
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Vente',
|
||||
'tva_label' => '21%',
|
||||
'qs_vat_code' => '1',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '219.5700',
|
||||
'amount_wovat' => '1045.6000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_type' => 'P',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Vente',
|
||||
'tva_label' => 'EXPORT',
|
||||
'qs_vat_code' => '6',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '1047.9000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_type' => 'O',
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Vente',
|
||||
'tva_label' => 'INTRA',
|
||||
'qs_vat_code' => '5',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '1800.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_type' => 'O',
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Vente',
|
||||
'tva_label' => 'VOIT',
|
||||
'qs_vat_code' => '1003',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '19.1500',
|
||||
'amount_wovat' => '91.2000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_type' => 'P',
|
||||
),
|
||||
4 =>
|
||||
array (
|
||||
'jrn_def_name' => 'Vente différée',
|
||||
'tva_label' => 'EXPORT',
|
||||
'qs_vat_code' => '6',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '150.5600',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_type' => 'O',
|
||||
),
|
||||
);
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
<?php
|
||||
$a_result=
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'tva_label' => '0%',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '4',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '658.2500',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'tva_label' => '12%',
|
||||
'tva_rate' => '0.1200',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '2',
|
||||
'amount_vat' => '109.8000',
|
||||
'amount_wovat' => '915.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'tva_label' => '21%',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1',
|
||||
'amount_vat' => '289.0800',
|
||||
'amount_wovat' => '1376.5400',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'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',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '8',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '315.2000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
5 =>
|
||||
array (
|
||||
'tva_label' => 'EXPORT',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '6',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '546.7500',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
6 =>
|
||||
array (
|
||||
'tva_label' => 'IMMO',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1002',
|
||||
'amount_vat' => '638.4800',
|
||||
'amount_wovat' => '3040.4000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
7 =>
|
||||
array (
|
||||
'tva_label' => 'INTRA',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '5',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '1250.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
8 =>
|
||||
array (
|
||||
'tva_label' => 'VOIT',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1003',
|
||||
'amount_vat' => '63.0000',
|
||||
'amount_wovat' => '300.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
);
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
$a_result = array (
|
||||
0 =>
|
||||
array (
|
||||
'tva_label' => '0%',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '4',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '658.2500',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'tva_label' => '21%',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1',
|
||||
'amount_vat' => '178.4700',
|
||||
'amount_wovat' => '849.8600',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
);
|
||||
|
|
@ -0,0 +1,129 @@
|
|||
<?php
|
||||
$a_result = array (
|
||||
0 =>
|
||||
array (
|
||||
'tva_label' => '0%',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '4',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '658.2500',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'tva_label' => '12%',
|
||||
'tva_rate' => '0.1200',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '2',
|
||||
'amount_vat' => '109.8000',
|
||||
'amount_wovat' => '915.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'tva_label' => '21%',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1',
|
||||
'amount_vat' => '289.0800',
|
||||
'amount_wovat' => '1376.5400',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'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',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '8',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '315.2000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
5 =>
|
||||
array (
|
||||
'tva_label' => 'EXPORT',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '6',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '546.7500',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
6 =>
|
||||
array (
|
||||
'tva_label' => 'IMMO',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1002',
|
||||
'amount_vat' => '638.4800',
|
||||
'amount_wovat' => '3040.4000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
7 =>
|
||||
array (
|
||||
'tva_label' => 'INTRA',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '5',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '1250.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
8 =>
|
||||
array (
|
||||
'tva_label' => 'VOIT',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'qp_vat_code' => '1003',
|
||||
'amount_vat' => '63.0000',
|
||||
'amount_wovat' => '300.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'amount_noded_amount' => '0.0000',
|
||||
'amount_noded_tax' => '0.0000',
|
||||
'amount_noded_return' => '0.0000',
|
||||
'amount_private' => '0.0000',
|
||||
),
|
||||
);
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
$a_result = array (
|
||||
0 =>
|
||||
array (
|
||||
'tva_label' => '21%',
|
||||
'qs_vat_code' => '1',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '219.5700',
|
||||
'amount_wovat' => '1045.6000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_payment_sale' => 'P',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'tva_label' => 'EXPORT',
|
||||
'qs_vat_code' => '6',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '1198.4600',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_payment_sale' => 'O',
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'tva_label' => 'INTRA',
|
||||
'qs_vat_code' => '5',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '1800.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_payment_sale' => 'O',
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'tva_label' => 'VOIT',
|
||||
'qs_vat_code' => '1003',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '19.1500',
|
||||
'amount_wovat' => '91.2000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_payment_sale' => 'P',
|
||||
),
|
||||
);
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
$a_result =
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'tva_label' => '21%',
|
||||
'qs_vat_code' => '1',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '16.8000',
|
||||
'amount_wovat' => '80.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_payment_sale' => 'P',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'tva_label' => 'VOIT',
|
||||
'qs_vat_code' => '1003',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '10.7500',
|
||||
'amount_wovat' => '51.2000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_payment_sale' => 'P',
|
||||
),
|
||||
);
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
$a_result =
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'tva_label' => '21%',
|
||||
'qs_vat_code' => '1',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '219.5700',
|
||||
'amount_wovat' => '1045.6000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_payment_sale' => 'O',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'tva_label' => 'EXPORT',
|
||||
'qs_vat_code' => '6',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '1198.4600',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_payment_sale' => 'O',
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'tva_label' => 'INTRA',
|
||||
'qs_vat_code' => '5',
|
||||
'tva_rate' => '0.0000',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '0.0000',
|
||||
'amount_wovat' => '1800.0000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_payment_sale' => 'O',
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'tva_label' => 'VOIT',
|
||||
'qs_vat_code' => '1003',
|
||||
'tva_rate' => '0.2100',
|
||||
'tva_both_side' => '0',
|
||||
'amount_vat' => '19.1500',
|
||||
'amount_wovat' => '91.2000',
|
||||
'amount_sided' => '0.0000',
|
||||
'tva_payment_sale' => 'O',
|
||||
),
|
||||
);
|
||||
40
unit-test/include/class/dossier.Test.php
Normal file
40
unit-test/include/class/dossier.Test.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-02-11 at 15:39:21.
|
||||
*/
|
||||
class DossierTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Dossier
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->object=new Dossier(DOSSIER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Dossier::synchro_admin
|
||||
*/
|
||||
public function testSynchro_admin()
|
||||
{
|
||||
Dossier::synchro_admin(DOSSIER);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,234 +0,0 @@
|
|||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-02-11 at 15:39:21.
|
||||
*/
|
||||
class DossierTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Dossier
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->object=new Dossier(DOSSIER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Dossier::id
|
||||
* @todo Implement testId().
|
||||
*/
|
||||
public function testId()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Dossier::show_dossier
|
||||
* @todo Implement testShow_dossier().
|
||||
*/
|
||||
public function testShow_dossier()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Dossier::count
|
||||
* @todo Implement testCount().
|
||||
*/
|
||||
public function testCount()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Dossier::get_user_folder
|
||||
* @todo Implement testGet_user_folder().
|
||||
*/
|
||||
public function testGet_user_folder()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Dossier::check
|
||||
* @todo Implement testCheck().
|
||||
*/
|
||||
public function testCheck()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Dossier::get
|
||||
* @todo Implement testGet().
|
||||
*/
|
||||
public function testGet()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Dossier::hidden
|
||||
* @todo Implement testHidden().
|
||||
*/
|
||||
public function testHidden()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Dossier::name
|
||||
* @todo Implement testName().
|
||||
*/
|
||||
public function testName()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Dossier::get_parameter
|
||||
* @todo Implement testGet_parameter().
|
||||
*/
|
||||
public function testGet_parameter()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Dossier::set_parameter
|
||||
* @todo Implement testSet_parameter().
|
||||
*/
|
||||
public function testSet_parameter()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Dossier::get_info
|
||||
* @todo Implement testGet_info().
|
||||
*/
|
||||
public function testGet_info()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Dossier::save
|
||||
* @todo Implement testSave().
|
||||
*/
|
||||
public function testSave()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Dossier::update
|
||||
* @todo Implement testUpdate().
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Dossier::load
|
||||
* @todo Implement testLoad().
|
||||
*/
|
||||
public function testLoad()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Dossier::get_version
|
||||
* @todo Implement testGet_version().
|
||||
*/
|
||||
public function testGet_version()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Dossier::connect
|
||||
* @todo Implement testConnect().
|
||||
*/
|
||||
public function testConnect()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Dossier::synchro_admin
|
||||
* @todo Implement testSynchro_admin().
|
||||
*/
|
||||
public function testSynchro_admin()
|
||||
{
|
||||
Dossier::synchro_admin(DOSSIER);
|
||||
}
|
||||
|
||||
}
|
||||
67
unit-test/include/class/fiche.Test.php
Normal file
67
unit-test/include/class/fiche.Test.php
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2014-11-07 at 23:05:36.
|
||||
* @backupGlobals enabled
|
||||
*/
|
||||
require 'global.php';
|
||||
class FicheTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Fiche
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::cmp_name
|
||||
* @todo Implement testCmp_name().
|
||||
*/
|
||||
public function testCmp_name()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::get_bk_account
|
||||
* @todo Implement testGet_bk_account().
|
||||
*/
|
||||
public function testGet_bk_account()
|
||||
{
|
||||
include 'global.php';
|
||||
$this->object=new Fiche($g_connection);
|
||||
$result=$this->object->get_bk_account();
|
||||
$this->assertEquals(gettype($result),'array');
|
||||
$count = count($result);
|
||||
$this->assertGreaterThan(0,$count);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::get_row
|
||||
*/
|
||||
public function testGet_row()
|
||||
{
|
||||
$this->assertTrue(is_array($this->object->get_row(235,238)));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,547 +0,0 @@
|
|||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2014-11-07 at 23:05:36.
|
||||
* @backupGlobals enabled
|
||||
*/
|
||||
require 'global.php';
|
||||
class FicheTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Fiche
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::cmp_name
|
||||
* @todo Implement testCmp_name().
|
||||
*/
|
||||
public function testCmp_name()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::get_bk_account
|
||||
* @todo Implement testGet_bk_account().
|
||||
*/
|
||||
public function testGet_bk_account()
|
||||
{
|
||||
include 'global.php';
|
||||
$this->object=new Fiche($g_connection);
|
||||
$result=$this->object->get_bk_account();
|
||||
$this->assertEquals(gettype($result),'array');
|
||||
$count = count($result);
|
||||
$this->assertGreaterThan(0,$count);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::get_by_qcode
|
||||
* @todo Implement testGet_by_qcode().
|
||||
*/
|
||||
public function testGet_by_qcode()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::setAttribut
|
||||
* @todo Implement testSetAttribut().
|
||||
*/
|
||||
public function testSetAttribut()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::getAttribut
|
||||
* @todo Implement testGetAttribut().
|
||||
*/
|
||||
public function testGetAttribut()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::seek
|
||||
* @todo Implement testSeek().
|
||||
*/
|
||||
public function testSeek()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::size
|
||||
* @todo Implement testSize().
|
||||
*/
|
||||
public function testSize()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::count_by_modele
|
||||
* @todo Implement testCount_by_modele().
|
||||
*/
|
||||
public function testCount_by_modele()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::GetByDef
|
||||
* @todo Implement testGetByDef().
|
||||
*/
|
||||
public function testGetByDef()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::ShowTable
|
||||
* @todo Implement testShowTable().
|
||||
*/
|
||||
public function testShowTable()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::strAttribut
|
||||
* @todo Implement testStrAttribut().
|
||||
*/
|
||||
public function testStrAttribut()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::to_array
|
||||
* @todo Implement testTo_array().
|
||||
*/
|
||||
public function testTo_array()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::blank
|
||||
* @todo Implement testBlank().
|
||||
*/
|
||||
public function testBlank()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::Display
|
||||
* @todo Implement testDisplay().
|
||||
*/
|
||||
public function testDisplay()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::Save
|
||||
* @todo Implement testSave().
|
||||
*/
|
||||
public function testSave()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::insert
|
||||
* @todo Implement testInsert().
|
||||
*/
|
||||
public function testInsert()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::update
|
||||
* @todo Implement testUpdate().
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::remove
|
||||
* @todo Implement testRemove().
|
||||
*/
|
||||
public function testRemove()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::getName
|
||||
* @todo Implement testGetName().
|
||||
*/
|
||||
public function testGetName()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::get_quick_code
|
||||
* @todo Implement testGet_quick_code().
|
||||
*/
|
||||
public function testGet_quick_code()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::Get
|
||||
* @todo Implement testGet().
|
||||
*/
|
||||
public function testGet()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::get_by_category
|
||||
* @todo Implement testGet_by_category().
|
||||
*/
|
||||
public function testGet_by_category()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::get_fiche_def_ref_id
|
||||
* @todo Implement testGet_fiche_def_ref_id().
|
||||
*/
|
||||
public function testGet_fiche_def_ref_id()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::get_row_date
|
||||
* @todo Implement testGet_row_date().
|
||||
*/
|
||||
public function testGet_row_date()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::get_row
|
||||
* @todo Implement testGet_row().
|
||||
*/
|
||||
public function testGet_row()
|
||||
{
|
||||
$this->object->get_row(235,238);
|
||||
|
||||
}
|
||||
/**
|
||||
* @covers Fiche::HtmlTableDetail
|
||||
* @todo Implement testHtmlTableDetail().
|
||||
*/
|
||||
public function testHtmlTableDetail()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::HtmlTable
|
||||
* @todo Implement testHtmlTable().
|
||||
*/
|
||||
public function testHtmlTable()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::HtmlTableHeader
|
||||
* @todo Implement testHtmlTableHeader().
|
||||
*/
|
||||
public function testHtmlTableHeader()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::get_solde_detail
|
||||
* @todo Implement testGet_solde_detail().
|
||||
*/
|
||||
public function testGet_solde_detail()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::get_bk_balance
|
||||
* @todo Implement testGet_bk_balance().
|
||||
*/
|
||||
public function testGet_bk_balance()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::empty_attribute
|
||||
* @todo Implement testEmpty_attribute().
|
||||
*/
|
||||
public function testEmpty_attribute()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::Summary
|
||||
* @todo Implement testSummary().
|
||||
*/
|
||||
public function testSummary()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::get_categorie
|
||||
* @todo Implement testGet_categorie().
|
||||
*/
|
||||
public function testGet_categorie()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::belong_ledger
|
||||
* @todo Implement testBelong_ledger().
|
||||
*/
|
||||
public function testBelong_ledger()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::get_fiche_def
|
||||
* @todo Implement testGet_fiche_def().
|
||||
*/
|
||||
public function testGet_fiche_def()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::is_used
|
||||
* @todo Implement testIs_used().
|
||||
*/
|
||||
public function testIs_used()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::delete
|
||||
* @todo Implement testDelete().
|
||||
*/
|
||||
public function testDelete()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::build_sql
|
||||
* @todo Implement testBuild_sql().
|
||||
*/
|
||||
public function testBuild_sql()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::move_to
|
||||
* @todo Implement testMove_to().
|
||||
*/
|
||||
public function testMove_to()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::get_amount_side
|
||||
* @todo Implement testGet_amount_side().
|
||||
*/
|
||||
public function testGet_amount_side()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::test_me
|
||||
* @todo Implement testTest_me().
|
||||
*/
|
||||
public function testTest_me()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::get_gestion_title
|
||||
* @todo Implement testGet_gestion_title().
|
||||
*/
|
||||
public function testGet_gestion_title()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Fiche::get_all_account
|
||||
* @todo Implement testGet_all_account().
|
||||
*/
|
||||
public function testGet_all_account()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
147
unit-test/include/class/print_LedgerTest.php
Normal file
147
unit-test/include/class/print_LedgerTest.php
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2002-2019) Author Dany De Bontridder <danydb@noalyss.eu>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief concerne print_LedgerTest
|
||||
* @coversDefaultClass Print_Ledger
|
||||
*/
|
||||
class print_LedgerTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
include 'global.php';
|
||||
// Exercice 2018
|
||||
$this->from=92;
|
||||
$this->to=103;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @covers ::factory
|
||||
*/
|
||||
function testFactory()
|
||||
{
|
||||
global $g_connection;
|
||||
$ledger_sale=new Acc_Ledger_Sold($g_connection,2);
|
||||
$p_from=$this->from;
|
||||
$p_to=$this->to;
|
||||
|
||||
// Check Sales
|
||||
$ledger=\Print_Ledger::factory($g_connection,"D", $ledger_sale, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Simple
|
||||
,"Sale Detail returns Print_Ledger_Simple");
|
||||
|
||||
$ledger=\Print_Ledger::factory($g_connection,"L", $ledger_sale, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Simple
|
||||
,"Sale Listing returns Print_Ledger_Simple");
|
||||
|
||||
$ledger=\Print_Ledger::factory($g_connection,"E", $ledger_sale, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail_Item
|
||||
,"Sale Extended returns Print_Ledger_Detail_Item");
|
||||
|
||||
$ledger=\Print_Ledger::factory($g_connection,"A", $ledger_sale, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail,
|
||||
"Sale Accounting returns Print_Ledger_Detail");
|
||||
|
||||
// Check Purchase
|
||||
$ledger_purchase=new Acc_Ledger_Purchase($g_connection,3);
|
||||
$ledger=\Print_Ledger::factory($g_connection,"D", $ledger_purchase, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Simple
|
||||
,"Purchase Detail returns Print_Ledger_Simple");
|
||||
|
||||
$ledger=\Print_Ledger::factory($g_connection,"L", $ledger_purchase, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Simple
|
||||
,"Purchase Listing returns Print_Ledger_Simple");
|
||||
|
||||
$ledger=\Print_Ledger::factory($g_connection,"E", $ledger_purchase, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail_Item
|
||||
,"Purchase Extended returns Print_Ledger_Detail_Item");
|
||||
|
||||
$ledger=\Print_Ledger::factory($g_connection,"A", $ledger_purchase, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail
|
||||
,"Purchase Accounting returns Print_Ledger_Detail");
|
||||
|
||||
// Check Misc
|
||||
$ledger_misc=new Acc_Ledger($g_connection,4);
|
||||
$ledger=\Print_Ledger::factory($g_connection,"D", $ledger_misc, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail
|
||||
,"Misc. Detail returns Print_Ledger_Detail");
|
||||
|
||||
$ledger=\Print_Ledger::factory($g_connection,"L", $ledger_misc, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Misc
|
||||
,"Misc. Listing returns Print_Ledger_Misc");
|
||||
|
||||
$ledger=\Print_Ledger::factory($g_connection,"E", $ledger_misc, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail
|
||||
,"Misc. Extended returns Print_Ledger_Detail");
|
||||
|
||||
$ledger=\Print_Ledger::factory($g_connection,"A", $ledger_misc, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail
|
||||
,"Misc. Accounting returns Print_Ledger_Detail");
|
||||
|
||||
// Financial
|
||||
$ledger_fin=new Acc_Ledger_Fin($g_connection,1);
|
||||
$ledger=\Print_Ledger::factory($g_connection,"D", $ledger_fin, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Financial
|
||||
,"Fin. Detail returns Print_Ledger_Financial");
|
||||
|
||||
$ledger=\Print_Ledger::factory($g_connection,"L", $ledger_fin, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Financial
|
||||
,"Fin. Detail returns Print_Ledger_Financial");
|
||||
|
||||
$ledger=\Print_Ledger::factory($g_connection,"E", $ledger_fin, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail
|
||||
,"Fin. Detail returns Print_Ledger_Financial");
|
||||
|
||||
$ledger=\Print_Ledger::factory($g_connection,"A", $ledger_fin, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail
|
||||
,"Fin. Detail returns Print_Ledger_Detail");
|
||||
|
||||
}
|
||||
//@covers \Print_Ledger::available_ledger
|
||||
function test_availableLedger()
|
||||
{
|
||||
$a_jrn=\Print_Ledger::available_ledger(94);
|
||||
$this->assertEquals(6,count($a_jrn),"Number of available ledger correct");
|
||||
}
|
||||
|
||||
}
|
||||
81
unit-test/include/class/print_ledger_detail.classTest.php
Normal file
81
unit-test/include/class/print_ledger_detail.classTest.php
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2002-2019) Author Dany De Bontridder <danydb@noalyss.eu>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief concerne print_ledger_detail
|
||||
* @coversDefaultClass Print_Ledger_Detail
|
||||
*/
|
||||
include_once 'global.php';
|
||||
|
||||
class Print_Ledger_DetailTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->from=92;
|
||||
$this->to=103;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
function test_export()
|
||||
{
|
||||
global $g_connection;
|
||||
$p_from=$this->from;
|
||||
$p_to=$this->to;
|
||||
|
||||
// Financial
|
||||
$ledger_fin=new Acc_Ledger($g_connection,4);
|
||||
$ledger=\Print_Ledger::factory($g_connection,"D", $ledger_fin, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail
|
||||
,"Misc. Detail returns Print_Ledger");
|
||||
|
||||
$ledger->setDossierInfo($ledger_fin->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/misc-detail.pdf","F");
|
||||
$this->assertFileExists(__DIR__."/file/misc-detail.pdf");
|
||||
}
|
||||
|
||||
}
|
||||
162
unit-test/include/class/print_ledger_detail_item.classTest.php
Normal file
162
unit-test/include/class/print_ledger_detail_item.classTest.php
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2002-2019) Author Dany De Bontridder <danydb@noalyss.eu>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief concerne print_ledger_detail_item.classTest
|
||||
* @coversDefaultClass print_ledger_detail_item
|
||||
*/
|
||||
class Print_Ledger_Detail_ItemTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
include 'global.php';
|
||||
$this->from=92;
|
||||
$this->to=103;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function test_Export()
|
||||
{
|
||||
global $g_connection;
|
||||
$p_from=$this->from;
|
||||
$p_to=$this->to;
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
// Purchase
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
$ledger_purchase=new Acc_Ledger_Purchase($g_connection,3);
|
||||
|
||||
// Paid
|
||||
//------------
|
||||
$ledger=\Print_Ledger::factory($g_connection, "E", $ledger_purchase, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail_Item
|
||||
, "Purchase Extended returns Print_Ledger_Detail_Item");
|
||||
|
||||
$ledger->setDossierInfo($ledger_purchase->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal Achat Payé"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/print_ledger_detail_purchase_paid.pdf","F");
|
||||
|
||||
// Unpaid
|
||||
//------------
|
||||
$ledger=\Print_Ledger::factory($g_connection, "E", $ledger_purchase, $p_from, $p_to, "unpaid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail_Item
|
||||
, "Purchase Extended returns Print_Ledger_Detail_Item");
|
||||
|
||||
$ledger->setDossierInfo($ledger_purchase->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal Non Payé"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/print_ledger_detail_purchase_unpaid.pdf","F");
|
||||
$this->assertFileExists(__DIR__."/file/print_ledger_detail_purchase_unpaid.pdf");
|
||||
|
||||
// All
|
||||
//------------
|
||||
$ledger=\Print_Ledger::factory($g_connection, "E", $ledger_purchase, $p_from, $p_to, "all");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail_Item
|
||||
, "Purchase Extended returns Print_Ledger_Detail_Item");
|
||||
|
||||
$ledger->setDossierInfo($ledger_purchase->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal Achat tous"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/print_ledger_detail_purchase_all.pdf","F");
|
||||
$this->assertFileExists(__DIR__."/file/print_ledger_detail_purchase_all.pdf");
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
// Sale
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
$ledger_sale=new Acc_Ledger_Sold($g_connection,2);
|
||||
|
||||
// Paid
|
||||
//-----------------
|
||||
$ledger=\Print_Ledger::factory($g_connection, "E", $ledger_sale, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail_Item
|
||||
, "Purchase Extended returns Print_Ledger_Detail_Item");
|
||||
|
||||
$ledger->setDossierInfo($ledger_sale->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal Vente Payé"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/print_ledger_detail_sale_paid.pdf","F");
|
||||
|
||||
// Unpaid
|
||||
//-----------------
|
||||
$ledger=\Print_Ledger::factory($g_connection, "E", $ledger_sale, $p_from, $p_to, "unpaid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail_Item
|
||||
, "Purchase Extended returns Print_Ledger_Detail_Item");
|
||||
|
||||
$ledger->setDossierInfo($ledger_sale->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal Non Payé"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/print_ledger_detail_sale_unpaid.pdf","F");
|
||||
$this->assertFileExists(__DIR__."/file/print_ledger_detail_sale_unpaid.pdf");
|
||||
|
||||
// All
|
||||
//-----------------
|
||||
$ledger=\Print_Ledger::factory($g_connection, "E", $ledger_sale, $p_from, $p_to, "all");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail_Item
|
||||
, "Purchase Extended returns Print_Ledger_Detail_Item");
|
||||
|
||||
$ledger->setDossierInfo($ledger_sale->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal Vente tous"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/print_ledger_detail_sale_all.pdf","F");
|
||||
$this->assertFileExists(__DIR__."/file/print_ledger_detail_sale_all.pdf");
|
||||
}
|
||||
|
||||
}
|
||||
111
unit-test/include/class/print_ledger_fin.classTest.php
Normal file
111
unit-test/include/class/print_ledger_fin.classTest.php
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2002-2019) Author Dany De Bontridder <danydb@noalyss.eu>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief concerne print_ledger_fin.classTest
|
||||
* @coversDefaultClass Print_Ledger_Fin
|
||||
*/
|
||||
class Print_Ledger_FinTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
include 'global.php';
|
||||
$this->from=92;
|
||||
$this->to=103;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
public function test_Export()
|
||||
{
|
||||
global $g_connection;
|
||||
$p_from=$this->from;
|
||||
$p_to=$this->to;
|
||||
|
||||
// Financial
|
||||
$ledger_fin=new Acc_Ledger_Fin($g_connection,1);
|
||||
$ledger=\Print_Ledger::factory($g_connection,"D", $ledger_fin, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Financial
|
||||
,"Fin. Detail returns Print_Ledger_Financial");
|
||||
|
||||
$ledger->setDossierInfo($ledger_fin->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/financial-detail.pdf","F");
|
||||
|
||||
$ledger=\Print_Ledger::factory($g_connection,"L", $ledger_fin, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Financial
|
||||
,"Fin. Detail returns Print_Ledger_Financial");
|
||||
$ledger->setDossierInfo($ledger_fin->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/financial-listing.pdf","F");
|
||||
|
||||
|
||||
$ledger=\Print_Ledger::factory($g_connection,"E", $ledger_fin, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail
|
||||
,"Fin. Detail returns Print_Ledger_Financial");
|
||||
$ledger->setDossierInfo($ledger_fin->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/financial-extended.pdf","F");
|
||||
|
||||
$ledger=\Print_Ledger::factory($g_connection,"A", $ledger_fin, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail
|
||||
,"Fin. Detail returns Print_Ledger_Detail");
|
||||
$ledger->setDossierInfo($ledger_fin->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/financial-accounting.pdf","F");
|
||||
}
|
||||
|
||||
}
|
||||
89
unit-test/include/class/print_ledger_misc.classTest.php
Normal file
89
unit-test/include/class/print_ledger_misc.classTest.php
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2002-2019) Author Dany De Bontridder <danydb@noalyss.eu>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief concerne print_ledger_misc.classTest
|
||||
*/
|
||||
class Print_Ledger_MiscTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
include 'global.php';
|
||||
// Exercice 2018
|
||||
$this->from=92;
|
||||
$this->to=103;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function test_export()
|
||||
{
|
||||
global $g_connection;
|
||||
$p_from=$this->from;
|
||||
$p_to=$this->to;
|
||||
|
||||
// Check Misc
|
||||
$ledger_misc=new Acc_Ledger($g_connection, 4);
|
||||
$ledger=\Print_Ledger::factory($g_connection, "D", $ledger_misc, $p_from, $p_to, "all");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail
|
||||
, "Misc. Detail returns Print_Ledger_Detail");
|
||||
|
||||
$ledger->setDossierInfo($ledger_misc->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal Opérations diverses "), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/print_ledger_detail_misc.pdf", "F");
|
||||
|
||||
$ledger=\Print_Ledger::factory($g_connection, "L", $ledger_misc, $p_from, $p_to, "all");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Misc
|
||||
, "Misc. Listing returns Print_Ledger_Misc");
|
||||
$ledger->setDossierInfo($ledger_misc->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal Opérations diverses"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/print_ledger_misc.pdf", "F");
|
||||
}
|
||||
|
||||
}
|
||||
166
unit-test/include/class/print_ledger_simple.classTest.php
Normal file
166
unit-test/include/class/print_ledger_simple.classTest.php
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2002-2019) Author Dany De Bontridder <danydb@noalyss.eu>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief concern Print_Ledger_Simple
|
||||
* @coversDefaultClass Print_Ledger_Simple
|
||||
*/
|
||||
class print_ledger_simpleTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
include 'global.php';
|
||||
// Exercice 2018
|
||||
$this->from=92;
|
||||
$this->to=103;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::export
|
||||
*/
|
||||
function test_export()
|
||||
{
|
||||
global $g_connection;
|
||||
$p_from=$this->from;
|
||||
$p_to=$this->to;
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
// Purchase
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
$ledger_purchase=new Acc_Ledger_Purchase($g_connection, 3);
|
||||
|
||||
// Paid
|
||||
//------------
|
||||
$ledger=\Print_Ledger::factory($g_connection, "E", $ledger_purchase, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail_Item
|
||||
, "Purchase Extended returns Print_Ledger_Detail_Item");
|
||||
|
||||
$ledger->setDossierInfo($ledger_purchase->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal Achat Payé"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/print_ledger_simple_purchase_paid.pdf", "F");
|
||||
|
||||
// Unpaid
|
||||
//------------
|
||||
$ledger=\Print_Ledger::factory($g_connection, "E", $ledger_purchase, $p_from, $p_to, "unpaid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail_Item
|
||||
, "Purchase Extended returns Print_Ledger_Detail_Item");
|
||||
|
||||
$ledger->setDossierInfo($ledger_purchase->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal Non Payé"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/print_ledger_simple_purchase_unpaid.pdf", "F");
|
||||
$this->assertFileExists(__DIR__."/file/print_ledger_simple_purchase_unpaid.pdf");
|
||||
|
||||
// All
|
||||
//------------
|
||||
$ledger=\Print_Ledger::factory($g_connection, "E", $ledger_purchase, $p_from, $p_to, "all");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail_Item
|
||||
, "Purchase Extended returns Print_Ledger_Detail_Item");
|
||||
|
||||
$ledger->setDossierInfo($ledger_purchase->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal Achat tous"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/print_ledger_simple_purchase_all.pdf", "F");
|
||||
$this->assertFileExists(__DIR__."/file/print_ledger_simple_purchase_all.pdf");
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
// Sale
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
$ledger_sale=new Acc_Ledger_Sold($g_connection, 2);
|
||||
|
||||
// Paid
|
||||
//-----------------
|
||||
$ledger=\Print_Ledger::factory($g_connection, "E", $ledger_sale, $p_from, $p_to, "paid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail_Item
|
||||
, "Purchase Extended returns Print_Ledger_Detail_Item");
|
||||
|
||||
$ledger->setDossierInfo($ledger_sale->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal Vente Payé"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/print_ledger_simple_sale_paid.pdf", "F");
|
||||
|
||||
// Unpaid
|
||||
//-----------------
|
||||
$ledger=\Print_Ledger::factory($g_connection, "E", $ledger_sale, $p_from, $p_to, "unpaid");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail_Item
|
||||
, "Purchase Extended returns Print_Ledger_Detail_Item");
|
||||
|
||||
$ledger->setDossierInfo($ledger_sale->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal Non Payé"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/print_ledger_simple_sale_unpaid.pdf", "F");
|
||||
$this->assertFileExists(__DIR__."/file/print_ledger_simple_sale_unpaid.pdf");
|
||||
|
||||
// All
|
||||
//-----------------
|
||||
$ledger=\Print_Ledger::factory($g_connection, "E", $ledger_sale, $p_from, $p_to, "all");
|
||||
$this->assertTrue($ledger instanceof Print_Ledger_Detail_Item
|
||||
, "Purchase Extended returns Print_Ledger_Detail_Item");
|
||||
|
||||
$ledger->setDossierInfo($ledger_sale->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal Vente tous"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/print_ledger_simple_sale_all.pdf", "F");
|
||||
$this->assertFileExists(__DIR__."/file/print_ledger_simple_sale_all.pdf");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2002-2019) Author Dany De Bontridder <danydb@noalyss.eu>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief concern print_ledger_simple_without_vat
|
||||
* @coversDefaultClass print_ledger_simple_without_vat
|
||||
*/
|
||||
class Print_Ledger_Simple_Without_VatTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
include 'global.php';
|
||||
// Exercice 2018
|
||||
$this->from=92;
|
||||
$this->to=103;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::export
|
||||
*/
|
||||
function test_export()
|
||||
{
|
||||
global $g_connection;
|
||||
$p_from=$this->from;
|
||||
$p_to=$this->to;
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
// Purchase
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
$ledger_purchase=new Acc_Ledger_Purchase($g_connection, 3);
|
||||
|
||||
// Paid
|
||||
//------------
|
||||
|
||||
$ledger=new Print_Ledger_Simple_Without_Vat($g_connection,
|
||||
$ledger_purchase, $p_from, $p_to, "paid");
|
||||
|
||||
$ledger->setDossierInfo($ledger_purchase->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal Achat Payé"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/print_Ledger_simple_without_vat_purchase_paid.pdf", "F");
|
||||
|
||||
// Unpaid
|
||||
//------------
|
||||
$ledger=new Print_Ledger_Simple_Without_Vat($g_connection,
|
||||
$ledger_purchase, $p_from, $p_to, "unpaid");
|
||||
|
||||
$ledger->setDossierInfo($ledger_purchase->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal Non Payé"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/print_Ledger_simple_without_vat_purchase_unpaid.pdf", "F");
|
||||
$this->assertFileExists(__DIR__."/file/print_Ledger_simple_without_vat_purchase_unpaid.pdf");
|
||||
|
||||
// All
|
||||
//------------
|
||||
$ledger=new Print_Ledger_Simple_Without_Vat($g_connection,
|
||||
$ledger_purchase, $p_from, $p_to, "all");
|
||||
|
||||
$ledger->setDossierInfo($ledger_purchase->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal Achat tous"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/print_Ledger_simple_without_vat_purchase_all.pdf", "F");
|
||||
$this->assertFileExists(__DIR__."/file/print_Ledger_simple_without_vat_purchase_all.pdf");
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
// Sale
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
$ledger_sale=new Acc_Ledger_Sold($g_connection, 2);
|
||||
|
||||
// Paid
|
||||
//-----------------
|
||||
$ledger=new Print_Ledger_Simple_Without_Vat($g_connection,
|
||||
$ledger_sale, $p_from, $p_to, "paid");
|
||||
|
||||
$ledger->setDossierInfo($ledger_sale->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal Vente Payé"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/print_Ledger_simple_without_vat_sale_paid.pdf", "F");
|
||||
|
||||
// Unpaid
|
||||
//-----------------
|
||||
$ledger=new Print_Ledger_Simple_Without_Vat($g_connection,
|
||||
$ledger_sale, $p_from, $p_to, "unpaid");
|
||||
|
||||
$ledger->setDossierInfo($ledger_sale->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal Non Payé"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/print_Ledger_simple_without_vat_sale_unpaid.pdf", "F");
|
||||
$this->assertFileExists(__DIR__."/file/print_Ledger_simple_without_vat_sale_unpaid.pdf");
|
||||
|
||||
// All
|
||||
//-----------------
|
||||
$ledger=new Print_Ledger_Simple_Without_Vat($g_connection,
|
||||
$ledger_sale, $p_from, $p_to, "all");
|
||||
|
||||
$ledger->setDossierInfo($ledger_sale->jrn_def_name);
|
||||
$ledger->AliasNbPages();
|
||||
$ledger->AddPage();
|
||||
$ledger->SetAuthor('NOALYSS');
|
||||
$ledger->setTitle(_("Journal Vente tous"), true);
|
||||
$ledger->export();
|
||||
$ledger->Output(__DIR__."/file/print_Ledger_simple_without_vat_sale_all.pdf", "F");
|
||||
$this->assertFileExists(__DIR__."/file/print_Ledger_simple_without_vat_sale_all.pdf");
|
||||
}
|
||||
|
||||
}
|
||||
267
unit-test/include/class/tax_summary.Test.php
Normal file
267
unit-test/include/class/tax_summary.Test.php
Normal file
|
|
@ -0,0 +1,267 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2002-2019) Author Dany De Bontridder <danydb@noalyss.eu>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief
|
||||
*/
|
||||
class Tax_SummaryTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Acc_Account
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
global $g_connection;
|
||||
$this->object=new \Tax_Summary($g_connection, "01.01.2014", "31.12.2019");
|
||||
}
|
||||
|
||||
function testCheck()
|
||||
{
|
||||
// No warning expected
|
||||
try
|
||||
{
|
||||
$this->object->check();
|
||||
$this->assertTrue(TRUE);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->assertSame('OK', $e->getMessage());
|
||||
}
|
||||
// Warning expected
|
||||
try
|
||||
{
|
||||
$this->object->set_date_start("01.01.2090");
|
||||
$this->object->check();
|
||||
$this->assertTrue(FALSE);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->assertTrue(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
function testDisplay()
|
||||
{
|
||||
$this->expectOutputRegex("/.*0,00.*\<\/tr\>\<\/table\>\n/");
|
||||
$this->object->display();
|
||||
}
|
||||
|
||||
function testForm_export_csv()
|
||||
{
|
||||
$this->expectOutputRegex("/\<form method=\"GET\".*/");
|
||||
$this->object->form_export_csv();
|
||||
}
|
||||
|
||||
function testForm_export_pdf()
|
||||
{
|
||||
$this->expectOutputRegex("/\<form method=\"GET\".*/");
|
||||
$this->object->form_export_pdf();
|
||||
}
|
||||
private function check_result ($p_scenario , $p_array,$p_array_expected,$jrn_type)
|
||||
{
|
||||
$nb_result=count($p_array_expected);
|
||||
$nb_array=count($p_array);
|
||||
$this->assertEquals($nb_result, $nb_array,$p_scenario);
|
||||
$ix=0;
|
||||
switch ($jrn_type)
|
||||
{
|
||||
case "ACH":
|
||||
$vat_code="qp_vat_code";
|
||||
break;
|
||||
case "SMRACH":
|
||||
$vat_code="qp_vat_code";
|
||||
break;
|
||||
case "VEN":
|
||||
$vat_code="qs_vat_code";
|
||||
break;
|
||||
case "SMRVEN":
|
||||
$vat_code="qs_vat_code";
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception(_("unknow jrn_type"));
|
||||
break;
|
||||
}
|
||||
for ($i=0; $i<$nb_result; $i++)
|
||||
{
|
||||
$row=$p_array_expected[$i];
|
||||
for ($e=0; $e<$nb_array; $e++)
|
||||
{
|
||||
$test_jrn_expected="";
|
||||
$test_jrn_result="";
|
||||
if ( in_array($jrn_type, ['ACH','VEN']))
|
||||
{
|
||||
$test_jrn_expected=$row['jrn_def_name'] ;
|
||||
$test_jrn_result=$p_array[$e]["jrn_def_name"];
|
||||
}
|
||||
if (
|
||||
$row[$vat_code]==$p_array[$e][$vat_code]
|
||||
&& $test_jrn_expected == $test_jrn_result
|
||||
)
|
||||
{
|
||||
$this->assertEquals($row['amount_vat'], $p_array[$e]['amount_vat']
|
||||
,sprintf("%s Code %s ",$p_scenario,$row[$vat_code]));
|
||||
|
||||
$this->assertEquals($row['amount_sided'], $p_array[$e]['amount_sided']
|
||||
,sprintf("%s Code %s ",$p_scenario,$row[$vat_code]));
|
||||
|
||||
$this->assertEquals($row['amount_wovat'], $p_array[$e]['amount_wovat']
|
||||
,sprintf("%s Code %s ",$p_scenario,$row[$vat_code]));
|
||||
|
||||
if ( $jrn_type=="ACH") {
|
||||
|
||||
$this->assertEquals($row['amount_noded_amount'], $p_array[$e]['amount_noded_amount']
|
||||
,sprintf("%s Code %s ",$p_scenario,$row[$vat_code]));
|
||||
$this->assertEquals($row['amount_noded_tax'], $p_array[$e]['amount_noded_tax']
|
||||
,sprintf("%s Code %s ",$p_scenario,$row[$vat_code]));
|
||||
$this->assertEquals($row['amount_noded_return'], $p_array[$e]['amount_noded_return']
|
||||
,sprintf("%s Code %s ",$p_scenario,$row[$vat_code]));
|
||||
$this->assertEquals($row['amount_private'], $p_array[$e]['amount_private']
|
||||
,sprintf("%s Code %s ",$p_scenario,$row[$vat_code]));
|
||||
}
|
||||
$ix++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->assertEquals($nb_array, $ix, 'Not all VAT CODE found');
|
||||
}
|
||||
function testGet_row_purchase()
|
||||
{
|
||||
// Operation date
|
||||
$this->object->set_tva_type("O");
|
||||
$array=$this->object->get_row_purchase();
|
||||
//-- For creating the array
|
||||
// Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_getrow_purchase.txt", var_export($array, TRUE));
|
||||
require __DIR__."/data/tax_summary_getrow_purchase_o.php";
|
||||
$this->check_result("tva_type = O , get_row_purchase",$array,$a_result,'ACH');
|
||||
|
||||
// Operation date
|
||||
$this->object->set_tva_type("P");
|
||||
$array=$this->object->get_row_purchase();
|
||||
//-- For creating the array
|
||||
// Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_getrow_purchase.txt", var_export($array, TRUE));
|
||||
require __DIR__."/data/tax_summary_getrow_purchase_p.php";
|
||||
$this->check_result("tva_type = P , get_row_purchase",$array,$a_result,'ACH');
|
||||
|
||||
$this->object->set_tva_type("T");
|
||||
$array=$this->object->get_row_purchase();
|
||||
//-- For creating the array
|
||||
// Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_getrow_purchase.txt", var_export($array, TRUE));
|
||||
require __DIR__."/data/tax_summary_getrow_purchase_t.php";
|
||||
$this->check_result("tva_type = T , get_row_purchase",$array,$a_result,'ACH');
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function testGet_row_sale()
|
||||
{
|
||||
$this->object->set_tva_type("O");
|
||||
$array=$this->object->get_row_sale();
|
||||
//-- For creating the array
|
||||
// Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_getrow_sale_o.txt", var_export($array, TRUE));
|
||||
require __DIR__."/data/tax_summary_getrow_sale_o.php";
|
||||
$this->check_result("tva_type = O , get_row_sale",$array,$a_result,'VEN');
|
||||
|
||||
|
||||
$this->object->set_tva_type("P");
|
||||
$array=$this->object->get_row_sale();
|
||||
//-- For creating the array
|
||||
//Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_getrow_sale_p.txt", var_export($array, TRUE));
|
||||
require __DIR__."/data/tax_summary_getrow_sale_p.php";
|
||||
$this->check_result("tva_type = P , get_row_sale",$array,$a_result,'VEN');
|
||||
|
||||
|
||||
$this->object->set_tva_type("T");
|
||||
$array=$this->object->get_row_sale();
|
||||
//-- For creating the array
|
||||
//Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_getrow_sale_t.txt", var_export($array, TRUE));
|
||||
require __DIR__."/data/tax_summary_getrow_sale_t.php";
|
||||
$this->check_result("tva_type = T , get_row_sale",$array,$a_result,'VEN');
|
||||
|
||||
}
|
||||
|
||||
function testget_summary_purchase()
|
||||
{
|
||||
$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));
|
||||
require __DIR__."/data/tax_summary_getsummary_purchase_t.php";
|
||||
$this->check_result("tva_type = T , get_summary_purchase",$array,$a_result,'SMRACH');
|
||||
|
||||
$this->object->set_tva_type("O");
|
||||
$array=$this->object->get_summary_purchase();
|
||||
//-- For creating the array
|
||||
// Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_getsummary_purchase_o.txt", var_export($array, TRUE));
|
||||
require __DIR__."/data/tax_summary_getsummary_purchase_o.php";
|
||||
$this->check_result("tva_type = O , get_summary_purchase",$array,$a_result,'SMRACH');
|
||||
|
||||
$this->object->set_tva_type("P");
|
||||
$array=$this->object->get_summary_purchase();
|
||||
//-- For creating the array
|
||||
// Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_getsummary_purchase_p.txt", var_export($array, TRUE));
|
||||
require __DIR__."/data/tax_summary_getsummary_purchase_p.php";
|
||||
$this->check_result("tva_type = P , get_summary_purchase",$array,$a_result,'SMRACH');
|
||||
|
||||
|
||||
}
|
||||
|
||||
function testget_summary_sale()
|
||||
{
|
||||
$this->object->set_tva_type("O");
|
||||
$array=$this->object->get_summary_sale();
|
||||
//-- For creating the array
|
||||
// Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_getsummary_sale_o.txt", var_export($array, TRUE));
|
||||
require __DIR__."/data/tax_summary_getsummary_sale_o.php";
|
||||
$this->check_result("tva_type = O , get_summary_sale",$array,$a_result,'SMRVEN');
|
||||
|
||||
$this->object->set_tva_type("P");
|
||||
$array=$this->object->get_summary_sale();
|
||||
//-- For creating the array
|
||||
// Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_getsummary_sale_p.txt", var_export($array, TRUE));
|
||||
require __DIR__."/data/tax_summary_getsummary_sale_p.php";
|
||||
$this->check_result("tva_type = P , get_summary_sale",$array,$a_result,'SMRVEN');
|
||||
|
||||
|
||||
$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));
|
||||
require __DIR__."/data/tax_summary_getsummary_sale_t.php";
|
||||
$this->check_result("tva_type = T , get_summary_sale",$array,$a_result,'SMRVEN');
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,655 +0,0 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2002-2019) Author Dany De Bontridder <danydb@noalyss.eu>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief
|
||||
*/
|
||||
class Tax_SummaryTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Acc_Account
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
global $g_connection;
|
||||
$this->object=new \Tax_Summary($g_connection, "01.01.2014", "31.12.2019");
|
||||
}
|
||||
|
||||
function testCheck()
|
||||
{
|
||||
// No warning expected
|
||||
try
|
||||
{
|
||||
$this->object->check();
|
||||
$this->assertTrue(TRUE);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->assertSame('OK', $e->getMessage());
|
||||
}
|
||||
// Warning expected
|
||||
try
|
||||
{
|
||||
$this->object->set_date_start("01.01.2090");
|
||||
$this->object->check();
|
||||
$this->assertTrue(FALSE);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->assertTrue(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
function testDisplay()
|
||||
{
|
||||
$this->expectOutputRegex("/.*0,00.*\<\/tr\>\<\/table\>\n/");
|
||||
$this->object->display();
|
||||
}
|
||||
|
||||
function testForm_export_csv()
|
||||
{
|
||||
$this->expectOutputRegex("/\<form method=\"GET\".*/");
|
||||
$this->object->form_export_csv();
|
||||
}
|
||||
|
||||
function testForm_export_pdf()
|
||||
{
|
||||
$this->expectOutputRegex("/\<form method=\"GET\".*/");
|
||||
$this->object->form_export_pdf();
|
||||
}
|
||||
|
||||
function testGet_row_purchase()
|
||||
{
|
||||
$array=$this->object->get_row_purchase();
|
||||
//-- For creating the array
|
||||
Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_getrow_purchase.txt", print_r($array, TRUE));
|
||||
$a_result=array
|
||||
(
|
||||
"0"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Achat",
|
||||
"tva_label"=>"0%",
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>4,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>658.2500,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"1"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Achat",
|
||||
"tva_label"=>"12%",
|
||||
"tva_rate"=>0.1200,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>2,
|
||||
"amount_vat"=>109.8000,
|
||||
"amount_wovat"=>915.0000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"2"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Achat",
|
||||
"tva_label"=>"21%",
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>1,
|
||||
"amount_vat"=>6.1000,
|
||||
"amount_wovat"=>29.0000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"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",
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>8,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>315.2000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"5"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Achat",
|
||||
"tva_label"=>"EXPORT",
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>6,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>286.9500,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"6"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Achat",
|
||||
"tva_label"=>"IMMO",
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>1002,
|
||||
"amount_vat"=>319.2400,
|
||||
"amount_wovat"=>1520.2000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"7"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Achat",
|
||||
"tva_label"=>"VOIT",
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>1003,
|
||||
"amount_vat"=>21.0000,
|
||||
"amount_wovat"=>100.0000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"8"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Frais Divers",
|
||||
"tva_label"=>"21%",
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>1,
|
||||
"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
|
||||
),
|
||||
"9"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Frais Divers",
|
||||
"tva_label"=>"EXPORT",
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>6,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>259.8000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"10"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Frais Divers",
|
||||
"tva_label"=>"IMMO",
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>1002,
|
||||
"amount_vat"=>319.2400,
|
||||
"amount_wovat"=>1520.2000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"11"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Frais Divers",
|
||||
"tva_label"=>"INTRA",
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>5,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>1250.0000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"12"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Frais Divers",
|
||||
"tva_label"=>"VOIT",
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>1003,
|
||||
"amount_vat"=>42.0000,
|
||||
"amount_wovat"=>200.0000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000,
|
||||
)
|
||||
);
|
||||
$nb_result=count($a_result);
|
||||
$nb_array=count($array);
|
||||
$this->assertEquals($nb_result, $nb_array);
|
||||
$ix=0;
|
||||
for ($i=0; $i<$nb_result; $i++)
|
||||
{
|
||||
$row=$a_result[$i];
|
||||
for ($e=0; $e<$nb_array; $e++)
|
||||
{
|
||||
if (
|
||||
$row['qp_vat_code']==$array[$e]['qp_vat_code']
|
||||
&& $row['jrn_def_name'] == $array[$e]["jrn_def_name"]
|
||||
)
|
||||
{
|
||||
$this->assertEquals($row['amount_vat'], $array[$e]['amount_vat']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_wovat'], $array[$e]['amount_wovat']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_sided'], $array[$e]['amount_sided']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_noded_amount'], $array[$e]['amount_noded_amount']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_noded_tax'], $array[$e]['amount_noded_tax']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_noded_return'], $array[$e]['amount_noded_return']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_private'], $array[$e]['amount_private']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$ix++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->assertEquals($nb_array, $ix, 'Not all VAT CODE found');
|
||||
}
|
||||
|
||||
function testGet_row_sale()
|
||||
{
|
||||
$array=$this->object->get_row_sale();
|
||||
//-- For creating the array
|
||||
//Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_getrow_sale.txt", print_r($array, TRUE));
|
||||
$a_result=array
|
||||
(
|
||||
"0"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Vente",
|
||||
"tva_label"=>"21%",
|
||||
"qs_vat_code"=>1,
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"amount_vat"=>219.5700,
|
||||
"amount_wovat"=>1045.6000,
|
||||
"amount_sided"=>0.0000
|
||||
),
|
||||
"1"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Vente",
|
||||
"tva_label"=>"EXPORT",
|
||||
"qs_vat_code"=>6,
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>1047.9000,
|
||||
"amount_sided"=>0.0000
|
||||
),
|
||||
"2"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Vente",
|
||||
"tva_label"=>"INTRA",
|
||||
"qs_vat_code"=>5,
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>1800.0000,
|
||||
"amount_sided"=>0.0000
|
||||
),
|
||||
"3"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Vente",
|
||||
"tva_label"=>"VOIT",
|
||||
"qs_vat_code"=>1003,
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"amount_vat"=>8.4000,
|
||||
"amount_wovat"=>40.0000,
|
||||
"amount_sided"=>0.0000
|
||||
),
|
||||
"4"=>Array
|
||||
(
|
||||
"jrn_def_name"=>"Vente différée",
|
||||
"tva_label"=>"EXPORT",
|
||||
"qs_vat_code"=>6,
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>150.5600,
|
||||
"amount_sided"=>0.0000
|
||||
)
|
||||
);
|
||||
$nb_result=count($a_result);
|
||||
$nb_array=count($array);
|
||||
$this->assertEquals($nb_result, $nb_array);
|
||||
$ix=0;
|
||||
for ($i=0; $i<$nb_result; $i++)
|
||||
{
|
||||
$row=$a_result[$i];
|
||||
for ($e=0; $e<$nb_array; $e++)
|
||||
{
|
||||
if (
|
||||
$row['qs_vat_code']==$array[$e]['qs_vat_code']&&$row['jrn_def_name']==$array[$e]["jrn_def_name"]
|
||||
)
|
||||
{
|
||||
$this->assertEquals($row['amount_vat'], $array[$e]['amount_vat']
|
||||
, sprintf("Code %s ", $row['qs_vat_code']));
|
||||
$this->assertEquals($row['amount_wovat'], $array[$e]['amount_wovat']
|
||||
, sprintf("Code %s ", $row['qs_vat_code']));
|
||||
$this->assertEquals($row['amount_sided'], $array[$e]['amount_sided']
|
||||
, sprintf("Code %s ", $row['qs_vat_code']));
|
||||
$ix++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->assertEquals($nb_array, $ix, 'Not all VAT CODE found');
|
||||
}
|
||||
|
||||
function testget_summary_purchase()
|
||||
{
|
||||
$array=$this->object->get_summary_purchase();
|
||||
//-- For creating the array
|
||||
// \Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_summary_purchase.txt", print_r($array, TRUE));
|
||||
$a_result=array
|
||||
(
|
||||
"0"=>array
|
||||
(
|
||||
"tva_label"=>"0%",
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>4,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>658.2500,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"1"=>array
|
||||
(
|
||||
"tva_label"=>"12%",
|
||||
"tva_rate"=>0.1200,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>2,
|
||||
"amount_vat"=>109.8000,
|
||||
"amount_wovat"=>915.0000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"2"=>array
|
||||
(
|
||||
"tva_label"=>"21%",
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>1,
|
||||
"amount_vat"=>250.6500,
|
||||
"amount_wovat"=>1193.5400,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"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,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>8,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>315.2000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"5"=>array
|
||||
(
|
||||
"tva_label"=>"EXPORT",
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>6,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>546.7500,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"6"=>array
|
||||
(
|
||||
"tva_label"=>"IMMO",
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>1002,
|
||||
"amount_vat"=>638.4800,
|
||||
"amount_wovat"=>3040.4000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"7"=>array
|
||||
(
|
||||
"tva_label"=>"INTRA",
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>5,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>1250.0000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"8"=>array
|
||||
(
|
||||
"tva_label"=>"VOIT",
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>1003,
|
||||
"amount_vat"=>63.0000,
|
||||
"amount_wovat"=>300.0000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
)
|
||||
);
|
||||
$nb_result=count($a_result);
|
||||
$nb_array=count($array);
|
||||
$this->assertEquals($nb_result, $nb_array);
|
||||
$ix=0;
|
||||
for ($i=0; $i<$nb_result; $i++)
|
||||
{
|
||||
$row=$a_result[$i];
|
||||
for ($e=0; $e<$nb_array; $e++)
|
||||
{
|
||||
if ($row['qp_vat_code']==$array[$e]['qp_vat_code'])
|
||||
{
|
||||
$this->assertEquals($row['amount_vat'], $array[$e]['amount_vat']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_wovat'], $array[$e]['amount_wovat']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_sided'], $array[$e]['amount_sided']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_noded_amount'], $array[$e]['amount_noded_amount']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_noded_tax'], $array[$e]['amount_noded_tax']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_noded_return'], $array[$e]['amount_noded_return']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_private'], $array[$e]['amount_private']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$ix++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->assertEquals($nb_array, $ix, 'Not all VAT CODE found');
|
||||
}
|
||||
|
||||
function testget_summary_sale()
|
||||
{
|
||||
$array=$this->object->get_summary_sale();
|
||||
//-- For creating the array
|
||||
// Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_summary_sale.txt", print_r($array, TRUE));
|
||||
|
||||
$a_result=array
|
||||
(
|
||||
array
|
||||
(
|
||||
"tva_label"=>"21%",
|
||||
"qs_vat_code"=>1,
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"amount_vat"=>219.5700,
|
||||
"amount_wovat"=>1045.6000,
|
||||
"amount_sided"=>0.0000
|
||||
),
|
||||
array
|
||||
(
|
||||
"tva_label"=>"EXPORT",
|
||||
"qs_vat_code"=>6,
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>1198.4600,
|
||||
"amount_sided"=>0.0000
|
||||
),
|
||||
array
|
||||
(
|
||||
"tva_label"=>"INTRA",
|
||||
"qs_vat_code"=>5,
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>1800.0000,
|
||||
"amount_sided"=>0.0000
|
||||
),
|
||||
array
|
||||
(
|
||||
"tva_label"=>"VOIT",
|
||||
"qs_vat_code"=>1003,
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"amount_vat"=>8.4000,
|
||||
"amount_wovat"=>40.0000,
|
||||
"amount_sided"=>0.0000
|
||||
)
|
||||
);
|
||||
$nb_result=count($a_result);
|
||||
$nb_array=count($array);
|
||||
$this->assertEquals($nb_result, $nb_array);
|
||||
$ix=0;
|
||||
for ($i=0; $i<$nb_result; $i++)
|
||||
{
|
||||
$row=$a_result[$i];
|
||||
for ($e=0; $e<$nb_array; $e++)
|
||||
{
|
||||
if ($row['qs_vat_code']==$array[$e]['qs_vat_code'])
|
||||
{
|
||||
$this->assertEquals($row['amount_vat'], $array[$e]['amount_vat']
|
||||
,sprintf("Code %s ",$row['qs_vat_code']));
|
||||
$this->assertEquals($row['amount_wovat'], $array[$e]['amount_wovat']
|
||||
,sprintf("Code %s ",$row['qs_vat_code']));
|
||||
$this->assertEquals($row['amount_sided'], $array[$e]['amount_sided']
|
||||
,sprintf("Code %s ",$row['qs_vat_code']));
|
||||
$ix++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->assertEquals($nb_array, $ix, 'Not all VAT CODE found');
|
||||
}
|
||||
|
||||
}
|
||||
116
unit-test/include/class/user.Test.php
Normal file
116
unit-test/include/class/user.Test.php
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
define('USE_ID', 999999);
|
||||
define('USE_FIRST_NAME', 'Unit test');
|
||||
define('USE_NAME', 'UNIT');
|
||||
define('USE_LOGIN', 'unit-test');
|
||||
define('USE_ACTIVE', 1);
|
||||
define('USE_PASS', 'passord');
|
||||
define('USE_ADMIN', 0);
|
||||
define('USE_EMAIL', 'none@dev.null.eu');
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-02-10 at 22:48:23.
|
||||
*/
|
||||
class UserTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var User
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
// create database connx :
|
||||
$this->cn=new Database();
|
||||
// create a user
|
||||
$this->cn->exec_sql('delete from jnt_use_dos where use_id=$1',
|
||||
array(USE_ID));
|
||||
$this->cn->exec_sql('delete from ac_users where use_id=$1',
|
||||
array(USE_ID));
|
||||
$this->cn->exec_sql('insert into ac_users (use_id,use_first_name,use_name,use_login,use_active,use_pass,use_admin,use_email) values ($1,$2,$3,$4,$5,$6,$7,$8)',
|
||||
array(USE_ID, USE_FIRST_NAME, USE_NAME, USE_LOGIN, USE_ACTIVE, USE_PASS,
|
||||
USE_ADMIN, USE_EMAIL));
|
||||
|
||||
$this->object=new User($this->cn, USE_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
//drop user
|
||||
$this->cn->exec_sql('delete from jnt_use_dos where use_id=$1',
|
||||
array(USE_ID));
|
||||
$this->cn->exec_sql('delete from ac_users where use_id = $1',
|
||||
array(USE_ID));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::load
|
||||
*/
|
||||
public function testLoad()
|
||||
{
|
||||
|
||||
$this->object->load();
|
||||
$this->assertEquals($this->object->id, USE_ID);
|
||||
$this->assertEquals($this->object->name, USE_NAME);
|
||||
$this->assertEquals($this->object->first_name, USE_FIRST_NAME);
|
||||
$this->assertEquals($this->object->login, USE_LOGIN);
|
||||
$this->assertEquals($this->object->active, USE_ACTIVE);
|
||||
$this->assertEquals($this->object->password, USE_PASS);
|
||||
$this->assertEquals($this->object->admin, USE_ADMIN);
|
||||
$this->assertEquals($this->object->email, USE_EMAIL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::revoke_access
|
||||
* @todo Implement testRevoke_access().
|
||||
*/
|
||||
public function testRevoke_access()
|
||||
{
|
||||
$cn_dossier=new Database(DOSSIER);
|
||||
User::revoke_access(USE_LOGIN, DOSSIER);
|
||||
$this->assertEquals($cn_dossier->get_value('select count(*) from profile_user where user_name =$1 ',
|
||||
array(USE_LOGIN)), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::grant_admin_access
|
||||
* @todo Implement testGrant_admin_access()
|
||||
*/
|
||||
public function testGrant_admin_access()
|
||||
{
|
||||
$cn_dossier=new Database(DOSSIER);
|
||||
User::grant_admin_access(USE_LOGIN, DOSSIER);
|
||||
|
||||
$this->assertEquals($cn_dossier->get_value('select count(*) from profile_user where user_name =$1 ',
|
||||
array(USE_LOGIN)), 1);
|
||||
}
|
||||
/**
|
||||
* @covers User::remove_inexistant_user
|
||||
*/
|
||||
public function testRemove_inexistant_user() {
|
||||
// insert inexisting user
|
||||
$cn=new Database (DOSSIER);
|
||||
$cn->exec_sql('insert into profile_user (user_name,p_id) values ($1,$2)',
|
||||
array('unknown/user',1));
|
||||
|
||||
//verify presence of it in DOSSIER
|
||||
$this->assertEquals($cn->get_value('select count(*) from profile_user where user_name=$1',array('unknown/user')),1);
|
||||
|
||||
//remove him
|
||||
User::remove_inexistant_user(DOSSIER);
|
||||
|
||||
// check his removal
|
||||
$this->assertEquals($cn->get_value('select count(*) from profile_user where user_name=$1',array('unknown/user')),0);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,645 +0,0 @@
|
|||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
define('USE_ID', 999999);
|
||||
define('USE_FIRST_NAME', 'Unit test');
|
||||
define('USE_NAME', 'UNIT');
|
||||
define('USE_LOGIN', 'unit-test');
|
||||
define('USE_ACTIVE', 1);
|
||||
define('USE_PASS', 'passord');
|
||||
define('USE_ADMIN', 0);
|
||||
define('USE_EMAIL', 'none@dev.null.eu');
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-02-10 at 22:48:23.
|
||||
*/
|
||||
class UserTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var User
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
// create database connx :
|
||||
$this->cn=new Database();
|
||||
// create a user
|
||||
$this->cn->exec_sql('delete from jnt_use_dos where use_id=$1',
|
||||
array(USE_ID));
|
||||
$this->cn->exec_sql('delete from ac_users where use_id=$1',
|
||||
array(USE_ID));
|
||||
$this->cn->exec_sql('insert into ac_users (use_id,use_first_name,use_name,use_login,use_active,use_pass,use_admin,use_email) values ($1,$2,$3,$4,$5,$6,$7,$8)',
|
||||
array(USE_ID, USE_FIRST_NAME, USE_NAME, USE_LOGIN, USE_ACTIVE, USE_PASS,
|
||||
USE_ADMIN, USE_EMAIL));
|
||||
|
||||
$this->object=new User($this->cn, USE_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
//drop user
|
||||
$this->cn->exec_sql('delete from jnt_use_dos where use_id=$1',
|
||||
array(USE_ID));
|
||||
$this->cn->exec_sql('delete from ac_users where use_id = $1',
|
||||
array(USE_ID));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::load
|
||||
* @todo Implement testLoad().
|
||||
*/
|
||||
public function testLoad()
|
||||
{
|
||||
|
||||
$this->object->load();
|
||||
$this->assertEquals($this->object->id, USE_ID);
|
||||
$this->assertEquals($this->object->name, USE_NAME);
|
||||
$this->assertEquals($this->object->first_name, USE_FIRST_NAME);
|
||||
$this->assertEquals($this->object->login, USE_LOGIN);
|
||||
$this->assertEquals($this->object->active, USE_ACTIVE);
|
||||
$this->assertEquals($this->object->password, USE_PASS);
|
||||
$this->assertEquals($this->object->admin, USE_ADMIN);
|
||||
$this->assertEquals($this->object->email, USE_EMAIL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::save
|
||||
* @todo Implement testSave().
|
||||
*/
|
||||
public function testSave()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::insert
|
||||
* @todo Implement testInsert().
|
||||
*/
|
||||
public function testInsert()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::Check
|
||||
* @todo Implement testCheck().
|
||||
*/
|
||||
public function testCheck()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::get_folder_access
|
||||
* @todo Implement testGet_folder_access().
|
||||
*/
|
||||
public function testGet_folder_access()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::set_folder_access
|
||||
* @todo Implement testSet_folder_access().
|
||||
*/
|
||||
public function testSet_folder_access()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::get_ledger_access
|
||||
* @todo Implement testGet_ledger_access().
|
||||
*/
|
||||
public function testGet_ledger_access()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::get_ledger
|
||||
* @todo Implement testGet_ledger().
|
||||
*/
|
||||
public function testGet_ledger()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::get_ledger_sql
|
||||
* @todo Implement testGet_ledger_sql().
|
||||
*/
|
||||
public function testGet_ledger_sql()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::Admin
|
||||
* @todo Implement testAdmin().
|
||||
*/
|
||||
public function testAdmin()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::set_periode
|
||||
* @todo Implement testSet_periode().
|
||||
*/
|
||||
public function testSet_periode()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::get_periode
|
||||
* @todo Implement testGet_periode().
|
||||
*/
|
||||
public function testGet_periode()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::get_mini_report
|
||||
* @todo Implement testGet_mini_report().
|
||||
*/
|
||||
public function testGet_mini_report()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::set_mini_report
|
||||
* @todo Implement testSet_mini_report().
|
||||
*/
|
||||
public function testSet_mini_report()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::save_global_preference
|
||||
* @todo Implement testSave_global_preference().
|
||||
*/
|
||||
public function testSave_global_preference()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::get_preference
|
||||
* @todo Implement testGet_preference().
|
||||
*/
|
||||
public function testGet_preference()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::check_module
|
||||
* @todo Implement testCheck_module().
|
||||
*/
|
||||
public function testCheck_module()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::check_action
|
||||
* @todo Implement testCheck_action().
|
||||
*/
|
||||
public function testCheck_action()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::load_global_pref
|
||||
* @todo Implement testLoad_global_pref().
|
||||
*/
|
||||
public function testLoad_global_pref()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::insert_default_global_pref
|
||||
* @todo Implement testInsert_default_global_pref().
|
||||
*/
|
||||
public function testInsert_default_global_pref()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::update_global_pref
|
||||
* @todo Implement testUpdate_global_pref().
|
||||
*/
|
||||
public function testUpdate_global_pref()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::get_exercice
|
||||
* @todo Implement testGet_exercice().
|
||||
*/
|
||||
public function testGet_exercice()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::can_request
|
||||
* @todo Implement testCan_request().
|
||||
*/
|
||||
public function testCan_request()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::check_print
|
||||
* @todo Implement testCheck_print().
|
||||
*/
|
||||
public function testCheck_print()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::can_print
|
||||
* @todo Implement testCan_print().
|
||||
*/
|
||||
public function testCan_print()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::is_local_admin
|
||||
* @todo Implement testIs_local_admin().
|
||||
*/
|
||||
public function testIs_local_admin()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::get_available_repository
|
||||
* @todo Implement testGet_available_repository().
|
||||
*/
|
||||
public function testGet_available_repository()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::get_list
|
||||
* @todo Implement testGet_list().
|
||||
*/
|
||||
public function testGet_list()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::check_jrn
|
||||
* @todo Implement testCheck_jrn().
|
||||
*/
|
||||
public function testCheck_jrn()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::check_dossier
|
||||
* @todo Implement testCheck_dossier().
|
||||
*/
|
||||
public function testCheck_dossier()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::get_limit_current_exercice
|
||||
* @todo Implement testGet_limit_current_exercice().
|
||||
*/
|
||||
public function testGet_limit_current_exercice()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::show_dossier
|
||||
* @todo Implement testShow_dossier().
|
||||
*/
|
||||
public function testShow_dossier()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::get_available_folder
|
||||
* @todo Implement testGet_available_folder().
|
||||
*/
|
||||
public function testGet_available_folder()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::audit
|
||||
* @todo Implement testAudit().
|
||||
*/
|
||||
public function testAudit()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::save_profile
|
||||
* @todo Implement testSave_profile().
|
||||
*/
|
||||
public function testSave_profile()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::get_profile
|
||||
* @todo Implement testGet_profile().
|
||||
*/
|
||||
public function testGet_profile()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::get_writable_profile
|
||||
* @todo Implement testGet_writable_profile().
|
||||
*/
|
||||
public function testGet_writable_profile()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::get_readable_profile
|
||||
* @todo Implement testGet_readable_profile().
|
||||
*/
|
||||
public function testGet_readable_profile()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::can_add_action
|
||||
* @todo Implement testCan_add_action().
|
||||
*/
|
||||
public function testCan_add_action()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::can_write_action
|
||||
* @todo Implement testCan_write_action().
|
||||
*/
|
||||
public function testCan_write_action()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::can_read_action
|
||||
* @todo Implement testCan_read_action().
|
||||
*/
|
||||
public function testCan_read_action()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::can_write_repo
|
||||
* @todo Implement testCan_write_repo().
|
||||
*/
|
||||
public function testCan_write_repo()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::can_read_repo
|
||||
* @todo Implement testCan_read_repo().
|
||||
*/
|
||||
public function testCan_read_repo()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::save_password
|
||||
* @todo Implement testSave_password().
|
||||
*/
|
||||
public function testSave_password()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::save_email
|
||||
* @todo Implement testSave_email().
|
||||
*/
|
||||
public function testSave_email()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::revoke_access
|
||||
* @todo Implement testRevoke_access().
|
||||
*/
|
||||
public function testRevoke_access()
|
||||
{
|
||||
$cn_dossier=new Database(DOSSIER);
|
||||
User::revoke_access(USE_LOGIN, DOSSIER);
|
||||
$this->assertEquals($cn_dossier->get_value('select count(*) from profile_user where user_name =$1 ',
|
||||
array(USE_LOGIN)), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers User::grant_admin_access
|
||||
* @todo Implement testGrant_admin_access()
|
||||
*/
|
||||
public function testGrant_admin_access()
|
||||
{
|
||||
$cn_dossier=new Database(DOSSIER);
|
||||
User::grant_admin_access(USE_LOGIN, DOSSIER);
|
||||
|
||||
$this->assertEquals($cn_dossier->get_value('select count(*) from profile_user where user_name =$1 ',
|
||||
array(USE_LOGIN)), 1);
|
||||
}
|
||||
/**
|
||||
* @covers User::remove_inexistant_user
|
||||
*/
|
||||
public function testRemove_inexistant_user() {
|
||||
// insert inexisting user
|
||||
$cn=new Database (DOSSIER);
|
||||
$cn->exec_sql('insert into profile_user (user_name,p_id) values ($1,$2)',
|
||||
array('unknown/user',1));
|
||||
|
||||
//verify presence of it in DOSSIER
|
||||
$this->assertEquals($cn->get_value('select count(*) from profile_user where user_name=$1',array('unknown/user')),1);
|
||||
|
||||
//remove him
|
||||
User::remove_inexistant_user(DOSSIER);
|
||||
|
||||
// check his removal
|
||||
$this->assertEquals($cn->get_value('select count(*) from profile_user where user_name=$1',array('unknown/user')),0);
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,11 @@ help(){
|
|||
echo " -f filename , file to test"
|
||||
echo " -i function , optional filter to a function"
|
||||
}
|
||||
PHPUNIT=./phpunit
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
CUR_DIR=`pwd`
|
||||
PHPUNIT=$CUR_DIR/phpunit
|
||||
FILETOTEST=""
|
||||
FUNCTION=""
|
||||
while getopts "f:i:" opt; do
|
||||
|
|
@ -34,9 +38,11 @@ fi
|
|||
|
||||
if [ ! -z "$FUNCTION" ] ; then
|
||||
echo "testing $FILETOTEST $FUNCTION"
|
||||
$PHPUNIT --bootstrap bootstrap.php --verbose --color --filter $FUNCTION $FILETOTEST
|
||||
$PHPUNIT --bootstrap $CUR_DIR/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 $CUR_DIR/bootstrap.php --whitelist=$CUR_DIR/../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