diff --git a/controllers/documents_controller.php b/controllers/documents_controller.php
new file mode 100644
index 00000000..7ad5a222
--- /dev/null
+++ b/controllers/documents_controller.php
@@ -0,0 +1,178 @@
+Document->recursive = 0;
+ $this->set('documents', $this->paginate());
+ }
+
+ function view($id = null) {
+ if (!$id) {
+ $this->Session->setFlash(__('Invalid Document.', true));
+ $this->redirect(array('action'=>'index'));
+ }
+ $document = $this->Document->read(null, $id);
+ $this->set('document', $document);
+
+
+ $this->set('customer', $this->Document->Enquiry->Customer->findById($document['Enquiry']['customer_id']));
+
+ $this->set('currencies', $this->Document->Quote->Currency->find('list'));
+
+ $this->set('principles', $this->Document->Enquiry->Principle->find('list'));
+
+ $pages = $document['Page'];
+
+
+ $this->set('pages', $pages);
+
+
+ $docType = "";
+
+ if(!empty($document['Invoice']['id'])) {
+ $docType = "invoice";
+ }
+ elseif(!empty($document['Quote']['id'])) {
+ $docType = "quote";
+ }
+ elseif(!empty($document['PurchaseOrder']['id'])) {
+ $docType = "purchaseOrder";
+ }
+ $this->set('docType',$docType);
+ }
+
+ /**
+ * Create a new Quote, along with its associated Document and the first two pages.
+ * @param int $id - the Enquiry ID that this quote belongs to.
+ */
+ function newQuote($id = null) {
+ $enquiryid = $id;
+ $this->Document->create();
+
+ $enquiry = $this->Document->Enquiry->findById($id);
+
+ $this->data['Document']['enquiry_id'] = $enquiryid;
+
+ $this->data['Quote']['enquiry_id'] = $enquiryid;
+ $number_of_revisions = $this->Document->Quote->findCount('Quote.enquiry_id ='. $enquiryid);
+ $this->data['Quote']['revision'] = $number_of_revisions;
+
+ $this->data['Document']['customer_id'] = $enquiry['Enquiry']['customer_id'];
+ $this->data['Document']['user_id']= $enquiry['Enquiry']['user_id'];
+ $this->data['Document']['contact_id']= $enquiry['Enquiry']['contact_id'];
+ $this->data['Page'][0]['page_number'] = 1;
+ $this->data['Page'][0]['contentPage'] = 1;
+ $this->data['Page'][1]['page_number'] = 2;
+ $this->data['Page'][1]['contentPage'] = 0;
+
+ if ($this->Document->saveAll($this->data)) {
+ $newid = $this->Document->id;
+
+ $this->Session->setFlash(__('The Document has been saved', true));
+ $this->redirect(array('action'=>'view',$newid));
+ } else {
+ $this->Session->setFlash(__('The Document could not be saved. Please, try again.', true));
+ }
+
+
+ }
+
+
+
+ /**
+ * Create a new Quote, along with its associated Document and the first two pages.
+ * @param int $id - the Enquiry ID that this quote belongs to.
+ */
+ function newInvoice($id = null) {
+ $enquiryid = $id;
+ $this->Document->create();
+
+ $enquiry = $this->Document->Enquiry->findById($id);
+
+ $this->data['Document']['enquiry_id'] = $enquiryid;
+
+ $this->data['Invoice']['enquiry_id'] = $enquiryid;
+ $invoice_number_offset = 4436; //What Invoice number we were up to before the new system.
+ $number_of_invoices = $this->Document->Invoice->findCount();
+
+ $newInvoiceNumber = $invoice_number_offset + $number_of_invoices;
+
+ $this->data['Invoice']['title'] = "CMCIN".$newInvoiceNumber;
+
+
+ $this->data['Document']['customer_id'] = $enquiry['Enquiry']['customer_id'];
+ $this->data['Document']['user_id']= $enquiry['Enquiry']['user_id'];
+ $this->data['Document']['contact_id']= $enquiry['Enquiry']['contact_id'];
+ $this->data['Page'][0]['page_number'] = 1;
+ $this->data['Page'][0]['contentPage'] = 0;
+
+ if ($this->Document->saveAll($this->data)) {
+ $newid = $this->Document->id;
+
+ $this->Session->setFlash(__('The Document has been saved', true));
+ $this->redirect(array('action'=>'view',$newid));
+ } else {
+ $this->Session->setFlash(__('The Document could not be saved. Please, try again.', true));
+ }
+
+
+ }
+
+ /* function add() {
+ if (!empty($this->data)) {
+ $this->Document->create();
+ if ($this->Document->save($this->data)) {
+ $this->Session->setFlash(__('The Document has been saved', true));
+ $this->redirect(array('action'=>'index'));
+ } else {
+ $this->Session->setFlash(__('The Document could not be saved. Please, try again.', true));
+ }
+ }
+ $customers = $this->Document->Customer->find('list');
+ $enquiries = $this->Document->Enquiry->find('list');
+ $jobs = $this->Document->Job->find('list');
+ $users = $this->Document->User->find('list');
+ $contacts = $this->Document->Contact->find('list');
+ $this->set(compact('customers', 'enquiries', 'jobs', 'users', 'contacts'));
+ }*/
+
+ function edit($id = null) {
+ if (!$id && empty($this->data)) {
+ $this->Session->setFlash(__('Invalid Document', true));
+ $this->redirect(array('action'=>'index'));
+ }
+ if (!empty($this->data)) {
+ if ($this->Document->save($this->data)) {
+ $this->Session->setFlash(__('The Document has been saved', true));
+ $this->redirect(array('action'=>'index'));
+ } else {
+ $this->Session->setFlash(__('The Document could not be saved. Please, try again.', true));
+ }
+ }
+ if (empty($this->data)) {
+ $this->data = $this->Document->read(null, $id);
+ }
+ $customers = $this->Document->Customer->find('list');
+ $enquiries = $this->Document->Enquiry->find('list');
+ $jobs = $this->Document->Job->find('list');
+ $users = $this->Document->User->find('list');
+ $contacts = $this->Document->Contact->find('list');
+ $this->set(compact('customers','enquiries','jobs','users','contacts'));
+ }
+
+ /*function delete($id = null) {
+ if (!$id) {
+ $this->Session->setFlash(__('Invalid id for Document', true));
+ $this->redirect(array('action'=>'index'));
+ }
+ if ($this->Document->del($id)) {
+ $this->Session->setFlash(__('Document deleted', true));
+ $this->redirect(array('action'=>'index'));
+ }
+ }*/
+
+}
+?>
\ No newline at end of file
diff --git a/controllers/enquiries_controller.php b/controllers/enquiries_controller.php
index 96e5ced3..49581ed7 100755
--- a/controllers/enquiries_controller.php
+++ b/controllers/enquiries_controller.php
@@ -44,10 +44,11 @@ class EnquiriesController extends AppController {
$this->set('enquiry', $enquiry);
//$this->set('quotes', $enquiry['Quote']);
- $this->set('quotes', $this->Enquiry->Quote->find('all', array('recursive' => 0, 'conditions'=>array('Quote.enquiry_id'=>$id), 'order'=>'Quote.revision DESC')));
+ $this->set('quotes', $this->Enquiry->Quote->find('all', array('conditions'=>array('Quote.enquiry_id'=>$id), 'order'=>'Quote.revision DESC')));
$this->set('invoices', $this->Enquiry->Invoice->find('all', array('conditions' => array('Invoice.enquiry_id' => $id))));
+
$this->pageTitle = "Enquiry: ".$enquiry['Enquiry']['title'];
@@ -74,6 +75,7 @@ class EnquiriesController extends AppController {
$this->set('number_of_emails', $this->Enquiry->Email->find('count', array('conditions'=>array('Email.enquiry_id'=>$id))));
*/
+
$this->set('emails', $this->Enquiry->Email->find('all', array('conditions'=>array('Email.enquiry_id' => $id))));
$this->set('number_of_quotes', $this->Enquiry->Quote->find('count', array('conditions'=>array('Quote.enquiry_id'=>$id))));
//$this->set('number_of_files', $this->Enquiry->EnquiryFile->find('count', array('conditions' => array('EnquiryFile.enquiry_id'=>$id))));
diff --git a/controllers/invoices_controller.php b/controllers/invoices_controller.php
index 065becc4..6904c681 100644
--- a/controllers/invoices_controller.php
+++ b/controllers/invoices_controller.php
@@ -6,8 +6,8 @@ class InvoicesController extends AppController {
var $paginate = array(
- 'limit' => 100,
- 'contain' => array('Customer')
+ 'limit' => 100,
+ 'contain' => array('Customer')
);
function index() {
@@ -25,7 +25,7 @@ class InvoicesController extends AppController {
- function add() {
+ function add() { //No longer creating invoices directly. Done through the Documents Controller
if (!empty($this->data)) {
$this->Invoice->create();
@@ -52,8 +52,8 @@ class InvoicesController extends AppController {
if(isset($this->params['named']['enquiryid'])) {
$enquiryid = $this->params['named']['enquiryid'];
$enquiry = $this->Invoice->Enquiry->findById($enquiryid);
-
-
+
+
$user = $this->Auth->user();
$this->set(compact('enquiry', 'user'));
diff --git a/controllers/jobs_controller.php b/controllers/jobs_controller.php
index e2be9744..c82563e5 100644
--- a/controllers/jobs_controller.php
+++ b/controllers/jobs_controller.php
@@ -5,8 +5,9 @@ class JobsController extends AppController {
var $helpers = array('Html', 'Form');
function index() {
- $this->Job->recursive = 0;
+ //$this->Job->recursive = 1;
$this->set('jobs', $this->paginate());
+ $this->set('customers', $this->Job->Enquiry->Customer->find('list'));
}
function view($id = null) {
diff --git a/controllers/pages_controller.php b/controllers/pages_controller.php
new file mode 100644
index 00000000..c617b97f
--- /dev/null
+++ b/controllers/pages_controller.php
@@ -0,0 +1,66 @@
+Page->recursive = 0;
+ $this->set('pages', $this->paginate());
+ }
+
+ function view($id = null) {
+ if (!$id) {
+ $this->Session->setFlash(__('Invalid Page.', true));
+ $this->redirect(array('action'=>'index'));
+ }
+ $this->set('page', $this->Page->read(null, $id));
+ }
+
+ function add() {
+ if (!empty($this->data)) {
+ $this->Page->create();
+ if ($this->Page->save($this->data)) {
+ $this->Session->setFlash(__('The Page has been saved', true));
+ $this->redirect(array('action'=>'index'));
+ } else {
+ $this->Session->setFlash(__('The Page could not be saved. Please, try again.', true));
+ }
+ }
+ $documents = $this->Page->Document->find('list');
+ $this->set(compact('documents'));
+ }
+
+ function edit($id = null) {
+ if (!$id && empty($this->data)) {
+ $this->Session->setFlash(__('Invalid Page', true));
+ $this->redirect(array('action'=>'index'));
+ }
+ if (!empty($this->data)) {
+ if ($this->Page->save($this->data)) {
+ $this->Session->setFlash(__('The Page has been saved', true));
+ $this->redirect(array('action'=>'index'));
+ } else {
+ $this->Session->setFlash(__('The Page could not be saved. Please, try again.', true));
+ }
+ }
+ if (empty($this->data)) {
+ $this->data = $this->Page->read(null, $id);
+ }
+ $documents = $this->Page->Document->find('list');
+ $this->set(compact('documents'));
+ }
+
+ function delete($id = null) {
+ if (!$id) {
+ $this->Session->setFlash(__('Invalid id for Page', true));
+ $this->redirect(array('action'=>'index'));
+ }
+ if ($this->Page->del($id)) {
+ $this->Session->setFlash(__('Page deleted', true));
+ $this->redirect(array('action'=>'index'));
+ }
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/controllers/quotes_controller.php b/controllers/quotes_controller.php
index 0769ca84..89a48a9b 100755
--- a/controllers/quotes_controller.php
+++ b/controllers/quotes_controller.php
@@ -51,10 +51,7 @@ class QuotesController extends AppController {
$this->data['Quote']['currency_id'] = 2;
- /**
- * @todo Fix this hard coded default currency. Currently set to '2' for AUD.
- */
-
+
if ($this->Quote->save($this->data)) {
$quoteid = $this->Quote->id;
diff --git a/models/document.php b/models/document.php
new file mode 100644
index 00000000..96e109a1
--- /dev/null
+++ b/models/document.php
@@ -0,0 +1,65 @@
+ array(
+ 'className' => 'Enquiry',
+ 'foreignKey' => 'enquiry_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ ),
+ 'Job' => array(
+ 'className' => 'Job',
+ 'foreignKey' => 'job_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ ),
+ 'User' => array(
+ 'className' => 'User',
+ 'foreignKey' => 'user_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ ),
+ 'Contact' => array(
+ 'className' => 'Contact',
+ 'foreignKey' => 'contact_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ ),
+
+ );
+
+ var $hasMany = array(
+ 'Page' => array(
+ 'className' => 'Page',
+ 'foreignKey' => 'document_id',
+ 'dependent' => false
+ )
+ );
+
+
+ var $hasOne = array(
+ 'Invoice' => array(
+ 'className' => 'Invoice',
+ 'foreignKey'=> 'document_id'
+ ),
+ 'Quote' => array(
+ 'className'=>'Quote',
+ 'foriegnKey'=>'document_id'
+ ),
+
+ 'PurchaseOrder' => array(
+ 'className'=>'PurchaseOrder',
+ 'foreignKey'=>'document_id'
+ )
+ );
+}
+?>
\ No newline at end of file
diff --git a/models/enquiry.php b/models/enquiry.php
index 551225d9..cf1b3ddb 100755
--- a/models/enquiry.php
+++ b/models/enquiry.php
@@ -181,7 +181,11 @@ class Enquiry extends AppModel {
'foreignKey'=>'enquiry_id'),
'Job' => array('className' => 'Job',
- 'foreignKey' =>'enquiry_id')
+ 'foreignKey' =>'enquiry_id'),
+
+
+ 'Document' => array('className'=>'Document',
+ 'foreignKey'=>'enquiry_id')
/* 'EnquiryFile' => array('className' => 'EnquiryFile',
diff --git a/models/job.php b/models/job.php
index 934f5d81..ad8fe2dc 100644
--- a/models/job.php
+++ b/models/job.php
@@ -27,21 +27,7 @@ class Job extends AppModel {
)
);
- /*var $hasMany = array(
- 'JobProduct' => array(
- 'className' => 'JobProduct',
- 'foreignKey' => 'job_id',
- 'dependent' => false,
- 'conditions' => '',
- 'fields' => '',
- 'order' => '',
- 'limit' => '',
- 'offset' => '',
- 'exclusive' => '',
- 'finderQuery' => '',
- 'counterQuery' => ''
- )
- );*/
+
}
?>
\ No newline at end of file
diff --git a/models/line_item.php b/models/line_item.php
index b4ac5df0..efe7db72 100644
--- a/models/line_item.php
+++ b/models/line_item.php
@@ -33,7 +33,10 @@ class LineItem extends AppModel {
),
'Principle' => array('className' => 'Principle',
- 'foreignKey' =>'principle_id')
+ 'foreignKey' =>'principle_id'),
+
+ 'Page' => array('className'=>'Page',
+ 'foreignKey'=>'page_id')
);
diff --git a/models/page.php b/models/page.php
new file mode 100644
index 00000000..7ecda669
--- /dev/null
+++ b/models/page.php
@@ -0,0 +1,22 @@
+ array(
+ 'className' => 'Document',
+ 'foreignKey' => 'document_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ )
+ );
+
+
+
+ var $order = 'Page.page_number ASC';
+
+}
+?>
\ No newline at end of file
diff --git a/models/purchase_order.php b/models/purchase_order.php
new file mode 100644
index 00000000..3d12d7b9
--- /dev/null
+++ b/models/purchase_order.php
@@ -0,0 +1,41 @@
+ array(
+ 'className' => 'Principle',
+ 'foreignKey' => 'principle_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ ),
+ 'Document' => array(
+ 'className' => 'Document',
+ 'foreignKey' => 'document_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ )
+ );
+
+ var $hasMany = array(
+ 'Shipment' => array(
+ 'className' => 'Shipment',
+ 'foreignKey' => 'purchase_order_id',
+ 'dependent' => false,
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => '',
+ 'limit' => '',
+ 'offset' => '',
+ 'exclusive' => '',
+ 'finderQuery' => '',
+ 'counterQuery' => ''
+ )
+ );
+
+}
+?>
\ No newline at end of file
diff --git a/models/quote.php b/models/quote.php
index 9aa1ac2a..a02fb6b8 100755
--- a/models/quote.php
+++ b/models/quote.php
@@ -20,7 +20,9 @@ class Quote extends AppModel {
'order' => ''
),
- 'Currency' => array('className' => 'Currency', 'foreignKey' => 'currency_id')
+ 'Currency' => array('className' => 'Currency', 'foreignKey' => 'currency_id'),
+
+ 'Document' => array('className'=>'Document', 'foreignKey'=>'document_id')
);
diff --git a/views/documents/add.ctp b/views/documents/add.ctp
new file mode 100644
index 00000000..488e81d2
--- /dev/null
+++ b/views/documents/add.ctp
@@ -0,0 +1,38 @@
+
+create('Document');?>
+
+
+ input('customer_id');
+ echo $form->input('enquiry_id');
+ echo $form->input('job_id');
+ echo $form->input('user_id');
+ echo $form->input('contact_id');
+ echo $form->input('type');
+ echo $form->input('quote_id');
+ echo $form->input('invoice_id');
+ ?>
+
+end('Submit');?>
+
+
+
+ link(__('List Documents', true), array('action' => 'index'));?>
+ link(__('List Customers', true), array('controller' => 'customers', 'action' => 'index')); ?>
+ link(__('New Customer', true), array('controller' => 'customers', 'action' => 'add')); ?>
+ link(__('List Enquiries', true), array('controller' => 'enquiries', 'action' => 'index')); ?>
+ link(__('New Enquiry', true), array('controller' => 'enquiries', 'action' => 'add')); ?>
+ link(__('List Jobs', true), array('controller' => 'jobs', 'action' => 'index')); ?>
+ link(__('New Job', true), array('controller' => 'jobs', 'action' => 'add')); ?>
+ link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?>
+ link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?>
+ link(__('List Contacts', true), array('controller' => 'contacts', 'action' => 'index')); ?>
+ link(__('New Contact', true), array('controller' => 'contacts', 'action' => 'add')); ?>
+ link(__('List Invoices', true), array('controller' => 'invoices', 'action' => 'index')); ?>
+ link(__('New Invoice', true), array('controller' => 'invoices', 'action' => 'add')); ?>
+ link(__('List Quotes', true), array('controller' => 'quotes', 'action' => 'index')); ?>
+ link(__('New Quote', true), array('controller' => 'quotes', 'action' => 'add')); ?>
+ link(__('List Pages', true), array('controller' => 'pages', 'action' => 'index')); ?>
+ link(__('New Page', true), array('controller' => 'pages', 'action' => 'add')); ?>
+
+
diff --git a/views/documents/edit.ctp b/views/documents/edit.ctp
new file mode 100644
index 00000000..5bf4221a
--- /dev/null
+++ b/views/documents/edit.ctp
@@ -0,0 +1,40 @@
+
+create('Document');?>
+
+
+ input('id');
+ echo $form->input('customer_id');
+ echo $form->input('enquiry_id');
+ echo $form->input('job_id');
+ echo $form->input('user_id');
+ echo $form->input('contact_id');
+ echo $form->input('type');
+ echo $form->input('quote_id');
+ echo $form->input('invoice_id');
+ ?>
+
+end('Submit');?>
+
+
+
+ link(__('Delete', true), array('action' => 'delete', $form->value('Document.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $form->value('Document.id'))); ?>
+ link(__('List Documents', true), array('action' => 'index'));?>
+ link(__('List Customers', true), array('controller' => 'customers', 'action' => 'index')); ?>
+ link(__('New Customer', true), array('controller' => 'customers', 'action' => 'add')); ?>
+ link(__('List Enquiries', true), array('controller' => 'enquiries', 'action' => 'index')); ?>
+ link(__('New Enquiry', true), array('controller' => 'enquiries', 'action' => 'add')); ?>
+ link(__('List Jobs', true), array('controller' => 'jobs', 'action' => 'index')); ?>
+ link(__('New Job', true), array('controller' => 'jobs', 'action' => 'add')); ?>
+ link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?>
+ link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?>
+ link(__('List Contacts', true), array('controller' => 'contacts', 'action' => 'index')); ?>
+ link(__('New Contact', true), array('controller' => 'contacts', 'action' => 'add')); ?>
+ link(__('List Invoices', true), array('controller' => 'invoices', 'action' => 'index')); ?>
+ link(__('New Invoice', true), array('controller' => 'invoices', 'action' => 'add')); ?>
+ link(__('List Quotes', true), array('controller' => 'quotes', 'action' => 'index')); ?>
+ link(__('New Quote', true), array('controller' => 'quotes', 'action' => 'add')); ?>
+ link(__('List Pages', true), array('controller' => 'pages', 'action' => 'index')); ?>
+ link(__('New Page', true), array('controller' => 'pages', 'action' => 'add')); ?>
+
+
diff --git a/views/documents/index.ctp b/views/documents/index.ctp
new file mode 100644
index 00000000..be1c903a
--- /dev/null
+++ b/views/documents/index.ctp
@@ -0,0 +1,96 @@
+
+
+
+counter(array(
+'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
+));
+?>
+
+
+ sort('id');?>
+ sort('created');?>
+ sort('customer_id');?>
+ sort('enquiry_id');?>
+ sort('job_id');?>
+ sort('user_id');?>
+ sort('contact_id');?>
+ sort('type');?>
+ sort('quote_id');?>
+ sort('invoice_id');?>
+
+
+
+ >
+
+
+
+
+
+
+
+ link($document['Customer']['name'], array('controller' => 'customers', 'action' => 'view', $document['Customer']['id'])); ?>
+
+
+ link($document['Enquiry']['title'], array('controller' => 'enquiries', 'action' => 'view', $document['Enquiry']['id'])); ?>
+
+
+ link($document['Job']['title'], array('controller' => 'jobs', 'action' => 'view', $document['Job']['id'])); ?>
+
+
+ link($document['User']['username'], array('controller' => 'users', 'action' => 'view', $document['User']['id'])); ?>
+
+
+ link($document['Contact']['name'], array('controller' => 'contacts', 'action' => 'view', $document['Contact']['id'])); ?>
+
+
+
+
+
+
+
+
+
+
+
+ link(__('View', true), array('action' => 'view', $document['Document']['id'])); ?>
+ link(__('Edit', true), array('action' => 'edit', $document['Document']['id'])); ?>
+ link(__('Delete', true), array('action' => 'delete', $document['Document']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $document['Document']['id'])); ?>
+
+
+
+
+
+
+ prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
+ | numbers();?>
+ next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
+
+
+
+ link(__('New Document', true), array('action' => 'add')); ?>
+ link(__('List Customers', true), array('controller' => 'customers', 'action' => 'index')); ?>
+ link(__('New Customer', true), array('controller' => 'customers', 'action' => 'add')); ?>
+ link(__('List Enquiries', true), array('controller' => 'enquiries', 'action' => 'index')); ?>
+ link(__('New Enquiry', true), array('controller' => 'enquiries', 'action' => 'add')); ?>
+ link(__('List Jobs', true), array('controller' => 'jobs', 'action' => 'index')); ?>
+ link(__('New Job', true), array('controller' => 'jobs', 'action' => 'add')); ?>
+ link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?>
+ link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?>
+ link(__('List Contacts', true), array('controller' => 'contacts', 'action' => 'index')); ?>
+ link(__('New Contact', true), array('controller' => 'contacts', 'action' => 'add')); ?>
+ link(__('List Invoices', true), array('controller' => 'invoices', 'action' => 'index')); ?>
+ link(__('New Invoice', true), array('controller' => 'invoices', 'action' => 'add')); ?>
+ link(__('List Quotes', true), array('controller' => 'quotes', 'action' => 'index')); ?>
+ link(__('New Quote', true), array('controller' => 'quotes', 'action' => 'add')); ?>
+ link(__('List Pages', true), array('controller' => 'pages', 'action' => 'index')); ?>
+ link(__('New Page', true), array('controller' => 'pages', 'action' => 'add')); ?>
+
+
diff --git a/views/documents/view.ctp b/views/documents/view.ctp
new file mode 100644
index 00000000..f976af33
--- /dev/null
+++ b/views/documents/view.ctp
@@ -0,0 +1,56 @@
+link('addLineItem'); ?>
+
+link('lineItemPriceNoCosting'); ?>
+
+
+
+
link($document['Enquiry']['title'],
+ array('controller'=>'enquiries', 'action'=>'view', $document['Enquiry']['id']));
+
+ $customer_link = $html->link( $customer['Customer']['name'], array('controller'=>'customers', 'action' => 'view', $customer['Customer']['id']));
+
+ if($docType == 'quote') {
+
+ if($document['Quote']['revision'] == 0) {
+ __('Quote: '.$enquirynumber_link. ' for '. $customer_link);
+ }
+ else {
+ __('Quote: '.$enquirynumber_link.' Revision '.$document['Quote']['revision'].' for '. $customer_link);
+ }
+ }
+ else if($docType == 'invoice') {
+ __('Invoice: '.$document['Invoice']['title']. ' for '. $customer_link);
+ }
+
+ ?>
+
+
+
Page
+
+ if($page['contentPage'] == 1): ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ //debug($document); ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/views/documents/viewDEFAULT.ctp b/views/documents/viewDEFAULT.ctp
new file mode 100644
index 00000000..9b75cc39
--- /dev/null
+++ b/views/documents/viewDEFAULT.ctp
@@ -0,0 +1,253 @@
+
+
+
+ >
+ >
+
+
+
+ >
+ >
+
+
+
+ >
+ >
+ link($document['Customer']['name'], array('controller' => 'customers', 'action' => 'view', $document['Customer']['id'])); ?>
+
+
+ >
+ >
+ link($document['Enquiry']['title'], array('controller' => 'enquiries', 'action' => 'view', $document['Enquiry']['id'])); ?>
+
+
+ >
+ >
+ link($document['Job']['title'], array('controller' => 'jobs', 'action' => 'view', $document['Job']['id'])); ?>
+
+
+ >
+ >
+ link($document['User']['username'], array('controller' => 'users', 'action' => 'view', $document['User']['id'])); ?>
+
+
+ >
+ >
+ link($document['Contact']['name'], array('controller' => 'contacts', 'action' => 'view', $document['Contact']['id'])); ?>
+
+
+ >
+ >
+
+
+
+ >
+ >
+
+
+
+ >
+ >
+
+
+
+
+
+
+
+ link(__('Edit Document', true), array('action' => 'edit', $document['Document']['id'])); ?>
+ link(__('Delete Document', true), array('action' => 'delete', $document['Document']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $document['Document']['id'])); ?>
+ link(__('List Documents', true), array('action' => 'index')); ?>
+ link(__('New Document', true), array('action' => 'add')); ?>
+ link(__('List Customers', true), array('controller' => 'customers', 'action' => 'index')); ?>
+ link(__('New Customer', true), array('controller' => 'customers', 'action' => 'add')); ?>
+ link(__('List Enquiries', true), array('controller' => 'enquiries', 'action' => 'index')); ?>
+ link(__('New Enquiry', true), array('controller' => 'enquiries', 'action' => 'add')); ?>
+ link(__('List Jobs', true), array('controller' => 'jobs', 'action' => 'index')); ?>
+ link(__('New Job', true), array('controller' => 'jobs', 'action' => 'add')); ?>
+ link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?>
+ link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?>
+ link(__('List Contacts', true), array('controller' => 'contacts', 'action' => 'index')); ?>
+ link(__('New Contact', true), array('controller' => 'contacts', 'action' => 'add')); ?>
+ link(__('List Invoices', true), array('controller' => 'invoices', 'action' => 'index')); ?>
+ link(__('New Invoice', true), array('controller' => 'invoices', 'action' => 'add')); ?>
+ link(__('List Quotes', true), array('controller' => 'quotes', 'action' => 'index')); ?>
+ link(__('New Quote', true), array('controller' => 'quotes', 'action' => 'add')); ?>
+ link(__('List Pages', true), array('controller' => 'pages', 'action' => 'index')); ?>
+ link(__('New Page', true), array('controller' => 'pages', 'action' => 'add')); ?>
+
+
+
+
+
diff --git a/views/enquiries/view.ctp b/views/enquiries/view.ctp
index 91463a08..693b535a 100755
--- a/views/enquiries/view.ctp
+++ b/views/enquiries/view.ctp
@@ -174,8 +174,7 @@ $class = ' class="altrow"';?>
element('isEmptyDate',
- array('date' => $job['Job']['date_order_placed_on_principle']));
- ?>
+ array('date' => $job['Job']['date_order_placed_on_principle'])); ?>
element('isEmptyDate',
@@ -300,8 +299,11 @@ $class = ' class="altrow"';?>
- image('internet-mail.png'); ?>
+ image('internet-mail.png'); ?>
element('email_table_ajax', $enquiry); ?>
-element('email_table_ajax', $enquiry, array('cache'=>'+1 day')); ?>
+element('email_table_ajax', $enquiry, array('cache'=>'+1 day')); ?>
+
+
+
\ No newline at end of file
diff --git a/views/jobs/index.ctp b/views/jobs/index.ctp
index 07f8fc6f..7979e6d5 100644
--- a/views/jobs/index.ctp
+++ b/views/jobs/index.ctp
@@ -6,13 +6,14 @@
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
));
?>
-
+
sort('created');?>
sort('Job Number');?>
sort('enquiry_id');?>
- sort('comments');?>
+ sort('Customer');?>
+
sort('date_order_received');?>
sort('date_order_placed_on_principle');?>
sort('date_scheduled_ex_works');?>
@@ -21,6 +22,7 @@
sort('domestic_freight_paid_by');?>
sort('sale_category');?>
sort('shipment_category');?>
+ sort('comments');?>
>
-
-
+
+
+
+ toUnix($job['Job']['created'])); ?>
+
+
@@ -43,15 +51,14 @@
link($job['Enquiry']['title'], array('controller' => 'enquiries', 'action' => 'view', $job['Enquiry']['id'])); ?>
-
+
+
-
+
@@ -70,11 +77,13 @@
+
+
+
link(__('View', true), array('action' => 'view', $job['Job']['id'])); ?>
link(__('Edit', true), array('action' => 'edit', $job['Job']['id'])); ?>
- link(__('Delete', true), array('action' => 'delete', $job['Job']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $job['Job']['id'])); ?>
@@ -96,7 +105,7 @@
\ No newline at end of file
+?>
+
+
\ No newline at end of file
diff --git a/views/pages/add.ctp b/views/pages/add.ctp
new file mode 100644
index 00000000..9bb8b05e
--- /dev/null
+++ b/views/pages/add.ctp
@@ -0,0 +1,18 @@
+
+create('Page');?>
+
+
+ input('page_number');
+ echo $form->input('contentPage');
+ echo $form->input('content');
+ echo $form->input('document_id');
+ ?>
+
+end('Submit');?>
+
+
+
+ link(__('List Pages', true), array('action' => 'index'));?>
+
+
diff --git a/views/pages/edit.ctp b/views/pages/edit.ctp
new file mode 100644
index 00000000..a5a15a16
--- /dev/null
+++ b/views/pages/edit.ctp
@@ -0,0 +1,20 @@
+
+create('Page');?>
+
+
+ input('id');
+ echo $form->input('page_number');
+ echo $form->input('contentPage');
+ echo $form->input('content');
+ echo $form->input('document_id');
+ ?>
+
+end('Submit');?>
+
+
+
+ link(__('Delete', true), array('action' => 'delete', $form->value('Page.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $form->value('Page.id'))); ?>
+ link(__('List Pages', true), array('action' => 'index'));?>
+
+
diff --git a/views/pages/index.ctp b/views/pages/index.ctp
new file mode 100644
index 00000000..8ba83336
--- /dev/null
+++ b/views/pages/index.ctp
@@ -0,0 +1,60 @@
+
+
+
+counter(array(
+'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
+));
+?>
+
+
+ sort('id');?>
+ sort('page_number');?>
+ sort('contentPage');?>
+ sort('content');?>
+ sort('document_id');?>
+
+
+
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ link(__('View', true), array('action' => 'view', $page['Page']['id'])); ?>
+ link(__('Edit', true), array('action' => 'edit', $page['Page']['id'])); ?>
+ link(__('Delete', true), array('action' => 'delete', $page['Page']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $page['Page']['id'])); ?>
+
+
+
+
+
+
+ prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
+ | numbers();?>
+ next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
+
+
+
+ link(__('New Page', true), array('action' => 'add')); ?>
+
+
diff --git a/views/pages/view.ctp b/views/pages/view.ctp
new file mode 100644
index 00000000..42d18fcd
--- /dev/null
+++ b/views/pages/view.ctp
@@ -0,0 +1,38 @@
+
+
+
+ >
+ >
+
+
+
+ >
+ >
+
+
+
+ >
+ >
+
+
+
+ >
+ >
+
+
+
+ >
+ >
+
+
+
+
+
+
+
+ link(__('Edit Page', true), array('action' => 'edit', $page['Page']['id'])); ?>
+ link(__('Delete Page', true), array('action' => 'delete', $page['Page']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $page['Page']['id'])); ?>
+ link(__('List Pages', true), array('action' => 'index')); ?>
+ link(__('New Page', true), array('action' => 'add')); ?>
+
+
diff --git a/webroot/css/quotenik.css b/webroot/css/quotenik.css
index 4130fdba..b05abdeb 100755
--- a/webroot/css/quotenik.css
+++ b/webroot/css/quotenik.css
@@ -95,6 +95,12 @@ h3 {
h3#logo {
color: #FFFFFF;
}
+
+
+h3.pagenumber {
+ font-size: 120%;
+}
+
h4 {
color: #993;
font-weight: normal;
@@ -339,10 +345,12 @@ dl#showemail {
border: black 1px solid;
}
-div.quotepageview {
+div.pageview {
+
overflow: scroll;
- border: black 1px solid;
- width: 60%;
+ border: black 2px solid;
+ width: 21cm;
+ margin-bottom: 2em;
}
.addressradio label {