信呼OA版本v2.3.8
This commit is contained in:
385
webmain/main/goods/goodsAction.php
Normal file
385
webmain/main/goods/goodsAction.php
Normal file
@@ -0,0 +1,385 @@
|
||||
<?php
|
||||
class goodsClassAction extends Action
|
||||
{
|
||||
|
||||
public function initAction()
|
||||
{
|
||||
$this->goodsobj = m('goods');
|
||||
}
|
||||
|
||||
private function gettypename($tid)
|
||||
{
|
||||
return $this->goodsobj->gettypename($tid);
|
||||
}
|
||||
|
||||
public function aftershow($table, $rows)
|
||||
{
|
||||
$typearr = $depotarr = array();
|
||||
$mid = (int)$this->post('mid','0');//根据主表出入库操作
|
||||
if($rows){
|
||||
$aid = '0';
|
||||
foreach($rows as $k=>$rs){
|
||||
|
||||
$rows[$k]['typeid'] = $this->gettypename($rs['typeid']);
|
||||
$aid.=','.$rs['id'].'';
|
||||
if($rs['stock']=='0')$rows[$k]['stock'] = '';
|
||||
if($rs['stock']<0)$rows[$k]['ishui']=1;
|
||||
}
|
||||
$rows = $this->pandian($aid, $rows);
|
||||
}else{
|
||||
if($mid>0){
|
||||
m('goodm')->update('state=1', $mid);
|
||||
}
|
||||
}
|
||||
if($this->loadci==1){
|
||||
$type = (int)$this->post('type');
|
||||
$typearr= $this->option->getdata('kutype'.$type.'');
|
||||
$where = m('admin')->getcompanywhere(1);
|
||||
$depotarr = m('godepot')->getall('1=1'.$where.'','id,depotname as name,depotnum','`sort`');
|
||||
foreach($depotarr as $k=>$rs){
|
||||
$depotarr[$k]['namea']= $rs['name'];
|
||||
$depotarr[$k]['name'] = ''.$rs['depotnum'].'.'.$rs['name'].'';
|
||||
}
|
||||
}
|
||||
return array(
|
||||
'rows' => $rows,
|
||||
'typearr' => $typearr,
|
||||
'depotarr' => $depotarr,
|
||||
);
|
||||
}
|
||||
|
||||
public function beforeshow($table)
|
||||
{
|
||||
$key = $this->post('key');
|
||||
$typeid = (int)$this->post('typeid');
|
||||
$mid = (int)$this->post('mid','0');//根据主表出入库操作
|
||||
$where = '';
|
||||
if($typeid != 0){
|
||||
$alltpeid = $this->option->getalldownid($typeid);
|
||||
$where .= ' and `typeid` in('.$alltpeid.')';
|
||||
}
|
||||
if($key!=''){
|
||||
$where .= " and (`name` like '%$key%' or `num` like '%$key%' or `guige` like '%$key%' or `xinghao` like '%$key%') ";
|
||||
}
|
||||
|
||||
$where.=m('admin')->getcompanywhere(1);
|
||||
|
||||
if($mid>0){
|
||||
/*
|
||||
$carro = m('goodn')->getall('mid='.$mid.' and `couns`<`count`');
|
||||
$typeids = '0';
|
||||
foreach($carro as $k=>$rs)$typeids.=','.$rs['aid'].'';
|
||||
$where .= ' and `id` in('.$typeids.')';
|
||||
*/
|
||||
return array(
|
||||
'where' => 'and b.`mid`='.$mid.' and b.`couns`<b.`count`',
|
||||
'fields' => 'a.*,(b.`count`-b.`couns`)maxcount',
|
||||
'table' => '`[Q]goods` a left join `[Q]goodn` b on a.`id`=b.`aid`'
|
||||
);
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
|
||||
//盘点对应仓库库存计算
|
||||
private function pandian($aid,$rows)
|
||||
{
|
||||
if($this->post('atype')!='pan')return $rows;
|
||||
|
||||
$ckarr = m('goods')->getstock($aid, $this->post('dt'));
|
||||
foreach($rows as $k=>&$rs){
|
||||
$rs['stock'] = '';
|
||||
if(isset($ckarr[$rs['id']])){
|
||||
$kdsra= $ckarr[$rs['id']];
|
||||
$rs['stock'] = $kdsra[0]=='0'?'':$kdsra[0]; //总库存
|
||||
|
||||
foreach($kdsra as $k1=>$v1){
|
||||
if($k1>0)$rs['stockdepotid'.$k1.''] = $v1=='0'?'':$v1; //对应仓库库存
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public function xiangbeforeshow($table)
|
||||
{
|
||||
$key = $this->post('key');
|
||||
$dt = $this->post('dt');
|
||||
$types = $this->post('types');
|
||||
$typeid = (int)$this->post('typeid', 0);
|
||||
$depotid = (int)$this->post('depotid', 0);
|
||||
|
||||
$where = '';
|
||||
if($typeid>0){
|
||||
$alltpeid = $this->option->getalldownid($typeid);
|
||||
$where.=" and b.typeid in($alltpeid)";
|
||||
}
|
||||
if($key!=''){
|
||||
$where .= " and (b.`name` like '%$key%' or a.optname like '%$key%' or c.depotname like '%$key%' )";
|
||||
}
|
||||
if($dt!=''){
|
||||
$where .= " and a.`applydt` like '$dt%' ";
|
||||
}
|
||||
if($depotid>0){
|
||||
$where .= " and a.`depotid`='$depotid'";
|
||||
}
|
||||
if($types){
|
||||
$typea = explode('_', $types);
|
||||
$where.= ' and a.type='.substr($typea[0],1).' and a.kind='.$typea[1].'';
|
||||
}
|
||||
|
||||
$where .= m('admin')->getcompanywhere(1,'a.');
|
||||
$table = '`[Q]goodss` a left join `[Q]goods` b on a.aid=b.id left join `[Q]godepot` c on a.depotid=c.id';
|
||||
$fields = 'a.id,b.name,a.count,c.depotname,a.type,a.kind,a.status,a.optname,b.typeid,b.xinghao,b.guige,a.applydt,a.explain,a.mid';
|
||||
return array(
|
||||
'where' => $where,
|
||||
'table' => $table,
|
||||
'fields' => $fields,
|
||||
);
|
||||
}
|
||||
|
||||
public function xiangaftershow($table, $rows)
|
||||
{
|
||||
$tyeparr = array();
|
||||
if($rows){
|
||||
$typearr0= $this->option->getdata('kutype0');
|
||||
$typearr1= $this->option->getdata('kutype1');
|
||||
$tyeparr['a0_3'] = '调拨入库';
|
||||
$tyeparr['a1_3'] = '调拨出库';
|
||||
foreach($typearr0 as $k=>$rs)$tyeparr['a0_'.$rs['value'].''] = $rs['name'];
|
||||
foreach($typearr1 as $k=>$rs)$tyeparr['a1_'.$rs['value'].''] = $rs['name'];
|
||||
$statusar= array('<font color=blue>待审核</font>','<font color=green>已审核</font>','<font color=red>审核未通过</font>');
|
||||
$typearr = array();
|
||||
|
||||
foreach($rows as $k=>$rs){
|
||||
|
||||
$tid = $rs['typeid'];
|
||||
if(isset($typearr[$tid])){
|
||||
$rows[$k]['typeid'] = $typearr[$tid];
|
||||
}else{
|
||||
$rows[$k]['typeid'] = $this->db->getpval('[Q]option','pid','name', $tid,'/','id',2);
|
||||
$typearr[$tid] = $rows[$k]['typeid'];
|
||||
}
|
||||
|
||||
$skey = 'a'.$rs['type'].'_'.$rs['kind'].'';
|
||||
$kind = '';
|
||||
if(isset($tyeparr[$skey]))$kind = $tyeparr[$skey];
|
||||
$rows[$k]['kind'] = $kind;
|
||||
$rows[$k]['status'] = $statusar[$rs['status']];
|
||||
if($rs['mid']>0)$rows[$k]['checkdisabled'] = true;//有主表ID,不能删除
|
||||
}
|
||||
}
|
||||
$barr = array('rows' => $rows,'tyeparr'=>$tyeparr);
|
||||
return $barr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除出入库详情
|
||||
*/
|
||||
public function delxiangAjax()
|
||||
{
|
||||
$ids = c('check')->onlynumber($this->post('id','0'));
|
||||
m('goodss')->delete("id in($ids) and `mid`=0");
|
||||
backmsg();
|
||||
}
|
||||
|
||||
public function chukuoptAjax()
|
||||
{
|
||||
$dt = $this->post('dt');
|
||||
$type = (int)$this->post('type');
|
||||
$depotid= (int)$this->post('depotid');
|
||||
$kind = (int)$this->post('kind');
|
||||
$mid = (int)$this->post('mid','0');
|
||||
$sm = $this->post('sm');
|
||||
$cont = $this->post('cont');
|
||||
$sharr = c('array')->strtoarray($cont);
|
||||
$arr['applydt'] = $dt;
|
||||
$arr['type'] = $type;
|
||||
$arr['kind'] = $kind;
|
||||
$arr['depotid'] = $depotid;
|
||||
$arr['explain'] = $sm;
|
||||
$arr['uid'] = $this->adminid;
|
||||
$arr['optid'] = $this->adminid;
|
||||
$arr['optdt'] = $this->now;
|
||||
$arr['comid'] = m('admin')->getcompanyid();
|
||||
$arr['optname'] = $this->adminname;
|
||||
$arr['status'] = 1;
|
||||
$aid = '0';
|
||||
|
||||
$ndbs = m('goodn');
|
||||
|
||||
$mtype = -1;
|
||||
|
||||
//根据主表出入库操作
|
||||
if($mid>0){
|
||||
$mrs = m('goodm')->getone("`id`='$mid' and `status`=1");
|
||||
if(!$mrs)return '该单据还未审核完成,不能出入库操作';
|
||||
//读取已入库数量
|
||||
$arwos = $ndbs->getall('`mid`='.$mid.' and `couns`<`count`');
|
||||
$ruks = array();
|
||||
foreach($arwos as $k1=>$rs1){
|
||||
$ruks[$rs1['aid']] = array(
|
||||
'kes' => floatval($rs1['count']) - floatval($rs1['couns']),//还可入库数
|
||||
'id' => $rs1['id'],
|
||||
'couns' => floatval($rs1['couns'])
|
||||
);
|
||||
}
|
||||
$mtype = (int)$mrs['type']; //3就是调拨
|
||||
$arr['comid'] = $mrs['comid'];
|
||||
}
|
||||
|
||||
//调拨必须先出库原来的
|
||||
if($mtype==3 && $depotid==$mrs['custid'])return '调拨出入库仓库不能相同';
|
||||
|
||||
|
||||
foreach($sharr as $k=>$rs){
|
||||
$arr['aid'] = $rs[0];
|
||||
$count = (int)$rs[1];
|
||||
$arr['depotid'] = $depotid;
|
||||
$arr['type'] = $type;
|
||||
$arr['explain'] = $sm;
|
||||
|
||||
if($count<0)$count = 0-$count;
|
||||
|
||||
if($mid>0){
|
||||
if(!isset($ruks[$arr['aid']]))continue;
|
||||
$shua = $ruks[$arr['aid']];
|
||||
if($count>$shua['kes'])$count=$shua['kes'];//超过
|
||||
$arr['mid'] = $mid;
|
||||
}
|
||||
|
||||
|
||||
if($count==0)continue;
|
||||
|
||||
|
||||
$arr['count'] = $count;
|
||||
if($type==1)$arr['count'] = 0- $arr['count'];//出库为负数
|
||||
|
||||
$ussid = $this->db->record('[Q]goodss', $arr);
|
||||
$aid.=','.$rs[0].'';
|
||||
|
||||
//更新已出入库的数量
|
||||
if($mid>0 && $ussid){
|
||||
$ndbs->update('`couns`=`couns`+'.$count.'', $shua['id']);
|
||||
}
|
||||
|
||||
if($mtype==3){
|
||||
$arr['depotid'] = $mrs['custid']; //仓库
|
||||
$arr['type'] = 1; //出库
|
||||
$arr['count'] = 0 - $count;
|
||||
//$arr['explain'] = '调拨出库';
|
||||
$this->db->record('[Q]goodss', $arr);
|
||||
}
|
||||
}
|
||||
if($aid!='0')m('goods')->setstock($aid);
|
||||
if($mid>0){
|
||||
m('goods')->upstatem($mid);
|
||||
}
|
||||
return 'success';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//刷新库存
|
||||
public function reloadkcAjax()
|
||||
{
|
||||
m('goods')->setstock();
|
||||
}
|
||||
|
||||
//出入库操作
|
||||
public function croptbeforeshow($table)
|
||||
{
|
||||
$key = $this->post('key');
|
||||
$where= '';
|
||||
if($key!=''){
|
||||
$where.=" and (b.`uname` like '%$key%' or b.`sericnum` like '$key%')";
|
||||
}
|
||||
$where .= m('admin')->getcompanywhere(1,'a.');
|
||||
return array(
|
||||
'where' => 'and a.`status`=1 and a.`state`<>1 '.$where.'',
|
||||
'table' => '`[Q]'.$table.'` a left join `[Q]flow_bill` b on a.id=b.mid and b.`table`=\''.$table.'\'',
|
||||
'fields' => 'a.id,a.applydt,a.optdt,a.`explain`,a.`state`,a.`type`,b.uname,b.sericnum,b.udeptname'
|
||||
);
|
||||
}
|
||||
public function croptaftershow($table, $rows)
|
||||
{
|
||||
$dgs = m('goods');
|
||||
$typeb = array('0' ,'1' ,'2' ,'3', '4','5');
|
||||
$typea = array('领用单' ,'采购单' ,'销售单' ,'调拨单', '归还单','退货单');
|
||||
$chux = array('0','2');
|
||||
if($rows)foreach($rows as $k=>&$rs){
|
||||
$rs['typev'] = $rs['type'];
|
||||
$rs['type'] = arrvalue($typea, $rs['type']);
|
||||
$lx = 0; //入
|
||||
if(in_array($rs['typev'],$chux))$lx=1;
|
||||
$rs['state'] = $dgs->crkstate($rs['state'], $lx);
|
||||
}
|
||||
return array(
|
||||
'rows' => $rows
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//根据仓库统计
|
||||
public function pdck_beforeshow($table)
|
||||
{
|
||||
$depotid = (int)$this->post('depotid');
|
||||
$where = 'and a.`depotid`='.$depotid.'';
|
||||
$key = $this->post('key');
|
||||
$dt = $this->post('dt');
|
||||
|
||||
if($key!=''){
|
||||
$where .= " and (b.`name` like '%$key%' or b.`num` like '%$key%' or b.`guige` like '%$key%' or b.`xinghao` like '%$key%') ";
|
||||
}
|
||||
if($dt!=''){
|
||||
$where .= " and a.`applydt` <= '$dt'";
|
||||
}
|
||||
|
||||
return array(
|
||||
'table' => '`[Q]goodss` a left join `[Q]goods` b on a.`aid`=b.`id`',
|
||||
'where' => $where,
|
||||
'fields'=> 'b.*,sum(a.`count`) as `stock`',
|
||||
'group' => 'a.`aid`'
|
||||
);
|
||||
}
|
||||
public function pdck_aftershow($table, $rows)
|
||||
{
|
||||
foreach($rows as $k=>$rs){
|
||||
$rows[$k]['typeid'] = $this->gettypename($rs['typeid']);
|
||||
if($rs['stock']<='0')$rows[$k]['ishui']=1;
|
||||
}
|
||||
return array(
|
||||
'rows' => $rows
|
||||
);
|
||||
}
|
||||
|
||||
//打印二维码
|
||||
public function printewmAction()
|
||||
{
|
||||
$sid = c('check')->onlynumber($this->get('sid'));
|
||||
$rows= m('goods')->getall('id in('.$sid.')');
|
||||
|
||||
foreach($rows as $k=>$rs){
|
||||
$rows[$k]['url'] = $this->jm->base64encode('task.php?a=x&num=goods&mid='.$rs['id'].'');
|
||||
}
|
||||
|
||||
$this->assign('rows', $rows);
|
||||
$this->displayfile = ''.P.'/main/assetm/tpl_assetm_printewm.html';
|
||||
$this->title = '物品二维码打印';
|
||||
}
|
||||
}
|
||||
155
webmain/main/goods/rock_goods.php
Normal file
155
webmain/main/goods/rock_goods.php
Normal file
@@ -0,0 +1,155 @@
|
||||
<?php if(!defined('HOST'))die('not access');?>
|
||||
|
||||
<script >
|
||||
$(document).ready(function(){
|
||||
|
||||
var a = $('#view_{rand}').bootstable({
|
||||
tablename:'goods',celleditor:true,fanye:true,modenum:'goods',autoLoad:false,
|
||||
url:publicstore('{mode}','{dir}'),params:{atype:'all'},modename:'物品',storebeforeaction:'beforeshow',storeafteraction:'aftershow',
|
||||
checked:true,
|
||||
columns:[{
|
||||
text:'编号',dataIndex:'num'
|
||||
},{
|
||||
text:'名称',dataIndex:'name',align:'left'
|
||||
},{
|
||||
text:'分类',dataIndex:'typeid',align:'left'
|
||||
},{
|
||||
text:'单价',dataIndex:'price',sortable:true,editor:true
|
||||
},{
|
||||
text:'规格',dataIndex:'guige'
|
||||
},{
|
||||
text:'型号',dataIndex:'xinghao'
|
||||
},{
|
||||
text:'总库存',dataIndex:'stock',sortable:true
|
||||
},{
|
||||
text:'单位',dataIndex:'unit',sortable:true
|
||||
},{
|
||||
text:'',dataIndex:'caozuo'
|
||||
}],
|
||||
itemclick:function(){
|
||||
btn(false);
|
||||
},
|
||||
itemdblclick:function(d){
|
||||
openxiangs('物品 '+d.name,'goods',d.id);
|
||||
}
|
||||
});
|
||||
|
||||
goodsrocks{rand} = function(s){
|
||||
a.reload();
|
||||
}
|
||||
var c = {
|
||||
del:function(){
|
||||
a.del({check:function(lx){if(lx=='yes')btn(true)}});
|
||||
},
|
||||
search:function(){
|
||||
var s=get('key_{rand}').value;
|
||||
a.setparams({key:s},true);
|
||||
},
|
||||
clickwin:function(o1,lx){
|
||||
var icon='plus',name='新增',id=0;
|
||||
if(lx==1){
|
||||
id = a.changeid;
|
||||
};
|
||||
openinput('物品产品','goods', id, 'goodsrocks{rand}');
|
||||
},
|
||||
piliang:function(){
|
||||
managelistgoods = a;
|
||||
addtabs({num:'daorugoods',url:'flow,input,daoru,modenum=goods',icons:'plus',name:'导入物品'});
|
||||
},
|
||||
rukuchu:function(o1, lx){
|
||||
var s='物品入库';
|
||||
if(lx==1)s='物品出库';
|
||||
addtabs({num:'rukuchugood'+lx+'',url:'main,goods,churuku,type='+lx+'',icons:'plus',name:s});
|
||||
},
|
||||
relaodkc:function(){
|
||||
js.ajax(js.getajaxurl('reloadkc','{mode}','{dir}'),{},function(){
|
||||
a.reload();
|
||||
},'get','','刷新中...,刷新完成');
|
||||
},
|
||||
daochu:function(o1){
|
||||
new publicdaochuobj({
|
||||
'objtable':a,
|
||||
'modename':'物品列表',
|
||||
'modenum':'goods',
|
||||
'btnobj':o1
|
||||
});
|
||||
},
|
||||
prinwem:function(){
|
||||
var sid = a.getchecked();
|
||||
if(sid==''){
|
||||
js.msg('msg','没有选中记录');
|
||||
return;
|
||||
}
|
||||
var url = '?a=printewm&m=goods&d=main&sid='+sid+'';
|
||||
window.open(url);
|
||||
},
|
||||
|
||||
|
||||
mobj:a,
|
||||
title:'物品分类',
|
||||
stable:'goods',
|
||||
optionview:'optionview_{rand}',
|
||||
optionnum:'goodstype',
|
||||
rand:'{rand}'
|
||||
};
|
||||
|
||||
var c = new optionclass(c);
|
||||
|
||||
function btn(bo){
|
||||
//get('del_{rand}').disabled = bo;
|
||||
//get('edit_{rand}').disabled = bo;
|
||||
}
|
||||
|
||||
js.initbtn(c);
|
||||
|
||||
});
|
||||
</script>
|
||||
<table width="100%">
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<div style="border:1px #cccccc solid;width:220px">
|
||||
<div id="optionview_{rand}" style="height:400px;overflow:auto;"></div>
|
||||
</div>
|
||||
</td>
|
||||
<td width="10" nowrap> </td>
|
||||
<td width="95%">
|
||||
|
||||
|
||||
<div>
|
||||
<table width="100%"><tr>
|
||||
<td nowrap>
|
||||
<button class="btn btn-primary" click="clickwin,0" type="button"><i class="icon-plus"></i> 新增</button>
|
||||
</td>
|
||||
|
||||
<td style="padding-left:10px">
|
||||
<input class="form-control" style="width:150px" id="key_{rand}" placeholder="物品名">
|
||||
</td>
|
||||
<td style="padding-left:10px">
|
||||
<button class="btn btn-default" click="search" type="button">搜索</button>
|
||||
</td>
|
||||
<td width="80%" style="padding-left:10px">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-default" click="rukuchu,0" type="button">入库</button>
|
||||
<button class="btn btn-default" click="rukuchu,1" type="button">出库</button>
|
||||
</div>
|
||||
</td>
|
||||
<td style="padding-right:10px">
|
||||
<button class="btn btn-default" click="piliang" type="button">导入</button>
|
||||
</td>
|
||||
<td style="padding-right:10px">
|
||||
<button class="btn btn-default" click="daochu" type="button">导出 <i class="icon-angle-down"></i></button>
|
||||
</td>
|
||||
<td align="right" nowrap>
|
||||
<button class="btn btn-default" click="prinwem" type="button">打印二维码</button>
|
||||
<button class="btn btn-default" click="relaodkc" type="button">刷新库存</button>
|
||||
|
||||
</td>
|
||||
</tr></table>
|
||||
</div>
|
||||
<div class="blank10"></div>
|
||||
<div id="view_{rand}"></div>
|
||||
<div class="tishi">在出入库详情需要已审核才会计算库存的,表goodss上字段status=1时。</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
174
webmain/main/goods/rock_goods_churuku.php
Normal file
174
webmain/main/goods/rock_goods_churuku.php
Normal file
@@ -0,0 +1,174 @@
|
||||
<?php if(!defined('HOST'))die('not access');?>
|
||||
<script >
|
||||
$(document).ready(function(){
|
||||
{params}
|
||||
var bools = false,type = params.type,typename='入库',mid=params.mid;
|
||||
if(type==1)typename='出库';
|
||||
if(!mid)mid=0;
|
||||
var a = $('#view_{rand}').bootstable({
|
||||
tablename:'goods',celleditor:true,fanye:true,params:{'type':type,'mid':mid},
|
||||
url:publicstore('{mode}','{dir}'),storebeforeaction:'beforeshow',storeafteraction:'aftershow',
|
||||
columns:[{
|
||||
text:'<font color=red>*</font>要'+typename+'数量',dataIndex:'shu',renderer:function(v,d){
|
||||
var maxss = d.maxcount;
|
||||
if(!maxss)maxss='99999999';
|
||||
var sv = '<input name="shu_{rand}" valid="'+d.id+'" style="width:70px;text-align:center" onfocus="js.focusval=this.value" min="0" max="'+maxss+'" onblur="js.number(this)" type="number" value="" class="form-control">';
|
||||
if(d.maxcount)sv+=' 还可'+typename+'数'+d.maxcount+'';
|
||||
return sv;
|
||||
}
|
||||
},{
|
||||
text:'总库存',dataIndex:'stock',sortable:true
|
||||
},{
|
||||
text:'编号',dataIndex:'num'
|
||||
},{
|
||||
text:'名称',dataIndex:'name'
|
||||
},{
|
||||
text:'分类',dataIndex:'typeid'
|
||||
},{
|
||||
text:'单价',dataIndex:'price',sortable:true
|
||||
},{
|
||||
text:'单位',dataIndex:'unit'
|
||||
},{
|
||||
text:'规格',dataIndex:'guige'
|
||||
},{
|
||||
text:'型号',dataIndex:'xinghao'
|
||||
},{
|
||||
text:'ID',dataIndex:'id'
|
||||
}],
|
||||
itemdblclick:function(d){
|
||||
openxiang('goods',d.id);
|
||||
},
|
||||
load:function(d){
|
||||
if(!bools){
|
||||
if(params.kindname){
|
||||
d.typearr = [{'name':params.kindname,'value':params.kind}];
|
||||
}
|
||||
js.setselectdata(get('type_{rand}'),d.typearr,'value');
|
||||
js.setselectdata(get('depotid_{rand}'),d.depotarr,'id');
|
||||
}
|
||||
bools=true;
|
||||
}
|
||||
});
|
||||
var c = {
|
||||
save:function(o1){
|
||||
var d={dt:$('#dt1_{rand}').val(),'type':type,kind:get('type_{rand}').value,sm:get('explain_{rand}').value,'depotid':get('depotid_{rand}').value,'mid':mid};
|
||||
var msgid='msgview_{rand}';
|
||||
d.cont = c.getshul();
|
||||
if(d.cont==''){
|
||||
js.setmsg('没有输入'+typename+'数量','', msgid);
|
||||
return;
|
||||
}
|
||||
if(d.dt==''){
|
||||
js.setmsg('请选择日期','', msgid);
|
||||
return;
|
||||
}
|
||||
if(d.kind==''){
|
||||
js.setmsg('请选择'+typename+'类型','', msgid);
|
||||
return;
|
||||
}
|
||||
if(d.depotid==''){
|
||||
js.setmsg('请选择'+typename+'的仓库','', msgid);
|
||||
return;
|
||||
}
|
||||
js.setmsg(''+typename+'中...','', msgid);
|
||||
o1.disabled=true;
|
||||
js.ajax(js.getajaxurl('chukuopt','{mode}','{dir}'),d,function(s){
|
||||
if(s=='success'){
|
||||
js.setmsg(''+typename+'成功','green', msgid);
|
||||
a.reload();
|
||||
}else{
|
||||
js.setmsg(s,'', msgid);
|
||||
}
|
||||
o1.disabled=false;
|
||||
},'post');
|
||||
},
|
||||
getshul:function(){
|
||||
var o = $("input[name='shu_{rand}']"),i,s='',o1,val;
|
||||
for(i=0;i<o.length;i++){
|
||||
o1=$(o[i]);
|
||||
val=o1.val();
|
||||
if(!isempt(val)){
|
||||
val=parseFloat(val);
|
||||
if(val>0)s+=','+o1.attr('valid')+'|'+val+'';
|
||||
}
|
||||
}
|
||||
if(s!='')s=s.substr(1);
|
||||
return s;
|
||||
},
|
||||
search:function(){
|
||||
var s=get('key_{rand}').value;
|
||||
a.setparams({key:s},true);
|
||||
},
|
||||
clickdt:function(o1, lx){
|
||||
$(o1).rockdatepicker({initshow:true,view:'date',inputid:'dt'+lx+'_{rand}'});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
js.initbtn(c);
|
||||
|
||||
$('#showte{rand}').html('<b>'+typename+'</b>操作');
|
||||
$('#dt1_{rand}').val(js.now());
|
||||
});
|
||||
</script>
|
||||
<div>
|
||||
<table width="100%"><tr>
|
||||
<td nowrap>
|
||||
<h4 id="showte{rand}">入库操作</h4>
|
||||
</td>
|
||||
<td style="padding-left:10px">
|
||||
<div class="input-group" style="width:250px">
|
||||
<input class="form-control" id="key_{rand}" placeholder="名称/编号/型号">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" click="search" type="button"><i class="icon-search"></i></button>
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td width="80%"></td>
|
||||
<td align="right" nowrap>
|
||||
|
||||
</td>
|
||||
</tr></table>
|
||||
</div>
|
||||
<div class="blank10"></div>
|
||||
<div id="view_{rand}"></div>
|
||||
<div class="blank20"></div>
|
||||
<table width="500">
|
||||
<tr>
|
||||
<td width="120" align="right" ><font color=red>*</font>日期:</td>
|
||||
<td class="tdinput">
|
||||
<div style="width:200px" class="input-group">
|
||||
<input readonly class="form-control" id="dt1_{rand}" >
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" click="clickdt,1" type="button"><i class="icon-calendar"></i></button>
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" ><font color=red>*</font>类型:</td>
|
||||
<td class="tdinput">
|
||||
<select id="type_{rand}" style="width:200px" class="form-control"><option value="">-请选择-</option></select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" ><font color=red>*</font>选择仓库:</td>
|
||||
<td class="tdinput">
|
||||
<select id="depotid_{rand}" style="width:200px" class="form-control"><option value="">-请选择-</option></select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" >说明:</td>
|
||||
<td class="tdinput">
|
||||
<textarea id="explain_{rand}" class="form-control" style="height:60px"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right"></td>
|
||||
<td style="padding:15px 0px" colspan="3" align="left"><button click="save" class="btn btn-success" id="save_{rand}" type="button"><i class="icon-save"></i> 确认提交</button> <span id="msgview_{rand}"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="blank10"></div>
|
||||
71
webmain/main/goods/rock_goods_cropt.php
Normal file
71
webmain/main/goods/rock_goods_cropt.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php if(!defined('HOST'))die('not access');?>
|
||||
<script >
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
|
||||
var a = $('#view_{rand}').bootstable({
|
||||
tablename:'goodm',fanye:true,dir:'desc',sort:'a.id',storebeforeaction:'croptbeforeshow',storeafteraction:'croptaftershow', url:publicstore('{mode}','{dir}'),
|
||||
columns:[{
|
||||
text:'单号',dataIndex:'sericnum'
|
||||
},{
|
||||
text:'申请人',dataIndex:'uname'
|
||||
},{
|
||||
text:'申请人部门',dataIndex:'udeptname'
|
||||
},{
|
||||
text:'类型',dataIndex:'type',sortable:true
|
||||
},{
|
||||
text:'申请日期',dataIndex:'applydt',sortable:true
|
||||
},{
|
||||
text:'操作时间',dataIndex:'optdt'
|
||||
},{
|
||||
text:'说明',dataIndex:'explain',align:'left'
|
||||
},{
|
||||
text:'出入库状态',dataIndex:'state'
|
||||
},{
|
||||
text:'',dataIndex:'opt',renderer:function(v,d){
|
||||
var v='<a href="javascript:;" onclick="rukuope{rand}('+d.id+','+d.typev+')">去操作</a>';
|
||||
return v;
|
||||
}
|
||||
}]
|
||||
});
|
||||
var c = {
|
||||
search:function(){
|
||||
var s=get('key_{rand}').value;
|
||||
a.setparams({key:s},true);
|
||||
}
|
||||
};
|
||||
|
||||
rukuope{rand}=function(id,kind){
|
||||
var lex = ['领用出库','采购入库','销售出库','调拨入库','归还入库','退货入库'];
|
||||
var typa= [1,0,1,0,0,0];
|
||||
var kina= [0,0,1,3,1,4]; //从数据选项中的来的
|
||||
var type = typa[kind]; //0入库,1出库
|
||||
addtabs({url:'main,goods,churuku,type='+type+',mid='+id+',kind='+kina[kind]+',kindname='+lex[kind]+'','num':'rukuopt'+id+'',name:''+id+'.'+lex[kind]+''});
|
||||
}
|
||||
|
||||
js.initbtn(c);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<div>
|
||||
<table width="100%"><tr>
|
||||
|
||||
<td >
|
||||
<input class="form-control" style="width:200px" id="key_{rand}" placeholder="申请人/单号">
|
||||
</td>
|
||||
<td style="padding-left:10px">
|
||||
<button class="btn btn-default" click="search" type="button">搜索</button>
|
||||
</td>
|
||||
|
||||
<td width="90%">
|
||||
<span id="megss{rand}"></span>
|
||||
</td>
|
||||
<td align="right" nowrap>
|
||||
|
||||
</td>
|
||||
</tr></table>
|
||||
</div>
|
||||
<div class="blank10"></div>
|
||||
<div id="view_{rand}"></div>
|
||||
127
webmain/main/goods/rock_goods_pandian.php
Normal file
127
webmain/main/goods/rock_goods_pandian.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php if(!defined('HOST'))die('not access');?>
|
||||
<script >
|
||||
$(document).ready(function(){
|
||||
var lbefe = false;
|
||||
var at = $('#optionview_{rand}').bootstree({
|
||||
url:js.getajaxurl('gettreedata','option','system',{'num':'goodstype'}),
|
||||
columns:[{
|
||||
text:'物品分类',dataIndex:'name',align:'left',xtype:'treecolumn',width:'79%'
|
||||
},{
|
||||
text:'ID',dataIndex:'id',width:'20%'
|
||||
}],
|
||||
load:function(d){
|
||||
c.loadfile('0','所有物品');
|
||||
},
|
||||
itemdblclick:function(d){
|
||||
c.loadfile(d.id,d.name);
|
||||
}
|
||||
});
|
||||
|
||||
var columns = [{
|
||||
text:'编号',dataIndex:'num'
|
||||
},{
|
||||
text:'名称',dataIndex:'name',align:'left'
|
||||
},{
|
||||
text:'分类',dataIndex:'typeid',align:'left'
|
||||
},{
|
||||
text:'单价',dataIndex:'price',sortable:true
|
||||
},{
|
||||
text:'单位',dataIndex:'unit'
|
||||
},{
|
||||
text:'规格',dataIndex:'guige'
|
||||
},{
|
||||
text:'型号',dataIndex:'xinghao'
|
||||
},{
|
||||
text:'ID',dataIndex:'id',sortable:true
|
||||
},{
|
||||
text:'总库存',dataIndex:'stock',sortable:true
|
||||
}];
|
||||
|
||||
var a = $('#view_{rand}').bootstable({
|
||||
tablename:'goods',celleditor:true,fanye:true,modenum:'goods',autoLoad:false,
|
||||
url:publicstore('{mode}','{dir}'),params:{'atype':'pan'},storebeforeaction:'beforeshow',storeafteraction:'aftershow',
|
||||
columns:columns,
|
||||
loadbefore:function(d){
|
||||
if(!lbefe && d.depotarr){
|
||||
for(var i=0;i<d.depotarr.length;i++)columns.push({text:d.depotarr[i].namea,dataIndex:'stockdepotid'+d.depotarr[i].id+''});
|
||||
a.setColumns(columns);
|
||||
}
|
||||
lbefe = true;
|
||||
},
|
||||
itemdblclick:function(d){
|
||||
openxiangs('【'+d.name+'】详情','goods',d.id);
|
||||
}
|
||||
});
|
||||
var c = {
|
||||
search:function(){
|
||||
var s=get('key_{rand}').value;
|
||||
a.setparams({key:s,dt:get('dt1_{rand}').value},true);
|
||||
},
|
||||
|
||||
daochu:function(o1){
|
||||
new publicdaochuobj({
|
||||
'objtable':a,
|
||||
'modename':'物品盘点',
|
||||
'btnobj':o1
|
||||
});
|
||||
},
|
||||
loadfile:function(spd,nsd){
|
||||
$('#megss{rand}').html(nsd);
|
||||
a.setparams({'typeid':spd}, true);
|
||||
},
|
||||
genmu:function(){
|
||||
this.loadfile('0','所有物品');
|
||||
},
|
||||
del:function(){
|
||||
a.del({checked:true,url:js.getajaxurl('delxiang','{mode}','{dir}')});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
js.initbtn(c);
|
||||
|
||||
$('#optionview_{rand}').css('height',''+(viewheight-25)+'px');
|
||||
});
|
||||
</script>
|
||||
|
||||
<table width="100%">
|
||||
<tr valign="top">
|
||||
<td width="220">
|
||||
<div style="border:1px #cccccc solid;width:220px">
|
||||
<div id="optionview_{rand}" style="height:400px;overflow:auto;"></div>
|
||||
</div>
|
||||
</td>
|
||||
<td width="10" nowrap> </td>
|
||||
<td>
|
||||
|
||||
|
||||
<div>
|
||||
<table width="100%"><tr>
|
||||
<td align="left" nowrap>
|
||||
<button class="btn btn-default" click="genmu" type="button">所有物品</button>
|
||||
</td>
|
||||
<td nowrap style="padding-left:10px">
|
||||
<input placeholder="日期" style="width:120px" onclick="js.changedate(this)" readonly class="form-control datesss" id="dt1_{rand}" >
|
||||
</td>
|
||||
|
||||
<td style="padding-left:10px">
|
||||
<input class="form-control" style="width:200px" id="key_{rand}" placeholder="物品名/型号/规格">
|
||||
</td>
|
||||
<td style="padding-left:10px">
|
||||
<button class="btn btn-default" click="search" type="button">搜索</button>
|
||||
</td>
|
||||
|
||||
<td width="90%">
|
||||
<span id="megss{rand}"></span>
|
||||
</td>
|
||||
<td align="right" nowrap>
|
||||
<button class="btn btn-default" click="daochu,1" type="button">导出 <i class="icon-angle-down"></i></button>
|
||||
</td>
|
||||
</tr></table>
|
||||
</div>
|
||||
<div class="blank10"></div>
|
||||
<div id="view_{rand}"></div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
76
webmain/main/goods/rock_goods_pdck.php
Normal file
76
webmain/main/goods/rock_goods_pdck.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php if(!defined('HOST'))die('not access');?>
|
||||
<script >
|
||||
$(document).ready(function(){
|
||||
{params}
|
||||
//根据仓库统计下面的物品数量
|
||||
var depotid = params.depotid;if(!depotid)depotid='';
|
||||
|
||||
var columns = [{
|
||||
text:'编号',dataIndex:'num'
|
||||
},{
|
||||
text:'名称',dataIndex:'name',align:'left'
|
||||
},{
|
||||
text:'分类',dataIndex:'typeid',align:'left'
|
||||
},{
|
||||
text:'单价',dataIndex:'price',sortable:true
|
||||
},{
|
||||
text:'单位',dataIndex:'unit'
|
||||
},{
|
||||
text:'规格',dataIndex:'guige'
|
||||
},{
|
||||
text:'型号',dataIndex:'xinghao'
|
||||
},{
|
||||
text:'ID',dataIndex:'id',sortable:true
|
||||
},{
|
||||
text:'数量',dataIndex:'stock'
|
||||
}];
|
||||
|
||||
var a = $('#view_{rand}').bootstable({
|
||||
tablename:'goodss',celleditor:true,fanye:true,
|
||||
url:publicstore('{mode}','{dir}'),params:{'depotid':depotid},storebeforeaction:'pdck_beforeshow',storeafteraction:'pdck_aftershow',
|
||||
columns:columns
|
||||
});
|
||||
var c = {
|
||||
search:function(){
|
||||
var s=get('key_{rand}').value;
|
||||
a.setparams({key:s,dt:get('dt1_{rand}').value},true);
|
||||
},
|
||||
|
||||
daochu:function(o1){
|
||||
publicdaochuobj({
|
||||
'objtable':a,
|
||||
'btnobj':o1
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
js.initbtn(c);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<div>
|
||||
<table width="100%"><tr>
|
||||
|
||||
<td align="left" nowrap>
|
||||
<input placeholder="截止日期" style="width:120px" onclick="js.changedate(this)" readonly class="form-control datesss" id="dt1_{rand}" >
|
||||
</td>
|
||||
|
||||
<td style="padding-left:10px">
|
||||
<input class="form-control" style="width:200px" id="key_{rand}" placeholder="物品名/型号/规格">
|
||||
</td>
|
||||
<td style="padding-left:10px">
|
||||
<button class="btn btn-default" click="search" type="button">搜索</button>
|
||||
</td>
|
||||
|
||||
<td width="90%">
|
||||
|
||||
</td>
|
||||
<td align="right" nowrap>
|
||||
<button class="btn btn-default" click="daochu,1" type="button">导出 <i class="icon-angle-down"></i></button>
|
||||
</td>
|
||||
</tr></table>
|
||||
</div>
|
||||
<div class="blank10"></div>
|
||||
<div id="view_{rand}"></div>
|
||||
144
webmain/main/goods/rock_goods_xiang.php
Normal file
144
webmain/main/goods/rock_goods_xiang.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php if(!defined('HOST'))die('not access');?>
|
||||
<script >
|
||||
$(document).ready(function(){
|
||||
|
||||
var at = $('#optionview_{rand}').bootstree({
|
||||
url:js.getajaxurl('gettreedata','option','system',{'num':'goodstype'}),
|
||||
columns:[{
|
||||
text:'物品分类',dataIndex:'name',align:'left',xtype:'treecolumn',width:'79%'
|
||||
},{
|
||||
text:'ID',dataIndex:'id',width:'20%'
|
||||
}],
|
||||
load:function(d){
|
||||
c.loadfile('0','所有出入库详情');
|
||||
},
|
||||
itemdblclick:function(d){
|
||||
c.loadfile(d.id,d.name);
|
||||
}
|
||||
});
|
||||
var forbo = false;
|
||||
var a = $('#view_{rand}').bootstable({
|
||||
tablename:'goodss',autoLoad:false,celleditor:true,fanye:true,dir:'desc',sort:'a.id',checked:true,
|
||||
url:publicstore('{mode}','{dir}'),storebeforeaction:'xiangbeforeshow',storeafteraction:'xiangaftershow',
|
||||
columns:[{
|
||||
text:'名称',dataIndex:'name',align:'left'
|
||||
},{
|
||||
text:'规格',dataIndex:'guige'
|
||||
},{
|
||||
text:'型号',dataIndex:'xinghao'
|
||||
},{
|
||||
text:'分类',dataIndex:'typeid',align:'left'
|
||||
},{
|
||||
text:'类型',dataIndex:'kind',sortable:true
|
||||
},{
|
||||
text:'日期',dataIndex:'applydt',sortable:true
|
||||
},{
|
||||
text:'操作人',dataIndex:'optname'
|
||||
},{
|
||||
text:'数量',dataIndex:'count',sortable:true,align:'right'
|
||||
},{
|
||||
text:'对应仓库',dataIndex:'depotname'
|
||||
},{
|
||||
text:'说明',dataIndex:'explain',align:'left'
|
||||
},{
|
||||
text:'状态',dataIndex:'status'
|
||||
}],
|
||||
loadbefore:function(d){
|
||||
if(!forbo){
|
||||
var d1 = [];
|
||||
for(var i in d.tyeparr)d1.push({value:i,name:d.tyeparr[i]});
|
||||
js.setselectdata(get('type_{rand}'),d1,'value');
|
||||
}
|
||||
forbo = true;
|
||||
}
|
||||
});
|
||||
var c = {
|
||||
search:function(){
|
||||
var s=get('key_{rand}').value;
|
||||
a.setparams({key:s,dt:get('dt1_{rand}').value},true);
|
||||
},
|
||||
clickdt:function(o1, lx){
|
||||
$(o1).rockdatepicker({initshow:true,view:'month',inputid:'dt'+lx+'_{rand}'});
|
||||
},
|
||||
daochu:function(o1){
|
||||
publicdaochuobj({
|
||||
'objtable':a,
|
||||
'modename':'物品出入库详情',
|
||||
'btnobj':o1
|
||||
});
|
||||
},
|
||||
loadfile:function(spd,nsd){
|
||||
$('#megss{rand}').html(nsd);
|
||||
a.setparams({'typeid':spd}, true);
|
||||
},
|
||||
genmu:function(){
|
||||
this.loadfile('0','所有出入库详情');
|
||||
},
|
||||
del:function(){
|
||||
a.del({checked:true,url:js.getajaxurl('delxiang','{mode}','{dir}')});
|
||||
},
|
||||
changetype:function(o1){
|
||||
a.setparams({types:o1.value},true);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
js.initbtn(c);
|
||||
|
||||
$('#optionview_{rand}').css('height',''+(viewheight-25)+'px');
|
||||
$('#type_{rand}').change(function(){
|
||||
c.changetype(this);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<table width="100%">
|
||||
<tr valign="top">
|
||||
<td width="220">
|
||||
<div style="border:1px #cccccc solid">
|
||||
<div id="optionview_{rand}" style="height:400px;overflow:auto;"></div>
|
||||
</div>
|
||||
</td>
|
||||
<td width="10"></td>
|
||||
<td>
|
||||
|
||||
|
||||
<div>
|
||||
<table width="100%"><tr>
|
||||
<td align="left" nowrap>
|
||||
<button class="btn btn-default" click="genmu" type="button">所有详情</button>
|
||||
</td>
|
||||
<td nowrap style="padding-left:10px">
|
||||
<div style="width:120px" class="input-group">
|
||||
<input placeholder="月份" readonly class="form-control" id="dt1_{rand}" >
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" click="clickdt,1" type="button"><i class="icon-calendar"></i></button>
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td style="padding-left:10px">
|
||||
<input class="form-control" style="width:200px" id="key_{rand}" placeholder="物品名/操作人/仓库">
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" style="width:130px" id="type_{rand}"><option value="">所有类型</option></select>
|
||||
</td>
|
||||
<td style="padding-left:10px">
|
||||
<button class="btn btn-default" click="search" type="button">搜索</button>
|
||||
</td>
|
||||
|
||||
<td width="90%">
|
||||
<span id="megss{rand}"></span>
|
||||
</td>
|
||||
<td align="right" nowrap>
|
||||
<button class="btn btn-default" click="daochu,1" type="button">导出 <i class="icon-angle-down"></i></button>
|
||||
<button class="btn btn-danger" id="del_{rand}" click="del" type="button"><i class="icon-trash"></i> 删除</button>
|
||||
</td>
|
||||
</tr></table>
|
||||
</div>
|
||||
<div class="blank10"></div>
|
||||
<div id="view_{rand}"></div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
Reference in New Issue
Block a user