Task #0001992: Prévision, calcul avec comptabilité analytique
This commit is contained in:
parent
2838cc2f08
commit
1a632a2d1c
37 changed files with 1675 additions and 1189 deletions
52
include/template/acc_report-create.php
Normal file
52
include/template/acc_report-create.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
// Copyright (2002-2021) Author Dany De Bontridder <danydb@noalyss.eu>
|
||||
|
||||
if (!defined('ALLOWED'))
|
||||
die('Appel direct ne sont pas permis');
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief display a form to enter a new Report definition
|
||||
*/
|
||||
$http=new HttpInput();
|
||||
?>
|
||||
<div id="acc_report_create_div" class="inner_box" style="display:none">
|
||||
<?=HtmlInput::title_box(_("Nouveau rapport"), "acc_report_create_div","hide")?>
|
||||
<form method="POST" enctype="multipart/form-data" >
|
||||
<?=HtmlInput::hidden("ac", $http->request("ac"))?>
|
||||
<?=HtmlInput::hidden("action", "add")?>
|
||||
<?=Dossier::hidden()?>
|
||||
<label for="fr_name"><?=_("Nom")?></label>
|
||||
<input type="text" name="fr_name" autofocus class="input_text" required>
|
||||
<?php
|
||||
echo '<h3> Importation</h3>';
|
||||
$wUpload=new IFile();
|
||||
$wUpload->name='report';
|
||||
$wUpload->value='report_value';
|
||||
echo _('Importer ce rapport').' ';
|
||||
echo $wUpload->input();
|
||||
?>
|
||||
<ul class="aligned-block">
|
||||
<li><?=HtmlInput::submit(uniqid(),_("Sauver"))?></li>
|
||||
<li><?=HtmlInput::button_hide("acc_report_create_div")?></li>
|
||||
</ul>
|
||||
</form>
|
||||
</div>
|
||||
|
|
@ -51,8 +51,7 @@ if (count($aPerMonth[$i]) != 0 ){
|
|||
echo p("\$aPeriode[$h]['p_id']==\$aPerMonth[$i][$x]['fi_pid'] ".
|
||||
$aPeriode[$h]['p_id']."==".$aPerMonth[$i][$x]['fi_pid'] );
|
||||
|
||||
echo p(" \$aItem[$i][$e]['fi_card']==\$aPerMonth[$i][$x]['fi_card'] ".
|
||||
$aItem[$i][$e]['fi_card']."==".$aPerMonth[$i][$x]['fi_card'] );
|
||||
|
||||
echo p( " \$aItem[$i][$e]['fi_account']==\$aPerMonth[$i][$x]['fi_account']".
|
||||
$aItem[$i][$e]['fi_account']."==".$aPerMonth[$i][$x]['fi_account']);
|
||||
if ($aPeriode[$h]['p_id']==$aPerMonth[$i][$x]['fi_pid']) {
|
||||
|
|
@ -60,12 +59,7 @@ if (count($aPerMonth[$i]) != 0 ){
|
|||
} else {
|
||||
echo p("\$aPeriode[$h]['p_id']==\$aPerMonth[$i][$x]['fi_pid'] NO");
|
||||
}
|
||||
if ( $aItem[$i][$e]['fi_card']==$aPerMonth[$i][$x]['fi_card']){
|
||||
echo "\$aItem[$i][$e]['fi_card']==\$aPerMonth[$i][$x]['fi_card'] YES";
|
||||
} else {
|
||||
echo "\$aItem[$i][$e]['fi_card']==\$aPerMonth[$i][$x]['fi_card'] NO";
|
||||
|
||||
}
|
||||
|
||||
if ($aItem[$i][$e]['fi_account']==$aPerMonth[$i][$x]['fi_account']) {
|
||||
echo p("\$aItem[$i][$e]['fi_account']==\$aPerMonth[$i][$x]['fi_account']YES");
|
||||
} else {
|
||||
|
|
@ -77,7 +71,6 @@ if (count($aPerMonth[$i]) != 0 ){
|
|||
$amount=$aItem[$i][$e]['fi_amount'];
|
||||
if (
|
||||
$aPeriode[$h]['p_id']==$aPerMonth[$i][$x]['fi_pid'] &&
|
||||
trim($aItem[$i][$e]['fi_card'])==trim($aPerMonth[$i][$x]['fi_card']) &&
|
||||
trim($aItem[$i][$e]['fi_account'])==trim($aPerMonth[$i][$x]['fi_account'])
|
||||
)
|
||||
{
|
||||
|
|
@ -163,12 +156,7 @@ $tot_cat_estm=bcadd($amount,$tot_cat_estm);
|
|||
|
||||
<?php
|
||||
$diff= bcsub( $aReal[$i][$e][$h],$estm[$i][$e][$h]);
|
||||
if ( ( $aItem[$i][$e]['fi_card']!="" && $aItem[$i][$e]['fi_debit'] == 'C' && $diff < 0)
|
||||
|| ($aItem[$i][$e]['fi_card'] && $aItem[$i][$e]['fi_debit'] == 'D' && $diff > 0))
|
||||
{
|
||||
echo '<td style="text-align:right;background-color:red;color:white">';
|
||||
}
|
||||
else if ($diff==0)
|
||||
if ($diff==0)
|
||||
{
|
||||
echo '<td style="text-align:right;">';
|
||||
}
|
||||
|
|
@ -199,11 +187,7 @@ echo nbm( $diff);
|
|||
<?php
|
||||
$diff= bcsub($aReal[$i][$e][$h],$estm[$i][$e][$h]);
|
||||
$cum=bcadd($diff,$cum);
|
||||
if ( ($aItem[$i][$e]['fi_debit'] == 'C' && $cum < 0) || ($aItem[$i][$e]['fi_debit'] == 'D' && $cum > 0))
|
||||
{
|
||||
echo '<td style="text-align:right;background-color:red;color:white">';
|
||||
}
|
||||
else if ($cum ==0)
|
||||
if ($cum ==0)
|
||||
{
|
||||
echo '<td style="text-align:right;">';
|
||||
}
|
||||
|
|
@ -218,14 +202,8 @@ echo nbm( $cum);
|
|||
</td>
|
||||
<?php endfor;?>
|
||||
<?php
|
||||
if ( ($aItem[$i][$e]['fi_debit'] == 'C' && $cum < 0) || ($aItem[$i][$e]['fi_debit'] == 'D' && $cum > 0))
|
||||
{
|
||||
echo '<td style="text-align:right;background-color:red;color:white">';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
echo '<td style="text-align:right;background-color:green;color:white">';
|
||||
}
|
||||
echo nbm( $cum);
|
||||
?>
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -140,8 +140,8 @@ if ( ! empty ($array) ) {
|
|||
*/
|
||||
$report=$g_user->get_mini_report();
|
||||
|
||||
$rapport=new Acc_Report($cn);
|
||||
$rapport->id=$report;
|
||||
$rapport=new Acc_Report($cn,$report);
|
||||
|
||||
if ( $rapport->exist() == false ) {
|
||||
$g_user->set_mini_report(0);
|
||||
$report=0;
|
||||
|
|
|
|||
|
|
@ -52,44 +52,12 @@ $forecast_text = new IText("fi_text");
|
|||
$forecast_text->value = $object->getp("fi_text");
|
||||
|
||||
/* Accounting*/
|
||||
$account = new IPoste('fi_account');
|
||||
$account = new ITextarea('fi_account');
|
||||
$account->value=$object->getp("fi_account");
|
||||
$account->id=uniqid("fi_account");
|
||||
$account->nb_row=3;
|
||||
$account->extra=' style = "margin-left:0px;width:100%;" class="input_text"';
|
||||
$account->set_attribute('account', 'fi_account');
|
||||
$account->set_attribute('bracket', 1);
|
||||
$account->set_attribute('no_overwrite', 1);
|
||||
$account->set_attribute('noquery', 1);
|
||||
$account->value = $object->getp("fi_account");
|
||||
$account->size="80rem";
|
||||
/*Quick Code */
|
||||
$qc = new ICard("fi_card");
|
||||
// If double click call the javascript fill_ipopcard
|
||||
$qc->set_dblclick("fill_ipopcard(this);");
|
||||
|
||||
// name of the field to update with the name of the card
|
||||
$qc->set_attribute('label', 'an_label');
|
||||
|
||||
// Type of card : all
|
||||
$qc->set_attribute('typecard', 'all');
|
||||
$qc->set_attribute('jrn', 0);
|
||||
$qc->extra = 'all';
|
||||
|
||||
// when value selected in the autcomplete
|
||||
$qc->set_function('fill_data');
|
||||
if ($object->getp("fi_card") != "") {
|
||||
|
||||
$qc->value = $cn->get_value("select ad_value
|
||||
from fiche_detail
|
||||
where
|
||||
ad_id=23 and f_id = $1", [$object->getp("fi_card")]);
|
||||
}
|
||||
|
||||
$isDebit=new ISelect("fi_debit");
|
||||
$isDebit->value=array(
|
||||
array("label"=>_("Crédit"),"value"=>'C'),
|
||||
array("label"=>_("Débit"),"value"=>'D')
|
||||
);
|
||||
$isDebit->selected=$object->getp("fi_debit");
|
||||
|
||||
$isPeriode = new ISelect('fi_pid');
|
||||
$isPeriode->value = $aPeriode;
|
||||
|
|
@ -116,24 +84,13 @@ $amount_initial->value=($amount_initial->value=='')?0:$amount_initial->value;
|
|||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?= _("Intitulé") ?></td>
|
||||
<td><?=$this->show_error("fi_text")?> <?= _("Intitulé") ?></td>
|
||||
<td><?= $forecast_text->input(); ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<?= _("Fiche") ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $qc->input(); ?><?=$qc->search()?>
|
||||
<span id="an_label"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?= _("Positif") ?><?= Icon_Action::tips(_("Ne concerne que les fiches"))?></td>
|
||||
<td><?=$isDebit->input(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?=$this->show_error("fi_account")?>
|
||||
<?= _("Formule") ?>
|
||||
( <a href="https://wiki.noalyss.eu/doku.php?id=tutoriaux:les_rapports#un_mot_d_explication" target="_blank">
|
||||
Aide</a> )
|
||||
|
|
@ -141,6 +98,10 @@ $amount_initial->value=($amount_initial->value=='')?0:$amount_initial->value;
|
|||
</td>
|
||||
<td>
|
||||
<?= $account->input() ?>
|
||||
<?= HtmlInput::button_action(_("Cherche poste, fiche , analytique"),
|
||||
sprintf('search_account_card({gDossier:%s,target:\'%s\'})',Dossier::id(),
|
||||
$account->id))
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue