phpcompta-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpcompta-dev] r4865 - phpcompta/trunk/include


From: phpcompta-dev
Subject: [Phpcompta-dev] r4865 - phpcompta/trunk/include
Date: Wed, 6 Jun 2012 14:48:07 +0200 (CEST)

Author: danydb
Date: 2012-06-06 14:48:07 +0200 (Wed, 06 Jun 2012)
New Revision: 4865

Modified:
   phpcompta/trunk/include/class_acc_ledger_purchase.php
   phpcompta/trunk/include/class_acc_ledger_sold.php
   phpcompta/trunk/include/class_acc_payment.php
Log:
0000600: Dans moyen de paiement, ajouter acompte

Modified: phpcompta/trunk/include/class_acc_ledger_purchase.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger_purchase.php       2012-06-06 
11:11:35 UTC (rev 4864)
+++ phpcompta/trunk/include/class_acc_ledger_purchase.php       2012-06-06 
12:48:07 UTC (rev 4865)
@@ -254,6 +254,9 @@
              }
            $nb++;
         }
+        /**
+         * address@hidden check that  acompte is less than total amount
+         */
         if ( $nb == 0 )
             throw new Exception(_('Il n\'y a aucune marchandise'),12);
 
@@ -766,14 +769,16 @@
                 {
                     $poste_val=$sposte;
                 }
+                
+                $famount=bcsub($cust_amount,$acompte);
                 $acc_pay->poste=$poste_val;
                 $acc_pay->qcode=$fqcode;
-                $acc_pay->amount=abs(round($cust_amount,2));
+                $acc_pay->amount=abs(round($famount,2));
                 $acc_pay->desc='';
                 $acc_pay->grpt=$acseq;
                 $acc_pay->jrn=$mp->get_parameter('ledger_target');
                 $acc_pay->periode=$tperiode;
-               $acc_pay->type=($cust_amount>=0)?'c':'d';
+               $acc_pay->type=($famount>=0)?'c':'d';
                 $acc_pay->insert_jrnx();
 
                 /* Insert supplier  */
@@ -781,12 +786,12 @@
                 $acc_pay->date=$e_date;
                 $acc_pay->poste=$poste;
                 $acc_pay->qcode=$e_client;
-                $acc_pay->amount=abs(round($cust_amount,2));
+                $acc_pay->amount=abs(round($famount,2));
                 $acc_pay->desc='';
                 $acc_pay->grpt=$acseq;
                 $acc_pay->jrn=$mp->get_parameter('ledger_target');
                 $acc_pay->periode=$tperiode;
-                               $acc_pay->type=($cust_amount>=0)?'d':'c';
+                               $acc_pay->type=($famount>=0)?'d':'c';
                 $let_other=$acc_pay->insert_jrnx();
 
                 /* insert into jrn */
@@ -823,7 +828,7 @@
                /* if ledger is FIN then insert into quant_fin */
                if ( $prop['jrn_def_type'] == 'FIN' )
                  {
-                   
$ledger->insert_quant_fin($acfiche->id,$mp_jr_id,$cust->id,bcmul($cust_amount,-1));
+                   
$ledger->insert_quant_fin($acfiche->id,$mp_jr_id,$cust->id,bcmul($famount,-1));
                  }
 
 
@@ -1507,13 +1512,13 @@
                if ( $e_mp!=0 && strlen (trim (${'e_mp_qcode_'.$e_mp})) != 0 )
         {
             $r.=HtmlInput::hidden('e_mp_qcode_'.$e_mp,${'e_mp_qcode_'.$e_mp});
-
+            $r.=HtmlInput::hidden('acompte');
             /* needed for generating a invoice */
             $r.=HtmlInput::hidden('qcode_benef', ${'e_mp_qcode_' . $e_mp});
                        $fname = new Fiche($this->db);
                        $fname->get_by_qcode(${'e_mp_qcode_' . $e_mp});
                        $r.='<div style="float:left"><h2 class="info">' . "Payé 
par " . ${'e_mp_qcode_' . $e_mp} .
-                                       " ".$fname->getName() . '</h2></div>';
+                                       " ".$fname->getName() ." ". 
_('Déduction de ').h($acompte).'</h2></div>';
             $r.='<br>';
         }
         // check for upload piece

Modified: phpcompta/trunk/include/class_acc_ledger_sold.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger_sold.php   2012-06-06 11:11:35 UTC 
(rev 4864)
+++ phpcompta/trunk/include/class_acc_ledger_sold.php   2012-06-06 12:48:07 UTC 
(rev 4865)
@@ -217,6 +217,9 @@
         //------------------------------------------------------
         // The "Paid By"  check
         //------------------------------------------------------
+        /**
+         address@hidden check that  acompte is less than total amount 
+         */
         if ($e_mp != 0 ) $this->check_payment($e_mp,${"e_mp_qcode_".$e_mp});
 
     }
@@ -536,16 +539,16 @@
                 {
                     $poste_val=$sposte;
                 }
-
+                $famount=bcsub($cust_amount,$acompte);
                 $acc_pay->poste=$poste_val;
                 $acc_pay->qcode=$fqcode;
-                $acc_pay->amount=abs(round($cust_amount,2));
+                $acc_pay->amount=abs(round($famount,2));
                 $acc_pay->desc=null;
 
                 $acc_pay->grpt=$acseq;
                 $acc_pay->jrn=$mp->get_parameter('ledger_target');
                 $acc_pay->periode=$tperiode;
-                $acc_pay->type=($cust_amount>=0)?'d':'c';
+                $acc_pay->type=($famount>=0)?'d':'c';
                 $acc_pay->insert_jrnx();
 
                 /* Insert supplier  */
@@ -553,12 +556,12 @@
                 $acc_pay->date=$e_date;
                 $acc_pay->poste=$poste;
                 $acc_pay->qcode=$e_client;
-                $acc_pay->amount=abs(round($cust_amount,2));
+                $acc_pay->amount=abs(round($famount,2));
                 $acc_pay->desc=null;
                 $acc_pay->grpt=$acseq;
                 $acc_pay->jrn=$mp->get_parameter('ledger_target');
                 $acc_pay->periode=$tperiode;
-                               $acc_pay->type=($cust_amount>=0)?'c':'d';
+                               $acc_pay->type=($famount>=0)?'c':'d';
                 $let_other=$acc_pay->insert_jrnx();
 
                 /* insert into jrn */
@@ -597,7 +600,7 @@
                /* if ledger is FIN then insert into quant_fin */
                if ( $prop['jrn_def_type'] == 'FIN' )
                  {
-                   
$ledger->insert_quant_fin($acfiche->id,$mp_jr_id,$cust->id,bcmul($cust_amount,1));
+                   
$ledger->insert_quant_fin($acfiche->id,$mp_jr_id,$cust->id,bcmul($famount,1));
                  }
 
             }
@@ -887,14 +890,14 @@
         if ( $e_mp!=0 && strlen (trim (${'e_mp_qcode_'.$e_mp})) != 0 )
         {
             $r.=HtmlInput::hidden('e_mp_qcode_'.$e_mp,${'e_mp_qcode_'.$e_mp});
-
+            $r.=HtmlInput::hidden('acompte');
             /* needed for generating a invoice */
             $r.=HtmlInput::hidden('qcode_benef',${'e_mp_qcode_'.$e_mp});
 
                        $fname=new Fiche($this->db);
                        $fname->get_by_qcode(${'e_mp_qcode_'.$e_mp});
                        $r.='<div style="float:left"><h2 class="info">'."Payé 
par ".${'e_mp_qcode_'.$e_mp}.
-                                  " ".$fname->getName().'</h2></div>';
+                                  " ".$fname->getName().' '._('Déduction de 
').h($acompte).'</h2></div>';
             $r.='<br>';
         }
 

Modified: phpcompta/trunk/include/class_acc_payment.php
===================================================================
--- phpcompta/trunk/include/class_acc_payment.php       2012-06-06 11:11:35 UTC 
(rev 4864)
+++ phpcompta/trunk/include/class_acc_payment.php       2012-06-06 12:48:07 UTC 
(rev 4865)
@@ -225,6 +225,10 @@
         }
         return $ret;
     }
+    /**
+     address@hidden
+     * @return string 
+     */
     public function row_deprecated()
     {
         
//---------------------------------------------------------------------------
@@ -325,6 +329,14 @@
         $r='';
         $array=$this->get_valide();
         $r.=HtmlInput::hidden('gDossier',dossier::id());
+       
+        if ( empty($array)==false ) {
+            $acompte=new INum('acompte');
+            $acompte->value=0;
+            $r.=_(" Montant à déduire");
+            $r.=$acompte->input();
+        }
+        
         $r.='<ol>';
         $r.='<li ><input type="radio" name="e_mp" value="0" 
checked>'._('Paiement encodé plus tard');
         if ( empty($array ) == false )



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]