diff --git a/controllers/documents_controller.php b/controllers/documents_controller.php
index 4bec3a4f..c53ba0cf 100755
--- a/controllers/documents_controller.php
+++ b/controllers/documents_controller.php
@@ -436,6 +436,7 @@ class DocumentsController extends AppController {
$this->set('principlesList', $this->Document->LineItem->Product->Principle->find('list'));
$this->set('products', $document['LineItem']);
+ $this->set('states', $this->Document->Invoice->Enquiry->State->find('list'));
//Set filename for the document.
@@ -443,10 +444,13 @@ class DocumentsController extends AppController {
switch($docType) {
case "quote":
$filename = $enquiry['Enquiry']['title'];
+ $template_name = 'pdf_quote';
break;
case "invoice":
$filename = $document['Invoice']['title'];
+ $this->set('job', $this->Document->Invoice->Job->find('first', array('conditions'=>array('Job.id'=>$document['Invoice']['job_id']))));
+ $template_name = 'pdf_invoice';
break;
case "purchaseOrder":
@@ -487,6 +491,8 @@ class DocumentsController extends AppController {
);
$this->set('colWidths',$colWidths);
+
+ $this->render($template_name);
}
diff --git a/vendors/pdfdoc.php b/vendors/pdfdoc.php
index 7ee5b5a4..f29b9b83 100644
--- a/vendors/pdfdoc.php
+++ b/vendors/pdfdoc.php
@@ -92,7 +92,7 @@ ENDHTML;
}
-
+
/**
* For Quotes and (hopefully) Invoices. Identifies who the document is for, date, reference number, etc.
*/
@@ -101,7 +101,7 @@ ENDHTML;
$pageNo = $this->PageNoFormatted();
$totalCount = $this->getAliasNbPages();
-
+
$col1width = '20%';
$col2width = '30%';
$col3width = $col1width;
@@ -160,13 +160,14 @@ ENDTABLE;
}
+
function header() {
//$this->Image(K_PATH_IMAGES.'cmclogosmall.jpg', 10, 10, 15, 13.6, null, 'http://www.cmctechnologies.com.au', null, false, null, 'L');
$this->SetFontSize(10);
$pageNo = $this->PageNoFormatted();
$totalCount = $this->getAliasNbPages();
-
+
//$currentX = $this->GetX();
diff --git a/views/documents/pdf_invoice.ctp b/views/documents/pdf_invoice.ctp
new file mode 100644
index 00000000..f0bdecd0
--- /dev/null
+++ b/views/documents/pdf_invoice.ctp
@@ -0,0 +1,73 @@
+SetPrintHeader(false);
+$pdfdoc->SetPrintFooter(false);
+
+
+$pdfdoc->AddPage();
+$pdfdoc->Page1Header();
+
+$pageTitle = "
TAX INVOICE ";
+$pdfdoc->writeHTML($pageTitle, true, false, false, false, 'C');
+
+$pdfdoc->SetTextColor(0);
+$shippingBillingBox = $this->element('pdf_shipping_billing_box');
+
+$pdfdoc->writeHTML($shippingBillingBox, false);
+
+$LineItemTable = $this->element('line_items_table');
+$pdfdoc->SetPrintHeader(true);
+
+$pdfdoc->pageContent($LineItemTable);
+$pdfdoc->lastPage();
+
+if($docType == 'quote') {
+
+ $commercialComments = ''.$document['Quote']['commercial_comments'].'
';
+ $pdfdoc->pageContent($commercialComments);
+}
+
+
+$output_dir = '/Users/karlcordes/Sites/quotenik/app/webroot/pdf/';
+
+$debuglevel = Configure::read('debug');
+
+if($debuglevel == 0) {
+ $output_dir = '/var/www/cakephp/app/webroot/pdf/';
+}
+
+
+$pdfdoc->Output($output_dir.$filename, 'F');
+
+echo " Wrote: ".$output_dir.$filename;
+
+App::import('Vendor', 'xfpdi');
+
+
+//$newpdf = new concat_pdf();
+
+$newpdf = new XFPDI();
+
+$newpdf->SetMargins(2, 2);
+$newpdf->setPrintHeader(false);
+$newpdf->setPrintFooter(false);
+
+$newpdf->setFiles(array($output_dir.$filename, $output_dir.'CMC_terms_and_conditions2006_A4.pdf'));
+$newpdf->concat();
+$newpdf->Output($output_dir.$filename, "F");
+//$pdfdoc->Output($output_dir = '/Users/karlcordes/Sites/quotenik/app/webroot/pdf/'.'example_060.pdf', 'F');
+
+//echo $html->link($filename, '/pdf/'.$filename);
+
+?>
+
+
+
+
+ debug($job); ?>
+ //debug($enquiry); ?>
\ No newline at end of file
diff --git a/views/documents/pdf_order_ack.ctp b/views/documents/pdf_order_ack.ctp
new file mode 100644
index 00000000..e69de29b
diff --git a/views/documents/pdf.ctp b/views/documents/pdf_quote.ctp
similarity index 99%
rename from views/documents/pdf.ctp
rename to views/documents/pdf_quote.ctp
index 58ba8950..73a4db2f 100755
--- a/views/documents/pdf.ctp
+++ b/views/documents/pdf_quote.ctp
@@ -9,7 +9,6 @@ $pdfdoc->SetPrintFooter(false);
$firstPageDone = false;
-
$companyName = $enquiry['Customer']['name'];
$emailTo = $enquiry['Contact']['email'];
$attention = $enquiry['Contact']['first_name'].' '.$enquiry['Contact']['last_name'];
diff --git a/views/elements/document_invoice_view.ctp b/views/elements/document_invoice_view.ctp
index f0f76a64..280ee8c5 100644
--- a/views/elements/document_invoice_view.ctp
+++ b/views/elements/document_invoice_view.ctp
@@ -8,9 +8,9 @@ echo $form->input('Document.id');
(re)Generate First Page
- Add Content Page
- View/Edit Quote Details
- =$html->link('Generate PDF of this Quote', '/documents/pdf/'.$document['Document']['id']);?>
+
+ View/Edit Invoice Details
+ =$html->link('Generate PDF of this Invoice', '/documents/pdf/'.$document['Document']['id']);?>
diff --git a/views/elements/line_items_table.ctp b/views/elements/line_items_table.ctp
index c342cf7a..d94b8afb 100644
--- a/views/elements/line_items_table.ctp
+++ b/views/elements/line_items_table.ctp
@@ -55,6 +55,9 @@
+
+
+
@@ -102,5 +105,5 @@
}
?>
-
+
diff --git a/views/elements/pdf_document_data_payment.ctp b/views/elements/pdf_document_data_payment.ctp
new file mode 100644
index 00000000..e69de29b
diff --git a/views/elements/pdf_shipping_billing_box.ctp b/views/elements/pdf_shipping_billing_box.ctp
new file mode 100644
index 00000000..964e9f84
--- /dev/null
+++ b/views/elements/pdf_shipping_billing_box.ctp
@@ -0,0 +1,57 @@
+
+$col1width = '30%';
+$col2width = '30%';
+$col3width = '30%';
+
+?>
+
+
+ BILL TO:
+ SHIP TO:
+
+
+ CMC INVOICE#: CMCIN4745
+ Date: =$document['Invoice']['issue_date'];?>
+ MAKE PAYMENT TO:
+ Account Name: CMC Technologies Pty Ltd
+ Bank Number BSB#: 062-458
+ Account Number: 10067982
+ SWIFT Code: CTBAAU2S
+
+
+
+
+
+ =$enquiry['BillingAddress']['address'];?>
+ =$enquiry['BillingAddress']['city'];?>
+ =$enquiry['BillingAddress']['postcode'];?>
+ =strtoupper($states[$enquiry['BillingAddress']['state_id']]);?>
+
+
+ =$enquiry['ShippingAddress']['address'];?>
+ =$enquiry['ShippingAddress']['city'];?>
+ =$enquiry['ShippingAddress']['postcode'];?>
+ =strtoupper($states[$enquiry['ShippingAddress']['state_id']]);?>
+
+
+
+
+
+
+ $moreDetailsFont = '9pt'; ?>
+ CUSTOMER ORDER NO
+ CMC JOB #
+ FOB
+ SHIP VIA
+ TERMS
+ CUSTOMER ABN
+
+
+ =$job['Job']['customer_order_number'];?>
+ =$job['Job']['title'];?>
+ ??
+ ??
+ =$job['Customer']['payment_terms'];?>
+ =$this->element('abn', array('abn'=>$job['Customer']['abn']));?>
+
+
\ No newline at end of file