本文整理汇总了PHP中ParseFloat函数的典型用法代码示例。如果您正苦于以下问题:PHP ParseFloat函数的具体用法?PHP ParseFloat怎么用?PHP ParseFloat使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ParseFloat函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postEdit
/**
* postEdit
*
* @param null $assetMaintenanceId
*
* @return mixed
* @author Vincent Sposato <vincent.sposato@gmail.com>
* @version v1.0
*/
public function postEdit($assetMaintenanceId = null)
{
// get the POST data
$new = Input::all();
// Check if the asset maintenance exists
if (is_null($assetMaintenance = AssetMaintenance::find($assetMaintenanceId))) {
// Redirect to the asset maintenance management page
return Redirect::to('admin/asset_maintenances')->with('error', Lang::get('admin/asset_maintenances/message.not_found'));
}
// attempt validation
if ($assetMaintenance->validate($new)) {
if (e(Input::get('supplier_id')) == '') {
$assetMaintenance->supplier_id = null;
} else {
$assetMaintenance->supplier_id = e(Input::get('supplier_id'));
}
if (e(Input::get('is_warranty')) == '') {
$assetMaintenance->is_warranty = 0;
} else {
$assetMaintenance->is_warranty = e(Input::get('is_warranty'));
}
if (e(Input::get('cost')) == '') {
$assetMaintenance->cost = '';
} else {
$assetMaintenance->cost = ParseFloat(e(Input::get('cost')));
}
if (e(Input::get('notes')) == '') {
$assetMaintenance->notes = null;
} else {
$assetMaintenance->notes = e(Input::get('notes'));
}
// Save the asset maintenance data
$assetMaintenance->asset_id = e(Input::get('asset_id'));
$assetMaintenance->asset_maintenance_type = e(Input::get('asset_maintenance_type'));
$assetMaintenance->title = e(Input::get('title'));
$assetMaintenance->start_date = e(Input::get('start_date'));
$assetMaintenance->completion_date = e(Input::get('completion_date'));
if ($assetMaintenance->completion_date == "" || $assetMaintenance->completion_date == "0000-00-00") {
$assetMaintenance->completion_date = null;
if ($assetMaintenance->asset_maintenance_time !== 0 || !is_null($assetMaintenance->asset_maintenance_time)) {
$assetMaintenance->asset_maintenance_time = null;
}
}
if ($assetMaintenance->completion_date !== "" && $assetMaintenance->completion_date !== "0000-00-00" && $assetMaintenance->start_date !== "" && $assetMaintenance->start_date !== "0000-00-00") {
$startDate = Carbon::parse($assetMaintenance->start_date);
$completionDate = Carbon::parse($assetMaintenance->completion_date);
$assetMaintenance->asset_maintenance_time = $completionDate->diffInDays($startDate);
}
// Was the asset maintenance created?
if ($assetMaintenance->save()) {
// Redirect to the new asset maintenance page
return Redirect::to("admin/asset_maintenances")->with('success', Lang::get('admin/asset_maintenances/message.create.success'));
}
} else {
// failure
$errors = $assetMaintenance->errors();
return Redirect::back()->withInput()->withErrors($errors);
}
// Redirect to the improvement create page
return Redirect::to('admin/asset_maintenances/edit')->with('error', Lang::get('admin/asset_maintenances/message.create.error'))->with('assetMaintenance', $assetMaintenance);
}
示例2: postEdit
/**
* Asset update form processing page.
*
* @param int $assetId
* @return Redirect
*/
public function postEdit($assetId = null)
{
// Check if the asset exists
if (is_null($asset = Asset::find($assetId))) {
// Redirect to the asset management page with error
return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
}
//attempt to validate
$validator = Validator::make(Input::all(), $asset->validationRules($assetId));
if ($validator->fails()) {
// The given data did not pass validation
return Redirect::back()->withInput()->withErrors($validator->messages());
} else {
if (e(Input::get('status_id')) == '') {
$asset->status_id = NULL;
} else {
$asset->status_id = e(Input::get('status_id'));
}
if (e(Input::get('warranty_months')) == '') {
$asset->warranty_months = NULL;
} else {
$asset->warranty_months = e(Input::get('warranty_months'));
}
if (e(Input::get('purchase_cost')) == '') {
$asset->purchase_cost = NULL;
} else {
$asset->purchase_cost = ParseFloat(e(Input::get('purchase_cost')));
}
if (e(Input::get('purchase_date')) == '') {
$asset->purchase_date = NULL;
} else {
$asset->purchase_date = e(Input::get('purchase_date'));
}
if (e(Input::get('supplier_id')) == '') {
$asset->supplier_id = NULL;
} else {
$asset->supplier_id = e(Input::get('supplier_id'));
}
if (e(Input::get('requestable')) == '') {
$asset->requestable = 0;
} else {
$asset->requestable = e(Input::get('requestable'));
}
// Update the asset data
$asset->name = e(Input::get('name'));
$asset->serial = e(Input::get('serial'));
$asset->model_id = e(Input::get('model_id'));
$asset->order_number = e(Input::get('order_number'));
$asset->asset_tag = e(Input::get('asset_tag'));
$asset->notes = e(Input::get('notes'));
$asset->physical = '1';
// Was the asset updated?
if ($asset->save()) {
// Redirect to the new asset page
return Redirect::to("hardware/{$assetId}/view")->with('success', Lang::get('admin/hardware/message.update.success'));
} else {
return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
}
}
// Redirect to the asset management page with error
return Redirect::to("hardware/{$assetId}/edit")->with('error', Lang::get('admin/hardware/message.update.error'));
}
示例3: postEdit
/**
* License update form processing page.
*
* @param int $licenseId
* @return Redirect
*/
public function postEdit($licenseId = null)
{
// Check if the license exists
if (is_null($license = License::find($licenseId))) {
// Redirect to the blogs management page
return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.does_not_exist'));
}
// get the POST data
$new = Input::all();
// attempt validation
if ($license->validate($new)) {
// Update the license data
$license->name = e(Input::get('name'));
$license->serial = e(Input::get('serial'));
$license->license_email = e(Input::get('license_email'));
$license->license_name = e(Input::get('license_name'));
$license->notes = e(Input::get('notes'));
$license->order_number = e(Input::get('order_number'));
$license->depreciation_id = e(Input::get('depreciation_id'));
$license->purchase_order = e(Input::get('purchase_order'));
$license->maintained = e(Input::get('maintained'));
$license->reassignable = e(Input::get('reassignable'));
$license->type_id = e(Input::get('type_id'));
$license->role_id = e(Input::get('role_id'));
// Update the asset data
if (e(Input::get('purchase_date')) == '') {
$license->purchase_date = NULL;
} else {
$license->purchase_date = e(Input::get('purchase_date'));
}
if (e(Input::get('expiration_date')) == '') {
$license->expiration_date = NULL;
} else {
$license->expiration_date = e(Input::get('expiration_date'));
}
// Update the asset data
if (e(Input::get('termination_date')) == '') {
$license->termination_date = NULL;
} else {
$license->termination_date = e(Input::get('termination_date'));
}
if (e(Input::get('purchase_cost')) == '') {
$license->purchase_cost = NULL;
} else {
$license->purchase_cost = ParseFloat(e(Input::get('purchase_cost')));
//$license->purchase_cost = e(Input::get('purchase_cost'));
}
if (e(Input::get('maintained')) == '') {
$license->maintained = 0;
} else {
$license->maintained = e(Input::get('maintained'));
}
if (e(Input::get('reassignable')) == '') {
$license->reassignable = 0;
} else {
$license->reassignable = e(Input::get('reassignable'));
}
if (e(Input::get('purchase_order')) == '') {
$license->purchase_order = '';
} else {
$license->purchase_order = e(Input::get('purchase_order'));
}
//Are we changing the total number of seats?
if ($license->seats != e(Input::get('seats'))) {
//Determine how many seats we are dealing with
$difference = e(Input::get('seats')) - $license->licenseseats()->count();
if ($difference < 0) {
//Filter out any license which have a user attached;
$seats = $license->licenseseats->filter(function ($seat) {
return is_null($seat->user);
});
//If the remaining collection is as large or larger than the number of seats we want to delete
if ($seats->count() >= abs($difference)) {
for ($i = 1; $i <= abs($difference); $i++) {
//Delete the appropriate number of seats
$seats->pop()->delete();
}
//Log the deletion of seats to the log
$logaction = new Actionlog();
$logaction->asset_id = $license->id;
$logaction->asset_type = 'software';
$logaction->user_id = Sentry::getUser()->id;
$logaction->note = abs($difference) . " seats";
$logaction->checkedout_to = NULL;
$log = $logaction->logaction('delete seats');
} else {
// Redirect to the license edit page
return Redirect::to("admin/licenses/{$licenseId}/edit")->with('error', Lang::get('admin/licenses/message.assoc_users'));
}
} else {
for ($i = 1; $i <= $difference; $i++) {
//Create a seat for this license
$license_seat = new LicenseSeat();
$license_seat->license_id = $license->id;
//.........这里部分代码省略.........
示例4: substr
//Veririfica se a linha é um boleto
if ($comeco == "15209") {
//Monta a string do boleto
$numero_boleto = substr($linhas, 3, 17);
//Monta a string do valor
$valor_float = substr($linhas, 95, 11);
//Converte a string para um decimal
$valor_boleto = number_format(ParseFloat($valor_float), 2, ",", ".");
//Monta a string do valor dos juros
$valor_juros_float = substr($linhas, 115, 10);
//Converte a string para um decimal
$valor_juros_boleto = number_format(ParseFloat($valor_juros_float), 2, ",", ".");
//echo $valor_boleto . "<br/>";
//echo $valor_juros_boleto . "<br/>";
$valor_retorno = number_format(ParseFloat($valor_float) + ParseFloat($valor_juros_float), 2, ",", ".");
$valor_retorno_compara = number_format(ParseFloat($valor_float) + ParseFloat($valor_juros_float), 2, ".", "");
$total_retorno = $total_retorno + $valor_retorno_compara;
//Busca no banco de dados se existe o boleto
//Monta a query para pegar os dados
$sql_cli = "SELECT * FROM boleto WHERE nosso_numero = '{$numero_boleto}'";
//Executa a query
$query_cli = mysql_query($sql_cli);
//Conta o numero de registros da query
$registros_cli = mysql_num_rows($query_cli);
//Caso não houver registros
if ($registros_cli == 0) {
$sacado = "<span style='color: #990000'><b>BOLETO NÃO ENCONTRADO !!!</b></span>";
$cor_celula = "#F0D9D9";
$marca_boleto = '';
$desativa_chk = "disabled='disabled'";
$valor_sacado = "R\$ 0,00";
示例5: postEdit
/**
* Accessory update form processing page.
*
* @param int $accessoryId
* @return Redirect
*/
public function postEdit($accessoryId = null)
{
// Check if the blog post exists
if (is_null($accessory = Accessory::find($accessoryId))) {
// Redirect to the blogs management page
return Redirect::to('admin/accessories')->with('error', Lang::get('admin/accessories/message.does_not_exist'));
} else {
if (!Company::isCurrentUserHasAccess($accessory)) {
return Redirect::to('admin/accessories')->with('error', Lang::get('general.insufficient_permissions'));
}
}
// get the POST data
$new = Input::all();
// attempt validation
$validator = Validator::make(Input::all(), $accessory->validationRules($accessoryId));
if ($validator->fails()) {
// The given data did not pass validation
return Redirect::back()->withInput()->withErrors($validator->messages());
} else {
// Update the accessory data
$accessory->name = e(Input::get('name'));
$accessory->location_id = e(Input::get('location_id'));
$accessory->category_id = e(Input::get('category_id'));
$accessory->company_id = Company::getIdForCurrentUser(Input::get('company_id'));
$accessory->order_number = e(Input::get('order_number'));
if (e(Input::get('purchase_date')) == '') {
$accessory->purchase_date = NULL;
} else {
$accessory->purchase_date = e(Input::get('purchase_date'));
}
if (e(Input::get('purchase_cost')) == '0.00') {
$accessory->purchase_cost = NULL;
} else {
$accessory->purchase_cost = ParseFloat(e(Input::get('purchase_cost')));
}
$accessory->qty = e(Input::get('qty'));
// Was the accessory created?
if ($accessory->save()) {
// Redirect to the new accessory page
return Redirect::to("admin/accessories")->with('success', Lang::get('admin/accessories/message.update.success'));
}
}
// Redirect to the accessory management page
return Redirect::to("admin/accessories/{$accessoryID}/edit")->with('error', Lang::get('admin/accessories/message.update.error'));
}
示例6: postEdit
/**
* Asset update form processing page.
*
* @param int $assetId
* @return Redirect
*/
public function postEdit($assetId = null)
{
// Check if the asset exists
if (is_null($asset = Asset::find($assetId))) {
// Redirect to the asset management page with error
return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
} else {
if (!Company::isCurrentUserHasAccess($asset)) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
}
}
//attempt to validate
$validator = Validator::make(Input::all(), $asset->validationRules($assetId));
if ($validator->fails()) {
// The given data did not pass validation
return Redirect::back()->withInput()->withErrors($validator->messages());
} else {
if (e(Input::get('status_id')) == '') {
$asset->status_id = NULL;
} else {
$asset->status_id = e(Input::get('status_id'));
}
if (e(Input::get('warranty_months')) == '') {
$asset->warranty_months = NULL;
} else {
$asset->warranty_months = e(Input::get('warranty_months'));
}
if (e(Input::get('purchase_cost')) == '') {
$asset->purchase_cost = NULL;
} else {
$asset->purchase_cost = ParseFloat(e(Input::get('purchase_cost')));
}
if (e(Input::get('purchase_date')) == '') {
$asset->purchase_date = NULL;
} else {
$asset->purchase_date = e(Input::get('purchase_date'));
}
if (e(Input::get('supplier_id')) == '') {
$asset->supplier_id = NULL;
} else {
$asset->supplier_id = e(Input::get('supplier_id'));
}
if (e(Input::get('requestable')) == '') {
$asset->requestable = 0;
} else {
$asset->requestable = e(Input::get('requestable'));
}
if (e(Input::get('rtd_location_id')) == '') {
$asset->rtd_location_id = 0;
} else {
$asset->rtd_location_id = e(Input::get('rtd_location_id'));
}
$checkModel = Config::get('app.url') . '/api/models/' . e(Input::get('model_id')) . '/check';
$asset->mac_address = $checkModel == true ? e(Input::get('mac_address')) : NULL;
// Update the asset data
$asset->name = e(Input::get('name'));
$asset->serial = e(Input::get('serial'));
$asset->company_id = Company::getIdForCurrentUser(Input::get('company_id'));
$asset->model_id = e(Input::get('model_id'));
$asset->order_number = e(Input::get('order_number'));
$asset->asset_tag = e(Input::get('asset_tag'));
$asset->notes = e(Input::get('notes'));
$asset->physical = '1';
// Update the image
if (Input::file('image')) {
$image = Input::file('image');
$file_name = str_random(25) . "." . $image->getClientOriginalExtension();
$path = public_path('uploads/assets/' . $file_name);
Image::make($image->getRealPath())->resize(300, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
$asset->image = $file_name;
}
// Was the asset updated?
if ($asset->save()) {
// Redirect to the new asset page
return Redirect::to("hardware/{$assetId}/view")->with('success', Lang::get('admin/hardware/message.update.success'));
} else {
return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
}
}
// Redirect to the asset management page with error
return Redirect::to("hardware/{$assetId}/edit")->with('error', Lang::get('admin/hardware/message.update.error'));
}
示例7: postEdit
/**
* Asset update form processing page.
*
* @param int $assetId
* @return Redirect
*/
public function postEdit($assetId = null)
{
// Check if the asset exists
if (is_null($asset = Asset::find($assetId))) {
// Redirect to the asset management page with error
return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
} else {
if (!Company::isCurrentUserHasAccess($asset)) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
}
}
$input = Input::all();
// return "INPUT IS: <pre>".print_r($input,true)."</pre>";
$rules = $asset->validationRules($assetId);
$model = Model::find(e(Input::get('model_id')));
//validate by the NEW model's custom fields, not the current one
if ($model->fieldset) {
foreach ($model->fieldset->fields as $field) {
$input[$field->db_column_name()] = $input['fields'][$field->db_column_name()];
$asset->{$field->db_column_name()} = $input[$field->db_column_name()];
}
$rules += $model->fieldset->validation_rules();
unset($input['fields']);
}
//return "Rules: <pre>".print_r($rules,true)."</pre>";
//attempt to validate
$validator = Validator::make($input, $rules);
$custom_errors = [];
if ($validator->fails()) {
// The given data did not pass validation
return Redirect::back()->withInput()->withErrors($validator->messages());
} else {
if (e(Input::get('status_id')) == '') {
$asset->status_id = NULL;
} else {
$asset->status_id = e(Input::get('status_id'));
}
if (e(Input::get('warranty_months')) == '') {
$asset->warranty_months = NULL;
} else {
$asset->warranty_months = e(Input::get('warranty_months'));
}
if (e(Input::get('purchase_cost')) == '') {
$asset->purchase_cost = NULL;
} else {
$asset->purchase_cost = ParseFloat(e(Input::get('purchase_cost')));
}
if (e(Input::get('purchase_date')) == '') {
$asset->purchase_date = NULL;
} else {
$asset->purchase_date = e(Input::get('purchase_date'));
}
if (e(Input::get('supplier_id')) == '') {
$asset->supplier_id = NULL;
} else {
$asset->supplier_id = e(Input::get('supplier_id'));
}
if (e(Input::get('requestable')) == '') {
$asset->requestable = 0;
} else {
$asset->requestable = e(Input::get('requestable'));
}
if (e(Input::get('rtd_location_id')) == '') {
$asset->rtd_location_id = 0;
} else {
$asset->rtd_location_id = e(Input::get('rtd_location_id'));
}
if (Input::has('image_delete')) {
unlink(public_path() . '/uploads/assets/' . $asset->image);
$asset->image = '';
}
$checkModel = Config::get('app.url') . '/api/models/' . e(Input::get('model_id')) . '/check';
//$asset->mac_address = ($checkModel == true) ? e(Input::get('mac_address')) : NULL;
// Update the asset data
$asset->name = e(Input::get('name'));
$asset->serial = e(Input::get('serial'));
$asset->company_id = Company::getIdForCurrentUser(Input::get('company_id'));
$asset->model_id = e(Input::get('model_id'));
$asset->order_number = e(Input::get('order_number'));
$asset->asset_tag = e(Input::get('asset_tag'));
$asset->notes = e(Input::get('notes'));
$asset->physical = '1';
// Update the image
if (Input::file('image')) {
$image = Input::file('image');
$file_name = str_random(25) . "." . $image->getClientOriginalExtension();
$path = public_path('uploads/assets/' . $file_name);
Image::make($image->getRealPath())->resize(300, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
$asset->image = $file_name;
}
// Was the asset updated?
//.........这里部分代码省略.........
示例8: fire
//.........这里部分代码省略.........
}
// Check for the category match and create it if it doesn't exist
if ($category = Category::where('name', e($category_name))->where('category_type', 'asset')->first()) {
$this->comment('Category ' . $category_name . ' already exists');
} else {
$category = new Category();
$category->name = e($category_name);
$category->category_type = 'asset';
$category->user_id = 1;
if ($category->save()) {
$this->comment('Category ' . $user_asset_category . ' was created');
} else {
$this->comment('Something went wrong! Category ' . $user_asset_category . ' was NOT created');
}
}
// Check for the manufacturer match and create it if it doesn't exist
if ($manufacturer = Manufacturer::where('name', e($user_asset_mfgr))->first()) {
$this->comment('Manufacturer ' . $user_asset_mfgr . ' already exists');
} else {
$manufacturer = new Manufacturer();
$manufacturer->name = e($user_asset_mfgr);
$manufacturer->user_id = 1;
if ($manufacturer->save()) {
$this->comment('Manufacturer ' . $user_asset_mfgr . ' was created');
} else {
$this->comment('Something went wrong! Manufacturer ' . $user_asset_mfgr . ' was NOT created');
}
}
// Check for the asset model match and create it if it doesn't exist
if ($asset_model = Model::where('name', e($user_asset_name))->where('modelno', e($user_asset_modelno))->where('category_id', $category->id)->where('manufacturer_id', $manufacturer->id)->first()) {
$this->comment('The Asset Model ' . $user_asset_name . ' with model number ' . $user_asset_modelno . ' already exists');
} else {
$asset_model = new Model();
$asset_model->name = e($user_asset_name);
$asset_model->manufacturer_id = $manufacturer->id;
$asset_model->modelno = e($user_asset_modelno);
$asset_model->category_id = $category->id;
$asset_model->user_id = 1;
if ($asset_model->save()) {
$this->comment('Asset Model ' . $user_asset_name . ' with model number ' . $user_asset_modelno . ' was created');
} else {
$this->comment('Something went wrong! Asset Model ' . $user_asset_name . ' was NOT created');
}
}
// Check for the asset company match and create it if it doesn't exist
if ($user_asset_company_name != '') {
if ($company = Company::where('name', e($user_asset_company_name))->first()) {
$this->comment('Company ' . $user_asset_company_name . ' already exists');
} else {
$company = new Company();
$company->name = e($user_asset_company_name);
if ($company->save()) {
$this->comment('Company ' . $user_asset_company_name . ' was created');
} else {
$this->comment('Something went wrong! Company ' . $user_asset_company_name . ' was NOT created');
}
}
} else {
$company = new Company();
}
// Check for the asset match and create it if it doesn't exist
if ($asset = Asset::where('asset_tag', e($user_asset_tag))->first()) {
$this->comment('The Asset with asset tag ' . $user_asset_tag . ' already exists');
} else {
$asset = new Asset();
$asset->name = e($user_asset_asset_name);
if ($user_asset_purchase_date != '') {
$asset->purchase_date = $user_asset_purchase_date;
} else {
$asset->purchase_date = NULL;
}
if ($user_asset_purchase_cost != '') {
$asset->purchase_cost = ParseFloat(e($user_asset_purchase_cost));
} else {
$asset->purchase_cost = 0.0;
}
$asset->serial = e($user_asset_serial);
$asset->asset_tag = e($user_asset_tag);
$asset->model_id = $asset_model->id;
$asset->assigned_to = $user->id;
$asset->rtd_location_id = $location->id;
$asset->user_id = 1;
$asset->status_id = $status_id;
$asset->company_id = $company->id;
if ($user_asset_purchase_date != '') {
$asset->purchase_date = $user_asset_purchase_date;
} else {
$asset->purchase_date = NULL;
}
$asset->notes = e($user_asset_notes);
if ($asset->save()) {
$this->comment('Asset ' . $user_asset_name . ' with serial number ' . $user_asset_serial . ' was created');
} else {
$this->comment('Something went wrong! Asset ' . $user_asset_name . ' was NOT created');
}
}
$this->comment('=====================================');
return true;
});
}
示例9: substr
$i++;
if ($linha > 9) {
$comeco = substr($linhas, 3, 5);
//Veririfica se a linha é um boleto
if ($comeco == "15209") {
//Monta a string do boleto
$numero_boleto = substr($linhas, 3, 17);
//Monta a string do valor
$valor_float = substr($linhas, 95, 11);
//Converte a string para um decimal
$valor_boleto = ParseFloat($valor_float);
$valor_boleto_formata = number_format(ParseFloat($valor_float), 2, ",", ".");
//Monta a string do valor dos juros
$valor_juros_float = substr($linhas, 115, 10);
//Converte a string para um decimal
$valor_juros_boleto = number_format(ParseFloat($valor_juros_float), 2, ",", ".");
//Busca no banco de dados se existe o boleto
//Monta a query para pegar os dados
$sql_cli = "SELECT * FROM boleto WHERE nosso_numero = '{$numero_boleto}' ORDER BY sacado";
//Executa a query
$query_cli = mysql_query($sql_cli);
//Conta o numero de registros da query
$registros_cli = mysql_num_rows($query_cli);
//Caso não houver registros
if ($registros_cli == 0) {
$string_boletos_antigos .= "<br/>Boleto <b>{$numero_boleto}</b> BOLETO NÃO ENCONTRADO - ANTIGOS - REGISTRO BB - NÃO SERÁ PROCESSADO !";
//Gera um lançamento na base de retornos processados com o status de não encontrado (3)
$sql = "INSERT INTO retornos (\n \t\t\tdata_processamento,\n \t\t\ttitulo, \n \t\t\tvalor,\n \t\t\tstatus\n \t\t\t) values (\n \t\t\t'{$dataProcessa}',\n \t\t\t'{$numero_boleto}',\n \t\t\t'{$valor_boleto}',\n \t\t\t'3'\n \t\t\t);";
mysql_query($sql);
} else {
//efetua o loop na pesquisa
示例10: postEdit
/**
* Consumable update form processing page.
*
* @param int $consumableId
* @return Redirect
*/
public function postEdit($consumableId = null)
{
// Check if the blog post exists
if (is_null($consumable = Consumable::find($consumableId))) {
// Redirect to the blogs management page
return Redirect::to('admin/consumables')->with('error', Lang::get('admin/consumables/message.does_not_exist'));
}
// get the POST data
$new = Input::all();
// attempt validation
$validator = Validator::make(Input::all(), $consumable->validationRules($consumableId));
if ($validator->fails()) {
// The given data did not pass validation
return Redirect::back()->withInput()->withErrors($validator->messages());
} else {
// Update the consumable data
$consumable->name = e(Input::get('name'));
$consumable->category_id = e(Input::get('category_id'));
$consumable->order_number = e(Input::get('order_number'));
if (e(Input::get('purchase_date')) == '') {
$consumable->purchase_date = NULL;
} else {
$consumable->purchase_date = e(Input::get('purchase_date'));
}
if (e(Input::get('purchase_cost')) == '0.00') {
$consumable->purchase_cost = NULL;
} else {
$consumable->purchase_cost = ParseFloat(e(Input::get('purchase_cost')));
}
$consumable->qty = e(Input::get('qty'));
// Was the consumable created?
if ($consumable->save()) {
// Redirect to the new consumable page
return Redirect::to("admin/consumables")->with('success', Lang::get('admin/consumables/message.update.success'));
}
}
// Redirect to the consumable management page
return Redirect::to("admin/consumables/{$consumableID}/edit")->with('error', Lang::get('admin/consumables/message.update.error'));
}