.
This commit is contained in:
@@ -84,6 +84,22 @@ QString cPartlistItem::description()
|
||||
return(m_szDescription);
|
||||
}
|
||||
|
||||
cPartlistItem::STATE cPartlistItem::state(const QString& szState)
|
||||
{
|
||||
if(szState == stateString(cPartlistItem::STATE_init))
|
||||
return(cPartlistItem::STATE_init);
|
||||
if(szState == stateString(cPartlistItem::STATE_ordered))
|
||||
return(cPartlistItem::STATE_ordered);
|
||||
if(szState == stateString(cPartlistItem::STATE_shipping))
|
||||
return(cPartlistItem::STATE_shipping);
|
||||
if(szState == stateString(cPartlistItem::STATE_received))
|
||||
return(cPartlistItem::STATE_received);
|
||||
if(szState == stateString(cPartlistItem::STATE_missing))
|
||||
return(cPartlistItem::STATE_missing);
|
||||
|
||||
return(cPartlistItem::STATE_init);
|
||||
}
|
||||
|
||||
void cPartlistItem::setState(const cPartlistItem::STATE& state)
|
||||
{
|
||||
m_state = state;
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
|
||||
void setState(const STATE& state);
|
||||
STATE state();
|
||||
static STATE state(const QString& szState);
|
||||
QString stateString();
|
||||
static QString stateString(const STATE& state);
|
||||
|
||||
|
||||
@@ -30,18 +30,24 @@ void cPartlistItemEditDialog::setList(cDistributorList* lpDistributorList, cPart
|
||||
m_lpPartList = lpPartList;
|
||||
m_lpPartDistributorList = lpPartDistributorList;
|
||||
|
||||
if(m_lpPartList)
|
||||
if(m_lpPartGroupList)
|
||||
{
|
||||
for(int x = 0;x < m_lpPartList->count();x++)
|
||||
ui->m_lpPartList->addItem(QString("%1 - %2").arg(m_lpPartList->at(x)->partGroup()->name()).arg(m_lpPartList->at(x)->name()), QVariant::fromValue(m_lpPartList->at(x)));
|
||||
for(int x = 0;x < m_lpPartGroupList->count();x++)
|
||||
ui->m_lpGroupList->addItem(m_lpPartGroupList->at(x)->name(), QVariant::fromValue(m_lpPartGroupList->at(x)));
|
||||
}
|
||||
|
||||
fillPartList();
|
||||
fillDistributorList();
|
||||
}
|
||||
|
||||
void cPartlistItemEditDialog::setValues(const QString &szReference, const QString &szGroup, const QString &szPart, const QString &szDistributor, const QString &szState, const qreal &dPrice, const QString &szDescription)
|
||||
{
|
||||
ui->m_lpPartList->setCurrentText(QString("%1 - %2").arg(szGroup).arg(szPart));
|
||||
ui->m_lpGroupList->setCurrentText(szGroup);
|
||||
ui->m_lpGroupList->setEnabled(false);
|
||||
|
||||
fillPartList();
|
||||
|
||||
ui->m_lpPartList->setCurrentText(szPart);
|
||||
ui->m_lpPartList->setEnabled(false);
|
||||
|
||||
fillDistributorList();
|
||||
@@ -53,6 +59,11 @@ void cPartlistItemEditDialog::setValues(const QString &szReference, const QStrin
|
||||
ui->m_lpDescription->setText(szDescription);
|
||||
}
|
||||
|
||||
void cPartlistItemEditDialog::on_m_lpGroupList_currentIndexChanged(int /*index*/)
|
||||
{
|
||||
fillPartList();
|
||||
}
|
||||
|
||||
void cPartlistItemEditDialog::on_m_lpPartList_currentIndexChanged(int /*index*/)
|
||||
{
|
||||
fillDistributorList();
|
||||
@@ -60,8 +71,8 @@ void cPartlistItemEditDialog::on_m_lpPartList_currentIndexChanged(int /*index*/)
|
||||
|
||||
void cPartlistItemEditDialog::on_m_lpDistributorList_currentIndexChanged(int /*index*/)
|
||||
{
|
||||
cPart* lpPart = qvariant_cast<cPart*>(ui->m_lpPartList->currentData(Qt::UserRole));
|
||||
cDistributor* lpDistributor = qvariant_cast<cDistributor*>(ui->m_lpDistributorList->currentData(Qt::UserRole));
|
||||
cPart* lpPart = qvariant_cast<cPart*>(ui->m_lpPartList->currentData(Qt::UserRole));
|
||||
cDistributor* lpDistributor = qvariant_cast<cDistributor*>(ui->m_lpDistributorList->currentData(Qt::UserRole));
|
||||
cPartDistributor* lpPartDistributor = m_lpPartDistributorList->find(lpPart, lpDistributor);
|
||||
|
||||
if(!lpPartDistributor)
|
||||
@@ -70,6 +81,25 @@ void cPartlistItemEditDialog::on_m_lpDistributorList_currentIndexChanged(int /*i
|
||||
ui->m_lpPrice->setValue(lpPartDistributor->price());
|
||||
}
|
||||
|
||||
void cPartlistItemEditDialog::fillPartList()
|
||||
{
|
||||
ui->m_lpPartList->clear();
|
||||
|
||||
cPartGroup* lpPartGroup = qvariant_cast<cPartGroup*>(ui->m_lpGroupList->currentData(Qt::UserRole));
|
||||
if(!lpPartGroup)
|
||||
return;
|
||||
|
||||
if(m_lpPartList)
|
||||
{
|
||||
for(int x = 0;x < m_lpPartList->count();x++)
|
||||
{
|
||||
if(lpPartGroup == m_lpPartList->at(x)->partGroup())
|
||||
ui->m_lpPartList->addItem(m_lpPartList->at(x)->name(), QVariant::fromValue(m_lpPartList->at(x)));
|
||||
}
|
||||
}
|
||||
fillDistributorList();
|
||||
}
|
||||
|
||||
void cPartlistItemEditDialog::fillDistributorList()
|
||||
{
|
||||
ui->m_lpDistributorList->clear();
|
||||
|
||||
@@ -33,6 +33,7 @@ public:
|
||||
qreal price();
|
||||
QString description();
|
||||
private slots:
|
||||
void on_m_lpGroupList_currentIndexChanged(int index);
|
||||
void on_m_lpPartList_currentIndexChanged(int index);
|
||||
void on_m_lpDistributorList_currentIndexChanged(int index);
|
||||
|
||||
@@ -43,6 +44,7 @@ private:
|
||||
cPartList* m_lpPartList;
|
||||
cPartDistributorList* m_lpPartDistributorList;
|
||||
|
||||
void fillPartList();
|
||||
void fillDistributorList();
|
||||
};
|
||||
|
||||
|
||||
+50
-39
@@ -18,28 +18,35 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_4" columnstretch="0,1,0,1">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Price:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="m_lpPrice">
|
||||
<property name="maximum">
|
||||
<double>9999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Part:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="3">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Price:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="m_lpPrice">
|
||||
<property name="maximum">
|
||||
<double>9999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Order state:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="3">
|
||||
<widget class="QTreeWidget" name="m_lpReplacement">
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
@@ -51,21 +58,10 @@
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Order state:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="3" column="3">
|
||||
<widget class="QComboBox" name="m_lpOrderState"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Distributor:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Replacement:</string>
|
||||
@@ -75,16 +71,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QComboBox" name="m_lpOrderState"/>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="3">
|
||||
<widget class="QComboBox" name="m_lpPartList"/>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="3">
|
||||
<item row="2" column="1" colspan="3">
|
||||
<widget class="QComboBox" name="m_lpDistributorList"/>
|
||||
</item>
|
||||
<item row="4" column="2" colspan="2">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Distributor:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="3">
|
||||
<widget class="QComboBox" name="m_lpPartList"/>
|
||||
</item>
|
||||
<item row="5" column="2" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Description</string>
|
||||
@@ -96,7 +96,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Reference</string>
|
||||
@@ -108,6 +108,16 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Group:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="3">
|
||||
<widget class="QComboBox" name="m_lpGroupList"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@@ -125,6 +135,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>m_lpGroupList</tabstop>
|
||||
<tabstop>m_lpPartList</tabstop>
|
||||
<tabstop>m_lpDistributorList</tabstop>
|
||||
<tabstop>m_lpPrice</tabstop>
|
||||
|
||||
+1
-1
@@ -297,7 +297,7 @@ bool cPartlistWindow::save(qint32 id)
|
||||
query.bindValue(":distributorID", lpDistributor->id());
|
||||
query.bindValue(":replaceID", QVariant::Int);
|
||||
query.bindValue(":reference", lpReferenceItem->text());
|
||||
query.bindValue(":state", lpStateItem->text());
|
||||
query.bindValue(":state", cPartlistItem::state(lpStateItem->text()));
|
||||
query.bindValue(":description", lpDescriptionItem->text());
|
||||
query.bindValue(":price", lpPriceItem->text().toDouble());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user