git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629/site@335 97e9348a-65ac-dc4b-aefc-98561f571b83
186 lines
5.8 KiB
PHP
186 lines
5.8 KiB
PHP
<?php /* -*- mode:PHP -*- */
|
|
|
|
echo '<div class="account collected">' . "\n";
|
|
|
|
/**********************************************************************
|
|
**********************************************************************
|
|
**********************************************************************
|
|
**********************************************************************
|
|
* Javascript
|
|
*/
|
|
|
|
?>
|
|
|
|
<script type="text/javascript"><!--
|
|
|
|
// Reset the form
|
|
function resetForm() {
|
|
/* updateEntriesGrid(); */
|
|
}
|
|
|
|
function onGridLoadComplete() {
|
|
var userdata = $('#collected-entries-jqGrid').getGridParam('userData');
|
|
$('#collected-total').html(fmtCurrency(userdata['total']));
|
|
}
|
|
|
|
function updateEntriesGrid() {
|
|
var cust = new Array();
|
|
|
|
var account_ids = new Array();
|
|
$("INPUT[type='checkbox']:checked").each(function(i) {
|
|
account_ids.push($(this).val());
|
|
});
|
|
|
|
cust['collected_account_id'] = <?php echo $account['id']; ?>;
|
|
cust['collected_from_date'] = $('#TxFromDate').val();
|
|
cust['collected_through_date'] = $('#TxThroughDate').val();
|
|
cust['collected_payment_accounts'] = account_ids;
|
|
|
|
$('#collected-entries-jqGrid').clearGridData();
|
|
$('#collected-entries-jqGrid').setPostDataItem('custom', serialize(cust));
|
|
$('#collected-entries-jqGrid')
|
|
.setGridParam({ page: 1 })
|
|
.trigger("reloadGrid");
|
|
}
|
|
|
|
|
|
--></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' => 'receipt-form',
|
|
//'onsubmit' => 'updateEntriesGrid(); return false',
|
|
'url' => array('controller' => 'transactions',
|
|
'action' => 'postReceipt')));
|
|
|
|
echo $form->input("id",
|
|
array('id' => 'account-id',
|
|
'type' => 'hidden',
|
|
'value' => 0));
|
|
|
|
echo $this->element('form_table',
|
|
array('class' => "item account collected entry",
|
|
//'with_name_after' => ':',
|
|
'field_prefix' => 'Tx.',
|
|
'fields' => array
|
|
("account_id" => array('name' => 'Account',
|
|
'opts' =>
|
|
array('type' => 'select',
|
|
'multiple' => 'checkbox',
|
|
'options' => $paymentAccounts,
|
|
'selected' => array_keys($defaultAccounts),
|
|
),
|
|
),
|
|
"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
|
|
*/
|
|
|
|
$grid_setup =
|
|
array('loadComplete' =>
|
|
array('--special' => "function() {url=jQuery('#collected-entries-jqGrid').getGridParam('url');url=url.replace(/\/debug.*$/,'?'); pd=jQuery('#collected-entries-jqGrid').getPostData();$.each(pd,function(i){ url+=i+'='+escape(pd[i])+'&'; }); jQuery('#collected-entries-jqGrid-query').html('<A HREF=\"'+url+'\">Grid Query</A><BR>'); onGridLoadComplete();}"));
|
|
|
|
echo $this->element('ledger_entries', array
|
|
(// Element configuration
|
|
'collected_account_id' => $account['id'],
|
|
'collected_payment_accounts' => array_keys($defaultAccounts),
|
|
|
|
// Grid configuration
|
|
'config' => array
|
|
(
|
|
'grid_div_id' => 'collected-entries',
|
|
'grid_div_class' => 'text-below',
|
|
'grid_setup' => $grid_setup,
|
|
//'caption' => '<SPAN id="receipt-charges-caption"></SPAN>',
|
|
'caption' => 'Collected ' . Inflector::pluralize($account['name'])
|
|
),
|
|
));
|
|
|
|
?>
|
|
|
|
<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>
|