[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r541 - in trunk/rapport_avance: . doc include include/te
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r541 - in trunk/rapport_avance: . doc include include/template sql |
Date: |
Wed, 23 Oct 2013 20:08:03 +0200 (CEST) |
Author: danydb
Date: 2013-10-23 20:08:02 +0200 (Wed, 23 Oct 2013)
New Revision: 541
Added:
trunk/rapport_avance/doc/rapav-list.dia
trunk/rapport_avance/doc/rapav-listing-code.odt
trunk/rapport_avance/include/liste.inc.php
trunk/rapport_avance/sql/2-date-paiement.sql
Modified:
trunk/rapport_avance/ajax_save_param_detail.php
trunk/rapport_avance/doc/
trunk/rapport_avance/include/class_formulaire_param.php
trunk/rapport_avance/include/class_formulaire_param_detail.php
trunk/rapport_avance/include/class_rapav_declaration.php
trunk/rapport_avance/include/class_rapport_avance_sql.php
trunk/rapport_avance/include/template/param_detail_new.php
trunk/rapport_avance/index.php
trunk/rapport_avance/sql/1-ajout-col-formulaire-param-detail.sql
Log:
Ajout date paiement + journal
Modified: trunk/rapport_avance/ajax_save_param_detail.php
===================================================================
--- trunk/rapport_avance/ajax_save_param_detail.php 2013-10-17 23:36:36 UTC
(rev 540)
+++ trunk/rapport_avance/ajax_save_param_detail.php 2013-10-23 18:08:02 UTC
(rev 541)
@@ -34,155 +34,153 @@
$fp_id = 0;
switch ($tab)
{
- case 'account_tva':
- $acc_tva = new RAPAV_Account_Tva();
- $acc_tva->tva_id = $code_tva;
- $acc_tva->tmp_val = $formtva;
- $acc_tva->jrn_def_type = $code_jrn;
- $acc_tva->p_id = $p_id;
- $acc_tva->type_detail = 2;
- $acc_tva->tt_id = $code_base;
- $acc_tva->jrn_def_id=$p_ledger;
- if ($acc_tva->verify() == 1)
- {
- $code = 'nok';
- $html = "Erreur dans la formule " . $acc_tva->errcode;
- }
- else
- {
- $acc_tva->insert();
- $code = 'ok';
- $fp_id = $acc_tva->fp_id;
- $html = '<td>';
- ob_start();
- $acc_tva->display_row();
- $html.=ob_get_contents();
- ob_end_clean();
- $html.= '</td>';
- $html.='<td id="del_' . $acc_tva->fp_id . '">';
- $html.=HtmlInput::anchor("Effacer", "",
sprintf("onclick=\"delete_param_detail('%s','%s','%s','%s')\""
- ,
$_REQUEST['plugin_code'], $_REQUEST['ac'], $_REQUEST['gDossier'],
$acc_tva->fp_id));
- $html.= '</td>';
- }
- break;
- case 'formula':
- $acc_formula = new RAPAV_Formula();
- $acc_formula->fp_formula = $formula_new;
- $acc_formula->p_id = $p_id;
- $acc_formula->type_detail = 1;
- $acc_formula->jrn_def_id=$p_ledger;
- if ($acc_formula->verify() == 1)
- {
- $code = 'nok';
- $html = $acc_formula->errcode;
- }
- else
- {
- $acc_formula->insert();
- $fp_id = $acc_formula->fp_id;
- $code = 'ok';
- $html = '<td>';
- ob_start();
- $acc_formula->display_row();
- $html.=ob_get_contents();
- ob_end_clean();
- $html.= '</td>';
- $html.='<td id="del_' . $acc_formula->fp_id . '">';
- $html.=HtmlInput::anchor("Effacer", "",
sprintf("onclick=\"delete_param_detail('%s','%s','%s','%s')\""
- ,
$_REQUEST['plugin_code'], $_REQUEST['ac'], $_REQUEST['gDossier'],
$acc_formula->fp_id));
- $html.='</td>';
- }
- break;
- case 'compute_id':
- $acc_compute = new RAPAV_Compute();
- $acc_compute->fp_formula = $form_compute;
- $acc_compute->p_id = $p_id;
- $acc_compute->type_detail = 3;
- $acc_compute->jrn_def_id=null;
- if ($acc_compute->verify() == 1)
- {
- $code = 'nok';
- $html = $acc_compute->errcode;
- }
- else
- {
- $acc_compute->insert();
- $fp_id = $acc_compute->fp_id;
- $code = 'ok';
- $html = '<td>';
- ob_start();
- $acc_compute->display_row();
- $html.=ob_get_contents();
- ob_end_clean();
- $html.= '</td>';
- $html.='<td id="del_' . $acc_compute->fp_id . '">';
- $html.=HtmlInput::anchor("Effacer", "",
sprintf("onclick=\"delete_param_detail('%s','%s','%s','%s')\""
- ,
$_REQUEST['plugin_code'], $_REQUEST['ac'], $_REQUEST['gDossier'],
$acc_compute->fp_id));
- $html.='</td>';
- }
- break;
- case 'new_account_id':
- $acc_account = new RAPAV_Account();
- $acc_account->tmp_val = $account_first;
- $acc_account->with_tmp_val = $account_second;
- $acc_account->p_id = $p_id;
- $acc_account->type_detail = 4;
- $acc_account->type_sum_account= $account_sum_type;
- $acc_account->jrn_def_id=$p_ledger;
- if ($acc_account->verify() == 1)
- {
- $code = 'nok';
- $html = $acc_account->errcode;
- }
- else
- {
- $acc_account->insert();
- $fp_id = $acc_account->fp_id;
- $code = 'ok';
- $html = '<td>';
- ob_start();
- $acc_account->display_row();
- $html.=ob_get_contents();
- ob_end_clean();
- $html.= '</td>';
- $html.='<td id="del_' . $acc_account->fp_id . '">';
- $html.=HtmlInput::anchor("Effacer", "",
sprintf("onclick=\"delete_param_detail('%s','%s','%s','%s')\""
- ,
$_REQUEST['plugin_code'], $_REQUEST['ac'], $_REQUEST['gDossier'],
$acc_account->fp_id));
- $html.='</td>';
- }
- break;
+ case 'account_tva':
+ $acc_tva = new RAPAV_Account_Tva();
+ $acc_tva->tva_id = $code_tva;
+ $acc_tva->tmp_val = $formtva;
+ $acc_tva->jrn_def_type = $code_jrn;
+ $acc_tva->p_id = $p_id;
+ $acc_tva->type_detail = 2;
+ $acc_tva->tt_id = $code_base;
+ $acc_tva->jrn_def_id = $p_ledger;
+ $acc_tva->date_paid=(isset($p_paid))?1:0;
+ if ($acc_tva->verify() == 1)
+ {
+ $code = 'nok';
+ $html = "Erreur dans la formule " . $acc_tva->errcode;
+ } else
+ {
+ $acc_tva->insert();
+ $code = 'ok';
+ $fp_id = $acc_tva->fp_id;
+ $html = '<td>';
+ ob_start();
+ $acc_tva->display_row();
+ $html.=ob_get_contents();
+ ob_end_clean();
+ $html.= '</td>';
+ $html.='<td id="del_' . $acc_tva->fp_id . '">';
+ $html.=HtmlInput::anchor("Effacer", "",
sprintf("onclick=\"delete_param_detail('%s','%s','%s','%s')\""
+ , $_REQUEST['plugin_code'],
$_REQUEST['ac'], $_REQUEST['gDossier'], $acc_tva->fp_id));
+ $html.= '</td>';
+ }
+ break;
+ case 'formula':
+ $acc_formula = new RAPAV_Formula();
+ $acc_formula->fp_formula = $formula_new;
+ $acc_formula->p_id = $p_id;
+ $acc_formula->type_detail = 1;
+ $acc_formula->jrn_def_id = $p_ledger;
+ $acc_formula->date_paid=(isset($p_paid))?1:0;
+ if ($acc_formula->verify() == 1)
+ {
+ $code = 'nok';
+ $html = $acc_formula->errcode;
+ } else
+ {
+ $acc_formula->insert();
+ $fp_id = $acc_formula->fp_id;
+ $code = 'ok';
+ $html = '<td>';
+ ob_start();
+ $acc_formula->display_row();
+ $html.=ob_get_contents();
+ ob_end_clean();
+ $html.= '</td>';
+ $html.='<td id="del_' . $acc_formula->fp_id . '">';
+ $html.=HtmlInput::anchor("Effacer", "",
sprintf("onclick=\"delete_param_detail('%s','%s','%s','%s')\""
+ , $_REQUEST['plugin_code'],
$_REQUEST['ac'], $_REQUEST['gDossier'], $acc_formula->fp_id));
+ $html.='</td>';
+ }
+ break;
+ case 'compute_id':
+ $acc_compute = new RAPAV_Compute();
+ $acc_compute->fp_formula = $form_compute;
+ $acc_compute->p_id = $p_id;
+ $acc_compute->type_detail = 3;
+ $acc_compute->jrn_def_id = null;
+ if ($acc_compute->verify() == 1)
+ {
+ $code = 'nok';
+ $html = $acc_compute->errcode;
+ } else
+ {
+ $acc_compute->insert();
+ $fp_id = $acc_compute->fp_id;
+ $code = 'ok';
+ $html = '<td>';
+ ob_start();
+ $acc_compute->display_row();
+ $html.=ob_get_contents();
+ ob_end_clean();
+ $html.= '</td>';
+ $html.='<td id="del_' . $acc_compute->fp_id . '">';
+ $html.=HtmlInput::anchor("Effacer", "",
sprintf("onclick=\"delete_param_detail('%s','%s','%s','%s')\""
+ , $_REQUEST['plugin_code'],
$_REQUEST['ac'], $_REQUEST['gDossier'], $acc_compute->fp_id));
+ $html.='</td>';
+ }
+ break;
+ case 'new_account_id':
+ $acc_account = new RAPAV_Account();
+ $acc_account->tmp_val = $account_first;
+ $acc_account->with_tmp_val = $account_second;
+ $acc_account->p_id = $p_id;
+ $acc_account->type_detail = 4;
+ $acc_account->type_sum_account = $account_sum_type;
+ $acc_account->jrn_def_id = $p_ledger;
+ $acc_account->date_paid=(isset($p_paid))?1:0;
+ if ($acc_account->verify() == 1)
+ {
+ $code = 'nok';
+ $html = $acc_account->errcode;
+ } else
+ {
+ $acc_account->insert();
+ $fp_id = $acc_account->fp_id;
+ $code = 'ok';
+ $html = '<td>';
+ ob_start();
+ $acc_account->display_row();
+ $html.=ob_get_contents();
+ ob_end_clean();
+ $html.= '</td>';
+ $html.='<td id="del_' . $acc_account->fp_id . '">';
+ $html.=HtmlInput::anchor("Effacer", "",
sprintf("onclick=\"delete_param_detail('%s','%s','%s','%s')\""
+ , $_REQUEST['plugin_code'],
$_REQUEST['ac'], $_REQUEST['gDossier'], $acc_account->fp_id));
+ $html.='</td>';
+ }
+ break;
- case 'new_reconcile_id':
- $acc_account = new RAPAV_Reconcile();
- $acc_account->tmp_val = $acrec_first;
- $acc_account->with_tmp_val = $acrec_second;
- $acc_account->operation_pcm_val = $acrec_third;
- $acc_account->p_id = $p_id;
- $acc_account->type_detail = 5;
- $acc_account->type_sum_account= $account_sum_type;
- $acc_account->jrn_def_id=$p_ledger;
- if ($acc_account->verify() == 1)
- {
- $code = 'nok';
- $html = $acc_account->errcode;
- }
- else
- {
- $acc_account->insert();
- $fp_id = $acc_account->fp_id;
- $code = 'ok';
- $html = '<td>';
- ob_start();
- $acc_account->display_row();
- $html.=ob_get_contents();
- ob_end_clean();
- $html.= '</td>';
- $html.='<td id="del_' . $acc_account->fp_id . '">';
- $html.=HtmlInput::anchor("Effacer", "",
sprintf("onclick=\"delete_param_detail('%s','%s','%s','%s')\""
- ,
$_REQUEST['plugin_code'], $_REQUEST['ac'], $_REQUEST['gDossier'],
$acc_account->fp_id));
- $html.='</td>';
- }
- break;
+ case 'new_reconcile_id':
+ $acc_account = new RAPAV_Reconcile();
+ $acc_account->tmp_val = $acrec_first;
+ $acc_account->with_tmp_val = $acrec_second;
+ $acc_account->operation_pcm_val = $acrec_third;
+ $acc_account->p_id = $p_id;
+ $acc_account->type_detail = 5;
+ $acc_account->type_sum_account = $account_sum_type;
+ $acc_account->jrn_def_id = $p_ledger;
+ if ($acc_account->verify() == 1)
+ {
+ $code = 'nok';
+ $html = $acc_account->errcode;
+ } else
+ {
+ $acc_account->insert();
+ $fp_id = $acc_account->fp_id;
+ $code = 'ok';
+ $html = '<td>';
+ ob_start();
+ $acc_account->display_row();
+ $html.=ob_get_contents();
+ ob_end_clean();
+ $html.= '</td>';
+ $html.='<td id="del_' . $acc_account->fp_id . '">';
+ $html.=HtmlInput::anchor("Effacer", "",
sprintf("onclick=\"delete_param_detail('%s','%s','%s','%s')\""
+ , $_REQUEST['plugin_code'],
$_REQUEST['ac'], $_REQUEST['gDossier'], $acc_account->fp_id));
+ $html.='</td>';
+ }
+ break;
}
//echo $html;exit();
$html = escape_xml($html);
Property changes on: trunk/rapport_avance/doc
___________________________________________________________________
Name: svn:ignore
- .~lock.rapav.odt#
+ .~lock.rapav.odt#
.~lock.rapav-listing-code.odt#
Added: trunk/rapport_avance/doc/rapav-list.dia
===================================================================
(Binary files differ)
Property changes on: trunk/rapport_avance/doc/rapav-list.dia
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/rapport_avance/doc/rapav-listing-code.odt
===================================================================
(Binary files differ)
Property changes on: trunk/rapport_avance/doc/rapav-listing-code.odt
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/rapport_avance/include/class_formulaire_param.php
===================================================================
--- trunk/rapport_avance/include/class_formulaire_param.php 2013-10-17
23:36:36 UTC (rev 540)
+++ trunk/rapport_avance/include/class_formulaire_param.php 2013-10-23
18:08:02 UTC (rev 541)
@@ -76,7 +76,7 @@
header('Pragma: public');
header('Content-type: application/bin');
header('Content-Disposition: attachment;filename="' . $title .
'.bin"', FALSE);
- fputcsv($out, array("RAPAV", '3'), ";");
+ fputcsv($out, array("RAPAV", '4'), ";");
fputcsv($out, array($form->f_title, $form->f_description), ";");
$array = $cn->get_array("select p_id,p_code, p_libelle, p_type,
p_order, f_id, t_id
from rapport_advanced.formulaire_param where f_id=$1",
array($p_id));
@@ -87,7 +87,7 @@
fputcsv($out, array('RAPAV_DETAIL'), ";");
$array = $cn->get_array("select
fp_id, p_id, tmp_val, tva_id, fp_formula, fp_signed,
jrn_def_type,
- tt_id, type_detail, with_tmp_val, type_sum_account,
operation_pcm_val
+ tt_id, type_detail, with_tmp_val, type_sum_account,
operation_pcm_val,date_paid
from rapport_advanced.formulaire_param_detail where
p_id in (select p_id from rapport_advanced.formulaire_param where f_id=$1)",
array($p_id));
for ($i = 0; $i < count($array); $i++)
{
@@ -143,10 +143,14 @@
$t[$o] = $csv[$o];
}
}
- $cn->get_array("INSERT INTO
rapport_advanced.restore_formulaire_param_detail(
- fp_id, p_id, tmp_val, tva_id, fp_formula, fp_signed, jrn_def_type,
- tt_id, type_detail, with_tmp_val, type_sum_account,
operation_pcm_val)
- VALUES ($1, $2, $3, $4, $5, $6, $7,$8, $9, $10,
$11, $12)", $t);
+ if ($rapav_version < 4 )
+ {
+ $t[12]=0;
+ }
+ $cn->get_array("INSERT INTO
rapport_advanced.restore_formulaire_param_detail(
+ fp_id, p_id, tmp_val, tva_id, fp_formula, fp_signed, jrn_def_type,
+ tt_id, type_detail, with_tmp_val, type_sum_account,
operation_pcm_val,date_paid)
+ VALUES ($1, $2, $3, $4, $5, $6, $7,$8, $9, $10,
$11, $12,$13)", $t);
}
/// Update now the table
rapport_advanced.restore_formulaire_param and set the correct pk
/// $cn->exec_sql("update
rapport_advanced.restore_formulaire_param set
p_id=nextval('rapport_advanced.formulaire_param_p_id_seq')");
@@ -154,7 +158,7 @@
// Insert row by row + detail
$array=$cn->get_array("select
p_id,p_code,p_libelle,p_order,f_id,t_id from
rapport_advanced.restore_formulaire_param where f_id=$1",array($form->f_id));
// Prepare stmt for the details
- $cn->prepare('detail','select
p_id,tmp_val,tva_id,fp_formula,fp_signed,
jrn_def_type,tt_id,type_detail,with_tmp_val,type_sum_account,operation_pcm_val
+ $cn->prepare('detail','select
p_id,tmp_val,tva_id,fp_formula,fp_signed,
jrn_def_type,tt_id,type_detail,with_tmp_val,type_sum_account,operation_pcm_val,date_paid
from
rapport_advanced.restore_formulaire_param_detail where p_id=$1');
$nb=count($array);
for ($e=0;$e<$nb;$e++)
@@ -164,8 +168,39 @@
select p_code, p_libelle, p_type,
p_order, f_id, t_id
from rapport_advanced.restore_formulaire_param
where p_id=$1 returning p_id",array($array[$e]['p_id']));
// Insert detail
- $cn->exec_sql("insert into
rapport_advanced.formulaire_param_detail select
nextval('rapport_advanced.formulaire_param_detail_fp_id_seq'), $new_pid,
tmp_val, tva_id, fp_formula, fp_signed, jrn_def_type,
- tt_id, type_detail, with_tmp_val, type_sum_account,
operation_pcm_val from rapport_advanced.restore_formulaire_param_detail where
p_id =$1
+ $cn->exec_sql("insert into
rapport_advanced.formulaire_param_detail
+ (fp_id,
+ p_id,
+ tmp_val,
+ tva_id,
+ fp_formula,
+ fp_signed,
+ jrn_def_type,
+ tt_id,
+ type_detail,
+ with_tmp_val,
+ type_sum_account,
+ operation_pcm_val,
+ jrn_def_id,
+ date_paid
+ )
+ select
+
nextval('rapport_advanced.formulaire_param_detail_fp_id_seq'),
+ $new_pid,
+ tmp_val,
+ tva_id,
+ fp_formula,
+ fp_signed,
+ jrn_def_type,
+ tt_id,
+ type_detail,
+ with_tmp_val,
+ type_sum_account,
+ operation_pcm_val,
+ -1,
+ date_paid
+ from
+
rapport_advanced.restore_formulaire_param_detail where p_id =$1
",array($array[$e]['p_id']));
}
Modified: trunk/rapport_avance/include/class_formulaire_param_detail.php
===================================================================
--- trunk/rapport_avance/include/class_formulaire_param_detail.php
2013-10-17 23:36:36 UTC (rev 540)
+++ trunk/rapport_avance/include/class_formulaire_param_detail.php
2013-10-23 18:08:02 UTC (rev 541)
@@ -38,10 +38,7 @@
$parent = new Formulaire_Param($p_id);
echo HtmlInput::title_box('Formule', 'param_detail_div');
echo '<h2>' . $parent->p_code . " " . $parent->p_libelle . '</h2>';
- $select = new ISelect('p_ledger');
- $a_ledger = $cn->make_array('select jrn_def_id,jrn_def_name from
jrn_def order by 2', 1);
- $a_ledger[0]['label'] = '-- Tous les journaux -- ';
- $select->value = $a_ledger;
+
require_once 'template/param_detail_new.php';
}
@@ -49,7 +46,7 @@
{
global $cn;
$ledger = "";
- if ($this->jrn_def_id == null || $this->jrn_def_id==-1)
+ if ($this->jrn_def_id == null || $this->jrn_def_id == -1)
{
$ledger = " tous les journaux";
} else
@@ -60,6 +57,26 @@
return $ledger;
}
+ static function input_ledger()
+ {
+ global $cn;
+ $select = new ISelect('p_ledger');
+ $a_ledger = $cn->make_array('select jrn_def_id,jrn_def_name from
jrn_def order by 2', 1);
+ $a_ledger[0]['label'] = '-- Tous les journaux -- ';
+ $select->value = $a_ledger;
+
+ echo '<p> Filtrage par journal ' . $select->input() . '</p>';
+ }
+
+ static function input_date_paiement()
+ {
+ $ck_paid = new ICheckBox('p_paid');
+ echo '<p> La date donnée concerne la date de paiement, ce qui limitera
la recherche aux journaux VEN et ACH ';
+ echo HtmlInput::infobulle(36);
+ echo $ck_paid->input();
+ echo '</p>';
+ }
+
}
class RAPAV_Formula extends Formulaire_Param_Detail
@@ -68,7 +85,8 @@
function display_row()
{
$ledger = $this->get_ledger_name();
- printf("Résultat de la formule %s utilisant $ledger",
$this->fp_formula);
+ $paid = ( $this->date_paid != 0 ) ? "la date concerne la date de
paiement, la recherche sera limitée au journaux de type ACH & VEN" : "";
+ printf("Résultat de la formule %s utilisant $ledger %s",
$this->fp_formula, $paid);
}
static function new_row()
@@ -82,6 +100,8 @@
$account->set_attribute('noquery', 1);
$account->set_attribute('account', $account->id);
echo $account->input();
+ Formulaire_Param_Detail::input_date_paiement();
+ Formulaire_Param_Detail::input_ledger();
}
function verify()
@@ -109,7 +129,8 @@
global $cn;
$ledger = $this->get_ledger_name();
$type_total = $cn->get_value("select tt_label from
rapport_advanced.total_type where tt_id=$1", array($this->tt_id));
- printf("Poste comptable %s avec le code tva %s (%s) dans le journal de
type %s [ %s ] $ledger", $this->tmp_val, $this->tva_id, $this->tva_id,
$this->jrn_def_type, $type_total);
+ $paid = ( $this->date_paid != 0 ) ? "la date concerne la date de
paiement, la recherche sera limitée au journaux de type ACH & VEN" : "";
+ printf("Poste comptable %s avec le code tva %s (%s) dans le journal de
type %s [ %s ] $ledger %s", $this->tmp_val, $this->tva_id, $this->tva_id,
$this->jrn_def_type, $type_total, $paid);
}
static function new_row()
@@ -147,6 +168,8 @@
echo td($code_base->input());
echo '</tr>';
echo '</table>';
+ Formulaire_Param_Detail::input_date_paiement();
+ Formulaire_Param_Detail::input_ledger();
}
function verify()
@@ -225,8 +248,9 @@
{
global $cn;
$ledger = $this->get_ledger_name();
+ $paid = ( $this->date_paid != 0 ) ? "la date concerne la date de
paiement, la recherche sera limitée au journaux de type ACH & VEN" : "";
$total_type_account = $cn->get_value('select tt_label from
rapport_advanced.total_type_account where tt_id=$1',
array($this->type_sum_account));
- printf("Total %s poste comptable %s utilisé avec le poste comptable %s
utilisant $ledger", $total_type_account, $this->tmp_val, $this->with_tmp_val);
+ printf("Total %s poste comptable %s utilisé avec le poste comptable %s
utilisant $ledger %s", $total_type_account, $this->tmp_val,
$this->with_tmp_val, $paid);
}
static function new_row($p_id)
@@ -258,6 +282,8 @@
echo ' utilisé avec le poste comptable ' . HtmlInput::infobulle(203);
echo $account_second->input();
echo '</p>';
+ Formulaire_Param_Detail::input_date_paiement();
+ Formulaire_Param_Detail::input_ledger();
}
function verify()
@@ -328,6 +354,7 @@
echo $account_third->input();
echo '</p>';
+ Formulaire_Param_Detail::input_ledger();
}
function verify()
Modified: trunk/rapport_avance/include/class_rapav_declaration.php
===================================================================
--- trunk/rapport_avance/include/class_rapav_declaration.php 2013-10-17
23:36:36 UTC (rev 540)
+++ trunk/rapport_avance/include/class_rapav_declaration.php 2013-10-23
18:08:02 UTC (rev 541)
@@ -222,7 +222,7 @@
{
echo _('Ne peut pas sauver ' . $oname . ' vers ' . $p_dir . '/' .
$p_filename . ' code d\'erreur =' . $ret);
}
- unlink ($oname);
+ unlink($oname);
}
function special_tag($p_dir, $p_filename, $p_type)
@@ -294,7 +294,7 @@
{
echo _('Ne peut pas sauver ' . $oname . ' vers ' . $p_dir . '/' .
$p_filename . ' code d\'erreur =' . $ret);
}
- unlink ($oname);
+ unlink($oname);
}
function load_document($p_file)
@@ -601,7 +601,7 @@
$this->amount = "0";
$array = $cn->get_array("select
fp_id,p_id,tmp_val,tva_id,fp_formula,fp_signed,jrn_def_type,tt_id,type_detail,
-
with_tmp_val,type_sum_account,operation_pcm_val,jrn_def_id
+
with_tmp_val,type_sum_account,operation_pcm_val,jrn_def_id,date_paid
from rapport_advanced.formulaire_param_detail where
p_id=$1", array($this->param->p_id));
$this->compute_date($p_start, $p_end);
for ($e = 0; $e < count($array); $e++)
@@ -665,7 +665,7 @@
function from_array($p_array)
{
$this->form = new Formulaire_Param_Detail();
- $attribute = explode(',',
'fp_id,p_id,tmp_val,tva_id,fp_formula,fp_signed,jrn_def_type,tt_id,type_detail,with_tmp_val,type_sum_account,operation_pcm_val,jrn_def_id');
+ $attribute = explode(',',
'fp_id,p_id,tmp_val,tva_id,fp_formula,fp_signed,jrn_def_type,tt_id,type_detail,with_tmp_val,type_sum_account,operation_pcm_val,jrn_def_id,date_paid');
foreach ($attribute as $e)
{
$this->form->$e = $p_array[$e];
@@ -692,12 +692,18 @@
function compute($p_start, $p_end)
{
global $cn;
- $sql="";
- if ($this->form->jrn_def_id !=null )
+ $sql = "";
+ if ($this->form->jrn_def_id != null)
{
- $sql=' and j_jrn_def ='.$this->form->jrn_def_id;
+ $sql = ' and j_jrn_def =' . $this->form->jrn_def_id;
}
- $amount = Impress::parse_formula($cn, "", $this->form->fp_formula,
$p_start, $p_end, true, 1,$sql);
+ if ($this->form->date == 1)
+ {
+ $sql.=sprintf(" and jr_date_paid >= to_date('%s','DD.MM.YYYY') and
jr_date_paid <= to_date ('%s','DD.MM.YYYY')", $p_start, $p_end);
+ $p_start = '01.01.1900';
+ $p_end = '01.01.2100';
+ }
+ $amount = Impress::parse_formula($cn, "", $this->form->fp_formula,
$p_start, $p_end, true, 1, $sql);
return $amount['montant'];
}
@@ -776,13 +782,28 @@
{
$filter_ledger = " and j_jrn_def = " .
sql_string($this->form->jrn_def_id);
}
+ if ($this->form->date_paid == 1)
+ {
+ $sql_date=" and j_id in
+ (select j_id from jrnx join jrn on (j_grpt = jr_grpt_id)
+ where
+ coalesce(jr_date_paid,to_date('01.01.1900','DD.MM.YYYY'))
>= to_date($2,'DD.MM.YYYY')
+ and
coalesce(jr_date_paid,to_date('01.01.1900','DD.MM.YYYY')) <=
to_date($3,'DD.MM.YYYY')
+ )
+ ";
+
+ }
+ else
+ {
+ $sql_date="and (j_date >= to_date($2,'DD.MM.YYYY') and j_date <=
to_date($3,'DD.MM.YYYY'))";
+ }
if ($this->form->jrn_def_type == 'ACH')
{
$sql = "select coalesce(sum(qp_vat),0) as amount
from quant_purchase join jrnx
using (j_id)
where qp_vat_code=$1
- and (j_date >=
to_date($2,'DD.MM.YYYY') and j_date <= to_date($3,'DD.MM.YYYY'))
+ $sql_date
and j_poste::text like ($4)
$filter_ledger";
$amount = $this->cn->get_value($sql, array($this->form->tva_id,
$p_start,
@@ -795,7 +816,7 @@
$sql = "select coalesce(sum(qs_vat),0) as amount
from quant_sold join jrnx using
(j_id)
where qs_vat_code=$1 and
- (j_date >=
to_date($2,'DD.MM.YYYY') and j_date <= to_date($3,'DD.MM.YYYY'))
+ $sql_date
and j_poste::text like ($4)
$filter_ledger";
$amount = $this->cn->get_value($sql, array($this->form->tva_id,
@@ -821,15 +842,30 @@
*/
private function compute_amount($p_start, $p_end)
{
- $filter_ledger = "";
+ $filter_ledger = "";
if ($this->form->jrn_def_id != "")
{
$filter_ledger = " and j_jrn_def = " .
sql_string($this->form->jrn_def_id);
}
+ if ($this->form->date_paid == 1)
+ {
+ $sql_date=" and j_id in
+ (select j_id from jrnx join jrn on (j_grpt = jr_grpt_id)
+ where
+ coalesce(jr_date_paid,to_date('01.01.1900','DD.MM.YYYY'))
>= to_date($2,'DD.MM.YYYY')
+ and
coalesce(jr_date_paid,to_date('01.01.1900','DD.MM.YYYY')) <=
to_date($3,'DD.MM.YYYY')
+ )
+ ";
+
+ }
+ else
+ {
+ $sql_date="and (j_date >= to_date($2,'DD.MM.YYYY') and j_date <=
to_date($3,'DD.MM.YYYY'))";
+ }
if ($this->form->jrn_def_type == 'ACH')
{
$sql = "select coalesce(sum(qp_price),0) as amount from
quant_purchase join jrnx using (j_id)
- where qp_vat_code=$1 and (j_date >=
to_date($2,'DD.MM.YYYY') and j_date <= to_date($3,'DD.MM.YYYY'))
+ where qp_vat_code=$1 $sql_date
and j_poste::text like ($4)
$filter_ledger";
$amount = $this->cn->get_value($sql, array($this->form->tva_id,
@@ -842,7 +878,7 @@
{
$sql = "select coalesce(sum(qs_price),0) as amount from quant_sold
join jrnx using (j_id)
- where qs_vat_code=$1 and (j_date >=
to_date($2,'DD.MM.YYYY') and j_date <= to_date($3,'DD.MM.YYYY'))
+ where qs_vat_code=$1 $sql_date
and j_poste::text like ($4)
$filter_ledger";
$amount = $this->cn->get_value($sql, array($this->form->tva_id,
$p_start,
@@ -918,6 +954,22 @@
{
$filter_ledger = " and jrn1.j_jrn_def = " .
sql_string($this->form->jrn_def_id);
}
+
+ if ($this->form->date_paid == 1)
+ {
+ $sql_date=" and j_id in
+ (select j_id from jrnx join jrn on (j_grpt = jr_grpt_id)
+ where
+ coalesce(jr_date_paid,to_date('01.01.1900','DD.MM.YYYY'))
>= to_date($3,'DD.MM.YYYY')
+ and
coalesce(jr_date_paid,to_date('01.01.1900','DD.MM.YYYY')) <=
to_date($4,'DD.MM.YYYY')
+ )
+ ";
+
+ }
+ else
+ {
+ $sql_date="and (jrn1.j_date >= to_date($3,'DD.MM.YYYY') and
jrn1.j_date <= to_date($4,'DD.MM.YYYY'))";
+ }
bcscale(2);
switch ($this->form->type_sum_account)
{
@@ -935,7 +987,7 @@
jrn1.j_poste like $1
and
jrn2.j_poste like $2
- and (jrn1.j_date >= to_date($3,'DD.MM.YYYY')
and jrn1.j_date <= to_date($4,'DD.MM.YYYY'))
+ $sql_date
$filter_ledger
) as tv_amount
";
@@ -963,8 +1015,7 @@
jrn2.j_poste like $2
and
jrn1.j_debit='t'
- and
- (jrn1.j_date >= to_date($3,'DD.MM.YYYY') and
jrn1.j_date <= to_date($4,'DD.MM.YYYY'))
+ $sql_date
$filter_ledger
) as tv_amount
";
@@ -989,8 +1040,7 @@
jrn2.j_poste like $2
and
jrn1.j_debit='f'
- and
- (jrn1.j_date >= to_date($3,'DD.MM.YYYY') and
jrn1.j_date <= to_date($4,'DD.MM.YYYY'))
+ $sql_date
$filter_ledger
) as tv_amount
";
Modified: trunk/rapport_avance/include/class_rapport_avance_sql.php
===================================================================
--- trunk/rapport_avance/include/class_rapport_avance_sql.php 2013-10-17
23:36:36 UTC (rev 540)
+++ trunk/rapport_avance/include/class_rapport_avance_sql.php 2013-10-23
18:08:02 UTC (rev 541)
@@ -128,7 +128,8 @@
"with_tmp_val"=>"with_tmp_val",
"type_sum_account"=>"type_sum_account",
"operation_pcm_val"=>"operation_pcm_val",
- "jrn_def_id"=>"jrn_def_id"
+ "jrn_def_id"=>"jrn_def_id",
+ "date_paid"=>"date_paid"
);
$this->type = array(
@@ -144,7 +145,8 @@
"with_tmp_val"=>"text",
"type_sum_account"=>"numeric",
"operation_pcm_val"=>"text",
- "jrn_def_id"=>"numeric"
+ "jrn_def_id"=>"numeric",
+ "date_paid"=>"numeric"
);
Added: trunk/rapport_avance/include/liste.inc.php
===================================================================
--- trunk/rapport_avance/include/liste.inc.php (rev 0)
+++ trunk/rapport_avance/include/liste.inc.php 2013-10-23 18:08:02 UTC (rev
541)
@@ -0,0 +1,3 @@
+<?php
+
+?>
Modified: trunk/rapport_avance/include/template/param_detail_new.php
===================================================================
--- trunk/rapport_avance/include/template/param_detail_new.php 2013-10-17
23:36:36 UTC (rev 540)
+++ trunk/rapport_avance/include/template/param_detail_new.php 2013-10-23
18:08:02 UTC (rev 541)
@@ -77,7 +77,7 @@
<?php echo HtmlInput::hidden('tab','formula')?>
<?php echo RAPAV_Formula::new_row()?>
</p>
- <p> Filtrage par journal <?php echo $select->input(); ?> </p>
+
<?php echo HtmlInput::submit('save','Sauve')?>
</form>
@@ -91,7 +91,7 @@
<?php echo HtmlInput::hidden('tab','account_tva')?>
<?php echo RAPAV_Account_Tva::new_row()?>
- <p> Filtrage par journal <?php echo $select->input(); ?> </p>
+
<?php echo HtmlInput::submit('save','Sauve')?>
</form>
@@ -117,8 +117,8 @@
<?php echo
HtmlInput::request_to_hidden(array('gDossier','ac','plugin_code','p_id'))?>
<?php echo HtmlInput::hidden('tab','new_account_id')?>
- <?php echo RAPAV_Account::new_row($p_id)?>
- <p> Filtrage par journal <?php echo $select->input(); ?> </p>
+ <?php echo RAPAV_Account::new_row($p_id)?>
+
<?php echo HtmlInput::submit('save','Sauve')?>
</form>
@@ -130,7 +130,7 @@
<?php echo HtmlInput::hidden('tab','new_reconcile_id')?>
<?php echo RAPAV_Reconcile::new_row($p_id)?>
- <p> Filtrage par journal <?php echo $select->input(); ?> </p>
+
<?php echo HtmlInput::submit('save','Sauve')?>
</form>
Modified: trunk/rapport_avance/index.php
===================================================================
--- trunk/rapport_avance/index.php 2013-10-17 23:36:36 UTC (rev 540)
+++ trunk/rapport_avance/index.php 2013-10-23 18:08:02 UTC (rev 541)
@@ -57,7 +57,7 @@
$array = array(
array($url . '&sa=li', _('Liste'), _('Création, modification, Paramètre
de listes, mailing list'), 0),
array($url . '&sa=fo', _('Formulaire'), _('Création, modification,
Paramètre'), 1),
- array($url . '&sa=de', _('Déclaration'), _('Déclaration TVA calculée'),
2),
+ array($url . '&sa=de', _('Génération Déclaration / listing'),
_('Génération Déclaration / listing'), 2),
array($url . '&sa=hi', _('Historique'), _('Historique des déclarations
faites'), 3)
);
Modified: trunk/rapport_avance/sql/1-ajout-col-formulaire-param-detail.sql
===================================================================
--- trunk/rapport_avance/sql/1-ajout-col-formulaire-param-detail.sql
2013-10-17 23:36:36 UTC (rev 540)
+++ trunk/rapport_avance/sql/1-ajout-col-formulaire-param-detail.sql
2013-10-23 18:08:02 UTC (rev 541)
@@ -1,18 +1,24 @@
-ALTER TABLE rapport_advanced.formulaire_param_detail
- ADD COLUMN jrn_def_id bigint;
+ALTER TABLE rapport_advanced.formulaire_param_detail ADD COLUMN jrn_def_id
bigint;
COMMENT ON COLUMN rapport_advanced.formulaire_param_detail.jrn_def_id IS 'FK
to jrn_def, if null then all the ledgers are concerned';
-ALTER TABLE rapport_advanced.formulaire_param_detail
- ADD CONSTRAINT formulaire_param_detail_jrn_def_id_fkey FOREIGN KEY
(jrn_def_id)
- REFERENCES jrn_def (jrn_def_id) MATCH SIMPLE
- ON UPDATE CASCADE ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE rapport_advanced.formulaire_param_detail
- ADD CONSTRAINT formulaire_param_detail_jrn_def_id_fkey FOREIGN KEY
(jrn_def_id)
- REFERENCES jrn_def (jrn_def_id) MATCH SIMPLE
- ON UPDATE CASCADE ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED;
-CREATE TRIGGER formulaire_param_detail_trg
- BEFORE INSERT OR UPDATE OF jrn_def_id
- ON rapport_advanced.formulaire_param_detail
- FOR EACH ROW
- EXECUTE PROCEDURE
rapport_advanced.formulaire_param_detail_jrn_def_id_ins_upd();
+CREATE FUNCTION formulaire_param_detail_jrn_def_id_ins_upd() RETURNS trigger
+ AS $$
+declare
+ jrn_def_id integer;
+begin
+ if NEW.jrn_def_id = -1 then
+ jrn_def_id=NULL;
+ NEW.jrn_def_id := jrn_def_id;
+ end if;
+ return NEW;
+end;$$;
+language plpgsql;
+CREATE INDEX fki_jrn_def_id ON rapport_advanced.formulaire_param_detail USING
btree (jrn_def_id);
+
+CREATE TRIGGER formulaire_param_detail_trg BEFORE INSERT OR UPDATE OF
jrn_def_id ON rapport_advanced.formulaire_param_detail FOR EACH ROW EXECUTE
PROCEDURE rapport_advanced.formulaire_param_detail_jrn_def_id_ins_upd();
+
+ALTER TABLE rapport_advanced.formulaire_param_detail ADD CONSTRAINT
formulaire_param_detail_jrn_def_id_fkey FOREIGN KEY (jrn_def_id)
REFERENCES jrn_def (jrn_def_id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE
SET NULL DEFERRABLE INITIALLY DEFERRED;
+
+
+
Added: trunk/rapport_avance/sql/2-date-paiement.sql
===================================================================
--- trunk/rapport_avance/sql/2-date-paiement.sql
(rev 0)
+++ trunk/rapport_avance/sql/2-date-paiement.sql 2013-10-23 18:08:02 UTC
(rev 541)
@@ -0,0 +1,2 @@
+alter table rapport_advanced.formulaire_param_detail add column date_paid
integer default 0;
+alter table rapport_advanced.restore_formulaire_param_detail add column
date_paid integer default 0;
---
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] r541 - in trunk/rapport_avance: . doc include include/template sql,
phpcompta-dev <=