A working version of the collected report for accounts. There is still some error checking to do, since we don't want this report for just any account. Also, we may wish to do away with the form to prevent accidental submittal. Finally, it would be nice to do away with the button, and automatically update on date changes.

git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629/site@324 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-13 02:24:31 +00:00
parent 3ffa3c81bb
commit 00cff7bb3a
6 changed files with 195 additions and 105 deletions

View File

@@ -0,0 +1,145 @@
<?php /* -*- mode:PHP -*- */
echo '<div class="account collected">' . "\n";
/**********************************************************************
**********************************************************************
**********************************************************************
**********************************************************************
* Javascript
*/
?>
<script type="text/javascript"><!--
// Reset the form
function resetForm() {
/* $('#payment-entry-id').val(1); */
/* $('#payments').html(''); */
/* $("#receipt-customer-id").html("INTERNAL ERROR"); */
/* $("#receipt-customer-name").html("INTERNAL ERROR"); */
/* $("#receipt-balance").html("INTERNAL ERROR"); */
/* $("#receipt-charges-caption").html("Outstanding Charges"); */
/* datepickerBOM(null, 'TxFromDate'); */
/* datepickerNow('TxThroughDate', false); */
/* updateEntriesGrid(); */
}
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
; // align
//echo '<DIV ID="dialog">' . "\n";
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();
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',
//'caption' => '<SPAN id="receipt-charges-caption"></SPAN>',
'caption' => 'Collected Charges',
),
));
echo('<DIV CLASS="grid-selection-text">' .
'<TABLE ID="supporting-table">' .
'<TR><TD CLASS="field">Balance:</TD><TD CLASS="value"><SPAN id="collected-balance"></SPAN></TD></TR>' .
'</TABLE>' .
'</DIV>' .
"\n");
?>
<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>
</div>
<a href="#" onClick="$('#debug').html(''); return false;">Clear Debug Output</a>

View File

@@ -64,8 +64,10 @@ foreach ($fields AS $field => $config) {
elseif (isset($field_prefix) && !isset($config['no_prefix']))
$field = $field_prefix . '.' . $field;
$config['opts']['label'] = false;
$config['opts']['div'] = false;
if (!isset($config['opts']['label']))
$config['opts']['label'] = false;
if (!isset($config['opts']['div']))
$config['opts']['div'] = false;
$cells = array();
if ($include_before) {

View File

@@ -88,6 +88,12 @@ if (isset($account_ftype))
$grid->invalidFields('Sub-Total');
// Now that columns are defined, establish basic grid parameters
$grid
->columns($cols)
->sortField('Date')
->defaultFields(array('Entry', 'Date', 'Amount', 'Credit', 'Debit'));
if (!isset($config['rows']) && !isset($collected_account_id)) {
$config['action'] = 'ledger';
@@ -99,7 +105,9 @@ if (isset($reconcile_id)) {
}
if (isset($collected_account_id)) {
$config['action'] = 'collected';
$grid->customData(compact('collected_account_id'))->limit(500);
$grid->sortField('Paid');
}
// Set up search fields if requested by caller
@@ -113,9 +121,6 @@ $grid->customData(compact('ledger_id', 'account_id', 'ar_account',
// Render the grid
$grid
->columns($cols)
->sortField('Date')
->defaultFields(array('Entry', 'Date', 'Amount', 'Credit', 'Debit'))
->render($this, isset($config) ? $config : null,
array('Transaction', 'Entry', 'Date', 'Effective', 'Paid',
'Account', 'Debit Account', 'Credit Account',