More progress on posting payments. Customer selection now works as well as the date picker. At this point, we need to figure out how to insert this data into the database. Of course, significant cleanup is still required, as is beautification.
git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605@155 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -12,8 +12,10 @@ $cols['Leases'] = array('index' => 'lease_count', 'width' =>
|
||||
$cols['Comment'] = array('index' => 'Customer.comment', 'formatter' => 'comment');
|
||||
|
||||
$jqGrid_options = array('jqGridColumns' => $cols,
|
||||
'controller' => 'customers',
|
||||
'caption' => isset($caption) ? $caption : null);
|
||||
'controller' => 'customers');
|
||||
|
||||
// User requested options have priority
|
||||
$jqGrid_options += compact('caption', 'grid_setup', 'limit');
|
||||
|
||||
if (isset($customers)) {
|
||||
$jqGrid_options += array('custom_ids' =>
|
||||
@@ -22,7 +24,9 @@ if (isset($customers)) {
|
||||
$customers),
|
||||
'limit' => 5);
|
||||
}
|
||||
else {
|
||||
|
||||
// Not the long term solution here... just for testing
|
||||
if (isset($searchfields)) {
|
||||
$jqGrid_options += array('search_fields' => array('Last Name', 'First Name'));
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,8 @@ if (!isset($grid_id))
|
||||
if (!isset($search_fields))
|
||||
$search_fields = array();
|
||||
|
||||
if (!isset($grid_setup))
|
||||
$grid_setup = array();
|
||||
|
||||
// Do some prework to bring in the appropriate libraries
|
||||
$imgpath = '/pmgr/site/css/jqGrid/basic/images';
|
||||
@@ -139,10 +141,35 @@ foreach ($jqGridColumns AS &$col) {
|
||||
$col = array_merge($default, $col);
|
||||
}
|
||||
|
||||
// Set the default sort column
|
||||
reset($jqGridColumns);
|
||||
$sortname = current($jqGridColumns);
|
||||
$sortname = $sortname['index'];
|
||||
|
||||
// Configure the grid setup, giving priority to user defined parameters
|
||||
$jqGrid_setup = array_merge
|
||||
(array('mtype' => 'GET',
|
||||
'datatype' => 'xml',
|
||||
'url' => $url,
|
||||
'postData' => $postData,
|
||||
'colNames' => array_keys($jqGridColumns),
|
||||
'colModel' => array('--special' => $jqGridColumns),
|
||||
'height' => $height,
|
||||
'rowNum' => $limit,
|
||||
'rowList' => $limitOptions,
|
||||
'sortname' => $sortname,
|
||||
'caption' => $caption,
|
||||
'imgpath' => $imgpath,
|
||||
'viewrecords' => true,
|
||||
'pager' => $grid_id.'-pager',
|
||||
|
||||
'loadComplete' => array('--special' => "function() {url=jQuery('#{$grid_id}').getGridParam('url');url=url.replace(/\/debug.*$/,'?'); pd=jQuery('#{$grid_id}').getPostData();$.each(pd,function(i){ url+=i+'='+escape(pd[i])+'&'; }); jQuery('#{$grid_id}-query').html('<A HREF=\"'+url+'\">Grid Query</A><BR>');}"),
|
||||
'loadError' => array('--special' => "function(xhr,st,err) {url=jQuery('#{$grid_id}').getGridParam('url');url=url.replace(/\/debug.*$/,'?'); pd=jQuery('#{$grid_id}').getPostData();$.each(pd,function(i){ url+=i+'='+escape(pd[i])+'&'; }); jQuery('#{$grid_id}-query').html('<A HREF=\"'+url+'\">Grid Error Query</A><BR>');}"),
|
||||
|
||||
),
|
||||
$grid_setup
|
||||
);
|
||||
//pr(compact('grid_setup', 'jqGrid_setup'));
|
||||
|
||||
// OK, now that everything is in place, get out of PHP mode,
|
||||
// and add the javascript code (along with a touch of HTML)
|
||||
@@ -165,27 +192,7 @@ jQuery(document).ready(function(){
|
||||
}
|
||||
|
||||
jQuery('#<?php echo $grid_id; ?>').jqGrid(
|
||||
<?php
|
||||
echo FormatHelper::phpVarToJavascript
|
||||
(array('mtype' => 'GET',
|
||||
'datatype' => 'xml',
|
||||
'url' => $url,
|
||||
'postData' => $postData,
|
||||
'colNames' => array_keys($jqGridColumns),
|
||||
'colModel' => array('--special' => $jqGridColumns),
|
||||
'height' => $height,
|
||||
'rowNum' => $limit,
|
||||
'rowList' => $limitOptions,
|
||||
'sortname' => $sortname,
|
||||
'caption' => $caption,
|
||||
'imgpath' => $imgpath,
|
||||
'viewrecords' => true,
|
||||
'pager' => $grid_id.'-pager',
|
||||
|
||||
'loadComplete' => array('--special' => "function() {url=jQuery('#{$grid_id}').getGridParam('url');url=url.replace(/\/debug.*$/,'?'); pd=jQuery('#{$grid_id}').getPostData();$.each(pd,function(i){ url+=i+'='+escape(pd[i])+'&'; }); jQuery('#{$grid_id}-query').html('<A HREF=\"'+url+'\">Grid Query</A><BR>');}"),
|
||||
'loadError' => array('--special' => "function(xhr,st,err) {url=jQuery('#{$grid_id}').getGridParam('url');url=url.replace(/\/debug.*$/,'?'); pd=jQuery('#{$grid_id}').getPostData();$.each(pd,function(i){ url+=i+'='+escape(pd[i])+'&'; }); jQuery('#{$grid_id}-query').html('<A HREF=\"'+url+'\">Grid Error Query</A><BR>');}"),
|
||||
//'toolbar' => array(true,"bottom"),
|
||||
)); ?>
|
||||
<?php echo FormatHelper::phpVarToJavascript($jqGrid_setup); ?>
|
||||
).navGrid('#<?php echo $grid_id; ?>-pager',
|
||||
{ view:false,
|
||||
edit:false,
|
||||
|
||||
Reference in New Issue
Block a user