版本10012,OA办公管理系统(标准版)中,物品管理模块中的 表单application 中字段"当前库存"的代码如下:
我不明白的是 statelabel is not null 这句,这里的变量statelabel是怎么来的啊?
#include "businesslib";
convertToFont(getInventoryByItemCode(getItemValue("itemcode")));
function getInventoryByItemCode(itemcode){
var inventory = 0; //库存
if (itemcode != null && itemcode.trim().length() > 0) {
var sql = "select sum(item_quantity) from tlk_storage where item_status='确认' and item_itemcode='"+itemcode+"'";
var storage = sumBySQL(sql); //入库数
//var sql1 = "select sum(item_quantity) from tlk_application where statelabel<>'提交申请' and item_status<>'退还' and item_itemcode='"+itemcode+"'";
var sql1 = "select sum(item_quantity) from tlk_application where statelabel is not null and item_status<>'退还' and item_itemcode='"+itemcode+"'";
var application = sumBySQL(sql1); //申请数
inventory = storage - application;
}
return inventory;