[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r604 - trunk/rapport_avance/include
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r604 - trunk/rapport_avance/include |
Date: |
Tue, 10 Dec 2013 13:50:56 +0100 (CET) |
Author: danydb
Date: 2013-12-10 13:50:56 +0100 (Tue, 10 Dec 2013)
New Revision: 604
Modified:
trunk/rapport_avance/include/class_rapav_listing_compute.php
trunk/rapport_avance/include/declaration.inc.php
Log:
task #938 - Listing : permettre s?\195?\169lection
Sauve les fiches
Filtre sur table
Task #938 - Listing : permettre la s?\195?\169lection
Modified: trunk/rapport_avance/include/class_rapav_listing_compute.php
===================================================================
--- trunk/rapport_avance/include/class_rapav_listing_compute.php
2013-12-09 14:04:52 UTC (rev 603)
+++ trunk/rapport_avance/include/class_rapav_listing_compute.php
2013-12-10 12:50:56 UTC (rev 604)
@@ -35,7 +35,11 @@
{
$this->data = new RAPAV_Listing_Compute_SQL();
}
-
+ function load($p_id)
+ {
+ $this->data->lc_id=$p_id;
+ $this->data->load();
+ }
/**
* Compute all the values and save them in the table rapav_listing_compute
* @param RAPAV_Listing $rapav_listing
@@ -132,8 +136,12 @@
{
$this->type_operation = $p_type;
}
-
- function display()
+ /**
+ * Display the result of the computing, no card are deleted for the moment
+ * @param $with true display the checkbox, false don't
+ * @global type $cn
+ */
+ function display($with_sel,$form_name="")
{
global $cn;
$ofiche=new RAPAV_Listing_Compute_Fiche_SQL();
@@ -151,8 +159,18 @@
// table header
if ($nb_detail > 0 && $i == 0)
{
- echo '<table style="min-width:100%" class="result">';
+ $col=array();
+ for ($e=0;$e<$nb_detail;$e++)
+ {
+ $col[]=$e;
+ }
+ $col_range=implode(",",$col);
+ echo "Filtre ".HtmlInput::filter_table($form_name."_tb",
$col_range, 1);
+ echo '<table id="'.$form_name.'_tb" style="min-width:100%"
class="result">';
echo '<tr>';
+ if ( $with_sel ) {
+ echo '<TH><INPUT TYPE="CHECKBOX"
onclick="toggle_checkbox(\''.$form_name.'\')"></TH>';
+ }
for ($e=0;$e<$nb_detail;$e++)
{
$detail=$odetail->next($r_detail,$e);
@@ -165,7 +183,11 @@
for ($e=0;$e <$nb_detail;$e++)
{
$detail=$odetail->next($r_detail,$e);
-
+ if ($e==0 && $with_sel)
+ {
+ $check_box=new ICheckBox("selected_card[]",
$fiche->lf_id);
+ echo td($check_box->input());
+ }
echo (($detail->ld_value_numeric !==
null)?td(nbm($detail->ld_value_numeric),'class="num"'):"");
echo (($detail->ld_value_text !==
null)?td($detail->ld_value_text):"");
echo (($detail->ld_value_date!==
null)?td($detail->ld_value_date):"");
@@ -174,6 +196,10 @@
}
echo '</table>';
}
+ /**
+ * Set the flag to keep to Y
+ * @param $p_id lc_id of the RAPAV_Listing_Compute to keep
+ */
function keep($p_id)
{
$this->data->lc_id=$p_id;
@@ -181,5 +207,26 @@
$this->data->l_keep='Y';
$this->data->save();
}
-
+ /**
+ * Return true or false if the corresponding RAPAV_Listing has a document
+ * @return true if RAPAV_Listing has a template otherwise false
+ */
+ function has_template()
+ {
+ return false;
+ }
+ /**
+ * Save the card selected, they are in an array with the idx selected_fiche
+ * @param $p_array array
+ */
+ function save_selected($p_array)
+ {
+ global $cn;
+ if (count($p_array)==0)
+ return;
+ $to_keep=implode(',',$p_array);
+ $to_keep=sql_string($to_keep);
+ $cn->exec_sql(" delete from rapport_advanced.listing_compute_fiche
+ where lf_id not in ($to_keep)");
+ }
}
Modified: trunk/rapport_avance/include/declaration.inc.php
===================================================================
--- trunk/rapport_avance/include/declaration.inc.php 2013-12-09 14:04:52 UTC
(rev 603)
+++ trunk/rapport_avance/include/declaration.inc.php 2013-12-10 12:50:56 UTC
(rev 604)
@@ -90,13 +90,17 @@
if ( isset($_POST['save_listing']))
{
$listing=new RAPAV_Listing_Compute();
- $listing->keep($_POST['lc_id']);
+ $listing->load($_POST['lc_id']);
+ if ( isset ($_POST['selected_card']) )
+ {
+ $listing->keep($_POST['lc_id']);
+ $listing->save_selected($_POST['selected_card']);
+ }
if ($listing->has_template() == true) {
$listing->generate_doc();
}
-
- $listing->display();
+ $listing->display(false);
exit();
}
/*
@@ -114,10 +118,10 @@
$p_listing = new Rapav_Listing($_GET['p_listing']);
$listing->filter_operation($_GET['p_operation_paid']);
$listing->compute($p_listing, $_GET['p_start'], $_GET['p_end']);
- echo '<form class="print" method="POST">';
+ echo '<form class="print" id="'.'select_card_frm'.'" method="POST">';
echo HtmlInput::hidden('lc_id',$listing->lc_id);
- $listing->display();
- echo HtmlInput::submit('save_listing', 'Sauver');
+ $listing->display(true,'select_card_frm');
+ echo HtmlInput::submit('save_listing', 'Sauver la sélection');
echo '</form>';
exit();
}
---
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] r604 - trunk/rapport_avance/include,
phpcompta-dev <=