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@324 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-13 02:24:31 +00:00
parent 03af4e731f
commit 8a3c6ae21b
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>