Click here to Skip to main content
15,883,883 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I made application for hospital.
My all input are done.
Payment receive window also done.
For receipt I have two tables
1. from where we can get test details.
2. from where we can get all other details.

Table 1 (from this I want to get only test details & test price)
CREATE TABLE [dbo].[tblReportData](
	[ReportId] [int] IDENTITY(1,1) NOT NULL,
	[PatientID] [int] NOT NULL,
	[TestId] [int] NOT NULL,
	[ProductID] [int] NOT NULL,
	[TestName] [nvarchar](100) NOT NULL,
	[TestPrice] [nvarchar](100) NULL,
	[ReferenceDr] [nvarchar](100) NOT NULL,
	[Remarks] [nvarchar](max) NULL,
	[Date] [date] NOT NULL,
	[EnteredBy] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_tblReportData] PRIMARY KEY CLUSTERED 


Table 2 (from this receiptid, patientid, date, patient name, refdr)

CREATE TABLE [dbo].[tblReceiptDetails](
	[ReceiptId] [bigint] IDENTITY(1,1) NOT NULL,
	[PatientID] [int] NULL,
	[PatientName] [nvarchar](200) NULL,
	[TestDone] [nvarchar](max) NULL,
	[TotalDue] [float] NULL,
	[ReceivedAmt] [float] NULL,
	[Discount] [float] NULL,
	[PendingAmt] [float] NULL,
	[PaymentType] [nvarchar](50) NULL,
	[PaymentStatus] [nvarchar](50) NULL,
	[Remark] [nvarchar](max) NULL,
	[Date] [date] NULL,
	[EnteredBy] [nvarchar](50) NULL,
 CONSTRAINT [PK_tblReceiptDetails] PRIMARY KEY CLUSTERED


Can someone please help me to get out of this?
Many thanks in advance.
I have done stored procedure for this but how can I put in software.
I am new in code.
Please help.

What I have tried:

I tried with Microsoft report viewer but no avail.
Posted
Updated 5-Jan-18 7:38am
v2

1 solution

I think you need to do following query to get ReportData correctly.


SQL
SELECT        tblReportData.TestName, tblReportData.TestPrice, tblReportData.ReferenceDr, tblReportData.Remarks, tblReportData.EnterBy, tblReceiptDetails.TestDone, tblReceiptDetails.PatientName, tblReceiptDetails.Remark
FROM            tblReceiptDetails INNER JOIN
                         tblReportData ON tblReceiptDetails.PatientID = tblReportData.PatientID


and for everything else just required PatientID and reverse it as given below.

SQL
SELECT        tblReportData.TestName, tblReportData.TestPrice, tblReportData.ReferenceDr, tblReportData.Remarks, tblReportData.EnterBy, tblReceiptDetails.PatientName, tblReportData.Date, tblReceiptDetails.PaymentStatus, 
                         tblReceiptDetails.PaymentType, tblReceiptDetails.ReceivedAmt, tblReceiptDetails.TotalDue, tblReceiptDetails.TestDone
FROM            tblReceiptDetails INNER JOIN
                         tblReportData ON tblReceiptDetails.PatientID = tblReportData.PatientID


I think best bet is use SQL Query designer and check with your test data and see what exactly you want to achieve.
 
Share this answer
 
Comments
sunil.shirke 29-Dec-17 12:08pm    
Thanks Ravi, but I want to print PDF receipt.
Could you please help me?
Thanks in advance.
Ravi Lodhiya 29-Dec-17 12:42pm    
Hi Sunil,

Just search iTextSharp library and I think there is Print Dialog with parameter might help you to print as PDF.

Regards,

Ravi

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900