| 1 |
<?php |
<?php |
| 2 |
// $Id: stormexpense.admin.inc,v 1.2.4.2 2008/07/22 13:19:09 robertogerola Exp $ |
// $Id: stormexpense.admin.inc,v 1.2.4.3 2008/07/23 07:10:36 robertogerola Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 59 |
|
|
| 60 |
$header = array( |
$header = array( |
| 61 |
array( |
array( |
| 62 |
'data' => t('Organization'), |
'data' => storm_t('Organization', 'expense'), |
| 63 |
'field' => 'sex.organization_title', |
'field' => 'sex.organization_title', |
| 64 |
), |
), |
| 65 |
array( |
array( |
| 66 |
'data' => t('Project'), |
'data' => storm_t('Project', 'expense'), |
| 67 |
'field' => 'sex.project_title', |
'field' => 'sex.project_title', |
| 68 |
), |
), |
| 69 |
array( |
array( |
| 70 |
'data' => t('Title'), |
'data' => storm_t('Title', 'expense'), |
| 71 |
'field' => 'n.title', |
'field' => 'n.title', |
| 72 |
), |
), |
| 73 |
array( |
array( |
| 74 |
'data' => t('Date'), |
'data' => storm_t('Date', 'expense'), |
| 75 |
'field' => 'sex.expensedate', |
'field' => 'sex.expensedate', |
| 76 |
'sort' => 'desc', |
'sort' => 'desc', |
| 77 |
), |
), |
| 78 |
array( |
array( |
| 79 |
'data' => t('Total'), |
'data' => storm_t('Total', 'expense'), |
| 80 |
'style' => 'text-align: right;' |
'style' => 'text-align: right;' |
| 81 |
), |
), |
| 82 |
array( |
array( |
| 83 |
'data' => storm_icon_l('report', '', t('Reports'), '', array(), $report_attrs) .' '. storm_icon_add_node($i, $_GET), |
'data' => storm_icon_l('report', '', storm_t('Reports', 'expense'), '', array(), $report_attrs) .' '. storm_icon_add_node($i, $_GET), |
| 84 |
'class' => 'storm_list_operations', |
'class' => 'storm_list_operations', |
| 85 |
), |
), |
| 86 |
); |
); |
| 88 |
$s = "SELECT n.*, sex.* FROM {node} AS n INNER JOIN {stormexpense} AS sex ON n.vid=sex.vid |
$s = "SELECT n.*, sex.* FROM {node} AS n INNER JOIN {stormexpense} AS sex ON n.vid=sex.vid |
| 89 |
WHERE n.status=1 AND n.type='stormexpense' "; |
WHERE n.status=1 AND n.type='stormexpense' "; |
| 90 |
|
|
| 91 |
$s_totals = "SELECT SUM(amount) AS t_amount, SUM(vat) AS t_vat, SUM(total) AS t_total FROM |
$s_totals = "SELECT SUM(amount) AS t_amount, SUM(tax) AS t_tax, SUM(total) AS t_total FROM |
| 92 |
{node} AS n INNER JOIN {stormexpense} AS sex ON n.vid=sex.vid WHERE n.status=1 AND n.type='stormexpense' "; |
{node} AS n INNER JOIN {stormexpense} AS sex ON n.vid=sex.vid WHERE n.status=1 AND n.type='stormexpense' "; |
| 93 |
|
|
| 94 |
if ($_SESSION['stormexpense_list_filter']['organization_nid']) { |
if ($_SESSION['stormexpense_list_filter']['organization_nid']) { |
| 184 |
|
|
| 185 |
$form['filter'] = array( |
$form['filter'] = array( |
| 186 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 187 |
'#title' => t('Filter'), |
'#title' => storm_t('Filter', 'expense'), |
| 188 |
'#collapsible' => TRUE, |
'#collapsible' => TRUE, |
| 189 |
'#collapsed' => TRUE, |
'#collapsed' => TRUE, |
| 190 |
'#theme' => 'stormexpense_list_filter', |
'#theme' => 'stormexpense_list_filter', |
| 205 |
while ($organization = db_fetch_object($r)) { |
while ($organization = db_fetch_object($r)) { |
| 206 |
$organizations[$organization->nid] = $organization->title; |
$organizations[$organization->nid] = $organization->title; |
| 207 |
} |
} |
| 208 |
$organizations = array(0 => t('All')) + $organizations; |
$organizations = array(0 => storm_t('All', 'expense')) + $organizations; |
| 209 |
$form['filter']['group1']['organization_nid'] = array( |
$form['filter']['group1']['organization_nid'] = array( |
| 210 |
'#type' => 'select', |
'#type' => 'select', |
| 211 |
'#title' => t('Organization'), |
'#title' => storm_t('Organization', 'expense'), |
| 212 |
'#default_value' => $organization_nid, |
'#default_value' => $organization_nid, |
| 213 |
'#options' => $organizations, |
'#options' => $organizations, |
| 214 |
'#attributes' => array('onchange' => "stormticket_organization_project_task_tickets(this, 'edit-project-nid', 'edit-task-nid', 'edit-ticket-nid', true, 'All')"), |
'#attributes' => array('onchange' => "stormticket_organization_project_task_tickets(this, 'edit-project-nid', 'edit-task-nid', 'edit-ticket-nid', true, 'All')"), |
| 223 |
while ($project = db_fetch_object($r)) { |
while ($project = db_fetch_object($r)) { |
| 224 |
$projects[$project->nid] = $project->title; |
$projects[$project->nid] = $project->title; |
| 225 |
} |
} |
| 226 |
$projects = array(0 => t('All')) + $projects; |
$projects = array(0 => storm_t('All', 'expense')) + $projects; |
| 227 |
$form['filter']['group1']['project_nid'] = array( |
$form['filter']['group1']['project_nid'] = array( |
| 228 |
'#type' => 'select', |
'#type' => 'select', |
| 229 |
'#title' => t('Project'), |
'#title' => storm_t('Project', 'expense'), |
| 230 |
'#default_value' => $project_nid, |
'#default_value' => $project_nid, |
| 231 |
'#options' => $projects, |
'#options' => $projects, |
| 232 |
'#process' => array('storm_dependent_select_process'), |
'#process' => array('storm_dependent_select_process'), |
| 235 |
|
|
| 236 |
$tree = _stormtask_get_tree($project_nid); |
$tree = _stormtask_get_tree($project_nid); |
| 237 |
$tasks = _stormtask_plain_tree($tree); |
$tasks = _stormtask_plain_tree($tree); |
| 238 |
$tasks = array(0 => t('All')) + $tasks; |
$tasks = array(0 => storm_t('All', 'expense')) + $tasks; |
| 239 |
$form['filter']['group1']['task_nid'] = array( |
$form['filter']['group1']['task_nid'] = array( |
| 240 |
'#type' => 'select', |
'#type' => 'select', |
| 241 |
'#title' => t('Task'), |
'#title' => storm_t('Task', 'expense'), |
| 242 |
'#default_value' => $task_nid, |
'#default_value' => $task_nid, |
| 243 |
'#options' => $tasks, |
'#options' => $tasks, |
| 244 |
'#process' => array('storm_dependent_select_process'), |
'#process' => array('storm_dependent_select_process'), |
| 254 |
while ($ticket = db_fetch_object($r)) { |
while ($ticket = db_fetch_object($r)) { |
| 255 |
$tickets[$ticket->nid] = $ticket->title; |
$tickets[$ticket->nid] = $ticket->title; |
| 256 |
} |
} |
| 257 |
$tickets = array(0 => t('All')) + $tickets; |
$tickets = array(0 => storm_t('All', 'expense')) + $tickets; |
| 258 |
$form['filter']['group1']['ticket_nid'] = array( |
$form['filter']['group1']['ticket_nid'] = array( |
| 259 |
'#type' => 'select', |
'#type' => 'select', |
| 260 |
'#title' => t('Ticket'), |
'#title' => storm_t('Ticket', 'expense'), |
| 261 |
'#default_value' => $ticket_nid, |
'#default_value' => $ticket_nid, |
| 262 |
'#process' => array('storm_dependent_select_process'), |
'#process' => array('storm_dependent_select_process'), |
| 263 |
'#options' => $tickets, |
'#options' => $tickets, |
| 271 |
|
|
| 272 |
$form['filter']['group2']['datefrom'] = array( |
$form['filter']['group2']['datefrom'] = array( |
| 273 |
'#type' => 'date', |
'#type' => 'date', |
| 274 |
'#title' => t('Date from'), |
'#title' => storm_t('Date from', 'expense'), |
| 275 |
'#default_value' => $datefrom, |
'#default_value' => $datefrom, |
| 276 |
); |
); |
| 277 |
|
|
| 278 |
$form['filter']['group2']['user'] = array( |
$form['filter']['group2']['user'] = array( |
| 279 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 280 |
'#title' => t('User'), |
'#title' => storm_t('User', 'expense'), |
| 281 |
'#size' => 25, |
'#size' => 25, |
| 282 |
'#default_value' => $expenseuser, |
'#default_value' => $expenseuser, |
| 283 |
'#autocomplete_path' => 'user/autocomplete', |
'#autocomplete_path' => 'user/autocomplete', |
| 290 |
|
|
| 291 |
$form['filter']['group3']['title'] = array( |
$form['filter']['group3']['title'] = array( |
| 292 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 293 |
'#title' => t('Title'), |
'#title' => storm_t('Title', 'expense'), |
| 294 |
'#size' => 40, |
'#size' => 40, |
| 295 |
'#default_value' => $title, |
'#default_value' => $title, |
| 296 |
); |
); |
| 297 |
|
|
| 298 |
$form['filter']['group3']['provider_title'] = array( |
$form['filter']['group3']['provider_title'] = array( |
| 299 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 300 |
'#title' => t('Provider'), |
'#title' => storm_t('Provider', 'expense'), |
| 301 |
'#size' => 40, |
'#size' => 40, |
| 302 |
'#default_value' => $provider_title, |
'#default_value' => $provider_title, |
| 303 |
'#autocomplete_path' => 'storm/expenses/provider_autocomplete', |
'#autocomplete_path' => 'storm/expenses/provider_autocomplete', |
| 310 |
|
|
| 311 |
$form['filter']['group4']['submit'] = array( |
$form['filter']['group4']['submit'] = array( |
| 312 |
'#type' => 'submit', |
'#type' => 'submit', |
| 313 |
'#value' => t('Filter'), |
'#value' => storm_t('Filter', 'expense'), |
| 314 |
'#submit' => array('stormexpense_list_filter_filter'), |
'#submit' => array('stormexpense_list_filter_filter'), |
| 315 |
); |
); |
| 316 |
|
|
| 317 |
$form['filter']['group4']['reset'] = array( |
$form['filter']['group4']['reset'] = array( |
| 318 |
'#type' => 'submit', |
'#type' => 'submit', |
| 319 |
'#value' => t('Reset'), |
'#value' => storm_t('Reset', 'expense'), |
| 320 |
'#submit' => array('stormexpense_list_filter_reset'), |
'#submit' => array('stormexpense_list_filter_reset'), |
| 321 |
); |
); |
| 322 |
|
|
| 323 |
$form['filter']['group4']['itemsperpage'] = array( |
$form['filter']['group4']['itemsperpage'] = array( |
| 324 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 325 |
'#title' => t('Items'), |
'#title' => storm_t('Items', 'expense'), |
| 326 |
'#size' => 10, |
'#size' => 10, |
| 327 |
'#default_value' => $itemsperpage, |
'#default_value' => $itemsperpage, |
| 328 |
'#prefix' => '<div class="container-inline">', |
'#prefix' => '<div class="container-inline">', |
| 353 |
$form['#prefix'] = '<div id="stormexpense_list_form_report" class="storm_list_form_report">'; |
$form['#prefix'] = '<div id="stormexpense_list_form_report" class="storm_list_form_report">'; |
| 354 |
$form['report'] = array( |
$form['report'] = array( |
| 355 |
'#type' => 'select', |
'#type' => 'select', |
| 356 |
'#title' => t('Reports'), |
'#title' => storm_t('Reports', 'expense'), |
| 357 |
'#options' => theme('stormexpense_list_form_report_reports'), |
'#options' => theme('stormexpense_list_form_report_reports'), |
| 358 |
); |
); |
| 359 |
|
|
| 365 |
} |
} |
| 366 |
$form['language'] = array( |
$form['language'] = array( |
| 367 |
'#type' => 'select', |
'#type' => 'select', |
| 368 |
'#title' => t('Language'), |
'#title' => storm_t('Language', 'expense'), |
| 369 |
'#options' => $languages, |
'#options' => $languages, |
| 370 |
); |
); |
| 371 |
} |
} |
| 377 |
} |
} |
| 378 |
$form['submit'] = array( |
$form['submit'] = array( |
| 379 |
'#type' => 'submit', |
'#type' => 'submit', |
| 380 |
'#value' => t('Report'), |
'#value' => storm_t('Report', 'expense'), |
| 381 |
); |
); |
| 382 |
$form['#suffix'] = '</div>'; |
$form['#suffix'] = '</div>'; |
| 383 |
return $form; |
return $form; |