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/PortOperate/XXHIndex.js

5901 lines
246 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');
var C_contractno = ""; //用于存储当前选定的合同号/ch_fee.id
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,
PageSize1: 500,
PageSizeEdit: 500,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
remind: null,
sqlcontext: '',
initUIComponents: function () {
//定义数据集
this.sqlcontext = "";
this.winAccess = null;
_this = this;
this.storeList = Ext.create('Ext.data.Store', {
model: 'XXH_ALLmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
//type: 'jsonp',
type: 'ajax',
url: '/Import/XXH/GetDataList_ALL', //http://120.27.53.37:8089/
reader: {
//idProperty: 'id;cgid',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeEditList = Ext.create('Ext.data.Store', {
model: 'XXH_ALL_Editmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/Import/XXH/GetEditList_ALL',
reader: {
//idProperty: 'id;cgid',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeList_single = Ext.create('Ext.data.Store', {
model: 'XXH_ALL_singlemb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/Import/XXH/GetDataList_ALL_single',
reader: {
idProperty: 'HTH',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.formname = "PortOperate";
this.formname_single = "PortOperate_single";
this.formname_edit = "PortOperate_edit";
this.formname_single_edit = "PortOperate_single_edit";
//#region 枚举参照
//代理公司
this.storeAGENT = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeAGENT.load({ params: { condition: ""} });
this.comboxAGENT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '代理',
flex: 1,
//disabled: true,
forceSelection: true,
store: this.storeAGENT,
name: 'AGENT',
valueField: 'name',
displayField: 'codename'
});
//
this.storeMainstate = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeMainstate.load({ params: { enumTypeId: 3} });
this.comboxMainstate = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '合同状态',
autosize: true,
bodyPadding: 5,
flex: 1,
width: 500,
labelWidth: 90,
store: this.storeMainstate,
queryMode: 'local',
triggerOnClick: false,
valueField: 'EnumValueId',
displayField: 'EnumValueName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
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,
queryMode: 'local',
autosize: true,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeAuditor = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeAuditor.load({ params: { condition: ""} });
this.comboxAuditor = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '审单人',
forceSelection: true,
store: this.storeAuditor, flex: 1,
name: 'Auditor',
valueField: 'UserCode',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeReceiver = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeReceiver.load({ params: { condition: "" } });
this.comboxReceiver = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '接单人',
labelWidth: 110,
forceSelection: true,
store: this.storeReceiver, flex: 1,
name: 'Receiver',
valueField: 'UserCode',
displayField: 'CodeAndName',
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,
labelWidth: 60,
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',
//flex:3,
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: '业务提醒',
matchFieldWidth: false,
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
},
flex: 1
});
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,
flex:1,
queryMode: 'local',
autosize: true,
store: this.storeUser,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeFStatus = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeFStatus.load({ params: { enumTypeId: 16} });
this.comboxFStatus = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '融资状态',
forceSelection: true,
store: this.storeFStatus,
name: 'FinanceStatus',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storecurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'currRef',
proxy: { url: '/CommMng/BasicDataRef/GetcurrRefList' }
});
this.storecurr.load({ params: { condition: ""} });
//#endregion
this.column = [
{
sortable: true,
dataIndex: 'seller',
header: '贸易商',
width: 80, editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'buyer',
header: '购货方(客户)',
width: 80
}, {
sortable: true,
dataIndex: 'HTH',
header: '合同号',
width: 80
}, {
sortable: true,
dataIndex: 'HTDATE',
header: '合同日期',
width: 80
}, {
sortable: true,
dataIndex: 'country',
header: '进口国',
width: 80
}, {
sortable: true,
dataIndex: 'AuditorREF',
header: '审单人',
width: 80
}, {
sortable: true, //5
dataIndex: 'countryid',
header: 'countryid',
hidden: true,
width: 80
}, {
sortable: true,
dataIndex: 'portRef',
header: '目的港',
width: 80
}, {
sortable: true,
dataIndex: 'companyname',
header: '用证公司',
width: 80
}, {
sortable: true,
dataIndex: 'CORPNAME',
header: '当前货所属公司',
width: 100
}, {
xtype: 'numbercolumn',
sortable: true,
dataIndex: 'tax_amount_RMB',
header: '完税价格(RMB)',
format: '0.00',
width: 80
},{
sortable: true,
dataIndex: 'creattime',
header: '接单日期',
width: 80
}, {
sortable: true,
dataIndex: 'name',
header: '货物名称',
width: 80
}, {
sortable: true, //10
dataIndex: 'weight_t',
header: '净重(吨)',
width: 80
}, {
sortable: true, //10
dataIndex: 'weight',
header: '净重(kg)',
width: 80
}, {
sortable: true,
dataIndex: 'm_weight',
header: '毛重(吨)',
width: 80
}, {
sortable: true,
dataIndex: 'ciname',
header: '商品手册名称',
width: 80
}, {
sortable: true,
dataIndex: 'AppNo',
header: '许可证号',
width: 80
}, {
sortable: true,
dataIndex: 'ValidDate',
header: '许可证有效期',
width: 80
}, {
sortable: true,
dataIndex: 'STT',
header: '双抬头',
width: 80
}, {
sortable: true, //15
dataIndex: 'printedRef',
header: '发票打印完成',
width: 80
}, {
sortable: true,
dataIndex: 'AutoAPPRef',
header: '自动证',
width: 80
}, {
sortable: true,
dataIndex: 'WriteoffsRef',
header: '核销完成',
width: 80
}, {
sortable: true, hidden: true,
dataIndex: 'Mainstate',
header: 'Mainstate',
width: 80
}, {
sortable: true,
dataIndex: 'MainstateRef',
header: '合同状态',
width: 80
}, {
sortable: true,
dataIndex: 'InventoryStateRef',
header: '库存状态',
width: 80
//,
//renderer: function (value) {
// if (value == 0) {
// return "过车";
// } else if (value == 1) {
// return "直送";
// } else if (value == 2) {
// return "入库";
// } else if (value == 3) {
// return "部分过车";
// }
//}
}, {
sortable: true,
dataIndex: 'Ex_sailingdate',
header: '预计开船日',
width: 80
}, {
sortable: true, //20
dataIndex: 'Sailingdate',
header: '开船日',
width: 80
}, {
sortable: true,
dataIndex: 'ArrivalDate',
header: '到港日',
width: 80
}, {
sortable: true,
dataIndex: 'ReceiptStatusRef',
header: '单据是否完备',
width: 80
}, {
sortable: true,
dataIndex: 'Receiptremark',
header: '寄单情况',
width: 280
}, {
sortable: true,
dataIndex: 'tax_date',
header: '出税日期',
width: 80
}, {
sortable: true, //25
dataIndex: 'tax_paydate',
header: '付税日期',
width: 80
}, {
sortable: true, dataIndex: 'id', header: 'id', hidden: true
},
{
dataIndex: 'TimeMark', header: 'TimeMark', hidden: true
},
{
sortable: true,
dataIndex: 'cgid',
header: 'cgid',
hidden: true,
width: 80
}, {
sortable: true,
dataIndex: 'BillNo',
header: '提单号',
width: 80
}, {
sortable: true, //30
dataIndex: 'E_Billtime',
header: '电放时间',
width: 80
}, {
sortable: true,
dataIndex: 'BillTime',
header: '正本时间',
width: 80
}, {
sortable: true,
dataIndex: 'HDtime',
header: '换单时间',
width: 80
}, {
sortable: true,
dataIndex: 'ContainerNo',
header: '箱号',
width: 80
}, {
sortable: true,
dataIndex: 'SealNo',
header: '铅封号',
width: 80
}, {
sortable: true, //35
dataIndex: 'ShipCompanyRef',
header: '船公司',
width: 80
}, {
sortable: true,
dataIndex: 'Vessel',
header: '船名',
width: 80
}, {
sortable: true,
dataIndex: 'Voyage',
header: '航次',
width: 80
}, {
sortable: true,
dataIndex: 'CIQ_licence',
header: '卫生证号',
width: 80
}, {
sortable: true,
dataIndex: 'CIQ_canbesearchRef',
header: '卫生证是否可查',
width: 80
}, {
sortable: true, //40
dataIndex: 'inspection_Signup_date',
header: '报检日期',
width: 80
}, {
sortable: true,
dataIndex: 'inspection_no',
header: '报检号',
width: 80
}, {
sortable: true,
dataIndex: 'InspectionReleaseDate',
header: '商检放行日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 80
}, {
sortable: true,
dataIndex: 'SamplingDate_Plan',
header: '海关确定抽检',
width: 80
}, {
sortable: true,
dataIndex: 'SamplingDate_Act',
header: '海关实际验货',
width: 80
}, {
sortable: true,
dataIndex: 'CustomsReleaseDate',
header: '海关放行日期',
width: 80
}, {
sortable: true, //45
dataIndex: 'DeclareNumber',
header: '报关单号',
width: 80
}, {
sortable: true,
dataIndex: 'ContractNo',
header: '合同序列号',
width: 120
}, {
sortable: true,
dataIndex: 'Paydate',
header: '付货款时间(尾款)',
width: 80
}, {
sortable: true,
dataIndex: 'Prepaydate',
header: '付货款时间(预付)',
width: 80
}, {
sortable: true,
dataIndex: 'TRADINGAGENCY',
header: '订货方(中间商)',
width: 80
}, {
sortable: true,
dataIndex: 'FactoryNo',
header: '厂号',
width: 80
}, {
sortable: true,
dataIndex: 'Audittime',
header: '审单时间',
width: 80
}, {
sortable: true,
dataIndex: 'price',
header: '单价',
width: 80
}, {
sortable: true,
dataIndex: 'amount',
header: '合同金额(对客户)',
width: 80,
summaryType: 'sum'
}, {
sortable: true,
dataIndex: 'TransactionMethodRef',
header: '成交方式',
width: 80
}, {
sortable: true,
dataIndex: 'PaymentMethodsRef',
header: '付款方式',
width: 80
}, {
sortable: true,
dataIndex: 'RCVModeREF',
header: '收单据模式',
width: 140
}, {
sortable: true,
dataIndex: 'BilltypeREF',
header: '提单交付方式',
width: 100
}, {
sortable: true,
dataIndex: 'OP',
header: '操作人',
width: 80
}, {
sortable: true,
dataIndex: 'Inspection_StorageREF',
header: '是否商检慢检',
width: 80
}, {
sortable: true,
dataIndex: 'inspection_date',
header: '商检验货日',
width: 100
}, {
sortable: true,
dataIndex: 'Sampling_needREF',
header: '海关是否抽检',
width: 100
}, {
sortable: true,
dataIndex: 'ZMQ',
header: '自贸区',
width: 100
}, {
sortable: true,
dataIndex: 'RecDate',
header: '回空日期',
width: 80
}, {
sortable: true,
dataIndex: 'PortDays',
header: '港口天数',
width: 80
}, {
sortable: true,
dataIndex: 'DeliveryDate',
header: '送货时间',
width: 80
}, {
sortable: true,
dataIndex: 'DeliveryAddress',
header: '送货地址',
width: 80
}, {
sortable: true,
dataIndex: 'BUZTYPEREF',
header: '业务类型',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'remark_2',
header: '备注2',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'remark_3',
header: '备注3',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'remark_4',
header: '备注4',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Overfilled',
header: '溢短装',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'FinanceStatusREF',
header: '融资状态',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'remark',
header: '备注1',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'price_agio',
header: '差价',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'price_limit',
header: '限价',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'boxcount',
header: '箱/件数',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'IsRongZi',
align: 'right',
header: '融资金额/收回金额',
width: 160,
renderer: function (value, meta) {
state = DsTruck.RONGZIState(value);
showclass = DsTruck.RONGZIGetRowClass(value);
meta.tdCls = showclass;
if (state == 1) {
return "";
} else {
return value;
}
}
}, {
sortable: true, id: '',
dataIndex: 'Freetime',
header: '免箱期',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'productiondate',
header: '生产日期',
width: 120
}, {
sortable: true, id: '',
dataIndex: 'SBYS',
header: '申报要素',
width: 120
}, {
sortable: true, id: '',
dataIndex: 'CHECKSAMPLE',
header: '样本清单已审核',
width: 90
}, {
sortable: true, id: '',
dataIndex: 'BILLTRANCNO',
header: '国外寄单快递号',
width: 120
}, {
sortable: true, id: '',
dataIndex: 'BILL_RECEIVE_DATE',
header: '单据收到时间',
width: 120
}, {
sortable: true, id: '',
dataIndex: 'BILL_SEND_DATE',
header: '单据发出时间(给客户)',
width: 120
}, {
sortable: true,
dataIndex: 'LOCK_EXCHANGERATE',
header: '是否锁汇',
width: 60,
renderer: function (value) {
if (value == "0") {
return "<a><font color='#FF0000'></font></a>";
} else if (value == "1") {
return "<a><font color='#FF0000'>锁汇</font></a>";
}
}
}, {
sortable: true,
dataIndex: 'EXCHANGERATE',
header: '锁汇汇率',
width: 60
}, {
sortable: true,
dataIndex: 'Unsealdate',
header: '慢检启封/整改放行日',
width: 80
}, {
sortable: true,
dataIndex: 'ISREFORM',
header: '是否整改',
width: 80,
renderer: function (value) {
if (value == "0") {
return "<a><font color='#0000FF'>否</font></a>";
} else if (value == "1") {
return "<a><font color='#FF0000'>是</font></a>";
}
}
}, {
sortable: true,
dataIndex: 'InspectionNo',
header: '出口商商检备案号',
width: 80
}, {
sortable: true, hidden: true,
dataIndex: 'TRADECOUNTRY',
header: 'TRADECOUNTRY',
width: 80
},
{
sortable: true,
dataIndex: 'TRADECOUNTRY_REF',
header: '贸易国',
width: 80
},
{
sortable: true,
dataIndex: 'CIQDATE',
header: '卫生证日期',
width: 80
},
{
sortable: true,
dataIndex: 'VSIGN',
header: '兽医官签名',
width: 80
},
{
sortable: true,
dataIndex: 'ClearanceNo',
header: '通关单号',
width: 80
}
//后加
,
{
sortable: true,
dataIndex: 'IsAppNo',
header: '是否配证',
width: 80,
renderer: function (value, p, record) {
if (record.data.AppNo != "")
return "是";
else
return "否";
}
},
{
sortable: true,
dataIndex: 'RECEIVE_MAN',
header: '接单人',
width: 80
},
{
sortable: true,
dataIndex: 'prepayments',
header: '预付款金额(应收)',
width: 100
},
{
sortable: true,
dataIndex: 'balance',
header: '尾款金额(应收)',
width: 100
},
{
sortable: true,
dataIndex: 'pay_prepayments',
header: '预付款金额(应付)',
width: 100
},
{
sortable: true,
dataIndex: 'pay_balance',
header: '尾款金额(应付)',
width: 100
}
//天津誉恒
,
{
sortable: true,
dataIndex: 'Supplier_Billno',
header: '供应商合同号',
width: 80
},
{
sortable: true,
dataIndex: 'ResendTime',
header: '分公司转单日期',
width: 80
},
{
sortable: true,
dataIndex: 'ShipAgent',
header: '船代',
width: 80
},
{
sortable: true,
dataIndex: 'BillReleaseDate',
header: '放单时间',
width: 80
},
{
sortable: true,
dataIndex: 'IsLBill',
header: '是否换小单',
width: 80
},
{
sortable: true,
dataIndex: 'LBillShipAgent',
header: '小单船代',
width: 80
},
{
sortable: true,
dataIndex: 'IsInnerLine',
header: '是否内至线',
width: 80
},
{
sortable: true,
dataIndex: 'InnerLinePort',
header: '内至线启运港',
width: 80
},
{
sortable: true,
dataIndex: 'YARD',
header: '押箱堆场',
width: 80
},
{
sortable: true,
dataIndex: 'PriceLimitDate',
header: '询回价格日期',
width: 80
},
{
sortable: true,
dataIndex: 'PriceLimitRemark',
header: '询回价格',
width: 80
},
{
sortable: true,
dataIndex: 'ClearanceDate',
header: '出通关单时间',
width: 80
},
{
sortable: true,
dataIndex: 'TaxRecvDate',
header: '税金收回日期',
width: 80
},
{
sortable: true,
dataIndex: 'GetBoxDate',
header: '车队提箱日期',
width: 80
},
{
sortable: true,
dataIndex: 'IsRec',
header: '车队未当日回空',
width: 80
},
{
sortable: true,
dataIndex: 'ResendTime2',
header: '转检时间',
width: 80
},{
sortable: true,
dataIndex: 'preArrivalDate',
header: '预计到港日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 80
}, {
dataIndex: 'TAGPICURL',
header: '标签图片',
width: 60,
renderer: function (value, p, record) {
if (value == '' || typeof (value) == "undefined") {
//return '<input type="button" value="上传" onClick="javascript:this.UpLoadFile('+record.data.BillNo+')"';
return '';
} else
return '<a href="' + value + '" style=' + '"text-decoration:none" target="_blank"' + ' > 下载图片 </a>';
}
}, {
xtype: 'actioncolumn',
width: 50,
text: "图片预览",
items: [{
icon: '/images/icons/btnSearch.gif', // Use a URL in the icon config
tooltip: '图片预览',
handler: function (grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
var filePath = rec.get('TAGPICURL');
if (filePath == "" || filePath == null) return;
if (/.(gif|jpg|jpeg|png|ico)$/.test(filePath)) {
ImgWindow(filePath);
} else if (/.(pdf|txt)$/.test(filePath)) {
ImgWindow(filePath, "_blank");
} else {
var a = document.createElement("a");
// 利用URL.createObjectURL()方法为a元素生成blob URL
a.href = filePath;
a.target = "_blank";
// 设置文件名目前只有Chrome和FireFox支持此属性
try {
a.download = filePath;
} catch (e) {
alert("浏览器不兼容!");
} finally {
a.click();
}
}
}
}]
}
]; //
this.column_single = [].concat(this.column);
//#region 枚举参照
this.storePrinted = Ext.create('DsExt.ux.RefEnumStore', {});
this.storePrinted.load({ params: { enumTypeId: 0} });
this.comboxPrinted = Ext.create('DsExt.ux.RefEnumCombox', {
//fieldLabel: '是否打印',
//forceSelection: true,
store: this.storePrinted,
name: 'Printed',
valueField: 'EnumValueId',
displayField: 'EnumValueName'
});
this.storeAutoAPP = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeAutoAPP.load({ params: { enumTypeId: 0} });
this.comboxAutoAPP = Ext.create('DsExt.ux.RefEnumCombox', {
//fieldLabel: '自动证',
forceSelection: true,
store: this.storeAutoAPP,
name: 'AutoAPP'
});
this.storeCIQ_canbesearch = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeCIQ_canbesearch.load({ params: { enumTypeId: 0} });
this.comboxCIQ_canbesearch = Ext.create('DsExt.ux.RefEnumCombox', {
//fieldLabel: '卫生证是否可查',
forceSelection: true,
store: this.storeCIQ_canbesearch,
name: 'CIQ_canbesearch'
});
this.storeInspection_Storage = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeInspection_Storage.load({ params: { enumTypeId: 0} });
this.comboxInspection_Storage = Ext.create('DsExt.ux.RefEnumCombox', {
//fieldLabel: '是否采样入库',
forceSelection: true,
store: this.storeInspection_Storage,
name: 'Inspection_Storage'
});
this.storeBillType = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeBillType.load({ params: { enumTypeId: 6} });
this.comboxBillType = Ext.create('DsExt.ux.RefEnumCombox', {
//fieldLabel: '提单提交方式',
forceSelection: true,
store: this.storeBillType,
name: 'BillType'//, flex: 1
});
this.storeInspection_Buyer = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeInspection_Buyer.load({ params: { condition: ""} });
this.comboxInspection_Buyer = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '商检收货单位',
flex: 2,
forceSelection: true,
store: this.storeInspection_Buyer,
name: 'Inspection_Buyer',
valueField: 'name',
displayField: 'codename'
});
//#endregion
this.column_edit = [
{
sortable: true,
dataIndex: 'seller',
header: '贸易商',
width: 80
}, {
sortable: true,
dataIndex: 'buyer',
header: '购货方',
width: 80
}, {
sortable: true,
dataIndex: 'HTH',
header: '合同号',
width: 80
}, {
sortable: true,
dataIndex: 'HTDATE',
header: '合同日期',
width: 80
}, {
sortable: true,
dataIndex: 'AuditorREF',
header: '审单人',
width: 80
}, {
sortable: true,
dataIndex: 'country',
header: '进口国',
width: 80
}, {
sortable: true, //5
dataIndex: 'countryid',
header: 'countryid',
hidden: true,
width: 80
}, {
sortable: true,
dataIndex: 'portRef',
header: '目的港',
width: 80
}, {
sortable: true,
dataIndex: 'companyname',
header: '用证公司',
width: 80
}, {
sortable: true,
dataIndex: 'CORPNAME',
header: '当前货所属公司',
width: 100
}, {
xtype: 'numbercolumn',
sortable: true,
dataIndex: 'tax_amount_RMB',
header: '完税价格(RMB)',
format: '0.00',
width: 80
}, {
sortable: true,
dataIndex: 'creattime',
header: '接单日期',
width: 80
}, {
sortable: true,
dataIndex: 'name',
header: '货物名称',
width: 80
}, {
sortable: true, //10
dataIndex: 'weight_t',
header: '净重(吨)',
width: 80
}, {
sortable: true, //10
dataIndex: 'weight',
header: '净重(kg)',
width: 80
},{
sortable: true, //10
dataIndex: 'm_weight',
header: '毛重(吨)',
width: 80
},{
sortable: true,
dataIndex: 'ciname',
header: '商品手册名称',
width: 80
}, {
sortable: true,
dataIndex: 'AppNo',
header: '许可证号',
width: 80
}, {
sortable: true,
dataIndex: 'ValidDate',
header: '许可证有效期',
width: 80
}, {
sortable: true,
dataIndex: 'STT',
header: '双抬头',
width: 120,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true, //15
dataIndex: 'printedRef', hidden: true,
header: '发票打印完成',
//editor: this.comboxPrinted,
width: 80
}, {
dataIndex: 'Printed',
header: '发票打印完成',
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.printedRef;
},
editor: this.comboxPrinted,
width: 60
}, {
sortable: true,
dataIndex: 'AutoAPP',
header: '自动证',
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.AutoAPPRef;
},
editor: this.comboxPrinted,
width: 60
}, {
sortable: true,
dataIndex: 'WriteoffsRef',
header: '核销完成',
width: 80
}, {
sortable: true,
dataIndex: 'MainstateRef',
header: '合同状态',
width: 80
}, {
sortable: true,
dataIndex: 'Ex_sailingdate',
header: '预计开船日',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'Sailingdate',
header: '开船日',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'ArrivalDate',
header: '到港日',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'ReceiptStatusRef',
header: '单据是否完备',
width: 80
}, {
dataIndex: 'Receiptremark',
header: '寄单情况',
width: 280,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'tax_date',
header: '出税日期',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'tax_paydate',
header: '付税日期',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
sortable: true, dataIndex: 'id', header: 'id', hidden: true
},
{
dataIndex: 'TimeMark', header: 'TimeMark', hidden: true
},
{
sortable: true,
dataIndex: 'cgid',
header: 'cgid',
hidden: true,
width: 80
}, {
sortable: true,
dataIndex: 'BillNo',
header: '提单号',
width: 80
}, {
sortable: true, //30
dataIndex: 'E_Billtime',
header: '电放时间',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'BillTime',
header: '正本时间',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'HDtime',
header: '换单时间',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'ContainerNo',
header: '箱号',
width: 80
}, {
sortable: true,
dataIndex: 'SealNo',
header: '铅封号',
width: 80
}, {
sortable: true, //35
dataIndex: 'ShipCompanyRef',
header: '船公司',
width: 80
}, {
sortable: true,
dataIndex: 'Vessel',
header: '船名',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'Voyage',
header: '航次',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'CIQ_licence',
header: '卫生证号',
width: 80
}, {
sortable: true,
dataIndex: 'CIQ_canbesearch',
header: '卫生证是否可查',
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.CIQ_canbesearchRef;
},
editor: this.comboxCIQ_canbesearch,
width: 60
}, {
sortable: true,
dataIndex: 'inspection_Signup_date',
header: '报检日期',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
dataIndex: 'inspection_no',
header: '报检号',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'InspectionReleaseDate',
header: '商检放行日期',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
xtype: 'datefield',
format: 'Y-m-d',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'SamplingDate_Plan',
header: '海关确定抽检',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'SamplingDate_Act',
header: '海关实际验货',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'CustomsReleaseDate',
header: '海关放行日期',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
dataIndex: 'DeclareNumber', //45
header: '报关单号',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'ContractNo',
header: '合同序列号',
width: 120
}, {
sortable: true,
dataIndex: 'Paydate',
header: '付货款时间(尾款)',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'Prepaydate',
header: '付货款时间(预付)',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
,
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'TRADINGAGENCY',
header: '订货方(中间商)',
width: 80
}, {
sortable: true,
dataIndex: 'FactoryNo',
header: '厂号',
width: 80
}, {
sortable: true,
dataIndex: 'Audittime',
header: '审单时间',
width: 80
}, {
sortable: true,
dataIndex: 'price',
header: '单价',
width: 80
}, {
sortable: true,
dataIndex: 'amount',
header: '合同金额(对客户)',
width: 80
}, {
sortable: true,
dataIndex: 'TransactionMethodRef',
header: '成交方式',
width: 80
}, {
sortable: true,
dataIndex: 'PaymentMethodsRef',
header: '付款方式',
width: 80
}, {
sortable: true,
dataIndex: 'RCVModeREF',
header: '收单据模式',
width: 140
}, {
dataIndex: 'BillType',
header: '提单交付方式',
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.BilltypeREF;
},
editor: this.comboxBillType,
width: 80
}, {
sortable: true,
dataIndex: 'OP',
header: '操作人',
width: 80
}, {
sortable: true,
dataIndex: 'preArrivalDate',
header: '预计到港日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 80,
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
dataIndex: 'Inspection_Storage',
header: '是否商检慢检',
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.Inspection_StorageREF;
},
editor: this.comboxInspection_Storage,
width: 60
}, {
sortable: true,
dataIndex: 'inspection_date',
header: '商检验货日',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'Sampling_needREF',
header: '海关是否抽检',
width: 100
}, {
sortable: true,
dataIndex: 'ZMQ',
header: '自贸区',
width: 100
}, {
sortable: true,
dataIndex: 'RecDate',
header: '回空日期',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
dataIndex: 'PortDays',
header: '港口天数',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'DeliveryDate',
header: '送货时间',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
dataIndex: 'DeliveryAddress',
header: '送货地址',
width: 120,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'Contacter',
header: '送货联系人',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'Tel',
header: '送货电话',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'BUZTYPEREF',
header: '业务类型',
width: 80
}, {
dataIndex: 'remark_2',
header: '备注2',
width: 280,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'remark_3',
header: '备注3',
width: 280,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'remark_4',
header: '备注4',
width: 280,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'Overfilled',
header: '溢短装',
width: 280,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true, id: '',
dataIndex: 'FinanceStatusREF',
header: '融资状态',
width: 80
}, {
dataIndex: 'remark',
header: '备注1',
width: 280,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true, id: '',
dataIndex: 'price_agio',
header: '差价',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'price_limit',
header: '限价',
width: 80
}, {
dataIndex: 'Inspection_Buyer',
header: '商检收货单位',
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.Inspection_Buyer;
},
editor: this.comboxInspection_Buyer,
width: 60
}, {
sortable: true, id: '',
dataIndex: 'Freetime',
header: '免箱期',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true, id: '',
dataIndex: 'SBYS',
header: '申报要素',
width: 120
}, {
sortable: true, id: '',
dataIndex: 'CHECKSAMPLE',
header: '样本清单已审核',
width: 90
}, {
sortable: true, id: '',
dataIndex: 'BILLTRANCNO',
header: '国外寄单快递号',
width: 90,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'Unsealdate',
header: '启封/整改放行日',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
dataIndex: 'TAGPICURL',
header: '标签图片',
width: 60,
renderer: function (value, p, record) {
if (value == '' || typeof (value) == "undefined") {
//return '<input type="button" value="上传" onClick="javascript:this.UpLoadFile('+record.data.BillNo+')"';
return '';
} else
return '<a href="' + value + '" style=' + '"text-decoration:none" target="_blank"' + ' > 下载图片 </a>';
}
}];
//this.comboxInspection_Buyer
this.column_single_edit = [].concat(this.column_edit);
//#endregion
//Inspection_Storage 是否采样入库
//inspection_date 商检验货日
this.MainCB = Ext.create('Ext.selection.CheckboxModel'); //, { checkOnly: true }
this.MainCB_single = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 40
});
Ext.grid.RowNumberer_single = Ext.extend(Ext.grid.RowNumberer, {
width: 40
});
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.Pagenum1 = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize1,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.PagenumEdit = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSizeEdit,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#region 定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
layout: "border",
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('IsRongZi');
//return DsTruck.RONGZIGetRowClass(feeStatus);
}
},
stateful: true,
selModel: this.MainCB,
stateId: 'PortOperateGrid',
columns: this.column,
bbar: [Ext.create('Ext.PagingToolbar', {
id: "bbar_ALL",
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
this.gridList_single = new Ext.grid.GridPanel({
store: this.storeList_single,
enableHdMenu: false,
layout: "border",
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('IsRongZi');
//return DsTruck.RONGZIGetRowClass(feeStatus);
}
},
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
stateful: true,
selModel: this.MainCB_single,
stateId: 'PortOperate_singleGrid',
columns: [new Ext.grid.RowNumberer_single()],
bbar: [Ext.create('Ext.PagingToolbar', {
id: "bbar_single",
store: this.storeList_single,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum1]
});
this.cellEditing_1 = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.cellEditing_2 = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.MainCB_Edit = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
this.gridList_edit = new Ext.grid.GridPanel({
hidden: true,
store: this.storeEditList,
enableHdMenu: false,
layout: "border",
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
viewConfig: {
enableTextSelection: true
},
stateful: true,
plugins: [this.cellEditing_1],
selModel: this.MainCB_Edit,
stateId: 'PortOperateGrid',
columns: this.column_edit,
bbar: [Ext.create('Ext.PagingToolbar', {
id: "bbar_ALL_edit",
store: this.storeEditList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.PagenumEdit]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.column = DsTruck.GetGridPanel(GID, this.formname, this.column);
//使用者id表名 中间column数组
this.column.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.column);
////////////////////////////
this.column_single = DsTruck.GetGridPanel(GID, this.formname_single, this.column_single);
//使用者id表名 中间column数组
this.column_single.unshift(new Ext.grid.RowNumberer_single());
this.gridList_single.reconfigure(this.storeList_single, this.column_single);
////////////////////////////
this.column_edit = DsTruck.GetGridPanel(GID, this.formname_edit, this.column_edit);
//使用者id表名 中间column数组
this.column_edit.unshift(new Ext.grid.RowNumberer());
this.gridList_edit.reconfigure(this.storeEditList, this.column_edit);
//#endregion
/*
this.column_single_edit = DsTruck.GetGridPanel(GID, this.formname_single_edit, this.column_single_edit);
//使用者id表名 中间column数组
this.column_single_edit.unshift(new Ext.grid.RowNumberer_single());
this.gridList_single_edit.reconfigure(this.storeList_single, this.column_single_edit);*/
////////////////////////////
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
if (VIEWTYPE == "天津誉恒") {
DsOpenEditWin('/Import/PortOperate/Edit2', record.data.ContractNo);
} else {
DsOpenEditWin('/Import/PortOperate/Edit', record.data.ContractNo, "850", "1200");
}
}, this);
this.gridList_single.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
if (VIEWTYPE == "天津誉恒") {
DsOpenEditWin('/Import/PortOperate/Edit2', record.data.ContractNo);
} else {
DsOpenEditWin('/Import/PortOperate/Edit', record.data.ContractNo, "850", "1200");
}
}, this);
//#region formSearch
//#region formSearch枚举参照相关
///////////////////////////////////////////////////
this.storeport = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeport.load({ params: { enumTypeId: 10} });
this.comboxPort = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '目的港',
//renderTo: 'basicBoxselect',
//autoHeight:true,
autosize: true,
bodyPadding: 1,
flex: 1,
//height:60,
width: 80,
labelWidth: 90,
store: this.storeport,
queryMode: 'local',
//stacked: true,
//pinList: false,
triggerOnClick: false,
valueField: 'EnumValueId',
displayField: 'EnumValueName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
//,value: ['TX', 'CA']
});
this.storeSeller = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeSeller.load({ params: { condition: " isagent=1" } });
this.comboxSeller = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '贸易商',
forceSelection: true,
store: this.storeSeller,
name: 'seller',
valueField: 'name',
displayField: 'codename',
matchFieldWidth: false,
listeners: {
beforequery: function (e) {
return FilterCombox(e);
},
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
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('DsExt.ux.RefTableCombox', {
fieldLabel: '客户',
forceSelection: true,
store: this.storeBuyer,
name: 'buyer',
queryMode: 'local',
valueField: 'name',
displayField: 'codename',
matchFieldWidth: false,
listeners: {
beforequery: function (e) {
return FilterCombox(e);
},
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
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: 2,
width: 100,
labelWidth: 90,
store: this.storeCname,
queryMode: 'local',
triggerOnClick: false,
valueField: 'FieldId',
displayField: 'FieldValue',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeBUZTYPE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeBUZTYPE.load({ params: { enumTypeId: 27} });
this.comboxBUZTYPE = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '业务类型',
forceSelection: true,
store: this.storeBUZTYPE,
name: 'BUZTYPE'
});
Ext.define('TFMd', {
extend: 'Ext.data.Model',
fields: [
{ name: 'TFValue', type: 'string' },
{ name: 'TFName', type: 'string' }
]
});
var TFData = [{ "TFValue": "", "TFName": "" },
{ "TFValue": "0", "TFName": "否" },
{ "TFValue": "1", "TFName": "是"}];
this.storeTFZDZ = Ext.create('Ext.data.Store', {
model: 'TFMd',
data: TFData
});
this.storeTFWSXKZ = Ext.create('Ext.data.Store', {
model: 'TFMd',
data: TFData
});
this.storePrinted = Ext.create('Ext.data.Store', {
model: 'TFMd',
data: TFData
});
this.storeHT = Ext.create('Ext.data.Store', {
model: 'TFMd',
data: TFData
});
this.storeBQ = Ext.create('Ext.data.Store', {
model: 'TFMd',
data: TFData
});
this.storeSJYH = Ext.create('Ext.data.Store', {
model: 'TFMd',
data: TFData
});
this.storeQFRQ = Ext.create('Ext.data.Store', {
model: 'TFMd',
data: TFData
});
this.storeLOCK_EXCHANGERATE = Ext.create('Ext.data.Store', {
model: 'TFMd',
data: TFData
});
this.comboxTFZDZ = Ext.create('DsExt.ux.RefTableCombox', {
forceSelection: true,
store: this.storeTFZDZ,
fieldLabel: '是否有自动证',
//flex: 0.7,
name: 'TFZDZ',
valueField: 'TFValue',
displayField: 'TFName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.comboxTFWSXKZ = Ext.create('DsExt.ux.RefTableCombox', {
forceSelection: true,
store: this.storeTFWSXKZ,
//flex: 0.8,
fieldLabel: '卫生证是否可查',
name: 'TFWSXKZ',
valueField: 'TFValue',
displayField: 'TFName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.comboxPrinted_S = Ext.create('DsExt.ux.RefTableCombox', {
forceSelection: true,
store: this.storePrinted,
fieldLabel: '发票已打印',
name: 'Printed',
valueField: 'TFValue',
displayField: 'TFName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.comboxHT = Ext.create('DsExt.ux.RefTableCombox', {
forceSelection: true,
store: this.storeHT,
fieldLabel: '是否有合同',
name: 'HaveContract',
valueField: 'TFValue',
displayField: 'TFName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.comboxBQ = Ext.create('DsExt.ux.RefTableCombox', {
forceSelection: true,
store: this.storeBQ,
fieldLabel: '是否有标签',
name: 'HaveCargoMark',
valueField: 'TFValue',
displayField: 'TFName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.comboxLOCK_EXCHANGERATE = Ext.create('DsExt.ux.RefTableCombox', {
forceSelection: true,
store: this.storeLOCK_EXCHANGERATE,
fieldLabel: '是否锁汇',
name: 'LOCK_EXCHANGERATE',
valueField: 'TFValue',
displayField: 'TFName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.comboxSJYH = Ext.create('DsExt.ux.RefTableCombox', {
forceSelection: true,
store: this.storeSJYH,
fieldLabel: '是否商检慢检',
name: 'SJYH',
valueField: 'TFValue',
displayField: 'TFName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.comboxQFRQ = Ext.create('DsExt.ux.RefTableCombox', {
forceSelection: true,
store: this.storeQFRQ,
labelWidth: 125,
fieldLabel: '是否启封/整改放行',
name: 'QFRQ',
valueField: 'TFValue',
displayField: 'TFName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeISREFORM = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeISREFORM.load({ params: { enumTypeId: 0} });
this.comboxISREFORM = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '是否整改', flex: 1,
//labelWidth: 77,
forceSelection: true,
store: this.storeISREFORM,
name: 'ISREFORM'
});
//SR2020060300005
this.storeTransactionMethod = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeTransactionMethod.load({ params: { enumTypeId: 1 } });
this.comboxTransactionMethod = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '成交方式', flex: 1,
//labelWidth: 77,
forceSelection: true,
store: this.storeTransactionMethod,
name: 'TransactionMethod',
valueField: 'EnumValueId',
displayField: 'EnumValueName'
});
//#endregion
_this = this;
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
bodyStyle: 'overflow-x:visible; overflow-y:scroll',
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 100,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxCompany,
this.comboxCountry,
{
fieldLabel: '接单日期',
format: 'Y-m-d',
labelWidth: 80,
xtype: 'datefield',
name: 'creattime',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '至接单日期',
format: 'Y-m-d',
labelWidth: 80,
xtype: 'datefield',
name: 'creattimeTo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{
fieldLabel: '合同序列号/报关号/报检号',
labelWidth: 170,
flex: 1.5,
name: 'ContractNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从..开船日',
labelWidth: 80,
format: 'Y-m-d',
xtype: 'datefield',
name: 'SailingDate_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..开船日',
labelWidth: 80,
format: 'Y-m-d',
xtype: 'datefield',
name: 'SailingDate_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.comboxAuditor,
{
fieldLabel: '业务单据不完整',
xtype: 'checkbox',
name: 'ReceiptStatus',
flex: 0.35
}, this.comboxRemind, {
fieldLabel: '备注中包含',
name: 'remark', flex: 1.15,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '包含双抬头',
xtype: 'checkbox',
name: 'STT',
flex: 0.5
},
{ fieldLabel: '双抬头内容',
name: 'STT_word', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxTFWSXKZ, this.comboxTFZDZ
]
}]
}, //end fieldset 2
{//fieldset 4
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
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: '申请/结算单号',
name: 'DH',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxSeller, {
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 3)
{//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: 'Paydate_min',
listeners: {
specialkey: function (_field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..付尾款时间',
format: 'Y-m-d',
xtype: 'datefield',
name: 'Paydate_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();
}
}
}
}, , {
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 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', flex: 3,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..出税时间',
format: 'Y-m-d',
xtype: 'datefield',
name: 'tax_date_max', flex: 3,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从..商检验货日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'inspection_date_min', flex: 3,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..商检验货日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'inspection_date_max', flex: 3,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从..海关放行日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CustomsReleaseDate_min', flex: 3,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..海关放行日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CustomsReleaseDate_max', flex: 3,
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: [
this.comboxMainstate, this.comboxAGENT, this.comboxBUZTYPE, this.comboxFStatus, this.comboxOP, this.comboxHT]
}]
} //end items(fieldset 6)
, {//fieldset 6
xtype: 'container',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxPort
, this.comboxBuyer
, this.comboxLOCK_EXCHANGERATE
, this.comboxPrinted_S, this.comboxBQ
, this.comboxSJYH]
}]
} //end items(fieldset 7)
, {//fieldset 6
xtype: 'container',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '厂号',
name: 'FactoryNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '货物名称包含',
name: 'Cname_1',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.Cname, this.comboxISREFORM, this.comboxQFRQ]
}]
} //end items(fieldset 8)
, {//fieldset 6
xtype: 'container',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '从.出通关单时间',
labelWidth: 110,
format: 'Y-m-d',
xtype: 'datefield',
name: 'ClearanceDate',
flex: 1
}, {
fieldLabel: '到.出通关单时间',
format: 'Y-m-d',
labelWidth: 110,
xtype: 'datefield',
name: 'ClearanceDate2',
flex: 1
}, {
fieldLabel: '从..批文到期日',
format: 'Y-m-d',
xtype: 'datefield',
labelWidth: 110,
name: 'AppDate_min', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..批文到期日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'AppDate_max', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从..付预付时间',
format: 'Y-m-d',
xtype: 'datefield',
name: 'Prepaydate_min', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..付预付时间',
format: 'Y-m-d',
xtype: 'datefield',
name: 'Prepaydate_max', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}]
}]
},
{//fieldset 6
xtype: 'container',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxReceiver, {
fieldLabel: '预计到港日期从..',
labelWidth:110,
format: 'Y-m-d',
xtype: 'datefield',
name: 'preArrivalDateMin', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '预计到港日期到..',
labelWidth: 110,
format: 'Y-m-d',
xtype: 'datefield',
name: 'preArrivalDateMax', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
this.comboxTransactionMethod
, {
xtype: 'hiddenfield'
}, {
xtype: 'hiddenfield'
}]
}]
}//end items(fieldset 9)
]//end root items
});
//#endregion formSearch
//#region menu1
var menu1 = new Ext.menu.Menu({
id: 'basicMenu',
items: [{
text: '业务总览',
handler: clickHandler_16
}, {
text: '船期表',
handler: clickHandler
}, {
text: '单据收发状态',
handler: clickHandler_15
}, {
text: '费用通知单_预付款',
handler: clickHandler_4
}, {
text: '费用通知单_尾款(无过程)',
handler: clickHandler_2
}, {
text: '费用通知单_尾款(有过程)',
handler: clickHandler_3
}, {
text: '费用通知单_尾款(天津)',
handler: clickHandler_5
}, {
text: '费用通知单_尾款(天津_无税/杂费)',
handler: clickHandler_6
}, {
text: '报检承诺书/检验检疫证明',
handler: clickHandler_7
}, {
text: '入库通知',
handler: clickHandler_8
}, {
text: '客户往来对账',
handler: clickHandler_9
}, {
text: '客户往来对账2',
handler: clickHandler_12
}, {
text: '客户往来对账 四格式',
handler: clickHandler_14
}, {
text: '客户往来对账_盛源',
handler: clickHandler_13
}, {
text: '申报要素',
handler: clickHandler_10
}, {
text: '商检销售记录',
handler: clickHandler_11
}, {
text: '打印合同/发票',
handler: clickHandler_17
}
]
});
//#region 打印格式定义
function clickHandler() {
panelTest.Print();
};
function clickHandler_2() {
panelTest.Print_FYTZ();
};
function clickHandler_3() {
panelTest.Print_FYTZ_3();
};
function clickHandler_4() {
panelTest.Print_FYTZ_4();
};
function clickHandler_5() {
panelTest.Print_FYTZ_TJ();
};
function clickHandler_6() {
panelTest.Print_FYTZ_TJ_2();
};
function clickHandler_7() {
panelTest.Print_BJCNS();
};
function clickHandler_8() {
panelTest.Print_RKTZ();
};
function clickHandler_9() {
panelTest.Print_WLDZ();
};
function clickHandler_10() {
panelTest.Print_SBYS();
};
function clickHandler_11() {
panelTest.Print_SJXSJL();
};
function clickHandler_12() {
panelTest.Print_WLDZ2();
};
function clickHandler_13() {
panelTest.Print_DZ_SYSH();
};
function clickHandler_14() {
panelTest.Print_WLDZ_4s();
};
function clickHandler_15() {
panelTest.Print_ReceiptList();
};
function clickHandler_16() {
panelTest.Print_YWZL();
};
function clickHandler_17() {
panelTest.Print_Contract();
};
//#endregion
//#endregion
//#region menu2
var menu2 = new Ext.menu.Menu({
id: 'basicMenu2',
items: [{
text: '上传业务、单据信息',
handler: CHUpload_1
}, {
text: '上传对账信息',
handler: CHUpload_2
}
]
});
function CHUpload_1() {
panelTest.OnClickUploadInfo();
};
function CHUpload_2() {
panelTest.OnClickUploadFee();
};
//#endregion
//#region menu3 其他操作 批量商品信息和
/*
me = this;
var USDGID = "740DF21C-BDE4-4C3E-A258-683A183AD3B4";
var Exchangerate = "1";
var currrecords = DsStoreQueryBy(this.storecurr, 'GID', USDGID);
if (currrecords.getCount() > 0) {
Exchangerate = currdata.DEFRATE;
}
this.formSetPrice = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 2,
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: '单价',
xtype: 'textfield',
name: 'price',
value:'0'
}, {
fieldLabel: '差价',
xtype: 'textfield',
name: 'price_agio',
value:'0'
},{
fieldLabel: '海关限价',
xtype: 'textfield',
name: 'price_limit',
value:'0'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '汇率_商务',
xtype: 'textfield',
name: 'Exchangerate',
value: Exchangerate
}, {
fieldLabel: '汇率_海关',
xtype: 'textfield',
name: 'Exchangerate_Customs',
value: Exchangerate
}, {
fieldLabel: '预付比例 %',
xtype: 'textfield',
name: 'PreProportion',
value: '20'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ {
fieldLabel: '重量(kg)',
xtype: 'textfield',
name: 'weight',
value:'27000'
}, {
fieldLabel: '件数',
xtype: 'textfield',
name: 'BoxCount',
value:'5000'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.winSetPrice = Ext.create('Ext.window.Window', {
title: "设定费率",
width: 550,
//height : 120,
//plain : true,
iconCls: "addcomm",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formSetPrice],
buttons: [{
text: "设定费率(空白项不变)",
minWidth: 70,
handler: function () {
me.onSetPriceClick();
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
me.winSetPrice.close();
}
}]
});
var menu3 = new Ext.menu.Menu({
id: 'basicMenu3',
items: [{
text: '批量修改商品信息,同时生成费用',
handler: function (button, event) {
var form = me.formSetPrice.getForm();
me.winSetPrice.show();
}
}
]
});*/
//#endregion
_this = this;
this.CBMSearch = new Ext.form.Checkbox({
//fieldLabel: '高级查询',
hideLabel: true,
labelwidth: 50,
listeners: {
change: function (newValue, oldValue, eOpts)//change事件
{
//alert(newValue.checked);
if (newValue.checked) {
_this.panelSearch.show();
} else {
_this.panelSearch.hide();
}
}
}
});
this.CB_EditMode = new Ext.form.Checkbox({
//fieldLabel: '编辑模式',
hideLabel: true,
labelwidth: 50,
id: "CheckEdit",
listeners: {
change: function (newValue, oldValue, eOpts)//change事件
{
if (newValue.checked) {
Ext.getCmp('SaveBtn').show();
_this.gridList.hide();
_this.gridList_single.hide();
_this.gridList_edit.show();
_this.onRefreshClick();
} else {
Ext.getCmp('SaveBtn').hide();
_this.gridList.show();
_this.gridList_single.show();
_this.gridList_edit.hide();
_this.onRefreshClick();
}
}
}
});
//查询工具条
_this = this;
this.panelBtn = new Ext.Panel({
region: "center",
tbar: [
{
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: "修改海关汇率",
id: "btnEditRate",
iconCls: 'btneditrate',
handler: function (button, event) {
var selectedRecords = this.gridList.selModel.getSelection();
if (selectedRecords.length === 0) return;
this.formRate.getForm().findField('BatchRate').setValue('0');
this.winRate.show();
},
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) {
var _tail = Ext.getCmp('formname_tail').getValue();
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
var mode = Ext.getCmp('CheckEdit').getValue();
if (mode == true) {
var formname = this.formname_edit + _tail;
var tempcolumns = this.gridList_edit.columns;
DsTruck.SaveGridPanel(GID, formname, tempcolumns, this.column_edit, 1, true);
}
else {
var formname = this.formname + _tail;
var tempcolumns = this.gridList.columns;
DsTruck.SaveGridPanel(GID, formname, tempcolumns, this.column, 1, true);
}
}
if (_p == "page_2") {
var formname_single = this.formname_single + _tail;
var tempcolumns = this.gridList_single.columns;
DsTruck.SaveGridPanel(GID, formname_single, tempcolumns, this.column_single, 1, true);
}
},
scope: this
}, {
text: "载入列表样式",
id: "loadstyle",
handler: function (button, event) {
this.OnClickLoadStyle();
},
scope: this
}, { id: "formname_tail",
//fieldLabel: "合同号",
Width: 55,
xtype: 'textfield',
name: 'formname_tail',
grow: true, //大小是否可变
growMin: 40, //在大小可变的情况下设置最小宽度
growMax: 100//在大小可变的情况下设置最大宽度
//minLength:8//最少字符数设置
,
listeners: {
//内容改变事件
change: function (me, newValue, oldValue, eOpts) {
},
//获得焦点事件
focus: function (me, event, eOpts) {
},
//失去焦点事件
blur: function (me, event, eOpts) {
//panelTest.OnClickLoadStyle();
}
}
}, '-',
{ text: "打印报表", menu: menu1, scope: this },
//{ text: "批量操作(请小心使用)", menu: menu3, scope: this },
{text: "上传至公开列表",hidden:true,
tooltip: "将可以公开的业务信息上传至服务器,供相关客户自行查询",
menu: menu2, scope: this
},
{ id: 'S_HTH',
fieldLabel: "合同号",
labelWidth: 55,
xtype: 'textfield',
name: 'HTH',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, { xtype: 'label', id: 'label1', text: "" },
//this.comboxport
{
xtype: 'button',
width: 30,
//text: "",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
//if (this.winAccess != null) {
// this.winAccess = null;
//}
if (this.winAccess) { this.winAccess.close(); }
this.winAccess = new Shipping.DsQuery();
this.winAccess.StoreList = this.storeList;
this.winAccess.formname = this.formname;
this.winAccess.condition = sql;
//winAccess.LoadQueryData_self(this.formname);
this.winAccess.show();
return;
},
scope: this
}, { xtype: 'label', text: '高级查询' }, this.CBMSearch, '-',
{ xtype: 'label', text: '编辑模式' },
{
text: "保存修改", id: "SaveBtn", hidden: true,
iconCls: "btnsave",
handler: function (button, event) {
this.onSaveClick(button, event);
},
scope: this
},
this.CB_EditMode
//this.basicBoxselect
]
});
//选择时保存选中的合同号
this.gridList.getSelectionModel().on('select',
function (model, record, index) {
this.C_contractno = record.data.ContractNo;
//alert(this.C_contractno);
},
this);
//布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 30,
items: [this.panelBtn]
});
this.panelSearch = new Ext.Panel({
layout: "border",
region: "north",
height: 260,
autoSize: true,
hidden: true,
items: [this.formSearch]
});
this.page_1 = new Ext.Panel({
id: "page_1",
layout: "border",
region: "center",
title: "合同信息(每商品)",
items: [this.gridList, this.gridList_edit
]
});
this.page_2 = new Ext.Panel({
id: "page_2",
layout: "border",
region: "center",
title: "合同信息(每合同)",
items: [this.gridList_single//, this.gridList_single_edit
]
});
this.MainTab = new Ext.tab.Panel({
layout: "border",
region: "center",
items: [this.page_1, this.page_2]
});
Ext.apply(this, {
items: [this.panelTop, this.panelSearch, this.MainTab]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
this.storeList.pageSize = this.PageSize;
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.storeEditList.on('beforeload', function (store) {
var sql = this.getCondition();
this.storeEditList.pageSize = this.PageSize;
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.storeList_single.on('beforeload', function (store) {
var sql = this.getCondition();
this.storeList.pageSize = this.PageSize;
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.gridList_edit.on('edit', function (editor, e, eOpts) {
this.ImportAfterEdit(editor, e, eOpts);
}, this);
this.gridList_edit.addListener('itemcontextmenu', this.itemcontextmenu);
if (VIEWTYPE == "天津誉恒")
this.storeList.getProxy().url = '/Import/XXH/GetDataList_ALL_HD';
//#region 批量修改汇率
this.formRate = Ext.widget('form', {
//region: 'north',
//title: '批量修改汇率',
flex: 1,
frame: true,
bodyPadding: 0,
collapsed: false,
collapsible: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 110,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [ {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '设定汇率',
name: 'BatchRate',
xtype: 'numberfield',
decimalPrecision: 4
//regex: /^(0|[1-9][0-9]*)$/,
// regexText: '请输入正确的数值!'
}]
}]
}]//end root items
});
me = this;
this.winRate = Ext.create('Ext.window.Window', {
title: '批量汇率修改', //"",
width: 320,
//height : 120,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formRate],
buttons: [{
text: '修改', //"确定修改",
minWidth: 70,
handler: function () {
//批量修改
me.onBatchRate();
}
}, {
text: '关闭', //"关闭",
minWidth: 70,
handler: function () {
me.winRate.close();
}
}]
});
//#endregion
}, //end initUIComponents
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.PageSize = this.Pagenum.getValue();
this.PageSize1 = this.Pagenum1.getValue();
this.PageSizeEdit = this.PagenumEdit.getValue();
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
var mode = Ext.getCmp('CheckEdit').getValue();
if (mode == true) {
this.storeEditList.pageSize = this.PageSizeEdit;
this.storeEditList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
else {
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
,
callback: function (records, options, success) {
//mergeCells(_this.gridList, [1]);
//alert(records);
}
});
}
}
if (_p == "page_2") {
this.storeList_single.pageSize = this.PageSize1;
this.storeList_single.load({
params: { start: 0, limit: this.PageSize1, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
},
onDsQuery: function () {
//var girdcolums = this.gridList.getColumnMode();
var sql = this.sqlcontext;
this.PageSize = this.Pagenum.getValue();
this.PageSize1 = this.Pagenum1.getValue();
this.PageSizeEdit = this.PagenumEdit.getValue();
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
var mode = Ext.getCmp('CheckEdit').getValue();
if (mode == true) {
this.storeEditList.pageSize = this.PageSizeEdit;
this.storeEditList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
else {
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
,
callback: function (records, options, success) {
//mergeCells(_this.gridList, [1]);
//alert(records);
}
});
}
}
if (_p == "page_2") {
this.storeList_single.pageSize = this.PageSize1;
this.storeList_single.load({
params: { start: 0, limit: this.PageSize1, 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 _L = selections.length;
Ext.MessageBox.confirm('提示', '确定删除这' + _L + '条记录吗?', function (btn) {
if (btn == 'yes') {
//var record = selections[0];
for (var i = 0; i < _L; i++) {
var record = selections[i];
var ContractNo = record.data.ContractNo;
var HTH = record.data.HTH;
var sql = " BSNO='" + ContractNo + "'";
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/Import/XXH/GetChfee',
scope: this,
async: false,
params: { condition: sql },
waitMsg: "正在查询数据...",
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
var returnData = jsonresult.data;
//alert(returnData.Count);
this.ChfeeCount = parseInt(returnData.Count);
if (this.ChfeeCount != "") {
alert("序列号<" + ContractNo + ">的业务包含未删除的费用,不能删除");
return;
} else {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/Import/XXH/Delete',
params: {
data: Ext.JSON.encode(record.data),
USERID: GID
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
//Ext.Msg.show({ tonitle: '提示', 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
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
}
});
}
//this.storeList.remove(record);
//if (i >= _L ) {
// Ext.Msg.show({ title: '提示', msg: "数据删除结束", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
//}
};
Ext.Msg.show({ title: '提示', msg: "数据删除结束", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
this.onRefreshClick(button, event);
}, this);
}, //onDeleteClick
getCondition: function () {
var sql = ' M.ISDELETE=0 ';
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var ContractNo = form.findField('ContractNo').getValue();
sql = sql + getAndConSql(sql, ContractNo, " (M.ContractNo like '%" + ContractNo + "%' or M.DeclareNumber like '%" + ContractNo + "%' or M.inspection_no like '%" + ContractNo + "%') ");
var HTH = Ext.getCmp('S_HTH').getValue();
sql = sql + getAndConSql(sql, HTH, "M.HTH like '%" + HTH + "%'");
var port = this.comboxPort.getValue();
if (port != "") {
sql = sql + getAndConSql(sql, port, "m.port in (" + port + ")");
}
var FactoryNo = form.findField('FactoryNo').getValue();
if (FactoryNo != "") {
sql = sql + getAndConSql(sql, FactoryNo, "M.contractno in(select contractno from import_cargo where FactoryNo like '%" + FactoryNo + "%')");
}
var CnameList = this.Cname.getValue();
//alert(CnameList);
var CnameString = "";
for (var i in CnameList) {
if (CnameString == "") { CnameString = "'" + CnameList[i] + "'"; }
else { CnameString = CnameString + ",'" + CnameList[i] + "'"; }
}
if (CnameString != "") {
sql = sql + getAndConSql(sql, CnameString, "M.contractno in(select contractno from import_cargo where name in (" + CnameString + "))");
}
var Cname = form.findField('Cname_1').getValue();
if (Cname != "") {
sql = sql + getAndConSql(sql, Cname, "M.contractno in(select contractno from import_cargo where name like '%" + Cname + "%')");
}
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 SailingDate_min = form.findField('SailingDate_min').getRawValue();
sql = sql + getAndConSql(sql, SailingDate_min, "m.SailingDate >= '" + SailingDate_min + "'");
var SailingDate_max = form.findField('SailingDate_max').getRawValue();
sql = sql + getAndConSql(sql, SailingDate_max, "m.SailingDate <= '" + SailingDate_max + " 23:59:59'");
var BUZTYPE = form.findField('BUZTYPE').getValue();
sql = sql + getAndConSql(sql, BUZTYPE, "m.BUZTYPE = " + BUZTYPE + "");
var createtime = form.findField('creattime').getRawValue();
sql = sql + getAndConSql(sql, createtime, "m.creattime >= '" + createtime + "'");
var creattimeTo = form.findField('creattimeTo').getRawValue();
sql = sql + getAndConSql(sql, creattimeTo, "m.creattime <= '" + creattimeTo + " 23:59:59'");
var Mainstate = this.comboxMainstate.getValue();
if (Mainstate != "") {
sql = sql + getAndConSql(sql, Mainstate, "m.Mainstate in (" + Mainstate + ")");
}
var seller = form.findField('seller').getValue();
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 buyer = form.findField('buyer').getValue();
sql = sql + getAndConSql(sql, buyer, "M.buyer like '%" + buyer + "%' ");
var Auditor = this.comboxAuditor.getValue();
sql = sql + getAndConSql(sql, Auditor, " M.Auditor = '" + Auditor + "' ");
var Receiver = this.comboxReceiver.getValue();
sql = sql + getAndConSql(sql, Receiver, " M.Creator = '" + Receiver + "' ");
/*
var ShipCompany_id = this.comboxCGS.getValue();
if (ShipCompany_id != "") {
sql = sql + getAndConSql(sql, ShipCompany_id, "m.ShipCompany_id in (" + ShipCompany_id + ")");
}*/
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 + "%' or m.SealNo like '%" + ContainerNo + "%') ");
var DH = form.findField('DH').getValue(); //结算单号/申请单号
sql = sql + getAndConSql(sql, DH, " M.ContractNo in ( select distinct BSNO from ch_fee_do where billno like '%" + DH + "%') ");
// alert(sql);
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 ReceiptStatus = form.findField("ReceiptStatus").getValue();
if (ReceiptStatus)
{ sql = sql + getAndConSql(sql, ReceiptStatus, " (m.ReceiptStatus is null or m.ReceiptStatus=0 )"); }
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 Paydate_min = form.findField('Paydate_min').getRawValue();
sql = sql + getAndConSql(sql, Paydate_min, "m.Paydate >= '" + Paydate_min + "'");
var Paydate_max = form.findField('Paydate_max').getRawValue();
sql = sql + getAndConSql(sql, Paydate_max, "m.Paydate <= '" + Paydate_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 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 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 FinanceStatus = form.findField('FinanceStatus').getValue();
sql = sql + getAndConSql(sql, FinanceStatus, "M.FinanceStatus = '" + FinanceStatus + "'");
var AppDate_min = form.findField('AppDate_min').getRawValue();
sql = sql + getAndConSql(sql, AppDate_min, "ap.ValidDate >= '" + AppDate_min + "'");
var AppDate_max = form.findField('AppDate_max').getRawValue();
sql = sql + getAndConSql(sql, AppDate_max, "ap.ValidDate <= '" + AppDate_max + " 23:59:59'");
var Prepaydate_min = form.findField('Prepaydate_min').getRawValue();
sql = sql + getAndConSql(sql, Prepaydate_min, "M.Prepaydate >= '" + Prepaydate_min + "'");
var Prepaydate_max = form.findField('Prepaydate_max').getRawValue();
sql = sql + getAndConSql(sql, Prepaydate_max, "M.Prepaydate <= '" + Prepaydate_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 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 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'");
if (this.remind != "") {
sql = sql + getAndConSql(sql, this.remind, this.remind);
}
var AutoAPP = form.findField('TFZDZ').getValue();
sql = sql + getAndConSql(sql, AutoAPP, "(M.ArrivalDate<(GETDATE()+14) AND M.AutoAPP = '" + AutoAPP + "')");
var CIQ_canbesearch = form.findField('TFWSXKZ').getValue();
sql = sql + getAndConSql(sql, CIQ_canbesearch, "(M.CIQ_canbesearch = '" + CIQ_canbesearch + "')");
var Printed = form.findField('Printed').getValue();
sql = sql + getAndConSql(sql, Printed, "M.Printed = '" + Printed + "'");
var HaveContract = form.findField('HaveContract').getValue();
sql = sql + getAndConSql(sql, HaveContract, "M.HaveContract = '" + HaveContract + "'");
var HaveCargoMark = form.findField('HaveCargoMark').getValue();
sql = sql + getAndConSql(sql, HaveCargoMark, "M.HaveCargoMark = '" + HaveCargoMark + "'");
var LOCK_EXCHANGERATE = form.findField('LOCK_EXCHANGERATE').getValue();
sql = sql + getAndConSql(sql, LOCK_EXCHANGERATE, "M.LOCK_EXCHANGERATE = '" + LOCK_EXCHANGERATE + "'");
var SJYH = form.findField('SJYH').getValue();
if (SJYH == "0") { sql = sql + getAndConSql(sql, SJYH, " isnull(M.Inspection_Storage,'') = 0"); }
if (SJYH == "1") { sql = sql + getAndConSql(sql, SJYH, " isnull(M.Inspection_Storage,'') = 1"); }
var QFRQ = form.findField('QFRQ').getValue();
if (QFRQ == "0") { sql = sql + getAndConSql(sql, QFRQ, " isnull(dbo.trimdate(M.Unsealdate),'') = ''"); }
if (QFRQ == "1") { sql = sql + getAndConSql(sql, QFRQ, " isnull(dbo.trimdate(M.Unsealdate),'') <> ''"); }
var ISREFORM = form.findField('ISREFORM').getValue();
sql = sql + getAndConSql(sql, ISREFORM, "M.ISREFORM = '" + ISREFORM + "'");
var Agent = this.comboxAGENT.getValue();
if (Agent != "" && Agent != null) {
sql = sql + getAndConSql(sql, Agent, "m.Agent = (select gid from company where name = '" + Agent + "')");
}
var ClearanceDate = form.findField('ClearanceDate').getRawValue();
if (ClearanceDate != '' && ClearanceDate != null) {
sql = sql + getAndConSql(sql, ClearanceDate, "m.ClearanceDate >= '" + ClearanceDate + "'");
}
if (ClearanceDate2 != '' && ClearanceDate2 != null) {
var ClearanceDate2 = form.findField('ClearanceDate2').getRawValue();
sql = sql + getAndConSql(sql, ClearanceDate2, "m.ClearanceDate <= '" + ClearanceDate2 + "'");
}
var preArrivalDateMin = form.findField('preArrivalDateMin').getRawValue();
sql = sql + getAndConSql(sql, preArrivalDateMin, "M.preArrivalDate >= '" + preArrivalDateMin + " 23:59:59'");
var preArrivalDateMax = form.findField('preArrivalDateMax').getRawValue();
sql = sql + getAndConSql(sql, preArrivalDateMax, "M.preArrivalDate <= '" + preArrivalDateMax + " 23:59:59'");
//SR2020060300005
var TransactionMethod = form.findField('TransactionMethod').getValue();
sql = sql + getAndConSql(sql, TransactionMethod, "M.TransactionMethod = " + TransactionMethod );
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.remind = newValue;
}
},
onResetClick: function (button, event) {
this.formSearch.getForm().reset();
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
},
OnClickLoadStyle: function () {
var _tail = Ext.getCmp('formname_tail').getValue();
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
/////////////以下部分为获取存储的gridpanel显示样式
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 50
});
var formname = this.formname + _tail;
this.column = DsTruck.GetGridPanel(GID, formname, this.column, 1);
this.column.unshift(new Ext.grid.RowNumberer_single());
this.gridList.reconfigure(this.storeList, this.column);
}
if (_p == "page_2") {
Ext.grid.RowNumberer_single = Ext.extend(Ext.grid.RowNumberer, {
width: 50
});
var formname_single = this.formname_single + _tail;
this.column_single = DsTruck.GetGridPanel(GID, formname_single, this.column_single, 1);
this.column_single.unshift(new Ext.grid.RowNumberer_single());
this.gridList_single.reconfigure(this.storeList_single, this.column_single);
}
},
ImportAfterEdit: function (editor, e, eOpts) {
if (e.value == e.originalValue) { return; }
if (e.field == 'Printed') {
var records = DsStoreQueryBy(this.storePrinted, 'EnumValueId', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
e.record.set('printedRef', data.EnumValueName);
} else {
e.record.set('printedRef', '');
}
}
if (e.field == 'CIQ_canbesearch') {
var records = DsStoreQueryBy(this.storeCIQ_canbesearch, 'EnumValueId', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
e.record.set('CIQ_canbesearchRef', data.EnumValueName);
} else {
e.record.set('CIQ_canbesearchRef', '');
}
}
if (e.field == 'Inspection_Storage') {
var records = DsStoreQueryBy(this.storeInspection_Storage, 'EnumValueId', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
e.record.set('Inspection_StorageREF', data.EnumValueName);
} else {
e.record.set('Inspection_StorageREF', '');
}
}
if (e.field == 'AutoAPP') {
var records = DsStoreQueryBy(this.storeAutoAPP, 'EnumValueId', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
e.record.set('AutoAPPRef', data.EnumValueName);
} else {
e.record.set('AutoAPPRef', '');
}
}
if (e.field == 'BillType') {
var records = DsStoreQueryBy(this.storeBillType, 'EnumValueId', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
e.record.set('BilltypeREF', data.EnumValueName);
} else {
e.record.set('BilltypeREF', '');
}
}
if (e.field == 'Inspection_Buyer') {
var records = DsStoreQueryBy(this.storeInspection_Buyer, 'name', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
e.record.set('Inspection_BuyerRef', data.name);
} else {
e.record.set('Inspection_BuyerRef', '');
}
}
if (e.field == 'ArrivalDate' || e.field == 'RecDate') {
var startdate = e.record.get('ArrivalDate');
var enddate = e.record.get('RecDate');
if (startdate == "" || startdate == null || enddate == "" || enddate == null) {
return;
}
var _e = Ext.util.Format.date(startdate); //格式化日期控件值
var _s = Ext.util.Format.date(enddate); //格式化日期控件值
var end = new Date(_s);
var start = new Date(_e);
var elapsed = Math.round((end.getTime() - start.getTime()) / (86400000)) + 1; // 计算间隔日数
//e.record.set('text',_s);
e.record.set('PortDays', elapsed);
}
},
onExportClick: function (button, event) {
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
GridExportExcelPage(this.gridList, "合同信息(每商品)");
}
if (_p == "page_2") {
GridExportExcelPage(this.gridList_single, "合同信息(每合同)");
}
},
// gridList_Edit的右键菜单
itemcontextmenu: function (his, record, item, index, e) {
// itemcontextmenu( Ext.view.View this, Ext.data.Model record,
// HTMLElement item, Number index, Ext.EventObject e, Object eOpts )
// 分类代码表的右键菜单
e.preventDefault();
e.stopEvent(); // 取消浏览器默认事件
_this = this;
var array = [
{
text: '根据提单号查船期',
handler: function () {
this.SelectedRecord = record;
//BillNo ShipCompanyRef
var BillNo = record.data.BillNo;
var ShipCompanyRef = record.data.ShipCompanyRef;
var ShipCompanyCode = "";
var ShipCompanyName = "";
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/CommMng/BasicDataRef/GeneralSelect',
scope: this,
async: false,
params: { condition: "select EnumValueName GVALUE,EnumValueName_2 as GID from tSysEnumValue where EnumTypeID=5 and EnumValueName='" + ShipCompanyRef + "' " },
waitMsg: "正在查询数据...",
callback: function (options, success, response) {
var result = Ext.JSON.decode(response.responseText);
ShipCompanyName = result.data[0].GVALUE; //name使用原值
ShipCompanyCode = result.data[0].GID; //code使用新填的简化值
}
});
//var ShipCompanyRef = record.data.ShipCompanyRef;
DsOpenMultiEditWin("http://www.fob001.cn/guestbook/chuangongsi/" + ShipCompanyCode + ".php?c=" + BillNo + "&t=bl&url=" + ShipCompanyName + "&Submit=%E6%8F%90%E4%BA%A4", record.data.ContractNo, "750", "1000");
//http://www.fob001.cn/guestbook/chuangongsi/msk.php?c=955943549&t=bl&url=MAERSK&Submit=%E6%8F%90%E4%BA%A4
}
}, {
text: '根据提单号查所有选中业务的船期',
handler: function () {
panelTest.SearchCQ();
}
},
{
text: '根据箱号查船期',
handler: function () {
this.SelectedRecord = record;
//BillNo ShipCompanyRef
var ContainerNo = record.data.ContainerNo;
var ShipCompanyRef = record.data.ShipCompanyRef;
var ShipCompanyCode = "";
var ShipCompanyName = "";
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/CommMng/BasicDataRef/GeneralSelect',
scope: this,
async: false,
params: { condition: "select EnumValueName GVALUE,EnumValueName_2 as GID from tSysEnumValue where EnumTypeID=5 and EnumValueName='" + ShipCompanyRef + "' " },
waitMsg: "正在查询数据...",
callback: function (options, success, response) {
var result = Ext.JSON.decode(response.responseText);
ShipCompanyName = result.data[0].GVALUE; //name使用原值
ShipCompanyCode = result.data[0].GID; //code使用新填的简化值
}
});
DsOpenMultiEditWin("http://www.fob001.cn/guestbook/chuangongsi/" + ShipCompanyCode + ".php?c=" + ContainerNo + "&t=cn&url=" + ShipCompanyName + "&Submit=%E6%8F%90%E4%BA%A4", record.data.ContractNo, "750", "1000");
}
},
{
text: '根据箱号查所有选中业务的船期',
handler: function () {
panelTest.SearchCQ_XH();
}
}
];
var nodemenu = new Ext.menu.Menu({
items: array
});
nodemenu.showAt(e.getXY()); // 菜单打开的位置
},
SearchCQ: function () {
selectedRecords = this.gridList_edit.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var record = selectedRecords[i];
var BillNo = record.data.BillNo;
var ShipCompanyRef = record.data.ShipCompanyRef;
var ShipCompanyCode = "";
var ShipCompanyName = "";
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/CommMng/BasicDataRef/GeneralSelect',
scope: this,
async: false,
params: { condition: "select EnumValueName GVALUE,EnumValueName_2 as GID from tSysEnumValue where EnumTypeID=5 and EnumValueName='" + ShipCompanyRef + "' " },
waitMsg: "正在查询数据...",
callback: function (options, success, response) {
var result = Ext.JSON.decode(response.responseText);
ShipCompanyName = result.data[0].GVALUE; //name使用原值
ShipCompanyCode = result.data[0].GID; //code使用新填的简化值
}
});
DsOpenMultiEditWin("http://www.fob001.cn/guestbook/chuangongsi/" + ShipCompanyCode + ".php?c=" + BillNo + "&t=bl&url=" + ShipCompanyName + "&Submit=%E6%8F%90%E4%BA%A4", record.data.ContractNo, "750", "1000", 15 * i + 200, 15 * i + 100);
}
},
SearchCQ_XH: function () {
selectedRecords = this.gridList_edit.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var record = selectedRecords[i];
var ContainerNo = record.data.ContainerNo;
var ShipCompanyRef = record.data.ShipCompanyRef;
var ShipCompanyCode = "";
var ShipCompanyName = "";
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/CommMng/BasicDataRef/GeneralSelect',
scope: this,
async: false,
params: { condition: "select EnumValueName GVALUE,EnumValueName_2 as GID from tSysEnumValue where EnumTypeID=5 and EnumValueName='" + ShipCompanyRef + "' " },
waitMsg: "正在查询数据...",
callback: function (options, success, response) {
var result = Ext.JSON.decode(response.responseText);
ShipCompanyName = result.data[0].GVALUE; //name使用原值
ShipCompanyCode = result.data[0].GID; //code使用新填的简化值
}
});
DsOpenMultiEditWin("http://www.fob001.cn/guestbook/chuangongsi/" + ShipCompanyCode + ".php?c=" + ContainerNo + "&t=cn&url=" + ShipCompanyName + "&Submit=%E6%8F%90%E4%BA%A4", record.data.ContractNo, "750", "1000", 15 * i + 200, 15 * i + 100);
}
},
//批量修改汇率
onBatchRate: function () {
var selectedRecords = this.gridList.selModel.getSelection();
if (selectedRecords.length === 0) return;
var rate = this.formRate.getForm().findField('BatchRate').getValue();
this.winRate.close();
for (var i = 0; i < selectedRecords.length; i++) {
var record = selectedRecords[i];
var sGID = record.data.cgid;
Ext.Msg.wait('正在批量修改海关汇率, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在修改数据...',
url: '/Import/XXH/BatchRate',
scope: this,
params: {
GIDS: sGID,
Rate: rate
},
success: function (resp, opts) {
Ext.MessageBox.hide();
},
failure: function (resp, opts) {
Ext.MessageBox.hide();
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
});
}
Ext.Msg.show({ title: '提示', msg: '汇率更新成功', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
this.gridList.getSelectionModel().clearSelections();
this.gridList.getView().refresh();
},
Print: function () {//船期表
var MainList = "";
var selectedRecords = [];
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
selectedRecords = this.gridList.selModel.getSelection();
}
if (_p == "page_2") {
selectedRecords = this.gridList_single.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_ship'; //船期
var T = this.getCondition();
if (T != "") { T = " where " + T; };
var sql1 = " select HTH,substring(cc.country,0,(charindex('(',cc.country)) ) country,dbo.f_FactoryNo(M.contractno) FactoryNo, ";
sql1 = sql1 + " dbo.f_str(M.contractno) name,dbo.f_weight_kg(M.contractno) [weight],dbo.f_count(M.contractno) [count],dbo.f_Date(M.contractno) [date], ";
sql1 = sql1 + " (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) as portRef, ";
sql1 = sql1 + " buyer,comp.name as companyname, m.stt,m.Voyage 航次,m.Vessel 船名, ";
sql1 = sql1 + " case [EX_Sailingdate] when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar (12) , [EX_Sailingdate],23) end as EX_Sailingdate , ";
sql1 = sql1 + " case [Sailingdate] when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar (12) , [Sailingdate],23) end as Sailingdate , ";
sql1 = sql1 + " case [ArrivalDate] when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar (12) , [ArrivalDate],23) end as ArrivalDate, ";
sql1 = sql1 + " billno,ContainerNo,sealno,dbo.f_price(M.contractno) price ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=5 and EnumValueID=M.ShipCompany_id) as ShipCompanyRef ";
sql1 = sql1 + " ,(select min(ValidDate) from Import_approval where id in(select app_id from Import_appstate where ContractNo=m.ContractNo)) as 许可证有效期 ";
sql1 = sql1 + " ,m.Audittime 审单时间 ,M.Paydate [付货款时间(尾款)],M.receiptremark 单据收发情况,dbo.trimdate(m.E_Billtime) 电放时间,m.CIQ_canbesearch 卫生证是否可查 ";
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 "; ///WHERE M.HTH LIKE '%1433%'
sql1 = sql1 + T;
if (MainList == "") {
sql1 = sql1 + " and isnull(dbo.trimdate(m.inspection_date),'')='' ";
}
if (MainList != "") {
sql1 = sql1 + " and m.contractno in( " + MainList + " ) "; //and isnull(dbo.trimdate(m.inspection_date),'')=''
}
sql1 = sql1 + " order by ArrivalDate,ex_sailingdate ";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_FYTZ: function (HTH) { //费用通知_无过程
//var basicForm = this.formEdit.getForm();
var MainList = "";
var selectedRecords = [];
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
selectedRecords = this.gridList.selModel.getSelection();
}
if (_p == "page_2") {
selectedRecords = this.gridList_single.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;
}
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 getmoneydate = GetDateStr(5);
var printType = 'XXH_CW_FYTZ'; //费用通知单 无过程
//
var sql1 = " select m.contractno,m.HTH,c.id,c.FactoryNo,case [ArrivalDate] when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar,[ArrivalDate],23) end as ArrivalDate, ";
sql1 = sql1 + " (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) as portRef, ";
sql1 = sql1 + " c.name,c.weight/1000 as weight_1,c.weight as weight_2,c.boxcount, ";
sql1 = sql1 + " case when (c.price_limit>c.price and c.price_limit>c.price_agio) then c.price_limit ";
sql1 = sql1 + " when (c.price>c.price_agio) then c.price else c.price_agio end price, ";
sql1 = sql1 + "c.amount,m.billno,m.containerno,m.sealno,m.buyer, ";
sql1 = sql1 + " (select cc.codename from code_currency cc where cc.gid=(select top 1 c1.currid from import_cargo c1 where c1.contractno=m.contractno)) currency, ";
sql1 = sql1 + " (select sum(c2.prepayments) from import_cargo c2 where c2.contractno=m.contractno) prepayments ";
sql1 = sql1 + " , (select u.showname from [user] u where u.codename=m.creator) creatorref, ";
sql1 = sql1 + " c.balance, dbo.get_Fee(m.contractno,'尾款',1)+dbo.get_Fee(m.contractno,'购货款',1) RMBbalance, ";
sql1 = sql1 + " c.exchangerate exchange,c.exchangerate_customs exchange_customs, c.tax_amount, ";
sql1 = sql1 + " (select sum(c1.[weight]) from import_cargo c1 where c1.contractno=m.contractno)/1000 M_weight, ";
sql1 = sql1 + " c.tax, c.tax_zz, c.baolv, c.tax_1, c.tax_zz_1,dbo.f_amount(m.contractno) M_Amount, ";
sql1 = sql1 + " (select top 1 c1.unitprice from ch_fee c1 where c1.bsno=m.contractno and c1.feename='代理费' and c1.feetype=1) daili, ";
sql1 = sql1 + " dbo.get_Fee(m.contractno,'代理费',1) daili_1,dbo.get_Fee(m.contractno,'拖车费',1) tuoche,dbo.get_Fee(m.contractno,'THC',1) THC ";
sql1 = sql1 + " ,case (select max(m2.paydate) from import_main m2 where m.contractno in(" + MainList + ")) when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar,paydate,23) end as paydate ";
sql1 = sql1 + " ,substring(cc.country,0,(charindex('(',cc.country)) ) as country ";
sql1 = sql1 + " from import_main m left join import_cargo c on c.contractno=m.contractno ";
sql1 = sql1 + " left join code_country cc on cc.countryid=m.countryid ";
sql1 = sql1 + " where m.contractno in(" + MainList + ")";
var sql2 = "select sum(dbo.get_Fee(m.contractno,'代理费',1) +dbo.get_Fee(m.contractno,'拖车费',1)+dbo.get_Fee(m.contractno,'THC',1)) other from import_main m ";
var sql2 = sql2 + " where m.contractno in(" + MainList + ")";
var sql3 = "select prtheadxml3 name,prtheadxml4 ZH,prtheadxml5 YH,ENNAME 英文全名,ADDRESS 地址,ENADDRESS 英文地址,fax 传真,OFFICEPHONE 办公电话 from company where gid=(select top 1 company from import_main where contractno in(" + MainList + "))";
var sql4 = "select '" + SHOWNAME + "' showname,'" + printdate + "' printdate,'" + getmoneydate + "' getmoneydate";
var sql5 = "select sum(dbo.get_Fee(m.contractno,'尾款',1)+dbo.get_Fee(m.contractno,'购货款',1)) RMBbalance, ";
var sql5 = sql5 + "sum(dbo.get_Fee_remark(m.contractno,'手续费','尾',1)+dbo.get_Fee_remark(m.contractno,'手续费','购货',1)) ShouXu, ";
var sql5 = sql5 + "sum(dbo.get_Fee_remark(m.contractno,'电汇费','尾',1)+dbo.get_Fee_remark(m.contractno,'电汇费','购货',1)) DianHui from import_main m where M.contractno in(" + MainList + ") ";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_FYTZ_3: function (HTH) {
var MainList = "";
var selectedRecords = [];
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
selectedRecords = this.gridList.selModel.getSelection();
}
if (_p == "page_2") {
selectedRecords = this.gridList_single.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;
}
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 getmoneydate = GetDateStr(5);
var printType = 'XXH_CW_FYTZ_3'; //费用通知单 尾款 有过程
var sql1 = " select m.contractno,m.HTH,c.id,c.FactoryNo,case [ArrivalDate] when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar,[ArrivalDate],23) end as ArrivalDate, ";
sql1 = sql1 + " (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) as portRef, ";
sql1 = sql1 + " c.name,c.weight/1000 as weight_1,c.weight as weight_2,c.boxcount, case when c.price_agio=0 then c.price else c.price_agio end as price, "
sql1 = sql1 + " case when (c.price_limit>c.price and c.price_limit>c.price_agio) then c.price_limit ";
sql1 = sql1 + " when (c.price>c.price_agio) then c.price else c.price_agio end tax_price,c.amount,m.billno,m.containerno,m.sealno, ";
sql1 = sql1 + " (select cc.codename from code_currency cc where cc.gid=(select top 1 c1.currid from import_cargo c1 where c1.contractno=m.contractno)) currency, ";
sql1 = sql1 + " (select sum(c2.prepayments) from import_cargo c2 where c2.contractno=m.contractno) prepayments , (select u.showname from [user] u where u.codename=m.creator) creatorref, ";
sql1 = sql1 + " c.balance, ";
sql1 = sql1 + " c.exchangerate exchange,c.exchangerate_customs exchange_customs,m.buyer, ";
sql1 = sql1 + " case when c.tax_amount>c.amount then c.tax_amount else c.amount end as tax_amount, ";
sql1 = sql1 + " (select sum(c1.[weight]) from import_cargo c1 where c1.contractno=m.contractno)/1000 M_weight, ";
sql1 = sql1 + " c.tax, c.tax_zz, c.baolv, c.tax_1, c.tax_zz_1,dbo.f_amount(m.contractno) M_Amount, ";
sql1 = sql1 + " (select top 1 c1.unitprice from ch_fee c1 where c1.bsno=m.contractno and c1.feename='代理费' and c1.feetype=1) daili, ";
sql1 = sql1 + " dbo.get_Fee(m.contractno,'代理费',1) daili_1,dbo.get_Fee(m.contractno,'拖车费',1) tuoche,dbo.get_Fee(m.contractno,'THC',1) THC ";
sql1 = sql1 + " ,case (select max(m2.paydate) from import_main m2 where m.contractno in(" + MainList + ")) when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar,paydate,23) end as paydate ";
//var sql1 = sql1 + " ,(dbo.get_Fee_remark(m.contractno,'手续费','尾',1)+dbo.get_Fee_remark(m.contractno,'手续费','购货',1)) ShouXu ";
//var sql1 = sql1 + " ,(dbo.get_Fee_remark(m.contractno,'电汇费','尾',1)+dbo.get_Fee_remark(m.contractno,'电汇费','购货',1)) ShouXu ";
sql1 = sql1 + " ,substring(cc.country,0,(charindex('(',cc.country)) ) as country ";
sql1 = sql1 + " from import_main m left join import_cargo c on c.contractno=m.contractno ";
sql1 = sql1 + " left join code_country cc on cc.countryid=m.countryid ";
sql1 = sql1 + " where m.contractno in(" + MainList + ")";
var sql2 = "select sum(dbo.get_Fee(m.contractno,'代理费',1) +dbo.get_Fee(m.contractno,'拖车费',1)+dbo.get_Fee(m.contractno,'THC',1)) other ";
var sql2 = sql2 + ",sum(dbo.get_Fee_remark(m.contractno,'手续费','尾',1)+dbo.get_Fee_remark(m.contractno,'手续费','购货',1)) ShouXu, ";
var sql2 = sql2 + "sum(dbo.get_Fee_remark(m.contractno,'电汇费','尾',1)+dbo.get_Fee_remark(m.contractno,'电汇费','购货',1)) DianHui ";
var sql2 = sql2 + " from import_main m where M.contractno in(" + MainList + ") ";
var sql3 = "select prtheadxml3 name,prtheadxml4 ZH,prtheadxml5 YH,ENNAME 英文全名,ADDRESS 地址,ENADDRESS 英文地址,fax 传真,OFFICEPHONE 办公电话 from company where gid=(select top 1 company from import_main where contractno in(" + MainList + "))";
var sql4 = "select '" + SHOWNAME + "' showname,'" + printdate + "' printdate,'" + getmoneydate + "' getmoneydate";
var sql5 = "select sum(dbo.get_Fee(m.contractno,'尾款',1)+dbo.get_Fee(m.contractno,'购货款',1)) RMBbalance, ";
var sql5 = sql5 + "sum(dbo.get_Fee_remark(m.contractno,'手续费','尾',1)+dbo.get_Fee_remark(m.contractno,'手续费','购货',1)) ShouXu, ";
var sql5 = sql5 + "sum(dbo.get_Fee_remark(m.contractno,'电汇费','尾',1)+dbo.get_Fee_remark(m.contractno,'电汇费','购货',1)) DianHui from import_main m where M.contractno in(" + MainList + ") ";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_FYTZ_4: function (HTH) {
var MainList = "";
var selectedRecords = [];
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
selectedRecords = this.gridList.selModel.getSelection();
}
if (_p == "page_2") {
selectedRecords = this.gridList_single.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;
}
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 getmoneydate = GetDateStr(5);
var printType = 'XXH_CW_FYTZ_4'; //费用通知单 预付
var sql1 = " select m.contractno,m.HTH,c.id,c.FactoryNo,case [Ex_sailingDate] when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar,[Ex_sailingDate],23) end as Ex_sailingDate, ";
sql1 = sql1 + " (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) as portRef, ";
sql1 = sql1 + " c.name,c.weight/1000 as weight_1,c.weight as weight_2,c.boxcount, case when c.price_agio=0 then c.price else c.price_agio end as price,";
sql1 = sql1 + " case when c.price_limit>c.price then c.price_limit else c.price end tax_price,c.amount,m.billno,m.containerno,m.sealno, ";
sql1 = sql1 + " (select cc.codename from code_currency cc where cc.gid=(select top 1 c1.currid from import_cargo c1 where c1.contractno=m.contractno)) currency, ";
sql1 = sql1 + " (select sum(c2.prepayments) from import_cargo c2 where c2.contractno=m.contractno) HT_prepayments,c.prepayments, (select u.showname from [user] u where u.codename=m.creator) creatorref, ";
sql1 = sql1 + " m.buyer, dbo.get_Fee(m.contractno,'预付款',1) RMBprepayments,";
sql1 = sql1 + " c.exchangerate exchange,c.exchangerate_customs exchange_customs, ";
sql1 = sql1 + " case when c.tax_amount>c.amount then c.tax_amount else c.amount end as tax_amount, ";
sql1 = sql1 + " (select sum(c1.[weight]) from import_cargo c1 where c1.contractno=m.contractno)/1000 M_weight, ";
sql1 = sql1 + " c.tax, c.tax_zz, c.baolv, c.tax_1, c.tax_zz_1,dbo.f_amount(m.contractno) M_Amount, ";
sql1 = sql1 + " (select sum(c2.amount) from ch_fee c2 where c2.bsno=m.contractno and c2.feename ='电汇费' and c2.remark ='预付款电汇费') dianhui, ";
sql1 = sql1 + " dbo.get_Fee(m.contractno,'代理费',1) daili_1,dbo.get_Fee(m.contractno,'拖车费',1) tuoche,dbo.get_Fee(m.contractno,'THC',1) THC ";
sql1 = sql1 + " ,case (select max(m2.paydate) from import_main m2 where m.contractno in(" + MainList + ")) when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar,paydate,23) end as paydate ";
sql1 = sql1 + " ,substring(cc.country,0,(charindex('(',cc.country)) ) as country ";
sql1 = sql1 + " from import_main m left join import_cargo c on c.contractno=m.contractno ";
sql1 = sql1 + " left join code_country cc on cc.countryid=m.countryid ";
sql1 = sql1 + " where m.contractno in(" + MainList + ") ";
var sql2 = "select sum(c.amount) Total from import_main m ";
var sql2 = sql2 + " left join ch_fee c on c.bsno=m.contractno ";
var sql2 = sql2 + " where c.bsno in(" + MainList + ") ";
var sql2 = sql2 + " and (c.feename='预付款' or (c.feename='手续费' and c.remark='预付款手续费') ";
var sql2 = sql2 + " or (c.feename='电汇费' and c.remark='预付款电汇费') ) ";
var sql2 = sql2 + " and c.feetype=1 ";
var sql3 = "select prtheadxml3 name,prtheadxml4 ZH,prtheadxml5 YH,ENNAME 英文全名,ADDRESS 地址,ENADDRESS 英文地址,fax 传真,OFFICEPHONE 办公电话 from company where gid=(select top 1 company from import_main where contractno in(" + MainList + "))";
var sql4 = "select '" + SHOWNAME + "' showname,'" + printdate + "' printdate,'" + getmoneydate + "' getmoneydate";
var sql5 = "select sum(dbo.get_Fee(m.contractno,'预付款',1)) RMBprepayments from import_main m where M.contractno in(" + MainList + ") ";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_FYTZ_TJ: function (HTH) { //尾款_天津
//var basicForm = this.formEdit.getForm();
var MainList = "";
var selectedRecords = [];
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
selectedRecords = this.gridList.selModel.getSelection();
}
if (_p == "page_2") {
selectedRecords = this.gridList_single.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;
}
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 getmoneydate = GetDateStr(5);
var printType = 'XXH_CW_FYTZ_TJ'; //费用通知单 无过程 天津
var sql1 = " select m.contractno,m.HTH,c.id,c.FactoryNo,dbo.trimdate(Ex_sailingDate) as Ex_sailingDate,dbo.trimdate(ArrivalDate) as ArrivalDate, ";
sql1 = sql1 + " (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) as portRef, ";
sql1 = sql1 + " c.name,c.weight/1000 as weight_1,c.weight as weight_2,c.boxcount, case when c.price_agio=0 then c.price else c.price_agio end as price,";
sql1 = sql1 + " case when c.price_limit>c.price then c.price_limit else c.price end tax_price,c.amount,m.billno,m.containerno,m.sealno, ";
sql1 = sql1 + " (select cc.codename from code_currency cc where cc.gid=(select top 1 c1.currid from import_cargo c1 where c1.contractno=m.contractno)) currency, ";
sql1 = sql1 + " (select sum(c2.prepayments) from import_cargo c2 where c2.contractno=m.contractno) prepayments, (select u.showname from [user] u where u.codename=m.creator) creatorref, ";
sql1 = sql1 + " m.buyer,(select sum(c2.balance) from import_cargo c2 where c2.contractno=m.contractno) balance, dbo.get_Fee(m.contractno,'尾款',1)+dbo.get_Fee(m.contractno,'购货款',1) RMBBalance,";
sql1 = sql1 + " c.exchangerate exchange,c.exchangerate_customs exchange_customs, ";
sql1 = sql1 + " case when c.tax_amount>c.amount then c.tax_amount else c.amount end as tax_amount, ";
sql1 = sql1 + " (select sum(c1.[weight]) from import_cargo c1 where c1.contractno=m.contractno)/1000 M_weight, ";
sql1 = sql1 + " c.tax, c.tax_zz, c.baolv, c.tax_1, c.tax_zz_1,dbo.f_amount(m.contractno) M_Amount, ";
sql1 = sql1 + " (select sum(c2.amount) from ch_fee c2 where c2.bsno=m.contractno and c2.feename ='电汇费' and c2.remark ='尾款电汇费') dianhui, ";
sql1 = sql1 + " dbo.get_Fee(m.contractno,'代理费',1) daili_1,(select max(unitprice) from ch_fee where feename='代理费' and feetype=1 and bsno=m.contractno) daili_unitprice";
sql1 = sql1 + " ,dbo.get_Fee(m.contractno,'拖车费',1) tuoche,dbo.get_Fee(m.contractno,'THC',1) THC,dbo.get_Fee(m.contractno,'商检验货费',1) SJYHF ";
sql1 = sql1 + " ,case (select max(m2.paydate) from import_main m2 where m.contractno in(" + MainList + ")) when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar,paydate,23) end as paydate ";
sql1 = sql1 + " ,substring(cc.country,0,(charindex('(',cc.country)) ) as country ";
sql1 = sql1 + " from import_main m left join import_cargo c on c.contractno=m.contractno ";
sql1 = sql1 + " left join code_country cc on cc.countryid=m.countryid ";
sql1 = sql1 + " where m.contractno in(" + MainList + ") ";
//var sql2 = "select sum(dbo.get_Fee(m.contractno,'代理费',1) +dbo.get_Fee(m.contractno,'拖车费',1)+dbo.get_Fee(m.contractno,'THC',1)+dbo.get_Fee(m.contractno,'商检验货费',1)) other from import_main m ";
//var sql2 = sql2 + " where m.contractno in(" + MainList + ")";
var sql2 = "select sum(c.amount) Total from import_main m ";
var sql2 = sql2 + " left join ch_fee c on c.bsno=m.contractno ";
var sql2 = sql2 + " where m.contractno in(" + MainList + ") ";
var sql2 = sql2 + " and (c.feename='尾款' or c.feename='关税' or c.feename='增值税' or c.feename='购货款' or (c.feename='手续费' and c.remark='尾款手续费') ";
var sql2 = sql2 + " or (c.feename='电汇费' and c.remark='尾款电汇费') or c.feename='代理费' or c.feename='拖车费' or c.feename='THC' or c.feename='商检验货费' ) ";
var sql2 = sql2 + " and c.feetype=1 ";
var sql3 = "select prtheadxml3 name,prtheadxml4 ZH,prtheadxml5 YH,ENNAME 英文全名,ADDRESS 地址,ENADDRESS 英文地址,fax 传真,OFFICEPHONE 办公电话 from company where gid=(select top 1 company from import_main where contractno in(" + MainList + "))";
var sql4 = "select '" + SHOWNAME + "' showname,'" + printdate + "' printdate,'" + getmoneydate + "' getmoneydate";
var sql5 = "select m.contractno,sum(dbo.get_Fee(m.contractno,'尾款',1)+dbo.get_Fee(m.contractno,'购货款',1)) RMBbalance ";
var sql5 = sql5 + " from import_main m where M.contractno in(" + MainList + ") group by m.contractno order by M.contractno";
var sql6 = "select sum(c.balance) balance from import_main m ";
var sql6 = sql6 + " left join import_cargo c on c.contractno=m.contractno ";
var sql6 = sql6 + " where m.contractno in(" + MainList + ") ";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_FYTZ_TJ_2: function (HTH) {//天津 尾款 无税/杂费
var MainList = "";
var selectedRecords = [];
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
selectedRecords = this.gridList.selModel.getSelection();
}
if (_p == "page_2") {
selectedRecords = this.gridList_single.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;
}
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 getmoneydate = GetDateStr(5);
var printType = 'XXH_CW_FYTZ_TJ_2'; //费用通知单 天津 尾款 无税/杂费
var sql1 = " select m.contractno,m.HTH,c.id,c.FactoryNo,dbo.trimdate(Ex_sailingDate) as Ex_sailingDate,dbo.trimdate(ArrivalDate) as ArrivalDate, ";
sql1 = sql1 + " (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) as portRef, ";
sql1 = sql1 + " c.name,c.weight/1000 as weight_1,c.weight as weight_2,c.boxcount, case when c.price_agio=0 then c.price else c.price_agio end as price,";
sql1 = sql1 + " case when c.price_limit>c.price then c.price_limit else c.price end tax_price,c.amount,m.billno,m.containerno,m.sealno, ";
sql1 = sql1 + " (select cc.codename from code_currency cc where cc.gid=(select top 1 c1.currid from import_cargo c1 where c1.contractno=m.contractno)) currency, ";
sql1 = sql1 + " (select sum(c2.prepayments) from import_cargo c2 where c2.contractno=m.contractno) prepayments, (select u.showname from [user] u where u.codename=m.creator) creatorref, ";
sql1 = sql1 + " m.buyer,(select sum(c2.balance) from import_cargo c2 where c2.contractno=m.contractno) balance, dbo.get_Fee(m.contractno,'尾款',1)+dbo.get_Fee(m.contractno,'购货款',1) RMBBalance,";
sql1 = sql1 + " c.exchangerate exchange,c.exchangerate_customs exchange_customs, ";
sql1 = sql1 + " case when c.tax_amount>c.amount then c.tax_amount else c.amount end as tax_amount, ";
sql1 = sql1 + " (select sum(c1.[weight]) from import_cargo c1 where c1.contractno=m.contractno)/1000 M_weight, ";
sql1 = sql1 + " c.tax, c.tax_zz, c.baolv, c.tax_1, c.tax_zz_1,dbo.f_amount(m.contractno) M_Amount, ";
sql1 = sql1 + " (select sum(c2.amount) from ch_fee c2 where c2.bsno=m.contractno and c2.feename ='电汇费' and c2.remark ='尾款电汇费') dianhui, ";
sql1 = sql1 + " dbo.get_Fee(m.contractno,'代理费',1) daili_1,dbo.get_Fee(m.contractno,'拖车费',1) tuoche,dbo.get_Fee(m.contractno,'THC',1) THC ";
sql1 = sql1 + " ,case (select max(m2.paydate) from import_main m2 where m.contractno in(" + MainList + ")) when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar,paydate,23) end as paydate ";
sql1 = sql1 + " ,substring(cc.country,0,(charindex('(',cc.country)) ) as country ";
sql1 = sql1 + " from import_main m left join import_cargo c on c.contractno=m.contractno ";
sql1 = sql1 + " left join code_country cc on cc.countryid=m.countryid ";
sql1 = sql1 + " where m.contractno in(" + MainList + ") ";
var sql2 = "select sum(c.amount) Total from import_main m ";
sql2 = sql2 + " left join ch_fee c on c.bsno=m.contractno ";
sql2 = sql2 + " where m.contractno in(" + MainList + ") ";
sql2 = sql2 + " and (c.feename='尾款' or (c.feename='手续费' and c.remark='尾款手续费') ";
sql2 = sql2 + " or (c.feename='电汇费' and c.remark='尾款电汇费') ) ";
sql2 = sql2 + " and c.feetype=1 ";
var sql3 = "select prtheadxml3 name,prtheadxml4 ZH,prtheadxml5 YH,ENNAME 英文全名,ADDRESS 地址,ENADDRESS 英文地址,fax 传真,OFFICEPHONE 办公电话 from company where gid=(select top 1 company from import_main where contractno in(" + MainList + "))";
var sql4 = "select '" + SHOWNAME + "' showname,'" + printdate + "' printdate,'" + getmoneydate + "' getmoneydate";
var sql5 = "select sum(dbo.get_Fee(m.contractno,'尾款',1)) RMBbalance,(select sum(c2.balance) from import_cargo c2 where c2.contractno=m.contractno) balance from import_main m where M.contractno in(" + MainList + ") group by m.contractno";
var sql6 = "select sum(c.balance) balance from import_main m ";
sql6 = sql6 + " left join import_cargo c on c.contractno=m.contractno ";
sql6 = sql6 + " where m.contractno in(" + MainList + ") ";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_BJCNS: function () { //报检承诺书
var MainList = "";
var selectedRecords = [];
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
selectedRecords = this.gridList.selModel.getSelection();
}
if (_p == "page_2") {
selectedRecords = this.gridList_single.selModel.getSelection();
}
var contractno = "";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "" + rec.get('cgid') + ""; }
else {
MainList = MainList + "," + rec.get('cgid') + "";
}
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;
}
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 = " DECLARE @tl as tp_cargolist ";
var sql1 = sql1 + " insert into @tl select id from Import_cargo where id in(" + MainList + ") ";
var sql1 = sql1 + " exec sum_cargoname @tl ";
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 ='" + contractno + "' ";
var sql4 = "";
var sql5 = "";
var sql6 = "";
//var sql6 = sql6 + "";
//var sql6 = sql6 + "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_RKTZ: function () { //入库通知
var MainList = "";
var selectedRecords = [];
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
selectedRecords = this.gridList.selModel.getSelection();
}
if (_p == "page_2") {
selectedRecords = this.gridList_single.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;
}
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_RKTZ'; //入库单
var sql1 = " select m.hth,m.containerno,c.name,m.buyer, ";
sql1 = sql1 + " (select top 1 innum from import_kc where ContractNo=m.ContractNo ";
sql1 = sql1 + " and CZState=1 and c.id=cargo_id order by czdate) goodscount,c.[weight] ";
sql1 = sql1 + " ,(select top 1 dbo.trimdate(czdate) from import_kc where ContractNo=m.ContractNo ";
sql1 = sql1 + " and CZState=1 and c.id=cargo_id order by czdate) czdate ";
sql1 = sql1 + " ,(select top 1 kfstate from import_kc where ContractNo=m.ContractNo ";
sql1 = sql1 + " and CZState=1 and c.id=cargo_id order by czdate) kf from Import_main m ";
sql1 = sql1 + " left join Import_cargo c on c.contractno=m.contractno ";
sql1 = sql1 + " where m.contractno in(" + MainList + ") ";
var sql2 = "select '" + SHOWNAME + "' showname,'" + printdate + "' printdate";
var sql3 = " select m.hth,m.containerno,c.name,m.buyer,case k.CZState when 1 then K.innum when 3 then k.outnum end goodscount,c.[weight] ";
sql3 = sql3 + " ,k.czdate,case k.CZState when 1 then '入库' when 3 then '出库' end CZState ";
sql3 = sql3 + ",k.kfstate kf from Import_KC k ";
sql3 = sql3 + "left join Import_cargo c on c.contractno=k.contractno ";
sql3 = sql3 + "left join Import_main m on m.contractno=k.contractno ";
sql3 = sql3 + "where k.contractno in(" + MainList + ") and k.CZState in (1,3) order by k.contractno,k.czdate";
//var sql3 = sql3 + " where m.contractno in(" + MainList + ") ";
var sql4 = "";
var sql5 = "";
var sql6 = "";
sql6 = sql6 + "";
sql6 = sql6 + "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_WLDZ: function () { //往来对账_张春燕
var MainList = "";
var MainListString = "";
var selectedRecords = [];
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
selectedRecords = this.gridList.selModel.getSelection();
}
if (_p == "page_2") {
selectedRecords = this.gridList_single.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') + "";
}
}
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_WLDZ'; //往来对账_张春燕
// var form = this.formSearch.getForm();
// var Audittime_min = form.findField('Audittime_min').getRawValue();
// var Audittime_max = form.findField('Audittime_max').getRawValue();
// if (Audittime_min == "" || Audittime_max == "") {
// alert("请通过‘审单时间’来确定结费时间区间");
// return;
// }
var sql1 = " ";
var sql1 = sql1 + " select m.hth ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=5 and EnumValueID=M.ShipCompany_id) as ShipCompanyRef, ";
var sql1 = sql1 + " dbo.trimdate(m.arrivaldate) arrivaldate,m.freetime,dbo.trimdate(m.recdate) recdate,m.portdays,";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'购货款','1') ) 购货款, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'购货款','1') ) 购货款未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'预付款','1') ) 预付款, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'预付款','1') ) 预付款未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'尾款','1') ) 尾款, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'尾款','1') ) 尾款未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'关税','1') ) 关税, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'关税','1') ) 关税未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'增值税','1') ) 增值税, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'增值税','1') ) 增值税未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'代理费','1') ) 代理费, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'代理费','1') ) 代理费未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'码头操作','1') ) 码头操作, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'码头操作','1') ) 码头操作未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'拖车费','1') ) 拖车费, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'拖车费','1') ) 拖车费未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'海关验货费','1') ) 海关验货费, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'海关验货费','1') ) 海关验货费未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'商检验货费','1') ) 商检验货费, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'商检验货费','1') ) 商检验货费未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'滞箱费','1') ) 滞箱费, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'滞箱费','1') ) 滞箱费未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'滞期费','1') ) 滞期费, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'滞期费','1') ) 滞期费未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'滞报金','1') ) 滞报金, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'滞报金','1') ) 滞报金未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'超期制冷费','1') ) 超期制冷费, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'超期制冷费','1') ) 超期制冷费未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'转栈费','1') ) 转栈费, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'转栈费','1') ) 转栈费未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'修箱费','1') ) 修箱费, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'修箱费','1') ) 修箱费未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'洗箱费','1') ) 洗箱费, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'洗箱费','1') ) 洗箱费未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'出入库费','1') ) 出入库费, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'出入库费','1') ) 出入库费未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'冷藏费','1') ) 冷藏费, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'冷藏费','1') ) 冷藏费未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'陆运费','1') ) 陆运费, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'陆运费','1') ) 陆运费未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'倒柜费','1') ) 倒柜费, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'倒柜费','1') ) 倒柜费未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'运费','1') ) 运费, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'运费','1') ) 运费未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'检疫费','1') ) 检疫费, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'检疫费','1') ) 检疫费未结, ";
var sql1 = sql1 + " (select isnull(amount,0) from dbo.get_fee_table(M.contractno,'标签费','1') ) 标签费, ";
var sql1 = sql1 + " (select isnull(settlement,0) from dbo.get_fee_table(M.contractno,'标签费','1') ) 标签费未结 ";
var sql1 = sql1 + " ,dbo.rpt_DoamountFee_Other(M.ContractNo,1,1) 其他";
//substring(cc.country,1,charindex('(' ,cc.country )-1) country
var sql1 = sql1 + " ,convert(numeric(16,2),substring(dbo.rpt_DoamountFee_Other(M.ContractNo,1,1), ";
var sql1 = sql1 + " charindex('共计' ,dbo.rpt_DoamountFee_Other(M.ContractNo,1,1) )+2,10)) 其他合计 ";
var sql1 = sql1 + " ,convert(numeric(16,2),substring(dbo.rpt_DoamountFee_Other(M.ContractNo,1,2), ";
var sql1 = sql1 + " charindex('共计' ,dbo.rpt_DoamountFee_Other(M.ContractNo,1,2) )+2,10)) 其他已结合计";
var sql1 = sql1 + " from import_main m where m.id in (" + MainList + ") ";
var sql2 = "select '" + SHOWNAME + "' showname,'" + printdate + "' printdate";
var sql3 = " select AMOUNTRMB,billno,ahsr_money, PREPAY_MONEY,ADVANCE_MONEY,ACCOUNTS_MONEY,settletime from ch_fee_settlement cfs ";
// 来了多少人民币,结算单,从这次来的里面的多少钱,转入预付, 从预付中取用 实际结算
var sql3 = sql3 + "where billno in(select DISTINCT billno from ch_fee_do ";
var sql3 = sql3 + "where feeid in(select distinct gid from ch_fee where BSNO in (select contractno from import_main where id in(" + MainList + "))) ";
var sql3 = sql3 + "and (category=1 or category=2 or category=8 or category=9 ) and FEETYPE=1) ";
var sql4 = "";
var sql5 = "";
var sql6 = "";
var sql6 = sql6 + "";
var sql6 = sql6 + "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_WLDZ2: function () { //往来对账2
var MainList = "";
var MainListString = "";
var selectedRecords = [];
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
selectedRecords = this.gridList.selModel.getSelection();
}
if (_p == "page_2") {
selectedRecords = this.gridList_single.selModel.getSelection();
}
/*
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') + "''";
}
}*/
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = rec.get('id'); }
else {
MainList = MainList + "," + rec.get('id') + "";
}
}
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_WLDZ2'; //往来对账_通用
// var form = this.formSearch.getForm();
// var Audittime_min = form.findField('Audittime_min').getRawValue();
// var Audittime_max = form.findField('Audittime_max').getRawValue();
// if (Audittime_min == "" || Audittime_max == "") {
// alert("请通过‘审单时间’来确定结费时间区间");
// return;
// }
var sql1 = " select buyer,hth,ContainerNo,convert(numeric(18,4),(select sum(weight) from import_cargo where ContractNo=m.ContractNo)/1000) [weight],m.ArrivalDate ";
sql1 = sql1 + ",(select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and feename in('购货款','预付款','尾款','购货差额','电汇费','手续费','汇兑损益')) ";
sql1 = sql1 + " -isnull((select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=2 and CUSTOMERNAME=m.buyer and feename in('购货款','预付款','尾款','购货差额','电汇费','手续费','汇兑损益')),0) 应收货款 ";
sql1 = sql1 + ",(select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and (feename ='尾款' or (feename in('电汇费','手续费') and (remark like '%尾款电汇费%' or remark like '%尾款手续费%')))) ";
sql1 = sql1 + " -isnull((select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=2 and CUSTOMERNAME=m.buyer and feename in('尾款')),0) 应收尾款 ";
sql1 = sql1 + ",(select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and (feename ='预付款' or (feename in('电汇费','手续费') and (remark like '%预付款电汇费%' or remark like '%预付款手续费%')))) ";
sql1 = sql1 + " -isnull((select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=2 and CUSTOMERNAME=m.buyer and feename in('预付款')),0) 应收预付款 ";
sql1 = sql1 + " ,isnull((select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and feename in('关税','增值税','补税')),0) ";
sql1 = sql1 + " -isnull((select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=2 and feename in('退税')),0) 应收税金 ";
sql1 = sql1 + " ,(select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and feename in('代理费')) 应收代理费 ";
sql1 = sql1 + " ,(select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and feename in('滞箱费')) 应收滞箱费 ";
sql1 = sql1 + " ,(select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and CUSTOMERNAME=m.buyer and feename in('超期制冷费')) 应收超期制冷费 ";
sql1 = sql1 + " ,(select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and feename in('修箱费')) 应收修箱费 ";
sql1 = sql1 + " ,(select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and feename in('洗箱费')) 应收洗箱费 ";
sql1 = sql1 + " ,(select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and feename ";
sql1 = sql1 + " not in('购货款','预付款','尾款','购货差额','电汇费','手续费','汇兑损益','关税','增值税','补税','退税','代理费','滞箱费','超期制冷费','修箱费','洗箱费')) 应收杂费 ";
sql1 = sql1 + " ,(select sum(SETTLEMENT) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and feename in('购货款','预付款','尾款','购货差额','电汇费','手续费','汇兑损益')) ";
sql1 = sql1 + " -isnull((select sum(SETTLEMENT) from ch_Fee where bsno=m.ContractNo and FEETYPE=2 and CUSTOMERNAME=m.buyer and feename in('购货款','预付款','尾款','购货差额','电汇费','手续费','汇兑损益')),0) 已收货款 ";
sql1 = sql1 + " ,isnull((select sum(SETTLEMENT) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and feename in('关税','增值税','补税')),0) ";
sql1 = sql1 + " -isnull((select sum(SETTLEMENT) from ch_Fee where bsno=m.ContractNo and FEETYPE=2 and CUSTOMERNAME=m.buyer and feename in('退税')),0) 已收税金 ";
sql1 = sql1 + " ,(select sum(SETTLEMENT) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and feename in('代理费')) 已收代理费 ";
sql1 = sql1 + " ,(select sum(SETTLEMENT) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and feename in('滞箱费')) 已收滞箱费 ";
sql1 = sql1 + " ,(select sum(SETTLEMENT) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and CUSTOMERNAME=m.buyer and feename in('超期制冷费')) 已收超期制冷费 ";
sql1 = sql1 + " ,(select sum(SETTLEMENT) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and feename in('修箱费')) 已收修箱费 ";
sql1 = sql1 + " ,(select sum(SETTLEMENT) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and feename in('洗箱费')) 已收洗箱费 ";
sql1 = sql1 + " ,(select sum(SETTLEMENT) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and feename ";
sql1 = sql1 + " not in('购货款','预付款','尾款','购货差额','电汇费','手续费','汇兑损益','关税','增值税','补税','退税','代理费','滞箱费','超期制冷费','修箱费','洗箱费')) 已收杂费 ";
sql1 = sql1 + " ,(select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=2 and feename in('尾款')) 应付货款";
sql1 = sql1 + " ,(select top 1 currency from ch_Fee where bsno=m.ContractNo and FEETYPE=2 and feename in('尾款')) 应付货款币别";
sql1 = sql1 + " ,(select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=2 and feename in('预付款')) 应付预付款";
sql1 = sql1 + " ,(select top 1 currency from ch_Fee where bsno=m.ContractNo and FEETYPE=2 and feename in('预付款')) 应付预付款币别";
sql1 = sql1 + " ,dbo.trimdate(m.arrivaldate) 到港日";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=6 and EnumValueID=M.Billtype) as 提单提交方式 ";
sql1 = sql1 + " ,comp.name as 用证公司,substring(cc.country,0,(charindex('(',cc.country)) ) as 进口国 ,dbo.f_FactoryNo(M.contractno) 厂号, dbo.f_str(M.contractno) 品名";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) 目的港";
sql1 = sql1 + " ,(select top 1 dbo.trimdate(enterdate) from ch_fee where feename='预付款' and feetype=1 and bsno=M.contractno) 预付款时间";
sql1 = sql1 + " ,(select top 1 dbo.trimdate(enterdate) from ch_fee where feename='尾款' and feetype=1 and bsno=M.contractno) 尾款时间";
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 + " where m.id in (" + MainList + ") ";
var sql2 = "select '" + SHOWNAME + "' showname,'" + printdate + "' printdate";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_DZ_SYSH: function () { //对账 圣源商行
var MainList = "";
var MainListString = "";
var selectedRecords = [];
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
selectedRecords = this.gridList.selModel.getSelection();
}
if (_p == "page_2") {
selectedRecords = this.gridList_single.selModel.getSelection();
}
/*
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') + "''";
}
}*/
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = rec.get('id'); }
else {
MainList = MainList + "," + rec.get('id') + "";
}
}
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_DZ_SYSH'; //往来对账_张春燕
// var form = this.formSearch.getForm();
// var Audittime_min = form.findField('Audittime_min').getRawValue();
// var Audittime_max = form.findField('Audittime_max').getRawValue();
// if (Audittime_min == "" || Audittime_max == "") {
// alert("请通过‘审单时间’来确定结费时间区间");
// return;
// }
var sql1 = " select buyer,dbo.trimdate(M.arrivaldate) 到港日,dbo.trimdate(M.inspection_date) 商检验货日,PortDays 港口天数 ";
sql1 = sql1 + " ,hth 合同号,ContainerNo [箱号],convert(numeric(18,4),(select sum(weight) from import_cargo where ContractNo=m.ContractNo)) [重量KGS] ";
sql1 = sql1 + " ,substring(cc.country,0,(charindex('(',cc.country)) ) 国家,dbo.f_str(m.contractno) 商品名称 ";
sql1 = sql1 + " ,(select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and feename in('代理费')) [代理费] ";
sql1 = sql1 + " ,isnull((select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and feename in('关税','增值税','补税')),0) ";
sql1 = sql1 + " -isnull((select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=2 and feename in('退税')),0) 应收税金 ";
sql1 = sql1 + " ,(select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and feename in('保证金')) [保证金] ";
sql1 = sql1 + " ,(select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and feename in('超期制冷费')) 应收超期制冷费 ";
sql1 = sql1 + " ,(select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and feename in('海关验货费')) 海关验货费 ";
sql1 = sql1 + " ,(select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and feename in('杂费') and ch_Fee.remark like '%慢检调快检%' ) 慢调快 ";
sql1 = sql1 + " ,(select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and feename in('倒柜费') ) 倒柜费 ";
sql1 = sql1 + " ,(select sum(amount) from ch_Fee where bsno=m.ContractNo and FEETYPE=1 and CUSTOMERNAME=m.buyer and feename in('标签费') ) 标签费 ";
sql1 = sql1 + " from Import_main m left join code_country cc on cc.countryid=m.countryid where m.id in (" + MainList + ") ";
var sql2 = "select '" + SHOWNAME + "' showname,'" + printdate + "' printdate";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_SBYS: function () { //申报要素_曹青
var MainList = "";
var MainListString = "";
var selectedRecords = [];
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
selectedRecords = this.gridList.selModel.getSelection();
}
if (_p == "page_2") {
selectedRecords = this.gridList_single.selModel.getSelection();
}
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'" + rec.get('cgid') + "'"; }
//if (MainListString == "") { MainListString = "''" + rec.get('ContractNo') + "''"; }
else {
MainList = MainList + ",'" + rec.get('cgid') + "'";
//MainListString = MainListString + ",''" + rec.get('ContractNo') + "''";
}
}
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(" + MainList + ")";
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(" + MainList + ")";
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') + "'";
}
}*/
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = rec.get('id'); }
else {
MainList = MainList + "," + rec.get('id') + "";
}
}
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.id 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_WLDZ_4s: function () { //往来对账4s
var MainList = "";
var MainListString = "";
var selectedRecords = [];
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
selectedRecords = this.gridList.selModel.getSelection();
}
if (_p == "page_2") {
selectedRecords = this.gridList_single.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') + "";
}
}
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_WLDZ_4s'; //往来对账_四格式
var sql1 = " select hth 合同号,ContainerNo 箱号 ";
sql1 = sql1 + " ,convert(numeric(18,4),(select sum(weight) from import_cargo where ContractNo=M.ContractNo)/1000) [净重(吨)] ";
sql1 = sql1 + " ,dbo.F_CZdate(contractno,1) 入库日期,m.ArrivalDate 到港日,M.RecDate 回空日期 ";
sql1 = sql1 + " ,M.PortDays 在港天数,M.Freetime 免箱期,dbo.f_str(M.ContractNo) 品名 ";
sql1 = sql1 + " ,M.countryid,substring(cc.country,0,(charindex('(',cc.country)) ) 进口国 ";
/*
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','出入库费') 出入库费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','冷藏费') 冷藏费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','分色费')分色费 ";
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','抄码费')抄码费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','返样费')返样费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','清点费')清点费 ";
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','装卸费')装卸费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','搬移费')搬移费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','看货费')看货费 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','出入库费') 出入库费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','冷藏费')冷藏费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','分色费')分色费_已收 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','抄码费')抄码费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','返样费')返样费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','清点费')清点费_已收 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','装卸费')装卸费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','搬移费')搬移费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','看货费')看货费_已收 ";
*/
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','押箱费') 押箱费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','堆存费')+dbo.f_fee(M.ContractNo,M.buyer,'RMB','超期制冷费') 超期制冷费 ";
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','退税') 退税,dbo.f_fee(M.ContractNo,M.buyer,'RMB','滞报金') 滞报金,dbo.f_fee(M.ContractNo,M.buyer,'RMB','海关验货费')+dbo.f_fee(M.ContractNo,M.buyer,'RMB','人工验货费') 海关验货费 ";
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','快递费') 快递费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','海关识封费') 海关识封费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','关税') 关税 ";
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','压车延迟费') 压车延迟费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','港杂费') 港杂费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','检疫票') 检疫票 ";
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','困难作业费') 困难作业费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','舱单更改费') 舱单更改费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','掏箱费') 掏箱费 ";
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','超重罚金') 超重罚金,dbo.f_fee(M.ContractNo,M.buyer,'RMB','检验检疫费') 检验检疫费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','报检费') 报检费 ";
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','商检取样费') 商检取样费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','标签费') 标签费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','转栈费') 转栈费 ";
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','补税') 补税,dbo.f_fee(M.ContractNo,M.buyer,'RMB','代理费')+dbo.f_fee(M.ContractNo,M.buyer,'RMB','进口代理费') 代理费 ";
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','商检鉴定费') 商检鉴定费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','杂费') 杂费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','报关费') 报关费 ";
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','拖车费') 拖车费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','THC') THC,dbo.f_fee(M.ContractNo,M.buyer,'RMB','保证金') 保证金 ";
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','消毒费') 消毒费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','运费') 运费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','滞箱费') 滞箱费 ";
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','洗箱费') 洗箱费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','增值税') 增值税,dbo.f_fee(M.ContractNo,M.buyer,'RMB','水分认证费') 水分认证费 ";
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','转船证明费') 转船证明费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','商检验货费') 商检验货费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','修箱费') 修箱费 ";
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','滞期费') 滞期费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','文件费') 文件费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','倒柜费') 倒柜费 ";
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo, M.buyer, 'RMB', '堆存费') 堆存费 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','押箱费') 押箱费_已收 ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','堆存费')+dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','超期制冷费') 超期制冷费_已收 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','退税') 退税_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','滞报金') 滞报金_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','海关验货费')+dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','人工验货费') 海关验货费_已收 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','快递费') 快递费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','海关识封费') 海关识封费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','关税') 关税_已收 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','压车延迟费') 压车延迟费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','港杂费') 港杂费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','检疫票') 检疫票_已收 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','困难作业费') 困难作业费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','舱单更改费') 舱单更改费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','掏箱费') 掏箱费_已收 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','超重罚金') 超重罚金_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','检验检疫费') 检验检疫费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','报检费') 报检费_已收 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','商检取样费') 商检取样费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','标签费') 标签费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','转栈费') 转栈费_已收 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','补税') 补税_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','代理费')+dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','进口代理费') 代理费_已收 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','商检鉴定费') 商检鉴定费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','杂费') 杂费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','报关费') 报关费_已收 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','拖车费') 拖车费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','THC') THC_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','保证金') 保证金_已收 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','消毒费') 消毒费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','运费') 运费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','滞箱费') 滞箱费_已收 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','洗箱费') 洗箱费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','增值税') 增值税_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','水分认证费') 水分认证费_已收 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','转船证明费') 转船证明费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','商检验货费') 商检验货费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','修箱费') 修箱费_已收 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','滞期费') 滞期费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','文件费') 文件费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','倒柜费') 倒柜费_已收 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo, M.buyer, 'RMB', '堆存费') 堆存费_已收 ";
/*
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','汇率损益') 汇率损益,dbo.f_fee(M.ContractNo,M.buyer,'RMB','购货差额') 购货差额,dbo.f_fee(M.ContractNo,M.buyer,'RMB','定金') 定金 ";
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','电汇费') 电汇费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','预付款') 预付款,dbo.f_fee(M.ContractNo,M.buyer,'RMB','手续费') 手续费 ";
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','购货款') 购货款,dbo.f_fee(M.ContractNo,M.buyer,'RMB','尾款') 尾款,dbo.f_fee(M.ContractNo,M.buyer,'RMB','换单费') 换单费 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','汇率损益') 汇率损益_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','购货差额') 购货差额_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','定金') 定金_已收 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','电汇费') 电汇费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','预付款') 预付款_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','手续费') 手续费_已收 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','购货款') 购货款_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','尾款') 尾款_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','换单费') 换单费_已收 ";
sql1 = sql1 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','融资款') 融资款,dbo.f_fee(M.ContractNo,M.buyer,'RMB','利息') 利息 ";
sql1 = sql1 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','融资款') 融资款_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','利息') 利息_已收 ";
*/
sql1 = sql1 + " from import_main M ";
sql1 = sql1 + " left join code_country cc on cc.countryid=m.countryid ";
sql1 = sql1 + " where m.id in (" + MainList + ") ";
var sql2 = "select '" + SHOWNAME + "' showname,'" + printdate + "' printdate";
var sql3 = " select hth 合同号,ContainerNo 箱号 ";
sql3 = sql3 + " ,convert(numeric(18,4),(select sum(weight) from import_cargo where ContractNo=M.ContractNo)/1000) [净重(吨)] ";
sql3 = sql3 + " ,dbo.F_CZdate(contractno,1) 入库日期,m.ArrivalDate 到港日,M.RecDate 回空日期 ";
sql3 = sql3 + " ,M.PortDays 在港天数,M.Freetime 免箱期,dbo.f_str(M.ContractNo) 品名 ";
sql3 = sql3 + " ,M.countryid,substring(cc.country,0,(charindex('(',cc.country)) ) 进口国 ";
sql3 = sql3 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','出入库费') 出入库费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','冷藏费') 冷藏费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','分色费')分色费 ";
sql3 = sql3 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','抄码费')抄码费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','返样费')返样费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','清点费')清点费 ";
sql3 = sql3 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','装卸费')装卸费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','搬移费')搬移费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','看货费')看货费 ";
sql3 = sql3 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','出入库费') 出入库费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','冷藏费')冷藏费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','分色费')分色费_已收 ";
sql3 = sql3 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','抄码费')抄码费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','返样费')返样费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','清点费')清点费_已收 ";
sql3 = sql3 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','装卸费')装卸费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','搬移费')搬移费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','看货费')看货费_已收 ";
sql3 = sql3 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','汇率损益') 汇率损益,dbo.f_fee(M.ContractNo,M.buyer,'RMB','购货差额') 购货差额,dbo.f_fee(M.ContractNo,M.buyer,'RMB','定金') 定金 ";
sql3 = sql3 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','电汇费') 电汇费,dbo.f_fee(M.ContractNo,M.buyer,'RMB','预付款') 预付款,dbo.f_fee(M.ContractNo,M.buyer,'RMB','手续费') 手续费 ";
sql3 = sql3 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','购货款') 购货款,dbo.f_fee(M.ContractNo,M.buyer,'RMB','尾款') 尾款,dbo.f_fee(M.ContractNo,M.buyer,'RMB','换单费') 换单费 ";
sql3 = sql3 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','汇率损益') 汇率损益_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','购货差额') 购货差额_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','定金') 定金_已收 ";
sql3 = sql3 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','电汇费') 电汇费_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','预付款') 预付款_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','手续费') 手续费_已收 ";
sql3 = sql3 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','购货款') 购货款_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','尾款') 尾款_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','换单费') 换单费_已收 ";
sql3 = sql3 + " ,dbo.f_fee(M.ContractNo,M.buyer,'RMB','融资款') 融资款,dbo.f_fee(M.ContractNo,M.buyer,'RMB','利息') 利息 ";
sql3 = sql3 + " ,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','融资款') 融资款_已收,dbo.f_fee_sett(M.ContractNo,M.buyer,'RMB','利息') 利息_已收 ";
sql3 = sql3 + " from import_main M ";
sql3 = sql3 + " left join code_country cc on cc.countryid=m.countryid ";
sql3 = sql3 + " where m.id in (" + MainList + ") ";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_ReceiptList: function () { //单据列表
var MainList = "";
var MainListString = "";
var selectedRecords = [];
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
selectedRecords = this.gridList.selModel.getSelection();
}
if (_p == "page_2") {
selectedRecords = this.gridList_single.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 + " ,m.ClearanceNo 通关单号 ,inspection_no 报检号";
sql1 = sql1 + " ,dbo.f_str(m.contractno) 产品名称";
sql1 = sql1 + " ,substring(c.country,0,(charindex('(',c.country)) ) 国家";
sql1 = sql1 + " ,dbo.f_FactoryNo(m.contractno) 厂号";
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);
},
onSaveClick: function () {
var bodyList = [];
for (i = 0; i < this.storeEditList.getCount(); i += 1) {
var member = this.storeEditList.getAt(i);
bodyList.push(member);
};
var jsonBody = ConvertRecordsToJson(bodyList);
if (jsonBody == '') {
return;
}
if (GID == "") {
alert("登陆信息丢失,请点击退出重新登陆");
return;
}
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/XXH/SaveList',
scope: this,
params: {
data: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//this.storeEditList.commitChanges();
this.onRefreshClick();
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
},
OnClickUploadInfo: function () {
//上传业务信息
var MainList = "";
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
selectedRecords = this.gridList.selModel.getSelection();
}
if (_p == "page_2") {
selectedRecords = this.gridList_single.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') + "";
}
}
if (MainList == "") {
Ext.Msg.show({ title: '错误', msg: '选中至少一个合同', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/XXH/UploadInfo',
scope: this,
params: {
idList: MainList
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
/*var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//this.storeEditList.commitChanges();
//this.onRefreshClick();
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}*/
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
},
OnClickUploadFee: function () {
//商检销售记录
var MainList = "";
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
selectedRecords = this.gridList.selModel.getSelection();
}
if (_p == "page_2") {
selectedRecords = this.gridList_single.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') + "";
}
}
if (MainList == "") {
Ext.Msg.show({ title: '错误', msg: '选中至少一个合同', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/XXH/UploadFee',
scope: this,
params: {
idList: MainList
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
/*var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//this.storeEditList.commitChanges();
//this.onRefreshClick();
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}*/
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
},
Print_YWZL: function () {//业务总览
var MainList = "";
var selectedRecords = [];
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
selectedRecords = this.gridList.selModel.getSelection();
}
if (_p == "page_2") {
selectedRecords = this.gridList_single.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_YWZL'; //业务总览
var T = this.getCondition();
if (T != "") { T = " where " + T; };
var sql1 = " select hth 合同号,comp.NAME 用证公司,substring(cc.country,0,(charindex('(',cc.country)) ) 进口国 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) as 目的港 ";
sql1 = sql1 + " ,c.name 品名,c.cargotype 商品类型 ";
sql1 = sql1 + " ,m.seller,m.buyer,c.weight [净重(kg)] ";
sql1 = sql1 + " ,c.weight 净重合计 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=5 and EnumValueID=M.ShipCompany_id) as 船公司 ";
sql1 = sql1 + " ,m.contractno 合同序列号,dbo.F_factoryno(m.ContractNo) 厂号,TRADINGAGENCY [订货方(中间商)] ";
sql1 = sql1 + " ,(select codename from code_currency where gid=c.currid ) 币别 ";
sql1 = sql1 + " ,c.price 单价,c.amount 合同金额 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=1 and EnumValueID=M.TransactionMethod) as 成交方式 ";
sql1 = sql1 + " ,M.TRADINGAGENCY 付款方式,m.op 操作,m.DeliveryAddress 送货地址 ";
sql1 = sql1 + " ,isnull(dbo.[F_FinanceAmount](m.ContractNo),'') 融资金额 ";
sql1 = sql1 + " ,c.boxcount [箱/件数] ";
sql1 = sql1 + " ,c.boxcount [箱/件数合计] ,c.cargotype 商品种类";
sql1 = sql1 + " ,c.sbys 申报要素,M.Freetime 免箱期 ";
sql1 = sql1 + " ,m.arrivaldate 到港日,dbo.trimdate(m.creattime) 接单日期 ";
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 m.countryid=cc.countryid ";
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 ArrivalDate,ex_sailingdate ";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
, onSetPriceClick: function (button, event) {
var GIdSql = '';
var selectedRecords = this.gridList.selModel.getSelection();
var form = this.formSetPrice.getForm();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.HZSTATUS == "1" || rec.data.HZSTATUS == "6") {
var GID = "'" + rec.data.GID + "'";
if (GIdSql == '') {
GIdSql = GID;
} else {
GIdSql = GIdSql + "," + GID;
}
} else {
alert("不能为提交审核/审核通过的业务设定费率");
return;
}
}
var CargoBody = ConvertRecordsToJsonAll(selectedRecords);
//GIdSql = " (" + GIdSql + ")";
var price = form.findField('price').getValue();
var price_agio = form.findField('price_agio').getValue();
var price_limit = form.findField('price_limit').getValue();
var weight = form.findField('weight').getValue();
var BoxCount = form.findField('BoxCount').getValue();
var Exchangerate = form.findField('Exchangerate').getValue();
var Exchangerate_Customs = form.findField('Exchangerate_Customs').getValue();
var PreProportion = form.findField('PreProportion').getValue();
if (price != "") {
if (parseFloat(price) < 0) {
alert("请输入正数");
return;
}
}
if (price_agio != "") {
if (parseFloat(price_agio) < 0) {
alert("请输入正数");
return;
}
}
if (price_limit != "") {
if (parseFloat(price_limit) < 0) {
alert("请输入正数");
return;
}
}
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Import/PortOperate/SetPrice',
params: {
_price: price,
_price_agio: price_agio,
_price_limit: price_limit,
_weight: weight,
_BoxCount: BoxCount,
_Exchangerate: Exchangerate,
_Exchangerate_Customs: Exchangerate_Customs,
_PreProportion: PreProportion,
CargoBody: CargoBody
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
this.winSetPrice.close();
this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
,
Print_Contract: function () {//打印合同/发票
var MainList = "";
var selectedRecords = [];
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
selectedRecords = this.gridList.selModel.getSelection();
}
if (_p == "page_2") {
selectedRecords = this.gridList_single.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);
}
});