Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 19th, 2007, 02:29 AM
Registered User
 
Join Date: Sep 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to separate Multiple InvoiceNos of one Receipt

Hi ,
please tell me How to separate Multiple InvoiceNos of one ReceiptID by comma in storedprocedure.
I have Store procedure as like :-



USE [TestExample]
GO
ALTER Procedure [TestExample].[RptCashChequeReceiptVoucherHeaderSingle]

 @CompanyID NVARCHAR(36),
 @DivisionID NVARCHAR(36),
 @DepartmentID NVARCHAR(36),
 @ReceiptID NVARCHAR(36)

 AS


declare @CompanyCurrencySymb nvarchar(1)
declare @DHCurrencySymb nvarchar(1)
set @DHCurrencySymb=(select CurrenycySymbol from CurrencyTypes where
CompanyID =@CompanyID
AND DivisionID =@DivisionID
AND DepartmentID = @DepartmentID
and CurrencyId=(select CurrencyId from CurrencyTypes
where CompanyID =@CompanyID AND DivisionID =@DivisionID
AND DepartmentID = @DepartmentID and CurrencyId='DH'))

set @CompanyCurrencySymb=(select CurrenycySymbol from CurrencyTypes where
CompanyID =@CompanyID
AND DivisionID =@DivisionID
AND DepartmentID = @DepartmentID
and CurrencyId=(select CurrencyId from Companies
where CompanyID =@CompanyID AND DivisionID =@DivisionID
AND DepartmentID = @DepartmentID))

SELECT Distinct ReceiptsHeader.ReceiptID,
CASE
    WHEN ReceiptsHeader.ReceiptTypeID = 'Check' THEN
    ReceiptsHeader.CheckNumber
    ELSE
    'Cash'
END as ByCashOrChequeNo,
        ReceiptsHeader.Amount,
        ReceiptsHeader.ReceiptTypeID,
        ReceiptsHeader.CheckNumber,
        ReceiptsHeader.TransactionDate as ReceiptDate,
        CustomerInformation.CustomerName,
        ReceiptsDetail.DocumentNumber as InvoiceNumber,
        @CompanyCurrencySymb as CompanyCurrencySymb ,
        @DHCurrencySymb as DHCurrencySymb
FROM ReceiptsHeader Left OUTER JOIN ReceiptsDetail
ON ReceiptsHeader.CompanyID = ReceiptsDetail.CompanyID AND ReceiptsHeader.DivisionID = ReceiptsDetail.DivisionID
        AND ReceiptsHeader.DepartmentID =ReceiptsDetail.DepartmentID and ReceiptsHeader.ReceiptID = ReceiptsDetail.ReceiptID
        Left OUTER JOIN CustomerInformation ON ReceiptsHeader.CompanyID = CustomerInformation.CompanyID
        AND ReceiptsHeader.DivisionID = CustomerInformation.DivisionID AND ReceiptsHeader.DepartmentID = CustomerInformation.DepartmentID
        AND ReceiptsHeader.CustomerID = CustomerInformation.CustomerID
WHERE ReceiptsHeader.CompanyID = @CompanyID
        AND ReceiptsHeader.DivisionID = @DivisionID
        AND ReceiptsHeader.DepartmentID = @DepartmentID
        AND ReceiptsHeader.ReceiptID = @ReceiptID


O/p of this StoredProcedure is as:

AssetID AssetTypeID Cost Additions Disposal subtotal, Depreciation, NetBookValue GlTransactionDate
a001 Building Improvements 10000.00 4000.00 2000.00 12000.00 8000.00 4000.00 2007-10-12 00:00:00.000
a003 Residence Furn/Equipment 30000.00 5000.00 4000.00 31000.00 7000.00 24000.00 2007-10-08 14:18:36.000


But when i generate report for one ReceiptID having Multiple InvoiceNos, this code generate report for each invoiceNo. seperately.
I want one Receipt report having one receiptID and multiple invoice nos separated by comma(,).i.e like following report


                CASH/CHEQUE RECEIPT VOUCHER
                                         ReceiptID : 2026
                                         Date : 7/26/2007

   Received from Mr./ Messrs : Technical Services

           The Sum Of (Q.Rls): 456.0000

           By Cash/Cheque No.: Cash
        For............................................... .........
      MaterialDetails .................................................. ..
       Invoice No.: 2256,2040,5512,1045




Signature .................................................. .........





Rg2005





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to separate Multiple InvoiceNos of one RecID Rg2005 SQL Server 2005 0 October 19th, 2007 01:54 AM
printing a receipt abdrabaa C# 1 September 12th, 2007 03:22 AM
print data as receipt format abdrabaa C# 1 July 9th, 2007 04:45 AM
sequence number for online receipt preston2003 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 April 25th, 2005 02:02 AM
Return receipt Persits ASPEmail Haroldd Classic ASP Components 1 March 10th, 2004 11:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.