[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r4407 - in phpcompta/trunk: include sql
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r4407 - in phpcompta/trunk: include sql |
Date: |
Sat, 19 Nov 2011 00:35:38 +0100 (CET) |
Author: danydb
Date: 2011-11-19 00:35:36 +0100 (Sat, 19 Nov 2011)
New Revision: 4407
Modified:
phpcompta/trunk/include/class_acc_ledger_sold.php
phpcompta/trunk/include/class_acc_tva.php
phpcompta/trunk/include/tva.inc.php
phpcompta/trunk/sql/tva.sql
Log:
#392 TVA cocontractant : fix vente
Modified: phpcompta/trunk/include/class_acc_ledger_sold.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger_sold.php 2011-11-18 14:55:13 UTC
(rev 4406)
+++ phpcompta/trunk/include/class_acc_ledger_sold.php 2011-11-18 23:35:36 UTC
(rev 4407)
@@ -288,7 +288,7 @@
$fiche=new Fiche($this->db);
$fiche->get_by_qcode(${"e_march".$i});
$amount=bcmul(${'e_march'.$i.'_price'},${'e_quant'.$i});
- $tot_amount+=$amount;
+ $tot_amount=bcadd($tot_amount,$amount);
$acc_operation=new Acc_Operation($this->db);
$acc_operation->date=$e_date;
$sposte=$fiche->strAttribut(ATTR_DEF_ACCOUNT);
@@ -321,6 +321,8 @@
$oTva=new Acc_Tva($this->db);
$idx_tva=${'e_march'.$i.'_tva_id'};
$tva_item=${'e_march'.$i.'_tva_amount'};
+ $oTva->set_parameter("id",$idx_tva);
+ $oTva->load();
/* if empty then we need to compute it */
if (trim($tva_item)=='')
{
@@ -333,6 +335,7 @@
$tva[$idx_tva]+=$tva_item;
else
$tva[$idx_tva]=$tva_item;
+ var_dump($oTva->get_parameter("both_side"));
if ($oTva->get_parameter("both_side")==0)
$tot_tva=round(bcadd($tva_item,$tot_tva),2);
}
@@ -433,6 +436,7 @@
// if TVA is on both side, we deduce it immediately
if ( $oTva->get_parameter("both_side")==1)
{
+ echo "remove_tva";
$poste_vat=$oTva->get_side('d');
$cust_amount=bcadd($tot_amount,$tot_tva);
$acc_operation=new Acc_Operation($this->db);
@@ -443,6 +447,8 @@
$acc_operation->jrn=$p_jrn;
$acc_operation->type='d';
$acc_operation->periode=$tperiode;
+ $acc_operation->insert_jrnx();
+ $tot_debit=bcadd($tot_debit,$value);
}
Modified: phpcompta/trunk/include/class_acc_tva.php
===================================================================
--- phpcompta/trunk/include/class_acc_tva.php 2011-11-18 14:55:13 UTC (rev
4406)
+++ phpcompta/trunk/include/class_acc_tva.php 2011-11-18 23:35:36 UTC (rev
4407)
@@ -132,7 +132,7 @@
*/
public function load()
{
- $sql="select tva_label,tva_rate, tva_comment,tva_poste,tva_both_side
from tva_rate where tva_id=$1";
+ $sql="select tva_id,tva_label,tva_rate,
tva_comment,tva_poste,tva_both_side from tva_rate where tva_id=$1";
$res=$this->cn->exec_sql(
$sql,
array($this->tva_id)
Modified: phpcompta/trunk/include/tva.inc.php
===================================================================
--- phpcompta/trunk/include/tva.inc.php 2011-11-18 14:55:13 UTC (rev 4406)
+++ phpcompta/trunk/include/tva.inc.php 2011-11-18 23:35:36 UTC (rev 4407)
@@ -35,7 +35,7 @@
echo '<p class="notice">Vous ne pouvez pas effacer tous taux' .
' Si votre société n\'utilise pas la TVA, changer dans le
menu société</p>';
}
-$both=(isset($_REQUEST['both']))?1:0;
+$both_side=(isset($_REQUEST['both']))?1:0;
//-----------------------------------------------------
// Record Change
if (isset($_POST['confirm_mod'])
@@ -50,7 +50,7 @@
{
$err = 2;
}
-
+ var_dump($_POST);
if ($err == 0)
{
if (isset($_POST['confirm_add']))
@@ -62,14 +62,14 @@
$tva_rate,
$tva_comment,
$tva_poste,
- $both)
+ $both_side)
);
$err = Database::fetch_result($res);
}
if (isset($_POST['confirm_mod']))
{
$Res = $cn->exec_sql(
- "select tva_modify($1,$2,$3,$4,$5,$6)", array($tva_id,
$tva_label, $tva_rate, $tva_comment, $tva_poste,$both)
+ "select tva_modify($1,$2,$3,$4,$5,$6)", array($tva_id,
$tva_label, $tva_rate, $tva_comment, $tva_poste,$both_side)
);
$err = Database::fetch_result($Res);
}
Modified: phpcompta/trunk/sql/tva.sql
===================================================================
--- phpcompta/trunk/sql/tva.sql 2011-11-18 14:55:13 UTC (rev 4406)
+++ phpcompta/trunk/sql/tva.sql 2011-11-18 23:35:36 UTC (rev 4407)
@@ -9,7 +9,6 @@
CREATE OR REPLACE FUNCTION comptaproc.tva_modify(integer, text, numeric, text,
text,integer)
RETURNS integer
- LANGUAGE plpgsql
AS $function$
declare
p_tva_id alias for $1;
@@ -41,6 +40,7 @@
return 0;
end;
$function$
+ LANGUAGE plpgsql;
----------------------------------------------------------------------
-- TVA INSERT
@@ -50,7 +50,6 @@
CREATE OR REPLACE FUNCTION comptaproc.tva_insert(text, numeric, text,
text,integer)
RETURNS integer
- LANGUAGE plpgsql
AS $function$
declare
l_tva_id integer;
@@ -83,3 +82,4 @@
return 0;
end;
$function$
+ LANGUAGE plpgsql;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpcompta-dev] r4407 - in phpcompta/trunk: include sql,
phpcompta-dev <=