git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@531 97e9348a-65ac-dc4b-aefc-98561f571b83
209 lines
6.3 KiB
PHP
209 lines
6.3 KiB
PHP
<?php /* -*- mode:PHP -*- */
|
|
|
|
echo '<div class="account collected">' . "\n";
|
|
|
|
/**********************************************************************
|
|
**********************************************************************
|
|
**********************************************************************
|
|
**********************************************************************
|
|
* Javascript
|
|
*/
|
|
|
|
?>
|
|
|
|
<script type="text/javascript"><!--
|
|
|
|
// Reset the form
|
|
function resetForm() {
|
|
<?php /* REVISIT <AP>: 20090810; Hate to do this, but first data is wrong... */ ?>
|
|
updateEntriesGrid();
|
|
}
|
|
|
|
function onGridLoadComplete() {
|
|
var userdata = $('#collected-entries-jqGrid').getGridParam('userData');
|
|
$('#collected-total').html(fmtCurrency(userdata['total']));
|
|
}
|
|
|
|
function updateEntriesGrid() {
|
|
var account_ids = new Array();
|
|
$("INPUT[type='checkbox']:checked").each(function(i) {
|
|
account_ids.push($(this).val());
|
|
});
|
|
|
|
var cust = new Array();
|
|
cust['from_date'] = $('#TxFromDate').val();
|
|
cust['through_date'] = $('#TxThroughDate').val();
|
|
cust['account_id'] = account_ids;
|
|
|
|
var dynamic_post = new Array();
|
|
dynamic_post['custom'] = cust;
|
|
|
|
$('#collected-total').html('Calculating...');
|
|
$('#collected-entries-jqGrid').clearGridData();
|
|
$('#collected-entries-jqGrid').setPostDataItem('dynamic_post', serialize(dynamic_post));
|
|
$('#collected-entries-jqGrid')
|
|
.setGridParam({ page: 1 })
|
|
.trigger("reloadGrid");
|
|
|
|
var gridstate = $('#collected-entries-jqGrid').getGridParam('gridstate');
|
|
if (gridstate == 'hidden')
|
|
$('#collected-entries .HeaderButton').click();
|
|
}
|
|
|
|
|
|
--></script>
|
|
|
|
<?php
|
|
|
|
/**********************************************************************
|
|
**********************************************************************
|
|
**********************************************************************
|
|
**********************************************************************
|
|
* Summary Info Box
|
|
*/
|
|
|
|
echo '<div class="infobox">' . "\n";
|
|
|
|
$rows = array();
|
|
$rows[] = array('Total:', '<SPAN id="collected-total"></SPAN>');
|
|
echo $this->element('table',
|
|
array('class' => 'summary',
|
|
'rows' => $rows,
|
|
'column_class' => array('field', 'value'),
|
|
'suppress_alternate_rows' => true,
|
|
));
|
|
echo '</div>' . "\n";
|
|
|
|
|
|
/**********************************************************************
|
|
**********************************************************************
|
|
**********************************************************************
|
|
**********************************************************************
|
|
* User Configuration
|
|
*/
|
|
|
|
echo $form->create(null, array('id' => 'collected-form',
|
|
'onsubmit' => 'return false',
|
|
'url' => null));
|
|
|
|
echo $form->input("id",
|
|
array('id' => 'account-id',
|
|
'type' => 'hidden',
|
|
'value' => 0));
|
|
|
|
/* echo '<fieldset class="account collected entry">'; */
|
|
/* echo ' <legend>Payment Account</legend>'; */
|
|
/* echo $form->input('Tx.account_id', */
|
|
/* array(//'label' => 'Payment<BR>Account', */
|
|
/* 'label' => false, */
|
|
/* 'type' => 'select', */
|
|
/* 'multiple' => 'checkbox', */
|
|
/* 'options' => $paymentAccounts, */
|
|
/* 'selected' => array_keys($defaultAccounts), */
|
|
/* ) */
|
|
/* ); */
|
|
/* echo '</fieldset>'; */
|
|
|
|
echo $this->element('form_table',
|
|
array('class' => "item account collected entry",
|
|
//'with_name_after' => ':',
|
|
'field_prefix' => 'Tx.',
|
|
'fields' => array
|
|
("account_id" => array('name' => 'Payment<BR>Account',
|
|
'opts' =>
|
|
array('type' => 'select',
|
|
'multiple' => 'checkbox',
|
|
'options' => $paymentAccounts,
|
|
'selected' => array_keys($defaultAccounts),
|
|
),
|
|
),
|
|
),
|
|
));
|
|
|
|
echo $this->element('form_table',
|
|
array('class' => "item account collected entry",
|
|
//'with_name_after' => ':',
|
|
'field_prefix' => 'Tx.',
|
|
'fields' => array
|
|
("from_date" => array('opts' =>
|
|
array('type' => 'text'),
|
|
'between' => '<A HREF="#" ONCLICK="datepickerBOM(null,\'TxFromDate\'); return false;">BOM</A>',
|
|
),
|
|
"through_date" => array('opts' =>
|
|
array('type' => 'text'),
|
|
'between' => '<A HREF="#" ONCLICK="datepickerEOM(\'TxFromDate\',\'TxThroughDate\'); return false;">EOM</A>',
|
|
),
|
|
),
|
|
));
|
|
|
|
echo $form->button('Update',
|
|
array('onclick' => 'updateEntriesGrid(); return false',
|
|
));
|
|
|
|
echo $form->end();
|
|
|
|
|
|
/**********************************************************************
|
|
**********************************************************************
|
|
**********************************************************************
|
|
**********************************************************************
|
|
* Supporting Elements Section
|
|
*/
|
|
|
|
echo '<div CLASS="detail supporting">' . "\n";
|
|
|
|
|
|
/**********************************************************************
|
|
* Entries
|
|
*/
|
|
|
|
echo $this->element('statement_entries', array
|
|
(// Grid configuration
|
|
'config' => array
|
|
(
|
|
'grid_div_id' => 'collected-entries',
|
|
'grid_div_class' => 'text-below',
|
|
'grid_events' => array('loadComplete' => 'onGridLoadComplete()'),
|
|
'grid_setup' => array('hiddengrid' => true),
|
|
//'caption' => '<SPAN id="receipt-charges-caption"></SPAN>',
|
|
'caption' => 'Collected ' . Inflector::pluralize($account['name']),
|
|
'filter' => array(//'StatementEntry.type' => 'DISBURSEMENT',
|
|
'ChargeEntry.account_id' => $account['id']),
|
|
'exclude' => array('Account', 'Charge', 'Type'),
|
|
),
|
|
));
|
|
|
|
?>
|
|
|
|
<script type="text/javascript"><!--
|
|
$(document).ready(function(){
|
|
$("#TxFromDate")
|
|
.attr('autocomplete', 'off')
|
|
.datepicker({ constrainInput: true,
|
|
numberOfMonths: [1, 1],
|
|
showCurrentAtPos: 0,
|
|
dateFormat: 'mm/dd/yy' });
|
|
|
|
$("#TxThroughDate")
|
|
.attr('autocomplete', 'off')
|
|
.datepicker({ constrainInput: true,
|
|
numberOfMonths: [1, 1],
|
|
showCurrentAtPos: 0,
|
|
dateFormat: 'mm/dd/yy' });
|
|
|
|
resetForm();
|
|
});
|
|
--></script>
|
|
|
|
<?php
|
|
|
|
/* End "detail supporting" div */
|
|
echo '</div>' . "\n";
|
|
|
|
/* End page div */
|
|
echo '</div>' . "\n";
|
|
|
|
?>
|
|
|
|
<a href="#" onClick="$('#debug').html(''); return false;">Clear Debug Output</a>
|