<div class="jobs form">
<?php echo $javascript->link('addjob'); ?>

<?php echo $form->create('Job');?>
	<fieldset>
 		<legend><?php __('Edit Job: '.$this->data['Job']['title']);?></legend>
	<?php
		//echo $form->input('title');
		echo $form->input('enquiry_id', array('type'=>'hidden'));

		?>


                 <?php
            //format the mySQL date in the nice readable format.
            if($this->data['Job']['date_order_received'] != '0000-00-00') {
               $order_received_time = strtotime($this->data['Job']['date_order_received']); 
               $order_received_readable = date('l j F Y', $order_received_time );
            }
            else {
                $order_received_readable = "";
            }


            if($this->data['Job']['date_order_sent_to_customer'] != '0000-00-00') {
                 $order_sent_to_customer_time = strtotime($this->data['Job']['date_order_sent_to_customer']);
                $order_sent_readable = date('l j F Y', $order_sent_to_customer_time);

            }
            else {

            $order_sent_readable = "";

            }
    

            ?>


                <div class="input text">
                <label for="JobDateOrderReceivedDisplay">Date Order Received by CMC</label>
                <input id="JobDateOrderReceivedDisplay" type="text" value="<?php echo $order_received_readable;?>" class="datePicker">
                </div>


                <div class="input text">
                <label for="JobDateOrderSentToCustomerDisplay">Date Order Sent to Customer</label>
                <input id="JobDateOrderSentToCustomerDisplay" type="text" value="<?php echo $order_sent_readable; ?>" class="datePicker">
                </div>
                <?


                echo $form->input('date_order_received', array('type'=>'hidden'));
		echo $form->input('date_order_placed_on_principle', array('type'=>'hidden'));
		echo $form->input('date_scheduled_ex_works', array('type'=>'hidden'));
		echo $form->input('date_order_sent_to_customer', array('type'=>'hidden'));
		echo $form->input('customer_order_number');
               
		echo $form->input('domestic_freight_paid_by', array('type'=>'select', 'options'=>$freight_paid_options, 'showEmpty'=>true));
		echo $form->input('sale_category', array('type'=>'select', 'options'=>$sale_category_options));
		echo $form->input('shipment_category', array('type'=>'select', 'options'=>$shipment_category_options));
                echo $form->input('id');
                echo $form->input('comments');
	?>
                <div id="financialData">
                    <?
                    echo $form->input('company_gross_sales_aud');
                    echo $form->input('net_sales_aud');
                    echo $form->input('gross_profit_aud');
                    echo $form->input('ato_exchange_rate');
                    echo $form->input('gst');
                    echo $form->input('currency_id');
                    echo $form->input('gst_amount');
                    echo $form->input('gross_commisions');
                    echo $form->input('invoiced_amount_inc_gst');
                    echo $form->input('net_export_sales_aud');
                    echo $form->input('gross_profit_exports_aud');
                    echo $form->input('gp_percent');
                    echo $form->input('gross_australian_sales_foriegn_currency');
                    echo $form->input('net_australian_sales_foreign_currency');
                    echo $form->input('gross_profit_value_australian_sales_foreign_currency');
                    echo $form->input('gross_export_sales_foreign_currency');
                    echo $form->input('net_export_sales_foreign_currency');
                    echo $form->input('gross_profit_value_after_discount_exports_foreign_currency');
                    echo $form->input('gross_commissions');
                    echo $form->input('net_commissions');
                    ?>
                </div>
	</fieldset>
<?php echo $form->end('Submit');?>
</div>
<div class="actions">
	<ul>
		<li><?php echo $html->link(__('List Jobs', true), array('action' => 'index'));?></li>
		<li><?php echo $html->link(__('List States', true), array('controller' => 'states', 'action' => 'index')); ?> </li>
		<li><?php echo $html->link(__('New State', true), array('controller' => 'states', 'action' => 'add')); ?> </li>
		<li><?php echo $html->link(__('List Customers', true), array('controller' => 'customers', 'action' => 'index')); ?> </li>
		<li><?php echo $html->link(__('New Customer', true), array('controller' => 'customers', 'action' => 'add')); ?> </li>
		<li><?php echo $html->link(__('List Enquiries', true), array('controller' => 'enquiries', 'action' => 'index')); ?> </li>
		<li><?php echo $html->link(__('New Enquiry', true), array('controller' => 'enquiries', 'action' => 'add')); ?> </li>
		<li><?php echo $html->link(__('List Contacts', true), array('controller' => 'contacts', 'action' => 'index')); ?> </li>
		<li><?php echo $html->link(__('New Contact', true), array('controller' => 'contacts', 'action' => 'add')); ?> </li>
	</ul>
</div>
