コード例 #1
0
ファイル: employees.php プロジェクト: ratiw/petro-test
 public function setup_index(&$grid)
 {
     $this->sidebars->add('Filters', Petro::render_filters(array('first_name' => array('type' => 'string'), 'last_name' => array('type' => 'string'), 'status' => array('type' => 'select', 'collection' => $this->model))));
     $grid->add_scope('all', 'All');
     $grid->add_scope('working', 'Working', array('status', '=', 1));
     $grid->add_scope('suspend', 'Suspended', array('status', '=', 2));
 }
コード例 #2
0
ファイル: print.php プロジェクト: ratiw/petro-test
 public function action_mk($id = null)
 {
     if ($docmk = Model_DocMK::find($id)) {
         // echo "Document found, this should output some html here.";
         // $pdf = MyDoc::forge('mpdf')->init('th','A4','','garuda' , -5 , 0 , 10 , 0 , 0 , 0, 'P');
         // $pdf->set_display_mode('fullpage');
         // $pdf->list_indent_first_level = 0;
         $pdf = $this->create_doc();
         $data['doc_name'] = 'ใบแจ้งผลิตสินค้า';
         $data['doc_code'] = 'FMMK-010 REV:2-27/01/51';
         $data['mk_no'] = $docmk->mk_no;
         $data['mk_date'] = Petro::to_app_date($docmk->mk_date);
         $data['client'] = Petro_Lookup::get(null, $docmk->client_id, 'clients', 'id', 'name');
         $data['client_po'] = $docmk->client_po;
         $data['delivery_date'] = Petro::to_app_date($docmk->delivery_date);
         $data['belt_type'] = Petro_Lookup::get('belt.type', $docmk->belt_type);
         $data['belt_color'] = Petro_Lookup::get('belt.color', $docmk->belt_color);
         $data['belt_width'] = $docmk->belt_width . ' ' . Petro_Lookup::get('belt.w.unit', $docmk->belt_width_unit);
         $data['belt_ply'] = $docmk->belt_ply . ' ' . 'ชั้น';
         $data['belt_ep'] = Petro_Lookup::get('belt.ep', $docmk->belt_ep);
         $data['belt_thick'] = $docmk->belt_thick . ' (' . $docmk->belt_top_thick . ' + ' . $docmk->belt_bot_thick . ')';
         $data['belt_grade'] = Petro_Lookup::get('belt.grade', $docmk->belt_grade) . ' (' . $docmk->belt_top_grade . '/' . $docmk->belt_bot_grade . ')';
         $data['belt_length'] = $docmk->belt_length . ' ' . Petro_Lookup::get('belt.l.unit', $docmk->belt_length_unit);
         $data['belt_end'] = Petro_Lookup::get('belt.end', $docmk->belt_end);
         $data['belt_qty'] = $docmk->belt_qty . ' ' . 'เส้น';
         $data['remark'] = $docmk->remark;
         $content = View::forge('print/fmmk-010', $data)->render();
         $pdf->write_html($content);
         $pdf->output();
     } else {
         echo "Document not found!";
     }
 }
コード例 #3
0
ファイル: docmk011.php プロジェクト: ratiw/petro-test
 /**
  * View
  */
 public function action_view($id = null)
 {
     $mk011 = Model_DocMK011::find($id);
     $data['docmk011'] = Petro::render_panel('Docmk011 Information', Petro::render_attr_table($mk011, static::_columns('view')));
     $this->sidebars->add('Render from another View!', View::forge('sidebar_link', array('url' => 'going/anywhere')));
     $this->action_items = array(array('title' => 'Edit Docmk011', 'link' => 'docmk011/edit/' . $id), array('title' => 'Delete Docmk011', 'link' => 'docmk011/delete/' . $id));
     $this->template->page_title = "docmk011";
     $this->template->content = View::forge('docmk011/view', $data, false);
 }
コード例 #4
0
ファイル: clients.php プロジェクト: ratiw/petro-test
 public function action_view($id = null)
 {
     $client = Model_Client::find($id);
     if (is_null($client)) {
         \Response::redirect('clients');
     }
     $data['client'] = Petro::render_panel('Client Information', Petro::render_attr_table($client, array('code', 'name', 'name_en', 'status')));
     $data['comments'] = Petro_Comment::render($this->app, $id);
     $this->sidebars->add('Render from another View!', View::forge('sidebar_link', array('url' => 'going/anywhere')));
     $routes = Petro::get_routes($id);
     $this->action_items = array(array('title' => 'Edit Client', 'link' => $routes['edit']), array('title' => 'Delete Client', 'link' => $routes['delete'], 'attr' => array('data-toggle' => 'modal', 'data-target' => '#petro-confirm', 'class' => 'del-item')));
     $this->template->page_title = $client->name;
     $this->template->set('content', $data['client'] . $data['comments'], false);
 }
コード例 #5
0
ファイル: users.php プロジェクト: ratiw/petro
 public function action_view($id = null)
 {
     $user = \Model_User::find($id);
     if (is_null($user)) {
         \Response::redirect('users');
     }
     $out = Petro::render_panel('User Information', Petro::render_attr_table($user, array('name', 'username', 'email', 'group', 'last_login'), static::_columns()));
     $out .= Petro_Comment::render($this->app, $id);
     $routes = Petro::get_routes($id);
     $this->action_items = array(array('title' => 'Edit User', 'link' => $routes['edit']), array('title' => 'Delete User', 'link' => $routes['delete']));
     $gp = \Auth::group()->get_name($user->group);
     if (\Auth::instance()->is_current_user($id)) {
         $this->sidebars->add('Operations', '<div>' . \Html::anchor('users/change_password', 'Change password') . '<br/>' . \Html::anchor('#', 'Reset password') . '<br/>' . $user->group . ' : ' . $gp . '</div>');
     }
     $this->template->page_title = $user->username;
     $this->template->set('content', $out, false);
 }
コード例 #6
0
ファイル: _form_belt_spec.php プロジェクト: ratiw/petro-test
echo Petro_Form::input('belt_thick', Input::post('belt_thick', isset($docmk) ? $docmk->belt_thick : ''), array('id' => 'form1_belt_thick', 'class' => 'span2'), __('belt_thick'), $errors);
echo Petro_Form::input('belt_top_thick', Input::post('belt_top_thick', isset($docmk) ? $docmk->belt_top_thick : ''), array('id' => 'form1_belt_top_thick', 'class' => 'span2'), __('belt_top_thick'), $errors);
echo Petro_Form::input('belt_bot_thick', Input::post('belt_bot_thick', isset($docmk) ? $docmk->belt_bot_thick : ''), array('id' => 'form1_belt_bot_thick', 'class' => 'span2'), __('belt_bot_thick'), $errors);
?>
				</div>
			</div><!--/row-->
			<div class="row-fluid">
				<div class="span12">
					<div class="control-group form-inline<?php 
echo isset($errors['belt_length']) ? ' error' : '';
?>
">
						<label class="control-label">
							<?php 
echo __('belt_length');
echo Petro::render_errors($errors, 'belt_length');
?>
						</label>
						<div class="controls">
							<?php 
echo Form::input('belt_length', Input::post('belt_length', isset($docmk) ? $docmk->belt_length : ''), array('id' => 'form1_belt_length', 'class' => 'span2' . (isset($errors['belt_length']) ? ' error' : '')));
?>
							<?php 
$belt_lunit = Petro_Lookup::get_array('belt.l.unit');
echo Form::select('belt_length_unit', Input::post('belt_length_unit', isset($docmk) ? $docmk->belt_length_unit : ''), $belt_lunit, array('id' => 'form1_belt_length_unit', 'class' => 'span2'));
?>
							<label style="width:150px;text-align:right" for="belt_end"><?php 
echo __('belt_end');
?>
&nbsp;</label>
							<?php 
コード例 #7
0
ファイル: template.php プロジェクト: ratiw/petro
<?php 
}
?>
	

		<div class="row-fluid" style="margin-top: 10px">
			<div class="span<?php 
echo isset($sidebars) ? '9' : '12';
?>
">
<?php 
if (isset($errors) and !empty($errors)) {
    echo '<div class="alert alert-error block-message error" data-alert="alert">' . PHP_EOL;
    echo '<a class="close" data-dismiss="alert" href="#">&times;</a>' . PHP_EOL;
    echo '<p><strong>' . __('alert_error_head') . '</strong></p>' . PHP_EOL;
    echo Petro::render_errors($errors) . PHP_EOL;
    echo '</div>' . PHP_EOL;
} else {
    $errors = array();
}
echo $content;
?>
			</div>
<?php 
if (isset($sidebars)) {
    ?>
		
			<div class="span3">
				<?php 
    echo isset($sidebars) ? $sidebars : '';
    ?>
コード例 #8
0
ファイル: _form.php プロジェクト: ratiw/petro-test
						</div>
					</div>
					<?php 
echo Petro_Form::input('mk_date', Input::post('mk_date', isset($docmk) ? Petro::to_app_date($docmk->mk_date) : ''), array('id' => 'form1_mk_date', 'placeholder' => 'dd/mm/yy', 'class' => 'datepicker'), __('mk_date'), $errors);
$client = Petro_Lookup::table('clients', 'id', 'name');
echo Petro_Form::select('client_id', Input::post('client_id', isset($docmk) ? $docmk->client_id : ''), array_merge(array('0' => '-- เลือก --'), $client), array('id' => 'form1_client_id'), __('client_id'), $errors);
echo Petro_Form::input('client_po', Input::post('client_po', isset($docmk) ? $docmk->client_po : ''), array('id' => 'form1_client_po'), __('client_po'), $errors);
?>
				</div>
				<div class="span6">
					<h3><?php 
echo __('delivery_head');
?>
</h3>
					<?php 
echo Petro_Form::input('delivery_date', Input::post('delivery_date', isset($docmk) ? Petro::to_app_date($docmk->delivery_date) : ''), array('id' => 'form1_delivery_date', 'placeholder' => 'dd/mm/yy', 'class' => 'datepicker '), __('delivery_date'), $errors);
echo Petro_Form::textarea('deliver_to', Input::post('deliver_to', isset($docmk) ? $docmk->deliver_to : ''), array('id' => 'form1_deliver_to', 'style' => 'width:90%'), __('deliver_to'), $errors);
?>
				</div>
			</div><!--/row-->
			<!--belt spec-->
<?php 
include '_form_belt_spec.php';
?>
			<div class="row-fluid">
				<div class="span7">
				<?php 
echo Petro_Form::input('belt_qty', Input::post('belt_qty', isset($docmk) ? $docmk->belt_qty : ''), array('id' => 'form1_belt_qty', 'class' => 'span2'), __('belt_qty'), $errors);
echo Petro_Form::input('belt_price_net', Input::post('belt_price_net', isset($docmk) ? $docmk->belt_price_net : ''), array('id' => 'form1_belt_price_net'), __('belt_price_net'), $errors);
echo Petro_Form::input('belt_amount', Input::post('belt_amount', isset($docmk) ? $docmk->belt_amount : ''), array('id' => 'form1_belt_amount'), __('belt_amount'), $errors);
echo Petro_form::textarea('remark', Input::post('remark', isset($docmk) ? $docmk->remark : ''), array('id' => 'form1_remark', 'class' => 'span4'), __('remark'), $errors);
コード例 #9
0
ファイル: docmk2.php プロジェクト: ratiw/petro-test
 protected function get_post_data($docmk = null)
 {
     $is_new = false;
     if (!isset($docmk)) {
         $docmk = array();
         $is_new = true;
     }
     $user = Auth::instance()->get_user_id();
     $screen_name = Auth::instance()->get_screen_name();
     $docmk['mk_no'] = Input::post('mk_no');
     $docmk['last_docno'] = Input::post('last_docno');
     $docmk['mk_date'] = Petro::to_db_date(Input::post('mk_date'));
     $docmk['client_id'] = Input::post('client_id');
     $docmk['client_po'] = Input::post('client_po');
     $docmk['delivery_date'] = Petro::to_db_date(Input::post('delivery_date'));
     $docmk['deliver_to'] = Input::post('deliver_to');
     $docmk['product_type'] = Input::post('product_type');
     $docmk['belt_type'] = Input::post('belt_type');
     $docmk['belt_color'] = Input::post('belt_color');
     $docmk['belt_color'] == 3 and $docmk['belt_color_other'] = Input::post('belt_color_other');
     $docmk['belt_width'] = Input::post('belt_width');
     $docmk['belt_width_unit'] = Input::post('belt_width_unit');
     $docmk['belt_ply'] = Input::post('belt_ply');
     $docmk['belt_ep'] = Input::post('belt_ep');
     $docmk['belt_grade'] = Input::post('belt_grade');
     $docmk['belt_top_grade'] = Input::post('belt_top_grade');
     $docmk['belt_bot_grade'] = Input::post('belt_bot_grade');
     $docmk['belt_thick'] = Input::post('belt_thick');
     $docmk['belt_top_thick'] = Input::post('belt_top_thick');
     $docmk['belt_bot_thick'] = Input::post('belt_bot_thick');
     $docmk['belt_length'] = Input::post('belt_length');
     $docmk['belt_length_unit'] = Input::post('belt_length_unit');
     $docmk['belt_end'] = Input::post('belt_end');
     $docmk['belt_qty'] = Input::post('belt_qty');
     $docmk['belt_price'] = Input::post('belt_price');
     $docmk['belt_disc1'] = Input::post('belt_disc1');
     $docmk['belt_disc2'] = Input::post('belt_disc2');
     $docmk['belt_disc3'] = Input::post('belt_disc3');
     $docmk['belt_price_net'] = Input::post('belt_price_net');
     $docmk['belt_amount'] = Input::post('belt_amount');
     $docmk['remark'] = Input::post('remark');
     $docmk['creator_id'] = $user[1];
     $docmk['creator_name'] = $screen_name;
     $docmk['status'] = Input::post('status');
     return $is_new ? Model_DocMK::forge($docmk) : $docmk;
 }