FS#127 each FIN ledger must have one and one bank account
This commit is contained in:
parent
0bae0fc084
commit
f7c98cd88e
10 changed files with 292 additions and 126 deletions
|
|
@ -59,6 +59,37 @@ $user=new User($cn); $user->check(true);$user->check_dossier($gDossier,true);
|
|||
$html=var_export($_REQUEST,true);
|
||||
switch($op)
|
||||
{
|
||||
//--------------------------------------------------
|
||||
// get the last date of a ledger
|
||||
case 'lastdate':
|
||||
require_once('class_acc_ledger_fin.php');
|
||||
$ledger=new Acc_Ledger_Fin($cn,$_GET['p_jrn']);
|
||||
$html=$ledger->get_last_date();
|
||||
$html=escape_xml($html);
|
||||
header('Content-type: text/xml; charset=UTF-8');
|
||||
echo <<<EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<data>
|
||||
<code>e_date</code>
|
||||
<value>$html</value>
|
||||
</data>
|
||||
EOF;
|
||||
|
||||
break;
|
||||
case 'bkname':
|
||||
require_once('class_acc_ledger_fin.php');
|
||||
$ledger=new Acc_Ledger_Fin($cn,$_GET['p_jrn']);
|
||||
$html=$ledger->get_bank_name();
|
||||
$html=escape_xml($html);
|
||||
header('Content-type: text/xml; charset=UTF-8');
|
||||
echo <<<EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<data>
|
||||
<code>bkname</code>
|
||||
<value>$html</value>
|
||||
</data>
|
||||
EOF;
|
||||
break;
|
||||
// display new calendar
|
||||
case 'cal':
|
||||
require_once('class_calendar.php');
|
||||
|
|
|
|||
|
|
@ -84,6 +84,80 @@ function update_pj() {
|
|||
}
|
||||
);
|
||||
}
|
||||
/**
|
||||
*ask the name, quick_code of the bank for the ledger
|
||||
*/
|
||||
function update_bank() {
|
||||
var jrn=g('p_jrn').value;
|
||||
var dossier=g('gDossier').value;
|
||||
var qs='?&gDossier='+dossier+'&op=bkname&p_jrn='+jrn;
|
||||
var action=new Ajax.Request(
|
||||
"ajax_misc.php",
|
||||
{
|
||||
method:'get',
|
||||
parameters:qs,
|
||||
onFailure:error_get_pj,
|
||||
onSuccess:success_update_bank
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
/**
|
||||
* Put into the span, the name of the bank, the bank account
|
||||
* and the quick_code
|
||||
*/
|
||||
function success_update_bank(req)
|
||||
{
|
||||
try{
|
||||
var answer=req.responseXML;
|
||||
var a=answer.getElementsByTagName('code');
|
||||
var html=answer.getElementsByTagName('value');
|
||||
if ( a.length == 0 ) { var rec=req.responseText;alert ('erreur :'+rec);}
|
||||
var name_ctl=a[0].firstChild.nodeValue;
|
||||
var code_html=getNodeText(html[0]);
|
||||
code_html=unescape_xml(code_html);
|
||||
$(name_ctl).innerHTML=code_html;
|
||||
}
|
||||
catch (e) {
|
||||
alert("success_update_bank".e.message);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* call ajax, ask what is the last date for the current ledger
|
||||
*/
|
||||
function get_last_date() {
|
||||
var jrn=g('p_jrn').value;
|
||||
var dossier=g('gDossier').value;
|
||||
var qs='?&gDossier='+dossier+'&op=lastdate&p_jrn='+jrn;
|
||||
var action=new Ajax.Request(
|
||||
"ajax_misc.php",
|
||||
{
|
||||
method:'get',
|
||||
parameters:qs,
|
||||
onFailure:error_get_pj,
|
||||
onSuccess:success_get_last_date
|
||||
}
|
||||
);
|
||||
}
|
||||
/**
|
||||
* callback ajax, set the ctl with the last date from the ledger
|
||||
*/
|
||||
function success_get_last_date(req)
|
||||
{
|
||||
try{
|
||||
var answer=req.responseXML;
|
||||
var a=answer.getElementsByTagName('code');
|
||||
var html=answer.getElementsByTagName('value');
|
||||
if ( a.length == 0 ) { var rec=req.responseText;alert ('erreur :'+rec);}
|
||||
var name_ctl=a[0].firstChild.nodeValue;
|
||||
var code_html=getNodeText(html[0]);
|
||||
code_html=unescape_xml(code_html);
|
||||
$(name_ctl).value=code_html;
|
||||
}
|
||||
catch (e) {
|
||||
alert(e.message);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @brief update the field predef
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -58,9 +58,21 @@ class Acc_Ledger_Fin extends Acc_Ledger {
|
|||
if ( $user->check_jrn($p_jrn) != 'W' )
|
||||
throw new Exception (_('Accès interdit'),20);
|
||||
|
||||
/* check if there is a customer */
|
||||
if ( strlen(trim($e_bank_account)) == 0 )
|
||||
throw new Exception(_('Vous n\'avez pas donné de banque'),11);
|
||||
/* check if there is a bank account linked to the ledger */
|
||||
$bank_id=$this->get_bank();
|
||||
|
||||
if ($this->db->count()==0 )
|
||||
throw new Exception("Ce journal n'a pas de compte en banque, allez dans paramètre->journal pour régler cela");
|
||||
/* check if the accounting of the bank is correct */
|
||||
$fBank=new Fiche($this->db,$bank_id);
|
||||
$bank_accounting=$fBank->strAttribut(ATTR_DEF_ACCOUNT);
|
||||
if ( trim($bank_accounting)=='' )
|
||||
throw new Exception ('Le poste comptable du compte en banque de ce journal est invalide');
|
||||
|
||||
/* check if the account exists */
|
||||
$poste=new Acc_Account_Ledger($this->db,$bank_accounting);
|
||||
if ( $poste->load() == false )
|
||||
throw new Exception ('Le poste comptable du compte en banque de ce journal est invalide');
|
||||
|
||||
/* check if the date is valid */
|
||||
if ( isDate($e_date) == null ) {
|
||||
|
|
@ -82,6 +94,7 @@ class Acc_Ledger_Fin extends Acc_Ledger {
|
|||
{
|
||||
throw new Exception(_('Periode fermee'),6);
|
||||
}
|
||||
|
||||
/* check if we are using the strict mode */
|
||||
if( $this->check_strict() == true) {
|
||||
/* if we use the strict mode, we get the date of the last
|
||||
|
|
@ -93,35 +106,7 @@ class Acc_Ledger_Fin extends Acc_Ledger {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$fiche=new Fiche($this->db);
|
||||
$fiche->get_by_qcode($e_bank_account);
|
||||
if ( $fiche->empty_attribute(ATTR_DEF_ACCOUNT) == true)
|
||||
throw new Exception('La fiche '.$e_bank_account.'n\'a pas de poste comptable',8);
|
||||
|
||||
/* get the account and explode if necessary */
|
||||
$sposte=$fiche->strAttribut(ATTR_DEF_ACCOUNT);
|
||||
// if 2 accounts, take only the debit one for customer
|
||||
if ( strpos($sposte,',') != 0 ) {
|
||||
$array=explode(',',$sposte);
|
||||
$poste_val=$array[0];
|
||||
} else {
|
||||
$poste_val=$sposte;
|
||||
}
|
||||
|
||||
$acc_pay=new Acc_Operation($this->db);
|
||||
/* The account exists */
|
||||
$poste=new Acc_Account_Ledger($this->db,$poste_val);
|
||||
if ( $poste->load() == false ){
|
||||
throw new Exception('Pour la fiche '.$e_bank_account.' le poste comptable ['.$poste->id.'] n\'existe pas',9);
|
||||
}
|
||||
|
||||
/* Check if the card belong to the ledger */
|
||||
$fiche=new Fiche ($this->db);
|
||||
$fiche->get_by_qcode($e_bank_account);
|
||||
if ( $fiche->belong_ledger($p_jrn,'deb') !=1 )
|
||||
throw new Exception('La fiche '.$e_bank_account.'n\'est pas accessible à ce journal',10);
|
||||
|
||||
$nb=0;
|
||||
$tot_amount=0;
|
||||
|
|
@ -158,7 +143,7 @@ class Acc_Ledger_Fin extends Acc_Ledger {
|
|||
/* Check if the card belong to the ledger */
|
||||
$fiche=new Fiche ($this->db);
|
||||
$fiche->get_by_qcode(${'e_other'.$i});
|
||||
if ( $fiche->belong_ledger($p_jrn,'cred') !=1 )
|
||||
if ( $fiche->belong_ledger($p_jrn,'deb') !=1 )
|
||||
throw new Exception('La fiche '.${'e_other'.$i}.'n\'est pas accessible à ce journal',10);
|
||||
$nb++;
|
||||
}
|
||||
|
|
@ -243,9 +228,8 @@ class Acc_Ledger_Fin extends Acc_Ledger {
|
|||
// Ledger (p_jrn)
|
||||
//--
|
||||
$add_js="";
|
||||
$owner=new Own($this->db);
|
||||
|
||||
if ( $owner->MY_PJ_SUGGEST == 'Y') $add_js="onchange='update_pj();'";
|
||||
|
||||
if ( $owner->MY_PJ_SUGGEST == 'Y') $add_js="onchange='update_pj();update_bank();get_last_date();'";
|
||||
|
||||
$wLedger=$this->select_ledger('FIN',2);
|
||||
$wLedger->javascript=$add_js;
|
||||
|
|
@ -255,38 +239,10 @@ class Acc_Ledger_Fin extends Acc_Ledger {
|
|||
$label=" Journal ".HtmlInput::infobulle(2) ;
|
||||
$f_jrn=$label.$wLedger->input();
|
||||
|
||||
//retrieve bank name
|
||||
$e_bank_account=( isset ($e_bank_account) )?$e_bank_account:"";
|
||||
$e_bank_account_label="";
|
||||
|
||||
// retrieve bank name, code and account from the jrn_def.jrn_def_bank
|
||||
|
||||
// retrieve e_bank_account_label
|
||||
if ( $e_bank_account != "" ) {
|
||||
$fBank=new Fiche($this->db);
|
||||
$fBank->get_by_qcode($e_bank_account);
|
||||
$e_bank_account_label=$fBank->strAttribut(ATTR_DEF_NAME).' '.
|
||||
' Adresse : '.$fBank->strAttribut(ATTR_DEF_ADRESS).' '.
|
||||
$fBank->strAttribut(ATTR_DEF_CP).' '.
|
||||
$fBank->strAttribut(ATTR_DEF_CITY).' ';
|
||||
|
||||
}
|
||||
$f_bank=$e_bank_account.$e_bank_account_label;
|
||||
|
||||
$ibank=new ICard();
|
||||
$ibank->readonly=$pview_only;
|
||||
$ibank->label="Banque ".HtmlInput::infobulle(0);
|
||||
$ibank->name="e_bank_account";
|
||||
$ibank->value=$e_bank_account;
|
||||
$ibank->extra='deb'; // credits
|
||||
$ibank->typecard='deb';
|
||||
$ibank->set_dblclick("fill_ipopcard(this);");
|
||||
$ibank->set_attribute('ipopup','ipopcard');
|
||||
|
||||
// name of the field to update with the name of the card
|
||||
$ibank->set_attribute('label','e_bank_account_label');
|
||||
// Add the callback function to filter the card on the jrn
|
||||
$ibank->set_callback('filter_card');
|
||||
$ibank->set_function('fill_fin_data');
|
||||
$ibank->javascript=sprintf(' onchange="fill_fin_data_onchange(this);" ');
|
||||
$f_bank='<span id="bkname">'.$this->get_bank_name().'</span>';
|
||||
|
||||
$f_legend_detail='Opérations financières';
|
||||
//--------------------------------------------------
|
||||
|
|
@ -443,15 +399,10 @@ class Acc_Ledger_Fin extends Acc_Ledger {
|
|||
$r.='</tr>';
|
||||
|
||||
//retrieve bank name
|
||||
$e_bank_account=( isset ($e_bank_account) )?$e_bank_account:"";
|
||||
$e_bank_account_label="";
|
||||
$bk_id=$this->get_bank();
|
||||
|
||||
$fBank=new Fiche($this->db);
|
||||
$fBank->get_by_qcode($e_bank_account);
|
||||
$e_bank_account_label=$fBank->strAttribut(ATTR_DEF_NAME).' '.
|
||||
' Adresse : '.$fBank->strAttribut(ATTR_DEF_ADRESS).' '.
|
||||
$fBank->strAttribut(ATTR_DEF_CP).' '.
|
||||
$fBank->strAttribut(ATTR_DEF_CITY).' ';
|
||||
$fBank=new Fiche($this->db,$bk_id);
|
||||
$e_bank_account_label=$this->get_bank_name();
|
||||
|
||||
$filter_year=" j_tech_per in (select p_id from parm_periode where p_exercice='".$exercice."')";
|
||||
|
||||
|
|
@ -551,7 +502,6 @@ class Acc_Ledger_Fin extends Acc_Ledger {
|
|||
$r.=HtmlInput::hidden('nb_item',$nb_item);
|
||||
$r.=HtmlInput::hidden('last_sold',$last_sold);
|
||||
$r.=HtmlInput::hidden('first_sold',$first_sold);
|
||||
$r.=HtmlInput::hidden('e_bank_account',$e_bank_account);
|
||||
$r.=HtmlInput::hidden('e_pj',$e_pj);
|
||||
$r.=HtmlInput::hidden('e_pj_suggest',$e_pj_suggest);
|
||||
$r.=HtmlInput::hidden('e_date',$e_date);
|
||||
|
|
@ -582,16 +532,17 @@ class Acc_Ledger_Fin extends Acc_Ledger {
|
|||
extract ($p_array);
|
||||
$ret='';
|
||||
// Debit = banque
|
||||
$bank_id=$this->get_bank();
|
||||
$fBank=new Fiche($this->db,$bank_id);
|
||||
$e_bank_account=$fBank->strAttribut(ATTR_DEF_QUICKCODE);
|
||||
|
||||
$fBank=new Fiche($this->db);
|
||||
$fBank->get_by_qcode($e_bank_account);
|
||||
// Get the saldo
|
||||
$pPeriode=new Periode($this->db);
|
||||
if ( $this->check_periode() == true ) {
|
||||
$pPeriode->p_id=$periode;
|
||||
} else {
|
||||
$pPeriode->find_periode($e_date);
|
||||
}
|
||||
if ( $this->check_periode() == true ) {
|
||||
$pPeriode->p_id=$periode;
|
||||
} else {
|
||||
$pPeriode->find_periode($e_date);
|
||||
}
|
||||
$exercice=$pPeriode->get_exercice();
|
||||
|
||||
$filter_year=" j_tech_per in (select p_id from parm_periode where p_exercice='".$exercice."')";
|
||||
|
|
@ -915,5 +866,19 @@ class Acc_Ledger_Fin extends Acc_Ledger {
|
|||
|
||||
|
||||
|
||||
}
|
||||
function get_bank_name() {
|
||||
$bank_id=$this->db->get_value('select jrn_def_bank from jrn_def where jrn_def_id=$1',
|
||||
array($this->id));
|
||||
$fBank=new Fiche($this->db,$bank_id);
|
||||
$e_bank_account=" : ".$fBank->strAttribut(ATTR_DEF_BQ_NO);
|
||||
$e_bank_name=" : ".$fBank->strAttribut(ATTR_DEF_NAME);
|
||||
$e_bank_qcode=": ".$fBank->strAttribut(ATTR_DEF_QUICKCODE);
|
||||
return $e_bank_qcode.$e_bank_name.$e_bank_account;
|
||||
}
|
||||
function get_bank() {
|
||||
$bank_id=$this->db->get_value('select jrn_def_bank from jrn_def where jrn_def_id=$1',
|
||||
array($this->id));
|
||||
return $bank_id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,17 +23,6 @@
|
|||
/*!\file
|
||||
* \brief this file is to be included to handle the financial ledger
|
||||
*/
|
||||
echo js_include('prototype.js');
|
||||
echo js_include('scriptaculous.js');
|
||||
echo js_include('effects.js');
|
||||
echo js_include('controls.js');
|
||||
echo JS_INFOBULLE;
|
||||
echo js_include('acc_ledger.js');
|
||||
echo js_include('ajax_fiche.js');
|
||||
echo JS_CARD;
|
||||
echo js_include('accounting_item.js');
|
||||
echo js_include('dragdrop.js');
|
||||
echo js_include('acc_ledger.js');
|
||||
require_once ('class_acc_ledger_fin.php');
|
||||
require_once('class_ipopup.php');
|
||||
$pop_tva=new IPopup('popup_tva');
|
||||
|
|
@ -179,7 +168,7 @@ if ( $def == 1 ) {
|
|||
echo HtmlInput::submit('save',_('Sauve'));
|
||||
echo HtmlInput::reset(_('Effacer'));
|
||||
|
||||
|
||||
echo create_script(" get_last_date()");
|
||||
exit();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@ require_once ('class_acc_ledger.php');
|
|||
|
||||
/* ipopup for search poste */
|
||||
echo IPoste::ipopup('ipop_account');
|
||||
/* search card */
|
||||
$search_card=new IPopup('ipop_card');
|
||||
$search_card->title=_('Recherche de fiche');
|
||||
echo $search_card->input();
|
||||
|
||||
html_page_start($_SESSION['g_theme']);
|
||||
require_once('class_dossier.php');
|
||||
|
|
@ -81,18 +85,33 @@ if ( isset ($_POST["add"]) ) {
|
|||
}
|
||||
$l_cred_max_line=$l_deb_max_line;
|
||||
$cn->start();
|
||||
$bank=null;
|
||||
if (isset($_POST['bank'])) {
|
||||
$a=new Fiche($cn);
|
||||
$a->get_by_qcode(trim(strtoupper($_POST['bank'])),false);
|
||||
$bank=$a->id;
|
||||
if ($bank==0) $bank=null;
|
||||
}
|
||||
|
||||
if ($_POST['p_jrn_type']=='FIN' && $bank==null)
|
||||
{
|
||||
alert("Vous devez donner un compte en banque");
|
||||
} else {
|
||||
|
||||
$Sql="insert into jrn_def(jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_deb_max_line,jrn_cred_max_line,
|
||||
jrn_def_type,jrn_def_fiche_deb,jrn_def_fiche_cred,jrn_def_code,jrn_def_pj_pref)
|
||||
values ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)";
|
||||
jrn_def_type,jrn_def_fiche_deb,jrn_def_fiche_cred,jrn_def_code,jrn_def_pj_pref,jrn_def_bank)
|
||||
values ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)";
|
||||
$sql_array=array(
|
||||
$p_jrn_name,$p_jrn_class_deb,$p_jrn_class_deb,
|
||||
$l_deb_max_line,$l_cred_max_line,$_POST['p_jrn_type'],
|
||||
$p_jrn_fiche_deb,$p_jrn_fiche_cred,
|
||||
$p_code,$_POST['jrn_def_pj_pref']);
|
||||
$p_code,$_POST['jrn_def_pj_pref'],
|
||||
$bank);
|
||||
$Res=$cn->exec_sql($Sql,$sql_array);
|
||||
$ledger_id=$cn->get_current_seq('s_jrn_def');
|
||||
$Res=$cn->create_sequence('s_jrn_pj'.$ledger_id);
|
||||
$cn->commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '<div class="lmenu">';
|
||||
|
|
@ -142,10 +161,14 @@ $wPjPref->name='jrn_def_pj_pref';
|
|||
$pj_pref=$wPjPref->input();
|
||||
$pj_seq='';
|
||||
$last_seq=0;
|
||||
$new=true;
|
||||
/* bank card */
|
||||
$qcode_bank='';
|
||||
|
||||
echo '<FORM METHOD="POST">';
|
||||
echo dossier::hidden();
|
||||
echo HtmlInput::hidden('p_action','jrn');
|
||||
echo HtmlInput::hidden('p_jrn',-1);
|
||||
echo HtmlInput::hidden('sa','add');
|
||||
require_once('template/param_jrn.php');
|
||||
echo HtmlInput::submit('add','Sauver');
|
||||
|
|
|
|||
|
|
@ -29,7 +29,10 @@ require_once('class_ipopup.php');
|
|||
|
||||
/* ipopup for search poste */
|
||||
echo IPoste::ipopup('ipop_account');
|
||||
|
||||
/* search card */
|
||||
$search_card=new IPopup('ipop_card');
|
||||
$search_card->title=_('Recherche de fiche');
|
||||
echo $search_card->input();
|
||||
$gDossier=dossier::id();
|
||||
|
||||
include_once ("ac_common.php");
|
||||
|
|
@ -55,13 +58,16 @@ if ( isset( $_REQUEST['p_jrn'] )) {
|
|||
// remove ledger
|
||||
//--------------------------------------------------
|
||||
if ( isset($_POST["efface"])) {
|
||||
if ( $cn->count_sql("select * from jrn where jr_def_id=".$_POST['p_jrn']." limit 3") == 0 )
|
||||
{
|
||||
$cn->exec_sql("delete from jrn_def where jrn_def_id=$1",array($_POST['p_jrn']));
|
||||
} else {
|
||||
alert(_("Impossible d\'effacer ce journal.\n Il est utilisé\n"));
|
||||
}
|
||||
if ( isNumber($_POST['p_jrn'])==0) {
|
||||
alert(_("Impossible d\'effacer ce journal.\n Il est utilisé\n"));
|
||||
}
|
||||
else if ( $cn->get_value("select count(*) from jrn where jr_def_id=$1",array($_POST['p_jrn'])) == 0 )
|
||||
{
|
||||
$cn->exec_sql("delete from jrn_def where jrn_def_id=$1",array($_POST['p_jrn']));
|
||||
} else {
|
||||
alert(_("Impossible d\'effacer ce journal.\n Il est utilisé\n"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------
|
||||
|
|
@ -94,28 +100,44 @@ If ( isset ($_POST["update"] )) {
|
|||
$p_jrn_name=FormatString($p_jrn_name);
|
||||
$p_jrn_fiche_deb="";
|
||||
$p_jrn_fiche_cred="";
|
||||
|
||||
if ( isset ($_POST["FICHEDEB"])) {
|
||||
$bank=null;
|
||||
if (isset($_POST['bank'])) {
|
||||
$a=new Fiche($cn);
|
||||
$a->get_by_qcode(trim(strtoupper($_POST['bank'])),false);
|
||||
$bank=$a->id;
|
||||
if ($bank==0) $bank=null;
|
||||
}
|
||||
$err=0;
|
||||
if ($_POST['p_jrn_type']=='FIN' && $bank==null)
|
||||
{
|
||||
alert("Vous devez donner un compte en banque");
|
||||
$err=1;
|
||||
}
|
||||
if ( isset ($_POST["FICHEDEB"])) {
|
||||
$p_jrn_fiche_deb=join(",",$_POST["FICHEDEB"]);
|
||||
}
|
||||
if ( isset ($_POST["FICHECRED"])) {
|
||||
$p_jrn_fiche_cred=join(",",$_POST["FICHECRED"]);
|
||||
}
|
||||
$Sql="update jrn_def set jrn_def_name=$1,jrn_def_class_deb=$2,jrn_def_class_cred=$3,
|
||||
if ($err==0) {
|
||||
$p_jrn_class_deb=(isset($_POST['p_jrn_class_deb']))?$_POST['p_jrn_class_deb']:'';
|
||||
$Sql="update jrn_def set jrn_def_name=$1,jrn_def_class_deb=$2,jrn_def_class_cred=$3,
|
||||
jrn_deb_max_line=$4,jrn_cred_max_line=$5,jrn_def_ech=$6,jrn_def_ech_lib=$7,jrn_def_fiche_deb=$8,
|
||||
jrn_def_fiche_cred=$9, jrn_def_pj_pref=upper($10)
|
||||
jrn_def_fiche_cred=$9, jrn_def_pj_pref=upper($10), jrn_def_bank=$12
|
||||
where jrn_def_id=$11";
|
||||
$sql_array=array(
|
||||
$p_jrn_name,$_POST['p_jrn_class_deb'],$_POST['p_jrn_class_deb'],
|
||||
$p_jrn_name,$p_jrn_class_deb,$p_jrn_class_deb,
|
||||
$l_deb_max_line,$l_cred_max_line,
|
||||
$p_ech,$p_ech_lib,
|
||||
$p_jrn_fiche_deb,$p_jrn_fiche_cred,
|
||||
$_POST['jrn_def_pj_pref'],
|
||||
$_GET['p_jrn']
|
||||
$_GET['p_jrn'],
|
||||
$bank
|
||||
);
|
||||
$Res=$cn->exec_sql($Sql,$sql_array);
|
||||
if ( isNumber($_POST['jrn_def_pj_seq']) == 1 && $_POST['jrn_def_pj_seq']!=0)
|
||||
$Res=$cn->alter_seq("s_jrn_pj".$_GET['p_jrn'],$_POST['jrn_def_pj_seq']);
|
||||
$Res=$cn->exec_sql($Sql,$sql_array);
|
||||
if ( isNumber($_POST['jrn_def_pj_seq']) == 1 && $_POST['jrn_def_pj_seq']!=0)
|
||||
$Res=$cn->alter_seq("s_jrn_pj".$_GET['p_jrn'],$_POST['jrn_def_pj_seq']);
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '<div class="lmenu">';
|
||||
|
|
@ -132,6 +154,7 @@ echo '</div>';
|
|||
$Res=$cn->exec_sql("select jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,".
|
||||
"jrn_deb_max_line,jrn_cred_max_line,jrn_def_code".
|
||||
",jrn_def_type,jrn_def_ech, jrn_def_ech_lib,jrn_def_fiche_deb,jrn_def_fiche_cred".
|
||||
",jrn_def_bank".
|
||||
" from jrn_def where".
|
||||
" jrn_def_id=".$_REQUEST['p_jrn']);
|
||||
if ( Database::num_row($Res) == 0 ) exit();
|
||||
|
|
@ -156,7 +179,7 @@ $wSearch->name="p_jrn_class_deb";
|
|||
$wSearch->size=20;
|
||||
$wSearch->value=$prop['jrn_def_class_deb'];
|
||||
$search=$wSearch->input();
|
||||
|
||||
$new=false;
|
||||
|
||||
$wPjPref=new IText();
|
||||
$wPjPref->name='jrn_def_pj_pref';
|
||||
|
|
@ -176,13 +199,22 @@ $hidden.= HtmlInput::hidden('sa','detail');
|
|||
$hidden.= dossier::hidden();
|
||||
$hidden.=HtmlInput::hidden('p_jrn_deb_max_line',10);
|
||||
$hidden.=HtmlInput::hidden('p_ech_lib','echeance');
|
||||
$hidden.=HtmlInput::hidden('p_jrn_type',$type);
|
||||
|
||||
/* Load the card */
|
||||
$card=$Ledger->get_fiche_def();
|
||||
$rdeb=explode(',',$card['deb']);
|
||||
$rcred=explode(',',$card['cred']);
|
||||
|
||||
|
||||
/* bank card */
|
||||
$qcode_bank='';
|
||||
if ( $type=='FIN') {
|
||||
$f_id=$l_line['jrn_def_bank'];
|
||||
if ( isNumber($f_id)==1){
|
||||
$fBank=new Fiche($cn,$f_id);
|
||||
$qcode_bank=$fBank->get_quick_code();
|
||||
}
|
||||
}
|
||||
echo '<div class="u_redcontent">';
|
||||
echo '<form method="POST">';
|
||||
echo $hidden;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<?=_('Date').' '.$f_date ?>
|
||||
<?=$f_period?><br>
|
||||
<?=$f_jrn?><br>
|
||||
<?=_('Banque')?><?=$ibank->input(); ?><?=$ibank->search()?> <span id='e_bank_account_label'><?$f_bank_label?></span>
|
||||
<?=_('Banque')?><?=$f_bank ?>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
|
|
|
|||
|
|
@ -2,14 +2,53 @@
|
|||
<TR>
|
||||
|
||||
<TD><?=_('Nom journal')?> </TD>
|
||||
<TD> <INPUT TYPE="text" NAME="p_jrn_name" VALUE="<?php echo $name; ?>"></TD>
|
||||
<TD> <INPUT TYPE="text" class="input_text" NAME="p_jrn_name" VALUE="<?php echo $name; ?>"></TD>
|
||||
</TR>
|
||||
<?
|
||||
if ($new || $type=='ODS' ):
|
||||
?>
|
||||
<TR>
|
||||
<td><?=_('Postes utilisables journal (débit/crédit)')?>
|
||||
<td><?=_('Postes utilisables journal (débit/crédit) ')?>
|
||||
</TD>
|
||||
<td>
|
||||
<?php echo $search;?>
|
||||
</TD>
|
||||
<TD CLASS="notice">
|
||||
<?=_("Uniquement pour les journaux d'Opérations Diverses")?>
|
||||
</TD>
|
||||
</TR>
|
||||
<?
|
||||
endif;
|
||||
?>
|
||||
<?
|
||||
if ( $new || $type=='FIN') {
|
||||
?>
|
||||
<tr>
|
||||
<TD>
|
||||
<?=_('Compte en banque')?>
|
||||
</td>
|
||||
<TD>
|
||||
<?
|
||||
$card=new ICard();
|
||||
$card->name='bank';
|
||||
$card->extra=$cn->make_list('select fd_id from fiche_def where frd_id=4');
|
||||
$card->set_dblclick("fill_ipopcard(this);");
|
||||
$card->set_function('fill_data');
|
||||
$card->set_attribute('ipopup','ipop_card');
|
||||
$list=$cn->make_list('select fd_id from fiche_def where frd_id=4');
|
||||
$card->set_attribute('typecard',$list);
|
||||
|
||||
$card->value=$qcode_bank;
|
||||
echo $card->search();
|
||||
echo $card->input();
|
||||
?>
|
||||
</td>
|
||||
<td class="notice">
|
||||
<?=_("Obligatoire pour les journaux FIN : donner ici la fiche de la banque utilisée")?>
|
||||
</td>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</TR>
|
||||
<tr>
|
||||
<td><INPUT TYPE="hidden" id="p_jrn_deb_max_line" NAME="p_jrn_deb_max_line" VALUE="10"></td>
|
||||
|
|
@ -19,6 +58,7 @@
|
|||
</tr>
|
||||
<tr><td><INPUT TYPE="hidden" id="p_ech_lib" NAME="p_ech_lib" VALUE="echeance"></td>
|
||||
</tr>
|
||||
|
||||
<TR>
|
||||
<TD><?=_('Type de journal')?> </TD>
|
||||
<TD>
|
||||
|
|
@ -55,19 +95,26 @@
|
|||
<TD>
|
||||
<?php echo $pj_seq; ?>
|
||||
</TD>
|
||||
<TD>
|
||||
<span class="notice"><?=_('La numérotation est propre à chaque journal')?></span>
|
||||
<span class="notice"><?=_('Laissez à 0 pour ne pas changer le numéro')?></span>
|
||||
</TD>
|
||||
|
||||
</TR>
|
||||
<TD>
|
||||
<span class="notice" style="display:block"><?=_('La numérotation est propre à chaque journal')?></span>
|
||||
<span class="notice" style="display:block"><?=_('Laissez à 0 pour ne pas changer le numéro')?></span>
|
||||
</TD>
|
||||
</tr>
|
||||
|
||||
|
||||
</TABLE>
|
||||
<H2 class="info"> Fiches </H2>
|
||||
<TABLE width="100%">
|
||||
<TR>
|
||||
|
||||
<?
|
||||
if ( $new || ($type != 'ODS' && $type != 'FIN')) {
|
||||
?>
|
||||
<th><?=_('Fiches Débit')?></TH>
|
||||
<th><?=_('Fiches Crédit')?></TH>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</TR>
|
||||
<?php
|
||||
// Show the fiche in deb section
|
||||
|
|
@ -93,9 +140,10 @@ for ($i=0;$i<$num;$i++) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $type != 'ODS' && $type != 'FIN' ){
|
||||
printf ('<TD> <INPUT TYPE="CHECKBOX" VALUE="%s" NAME="FICHECRED[]" %s>%s</TD>',
|
||||
$res['fd_id'],$CHECKED,$res['fd_label']);
|
||||
}
|
||||
echo '</TR>';
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ commence à 10000, afin de ne pas mélanger les attributs que je créé avec ceu
|
|||
28. Dans les balances, on peut choisir plusieurs journaux ou plusieurs cat. de journal. Les données sont filtrées en plus d'après la sécurité
|
||||
29. Dans impression -> poste, on peut filtrer les opérations suivant qu'elles sont lettrées ou non.
|
||||
30. Après avoir sauvé une opération, vous pouvez avoir le détail de l'opération en cliquant sur le numéro interne qui s'affiche
|
||||
31. Les journaux FIN doivent être attachés à un compte en banque et uniquement un A propos du mode de paiement : on ne change rien mais il faut que dans la doc, il est précisé qu'il faut paramètrer le mdp comme le journal FIN
|
||||
|
||||
|
||||
IDEE1 Pièce attachée uniquement depuis détail opération ?
|
||||
|
||||
|
|
|
|||
|
|
@ -122,4 +122,6 @@ end;
|
|||
$BODY$
|
||||
LANGUAGE 'plpgsql' VOLATILE;
|
||||
|
||||
select correct_quant_sale() ;
|
||||
select correct_quant_sale() ;
|
||||
|
||||
ALTER TABLE jrn_def ADD COLUMN jrn_def_bank bigint;
|
||||
Loading…
Add table
Add a link
Reference in a new issue