emreeren / SambaPOS-3

Touch Screen Restaurant POS
sambapos.com
469 stars 413 forks source link

Inventory Report Wrapping Long Lines #336

Open JohnSCS opened 11 years ago

JohnSCS commented 11 years ago

As per the picture, long lines are being wrapped. To help reduce this, can we have Unit & Qty right justified so the Inventory Name can use more than half the width of the page?

Basically, the Inventory Name is only allowed the Left half of the page, the Unit is in the middle and Quantity on the right hand side.

screenhunter_85 aug 12 12 16

emreeren commented 11 years ago

This is a table so changing alignment will have no effect. I can only define column widths as percents because of a shitty Microsoft bug that prevent us to use "auto" width columns. I tried using grids instead of tables. It solves the problem but it does not support column headers :)

https://connect.microsoft.com/VisualStudio/feedback/details/724483/the-width-of-tablecolumns-in-a-wpf-flowdocument-doesnt-work-with-non-star-widths

It looks like it won't be fixed on .net framework 4.5 so I have to find another solution.

JohnSCS commented 11 years ago

Can you do it by working out the percentage for each column by finding the maximum length in each field to find the ratio of column widths needed. And to ensure that the Unit & Quantity have enough space make them double.

For example Inventory Name - 60 chars Unit - 2 chars -> but we make it 4 Quantity - 2 chars -> but we make it 4

Quantity = (100/68)_4 = 6.25% or 6% Unit = (100/68)_4 = 6.25% or 6% That leaves Name = 88%

Could that work?

emreeren commented 11 years ago

I've tried it now but %6 is small space even on wide page. I'll try another idea.

Stelzi79 commented 11 years ago

What about making the width-percentages configurable? By the way every "WPF-thing" you can see on a screen (it has an VisualState) can be easyly printed.

emreeren commented 11 years ago

hi,. We can simply use grids instead of tables and solve that problem. However I have very optimized code that converts flow document tables into a receipt text format and for this reason I'm searching a simple solution to prevent rewrite. The problem occurs when it printed on A4 paper. So to be able to make it configurable we'll need paper based configurations.

I'll first try replacing tables with grids.