日期:2014-05-17 浏览次数:20656 次
ALTER PROCEDURE [dbo].[QDZYExportCostExcel_EX]
@BusinessNum varchar(8000),
@Consignor varchar(100),
@StartExportDate datetime,
@EndExportDate datetime,
@ExportMan varchar(50),
@ExportType varchar(20),
@InputMan varchar(50),
@InputDepartment varchar(20),
@StartManagerCheckCostDate datetime,
@EndManagerCheckCostDate datetime,
@Flag_ManagerCheckCost varchar(1),
@DeliveryListNum varchar(50),
@AdvanceNum varchar(20),
@ApproveNum varchar(20),
@VoyageNum varchar(50),
@TotalNum varchar(12),
@DocumentNum varchar(50),
@ContainerNum varchar(50),
@Flag_Customs varchar(1),
@EndInputDate datetime ,
@StartInputDate datetime
AS
BEGIN
DECLARE @sql VARCHAR(8000)
SET @sql = 'select
Convert(varchar(10),ccd.DeclareDate,120) [申报日期(业务日期)],
ccd.Operate_Name [经营单位(客户自编号)],
ccd.ConveyanceName [船名],
ccd.VoyageNum [航次],
ccd.DeliveryListNum [提单号],
ccd. CustomsNum [海关编码],
'''' [随附单证号(报检号)],
ccd.GoodsCount [件数],
ccd.GW [毛重],
'''' [品名(货物属性描述)],
case cfi.CostType when ''0'' then ''AR'' else ''AP'' end [应收/应付],
cfi.Code [客户/供应商(SAP ID)],
cfi.ChargeCode [Charge Code],
cfi.Currency_Id [币种],
(case cfi.CostType when ''0'' then (RealMoney) else (RealMoney) end ) [金额],
(case ccd.Flag_Customs when ''0'' then ''OB'' else ''IB'' end) [进出口],
'''' [始发港],
'''' [目的港],
'''' [SVVD],
ccd.InputMan [销售员],
'''' [接货地城市],
'''' [目的地城市], &