Finally got the damned hackish not-costing Line Items done.
This commit is contained in:
parent
e7a6c9ebfc
commit
616f09abe2
|
|
@ -212,13 +212,13 @@ class QuotesController extends AppController {
|
|||
$enquiry = $this->Quote->Enquiry->find('first', array('conditions' => array('Enquiry.id' => $quote['Quote']['enquiry_id'])));
|
||||
|
||||
|
||||
$quoteProducts = $this->Quote->LineItem->find('all', array('recursive' => 0, 'conditions' => array('LineItem.quote_id' => $id),
|
||||
$quoteProducts = $this->Quote->LineItem->find('all', array('recursive' => 1, 'conditions' => array('LineItem.quote_id' => $id),
|
||||
'order' => array('LineItem.item_number ASC'))
|
||||
);
|
||||
|
||||
$user = $this->Quote->Enquiry->User->find('first', array('conditions' => array('User.id' => $enquiry['Enquiry']['user_id'])));
|
||||
|
||||
$this->set('principlesList', $this->Quote->Enquiry->Principle->find('list'));
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ class LineItem extends AppModel {
|
|||
'order' => ''
|
||||
),
|
||||
|
||||
'Principle' => array('className' => 'Principle',
|
||||
'foreignKey' =>'principle_id')
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
|
|
|||
8
vendors/xtcpdf.php
vendored
8
vendors/xtcpdf.php
vendored
|
|
@ -190,7 +190,7 @@ class XTCPDF extends TCPDF {
|
|||
* @param <type> $docType
|
||||
* @param <type> $commercialDetails
|
||||
*/
|
||||
function calculateProductPage($principlesList, $currency,$gst, $products ,$docType, $commercialDetails) {
|
||||
function calculateProductPage($currency,$gst, $products ,$docType, $commercialDetails) {
|
||||
|
||||
$itemColwidth = 12;
|
||||
$qtyColwidth = 10;
|
||||
|
|
@ -290,7 +290,7 @@ class XTCPDF extends TCPDF {
|
|||
* @param String $docType - the model name of the Products we want to put in the table. ie. QuoteProduct, or InvoiceProduct, etc
|
||||
* @param Map $commercialDetails - the details array/map - passed to commercialComments()
|
||||
*/
|
||||
function productPage($principlesList, $currency,$gst, $products ,$docType, $commercialDetails, $pageProducts) {
|
||||
function productPage($currency,$gst, $products ,$docType, $commercialDetails, $pageProducts) {
|
||||
|
||||
|
||||
$this->SetFontSize(10);
|
||||
|
|
@ -314,7 +314,7 @@ class XTCPDF extends TCPDF {
|
|||
$options = 0; //Toggled to 1 when we encounter an Optional product. Stops the totals being printed.
|
||||
|
||||
echo "FUCK";
|
||||
print_r($principlesList);
|
||||
print_r($principlesList[0]);
|
||||
foreach ($pageProducts as $page) {
|
||||
|
||||
$this->AddPage();
|
||||
|
|
@ -357,7 +357,7 @@ class XTCPDF extends TCPDF {
|
|||
foreach($page as $productID) {
|
||||
$product = array_shift($products);
|
||||
|
||||
$fullDesc = "<b>".$principlesList[$product[$docType]['id']]."</b><br>"."<b>".$product[$docType]['title'].'</b><br>'.$product[$docType]['description'];
|
||||
$fullDesc = "<b>".$product['Principle']['name']."</b><br>"."<b>".$product[$docType]['title'].'</b><br>'.$product[$docType]['description'];
|
||||
|
||||
if($product[$docType]['option'] == 1) {
|
||||
$options = 1;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ $tcpdf->setPrintHeader(false);
|
|||
$tcpdf->setPrintFooter(false);
|
||||
|
||||
|
||||
$pageProducts = $tcpdf->calculateProductPage($principle_name, $quote['Currency'],
|
||||
$pageProducts = $tcpdf->calculateProductPage($quote['Currency'],
|
||||
$enquiry['Enquiry']['gst'], $products, 'LineItem', $commercialDetails);
|
||||
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ foreach ($quote['QuotePage'] as $page) {
|
|||
|
||||
|
||||
|
||||
//print_r($products);
|
||||
print_r($products);
|
||||
|
||||
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ foreach ($quote['QuotePage'] as $page) {
|
|||
|
||||
|
||||
|
||||
$tcpdf->productPage($principlesList, $quote['Currency'], $enquiry['Enquiry']['gst'], $products, 'LineItem', $commercialDetails,
|
||||
$tcpdf->productPage($quote['Currency'], $enquiry['Enquiry']['gst'], $products, 'LineItem', $commercialDetails,
|
||||
$pageProducts);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -172,4 +172,4 @@ foreach ($quote['QuotePage'] as $quotePage):
|
|||
|
||||
<div id="mydebug"></div>
|
||||
|
||||
<? debug($principles); ?>
|
||||
<? debug($quoteProducts); ?>
|
||||
|
|
@ -64,7 +64,7 @@ $(function() {
|
|||
.button()
|
||||
.click(function() {
|
||||
$.post("/quotes/ajaxpdf",quoteID, function(data) {
|
||||
alert(data);
|
||||
$('#mydebug').html(data);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue