[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r303 - in tag/rel601/tools/include: . template
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r303 - in tag/rel601/tools/include: . template |
Date: |
Sat, 11 Feb 2012 20:31:51 +0100 (CET) |
Author: danydb
Date: 2012-02-11 20:31:50 +0100 (Sat, 11 Feb 2012)
New Revision: 303
Modified:
tag/rel601/tools/include/operation.inc.php
tag/rel601/tools/include/template/search_view.php
tag/rel601/tools/include/tool_function.php
Log:
Allow to change accounting by card
Modified: tag/rel601/tools/include/operation.inc.php
===================================================================
--- tag/rel601/tools/include/operation.inc.php 2012-02-09 13:09:06 UTC (rev
302)
+++ tag/rel601/tools/include/operation.inc.php 2012-02-11 19:31:50 UTC (rev
303)
@@ -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: tag/rel601/tools/include/template/search_view.php
===================================================================
--- tag/rel601/tools/include/template/search_view.php 2012-02-09 13:09:06 UTC
(rev 302)
+++ tag/rel601/tools/include/template/search_view.php 2012-02-11 19:31:50 UTC
(rev 303)
@@ -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: tag/rel601/tools/include/tool_function.php
===================================================================
--- tag/rel601/tools/include/tool_function.php 2012-02-09 13:09:06 UTC (rev
302)
+++ tag/rel601/tools/include/tool_function.php 2012-02-11 19:31:50 UTC (rev
303)
@@ -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>';
}
+ /**
+ address@hidden change the accounting in the selected operation by a card
(with a possible different accounting
+ address@hidden $cn database connx
+ address@hidden 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>';
+}
+
/**
address@hidden change the accounting and card in the selected operations
address@hidden $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 @@
}
/**
address@hidden display the prefix + from number
- address@hidden use the variable from $_GET
+ address@hidden 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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpcompta-dev] r303 - in tag/rel601/tools/include: . template,
phpcompta-dev <=