Browse Source

物料库存数量金额

zhuth 7 years ago
parent
commit
6b65da37d0

+ 97 - 108
frontend/saas-web/app/view/stock/report/DataList.js

@@ -12,160 +12,149 @@ Ext.define('saas.view.stock.report.DataList', {
     // listUrl: 'http://192.168.253.41:8560/api/document/product/ReserveCost',
     defaultCondition: null,
     reportTitle: '物料库存数量金额表',
-    QueryWidth:0.15,
+    QueryWidth: 0.4,
     printAble: false,
     exportAble: true,
 
     searchItems: [{
         name: 'pr_code',
         xtype: 'textfield',
-        emptyText : '物料编号',
-        columnWidth: 0.15
-    },{
-        name: 'pr_detail',
-        xtype: 'textfield',
-        emptyText : '物料名称',
-        columnWidth: 0.15
-    },{
-        name: 'wh_code',
-        xtype: 'textfield',
-        emptyText : '仓库编号',
-        columnWidth: 0.15
-    },{
-        name: 'wh_description',
-        xtype: 'textfield',
-        emptyText : '仓库名称',
-        columnWidth: 0.15
+        emptyText: '物料编号/名称/规格',
+        columnWidth: 0.25,
+        getCondition: function (v) {
+            if (v) {
+                return "(upper(pr_spec) like '%" + v.toUpperCase() + "%' or upper(pr_code) like '%" + v.toUpperCase() + "%' or upper(pr_detail) like '%" + v.toUpperCase() + "%')";
+            } else {
+                return '1 = 1';
+            }
+        },
     }, {
-        name: 'wh_description',
+        name: 'wh_code',
         xtype: 'textfield',
-        emptyText : '仓库名称',
-        columnWidth: 0.15
+        emptyText: '仓库编号/名称',
+        columnWidth: 0.25,
+        hidden: true,
+        getCondition: function (v) {
+            if (v) {
+                return "(upper(wh_code) like '%" + v.toUpperCase() + "%' or upper(wh_description) like '%" + v.toUpperCase() + "%')";
+            } else {
+                return '1 = 1';
+            }
+        }
     }, {
         name: 'toggle',
         xtype: 'checkbox',
-        fieldLabel : '分仓库存',
+        fieldLabel: '分仓库存',
         columnWidth: 0.1,
+        labelAlign: 'left',
+        labelWidth: 50,
         ignore: true,
         listeners: {
             change: 'toggle_change'
         }
     }],
 
-    reportColumns2 : [{
-        text : "物料编号", 
-        width : 150, 
-        dataIndex : "rc_prodCode", 
-        xtype : "", 
-    },{
-        text : "物料名称", 
-        width : 200.0, 
-        dataIndex : "rc_prodDetail", 
-    }, 
-    {
-        text : "物料规格", 
-        dataIndex : "rc_prodSpec", 
-        width : 150.0, 
-    }, 
-    {
-        text : "单位", 
-        dataIndex : "rc_prodUnit", 
-        width : 80.0, 
-    }, 
-    {
-        text : "仓库编号", 
-        dataIndex : "rc_whCode", 
-        width : 150, 
-    }, 
-    {
-        text : "仓库名称", 
-        dataIndex : "rc_whName", 
-        width : 200.0, 
-    }, 
-    {
-        text : "数量",
+    reportColumns2: [{
+        text: "物料编号",
+        width: 200,
+        dataIndex: "rc_prodCode",
+        xtype: "",
+    }, {
+        text: "物料名称",
+        width: 200,
+        dataIndex: "rc_prodDetail",
+    }, {
+        text: "物料规格",
+        dataIndex: "rc_prodSpec",
+        width: 200,
+    }, {
+        text: "单位",
+        dataIndex: "rc_prodUnit",
+        width: 150,
+    }, {
+        text: "仓库编号",
+        dataIndex: "rc_whCode",
+        width: 200,
+    }, {
+        text: "仓库名称",
+        dataIndex: "rc_whName",
+        width: 200,
+    }, {
+        text: "数量",
         xtype: 'numbercolumn',
-        dataIndex : "rc_number", 
-        width : 110.0, 
-        renderer : function(v) {
+        dataIndex: "rc_number",
+        width: 150,
+        renderer: function (v) {
             var arr = (v + '.').split('.');
-            var xr = (new Array(arr[1].length>3?3:arr[1].length)).fill('0');
+            var xr = (new Array(arr[1].length > 3 ? 3 : arr[1].length)).fill('0');
             var format = '0.' + xr.join();
             return Ext.util.Format.number(v, format);
         }
-    }, 
-    {
-        text : "单价",
+    }, {
+        text: "单价",
         xtype: 'numbercolumn',
         align: 'end',
-        dataIndex : "rc_price", 
-        width : 110.0, 
-        renderer : function(v) {
+        dataIndex: "rc_price",
+        width: 150,
+        renderer: function (v) {
             var arr = (v + '.').split('.');
-            var xr = (new Array(arr[1].length>8?8:arr[1].length)).fill('0');
+            var xr = (new Array(arr[1].length > 8 ? 8 : arr[1].length)).fill('0');
             var format = '0.' + xr.join();
             return Ext.util.Format.number(v, format);
         }
-    }, 
-    {
-        text : "金额", 
+    }, {
+        text: "金额",
         xtype: 'numbercolumn',
-        dataIndex : "rc_amount", 
-        width : 110.0,
-        renderer : function(v) {
+        dataIndex: "rc_amount",
+        width: 150,
+        renderer: function (v) {
             var arr = (v + '.').split('.');
-            var xr = (new Array(arr[1].length>2?2:arr[1].length)).fill('0');
+            var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
             var format = '0.' + xr.join();
             return Ext.util.Format.number(v, format);
         },
     }],
 
-    reportColumns : [{
-        text : "物料编号", 
-        width : 150, 
-        dataIndex : "rc_prodCode", 
-        xtype : "", 
-    },{
-        text : "物料名称", 
-        width : 200.0, 
-        dataIndex : "rc_prodDetail", 
-    }, 
-    {
-        text : "物料规格", 
-        dataIndex : "rc_prodSpec", 
-        width : 150.0, 
-    }, 
-    {
-        text : "单位", 
-        dataIndex : "rc_prodUnit", 
-        width : 80.0, 
-    }, 
-    {
-        text : "数量",
+    reportColumns: [{
+        text: "物料编号",
+        width: 200,
+        dataIndex: "rc_prodCode",
+        xtype: "",
+    }, {
+        text: "物料名称",
+        width: 200,
+        dataIndex: "rc_prodDetail",
+    }, {
+        text: "物料规格",
+        dataIndex: "rc_prodSpec",
+        width: 200,
+    }, {
+        text: "单位",
+        dataIndex: "rc_prodUnit",
+        width: 150,
+    }, {
+        text: "数量",
         xtype: 'numbercolumn',
-        dataIndex : "rc_number", 
-        width : 110.0, 
-        renderer : function(v) {
+        dataIndex: "rc_number",
+        width: 150,
+        renderer: function (v) {
             var arr = (v + '.').split('.');
-            var xr = (new Array(arr[1].length>3?3:arr[1].length)).fill('0');
+            var xr = (new Array(arr[1].length > 3 ? 3 : arr[1].length)).fill('0');
             var format = '0.' + xr.join();
             return Ext.util.Format.number(v, format);
         }
-    }, 
-    {
-        text : "金额", 
+    }, {
+        text: "金额",
         xtype: 'numbercolumn',
-        dataIndex : "rc_amount", 
-        width : 110.0,
-        renderer : function(v) {
+        dataIndex: "rc_amount",
+        width: 150,
+        renderer: function (v) {
             var arr = (v + '.').split('.');
-            var xr = (new Array(arr[1].length>2?2:arr[1].length)).fill('0');
+            var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
             var format = '0.' + xr.join();
             return Ext.util.Format.number(v, format);
         },
     }, {
         flex: 1
     }],
-})
-
-
+})

+ 5 - 0
frontend/saas-web/app/view/stock/report/DataListController.js

@@ -5,9 +5,14 @@ Ext.define('saas.view.stock.report.DataListController', {
     toggle_change: function(field, newValue, oldValue, eOpts) {
         var me = this,
         reportPanel = me.getView(),
+        form = reportPanel.down('form'),
         grid = reportPanel.down('grid'),
         store = grid.store;
         
+        var whCodeField = form.getForm().findField('wh_code');
+        whCodeField.setValue('');
+        whCodeField.setHidden(!newValue);
+
         if(newValue) {
             reportPanel.queryMode = 'DETAIL';
             store.load(function() {