diff --git a/doc/manuel-fr.sgml b/doc/manuel-fr.sgml
index 79f3eee4d..48d22b7e0 100644
--- a/doc/manuel-fr.sgml
+++ b/doc/manuel-fr.sgml
@@ -489,7 +489,7 @@ C'est l'unique journal qui n'utilise pas les fiches. Pourquoi ? Tout
simplement parce
que s'il utilisait lui-aussi les fiches, il faudrait faire une fiche
par poste comptable,
-ce qui serait rapidement ingérable. De plus, es fiches sont là pour
+ce qui serait rapidement ingérable. De plus, les fiches sont là pour
les opérations
courantes (vente/Achat/banque). Puisque ce journal n'utilise pas les
fiches, le filtre est
@@ -511,7 +511,8 @@ Pour cr
création. Vous devez donner le nom de la catégorie et le type de fiche
que vous voulez.
-La classe de base est le poste comptable parent de vos fiche, ce poste doit exister, il faut alors
+La classe de base est le poste comptable parent de vos fiche, ce poste
+doit exister, il faut alors
cliquer aussi sur "create account for each" qui permet de générer
automatiquement le poste comptable voulu, ce poste sera
automatiquement ajouté dans le Plan Comptable. Si cette option n'est
@@ -524,8 +525,11 @@ classe par d
Pour simplifier :
Cas spécial: la classe de base "Autre" permet de créer des fiches
+sur mesure, par exemple: liste des employés,
Autre : comme plusieur fiches peuvent utiliser le même poste comptable, si on
modifie le nom d'une fiche cela ne modifiera pas son nom dans le Plan Comptable
+
La tva est automatiquement mise, on prend celle de la fiche, il n'est
diff --git a/html/fiche_csv.php b/html/fiche_csv.php
index 2b2088999..a0fd04f97 100644
--- a/html/fiche_csv.php
+++ b/html/fiche_csv.php
@@ -24,7 +24,7 @@ include_once ("ac_common.php");
include_once('class_fiche.php');
include_once ("postgres.php");
include_once("check_priv.php");
-
+if ( isset ($_REQUEST['with_amount'])) include_once("class_poste.php");
$cn=DbConnect($_SESSION['g_dossier']);
$rep=DbConnect();
@@ -49,19 +49,42 @@ if ( isset ($_POST['fd_id'])) {
if ( $o == 0 ) {
printf("%s",$attribut->ad_text);
$o=1;
- }else
- printf(";%s",$attribut->ad_text);
+ }else {
+ printf(";%s",$attribut->ad_text);
+ if ( $attribut->ad_id == ATTR_DEF_ACCOUNT
+ && isset ($_REQUEST['with_amount']))
+ echo ";debit;credit;solde";
+ }
}
printf("\n");
$o=0;
// Details
+ // Save the accounting
foreach ($e as $detail) {
foreach ( $detail->attribut as $dattribut ) {
if ( $o == 0 ) {
printf("%s",$dattribut->av_text);
$o=1;
- } else
- printf (";%s",$dattribut->av_text);
+ } else {
+ printf (";%s",$dattribut->av_text);
+ // if solde resquested
+ //--
+ if ( $dattribut->ad_id == ATTR_DEF_ACCOUNT
+ && isset ($_REQUEST['with_amount'])) {
+ $account=new poste ($cn,$dattribut->av_text);
+ $solde=$account->GetSoldeDetail("j_tech_per between ".$_REQUEST['from_periode'].
+ " and ".
+ $_REQUEST['to_periode']);
+
+ printf(";% 10.2f;% 10.2f;% 10.2f",
+ $solde['debit'],
+ $solde['credit'],
+ $solde['solde']
+ );
+
+
+ }
+ }
}
printf("\n");
$o=0;
diff --git a/html/user_impress.php b/html/user_impress.php
index db43506d3..572edd4cc 100644
--- a/html/user_impress.php
+++ b/html/user_impress.php
@@ -67,7 +67,7 @@ if ( $User->admin == 0 ) {
}
// something is choosen
-$default=( isset ($_GET['type']))?$_GET['type']:"";
+$default=( isset ($_REQUEST['type']))?$_REQUEST['type']:"";
switch ($default) {
case "jrn":
include ("impress_jrn.php");
diff --git a/include/class_fiche.php b/include/class_fiche.php
index c262a2056..f14cab014 100644
--- a/include/class_fiche.php
+++ b/include/class_fiche.php
@@ -113,6 +113,21 @@ class fiche_def {
$this->all[$i]->create_account=$row['fd_create_account'];
}
}
+/* function HasAttribute
+ **************************************************
+ * Purpose : Check in vw_fiche_def if a fiche has
+ * a attribut X
+ *
+ * parm :
+ * - attribut to check
+ * gen :
+ * - none
+ * return: true or false
+ */
+ function HasAttribute($p_attr) {
+ return (CountSql($this->cn,"select * from vw_fiche_def where ad_id=$p_attr and fd_id=".$this->id)>0)?true:false;
+
+ }
}
diff --git a/include/class_poste.php b/include/class_poste.php
index 9533997b9..17a99549c 100644
--- a/include/class_poste.php
+++ b/include/class_poste.php
@@ -111,5 +111,33 @@ function GetSolde($p_cond="") {
return abs($r['sum_deb']-$r['sum_cred']);
}
-
+ /* function GetSoldeDetail
+ * Purpose : give the balance of an account
+ *
+ * parm :
+ * - cond
+ * gen :
+ * - none
+ * return:
+ * - balance of the account
+ *
+ */
+function GetSoldeDetail($p_cond="") {
+ $Res=ExecSql($this->db,"select sum(deb) as sum_deb, sum(cred) as sum_cred from
+ ( select j_poste,
+ case when j_debit='t' then j_montant else 0 end as deb,
+ case when j_debit='f' then j_montant else 0 end as cred
+ from jrnx join tmp_pcmn on j_poste=pcm_val
+ where
+ j_poste like ('$this->id'::text) and
+ $p_cond
+ ) as m ");
+ $Max=pg_NumRows($Res);
+ if ($Max==0) return 0;
+ $r=pg_fetch_array($Res,0);
+
+ return array('debit'=>$r['sum_deb'],
+ 'credit'=>$r['sum_cred'],
+ 'solde'=>abs($r['sum_deb']-$r['sum_cred']));
+}
}
\ No newline at end of file
diff --git a/include/impress_fiche.php b/include/impress_fiche.php
index 66281b48b..fbc8f5fd8 100644
--- a/include/impress_fiche.php
+++ b/include/impress_fiche.php
@@ -24,53 +24,118 @@ include_once('class_fiche.php');
include_once("class_widget.php");
$cn=DbConnect($_SESSION['g_dossier']);
-$fiche_def=new fiche_def($cn);
-
-$fiche_def->GetAll();
-
-$i=0;
-foreach ($fiche_def->all as $l_fiche) {
- $a[$i]=array("user_impress.php?type=fiche&fd_id=".$l_fiche->id,$l_fiche->label);
- $i++;
-}
-echo ShowItem($a,'V');
////////////////////////////////////////////////////////////////////////////////
-if ( isset ($_GET['fd_id'])) {
- echo '";
+ echo "
";
echo "
";
echo "";
}
+ else {
+ // only the menu
+ $fiche_def=new fiche_def($cn);
+
+
+ $fiche_def->GetAll();
+
+ $i=0;
+ foreach ($fiche_def->all as $l_fiche) {
+ $a[$i]=array("user_impress.php?type=fiche&fd_id=".$l_fiche->id,$l_fiche->label);
+ $i++;
+ }
+ echo ShowItem($a,'V');
+ }
+
?>
\ No newline at end of file
";
$fiche_def->GetAttribut();
- foreach ($fiche_def->attribut as $attribut)
+ foreach ($fiche_def->attribut as $attribut) {
echo " ".$attribut->ad_text." ";
+ // si solde demandé affiche la col
+ //--
+ if ($attribut->ad_id==ATTR_DEF_ACCOUNT
+ && $with_amount==true) {
+ echo "Débit ";
+ echo "Crédit ";
+ echo "Solde ";
+ }
+ }
+
echo "";
if ( count($e) != 0 ) {
foreach ($e as $detail) {
echo " ";
foreach ( $detail->attribut as $dattribut ) {
echo " ";
}
+ echo "";
}
+
echo "".$dattribut->av_text." ";
+ // if amount requested
+ //---
+ if ( $dattribut->ad_id == ATTR_DEF_ACCOUNT &&
+ $with_amount) {
+
+ $account=new poste ($cn,$dattribut->av_text);
+ $solde= $account->GetSoldeDetail("j_tech_per between ".$_REQUEST['from_periode'].
+ " and ".
+ $_REQUEST['to_periode']);
+ printf ("% 10.2f ",$solde['debit']);
+ printf ("% 10.2f ",$solde['credit']);
+ printf ("% 10.2f ",$solde['solde']);
+
+ }
}
- echo "