I want to make a crystal report like this in which the detail section there is item detail as well as the my expenses, and also the calculation is also there, instead in footer but these thing will be shown in three columns.
The stored procedure is good - I get all the thing in my Crystal Reports, but I am stuck in Crystal Reports settings:
Item || Expenses || Net amount
Banana 150 | Commission 10% | Item Total 600
Apple 150 | Fare 200 | Expenses total 230
Mango 300 | | Net 370
Stored procedure:
CREATE PROCEDURE [dbo].[one_complete_order]
@order_id INT
AS
BEGIN
SELECT DISTINCT
Our_orders.orderID,
Stock.itemname AS item,
Stock.qty AS [Orderd Qty],
Stock.status AS Qty,
Stock.price AS [Cost Price],
Stock.size AS [packing],
Our_orders.date,
vendor.Vendor_Name, vendor.Vendor_Address,
vendor.Contact, vendor.Vendor_Company,
Expenses.commission, Expenses.Karaya, Expenses.labour_pay,
Expenses.Munishi
FROM
Our_orders
JOIN
Stock ON Our_orders.orderID = Stock.orderID
JOIN
vendor ON vendor.VendorID = Our_orders.VendorID
JOIN
Expenses ON Our_orders.orderID = Expenses.orderID
WHERE
Our_orders.orderID = @order_id
ORDER BY
Our_orders.date DESC;
END
Since you have a different number of rows for Items, Expenses, and Net Amount I would recommend using Subreports for the Expenses and Net Amount. Allow all of your Items to print in the Details section, then insert two Subreports into the the Details section to the right of the fields for the Items data, spacing the subreports out so that they appear to be a second and third column within the details section.
You will need to determine which data field will link each Subreport to the main report. From looking at your SQL Stored Procedure I believe OrderID would be appropriate.
You can probably use the same SQL Stored Procedure as the data source for both of your subreports. When you create the Expenses Subreport, only use the data fields for Expenses in the Details section of the subreport, and do the same for the Net Amounts Subreport. It will be easier to line up the rows in your subreports with the main report if you suppress all sections in the subreports except the Details sections, and then edit the format of the sub reports to remove the default border line. That's up to you though really. :)