improve #jrn_name +(div)

improve appearance predefined operation
finish financial ledger
This commit is contained in:
Dany De Bontridder 2011-11-03 22:03:53 +00:00
parent 67f4d0cb0a
commit 0f3c11ef4d
19 changed files with 488 additions and 466 deletions

View file

@ -948,4 +948,11 @@ tr.footer{
span.remain {
font-weight: bold;
color:black;
}
}
div#jrn_name_div
{
float: right;
margin-right:150;
}

View file

@ -988,4 +988,16 @@ tr.footer{
span.remain {
font-weight: bold;
color:black;
}
}
div#jrn_name_div
{
float: right;
margin-right:150;
}
#predef_form {
margin-left:20%;
width:60%;
}

View file

@ -978,4 +978,12 @@ tr.footer{
span.remain {
font-weight: bold;
color:black;
}
}
div#jrn_name_div
{
float: right;
margin-right:150;
}

View file

@ -841,25 +841,31 @@ function show_menu($module, $idx)
* @todo add security
* check if user can access this module
*/
$file = $cn->get_array("select me_file,me_parameter
from menu_ref
where
me_code=$1 and
(me_file is not null or trim(me_file) <>'')", array($module[$idx]));
$file = $cn->get_array("select me_file,me_parameter
from menu_ref
where
me_code=$1 and
(me_file is not null or trim(me_file) <>'')", array($module[$idx]));
if ($file[0]['me_file'] != "")
{
if ($file[0]['me_parameter'] !== "")
{
// if there are paramter put them in superglobal
$array=compute_variable($file[0]['me_parameter']);
put_global($array);
}
echo '<div class="content">';
require_once $file[0]['me_file'];
echo '</div>';
exit();
}
if (count($file)==0)
{
echo "Configuration incorrecte pour ce module ".$module[$idx];
exit;
}
if ($file[0]['me_file'] != "")
{
if ($file[0]['me_parameter'] !== "")
{
// if there are paramter put them in superglobal
$array=compute_variable($file[0]['me_parameter']);
put_global($array);
}
echo '<div class="content">';
require_once $file[0]['me_file'];
echo '</div>';
exit();
}
}
}
/**

View file

@ -1394,7 +1394,7 @@ class Acc_Ledger
// Load the javascript
//
$ret.="<table>";
$ret.= '<tr><td>';
$ret.= '<tr ><td colspan="2" style="width:auto">';
$wDate=new IDate('e_date');
$wDate->readonly=$p_readonly;
$e_date=(isset($e_date)&&trim($e_date)!='')?$e_date:'';
@ -1443,11 +1443,12 @@ class Acc_Ledger
$default_pj=$this->guess_pj();
}
$wPJ->value=(isset($e_pj))?$e_pj:$default_pj;
$ret.='<td> '._('Pièce').' : '.$wPJ->input();
$ret.=HtmlInput::hidden('e_pj_suggest',$default_pj);
$ret.= '</td>';
$ret.= '</tr>';
$ret.='<tr >';
$ret.='<td colspan="2" style="width:auto"> '._('Pièce').' : '.$wPJ->input();
$ret.=HtmlInput::hidden('e_pj_suggest',$default_pj);
$ret.= '</tr>';
$ret.= '</td>';
$ret.= '<tr><td >'._('Libellé');
$wDescription=new IText('desc');

View file

@ -181,7 +181,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
/*!\brief
*\param $p_array contains the value usually it is $_POST
*\param $p_array contains the value usually it is $_POST
*\return string with html code
*\note the form tag are not set here
*/
@ -247,10 +247,10 @@ class Acc_Ledger_Fin extends Acc_Ledger
// Ledger (p_jrn)
//--
$add_js='onchange="update_pj();update_bank();get_last_date();ajax_saldo(\'first_sold\')";';
if ( $owner->MY_DATE_SUGGEST == 'Y')
$add_js='onchange="update_pj();update_bank();get_last_date();ajax_saldo(\'first_sold\');update_name();"';
if ( $owner->MY_DATE_SUGGEST == 'Y')
$add_js='onchange="update_pj();update_bank();get_last_date();ajax_saldo(\'first_sold\')";';
$wLedger=$this->select_ledger('FIN',2);
@ -381,7 +381,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
/*!\brief show the summary before inserting into the database, it
*calls the function for adding a attachment. The function verify
*should be called before
*\param $p_array an array usually is $_POST
*\param $p_array an array usually is $_POST
*\return string with code html
*/
public function confirm($p_array)
@ -404,6 +404,9 @@ class Acc_Ledger_Fin extends Acc_Ledger
$exercice=$pPeriode->get_exercice();
$r.='';
$r.='<fieldset><legend>Banque, caisse </legend>';
$r.= '<div id="jrn_name_div">';
$r.='<h2 id="jrn_name" style="display:inline">' . $this->get_name() . '</h2>';
$r.= '</div>';
$r.='<TABLE width="100%">';
// Date
//--
@ -516,7 +519,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
// Comment
$r.='<td style="width:40%">'.$tiers_comment.'</td>';
// amount
$r.='<td>'.$tiers_amount.'</td>';
$r.='<td class="num">'.nbm($tiers_amount).'</td>';
// concerned
$r.='<td>';
$r.=${"e_concerned".$i};
@ -583,11 +586,12 @@ class Acc_Ledger_Fin extends Acc_Ledger
}
/*!\brief save the data into the database, included the attachment,
*and the reconciliations
*\param $p_array usually $_POST
*\param $p_array usually $_POST
*\return string with HTML code
*/
public function insert($p_array)
{
bcscale(2);
$internal_code="";
$oid=0;
extract ($p_array);
@ -646,7 +650,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
${"e_other$i"."_amount"}=round( ${"e_other$i"."_amount"},2);
// Compute display
$row=td(${"e_other$i"}).td($fPoste->strAttribut(ATTR_DEF_NAME)).td(${"e_other".$i."_comment"}).td(${"e_other$i"."_amount"},'class="num"');
$row=td(${"e_other$i"}).td($fPoste->strAttribut(ATTR_DEF_NAME)).td(${"e_other".$i."_comment"}).td(nbm(${"e_other$i"."_amount"}),'class="num"');
$ret.=tr($row);
@ -800,7 +804,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
$op->oa_description=sql_string($comment);
$op->save_form_plan($_POST,$i,$j_id);
}
$this->update_internal_code($internal);
@ -843,9 +847,9 @@ class Acc_Ledger_Fin extends Acc_Ledger
}
$this->db->commit();
$r="";
$r.="<br>Ancien solde ".$solde;
$new_solde+=$amount;
$r.="<br>Nouveau solde ".$new_solde;
$r.="<br>Ancien solde ".nbm($solde);
$new_solde=bcadd($new_solde,$amount);
$r.="<br>Nouveau solde ".nbm($new_solde);
$ret.=$r;
return $ret;
}
@ -1003,7 +1007,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
{
$sql="INSERT INTO quant_fin(qf_bank, jr_id, qf_other, qf_amount)
VALUES ($1, $2, $3, $4);";
$this->db->exec_sql($sql,array($p_bankid,$p_jrid,$p_otherid,round($p_amount,2)));
}
}

View file

@ -1262,6 +1262,9 @@ class Acc_Ledger_Purchase extends Acc_Ledger
$r="";
$r.="<fieldset>";
$r.="<legend>"._('En-tête facture fournisseur')." </legend>";
$r.='<div id="jrn_name_div">';
$r.='<h2 id="jrn_name">'.$this->get_name().'</h2>';
$r.='</div>';
$r.='<TABLE width="100%">';
$r.='<tr>';
$r.='<td> '._('Date').' '.$e_date.'</td>';

View file

@ -645,6 +645,9 @@ class Acc_Ledger_Sold extends Acc_Ledger
$r="";
$r.="<fieldset>";
$r.="<legend>"._('En-tête facture client')." </legend>";
$r.='<div id="jrn_name_div">';
$r.='<h2 id="jrn_name" style="display:inline">' . $this->get_name() . '</h2>';
$r.= '</div>';
$r.='<TABLE width="100%">';
$r.='<tr>';
$r.='<td> '._('Date').' '.$e_date.'</td>';
@ -778,7 +781,7 @@ class Acc_Ledger_Sold extends Acc_Ledger
$r.='</table>';
if ( $owner->MY_ANALYTIC!='nu') // use of AA
if ( $owner->MY_ANALYTIC!='nu' && $p_summary ) // use of AA
$r.='<input type="button" class="button" value="'._('Vérifiez Imputation Analytique').'" onClick="verify_ca(\'\');">';
$r.='</fieldset>';
if (! $p_summary )

View file

@ -61,7 +61,6 @@ if (isset($_POST['view_invoice']))
{
echo '<div class="content">';
echo h2info('Confirmation');
echo '<h2 id="jrn_name">' . $Ledger->get_name() . '</h2>';
echo '<form enctype="multipart/form-data" method="post">';
echo dossier::hidden();
@ -109,8 +108,6 @@ if (isset($_POST['record']))
{
echo '<div class="content">';
echo '<h2 id="jrn_name">' . $Ledger->get_name() . '</h2>';
$Ledger = new Acc_Ledger_Purchase($cn, $_POST['p_jrn']);
$internal = $Ledger->insert($_POST);
@ -170,9 +167,9 @@ if (!isset($_REQUEST ['p_jrn']))
else
$Ledger->id = $_REQUEST ['p_jrn'];
echo '<h2 id="jrn_name">' . $Ledger->get_name() . '</h2>';
// pre defined operation
//
echo '<div id="predef_form">';
echo '<form method="GET" action="do.php">';
echo dossier::hidden();
echo HtmlInput::hidden('p_jrn_predef', $Ledger->id);
@ -182,9 +179,10 @@ $op->set('ledger', $Ledger->id);
$op->set('ledger_type', "ACH");
$op->set('direct', 'f');
echo $op->form_get();
echo '</form>';
echo '</div>';
echo '</div>';
echo '<div class="content">';
echo "<FORM class=\"print\"NAME=\"form_detail\" METHOD=\"POST\" >";
/* request for a predefined operation */

View file

@ -32,425 +32,114 @@ $gDossier=dossier::id();
$cn=new Database(dossier::id());
$menu_action="?ledger_type=fin&ac=".$_REQUEST['ac']."&".dossier::get();
$menu=array(
array($menu_action.'&sa=n',_('Nouvel extrait'),_('Encodage d\'un nouvel extrait'),1),
array($menu_action.'&sa=l',_('Liste'),_('Liste opération bancaire'),2),
array($menu_action.'&sa=s',_('Solde'),_('Solde des comptes'),3),
array($menu_action.'&sa=r',_('Rapprochements banquaires'),_('Rapprochements banquaires'),4)
);
$sa=(isset($_REQUEST['sa']))?$_REQUEST['sa']:-1;
switch ($sa)
{
case 'n':
$def=1;
break;
case 'l':
$def=2;
break;
case 's':
$def=3;
break;
case 'r':
$def=4;
break;
default:
$def=1;
}
echo '<div class="lmenu">';
echo ShowItem($menu,'H','mtitle','mtitle',$def);
echo '</div>';
$href=basename($_SERVER['PHP_SELF']);
$Ledger=new Acc_Ledger_Fin($cn,0);
//--------------------------------------------------------------------------------
// Encode a new financial operation
//--------------------------------------------------------------------------------
if ( $def == 1 )
if ( isset($_REQUEST['p_jrn']))
$Ledger->id=$_REQUEST['p_jrn'];
else
{
if ( isset($_REQUEST['p_jrn']))
$Ledger->id=$_REQUEST['p_jrn'];
else
{
$def_ledger=$Ledger->get_first('fin');
$Ledger->id=$def_ledger['jrn_def_id'];
}
$jrn_priv=$g_user->get_ledger_access($Ledger->id);
// Check privilege
if ( isset($_REQUEST['p_jrn']) && ( $jrn_priv == 'X'))
{
NoAccess();
exit -1;
}
//----------------------------------------
// Confirm the operations
//----------------------------------------
if ( isset($_POST['save']))
{
try
{
$Ledger->verify($_POST);
}
catch (Exception $e)
{
alert($e->getMessage());
$correct=1;
}
if ( ! isset ($correct ))
{
echo '<div class="content">';
echo '<form name="form_detail" class="print" enctype="multipart/form-data" ACTION="'.$href.'" METHOD="POST">';
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo $Ledger->confirm($_POST);
echo HtmlInput::submit('confirm',_('Confirmer'));
echo HtmlInput::submit('correct',_('Corriger'));
echo '</form>';
echo '</div>';
exit();
}
}
//----------------------------------------
// Confirm and save the operations
// into the database
//----------------------------------------
if ( isset($_POST['confirm']))
{
try
{
$Ledger->verify($_POST);
}
catch (Exception $e)
{
alert($e->getMessage());
$correct=1;
}
if ( !isset($correct))
{
echo '<div class="content">';
$a= $Ledger->insert($_POST);
echo '<h2 class="info" style="margin-left:20%;width:60%;margin-right:20%;">'._('Opération sauvée').' </h2>';
echo $a;
echo '</div>';
echo '<div class="content">';
echo HtmlInput::button_anchor(_('Nouvel extrait'),$href.'?ledger_type=fin&sa=n&'.dossier::get()."&ac=".$_REQUEST['ac']);
echo '</div>';
exit();
}
}
//----------------------------------------
// Correct the operations
//----------------------------------------
if ( isset($_POST['correct']))
{
$correct=1;
}
//----------------------------------------
// Blank form
//----------------------------------------
echo '<div class="content">';
echo '<form class="print" name="form_detail" enctype="multipart/form-data" ACTION="'.$href.'" METHOD="POST">';
echo HtmlInput::hidden('ledger_type','fin');
echo HtmlInput::hidden('sa','n');
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
$array=( isset($correct))?$_POST:null;
// show select ledger
echo $Ledger->input($array);
echo HtmlInput::button('add_item',_('Ajout article'), ' onClick="ledger_fin_add_row()"');
echo HtmlInput::submit('save',_('Sauve'));
echo HtmlInput::reset(_('Effacer'));
echo create_script(" get_last_date();ajax_saldo('first_sold');");
exit();
$def_ledger=$Ledger->get_first('fin');
$Ledger->id=$def_ledger['jrn_def_id'];
}
$jrn_priv=$g_user->get_ledger_access($Ledger->id);
// Check privilege
if ( isset($_REQUEST['p_jrn']) && ( $jrn_priv == 'X'))
{
NoAccess();
exit -1;
}
//----------------------------------------
// Confirm the operations
//----------------------------------------
if ( isset($_POST['save']))
{
try
{
$Ledger->verify($_POST);
}
catch (Exception $e)
{
alert($e->getMessage());
$correct=1;
}
if ( ! isset ($correct ))
{
echo '<div class="content">';
echo '<h2 class="info">'._('Confirmation').' </h2>';
echo '<form name="form_detail" class="print" enctype="multipart/form-data" METHOD="POST">';
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo $Ledger->confirm($_POST);
echo HtmlInput::submit('confirm',_('Confirmer'));
echo HtmlInput::submit('correct',_('Corriger'));
echo '</form>';
echo '</div>';
exit();
}
}
//----------------------------------------
// Confirm and save the operations
// into the database
//----------------------------------------
if ( isset($_POST['confirm']))
{
try
{
$Ledger->verify($_POST);
}
catch (Exception $e)
{
alert($e->getMessage());
$correct=1;
}
if ( !isset($correct))
{
echo '<div id="jrn_name_div">';
echo '<h2 id="jrn_name" style="display:inline">' . $Ledger->get_name() . '</h2>';
echo '</div>';
echo '<div class="content">';
$a= $Ledger->insert($_POST);
echo '<h2 class="info">'._('Enregistrement').' </h2>';
echo '<div class="content">';
echo $a;
echo '</div>';
echo '</div>';
exit();
}
}
//----------------------------------------
// Correct the operations
//----------------------------------------
if ( isset($_POST['correct']))
{
$correct=1;
}
//----------------------------------------
// Blank form
//----------------------------------------
echo '<div class="content">';
echo '<form class="print" name="form_detail" enctype="multipart/form-data" METHOD="POST">';
echo HtmlInput::hidden('ledger_type','fin');
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
$array=( isset($correct))?$_POST:null;
// show select ledger
echo $Ledger->input($array);
echo HtmlInput::button('add_item',_('Ajout article'), ' onClick="ledger_fin_add_row()"');
echo HtmlInput::submit('save',_('Sauve'));
echo HtmlInput::reset(_('Effacer'));
echo create_script(" get_last_date();ajax_saldo('first_sold');");
exit();
//--------------------------------------------------------------------------------
// Show the listing
//--------------------------------------------------------------------------------
if ( $def == 2)
{
$Ledger=new Acc_Ledger_Fin($cn,0);
if ( !isset($_REQUEST['p_jrn']))
{
$Ledger->id=-1;
}
else
$Ledger->id=$_REQUEST['p_jrn'];
echo '<div class="content">';
echo $Ledger->display_search_form();
$p_array=$_GET;
/* by default we should the default period */
if ( ! isset($p_array['date_start']))
{
$period=$g_user->get_periode();
$per=new Periode($cn,$period);
list($date_start,$date_end)=$per->get_date_limit();
$p_array['date_start']=$date_start;
$p_array['date_end']=$date_end;
}
/* compute the sql stmt */
list($sql,$where)=$Ledger->build_search_sql($p_array);
$max_line=$cn->count_sql($sql);
$step=$_SESSION['g_pagesize'];
$page=(isset($_GET['offset']))?$_GET['page']:1;
$offset=(isset($_GET['offset']))?$_GET['offset']:0;
$bar=jrn_navigation_bar($offset,$max_line,$step,$page);
echo HtmlInput::hidden("sa","lnp");
echo dossier::hidden();
echo $bar;
list($count,$html)= $Ledger->list_operation($sql,$offset);
echo $html;
echo $bar;
/*
* Export to csv
*/
$r=HtmlInput::get_to_hidden(array('l','ac','date_start','date_end','desc','amount_min','amount_max','qcode','accounting','unpaid','gDossier','ledger_type','p_action'));
if (isset($_GET['r_jrn'])) {
foreach ($_GET['r_jrn'] as $k=>$v)
$r.=HtmlInput::hidden('r_jrn['.$k.']',$v);
}
echo '<form action="export.php" method="get">';
echo $r;
echo HtmlInput::hidden('act','CSV/histo');
echo HtmlInput::submit('viewsearch','Export vers CSV');
echo '</form>';
echo '</div>';
exit();
}
//--------------------------------------------------------------------------------
// Show the saldo
//--------------------------------------------------------------------------------
if ( $def==3)
{
require_once ('class_acc_parm_code.php');
echo '<div class="content">';
$fiche=new Fiche($cn);
$array=$fiche->get_bk_account();
echo '<div class="content">';
echo dossier::hidden();
echo '<table style="margin-left:10%;width:60%" class="result">';
echo tr(th('Quick Code').th('Compte en banque',' style="text-align:left"').th('solde opération',' style="text-align:right"')
.th('solde extrait/relevé',' style="text-align:right"')
.th('différence',' style="text-align:right"'));
// Filter the saldo
// on the current year
$filter_year=" j_tech_per in (select p_id from parm_periode where p_exercice='".$g_user->get_exercice()."')";
// for highligting tje line
$idx=0;
bcscale(2);
// for each account
for ( $i = 0; $i < count($array);$i++)
{
// get the saldo
$m=$array[$i]->get_solde_detail($filter_year);
$solde=$m['debit']-$m['credit'];
// print the result if the saldo is not equal to 0
if ( $m['debit'] != 0.0 || $m['credit'] != 0.0)
{
/* get saldo for not reconcilied operations */
$saldo_not_reconcilied=$array[$i]->get_bk_balance($filter_year." and (trim(jr_pj_number) ='' or jr_pj_number is null)" );
/* get saldo for reconcilied operation */
$saldo_reconcilied=$array[$i]->get_bk_balance($filter_year." and ( trim(jr_pj_number) != '' and jr_pj_number is not null)" );
if ( $idx%2 != 0 )
$odd="odd";
else
$odd="";
$idx++;
echo "<tr class=\"$odd\">";
echo "<TD >".
IButton::history_card($array[$i]->id,$array[$i]->strAttribut(ATTR_DEF_QUICKCODE)).
"</TD>";
$saldo_rec=bcsub($saldo_reconcilied['debit'],$saldo_reconcilied['credit']);
$diff=bcsub($saldo_not_reconcilied['debit'],$saldo_not_reconcilied['credit']);
echo "<TD >".
$array[$i]->strAttribut(ATTR_DEF_NAME).
"</TD>".
"<TD align=\"right\">".
nbm($solde).
"</TD>".
"<TD align=\"right\">".
nbm($saldo_rec).
"</TD>".
"<TD align=\"right\">".
nbm($diff).
"</TD>".
"</TR>";
}
}// for
echo "</table>";
echo "</div>";
exit();
}
//--------------------------------------------------
// Reconcilied
//--------------------------------------------------
if ($def==4)
{
echo '<div class="content">';
$Ledger=new Acc_Ledger_Fin($cn,0);
if ( !isset($_REQUEST['p_jrn']))
{
$a=$Ledger->get_first('fin');
$Ledger->id=$a['jrn_def_id'];
}
else
$Ledger->id=$_REQUEST['p_jrn'];
$jrn_priv=$g_user->get_ledger_access($Ledger->id);
if ( isset($_GET["p_jrn"]) && $jrn_priv=="X")
{
NoAccess();
exit();
}
//-------------------------
// save
//-------------------------
if (isset ($_POST['save']))
{
if (trim($_POST['ext']) != '' && isset($_POST['op']))
{
$array=$_POST['op'];
$tot=0;
for ($i=0;$i<count($array);$i++)
{
$cn->exec_sql('update jrn set jr_pj_number=$1 where jr_id=$2',
array($_POST['ext'],$array[$i]));
$tot=bcadd($tot,$cn->get_value('select qf_amount from quant_fin where jr_id=$1',array($array[$i])));
}
$diff=bcsub($_POST['start_extrait'],$_POST['end_extrait']);
if ( $diff != 0 && $diff != $tot )
{
echo_warning("D'après l'extrait il y aurait du avoir un montant de $diff à rapprocher alors qu'il n'y a que $tot rapprochés");
}
}
}
//-------------------------
// show the operation of this ledger
// without receipt number
//-------------------------
echo '<div class="content">';
echo '<form method="get">';
echo HtmlInput::get_to_hidden(array('gDossier','ledger_type','ac','sa'));
$wLedger=$Ledger->select_ledger('FIN',3);
if ($wLedger == null ) exit ('Pas de journal disponible');
$wLedger->javascript="onchange='this.form.submit()';";
echo $wLedger->input();
echo HtmlInput::submit('ref','Rafraîchir');
echo '</form>';
echo '<form method="post" id="rec1">';
echo dossier::hidden();
echo HtmlInput::get_to_hidden(array('sa','p_action','p_jrn'));
$operation=$cn->get_array("select jr_id,jr_internal,jr_comment,to_char(jr_date,'DD.MM.YYYY') as fmt_date,jr_montant
from jrn where jr_def_id=$1 and (jr_pj_number is null or jr_pj_number='') order by jr_date",
array($Ledger->id));
echo '<span id="bkname">'.hb(h($Ledger->get_bank_name())).'</span>';
echo '<p>';
$iextrait=new IText('ext');
$iextrait->value=$Ledger->guess_pj();
$nstart_extrait=new INum('start_extrait');
$nend_extrait=new INum('end_extrait');
echo "Extrait / relevé :".$iextrait->input();
echo 'solde Début'.$nstart_extrait->input();
echo 'solde Fin'.$nend_extrait->input();
echo IButton::tooggle_checkbox('rec1');
echo '</p>';
echo '<table class="result" style="width:80%;margin-left:10%">';
$r=th('Date');
$r.=th('Libellé');
$r.=th('N° interne');
$r.=th('Montant',' style="text-align:right"');
$r.=th('Selection',' style="text-align:center" ');
echo tr($r);
$iradio=new ICheckBox('op[]');
$tot_not_reconcilied=0;
$diff=0;
for ($i=0;$i<count($operation);$i++)
{
$row=$operation[$i];
$r='';
$js=HtmlInput::detail_op($row['jr_id'],$row['jr_internal']);
$r.=td($row['fmt_date']);
$r.=td($row['jr_comment']);
$r.=td($js);
$r.=td(sprintf("%.2f",$row['jr_montant']),' class="num" ');
$tot_not_reconcilied+=$row['jr_montant'];
$diff+=$cn->get_value('select qf_amount from quant_fin where jr_id=$1',array($row['jr_id']));
$iradio->value=$row['jr_id'];
$r.=td(HtmlInput::hidden('jrid[]',$row['jr_id']).$iradio->input(),' style="text-align:center" ');
if ( $i % 2 == 0 )
echo tr($r,' class="odd" ');
else
echo tr($r);
}
echo '</table>';
$bk_card=new Fiche($cn);
$bk_card->id=$Ledger->get_bank();
$filter_year=" j_tech_per in (select p_id from parm_periode where p_exercice='".$g_user->get_exercice()."')";
/* get saldo for not reconcilied operations */
$saldo_not_reconcilied=$bk_card->get_solde_detail($filter_year." and j_grpt in (select jr_grpt_id from jrn where trim(jr_pj_number) ='' or jr_pj_number is null)" );
/* get saldo for reconcilied operation */
$saldo_reconcilied=$bk_card->get_solde_detail($filter_year." and j_grpt in (select jr_grpt_id from jrn where trim(jr_pj_number) != '' and jr_pj_number is not null)" );
/* solde compte */
$saldo=$bk_card->get_solde_detail($filter_year);
echo '<table>';
echo '<tr>';
echo td("Solde compte ");
echo td(sprintf('%.2f',($saldo['debit']-$saldo['credit'])),' style="text-align:right"');
echo '</tr>';
echo '<tr>';
echo td("Solde non rapproché ");
echo td(sprintf('%.2f',($saldo_not_reconcilied['debit']-$saldo_not_reconcilied['credit'])),' style="text-align:right"');
echo '</tr>';
echo '<tr>';
echo td("Solde rapproché ");
echo td(sprintf('%.2f',($saldo_reconcilied['debit']-$saldo_reconcilied['credit'])),' style="text-align:right"');
echo '</tr>';
echo '<tr>';
echo td("Total montant ");
echo td(sprintf('%.2f',($tot_not_reconcilied)),' style="text-align:right"');
echo '</tr>';
echo '</table>';
echo HtmlInput::submit('save','Mettre à jour le n° de relevé banquaire');
echo '</form>';
echo '</div>';
exit();
}
exit();

View file

@ -0,0 +1,179 @@
<?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 reconcile operation
*
*/
require_once 'class_acc_ledger_fin.php';
echo '<div class="content">';
$Ledger = new Acc_Ledger_Fin($cn, 0);
if (!isset($_REQUEST['p_jrn']))
{
$a = $Ledger->get_first('fin');
$Ledger->id = $a['jrn_def_id'];
}
else
$Ledger->id = $_REQUEST['p_jrn'];
$jrn_priv = $g_user->get_ledger_access($Ledger->id);
if (isset($_GET["p_jrn"]) && $jrn_priv == "X")
{
NoAccess();
exit();
}
//-------------------------
// save
//-------------------------
if (isset($_POST['save']))
{
if (trim($_POST['ext']) != '' && isset($_POST['op']))
{
$array = $_POST['op'];
$tot = 0;
$cn->start();
for ($i = 0; $i < count($array); $i++)
{
$cn->exec_sql('update jrn set jr_pj_number=$1 where jr_id=$2', array($_POST['ext'], $array[$i]));
$tot = bcadd($tot, $cn->get_value('select qf_amount from quant_fin where jr_id=$1', array($array[$i])));
}
$diff = bcsub($_POST['start_extrait'], $_POST['end_extrait']);
if ($diff != 0 && $diff != $tot)
{
$cn->rollback();
alert("D'après l'extrait il y aurait du avoir un montant de $diff à rapprocher alors qu'il y a $tot rapprochés, mise à jour annulée");
}
$cn->commit();
}
}
//-------------------------
// show the operation of this ledger
// without receipt number
//-------------------------
echo '<div class="content">';
echo '<form method="get">';
echo HtmlInput::get_to_hidden(array('gDossier', 'ledger_type', 'ac', 'sa'));
$wLedger = $Ledger->select_ledger('FIN', 3);
if ($wLedger == null)
exit('Pas de journal disponible');
echo '<div id="jrn_name_div">';
echo '<h2 id="jrn_name" style="display:inline">' . $Ledger->get_name() . '</h2>';
echo '</div>';
$wLedger->javascript = "onchange='this.form.submit()';";
echo $wLedger->input();
echo HtmlInput::submit('ref', 'Rafraîchir');
echo '</form>';
echo '<form method="post" id="rec1">';
echo dossier::hidden();
echo HtmlInput::get_to_hidden(array('sa', 'p_action', 'p_jrn'));
$operation = $cn->get_array("select jr_id,jr_internal,jr_comment,to_char(jr_date,'DD.MM.YYYY') as fmt_date,jr_montant
from jrn where jr_def_id=$1 and (jr_pj_number is null or jr_pj_number='') order by jr_date", array($Ledger->id));
echo '<span id="bkname">' . hb(h($Ledger->get_bank_name())) . '</span>';
echo '<p>';
$iextrait = new IText('ext');
$iextrait->value = $Ledger->guess_pj();
$nstart_extrait = new INum('start_extrait');
$nend_extrait = new INum('end_extrait');
echo "Extrait / relevé :" . $iextrait->input();
echo 'solde Début' . $nstart_extrait->input();
echo 'solde Fin' . $nend_extrait->input();
echo IButton::tooggle_checkbox('rec1');
echo '</p>';
echo '<table class="result" style="width:80%;margin-left:10%">';
$r = th('Date');
$r.=th('Libellé');
$r.=th('N° interne');
$r.=th('Montant', ' style="text-align:right"');
$r.=th('Selection', ' style="text-align:center" ');
echo tr($r);
$iradio = new ICheckBox('op[]');
$tot_not_reconcilied = 0;
$diff = 0;
for ($i = 0; $i < count($operation); $i++)
{
$row = $operation[$i];
$r = '';
$js = HtmlInput::detail_op($row['jr_id'], $row['jr_internal']);
$r.=td($row['fmt_date']);
$r.=td($row['jr_comment']);
$r.=td($js);
$r.=td(sprintf("%.2f", $row['jr_montant']), ' class="num" ');
$tot_not_reconcilied+=$row['jr_montant'];
$diff+=$cn->get_value('select qf_amount from quant_fin where jr_id=$1', array($row['jr_id']));
$iradio->value = $row['jr_id'];
$r.=td(HtmlInput::hidden('jrid[]', $row['jr_id']) . $iradio->input(), ' style="text-align:center" ');
if ($i % 2 == 0)
echo tr($r, ' class="odd" ');
else
echo tr($r);
}
echo '</table>';
$bk_card = new Fiche($cn);
$bk_card->id = $Ledger->get_bank();
$filter_year = " j_tech_per in (select p_id from parm_periode where p_exercice='" . $g_user->get_exercice() . "')";
/* get saldo for not reconcilied operations */
$saldo_not_reconcilied = $bk_card->get_solde_detail($filter_year . " and j_grpt in (select jr_grpt_id from jrn where trim(jr_pj_number) ='' or jr_pj_number is null)");
/* get saldo for reconcilied operation */
$saldo_reconcilied = $bk_card->get_solde_detail($filter_year . " and j_grpt in (select jr_grpt_id from jrn where trim(jr_pj_number) != '' and jr_pj_number is not null)");
/* solde compte */
$saldo = $bk_card->get_solde_detail($filter_year);
echo '<table>';
echo '<tr>';
echo td("Solde compte ");
echo td(sprintf('%.2f', ($saldo['debit'] - $saldo['credit'])), ' style="text-align:right"');
echo '</tr>';
echo '<tr>';
echo td("Solde non rapproché ");
echo td(sprintf('%.2f', ($saldo_not_reconcilied['debit'] - $saldo_not_reconcilied['credit'])), ' style="text-align:right"');
echo '</tr>';
echo '<tr>';
echo td("Solde rapproché ");
echo td(sprintf('%.2f', ($saldo_reconcilied['debit'] - $saldo_reconcilied['credit'])), ' style="text-align:right"');
echo '</tr>';
echo '<tr>';
echo td("Total montant ");
echo td(sprintf('%.2f', ($tot_not_reconcilied)), ' style="text-align:right"');
echo '</tr>';
echo '</table>';
echo HtmlInput::submit('save', 'Mettre à jour le n° de relevé banquaire');
echo '</form>';
echo '</div>';
exit();
?>

View file

@ -0,0 +1,97 @@
<?php
/*
* This file is part of PhpCompta.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* $Revision$ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/* !\file
*
*
* \brief show bank saldo
*
*/
require_once ('class_acc_parm_code.php');
echo '<div class="content">';
$fiche=new Fiche($cn);
$array=$fiche->get_bk_account();
echo '<div class="content">';
echo dossier::hidden();
echo '<table style="margin-left:10%;width:60%" class="result">';
echo tr(th('Quick Code').th('Compte en banque',' style="text-align:left"').th('solde opération',' style="text-align:right"')
.th('solde extrait/relevé',' style="text-align:right"')
.th('différence',' style="text-align:right"'));
// Filter the saldo
// on the current year
$filter_year=" j_tech_per in (select p_id from parm_periode where p_exercice='".$g_user->get_exercice()."')";
// for highligting tje line
$idx=0;
bcscale(2);
// for each account
for ( $i = 0; $i < count($array);$i++)
{
// get the saldo
$m=$array[$i]->get_solde_detail($filter_year);
$solde=$m['debit']-$m['credit'];
// print the result if the saldo is not equal to 0
if ( $m['debit'] != 0.0 || $m['credit'] != 0.0)
{
/* get saldo for not reconcilied operations */
$saldo_not_reconcilied=$array[$i]->get_bk_balance($filter_year." and (trim(jr_pj_number) ='' or jr_pj_number is null)" );
/* get saldo for reconcilied operation */
$saldo_reconcilied=$array[$i]->get_bk_balance($filter_year." and ( trim(jr_pj_number) != '' and jr_pj_number is not null)" );
if ( $idx%2 != 0 )
$odd="odd";
else
$odd="";
$idx++;
echo "<tr class=\"$odd\">";
echo "<TD >".
IButton::history_card($array[$i]->id,$array[$i]->strAttribut(ATTR_DEF_QUICKCODE)).
"</TD>";
$saldo_rec=bcsub($saldo_reconcilied['debit'],$saldo_reconcilied['credit']);
$diff=bcsub($saldo_not_reconcilied['debit'],$saldo_not_reconcilied['credit']);
echo "<TD >".
$array[$i]->strAttribut(ATTR_DEF_NAME).
"</TD>".
"<TD align=\"right\">".
nbm($solde).
"</TD>".
"<TD align=\"right\">".
nbm($saldo_rec).
"</TD>".
"<TD align=\"right\">".
nbm($diff).
"</TD>".
"</TR>";
}
}// for
echo "</table>";
echo "</div>";
exit();
?>

View file

@ -92,6 +92,7 @@ elseif (isset($_POST['save']))
printf('<a class="detail" style="display:inline" href="javascript:modifyOperation(%d,%d)">%s</a><hr>', $jr_id, dossier::id(), $ledger->internal);
// show feedback
echo '<div id="jrn_name_div">'; echo '<h2 id="jrn_name" style="display:inline">' . $ledger->get_name() . '</h2>'; echo '</div>';
echo $ledger->confirm($_POST, true);
}
catch (Exception $e)

View file

@ -71,7 +71,8 @@ $ac="ac=".$_REQUEST['ac'];
{
echo '<div class="content">';
echo h2info('Confirmation');
echo '<h2 id="jrn_name" style="display:inline">' . $Ledger->get_name() . '</h2>';
echo '<div class="content">';
echo '<form class="print" enctype="multipart/form-data" method="post">';
echo dossier::hidden();
@ -125,7 +126,6 @@ $ac="ac=".$_REQUEST['ac'];
if ( ! isset($correct))
{
echo '<div class="content">';
echo '<h2 id="jrn_name">' . $Ledger->get_name() . '</h2>';
$Ledger=new Acc_Ledger_Sold($cn,$_POST['p_jrn']);
$internal=$Ledger->insert($_POST);
@ -138,7 +138,7 @@ $ac="ac=".$_REQUEST['ac'];
}
/* Show button */
echo '<h2 class="info" Enregistrement </h2>';
echo '<h2 class="info"> Enregistrement </h2>';
$jr_id=$cn->get_value('select jr_id from jrn where jr_internal=$1',array($internal));
echo "<h2 >"._('Opération sauvée');
@ -186,8 +186,7 @@ $ac="ac=".$_REQUEST['ac'];
else
$Ledger->id=$_REQUEST ['p_jrn'];
echo '<div class="u_redcontent">';
echo '<h2 id="jrn_name">' . $Ledger->get_name() . '</h2>';
echo '<div id="predef_form">';
echo '<form style="display:inline" method="GET" >';
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo dossier::hidden();

View file

@ -51,6 +51,10 @@ if ( isset ($_GET['ledger_type']))
$Ledger=new Acc_Ledger_Sold($cn,0);
$ask_pay=1;
break;
case 'FIN':
$Ledger=new Acc_Ledger_Fin($cn,0);
$ask_pay=0;
break;
}
}

View file

@ -30,9 +30,10 @@
echo '<div class="content">';
echo h2("Confirmation",'class="info"');
echo '<div id="jrn_name_div">';
echo '<h2 id="jrn_name" style="display:inline">' . $ledger->get_name() . '</h2>';
echo '</div>';
echo '<h2 id="jrn_name">'.$ledger->get_name().'</h2>';
echo '<FORM METHOD="POST">';
echo $ledger->confirm($_POST,false);

View file

@ -43,6 +43,7 @@ if ( $g_user->check_jrn($ledger->id)=='X')
exit();
}
echo '<div class="content">';
echo '<div id="predef_form">';
echo '<form method="GET" action="do.php">';
echo HtmlInput::hidden("action", "use_opd");
echo HtmlInput::hidden("ac",$_REQUEST['ac']);
@ -53,10 +54,12 @@ $op->set('ledger', $ledger->id);
$op->set('ledger_type', "ODS");
$op->set('direct', 't');
echo $op->form_get();
echo '<h2 id="jrn_name">'.$ledger->get_name().'</h2>';
echo '</form>';
echo '</div>';
echo '<div id="jrn_name_div">';
echo '<h2 id="jrn_name" style="display:inline">' . $ledger->get_name() . '</h2>';
echo '</div>';
// Show the predef operation
// Don't forget the p_jrn

View file

@ -4,6 +4,9 @@
<fieldset>
<legend><?=$f_legend ?>
</legend>
<div id="jrn_name_div">
<h2 id="jrn_name"> <?=$this->get_name()?></h2>
</div>
<?=_('Date').':'?> <?=$f_date ?> <?=_('Echeance')?> : <?=$f_echeance?>
<?=$f_periode?><br>
<?=_('Journal')?> <?=$f_jrn?><br><hr>

View file

@ -1,9 +1,13 @@
<fieldset>
<div id="jrn_name_div">
<h2 id="jrn_name"> <?=$this->get_name()?></h2>
</div>
<legend><?=$f_legend ?> </legend>
<?=_('Date').' '.$f_date ?>
<?=$f_period?><br>
<?=$f_jrn?><br>
<?=_('Banque')?><?=$f_bank ?>
</fieldset>
<fieldset>