diff --git a/html/index.php b/html/index.php
index 5be91c1f5..4fad9adf7 100644
--- a/html/index.php
+++ b/html/index.php
@@ -77,7 +77,7 @@ BODY {
-version 3.1.0
+version 4.0
diff --git a/html/style-light.css b/html/style-light.css
index a166f9f49..0c273dfc1 100644
--- a/html/style-light.css
+++ b/html/style-light.css
@@ -98,7 +98,7 @@ div.u_tmenu {
}
div.u_subtmenu {
- background-color:lightblue ;
+ background-color:white ;
float:left;
clear:both;
left:10px;
diff --git a/html/style.css b/html/style.css
index 3701e3bb7..209859d83 100644
--- a/html/style.css
+++ b/html/style.css
@@ -113,7 +113,7 @@ div.u_tool div.acces_direct{
div.u_subtmenu {
float:left;
clear:both;
-background-color:#C0E6E9;
+background-color:#879ED4;
}
div.u_subt2menu {
left:1%;
diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php
index 479f7b60d..abaed48c7 100644
--- a/include/class_acc_ledger.php
+++ b/include/class_acc_ledger.php
@@ -31,6 +31,8 @@ require_once ('jrn.php');
require_once ('class_acexception.php');
require_once ('class_acc_reconciliation.php');
require_once ('class_periode.php');
+require_once ('class_gestion_purchase.php');
+
/*!\file
* \brief Class for jrn, class acc_ledger for manipulating the ledger
*/
@@ -403,7 +405,9 @@ class Acc_Ledger {
{
$array[$i]=pg_fetch_array($Res);
$p=$this->get_detail($array[$i],$type,$trunc,$a_TVA,$a_ParmCode);
-
+ if ( $array[$i]['dep_priv'] != 0.0) {
+ $array[$i]['comment'].="(priv. ".$array[$i]['dep_priv'].")";
+ }
}
}
@@ -444,6 +448,7 @@ class Acc_Ledger {
*/
function get_detail(&$p_array,$p_jrn_type,$trunc=0,$a_TVA=null,$a_ParmCode=null)
{
+ echo_debug(__FILE__.':'.__LINE__.'- get_detail','$p_array',$p_array);
if ( $a_TVA == null )
{
//Load TVA array
@@ -460,9 +465,11 @@ class Acc_Ledger {
$p_array['TVAC']=0;
$p_array['TVA']=array();
$p_array['AMOUNT_TVA']=0.0;
+ $p_array['dep_priv']=0;
+ $dep_priv=0.0;
//
// Retrieve data from jrnx
- $sql="select j_poste,j_montant, j_debit,j_qcode from jrnx where ".
+ $sql="select j_id,j_poste,j_montant, j_debit,j_qcode from jrnx where ".
" j_grpt=".$p_array['grpt_id'];
$Res2=ExecSql($this->db,$sql);
$data_jrnx=pg_fetch_all($Res2);
@@ -565,9 +572,18 @@ class Acc_Ledger {
// isDNA
// If operation is reversed then amount are negatif
+ /* if ND */
+ if ( $p_array['jrn_def_type'] == 'ACH') {
+ $purchase=new Gestion_Purchase($this->db);
+ $purchase->search_by_jid($code['j_id']);
+ $purchase->load();
+ $dep_priv+=$purchase->qp_dep_priv;
+ echo_debug(__FILE__.':'.__LINE__.'- get_detail','$dep_priv',$dep_priv);
+ $p_array['dep_priv']=$dep_priv;
+ }
}
- $p_array['TVAC']=sprintf('% 10.2f',$p_array['TVAC']);
+ $p_array['TVAC']=sprintf('% 10.2f',$p_array['TVAC']-$dep_priv);
$p_array['HTVA']=sprintf('% 10.2f',$p_array['TVAC']-$p_array['AMOUNT_TVA']);
$r="";
$a_tva_amount=array();
diff --git a/include/class_gestion_purchase.php b/include/class_gestion_purchase.php
index eb51ed160..7cdf4a08c 100644
--- a/include/class_gestion_purchase.php
+++ b/include/class_gestion_purchase.php
@@ -84,4 +84,39 @@ class gestion_purchase extends gestion_table
}
return $array;
}
+ function search_by_jid($p_jid) {
+ $res=ExecSql($this->db,"select qp_id from quant_purchase where j_id=".$p_jid);
+
+ if ( pg_NumRows($res) == 1)
+ $this->qp_id=pg_fetch_result($res,0,0);
+ else
+ $this->qp_id=0;
+ }
+ function load() {
+ $sql="select qp_id,
+ qp_internal,
+ qp_fiche,
+ qp_quantite,
+ qp_price,
+ qp_vat,
+ qp_vat_code,
+ qp_nd_amount,
+ qp_nd_tva,
+ qp_nd_tva_recup,
+ qp_supplier,
+ j_id,
+ qp_dep_priv
+ from quant_purchase
+ where qp_id=".$this->qp_id;
+ $ret=ExecSql($this->db,$sql);
+ // $res contains all the line
+ $res=pg_fetch_all($ret);
+
+ if ( empty($res) ) return null;
+ foreach ($res[0] as $idx=>$value)
+ $this->$idx=$value;
+ echo_debug(__FILE__.':'.__LINE__.'- gestion_purchase', 'load',$this);
+
+ }
+
}
diff --git a/include/constant.php b/include/constant.php
index 08aea30ae..6e99ff0f6 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -36,7 +36,7 @@ define ("domaine","");
define ("MAX_COMPTE",4);
define ('MAX_BUD_DETAIL',20);
-define ("DEBUG","false");
+define ("DEBUG","true");
// securite correspond a la table
// action
diff --git a/include/impress.inc.php b/include/impress.inc.php
index 57f2b94ee..14a48e5ef 100644
--- a/include/impress.inc.php
+++ b/include/impress.inc.php
@@ -41,7 +41,7 @@ $p_array=array(array ("?p_action=impress&type=jrn&".$str_dossier,"Journaux"),
$default=( isset ($_GET['type']))?"?p_action=impress&type=".$_GET['type']."&$str_dossier":"";
-$result=ShowItem($p_array,'H',"mtitle","mtitle",$default);
+$result=ShowItem($p_array,'H',"mtitle","mtitle",$default,' width="100%"');
echo $result;
echo "";
diff --git a/include/user_menu.php b/include/user_menu.php
index 53c8854ea..b037387b7 100644
--- a/include/user_menu.php
+++ b/include/user_menu.php
@@ -193,7 +193,7 @@ function ShowMenuCompta($p_high="")
$str_dossier=dossier::get();
$r="";
$r.=menu_tool("compta");
- $r.='';
+ $r.='
';
$r.=$result;
$r.='
';
// $r.='
';
@@ -826,7 +826,7 @@ $r.='