|
|
|
ปัจจัยที่ทำให้คีย์ด้วยมือได้ แต่ใช้สแกน scan ทำไม่ได้ |
|
|
|
|
|
|
|
น่าจะเกิดจาก
1. รหัสไม่ตรงกับที่สแกน
ทางแก้ คือ ลอง echo ค่าที่สแกนมาดูก่อน
2. เครื่องสแกนจุ๊ง ไปแล้ว มันไม่อ่านค่า หรืออาจเป็นที่แถบสแกนในสินค้า เบลอทำให้เครื่องอ่านผิดพลาดได้เช่นเดียวกันครับ
|
|
|
|
|
Date :
2010-06-12 11:02:37 |
By :
deawx |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ผม echo ค่าที่สแกนมาแล้วครับ ตอนสแกน มีการแสดง รหัสสินค้า แต่ตอนเก็บไม่ยอมเก็บครับ.
งง ได้ ใจ...ท้าทาย ได้ เรื่อง..
|
|
|
|
|
Date :
2010-06-12 11:18:05 |
By :
แมนนิดหน่อย |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ตอนเก็บไม่ยอมเก็บ
ต้อง echo ข้อมูลตอนสแกนมา ก่อนเก็บ ดูครับ ว่ามันมีข้อมูลส่งมาหรือเปล่าครับ
หรือไม่ก็ต้องโพสต์โค้ดไว้หน่อยครับ
ว่าสคริปเรามีตรงใหนที่ลืมใส่ไปหรือเปล่า
|
|
|
|
|
Date :
2010-06-12 14:01:49 |
By :
deawx |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"""
Code (PHP)
<?php
require_once ("secure_area.php");
class Receives extends Secure_area
{
function __construct()
{
parent::__construct('receives');
$this->load->library('receive_lib');
}
function index()
{
$this->_reload();
}
function item_search()
{
$suggestions = $this->Item->get_item_search_suggestions($this->input->post('q'),$this->input->post('limit'));
echo implode("\n",$suggestions);
}
function supplier_search()
{
$suggestions = $this->Supplier->get_suppliers_search_suggestions($this->input->post('q'),$this->input->post('limit'));
echo implode("\n",$suggestions);
}
function select_supplier()
{
$supplier_id = $this->input->post("supplier");
$this->receive_lib->set_supplier($supplier_id);
$this->_reload();
}
function change_mode()
{
$mode = $this->input->post("mode");
$this->receive_lib->set_mode($mode);
$this->_reload();
}
function add()
{
$data=array();
$mode = $this->receive_lib->get_mode();
$item_id_or_number_or_receipt = $this->input->post("item");
$quantity = $mode=="receive" ? 1:-1;
if($this->receive_lib->is_valid_receipt($item_id_or_number_or_receipt) && $mode=='return')
{
$this->receive_lib->return_entire_receive($item_id_or_number_or_receipt);
}
elseif(!$this->receive_lib->add_item($item_id_or_number_or_receipt,$quantity))
{
$data['error']=$this->lang->line('receives_unable_to_add_item');
}
$this->_reload($data);
}
function edit_item($item_id)
{
$data= array();
$this->form_validation->set_rules('price', 'lang:items_price', 'required|numeric');
$this->form_validation->set_rules('quantity', 'lang:items_quantity', 'required|integer');
$price = $this->input->post("price");
$quantity = $this->input->post("quantity");
$discount = $this->input->post("discount");
if ($this->form_validation->run() != FALSE)
{
$this->receive_lib->edit_item($item_id,$quantity,$discount,$price);
}
else
{
$data['error']=$this->lang->line('receives_error_editing_item');
}
$this->_reload($data);
}
function delete_item($item_number)
{
$this->receive_lib->delete_item($item_number);
$this->_reload();
}
function delete_supplier()
{
$this->receive_lib->delete_supplier();
$this->_reload();
}
function complete()
{
$data['cart']=$this->receive_lib->get_cart();
$data['subtotal']=$this->receive_lib->get_subtotal();
$data['taxes']=$this->receive_lib->get_taxes();
$data['total']=$this->receive_lib->get_total();
$data['receipt_title']=$this->lang->line('receives_receipt');
$data['transaction_time']= date('m/d/Y h:i:s a');
$supplier_id=$this->receive_lib->get_supplier();
$employee_id=$this->Employee->get_logged_in_employee_info()->person_id;
$comment = $this->input->post('comment');
$emp_info=$this->Employee->get_info($employee_id);
$payment_type = $this->input->post('payment_type');
$data['payment_type']=$this->input->post('payment_type');
if ($this->input->post('amount_tendered'))
{
$data['amount_tendered'] = $this->input->post('amount_tendered');
$data['amount_change'] = to_currency($data['amount_tendered'] - $data['total']);
}
$data['employee']=$emp_info->first_name.' '.$emp_info->last_name;
if($supplier_id!=-1)
{
$supp_info=$this->Supplier->get_info($supplier_id);
$data['supplier']=$supp_info->first_name;
}
//SAVE receive to database
$data['receive_id']='RECEIVES '.$this->Receive->save($data['cart'], $supplier_id,$employee_id,$comment,$payment_type);
$this->load->view("receives/receipt",$data);
$this->receive_lib->clear_all();
}
function receipt($receive_id)
{
$receive_info = $this->Receive->get_info($receive_id)->row_array();
$this->receive_lib->copy_entire_receive($receive_id);
$data['cart']=$this->receive_lib->get_cart();
$data['subtotal']=$this->receive_lib->get_subtotal();
$data['taxes']=$this->receive_lib->get_taxes();
$data['total']=$this->receive_lib->get_total();
$data['receipt_title']=$this->lang->line('receives_receipt');
$data['transaction_time']= date('m/d/Y h:i:s a', strtotime($receive_info['receive_time']));
$supplier_id=$this->receive_lib->get_supplier();
$employee_id=$this->Employee->get_logged_in_employee_info()->person_id;
$emp_info=$this->Employee->get_info($employee_id);
$data['payment_type']=$receive_info['payment_type'];
$data['employee']=$emp_info->first_name.' '.$emp_info->last_name;
if($supplier_id!=-1)
{
$supp_info=$this->Supplier->get_info($supplier_id);
$data['supplier']=$supp_info->first_name.' '.$supp_info->last_name;
}
$data['receive_id']='RECEIVES '.$receive_id;
$this->load->view("receives/receipt",$data);
$this->receive_lib->clear_all();
}
function _reload($data=array())
{
$person_info = $this->Employee->get_logged_in_employee_info();
$data['cart']=$this->receive_lib->get_cart();
$data['modes']=array('receive'=>$this->lang->line('receives_receive'),'return'=>$this->lang->line('receives_return'));
$data['mode']=$this->receive_lib->get_mode();
$data['subtotal']=$this->receive_lib->get_subtotal();
$data['taxes']=$this->receive_lib->get_taxes();
$data['total']=$this->receive_lib->get_total();
$data['items_module_allowed'] = $this->Employee->has_permission('items', $person_info->person_id);
$data['payment_options']=array(
$this->lang->line('receives_cash') => $this->lang->line('receives_cash'),
$this->lang->line('receives_check') => $this->lang->line('receives_check'),
$this->lang->line('receives_debit') => $this->lang->line('receives_debit'),
$this->lang->line('receives_credit') => $this->lang->line('receives_credit')
);
$supplier_id=$this->receive_lib->get_supplier();
if($supplier_id!=-1)
{
$info=$this->Supplier->get_info($supplier_id);
$data['supplier']=$info->first_name;
}
$this->load->view("receives/register",$data);
}
function cancel_receive()
{
//$this->load->view("receives/receipt",$data);
$this->receive_lib->clear_all();
$this->_reload();
}
}
?>
|
|
|
|
|
Date :
2010-06-12 20:59:15 |
By :
mkamsoy0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
โค้ดอย่างยาวเลย.
ไม่เคยเจอแบบนี้เลยครับ..
แบบนี้ต้องมึน..
|
|
|
|
|
Date :
2010-06-12 21:00:47 |
By :
mkamsoy0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอโทษครับ
ผมเห็นแต่ฟังก์ชั่น พ้มไม่เห็นโค๊ดรับค่า ส่งค่าไรเลยครับ
สรุปแล้ว โพสต์ผิดไฟล์เปล่าครับผม
|
|
|
|
|
Date :
2010-06-12 21:36:34 |
By :
deawx |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เอ..งั้นหรอครับ..
ผมเห็นว่ามันแสดงไฟล์นี้เลยเอามา...
ลืมไปว่ามันไปดึงจากหลายๆที่..
ขอโทษทีครับ มือใหม่ในเรื่องนี้.
|
|
|
|
|
Date :
2010-06-14 16:01:58 |
By :
แมนนิดหน่อย |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
....
Code (PHP)
<?php $this->load->view("partial/header"); ?>
<div id="page_title" style="margin-bottom:8px;"><?php echo $this->lang->line('receives_register'); ?></div>
<?php
if(isset($error))
{
echo "<div class='error_message'>".$error."</div>";
}
?>
<div id="register_wrapper">
<?php echo form_open("receives/change_mode",array('id'=>'mode_form')); ?>
<span><?php echo $this->lang->line('receives_mode') ?></span>
<?php echo form_dropdown('mode',$modes,$mode,'onchange="$(\'#mode_form\').submit();"'); ?>
</form>
<?php echo form_open("receives/add",array('id'=>'add_item_form')); ?>
<label id="item_label" for="item">
<?php
if($mode=='receive')
{
echo $this->lang->line('receives_find_or_scan_item');
}
else
{
echo $this->lang->line('receives_find_or_scan_item_or_receipt');
}
?>
</label>
<?php echo form_input(array('name'=>'item','id'=>'item','size'=>'40'));?>
<div id="new_item_button_register" >
<?php echo anchor("items/view/-1/width:360",
"<div class='small_button'><span>".$this->lang->line('receives_new_item')."</span></div>",
array('class'=>'thickbox none','title'=>$this->lang->line('receives_new_item')));
?>
</div>
</form>
<table id="register">
<thead>
<tr>
<th style="width:11%;"><?php echo $this->lang->line('common_delete'); ?></th>
<th style="width:30%;"><?php echo $this->lang->line('receives_item_name'); ?></th>
<th style="width:11%;"><?php echo $this->lang->line('receives_price'); ?></th>
<th style="width:11%;"><?php echo $this->lang->line('receives_quantity'); ?></th>
<th style="width:11%;"><?php echo $this->lang->line('receives_discount'); ?></th>
<th style="width:15%;"><?php echo $this->lang->line('receives_total'); ?></th>
<th style="width:11%;"><?php echo $this->lang->line('receives_edit'); ?></th>
</tr>
</thead>
<tbody id="cart_contents">
<?php
if(count($cart)==0)
{
?>
<tr><td colspan='7'>
<div class='warning_message' style='padding:7px;'><?php echo $this->lang->line('receives_no_items_in_cart'); ?></div>
</tr></tr>
<?php
}
else
{
foreach($cart as $item_id=>$item)
{
echo form_open("receives/edit_item/$item_id");
?>
<tr>
<td><?php echo anchor("receives/delete_item/$item_id",'['.$this->lang->line('common_delete').']');?></td>
<td><?php echo $item['name']; ?></td>
<?php if ($items_module_allowed)
{
?>
<td><?php echo form_input(array('name'=>'price','value'=>$item['price'],'size'=>'6'));?></td>
<?php
}
else
{
?>
<td><?php echo $item['price']; ?></td>
<?php echo form_hidden('price',$item['price']); ?>
<?php
}
?>
<td><?php echo form_input(array('name'=>'quantity','value'=>$item['quantity'],'size'=>'2'));?></td>
<td><?php echo form_input(array('name'=>'discount','value'=>$item['discount'],'size'=>'3'));?></td>
<td><?php echo to_currency($item['price']*$item['quantity']-$item['price']*$item['quantity']*$item['discount']/100); ?></td>
<td><?php echo form_submit("edit_item", $this->lang->line('receives_edit_item'));?></td>
</tr>
</form>
<?php
}
}
?>
</tbody>
</table>
</div>
<div id="overall_receive">
<?php
if(isset($supplier))
{
echo $this->lang->line("receives_supplier").': <b>'.$supplier. '</b><br />';
echo anchor("receives/delete_supplier",'['.$this->lang->line('common_delete').' '.$this->lang->line('suppliers_supplier').']');
}
else
{
echo form_open("receives/select_supplier",array('id'=>'select_supplier_form')); ?>
<label id="supplier_label" for="supplier"><?php echo $this->lang->line('receives_select_supplier'); ?></label>
<?php echo form_input(array('name'=>'supplier','id'=>'supplier','size'=>'30','value'=>$this->lang->line('receives_start_typing_supplier_name')));?>
</form>
<div style="margin-top:5px;text-align:center;">
<h3 style="margin: 5px 0 5px 0"><?php echo $this->lang->line('common_or'); ?></h3>
<?php echo anchor("suppliers/view/-1/width:350",
"<div class='small_button' style='margin:0 auto;'><span>".$this->lang->line('receives_new_supplier')."</span></div>",
array('class'=>'thickbox none','title'=>$this->lang->line('receives_new_supplier')));
?>
</div>
<div class="clearfix"> </div>
<?php
}
?>
<div id='receive_details'>
<div class="float_left" style="width:55%;"><?php echo $this->lang->line('receives_sub_total'); ?>:</div>
<div class="float_left" style="width:45%;font-weight:bold;"><?php echo to_currency($subtotal); ?></div>
<?php foreach($taxes as $name=>$value) { ?>
<div class="float_left" style='width:55%;'><?php echo $name; ?>:</div>
<div class="float_left" style="width:45%;font-weight:bold;"><?php echo to_currency($value); ?></div>
<?php }; ?>
<div class="float_left" style='width:55%;'><?php echo $this->lang->line('receives_total'); ?>:</div>
<div class="float_left" style="width:45%;font-weight:bold;"><?php echo to_currency($total); ?></div>
</div>
<?php
if(count($cart) > 0)
{
?>
<div id="finish_receive">
<?php echo form_open("receives/complete",array('id'=>'finish_receive_form')); ?>
<br>
<label id="comment_label" for="comment"><?php echo $this->lang->line('common_comments'); ?>:</label>
<?php echo form_textarea(array('name'=>'comment','value'=>'','rows'=>'4','cols'=>'23'));?>
<br><br>
<table width="100%"><tr><td>
<?php
echo $this->lang->line('receives_payment').': ';?>
</td><td>
<?php
echo form_dropdown('payment_type',$payment_options);?>
</td>
</tr>
<tr>
<td>
<?php
echo $this->lang->line('receives_amount_tendered').': ';?>
</td><td>
<?php
echo form_input(array('name'=>'amount_tendered','value'=>'','size'=>'10'));
?>
</td>
</tr>
</table>
<br>
<?php echo "<div class='small_button' id='finish_receive_button' style='float:right;margin-top:5px;'><span>".$this->lang->line('receives_complete_receive')."</span></div>";
?>
</div>
</form>
<?php echo form_open("receives/cancel_receive",array('id'=>'cancel_receive_form')); ?>
<div class='small_button' id='cancel_receive_button' style='float:left;margin-top:5px;'>
<span>ยกเลิกการรับสินค้า</span>
</div>
</form>
</div>
<?php
}
?>
</div>
<div class="clearfix" style="margin-bottom:30px;"> </div>
<?php $this->load->view("partial/footer"); ?>
<script type="text/javascript" language="javascript">
$(document).ready(function()
{
$("#item").autocomplete('<?php echo site_url("receives/item_search"); ?>',
{
minChars:0,
max:100,
delay:10,
formatItem: function(row) {
return row[1];
}
});
$("#item").result(function(event, data, formatted)
{
$("#add_item_form").submit();
});
$('#item').focus();
$('#item').blur(function()
{
$(this).attr('value',"<?php echo $this->lang->line('receives_start_typing_item_name'); ?>");
});
$('#item,#supplier').click(function()
{
$(this).attr('value','');
});
$("#supplier").autocomplete('<?php echo site_url("receives/supplier_search"); ?>',
{
minChars:0,
delay:10,
max:100,
formatItem: function(row) {
return row[1];
}
});
$("#supplier").result(function(event, data, formatted)
{
$("#select_supplier_form").submit();
});
$('#supplier').blur(function()
{
$(this).attr('value',"<?php echo $this->lang->line('receives_start_typing_supplier_name'); ?>");
});
$("#finish_receive_button").click(function()
{
if (confirm('<?php echo $this->lang->line("receives_confirm_finish_receive"); ?>'))
{
$('#finish_receive_form').submit();
}
});
$("#cancel_receive_button").click(function()
{
if (confirm('<?php echo $this->lang->line("receives_confirm_cancel_receive"); ?>'))
{
$('#cancel_receive_form').submit();
}
});
});
function post_item_form_submit(response)
{
if(response.success)
{
$("#item").attr("value",response.item_id);
$("#add_item_form").submit();
}
}
function post_person_form_submit(response)
{
if(response.success)
{
$("#supplier").attr("value",response.person_id);
$("#select_supplier_form").submit();
}
}
</script>
|
|
|
|
|
Date :
2010-06-14 16:05:31 |
By :
แมนนิดหน่อย |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
...
ตอนที่ดึง function ของการค้นหา search ที่ไฟล์อื่นก็สามารถใช้ scan ได้นะครับ
แต่ทำไมที่ไฟล์นี้กลับดึงไม่ได้ก็ไม่รู้นะครับ..
... งงได้ใจ ท้าทายเอาเรื่อง...
กินแบรนด์แล้วยังทำไม่ได้..สงสัยต้องกินอย่างอื่นแล้ว..
|
|
|
|
|
Date :
2010-06-14 16:22:49 |
By :
แมนนิดหน่อย |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|