From cf9be800e5db6a22dfc7540cb004b144943e07dd Mon Sep 17 00:00:00 2001 From: abijah Date: Tue, 2 Mar 2010 03:25:52 +0000 Subject: [PATCH] Merge in the v0.2.0 work git-svn-id: file:///svn-source/pmgr/trunk/site@938 97e9348a-65ac-dc4b-aefc-98561f571b83 --- controllers/statement_entries_controller.php | 12 +- views/customers/receipt.ctp | 20 +- views/elements/leases.ctp | 5 +- views/leases/invoice.ctp | 201 +++++++++++++------ views/tenders/view.ctp | 12 +- webroot/css/print.css | 8 + webroot/js/pmgr.js | 147 +++++++++----- 7 files changed, 281 insertions(+), 124 deletions(-) diff --git a/controllers/statement_entries_controller.php b/controllers/statement_entries_controller.php index c14333f..b931e75 100644 --- a/controllers/statement_entries_controller.php +++ b/controllers/statement_entries_controller.php @@ -47,7 +47,17 @@ class StatementEntriesController extends AppController { if (!empty($params['post']['custom']['statement_entry_id'])) { $link['ChargeEntry'] = array(); - $link['DisbursementEntry'] = array(); + // This query actually represents a union... + // Unpaid Charge/Surplus: ChargeID - NULL; DisbursementID - NULL + // Paid Charge/Refund: ChargeID - NULL; DisbursementID - !NULL + // Disbursement/Reversal: ChargeID - !NULL; DisbursementID - NULL + // : ChargeID - !NULL; DisbursementID - !NULL + // + // The query is really slow unless we add the `id` condition to the join. + // A cleaner query would be nice, but we must work within the Cake framework. + $link['DisbursementEntry'] = array('conditions' => + '`DisbursementEntry`.`id` = ' + . $params['post']['custom']['statement_entry_id']); } return array('link' => $link); diff --git a/views/customers/receipt.ctp b/views/customers/receipt.ctp index 6e6f41e..446aa40 100644 --- a/views/customers/receipt.ctp +++ b/views/customers/receipt.ctp @@ -48,24 +48,32 @@ function verifyRequest(formData, jqForm, options) { if (formData[i]['name'] == "data[Customer][id]" && !(formData[i]['value'] > 0)) { //$("#debug").append('

Missing Customer ID'); - alert("Must select a customer first"); + alert("Please select a customer first."); return false; } if (formData[i]['name'] == "data[Transaction][stamp]" && formData[i]['value'] == '') { //$("#debug").append('

Bad Stamp'); - alert("Must enter a valid date stamp"); + if (formData[i]['value'] != '') + alert(formData[i]['value'] + " is not valid date stamp. Please correct it."); + else + alert("Please enter a valid date stamp first."); return false; } // Terrible way to accomplish this... for (var j = 0; j < 20; ++j) { - if (formData[i]['name'] == "data[Entry]["+j+"][amount]" && - !(formData[i]['value'] > 0)) { + if (formData[i]['name'] == "data[Entry]["+j+"][amount]") { + var val = formData[i]['value'].replace(/\$/,''); //$("#debug").append('

Bad Amount'); - alert("Must enter a valid amount"); - return false; + if (!(val > 0)) { + if (formData[i]['value'] == '') + alert("Please enter an amount first."); + else + alert('"'+formData[i]['value']+'"' + " is not valid amount. Please correct it."); + return false; + } } } diff --git a/views/elements/leases.ctp b/views/elements/leases.ctp index 916924a..556a6db 100644 --- a/views/elements/leases.ctp +++ b/views/elements/leases.ctp @@ -11,6 +11,7 @@ $cols['Signed'] = array('index' => 'Lease.lease_date', 'formatter' => 'dat $cols['Move-In'] = array('index' => 'Lease.movein_date', 'formatter' => 'date'); $cols['Move-Out'] = array('index' => 'Lease.moveout_date', 'formatter' => 'date'); $cols['Closed'] = array('index' => 'Lease.close_date', 'formatter' => 'date'); +$cols['Charge-Thru'] = array('index' => 'Lease.charge_through_date', 'formatter' => 'date'); $cols['Paid-Thru'] = array('index' => 'Lease.paid_through_date', 'formatter' => 'date'); $cols['Status'] = array('index' => 'status', 'formatter' => 'longenum'); $cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency'); @@ -18,7 +19,7 @@ $cols['Comment'] = array('index' => 'Lease.comment', 'formatter' => 'com if (!empty($this->params['action'])) { if ($this->params['action'] === 'closed') - $grid->invalidFields(array('Paid-Thru', 'Status')); + $grid->invalidFields(array('Charge-Thru', 'Paid-Thru', 'Status')); elseif ($this->params['action'] === 'active') $grid->invalidFields(array('Closed')); elseif ($this->params['action'] === 'delinquent') @@ -32,4 +33,4 @@ $grid ->defaultFields(array('Lease')) ->searchFields(array('Customer', 'Unit')) ->render($this, isset($config) ? $config : null, - array_diff(array_keys($cols), array('Signed', 'Status', 'Comment'))); + array_diff(array_keys($cols), array('Signed', 'Charge-Thru', 'Status', 'Comment'))); diff --git a/views/leases/invoice.ctp b/views/leases/invoice.ctp index ed3b6e7..3a4dc6b 100644 --- a/views/leases/invoice.ctp +++ b/views/leases/invoice.ctp @@ -10,6 +10,7 @@ $customer = $lease['Customer']; if (isset($lease['Lease'])) $lease = $lease['Lease']; +//pr(compact('unit', 'customer', 'lease', 'movein')); /********************************************************************** ********************************************************************** @@ -25,6 +26,8 @@ Configure::write('debug', '0');