[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 70/323: Task #0001530: Réécriture PRINTJRN :
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 70/323: Task #0001530: Réécriture PRINTJRN : export CSV : Purchase List (L) |
Date: |
Wed, 14 Mar 2018 17:38:20 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 295dc85a3836933bf83f272ffbbfed3e6f1acba1
Author: Dany De Bontridder <address@hidden>
Date: Mon Jan 22 20:28:19 2018 +0100
Task #0001530: Réécriture PRINTJRN : export CSV : Purchase List (L)
---
include/class/acc_ledger_history.class.php | 3 +
.../class/acc_ledger_history_purchase.class.php | 98 +++++++++++++++++++++-
include/export/export_ledger_csv.php | 93 ++------------------
.../acc_ledger_history_purchase_detail.php | 2 +-
4 files changed, 105 insertions(+), 91 deletions(-)
diff --git a/include/class/acc_ledger_history.class.php
b/include/class/acc_ledger_history.class.php
index 8cfc254..94a88e3 100644
--- a/include/class/acc_ledger_history.class.php
+++ b/include/class/acc_ledger_history.class.php
@@ -42,6 +42,9 @@ abstract class Acc_Ledger_History
function __construct(Database $cn, $pa_ledger, $p_from, $p_to, $p_mode)
{
+ if (is_array($pa_ledger) == FALSE) {
+ throw new Exception (_('pa_ledger doit être un
tableau'),EXC_PARAM_VALUE);
+ }
$this->db=$cn;
$this->ma_ledger=$pa_ledger;
$this->m_from=$p_from;
diff --git a/include/class/acc_ledger_history_purchase.class.php
b/include/class/acc_ledger_history_purchase.class.php
index 70daa96..5f813c2 100644
--- a/include/class/acc_ledger_history_purchase.class.php
+++ b/include/class/acc_ledger_history_purchase.class.php
@@ -151,11 +151,13 @@ class Acc_Ledger_History_Purchase extends
Acc_Ledger_History
noded_amount,
noded_vat,
private_amount,
- novat+vat-tva_sided as tvac
+ novat+vat-tva_sided as tvac,
+ n_text
from
jrn
join row_purchase on (qp_internal=jr_internal)
join supplier_detail on (qp_supplier=f_id)
+ left join jrn_note using (jr_id)
where
jr_def_id in ({$ledger_list})
and {$periode}
@@ -165,12 +167,11 @@ class Acc_Ledger_History_Purchase extends
Acc_Ledger_History
/**
* @brief preprare the query for fetching the detailed VAT of an operation
- * @staticvar int $prepare
*/
private function add_vat_info()
{
$prepare=$this->db->is_prepare("vat_infop");
- if ($prepare==0)
+ if ($prepare==FALSE)
{
$this->db->prepare("vat_infop",
"
@@ -184,7 +185,6 @@ class Acc_Ledger_History_Purchase extends Acc_Ledger_History
group by qp_vat_code,qp_internal order by qp_vat_code");
}
- $prepare=1;
$nb_row=count($this->data);
for ($i=0; $i<$nb_row; $i++)
{
@@ -233,5 +233,95 @@ class Acc_Ledger_History_Purchase extends
Acc_Ledger_History
{
return $this->data;
}
+ function export_csv()
+ {
+ $export=new Noalyss_Csv(_('journal'));
+ $export->send_header();
+
+ $this->get_row();
+ $this->prepare_reconcile_date();
+ $this->add_vat_info();
+
+ $own=new Noalyss_Parameter_Folder($this->db);
+ $title=array();
+ $title[]=_('Date');
+ $title[]=_("Paiement");
+ $title[]=_("operation");
+ $title[]=_("Pièce");
+ $title[]=_("Fournisseur");
+ $title[]=_("Note");
+ $title[]=_("interne");
+ $title[]=_("HTVA");
+ $title[]=_("privé");
+ $title[]=_("DNA");
+ $title[]=_("tva non ded.");
+ $title[]=_("TVA NP");
+
+ if ( $own->MY_TVA_USE=='Y')
+ {
+ $a_Tva=$this->db->get_array("select tva_id,tva_label from tva_rate
order by tva_rate,tva_label,tva_id");
+ foreach($a_Tva as $line_tva)
+ {
+ $title[]="Tva ".$line_tva['tva_label'];
+ }
+ }
+ $title[]=_("TVAC/TTC");
+ $title[]=_("opérations liées");
+ $export->write_header($title);
+
+ foreach ($this->data as $line)
+ {
+ $export->add($line['jr_date']);
+ $export->add($line['jr_date_paid']);
+ $export->add($line['jr_id']);
+ $export->add($line['jr_pj_number']);
+ $export->add($line['name']." ".
+ $line["first_name"]." ".
+ $line["qcode"]); // qp_supplier
+ $export->add($line['jr_comment']);
+ $export->add($line['jr_internal']);
+ $export->add($line['novat'],"number");
+ $export->add($line['private_amount'],"number");
+ $export->add($line['noded_amount'],"number");
+ $export->add($line['noded_vat'],"number");
+ $export->add($line['tva_sided'],"number");
+
+ $a_tva_amount=array();
+ //- set all TVA to 0
+ foreach ($a_Tva as $l) {
+ $t_id=$l["tva_id"];
+ $a_tva_amount[$t_id]=0;
+ }
+ foreach ($line['detail_vat'] as $lineTVA)
+ {
+ $idx_tva=$lineTVA['qp_vat_code'];
+ $a_tva_amount[$idx_tva]=$lineTVA['vat_amount'];
+ }
+ if ($own->MY_TVA_USE == 'Y' )
+ {
+ foreach ($a_Tva as $line_tva)
+ {
+ $a=$line_tva['tva_id'];
+ $export->add($a_tva_amount[$a],"number");
+ }
+ }
+ $export->add($line['tvac'],"number");
+ /**
+ * Retrieve payment if any
+ */
+
$ret_reconcile=$this->db->execute('reconcile_date',array($line['jr_id']));
+ $max=Database::num_row($ret_reconcile);
+ if ($max > 0) {
+ for ($e=0;$e<$max;$e++) {
+ $row=Database::fetch_array($ret_reconcile, $e);
+ $export->add($row['jr_date']);
+ $export->add($row['jr_internal']);
+ }
+ }
+ $export->write();
+
+ }
+
+ }
}
diff --git a/include/export/export_ledger_csv.php
b/include/export/export_ledger_csv.php
index 7f55dbc..0c1107a 100644
--- a/include/export/export_ledger_csv.php
+++ b/include/export/export_ledger_csv.php
@@ -84,7 +84,7 @@ if ($get_option == 'D')
{
if ($jrn_type != 'ACH' && $jrn_type != 'VEN' || $Jrn->id == 0)
{
- $get_option = 0;
+ $get_option = 'A';
}
else
{
@@ -236,92 +236,13 @@ if ($get_option == "L")
// One line summary with tiers, amount VAT, DNA, tva code ....
//
//------------------------------------------------------------------------------
- if ( $jrn_type=='ACH' || $jrn_type=='VEN')
- {
- $Row=$Jrn->get_rowSimple($get_from_periode,
- $get_to_periode,
- 0);
- $cn->prepare('reconcile_date',"select to_char(jr_date,'DD.MM.YY') as
str_date,* "
- . "from jrn "
- . "where "
- . "jr_id in (select jra_concerned from jrn_rapt where jr_id =
$1 union all select jr_id from jrn_rapt where jra_concerned=$1)");
-
- $own=new Noalyss_Parameter_Folder($cn);
- $title=array();
- $title[]=_('Date');
- $title[]=_("Paiement");
- $title[]=_("operation");
- $title[]=_("Pièce");
- $title[]=_("Client/Fourn.");
- $title[]=_("Note");
- $title[]=_("interne");
- $title[]=_("HTVA");
- $title[]=_("privé");
- $title[]=_("DNA");
- $title[]=_("tva non ded.");
- $title[]=_("TVA NP");
-
- if ( $own->MY_TVA_USE=='Y')
- {
- $a_Tva=$cn->get_array("select tva_id,tva_label from tva_rate order
by tva_rate,tva_label,tva_id");
- foreach($a_Tva as $line_tva)
- {
- $title[]="Tva ".$line_tva['tva_label'];
- }
+ if ( $jrn_type == "ACH") {
+ $acc_ledger_history=new
Acc_Ledger_History_Purchase($cn,[$Jrn->id],$get_from_periode,$get_to_periode,'D');
+ $acc_ledger_history->export_csv();
}
- $title[]=_("TVAC");
- $title[]=_("opérations liées");
- $export->write_header($title);
-
- foreach ($Row as $line)
- {
- $export->add($line['date']);
- $export->add($line['date_paid']);
- $export->add($line['num']);
- $export->add($line['jr_pj_number']);
-
$export->add($Jrn->get_tiers($line['jrn_def_type'],$line['jr_id']));
- $export->add($line['comment']);
- $export->add($line['jr_internal']);
- $export->add($line['HTVA'],"number");
- $export->add($line['dep_priv'],"number");
- $export->add($line['dna'],"number");
- $export->add($line['tva_dna'],"number");
- $export->add($line['tva_np'],"number");
- $a_tva_amount=array();
- //- set all TVA to 0
- foreach ($a_Tva as $l) {
- $t_id=$l["tva_id"];
- $a_tva_amount[$t_id]=0;
- }
- foreach ($line['TVA'] as $lineTVA)
- {
- $idx_tva=$lineTVA[1][0];
- $a_tva_amount[$idx_tva]=$lineTVA[1][2];
- }
- if ($own->MY_TVA_USE == 'Y' )
- {
- foreach ($a_Tva as $line_tva)
- {
- $a=$line_tva['tva_id'];
- $export->add($a_tva_amount[$a],"number");
- }
- }
- $export->add($line['TVAC'],"number");
- /**
- * Retrieve payment if any
- */
-
$ret_reconcile=$cn->execute('reconcile_date',array($line['jr_id']));
- $max=Database::num_row($ret_reconcile);
- if ($max > 0) {
- for ($e=0;$e<$max;$e++) {
- $row=Database::fetch_array($ret_reconcile, $e);
- $export->add($row['str_date']);
- $export->add($row['jr_internal']);
- }
- }
- $export->write();
-
+ if ( $jrn_type == "VEN") {
+ $acc_ledger_history=new
Acc_Ledger_History_Sale($cn,[$Jrn->id],$get_from_periode,$get_to_periode,'D');
+ //@todo to implement $acc_ledger_history->export_csv();
}
- }
}
?>
diff --git a/include/template/acc_ledger_history_purchase_detail.php
b/include/template/acc_ledger_history_purchase_detail.php
index ea39c3f..e3c5e94 100644
--- a/include/template/acc_ledger_history_purchase_detail.php
+++ b/include/template/acc_ledger_history_purchase_detail.php
@@ -116,7 +116,7 @@ foreach ($this->data as $line) {
echo "<TD class=\"num\">" . $tva_dna. "</TD>";
$a_tva_amount=array();
- foreach ($line['detail_vat'] as $lineTVA)
+ foreach ($line['m'] as $lineTVA)
{
foreach ($a_Tva as $idx=>$line_tva)
{
- [Noalyss-commit] [noalyss] 63/323: Task #0001529: Icon_Action missing, (continued)
- [Noalyss-commit] [noalyss] 63/323: Task #0001529: Icon_Action missing, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 62/323: Merge branch 'master' of ssh://ns3/srv/git/noalyss, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 66/323: Database : add function is_prepare() to check if pg_prepare has already run, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 48/323: Task #1520 : Préférence : pouvoir changer les préférence pour les exports CSV, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 59/323: Task #0001529: Réécriture de code , placer les icones dans Icon_Action, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 45/323: Task #0001519: Assouplissement de la sécurité : journaux et actions, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 77/323: Small bug in clean card, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 69/323: Task #0001530: Réécriture PRINTJRN : export PDF, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 80/323: before deleting a card , check if it is not used as an attribute in another card, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 78/323: esthetic, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 70/323: Task #0001530: Réécriture PRINTJRN : export CSV : Purchase List (L),
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 73/323: Missing import of icon_action, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 75/323: Merge branch 'rewrite-printjrn', Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 76/323: Small bug in save_card, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 71/323: task #1531: Historique poste et fiche d'après exercice opération, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 83/323: Esthétique Recherche action, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 68/323: Task #0001530: Réécriture PRINTJRN Add Financial Ledger Adapt test file, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 61/323: Fix some issues with PRINTJRN, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 79/323: before deleting a card , check if it is not used as an attribute in another card, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 04/323: Improve Doxygen documentation, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 60/323: remove deprecated theme, Dany De Bontridder, 2018/03/14