Browse Source

对账单修改

hy 7 years ago
parent
commit
7b0ac72327

+ 19 - 10
frontend/saas-web/app/Application.scss

@@ -233,6 +233,15 @@ body.launching {
   }
 }
 
+.x-formpanel-btn-red {
+  background: #ff0000;
+  border-color: #ff0000;
+
+  .x-btn-inner-default-toolbar-small {
+    color: #fff !important;
+  }
+}
+
 .x-formpanel-btn-white {
   border: 1px solid #c1c1c1 !important;
 
@@ -626,16 +635,16 @@ input::-webkit-input-placeholder {
   }
 }
 
-.x-quotation-main{
-  .x-grid-row{
-    border-color:#fff !important;
-    background-color: #fff !important;
-  }
-  .x-grid-item-selected{
-    border-color:#fff !important;
-    background-color: #fff !important;
-  }
-}
+// .x-quotation-main{
+//   .x-grid-row{
+//     border-color:#fff !important;
+//     //background-color: #fff !important;
+//   }
+//   .x-grid-item-selected{
+//     border-color:#fff !important;
+//     background-color: #fff !important;
+//   }
+// }
 
 .x-btn-quotation{
   .x-btn-over {

+ 16 - 0
frontend/saas-web/app/model/purchase/ApCheckDetail.js

@@ -0,0 +1,16 @@
+Ext.define('saas.model.purchase.ApCheckDetail', {
+    extend: 'saas.model.Base',
+
+    fields: [
+
+        { name: 'id', type: 'int' }, // id
+        { name: 'pd_prodid', type: 'int' }, // 物料id
+        { name: 'ad_inoutno', type: 'string' }, // 物料编号
+        { name: 'ad_pdno', type: 'string' }, // 品牌
+        { name: 'ad_prodcode', type: 'string' }, // 名称
+        { name: 'ad_pucode', type: 'string' }, // 型号
+        { name: 'ad_taxrate', type: 'float' }, // 税率
+        { name: 'ad_price', type: 'float' }, // 单价
+        { name: 'ad_b2bqty', type: 'float' } // 数量
+    ]
+});

+ 2 - 0
frontend/saas-web/app/view/purchase/quotationList/DataList.js

@@ -85,6 +85,8 @@ Ext.define('saas.view.purchase.quotationList.DataList', {
                             listeners: {								          
                                 beforeshow: function updateTipBody(tip) {
                                     var dg = Ext.getCmp('grid-'+id);
+                                    var rowindex = tip.triggerElement.parentNode.rowIndex;
+							        var rec = Ext.getCmp(grid.id).getStore().getAt(rowindex-1);
                                     dg.store.loadData(val);
                                     dg.show();
                                 }

+ 376 - 0
frontend/saas-web/app/view/purchase/reconciliation/DataList.js

@@ -0,0 +1,376 @@
+Ext.define('saas.view.purchase.reconciliation.DataList', {
+    extend: 'Ext.grid.Panel',
+    xtype: 'purchase-reconciliation-datalist',
+    controller: 'purchase-reconciliation-datalist',
+    viewModel: 'purchase-reconciliation-datalist',
+    autoScroll: true,
+    frame:true,
+    layout:'fit',
+    dataUrl:'http://10.1.80.35:8560/api/money/apcheck/list',   
+    
+    plugins: [{
+        ptype: 'cellediting',
+        clicksToEdit: 1
+    }, {
+        ptype: 'menuclipboard'
+    }],
+
+    tbar: [{
+        width: 280,
+        name: 'ac_vendname',
+        xtype: 'textfield',
+        emptyText : '请输入供应商名称',
+        enableKeyEvents: true,
+        listeners: {
+            keydown: {
+                fn: function(th, e, eOpts) {
+                    if(e.keyCode == 13) {
+                        var grid = th.up('grid');
+                        grid.condition = grid.getConditions();
+                        grid.store.loadPage(1);
+                    }
+                }
+            }
+        }
+    },{
+        columnWidth:0.5,
+        xtype: 'condatefield',
+        name: 'ac_date',
+        fieldLabel: '日期',
+        operation: 'between'
+    },'->',{
+        xtype:'button',
+        text:'查询',
+        listeners: {
+            click:function(b){
+                var grid = b.ownerCt.ownerCt;
+                grid.condition = grid.getConditions();
+                grid.store.loadPage(1);
+            }
+        }
+    }],
+
+    columns : [{
+        text : '对账单编号', 
+        width:150,
+        dataIndex : 'ac_code',
+        cls:'x-querygrid-code-column',
+        renderer:function(v,style,a,b,c){
+            return '<span class="x-query-link" style="cursor: pointer;color: #3e80f6;border-bottom: 1px solid #3e80f6;">'+v+'</span>';
+        }
+    },{
+        text : 'id', 
+        hidden:true,
+        dataIndex : 'id', 
+        xtype : 'numbercolumn',   
+    },{
+        text : 'ac_b2bid', 
+        hidden:true,
+        dataIndex : 'ac_b2bid', 
+        xtype : 'numbercolumn',   
+    },{
+        text : 'accountId', 
+        hidden:true,
+        dataIndex : 'accountId', 
+        xtype : 'numbercolumn',     
+    },{
+        text : 'ac_sendstatus', 
+        hidden:true,
+        dataIndex : 'ac_sendstatus'
+    },{
+        text : '供应商编号', 
+        dataIndex : 'ac_vendcode', 
+        hidden:true
+    },{
+        text : '供应商名称', 
+        dataIndex : 'ac_vendname', 
+        width:110
+    },{
+        text : '币别', 
+        width : 90.0, 
+        dataIndex : 'ac_currency', 
+    },{
+        text : '本期应付', 
+        dataIndex : 'ac_thisamount',
+        xtype:'numbercolumn', 
+        width : 110.0,
+    },{
+        text : '本期发货', 
+        dataIndex : 'ac_thissend',
+        xtype:'numbercolumn',
+        width : 110.0,
+    },{
+        text : '本期未对账', 
+        dataIndex : 'ac_thisuncheck', 
+        xtype:'numbercolumn',
+        width : 110.0,
+    },{
+        text : '本期已对账', 
+        dataIndex : 'ac_thischeck', 
+        xtype:'numbercolumn',
+        width : 110.0,
+    },{
+        text : '本期已付', 
+        dataIndex : 'ac_thispay', 
+        xtype:'numbercolumn',
+        width : 110.0,
+    },{
+        text : '应付金额', 
+        dataIndex : 'ac_payamont', 
+        xtype:'numbercolumn',
+        width : 110.0,
+    }],
+
+    dbSearchFields: [],
+    condition:'',
+
+    initComponent: function() {
+        var me = this;
+        if(me.columns){
+            var fields = me.columns.map(column => column.dataIndex);
+            me.store = Ext.create('Ext.data.Store',{
+                fields:fields,
+                autoLoad: true,
+                pageSize: 11,
+                data: [],
+                proxy: {
+                    timeout:8000,
+                    type: 'ajax',
+                    url: me.dataUrl,
+                    actionMethods: {
+                        read: 'GET'
+                    },
+                    reader: {
+                        type: 'json',
+                        rootProperty: 'data.list',
+                        totalProperty: 'data.total',
+                    },
+                    listeners: {
+                        exception: function(proxy, response, operation, eOpts) {
+                            if(operation.success) {
+                                if(response.timedout) {
+                                    saas.util.BaseUtil.showErrorToast('请求超时');
+                                }
+                            }else {
+                                if(response.timedout) {
+                                    saas.util.BaseUtil.showErrorToast('请求超时');
+                                }else{
+                                    if(proxy.showPowerMessage){
+                                        saas.util.BaseUtil.showErrorToast('查询失败:' + (response.responseJson?response.responseJson.message:'请求超时'));
+                                    }
+                                }
+                            }
+                        }
+                    }
+                },
+                listeners: {
+                    beforeload: function (store, op) {
+                        var condition = me.condition;
+                        if (Ext.isEmpty(condition)) {
+                            condition = [];
+                        }
+                        Ext.apply(store.proxy.extraParams, {
+                            number: op._page,
+                            size: store.pageSize,
+                            condition: JSON.stringify(condition)
+                        });
+                    }
+                }
+            });
+
+            Ext.apply(me, {
+                dockedItems:[{
+                    xtype: 'pagingtoolbar',
+                    dock: 'bottom',
+                    displayInfo: true,
+                    store: me.store
+                }]
+            });
+        }
+        me.callParent(arguments);
+    },
+
+    listeners:{
+        boxready: function(grid, width, height, eOpts) {
+            var store = grid.getStore(),
+            gridBodyBox = grid.body.dom.getBoundingClientRect(),
+            gridBodyBoxHeight = gridBodyBox.height;
+            var pageSize = Math.floor(gridBodyBoxHeight / 32);
+            store.setPageSize(pageSize);
+            grid.ownerCt.el.dom.style.left = '8px';
+            grid.el.dom.style.padding = '0px'
+        },
+        itemClick: function(tableView, record, item, index, e, eOpts) {
+            if(e.target.classList.contains('x-query-link')) {
+                idValue = record.get('id'),
+                codeValue = record.get('ac_code'),
+                id = 'purchase-reconciliation-formpanel-' + idValue;
+                saas.util.BaseUtil.openTab('purchase-reconciliation-formpanel', "平台对账单("+codeValue+")", id, {
+                    initId: idValue
+                });
+            }
+        },
+    },
+
+    getGridSelected:function(type){
+        var isErrorSelect = false;
+        var checkField = this.statusCodeField;
+        var me = this,
+        items = me.selModel.getSelection(),
+        data = new Array() ;
+        Ext.each(items, function(item, index){
+            if(!Ext.isEmpty(item.data[me.idField])){
+                var o = new Object();
+                if(me.idField){
+                    o['id'] = item.data[me.idField];
+                }
+                if(me.codeField){
+                    o['code'] = item.data[me.codeField];
+                }
+                if(type&&type==item.data[checkField]){
+                    isErrorSelect = true
+                }
+                data.push(o);
+            }
+        });
+        if(isErrorSelect){
+            return false;
+        }
+		return data;
+    },
+
+    /**
+     * 获得过滤条件
+     */
+    getConditions: function() {
+        var me = this,
+        tbar = me.getDockedItems()[0],
+        items = Ext.Array.filter(tbar.items.items, function(item) {
+            return !!item.name;
+        }),
+        conditions = [];
+        for(var i = 0; i < items.length; i++) {
+            var item = items[i];
+            var field = item.name,
+            func = item.getCondition,
+            value = item.value,
+            condition;
+
+            if(value&&value!=''){
+                if(typeof func == 'function') {
+                    condition = {
+                        type: 'condition',
+                        value: func(value)
+                    }
+                }else {
+                    var type = item.fieldType || me.getDefaultFieldType(item),
+                    operation = item.operation || me.getDefaultFieldOperation(item),
+                    conditionValue = me.getConditionValue(item, value);
+        
+                    if(!conditionValue) {
+                        continue;
+                    }
+                    condition = {
+                        type: type,
+                        field: field,
+                        operation: operation,
+                        value: conditionValue
+                    }
+                }
+                conditions.push(condition);
+            }
+        }
+
+        return conditions;
+    },
+
+    /**
+     * 只要arr1和arr2中存在相同项即返回真
+     */
+    isContainsAny: function (arr1, arr2) {
+        for (var i = 0; i < arr2.length; i++) {
+            var a2 = arr2[i];
+            if (!!arr1.find(function (a1) {
+                    return a1 == a2
+                })) {
+                return true;
+            }
+        }
+        return false;
+    },
+
+    getDefaultFieldType: function (field) {
+        var me = this,
+            xtypes = field.getXTypes().split('/'),
+            type;
+
+        if (me.isContainsAny(xtypes, ['numberfield'])) {
+            type = 'number';
+        } else if (me.isContainsAny(xtypes, ['datefield', 'condatefield', 'conmonthfield'])) {
+            type = 'date';
+        } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
+            type = 'enum';
+        } else if (me.isContainsAny(xtypes, ['combobox', 'multicombo', 'combo', 'radiofield', 'radio'])) {
+            type = 'enum';
+        } else {
+            type = 'string';
+        }
+
+        return type;
+    },
+
+    getDefaultFieldOperation: function (field) {
+        var me = this,
+            xtypes = field.getXTypes().split('/'),
+            operation;
+
+        if (me.isContainsAny(xtypes, ['numberfield', 'datefield', 'dbfindtrigger'])) {
+            operation = '=';
+        } else if (me.isContainsAny(xtypes, ['condatefield', 'conmonthfield'])) {
+            operation = 'between';
+        } else if (me.isContainsAny(xtypes, ['multidbfindtrigger', 'combobox', 'multicombo', 'combo'])) {
+            operation = 'in';
+        } else {
+            operation = 'like';
+        }
+
+        return operation;
+    },
+
+    /**
+     * 处理部分字段值
+     */
+    getConditionValue: function (field, value) {
+        var me = this,
+            xtypes = field.getXTypes().split('/'),
+            conditionValue;
+        if (me.isContainsAny(xtypes, ['datefield'])) {
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
+        } else if (me.isContainsAny(xtypes, ['conmonthfield'])) {
+            var from = value.from,
+                to = value.to;
+
+            conditionValue = from + ',' + to;
+        } else if (me.isContainsAny(xtypes, ['condatefield'])) {
+            var from = value.from,
+                to = value.to;
+
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d 00:00:00') + ',' + Ext.Date.format(new Date(to), 'Y-m-d 23:59:59');
+        } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
+            conditionValue = value;
+        } else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) {
+            conditionValue = '\'' + value + '\'';
+        } else if (me.isContainsAny(xtypes, ['multicombo'])) {
+            conditionValue = value.map ? value.map(function (v) {
+                return '\'' + v.value + '\'';
+            }).join(',') : '';
+        } else {
+            conditionValue = value;
+        }
+
+        return conditionValue;
+    }
+
+})
+
+

+ 15 - 0
frontend/saas-web/app/view/purchase/reconciliation/DataListController.js

@@ -0,0 +1,15 @@
+Ext.define('saas.view.purchase.reconciliation.DataListController', {
+    extend: 'saas.view.core.base.BasePanelController',
+    alias: 'controller.purchase-reconciliation-datalist',
+
+    init: function (form) {
+        var me = this;
+        this.control({
+        });
+    },
+
+    onRefresh:function(){
+        var me = this;
+        me.view.items.items[0].store.load();
+    },
+});

+ 4 - 0
frontend/saas-web/app/view/purchase/reconciliation/DataListlModel.js

@@ -0,0 +1,4 @@
+Ext.define('saas.view.purchase.reconciliation.DataListModel', {
+    extend: 'saas.view.core.base.BasePanelModel',
+    alias: 'viewmodel.purchase-reconciliation-datalist'
+});

+ 209 - 0
frontend/saas-web/app/view/purchase/reconciliation/FormPanel.js

@@ -0,0 +1,209 @@
+Ext.define('saas.view.purchase.reconciliation.FormPanel', {
+    extend: 'saas.view.core.form.FormPanel',
+    xtype: 'purchase-reconciliation-formpanel',
+
+    controller: 'purchase-reconciliation-formpanel',
+    viewModel: 'purchase-reconciliation-formpanel',
+
+    viewName: 'purchase-reconciliation-formpanel',
+
+    //字段属性
+    _title: '平台对账单',
+    _idField: 'id',
+    _codeField: 'ac_code',
+    _relationColumn: 'pd_puid',
+    _readUrl: 'http://10.1.80.35:8560/api/money/apcheck/read',
+    initId: 0,
+    toolBtns: [{
+        xtype: 'button',
+        text: '确认',
+        bind: {
+           hidden: '{Hidden}'
+        },
+        handler: 'agree'
+    },{
+        cls:'x-formpanel-btn-red',
+        xtype: 'button',
+        text: '不同意',
+        bind: {
+           hidden: '{Hidden}'
+        },
+        handler: 'disagree'
+    }],
+    initComponent: function () {
+        Ext.apply(this, {
+            defaultItems: [{
+                xtype: 'hidden',
+                name: 'id',
+                fieldLabel: 'id'
+            }, {
+                xtype: "textfield",
+                name: "ac_vendname",
+                fieldLabel: "供应商名称",
+                allowBlank: true,
+                readOnly:true
+            },  {
+                xtype: "textfield",
+                name: "ac_date",
+                fieldLabel: "对账日期",
+                allowBlank: true,
+                readOnly:true
+            }, {
+                xtype: "textfield",
+                name: "ac_currency",
+                fieldLabel: "币别",
+                allowBlank: true,
+                readOnly:true
+            } ,{
+                xtype: "numberfield",
+                name: "ac_thisamount",
+                fieldLabel: "本期应付金额",
+                allowBlank: true,
+                readOnly:true
+            }, {
+                xtype: "numberfield",
+                name: "ac_thisuncheck",
+                fieldLabel: "本期未对账",
+                allowBlank: true,
+                readOnly:true
+            },{
+                xtype: "numberfield",
+                name: "ac_thispay",
+                fieldLabel: "本期已付",
+                allowBlank: true,
+                readOnly:true
+            },{
+                xtype: "numberfield",
+                name: "ac_thissend",
+                fieldLabel: "本期发货",
+                allowBlank: true,
+                readOnly:true
+            },{
+                xtype: "numberfield",
+                name: "ac_thischeck",
+                fieldLabel: "本期已对账",
+                allowBlank: true,
+                readOnly:true
+            },{
+                xtype: "numberfield",
+                name: "ac_payamont",
+                fieldLabel: "应付总额",
+                allowBlank: true,
+                readOnly:true
+            },{
+                xtype: "textfield",
+                name: "ac_confirmstatus",
+                fieldLabel: "确认状态",
+                allowBlank: true,
+                readOnly:true
+            },   
+            {
+                name: "detailGridField",
+                xtype: "detailGridField",
+                storeModel: 'saas.model.purchase.ApCheckDetail',
+                detnoColumn: 'ad_detno',
+                editable:false,
+                features : [Ext.create('Ext.grid.feature.Grouping',{
+                    collapsible:false,
+                    showSummaryRow: false,
+                    groupHeaderTpl: '采购单号 : {name} (共:{rows.length}条)'
+                })],
+                allowEmpty: true,
+                columns: [{
+                    text: "id",
+                    dataIndex: "id",
+                    xtype: "numbercolumn",
+                    hidden: true
+                },{
+                    text: "ad_acid",
+                    dataIndex: "ad_acid",
+                    xtype: "numbercolumn",
+                    hidden: true
+                },{  
+                    hidden:true,
+                    text: "采购单号",
+                    width: 150.0,
+                    dataIndex: "ad_pucode",
+                }, { 
+                    text: "出入库单号",
+                    width: 120.0,
+                    dataIndex: "ad_inoutno",
+                },{
+                    text: "物料编号",
+                    width: 120.0,
+                    dataIndex: "ad_prodcode",
+                    ignore: true,
+                }, {
+                    text: "品牌",
+                    dataIndex: "pr_brand",
+                    width: 100.0
+                }, {
+                    text: "物料名称",
+                    dataIndex: "pr_detail",
+                    width: 150.0
+                }, {
+                    text: "型号",
+                    dataIndex: "pr_orispeccode",
+                    width: 200.0
+                }, {
+                    text: "规格",
+                    dataIndex: "pr_spec",
+                    width: 200.0
+                },{
+                    text: "数量",
+                    xtype:'numbercolumn',
+                    width: 150.0,
+                    dataIndex: "ad_b2bqty",
+                    ignore: true
+                },{
+                    text: "含税单价",
+                    width: 100.0,
+                    dataIndex: "ad_price",
+                    xtype:'numbercolumn',
+                    ignore: true
+                },{
+                    text: "税率%",
+                    xtype:'numbercolumn',
+                    width: 100.0,
+                    dataIndex: "ad_taxrate",
+                    ignore: true
+                },{
+                    text: "价税合计",
+                    xtype:'numbercolumn',
+                    width: 100.0,
+                    dataIndex: "ad_price",
+                    renderer:function(v,a,rec,c,d,e,f){
+                        return saas.util.BaseUtil.numberFormat(rec.get('ad_price') * rec.get('ad_b2bqty'), 2, true);
+                    }
+                }],
+                initColumns: function() {
+                    // 构造序号列
+                    var me = this,
+                    columns = me.columns,
+                    detnoField = me.detnoColumn;
+            
+                    indexColumn = {
+                        bind: {
+                            text: "{(configurable && isAdmin) ? ('<div class=\"x-sa sa-setting\" style=\"cursor: pointer;\" title=\"列设置\"></div>') : '序号'}"
+                        },
+                        dataIndex : detnoField, 
+                        width : 60, 
+                        xtype : "numbercolumn",
+                        align : 'center',
+                        format:'0',
+                        allowBlank: true,
+                    };
+                    if (detnoField) {
+                        Ext.apply(me, { columns: [indexColumn].concat(columns) });
+                    }
+                }
+            }]
+        });
+        this.callParent();
+    },
+    listeners: {
+        load:function(form){
+            form.getViewModel().getData().detail0.detailStore.group('ad_pucode', 'ASC');
+        }
+    }
+});

+ 8 - 0
frontend/saas-web/app/view/purchase/reconciliation/FormPanelController.js

@@ -0,0 +1,8 @@
+Ext.define('saas.view.purchase.reconciliation.FormPanelController', {
+    extend: 'saas.view.core.form.FormPanelController',
+    alias: 'controller.purchase-reconciliation-formpanel',
+    init: function (form) {
+        var me = this;
+        this.control({});
+    }
+});

+ 34 - 0
frontend/saas-web/app/view/purchase/reconciliation/FormPanelModel.js

@@ -0,0 +1,34 @@
+Ext.define('saas.view.purchase.reconciliation.FormPanelModel', {
+    extend: 'saas.view.core.form.FormPanelModel',
+    alias: 'viewmodel.purchase-reconciliation-formpanel',
+
+    data: {
+        id: 0,
+        base: {
+            bindFields: [], // 绑定字段
+            valid: true, // 单据是否合法
+            editable: false, // 单据是否可编辑
+            codeEditable: false, // 单据编号是否可编辑
+        },
+        auditBtnText: '审核', // 审核按钮默认text
+        showAddBtn: false, // 显示新增按钮
+        showSaveBtn: false, // 显示保存按钮
+        showDeleteBtn: false, // 显示删除按钮
+        showCopyBtn: false, // 显示复制按钮
+        showAuditBtn: false, // 显示审核、反审核按钮
+        showPrintBtn: false, // 显示打印按钮
+        configurable: false, // 显示界面设置按钮
+
+        detailBindeFields: [], // 从表绑定列
+        detailStore: null, // 从表store
+    },
+
+    formulas:{
+        Hidden:{
+            bind:'{ac_confirmstatus}',
+            get:function(value){
+                return !!value;
+            }
+        }
+    }
+});

+ 2 - 0
frontend/saas-web/app/view/sys/invitation/DataList.js

@@ -257,6 +257,8 @@ Ext.define('saas.view.sys.invitation.DataList', {
             gridBodyBoxHeight = gridBodyBox.height;
             var pageSize = Math.floor(gridBodyBoxHeight / 35);
             store.setPageSize(pageSize);
+            grid.ownerCt.el.dom.style.left = '8px';
+            grid.el.dom.style.padding = '0px'
         }
     },
 

+ 5 - 0
frontend/saas-web/resources/json/navigation.json

@@ -33,6 +33,11 @@
             "id": "quotationList",
             "text": "询价信息查询",
             "viewType": "purchase-quotationList-datalist"
+        },{
+            "b2b":true,
+            "id":"reconciliation",  
+            "text":"平台对账单",  
+            "viewType": "purchase-reconciliation-datalist"
         }]
     }, {
         "text": "报表",