Beispiel #1
0
<?php

/*
 * Example PHP implementation used for the index.html example
 */
// DataTables PHP library
include "../../php/DataTables.php";
// Alias Editor classes so they are easy to use
use DataTables\Editor, DataTables\Editor\Field, DataTables\Editor\Format, DataTables\Editor\Mjoin, DataTables\Editor\Upload, DataTables\Editor\Validate;
// Build our Editor instance and process the data coming from _POST
Editor::inst($db, 'users')->fields(Field::inst('users.first_name'), Field::inst('users.last_name'), Field::inst('users.phone'), Field::inst('users.site')->options('sites', 'id', 'name'), Field::inst('sites.name'))->join(Mjoin::inst('files')->link('users.id', 'users_files.user_id')->link('files.id', 'users_files.file_id')->fields(Field::inst('id')->upload(Upload::inst($_SERVER['DOCUMENT_ROOT'] . '/upload/__ID__.__EXTN__')->db('files', 'id', array('filename' => Upload::DB_FILE_NAME, 'filesize' => Upload::DB_FILE_SIZE, 'web_path' => Upload::DB_WEB_PATH, 'system_path' => Upload::DB_SYSTEM_PATH))->validator(function ($file) {
    return $file['size'] >= 50000 ? "Files must be smaller than 50K" : null;
})->allowedExtensions(['png', 'jpg'], "Please upload an image"))))->leftJoin('sites', 'sites.id', '=', 'users.site')->process($_POST)->json();
Beispiel #2
0
    $instrument_id = $values['ledger']['instrument_id'];
    $trade_currency = $values['ledger']['currency'];
    $portfolios = Portfolios::model()->findByPk($portfolio_id);
    $portfolio_currency = $portfolios->currency;
    //Returns::model()->calculateIinstrumnetReturn($instrument_id, $portfolio_id = 0, $trade_rate, $trade_currency, $client_id, $portfolio_currency);
    //PortfolioReturns::model()->PortfolioReturnsUpdate($portfolio_id);
    //$trade_rate, $trade_currency,
    Returns::model()->calculateIinstrumnetReturn($instrument_id, $portfolio_id, $client_id, $portfolio_currency);
    $step_completed = $user_data->step_completed;
    if ($user_data->user_role == 2 && $step_completed < 5) {
        $user_data->step_completed = 5;
        $user_data->save();
    }
}
//Build our Editor instance and process the data coming from _POST
$time = date("fYhis");
// $extension = end(explode('.', Upload::DB_FILE_NAME));
Editor::inst($db, 'ledger', 'id', $time, $client_id)->fields(Field::inst('instruments.instrument'), Field::inst('portfolios.portfolio'), Field::inst('prof1.lastname'), Field::inst('prof1.firstname'), Field::inst('prof2.lastname'), Field::inst('prof2.firstname'), Field::inst('trade_status.trade_status'), Field::inst('ledger.id')->validator('Validate::notEmpty'), Field::inst('ledger.instrument_id')->validator('Validate::notEmpty'), Field::inst('ledger.portfolio_id')->validator('Validate::notEmpty'), Field::inst('ledger.nominal'), Field::inst('ledger.created_by'), Field::inst('ledger.created_at'), Field::inst('ledger.trade_status_id'), Field::inst('ledger.version_number'), Field::inst('ledger.custody_account'), Field::inst('ledger.custody_comment'), Field::inst('ledger.account_number'), Field::inst('ledger.is_current'), Field::inst('ledger.confirmed_at'), Field::inst('ledger.client_id'), Field::inst('ledger.trade_code as trade_code'), Field::inst('ledger.note'), Field::inst('ledger.currency'), Field::inst('ledger.currency_rate'), Field::inst('ledger.file')->setFormatter('Format::ifEmpty', null)->upload(Upload::inst('uploads/' . $time . '.__EXTN__')->db('documents', 'file', array('document_name' => Upload::DB_FILE_NAME, 'filesize' => Upload::DB_FILE_SIZE, 'web_path' => Upload::DB_WEB_PATH, 'system_path' => Upload::DB_SYSTEM_PATH, 'extension' => Upload::DB_EXTN, 'file' => $time, 'document_type_id' => 1))->validator(function ($file) {
    return $file['size'] >= 250000 ? "Files must be smaller than 250KB" : null;
})->allowedExtensions(['png', 'jpg', 'gif', 'xlsx', 'pdf', 'doc', 'xls', 'docx'], "Please upload document with correct format")), Field::inst('documents.id'), Field::inst('documents.document_name'), Field::inst('documents.filesize'), Field::inst('documents.web_path'), Field::inst('documents.system_path'), Field::inst('documents.file'), Field::inst('documents.extension'), Field::inst('trade_types.trade_type'), Field::inst('ledger.trade_type'), Field::inst('ledger.confirmed_by')->validator('Validate::numeric')->setFormatter('Format::ifEmpty', null), Field::inst('ledger.price')->validator('Validate::numeric')->setFormatter('Format::ifEmpty', null), Field::inst('ledger.trade_date')->validator('Validate::dateFormat', array("format" => Format::DATE_ISO_8601, "message" => "Please enter a date in the format yyyy-mm-dd"))->getFormatter('Format::date_sql_to_format', Format::DATE_ISO_8601)->setFormatter('Format::date_format_to_sql', Format::DATE_ISO_8601))->on('preCreate', function ($editor, $values) {
    newledger($editor, $values);
})->on('preEdit', function ($editor, $id, $values) {
    editledger($editor, $id, $values);
})->on('postCreate', function ($editor, $id, $values, $row) {
    portfolioUpdateoncreate($id, $values);
})->on('postEdit', function ($editor, $id, $values, $row) {
    //logChange( $editor->db(), 'edit', $id, $values );
    portfolioUpdate($id, $values);
})->on('postRemove', function ($editor, $id, $values) {
    portfolioUpdate($id, $values);
})->leftJoin('instruments', 'instruments.id', '=', 'ledger.instrument_id')->leftJoin('portfolios', 'portfolios.id', '=', 'ledger.portfolio_id')->leftJoin('profiles as prof1', 'prof1.user_id', '=', 'ledger.created_by')->leftJoin('profiles as prof2', 'prof2.user_id', '=', 'ledger.confirmed_by')->leftJoin('trade_status', 'trade_status.id', '=', 'ledger.trade_status_id')->leftJoin('trade_types', 'trade_types.id', '=', 'ledger.trade_type')->leftJoin('documents', 'documents.id', '=', 'ledger.file')->where('ledger.client_id', $client_id)->where('ledger.is_current', 1)->process($_POST)->json();
Beispiel #3
0
<?php

/*
 * Example PHP implementation used for the index.html example
 */
// DataTables PHP library
include "../../php/DataTables.php";
// Alias Editor classes so they are easy to use
use DataTables\Editor, DataTables\Editor\Field, DataTables\Editor\Format, DataTables\Editor\Join, DataTables\Editor\Upload, DataTables\Editor\Validate;
// Build our Editor instance and process the data coming from _POST
Editor::inst($db, 'users')->fields(Field::inst('first_name'), Field::inst('last_name'), Field::inst('phone'), Field::inst('city'), Field::inst('image')->setFormatter('Format::nullEmpty')->upload(Upload::inst($_SERVER['DOCUMENT_ROOT'] . '/upload/__ID__.__EXTN__')->db('files', 'id', array('filename' => Upload::DB_FILE_NAME, 'filesize' => Upload::DB_FILE_SIZE, 'web_path' => Upload::DB_WEB_PATH, 'system_path' => Upload::DB_SYSTEM_PATH))->validator(function ($file) {
    return $file['size'] >= 50000 ? "Files must be smaller than 50K" : null;
})->allowedExtensions(['png', 'jpg', 'gif'], "Please upload an image")))->process($_POST)->json();
Beispiel #4
0
               $new_trade->save();
               //var_dump($new_trade->getErrors());
               //exit;
               
               $editor->field( 'ledger.is_current' )->setValue( 0 );
               $editor->field( 'ledger.trade_status_id' )->setValue( $existing_trades->trade_status_id );
               $editor->field( 'ledger.trade_date' )->setValue( $existing_trades->trade_date );
               $editor->field( 'ledger.instrument_id' )->setValue( $existing_trades->instrument_id );
               $editor->field( 'ledger.portfolio_id' )->setValue( $existing_trades->portfolio_id );
               $editor->field( 'ledger.nominal' )->setValue( $existing_trades->nominal );
               $editor->field( 'ledger.price' )->setValue( $existing_trades->price ); 
               $editor->field( 'trade_code' )->setValue( $trade_code ); 
         }else{
               $editor
                   ->field( 'ledger.trade_status_id' )
                   ->setValue( $trade_status_id );
               $editor
                   ->field( 'ledger.is_current' )
                   ->setValue( $is_current );
               $editor
                   ->field( 'trade_code' )
                   ->setValue( $trade_code );
         }
   } 
*/
//Build our Editor instance and process the data coming from _POST
$time = date("fYhis");
// $extension = end(explode('.', Upload::DB_FILE_NAME));
Editor::inst($db, 'counterparties', 'id', $time, $client_id)->fields(Field::inst('clients.client_name'), Field::inst('counterparties.id')->validator('Validate::notEmpty'), Field::inst('counterparties.name')->validator('Validate::notEmpty'), Field::inst('counterparties.client_id')->validator('Validate::notEmpty'), Field::inst('counterparties.contact_person'), Field::inst('counterparties.contact_tel'), Field::inst('counterparties.contact_mail'), Field::inst('counterparties.address'), Field::inst('counterparties.file')->setFormatter('Format::ifEmpty', null)->upload(Upload::inst('uploads/' . $time . '.__EXTN__')->db('documents', 'file', array('document_name' => Upload::DB_FILE_NAME, 'filesize' => Upload::DB_FILE_SIZE, 'web_path' => Upload::DB_WEB_PATH, 'system_path' => Upload::DB_SYSTEM_PATH, 'extension' => Upload::DB_EXTN, 'file' => $time))->validator(function ($file) {
    return $file['size'] >= 250000 ? "Files must be smaller than 250KB" : null;
})->allowedExtensions(['png', 'jpg', 'gif', 'xlsx', 'pdf', 'doc', 'xls', 'docx'], "Please upload document with correct format")), Field::inst('documents.id'), Field::inst('documents.document_name'), Field::inst('documents.filesize'), Field::inst('documents.web_path'), Field::inst('documents.system_path'), Field::inst('documents.file'), Field::inst('documents.extension'))->leftJoin('clients', 'clients.id', '=', 'counterparties.client_id')->leftJoin('documents', 'documents.id', '=', 'counterparties.file')->where('counterparties.client_id', $client_id)->process($_POST)->json();