[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 154/323: FIX : PRINTJRN, ledger PDF and CSV
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 154/323: FIX : PRINTJRN, ledger PDF and CSV |
Date: |
Wed, 14 Mar 2018 17:38:41 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit e782275c893366bff03e6e03fd871ea6702155e4
Author: Dany De Bontridder <address@hidden>
Date: Thu Feb 8 22:19:59 2018 +0100
FIX : PRINTJRN, ledger PDF and CSV
---
include/class/acc_ledger_fin.class.php | 2 +-
include/class/print_ledger.class.php | 154 ++++++++++++++++++++++++---------
include/export/export_ledger_csv.php | 38 +-------
3 files changed, 117 insertions(+), 77 deletions(-)
diff --git a/include/class/acc_ledger_fin.class.php
b/include/class/acc_ledger_fin.class.php
index 2144b1f..ca5da1a 100644
--- a/include/class/acc_ledger_fin.class.php
+++ b/include/class/acc_ledger_fin.class.php
@@ -24,6 +24,7 @@
* \brief the class Acc_Ledger_Fin inherits from Acc_Ledger, this
* object permit to manage the financial ledger
*/
+require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php';
require_once NOALYSS_INCLUDE.'/lib/idate.class.php';
require_once NOALYSS_INCLUDE.'/lib/icard.class.php';
require_once NOALYSS_INCLUDE.'/lib/ispan.class.php';
@@ -32,7 +33,6 @@ require_once NOALYSS_INCLUDE.'/lib/iconcerned.class.php';
require_once NOALYSS_INCLUDE.'/lib/ifile.class.php';
require_once NOALYSS_INCLUDE.'/lib/ihidden.class.php';
require_once NOALYSS_INCLUDE.'/lib/iselect.class.php';
-require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
require_once NOALYSS_INCLUDE.'/class/acc_reconciliation.class.php';
diff --git a/include/class/print_ledger.class.php
b/include/class/print_ledger.class.php
index d019f30..a8bcec2 100644
--- a/include/class/print_ledger.class.php
+++ b/include/class/print_ledger.class.php
@@ -52,29 +52,38 @@ class Print_Ledger {
if ($p_format_output == 'PDF') {
switch ($p_type_export) {
case 'D':
- $own = new Noalyss_Parameter_Folder($cn);
- $jrn_type = $p_ledger->get_type();
+ $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'||$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);
+ ($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);
+ 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);
+ if ($own->MY_TVA_USE=='N')
+ {
+ $pdf=new Print_Ledger_Simple_without_vat($cn,
+ $p_ledger);
return $pdf;
}
- }else
+ }
+ else
return new Print_Ledger_Detail($cn, $p_ledger);
break;
@@ -82,76 +91,139 @@ class Print_Ledger {
//----------------------------------------------------------------------
// Simple Printing Purchase Ledger
//---------------------------------------------------------------------
- $own = new Noalyss_Parameter_Folder($cn);
- $jrn_type = $p_ledger->get_type();
+ $own=new Noalyss_Parameter_Folder($cn);
+ $jrn_type=$p_ledger->get_type();
- if ($jrn_type == 'ACH' || $jrn_type == 'VEN') {
+ 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);
+ ($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);
+ 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);
+ 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);
+ 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);
+ 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_Financial($cn, $p_ledger);
+ *
********************************************************* */
+ $own=new Noalyss_Parameter_Folder($cn);
+ $jrn_type=$p_ledger->get_type();
+ 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_Detail($cn, $p_ledger);
+ if ($jrn_type=='ODS'||$p_ledger->id==0)
+ {
+ $pdf=new Print_Ledger_Detail($cn, $p_ledger);
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);
+ ($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;
}
- $pdf = new Print_Ledger_Detail_Item($cn,$p_ledger);
+ $pdf=new Print_Ledger_Detail_Item($cn, $p_ledger);
return $pdf;
case 'A':
/***********************************************************
* Accounting
*/
- $pdf = new Print_Ledger_Detail($cn, $p_ledger);
+ $pdf=new Print_Ledger_Detail($cn, $p_ledger);
return $pdf;
break;
-
} // end switch
} // end $p_format == PDF
}
// end function
+ /**
+ * @brief find all the active ledger for the exerice of the periode
+ * and readable by the current user
+ * @global type $g_user
+ * @param int $get_from_periode
+ * @return array of ledger id
+ */
+ static function available_ledger($get_from_periode)
+ {
+ global $g_user;
+ $cn=Dossier::connect();
+ // Find periode
+ $periode=new Periode($cn, $get_from_periode);
+ $exercice=$periode->get_exercice($get_from_periode);
+
+ if
($g_user->Admin()==0&&$g_user->is_local_admin()==0&&$g_user->get_status_security_ledger()
+ ==1)
+ {
+ $sql="select jrn_def_id
+ from jrn_def join jrn_type on jrn_def_type=jrn_type_id
+ join user_sec_jrn on uj_jrn_id=jrn_def_id
+ where
+ uj_login=$1
+ and uj_priv in ('R','W')
+ order by jrn_def_name
+ and ( jrn_enable=1
+ or
+ exists (select 1 from jrn where jr_tech_per in (select
p_id from parm_periode where p_exercice=$2))
+ ";
+ $a_jrn=$cn->get_array($sql, array($g_user->login, $exercice));
+ }
+ else
+ {
+ $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_tech_per in (select p_id from parm_periode where p_exercice=$1))
+ order by jrn_def_name
+ ", [$exercice]);
+ }
+ $a=[];
+ $nb_jrn=count($a_jrn);
+ for ($i=0; $i<$nb_jrn; $i++)
+ {
+ $a[]=$a_jrn[$i]['jrn_def_id'];
+ }
+ return $a;
+ }
+
}
?>
diff --git a/include/export/export_ledger_csv.php
b/include/export/export_ledger_csv.php
index 96a466a..73e8008 100644
--- a/include/export/export_ledger_csv.php
+++ b/include/export/export_ledger_csv.php
@@ -32,6 +32,7 @@ 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();
@@ -83,41 +84,8 @@ global $g_user;
*/
if ($get_jrn==0)
{
- // Find periode
- $periode=new Periode($cn, $get_from_periode);
- $exercice=$periode->get_exercice($get_from_periode);
-
- if
($g_user->Admin()==0&&$g_user->is_local_admin()==0&&$g_user->get_status_security_ledger()
- ==1)
- {
- $sql="select jrn_def_id
- from jrn_def join jrn_type on jrn_def_type=jrn_type_id
- join user_sec_jrn on uj_jrn_id=jrn_def_id
- where
- uj_login=$1
- and uj_priv in ('R','W')
- order by jrn_def_name
- and ( jrn_enable=1
- or
- exists (select 1 from jrn where jr_tech_per in (select
p_id from parm_periode where p_exercice=$2))
- ";
- $a_jrn=$cn->get_array($sql, array($g_user->login, $exercice));
- }
- else
- {
- $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_tech_per in (select p_id from parm_periode where p_exercice=$1))
- order by jrn_def_name
- ", [$exercice]);
- }
- $a=[];
- $nb_jrn=count($a_jrn);
- for ($i=0;$i< $nb_jrn;$i++){
- $a[]=$a_jrn[$i]['jrn_def_id'];
- }
- $a_jrn=$a;
+ // find out all the available ledgers for the current user
+ $a_jrn=Print_Ledger::available_ledger($get_from_periode);
}
else
{
- [Noalyss-commit] [noalyss] 162/323: esthetic : improve title2, (continued)
- [Noalyss-commit] [noalyss] 162/323: esthetic : improve title2, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 158/323: bug: cannot create user, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 167/323: Suppress obsolete files, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 174/323: Improve Documentation, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 172/323: History accounting / card : first column is date, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 176/323: Manage_Table_SQL : Add tips for some col, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 164/323: Periode : change with exercice, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 166/323: PRINTBAL : add opening , correct, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 177/323: PRINTBAL : correct bug , exercice not get, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 173/323: Esthetic : put the anchor at a better place, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 154/323: FIX : PRINTJRN, ledger PDF and CSV,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 168/323: suppress useless file, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 169/323: Install : accept postgresql 10, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 165/323: PRINTBAL translate, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 197/323: CSS classic 7 : menu use font OpenSansRegular instead of SansaLight, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 199/323: CSS classic 7 : menu use font OpenSansRegular instead of SansaLight, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 163/323: Remove unused file, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 201/323: CSS : page login : forgotten email, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 190/323: SQL : remove comment on extension, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 200/323: Improve Cosmetic : login page, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 198/323: Improve Cosmetic : login page, Dany De Bontridder, 2018/03/14