Merged revisions 4810,4813-4821 via svnmerge from

svn+ssh://ns352270.ovh.net/svn/phpcompta/tags/rel601

........
  r4810 | danydb | 2012-04-24 20:55:23 +0200 (Tue, 24 Apr 2012) | 3 lines
  
  Removed merge tracking for "svnmerge" for 
  svn+ssh://danydb@ns352270.ovh.net/svn/phpcompta/tags/rel600
........
  r4813 | danydb | 2012-04-24 20:58:20 +0200 (Tue, 24 Apr 2012) | 1 line
  
  change SQL
........
  r4814 | danydb | 2012-04-24 21:33:02 +0200 (Tue, 24 Apr 2012) | 2 lines
  
  Fix bug predefined operation for misc ledger
........
  r4815 | danydb | 2012-04-24 21:33:27 +0200 (Tue, 24 Apr 2012) | 3 lines
  
  Fix bug predefined operation for misc ledger
  Fix bug for check_balance (null value)
........
  r4816 | danydb | 2012-04-24 21:51:04 +0200 (Tue, 24 Apr 2012) | 1 line
  
  fix bug : rounded value
........
  r4817 | danydb | 2012-05-01 16:49:39 +0200 (Tue, 01 May 2012) | 2 lines
  
  #569 réécriture des menus fournisseur, client et adm
........
  r4818 | danydb | 2012-05-01 16:51:35 +0200 (Tue, 01 May 2012) | 2 lines
  
  #568: Impossible d'ajouter une fiche BANQUE dans ADM
........
  r4819 | danydb | 2012-05-01 16:53:12 +0200 (Tue, 01 May 2012) | 2 lines
  
  #570: Ajout d'un menu contact
........
  r4820 | danydb | 2012-05-01 16:53:46 +0200 (Tue, 01 May 2012) | 1 line
  
  cosmetic  : message d'erreur quand on veut ajouter une fiche dans catégorie non existante
........
  r4821 | danydb | 2012-05-01 18:38:34 +0200 (Tue, 01 May 2012) | 1 line
  
  code : dead code
........
This commit is contained in:
Dany De Bontridder 2012-05-08 18:01:19 +00:00
parent 27a50547ad
commit 2e4dc23d33
28 changed files with 414 additions and 1168 deletions

View file

@ -252,7 +252,7 @@ case 'st':
{
$html.=_("Aucune catégorie de fiche ne correspondant à".
" votre demande");
$html.=$sql;
if ( DEBUG ) $html.=$sql;
}
else
{
@ -396,6 +396,9 @@ case 'ac':
$msg=_(' d\'administration');
$base='';
break;
case FICHE_TYPE_CONTACT:
$msg=(' de contacts');
$base='';
}
$html='';

View file

@ -58,7 +58,7 @@ if ( isset($_POST['delete_card'] ) )
$f_id=$_REQUEST['f_id'];
$fiche=new Customer($cn,$f_id);
$fiche=new Admin($cn,$f_id);
$fiche->remove();
$low_action="list";
@ -82,7 +82,7 @@ if ( $low_action == "list" )
echo HtmlInput::request_to_hidden(array('ac'));
$sel_card=new ISelect('cat');
$sel_card->value=$cn->make_array('select fd_id, fd_label from fiche_def '.
' where frd_id='.FICHE_TYPE_ADM_TAX.' or frd_id ='.FICHE_TYPE_FIN.
' where frd_id='.FICHE_TYPE_ADM_TAX.
' order by fd_label ',1);
$sel_card->selected=(isset($_GET['cat']))?$_GET['cat']:-1;
$sel_card->javascript=' onchange="submit(this);"';
@ -140,32 +140,11 @@ if ( $low_action == "list" )
if ( $low_action == 'detail')
{
/* Menu */
require_once('adm_card.inc.php');
require_once('category_card.inc.php');
exit();
}
if ( $low_action=="insert" )
{
/* security : check if user can add card */
if ( $g_user->check_action(FICADD) == 0 )
{
alert('Vous ne pouvez pas ajouter de fiche');
return;
}
$customer=new Customer($cn);
$customer->Save($_REQUEST['fd_id']);
echo '<div class="content">';
echo "<table>";
echo $customer->Display(true);
echo "</table>";
$retour=new IAction();
$retour->label="Retour";
$retour->value="?p_action=adm&".dossier::get();
echo $retour->input();
echo '</div>';
}
html_page_stop();
?>

View file

@ -1,151 +0,0 @@
<?php
/*
* 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
/*!\file
* \brief this file will handle all the actions for a specific customer (
* contact,operation,invoice and financial)
* include from client.inc.php and concerned only the customer card and
* the customer category
*/
require_once('class_contact.php');
require_once('class_ipopup.php');
$str_dossier=Dossier::get();
/* $sub_action = sb = detail */
/* $cn database conx */
$return=new IAction();
$return->name='retour';
$return->label='Retour';
$return->value='?ac='.$_REQUEST['ac'].'&'.$str_dossier;
$root='?ac='.$_REQUEST['ac']."&sb=detail&f_id=".$_REQUEST["f_id"].'&'.$str_dossier;
$ss_action=( isset ($_REQUEST['sc'] ))? $_REQUEST['sc']: '';
switch ($ss_action)
{
case 'dc':
$def=1;
break;
case 'sv': /* all the actions (mail,meeting...) */
$def=2;
break;
case 'cn':
$def=3;
break;
case 'op':
$def=4;
break;
case 'bal':
$def=7;
break;
case 'let':
$def=6;
break;
default:
$def=1;
$ss_action='dc';
}
$f=new Fiche($cn,$_REQUEST['f_id']);
echo '<div class="content">';
echo ShowItem(array(
array($root."&sc=dc",_('Fiche'),_('Détail de la fiche'),1),
array($root.'&sc=sv',_('Suivi'),_('Suivi adm, devis, bon de commande, courrier'),2),
array($root.'&sc=cn',_('Contact'),_('Liste de contacts de cette administration'),3),
array($root.'&sc=op',_('Opérations'),_('Toutes les opérations'),4),
array($root.'&sc=bal',_('Balance'),_('Balance du fournisseur'),7),
array($root.'&sc=let',_('Lettrage'),_('Opérations & Lettrages'),6),
array('?ac='.$_REQUEST['ac']."&".dossier::get(),_('Retour liste'),_('Retour à la liste des administration'),5)
),
'H',"mtitle","mtitle",$def,' ');
echo '</div>';
echo '<div class="gest_name">';
echo '<h2 class="gest_name">'.$f->get_quick_code()." ".$f->strAttribut(ATTR_DEF_NAME).'</h2>';
echo '</div>';
echo '</div>';
//---------------------------------------------------------------------------
// Show Detail of a card and category
//---------------------------------------------------------------------------
if ( $ss_action == 'dc' )
{
require_once('detail_adm.inc.php');
}
//---------------------------------------------------------------------------
// Follow up : mail, bons de commande, livraison, rendez-vous...
//---------------------------------------------------------------------------
if ( $ss_action == 'sv' )
{
require_once('suivi_adm.inc.php');
}
/*----------------------------------------------------------------------
* Operation all the operation of this customer
*
* ----------------------------------------------------------------------*/
if ( $ss_action == 'op')
{
require_once('operation_adm.inc.php');
}
/*----------------------------------------------------------------------
* All the contact
*
*----------------------------------------------------------------------*/
if ( $ss_action == 'cn')
{
echo '<div class="content">';
echo dossier::hidden();
$f=new Fiche($cn,$_REQUEST['f_id']);
$contact=new Contact($cn);
$contact->company=$f->get_quick_code();
echo $contact->summary("");
$sql=' select fd_id from fiche_def where frd_id='.FICHE_TYPE_CONTACT;
$filter=$cn->make_list($sql);
if ( empty ($filter))
{
echo '<span class="notice">';
echo _("Vous devez aller dans fiche et créer une catégorie pour les contacts");
echo '</span>';
exit();
}
/* Add button */
$f_add_button=new IButton('add_card');
$f_add_button->label=_('Créer une nouvelle fiche');
$f_add_button->set_attribute('ipopup','ipopcard');
$f_add_button->set_attribute('filter',$filter);
$f_add_button->javascript=" select_card_type(this);";
echo $f_add_button->input();
echo '</div>';
}
/*-------------------------------------------------------------------------
* Balance of the card
*-------------------------------------------------------------------------*/
if ( $ss_action=='bal')
{
require_once('balance_card.inc.php');
}
/*----------------------------------------------------------------------------
* Lettering
*----------------------------------------------------------------------------*/
if ( $def==6 )
{
require_once('lettering.gestion.inc.php');
}

146
include/bank.inc.php Normal file
View file

@ -0,0 +1,146 @@
<?php
/*
* 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: 4701 $ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/*!\brief include from supplier.inc.php and concerned only the supplier card and
* the supplier category
*/
require_once("class_iselect.php");
require_once("class_ihidden.php");
require_once("class_bank.php");
require_once("class_ibutton.php");
require_once('class_iaction.php');
global $g_user;
$low_action=(isset($_REQUEST['sb']))?$_REQUEST['sb']:"list";
/*! \file
* \brief Called from the module "Gestion" to manage the supplier
*/
$href=basename($_SERVER['PHP_SELF']);
// by default open liste
if ( $low_action == "" )
$low_action="list";
//-----------------------------------------------------
// Remove a card
//-----------------------------------------------------
if ( isset($_POST['delete_card'] ) )
{
if ( $g_user->check_action(FICADD) == 0 )
{
alert('Vous ne pouvez pas enlever de fiche');
return;
}
$f_id=$_REQUEST['f_id'];
$fiche=new Bank($cn,$f_id);
$fiche->remove();
$low_action="list";
}
//-----------------------------------------------------
// list of supplier
//-----------------------------------------------------
if ( $low_action == "list" )
{
?>
<div class="content">
<div>
<form method="get" action="<?php echo $href; ?>">
<?php
echo dossier::hidden();
$a=(isset($_GET['query']))?$_GET['query']:"";
printf (_('Recherche').' <input class="input_text" type="text" name="query" value="%s">',
$a);
$sel_card=new ISelect('cat');
$sel_card->value=$cn->make_array('select fd_id, fd_label from fiche_def '.
' where frd_id='.FICHE_TYPE_FIN.
' order by fd_label ',1);
$sel_card->selected=(isset($_GET['cat']))?$_GET['cat']:-1;
$sel_card->javascript=' onchange="submit(this);"';
echo _('Catégorie :').$sel_card->input();
$nooperation=new ICheckBox('noop');
$nooperation->selected=(isset($_GET['noop']))?true:false;
echo _('Inclure les banques sans opération :').$nooperation->input();
?>
<input type="submit" class="button" name="submit_query" value="<?=_('recherche')?>">
<input type="hidden" name="ac" value="<?=$_REQUEST['ac']?>">
</form>
</div>
<?php
$supplier=new Bank($cn);
$search=(isset($_GET['query']))?$_GET['query']:"";
$sql="";
if ( isset($_GET['cat']))
{
if ( $_GET['cat'] != -1) $sql=sprintf(" and fd_id = %d",$_GET['cat']);
}
$noop=(isset($_GET['noop']))?false:true;
echo '<div class="content">';
echo $supplier->Summary($search,'supplier',$sql,$noop);
echo '<br>';
echo '<br>';
echo '<br>';
if ($g_user->check_action(FICADD)==1)
{
/* Add button */
$f_add_button=new IButton('add_card');
$f_add_button->label=_('Créer une nouvelle fiche');
$f_add_button->set_attribute('win_refresh','yes');
$f_add_button->set_attribute('type_cat',FICHE_TYPE_FIN);
$f_add_button->javascript=" select_card_type(this);";
echo $f_add_button->input();
$f_cat_button=new IButton('add_cat');
$f_cat_button->set_attribute('type_cat',FICHE_TYPE_FIN);
$f_cat_button->label=_('Ajout d\'une catégorie');
$f_cat_button->javascript='add_category(this)';
echo $f_cat_button->input();
}
echo '</div>';
echo '</div>';
}
/*----------------------------------------------------------------------
* Detail for a card, Suivi, Contact, Operation,... *
* cc stands for supplier card
*----------------------------------------------------------------------*/
if ( $low_action == 'detail')
{
/* Menu */
require_once('category_card.inc.php');
exit();
}
html_page_stop();
?>

View file

@ -16,7 +16,7 @@
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* $Revision$ */
/* $Revision: 4565 $ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
@ -31,10 +31,6 @@ require_once('class_contact.php');
$str_dossier=Dossier::get();
/* $sub_action = sb = detail */
/* $cn database conx */
$return=new IAction();
$return->name='retour';
$return->label='Retour';
$return->value='?ac='.$_REQUEST['ac'].'&'.$str_dossier;
$root='?ac='.$_REQUEST['ac']."&sb=detail&f_id=".$_REQUEST["f_id"].'&'.$str_dossier;
$ss_action=( isset ($_REQUEST['sc'] ))? $_REQUEST['sc']: '';
switch ($ss_action)
@ -70,8 +66,7 @@ echo ShowItem(array(
array($root.'&sc=cn',_('Contact'),_('Liste de contacts de ce fournisseur'),3),
array($root.'&sc=op',_('Opérations'),_('Toutes les opérations'),4),
array($root.'&sc=bal',_('Balance'),_('Balance du fournisseur'),7),
array($root.'&sc=let',_('Lettrage'),_('Opérations & Lettrages'),6),
array('?ac='.$_REQUEST['ac'].'&'.dossier::get(),_('Retour liste'),_('Retour à la liste des fournisseurs'),5)
array($root.'&sc=let',_('Lettrage'),_('Opérations & Lettrages'),6)
),
'H',"mtitle","mtitle",$def,' ');
echo '</div>';
@ -86,14 +81,14 @@ echo '</div>';
//---------------------------------------------------------------------------
if ( $ss_action == 'dc' )
{
require_once('detail_supplier.inc.php');
require_once('category_detail.inc.php');
}
//---------------------------------------------------------------------------
// Follow up : mail, bons de commande, livraison, rendez-vous...
//---------------------------------------------------------------------------
if ( $ss_action == 'sv' )
{
require_once('suivi_supplier.inc.php');
require_once('category_followup.inc.php');
}
/*----------------------------------------------------------------------
* Operation all the operation of this customer
@ -101,7 +96,7 @@ if ( $ss_action == 'sv' )
* ----------------------------------------------------------------------*/
if ( $ss_action == 'op')
{
require_once('operation_supplier.inc.php');
require_once('category_operation.inc.php');
}
/*-------------------------------------------------------------------------
* Balance of the card
@ -135,7 +130,6 @@ if ( $ss_action == 'cn')
/* Add button */
$f_add_button=new IButton('add_card');
$f_add_button->label=_('Créer une nouvelle fiche');
$f_add_button->set_attribute('ipopup','ipopcard');
$f_add_button->set_attribute('filter',$filter);
$f_add_button->javascript=" select_card_type(this);";

View file

@ -16,10 +16,9 @@
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* $Revision$ */
/* $Revision: 4701 $ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
require_once('class_customer.php');
/*!\file
* \brief this file will handle all the actions for a specific customer (
* contact,operation,invoice and financial)
@ -49,7 +48,7 @@ $f_id=$_REQUEST['f_id'];
echo '<div class="content" style="width:50%">';
if ( isset($_POST['mod'])) echo hb(_('Information sauvée'));
$supplier=new Supplier($cn,$f_id);
$supplier=new Fiche($cn,$f_id);
$p_readonly=($g_user->check_action(FICADD)==0)?true:false;
if ( ! $p_readonly) echo '<form method="post">';
echo dossier::hidden();
@ -70,7 +69,6 @@ if ( ! $p_readonly)
echo HtmlInput::submit('delete_card',_('Effacer cette fiche'),'onclick="return confirm(\'Confirmer effacement ?\');"');
echo '</form>';
}
echo $return->input();
echo '</div>';

View file

@ -16,7 +16,7 @@
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* $Revision$ */
/* $Revision: 4320 $ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr

View file

@ -16,7 +16,7 @@
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* $Revision$ */
/* $Revision: 4301 $ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr

59
include/class_bank.php Normal file
View file

@ -0,0 +1,59 @@
<?php
/*
* 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: 4267 $ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
require_once("constant.php");
require_once('class_database.php');
require_once("class_acc_parm_code.php");
require_once('class_fiche.php');
require_once('class_acc_account_ledger.php');
require_once('user_common.php');
/*! \file
* \brief Derived from class fiche Administration are a specific kind of card
* concerned only by official (or not) administration
*/
/*!
* \brief class admin are a specific kind of card
*/
// Use the view vw_supplier
//
class Bank extends Fiche
{
var $name; /*!< $name name of the company */
var $street; /*!< $street Street */
var $country; /*!< $country Country */
var $cp; /*!< $cp Zip code */
var $vat_number; /*!< $vat_number vat number */
/*! \brief Constructor
/* only a db connection is needed */
function __construct($p_cn,$p_id=0)
{
$this->fiche_def_ref=FICHE_TYPE_FIN;
parent::__construct($p_cn,$p_id) ;
}
}
?>

View file

@ -76,12 +76,15 @@ class contact extends Fiche
}
// Get The result Array
$step_contact=$this->GetAll($offset,$search.$extra_sql.$p_sql);
if ( $all_contact == 0 ) return "";
if ( $all_contact == 0 ) return "";
$r=$bar;
$r.='<table border="0" width="95%">
<TR style="background-color:lightgrey;">
<th>Quick Code</th>
<th>Nom</th>
<th>Prénom</th>
<th>Société</th>
<th>Téléphone</th>
<th>email</th>
<th>Fax</th>
@ -116,17 +119,15 @@ class contact extends Fiche
// add popup for detail
if ( $l_company_name !="")
{
$l_company_name=sprintf("<A HREF=\"javascript:showfiche('%s')\">%s - %s</A>",
$contact->strAttribut(ATTR_DEF_COMPANY),
$contact->strAttribut(ATTR_DEF_COMPANY),
$l_company_name
);
$l_company_name=HtmlInput::card_detail($contact->strAttribut(ATTR_DEF_COMPANY),$l_company_name,'style="text-decoration:underline;"');
}
$r.="<TR>";
$qcode=$contact->strAttribut(ATTR_DEF_QUICKCODE);
$r.='<TD><A HREF="javascript:void(0)" onclick="this.ipopup=\'ipopcard\';this.qcode=(\''.$qcode.'\');fill_ipopcard(this);">'.$qcode.
"</A></TD>";
$r.="<TD>".$contact->strAttribut(ATTR_DEF_NAME)."</TD>";
$r.="<TD>".$contact->strAttribut(ATTR_DEF_FIRST_NAME)."</TD>";
$r.="<TD>".$l_company_name."</TD>";
$r.="<TD>".$contact->strAttribut(ATTR_DEF_TEL)."</TD>";
$r.="<TD>".$contact->strAttribut(ATTR_DEF_EMAIL)."</TD>".
"<TD> ".$contact->strAttribut(ATTR_DEF_FAX)."</TD>";

View file

@ -974,8 +974,9 @@ class Document
|| strlen(trim( ${'e_march'.$counter.'_price'} )) ==0
|| strlen(trim(${'e_quant'.$counter})) ==0)
return "";
$r=round(${$id}*${$quant},2);
bcscale(4);
$r=bcmul(${$id},${$quant});
$r=round($r,2);
break;
case 'VEN_TVAC':
@ -986,7 +987,7 @@ class Document
if ( ! isset(${'e_march'.$counter.'_price'})|| !isset(${'e_quant'.$counter})) return "";
// check that something is sold
if ( ${'e_march'.$counter.'_price'} == 0 || ${'e_quant'.$counter} == 0 ) return "";
bcscale(2);
bcscale(4);
// if TVA not exist
if ( ! isset(${$id}))
$r= bcmul(${$price},${$quant});
@ -994,12 +995,13 @@ class Document
$r= bcmul(${$price},${$quant});
$r=bcadd($r,${$id});
}
$r=round($r,2);
return $r;
break;
case 'TOTAL_VEN_HTVA':
extract($p_array);
bcscale(4);
$sum=0.0;
for ($i=0;$i<$nb_item;$i++)
{
@ -1012,8 +1014,8 @@ class Document
strlen(trim(${$qt})) == 0 ||
${$qt}==0 || ${$sell}==0)
continue;
$sum+=${$sell}*${$qt};
$sum=round($sum,2);
$tmp1=bcmul(${$sell},${$qt});
$sum=bcadd($sum,$tmp1);
}
@ -1022,7 +1024,7 @@ class Document
case 'TOTAL_VEN_TVAC':
extract($p_array);
$sum=0.0;
bcscale(2);
bcscale(4);
for ($i=0;$i<$nb_item;$i++)
{
$tva='e_march'.$i.'_tva_amount';

View file

@ -468,7 +468,7 @@ class Fiche
{
$w=new ICard("av_text".$attr->ad_id);
// filter on frd_id
$sql=' select fd_id from fiche_def where frd_id in ('.FICHE_TYPE_CLIENT.','.FICHE_TYPE_FOURNISSEUR.','.FICHE_TYPE_ADM_TAX.')';
$sql=' select fd_id from fiche_def where frd_id in ('.FICHE_TYPE_CLIENT.','.FICHE_TYPE_FOURNISSEUR.','.FICHE_TYPE_ADM_TAX.','.FICHE_TYPE_FIN.')';
$filter=$this->cn->make_list($sql);
$w->set_attribute('ipopup','ipopcard');
$w->set_attribute('typecard',$filter);
@ -612,7 +612,8 @@ class Fiche
{
$w = new ICard("av_text" . $r->ad_id);
// filter on frd_id
$sql = ' select fd_id from fiche_def where frd_id in (' . FICHE_TYPE_CLIENT . ',' . FICHE_TYPE_FOURNISSEUR . ',' . FICHE_TYPE_ADM_TAX . ')';
$sql = ' select fd_id from fiche_def where frd_id in (' . FICHE_TYPE_CLIENT . ',' . FICHE_TYPE_FOURNISSEUR . ',' . FICHE_TYPE_ADM_TAX . '
,'.FICHE_TYPE_FIN.')';
$filter = $this->cn->make_list($sql);
$w->extra = $filter;
$w->extra2 = 0;
@ -829,7 +830,7 @@ class Fiche
{
$exist=$this->cn->count_sql("select f_id from fiche join fiche_def using (fd_id) ".
" join fiche_detail using(f_id) ".
" where frd_id in (8,9,14) and ad_id=".ATTR_DEF_QUICKCODE.
" where frd_id in (4,8,9,14) and ad_id=".ATTR_DEF_QUICKCODE.
" and ad_value='".sql_string($value)."'");
if ( $exist == 0 && sql_string($value) != null )
{
@ -1000,7 +1001,7 @@ class Fiche
{
$exist=$this->cn->exec_sql("select f_id from fiche join fiche_def using (fd_id) ".
" join fiche_detail using (f_id) ".
" where frd_id in (8,9,14) and ad_id=$1 ".
" where frd_id in (4,8,9,14) and ad_id=$1 ".
" and ad_value=upper($2)",
array(ATTR_DEF_QUICKCODE,$value));

View file

@ -63,8 +63,7 @@ class Pre_operation
}
function delete ()
{
$sql="delete from op_predef where od_id=".$this->od_id.
" and od_direct ='".$this->od_direct."'";
$sql="delete from op_predef where od_id=".$this->od_id;
$this->db->exec_sql($sql);
}
/*!\brief save the predef check first is the name is unique

View file

@ -25,11 +25,7 @@ require_once("class_iselect.php");
require_once("class_ihidden.php");
require_once("class_customer.php");
require_once("class_ibutton.php");
require_once('class_iaction.php');
require_once('class_fiche_def.php');
require_once('class_iaction.php');
require_once('class_fiche_def.php');
require_once('class_ipopup.php');
@ -137,30 +133,9 @@ if ($low_action == "list")
if ( $low_action == 'detail')
{
/* Menu */
require_once('client_card.inc.php');
require_once('category_card.inc.php');
exit();
}
if ($low_action == "insert")
{
/* security : check if user can add card */
if ($g_user->check_action(FICADD) == 0)
{
alert('Vous ne pouvez pas ajouter de fiche');
return;
}
$customer = new Customer($cn);
$customer->Save($_REQUEST['fd_id']);
echo '<div class="content">';
echo "<table>";
echo $customer->Display(true);
echo "</table>";
$retour = new IAction();
$retour->label = "Retour";
$retour->value = "?ac=" . $_REQUEST["ac"] . "&" . dossier::get();
echo $retour->input();
echo '</div>';
}
html_page_stop();
?>

View file

@ -1,150 +0,0 @@
<?php
/*
* 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
/*!\file
* \brief this file will handle all the actions for a specific customer (
* contact,operation,invoice and financial)
* include from client.inc.php and concerned only the customer card and
* the customer category
*/
require_once('class_contact.php');
require_once('class_ipopup.php');
/* $sub_action = sb = detail */
/* $cn database conx */
$str_dossier=Dossier::get();
$return= HtmlInput::button_anchor('Retour','?p_action=client&'.$str_dossier);
$root="?p_action=client&sb=detail&f_id=".$_REQUEST["f_id"].'&'.$str_dossier."&ac=".$_REQUEST["ac"];
$ss_action=( isset ($_REQUEST['sc'] ))? $_REQUEST['sc']: '';
switch ($ss_action)
{
case 'dc':
$def=1;
break;
case 'sv': /* all the actions (mail,meeting...) */
$def=2;
break;
case 'cn':
$def=3;
break;
case 'op':
$def=4;
break;
case 'let':
$def=6;
break;
case 'bal':
$def=7;
break;
default:
$def=1;
$ss_action='dc';
}
$f=new Fiche($cn,$_REQUEST['f_id']);
echo '<div class="content">';
echo ShowItem(array(
array($root."&sc=dc",_('Fiche'),_('Détail de la fiche'),1),
array($root.'&sc=sv',_('Suivi'),_('Suivi client, devis, bon de commande, courrier'),2),
array($root.'&sc=cn',_('Contact'),_('Liste de contacts de ce client'),3),
array($root.'&sc=op',_('Opérations'),_('Toutes les opérations'),4),
array($root.'&sc=bal',_('Balance'),_('Balance du client'),7),
array($root.'&sc=let',_('Lettrage'),_('Opérations & Lettrages'),6),
array('?ac='.$_REQUEST['ac'].'&'.dossier::get(),_('Retour liste'),_('Retour à la liste des clients'),5)
),
'H',"mtitle","mtitle",$def,'');
echo '</div>';
echo '<div>';
echo '<div class="gest_name"">';
echo '<h2 class="gest_name">'.$f->get_quick_code()." ".$f->strAttribut(ATTR_DEF_NAME).'</h2>';
echo '</div>';
echo '</div>';
//---------------------------------------------------------------------------
// Show Detail of a card and category
//---------------------------------------------------------------------------
if ( $ss_action == 'dc' )
{
require_once('detail_client.inc.php');
}
//---------------------------------------------------------------------------
// Follow up : mail, bons de commande, livraison, rendez-vous...
//---------------------------------------------------------------------------
if ( $ss_action == 'sv' )
{
require_once('suivi_client.inc.php');
}
/*----------------------------------------------------------------------
* Operation all the operation of this customer
*
* ----------------------------------------------------------------------*/
if ( $ss_action == 'op')
{
require_once('operation_client.inc.php');
}
/*----------------------------------------------------------------------
* All the contact
*
*----------------------------------------------------------------------*/
if ( $ss_action == 'cn')
{
echo '<div class="content">';
echo dossier::hidden();
$f=new Fiche($cn,$_REQUEST['f_id']);
$contact=new Contact($cn);
$contact->company=$f->get_quick_code();
echo $contact->summary();
$sql=' select fd_id from fiche_def where frd_id='.FICHE_TYPE_CONTACT;
$filter=$cn->make_list($sql);
if ( empty ($filter))
{
echo '<span class="notice">';
echo _("Vous devez aller dans fiche et créer une catégorie pour les contacts");
echo '</span>';
exit();
}
/* Add button */
$f_add_button=new IButton('add_card');
$f_add_button->label=_('Créer une nouvelle fiche');
$f_add_button->set_attribute('ipopup','ipopcard');
$f_add_button->set_attribute('filter',$filter);
$f_add_button->javascript=" select_card_type(this);";
echo $f_add_button->input();
echo '</div>';
}
/*----------------------------------------------------------------------------
* Lettering
*----------------------------------------------------------------------------*/
if ( $def==6 )
{
require_once('lettering.gestion.inc.php');
}
/*-------------------------------------------------------------------------
* Balance of the card
*-------------------------------------------------------------------------*/
if ( $ss_action=='bal')
{
require_once('balance_card.inc.php');
}

View file

@ -15,215 +15,140 @@
* 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
//!\brief File for adding contact, contact is a kind of fiche
require_once("class_icard.php");
require_once("class_ispan.php");
/* !\brief include from client.inc.php and concerned only the contact card and
* the contact category
*/
require_once("class_iselect.php");
require_once("class_ihidden.php");
require_once('class_contact.php');
/*! \file
* \brief the contact class is derived from the class fiche
* the contact is in fact a card but more specific
* This file is included from the module "Gestion"
require_once("class_contact.php");
require_once("class_ibutton.php");
require_once('class_fiche_def.php');
$low_action = (isset($_REQUEST['sb'])) ? $_REQUEST['sb'] : "list";
/* ! \file
* \brief Called from the module "Gestion" to manage the contact
*/
$href=basename($_SERVER['PHP_SELF']);
$sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"";
// if this page is called from another menu (customer, supplier,...)
// a button back is added
if ( isset ($_REQUEST['url']))
{
$retour=HtmlInput::button_anchor('Retour',urldecode($_REQUEST['url']));
$h_url=sprintf('<input type="hidden" name="url" value="%s">',urldecode($_REQUEST['url']));
}
else
{
$retour="";
$h_url="";
}
// Menu
// Remove a card
if ( isset ($_POST['delete']) )
{
$f_id=$_REQUEST['f_id'];
$fiche=new contact($cn,$f_id);
$fiche->remove();
$sub_action="list";
}
//-----------------------------------------------------
// Add card
if ( $sub_action=="insert" )
{
$contact=new Contact($cn);
$contact->Save($_REQUEST['fd_id']);
echo $retour;
echo "<table>";
echo $contact->Display(true);
echo "</table>";
echo $retour;
}
//-----------------------------------------------------
// Save modification
if ( isset ($_POST['mod']))
{
// modification is asked
$f_id=$_REQUEST['f_id'];
$contact=new contact($cn,$f_id);
$contact->Save();
$sub_action="list";
}
// by default open liste
if ( $sub_action == "" )
$sub_action="list";
if ($low_action == "")
$low_action = "list";
//-----------------------------------------------------
//Display a blank card
if ( $sub_action=="blank")
// Remove a card
//-----------------------------------------------------
if (isset($_POST['delete_card']))
{
$retour_action=HtmlInput::button_anchor('Retour', "commercial.php?p_action=contact&$str_dossier");
if ($g_user->check_action(FICADD) == 0)
{
alert(j(_('Vous ne pouvez pas enlever de fiche')));
return;
}
echo '<div class="redcontent">';
$f_id = $_REQUEST['f_id'];
echo $retour_action;
$c=new contact($cn);
echo '<form method="post" action="commercial.php"';
echo dossier::hidden();
echo HtmlInput::hidden('p_action','client');
echo HtmlInput::hidden("sa","insert");
echo HtmlInput::hidden("fd_id",$_GET['fd_id']);
echo HtmlInput::hidden("url", $_GET['url']);
;
echo $c->blank($_GET['fd_id']);
echo HtmlInput::submit('Sauve','Sauve');
echo '</form>';
echo $retour_action;
echo '</div>';
$fiche = new Contact($cn, $f_id);
$fiche->remove();
$low_action = "list";
}
//-----------------------------------------------------
// list
if ( $sub_action == "list" )
// list of contact
//-----------------------------------------------------
if ($low_action == "list")
{
?>
<div class="content">
<span>
<form method="get" action="commercial.php">
<?php
echo dossier::hidden();
$a=(isset($_GET['query']))?$_GET['query']:"";
printf ('<input type="text" name="query" value="%s">',
$a);
?>
<input type="submit" class="button" name="submit_query" value="<?_('recherche')?>">
<input type="hidden" name="p_action" value="contact">
</form>
<div>
<form method="get" action="<?php echo $href;?>">
<?php
echo dossier::hidden();
$a = (isset($_GET['query'])) ? $_GET['query'] : "";
printf(_('Recherche') . ' <input class="input_text" type="text" name="query" value="%s">', $a);
$sel_card = new ISelect('cat');
$sel_card->value = $cn->make_array('select fd_id, fd_label from fiche_def ' .
' where frd_id=' . FICHE_TYPE_CONTACT .
' order by fd_label ', 1);
$sel_card->selected = (isset($_GET['cat'])) ? $_GET['cat'] : -1;
$sel_card->javascript = ' onchange="submit(this);"';
echo _('Catégorie :') . $sel_card->input();
$sl_company=new ISelect("sel_company");
$sl_company->value = $cn->make_array('select distinct ad_value,ad_value from fiche_detail as fd' .
' join fiche as f1 on (f1.f_id=fd.f_id) join fiche_def as fdf on (f1.fd_id=fdf.fd_id)
where
ad_id='.ATTR_DEF_COMPANY. " and frd_id= ".FICHE_TYPE_CONTACT.
' order by 1', 1);
$sl_company->selected = (isset($_GET['sel_company'])) ? $_GET['sel_company'] : '';
echo _('Société :') . $sl_company->input();
?>
<input type="submit" class="button" name="submit_query" value="<?= _('recherche')?>">
<input type="hidden" name="ac" value="<?= $_REQUEST['ac']?>">
</form>
</div>
<?php
$client = new contact($cn);
$search = (isset($_GET['query'])) ? $_GET['query'] : "";
$sql = "";
if (isset($_GET['cat']))
{
if ($_GET['cat'] != -1)
$sql = sprintf(" and fd_id = %d", $_GET['cat']);
}
if (isset($_GET['sel_company']))
{
if ($_GET['sel_company'] != '' && $_GET['sel_company'] != -1)
{
$client->company=$_GET['sel_company'];
}
}
echo '<div class="content">';
echo $client->Summary($search,"contact",$sql);
<form>
<?php
echo dossier::hidden();
$qcode=(isset($_GET['qcode']))?$_GET['qcode']:"";
echo '<br>';
echo '<br>';
echo '<br>';
/* Add button */
$f_add_button = new IButton('add_card');
$f_add_button->label = _('Créer une nouvelle fiche');
$f_add_button->set_attribute('win_refresh', 'yes');
$f_add_button->set_attribute('type_cat', FICHE_TYPE_CONTACT);
$f_add_button->javascript = " select_card_type(this);";
echo $f_add_button->input();
$w=new ICard();
$w->name='qcode';
$w->value=$qcode;
$w->label='qcode';
$w->table=0;
$w->jrn=0;
$w->extra='4,8,9,14';
echo $w->input();
$f_cat_button=new IButton('add_cat');
$f_cat_button->set_attribute('ipopup','ipop_cat');
$f_cat_button->set_attribute('type_cat',FICHE_TYPE_CONTACT);
$f_cat_button->label=_('Ajout d\'une catégorie');
$f_cat_button->javascript='add_category(this)';
echo $f_cat_button->input();
$sp=new ISpan();
echo $sp->input("qcode_label",$qcode)."</TD></TR>";
?>
<input type="submit" class="button" name="submit_query" value="recherche">
<input type="hidden" name="p_action" value="contact">
</FORM>
</span>
<span>
<form method="get" action="commercial.php">
<? echo dossier::hidden();
?>
<input type="hidden" name="url" <?php $url=urlencode($_SERVER['REQUEST_URI']);
echo 'value="'.$url.'"';
?>>
<input type="hidden" name="p_action" value="contact">
<?php
$w=new ISelect();
$w->name="fd_id";
$w->value= $cn->make_array("select fd_id,fd_label from fiche_def where ".
" frd_id=".FICHE_TYPE_CONTACT);
// if array is empty show an warning and stops
if ( sizeof ($w->value) == 0 )
{
echo '<p style="color:red">Aucune fiche de catégories contact</p>';
echo '<p>allez dans fiche creation et choississez contact comme sorte</p>';
exit();
}
echo $w->input();
?>
<input type="hidden" name="sa" value="blank">
<input type="submit" class="button" name="submit_query" value="Ajout Contact">
</form>
</span>
<?php
$contact=new Contact($cn);
$search=(isset($_GET['query']))?$_GET['query']:"";
// check if a company is asked if yes, add a condition
if ( $qcode != "" )
{
$contact->company=$qcode;
}
echo $retour;
echo '<div class="redcontent">';
echo $contact->Summary($search);
echo '</div>';
echo '</div>';
echo $retour;
}
//-----------------------------------------------------
// Show Detail
if ( $sub_action == 'detail' )
/*----------------------------------------------------------------------
* Detail for a card, Suivi, Contact, Operation,... *
* cc stands for contact card
*----------------------------------------------------------------------*/
if ( $low_action == 'detail')
{
$f_id=$_REQUEST['f_id'];
echo '<div class="redcontent">';
$contact=new contact($cn,$f_id);
echo $retour;
echo '<form action="'.$_SERVER['REQUEST_URI'].'" method="post">';
echo dossier::hidden();
echo $contact->Display(false);
$w=new IHidden();
$w->name="p_action";
$w->value="contact";
echo $w->input();
$w->name="f_id";
$w->value=$f_id;
echo $w->input();
echo HtmlInput::submit('mod','Sauver les modifications');
echo '<A HREF="commercial.php?p_action=contact&'.$str_dossier.'"><INPUT TYPE="button" class="button" value="Retour"></A>';
echo HtmlInput::submit('delete','Effacer cette fiche');
echo '</form>';
echo $retour;
echo '<div>';
/* Menu */
require_once('category_card.inc.php');
exit();
}
html_page_stop();
html_page_stop();
?>

View file

@ -1,76 +0,0 @@
<?php
/*
* 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
/*!\file
* \brief this file will handle all the actions for a specific customer (
* contact,operation,invoice and financial)
* include from adm.inc.php and concerned only the customer card and
* the customer category
* parameter
* - p_action = adm
* - sb = detail
* - sc = dc
*/
//----------------------------------------------------------------------------
// Save modification
//---------------------------------------------------------------------------
if ( isset ($_POST['mod']))
{
// modification is asked
$f_id=$_REQUEST['f_id'];
$adm=new Fiche($cn,$f_id);
$adm->Save();
}
echo '<div class="u_content" style="width:50%">';
$f_id=$_REQUEST['f_id'];
echo '<div class="content">';
if ( isset($_POST['mod'])) echo hb('Information sauvée');
$adm=new Fiche($cn,$f_id);
$p_readonly=($g_user->check_action(FICADD)==0)?true:false;
if ( ! $p_readonly) echo '<form method="post">';
echo dossier::hidden();
echo HtmlInput::hidden('sb','detail');
echo HtmlInput::hidden('dc','cc');
echo $adm->Display($p_readonly);
$w=new IHidden();
$w->name="p_action";
$w->value="adm";
echo $w->input();
$w->name="f_id";
$w->value=$f_id;
echo $w->input();
if ( ! $p_readonly)
{
echo HtmlInput::submit('mod',_('Sauver les modifications'));
echo HtmlInput::reset(_("Annuler"));
echo HtmlInput::submit('delete_card','Effacer cette fiche','onclick="return confirm(\'Confirmer effacement ?\');"');
echo '</form>';
}
echo $return->input();
echo '</div>';

View file

@ -1,76 +0,0 @@
<?php
/*
* 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
/*!\file
* \brief this file will handle all the actions for a specific customer (
* contact,operation,invoice and financial)
* include from client.inc.php and concerned only the customer card and
* the customer category
* parameter
* - p_action = client
* - sb = detail
* - sc = dc
*/
//----------------------------------------------------------------------------
// Save modification
//---------------------------------------------------------------------------
if ( isset ($_POST['mod']))
{
// modification is asked
$f_id=$_REQUEST['f_id'];
$client=new Customer($cn,$f_id);
$client->Save();
}
echo '<div class="u_content">';
$f_id=$_REQUEST['f_id'];
echo '<div class="content" style="width:50%">';
if ( isset($_POST['mod'])) echo hb(_('Information sauvée'));
$client=new Customer($cn,$f_id);
$p_readonly=($g_user->check_action(FICADD)==0)?true:false;
if ( ! $p_readonly) echo '<form method="post">';
echo dossier::hidden();
echo HtmlInput::hidden('sb','detail');
echo HtmlInput::hidden('dc','cc');
echo $client->Display($p_readonly);
$w=new IHidden();
$w->name="p_action";
$w->value="client";
echo $w->input();
$w->name="f_id";
$w->value=$f_id;
echo $w->input();
if ( ! $p_readonly)
{
echo HtmlInput::submit('mod',_('Sauver les modifications'));
echo HtmlInput::reset(_("Annuler"));
echo HtmlInput::submit('delete_card',_('Effacer cette fiche'),'onclick="return confirm(\'Confirmer effacement ?\');"');
echo '</form>';
}
echo $return;
echo '</div>';

View file

@ -1,34 +0,0 @@
<?php
/*
* 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
/*!\file
* \brief export the anc tables in CSV
*/
header('Pragma: public');
header('Content-type: application/csv');
header('Content-Disposition: attachment;filename="anc-list-export.csv"',FALSE);
require_once('class_anc_acc_list.php');
$atable=new Anc_Acc_List($cn);
$atable->get_request();
$atable->export_csv();

View file

@ -1,161 +0,0 @@
<?php
/*
* 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
/*! \file
* \brief Send the poste list in csv
*/
include_once("ac_common.php");
require_once('class_database.php');
include ('class_user.php');
require_once("class_acc_account_ledger.php");
require_once ('class_acc_operation.php');
header('Pragma: public');
header('Content-type: application/csv');
header('Content-Disposition: attachment;filename="poste.csv"',FALSE);
require_once('class_dossier.php');
$gDossier=dossier::id();
/* Admin. Dossier */
$cn=new Database($gDossier);
$User=new User($cn);
$User->Check();
$User->check_dossier($gDossier);
if ( isset ( $_REQUEST['poste_fille']) )
{ //choisit de voir tous les postes
$a_poste=$cn->get_array("select pcm_val from tmp_pcmn where pcm_val::text like $1||'%'",array($_REQUEST["poste_id"]));
}
else
{
$a_poste=$cn->get_array("select pcm_val from tmp_pcmn where pcm_val = $1",array($_REQUEST['poste_id']));
}
if ( ! isset ($_REQUEST['oper_detail']))
{
if ( count($a_poste) == 0 )
exit;
foreach ($a_poste as $pos)
{
$Poste=new Acc_Account_Ledger($cn,$pos['pcm_val']);
$name=$Poste->get_name();
list($array,$tot_deb,$tot_cred)=$Poste->get_row_date( $_REQUEST['from_periode'],
$_REQUEST['to_periode'],
$_GET['ople']
);
if ( count($Poste->row ) == 0 )
continue;
echo '"Poste";'.
'"n° pièce";'.
'"Lib.";'.
"\"Code interne\";".
"\"Date\";".
"\"Description\";".
"\"Débit\";".
"\"Crédit\";".
"\"Prog.\"";
printf("\n");
$prog=0;
foreach ( $Poste->row as $op )
{
$diff=bcsub($op['deb_montant'],$op['cred_montant']);
$prog=bcadd($prog,$diff);
echo '"'.$pos['pcm_val'].'";'.
'"'.$op['jr_pj_number'].'"'.";".
'"'.$name.'";'.
'"'.$op['jr_internal'].'"'.";".
'"'.$op['j_date_fmt'].'"'.";".
'"'.$op['description'].'";'.
nb($op['deb_montant']).";".
nb($op['cred_montant']).";".
nb(abs($prog));
printf("\n");
}
$solde_type=($tot_deb>$tot_cred)?"solde débiteur":"solde créditeur";
$diff=abs($tot_deb-$tot_cred);
printf(
'"'."$solde_type".'"'.";".
nb($diff).";".
nb($tot_deb).";".
nb($tot_cred)."\n");
}
}
else
{
/* detail of all operation */
if ( count($a_poste) == 0 )
exit;
foreach ($a_poste as $pos)
{
$Poste=new Acc_Account_Ledger($cn,$pos['pcm_val']);
$Poste->get_name();
list($array,$tot_deb,$tot_cred)=$Poste->get_row_date( $_REQUEST['from_periode'],
$_REQUEST['to_periode']
);
if ( count($Poste->row ) == 0 )
continue;
echo '"Poste";'.
'"Lib.";'.
'"QuickCode";'.
"\"Code interne\";".
"\"Date\";".
"\"Description\";".
"\"Montant\";".
"\"D/C\"";
printf("\n");
foreach ( $Poste->row as $a )
{
$op=new Acc_Operation($cn);
$op->jr_id=$a['jr_id'];
$result=$op->get_jrnx_detail();
foreach ( $result as $r)
{
printf('"%s";"%s";"%s";"%s";"%s";"%s";"%s";%12.2f;"%s"',
$r['j_poste'],
$r['pcm_lib'],
$r['j_qcode'],
$r['jr_internal'],
$r['jr_date'],
$a['description'],
$a['jr_pj_number'],
nb($r['j_montant']),
$r['debit']);
printf("\r\n");
}
}
}
exit;
}
?>

View file

@ -1,34 +0,0 @@
<?php
/*
* 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
/*!\file
* \brief export the anc tables in CSV
*/
header('Pragma: public');
header('Content-type: application/csv');
header('Content-Disposition: attachment;filename="histo-export.csv"',FALSE);
require_once('class_anc_table.php');
$atable=new Anc_Table($cn);
$atable->get_request();
$atable->export_csv();

View file

@ -1,41 +0,0 @@
<?php
/*
* 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
/*!\file
* \brief show all the operation for a customer
* the variable inherited are
* - $cn database connexion
* - $_REQUEST['f_id'] the f_id of the card
* - $p_action
* - $sub_action
* - $ss_action
*/
require_once('class_acc_ledger.php');
$f=new Fiche($cn,$_REQUEST['f_id']);
$qcode=$f->get_quick_code();
$_GET['qcode']=$qcode;
$_REQUEST['qcode']=$qcode;
$var_array=compute_variable('ledger_type=ALL');
put_global($var_array);
require_once ('history_operation.inc.php');

View file

@ -1,41 +0,0 @@
<?php
/*
* 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
/*!\file
* \brief show all the operation for a customer
* the variable inherited are
* - $cn database connexion
* - $_REQUEST['f_id'] the f_id of the card
* - $p_action
* - $sub_action
* - $ss_action
*/
require_once('class_acc_ledger.php');
$f=new Fiche($cn,$_REQUEST['f_id']);
$qcode=$f->get_quick_code();
$_GET['qcode']=$qcode;
$_REQUEST['qcode']=$qcode;
$var_array=compute_variable('ledger_type=ALL');
put_global($var_array);
require_once ('history_operation.inc.php');

View file

@ -64,16 +64,13 @@ if ( $sa == 'jrn' )
{
$op=new Pre_operation($cn);
$op->set_jrn($_GET['jrn']);
if ( isset($_GET['direct']))
{
$op->od_direct='true';
}
else
{
$op->od_direct='false';
}
$array=$op->get_list_ledger();
if ( empty($array) == true )
$is_ods = $cn->get_value("select count(*)
from jrn_def where
jrn_def_id=$1
and jrn_def_type='ODS'", array($_GET['jrn']));
$op->od_direct = ($is_ods > 0) ? 't' : 'f';
$array = $op->get_list_ledger();
if (empty($array) == true)
{
echo "Aucun enregistrement";
exit();

View file

@ -1,48 +0,0 @@
<?php
/*
* 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
/*!\file
* \brief this file is used for the follow up of the customer (mail, meeting...)
* - sb = detail
* - sc = sv
* - sd = this parameter is used here
* - $cn = database connection
*/
require_once('class_follow_up.php');
/**
*\note fix problem with ShowActionList, this function is local
* to the file action.inc.php. And this function must different for each
* follow-up (suivi)
*/
$sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"list";
$ag_id=(isset($_REQUEST['ag_id']))?$_REQUEST['ag_id']:0;
$ac=$_REQUEST['ac'];
$base="ac=ac&sc=sv&sb=detail&f_id=".$_REQUEST['f_id'];
$retour=HtmlInput::button_anchor('Retour','?'.dossier::get().'&'.$base);
$fiche=new Fiche($cn,$_REQUEST['f_id']);
$_GET['qcode']=$fiche->get_quick_code();
$_REQUEST['qcode']=$fiche->get_quick_code();
echo '<div class="content">';
require_once('action.common.inc.php');
echo '</div>';

View file

@ -1,50 +0,0 @@
<?php
/*
* 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
/*!\file
* \brief this file is used for the follow up of the customer (mail, meeting...)
* - p_action = client
* - sb = detail
* - sc = sv
* - sd = this parameter is used here
* - $cn = database connection
*/
require_once('class_follow_up.php');
load_all_script();
/**
*\note problem with ShowActionList, this function is local
* to the file action.inc.php. And this function must different for each
* suivi
*/
$sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"list";
$ag_id=(isset($_REQUEST['ag_id']))?$_REQUEST['ag_id']:0;
//$p_action=$_REQUEST['p_action'];
$base="ac=".$_REQUEST['ac']."&sc=sv&sb=detail&f_id=".$_REQUEST['f_id'];
$retour=HtmlInput::button_anchor('Retour','?'.dossier::get().'&'.$base);
$fiche=new Fiche($cn,$_REQUEST['f_id']);
$_GET['qcode']=$fiche->get_quick_code();
$_REQUEST['qcode']=$fiche->get_quick_code();
echo '<div class="content">';
require_once('action.common.inc.php');
echo '</div>';

View file

@ -115,7 +115,6 @@ if ( $low_action == "list" )
/* Add button */
$f_add_button=new IButton('add_card');
$f_add_button->label=_('Créer une nouvelle fiche');
$f_add_button->set_attribute('ipopup','ipop_newcard');
$f_add_button->set_attribute('win_refresh','yes');
$f_add_button->set_attribute('type_cat',FICHE_TYPE_FOURNISSEUR);
@ -123,7 +122,6 @@ if ( $low_action == "list" )
echo $f_add_button->input();
$f_cat_button=new IButton('add_cat');
$f_cat_button->set_attribute('ipopup','ipop_cat');
$f_cat_button->set_attribute('type_cat',FICHE_TYPE_FOURNISSEUR);
$f_cat_button->label=_('Ajout d\'une catégorie');
$f_cat_button->javascript='add_category(this)';
@ -142,32 +140,11 @@ if ( $low_action == "list" )
if ( $low_action == 'detail')
{
/* Menu */
require_once('supplier_card.inc.php');
require_once('category_card.inc.php');
exit();
}
if ( $low_action=="insert" )
{
/* security : check if user can add card */
if ( $g_user->check_action(FICADD) == 0 )
{
alert('Vous ne pouvez pas ajouter de fiche');
return;
}
$supplier=new Supplier($cn);
$supplier->Save($_REQUEST['fd_id']);
echo '<div class="content">';
echo "<table>";
echo $supplier->Display(true);
echo "</table>";
$retour=new IAction();
$retour->label="Retour";
$retour->value="?p_action=supplier&".dossier::get();
echo $retour->input();
echo '</div>';
}
html_page_stop();
?>

52
sql/upgrade.sql Normal file
View file

@ -0,0 +1,52 @@
CREATE OR REPLACE FUNCTION comptaproc.check_balance(p_grpt integer)
RETURNS numeric AS
$BODY$
declare
amount_jrnx_debit numeric;
amount_jrnx_credit numeric;
amount_jrn numeric;
begin
select coalesce(sum (j_montant),0) into amount_jrnx_credit
from jrnx
where
j_grpt=p_grpt
and j_debit=false;
select coalesce(sum (j_montant),0) into amount_jrnx_debit
from jrnx
where
j_grpt=p_grpt
and j_debit=true;
select coalesce(jr_montant,0) into amount_jrn
from jrn
where
jr_grpt_id=p_grpt;
if ( amount_jrnx_debit != amount_jrnx_credit )
then
return abs(amount_jrnx_debit-amount_jrnx_credit);
end if;
if ( amount_jrn != amount_jrnx_credit)
then
return -1*abs(amount_jrn - amount_jrnx_credit);
end if;
return 0;
end;
$BODY$
LANGUAGE plpgsql;
update op_predef set od_direct='t' where od_jrn_type='ODS';
INSERT INTO menu_ref(
me_code, me_menu, me_file, me_url, me_description, me_parameter,
me_javascript, me_type)
VALUES ('BK', 'Banque', 'bank.inc.php', null, 'Information Banque', null,null,'ME');
INSERT INTO profile_menu(
me_code, me_code_dep, p_id, p_order, p_type_display, pm_default)
VALUES ('BK', 'GESTION', 1, 4, 'E', 0);
INSERT INTO profile_menu(
me_code, me_code_dep, p_id, p_order, p_type_display, pm_default)
VALUES ('BK', 'GESTION', 2, 4, 'E', 0);