Ext.namespace('Shipping');
Shipping.MsChForeignPayIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsChForeignPayIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsChForeignPayIndex, Ext.Panel, {
PageSize: 500,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
editype: '',
selectbsno: '',
sortfield: '',
sortdire: '',
remind: null,
VISIBLERANGE: 4,
OPERATERANGE: 4,
initUIComponents: function () {
Ext.Ajax.timeout = 120000;
//定义数据集
_this = this;
if (SPTYPE == "跟单销售") {
this.formname = "formImportSalesIndex"; //页面名称
this.formname_Single = "formImportSalesIndex_single"; //页面名称
}
if (SPTYPE == "财务核销") {
this.formname = "formImportSalesIndex_CWHX"; //页面名称
}
this.formname_body = "formImportSalesEdit_detail"; //页面名称
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.StoreOpRange.load({ params: { optype: "modImportSales"} });
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.Pagenum_Single = 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();
}
}
}
});
//#region 主列表页面
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'ImportSalesmb',
remoteSort: true,
//groupField: 'CUSTOMERNAME',
proxy: {
type: 'ajax',
url: '/Import/ImportSales/GetDataList',
reader: {
id: 'SaleDetail_GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeList_Single = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'ImportSales_Singlemb',
remoteSort: true,
//groupField: 'CUSTOMERNAME',
proxy: {
type: 'ajax',
url: '/Import/ImportSales/GetDataList',
reader: {
id: 'SALESNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
_this = this;
//定义Grid
this.initgirdcolums = [
{
sortable: true, hidden: true,
dataIndex: 'SaleDetail_GID',
header: 'SaleDetail_GID',
width: 80
},
/*{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},*/
{
sortable: true, align: 'left',
dataIndex: 'SALESNO',
header: '销售单',
width: 130
},
{
sortable: true, align: 'left',
dataIndex: 'CUSTOMERNAME',
header: '客户名称',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CORPID',
header: 'CORPID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DEPTGID',
header: 'DEPTGID',
width: 80
},
{
sortable: true,
dataIndex: 'CargoType',
header: '商品类型',
width: 80
},
{
sortable: true, align: 'left',
dataIndex: 'CARGONAME',
header: '商品摘要',
width: 130
},
{
sortable: true, align: 'left',
dataIndex: 'SALEINFO',
header: '销售摘要',
width: 200
},
{
sortable: true, align: 'left',
dataIndex: 'DeliveryInfo',
header: '出库情况摘要',
width: 200
}, {
sortable: true,
dataIndex: 'AMOUNTRMB',
header: 'RMB金额',
width: 95, align: 'right',
summaryType: 'sum',
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;
}
}/*, {
sortable: true,
dataIndex: 'PREPAYMENT',
header: '定金',
width: 95, align: 'right',
summaryType: 'sum',
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;
}
}*/, {
sortable: true,
dataIndex: 'AMOUNTRMB_ACT',
header: '实际产生应收金额',
width: 95, align: 'right',
summaryType: 'sum',
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;
}
}, {
sortable: true,
dataIndex: 'AMOUNTRMB_REMAIN',
header: '已认款 减 实际应收',
tooltip: '“多退少补”的预收部分。',
width: 95, align: 'right',
summaryType: 'sum',
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;
}
},
{
sortable: true, align: 'left',
dataIndex: 'CURRENCY',
header: '币别',
width: 35
}, {
sortable: true,
dataIndex: 'AMOUNT',
header: '金额',
width: 95, align: 'right',
summaryType: 'sum',
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;
}
},
{
sortable: true, align: 'right',
dataIndex: 'EXCHANGERATE',
header: '汇率',
width: 60
},
{
sortable: true, align: 'left',
dataIndex: 'SALESDATE',
header: '销售日期',
width: 80
},
{
sortable: true, align: 'right',
dataIndex: 'DELIVERYWEIGHT',
header: '已出库重量',
width: 80,
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'ZDAMOUNT',
header: '账单金额',
tooltip: '销售单内采用状态账单内费用名称未‘应付尾款’或名称包含‘补款’二字的费用之和',
width: 95, align: 'right',
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 "" + usMoney(value, 2, '', true); +"";
} else if (parseFloat(value) <= 0) {
return "" + usMoney(value, 2, '', true); +"";
} else {
return "";
}
}
},
{
sortable: true,
dataIndex: 'Forecast_Amount',
header: '该销售业务已认款金额',
width: 95, align: 'right',
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 "" + usMoney(value, 2, '', true) + "";
} else if (parseFloat(value) <= 0) {
return "" + usMoney(value, 2, '', true) + "";
} else {
return "";
}
}
},
{
sortable: true,
dataIndex: 'Forecast_Remain',
header: '该销售业务未认款金额',
width: 95, align: 'right',
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 "" + usMoney(value, 2, '', true); +"";
} else if (parseFloat(value) <= 0) {
return "" + usMoney(value, 2, '', true); +"";
} else {
return "";
}
}
},
{
sortable: true,
dataIndex: 'WHX_YS',
header: '该客户未核销预收', tooltip: '该客户的预收当中未核销的款',
width: 95, align: 'right',
summaryType: 'average',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value) {
if (parseFloat(value) > 0) {
return "" + usMoney(value, 2, '', true); +"";
} else if (parseFloat(value) <= 0) {
return "" + usMoney(value, 2, '', true); +"";
} else {
return "";
}
}
},
{
sortable: true,
dataIndex: 'KERENKUAN',
header: '该客户可认款(全部预收当中未核销也未认的款)',
tooltip: '该客户全部预收当中未核销也未认的款',
width: 95, align: 'right',
summaryType: 'average',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value) {
if (parseFloat(value) > 0) {
return "" + usMoney(value, 2, '', true); +"";
} else if (parseFloat(value) <= 0) {
return "" + usMoney(value, 2, '', true); +"";
} else {
return "";
}
}
},
{
sortable: true,
dataIndex: 'DAIRENKUAN',
header: '该客户全部需认款(已做销售而未认款的销售金额)',
tooltip: '该客户全部销售单当中,未认款的销售金额',
width: 95, align: 'right',
summaryType: 'average',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value) {
if (parseFloat(value) > 0) {
return "" + usMoney(value, 2, '', true); +"";
} else if (parseFloat(value) <= 0) {
return "" + usMoney(value, 2, '', true); +"";
} else {
return "";
}
}
},
{
sortable: true,
dataIndex: 'SALES_AMOUNT',
header: '此业务应收',
tooltip: '销售单内的所有应收',
width: 95, align: 'right',
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 "" + usMoney(value, 2, '', true); +"";
} else if (parseFloat(value) <= 0) {
return "" + usMoney(value, 2, '', true); +"";
} else {
return "";
}
}
},
{
sortable: true,
dataIndex: 'SALES_SETTLEMENT',
header: '此业务实收',
tooltip: '销售单内的所有已经核销的应收',
width: 95, align: 'right',
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 "" + usMoney(value, 2, '', true); +"";
} else if (parseFloat(value) <= 0) {
return "" + usMoney(value, 2, '', true); +"";
} else {
return "";
}
}
},
{
sortable: true, align: 'left', hidden: true,
dataIndex: 'DELIVERYADDRESS',
header: '送货地址',
width: 80
},
{
sortable: true, align: 'left', hidden: true,
dataIndex: 'DELIVERYCONTACTS',
header: '送货联系人',
width: 80
},
{
sortable: true, align: 'left', hidden: true,
dataIndex: 'DELIVERYTEL',
header: '送货联系电话',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BSSTATUS',
header: 'BSSTATUS',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'FEESTATUS',
header: 'FEESTATUS',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'TIMEMARK',
header: 'TIMEMARK',
width: 80
},
{
sortable: true, align: 'left',
dataIndex: 'OP',
header: '销售助理',
width: 80
},
{
sortable: true, align: 'left',
dataIndex: 'SALER',
header: '销售员',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BSSTATUSRef',
header: '业务状态',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'FEESTATUSRef',
header: '费用状态',
width: 80
},
{
sortable: true, align: 'left',
dataIndex: 'MAINSTATERef',
header: '销售方式',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'MAINSTATE',
header: 'MAINSTATE',
width: 80
},
{
sortable: true, align: 'left',
dataIndex: 'SALESTATUSRef',
header: '销售单状态',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'SALESTATUS',
header: 'SALESTATUS',
width: 80
}, {
sortable: true,
dataIndex: 'REPLY',
header: '是否盖章回传',
width: 80,
renderer: function (value) {
if (parseFloat(value) == 0) {
return " 未回传 ";
} else if (parseFloat(value) > 0) {
return " 已回传 ";
} else {
return "";
}
}
}, {
sortable: true,
dataIndex: 'ISMAKED',
header: '是否已做销售单',
width: 80,
renderer: function (value, cellmeta) {
if (value == "1") {
return "";
}
}
}, {
sortable: true, align: 'left',
dataIndex: 'REMARK',
header: '备注',
width: 160
},
{
sortable: true, align: 'left',
dataIndex: 'PAYCOMPANY',
header: '付款公司',
width: 100
},
{
sortable: true, align: 'left',
dataIndex: 'FUNDRATE',
header: '资金利息利率',
width: 100
},
{
sortable: true, align: 'left',
dataIndex: 'ArrivalDate',
header: '到港日',
width: 90
},
{
sortable: true, align: 'left', hidden: true,
dataIndex: 'ISINVOICE',
header: 'ISINVOICE',
width: 90
},
{
sortable: true, align: 'left',
dataIndex: 'ISINVOICE_REF',
header: '是否开票',
width: 110
},
{
sortable: true, align: 'left',
dataIndex: 'port',
header: '目的港',
width: 80
}, {
sortable: true,
dataIndex: 'country',
header: '国家',
width: 80
},
{
sortable: true,
dataIndex: 'FactoryNo',
header: '厂号',
width: 80
},
{
sortable: true,
dataIndex: 'Cargo_Name',
header: '跟单品名',
width: 80
},
{
sortable: true,
dataIndex: 'productiondate_min',
header: '生产日期起',
width: 80
},
{
sortable: true,
dataIndex: 'productiondate_max',
header: '生产日期止',
width: 80
},
{
sortable: true,
dataIndex: 'SD_PREPAYMENT',
header: '合同定金',
width: 80
},
{
sortable: true,
dataIndex: 'SD_PREPAYMENT_ACT',
header: '实际定金',
width: 80
},
{
sortable: true,
dataIndex: 'SD_WEIGHT',
header: '销售重量',
width: 80
},
{
sortable: true,
dataIndex: 'SD_BOXCOUNT',
header: '销售件数',
width: 80
},
{
sortable: true,
dataIndex: 'STORAGENAME',
header: '冷库',
width: 80
},
{
sortable: true,
dataIndex: 'Ex_sailingdate',
header: '预计开船日期',
width: 80
},
{
sortable: true,
dataIndex: 'price_limit',
header: '海关限价',
width: 80
},
{
sortable: true,
dataIndex: 'WMSDATE',
header: '入库日期',
width: 80
},
{
sortable: true,
dataIndex: 'PRICE',
header: '销售价(币别/kg)',
width: 80
},
{
sortable: true,
dataIndex: 'PRICERMB',
header: 'RMB销售价',
width: 80
},
{
sortable: true,
dataIndex: 'DirectPrice',
header: '直营店价格',
width: 80
},
{
dataIndex: 'Agent', align: 'left',
header: '代理',
width: 80
},
{
dataIndex: 'Inspection_Storage', align: 'left',
header: '是否商检慢检',
width: 80
},
{
dataIndex: 'Unsealdate', align: 'left',
header: '慢检放行日期',
width: 80
}
];
this.initgirdcolums_Single = [
{
sortable: true, hidden: true,
dataIndex: 'SaleDetail_GID',
header: 'SaleDetail_GID',
width: 80
},
/*{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},*/
{
sortable: true, align: 'left',
dataIndex: 'SALESNO',
header: '销售单',
width: 130
},
{
sortable: true, align: 'left',
dataIndex: 'CUSTOMERNAME',
header: '客户名称',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CORPID',
header: 'CORPID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DEPTGID',
header: 'DEPTGID',
width: 80
},
{
sortable: true, align: 'left',
dataIndex: 'CARGONAME',
header: '商品摘要',
width: 130
},
{
sortable: true, align: 'left',
dataIndex: 'SALEINFO',
header: '销售摘要',
width: 200
},
{
sortable: true, align: 'left',
dataIndex: 'DeliveryInfo',
header: '出库情况摘要',
width: 200
}, {
sortable: true,
dataIndex: 'AMOUNTRMB',
header: 'RMB金额',
width: 95, align: 'right',
summaryType: 'sum',
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;
}
}/*, {
sortable: true,
dataIndex: 'PREPAYMENT',
header: '定金',
width: 95, align: 'right',
summaryType: 'sum',
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;
}
}*/, {
sortable: true,
dataIndex: 'AMOUNTRMB_ACT',
header: '实际产生应收金额',
width: 95, align: 'right',
summaryType: 'sum',
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;
}
}, {
sortable: true,
dataIndex: 'AMOUNTRMB_REMAIN',
header: '已认款 减 实际应收',
tooltip: '“多退少补”的预收部分。',
width: 95, align: 'right',
summaryType: 'sum',
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;
}
},
{
sortable: true, align: 'left',
dataIndex: 'CURRENCY',
header: '币别',
width: 35
}, {
sortable: true,
dataIndex: 'AMOUNT',
header: '金额',
width: 95, align: 'right',
summaryType: 'sum',
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;
}
},
{
sortable: true, align: 'right',
dataIndex: 'EXCHANGERATE',
header: '汇率',
width: 60
},
{
sortable: true, align: 'left',
dataIndex: 'SALESDATE',
header: '销售日期',
width: 80
},
{
sortable: true, align: 'right',
dataIndex: 'DELIVERYWEIGHT',
header: '已出库重量',
width: 80,
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'ZDAMOUNT',
header: '账单金额',
tooltip: '销售单内采用状态账单内费用名称未‘应付尾款’或名称包含‘补款’二字的费用之和',
width: 95, align: 'right',
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 "" + usMoney(value, 2, '', true); +"";
} else if (parseFloat(value) <= 0) {
return "" + usMoney(value, 2, '', true); +"";
} else {
return "";
}
}
},
{
sortable: true,
dataIndex: 'Forecast_Amount',
header: '该销售业务已认款金额',
width: 95, align: 'right',
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 "" + usMoney(value, 2, '', true) + "";
} else if (parseFloat(value) <= 0) {
return "" + usMoney(value, 2, '', true) + "";
} else {
return "";
}
}
},
{
sortable: true,
dataIndex: 'Forecast_Remain',
header: '该销售业务未认款金额',
width: 95, align: 'right',
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 "" + usMoney(value, 2, '', true); +"";
} else if (parseFloat(value) <= 0) {
return "" + usMoney(value, 2, '', true); +"";
} else {
return "";
}
}
},
{
sortable: true,
dataIndex: 'WHX_YS',
header: '该客户未核销预收', tooltip: '该客户的预收当中未核销的款',
width: 95, align: 'right',
summaryType: 'average',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value) {
if (parseFloat(value) > 0) {
return "" + usMoney(value, 2, '', true); +"";
} else if (parseFloat(value) <= 0) {
return "" + usMoney(value, 2, '', true); +"";
} else {
return "";
}
}
},
{
sortable: true,
dataIndex: 'KERENKUAN',
header: '该客户可认款(全部预收当中未核销也未认的款)',
tooltip: '该客户全部预收当中未核销也未认的款',
width: 95, align: 'right',
summaryType: 'average',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value) {
if (parseFloat(value) > 0) {
return "" + usMoney(value, 2, '', true); +"";
} else if (parseFloat(value) <= 0) {
return "" + usMoney(value, 2, '', true); +"";
} else {
return "";
}
}
},
{
sortable: true,
dataIndex: 'DAIRENKUAN',
header: '该客户全部需认款(已做销售而未认款的销售金额)',
tooltip: '该客户全部销售单当中,未认款的销售金额',
width: 95, align: 'right',
summaryType: 'average',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value) {
if (parseFloat(value) > 0) {
return "" + usMoney(value, 2, '', true); +"";
} else if (parseFloat(value) <= 0) {
return "" + usMoney(value, 2, '', true); +"";
} else {
return "";
}
}
},
{
sortable: true,
dataIndex: 'SALES_AMOUNT',
header: '此业务应收',
tooltip: '销售单内的所有应收',
width: 95, align: 'right',
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 "" + usMoney(value, 2, '', true); +"";
} else if (parseFloat(value) <= 0) {
return "" + usMoney(value, 2, '', true); +"";
} else {
return "";
}
}
},
{
sortable: true,
dataIndex: 'SALES_SETTLEMENT',
header: '此业务实收',
tooltip: '销售单内的所有已经核销的应收',
width: 95, align: 'right',
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 "" + usMoney(value, 2, '', true); +"";
} else if (parseFloat(value) <= 0) {
return "" + usMoney(value, 2, '', true); +"";
} else {
return "";
}
}
},
{
sortable: true, align: 'left', hidden: true,
dataIndex: 'DELIVERYADDRESS',
header: '送货地址',
width: 80
},
{
sortable: true, align: 'left', hidden: true,
dataIndex: 'DELIVERYCONTACTS',
header: '送货联系人',
width: 80
},
{
sortable: true, align: 'left', hidden: true,
dataIndex: 'DELIVERYTEL',
header: '送货联系电话',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BSSTATUS',
header: 'BSSTATUS',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'FEESTATUS',
header: 'FEESTATUS',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'TIMEMARK',
header: 'TIMEMARK',
width: 80
},
{
sortable: true, align: 'left',
dataIndex: 'OP',
header: '销售助理',
width: 80
},
{
sortable: true, align: 'left',
dataIndex: 'SALER',
header: '销售员',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BSSTATUSRef',
header: '业务状态',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'FEESTATUSRef',
header: '费用状态',
width: 80
},
{
sortable: true, align: 'left',
dataIndex: 'MAINSTATERef',
header: '销售方式',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'MAINSTATE',
header: 'MAINSTATE',
width: 80
},
{
sortable: true, align: 'left',
dataIndex: 'SALESTATUSRef',
header: '销售单状态',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'SALESTATUS',
header: 'SALESTATUS',
width: 80
}, {
sortable: true,
dataIndex: 'REPLY',
header: '是否盖章回传',
width: 80,
renderer: function (value) {
if (parseFloat(value) == 0) {
return " 未回传 ";
} else if (parseFloat(value) > 0) {
return " 已回传 ";
} else {
return "";
}
}
}, {
sortable: true,
dataIndex: 'ISMAKED',
header: '是否已做销售单',
width: 80,
renderer: function (value, cellmeta) {
if (value == "1") {
return "";
}
}
}, {
sortable: true, align: 'left',
dataIndex: 'REMARK',
header: '备注',
width: 160
},
{
sortable: true, align: 'left',
dataIndex: 'PAYCOMPANY',
header: '付款公司',
width: 100
},
{
sortable: true, align: 'left',
dataIndex: 'FUNDRATE',
header: '资金利息利率',
width: 100
},
{
sortable: true, align: 'left',
dataIndex: 'ArrivalDate',
header: '到港日',
width: 90
},
{
sortable: true, align: 'left', hidden: true,
dataIndex: 'ISINVOICE',
header: 'ISINVOICE',
width: 90
},
{
sortable: true, align: 'left',
dataIndex: 'ISINVOICE_REF',
header: '是否开票',
width: 110
},
{
sortable: true, align: 'left',
dataIndex: 'port',
header: '目的港',
width: 80
}, {
sortable: true,
dataIndex: 'country',
header: '国家',
width: 80
},
{
sortable: true,
dataIndex: 'FactoryNo',
header: '厂号',
width: 80
},
{
sortable: true,
dataIndex: 'Cargo_Name',
header: '跟单品名',
width: 80
},
{
sortable: true,
dataIndex: 'productiondate_min',
header: '生产日期起',
width: 80
},
{
sortable: true,
dataIndex: 'productiondate_max',
header: '生产日期止',
width: 80
},
{
sortable: true,
dataIndex: 'SD_PREPAYMENT',
header: '合同定金',
width: 80
},
{
sortable: true,
dataIndex: 'SD_PREPAYMENT_ACT',
header: '实际定金',
width: 80
},
{
sortable: true,
dataIndex: 'SD_WEIGHT',
header: '销售重量',
width: 80
},
{
sortable: true,
dataIndex: 'SD_BOXCOUNT',
header: '销售件数',
width: 80
},
{
sortable: true,
dataIndex: 'STORAGENAME',
header: '冷库',
width: 80
},
{
sortable: true,
dataIndex: 'Ex_sailingdate',
header: '预计开船日期',
width: 80
},
{
sortable: true,
dataIndex: 'price_limit',
header: '海关限价',
width: 80
},
{
sortable: true,
dataIndex: 'WMSDATE',
header: '入库日期',
width: 80
},
{
sortable: true,
dataIndex: 'PRICE',
header: '销售价(币别/kg)',
width: 80
},
{
sortable: true,
dataIndex: 'PRICERMB',
header: 'RMB销售价',
width: 80
},
{
sortable: true,
dataIndex: 'DirectPrice',
header: '直营店价格',
width: 80
},
{
dataIndex: 'Agent', align: 'left',
header: '代理',
width: 80
},
{
dataIndex: 'Inspection_Storage', align: 'left',
header: '是否商检慢检',
width: 80,
renderer: function (value) {
if (parseFloat(value) == 0) {
return "";
} else {
return "慢检";
}
}
},
{
dataIndex: 'Unsealdate', align: 'left',
header: '慢检放行日期',
width: 80
}
];
this.girdcolums = this.initgirdcolums;
this.girdcolums_Single = this.initgirdcolums_Single;
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolums,
selModel: this.GridCheckBoxModel,
/*plugins: [{
ptype: 'rowexpander',
rowBodyTpl: [
'
',
'
'
]
}],*/
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
viewConfig: {
autoFill: true,
enableTextSelection: true
},
/*
features: [{
id: 'group',
ftype: 'groupingsummary',
groupHeaderTpl: '{name}',
hideGroupedHeader: false,
enableGroupingMenu: true
}],*/
bbar: [Ext.create('Ext.PagingToolbar', {
id: "bbar",
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
this.CBM_Single = Ext.create('Ext.selection.CheckboxModel');
this.gridList_Single = new Ext.grid.GridPanel({
store: this.storeList_Single,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolums_Single,
selModel: this.CBM_Single,
/*plugins: [{
ptype: 'rowexpander',
rowBodyTpl: [
'',
'
'
]
}],*/
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
viewConfig: {
autoFill: true,
enableTextSelection: true
},
/*
features: [{
id: 'group',
ftype: 'groupingsummary',
groupHeaderTpl: '{name}',
hideGroupedHeader: false,
enableGroupingMenu: true
}],*/
bbar: [Ext.create('Ext.PagingToolbar', {
id: "bbar_Single",
store: this.storeList_Single,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum_Single]
});
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 50
});
/////////////以下部分为获取存储的gridpanel显示样式
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 0); //使用者id,表名,中间column数组,跳过一开始的几列
//this.gridList.columns[1] = new Ext.grid.RowNumberer();
this.girdcolums.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.girdcolums);
this.girdcolums_Single = DsTruck.GetGridPanel(USERID, this.formname_Single, this.girdcolums_Single, 0); //使用者id,表名,中间column数组,跳过一开始的几列
//this.girdcolums_Single.unshift(new Ext.grid.RowNumberer());
this.gridList_Single.reconfigure(this.storeList_Single, this.girdcolums_Single);
////////////////////////////////////////////////
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
//this.SelectedRecord = this.record;
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];
this.SelectedRecord = _record;
this.OprationStatus = 'edit';
if (SPTYPE == "跟单销售")
DsOpenEditWin('/Import/ImportSales/BLEdit', "编辑销售单");
if (SPTYPE == "财务核销")
DsOpenEditWin('/Import/ImportSales/CWSTLEdit', "财务核销");
}, this);
this.gridList_Single.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
var selections = this.gridList_Single.getSelectionModel().getSelection();
var _record = selections[0];
this.SelectedRecord = _record;
this.OprationStatus = 'edit';
if (SPTYPE == "跟单销售")
DsOpenEditWin('/Import/ImportSales/BLEdit', "编辑销售单");
if (SPTYPE == "财务核销")
DsOpenEditWin('/Import/ImportSales/CWSTLEdit', "财务核销");
}, this);
/*
this.gridList.view.on('expandBody', function (rowNode, record, expandRow, eOpts) {
_this.displayInnerGrid(record.get('SALESNO'));
});
this.gridList.view.on('collapsebody', function (rowNode, record, expandRow, eOpts) {
_this.destroyInnerGrid(record);
});*/
//#endregion
//#region formSearch
//#region formSearch枚举参照相关
//客户加载_委托单位
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.storeMainstate = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeMainstate.load({ params: { enumTypeId: 31} });
this.comboxMainstate = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '销售类型',
autosize: true,
bodyPadding: 5,
flex: 1,
//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.storeISINVOICE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeISINVOICE.load({ params: { enumTypeId: 41} });
this.comboxISINVOICE = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '是否开票',
autosize: true,
bodyPadding: 5,
flex: 1,
//width: 500,
labelWidth: 80,
store: this.storeISINVOICE,
queryMode: 'local',
triggerOnClick: false,
valueField: 'EnumValueId',
displayField: 'EnumValueName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeYN = Ext.create('Ext.data.Store', {
fields: ['VALUE', 'NAME']
});
this.storeYN.add({ "VALUE": "1", "NAME": "是" });
this.storeYN.add({ "VALUE": "0", "NAME": "否" });
this.comboxREPLY = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否盖章回传',
store: this.storeYN,
name: 'REPLY',
valueField: 'VALUE',
displayField: 'NAME',
forceSelection: true
});
this.comboxISMAKED = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否已做销售单',
store: this.storeYN,
flex: 1,
name: 'ISMAKED',
valueField: 'VALUE',
displayField: 'NAME',
forceSelection: true
});
this.storeCargoType = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeCargoType.load({ params: { enumTypeId: 30} });
this.comboxCargoType = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeCargoType,
fieldLabel: '商品类型',
flex: 1,
forceSelection: true,
name: 'CargoType',
valueField: 'EnumValueName',
displayField: 'EnumValueName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#endregion
_this = this;
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '销售单号/合同号/提单号/箱号',
name: 'SALESNO',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxCustCode, {
fieldLabel: '从.销售日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'SALESDATE_min',
tooltip: '只填此项时,显示的是销售日期等于此日期的销售单',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到.销售日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'SALESDATE_max',
tooltip: '只填此项时,显示的是销售日期等于此日期的销售单',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '产品描述',
name: 'CARGONAME',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
xtype: 'button',
flex: 0.5,
text: "高级查询",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
var winAccess = new Shipping.DsQuery({
});
winAccess.StoreList = this.storeList;
winAccess.formname = this.formname;
winAccess.condition = sql;
winAccess.LoadQueryData_self(this.formname);
winAccess.show();
return;
},
scope: this
}
/*, {
fieldLabel: '未交定金/认款',
xtype: 'checkbox',
name: 'no_Forecast'
}*/
]
}
]//end items(fieldset 1)
}//end fieldset 1
,
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxREPLY,
this.comboxISMAKED,
this.comboxMainstate,
this.comboxISINVOICE,
this.comboxCargoType
//{
// xtype:'hiddenfield' ,flex:1.5
//}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
_this = this;
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "新建", id: "btnadd",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin('/Import/ImportSales/BLEdit');
},
scope: this
},
'-',
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
var form = this.formSearch.getForm();
form.reset();
},
scope: this
}, // '-',
{
text: '提交审核', hidden: true,
tooltip: '提交审核',
handler: function (button, event) {
//this.onSubmitAuditClick();
},
scope: this
}, // '-',
{
text: '撤销审核', hidden: true,
tooltip: '撤销审核',
handler: function (button, event) {
this.onSubmitAuditBackClick();
},
scope: this
}, '-',
{
text: "删除", id: "btndelete",
id: 'btndelete',
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btntest",
menu: [
{ text: "保存",
handler: function (button, event) {
var _p = _this.MainTab.getActiveTab().id;
if (_p == "page_1") {
this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true);
}
if (_p == "page_2") {
this.girdcolums_Single = DsTruck.SaveGridPanel(USERID, _this.formname_Single, _this.gridList_Single.columns, _this.girdcolums_Single, 0, true);
}
}
}, { text: "初始化",
handler: function (menu, event) {
//_this.InitGrid(_this.initgirdcolums);
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true);
_this.girdcolums_Single = DsTruck.SaveGridPanel(USERID, _this.formname_Single, _this.gridList_Single.columns, _this.initgirdcolums_Single, 1, true);
}
}],
scope: this
}, '-',
{
text: "打印",
iconCls: 'btnprint',
menu: [{
text: '销售单打印',
handler: function (menu, event) {
this.Print();
},
scope: this
}, {
text: '销售合同登记表',
handler: function (menu, event) {
this.Print_DetailList();
},
scope: this
},
{
text: "客户对账_尾款", //Print_importtrade_KHZD2
handler: function (menu, event) {
this.Print_KHDZ3();
},
scope: this
},
{
text: "客户对账_尾款_依账单明细", //Print_importtrade_KHZD2
handler: function (menu, event) {
this.Print_KHDZ4();
},
scope: this
}],
scope: this
}, '-', {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 110,
items: [this.formSearch, this.panelBtn]
});
this.page_1 = new Ext.Panel({
id: "page_1",
layout: "border",
region: "center",
title: "销售信息(每商品)",
items: [this.gridList
]
});
this.page_2 = new Ext.Panel({
id: "page_2",
layout: "border",
region: "center",
title: "合同信息(每销售单)",
items: [this.gridList_Single//, this.gridList_single_edit
]
});
this.MainTab = new Ext.tab.Panel({
layout: "border",
region: "center",
items: [this.page_1, this.page_2]
});
Ext.apply(this, {
items: [this.panelTop, this.MainTab]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
//this.onRefreshClick();
var me = this;
Ext.Ajax.request({
waitMsg: '正在查询用户权限...',
url: '/CommMng/BasicDataRef/GetAuthorityRange',
params: {
modName: "modImportSales",
USERID: USERID
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
rec = result.data;
this.VISIBLERANGE = rec.VISIBLERANGE;
this.OPERATERANGE = rec.OPERATERANGE;
this.setBtnEnable();
}
else
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
},
scope: this
}); //request over
var btndelete = Ext.getCmp('btndelete');
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
});
}, //end initUIComponents
//#region 销售明细Grid
displayInnerGrid: function (SALESNO) {
storeBodyList = Ext.create('Ext.data.Store', {
model: 'ImportSaledetailmb',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/Import/ImportSales/GetDetailList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
initInnerColums = [
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CARGO_GID',
header: 'CARGO_GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BSNO',
header: 'BSNO',
width: 80
},
{
sortable: true,
dataIndex: 'HTH',
header: '合同号',
width: 80
},
{
sortable: true,
dataIndex: 'SALESNO',
header: '销售单号',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '销售客户',
width: 80
},
{
sortable: true,
dataIndex: 'NAME',
header: '货物名称',
width: 80
},
{
sortable: true, align: 'right',
dataIndex: 'WEIGHT',
header: '销售重量(kg)',
width: 80,
editor: {
selectOnFocus: true, align: 'right',
xtype: 'numberfield'
}
},
{
sortable: true, align: 'right',
dataIndex: 'BOXCOUNT',
header: '销售件数',
width: 80,
editor: {
selectOnFocus: true, align: 'right',
xtype: 'numberfield'
}
},
{
sortable: true, align: 'right',
dataIndex: 'WEIGHT_ACT',
header: '采购入库重量(kg)',
width: 80
},
{
sortable: true, align: 'right',
dataIndex: 'WEIGHT_REMAIN',
header: '剩余可售重量(kg)',
width: 80
},
{
sortable: true, align: 'right',
dataIndex: 'BOXCOUNT_REMAIN',
header: '剩余可售件数',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 80,
editor: {
align: 'right',
xtype: 'textfield'
}
},
{
sortable: true,
dataIndex: 'PRICE',
header: '单价(币别/kg)',
width: 75,
editor: {
xtype: 'numberfield', align: 'right',
allowBlank: false,
selectOnFocus: true, //精确到小数点后2位(执行4舍5入)
allowDecimals: true, //允许输入小数
nanText: '请输入有效小数',
decimalPrecision: 4,
value: 0.0000
}, align: 'right'
},
{
sortable: true, align: 'right',
dataIndex: 'AMOUNT',
header: '金额',
editor: {
xtype: 'numberfield', align: 'right',
allowBlank: false,
selectOnFocus: true, //精确到小数点后2位(执行4舍5入)
allowDecimals: true, //允许输入小数
nanText: '请输入有效小数',
//minValue: 0,
//maxValue: 100000,
value: 0.00
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, hidden: true,
dataIndex: 'EXCHANGERATE',
header: '汇率',
width: 80,
editor: {
selectOnFocus: true,
xtype: 'numberfield'
}
},
{
sortable: true,
dataIndex: 'PRICERMB',
header: '单价(RMB/kg)',
width: 75,
editor: {
xtype: 'numberfield', align: 'right',
allowBlank: false,
selectOnFocus: true, //精确到小数点后2位(执行4舍5入)
allowDecimals: true, //允许输入小数
nanText: '请输入有效小数',
decimalPrecision: 6,
value: 0.000000
}, align: 'right'
},
{
sortable: true, align: 'right',
dataIndex: 'AMOUNTRMB',
header: 'RMB金额',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, align: 'right',
dataIndex: 'AMOUNTRMB_Detail',
header: 'RMB金额(销售明细)',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, align: 'right',
dataIndex: 'PREPAYMENT',
header: '合同定金',
width: 80,
editor: {
xtype: 'numberfield', align: 'right',
allowBlank: false,
selectOnFocus: true, //精确到小数点后2位(执行4舍5入)
allowDecimals: true, //允许输入小数
nanText: '请输入有效小数',
value: 0.00
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, align: 'right',
dataIndex: 'PREPAYMENT_ACT',
header: '实际定金',
width: 80,
editor: {
xtype: 'numberfield', align: 'right',
allowBlank: false,
selectOnFocus: true, //精确到小数点后2位(执行4舍5入)
allowDecimals: true, //允许输入小数
nanText: '请输入有效小数',
value: 0.00
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, align: 'right',
dataIndex: 'COSTPRICE',
header: '预计成本(含税、代理费)',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 4, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
width: 130
},
{
sortable: true, align: 'right',
dataIndex: 'PRICEREMARK',
header: '价格备注',
width: 130,
editor: {
xtype: 'textfield'
}
},
{
sortable: true, align: 'right',
dataIndex: 'DirectShop',
header: '直营店',
width: 130,
editor: this.comboxDirectShop
},
{
sortable: true, align: 'right',
dataIndex: 'DirectPrice',
header: '直营店价格',
width: 80,
editor: {
xtype: 'numberfield'
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, align: 'right',
dataIndex: 'REMARK',
header: '备注',
width: 80,
editor: {
xtype: 'textfield'
}
}
];
InnerColums = initInnerColums;
innerGrid = Ext.create('Ext.grid.Panel', {
store: storeBodyList,
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
},
columns: InnerColums,
// columnLines: true,
// autoWidth: true,
// autoHeight: true,
frame: false
//,
//renderTo: SALESNO
});
/////////////以下部分为获取存储的gridpanel显示样式
InnerColums = DsTruck.GetGridPanel(USERID, this.formname_body, InnerColums, 1); //使用者id,表名,中间column数组,跳过一开始的几列
innerGrid.reconfigure(storeBodyList, InnerColums);
//innerGrid.columns[0] = new Ext.grid.RowNumberer();
////////////////////////////////////////////////
//innerGrid.columns[0] = new Ext.grid.RowNumberer();
storeBodyList.on('beforeload', function (store) {
var sql = " s.SALESNO='" + SALESNO + "' ";
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
storeBodyList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: " s.SALESNO='" + SALESNO + "' "} });
},
destroyInnerGrid: function (record) {
var parent = document.getElementById(record.get('SALESNO'));
var child = parent.firstChild;
while (child) {
child.parentNode.removeChild(child);
child = child.nextSibling;
}
},
//#endregion
setBtnEnable: function (button, event) {
if (this.OPERATERANGE == "0" || this.OPERATERANGE == "2") {
Ext.getCmp("btnadd").enable();
//Ext.getCmp("btndelete").enable();
} else {
Ext.getCmp("btnadd").disable();
//Ext.getCmp("btndelete").disable();
}
if (SPTYPE == "财务核销") {
Ext.getCmp("btnadd").hide();
//Ext.getCmp("btndelete").hide();
}
},
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
// });
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
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,
timeout:120000
});
}
if (_p == "page_2") {
this.PageSize_Single = this.Pagenum_Single.getValue();
var sql = this.getCondition();
this.sqlcontext = sql;
this.storeList_Single.load({
params: { start: 0, limit: this.PageSize, sort: "", condition: sql },
waitMsg: "正在查询数据...",
scope: this,
timeout: 120000
});
}
},
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
});
},
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
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 SALESNO = record.data.SALESNO;
//var HTH = record.data.HTH;
var sql = " SALESNO='" + SALESNO + "'";
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/CommMng/BasicDataRef/GetExist2',
scope: this,
async: false,
params: {
tablename: "SalesAdvancePay_state",
condition: sql,
tablename2: "ch_fee",
condition2: sql
},
waitMsg: "正在查询数据...",
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
var returnData = jsonresult.data;
//alert(returnData.Count);
this.ChfeeCount = parseInt(returnData);
if (this.ChfeeCount != "") {
alert("销售单<" + SALESNO + ">内包含未删除的费用或费用声明(认款),不能删除");
return;
} else {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/Import/ImportSales/Delete',
params: {
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
Ext.Msg.show({ title: '提示', msg: "数据删除结束", 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.hide();
this.onRefreshClick(button, event);
}, this);
}, //onDeleteClick
onSubmitAuditClick: 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 BILLNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BILLNO = rec.data.BILLNO;
if (rec.data.BILLSTATUS == '1' || rec.data.BILLSTATUS == '6') {
if (BILLNOStr == '')
BILLNOStr = BILLNO;
else {
BILLNOStr = BILLNOStr + ',' + BILLNO;
}
}
}
_this = this;
if (BILLNOStr == '') {
} else {
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_ForeignPay/SubmitAuditList',
params: {
bills: BILLNOStr
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onSubmitAuditBackClick: 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 BILLNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BILLNO = rec.data.BILLNO;
if (rec.data.BILLSTATUS == '2') {
if (BILLNOStr == '')
BILLNOStr = BILLNO;
else {
BILLNOStr = BILLNOStr + ',' + BILLNO;
}
}
}
_this = this;
if (BILLNOStr == '') {
} else {
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_ForeignPay/SubmitAuditBackList',
params: {
bills: BILLNOStr
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
};
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = "";
if (this.OPERATERANGE == "0") {
sql = "";
}
/*
if (this.OPERATERANGE == "1") {
sql = " s.SALER='" + SHOWNAME + "' "
}*/
var SALESNO = form.findField('SALESNO').getValue();
sql = sql + getAndConSql(sql, SALESNO, " (s.SALESNO like '%" + SALESNO + "%' or s.SALESNO in(select SALESNO from import_saledetail where BSNO in( "
+ "select contractno from import_main m where m.hth like '%" + SALESNO + "%' or m.billno like '%" + SALESNO + "%' or m.containerno like '%" + SALESNO + "%')))");
var SALESDATE_min = form.findField('SALESDATE_min').getRawValue();
var SALESDATE_max = form.findField('SALESDATE_max').getRawValue();
if (SALESDATE_min != "" && SALESDATE_max != "") {
sql = sql + getAndConSql(sql, SALESDATE_min, "s.SALESDATE >='" + SALESDATE_min + "'");
sql = sql + getAndConSql(sql, SALESDATE_max, "s.SALESDATE <='" + SALESDATE_max + " 23:59:59'");
} else {
sql = sql + getAndConSql(sql, SALESDATE_min, "s.SALESDATE ='" + SALESDATE_min + "'");
sql = sql + getAndConSql(sql, SALESDATE_max, "s.SALESDATE ='" + SALESDATE_max + "'");
}
var CARGONAME = form.findField('CARGONAME').getValue();
sql = sql + getAndConSql(sql, CARGONAME, " (dbo.F_SaleInfo(s.SALESNO) like '%" + CARGONAME + "%') ");
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "S.CUSTOMERNAME='" + CUSTOMERNAME + "'");
var REPLY = form.findField('REPLY').getValue();
sql = sql + getAndConSql(sql, REPLY, " isnull(s.REPLY,0) = " + REPLY + " ");
var ISMAKED = form.findField('ISMAKED').getValue();
sql = sql + getAndConSql(sql, ISMAKED, " isnull(s.ISMAKED,0) = " + ISMAKED + " ");
var Mainstate = this.comboxMainstate.getValue();
if (Mainstate != "") {
sql = sql + getAndConSql(sql, Mainstate, "s.Mainstate in (" + Mainstate + ")");
}
var ISINVOICE = this.comboxISINVOICE.getValue();
if (ISINVOICE != "") {
sql = sql + getAndConSql(sql, ISINVOICE, "s.ISINVOICE in (" + ISINVOICE + ")");
}
var cargotype = this.comboxCargoType.getValue();
if (cargotype != "") {
sql = sql + getAndConSql(sql, cargotype, "c.cargotype = '" + cargotype + "'");
}
return sql;
},
onExportClick: function (button, event) {
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
GridExportExcelPage(this.gridList);
}
if (_p == "page_2") {
GridExportExcelPage(this.gridList_Single);
}
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
},
Print: function () {
var _T = this.getCondition();
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
}
//alert(GetDateStr(+5));
var madedate = GetDateStr(0);
var SALER = SHOWNAME;
var printType = 'Import_SALESIndex_rpt';
var sql1 = " select s.SALESNO 销售单号,s.CUSTOMERNAME 客户名称 ";
sql1 = sql1 + " ,c.country 国家,c.FactoryNo 厂号,c.name 品名,dbo.trimdate(c.ArrivalDate) 到港日 ";
sql1 = sql1 + " ,case " + this.OPERATERANGE + " when 0 then c.price else '' end 采购合同单价,c.currid 采购价币别 ";
sql1 = sql1 + " ,case " + this.OPERATERANGE + " when 0 then c.costprice_ex else '' end [合同预计成本价(按合同计算,不含代理费)] ";
sql1 = sql1 + " ,case " + this.OPERATERANGE + " when 0 then c.costprice else '' end [成本价(实际应付成本,含货款税金代理费)] ";
sql1 = sql1 + " ,case " + this.OPERATERANGE + " when 0 then c.WEIGHT_REMAIN else '' end [待售重量] ";
sql1 = sql1 + " ,case " + this.OPERATERANGE + " when 0 then w.GOODSSTOCK else '' end [库存剩余重量] ";
sql1 = sql1 + " from Import_SALES s ";
sql1 = sql1 + " left join ImportTrade_Cargo c on c.gid in(select cargo_gid from Import_Saledetail where SALESNO=s.salesno) ";
sql1 = sql1 + " left join wms w on w.Cargo_gid=c.GID ";
sql1 = sql1 + " left join vw_importtrade_zhqk z on z.customername=s.CUSTOMERNAME ";
sql1 = sql1 + _T;
var sql2 = "";
// var sql3 = " select * from company where gid=(select top 1 companyid from ch_fee_do where BILLNO='" + billNo + "') ";
var sql3 = " select enname 公司英文名称,ENADDRESS 公司英文地址,ORGANIZATIONCODE 组织机构代码 ";
sql3 = sql3 + " ,* from company where gid='" + COMPANYID + "' ";
var sql4 = "select '" + madedate + "' as madedate,'" + SHOWNAME + "' as SHOWNAME";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
,
Print_DetailList: function () {
var selectedRecords = this.gridList.getSelectionModel().getSelection();
var MainList = "";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'" + rec.get('SALESNO') + "'"; }
else {
MainList = MainList + ",'" + rec.get('SALESNO') + "'";
}
}
var _T = this.getCondition();
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;
}
var printType = 'Import_SALESDetail_rpt';
var sql1 = " select s.SalesNo 销售单号,REPLY 盖章回传,PREPAYMENT_ACT 实付定金 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=28 and EnumValueID=M.MainState) 合同状态 ";
sql1 = sql1 + " ,s.SALESDATE 销售日期,s.SALER 销售员,s.CUSTOMERNAME 客户名称,m.hth 合同号 ";
sql1 = sql1 + " ,(select substring(country,0,(charindex('(',country)) ) from code_country where countryid=m.countryid) 国家 ";
sql1 = sql1 + " ,c.FactoryNo 厂号,c.cargotype 产品类型,c.name 品名,sd.BOXCOUNT 件数,sd.WEIGHT 重量,sd.PRICERMB RMB单价 ";
sql1 = sql1 + " ,(select (dbo.[F_GetFee](c.contractno,2,'预付款')+dbo.[F_GetFee](c.contractno,2,'尾款') ";
sql1 = sql1 + " +dbo.[F_GetFee](c.contractno,2,'关税')+dbo.[F_GetFee](c.contractno,2,'增值税') ";
sql1 = sql1 + " +dbo.[F_GetFee](c.contractno,2,'代理费')+dbo.[F_GetFee](c.contractno,2,'补税') ";
sql1 = sql1 + " +dbo.[F_GetFee](c.contractno,2,'手续费')+dbo.[F_GetFee](c.contractno,2,'电汇费') ";
sql1 = sql1 + " -dbo.[F_GetFee](c.contractno,1,'退税')) ";
sql1 = sql1 + " *dbo.f_cargoamount(c.gid)/dbo.f_mainamount(c.contractno)/(case c.Weight_Act when 0 then 1 else c.Weight_Act end)) 成本价 ";
sql1 = sql1 + " ,sd.AMOUNTRMB RMB金额,sd.PREPAYMENT 应收定金,PREPAYMENT_ACT 实付定金 ";
sql1 = sql1 + " ,(select sum(doamount) from SalesAdvancePay_state where salesno=s.salesno ) 已认款金额 ";
sql1 = sql1 + " ,(select sum(weight) from import_deliverydetail where SALEDETAIL_GID=sd.GID) 出库重量 ";
sql1 = sql1 + " ,(select sum(boxcount) from import_deliverydetail where SALEDETAIL_GID=sd.GID) 出库件数 ";
sql1 = sql1 + " from Import_Sales s ";
sql1 = sql1 + " left join Import_Saledetail sd on sd.SALESNO=s.SALESNO ";
sql1 = sql1 + " left join Import_cargo c on c.GID=sd.CARGO_GID ";
sql1 = sql1 + " left join import_main m on m.ContractNo=sd.bsno ";
if (MainList == "") {
var T = this.getCondition();
if (T != "") { T = " where " + T; };
sql1 = sql1 + T;
}
else {
sql1 = sql1 + " and s.SALESNO in( " + MainList + " ) "; //and isnull(dbo.trimdate(m.inspection_date),'')=''
}
sql1 = sql1 + " order by s.salesno ";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
,
Print_KHDZ3: 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.SALESNO;
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 basicForm = this.formHead.getForm();
//var billNo = basicForm.findField('ContractNo').value;
if (billNo == '*' || billNo == '') {
//Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var printType = 'Print_importtrade_KHZD3'; //期货 牛羊
var sql1 = " select HTH 合同号,Supplier_Billno 供应商合同号,Other_Billno 分公司合同号 ";
sql1 = sql1 + " ,dbo.trimdate(s.SALESDATE) 合同签订日期 ,dbo.trimdate(dateadd(day,3,s.SALESDATE)) 收取费用日期 ";
sql1 = sql1 + " ,dbo.F_Sales_BoxCount2(s.salesno) 销售件数 ,s.CUSTOMERNAME 销售对象,m.buyer 购货方 ";
sql1 = sql1 + " ,dbo.F_Sales_weight_KG(s.salesno) 销售重量 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) 目的港 ";
sql1 = sql1 + " ,m.ArrivalDate 到港日,m.ContainerNo 箱号 ";
sql1 = sql1 + " ,(select substring(country,0,(charindex('(',country)) ) from code_country where countryid=m.countryid) 进口国 ";
sql1 = sql1 + " ,dbo.F_CargoName_Sales(S.SalesNo) 品名,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=1 and EnumValueID=M.TransactionMethod) 成交方式 ";
sql1 = sql1 + " ,dbo.F_Saleprice(M.ContractNo) 价格,s.saler 销售员 ";
sql1 = sql1 + " ,case (select top 1 CURRENCY from Import_Saledetail where BSNO=m.ContractNo) when 'USD' then '$' when 'RMB' then '¥' when 'EUR' then '€' else '' end 币别符号 ";
sql1 = sql1 + " ,dbo.F_Sales_FactoryNo(s.SALESNO) 厂号 ";
sql1 = sql1 + " from import_sales S left join import_main m on m.contractno=(select top 1 BSNO from import_saledetail where SalesNo=S.SalesNo) ";
sql1 = sql1 + " where S.SalesNo ='" + billNo + "' ";
var sql2 = " select c.name 品名,SD.price*1000 单价吨,convert(numeric(18,2),SD.weight) 千克数,convert(varchar(20),convert(numeric(18,5),SD.weight/1000)) 吨数 ";
sql2 = sql2 + " ,S.Exchangerate 应收汇率,SD.price*SD.weight 销售金额,ic.currid 币别 ";
sql2 = sql2 + " ,SD.AMOUNT 货款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 + " ,sd.BoxCount 入库件数,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 + " , isnull(DATEDIFF(DAY, dbo.trimdate(dateadd(day,3,s.SALESDATE)), dbo.trimdate(ic.STOCKDATE_2)), 0)+1 冷藏天数 ";
sql2 = sql2 + " ,(dbo.[Get_ClientFee](w.STORAGENAME,'冷藏费')*SD.weight/1000)*(isnull(DATEDIFF(DAY, dbo.trimdate(dateadd(day,3,s.SALESDATE)), dbo.trimdate(ic.STOCKDATE_2)), 0)+1 ) 冷藏费 ";
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*c.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 + " ,dbo.trimdate(ic.STOCKDATE_2) 出库时间 ";
sql2 = sql2 + " , isnull(DATEDIFF(DAY,dateadd(day,3,s.SALESDATE), ic.STOCKDATE_2), 0)+1 资金占用时间 ";
sql2 = sql2 + " ,SD.PREPAYMENT_ACT 定金,sd.PRICE 销售价格,s.currency 销售币别,s.FUNDRATE 资金利息利率 ";
sql2 = sql2 + " ,ic.AGENCRATE_Cust 应收代理费率,ic.Exchangerate_Cust 应收账单汇率 ";
sql2 = sql2 + " ,(case when ic.price_limit>ic.price then ic.price_limit else ic.price end) 完税单价 ";
sql2 = sql2 + " ,(case when ic.price_limit>ic.price then ic.price_limit else ic.price end)*SD.weight 完税金额无保率 ";
sql2 = sql2 + " ,(case when ic.price_limit>ic.price then ic.price_limit else ic.price end)*SD.weight*ic.baolv 完税金额 ";
sql2 = sql2 + " from Import_Saledetail sd ";
sql2 = sql2 + " left join importtrade_cargo c on sd.CARGO_GID=c.gid ";
sql2 = sql2 + " left join import_cargo ic on ic.GID=c.GID ";
sql2 = sql2 + " left join import_main m on m.ContractNo=sd.BSNO ";
sql2 = sql2 + " left join wms w on w.Cargo_gid=c.GID ";
sql2 = sql2 + " left join Import_Sales s on s.SALESNO=sd.SALESNO ";
sql2 = sql2 + " where sd.SALESNO ='" + billNo + "' ";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "select '" + SHOWNAME + "' showname,'" + printdate + "' printdate";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
,
Print_KHDZ4: 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.SALESNO;
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 basicForm = this.formHead.getForm();
//var billNo = basicForm.findField('ContractNo').value;
if (billNo == '*' || billNo == '') {
//Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var printType = 'Print_importtrade_KHZD5';
var sql1 = " select HTH 合同号,Supplier_Billno 供应商合同号,Other_Billno 分公司合同号 ";
sql1 = sql1 + " ,dbo.trimdate(s.SALESDATE) 合同签订日期 ,dbo.trimdate(dateadd(day,3,s.SALESDATE)) 收取费用日期 ";
sql1 = sql1 + " ,dbo.F_Sales_BoxCount2(s.salesno) 销售件数 ,s.CUSTOMERNAME 销售对象,m.buyer 购货方 ";
sql1 = sql1 + " ,dbo.F_Sales_weight_KG(s.salesno) 销售重量 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) 目的港 ";
sql1 = sql1 + " ,m.ArrivalDate 到港日,m.ContainerNo 箱号 ";
sql1 = sql1 + " ,(select substring(country,0,(charindex('(',country)) ) from code_country where countryid=m.countryid) 进口国 ";
sql1 = sql1 + " ,dbo.F_CargoName_Sales(S.SalesNo) 品名,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=1 and EnumValueID=M.TransactionMethod) 成交方式 ";
sql1 = sql1 + " ,dbo.F_Saleprice(M.ContractNo) 价格,s.saler 销售员 ";
sql1 = sql1 + " ,case (select top 1 CURRENCY from Import_Saledetail where BSNO=m.ContractNo) when 'USD' then '$' when 'RMB' then '¥' when 'EUR' then '€' else '' end 币别符号 ";
sql1 = sql1 + " ,dbo.F_Sales_FactoryNo(s.SALESNO) 厂号 ";
sql1 = sql1 + " from import_sales S left join import_main m on m.contractno=(select top 1 BSNO from import_saledetail where SalesNo=S.SalesNo) ";
sql1 = sql1 + " where S.SalesNo ='" + billNo + "' ";
var sql2 = " declare @sql varchar(8000) select @sql = isnull(@sql + ',' , '') + feename from ";
sql2 = sql2 + " (select distinct feename from ch_fee_order where BSNO='" + billNo + "')t ";
sql2 = sql2 + " exec ('select * into KHDZ4 from (select salesno,cargo_gid, '+@sql+' from (select bsno SALESNO,cargo_gid, feename,amount from ch_fee_order where BSNO=''" + billNo + "'' )t2 ";
sql2 = sql2 + " pivot (sum(amount) for feename in('+@sql+'))fn)t') ";
sql2 = sql2 + " select kt.* ";
sql2 = sql2 + " ,ic.name 品名,Convert(varchar,SD.exchangerate_cust) SD应收账单汇率 ";
sql2 = sql2 + " ,Convert(varchar,c.Exchangerate_Customs) SD海关汇率,dbo.trimdate(sd.STOCKDATE_2) 出库日期";
sql2 = sql2 + " ,w.STORAGENAME 冷库";
sql2 = sql2 + " from KHDZ4 kt ";
sql2 = sql2 + " left join Import_Saledetail sd on kt.salesno=sd.salesno and kt.cargo_gid=sd.cargo_gid ";
sql2 = sql2 + " left join importtrade_cargo c on sd.CARGO_GID=c.gid ";
sql2 = sql2 + " left join import_cargo ic on sd.CARGO_GID=ic.GID ";
sql2 = sql2 + " left join import_main m on m.ContractNo=sd.BSNO ";
sql2 = sql2 + " left join wms w on w.Cargo_gid=c.GID ";
sql2 = sql2 + " left join Import_Sales s on s.SALESNO=sd.SALESNO ";
sql2 = sql2 + " where sd.SALESNO ='" + billNo + "' ";
sql2 = sql2 + " drop table KHDZ4 ";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "select '" + SHOWNAME + "' showname,'" + printdate + "' printdate";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});