<script type="text/javascript">
    $(function() {
	$("button").button();


	$('#valid_until_display').datepicker({
	    showButtonPanel: true,
	    dateFormat: 'd M yy',
	    altFormat: 'yy-mm-dd',
	    altField: '#valid_until'

	});

	$('#date_issued_display').datepicker({
	    showButtonPanel: true,
	    dateFormat: 'd M yy',
	    altFormat: 'yy-mm-dd',
	    altField: '#date_issued',
	    onSelect: function(date, inst) {
		issueDate = $('#date_issued_display').datepicker("getDate");
		daysValid = $("#QuoteDaysValid").val();
		validUntilDate = new Date();
		daysValid = parseInt(issueDate.getDate()) + parseInt(daysValid);
		validUntilDate.setFullYear(issueDate.getFullYear(), issueDate.getMonth(), daysValid);
		$("#valid_until_display").datepicker("setDate", validUntilDate);

	    }

	});





    });

</script>
<?php

$exworksCMC = array('Ex Works Incoterms 2010 (CMC Technologies, Alexandria, NSW Australia)' => 'Ex Works Incoterms 2010 (CMC Technologies, Alexandria, NSW Australia)');

$deliveryOptions = array_merge($exworksCMC, $cityCountryList);


echo $form->create('Quote',array('default'=>false));

echo $form->input('id');
echo $form->input('enquiry_id', array('type'=>'hidden'));
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(
	'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'
)));
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'));
echo $form->input('valid_until_display', array('id'=>'valid_until_display', 'label'=>'Valid Until', 'value'=>$this->element('isEmptyDate', array('date'=>$this->data['Quote']['valid_until']))));
echo $form->input('valid_until', array('type'=>'hidden', 'id'=>'valid_until'));
echo $form->input('delivery_point', array('type'=>'select', 'options'=>$deliveryOptions));
echo $form->input('exchange_rate', array('default'=>'NOT APPLICABLE, FIXED PRICE QUOTED'));
echo $form->input('customs_duty');
echo $form->input('document_id',array('type'=>'hidden'));
echo $form->input('commercial_comments', array('between'=>'<button class="generateCommercialComments">(re)Generate Commercial Comments</button>'));
echo $form->end();


?>