[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [12772]
From: |
Nelson Guerra |
Subject: |
[Fmsystem-commits] [12772] |
Date: |
Thu, 19 Feb 2015 23:12:17 +0000 |
Revision: 12772
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12772
Author: nelson224
Date: 2015-02-19 23:12:17 +0000 (Thu, 19 Feb 2015)
Log Message:
-----------
Modified Paths:
--------------
branches/dev-syncromind/property/inc/class.uiproject.inc.php
Modified: branches/dev-syncromind/property/inc/class.uiproject.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uiproject.inc.php
2015-02-19 23:11:58 UTC (rev 12771)
+++ branches/dev-syncromind/property/inc/class.uiproject.inc.php
2015-02-19 23:12:17 UTC (rev 12772)
@@ -1724,7 +1724,7 @@
)
);
- $so_budget = 0;
+ /*$so_budget = 0;
$so_cost = 0;
$so_obligation = 0;
$so_actual_cost = 0;
@@ -1745,11 +1745,11 @@
$so_obligation += $_order_entry['obligation'];
$so_actual_cost += $_order_entry['actual_cost'];
$so_diff += $_order_entry['diff'];
- }
+ }*/
$orders_def = array
(
- array('key' =>
'workorder_id','label'=>lang('Workorder'),'sortable'=>true,'formatter'=>'formatLink','value_footer'=>lang('Sum')),
+ /*array('key' =>
'workorder_id','label'=>lang('Workorder'),'sortable'=>true,'formatter'=>'formatLink','value_footer'=>lang('Sum')),
array('key' =>
'title','label'=>lang('title'),'sortable'=>true),
array('key' =>
'b_account_id','label'=>lang('Budget
account'),'sortable'=>true,'className'=>'right'),
array('key' =>
'budget','label'=>lang('budget'),'sortable'=>true,'className'=>'right','formatter'=>'JqueryPortico.FormatterAmount0','value_footer'=>number_format($so_budget,
0, ',', ' ')),
@@ -1760,14 +1760,26 @@
array('key' =>
'diff','label'=>lang('difference'),'sortable'=>true,'className'=>'right','formatter'=>'JqueryPortico.FormatterAmount0','value_footer'=>number_format($so_diff,
0, ',', ' ')),
array('key' =>
'vendor_name','label'=>lang('Vendor'),'sortable'=>true),
array('key' =>
'status','label'=>lang('Status'),'sortable'=>true),
+ array('key' => 'send_order','label'=>lang('send
workorder'),'sortable'=>false,'className'=>'center')*/
+ array('key' =>
'workorder_id','label'=>lang('Workorder'),'sortable'=>true,'formatter'=>'formatLink'),
+ array('key' =>
'title','label'=>lang('title'),'sortable'=>true),
+ array('key' =>
'b_account_id','label'=>lang('Budget
account'),'sortable'=>true,'className'=>'right'),
+ array('key' =>
'budget','label'=>lang('budget'),'sortable'=>true,'className'=>'right','formatter'=>'JqueryPortico.FormatterAmount0'),
+ array('key' =>
'cost','label'=>lang('cost'),'sortable'=>true,'className'=>'right','formatter'=>'JqueryPortico.FormatterAmount0'),
+ array('key' => 'addition_percentage','label'=>
'%','sortable'=>false,'className'=>'right'),
+ array('key' => 'obligation','label'=>lang('sum
orders'),'sortable'=>true,'className'=>'right','formatter'=>'JqueryPortico.FormatterAmount0'),
+ array('key' =>
'actual_cost','label'=>lang('actual
cost'),'sortable'=>true,'className'=>'right','formatter'=>'JqueryPortico.FormatterAmount0'),
+ array('key' =>
'diff','label'=>lang('difference'),'sortable'=>true,'className'=>'right','formatter'=>'JqueryPortico.FormatterAmount0'),
+ array('key' =>
'vendor_name','label'=>lang('Vendor'),'sortable'=>true),
+ array('key' =>
'status','label'=>lang('Status'),'sortable'=>true),
array('key' => 'send_order','label'=>lang('send
workorder'),'sortable'=>false,'className'=>'center')
);
$datatable_def[] = array
(
'container' =>
'datatable-container_1',
- 'requestUrl' => "''",
- 'data' =>
json_encode($content_orders),
+ 'requestUrl' =>
json_encode(self::link(array('menuaction'=>'property.uiproject.get_orders',
'project_id'=>$id, 'year'=>date('Y'), 'phpgw_return_as'=>'json'))),
+ 'data' => json_encode(array()),
'ColumnDefs' => $orders_def,
'config' => array(
array('disableFilter' => true),
@@ -1775,7 +1787,7 @@
)
);
- $invoices = array();
+ /*$invoices = array();
$content_invoice = array();
if ($id)
@@ -1788,13 +1800,13 @@
$si_amount += $_invoice_entry['amount'];
$si_approved_amount +=
$_invoice_entry['approved_amount'];
}
- }
+ }*/
$_formatter_voucher_link =
isset($config->config_data['invoicehandler']) &&
$config->config_data['invoicehandler'] == 2 ? 'formatLink_invoicehandler_2' :
'formatLink_voucher';
$invoice_def = array
(
- array('key' =>
'workorder_id','label'=>lang('Workorder'),'sortable'=>true,'formatter'=>'formatLink','value_footer'=>lang('Sum')),
+ /*array('key' =>
'workorder_id','label'=>lang('Workorder'),'sortable'=>true,'formatter'=>'formatLink','value_footer'=>lang('Sum')),
array('key' =>
'voucher_id','label'=>lang('bilagsnr'),'sortable'=>true,'formatter'=>$_formatter_voucher_link),
array('key' => 'voucher_out_id','hidden'=>true),
array('key' =>
'invoice_id','label'=>lang('invoice number'),'sortable'=>false),
@@ -1808,14 +1820,29 @@
array('key' =>
'type','label'=>lang('type'),'sortable'=>true),
array('key' =>
'budget_responsible','label'=>lang('budget responsible'),'sortable'=>true),
array('key' =>
'budsjettsigndato','label'=>lang('budsjettsigndato'),'sortable'=>true),
+ array('key' =>
'transfer_time','label'=>lang('transfer time'),'sortable'=>true)*/
+ array('key' =>
'workorder_id','label'=>lang('Workorder'),'sortable'=>true,'formatter'=>'formatLink'),
+ array('key' =>
'voucher_id','label'=>lang('bilagsnr'),'sortable'=>true,'formatter'=>$_formatter_voucher_link),
+ array('key' => 'voucher_out_id','hidden'=>true),
+ array('key' =>
'invoice_id','label'=>lang('invoice number'),'sortable'=>false),
+ array('key' =>
'vendor','label'=>lang('vendor'),'sortable'=>false),
+ array('key' =>
'amount','label'=>lang('amount'),'sortable'=>true,'className'=>'right','formatter'=>'JqueryPortico.FormatterAmount2'),
+ array('key' =>
'approved_amount','label'=>lang('approved
amount'),'sortable'=>false,'className'=>'right','formatter'=>'JqueryPortico.FormatterAmount2'),
+ array('key' =>
'period','label'=>lang('period'),'sortable'=>true),
+ array('key' =>
'periodization','label'=>lang('periodization'),'sortable'=>false),
+ array('key' =>
'periodization_start','label'=>lang('periodization start'),'sortable'=>false),
+ array('key' =>
'currency','label'=>lang('currency'),'sortable'=>false),
+ array('key' =>
'type','label'=>lang('type'),'sortable'=>true),
+ array('key' =>
'budget_responsible','label'=>lang('budget responsible'),'sortable'=>true),
+ array('key' =>
'budsjettsigndato','label'=>lang('budsjettsigndato'),'sortable'=>true),
array('key' =>
'transfer_time','label'=>lang('transfer time'),'sortable'=>true)
);
$datatable_def[] = array
(
'container' =>
'datatable-container_2',
- 'requestUrl' => "''",
- 'data' =>
json_encode($content_invoice),
+ 'requestUrl' =>
json_encode(self::link(array('menuaction'=>'property.uiproject.get_vouchers',
'project_id'=>$id, 'year'=>date('Y'), 'phpgw_return_as'=>'json'))),
+ 'data' => json_encode(array()),
'ColumnDefs' => $invoice_def,
'config' => array(
array('disableFilter' => true),
@@ -2201,22 +2228,66 @@
}
- public function get_orders($project_id = 0, $year = 0)
+ public function get_orders()
{
- if(!$project_id)
+ $project_id = phpgw::get_var('project_id', 'int');
+ if (empty($project_id))
{
- $project_id = phpgw::get_var('project_id',
'int');
+ $result_data = array('results' => array());
+ $result_data['total_records'] = 0;
+ $result_data['draw'] = 0;
+
+ return $this->jquery_results($result_data);
}
- if(!$year)
+
+ $year = phpgw::get_var('year', 'int');
+ $draw = phpgw::get_var('draw', 'int');
+ $allrows = phpgw::get_var('length', 'int') == -1;
+
+ $values = $this->bo->get_orders(array('project_id'=>
$project_id,'year'=> $year));
+ foreach($values as & $_order_entry)
{
- $year = phpgw::get_var('year', 'int');
+ $_order_entry['send_order'] = '';
+ if(isset($_order_entry['mail_recipients'][0])
&& $_order_entry['mail_recipients'][0])
+ {
+ $_title = implode(';',
$_order_entry['mail_recipients']);
+ $_order_entry['send_order'] = "<input
type='checkbox' name='values[send_order][]'
value='{$_order_entry['workorder_id']}' title='{$_title}'>";
+ }
}
+
+ $start = phpgw::get_var('start', 'int', 'REQUEST', 0);
+ $total_records = count($values);
- $content = $this->bo->get_orders(array('project_id'=>
$project_id,'year'=> $year));
+ $num_rows = phpgw::get_var('length', 'int', 'REQUEST',
0);
- if( phpgw::get_var('phpgw_return_as') == 'json' )
+ if($allrows)
{
+ $out = $values;
+ }
+ else
+ {
+ if ($total_records > $num_rows)
+ {
+ $page = ceil( ( $start / $total_records
) * ($total_records/ $num_rows) );
+ $values_part = array_chunk($values,
$num_rows);
+ $out = $values_part[$page];
+ }
+ else
+ {
+ $out = $values;
+ }
+ }
+ $result_data = array('results' => $out);
+
+ $result_data['total_records'] = $total_records;
+ $result_data['draw'] = $draw;
+
+ return $this->jquery_results($result_data);
+
+ /*if( phpgw::get_var('phpgw_return_as') == 'json' )
+ {
+
if(count($content))
{
return json_encode($content);
@@ -2226,19 +2297,24 @@
return "";
}
}
- return $content;
+ return $content;*/
}
- public function get_vouchers($project_id = 0, $year = 0)
+ public function get_vouchers()
{
- if(!$project_id)
+ $project_id = phpgw::get_var('project_id', 'int');
+ if (empty($project_id))
{
- $project_id = phpgw::get_var('project_id',
'int');
+ $result_data = array('results' => array());
+ $result_data['total_records'] = 0;
+ $result_data['draw'] = 0;
+
+ return $this->jquery_results($result_data);
}
- if(!$year)
- {
- $year = phpgw::get_var('year', 'int');
- }
+
+ $year = phpgw::get_var('year', 'int');
+ $draw = phpgw::get_var('draw', 'int');
+ $allrows = phpgw::get_var('length', 'int') == -1;
$active_invoices =
execMethod('property.soinvoice.read_invoice_sub_sum', array('project_id' =>
$project_id, 'year' => $year));
$historical_invoices =
execMethod('property.soinvoice.read_invoice_sub_sum', array('project_id' =>
$project_id, 'year' => $year, 'paid' => true));
@@ -2246,7 +2322,7 @@
foreach($invoices as $entry)
{
- $content[] = array
+ $values[] = array
(
'voucher_id' =>
$entry['transfer_time'] ? -1*$entry['voucher_id'] : $entry['voucher_id'],
'voucher_out_id' =>
$entry['voucher_out_id'],
@@ -2272,9 +2348,39 @@
);
}
- if( phpgw::get_var('phpgw_return_as') == 'json' )
+ $start = phpgw::get_var('start', 'int', 'REQUEST', 0);
+ $total_records = count($values);
+
+ $num_rows = phpgw::get_var('length', 'int', 'REQUEST',
0);
+
+ if($allrows)
{
+ $out = $values;
+ }
+ else
+ {
+ if ($total_records > $num_rows)
+ {
+ $page = ceil( ( $start / $total_records
) * ($total_records/ $num_rows) );
+ $values_part = array_chunk($values,
$num_rows);
+ $out = $values_part[$page];
+ }
+ else
+ {
+ $out = $values;
+ }
+ }
+ $result_data = array('results' => $out);
+
+ $result_data['total_records'] = $total_records;
+ $result_data['draw'] = $draw;
+
+ return $this->jquery_results($result_data);
+
+ /*if( phpgw::get_var('phpgw_return_as') == 'json' )
+ {
+
if(count($content))
{
return json_encode($content);
@@ -2284,7 +2390,7 @@
return "";
}
}
- return $content;
+ return $content;*/
}
function delete()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [12772],
Nelson Guerra <=