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.

5166 lines
211 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('Shipping');
Shipping.ImportTradeIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.ImportTradeIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.ImportTradeIndex, Ext.Panel, {
PageSize: 100,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
isShowAdvancedQuery: 1, //是否显示高级查询面板
sqlcontext: '',
editype: '',
selectbsno: '',
sortfield: '',
sortdire: '',
remind: null,
ADWinIsOpen: false,
//winAccess: '',
initUIComponents: function () {
this.sqlcontext = "";
this.formname = "formImportTradeIndex"; //页面名称
//定义数据集
this.storectndisp = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CtnDispModel',
proxy: { url: '/CommMng/BasicDataRef/GetCtnDisp' }
});
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'ImportTrademb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Import/ImportTrade/GetDataList_ALL',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region List列表显示信息
Ext.define('Ext.grid.column.Actiontextcolumn', {
extend: 'Ext.grid.column.Column',
alias: ['widget.actiontextcolumn'],
defaultRenderer: function (value) {
var me = this;
prefix = Ext.baseCSSPrefix;
scope = me.origScope || me;
// if (value == "") {
// }
// else
value = value + '<img role="button" src="' + (me.icon || Ext.BLANK_IMAGE_URL)
+ '" class="' + this.iconCls + ' x-action-col-icon"/>';
// value = '<label class="x-action-col-icon">' + value + '</label><img role="button" src="' + (me.icon || Ext.BLANK_IMAGE_URL)
// + '" class="' + this.iconCls + ' x-action-col-icon"/>';
return value;
},
processEvent: function (type, view, cell, recordIndex, cellIndex, e, record, row) {
var me = this;
if (type == 'click') {
me.handler.call(me.scope || me.origScope || me, view, recordIndex, cellIndex, e, record, row);
}
}
});
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
_this = this;
this.initgirdcolums = [
{
dataIndex: 'id', hidden: true,
header: 'id',
width: 80
}, {
dataIndex: 'GID', hidden: true,
header: 'GID',
width: 80
}, {
dataIndex: 'SEQUENCE', hidden: true,
header: 'SEQUENCE',
width: 80
}, {
dataIndex: 'ContractNo', hidden: true,
header: '合同序列号',
width: 80
}, {
dataIndex: 'BSNO', hidden: true,
header: 'BSNO',
width: 80
}, {
dataIndex: 'OPLBNAME', hidden: true,
header: 'OPLBNAME',
width: 80
}, {
dataIndex: 'HTH', align: 'left',
header: '合同号',
width: 80,
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
var _count = getStoreFieldCount(_this.storeList, 'HTH');
return _count;
}
}, {
dataIndex: 'Mainstate', hidden: true,
header: 'Mainstate',
width: 80
}, {
dataIndex: 'MainstateRef', align: 'left',
header: '合同状态',
width: 80
}, {
//sortable: true,
dataIndex: 'WEIGHT_ACT', align: 'right',
header: '实际重量',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}, {
//sortable: true,
dataIndex: 'BOXCOUNT_ACT', align: 'right',
header: '实际件数',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}, {
//sortable: true,
dataIndex: 'UnitRef', align: 'center',
header: '重量单位',
width: 80
}, {
//sortable: true,
dataIndex: 'U_weight', align: 'right',
header: '单据净重(重量单位)',
width: 80
}, {
dataIndex: 'Selled_Ref', align: 'right',
header: '已售(kg)',
width: 80,
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}, summaryType: 'sum'
}, {
//sortable: true,
dataIndex: 'WEIGHT_REMAIN', align: 'right',
header: '待售重量',
width: 80, summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value) {
if (parseFloat(value) <= 0) {
return "<a><font color='#FF0000'> 已经售完 </font></a>";
} else {
return "<a><font color='#0000FF'>" + value + "</font></a>";
}
}
}, {
//sortable: true,
dataIndex: 'BOXCOUNT_REMAIN', align: 'right',
header: '待售件数',
width: 80, summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value) {
if (parseFloat(value) <= 0) {
return "<a><font color='#FF0000'> 已经售完 </font></a>";
} else {
return "<a><font color='#0000FF'>" + value + "</font></a>";
}
}
},{
dataIndex: 'ispinxiang', align: 'left',
header: '是否拼柜',
width: 80,
renderer: function (value) {
if (value == '1') {
return "是";
} else {
return "否";
}
}
}, {
dataIndex: 'Supplier_Billno', align: 'left',
header: '供应商合同号',
width: 80
}, {
dataIndex: 'Other_Billno', align: 'left',
header: '分公司合同号',
width: 80
}, {
dataIndex: 'OP', align: 'left',
header: '操作人',
width: 80
}, {
dataIndex: 'Agent', align: 'left',
header: '代理商',
width: 80
}, {
dataIndex: 'seller', align: 'left',
header: '供应商',
width: 80
}, {
dataIndex: 'buyer', align: 'left',
header: '购货方',
width: 80
}, {
dataIndex: 'Owner_Ref', hidden: true,
header: '当前货权',
width: 80
}, {
dataIndex: 'Buy_Type', align: 'left',
header: '采购类型',
width: 80
}, {
dataIndex: 'Buy_Op', align: 'left',
header: '采购人员',
width: 80
}, {
dataIndex: 'creattime', align: 'left',
header: '合同签订日期',
width: 80
}, {
dataIndex: 'countryid', hidden: true,
header: '国家代码',
width: 80
}, {
dataIndex: 'Country_Ref', align: 'left',
header: '进口国',
width: 80
}, {
dataIndex: 'port', hidden: true,
header: 'port',
width: 80
}, {
dataIndex: 'portRef', align: 'left',
header: '目的港',
width: 80
}, {
dataIndex: 'ShipCompany_id', hidden: true,
header: 'ShipCompany_id',
width: 80
}, {
dataIndex: 'shipcompany_Ref', align: 'left',
header: '船公司',
width: 80
}, {
dataIndex: 'Vessel', align: 'left',
header: '船名',
width: 80
}, {
dataIndex: 'Voyage', align: 'left',
header: '航次',
width: 80
}, {
dataIndex: 'Ex_sailingdate', align: 'left',
header: '预计开船日',
width: 80
}, {
dataIndex: 'Sailingdate', align: 'left',
header: 'ETD',
width: 80
}, {
dataIndex: 'ArrivalDate', align: 'left',
header: 'ETA',
width: 80
}, {
dataIndex: 'BillNo', align: 'left',
header: '提单号',
width: 80
}, {
dataIndex: 'ContainerNo', align: 'left',
header: '箱号',
width: 80
}, {
dataIndex: 'SealNo', align: 'left',
header: '封号',
width: 80
}, {
dataIndex: 'BillTime', align: 'left',
header: '收单据时间',
width: 80
}, {
dataIndex: 'Audittime', align: 'left',
header: '单据确认时间',
width: 80
}, {
dataIndex: 'Receiptremark', align: 'left',
header: '单据问题',
width: 80
}, {
dataIndex: 'Bill_ExpressNo', align: 'left',
header: '单据快递号',
width: 80
}, {
sortable: true,
dataIndex: 'Inspection_Storage',
header: '是否商检慢检',
width: 50,
renderer: function (value) {
if (parseFloat(value) == 0) {
return "<a><font color='#FF0000'></font></a>";
} else {
return "<a><font color='#FF0000'>慢检</font></a>";
}
}
}, {
sortable: true,
dataIndex: 'inspection_date',
header: '商检验货日',
width: 100
}, {
sortable: true,
dataIndex: 'Unsealdate',
header: '商检放行日期',
width: 100
}, {
dataIndex: 'paydate_ref', align: 'left',
header: '向代理商付_预付',
width: 80
}, {
dataIndex: 'paydate_b_ref', align: 'left',
header: '向代理商付_尾款',
width: 80
}, {
dataIndex: 'Agents_paydate', align: 'left',
header: '代理商付汇_预付',
width: 80
}, {
dataIndex: 'Agents_b_paydate', align: 'left',
header: '代理商付汇_尾款',
width: 80
}, {
dataIndex: 'BillTypeREF', align: 'left',
header: '寄单方式',
width: 80
}, {
dataIndex: 'CargoType', align: 'left',
header: '产品类型',
width: 80
}, {
dataIndex: 'CargoName', align: 'left',
header: '产品描述',
width: 80
}, {
dataIndex: 'Ename', align: 'left',
header: '产品描述(英)',
width: 80
}, {
dataIndex: 'WEIGHT_HT', align: 'left',
header: '合同重量', summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}, {
dataIndex: 'BOXCOUNT_HT', align: 'left',
header: '合同件数', summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}, {
dataIndex: 'BoxCount', align: 'left',
header: '单据件数', summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}, {
dataIndex: 'KINDPKGS', align: 'left',
header: '包装',
width: 80
}, {
dataIndex: 'Weight', align: 'right',
header: '单据重量(KG)',
summaryType: 'sum',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 4, '', true);
return value;
},
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 4, '', true);
return value;
},
width: 80
}, {
dataIndex: 'SPECIFICATIONS', align: 'left',
header: '商品规格',
width: 80
}, {
dataIndex: 'weight_Ref', align: 'right',
header: '实际在库重量(吨)', summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}, {
dataIndex: 'Exporter', align: 'left',
header: '生产商',
width: 80
}, {
dataIndex: 'factoryno', align: 'left',
header: '厂号',
width: 80
}, {
dataIndex: 'productiondate_min', align: 'left',
header: '生产日期起',
width: 80
}, {
dataIndex: 'productiondate_max', align: 'left',
header: '生产日期止',
width: 80
}, {
dataIndex: 'ExpirationDate', align: 'left',
header: '保质期',
width: 80
}, {
dataIndex: 'ExpirationDates', align: 'left',
header: '保质天数',
width: 80
}, {
dataIndex: 'TransactionMethodRef', align: 'left',
header: '成交方式',
width: 80
}, {
dataIndex: 'LOCK_EXCHANGERATE', align: 'left',
header: '锁汇',
width: 50,
renderer: function (value) {
if (value == "0") {
return "<a><font color='#333333'>否</font></a>";
} else if (value == "1") {
return "<a><font color='#FF0000'>是</font></a>";
}
}
}, {
dataIndex: 'EXCHANGERATE', align: 'right',
header: '锁汇汇率',
width: 80
}, {
dataIndex: 'price_limit', align: 'right',
header: '海关限价',
width: 80
},
{
dataIndex: 'Currency', align: 'left',
header: '合同币别',
width: 80
},
{
dataIndex: 'amount',
header: '合同金额(外币)',
width: 80, summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
dataIndex: 'pay_amount',
header: '单据金额(外币对供应商)',
width: 80, summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
dataIndex: 'pay_amount_RMBes',
header: '合同预计金额(RMB)',
width: 80, summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
dataIndex: 'Price',
header: '外币单价/kg',
width: 80, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 6, '', true);
return value;
}
},
{
dataIndex: 'price_RMBes',
header: '预计本币单价/kg',
width: 80, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
dataIndex: 'STORAGENAME', align: 'left',
header: '冷库',
width: 80
},
{
dataIndex: 'GOODSPACK',
header: '入库件数',
width: 80, summaryType: 'sum', align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
dataIndex: 'Overfilled', align: 'left',
header: '溢短装',
width: 80
},
{
dataIndex: 'GOODSPACKSTOCK_Ref',
header: '目前剩余件数',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
width: 80, summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
dataIndex: 'GOODSSTOCK_Ref',
header: '目前库存剩余数量(吨)',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
width: 80, summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
dataIndex: 'WMSDATE',
header: '入库日期',
width: 90, align: 'right'
},
{
dataIndex: 'StoreDays',
header: '库龄天数',
width: 50, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 0, '', true);
return value;
}
},
{
dataIndex: 'CargoDays',
header: '货龄天数',
width: 80, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 0, '', true);
return value;
}
},
{
dataIndex: 'PreProportion',
header: '预付比例',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
width: 80, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
dataIndex: 'Prepayments',
header: '预付金额(外币)',
width: 80, summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
dataIndex: 'prepayments_RMBes',
header: '预计预付RMB金额',
width: 80, summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
dataIndex: 'prepayments_RMB',
header: '实际预付RMB金额',
width: 80, summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
dataIndex: 'Exchange_Pre',
header: '实际预付汇率',
width: 80, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 6, '', true);
return value;
}
},
{
dataIndex: 'Prepaydate_Payapp', align: 'left',
header: '申请向代理商付预付款日期',
width: 80
},
{
dataIndex: 'Prepaydate_Agent', align: 'left',
header: '预付款实际付汇日期',
width: 80
},
{
dataIndex: 'Balance',
header: '尾款金额(外币)',
width: 80, summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
dataIndex: 'Balance_RMBes',
header: '预计尾款RMB金额',
width: 80, summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
dataIndex: 'Balance_RMB',
header: '实际尾款RMB金额',
width: 80, summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
dataIndex: 'Exchange_Balance',
header: '实际尾款汇率',
width: 80, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 6, '', true);
return value;
}
},
{
dataIndex: 'Balancepaydate', align: 'left',
header: '申请向代理商付尾款日期',
width: 80
},
{
dataIndex: 'Balancepaydate_Agent', align: 'left',
header: '尾款实际付汇日期',
width: 80
},
{
dataIndex: 'AllCostes',
header: '预计总成本(不含代理费)',
width: 80, summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
dataIndex: 'AllCost',
header: '总成本',
width: 80, summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
dataIndex: 'AllPayment',
header: '总费用',
width: 80, summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
dataIndex: 'FundsUsed',
header: '当前资金占用',
width: 80, summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
dataIndex: 'BasePricees',
header: '预计成本价(不含代理费)',
width: 100, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 4, '', true);
return value;
}
},
{
dataIndex: 'BasePrice',
header: '成本价',
width: 80, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 4, '', true);
return value;
}
},
{
dataIndex: 'FEESTATUS', hidden: true,
header: 'FEESTATUS',
width: 80
}, {
sortable: true,
dataIndex: 'PUBLIC_AMOUNT',
header: '代理应收',
width: 80,
summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'PUBLIC_SETTLEMENT',
header: '代理已收',
width: 80,
summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'PUBLIC_REMAIN',
header: '代理未收',
width: 80,
summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'LOCAL_AMOUNT',
header: '对代理应付',
width: 80,
summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'LOCAL_SETTLEMENT',
header: '对代理已付',
width: 80,
summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'LOCAL_REMAIN',
header: '对代理未付',
width: 80,
summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'DZCE',
header: '对账差额',
width: 80,
summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, align: 'left',
dataIndex: 'remark_4',
header: '合同编码',
width: 100
},
{
sortable: true, align: 'left',
dataIndex: 'remark',
header: '船期备注(1)',
width: 100
},
{
sortable: true, align: 'left',
dataIndex: 'remark_2',
header: '备注2',
width: 100
},
{
sortable: true, align: 'left',
dataIndex: 'remark_3',
header: '备注3',
width: 100
},
{
sortable: true, align: 'left',
dataIndex: 'remark_5',
header: '备注4',
width: 100
},
{
sortable: true, align: 'left',
dataIndex: 'remark_6',
header: '备注5',
width: 100
},
{
sortable: true, align: 'left',
dataIndex: 'SALEINFO',
header: '销售情况摘要',
width: 200
},
{
sortable: true, align: 'left',
dataIndex: 'DeliveryInfo',
header: '出库情况摘要',
width: 200
},
{
sortable: true, align: 'left',
dataIndex: 'Prepaydate_sett',
header: '付预付款结算时间',
width: 100
},
{
sortable: true, align: 'left',
dataIndex: 'Balancepaydate_sett',
header: '付尾款结算时间',
width: 100
},
{
sortable: true, align: 'left',
dataIndex: 'SamplingDate_Plan',
header: '海关确定抽检时间',
width: 100
},
/*{
sortable: true, align: 'left',
dataIndex: 'STOCKDATE_1',
header: '冷藏费开始日',
width: 100
},
{
sortable: true, align: 'left',
dataIndex: 'STOCKDATE_2',
header: '冷藏费截止日',
width: 100
},*/
{
sortable: true, align: 'left',
dataIndex: 'PAYCOMPANY',
header: '付款公司',
width: 100
},
{
sortable: true, align: 'left',
dataIndex: 'MOREORLESS',
header: '短装重量',
width: 100
},
{
sortable: true, align: 'left',
dataIndex: 'MOREORLESSCOUNT',
header: '短装件数',
width: 100
},
{
dataIndex: 'Freetime', align: 'left',
header: '免箱期',
width: 80
},
{
dataIndex: 'Prepaydate', align: 'left',
header: '预计付预付日期',
width: 80
},
{
dataIndex: 'Paydate', align: 'left',
header: '预计付尾款日期',
width: 80
},
{
dataIndex: 'PortDays', align: 'left',
header: '港口天数',
width: 80
}
];
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.girdcolums = this.initgirdcolums;
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
features: [{
ftype: 'summary'
}],
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
},
tbar: ['-'],
listeners: {
cellclick: function (thisTab, record, item, index, e, eOpts) {
if (index == 10) {//设置按钮列
// alert('用户编号=' + this.getStore().getAt(rowIndex).data.usercode);
}
}
},
columns: this.girdcolums,
bbar: [Ext.create('Ext.PagingToolbar', {
id: "bbar",
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 0); //使用者id表名中间column数组跳过一开始的几列
this.gridList.reconfigure(this.storeList, this.girdcolums);
this.gridList.columns[0] = new Ext.grid.RowNumberer();
////////////////////////////////////////////////
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/Import/ImportTrade/Edit', "编辑跟单信息");
}, this);
this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) {
this.sortfield = column.dataIndex;
this.sortdire = direction;
}, this);
//#region formSearch 下拉框信息加载
//权限范围
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.StoreOpRange.load({ params: { optype: "modImport"} });
//人员信息加载
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeOpCode.load();
//客服
this.comboxCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客服',
store: this.storeOpCode,
forceSelection: true,
name: 'CUSTSERVICE',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//揽货人
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
store: this.storeOpCode,
forceSelection: true,
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//操 作
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '跟单操作',
store: this.storeOpCode,
forceSelection: true,
name: 'OP', flex: 1,
valueField: 'UserName',
displayField: 'CodeAndName'
});
//录入人
this.comboxINPUTBY = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '录入人',
store: this.storeOpCode,
forceSelection: true,
name: 'INPUTBY',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//客户加载_委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
//委托单位
_this = this;
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode, flex: 1,
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//客户加载_船公司
this.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCARRIER.load({ params: { condition: "ISCARRIER='1'"} });
//船公司
this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船公司',
store: this.storeCARRIER,
forceSelection: true,
name: 'CARRIER',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//客户加载_车队
this.storeTRUCKER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeTRUCKER.load({ params: { condition: "ISTRUCK='1'"} });
//车队
this.comboxTRUCKER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '车队',
store: this.storeTRUCKER,
forceSelection: true,
name: 'TRUCKER',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//客户加载_报关报检
this.storeCUSTOMSER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCUSTOMSER.load({ params: { condition: "ISCUSTOM='1'"} });
//报关行
this.comboxCUSTOMSER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '报关行',
store: this.storeCUSTOMSER,
forceSelection: true,
name: 'CUSTOMSER',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//报检
this.comboxINSPECTION = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '报检',
store: this.storeCUSTOMSER,
forceSelection: true,
name: 'INSPECTION',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//客户加载_代理
this.storeagent = Ext.create('DsExt.ux.RefTableStore', {
model: 'OpSeaeShipper',
proxy: { url: '/Import/ImportTrade/GetShipperList' }
});
//this.storeagent.load({ params: { condition: "shippertype=4 AND ISPUBLIC=1 "} });
//收货人
this.comboxAgent = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '代 理',
store: this.storeagent,
forceSelection: true,
name: 'AGENTID',
valueField: 'SHORTNAME',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeMainstate = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeMainstate.load({ params: { enumTypeId: 28} });
/*
this.comboxMainstate = Ext.create('DsExt.ux.RefEnumCombox', {
labelWidth: 125,
fieldLabel: '合同货物状态', flex: 1,
forceSelection: true,
store: this.storeMainstate,
name: 'Mainstate'
});*/
this.comboxMainstate = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '合同货物状态',
autosize: true,
bodyPadding: 5,
flex: 3,
//width: 500,
labelWidth: 80,
store: this.storeMainstate,
queryMode: 'local',
triggerOnClick: false,
valueField: 'EnumValueId',
displayField: 'EnumValueName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//键值维护表_委托单类型
this.StoreBLTYPE = Ext.create('Ext.data.Store', {
fields: ['BLTYPE']
});
this.StoreBLTYPE.add({ "BLTYPE": "整箱" });
this.StoreBLTYPE.add({ "BLTYPE": "拼箱主票" });
this.StoreBLTYPE.add({ "BLTYPE": "拼箱分票" });
this.StoreBLTYPE.add({ "BLTYPE": "拼箱单票" });
this.comboxBLTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '装运方式',
store: this.StoreBLTYPE,
forceSelection: true,
name: 'BLTYPE',
valueField: 'BLTYPE',
displayField: 'BLTYPE'
});
//品名
this.storeCodeGoodsList = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeGoodsModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeGoodsList' }
});
this.storeCodeGoodsList.load();
this.comboxGOODSNAME = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '品名',
store: this.storeCodeGoodsList,
forceSelection: true,
name: 'GOODSNAME',
valueField: 'GOODNAME',
displayField: 'CodeAndName'
});
//业务来源
this.storeSource = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.SourceModel',
proxy: { url: '/CommMng/BasicDataRef/GetSource' }
});
this.storeSource.load();
this.storeSourceDetail = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.SourceDetailModel',
proxy: { url: '/CommMng/BasicDataRef/GetSourceDetail2' }
});
this.comboxBSSOURCE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务来源',
store: this.storeSource,
forceSelection: true,
name: 'BSSOURCE',
valueField: 'SourceName',
displayField: 'SourceName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var recs = DsStoreQueryBy(this.storeSource, 'SourceID', records[0].data.SourceID);
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
var s = "SOURCEID='" + data.SourceID + "'";
this.storeSourceDetail.load({ params: { condition: s} });
} else {
var BSSOURCEDETAIL = this.formHead.getForm().findField('BSSOURCEDETAIL');
BSSOURCEDETAIL.setValue('');
}
}
}
}
});
this.comboxBSSOURCEDETAIL = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '来源明细',
store: this.storeSourceDetail,
forceSelection: true,
name: 'BSSOURCEDETAIL',
valueField: 'SourceDetail',
displayField: 'SourceDetail'
});
//状态_业务状态
Ext.define('BSSTATUSModel', {
extend: 'Ext.data.Model',
fields: [
{ name: 'Name', type: 'string' }
]
});
var dataBSSTATUS = [{ "Name": "未锁定" }, { "Name": "锁定" }, { "Name": ""}];
var storeBSSTATUS = Ext.create('Ext.data.Store', {
model: 'BSSTATUSModel',
data: dataBSSTATUS
});
//业务状态
this.comboxBSSTATUS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务锁定',
forceSelection: true,
store: storeBSSTATUS,
name: 'BSSTATUS',
valueField: 'Name',
displayField: 'Name'
});
//费用状态
this.comboxFEESTATUS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '费用锁定',
forceSelection: true,
store: storeBSSTATUS,
name: 'FEESTATUS',
valueField: 'Name',
displayField: 'Name'
});
//所属部门
this.storeDept = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.DeptModel',
proxy: { url: '/CommMng/BasicDataRef/GetDeptList' }
});
this.storeDept.load();
this.comboxDept = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '所属部门',
store: this.storeDept,
forceSelection: true,
name: 'SALEDEPT',
valueField: 'DeptName',
displayField: 'DeptName'
//,hidden: true
});
//国际港口(进口装货港、出口卸货港)
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storeCodeDisport.load();
//国内港口(出口装货港、进口卸货港)
this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeLoadportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportList' }
});
this.storeCodeLoadport.load();
this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '装货港',
store: this.storeCodeLoadport,
forceSelection: true,
name: 'PORTLOAD',
valueField: 'CNAME',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '卸货港',
store: this.storeCodeDisport,
forceSelection: true,
name: 'PORTDISCHARGE',
valueField: 'CNAME',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeVoyVeg = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.VesselModel',
proxy: { url: '/CommMng/BasicDataRef/GetVesselList' }
});
this.storeVoyVeg.load({ params: { condition: ""} });
this.comboxVoyVeg = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船 名',
store: this.storeVoyVeg,
name: 'VESSEL',
valueField: 'VESSEL',
flex: 1,
displayField: 'VESSEL',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeRemind = Ext.create('DsExt.ux.RefTableStore', {
model: 'remind',
proxy: { url: '/CommMng/BasicDataRef/Getimportremind' }
});
this.storeRemind.load({ params: { condition: ""} });
this.comboxRemind = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务提醒',
store: this.storeRemind,
name: 'Remind',
valueField: 'RemindSql',
displayField: 'RemindName',
triggerAction: 'all',
selectOnFocus: true,
listeners: {
change: function (field, newValue, oldValue) {
this.onGetremind(field, newValue, oldValue);
},
scope: this
},
flex: 2
});
Ext.define('CargoTypemb', {
extend: 'Ext.data.Model',
fields: [
{ name: 'Type', type: 'string' }
]
});
var CargoTypeData = [{ "Type": "牛" },
{ "Type": "羊" },
{ "Type": "猪" },
{ "Type": "鸡"}];
this.storeCargoType = Ext.create('Ext.data.Store', {
model: 'CargoTypemb',
data: CargoTypeData
});
this.comboxCargoType = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '货物类型',
autosize: true,
bodyPadding: 5,
flex: 2,
//width: 500,
//labelWidth: 90,
store: this.storeCargoType,
queryMode: 'local',
triggerOnClick: false,
valueField: 'Type',
displayField: 'Type',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
Ext.define('CargoRemainmb', {
extend: 'Ext.data.Model',
fields: [
{ name: 'Type', type: 'string' }
, { name: 'mssql', type: 'string' }
]
});
var CargoRemainData = [{ "Type": "全部", "mssql": "" },
//{ "Type": "未出售","mssql":" ic.sale_weight=0 " },
{"Type": "售完", "mssql": " isnull((select sum(isnull(sale_weight,0)) from ImportTrade_Cargo where GID= C.gid ),0)-isnull(c.weight_act,0) > 0 " },
{ "Type": "已售但未售完(不含'完全未销售的业务')", "mssql": " isnull((select sum(isnull(sale_weight,0)) from ImportTrade_Cargo where GID= C.gid ),0) > 0 and isnull((select sum(isnull(sale_weight,0)) from ImportTrade_Cargo where GID= C.gid ),0) - isnull(c.weight_act,0)<0 " },
{ "Type": "还未售完(含'完全未售'和'已售一部分但未售完';不含'全部售完')", "mssql": " isnull((select sum(isnull(sale_weight,0)) from ImportTrade_Cargo where GID= C.gid ),0)-isnull(c.weight_act,0) <0" },
{ "Type": "还未销售(含'完全未售',不含'已售一部分但未售完'和'全部售完')", "mssql": " isnull((select sum(isnull(sale_weight,0)) from ImportTrade_Cargo where GID= C.gid ),0)=0 " }
//,{ "Type": "还未销售()", "mssql": " isnull((select sum(isnull(sale_weight,0)) from ImportTrade_Cargo where GID= C.gid ),0)=0 " }
];
this.storeCargoRemain = Ext.create('Ext.data.Store', {
model: 'CargoRemainmb',
data: CargoRemainData
});
this.comboxCargoRemain = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '销售情况',
store: this.storeCargoRemain,
name: 'CargoRemain',
valueField: 'mssql',
flex: 1,
displayField: 'Type',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeport = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeport.load({ params: { enumTypeId: 10} });
this.comboxPort = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '目的港',
autosize: true,
bodyPadding: 1,
flex: 2,
width: 80,
labelWidth: 90,
store: this.storeport,
queryMode: 'local',
triggerOnClick: false,
valueField: 'EnumValueId',
displayField: 'EnumValueName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
//,value: ['TX', 'CA']
});
this.storeWMSStatus = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeWMSStatus.load({ params: { enumTypeId: 37} });
this.comboxWMSStatus = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '入库状态',
autosize: true,
bodyPadding: 1,
flex: 2,
width: 80,
labelWidth: 90,
store: this.storeWMSStatus,
queryMode: 'local',
triggerOnClick: false,
valueField: 'EnumValueId',
displayField: 'EnumValueName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
//,value: ['TX', 'CA']
});
//#endregion
//#region formSearch 查询面板
_this = this;
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 2,
labelWidth: 60,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [
//#region 第一行
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
//labelWidth: 100,
fieldLabel: '合同号',
name: 'HTH', flex: 1,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
//labelWidth: 125,
fieldLabel: '提单号',
name: 'BILLNO', flex: 1,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, this.comboxCustCode
, {
fieldLabel: '到港日期',
format: 'Y-m-d',
xtype: 'datefield',
labelWidth: 80,
name: 'ETDbgn', flex: 1,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDend', flex: 1,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, {
fieldLabel: '只显示已删除',
labelWidth: 125,
xtype: 'checkbox',
name: 'ISDELETE', flex: 1,
listeners: {
"change": function (checked) {
if (checked.checked) { //如果选中,显示
Ext.getCmp('btnUndelete').show();
Ext.getCmp('btndelete').hide();
}
else { //未选中,隐藏
Ext.getCmp('btnUndelete').hide();
Ext.getCmp('btndelete').show();
}
}
}
}
]
}
//#endregion
,
//#region 第二行
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
xtype: 'button',
width: 90,
text: "高级查询",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
if (this.winAccess == '' || typeof (this.winAccess) == "undefined") {
this.winAccess = new Shipping.DsQuery({});
} else {
this.winAccess.destroy();
this.winAccess = new Shipping.DsQuery({});
}
this.winAccess.StoreList = this.storeList;
this.winAccess.formname = this.formname;
this.winAccess.condition = sql;
this.winAccess.LoadQueryData_self(this.formname);
this.winAccess.show();
return;
},
scope: this
},
{
labelWidth: 125,
fieldLabel: '分公司/供应商合同号',
name: 'Other_Billno', flex: 1,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
//labelWidth: 125,
fieldLabel: '编码',
name: 'remark_4', flex: 1,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
this.comboxOP
, {
fieldLabel: '备注中包含',
labelWidth: 80,
name: 'remark', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, this.comboxRemind
]
}
//#endregion 第二行结束
//#region 第3行
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
xtype: "label",
width: 90,
text: ""
}
, {
labelWidth: 100,
fieldLabel: '从..合同签订日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'creattimebgn', flex: 1,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到',
format: 'Y-m-d',
xtype: 'datefield',
name: 'creattimeend', flex: 1,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, this.comboxCargoRemain
, this.comboxMainstate
//, { xtype: "hiddenfield", flex: 3 }
]
}
//#endregion 第3行结束
//#region 第4行
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxCargoType
, this.comboxPort
, this.comboxWMSStatus,{
fieldLabel: '保质天数',
name: 'ExpirationDates', flex: 1,
}
]
}
//#endregion 第4行结束
]//end items(fieldset 1)
}]//end root items
});
//#endregion formSearch
_this = this;
//按钮工具条_
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "新建",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin('/Import/ImportTrade/Edit');
},
scope: this
}, {
text: "删除", id: "btndelete",
iconCls: "btndelete", //disabled: true,
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, {
text: "取消删除", id: "btnUndelete", hidden: true,
iconCls: "btndelete", //disabled: true,
handler: function (button, event) {
this.onUnDeleteClick(button, event);
},
scope: this
}, {
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btntest",
menu: [
{ text: "保存",
handler: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true);
}
}, { text: "初始化",
handler: function (menu, event) {
_this.InitGrid(_this.initgirdcolums);
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true);
}
}],
scope: this
}, '-',
{
text: "打印",
iconCls: 'btnprint',
menu: [{
text: '费用通知单_预付款',
handler: function (menu, event) {
_this.Print_FYTZ_YF();
}
},
{ text: "费用通知单_尾款",
handler: function (menu, event) {
_this.Print_FYTZ_WK();
}
}, { text: "根据查询条件导出",
handler: function (menu, event) {
_this.Print_0();
}
}/*, { text: "期货-牛羊",
handler: function (menu, event) {
_this.Print_Q_ny();
}
}*/, { text: "期货查询",
handler: function (menu, event) {
_this.Print_Q_Z();
}
}, { text: "现货-牛羊",
handler: function (menu, event) {
_this.Print_XH_ny();
}
}, { text: "现货-猪鸡",
handler: function (menu, event) {
_this.Print_XH_zj();
}
}, { text: "对客户账单",
handler: function (menu, event) {
_this.Print_KHZD4();
}
}, {
text: '预付列表',
handler: function (menu, event) {
_this.Print_YFList();
}
},
{ text: "尾款列表",
handler: function (menu, event) {
_this.Print_WKList();
}
},
{ text: "船期表",
handler: function (menu, event) {
_this.Print_Ship();
}
}
],
scope: this
}, '-'
, {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}, '-'
, {
text: "只显示选中业务",
tooltip: '点此按钮之后,未选中的业务将会隐藏,除非重新进行查询才会出现',
handler: function (button, event) {
this.onHideUnSelected(button, event);
},
scope: this
}
]
});
//#region 生成EDI
this.CheckNoCtn = new Ext.form.Checkbox({
fieldLabel: '不输出箱号封号',
checked: false
});
this.CheckBill = new Ext.form.Checkbox({
fieldLabel: '货代提单',
checked: false
});
this.formEdiShow = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'radiogroup',
fieldLabel: '报文类型',
id: 'rFILETYPE',
defaults: {
flex: 1
},
layout: 'hbox',
items: [
{
boxLabel: '订舱',
name: 'FILETYPE',
checked: true,
inputValue: 'B',
id: 'radio1'
}, {
boxLabel: '确认',
name: 'FILETYPE',
inputValue: 'E',
id: 'radio2'
}
]
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'radiogroup',
fieldLabel: '文件功能',
id: 'rFILEROLE',
defaults: {
flex: 1
},
layout: 'hbox',
items: [
{
boxLabel: '原始',
name: 'FILEROLE',
inputValue: '9',
checked: true,
id: 'radio3'
}, {
boxLabel: '增加',
name: 'FILEROLE',
inputValue: '2',
id: 'radio4'
}, {
boxLabel: '删除',
name: 'FILEROLE',
inputValue: '3',
id: 'radio5'
}, {
boxLabel: '更新',
name: 'FILEROLE',
inputValue: '4',
id: 'radio6'
}
]
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.CheckNoCtn, this.CheckBill
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '装港代码',
labelWidth: 70,
id: 'rPORTLOAD',
name: 'PORTLOAD'
}, {
id: 'rPORTDISCHARGE',
fieldLabel: '卸港代码',
labelWidth: 70,
name: 'PORTDISCHARGE'
}, {
fieldLabel: '接收销售',
id: 'rRECEIVEROP',
labelWidth: 70,
name: 'RECEIVEROP'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
this.winEDIShow = Ext.create('Ext.window.Window', {
title: "生成EDI",
width: 450,
//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.formEdiShow],
buttons: [{
text: "上传EDI",
minWidth: 70,
handler: function () {
var cgFILETYPE = Ext.getCmp('rFILETYPE');
var FILETYPE = cgFILETYPE.getValue();
var cgFILEROLE = Ext.getCmp('rFILEROLE');
var FILEROLE = cgFILEROLE.getValue();
var IsNoCtn = 0;
if (me.CheckNoCtn.checked)
IsNoCtn = 1;
var IsBill = 0;
if (me.CheckBill.checked)
IsBill = 1;
var cgPORTLOAD = Ext.getCmp('rPORTLOAD');
var PORTLOAD = cgPORTLOAD.getValue();
var cgPORTDISCHARGE = Ext.getCmp('rPORTDISCHARGE');
var PORTDISCHARGE = cgPORTDISCHARGE.getValue();
var cgRECEIVEROP = Ext.getCmp('rRECEIVEROP');
var RECEIVEROP = cgRECEIVEROP.getValue();
me.onSendEDI(me.editype, FILETYPE.FILETYPE, FILEROLE.FILEROLE, IsBill, IsNoCtn, PORTLOAD, PORTDISCHARGE, RECEIVEROP);
}
}, {
text: "保存EDI文件",
minWidth: 70,
handler: function () {
var cgFILETYPE = Ext.getCmp('rFILETYPE');
var FILETYPE = cgFILETYPE.getValue();
var cgFILEROLE = Ext.getCmp('rFILEROLE');
var FILEROLE = cgFILEROLE.getValue();
var IsNoCtn = 0;
if (me.CheckNoCtn.checked)
IsNoCtn = 1;
var IsBill = 0;
if (me.CheckBill.checked)
IsBill = 1;
var cgPORTLOAD = Ext.getCmp('rPORTLOAD');
var PORTLOAD = cgPORTLOAD.getValue();
var cgPORTDISCHARGE = Ext.getCmp('rPORTDISCHARGE');
var PORTDISCHARGE = cgPORTDISCHARGE.getValue();
var cgRECEIVEROP = Ext.getCmp('rRECEIVEROP');
var RECEIVEROP = cgRECEIVEROP.getValue();
me.onSaveEDI(me.editype, FILETYPE.FILETYPE, FILEROLE.FILEROLE, IsBill, IsNoCtn, PORTLOAD, PORTDISCHARGE, RECEIVEROP);
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
me.winEDIShow.close();
}
}]
});
//#endregion
//#region 生成INTTR
this.CheckBillInttr = new Ext.form.Checkbox({
fieldLabel: '货代提单',
checked: false
});
this.CheckWY = new Ext.form.Checkbox({
fieldLabel: '订舱代理-SINOTRANS',
labelWidth: 160,
hidden: true,
checked: false
});
this.formINTTRShow = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'radiogroup',
fieldLabel: '报文类型',
id: 'iFILETYPE',
defaults: {
flex: 1
},
layout: 'hbox',
items: [
{
boxLabel: '订舱',
name: 'FILETYPE',
checked: true,
inputValue: 'B'
}, {
boxLabel: '确认',
name: 'FILETYPE',
inputValue: 'E'
}
]
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.CheckBillInttr, this.CheckWY
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'radiogroup',
fieldLabel: '文件功能',
id: 'iFILEROLE',
defaults: {
flex: 1
},
layout: 'hbox',
items: [
{
boxLabel: '原始',
name: 'FILEROLE',
inputValue: '9',
checked: true
}, {
boxLabel: '更新',
name: 'FILEROLE',
inputValue: '4'
}, {
boxLabel: '删除',
name: 'FILEROLE',
inputValue: '3'
}
]
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'radiogroup',
fieldLabel: '船公司',
columns: 2,
vertical: true,
id: 'rCARRIER',
items: [
{
boxLabel: 'MAERSK LINE',
name: 'CARRIER',
inputValue: 'MAEU',
checked: true
}, {
boxLabel: 'MCC SINGAPORE',
name: 'CARRIER',
inputValue: 'MCCQ',
checked: false
}, {
boxLabel: 'ANL CONTAINER LINE',
name: 'CARRIER',
inputValue: 'ANNU',
checked: false
}, {
boxLabel: 'CMA CGM',
name: 'CARRIER',
inputValue: 'CMDU',
checked: false
}, {
boxLabel: 'CNC',
name: 'CARRIER',
inputValue: 'CHNL',
checked: false
}, {
boxLabel: 'HAPAG-LLOYD',
name: 'CARRIER',
inputValue: 'HLCU',
checked: false
}, {
boxLabel: 'HAMBURG',
name: 'CARRIER',
inputValue: 'SUDU',
checked: false
}, {
boxLabel: 'MSC',
name: 'CARRIER',
inputValue: 'MSCU',
checked: false
}, {
boxLabel: 'DELMAS',
name: 'CARRIER',
inputValue: 'DAAE',
checked: false
}, {
boxLabel: 'UASC',
name: 'CARRIER',
inputValue: 'UASC',
checked: false
}, {
boxLabel: 'COSCO',
name: 'CARRIER',
inputValue: 'COSU',
checked: false
}
]
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
this.winINTTRShow = Ext.create('Ext.window.Window', {
title: "生成INTTR",
width: 450,
//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.formINTTRShow],
buttons: [{
text: "上传EDI",
minWidth: 70,
handler: function () {
var cgFILETYPE = Ext.getCmp('iFILETYPE');
var FILETYPE = cgFILETYPE.getValue();
var cgFILEROLE = Ext.getCmp('iFILEROLE');
var FILEROLE = cgFILEROLE.getValue();
var cgCARRIER = Ext.getCmp('rCARRIER');
var CARRIER = cgCARRIER.getValue();
var IsBill = 0;
if (me.CheckBillInttr.checked)
IsBill = 1;
var IsWY = 0;
if (me.CheckWY.checked)
IsWY = 1;
me.onSendINTTR(FILETYPE.FILETYPE, FILEROLE.FILEROLE, IsBill, IsWY, CARRIER.CARRIER);
}
}, {
text: "保存EDI文件",
minWidth: 70,
handler: function () {
var cgFILETYPE = Ext.getCmp('iFILETYPE');
var FILETYPE = cgFILETYPE.getValue();
var cgFILEROLE = Ext.getCmp('iFILEROLE');
var FILEROLE = cgFILEROLE.getValue();
var cgCARRIER = Ext.getCmp('rCARRIER');
var CARRIER = cgCARRIER.getValue();
var IsBill = 0;
if (me.CheckBillInttr.checked)
IsBill = 1;
var IsWY = 0;
if (me.CheckWY.checked)
IsWY = 1;
me.onSaveINTTR(FILETYPE.FILETYPE, FILEROLE.FILEROLE, IsBill, IsWY, CARRIER.CARRIER);
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
me.winINTTRShow.close();
}
}]
});
//#endregion
//#region 直发舱单
this.CheckVessel = new Ext.form.Checkbox({
fieldLabel: '换船或更改提单号',
checked: false
});
this.formDsManifestShow = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'radiogroup',
fieldLabel: '船公司',
columns: 2,
vertical: true,
id: 'dCARRIER',
items: [
{
boxLabel: '外代',
name: 'CARRIER',
inputValue: '外代',
checked: true
}, {
boxLabel: '外运',
name: 'CARRIER',
inputValue: '外运',
checked: false
}, {
boxLabel: '联代',
name: 'CARRIER',
inputValue: '联代',
checked: false
}, {
boxLabel: '华港',
name: 'CARRIER',
inputValue: '华港',
checked: false
}, {
boxLabel: '中创',
name: 'CARRIER',
inputValue: '中创',
checked: false
}, {
boxLabel: '中远',
name: 'CARRIER',
inputValue: '中远',
checked: false
}, {
boxLabel: '海丰',
name: 'CARRIER',
inputValue: '海丰',
checked: false
}, {
boxLabel: '振华',
name: 'CARRIER',
inputValue: '振华',
checked: false
}, {
boxLabel: '中通',
name: 'CARRIER',
inputValue: '中通',
checked: false
}, {
boxLabel: '中海',
name: 'CARRIER',
inputValue: '中海',
checked: false
}
]
}, this.CheckVessel, {
xtype: 'textareafield',
grow: true,
fieldLabel: 'EDI备注',
height: 60,
id: 'dREMARK',
name: 'EDIREMARK',
anchor: '100%'
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
this.winDSMANIFESTShow = Ext.create('Ext.window.Window', {
title: "发送预配舱单",
width: 450,
//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.formDsManifestShow],
buttons: [{
text: "确定发送",
minWidth: 70,
handler: function () {
var cgCARRIER = Ext.getCmp('dCARRIER');
var CARRIER = cgCARRIER.getValue();
var IsCgVessel = 0;
if (me.CheckVessel.checked)
IsCgVessel = 1;
var dREMARK = Ext.getCmp('dREMARK');
var REMARK = dREMARK.getValue();
me.onSendDS(CARRIER.CARRIER, IsCgVessel, REMARK);
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
me.winDSMANIFESTShow.close();
}
}]
});
//#endregion
//#region 合计列表
this.SumField = [
{ name: 'NOBILL', type: 'number' },
{ name: 'TEU', type: 'number' },
{ name: 'KGS', type: 'number' },
{ name: 'PKGS', type: 'number' },
{ name: 'CBM', type: 'number' }
];
this.storeSumList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: this.SumField,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Import/ImportTrade/GetCtnSum',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.girdcolumsSum = [{
sortable: true,
dataIndex: 'NOBILL',
header: '票数',
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'TEU',
header: 'TEU',
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'PKGS',
header: '件数',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'KGS',
header: '毛重',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'CBM',
header: '尺码',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}
];
this.gridListSum = new Ext.grid.GridPanel({
store: this.storeSumList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolumsSum
});
this.panelSum = new Ext.Panel({
// title: '合 计',
layout: "border",
height: 70,
region: 'south',
margin: '0 0',
frame: true,
items: [this.gridListSum]
});
//#endregion
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 150,
items: [this.panelBtn, this.formSearch]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList
//, this.panelSum
]
});
this.storeCtnList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'CTNALL', type: 'string' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Import/ImportTrade/GetCtnList',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.InitGrid(this.girdcolums);
// this.onRefreshClick();
/*
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: ' isnull(M.isdelete,0)=0 ', load: 'true' },
waitMsg: "正在查询数据...",
scope: this
});*/
this.onRefreshSumClick('');
this.storeList.on('beforeload', function (store) {
var sql = "";
if (this.sqlcontext != "") {
sql = this.sqlcontext;
} else {
sql = this.getCondition();
}
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
var btndelete = Ext.getCmp('btndelete');
var btnUndelete = Ext.getCmp('btnUndelete');
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: 'modDelImportTrade'
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success) {
btndelete.enable();
btnUndelete.enable();
} else {
btndelete.disable();
btnUndelete.disable();
}
}
},
scope: this
});
//this.winAccess.hide();
//#region 下载窗体
this.formDownloadShow = Ext.widget('form', {
frame: true,
region: 'center',
height: 100,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
id: 'downloadfile',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'label',
html: '',
width: 120,
text: ''
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
this.winDownloadShow = Ext.create('Ext.window.Window', {
title: "下载文件",
width: 450,
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.formDownloadShow],
buttons: [{
text: "关闭",
minWidth: 70,
handler: function () {
me.winDownloadShow.close();
}
}]
});
//#endregion
//#region 批量修改窗体
//客户加载_场站
this.storeYARD = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeYARD.load({ params: { condition: "ISYARD='1'"} });
//船公司
this.comboxYARD2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '场站',
store: this.storeYARD,
// forceSelection: true,
name: 'YARD',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//客户加载_船公司
//船公司
this.comboxCARRIER2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船公司',
store: this.storeCARRIER,
// forceSelection: true,
name: 'CARRIER',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//客户加载_订舱代理
this.storeFORWARDER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeFORWARDER.load({ params: { condition: "ISBOOKING='1'"} });
//船公司
this.comboxFORWARDER2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '订舱代理',
store: this.storeFORWARDER,
// forceSelection: true,
name: 'FORWARDER',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//客户加载_车队
//车队
this.comboxTRUCKER2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '车队',
store: this.storeTRUCKER,
// forceSelection: true,
name: 'TRUCKER',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//客户加载_报关报检
//报关行
this.comboxCUSTOMSER2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '报关行',
store: this.storeCUSTOMSER,
// forceSelection: true,
name: 'CUSTOMSER',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storeLANE = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.Lane',
proxy: { url: '/CommMng/BasicDataRef/GetCodeLaneList' }
});
this.storeLANE.load();
this.comboxLANE2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '航线',
store: this.storeLANE,
// forceSelection: true,
name: 'LANE',
valueField: 'LANE',
displayField: 'LANE'
});
//客户加载_代理
// this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} });
//收货人
this.comboxAgent2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '代 理',
store: this.storeagent,
// forceSelection: true,
name: 'AGENTID',
valueField: 'SHORTNAME',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeagent, 'SHORTNAME', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formModify.getForm().findField('AGENT').setValue(selectdata.SHIPPERDETAIL);
} else {
this.formModify.getForm().findField('AGENT').setValue('');
}
}
}
}
});
this.comboxPORTLOAD2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '装货港',
store: this.storeCodeLoadport,
name: 'PORTLOAD',
valueField: 'PORT',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeCodeLoadport, 'PORT', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formModify.getForm().findField('PORTLOADID').setValue(selectdata.EDICODE);
} else {
this.formModify.getForm().findField('PORTLOADID').setValue('');
}
}
}
}
});
this.comboxPORTDISCHARGE2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '卸货港',
store: this.storeCodeDisport,
name: 'PORTDISCHARGE',
valueField: 'PORT',
queryMode: 'local',
displayField: 'PORT',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeCodeDisport, 'PORT', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formModify.getForm().findField('PORTDISCHARGEID').setValue(selectdata.EDICODE);
} else {
this.formModify.getForm().findField('PORTDISCHARGEID').setValue('');
}
}
}
}
});
this.formModify = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxYARD2, this.comboxCARRIER2, this.comboxFORWARDER2, this.comboxLANE2
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxAgent2, this.comboxCUSTOMSER2, this.comboxTRUCKER2, { xtype: 'hiddenfield' }
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxPORTLOAD2, {
fieldLabel: '装港代码',
name: 'PORTLOADID'
}, this.comboxPORTDISCHARGE2, {
fieldLabel: '卸港代码',
name: 'PORTDISCHARGEID'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'textareafield',
grow: true,
fieldLabel: 'AGENT',
height: 70,
name: 'AGENT',
anchor: '100%'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
me = this;
this.winModifyShow = Ext.create('Ext.window.Window', {
title: "批量修改",
width: 820,
//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.formModify],
buttons: [{
text: "确认修改",
minWidth: 70,
handler: function () {
me.onModifyClick()
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
me.winModifyShow.close();
}
}]
});
//#endregion
}, //end initUIComponents
InitGrid: function (grid) {
//var agirdcolums = Ext.clone(this.gridList.columns);
var agirdcolums = grid;
// var agirdcolumsSum = this.girdcolumsSum;
this.storectndisp.load({ params: { condition: "" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
for (i = 0; i < this.storectndisp.getCount(); i += 1) {
var itemindex = i + 1;
var memberyf = this.storectndisp.getAt(i);
for (var j = 0; j < agirdcolums.length; j++) {
if (agirdcolums[j].dataIndex == 'CNTR1') {
if (memberyf.data.CNT1 != '' && memberyf.data.CNT1 != null) {
agirdcolums[j].header = memberyf.data.CNT1;
agirdcolums[j].hidden = false;
} else {
agirdcolums[j].hidden = true;
}
}
if (agirdcolums[j].dataIndex == 'CNTR2') {
if (memberyf.data.CNT2 != '' && memberyf.data.CNT2 != null) {
agirdcolums[j].header = memberyf.data.CNT2;
agirdcolums[j].hidden = false;
} else {
agirdcolums[j].hidden = true;
}
}
if (agirdcolums[j].dataIndex == 'CNTR3') {
if (memberyf.data.CNT3 != '' && memberyf.data.CNT3 != null) {
agirdcolums[j].header = memberyf.data.CNT3;
agirdcolums[j].hidden = false;
} else {
agirdcolums[j].hidden = true;
}
}
if (agirdcolums[j].dataIndex == 'CNTR4') {
if (memberyf.data.CNT4 != '' && memberyf.data.CNT4 != null) {
agirdcolums[j].header = memberyf.data.CNT4;
agirdcolums[j].hidden = false;
} else {
agirdcolums[j].hidden = true;
}
}
if (agirdcolums[j].dataIndex == 'CNTR5') {
if (memberyf.data.CNT5 != '' && memberyf.data.CNT5 != null) {
agirdcolums[j].header = memberyf.data.CNT5;
agirdcolums[j].hidden = false;
} else {
agirdcolums[j].hidden = true;
}
}
if (agirdcolums[j].dataIndex == 'CNTR6') {
if (memberyf.data.CNT6 != '' && memberyf.data.CNT6 != null) {
agirdcolums[j].header = memberyf.data.CNT6;
agirdcolums[j].hidden = false;
} else {
agirdcolums[j].hidden = true;
}
}
if (agirdcolums[j].dataIndex == 'CNTR7') {
if (memberyf.data.CNT7 != '' && memberyf.data.CNT7 != null) {
agirdcolums[j].header = memberyf.data.CNT7;
agirdcolums[j].hidden = false;
} else {
agirdcolums[j].hidden = true;
}
}
if (agirdcolums[j].dataIndex == 'CNTR8') {
if (memberyf.data.CNT8 != '' && memberyf.data.CNT8 != null) {
agirdcolums[j].header = memberyf.data.CNT8;
agirdcolums[j].hidden = false;
} else {
agirdcolums[j].hidden = true;
}
}
if (agirdcolums[j].dataIndex == 'CNTR9') {
if (memberyf.data.CNT9 != '' && memberyf.data.CNT9 != null) {
agirdcolums[j].header = memberyf.data.CNT9;
agirdcolums[j].hidden = false;
} else {
agirdcolums[j].hidden = true;
}
}
if (agirdcolums[j].dataIndex == 'CNTR10') {
if (memberyf.data.CNT10 != '' && memberyf.data.CNT10 != null) {
agirdcolums[j].header = memberyf.data.CNT10;
agirdcolums[j].hidden = false;
} else {
agirdcolums[j].hidden = true;
}
}
}
};
}
this.gridList.reconfigure(this.storeList, agirdcolums);
// this.gridListSum.reconfigure(this.storeSumList, agirdcolumsSum);
}
},
scope: this
});
},
onRefreshClick: function (button, event) {
this.PageSize = this.Pagenum.getValue();
var sql = this.getCondition();
this.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
//this.onRefreshSumClick(sql);
},
onDsQuery: function () {
this.PageSize = this.Pagenum.getValue();
var sql = this.sqlcontext;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
//this.onRefreshSumClick(sql);
},
onRefreshSumClick: function (sql) {
this.SumField = [
{ name: 'NOBILL', type: 'number' },
{ name: 'TEU', type: 'number' },
{ name: 'KGS', type: 'number' },
{ name: 'PKGS', type: 'number' },
{ name: 'CBM', type: 'number' }
];
this.girdcolumsSum = [{
sortable: true,
dataIndex: 'NOBILL',
header: '票数',
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'TEU',
header: 'TEU',
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'PKGS',
header: '件数',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'KGS',
header: '毛重',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'CBM',
header: '尺码',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}
];
_this = this;
/*
this.storeCtnList.load({ params: { condition: sql },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
for (i = 0; i < _this.storeCtnList.getCount(); i += 1) {
var itemindex = i + 1;
var memberyf = _this.storeCtnList.getAt(i);
_this.SumField.push({ name: 'C' + memberyf.data.CTNALL, type: 'number' });
_this.girdcolumsSum.push({
sortable: true,
dataIndex: 'C' + memberyf.data.CTNALL,
header: memberyf.data.CTNALL,
width: 80
});
};
}
_this.storeSumList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: _this.SumField,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Import/ImportTrade/GetCtnSum',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
_this.gridListSum.reconfigure(_this.storeSumList, _this.girdcolumsSum);
_this.storeSumList.load({
params: { 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 sql1 = " BSNO='" + ContractNo + "'";
var sql2 = " CARGO_GID in(select gid from import_cargo where ContractNo='" + ContractNo + "') ";
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/Import/XXH/GetChfeeAndSaleDetail',
scope: this,
async: false,
params: {
sql1: sql1,
sql2: sql2
},
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);
if (this.ChfeeCount > 0) {
alert("序列号<" + ContractNo + ">的业务包含未删除的费用,或已生成的销售明细,不能删除。");
return;
} else {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/Import/XXH/Delete',
params: {
data: Ext.JSON.encode(record.data),
USERID: USERID
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
Ext.Msg.hide();
//Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
} 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 });
Ext.Msg.hide();
this.onRefreshClick(button, event);
}, this);
},
onUnDeleteClick: 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];
Ext.Msg.wait('正在恢复数据...');
Ext.Ajax.request({
waitMsg: '正在恢复数据...',
url: '/Import/XXH/UnDelete',
params: {
data: Ext.JSON.encode(record.data),
USERID: USERID
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
//Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
};
Ext.Msg.show({ title: '提示', msg: "数据恢复结束", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
this.onRefreshClick(button, event);
}, this);
},
//end initUIComponents
//#region 舱单 AFR
onCreateAfrClick: function (menu, event, type) {
var GidStr = '';
var selections = this.GridCheckBoxModel.selected.items;
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要生成的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var BSNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BSNO = rec.data.BSNO;
if (BSNOStr == '')
BSNOStr = BSNO;
else {
BSNOStr = BSNOStr + ',' + BSNO;
}
}
if (BSNOStr == '') {
Ext.Msg.show({ title: '提示', msg: '没有要生成的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
Ext.Ajax.request({
waitMsg: '正在生成...',
url: '/Import/ImportTrade/CreateAfrList',
params: {
BSNOS: BSNOStr,
type: type
},
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 {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onCreateCustomClick: function (menu, event, type) {
var GidStr = '';
var selections = this.GridCheckBoxModel.selected.items;
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要生成的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var BSNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BSNO = rec.data.BSNO;
if (BSNOStr == '')
BSNOStr = BSNO;
else {
BSNOStr = BSNOStr + ',' + BSNO;
}
}
if (BSNOStr == '') {
Ext.Msg.show({ title: '提示', msg: '没有要生成的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
Ext.Ajax.request({
waitMsg: '正在生成...',
url: '/Import/ImportTrade/CreateCustomList',
params: {
BSNOS: BSNOStr,
type: type
},
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 {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
//#endregion
//#region EDI
onCreateEDIClick: function (menu, event, type) {
this.editype = type;
this.winEDIShow.show();
},
onSendEDI: function (type, filetype, filerole, isbill, isnoctn, portload, portdischarge, receiverop) {
var GidStr = '';
var selections = this.GridCheckBoxModel.selected.items;
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要生成的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var BSNOStr = '';
var j = 0;
var Mblno = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
Mblno = rec.data.MBLNO;
var BSNO = rec.data.BSNO;
if (BSNOStr == '')
BSNOStr = BSNO;
else {
BSNOStr = BSNOStr + ',' + BSNO;
}
}
if (BSNOStr == '') {
Ext.Msg.show({ title: '提示', msg: '没有要生成的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
Ext.Ajax.request({
waitMsg: '正在生成...',
url: '/Import/ImportTrade/CreateEDIList',
params: {
bsnos: BSNOStr,
mblno: Mblno,
type: type,
filetype: filetype,
filerole: filerole,
isbill: isbill,
isnoctn: isnoctn,
portload: portload,
portdischarge: portdischarge,
receiverop: receiverop
},
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 {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onSaveEDI: function (type, filetype, filerole, isbill, isnoctn, portload, portdischarge, receiverop) {
var GidStr = '';
var selections = this.GridCheckBoxModel.selected.items;
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要生成的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var BSNOStr = '';
var j = 0;
var Mblno = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
Mblno = rec.data.MBLNO;
var BSNO = rec.data.BSNO;
if (BSNOStr == '')
BSNOStr = BSNO;
else {
BSNOStr = BSNOStr + ',' + BSNO;
}
}
if (BSNOStr == '') {
Ext.Msg.show({ title: '提示', msg: '没有要生成的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
Ext.Ajax.request({
waitMsg: 'Changing...',
url: '/Import/ImportTrade/SaveEDIList',
params: {
bsnos: BSNOStr,
mblno: Mblno,
type: type,
filetype: filetype,
filerole: filerole,
isbill: isbill,
isnoctn: isnoctn,
portload: portload,
portdischarge: portdischarge,
receiverop: receiverop
},
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 {
// var openSet = "height=100, width=100, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=" + (screen.height - 200) / 2 + ",Left=" + (screen.width - 200) / 2;
// var openType = "_blank";
// var openUrl = "../../Reports/FileExport.aspx?filename=" + result.Data;
// window.open(openUrl, openType, openSet);
// this.formDownloadShow.items.removeAll(true);
var downloadfile = Ext.getCmp('downloadfile');
var children = downloadfile.items;
if (children) {
for (var i = 0, len = children.length; i < len; i++) {
downloadfile.remove(children.items[i], true);
}
}
// downloadfile.doLayout();
// // var downloadfile = Ext.getCmp('downloadfile');
// var filehtml = '<a href="' + result.Data + '" style=' + '"text-decoration:none"' + '>' + result.Message + '</a>'
// downloadfile.html = filehtml;
var downloadfiles = '<a href="' + result.Data + '" style=' + '"text-decoration:none"' + '>' + result.Message + '</a>';
var htmla = Ext.widget('label', {
html: downloadfiles,
width: 120,
text: ''
});
downloadfile.items.add(htmla);
this.winDownloadShow.show();
}
} else {
Ext.MessageBox.alert('The Server Response Error, Please Try Again', response.responseText);
}
},
scope: this
});
}
},
//#endregion
//#region INTTR
onCreateINTTRClick: function (menu, event) {
this.winINTTRShow.show();
},
onSendINTTR: function (filetype, filerole, isbill, isWY, carrier) {
var GidStr = '';
var selections = this.GridCheckBoxModel.selected.items;
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要生成的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var BSNOStr = '';
var j = 0;
var Mblno = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
Mblno = rec.data.MBLNO;
var BSNO = rec.data.BSNO;
if (BSNOStr == '')
BSNOStr = BSNO;
else {
BSNOStr = BSNOStr + ',' + BSNO;
}
}
if (BSNOStr == '') {
Ext.Msg.show({ title: '提示', msg: '没有要生成的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
Ext.Ajax.request({
waitMsg: '正在生成...',
url: '/Import/ImportTrade/CreateINTTRList',
params: {
bsnos: BSNOStr,
mblno: Mblno,
filetype: filetype,
filerole: filerole,
isbill: isbill,
iswy: isWY,
carrier: carrier
},
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 {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onSaveINTTR: function (filetype, filerole, isbill, isWY, carrier) {
var GidStr = '';
var selections = this.GridCheckBoxModel.selected.items;
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要生成的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var BSNOStr = '';
var j = 0;
var Mblno = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
Mblno = rec.data.MBLNO;
var BSNO = rec.data.BSNO;
if (BSNOStr == '')
BSNOStr = BSNO;
else {
BSNOStr = BSNOStr + ',' + BSNO;
}
}
if (BSNOStr == '') {
Ext.Msg.show({ title: '提示', msg: '没有要生成的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
Ext.Ajax.request({
waitMsg: 'Changing...',
url: '/Import/ImportTrade/SaveINTTRList',
params: {
bsnos: BSNOStr,
mblno: Mblno,
filetype: filetype,
filerole: filerole,
isbill: isbill,
iswy: isWY,
carrier: carrier
},
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 {
// var openSet = "height=100, width=100, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=" + (screen.height - 200) / 2 + ",Left=" + (screen.width - 200) / 2;
// var openType = "_blank";
// var openUrl = "../../Reports/FileExport.aspx?filename=" + result.Data;
// window.open(openUrl, openType, openSet);
// this.formDownloadShow.items.removeAll(true);
var downloadfile = Ext.getCmp('downloadfile');
var children = downloadfile.items;
if (children) {
for (var i = 0, len = children.length; i < len; i++) {
downloadfile.remove(children.items[i], true);
}
}
// downloadfile.doLayout();
// // var downloadfile = Ext.getCmp('downloadfile');
// var filehtml = '<a href="' + result.Data + '" style=' + '"text-decoration:none"' + '>' + result.Message + '</a>'
// downloadfile.html = filehtml;
var downloadfiles = '<a href="' + result.Data + '" style=' + '"text-decoration:none"' + '>' + result.Message + '</a>';
var htmla = Ext.widget('label', {
html: downloadfiles,
width: 120,
text: ''
});
downloadfile.items.add(htmla);
this.winDownloadShow.show();
}
} else {
Ext.MessageBox.alert('The Server Response Error, Please Try Again', response.responseText);
}
},
scope: this
});
}
},
//#endregion
onYanTaiYardStatusClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
var mblno = record.data.MBLNO;
if (mblno == "") {
Ext.Msg.show({ title: '提示', msg: '没有要刷新查看的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
var yantaiyardview = new Shipping.YantaiYardView({
});
yantaiyardview.mblno = mblno;
yantaiyardview.show();
return;
}
},
onImportEdiClick: function (button, event) {
var winAccess = new Shipping.EDIImport({
});
winAccess.StoreList = this.storeList;
winAccess.show();
return;
},
onModifyClick: function (menu, event) {
var GidStr = '';
var records = this.GridCheckBoxModel.selected.items;
if (records.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要修改的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodyAddDatas = [];
for (var i = 0; i < records.length; i++) {
var rec = records[i];
if (rec.data.BSSTATUS == 'true') {
Ext.Msg.show({ title: '警告', msg: '业务已锁定,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
} else {
var op = rec.data.OP;
var inputby = rec.data.INPUTBY;
var mrecords = DsStoreQueryBy(this.StoreOpRange, 'OPID', op);
if (mrecords.getCount() > 0) {
bodyAddDatas.push(rec);
} else {
var recordins = DsStoreQueryBy(this.StoreOpRange, 'OPID', inputby);
if (recordins.getCount() > 0) {
bodyAddDatas.push(rec);
} else {
canedit = false;
Ext.Msg.show({ title: '警告', msg: '权限不足,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
}
}
}
}
var data = this.formModify.getForm().getValues();
_this = this;
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要修改的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Ajax.request({
waitMsg: '正在锁定...',
url: '/Import/ImportTrade/modify',
params: {
data: jsonbodyAddDatas,
modifydata: Ext.JSON.encode(data)
},
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 {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
_this.onRefreshClick();
_this.winModifyShow.close();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
}, //onDeleteClick
onGetremind: function (field, newValue, oldValue) {
if (newValue != null) {
this.remind = newValue;
}
},
getCondition: function () {
var form = this.formSearch.getForm();
// var form2 = this.formSearch2.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
//隐藏查询面板
// this.panelSearch.hide();
this.isShowAdvancedQuery = 0;
//
var sql = "";
//var sql = " isnull(M.isdelete,0)=0 ";
//#region formSearch 查询面板
//编号包括(主提单号)
var HTH = form.findField('HTH').getValue();
sql = sql + getAndConSql(sql, HTH, "M.HTH like '%" + HTH + "%'");
var BILLNO = form.findField('BILLNO').getValue();
sql = sql + getAndConSql(sql, BILLNO, " M.BILLNO like '%" + BILLNO + "%'"); // or M.remark_4 like '%" + MblNo + "%')");
var remark_4 = form.findField('remark_4').getValue();
sql = sql + getAndConSql(sql, remark_4, " M.remark_4 like '%" + remark_4 + "%'");
var Other_Billno = form.findField('Other_Billno').getValue();
sql = sql + getAndConSql(sql, Other_Billno, "(M.Other_Billno like '%" + Other_Billno + "%' or M.Supplier_Billno like '%" + Other_Billno + "%' )");
var OP = form.findField('OP').getValue();
sql = sql + getAndConSql(sql, OP, "M.OP = '" + OP + "'");
//客户名称
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "M.buyer='" + CUSTOMERNAME + "'");
//到港日期
var ETDbgn = form.findField('ETDbgn').getRawValue();
sql = sql + getAndConSql(sql, ETDbgn, "M.arrivaldate >='" + ETDbgn + "'");
var ETDend = form.findField('ETDend').getRawValue();
sql = sql + getAndConSql(sql, ETDend, "M.arrivaldate <='" + ETDend + " 23:59:59'");
if (this.remind != "") {
sql = sql + getAndConSql(sql, this.remind, this.remind);
}
var ISDELETE = form.findField("ISDELETE").getValue();
if (ISDELETE)
{ sql = sql + getAndConSql(sql, ISDELETE, " m.ISDELETE = 1 "); }
else { sql = sql + getAndConSql(sql, "True", " m.ISDELETE = 0 "); }
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_5 like '%" + remark + "%' or m.remark_6 like '%" + remark + "%' or m.Receiptremark like '%" + remark + "%' )");
var creattimebgn = form.findField('creattimebgn').getRawValue();
sql = sql + getAndConSql(sql, creattimebgn, "M.creattime >='" + creattimebgn + "'");
var creattimeend = form.findField('creattimeend').getRawValue();
sql = sql + getAndConSql(sql, creattimeend, "M.creattime <='" + creattimeend + " 23:59:59'");
var CargoType = this.getStrValue(this.comboxCargoType.getValue());
sql = sql + getAndConSql(sql, CargoType, "c.cargotype in (" + CargoType + ")");
var CargoRemain = form.findField('CargoRemain').getValue();
sql = sql + getAndConSql(sql, CargoRemain, CargoRemain);
/*
var Mainstate = form.findField('Mainstate').getValue();
sql = sql + getAndConSql(sql, Mainstate, "M.Mainstate ='" + Mainstate + "'");
*/
var port = this.comboxPort.getValue();
if (port != "") {
sql = sql + getAndConSql(sql, port, "m.port in (" + port + ")");
}
var WMSSTATUS = this.comboxWMSStatus.getValue();
if (WMSSTATUS != "") {
sql = sql + getAndConSql(sql, WMSSTATUS, " EXISTS (select * from wms where ASSOCIATEDNO=m.contractno and ISLOCK in( " + WMSSTATUS + "))");
}
var Mainstate = this.comboxMainstate.getValue();
if (Mainstate != "") {
sql = sql + getAndConSql(sql, Mainstate, "m.Mainstate in (" + Mainstate + ")");
}
var ExpirationDates = form.findField('ExpirationDates').getValue();
sql = sql + getAndConSql(sql, ExpirationDates, " c.ExpirationDates = " + ExpirationDates + "");
//#endregion formSearch
//#region formSearch2 隐藏查询面板
// //建单日期
// var CREATETIMEbgn = form2.findField('CREATETIMEbgn').getRawValue();
// sql = sql + getAndConSql(sql, CREATETIMEbgn, "B.CREATETIME >='" + CREATETIMEbgn + "'");
// var CREATETIMEend = form2.findField('CREATETIMEend').getRawValue();
// sql = sql + getAndConSql(sql, CREATETIMEend, "B.CREATETIME <='" + CREATETIMEend + "'");
// //接单日期
// var BSDATEbgn = form2.findField('BSDATEbgn').getRawValue();
// sql = sql + getAndConSql(sql, BSDATEbgn, "B.BSDATE >='" + BSDATEbgn + "'");
// var BSDATEend = form2.findField('BSDATEend').getRawValue();
// sql = sql + getAndConSql(sql, BSDATEend, "B.BSDATE <='" + BSDATEend + "'");
// //操作人
// var OP = form2.findField('OP').getValue();
// sql = sql + getAndConSql(sql, OP, "B.OP='" + OP + "'");
// //揽货人
// var SALE = form2.findField('SALE').getValue();
// sql = sql + getAndConSql(sql, SALE, "B.SALE='" + SALE + "'");
// // //录入人
// // var INPUTBY = form2.findField('INPUTBY').getValue();
// // sql = sql + getAndConSql(sql, INPUTBY, "INPUTBY='" + INPUTBY + "'");
// // //
// // var BSTYPE = form2.findField('BSTYPE').getValue();
// // sql = sql + getAndConSql(sql, BSTYPE, "BSTYPE='" + BSTYPE + "'");
// //牌号
// var CNTRTOTAL = form2.findField('CNTRTOTAL').getValue();
// sql = sql + getAndConSql(sql, CNTRTOTAL, "B.CNTRTOTAL like '%" + CNTRTOTAL + "%'");
// //业务状态
// var BSSTATUS = form2.findField('BSSTATUS').getValue();
// if (BSSTATUS != null) {
// if (BSSTATUS.toString().trim() == "锁定") {
// sql = sql + getAndConSql(sql, BSSTATUS, "B.BSSTATUS=1");
// }
// else if (BSSTATUS.toString().trim() == "未锁定") {
// sql = sql + getAndConSql(sql, BSSTATUS, "B.BSSTATUS=0");
// }
// }
// // //车队
// // var TRUCKER = form2.findField('TRUCKER').getValue();
// // sql = sql + getAndConSql(sql, TRUCKER, "TRUCKER='" + TRUCKER + "'");
// // //报关行
// // var CUSTOMSER = form2.findField('CUSTOMSER').getValue();
// // sql = sql + getAndConSql(sql, CUSTOMSER, "CUSTOMSER='" + CUSTOMSER + "'");
// //业务来源
// var BSSOURCE = form2.findField('BSSOURCE').getValue();
// sql = sql + getAndConSql(sql, BSSOURCE, "B.BSSOURCE='" + BSSOURCE + "'");
// //来源明细
// var BSSOURCEDETAIL = form2.findField('BSSOURCEDETAIL').getValue();
// sql = sql + getAndConSql(sql, BSSOURCEDETAIL, "B.BSSOURCEDETAIL='" + BSSOURCEDETAIL + "'");
// //装运方式
// var BLTYPE = form2.findField('BLTYPE').getValue();
// sql = sql + getAndConSql(sql, BLTYPE, "B.BLTYPE='" + BLTYPE + "'");
// // //备注
// // var REMARK = form2.findField('REMARK').getValue();
// // sql = sql + getAndConSql(sql, REMARK, "B.REMARK like '%" + REMARK + "%'");
//#endregion formSearch2
return sql;
},
getCondition_SinglePrint: function () {
var form = this.formSearch.getForm();
// var form2 = this.formSearch2.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
//隐藏查询面板
// this.panelSearch.hide();
this.isShowAdvancedQuery = 0;
//
var sql = "";
//var sql = " isnull(M.isdelete,0)=0 ";
//#region formSearch 查询面板
//编号包括(主提单号)
var HTH = form.findField('HTH').getValue();
sql = sql + getAndConSql(sql, HTH, "M.HTH like '%" + HTH + "%'");
var BILLNO = form.findField('BILLNO').getValue();
sql = sql + getAndConSql(sql, BILLNO, " M.BILLNO like '%" + BILLNO + "%'"); // or M.remark_4 like '%" + MblNo + "%')");
var remark_4 = form.findField('remark_4').getValue();
sql = sql + getAndConSql(sql, remark_4, " M.remark_4 like '%" + remark_4 + "%'");
var Other_Billno = form.findField('Other_Billno').getValue();
sql = sql + getAndConSql(sql, Other_Billno, "(M.Other_Billno like '%" + Other_Billno + "%' or M.Supplier_Billno like '%" + Other_Billno + "%' )");
var OP = form.findField('OP').getValue();
sql = sql + getAndConSql(sql, OP, "M.OP = '" + OP + "'");
//客户名称
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "M.buyer='" + CUSTOMERNAME + "'");
//到港日期
var ETDbgn = form.findField('ETDbgn').getRawValue();
sql = sql + getAndConSql(sql, ETDbgn, "M.arrivaldate >='" + ETDbgn + "'");
var ETDend = form.findField('ETDend').getRawValue();
sql = sql + getAndConSql(sql, ETDend, "M.arrivaldate <='" + ETDend + " 23:59:59'");
if (this.remind != "") {
sql = sql + getAndConSql(sql, this.remind, this.remind);
}
var ISDELETE = form.findField("ISDELETE").getValue();
if (ISDELETE)
{ sql = sql + getAndConSql(sql, ISDELETE, " m.ISDELETE = 1 "); }
else { sql = sql + getAndConSql(sql, "True", " m.ISDELETE = 0 "); }
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_5 like '%" + remark + "%' or m.remark_6 like '%" + remark + "%' or m.Receiptremark like '%" + remark + "%' )");
var creattimebgn = form.findField('creattimebgn').getRawValue();
sql = sql + getAndConSql(sql, creattimebgn, "M.creattime >='" + creattimebgn + "'");
var creattimeend = form.findField('creattimeend').getRawValue();
sql = sql + getAndConSql(sql, creattimeend, "M.creattime <='" + creattimeend + " 23:59:59'");
var CargoType = this.getStrValue(this.comboxCargoType.getValue());
sql = sql + getAndConSql(sql, CargoType, " exists( select 1 from import_cargo where contractno=m.contractno and cargotype in (" + CargoType + ")) ");
var port = this.comboxPort.getValue();
if (port != "") {
sql = sql + getAndConSql(sql, port, "m.port in (" + port + ")");
}
var WMSSTATUS = this.comboxWMSStatus.getValue();
if (WMSSTATUS != "") {
sql = sql + getAndConSql(sql, WMSSTATUS, " EXISTS (select * from wms where ASSOCIATEDNO=m.contractno and ISLOCK in( " + WMSSTATUS + "))");
}
var Mainstate = this.comboxMainstate.getValue();
if (Mainstate != "") {
sql = sql + getAndConSql(sql, Mainstate, "m.Mainstate in (" + Mainstate + ")");
}
return sql;
},
getStrValue: function (list) {
var _list = [];
for (var _i = 0; _i < list.length; _i++) {
_list.push("'" + list[_i] + "'");
}
return _list;
},
getStrValue2: function (list) {
var _list = "";
for (var _i = 0; _i < list.length; _i++) {
if (_list == "") {
_list = list[_i];
} else {
_list = "," + list[_i];
}
}
return _list;
},
// setIsShowAdvancedQuery: function () {
// if (this.isShowAdvancedQuery == 0) {
// this.panelSearch.show();
// this.isShowAdvancedQuery = 1;
// } else {
// this.panelSearch.hide();
// this.isShowAdvancedQuery = 0;
// }
// },
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.selectbsno;
ret[4] = 'op_seae';
return ret;
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
//GridExportExcelPage(this.gridListSale);
},
onHideUnSelected: function (button, event) {
var _storerecord = [];
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
this.storeList.removeAll();
this.storeList.add(selectedRecords);
},
/* for (i = 0; i < this.storectndisp.getCount(); i += 1) {
var itemindex = i + 1;
var memberyf = this.storectndisp.getAt(i);*/
Print_Q_ny: function () {
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_Q_ny'; //期货 牛羊
var sql1 = " select M.creattime 签订日期,M.Buy_Type 采购类型,M.hth 合同号,M.Other_Billno 分公司合同号,M.Supplier_Billno 供应商合同号,m.ContainerNo 箱号 ";
sql1 = sql1 + " ,(select substring(country,0,(charindex('(',country)) ) from code_country where countryid=m.countryid) 国家 ";
sql1 = sql1 + " ,tc.FactoryNo 厂号,tc.CargoType 产品类型,tc.name 中文名称,tc.ename 英文名称,tc.Exporter 供货商,m.Agent 代理商 ";
sql1 = sql1 + " ,c.weight_HT 预计重量,tc.Weight 实际重量,tc.productiondate_min 生产日期起,tc.productiondate_max 生产日期止 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) 目的港 ";
sql1 = sql1 + " ,dbo.trimdate(m.Sailingdate) 开船日,dbo.trimdate(m.ArrivalDate) 到港日 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=1 and EnumValueID=M.TransactionMethod) 成交方式 ";
sql1 = sql1 + " ,case when tc.currid='USD' then tc.price else 0 end 美元单价 ";
sql1 = sql1 + " ,case when tc.currid='EUR' then tc.price else 0 end 欧元单价 ";
sql1 = sql1 + " ,case when tc.currid='RMB' then tc.price else 0 end 人民币单价 ";
//sql1 = sql1 + " ,tc.Exchangerate*tc.price 人民币单价 ";
sql1 = sql1 + " ,(dbo.F_GetFee_sett(m.ContractNo,2,'*')-dbo.F_GetFee_sett(m.ContractNo,1,'*'))*dbo.f_cargoamount(tc.gid)/dbo.f_mainamount(tc.contractno) 资金占用 ";
sql1 = sql1 + " from import_main m ";
sql1 = sql1 + " left join ImportTrade_Cargo tc on tc.ContractNo=m.ContractNo ";
sql1 = sql1 + " left join Import_Cargo c on c.id=tc.id ";
sql1 = sql1 + " where m.MainState=0 and isnull(m.ISDELETE,0)=0 and tc.CargoType in('牛','羊') ";
var sql2 = "select '" + SHOWNAME + "' showname,'" + printdate + "' printdate";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_Q_Z: function () {
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_Q_Z'; //期货 猪
/*
var sql1 = " select M.creattime 签订日期,M.Buy_Type 采购类型,M.hth 合同号,M.Other_Billno 分公司合同号,M.Supplier_Billno 供应商合同号,m.ContainerNo 箱号 ";
sql1 = sql1 + " ,(select substring(country,0,(charindex('(',country)) ) from code_country where countryid=m.countryid) 国家 ";
sql1 = sql1 + " ,dbo.f_factoryno(M.contractno) 厂号,'' 产品类型,dbo.f_str(m.contractno) 中文名称,tc.ename 英文名称,tc.Exporter 供货商,m.Agent 代理商 ";
sql1 = sql1 + " ,c.weight_HT 预计重量,tc.Weight 实际重量,tc.productiondate_min 生产日期起,tc.productiondate_max 生产日期止 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) 目的港 ";
sql1 = sql1 + " ,dbo.trimdate(m.Sailingdate) 开船日,dbo.trimdate(m.ArrivalDate) 到港日 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=1 and EnumValueID=M.TransactionMethod) 成交方式 ";
sql1 = sql1 + " ,case when tc.currid='USD' then tc.price else 0 end 美元单价 ";
sql1 = sql1 + " ,case when tc.currid='EUR' then tc.price else 0 end 欧元单价 ";
sql1 = sql1 + " ,case when tc.currid='RMB' then tc.price else 0 end 人民币单价 ";
//sql1 = sql1 + " ,tc.Exchangerate*tc.price 人民币单价 ";
sql1 = sql1 + " ,(dbo.F_GetFee_sett(m.ContractNo,2,'*')-dbo.F_GetFee_sett(m.ContractNo,1,'*'))*dbo.f_cargoamount(tc.gid)/dbo.f_mainamount(tc.contractno) 资金占用 ";
sql1 = sql1 + " from import_main m ";
//sql1 = sql1 + " left join ImportTrade_Cargo tc on tc.ContractNo=m.ContractNo ";
//sql1 = sql1 + " left join Import_Cargo c on c.id=tc.id ";
sql1 = sql1 + " where m.MainState=0 and isnull(m.ISDELETE,0)=0 and tc.CargoType in('猪','鸡') ";
*/
var sql1 = " select M.creattime 签订日期,M.Buy_Type 采购类型,M.hth 合同号,M.Other_Billno 分公司合同号,M.Supplier_Billno 供应商合同号,m.ContainerNo 箱号 ";
sql1 = sql1 + " ,(select substring(country,0,(charindex('(',country)) ) from code_country where countryid=m.countryid) 国家 ";
sql1 = sql1 + " ,dbo.f_factoryno(M.contractno) 厂号,'' 产品类型,dbo.f_str(m.contractno) 中文名称,dbo.f_Str_En(m.contractno) 英文名称 ";
sql1 = sql1 + " ,m.seller 供货商,m.Agent 代理商,dbo.F_weight_HT(M.contractno) 预计重量,dbo.F_weight(M.contractno) 实际重量 ";
sql1 = sql1 + " ,(select min(productiondate_min) from Import_cargo where ContractNo=m.ContractNo) 生产日期起 ";
sql1 = sql1 + " ,(select max(productiondate_max) from Import_cargo where ContractNo=m.ContractNo) 生产日期止 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) 目的港 ";
sql1 = sql1 + " ,dbo.trimdate(m.Sailingdate) 开船日,dbo.trimdate(m.ArrivalDate) 到港日 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=1 and EnumValueID=M.TransactionMethod) 成交方式 ";
sql1 = sql1 + " ,case when (select top 1 currid from Import_cargo where ContractNo=m.ContractNo)='USD' then dbo.F_price(M.ContractNo) else '0' end 美元单价 ";
sql1 = sql1 + " ,case when (select top 1 currid from Import_cargo where ContractNo=m.ContractNo)='EUR' then dbo.F_price(M.ContractNo) else '0' end 欧元单价 ";
sql1 = sql1 + " ,case when (select top 1 currid from Import_cargo where ContractNo=m.ContractNo)='RMB' then dbo.F_price(M.ContractNo) else '0' end 人民币单价 ";
sql1 = sql1 + " ,(dbo.F_GetFee_sett(m.ContractNo,2,'*')-dbo.F_GetFee_sett(m.ContractNo,1,'*')) 资金占用 ";
sql1 = sql1 + " from import_main m ";
sql1 = sql1 + " where m.MainState=0 and isnull(m.ISDELETE,0)=0 ";
var T = this.getCondition_SinglePrint();
if (T != "") {
T = " and " + T;
sql1 = sql1 + T;
};
//sql1 = sql1 + " and EXISTS ( select CargoType from import_cargo where CargoType in('猪','鸡') and m.ContractNo=ContractNo) ";
var CargoType = this.getStrValue2(this.comboxCargoType.getValue());
var sql2 = "select '" + SHOWNAME + "' showname,'" + printdate + "' printdate,'" + CargoType + "' CargoType ";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_XH_ny: function () {
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_XH_ny'; //现货牛羊
var sql1 = " select m.Agent 代理商,dbo.trimdate(m.CustomsReleaseDate) 海关放行日,dbo.trimdate(w.wmsdate) 入库日期,m.hth 合同号 ";
sql1 = sql1 + " ,M.Supplier_Billno 供应商合同号 ,m.ContainerNo 箱号,ic.FactoryNo 厂号,ic.country 进口国 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) 目的港 ";
sql1 = sql1 + " ,ic.cargotype,ic.name,ic.productiondate_min,ic.productiondate_max,w.STORAGENAME 仓库,ic.BoxCount 合同件数 ";
sql1 = sql1 + " ,ic.weight 预计重量,w.GOODSPACKSTOCK 库存件数 ,w.GOODSSTOCK*1000 库存重量,ic.costprice 成本价 ";
sql1 = sql1 + " ,(dbo.F_GetFee_sett(m.ContractNo,2,'*')-dbo.F_GetFee_sett(m.ContractNo,1,'*'))*dbo.f_cargoamount(ic.gid)/dbo.f_mainamount(ic.contractno) 资金占用 ";
sql1 = sql1 + " from ImportTrade_Cargo ic ";
sql1 = sql1 + " left join import_main m on m.ContractNo=ic.ContractNo ";
sql1 = sql1 + " left join wms w on w.Cargo_gid=ic.gid ";
sql1 = sql1 + " where m.MainState=1 and isnull(m.ISDELETE,0)=0 and (w.GOODSPACKSTOCK>0 or w.GOODSSTOCK>0) and ic.CargoType in('牛','羊') ";
var sql2 = "select '" + SHOWNAME + "' showname,'" + printdate + "' printdate";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
,
Print_XH_zj: function () {
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_XH_zj'; //现货猪鸡
var sql1 = " select m.Agent 代理商,dbo.trimdate(m.CustomsReleaseDate) 海关放行日,dbo.trimdate(w.wmsdate) 入库日期,m.hth 合同号 ";
sql1 = sql1 + " ,M.Supplier_Billno 供应商合同号 ,m.ContainerNo 箱号,ic.FactoryNo 厂号,ic.country 进口国 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) 目的港 ";
sql1 = sql1 + " ,ic.cargotype,ic.name,ic.productiondate_min,ic.productiondate_max,w.STORAGENAME 仓库,ic.BoxCount 合同件数 ";
sql1 = sql1 + " ,ic.weight 预计重量,w.GOODSPACKSTOCK 库存件数 ,w.GOODSSTOCK*1000 库存重量,ic.costprice 成本价 ";
sql1 = sql1 + " ,(dbo.F_GetFee_sett(m.ContractNo,2,'*')-dbo.F_GetFee_sett(m.ContractNo,1,'*'))*dbo.f_cargoamount(ic.gid)/dbo.f_mainamount(ic.contractno) 资金占用 ";
sql1 = sql1 + " from ImportTrade_Cargo ic ";
sql1 = sql1 + " left join import_main m on m.ContractNo=ic.ContractNo ";
sql1 = sql1 + " left join wms w on w.Cargo_gid=ic.gid ";
sql1 = sql1 + " where m.MainState=1 and isnull(m.ISDELETE,0)=0 and (w.GOODSPACKSTOCK>0 or w.GOODSSTOCK>0) and ic.CargoType in('猪','鸡') ";
var sql2 = "select '" + SHOWNAME + "' showname,'" + printdate + "' printdate";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
,
Print_FYTZ_YF: function (HTH) {
var MainList = "";
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'" + rec.get('ContractNo') + "'"; }
else {
MainList = MainList + ",'" + rec.get('ContractNo') + "'";
}
}
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_YF'; //费用通知单 预付
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,'预付款',2) 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,'代理费',2) daili_1,dbo.get_Fee(m.contractno,'拖车费',2) tuoche,dbo.get_Fee(m.contractno,'THC',2) 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 + " ,m.Supplier_Billno+' '+m.Other_Billno 其他合同号 ";
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 c.bsno 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=2 ";
var sql3 = " select ic.description name,icb.BANKNAME YH,icb.ACCOUNT ZH from info_client ic ";
sql3 = sql3 + " left join info_client_bank icb on ic.GID=icb.LINKID where SHORTNAME in(select agent 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,'预付款',2)) RMBprepayments from import_main m where M.contractno in(" + MainList + ") ";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_FYTZ_WK: function (HTH) { //尾款_天津
var MainList = "";
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'" + rec.get('ContractNo') + "'"; }
else {
MainList = MainList + ",'" + rec.get('ContractNo') + "'";
}
}
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,'尾款',2)+dbo.get_Fee(m.contractno,'购货款',2) 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,'代理费',2) daili_1,(select max(unitprice) from ch_fee where feename='代理费' and feetype=2 and bsno=m.contractno) daili_unitprice";
sql1 = sql1 + " ,dbo.get_Fee(m.contractno,'拖车费',2) tuoche,dbo.get_Fee(m.contractno,'THC',2) THC,dbo.get_Fee(m.contractno,'商检验货费',2) 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 + " ,m.Supplier_Billno+' '+m.Other_Billno 其他合同号 ";
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='关税' or c.feename='增值税' or c.feename='购货款' or (c.feename='手续费' and c.remark='尾款手续费') ";
sql2 = sql2 + " or (c.feename='电汇费' and c.remark='尾款电汇费') or c.feename='代理费' or c.feename='拖车费' or c.feename='THC' or c.feename='商检验货费' ) ";
sql2 = sql2 + " and c.feetype=2 ";
var sql3 = " select ic.description name,icb.BANKNAME YH,icb.ACCOUNT ZH from info_client ic ";
sql3 = sql3 + " left join info_client_bank icb on ic.GID=icb.LINKID where SHORTNAME in(select agent 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,'尾款',2)+dbo.get_Fee(m.contractno,'购货款',2)) 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_0: function () {
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_ImportTrade_0'; //期货 牛羊
var sql1 = " select (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=28 and EnumValueID=M.MainState) as 期货现货,M.OP 操作人 ";
sql1 = sql1 + " ,isnull(ic.sale_weight,0) 售出重量,dbo.trimdate(m.creattime) 合同签定日期,m.hth 二商合同号,m.Other_Billno 分公司合同号,M.Buy_Op 采购人,M.Agent 代理商 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=1 and EnumValueID=M.TransactionMethod) 成交方式 ";
sql1 = sql1 + " ,(dbo.F_GetFee_sett(m.ContractNo,2,'*')-dbo.F_GetFee_sett(m.ContractNo,1,'*'))*dbo.f_cargoamount(ic.gid)/dbo.f_mainamount(c.contractno) 资金占用 ";
sql1 = sql1 + " ,m.Supplier_Billno 供应商合同号,m.ContainerNo 箱号,(select substring(country,0,(charindex('(',country)) ) from code_country where countryid=m.countryid) 国家 ";
sql1 = sql1 + " ,ic.FactoryNo 厂号,ic.CargoType 产品,c.SPECIFICATIONS 商品规格,ic.Exporter 供应商,ic.name 产品描述中文 ";
sql1 = sql1 + " ,c.BOXCOUNT_HT 件数,c.WEIGHT_HT 预计重量,ic.[Weight] 单据重量,ic.BoxCount 单据件数,case isnull(ic.BoxCount,0) when 0 then 0 else isnull(ic.[Weight],0)/ic.BoxCount end 平均重量 ";
sql1 = sql1 + " ,ic.sale_weight 销售重量,ic.sale_boxcount 销售件数";
sql1 = sql1 + " ,c.productiondate_min 生产日期起,c.productiondate_max 生产日期止,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) 目的港 ";
sql1 = sql1 + " ,dbo.trimdate( m.Sailingdate) ETD,dbo.trimdate( m.ArrivalDate) ETA ,dbo.trimdate(m.Ex_sailingdate) 预计开船日 ";
sql1 = sql1 + " ,m.ShipCompany_id 船公司,m.Billno 提单号,dbo.F_ImportTrade_SealInfo(c.GID) 销售摘要 ";
sql1 = sql1 + " ,c.CargoType 商品类型,c.ename 英文品名,c.currid 币别,c.price 单价,m.remark 船期备注";
sql1 = sql1 + " ,isnull(c.weight_act,0)-isnull((select sum(weight) from import_saledetail where cargo_gid=c.gid),0) 待售重量 ";
sql1 = sql1 + " ,(select top 1 costprice from ImportTrade_Cargo where gid=ic.gid) 成本价 ";
sql1 = sql1 + " from ImportTrade_Cargo ic ";
sql1 = sql1 + " left join import_main m on m.ContractNo=ic.ContractNo ";
sql1 = sql1 + " left join import_cargo c on c.id=ic.id ";
var T = this.sqlcontext;
if (T != "") { T = " where " + T; };
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);
},
Print_KHZD: function () {
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_ImportTrade_KHZD'; //期货 牛羊
var sql1 = " select (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=28 and EnumValueID=M.MainState) as 期货现货,M.OP 操作人 ";
sql1 = sql1 + " ,isnull(ic.sale_weight,0) 售出重量,dbo.trimdate(m.creattime) 合同签定日期,m.hth 二商合同号,m.Other_Billno 分公司合同号,M.Buy_Op 采购人,M.Agent 代理商 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=1 and EnumValueID=M.TransactionMethod) 成交方式 ";
sql1 = sql1 + " ,(dbo.F_GetFee_sett(m.ContractNo,2,'*')-dbo.F_GetFee_sett(m.ContractNo,1,'*'))*dbo.f_cargoamount(ic.gid)/dbo.f_mainamount(c.contractno) 资金占用 ";
sql1 = sql1 + " ,m.Supplier_Billno 供应商合同号,m.ContainerNo 箱号,(select substring(country,0,(charindex('(',country)) ) from code_country where countryid=m.countryid) 国家 ";
sql1 = sql1 + " ,ic.FactoryNo 厂号,ic.CargoType 产品,c.SPECIFICATIONS 商品规格,ic.Exporter 供应商,ic.name 产品描述中文 ";
sql1 = sql1 + " ,c.BOXCOUNT_HT 件数,c.WEIGHT_HT 预计重量,ic.[Weight] 单据重量,ic.BoxCount 单据件数,case isnull(ic.BoxCount,0) when 0 then 0 else isnull(ic.[Weight],0)/ic.BoxCount end 平均重量 ";
sql1 = sql1 + " ,ic.sale_weight 销售重量,ic.sale_boxcount 销售件数";
sql1 = sql1 + " ,c.productiondate_min 生产日期起,c.productiondate_max 生产日期止,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) 目的港 ";
sql1 = sql1 + " ,dbo.trimdate( m.Sailingdate) ETD,dbo.trimdate( m.ArrivalDate) ETA ,dbo.trimdate(m.Ex_sailingdate) 预计开船日 ";
sql1 = sql1 + " ,m.ShipCompany_id 船公司,m.Billno 提单号,dbo.F_ImportTrade_SealInfo(c.GID) 销售摘要 ";
sql1 = sql1 + " ,c.CargoType 商品类型,c.ename 英文品名,c.currid 币别,c.price 单价,m.remark 船期备注";
sql1 = sql1 + " ,isnull(c.weight_act,0)-isnull((select sum(weight) from import_saledetail where cargo_gid=c.gid),0) 待售重量 ";
sql1 = sql1 + " from ImportTrade_Cargo ic ";
sql1 = sql1 + " left join import_main m on m.ContractNo=ic.ContractNo ";
sql1 = sql1 + " left join import_cargo c on c.id=ic.id ";
var T = this.getCondition();
if (T != "") { T = " where " + T; };
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);
}
,
Print_KHZD4: function () {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
var billNo = record.data.ContractNo;
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_importtrade_KHZD4';
var sql1 = " select HTH 合同号,Supplier_Billno 供应商合同号,Other_Billno 分公司合同号 ";
sql1 = sql1 + " ,dbo.f_count2(m.ContractNo) 单据件数 ";
sql1 = sql1 + " ,(select top 1 customername from Import_Sales where SALESNO in(select distinct salesno from Import_Saledetail where bsno=m.ContractNo) and Salestatus<>2 ) 销售对象,m.buyer 购货方 ";
sql1 = sql1 + " ,dbo.F_weight_kg(m.ContractNo) 单据重量 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) 目的港 ";
sql1 = sql1 + " ,m.ArrivalDate 到港日,m.ContainerNo 箱号,dbo.F_factoryno(contractno) 厂号 ";
sql1 = sql1 + " ,(select substring(country,0,(charindex('(',country)) ) from code_country where countryid=m.countryid) 进口国 ";
sql1 = sql1 + " ,dbo.F_Str(M.ContractNo) 品名,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=1 and EnumValueID=M.TransactionMethod) 成交方式 ";
sql1 = sql1 + " ,dbo.F_Saleprice(M.ContractNo) 价格,(select top 1 SALER from Import_Sales where SALESNO in(select distinct salesno from Import_Saledetail where bsno=m.ContractNo) and Import_Sales.Salestatus<>2 ) 销售员 ";
sql1 = sql1 + " ,case (select top 1 CURRENCY from Import_Sales where SALESNO in(select salesno from Import_Saledetail where BSNO=m.ContractNo) and Import_Sales.Salestatus<>2 ) when 'USD' then '$' when 'RMB' then '¥' when 'EUR' then '€' else '' end 币别符号 ";
sql1 = sql1 + " ,m.agent+' '+m.agent2+' '+m.agent3 代理商 ";
sql1 = sql1 + " from import_main m ";
sql1 = sql1 + " where M.contractno ='" + billNo + "' ";
var sql2 = " select c.name 品名,SD.price*1000 单价吨,convert(numeric(18,2),ic.weight) 千克数,convert(varchar(20),convert(numeric(18,5),ic.weight/1000)) 吨数 ";
sql2 = sql2 + " ,ic.Exchangerate_Cust 应收汇率,SD.price*ic.weight 销售金额,ic.currid 币别 ";
sql2 = sql2 + " ,ic.Exchangerate_Cust*SD.price*ic.weight 货款RMB ";
sql2 = sql2 + " ,dbo.[F_GetFee](c.contractno,2,'手续费')*dbo.f_cargoamount(c.gid)/dbo.f_mainamount(c.contractno) 手续费 ";
sql2 = sql2 + " ,150*dbo.f_cargoamount(c.gid)/dbo.f_mainamount(c.contractno) 电汇费 ";
sql2 = sql2 + " ,(case when isnull((select charindex('调快',m.remark_6)),-1)>0 then 1000 else 0 end)*dbo.f_cargoamount(c.gid)/dbo.f_mainamount(c.contractno) 调快费 ";
sql2 = sql2 + " ,c.costCargo 总货款,c.price_limit*1000 海关限价吨,c.Exchangerate_Customs 海关汇率 ";
sql2 = sql2 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=1 and EnumValueID=M.TransactionMethod) 成交方式 ";
sql2 = sql2 + " ,c.tax 关税税率 ,c.tax_zz 增值税税率 ";
sql2 = sql2 + " ,case when (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=1 and EnumValueID=M.TransactionMethod)='CFR' then ";
sql2 = sql2 + " case when (SD.price>isnull(c.price_limit,0)) then 1.003*SD.price*ic.weight*c.tax*c.Exchangerate_Customs else (1.003*c.price_limit*ic.weight*c.tax*c.Exchangerate_Customs) end ";
sql2 = sql2 + " else ";
sql2 = sql2 + " case when (SD.price>isnull(c.price_limit,0)) then SD.price*ic.weight*c.tax*c.Exchangerate_Customs else (c.price_limit*ic.weight*c.tax*c.Exchangerate_Customs) end end ";
sql2 = sql2 + " 应收关税 ";
sql2 = sql2 + " ,case when (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=1 and EnumValueID=M.TransactionMethod)='CFR' then ";
sql2 = sql2 + " case when (SD.price>isnull(c.price_limit,0)) then 1.003*SD.price*ic.weight*(1+c.tax)*c.Exchangerate_Customs*c.tax_zz else 1.003*c.price_limit*ic.weight*(1+c.tax)*c.Exchangerate_Customs*c.tax_zz end ";
sql2 = sql2 + " else ";
sql2 = sql2 + " case when (SD.price>isnull(c.price_limit,0)) then SD.price*ic.weight*(1+c.tax)*c.Exchangerate_Customs*c.tax_zz else c.price_limit*ic.weight*(1+c.tax)*c.Exchangerate_Customs*c.tax_zz end end ";
sql2 = sql2 + " 应收增值税 ";
sql2 = sql2 + " ,ic.AGENCRATE_Cust 代理费单价 ,convert(numeric(18,2),ic.AGENCRATE_Cust*c.weight/1000) 代理费,w.STORAGENAME 冷库 ";
sql2 = sql2 + " ,w.GOODSPACK 入库件数,case isnull(M.Inspection_Storage,0) when 0 then '否' else '是' end 是否商检慢检 ";
sql2 = sql2 + " ,dbo.trimdate(m.inspection_date) 商检验货日期,dbo.trimdate(m.Unsealdate) 商检放行日期,ic.STOCKDATE_2 冷藏费截止日 ";
sql2 = sql2 + " ,sd.PRICEREMARK 价格备注 ";
sql2 = sql2 + " ,(select substring(sd.PRICEREMARK,charindex('+',sd.PRICEREMARK)+1,len(sd.PRICEREMARK)) ) 价格备注费率 ";
sql2 = sql2 + " ,dbo.trimdate(ic.STOCKDATE_1) 冷藏费开始日 ";
sql2 = sql2 + " ,case when isnull(dbo.trimdate(m.Unsealdate) ,'')='' then isnull(DATEDIFF(DAY, ic.STOCKDATE_1, ic.STOCKDATE_2), 0)+1 else isnull(DATEDIFF(DAY, m.Unsealdate, ic.STOCKDATE_2), 0)+1 end 冷藏天数 ";
sql2 = sql2 + " ,dbo.[Get_ClientFee](w.STORAGENAME,'冷藏费')*c.weight/1000*(case when isnull(dbo.trimdate(m.Unsealdate) ,'')='' then isnull(DATEDIFF(DAY, ic.STOCKDATE_1, ic.STOCKDATE_2), 0)+1 else isnull(DATEDIFF(DAY, m.Unsealdate, ic.STOCKDATE_2), 0)+1 end) 冷藏费 ";
sql2 = sql2 + " ,dbo.[Get_ClientFee](w.STORAGENAME,'冷藏费') 冷库默认费率 ";
sql2 = sql2 + " ,dbo.[Get_ClientFee](w.STORAGENAME,'出入库费') 出入库费率 ";
sql2 = sql2 + " ,dbo.[Get_ClientFee](w.STORAGENAME,'倒柜费') 倒柜费率 ";
sql2 = sql2 + " ,dbo.[Get_ClientFee](w.STORAGENAME,'倒柜费')*dbo.f_cargoamount(c.gid)/dbo.f_mainamount(c.contractno) 倒柜费率按比例分摊 ";
sql2 = sql2 + " ,c.weight*SD.price 单据金额,dbo.trimdate(ic.STOCKDATE_2) 出库时间 "; //
sql2 = sql2 + " ,dbo.[F_SettlementDate_Import](m.contractno,m.Agent,'预付款') 向代理商付预付款结算时间 ";
sql2 = sql2 + " ,dbo.[F_SettlementDate_Import](m.contractno,m.Agent,'尾款') 向代理商付尾款结算时间 ";
/*sql2 = sql2 + " ,isnull(case when isnull(dbo.[F_SettlementDate_Import](m.contractno,m.Agent,'预付款'),'')<>'' and isnull(dbo.[F_SettlementDate_Import](m.contractno,m.Agent,'尾款'),'')='' ";
sql2 = sql2 + " then datediff(day,dbo.[F_SettlementDate_Import](m.contractno,m.Agent,'预付款'),m.STOCKDATE_2)+1 ";
sql2 = sql2 + " else datediff(day,dbo.[F_SettlementDate_Import](m.contractno,m.Agent,'尾款'),m.STOCKDATE_2)+1 end,0) 资金占用时间 ";*/
sql2 = sql2 + " ,case when isnull(dbo.trimdate(m.Unsealdate) ,'')='' then isnull(DATEDIFF(DAY, ic.STOCKDATE_1, ic.STOCKDATE_2), 0)+1 else isnull(DATEDIFF(DAY, m.Unsealdate, ic.STOCKDATE_2), 0)+1 end 资金占用时间 ";
sql2 = sql2 + " ,SD.PREPAYMENT_ACT 定金,sd.PRICE 销售价格,s.currency 销售币别,s.FUNDRATE 资金利息利率 ";
sql2 = sql2 + " from importtrade_cargo c ";
sql2 = sql2 + " left join import_cargo ic on ic.GID=c.GID ";
sql2 = sql2 + " left join import_main m on m.ContractNo=c.ContractNo ";
sql2 = sql2 + " left join wms w on w.Cargo_gid=c.GID ";
sql2 = sql2 + " left join Import_Saledetail sd on sd.CARGO_GID=c.gid ";
sql2 = sql2 + " left join Import_Sales s on s.SALESNO=sd.SALESNO and s.Salestatus<>2 ";
sql2 = sql2 + " where c.contractno ='" + billNo + "' ";
var sql3 = " select c.name 品名,SD.price*1000 单价吨,convert(numeric(18,2),ic.weight) 千克数,convert(varchar(20),convert(numeric(18,5),ic.weight/1000)) 吨数 ";
sql3 = sql3 + " ,1 应收汇率,SD.price*ic.weight 销售金额,ic.currid 币别 ";
sql3 = sql3 + " ,1*SD.price*ic.weight 货款RMB ";
sql3 = sql3 + " ,dbo.[F_GetFee](c.contractno,2,'手续费')*dbo.f_cargoamount(c.gid)/dbo.f_mainamount(c.contractno) 手续费 ";
sql3 = sql3 + " ,150*dbo.f_cargoamount(c.gid)/dbo.f_mainamount(c.contractno) 电汇费 ";
sql3 = sql3 + " ,(case when isnull((select charindex('调快',m.remark_6)),-1)>0 then 1000 else 0 end)*dbo.f_cargoamount(c.gid)/dbo.f_mainamount(c.contractno) 调快费 ";
sql3 = sql3 + " ,c.costCargo 总货款,c.price_limit*1000 海关限价吨,c.Exchangerate_Customs 海关汇率 ";
sql3 = sql3 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=1 and EnumValueID=M.TransactionMethod) 成交方式 ";
sql3 = sql3 + " ,c.tax 关税税率 ,c.tax_zz 增值税税率 ";
sql3 = sql3 + " ,case when (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=1 and EnumValueID=M.TransactionMethod)='CFR' then ";
sql3 = sql3 + " case when (SD.price>isnull(c.price_limit,0)) then 1.003*SD.price*ic.weight*c.tax*c.Exchangerate_Customs else (1.003*c.price_limit*ic.weight*c.tax*c.Exchangerate_Customs) end ";
sql3 = sql3 + " else ";
sql3 = sql3 + " case when (SD.price>isnull(c.price_limit,0)) then SD.price*ic.weight*c.tax*c.Exchangerate_Customs else (c.price_limit*ic.weight*c.tax*c.Exchangerate_Customs) end end ";
sql3 = sql3 + " 应收关税 ";
sql3 = sql3 + " ,case when (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=1 and EnumValueID=M.TransactionMethod)='CFR' then ";
sql3 = sql3 + " case when (SD.price>isnull(c.price_limit,0)) then 1.003*SD.price*ic.weight*(1+c.tax)*c.Exchangerate_Customs*c.tax_zz else 1.003*c.price_limit*ic.weight*(1+c.tax)*c.Exchangerate_Customs*c.tax_zz end ";
sql3 = sql3 + " else ";
sql3 = sql3 + " case when (SD.price>isnull(c.price_limit,0)) then SD.price*ic.weight*(1+c.tax)*c.Exchangerate_Customs*c.tax_zz else c.price_limit*ic.weight*(1+c.tax)*c.Exchangerate_Customs*c.tax_zz end end ";
sql3 = sql3 + " 应收增值税 ";
sql3 = sql3 + " ,ic.AGENCRATE_Cust 代理费单价 ,convert(numeric(18,2),ic.AGENCRATE_Cust*c.weight/1000) 代理费,w.STORAGENAME 冷库 ";
sql3 = sql3 + " ,w.GOODSPACK 入库件数,case isnull(M.Inspection_Storage,0) when 0 then '否' else '是' end 是否商检慢检 ";
sql3 = sql3 + " ,dbo.trimdate(m.inspection_date) 商检验货日期,dbo.trimdate(m.Unsealdate) 商检放行日期,ic.STOCKDATE_2 冷藏费截止日 ";
sql3 = sql3 + " ,sd.PRICEREMARK 价格备注 ";
sql3 = sql3 + " ,(select substring(sd.PRICEREMARK,charindex('+',sd.PRICEREMARK)+1,len(sd.PRICEREMARK)) ) 价格备注费率 ";
sql3 = sql3 + " ,dbo.trimdate(ic.STOCKDATE_1) 冷藏费开始日 ";
sql3 = sql3 + " ,case when isnull(dbo.trimdate(m.Unsealdate) ,'')='' then isnull(DATEDIFF(DAY, ic.STOCKDATE_1, ic.STOCKDATE_2), 0)+1 else isnull(DATEDIFF(DAY, m.Unsealdate, ic.STOCKDATE_2), 0)+1 end 冷藏天数 ";
sql3 = sql3 + " ,dbo.[Get_ClientFee](w.STORAGENAME,'冷藏费')*c.weight/1000*(case when isnull(dbo.trimdate(m.Unsealdate) ,'')='' then isnull(DATEDIFF(DAY, ic.STOCKDATE_1, ic.STOCKDATE_2), 0)+1 else isnull(DATEDIFF(DAY, m.Unsealdate, ic.STOCKDATE_2), 0)+1 end) 冷藏费 ";
sql3 = sql3 + " ,dbo.[Get_ClientFee](w.STORAGENAME,'冷藏费') 冷库默认费率 ";
sql3 = sql3 + " ,dbo.[Get_ClientFee](w.STORAGENAME,'出入库费') 出入库费率 ";
sql3 = sql3 + " ,dbo.[Get_ClientFee](w.STORAGENAME,'倒柜费') 倒柜费率 ";
sql3 = sql3 + " ,dbo.[Get_ClientFee](w.STORAGENAME,'倒柜费')*dbo.f_cargoamount(c.gid)/dbo.f_mainamount(c.contractno) 倒柜费率按比例分摊 ";
sql3 = sql3 + " ,c.weight*SD.price 单据金额,dbo.trimdate(ic.STOCKDATE_2) 出库时间 "; //
sql3 = sql3 + " ,dbo.[F_SettlementDate_Import](m.contractno,m.Agent,'预付款') 向代理商付预付款结算时间 ";
sql3 = sql3 + " ,dbo.[F_SettlementDate_Import](m.contractno,m.Agent,'尾款') 向代理商付尾款结算时间 ";
/*sql3 = sql3 + " ,isnull(case when isnull(dbo.[F_SettlementDate_Import](m.contractno,m.Agent,'预付款'),'')<>'' and isnull(dbo.[F_SettlementDate_Import](m.contractno,m.Agent,'尾款'),'')='' ";
sql3 = sql3 + " then datediff(day,dbo.[F_SettlementDate_Import](m.contractno,m.Agent,'预付款'),m.STOCKDATE_2)+1 ";
sql3 = sql3 + " else datediff(day,dbo.[F_SettlementDate_Import](m.contractno,m.Agent,'尾款'),m.STOCKDATE_2)+1 end,0) 资金占用时间 ";*/
sql3 = sql3 + " ,case when isnull(dbo.trimdate(m.Unsealdate) ,'')='' then isnull(DATEDIFF(DAY, ic.STOCKDATE_1, ic.STOCKDATE_2), 0)+1 else isnull(DATEDIFF(DAY, m.Unsealdate, ic.STOCKDATE_2), 0)+1 end 资金占用时间 ";
sql3 = sql3 + " ,SD.PREPAYMENT_ACT 定金,sd.PRICE 销售价格,s.currency 销售币别,s.FUNDRATE 资金利息利率 ";
sql3 = sql3 + " from importtrade_cargo c ";
sql3 = sql3 + " left join import_cargo ic on ic.GID=c.GID ";
sql3 = sql3 + " left join import_main m on m.ContractNo=c.ContractNo ";
sql3 = sql3 + " left join wms w on w.Cargo_gid=c.GID ";
sql3 = sql3 + " left join Import_Saledetail sd on sd.CARGO_GID=c.gid ";
sql3 = sql3 + " left join Import_Sales s on s.SALESNO=sd.SALESNO and s.Salestatus<>2 ";
sql3 = sql3 + " where c.contractno ='" + billNo + "' ";
var sql4 = "";
var sql5 = "";
var sql6 = "select '" + SHOWNAME + "' showname,'" + printdate + "' printdate";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
,
Print_YFList: function () {
var MainList = "";
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'" + rec.get('ContractNo') + "'"; }
else {
MainList = MainList + ",'" + rec.get('ContractNo') + "'";
}
}
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 = 'BJES_YFWKList'; //费用通知单 预付
var sql1 = " select m.contractno,agent 代理,hth+' '+Supplier_Billno+' '+Other_Billno 合同号 ";
sql1 = sql1 + " ,(select substring(country,0,(charindex('(',country)) ) from code_country where countryid=m.countryid) 国家 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) 目的港 ";
sql1 = sql1 + " ,dbo.F_factoryno(m.ContractNo) 厂号,dbo.F_Str(m.ContractNo) 品名 ";
sql1 = sql1 + " ,dbo.f_getfee(m.ContractNo,2,'预付款') 预付款rmb,(select sum(pay_prepayments) from import_cargo where m.ContractNo=ContractNo) ";
sql1 = sql1 + " , dbo.f_danhao((select min(gid) from ch_fee where BSNO=m.ContractNo and FEETYPE=2 and FEENAME='预付款'),4) 申请单号 ";
sql1 = sql1 + " ,(select dbo.trimdate(min(payabletime)) from ch_fee_payapplication where billno ";
sql1 = sql1 + " in(select billno from ch_fee_do where feeid= ";
sql1 = sql1 + " (select min(gid) from ch_fee where BSNO=m.ContractNo and FEETYPE=2 and FEENAME='预付款') )) 申请支付日期 ";
sql1 = sql1 + " ,dbo.f_danhao((select min(gid) from ch_fee where BSNO=m.ContractNo and FEETYPE=2 and FEENAME='预付款'),1) 结算单号 ";
sql1 = sql1 + " from import_main m ";
sql1 = sql1 + " where m.contractno in(" + MainList + ") ";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
,
Print_WKList: function () {
var MainList = "";
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'" + rec.get('ContractNo') + "'"; }
else {
MainList = MainList + ",'" + rec.get('ContractNo') + "'";
}
}
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 = 'BJES_WKList'; //费用通知单 预付
var sql1 = " select m.contractno,agent 代理,hth+' '+Supplier_Billno+' '+Other_Billno 合同号,m.containerno 箱号 ";
sql1 = sql1 + " ,(select substring(country,0,(charindex('(',country)) ) from code_country where countryid=m.countryid) 国家 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) 目的港 ";
sql1 = sql1 + " ,dbo.F_factoryno(m.ContractNo) 厂号,dbo.F_Str(m.ContractNo) 品名,dbo.trimdate(m.ArrivalDate) 到港日 ";
sql1 = sql1 + " ,dbo.f_getfee(m.ContractNo,2,'尾款') 尾款 ";
sql1 = sql1 + " ,dbo.f_getfee(m.ContractNo,2,'关税')+dbo.f_getfee(m.ContractNo,2,'增值税') 税金 ";
sql1 = sql1 + " ,dbo.f_getfee(m.ContractNo,2,'代理费') 代理费 ";
sql1 = sql1 + " ,(select sum(pay_balance) from import_cargo where m.ContractNo=ContractNo) 应付汇 ";
sql1 = sql1 + " , dbo.f_danhao((select min(gid) from ch_fee where BSNO=m.ContractNo and FEETYPE=2 and FEENAME='尾款'),4) 尾款申请单号 ";
sql1 = sql1 + " ,(select dbo.trimdate(min(payabletime)) from ch_fee_payapplication where billno ";
sql1 = sql1 + " in(select billno from ch_fee_do where feeid= ";
sql1 = sql1 + " (select min(gid) from ch_fee where BSNO=m.ContractNo and FEETYPE=2 and FEENAME='尾款') )) 尾款申请支付日期 ";
sql1 = sql1 + " , dbo.f_danhao((select min(gid) from ch_fee where BSNO=m.ContractNo and FEETYPE=2 and FEENAME='尾款'),1) 尾款结算单号 ";
sql1 = sql1 + " , dbo.f_danhao((select min(gid) from ch_fee where BSNO=m.ContractNo and FEETYPE=2 and FEENAME='增值税'),4) 增值税申请单号 ";
sql1 = sql1 + " ,(select dbo.trimdate(min(payabletime)) from ch_fee_payapplication where billno ";
sql1 = sql1 + " in(select billno from ch_fee_do where feeid= ";
sql1 = sql1 + " (select min(gid) from ch_fee where BSNO=m.ContractNo and FEETYPE=2 and FEENAME='增值税') )) 增值税申请支付日期 ";
sql1 = sql1 + " , dbo.f_danhao((select min(gid) from ch_fee where BSNO=m.ContractNo and FEETYPE=2 and FEENAME='增值税'),1) 增值税结算单号 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=6 and EnumValueID=M.Billtype) 提单提交方式 ";
sql1 = sql1 + " , dbo.F_price(contractno) 采购单价,dbo.F_weight_KG(ContractNo) 单据重量kg ";
sql1 = sql1 + " from import_main m ";
sql1 = sql1 + " where m.contractno in(" + MainList + ") ";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
, Print_Ship: function () {//船期表
var MainList = "";
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'" + rec.get('ContractNo') + "'"; }
else {
MainList = MainList + ",'" + rec.get('ContractNo') + "'";
}
}
var printType = 'BJES_ship'; //船期
var T = this.getCondition();
if (T != "") { T = " where " + T; }
//业务状态 操作人 合同签定日期 采购人员 销售情况 二商合同号 分公司合同号 供应商合同号 箱号
//国家 厂号 类型 供应商 代理商 品名 商品规格 预计重量 单据件数 单据重量 生产日期起 生产日期止
//目的港 ETD ETA 船期备注 成交方式 船公司 提单号 销售摘要
var sql1 = " select s.CUSTOMERNAME 销售对象,s.SALER 销售员,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=28 and EnumValueID=M.MainState) 业务状态 ";
sql1 = sql1 + " ,isnull((select sum(weight) from import_saledetail where bsno=m.ContractNo and exists (select 1 from import_sales where salesno=import_saledetail.salesno and mainstate<>2 )),0) 已售重量 ";
sql1 = sql1 + " ,m.op 操作人,dbo.trimdate(m.creattime) 合同签订,m.Buy_OP 采购人员,m.hth 合同号,m.Other_Billno 分公司合同号,m.Supplier_Billno 供应商合同号,m.ContainerNo 箱号 ";
sql1 = sql1 + " ,(select substring(country,0,(charindex('(',country)) ) from code_country where countryid=m.countryid) 国家 ";
sql1 = sql1 + " ,dbo.F_factoryno(m.ContractNo) 厂号,(select top 1 cargotype from Import_cargo where ContractNo=m.ContractNo) 类型 ";
sql1 = sql1 + " ,m.seller 供应商,m.Agent+isnull(' '+m.AGENT2,'')+isnull(' '+m.AGENT3,'') 代理商 ";
sql1 = sql1 + " ,dbo.F_Str(m.ContractNo) 品名,dbo.f_SPECIFICATIONS(m.ContractNo) 商品规格 ";
sql1 = sql1 + " ,dbo.F_weight_HT_KG(m.ContractNo) 预计重量,dbo.F_weight_KG(m.ContractNo) 单据重量,dbo.F_BOXCount(m.ContractNo) 单据件数 ";
sql1 = sql1 + " ,dbo.[F_Import_productiondate_min](m.ContractNo) 生产日期起,dbo.[F_Import_productiondate_max](m.ContractNo) 生产日期止 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) 目的港 ";
sql1 = sql1 + " ,dbo.trimdate(m.Sailingdate) ETD,dbo.trimdate(m.ArrivalDate) ETA,m.remark 船期备注 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=1 and EnumValueID=M.TransactionMethod) 成交方式 ";
sql1 = sql1 + " ,m.ShipCompany_id 船公司,m.Billno 提单号,dbo.[F_ImportTrade_SaleInfo_Main](m.ContractNo) 销售摘要 ";
sql1 = sql1 + " ,(select top 1 wmsdate from wms where ASSOCIATEDNO=m.contractno) 入库日期 ";
sql1 = sql1 + " ,(select top 1 STORAGENAME from wms where ASSOCIATEDNO=m.contractno) 冷库 ";
sql1 = sql1 + " from import_main M ";
sql1 = sql1 + " left join import_sales s on s.SALESNO in(select SALESNO from Import_Saledetail where SALESNO=s.Salesno and BSNO=m.contractno) and s.mainstate<>2 ";
if (MainList != "") {
sql1 = sql1 + " where m.contractno in( " + MainList + " ) "; //and isnull(dbo.trimdate(m.inspection_date),'')=''
} else {
sql1 = sql1 + T;
}
sql1 = sql1 + " order by s.SALER,s.CUSTOMERNAME,m.OP ";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});