public function currency() { $value = 123456.78; $this->data->value = 'Valor = ' . $value; $currency = Manager::currency($value); $this->data->currency = 'Currency = ' . $currency; $formated = $currency->format(); $this->data->formated = 'Formatado = ' . $formated; $currency = Manager::currency($formated); $value = $currency->getValue(); $this->data->getValue = 'Get Value = ' . $value; $currency->setValue(87654321.09); $this->data->setValue = 'Após setValue = ' . $currency; $currency->setValue(-654.3200000000001); $this->data->setValueNeg = 'Após setValue negativo = ' . $currency; $currency = Manager::currency('-R$ 123.345,67'); $value = $currency->getValue(); $this->data->valueNeg = 'Valor negativo = ' . $value; $valor1 = Manager::currency(10.9008900015); $valor2 = Manager::currency(10.9008900017); mdump($valor1->getValue() == $valor2->getValue() ? 'Valores iguais' : 'Valores diferentes'); $valor1 = Manager::currency(10.9018900015); $valor2 = Manager::currency(10.9068900017); mdump($valor1->getValue() == $valor2->getValue() ? 'Valores iguais' : 'Valores diferentes'); $this->render(); }
public function renderCurrencyValue($value) { if (is_numeric($value)) { $v = Manager::currency((double) $value); $value = $v->formatValue(); } return new MLabel($value); }
public function convertToPHPValue($value, $type) { if ($type == 'date') { return \Manager::Date($value); } elseif ($type == 'timestamp') { return \Manager::Timestamp($value); } elseif ($type == 'currency') { return \Manager::currency($value); } elseif ($type == 'cnpj') { return \MCNPJ::create($value); } elseif ($type == 'cpf') { return \MCPF::create($value); } elseif ($type == 'blob') { if ($value) { $value = base64_decode($value); } $value = \MFile::file($value); return $value; } else { return $value; } }
public function formTextField() { $this->data->email = '*****@*****.**'; $this->data->nomeValidator = false; $this->data->currency = Manager::currency(1234.56); $this->data->dataNascimento = Manager::date(Manager::getSysDate()); $this->data->timestamp = Manager::timestamp(Manager::getSysTime()); $this->render(); }
public function convertToPHPValue($value, $type) { if ($type == 'date') { return \Manager::Date($value); } elseif ($type == 'timestamp') { return \Manager::Timestamp($value); } elseif ($type == 'currency') { return \Manager::currency($value); } elseif ($type == 'cnpj') { return \MCNPJ::create($value); } elseif ($type == 'cpf') { return \MCPF::create($value); } elseif ($type == 'currency') { return \Manager::currency($value); } elseif ($type == 'boolean') { return !empty($value); } elseif ($type == 'blob') { if ($value) { $value = stream_get_contents($value); } $value = \MFile::file($value); return $value; } else { return $value; } }
public function convertToPHPValue($value, $type) { if ($type == 'date') { return $value; } elseif ($type == 'timestamp') { return $value; } elseif ($type == 'currency') { return \Manager::currency($value); } elseif ($type == 'cnpj') { return \MCNPJ::create($value); } elseif ($type == 'cpf') { return \MCPF::create($value); } elseif ($type == 'boolean') { return $value; } elseif ($type == 'decimal' || $type == 'float') { return str_replace(',', '.', $value); } elseif ($type == 'blob') { $parsedValue = ''; if (is_resource($value) or is_resource($value->descriptor)) { while (!$value->eof()) { $parsedValue .= $value->read(2000); } $value = \MFile::file($parsedValue); } else { $value = \MFile::file($value); } return $value; } elseif ($type == 'clob') { return is_a($value, '\\OCI-Lob') ? $value->load() : $value; } else { return $value; } }