64 - editable payment terms

This commit is contained in:
Karl Cordes 2023-06-15 07:31:41 +10:00
parent 9fe3814f95
commit 81ec118347
12 changed files with 82 additions and 9 deletions

View file

@ -626,6 +626,11 @@ ENDINSTRUCTIONS;
$newDoc['Document']['shipping_details'] = $this->defaultShippingText;
$newDoc['Document']['doc_page_count'] = 0;
$newDoc['Document']['cmc_reference'] = '';
$newDoc['Document']['pdf_filename'] = '';
$newDoc['Document']['pdf_created_at'] = '0000-00-00 00:00:00';
$newDoc['Document']['pdf_created_at'] = 0;
$newDoc['OrderAcknowledgement']['fob'] = $this->defaultFOB;

View file

@ -63,6 +63,7 @@ class QuotesController extends AppController {
$this->set(compact('enquiry', 'quote', 'currencies'));
$this->set('cityCountryList', $this->Quote->Enquiry->Principle->getCityCountryList());
$this->set('quoteID', $id);
}
@ -297,6 +298,15 @@ class QuotesController extends AppController {
}
// #64 - ability to customise payment terms dropdown box.
// jquery is hopelessly out of date, so trying htmx for novelty.
function paymentTerms($id = null) {
$this->layout = 'ajax';
$quote = $this->Quote->read(null, $id);
$this->data = $quote;
}
}
?>

View file

@ -88,6 +88,11 @@ class Job extends AppModel {
$newJob['Job']['contact_id'] = $enquiry['Enquiry']['contact_id'];
$newJob['Job']['enquiry_id'] = $enquiry['Enquiry']['id'];
$newJob['Job']['date_order_received'] = date('Y-m-d');
$newJob['Job']['all_sent'] = 0;
$newJob['Job']['all_paid'] = 0;
$newJob['Job']['comments'] = '';
if(!empty($customerOrderNumber)) {
$newJob['Job']['customer_order_number'] = $customerOrderNumber;

View file

@ -1,3 +1,6 @@
<?php echo $javascript->link('customer_edit'); ?>
<div class="customers form">
<?php echo $form->create('Customer');?>
<fieldset>
@ -6,7 +9,18 @@
echo $form->input('id');
echo $form->input('name');
echo $form->input('abn');
echo $this->element('payment_terms_box');
//echo $this->element('payment_terms_box');
?>
<div class="input select"><label for="CustomerPaymentTermsOptions">Payment Terms</label><select name="data[Customer][payment_terms]" id="CustomerPaymentTermsOptions">
<option value="">Select the Terms of Payment</option>
<option value="100% Payment with Order">100% Payment with Order</option>
<option value="Net 7 Days for Approved Accounts">Net 7 Days for Approved Accounts</option>
<option value="Net 14 Days for Approved Accounts">Net 14 Days for Approved Accounts</option>
<option value="Net 30 Days for Approved Accounts">Net 30 Days for Approved Accounts</option>
</select></div>
<?php
echo $form->input('payment_terms');
echo $form->input('discount_pricing_policies', array('label'=>'Discount and Pricing Policies'));
echo $form->input('notes');
echo $form->input('url', array('label'=>'Website URL'));

View file

@ -43,6 +43,12 @@
echo $form->input('Invoice.ship_via');
echo $form->input('Invoice.fob');
?>
<div class="input">Payment terms: <?=$enquiry['Customer']['payment_terms'];?></div>
<div class="input">
<a href="/customers/edit/<?=$enquiry['Customer']['id'];?>">Set the payment terms for this customer</a>
</div>
<?php
echo $form->input('Document.shipping_details', array('id'=>'shippingDetails'));
echo $form->end(array('label'=>'Save Invoice Details', 'id'=>'saveInvoiceButton'));
?>

View file

@ -44,6 +44,12 @@
echo $form->input('OrderAcknowledgement.ship_via');
echo $form->input('OrderAcknowledgement.fob');
?>
<div class="input">Payment terms: <?=$enquiry['Customer']['payment_terms'];?></div>
<div class="input">
<a href="/customers/edit/<?=$enquiry['Customer']['id'];?>">Set the payment terms for this customer</a>
</div>
<?php
echo $form->input('OrderAcknowledgement.estimated_delivery');
echo $form->input('OrderAcknowledgement.signature_required', array('options' => array('1' => 'Yes', '0' => 'No')));
echo $form->input('Document.shipping_details', array('id'=>'shippingDetails'));

View file

@ -28,6 +28,12 @@
echo $form->input('PackingList.fob');
?>
<div class="input">Payment terms: <?=$enquiry['Customer']['payment_terms'];?></div>
<div class="input">
<a href="/customers/edit/<?=$enquiry['Customer']['id'];?>">Set the payment terms for this customer</a>
</div>
<?php
echo $form->input('Document.shipping_details', array('id'=>'shippingDetails'));
echo $form->end(array('label'=>'Save PackingList Details', 'id'=>'savePackingListButton'));
?>

View file

@ -1,5 +1,5 @@
<?
echo $form->input('payment_terms', array('empty'=>'Select the Terms of Payment', 'options' => array(
echo $form->input('payment_terms', array('id'=>'paymentTermsOptions', 'empty'=>'Select the Terms of Payment', 'options' => array(
'100% Payment with Order' => '100% Payment with Order',
'Net 7 Days for Approved Accounts' => 'Net 7 Days for Approved Accounts',
'Net 14 Days for Approved Accounts' => 'Net 14 Days for Approved Accounts',

View file

@ -50,14 +50,20 @@ echo $form->input('currency_id');
echo $form->input('revision', array('type'=>'hidden'));
echo $form->input('delivery_time');
echo $form->input('delivery_time_frame',array('type'=>'select', 'empty'=>'Choose Delivery Time Frame', 'options'=>array('WORKING DAYS'=>'WORKING DAYS', 'WORKING WEEKS'=>'WORKING WEEKS')));
echo $form->input('payment_terms', array('empty'=>'Select the Terms of Payment', 'options' => array(
?>
<div id="paymentTerms">
<?php
echo $form->input('payment_terms_options', array('empty'=>'Select the Terms of Payment', 'options' => array(
'100% Payment with Order' => '100% Payment with Order',
'Net 7 Days for Approved Accounts' => 'Net 7 Days for Approved Accounts',
'Net 14 Days for Approved Accounts' => 'Net 14 Days for Approved Accounts',
'Net 30 Days for Approved Accounts' => 'Net 30 Days for Approved Accounts',
'SEE PAGE 1 FOR DETAILS' => 'SEE PAGE 1 FOR DETAILS'
)));
?>
</div>
<?php echo $form->input('Quote.payment_terms');
echo $form->input('days_valid');
echo $form->input('date_issued_display', array('id'=>'date_issued_display', 'label'=>'Date Issued', 'value'=>$this->element('isEmptyDate', array('date'=>$this->data['Quote']['date_issued']))));
echo $form->input('date_issued', array('type'=>'hidden', 'id'=>'date_issued'));

View file

@ -0,0 +1,3 @@
<php
echo $form->input('payment_terms');
?>

View file

@ -0,0 +1,3 @@
<?php
echo $form->input('Quote.payment_terms');
?>

View file

@ -434,13 +434,22 @@ $(function() {
});
$.get('/quotes/edit/'+quoteID, function(data) {
$("#QuoteDetails").html(data);
$('#QuoteCommercialComments').ckeditor(config);
$("#QuoteDetails").dialog('open');
$("#QuoteDetails").html(data);
$('#QuoteCommercialComments').ckeditor(config);
$("#QuoteDetails").dialog('open');
});
});
// Fairly quick and easy way to make this select box editable. Good enough.
$("#QuotePaymentTermsOptions").live('change', function(data) {
selectedOption = $("#QuotePaymentTermsOptions").val();
$("#QuotePaymentTerms").val(selectedOption);
console.log(selectedOption);
});
$("#generateFirstPage").click(function() {
if($(".firstPage").length == 0) {