QLabel*lab;
gl->addWidget(new QLabel(tr("Order ID:")),rw,0);
gl->addWidget(m_orderid=new QLabel(QString::number(m_order.orderid())),rw,1);
+ gl->addWidget(new QLabel(tr("Order State:")),++rw,0);
+ gl->addWidget(m_state=new QLabel(),rw,1);
gl->addWidget(new QLabel(tr("Order Date:")),++rw,0);
- gl->addWidget(m_orderdate=new QLabel(m_order.orderDateTimeStr()),rw,1);
+ gl->addWidget(m_orderdate=new QLabel(),rw,1);
gl->addWidget(new QLabel(tr("Shipping Date:")),++rw,0);
- gl->addWidget(m_sentdate=new QLabel(m_order.sentDateTimeStr()),rw,1);
+ gl->addWidget(m_sentdate=new QLabel(),rw,1);
gl->addWidget(new QLabel(tr("Customer:")),++rw,0);
- gl->addWidget(new QLabel(m_order.customer().value().fullName()),rw,1);
+ gl->addWidget(m_custname=new QLabel(),rw,1);
gl->addWidget(lab=new QLabel(tr("Delivery Address:")),++rw,0);
lab->setAlignment(Qt::AlignTop);
- gl->addWidget(lab=new QLabel(m_order.fullDeliveryAddress(false)),rw,1);
+ gl->addWidget(m_daddr=lab=new QLabel(),rw,1);
lab->setWordWrap(true);lab->setFrameShape(lab->Box);lab->setFrameShadow(lab->Raised);
gl->addWidget(lab=new QLabel(tr("Invoice Address:")),++rw,0);
lab->setAlignment(Qt::AlignTop);
- gl->addWidget(lab=new QLabel(m_order.fullInvoiceAddress(false)),rw,1);
+ gl->addWidget(m_iaddr=lab=new QLabel(),rw,1);
lab->setWordWrap(true);lab->setFrameShape(lab->Box);lab->setFrameShadow(lab->Raised);
- gl->addWidget(new QLabel(tr("Sold by:")),++rw,0);
- gl->addWidget(new QLabel(m_order.soldby()),rw,1);
- gl->addWidget(new QLabel(tr("Total Price:")),++rw,0);
- gl->addWidget(m_total=new QLabel(m_order.totalPriceString()),rw,1);
- gl->addWidget(new QLabel(tr("Already Paid:")),++rw,0);
- gl->addWidget(m_paid=new QLabel(m_order.amountPaidString()),rw,1);
- gl->addWidget(new QLabel(tr("Order State:")),++rw,0);
- gl->addWidget(m_state=new QLabel(m_order.orderStatusString()),rw,1);
gl->addWidget(new QLabel(tr("Shipping Method:")),++rw,0);
- gl->addWidget(m_shipmeth=new QLabel(m_order.shippingtype().value().description()),rw,1);
+ gl->addWidget(m_shipmeth=new QLabel(),rw,1);
gl->addWidget(new QLabel(tr("Shipping Costs:")),++rw,0);
- gl->addWidget(m_shipprice=new QLabel(cent2str(m_order.shippingcosts())),rw,1);
- gl->addWidget(lab=new QLabel(tr("Order Comment:")),++rw,0);
+ gl->addWidget(m_shipprice=new QLabel(),rw,1);
+ gl->addWidget(new QLabel(tr("Total Price:")),++rw,0);
+ gl->addWidget(m_total=new QLabel(),rw,1);
+ gl->addWidget(new QLabel(tr("Already Paid:")),++rw,0);
+ gl->addWidget(m_paid=new QLabel(),rw,1);
+ gl->addWidget(new QLabel(tr("Sold by:")),++rw,0);
+ gl->addWidget(m_soldby=new QLabel(),rw,1);
+ gl->addWidget(lab=new QLabel(tr("Order Comments:")),++rw,0);
lab->setAlignment(Qt::AlignTop);
- gl->addWidget(m_comment=lab=new QLabel(m_order.comments()),rw,1);
+ gl->addWidget(m_comment=lab=new QLabel(),rw,1);
lab->setWordWrap(true);lab->setFrameShape(lab->Box);lab->setFrameShadow(lab->Raised);
gl->setColumnStretch(0,0);
gl->setColumnStretch(1,10);
vl->addWidget(m_table=new QTableView,10);
m_table->setModel(m_model=new QStandardItemModel(this));
m_table->setEditTriggers(QAbstractItemView::NoEditTriggers);
- updateTable();
+ updateData();
//make sure everything is visible
QSize vsz=m_table->maximumViewportSize();
vsz.setWidth(vsz.width()+40);
static const int ITEM_VOUCHER=2;
static const int ITEM_ITEM=3;
-void MOrderWindow::updateTable()
+void MOrderWindow::updateData()
{
+ //label data
+ m_orderid->setText(QString::number(m_order.orderid()));
+ m_state->setText(m_order.orderStatusString());
+ m_orderdate->setText(m_order.orderDateTimeStr());
+ m_sentdate->setText(m_order.sentDateTimeStr());
+ m_custname->setText(m_order.customer().value().fullName());
+ m_daddr->setText(m_order.fullDeliveryAddress(false));
+ m_iaddr->setText(m_order.fullInvoiceAddress(false));
+ m_shipmeth->setText(m_order.shippingtype().value().description());
+ m_shipprice->setText(cent2str(m_order.shippingcosts()));
+ m_total->setText(m_order.totalPriceString());
+ m_paid->setText(m_order.amountPaidString());
+ m_soldby->setText(m_order.soldby());
+ m_comment->setText(m_order.comments());
//get detail data
QList<MOTicket> tickets=m_order.tickets();
QList<MOEvent> events;
m_model->setData(m_model->index(i+off,3),vouchers[i].statusString());
m_model->setData(m_model->index(i+off,4),vouchers[i].priceString());
}
- //TODO: insert items
+ //insert items
off+=vouchers.size();
for(int i=0;i<items.size();i++){
m_model->setData(m_model->index(i+off,0),ITEM_ITEM,Qt::UserRole);
m_table->resizeColumnsToContents();
}
-void MOrderWindow::setChanged()
-{
- m_changed=true;
-}
-
-bool MOrderWindow::isChanged()const
-{
- return m_changed;
-}
-
void MOrderWindow::itemView()
{
QList<MOTicket>tickets=m_order.tickets();
return;
}
m_order=ms.getorder();
- m_state->setText(m_order.orderStatusString());
- m_sentdate->setText(m_order.sentDateTimeStr());
+ updateData();
}
}
}
m_order=ocs.getorder();
//reset display
- m_shipmeth->setText(m_order.shippingtype().value().description());
- m_shipprice->setText(cent2str(m_order.shippingcosts()));
- m_total->setText(m_order.totalPriceString());
+ updateData();
}
void MOrderWindow::moneyLogOrder()