msupply-foundation / open-msupply

Open mSupply represents our most recent advancement in the Logistics Management Information System (LMIS), expanding on more than two decades of development inherited from the well-established legacy of the original mSupply.
https://msupply.foundation/open-msupply/
Other
19 stars 12 forks source link

Excel reports: Prototype/Research HTML tables to Excel #2868

Open clemens-msupply opened 5 months ago

clemens-msupply commented 5 months ago

Requirements for this issue have been gathered in: https://github.com/msupply-foundation/open-msupply/issues/2059

Most of the details in this issue has been discussed in a group meeting (31/1/24).

Overall Idea:

Example HTML annotated with custom Excel attributes:

 <table border="1"
    data-excel-work-sheet="My optional worksheet name"
    data-excel-start-column="2"
    data-excel-start-row="1"
 >
  <tr>
    <th>Company</th>
    <th>Contact</th>
    <th>Country</th>
  </tr>
  <tr>
    <td>Alfreds Futterkiste</td>
    <td data-excel-type="string">Maria Anders</td>
    <td rowspan="2">Germany</td>
  </tr>
  <tr>
    <td colspan="2">Centro comercial Moctezuma</td>
  </tr>
  <tr>
    <td colspan="2" data-excel-colspan="3"></td>
    <td data-excel-formula="=SUMIF(C1:C1, &quot;Assignments&quot;,C[0]:C[0])">Formula result</td>
  </tr>
  <tr>
    <td colspan="2" data-excel-colspan="3"></td>
    <td ss:Formula="=SUMIF(C1:C1, &quot;Assignments&quot;,C[0]:C[0])">Formula result 2</td>
  </tr>
</table>

Open questions

TODOs

Job Code

OMS:REPT

DhanyaHerath commented 5 months ago

@clemens-msupply have updated with a jobcode! When you have a chance would you mind trying to estimate how long you think this work will take please?

clemens-msupply commented 5 months ago

The last point is a bit open-ended, so I will leave it out. For the first three points I would estimate 4-5 days.

craigdrown commented 4 months ago

For table pagination in HTML - for display we don't want it right? Or are you thinking of a table w 10K rows? Maybe we give a message and only send the Excel if too many rows? For printing, I'd expect users to print from Excel, but if they print from the UI then as long as we use tags on the header rows they'll repeat each page

clemens-msupply commented 4 months ago

Yes as far as I know this is as it already works for HTML, i.e. the table is displayed without pagination and when printed it is split onto the pages. Will test this again when implementing!

Regarding reports with many rows, this can indeed become a problem. The graphql endpoints have a hardcoded pagination limit, e.g. 5000 rows. If there are more data, we either need to be able to override this limit or implement pagination support for the report engine, i.e. do multiple queries till all rows are fetched...

Another solution would be to allow raw SQL for report. I summarized my thoughts on it in this issue: https://github.com/msupply-foundation/open-msupply/issues/2853

regotaina commented 3 months ago

Tested on V1.7.RC1

🧪 Testing

Setup

Tests

Tested with requisitions, stock takes, it works!

Screenshot 2024-03-12 at 5 27 48 PM