<?php echo $javascript->link('add_costing'); ?>

<div class="costings form">
    <?php echo $form->create('Costing', array('class'=>'cmxform'));?>

   <?php if(isset($product)) {
         $form->input('product_id', array('type'=>'hidden', 'value'=>$product['Product']['id']));
   }

   elseif(isset($line_item)) {
        $form->input('line_item_id', array('type'=>'hidden', 'value'=>$line_item['LineItem']['id']));
       
   }
   ?>

    <?php __('Add Costing to');?>
    <fieldset>
        <legend>Quantity, Unit price, Packing costs</legend>
        <?php
     
        echo $form->input('purchase_currency_id');
        echo $form->input('sale_currency_id', array('default'=>2));
        echo $form->input('quantity');
        echo $form->input('unit_cost_price', array('label'=>'Unit Cost Price<span class="purchaseCurrency"></span>'));
        echo $form->input('our_discount_percent');
        echo $form->input('packing', array('label'=>'Supplier packing cost<span class="purchaseCurrency"></span>'));
        echo $form->input('FobCountryOfExport', array('class'=>'disabled', 'readonly'=>'readonly', 'label'=>'FOB Country of Export<span class="purchaseCurrency"></span>'));
        ?>
    </fieldset>
    <fieldset>
        <legend>Exchange Rate / Conversion</legend>
        <?
        echo $form->input('exchange_rate', array('label'=>'Exchange Rate <span id="exchangeConversion"></span>'));
        ?>

        <? echo $form->input('fob_sale_currency', array('class'=>'disabled', 'readonly'=>'readonly', 'label'=>'Cost<span class="saleCurrency"></span>')); ?>
    </fieldset>

    <fieldset>
        <legend>Customs and Duty</legend>

        <?
        echo $form->input('duty_percent', array('label'=>'Duty Percent (%)<span id="dutyAmount" class="rightHandLabel"></span>'));

        echo $form->input('customs');
        ?>

    </fieldset>


    <fieldset>
        <legend>Shipping Details</legend>
        <?
        echo $form->input('shipping_weight', array('label'=>'Shipping Weight (kilograms)'));
        echo $form->input('shipping_cost', array('label'=>'Shipping Cost<span class="saleCurrency"></span>'));
        ?>

    </fieldset>

    <fieldset>
        <legend>Finance, Misc Costs</legend>
        <?
        echo $form->input('finance_percent', array('label'=>'Finance Percent (%)<span id="financeAmount" class="rightHandLabel"></span>'));
        echo $form->input('misc_costs', array('label'=>'Misc Costs<span class="saleCurrency"></span>'));
        ?>
    </fieldset>

    <fieldset>
        <legend>Total Landed Cost</legend>
        <?
        echo $form->input('total_landed_cost', array('class'=>'disabled', 'readonly'=>'readonly','label'=>'Total Landed Cost<span class="saleCurrency"></span>'));
        ?>
    </fieldset>

    <fieldset>
        <legend>Selling Prices, Gross Profit</legend>
        <?
        echo $form->input('gross_sell_price', array('label'=>'Gross Selling Price<span class="saleCurrency"></span>'));
        echo $form->input('gross_gp_prior_to_discount', array('class'=>'disabled', 'readonly'=>'readonly', 'label'=>'Gross GP prior to discount<span class="saleCurrency"></span>'));
        echo $form->input('sale_discount_percent', array('label'=>'Discount/Commission (%)<span id="saleDiscountAmount" class="rightHandLabel"></span> '));
        echo $form->input('net_sell_price', array('class'=>'disabled', 'readonly'=>'readonly', 'label'=>'Net Selling Price<span class="saleCurrency"></span>'));
        echo $form->input('net_gp_amount', array('class'=>'disabled', 'readonly'=>'readonly', 'label'=>'Net GP Amount<span class="saleCurrency"></span>'));
        echo $form->input('net_gp_percent', array('class'=>'disabled', 'readonly'=>'readonly', 'label'=>'Net GP Percent (%)'));
        echo $form->input('gross_sell_price_each', array('class'=>'disabled', 'readonly'=>'readonly', 'label'=>'Gross Sell Price Each<span class="saleCurrency"></span>'));
        echo $form->input('net_sell_price_each', array('class'=>'disabled','readonly'=>'readonly', 'label'=>'Net Sell Price Each<span class="saleCurrency"></span>'));

        ?>
    </fieldset>

    <?

    ?>
<?php
echo $form->input('duty_amount', array('type'=>'hidden'));
echo $form->input('finance_amount', array('type'=>'hidden'));
echo $form->input('sale_discount_amount', array('type'=>'hidden'));



echo $form->end('Submit');?>
</div>
<div class="actions">
    <ul>
        <li><?php echo $html->link(__('List Costings', true), array('action' => 'index'));?></li>
        <li><?php echo $html->link(__('List Products', true), array('controller' => 'products', 'action' => 'index')); ?> </li>
        <li><?php echo $html->link(__('New Product', true), array('controller' => 'products', 'action' => 'add')); ?> </li>
        <li><?php echo $html->link(__('List Line Items', true), array('controller' => 'line_items', 'action' => 'index')); ?> </li>
        <li><?php echo $html->link(__('New Line Item', true), array('controller' => 'line_items', 'action' => 'add')); ?> </li>
        <li><?php echo $html->link(__('List Currencies', true), array('controller' => 'currencies', 'action' => 'index')); ?> </li>
        <li><?php echo $html->link(__('New Purchase Currency', true), array('controller' => 'currencies', 'action' => 'add')); ?> </li>
    </ul>
</div>
