2018-06-01 09:36:01 +00:00
|
|
|
#include <QtWidgets/QtWidgets>
|
|
|
|
#include "QTelSalePolicyInfoInputWidget.h"
|
|
|
|
#include "QRapidInputWidget.h"
|
|
|
|
#include "SystemDataQuery.h"
|
|
|
|
#include "SystemData.h"
|
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
QTelSalePolicyInfoInputWidget::QTelSalePolicyInfoInputWidget( QWidget * parent )
|
|
|
|
: QWidget( parent )
|
2018-06-01 09:36:01 +00:00
|
|
|
{
|
2018-06-01 10:21:26 +00:00
|
|
|
setupUi( this );
|
2018-06-01 09:36:01 +00:00
|
|
|
|
|
|
|
init();
|
|
|
|
initWidget();
|
|
|
|
initSignal();
|
|
|
|
initData();
|
|
|
|
}
|
|
|
|
|
|
|
|
QTelSalePolicyInfoInputWidget::~QTelSalePolicyInfoInputWidget()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTelSalePolicyInfoInputWidget::init()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTelSalePolicyInfoInputWidget::initWidget()
|
|
|
|
{
|
|
|
|
setLayout( pLayoutMain );
|
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
//单笔录入窗口
|
2018-06-01 09:36:01 +00:00
|
|
|
pTabWidget->widget( 0 )->setLayout( pLayoutInputMain );
|
|
|
|
|
|
|
|
pScrollAreaInput->setWidget( pWidgetInput );
|
|
|
|
|
|
|
|
pWidgetInput->setLayout( pLayoutInfoDetail );
|
|
|
|
pWidgetInput->setMaximumWidth( 820 );
|
|
|
|
pWidgetInput->setMinimumWidth( 820 );
|
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
//批量录入
|
2018-06-01 09:36:01 +00:00
|
|
|
QRapidInputWidget * pWidgetRapid = new QRapidInputWidget;
|
|
|
|
|
|
|
|
pScrollAreaRapid->setWidget( pWidgetRapid );
|
|
|
|
|
|
|
|
pTabWidget->widget( 1 )->setLayout( pLayoutRapid );
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTelSalePolicyInfoInputWidget::initSignal()
|
|
|
|
{
|
2018-06-01 10:21:26 +00:00
|
|
|
connect( pEditSalerCode, SIGNAL(editingFinished()), this, SLOT(onQuerySalerName()) );
|
2018-06-01 09:36:01 +00:00
|
|
|
connect( pEditSalerCode, SIGNAL(textChanged(const QString &)), this, SLOT(onSalerCodeChanged()) );
|
2018-06-01 10:21:26 +00:00
|
|
|
connect( pEditAutoTraderCode, SIGNAL(editingFinished()), this, SLOT(onQueryAutoTraderName()) );
|
2018-06-01 09:36:01 +00:00
|
|
|
connect( pEditAutoTraderCode, SIGNAL(textChanged(const QString &)), this, SLOT(onAutoTraderCodeChanged()) );
|
|
|
|
connect( pButtonSave, SIGNAL(clicked()), this, SLOT(onSavePolicy()) );
|
|
|
|
connect( pButtonResetGift, SIGNAL(clicked()), this, SLOT(onResetGiftsTable()) );
|
|
|
|
connect( pButtonReset, SIGNAL(clicked()), this, SLOT(onReset()) );
|
|
|
|
connect( pTableGifts, SIGNAL(cellChanged(int,int)), this, SLOT(onGiftTableItemChanged(int, int)) );
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTelSalePolicyInfoInputWidget::initData()
|
|
|
|
{
|
2018-06-01 10:21:26 +00:00
|
|
|
//默认的车商代码
|
2018-06-15 06:35:27 +00:00
|
|
|
pEditAutoTraderCode->setText( QString::fromLocal8Bit( pParameters->getParameter( "默认车商代码" ).c_str() ) );
|
2018-06-01 09:36:01 +00:00
|
|
|
|
|
|
|
emit pEditAutoTraderCode->editingFinished();
|
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
//初始化礼品列表
|
2018-06-01 09:36:01 +00:00
|
|
|
InitGiftTable();
|
|
|
|
|
|
|
|
pEditQjxPolicySerial->clear();
|
|
|
|
pEditBizPolicySerial->clear();
|
|
|
|
pEditSalerCode->clear();
|
|
|
|
pEditSalerName->clear();
|
|
|
|
pEditDeptCode->clear();
|
|
|
|
pEditDeptName->clear();
|
|
|
|
pEditOfficeCode->clear();
|
|
|
|
pEditOfficeName->clear();
|
|
|
|
pComboBoxAutotraderCall->setCurrentIndex( 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTelSalePolicyInfoInputWidget::InitGiftTable()
|
|
|
|
{
|
2018-06-01 10:21:26 +00:00
|
|
|
//设置标志位
|
2018-06-01 09:36:01 +00:00
|
|
|
m_initing = true;
|
|
|
|
|
2018-06-15 02:19:41 +00:00
|
|
|
giftsList.clear();
|
2018-06-01 09:36:01 +00:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2018-06-15 02:19:41 +00:00
|
|
|
queryTelsalePolicyGifts( giftsList );
|
2018-06-01 09:36:01 +00:00
|
|
|
}
|
2018-06-01 10:21:26 +00:00
|
|
|
catch ( runtime_error & error )
|
2018-06-01 09:36:01 +00:00
|
|
|
{
|
2018-06-01 10:21:26 +00:00
|
|
|
QMessageBox::critical( this, QString::fromLocal8Bit( "获取礼品列表出错!" ), error.what() );
|
2018-06-01 09:36:01 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
pTableGifts->clearContents();
|
|
|
|
pTableGifts->setColumnWidth( 0, 200 );
|
2018-06-15 02:19:41 +00:00
|
|
|
pTableGifts->setRowCount( giftsList.size() + 2 );
|
2018-06-01 09:36:01 +00:00
|
|
|
|
2018-06-15 02:19:41 +00:00
|
|
|
vector<TelSalePolicyGift>::iterator iter = giftsList.begin();
|
2018-06-01 09:36:01 +00:00
|
|
|
|
2018-06-15 02:19:41 +00:00
|
|
|
for ( unsigned int rowIndex = 0; iter != giftsList.end(); rowIndex++ )
|
2018-06-01 09:36:01 +00:00
|
|
|
{
|
2018-06-01 10:21:26 +00:00
|
|
|
QTableWidgetItem * pItem = new QTableWidgetItem();
|
2018-06-01 09:36:01 +00:00
|
|
|
|
|
|
|
pItem->setCheckState( Qt::Unchecked );
|
2018-06-01 10:21:26 +00:00
|
|
|
pItem->setFlags( Qt::ItemIsUserCheckable | Qt::ItemIsEnabled );
|
|
|
|
pItem->setText( QString::fromLocal8Bit( iter->GiftName().c_str() ) );
|
2018-06-01 09:36:01 +00:00
|
|
|
pItem->setTextAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
|
|
|
|
|
|
|
pTableGifts->setItem( rowIndex, 0, pItem );
|
|
|
|
|
|
|
|
pItem = new QTableWidgetItem();
|
|
|
|
|
|
|
|
pItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsEditable );
|
2018-06-01 10:21:26 +00:00
|
|
|
pItem->setText( QString::fromLocal8Bit( iter->GiftDefaultPrice().c_str() ) );
|
2018-06-01 09:36:01 +00:00
|
|
|
pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
|
|
|
|
|
|
|
|
pTableGifts->setItem( rowIndex, 1, pItem );
|
|
|
|
|
|
|
|
++iter;
|
|
|
|
}
|
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
//其他
|
|
|
|
QTableWidgetItem * pItemOther = new QTableWidgetItem();
|
2018-06-01 09:36:01 +00:00
|
|
|
QTableWidgetItem * pItemOtherPrice = new QTableWidgetItem();
|
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
pItemOther->setText( QString::fromLocal8Bit( "其他" ) );
|
2018-06-01 09:36:01 +00:00
|
|
|
pItemOther->setCheckState( Qt::Unchecked );
|
2018-06-01 10:21:26 +00:00
|
|
|
pItemOther->setFlags( Qt::ItemIsUserCheckable | Qt::ItemIsEnabled );
|
2018-06-01 09:36:01 +00:00
|
|
|
pItemOther->setTextAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
|
|
|
|
|
|
|
pItemOtherPrice->setText( "0" );
|
|
|
|
pItemOtherPrice->setFlags( Qt::ItemIsEnabled | Qt::ItemIsEditable );
|
|
|
|
pItemOtherPrice->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
|
|
|
|
|
2018-06-15 02:19:41 +00:00
|
|
|
pTableGifts->setItem( giftsList.size(), 0, pItemOther );
|
|
|
|
pTableGifts->setItem( giftsList.size(), 1, pItemOtherPrice );
|
2018-06-01 09:36:01 +00:00
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
//礼品总价值
|
|
|
|
QTableWidgetItem * pItemTotalPrice = new QTableWidgetItem();
|
2018-06-01 09:36:01 +00:00
|
|
|
QTableWidgetItem * pItemTotalPriceAmount = new QTableWidgetItem();
|
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
pItemTotalPrice->setText( QString::fromLocal8Bit( "礼品总价值" ) );
|
2018-06-01 09:36:01 +00:00
|
|
|
pItemTotalPrice->setTextColor( Qt::red );
|
|
|
|
pItemTotalPrice->setFlags( Qt::ItemIsEnabled );
|
|
|
|
pItemTotalPrice->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
|
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
pItemTotalPriceAmount->setText( QString::fromLocal8Bit( "0 元" ) );
|
2018-06-01 09:36:01 +00:00
|
|
|
pItemTotalPriceAmount->setTextColor( Qt::red );
|
|
|
|
pItemTotalPriceAmount->setFlags( Qt::ItemIsEnabled );
|
|
|
|
pItemTotalPriceAmount->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
|
|
|
|
|
2018-06-15 02:19:41 +00:00
|
|
|
pTableGifts->setItem( giftsList.size() + 1, 0, pItemTotalPrice );
|
|
|
|
pTableGifts->setItem( giftsList.size() + 1, 1, pItemTotalPriceAmount );
|
2018-06-01 09:36:01 +00:00
|
|
|
|
|
|
|
pTableGifts->resizeColumnsToContents();
|
|
|
|
|
|
|
|
m_initing = false;
|
|
|
|
}
|
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
void QTelSalePolicyInfoInputWidget::readGiftTable( vector<TelSalePolicyGift> & giftList )
|
2018-06-01 09:36:01 +00:00
|
|
|
{
|
|
|
|
int rowCount = pTableGifts->rowCount();
|
|
|
|
|
|
|
|
for ( int rowIndex = 0; rowIndex < rowCount; rowIndex++ )
|
|
|
|
{
|
2018-06-01 10:21:26 +00:00
|
|
|
QTableWidgetItem * pItemName = pTableGifts->item( rowIndex, 0 );
|
2018-06-01 09:36:01 +00:00
|
|
|
QTableWidgetItem * pItemPrice = pTableGifts->item( rowIndex, 1 );
|
|
|
|
|
|
|
|
if ( pItemName->checkState() == Qt::Unchecked )
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
TelSalePolicyGift gift( rowIndex,
|
|
|
|
string( pItemName->text().toLocal8Bit().data() ),
|
|
|
|
string( pItemPrice->text().toLocal8Bit().data() ) );
|
2018-06-01 09:36:01 +00:00
|
|
|
|
|
|
|
giftList.push_back( gift );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTelSalePolicyInfoInputWidget::onSalerCodeChanged()
|
|
|
|
{
|
|
|
|
pEditSalerName->clear();
|
|
|
|
pEditDeptName->clear();
|
|
|
|
pEditDeptCode->clear();
|
|
|
|
pEditOfficeName->clear();
|
|
|
|
pEditOfficeCode->clear();
|
|
|
|
|
2018-06-15 02:19:41 +00:00
|
|
|
salerCode.clear();
|
|
|
|
salerName.clear();
|
|
|
|
salerDeptCode.clear();
|
|
|
|
salerDeptName.clear();
|
2018-06-01 09:36:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTelSalePolicyInfoInputWidget::onQuerySalerName()
|
|
|
|
{
|
2018-06-15 02:19:41 +00:00
|
|
|
salerCode = pEditSalerCode->text().trimmed().toUpper().toLocal8Bit().data();
|
|
|
|
|
2018-06-15 07:32:41 +00:00
|
|
|
query_staff_info( salerCode,
|
2018-06-15 02:19:41 +00:00
|
|
|
salerName,
|
|
|
|
salerDeptCode,
|
|
|
|
salerDeptName,
|
|
|
|
salerOfficeCode,
|
|
|
|
salerOfficeName );
|
|
|
|
|
|
|
|
pEditSalerName->setText( QString::fromLocal8Bit( salerName.c_str() ) );
|
|
|
|
pEditOfficeCode->setText( QString::fromLocal8Bit( salerOfficeCode.c_str() ) );
|
|
|
|
pEditOfficeName->setText( QString::fromLocal8Bit( salerOfficeName.c_str() ) );
|
|
|
|
pEditDeptCode->setText( QString::fromLocal8Bit( salerDeptCode.c_str() ) );
|
|
|
|
pEditDeptName->setText( QString::fromLocal8Bit( salerDeptName.c_str() ) );
|
2018-06-01 09:36:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTelSalePolicyInfoInputWidget::onSavePolicy()
|
|
|
|
{
|
|
|
|
string strJqxPolicySerial = pEditQjxPolicySerial->text().trimmed().toLocal8Bit().data();
|
|
|
|
string strBizPolicySerial = pEditBizPolicySerial->text().trimmed().toLocal8Bit().data();
|
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
int iAutotraderCallIndex = pComboBoxAutotraderCall->currentIndex();
|
2018-06-01 09:36:01 +00:00
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
vector<TelSalePolicyGift> giftsList; //用户选择的礼品清单
|
2018-06-01 09:36:01 +00:00
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
//触发信号
|
2018-06-01 09:36:01 +00:00
|
|
|
emit pEditSalerCode->editingFinished();
|
|
|
|
emit pEditAutoTraderCode->editingFinished();
|
|
|
|
|
|
|
|
if ( strJqxPolicySerial.empty() && strBizPolicySerial.empty() )
|
|
|
|
{
|
2018-06-01 10:21:26 +00:00
|
|
|
QMessageBox::critical( this,
|
|
|
|
QString::fromLocal8Bit( "必须输入保单号" ),
|
|
|
|
QString::fromLocal8Bit( "交强险、商业险保单号皆为空,\n必须输入一个保单号!" ),
|
|
|
|
QMessageBox::Yes );
|
2018-06-01 09:36:01 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-06-15 02:19:41 +00:00
|
|
|
if ( salerName.empty() == true )
|
2018-06-01 09:36:01 +00:00
|
|
|
{
|
2018-06-01 10:21:26 +00:00
|
|
|
QMessageBox::critical( this,
|
|
|
|
QString::fromLocal8Bit( "必须输入经办人代码" ),
|
|
|
|
QString::fromLocal8Bit( "经办人代码不正确!" ),
|
|
|
|
QMessageBox::Yes );
|
2018-06-01 09:36:01 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
if ( iAutotraderCallIndex == 0 )
|
|
|
|
{
|
|
|
|
QMessageBox::critical( this,
|
|
|
|
QString::fromLocal8Bit( "输入错误" ),
|
|
|
|
QString::fromLocal8Bit( "未选择是否车店联呼!" ),
|
|
|
|
QMessageBox::Yes );
|
2018-06-01 09:36:01 +00:00
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
return;
|
|
|
|
}
|
2018-06-01 09:36:01 +00:00
|
|
|
|
|
|
|
if ( pEditAutoTraderName->text().isEmpty() )
|
|
|
|
{
|
2018-06-01 10:21:26 +00:00
|
|
|
QMessageBox::critical( this,
|
|
|
|
QString::fromLocal8Bit( "输入错误" ),
|
|
|
|
QString::fromLocal8Bit( "车商代码错误!" ),
|
|
|
|
QMessageBox::Yes );
|
2018-06-01 09:36:01 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
if ( pGroupBoxGift->isChecked() == true )
|
|
|
|
{
|
|
|
|
readGiftTable( giftsList );
|
2018-06-01 09:36:01 +00:00
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
if ( giftsList.size() == 0 )
|
|
|
|
{
|
|
|
|
QMessageBox::critical( this,
|
|
|
|
QString::fromLocal8Bit( "输入错误" ),
|
|
|
|
QString::fromLocal8Bit( "未选择礼品!" ),
|
|
|
|
QMessageBox::Yes );
|
2018-06-01 09:36:01 +00:00
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2018-06-01 09:36:01 +00:00
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
SPolicyRecord policy; //保单信息
|
2018-06-01 09:36:01 +00:00
|
|
|
|
2018-06-15 02:19:41 +00:00
|
|
|
policy.strSalerCode = salerCode;
|
|
|
|
policy.strSalerName = salerName;
|
|
|
|
policy.strSalerDeptCode = salerDeptCode;
|
|
|
|
policy.strSalerDeptName = salerDeptName;
|
|
|
|
policy.strSalerOfficeCode = salerOfficeCode;
|
|
|
|
policy.strSalerOfficeName = salerOfficeName;
|
2018-06-01 10:21:26 +00:00
|
|
|
policy.strOperatorCode = getUserCode();
|
|
|
|
policy.strCustomerName = pEditCustomerName->text().trimmed().toLocal8Bit().data();
|
|
|
|
policy.strPlateSerial = pEditPlateSerial->text().trimmed().toLocal8Bit().data();
|
|
|
|
policy.strFrameSerial = pEditFrameSerial->text().trimmed().toLocal8Bit().data();
|
|
|
|
policy.strEngineSerial = pEditEngineSerial->text().trimmed().toLocal8Bit().data();
|
|
|
|
policy.strOperatorDate = QDate::currentDate()
|
|
|
|
.toString( QString::fromLocal8Bit( "MM/dd/yyyy" ) ).toLocal8Bit().data();
|
|
|
|
|
|
|
|
if ( iAutotraderCallIndex == 2 )
|
|
|
|
{
|
|
|
|
policy.bIsAutotraderCall = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
policy.bIsAutotraderCall = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//车商代码
|
2018-06-15 02:19:41 +00:00
|
|
|
if ( autoTraderName.empty() == false )
|
2018-06-01 09:36:01 +00:00
|
|
|
{
|
2018-06-15 02:19:41 +00:00
|
|
|
policy.strAutoTraderCode = autoTraderCode;
|
|
|
|
policy.strAutoTraderName = autoTraderName;
|
2018-06-01 09:36:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( strJqxPolicySerial.empty() == false )
|
|
|
|
{
|
2018-06-01 10:21:26 +00:00
|
|
|
//处理交强险保单
|
2018-06-01 09:36:01 +00:00
|
|
|
policy.strPolicySerial = strJqxPolicySerial;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
SaveTelSalePolicyInfo( policy, giftsList );
|
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
QMessageBox::information( this,
|
|
|
|
QString::fromLocal8Bit( "保存成功!" ),
|
|
|
|
QString::fromLocal8Bit( "交强险保单保存成功!" ),
|
|
|
|
QMessageBox::Yes );
|
2018-06-01 09:36:01 +00:00
|
|
|
}
|
|
|
|
catch ( runtime_error & error )
|
|
|
|
{
|
2018-06-01 10:21:26 +00:00
|
|
|
QMessageBox::critical( this,
|
|
|
|
QString::fromLocal8Bit( "保存交强险保单失败!" ),
|
|
|
|
QString::fromLocal8Bit( error.what() ),
|
|
|
|
QMessageBox::Yes );
|
2018-06-01 09:36:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( strBizPolicySerial.empty() == false )
|
|
|
|
{
|
2018-06-01 10:21:26 +00:00
|
|
|
//处理交强险保单
|
2018-06-01 09:36:01 +00:00
|
|
|
policy.strPolicySerial = strBizPolicySerial;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
SaveTelSalePolicyInfo( policy, giftsList );
|
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
QMessageBox::information( this,
|
|
|
|
QString::fromLocal8Bit( "保存成功!" ),
|
|
|
|
QString::fromLocal8Bit( "商业险保单保存成功!" ),
|
|
|
|
QMessageBox::Yes );
|
2018-06-01 09:36:01 +00:00
|
|
|
}
|
|
|
|
catch ( runtime_error & error )
|
|
|
|
{
|
2018-06-01 10:21:26 +00:00
|
|
|
QMessageBox::critical( this,
|
|
|
|
QString::fromLocal8Bit( "保存商业险保单失败!" ),
|
|
|
|
QString::fromLocal8Bit( error.what() ),
|
|
|
|
QMessageBox::Yes );
|
|
|
|
}
|
2018-06-01 09:36:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTelSalePolicyInfoInputWidget::onResetGiftsTable()
|
|
|
|
{
|
|
|
|
InitGiftTable();
|
|
|
|
}
|
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
void QTelSalePolicyInfoInputWidget::onGiftTableItemChanged( int row, int column )
|
2018-06-01 09:36:01 +00:00
|
|
|
{
|
|
|
|
if ( m_initing == true )
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
int rowCount = pTableGifts->rowCount() - 1;
|
|
|
|
QTableWidgetItem * pItem = NULL;
|
2018-06-01 09:36:01 +00:00
|
|
|
QTableWidgetItem * pItemPrice = NULL;
|
2018-06-01 10:21:26 +00:00
|
|
|
bool isSuccess = false;
|
|
|
|
double giftPrice = 0.0l;
|
2018-06-01 09:36:01 +00:00
|
|
|
|
|
|
|
if ( column == 1 && row != rowCount )
|
|
|
|
{
|
2018-06-01 10:21:26 +00:00
|
|
|
pItem = pTableGifts->item( row, 0 );
|
2018-06-01 09:36:01 +00:00
|
|
|
pItemPrice = pTableGifts->item( row, column );
|
|
|
|
|
|
|
|
pItemPrice->text().toDouble( &isSuccess );
|
|
|
|
|
|
|
|
if ( isSuccess == false )
|
|
|
|
{
|
2018-06-01 10:21:26 +00:00
|
|
|
QMessageBox::critical( this,
|
|
|
|
QString::fromLocal8Bit( "输入错误!" ),
|
|
|
|
pItem->text() + QString::fromLocal8Bit( "价格有误!" ) );
|
2018-06-01 09:36:01 +00:00
|
|
|
|
|
|
|
pItemPrice->setText( "0" );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( int rowIndex = 0; rowIndex < rowCount; rowIndex++ )
|
|
|
|
{
|
2018-06-01 10:21:26 +00:00
|
|
|
pItem = pTableGifts->item( rowIndex, 0 );
|
2018-06-01 09:36:01 +00:00
|
|
|
pItemPrice = pTableGifts->item( rowIndex, 1 );
|
|
|
|
|
|
|
|
if ( pItem->checkState() == Qt::Unchecked )
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
giftPrice += pItemPrice->text().toDouble( &isSuccess );
|
|
|
|
|
|
|
|
if ( isSuccess == false )
|
|
|
|
{
|
2018-06-01 10:21:26 +00:00
|
|
|
QMessageBox::critical( this,
|
|
|
|
QString::fromLocal8Bit( "输入错误!" ),
|
|
|
|
pItem->text() + QString::fromLocal8Bit( "价格有误!" ) );
|
2018-06-01 09:36:01 +00:00
|
|
|
|
|
|
|
pItemPrice->setText( "0" );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
pTableGifts->item( pTableGifts->rowCount() - 1, 1 )->setText( QString::fromLocal8Bit( "%1 元" ).arg( giftPrice ) );
|
2018-06-01 09:36:01 +00:00
|
|
|
pTableGifts->resizeColumnsToContents();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTelSalePolicyInfoInputWidget::onAutoTraderCodeChanged()
|
|
|
|
{
|
|
|
|
pEditAutoTraderName->clear();
|
|
|
|
|
2018-06-15 02:19:41 +00:00
|
|
|
autoTraderName.clear();
|
2018-06-01 09:36:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTelSalePolicyInfoInputWidget::onQueryAutoTraderName()
|
|
|
|
{
|
2018-06-15 02:19:41 +00:00
|
|
|
autoTraderCode = pEditAutoTraderCode->text().trimmed().toUpper().toLocal8Bit().data();
|
2018-06-01 09:36:01 +00:00
|
|
|
|
2018-06-15 07:32:41 +00:00
|
|
|
query_auto_trader_info( autoTraderCode, autoTraderName );
|
2018-06-01 09:36:01 +00:00
|
|
|
|
2018-06-15 02:19:41 +00:00
|
|
|
pEditAutoTraderName->setText( QString::fromLocal8Bit( autoTraderName.c_str() ) );
|
2018-06-01 09:36:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTelSalePolicyInfoInputWidget::onReset()
|
|
|
|
{
|
|
|
|
initData();
|
|
|
|
}
|