You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

687 lines
23 KiB
JavaScript

12 months ago
//集运管理-路单查询
Ext.namespace('DsTruck');
DsTruck.RptImportFeedetailIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.RptImportFeedetailIndex.superclass.constructor.call(this);
};
Ext.extend(DsTruck.RptImportFeedetailIndex, Ext.Panel, {
PageSize: 500,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
idProperty: 'GId',
fields: [
{ name: 'GId', type: 'string' },
{ name: 'Billno', type: 'string' },
{ name: 'ContractNo', type: 'string' },
{ name: 'HTH', type: 'string' },
{ name: 'seller', type: 'string' },
{ name: 'buyer', type: 'string' },
{ name: 'Vessel', type: 'string' },
{ name: 'Voyage', type: 'string' },
{ name: 'Sailingdate', type: 'string' },
{ name: 'ArrivalDate', type: 'string' },
{ name: 'ContainerNo', type: 'string' },
{ name: 'SealNo', type: 'string' },
{ name: 'creattime', type: 'string' },
{ name: 'FeeType_Ref', type: 'string' },
{ name: 'FeeStatus_Ref', type: 'string' },
{ name: 'FeeStatus', type: 'string' },
{ name: 'FeeName_Ref', type: 'string' },
{ name: 'FeeDescription', type: 'string' },
{ name: 'CustomerName_Ref', type: 'string' },
{ name: 'Unit', type: 'string' },
{ name: 'Currency', type: 'string' },
{ name: 'Remark', type: 'string' },
{ name: 'EnterDate', type: 'string' },
{ name: 'UnitPrice', type: 'number' },
{ name: 'Quantity', type: 'number' },
{ name: 'Amount_YS', type: 'number' },
{ name: 'Amount_YF', type: 'number' },
{ name: 'Amount_RMBYS', type: 'number' },
{ name: 'Amount_RMBYF', type: 'number' },
{ name: 'ExChangerate', type: 'number' },
{ name: 'CreateUser', type: 'string' },
{ name: 'AC', type: 'string' },
{ name: 'AD', type: 'string' },
{ name: 'CR', type: 'string' },
{ name: 'DR', type: 'string' }
//,
//{ name: 'dotype', type: 'string' },
//{ name: 'remain', type: 'string' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Import/RptImportFeedetail/GetDataList',
reader: {
id: 'Id',
root: 'data',
totalProperty: 'totalCount'
}
}
});
Ext.define('Tradermb', {
extend: 'Ext.data.Model',
idProperty: 'gid',
fields: [
{ name: 'gid', type: 'string' },
{ name: 'name', type: 'string' },
{ name: 'codename', type: 'string' }
]
});
this.formname = "ImportFeedetail";
this.storeMainstate = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeMainstate.load({ params: { enumTypeId: 3} });
this.comboxMainstate = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '合同状态',
store: this.storeMainstate,
name: 'Mainstate'
});
this.storeFeestatus = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeFeestatus.load({ params: { enumTypeId: 99024} });
this.comboxFeestatus = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '费用状态',
store: this.storeFeestatus,
name: 'FeeStatus'
});
this.storeFeetype = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeFeetype.load({ params: { enumTypeId: 22} });
this.comboxFeetype = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '收付方向',
store: this.storeFeetype,
name: 'Feetype'
});
this.storeFeeName = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.FeeTypeRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetFeeTypeRefList' }
});
this.storeFeeName.load({ params: { condition: ""} });
this.comboxFeeName = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '费用名称',
//renderTo: 'basicBoxselect',height:60,pinList: false,
//autoHeight:true,width: 500,stacked: true,
autosize: true,
bodyPadding: 7,
flex: 1,
labelWidth: 90,
store: this.storeFeeName,
queryMode: 'local',
triggerOnClick: false,
valueField: 'Name',
displayField: 'CodeAndName'
});
this.storeCustomer = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeCustomer.load({ params: { condition: " 1=1 "} });
this.comboxCustomer = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '结算对象',
store: this.storeCustomer,
name: 'Customer',
valueField: 'name',
displayField: 'codename'
});
this.storeport = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeport.load({ params: { enumTypeId: 10} });
this.comboxport = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '目的港',
store: this.storeport,
name: 'port'
});
this.column = [{
sortable: true,
dataIndex: '',
header: '',
width: 120
}, {
sortable: true,
dataIndex: 'CustomerName_Ref',
header: '结算对象',
width: 76
}, {
sortable: true,
dataIndex: 'HTH',
header: '合同号',
width: 65
}, {
sortable: true,
dataIndex: 'ContractNo',
header: '合同序列号',
hidden: true,
width: 65
}, {
sortable: true,
dataIndex: 'FeeName_Ref',
header: '费用名称',
width: 60
}, {
sortable: true,
dataIndex: 'CreateUser',
header: '录入人',
width: 60
}, {
sortable: true,
dataIndex: 'FeeType_Ref',
header: '收付类型',
width: 65
}, {
sortable: true,
dataIndex: 'Amount_YS',
header: '应收',
width: 80
}, {
sortable: true,
dataIndex: 'Amount_YF',
header: '应付',
width: 80
}, {
sortable: true,
dataIndex: 'Amount_RMBYS',
header: '应收(RMB)',
width: 80
}, {
sortable: true,
dataIndex: 'Amount_RMBYF',
header: '应付(RMB)',
width: 80
}, {
sortable: true,
dataIndex: 'ArrivalDate',
header: '到港日期',
width: 70
}, {
sortable: true,
dataIndex: 'Billno',
header: '提单号',
width: 130
}, {
sortable: true,
dataIndex: 'seller',
header: '贸易商',
hidden: true,
width: 65
}, {
sortable: true,
dataIndex: 'EnterDate',
header: '费用录入日期',
width: 70
}, {
sortable: true,
dataIndex: 'FeeStatus_Ref',
header: '费用状态',
width: 60
}, {
dataIndex: 'FeeStatus',
header: 'FeeStatus', hidden: true,
width: 60
}, {
sortable: true,
dataIndex: 'UnitPrice',
header: '单价',
width: 60
}, {
sortable: true,
dataIndex: 'Unit',
header: '重量单位',
width: 60
}, {
sortable: true,
dataIndex: 'Quantity',
header: '数量',
width: 60
}, {
sortable: true,
dataIndex: 'Currency',
header: '币别',
width: 60
}, {
sortable: true,
dataIndex: 'ExChangerate',
header: '汇率',
width: 60
}, {
sortable: true,
dataIndex: 'Vessel',
header: '船名',
width: 60
}, {
sortable: true,
dataIndex: 'Voyage',
header: '航次',
width: 60
}, {
sortable: true,
dataIndex: 'ContainerNo',
header: '箱号',
width: 80
}, {
sortable: true,
dataIndex: 'SealNo',
header: '封号',
width: 80
}, {
sortable: true,
dataIndex: 'Remark',
header: '费用备注',
width: 80
}, {
sortable: true,
dataIndex: 'AC',
header: '付费申请',
width: 140
}, {
sortable: true,
dataIndex: 'AD',
header: '收费申请',
width: 140
}, {
sortable: true,
dataIndex: 'CR',
header: '付费结算',
width: 140
}, {
sortable: true,
dataIndex: 'DR',
header: '收费结算',
width: 140
}, {
dataIndex: 'GId',
header: 'GId', hidden: true,
width: 140
}];
this.FeeCBModel = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
viewConfig: {
enableTextSelection: true,
autoFill: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('FeeStatus');
return DsTruck.MsChFeeGetRowClass(feeStatus);
}
},
stateful: true,
selModel: this.FeeCBModel,
columns: [new Ext.grid.RowNumberer()],
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
/////////////以下部分为获取存储的gridpanel显示样式
this.column = DsTruck.GetGridPanel(GID, this.formname, this.column, 1);
//使用者id表名 中间column数组跳过一开始的几列
this.gridList.reconfigure(this.storeList, this.column);
this.gridList.columns[0] = new Ext.grid.RowNumberer();
////////////////////////////
//#region formSearch
//#region formSearch枚举参照相关
//#endregion
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxBuyer,
this.comboxFeetype,
this.comboxFeestatus,
{
fieldLabel: '从费用日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'EnterDate_min'
}, {
fieldLabel: '到费用日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'EnterDate_max'
}
]
}
]//end items(fieldset 1)
}, //end fieldset 1
{//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxport,
{
fieldLabel: '合同号',
name: 'HTH', flex: 1
},
{
fieldLabel: '备注中包含',
name: 'ReMark', flex: 3
}
]
}
]//end items(fieldset 2)
}//end fieldset 2
, {//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCustomer,
this.comboxFeeName
]
}
]//end items(fieldset 2)
}//end fieldset 2
]//end root items
});
//#endregion formSearch
var menu1 = new Ext.menu.Menu({
id: 'basicMenu',
items: [{
text: '收款通知单',
handler: clickHandler_SK
}, {
text: '付款通知单',
handler: clickHandler_FK
}]
});
function clickHandler_SK() {
window.pnlRptImportFeedetailIndex.Print_SK();
};
function clickHandler_FK() {
window.pnlRptImportFeedetailIndex.Print_FK();
};
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}, {
text: "保存列表样式",
id: "btntest",
handler: function (button, event) {
this.column = DsTruck.SaveGridPanel(GID, this.formname, this.gridList.columns, this.column, 1, true);
//alert(this.column[0].id);
},
scope: this
},
{ text: "打印报表", menu: menu1, scope: this }
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 125,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.storeList.on('beforeload', function (store) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
}, //end initUIComponents
onRefreshClick: function (button, event) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = ' M.ISDELETE=0 ';
var Customer = form.findField('Customer').getValue();
sql = sql + getAndConSql(sql, Customer, "f.CustomerName like '%" + Customer + "%'");
var Feetype = form.findField('Feetype').getValue();
sql = sql + getAndConSql(sql, Feetype, "f.Feetype = " + Feetype);
var port = form.findField('port').getValue();
sql = sql + getAndConSql(sql, port, "M.port = " + port);
var EnterDate_min = form.findField('EnterDate_min').getRawValue();
sql = sql + getAndConSql(sql, EnterDate_min, "f.EnterDate_min >= '" + EnterDate_min + "'");
var EnterDate_max = form.findField('EnterDate_max').getRawValue();
sql = sql + getAndConSql(sql, EnterDate_max, "f.EnterDate_max <= '" + EnterDate_max + " 23:59:59'");
var HTH = form.findField('HTH').getValue();
sql = sql + getAndConSql(sql, HTH, "M.HTH like '%" + HTH + "%'");
/*
var FeeType = form.findField('FeeType').getValue();
sql = sql + getAndConSql(sql, FeeType, "f.FeeType = " + FeeType);
*/
var FeeName = this.getStrValue(this.comboxFeeName.getValue());
sql = sql + getAndConSql(sql, FeeName, "f.FeeName in (" + FeeName + ")");
var FeeStatus = form.findField('FeeStatus').getValue();
sql = sql + getAndConSql(sql, FeeStatus, "f.FeeStatus like " + FeeStatus);
return sql;
},
checkSearchCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
getStrValue: function (list) {
var _list = [];
for (var _i = 0; _i < list.length; _i++) {
_list.push("'" + list[_i] + "'");
}
return _list;
},
Print_SK: function () {
//alert("print");
var selectedRecords = this.gridList.selModel.getSelection();
var FEEGID = "";
var CUSTOMERNAME = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.get('FeeType_Ref') == "应收" && rec.get('FeeStatus')=='0') {
if (FEEGID == "") {
FEEGID = FEEGID + "'" + rec.get('GId') + "'";
} else {
FEEGID = FEEGID + ",'" + rec.get('GId') + "'";
}
if (CUSTOMERNAME[0] != rec.get('CustomerName_Ref')) {
CUSTOMERNAME.push(rec.get('CustomerName_Ref'));
}
}
}
/*
if (CUSTOMERNAME.length > 1) {
alert("")
}*/
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
}
//alert(GetDateStr(+5));
var madedate = GetDateStr(0);
var printType = 'RptFee_TZD_SK'; //收款通知单
var sql1 = " select m.hth,m.billno,cf.feename,cf.amount,cf.currency from ch_fee cf ";
var sql1 = sql1 + " left join import_main m on m.contractno=cf.bsno ";
var sql1 = sql1 + " where cf.gid in( " + FEEGID + ")";
//var sql1 = sql1 + T;
//var sql1 = sql1 + " go ";
var sql2 = "";
var sql3 = "select '" + madedate + "' as madedate,'" + CUSTOMERNAME[0] + "' as CUSTOMERNAME,'" + SHOWNAME + "' as SHOWNAME";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_FK: function () {
//alert("print");
var selectedRecords = this.gridList.selModel.getSelection();
var FEEGID = "";
var CUSTOMERNAME = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.get('FeeType_Ref') == "应付" && rec.get('FeeStatus') == '0') {
if (FEEGID == "") {
FEEGID = FEEGID + "'" + rec.get('GId') + "'";
} else {
FEEGID = FEEGID + ",'" + rec.get('GId') + "'";
}
if (CUSTOMERNAME[0] != rec.get('CustomerName_Ref')) {
CUSTOMERNAME.push(rec.get('CustomerName_Ref'));
}
}
}
/*
if (CUSTOMERNAME.length > 1) {
alert("")
}*/
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
}
//alert(GetDateStr(+5));
var madedate = GetDateStr(0);
var printType = 'RptFee_TZD_FK'; //付款通知单
var sql1 = " select m.hth,m.billno,cf.feename,cf.amount,cf.currency from ch_fee cf ";
var sql1 = sql1 + " left join import_main m on m.contractno=cf.bsno ";
var sql1 = sql1 + " where cf.gid in( " + FEEGID + ")";
//var sql1 = sql1 + T;
//var sql1 = sql1 + " go ";
var sql2 = "";
var sql3 = "select '" + madedate + "' as madedate,'" + CUSTOMERNAME[0] + "' as CUSTOMERNAME,'" + SHOWNAME + "' as SHOWNAME";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});