나는이 금액이 평금보다 같거나 더 큰지 확인하는 javascript를 가지고 있습니다.
마찬가지로 window.print도 실행되지만 리디렉션 페이지 만 인쇄됩니다
리디렉션하지 않습니다.자바 스크립트가 window.print() 이후에 (codeigniter) PHP 스크립트를 실행하지 않습니다
보기 페이지 :
<script>
function printpage()
{
var
total = parseFloat($(':input[name="total"]').val(),10),
cash = parseFloat($(':input[name="cash"]').val(),10),
charge = parseFloat($(':input[name="charge"]').val(),10),
payment = (cash + charge);
if(payment>= total){
window.print();
}else{
return false;
}
}
</script>
im not good at javascript.
here is some more details:
<form action="bills/settle" method="post">
<input type="text" name="cash">
<input type="text" name="charge">
<input type="text" name="total" value="<?php echo $total">
<input type="submit" onclick="printpage()"
</form>
컨트롤러 페이지 :
function settle(){
$payment = $this->input->post('cash')+ $this->input->post('charge');
$total = $this->input->post('total');
$data = ('cash'=>$this->input->post('cash'), so on.....)
if($payment >=$total)
{
$this->load->model('process');
$this->process->close_bill($data);
} else {
redirect('msg','refresh');
}
}
* 다른 노트,
지불 OK 인 경우는 데이터베이스에 데이터를 삽입 년대를 인쇄하지만, 리디렉션하지 않습니다 .
db 삽입이 성공한 후 리디렉션 스크립트가 내 모델에 있습니다.
지불이 확인되지 않는 경우 : (이 측면에 아무 문제)은 MSG 페이지로 리디렉션
,
죄송합니다. 1 주일 동안 인터넷에서 응답을 보내 주셔서 감사합니다. – swordfish