diff --git a/html/style-color.css b/html/style-color.css index c4c9be815..63ab1afef 100644 --- a/html/style-color.css +++ b/html/style-color.css @@ -948,4 +948,11 @@ tr.footer{ span.remain { font-weight: bold; color:black; - } \ No newline at end of file + } +div#jrn_name_div +{ + float: right; + margin-right:150; + + +} \ No newline at end of file diff --git a/html/style-light.css b/html/style-light.css index e04e9f4c1..b0cf29eae 100644 --- a/html/style-light.css +++ b/html/style-light.css @@ -988,4 +988,16 @@ tr.footer{ span.remain { font-weight: bold; color:black; - } \ No newline at end of file + } +div#jrn_name_div +{ + float: right; + margin-right:150; + + +} +#predef_form { + margin-left:20%; + width:60%; + +} \ No newline at end of file diff --git a/html/style.css b/html/style.css index f87862a4c..09781b567 100644 --- a/html/style.css +++ b/html/style.css @@ -978,4 +978,12 @@ tr.footer{ span.remain { font-weight: bold; color:black; - } \ No newline at end of file + } + +div#jrn_name_div +{ + float: right; + margin-right:150; + + +} \ No newline at end of file diff --git a/include/ac_common.php b/include/ac_common.php index c04637b44..1b4ce99a3 100644 --- a/include/ac_common.php +++ b/include/ac_common.php @@ -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 '
'; - require_once $file[0]['me_file']; - echo '
'; - 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 '
'; + require_once $file[0]['me_file']; + echo '
'; + exit(); + } } } /** diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php index 0a80f19df..0f1f31f95 100644 --- a/include/class_acc_ledger.php +++ b/include/class_acc_ledger.php @@ -1394,7 +1394,7 @@ class Acc_Ledger // Load the javascript // $ret.=""; - $ret.= ''; $ret.= ''; + $ret.=''; + $ret.=''; + $ret.= ''; $ret.= '
'; + $ret.= '
'; $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.=' '._('Pièce').' : '.$wPJ->input(); - $ret.=HtmlInput::hidden('e_pj_suggest',$default_pj); - $ret.= '
'._('Pièce').' : '.$wPJ->input(); + $ret.=HtmlInput::hidden('e_pj_suggest',$default_pj); + $ret.= '
'._('Libellé'); $wDescription=new IText('desc'); diff --git a/include/class_acc_ledger_fin.php b/include/class_acc_ledger_fin.php index 09d0beb8e..789d79f9a 100644 --- a/include/class_acc_ledger_fin.php +++ b/include/class_acc_ledger_fin.php @@ -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.='
Banque, caisse '; + $r.= '
'; + $r.='

' . $this->get_name() . '

'; + $r.= '
'; $r.=''; // Date //-- @@ -516,7 +519,7 @@ class Acc_Ledger_Fin extends Acc_Ledger // Comment $r.=''; // amount - $r.=''; + $r.=''; // concerned $r.='
'.$tiers_comment.''.$tiers_amount.''.nbm($tiers_amount).''; $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.="
Ancien solde ".$solde; - $new_solde+=$amount; - $r.="
Nouveau solde ".$new_solde; + $r.="
Ancien solde ".nbm($solde); + $new_solde=bcadd($new_solde,$amount); + $r.="
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))); } } diff --git a/include/class_acc_ledger_purchase.php b/include/class_acc_ledger_purchase.php index 9743a3ba3..dabd59fe9 100644 --- a/include/class_acc_ledger_purchase.php +++ b/include/class_acc_ledger_purchase.php @@ -1262,6 +1262,9 @@ class Acc_Ledger_Purchase extends Acc_Ledger $r=""; $r.="
"; $r.=""._('En-tête facture fournisseur')." "; + $r.='
'; + $r.='

'.$this->get_name().'

'; + $r.='
'; $r.=''; $r.=''; $r.=''; diff --git a/include/class_acc_ledger_sold.php b/include/class_acc_ledger_sold.php index c952e7351..ef21face1 100644 --- a/include/class_acc_ledger_sold.php +++ b/include/class_acc_ledger_sold.php @@ -645,6 +645,9 @@ class Acc_Ledger_Sold extends Acc_Ledger $r=""; $r.="
"; $r.=""._('En-tête facture client')." "; + $r.='
'; + $r.='

' . $this->get_name() . '

'; + $r.= '
'; $r.='
'._('Date').' '.$e_date.'
'; $r.=''; $r.=''; @@ -778,7 +781,7 @@ class Acc_Ledger_Sold extends Acc_Ledger $r.='
'._('Date').' '.$e_date.'
'; - if ( $owner->MY_ANALYTIC!='nu') // use of AA + if ( $owner->MY_ANALYTIC!='nu' && $p_summary ) // use of AA $r.=''; $r.='
'; if (! $p_summary ) diff --git a/include/compta_ach.inc.php b/include/compta_ach.inc.php index 07397138e..c79535fbb 100644 --- a/include/compta_ach.inc.php +++ b/include/compta_ach.inc.php @@ -61,7 +61,6 @@ if (isset($_POST['view_invoice'])) { echo '
'; echo h2info('Confirmation'); - echo '

' . $Ledger->get_name() . '

'; echo '
'; echo dossier::hidden(); @@ -109,8 +108,6 @@ if (isset($_POST['record'])) { echo '
'; - echo '

' . $Ledger->get_name() . '

'; - $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 '

' . $Ledger->get_name() . '

'; // pre defined operation // +echo '
'; echo ''; 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 ''; echo '
'; +echo '
'; + echo '
'; echo "
"; /* request for a predefined operation */ diff --git a/include/compta_fin.inc.php b/include/compta_fin.inc.php index 39eb3ccdf..7e955a584 100644 --- a/include/compta_fin.inc.php +++ b/include/compta_fin.inc.php @@ -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 ''; - -$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 '
'; - echo ''; - echo HtmlInput::hidden('ac',$_REQUEST['ac']); - echo $Ledger->confirm($_POST); - echo HtmlInput::submit('confirm',_('Confirmer')); - echo HtmlInput::submit('correct',_('Corriger')); - - echo ''; - echo '
'; - 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 '
'; - $a= $Ledger->insert($_POST); - echo '

'._('Opération sauvée').'

'; - echo $a; - echo '
'; - echo '
'; - echo HtmlInput::button_anchor(_('Nouvel extrait'),$href.'?ledger_type=fin&sa=n&'.dossier::get()."&ac=".$_REQUEST['ac']); - echo '
'; - exit(); - } - } - //---------------------------------------- - // Correct the operations - //---------------------------------------- - if ( isset($_POST['correct'])) - { - $correct=1; - } - //---------------------------------------- - // Blank form - //---------------------------------------- - echo '
'; - - - echo '
'; - 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 '
'; + echo '

'._('Confirmation').'

'; + echo ''; + echo HtmlInput::hidden('ac',$_REQUEST['ac']); + echo $Ledger->confirm($_POST); + echo HtmlInput::submit('confirm',_('Confirmer')); + echo HtmlInput::submit('correct',_('Corriger')); + + echo ''; + echo '
'; + 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 '
'; + echo '

' . $Ledger->get_name() . '

'; + echo '
'; + + echo '
'; + $a= $Ledger->insert($_POST); + echo '

'._('Enregistrement').'

'; + echo '
'; + echo $a; + echo '
'; + echo '
'; + exit(); + } +} +//---------------------------------------- +// Correct the operations +//---------------------------------------- +if ( isset($_POST['correct'])) +{ + $correct=1; +} +//---------------------------------------- +// Blank form +//---------------------------------------- +echo '
'; + + +echo '
'; +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 '
'; - 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 ''; - echo $r; - echo HtmlInput::hidden('act','CSV/histo'); - echo HtmlInput::submit('viewsearch','Export vers CSV'); - - echo ''; - - echo '
'; - exit(); -} -//-------------------------------------------------------------------------------- -// Show the saldo -//-------------------------------------------------------------------------------- -if ( $def==3) -{ - require_once ('class_acc_parm_code.php'); - echo '
'; - $fiche=new Fiche($cn); - - $array=$fiche->get_bk_account(); - - echo '
'; - echo dossier::hidden(); - echo ''; - 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 ""; - echo ""; - - $saldo_rec=bcsub($saldo_reconcilied['debit'],$saldo_reconcilied['credit']); - $diff=bcsub($saldo_not_reconcilied['debit'],$saldo_not_reconcilied['credit']); - echo "". - "". - "". - "". - ""; - } - }// for - echo "
". - IButton::history_card($array[$i]->id,$array[$i]->strAttribut(ATTR_DEF_QUICKCODE)). - "". - $array[$i]->strAttribut(ATTR_DEF_NAME). - "". - nbm($solde). - "". - nbm($saldo_rec). - "". - nbm($diff). - "
"; - echo "
"; - exit(); -} -//-------------------------------------------------- -// Reconcilied -//-------------------------------------------------- -if ($def==4) -{ - echo '
'; - $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;$iexec_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 '
'; - echo '
'; - 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 '
'; - - echo '
'; - - 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 ''.hb(h($Ledger->get_bank_name())).''; - echo '

'; - $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 '

'; - - echo ''; - $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;$iget_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 '
'; - $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 ''; - echo ''; - echo td("Solde compte "); - echo td(sprintf('%.2f',($saldo['debit']-$saldo['credit'])),' style="text-align:right"'); - echo ''; - - echo ''; - echo td("Solde non rapproché "); - echo td(sprintf('%.2f',($saldo_not_reconcilied['debit']-$saldo_not_reconcilied['credit'])),' style="text-align:right"'); - echo ''; - - echo ''; - echo td("Solde rapproché "); - echo td(sprintf('%.2f',($saldo_reconcilied['debit']-$saldo_reconcilied['credit'])),' style="text-align:right"'); - echo ''; - - - echo ''; - echo td("Total montant "); - echo td(sprintf('%.2f',($tot_not_reconcilied)),' style="text-align:right"'); - echo ''; - - echo '
'; - - echo HtmlInput::submit('save','Mettre à jour le n° de relevé banquaire'); - echo '
'; - echo '
'; - exit(); -} +exit(); \ No newline at end of file diff --git a/include/compta_fin_rec.inc.php b/include/compta_fin_rec.inc.php new file mode 100644 index 000000000..cef594196 --- /dev/null +++ b/include/compta_fin_rec.inc.php @@ -0,0 +1,179 @@ +'; +$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 '
'; +echo '
'; +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 '
'; +echo '

' . $Ledger->get_name() . '

'; +echo '
'; +$wLedger->javascript = "onchange='this.form.submit()';"; +echo $wLedger->input(); +echo HtmlInput::submit('ref', 'Rafraîchir'); +echo '
'; + +echo '
'; + +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 '' . hb(h($Ledger->get_bank_name())) . ''; +echo '

'; +$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 '

'; + +echo ''; +$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 '
'; +$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 ''; +echo ''; +echo td("Solde compte "); +echo td(sprintf('%.2f', ($saldo['debit'] - $saldo['credit'])), ' style="text-align:right"'); +echo ''; + +echo ''; +echo td("Solde non rapproché "); +echo td(sprintf('%.2f', ($saldo_not_reconcilied['debit'] - $saldo_not_reconcilied['credit'])), ' style="text-align:right"'); +echo ''; + +echo ''; +echo td("Solde rapproché "); +echo td(sprintf('%.2f', ($saldo_reconcilied['debit'] - $saldo_reconcilied['credit'])), ' style="text-align:right"'); +echo ''; + + +echo ''; +echo td("Total montant "); +echo td(sprintf('%.2f', ($tot_not_reconcilied)), ' style="text-align:right"'); +echo ''; + +echo '
'; + +echo HtmlInput::submit('save', 'Mettre à jour le n° de relevé banquaire'); +echo '
'; +echo '
'; +exit(); +?> diff --git a/include/compta_fin_saldo.inc.php b/include/compta_fin_saldo.inc.php new file mode 100644 index 000000000..90d7b720f --- /dev/null +++ b/include/compta_fin_saldo.inc.php @@ -0,0 +1,97 @@ +'; + $fiche=new Fiche($cn); + + $array=$fiche->get_bk_account(); + + echo '
'; + echo dossier::hidden(); + echo ''; + 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 ""; + echo ""; + + $saldo_rec=bcsub($saldo_reconcilied['debit'],$saldo_reconcilied['credit']); + $diff=bcsub($saldo_not_reconcilied['debit'],$saldo_not_reconcilied['credit']); + echo "". + "". + "". + "". + ""; + } + }// for + echo "
". + IButton::history_card($array[$i]->id,$array[$i]->strAttribut(ATTR_DEF_QUICKCODE)). + "". + $array[$i]->strAttribut(ATTR_DEF_NAME). + "". + nbm($solde). + "". + nbm($saldo_rec). + "". + nbm($diff). + "
"; + echo "
"; + exit(); +?> diff --git a/include/compta_ods.inc.php b/include/compta_ods.inc.php index 5762ec9db..ce5373493 100644 --- a/include/compta_ods.inc.php +++ b/include/compta_ods.inc.php @@ -92,6 +92,7 @@ elseif (isset($_POST['save'])) printf('%s
', $jr_id, dossier::id(), $ledger->internal); // show feedback + echo '
'; echo '

' . $ledger->get_name() . '

'; echo '
'; echo $ledger->confirm($_POST, true); } catch (Exception $e) diff --git a/include/compta_ven.inc.php b/include/compta_ven.inc.php index 6d2d8ede0..dfa13f13f 100644 --- a/include/compta_ven.inc.php +++ b/include/compta_ven.inc.php @@ -71,7 +71,8 @@ $ac="ac=".$_REQUEST['ac']; { echo '
'; echo h2info('Confirmation'); - echo '

' . $Ledger->get_name() . '

'; + + echo '
'; echo '
'; echo dossier::hidden(); @@ -125,7 +126,6 @@ $ac="ac=".$_REQUEST['ac']; if ( ! isset($correct)) { echo '
'; - echo '

' . $Ledger->get_name() . '

'; $Ledger=new Acc_Ledger_Sold($cn,$_POST['p_jrn']); $internal=$Ledger->insert($_POST); @@ -138,7 +138,7 @@ $ac="ac=".$_REQUEST['ac']; } /* Show button */ - echo '

'; + echo '

Enregistrement

'; $jr_id=$cn->get_value('select jr_id from jrn where jr_internal=$1',array($internal)); echo "

"._('Opération sauvée'); @@ -186,8 +186,7 @@ $ac="ac=".$_REQUEST['ac']; else $Ledger->id=$_REQUEST ['p_jrn']; - echo '
'; - echo '

' . $Ledger->get_name() . '

'; + echo '
'; echo ''; echo HtmlInput::hidden('ac',$_REQUEST['ac']); echo dossier::hidden(); diff --git a/include/history_operation.inc.php b/include/history_operation.inc.php index 0f0be0b3e..64e4fff93 100644 --- a/include/history_operation.inc.php +++ b/include/history_operation.inc.php @@ -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; } } diff --git a/include/operation_ods_confirm.inc.php b/include/operation_ods_confirm.inc.php index 04fd35600..6001bc1a8 100644 --- a/include/operation_ods_confirm.inc.php +++ b/include/operation_ods_confirm.inc.php @@ -30,9 +30,10 @@ echo '
'; echo h2("Confirmation",'class="info"'); +echo '
'; +echo '

' . $ledger->get_name() . '

'; +echo '
'; - -echo '

'.$ledger->get_name().'

'; echo ''; echo $ledger->confirm($_POST,false); diff --git a/include/operation_ods_new.inc.php b/include/operation_ods_new.inc.php index b251623d9..f1d7f99c4 100644 --- a/include/operation_ods_new.inc.php +++ b/include/operation_ods_new.inc.php @@ -43,6 +43,7 @@ if ( $g_user->check_jrn($ledger->id)=='X') exit(); } echo '
'; +echo '
'; echo ''; 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 '

'.$ledger->get_name().'

'; + echo ''; - - +echo '
'; +echo '
'; +echo '

' . $ledger->get_name() . '

'; +echo '
'; // Show the predef operation // Don't forget the p_jrn diff --git a/include/template/form_ledger_detail.php b/include/template/form_ledger_detail.php index fba8e63a1..1c3da37c1 100644 --- a/include/template/form_ledger_detail.php +++ b/include/template/form_ledger_detail.php @@ -4,6 +4,9 @@
+
+

get_name()?>

+
:


diff --git a/include/template/form_ledger_fin.php b/include/template/form_ledger_fin.php index 700f5f65c..064b10977 100644 --- a/include/template/form_ledger_fin.php +++ b/include/template/form_ledger_fin.php @@ -1,9 +1,13 @@
+
+

get_name()?>

+


+