Nouveau #0002178: Cotisation de solidarité
Impression : Listing (HTML, CSV et PDF) Impression : Extended (HTML, CSV et PDF) Negatif amount and currency
This commit is contained in:
parent
7256f1464d
commit
56d2622714
16 changed files with 399 additions and 51 deletions
|
|
@ -387,11 +387,19 @@ abstract class Acc_Ledger_History
|
||||||
$prepare=$this->db->is_prepare("supp_tax_info");
|
$prepare=$this->db->is_prepare("supp_tax_info");
|
||||||
if ( $prepare == false ){
|
if ( $prepare == false ){
|
||||||
$this->db->prepare("supp_tax_info","
|
$this->db->prepare("supp_tax_info","
|
||||||
select j_montant,jt1.ac_id,ac_label,ac_rate,j_poste
|
select
|
||||||
|
case when j.j_debit is false and jd.jrn_def_type='ACH' then 0-j_montant
|
||||||
|
when j.j_debit is true and jd.jrn_def_type='VEN' then 0-j_montant
|
||||||
|
else j.j_montant end j_montant,
|
||||||
|
jt1.ac_id,
|
||||||
|
ac_label,
|
||||||
|
ac_rate,j_poste
|
||||||
from
|
from
|
||||||
jrn_tax jt1
|
jrn_tax jt1
|
||||||
join acc_other_tax using (ac_id)
|
join acc_other_tax using (ac_id)
|
||||||
join jrnx using (j_id) where j_grpt=$1
|
join jrnx j using (j_id)
|
||||||
|
join jrn_def jd on (j.j_jrn_def=jd.jrn_def_id)
|
||||||
|
where j_grpt=$1
|
||||||
");
|
");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,17 @@
|
||||||
class Acc_Ledger_History_Purchase extends Acc_Ledger_History
|
class Acc_Ledger_History_Purchase extends Acc_Ledger_History
|
||||||
{
|
{
|
||||||
|
|
||||||
private $data; //!< Contains rows from SQL
|
private $data;//!< Contains rows from SQL
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $data
|
||||||
|
*/
|
||||||
|
public function set_data($data)
|
||||||
|
{
|
||||||
|
//!< Contains rows from SQL
|
||||||
|
$this->data = $data;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function __construct(\Database $cn, $pa_ledger, $p_from, $p_to,
|
public function __construct(\Database $cn, $pa_ledger, $p_from, $p_to,
|
||||||
$p_mode)
|
$p_mode)
|
||||||
|
|
@ -71,6 +81,7 @@ class Acc_Ledger_History_Purchase extends Acc_Ledger_History
|
||||||
{
|
{
|
||||||
$this->get_row();
|
$this->get_row();
|
||||||
$this->add_vat_info();
|
$this->add_vat_info();
|
||||||
|
$this->add_additional_tax_info();
|
||||||
$this->prepare_detail();
|
$this->prepare_detail();
|
||||||
$this->prepare_reconcile_date();
|
$this->prepare_reconcile_date();
|
||||||
include NOALYSS_TEMPLATE."/acc_ledger_history_purchase_extended.php";
|
include NOALYSS_TEMPLATE."/acc_ledger_history_purchase_extended.php";
|
||||||
|
|
@ -107,6 +118,7 @@ class Acc_Ledger_History_Purchase extends Acc_Ledger_History
|
||||||
{
|
{
|
||||||
$this->get_row();
|
$this->get_row();
|
||||||
$this->prepare_reconcile_date();
|
$this->prepare_reconcile_date();
|
||||||
|
$nb_other_tax=$this->has_other_tax();
|
||||||
require_once NOALYSS_TEMPLATE.'/acc_ledger_history_purchase_oneline.php';
|
require_once NOALYSS_TEMPLATE.'/acc_ledger_history_purchase_oneline.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -146,13 +158,19 @@ class Acc_Ledger_History_Purchase extends Acc_Ledger_History
|
||||||
from
|
from
|
||||||
operation_currency
|
operation_currency
|
||||||
join jrnx using (j_id)
|
join jrnx using (j_id)
|
||||||
|
join quant_purchase qp using (j_id)
|
||||||
group by j_grpt
|
group by j_grpt
|
||||||
)
|
),
|
||||||
|
other_tax as (select sum(case when j_debit is true
|
||||||
|
then j_montant else 0-j_montant end) other_tax_amount
|
||||||
|
,j_grpt
|
||||||
|
from jrnx j1
|
||||||
|
join jrn_tax jt2 on (j1.j_id=jt2.j_id) group by j_grpt)
|
||||||
select
|
select
|
||||||
name,
|
name,
|
||||||
first_name,
|
first_name,
|
||||||
qcode,
|
qcode,
|
||||||
jr_id,
|
jrn.jr_id,
|
||||||
jr_pj_number,
|
jr_pj_number,
|
||||||
to_char(jr_date,'DD.MM.YYYY') as str_date,
|
to_char(jr_date,'DD.MM.YYYY') as str_date,
|
||||||
to_char(jr_date,'DDMMYY') as str_date_short,
|
to_char(jr_date,'DDMMYY') as str_date_short,
|
||||||
|
|
@ -175,7 +193,8 @@ class Acc_Ledger_History_Purchase extends Acc_Ledger_History
|
||||||
jrn.currency_rate_ref,
|
jrn.currency_rate_ref,
|
||||||
sum_oc_amount,
|
sum_oc_amount,
|
||||||
sum_oc_vat_amount,
|
sum_oc_vat_amount,
|
||||||
cr_code_iso
|
cr_code_iso,
|
||||||
|
coalesce (other_tax_amount,0) other_tax_amount
|
||||||
from
|
from
|
||||||
jrn
|
jrn
|
||||||
join row_purchase on (qp_internal=jr_internal)
|
join row_purchase on (qp_internal=jr_internal)
|
||||||
|
|
@ -183,6 +202,7 @@ class Acc_Ledger_History_Purchase extends Acc_Ledger_History
|
||||||
left join jrn_note using (jr_id)
|
left join jrn_note using (jr_id)
|
||||||
left join row_currency as rc on (rc.j_grpt = jrn.jr_grpt_id)
|
left join row_currency as rc on (rc.j_grpt = jrn.jr_grpt_id)
|
||||||
left join currency as c on (c.id=jrn.currency_id)
|
left join currency as c on (c.id=jrn.currency_id)
|
||||||
|
left join other_tax as ot on (ot.j_grpt=jrn.jr_grpt_id)
|
||||||
where
|
where
|
||||||
jr_def_id in ({$ledger_list})
|
jr_def_id in ({$ledger_list})
|
||||||
{$sql_filter}
|
{$sql_filter}
|
||||||
|
|
@ -260,12 +280,17 @@ class Acc_Ledger_History_Purchase extends Acc_Ledger_History
|
||||||
{
|
{
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief export Purchase in CSV
|
||||||
|
*/
|
||||||
function export_csv()
|
function export_csv()
|
||||||
{
|
{
|
||||||
// Prepare the query for reconcile date
|
// Prepare the query for reconcile date
|
||||||
$prepared_query=new Prepared_Query($this->db);
|
$prepared_query=new Prepared_Query($this->db);
|
||||||
$prepared_query->prepare_reconcile_date();
|
$prepared_query->prepare_reconcile_date();
|
||||||
|
$nb_other_tax=$this->has_other_tax();
|
||||||
|
|
||||||
$export=new Noalyss_Csv(_('journal'));
|
$export=new Noalyss_Csv(_('journal'));
|
||||||
$export->send_header();
|
$export->send_header();
|
||||||
|
|
||||||
|
|
@ -287,8 +312,8 @@ class Acc_Ledger_History_Purchase extends Acc_Ledger_History
|
||||||
$title[]=_("DNA");
|
$title[]=_("DNA");
|
||||||
$title[]=_("tva non ded.");
|
$title[]=_("tva non ded.");
|
||||||
$title[]=_("TVA NP");
|
$title[]=_("TVA NP");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ( $own->MY_TVA_USE=='Y')
|
if ( $own->MY_TVA_USE=='Y')
|
||||||
{
|
{
|
||||||
|
|
@ -298,13 +323,16 @@ class Acc_Ledger_History_Purchase extends Acc_Ledger_History
|
||||||
$title[]="Tva ".$line_tva['tva_label'];
|
$title[]="Tva ".$line_tva['tva_label'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($nb_other_tax>0) {
|
||||||
|
$title[]=_("Autre taxe");
|
||||||
|
}
|
||||||
$title[]=_("TVAC/TTC");
|
$title[]=_("TVAC/TTC");
|
||||||
$title[]=_("Devise");
|
$title[]=_("Devise");
|
||||||
$title[]=_("Devise HTVA");
|
$title[]=_("Devise HTVA");
|
||||||
$title[]=_("Devise TVA");
|
$title[]=_("Devise TVA");
|
||||||
$title[]=_("Taux ref");
|
$title[]=_("Taux ref");
|
||||||
$title[]=_("Taux utilisé");
|
$title[]=_("Taux utilisé");
|
||||||
$title[]=_("Date paiement");
|
$title[]=_("Date paiement");
|
||||||
$title[]=_("Code paiement");
|
$title[]=_("Code paiement");
|
||||||
$title[]=_("Méthode paiement");
|
$title[]=_("Méthode paiement");
|
||||||
$title[]=_("Montant paiement");
|
$title[]=_("Montant paiement");
|
||||||
|
|
@ -349,7 +377,11 @@ class Acc_Ledger_History_Purchase extends Acc_Ledger_History
|
||||||
$export->add($a_tva_amount[$a], "number");
|
$export->add($a_tva_amount[$a], "number");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$export->add($line['tvac'],"number");
|
if ( $nb_other_tax > 0)
|
||||||
|
{
|
||||||
|
$export->add($line['other_tax_amount'],"number");
|
||||||
|
}
|
||||||
|
$export->add(bcadd($line['other_tax_amount'],$line['tvac'],2),"number");
|
||||||
/**
|
/**
|
||||||
* Add currency info
|
* Add currency info
|
||||||
*/
|
*/
|
||||||
|
|
@ -374,7 +406,7 @@ class Acc_Ledger_History_Purchase extends Acc_Ledger_History
|
||||||
$export->add($row['jr_internal']);
|
$export->add($row['jr_internal']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$export->write();
|
$export->write();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
|
||||||
{
|
{
|
||||||
$this->get_row();
|
$this->get_row();
|
||||||
$this->add_vat_info();
|
$this->add_vat_info();
|
||||||
|
$this->add_additional_tax_info();
|
||||||
$this->prepare_detail();
|
$this->prepare_detail();
|
||||||
$this->prepare_reconcile_date();
|
$this->prepare_reconcile_date();
|
||||||
include NOALYSS_TEMPLATE."/acc_ledger_history_sale_extended.php";
|
include NOALYSS_TEMPLATE."/acc_ledger_history_sale_extended.php";
|
||||||
|
|
@ -141,8 +142,14 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
|
||||||
from
|
from
|
||||||
operation_currency
|
operation_currency
|
||||||
join jrnx using (j_id)
|
join jrnx using (j_id)
|
||||||
|
join quant_sold using (j_id)
|
||||||
group by j_grpt
|
group by j_grpt
|
||||||
)
|
),
|
||||||
|
other_tax as (select sum(case when j_debit is false
|
||||||
|
then j_montant else 0-j_montant end) as other_tax_amount,
|
||||||
|
j_grpt
|
||||||
|
from jrnx j1
|
||||||
|
join jrn_tax jt2 on (j1.j_id=jt2.j_id) group by j_grpt)
|
||||||
select
|
select
|
||||||
name,
|
name,
|
||||||
first_name,
|
first_name,
|
||||||
|
|
@ -166,13 +173,15 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
|
||||||
jrn.currency_rate_ref,
|
jrn.currency_rate_ref,
|
||||||
sum_oc_amount,
|
sum_oc_amount,
|
||||||
sum_oc_vat_amount,
|
sum_oc_vat_amount,
|
||||||
cr_code_iso
|
cr_code_iso,
|
||||||
|
coalesce (other_tax_amount,0) other_tax_amount
|
||||||
from
|
from
|
||||||
jrn
|
jrn
|
||||||
join row_sale on (qs_internal=jr_internal)
|
join row_sale on (qs_internal=jr_internal)
|
||||||
join client_detail on (qs_client=f_id)
|
join client_detail on (qs_client=f_id)
|
||||||
left join row_currency as rc on (rc.j_grpt = jrn.jr_grpt_id)
|
left join row_currency as rc on (rc.j_grpt = jrn.jr_grpt_id)
|
||||||
left join currency as c on (c.id=jrn.currency_id)
|
left join currency as c on (c.id=jrn.currency_id)
|
||||||
|
left join other_tax as ot on (ot.j_grpt=jrn.jr_grpt_id)
|
||||||
where
|
where
|
||||||
jr_def_id in ({$ledger_list})
|
jr_def_id in ({$ledger_list})
|
||||||
{$sql_filter}
|
{$sql_filter}
|
||||||
|
|
@ -210,6 +219,7 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
|
||||||
$this->data[$i]["detail_vat"]=$array;
|
$this->data[$i]["detail_vat"]=$array;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief display in HTML following the mode
|
* @brief display in HTML following the mode
|
||||||
*/
|
*/
|
||||||
|
|
@ -241,6 +251,7 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
|
||||||
{
|
{
|
||||||
$this->get_row();
|
$this->get_row();
|
||||||
$this->prepare_reconcile_date();
|
$this->prepare_reconcile_date();
|
||||||
|
$nb_other_tax=$this->has_other_tax();
|
||||||
require_once NOALYSS_TEMPLATE.'/acc_ledger_history_sale_oneline.php';
|
require_once NOALYSS_TEMPLATE.'/acc_ledger_history_sale_oneline.php';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -252,6 +263,11 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
|
||||||
{
|
{
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
function set_data($p_data)
|
||||||
|
{
|
||||||
|
$this->data=$p_data;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* export in csv with detail VAT
|
* export in csv with detail VAT
|
||||||
*/
|
*/
|
||||||
|
|
@ -259,7 +275,8 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
|
||||||
{
|
{
|
||||||
$export=new Noalyss_Csv(_('journal'));
|
$export=new Noalyss_Csv(_('journal'));
|
||||||
$export->send_header();
|
$export->send_header();
|
||||||
|
$nb_other_tax=$this->has_other_tax();
|
||||||
|
|
||||||
$this->get_row();
|
$this->get_row();
|
||||||
$this->prepare_reconcile_date();
|
$this->prepare_reconcile_date();
|
||||||
$this->add_vat_info();
|
$this->add_vat_info();
|
||||||
|
|
@ -285,6 +302,9 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
|
||||||
$title[]="Tva ".$line_tva['tva_label'];
|
$title[]="Tva ".$line_tva['tva_label'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($nb_other_tax>0) {
|
||||||
|
$title[]=_("Autre tx");
|
||||||
|
}
|
||||||
$title[]=_("TVAC/TTC");
|
$title[]=_("TVAC/TTC");
|
||||||
$title[]=_("Devise");
|
$title[]=_("Devise");
|
||||||
$title[]=_("Devise HTVA");
|
$title[]=_("Devise HTVA");
|
||||||
|
|
@ -333,7 +353,11 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
|
||||||
$export->add($a_tva_amount[$a],"number");
|
$export->add($a_tva_amount[$a],"number");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$export->add($line['tvac'],"number");
|
if ( $nb_other_tax > 0)
|
||||||
|
{
|
||||||
|
$export->add($line['other_tax_amount'],"number");
|
||||||
|
}
|
||||||
|
$export->add(bcadd($line['other_tax_amount'],$line['tvac'],2),"number");
|
||||||
/**
|
/**
|
||||||
* Add currency info
|
* Add currency info
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -2095,6 +2095,7 @@ EOF;
|
||||||
$array['j_poste'] = _('Poste');
|
$array['j_poste'] = _('Poste');
|
||||||
$array['j_text'] = _('Commentaire');
|
$array['j_text'] = _('Commentaire');
|
||||||
$array['j_qcode'] = _('Code Item');
|
$array['j_qcode'] = _('Code Item');
|
||||||
|
$array['jr_rapt'] = _('Payé');
|
||||||
$array['item_card'] = _('N° fiche');
|
$array['item_card'] = _('N° fiche');
|
||||||
$array['item_name'] = _('Nom fiche');
|
$array['item_name'] = _('Nom fiche');
|
||||||
$array['qp_supplier'] = _('N° fiche fournisseur');
|
$array['qp_supplier'] = _('N° fiche fournisseur');
|
||||||
|
|
@ -2115,6 +2116,7 @@ EOF;
|
||||||
$array['htva'] = _('HTVA Opération');
|
$array['htva'] = _('HTVA Opération');
|
||||||
$array['tot_vat'] = _('TVA Opération');
|
$array['tot_vat'] = _('TVA Opération');
|
||||||
$array['tot_tva_np'] = _('TVA NP opération');
|
$array['tot_tva_np'] = _('TVA NP opération');
|
||||||
|
$array['other_tax'] = _("Autre taxe");
|
||||||
$array['oc_amount'] = _('Mont. Devise');
|
$array['oc_amount'] = _('Mont. Devise');
|
||||||
$array['oc_vat_amount'] = _('Mont. TVA Devise');
|
$array['oc_vat_amount'] = _('Mont. TVA Devise');
|
||||||
$array['cr_code_iso'] = _('Devise');
|
$array['cr_code_iso'] = _('Devise');
|
||||||
|
|
|
||||||
|
|
@ -1648,7 +1648,8 @@ EOF;
|
||||||
$array['j_poste'] = _('Poste');
|
$array['j_poste'] = _('Poste');
|
||||||
$array['j_text'] = _('Commentaire');
|
$array['j_text'] = _('Commentaire');
|
||||||
$array['j_qcode'] = _('Code Item');
|
$array['j_qcode'] = _('Code Item');
|
||||||
$array['item_card'] = _('N° fiche');
|
$array['jr_rapt'] = _('Payé');
|
||||||
|
$array['item_card'] = _('N° item');
|
||||||
$array['item_name'] = _('Nom fiche');
|
$array['item_name'] = _('Nom fiche');
|
||||||
$array['qs_client'] = _('N° fiche fournisseur');
|
$array['qs_client'] = _('N° fiche fournisseur');
|
||||||
$array['tiers_name'] = _('Nom fournisseur');
|
$array['tiers_name'] = _('Nom fournisseur');
|
||||||
|
|
@ -1665,9 +1666,11 @@ EOF;
|
||||||
$array['htva'] = _('HTVA Opération');
|
$array['htva'] = _('HTVA Opération');
|
||||||
$array['tot_vat'] = _('TVA Opération');
|
$array['tot_vat'] = _('TVA Opération');
|
||||||
$array['tot_vat_np'] = _('TVA ND');
|
$array['tot_vat_np'] = _('TVA ND');
|
||||||
|
$array['other_tax'] = _("Autre taxe");
|
||||||
$array['oc_amount'] = _('Mont. Devise');
|
$array['oc_amount'] = _('Mont. Devise');
|
||||||
$array['oc_vat_amount'] = _('Mont. TVA Devise');
|
$array['oc_vat_amount'] = _('Mont. TVA Devise');
|
||||||
$array['cr_code_iso'] = _('Devise');
|
$array['cr_code_iso'] = _('Devise');
|
||||||
|
|
||||||
|
|
||||||
return $array;
|
return $array;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,24 +40,37 @@ class Additional_Tax
|
||||||
$this->ac_rate=$ac_rate;
|
$this->ac_rate=$ac_rate;
|
||||||
$this->ac_accounting=$ac_accounting;
|
$this->ac_accounting=$ac_accounting;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @brief create an array of Additional_Tax
|
||||||
|
* @param $p_jrn_id
|
||||||
|
* @param $sum_euro
|
||||||
|
* @param $sum_currency
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
static function get_by_operation($p_jrn_id,&$sum_euro,&$sum_currency)
|
static function get_by_operation($p_jrn_id,&$sum_euro,&$sum_currency)
|
||||||
{
|
{
|
||||||
bcscale(4);
|
bcscale(4);
|
||||||
global $cn;
|
global $cn;
|
||||||
$array = $cn->get_array('select j_montant,currency_id,
|
$array = $cn->get_array("select
|
||||||
oc.oc_amount,
|
case when j_debit is false and jn.jrn_def_type='ACH' then 0-j_montant
|
||||||
|
when j_debit is true and jn.jrn_def_type='VEN' then 0-j_montant
|
||||||
|
else j_montant end j_montant,
|
||||||
|
jrn.currency_id,
|
||||||
|
oc_amount,
|
||||||
jt.ac_id,
|
jt.ac_id,
|
||||||
|
jrnx.j_debit,
|
||||||
aot.ac_label,
|
aot.ac_label,
|
||||||
aot.ac_rate,
|
aot.ac_rate,
|
||||||
aot.ac_accounting
|
aot.ac_accounting,
|
||||||
|
jn.jrn_def_type
|
||||||
from jrn_tax jt
|
from jrn_tax jt
|
||||||
join jrnx using (j_id)
|
join jrnx using (j_id)
|
||||||
join jrn on (jrnx.j_grpt=jrn.jr_grpt_id)
|
join jrn on (jrnx.j_grpt=jrn.jr_grpt_id)
|
||||||
|
join jrn_def jn on (jrn.jr_def_id=jn.jrn_def_id)
|
||||||
join acc_other_tax aot on (jt.ac_id=aot.ac_id)
|
join acc_other_tax aot on (jt.ac_id=aot.ac_id)
|
||||||
left join operation_currency oc ON (oc.j_id=jt.j_id)
|
left join operation_currency oc ON (oc.j_id=jt.j_id)
|
||||||
where
|
where
|
||||||
jr_id=$1', [$p_jrn_id]);
|
jr_id=$1", [$p_jrn_id]);
|
||||||
$sum_currency=0;$sum_euro=0;
|
$sum_currency=0;$sum_euro=0;
|
||||||
if (empty($array)) { return array();}
|
if (empty($array)) { return array();}
|
||||||
$nb=count($array);
|
$nb=count($array);
|
||||||
|
|
@ -77,6 +90,14 @@ class Additional_Tax
|
||||||
$sum_euro=round($sum_euro,2);
|
$sum_euro=round($sum_euro,2);
|
||||||
return $a_additional_tax;
|
return $a_additional_tax;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief display the additional_tax in the ledger_detail for Sales and Purchase
|
||||||
|
* @param $p_jrn_id
|
||||||
|
* @param $sum_euro
|
||||||
|
* @param $sum_currency
|
||||||
|
* @param int $decalage
|
||||||
|
*/
|
||||||
static function display_row($p_jrn_id,&$sum_euro,&$sum_currency,$decalage=0)
|
static function display_row($p_jrn_id,&$sum_euro,&$sum_currency,$decalage=0)
|
||||||
{
|
{
|
||||||
$a_additional_tax=Additional_Tax::get_by_operation($p_jrn_id,$sum_euro,$sum_currency);
|
$a_additional_tax=Additional_Tax::get_by_operation($p_jrn_id,$sum_euro,$sum_currency);
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ class Print_Ledger_Detail_Item extends Print_Ledger
|
||||||
$this->Cell(80, $high, _('Libellé'),0,'L',false);
|
$this->Cell(80, $high, _('Libellé'),0,'L',false);
|
||||||
$this->Cell(20, $high, _('Tot HTVA'), 0, 0, 'R', false);
|
$this->Cell(20, $high, _('Tot HTVA'), 0, 0, 'R', false);
|
||||||
$this->Cell(20, $high, _('Tot TVA NP'), 0, 0, 'R', false);
|
$this->Cell(20, $high, _('Tot TVA NP'), 0, 0, 'R', false);
|
||||||
$this->Cell(20, $high, "", 0, 0, 'R', false);
|
$this->Cell(20, $high, _("Autre Tx"), 0, 0, 'R', false);
|
||||||
$this->Cell(20, $high, _('Tot TVA'), 0, 0, 'R', false);
|
$this->Cell(20, $high, _('Tot TVA'), 0, 0, 'R', false);
|
||||||
$this->Cell(20, $high, _('TVAC'), 0, 0, 'R', false);
|
$this->Cell(20, $high, _('TVAC'), 0, 0, 'R', false);
|
||||||
$this->Ln(6);
|
$this->Ln(6);
|
||||||
|
|
@ -117,16 +117,18 @@ class Print_Ledger_Detail_Item extends Print_Ledger
|
||||||
$row=Database::fetch_array($ret_detail, $i);
|
$row=Database::fetch_array($ret_detail, $i);
|
||||||
if ($internal != $row['jr_internal'])
|
if ($internal != $row['jr_internal'])
|
||||||
{
|
{
|
||||||
|
|
||||||
// Print the general info line width=270mm
|
// Print the general info line width=270mm
|
||||||
$this->LongLine(20, $high, $row['jr_date'],1, 'L', true);
|
$this->LongLine(20, $high, $row['jr_date'],1, 'L', true);
|
||||||
$this->write_cell(20, $high, $row['jr_internal'], 1, 0, 'L', true);
|
$this->write_cell(20, $high,$row['jr_pj_number'].".". $row['jr_internal'], 1, 0, 'L', true);
|
||||||
$this->LongLine(50, $high, $row['quick_code']." ".$row['tiers_name'],1,'L',true);
|
$this->LongLine(50, $high, $row['quick_code']." ".$row['tiers_name'],1,'L',true);
|
||||||
$this->LongLine(80, $high, $row['jr_comment'],1,'L',true);
|
$this->LongLine(80, $high, $row['jr_comment'],1,'L',true);
|
||||||
$this->write_cell(20, $high, nbm($row['htva']), 1, 0, 'R', true);
|
$this->write_cell(20, $high, nbm($row['htva']), 1, 0, 'R', true);
|
||||||
$this->write_cell(20, $high, nbm($row['tot_tva_np']), 1, 0, 'R', true);
|
$this->write_cell(20, $high, nbm($row['tot_tva_np']), 1, 0, 'R', true);
|
||||||
$this->write_cell(20, $high, "", 1, 0, 'R', true);
|
$this->write_cell(20, $high, nbm($row['other_tax_amount']), 1, 0, 'R', true);
|
||||||
$this->write_cell(20, $high, nbm($row['tot_vat']), 1, 0, 'R', true);
|
$this->write_cell(20, $high, nbm($row['tot_vat']), 1, 0, 'R', true);
|
||||||
$sum=bcadd($row['htva'],$row['tot_vat']);
|
$sum=bcadd($row['htva'],$row['tot_vat']);
|
||||||
|
$sum=bcadd($row['other_tax_amount'],$sum);
|
||||||
$sum=bcsub($sum,$row['tot_tva_np']);
|
$sum=bcsub($sum,$row['tot_tva_np']);
|
||||||
$this->write_cell(20, $high, nbm($sum), 1, 0, 'R', true);
|
$this->write_cell(20, $high, nbm($sum), 1, 0, 'R', true);
|
||||||
$internal=$row['jr_internal'];
|
$internal=$row['jr_internal'];
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ class Print_Ledger_Simple extends \Print_Ledger
|
||||||
$tmp1=$line_tva['tva_id'];
|
$tmp1=$line_tva['tva_id'];
|
||||||
$this->rap_tva[$tmp1]=0;
|
$this->rap_tva[$tmp1]=0;
|
||||||
}
|
}
|
||||||
|
$this->rap_other_tax=0;
|
||||||
$this->jrn_type=$p_jrn->get_type();
|
$this->jrn_type=$p_jrn->get_type();
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
/* report
|
/* report
|
||||||
|
|
@ -53,6 +54,7 @@ class Print_Ledger_Simple extends \Print_Ledger
|
||||||
*/
|
*/
|
||||||
$from_periode=$this->get_from();
|
$from_periode=$this->get_from();
|
||||||
$this->previous=$this->get_ledger()->previous_amount($from_periode);
|
$this->previous=$this->get_ledger()->previous_amount($from_periode);
|
||||||
|
$this->other_tax_previous=$this->get_ledger()->previous_other_tax($from_periode);
|
||||||
|
|
||||||
/* initialize the amount to report */
|
/* initialize the amount to report */
|
||||||
foreach($this->previous['tva'] as $line_tva)
|
foreach($this->previous['tva'] as $line_tva)
|
||||||
|
|
@ -70,6 +72,24 @@ class Print_Ledger_Simple extends \Print_Ledger
|
||||||
$this->rap_priv=$this->previous['priv'];
|
$this->rap_priv=$this->previous['priv'];
|
||||||
$this->rap_nd=$this->previous['tva_nd'];
|
$this->rap_nd=$this->previous['tva_nd'];
|
||||||
$this->rap_tva_np=$this->previous['tva_np'];
|
$this->rap_tva_np=$this->previous['tva_np'];
|
||||||
|
$this->flag_other_tax=false;
|
||||||
|
|
||||||
|
if ($this->jrn_type == 'ACH' || $this->jrn_type=='VEN') {
|
||||||
|
$periode=new Periode($p_cn,$p_from);
|
||||||
|
$first_date=$periode->first_day();
|
||||||
|
$periode=new Periode($p_cn,$p_to);
|
||||||
|
$last_date=$periode->last_day();
|
||||||
|
|
||||||
|
$count=$this->cn->get_value("
|
||||||
|
select count(*)
|
||||||
|
from jrn_tax join jrnx using (j_id)
|
||||||
|
join jrn on (j_grpt=jr_grpt_id) where
|
||||||
|
j_date >= to_date($1,'DD.MM.YYYY')
|
||||||
|
and j_date <= to_date($2,'DD.MM.YYYY')
|
||||||
|
and j_jrn_def=$3",
|
||||||
|
array($first_date,$last_date,$p_jrn->id));
|
||||||
|
if ($count>0) { $this->flag_other_tax=true;}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setDossierInfo($dossier = "n/a")
|
function setDossierInfo($dossier = "n/a")
|
||||||
|
|
@ -119,6 +139,10 @@ class Print_Ledger_Simple extends \Print_Ledger
|
||||||
{
|
{
|
||||||
$this->Cell(15,6,$line_tva['tva_label'],0,0,'R');
|
$this->Cell(15,6,$line_tva['tva_label'],0,0,'R');
|
||||||
}
|
}
|
||||||
|
if ($this->flag_other_tax) {
|
||||||
|
$this->Cell(15,6,'Autre Tx',0,0,'R');
|
||||||
|
|
||||||
|
}
|
||||||
$this->Cell(15,6,'TVAC',0,0,'R');
|
$this->Cell(15,6,'TVAC',0,0,'R');
|
||||||
$this->Ln(5);
|
$this->Ln(5);
|
||||||
|
|
||||||
|
|
@ -137,6 +161,9 @@ class Print_Ledger_Simple extends \Print_Ledger
|
||||||
$this->Cell(15,6,nbm($this->rap_tva_np),0,0,'R'); /* Tva ND */
|
$this->Cell(15,6,nbm($this->rap_tva_np),0,0,'R'); /* Tva ND */
|
||||||
foreach($this->rap_tva as $line_tva)
|
foreach($this->rap_tva as $line_tva)
|
||||||
$this->Cell(15,6,nbm($line_tva),0,0,'R');
|
$this->Cell(15,6,nbm($line_tva),0,0,'R');
|
||||||
|
if ($this->flag_other_tax) {
|
||||||
|
$this->Cell(15, 6, nbm($this->rap_other_tax), 0, 0, 'R'); /* Other tax */
|
||||||
|
}
|
||||||
$this->Cell(15,6,nbm($this->rap_tvac),0,0,'R'); /* Tvac */
|
$this->Cell(15,6,nbm($this->rap_tvac),0,0,'R'); /* Tvac */
|
||||||
|
|
||||||
$this->Ln(6);
|
$this->Ln(6);
|
||||||
|
|
@ -146,6 +173,7 @@ class Print_Ledger_Simple extends \Print_Ledger
|
||||||
$this->tp_priv=0;
|
$this->tp_priv=0;
|
||||||
$this->tp_nd=0;
|
$this->tp_nd=0;
|
||||||
$this->tp_tva_np=0;
|
$this->tp_tva_np=0;
|
||||||
|
$this->tp_other_tax=0;
|
||||||
foreach($this->a_Tva as $line_tva)
|
foreach($this->a_Tva as $line_tva)
|
||||||
{
|
{
|
||||||
//initialize Amount TVA
|
//initialize Amount TVA
|
||||||
|
|
@ -179,7 +207,9 @@ class Print_Ledger_Simple extends \Print_Ledger
|
||||||
$l=$line_tva['tva_id'];
|
$l=$line_tva['tva_id'];
|
||||||
$this->Cell(15,6,nbm($this->tp_tva[$l]),'T',0,'R');
|
$this->Cell(15,6,nbm($this->tp_tva[$l]),'T',0,'R');
|
||||||
}
|
}
|
||||||
|
if ($this->flag_other_tax) {
|
||||||
|
$this->Cell(15, 6, nbm($this->tp_other_tax), 'T', 0, 'R'); /* Tvac */
|
||||||
|
}
|
||||||
$this->Cell(15,6,nbm($this->tp_tvac),'T',0,'R'); /* Tvac */
|
$this->Cell(15,6,nbm($this->tp_tvac),'T',0,'R'); /* Tvac */
|
||||||
$this->Ln(2);
|
$this->Ln(2);
|
||||||
$flag_tva=(count($this->a_Tva) > 4)?true:false;
|
$flag_tva=(count($this->a_Tva) > 4)?true:false;
|
||||||
|
|
@ -202,6 +232,9 @@ class Print_Ledger_Simple extends \Print_Ledger
|
||||||
$l=$line_tva['tva_id'];
|
$l=$line_tva['tva_id'];
|
||||||
$this->Cell(15,6,nbm($this->rap_tva[$l]),0,0,'R');
|
$this->Cell(15,6,nbm($this->rap_tva[$l]),0,0,'R');
|
||||||
}
|
}
|
||||||
|
if ($this->flag_other_tax) {
|
||||||
|
$this->Cell(15, 6, nbm($this->rap_other_tax), 0, 0, 'R'); /* Other tax */
|
||||||
|
}
|
||||||
$this->Cell(15,6,nbm($this->rap_tvac),0,0,'R'); /* Tvac */
|
$this->Cell(15,6,nbm($this->rap_tvac),0,0,'R'); /* Tvac */
|
||||||
$this->Ln(2);
|
$this->Ln(2);
|
||||||
|
|
||||||
|
|
@ -290,8 +323,12 @@ class Print_Ledger_Simple extends \Print_Ledger
|
||||||
$this->write_cell(15, 5, nbm($row_atva_amount), 0, 0, 'R');
|
$this->write_cell(15, 5, nbm($row_atva_amount), 0, 0, 'R');
|
||||||
}
|
}
|
||||||
|
|
||||||
$l_tvac=bcadd($other['price'], bcsub($other['vat'],$other['tva_np']));
|
$l_tvac=bcadd($other['price'], bcsub($other['vat'],$other['tva_np']));
|
||||||
$l_tvac=bcadd($l_tvac,$other['tva_nd']);
|
$l_tvac=bcadd($l_tvac,$other['tva_nd']);
|
||||||
|
$l_tvac=bcadd($l_tvac,$a_jrn[$i]['other_tax_amount']);
|
||||||
|
if ($this->flag_other_tax) {
|
||||||
|
$this->write_cell(15, 5, nbm($a_jrn[$i]['other_tax_amount']), 0, 0, 'R');
|
||||||
|
}
|
||||||
$this->write_cell(15,5,nbm($l_tvac),0,0,'R');
|
$this->write_cell(15,5,nbm($l_tvac),0,0,'R');
|
||||||
$this->line_new(2);
|
$this->line_new(2);
|
||||||
// Add the payment information on another row
|
// Add the payment information on another row
|
||||||
|
|
@ -320,7 +357,8 @@ class Print_Ledger_Simple extends \Print_Ledger
|
||||||
$this->tp_tva_np=bcadd($this->tp_tva_np,$other['tva_np']);
|
$this->tp_tva_np=bcadd($this->tp_tva_np,$other['tva_np']);
|
||||||
$this->tp_priv=bcadd($this->tp_priv,$other['priv']);
|
$this->tp_priv=bcadd($this->tp_priv,$other['priv']);
|
||||||
$this->tp_nd=bcadd($this->tp_nd,$other['tva_nd']);
|
$this->tp_nd=bcadd($this->tp_nd,$other['tva_nd']);
|
||||||
|
|
||||||
|
|
||||||
// Total report
|
// Total report
|
||||||
$this->rap_htva=bcadd($this->rap_htva,$other['price']);
|
$this->rap_htva=bcadd($this->rap_htva,$other['price']);
|
||||||
$this->rap_tvac=bcadd($this->rap_tvac,$other['price']);
|
$this->rap_tvac=bcadd($this->rap_tvac,$other['price']);
|
||||||
|
|
@ -331,6 +369,11 @@ class Print_Ledger_Simple extends \Print_Ledger
|
||||||
$this->rap_nd=bcadd($this->rap_nd,$other['tva_nd']);
|
$this->rap_nd=bcadd($this->rap_nd,$other['tva_nd']);
|
||||||
$this->rap_tva_np=bcadd($this->rap_tva_np,$other['tva_np']);
|
$this->rap_tva_np=bcadd($this->rap_tva_np,$other['tva_np']);
|
||||||
|
|
||||||
|
if ($this->flag_other_tax) {
|
||||||
|
$this->tp_other_tax = bcadd($this->tp_other_tax, $a_jrn[$i]['other_tax_amount']);
|
||||||
|
$this->rap_other_tax = bcadd($this->rap_other_tax, $a_jrn[$i]['other_tax_amount']);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ if (!defined('ALLOWED'))
|
||||||
|
|
||||||
include_once NOALYSS_INCLUDE."/lib/ac_common.php";
|
include_once NOALYSS_INCLUDE."/lib/ac_common.php";
|
||||||
|
|
||||||
|
global $cn,$g_user;
|
||||||
|
|
||||||
|
|
||||||
$gDossier=dossier::id();
|
$gDossier=dossier::id();
|
||||||
|
|
@ -130,9 +130,7 @@ if ( $get_option=="E")
|
||||||
}
|
}
|
||||||
if ($ret_detail==null)
|
if ($ret_detail==null)
|
||||||
return;
|
return;
|
||||||
$a_heading[]="";
|
|
||||||
$a_heading[]="";
|
|
||||||
$a_heading[]="";
|
|
||||||
$a_heading[]=_("Date paiement");
|
$a_heading[]=_("Date paiement");
|
||||||
$a_heading[]=_("Montant paiement");
|
$a_heading[]=_("Montant paiement");
|
||||||
$a_heading[]=_("Methode paiement");
|
$a_heading[]=_("Methode paiement");
|
||||||
|
|
|
||||||
|
|
@ -1223,7 +1223,7 @@ function check()
|
||||||
* @return nothing
|
* @return nothing
|
||||||
*/
|
*/
|
||||||
function input_custom($p_key,$p_value) {
|
function input_custom($p_key,$p_value) {
|
||||||
throw new Exception(__FILE__.":".__LINE__."-"._("non implémenté"));
|
throw new Exception(__FILE__.":".__LINE__."- input_custom "._("non implémenté"));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Save the record from Request into the DB and returns an XML
|
* @brief Save the record from Request into the DB and returns an XML
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
* @file
|
* @file
|
||||||
* @brief detail of the list of operation with VAT and items
|
* @brief detail of the list of operation with VAT and items
|
||||||
*/
|
*/
|
||||||
|
bcscale(2);
|
||||||
?>
|
?>
|
||||||
<table class="result">
|
<table class="result">
|
||||||
<tr>
|
<tr>
|
||||||
|
|
@ -69,6 +70,9 @@ for ($i=0;$i<$nb_data;$i++):
|
||||||
$tot_amount_vat=bcadd($tot_amount_vat,$this->data[$i]['vat']);
|
$tot_amount_vat=bcadd($tot_amount_vat,$this->data[$i]['vat']);
|
||||||
$tot_amount_vat=bcsub($tot_amount_vat,$this->data[$i]['tva_sided']);
|
$tot_amount_vat=bcsub($tot_amount_vat,$this->data[$i]['tva_sided']);
|
||||||
$tot_amount_tvac=bcadd($tot_amount_tvac,$this->data[$i]['tvac']);
|
$tot_amount_tvac=bcadd($tot_amount_tvac,$this->data[$i]['tvac']);
|
||||||
|
$supp_tax=$this->data[$i]['supp_tax'];
|
||||||
|
$tot_other_tax=array_sum(array_column($supp_tax,'j_montant'));
|
||||||
|
$all_tax=bcadd($tot_other_tax,$this->data[$i]['vat']);
|
||||||
?>
|
?>
|
||||||
<tr <?=$odd?> >
|
<tr <?=$odd?> >
|
||||||
<td>
|
<td>
|
||||||
|
|
@ -90,17 +94,19 @@ for ($i=0;$i<$nb_data;$i++):
|
||||||
<?=h($this->data[$i]['jr_comment'])?>
|
<?=h($this->data[$i]['jr_comment'])?>
|
||||||
</td>
|
</td>
|
||||||
<td class="num">
|
<td class="num">
|
||||||
<?=nbm(bcadd($this->data[$i]['sum_oc_amount'],$this->data[$i]['sum_oc_vat_amount'],4),4)?>
|
<?php if ($this->data[$i]['currency_id'] !=0) : ?>
|
||||||
|
<?=nbm(bcadd($this->data[$i]['sum_oc_amount'],$this->data[$i]['sum_oc_vat_amount'],4),2)?>
|
||||||
<?=$this->data[$i]['cr_code_iso']?>
|
<?=$this->data[$i]['cr_code_iso']?>
|
||||||
|
<?php endif;?>
|
||||||
</td>
|
</td>
|
||||||
<td class="num">
|
<td class="num">
|
||||||
<?=nbm($this->data[$i]['novat'])?>
|
<?=nbm($this->data[$i]['novat'])?>
|
||||||
</td>
|
</td>
|
||||||
<td class="num">
|
<td class="num">
|
||||||
<?=nbm(bcsub($this->data[$i]['vat'],$this->data[$i]['tva_sided']))?>
|
<?=nbm(bcsub($all_tax,$this->data[$i]['tva_sided']),2)?>
|
||||||
</td>
|
</td>
|
||||||
<td class="num">
|
<td class="num">
|
||||||
<?=nbm($this->data[$i]['tvac'])?>
|
<?=nbm(bcadd($this->data[$i]['tvac'],$tot_other_tax))?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
|
|
@ -154,7 +160,25 @@ for ($j=0;$j<$nb_detail;$j++):
|
||||||
<?php
|
<?php
|
||||||
endfor;
|
endfor;
|
||||||
?>
|
?>
|
||||||
|
<?php
|
||||||
|
// print additional tax if any
|
||||||
|
$nb_supp_tax=count($this->data[$i]['supp_tax']);
|
||||||
|
for ($j=0;$j<$nb_supp_tax;$j++):
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><?=$this->data[$i]['supp_tax'][$j]['j_poste']?>
|
||||||
|
<?=$this->data[$i]['supp_tax'][$j]['ac_label']?>
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td class="num"><?=nbm($this->data[$i]['supp_tax'][$j]['j_montant'])?></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
endfor;
|
||||||
|
?>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ if (!defined('ALLOWED'))
|
||||||
* @brief display purchase on one line with sum of VAT, Operation, Private exp.
|
* @brief display purchase on one line with sum of VAT, Operation, Private exp.
|
||||||
* @todo prévoir aussi pour les non assujetti : faire disparaître les montants TVA
|
* @todo prévoir aussi pour les non assujetti : faire disparaître les montants TVA
|
||||||
*/
|
*/
|
||||||
|
bcscale(2);
|
||||||
?>
|
?>
|
||||||
<table class="result">
|
<table class="result">
|
||||||
<tr>
|
<tr>
|
||||||
|
|
@ -58,10 +58,15 @@ if (!defined('ALLOWED'))
|
||||||
<th class="num">
|
<th class="num">
|
||||||
<?=_('TVA')?>
|
<?=_('TVA')?>
|
||||||
</th>
|
</th>
|
||||||
|
<?php if ($nb_other_tax>0) :?>
|
||||||
|
<th class="num">
|
||||||
|
<?=_('Autre Taxe')?>
|
||||||
|
</th>
|
||||||
|
<?php endif;?>
|
||||||
<th class="num">
|
<th class="num">
|
||||||
<?=_('TVAC')?>
|
<?=_('TVAC')?>
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
<th class="num">
|
<th class="num">
|
||||||
<?=_('Devise')?>
|
<?=_('Devise')?>
|
||||||
</th>
|
</th>
|
||||||
|
|
@ -77,16 +82,18 @@ $tot_amount_tvac=0;
|
||||||
$tot_amount_private=0;
|
$tot_amount_private=0;
|
||||||
$tot_nonded_vat=0;
|
$tot_nonded_vat=0;
|
||||||
$tot_nonded_amount=0;
|
$tot_nonded_amount=0;
|
||||||
|
$tot_other_tax=0;
|
||||||
for ($i=0;$i<$nb_data;$i++):
|
for ($i=0;$i<$nb_data;$i++):
|
||||||
$odd=($i%2==0)?' class="even" ':' class="odd" ';
|
$odd=($i%2==0)?' class="even" ':' class="odd" ';
|
||||||
$tot_amount_novat=bcadd($tot_amount_novat,$this->data[$i]['novat']);
|
$tot_amount_novat=bcadd($tot_amount_novat,$this->data[$i]['novat']);
|
||||||
$tot_amount_vat=bcadd($tot_amount_vat,$this->data[$i]['vat']);
|
$tot_amount_vat=bcadd($tot_amount_vat,$this->data[$i]['vat']);
|
||||||
$tot_amount_vat=bcsub($tot_amount_vat,$this->data[$i]['tva_sided']);
|
$tot_amount_vat=bcsub($tot_amount_vat,$this->data[$i]['tva_sided']);
|
||||||
$tot_amount_tvac=bcadd($tot_amount_tvac,$this->data[$i]['tvac']);
|
$tot_amount_tvac=bcadd($tot_amount_tvac,$this->data[$i]['tvac']);
|
||||||
|
$tot_amount_tvac=bcadd($tot_amount_tvac,$this->data[$i]['other_tax_amount']);
|
||||||
$tot_nonded_amount=bcadd($tot_nonded_amount,$this->data[$i]['noded_amount']);
|
$tot_nonded_amount=bcadd($tot_nonded_amount,$this->data[$i]['noded_amount']);
|
||||||
$tot_nonded_amount=bcadd($tot_nonded_amount,$this->data[$i]['private_amount']);
|
$tot_nonded_amount=bcadd($tot_nonded_amount,$this->data[$i]['private_amount']);
|
||||||
$tot_nonded_vat=bcadd($tot_nonded_vat, $this->data[$i]['noded_vat']);
|
$tot_nonded_vat=bcadd($tot_nonded_vat, $this->data[$i]['noded_vat']);
|
||||||
|
$tot_other_tax=bcadd($tot_other_tax,$this->data[$i]['other_tax_amount']);
|
||||||
?>
|
?>
|
||||||
<tr <?=$odd?> >
|
<tr <?=$odd?> >
|
||||||
<td>
|
<td>
|
||||||
|
|
@ -117,11 +124,16 @@ for ($i=0;$i<$nb_data;$i++):
|
||||||
<?=nbm(bcsub($this->data[$i]['vat'],$this->data[$i]['tva_sided']))?>
|
<?=nbm(bcsub($this->data[$i]['vat'],$this->data[$i]['tva_sided']))?>
|
||||||
</td>
|
</td>
|
||||||
<td class="num">
|
<td class="num">
|
||||||
<?=nbm($this->data[$i]['tvac'])?>
|
<?=nbm($this->data[$i]['other_tax_amount'])?>
|
||||||
</td>
|
</td>
|
||||||
|
<?php if ($nb_other_tax>0) :?>
|
||||||
|
<td class="num">
|
||||||
|
<?=nbm(bcadd($this->data[$i]['other_tax_amount'] ,$this->data[$i]['tvac']))?>
|
||||||
|
</td>
|
||||||
|
<?php endif;?>
|
||||||
<td class="num">
|
<td class="num">
|
||||||
<?php if ( $this->data[$i]['currency_id'] != '0') : ?>
|
<?php if ( $this->data[$i]['currency_id'] != '0') : ?>
|
||||||
<?=nbm ( bcadd($this->data[$i]['sum_oc_amount'],$this->data[$i]['sum_oc_vat_amount']),4)?>
|
<?=nbm ( bcadd($this->data[$i]['sum_oc_amount'],$this->data[$i]['sum_oc_vat_amount'],2),2)?>
|
||||||
<?=$this->data[$i]['cr_code_iso']?>
|
<?=$this->data[$i]['cr_code_iso']?>
|
||||||
<?php endif;?>
|
<?php endif;?>
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -157,6 +169,9 @@ for ($i=0;$i<$nb_data;$i++):
|
||||||
<td class="num"><?=nbm($tot_amount_novat)?></td>
|
<td class="num"><?=nbm($tot_amount_novat)?></td>
|
||||||
<td class="num"><?=nbm($tot_nonded_amount)?></td>
|
<td class="num"><?=nbm($tot_nonded_amount)?></td>
|
||||||
<td class="num"><?=nbm($tot_amount_vat)?></td>
|
<td class="num"><?=nbm($tot_amount_vat)?></td>
|
||||||
|
<?php if ($nb_other_tax>0) :?>
|
||||||
|
<td class="num"><?=nbm($tot_other_tax)?></td>
|
||||||
|
<?php endif;?>
|
||||||
<td class="num"><?=nbm($tot_amount_tvac)?></td>
|
<td class="num"><?=nbm($tot_amount_tvac)?></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
* @file
|
* @file
|
||||||
* @brief detail of the list of operation with VAT and items
|
* @brief detail of the list of operation with VAT and items
|
||||||
*/
|
*/
|
||||||
|
bcscale(2);
|
||||||
?>
|
?>
|
||||||
<table class="result">
|
<table class="result">
|
||||||
<tr>
|
<tr>
|
||||||
|
|
@ -69,6 +70,9 @@ for ($i=0;$i<$nb_data;$i++):
|
||||||
$tot_amount_vat=bcadd($tot_amount_vat,$this->data[$i]['vat']);
|
$tot_amount_vat=bcadd($tot_amount_vat,$this->data[$i]['vat']);
|
||||||
$tot_amount_vat=bcsub($tot_amount_vat,$this->data[$i]['tva_sided']);
|
$tot_amount_vat=bcsub($tot_amount_vat,$this->data[$i]['tva_sided']);
|
||||||
$tot_amount_tvac=bcadd($tot_amount_tvac,$this->data[$i]['tvac']);
|
$tot_amount_tvac=bcadd($tot_amount_tvac,$this->data[$i]['tvac']);
|
||||||
|
$supp_tax=$this->data[$i]['supp_tax'];
|
||||||
|
$tot_other_tax=array_sum(array_column($supp_tax,'j_montant'));
|
||||||
|
$all_tax=bcadd($tot_other_tax,$this->data[$i]['vat']);
|
||||||
?>
|
?>
|
||||||
<tr <?=$odd?> >
|
<tr <?=$odd?> >
|
||||||
<td>
|
<td>
|
||||||
|
|
@ -90,17 +94,21 @@ for ($i=0;$i<$nb_data;$i++):
|
||||||
<?=h($this->data[$i]['jr_comment'])?>
|
<?=h($this->data[$i]['jr_comment'])?>
|
||||||
</td>
|
</td>
|
||||||
<td class="num">
|
<td class="num">
|
||||||
<?=nbm(bcadd($this->data[$i]['sum_oc_amount'],$this->data[$i]['sum_oc_vat_amount'],4),4)?>
|
<?php if ($this->data[$i]['currency_id'] !=0) : ?>
|
||||||
|
<?=nbm(bcadd($this->data[$i]['sum_oc_amount'],$this->data[$i]['sum_oc_vat_amount'],4),2)?>
|
||||||
<?=$this->data[$i]['cr_code_iso']?>
|
<?=$this->data[$i]['cr_code_iso']?>
|
||||||
|
<?php endif;?>
|
||||||
</td>
|
</td>
|
||||||
<td class="num">
|
<td class="num">
|
||||||
<?=nbm($this->data[$i]['novat'])?>
|
<?=nbm($this->data[$i]['novat'])?>
|
||||||
</td>
|
</td>
|
||||||
<td class="num">
|
<td class="num">
|
||||||
<?=nbm(bcsub($this->data[$i]['vat'],$this->data[$i]['tva_sided']))?>
|
<?=nbm(bcsub($all_tax,$this->data[$i]['tva_sided']),2)?>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td class="num">
|
<td class="num">
|
||||||
<?=nbm($this->data[$i]['tvac'])?>
|
<?=nbm(bcadd($this->data[$i]['tvac'],$tot_other_tax))?>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
|
|
@ -141,6 +149,9 @@ $a_detail=Database::fetch_all($det);
|
||||||
<?php
|
<?php
|
||||||
$nb_detail=count($a_detail);
|
$nb_detail=count($a_detail);
|
||||||
for ($j=0;$j<$nb_detail;$j++):
|
for ($j=0;$j<$nb_detail;$j++):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?=$a_detail[$j]['qcode']?>
|
<td><?=$a_detail[$j]['qcode']?>
|
||||||
|
|
@ -155,6 +166,25 @@ for ($j=0;$j<$nb_detail;$j++):
|
||||||
<?php
|
<?php
|
||||||
endfor;
|
endfor;
|
||||||
?>
|
?>
|
||||||
|
<?php
|
||||||
|
// print additional tax if any
|
||||||
|
$nb_supp_tax=count($this->data[$i]['supp_tax']);
|
||||||
|
for ($j=0;$j<$nb_supp_tax;$j++):
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><?=$this->data[$i]['supp_tax'][$j]['j_poste']?>
|
||||||
|
<?=$this->data[$i]['supp_tax'][$j]['ac_label']?>
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td class="num"><?=nbm($this->data[$i]['supp_tax'][$j]['j_montant'])?></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
endfor;
|
||||||
|
?>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
|
|
@ -49,9 +49,15 @@
|
||||||
<th class="num">
|
<th class="num">
|
||||||
<?=_('HTVA')?>
|
<?=_('HTVA')?>
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
<th class="num">
|
<th class="num">
|
||||||
<?=_('TVA')?>
|
<?=_('TVA')?>
|
||||||
</th>
|
</th>
|
||||||
|
<?php if ($nb_other_tax>0) :?>
|
||||||
|
<th class="num">
|
||||||
|
<?=_('Autre Taxe')?>
|
||||||
|
</th>
|
||||||
|
<?php endif;?>
|
||||||
<th class="num">
|
<th class="num">
|
||||||
<?=_('TVAC')?>
|
<?=_('TVAC')?>
|
||||||
</th>
|
</th>
|
||||||
|
|
@ -64,12 +70,15 @@ $nb_data=count($this->data);
|
||||||
$tot_amount_novat=0;
|
$tot_amount_novat=0;
|
||||||
$tot_amount_vat=0;
|
$tot_amount_vat=0;
|
||||||
$tot_amount_tvac=0;
|
$tot_amount_tvac=0;
|
||||||
|
$tot_other_tax=0;
|
||||||
for ($i=0;$i<$nb_data;$i++):
|
for ($i=0;$i<$nb_data;$i++):
|
||||||
$odd=($i%2==0)?' class="even" ':' class="odd" ';
|
$odd=($i%2==0)?' class="even" ':' class="odd" ';
|
||||||
$tot_amount_novat=bcadd($tot_amount_novat,$this->data[$i]['novat']);
|
$tot_amount_novat=bcadd($tot_amount_novat,$this->data[$i]['novat']);
|
||||||
$tot_amount_vat=bcadd($tot_amount_vat,$this->data[$i]['vat']);
|
$tot_amount_vat=bcadd($tot_amount_vat,$this->data[$i]['vat']);
|
||||||
$tot_amount_vat=bcsub($tot_amount_vat,$this->data[$i]['tva_sided']);
|
$tot_amount_vat=bcsub($tot_amount_vat,$this->data[$i]['tva_sided']);
|
||||||
$tot_amount_tvac=bcadd($tot_amount_tvac,$this->data[$i]['tvac']);
|
$tot_amount_tvac=bcadd($tot_amount_tvac,$this->data[$i]['tvac']);
|
||||||
|
$tot_amount_tvac=bcadd($tot_amount_tvac,$this->data[$i]['other_tax_amount']);
|
||||||
|
$tot_other_tax=bcadd($tot_other_tax,$this->data[$i]['other_tax_amount']);
|
||||||
?>
|
?>
|
||||||
<tr <?=$odd?> >
|
<tr <?=$odd?> >
|
||||||
<td>
|
<td>
|
||||||
|
|
@ -96,12 +105,18 @@ for ($i=0;$i<$nb_data;$i++):
|
||||||
<td class="num">
|
<td class="num">
|
||||||
<?=nbm(bcsub($this->data[$i]['vat'],$this->data[$i]['tva_sided']))?>
|
<?=nbm(bcsub($this->data[$i]['vat'],$this->data[$i]['tva_sided']))?>
|
||||||
</td>
|
</td>
|
||||||
|
<?php if ($nb_other_tax>0) :?>
|
||||||
<td class="num">
|
<td class="num">
|
||||||
<?=nbm($this->data[$i]['tvac'])?>
|
<?=nbm($this->data[$i]['other_tax_amount'])?>
|
||||||
|
</td>
|
||||||
|
<?php endif;?>
|
||||||
|
<td class="num">
|
||||||
|
<?=nbm(bcadd($this->data[$i]['other_tax_amount'] ,$this->data[$i]['tvac']))?>
|
||||||
</td>
|
</td>
|
||||||
<td class="num">
|
<td class="num">
|
||||||
<?php if ( $this->data[$i]['cr_code_iso'] != 0) : ?>
|
|
||||||
<?=nbm ( bcadd($this->data[$i]['sum_oc_amount'],$this->data[$i]['sum_oc_vat_amount']),4)?>
|
<?php if ( $this->data[$i]['currency_id'] != '0') : ?>
|
||||||
|
<?=nbm ( bcadd($this->data[$i]['sum_oc_amount'],$this->data[$i]['sum_oc_vat_amount']),2)?>
|
||||||
<?=$this->data[$i]['cr_code_iso']?>
|
<?=$this->data[$i]['cr_code_iso']?>
|
||||||
<?php endif;?>
|
<?php endif;?>
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -137,6 +152,9 @@ for ($i=0;$i<$nb_data;$i++):
|
||||||
<td></td>
|
<td></td>
|
||||||
<td class="num"><?=nbm($tot_amount_novat)?></td>
|
<td class="num"><?=nbm($tot_amount_novat)?></td>
|
||||||
<td class="num"><?=nbm($tot_amount_vat)?></td>
|
<td class="num"><?=nbm($tot_amount_vat)?></td>
|
||||||
|
<?php if ($nb_other_tax>0) :?>
|
||||||
|
<td class="num"><?=nbm($tot_other_tax)?></td>
|
||||||
|
<?php endif;?>
|
||||||
<td class="num"><?=nbm($tot_amount_tvac)?></td>
|
<td class="num"><?=nbm($tot_amount_tvac)?></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
|
|
||||||
|
|
@ -274,6 +274,7 @@ echo $ipaid->input();
|
||||||
*/
|
*/
|
||||||
$sum_add_tax=0;$sum_add_tax_cur=0;
|
$sum_add_tax=0;$sum_add_tax_cur=0;
|
||||||
Additional_Tax::display_row($jr_id,$sum_add_tax,$sum_add_tax_cur);
|
Additional_Tax::display_row($jr_id,$sum_add_tax,$sum_add_tax_cur);
|
||||||
|
print_r("sum_add_tax_cur $sum_add_tax_cur");
|
||||||
$sum_prod_currency=bcadd($sum_prod_currency,$sum_add_tax_cur);
|
$sum_prod_currency=bcadd($sum_prod_currency,$sum_add_tax_cur);
|
||||||
|
|
||||||
$total_tvac=bcadd($sum_add_tax,$total_tvac);
|
$total_tvac=bcadd($sum_add_tax,$total_tvac);
|
||||||
|
|
@ -289,7 +290,7 @@ echo $ipaid->input();
|
||||||
//Display total in currency
|
//Display total in currency
|
||||||
if ( $obj->det->currency_id != "" && $obj->det->currency_id > 0)
|
if ( $obj->det->currency_id != "" && $obj->det->currency_id > 0)
|
||||||
{
|
{
|
||||||
$row.= td(nbm($sum_prod_currency,4),' class="num" style="font-style:italic;font-weight: bolder;"');
|
$row.= td(nbm($sum_prod_currency,2),' class="num" style="font-style:italic;font-weight: bolder;"');
|
||||||
}
|
}
|
||||||
echo tr($row);
|
echo tr($row);
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
127
sql/upgrade.sql
127
sql/upgrade.sql
|
|
@ -42,3 +42,130 @@ COMMENT ON COLUMN public.jrn_tax.ac_id IS 'FK to acc_other_tax';
|
||||||
|
|
||||||
ALTER TABLE public.jrn_tax ADD CONSTRAINT jrn_tax_acc_other_tax_fk FOREIGN KEY (ac_id) REFERENCES public.acc_other_tax(ac_id);
|
ALTER TABLE public.jrn_tax ADD CONSTRAINT jrn_tax_acc_other_tax_fk FOREIGN KEY (ac_id) REFERENCES public.acc_other_tax(ac_id);
|
||||||
ALTER TABLE public.jrn_tax ADD CONSTRAINT jrn_tax_fk FOREIGN KEY (j_id) REFERENCES public.jrnx(j_id);
|
ALTER TABLE public.jrn_tax ADD CONSTRAINT jrn_tax_fk FOREIGN KEY (j_id) REFERENCES public.jrnx(j_id);
|
||||||
|
|
||||||
|
drop view if exists v_detail_sale;
|
||||||
|
create or replace view v_detail_sale
|
||||||
|
(jr_id, jr_date, jr_date_paid, jr_ech, jr_tech_per, jr_comment, jr_pj_number, jr_internal, jr_def_id,
|
||||||
|
j_poste, j_text, j_qcode, jr_rapt, item_card, item_name, qs_client, tiers_name, quick_code, tva_label,
|
||||||
|
tva_comment, tva_both_side, vat_sided, vat_code, vat, price, quantity, price_per_unit, htva, tot_vat,
|
||||||
|
tot_tva_np,other_tax_amount, oc_amount, oc_vat_amount, cr_code_iso)
|
||||||
|
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
|
||||||
|
),other_tax as (
|
||||||
|
select j_grpt , sum(case when j_debit is true then 0-j_montant else j_montant end) other_tax_amount from jrnx join jrn_tax using (j_id) group by j_grpt )
|
||||||
|
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,
|
||||||
|
ot.other_tax_amount,
|
||||||
|
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
|
||||||
|
LEFT 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
|
||||||
|
left join other_tax ot on ot.j_grpt=jrn.jr_grpt_id;
|
||||||
|
|
||||||
|
drop view if exists public.v_detail_purchase;
|
||||||
|
|
||||||
|
create 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
|
||||||
|
),other_tax as (
|
||||||
|
select j_grpt , sum(case when j_debit is false then 0-j_montant else j_montant end) other_tax_amount from jrnx join jrn_tax using (j_id) group by j_grpt )
|
||||||
|
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,
|
||||||
|
ot.other_tax_amount,
|
||||||
|
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
|
||||||
|
LEFT 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
|
||||||
|
left join other_tax ot on ot.j_grpt=jrn.jr_grpt_id;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue