From 3b0598369897708ed59120c7628eb22dd5079faa Mon Sep 17 00:00:00 2001 From: konrad Date: Sat, 29 Mar 2008 08:22:32 +0000 Subject: [PATCH] print bills git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@145 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- doc/prog_odttemplate.html | 41 ++++++++++++++++++++- examples/bill.odtt | Bin 0 -> 10972 bytes src/event.cpp | 5 +++ src/event.h | 4 ++- src/eventsummary.cpp | 10 +++++- src/order.cpp | 10 +++++ src/order.h | 6 +++ src/orderwin.cpp | 88 +++++++++++++++++++++++++++++++++++++++++++-- src/orderwin.h | 12 ++++++ 9 files changed, 170 insertions(+), 6 deletions(-) create mode 100644 examples/bill.odtt diff --git a/doc/prog_odttemplate.html b/doc/prog_odttemplate.html index 95c59c1..79903cc 100644 --- a/doc/prog_odttemplate.html +++ b/doc/prog_odttemplate.html @@ -56,7 +56,7 @@ Loops cannot be nested. File name: eventsummary.odtt

-Loop: TICKETS - this loop iterated over the ticket price categories.

+Loop: TICKETS - this loop iterates over the ticket price categories.

Variables: @@ -71,6 +71,7 @@ Variables: + @@ -78,4 +79,42 @@ Variables:
@UNUSED@tickets that are still unused
@CANCELLED@tickets that were cancelled
@TOTALMONEY@the total amount of income for this event
@TICKETS@the amount of ticket lines in the overview
@TICKETS:PRICE@the price of this category
@TICKETS:BOUGHT@used+unused
@TICKETS:UNUSED@tickets from this category that were not used
+

Order Bills

+ +File name: bill.odtt

+ +Loop: TICKETS - this loop iterates over each ticket in the order.

+ +(TODO: loop for vouchers)

+ +Variables: + + + + + + + + + + + + + + + + + + + + + + + + + + +
VariableDescription
@ORDERDATE@the date when this order has been generated
@ORDERDATETIME@the date and time when this order has been generated
@SENTDATE@the date when this order has been shipped
@SENTDATETIME@the date and time when this order has been shipped
@CUSTOMERID@the ID of the customer
@ORDERID@the ID of the order
@ADDRESS@the address of the customer
@DELIVERYADDRESS@the address it is shipped to, if different from the customers address
@TOTALPRICE@the total price of the order
@AMOUNTPAID@the amount that has already been paid
@SELLER@the login ID of the seller (it is not recommended to use this)
@COMMENT@the comment in the order (it is not recommended to use this)
@AMOUNTTOPAY@the amount that still needs to be paid
@AMOUNTTOREFUND@the amount that has to be refunded
@TICKETS@the amount of tickets in the order
@TICKETS:PRICE@the price of this ticket
@TICKETS:ID@the ID of this ticket (barcode-string)
@TICKETS:TITLE@the title of the event for this ticket
@TICKETS:ARTIST@the artist of the event for this ticket
@TICKETS:DATE@the date of the event for this ticket
@TICKETS:STARTTIME@the date and start time of the event for this ticket
@TICKETS:ENDTIME@the end date and time of the event for this ticket
@TICKETS:ROOM@the room/place of the event for this ticket
+ + \ No newline at end of file diff --git a/examples/bill.odtt b/examples/bill.odtt new file mode 100644 index 0000000000000000000000000000000000000000..280dcb8afc5f16e879252371bd295c69acf8a3e5 GIT binary patch literal 10972 zcmbW71ymf_wuT#bcXtR50fGg0clQun8rR_N60DKnZoz^}fDjylOK=bFP9C{)?hOoxRVl+NXX+83;&B0000Bz~^!0%2gY-D+U7qwjjR!g9WfLaWZ0Z zv$0lFg#$oLoNq{c+tl130oxGU5K*t2qvu&r#cp2(30li29nJ*iLA}!?oy4x%^_7V> zp+={TRb9XHItwNP5|>63{f10ymUX2jTl|7Qe#(P@ebsT>LKhPf z4%8l3PiR`-=CCknuD$u%844cJaV~)*VE$u98c9ofVvD=yy@u5pa5?&ANS2hrB99ir zE5x>s-0nwd_l;ni!H}9PFdL}Hz5%!rpJ?GNQa@2@-CXE0aV>Cm7cL8SMHVQ@PpwK$ z%Bm5SW7<5FviQEo?jTsUtr9OUsdAZoD;bVDCqWBnN_{SIn09S%uT>skn_ZRA8 zj75O9rWR(-4n|HEKwHPB%>RmY_m_PM`lJ0nWBncRElqwz;Qs<)2efmxvoW!C{sZdoI9RJ%elKh?|Y~f^MWcP34?_>E_ZNCbDk+HFfwaH_u0slQ}|2)rVej)Hj zoUyZmgNd!vZ>!aRm%)xsMo!NEG*9$lK(K1jO^^J zEsXy)*_d5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q;+y(TCfzY!y~> zRXGuS7!9caV6lJ-2^hb7PVJb?IlCR~VL0*}sM3-P^`_RFVQctCY2K;l<`V)C zu{oFqPD9eE+gM)<$LSdB+IvUmk1cW2$kdff0(L|EEz4i*cMm<)5lh!~Mn_X@WX`$g z+|RuFCG(N#$RboyrB(7>d?wTL3`DKJRnFq1UiU?rxwlODqL8o$nE4vnFBtZM1 zfW>^_Unkx^v`{B6@fanrRF)iyy4N&WLT`Rn;l5%_adVov%aXGL3zF;soEZ5o@|os| zv9J%B?>c94>_Pd|SqfkwniRT>nUWdvsth!QCf)<0II2#OK6+RQEG(~KUahkpgZr4z zbXks5lpXXb<@e?q3KqIPuZa(*xoUK2OsUi*)sLMDS>LdH_#zy7P8loIuuq4aJ?c@O z?>|n$aSl_Dup?x*#*6Q zqc=%tU7f@^M~pp7#MQ1CPc<8E(f+d~FLHxDRN5r7h$m9z(x{LAjE~S|*U+f{O_p-Q z%F5jp#h&;a-gDQ9r-$j5b)G2;l+@e+fIkqw^S%6m002+{`$FrFq`$jh9#P-i z34cZX-T(3^x|4G6nyKiFsfHhSM{&d&`%Jk$EFDYzgetTemplate("eventsummary.odtt"); + if(tf==""){ + QMessageBox::warning(this,tr("Warning"),tr("Unable to get template file (eventsummary.odtt). Giving up.")); + return; + } QFileDialog fd(this); fd.setAcceptMode(QFileDialog::AcceptSave); fd.setFileMode(QFileDialog::AnyFile); @@ -166,7 +171,7 @@ void MEventSummary::saveas() if(fn.size()<1)return; fname=fn[0]; } - MOdtSignalRenderer rend("../examples/eventsummary.odtt"); + MOdtSignalRenderer rend(tf); connect(&rend,SIGNAL(getVariable(QString,QString&)),this,SLOT(getVariable(QString,QString&))); connect(&rend,SIGNAL(getLoopIterations(QString,int&)),this,SLOT(getLoopIterations(QString,int&))); connect(&rend,SIGNAL(getLoopVariable(QString,int,QString,QString&)),this,SLOT(getLoopVariable(QString,int,QString,QString&))); @@ -210,6 +215,9 @@ void MEventSummary::getVariable(QString varname,QString&value) value=QString::number(ntotalmoney/100) +tr(".","decimal dot") +QString().sprintf("%02d",ntotalmoney%100); + else + if(varname=="TICKETS") + value=QString::number(tickets.size()); } void MEventSummary::getLoopIterations(QString loopname,int&iterations) diff --git a/src/order.cpp b/src/order.cpp index 5b9005c..fbdebf2 100644 --- a/src/order.cpp +++ b/src/order.cpp @@ -159,6 +159,16 @@ int MOrder::amountToRefund()const return 0; } +QString MOrder::amountToPayStr()const +{ + return cent2string(amountToPay()); +} + +QString MOrder::amountToRefundStr()const +{ + return cent2string(amountToRefund()); +} + bool MOrder::isSent()const { //only in placed mode there is a need for action, hence in all other modes we assume sent diff --git a/src/order.h b/src/order.h index 9a1e3ba..186fd9a 100644 --- a/src/order.h +++ b/src/order.h @@ -194,9 +194,15 @@ class MOrder /**returns how much there is to be paid, in cents*/ int amountToPay()const; + /**returns how much there is to be paid, as localized string*/ + QString amountToPayStr()const; + /**returns how much there is to be refunded, in cents*/ int amountToRefund()const; + /**returns how much there is to be refunded, as localized string*/ + QString amountToRefundStr()const; + /**returns whether the tickets of this order have already been shipped*/ bool isSent()const; diff --git a/src/orderwin.cpp b/src/orderwin.cpp index df1a164..c93c804 100644 --- a/src/orderwin.cpp +++ b/src/orderwin.cpp @@ -15,9 +15,11 @@ #include "webrequest.h" #include "ticketrender.h" #include "labeldlg.h" +#include "odtrender.h" #include #include +#include #include #include #include @@ -49,10 +51,10 @@ MOrderWindow::MOrderWindow(QWidget*par,MWebRequest*r,const MOrder&o) m->addAction(tr("Receive &Payment...")); m->addAction(tr("&Refund...")); m=mb->addMenu(tr("P&rinting")); - m->addAction(tr("Print &Bill...")); - m->addAction(tr("Save Bill &as file...")); + m->addAction(tr("Print &Bill..."),this,SLOT(printBill())); + m->addAction(tr("Save Bill &as file..."),this,SLOT(saveBill())); m->addSeparator(); - m->addAction(tr("Print &Tickets...")); + m->addAction(tr("Print &Tickets..."),this,SLOT(printTickets())); m->addAction(tr("Print &Current Ticket..."),this,SLOT(printCurrentTicket())); m->addAction(tr("&View Tickets..."),this,SLOT(ticketView())); @@ -183,6 +185,86 @@ void MOrderWindow::printTickets(QList tickets) } +void MOrderWindow::printBill() +{ + QString tf=req->getTemplate("bill.odtt"); + if(tf==""){ + QMessageBox::warning(this,tr("Warning"),tr("Unable to get template file (bill.odtt). Giving up.")); + return; + } + MOdtSignalRenderer rend(tf); + connect(&rend,SIGNAL(getVariable(QString,QString&)),this,SLOT(getVariable(QString,QString&))); + connect(&rend,SIGNAL(getLoopIterations(QString,int&)),this,SLOT(getLoopIterations(QString,int&))); + connect(&rend,SIGNAL(getLoopVariable(QString,int,QString,QString&)),this,SLOT(getLoopVariable(QString,int,QString,QString&))); + rend.renderToPrinter(); +} + +void MOrderWindow::saveBill() +{ + QString tf=req->getTemplate("eventsummary.odtt"); + if(tf==""){ + QMessageBox::warning(this,tr("Warning"),tr("Unable to get template file (eventsummary.odtt). Giving up.")); + return; + } + QFileDialog fd(this); + fd.setAcceptMode(QFileDialog::AcceptSave); + fd.setFileMode(QFileDialog::AnyFile); + fd.setConfirmOverwrite(true); + fd.setFilter("Open Document Text (*.odt)"); + fd.setDefaultSuffix("odt"); + QString fname; + if(fd.exec()){ + QStringList fn=fd.selectedFiles(); + if(fn.size()<1)return; + fname=fn[0]; + } + MOdtSignalRenderer rend(tf); + connect(&rend,SIGNAL(getVariable(QString,QString&)),this,SLOT(getVariable(QString,QString&))); + connect(&rend,SIGNAL(getLoopIterations(QString,int&)),this,SLOT(getLoopIterations(QString,int&))); + connect(&rend,SIGNAL(getLoopVariable(QString,int,QString,QString&)),this,SLOT(getLoopVariable(QString,int,QString,QString&))); + rend.renderToFile(fname); +} + +void MOrderWindow::getVariable(QString vn,QString&value) +{ + if(vn=="ORDERDATE")value=m_order.orderDateStr();else + if(vn=="ORDERDATETIME")value=m_order.orderDateTimeStr();else + if(vn=="SENTDATE")value=m_order.sentDateStr();else + if(vn=="SENTDATETIME")value=m_order.sentDateTimeStr();else + if(vn=="CUSTOMERID")value=QString::number(m_order.customerID());else + if(vn=="ORDERID")value=QString::number(m_order.orderID());else + if(vn=="ADDRESS")value=m_order.customer().address();else + if(vn=="DELIVERYADDRESS")value=m_order.deliveryAddress();else + if(vn=="TOTALPRICE")value=m_order.totalPriceString();else + if(vn=="AMOUNTPAID")value=m_order.amountPaidString();else + if(vn=="SELLER")value=m_order.seller();else + if(vn=="COMMENT")value=m_order.comment();else + if(vn=="AMOUNTTOPAY")value=m_order.amountToPayStr();else + if(vn=="AMOUNTTOREFUND")value=m_order.amountToRefundStr();else + if(vn=="TICKETS")value=QString::number(m_ticketmodel->rowCount()); +} + +void MOrderWindow::getLoopIterations(QString loopname,int&iterations) +{ + if(loopname=="TICKETS")iterations=m_ticketmodel->rowCount(); +} +void MOrderWindow::getLoopVariable(QString loopname,int it,QString vn,QString&value) +{ + if(loopname!="TICKETS")return; + if(it<0 || it>=m_ticketmodel->rowCount())return; + + QListtickets=m_order.tickets(); + + if(vn=="PRICE")value=tickets[it].priceString();else + if(vn=="ID")value=tickets[it].ticketID();else + if(vn=="TITLE")value=tickets[it].event().title();else + if(vn=="ARTIST")value=tickets[it].event().artist();else + if(vn=="DATE")value=tickets[it].event().startDateString();else + if(vn=="STARTTIME")value=tickets[it].event().startTimeString();else + if(vn=="ENDTIME")value=tickets[it].event().endTimeString();else + if(vn=="ROOM")value=tickets[it].event().room(); +} + /*************************************************************************************/ diff --git a/src/orderwin.h b/src/orderwin.h index 3eb8e16..6711807 100644 --- a/src/orderwin.h +++ b/src/orderwin.h @@ -47,6 +47,18 @@ class MOrderWindow:public QMainWindow void printTickets(); /**internal helper: print list of tickets*/ void printTickets(QList); + + /**print a bill*/ + void printBill(); + /**save the bill as file*/ + void saveBill(); + /**callback for bill generator: variables; see MOdtSignalRenderer for details*/ + void getVariable(QString varname,QString&value); + /**callback for bill generator: loops; see MOdtSignalRenderer for details*/ + void getLoopIterations(QString loopname,int&iterations); + /**callback for bill generator: loop variables; see MOdtSignalRenderer for details*/ + void getLoopVariable(QString loopname,int iteration,QString varname,QString&value); + private: MWebRequest*req; -- 1.7.2.5