01.
<?php
02.
$sqlw
=
" select distinct(invoice_no) from tbl_invoice"
;
03.
$sqlw
.=
" where"
;
04.
$sqlw
.=
" invoice_status='ทำใบแจ้งหนี้เรียบร้อย'"
;
05.
06.
$numw
=
$cls_con
->select_numrows(
$sqlw
);
07.
if
(
$numw
==0)
08.
{
09.
$invoice_no
=
"NK"
.
date
(
'ymd'
).
"-01"
;
10.
11.
12.
}
13.
else
14.
{
15.
$numw
=
$numw
+1;
16.
$invoice_no
=
"NK"
.
date
(
'ymd'
).
"-"
.
$numw
;
17.
18.
}
19.
?>
20.
<div
class
=
"form-group"
>
21.
<label
for
=
"invoice_no"
class
=
"col-sm-2 control-label"
>หมายเลขใบแจ้งหนี้</label>
22.
<div
class
=
"col-sm-10"
>
23.
<input type=
"text"
class
=
"form-control"
name=
"invoice_no"
value=
"<?=$invoice_no;?>"
id=
"invoice_no"
placeholder=">
24.
</div>
25.
</div>