Ajout listing assujetti tva (experimental)
ajout parametre de la companie improve apparence de certaines table
This commit is contained in:
parent
6c0b5a8f25
commit
bade1f18bd
11 changed files with 641 additions and 29 deletions
|
|
@ -251,8 +251,7 @@ if ($account == 0 ) {
|
|||
ExecuteScript($cn,'sql/mod1/schema.sql');
|
||||
ExecuteScript($cn,'sql/mod1/data.sql');
|
||||
|
||||
// $r=system("$psql -U phpcompta mod1 -f sql/mod1/schema.sql",$r);
|
||||
// $r=system("$psql -U phpcompta mod1 -f sql/mod1/data.sql",$r);
|
||||
|
||||
ob_end_clean();
|
||||
|
||||
}
|
||||
|
|
@ -290,7 +289,14 @@ for ($e=0;$e < $MaxDossier;$e++) {
|
|||
$sql=sprintf ("create sequence s_jrn_%d",$row['jrn_def_id']);
|
||||
ExecSql($db,$sql);
|
||||
}
|
||||
} // version == 4
|
||||
} // version == 4
|
||||
//--
|
||||
// update to the version 5
|
||||
//--
|
||||
if ( GetVersion($db) == 5 ) {
|
||||
ExecuteScript($db,'sql/patch/upgrade5.sql');
|
||||
} // version == 5
|
||||
|
||||
}
|
||||
|
||||
$Resdossier=ExecSql($cn,"select mod_id, mod_name from modeledef");
|
||||
|
|
@ -312,6 +318,10 @@ for ($e=0;$e < $MaxDossier;$e++) {
|
|||
ExecSql($db,$sql);
|
||||
}
|
||||
} // version == 4
|
||||
if ( GetVersion($db) == 5 ) {
|
||||
ExecuteScript($db,'sql/patch/upgrade5.sql');
|
||||
} // version == 5
|
||||
|
||||
}
|
||||
$cn=DbConnect();
|
||||
if ( GetVersion($cn) <= 4 ) {
|
||||
|
|
|
|||
96
html/admin/sql/patch/upgrade5.sql
Normal file
96
html/admin/sql/patch/upgrade5.sql
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
-- create vw_client view
|
||||
create view vw_client as
|
||||
select a.f_id,
|
||||
a.av_text as name,
|
||||
b.av_text as tva_num,c.av_text as poste_comptable,
|
||||
d.av_text as rue,
|
||||
e.av_text as code_postal,
|
||||
f.av_text as pays,
|
||||
g.av_text as telephone,
|
||||
h.av_text as email
|
||||
from (
|
||||
select * from fiche join fiche_def using (fd_id)
|
||||
join fiche_def_ref using (frd_id)
|
||||
join jnt_fic_att_value using (f_id) join attr_value using (jft_id) where ad_id=1 ) a
|
||||
left join (
|
||||
select * from fiche join fiche_def using (fd_id)
|
||||
join fiche_def_ref using (frd_id)
|
||||
join jnt_fic_att_value using (f_id) join attr_value using (jft_id) where ad_id=13 ) b using (f_id)
|
||||
left join (
|
||||
select * from fiche join fiche_def using (fd_id)
|
||||
join fiche_def_ref using (frd_id)
|
||||
join jnt_fic_att_value using (f_id)
|
||||
join attr_value using (jft_id)
|
||||
where ad_id=5 ) c using (f_id)
|
||||
left join (
|
||||
select * from fiche join fiche_def using (fd_id)
|
||||
join fiche_def_ref using (frd_id)
|
||||
join jnt_fic_att_value using (f_id)
|
||||
join attr_value using (jft_id)
|
||||
where ad_id=14 ) d using (f_id)
|
||||
left join (
|
||||
select * from fiche join fiche_def using (fd_id)
|
||||
join fiche_def_ref using (frd_id)
|
||||
join jnt_fic_att_value using (f_id)
|
||||
join attr_value using (jft_id)
|
||||
where ad_id=15 ) e using (f_id)
|
||||
left join (
|
||||
select * from fiche join fiche_def using (fd_id)
|
||||
join fiche_def_ref using (frd_id)
|
||||
join jnt_fic_att_value using (f_id)
|
||||
join attr_value using (jft_id)
|
||||
where ad_id=16 ) f using (f_id)
|
||||
left join (
|
||||
select * from fiche join fiche_def using (fd_id)
|
||||
join fiche_def_ref using (frd_id)
|
||||
join jnt_fic_att_value using (f_id)
|
||||
join attr_value using (jft_id)
|
||||
where ad_id=17 ) g using (f_id)
|
||||
left join (
|
||||
select * from fiche join fiche_def using (fd_id)
|
||||
join fiche_def_ref using (frd_id)
|
||||
join jnt_fic_att_value using (f_id)
|
||||
join attr_value using (jft_id)
|
||||
where ad_id=18 ) h using (f_id)
|
||||
where a.frd_id=9;
|
||||
|
||||
-- all the min attribut for card reference
|
||||
|
||||
create view vw_fiche_min
|
||||
as select frd_id, ad_id, ad_text, frd_text, frd_class_base
|
||||
from
|
||||
attr_min join attr_Def using (ad_id)
|
||||
join fiche_Def_ref using (frd_id);
|
||||
-- definition for card
|
||||
create view vw_fiche_Def as
|
||||
SELECT fd_id,
|
||||
ad_id,
|
||||
ad_text,
|
||||
fd_class_base,
|
||||
fd_label,
|
||||
fd_create_account,
|
||||
frd_id
|
||||
FROM jnt_fic_attr
|
||||
JOIN attr_def USING (ad_id)
|
||||
JOIN fiche_def USING (fd_id);
|
||||
|
||||
-- comments
|
||||
comment on view vw_fiche_min is 'minimum attribut for reference card';
|
||||
comment on view vw_fiche_def is 'all the attributs for card family';
|
||||
comment on view vw_client is 'minimum attribut for the customer (frd_id=9)';
|
||||
|
||||
-- new table : parameter
|
||||
create table parameter (
|
||||
pr_id text primary key,
|
||||
pr_value text
|
||||
);
|
||||
|
||||
insert into parameter (pr_id) values ('MY_NAME');
|
||||
insert into parameter (pr_id) values ('MY_CP');
|
||||
insert into parameter (pr_id) values ('MY_COMMUNE');
|
||||
insert into parameter (pr_id) values ('MY_TVA');
|
||||
insert into parameter (pr_id) values ('MY_STREET');
|
||||
insert into parameter (pr_id) values ('MY_NUMMER');
|
||||
|
||||
|
||||
update version set val=6;
|
||||
|
|
@ -33,7 +33,6 @@ $User=new cl_user($rep);
|
|||
$User->Check();
|
||||
|
||||
include("preference.php");
|
||||
// include_once ("top_menu_compta.php");
|
||||
include_once("user_menu.php");
|
||||
|
||||
ShowMenuCompta($_SESSION['g_dossier']);
|
||||
|
|
@ -64,7 +63,9 @@ if ( isset ($_POST['action']) ) {
|
|||
$action=$_POST['action'];
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Currency
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
if ( $p_action == "change" ) {
|
||||
$p_mid=$_GET['p_mid'];
|
||||
$p_rate=$_GET['p_rate'];
|
||||
|
|
@ -77,6 +78,36 @@ if ( $p_action == "change" ) {
|
|||
echo '<TD> <INPUT TYPE="SUBMIT" NAME="action" Value="Change"</TD>';
|
||||
echo '</FORM></TR>';
|
||||
}
|
||||
if ( $action == "Change") {
|
||||
$p_devise=$_POST['p_devise'];
|
||||
$p_id=$_POST['p_id'];
|
||||
$p_rate=$_POST['p_rate'];
|
||||
$Res=ExecSql($cn,"update parm_money set pm_code='$p_devise',pm_rate=$p_rate where pm_id=$p_id");
|
||||
ShowDevise($cn);
|
||||
|
||||
}
|
||||
if ( $action == "Ajout") {
|
||||
$p_devise=$_POST['p_devise'];
|
||||
$p_rate=$_POST['p_rate'];
|
||||
$Res=ExecSql($cn,"insert into parm_money ( pm_code,pm_rate) values ('$p_devise',$p_rate) ");
|
||||
ShowDevise($cn);
|
||||
|
||||
}
|
||||
|
||||
if ( $p_action == "delete") {
|
||||
$p_id=$_GET['p_mid'];
|
||||
$Res=ExecSql($cn,"delete from parm_money where pm_id=$p_id");
|
||||
ShowDevise($cn);
|
||||
}
|
||||
|
||||
|
||||
if ( $p_action=="devise") {
|
||||
ShowDevise($cn);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Periode
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
if ( $p_action=="change_per") {
|
||||
foreach($HTTP_GET_VARS as $key=>$element)
|
||||
${"$key"}=$element;
|
||||
|
|
@ -136,27 +167,6 @@ if ( isset ($_POST["add_per"] )) {
|
|||
}
|
||||
|
||||
echo_debug(__FILE__,__LINE__,"Action $action");
|
||||
if ( $action == "Change") {
|
||||
$p_devise=$_POST['p_devise'];
|
||||
$p_id=$_POST['p_id'];
|
||||
$p_rate=$_POST['p_rate'];
|
||||
$Res=ExecSql($cn,"update parm_money set pm_code='$p_devise',pm_rate=$p_rate where pm_id=$p_id");
|
||||
ShowDevise($cn);
|
||||
|
||||
}
|
||||
if ( $action == "Ajout") {
|
||||
$p_devise=$_POST['p_devise'];
|
||||
$p_rate=$_POST['p_rate'];
|
||||
$Res=ExecSql($cn,"insert into parm_money ( pm_code,pm_rate) values ('$p_devise',$p_rate) ");
|
||||
ShowDevise($cn);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( $p_action=="devise") {
|
||||
ShowDevise($cn);
|
||||
}
|
||||
if ( $p_action=="closed") {
|
||||
$p_per=$_GET['p_per'];
|
||||
$Res=ExecSql($cn,"update parm_periode set p_closed=true where p_id=$p_per");
|
||||
|
|
@ -178,7 +188,41 @@ if ( $p_action== "delete_per" ) {
|
|||
if ( $p_action == "periode" ) {
|
||||
ShowPeriode($cn);
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Coord societe
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
if ( $p_action=='company') {
|
||||
require_once("class_own.php");
|
||||
require_once("class_widget.php");
|
||||
if ( isset ($_POST['record_company'] )) {
|
||||
$m=new Own($cn);
|
||||
extract($_POST);
|
||||
$m->MY_NAME=$p_name;
|
||||
$m->MY_TVA=$p_tva;
|
||||
$m->MY_STREET=$p_street;
|
||||
$m->MY_NUMBER=$p_no;
|
||||
$m->MY_CP=$p_cp;
|
||||
$m->MY_COMMUNE=$p_Commune;
|
||||
$m->Save();
|
||||
}
|
||||
|
||||
$my=new Own($cn);
|
||||
$all=new widget("text");
|
||||
$all->table=1;
|
||||
echo '<form method="post" action="?p_action=company">';
|
||||
echo "<table class=\"result\">";
|
||||
echo "<tr>".$all->IOValue("p_name",$my->MY_NAME,"Nom société")."</tr>";
|
||||
|
||||
echo "<tr>".$all->IOValue("p_tva",$my->MY_TVA,"Numéro de Tva")."</tr>";
|
||||
echo "<tr>".$all->IOValue("p_street",$my->MY_STREET,"Rue ")."</tr>";
|
||||
echo "<tr>".$all->IOValue("p_no",$my->MY_NUMBER,"Numéro")."</tr>";
|
||||
echo "<tr>".$all->IOValue("p_cp",$my->MY_CP,"Code Postal")."</tr>";
|
||||
echo "<tr>".$all->IOValue("p_Commune",$my->MY_COMMUNE,"Commune")."</tr>";
|
||||
echo "</table>";
|
||||
$submit=new widget("submit");
|
||||
echo $submit->Submit("record_company","Enregistre");
|
||||
echo "</form>";
|
||||
}
|
||||
|
||||
|
||||
echo "</DIV>";
|
||||
|
|
|
|||
58
html/listing_client.php
Normal file
58
html/listing_client.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?
|
||||
/*
|
||||
* This file is part of PhpCompta.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/* $Revision$ */
|
||||
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
|
||||
require_once("ac_common.php");
|
||||
require_once("postgres.php");
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Check User
|
||||
include ('class_user.php');
|
||||
/* Admin. Dossier */
|
||||
$cn=DbConnect($_SESSION['g_dossier']);
|
||||
|
||||
$User=new cl_user($cn);
|
||||
$User->Check();
|
||||
|
||||
// TODO a specific level of security for the "bilan" ???
|
||||
// Change must be done here
|
||||
if ( $User->admin == 0 ) {
|
||||
if (CheckAction($_SESSION['g_dossier'],$_SESSION['g_user'],IMP) == 0 ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
}
|
||||
}
|
||||
|
||||
header('Content-type: application/bin');
|
||||
header('Content-Disposition: attachment;filename="declaration.bin"',FALSE);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Submit for a magnetic declaration
|
||||
// Belgium only
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
if ( isset($_POST['bt_disk'])) {
|
||||
require_once("class_customer.php");
|
||||
$customer=new Customer($cn);
|
||||
$a_Res=$customer->VatListing($_POST['year']);
|
||||
|
||||
require_once("decla.BE.inc.php");
|
||||
$a=MakeListingVat($cn,$a_Res,$_POST['year']);
|
||||
echo "$a";
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
|
@ -47,7 +47,8 @@ $p_array=array(array ("user_impress.php?type=jrn","Journaux"),
|
|||
array("user_impress.php?type=fiche","Fiche"),
|
||||
array("user_impress.php?type=rapport","Rapport"),
|
||||
array('user_impress.php?type=bal','Balance des comptes'),
|
||||
array("user_impress.php?type=bilan","Bilan")
|
||||
array("user_impress.php?type=bilan","Bilan"),
|
||||
array("user_impress.php?type=list_client","Liste Clients Assujettis")
|
||||
);
|
||||
$default=( isset ($_GET['type']))?"user_impress.php?type=".$_GET['type']:"";
|
||||
$result=ShowItem($p_array,'H',"cell","mtitle",$default);
|
||||
|
|
@ -87,6 +88,9 @@ $default=( isset ($_GET['type']))?$_GET['type']:"";
|
|||
case "fiche":
|
||||
include ("impress_fiche.php");
|
||||
break;
|
||||
case "list_client":
|
||||
include ("impress_listing_client.php");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
160
include/class_customer.php
Normal file
160
include/class_customer.php
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
<?
|
||||
/*
|
||||
* This file is part of PhpCompta.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/* $Revision$ */
|
||||
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
|
||||
require_once("constant.php");
|
||||
require_once("postgres.php");
|
||||
// Use the view vw_customer
|
||||
//
|
||||
class Customer {
|
||||
var $id; // f_id
|
||||
var $poste; // poste comptable
|
||||
var $db; // base de donnée
|
||||
var $name;
|
||||
var $street;
|
||||
var $country;
|
||||
var $cp;
|
||||
var $vat_number;
|
||||
// Constructor
|
||||
// only a db connection is needed
|
||||
function Customer($p_cn) {
|
||||
$this->db=$p_cn;
|
||||
}
|
||||
// Get all info contains in the view
|
||||
// thanks to the poste elt
|
||||
function GetFromPoste($p_poste=0) {
|
||||
$this->poste=($p_poste==0)?$this->poste:$p_poste;
|
||||
$sql="select * from vw_client where poste_comptable=".$this->poste;
|
||||
$Res=ExecSql($this->db,$sql);
|
||||
if ( pg_NumRows($Res) == 0) return null;
|
||||
// There is only _one_ row by customer
|
||||
$row=pg_fetch_array($Res,0);
|
||||
$this->name=$row['name'];
|
||||
$this->id=$row['f_id'];
|
||||
$this->street=$row['rue'];
|
||||
$this->cp=$row['code_postal'];
|
||||
$this->country=$row['pays'];
|
||||
$this->vat_number=$row['tva_num'];
|
||||
|
||||
}
|
||||
/* function ListingVat
|
||||
**************************************************
|
||||
* Purpose : Get all the info for making a vat listing
|
||||
* for the vat administration
|
||||
*
|
||||
* parm :
|
||||
* - periode
|
||||
*
|
||||
* return:
|
||||
*
|
||||
* - array
|
||||
*/
|
||||
function VatListing($p_year) {
|
||||
$cond_sql=" and A.j_tech_per = B.j_tech_per
|
||||
and A.j_tech_per= any (select p_id
|
||||
from parm_periode
|
||||
where
|
||||
p_exercice='$p_year')";
|
||||
|
||||
// BASE ACCOUNT
|
||||
// for belgium
|
||||
// TODO : those values should be in a table because
|
||||
// they are _national_ parameters
|
||||
//-----
|
||||
$SOLD="70";
|
||||
$CUSTOMER="400";
|
||||
$TVA="451";
|
||||
// Get all the sell operation
|
||||
//----
|
||||
$sql="select j_grpt
|
||||
from
|
||||
jrnx as A
|
||||
join jrnx as B using (j_grpt)
|
||||
where
|
||||
A.j_poste like '".$CUSTOMER."%' and
|
||||
B.j_poste like '".$SOLD."%'
|
||||
$cond_sql
|
||||
";
|
||||
|
||||
$Res=ExecSql($this->db,$sql);
|
||||
// Foreach operation
|
||||
// where 7% or tva account are involved
|
||||
// and store the result in an array (a_Res)
|
||||
//---
|
||||
$a_Res=array();
|
||||
for ($i=0; $i < pg_NumRows($Res);$i++) {
|
||||
// Get each row
|
||||
//---
|
||||
$row1=pg_fetch_array($Res,$i);
|
||||
|
||||
// select the customer
|
||||
//----
|
||||
$Res2=ExecSql($this->db,"select j_poste,j_montant,j_debit from jrnx where j_grpt=".$row1['j_grpt']);
|
||||
$a_row=array();
|
||||
// Store the result in the array
|
||||
//---
|
||||
for ($e=0;$e < pg_NumRows($Res2);$e++) {
|
||||
$a_row[]=pg_fetch_array($Res2,$e);
|
||||
}
|
||||
|
||||
// Seek the customer
|
||||
//---
|
||||
foreach ($a_row as $e) {
|
||||
if ( substr($e['j_poste'],0, strlen($CUSTOMER))==$CUSTOMER) {
|
||||
$customer=$e['j_poste'];
|
||||
// Retrieve name and vat number
|
||||
$this->GetFromPoste($customer);
|
||||
$a_Res[$customer]['name']=$this->name;
|
||||
$a_Res[$customer]['vat_number']=$this->vat_number;
|
||||
break;
|
||||
|
||||
}
|
||||
}// foreach $a
|
||||
// Store the amount in the array
|
||||
//---
|
||||
foreach ($a_row as $e) {
|
||||
$amount=0;
|
||||
$tva=0;
|
||||
if ( substr($e['j_poste'],0, strlen($SOLD))==$SOLD) {
|
||||
$amount=($e['j_debit']=='f')?$e['j_montant']:$e['j_montant']*-1;
|
||||
}
|
||||
if ( substr($e['j_poste'],0, strlen($TVA))==$TVA) {
|
||||
$tva=($e['j_debit']=='f')?$e['j_montant']:$e['j_montant']*-1;
|
||||
}
|
||||
// store sold
|
||||
//---
|
||||
$a_Res[$customer]['amount']=(isset($a_Res[$customer]['amount']))?$a_Res[$customer]['amount']:0;
|
||||
$a_Res[$customer]['amount']+=$amount;
|
||||
|
||||
// store vat
|
||||
//---
|
||||
$a_Res[$customer]['tva']=(isset($a_Res[$customer]['tva']))?$a_Res[$customer]['tva']:0;
|
||||
$a_Res[$customer]['tva']+=$tva;
|
||||
|
||||
// store customef info
|
||||
//---
|
||||
$a_Res[$customer]['customer']=$customer;
|
||||
}// foreach $a
|
||||
|
||||
}
|
||||
return $a_Res;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
73
include/class_own.php
Normal file
73
include/class_own.php
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<?
|
||||
/*
|
||||
* This file is part of PhpCompta.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/* $Revision$ */
|
||||
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
|
||||
class Own {
|
||||
var $db;
|
||||
// constructor
|
||||
function Own($p_cn) {
|
||||
$this->db=$p_cn;
|
||||
$Res=ExecSql($p_cn,"select * from parameter where pr_id like 'MY_%'");
|
||||
for ($i = 0;$i < pg_NumRows($Res);$i++) {
|
||||
$row=pg_fetch_array($Res,$i);
|
||||
$key=$row['pr_id'];
|
||||
$elt=$row['pr_value'];
|
||||
// store value here
|
||||
$this->{"$key"}=$elt;
|
||||
}
|
||||
|
||||
}
|
||||
/* function UpdateRow
|
||||
**************************************************
|
||||
* Purpose : Update a row
|
||||
*
|
||||
* parm :
|
||||
* - give the attribut name
|
||||
* gen :
|
||||
* - none
|
||||
* return:
|
||||
* -none
|
||||
*/
|
||||
function UpdateRow($p_attr) {
|
||||
$value=FormatString($this->{"$p_attr"});
|
||||
$Res=ExecSql($this->db,"update parameter set pr_value='$value' where pr_id='$p_attr'");
|
||||
}
|
||||
|
||||
/* function Save
|
||||
**************************************************
|
||||
* Purpose : save data
|
||||
*
|
||||
* parm :
|
||||
* - none
|
||||
* gen :
|
||||
* - none
|
||||
* return:
|
||||
* - nothing
|
||||
*/
|
||||
function Save() {
|
||||
$this->UpdateRow('MY_NAME');
|
||||
$this->UpdateRow('MY_TVA');
|
||||
$this->UpdateRow('MY_STREET');
|
||||
$this->UpdateRow('MY_NUMBER');
|
||||
$this->UpdateRow('MY_CP');
|
||||
$this->UpdateRow('MY_COMMUNE');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
83
include/decla.BE.inc.php
Normal file
83
include/decla.BE.inc.php
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
<?
|
||||
/*
|
||||
* This file is part of PhpCompta.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/* $Revision$ */
|
||||
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
|
||||
/* function MakeListingVat
|
||||
**************************************************
|
||||
* Purpose : Créer le fichier à déposer pour la TVA
|
||||
* voir le fichier BE_fr_list_client_nonpapier.pdf
|
||||
*
|
||||
* parm :
|
||||
* -array
|
||||
* gen :
|
||||
* -none
|
||||
* return:
|
||||
* - none
|
||||
*/
|
||||
function MakeListingVat($p_cn,$p_array,$p_year) {
|
||||
// declarant
|
||||
//--
|
||||
require_once("class_own.php");
|
||||
// load the data
|
||||
$my=new Own($p_cn);
|
||||
//Make the first record
|
||||
$a="000000";
|
||||
$a.=sprintf("% 32s",$my->MY_NAME);
|
||||
$b=$my->MY_STREET.",".$my->MY_NUMBER;
|
||||
$a.=sprintf("% 24s",$b);
|
||||
$b=$my->MY_CP." ".$my->MY_COMMUNE;
|
||||
$a.=sprintf("% 27s",$b);
|
||||
$a.="BE";
|
||||
$a.=sprintf("%9s",$my->MY_TVA);
|
||||
// special zone
|
||||
$a.=sprintf("% 20s",' ');
|
||||
//
|
||||
$a.="E";
|
||||
$a.=$p_year;
|
||||
$a.="\n";
|
||||
// customer record
|
||||
$rec_id=0;
|
||||
$tot_amount=0;
|
||||
$tot_tva=0;
|
||||
foreach ($p_array as $client) {
|
||||
if ( strlen(trim($client['tva'])) != 0 ) {
|
||||
$rec_id++;
|
||||
$a.=sprintf("%06d",$rec_id);
|
||||
$a.=sprintf("% 32s",$client['name']);
|
||||
$a.=str_repeat(" ",51);
|
||||
$a.=sprintf("BE%s",$client['vat_number']);
|
||||
$a.=sprintf("%010d",$client['amount']*100);
|
||||
$a.=sprintf("%010d",$client['tva']*100);
|
||||
$a.=str_repeat(" ",10);
|
||||
$a.="\n";
|
||||
$tot_amount=+$client['amount']*100;
|
||||
$tot_tva+=$client['tva']*100;
|
||||
}
|
||||
}
|
||||
//Last Record
|
||||
$a.="999999";
|
||||
$a.=sprintf("%016d",$tot_amount);
|
||||
$a.=sprintf("%016d",$tot_tva);
|
||||
$a.=str_repeat(" ",51);
|
||||
$a.="BE";
|
||||
$a.=$my->MY_TVA;
|
||||
$a.=str_repeat(" ",28);
|
||||
$a.="\n";
|
||||
return $a;
|
||||
}
|
||||
83
include/impress_listing_client.php
Normal file
83
include/impress_listing_client.php
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
<?
|
||||
/*
|
||||
* This file is part of PhpCompta.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/* $Revision$ */
|
||||
include_once("class_widget.php");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Show the jrn and date
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
include_once('form_input.php');
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Submit Html
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
if ( isset($_POST['bt_html'] )) {
|
||||
require_once("class_customer.php");
|
||||
$customer=new Customer($cn);
|
||||
$a_Res=$customer->VatListing($_POST['year']);
|
||||
|
||||
echo "
|
||||
<div class=\"redcontent\"
|
||||
<form method=\"post\" action=\"listing_client.php\">
|
||||
<input type=\"submit\" name=\"bt_disk\" value=\"expérimental !! déclaration magnétique\" disable>
|
||||
<input type=\"hidden\" name=\"year\" value=\"".$_POST['year']."\">
|
||||
</form>
|
||||
<Table class=\"result\">
|
||||
<tr>
|
||||
<th> Nom </th>
|
||||
<th> Numéro TVA </th>
|
||||
<th> Montant HTVA </th>
|
||||
<th> Montant TVA </th>
|
||||
</tr>
|
||||
";
|
||||
foreach ($a_Res as $key=>$elt) {
|
||||
echo "<tr>".
|
||||
"<td>".$elt['name']."</td>".
|
||||
"<td>".$elt['vat_number']."</td>".
|
||||
"<td align=\"right\">".sprintf("% 8.2f",$elt['amount'])."</td>".
|
||||
"<td align=\"right\">".sprintf("% 8.2f",$elt['tva'])."</td>".
|
||||
"</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
return;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Form
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
$w=new widget("select");
|
||||
$w->table=1;
|
||||
|
||||
echo '<div class="redcontent">';
|
||||
echo '<FORM ACTION="user_impress.php?type=list_client" METHOD="POST">';
|
||||
echo '<TABLE>';
|
||||
|
||||
print '<TR>';
|
||||
$year=make_array($cn,"select distinct p_exercice,p_exercice from parm_periode");
|
||||
$w->label="Année concernée";
|
||||
print $w->IOValue('year',$year);
|
||||
print "</TR>";
|
||||
echo '</TABLE>';
|
||||
print $w->Submit('bt_html','Impression');
|
||||
|
||||
echo '</FORM>';
|
||||
|
||||
echo '</div>';
|
||||
|
||||
?>
|
||||
|
|
@ -37,7 +37,7 @@ include("class_poste.php");
|
|||
$hid=new widget("hidden");
|
||||
echo '<div class="u_redcontent">';
|
||||
echo '<h2 class="info">'.$Poste->id." ".$Poste->name.'</h2>';
|
||||
echo "<table>";
|
||||
echo "<table >";
|
||||
echo '<TR>';
|
||||
echo '<TD><form method="GET" ACTION="user_impress.php">'.
|
||||
$submit->Submit('bt_other',"Autre poste").
|
||||
|
|
@ -66,7 +66,7 @@ include("class_poste.php");
|
|||
if ( count($Poste->row ) == 0 )
|
||||
exit;
|
||||
|
||||
echo "<TABLE width=\"100%\">";
|
||||
echo "<TABLE class=\"result\" width=\"100%\">";
|
||||
echo "<TR>".
|
||||
"<TH> Code interne </TH>".
|
||||
"<TH> Date</TH>".
|
||||
|
|
|
|||
|
|
@ -593,6 +593,7 @@ function ShowMenuParam()
|
|||
{
|
||||
$sub_menu=ShowItem(array(
|
||||
//('rapprt.php','Rapprochement'),
|
||||
array('dossier_prefs.php?p_action=company','Paramètres sociétés'),
|
||||
array('dossier_prefs.php?p_action=devise','Devises'),
|
||||
array('dossier_prefs.php?p_action=periode','Période'),
|
||||
array('user_sec.php','Sécurité')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue