[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [6515] Rental: Updated the excelreport functionality
From: |
Joakim Hop |
Subject: |
[Fmsystem-commits] [6515] Rental: Updated the excelreport functionality at Contracts with to and from date |
Date: |
Wed, 27 Oct 2010 12:57:39 +0000 |
Revision: 6515
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6515
Author: joakim_hop
Date: 2010-10-27 12:57:39 +0000 (Wed, 27 Oct 2010)
Log Message:
-----------
Rental: Updated the excelreport functionality at Contracts with to and from date
Modified Paths:
--------------
trunk/rental/inc/model/class.contract.inc.php
trunk/rental/setup/phpgw_no.lang
trunk/rental/templates/base/contract_list_partial.php
Modified: trunk/rental/inc/model/class.contract.inc.php
===================================================================
--- trunk/rental/inc/model/class.contract.inc.php 2010-10-27 12:14:21 UTC
(rev 6514)
+++ trunk/rental/inc/model/class.contract.inc.php 2010-10-27 12:57:39 UTC
(rev 6515)
@@ -581,13 +581,29 @@
* 2.3 ...ends or starts current year - calculate price
* 2.3.1
*/
- $current_year = date("Y");
- $next_year = $current_year + 1;
- $timestamp_invoice_start =
strtotime("{$current_year}-1-1");
- $timestamp_invoice_end =
strtotime("{$current_year}-12-31");
+ $date_start = phpgw::get_var('date_start');
+ $date_end = phpgw::get_var('date_end');
+
+ if(isset($date_start)){
+ $aDate = split ("/", $date_start);
+ $date_start =
$aDate[1]."/".$aDate[0]."/".$aDate[2];
+ $timestamp_invoice_start =
strtotime($date_start);
+ }
+ if(isset($date_end)){
+ $aDate = split ("/", $date_end);
+ $date_end =
$aDate[1]."/".$aDate[0]."/".$aDate[2];
+ $timestamp_invoice_end = strtotime($date_end);
+ }
+
+ if(!isset($timestamp_invoice_start) ||
$timestamp_invoice_start == "" || !isset($timestamp_invoice_end) ||
$timestamp_invoice_end == ""){
+ $current_year = date("Y");
+ $timestamp_invoice_start =
strtotime("{$current_year}-1-1");
+ $timestamp_invoice_end =
strtotime("{$current_year}-12-31");
+ }
+
$contract_dates = $this->get_contract_date();
if(isset($contract_dates))
{
@@ -602,11 +618,6 @@
{
return 0; // The contract starts after
the end of current year
}
- else if($contract_start <
$timestamp_invoice_start && (!isset($contract_end) || $contract_end >
$timestamp_invoice_end))
- {
- // The contract is active the whole
current year
- return
rental_socontract_price_item::get_instance()->get_total_price($this->get_id());
- }
}
else
{
@@ -717,16 +728,18 @@
$invoice_price_item_end
// the end date to which this price item should be
calculated
);
+
+ $total_price_price_item = 0;
+
// If the contract price item is of type
one-time and it's dates are within the invoice period ...
- if($contract_price_item->is_one_time()){
+ if($contract_price_item->is_one_time()){
if($contract_price_item_start >=
$timestamp_invoice_start && $contract_price_item_start <=
$timestamp_invoice_end){
// ... set the total price of
the invoice price item to the total price of the contract price item
-
$invoice_price_item->set_total_price($contract_price_item->get_total_price());
+ $total_price_price_item =
$contract_price_item->get_total_price();
}
+ }else{
+ $total_price_price_item =
$invoice_price_item->get_total_price();
}
-
- // Add this price item's total sum to the tota
sum of the invoice
- $total_price_price_item =
$invoice_price_item->get_total_price();
$total_sum += round($total_price_price_item,2);
} // end of looping through the contract price items
Modified: trunk/rental/setup/phpgw_no.lang
===================================================================
--- trunk/rental/setup/phpgw_no.lang 2010-10-27 12:14:21 UTC (rev 6514)
+++ trunk/rental/setup/phpgw_no.lang 2010-10-27 12:57:39 UTC (rev 6515)
@@ -507,7 +507,7 @@
to_the_top rental no Til toppen
Total sum rental no Totalt beløp
total_price rental no Total pris
-total_price_current_year rental no Pris inneværende år
+total_price_current_year rental no Pris i budsjettperiode
type rental no Type
under_dismissal rental no Under oppsigelse
under_planning rental no Under planlegging
Modified: trunk/rental/templates/base/contract_list_partial.php
===================================================================
--- trunk/rental/templates/base/contract_list_partial.php 2010-10-27
12:14:21 UTC (rev 6514)
+++ trunk/rental/templates/base/contract_list_partial.php 2010-10-27
12:57:39 UTC (rev 6515)
@@ -147,6 +147,9 @@
var query = document.getElementById('<?php echo $list_id
?>_ctrl_search_query').value;
+ var startDate =
document.getElementById('start_date_report').value;
+ var endDate = document.getElementById('end_date_report').value;
+
var dl = window.open('index.php?menuaction=rental.uicontract.download'+
'&type='+ctype+
'&contract_type='+typeoption+
@@ -155,6 +158,8 @@
'&query='+query+
'&search_option='+sOption+
//'&results=100'+
+ '&date_start='+startDate+
+ '&date_end='+endDate+
'&export=true');
}
</script>
@@ -219,17 +224,32 @@
?>
</select>
</fieldset>
+ <fieldset>
+ <!-- export with date limitation -->
+ <h3><?php echo lang('export_to') ?></h3>
+ <div id="export">
+ <a href="javascript:contract_export('<?php echo
$list_id ?>');"><img src="<?php echo RENTAL_TEMPLATE_PATH
?>images/16x16/mimetypes/x-office-spreadsheet.png"/></a>
+ <label class="toolbar_element_label"
for="start_date_report" id="label_start_date_report"><?php echo
lang('date_start') ?></label>
+ <?php echo
$GLOBALS['phpgw']->yuical->add_listener('start_date_report',
$notification_date); ?>
+ <label class="toolbar_element_label"
for="end_date_report" id="label_end_date_report"><?php echo lang('date_end')
?></label>
+ <?php echo
$GLOBALS['phpgw']->yuical->add_listener('end_date_report', $notification_date);
?>
+ </div>
+ </fieldset>
</form>
<?php
+ }else{
+?>
+
+ <fieldset>
+ <h3><?php echo lang('export_to') ?></h3>
+ <div id="export"><a href="javascript:contract_export('<?php
echo $list_id ?>');"><img src="<?php echo RENTAL_TEMPLATE_PATH
?>images/16x16/mimetypes/x-office-spreadsheet.png"/></a></div>
+ </fieldset>
+
+<?php
}
?>
-<fieldset>
- <h3><?php echo lang('export_to') ?></h3>
- <div id="export"><a href="javascript:contract_export('<?php echo
$list_id ?>');"><img src="<?php echo RENTAL_TEMPLATE_PATH
?>images/16x16/mimetypes/x-office-spreadsheet.png"/></a></div>
-</fieldset>
-
<div id="<?php echo $list_id ?>_paginator" class="paginator"></div>
<div id="<?php echo $list_id ?>_container" class="datatable_container"></div>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [6515] Rental: Updated the excelreport functionality at Contracts with to and from date,
Joakim Hop <=