comment for deduct voucher transaction
authorkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Sat, 11 Dec 2010 17:33:12 +0000 (17:33 +0000)
committerkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Sat, 11 Dec 2010 17:33:12 +0000 (17:33 +0000)
git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@657 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33

src/mwin/entrancetab.cpp
src/mwin/overview.cpp
wob/classes/order.wolf
wob/db/order.wolf
wob/transact/order.wolf
www/inc/wext/autoload.php
www/inc/wext/transaction.php
www/inc/wext/voucher.php [new file with mode: 0644]

index 01838f2..cc9f333 100644 (file)
@@ -54,17 +54,27 @@ MEntranceTab::MEntranceTab(QString pk)
        connect(orderbtn,SIGNAL(clicked()),this,SLOT(openOrder()));
        vl->addSpacing(20);
        vl->addLayout(hl=new QHBoxLayout,0);
-       hl->addWidget(new QLabel(tr("Total:")));
-       hl->addWidget(amtotal=new QLabel("0"));
        hl->addStretch(1);
-       hl->addWidget(new QLabel(tr("Used:")));
+       QLabel*lab;
+       hl->addWidget(lab=new QLabel(tr("Total:")));
+       fnt=lab->font();
+       fnt.setPointSizeF(fnt.pointSizeF()*1.5);
+       lab->setFont(fnt);
+       hl->addWidget(amtotal=new QLabel("0"));
+       amtotal->setFont(fnt);
+       hl->addSpacing(10);
+       hl->addWidget(lab=new QLabel(tr("Used:")));
+       lab->setFont(fnt);
        hl->addWidget(amused=new QLabel("0"));
-       hl->addStretch(1);
-       hl->addWidget(new QLabel(tr("Unused:")));
+       amused->setFont(fnt);
+       hl->addSpacing(10);
+       hl->addWidget(lab=new QLabel(tr("Unused:")));
+       lab->setFont(fnt);
        hl->addWidget(amopen=new QLabel("0"));
-       hl->addStretch(1);
-       hl->addWidget(new QLabel(tr("Reserved:")));
-       hl->addWidget(amreserved=new QLabel("0"));
+       amopen->setFont(fnt);
+//     hl->addStretch(1);
+//     hl->addWidget(new QLabel(tr("Reserved:")));
+//     hl->addWidget(amreserved=new QLabel("0"));
        
        QTimer*tm=new QTimer(this);
        connect(tm,SIGNAL(timeout()),this,SLOT(resetLabel()));
@@ -155,7 +165,7 @@ void MEntranceTab::entranceValidate()
        amtotal->setText(QString::number(tuse.amounttickets()));
        amused->setText(QString::number(tuse.amountused()));
        amopen->setText(QString::number(tuse.amountopen()));
-       amreserved->setText(QString::number(tuse.amountreserved()));
+//     amreserved->setText(QString::number(tuse.amountreserved()));
        if(tuse.usestatus().value()!=MOTicketUse::NotFound)
                orderbtn->setEnabled(req->hasRight(req->RGetOrderByBarcode));
        else
@@ -225,5 +235,5 @@ void MEntranceTab::resetAmounts()
        amtotal->setText("0");
        amused->setText("0");
        amopen->setText("0");
-       amreserved->setText("0");
+//     amreserved->setText("0");
 }
\ No newline at end of file
index 565dd02..f140ad0 100644 (file)
@@ -253,16 +253,18 @@ void MOverview::deductVoucher()
        d.setLayout(gl=new QGridLayout);
        gl->addWidget(new QLabel(tr("Using a voucher to pay outside the system.")),0,0,1,2);
        
-       QLineEdit*vid;
+       QLineEdit*vid,*cmt;
        MCentSpinBox*cent;
        gl->addWidget(new QLabel(tr("Amount to deduct:")),1,0);
        gl->addWidget(cent=new MCentSpinBox,1,1);
-       gl->addWidget(new QLabel(tr("Voucher ID:")),2,0);
-       gl->addWidget(vid=new QLineEdit,2,1);
+       gl->addWidget(new QLabel(tr("Reason for deducting:")),2,0);
+       gl->addWidget(cmt=new QLineEdit,2,1);
+       gl->addWidget(new QLabel(tr("Voucher ID:")),3,0);
+       gl->addWidget(vid=new QLineEdit,3,1);
        
-       gl->setRowMinimumHeight(3,15);
+       gl->setRowMinimumHeight(4,15);
        QHBoxLayout*hl;
-       gl->addLayout(hl=new QHBoxLayout,4,0,1,2);
+       gl->addLayout(hl=new QHBoxLayout,5,0,1,2);
        hl->addStretch(10);
        QPushButton*p;
        hl->addWidget(p=new QPushButton(tr("OK")));
@@ -272,7 +274,7 @@ void MOverview::deductVoucher()
        if(d.exec()!=QDialog::Accepted)return;
        if(vid->text().trimmed()=="" || cent->value()<=0)return;
        //query server
-       MTDeductVoucher dv=req->queryDeductVoucher(vid->text(),cent->value());
+       MTDeductVoucher dv=req->queryDeductVoucher(vid->text(),cent->value(),cmt->text());
        if(dv.hasError()){
                QMessageBox::warning(this,tr("Warning"),tr("Unable to deduct voucher: %1").arg(dv.errorString()));
                return;
index 3343275..dea5e59 100644 (file)
@@ -53,6 +53,7 @@
        
        <Class name="Voucher">
                <Abstract lang="qt"/>
+               <Abstract lang="php"/>
                <Enum name="VoucherState">
                        <Value name="Ok"/>
                        <Value name="InvalidValue"/>
index 364f75c..b6af6b3 100644 (file)
                <Column name="isused" type="bool" default="false"/>
                <!--remaining value in cents (0 for cancelled)-->
                <Column name="value" type="int32" notnull="yes"/>
+               <!-- comments in auditing -->
+               <AuditColumn name="comment" type="string" null="yes">
+                       <Call lang="php" method="WOVoucher::getTransactionComment()"/>
+               </AuditColumn>
        </Table>
        
        <Table name="product" backup="yes">
index 888df3a..e80d77b 100644 (file)
                <Input>
                        <Var name="voucherid" type="astring">ID of the voucher to be used</Var>
                        <Var name="amount" type="int">Amount to be deducted. Must be positive.</Var>
+                       <Var name="comment" type="string">A comment noting why it was deducted.</Var>
                </Input>
                <Call lang="php" method="WOOrder::deductVoucher($this);"/>
                <Output>
index 78d9250..48c23a2 100644 (file)
@@ -26,6 +26,7 @@ wob_autoclass("WOServerFormat","inc/wext/format.php");
 wob_autoclass("WOShipping","inc/wext/shipping.php");
 wob_autoclass("WOTemplate","inc/wext/template.php");
 wob_autoclass("WOTicket","inc/wext/ticket.php");
+wob_autoclass("WOVoucher","inc/wext/voucher.php");
 wob_autoclass("WOWebCart","inc/wext/webcart.php");
 
 wob_autoclass("MSmokeTransaction","inc/wext/transaction.php");
index 2f51cef..bc447a1 100644 (file)
@@ -13,6 +13,7 @@ class MSmokeTransaction extends WobTransaction
 {
        public function __construct()
        {
+               parent::__construct();
        }
        
        protected function mkSession()
diff --git a/www/inc/wext/voucher.php b/www/inc/wext/voucher.php
new file mode 100644 (file)
index 0000000..6aecf5e
--- /dev/null
@@ -0,0 +1,15 @@
+<?
+
+class WOVoucher extends WOVoucherAbstract
+{
+       public static function getTransactionComment()
+       {
+               $inst=WobTransaction::getInstance();
+               if($inst == null)return null;
+               if(method_exists($inst,"getcomment"))
+                       return $inst->getcomment();
+               else return null;
+       }
+};
+
+?>
\ No newline at end of file