Author: danydb Date: 2012-03-22 23:23:29 +0100 (Thu, 22 Mar 2012) New Revision: 309
Removed: trunk/modop/mod_save.php Modified: trunk/ trunk/coprop/include/ajax_add_key.php trunk/coprop/include/ajax_bud_display.php trunk/coprop/include/budget.inc.php trunk/coprop/include/class_copro_budget.php trunk/coprop/include/key.inc.php trunk/coprop/include/template/key_detail.php trunk/modop/index.php trunk/modop/modop_confirm.php trunk/modop/modop_display.php trunk/modop/modop_save.php trunk/tools/include/operation.inc.php trunk/tools/include/template/search_view.php trunk/tools/include/tool_function.php Log: Merged revisions 299-307 via svnmerge from svn+ssh://[email protected]/svn_extension/tag/rel601 ........ r299 | danydb | 2012-02-08 22:32:48 +0100 (Wed, 08 Feb 2012) | 2 lines Fix bug Document are not generated properly ........ r300 | danydb | 2012-02-09 13:49:28 +0100 (Thu, 09 Feb 2012) | 2 lines location generated document ........ r301 | danydb | 2012-02-09 13:49:58 +0100 (Thu, 09 Feb 2012) | 2 lines code indenting ........ r302 | danydb | 2012-02-09 14:09:06 +0100 (Thu, 09 Feb 2012) | 2 lines add button actualiser ........ r303 | danydb | 2012-02-11 20:31:50 +0100 (Sat, 11 Feb 2012) | 2 lines Allow to change accounting by card ........ r304 | danydb | 2012-03-22 21:34:46 +0100 (Thu, 22 Mar 2012) | 1 line 0000554: COPROP : dans budget ajouter bouton ajout charge ........ r305 | danydb | 2012-03-22 21:47:12 +0100 (Thu, 22 Mar 2012) | 1 line 0000550: Ajout clef : classement des lots ........ r306 | danydb | 2012-03-22 22:02:08 +0100 (Thu, 22 Mar 2012) | 1 line n'affiche pas les fiches vides ........ r307 | danydb | 2012-03-22 22:18:04 +0100 (Thu, 22 Mar 2012) | 1 line 0000547: PLUGIN COPRO : ajoutez b?\195?\162timent & colocataire dans clef de r?\195?\169partition ........ Property changes on: trunk ___________________________________________________________________ Name: svnmerge-integrated - /tag/rel601:1-298 + /tag/rel601:1-308 Modified: trunk/coprop/include/ajax_add_key.php =================================================================== --- trunk/coprop/include/ajax_add_key.php 2012-03-22 22:18:41 UTC (rev 308) +++ trunk/coprop/include/ajax_add_key.php 2012-03-22 22:23:29 UTC (rev 309) @@ -38,7 +38,7 @@ $str_message="Ajout d'une clef de répartition"; $alot=$cn->get_array("select f_id,vw_name as name,quick_code as qcode, vw_description as desc, 0 as l_part - from vw_fiche_attr where fd_id=$1",array($g_copro_parameter->categorie_lot)); + from vw_fiche_attr where fd_id=$1 order by 2 ",array($g_copro_parameter->categorie_lot)); $init_tantieme=0; echo '<form id="fkey" method="post">'; require_once 'template/key_detail.php'; Modified: trunk/coprop/include/ajax_bud_display.php =================================================================== --- trunk/coprop/include/ajax_bud_display.php 2012-03-22 22:18:41 UTC (rev 308) +++ trunk/coprop/include/ajax_bud_display.php 2012-03-22 22:23:29 UTC (rev 309) @@ -4,9 +4,11 @@ */ require_once 'class_copro_budget.php'; + +echo '<form id="fbud_update" method="post">'; $bud=new Copro_Budget(); $bud->b_id=$bud_id; -echo '<form id="fbud_update" method="post">'; + $bud->detail(); echo HtmlInput::submit("bud_update","Valider"); echo "</form>"; Modified: trunk/coprop/include/budget.inc.php =================================================================== --- trunk/coprop/include/budget.inc.php 2012-03-22 22:18:41 UTC (rev 308) +++ trunk/coprop/include/budget.inc.php 2012-03-22 22:23:29 UTC (rev 309) @@ -13,11 +13,12 @@ } +echo '<div id="bud_list" class="content">'; -echo '<div id="bud_list" class="content">'; $bud->to_list(); echo HtmlInput::button("bud_add_bt","Ajout Budget","onclick=\"budget_add('".$_REQUEST['gDossier']."','".$_REQUEST['plugin_code']."','".$_REQUEST['ac']."')\""); echo '</div>'; + ?> <div id="divbuddetail"> Modified: trunk/coprop/include/class_copro_budget.php =================================================================== --- trunk/coprop/include/class_copro_budget.php 2012-03-22 22:18:41 UTC (rev 308) +++ trunk/coprop/include/class_copro_budget.php 2012-03-22 22:23:29 UTC (rev 309) @@ -91,6 +91,15 @@ $a_key=$cn->make_array(" select cr_id,cr_name from coprop.clef_repartition order by cr_name"); $max=count($array); + + // Ajout bouton ajout charge + $f_add_button=new IButton('add_card'); + $f_add_button->label=_('Créer une nouvelle fiche'); + $f_add_button->set_attribute('ipopup','ipop_newcard'); + $f_add_button->set_attribute('jrn',-1); + $filter=$cn->make_list("select fd_id from fiche_def where frd_id=2"); + $f_add_button->javascript=" this.filter='$filter';this.jrn=-1;select_card_type(this);"; + echo $f_add_button->input(); for ($i=0;$i<MAXROWBUD;$i++) { $label=new IText('bt_label[]'); Modified: trunk/coprop/include/key.inc.php =================================================================== --- trunk/coprop/include/key.inc.php 2012-03-22 22:18:41 UTC (rev 308) +++ trunk/coprop/include/key.inc.php 2012-03-22 22:23:29 UTC (rev 309) @@ -45,10 +45,7 @@ } -$sql="select cr_id,cr_name,cr_note,cr_tantieme from coprop.clef_repartition "; -/** - * @todo ajouter tri - */ +$sql="select cr_id,cr_name,cr_note,cr_tantieme from coprop.clef_repartition order by cr_name"; $a_key=$cn->get_array($sql); ?> @@ -61,7 +58,7 @@ Note </th> <th> - Tantième + Tantième </th> <th></th> </tr> @@ -86,7 +83,7 @@ echo HtmlInput::anchor("enlever","",$js); ?> </td> - + </tr> <? endfor; Modified: trunk/coprop/include/template/key_detail.php =================================================================== --- trunk/coprop/include/template/key_detail.php 2012-03-22 22:18:41 UTC (rev 308) +++ trunk/coprop/include/template/key_detail.php 2012-03-22 22:23:29 UTC (rev 309) @@ -53,18 +53,48 @@ Description <?=$note->input()?> <h2>Détail des lots</h2> -<table> +<table class="result"> + <tr> + <th>QuickCode</th> + <th>Nom</th> + <th>Description</th> + <th>Copropriétaire</th> + <th>Bâtiment</th> + <th>Montant</th> + </tr> <? for ($i=0;$i<count($alot);$i++): + if ( $alot[$i]['qcode'] == "" ) continue; ?> <tr> <td> - <?=HtmlInput::card_detail($alot[$i]['qcode'],$alot[$i]['name'])?> + <?=HtmlInput::card_detail($alot[$i]['qcode'],$alot[$i]['qcode'],' class="line"')?> <?=HtmlInput::hidden('f_id[]',$alot[$i]['f_id'])?> </td> + <td> + <?=$alot[$i]['name']?> + </td> <td> <?=$alot[$i]['desc']?> </td> + <td> + <? + $copro=$cn->get_value ("select ad_value + from fiche_Detail + where ad_id=1 + and f_id = (select coprop_id::integer from coprop.summary where lot_id=$1)",array($alot[$i]['f_id'])); + echo h($copro); + ?> + </td> + <td> + <? + $batiment=$cn->get_value ("select ad_value + from fiche_Detail + where ad_id=1 + and f_id = (select building_id::integer from coprop.summary where lot_id=$1)",array($alot[$i]['f_id'])); + echo h($batiment); + ?> + </td> <td> <? $num=new INum('part'.$alot[$i]['f_id']); Modified: trunk/modop/index.php =================================================================== --- trunk/modop/index.php 2012-03-22 22:18:41 UTC (rev 308) +++ trunk/modop/index.php 2012-03-22 22:23:29 UTC (rev 309) @@ -45,7 +45,9 @@ </FORM> <hr> <?php - if ( isset($_GET['seek'])) { +$action=(isset ($_REQUEST['action']))?$_REQUEST['action']:'end'; + + if ( ! isset ($_REQUEST['action']) && isset($_GET['seek'])) { /* retrieve and show the accounting */ if ( trim($_GET['jr_id'])=='') { alert('Aucune opération demandé'); exit;} @@ -53,8 +55,8 @@ require_once('modop_display.php'); exit(); } -$action=(isset ($_GET['action']))?$_GET['action']:'end'; + /* we need to confirm it */ if ( $action=='confirm' ) { require_once('modop_confirm.php'); Deleted: trunk/modop/mod_save.php =================================================================== --- trunk/modop/mod_save.php 2012-03-22 22:18:41 UTC (rev 308) +++ trunk/modop/mod_save.php 2012-03-22 22:23:29 UTC (rev 309) @@ -1,26 +0,0 @@ -<?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 [email protected] - -/*!\file - * \brief - */ - Modified: trunk/modop/modop_confirm.php =================================================================== --- trunk/modop/modop_confirm.php 2012-03-22 22:18:41 UTC (rev 308) +++ trunk/modop/modop_confirm.php 2012-03-22 22:23:29 UTC (rev 309) @@ -31,17 +31,17 @@ $act->suspend_strict(); //---------------------------------------------------------------------- // ACH -if ( $_GET['jrn_type'] == 'ACH') { - $jrn=new Acc_Ledger_Purchase($cn,$_GET['p_jrn']); +if ( $_POST['jrn_type'] == 'ACH') { + $jrn=new Acc_Ledger_Purchase($cn,$_POST['p_jrn']); try { - echo '<FORM METHOD="GET">'; + echo '<FORM enctype="multipart/form-data" METHOD="POST">'; echo HtmlInput::hidden('ac',$_REQUEST['ac']); echo HtmlInput::extension().dossier::hidden(); echo HtmlInput::hidden('action','save'); - echo HtmlInput::hidden('ext_jr_id',$_GET['ext_jr_id']); + echo HtmlInput::hidden('ext_jr_id',$_POST['ext_jr_id']); echo HtmlInput::hidden('ext_jr_internal', - $_GET['ext_jr_internal']); - echo $jrn->confirm($_GET); + $_POST['ext_jr_internal']); + echo $jrn->confirm($_POST); echo HtmlInput::submit('save','Sauver'); echo '</FORM>'; @@ -51,17 +51,17 @@ } //---------------------------------------------------------------------- // VEN -if ( $_GET['jrn_type'] == 'VEN') { - $jrn=new Acc_Ledger_Sold($cn,$_GET['p_jrn']); +if ( $_POST['jrn_type'] == 'VEN') { + $jrn=new Acc_Ledger_Sold($cn,$_POST['p_jrn']); try { - $a=$jrn->confirm($_GET); - echo '<FORM METHOD="GET">'; + $a=$jrn->confirm($_POST); + echo '<FORM enctype="multipart/form-data" METHOD="POST">'; echo HtmlInput::hidden('ac',$_REQUEST['ac']); echo HtmlInput::extension().dossier::hidden(); echo HtmlInput::hidden('action','save'); - echo HtmlInput::hidden('ext_jr_id',$_GET['ext_jr_id']); + echo HtmlInput::hidden('ext_jr_id',$_POST['ext_jr_id']); echo HtmlInput::hidden('ext_jr_internal', - $_GET['ext_jr_internal']); + $_POST['ext_jr_internal']); echo $a; echo HtmlInput::submit('save','Sauver'); @@ -73,20 +73,20 @@ } //---------------------------------------------------------------------- // ODS -if ( $_GET['jrn_type'] == 'ODS') { - $jrn=new Acc_Ledger($cn,$_GET['p_jrn']); +if ( $_POST['jrn_type'] == 'ODS') { + $jrn=new Acc_Ledger($cn,$_POST['p_jrn']); $jrn->with_concerned=false; try { - $jrn->verify($_GET); - $a= $jrn->input($_GET,1); - echo '<FORM METHOD="GET">'; + $jrn->verify($_POST); + $a= $jrn->input($_POST,1); + echo '<FORM enctype="multipart/form-data" METHOD="POST">'; echo HtmlInput::hidden('ac',$_REQUEST['ac']); echo HtmlInput::extension().dossier::hidden(); echo HtmlInput::hidden('action','save'); - echo HtmlInput::hidden('ext_jr_id',$_GET['ext_jr_id']); + echo HtmlInput::hidden('ext_jr_id',$_POST['ext_jr_id']); echo HtmlInput::hidden('ext_jr_internal', - $_GET['ext_jr_internal']); - echo $a; + $_POST['ext_jr_internal']); + echo $a; echo HtmlInput::submit('save','Sauver'); echo '</FORM>'; Modified: trunk/modop/modop_display.php =================================================================== --- trunk/modop/modop_display.php 2012-03-22 22:18:41 UTC (rev 308) +++ trunk/modop/modop_display.php 2012-03-22 22:23:29 UTC (rev 309) @@ -85,7 +85,7 @@ $pop_tva->value=''; echo $pop_tva->input(); - echo '<FORM METHOD="GET" class="print">'; + echo '<FORM enctype="multipart/form-data" METHOD="POST" class="print">'; $op->suspend_receipt(); echo HtmlInput::hidden('ac',$_REQUEST['ac']); echo $jrn->input($op->array); @@ -119,7 +119,7 @@ echo $pop_tva->input(); $op->suspend_receipt(); - echo '<FORM METHOD="GET" class="print">'; + echo '<FORM enctype="multipart/form-data" METHOD="POST" class="print">'; echo $jrn->input($op->array); echo HtmlInput::hidden('ac',$_REQUEST['ac']); echo HtmlInput::extension().dossier::hidden(); @@ -128,7 +128,8 @@ echo HtmlInput::hidden('e_mp',0); echo HtmlInput::hidden('ext_jr_id',$op->jr_id); echo HtmlInput::hidden('ext_jr_internal',$op->jr_internal); - echo HtmlInput::button('add_item',_('Ajout article'), ' onClick="ledger_add_row()"'); + //echo HtmlInput::button('add_item',_('Ajout article'), ' onClick="ledger_add_row()"'); + echo HtmlInput::button('actualiser',_('Actualiser'), ' onClick="compute_all_ledger();"'); echo '</form>'; } @@ -148,7 +149,7 @@ echo $search_card->input(); $op->suspend_receipt(); - echo '<FORM METHOD="GET" class="print">'; + echo '<FORM enctype="multipart/form-data" METHOD="POST" class="print">'; echo $jrn->input($op->array); echo HtmlInput::hidden('ac',$_REQUEST['ac']); echo HtmlInput::extension().dossier::hidden(); @@ -189,7 +190,7 @@ $f_add_button->set_attribute('filter',$jrn->get_all_fiche_def ()); $f_add_button->javascript=" select_card_type(this);"; $str_add_button=$f_add_button->input(); - echo '<FORM METHOD="GET" class="print">'; + echo '<FORM enctype="multipart/form-data" METHOD="post" class="print">'; echo HtmlInput::hidden('ac',$_REQUEST['ac']); $Date=new IDate("e_date",$op->array['e_date']); $f_date=$Date->input(); Modified: trunk/modop/modop_save.php =================================================================== --- trunk/modop/modop_save.php 2012-03-22 22:18:41 UTC (rev 308) +++ trunk/modop/modop_save.php 2012-03-22 22:23:29 UTC (rev 309) @@ -29,115 +29,176 @@ /* ---------------------------------------------------------------------- */ // Purchase /* ---------------------------------------------------------------------- */ -if ( $_GET['jrn_type'] == 'ACH') +if ( $_POST['jrn_type'] == 'ACH') { - $jrn=new Acc_Ledger_Purchase($cn,$_GET['p_jrn']); + $jrn=new Acc_Ledger_Purchase($cn,$_POST['p_jrn']); try { - $op=new Modop_Operation($cn,$_GET['ext_jr_internal']); + $op=new Modop_Operation($cn,$_POST['ext_jr_internal']); $op->suspend_receipt(); $op->suspend_strict(); - $pj=$_GET['e_pj']; - $_GET['e_pj']=microtime(); - $new_internal=$jrn->insert($_GET); + $pj=$_POST['e_pj']; + $oldpj= microtime(); + $cn->exec_sql('update jrn set jr_pj_number=$1 where jr_id=$2', + array($oldpj,$_POST['ext_jr_id'])); + $new_internal=$jrn->insert($_POST); } catch (Exception $e) { alert($e->getMessage()); exit(); } + $cn->commit(); + /* we delete the old operation */ $cn->start(); /* in stock_goods */ $cn->exec_sql('delete from stock_goods where j_id in (select j_id from jrnx join jrn on (j_grpt=jr_grpt_id) where jr_id=$1)', - array($_GET['ext_jr_id'])); + array($_POST['ext_jr_id'])); /* in jrnx */ $cn->exec_sql('delete from jrnx where j_grpt in (select jr_grpt_id from jrn where jr_id=$1)', - array($_GET['ext_jr_id'])); + array($_POST['ext_jr_id'])); /* in jrn */ $attach=$cn->get_array('select jr_pj,jr_pj_name,jr_pj_type from jrn where jr_id=$1', - array($_GET['ext_jr_id'])); - $cn->exec_sql('delete from jrn where jr_id=$1',array($_GET['ext_jr_id'])); + array($_POST['ext_jr_id'])); + $cn->exec_sql('delete from jrn where jr_id=$1',array($_POST['ext_jr_id'])); $cn->exec_sql('update jrn set jr_id=$1,jr_internal=$2,jr_pj_number=$3 where jr_internal=$4', - array($_GET['ext_jr_id'],$_GET['ext_jr_internal'],$pj,$new_internal)); - if ( $attach[0]['jr_pj_name'] != '') + array($_POST['ext_jr_id'],$_POST['ext_jr_internal'],$pj,$new_internal)); + if ($_FILES['pj']['name']=='' && $attach[0]['jr_pj_name'] != '' && ! isset ($_POST['gen_invoice'])) { $cn->exec_sql('update jrn set jr_pj=$1,jr_pj_type=$2,jr_pj_name=$3 where jr_id=$4', - array($attach[0]['jr_pj'],$attach[0]['jr_pj_type'],$attach[0]['jr_pj_name'],$_GET['ext_jr_id'])); + array($attach[0]['jr_pj'],$attach[0]['jr_pj_type'],$attach[0]['jr_pj_name'],$_POST['ext_jr_id'])); } /* in quant_purchase */ $cn->exec_sql('update quant_purchase set qp_internal=$1 where qp_internal=$2', - array($_GET['ext_jr_internal'],$new_internal)); + array($_POST['ext_jr_internal'],$new_internal)); $cn->commit(); + echo '<h2 class="info"> Enregistrement </h2>'; + echo "<h2 >" . _('Opération sauvée') .$_POST['ext_jr_internal'] ; + if ($jrn->pj != '') + echo ' Piece : ' . h($jrn->pj); + echo "</h2>"; + if (strcmp($jrn->pj, $_POST['e_pj']) != 0) + { + echo '<h3 class="notice"> ' . _('Attention numéro pièce existante, elle a du être adaptée') . '</h3>'; + } + /* Save the additional information into jrn_info */ + $obj = new Acc_Ledger_Info($cn); + $obj->save_extra($jrn->jr_id, $_POST); + printf('<a class="line" style="display:inline" href="javascript:modifyOperation(%d,%d)">%s</a><hr>', $_POST['ext_jr_id'], dossier::id(), $new_internal); + // Feedback + echo $jrn->confirm($_POST, true); + if (isset($jrn->doc)) + { + echo '<span class="invoice">'; + echo $jrn->doc; + echo '</span>'; + } + + echo '</div>'; } /* ---------------------------------------------------------------------- */ // SOLD /* ---------------------------------------------------------------------- */ -if ( $_GET['jrn_type'] == 'VEN') +if ( $_POST['jrn_type'] == 'VEN') { - $jrn=new Acc_Ledger_Sold($cn,$_GET['p_jrn']); + $jrn=new Acc_Ledger_Sold($cn,$_POST['p_jrn']); + $pj=$_POST['e_pj']; try - { - $op=new Modop_Operation($cn,$_GET['ext_jr_internal']); + { $cn->start(); + $op=new Modop_Operation($cn,$_POST['ext_jr_internal']); $op->suspend_receipt(); $op->suspend_strict(); - $pj=$_GET['e_pj']; - $_GET['e_pj']=microtime(); - $new_internal=$jrn->insert($_GET); + + $oldpj= microtime(); + $cn->exec_sql('update jrn set jr_pj_number=$1 where jr_id=$2', + array($oldpj,$_POST['ext_jr_id'])); + $new_internal=$jrn->insert($_POST); } catch (Exception $e) { alert($e->getMessage()); exit(); } + $cn->commit(); /* we delete the old operation */ $cn->start(); /* in stock_goods */ $cn->exec_sql('delete from stock_goods where j_id in (select j_id from jrnx join jrn on (j_grpt=jr_grpt_id) where jr_id=$1)', - array($_GET['ext_jr_id'])); + array($_POST['ext_jr_id'])); /* in jrnx */ $cn->exec_sql('delete from jrnx where j_grpt in (select jr_grpt_id from jrn where jr_id=$1)', - array($_GET['ext_jr_id'])); + array($_POST['ext_jr_id'])); /* in jrn */ $attach=$cn->get_array('select jr_pj,jr_pj_name,jr_pj_type from jrn where jr_id=$1', - array($_GET['ext_jr_id'])); + array($_POST['ext_jr_id'])); - $cn->exec_sql('delete from jrn where jr_id=$1',array($_GET['ext_jr_id'])); + $cn->exec_sql('delete from jrn where jr_id=$1',array($_POST['ext_jr_id'])); $cn->exec_sql('update jrn set jr_id=$1,jr_internal=$2,jr_pj_number=$3 where jr_internal=$4', - array($_GET['ext_jr_id'],$_GET['ext_jr_internal'],$pj,$new_internal)); - if ( $attach[0]['jr_pj_name'] != '') + array($_POST['ext_jr_id'],$_POST['ext_jr_internal'],$pj,$new_internal)); + + if ( $_FILES['pj']['name']=='' && $attach[0]['jr_pj_name'] != '' && ! isset ($_POST['gen_invoice'])) { $cn->exec_sql('update jrn set jr_pj=$1,jr_pj_type=$2,jr_pj_name=$3 where jr_id=$4', - array($attach[0]['jr_pj'],$attach[0]['jr_pj_type'],$attach[0]['jr_pj_name'],$_GET['ext_jr_id'])); - } + array($attach[0]['jr_pj'],$attach[0]['jr_pj_type'],$attach[0]['jr_pj_name'],$_POST['ext_jr_id'])); + } /* in quant_sold */ $cn->exec_sql('update quant_sold set qs_internal=$1 where qs_internal=$2', - array($_GET['ext_jr_internal'],$new_internal)); + array($_POST['ext_jr_internal'],$new_internal)); $cn->commit(); + /* Show button */ + echo '<h2 class="info"> Enregistrement </h2>'; + $jr_id=$_POST['ext_jr_id']; + echo "<h2 >"._('Opération sauvée'); + if ( $jrn->pj != '') echo ' Piece : '.h($jrn->pj); + echo "</h2>"; + if ( strcmp($jrn->pj,$_POST['e_pj']) != 0 ) + { + echo '<h3 class="notice"> '._('Attention numéro pièce existante, elle a du être adaptée').'</h3>'; + } + + printf ('<a class="line" style="display:inline" href="javascript:modifyOperation(%d,%d)">%s</a><hr>', + $jr_id,dossier::id(),$new_internal); + echo $jrn->confirm($_POST,true); + /* Show link for Invoice */ + if (isset ($jrn->doc) ) + { + echo '<span class="invoice">'; + echo $jrn->doc; + echo '</span>'; + } + + + /* Save the additional information into jrn_info */ + $obj=new Acc_Ledger_Info($cn); + $obj->save_extra($jr_id,$_POST); + + + echo '</div>'; } /* ---------------------------------------------------------------------- */ // ODS /* ---------------------------------------------------------------------- */ -if ( $_GET['jrn_type'] == 'ODS') +if ( $_POST['jrn_type'] == 'ODS') { - $jrn=new Acc_Ledger($cn,$_GET['p_jrn']); + $jrn=new Acc_Ledger($cn,$_POST['p_jrn']); try { - $op=new Modop_Operation($cn,$_GET['ext_jr_internal']); + $op=new Modop_Operation($cn,$_POST['ext_jr_internal']); $op->suspend_receipt(); $op->suspend_strict(); - $pj=$_GET['e_pj']; - $_GET['e_pj']=microtime(); - $jrn->save($_GET); + $pj=$_POST['e_pj']; + $_POST['e_pj']=microtime(); + $jrn->save($_POST); $new_internal=$jrn->internal; } catch (Exception $e) @@ -150,18 +211,18 @@ /* in jrnx */ $cn->exec_sql('delete from jrnx where j_grpt in (select jr_grpt_id from jrn where jr_id=$1)', - array($_GET['ext_jr_id'])); + array($_POST['ext_jr_id'])); /* in jrn */ $attach=$cn->get_array('select jr_pj,jr_pj_name,jr_pj_type from jrn where jr_id=$1', - array($_GET['ext_jr_id'])); - $cn->exec_sql('delete from jrn where jr_id=$1',array($_GET['ext_jr_id'])); + array($_POST['ext_jr_id'])); + $cn->exec_sql('delete from jrn where jr_id=$1',array($_POST['ext_jr_id'])); $cn->exec_sql('update jrn set jr_id=$1,jr_internal=$2,jr_pj_number=$3 where jr_internal=$4', - array($_GET['ext_jr_id'],$_GET['ext_jr_internal'],$pj,$new_internal)); + array($_POST['ext_jr_id'],$_POST['ext_jr_internal'],$pj,$new_internal)); if ( $attach[0]['jr_pj_name'] != '') { $cn->exec_sql('update jrn set jr_pj=$1,jr_pj_type=$2,jr_pj_name=$3 where jr_id=$4', - array($attach[0]['jr_pj'],$attach[0]['jr_pj_type'],$attach[0]['jr_pj_name'],$_GET['ext_jr_id'])); + array($attach[0]['jr_pj'],$attach[0]['jr_pj_type'],$attach[0]['jr_pj_name'],$_POST['ext_jr_id'])); } $cn->commit(); @@ -171,9 +232,9 @@ /* ---------------------------------------------------------------------- */ // Purchase /* ---------------------------------------------------------------------- */ -if ( $_GET['jrn_type'] == 'FIN') +if ( $_POST['jrn_type'] == 'FIN') { - extract ($_GET); + extract ($_POST); $user=new User($cn); try { Modified: trunk/tools/include/operation.inc.php =================================================================== --- trunk/tools/include/operation.inc.php 2012-03-22 22:18:41 UTC (rev 308) +++ trunk/tools/include/operation.inc.php 2012-03-22 22:23:29 UTC (rev 309) @@ -33,6 +33,13 @@ { change_ledger($cn); } +/* + * Change ledger + */ +if (isset($_POST['chg_card_account'])) + { + change_card_account($cn); + } //----------------------------------------------------- // Display search result @@ -52,11 +59,12 @@ // Count nb of line $max_line=$cn->count_sql($sql); -echo HtmlInput::button('accounting_bt','Poste comptable','onclick="$(\'div_poste\').show();$(\'div_card\').hide();$(\'div_ledger\').hide()"'); +echo HtmlInput::button('accounting_bt','Changer poste comptable','onclick="$(\'div_poste\').show();$(\'div_card\').hide();$(\'div_ledger\').hide();$(\'div_card_account\').hide();"'); -echo HtmlInput::button('card_bt','Fiche','onclick="$(\'div_poste\').hide();$(\'div_card\').show();$(\'div_ledger\').hide()"'); +echo HtmlInput::button('card_bt','Changer fiche','onclick="$(\'div_poste\').hide();$(\'div_card\').show();$(\'div_ledger\').hide();$(\'div_card_account\').hide();"'); -echo HtmlInput::button('ledger_bt','Journal','onclick="$(\'div_poste\').hide();$(\'div_card\').hide();$(\'div_ledger\').show()"'); +echo HtmlInput::button('ledger_bt','Déplacement dans Journal','onclick="$(\'div_poste\').hide();$(\'div_card\').hide();$(\'div_ledger\').show();$(\'div_card_account\').hide();"'); +echo HtmlInput::button('card_acc_bt','Poste > fiche','onclick="$(\'div_poste\').hide();$(\'div_card\').hide();;$(\'div_card_account\').show();$(\'div_ledger\').hide()"'); require_once('template/search_view.php'); Modified: trunk/tools/include/template/search_view.php =================================================================== --- trunk/tools/include/template/search_view.php 2012-03-22 22:18:41 UTC (rev 308) +++ trunk/tools/include/template/search_view.php 2012-03-22 22:23:29 UTC (rev 309) @@ -66,6 +66,7 @@ $ctarget->set_attribute('label','ctarget_label'); $ctarget->javascript=sprintf(' onchange="fill_data_onchange(\'%s\');" ', $ctarget->name); + $ctarget->set_function('fill_data'); $ctarget->set_dblclick("fill_ipopcard(this);"); $ctarget->set_attribute("typecard",'all'); @@ -92,7 +93,48 @@ ?> </div> +<div id="div_card_account" class="inner_box" style="top:230;margin:5;overflow:visible;display:none;"> +<h2 class="info">Changer un poste comptable par une fiche</h2> + <p class="notice">Attention, dans les opérations sélectionnées, le poste comptable sera changé par une fiche et par son poste comptable, soyez prudent</p> +<? + $csource=new IPoste('csource1'); + $csource->set_attribute('gDossier',Dossier::id()); + $csource->set_attribute('jrn',0); + $csource->set_attribute('label','csource1_label'); + $csource->set_attribute('account','csource1'); + $csource->table=0; + $ctarget=new ICard('ctarget1'); + $ctarget->typecard='all'; + $ctarget->set_attribute('label','ctarget1_label'); + $ctarget->javascript=sprintf(' onchange="fill_data_onchange(\'%s\');" ', + $ctarget->name); + $ctarget->set_dblclick("fill_ipopcard(this);"); + $ctarget->set_attribute("typecard",'all'); + $ctarget->set_function('fill_data'); + + +?> +<table> +<TR> + <TD>Changer</TD> + <TD><?=$csource->input();?></TD> + <td><span id="csource1_label"></span></td> +</tr> +<tr> + <TD>par </TD> + + <TD><?=$ctarget->input()?></TD> + <td><?=$ctarget->search()?></td> + <td><span id="ctarget1_label"></span></td> +</tr> +</table> + <? echo HtmlInput::submit('chg_card_account','Changer le poste comptable par la fiche'); ?> +<? +echo HtmlInput::button('card_hide_bt','Annuler','onclick="$(\'div_card_account\').hide();"'); +?> + +</div> <div id="div_ledger" class="inner_box" style="top:230;margin:5;overflow:visible;display:none;"> <h2 class="info">Déplacer dans un autre journal </h2> <p class="notice">Attention, pour les opérations sélectionnées,cela transfèrera les opérations vers le journal choisi mais il faut que ce journal soit de même type (achat vers achat, vente vers vente...), les pièces justificatives ne seront pas mises à jour, soyez prudent</p> @@ -170,4 +212,5 @@ new Draggable('div_card',{zindex:2}); new Draggable('div_ledger',{zindex:2}); new Draggable('div_poste',{zindex:2}); +new Draggable('div_card_account',{zindex:2}); </script> \ No newline at end of file Modified: trunk/tools/include/tool_function.php =================================================================== --- trunk/tools/include/tool_function.php 2012-03-22 22:18:41 UTC (rev 308) +++ trunk/tools/include/tool_function.php 2012-03-22 22:23:29 UTC (rev 309) @@ -38,7 +38,7 @@ } else return "Erreur : aucune opération n'est sélectionnée"; - + return ""; } @@ -61,7 +61,7 @@ $target=$cn->get_value('select pcm_val from tmp_pcmn where pcm_val=$1',array($_POST['tposte'])); if ( $source == '' || $target == '') { - echo '<p class="error"> Il manque soit le poste comptable source soit le poste comptable destination ou l\'un des deux postes n\'existe pas</p>'; + echo '<p class="error"> Il manque soit le poste comptable source soit le poste comptable destination ou l\'un des deux postes n\'existe pas</p>'; return; } $cn->prepare('update_account','update jrnx set j_poste = $1 where j_id in (select j_id from jrnx join jrn on (jr_grpt_id=j_grpt) and jr_id=$2) and j_poste=$3 @@ -91,8 +91,64 @@ echo '</table>'; echo '<p> Nombre d\'opérations changées :'.$count.'</p>'; } + /** + *@brief change the accounting in the selected operation by a card (with a possible different accounting + *@param $cn database connx + *@note use the $_POST variables + * - csource1 accounting source + * - ctarget1 card target + * - jr_id[] + */ +function change_card_account(&$cn) +{ + $msg= check_jrid(); + if( $msg != "") + { + echo " <p class=\"error\">$msg</p>"; return; + } + $source=$cn->get_value('select pcm_val from tmp_pcmn where pcm_val=$1',array($_POST['csource1'])); + $target=$cn->get_value('select f_id from fiche_detail where ad_id=23 and ad_value=trim(upper($1))',array($_POST['ctarget1'])); + if ( $source == '' || $target == '') + { + echo '<p class="error"> Il manque soit le poste comptable source soit la fiche destination ou l\'un des deux n\'existe pas</p>'; + return; + } + // accounting target + $target_account=$cn->get_value('select pcm_val from tmp_pcmn where pcm_val in (select ad_value from fiche_detail where ad_id=5 and f_id=$1)',array($target)); + if ($target_account == '') { + echo '<p class="error"> Le poste comptable de la fiche n\'existe pas</span>'; + return; + } + $cn->prepare('update_account','update jrnx set j_poste = $1,j_qcode=upper($2),f_id=$3 where j_id in (select j_id from jrnx join jrn on (jr_grpt_id=j_grpt) and jr_id=$4) and j_poste=$5 + RETURNING j_id '); + $cn->prepare('retrieve','select jr_date,jr_comment,jr_montant,jr_internal from jrn where jr_id=$1'); + echo h2info('Opération changée'); + echo 'compte : '.$_REQUEST['sposte'].' vers '.$_REQUEST['tposte']; + $count=0; + echo '<table class="result">'; + foreach ($_POST['jr_id'] as $id) + { + $update=$cn->execute('update_account',array(trim($target_account),trim($_POST['ctarget1']),$target,$id,trim($_POST['csource1']))); + if ( Database::num_row($update) ==0 ) continue; + $feedback=$cn->execute('retrieve',array($id)); + if ( Database::num_row($feedback) != 0) + { + $count++; + $row=Database::fetch_array($feedback,0); + echo '<tr>'; + echo td(format_date($row['jr_date'])); + echo td(HtmlInput::detail_op($id,$row['jr_internal'])); + echo td($row['jr_comment']); + echo td(nbm($row['jr_montant'],' class="num"')); + echo '</tr>'; + } + } + echo '</table>'; + echo '<p> Nombre d\'opérations changées :'.$count.'</p>'; +} + /** *@brief change the accounting and card in the selected operations *@param $cn database connx @@ -113,7 +169,7 @@ if ( $source == '' || $target == '') { - echo '<p class="error"> Il manque soit la fiche source soit le fiche destination ou l\'une des deux fiches n\'existe pas</p>'; + echo '<p class="error"> Il manque soit la fiche source soit le fiche destination ou l\'une des deux fiches n\'existe pas</p>'; return; } /* @@ -127,7 +183,7 @@ */ if ( $source_account == '' || $target_account == '') { - echo '<p class="error"> L\'une des deux fiche n\'a pas de poste comptable</p>'; + echo '<p class="error"> L\'une des deux fiche n\'a pas de poste comptable</p>'; return; } @@ -146,7 +202,7 @@ j_id in (select j_id from jrnx join jrn on (jr_grpt_id=j_grpt) and jr_id=$2) and qs_client=$3'); /* - * Change also in quant_purchase + * Change also in quant_purchase */ $cn->prepare('update_pur_mer','update quant_purchase set qp_fiche=$1 where j_id in (select j_id from jrnx join jrn on (jr_grpt_id=j_grpt) and jr_id=$2) and qp_fiche=$3'); @@ -192,7 +248,7 @@ $cn->execute('update_fin_bk',array($target,$id,$source)); $cn->execute('update_fin_oth',array($target,$id,$source)); break; - + } } @@ -211,7 +267,7 @@ echo td(nbm($row['jr_montant'],' class="num"')); echo '</tr>'; } - + } echo '</table>'; $cn->commit(); @@ -321,7 +377,7 @@ where jr_def_id=$1 and jr_date >= to_date($2,'DD.MM.YYYY') and jr_date <= to_date($3,'DD.MM.YYYY') - order by jr_date asc,substring(jr_pj_number,'\\\\d+$')::numeric asc + order by jr_date asc,substring(jr_pj_number,'\\\\d+$')::numeric asc "; $ret=$cn->exec_sql($sql,array($_GET['ledger'],$_GET['dstart'],$_GET['dend'])); $nb_row=Database::num_row($ret); @@ -331,7 +387,7 @@ } /** *@brief display the prefix + from number - *@note use the variable from $_GET + *@note use the variable from $_GET */ function display_numb_receipt() { --- PhpCompta est un logiciel de comptabilité libre en ligne (full web) Projet opensource http://www.phpcompta.eu _______________________________________________ Phpcompta est un logiciel libre de comptabilité en ligne (http://www.phpcompta.eu) Phpcompta-dev mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/phpcompta-dev
