Files
xinhu/webmain/flow/input/mode_tovoidAction.php
2022-08-14 16:47:40 +08:00

60 lines
1.5 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
class mode_tovoidClassAction extends inputAction{
protected function savebefore($table, $arr, $id, $addbo){
$tonum = $arr['tonum'];
if(m($table)->rows("`id`<>$id and `tonum`='$tonum'")>0)return '此单据已申请过了';
}
protected function saveafter($table, $arr, $id, $addbo){
}
//读取可作废的单据是申请日期只能是30天内的单据
public function modebill()
{
$dts = date('Y-m-d', time()-30*24*3600);
$rows = $this->db->getrows('[Q]flow_bill',"`uid`='$this->adminid' and `status`=1 and `isdel`=0 and `applydt`>='$dts' group by `modeid`",'`modeid`,`modename`','optdt desc');
$row = array();
foreach($rows as $k=>$rs){
$row[] = array(
'value' => $rs['modeid'],
'name' => $rs['modename'],
);
}
return $row;
}
//获取作废单据
public function gettonum()
{
$row = array();
if($this->rs){
$row[] = array(
'name' => $this->rs['tonum'],
'value' => $this->rs['tonum'],
);
}
return $row;
}
/**
* 联动获取
*/
public function gettonumAjax()
{
$modeid = (int)$this->get('modeid');
$dts = date('Y-m-d', time()-30*24*3600);
$rows = $this->db->getrows('[Q]flow_bill',"`uid`='$this->adminid' and `modeid`='$modeid' and `status`=1 and `isdel`=0 and `applydt`>='$dts'",'`sericnum`','optdt desc');
$row = array();
foreach($rows as $k=>$rs){
$row[] = array(
'name' => $rs['sericnum'],
);
}
$this->returnjson($row);
}
}