Add the quick / direct writing ability
This commit is contained in:
parent
15ce1362e9
commit
26afef570a
28 changed files with 656 additions and 122 deletions
|
|
@ -80,7 +80,7 @@ A.codeRef:visited { font-weight: normal; color: #0000FF}
|
|||
A:hover { text-decoration: none; background-color: #f2f2ff }
|
||||
DL.el { margin-left: -1cm }
|
||||
.fragment {
|
||||
font-family: sans-serif;
|
||||
font-family: monospace, fixed;
|
||||
font-size: 95%;
|
||||
}
|
||||
PRE.fragment {
|
||||
|
|
@ -96,14 +96,7 @@ PRE.fragment {
|
|||
padding-bottom: 4px;
|
||||
}
|
||||
DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px }
|
||||
TD.md { background-color: #F4F4FB; font-weight: bold; }
|
||||
TD.mdPrefix {
|
||||
background-color: #F4F4FB;
|
||||
color: #606060;
|
||||
font-size: 80%;
|
||||
}
|
||||
TD.mdname1 { background-color: #F4F4FB; font-weight: bold; color: #602020; }
|
||||
TD.mdname { background-color: #F4F4FB; font-weight: bold; color: #602020; width: 600px; }
|
||||
|
||||
DIV.groupHeader {
|
||||
margin-left: 16px;
|
||||
margin-top: 12px;
|
||||
|
|
@ -156,13 +149,6 @@ SPAN.comment { color: #800000 }
|
|||
SPAN.preprocessor { color: #806020 }
|
||||
SPAN.stringliteral { color: #002080 }
|
||||
SPAN.charliteral { color: #008080 }
|
||||
.mdTable {
|
||||
border: 1px solid #868686;
|
||||
background-color: #F4F4FB;
|
||||
}
|
||||
.mdRow {
|
||||
padding: 8px 10px;
|
||||
}
|
||||
.mdescLeft {
|
||||
padding: 0px 8px 4px 8px;
|
||||
font-size: 80%;
|
||||
|
|
@ -308,3 +294,65 @@ HR { height: 1px;
|
|||
border-top: 1px solid black;
|
||||
}
|
||||
|
||||
/* Style for detailed member documentation */
|
||||
.memtemplate {
|
||||
font-size: 80%;
|
||||
color: #606060;
|
||||
font-weight: normal;
|
||||
}
|
||||
.memnav {
|
||||
background-color: #e8eef2;
|
||||
border: 1px solid #84b0c7;
|
||||
text-align: center;
|
||||
margin: 2px;
|
||||
margin-right: 15px;
|
||||
padding: 2px;
|
||||
}
|
||||
.memitem {
|
||||
padding: 4px;
|
||||
background-color: #eef3f5;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #dedeee;
|
||||
-moz-border-radius: 8px 8px 8px 8px;
|
||||
}
|
||||
.memname {
|
||||
white-space: nowrap;
|
||||
font-weight: bold;
|
||||
}
|
||||
.memdoc{
|
||||
padding-left: 10px;
|
||||
}
|
||||
.memproto {
|
||||
background-color: #d5e1e8;
|
||||
width: 100%;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #84b0c7;
|
||||
font-weight: bold;
|
||||
-moz-border-radius: 8px 8px 8px 8px;
|
||||
}
|
||||
.paramkey {
|
||||
text-align: right;
|
||||
}
|
||||
.paramtype {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.paramname {
|
||||
color: #602020;
|
||||
font-style: italic;
|
||||
white-space: nowrap;
|
||||
}
|
||||
/* End Styling for detailed member documentation */
|
||||
|
||||
/* for the tree view */
|
||||
.ftvtree {
|
||||
font-family: sans-serif;
|
||||
margin:0.5em;
|
||||
}
|
||||
.directory { font-size: 9pt; font-weight: bold; }
|
||||
.directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; }
|
||||
.directory > h3 { margin-top: 0; }
|
||||
.directory p { margin: 0px; white-space: nowrap; }
|
||||
.directory div { display: none; margin: 0px; }
|
||||
.directory img { vertical-align: -30%; }
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ include_once ("user_menu.php");
|
|||
echo '<div class="u_tmenu">';
|
||||
$action=$_REQUEST['p_action'];
|
||||
echo ShowMenuCompta("user_advanced.php?".dossier::get());
|
||||
|
||||
echo '</div>';
|
||||
// Get action
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<?
|
||||
header("Content-type: text/xml charset=\"ISO8859-1\"",true);
|
||||
|
||||
include ("constant.php");
|
||||
include ("postgres.php");
|
||||
include("user_common.php");
|
||||
include("debug.php");
|
||||
require_once ("constant.php");
|
||||
require_once ("postgres.php");
|
||||
require_once ("user_common.php");
|
||||
require_once ("debug.php");
|
||||
require_once('class_dossier.php');
|
||||
$gDossier=dossier::id();
|
||||
|
||||
|
|
|
|||
|
|
@ -347,6 +347,8 @@ if ( $p_jrn != -1 )
|
|||
echo '<form method="GET">';
|
||||
$op=new Pre_operation($cn);
|
||||
$op->p_jrn=$p_jrn;
|
||||
$op->od_direct='f';
|
||||
|
||||
$hid=new widget("hidden");
|
||||
echo $hid->IOValue("p_action","bank");
|
||||
echo $hid->IOValue("sa","use_opd");
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ require_once ('class_acc_operation.php');
|
|||
require_once ('class_poste.php');
|
||||
require_once ('class_pre_op_advanced.php');
|
||||
require_once ('jrn.php');
|
||||
require_once ('class_acexception.php');
|
||||
|
||||
/*!\brief Class for jrn
|
||||
*
|
||||
*/
|
||||
|
|
@ -114,8 +116,8 @@ class Acc_Ledger {
|
|||
if ( $this->id != 0 ) {
|
||||
|
||||
if ( $cent=='off' ) {
|
||||
echo_debug('class_acc_ledger.php',__LINE__,"journaux non centralisé");
|
||||
// Journaux non centralisés
|
||||
echo_debug('class_acc_ledger.php',__LINE__,"journaux non centralisé");
|
||||
// Journaux non centralisés
|
||||
$Res=ExecSql($this->db,"select j_id,j_id as int_j_id,to_char(j_date,'DD.MM.YYYY') as j_date,
|
||||
jr_internal,
|
||||
case j_debit when 't' then j_montant::text else ' ' end as deb_montant,
|
||||
|
|
@ -131,8 +133,8 @@ class Acc_Ledger {
|
|||
" and ".$periode." order by j_date::date asc,jr_internal,j_debit desc ".
|
||||
$cond_limite);
|
||||
}else {
|
||||
// Journaux centralisés
|
||||
// echo'class_acc_ledger.php',__LINE__,"journaux centralisé";
|
||||
// Journaux centralisés
|
||||
// echo'class_acc_ledger.php',__LINE__,"journaux centralisé";
|
||||
$Sql="select jr_opid as j_id,
|
||||
c_order as int_j_id,
|
||||
to_char (c_date,'DD.MM.YYYY') as j_date ,
|
||||
|
|
@ -161,8 +163,8 @@ class Acc_Ledger {
|
|||
} else {
|
||||
// Grand Livre
|
||||
if ( $cent == 'off') {
|
||||
echo_debug('class_acc_ledger.php',__LINE__,"Grand livre non centralisé");
|
||||
// Non centralisé
|
||||
echo_debug('class_acc_ledger.php',__LINE__,"Grand livre non centralisé");
|
||||
// Non centralisé
|
||||
$Res=ExecSql($this->db,"select j_id,j_id as int_j_id,to_char(j_date,'DD.MM.YYYY') as j_date,
|
||||
jr_internal,
|
||||
case j_debit when 't' then j_montant::text else ' ' end as deb_montant,
|
||||
|
|
@ -178,8 +180,8 @@ class Acc_Ledger {
|
|||
$cond_limite);
|
||||
|
||||
} else {
|
||||
echo_debug('class_acc_ledger.php',__LINE__,"Grand livre centralisé");
|
||||
// Centralisé
|
||||
echo_debug('class_acc_ledger.php',__LINE__,"Grand livre centralisé");
|
||||
// Centralisé
|
||||
$Sql="select jr_c_opid as j_id,
|
||||
c_order as int_j_id,
|
||||
c_j_id,
|
||||
|
|
@ -321,7 +323,7 @@ class Acc_Ledger {
|
|||
// Non Centralise si cent=off
|
||||
//--
|
||||
if ($cent=='off')
|
||||
{// Non centralisé
|
||||
{// Non centralisé
|
||||
|
||||
$periode=sql_filter_per($this->db,$p_from,$p_to,'p_id','jr_tech_per');
|
||||
|
||||
|
|
@ -348,7 +350,7 @@ class Acc_Ledger {
|
|||
$periode=sql_filter_per($this->db,$p_from,$p_to,'p_id','jr_tech_per');
|
||||
|
||||
$cond_limite=($p_limit!=-1)?" limit ".$p_limit." offset ".$p_offset:"";
|
||||
//Centralisé
|
||||
//Centralisé
|
||||
//---
|
||||
$id=($this->id == 0 ) ?"jr_c_opid as num":"jr_opid as num";
|
||||
|
||||
|
|
@ -694,7 +696,7 @@ class Acc_Ledger {
|
|||
|
||||
$res=pg_fetch_all($r);
|
||||
if ( empty($res) ) return null;
|
||||
print_r($res);
|
||||
|
||||
return $res[0];
|
||||
}
|
||||
/*!
|
||||
|
|
@ -711,11 +713,11 @@ class Acc_Ledger {
|
|||
$sql="select jrn_def_class_cred ".
|
||||
" from jrn_def where ".
|
||||
" jrn_def_id = ".$this->id;
|
||||
print_r($sql);
|
||||
|
||||
$r=ExecSql($this->db,$sql);
|
||||
|
||||
$res=pg_fetch_all($r);
|
||||
print_r($res);
|
||||
|
||||
if ( empty($res) ) return null;
|
||||
return $res[0];
|
||||
}
|
||||
|
|
@ -755,11 +757,13 @@ class Acc_Ledger {
|
|||
$ret.=$hidden->IOValue('p_jrn',$this->id);
|
||||
$ret.=$hidden->IOValue('nb_item',$this->nb);
|
||||
$ret.=dossier::hidden();
|
||||
$count=0;
|
||||
for ($i=0;$i<$this->nb;$i++) {
|
||||
$ret.="<tr>";
|
||||
if ( trim(${'qc_'.$i})!="") {
|
||||
$oqc=new fiche($this->db);
|
||||
$oqc->GetByQCode(${'qc_'.$i},false);
|
||||
$strPoste=$oqc->strAttribut(ATTR_DEF_ACCOUNT);
|
||||
$ret.="<td>".${'qc_'.$i}.' - '.
|
||||
$oqc->strAttribut(ATTR_DEF_NAME).$hidden->IOValue('qc_'.$i,${'qc_'.$i}).
|
||||
'</td>';
|
||||
|
|
@ -767,6 +771,7 @@ class Acc_Ledger {
|
|||
|
||||
if ( trim(${'qc_'.$i})=="" && trim(${'poste'.$i}) != "") {
|
||||
$oposte=new poste($this->db,${'poste'.$i});
|
||||
$strPoste=$oposte->id;
|
||||
$ret.="<td>".${"poste".$i}." - ".
|
||||
$oposte->GetName().$hidden->IOValue('poste'.$i,${'poste'.$i}).
|
||||
'</td>';
|
||||
|
|
@ -784,12 +789,15 @@ class Acc_Ledger {
|
|||
|
||||
if ( $own->MY_ANALYTIC!='nu') // use of AA
|
||||
{
|
||||
// show form
|
||||
$op=new Anc_Operation($this->db);
|
||||
$null=($own->MY_ANALYTIC=='op')?1:0;
|
||||
$ret.='<td>';
|
||||
$ret.=$op->display_form_plan(null,$null,1,$i,round(${'amount'.$i},2));
|
||||
$ret.='</td>';
|
||||
if ( ereg("^[6,7]+",$strPoste)) {
|
||||
// show form
|
||||
$op=new Anc_Operation($this->db);
|
||||
$null=($own->MY_ANALYTIC=='op')?1:0;
|
||||
$ret.='<td>';
|
||||
$ret.=$op->display_form_plan(null,$null,1,$count,round(${'amount'.$i},2));
|
||||
$ret.='</td>';
|
||||
$count++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -877,8 +885,8 @@ class Acc_Ledger {
|
|||
$poste->readonly=$p_readonly;
|
||||
$poste->extra=$this->id;
|
||||
$poste->extra2=$this->get_class_def();
|
||||
echo "get_class_Def returns";
|
||||
print_r($poste->extra2);
|
||||
|
||||
|
||||
$poste_span=new widget('span','','poste'.$i.'_label');
|
||||
|
||||
// Amount
|
||||
|
|
@ -890,7 +898,7 @@ class Acc_Ledger {
|
|||
// D/C
|
||||
$deb=new widget('checkbox');
|
||||
$deb->name='ck'.$i;
|
||||
$deb->value=(isset(${'ck'.$i}))?${"ck".$i}:'';
|
||||
$deb->selected=(isset(${'ck'.$i}))?true:false;
|
||||
$deb->readonly=$p_readonly;
|
||||
|
||||
$ret.='<tr>';
|
||||
|
|
@ -906,20 +914,92 @@ class Acc_Ledger {
|
|||
$ret.='</table>';
|
||||
return $ret;
|
||||
}
|
||||
/*!
|
||||
* \brief verify that the operation can be saved
|
||||
* \param $p_array array of data same layout that the $_POST from show_form
|
||||
*
|
||||
*
|
||||
* \return the return value are 0 ok,1 incorrect balance, 2 date
|
||||
* invalid, 3 invalid amount, 4 the card is not in the range of
|
||||
* permitted card, 5 not in the user's period, 6 closed period
|
||||
*
|
||||
*/
|
||||
function verify($p_array)
|
||||
{
|
||||
extract ($p_array);
|
||||
$user=new cl_user($this->db);
|
||||
|
||||
$tot_cred=0;$tot_deb=0;
|
||||
// Check the periode and the date
|
||||
if ( isDate($date) == null ) {
|
||||
throw new AcException('Date invalide', 2);
|
||||
}
|
||||
list ($l_date_start,$l_date_end)=GetPeriode($this->db,$user->GetPeriode());
|
||||
|
||||
// Date dans la periode active
|
||||
if ( cmpDate($date,$l_date_start)<0 ||
|
||||
cmpDate($date,$l_date_end)>0 )
|
||||
{
|
||||
throw new AcException('Pas dans la periode active',5);
|
||||
}
|
||||
// Periode ferm<72>
|
||||
if ( PeriodeClosed ($this->db,$user->GetPeriode())=='t' )
|
||||
{
|
||||
return new AcException('Periode fermee',6);
|
||||
}
|
||||
|
||||
for ($i=0;$i<$this->nb;$i++)
|
||||
{
|
||||
$err=0;
|
||||
|
||||
// Check the balance
|
||||
if ( ! isset (${'amount'.$i}))
|
||||
continue;
|
||||
|
||||
if ( isNumber(${'amount'.$i} ) == 0 )
|
||||
throw new AcException('Montant invalide',3);
|
||||
|
||||
$amount=round(${'amount'.$i},2);
|
||||
$tot_deb+=(isset(${'ck'.$i}))?$amount:0;
|
||||
$tot_cred+=(! isset(${'ck'.$i}))?$amount:0;
|
||||
|
||||
// Check if the card is permitted
|
||||
if ( isset (${'qc_'.$i}) && trim(${'qc_'.$i}) !="") {
|
||||
$f=new fiche($this->db);
|
||||
$f->quick_code=${'qc_'.$i};
|
||||
|
||||
if ( $f->belong_ledger($p_jrn) < 0 )
|
||||
throw new AcException("La fiche quick_code = ".
|
||||
$f->quick_code." n\'est pas dans ce journal",4);
|
||||
}
|
||||
|
||||
// Check if the account is permitted
|
||||
if ( isset (${'poste'.$i})) {
|
||||
$p=new poste($this->db,${'poste'.$i});
|
||||
if ( $p->belong_ledger ($p_jrn) < 0 )
|
||||
throw new AcException("Le poste ".$p->id." n\'est pas dans ce journal",5);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if ( $tot_deb != $tot_cred )
|
||||
throw new AcException("Balance incorrecte debit = $tot_deb credit=$tot_cred ",1);
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief save the operation into the jrnx,jrn, ,
|
||||
* CA and pre_def
|
||||
* \param
|
||||
* \param
|
||||
* \param
|
||||
*
|
||||
* \param $p_array
|
||||
*
|
||||
* \return
|
||||
* \return array with [0] = false if failed otherwise true, [1] error
|
||||
* code
|
||||
*/
|
||||
function save ($p_array) {
|
||||
extract ($p_array);
|
||||
|
||||
try {
|
||||
$this->verify($p_array);
|
||||
|
||||
StartSql($this->db) ;
|
||||
|
||||
$seq=NextSequence($this->db,'s_grpt');
|
||||
|
|
@ -928,6 +1008,8 @@ class Acc_Ledger {
|
|||
$group=NextSequence($this->db,"s_oa_group");
|
||||
$own=new own($this->db);
|
||||
$tot_amount=0;
|
||||
|
||||
$count=0;
|
||||
for ($i=0;$i<$this->nb;$i++)
|
||||
{
|
||||
if ( ! isset (${'qc_'.$i}) && ! isset(${'poste'.$i}))
|
||||
|
|
@ -946,7 +1028,7 @@ class Acc_Ledger {
|
|||
}
|
||||
$acc_op->date=$date;
|
||||
$acc_op->desc=$desc;
|
||||
$acc_op->amount=${'amount'.$i};
|
||||
$acc_op->amount=round(${'amount'.$i},2);
|
||||
$acc_op->grpt=$seq;
|
||||
$acc_op->poste=$poste;
|
||||
$acc_op->jrn=$this->id;
|
||||
|
|
@ -957,14 +1039,18 @@ class Acc_Ledger {
|
|||
|
||||
if ( $own->MY_ANALYTIC != "nu" )
|
||||
{
|
||||
// for each item, insert into operation_analytique */
|
||||
$op=new Anc_Operation($this->db);
|
||||
$op->oa_group=$group;
|
||||
$op->j_id=$j_id;
|
||||
$op->oa_date=$date;
|
||||
$op->oa_debit=($acc_op->type=='d' )?'t':'f';
|
||||
$op->oa_description=$desc;
|
||||
$op->save_form_plan($p_array,$i);
|
||||
if ( ereg("^[6,7]+",$poste)) {
|
||||
|
||||
// for each item, insert into operation_analytique */
|
||||
$op=new Anc_Operation($this->db);
|
||||
$op->oa_group=$group;
|
||||
$op->j_id=$j_id;
|
||||
$op->oa_date=$date;
|
||||
$op->oa_debit=($acc_op->type=='d' )?'t':'f';
|
||||
$op->oa_description=$desc;
|
||||
$op->save_form_plan($p_array,$count);
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$acc_end=new Acc_Operation($this->db);
|
||||
|
|
@ -986,7 +1072,11 @@ class Acc_Ledger {
|
|||
$opd->get_post();
|
||||
$opd->save();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
catch (AcException $a) {
|
||||
throw $a;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Rollback($this->db);
|
||||
echo 'OPERATION ANNULEE ';
|
||||
echo '<hr>';
|
||||
|
|
@ -994,6 +1084,7 @@ class Acc_Ledger {
|
|||
exit();
|
||||
}
|
||||
Commit($this->db);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -1025,8 +1116,10 @@ class Acc_Ledger {
|
|||
$cn=DbConnect(dossier::id());
|
||||
$_SESSION['g_user']='phpcompta';
|
||||
$_SESSION['g_pass']='phpcompta';
|
||||
$id=(isset ($_POST['p_jrn']))?$_POST['p_jrn']:-1;
|
||||
|
||||
$id=(isset ($_REQUEST['p_jrn']))?$_REQUEST['p_jrn']:-1;
|
||||
$a=new Acc_Ledger($cn,$id);
|
||||
// Vide
|
||||
echo '<FORM method="post">';
|
||||
echo $a->select_ledger()->IOValue();
|
||||
echo widget::submit_button('go','Test it');
|
||||
|
|
@ -1037,17 +1130,61 @@ class Acc_Ledger {
|
|||
echo $a->show_form();
|
||||
echo widget::submit_button('post_id','Try me');
|
||||
echo '</form>';
|
||||
// Show the predef operation
|
||||
// Don't forget the p_jrn
|
||||
echo '<form>';
|
||||
echo dossier::hidden();
|
||||
echo '<input type="hidden" value="'.$id.'" name="p_jrn">';
|
||||
$op=new Pre_operation($cn);
|
||||
$op->p_jrn=$id;
|
||||
$op->od_direct='t';
|
||||
if ($op->count() != 0 )
|
||||
echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
|
||||
echo $op->show_button();
|
||||
echo '</form>';
|
||||
exit();
|
||||
}
|
||||
|
||||
if ( isset($_POST['post_id' ])) {
|
||||
echo '<form method="post">';
|
||||
echo $a->show_form($_POST,1);
|
||||
echo widget::submit_button('save_it',"Sauver");
|
||||
echo '</form>';
|
||||
exit();
|
||||
}
|
||||
if ( isset($_POST['save_it' ])) {
|
||||
print 'saving';
|
||||
$array=$_POST;
|
||||
$array['save_opd']=1;
|
||||
$a->save($array);
|
||||
try {
|
||||
$a->save($array);
|
||||
} catch (AcException $e) {
|
||||
echo '<script>alert (\''.$e->getMessage()."'); </script>";
|
||||
echo '<form method="post">';
|
||||
|
||||
echo $a->show_form($_POST);
|
||||
echo widget::submit_button('post_id','Try me');
|
||||
echo '</form>';
|
||||
|
||||
}
|
||||
exit();
|
||||
}
|
||||
// The GET at the end because automatically repost when you don't
|
||||
// specify the url in the METHOD field
|
||||
if ( isset ($_GET['use_opd'])) {
|
||||
$op=new Pre_op_advanced($cn);
|
||||
$op->set_od_id($_REQUEST['pre_def']);
|
||||
//$op->p_jrn=$id;
|
||||
|
||||
$p_post=$op->compute_array();
|
||||
|
||||
echo '<FORM method="post">';
|
||||
|
||||
echo $a->show_form($p_post);
|
||||
echo widget::submit_button('post_id','Use predefined operation');
|
||||
echo '</form>';
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
31
include/class_acexception.php
Normal file
31
include/class_acexception.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?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 acException extends Exception
|
||||
*
|
||||
*/
|
||||
class AcException extends Exception {
|
||||
|
||||
}
|
||||
|
|
@ -379,7 +379,7 @@ function get_balance($p_from,$p_to,$p_plan_id)
|
|||
$result="";
|
||||
$plan=new PlanAnalytic($this->db);
|
||||
$a_plan=$plan->get_list();
|
||||
|
||||
if ( empty ($a_plan) ) return "";
|
||||
$table_id="t".$p_seq;
|
||||
|
||||
$hidden=new widget("hidden");
|
||||
|
|
@ -400,6 +400,7 @@ function get_balance($p_from,$p_to,$p_plan_id)
|
|||
for ( $i=1; $i <= $nb_row;$i++) {
|
||||
$result.='<tr>';
|
||||
$count=0;
|
||||
|
||||
foreach ($a_plan as $r_plan)
|
||||
{
|
||||
$count++;
|
||||
|
|
@ -475,8 +476,8 @@ function get_balance($p_from,$p_to,$p_plan_id)
|
|||
echo_debug(__FILE__.':'.__LINE__,"p_array is ",$p_array);
|
||||
extract($p_array);
|
||||
if ( !isset (${"nb_t".$p_item}) ) {
|
||||
echo __FILE__.':'.__LINE."nb_t".$p_item." n'est pas defini !!!";
|
||||
exit();
|
||||
// echo __FILE__.':'.__LINE."nb_t".$p_item." n'est pas defini !!!";
|
||||
return;
|
||||
}
|
||||
$max=${"nb_t".$p_item};
|
||||
echo_debug(__FILE__.':'.__LINE__.'- ', "max of row for CA = ".$max);
|
||||
|
|
|
|||
|
|
@ -43,21 +43,25 @@ class fiche {
|
|||
var $attribut; /*! < $attribut array of attribut object */
|
||||
var $fiche_def_ref; /*!< $fiche_def_ref Type */
|
||||
var $row; /*! < All the row from the ledgers */
|
||||
var $quick_code; /*!< quick_code of the card */
|
||||
function fiche($p_cn,$p_id=0) {
|
||||
$this->cn=$p_cn;
|
||||
$this->id=$p_id;
|
||||
$this->quick_code='';
|
||||
}
|
||||
/*! GetByQCode($p_qcode)
|
||||
* \brief Retrieve a card thx his quick_code
|
||||
* complete the object
|
||||
* complete the object,, set the id member of the object
|
||||
* \param $p_qcode quick_code (ad_id=23)
|
||||
* \param $p_all retrieve all the attribut of the card, possible value
|
||||
* are true, false retrieve only the f_id
|
||||
* \return 0 success 1 error not found
|
||||
*/
|
||||
|
||||
function GetByQCode($p_qcode,$p_all=true)
|
||||
function GetByQCode($p_qcode=null,$p_all=true)
|
||||
{
|
||||
if ( $p_qcode == null )
|
||||
$p_qcode=$this->quick_code;
|
||||
|
||||
$p_qcode=FormatString($p_qcode);
|
||||
$sql="select f_id from jnt_fic_att_value join attr_value
|
||||
|
|
@ -65,6 +69,7 @@ class fiche {
|
|||
$Res=ExecSql($this->cn,$sql);
|
||||
$r=pg_fetch_all($Res);
|
||||
echo_debug('fiche',__LINE__,'result:'.var_export($r,true).'size '.sizeof($r));
|
||||
|
||||
if ( $r == null )
|
||||
return 1;
|
||||
$this->id=$r[0]['f_id'];
|
||||
|
|
@ -734,6 +739,21 @@ class fiche {
|
|||
return 1;
|
||||
return $r[0]['av_text'];
|
||||
}
|
||||
|
||||
/*!\brief return the quick_code of a card
|
||||
* \return null if not quick_code is found
|
||||
*/
|
||||
function get_quick_code()
|
||||
{
|
||||
$sql="select av_text from jnt_fic_att_value join attr_value
|
||||
using (jft_id) where ad_id=23 and f_id=".$this->id;
|
||||
$Res=ExecSql($this->cn,$sql);
|
||||
$r=pg_fetch_all($Res);
|
||||
if ( sizeof($r) == 0 )
|
||||
return null;
|
||||
return $r[0]['av_text'];
|
||||
}
|
||||
|
||||
/*!\brief Synonum of fiche::getAttribut
|
||||
*/
|
||||
function Get()
|
||||
|
|
@ -947,5 +967,85 @@ function GetSoldeDetail($p_cond="") {
|
|||
else
|
||||
$this->fd_id=$R;
|
||||
}
|
||||
/*!
|
||||
***************************************************
|
||||
* \brief Check if a fiche is used by a jrn
|
||||
* return 1 if the fiche is in the range otherwise 0, the quick_code
|
||||
* or the id must be set
|
||||
*
|
||||
*
|
||||
* \param $j_jrn journal_id
|
||||
* \param $p_type : deb or cred default empty
|
||||
*
|
||||
*\todo fiche::belong_ledger this function will replace fiche_inc.php
|
||||
*function isFicheOfJrn , it should be replaced everywhere in the code
|
||||
*
|
||||
* \return 1 if the fiche is in the range otherwise < 1
|
||||
* -1 the card doesn't exist
|
||||
* -2 the ledger has no card to check
|
||||
*
|
||||
*/
|
||||
function belong_ledger($p_jrn,$p_type="")
|
||||
{
|
||||
// check if we have a quick_code or a f_id
|
||||
if (($this->quick_code==null || $this->quick_code == "" )
|
||||
&& $this->id == 0 ) {
|
||||
echo 'erreur ni quick_code ni f_id ne sont donnes';
|
||||
exit();
|
||||
}
|
||||
|
||||
//retrieve the quick_code
|
||||
if ( $this->quick_code=="")
|
||||
$this->quick_code=$this->get_quick_code();
|
||||
|
||||
|
||||
if ( $this->quick_code==null)
|
||||
return -1;
|
||||
|
||||
if ( $this->id == 0 )
|
||||
if ( $this->GetByQCode(null,false) == 1)
|
||||
return -1;
|
||||
|
||||
$get="";
|
||||
if ( $p_type == 'deb' ) {
|
||||
$get='jrn_def_fiche_deb';
|
||||
}
|
||||
if ( $p_type == 'cred' ) {
|
||||
$get='jrn_def_fiche_cred';
|
||||
}
|
||||
if ( $get != "" ) {
|
||||
$Res=ExecSql($this->cn,"select $get as fiche from jrn_def where jrn_def_id=$p_jrn");
|
||||
} else {
|
||||
// Get all the fiche type (deb and cred)
|
||||
$Res=ExecSql($this->cn," select jrn_def_fiche_cred as fiche
|
||||
from jrn_def where jrn_def_id=$p_jrn
|
||||
union
|
||||
select jrn_def_fiche_deb
|
||||
from jrn_def where jrn_def_id=$p_jrn"
|
||||
);
|
||||
}
|
||||
$Max=pg_NumRows($Res);
|
||||
if ( $Max==0) {
|
||||
return -2;
|
||||
}
|
||||
// Normally Max must be == 1
|
||||
$list=pg_fetch_array($Res,0);
|
||||
if ( $list['fiche']=="") {
|
||||
return -3;
|
||||
}
|
||||
|
||||
$sql="select *
|
||||
from fiche
|
||||
where
|
||||
fd_id in (".$list['fiche'].") and f_id= ".$this->id;
|
||||
|
||||
$Res=ExecSql($this->cn,$sql);
|
||||
$Max=pg_NumRows($Res);
|
||||
if ($Max==0 )
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ class PlanAnalytic
|
|||
function header() {
|
||||
$res="";
|
||||
$a_plan=$this->get_list();
|
||||
if ( empty($a_plan)) return "";
|
||||
foreach ($a_plan as $r_plan)
|
||||
{
|
||||
$res.="<th>".$r_plan['name']."</th>";
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ function GetSoldeDetail($p_cond="") {
|
|||
/*!
|
||||
* \brief verify that the poste belong to a ledger
|
||||
*
|
||||
* \return 0 ok, -1 no, -2 account doesn't exist
|
||||
* \return 0 ok, -1 no
|
||||
*/
|
||||
function belong_ledger($p_jrn) {
|
||||
$filter=getDbValue($this->db,"select jrn_def_class_cred from jrn_def where jrn_def_id=$p_jrn");
|
||||
|
|
@ -317,7 +317,7 @@ function GetSoldeDetail($p_cond="") {
|
|||
if ($max > 0 )
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
static function test_me() {
|
||||
$cn=DbConnect(dossier::id());
|
||||
|
|
|
|||
|
|
@ -29,10 +29,16 @@ require_once ('class_pre_operation.php');
|
|||
/*---------------------------------------------------------------------- */
|
||||
class Pre_op_ach extends Pre_operation_detail {
|
||||
var $op;
|
||||
function __construct($cn) {
|
||||
parent::__construct($cn);
|
||||
|
||||
$this->operation->od_direct='f';
|
||||
}
|
||||
|
||||
function get_post() {
|
||||
echo_debug(__FILE__.':'.__LINE__.'- ','get_post');
|
||||
parent::get_post();
|
||||
$this->operation->od_direct='f';
|
||||
$this->e_client=$_POST['e_client'];
|
||||
for ($i=0;$i<$this->operation->nb_item;$i++) {
|
||||
$march="e_march".$i;
|
||||
|
|
|
|||
|
|
@ -29,17 +29,23 @@ require_once ('class_pre_operation.php');
|
|||
/*---------------------------------------------------------------------- */
|
||||
class Pre_Op_Advanced extends Pre_operation_detail {
|
||||
var $op;
|
||||
|
||||
function Pre_Op_Advanced($cn) {
|
||||
parent::__construct($cn);
|
||||
$this->operation->od_direct='t';
|
||||
}
|
||||
function get_post() {
|
||||
echo_debug(__FILE__.':'.__LINE__.'- ','get_post');
|
||||
parent::get_post();
|
||||
// For advanced we use +5000
|
||||
$this->operation->p_jrn+=5000;
|
||||
|
||||
extract($_POST);
|
||||
|
||||
for ($i=0;$i<$this->operation->nb_item;$i++) {
|
||||
if ( ! isset ($_POST['poste'.$i]) && ! isset ($_POST['qc_'.$i]))
|
||||
continue;
|
||||
$this->{'poste'.$i}=(isset($_POST['qc_'.$i]))?$_POST['qc_'.$i]:$_POST['poste'.$i];
|
||||
$this->{'isqc'.$i}=(isset($_POST['qc_'.$i]))?'t':'f';
|
||||
$this->{"amount".$i}=$_POST['amount'.$i];
|
||||
$this->{"ck".$i}=($_POST['ck'.$i]=='c')?'t':'f';
|
||||
$this->{"ck".$i}=(isset($_POST['ck'.$i]))?'t':'f';
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -54,16 +60,22 @@ class Pre_Op_Advanced extends Pre_operation_detail {
|
|||
return;
|
||||
// save the selling
|
||||
for ($i=0;$i<$this->operation->nb_item;$i++) {
|
||||
$sql=sprintf('insert into op_predef_detail (opd_poste,opd_amount,'.
|
||||
'opd_debit,od_id)'.
|
||||
' values '.
|
||||
"('%s',%.2f,%d,%f,'%s',%d)",
|
||||
$this->{"poste".$i},
|
||||
$this->{"amount".$i},
|
||||
$this->{"ck".$i},
|
||||
$this->operation->od_id
|
||||
);
|
||||
ExecSql($this->db,$sql);
|
||||
if ( ! isset ($this->{"poste".$i}))
|
||||
continue;
|
||||
|
||||
$sql=sprintf('insert into op_predef_detail (opd_poste,opd_amount,'.
|
||||
'opd_debit,od_id,opd_qc)'.
|
||||
' values '.
|
||||
"('%s',%.2f,'%s',%d,'%s')",
|
||||
$this->{"poste".$i},
|
||||
$this->{"amount".$i},
|
||||
$this->{"ck".$i},
|
||||
$this->operation->od_id,
|
||||
$this->{'isqc'.$i}
|
||||
);
|
||||
|
||||
ExecSql($this->db,$sql);
|
||||
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo ($e->getMessage());
|
||||
|
|
@ -77,27 +89,37 @@ class Pre_Op_Advanced extends Pre_operation_detail {
|
|||
$count=0;
|
||||
$a_op=$this->operation->load();
|
||||
$array=$this->operation->compute_array($a_op);
|
||||
$array['desc']=$array['e_comm'];
|
||||
$p_array=$this->load();
|
||||
foreach ($p_array as $row) {
|
||||
if ( $row['opd_debit']=='t') {
|
||||
$array+=array('e_client'=>$row['opd_poste']);
|
||||
} else {
|
||||
$array+=array("e_march".$count=>$row['opd_poste'],
|
||||
"e_march".$count."_sell"=>$row['opd_amount'],
|
||||
"e_march".$count."_tva_id"=>$row['opd_tva_id'],
|
||||
"e_quant".$count=>$row['opd_quantity']
|
||||
);
|
||||
$count++;
|
||||
}
|
||||
$tmp_array=array("qc_".$count=>'',
|
||||
"poste".$count=>'',
|
||||
"amount".$count=>$row['opd_amount'],
|
||||
'ck'.$count=>$row['opd_debit']
|
||||
);
|
||||
|
||||
if ( $row['opd_qc'] == 't' )
|
||||
$tmp_array['qc_'.$count]=$row['opd_poste'];
|
||||
else
|
||||
$tmp_array['poste'.$count]=$row['opd_poste'];
|
||||
|
||||
|
||||
if ( $row['opd_debit'] == 'f' )
|
||||
unset ($tmp_array['ck'.$count]);
|
||||
|
||||
$array+=$tmp_array;
|
||||
$count++;
|
||||
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
/*!\brief load the data from the database and return an array
|
||||
* \return an array
|
||||
*/
|
||||
function load() {
|
||||
$sql="select opd_id,opd_poste,opd_amount,opd_tva_id,opd_debit,".
|
||||
" opd_quantity from op_predef_detail where od_id=".$this->operation->od_id.
|
||||
$sql="select opd_id,opd_poste,opd_amount,opd_debit,".
|
||||
" opd_qc from op_predef_detail where od_id=".$this->operation->od_id.
|
||||
" order by opd_id";
|
||||
$res=ExecSql($this->db,$sql);
|
||||
$array=pg_fetch_all($res);
|
||||
|
|
|
|||
|
|
@ -29,10 +29,15 @@ require_once ('class_pre_operation.php');
|
|||
/*---------------------------------------------------------------------- */
|
||||
class Pre_op_fin extends Pre_operation_detail {
|
||||
var $op;
|
||||
function __construct($cn) {
|
||||
parent::__construct($cn);
|
||||
$this->operation->od_direct='f';
|
||||
}
|
||||
|
||||
function get_post() {
|
||||
echo_debug(__FILE__.':'.__LINE__.'- ','get_post');
|
||||
parent::get_post();
|
||||
$this->operation->od_direct='f';
|
||||
$this->e_bank_account=$_POST['e_bank_account'];
|
||||
for ($i=0;$i<$this->operation->nb_item;$i++) {
|
||||
$this->{"e_other".$i}=$_POST['e_other'.$i];
|
||||
|
|
|
|||
|
|
@ -29,10 +29,15 @@ require_once ('class_pre_operation.php');
|
|||
/*---------------------------------------------------------------------- */
|
||||
class Pre_op_ods extends Pre_operation_detail {
|
||||
var $op;
|
||||
function __construct($cn) {
|
||||
parent::__construct($cn);
|
||||
$this->operation->od_direct='f';
|
||||
}
|
||||
|
||||
function get_post() {
|
||||
echo_debug(__FILE__.':'.__LINE__.'- ','get_post');
|
||||
parent::get_post();
|
||||
$this->operation->od_direct='f';
|
||||
for ($i=0;$i<$this->operation->nb_item;$i++) {
|
||||
|
||||
$this->{"e_account".$i}=$_POST['e_account'.$i];
|
||||
|
|
|
|||
|
|
@ -29,10 +29,15 @@ require_once ('class_pre_operation.php');
|
|||
/*---------------------------------------------------------------------- */
|
||||
class Pre_op_ven extends Pre_operation_detail {
|
||||
var $op;
|
||||
function __construct($cn) {
|
||||
parent::__construct($cn);
|
||||
$this->operation->od_direct='f';
|
||||
}
|
||||
|
||||
function get_post() {
|
||||
echo_debug(__FILE__.':'.__LINE__.'- ','get_post');
|
||||
parent::get_post();
|
||||
$this->operation->od_direct='f';
|
||||
$this->e_client=$_POST['e_client'];
|
||||
for ($i=0;$i<$this->operation->nb_item;$i++) {
|
||||
$march="e_march".$i;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,8 @@ class Pre_operation
|
|||
}
|
||||
}
|
||||
function delete () {
|
||||
$sql="delete from op_predef where od_id=".$this->od_id;
|
||||
$sql="delete from op_predef where od_id=".$this->od_id.
|
||||
" and od_direct ='".$this->od_direct."'";
|
||||
ExecSql($this->db,$sql);
|
||||
}
|
||||
/*!\brief save the predef check first is the name is unique
|
||||
|
|
@ -72,13 +73,14 @@ class Pre_operation
|
|||
echo '<h2 class="info">Vous avez atteint le max. d\'opération prédéfinie, désolé</h2>';
|
||||
return false;
|
||||
}
|
||||
$sql=sprintf('insert into op_predef (jrn_def_id,od_name,od_item,od_jrn_type)'.
|
||||
$sql=sprintf('insert into op_predef (jrn_def_id,od_name,od_item,od_jrn_type,od_direct)'.
|
||||
'values'.
|
||||
"(%d,'%s',%d,'%s')",
|
||||
"(%d,'%s',%d,'%s','%s')",
|
||||
$this->p_jrn,
|
||||
pg_escape_string($this->name),
|
||||
$this->nb_item,
|
||||
$this->jrn_type);
|
||||
$this->jrn_type,
|
||||
$this->od_direct);
|
||||
ExecSql($this->db,$sql);
|
||||
$this->od_id=GetSequence($this->db,'op_def_op_seq');
|
||||
return true;
|
||||
|
|
@ -88,7 +90,9 @@ class Pre_operation
|
|||
*/
|
||||
function load() {
|
||||
$sql="select od_id,jrn_def_id,od_name,od_item,od_jrn_type".
|
||||
" from op_predef where od_id=".$this->od_id." order by od_name";
|
||||
" from op_predef where od_id=".$this->od_id.
|
||||
" and od_direct='".$this->od_direct."'".
|
||||
" order by od_name";
|
||||
$res=ExecSql($this->db,$sql);
|
||||
$array=pg_fetch_all($res);
|
||||
echo_debug(__FILE__.':'.__LINE__.'- ','load pre_op',$array);
|
||||
|
|
@ -112,8 +116,10 @@ class Pre_operation
|
|||
|
||||
$select=new widget("select");
|
||||
$value=make_array($this->db,"select od_id,od_name from op_predef ".
|
||||
" where jrn_def_id=".$this->p_jrn.
|
||||
" order by od_name");
|
||||
" where jrn_def_id=".$this->p_jrn.
|
||||
" and od_direct ='".$this->od_direct."'".
|
||||
" order by od_name");
|
||||
|
||||
if ( empty($value)==true) return "";
|
||||
$select->value=$value;
|
||||
$r=$select->IOValue("pre_def");
|
||||
|
|
@ -122,17 +128,19 @@ class Pre_operation
|
|||
/*!\brief count the number of pred operation for a ledger */
|
||||
function count() {
|
||||
$a=CountSql($this->db,"select od_id,od_name from op_predef ".
|
||||
" where jrn_def_id=".$this->p_jrn.
|
||||
" order by od_name");
|
||||
" where jrn_def_id=".$this->p_jrn.
|
||||
" and od_direct ='".$this->od_direct."'".
|
||||
" order by od_name");
|
||||
return $a;
|
||||
}
|
||||
/*!\brief get the list of the predef. operation of a ledger
|
||||
* \return string
|
||||
*/
|
||||
function get_list_ledger() {
|
||||
$sql="select od_id,od_name from op_predef ".
|
||||
" where jrn_def_id=".$this->p_jrn.
|
||||
" order by od_name";
|
||||
$sql="select od_id,od_name from op_predef ".
|
||||
" where jrn_def_id=".$this->p_jrn.
|
||||
" and od_direct ='".$this->od_direct."'".
|
||||
" order by od_name";
|
||||
$res=ExecSql($this->db,$sql);
|
||||
$all=pg_fetch_all($res);
|
||||
return $all;
|
||||
|
|
@ -143,11 +151,12 @@ class Pre_operation
|
|||
}
|
||||
class Pre_operation_detail {
|
||||
var $operation;
|
||||
function Pre_operation_detail($p_cn) {
|
||||
function __construct($p_cn) {
|
||||
$this->db=$p_cn;
|
||||
$this->operation=new Pre_operation($this->db);
|
||||
|
||||
}
|
||||
|
||||
function get_post() {
|
||||
$this->operation->get_post();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,19 +70,16 @@ class Supplier extends fiche{
|
|||
|
||||
}
|
||||
|
||||
/*! \function Summary
|
||||
/*!
|
||||
**************************************************
|
||||
\Brief show the default screen
|
||||
* \brief show the default screen
|
||||
*
|
||||
* parm :
|
||||
* - p_search (filter)
|
||||
* gen :
|
||||
* -
|
||||
* return: string to display
|
||||
* \param p_search (filter)
|
||||
* \return string to display
|
||||
*/
|
||||
function Summary($p_search)
|
||||
{
|
||||
$str_dossier=dossier::get();
|
||||
$str_dossier=dossier::get();
|
||||
$p_search=FormatString($p_search);
|
||||
$url=urlencode($_SERVER['REQUEST_URI']);
|
||||
$script=$_SERVER['PHP_SELF'];
|
||||
|
|
@ -143,14 +140,14 @@ class Supplier extends fiche{
|
|||
$r.=sprintf('<TD align="right"> %15.2f€</TD>',$a['solde']);
|
||||
|
||||
|
||||
$r.=sprintf('<td><A HREF="%s?p_action=contact&qcode=%s&url=%s" title="Contact">Contact</A></td>',
|
||||
$script,$supplier->strAttribut(ATTR_DEF_QUICKCODE),$url);
|
||||
$r.=sprintf('<td><A HREF="%s?p_action=suivi_courrier&sa=list&qcode=%s&url=%s" title="Action">Courrier</A></td> ',
|
||||
$script,$supplier->strAttribut(ATTR_DEF_QUICKCODE) ,$url);
|
||||
$r.=sprintf('<td><A HREF="%s?p_action=contact&qcode=%s&%s&url=%s" title="Contact">Contact</A></td>',
|
||||
$script,$supplier->strAttribut(ATTR_DEF_QUICKCODE),$str_dossier,$url);
|
||||
$r.=sprintf('<td><A HREF="%s?p_action=suivi_courrier&sa=list&qcode=%s&%s&url=%s" title="Action">Courrier</A></td> ',
|
||||
$script,$supplier->strAttribut(ATTR_DEF_QUICKCODE) ,$str_dossier,$url);
|
||||
|
||||
|
||||
|
||||
$r.='<td><A HREF="commercial.php?p_action=depense&sa=list&'.$str_dossier.'&p_periode=-1&qcode='.$supplier->strAttribut(ATTR_DEF_QUICKCODE).'&url='.$url.'" title="Historique Facture">Facture</A></td>';
|
||||
$r.='<td><A HREF="commercial.php?p_action=depense&sa=list&'.$str_dossier.'&p_periode=-1&qcode='.$supplier->strAttribut(ATTR_DEF_QUICKCODE).'&'.$str_dossier.'&url='.$url.'" title="Historique Facture">Facture</A></td>';
|
||||
$r.=sprintf('<td><A class="mtitle" HREF="%s?liste&p_action=bank&sa=list&'.$str_dossier.'&qcode=%s&url=%s&p_periode=-1" title="Financier">Financier</A></td>',
|
||||
$script,$supplier->strAttribut(ATTR_DEF_QUICKCODE) ,$url);
|
||||
|
||||
|
|
|
|||
|
|
@ -567,6 +567,7 @@ class widget {
|
|||
return $r;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// JS_DATE
|
||||
//------------------------------------------------------------------------
|
||||
|
|
@ -629,5 +630,13 @@ class widget {
|
|||
function Reset ($p_value) {
|
||||
return '<INPUT TYPE="SUBMIT" VALUE="'.$p_value.'">';
|
||||
}
|
||||
static function hidden($p_name,$p_value) {
|
||||
return '<INPUT TYPE="hidden" id="'.$p_name.'" NAME="'.$p_name.'" VALUE="'.$p_value.'">';
|
||||
}
|
||||
static function button_href($p_name,$p_value) {
|
||||
return sprintf('<A class="mtitle" HREF="%s"><input type="button" value="%s"></A>',
|
||||
$p_value,
|
||||
$p_name);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -328,6 +328,8 @@ if ( $p_jrn != -1 )
|
|||
echo '<form method="GET">';
|
||||
$op=new Pre_operation($cn);
|
||||
$op->p_jrn=$p_jrn;
|
||||
$op->od_direct='f';
|
||||
|
||||
$hid=new widget("hidden");
|
||||
echo $hid->IOValue("p_action","depense");
|
||||
echo dossier::hidden();
|
||||
|
|
|
|||
|
|
@ -314,6 +314,7 @@ if ( $p_jrn != -1 )
|
|||
echo '<form method="GET">';
|
||||
$op=new Pre_operation($cn);
|
||||
$op->p_jrn=$p_jrn;
|
||||
$op->od_direct='f';
|
||||
$hid=new widget("hidden");
|
||||
echo $hid->IOValue("p_action","facture");
|
||||
echo dossier::hidden();
|
||||
|
|
|
|||
|
|
@ -223,6 +223,9 @@ function getFicheAttribut($p_cn,$p_id,$p_attr="") {
|
|||
* \param $p_fiche : quick_code
|
||||
* \param $p_type : deb or cred default empty
|
||||
*
|
||||
*\todo fiche_inc.php function isFicheOfJrn this function is now in
|
||||
* class_fiche with the name belong_ledger, it should be replace
|
||||
* everywhere in the code
|
||||
*
|
||||
* \return 1 if the fiche is in the range otherwise 0
|
||||
*
|
||||
|
|
|
|||
131
include/quick_writing.inc.php
Normal file
131
include/quick_writing.inc.php
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
<?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 to write directly into the ledgers,the stock and the tables
|
||||
* quant_purchase and quant_sold are not changed by this
|
||||
*
|
||||
*/
|
||||
require_once ('class_acc_ledger.php');
|
||||
|
||||
$cn=DbConnect(dossier::id());
|
||||
$id=(isset ($_REQUEST['p_jrn']))?$_REQUEST['p_jrn']:-1;
|
||||
|
||||
function show_direct_form($cn,$ledger,$p_array) {
|
||||
$id=(isset ($_REQUEST['p_jrn']))?$_REQUEST['p_jrn']:-1;
|
||||
|
||||
// Show the predef operation
|
||||
// Don't forget the p_jrn
|
||||
echo '<form>';
|
||||
echo dossier::hidden();
|
||||
echo widget::hidden('p_action',$_REQUEST['p_action']);
|
||||
|
||||
echo '<input type="hidden" value="'.$id.'" name="p_jrn">';
|
||||
$op=new Pre_operation($cn);
|
||||
$op->p_jrn=$id;
|
||||
$op->od_direct='t';
|
||||
if ($op->count() != 0 )
|
||||
echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
|
||||
echo $op->show_button();
|
||||
echo '</form>';
|
||||
|
||||
echo '<form method="post" action="?">';
|
||||
echo dossier::hidden();
|
||||
echo widget::hidden('p_action',$_REQUEST['p_action']);
|
||||
|
||||
echo $ledger->show_form($p_array);
|
||||
|
||||
echo widget::submit_button('summary','Sauvez');
|
||||
|
||||
|
||||
echo '</form>';
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
$ledger=new Acc_Ledger($cn,$id);
|
||||
// no ledger selected, propose one
|
||||
if ($id == -1 )
|
||||
{
|
||||
|
||||
// Vide
|
||||
echo '<FORM method="get" action="?">';
|
||||
echo dossier::hidden();
|
||||
echo widget::hidden('p_action',$_REQUEST['p_action']);
|
||||
echo $ledger->select_ledger()->IOValue();
|
||||
echo widget::submit_button('show_form','Choix du journal');
|
||||
echo '</form>';
|
||||
exit();
|
||||
}
|
||||
echo '<div class="u_content">';
|
||||
echo '<h2 class="info"> Journal : '.$ledger->GetName().'</h2>';
|
||||
echo widget::button_href('Autre journal','?p_action='.$_REQUEST['p_action'].'&'.dossier::get());
|
||||
|
||||
if ( isset($_GET['show_form']) || isset($_POST['correct_it']) ) {
|
||||
show_direct_form($cn,$ledger,$_POST);
|
||||
exit();
|
||||
}
|
||||
|
||||
// reload with a predefined operation
|
||||
//
|
||||
if ( isset ($_GET['use_opd'])) {
|
||||
$op=new Pre_op_advanced($cn);
|
||||
$op->set_od_id($_REQUEST['pre_def']);
|
||||
//$op->p_jrn=$id;
|
||||
|
||||
$p_post=$op->compute_array();
|
||||
show_direct_form($cn,$ledger,$p_post);
|
||||
|
||||
exit();
|
||||
|
||||
}
|
||||
if ( isset($_POST['summary'])) {
|
||||
echo '<form method="post" action="?">';
|
||||
echo $ledger->show_form($_POST,1);
|
||||
echo dossier::hidden();
|
||||
echo widget::hidden('p_action',$_REQUEST['p_action']);
|
||||
|
||||
echo widget::submit_button('save_it',"Sauver");
|
||||
echo widget::submit_button('correct_it','Corriger');
|
||||
|
||||
$chk=new widget('checkbox');
|
||||
$chk->selected=false;
|
||||
echo "Sauvez l'opération ?";
|
||||
echo $chk->IOValue('save_opd');
|
||||
|
||||
echo '</form>';
|
||||
exit();
|
||||
|
||||
}
|
||||
if ( isset($_POST['save_it' ])) {
|
||||
$array=$_POST;
|
||||
|
||||
try {
|
||||
$ledger->save($array);
|
||||
} catch (AcException $e) {
|
||||
echo '<script>alert (\''.$e->getMessage()."'); </script>";
|
||||
show_direct_form($cn,$ledger,$_POST);
|
||||
}
|
||||
exit();
|
||||
}
|
||||
|
|
@ -77,6 +77,7 @@ if ( $action == 'new' ) {
|
|||
// predef op.
|
||||
$op=new Pre_operation($cn);
|
||||
$op->p_jrn=$_GET['p_jrn'];
|
||||
$op->od_direct='f';
|
||||
|
||||
echo '<div class="u_redcontent">';
|
||||
echo $r;
|
||||
|
|
@ -86,6 +87,8 @@ if ( $action == 'new' ) {
|
|||
echo '<form method="GET">';
|
||||
$op=new Pre_operation($cn);
|
||||
$op->p_jrn=$_GET['p_jrn'];
|
||||
$op->od_direct='f';
|
||||
|
||||
$hid=new widget("hidden");
|
||||
echo $hid->IOValue("action","use_opd");
|
||||
echo dossier::hidden();
|
||||
|
|
|
|||
|
|
@ -86,6 +86,8 @@ if ( $action == 'new' ) {
|
|||
echo '<form method="GET">';
|
||||
$op=new Pre_operation($cn);
|
||||
$op->p_jrn=$_GET['p_jrn'];
|
||||
$op->od_direct='f';
|
||||
|
||||
$hid=new widget("hidden");
|
||||
echo $hid->IOValue("action","use_opd");
|
||||
echo dossier::hidden();
|
||||
|
|
|
|||
|
|
@ -88,6 +88,8 @@ if ( $action == 'new' ) {
|
|||
echo '<form method="GET">';
|
||||
$op=new Pre_operation($cn);
|
||||
$op->p_jrn=$_GET['p_jrn'];
|
||||
$op->od_direct='f';
|
||||
|
||||
$hid=new widget("hidden");
|
||||
echo $hid->IOValue("action","use_opd");
|
||||
echo dossier::hidden();
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ if ( ! isset ($_REQUEST['action'])) {
|
|||
if ( $action=="use_opd" ) {
|
||||
$op=new Pre_op_ven($cn);
|
||||
$op->set_od_id($_REQUEST['pre_def']);
|
||||
$op->od_direct='f';
|
||||
|
||||
$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']);
|
||||
|
|
@ -103,6 +105,8 @@ if ( $action == 'insert_vente' ) {
|
|||
echo '<form method="GET">';
|
||||
$op=new Pre_operation($cn);
|
||||
$op->p_jrn=$_GET['p_jrn'];
|
||||
$op->od_direct='f';
|
||||
|
||||
$hid=new widget("hidden");
|
||||
echo $hid->IOValue("action","use_opd");
|
||||
echo dossier::hidden();
|
||||
|
|
|
|||
|
|
@ -166,6 +166,9 @@ function ShowMenuCompta($p_high="")
|
|||
$default=5;
|
||||
if ( $_REQUEST['p_action']=='fiche')
|
||||
$default=6;
|
||||
if ( $_REQUEST['p_action']=='quick_writing')
|
||||
$default=4;
|
||||
|
||||
}
|
||||
$str_dossier=dossier::get();
|
||||
$p_array=array(
|
||||
|
|
@ -174,11 +177,11 @@ function ShowMenuCompta($p_high="")
|
|||
array("user_jrn.php?jrn_type=ACH&".$str_dossier,"Dépense"),
|
||||
array("user_jrn.php?jrn_type=FIN&".$str_dossier,"Financier"),
|
||||
array("user_jrn.php?jrn_type=ODS&".$str_dossier,"Op. Diverses"),
|
||||
array('compta.php?p_action=quick_writing&'.$str_dossier,'Ecriture rapide'),
|
||||
array('compta.php?p_action=quick_writing&'.$str_dossier,'Ecriture rapide','Ecriture directe dans les journaux',4),
|
||||
|
||||
array("compta.php?p_action=impress&".$str_dossier,"Impression","Impression",5),
|
||||
array("compta.php?p_action=fiche&".$str_dossier,"Fiche","Ajouter, modifier ou effacer des fiches",6),
|
||||
array("user_advanced.php?".$str_dossier,"Avancé","Opérations délicates"),
|
||||
array("user_advanced.php?".$str_dossier,"Avancé","Opérations délicates",7),
|
||||
);
|
||||
|
||||
$result=ShowItem($p_array,'H',"mtitle","mtitle",$default,' width="100%"');
|
||||
|
|
|
|||
|
|
@ -1,2 +1,6 @@
|
|||
delete from jrn where jr_internal is null;
|
||||
delete from jrnx where j_grpt not in (select jr_grpt_id from jrn);
|
||||
delete from jrnx where j_grpt not in (select jr_grpt_id from jrn);
|
||||
alter table op_predef add od_direct bool;
|
||||
update op_predef set od_direct=false;
|
||||
alter table op_predef alter od_direct set not null;
|
||||
alter table op_predef_detail add od_qc bool;
|
||||
Loading…
Add table
Add a link
Reference in a new issue