Implemented PO first page. Added extra PO field migration
This commit is contained in:
parent
e2b1af84d8
commit
3f1c37057d
|
|
@ -269,16 +269,40 @@ class DocumentsController extends AppController {
|
|||
$enquiry = $this->Document->OrderAcknowledgement->Enquiry->read(null, $enquiryid);
|
||||
$count = $this->Document->PurchaseOrder->findCount();
|
||||
$count++;
|
||||
|
||||
$offset = 2060;
|
||||
$count += $offset;
|
||||
$newPOnumber = "CMCPO".$count;
|
||||
$this->data['PurchaseOrder']['title'] = $newPOnumber;
|
||||
$this->data['PurchaseOrder']['issue_date'] = date('Y-m-d');
|
||||
|
||||
$this->data['PurchaseOrder']['deliver_to'] = <<<ENDDELIVER
|
||||
CMC TECHNOLOGIES PTY LTD<br>
|
||||
Unit 19, 77 Bourke Road<br>
|
||||
Alexandria NSW 2015 AUSTRALIA<br>
|
||||
ENDDELIVER;
|
||||
|
||||
//Fuck it all.
|
||||
$this->data['PurchaseOrder']['shipping_instructions'] = <<<ENDINSTRUCTIONS
|
||||
|
||||
<b>PART SHIPMENT:</b> Not Acceptable - please advise ASAP if production of an Item will Delay the Dispatch of the Complete Order by the Date Required stated above.<br>
|
||||
<b>INSURANCE:</b> DO NOT INSURE - Insurance effected by CMC<br>
|
||||
<b>SECURITY:</b> It is essential that the cargo is prepared & handled so as not to compromise its security standing.<br>
|
||||
<b>SHIPMENT MARKINGS:</b><br>
|
||||
(Please put red fragile stickers on boxing)<br>
|
||||
CMC TECHNOLOGIES PTY LTD<br>
|
||||
UNIT 19, 77 BOURKE ROAD<br>
|
||||
ALEXANDRIA NSW 2015 AUSTRALIA<br>
|
||||
ENDINSTRUCTIONS;
|
||||
|
||||
|
||||
|
||||
|
||||
$this->data['Document']['user_id']= $enquiry['Enquiry']['user_id'];
|
||||
$this->data['Document']['revision'] = 0; //No revisions for POs. I have decreed it!
|
||||
$this->data['Document']['type'] = 'purchaseOrder';
|
||||
break;
|
||||
|
||||
|
||||
case "orderAck":
|
||||
$enquiry = $this->Document->OrderAcknowledgement->Enquiry->read(null, $enquiryid);
|
||||
$this->data['OrderAcknowledgement']['job_id'] = $jobid;
|
||||
|
|
@ -642,7 +666,21 @@ class DocumentsController extends AppController {
|
|||
break;
|
||||
|
||||
case "purchaseOrder":
|
||||
|
||||
$totalsDescText = array(
|
||||
'subtotal' => 'SUBTOTAL',
|
||||
'gst' => '',
|
||||
'total' => 'ORDER TOTAL'
|
||||
);
|
||||
//No GST for POs for now.
|
||||
$totals = $this->calculateTotals($document, 0);
|
||||
$this->set('totals',$totals);
|
||||
$this->set('totalsDescText',$totalsDescText);
|
||||
|
||||
$filename = $document['PurchaseOrder']['title'];
|
||||
|
||||
$issue_date = date('l, j F Y', strtotime($document['PurchaseOrder']['issue_date']));
|
||||
$this->set('issue_date', $issue_date);
|
||||
$template_name = 'pdf_po';
|
||||
break;
|
||||
|
||||
|
|
|
|||
5
app/migrations/15_6_2013_add_extra_po_fields.sql
Normal file
5
app/migrations/15_6_2013_add_extra_po_fields.sql
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
ALTER TABLE `purchase_orders` ADD `currency_id` INT NOT NULL;
|
||||
|
||||
ALTER TABLE `purchase_orders` ADD `ordered_from` TEXT NOT NULL, ADD `description` TEXT NOT NULL, ADD `dispatch_by` VARCHAR(255) NOT NULL, ADD `deliver_to` TEXT NOT NULL, ADD `shipping_instructions` TEXT NOT NULL;
|
||||
|
||||
|
||||
|
|
@ -10,20 +10,17 @@ $pdfdoc->SetPrintFooter(false);
|
|||
$pdfdoc->AddPage();
|
||||
$pdfdoc->Page1Header();
|
||||
|
||||
$pageTitle = "<h1>PURCHASE ORDER</h1>";
|
||||
$pdfdoc->writeHTML($pageTitle, true, false, false, false, 'C');
|
||||
|
||||
$first_page = $this->element('pdf_po_first_page');
|
||||
$pdfdoc->pageContent($first_page);
|
||||
|
||||
$pdfdoc->SetTextColor(0);
|
||||
|
||||
$pageNo = $pdfdoc->PageNoFormatted();
|
||||
$totalCount = $pdfdoc->getAliasNbPages();
|
||||
|
||||
$pdfdoc->AddPage();
|
||||
|
||||
$shippingBillingBox = $this->element('pdf_shipping_billing_box', array('pageNo'=>$pageNo, 'totalCount'=>$totalCount));
|
||||
|
||||
$pdfdoc->writeHTML($shippingBillingBox, false);
|
||||
|
||||
$LineItemTable = $this->element('line_items_table_with_shipping');
|
||||
$LineItemTable = $this->element('line_items_table_po'); //Because fuck it.
|
||||
$pdfdoc->SetPrintHeader(true);
|
||||
|
||||
$pdfdoc->pageContent($LineItemTable);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
<h2>Purchase Order: <?=$document['PurchaseOrder']['title']?></h2>
|
||||
<h2>Job: <?=$html->link($invoice['Job']['title'], array('controller'=>'jobs', 'action'=>'view', $invoice['Job']['id']));?></h2>
|
||||
<h2>Job: </h2>
|
||||
|
||||
<div id="flashMessage" class="message">
|
||||
</div>
|
||||
<div class="docButtons">
|
||||
<button id="paymentReceived">Enter Payment Received</button>
|
||||
<button id="pdfDocButton" data-url="/documents/pdf/<?= $document['Document']['id']; ?>">Generate PDF</button>
|
||||
<button id="emailDocButton" data-url="/documents/email_pdf/<?= $document['Document']['id']; ?>">Email PurchaseOrder to customer</button>
|
||||
</div>
|
||||
|
|
@ -26,18 +25,15 @@
|
|||
echo $form->input('PurchaseOrder.dispatch_date');
|
||||
echo $form->input('PurchaseOrder.date_arrived'); //ARGH. Really Karl?
|
||||
|
||||
echo $form->input('billing_address_id', array('div' => 'addressradio', 'legend' => 'Select Billing Address', 'options' => $billing_addresses_list, 'type' => 'radio', 'class'=>'billing_address'));
|
||||
echo $form->input('Document.bill_to');
|
||||
echo $form->input('PurchaseOrder.ordered_from');
|
||||
echo $form->input('PurchaseOrder.description');
|
||||
|
||||
echo $form->input('PurchaseOrder.dispatch_by');
|
||||
|
||||
echo $form->input('PurchaseOrder.deliver_to');
|
||||
echo $form->input('PurchaseOrder.shipping_instructions');
|
||||
|
||||
|
||||
echo $form->input('shipping_address_id', array('div' => 'addressradio','legend' => 'Select Shipping Address', 'options' => $shipping_addresses_list, 'type' => 'radio', 'class' => 'shipping_address'));
|
||||
echo $form->input('Document.ship_to');
|
||||
|
||||
|
||||
|
||||
echo $form->input('PurchaseOrder.ship_via');
|
||||
echo $form->input('PurchaseOrder.fob');
|
||||
echo $form->input('Document.shipping_details', array('id'=>'shippingDetails'));
|
||||
echo $form->end(array('label'=>'Save PurchaseOrder Details', 'id'=>'savePurchaseOrderButton'));
|
||||
?>
|
||||
</fieldset>
|
||||
|
|
|
|||
123
app/views/elements/line_items_table_po.ctp
Executable file
123
app/views/elements/line_items_table_po.ctp
Executable file
|
|
@ -0,0 +1,123 @@
|
|||
<table border="1" cellpadding="2" cellspacing="0" >
|
||||
<thead>
|
||||
<tr bgcolor="#f2f2f2" nobr="true">
|
||||
<th width="<?=$colWidths['item'];?>" align="center">ITEM<br />NO.</th>
|
||||
<th width="<?=$colWidths['qty'];?>" align="center">QTY</th>
|
||||
<th width="<?=$colWidths['desc'];?>" align="center">DESCRIPTION</th>
|
||||
<th width="<?=$colWidths['unit'];?>" align="center">UNIT<br>PRICE</th>
|
||||
<th width="<?=$colWidths['total'];?>" align="center">TOTAL<br>PRICE</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th align="center"><?=$currencyCode?></th>
|
||||
<th align="center"><?=$currencyCode?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?
|
||||
$hasOptions = false;
|
||||
foreach($document['LineItem'] as $li):?>
|
||||
<tr>
|
||||
<td width="<?=$colWidths['item'];?>" align="center" valign="top">
|
||||
<? if($li['option'] == 1) {
|
||||
echo 'Option<br>';
|
||||
$hasOptions = true;
|
||||
}
|
||||
?>
|
||||
<?=$li['item_number'];?>
|
||||
</td>
|
||||
<td width="<?=$colWidths['qty'];?>" align="center" valign="top"><?=$decimal->formatDecimal($li['quantity']);?></td>
|
||||
<td width="<?=$colWidths['desc'];?>"><?=$li['title'];?><br>
|
||||
<?=$li['description'];?>
|
||||
</td>
|
||||
<td width="<?=$colWidths['unit'];?>" align="center" valign="top">
|
||||
<?
|
||||
if($li['has_text_prices']):
|
||||
echo $li['unit_price_string'];
|
||||
?>
|
||||
<?
|
||||
else:
|
||||
?>
|
||||
<?=$number->currency($li['gross_unit_price'], $currencyCode);?>
|
||||
<? if($li['discount_percent']):?>
|
||||
<br>less<br><?=$li['discount_percent']?>%<br>
|
||||
discount<br>
|
||||
(-<?=$number->currency($li['discount_amount_unit'], $currencyCode);?>)<br>
|
||||
=<br>
|
||||
<?=$number->currency($li['net_unit_price'], $currencyCode);?>
|
||||
<?endif;?>
|
||||
<?endif;?>
|
||||
</td>
|
||||
<td width="<?=$colWidths['total'];?>" align="center" valign="top">
|
||||
<?
|
||||
if($li['has_text_prices']):
|
||||
echo $li['gross_price_string'];
|
||||
?>
|
||||
<?
|
||||
else:
|
||||
?>
|
||||
<?=$number->currency($li['gross_price'], $currencyCode);?>
|
||||
<? if($li['discount_percent']):?>
|
||||
<br>less<br><?=$li['discount_percent']?>%<br>
|
||||
discount*<br>
|
||||
(-<?=$number->currency($li['discount_amount_total'], $currencyCode);?>)<br>
|
||||
=<br>
|
||||
<?=$number->currency($li['net_price'], $currencyCode);?>
|
||||
<?endif;?>
|
||||
<?endif;?>
|
||||
</td>
|
||||
</tr>
|
||||
<?endforeach;?>
|
||||
</tbody>
|
||||
<tfoot nobr="true">
|
||||
|
||||
<tr nobr="true">
|
||||
<td width="<?=$colWidths['item'];?>"></td>
|
||||
<td width="<?=$colWidths['qty'];?>"></td>
|
||||
<td width="<?=$colWidths['desc'];?>"><?=$totalsDescText['subtotal']?></td>
|
||||
<td width="<?=$colWidths['unit'];?>"></td>
|
||||
<td width="<?=$colWidths['total'];?>" align="center">
|
||||
<?
|
||||
if(!$hasOptions) {
|
||||
echo $number->currency($totals['subtotal'], $currencyCode);
|
||||
}
|
||||
else {
|
||||
echo $currencySymbol.'TBA';
|
||||
}
|
||||
?></td>
|
||||
</tr>
|
||||
<tr nobr="true">
|
||||
<td width="<?=$colWidths['item'];?>"></td>
|
||||
<td width="<?=$colWidths['qty'];?>"></td>
|
||||
<td width="<?=$colWidths['desc'];?>"><?=$totalsDescText['gst'];?></td>
|
||||
<td width="<?=$colWidths['unit'];?>"></td>
|
||||
<td width="<?=$colWidths['total'];?>" align="center">
|
||||
<?
|
||||
if(!$hasOptions) {
|
||||
}
|
||||
else {
|
||||
echo $currencySymbol.'TBA';
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr nobr="true">
|
||||
<td width="<?=$colWidths['item'];?>"></td>
|
||||
<td width="<?=$colWidths['qty'];?>"></td>
|
||||
<td width="<?=$colWidths['desc'];?>"><?=$totalsDescText['total'];?></td>
|
||||
<td width="<?=$colWidths['unit'];?>" align="center"><?=$currencyCode?></td>
|
||||
<td width="<?=$colWidths['total'];?>" align="center">
|
||||
<?
|
||||
if(!$hasOptions) {
|
||||
echo $number->currency($totals['total'], $currencyCode);
|
||||
}
|
||||
else {
|
||||
echo $currencySymbol.'TBA';
|
||||
}
|
||||
?></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
74
app/views/elements/pdf_po_first_page.ctp
Normal file
74
app/views/elements/pdf_po_first_page.ctp
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<table style="font-size: 14px; font-weight: bold;">
|
||||
<tr>
|
||||
<td>PURCHASE ORDER NO:</td>
|
||||
<td><?= $document['PurchaseOrder']['title']; ?></td>
|
||||
<td style="font-size: 12px;">Date: <?= $issue_date ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br><br><br>
|
||||
<table style="font-size: 12px; font-weight: bold;">
|
||||
<tr>
|
||||
<td style="width: 30%;">ORDERED FROM:</td>
|
||||
<td style="font-size: 12px; width: 70%"><?=$document['PurchaseOrder']['ordered_from']; ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br><br><br>
|
||||
|
||||
<table style="font-size: 12px; font-weight: bold; border: 1px solid #000; text-align: center;">
|
||||
<tr>
|
||||
<td style="border: 1px solid black;">Reference</td>
|
||||
<td style="border: 1px solid black;">Description</td>
|
||||
<td style="border: 1px solid black;">Order Total <?= $currency['Currency']['iso4217']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="border: 1px solid black;"><?= $document['PurchaseOrder']['principle_reference']; ?></td>
|
||||
<td style="border: 1px solid black;"><?= $document['PurchaseOrder']['description']; ?></td>
|
||||
<td style="border: 1px solid black;">
|
||||
<?= $number->currency($totals['total'], $currencyCode); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
<br><br>
|
||||
<?php $col1 = '30%'; $col2 = '70%'; ?>
|
||||
|
||||
<table style="font-size: 11px; font-weight: bold;">
|
||||
|
||||
<tr>
|
||||
<td style="width: <?=$col1;?>;">DISPATCH EX-WORKS BY:</td>
|
||||
<td style="width: <?=$col2;?>"><?= $document['PurchaseOrder']['dispatch_by'];?></td>
|
||||
</tr>
|
||||
</table><br><br>
|
||||
<table style="font-size: 11px; font-weight: bold;">
|
||||
<tr>
|
||||
<td style="width: <?=$col1;?>;">DELIVER TO:</td>
|
||||
<td style="width: <?=$col2;?>"><?= $document['PurchaseOrder']['deliver_to'];?></td>
|
||||
</tr>
|
||||
</table><br><br>
|
||||
|
||||
<table style="font-size: 11px;">
|
||||
|
||||
<tr>
|
||||
<td style="width: <?=$col1;?>;"><u>SHIPPING INSTRUCTIONS:</u></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: <?=$col2;?>">
|
||||
<br>
|
||||
<?= $document['PurchaseOrder']['shipping_instructions'];?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br><br>
|
||||
<table style="font-size: 11px; font-weight: bold;">
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>I HEREBY CERTIFY THAT CMC TECHNOLOGIES IS REGISTERED FOR GST AND OUR REGISTRATION # IS 47 085 991 224. <br><br>
|
||||
CON CARPIS</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
|
@ -106,8 +106,7 @@ if ($currentuser['User']['access_level'] == 'manager' || $currentuser['User']['a
|
|||
|
||||
<li><?php echo $html->link('POs', '/purchase_orders/index'); ?>
|
||||
<ul>
|
||||
<li><?php echo $html->link('PO Index', '/purchase_orders/index'); ?></li>
|
||||
<li class="last"><?php echo $html->link('New PO', '/purchase_orders/add'); ?></li>
|
||||
<li class="last"><?php echo $html->link('PO Index', '/purchase_orders/index'); ?></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
<div class="purchaseOrders index">
|
||||
<h2><?php __('PurchaseOrders');?></h2>
|
||||
|
||||
<div class="actions">
|
||||
<a href="/documents/newDocument/purchaseOrder/0/0/0">New blank Purchase Order</a>
|
||||
</div>
|
||||
<p>
|
||||
<?php
|
||||
echo $paginator->counter(array(
|
||||
|
|
@ -17,7 +21,7 @@ echo $paginator->counter(array(
|
|||
<th><?php echo $paginator->sort('principle_id');?></th>
|
||||
<th><?php echo $paginator->sort('principle_reference');?></th>
|
||||
<? /*<th><?php echo $paginator->sort('document_id');?></th> */?>
|
||||
<th class="actions"><?php __('Actions');?></th>
|
||||
<th>Document</th>
|
||||
</tr>
|
||||
<?php
|
||||
$i = 0;
|
||||
|
|
@ -58,10 +62,12 @@ foreach ($purchaseOrders as $purchaseOrder):
|
|||
<? /*<td>
|
||||
<?php echo $html->link($purchaseOrder['Document']['id'], array('controller' => 'documents', 'action' => 'view', $purchaseOrder['Document']['id'])); ?>
|
||||
</td>*/ ?>
|
||||
<td class="actions">
|
||||
<?php echo $html->link(__('View', true), array('action' => 'view', $purchaseOrder['PurchaseOrder']['id'])); ?>
|
||||
<?php echo $html->link(__('Edit', true), array('action' => 'edit', $purchaseOrder['PurchaseOrder']['id'])); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if($purchaseOrder['PurchaseOrder']['document_id'] > 0) { ?>
|
||||
<a href="/documents/view/<?=$purchaseOrder['PurchaseOrder']['document_id']; ?>">View</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
|
@ -71,18 +77,6 @@ foreach ($purchaseOrders as $purchaseOrder):
|
|||
| <?php echo $paginator->numbers();?>
|
||||
<?php echo $paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<ul>
|
||||
<li><?php echo $html->link(__('New PurchaseOrder', true), array('action' => 'add')); ?></li>
|
||||
<li><?php echo $html->link(__('List Principles', true), array('controller' => 'principles', 'action' => 'index')); ?> </li>
|
||||
<li><?php echo $html->link(__('New Principle', true), array('controller' => 'principles', 'action' => 'add')); ?> </li>
|
||||
<li><?php echo $html->link(__('List Documents', true), array('controller' => 'documents', 'action' => 'index')); ?> </li>
|
||||
<li><?php echo $html->link(__('New Document', true), array('controller' => 'documents', 'action' => 'add')); ?> </li>
|
||||
<li><?php echo $html->link(__('List Jobs', true), array('controller' => 'jobs', 'action' => 'index')); ?> </li>
|
||||
<li><?php echo $html->link(__('New Job', true), array('controller' => 'jobs', 'action' => 'add')); ?> </li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
|
@ -96,4 +90,3 @@ function isEmptyDate($date) {
|
|||
}
|
||||
?>
|
||||
|
||||
<?php debug($purchaseOrders);?>
|
||||
|
|
@ -392,6 +392,12 @@ $(function() {
|
|||
});
|
||||
|
||||
|
||||
//This is fucked beyond all words.
|
||||
$("#PurchaseOrderDeliverTo").ckeditor(config);
|
||||
$("#PurchaseOrderOrderedFrom").ckeditor(config);
|
||||
$("#PurchaseOrderShippingInstructions").ckeditor(config);
|
||||
$("#PurchaseOrderDescription").ckeditor(config);
|
||||
|
||||
//PackingList View. Damn you past Karl.
|
||||
$("#savePackingListButton").click(function() {
|
||||
saveDocument('Packing List');
|
||||
|
|
@ -401,6 +407,13 @@ $(function() {
|
|||
});
|
||||
|
||||
|
||||
//PurchaseOrder View. Damn you past Karl.
|
||||
$("#savePurchaseOrderButton").click(function() {
|
||||
saveDocument('Purchase Order');
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
$("#createOA").click(function() {
|
||||
$("#addJobConfirmation").dialog('open');
|
||||
|
|
@ -505,17 +518,24 @@ function showHideTextPrices() {
|
|||
}
|
||||
|
||||
|
||||
//I am a much better programmer now.
|
||||
//FUCK YEAH!!
|
||||
function updateTextFields() {
|
||||
$('#shippingDetails').ckeditor(function() {
|
||||
this.updateElement();
|
||||
});
|
||||
var fields = [
|
||||
'#shippingDetails',
|
||||
"#DocumentBillTo",
|
||||
"#DocumentShipTo",
|
||||
"#PurchaseOrderDeliverTo",
|
||||
"#PurchaseOrderOrderedFrom",
|
||||
"#PurchaseOrderShippingInstructions",
|
||||
"#PurchaseOrderDescription"
|
||||
];
|
||||
|
||||
$("#DocumentBillTo").ckeditor(function() {
|
||||
this.updateElement();
|
||||
});
|
||||
$("#DocumentShipTo").ckeditor(function() {
|
||||
for (i in fields) {
|
||||
$(fields[i]).ckeditor(function() {
|
||||
this.updateElement();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue