Predefined operation

This commit is contained in:
sparkyx 2007-09-18 19:29:43 +00:00
parent 4efe0a4e3a
commit 3ba3ca02c6
16 changed files with 423 additions and 134 deletions

View file

@ -25,6 +25,8 @@ require_once("class_document.php");
require_once("class_fiche.php");
require_once("class_parm_code.php");
require_once("check_priv.php");
require_once ('class_pre_op_fin.php');
/*!\file
* \brief the purpose off this file encode expense and to record them
*
@ -59,6 +61,7 @@ if ( isset ($_REQUEST['url']))
}
$sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"";
//----------------------------------------------------------------------
// ask the saldo of the bank
if ( $sub_action == "solde" )
@ -218,6 +221,26 @@ echo ShowMenuJrnUser($gDossier,'FIN',$p_jrn,
'<td class="cell"><A class="mtitle" HREF="commercial.php?liste&p_action=bank&sa=list&'.dossier::get().'">Liste</A></td>'.
'<td class="cell"><A class="mtitle" HREF="commercial.php?liste&p_action=bank&sa=solde&'.dossier::get().'">Solde</A></td>');
echo '</div>';
//--------------------------------------------------------------------------------
// use a predefined operation
//--------------------------------------------------------------------------------
if ( $sub_action=="use_opd" ) {
$op=new Pre_op_fin($cn);
$op->set_od_id($_REQUEST['pre_def']);
$p_post=$op->compute_array();
echo_debug(__FILE__.':'.__LINE__.'- ','p_post = ',$p_post);
// submit button in the form
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article">'.
'<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Enregistrer">';
$form=FormFin($cn,$_GET['p_jrn'],$User->GetPeriode(),$submit,$p_post,false,$p_post['nb_item']);
echo '<div class="u_redcontent">';
echo $form;
echo '</div>';
exit();
}
//-----------------------------------------------------
// if we request to add an item
// the $_POST['add_item'] is set
@ -321,6 +344,21 @@ if ( $p_jrn != -1 )
$form=FormFin($cn,$p_jrn,$User->GetPeriode(),$submit,null,false,$jrn->GetDefLine('deb'));
echo '<div class="u_redcontent">';
echo $form;
echo '<form method="GET">';
$op=new Pre_operation($cn);
$op->p_jrn=$p_jrn;
$hid=new widget("hidden");
echo $hid->IOValue("p_action","bank");
echo $hid->IOValue("sa","use_opd");
echo dossier::hidden();
echo $hid->IOValue("p_jrn",$p_jrn);
echo $hid->IOValue("jrn_type","FIN");
echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
echo $op->show_button();
echo '</form>';
echo JS_CALC_LINE;
echo '</div>';
}

View file

@ -35,13 +35,9 @@ require_once ('header_print.php');
class balance_ca_bs extends print_ca {
/*!
* \brief
* \param
* \param
* \param
*
* \brief load the data from the database
*
* \return
* \return array
*/
function get_data()
{
@ -80,6 +76,13 @@ class balance_ca_bs extends print_ca {
}
/*!
* \brief Set the filter (account_date)
*
* \return return the string to add to get_data
*/
function set_sql_filter() {
$sql="";
$and="";
@ -103,10 +106,7 @@ class balance_ca_bs extends print_ca {
}
/*!
* \brief
* \param
* \param
* \param
* \brief compute the html display
*
*
* \return string
@ -143,13 +143,11 @@ class balance_ca_bs extends print_ca {
return $r;
}
/*!
* \brief
* \param
* \param
* \param
*
* \brief Compute the form to display
* \param $p_hidden hidden tag to be included (gDossier,...)
*
* \return
*
* \return string containing the data
*/
function display_form($p_string="") {
$r=parent::display_form($p_string);
@ -206,13 +204,8 @@ class balance_ca_bs extends print_ca {
$pdf->ezStream();
}
/*!
* \brief
* \param
* \param
* \param
*
*
* \return
* \brief Compute the csv export
* \return string with the csv
*/
function display_csv()
{
@ -238,13 +231,13 @@ class balance_ca_bs extends print_ca {
}
/*!
* \brief
* \param
* \param
* \param
* \brief Show the button to export in PDF or CSV
* \param $url_csv url of the csv
* \param $url_pdf url of the pdf
* \param $p_string hidden data to include in the form
*
*
* \return
* \return string with the button
*/
function show_button($url_csv,$url_pdf,$p_string="")
{

View file

@ -30,11 +30,7 @@ require_once ('class_plananalytic.php');
require_once ('class_print_ca.php');
require_once ('class_operation.php');
/*!
* \brief
* \param
* \param
* \param
*
* \brief manage the CA listing
*
* \return
*/
@ -48,10 +44,21 @@ class list_ca extends print_ca {
return $r;
}
/*!
* \brief complete the object with the data in $_REQUEST
*/
function get_request() {
parent::get_request();
$this->pa_id=(isset($_REQUEST['pa_id']))?$_REQUEST['pa_id']:"";
}
/*!
* \brief compute the html display
*
*
* \return string
*/
function display_html() {
$r="";
//---Html
@ -84,13 +91,9 @@ class list_ca extends print_ca {
return $r;
}
/*!
* \brief
* \param
* \param
* \param
*
* \brief load the data from the database
*
* \return
* \return array
*/
function get_data()
{
@ -99,6 +102,11 @@ class list_ca extends print_ca {
$array=$op->get_list($this->from,$this->to,$this->from_poste,$this->to_poste);
return $array;
}
/*!
* \brief Compute the csv export
* \return string with the csv
*/
function display_csv()
{
$array=$this->get_data($this->from,$this->to,$this->from_poste,$this->to_poste);

View file

@ -49,13 +49,7 @@ class print_ca {
}
/*!
* \brief
* \param
* \param
* \param
*
*
* \return
* \brief complete the object with the data in $_REQUEST
*/
function get_request() {
if ( isset($_REQUEST['from']))
@ -76,13 +70,11 @@ class print_ca {
}
/*!
* \brief
* \param
* \param
* \param
*
* \brief Compute the form to display
* \param $p_hidden hidden tag to be included (gDossier,...)
*
* \return
*
* \return string containing the data
*/
function display_form($p_hidden="") {
$from=new widget ('js_date','from','from');

View file

@ -619,6 +619,10 @@ class widget {
function Submit ($p_name,$p_value) {
return '<INPUT TYPE="SUBMIT" NAME="'.$p_name.'" VALUE="'.$p_value.'">';
}
static function submit_button ($p_name,$p_value) {
return '<INPUT TYPE="SUBMIT" NAME="'.$p_name.'" VALUE="'.$p_value.'">';
}
function Reset ($p_value) {
return '<INPUT TYPE="SUBMIT" VALUE="'.$p_value.'">';
}

View file

@ -24,6 +24,7 @@ require_once('jrn.php');
require_once("class_document.php");
require_once("class_fiche.php");
require_once("check_priv.php");
require_once ('class_pre_op_ach.php');
/*!\brief the purpose off this file encode expense and to record them
*
*/
@ -52,6 +53,27 @@ if ( isset ($_REQUEST['url']))
}
$sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"";
//--------------------------------------------------------------------------------
// use a predefined operation
//--------------------------------------------------------------------------------
if ( $sub_action=="use_opd" ) {
$op=new Pre_op_ach($cn);
$op->set_od_id($_REQUEST['pre_def']);
$p_post=$op->compute_array();
echo_debug(__FILE__.':'.__LINE__.'- ','p_post = ',$p_post);
// Submit button in the form
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article">
<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Enregistrer" ID="SubmitButton">';
$form=FormAchInput($cn,$_GET['p_jrn'],$User->GetPeriode(),$p_post,$submit,false,$p_post['nb_item']);
// $form=FormAchInput($cn,$p_jrn,$User->GetPeriode(),$_POST,$submit,false,$nb_item);
echo '<div class="u_redcontent">';
echo $form;
echo '</div>';
exit();
}
//-----------------------------------------------------
// If a list of depense is asked
//
@ -232,7 +254,7 @@ if ( isset($_POST['save']))
echo $form;
echo '<hr>';
echo '</form>';
echo '<A class="mtitle" href="commercial.php?p_action=depense&p_jrn='.$p_jrn.'">
echo '<A class="mtitle" href="commercial.php?p_action=depense&p_jrn='.$p_jrn.'&'.dossier::get().'">
<input type="button" Value="Autre dépense"></A>';
exit();
}
@ -300,6 +322,22 @@ if ( $p_jrn != -1 )
echo '<div class="u_redcontent">';
echo $form;
echo $msg_tva;
//--------------------
// predef op.
echo '<form method="GET">';
$op=new Pre_operation($cn);
$op->p_jrn=$p_jrn;
$hid=new widget("hidden");
echo $hid->IOValue("p_action","depense");
echo dossier::hidden();
echo $hid->IOValue("p_jrn",$p_jrn);
echo $hid->IOValue("jrn_type","ACH");
echo $hid->IOValue("sa","use_opd");
echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
echo $op->show_button();
echo '</form>';
echo JS_CALC_LINE;
echo '</div>';

View file

@ -179,6 +179,21 @@ echo $w->Submit('gl_submit','Rechercher');
echo '<div class="u_subtmenu">';
echo ShowMenuJrnUser($gDossier,'VEN',$p_jrn,'<td class="cell"><A class="mtitle" HREF="commercial.php?liste&p_action=facture&sa=list&'.$str_dossier.'">Liste</A></td>');
echo '</div>';
//--------------------------------------------------------------------------------
// use a predefined operation
//--------------------------------------------------------------------------------
if ( $sub_action=="use_opd" ) {
$op=new Pre_op_ven($cn);
$op->set_od_id($_REQUEST['pre_def']);
$p_post=$op->compute_array();
echo_debug(__FILE__.':'.__LINE__.'- ','p_post = ',$p_post);
$form=FormVenInput($cn,$_GET['p_jrn'],$User->GetPeriode(),$p_post,false,$p_post['nb_item']);
echo '<div class="u_redcontent">';
echo $form;
echo '</div>';
exit();
}
//-----------------------------------------------------
// if we request to add an item
// the $_POST['add_item'] is set
@ -208,7 +223,7 @@ if ( isset($_POST['record_and_print_invoice']))
NoAccess();
exit -1;
}
$nb_number=$_POST['nb_item'];
// First we save the invoice, the internal code will be used to change the description
// and upload the file
if ( form_verify_input($cn,$p_jrn,$User->GetPeriode(),$_POST,$nb_number)== true) {
@ -245,8 +260,8 @@ if ( isset($_POST['record_and_print_invoice']))
echo '</form>';
// Button return
printf ('<A class="mtitle" href="?jrn_type=VEN&p_jrn=%d&p_action=facture"><input type="Button" value="Autre Facture"></A>',
$p_jrn);
printf ('<A class="mtitle" href="?jrn_type=VEN&p_jrn=%d&p_action=facture&%s"><input type="Button" value="Autre Facture"></A>',
$p_jrn,dossier::get());
exit();
}
//-----------------------------------------------------
@ -294,4 +309,21 @@ if ( $p_jrn != -1 )
echo '<div class="u_redcontent">';
echo $form;
echo '</div>';
//--------------------
// predef op.
echo '<form method="GET">';
$op=new Pre_operation($cn);
$op->p_jrn=$p_jrn;
$hid=new widget("hidden");
echo $hid->IOValue("p_action","facture");
echo dossier::hidden();
echo $hid->IOValue("p_jrn",$p_jrn);
echo $hid->IOValue("jrn_type","VEN");
echo $hid->IOValue("sa","use_opd");
echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
echo $op->show_button();
echo '</form>';
}

View file

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* $Revision$ */
include_once("class_widget.php");
require_once ('class_bilan.php');
/*! \file
* \brief form who call the printing of the bilan in RTF
* file included by user_impress
@ -29,34 +29,18 @@ include_once("class_widget.php");
// Show the jrn and date
//-----------------------------------------------------
include_once("postgres.php");
$ret=make_array($cn,"select fr_id,fr_label
/*$ret=make_array($cn,"select fr_id,fr_label
from formdef
order by fr_label");
*/
//-----------------------------------------------------
// Form
//-----------------------------------------------------
$w=new widget("select");
$w->table=1;
echo '<div class="u_redcontent">';
echo '<FORM ACTION="bilan.php" METHOD="POST">';
echo dossier::hidden();
echo '<TABLE>';
print '<TR>';
// filter on the current year
$filter_year=" where p_exercice='".$User->getExercice()."'";
$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
$w->label="Depuis";
print $w->IOValue('from_periode',$periode_start);
$w->label=" jusqu'à ";
$periode_end=make_array($cn,"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
print $w->IOValue('to_periode',$periode_end);
print "</TR>";
echo '</TABLE>';
print $w->Submit('bt_rtf','Impression');
$bilan=new Bilan($cn);
echo '<div class="u_redcontent">';
echo '<FORM ACTION="bilan.php" METHOD="GET">';
echo $bilan->display_form ($filter_year);
echo '</FORM>';
echo '</div>';
?>

View file

@ -31,11 +31,28 @@ $cn=DbConnect($gDossier);
$msg_tva='<i>Si le montant de TVA est &eacute;gal &agrave; 0, il sera automatiquement calcul&eacute;</i>';
if ( ! isset ($_GET['action']) && ! isset ($_POST["action"]) ) {
if ( ! isset ($_REQUEST['action'])){
exit;
}
$action=(isset($_GET['action']))?$_GET['action']:$_POST['action'];
$action=$_REQUEST['action'];
//--------------------------------------------------------------------------------
// use a predefined operation
//--------------------------------------------------------------------------------
if ( $action=="use_opd" ) {
$op=new Pre_op_ach($cn);
$op->set_od_id($_REQUEST['pre_def']);
$p_post=$op->compute_array();
echo_debug(__FILE__.':'.__LINE__.'- ','p_post = ',$p_post);
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article">
<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Enregistrer" ID="SubmitButton">';
$form=FormAchInput($cn,$_GET['p_jrn'],$User->GetPeriode(),$p_post,$submit,false,$p_post['nb_item']);
echo '<div class="u_redcontent">';
echo $form;
echo '</div>';
exit();
}
// action = new
if ( $action == 'new' ) {
@ -46,18 +63,39 @@ if ( $action == 'new' ) {
exit -1;
}
if ( isset($_GET['blank'] )) {
// Submit button in the form
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article">
if ( isset($_GET['blank'] )) {
// Submit button in the form
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article">
<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Enregistrer" ID="SubmitButton">';
$jrn=new jrn($cn, $_GET['p_jrn']);
$r=FormAchInput($cn,$_GET['p_jrn'],$User->GetPeriode(),$_POST,$submit,false,$jrn->getDefLine());
echo '<div class="u_redcontent">';
echo $r;
echo $msg_tva;
echo "<div>".JS_CALC_LINE."<div>";
echo "</div>";
$jrn=new jrn($cn, $_GET['p_jrn']);
$r=FormAchInput($cn,$_GET['p_jrn'],$User->GetPeriode(),$_POST,$submit,false,$jrn->getDefLine());
//--------------------
// predef op.
$op=new Pre_operation($cn);
$op->p_jrn=$_GET['p_jrn'];
echo '<div class="u_redcontent">';
echo $r;
echo $msg_tva;
//--------------------
// predef op.
echo '<form method="GET">';
$op=new Pre_operation($cn);
$op->p_jrn=$_GET['p_jrn'];
$hid=new widget("hidden");
echo $hid->IOValue("action","use_opd");
echo dossier::hidden();
echo $hid->IOValue("p_jrn",$_GET['p_jrn']);
echo $hid->IOValue("jrn_type","ACH");
echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
echo $op->show_button();
echo '</form>';
echo "<div>".JS_CALC_LINE."</div>";
echo "</div>";
}

View file

@ -28,6 +28,8 @@ require_once("user_form_fin.php");
include_once("class_widget.php");
require_once("class_parm_code.php");
require_once("class_jrn.php");
require_once ('class_pre_op_fin.php');
$cn=DbConnect($gDossier);
if ( ! isset ($_GET['action']) && ! isset ($_POST["action"]) ) {
@ -37,6 +39,25 @@ include_once ("preference.php");
include_once ("user_common.php");
$action=(isset($_GET['action']))?$_GET['action']:$_POST['action'];
//--------------------------------------------------------------------------------
// use a predefined operation
//--------------------------------------------------------------------------------
if ( $action=="use_opd" ) {
$op=new Pre_op_fin($cn);
$op->set_od_id($_REQUEST['pre_def']);
$p_post=$op->compute_array();
echo_debug(__FILE__.':'.__LINE__.'- ','p_post = ',$p_post);
// submit button in the form
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article">'.
'<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Enregistrer">';
$form=FormFin($cn,$_GET['p_jrn'],$User->GetPeriode(),$submit,$p_post,false,$p_post['nb_item']);
echo '<div class="u_redcontent">';
echo $form;
echo '</div>';
exit();
}
//-----------------------------------------------------
// action = new
//-----------------------------------------------------
@ -59,7 +80,24 @@ if ( $action == 'new' ) {
$r=FormFin($cn,$p_jrn,$User->GetPeriode(),$submit,null,false,$jrn->GetDefLine());
echo '<div class="u_redcontent">';
echo $r;
echo "<div><h4>On-line calculator</h4>".JS_CALC_LINE."</div>";
echo "<div>";
//--------------------
// predef op.
echo '<form method="GET">';
$op=new Pre_operation($cn);
$op->p_jrn=$_GET['p_jrn'];
$hid=new widget("hidden");
echo $hid->IOValue("action","use_opd");
echo dossier::hidden();
echo $hid->IOValue("p_jrn",$_GET['p_jrn']);
echo $hid->IOValue("jrn_type","FIN");
echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
echo $op->show_button();
echo '</form>';
echo "<h4>On-line calculator</h4>".JS_CALC_LINE."</div>";
echo "</div>";

View file

@ -26,6 +26,9 @@ echo_debug('user_action_ods.php',__LINE__,"include user_action_ods.php");
include_once("user_form_ods.php");
include_once("class_widget.php");
require_once('class_dossier.php');
require_once ('class_pre_operation.php');
require_once ('class_pre_op_ods.php');
$gDossier=dossier::id();
$cn=DbConnect($gDossier);
@ -39,12 +42,31 @@ include_once ("user_common.php");
$action=(isset($_GET['action']))?$_GET['action']:$_POST['action'];
//--------------------------------------------------------------------------------
// use a predefined operation
//--------------------------------------------------------------------------------
if ( $action=="use_opd" ) {
$op=new Pre_op_ods($cn);
$op->set_od_id($_REQUEST['pre_def']);
$p_post=$op->compute_array();
echo_debug(__FILE__.':'.__LINE__.'- ','p_post = ',$p_post);
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout poste">'.
'<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Confirmer">';
// $form=FormVenInput($cn,$_GET['p_jrn'],$User->GetPeriode(),$p_post,false,$p_post['nb_item']);
$form=FormODS($cn,$_REQUEST['p_jrn'],$User->GetPeriode(),$submit,$p_post,false,$p_post['nb_item']);
echo '<div class="u_redcontent">';
echo $form;
echo '</div>';
exit();
}
// action = new
if ( $action == 'new' ) {
// Check privilege
if ( CheckJrn($gDossier,$_SESSION['g_user'],$_GET['p_jrn']) != 2 ) {
if ( CheckJrn($gDossier,$_SESSION['g_user'],$_REQUEST['p_jrn']) != 2 ) {
NoAccess();
exit -1;
}
@ -56,12 +78,29 @@ if ( $action == 'new' ) {
// add a one-line calculator
$prop=GetJrnProp($gDossier,$_GET['p_jrn']);
$line=$prop['jrn_deb_max_line'];
$r=FormODS($cn,$_GET['p_jrn'],$User->GetPeriode(),$submit,null,false,$line);
$r=FormODS($cn,$_REQUEST['p_jrn'],$User->GetPeriode(),$submit,null,false,$line);
echo '<div class="u_redcontent">';
echo $r;
echo "<div><h4>On-line calculator</h4>".JS_CALC_LINE."<div>";
echo "<div>";
//--------------------
// predef op.
echo '<form method="GET">';
$op=new Pre_operation($cn);
$op->p_jrn=$_GET['p_jrn'];
$hid=new widget("hidden");
echo $hid->IOValue("action","use_opd");
echo dossier::hidden();
echo $hid->IOValue("p_jrn",$_GET['p_jrn']);
echo $hid->IOValue("jrn_type","ODS");
echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
echo $op->show_button();
echo '</form>';
echo "<h4>On-line calculator</h4>".JS_CALC_LINE."<div>";
echo "</div>";
}
@ -75,7 +114,7 @@ if ( $action == 'new' ) {
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout Poste">
<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Enregistrer">';
$r=FormODS($cn,$_GET['p_jrn'],$User->GetPeriode(),$submit,$_POST,false, $nb_number);
$r=FormODS($cn,$_POST['p_jrn'],$User->GetPeriode(),$submit,$_POST,false, $nb_number);
echo '<div class="u_redcontent">';
echo $r;
echo "<div><h4>On-line calculator</h4>".JS_CALC_LINE."<div>";
@ -90,7 +129,7 @@ if ( $action == 'new' ) {
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout Poste">
<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Enregistrer">';
$r=FormODS($cn,$_GET['p_jrn'],$User->GetPeriode(),$submit,$_POST,false, $nb_number);
$r=FormODS($cn,$_POST['p_jrn'],$User->GetPeriode(),$submit,$_POST,false, $nb_number);
echo '<div class="u_redcontent">';
echo $r;
echo "<div><h4>On-line calculator</h4>".JS_CALC_LINE."<div>";
@ -107,7 +146,7 @@ if ( $action == 'new' ) {
$submit.='<input type="button" value="verifie CA" onClick="verify_ca(\'ok\');">';
$submit.='<INPUT TYPE="SUBMIT" name="correct" value="Corriger">';
$r=FormODS($cn,$_GET['p_jrn'],$User->GetPeriode(),$submit,$_POST,true,$nb_number);
$r=FormODS($cn,$_POST['p_jrn'],$User->GetPeriode(),$submit,$_POST,true,$nb_number);
// if something goes wrong, correct it
if ( $r == null ) {
@ -115,7 +154,7 @@ if ( $action == 'new' ) {
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout Poste">
<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Enregistrer">';
$r=FormODS($cn,$_GET['p_jrn'],$User->GetPeriode(),$submit,$_POST,false, $nb_number);
$r=FormODS($cn,$_POST['p_jrn'],$User->GetPeriode(),$submit,$_POST,false, $nb_number);
}else {
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout Poste">
<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Enregistrer">';
@ -129,21 +168,21 @@ if ( $action == 'new' ) {
}
// Save the change into database
if ( isset($_POST['save'] )) {
$r=RecordODS($cn,$_POST,$User,$_GET['p_jrn']);
$r=RecordODS($cn,$_POST,$User,$_POST['p_jrn']);
// Get number of lines
$nb_number=$_POST["nb_item"];
if ( $r != null ) {
// submit button in the form
$submit='<h2 class="info">Recorded'.$r.'</h2>';
$r.=FormODS($cn,$_GET['p_jrn'],$User->GetPeriode(),$submit,$_POST,true, $nb_number,true);
$r.=FormODS($cn,$_POST['p_jrn'],$User->GetPeriode(),$submit,$_POST,true, $nb_number,true);
}else {
// CA incorrecte
$submit='<INPUT TYPE="SUBMIT" name="save" value="Confirmer" onClick="return verify_ca(\'error\');">';
$submit.='<input type="button" value="verifie CA" onClick="verify_ca(\'ok\');">';
$submit.='<INPUT TYPE="SUBMIT" name="correct" value="Corriger">';
$r=FormODS($cn,$_GET['p_jrn'],$User->GetPeriode(),$submit,$_POST,true,$nb_number);
$r=FormODS($cn,$_POST['p_jrn'],$User->GetPeriode(),$submit,$_POST,true,$nb_number);
}
echo '<div class="u_redcontent">';
@ -156,7 +195,7 @@ if ( $action == 'new' ) {
}
if ( $action == 'voir_jrn' ) {
// Check privilege
if ( CheckJrn($gDossier,$_SESSION['g_user'],$_GET['p_jrn']) < 1 ) {
if ( CheckJrn($gDossier,$_SESSION['g_user'],$_POST['p_jrn']) < 1 ) {
NoAccess();
exit -1;
}

View file

@ -29,22 +29,35 @@ include_once("class_widget.php");
require_once("class_jrn.php");
require_once('class_dossier.php');
$gDossier=dossier::id();
if ( CheckJrn($gDossier,$_SESSION['g_user'],$_GET['p_jrn']) != 2 ) {
NoAccess();
exit -1;
}
$cn=DbConnect($gDossier);
// default action is insert_vente
if ( ! isset ($_GET['action']) && ! isset ($_POST["action"]) ) {
if ( ! isset ($_REQUEST['action'])) {
exit;
} else {
$action=(isset($_GET['action']))?$_GET['action']:$_POST['action'];
$action=$_REQUEST['action'];
$blank=(isset($_GET["blank"]))?1:0;
}
//--------------------------------------------------------------------------------
// use a predefined operation
//--------------------------------------------------------------------------------
if ( $action=="use_opd" ) {
$op=new Pre_op_ven($cn);
$op->set_od_id($_REQUEST['pre_def']);
$p_post=$op->compute_array();
echo_debug(__FILE__.':'.__LINE__.'- ','p_post = ',$p_post);
$form=FormVenInput($cn,$_GET['p_jrn'],$User->GetPeriode(),$p_post,false,$p_post['nb_item']);
echo '<div class="u_redcontent">';
echo $form;
echo '</div>';
exit();
}
if ( $action == 'insert_vente' ) {
if ( CheckJrn($gDossier,$_SESSION['g_user'],$_GET['p_jrn']) != 2 ) {
NoAccess();
exit -1;
}
// Add item
if (isset($_POST["add_item"]) ) {
@ -85,6 +98,21 @@ if ( $action == 'insert_vente' ) {
$form=FormVenInput($cn,$_GET['p_jrn'],$User->GetPeriode(),null,false,$jrn->GetDefLine());
echo '<div class="u_redcontent">';
echo $form;
//--------------------
// predef op.
echo '<form method="GET">';
$op=new Pre_operation($cn);
$op->p_jrn=$_GET['p_jrn'];
$hid=new widget("hidden");
echo $hid->IOValue("action","use_opd");
echo dossier::hidden();
echo $hid->IOValue("p_jrn",$_GET['p_jrn']);
echo $hid->IOValue("jrn_type","VEN");
echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
echo $op->show_button();
echo '</form>';
echo '</div>';
}
@ -124,7 +152,7 @@ if ( isset($_POST["record_and_print_invoice"])) {
}
$nb_number=$_POST["nb_item"];
echo_debug(__FILE__.':'.__LINE__.'- record_and_print_invoice');
if ( form_verify_input($cn,$p_jrn,$User->GetPeriode(),$_POST,$nb_number)== true) {
$comment=RecordInvoice($cn,$_POST,$User,$_GET['p_jrn']);

View file

@ -23,6 +23,8 @@ require_once("constant.php");
require_once("preference.php");
require_once("fiche_inc.php");
require_once("user_common.php");
require_once ('class_pre_operation.php');
/*! \file
* \brief Functions for the financial ledger
*/
@ -173,6 +175,9 @@ function FormFin($p_cn,$p_jrn,$p_periode,$p_submit,$p_array=null,$pview_only=tru
$r.="<FORM NAME=\"form_detail\" enctype=\"multipart/form-data\" ACTION=\"$href\" METHOD=\"POST\">";
$r.=dossier::hidden();
$hid=new widget('hidden');
$r.=$hid->IOValue('p_jrn',$p_jrn);
$r.='<TABLE>';
$Date=new widget("js_date");
$Date->SetReadOnly($pview_only);
@ -300,6 +305,11 @@ $r.="</TABLE>";
$r.="<TR>".$file->IOValue("pj","","Pi&egrave;ce justificative")."</TR>";
$r.="</table>";
$r.="<hr>";
$chk=new widget('checkbox');
$chk->selected=true;
$r.="Sauvez l'op&eacute;ration ?";
$r.=$chk->IOValue('opd_save');
}
// Set correctly the REQUEST param for jrn_type
$h=new widget('hidden');
@ -434,8 +444,18 @@ function RecordFin($p_cn,$p_array,$p_user,$p_jrn) {
"jr_pj_type='".$_FILES['pj']['type']."' where jr_grpt_id=$seq");
}
}
} // for nbitem
// Save pre_operatoin
// Save the operation
if ( isset($_POST['opd_save']) && $_POST['opd_save']=='on' ){
echo_debug(__FILE__.':'.__LINE__.'- ','save opd');
$opd=new Pre_op_fin($p_cn);
$opd->get_post();
$opd->save();
echo_debug(__FILE__.':'.__LINE__.'- ',"opd = ",$opd);
}
}
catch (Exception $e)
{

View file

@ -28,6 +28,7 @@ require_once("user_common.php");
require_once ('class_plananalytic.php');
require_once ('class_own.php');
require_once ('class_operation.php');
require_once ('class_pre_op_ods.php');
/*! \file
* \brief Functions for the ledger of misc. operation
*/
@ -83,7 +84,15 @@ function FormODS($p_cn,$p_jrn,$p_periode,$p_submit,$p_array=null,$pview_only=tru
$r.=JS_COMPUTE_ODS;
}
$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=\"user_jrn.php\"?action=new&p_jrn=$p_jrn\"
//METHOD=\"POST\">";
$r.="<FORM NAME=\"form_detail\" enctype=\"multipart/form-data\"".
" ACTION=\"user_jrn.php\" METHOD=\"POST\">";
$hid=new widget('hidden');
$r.=$hid->IOValue('p_jrn',$p_jrn);
$r.=$hid->IOValue('action','new');
$r.=dossier::hidden();
$r.='<TABLE>';
// Date
@ -217,6 +226,12 @@ function FormODS($p_cn,$p_jrn,$p_periode,$p_submit,$p_array=null,$pview_only=tru
$r.="</TABLE>";
if ( $pview_only==true && $p_saved==false) {
// pre_operation
$chk=new widget('checkbox');
$chk->selected=true;
$r.="Sauvez l'op&eacute;ration ?";
$r.=$chk->IOValue('opd_save');
// check for upload piece
$file=new widget("file");
$file->table=1;
@ -394,7 +409,16 @@ function RecordODS($p_cn,$p_array,$p_user,$p_jrn)
$Res=ExecSql($p_cn,"update jrn set jr_comment='".$internal."' where jr_grpt_id=".$seq);
}
if ( isset ($_FILES))
save_upload_document($p_cn,$seq);
save_upload_document($p_cn,$seq);
// Save the operation
if ( isset($_POST['opd_save']) && $_POST['opd_save']=='on' ){
echo_debug(__FILE__.':'.__LINE__.'- ','save opd');
$opd=new Pre_op_ods($p_cn);
$opd->get_post();
$opd->save();
echo_debug(__FILE__.':'.__LINE__.'- ',"opd = ",$opd);
}
}
catch (Exception $e)
{

View file

@ -29,6 +29,7 @@ require_once("user_common.php");
require_once ("class_own.php");
require_once ("class_plananalytic.php");
require_once ('class_operation.php');
require_once ('class_pre_op_ven.php');
/*! FormVenInput
* \brief Display the form for a sell
* Used to show detail, encode a new invoice
@ -428,7 +429,7 @@ function form_verify_input($p_cn,$p_jrn,$p_periode,$p_array,$p_number)
* \param p_periode
* \param array of value
* \param nb of item
* \param p_doc type pdf or html
* \param p_doc type form for a form
* \return string
*
*/
@ -590,8 +591,11 @@ function FormVenteView ($p_cn,$p_jrn,$p_periode,$p_array,$p_number,$p_doc='form'
$r.="</DIV>";
if ( $p_doc == 'form' ) {
// Propose to save
$chk=new widget('checkbox');
$chk->selected=true;
$r.="Sauvez l'op&eacute;ration ?";
$r.=$chk->IOValue('opd_save');
// check for upload piece
@ -610,21 +614,21 @@ function FormVenteView ($p_cn,$p_jrn,$p_periode,$p_array,$p_number,$p_doc='form'
if ( basename($_SERVER['PHP_SELF']) == 'commercial.php')
{
// if a template exists propose to choose an invoice template
if ( CountSql($p_cn,
"select md_id,md_name from document_modele where md_type=4") > 0 )
{
$r.='G&eacute;n&eacute;rer une facture <input type="checkbox" name="gen_invoice" CHECKED>';
// We propose to generate the invoice and some template
$doc_gen=new widget("select");
$doc_gen->name="gen_doc";
$doc_gen->value=make_array($p_cn,
"select md_id,md_name from document_modele where md_type=4");
$r.=$doc_gen->IOValue();
$r.="<hr>";
if ( CountSql($p_cn,
"select md_id,md_name from document_modele where md_type=4") > 0 )
{
$r.='G&eacute;n&eacute;rer une facture <input type="checkbox" name="gen_invoice" CHECKED>';
// We propose to generate the invoice and some template
$doc_gen=new widget("select");
$doc_gen->name="gen_doc";
$doc_gen->value=make_array($p_cn,
"select md_id,md_name from document_modele where md_type=4");
$r.=$doc_gen->IOValue();
$r.="<hr>";
}
}
}
$r.=$data;
if ( $sum_with_vat != 0 ) {
@ -823,6 +827,14 @@ function RecordInvoice($p_cn,$p_array,$p_user,$p_jrn)
$vat_code=$a_vat[$i];
}
}
// Save the operation
if ( isset($_POST['opd_save']) && $_POST['opd_save']=='on' ){
echo_debug(__FILE__.':'.__LINE__.'- ','save opd');
$opd=new Pre_op_ven($p_cn);
$opd->get_post();
$opd->save();
echo_debug(__FILE__.':'.__LINE__.'- ',"opd = ",$opd);
}
}//try
catch (Exception $e)
{

View file

@ -538,6 +538,8 @@ function ShowMenuAdvanced($default="") {
$left_menu=ShowItem(array(
//('rapprt.php','Rapprochement'),
array('jrn_update.php?'.$str_dossier,'Journaux',"Gestion des journaux",1),
array('user_advanced.php?'.$str_dossier.'&p_action=preod','Ecritures sauvees',"",9),
array('user_advanced.php?p_action=periode&'.$str_dossier,'Periode',"Gestion des periodes",2),
array('central.php?'.$str_dossier,'Centralise',"Centralisation",3),
array('pcmn_update.php?p_start=1&'.$str_dossier,'Plan Comptable',"Gestion Plan Comptable",4),
@ -545,7 +547,6 @@ function ShowMenuAdvanced($default="") {
array('form.php?'.$str_dossier,'Rapport',"Rapport",6),
array('import.php?'.$str_dossier,'Import Banque',"Banque",7),
array('ecrit_ouv.php?'.$str_dossier,'Ecriture ouverture',"",8)
),
'H',"cell","mtitle",$default);
$r='<div class="u_subtmenu">'.$left_menu."</div>";