Gotta refactor xtcpdf because of stupid spec changes. Need to turn on recursion which changes the datastructure format of the Products.. .GHUweghwegw
This commit is contained in:
parent
241724b8a3
commit
e7a6c9ebfc
|
|
@ -27,11 +27,24 @@ class CostingsController extends AppController {
|
||||||
$this->Session->setFlash(__('The Costing could not be saved. Please, try again.', true));
|
$this->Session->setFlash(__('The Costing could not be saved. Please, try again.', true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$products = $this->Costing->Product->find('list');
|
if(isset($this->params['named']['productid'])) {
|
||||||
$lineItems = $this->Costing->LineItem->find('list');
|
$product = $this->Costing->Product->findById($this->params['named']['productid']);
|
||||||
|
|
||||||
|
$this->set('product', $product);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($this->params['named']['lineitemid'])) {
|
||||||
|
$line_item = $this->Costing->LineItem->findById($this->params['named']['lineitem']);
|
||||||
|
|
||||||
|
$this->set('line_item', $line_item);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$purchaseCurrencies = $this->Costing->PurchaseCurrency->find('list');
|
$purchaseCurrencies = $this->Costing->PurchaseCurrency->find('list');
|
||||||
$saleCurrencies = $this->Costing->SaleCurrency->find('list');
|
$saleCurrencies = $this->Costing->SaleCurrency->find('list');
|
||||||
$this->set(compact('products', 'lineItems', 'purchaseCurrencies', 'saleCurrencies'));
|
$this->set(compact('purchaseCurrencies', 'saleCurrencies'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function edit($id = null) {
|
function edit($id = null) {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ class PrinciplesController extends AppController {
|
||||||
|
|
||||||
var $paginate = array(
|
var $paginate = array(
|
||||||
'Principle' => array('limit' => 50, 'order' => array('Principle.name' => 'asc')),
|
'Principle' => array('limit' => 50, 'order' => array('Principle.name' => 'asc')),
|
||||||
'Enquiry' => array('limit' => 200, 'order' => array('Enquiry.id' => 'desc'))
|
'Enquiry' => array('limit' => 150, 'order' => array('Enquiry.id' => 'desc'))
|
||||||
);
|
);
|
||||||
|
|
||||||
function index() {
|
function index() {
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ class QuotesController extends AppController {
|
||||||
$this->set('quote', $quote);
|
$this->set('quote', $quote);
|
||||||
$this->set('enquiry', $enquiry);
|
$this->set('enquiry', $enquiry);
|
||||||
|
|
||||||
|
$this->set('principlesList', $this->Quote->Enquiry->Principle->find('list'));
|
||||||
|
|
||||||
$this->set('products', $quoteProducts);
|
$this->set('products', $quoteProducts);
|
||||||
|
|
||||||
|
|
@ -218,7 +218,7 @@ class QuotesController extends AppController {
|
||||||
|
|
||||||
$user = $this->Quote->Enquiry->User->find('first', array('conditions' => array('User.id' => $enquiry['Enquiry']['user_id'])));
|
$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'));
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -284,66 +284,6 @@ class QuotesController extends AppController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function BROKENajaxpdf() {
|
|
||||||
Configure::write('debug',0);
|
|
||||||
|
|
||||||
if($this->RequestHandler->isAjax()) {
|
|
||||||
|
|
||||||
$quoteid = $this->data['Quote']['id'];
|
|
||||||
$quote = $this->Quote->findById($quoteid);
|
|
||||||
|
|
||||||
//$customer = $this->Quote->Enquiry->Customer->read(null, $quote['Enquiry']['customer_id']);
|
|
||||||
$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),
|
|
||||||
'order' => array('LineItem.item_number ASC'))
|
|
||||||
);
|
|
||||||
|
|
||||||
$user = $this->Quote->Enquiry->User->find('first', array('conditions' => array('User.id' => $enquiry['Enquiry']['user_id'])));
|
|
||||||
|
|
||||||
if($enquiry['Enquiry']['gst'] == 1) {
|
|
||||||
$gstPhrase = "10% EXTRA";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$gstPhrase = "Not Applicable for Export";
|
|
||||||
}
|
|
||||||
|
|
||||||
$commercialDetails = array (
|
|
||||||
'deliveryTime' => strtoupper($quote['Quote']['delivery_time']),
|
|
||||||
'paymentTerms' => strtoupper($quote['Quote']['payment_terms']),
|
|
||||||
'dateIssued' => $quote['Quote']['date_issued'],
|
|
||||||
'validFor' => $quote['Quote']['days_valid'],
|
|
||||||
'deliveryPoint' => strtoupper($quote['Quote']['delivery_point']),
|
|
||||||
'exchangeRate' => strtoupper($quote['Quote']['exchange_rate']),
|
|
||||||
'customsDuty' => strtoupper($quote['Quote']['customs_duty']),
|
|
||||||
'gst' => strtoupper($gstPhrase),
|
|
||||||
'salesEngineer' => strtoupper($user['User']['first_name'].' '.$user['User']['last_name'])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->set('commercialDetails', $commercialDetails);
|
|
||||||
|
|
||||||
//debug($quote);
|
|
||||||
//debug($commercialDetails);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->set('quote', $quote);
|
|
||||||
$this->set('enquiry', $enquiry);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->set('products', $quoteProducts);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
19
vendors/shells/vault.php
vendored
19
vendors/shells/vault.php
vendored
|
|
@ -49,7 +49,7 @@ class VaultShell extends Shell {
|
||||||
//echo "Checking msg number: $i \tSubject: ".$message['subject']."\n";
|
//echo "Checking msg number: $i \tSubject: ".$message['subject']."\n";
|
||||||
$enquiry = $this->checkIfValidEnquiry($message['subject'], $testing);
|
$enquiry = $this->checkIfValidEnquiry($message['subject'], $testing);
|
||||||
if($enquiry) {
|
if($enquiry) {
|
||||||
echo "Found Enquiry number: ".$enquiry['Enquiry']['title']." Processing.\n";
|
//echo "Found Enquiry number: ".$enquiry['Enquiry']['title']." Processing.\n";
|
||||||
//Process it and store the message and its attachments.
|
//Process it and store the message and its attachments.
|
||||||
|
|
||||||
//Generate a Uniqid for this email.
|
//Generate a Uniqid for this email.
|
||||||
|
|
@ -127,16 +127,11 @@ class VaultShell extends Shell {
|
||||||
}
|
}
|
||||||
echo "Email stored in the DB under enquiry ".$enquiry['Enquiry']['title']." Will be moved to the stored folder\n";
|
echo "Email stored in the DB under enquiry ".$enquiry['Enquiry']['title']." Will be moved to the stored folder\n";
|
||||||
|
|
||||||
$stored_msgs[] = imap_uid($mbox,$i);
|
//$stored_msgs[] = imap_uid($mbox,$i);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// if($attachments != 1) {
|
|
||||||
// $this->clearEmailAttachmentDirs($email_dir, $temp_filename, $attachments);
|
|
||||||
//unlink($email_dir.'/'.$temp_filename); #remove the temp email. start again
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
if($testing == 0) {
|
||||||
|
imap_mail_move($mbox, $no, 'INBOX/Stored');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -166,7 +161,7 @@ class VaultShell extends Shell {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(isset($stored_msgs)) {
|
/* if(isset($stored_msgs)) {
|
||||||
|
|
||||||
foreach($stored_msgs as $msg) {
|
foreach($stored_msgs as $msg) {
|
||||||
$no = imap_msgno($mbox,$msg);
|
$no = imap_msgno($mbox,$msg);
|
||||||
|
|
@ -190,6 +185,8 @@ class VaultShell extends Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
* */
|
||||||
|
|
||||||
/* Finished working with the IMAP server. Make the changes and close the connection */
|
/* Finished working with the IMAP server. Make the changes and close the connection */
|
||||||
imap_expunge($mbox);
|
imap_expunge($mbox);
|
||||||
imap_close($mbox);
|
imap_close($mbox);
|
||||||
|
|
|
||||||
143
vendors/xtcpdf.php
vendored
143
vendors/xtcpdf.php
vendored
|
|
@ -179,85 +179,6 @@ class XTCPDF extends TCPDF {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Product Pages, made using writeHTML Cell.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param <type> $principleName
|
|
||||||
* @param <type> $currency
|
|
||||||
* @param <type> $gst
|
|
||||||
* @param <type> $products
|
|
||||||
* @param <type> $docType
|
|
||||||
* @param <type> $commercialDetails
|
|
||||||
*/
|
|
||||||
function productPageHTML($principleName, $currency,$gst, $products ,$docType, $commercialDetails) {
|
|
||||||
$this->SetAutoPageBreak(true, 20);
|
|
||||||
$this->setPrintHeader(true);
|
|
||||||
$this->SetTopMargin(20);
|
|
||||||
$this->AddPage();
|
|
||||||
|
|
||||||
$currencyISOcode = $currency['iso4217'];
|
|
||||||
|
|
||||||
$item_width = 40;
|
|
||||||
$qty_width = 40;
|
|
||||||
$desc_width = 340;
|
|
||||||
$unitprice_width = 60;
|
|
||||||
$totalprice_width = 60;
|
|
||||||
|
|
||||||
|
|
||||||
$tbl = <<<EOD
|
|
||||||
<table align="center" border="1" cellspacing="0" cellpadding="2">
|
|
||||||
<thead>
|
|
||||||
<tr style="background-color:#F2F2F2;">
|
|
||||||
<td width="$item_width" align="center"><b>ITEM NO.</b></td>
|
|
||||||
<td width="$qty_width" align="center"><b>QTY</b></td>
|
|
||||||
<td width="$desc_width" align="center"><b>DESCRIPTION</b></td>
|
|
||||||
<td width="$unitprice_width" align="center"> <b>UNIT PRICE</b></td>
|
|
||||||
<td width="$totalprice_width" align="center"><b>TOTAL PRICE</b></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr style="background-color:#F2F2F2;">
|
|
||||||
<td width="$item_width" align="center"></td>
|
|
||||||
<td width="$qty_width" align="center"></td>
|
|
||||||
<td width="$desc_width" align="center"></td>
|
|
||||||
<td width="$unitprice_width" align="center"> <b>$currencyISOcode</b></td>
|
|
||||||
<td width="$totalprice_width" align="center"><b>$currencyISOcode</b></td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
EOD;
|
|
||||||
|
|
||||||
|
|
||||||
foreach ($products as $product) {
|
|
||||||
$fullDesc = "<b>".$product[$docType]['title'].'</b><br />'.$product[$docType]['description'];
|
|
||||||
// echo $fullDesc;
|
|
||||||
$itemno = number_format($product[$docType]['item_number'], 1, '.', '');
|
|
||||||
$qty = $product[$docType]['quantity'];
|
|
||||||
|
|
||||||
$unit_price = $this->formatCurrency($currency['symbol'], $product[$docType]['unit_price']);
|
|
||||||
$thisTotalPrice = $product[$docType]['quantity']*$product[$docType]['unit_price'];
|
|
||||||
$total_price = $this->formatCurrency($currency['symbol'],$thisTotalPrice);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$tbl .= <<<ENDPRODUCT
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td width="$item_width" align="center">$itemno</td>
|
|
||||||
<td width="$qty_width" align="center">$qty</td>
|
|
||||||
<td width="$desc_width" align="left">$fullDesc</td>
|
|
||||||
<td width="$unitprice_width" align="center">$unit_price</td>
|
|
||||||
<td width="$totalprice_width" align="center">$total_price</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
ENDPRODUCT;
|
|
||||||
}
|
|
||||||
$tbl .= "</table>";
|
|
||||||
|
|
||||||
$this->writeHTML($tbl, true, false, false, false, "");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -269,7 +190,7 @@ ENDPRODUCT;
|
||||||
* @param <type> $docType
|
* @param <type> $docType
|
||||||
* @param <type> $commercialDetails
|
* @param <type> $commercialDetails
|
||||||
*/
|
*/
|
||||||
function calculateProductPage($principleName, $currency,$gst, $products ,$docType, $commercialDetails) {
|
function calculateProductPage($principlesList, $currency,$gst, $products ,$docType, $commercialDetails) {
|
||||||
|
|
||||||
$itemColwidth = 12;
|
$itemColwidth = 12;
|
||||||
$qtyColwidth = 10;
|
$qtyColwidth = 10;
|
||||||
|
|
@ -289,7 +210,7 @@ ENDPRODUCT;
|
||||||
|
|
||||||
$this->startTransaction();
|
$this->startTransaction();
|
||||||
|
|
||||||
$fullDesc = "<b>".$product[$docType]['title'].'GG</b><br>'.$product[$docType]['description'];
|
$fullDesc = "<b>".$principlesList[$product[$docType]['principle_id']]."</b><br>"."<b>".$product[$docType]['title'].'</b><br>'.$product[$docType]['description'];
|
||||||
$this->MultiCell($descColwidth, 0, $fullDesc, 1, "L", 0, 0, null, null, true, 0, true);
|
$this->MultiCell($descColwidth, 0, $fullDesc, 1, "L", 0, 0, null, null, true, 0, true);
|
||||||
|
|
||||||
$lasth = $this->getLastH();
|
$lasth = $this->getLastH();
|
||||||
|
|
@ -298,18 +219,18 @@ ENDPRODUCT;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo $product[$docType]['id']." needs ".$lasth." has $heightLeft left<br>";
|
//echo $product[$docType]['id']." needs ".$lasth." has $heightLeft left<br>";
|
||||||
|
|
||||||
$itemno = $product[$docType]['item_number'];
|
$itemno = $product[$docType]['item_number'];
|
||||||
|
|
||||||
if($heightLeft - $lasth <= 0) {
|
if($heightLeft - $lasth <= 0) {
|
||||||
echo "<br>OUT OF SPACE ON PAGE $pagesRequired making a new one<br>";
|
// echo "<br>OUT OF SPACE ON PAGE $pagesRequired making a new one<br>";
|
||||||
$pagesRequired++;
|
$pagesRequired++;
|
||||||
$heightLeft = $availableHeight; //Start checking the next page;
|
$heightLeft = $availableHeight; //Start checking the next page;
|
||||||
echo "<br>remaining height on new one = ".$heightLeft."<br>";
|
// echo "<br>remaining height on new one = ".$heightLeft."<br>";
|
||||||
$heightLeft -= $lasth;
|
$heightLeft -= $lasth;
|
||||||
$itemno = $product[$docType]['item_number'];
|
$itemno = $product[$docType]['item_number'];
|
||||||
echo "<br>Using $lasth for $itemno so now have $heightLeft left<br>";
|
// echo "<br>Using $lasth for $itemno so now have $heightLeft left<br>";
|
||||||
|
|
||||||
$pageProducts[$pagesRequired][] = $product[$docType]['id'];
|
$pageProducts[$pagesRequired][] = $product[$docType]['id'];
|
||||||
|
|
||||||
|
|
@ -336,12 +257,12 @@ ENDPRODUCT;
|
||||||
|
|
||||||
$this->rollbackTransaction($this);
|
$this->rollbackTransaction($this);
|
||||||
|
|
||||||
echo "Currently have $heightLeft Comm details height is ".$commDetailsHeight." totals height is: ".$totalsHeight."<br>";
|
//echo "Currently have $heightLeft Comm details height is ".$commDetailsHeight." totals height is: ".$totalsHeight."<br>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($heightLeft - $totalsHeight <= 0) {
|
if($heightLeft - $totalsHeight <= 0) {
|
||||||
echo "<br>Need a new page for last item and totals";
|
// echo "<br>Need a new page for last item and totals";
|
||||||
array_pop($pageProducts[$pagesRequired]);
|
array_pop($pageProducts[$pagesRequired]);
|
||||||
$pagesRequired++;
|
$pagesRequired++;
|
||||||
$heightLeft = $availableHeight;
|
$heightLeft = $availableHeight;
|
||||||
|
|
@ -361,14 +282,15 @@ ENDPRODUCT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param <type> $principleName
|
* @param Map $principles - list of principles. A hack so we can show a products principle name on it, without rewriting
|
||||||
|
* lots of code.
|
||||||
* @param <type> $currency
|
* @param <type> $currency
|
||||||
* @param int $gst - 0 or 1 if GST is applicable.
|
* @param int $gst - 0 or 1 if GST is applicable.
|
||||||
* @param <type> $products
|
* @param <type> $products
|
||||||
* @param String $docType - the model name of the Products we want to put in the table. ie. QuoteProduct, or InvoiceProduct, etc
|
* @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()
|
* @param Map $commercialDetails - the details array/map - passed to commercialComments()
|
||||||
*/
|
*/
|
||||||
function productPage($principleName, $currency,$gst, $products ,$docType, $commercialDetails, $pageProducts) {
|
function productPage($principlesList, $currency,$gst, $products ,$docType, $commercialDetails, $pageProducts) {
|
||||||
|
|
||||||
|
|
||||||
$this->SetFontSize(10);
|
$this->SetFontSize(10);
|
||||||
|
|
@ -391,8 +313,8 @@ ENDPRODUCT;
|
||||||
|
|
||||||
$options = 0; //Toggled to 1 when we encounter an Optional product. Stops the totals being printed.
|
$options = 0; //Toggled to 1 when we encounter an Optional product. Stops the totals being printed.
|
||||||
|
|
||||||
print_r($pageProducts);
|
echo "FUCK";
|
||||||
// print_r($products);
|
print_r($principlesList);
|
||||||
foreach ($pageProducts as $page) {
|
foreach ($pageProducts as $page) {
|
||||||
|
|
||||||
$this->AddPage();
|
$this->AddPage();
|
||||||
|
|
@ -435,7 +357,7 @@ ENDPRODUCT;
|
||||||
foreach($page as $productID) {
|
foreach($page as $productID) {
|
||||||
$product = array_shift($products);
|
$product = array_shift($products);
|
||||||
|
|
||||||
$fullDesc = "<b>".$product['Principle']['name']."</b><br>"."<b>".$product[$docType]['title'].'</b><br>'.$product[$docType]['description'];
|
$fullDesc = "<b>".$principlesList[$product[$docType]['id']]."</b><br>"."<b>".$product[$docType]['title'].'</b><br>'.$product[$docType]['description'];
|
||||||
|
|
||||||
if($product[$docType]['option'] == 1) {
|
if($product[$docType]['option'] == 1) {
|
||||||
$options = 1;
|
$options = 1;
|
||||||
|
|
@ -456,13 +378,40 @@ ENDPRODUCT;
|
||||||
|
|
||||||
$this->SetX($endOfDesc);
|
$this->SetX($endOfDesc);
|
||||||
|
|
||||||
$this->MultiCell($unitpriceColwidth, $heightNeeded, $this->formatCurrency($currency['symbol'], $product[$docType]['unit_price']), 1, "C", 0, 0);
|
if($product[$docType]['discount_percent'] != 0) {
|
||||||
$thisTotalPrice = $product[$docType]['quantity']*$product[$docType]['unit_price'];
|
|
||||||
$this->MultiCell($totalPricColwidth, $heightNeeded, $this->formatCurrency($currency['symbol'],$thisTotalPrice), 1, "C", 0, 1);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$subTotal += $thisTotalPrice;
|
|
||||||
|
$unitPriceString = $this->formatCurrency($currency['symbol'], $product[$docType]['unit_price']);
|
||||||
|
$unitPriceString .= "<br>less ".$product[$docType]['discount_percent']."% discount<br>(-"
|
||||||
|
.$this->formatCurrency($currency['symbol'], $product[$docType]['discount_amount_each']).")<br>=<br>";
|
||||||
|
$unitPriceString .= $this->formatCurrency($currency['symbol'], $product[$docType]['net_price_each']);
|
||||||
|
|
||||||
|
$totalPriceString = $this->formatCurrency($currency['symbol'], $product[$docType]['gross_price']);
|
||||||
|
$totalPriceString .= "<br>less ".$product[$docType]['discount_percent']."% discount<br>(-"
|
||||||
|
.$this->formatCurrency($currency['symbol'], $product[$docType]['total_discount_amount']).")<br>=<br>";
|
||||||
|
$totalPriceString .= $this->formatCurrency($currency['symbol'], $product[$docType]['net_price']);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$unitPriceString = $this->formatCurrency($currency['symbol'], $product[$docType]['unit_price']);
|
||||||
|
$totalPriceString = $this->formatCurrency($currency['symbol'], $product[$docType]['net_price']);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Unit Price Column
|
||||||
|
$this->MultiCell($unitpriceColwidth, $heightNeeded, $unitPriceString , 1, "C", 0, 0, null, null, true, 0, true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Net Price Column
|
||||||
|
$this->MultiCell($totalPricColwidth, $heightNeeded, $totalPriceString, 1, "C", 0, 1, null, null, true, 0, true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$subTotal += $product[$docType]['net_price'];
|
||||||
$lastY = $this->GetY();
|
$lastY = $this->GetY();
|
||||||
$lastX = $this->GetX();
|
$lastX = $this->GetX();
|
||||||
//echo $product[$docType]['item_number']." Last X is $lastX, Last Y is $lastY <br>";
|
//echo $product[$docType]['item_number']." Last X is $lastX, Last Y is $lastY <br>";
|
||||||
|
|
@ -610,7 +559,7 @@ ENDHTMLCONTENTS;
|
||||||
$totalPricColwidth = -10;
|
$totalPricColwidth = -10;
|
||||||
$totalHeight = 0;
|
$totalHeight = 0;
|
||||||
|
|
||||||
echo "desc col wdith : ".$descColwidth;
|
// echo "desc col wdith : ".$descColwidth;
|
||||||
$this->MultiCell($itemColwidth, 6, "", 1, 'C', 0, 0);
|
$this->MultiCell($itemColwidth, 6, "", 1, 'C', 0, 0);
|
||||||
$totalHeight += $this->getLastH();
|
$totalHeight += $this->getLastH();
|
||||||
$this->MultiCell($qtyColwidth, 6, "", 1, 'C', 0, 0);
|
$this->MultiCell($qtyColwidth, 6, "", 1, 'C', 0, 0);
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,21 @@
|
||||||
<div class="costings form">
|
<div class="costings form">
|
||||||
<?php echo $form->create('Costing', array('class'=>'cmxform'));?>
|
<?php echo $form->create('Costing', array('class'=>'cmxform'));?>
|
||||||
|
|
||||||
<?php __('Add Costing');?>
|
<?php if(isset($product)) {
|
||||||
|
$form->input('product_id', array('type'=>'hidden', 'value'=>$product['Product']['id']));
|
||||||
|
}
|
||||||
|
|
||||||
|
elseif(isset($line_item)) {
|
||||||
|
$form->input('line_item_id', array('type'=>'hidden', 'value'=>$line_item['LineItem']['id']));
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php __('Add Costing to');?>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Quantity, Unit price, Packing costs</legend>
|
<legend>Quantity, Unit price, Packing costs</legend>
|
||||||
<?php
|
<?php
|
||||||
echo $form->input('product_id');
|
|
||||||
echo $form->input('line_item_id');
|
|
||||||
echo $form->input('purchase_currency_id');
|
echo $form->input('purchase_currency_id');
|
||||||
echo $form->input('sale_currency_id', array('default'=>2));
|
echo $form->input('sale_currency_id', array('default'=>2));
|
||||||
echo $form->input('quantity');
|
echo $form->input('quantity');
|
||||||
|
|
@ -81,7 +90,6 @@
|
||||||
<?
|
<?
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</fieldset>
|
|
||||||
<?php
|
<?php
|
||||||
echo $form->input('duty_amount', array('type'=>'hidden'));
|
echo $form->input('duty_amount', array('type'=>'hidden'));
|
||||||
echo $form->input('finance_amount', array('type'=>'hidden'));
|
echo $form->input('finance_amount', array('type'=>'hidden'));
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<h3><?php __($quote['Quote']['line_item_count'].' Items in this Quote');?></h3>
|
<h3><?php __($quote['Quote']['line_item_count'].' Items in this Quote');?></h3>
|
||||||
<table cellpadding = "0" cellspacing = "0" id= "quoteTable" class="quoteproducts" ">
|
<table cellpadding = "0" cellspacing = "0" id= "quoteTable" class="quoteproducts" ">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
$subTotal = 0;
|
$subTotal = 0;
|
||||||
|
|
||||||
foreach ($lineItems as $lineItem) {
|
foreach ($lineItems as $lineItem) {
|
||||||
$thisNetPrice = $lineItem['LineItem']['unit_price']*$lineItem['LineItem']['quantity'];
|
$thisNetPrice = $lineItem['LineItem']['net_price'];
|
||||||
|
|
||||||
$subTotal += $thisNetPrice;
|
$subTotal += $thisNetPrice;
|
||||||
|
|
||||||
|
|
@ -129,14 +129,21 @@
|
||||||
<td class="leftAlign"><?php echo $lineItem['LineItem']['description'];?></td>
|
<td class="leftAlign"><?php echo $lineItem['LineItem']['description'];?></td>
|
||||||
|
|
||||||
<td><?php echo $quote['Currency']['symbol'].$lineItem['LineItem']['unit_price'];
|
<td><?php echo $quote['Currency']['symbol'].$lineItem['LineItem']['unit_price'];
|
||||||
|
|
||||||
|
//If there's a costing, or a discount. Show it.
|
||||||
|
|
||||||
|
|
||||||
|
if($lineItem['LineItem']['discount_percent']) {
|
||||||
|
echo "<br>less ".$lineItem['LineItem']['discount_percent']."% discount (-".
|
||||||
|
$quote['Currency']['symbol'].$lineItem['LineItem']['discount_amount_each'].")<br>";
|
||||||
|
echo "=<br>".$quote['Currency']['symbol'].$lineItem['LineItem']['net_price_each'];
|
||||||
|
}
|
||||||
|
|
||||||
?></td>
|
?></td>
|
||||||
<td class="netPrice"><?php
|
<td class="netPrice"><?php
|
||||||
|
|
||||||
$thisNetPrice = $lineItem['LineItem']['unit_price']*$lineItem['LineItem']['quantity'];
|
|
||||||
|
|
||||||
$subTotal += $thisNetPrice;
|
echo $quote['Currency']['symbol'].$lineItem['LineItem']['net_price']; ?></td>
|
||||||
|
|
||||||
echo $quote['Currency']['symbol'].$thisNetPrice; ?></td>
|
|
||||||
|
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
<?php echo $html->link(__('View', true), array('controller'=> 'line_items', 'action'=>'view', $lineItem['LineItem']['id'])); ?>
|
<?php echo $html->link(__('View', true), array('controller'=> 'line_items', 'action'=>'view', $lineItem['LineItem']['id'])); ?>
|
||||||
|
|
@ -148,4 +155,4 @@
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
@ -36,7 +36,9 @@
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<ul>
|
<ul>
|
||||||
<li><?php echo $html->link(__('Edit Product', true), array('action'=>'edit', $product['Product']['id'])); ?> </li>
|
<li><?php echo $html->link(__('Edit Product', true), array('action'=>'edit', $product['Product']['id'])); ?> </li>
|
||||||
|
<li><?php echo $html->link(__('Add Costing', true), array('controller'=>'costings', 'action'=>'add/productid:'.$product['Product']['id']));?></li>
|
||||||
|
|
||||||
|
<button id="addCostingDialog"></button>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -103,6 +105,12 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="costingdiv"></div>
|
||||||
|
|
||||||
|
|
||||||
<?php debug($product); ?>
|
<?php debug($product); ?>
|
||||||
|
|
||||||
<?php debug($options); ?>
|
<?php debug($options); ?>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ $tcpdf->SetHeaderMargin(2);
|
||||||
$tcpdf->setPrintHeader(false);
|
$tcpdf->setPrintHeader(false);
|
||||||
$tcpdf->setPrintFooter(false);
|
$tcpdf->setPrintFooter(false);
|
||||||
|
|
||||||
$principle_name = strtoupper($enquiry['Principle']['name']);
|
|
||||||
$pageProducts = $tcpdf->calculateProductPage($principle_name, $quote['Currency'],
|
$pageProducts = $tcpdf->calculateProductPage($principle_name, $quote['Currency'],
|
||||||
$enquiry['Enquiry']['gst'], $products, 'LineItem', $commercialDetails);
|
$enquiry['Enquiry']['gst'], $products, 'LineItem', $commercialDetails);
|
||||||
|
|
||||||
|
|
@ -100,7 +100,7 @@ foreach ($quote['QuotePage'] as $page) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$tcpdf->productPage($principle_name, $quote['Currency'], $enquiry['Enquiry']['gst'], $products, 'LineItem', $commercialDetails,
|
$tcpdf->productPage($principlesList, $quote['Currency'], $enquiry['Enquiry']['gst'], $products, 'LineItem', $commercialDetails,
|
||||||
$pageProducts);
|
$pageProducts);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@ $tcpdf->SetHeaderMargin(2);
|
||||||
$tcpdf->setPrintHeader(false);
|
$tcpdf->setPrintHeader(false);
|
||||||
$tcpdf->setPrintFooter(false);
|
$tcpdf->setPrintFooter(false);
|
||||||
|
|
||||||
$principle_name = strtoupper($enquiry['Principle']['name']);
|
|
||||||
$pageProducts = $tcpdf->calculateProductPage($principle_name, $quote['Currency'], $enquiry['Enquiry']['gst'], $products, 'LineItem', $commercialDetails);
|
$pageProducts = $tcpdf->calculateProductPage($principlesList, $quote['Currency'], $enquiry['Enquiry']['gst'], $products, 'LineItem', $commercialDetails);
|
||||||
|
|
||||||
|
|
||||||
$page1done = false; //Have we already made the first page? If so, don't show the CMC header/footer
|
$page1done = false; //Have we already made the first page? If so, don't show the CMC header/footer
|
||||||
|
|
@ -90,7 +90,7 @@ foreach ($quote['QuotePage'] as $page) {
|
||||||
|
|
||||||
|
|
||||||
//print_r($products);
|
//print_r($products);
|
||||||
|
print_r($principlesList);
|
||||||
|
|
||||||
|
|
||||||
//debug($commercialDetails);
|
//debug($commercialDetails);
|
||||||
|
|
@ -100,10 +100,11 @@ foreach ($quote['QuotePage'] as $page) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$tcpdf->productPage($principle_name, $quote['Currency'], $enquiry['Enquiry']['gst'], $products, 'LineItem', $commercialDetails,
|
$tcpdf->productPage($principlesList, $quote['Currency'], $enquiry['Enquiry']['gst'], $products, 'LineItem', $commercialDetails,
|
||||||
$pageProducts);
|
$pageProducts);
|
||||||
|
|
||||||
|
|
||||||
|
//print_r($products);
|
||||||
|
|
||||||
|
|
||||||
$output_dir = '/Users/karlcordes/Sites/quotenik/app/webroot/pdf/';
|
$output_dir = '/Users/karlcordes/Sites/quotenik/app/webroot/pdf/';
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<?php echo $javascript->link('addLineItem'); ?>
|
<?php echo $javascript->link('addLineItem'); ?>
|
||||||
|
<?php echo $javascript->link('lineItemPriceNoCosting'); ?>
|
||||||
|
|
||||||
<div class="quotes view">
|
<div class="quotes view">
|
||||||
<h2><?php
|
<h2><?php
|
||||||
|
|
@ -130,7 +131,7 @@ foreach ($quote['QuotePage'] as $quotePage):
|
||||||
echo $form->input('item_number');
|
echo $form->input('item_number');
|
||||||
echo $form->input('option', array('label'=>'Optional Item'));
|
echo $form->input('option', array('label'=>'Optional Item'));
|
||||||
|
|
||||||
echo $form->input('quantity');
|
echo $form->input('quantity', array('class'=>'nocostinput'));
|
||||||
echo $form->input('principle_id', array('options'=>$principles, 'empty' =>'Select the Principle for this Product'));
|
echo $form->input('principle_id', array('options'=>$principles, 'empty' =>'Select the Principle for this Product'));
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -140,11 +141,18 @@ foreach ($quote['QuotePage'] as $quotePage):
|
||||||
|
|
||||||
<div id="productOptionsBox"></div>
|
<div id="productOptionsBox"></div>
|
||||||
|
|
||||||
<? echo $form->input('unit_price', array('id'=>"unitPrice")); ?>
|
<? echo $form->input('unit_price', array('id'=>"unitPrice", 'div'=>'nocosting', 'class'=>'nocostinput')); ?>
|
||||||
|
<? echo $form->input('discount_percent', array('id'=>'discountPercent', 'div'=>'nocosting', 'class'=>'nocostinput'));
|
||||||
|
echo $form->input('discount_amount_each', array('id'=>'discountAmountEach', 'readonly'=>'readonly', 'div'=>'nocosting'));
|
||||||
|
echo $form->input('net_price_each', array('id'=>'net_price_each', 'readonly'=>'readonly', 'div'=>'nocosting'));
|
||||||
|
echo $form->input('total_discount_amount', array('id'=>'total_discountAmount', 'readonly'=>'readonly', 'div'=>'nocosting'));
|
||||||
|
echo $form->input('gross_price', array('id'=>'grossPrice', 'readonly'=>'readonly', 'div'=>'nocosting'));
|
||||||
|
echo $form->input('net_price', array('id'=>'netPrice', 'readonly'=>'readonly', 'div'=>'nocosting'));
|
||||||
|
?>
|
||||||
|
|
||||||
<div id="addLineItem-form2">
|
<div id="addLineItem-form2">
|
||||||
<?
|
<?
|
||||||
/*
|
/*
|
||||||
echo $form->input('title');
|
echo $form->input('title');
|
||||||
echo $form->input('description');
|
echo $form->input('description');
|
||||||
|
|
||||||
|
|
@ -163,3 +171,5 @@ foreach ($quote['QuotePage'] as $quotePage):
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="mydebug"></div>
|
<div id="mydebug"></div>
|
||||||
|
|
||||||
|
<? debug($principles); ?>
|
||||||
|
|
@ -16,7 +16,12 @@ $(function() {
|
||||||
fetchTable();
|
fetchTable();
|
||||||
|
|
||||||
var quoteID = $("#QuoteId").serialize();
|
var quoteID = $("#QuoteId").serialize();
|
||||||
$("#unitPrice").hide();
|
|
||||||
|
|
||||||
|
$(".nocosting").hide();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$("#addLineItem-form").dialog({
|
$("#addLineItem-form").dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
height: 800,
|
height: 800,
|
||||||
|
|
@ -74,6 +79,10 @@ $(function() {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -105,7 +114,8 @@ function getProductOptions() {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#unitPrice").show();
|
$(".nocosting").show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -120,3 +130,4 @@ function fetchTable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue