raouf505 / fairpos

Automatically exported from code.google.com/p/fairpos
0 stars 0 forks source link

Comission Invoice #82

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Invoice with details (all articles) in DIN A4 print
* print all articles taken and returned via commission
* calculate difference and summarize non-returned articles for payment
* use Jasper Reports/iReport
** print on DIN A4 paper, not ticket printer
** template is the printed invoice from issue 62

-> I think before having the Report itself, the data can be prepared for the 
report via a DB view or Java class.

Original issue reported on code.google.com by harald.g...@gmail.com on 18 Jan 2013 at 11:52

GoogleCodeExporter commented 8 years ago
HINT: For quick feedback on .jrxml change, add this line:

try {jr = 
JasperCompileManager.compileReport(JRXmlLoader.load(getClass().getResourceAsStre
am(getReport() + ".jrxml")));} catch (Exception e) {}

as first line of 'launchreport()' in JPanelReport.java. (Every new click on 
'Execute report' will re-read .jrxml (which can be meanwhile changed in iReport 
(open .jrxml files in iReport from 
'Fairpos-src/netbeans/build/classes/com/openbravo/reports') (set iReport to 
3.1.4 compatibility, see also Wiki->Reports).)

Original comment by benes.vi...@gmail.com on 28 Jan 2013 at 9:13

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Breakpoint here:

#0
(creating commision return lines from selected ticket in 'Edit Sales', see 
JTicketsBagTicket.m_ticket & refundTicket):
JTicketsBagTicket.java - m_jCommissionActionPerformed()

#1
(switching to new refundticket)
JPanelTicket.java - setActiveTicket()

#2
(adding lines to refund ticket)
JRefundLines.java - m_jbtnAddOneActionPerformed() / 
m_jbtnAddLineActionPerformed() / m_jbtnAddAllActionPerformed()

#3
(opening payment dialog after activating the "cash" "pay" button)
JPanelTicket.java - closeTicket()

#4
(after paying the refund ticket)
DataLogicSales.java - saveTicket() - case TicketInfo.RECEIPT_REFUNDCOMMISSION

Problem:
@ #0 and #1 - this is too soon for anything related to invoice print
@ #2 - we have both old ticket lines (ie. items taken originally on commission) 
& new ticket (ie. returned items) - but we do not know if this is the final 
state or if any more items will be returned
@ #3 and #4, we do not have the information about the origial ticket 
(JTicketsBagTicket.m_ticket) or the lines (JRefundLines.ticketlines) created 
from it

? Solution:
a) from #0 / #1 / #2 - store somewhere the reference to 
JRefundLines.ticketlines - into new ticket? into some global something?
b) prepare the invoice each time #2 occurs (and finally use its last version 
then - after the payment is done) - where & how to store it?

The a) option is probably cleaner - TicketInfo will be extended with 
m_aLinesSourceCommission, where we will store the lines of original ticket 
during #0 & we will use them right after #4.

Original comment by benes.vi...@gmail.com on 29 Jan 2013 at 12:32

GoogleCodeExporter commented 8 years ago
I thought more like after payment (with payment type invoice) everything is in 
the DB and it is just a SQL and Report to assemble it?
We could turn off the ticket print and instead print a report.
(this comment already sent via e-mail)

Original comment by harald.g...@gmail.com on 2 Feb 2013 at 8:26

GoogleCodeExporter commented 8 years ago
>You want to take these 2 tickets & prepare the report from them (somehow)?
That's what I thought... Maybe just sum up both in an SQL?
We can omit the entirely returned items, list only those to pay for.

>What about issue #62? Are you going to prepare the template today or should I 
try to prepare something by myself (for this issue #82)?
If possible, prepare something similar to current invoice receipt.

(copied from e-mail to this ticket)

Original comment by harald.g...@gmail.com on 10 Feb 2013 at 5:52

GoogleCodeExporter commented 8 years ago
r154
Invoice report printing was added - now triggered on every ticket close (ie. 
payment) - see JPanelTicket.java -> closeTicket() (line:1092-1096) ...call to 
printReport().

JRPrinterAWT300.printPages() call in printReport() prints successfuly to my 
default printer set in Windows, which is currently Foxit PDF printer.

TODO:
* add sums to report;
* FIXME: discount on refund ticket is negative;
* ? clone 'invoiceCommission' report (& resources) from 'invoice';
* trigger 'invoice' report creation from other place than closeTicket(); 
(invoice-commission report trigger is probably ok there)

Original comment by benes.vi...@gmail.com on 11 Feb 2013 at 3:32

GoogleCodeExporter commented 8 years ago
Fixed 2 last points, 2 separate reports, also triggered only when payment 
contains invoice.

>* FIXME: discount on refund ticket is negative;
I think this is correct. It is just that the entire group 2 has to be 
subtracted from group 1 - then also discount is OK.

TODO:
* add sums to report;
* add payments to report
* add customer name and address to report

Original comment by harald.g...@gmail.com on 13 Feb 2013 at 2:42

GoogleCodeExporter commented 8 years ago
Also made rough design of the reports.

Original comment by harald.g...@gmail.com on 13 Feb 2013 at 3:04

GoogleCodeExporter commented 8 years ago
> I think this is correct. It is just that the entire group 2 has to be 
subtracted from group 1 - then also discount is OK.
You are right. 
But - to match refund ticket, I removed (r169) the negative multiplication for 
commission refund ticket in the report. So now, please, (substitute:) 
s/subtracted/added/ in your statement above.

* add payments to report
...please - what is meant by this? What should appear on the ticket? Whether 
the customer paid by car/cash/...? Can you prepare the layout with the 
variables (in .jrxml only - I will then update the logic in FairPOS).

> calculate difference and summarize non-returned articles for payment
You mean the first commission ticket with everything + the commission refund 
ticket with returned items is not sufficient? You say we need yet other list of 
items which are in commission but not in refund-commission?

We discussed this somewhere else: You do not want the customer to pay his whole 
depth (where are potentially more commission tickets included), just the cost 
of current commission being paid? As it is now, it was easy - we knew that 
after customer returns things from commission & pays - we just set his/her debt 
to 0. If you want to change it, we would need to change the refund-commission 
payment:
* "case TicketInfo.RECEIPT_REFUNDCOMMISSION" case-block in saveTicket() in 
DataLogicSales.java                       (...-> update customer depth to zero 
function call should be prevented)
* "addedValue = ticket.getCustomer().getCurdebt();" line in closeTicket() in 
JPanelTicket.java (...line should not be used)

----

TODO:
* add payments to report;
* ? payment of refund-commission will not include customers debt (which 
includes all commission-s before) but just current commission (being partially 
returned->refunded); 
* ? 

DONE: r170
* add sums to report;
* add customer name and address to report

Note: you probably forgot to commit your invoice split & layout change - if you 
have trouble merging, feel free to assign it to me...

Original comment by benes.vi...@gmail.com on 16 Feb 2013 at 10:50

GoogleCodeExporter commented 8 years ago
>* add payments to report
>...please - what is meant by this? What should appear on the ticket? Whether 
the customer paid by car/cash/...? 

Exactly, or if he e.g. pays by invoice.

>Can you prepare the layout with the variables (in .jrxml only - I will then 
update the logic in FairPOS).

Not today via phone. But you could already add the payments to the report data.

> calculate difference and summarize non-returned articles for payment
>You mean the first commission ticket with everything + the commission refund 
ticket with returned items is not sufficient?

Yes it is sufficient. I just meant to display the sum to pay, just the Addition 
of the 2 tickets.

Original comment by harald.g...@gmail.com on 17 Feb 2013 at 12:10

GoogleCodeExporter commented 8 years ago
DONE:
* commission grand total (sum of commission and commission_return ticket) (r172)
* when paying commission only current commission is subtracted from debt (not 
all potential commissions taken before) (r172)

TODO:
* payments on report

Original comment by benes.vi...@gmail.com on 18 Feb 2013 at 8:57

GoogleCodeExporter commented 8 years ago
TODO:
* i18n - payments in reports & printer tickets
* payments (see draft below)

Payments:
Draft in r173 - it prints cash/non-cash payment in report.

The problem is that payments cannot be passed nicely as a list. It is now like 
this: there are fields: LABELPAY0 + PAY0, LABEPAY1 + PAY1 (and we whould need 
to have 15+ of these for each possible line of different payments (see possible 
lines at bottom - this were obtained from Printer.Ticket.xml)).

Do we want it like this or is there some more elegant way? 

--------------
$paymentline.name == "cash"
  Bar gegeben: ----> paymentline.printPaid()
  if ($paymentline.getChange() > 0)
  Rückgeld: ----> paymentline.printChange()

$paymentline.name == "cashrefund"
  Rückzahlung Bar ----> ${paymentline.printTotal()}

$paymentline.name == "magcard"
  Kartenzahlung  ----> ${paymentline.printTotal()}
  Nummer:  ----> ${paymentline.printCardNumber()}  
  Gültig bis: ---->  ${paymentline.printExpirationDate()}
  Transaktionsnr.: ----> ${paymentline.printTransactionID()}
  Authorization: ----> ${paymentline.printAuthorization()}

$paymentline.name == "magcardrefund"
  Rückgabe einer Kartenzahlung ----> ${paymentline.printTotal()}

$paymentline.name == "cheque"
  Rechnung ----> ${paymentline.printTotal()}
  Bitte innerhalb 14 Tagen überweisen auf
  Konto Nr. 5367360 - BLZ 60250010
  bei der Kreissparkasse Waiblingen.

$paymentline.name == "chequerefund"
  Rechnung Erstattung ----> ${paymentline.printTotal()}

$paymentline.name == "paperin"
  Gutschein ----> ${paymentline.printTotal()}

$paymentline.name == "paperout"
  Gutschein Rückzahlung ----> ${paymentline.printTotal()}

$paymentline.name == "free"
  Mitarbeiter-Gutschein ----> ${paymentline.printTotal()}

Original comment by benes.vi...@gmail.com on 18 Feb 2013 at 10:49

GoogleCodeExporter commented 8 years ago
Wasn't it possible to use a kind of array in the report afai remember?
You could add there payment name and amount and Japsper just puts one line per 
array entry?

Original comment by harald.g...@gmail.com on 23 May 2013 at 1:26