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.

1367 lines
56 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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: 500,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
winOpen: null,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'XXHmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/Import/XXH/GetDataList',
reader: {
idProperty: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.formname = "UseApproval";
//#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',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
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',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//表参照
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',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
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',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
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,
listeners: {
change: function (field, newValue, oldValue) {
this.onGetremind(field, newValue, oldValue);
},
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
},
scope: this
}
});
//#endregion
//#region 定义Grid
this.MainCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 50
});
this.column = [{
sortable: true, id: '',
dataIndex: 'ContractNo',
header: '合同序列号',
width: 120
}, {
sortable: true, id: '',
dataIndex: 'HTH',
header: '合同号',
width: 110
}, {
sortable: true, id: '',
dataIndex: 'HTDATE',
header: '合同日期',
width: 70
},
{
sortable: true, id: '',
dataIndex: 'companyname',
header: '用证公司',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'seller',
header: '贸易商',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'buyer',
header: '客户(购货方)',
width: 80
}, {
id: '', sortable: true, dataIndex: 'id', header: 'id', hidden: true
},
{
id: '', dataIndex: 'TimeMark', header: 'TimeMark', hidden: true
},
{
sortable: true, id: '',
dataIndex: 'cgid',
header: 'cgid',
hidden: true,
width: 80
},
{
sortable: true, id: '',
dataIndex: 'name',
header: '货名',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'weight',
header: '净重(吨)',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'country',
header: '进口国',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'TRADECOUNTRY_REF',
header: '贸易国',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'portRef',
header: '目的港',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'AppNo',
header: '许可证号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ValidDate',
header: '许可证有效期',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ArrivalDate',
header: '到港日',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Printed',
header: '发票打印完成',
width: 70
}, {
sortable: true, id: '',
dataIndex: 'AutoAPP',
header: '自动证',
width: 70,
renderer: function (value) {
switch (value) {
case "0":
return "否";
default:
return "是";
}
}
}, {
sortable: true,
dataIndex: 'AutoAPPApplyId',
header: '自动证申请号',
width: 160
}, {
sortable: true,
dataIndex: 'AutoAPPNum',
header: '自动证号',
width: 160
}, {
sortable: true,
dataIndex: 'ApplyDate',
header: '申请日期',
width: 160,
renderer: function (value) {
return Ext.util.Format.date(value, 'Y-m-d');;
}
}, {
sortable: true, id: '',
dataIndex: 'Writeoffs',
header: '核销完成',
width: 70,
renderer: function (value) {
switch (value) {
case "0":
return "否";
default:
return "是";
}
}
}, {
sortable: true, id: '',
dataIndex: 'MainstateRef',
header: '合同工作状态',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'cicode',
header: '商品手册编号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ciname',
header: '商品手册名称',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'countryid',
header: 'countryid',
hidden: true,
width: 80
}, {
sortable: true, id: '',
dataIndex: 'inspection_no',
header: '报检号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'creattime',
header: '接单时间',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Receiptremark',
header: '寄单情况',
width: 200
}, {
sortable: true, id: '',
dataIndex: 'AppName',
header: '许可证货物名',
width: 90
}, {
sortable: true, id: '',
dataIndex: 'Audit',
header: '审单时间',
width: 90
}, {
sortable: true, id: '',
dataIndex: 'OP',
header: '操作人',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'APPREMARK',
header: '许可证备注',
width: 140
}, {
sortable: true, id: '',
dataIndex: 'APPWEIGHT',
header: '配证重量',
width: 140
}, {
sortable: true,
dataIndex: 'BillNo',
header: '提单号',
width: 80
}, {
sortable: true,
dataIndex: 'SBYS',
header: '申报要素',
width: 160
}];
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
selModel: this.MainCB,
viewConfig: {
autoFill: true,
enableTextSelection: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var OwnApp = record.get('OwnApp');
return DsTruck.AppUsedGetRowClass(OwnApp);
}
},
columns: [new Ext.grid.RowNumberer()],
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
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';
this.winOpen = DsOpenEditWin('/Import/UseApproval/Edit', record.data.ContractNo, "700", "1100","150","150");
}, this);
/* this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
alert(record.get("ContractNo"))
}, this);*/
/////////////以下部分为获取存储的gridpanel显示样式
this.column = DsTruck.GetGridPanel(GID, this.formname, this.column);
this.column.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.column);
////////////////////////////
//#endregion
var _this = this;
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: [/*{
fieldLabel: '合同序列号',
name: 'ContractNo'
},*/{
fieldLabel: '合同号/箱号',
//labelWidth: 120,
name: 'HTH',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
this.comboxCompany,
this.comboxCountry, {
fieldLabel: '备注中包含',
name: 'remark',
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.comboxport,
this.comboxMainstate,
{ fieldLabel: '贸易商',
name: 'seller',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{ fieldLabel: '客户',
name: 'buyer',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
]
}]
}, //end fieldset 2
{//fieldset 3
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '未打印发票',
xtype: 'checkbox',
name: 'Printed'
}
, this.comboxRemind, {
fieldLabel: '从..预计开船日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExsailingDate_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..预计开船日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExsailingDate_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}]
}]
}, //end items(fieldset 4)
{//fieldset 4
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: 'Creattime_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..接单日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'Creattime_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从..审单日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'Audittime_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..审单日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'Audittime_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}]
}]
}, //end items(fieldset 4)
{//fildset 5
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '货物名称包含',
name: 'CargoName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从..到港日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ArrivalDate_min', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..到港日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ArrivalDate_max', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从..核销日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'cancellation_date_min', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..核销日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'cancellation_date_max', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}]
}]
} //end items(fieldset 5)
]//end root items
});
//#endregion formSearch
//#region 查询工具条
var menu1 = new Ext.menu.Menu({
id: 'basicMenu',
items: [{
text: '用证统计',
handler: clickHandler
}, {
text: '申证',
handler: clickHandler_SZ
}, {
text: '采样批',
handler: clickHandler_CYP
}, {
text: '进口食品销售记录',
handler: clickHandler_SPXSJL
}, {
text: '进口肉类销售记录',
handler: clickHandler_RLXSJL
}, {
text: '食品进口记录',
handler: clickHandler_SPJKJL
}, {
text: '商检系统录入表格',
handler: clickHandler_SJXTLR
}
]
});
function clickHandler() {
panelTest.Print();
};
function clickHandler_SZ() {
panelTest.Print_SZ();
};
function clickHandler_CYP() {
panelTest.Print_CYP();
};
function clickHandler_SPXSJL() {
panelTest.Print_SPXSJL();
};
function clickHandler_RLXSJL() {
panelTest.Print_RLXSJL();
};
function clickHandler_SPJKJL() {
panelTest.Print_SPJKJL();
};
function clickHandler_SJXTLR() {
panelTest.Print_SJXTLR();
};
_this = this;
this.CBMSearch = new Ext.form.Checkbox({
fieldLabel: '是否全部排序',
listeners: {
change: function (newValue, oldValue, eOpts)//change事件
{
//alert(newValue.checked);
if (newValue.checked) {
_this.storeList.remoteSort = true;
} else {
_this.storeList.remoteSort = false;
}
}
}
});
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
/* {
text: "新建",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin("/Import/XXH/Edit");
},
scope: this
},
{
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
},
'-',*/
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: "重置条件",
iconCls: "btnreset",
handler: function (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);
var tempcolumns = this.gridList.columns;
DsTruck.SaveGridPanel(GID, this.formname, tempcolumns, this.column, 1, true);
},
scope: this
}, '-',
{ text: "打印报表", menu: menu1, scope: this },
'-', this.CBMSearch
]
});
//#endregion
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 180,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
//_this.onRefreshClick();
}, //end initUIComponents
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
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
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = ' isnull(M.ISDELETE,0)=0 ';//去掉条件限制进口业务也可以配证by zxb 2018.0917
/*
var ContractNo = form.findField('ContractNo').getValue();
sql = sql + getAndConSql(sql, ContractNo, "M.ContractNo like '%" + ContractNo + "%'");
*/
var HTH = form.findField('HTH').getValue();
sql = sql + getAndConSql(sql, HTH, "(M.HTH like '%" + HTH + "%' or M.contractno like '%" + HTH + "%' or M.ContainerNo like '%" + HTH + "%')");
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 port = form.findField('port').getValue();
sql = sql + getAndConSql(sql, port, "m.port = " + port + "");
/*
var Cargoinfo_id = form.findField('Cargoinfo_id').getValue();
//alert(Cargoinfo_id);
sql = sql + getAndConSql(sql, Cargoinfo_id, "cg.Cargoinfo_id = " + Cargoinfo_id + "");
var Cargociq_id = form.findField('Cargociq_id').getValue();
//alert(Cargociq_id);
sql = sql + getAndConSql(sql, Cargociq_id, "cg.Cargociq_id = " + Cargociq_id + "");
*/
var Mainstate = form.findField('Mainstate').getValue();
sql = sql + getAndConSql(sql, Mainstate, "m.Mainstate = " + Mainstate + "");
var seller = form.findField('seller').getRawValue();
sql = sql + getAndConSql(sql, seller, "M.seller like '%" + seller + "%'");
var buyer = form.findField('buyer').getRawValue();
sql = sql + getAndConSql(sql, buyer, "M.buyer like '%" + buyer + "%'");
var Printed = form.findField("Printed").getValue();
if (Printed)
{ sql = sql + getAndConSql(sql, Printed, " m.Printed = 0 "); }
var ExsailingDate_min = form.findField('ExsailingDate_min').getRawValue();
sql = sql + getAndConSql(sql, ExsailingDate_min, "m.Ex_sailingdate >= '" + ExsailingDate_min + "'");
var ExsailingDate_max = form.findField('ExsailingDate_max').getRawValue();
sql = sql + getAndConSql(sql, ExsailingDate_max, "m.Ex_sailingdate <= '" + ExsailingDate_max + " 23:59:59'");
var Creattime_min = form.findField('Creattime_min').getRawValue();
sql = sql + getAndConSql(sql, Creattime_min, "m.Creattime >= '" + Creattime_min + "'");
var Creattime_max = form.findField('Creattime_max').getRawValue();
sql = sql + getAndConSql(sql, Creattime_max, "m.Creattime <= '" + Creattime_max + " 23:59:59'");
var Audittime_min = form.findField('Audittime_min').getRawValue();
sql = sql + getAndConSql(sql, Audittime_min, "m.Audittime >= '" + Audittime_min + "'");
var Audittime_max = form.findField('Audittime_max').getRawValue();
sql = sql + getAndConSql(sql, Audittime_max, "m.Audittime <= '" + Audittime_max + " 23:59:59'");
var remark = form.findField('remark').getValue();
sql = sql + getAndConSql(sql, remark, "(m.remark like '%" + remark + "%' or ap.remark like '%" + remark + "%')");
var CargoName = form.findField('CargoName').getValue();
sql = sql + getAndConSql(sql, CargoName, "m.contractno in(select contractno from import_cargo where name like '%" + CargoName + "%')");
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'");
if (this.remind != "") {
sql = sql + getAndConSql(sql, this.remind, this.remind);
}
var cancellation_date_min = form.findField('cancellation_date_min').getRawValue();
sql = sql + getAndConSql(sql, cancellation_date_min, " ast.cancellation_date >= '" + cancellation_date_min + "'");
var cancellation_date_max = form.findField('cancellation_date_max').getRawValue();
sql = sql + getAndConSql(sql, cancellation_date_max, " ast.cancellation_date <= '" + cancellation_date_max + " 23:59:59'");
return sql;
/* select st.[weight],case [cancellation_date] when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar, [cancellation_date],23) end as cancellation_date, ");
strSql.Append(" (select EnumValueName from tSysEnumValue ");
strSql.Append(" where LangId=0 and EnumTypeID=13 and EnumValueID=st.cancellation) as cancellationRef, ");
strSql.Append(" c.contractno,m.hth,m.seller,m.buyer,convert(varchar,dbo.trimdate(m.ArrivalDate),23) ArrivalDate, ");
strSql.Append(" ci.code,ci.name,ciq.ciqcode,ciq.ciqname,c.name cargoname, ");
strSql.Append(" (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=3 and EnumValueID=M.MainState) as MainStateRef ");
strSql.Append(" from import_appstate st ");
strSql.Append(" left join import_cargo c on c.id=st.cargo_id ");
strSql.Append(" left join Import_main m on m.contractno=c.contractno ");
strSql.Append(" left join import_cargoinfo ci on ci.id = c.cargoinfo_id ");
strSql.Append(" left join import_cargociq ciq on ciq.id = c.cargociq_id ");
*/
},
onGetremind: function (field, newValue, oldValue) {
if (newValue != null) {/*
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: newValue },
waitMsg: "正在查询数据...",
scope: this
});*/
this.remind = newValue;
}
},
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());
,
Print: function () {
//alert("print");
var printType = 'XXH_app_use1'; //用证统计
var T = this.getCondition();
var form = this.formSearch.getForm();
var ArrivalDate_min = form.findField('ArrivalDate_min').getRawValue();
var ArrivalDate_max = form.findField('ArrivalDate_max').getRawValue();
if (T != "") { T = " where (M.hth not like '%代入库%' and M.hth not like '%货转%') and " + T; }
else { T = " where (M.hth not like '%代入库%' and M.hth not like '%货转%') "; }
var sql1 = " select portref,contime,buyer,name,count(*) concount into #T1 from ";
sql1 = sql1 + " ( select (select EnumValueName from tSysEnumValue where LangId=0 ";
sql1 = sql1 + " and EnumTypeID=10 and EnumValueID=M.port) as portRef, ";
sql1 = sql1 + " substring( dbo.trimdate(m.creattime),6,2 )+'.'+substring( dbo.trimdate(m.creattime),9,2 ) contime, ";
sql1 = sql1 + " m.buyer,substring(cc.country,0,(charindex('(',cc.country)) )+':'+c.name name";
sql1 = sql1 + " from (Select distinct Contractno,name=dbo.F_Str(Contractno) from import_cargo) c";
sql1 = sql1 + " left join import_main m on c.contractno=m.contractno ";
sql1 = sql1 + " left join code_country cc on cc.countryid=m.countryid ";
sql1 = sql1 + T + " )tt";
sql1 = sql1 + " group by portref,contime,buyer,name ";
sql1 = sql1 + " select max(portref)+'_柜数' portref,sum(concount) concount into #T2 ";
sql1 = sql1 + " from #T1 group by portref order by portref ";
sql1 = sql1 + " insert into #T2 (portref,concount) select '总计_柜数:' portref,sum(concount) concount from #T1";
sql1 = sql1 + " select portref,contime,buyer,name,concount from ";
sql1 = sql1 + " ( select portref,contime,buyer,name,concount from #T1 ";
sql1 = sql1 + " union all select portref,'','','合计:',concount from #T2 ";
sql1 = sql1 + " ) a order by portref ";
sql1 = sql1 + " drop table #T1";
sql1 = sql1 + " drop table #T2 ";
//alert(sql1);
var sql2 = " select portref,contime,buyer,name,count(*) concount into #T1 from ";
sql2 = sql2 + " ( select (select EnumValueName from tSysEnumValue where LangId=0 ";
sql2 = sql2 + " and EnumTypeID=10 and EnumValueID=M.port) as portRef, ";
sql2 = sql2 + " substring( dbo.trimdate(m.creattime),6,2 )+'.'+substring( dbo.trimdate(m.creattime),9,2 ) contime, ";
sql2 = sql2 + " m.buyer,substring(cc.country,0,(charindex('(',cc.country)) )+':'+c.name name";
sql2 = sql2 + " from (Select distinct Contractno,name=dbo.F_Str(Contractno) from import_cargo) c";
sql2 = sql2 + " left join import_main m on c.contractno=m.contractno ";
sql2 = sql2 + " left join code_country cc on cc.countryid=m.countryid ";
sql2 = sql2 + T + " )tt";
sql2 = sql2 + " group by portref,contime,buyer,name ";
sql2 = sql2 + " select max(buyer)+'_柜数' buyer,sum(concount) concount into #T2 ";
sql2 = sql2 + " from #T1 group by buyer order by buyer ";
sql2 = sql2 + " insert into #T2 (buyer,concount) select '总计_柜数:' buyer,sum(concount) concount from #T1 ";
sql2 = sql2 + " select buyer,portref,contime,name,concount from ";
sql2 = sql2 + " ( select buyer,portref,contime,name,concount from #T1 ";
sql2 = sql2 + " union all select buyer,'','','合计:',concount from #T2 ";
sql2 = sql2 + " ) a order by buyer ";
sql2 = sql2 + " drop table #T1";
sql2 = sql2 + " drop table #T2 ";
var sql3 = " select portref,buyer,count(*) concount into #T1 from ";
sql3 = sql3 + " ( select (select EnumValueName from tSysEnumValue where LangId=0 ";
sql3 = sql3 + " and EnumTypeID=10 and EnumValueID=M.port) as portRef, ";
sql3 = sql3 + " substring( dbo.trimdate(m.creattime),6,2 )+'.'+substring( dbo.trimdate(m.creattime),9,2 ) contime, ";
sql3 = sql3 + " m.buyer,substring(cc.country,0,(charindex('(',cc.country)) )+':'+c.name name ";
sql3 = sql3 + " from (Select distinct Contractno,name=dbo.F_Str(Contractno) from import_cargo) c ";
sql3 = sql3 + " left join import_main m on c.contractno=m.contractno ";
sql3 = sql3 + " left join code_country cc on cc.countryid=m.countryid ";
sql3 = sql3 + T + " )tt";
sql3 = sql3 + " group by portref,buyer ";
sql3 = sql3 + " select max(buyer)+'_柜数' buyer,sum(concount) concount into #T2 ";
sql3 = sql3 + " from #T1 group by buyer order by buyer ";
sql3 = sql3 + " insert into #T2 (buyer,concount) select '总计_柜数:' buyer,sum(concount) concount from #T1 ";
sql3 = sql3 + " select buyer,portref,concount from ";
sql3 = sql3 + " ( select buyer,portref,concount from #T1 ";
sql3 = sql3 + " union all select buyer,'____合计:',concount from #T2 ";
sql3 = sql3 + " ) a order by buyer ";
sql3 = sql3 + " drop table #T1 ";
sql3 = sql3 + " drop table #T2 ";
var sql4 = "select " + ArrivalDate_min + " 'ArrivalDate_min'," + ArrivalDate_max + " 'ArrivalDate_max'";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_SZ: 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 = 'ShenZheng'; //申证
var sql1 = " select HTH,substring(cc.country,0,(charindex('(',cc.country)) ) country,c.name,c.[weight], ";
sql1 = sql1 + " c.price,c.amount,";
sql1 = sql1 + " case [Sailingdate] when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar, [Sailingdate],23) end as Sailingdate , ";
sql1 = sql1 + " case [ArrivalDate] when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar , [ArrivalDate],23) end as ArrivalDate , ";
sql1 = sql1 + " ci.code, comp.name as companyname,";
sql1 = sql1 + " (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) as portRef ";
sql1 = sql1 + " from import_main m ";
sql1 = sql1 + " left join company comp on comp.gid=M.company ";
sql1 = sql1 + " left join import_cargo c on c.contractno=m.contractno ";
sql1 = sql1 + " left join import_cargoinfo ci on ci.id=c.cargoinfo_id ";
sql1 = sql1 + " left join code_country cc on cc.countryid=m.countryid ";
sql1 = sql1 + " left join import_appstate ast on ast.cargo_id=c.id ";
sql1 = sql1 + " left join import_approval ap on ap.id=ast.app_id ";
var sql1 = sql1 + " where m.contractno in(" + MainList + ")";
//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_CYP: 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 = 'CYP'; //采样批
var sql1 = " select dbo.trimdate(m.inspection_Signup_date) inspection_Signup_date,m.inspection_no,c.boxcount,c.weight, substring(cc.country,0,(charindex('(',cc.country)) ) country, ";
sql1 = sql1 + " m.seller,c.FactoryNo,c.Productiondate,m.containerno,dbo.trimdate(m.CustomsReleaseDate) CustomsReleaseDate, ";
sql1 = sql1 + " dbo.trimdate(m.DeliveryDate) DeliveryDate,m.Contacter,m.Tel,dbo.F_Str(m.contractno) name ,m.buyer,M.HTH,M.ciq_licence, ";
sql1 = sql1 + " (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=9 and EnumValueID=(select top 1 k2.kfstate from import_kc k2 order by czdate desc)) KF, ";
sql1 = sql1 + " (select top 1 k.czdate from import_kc k where k.contractno=m.contractno and czstate=1) In_k, ";
sql1 = sql1 + " (select top 1 k.czdate from import_kc k where k.contractno=m.contractno and czstate=3) out_k ";
sql1 = sql1 + " from import_main m ";
sql1 = sql1 + " left join import_cargo c on c.contractno=m.contractno ";
sql1 = sql1 + " left join code_country cc on cc.countryid=m.countryid ";
sql1 = sql1 + " left join import_appstate ast on ast.cargo_id=c.id ";
sql1 = sql1 + " left join import_approval ap on ap.id=ast.app_id ";
sql1 = sql1 + " where m.contractno in(" + MainList + ")";
//alert(sql1);
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_SPXSJL: 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 = 'XSJL'; //进口食品销售记录
var sql1 = " select m.ArrivalDate,c.name,c.boxcount,c.weight,c.Productiondate,M.HTH,C.boxweight, ";
sql1 = sql1 + " m.Contacter,m.tel,m.DeliveryAddress,comp.name as companyname , ";
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 ";
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)+'.'+ ";
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 ";
sql1 = sql1 + " from import_main m ";
sql1 = sql1 + " left join company comp on comp.gid=M.company ";
sql1 = sql1 + " left join import_cargo c on c.contractno=m.contractno ";
sql1 = sql1 + " left join import_appstate ast on ast.cargo_id=c.id ";
sql1 = sql1 + " left join import_approval ap on ap.id=ast.app_id ";
sql1 = sql1 + " where m.contractno in(" + MainList + ")";
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_RLXSJL: 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') + "'";
}
}
var printType = 'RLXSJL'; //肉类销售记录
var sql1 = " select dbo.trimdate(M.inspection_Signup_date) inspection_Signup_date,M.inspection_no,M.containerno,M.buyer,M.Contacter, ";
sql1 = sql1 + " (select sum(boxcount) from import_cargo c2 where c2.contractno=m.contractno) boxcount, ";
sql1 = sql1 + " (select sum(weight) from import_cargo c2 where c2.contractno=m.contractno) weight ";
sql1 = sql1 + " ,dbo.f_str(M.contractno) name,substring(cc.country,0,(charindex('(',cc.country)) ) country,m.seller,dbo.f_FactoryNo(M.contractno) FactoryNo, ";
sql1 = sql1 + " dbo.trimdate(M.CustomsReleaseDate) CustomsReleaseDate,dbo.f_Productiondate(M.contractno) Productiondate,M.ciq_licence,M.HTH,";
sql1 = sql1 + " (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) as portRef, ";
sql1 = sql1 + " dbo.trimdate(m.DeliveryDate) DeliveryDate,m.tel ,comp.name as companyname , ";
sql1 = sql1 + " (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=9 and EnumValueID=(select top 1 k2.kfstate from import_kc k2 order by czdate desc)) KF, ";
sql1 = sql1 + " (select top 1 k.czdate from import_kc k where k.contractno=m.contractno and czstate=1) In_k, ";
sql1 = sql1 + " (select top 1 k.czdate from import_kc k where k.contractno=m.contractno and czstate=3) out_k, ";
sql1 = sql1 + " (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) as portRef ";
sql1 = sql1 + " ,(select top 1 ik.kfstate from import_kc ik where ik.contractno=m.contractno and ik.kfstate <>'' and ik.kfstate is not null ) ";
sql1 = sql1 + " from import_main m ";
sql1 = sql1 + " left join company comp on comp.gid=M.company ";
sql1 = sql1 + " left join code_country cc on cc.countryid=m.countryid ";
sql1 = sql1 + " left join import_appstate ast on ast.contractno=m.contractno ";
sql1 = sql1 + " left join import_approval ap on ap.id=ast.app_id ";
if (MainList == "") {
sql1 = sql1 + " where " + this.getCondition() + "";
} else {
sql1 = sql1 + " where m.contractno in(" + MainList + ")";
}
sql1 = sql1 + " order by inspection_Signup_date";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_SPJKJL: function () {
var printType = 'SPJKJL'; //食品进口记录
var T = this.getCondition();
if (T != "") { T = " where isnull(m.ISDELETE,0)=0 and " + T; }
var sql1 = " select m.arrivaldate,c.name,c.exporter,c.boxweight,c.boxcount,c.[weight],c.Productiondate, ";
sql1 = sql1 + " substring(cc.country,0,(charindex('(',cc.country)) ) country, ";
sql1 = sql1 + " (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) as portRef, ";
sql1 = sql1 + " M.HTH,m.seller,m.hth,m.CIQ_licence,inspection_no, m.tel ";
sql1 = sql1 + " ,case when (select codename from code_currency where gid= c.currid)='USD' then c.amount else 0 end amount_USD ";
sql1 = sql1 + " ,case when (select codename from code_currency where gid= c.currid)='EUR' then c.amount else 0 end amount_EUR ";
sql1 = sql1 + " ,case when (select codename from code_currency where gid= c.currid)='RMB' then c.amount else 0 end amount_RMB ";
sql1 = sql1 + " ,case (select codename from code_currency where gid= c.currid) when 'USD' then 0 when 'EUR' then 0 when 'RMB' then 0 else c.amount end amount_OTHER ";
sql1 = sql1 + " from import_cargo c ";
sql1 = sql1 + " left join import_main m on c.contractno=m.contractno ";
sql1 = sql1 + " left join code_country cc on cc.countryid=m.countryid ";
sql1 = sql1 + " left join import_appstate ast on ast.cargo_id=c.id ";
sql1 = sql1 + " left join import_approval ap on ap.id=ast.app_id ";
sql1 = sql1 + T;
sql1 = sql1 + " order by m.arrivaldate ";
var form = this.formSearch.getForm();
var CargoName = form.findField('CargoName').getValue();
var T = this.getCondition();
if (T != "") { T = " where c.name like '%" + CargoName + "%' and " + T; }
else { T = " where c.name like '%" + CargoName + "%' "; }
var sql2 = " select m.arrivaldate,c.name,c.exporter,c.boxweight,c.boxcount,c.[weight],c.amount,c.Productiondate, ";
sql2 = sql2 + " substring(cc.country,0,(charindex('(',cc.country)) ) country, ";
sql2 = sql2 + " (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) as portRef, ";
sql2 = sql2 + " M.HTH,m.seller,m.hth,m.CIQ_licence,inspection_no, m.tel ";
sql2 = sql2 + " from import_cargo c ";
sql2 = sql2 + " left join import_main m on c.contractno=m.contractno ";
sql2 = sql2 + " left join code_country cc on cc.countryid=m.countryid ";
sql2 = sql2 + " left join import_appstate ast on ast.cargo_id=c.id ";
sql2 = sql2 + " left join import_approval ap on ap.id=ast.app_id ";
sql2 = sql2 + T;
sql2 = sql2 + " order by m.arrivaldate ";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_SJXTLR: function () {
//text: '商检系统录入表格',
//handler: clickHandler_SJXTLR
var MainList = "";
var _array = [];
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 tablename = "SJXTLR_"+NewGuid();
var sql1=" create table "+tablename+" (contractno [varchar](50) )"
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
sql1=
}*/
var printType = 'SJXTLR'; //商检系统录入表格
var sql1 = " select m.buyer [客户],m.hth [合同号],c.name [货物名称],substring(cc.country,0,(charindex('(',cc.country)) ) [进口国], ";
sql1 = sql1 + " dbo.trimdate(m.arrivaldate) [到港日],c.productiondate [生产日期],c.[weight] [重量],c.boxweight [规格],m.inspection_no [报检号]";
sql1 = sql1 + " ,c.amount [合同金额],contacter [联系人],tel [联系电话], ";
//sql1 = sql1 + " (select EnumValueID from tSysEnumValue where LangId=0 and EnumTypeID=26 and EnumValueName=c.exporter) as [备案号] ";
sql1 = sql1 + " (select Enfullname from info_client where shortname=c.exporter) as [出口商], ";
sql1 = sql1 + " (select REGISTRATIONNO from info_client where shortname=c.exporter) as [备案号] ";
sql1 = sql1 + " from import_main m ";
sql1 = sql1 + " left join code_country cc on cc.countryid=m.countryid ";
sql1 = sql1 + " left join import_cargo c on c.contractno=m.contractno ";
sql1 = sql1 + " left join import_appstate ast on ast.cargo_id=c.id ";
sql1 = sql1 + " left join import_approval ap on ap.id=ast.app_id ";
sql1 = sql1 + " where m.contractno in(" + MainList + ") order by m.arrivaldate,m.buyer,m.hth";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});