コード例 #1
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!";
     }
 }
コード例 #2
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);
コード例 #3
0
ファイル: docmk2.php プロジェクト: ratiw/petro-test
 protected function display_info($docmk)
 {
     // $out = Petro::render_attr_table_open($docmk);
     // $out .= Petro::render_attr_table_row(__('mk_no'), $docmk->mk_no);
     // $out .= Petro::render_attr_table_row(__('mk_date'), Petro::to_app_date($docmk->mk_date));
     // $out .= Petro::render_attr_table_row(__('client_id'),
     // '<a href="'.Uri::base().'clients/view/'.$docmk->client_id.'">'.
     // Petro_Lookup::get(null, $docmk->client_id, 'clients', 'id', 'name').
     // '</a>'
     // );
     // $out .= Petro::render_attr_table_row(__('client_po'), $docmk->client_po);
     // $out .= Petro::render_attr_table_row(__('product_type'), Petro_Lookup::get('product.type', $docmk->product_type));
     // $out .= Petro::render_attr_table_row(__('belt_info'), BeltInfo::long($docmk));
     // $out .= Petro::render_attr_table_row(__('belt_length'), $docmk->belt_length.' '.Petro_Lookup::get('belt.l.unit', $docmk->belt_length_unit));
     // $out .= Petro::render_attr_table_row(__('belt_end'), Petro_Lookup::get('belt.end', $docmk->belt_end));
     // $out .= Petro::render_attr_table_row(__('belt_qty'), $docmk->belt_qty.' '.'เส้น');
     // $price = BeltInfo::calc_price($docmk);
     // $out .= Petro::render_attr_table_row(__('belt_price'), number_format($price['standard_price'], 2));
     // $out .= Petro::render_attr_table_row(__('remark'), $docmk->remark);
     // $out .= Petro::render_attr_table_row(__('creator'), $docmk->creator_name);
     // $out .= Petro::render_attr_table_row(__('status'), Petro_Lookup::get('prd.status', $docmk->status));
     // $out .= Petro::render_attr_table_close();
     // return $out;
     return Petro::render_attr_table($docmk, array('mk_no', 'mk_date' => function ($data) {
         return Petro::to_app_date($data->mk_date);
     }, 'client_id' => function ($data) {
         return '<a href="' . Uri::base() . 'clients/view/' . $data->client_id . '">' . Petro_Lookup::get(null, $data->client_id, 'clients', 'id', 'name') . '</a>';
     }, 'client_po', 'product_type' => function ($data) {
         return Petro_Lookup::get('product.type', $data->product_type);
     }, 'belt_info' => function ($data) {
         return BeltInfo::long($data);
     }, 'belt_length' => function ($data) {
         return $data->belt_length . ' ' . Petro_Lookup::get('belt.l.unit', $data->belt_length_unit);
     }, 'belt_end' => function ($data) {
         return Petro_Lookup::get('belt.end', $data->belt_end);
     }, 'belt_qty' => function ($data) {
         return $data->belt_qty . ' ' . 'เส้น';
     }, 'belt_price' => function ($data) {
         $price = BeltInfo::calc_price($data);
         return number_format($price['standard_price'], 2);
     }, 'remark', 'creator' => function ($data) {
         return $data->creator_name;
     }, 'status' => function ($data) {
         return Petro_Lookup::get('prd.status', $data->status);
     }));
 }