Decimal helper added
This commit is contained in:
parent
14dc7de68c
commit
e5edf973fd
|
|
@ -526,7 +526,7 @@ class JobsController extends AppController {
|
|||
if(isset($this->data)) {
|
||||
//$data = json_decode($this->data);
|
||||
|
||||
print_r($this->data);
|
||||
// print_r($this->data);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,13 +96,13 @@ class QuotesController extends AppController {
|
|||
$this->redirect(array('action'=>'index'));
|
||||
}
|
||||
if (!empty($this->data)) {
|
||||
$issuedate = $this->data['Quote']['date_issued'];
|
||||
/*$issuedate = $this->data['Quote']['date_issued'];
|
||||
$issuedate = $issuedate['year'].'-'.$issuedate['month'].'-'.$issuedate['day'];
|
||||
|
||||
$validUntilDate = strtotime($issuedate."+ ".$this->data['Quote']['days_valid']." days");
|
||||
|
||||
$this->data['Quote']['valid_until'] = date('Y-m-d', $validUntilDate);
|
||||
|
||||
*/
|
||||
|
||||
if ($this->Quote->save($this->data)) {
|
||||
|
||||
|
|
|
|||
32
views/helpers/decimal.php
Normal file
32
views/helpers/decimal.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?
|
||||
class DecimalHelper extends AppHelper {
|
||||
|
||||
function formatDecimal($num) {
|
||||
if(floor($num) == $num) { //whole number.
|
||||
$formatted = number_format($num, 0);
|
||||
}
|
||||
else {
|
||||
$formatted = number_format($num, 2);
|
||||
}
|
||||
|
||||
return $this->output($formatted);
|
||||
}
|
||||
|
||||
function formatMoney($number, $cents = 1) { // cents: 0=never, 1=if needed, 2=always
|
||||
if (is_numeric($number)) { // a number
|
||||
if (!$number) { // zero
|
||||
$money = ($cents == 2 ? '0.00' : '0'); // output zero
|
||||
} else { // value
|
||||
if (floor($number) == $number) { // whole number
|
||||
$money = number_format($number, ($cents == 2 ? 2 : 0)); // format
|
||||
} else { // cents
|
||||
$money = number_format(round($number, 2), ($cents == 0 ? 0 : 2)); // format
|
||||
} // integer or decimal
|
||||
} // value
|
||||
return '$'.$money;
|
||||
} // numeric
|
||||
} // formatMoney
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -32,6 +32,9 @@ 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');
|
||||
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']))));
|
||||
|
|
|
|||
|
|
@ -305,6 +305,11 @@ $(function() {
|
|||
});
|
||||
|
||||
|
||||
$("#QuoteDeliveryTimeFrame").live('change', function() {
|
||||
tf = $(this).val();
|
||||
alert(tf);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue