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) {
|
function generateFirstPage($id = null) {
|
||||||
|
$this->layout = 'ajax';
|
||||||
|
|
||||||
if(!$id) {
|
if(!$id) {
|
||||||
$this->Session->setFlash(__('Invalid id for Document', true));
|
return;
|
||||||
$this->redirect(array('action'=>'index'));
|
|
||||||
}
|
}
|
||||||
if ($this->Document->del($id)) {
|
|
||||||
$this->Session->setFlash(__('Document deleted', true));
|
$document = $this->Document->read(null, $id);
|
||||||
$this->redirect(array('action'=>'index'));
|
$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) {
|
function getTable($documentID = null) {
|
||||||
$this->layout = 'ajax';
|
$this->layout = 'ajax';
|
||||||
if($documentID == null) {
|
if($documentID == null) {
|
||||||
|
|
@ -72,7 +76,7 @@ class LineItemsController extends AppController {
|
||||||
$this->set('document',$document);
|
$this->set('document',$document);
|
||||||
|
|
||||||
$enquiry = $this->LineItem->Document->getEnquiry($document);
|
$enquiry = $this->LineItem->Document->getEnquiry($document);
|
||||||
|
$this->set('enquiry', $enquiry);
|
||||||
$gst = $this->LineItem->Document->gstApplies($enquiry);
|
$gst = $this->LineItem->Document->gstApplies($enquiry);
|
||||||
$this->set('gst',$gst);
|
$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 />
|
||||||
|
|
@ -16,6 +16,7 @@ echo $form->input('Document.id');
|
||||||
|
|
||||||
<div class="docButtons">
|
<div class="docButtons">
|
||||||
<button id="addPage">Add Content Page</button>
|
<button id="addPage">Add Content Page</button>
|
||||||
|
<button id="generateFirstPage">(re)Generate First Page</button>
|
||||||
<button id="addLineItem">Add Line Item</button>
|
<button id="addLineItem">Add Line Item</button>
|
||||||
<button id="editQuoteDetails">View/Edit Quote Details</button>
|
<button id="editQuoteDetails">View/Edit Quote Details</button>
|
||||||
<?=$html->link('Generate PDF of this Quote', '/documents/pdf/'.$document['Document']['id']);?>
|
<?=$html->link('Generate PDF of this Quote', '/documents/pdf/'.$document['Document']['id']);?>
|
||||||
|
|
@ -25,11 +26,23 @@ echo $form->input('Document.id');
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pages">
|
<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">
|
<div class="docPage">
|
||||||
<?=$form->input("DocPage.{$key}.id");?>
|
<?=$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}.document_id", array('type'=>'hidden'));?>
|
||||||
<?=$form->input("DocPage.{$key}.page_number", array('type'=>'hidden'));?>
|
<?=$form->input("DocPage.{$key}.page_number", array('type'=>'hidden'));?>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -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>
|
<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>
|
</div>
|
||||||
|
|
||||||
|
<? //For re-Generating the first page ?>
|
||||||
|
<div id="contactFirstName" style="display: none;"><?=$enquiry['Contact']['first_name'];?></div>
|
||||||
|
|
||||||
|
|
||||||
<? //debug($this->data);?>
|
<? //debug($this->data);?>
|
||||||
<? //debug($enquiry);?>
|
<? //debug($enquiry);?>
|
||||||
<?php //debug($document);?>
|
<?php //debug($document);?>
|
||||||
|
|
|
||||||
|
|
@ -220,6 +220,10 @@ $class = ' class="altrow"';?>
|
||||||
Redirecting you now to fill in the details.
|
Redirecting you now to fill in the details.
|
||||||
</div>
|
</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">
|
<div class="related">
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
$(function() {
|
$(function() {
|
||||||
$(".addJob").button('enable');
|
$(".addJob").button('enable');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(".addJob").click(function() {
|
$(".addJob").click(function() {
|
||||||
$(".addJob").button('disable');
|
$("#jobConfirm").dialog('open');
|
||||||
addJob();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -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() {
|
function addJob() {
|
||||||
|
|
||||||
var enquiryID = $(".addJob").attr("id");
|
var enquiryID = $(".addJob").attr("id");
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ $(function() {
|
||||||
|
|
||||||
// var config defined in global.js
|
// var config defined in global.js
|
||||||
loadLineItems();
|
loadLineItems();
|
||||||
|
var docID = $('#documentID').html();
|
||||||
|
|
||||||
|
|
||||||
$("#flashMessage").hide();
|
$("#flashMessage").hide();
|
||||||
|
|
@ -168,7 +169,6 @@ $(function() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var docID = $('#documentID').html();
|
|
||||||
|
|
||||||
$('#LineItemDescription').ckeditor(function() {
|
$('#LineItemDescription').ckeditor(function() {
|
||||||
this.destroy();
|
this.destroy();
|
||||||
|
|
@ -318,6 +318,16 @@ $(function() {
|
||||||
$("#QuoteDetails").dialog('open');
|
$("#QuoteDetails").dialog('open');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$("#generateFirstPage").click(function() {
|
||||||
|
$.get('/documents/generateFirstPage/'+docID, function(data) {
|
||||||
|
$(".firstPage").val(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue