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.
DS7/DSWeb/Areas/Import/Viewsjs/XXH_single/XXHIndex.js

1714 lines
64 KiB
JavaScript

Ext.namespace('DsTruck');
DsTruck.XXHIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.XXHIndex.superclass.constructor.call(this);
};
Ext.extend(DsTruck.XXHIndex, Ext.Panel, {
PageSize: 20,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'XXH_singlemb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/Import/XXH_single/GetDataList',
reader: {
idProperty: 'id' + 'cgid',
root: 'data',
totalProperty: 'totalCount',
sort: 'm.createtime'
}
}
});
this.formname = "XXH_single";
//#region 枚举参照
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', flex: 2
});
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.storeCountry = Ext.create('DsExt.ux.RefTableStore', {
model: 'ConutryRef',
proxy: { url: '/CommMng/BasicDataRef/GetCountryRefList' }
});
this.storeCountry.load({ params: { condition: ""} });
this.comboxCountry = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '进口国',
store: this.storeCountry,
name: 'countryid',
valueField: 'countryid',
displayField: 'country_idandname'
});
this.storeCargoinfo = Ext.create('DsExt.ux.RefTableStore', {
model: 'CargoRef',
proxy: { url: '/CommMng/BasicDataRef/GetCargoRefList' }
});
this.storeCargoinfo.load({ params: { condition: ""} });
this.comboxCargoinfo = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'HS代码',
store: this.storeCargoinfo,
name: 'Cargoinfo_id',
valueField: 'id',
displayField: 'codeandname'
//HS代码
});
this.storeCargociq = Ext.create('DsExt.ux.RefTableStore', {
model: 'CargociqRef',
proxy: { url: '/CommMng/BasicDataRef/GetCargociqRefList' }
});
this.storeCargociq.load({ params: { condition: ""} });
this.comboxCargociq = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'CIQ代码',
store: this.storeCargociq,
name: 'Cargociq_id',
valueField: 'id',
displayField: 'codeandname'
//ciq代码
});
this.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'companymb',
proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' }
});
this.storeCompany.load({ params: { condition: ""} });
this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '用证公司',
store: this.storeCompany,
name: 'company',
valueField: 'gid',
displayField: 'name'
});
this.storeRemind = Ext.create('DsExt.ux.RefTableStore', {
model: 'remind',
proxy: { url: '/CommMng/BasicDataRef/Getimportremind' }
});
this.storeRemind.load({ params: { condition: ""} });
this.comboxRemind = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务提醒',
store: this.storeRemind,
name: 'Remind',
valueField: 'RemindSql',
displayField: 'RemindName',
triggerAction: 'all',
selectOnFocus: true, flex: 2,
listeners: {
change: function (field, newValue, oldValue) {
this.onGetremind(field, newValue, oldValue);
},
scope: this
}
});
//#endregion
this.column = [
{
sortable: true, id: '',
dataIndex: 'Inspection_StorageREF',
header: '是否商检慢检',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'STT',
header: '双抬头',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'HTH',
header: '合同号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'inspection_Signup_date',
header: '报检日期',
width: 80
}, {
id: '',
sortable: true,
dataIndex: 'CreateTime_2',
header: '分公司接单日期',
width: 90
},
{
id: '',
sortable: true,
dataIndex: 'ResendTime',
header: '分公司转单日期',
width: 90
}, {
sortable: true, id: '',
dataIndex: 'inspection_no',
header: '报检号',
width: 80
}, {
id: '',
sortable: true,
dataIndex: 'seller',
header: '贸易商',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'buyer',
header: '购货方',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'country',
header: '进口国',
width: 80
}, {
sortable: true, hidden: true,
dataIndex: 'TRADECOUNTRY',
header: 'TRADECOUNTRY',
width: 80
}, {
sortable: true, //hidden: true,
dataIndex: 'TRADECOUNTRY_REF',
header: '贸易国',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'country',
header: '进口国',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'countryid',
header: 'countryid',
hidden: true,
width: 80
}, {
sortable: true, id: '',
dataIndex: 'portRef',
header: '目的港',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'companyname',
header: '用证公司(收货人)',
width: 90
}, {
sortable: true, id: '',
dataIndex: 'creattime',
header: '接单日期',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'name',
header: '货物名称',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'weight',
header: '净重(吨)',
width: 80
}, //{
// sortable: true,
// dataIndex: 'cicode',
// header: '商品手册编号',
// width: 80
//},
{
sortable: true, id: '',
dataIndex: 'ciname',
header: '商品手册名称',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'AppNo',
header: '许可证号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'printedRef',
header: '发票打印完成',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'AutoAPPRef',
header: '自动证',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'WriteoffsRef',
header: '核销完成',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'MainstateRef',
header: '合同状态',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Ex_sailingdate',
header: '预计开船日',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Sailingdate',
header: '开船日',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ArrivalDate',
header: '到港日',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ValidDate',
header: '许可证有效期',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ReceiptStatusRef',
header: '单据是否完备',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Receiptremark',
header: '寄单情况',
width: 280
}, {
sortable: true, id: '',
dataIndex: 'tax_date',
header: '出税日期',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'tax_paydate',
header: '付税日期',
width: 80
}, {
sortable: true, id: '', dataIndex: 'id', header: 'id', hidden: true
},
{
dataIndex: 'TimeMark', header: 'TimeMark', id: '', hidden: true
},
{
sortable: true, id: '',
dataIndex: 'cgid',
header: 'cgid',
hidden: true,
width: 80
}, {
sortable: true, id: '',
dataIndex: 'BillNo',
header: '提单号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'BilltypeREF',
header: '提单交付方式',
width: 100
}, {
sortable: true, id: '',
dataIndex: 'E_Billtime',
header: '电放时间',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'BillTime',
header: '正本时间',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'HDtime',
header: '换单时间',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ContainerNo',
header: '箱号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'SealNo',
header: '铅封号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ShipCompanyRef',
header: '船公司',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Vessel',
header: '船名',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Voyage',
header: '航次',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'CIQ_licence',
header: '卫生证号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'CIQ_canbesearchRef',
header: '卫生证是否可查',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'SamplingDate_Plan',
header: '海关确定抽检',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'SamplingDate_Act',
header: '海关实际验货',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'CustomsReleaseDate',
header: '海关放行日期',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'DeclareNumber',
header: '报关单号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'FactoryNo',
header: '厂号',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'boxcount',
header: '箱/件数',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'amount',
header: '合同金额',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'price',
header: '单价',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ContractNo',
header: '合同序列号',
width: 120
}, {
sortable: true, id: '',
dataIndex: 'MZBZREF',
header: '是否木质包装',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'remark_2',
header: '备注2(报检备注)',
width: 80
}, {
sortable: true,
dataIndex: 'OPBillTime',
header: '放单时间',
width: 80
}, {
sortable: true,
dataIndex: 'Dock',
header: '码头',
width: 80
},
{
sortable: true,
dataIndex: 'Customs_broker',
header: '报关行',
width: 80
},
{
sortable: true,
dataIndex: 'inspection_broker',
header: '报检行',
width: 80
},
{
sortable: true,
dataIndex: 'Shuidan_Time',
header: '税单时间',
width: 80
},
{
sortable: true,
dataIndex: 'Jianyizheng_Time',
header: '检疫证发出时间',
width: 80
},
{
sortable: true,
dataIndex: 'AutoAPP_Time',
header: '自动证收到时间',
width: 80
},
{
sortable: true,
dataIndex: 'HXD_Time',
header: '核销单收到时间',
width: 80
},
{
sortable: true,
dataIndex: 'Agent',
header: '代理',
width: 80
},
{
sortable: true,
dataIndex: 'Agent2',
header: '代理2',
width: 80
},
{
sortable: true,
dataIndex: 'Agent3',
header: '代理3',
width: 80
},
{
sortable: true,
dataIndex: 'OP',
header: '操作人',
width: 80
}];
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 38
});
var _this = this;
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 1000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.PageSize = field.lastValue;
_this.onRefreshClick();
}
}
}
});
this.MainCB_single = 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
},
selModel: this.MainCB_single,
columns: [new Ext.grid.RowNumberer()],
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.column = DsTruck.GetGridPanel(GID, this.formname, this.column);
this.column.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.column);
////////////////////////////
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
// alert('0....' + dataview.toString() + ',' + record.toString() + ',' + item.toString() + ',' + index.toString() + ',' + e.toString() + ',' + b.toString());
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/Import/XXH_single/Edit', '', 650, 1150);
}, this);
/* this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
alert(record.get("ContractNo"))
}, this);*/
//#region formSearch枚举参照相关
///////////////////////////////////////////////////
this.storeBuyer = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeBuyer.load({ params: { condition: " isagentcn=1 "} });
this.comboxBuyer = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '客户',
autosize: true,
bodyPadding: 7,
flex: 5,
labelWidth: 90,
store: this.storeBuyer,
queryMode: 'local',
triggerOnClick: false,
valueField: 'name',
displayField: 'codename'
});
this.storeCname = Ext.create('DsExt.ux.RefTableStore', {
model: 'Fieldmb',
proxy: { url: '/Import/XXH/GetField' }
});
this.storeCname.load({ params: { tablename: 'import_cargo', fieldid: 'name', fieldvalue: 'name'} });
this.Cname = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '货物名称',
autosize: true,
bodyPadding: 5,
flex: 5,
width: 100,
labelWidth: 90,
store: this.storeCname,
queryMode: 'local',
triggerOnClick: false,
valueField: 'FieldId',
displayField: 'FieldValue'
});
this.storeUser = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeUser.load({ params: { condition: ""} });
this.comboxOP = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '操作人',
forceSelection: true,
store: this.storeUser,
name: 'OP',
queryMode: 'local',
autosize: true,
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.storekfstate = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storekfstate.load({ params: { condition: " ISWAREHOUSE=1"} });
this.comboxkfstate = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '存放仓库',
forceSelection: true,
store: this.storekfstate,
name: 'kfstate',
valueField: 'CustName',
displayField: 'KFCodename'
});
////////////////////
//#endregion
//#region
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyStyle: 'overflow-x:visible; overflow-y:scroll',
bodyPadding: 15,
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: [{
fieldLabel: '从..分公司接单日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CreateTime_2_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..分公司接单日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CreateTime_2_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从..分公司转单日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ResendTime_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..分公司转单日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ResendTime_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从..到港日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ArrivalDate_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..到港日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ArrivalDate_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
]
}]
}, //end items(fieldset 1)
{//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxCompany,
this.comboxCountry,
{
fieldLabel: '包含双抬头',
xtype: 'checkbox',
name: 'STT',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{ fieldLabel: '双抬头内容',
name: 'STT_word',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从..换单时间',
format: 'Y-m-d',
xtype: 'datefield',
name: 'HDtime_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..换单时间',
format: 'Y-m-d',
xtype: 'datefield',
name: 'HDtime_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}]
}]
}, //end fieldset 2
{//fieldset 4
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxRemind, {
fieldLabel: '提单号',
name: 'BillNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '箱号',
name: 'ContainerNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从..报检日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'inspection_Signup_date_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..报检日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'inspection_Signup_date_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}]
}]
}, //end items(fieldset 4)
{//fieldset 5
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '从..出税时间',
format: 'Y-m-d',
xtype: 'datefield',
name: 'tax_date_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..出税时间',
format: 'Y-m-d',
xtype: 'datefield',
name: 'tax_date_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从..付税时间',
format: 'Y-m-d',
xtype: 'datefield',
name: 'tax_date_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..付税时间',
format: 'Y-m-d',
xtype: 'datefield',
name: 'tax_date_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从..海关放行日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CustomsReleaseDate_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..海关放行日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CustomsReleaseDate_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}]
}]
} //end items(fieldset 5)
, {//fieldset 6
xtype: 'container',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '从..商检验货日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'inspection_date_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..商检验货日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'inspection_date_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxkfstate, {
fieldLabel: '备注中包含',
name: 'remark', flex: 2,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
this.comboxOP]
}]
} //end items(fieldset 6)
, {//fieldset 6
xtype: 'container',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxport, this.Cname, this.comboxBuyer]
}]
} //end items(fieldset 6)
, {//fieldset 6
xtype: 'container',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: []
}]
} //end items(fieldset 6)
, {//fieldset 6
xtype: 'container',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: []
}]
} //end items(fieldset 6)
]//end root items
});
var menu1 = new Ext.menu.Menu({
id: 'basicMenu',
items: [{
text: '报检承诺书/检验检疫证明',
handler: clickHandler_7
},
{
text: '申报要素/商品清单',
handler: clickHandler_10
}, {
text: '商检销售记录',
handler: clickHandler_11
}, {
text: '打印合同/发票',
handler: clickHandler_17
}, {
text: '单据收发状态',
handler: clickHandler_15
}
]
});
function clickHandler_7() {
panelTest.Print_BJCNS();
};
function clickHandler_10() {
panelTest.Print_SBYS();
};
function clickHandler_11() {
panelTest.Print_SJXSJL();
};
function clickHandler_17() {
panelTest.Print_Contract();
};
function clickHandler_15() {
panelTest.Print_ReceiptList();
};
_this = this;
this.CBMSearch = new Ext.form.Checkbox({
fieldLabel: '高级查询',
listeners: {
change: function (newValue, oldValue, eOpts)//change事件
{
//alert(newValue.checked);
if (newValue.checked) {
_this.panelSearch.show();
} else {
_this.panelSearch.hide();
}
}
}
});
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [/*
{
text: "新建",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin("/Import/XXH/Edit", "新建合同", "700", "900");
},
scope: this
},
{
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
disabled: true,
scope: this
},
'-',*/
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onResetClick(button, event);
},
scope: this
}, '-', {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}, '-', {
text: "导入冷藏费单",
iconCls: "btnexportexcel",
handler: function (button, event) {
var winAccess = new DsTruck.FileImport({});
winAccess.StoreList = this.storeList;
winAccess.show();
},
scope: this
}, '-', { text: "打印报表", menu: menu1, scope: this }, {
text: "保存列表样式",
id: "btntest",
handler: function (button, event) {
//this.column = DsTruck.SaveGridPanel(GID, this.formname, this.gridList.columns, this.column, 1);
var tempcolumns = this.gridList.columns;
DsTruck.SaveGridPanel(GID, this.formname, tempcolumns, this.column, 1, true);
},
scope: this
}, { id: "S_HTH",
fieldLabel: "合同号",
labelWidth: 55,
xtype: 'textfield',
name: 'HTH',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, '-', this.CBMSearch
]
});
this.panelSearch = new Ext.Panel({
layout: "border",
region: "north",
height: 240,
autoSize: true,
hidden: true,
items: [this.formSearch]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 30,
items: [this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.panelSearch, this.gridList]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
}, //end initUIComponents
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/Import/XXH/Delete',
params: {
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}, //onDeleteClick
onResetClick: function (button, event) {
this.formSearch.getForm().reset();
},
getCondition: function () {
var sql = ' M.ISDELETE=0 and M.buztype=0 '; //只包含为删除的 和进口贸易业务
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var HTH = Ext.getCmp('S_HTH').getValue();
sql = sql + getAndConSql(sql, HTH, "M.HTH like '%" + HTH + "%'");
var CreateTime_2_min = form.findField('CreateTime_2_min').getRawValue();
sql = sql + getAndConSql(sql, CreateTime_2_min, "m.CreateTime_2 >= '" + CreateTime_2_min + "'");
var CreateTime_2_max = form.findField('CreateTime_2_max').getRawValue();
sql = sql + getAndConSql(sql, CreateTime_2_max, "m.CreateTime_2 <= '" + CreateTime_2_max + " 23:59:59'");
var ResendTime_min = form.findField('ResendTime_min').getRawValue();
sql = sql + getAndConSql(sql, ResendTime_min, "m.ResendTime >= '" + ResendTime_min + "'");
var ResendTime_max = form.findField('ResendTime_max').getRawValue();
sql = sql + getAndConSql(sql, ResendTime_max, "m.ResendTime <= '" + ResendTime_max + " 23:59:59'");
var ArrivalDate_min = form.findField('ArrivalDate_min').getRawValue();
sql = sql + getAndConSql(sql, ArrivalDate_min, "m.ArrivalDate >= '" + ArrivalDate_min + "'");
var ArrivalDate_max = form.findField('ArrivalDate_max').getRawValue();
sql = sql + getAndConSql(sql, ArrivalDate_max, "m.ArrivalDate <= '" + ArrivalDate_max + " 23:59:59'");
var company = form.findField('company').getValue();
sql = sql + getAndConSql(sql, company, "M.company = '" + company + "'");
var countryid = form.findField('countryid').getValue();
sql = sql + getAndConSql(sql, countryid, "m.countryid like '%" + countryid + "%'");
var STT = form.findField("STT").getValue();
if (STT)
{ sql = sql + getAndConSql(sql, STT, " m.STT is not null and m.STT<>'' "); }
var STT_word = form.findField('STT_word').getRawValue();
sql = sql + getAndConSql(sql, STT_word, "m.STT like '%" + STT_word + "%'");
var HDtime_min = form.findField('HDtime_min').getRawValue();
sql = sql + getAndConSql(sql, HDtime_min, "m.HDtime >= '" + HDtime_min + "'");
var HDtime_max = form.findField('HDtime_max').getRawValue();
sql = sql + getAndConSql(sql, HDtime_max, "m.HDtime <= '" + HDtime_max + " 23:59:59'");
var BillNo = form.findField('BillNo').getRawValue();
sql = sql + getAndConSql(sql, BillNo, "m.BillNo like '%" + BillNo + "%'");
var ContainerNo = form.findField('ContainerNo').getRawValue();
sql = sql + getAndConSql(sql, ContainerNo, "m.ContainerNo like '%" + ContainerNo + "%'");
var inspection_Signup_date_min = form.findField('inspection_Signup_date_min').getRawValue();
sql = sql + getAndConSql(sql, inspection_Signup_date_min, "m.inspection_Signup_date >= '" + inspection_Signup_date_min + "'");
var inspection_Signup_date_max = form.findField('inspection_Signup_date_max').getRawValue();
sql = sql + getAndConSql(sql, inspection_Signup_date_max, "m.inspection_Signup_date <= '" + inspection_Signup_date_max + " 23:59:59'");
var tax_date_min = form.findField('tax_date_min').getRawValue();
sql = sql + getAndConSql(sql, tax_date_min, "m.tax_date >= '" + tax_date_min + "'");
var tax_date_max = form.findField('tax_date_max').getRawValue();
sql = sql + getAndConSql(sql, tax_date_max, "m.tax_date <= '" + tax_date_max + " 23:59:59'");
var CustomsReleaseDate_min = form.findField('CustomsReleaseDate_min').getRawValue();
sql = sql + getAndConSql(sql, CustomsReleaseDate_min, "m.CustomsReleaseDate >= '" + CustomsReleaseDate_min + "'");
var CustomsReleaseDate_max = form.findField('CustomsReleaseDate_max').getRawValue();
sql = sql + getAndConSql(sql, CustomsReleaseDate_max, "m.CustomsReleaseDate <= '" + CustomsReleaseDate_max + " 23:59:59'");
var inspection_date_min = form.findField('inspection_date_min').getRawValue();
sql = sql + getAndConSql(sql, inspection_date_min, "m.inspection_date >= '" + inspection_date_min + "'");
var inspection_date_max = form.findField('inspection_date_max').getRawValue();
sql = sql + getAndConSql(sql, inspection_date_max, "m.inspection_date <= '" + inspection_date_max + " 23:59:59'");
var kfstate = form.findField('kfstate').getValue();
sql = sql + getAndConSql(sql, kfstate, "M.contractno in( select contractno from import_kc where kfstate= '" + kfstate + "')");
var remark = form.findField('remark').getValue();
sql = sql + getAndConSql(sql, remark, "(m.remark like '%" + remark + "%' or m.remark_2 like '%"
+ remark + "%' or m.remark_3 like '%" + remark + "%' or m.remark_4 like '%" + remark + "%' or m.Receiptremark like '%" + remark + "%' )");
var OP = form.findField('OP').getValue();
var opstr = '';
for (var i = 0; i < OP.length; i++) {
opstr = opstr + "'" + OP[i] + "',";
}
opstr = opstr.substr(0, opstr.length - 1);
//sql = sql + getAndConSql(sql, OP, "M.OP = '" + OP + "'");
sql = sql + getAndConSql(sql, OP, "M.OP in (" + opstr + ")");
var port = this.comboxport.getValue();
if (port != "") {
sql = sql + getAndConSql(sql, port, "m.port in (" + port + ")");
}
var CnameList = this.Cname.getValue();
var CnameString = "";
for (var i in CnameList) {
if (CnameString == "") { CnameString = "'" + CnameList[i] + "'"; }
else { CnameString = CnameString + ",'" + CnameList[i] + "'"; }
}
if (CnameString != "") {
sql = sql + getAndConSql(sql, CnameString, "cg.name in (" + CnameString + ")");
}
var buyer = this.getStrValue(this.comboxBuyer.getValue());
sql = sql + getAndConSql(sql, buyer, "M.buyer in (" + buyer + ")");
if (this.remind != "") {
sql = sql + getAndConSql(sql, this.remind, this.remind);
}
return sql;
},
getStrValue: function (list) {
var _list = [];
for (var _i = 0; _i < list.length; _i++) {
_list.push("'" + list[_i] + "'");
}
return _list;
},
onGetremind: function (field, newValue, oldValue) {
if (newValue != null) {
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: newValue },
waitMsg: "正在查询数据...",
scope: this
});
}
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
},
// alert(this.OprationStatus.ToString());
// alert(this.storeList.toString());
// alert(this.SelectedRecord.toString());
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
Print_BJCNS: function () { //报检承诺书
var MainList = "";
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
var contractno = "";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "" + rec.get('ContractNo') + ""; }
else {
MainList = MainList + "," + rec.get('ContractNo') + "";
}
if (contractno == "") { contractno = "'" + rec.get('ContractNo') + "'" }
else {
contractno = contractno + ",'" + rec.get('ContractNo') + "'";
}
}
if (MainList == "") {
Ext.Msg.show({ title: '错误', msg: '选中至少一个合同', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var y = '';
var m = ''; //获取当前月份的日期
var d = '';
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
y = dd.getFullYear();
m = dd.getMonth() + 1; //获取当前月份的日期
d = dd.getDate();
return y + "-" + m + "-" + d;
}
//alert(GetDateStr(+5));
var printdate = GetDateStr(0);
//var getmoneydate = GetDateStr(5);
var printType = 'XXH_BJCNS'; //报检承诺书
var sql1 = " select m.inspection_no,dbo.F_Str(m.ContractNo) name,m.ContainerNo, ";
var sql1 = sql1 + " (select sum(c2.weight) from import_cargo c2 where c2.contractno=m.contractno) [weigth], ";
var sql1 = sql1 + " substring(cc.country,0,(charindex('(',cc.country)) ) as country , ";
var sql1 = sql1 + " (select EnumValueName from tSysEnumValue where LangId=0 ";
var sql1 = sql1 + " and EnumTypeID=10 and EnumValueID=M.port) as portRef, ";
var sql1 = sql1 + " dbo.F_weight_KG(M.ContractNo) KG_Weight, ";
var sql1 = sql1 + " dbo.F_Count(M.ContractNo) Boxcount,cp.fullname fullname, ";
var sql1 = sql1 + " dbo.F_factoryno(M.contractno) factoryno,dbo.F_productiondate(M.ContractNo) productiondate,M.HTH, ";
var sql1 = sql1 + " convert(varchar(10),M.arrivaldate,102) arrivaldate, "; //datepart(year,inspection_date) y
var sql1 = sql1 + " datepart(year,inspection_date) y,datepart(month,inspection_date) m,datepart(day,inspection_date) d, "; //
var sql1 = sql1 + " m.SealNo,m.Vessel,m.Voyage,m.Billno,M.CIQ_licence ";
var sql1 = sql1 + " from import_main m ";
var sql1 = sql1 + " left join code_country cc on cc.countryid=m.countryid ";
var sql1 = sql1 + " left join [company] cp on cp.gid=m.company ";
var sql1 = sql1 + " where m.contractno in(" + contractno + ") ";
var sql2 = " select '" + y + "' y,'" + m + "' m,'" + d + "' d," + printdate + " printdate";
var sql3 = " select m.inspection_no,dbo.F_Str(m.ContractNo) name,m.ContainerNo, ";
var sql3 = sql3 + " (select sum(c2.weight) from import_cargo c2 where c2.contractno=m.contractno) [weigth], ";
var sql3 = sql3 + " substring(cc.country,0,(charindex('(',cc.country)) ) as country , ";
var sql3 = sql3 + " (select EnumValueName from tSysEnumValue where LangId=0 ";
var sql3 = sql3 + " and EnumTypeID=10 and EnumValueID=M.port) as portRef, ";
var sql3 = sql3 + " dbo.F_weight_KG(M.ContractNo) KG_Weight, ";
var sql3 = sql3 + " dbo.F_Count(M.ContractNo) Boxcount,cp.fullname fullname, ";
var sql3 = sql3 + " dbo.F_factoryno(M.contractno) factoryno,dbo.F_productiondate(M.ContractNo) productiondate,M.HTH, ";
var sql3 = sql3 + " convert(varchar(10),M.arrivaldate,102) arrivaldate, "; //datepart(year,inspection_date) y
var sql3 = sql3 + " datepart(year,inspection_date) y,datepart(month,inspection_date) m,datepart(day,inspection_date) d, "; //
var sql3 = sql3 + " m.SealNo,m.Vessel,m.Voyage,m.Billno,M.CIQ_licence ";
var sql3 = sql3 + " from import_main m ";
var sql3 = sql3 + " left join code_country cc on cc.countryid=m.countryid ";
var sql3 = sql3 + " left join [company] cp on cp.gid=m.company ";
var sql3 = sql3 + " where m.contractno in(" + contractno + ") ";
var sql4 = "";
var sql5 = "";
var sql6 = "";
var sql6 = sql6 + "";
var sql6 = sql6 + "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
,
Print_SBYS: function () { //申报要素_曹青
var MainList = "";
var MainListString = "";
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
var contractno = "";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'" + rec.get('ContractNo') + "'"; }
//if (MainListString == "") { MainListString = "''" + rec.get('ContractNo') + "''"; }
else {
MainList = MainList + ",'" + rec.get('ContractNo') + "'";
//MainListString = MainListString + ",''" + rec.get('ContractNo') + "''";
}
if (contractno == "") { contractno = rec.get('ContractNo') }
else if (contractno != rec.get('ContractNo')) {
alert("不能跨合同选择商品");
return false;
}
}
if (MainList == "") {
Ext.Msg.show({ title: '错误', msg: '选中至少一个商品', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
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 printdate = GetDateStr(0);
var printType = 'XXH_SBYS'; //申报要素
var sql1 = " ";
var sql1 = sql1 + " select c.name [标签品名],c.ename [英文品名],c.sbys [申报要素],(select code from Import_cargoinfo where id=c.cargoinfo_id) HS ";
var sql1 = sql1 + " ,m.hth [合同号],m.containerno [箱号],m.billno [提单号] ";
var sql1 = sql1 + " from Import_cargo c left join import_main m on m.contractno=c.contractno where c.id in(select id from import_cargo where contractno='" + contractno + "')";
var sql2 = "select '" + SHOWNAME + "' showname,'" + printdate + "' printdate";
var sql3 = "";
var sql3 = sql3 + " select c.name [标签品名] ";
var sql3 = sql3 + " ,c.boxcount [件数] ,c.weight [重量] ";
var sql3 = sql3 + " from Import_cargo c where c.id in(select id from import_cargo where contractno='" + contractno + "')";
var sql4 = "";
var sql5 = "";
var sql6 = "";
var sql6 = sql6 + "";
var sql6 = sql6 + "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_SJXSJL: function () {
//商检销售记录
var MainList = "";
var selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'" + rec.get('ContractNo') + "'"; }
else {
MainList = MainList + ",'" + rec.get('ContractNo') + "'";
}
}
if (MainList == "") {
Ext.Msg.show({ title: '错误', msg: '选中至少一个合同', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var printType = 'SJXSJL'; //商检销售记录
var sql1 = " select m.ArrivalDate,c.name,c.boxcount,c.weight,c.Productiondate,M.HTH,C.boxweight, ";
var sql1 = sql1 + " m.Contacter,m.tel,m.DeliveryAddress,comp.fullname as companyname , ";
var sql1 = sql1 + " case isnull((select max(czdate) from import_kc where import_kc.contractno=m.contractno and import_kc.czstate in (3,5)),'') when '' then dbo.trimdate(M.DeliveryDate) else ";
var sql1 = sql1 + " substring(convert(varchar,(select max(czdate) from import_kc where import_kc.contractno=m.contractno and import_kc.czstate in (3,5)),23),6,2)+'.'+ ";
var sql1 = sql1 + " substring(convert(varchar,(select max(czdate) from import_kc where import_kc.contractno=m.contractno and import_kc.czstate in (3,5)),23),9,2) end as kcout ";
var sql1 = sql1 + " ,M.Inspection_Buyer ,IC.tel Inspection_tel,IC.EMAIL Inspection_Email,IC.ADDR Inspection_DeliveryAddress ";
var sql1 = sql1 + " ,CHIEF Inspection_Contacter,EDICODE Inspection_Code,c.Productiondate,c.BZTCHNO ";
var sql1 = sql1 + " from import_main m ";
var sql1 = sql1 + " left join company comp on comp.gid=M.company ";
var sql1 = sql1 + " left join import_cargo c on c.contractno=m.contractno ";
var sql1 = sql1 + " left join info_client IC on IC.shortname=M.Inspection_Buyer ";
var sql1 = sql1 + " where m.contractno in(" + MainList + ")";
var sql1 = sql1 + " order by m.ArrivalDate";
//var sql1 = sql1 + " go ";
//alert(sql1);
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
,
Print_Contract: function () {//打印合同/发票
var MainList = "";
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'" + rec.get('ContractNo') + "'"; }
else {
MainList = MainList + ",'" + rec.get('ContractNo') + "'";
}
}
var printType = 'XXH_Print_Contract'; //打印发票
var T = this.getCondition();
if (T != "") { T = " where " + T; }
else {
T = " where 1=1 "
}
var sql1 = " select contractno,(select enfullname from info_client where SHORTNAME= M.seller) 贸易商 ";
sql1 = sql1 + " ,comp.fullNAME,comp.ENNAME 用证公司英文全称,comp.ENADDRESS 用证公司英文地址 ";
sql1 = sql1 + " ,comp.OFFICEPHONE 用证公司办公电话,comp.FAX 用证公司传真 ";
sql1 = sql1 + " ,m.hth 合同号,dbo.trimdate(m.creattime) 接单日期,(select top 1 PreProportion from import_cargo where ContractNo=m.ContractNo) 预付比例 ";
sql1 = sql1 + " ,substring(cc.country,charindex('(',cc.country)+1,charindex(')',cc.country)-charindex('(',cc.country)-1 ) 进口国 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=1 and EnumValueID=M.TransactionMethod) as 成交方式 ";
sql1 = sql1 + " ,dbo.trimdate(m.arrivaldate) 预计到港日 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) as 目的港 ";
sql1 = sql1 + " ,(select EnumValueName_2 from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) as 目的港EN ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=4 and EnumValueID=M.PaymentMethods) as 付款方式 ";
sql1 = sql1 + " ,(select sum(weight) from import_cargo where contractno=m.contractno) as 货物总重 ";
sql1 = sql1 + " from import_main m ";
sql1 = sql1 + " left join code_country cc on cc.COUNTRYID=m.countryid ";
sql1 = sql1 + " left join company comp on comp.gid=m.company ";
//sql1 = sql1 + " left join import_cargo c on m.contractno=c.contractno ";
sql1 = sql1 + T;
if (MainList != "") {
sql1 = sql1 + " and m.contractno in( " + MainList + " ) "; //and isnull(dbo.trimdate(m.inspection_date),'')=''
}
sql1 = sql1 + " order by m.contractno ";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_ReceiptList: function () { //单据列表
var MainList = "";
var MainListString = "";
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = rec.get('id'); }
else {
MainList = MainList + "," + rec.get('id') + "";
}
}
var T = "";
if (MainList == "") {
//Ext.Msg.show({ title: '错误', msg: '选中至少一个合同', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
//return;
T = this.getCondition();
if (T != "") { T = " where " + T; };
}
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 printdate = GetDateStr(0);
var printType = 'Print_ReceiptList'; //单据收发状态维护
var sql1 = " select hth 合同号,billno 提单号,ContainerNo 箱号,buyer 购货商,dbo.trimdate(ArrivalDate) 到港日 ";
sql1 = sql1 + " ,dbo.trimdate(DeliveryDate) 送货日,(case Inspection_Storage when 1 then '是' else '否' end) 是否采样 ";
sql1 = sql1 + " ,(select top 1 dbo.trimdate(RECEIVE_DATE) from op_receipt where bsno=m.ContractNo and RECEIPTTYPE='单据') 单据_收 ";
sql1 = sql1 + " ,(select top 1 dbo.trimdate(SEND_DATE) from op_receipt where bsno=m.ContractNo and RECEIPTTYPE='单据') 单据_发 ";
sql1 = sql1 + " ,(select top 1 dbo.trimdate(RECEIVE_DATE) from op_receipt where bsno=m.ContractNo and RECEIPTTYPE='检验检疫证明')检验检疫证明_收 ";
sql1 = sql1 + " ,(select top 1 dbo.trimdate(SEND_DATE) from op_receipt where bsno=m.ContractNo and RECEIPTTYPE='检验检疫证明')检验检疫证明_发 ";
sql1 = sql1 + " ,(select top 1 dbo.trimdate(RECEIVE_DATE) from op_receipt where bsno=m.ContractNo and RECEIPTTYPE='税单')税单_收 ";
sql1 = sql1 + " ,(select top 1 dbo.trimdate(SEND_DATE) from op_receipt where bsno=m.ContractNo and RECEIPTTYPE='税单')税单_发 ";
sql1 = sql1 + " ,(select top 1 dbo.trimdate(RECEIVE_DATE) from op_receipt where bsno=m.ContractNo and RECEIPTTYPE='报关单')报关单_收 ";
sql1 = sql1 + " ,(select top 1 dbo.trimdate(SEND_DATE) from op_receipt where bsno=m.ContractNo and RECEIPTTYPE='报关单')报关单_发 ";
sql1 = sql1 + " from import_main m ";
sql1 = sql1 + " left join code_country c on m.countryid=c.countryid ";
sql1 = sql1 + " left join import_cargo cg on cg.contractno=M.contractno ";
sql1 = sql1 + " left join import_cargoinfo ci on ci.id=cg.cargoinfo_id ";
sql1 = sql1 + " left join company comp on comp.gid=M.company ";
sql1 = sql1 + " left join import_appstate ast on ast.cargo_id=cg.id ";
sql1 = sql1 + " left join import_approval ap on ap.id=ast.app_id ";
sql1 = sql1 + " left join vmsappused vau on vau.app_id=ap.id ";
sql1 = sql1 + " left join info_client IC on IC.shortname=M.Inspection_Buyer ";
if (MainList != "") {
sql1 = sql1 + " where m.id in (" + MainList + ") ";
} else {
sql1 = sql1 + T;
}
var sql2 = "select '" + SHOWNAME + "' showname,'" + printdate + "' printdate";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});