[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 69/323: Task #0001530: Réécriture PRINTJRN :
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 69/323: Task #0001530: Réécriture PRINTJRN : export PDF |
Date: |
Wed, 14 Mar 2018 17:38:20 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit eba7117ad6bd12a701329aa411ad0d4ee4bfd422
Author: Dany De Bontridder <address@hidden>
Date: Sun Jan 21 23:11:54 2018 +0100
Task #0001530: Réécriture PRINTJRN : export PDF
---
include/class/acc_ledger.class.php | 20 +++++++++++-
.../class/acc_ledger_history_financial.class.php | 8 +++++
include/class/acc_ledger_history_generic.class.php | 9 +++++-
.../class/acc_ledger_history_purchase.class.php | 8 +++++
include/class/acc_ledger_history_sale.class.php | 9 ++++++
include/class/print_ledger.class.php | 37 +++++++++++++++++++---
include/export/export_ledger_csv.php | 8 ++---
include/export/export_ledger_pdf.php | 2 +-
include/impress_jrn.inc.php | 36 +++++++++++++++++++--
9 files changed, 123 insertions(+), 14 deletions(-)
diff --git a/include/class/acc_ledger.class.php
b/include/class/acc_ledger.class.php
index 1f32a0d..5000ce7 100644
--- a/include/class/acc_ledger.class.php
+++ b/include/class/acc_ledger.class.php
@@ -44,6 +44,7 @@ require_once NOALYSS_INCLUDE.'/class/lettering.class.php';
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.'/lib/http_input.class.php';
/** \file
@@ -1919,6 +1920,7 @@ class Acc_Ledger extends jrn_def_sql
" ,coalesce(sum(qs_vat),0) as vat ".
',0 as priv'.
',0 as tva_nd'.
+ ',coalesce(sum(qs_vat_sided),0) as reversed'.
',coalesce(sum(qs_vat_sided),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') ".
@@ -2617,7 +2619,23 @@ class Acc_Ledger extends jrn_def_sql
$array=$this->db->get_array($sql, array($p_date));
return $array;
}
-
+ /** @brief Get simplified row from ledger
+ * Call Acc_Ledger_History_Generic:get_rowSimple
+ * @param p_from periode
+ * @param p_to periode
+ * @param p_limit starting line
+ * @param p_offset number of lines
+ * @param trunc if data must be truncated (pdf export)
+ *
+ * \return an Array with the asked data
+ */
+ function get_rowSimple($p_from, $p_to, $trunc=0, $p_limit=-1, $p_offset=-1)
+ {
+ $alh_generic=new Acc_Ledger_History_Generic($this->db, [$this->id],
$p_from, $p_to, "A");
+ $alh_generic->get_rowSimple($trunc,$p_limit,$p_offset);
+ $data=$alh_generic->get_data();
+ return $data;
+ }
/**
* @brief get info from supplier to pay today
*/
diff --git a/include/class/acc_ledger_history_financial.class.php
b/include/class/acc_ledger_history_financial.class.php
index 2895835..0294bd7 100644
--- a/include/class/acc_ledger_history_financial.class.php
+++ b/include/class/acc_ledger_history_financial.class.php
@@ -136,5 +136,13 @@ class Acc_Ledger_History_Financial extends
Acc_Ledger_History
{$cond_limite}";
$this->data=$this->db->get_array($sql);
}
+ /**
+ * To get data
+ * @return array of rows
+ */
+ function get_data()
+ {
+ return $this->data;
+ }
}
diff --git a/include/class/acc_ledger_history_generic.class.php
b/include/class/acc_ledger_history_generic.class.php
index 714dc95..8b8a5ce 100644
--- a/include/class/acc_ledger_history_generic.class.php
+++ b/include/class/acc_ledger_history_generic.class.php
@@ -733,5 +733,12 @@ class Acc_Ledger_History_Generic extends Acc_Ledger_History
echo '</tr>';
echo "</table>";
}
-
+ /**
+ * To get data
+ * @return array of rows
+ */
+ function get_data()
+ {
+ return $this->data;
+ }
}
diff --git a/include/class/acc_ledger_history_purchase.class.php
b/include/class/acc_ledger_history_purchase.class.php
index 72eeb41..70daa96 100644
--- a/include/class/acc_ledger_history_purchase.class.php
+++ b/include/class/acc_ledger_history_purchase.class.php
@@ -225,5 +225,13 @@ class Acc_Ledger_History_Purchase extends
Acc_Ledger_History
");
}
}
+ /**
+ * To get data
+ * @return array of rows
+ */
+ function get_data()
+ {
+ return $this->data;
+ }
}
diff --git a/include/class/acc_ledger_history_sale.class.php
b/include/class/acc_ledger_history_sale.class.php
index 4f1b2f6..d75aa31 100644
--- a/include/class/acc_ledger_history_sale.class.php
+++ b/include/class/acc_ledger_history_sale.class.php
@@ -67,6 +67,7 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
$this->get_row();
$this->add_vat_info();
$this->prepare_detail();
+ $this->prepare_reconcile_date();
include NOALYSS_TEMPLATE."/acc_ledger_history_sale_extended.php";
}
/**
@@ -215,5 +216,13 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
require_once NOALYSS_TEMPLATE.'/acc_ledger_history_sale_oneline.php';
}
+ /**
+ * To get data
+ * @return array of rows
+ */
+ function get_data()
+ {
+ return $this->data;
+ }
}
diff --git a/include/class/print_ledger.class.php
b/include/class/print_ledger.class.php
index 7503fca..d019f30 100644
--- a/include/class/print_ledger.class.php
+++ b/include/class/print_ledger.class.php
@@ -51,14 +51,34 @@ class Print_Ledger {
*/
if ($p_format_output == 'PDF') {
switch ($p_type_export) {
- case 0:
+ case 'D':
+ $own = new Noalyss_Parameter_Folder($cn);
+ $jrn_type = $p_ledger->get_type();
//---------------------------------------------
// Detailled Printing (accounting )
//---------------------------------------------
- return new Print_Ledger_Detail($cn, $p_ledger);
+ 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;
+ }
+ }else
+ return new Print_Ledger_Detail($cn, $p_ledger);
break;
- case 1:
+ case 'L':
//----------------------------------------------------------------------
// Simple Printing Purchase Ledger
//---------------------------------------------------------------------
@@ -94,7 +114,7 @@ class Print_Ledger {
return $pdf;
}
break;
- case 2:
+ case 'E':
/**********************************************************
* Print Detail Operation + Item
********************************************************** */
@@ -106,7 +126,7 @@ class Print_Ledger {
;
}
if ($jrn_type == 'ODS' || $p_ledger->id == 0) {
- $pdf = new Print_Ledger_Misc($cn, $p_ledger);
+ $pdf = new Print_Ledger_Detail($cn, $p_ledger);
return $pdf;
}
if (
@@ -119,6 +139,13 @@ class Print_Ledger {
}
$pdf = new Print_Ledger_Detail_Item($cn,$p_ledger);
return $pdf;
+ case 'A':
+
/***********************************************************
+ * Accounting
+ */
+ $pdf = new Print_Ledger_Detail($cn, $p_ledger);
+ return $pdf;
+ break;
} // end switch
} // end $p_format == PDF
diff --git a/include/export/export_ledger_csv.php
b/include/export/export_ledger_csv.php
index 9041f58..7f55dbc 100644
--- a/include/export/export_ledger_csv.php
+++ b/include/export/export_ledger_csv.php
@@ -46,7 +46,7 @@ $export->send_header();
try
{
$get_jrn=$http->get('jrn_id',"number");
- $get_option=$http->get('p_simple',"number");
+ $get_option=$http->get('p_simple',"string");
$get_from_periode= $http->get('from_periode');
$get_to_periode=$http->get('to_periode');
@@ -80,7 +80,7 @@ $jrn_type=$Jrn->get_type();
//
// With Detail per item which is possible only for VEN or ACH
//
-if ($get_option == 2)
+if ($get_option == 'D')
{
if ($jrn_type != 'ACH' && $jrn_type != 'VEN' || $Jrn->id == 0)
{
@@ -132,7 +132,7 @@ if ($get_option == 2)
// Detailled printing
// For miscellaneous legder or all ledgers
//-----------------------------------------------------------------------------
-if ( $get_option == 0 )
+if ( $get_option == 'A' )
{
$Jrn->get_row( $get_from_periode, $get_to_periode );
$title=array();
@@ -180,7 +180,7 @@ if ( $get_option == 0 )
// for Misc the amount
// For Financial only the tiers and the sign of the amount
//-----------------------------------------------------------------------------
-if ($get_option == 1)
+if ($get_option == "L")
{
//-----------------------------------------------------
diff --git a/include/export/export_ledger_pdf.php
b/include/export/export_ledger_pdf.php
index ea2fcc1..2ac0a29 100644
--- a/include/export/export_ledger_pdf.php
+++ b/include/export/export_ledger_pdf.php
@@ -45,7 +45,7 @@ $periode = new Periode($cn);
try
{
$jrn_id=$http->get('jrn_id',"number");
- $p_simple=$http->get('p_simple',"number");
+ $p_simple=$http->get('p_simple',"string");
}
diff --git a/include/impress_jrn.inc.php b/include/impress_jrn.inc.php
index a5b02b2..9098511 100644
--- a/include/impress_jrn.inc.php
+++ b/include/impress_jrn.inc.php
@@ -162,7 +162,7 @@ print HtmlInput::submit('bt_html', _('Visualisation'));
echo '</FORM>';
echo '<hr>';
-
+
//-----------------------------------------------------
// If print is asked
// First time in html
@@ -171,9 +171,41 @@ echo '<hr>';
if (isset($_REQUEST['bt_html']))
{
// Type of report : listing=1 , Accounting writing=0, detail =2
-
+ $hid=new IHidden();
$jrn_id=$http->get("jrn_id","number");
+ echo '<table>';
+ echo '<td>';
+ echo '<form method="GET" ACTION="export.php">' . dossier::hidden() .
+ HtmlInput::submit('bt_pdf', "Export PDF") .
+ HtmlInput::hidden('act', 'PDF:ledger') .
+ $hid->input("type", "jrn") .
+ $hid->input("jrn_id", $jrn_id) .
+ $hid->input("from_periode", $from_periode) .
+ $hid->input("to_periode", $to_periode);
+ echo $hid->input("p_simple", $simple);
+ echo HtmlInput::get_to_hidden(array('ac', 'type'));
+ echo "</form>";
+ echo '</td>';
+
+ echo '<TD><form method="GET" ACTION="export.php">' . dossier::hidden() .
+ HtmlInput::submit('bt_csv', "Export CSV") .
+ HtmlInput::hidden('act', 'CSV:ledger') .
+ $hid->input("type", "jrn") .
+ $hid->input("jrn_id", $jrn_id) .
+ $hid->input("from_periode", $from_periode) .
+ $hid->input("to_periode", $to_periode);
+ echo $hid->input("p_simple", $simple);
+ echo HtmlInput::get_to_hidden(array('ac', 'type'));
+ echo "</form></TD>";
+
+ echo '<td style="vertical-align:top">';
+ echo HtmlInput::print_window();
+ echo '</td>';
+ echo "</TR>";
+
+ echo "</table>";
+
/*
* Compute an array with all the usable ledger
*/
- [Noalyss-commit] [noalyss] 55/323: Task #1457 & 1281 : export PDF with opening writing, (continued)
- [Noalyss-commit] [noalyss] 55/323: Task #1457 & 1281 : export PDF with opening writing, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 54/323: Task #1326 & #1512 = ajout détail extourne, libellé directement après ajout opération, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 57/323: Task #0001527: Effacement du champ code fiche : bouton , indent, Dany De Bontridder, 2018/03/14
- [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 <=
- [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, 2018/03/14
- [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