Browse Source

其他出/入库倒算逻辑

zhuth 7 years ago
parent
commit
0c3e01f272

+ 23 - 29
frontend/saas-web/app/model/stock/OtherIn.js

@@ -14,43 +14,37 @@ Ext.define('saas.model.stock.OtherIn', {
         { name: 'pr_unit', type: 'string' }, // 单位
         { name: 'pd_netprice', type: 'float' }, // 单价
         { name: 'pd_orderprice', type: 'float', // 含税单价
-            // convert: function(v, rec) {
-            //     var t = rec.get('pd_netprice') * (1 + rec.get('pd_taxrate') / 100);
-            //     return Number(saas.util.BaseUtil.numberFormat(t, 4, false));
-            // },
-            // depends: ['pd_netprice', 'pd_taxrate']
+            convert: function(v, rec) {
+                var t = rec.get('pd_netprice') * (1 + rec.get('pd_taxrate') / 100);
+                return Number(saas.util.BaseUtil.numberFormat(t, 4, false));
+            },
+            depends: ['pd_netprice', 'pd_taxrate']
         },
         { name: 'pd_nettotal', type: 'float', // 金额
-            // convert: function(v, rec) {
-            //     var t = rec.get('pd_netprice') * rec.get('pd_outqty');
-            //     return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
-            // },
-            // depends: ['pd_netprice', 'pd_outqty']
+            convert: function(v, rec) {
+                var t = rec.get('pd_netprice') * rec.get('pd_inqty');
+                return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
+            },
+            depends: ['pd_netprice', 'pd_inqty']
         },
         { name: 'pd_taxrate', type: 'float' }, // 税率
         { name: 'pd_taxamount', type: 'float', // 税额
-            // convert: function(v, rec) {
-            //     var t = rec.get('pd_ordertotal') - rec.get('pd_nettotal');
-            //     return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
-            // },
-            // depends: ['pd_ordertotal', 'pd_nettotal']
+            convert: function(v, rec) {
+                var t = rec.get('pd_ordertotal') - rec.get('pd_nettotal');
+                return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
+            },
+            depends: ['pd_ordertotal', 'pd_nettotal']
         },
         { name: 'pd_ordertotal', type: 'float', // 价税合计
-            // convert: function(v, rec) {
-            //     var t = rec.get('pd_orderprice') * rec.get('pd_outqty');
-            //     return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
-            // },
-            // depends: ['pd_orderprice', 'pd_outqty']
+            convert: function(v, rec) {
+                var t = rec.get('pd_orderprice') * rec.get('pd_inqty');
+                return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
+            },
+            depends: ['pd_orderprice', 'pd_inqty']
         },
-        { name: 'pd_whid', type: 'int' }, // 拨出仓库id
-        { name: 'pd_whcode', type: 'string' }, // 拨出仓库编号
-        { name: 'pd_whname', type: 'string' }, // 拨出仓库
-        { name: 'pd_inwhid', type: 'int' }, // 拨入仓库id
-        { name: 'pd_inwhcode', type: 'string' }, // 拨入仓库编号
-        { name: 'pd_inwhname', type: 'string' }, // 拨入仓库
-        { name: 'pd_ioid', type: 'int' }, // 验收明细id
-        { name: 'iocode', type: 'string' }, // 验收单号
-        { name: 'iodetno', type: 'int' }, // 验收序号
+        { name: 'pd_whid', type: 'int' }, // 仓库id
+        { name: 'pd_whcode', type: 'string' }, // 仓库编号
+        { name: 'pd_whname', type: 'string' }, // 仓库
         { name: 'pd_remark', type: 'string' }, // 备注
 
         { name: 'pd_text1', type: 'string' },

+ 23 - 29
frontend/saas-web/app/model/stock/OtherOut.js

@@ -14,43 +14,37 @@ Ext.define('saas.model.stock.OtherOut', {
         { name: 'pr_unit', type: 'string' }, // 单位
         { name: 'pd_netprice', type: 'float' }, // 单价
         { name: 'pd_orderprice', type: 'float', // 含税单价
-            // convert: function(v, rec) {
-            //     var t = rec.get('pd_netprice') * (1 + rec.get('pd_taxrate') / 100);
-            //     return Number(saas.util.BaseUtil.numberFormat(t, 4, false));
-            // },
-            // depends: ['pd_netprice', 'pd_taxrate']
+            convert: function(v, rec) {
+                var t = rec.get('pd_netprice') * (1 + rec.get('pd_taxrate') / 100);
+                return Number(saas.util.BaseUtil.numberFormat(t, 4, false));
+            },
+            depends: ['pd_netprice', 'pd_taxrate']
         },
         { name: 'pd_nettotal', type: 'float', // 金额
-            // convert: function(v, rec) {
-            //     var t = rec.get('pd_netprice') * rec.get('pd_outqty');
-            //     return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
-            // },
-            // depends: ['pd_netprice', 'pd_outqty']
+            convert: function(v, rec) {
+                var t = rec.get('pd_netprice') * rec.get('pd_outqty');
+                return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
+            },
+            depends: ['pd_netprice', 'pd_outqty']
         },
         { name: 'pd_taxrate', type: 'float' }, // 税率
         { name: 'pd_taxamount', type: 'float', // 税额
-            // convert: function(v, rec) {
-            //     var t = rec.get('pd_ordertotal') - rec.get('pd_nettotal');
-            //     return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
-            // },
-            // depends: ['pd_ordertotal', 'pd_nettotal']
+            convert: function(v, rec) {
+                var t = rec.get('pd_ordertotal') - rec.get('pd_nettotal');
+                return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
+            },
+            depends: ['pd_ordertotal', 'pd_nettotal']
         },
         { name: 'pd_ordertotal', type: 'float', // 价税合计
-            // convert: function(v, rec) {
-            //     var t = rec.get('pd_orderprice') * rec.get('pd_outqty');
-            //     return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
-            // },
-            // depends: ['pd_orderprice', 'pd_outqty']
+            convert: function(v, rec) {
+                var t = rec.get('pd_orderprice') * rec.get('pd_outqty');
+                return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
+            },
+            depends: ['pd_orderprice', 'pd_outqty']
         },
-        { name: 'pd_whid', type: 'int' }, // 拨出仓库id
-        { name: 'pd_whcode', type: 'string' }, // 拨出仓库编号
-        { name: 'pd_whname', type: 'string' }, // 拨出仓库
-        { name: 'pd_inwhid', type: 'int' }, // 拨入仓库id
-        { name: 'pd_inwhcode', type: 'string' }, // 拨入仓库编号
-        { name: 'pd_inwhname', type: 'string' }, // 拨入仓库
-        { name: 'pd_ioid', type: 'int' }, // 验收明细id
-        { name: 'iocode', type: 'string' }, // 验收单号
-        { name: 'iodetno', type: 'int' }, // 验收序号
+        { name: 'pd_whid', type: 'int' }, // 仓库id
+        { name: 'pd_whcode', type: 'string' }, // 仓库编号
+        { name: 'pd_whname', type: 'string' }, // 仓库
         { name: 'pd_remark', type: 'string' }, // 备注
 
         { name: 'pd_text1', type: 'string' },

+ 308 - 317
frontend/saas-web/app/view/stock/otherIn/FormPanel.js

@@ -6,24 +6,24 @@ Ext.define('saas.view.stock.otherIn.FormPanel', {
     viewModel: 'stock-otherin-formpanel',
 
     viewName: 'stock-otherin-formpanel',
-    caller:'OtherIn',
-    
-     //字段属性
-    
-    _title:'其它入库单',
+    caller: 'OtherIn',
+
+    //字段属性
+
+    _title: '其它入库单',
     _idField: 'id',
     _codeField: 'pi_inoutno',
     _statusField: 'pi_status',
     _statusCodeField: 'pi_statuscode',
     _auditmanField: 'pi_auditman',
-    _auditdateField:'pi_auditdate',
+    _auditdateField: 'pi_auditdate',
     _relationColumn: 'pd_piid',
-    _readUrl:'/api/storage/prodinout/read',
-    _saveUrl:'/api/storage/prodinout/save',
-    _auditUrl:'/api/storage/prodinout/audit',
+    _readUrl: '/api/storage/prodinout/read',
+    _saveUrl: '/api/storage/prodinout/save',
+    _auditUrl: '/api/storage/prodinout/audit',
     _unAuditUrl: '/api/storage/prodinout/unAudit',
-    _deleteUrl:'/api/storage/prodinout/delete',
-    initId:0,
+    _deleteUrl: '/api/storage/prodinout/delete',
+    initId: 0,
 
     toolBtns: [],
 
@@ -33,20 +33,20 @@ Ext.define('saas.view.stock.otherIn.FormPanel', {
         fieldLabel: 'id',
         allowBlank: true,
         columnWidth: 0
-    },{
-        xtype : "hidden", 
-        name : "pi_class", 
-        fieldLabel : "单据类型", 
-        readOnly:true,
-        allowBlank : true, 
-        columnWidth : 0.25
-    },{
-        xtype : "hidden", 
-        name : "pi_custid", 
-        fieldLabel : "客户ID", 
-        allowBlank : true, 
-        columnWidth : 0.0
-    },{
+    }, {
+        xtype: "hidden",
+        name: "pi_class",
+        fieldLabel: "单据类型",
+        readOnly: true,
+        allowBlank: true,
+        columnWidth: 0.25
+    }, {
+        xtype: "hidden",
+        name: "pi_custid",
+        fieldLabel: "客户ID",
+        allowBlank: true,
+        columnWidth: 0.0
+    }, {
         xtype: 'hidden',
         name: 'pi_custcode',
         fieldLabel: '客户编号'
@@ -54,13 +54,13 @@ Ext.define('saas.view.stock.otherIn.FormPanel', {
         xtype: 'hidden',
         name: 'pi_custname',
         fieldLabel: '客户名称'
-    },{
-        xtype : "hidden", 
-        name : "pi_vendid", 
-        fieldLabel : "供应商ID", 
-        allowBlank : true, 
-        columnWidth : 0.0
-    },{
+    }, {
+        xtype: "hidden",
+        name: "pi_vendid",
+        fieldLabel: "供应商ID",
+        allowBlank: true,
+        columnWidth: 0.0
+    }, {
         xtype: 'hidden',
         name: 'pi_vendcode',
         fieldLabel: '供应商编号'
@@ -68,309 +68,300 @@ Ext.define('saas.view.stock.otherIn.FormPanel', {
         xtype: 'vendorDbfindTrigger',
         name: 'pi_vendname',
         fieldLabel: '供应商名称',
-        allowBlank : true,
-    },{
-        xtype : "datefield", 
-        name : "pi_date", 
-        fieldLabel : "单据日期", 
-        allowBlank : false, 
-        columnWidth : 0.25,
+        allowBlank: true,
+    }, {
+        xtype: "datefield",
+        name: "pi_date",
+        fieldLabel: "单据日期",
+        allowBlank: false,
+        columnWidth: 0.25,
         defaultValue: new Date()
-    },{
-        xtype : "textfield", 
-        name : "pi_total", 
-        fieldLabel : "总额", 
-        allowBlank : true,
+    }, {
+        xtype: "textfield",
+        name: "pi_total",
+        fieldLabel: "总额",
+        allowBlank: true,
         readOnly: true,
-        columnWidth : 0.25
+        columnWidth: 0.25
     }, {
-        name : "detailGridField", 
-        xtype : "detailGridField",
-        storeModel:'saas.model.stock.OtherIn',
-        deleteDetailUrl:'/api/storage/prodinout/deleteDetail',
-        detnoColumn:  'pd_pdno',
-        columns : [
-            {
-                text : "id", 
-                dataIndex : "id", 
-                xtype : "numbercolumn",
-                hidden:true
-            },{
-                text : "物料id", 
-                dataIndex : "pd_prodid", 
-                xtype : "numbercolumn",
-                hidden:true
-            },
-            {
-                text : "物料编号", 
-                width : 150.0, 
-                dataIndex : "pd_prodcode", 
-                xtype : "", 
-                items : null,
-                allowBlank : false,
-                editor : {
-                    displayField : "display", 
-                    editable : true, 
-                    format : "", 
-                    hideTrigger : false, 
-                    maxLength : 100.0, 
-                    minValue : null, 
-                    positiveNum : false, 
-                    queryMode : "local", 
-                    store : null, 
-                    valueField : "value", 
-                    xtype : "productMultiDbfindTrigger"
-                }
-            },{
-                text: 'model映射需要',
-                dataIndex: 'productDTO',
-                hidden: true,
-            },
-            {
-                text : "品牌", 
-                width : 150.0, 
-                dataIndex : "pr_brand",
-                ignore:true,
-                renderer: function (v, m, r) {
-                    if(!v){
-                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null; 
-                    }                     
-                    return v;
-                }
-            },
-            {
-                text : "名称", 
-                width : 200.0, 
-                dataIndex : "pr_detail",
-                ignore:true,
-                renderer: function (v, m, r) {
-                    if(!v){
-                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null; 
-                    }                     
-                    return v;
-                }
-            },
-            {
-                text : "型号", 
-                width : 200.0, 
-                dataIndex : "pr_orispeccode",
-                ignore:true,
-                renderer: function (v, m, r) {
-                    if(!v){
-                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null; 
-                    }                     
-                    return v;
-                }
-            },{
-                text : "规格", 
-                width : 150, 
-                dataIndex : "pr_spec",
-                ignore:true,
-                renderer: function (v, m, r) {
-                    if(!v){
-                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null; 
-                    }                     
-                    return v;
+        name: "detailGridField",
+        xtype: "detailGridField",
+        storeModel: 'saas.model.stock.OtherIn',
+        deleteDetailUrl: '/api/storage/prodinout/deleteDetail',
+        detnoColumn: 'pd_pdno',
+        columns: [{
+            text: "id",
+            dataIndex: "id",
+            xtype: "numbercolumn",
+            hidden: true
+        }, {
+            text: "物料id",
+            dataIndex: "pd_prodid",
+            xtype: "numbercolumn",
+            hidden: true
+        }, {
+            text: "物料编号",
+            width: 150.0,
+            dataIndex: "pd_prodcode",
+            xtype: "",
+            items: null,
+            allowBlank: false,
+            editor: {
+                displayField: "display",
+                editable: true,
+                format: "",
+                hideTrigger: false,
+                maxLength: 100.0,
+                minValue: null,
+                positiveNum: false,
+                queryMode: "local",
+                store: null,
+                valueField: "value",
+                xtype: "productMultiDbfindTrigger"
+            }
+        }, {
+            text: 'model映射需要',
+            dataIndex: 'productDTO',
+            hidden: true,
+        }, {
+            text: "品牌",
+            width: 150.0,
+            dataIndex: "pr_brand",
+            ignore: true,
+            renderer: function (v, m, r) {
+                if (!v) {
+                    return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
                 }
-            },{
-                text : "数量", 
-                xtype: 'numbercolumn',
-                dataIndex : "pd_inqty", 
-                width : 110.0,
-                allowBlank : false,
-                editor : {
-                    xtype : "numberfield",
-                    decimalPrecision: 3,
-                    minValue:0
-                },
-                renderer : function(v) {
-                    var arr = (v + '.').split('.');
-                    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);
-                },
-                summaryType: 'sum',
-                summaryRenderer: function(v) {
-                    var arr = (v + '.').split('.');
-                    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);
+                return v;
+            }
+        }, {
+            text: "名称",
+            width: 200.0,
+            dataIndex: "pr_detail",
+            ignore: true,
+            renderer: function (v, m, r) {
+                if (!v) {
+                    return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
                 }
-            },{
-                text : "单位", 
-                width : 80.0, 
-                dataIndex : "pr_unit",
-                ignore:true,
-                renderer: function (v, m, r) {
-                    if(!v){
-                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null; 
-                    }                     
-                    return v;
+                return v;
+            }
+        }, {
+            text: "型号",
+            width: 200.0,
+            dataIndex: "pr_orispeccode",
+            ignore: true,
+            renderer: function (v, m, r) {
+                if (!v) {
+                    return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
                 }
-            },{
-                text : "单价(元)", 
-                xtype: 'numbercolumn',
-                dataIndex : "pd_orderprice",
-                width : 110.0,
-                editor : {
-                    xtype : "numberfield",
-                    decimalPrecision: 4,
-                    minValue:0
-                },
-                renderer : function(v) {
-                    var arr = (v + '.').split('.');
-                    var xr = (new Array(arr[1].length > 4 ? 4 : arr[1].length)).fill('0');
-                    var format = '0.' + xr.join('');
-                    return Ext.util.Format.number(v, format);
+                return v;
+            }
+        }, {
+            text: "规格",
+            width: 150,
+            dataIndex: "pr_spec",
+            ignore: true,
+            renderer: function (v, m, r) {
+                if (!v) {
+                    return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
                 }
-            },{
-                text : "仓库id", 
-                dataIndex : "pd_whid", 
-                xtype : "numbercolumn",
-                hidden:true
+                return v;
+            }
+        }, {
+            text: "数量",
+            xtype: 'numbercolumn',
+            dataIndex: "pd_inqty",
+            width: 110.0,
+            allowBlank: false,
+            editor: {
+                xtype: "numberfield",
+                decimalPrecision: 3,
+                minValue: 0
             },
-            {
-                text : "仓库编号", 
-                dataIndex : "pd_whcode",
-                hidden:true
+            renderer: function (v) {
+                return saas.util.BaseUtil.numberFormat(v, 3, true);
             },
-            {
-                text : "仓库", 
-                dataIndex : "pd_whname", 
-                width : 150.0, 
-                allowBlank : false,
-                editor : {
-                    displayField : "display", 
-                    editable : true, 
-                    format : "", 
-                    hideTrigger : false, 
-                    maxLength : 100.0, 
-                    minValue : null, 
-                    positiveNum : false, 
-                    queryMode : "local", 
-                    store : null, 
-                    valueField : "value", 
-                    xtype : "warehouseDbfindTrigger"
-                }
-            }, {
-                text : "税率", 
-                xtype: 'numbercolumn',
-                dataIndex : "pd_taxrate", 
-                width : 80.0,
-                editor : {
-                    xtype : "numberfield",
-                    decimalPrecision: 0,
-                    minValue: 0,
-                    maxValue: 100
-                },
-                renderer : function(v) {
-                    return Ext.util.Format.number(v, '0');
-                }
-            }, 
-           {
-                text : "含税金额", 
-                xtype: 'numbercolumn',
-                dataIndex : "pd_ordertotal", 
-                width : 150.0,
-                // editor : {
-                //     xtype : "numberfield",
-                //     decimalPrecision: 2,
-                //     editable:false
-                // },
-                renderer : function(v) {
-                    var arr = (v + '.').split('.');
-                    var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
-                    var format = '0,000.' + xr.join('');
-                    return Ext.util.Format.number(v, format);
-                },
-                summaryType: 'sum',
-                summaryRenderer: function(v) {
-                    var arr = (v + '.').split('.');
-                    var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
-                    var format = '0,000.' + xr.join('');
-                    return Ext.util.Format.number(v, format);
+            summaryType: 'sum',
+            summaryRenderer: function (v) {
+                return saas.util.BaseUtil.numberFormat(v, 3, true);
+            }
+        }, {
+            text: "单位",
+            width: 80.0,
+            dataIndex: "pr_unit",
+            ignore: true,
+            renderer: function (v, m, r) {
+                if (!v) {
+                    return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
                 }
+                return v;
+            }
+        }, {
+            text: "单价(元)",
+            xtype: 'numbercolumn',
+            dataIndex: "pd_netprice",
+            width: 120,
+            editor: {
+                xtype: "numberfield",
+                decimalPrecision: 4,
+                minValue: 0
             },
-            {
-                text : "未税金额", 
-                xtype: 'numbercolumn',
-                dataIndex : "pd_nettotal", 
-                width : 150.0, 
-                // editor : {
-                //     xtype : "numberfield",
-                //     decimalPrecision: 2,
-                //     editable:false
-                // },
-                renderer : function(v) {
-                    var arr = (v + '.').split('.');
-                    var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
-                    var format = '0,000.' + xr.join('');
-                    return Ext.util.Format.number(v, format);
-                },
-                summaryType: 'sum',
-                summaryRenderer: function(v) {
-                    var arr = (v + '.').split('.');
-                    var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
-                    var format = '0,000.' + xr.join('');
-                    return Ext.util.Format.number(v, format);
+            renderer: function (v) {
+                return saas.util.BaseUtil.numberFormat(v, 4, true);
+            }
+        }, {
+            text: "含税单价(元)",
+            xtype: 'numbercolumn',
+            dataIndex: "pd_orderprice",
+            width: 120,
+            editor: {
+                xtype: "numberfield",
+                decimalPrecision: 4,
+                minValue: 0
+            },
+            renderer: function (v) {
+                return saas.util.BaseUtil.numberFormat(v, 4, true);
+            },
+            listeners: {
+                edit: function (value, grid) {
+                    var r = grid.getSelection()[0],
+                        pd_taxrate = r.get('pd_taxrate');
+                    var v = value / (1 + pd_taxrate / 100);
+                    r.set('pd_netprice', Number(saas.util.BaseUtil.numberFormat(v, 4, false)));
                 }
-            },{
-                text : "备注", 
-                dataIndex : "pd_remark",
-                width : 250, 
-                items : null,
-                editor : {
-                    xtype : "textfield"
-                },
             }
-        ]
-    },{
-        xtype : "textfield", 
-        name : "pi_remark", 
-        fieldLabel : "备注", 
-        columnWidth : 1
-    },{
-        xtype : "hidden", 
-        name : "creatorId", 
-        fieldLabel : "录入人ID", 
-        readOnly:true
-    },
-    {
-        xtype : "textfield", 
-        name : "creatorName", 
-        fieldLabel : "录入人", 
-        readOnly:true
+        }, {
+            text: "金额(元)",
+            xtype: 'numbercolumn',
+            dataIndex: "pd_nettotal",
+            width: 120,
+            renderer: function (v) {
+                return saas.util.BaseUtil.numberFormat(v, 2, true);
+            },
+            summaryType: 'sum',
+            summaryRenderer: function (v) {
+                return saas.util.BaseUtil.numberFormat(v, 2, true);
+            }
+        }, {
+            text: "税率",
+            xtype: 'numbercolumn',
+            dataIndex: "pd_taxrate",
+            width: 80,
+            editor: {
+                xtype: "numberfield",
+                decimalPrecision: 0,
+                minValue: 0,
+                maxValue: 100
+            },
+            renderer: function (v) {
+                return Ext.util.Format.number(v, '0');
+            }
+        }, {
+            text: "税额",
+            xtype: 'numbercolumn',
+            dataIndex: "pd_taxamount",
+            width: 120,
+            renderer: function (v) {
+                return saas.util.BaseUtil.numberFormat(v, 2, true);
+            },
+            summaryType: 'sum',
+            summaryRenderer: function (v) {
+                return saas.util.BaseUtil.numberFormat(v, 2, true);
+            }
+        }, {
+            text: "价税合计",
+            xtype: 'numbercolumn',
+            dataIndex: "pd_ordertotal",
+            width: 120,
+            renderer: function (v) {
+                return saas.util.BaseUtil.numberFormat(v, 2, true);
+            },
+            summaryType: 'sum',
+            summaryRenderer: function (v) {
+                return saas.util.BaseUtil.numberFormat(v, 2, true);
+            }
+        }, {
+            text: "仓库id",
+            dataIndex: "pd_whid",
+            xtype: "numbercolumn",
+            hidden: true
+        }, {
+            text: "仓库编号",
+            dataIndex: "pd_whcode",
+            hidden: true
+        }, {
+            text: "仓库",
+            dataIndex: "pd_whname",
+            width: 150.0,
+            allowBlank: false,
+            editor: {
+                displayField: "display",
+                editable: true,
+                format: "",
+                hideTrigger: false,
+                maxLength: 100.0,
+                minValue: null,
+                positiveNum: false,
+                queryMode: "local",
+                store: null,
+                valueField: "value",
+                xtype: "warehouseDbfindTrigger"
+            }
+        }, {
+            text: "备注",
+            dataIndex: "pd_remark",
+            width: 250,
+            items: null,
+            editor: {
+                xtype: "textfield"
+            },
+        }]
+    }, {
+        xtype: "textfield",
+        name: "pi_remark",
+        fieldLabel: "备注",
+        columnWidth: 1
     }, {
-        xtype : "datefield", 
-        name : "createTime", 
-        fieldLabel : "录入日期",
-        readOnly:true, 
+        xtype: "hidden",
+        name: "creatorId",
+        fieldLabel: "录入人ID",
+        readOnly: true
+    }, {
+        xtype: "textfield",
+        name: "creatorName",
+        fieldLabel: "录入人",
+        readOnly: true
+    }, {
+        xtype: "datefield",
+        name: "createTime",
+        fieldLabel: "录入日期",
+        readOnly: true,
         defaultValue: new Date()
-    },{
-        xtype : "hidden", 
-        name : "updaterId", 
-        fieldLabel : "更新人ID", 
-        readOnly:true
-    },{
-        xtype : "hidden", 
-        name : "updaterName", 
-        fieldLabel : "更新人", 
-        readOnly:true
     }, {
-        xtype : "hidden", 
-        name : "updateTime", 
-        fieldLabel : "更新日期",
-        readOnly:true, 
+        xtype: "hidden",
+        name: "updaterId",
+        fieldLabel: "更新人ID",
+        readOnly: true
+    }, {
+        xtype: "hidden",
+        name: "updaterName",
+        fieldLabel: "更新人",
+        readOnly: true
+    }, {
+        xtype: "hidden",
+        name: "updateTime",
+        fieldLabel: "更新日期",
+        readOnly: true,
         defaultValue: new Date()
     }, {
-        xtype : "textfield", 
-        name : "pi_auditman", 
-        fieldLabel : "审核人", 
-        readOnly:true
+        xtype: "textfield",
+        name: "pi_auditman",
+        fieldLabel: "审核人",
+        readOnly: true
     }, {
-        xtype : "datefield", 
-        name : "pi_auditdate", 
-        fieldLabel : "审核日期",
-        readOnly:true
+        xtype: "datefield",
+        name: "pi_auditdate",
+        fieldLabel: "审核日期",
+        readOnly: true
     }]
 });

+ 258 - 257
frontend/saas-web/app/view/stock/otherOut/FormPanel.js

@@ -15,7 +15,7 @@ Ext.define('saas.view.stock.otherOut.FormPanel', {
     _statusField: 'pi_status',
     _statusCodeField: 'pi_statuscode',
     _auditmanField: 'pi_auditman',
-    _auditdateField:'pi_auditdate',
+    _auditdateField: 'pi_auditdate',
     _relationColumn: 'pd_piid',
     _readUrl: '/api/storage/prodinout/read',
     _saveUrl: '/api/storage/prodinout/save',
@@ -52,7 +52,7 @@ Ext.define('saas.view.stock.otherOut.FormPanel', {
     }, {
         xtype: 'customerDbfindTrigger',
         name: 'pi_custname',
-        allowBlank : true,
+        allowBlank: true,
         fieldLabel: '客户名称'
     }, {
         xtype: "datefield",
@@ -71,281 +71,282 @@ Ext.define('saas.view.stock.otherOut.FormPanel', {
     }, {
         name: "detailGridField",
         xtype: "detailGridField",
-        storeModel:'saas.model.stock.OtherOut',
+        storeModel: 'saas.model.stock.OtherOut',
         deleteDetailUrl: '/api/storage/prodinout/deleteDetail',
         detnoColumn: 'pd_pdno',
         columns: [{
-                text: "id",
-                dataIndex: "id",
-                xtype: "numbercolumn",
-                hidden: true
-            }, {
-                text: "物料id",
-                dataIndex: "pd_prodid",
-                xtype: "numbercolumn",
-                hidden: true
-            },
-            {
-                text: "物料编号",
-                width: 150.0,
-                dataIndex: "pd_prodcode",
-                xtype: "",
-                items: null,
-                allowBlank : false,
-                editor: {
-                    displayField: "display",
-                    editable: true,
-                    format: "",
-                    hideTrigger: false,
-                    maxLength: 100.0,
-                    minValue: null,
-                    positiveNum: false,
-                    queryMode: "local",
-                    store: null,
-                    valueField: "value",
-                    xtype: "productMultiDbfindTrigger"
-                }
-            },{
-                text: 'model映射需要',
-                dataIndex: 'productDTO',
-                hidden: true,
-            },
-            {
-                text : "品牌", 
-                width : 150.0, 
-                dataIndex : "pr_brand",
-                ignore:true,
-                renderer: function (v, m, r) {
-                    if(!v){
-                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null; 
-                    }                     
-                    return v;
-                }
-            },
-            {
-                text : "名称", 
-                width : 200.0, 
-                dataIndex : "pr_detail",
-                ignore:true,
-                renderer: function (v, m, r) {
-                    if(!v){
-                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null; 
-                    }                     
-                    return v;
-                }
-            },
-            {
-                text : "型号", 
-                width : 200.0, 
-                dataIndex : "pr_orispeccode",
-                ignore:true,
-                renderer: function (v, m, r) {
-                    if(!v){
-                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null; 
-                    }                     
-                    return v;
-                }
-            },{
-                text : "规格", 
-                width : 150, 
-                dataIndex : "pr_spec",
-                ignore:true,
-                renderer: function (v, m, r) {
-                    if(!v){
-                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null; 
-                    }                     
-                    return v;
+            text: "id",
+            dataIndex: "id",
+            xtype: "numbercolumn",
+            hidden: true
+        }, {
+            text: "物料id",
+            dataIndex: "pd_prodid",
+            xtype: "numbercolumn",
+            hidden: true
+        }, {
+            text: "物料编号",
+            width: 150.0,
+            dataIndex: "pd_prodcode",
+            xtype: "",
+            items: null,
+            allowBlank: false,
+            editor: {
+                displayField: "display",
+                editable: true,
+                format: "",
+                hideTrigger: false,
+                maxLength: 100.0,
+                minValue: null,
+                positiveNum: false,
+                queryMode: "local",
+                store: null,
+                valueField: "value",
+                xtype: "productMultiDbfindTrigger"
+            }
+        }, {
+            text: 'model映射需要',
+            dataIndex: 'productDTO',
+            hidden: true,
+        }, {
+            text: "品牌",
+            width: 150.0,
+            dataIndex: "pr_brand",
+            ignore: true,
+            renderer: function (v, m, r) {
+                if (!v) {
+                    return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
                 }
-            },{
-                text: "数量",
-                xtype: 'numbercolumn',
-                dataIndex: "pd_outqty",
-                allowBlank : false,
-                width: 110.0,
-                editor : {
-                    xtype : "numberfield",
-                    decimalPrecision: 3,
-                    minValue:0
-                },
-                renderer : function(v) {
-                    var arr = (v + '.').split('.');
-                    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);
-                },
-                summaryType: 'sum',
-                summaryRenderer: function(v) {
-                    var arr = (v + '.').split('.');
-                    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);
+                return v;
+            }
+        }, {
+            text: "名称",
+            width: 200.0,
+            dataIndex: "pr_detail",
+            ignore: true,
+            renderer: function (v, m, r) {
+                if (!v) {
+                    return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
                 }
-            },{
-                text : "单位", 
-                width : 80.0, 
-                dataIndex : "pr_unit",
-                ignore:true,
-                renderer: function (v, m, r) {
-                    if(!v){
-                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null; 
-                    }                     
-                    return v;
+                return v;
+            }
+        }, {
+            text: "型号",
+            width: 200.0,
+            dataIndex: "pr_orispeccode",
+            ignore: true,
+            renderer: function (v, m, r) {
+                if (!v) {
+                    return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
                 }
-            },{
-                text: "单价(元)",
-                xtype: 'numbercolumn',
-                dataIndex: "pd_orderprice", 
-                width : 110.0,
-                editor : {
-                    xtype : "numberfield",
-                    decimalPrecision: 4,
-                    minValue:0
-                },
-                renderer : function(v) {
-                    var arr = (v + '.').split('.');
-                    var xr = (new Array(arr[1].length > 4 ? 4 : arr[1].length)).fill('0');
-                    var format = '0.' + xr.join('');
-                    return Ext.util.Format.number(v, format);
+                return v;
+            }
+        }, {
+            text: "规格",
+            width: 150,
+            dataIndex: "pr_spec",
+            ignore: true,
+            renderer: function (v, m, r) {
+                if (!v) {
+                    return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
                 }
-            },{
-                text: "仓库id",
-                dataIndex: "pd_whid",
-                xtype: "numbercolumn",
-                hidden: true
+                return v;
+            }
+        }, {
+            text: "数量",
+            xtype: 'numbercolumn',
+            dataIndex: "pd_outqty",
+            allowBlank: false,
+            width: 110.0,
+            editor: {
+                xtype: "numberfield",
+                decimalPrecision: 3,
+                minValue: 0
             },
-            {
-                text: "仓库编号",
-                dataIndex: "pd_whcode",
-                hidden: true
+            renderer: function (v) {
+                return saas.util.BaseUtil.numberFormat(v, 3, true);
             },
-            {
-                text: "仓库",
-                dataIndex: "pd_whname",
-                width: 150.0,
-                allowBlank : false,
-                editor: {
-                    displayField: "display",
-                    editable: true,
-                    format: "",
-                    hideTrigger: false,
-                    maxLength: 100.0,
-                    minValue: null,
-                    positiveNum: false,
-                    queryMode: "local",
-                    store: null,
-                    valueField: "value",
-                    xtype: "warehouseDbfindTrigger"
+            summaryType: 'sum',
+            summaryRenderer: function (v) {
+                return saas.util.BaseUtil.numberFormat(v, 3, true);
+            }
+        }, {
+            text: "单位",
+            width: 80.0,
+            dataIndex: "pr_unit",
+            ignore: true,
+            renderer: function (v, m, r) {
+                if (!v) {
+                    return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
                 }
+                return v;
+            }
+        }, {
+            text: "单价(元)",
+            xtype: 'numbercolumn',
+            dataIndex: "pd_netprice",
+            width: 120,
+            editor: {
+                xtype: "numberfield",
+                decimalPrecision: 4,
+                minValue: 0
             },
-            {
-                text: "税率",
-                xtype: 'numbercolumn',
-                dataIndex: "pd_taxrate", 
-                width : 80.0,
-                editor : {
-                    xtype : "numberfield",
-                    decimalPrecision: 0,
-                    minValue: 0,
-                    maxValue: 100
-                },
-                renderer : function(v) {
-                    return Ext.util.Format.number(v, '0');
-                }
+            renderer: function (v) {
+                return saas.util.BaseUtil.numberFormat(v, 4, true);
+            }
+        }, {
+            text: "含税单价(元)",
+            xtype: 'numbercolumn',
+            dataIndex: "pd_orderprice",
+            width: 120,
+            editor: {
+                xtype: "numberfield",
+                decimalPrecision: 4,
+                minValue: 0
             },
-            {
-                text: "含税金额",
-                xtype: 'numbercolumn',
-                dataIndex: "pd_ordertotal",
-                width: 150.0,
-                renderer : function(v) {
-                    var arr = (v + '.').split('.');
-                    var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
-                    var format = '0,000.' + xr.join('');
-                    return Ext.util.Format.number(v, format);
-                },
-                summaryType: 'sum',
-                summaryRenderer: function(v) {
-                    var arr = (v + '.').split('.');
-                    var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
-                    var format = '0,000.' + xr.join('');
-                    return Ext.util.Format.number(v, format);
-                }
+            renderer: function (v) {
+                return saas.util.BaseUtil.numberFormat(v, 4, true);
             },
-            {
-                text: "未税金额",
-                xtype: 'numbercolumn',
-                dataIndex: "pd_nettotal", 
-                width : 150.0,
-                renderer : function(v) {
-                    var arr = (v + '.').split('.');
-                    var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
-                    var format = '0,000.' + xr.join('');
-                    return Ext.util.Format.number(v, format);
-                },
-                summaryType: 'sum',
-                summaryRenderer: function(v) {
-                    var arr = (v + '.').split('.');
-                    var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
-                    var format = '0,000.' + xr.join('');
-                    return Ext.util.Format.number(v, format);
+            listeners: {
+                edit: function (value, grid) {
+                    var r = grid.getSelection()[0],
+                        pd_taxrate = r.get('pd_taxrate');
+                    var v = value / (1 + pd_taxrate / 100);
+                    r.set('pd_netprice', Number(saas.util.BaseUtil.numberFormat(v, 4, false)));
                 }
-            },{
-                text : "备注", 
-                dataIndex : "pd_remark",
-                width : 250, 
-                items : null,
-                editor : {
-                    xtype : "textfield"
-                },
             }
-        ]
-    },{
-        xtype : "textfield", 
-        name : "pi_remark", 
-        fieldLabel : "备注", 
-        columnWidth : 1
-    },{
-        xtype : "hidden", 
-        name : "creatorId", 
-        fieldLabel : "录入人ID", 
-        readOnly:true
-    },
-    {
-        xtype : "textfield", 
-        name : "creatorName", 
-        fieldLabel : "录入人", 
-        readOnly:true
+        }, {
+            text: "金额(元)",
+            xtype: 'numbercolumn',
+            dataIndex: "pd_nettotal",
+            width: 120,
+            renderer: function (v) {
+                return saas.util.BaseUtil.numberFormat(v, 2, true);
+            },
+            summaryType: 'sum',
+            summaryRenderer: function (v) {
+                return saas.util.BaseUtil.numberFormat(v, 2, true);
+            }
+        }, {
+            text: "税率",
+            xtype: 'numbercolumn',
+            dataIndex: "pd_taxrate",
+            width: 80,
+            editor: {
+                xtype: "numberfield",
+                decimalPrecision: 0,
+                minValue: 0,
+                maxValue: 100
+            },
+            renderer: function (v) {
+                return Ext.util.Format.number(v, '0');
+            }
+        }, {
+            text: "税额",
+            xtype: 'numbercolumn',
+            dataIndex: "pd_taxamount",
+            width: 120,
+            renderer: function (v) {
+                return saas.util.BaseUtil.numberFormat(v, 2, true);
+            },
+            summaryType: 'sum',
+            summaryRenderer: function (v) {
+                return saas.util.BaseUtil.numberFormat(v, 2, true);
+            }
+        }, {
+            text: "价税合计",
+            xtype: 'numbercolumn',
+            dataIndex: "pd_ordertotal",
+            width: 120,
+            renderer: function (v) {
+                return saas.util.BaseUtil.numberFormat(v, 2, true);
+            },
+            summaryType: 'sum',
+            summaryRenderer: function (v) {
+                return saas.util.BaseUtil.numberFormat(v, 2, true);
+            }
+        }, {
+            text: "仓库id",
+            dataIndex: "pd_whid",
+            xtype: "numbercolumn",
+            hidden: true
+        }, {
+            text: "仓库编号",
+            dataIndex: "pd_whcode",
+            hidden: true
+        }, {
+            text: "仓库",
+            dataIndex: "pd_whname",
+            width: 150.0,
+            allowBlank: false,
+            editor: {
+                displayField: "display",
+                editable: true,
+                format: "",
+                hideTrigger: false,
+                maxLength: 100.0,
+                minValue: null,
+                positiveNum: false,
+                queryMode: "local",
+                store: null,
+                valueField: "value",
+                xtype: "warehouseDbfindTrigger"
+            }
+        }, {
+            text: "备注",
+            dataIndex: "pd_remark",
+            width: 250,
+            items: null,
+            editor: {
+                xtype: "textfield"
+            },
+        }]
+    }, {
+        xtype: "textfield",
+        name: "pi_remark",
+        fieldLabel: "备注",
+        columnWidth: 1
+    }, {
+        xtype: "hidden",
+        name: "creatorId",
+        fieldLabel: "录入人ID",
+        readOnly: true
+    }, {
+        xtype: "textfield",
+        name: "creatorName",
+        fieldLabel: "录入人",
+        readOnly: true
     }, {
-        xtype : "datefield", 
-        name : "createTime", 
-        fieldLabel : "录入日期",
-        readOnly:true, 
+        xtype: "datefield",
+        name: "createTime",
+        fieldLabel: "录入日期",
+        readOnly: true,
         defaultValue: new Date()
-    },{
-        xtype : "hidden", 
-        name : "updaterId", 
-        fieldLabel : "更新人ID", 
-        readOnly:true
-    },{
-        xtype : "hidden", 
-        name : "updaterName", 
-        fieldLabel : "更新人", 
-        readOnly:true
     }, {
-        xtype : "hidden", 
-        name : "updateTime", 
-        fieldLabel : "更新日期",
-        readOnly:true, 
+        xtype: "hidden",
+        name: "updaterId",
+        fieldLabel: "更新人ID",
+        readOnly: true
+    }, {
+        xtype: "hidden",
+        name: "updaterName",
+        fieldLabel: "更新人",
+        readOnly: true
+    }, {
+        xtype: "hidden",
+        name: "updateTime",
+        fieldLabel: "更新日期",
+        readOnly: true,
         defaultValue: new Date()
     }, {
-        xtype : "textfield", 
-        name : "pi_auditman", 
-        fieldLabel : "审核人", 
-        readOnly:true
+        xtype: "textfield",
+        name: "pi_auditman",
+        fieldLabel: "审核人",
+        readOnly: true
     }, {
-        xtype : "datefield", 
-        name : "pi_auditdate", 
-        fieldLabel : "审核日期",
-        readOnly:true
+        xtype: "datefield",
+        name: "pi_auditdate",
+        fieldLabel: "审核日期",
+        readOnly: true
     }]
 });