Generate Invoices as PDF from SQL data

which thread are on for SSRS to PDF stuff, I am confused. I see 2 threads

expressions are your friends in this scenario. in your stored procedures or some other metadata table, or metadata database with many tables, per customer, per x, you could create formatting rules. then on your report or better yet on your stored procedures you could leverage these metadata entries to format things based on xyz, however you define xyz?
For example, I created a report for our sys admin for Virtual Machines peformance stats. For virts that eat up a lot of resources I needed to mark them as red, medium as yellow and good virts as green.
in my sproc that pulls this data from vmware sql database, I set the colors in my stored proc and leveraged expressions to set the colors in my SSRS graphs
so expressions are the best things in some of these scenarios such as width etc, you can pre-define them globally or define them on customer etc. it is like the ecosystem you had created for your webkit only this time, it will be in sql server.

Thanks, I suppose that's quite like the HTML equivalent that I do:

<tr>
<th>Amount</th>
<td class="{AmountClass}">{AmountValue}</td></tr>

where I can output

[AmountClass] = CASE WHEN Amount < 0 THEN 'CreditClass' ELSE 'DebitClass' END

I know the issue of "Its all new and feels weird" comes in to play, but I like the manipulation to be at one end of the other (and I prefer SQL - its much easier to Deploy a change to an Sproc than any change to the APP - in terms of QA-effort, if nothing else, lots of risk of other DEV changes being included in an APP release, whereas I can DIFF my Sproc change against the Actual to check that there are no other bits that have been added) and also "highly visible" - I have the JQuery code that APPLIES an action to some Object in the page, at a location totally removed from the object, so looking at the object (in the source code) it is impossible to tell what Actions are, or are not, attached to it. Bit the same with me for Expressions that might be applied in a way that are not immediately obvious when looking at the report in the Designer.

Some other snags I've hit

I added a Parameter so that the Invoice Items was tied to the Header, but now I want to test some changes to the Invoice Item report I can't - because the parameter is missing. Maybe there is a way around that (to just test the invoice items report in isolation)

How do I add the Sub Totals to the Invoice Items sub-report?

I think that:

I want them to align in the Amount Column
I have three rows I want to add:

  • Sub total
  • Tax
  • Grant Total

I don't want SSRS to calculate them (they might have different rounding somehow to what is in my DB record)
(I could UNION them as "special" rows to my Invoice Items - that's probably what I would do using my own "stuff", so if that's the answer that's fine)

I want to keep-together those three rows - is that possible, or will it take another sub-report to achieve that? which will then need careful synchronisation with the Invoice Items sub-report to make sure the columns are in the same position (I guess that isn't a big deal? I can position them pixel-perfect exactly the same as the Amount column)

yes exactly! do your CASE stuff in sql proc and SSRS can leverage that. That is what I do. Otherwise you will have pretty fat expression that eventually become un-manageable (strabismus) :older_man:

SSRS has its quirkiness such as when you want to test something, dont forget to hit that refresh button! I do not like that either, that is something that should change, I agree.

Do most of your calculations in proc. Though SSRS is powerful, I try to limit it to just visualization of my data, I do not use it to do calculations and stuff (though it could do it nicely) By doing calcs in proc, you have control over it. Best not to do fancy stuff in sproc. Give SSRS the data and nothing but the pure data, then you can do all you want on the SSRS side of things.

Also this might be a good time to look into the benefits of having a datawarehouse, data mart, mini mart, data lake whatever. Flattened and calculated data sliced and diced to your own delight. Then all you do is feed this data to your SSRS.
We have a dedicated "BI" server in our cluster that has SSIS, SSRS, PowerBI Gateway Settings.Data is pushed on daily basis to Datawarehouse (or however often is your needs) then SSRS using sproc, very lightweight sproc because all the data has already been crunched into Dimensions and Facts. this way you save your OLTP server some headaches. hope this is not too much. Lordy, I think I got Kristenitus!

:slight_smile:

This particular usage needs to be real-time, but we do have (old codger, old nomenclature ...) an Enquiry Version, which is yesterday's data, used by enquiry users, does not change under-foot (as the post and phone calls are entered into the LIVE version they are THEN checked and therefore quite possibly entered wrongly / inconsistently for a short period).

Not curable I'm afraid ... but of course you now know that :slight_smile:

Subtotals exclusively for the Invoice Items sub-report?

Did you try to right click and select Add Sum?

Well there are two things here. I want some Total Totals at the bottom of the sub report. Because they much be mathematically the same as the ones in the DB I'm going to output them from the DB

Secondly, WITHIN the sub-report I want sub-totals at each page break (ideally a sub-total at the bottom of the page, and a carried-forwards at the top of the following page)

No ... I'll have a look at that, but you might have been answering my "Total total" at the bottom question, which I now want to use DB data for, rather than a local SUM within the report.