First page generating working
This commit is contained in:
parent
8c0a907b76
commit
420630ce7b
|
|
@ -292,16 +292,21 @@ class DocumentsController extends AppController {
|
|||
|
||||
}
|
||||
|
||||
/*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'));
|
||||
}
|
||||
}*/
|
||||
function generateFirstPage($id = null) {
|
||||
$this->layout = 'ajax';
|
||||
|
||||
if(!$id) {
|
||||
return;
|
||||
}
|
||||
|
||||
$document = $this->Document->read(null, $id);
|
||||
$this->set('document',$document);
|
||||
|
||||
$enquiry = $this->Document->Quote->Enquiry->read(null, $document['Quote']['enquiry_id']);
|
||||
$this->set('enquiry', $enquiry);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
@ -62,6 +62,10 @@ class LineItemsController extends AppController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the products table with prices (for quotes, invoices etc)
|
||||
* @param <type> $documentID
|
||||
*/
|
||||
function getTable($documentID = null) {
|
||||
$this->layout = 'ajax';
|
||||
if($documentID == null) {
|
||||
|
|
@ -72,7 +76,7 @@ class LineItemsController extends AppController {
|
|||
$this->set('document',$document);
|
||||
|
||||
$enquiry = $this->LineItem->Document->getEnquiry($document);
|
||||
|
||||
$this->set('enquiry', $enquiry);
|
||||
$gst = $this->LineItem->Document->gstApplies($enquiry);
|
||||
$this->set('gst',$gst);
|
||||
|
||||
|
|
|
|||
29
views/documents/generate_first_page.ctp
Normal file
29
views/documents/generate_first_page.ctp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<p>Dear <?=$enquiry['Contact']['first_name']?>,</p>
|
||||
|
||||
<p>Thank you for your enquiry. The following quotation is for:</p>
|
||||
<table>
|
||||
<tr>
|
||||
<td width="10%"><u><b>Item</b></u></td>
|
||||
<td width="80%"><u><b>Description</b></u></td>
|
||||
<td width="10%"><u><b>Quantity</b></u></td>
|
||||
</tr>
|
||||
<? foreach($document['LineItem'] as $li):?>
|
||||
<tr>
|
||||
<td valign="top" width="10%"><? if($li['option'] == 1) {
|
||||
echo 'Option<br>';
|
||||
}
|
||||
?><?=$li['item_number']?></td>
|
||||
<td width="80%"><?=$li['title'];?></td>
|
||||
<td valign="top" width="10%"><?=$li['quantity'];?></td>
|
||||
</tr>
|
||||
<? endforeach;?>
|
||||
</table>
|
||||
<p>If you have any further queries, please contact us at our office for assistance.</p>
|
||||
<p>We look forward to your reply.</p>
|
||||
|
||||
<p>Regards,</p>
|
||||
<?=$enquiry['User']['first_name'].' '.$enquiry['User']['last_name'];?><br />
|
||||
<?=$enquiry['User']['job_title'];?><br />
|
||||
<br />
|
||||
<u><b>Attachments:</b></u><br />
|
||||
CMC Technologies Terms & Conditions of Sale 1/7/06 (attached)<br />
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
<h2>Quote: <?=$html->link($enquiry['Enquiry']['title'], array('controller'=>'enquiries','action'=>'view',$enquiry['Enquiry']['id']));?> <?
|
||||
if($document['Quote']['revision'] > 0) {
|
||||
echo "Revision {$document['Quote']['revision']} ";
|
||||
}
|
||||
?>
|
||||
for
|
||||
<?=$html->link($enquiry['Customer']['name'], array('controller'=>'customers','action'=>'view',$enquiry['Customer']['id']));?>
|
||||
if($document['Quote']['revision'] > 0) {
|
||||
echo "Revision {$document['Quote']['revision']} ";
|
||||
}
|
||||
?>
|
||||
for
|
||||
<?=$html->link($enquiry['Customer']['name'], array('controller'=>'customers','action'=>'view',$enquiry['Customer']['id']));?>
|
||||
</h2>
|
||||
|
||||
|
||||
|
|
@ -16,6 +16,7 @@ echo $form->input('Document.id');
|
|||
|
||||
<div class="docButtons">
|
||||
<button id="addPage">Add Content Page</button>
|
||||
<button id="generateFirstPage">(re)Generate First Page</button>
|
||||
<button id="addLineItem">Add Line Item</button>
|
||||
<button id="editQuoteDetails">View/Edit Quote Details</button>
|
||||
<?=$html->link('Generate PDF of this Quote', '/documents/pdf/'.$document['Document']['id']);?>
|
||||
|
|
@ -25,13 +26,25 @@ echo $form->input('Document.id');
|
|||
</div>
|
||||
|
||||
<div class="pages">
|
||||
<?php foreach($document['DocPage'] as $key => $page):?>
|
||||
<?php
|
||||
$first = true;
|
||||
|
||||
foreach($document['DocPage'] as $key => $page):?>
|
||||
|
||||
<? if($first == true) {
|
||||
$class = 'page firstPage';
|
||||
$first = false;
|
||||
}
|
||||
else {
|
||||
$class = 'page';
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="docPage">
|
||||
<?=$form->input("DocPage.{$key}.id");?>
|
||||
<?=$form->input("DocPage.{$key}.content", array('class'=>'page', 'label'=>'Page '.$page['page_number'], 'between'=>'<button class="removePage">X</button>'));?>
|
||||
<?=$form->input("DocPage.{$key}.content", array('class'=>$class, 'label'=>'Page '.$page['page_number'], 'between'=>'<button class="removePage">X</button>'));?>
|
||||
<?=$form->input("DocPage.{$key}.document_id", array('type'=>'hidden'));?>
|
||||
<?=$form->input("DocPage.{$key}.page_number", array('type'=>'hidden'));?>
|
||||
<?=$form->input("DocPage.{$key}.page_number", array('type'=>'hidden'));?>
|
||||
</div>
|
||||
|
||||
<?endforeach?>
|
||||
|
|
@ -49,6 +62,10 @@ echo $form->input('Document.id');
|
|||
<span style="font-size: small;">ANY VARIATIONS ON ITEMS 5. TO 7. WILL BE TO YOUR ACCOUNT. THIS QUOTATION IS BASED ON QUANTITIES STATED AND IS SUBJECT TO CHANGE IF QUANTITIES VARY.</span>
|
||||
</div>
|
||||
|
||||
<? //For re-Generating the first page ?>
|
||||
<div id="contactFirstName" style="display: none;"><?=$enquiry['Contact']['first_name'];?></div>
|
||||
|
||||
|
||||
<? //debug($this->data);?>
|
||||
<? //debug($enquiry);?>
|
||||
<?php //debug($document);?>
|
||||
|
|
|
|||
|
|
@ -220,6 +220,10 @@ $class = ' class="altrow"';?>
|
|||
Redirecting you now to fill in the details.
|
||||
</div>
|
||||
|
||||
<div id="jobConfirm" title="Are you sure you want to make a new Job">
|
||||
This will create a new Job and a Job number. Are you sure you want to do this?
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="related">
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
$(function() {
|
||||
$(".addJob").button('enable');
|
||||
|
||||
|
||||
|
||||
$(".addJob").click(function() {
|
||||
$(".addJob").button('disable');
|
||||
addJob();
|
||||
$("#jobConfirm").dialog('open');
|
||||
});
|
||||
|
||||
|
||||
|
|
@ -22,6 +23,23 @@ $(function() {
|
|||
});
|
||||
|
||||
|
||||
$( "#jobConfirm" ).dialog({
|
||||
autoOpen: false,
|
||||
resizable: false,
|
||||
height:140,
|
||||
modal: true,
|
||||
buttons: {
|
||||
"Add new Job": function() {
|
||||
addJob();
|
||||
$( this ).dialog( "close" );
|
||||
},
|
||||
Cancel: function() {
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function addJob() {
|
||||
|
||||
var enquiryID = $(".addJob").attr("id");
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ $(function() {
|
|||
|
||||
// var config defined in global.js
|
||||
loadLineItems();
|
||||
|
||||
var docID = $('#documentID').html();
|
||||
|
||||
|
||||
$("#flashMessage").hide();
|
||||
|
||||
|
|
@ -168,7 +169,6 @@ $(function() {
|
|||
|
||||
|
||||
|
||||
var docID = $('#documentID').html();
|
||||
|
||||
$('#LineItemDescription').ckeditor(function() {
|
||||
this.destroy();
|
||||
|
|
@ -318,6 +318,16 @@ $(function() {
|
|||
$("#QuoteDetails").dialog('open');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$("#generateFirstPage").click(function() {
|
||||
$.get('/documents/generateFirstPage/'+docID, function(data) {
|
||||
$(".firstPage").val(data);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
@ -343,7 +353,7 @@ $('.generateCommercialComments').live('click', function(event) {
|
|||
var commList = commComments.find('ol');
|
||||
|
||||
commList.append('<li>DELIVERY IS ESTIMATED AT '+deliveryTime+ 'FROM RECEIPT OF YOUR TECHNICALLY AND COMMERCIALLY CLEAR ORDER');
|
||||
commList.append('<li>PAYMENT TERMS:'+paymentTerms+'</li>');
|
||||
commList.append('<li>PAYMENT TERMS: '+paymentTerms+'</li>');
|
||||
commList.append('<li>QUOTATION IS VALID <u>FOR '+daysValid+' DAYS</li>');
|
||||
commList.append('<li>ALL PRICES ARE <u>'+deliveryPoint+'</u></li>');
|
||||
commList.append('<li>EXCHANGE RATE:'+exchangeRate+'</u></li>');
|
||||
|
|
|
|||
Loading…
Reference in a new issue