Я использую Microsoft SQL Report Builder 2008 для настройки отчета SSRS, сгенерированного из системы Epicor ERP. Я загружаю стиль отчетов SSRS, настраиваю его конструктор отчетов, а затем загружаю его в Epicor, чтобы увидеть изменения, которые я внес в отчет.
В моем отчете SSRS содержится поле Project Lead, но в нем не указано имя Project Lead. Поэтому я пытаюсь найти способ показать имя здесь. Набор данных POHeader в отчете не содержит никакого значения Project Lead, которое равно "PersonID". Поэтому я написал подзапрос, который возвращает значение «Project_Lead» из нескольких наборов данных, которого нет в текущем отчете, но я связал этот запрос с набором данных отчета, чтобы при совпадении со значением «PONum» он возвращал « PersonID ", который является именем руководителя проекта.
Тем не менее, поле показывает инструкцию SELECT вместо возвращаемого значения. SQL-запрос правильный, и я запустил его в системе EPICOR, из которой создается отчет. Я настраиваю отчет, добавляя это значение "PersonID" в поле Project Lead.
Любое предложение очень ценится.
1.Я написал подзапрос, который возвращает значение PersonID из 3 таблиц базы данных.
Затем я установил связь между подзапросом, содержащим значение PersonID, с набором данных POHeader
Подзапрос и POHeader содержат PONum. Таким образом, когда PONum совпадает друг с другом, POHeader возвращает значение PersonID.
Я создал текстовое поле в отчете. В поле выражения я включил подзапрос SQL, который возвращает значение PersonID со связью с набором данных POHeader.
Затем я сохраняю отчет SSRS. И загрузил стиль отчетности в систему Epicor, где я сгенерирую отчет в формате PDF на основе модификации SSRS, которую я только что внес в текстовое поле.
6. Однако в поле текстового поля отображается весь запрос SQL, когда я пытаюсь просмотреть его в качестве предварительного просмотра в системе
="SELECT
[PlannerID].[JobHead_PersonID] as [JobHead_PersonID]
from (select
[POHeader].[PONum] as [POHeader_PONum],
[JobHead].[PersonID] as [JobHead_PersonID],
[JobHead].[JobNum] as [JobHead_JobNum]
from Erp.POHeader as POHeader
inner join Erp.PODetail as PODetail on
POHeader.Company = PODetail.Company
and POHeader.PONum = PODetail.PONUM
inner join Erp.PORel as PORel on
PODetail.Company = PORel.Company
and PODetail.PONUM = PORel.PONum
and PODetail.POLine = PORel.POLine
inner join Erp.JobHead as JobHead on
PORel.Company = JobHead.Company
and PORel.JobNum = JobHead.JobNum) as PlannerID
right outer join Erp.POHeader as POHeader1 on
POHeader1.PONum = PlannerID.POHeader_PONum
POHeader.Company = PODetail.Company
and POHeader.PONum = PODetail.PONUM
inner join Erp.PORel as PORel on
PODetail.Company = PORel.Company
and PODetail.PONUM = PORel.PONum
and PODetail.POLine = PORel.POLine
inner join Erp.JobHead as JobHead on
PORel.Company = JobHead.Company
and PORel.JobNum = JobHead.JobNum) as PlannerID
right outer join Erp.POHeader as POHeader1 on
POHeader1.PONum = PlannerID.POHeader_PONum"
Ожидаемым результатом будет название проекта. Вместо этого я получаю вышеуказанный запрос в этом конкретном поле отчета.
Так что это весь мой SQL после добавления в него подзапроса. Подзапрос включен в самую последнюю часть кода. Если вы сможете взглянуть и предположить, допустил ли я какие-то ошибки при установлении взаимосвязей между различными таблицами, это было бы мне очень полезно. В первой строке оператора SQL SELECT я вызвал personID из подзапроса.
="SELECT
PlannerID.T5.PersonID, T3.TranType, T3.ProjectID, T3.JobNum,
T3.AssemblySeq, T3.JobSeq, T1.RptLanguageID,
T1.CommentText,
T1.Company,
T1.FOB,
T1.FreightPP, T1.EntryPerson, T1.DueDate,
T1.OrderDate,
T1.PONum,
T1.PrintAs,
T1.ShipToConName,
T1.ShipViaCode,
T1.Calc_AccountRef,
T1.Calc_BillToAddrList,
T1.Calc_Buyer,
T1.Calc_CurDesc,
T1.Calc_CurSymb,
CAST(T1.Calc_ExistingDropShipReleases AS nvarchar) AS
Calc_ExistingDropShipReleases,
T1.Calc_FOBDesc,
CAST(T1.Calc_MultiShiptoAddresses AS nvarchar) AS
Calc_MultiShiptoAddresses,
T1.Calc_PurTerms,
T1.Calc_ShipToAddrList,
T1.Calc_ShipVia,
T1.Calc_VendorContact,
T1.Calc_VendPhone,
T1.Calc_VendFax,
T1.Calc_EMail,
T1.BuyerID_EMailAddress,
T1.Vendor_EMailAddress,
T1.Vendor_FaxNum,
T1.VendorCnt_EmailAddress,
T1.Calc_TotDocMiscAmt,
T1.VendorCnt_FaxNum,
T1.InPrice,
T1.DocTotalMisc,
T1.DocTotalTax,
T2.CommentText AS PODetail_CommentText,
T2.Company AS PODetail_Company,
T2.DocUnitCost,
T2.MfgPartNum,
T2.MfgPartOpts,
T2.PartNum,
T2.POLine,
T2.PONUM AS PODetail_PONum,
T2.PUM,
T2.RevisionNum,
T2.SubPartNum,
T2.SubPartOpts,
T2.SubPartType,
T2.Taxable,
T2.VendorPartOpts,
T2.VenPartNum,
T2.Calc_CostPer,
T2.Calc_DtLineDesc,
T2.Calc_ExtCost,
T2.Calc_UOMDescription,
T2.Calc_MfgID,
T2.Calc_InTaxAmt,
T2.DocExtCost,
T4.Calc_AccountRef AS RptLiteralsCalc_AccountRef,
T4.RptLiteralsLFax,
T4.FreightPP AS RptLiteralsFreightPP,
T4.RptLiteralsLAuthBy,
T4.RptLiteralsLChangeOrder,
T4.RptLiteralsLClosed,
T4.RptLiteralsLDueDt,
T4.RptLiteralsLExtPrice,
T4.RptLiteralsLFOB,
T4.RptLiteralsLHdng,
T4.RptLiteralsLJobNum,
T4.RptLiteralsLLine,
T4.RptLiteralsLLineChargeSubtotal,
T4.RptLiteralsLMfgPartNumber,
T4.RptLiteralsLMiscChargeSubtotal,
T4.RptLiteralsLMslshS,
T4.RptLiteralsLOrderDate,
T4.RptLiteralsLOrderQty,
T4.RptLiteralsLOurPartNumber,
T4.RptLiteralsLPg,
T4.RptLiteralsLPhone,
T4.RptLiteralsLPONum,
T4.RptLiteralsLPrtRvDes,
T4.RptLiteralsLQty,
T4.RptLiteralsLResalNo,
T4.RptLiteralsLRevised,
T4.RptLiteralsLSeeBelow,
T4.RptLiteralsLSeq,
T4.RptLiteralsLShipTo,
T4.RptLiteralsLShipVia,
T4.RptLiteralsLShRelReq,
T4.RptLiteralsLSubstitute,
T4.RptLiteralsLSubstitutedFor,
T4.RptLiteralsLSupplierPartNumber,
T4.RptLiteralsLTax,
T4.RptLiteralsLTerms,
T4.RptLiteralsLTotal,
T4.RptLiteralsLUnitPric,
T4.RptLiteralsLVend,
T4.RptLiteralsLLnMsChrg,
T4.RptLiteralsLDesc,
T4.PONum AS RptLiteralsPONum,
T4.RptLiteralsLAmt,
T4.RptLiteralsLTaxSubtotal,
T4.RptLiteralsLYes,
T4.RptLiteralsLNo,
T4.RptLiteralsLBuyer
, T1.[CurrencyCode], T1.[DocTotalCharges], T1.[DocTotalDedTax], T1.
[DocTotalOrder], T1.[DocTotalSATax], T1.[DocTotalWhTax], T1.
[POTaxReadyToProcess], T1.[PromiseDate], T1.[TotalCharges], T1.
[TotalDedTax], T1.[TotalMiscCharges], T1.[TotalOrder], T1.[TotalSATax],
T1.
[TotalTax], T1.[TotalWhTax], T1.[Character01], T1.[Character02], T1.
[Character03], T1.[Character04], T1.[Character05], T1.[CheckBox01], T1.
[CheckBox02], T1.[CheckBox03], T1.[CheckBox04], T1.[CheckBox05], T1.
[Date01],
T1.[Date02], T1.[Date03], T1.[Date04], T1.[Date05], T1.[Number01], T1.
[Number02], T1.[Number03], T1.[Number04], T1.[Number05], T1.[ShortChar01],
T1.[ShortChar02], T1.[ShortChar03], T1.[ShortChar04], T1.[ShortChar05],
T1.
[Calc_CarrierDesc], T1.[Calc_CarrierSCAC], T1.[Calc_INBillToAddrList], T1.
[Calc_INShipToAddrList], T1.[Calc_INTotalWords], T1.
[Calc_PlantAddressInRelease], T1.[Calc_RPTUSERID], T1.[Calc_VendorID], T1.
[BuyerID_Name], T1.[VendorCnt_Name], T1.[VendorCnt_PhoneNum], T2.
[CommodityCode], T2.[DocMiscCost], T2.[ExtCost], T2.[GroupSeq], T2.
[InUnitCost], T2.[MiscCost], T2.[NoTaxRecalc], T2.[PCLinkRemoved], T2.
[Per],
T2.[Rpt1TotalDedTax], T2.[Rpt1TotalSATax], T2.[Rpt1TotalTax], T2.
[Rpt2TotalDedTax], T2.[Rpt2TotalSATax], T2.[Rpt2TotalTax], T2.
[Rpt3TotalDedTax], T2.[Rpt3TotalSATax], T2.[Rpt3TotalTax], T2.[TaxCatID],
T2.[UOM], T2.[Date06], T2.[Date07], T2.[Number11], T2.[ShortChar06], T2.
[ShortChar07], T2.[Calc_DispUnitCost], T2.[Calc_LastLin], T2.[Calc_OurUM],
T2.[Calc_OurUM_UOMSymbol], T2.[Calc_PartUDChr1], T2.[Calc_PartUDChr2], T2.
[Calc_PartUDChr3], T2.[Calc_PartUDChr4], T2.[Calc_PartUDDat1], T2.
[Calc_PartUDDat2], T2.[Calc_PartUDDat3], T2.[Calc_PartUDDat4], T2.
[Calc_PartUDDec1], T2.[Calc_PartUDDec2], T2.[Calc_PartUDDec3], T2.
[Calc_PartUDDec4], T2.[Calc_PartUDInt1], T2.[Calc_PartUDInt2], T2.
[Calc_UnitCost], T2.[ContractQtyUOM_UOMSymbol], T2.[PUM_UOMSymbol], T4.
[DecimalsGeneral] as RptLabelsDecimalsGeneral, T4.[DecimalsPrice] as
RptLabelsDecimalsPrice, T4.[DecimalsCost] as RptLabelsDecimalsCost, T4.
[GlbDecimalsGeneral] as RptLabelsGlbDecimalsGeneral, T4.[GlbDecimalsPrice]
as RptLabelsGlbDecimalsPrice, T4.[GlbDecimalsCost] as
RptLabelsGlbDecimalsCost, T4.[RptLiteralsPage], T4.[RptLiteralsTime], T4.
[RptLiteralsUser], T4.[RptLiteralsDate], T4.[RptLiteralsLAsm], T4.
[RptLiteralsLCarrier], T4.[RptLiteralsLCarrierSCAC], T4.
[RptLiteralsLChange], T4.[RptLiteralsLClosedCAP], T4.
[RptLiteralsLFrtPaid],
T4.[RptLiteralsLINCommodityCode], T4.[RptLiteralsLINDescription], T4.
[RptLiteralsLINFooterDate], T4.[RptLiteralsLINFooterDesignation], T4.
[RptLiteralsLINFooterName], T4.[RptLiteralsLINFooterSignature], T4.
[RptLiteralsLINPartNumber], T4.[RptLiteralsLINRatePercent], T4.
[RptLiteralsLINTotal], T4.[RptLiteralsLOrder], T4.[RptLiteralsLOrMsChrg],
T4.[RptLiteralsLOurPart], T4.[RptLiteralsLPercent], T4.
[RptLiteralsLslshC], T4.[RptLiteralsLslshM], T4.
[RptLiteralsLTaxableAmount], T4.[RptLiteralsLTaxAmount], T4.
[RptLiteralsLTaxes], T4.[ActTypeCode] as RptLabelsActTypeCode, T4.
[APBOECheck] as RptLabelsAPBOECheck, T4.[CalendarID] as
RptLabelsCalendarID, T4.[ChiefAcctName] as RptLabelsChiefAcctName, T4.
[Company] as RptLabelsCompany, T4.[COSequenceCert] as
RptLabelsCOSequenceCert, T4.[CountryNum] as RptLabelsCountryNum, T4.
[CurrentFiscalYear] as RptLabelsCurrentFiscalYear, T4.[DeepCopy] as
RptLabelsDeepCopy, T4.[DeepCopyDupOrRevEst] as
RptLabelsDeepCopyDupOrRevEst, T4.[EDICode] as RptLabelsEDICode, T4.
[EmpPhotoPath] as RptLabelsEmpPhotoPath, T4.[EpicorAccountNum] as
RptLabelsEpicorAccountNum, T4.[EschedFileSet] as RptLabelsEschedFileSet,
T4.[ExternalID] as RptLabelsExternalID, T4.[FaxNum] as RptLabelsFaxNum,
T4.[FEIN] as RptLabelsFEIN, T4.[FiscalCalendarID] as
RptLabelsFiscalCalendarID, T4.[FRxDSN] as RptLabelsFRxDSN, T4.
[FRxPassWord] as RptLabelsFRxPassWord, T4.[FrxUserid] as
RptLabelsFrxUserid, T4.[LegalName] as RptLabelsLegalName, T4.[LogoFile] as
RptLabelsLogoFile, T4.[ManagerName] as RptLabelsManagerName, T4.[MapURL]
as RptLabelsMapURL, T4.[MXMunicipio] as RptLabelsMXMunicipio, T4.[Number]
as RptLabelsNumber, T4.[OrgRegCode] as RptLabelsOrgRegCode, T4.[PhoneNum]
as RptLabelsPhoneNum, T4.[SendToFSA] as RptLabelsSendToFSA, T4.
[StateTaxID] as RptLabelsStateTaxID, T4.[TaxRegionCode] as
RptLabelsTaxRegionCode, T4.[TaxRegReason] as RptLabelsTaxRegReason, T4.
[WIApplication] as RptLabelsWIApplication, T4.[WIAutoCreateJob] as
RptLabelsWIAutoCreateJob, T4.[WIGetDetails] as RptLabelsWIGetDetails, T4.
[WIRelease] as RptLabelsWIRelease, T4.[WISchedule] as RptLabelsWISchedule,
T4.[WIShippingCosts] as RptLabelsWIShippingCosts, T4.[Calc_AddressList] as
RptLabelsCalc_AddressList, T4.[Calc_INAddressList] as
RptLabelsCalc_INAddressList, T4.[Calc_PrintCompanyName] as
RptLabelsCalc_PrintCompanyName, T4.[CommentText] as RptLabelsCommentText,
T4.[CurrencyCode] as RptLabelsCurrencyCode, T4.[DocTotalCharges] as
RptLabelsDocTotalCharges, T4.[DocTotalDedTax] as RptLabelsDocTotalDedTax,
T4.[DocTotalMisc] as RptLabelsDocTotalMisc, T4.[DocTotalOrder] as
RptLabelsDocTotalOrder, T4.[DocTotalSATax] as RptLabelsDocTotalSATax, T4.
[DocTotalTax] as RptLabelsDocTotalTax, T4.[DocTotalWhTax] as
RptLabelsDocTotalWhTax, T4.[DueDate] as RptLabelsDueDate, T4.[EntryPerson]
as RptLabelsEntryPerson, T4.[FOB] as RptLabelsFOB, T4.[FreightPP] as
RptLabelsFreightPP, T4.[InPrice] as RptLabelsInPrice, T4.[OrderDate] as
RptLabelsOrderDate, T4.[PONum] as RptLabelsPONum, T4.[POTaxReadyToProcess]
as RptLabelsPOTaxReadyToProcess, T4.[PrintAs] as RptLabelsPrintAs, T4.
[PromiseDate] as RptLabelsPromiseDate, T4.[ShipToConName] as
RptLabelsShipToConName, T4.[ShipViaCode] as RptLabelsShipViaCode, T4.
[TotalCharges] as RptLabelsTotalCharges, T4.[TotalDedTax] as
RptLabelsTotalDedTax, T4.[TotalMiscCharges] as RptLabelsTotalMiscCharges,
T4.[TotalOrder] as RptLabelsTotalOrder, T4.[TotalSATax] as
RptLabelsTotalSATax, T4.[TotalTax] as RptLabelsTotalTax, T4.[TotalWhTax]
as RptLabelsTotalWhTax, T4.[Calc_AccountRef] as RptLabelsCalc_AccountRef,
T4.[Calc_BillToAddrList] as RptLabelsCalc_BillToAddrList, T4.[Calc_Buyer]
as RptLabelsCalc_Buyer, T4.[Calc_CarrierDesc] as
RptLabelsCalc_CarrierDesc, T4.[Calc_CarrierSCAC] as
RptLabelsCalc_CarrierSCAC, T4.[Calc_CurDesc] as RptLabelsCalc_CurDesc, T4.
[Calc_CurSymb] as RptLabelsCalc_CurSymb, T4.[Calc_EMail] as
RptLabelsCalc_EMail, T4.[Calc_ExistingDropShipReleases] as
RptLabelsCalc_ExistingDropShipReleases, T4.[Calc_FOBDesc] as
RptLabelsCalc_FOBDesc, T4.[Calc_INBillToAddrList] as
RptLabelsCalc_INBillToAddrList, T4.[Calc_INShipToAddrList] as
RptLabelsCalc_INShipToAddrList, T4.[Calc_INTotalWords] as
RptLabelsCalc_INTotalWords, T4.[Calc_MultiShiptoAddresses] as
RptLabelsCalc_MultiShiptoAddresses, T4.[Calc_PlantAddressInRelease] as
RptLabelsCalc_PlantAddressInRelease, T4.[Calc_PurTerms] as
RptLabelsCalc_PurTerms, T4.[Calc_RPTUSERID] as RptLabelsCalc_RPTUSERID,
T4.[Calc_ShipToAddrList] as RptLabelsCalc_ShipToAddrList, T4.
[Calc_ShipVia] as RptLabelsCalc_ShipVia, T4.[Calc_TotDocMiscAmt] as
RptLabelsCalc_TotDocMiscAmt, T4.[Calc_VendFax] as RptLabelsCalc_VendFax,
T4.[Calc_VendorContact] as RptLabelsCalc_VendorContact, T4.[Calc_VendorID]
as RptLabelsCalc_VendorID, T4.[Calc_VendPhone] as RptLabelsCalc_VendPhone,
T4.
[EMailAddress] as RptLabelsEMailAddress, T4.[Name] as RptLabelsName, T4.
[CommodityCode] as RptLabelsCommodityCode, T4.[DocExtCost] as
RptLabelsDocExtCost, T4.[DocMiscCost] as RptLabelsDocMiscCost, T4.
[DocUnitCost] as RptLabelsDocUnitCost, T4.[ExtCost] as RptLabelsExtCost,
T4.[GroupSeq] as RptLabelsGroupSeq, T4.[InUnitCost] as
RptLabelsInUnitCost, T4.[MfgPartNum] as RptLabelsMfgPartNum, T4.
[MfgPartOpts] as RptLabelsMfgPartOpts, T4.[MiscCost] as RptLabelsMiscCost,
T4.[NoTaxRecalc] as RptLabelsNoTaxRecalc, T4.[PartNum] as
RptLabelsPartNum, T4.[PCLinkRemoved] as RptLabelsPCLinkRemoved, T4.[Per]
as RptLabelsPer, T4.[POLine] as RptLabelsPOLine, T4.[PUM] as RptLabelsPUM,
T4.[RevisionNum] as RptLabelsRevisionNum, T4.[Rpt1TotalDedTax] as
RptLabelsRpt1TotalDedTax, T4.[Rpt1TotalSATax] as RptLabelsRpt1TotalSATax,
T4.[Rpt1TotalTax] as RptLabelsRpt1TotalTax, T4.[Rpt2TotalDedTax] as
RptLabelsRpt2TotalDedTax, T4.[Rpt2TotalSATax] as RptLabelsRpt2TotalSATax,
T4.[Rpt2TotalTax] as RptLabelsRpt2TotalTax, T4.[Rpt3TotalDedTax] as
RptLabelsRpt3TotalDedTax, T4.[Rpt3TotalSATax] as RptLabelsRpt3TotalSATax,
T4.[Rpt3TotalTax] as RptLabelsRpt3TotalTax, T4.[SubPartNum] as
RptLabelsSubPartNum, T4.[SubPartOpts] as RptLabelsSubPartOpts, T4.
[SubPartType] as RptLabelsSubPartType, T4.[Taxable] as RptLabelsTaxable,
T4.[TaxCatID] as RptLabelsTaxCatID, T4.[UOM] as RptLabelsUOM, T4.
[VendorPartOpts] as RptLabelsVendorPartOpts, T4.[VenPartNum] as
RptLabelsVenPartNum, T4.[Calc_CostPer] as RptLabelsCalc_CostPer, T4.
[Calc_DispUnitCost] as RptLabelsCalc_DispUnitCost, T4.[Calc_DtLineDesc] as
RptLabelsCalc_DtLineDesc, T4.[Calc_ExtCost] as RptLabelsCalc_ExtCost, T4.
[Calc_InTaxAmt] as RptLabelsCalc_InTaxAmt, T4.[Calc_LastLin] as
RptLabelsCalc_LastLin, T4.[Calc_MfgID] as RptLabelsCalc_MfgID, T4.
[Calc_OurUM] as RptLabelsCalc_OurUM, T4.[Calc_OurUM_UOMSymbol] as
RptLabelsCalc_OurUM_UOMSymbol, T4.[Calc_PartUDChr1] as
RptLabelsCalc_PartUDChr1, T4.[Calc_PartUDChr2] as
RptLabelsCalc_PartUDChr2, T4.[Calc_PartUDChr3] as
RptLabelsCalc_PartUDChr3, T4.[Calc_PartUDChr4] as
RptLabelsCalc_PartUDChr4, T4.[Calc_PartUDDat1] as
RptLabelsCalc_PartUDDat1, T4.[Calc_PartUDDat2] as
RptLabelsCalc_PartUDDat2, T4.[Calc_PartUDDat3] as
RptLabelsCalc_PartUDDat3, T4.[Calc_PartUDDat4] as
RptLabelsCalc_PartUDDat4, T4.[Calc_PartUDDec1] as
RptLabelsCalc_PartUDDec1, T4.[Calc_PartUDDec2] as
RptLabelsCalc_PartUDDec2, T4.[Calc_PartUDDec3] as
RptLabelsCalc_PartUDDec3, T4.[Calc_PartUDDec4] as
RptLabelsCalc_PartUDDec4,
T4.[Calc_PartUDInt1] as RptLabelsCalc_PartUDInt1, T4.[Calc_PartUDInt2] as
RptLabelsCalc_PartUDInt2, T4.[Calc_UnitCost] as RptLabelsCalc_UnitCost,
T4.[Calc_UOMDescription] as RptLabelsCalc_UOMDescription, T4.[UOMSymbol]
as RptLabelsUOMSymbol, T4.[AssemblySeq] as RptLabelsAssemblySeq, T4.
[DropShip] as RptLabelsDropShip, T4.[EpicorFSA] as RptLabelsEpicorFSA, T4.
[JobNum] as RptLabelsJobNum, T4.[JobSeq] as RptLabelsJobSeq, T4.
[JobSeqType] as RptLabelsJobSeqType, T4.[OpenRelease] as
RptLabelsOpenRelease, T4.[OrderRelNum] as RptLabelsOrderRelNum, T4.
[ProjectID] as RptLabelsProjectID, T4.[RelQty] as RptLabelsRelQty, T4.
[Status] as RptLabelsStatus, T4.[TaxExempt] as RptLabelsTaxExempt, T4.
[TranType] as RptLabelsTranType, T4.[Calc_ManPartNum] as
RptLabelsCalc_ManPartNum, T4.[Calc_Manufacturer] as
RptLabelsCalc_Manufacturer, T4.[Calc_ShipToConName] as
RptLabelsCalc_ShipToConName, T4.[Calc_SortDueDte] as
RptLabelsCalc_SortDueDte, T4.[Description] as RptLabelsDescription, T4.
[DocInInvoiceAmt] as RptLabelsDocInInvoiceAmt, T4.[DocInMiscAmt] as
RptLabelsDocInMiscAmt, T4.[DocMiscAmt] as RptLabelsDocMiscAmt, T4.
[MiscCode] as RptLabelsMiscCode, T4.[Percentage] as RptLabelsPercentage,
T4.[Type] as RptLabelsType, T4.[MiscAmt] as RptLabelsMiscAmt, T4.
[Calc_MiscSeq] as RptLabelsCalc_MiscSeq, T4.[DocTaxableAmt] as
RptLabelsDocTaxableAmt, T4.[DocTaxAmt] as RptLabelsDocTaxAmt, T4.[Percent]
as RptLabelsPercent, T4.[TaxCode] as RptLabelsTaxCode, T4.[MfgNum] as
RptLabelsMfgNum, T4.[VendorNum] as RptLabelsVendorNum, T4.[VendPartNum] as
RptLabelsVendPartNum, T4.[Calc_POLine] as RptLabelsCalc_POLine, T4.
[Calc_PONum] as RptLabelsCalc_PONum, T4.[ExternalMESLastSync] as
RptLabelsExternalMESLastSync, T4.[ExternalMESSyncRequired] as
RptLabelsExternalMESSyncRequired, T4.[PartDescription] as
RptLabelsPartDescription, T4.[PersonID] as RptLabelsPersonID, T3.
[DropShip], T3.[EpicorFSA], T3.[JobSeqType], T3.[OpenRelease], T3.
[OrderRelNum], T3.[RelQty], T3.[Status], T3.[TaxExempt], T3.[Date11], T3.
[Date12], T3.[Date13], T3.[Number10], T3.[Number12], T3.[Number13], T3.
[Number14], T3.[Number15], T3.[ShortChar10], T3.[Calc_ManPartNum], T3.
[Calc_Manufacturer], T3.[Calc_ShipToConName], T3.[Calc_SortDueDte], T5.
[ExternalMESLastSync], T5.[ExternalMESSyncRequired], T5.[PartDescription],
T6.[DocTaxableAmt], T6.[DocTaxAmt], T6.[Percent], T6.[TaxCode], T7.
[Description], T7.[DocMiscAmt], T7.[MiscAmt], T7.[Calc_MiscSeq], T8.
[DocInInvoiceAmt], T8.[DocInMiscAmt], T8.[MiscCode], T8.[Percentage], T8.
[Type], T9.[MfgNum], T9.[Calc_POLine], T9.[Calc_PONum], T10.[VendorNum],
T10.[VendPartNum]
FROM POHeader_" + Parameters!TableGuid.Value + " T1
LEFT OUTER JOIN PODetail_" + Parameters!TableGuid.Value + " T2
ON T1.Company = T2.Company AND T1.PONum = T2.PONUM
LEFT OUTER JOIN RptLabels_" + Parameters!TableGuid.Value + " T4
ON T1.RptLanguageID = T4.RptLanguageID LEFT OUTER JOIN PORel_" +
Parameters!TableGuid.Value + " T3
ON T3.Company = T2.Company AND T3.PONum = T2.PONUM
AND T3.POLine = T2.POLine LEFT OUTER JOIN JobHead_" +
Parameters!TableGuid.Value + " T5
ON T5.Company = T3.Company AND T5.JobNum = T3.JobNum
LEFT OUTER JOIN POHeaderTax_" + Parameters!TableGuid.Value + " T6 ON T1.
[Company] = T6.[Company] AND T1.[PONum] = T6.[PONum]
LEFT OUTER JOIN ORMisc_" + Parameters!TableGuid.Value + " T7 ON T1.
[Company] = T7.[Company] AND T1.[PONum] = T7.[PONum]
LEFT OUTER JOIN POMisc_" + Parameters!TableGuid.Value + " T8 ON T1.
[Company] = T8.[Company] AND T1.[PONum] = T8.[PONum]
LEFT OUTER JOIN PartXRefMfg_" + Parameters!TableGuid.Value + " T9 ON T2.
[Company] = T9.[Company] AND T2.[PONUM] = T9.[Calc_PONum] AND T2.[POLine]
=
T9.[Calc_POLine]
LEFT OUTER JOIN PartXRefVend_" + Parameters!TableGuid.Value + " T10 ON
T2.[Company] = T10.[Company] AND T2.[PONUM] = T10.[Calc_PONum] AND T2.
[POLine] = T10.[Calc_POLine]
INNER JOIN
(SELECT
T1.PONum,
T5.PersonID,
T5.JobNum
from T1
inner join T2 on
T1.Company = T2.Company
and T1.PONum = T2.PONUM
inner join T3 on
T2.Company = T3.Company
and T2.PONUM = T3.PONum
and T2.POLine = T3.POLine
inner join T5 on
T3.Company = T5.Company
and T3.JobNum = T5.JobNum) as PlannerID
right outer join T1 as POHeader1 on
POHeader1.PONum = PlannerID.T1.PONum"