Query Issue

This query is duplicating data and I have not been able to put it into the BAQ designer to break it down due to the left Join on RptLabels. Ideas on how to get around that? Here is the query for consideration.

SELECT
   T1.CurrencyCode_DecimalsGeneral,
   T1.Company,
   T1.Calc_InvSubTotal,
   T1.InvoiceNum,
   T2.Company as InvcMisc_Company,
   T2.InvoiceNum as InvcMisc_InvoiceNum,
   T2.[Description],
   T2.DocMiscAmt,
   T2.SeqNum,
   T3.Calc_TaxAmtTotal,
   T4.RptLiteralsLMiscChgs,
   T4.[Description] as Label_Description,
   T4.RptLiteralsLAmt as Label_Calc_vPayAmounts,
   T1.[AGAuthorizationCode],
   T1.[AGAuthorizationDate],
   T1.[AGDocumentLetter],
   T1.[AGInvoicingPoint],
   T1.[AGLegalNumber],
   T1.[AGPrintingControlType],
   T1.[AGUseGoodDefaultMark],
   T1.[ApplyDate],
   T1.[ARLOCID],
   T1.[AutoPrintReady],
   T1.[BillingDate],
   T1.[BillingNumber],
   T1.[BillToInvoiceAddress],
   T1.[BlockedFinChrg],
   T1.[BlockedFinChrgReason],
   T1.[BlockedRemLetters],
   T1.[BlockedRemLettersReason],
   T1.[BranchID],
   T1.[CardNumber],
   T1.[CCStreetAddr],
   T1.[CCZip],
   T1.[ChangeDate],
   T1.[ChangedBy],
   T1.[ChangeTime],
   T1.[CHISRCodeLine],
   T1.[CMReason],
   T1.[CMType],
   T1.[CNConfirmDate],
   T1.[CollectionsCust],
   T1.[Consolidated],
   T1.[ContractDate],
   T1.[ContractRef],
   T1.[CopyLatestInvoice],
   T1.[CorrectionInv],
   T1.[CounterARForm],
   T1.[CreditMemo],
   T1.[CurrencyCode],
   T1.[CurrRateDate],
   T1.[CustAgentName],
   T1.[CustAgentTaxRegNo],
   T1.[CustNum],
   T1.[CycleCode],
   T1.[CycleInactive],
   T1.[DebitNote],
   T1.[Deferred],
   T1.[DepositAmt],
   T1.[DepositCredit],
   T1.[DepUnallocatedAmt],
   T1.[DNComments],
   T1.[DNCustNbr],
   T1.[DocDepApplied],
   T1.[DocDepositAmt],
   T1.[DocDepositCredit],
   T1.[DocDepUnallocatedAmt],
   T1.[DocInvoiceAmt],
   T1.[DocMaxValueAmt],
   T1.[DocPECharges],
   T1.[DocPECommissions],
   T1.[DocPEDetTaxAmt],
   T1.[DocPEDischargeAmt],
   T1.[DocPEInterest],
   T1.[DocPENoPayPenalty],
   T1.[DocRecurBalance],
   T1.[DocRounding],
   T1.[DocumentPrinted],
   T1.[DocWithholdAmt],
   T1.[DueDate],
   T1.[Duration],
   T1.[EDIReady],
   T1.[EInvException],
   T1.[EInvoice],
   T1.[EInvStatus],
   T1.[EInvTimestamp],
   T1.[EInvUpdatedBy],
   T1.[EndDate],
   T1.[ExchangeRate],
   T1.[Excluded],
   T1.[ExportReportNo],
   T1.[ExportType],
   T1.[FiscalCalendarID],
   T1.[FiscalYearSuffix],
   T1.[GUIDateOfExport],
   T1.[GUIDeductCode],
   T1.[GUIExportBillNumber],
   T1.[GUIExportBillType],
   T1.[GUIExportMark],
   T1.[GUIExportType],
   T1.[GUIFormatCode],
   T1.[GUITaxTypeCode],
   T1.[HeadNum],
   T1.[HoldInvoice],
   T1.[InPrice],
   T1.[InstanceNum],
   T1.[InvInCollections],
   T1.[InvoiceAmt],
   T1.[InvoiceComment],
   T1.[InvoiceDate],
   T1.[InvoiceNumList],
   T1.[InvoiceRef],
   T1.[InvoiceType],
   T1.[IsAddedToGTI],
   T1.[IsRecurring],
   T1.[LastChrgCalcDate],
   T1.[LastDate],
   T1.[LegalNumber],
   T1.[LockTaxRate],
   T1.[MainSite],
   T1.[MaxValueAmt],
   T1.[MXAccountNumber],
   T1.[MXApprovalNum],
   T1.[MXApprovalYear],
   T1.[MXCancelledDate],
   T1.[MXCBB],
   T1.[MXCertificate],
   T1.[MXCertificateSN],
   T1.[MXCertifiedTimestamp],
   T1.[MXDigitalSeal],
   T1.[MXFiscalFolio],
   T1.[MXFolio],
   T1.[MXOriginalAmount],
   T1.[MXOriginalDate],
   T1.[MXOriginalFolio],
   T1.[MXOriginalSeries],
   T1.[MXOriginalString],
   T1.[MXOriginalStringTFD],
   T1.[MXPaidAs],
   T1.[MXPaymentName],
   T1.[MXPaymentNum],
   T1.[MXPostedTimeStamp],
   T1.[MXSATCertificateSN],
   T1.[MXSATSeal],
   T1.[MXSerie],
   T1.[MXTaxRcptType],
   T1.[MXTaxRegime],
   T1.[MXTotalPayments],
   T1.[OrderNum],
   T1.[OrdExchangeRate],
   T1.[OrigDueDate],
   T1.[OurBank],
   T1.[OurSupplierCode],
   T1.[Overpaid],
   T1.[OverrideEndDate],
   T1.[OvrDefTaxDate],
   T1.[PayDiscDays],
   T1.[PayDiscPartPay],
   T1.[PayDiscPer],
   T1.[PBProjectID],
   T1.[PEAPPayNum],
   T1.[PEBankNumber],
   T1.[PEBOEIsMultiGen],
   T1.[PEBOEPosted],
   T1.[PEBOEStatus],
   T1.[PECharges],
   T1.[PECommissions],
   T1.[PEDetTaxAmt],
   T1.[PEDetTaxCurrencyCode],
   T1.[PEDischargeAmt],
   T1.[PEDischargeDate],
   T1.[PEGuaranteeAddress1],
   T1.[PEGuaranteeAddress2],
   T1.[PEGuaranteeAddress3],
   T1.[PEGuaranteeCity],
   T1.[PEGuaranteeCountry],
   T1.[PEGuaranteeName],
   T1.[PEGuaranteePhoneNum],
   T1.[PEGuaranteeState],
   T1.[PEGuaranteeTaxID],
   T1.[PEGuaranteeZip],
   T1.[PEInterest],
   T1.[PENoPayPenalty],
   T1.[PEReasonCode],
   T1.[PEReasonDesc],
   T1.[PERefDocID],
   T1.[PESUNATDepAmt],
   T1.[PESUNATDepDate],
   T1.[PESUNATDepNum],
   T1.[PIPayment],
   T1.[PMUID],
   T1.[PONum],
   T1.[PostedRecog],
   T1.[RateGrpCode],
   T1.[ReadyToBill],
   T1.[ReadyToCalc],
   T1.[RealEstateNo],
   T1.[RecalcBeforePost],
   T1.[RecurBalance],
   T1.[RecurringState],
   T1.[RecurSource],
   T1.[RefCancelled],
   T1.[RefCancelledBy],
   T1.[ReversalDocAmount],
   T1.[RevisionDate],
   T1.[RevisionNum],
   T1.[Rounding],
   T1.[Rpt1DepGainLoss],
   T1.[Rpt1DepositAmt],
   T1.[Rpt1DepUnallocatedAmt],
   T1.[Rpt1MaxValueAmt],
   T1.[Rpt1PECharges],
   T1.[Rpt1PECommissions],
   T1.[Rpt1PEDischargeAmt],
   T1.[Rpt1PEInterest],
   T1.[Rpt1PENoPayPenalty],
   T1.[Rpt1RecurBalance],
   T1.[Rpt1WithholdAmt],
   T1.[Rpt2DepGainLoss],
   T1.[Rpt2DepositAmt],
   T1.[Rpt2DepUnallocatedAmt],
   T1.[Rpt2MaxValueAmt],
   T1.[Rpt2PECharges],
   T1.[Rpt2PECommissions],
   T1.[Rpt2PEDischargeAmt],
   T1.[Rpt2PEInterest],
   T1.[Rpt2PENoPayPenalty],
   T1.[Rpt2RecurBalance],
   T1.[Rpt2WithholdAmt],
   T1.[Rpt3DepGainLoss],
   T1.[Rpt3DepositAmt],
   T1.[Rpt3DepUnallocatedAmt],
   T1.[Rpt3MaxValueAmt],
   T1.[Rpt3PECharges],
   T1.[Rpt3PECommissions],
   T1.[Rpt3PEDischargeAmt],
   T1.[Rpt3PEInterest],
   T1.[Rpt3PENoPayPenalty],
   T1.[Rpt3RecurBalance],
   T1.[Rpt3WithholdAmt],
   T1.[SEBankRef],
   T1.[ShipDate],
   T1.[SiteCode],
   T1.[SoldToCustNum],
   T1.[SoldToInvoiceAddress],
   T1.[SummarizationDate],
   T1.[TaxPoint],
   T1.[TaxRateDate],
   T1.[TaxRateGrpCode],
   T1.[TaxRegionCode],
   T1.[THIsImmatAdjustment],
   T1.[TotFinChrg],
   T1.[TranDocTypeID],
   T1.[TWDeclarePeriod],
   T1.[TWDeclareYear],
   T1.[TWGenerationType],
   T1.[TWGUIGroup],
   T1.[TWPeriodPrefix],
   T1.[UseAltBillTo],
   T1.[UseAltBillToID],
   T1.[WithholdAmt],
   T1.[WithTaxConfirm],
   T1.[XRefContractDate],
   T1.[XRefContractNum],
   T1.[Calc_BillToAddressList],
   T1.[Calc_BottomAddress],
   T1.[Calc_BTAddressList],
   T1.[Calc_CHBankAcctIBANCode],
   T1.[Calc_CHBankAcctISRPartyID],
   T1.[Calc_CompanyAddressList],
   T1.[Calc_ConReference],
   T1.[Calc_ConStartDate],
   T1.[Calc_CreditMemo],
   T1.[Calc_CurrDocDecimalsGeneral],
   T1.[Calc_CurrDocDecimalsPrice],
   T1.[Calc_CurrDocDesc],
   T1.[Calc_CurSymbol],
   T1.[Calc_CustContactName],
   T1.[Calc_CustEMailAddress],
   T1.[Calc_CustFax],
   T1.[Calc_CustID],
   T1.[Calc_CustPartOpts],
   T1.[Calc_CustPhone],
   T1.[Calc_CustResaleID],
   T1.[Calc_DocInvoiceAmt],
   T1.[Calc_DropShipPackSlip],
   T1.[Calc_DteOrdrd],
   T1.[Calc_fFOB],
   T1.[Calc_GuiFormatCodeDesc],
   T1.[Calc_InvoiceRefDate],
   T1.[Calc_InvoiceRefLegalNumber],
   T1.[Calc_InvSuffix],
   T1.[Calc_LessPrepaidDeposits],
   T1.[Calc_MscTotal],
   T1.[Calc_MtlTotal],
   T1.[Calc_MulPackNum],
   T1.[Calc_mulponum],
   T1.[Calc_MulShipDate],
   T1.[Calc_MulShipTo],
   T1.[Calc_MulShipVia],
   T1.[Calc_MulShpCon],
   T1.[Calc_MultSoldTo],
   T1.[Calc_MultTaxID],
   T1.[Calc_MXAmountInWords],
   T1.[Calc_MXApprovalNumber],
   T1.[Calc_MXApprovalYear],
   T1.[Calc_MXBarcode],
   T1.[Calc_MXCBB],
   T1.[Calc_MXCertificateSN],
   T1.[Calc_MXCertifiedTimeStamp],
   T1.[Calc_MXCurrencyId],
   T1.[Calc_MXDigitalSeal],
   T1.[Calc_MXExpeditionAddress],
   T1.[Calc_MXFiscalFolio],
   T1.[Calc_MXFolio],
   T1.[Calc_MXFormOfPayment],
   T1.[Calc_MXIsBaseCurr],
   T1.[Calc_MXOrigFiscalFolio],
   T1.[Calc_MXOrigFiscalFolioAmount],
   T1.[Calc_MXOrigFiscalFolioDate],
   T1.[Calc_MXOrigFiscalFolioSeries],
   T1.[Calc_MXOriginalString1],
   T1.[Calc_MXOriginalString10],
   T1.[Calc_MXOriginalString2],
   T1.[Calc_MXOriginalString3],
   T1.[Calc_MXOriginalString4],
   T1.[Calc_MXOriginalString5],
   T1.[Calc_MXOriginalString6],
   T1.[Calc_MXOriginalString7],
   T1.[Calc_MXOriginalString8],
   T1.[Calc_MXOriginalString9],
   T1.[Calc_MXOriginalStringTFD],
   T1.[Calc_MXPaidAs],
   T1.[Calc_MXPaymentAccountNum],
   T1.[Calc_MXPaymentMethod],
   T1.[Calc_MXPaymentNum],
   T1.[Calc_MXSATCertificateSN],
   T1.[Calc_MXSATSeal],
   T1.[Calc_MXSerie],
   T1.[Calc_MXTaxRegime],
   T1.[Calc_MXTotalPayments],
   T1.[Calc_MYBaseCurrCode],
   T1.[Calc_MYBaseCurrSymbol],
   T1.[Calc_NumRecordPerPage],
   T1.[Calc_NumTotalParts],
   T1.[Calc_PackNum],
   T1.[Calc_PELegalText],
   T1.[Calc_PeriodEndDate],
   T1.[Calc_PPAllowPcnt],
   T1.[Calc_PrintBottomAddress],
   T1.[Calc_RefInvAmt],
   T1.[Calc_RefInvNum],
   T1.[Calc_SalesPerson],
   T1.[Calc_SalesTerms],
   T1.[Calc_SEBankRef],
   T1.[Calc_ShipDate],
   T1.[Calc_ShipTo],
   T1.[Calc_ShipToAddressList],
   T1.[Calc_ShipToContactName],
   T1.[Calc_ShipVia],
   T1.[Calc_ShpConNum],
   T1.[Calc_SoldToAddressList],
   T1.[Calc_SubTotal],
   T1.[Calc_TaxMethod],
   T1.[Calc_vDocPayAmounts],
   T1.[Calc_VoucherString],
   T1.[Calc_Voucher - String] as Calc_Voucher_String,
   T1.[Calc_vPayAmounts],
   T1.[Calc_vPayDates],
   T1.[CardType_Description],
   T1.[CurrencyCode_CurrDesc],
   T1.[CurrencyCode_CurrencyID],
   T1.[CurrencyCode_CurrName],
   T1.[CurrencyCode_CurrSymbol],
   T1.[CurrencyCode_DocumentDesc],
   T1.[Customer_BTName],
   T1.[Customer_CustID],
   T1.[Customer_EstDate],
   T1.[Customer_LegalName],
   T1.[Customer_Name],
   T1.[Customer_TradingPartnerName],
   T1.[FOB_Description],
   T1.[JournalCode_JrnlDescription],
   T1.[OrderNum_CardMemberName],
   T1.[OrderNum_CurrencyCode],
   T1.[OrderNum_OrderDate],
   T1.[Plant_Name],
   T1.[TermsCode_Description],
   T1.[TermsCode_NumberOfPayments],
   T1.[TermsCode_TermsCode],
   T1.[TranDocType_Description],
   T1.[Customer_EmailInvcs_c],
   T1.[Customer_FaxInvcs_c],
   T2.[DocInMiscAmt],
   T2.[IncomeTaxCode],
   T2.[InMiscAmt],
   T2.[MiscAmt],
   T2.[OrgInvcLine],
   T2.[OrgInvcSeq],
   T2.[Percentage],
   T2.[Rpt1InMiscAmt],
   T2.[Rpt1MiscAmt],
   T2.[Rpt2InMiscAmt],
   T2.[Rpt2MiscAmt],
   T2.[Rpt3InMiscAmt],
   T2.[Rpt3MiscAmt],
   T2.[Type],
   T2.[Calc_ChargeDesc],
   T2.[InvoiceNum_CardMemberName],
   T2.[MiscCode_Description],
   T2.[TaxCatID_Description],
   T3.[AllocDepECAcqSeq],
   T3.[AllocDepInvcLine],
   T3.[AllocDepInvcNum],
   T3.[AllocDepRateCode],
   T3.[AllocDepTaxBal],
   T3.[ApplyConfirmationDate],
   T3.[CollectionType],
   T3.[ConfirmationDate],
   T3.[DedTaxAmt],
   T3.[DefTaxableAmt],
   T3.[DefTaxAmt],
   T3.[DefTaxDate],
   T3.[DocAllocTaxBal],
   T3.[DocDedTaxAmt],
   T3.[DocDefTaxableAmt],
   T3.[DocDefTaxAmt],
   T3.[DocFixedAmount],
   T3.[DocReportableAmt],
   T3.[DocTaxableAmt],
   T3.[DocTaxAmt],
   T3.[DocTaxAmtVar],
   T3.[ECAcquisitionSeq],
   T3.[ExemptPercent],
   T3.[ExemptType],
   T3.[FixedAmount],
   T3.[ManAdd],
   T3.[MovementNum],
   T3.[Percent],
   T3.[RateCode],
   T3.[RateTextCode],
   T3.[ResolutionDate],
   T3.[ResolutionNum],
   T3.[ReverseByInvoiceNum],
   T3.[ReverseCharge],
   T3.[Rpt1AllocDepTaxBal],
   T3.[Rpt1DedTaxAmt],
   T3.[Rpt1DefTaxableAmt],
   T3.[Rpt1DefTaxAmt],
   T3.[Rpt1FixedAmount],
   T3.[Rpt1ReportableAmt],
   T3.[Rpt1TaxableAmt],
   T3.[Rpt1TaxAmt],
   T3.[Rpt1TaxAmtVar],
   T3.[Rpt2AllocDepTaxBal],
   T3.[Rpt2DedTaxAmt],
   T3.[Rpt2DefTaxableAmt],
   T3.[Rpt2DefTaxAmt],
   T3.[Rpt2FixedAmount],
   T3.[Rpt2ReportableAmt],
   T3.[Rpt2TaxableAmt],
   T3.[Rpt2TaxAmt],
   T3.[Rpt2TaxAmtVar],
   T3.[Rpt3AllocDepTaxBal],
   T3.[Rpt3DedTaxAmt],
   T3.[Rpt3DefTaxableAmt],
   T3.[Rpt3DefTaxAmt],
   T3.[Rpt3FixedAmount],
   T3.[Rpt3ReportableAmt],
   T3.[Rpt3TaxableAmt],
   T3.[Rpt3TaxAmt],
   T3.[Rpt3TaxAmtVar],
   T3.[STPProcessed],
   T3.[TaxableAmt],
   T3.[TaxAmtVar],
   T3.[TaxCode],
   T3.[TaxConfirm],
   T3.[TaxFuture],
   T3.[TaxReverseDate],
   T3.[TextCode],
   T3.[Timing],
   T3.[Calc_BaseTaxableAmtTotal],
   T3.[Calc_BaseTaxAmtTotal],
   T3.[Calc_LegalText],
   T3.[Calc_RateLegalText],
   T3.[Calc_TaxableAmtTotal],
   T3.[Calc_TaxDesc],
   T3.[SalesTaxDesc_Description],
   T5.[Address1],
   T5.[Address2],
   T5.[Address3],
   T5.[AutoBankAdjustment],
   T5.[AutoBankTransferCrossCurr],
   T5.[AutoBankTransferSameCurr],
   T5.[AutoCashMovement],
   T5.[AutoCustBalanceReceipt],
   T5.[AutoCustBalanceReceiptApplyAll],
   T5.[AutoInvoicePayment],
   T5.[AutoMatchStatement],
   T5.[AutoOnAccountReceipt],
   T5.[AutoRcgAPRefNum],
   T5.[AutoRcgAPSupplier],
   T5.[AutoRcgAPTranDate],
   T5.[AutoRcgARCustomer],
   T5.[AutoRcgARRefNum],
   T5.[AutoRcgARTranDate],
   T5.[AutoRcgUnknownTran],
   T5.[AutoRecDocuments],
   T5.[AutoRetrieve],
   T5.[AutoReverse],
   T5.[AutoStatementImport],
   T5.[BankAcctID],
   T5.[BankBranchCode],
   T5.[BankCustNum],
   T5.[BankName],
   T5.[BankRoutingNum],
   T5.[BankTranfAccountType],
   T5.[BankType],
   T5.[CHDTAID],
   T5.[CheckingAccount],
   T5.[CHISRPartyID],
   T5.[City],
   T5.[CNSellerAddress],
   T5.[CNSellerBankName],
   T5.[COIsOneTimeBankAcct],
   T5.[ConsInvPmt],
   T5.[COOneTimeID],
   T5.[CountryNum],
   T5.[CreditorID],
   T5.[EFTHeadUID],
   T5.[FilterByLine],
   T5.[InvPerCheckStub],
   T5.[JPBankName],
   T5.[JPBranchName],
   T5.[LName],
   T5.[MatchTolerance],
   T5.[MsgIDCounter],
   T5.[MXSATCode],
   T5.[MXSATNameFull],
   T5.[MXSATNameShort],
   T5.[ParamCode],
   T5.[PayerRef],
   T5.[PayrollCheckingAccount],
   T5.[PeriodThreshold],
   T5.[POBankAcctNum],
   T5.[PostalCode],
   T5.[PRAlignTax],
   T5.[PreprintedCheckNum],
   T5.[PRLinePerPRCheck],
   T5.[PRPreprintedCheckNumber],
   T5.[RBankNum],
   T5.[RBranchNum],
   T5.[RecBalFiscalPeriod],
   T5.[RecBalFiscalYear],
   T5.[RecBalFiscalYearSuffix],
   T5.[ReconcileOtherBalances],
   T5.[RevalueUseRecBal],
   T5.[State],
   T5.[TranTemplateID],
   T5.[Calc_InvoiceNum],
   T5.[BankBranchCodeDesc_BankBranchCode],
   T5.[BankBranchCodeDesc_Description],
   T6.[AcctRefNumber],
   T6.[AcrossNatAcc],
   T6.[AddlHdlgFlag],
   T6.[AddressVal],
   T6.[AEPLOQType],
   T6.[AGAFIPResponsibilityCode],
   T6.[AGBillToProvinceCode],
   T6.[AGGrossIncomeTaxID],
   T6.[AGIDDocTypeCode],
   T6.[AGIDDocumentNumber],
   T6.[AGProvinceCode],
   T6.[AllowAltBillTo],
   T6.[AllowAsAltRemitTo],
   T6.[AllowOTS],
   T6.[AllowShipTo3],
   T6.[AnnualRevenue],
   T6.[ApplyChrg],
   T6.[ARInvoiceAdjITCode],
   T6.[ARInvoiceITCode],
   T6.[BTFaxNum],
   T6.[BTName],
   T6.[BusinessCust],
   T6.[CertOfOrigin],
   T6.[ChargeCode],
   T6.[CheckConfirmCapPromise],
   T6.[CheckDateCapPromise],
   T6.[CheckUpdateCapPromise],
   T6.[ChrgAmount],
   T6.[COIsOneTimeCust],
   T6.[Collections],
   T6.[CollectionsDate],
   T6.[CommercialInvoice],
   T6.[CreditCardOrder],
   T6.[CreditMemoITCode],
   T6.[CSR],
   T6.[CustID],
   T6.[CustPartOpts],
   T6.[CustPricingSchema],
   T6.[DateCollectionPosted],
   T6.[DefaultInvoicestyle],
   T6.[DefaultLOQstyle],
   T6.[DefaultOrderAcknowledgement],
   T6.[DefaultOversPricing],
   T6.[DefaultPackSlip],
   T6.[DeferredRev],
   T6.[DeliveryConf],
   T6.[DeliveryType],
   T6.[DemandCapPromiseAction],
   T6.[DemandCapPromiseDate],
   T6.[DemandCapPromiseUpdate],
   T6.[DemandCheckCfgAction],
   T6.[DemandCheckConfig],
   T6.[DemandCheckCUMM],
   T6.[DemandCheckCUMMAction],
   T6.[DemandCheckForPart],
   T6.[DemandCheckForPartAction],
   T6.[DemandCheckForRev],
   T6.[DemandCheckForRevAction],
   T6.[DemandCheckForRunOutPart],
   T6.[DemandCheckForRunOutPartAction],
   T6.[DemandCloseNoMatch],
   T6.[DemandCloseRejSkd],
   T6.[DemandPricing],
   T6.[DemandSplitSched],
   T6.[DEOrgType],
   T6.[DirectDebiting],
   T6.[DmdCheckPartialShip],
   T6.[DmdCheckShipAction],
   T6.[DueDateCriteria],
   T6.[EAddress],
   T6.[ECCType],
   T6.[EInvCompanyIDAttr],
   T6.[EMailAddress],
   T6.[EntityUseCode],
   T6.[ERSOrder],
   T6.[ETCAddrChg],
   T6.[ExcFromVal],
   T6.[ExternalCRMCustomerID],
   T6.[ExternalCRMCustomerType],
   T6.[ExternalCRMLastSync],
   T6.[ExternalCRMSyncRequired],
   T6.[FaxNum],
   T6.[FederalID],
   T6.[FFAddress1],
   T6.[FFAddress2],
   T6.[FFAddress3],
   T6.[FFCity],
   T6.[FFCompName],
   T6.[FFContact],
   T6.[FFCountry],
   T6.[FFCountryNum],
   T6.[FFID],
   T6.[FFPhoneNum],
   T6.[FFState],
   T6.[FFZip],
   T6.[GlbNACreditIsShare],
   T6.[GlbNACreditSharedPrc],
   T6.[GlbNAParentCreditIsUsed],
   T6.[GlbNAParentCreditPrc],
   T6.[HasBank],
   T6.[INCSTNumber],
   T6.[IndividualPackIDs],
   T6.[Industry],
   T6.[INPANNumber],
   T6.[IntrntlShip],
   T6.[InvcOrderCmpDflt],
   T6.[InvPerPackLine],
   T6.[LegalName],
   T6.[LOQBookCaFinishing],
   T6.[LOQBookCapaper],
   T6.[LOQBookCaPress],
   T6.[LOQBookCatPlates],
   T6.[LOQBookPCFinishing],
   T6.[LOQBookPCPaper],
   T6.[LOQBookPCPlates],
   T6.[LOQBookPCPress],
   T6.[LOQPrepressStyle],
   T6.[LOQVariations],
   T6.[ManagedVendID],
   T6.[ManagedVendNum],
   T6.[MiscCashRecITCode],
   T6.[MXMunicipio],
   T6.[MYIndustryCode],
   T6.[NACreditIsShare],
   T6.[NACreditPreferenceList],
   T6.[NACreditSharedPrc],
   T6.[Name],
   T6.[NAParentCreditIsUsed],
   T6.[NAParentCreditPrc],
   T6.[NARlsClassCode],
   T6.[NotifyEMail],
   T6.[NotifyFlag],
   T6.[NumberOfEmployees],
   T6.[OrderHoldForReview],
   T6.[OrgRegCode],
   T6.[OTSmartString],
   T6.[OTSSaveAs],
   T6.[OurBankCode],
   T6.[OverrideRlsClass],
   T6.[OversPct],
   T6.[Ownership],
   T6.[PBTerms],
   T6.[PECollectionAgent],
   T6.[PEDocumentID],
   T6.[PEGoodsContributor],
   T6.[PEIdentityDocType],
   T6.[PENoAddress],
   T6.[PENotFound],
   T6.[PeriodicBilling],
   T6.[PEWithholdAgent],
   T6.[PreferredBank],
   T6.[PriceTolerance],
   T6.[RACode],
   T6.[Rating],
   T6.[RebateForm],
   T6.[RebateVendorNum],
   T6.[RefNotes],
   T6.[RegistrationCode],
   T6.[ReminderCode],
   T6.[ResaleID],
   T6.[ResDelivery],
   T6.[ReservePriorityCode],
   T6.[ShipExprtDeclartn],
   T6.[ShipToTerrList],
   T6.[SyncToExternalCRM],
   T6.[TaxMethod],
   T6.[TaxRegReason],
   T6.[TaxRoundRule],
   T6.[THBranchID],
   T6.[ThirdPLCust],
   T6.[TickerLocation],
   T6.[TickerSymbol],
   T6.[TradingPartnerName],
   T6.[UndersPct],
   T6.[UPSQuantumView],
   T6.[UPSQVEmailType],
   T6.[UPSQVMemo],
   T6.[UPSQVShipFromName],
   T6.[ValidPayer],
   T6.[ValidShipTo],
   T6.[ValidSoldTo],
   T6.[Variations],
   T6.[WIApplication],
   T6.[WICustomer],
   T6.[WIShippingCosts],
   T6.[ASI_c],
   T6.[ASINum_c],
   T6.[BTEmail_c],
   T6.[ConvenLoc_c],
   T6.[Convention_c],
   T6.[CreditHold_c],
   T6.[EmailInvcs_c],
   T6.[EmailOrderAcks_c],
   T6.[FaxInvcs_c],
   T6.[FaxOrderAcks_c],
   T6.[FrtAcct_c],
   T6.[Incorporated_c],
   T6.[Internet_c],
   T6.[PPAI_c],
   T6.[Referral_c],
   T6.[ReferredBy_c],
   T6.[SAGE_c],
   T6.[SamplesOnAll_c],
   T6.[SamplesOnNew_c],
   T6.[Calc_MXAddress],
   T6.[Calc_RptUserID],
   T6.[AGAFIPResponsibility_Description],
   T6.[Currency_CurrDesc],
   T6.[Currency_CurrName],
   T6.[Currency_CurrSymbol],
   T6.[Currency_DocumentDesc],
   T6.[CustGrup_GroupDesc],
   T6.[GlobalCurrency_CurrDesc],
   T6.[GlobalCurrency_CurrName],
   T6.[GlobalCurrency_CurrSymbol],
   T6.[GlobalCurrency_DocumentDesc],
   T6.[Language_Description],
   T6.[SalesRep_Name],
   T6.[ShipVia_Description],
   T6.[ShipVia_WebDesc],
   T6.[TA_TaxAuthorityDescription],
   T6.[TaxRegion_Description],
   T6.[Terms_Description],
   T6.[Territory_TerritoryDesc],
   T7.[ABTUID],
   T7.[AdvanceBillCredit],
   T7.[AssetNum],
   T7.[BTCustNum],
   T7.[CallLine],
   T7.[ChargeDefRev],
   T7.[ChargeReclass],
   T7.[CorrectionDtl],
   T7.[CustCostCenter],
   T7.[DEDenomination],
   T7.[DeferredOnly],
   T7.[DeferredPercent],
   T7.[DeferredRevAmt],
   T7.[DefRevEndDate],
   T7.[DefRevPosted],
   T7.[DefRevStart],
   T7.[DEInternationalSecuritiesID],
   T7.[DEIsInvestment],
   T7.[DEIsSecurityFinancialDerivative],
   T7.[DEIsServices],
   T7.[DEPayStatCode],
   T7.[Discount],
   T7.[DisposalNum],
   T7.[DocAdvanceBillCredit],
   T7.[DocDeferredRevAmt],
   T7.[DocDiscount],
   T7.[DocDspWithholdAmt],
   T7.[DocExtPrice],
   T7.[DocInAdvanceBillCredit],
   T7.[DocInDiscount],
   T7.[DocInExtPrice],
   T7.[DocInListPrice],
   T7.[DocInOrdBasedPrice],
   T7.[DocInTotalMiscChrg],
   T7.[DocInUnitPrice],
   T7.[DockingStation],
   T7.[DocMXUnitPrice],
   T7.[DocUnitPrice],
   T7.[DropShipPackLine],
   T7.[DropShipPackSlip],
   T7.[DropShipPONum],
   T7.[DspWithholdAmt],
   T7.[ExtPrice],
   T7.[FinChargeCode],
   T7.[GetDfltTaxIds],
   T7.[InAdvanceBillCredit],
   T7.[InDiscount],
   T7.[InExtPrice],
   T7.[InListPrice],
   T7.[InOrdBasedPrice],
   T7.[InTotalMiscChrg],
   T7.[InUnitPrice],
   T7.[InvoiceLineRef],
   T7.[LineDesc],
   T7.[LinkedCurrencyCode],
   T7.[LinkedInvcUnitPrice],
   T7.[LotNum],
   T7.[MXSellingShipQty],
   T7.[MXUnitPrice],
   T7.[OrderLine],
   T7.[OTSAddress1],
   T7.[OTSAddress2],
   T7.[OTSAddress3],
   T7.[OTSCity],
   T7.[OTSContact],
   T7.[OTSCountryNum],
   T7.[OTSFaxNum],
   T7.[OTSName],
   T7.[OTSPhoneNum],
   T7.[OTSResaleID],
   T7.[OTSState],
   T7.[OTSTaxRegionCode],
   T7.[OTSZIP],
   T7.[OverrideReverseCharge],
   T7.[PackLine],
   T7.[PackNum],
   T7.[PartiallyDefer],
   T7.[PartNum],
   T7.[PBInvoiceLine],
   T7.[PBLineType],
   T7.[PEBOEHeadNum],
   T7.[PhaseID],
   T7.[Plant],
   T7.[POLine],
   T7.[PricePerCode],
   T7.[RADtlID],
   T7.[RAID],
   T7.[Reclass],
   T7.[ReclassCodeID],
   T7.[ReclassComments],
   T7.[Reclassified],
   T7.[ReclassReasonCode],
   T7.[RenewalNbr],
   T7.[RevChargeApplied],
   T7.[RevChargeMethod],
   T7.[Rpt1AdvanceBillCredit],
   T7.[Rpt1AdvGainLoss],
   T7.[Rpt1DeferredRevAmt],
   T7.[Rpt1Discount],
   T7.[Rpt1DspWithholdAmt],
   T7.[Rpt1ExtPrice],
   T7.[Rpt1InAdvanceBillCredit],
   T7.[Rpt1InDiscount],
   T7.[Rpt1InExtPrice],
   T7.[Rpt1InListPrice],
   T7.[Rpt1InOrdBasedPrice],
   T7.[Rpt1InTotalMiscChrg],
   T7.[Rpt1InUnitPrice],
   T7.[Rpt1ListPrice],
   T7.[Rpt1MXUnitPrice],
   T7.[Rpt1OrdBasedPrice],
   T7.[Rpt1TotalMiscChrg],
   T7.[Rpt1UnitPrice],
   T7.[Rpt2AdvanceBillCredit],
   T7.[Rpt2AdvGainLoss],
   T7.[Rpt2DeferredRevAmt],
   T7.[Rpt2Discount],
   T7.[Rpt2DspWithholdAmt],
   T7.[Rpt2ExtPrice],
   T7.[Rpt2InAdvanceBillCredit],
   T7.[Rpt2InDiscount],
   T7.[Rpt2InExtPrice],
   T7.[Rpt2InListPrice],
   T7.[Rpt2InOrdBasedPrice],
   T7.[Rpt2InTotalMiscChrg],
   T7.[Rpt2InUnitPrice],
   T7.[Rpt2ListPrice],
   T7.[Rpt2MXUnitPrice],
   T7.[Rpt2OrdBasedPrice],
   T7.[Rpt2TotalMiscChrg],
   T7.[Rpt2UnitPrice],
   T7.[Rpt3AdvanceBillCredit],
   T7.[Rpt3AdvGainLoss],
   T7.[Rpt3DeferredRevAmt],
   T7.[Rpt3Discount],
   T7.[Rpt3DspWithholdAmt],
   T7.[Rpt3ExtPrice],
   T7.[Rpt3InAdvanceBillCredit],
   T7.[Rpt3InDiscount],
   T7.[Rpt3InExtPrice],
   T7.[Rpt3InListPrice],
   T7.[Rpt3InOrdBasedPrice],
   T7.[Rpt3InTotalMiscChrg],
   T7.[Rpt3InUnitPrice],
   T7.[Rpt3ListPrice],
   T7.[Rpt3MXUnitPrice],
   T7.[Rpt3OrdBasedPrice],
   T7.[Rpt3TotalMiscChrg],
   T7.[Rpt3UnitPrice],
   T7.[SalesUM],
   T7.[SellingFactor],
   T7.[SellingFactorDirection],
   T7.[SellingOrderQty],
   T7.[SellingShipQty],
   T7.[ShipToCustNum],
   T7.[TaxConnectCalc],
   T7.[UnitPrice],
   T7.[UseOTS],
   T7.[WarehouseCode],
   T7.[XPartNum],
   T7.[XRevisionNum],
   T7.[Calc_ActDate],
   T7.[Calc_ActivityAmount],
   T7.[Calc_ActivityUnit],
   T7.[Calc_BackOrdQty],
   T7.[Calc_BaseExtPrice],
   T7.[Calc_BdnCd],
   T7.[Calc_BdnPrc],
   T7.[Calc_BdnSetDesc],
   T7.[Calc_BdnSetID],
   T7.[Calc_BillSchedID],
   T7.[Calc_BillSchedIDDesc],
   T7.[Calc_CalcExtPrice],
   T7.[Calc_CalcUnitPrice],
   T7.[Calc_ChargeRate],
   T7.[Calc_ContComment],
   T7.[Calc_CostPlusPrc],
   T7.[Calc_CurrentHours],
   T7.[Calc_DocActivityAmount],
   T7.[Calc_DocLineTotal],
   T7.[Calc_DocLineTotalDisc],
   T7.[Calc_DocUnitPriceDisc],
   T7.[Calc_Duration],
   T7.[Calc_ExtPrice],
   T7.[Calc_FeeCharge],
   T7.[Calc_GetNextLegalNum],
   T7.[Calc_InvcComment],
   T7.[Calc_InvoiceDisplayLine],
   T7.[Calc_InvoiceLine],
   T7.[Calc_IsBlank],
   T7.[Calc_IsKitParent],
   T7.[Calc_IstAmt],
   T7.[Calc_IstBdrXng],
   T7.[Calc_IstCmdCd],
   T7.[Calc_IstCntCd],
   T7.[Calc_IstCur],
   T7.[Calc_IstDesc],
   T7.[Calc_IstFlow],
   T7.[Calc_IstFlowSp],
   T7.[Calc_IstFOB],
   T7.[Calc_IstInvcLn],
   T7.[Calc_IstInvcNum],
   T7.[Calc_IstISShpVia],
   T7.[Calc_IstMemoFlg],
   T7.[Calc_IstPeriod],
   T7.[Calc_IstPosted],
   T7.[Calc_IstShpVia],
   T7.[Calc_IstSrcMod],
   T7.[Calc_IstSuppUnts],
   T7.[Calc_IstTrms],
   T7.[Calc_IstTrnTyp],
   T7.[Calc_IstVndNum],
   T7.[Calc_IstWeight],
   T7.[Calc_JobNumber],
   T7.[Calc_KitParentLine],
   T7.[Calc_LabDur],
   T7.[Calc_LabMod],
   T7.[Calc_Labor],
   T7.[Calc_LineDesc],
   T7.[Calc_LineSoldToAddressList],
   T7.[Calc_LotNumber],
   T7.[Calc_MarkUpAmt],
   T7.[Calc_MatDur],
   T7.[Calc_Mate],
   T7.[Calc_MatMod],
   T7.[Calc_MeasuredWorkID],
   T7.[Calc_Misc],
   T7.[Calc_MiscDur],
   T7.[Calc_MiscMod],
   T7.[Calc_Modifier],
   T7.[Calc_MsWrkIDDesc],
   T7.[Calc_NextLegalNumID],
   T7.[Calc_NextLinePBType],
   T7.[Calc_NumLineByInv],
   T7.[Calc_OurJobQty],
   T7.[Calc_OurJobShippedQty],
   T7.[Calc_OurReqQty],
   T7.[Calc_OurStockQty],
   T7.[Calc_OurStockShippedQty],
   T7.[Calc_ParentWrkSchID],
   T7.[Calc_PBFeeCharge],
   T7.[Calc_PBMarkUp],
   T7.[Calc_POLine],
   T7.[Calc_ponum],
   T7.[Calc_PrevLinePBType],
   T7.[Calc_PricePerUnit],
   T7.[Calc_PSLegalNum],
   T7.[Calc_PtWrkSchIDDesc],
   T7.[Calc_QtyOrdrd],
   T7.[Calc_Reference],
   T7.[Calc_RetentionAmt],
   T7.[Calc_RetentionPcnt],
   T7.[Calc_RetentionPrcnt],
   T7.[Calc_SellingJobQty],
   T7.[Calc_SellingJobShippedQty],
   T7.[Calc_SellingStockQty],
   T7.[Calc_SellingStockShipQty],
   T7.[Calc_SerialNumber],
   T7.[Calc_ShipComment],
   T7.[Calc_ShipLog],
   T7.[Calc_ShipToShipToFax],
   T7.[Calc_ShipToShipToNum],
   T7.[Calc_ShipToShipVia],
   T7.[Calc_StateTaxID],
   T7.[Calc_UnitPrice],
   T7.[Calc_UOMDescription],
   T7.[Calc_WarrComment],
   T7.[Calc_WarrDesc],
   T7.[Calc_WhseCode],
   T7.[CallCode_CallDescription],
   T7.[ContractCode_ContractDescription],
   T7.[CustCnt_CorpName],
   T7.[CustCnt_FaxNum],
   T7.[CustCnt_FirstName],
   T7.[CustCnt_LastName],
   T7.[CustCnt_MiddleName],
   T7.[CustCnt_Name],
   T7.[CustCnt_PhoneNum],
   T7.[OrderLine_DisplaySeq],
   T7.[OrderLine_KitFlag],
   T7.[OrderLine_KitParentLine],
   T7.[OrderLine_KitPrintCompsInv],
   T7.[OrderLine_KitPrintCompsPS],
   T7.[OrderLine_KitQtyPer],
   T7.[OrderLine_KitShipComplete],
   T7.[OrderLine_KitsLoaded],
   T7.[OrderLine_LineDesc],
   T7.[OrderLine_OrderLine],
   T7.[OrderLine_OrderNum],
   T7.[PartNum_MfgComment],
   T7.[PartNum_NetVolume],
   T7.[PartNum_NetWeight],
   T7.[PartNum_PartDescription],
   T7.[PartNum_PurComment],
   T7.[PartNum_TrackDimension],
   T7.[PartNum_TrackLots],
   T7.[PartNum_TrackSerialNum],
   T7.[PartNum_UPCCode1],
   T7.[PartNum_UPCCode2],
   T7.[PartNum_UPCCode3],
   T7.[ProdCode_Description],
   T7.[ProjectID_Description],
   T7.[SalesCatID_Description],
   T7.[SalesUM_UOMSymbol],
   T7.[ShipViaCode_Description],
   T7.[ShipViaCode_WebDesc],
   T7.[OrderLine_JobID_c],
   T8.[CallComment],
   T8.[CallNum],
   T8.[CallQty],
   T8.[CommentText],
   T8.[IssueTopicID1],
   T8.[IssueTopicID10],
   T8.[IssueTopicID2],
   T8.[IssueTopicID3],
   T8.[IssueTopicID4],
   T8.[IssueTopicID5],
   T8.[IssueTopicID6],
   T8.[IssueTopicID7],
   T8.[IssueTopicID8],
   T8.[IssueTopicID9],
   T8.[IssueTopics],
   T8.[PartDescription],
   T8.[ProbReasonCode],
   T8.[PurPoint],
   T8.[ResTopicID1],
   T8.[ResTopicID10],
   T8.[ResTopicID2],
   T8.[ResTopicID3],
   T8.[ResTopicID4],
   T8.[ResTopicID5],
   T8.[ResTopicID6],
   T8.[ResTopicID7],
   T8.[ResTopicID8],
   T8.[ResTopicID9],
   T8.[ResTopics],
   T8.[Rpt1TotBillableMisc],
   T8.[Rpt1TotBillLabor],
   T8.[Rpt1TotBillMaterial],
   T8.[Rpt1TotBillSubCont],
   T8.[Rpt1TotEstLabor],
   T8.[Rpt1TotEstMaterial],
   T8.[Rpt1TotEstMisc],
   T8.[Rpt1TotEstSubCont],
   T8.[Rpt1TotLabor],
   T8.[Rpt1TotMaterial],
   T8.[Rpt1TotMisc],
   T8.[Rpt1TotSubCont],
   T8.[Rpt2TotBillableMisc],
   T8.[Rpt2TotBillLabor],
   T8.[Rpt2TotBillMaterial],
   T8.[Rpt2TotBillSubCont],
   T8.[Rpt2TotEstLabor],
   T8.[Rpt2TotEstMaterial],
   T8.[Rpt2TotEstMisc],
   T8.[Rpt2TotEstSubCont],
   T8.[Rpt2TotLabor],
   T8.[Rpt2TotMaterial],
   T8.[Rpt2TotMisc],
   T8.[Rpt2TotSubCont],
   T8.[Rpt3TotBillableMisc],
   T8.[Rpt3TotBillLabor],
   T8.[Rpt3TotBillMaterial],
   T8.[Rpt3TotBillSubCont],
   T8.[Rpt3TotEstLabor],
   T8.[Rpt3TotEstMaterial],
   T8.[Rpt3TotEstMisc],
   T8.[Rpt3TotEstSubCont],
   T8.[Rpt3TotLabor],
   T8.[Rpt3TotMaterial],
   T8.[Rpt3TotMisc],
   T8.[Rpt3TotSubCont],
   T8.[VendorNum],
   T8.[Calc_CProb],
   T8.[Calc_fCallLine],
   T8.[Calc_fCallNum],
   T8.[CallNum_CallNum],
   T8.[JobNum_PartDescription],
   T8.[PackNum_ShipStatus],
   T8.[WarrantyCode_WarrDescription],
   T9.[ResReasonCode],
   T9.[Rpt1BillableUnitPrice],
   T9.[Rpt1UnitCost],
   T9.[Rpt2BillableUnitPrice],
   T9.[Rpt2UnitCost],
   T9.[Rpt3BillableUnitPrice],
   T9.[Rpt3UnitCost],
   T9.[Calc_AsmSeq],
   T9.[Calc_MatNum],
   T9.[Calc_MtBillPrice],
   T9.[Calc_MtCount],
   T9.[Calc_MtExtPrice],
   T9.[Calc_MtLinedesc],
   T9.[Calc_MtPaNum],
   T9.[Calc_MtQty],
   T9.[Calc_MtRevNum],
   T10.[ActLabHours],
   T10.[BillableLaborRate],
   T10.[Rpt1BillableLaborRate],
   T10.[Rpt1LaborRate],
   T10.[Rpt2BillableLaborRate],
   T10.[Rpt2LaborRate],
   T10.[Rpt3BillableLaborRate],
   T10.[Rpt3LaborRate],
   T10.[ServCode],
   T10.[ServNum],
   T10.[Calc_ServActHr],
   T10.[Calc_ServDocRat],
   T10.[Calc_ServExtPrice],
   T10.[Calc_ServNum],
   T10.[CallLine_LineDesc],
   T10.[POLine_LineDesc],
   T10.[POLine_PartNum],
   T10.[POLine_VenPartNum],
   T10.[ServCode_ServDescription],
   T11.[BillEndDate],
   T11.[BillStartDate],
   T11.[ContractCode],
   T11.[ContractLine],
   T11.[ContractNum],
   T11.[ContractQty],
   T11.[DateInactivated],
   T11.[DateInvoiced],
   T11.[DocPricePerUnit],
   T11.[Inactive],
   T11.[Invoiced],
   T11.[PricePerUnit],
   T11.[Rpt1PricePerUnit],
   T11.[Rpt2PricePerUnit],
   T11.[Rpt3PricePerUnit],
   T11.[Calc_ContPrice],
   T12.[ChargeAmt],
   T12.[ChargePercent],
   T12.[DocChargeAmt],
   T12.[FromDate],
   T12.[LetterNum],
   T12.[Manual],
   T12.[ReminderPreview],
   T12.[Rpt1ChargeAmt],
   T12.[Rpt2ChargeAmt],
   T12.[Rpt3ChargeAmt],
   T12.[SourceInvoiceNum],
   T12.[ToDate] 
FROM
   InvcHead_" + Parameters ! TableGuid.Value + " T1 
   LEFT OUTER JOIN
      InvcMisc_" + Parameters ! TableGuid.Value + " T2 
      ON T1.Company = T2.Company 
      AND T1.InvoiceNum = T2.InvoiceNum 
   LEFT OUTER JOIN
      InvcTax_" + Parameters ! TableGuid.Value + " T3 
      ON T1.Company = T3.Company 
      AND T1.InvoiceNum = T3.InvoiceNum 
   LEFT OUTER JOIN
      RptLabels_" + Parameters ! TableGuid.Value + " T4 
      ON T1.RptLanguageID = T4.RptLanguageID 
   LEFT OUTER JOIN
      BankAcct_" + Parameters ! TableGuid.Value + " T5 
      ON T1.[Company] = T5.[Company] 
      AND T1.[OurBank] = T5.[BankAcctID] 
      AND T1.[InvoiceNum] = T5.[Calc_InvoiceNum] 
   LEFT OUTER JOIN
      Customer_" + Parameters ! TableGuid.Value + " T6 
      ON T1.[Company] = T6.[Company] 
      AND T1.[CustNum] = T6.[CustNum] 
      AND T1.[InvoiceNum] = T6.[Calc_InvoiceNum] 
   LEFT OUTER JOIN
      InvcDtl_" + Parameters ! TableGuid.Value + " T7 
      ON T1.[Company] = T7.[Company] 
      AND T1.[InvoiceNum] = T7.[InvoiceNum] 
   LEFT OUTER JOIN
      FSCallDt_" + Parameters ! TableGuid.Value + " T8 
      ON T7.[Company] = T8.[Company] 
      AND T7.[InvoiceLine] = T8.[Calc_InvoiceLine] 
      AND T7.[InvoiceNum] = T8.[Calc_InvoiceNum] 
   LEFT OUTER JOIN
      FSCallMt_" + Parameters ! TableGuid.Value + " T9 
      ON T8.[Company] = T9.[Company] 
      AND T8.[CallNum] = T9.[CallNum] 
      AND T8.[Calc_fCallLine] = T9.[Calc_fCallLine] 
      AND T8.[Calc_InvoiceLine] = T9.[Calc_InvoiceLine] 
      AND T8.[Calc_InvoiceNum] = T9.[Calc_InvoiceNum] 
   LEFT OUTER JOIN
      FSCallSv_" + Parameters ! TableGuid.Value + " T10 
      ON T8.[Company] = T10.[Company] 
      AND T8.[CallNum] = T10.[CallNum] 
      AND T8.[Calc_InvoiceLine] = T10.[Calc_InvoiceLine] 
      AND T8.[Calc_InvoiceNum] = T10.[Calc_InvoiceNum] 
   LEFT OUTER JOIN
      FSContDt_" + Parameters ! TableGuid.Value + " T11 
      ON T7.[Company] = T11.[Company] 
      AND T7.[InvoiceLine] = T11.[Calc_InvoiceLine] 
      AND T7.[InvoiceNum] = T11.[Calc_InvoiceNum] 
   LEFT OUTER JOIN
      InvcChrg_" + Parameters ! TableGuid.Value + " T12 
      ON T7.[Company] = T12.[Company] 
      AND T7.[InvoiceLine] = T12.[InvoiceLine] 
      AND T7.[InvoiceNum] = T12.[InvoiceNum] 
   LEFT OUTER JOIN
      InvcHeadDocPay_" + Parameters ! TableGuid.Value + " T13 
      ON T1.[Company] = T13.[Company] 
      AND T1.[InvoiceNum] = T13.[InvoiceNum]

Duplicate data is usually resolved by adding Group By (assuming you can’t figure out what the duplication is)
Why are you joining to RptLabels?

Its one that was built back in 2015 that is causing issues today. I didn’t add this one and am confused as well.

Looks like there is 4 fields it uses from the RPTLabel (not sure why) I’d start by removing that… seems silly. Then drop the query into MSSQL run it and see where you duplication is.
I mean there’s a LOT of joins there so it wouldn’t be un-usual to see multiple rows you may have to adjust your groupings in the report.

1 Like

Ok, so if its not a table in Epicor today, and its an old query, I can drop those and move forward. Wanted to make sure there wasn’t something I was missing.

RPT Labels is always available its part of the RDD but nobody uses that crap. It just causes heartache

1 Like

I’m thinking is from an older Epicor that was standard for its day for the ARForm_Misc Charges. And my predecessors probably adjusted it to fit our needs. Since we only sell to distributors, we never needed to see the TAX. However, we have started selling to a very select few end users and we have noticed the tax is duplicating. Anyway, I say it is a standard because it has Calc_XYZ that I can not look into and see what they were doing; No BAQ Designer ID to pull to look at.

@josecgomez I found the issue. It was the InvDtl was duplicating because it wasn’t constrained enough. It was bound on T1 for Company and InvoiceNum. I added a connection to T1 on OrderNum and then add connections to T3 on Company, InvoiceLine, and InvoiceNum. Now everything works perfectly.

1 Like