Beta 2.0 Add the expense and supplier

This commit is contained in:
sparkyx 2006-06-23 20:45:22 +00:00
parent a6813a4ac3
commit 265df86335
10 changed files with 630 additions and 29 deletions

View file

@ -76,6 +76,7 @@ echo ShowItem(array(
array('?p_action=client','Client'),
array('?p_action=facture','Facture'),
array('?p_action=fournisseur','Fournisseur'),
array('?p_action=depense','Dépense'),
array('?p_action=contact','Contact'),
array('?p_action=suivi_courrier','Suivi courrier'),
array('?p_action=pref','Préférence'),
@ -109,7 +110,7 @@ if ( $p_action == "client" )
// Fournisseur
if ( $p_action == 'fournisseur')
{
require_once("fournisseur.inc.php");
require_once("supplier.inc.php");
}
////////////////////////////////////////////////////////////////////////////////
// action
@ -130,3 +131,9 @@ if ( $p_action == 'contact')
{
require_once("contact.inc.php");
}
////////////////////////////////////////////////////////////////////////////////
// Expense
if ( $p_action == 'depense')
{
require_once("depense.inc.php");
}

View file

@ -593,7 +593,7 @@ class Document
$sql='delete from document where d_id='.$this->d_id;
ExecSql($this->db,$sql);
}
/*!\brief Copy a document from the table document into the concerned row
/*!\brief Move a document from the table document into the concerned row
* the document is not copied : it is only a link
*
* \param $p_internal internal code

158
include/class_supplier.php Normal file
View file

@ -0,0 +1,158 @@
<?
/*
* 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");
require_once("class_parm_code.php");
require_once("class_widget.php");
require_once('class_fiche.php');
require_once('class_poste.php');
require_once('user_common.php');
/*! \file
* \brief Derived from class fiche Supplier are a specific kind of card
*/
/*!
* \brief class Supplier are a specific kind of card
*/
// Use the view vw_supplier
//
class Supplier extends fiche{
var $poste; /*! \enum $poste poste comptable */
var $name; /*! \enum $name name of the company */
var $street; /*! \enum $street Street */
var $country; /*! \enum $country Country */
var $cp; /*! \enum $cp Zip code */
var $vat_number; /*! \enum $vat_number vat number */
/*! \brief Constructor
/* only a db connection is needed */
function Supplier($p_cn,$p_id=0) {
$this->fiche_def_ref=FICHE_TYPE_FOURNISSEUR;
fiche::fiche($p_cn,$p_id) ;
}
/*! \brief Get all info contains in the view
* thanks to the poste elt (account)
*/
function GetFromPoste($p_poste=0) {
$this->poste=($p_poste==0)?$this->poste:$p_poste;
$sql="select * from vw_supplier where poste_comptable=".$this->poste;
$Res=ExecSql($this->cn,$sql);
if ( pg_NumRows($Res) == 0) return null;
// There is only _one_ row by supplier
$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 Summary
**************************************************
\Brief show the default screen
*
* parm :
* - p_search (filter)
* gen :
* -
* return: string to display
*/
function Summary($p_search)
{
$p_search=FormatString($p_search);
$url=urlencode($_SERVER['REQUEST_URI']);
$script=$_SERVER['SCRIPT_NAME'];
// Creation of the nav bar
// Get the max numberRow
$all_supplier=$this->CountByDef($this->fiche_def_ref,$p_search);
// Get offset and page variable
$offset=( isset ($_REQUEST['offset'] )) ?$_REQUEST['offset']:0;
$page=(isset($_REQUEST['page']))?$_REQUEST['page']:1;
$bar=jrn_navigation_bar($offset,$all_supplier,$_SESSION['g_pagesize'],$page);
// set a filter ?
$search="";
if ( trim($p_search) != "" )
{
$search=" and f_id in
(select f_id from jnt_fic_att_value
join fiche using (f_id)
join attr_value using (jft_id)
where
ad_id=1 and av_text ~* '$p_search')";
}
// Get The result Array
$step_supplier=$this->GetAll($offset,$search);
if ( $all_supplier == 0 ) return "";
$r=$bar;
$r.='<table>
<TR style="background-color:lightgrey;">
<TH>Quick Code</TH>
<th>Nom</th>
<th>Adresse</th>
<th>Solde</th>
<th>Action </th>
</TR>';
if ( sizeof ($step_supplier ) == 0 )
return $r;
foreach ($step_supplier as $supplier ) {
$r.="<TR>";
$e=sprintf('<A HREF="%s?p_action=fournisseur&sa=detail&f_id=%d&url=%s" title="Détail"> ',
$script,$supplier->id,$url);
$r.="<TD> $e".$supplier->strAttribut(ATTR_DEF_QUICKCODE)."</A></TD>";
$r.="<TD>".$supplier->strAttribut(ATTR_DEF_NAME)."</TD>";
$r.="<TD>".$supplier->strAttribut(ATTR_DEF_ADRESS).
" ".$supplier->strAttribut(ATTR_DEF_CP).
" ".$supplier->strAttribut(ATTR_DEF_PAYS).
"</TD>";
$post=new poste($this->cn,$supplier->strAttribut(ATTR_DEF_ACCOUNT));
$a=$post->GetSoldeDetail();
$r.=sprintf('<TD align="right"> %15.2f&euro;</TD>',$a['solde']);
$r.="<TD>";
$r.=sprintf('<A HREF="%s?p_action=contact&qcode=%s&url=%s" title="Contact">C</A> - ',
$script,$supplier->strAttribut(ATTR_DEF_QUICKCODE),$url);
$r.=sprintf('<A HREF="%s?p_action=suivi_courrier&sa=list&qcode=%s&url=%s" title="Action">A</A> - ',
$script,$supplier->strAttribut(ATTR_DEF_QUICKCODE) ,$url);
$r.='<A HREF="commercial.php?p_action=depense&sa=list&qcode='.$supplier->strAttribut(ATTR_DEF_QUICKCODE).'&url='.$url.'" title="Historique Facture">F</A> -';
$r.='</TD>';
$r.="</TR>";
}
$r.="</TABLE>";
$r.=$bar;
return $r;
}
}
?>

View file

@ -77,6 +77,7 @@ if ( isset ($_POST['mod']))
$contact=new contact($cn,$f_id);
$contact->Save();
$sub_action="list";
}
// by default open liste
if ( $sub_action == "" )

236
include/depense.inc.php Normal file
View file

@ -0,0 +1,236 @@
<?
/*
* 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('class_jrn.php');
require_once('user_form_ach.php');
require_once('jrn.php');
require_once("class_document.php");
require_once("class_fiche.php");
/*!\brief the purpose off this file encode expense and to record them
*
*/
var_dump($_REQUEST);
// First we show the menu
// If nothing is asked the propose a blank form
// to enter a new invoice
if ( ! isset ($_REQUEST['p_jrn'])) {
// no journal are selected so we select the first one
$p_jrn=GetFirstJrnIdForJrnType($_SESSION['g_dossier'],'ACH');
} else
{
$p_jrn=$_REQUEST['p_jrn'];
}
// for the back button
$retour="";
$h_url="";
if ( isset ($_REQUEST['url']))
{
$retour=sprintf('<A HREF="%s"><input type="button" value="Retour"></A>',urldecode($_REQUEST['url']));
$h_url=sprintf('<input type="hidden" name="url" value="%s">',urldecode($_REQUEST['url']));
}
$sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"";
////////////////////////////////////////////////////////////////////////////////
// If a list of depense is asked
//
if ( $sub_action == "list")
{
// show the menu with the list item selected
echo '<div class="u_subtmenu">';
echo ShowMenuJrnUser($_SESSION['g_dossier'],'ACH',0,'<td class="selectedcell">Liste</td>');
echo '</div>';
// Ask to update payment
if ( isset ( $_GET['paid']))
{
// reset all the paid flag because the checkbox is post only
// when checked
foreach ($_GET as $name=>$paid)
{
list($ad) = sscanf($name,"set_jr_id%d");
if ( $ad == null ) continue;
$sql="update jrn set jr_rapt='' where jr_id=$ad";
$Res=ExecSql($cn,$sql);
}
// set a paid flag for the checked box
foreach ($_GET as $name=>$paid)
{
list ($id) = sscanf ($name,"rd_paid%d");
if ( $id == null ) continue;
// echo "Mise à jour $id";
$paid=($paid=='on')?'paid':'';
$sql="update jrn set jr_rapt='$paid' where jr_id=$id";
$Res=ExecSql($cn,$sql);
}
}
echo '<div class="u_redcontent">';
echo '<form method= "GET" action="commercial.php">';
$hid=new widget("hidden");
$hid->name="p_action";
$hid->value="depense";
echo $hid->IOValue();
$hid->name="sa";
$hid->value="list";
echo $hid->IOValue();
$w=new widget("select");
$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode order by p_id");
// User is already set User=new cl_user($cn);
$current=(isset($_GET['p_periode']))?$_GET['p_periode']:$User->GetPeriode();
$w->selected=$current;
echo 'Période '.$w->IOValue("p_periode",$periode_start).$w->Submit('gl_submit','Valider');
$qcode=(isset($_GET['qcode']))?$_GET['qcode']:"";
printf ('<span>Tiers QuickCode: <input type="text" name="qcode" value="%s"></span>',
$qcode);
echo $retour;
// Show list of sell
// Date - date of payment - Customer - amount
$sql=SQL_LIST_ALL_INVOICE." and jr_tech_per=".$current." and jr_def_type='ACH'" ;
$step=$_SESSION['g_pagesize'];
$page=(isset($_GET['offset']))?$_GET['page']:1;
$offset=(isset($_GET['offset']))?$_GET['offset']:0;
$l="";
// check if qcode contains something
if ( $qcode != "" )
{
// add a condition to filter on the quick code
$l=" and jr_grpt_id in (select j_grpt from jrnx where j_qcode='$qcode') ";
}
list($max_line,$list)=ListJrn($cn,0,"where jrn_def_type='ACH' and jr_tech_per=$current $l "
,null,$offset,1);
$bar=jrn_navigation_bar($offset,$max_line,$step,$page);
echo "<hr> $bar";
echo $list;
echo "$bar <hr>";
if ( $max_line !=0 )
echo $hid->Submit('paid','Mise à jour paiement');
echo '</FORM>';
echo $retour;
echo '</div>';
exit();
}
////////////////////////////////////////////////////////////////////////////////
echo '<div class="u_subtmenu">';
echo ShowMenuJrnUser($_SESSION['g_dossier'],'ACH',$p_jrn,'<td class="cell"><A class="mtitle" HREF="commercial.php?liste&p_action=depense&sa=list">Liste</A></td>');
echo '</div>';
////////////////////////////////////////////////////////////////////////////////
// if we request to add an item
// the $_POST['add_item'] is set
// or if we ask to correct the invoice
if ( isset ($_POST['add_item']) || isset ($_POST["correct_new_invoice"]) )
{
$nb_item=$_POST['nb_item'];
$nb_item++;
// Submit button in the form
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article">
<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Sauver" ID="SubmitButton">';
$form=FormAchInput($cn,$_GET['p_jrn'],$User->GetPeriode(),$_POST,$submit,false,$nb_item);
echo '<div class="u_redcontent">';
echo $form;
echo '</div>';
exit();
}
////////////////////////////////////////////////////////////////////////////////
// we want to save the invoice and to generate a invoice
//
if ( isset($_POST['save']))
{
// we save the expense
list ($internal,$c)=RecordSell($cn,$_POST,$User,$p_jrn);
$form=FormAchView($cn,$_GET['p_jrn'],$User->GetPeriode(),$_POST,"",$_POST['nb_item'],false);
echo '<div class="u_redcontent">';
echo '<h2 class="info"> Op&eacute;ration '.$internal.' enregistr&eacute;</h2>';
echo $form;
echo '<hr>';
echo '</form>';
echo '<A href="commercial.php?p_action=depense&p_jrn='.$_GET['p_jrn'].'">
<input type="button" Value="Nouveau"></A>';
exit();
}
////////////////////////////////////////////////////////////////////////////////
// we show the confirmation screen
//
if ( isset ($_POST['view_invoice']) )
{
$nb_number=$_POST["nb_item"];
$submit='<INPUT TYPE="SUBMIT" name="save" value="Confirmer">';
$submit.='<INPUT TYPE="SUBMIT" name="correct" value="Corriger">';
if ( form_verify_input ($cn,$p_jrn,$User->GetPeriode(),$_POST,$nb_number) == true ) {
// Should use a read only view instead of FormAch
// where we can check
$form=FormAchView($cn,$p_jrn,$User->GetPeriode(),$_POST,$submit,$nb_number);
} else {
// if something goes wrong, correct it
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article">
<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Sauver">';
$form=FormAchInput($cn,$p_jrn,$User->GetPeriode(),$_POST,$submit, false, $nb_number);
}
echo '<div class="u_redcontent">';
echo $form;
echo '</div>';
exit();
}
////////////////////////////////////////////////////////////////////////////////
// By default we add a new invoice
if ( $p_jrn != -1 )
{
$jrn=new jrn($cn, $p_jrn);
echo_debug('depense.inc.php',__LINE__,"Blank form");
// Submit button in the form
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article">
<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Sauver" ID="SubmitButton">';
// Show an empty form of invoice
$form=FormAchInput($cn,$p_jrn,$User->GetPeriode(),null,$submit,false,$jrn->getDefLine('cred'));
echo '<div class="u_redcontent">';
echo $form;
echo '</div>';
}

View file

@ -26,13 +26,6 @@ require_once("class_fiche.php");
/*!\brief the purpose off this file is to create invoices, to record them and to generate
* them, and of course to save them into the database
*
* \note we update also the jrn.
* jr_pj oid
* jr_pj_name text
* jr_pj_type text
* \todo link the table document and jrn, remove those field to make it cleaner and to permit to
* several operation for one document. For that we should have a new item in the menu (link
* document and operation) To be analyzed
*/
var_dump($_REQUEST);
@ -40,24 +33,22 @@ var_dump($_REQUEST);
// If nothing is asked the propose a blank form
// to enter a new invoice
if ( ! isset ($_REQUEST['p_jrn'])) {
// no journal are selected so we select the first one
// $p_jrn=GetFirstJrnIdForJrnType($_SESSION['g_dossier'],'VEN');
$p_jrn=-1;
// no journal are selected so we select the first one
$p_jrn=GetFirstJrnIdForJrnType($_SESSION['g_dossier'],'VEN');
// $p_jrn=-1;
} else
{
$p_jrn=$_REQUEST['p_jrn'];
}
// for the back button
$retour="";
$h_url="";
if ( isset ($_REQUEST['url']))
{
$retour=sprintf('<A HREF="%s"><input type="button" value="Retour"></A>',urldecode($_REQUEST['url']));
$h_url=sprintf('<input type="hidden" name="url" value="%s">',urldecode($_REQUEST['url']));
}
else
{
$retour="";
$h_url="";
}
$sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"";
////////////////////////////////////////////////////////////////////////////////
@ -68,7 +59,7 @@ if ( $sub_action == "list")
// show the menu with the list item selected
echo '<div class="u_subtmenu">';
echo ShowMenuJrnUser($_SESSION['g_dossier'],'VEN',$p_jrn,'<td class="selectedcell">Liste</td>');
echo ShowMenuJrnUser($_SESSION['g_dossier'],'VEN',0,'<td class="selectedcell">Liste</td>');
echo '</div>';
// Ask to update payment
if ( isset ( $_GET['paid']))
@ -127,7 +118,7 @@ if ( $sub_action == "list")
$qcode=(isset($_GET['qcode']))?$_GET['qcode']:"";
printf ('<span>Tiers QuickCode: <input type="text" name="qcode" value="%s"></span>',
$qcode);
echo $retour;
// Show list of sell
// Date - date of payment - Customer - amount
$sql=SQL_LIST_ALL_INVOICE." and jr_tech_per=".$current." and jr_def_type='VEN'" ;
@ -153,6 +144,7 @@ if ( $sub_action == "list")
if ( $max_line !=0 )
echo $hid->Submit('paid','Mise à jour paiement');
echo '</FORM>';
echo $retour;
echo '</div>';
@ -238,9 +230,9 @@ if ( isset ($_POST['view_invoice']) )
if ( $p_jrn != -1 )
{
$jrn=new jrn($cn, $p_jrn);
echo_debug('user_action_ven.php',__LINE__,"Blank form");
echo_debug('facture.inc.php.php',__LINE__,"Blank form");
// Show an empty form of invoice
$form=FormVenInput($cn,$_GET['p_jrn'],$User->GetPeriode(),null,false,$jrn->GetDefLine('cred'));
$form=FormVenInput($cn,$p_jrn,$User->GetPeriode(),null,false,$jrn->GetDefLine('cred'));
echo '<div class="u_redcontent">';
echo $form;
echo '</div>';

173
include/supplier.inc.php Normal file
View file

@ -0,0 +1,173 @@
<?
/*
* 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("class_supplier.php");
$sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"";
var_dump($_REQUEST);
/*! \file
* \brief Called from the module "Gestion" to manage the customer
*/
?>
<?
// Menu
// Remove a card
if ( isset ($_POST['delete']) )
{
echo 'delete';
$f_id=$_REQUEST['f_id'];
$fiche=new Supplier($cn,$f_id);
$fiche->remove();
$sub_action="list";
}
////////////////////////////////////////////////////////////////////////////////
// Add card
if ( $sub_action=="insert" )
{
$retour=sprintf('<A class="two" HREF="%s"><input type="button" value="Retour"></A>',
urldecode($_REQUEST['url']));
$supplier=new Supplier($cn);
$supplier->Save($_REQUEST['fd_id']);
echo $retour;
echo "<table>";
echo $supplier->Display(true);
echo "</table>";
echo $retour;
}
////////////////////////////////////////////////////////////////////////////////
// Save modification
if ( isset ($_POST['mod']))
{
// modification is asked
$f_id=$_REQUEST['f_id'];
$sup=new Supplier($cn,$f_id);
$sup->Save();
}
// by default open liste
if ( $sub_action == "" )
$sub_action="list";
////////////////////////////////////////////////////////////////////////////////
//Display a blank card
if ( $sub_action=="blank")
{
$retour=sprintf('<A class="two" HREF="%s"><input type="button" value="Retour"></A>',
"commercial.php?p_action=fournisseur");
echo '<div class="u_redcontent">';
echo $retour;
$c=new Supplier($cn);
echo '<form method="post" action="commercial.php"';
echo '<input type="hidden" name="p_action" value="fournisseur">';
echo '<input type="hidden" name="sa" value="insert">';
echo '<input type="hidden" name="fd_id" value="'.$_GET['fd_id'].'">';
echo '<input type="hidden" name="url" value="'.$_GET['url'].'">';
echo $c->blank($_GET['fd_id']);
echo '<input type="Submit" value="Sauve">';
echo '</form>';
echo $retour;
echo '</div>';
}
////////////////////////////////////////////////////////////////////////////////
// list
if ( $sub_action == "list" )
{
?>
<div class="u_content">
<span>
<form method="get" action="commercial.php">
<?
$a=(isset($_GET['query']))?$_GET['query']:"";
printf ('<input type="text" name="query" value="%s">',
$a);
?>
<input type="submit" name="submit_query" value="recherche">
<input type="hidden" name="p_action" value="fournisseur">
</form>
</span>
<span>
<form method="get" action="commercial.php">
<input type="hidden" name="url" <? $url=urlencode($_SERVER['REQUEST_URI']);echo 'value="'.$url.'"'; ?>
<input type="hidden" name="p_action" value="fournisseur">
<?
$w=new widget("select");
$w->name="fd_id";
$w->value= make_array($cn,"select fd_id,fd_label from fiche_def where ".
" frd_id=".FICHE_TYPE_FOURNISSEUR);
echo $w->IOValue();
?>
<input type="hidden" name="sa" value="blank">
<input type="submit" name="submit_query" value="Ajout Sup">
</form>
</span>
<?
$sup=new Supplier($cn);
$search=(isset($_GET['query']))?$_GET['query']:"";
// echo '<div style="position:absolute;left:15%;width:67%;margin-top:20px;">';
echo '<div class="u_redcontent">';
echo $sup->Summary($search);
echo '</div>';
echo '<div style="position:absolute;right:1%;width:10%;color:blue;background-color:lightgrey;margin-top:10px;">';
echo "<strong>Action :</strong> Ajout, mise à jour ou effacement";
echo " <ul>";
echo "<li>C - Contact</li>";
echo "<li>F - Facture</li>";
echo "<li>FC - Courrier</li>";
echo "</ul>";
echo '</div>';
echo '</div>';
}
////////////////////////////////////////////////////////////////////////////////
// Show Detail
if ( $sub_action == 'detail' )
{
$f_id=$_REQUEST['f_id'];
echo '<div class="u_redcontent">';
$sup=new Supplier($cn,$f_id);
$retour=sprintf('<A class="two" HREF="%s"><input type="button" value="Retour"></A>',
urldecode($_REQUEST['url']));
echo $retour;
echo '<form action="'.$_REQUEST['url'].'" method="post">';
echo $sup->Display(false);
$w=new widget("hidden");
$w->name="p_action";
$w->value="fournisseur";
echo $w->IOValue();
$w->name="f_id";
$w->value=$f_id;
echo $w->IOValue();
echo $w->Submit('mod','Sauver les modifications');
echo $w->Reset("Annuler");
echo $w->Submit('delete','Effacer cette fiche');
echo '</form>';
echo $retour;
echo '<div>';
}
html_page_stop();
?>

View file

@ -61,7 +61,25 @@ echo_debug('user_form_ach.php',__LINE__,"Enter FormAchInput($p_cn,$p_jrn,$p_peri
$r.=JS_SEARCH_CARD;
$r.=JS_SHOW_TVA;
$r.=JS_TVA;
$r.="<FORM NAME=\"form_detail\" enctype=\"multipart/form-data\" ACTION=\"user_jrn.php?action=new&p_jrn=$p_jrn\" METHOD=\"POST\">";
// Compute href
$href=$_SERVER['SCRIPT_NAME'];
switch ($href)
{
// user_jrn.php
case '/user_jrn.php':
$href="user_jrn.php?action=new&p_jrn=$p_jrn";
break;
case '/commercial.php':
$href="commercial.php?p_action=depense&p_jrn=$p_jrn";
break;
default:
echo_error('user_form_ach.php',__LINE__,'Erreur invalid request uri');
exit (-1);
}
// $r.="<FORM NAME=\"form_detail\" enctype=\"multipart/form-data\" ACTION=\"user_jrn.php?action=new&p_jrn=$p_jrn\" METHOD=\"POST\">";
$r.="<FORM NAME=\"form_detail\" enctype=\"multipart/form-data\" ACTION=\"$href\" METHOD=\"POST\">";
}
$sql="select jrn_def_id as value,jrn_def_name as label from jrn_def where jrn_def_type='VEN'";
@ -129,7 +147,7 @@ echo_debug('user_form_ach.php',__LINE__,"Enter FormAchInput($p_cn,$p_jrn,$p_peri
// Set correctly the REQUEST param for jrn_type
$h=new widget('hidden');
$h->name='jrn_type';
$h->value=$_REQUEST['jrn_type'];
$h->value='ACH';
$r.=$h->IOValue();
// Record the current number of article
@ -569,8 +587,24 @@ function FormAchView ($p_cn,$p_jrn,$p_periode,$p_array,$p_submit,$p_number,$p_pi
$r.="</DIV>";
// Compute href
$href=$_SERVER['SCRIPT_NAME'];
switch ($href)
{
// user_jrn.php
case '/user_jrn.php':
$href="user_jrn.php?action=new&p_jrn=$p_jrn";
break;
case '/commercial.php':
$href="commercial.php?p_action=depense&p_jrn=$p_jrn";
break;
default:
echo_error('user_form_ach.php',__LINE__,'Erreur invalid request uri');
exit (-1);
}
$r.='<FORM METHOD="POST" enctype="multipart/form-data" ACTION="user_jrn.php?action=new&p_jrn='.$p_jrn.'">';
// $r.='<FORM METHOD="POST" enctype="multipart/form-data" ACTION="user_jrn.php?action=new&p_jrn='.$p_jrn.'">';
$r.='<FORM METHOD="POST" enctype="multipart/form-data" ACTION="'.$href.'">';
// check for upload piece
// Set correctly the REQUEST param for jrn_type
$h=new widget('hidden');
@ -798,7 +832,7 @@ function RecordSell($p_cn,$p_array,$p_user,$p_jrn)
Commit($p_cn);
return $comment;
return array($internal,$comment);
}
?>

View file

@ -247,7 +247,7 @@ function FormVenInput($p_cn,$p_jrn,$p_periode,$p_array=null,$pview_only=true,$p_
// Set correctly the REQUEST param for jrn_type
$h=new widget('hidden');
$h->name='jrn_type';
$h->value=$_REQUEST['jrn_type'];
$h->value='VEN';
$r.=$h->IOValue();
if ($pview_only == false ) {

View file

@ -266,13 +266,13 @@ function ShowMenuJrnUser($p_dossier,$p_type,$p_jrn,$p_extra="")
where
uj_login='".$User->id."'
and uj_priv !='X'
and jrn_def_type='$p_type'
and jrn_def_type='$p_type' order by jrn_Def_id
");
} else {
$Ret=ExecSql($Cn,"select jrn_def_id,jrn_def_type,jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_deb_max_line,jrn_cred_max_line,
jrn_type_id,jrn_desc,'W' as uj_priv
from jrn_def join jrn_type on jrn_def_type=jrn_type_id where
jrn_def_type='$p_type'");
jrn_def_type='$p_type' order by jrn_Def_id");
}
$Max=pg_NumRows($Ret);
@ -297,7 +297,7 @@ function ShowMenuJrnUser($p_dossier,$p_type,$p_jrn,$p_extra="")
// p_action=facture
if ( $href=="/commercial.php" )
{
$add="&p_action=facture";
$add='&p_action='.$_REQUEST['p_action'];
}
echo '<TD class="cell">';
printf ('<A class="mtitle" HREF="%s?jrn_type=%s&p_jrn=%s%s">%s</A></TD>',