jsp版本

This commit is contained in:
2018-06-19 15:52:20 +08:00
parent 2a78cfca33
commit e3518aa05a
132 changed files with 1259 additions and 1 deletions

View File

@@ -0,0 +1,599 @@
#include <SQLAPI.h>
#include <string>
#include <sstream>
#include <exception>
#include <stdlib.h>
#include <libxl.h>
#include "DataManipulation.h"
#include "SystemDataQuery.h"
#include "StringCodeConverter.h"
//#pragma comment( lib, "user32.lib")
//#pragma comment( lib, "version.lib")
//#pragma comment( lib, "oleaut32.lib")
//#pragma comment( lib, "ole32.lib")
//#pragma comment( lib, "libxl.lib")
// #ifdef _DEBUG
// #pragma comment( lib, "sqlapisd.lib")
// #else
// #pragma comment( lib, "sqlapis.lib")
// #endif
const char g_cszConnectStringIDS6[] =
"DRIVER={};"
"PROTOCOL=onsoctcp;"
"SERVICE=16191;"
"SERVER=xmcx1;"
"HOST=10.39.0.91;"
"DATABASE=ids6;"
"DB_LOCALE=en_US.819;";
const static char g_szUserNameIDS6[] = "ccx99";
const static char g_szPasswordIDS6[] = "c91IT09";
const static char g_cszConnstringYwgl[] =
"DRIVER={};"
"PROTOCOL=onsoctcp;"
"SERVICE=16192;"
"SERVER=xmcx2;"
"HOST=10.39.0.92;"
"DATABASE=ywgl_xm;"
"DB_LOCALE=en_US.819;";
const static char g_cszUserNameYwgl[] = "ccx99";
const static char g_cszPasswordYwgl[] = "c92IT09";
void queryTelsalePolicyGifts(vector<TelSalePolicyGift>& giftList)
{
SAConnection connection;
SACommand command;
string strSQL = "select id, trim(name), default_price from w_dx_gifts";
command.setConnection(&connection);
command.setCommandText(strSQL.c_str());
try
{
connection.Connect(g_cszConnstringYwgl,
g_cszUserNameYwgl,
g_cszPasswordYwgl,
SA_Informix_Client);
command.Execute();
}
catch (SAException& error)
{
throw runtime_error(error.ErrText());
}
while (command.FetchNext())
{
TelSalePolicyGift gift;
gift.Id(command.Field(1).asLong());
gift.GiftName((const char *)(command.Field(2).asString()));
gift.GiftDefaultPrice((const char *)(command.Field(3).asString()));
giftList.push_back(gift);
}
connection.Disconnect();
}
void SaveTelSalePolicyInfo(const SPolicyRecord& policy, const vector<TelSalePolicyGift>& giftList)
{
if (policy.strPolicySerial.empty() == true)
{
throw invalid_argument("保单号为空!");
}
if (policy.strSalerCode.empty() == true)
{
throw invalid_argument("保单号为空!");
}
ostringstream ostrCommand;
string strAutotraderCall;
//车店联呼
if (policy.bIsAutotraderCall == true)
{
strAutotraderCall = "1";
}
else
{
strAutotraderCall = "0";
}
ostrCommand <<
"insert into w_dxbd_i ( jjbj, khjl, khjllx, bdh, zhjywy, zhjywymc, zhjywybm, zhjywybmm, kshdm, kshmc, czydm, czrq , chdlh, chshdm, chshmc, khmc, chph, chjh, fdjh ) "
"values( 1, 0, 0, "
<< "trim('" << policy.strPolicySerial << "'), "
<< "trim('" << policy.strSalerCode << "'), "
<< "trim('" << policy.strSalerName << "'), "
<< "trim('" << policy.strSalerDeptCode << "'), "
<< "trim('" << policy.strSalerDeptName << "'), "
<< "trim('" << policy.strSalerOfficeCode << "'), "
<< "trim('" << policy.strSalerOfficeName << "'), "
<< "trim('" << policy.strOperatorCode << "'), "
<< "today, "
<< "'" << strAutotraderCall << "'";
if (policy.strAutoTraderCode.empty() == false)
{
ostrCommand << ", '" << policy.strAutoTraderCode << "'";
ostrCommand << ", '" << policy.strAutoTraderName << "'";
}
else
{
ostrCommand << ", NULL, NULL";
}
if (policy.strCustomerName.empty() == false)
{
ostrCommand << ", '" << policy.strCustomerName << "'";
}
else
{
ostrCommand << ", NULL";
}
if (policy.strPlateSerial.empty() == false)
{
ostrCommand << ", '" << policy.strPlateSerial << "'";
}
else
{
ostrCommand << ", NULL";
}
if (policy.strFrameSerial.empty() == false)
{
ostrCommand << ", '" << policy.strFrameSerial << "'";
}
else
{
ostrCommand << ", NULL";
}
if (policy.strEngineSerial.empty() == false)
{
ostrCommand << ", '" << policy.strEngineSerial << "'";
}
else
{
ostrCommand << ", NULL";
}
ostrCommand << " )";
string strCommand = ostrCommand.str();
SAConnection conn;
SACommand command;
command.setConnection(&conn);
command.setCommandText(strCommand.c_str());
try
{
conn.Connect(
g_cszConnstringYwgl,
g_cszUserNameYwgl,
g_cszPasswordYwgl,
SA_Informix_Client);
//conn.setAutoCommit( SA_AutoCommitOff ); //导致锁表
//保存保单
command.Execute();
//保存礼品列表,先删除旧数据
command.setCommandText("delete w_dxbd_gift_i where bdh = :1 ");
command.Param(1).setAsString() = policy.strPolicySerial.c_str();
command.Execute();
command.setCommandText("insert into w_dxbd_gift_i ( bdh, gift_name, gift_price ) values ( :1, :2, :3 )");
for (vector<TelSalePolicyGift>::const_iterator iter = giftList.begin(); iter != giftList.end(); ++iter)
{
command.Param(1).setAsString() = policy.strPolicySerial.c_str();
command.Param(2).setAsString() = iter->GiftName().c_str();
command.Param(3).setAsString() = iter->GiftDefaultPrice().c_str();
command.Execute();
}
conn.Commit();
}
catch (SAException& error)
{
conn.Rollback();
conn.Disconnect();
throw runtime_error(error.ErrText());
}
conn.Disconnect();
}
void QueryTelSalePolicyInfo(const string& strPolicyNo,
const string& strOperatorCode,
const string& strStartDate,
const string& strEndDate,
vector<SPolicyQuery>& vPolicyInfo)
{
SACommand command;
SAConnection connection;
SPolicyQuery policy;
string strSQL =
"select trim(bdh) bdh, trim(zhjywy) zhjywy, to_char(czrq, '%Y年%m月%d日') czrq, trim(czydm) czydm, chdlh, zhjywybmm, kshmc, chshdm, chshmc "
" from w_dxbd_i "
" where 1=1 ";
if (!strPolicyNo.empty())
{
strSQL.append("and bdh = '");
strSQL.append(strPolicyNo);
strSQL.append("' ");
}
if (!strOperatorCode.empty())
{
strSQL.append("and czydm = '");
strSQL.append(strOperatorCode);
strSQL.append("' ");
}
if (!strStartDate.empty())
{
strSQL.append("and czrq >= '");
strSQL.append(strStartDate);
strSQL.append("' ");
}
if (!strEndDate.empty())
{
strSQL.append("and czrq <= '");
strSQL.append(strEndDate);
strSQL.append("' ");
}
try
{
command.setCommandText(strSQL.c_str());
command.setConnection(&connection);
connection.Connect(
g_cszConnstringYwgl,
g_cszUserNameYwgl,
g_cszPasswordYwgl,
SA_Informix_Client);
command.Execute();
while (command.FetchNext())
{
policy.strPolicySerial = command.Field("bdh").asString();
policy.strSalerCode = command.Field("zhjywy").asString();
policy.strDeptName = command.Field("zhjywybmm").asString();
policy.strOfficeName = command.Field("kshmc").asString();
policy.strAutoTraderCode = command.Field("chshdm").asString();
policy.strAutoTraderName = command.Field("chshmc").asString();
policy.strInputDate = command.Field("czrq").asString();
policy.strCDLH = command.Field("chdlh").asString();
QueryPolicyGifts(policy.strPolicySerial, policy.strGifts, policy.dGiftPriceSum);
vPolicyInfo.push_back(policy);
}
connection.Disconnect();
}
catch (SAException& error)
{
throw runtime_error(error.ErrText());
}
}
void QueryPolicyGifts(const string& strPolicyNo, string& strGifts, double dGiftPriceSum)
{
SAConnection connection;
SACommand command;
string strSQL =
"select gift_name, gift_price "
" from w_dxbd_gift_i "
" where bdh = '" + strPolicyNo + "'";
string strSQLSum =
"select sum( gift_price ) "
" from w_dxbd_gift_i "
" where bdh = '" + strPolicyNo + "'";
try
{
command.setConnection(&connection);
command.setCommandText(strSQL.c_str());
connection.Connect(g_cszConnstringYwgl,
g_cszUserNameYwgl,
g_cszPasswordYwgl,
SA_Informix_Client);
command.Execute();
strGifts.clear();
dGiftPriceSum = 0.0;
while (command.FetchNext())
{
if (!strGifts.empty())
{
strGifts.append("; ");
}
strGifts.append(command.Field("gift_name").asString());
strGifts.append(" ");
strGifts.append(command.Field("gift_price").asString());
strGifts.append("");
dGiftPriceSum += command.Field("gift_price").asDouble();
}
/*command.setCommandText( strSQLSum.c_str() );
command.Execute();
if ( command.FetchNext() )
{
strGiftPriceSum = command.Field( 0 ).asString();
}*/
connection.Disconnect();
}
catch (SAException& error)
{
throw runtime_error(error.ErrText());
}
}
/*void readTelsaleXlsFile(const string strFilePath, vector<SPolicyRecord> & listPolicy, bool hasTitle, bool isXML )
{
Book * pBook = NULL;
Sheet * pSheet = NULL;
int iRowCount = 0;
int iRowIndex = 0;
if ( isXML == true )
{
pBook = xlCreateXMLBook();
}
else
{
pBook = xlCreateBook();
}
if ( pBook == NULL )
{
throw string("");
}
if ( pBook->load(strFilePath.c_str()) == NULL )
{
string strMessage = pBook->errorMessage();
throw string( strMessage );
}
pSheet = pBook->getSheet( 0 );
if ( pSheet == NULL )
{
throw string( "读取sheet失败" );
}
iRowCount = pSheet->lastRow();
if ( hasTitle == true )
{
iRowIndex = 1;
}
//读取数据
while ( iRowIndex < iRowCount )
{
SPolicyRecord policy;
CellType type = pSheet->cellType( iRowIndex, 4 );
policy.strSignDate = readXlsxCell( pSheet, iRowIndex, 0 );
policy.strPolicySerial = readXlsxCell( pSheet, iRowIndex, 1 );
policy.strPlateSerial = readXlsxCell( pSheet, iRowIndex, 2 );
policy.strCustomerName = readXlsxCell( pSheet, iRowIndex, 3 );
policy.strSalerCode = readXlsxCell( pSheet, iRowIndex, 4 );
//policy.strAutoTraderName = readXlsCell( pSheet, iRowIndex, 5 );
policy.strAutoTraderCode = readXlsxCell( pSheet, iRowIndex, 6 );
//补齐工号
if ( policy.strSalerCode.length() == 1 )
{
policy.strSalerCode = string("00") + policy.strSalerCode;
}
if ( policy.strSalerCode.length() == 2 )
{
policy.strSalerCode = string("0") + policy.strSalerCode;
}
policy.strOperatorCode = getUserCode();
query_auto_trader_info( policy.strAutoTraderCode, policy.strAutoTraderName );
query_staff_info( policy.strSalerCode,
policy.strSalerName,
policy.strSalerDeptCode,
policy.strSalerDeptName,
policy.strSalerOfficeCode,
policy.strSalerOfficeName );
listPolicy.push_back( policy );
iRowIndex++;
}
pBook->release();
}*/
string readXlsCell(ISheetT<char>* pSheet, int iRowIndex, int iColIndex)
{
string strCell;
char szNum[40];
int iCell;
if (pSheet == NULL)
{
throw string("");
}
CellType cellType = pSheet->cellType(iRowIndex, iColIndex);
switch (cellType)
{
case libxl::CELLTYPE_STRING:
strCell = pSheet->readStr(iRowIndex, iColIndex);
break;
case libxl::CELLTYPE_NUMBER:
memset(szNum, NULL, 40);
iCell = pSheet->readNum(iRowIndex, iColIndex);
sprintf_s(szNum, "%d", iCell);
strCell = szNum;
break;
default:
strCell = "";
}
return strCell;
}
string readXlsxCell(ISheetT<wchar_t>* pSheet, int iRowIndex, int iColIndex)
{
wstring strCell;
string strReturn;
char szNum[40];
int iCell;
if (pSheet == NULL)
{
throw string("");
}
CellType cellType = pSheet->cellType(iRowIndex, iColIndex);
switch (cellType)
{
case libxl::CELLTYPE_STRING:
strCell = pSheet->readStr(iRowIndex, iColIndex);
break;
case libxl::CELLTYPE_NUMBER:
memset(szNum, NULL, 40);
iCell = pSheet->readNum(iRowIndex, iColIndex);
sprintf_s(szNum, "%d", iCell);
strReturn = szNum;
break;
default:
strReturn = "";
}
StringCodeConverter::unicode2mbs(strCell, strReturn);
return strReturn;
}
void readTelsaleXlsxFile(const wstring& filePath, vector<SPolicyRecord>& listPolicy, bool hasTitle)
{
IBookT<wchar_t>* pBook = NULL;
ISheetT<wchar_t>* pSheet = NULL;
int iRowCount = 0;
int iRowIndex = 0;
pBook = xlCreateXMLBookW();
if (pBook == NULL)
{
throw string("");
}
if (pBook->load(filePath.data()) == false)
{
throw string("打开文件失败!");
}
pSheet = pBook->getSheet(0);
if (pSheet == NULL)
{
throw string("读取sheet失败");
}
iRowCount = pSheet->lastRow();
if (hasTitle == true)
{
iRowIndex = 1;
}
//读取数据
while (iRowIndex < iRowCount)
{
SPolicyRecord policy;
CellType type = pSheet->cellType(iRowIndex, 4);
policy.strSignDate = readXlsxCell(pSheet, iRowIndex, 0);
policy.strPolicySerial = readXlsxCell(pSheet, iRowIndex, 1);
policy.strPlateSerial = readXlsxCell(pSheet, iRowIndex, 2);
policy.strCustomerName = readXlsxCell(pSheet, iRowIndex, 3);
policy.strSalerCode = readXlsxCell(pSheet, iRowIndex, 4);
policy.strAutoTraderName = readXlsxCell(pSheet, iRowIndex, 6);
//补齐工号
if (policy.strSalerCode.length() == 1)
{
policy.strSalerCode = string("00") + policy.strSalerCode;
}
if (policy.strSalerCode.length() == 2)
{
policy.strSalerCode = string("0") + policy.strSalerCode;
}
policy.strOperatorCode = getUserCode();
query_staff_info(
policy.strSalerCode,
policy.strSalerName,
policy.strSalerDeptCode,
policy.strSalerDeptName,
policy.strSalerOfficeCode,
policy.strSalerOfficeName);
listPolicy.push_back(policy);
iRowIndex++;
}
pBook->release();
}

View File

@@ -0,0 +1,190 @@
/*!
* \file DataManipulation.h
* \date 2014/08/18 15:43
*
* \author Kane
* Contact: user@company.com
*
* \brief 转介绍数据处理
*
* TODO: long description
*
* \note
*/
#ifndef DataManipulation_h__
#define DataManipulation_h__
#include <libxl.h>
#include <string>
#include <QtCore/QString>
#include <vector>
#include <unordered_map>
#include "SystemData.h"
using namespace std;
using namespace libxl;
//准备废弃
typedef struct
{
string strPolicySerial;
string strSignDate;
string strSalerCode;
string strSalerName;
string strSalerDeptCode;
string strSalerDeptName;
string strSalerOfficeCode;
string strSalerOfficeName;
string strAutoTraderCode;
string strAutoTraderName;
string strCustomerName;
string strPlateSerial;
string strFrameSerial;
string strEngineSerial;
string strOperatorDate;
string strOperatorCode;
bool bIsAutotraderCall;
} SPolicyRecord;
class PolicyRecord
{
private:
QString policySerial;
QString signDate;
QString salerCode;
QString salerName;
QString salerDeptCode;
QString salerDeptName;
QString salerOfficeCode;
QString salerOfficeName;
QString autoTraderCode;
QString autoTraderName;
QString customerName;
QString plateSerial;
QString frameSerial;
QString engineSerial;
QString operatorDate;
QString operatorCode;
bool isAutotraderCall;
};
//准备废弃
typedef struct
{
string strPolicySerial;
string strSalerCode;
string strDeptName;
string strOfficeName;
string strCDLH;
string strAutoTraderCode;
string strAutoTraderName;
double dGiftPriceSum;
string strGifts;
string strInputDate;
} SPolicyQuery;
class TelSalePolicyGift
{
public:
TelSalePolicyGift()
{
};
TelSalePolicyGift(int id, const string & name, const string & defaultPrice) : m_id(id),
m_giftName(name),
m_giftDefaultPrice(defaultPrice)
{
}
inline int Id() const { return m_id; }
void Id(int val) { m_id = val; }
string GiftName() const { return m_giftName; }
void GiftName(string val) { m_giftName = val; }
string GiftDefaultPrice() const { return m_giftDefaultPrice; }
void GiftDefaultPrice(string val) { m_giftDefaultPrice = val; }
private:
int m_id;
string m_giftName;
string m_giftDefaultPrice;
};
//************************************
// Method: queryTelsalePolicyGifts
// FullName: queryTelsalePolicyGifts
// Access: public
// Returns: void
// Qualifier: 查询礼品信息
// Parameter: vector<TelSalePolicyGift> & giftList 礼品列表
//************************************
void queryTelsalePolicyGifts(vector<TelSalePolicyGift> & giftList);
//************************************
// Method: SaveTelSalePolicyInfo
// FullName: SaveTelSalePolicyInfo
// Access: public
// Returns: void
// Qualifier:
// Parameter: const SPolicyRecord & policy
// Parameter: const vector<TelSalePolicyGift> & giftList
//************************************
void SaveTelSalePolicyInfo(const SPolicyRecord & policy, const vector<TelSalePolicyGift> & giftList);
//************************************
// Method: QueryTelSalePolicyInfo
// FullName: QueryTelSalePolicyInfo
// Access: public
// Returns: void
// Qualifier:
// Parameter: const string & strPolicyNo
// Parameter: const string & strOperatorCode
// Parameter: const string & strStartDate
// Parameter: const string & strEndDate
// Parameter: vector<SPolicyQuery> & vPolicyInfo
//************************************
void QueryTelSalePolicyInfo(const string & strPolicyNo,
const string & strOperatorCode,
const string & strStartDate,
const string & strEndDate,
vector<SPolicyQuery> & vPolicyInfo);
//************************************
// Method: QueryPolicyGifts
// FullName: QueryPolicyGifts
// Access: public
// Returns: void
// Qualifier: 查询礼品列表,生成字符串
// Parameter: const string & strPolicyNo
// Parameter: string & strGifts
//************************************
void QueryPolicyGifts(const string & strPolicyNo,
string & strGifts,
double dGiftPriceSum);
//void readTelsaleXlsFile( const string & strFilePath, vector<SPolicyRecord> & listPolicy, bool hasTitle, bool isXML );
void readTelsaleXlsxFile(const wstring & filePath, vector<SPolicyRecord> & listPolicy, bool hasTitle);
/************************************************
* \brief 读取xls文件的单元格内容返回std::string
* \param pSheet xls文件的sheet对象指针
* \param iRowIndex 行索引
* \param iColIndex 列索引
* \return 返回读取的单元格内容以std::string为载体
************************************************/
string readXlsCell(ISheetT<char> * pSheet, int iRowIndex, int iColIndex);
/************************************************
* \brief 读取xlsx文件的单元格内容返回std::string
* \param pSheet xlsx文件的sheet对象指针
* \param iRowIndex 行索引
* \param iColIndex 列索引
* \return 返回读取的单元格内容以std::string为载体
************************************************/
string readXlsxCell(ISheetT<wchar_t> * pSheet, int iRowIndex, int iColIndex);
#endif // DataManipulation_h__

View File

@@ -0,0 +1,106 @@
#include <exception>
#include <unordered_map>
#include "Parameters.h"
#include "sqlite/sqlite3.h"
using namespace std;
Parameters::Parameters(void)
{
}
Parameters::Parameters(const string & strFilePath)
{
sqlite3 * pdbParameter;
string path;
int returnCode;
int nRowCount;
int nColCount;
char ** result;
char * pszMessage;
char szSQL[] =
"select name, value from sys_parameters ";
returnCode = sqlite3_open( strFilePath.c_str(), &pdbParameter );
if ( returnCode != SQLITE_OK )
{
const char * pszMessage = sqlite3_errmsg(pdbParameter);
throw runtime_error( pszMessage );
}
//查询
returnCode = sqlite3_get_table( pdbParameter, szSQL, &result, &nRowCount, &nColCount, &pszMessage );
if ( returnCode != SQLITE_OK )
{
const char * pszMessage = sqlite3_errmsg(pdbParameter);
throw runtime_error(pszMessage);
}
for ( int nRowIndex = nColCount; nRowIndex < nColCount*(nRowCount+1); nRowIndex += nColCount )
{
string strName = result[nRowIndex];
string strValue = result[nRowIndex+1];
m_parameters[strName] = strValue;
}
//清理
sqlite3_free_table( result );
sqlite3_close( pdbParameter );
//保存文件路径
m_strDbFilePath = strFilePath;
}
Parameters::~Parameters(void)
{
}
string Parameters::getParameter(const string & strParaName)
{
return m_parameters[strParaName];
}
void Parameters::setParameter(const string & strParaName, const string & strParaValue)
{
if ( m_parameters.find( strParaName) == m_parameters.end() )
{
throw runtime_error( "参数名称错误!" );
}
m_parameters[strParaName] = strParaValue;
sqlite3 * pDb = NULL;
int iReturnCode;
char * szMsg;
string strSQL =
"update sys_parameters set value = '";
strSQL.append( strParaValue );
strSQL.append( "' where name = '" );
strSQL.append( strParaName );
strSQL.append( "' " );
iReturnCode = sqlite3_open( m_strDbFilePath.c_str(), &pDb );
if ( iReturnCode != SQLITE_OK )
{
throw runtime_error( sqlite3_errmsg( pDb ));
}
iReturnCode = sqlite3_exec( pDb, strSQL.c_str(), NULL, NULL, &szMsg );
if ( iReturnCode != SQLITE_OK )
{
throw runtime_error( szMsg );
}
sqlite3_close( pDb );
}

View File

@@ -0,0 +1,42 @@
/*!
* \file Parameters.h
* \date 2014/08/25 11:44
*
* \author Kane
* Contact: user@company.com
*
* \brief
*
* TODO: long description
*
* \note
*/
#ifndef Parameters_h__
#define Parameters_h__
#include <string>
#include <unordered_map>
using std::string;
using std::unordered_map;
class Parameters
{
public:
Parameters( const string & strFilePath );
virtual ~Parameters(void);
string getParameter( const string & strParaName );
void setParameter( const string & strParaName, const string & strParaValue );
private:
Parameters();
private:
string m_strDbFilePath;
unordered_map<string, string> m_parameters;
};
#endif // Parameters_h__

View File

@@ -0,0 +1,84 @@
#include <Qtwidgets/QtWidgets>
#include "QConfigurationWidget.h"
#include "SystemDataQuery.h"
#include "SystemData.h"
QConfigurationWidget::QConfigurationWidget(QWidget *parent)
: QWidget(parent)
{
setupUi(this);
init();
initWidget();
initSignal();
initData();
}
QConfigurationWidget::~QConfigurationWidget()
{
}
void QConfigurationWidget::init()
{
}
void QConfigurationWidget::initWidget()
{
setLayout( pLayoutMain );
setMaximumWidth( 800 );
}
void QConfigurationWidget::initSignal()
{
connect( pEditAutoTraderCode, SIGNAL(editingFinished()), this, SLOT(onAutoTraderCodeEdited()));
connect( pEditAutoTraderCode, SIGNAL(textChanged(const QString &)), this, SLOT(onAutoTraderCodeChanged()) );
connect( pButtonSave, SIGNAL(clicked()), this, SLOT(onSave()) );
connect( pButtonReset, SIGNAL(clicked()), this, SLOT(onReset()) );
}
void QConfigurationWidget::initData()
{
pEditAutoTraderCode->setText( QString::fromLocal8Bit( pParameters->getParameter("默认车商代码").c_str() ));
emit pEditAutoTraderCode->editingFinished();
}
void QConfigurationWidget::onAutoTraderCodeEdited()
{
string strAutoTraderCode = pEditAutoTraderCode->text().trimmed().toUpper().toLocal8Bit().data();
string strAutoTraderName;
query_auto_trader_info( strAutoTraderCode, strAutoTraderName );
pEditAutoTraderName->setText( QString::fromLocal8Bit( strAutoTraderName.c_str() ));
}
void QConfigurationWidget::onAutoTraderCodeChanged()
{
pEditAutoTraderName->clear();
}
void QConfigurationWidget::onSave()
{
if ( pEditAutoTraderName->text().isEmpty() )
{
emit pEditAutoTraderCode->editingFinished();
}
if ( pEditAutoTraderName->text().isEmpty() )
{
QMessageBox::critical( this, QString::fromLocal8Bit("错误!"), QString::fromLocal8Bit("车商代码错误!") );
return;
}
pParameters->setParameter( "默认车商代码", pEditAutoTraderCode->text().toLocal8Bit().data() );
}
void QConfigurationWidget::onReset()
{
initData();
}

View File

@@ -0,0 +1,31 @@
#ifndef QCONFIGURATIONWIDGET_H
#define QCONFIGURATIONWIDGET_H
#include <QtWidgets/QtWidgets>
#include <string>
#include "ui_QConfigurationWidget.h"
using std::string;
class QConfigurationWidget : public QWidget, public Ui::QConfigurationWidget
{
Q_OBJECT
public:
QConfigurationWidget(QWidget *parent = 0);
~QConfigurationWidget();
protected Q_SLOTS:
void onAutoTraderCodeEdited();
void onAutoTraderCodeChanged();
void onSave();
void onReset();
private:
void init();
void initWidget();
void initSignal();
void initData();
};
#endif // QCONFIGURATIONWIDGET_H

View File

@@ -0,0 +1,224 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QConfigurationWidget</class>
<widget class="QWidget" name="QConfigurationWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>843</width>
<height>527</height>
</rect>
</property>
<property name="windowTitle">
<string>QConfigurationWidget</string>
</property>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>55</x>
<y>95</y>
<width>571</width>
<height>208</height>
</rect>
</property>
<layout class="QVBoxLayout" name="pLayoutMain">
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>默认车商代码:</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_20">
<property name="text">
<string>车商代码:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="pEditAutoTraderCode">
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>90</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">border: 1px solid red;
height: 1.5em;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_21">
<property name="text">
<string>车商名称:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLineEdit" name="pEditAutoTraderName">
<property name="styleSheet">
<string notr="true">border: 1px solid silver;
height: 1.5em;</string>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="title">
<string>操作</string>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="3">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>301</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>301</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QToolButton" name="pButtonSave">
<property name="toolTip">
<string>保存信息</string>
</property>
<property name="text">
<string>保存</string>
</property>
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/save2.png</normaloff>:/QMainFrame/Resources/save2.png</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="pButtonReset">
<property name="toolTip">
<string>重置所有</string>
</property>
<property name="text">
<string>重置</string>
</property>
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/clean.png</normaloff>:/QMainFrame/Resources/clean.png</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
<include location="resource.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -0,0 +1,86 @@
//#include <occi.h>
//#include <QTextCodec>
#include <QtWidgets/QMessageBox>
#include "QLoginWidget.h"
#include "SystemData.h"
#include "SystemDataQuery.h"
QLoginWidget::QLoginWidget( QWidget * parent )
: QDialog( parent )
{
ui.setupUi( this );
init();
}
QLoginWidget::~QLoginWidget()
{
}
void QLoginWidget::init()
{
initWidget();
initSignal();
doesLoginSuccess = false;
}
void QLoginWidget::initWidget()
{
setLayout( ui.pLayoutMain );
}
void QLoginWidget::initSignal()
{
connect( ui.pButtonLogin, SIGNAL(clicked()), this, SLOT(login()) );
connect( ui.pButtonCancel, SIGNAL(clicked()), this, SLOT(cancel()) );
connect( ui.pEditUserCode, SIGNAL(editingFinished()), this, SLOT(getUserName()) );
}
void QLoginWidget::onLogin()
{
string strPassword( static_cast<char *>(ui.pEditPassword->text().toLocal8Bit().data()) );
if ( strPassword == userPassword )
{
doesLoginSuccess = true;
//保存用户名和密码
setUserCode( userCode );
setUserName( userName );
close();
}
else
{
QMessageBox::warning( this, QString::fromLocal8Bit( "错误" ), QString::fromLocal8Bit( "密码错误!" ) );
}
}
void QLoginWidget::onCancel()
{
doesLoginSuccess = false;
close();
}
void QLoginWidget::onQueryUserInfo()
{
userCode = ui.pEditUserCode->text().toLocal8Bit().data();
try
{
//根据用户填入的工号,查询名称和密码
query_user_info( userCode,
userName,
userPassword );
ui.pEditUserName->setText( QString::fromLocal8Bit( userName.c_str() ) );
}
catch ( runtime_error & error )
{
QMessageBox::critical( this,
QString::fromLocal8Bit( "查询用户信息出错" ),
QString::fromLocal8Bit( error.what() ) );
}
}

View File

@@ -0,0 +1,45 @@
#ifndef QLOGINWIDGET_H
#define QLOGINWIDGET_H
#include <string>
#include <QtWidgets/QtWidgets>
#include "ui_QLoginWidget.h"
using namespace std;
class QLoginWidget : public QDialog
{
Q_OBJECT
public:
QLoginWidget(QWidget *parent = 0);
~QLoginWidget();
bool isLogin() const { return doesLoginSuccess; }
private:
void init();
void initWidget();
void initSignal();
protected Q_SLOTS:
void onLogin();
void onCancel();
void onQueryUserInfo();
private:
Ui::QLoginWidget ui;
QTextCodec * pCodecLocal;
QTextCodec * pCodecUTF8;
private:
string userCode;
string userName;
string userPassword;
bool doesLoginSuccess;
};
#endif // QLOGINWIDGET_H

View File

@@ -0,0 +1,290 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QLoginWidget</class>
<widget class="QDialog" name="QLoginWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>764</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>登录</string>
</property>
<property name="windowIcon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/CPIC.png</normaloff>:/QMainFrame/Resources/CPIC.png</iconset>
</property>
<widget class="QWidget" name="gridLayoutWidget">
<property name="geometry">
<rect>
<x>40</x>
<y>40</y>
<width>369</width>
<height>164</height>
</rect>
</property>
<layout class="QGridLayout" name="pLayoutMain">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>104</width>
<height>104</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>104</width>
<height>104</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="resource.qrc">:/QMainFrame/Resources/login.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>245</width>
<height>104</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>245</width>
<height>104</height>
</size>
</property>
<property name="title">
<string>登录信息:</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string> 工号:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="pEditUserCode">
<property name="maxLength">
<number>6</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>名称:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="pEditUserName">
<property name="maxLength">
<number>20</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>密码:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="pEditPassword">
<property name="maxLength">
<number>999</number>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="pButtonLogin">
<property name="text">
<string>登录</string>
</property>
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/ok.png</normaloff>:/QMainFrame/Resources/ok.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="pButtonCancel">
<property name="text">
<string>放弃</string>
</property>
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/x.png</normaloff>:/QMainFrame/Resources/x.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
<include location="resource.qrc"/>
<include location="resources.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -0,0 +1,108 @@
#include <QtWidgets/QtWidgets>
#include "QMainFrame.h"
QMainFrame::QMainFrame(QWidget *parent)
: QMainWindow(parent)
{
setupUi(this);
init();
}
QMainFrame::~QMainFrame()
{
}
void QMainFrame::init()
{
initWidget();
initSignal();
initStatusBar();
}
void QMainFrame::initWidget()
{
//标题栏
setWindowTitle( windowTitle() + QString::fromLocal8Bit(" - 版本号v") + QString::fromLocal8Bit( getVersion().c_str()) );
//工具栏
//ui.pActionDataManage->setEnabled( false );
//层叠窗口
m_pWidgetStack = new QMyStackedWidget( this );
setCentralWidget( m_pWidgetStack );
//加入信息录入窗口
m_pWidgetInfoInput = new QTelSalePolicyInfoInputWidget();
m_pWidgetStack->addWidget( m_pWidgetInfoInput, QString::fromLocal8Bit("电销转介绍信息录入窗口") );
m_pWidgetStack->showWidget( QString::fromLocal8Bit("电销转介绍信息录入窗口") );
//加入查询窗口
m_pWidgetQuery = new QTelSalePolicyInfoQuery();
m_pWidgetStack->addWidget( m_pWidgetQuery, QString::fromLocal8Bit("信息查询窗口") );
//加入参数设置窗口
QScrollArea * pScrollArea = new QScrollArea();
m_pWidgetConfiguration = new QConfigurationWidget();
pScrollArea->setWidget( m_pWidgetConfiguration );
pScrollArea->setAlignment( Qt::AlignLeft | Qt::AlignTop );
pScrollArea->setObjectName( QString::fromLocal8Bit("pScrollAreaInput") );
pScrollArea->setStyleSheet( QString::fromLocal8Bit( "#pScrollAreaInput\n{\n border: none;\n}" ));
m_pWidgetStack->addWidget( pScrollArea, QString::fromLocal8Bit("参数配置窗口") );
}
void QMainFrame::initSignal()
{
connect( pActionInput, SIGNAL(triggered()), this, SLOT(onShowInputWidget()) );
connect( pActionQuery, SIGNAL(triggered()), this, SLOT(onShowQueryWidget()) );
connect( pActionSetParameter, SIGNAL(triggered()), this, SLOT(onShowSetParameterWidget()) );
}
void QMainFrame::resizeEvent( QResizeEvent * pEvent )
{
QMainWindow::resizeEvent( pEvent );
}
void QMainFrame::initStatusBar()
{
//验证
QStatusBar * pStatusBar = this->statusBar();
if ( pStatusBar == NULL )
{
return;
}
QString strDate = QDate::currentDate().toString( QString::fromLocal8Bit("当前日期yyyy年MM月dd日 ") );
QString strUserName = QString::fromLocal8Bit("操作员:") + QString::fromLocal8Bit( getUserName().c_str() ) + QString(" ");
QString strUserCode = QString::fromLocal8Bit("工号:") + QString::fromLocal8Bit( getUserCode().c_str() ) + QString(" ");
//strUser.
pStatusBar->addPermanentWidget( new QLabel(strDate) );
pStatusBar->addPermanentWidget( new QLabel(strUserName) );
pStatusBar->addPermanentWidget( new QLabel(strUserCode) );
}
void QMainFrame::onShowInputWidget()
{
m_pWidgetStack->showWidget( QString::fromLocal8Bit("电销转介绍信息录入窗口") );
}
void QMainFrame::onShowQueryWidget()
{
m_pWidgetStack->showWidget( QString::fromLocal8Bit("信息查询窗口") );
}
void QMainFrame::onShowSetParameterWidget()
{
m_pWidgetStack->showWidget( QString::fromLocal8Bit("参数配置窗口") );
}

View File

@@ -0,0 +1,43 @@
#ifndef QMAINFRAME_H
#define QMAINFRAME_H
#include <QtWidgets/QtWidgets>
#include "SystemData.h"
#include "QMyStackedWidget.h"
#include "QTelSalePolicyInfoInputWidget.h"
#include "QTelSalePolicyInfoQuery.h"
#include "QConfigurationWidget.h"
#include "ui_QMainFrame.h"
class QMainFrame : public QMainWindow, public Ui::QMainFrame
{
Q_OBJECT
public:
QMainFrame(QWidget *parent = 0);
~QMainFrame();
protected Q_SLOTS:
void onShowInputWidget();
void onShowQueryWidget();
void onShowSetParameterWidget();
protected:
void resizeEvent(QResizeEvent * pEvent);
private:
void init();
void initWidget();
void initSignal();
void initStatusBar();
private:
QMyStackedWidget * m_pWidgetStack;
QTelSalePolicyInfoInputWidget * m_pWidgetInfoInput;
QTelSalePolicyInfoQuery * m_pWidgetQuery;
QConfigurationWidget * m_pWidgetConfiguration;
};
#endif // QMAINFRAME_H

View File

@@ -0,0 +1,129 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QMainFrame</class>
<widget class="QMainWindow" name="QMainFrame">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>768</width>
<height>534</height>
</rect>
</property>
<property name="windowTitle">
<string>电销转介绍信息管理系统</string>
</property>
<property name="windowIcon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/telephone.png</normaloff>:/QMainFrame/Resources/telephone.png</iconset>
</property>
<widget class="QWidget" name="centralWidget"/>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>768</width>
<height>23</height>
</rect>
</property>
<widget class="QMenu" name="menu">
<property name="title">
<string>系统</string>
</property>
<addaction name="pActionExit"/>
</widget>
<widget class="QMenu" name="menu_2">
<property name="title">
<string>帮助</string>
</property>
<addaction name="pActionAbout"/>
</widget>
<addaction name="menu"/>
<addaction name="menu_2"/>
</widget>
<widget class="QToolBar" name="mainToolBar">
<property name="iconSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="pActionInput"/>
<addaction name="pActionQuery"/>
<addaction name="pActionSetParameter"/>
</widget>
<widget class="QStatusBar" name="pStatusBar"/>
<action name="pActionExit">
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/x.png</normaloff>:/QMainFrame/Resources/x.png</iconset>
</property>
<property name="text">
<string>退出</string>
</property>
<property name="toolTip">
<string>退出程序</string>
</property>
</action>
<action name="pActionAbout">
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/CPIC.png</normaloff>:/QMainFrame/Resources/CPIC.png</iconset>
</property>
<property name="text">
<string>关于</string>
</property>
</action>
<action name="pActionInput">
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/edit.png</normaloff>:/QMainFrame/Resources/edit.png</iconset>
</property>
<property name="text">
<string>录入</string>
</property>
<property name="toolTip">
<string>转介绍信息录入</string>
</property>
</action>
<action name="pActionQuery">
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/find.png</normaloff>:/QMainFrame/Resources/find.png</iconset>
</property>
<property name="text">
<string>查询</string>
</property>
<property name="toolTip">
<string>转介绍信息查询</string>
</property>
</action>
<action name="pActionSetParameter">
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/gear.png</normaloff>:/QMainFrame/Resources/gear.png</iconset>
</property>
<property name="text">
<string>参数设置</string>
</property>
<property name="toolTip">
<string>参数设置</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
<include location="resource.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -0,0 +1,12 @@
#include "QMainWidget.h"
QMainWidget::QMainWidget(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
}
QMainWidget::~QMainWidget()
{
}

View File

@@ -0,0 +1,19 @@
#ifndef QMAINWIDGET_H
#define QMAINWIDGET_H
#include <QtWidgets/QWidget>
#include "ui_QMainWidget.h"
class QMainWidget : public QWidget
{
Q_OBJECT
public:
QMainWidget(QWidget *parent = 0);
~QMainWidget();
private:
Ui::QMainWidgetClass ui;
};
#endif // QMAINWIDGET_H

View File

@@ -0,0 +1,25 @@
<UI version="4.0" >
<class>QMainWidgetClass</class>
<widget class="QWidget" name="QMainWidgetClass" >
<property name="objectName" >
<string notr="true">QMainWidgetClass</string>
</property>
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle" >
<string>QMainWidget</string>
</property>
</widget>
<layoutDefault spacing="6" margin="11" />
<pixmapfunction></pixmapfunction>
<resources>
<include location="resource.qrc"/>
</resources>
<connections/>
</UI>

View File

@@ -0,0 +1,60 @@
#include "QMyStackedWidget.h"
QMyStackedWidget::QMyStackedWidget(QWidget *parent)
: QStackedWidget(parent)
{
//ui.setupUi(this);
}
QMyStackedWidget::~QMyStackedWidget()
{
}
void QMyStackedWidget::addWidget(QWidget * pWidget, const QString & strWidgetName)
{
//防御性验证
if ( pWidget == NULL )
{
return;
}
m_subWidgetTable[strWidgetName] = pWidget;
QStackedWidget::addWidget( pWidget );
}
void QMyStackedWidget::removeWidget(QWidget * pWidget)
{
const QString & strWidgetName = m_subWidgetTable.key( pWidget );
//判断一下列表中是否有这个widget
if ( strWidgetName.length() != 0 )
{
QStackedWidget::removeWidget( pWidget );
m_subWidgetTable.remove( strWidgetName );
}
}
void QMyStackedWidget::removeWidget(const QString & strWidgetName)
{
if ( m_subWidgetTable.contains(strWidgetName) == true )
{
QStackedWidget::removeWidget( m_subWidgetTable[strWidgetName] );
m_subWidgetTable.remove( strWidgetName );
}
}
void QMyStackedWidget::showWidget(const QString & strWidgetName)
{
if ( m_subWidgetTable.contains(strWidgetName) == true )
{
setCurrentWidget( m_subWidgetTable[strWidgetName] );
}
}
void QMyStackedWidget::showWidget(int index)
{
}

View File

@@ -0,0 +1,35 @@
#ifndef QMYSTACKEDWIDGET_H
#define QMYSTACKEDWIDGET_H
#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
#include <QtCore/qhash.h>
#include <QtWidgets/QStackedWidget>
class QMyStackedWidget : public QStackedWidget
{
Q_OBJECT
public:
QMyStackedWidget(QWidget *parent = 0);
~QMyStackedWidget();
void addWidget( QWidget * pWidget, const QString & strWidgetName );
void removeWidget( QWidget * pWidget );
void removeWidget( const QString & strWidgetName );
void showWidget( const QString & strWidgetName );
void showWidget( int index );
protected Q_SLOTS:
private:
private:
//Ui::QMyStackedWidget ui;
QHash<QString, QWidget *> m_subWidgetTable; //子窗口hash表
};
#endif // QMYSTACKEDWIDGET_H

View File

@@ -0,0 +1,259 @@
#include "QRapidInputWidget.h"
#include "DataManipulation.h"
QRapidInputWidget::QRapidInputWidget(QWidget* parent)
: QWidget(parent)
{
ui.setupUi(this);
init();
}
QRapidInputWidget::~QRapidInputWidget()
{
}
void QRapidInputWidget::init()
{
initWidget();
initSignal();
initData();
}
void QRapidInputWidget::initWidget()
{
setLayout(ui.pLayoutMain);
setAcceptDrops(true);
}
void QRapidInputWidget::initSignal()
{
connect(ui.pButtonSave,SIGNAL(clicked()), this, SLOT(onSaveTelSalePolicy()));
connect(ui.pButtonClean,SIGNAL(clicked()), this, SLOT(onCleanTable()));
connect(ui.pButtonOpenFile,SIGNAL(clicked()), this, SLOT(onOpenFile()));
}
void QRapidInputWidget::initData()
{
}
void QRapidInputWidget::dragEnterEvent(QDragEnterEvent* pEvent)
{
if (pEvent->mimeData()->hasUrls())
{
pEvent->acceptProposedAction();
}
}
void QRapidInputWidget::dropEvent(QDropEvent* pEvent)
{
QList<QUrl> listURL = pEvent->mimeData()->urls();
QString strFilePath;
//正则表达式判断文件类型
QRegularExpression regXlsx(QString::fromLocal8Bit(".xlsx$"),
QRegularExpression::PatternOption::CaseInsensitiveOption);
QRegularExpression regXls(QString::fromLocal8Bit(".xls$"),
QRegularExpression::PatternOption::CaseInsensitiveOption);
QRegularExpressionMatch match;
if (listURL.size() == 0)
{
return;
}
strFilePath = listURL[0].toLocalFile();
//是xlsx文件
match = regXlsx.match(strFilePath);
if (match.hasMatch())
{
readTelsaleXlsxFile(strFilePath.toStdWString(),
m_vPolicy,
ui.pCheckBoxHasTitle->isChecked());
}
//是xls文件
match = regXls.match(strFilePath);
if (match.hasMatch())
{
//readTelsaleXlsFile(strFilePath.toStdWString(), m_vPolicy, ui.pCheckBoxHasTitle->isChecked(), false);
QMessageBox::critical(this,
QString::fromLocal8Bit("文件类型错误!"),
QString::fromLocal8Bit("文件格式需为Excel 2007及以后"));
}
showPolicy();
}
void QRapidInputWidget::showPolicy()
{
int iRowCount = m_vPolicy.size();
QTableWidgetItem* pItem = NULL;
ui.pTableWidgetPolicy->setRowCount(iRowCount);
for (int iRowIndex = 0; iRowIndex < iRowCount; iRowIndex++)
{
//保单号
pItem = new QTableWidgetItem(QString::fromLocal8Bit(m_vPolicy[iRowIndex].strPolicySerial.c_str()));
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
pItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
ui.pTableWidgetPolicy->setItem(iRowIndex, 0, pItem);
//签单日期
pItem = new QTableWidgetItem(QString::fromLocal8Bit(m_vPolicy[iRowIndex].strSignDate.c_str()));
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
pItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
ui.pTableWidgetPolicy->setItem(iRowIndex, 1, pItem);
//车牌号
pItem = new QTableWidgetItem(QString::fromLocal8Bit(m_vPolicy[iRowIndex].strPlateSerial.c_str()));
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
pItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
ui.pTableWidgetPolicy->setItem(iRowIndex, 2, pItem);
//被保险人
pItem = new QTableWidgetItem(QString::fromLocal8Bit(m_vPolicy[iRowIndex].strCustomerName.c_str()));
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
pItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
ui.pTableWidgetPolicy->setItem(iRowIndex, 3, pItem);
//车商代码
pItem = new QTableWidgetItem(QString::fromLocal8Bit(m_vPolicy[iRowIndex].strAutoTraderCode.c_str()));
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
pItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
ui.pTableWidgetPolicy->setItem(iRowIndex, 4, pItem);
//经办人代码
pItem = new QTableWidgetItem(QString::fromLocal8Bit(m_vPolicy[iRowIndex].strSalerCode.c_str()));
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
pItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
ui.pTableWidgetPolicy->setItem(iRowIndex, 5, pItem);
//经办人名称
pItem = new QTableWidgetItem(QString::fromLocal8Bit(m_vPolicy[iRowIndex].strSalerName.c_str()));
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
pItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
ui.pTableWidgetPolicy->setItem(iRowIndex, 6, pItem);
//部门
pItem = new QTableWidgetItem(QString::fromLocal8Bit(m_vPolicy[iRowIndex].strSalerDeptName.c_str()));
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
pItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
ui.pTableWidgetPolicy->setItem(iRowIndex, 7, pItem);
//科室
pItem = new QTableWidgetItem(QString::fromLocal8Bit(m_vPolicy[iRowIndex].strSalerOfficeName.c_str()));
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
pItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
ui.pTableWidgetPolicy->setItem(iRowIndex, 8, pItem);
}
ui.pTableWidgetPolicy->resizeColumnsToContents();
}
void QRapidInputWidget::onSaveTelSalePolicy()
{
vector<TelSalePolicyGift> vGifts;
m_vErrorPolicy.clear();
for (vector<SPolicyRecord>::iterator iter = m_vPolicy.begin(); iter != m_vPolicy.end(); ++iter)
{
try
{
SaveTelSalePolicyInfo(*iter, vGifts);
}
catch (runtime_error& excpt)
{
m_vErrorPolicy.push_back(*iter);
QString strInfo = QString::fromLocal8Bit("保单") + QString::fromLocal8Bit((*iter).strPolicySerial.c_str()) + QString::
fromLocal8Bit("保存错误!\n") +
QString::fromLocal8Bit("错误信息:") + QString::fromLocal8Bit(excpt.what());
QMessageBox::critical(this, QString::fromLocal8Bit("保存错误"), strInfo);
}
}
m_vPolicy = m_vErrorPolicy;
showPolicy();
}
void QRapidInputWidget::onCleanTable()
{
m_vErrorPolicy.clear();
m_vPolicy.clear();
ui.pTableWidgetPolicy->setRowCount(0);
ui.pTableWidgetPolicy->clearContents();
}
void QRapidInputWidget::onOpenFile()
{
QSettings reg("HKEY_CURRENT_USER\\Software\\TelsalePolicyInfoManager", QSettings::NativeFormat);
QString strPath = reg.value(QString::fromLocal8Bit("打开地址")).toString();
QStringList listFileNames = QFileDialog::getOpenFileNames(this,
QString::fromLocal8Bit("打开Excel文件"),
strPath,
QString::fromLocal8Bit("Excel文件 (*.xls *.xlsx)"));
//记录一下打开的路径
if (listFileNames.size() > 0)
{
strPath = listFileNames[0].left(listFileNames[0].lastIndexOf(QString::fromLocal8Bit("/")) + 1);
reg.setValue(QString::fromLocal8Bit("打开地址"), strPath);
}
else
{
return;
}
//正则表达式判断文件类型
QRegularExpression regXlsx(QString::fromLocal8Bit(".xlsx$"),
QRegularExpression::PatternOption::CaseInsensitiveOption);
QRegularExpression regXls(QString::fromLocal8Bit(".xls$"),
QRegularExpression::PatternOption::CaseInsensitiveOption);
QRegularExpressionMatch match;
strPath = listFileNames[0];
//是xlsx文件
match = regXlsx.match(strPath);
if (match.hasMatch())
{
readTelsaleXlsxFile(strPath.toStdWString(), m_vPolicy, ui.pCheckBoxHasTitle->isChecked());
}
//是xls文件
match = regXls.match(strPath);
if (match.hasMatch())
{
//readTelsaleXlsFile( strPath.toLocal8Bit().data(), m_vPolicy, ui.pCheckBoxHasTitle->isChecked(), false );
QMessageBox::critical(this,
QString::fromLocal8Bit("文件类型错误!"),
QString::fromLocal8Bit("文件格式需为Excel 2007及以后"));
}
showPolicy();
}

View File

@@ -0,0 +1,41 @@
#ifndef QRAPIDINPUTWIDGET_H
#define QRAPIDINPUTWIDGET_H
#include <QtWidgets/QtWidgets>
//#include <QWidget>
#include <vector>
#include "ui_QRapidInputWidget.h"
#include "DataManipulation.h"
class QRapidInputWidget : public QWidget
{
Q_OBJECT
public:
QRapidInputWidget(QWidget *parent = 0);
~QRapidInputWidget();
protected:
virtual void dragEnterEvent( QDragEnterEvent * pEvent );
virtual void dropEvent( QDropEvent * pEvent );
protected Q_SLOTS:
void onSaveTelSalePolicy();
void onCleanTable();
void onOpenFile();
private:
void init();
void initWidget();
void initSignal();
void initData();
void showPolicy();
private:
Ui::QRapidInputWidget ui;
std::vector<SPolicyRecord> m_vPolicy;
std::vector<SPolicyRecord> m_vErrorPolicy;
};
#endif // QRAPIDINPUTWIDGET_H

View File

@@ -0,0 +1,203 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QRapidInputWidget</class>
<widget class="QWidget" name="QRapidInputWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>917</width>
<height>529</height>
</rect>
</property>
<property name="windowTitle">
<string>QRapidInputWidget</string>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>120</x>
<y>90</y>
<width>541</width>
<height>318</height>
</rect>
</property>
<layout class="QVBoxLayout" name="pLayoutMain">
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>操作:</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="2">
<widget class="QToolButton" name="pButtonSave">
<property name="text">
<string>保存数据</string>
</property>
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/save2.png</normaloff>:/QMainFrame/Resources/save2.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QToolButton" name="pButtonOpenFile">
<property name="text">
<string>打开文件</string>
</property>
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/excel.png</normaloff>:/QMainFrame/Resources/excel.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QToolButton" name="pButtonClean">
<property name="text">
<string>清空列表</string>
</property>
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/clean.png</normaloff>:/QMainFrame/Resources/clean.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>导入参数:</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="pCheckBoxHasTitle">
<property name="text">
<string>包含标题</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>191</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTableWidget" name="pTableWidgetPolicy">
<property name="styleSheet">
<string notr="true"/>
</property>
<column>
<property name="text">
<string>保单号</string>
</property>
</column>
<column>
<property name="text">
<string>签单日期</string>
</property>
</column>
<column>
<property name="text">
<string>车牌号</string>
</property>
</column>
<column>
<property name="text">
<string>被保险人</string>
</property>
</column>
<column>
<property name="text">
<string>车商代码</string>
</property>
</column>
<column>
<property name="text">
<string>经办人代码</string>
</property>
</column>
<column>
<property name="text">
<string>经办人名称</string>
</property>
</column>
<column>
<property name="text">
<string>部门</string>
</property>
</column>
<column>
<property name="text">
<string>科室</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
<include location="resource.qrc"/>
</resources>
<connections/>
</ui>

View File

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

View File

@@ -0,0 +1,55 @@
#ifndef QTELSALEPOLICYINFOINPUTWIDGET_H
#define QTELSALEPOLICYINFOINPUTWIDGET_H
#include <vector>
#include <QtWidgets/QtWidgets>
#include "DataManipulation.h"
#include "ui_QTelSalePolicyInfoInputWidget.h"
class QTelSalePolicyInfoInputWidget : public QWidget, public Ui::QTelSalePolicyInfoInputWidget
{
Q_OBJECT
public:
QTelSalePolicyInfoInputWidget(QWidget *parent = 0);
~QTelSalePolicyInfoInputWidget();
public Q_SLOTS:
void onSalerCodeChanged();
void onQuerySalerName();
void onAutoTraderCodeChanged();
void onQueryAutoTraderName();
void onSavePolicy();
void onResetGiftsTable();
void onGiftTableItemChanged( int row, int column );
void onReset();
private:
void init();
void initWidget();
void initSignal();
void initData();
void InitGiftTable();
/************************************************
* \brief 读取礼品列表
* \param giftList
************************************************/
void readGiftTable( vector<TelSalePolicyGift> & giftList );
private:
string salerCode;
string salerName;
string salerDeptCode;
string salerDeptName;
string salerOfficeCode;
string salerOfficeName;
string autoTraderCode;
string autoTraderName;
vector<TelSalePolicyGift> giftsList;
bool m_initing;
};
#endif // QTELSALEPOLICYINFOINPUTWIDGET_H

View File

@@ -0,0 +1,890 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QTelSalePolicyInfoInputWidget</class>
<widget class="QWidget" name="QTelSalePolicyInfoInputWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1007</width>
<height>872</height>
</rect>
</property>
<property name="windowTitle">
<string>QTelSalePolicyInfoInputWidget</string>
</property>
<widget class="QWidget" name="gridLayoutWidget">
<property name="geometry">
<rect>
<x>60</x>
<y>30</y>
<width>271</width>
<height>181</height>
</rect>
</property>
<layout class="QGridLayout" name="pLayoutMain">
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QTabWidget" name="pTabWidget">
<property name="currentIndex">
<number>1</number>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="documentMode">
<bool>false</bool>
</property>
<widget class="QWidget" name="tab">
<attribute name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/edit.png</normaloff>:/QMainFrame/Resources/edit.png</iconset>
</attribute>
<attribute name="title">
<string>转介绍信息录入</string>
</attribute>
<widget class="QWidget" name="gridLayoutWidget_2">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>160</width>
<height>80</height>
</rect>
</property>
<layout class="QGridLayout" name="pLayoutInputMain">
<item row="0" column="0">
<widget class="QScrollArea" name="pScrollAreaInput">
<property name="styleSheet">
<string notr="true">#pScrollAreaInput
{
border: none;
}</string>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>30</height>
</rect>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/excel.png</normaloff>:/QMainFrame/Resources/excel.png</iconset>
</attribute>
<attribute name="title">
<string>批量录入</string>
</attribute>
<widget class="QWidget" name="gridLayoutWidget_3">
<property name="geometry">
<rect>
<x>50</x>
<y>20</y>
<width>160</width>
<height>80</height>
</rect>
</property>
<layout class="QGridLayout" name="pLayoutRapid">
<item row="0" column="0">
<widget class="QScrollArea" name="pScrollAreaRapid">
<property name="styleSheet">
<string notr="true">#pScrollAreaRapid
{
border: none;
}</string>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>158</width>
<height>78</height>
</rect>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="pWidgetInput" native="true">
<property name="geometry">
<rect>
<x>390</x>
<y>70</y>
<width>71</width>
<height>51</height>
</rect>
</property>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>45</x>
<y>225</y>
<width>861</width>
<height>580</height>
</rect>
</property>
<layout class="QGridLayout" name="pLayoutInfoDetail">
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="title">
<string>保单信息</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="styleSheet">
<string notr="true">font:rgb(255, 0, 0)</string>
</property>
<property name="text">
<string>交强险保单号:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1" colspan="3">
<widget class="QLineEdit" name="pEditQjxPolicySerial">
<property name="styleSheet">
<string notr="true">border: 1px solid red;
height: 1.5em;</string>
</property>
<property name="maxLength">
<number>20</number>
</property>
<property name="frame">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>商业险保单号:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QLineEdit" name="pEditBizPolicySerial">
<property name="styleSheet">
<string notr="true">border: 1px solid red;
height: 1.5em;</string>
</property>
<property name="maxLength">
<number>20</number>
</property>
<property name="frame">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_20">
<property name="text">
<string>车商代码:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="pEditAutoTraderCode">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">border: 1px solid red;
height: 1.5em;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_21">
<property name="text">
<string>车商名称:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QLineEdit" name="pEditAutoTraderName">
<property name="styleSheet">
<string notr="true">border: 1px solid silver;
height: 1.5em;</string>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>车店联呼:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QComboBox" name="pComboBoxAutotraderCall">
<property name="styleSheet">
<string notr="true">text-align: center;</string>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
<item>
<property name="text">
<string/>
</property>
</item>
<item>
<property name="text">
<string>否</string>
</property>
</item>
<item>
<property name="text">
<string>是</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QGroupBox" name="groupBox_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="title">
<string>经办人信息</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>经办人代码:</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="3">
<widget class="QLineEdit" name="pEditSalerCode">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">border: 1px solid red;
height: 1.5em;</string>
</property>
<property name="maxLength">
<number>6</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>经办人名称:</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QLineEdit" name="pEditSalerName">
<property name="styleSheet">
<string notr="true">border: 1px solid silver;
height: 1.5em;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_12">
<property name="minimumSize">
<size>
<width>72</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>部门代码:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="pEditDeptCode">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">border: 1px solid silver;
height: 1.5em;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_23">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>部门名称:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QLineEdit" name="pEditDeptName">
<property name="styleSheet">
<string notr="true">border: 1px solid silver;
height: 1.5em;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_19">
<property name="minimumSize">
<size>
<width>72</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>科室代码:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="pEditOfficeCode">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">border: 1px solid silver;
height: 1.5em;</string>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QLabel" name="label_22">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>科室名称:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QLineEdit" name="pEditOfficeName">
<property name="styleSheet">
<string notr="true">border: 1px solid silver;
height: 1.5em;</string>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_3">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="title">
<string>车辆信息</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_14">
<property name="minimumSize">
<size>
<width>84</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>客户名称:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1" colspan="3">
<widget class="QLineEdit" name="pEditCustomerName">
<property name="styleSheet">
<string notr="true">border: 1px solid silver;
height: 1.5em;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_15">
<property name="minimumSize">
<size>
<width>84</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>车牌号:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="pEditPlateSerial">
<property name="styleSheet">
<string notr="true">border: 1px solid silver;
height: 1.5em;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_16">
<property name="text">
<string>车架号:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLineEdit" name="pEditFrameSerial">
<property name="styleSheet">
<string notr="true">border: 1px solid silver;
height: 1.5em;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_17">
<property name="minimumSize">
<size>
<width>84</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>发动机号:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="pEditEngineSerial">
<property name="styleSheet">
<string notr="true">border: 1px solid silver;
height: 1.5em;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="2" colspan="2">
<widget class="QLabel" name="label_18">
<property name="text">
<string>* 此部分内容可以不填</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QGroupBox" name="pGroupBoxGift">
<property name="title">
<string>礼品清单:</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_8">
<item row="0" column="0" colspan="2">
<widget class="QTableWidget" name="pTableGifts">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<row>
<property name="text">
<string>新建行</string>
</property>
</row>
<column>
<property name="text">
<string>礼品名称</string>
</property>
<property name="textAlignment">
<set>AlignCenter</set>
</property>
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/8218_box1.png</normaloff>:/QMainFrame/Resources/8218_box1.png</iconset>
</property>
</column>
<column>
<property name="text">
<string>礼品价值</string>
</property>
<property name="textAlignment">
<set>AlignCenter</set>
</property>
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/CNY_Red.png</normaloff>:/QMainFrame/Resources/CNY_Red.png</iconset>
</property>
</column>
<item row="0" column="0">
<property name="text">
<string/>
</property>
<property name="checkState">
<enum>Unchecked</enum>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_4">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="title">
<string>操作</string>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="2">
<widget class="QToolButton" name="pButtonReset">
<property name="toolTip">
<string>重置所有</string>
</property>
<property name="text">
<string>重置</string>
</property>
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/clean.png</normaloff>:/QMainFrame/Resources/clean.png</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
</widget>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>301</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>301</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QToolButton" name="pButtonSave">
<property name="toolTip">
<string>保存信息</string>
</property>
<property name="text">
<string>保存</string>
</property>
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/save2.png</normaloff>:/QMainFrame/Resources/save2.png</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QToolButton" name="pButtonResetGift">
<property name="toolTip">
<string>重置礼品列表</string>
</property>
<property name="text">
<string>重置</string>
</property>
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/8218_box1.png</normaloff>:/QMainFrame/Resources/8218_box1.png</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
<include location="resource.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -0,0 +1,197 @@
#include <vector>
#include <Qtwidgets/QtWidgets>
#include "SystemDataQuery.h"
#include "SystemData.h"
#include "QTelSalePolicyInfoQuery.h"
using namespace std;
QTelSalePolicyInfoQuery::QTelSalePolicyInfoQuery(QWidget *parent)
: QWidget(parent)
{
setupUi(this);
init();
initWidget();
initSignal();
}
QTelSalePolicyInfoQuery::~QTelSalePolicyInfoQuery()
{
}
void QTelSalePolicyInfoQuery::init()
{
}
void QTelSalePolicyInfoQuery::initWidget()
{
setLayout( pLayoutMain );
//录入时间
pDateEditStart->setDate( QDate::currentDate().addDays(-1) );
pDateEditEnd->setDate( QDate::currentDate() );
}
void QTelSalePolicyInfoQuery::initSignal()
{
connect( pEditOperatorCode, SIGNAL(editingFinished()), this, SLOT(onOperatorCodeEdited()) );
connect( pEditOperatorCode, SIGNAL(textChanged(const QString &)), this, SLOT(onOperatorCodeEditing(const QString &)) );
connect( pButtonQuery, SIGNAL(clicked()), this, SLOT(onQuery()) );
connect( pButtonReset, SIGNAL(clicked()), this, SLOT(onReset()) );
}
void QTelSalePolicyInfoQuery::onOperatorCodeEditing(const QString & text)
{
pEditOperatorName->clear();
}
void QTelSalePolicyInfoQuery::onOperatorCodeEdited()
{
string strStaffCode = pEditOperatorCode->text().toLocal8Bit().data();
string strStaffName;
query_staff_info( strStaffCode, strStaffName );
pEditOperatorName->setText( QString::fromLocal8Bit( strStaffName.c_str() ));
}
void QTelSalePolicyInfoQuery::onQuery()
{
string strPolicyNo = pEditPolicyNo->text().toLocal8Bit().data();
string strOperatorCode;
string strStartDate;
string strEndDate;
vector<SPolicyQuery> vPolicyInfo;
if ( !pEditOperatorName->text().isEmpty() )
{
strOperatorCode = pEditOperatorCode->text().toLocal8Bit().data();
}
else
{
//自动使用操作员的工号为条件
strOperatorCode = getUserCode();
}
if ( pGroupBoxDate->isChecked() )
{
strStartDate = pDateEditStart->date().toString( QString::fromLocal8Bit("MM/dd/yyyy") ).toLocal8Bit().data();
strEndDate = pDateEditEnd->date().toString( QString::fromLocal8Bit("MM/dd/yyyy") ).toLocal8Bit().data();
}
try
{
QueryTelSalePolicyInfo( strPolicyNo,
strOperatorCode,
strStartDate,
strEndDate,
vPolicyInfo );
showData( vPolicyInfo );
}
catch ( runtime_error & error )
{
QMessageBox::critical( this, QString::fromLocal8Bit("查询错误!"), QString::fromLocal8Bit(error.what()) );
}
}
void QTelSalePolicyInfoQuery::onReset()
{
//录入时间
pDateEditStart->setDate( QDate::currentDate().addDays(-1) );
pDateEditEnd->setDate( QDate::currentDate() );
pEditPolicyNo->clear();
pEditOperatorCode->clear();
pEditOperatorName->clear();
}
void QTelSalePolicyInfoQuery::showData(std::vector<SPolicyQuery> & vPolicy)
{
QTableWidgetItem * pItem = NULL;
QLabel * pLabel = NULL;
unsigned int nRowIndex = 0;
pTableWidgetInfo->setRowCount( vPolicy.size() );
for ( vector<SPolicyQuery>::iterator iter = vPolicy.begin(); iter != vPolicy.end(); ++iter )
{
//保单号
pItem = new QTableWidgetItem( QString::fromLocal8Bit( iter->strPolicySerial.c_str() ));
pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
pTableWidgetInfo->setItem( nRowIndex, 0, pItem );
//经办人
pItem = new QTableWidgetItem( QString::fromLocal8Bit( iter->strSalerCode.c_str() ));
pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
pTableWidgetInfo->setItem( nRowIndex, 1, pItem );
//部门
pItem = new QTableWidgetItem( QString::fromLocal8Bit( iter->strDeptName.c_str() ));
pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
pTableWidgetInfo->setItem( nRowIndex, 2, pItem );
//科室
pItem = new QTableWidgetItem( QString::fromLocal8Bit( iter->strOfficeName.c_str() ));
pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
pTableWidgetInfo->setItem( nRowIndex, 3, pItem );
//车店联呼
if ( iter->strCDLH == "1" )
{
pItem = new QTableWidgetItem( QString::fromLocal8Bit( "" ));
}
else
{
pItem = new QTableWidgetItem( QString::fromLocal8Bit( "" ));
}
pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
pTableWidgetInfo->setItem( nRowIndex, 4, pItem );
//车商代码
pItem = new QTableWidgetItem( QString::fromLocal8Bit( iter->strAutoTraderCode.c_str() ));
pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
pTableWidgetInfo->setItem( nRowIndex, 5, pItem );
//车商名称
pItem = new QTableWidgetItem( QString::fromLocal8Bit( iter->strAutoTraderName.c_str() ));
pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
pTableWidgetInfo->setItem( nRowIndex, 6, pItem );
//礼品总价值
pItem = new QTableWidgetItem( QString::number(iter->dGiftPriceSum, 'f', 2) );
pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
pTableWidgetInfo->setItem( nRowIndex, 7, pItem );
//礼品
pItem = new QTableWidgetItem( QString::fromLocal8Bit( iter->strGifts.c_str() ));
pItem->setTextAlignment( Qt::AlignLeft | Qt::AlignVCenter );
pTableWidgetInfo->setItem( nRowIndex, 8, pItem );
//录入日期
pItem = new QTableWidgetItem( QString::fromLocal8Bit( iter->strInputDate.c_str() ));
pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
pTableWidgetInfo->setItem( nRowIndex, 9, pItem );
++nRowIndex;
}
pTableWidgetInfo->resizeColumnsToContents();
}

View File

@@ -0,0 +1,32 @@
#ifndef QTELSALEPOLICYINFOQUERY_H
#define QTELSALEPOLICYINFOQUERY_H
#include <vector>
#include <QtWidgets/QtWidgets>
#include "DataManipulation.h"
#include "ui_QTelSalePolicyInfoQuery.h"
class QTelSalePolicyInfoQuery : public QWidget, public Ui::QTelSalePolicyInfoQuery
{
Q_OBJECT
public:
QTelSalePolicyInfoQuery(QWidget *parent = 0);
~QTelSalePolicyInfoQuery();
protected Q_SLOTS:
void onOperatorCodeEditing(const QString & text);
void onOperatorCodeEdited();
void onQuery();
void onReset();
private:
void init();
void initWidget();
void initSignal();
void showData( std::vector<SPolicyQuery> & vPolicy );
};
#endif // QTELSALEPOLICYINFOQUERY_H

View File

@@ -0,0 +1,392 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QTelSalePolicyInfoQuery</class>
<widget class="QWidget" name="QTelSalePolicyInfoQuery">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>917</width>
<height>624</height>
</rect>
</property>
<property name="windowTitle">
<string>QTelSalePolicyInfoQuery</string>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>50</y>
<width>756</width>
<height>280</height>
</rect>
</property>
<layout class="QVBoxLayout" name="pLayoutMain">
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="title">
<string>保单信息:</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>保单号:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1" colspan="3">
<widget class="QLineEdit" name="pEditPolicyNo">
<property name="styleSheet">
<string notr="true">border: 1px solid red;
height: 1.5em;</string>
</property>
<property name="maxLength">
<number>20</number>
</property>
<property name="frame">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_20">
<property name="text">
<string>操作员代码:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="pEditOperatorCode">
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>90</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">border: 1px solid red;
height: 1.5em;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_21">
<property name="text">
<string>操作员名称:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLineEdit" name="pEditOperatorName">
<property name="styleSheet">
<string notr="true">border: 1px solid silver;
height: 1.5em;</string>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="pGroupBoxDate">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="title">
<string>录入日期:</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_22">
<property name="text">
<string>起始日期:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDateEdit" name="pDateEditStart">
<property name="displayFormat">
<string>yyyy年MM月dd日</string>
</property>
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_23">
<property name="text">
<string>终止日期:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDateEdit" name="pDateEditEnd">
<property name="displayFormat">
<string>yyyy年MM月dd日</string>
</property>
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QToolButton" name="pButtonQuery">
<property name="toolTip">
<string>查询</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/find.png</normaloff>:/QMainFrame/Resources/find.png</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="pButtonReset">
<property name="toolTip">
<string>重置</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/clean.png</normaloff>:/QMainFrame/Resources/clean.png</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QTableWidget" name="pTableWidgetInfo">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="gridStyle">
<enum>Qt::SolidLine</enum>
</property>
<attribute name="horizontalHeaderVisible">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>保单号</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/CPIC.png</normaloff>:/QMainFrame/Resources/CPIC.png</iconset>
</property>
</column>
<column>
<property name="text">
<string>经办人代码</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</column>
<column>
<property name="text">
<string>部门</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</column>
<column>
<property name="text">
<string>科室</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</column>
<column>
<property name="text">
<string>车店联呼</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</column>
<column>
<property name="text">
<string>车商代码</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</column>
<column>
<property name="text">
<string>车商名称</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</column>
<column>
<property name="text">
<string>礼品总价值</string>
</property>
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/CNY_Red.png</normaloff>:/QMainFrame/Resources/CNY_Red.png</iconset>
</property>
</column>
<column>
<property name="text">
<string>礼品</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/QMainFrame/Resources/8218_box1.png</normaloff>:/QMainFrame/Resources/8218_box1.png</iconset>
</property>
</column>
<column>
<property name="text">
<string>录入日期</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
<include location="resource.qrc"/>
</resources>
<connections/>
</ui>

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 952 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -0,0 +1,366 @@
//#include "stdafx.h"
#include "StringCodeConverter.h"
#include <locale.h>
#include <stdlib.h>
//#include <stdio.h>
#include <string>
#include <cstring>
using namespace std;
size_t StringCodeConverter::mbslen( const char *pcszSource )
{
string strCurLocale = setlocale( LC_ALL, NULL );
setlocale( LC_ALL, "chinese-simplified" );
int mbl = 0;
size_t cnt = 0;
for (cnt = 0; *pcszSource; ++cnt)
{
mbl = mblen( pcszSource, MB_CUR_MAX );
pcszSource += mbl;
}
setlocale( LC_ALL, strCurLocale.c_str() );
return cnt;
}
wstring StringCodeConverter::mbs2unicode( const string &cstrSource )
{
string strCurLocale = setlocale( LC_ALL, NULL );
setlocale( LC_ALL, "chinese-simplified" ); //改成中文环境,如果接受的参数不是中文字符串,得注意结果
const char *pcszSource = cstrSource.c_str();
size_t iCount = cstrSource.size() + 1;
wchar_t *pwszBuffer = new wchar_t[ iCount ];
wmemset( pwszBuffer, 0, iCount );
size_t iConvertedCount = mbstowcs( pwszBuffer, pcszSource, iCount );
if ( iConvertedCount == -1 )
{
delete [] pwszBuffer;
throw string( "mbs2unicode参数有非中英文字符" );
}
wstring wstrDest( pwszBuffer );
delete [] pwszBuffer;
setlocale( LC_ALL, strCurLocale.c_str() );
return wstrDest;
}
void StringCodeConverter::mbs2unicode(const string &strSource, wstring &wstrDest)
{
const char *pcszSource = strSource.c_str();
string strCurLocale( setlocale(LC_ALL, NULL) );//先保存当前的locale设置
setlocale( LC_ALL, "chs" );//设置为中文
size_t iCharCount = strSource.size() + 1;//unicode字符串所需要的字符数
wchar_t *pwszBuffer = new wchar_t[ iCharCount ];
wmemset( pwszBuffer, 0, iCharCount );
mbstowcs( pwszBuffer, pcszSource, iCharCount );
setlocale( LC_ALL, strCurLocale.c_str() );//改回原来的locale设置
wstrDest = pwszBuffer;
delete [] pwszBuffer;
}
void StringCodeConverter::mbs2unicode( const char *pcszSource, wchar_t *pwszDest ) throw (string)
{
if ( pcszSource == NULL || pwszDest == NULL )
{
throw string( "参数指针为NULL" );
}
string strCurLocale = setlocale( LC_ALL, NULL );
setlocale( LC_ALL, "chinese-simplified" ); //改成中文环境,如果接受的参数不是中文字符串,得注意结果
size_t iCharCount = mbslen( pcszSource ) + 1;
if ( iCharCount == -1 )
{
throw string( "源字符串的编码有非中英文字符" );
}
wmemset( pwszDest, 0, iCharCount );
size_t iConvertedCount = mbstowcs( pwszDest, pcszSource, iCharCount );
if ( iConvertedCount == -1 )
{
throw string( "源字符串的编码有非中英文字符" );
}
*( pwszDest + iConvertedCount ) = NULL;
setlocale( LC_ALL, strCurLocale.c_str() );
}
void StringCodeConverter::mbs2utf8( const string &cstrSource, char *pszDest )
{
const char *pcszSource = cstrSource.c_str();
string strCurLocale( setlocale( LC_ALL, NULL ) );
setlocale( LC_ALL, "chinese-simplified" ); //改成中文环境,如果接受的参数不是中文字符串,得注意结果
while ( *pcszSource != NULL )
{
if ( *pcszSource > 0 )
{
//英文字符,可以直接复制
*pszDest = *pcszSource;
pcszSource++;
pszDest++;
}
else
{
//非ascii英文字符,先转换成unicode再转换utf8
int iLen = 0;
wchar_t wUnicode = 0;
char *pcUnicode = (char *)&wUnicode;
//转换成unicode返回mb字符的长度
iLen = mbtowc( &wUnicode, pcszSource, MB_CUR_MAX );
pszDest[0] = (0xE0 | ((pcUnicode[1] & 0xF0) >> 4));
pszDest[1] = (0x80 | ((pcUnicode[1] & 0x0F) << 2)) + ((pcUnicode[0] & 0xC0) >> 6);
pszDest[2] = (0x80 | (pcUnicode[0] & 0x3F));
pszDest += 3;
pcszSource += iLen;
}
}
setlocale( LC_ALL, strCurLocale.c_str() );
*pszDest = NULL;
}
string StringCodeConverter::unicode2mbs( const wstring &wstrSource )
{
string strCurLocale = setlocale( LC_ALL, NULL );
setlocale( LC_ALL, "chinese-simplified" ); //改成中文环境,如果接受的参数不是中文字符串,得注意结果
const wchar_t *pcwszSource = wstrSource.c_str();
size_t iCount = wstrSource.size() * 2 + 1;
char *pszBuffer = new char[ iCount ];
memset( pszBuffer, 0, iCount );
size_t iConvertedCount = wcstombs( pszBuffer, pcwszSource, iCount );
if ( iConvertedCount == -1 )
{
throw string( "unicode2mbs源字符串的编码有非中英文字符" );
}
setlocale( LC_ALL, strCurLocale.c_str() );
string strDest( pszBuffer );
delete [] pszBuffer;
return strDest;
}
void StringCodeConverter::unicode2mbs( const wstring &wstrSource, string &strDest )
{
string strCurLocale = setlocale( LC_ALL, NULL );
setlocale( LC_ALL, "chs" );
size_t iCount = wstrSource.size() + 1;
char *pszBuffer = new char[ iCount ];
const wchar_t *pcwszSource = wstrSource.c_str();
memset( pszBuffer, 0, iCount );
size_t iConvertedCount = wcstombs( pszBuffer, pcwszSource , iCount );
if ( iConvertedCount == -1 )
{
delete [] pszBuffer;
throw string( "unicode2mbs转换失败字符串中有非中英文字符" );
}
strDest = pszBuffer;
delete [] pszBuffer;
setlocale( LC_ALL, strCurLocale.c_str() );
}
void StringCodeConverter::unicode2mbs( const wchar_t *pcwszSource, char *pszDest )
{
if ( pcwszSource == NULL || pszDest == NULL )
{
throw string( "unicode2mbs函数参数值为NULL" );
}
string strCurLocale = setlocale( LC_ALL, NULL );
setlocale( LC_ALL, "chinese-simplified" ); //改成中文环境,如果接受的参数不是中文字符串,得注意结果
size_t iCount = wcslen( pcwszSource )*2 + 1;
memset( pszDest, 0, iCount );
size_t iConvertedCount = wcstombs( pszDest, pcwszSource, iCount );
if ( iConvertedCount == -1 )
{
throw string( "unicode2mbs转换失败字符串中有非中英文字符" );
}
setlocale( LC_ALL, strCurLocale.c_str() );
}
void StringCodeConverter::unicode2utf8( const wstring &cwstrSource, char *pszDest )
{
if ( pszDest == NULL )
{
throw string( "参数为NULL" );
}
const wchar_t *pcwszSource = cwstrSource.c_str();
while ( *pcwszSource != NULL )
{
unsigned short int iUnicode = *pcwszSource;
if ( iUnicode < 128 )
{
//小于128是英文字符不需要转换
*pszDest = (char)iUnicode;
pszDest++;
pcwszSource++;
}
else
{
//大于128是mbs字符需要转换
const char *pcszUnicode = (const char *)pcwszSource;
pszDest[0] = (0xE0 | ((pcszUnicode[1] & 0xF0) >> 4 ));
pszDest[1] = (0x80 | ((pcszUnicode[1] & 0x0F) << 2)) + ((pcszUnicode[0] & 0xC0) >> 6);
pszDest[2] = (0x80 | (pcszUnicode[0] & 0x3F));
pszDest = pszDest + 3;
pcwszSource++;
}
}
*pszDest = NULL;//末尾的NULL字符
}
string StringCodeConverter::utf8tombs( const char *pcszSource )
{
if ( pcszSource == NULL )
{
throw string( "参数为NULL" );
}
string strCurLocale( setlocale( LC_ALL, NULL ) );
setlocale( LC_ALL, "chinese-simplified" ); //改成中文环境,如果接受的参数不是中文字符串,得注意结果
char *pszDest = new char[ strlen( pcszSource ) ];
char *pszBuffer = pszDest;
while ( *pcszSource != 0 )
{
if ( *pcszSource > 0 )
{
//是ASCII字符
*pszDest = *pcszSource;
pszDest++;
pcszSource++;
}
else
{
wchar_t wUnicode = 0;
char *pcUnicode = (char *)&wUnicode;
pcUnicode[1] = ((pcszSource[0] & 0x0F) << 4) + ((pcszSource[1] >> 2) & 0x0F);
pcUnicode[0] = ((pcszSource[1] & 0x03) << 6) + (pcszSource[2] & 0x3F);
wchar_t wMcb;
char *pcMbs = (char *)&wMcb;
int iLen = 0;
iLen = wctomb( pcMbs, wUnicode );
if ( iLen == 1 )
{
*pszDest = *pcMbs;
}
else
{
pszDest[0] = pcMbs[0];
pszDest[1] = pcMbs[1];
}
pszDest += iLen;
pcszSource += 3;
}
}
*pszDest = NULL;
setlocale( LC_ALL, strCurLocale.c_str() );
strCurLocale = pszBuffer; //废物利用
return strCurLocale;
}
wstring StringCodeConverter::utf8tounicode( const char *pcszSource )
{
if ( pcszSource == NULL )
{
throw string( "参数为NULL" );
}
string strCurLocale = setlocale( LC_ALL, NULL );
setlocale( LC_ALL, "chinese-simplified" ); //改成中文环境,如果接受的参数不是中文字符串,得注意结果
wchar_t *pwszBuffer = new wchar_t[ strlen( pcszSource ) ];
wchar_t *pwszDest = pwszBuffer;
while ( *pcszSource != NULL )
{
if ( *pcszSource > 0 )
{
//是ASCII字符
wchar_t wUnicode;
mbtowc( &wUnicode, pcszSource, 1 );
*pwszDest = wUnicode;
pwszDest++;
pcszSource++;
}
else
{
//中文字符3个字节
wchar_t wUnicode;
char *pcUnicode = (char *)&wUnicode;
pcUnicode[1] = ((pcszSource[0] & 0x0F) << 4) + ((pcszSource[1] >> 2) & 0x0F);
pcUnicode[0] = ((pcszSource[1] & 0x03) << 6) + (pcszSource[2] & 0x3F);
*pwszDest = wUnicode;
pwszDest++;
pcszSource += 3;
}
}
setlocale( LC_ALL, strCurLocale.c_str() );
*pwszDest = NULL;//末尾空字符
wstring wstrDest( pwszBuffer );
return wstrDest;
}

View File

@@ -0,0 +1,26 @@
#pragma once
#include <string>
namespace StringCodeConverter
{
using std::string;
using std::wstring;
size_t mbslen( const char *pcszSource );
wstring mbs2unicode( const string &strSource );
void mbs2unicode(const string &strSource, wstring &wstrDest);
void mbs2unicode(const char *pcszSource, wchar_t *pwszDest) throw ( string );
void mbs2utf8( const string &cstrSource, char *pszDest );
string unicode2mbs( const wstring &wstrSource );
void unicode2mbs( const wstring &wstrSource, string &strDest );
void unicode2mbs( const wchar_t *pwszSource, char *pszDest );
void unicode2utf8( const wstring &wstrSource, char *pszDest );
string utf8tombs( const char *pcszSource );
wstring utf8tounicode( const char *pcszSource );
};

View File

@@ -0,0 +1,64 @@
#include <QtCore/QtCore>
#include "SystemData.h"
//hash_map<string, string> parameters; //存放参数的hashmap
//版本号
const string cstrVersion = "0.99";
const string DB_FILE_NAME = "config.db";
string strUserCode;
string strUserName;
string strUserPassword;
//参数
//Parameters parameters( "config.db" );
Parameters* pParameters;
//bool checkVersion()
//{
// bool result = false;
// hash_map<string,string>::iterator iter = parameters.find( string("版本号") );
//
// if ( iter != parameters.end() && iter->second == cstrVersion )
// {
// result = true;
// }
//
// return result;
//}
void init_parameters()
{
QString dbFilePath = QCoreApplication::applicationDirPath();
dbFilePath.append( QString::fromLocal8Bit( "/" ) );
dbFilePath.append( QString::fromLocal8Bit( DB_FILE_NAME.c_str() ) );
pParameters = new Parameters( dbFilePath.toStdString() );
}
string getUserCode()
{
return strUserCode;
}
string getUserName()
{
return strUserName;
}
void setUserCode( const string& cstrUserCode )
{
strUserCode = cstrUserCode;
}
void setUserName( const string& cstrUserName )
{
strUserName = cstrUserName;
}
string getVersion()
{
return pParameters->getParameter( "version" );
}

View File

@@ -0,0 +1,40 @@
/*!
* \file SystemData.h
* \date 2014/08/18 13:23
*
* \author Kane
* Contact: user@company.com
*
* \brief
*
* TODO: long description
*
* \note
*/
#ifndef SystemData_h__
#define SystemData_h__
#include <unordered_map>
#include <string>
#include "Parameters.h"
using namespace std;
//extern hash_map<string, string> parameters;
extern Parameters * pParameters;
//bool checkVersion();
void init_parameters();
string getUserCode();
string getUserName();
void setUserCode( const string & cstrUserCode );
void setUserName( const string & cstrUserName );
string getVersion();
#endif // SystemData_h__

View File

@@ -0,0 +1,205 @@
#include <SQLAPI.h>
#include <string>
#include <vector>
//#include <libxl.h>
//#include "StringCodeConverter.h"
#include "SystemDataQuery.h"
//using namespace libxl;
using namespace std;
#pragma comment( lib, "user32.lib")
#pragma comment( lib, "version.lib")
#pragma comment( lib, "oleaut32.lib")
#pragma comment( lib, "ole32.lib")
#pragma comment( lib, "libxl.lib")
#ifdef _DEBUG
#pragma comment( lib, "sqlapisd.lib")
#else
#pragma comment( lib, "sqlapis.lib")
#endif
const char g_cszConnectStringIDS6[] =
"DRIVER={};"
"PROTOCOL=onsoctcp;"
"SERVICE=16191;"
"SERVER=xmcx1;"
"HOST=10.39.0.91;"
"DATABASE=ids6;"
"DB_LOCALE=en_US.819;";
const static char g_szUserNameIDS6[] = "ccx99";
const static char g_szPasswordIDS6[] = "c91IT09";
const static char g_cszConnectStringIDSt0[] =
"DRIVER={};"
"PROTOCOL=onsoctcp;"
"SERVICE=16193;"
"SERVER=xmcx3;"
"HOST=10.39.0.93;"
"DATABASE=idst0;"
"DB_LOCALE=en_US.819;";
const static char g_szUserNameIDSt0[] = "ccx99";
const static char g_szPasswordIDSt0[] = "c93IT09";
const static char g_cszConnstringYwgl[] =
"DRIVER={};"
"PROTOCOL=onsoctcp;"
"SERVICE=16192;"
"SERVER=xmcx2;"
"HOST=10.39.0.92;"
"DATABASE=ywgl_xm;"
"DB_LOCALE=en_US.819;";
const static char g_cszUserNameYwgl[] = "ccx99";
const static char g_cszPasswordYwgl[] = "c92IT09";
void query_user_info(const string & strCode, string & strName, string & strPassword)
{
SAConnection conn;
SACommand command;
string strCommand( "select rymc, rymm from rydm where rydm='" );
strCommand += strCode;
strCommand += "'";
command.setConnection( &conn );
command.setCommandText( strCommand.c_str() );
try
{
conn.Connect(
g_cszConnstringYwgl,
g_cszUserNameYwgl,
g_cszPasswordYwgl,
SA_Informix_Client );
command.Execute();
}
catch ( SAException &error )
{
//SAString strError = error.ErrText();
throw runtime_error( error.ErrText() );
}
if ( command.FetchNext() == true )
{
//名字
SAString sastrResult = command.Field("rymc").asString();
sastrResult.TrimRight();
strName = (const char *)sastrResult;
//密码
sastrResult = command.Field("rymm").asString();
sastrResult.TrimRight();
strPassword = (const char *)sastrResult;
}
conn.Disconnect();
}
void query_staff_info(const string & strOperatorCode, string & strOperatorName, string & strDeptCode, string & strDeptName, string & strOfficeCode, string & strOfficeName)
{
SAConnection connection;
SACommand command;
if ( strOperatorCode.size() == 0 )
{
return;
}
string strCommand =
"select a.staff_name, "
" b.department_code, "
" b.department_name, "
" c.section_office_c01, "
" c.section_office_n01 "
"from rydm_t a, bm_t b, ks_t c "
"where a.department_code = b.department_code "
" and a.section_office_c01 = c.section_office_c01 "
" and a.staff_code = '";
strCommand.append( strOperatorCode );
strCommand.append( "'" );
try
{
connection.Connect(
g_cszConnectStringIDSt0,
g_szUserNameIDSt0,
g_szPasswordIDSt0,
SA_Informix_Client );
command.setConnection( &connection );
command.setCommandText( strCommand.c_str() );
command.Execute();
if ( command.FetchNext() == true )
{
strOperatorName = (const char *)( command.Field( "staff_name").asString() );
strDeptCode = (const char *)( command.Field( "department_code").asString() );
strDeptName = (const char *)( command.Field( "department_name").asString() );
strOfficeCode = (const char *)( command.Field( "section_office_c01").asString() );
strOfficeName = (const char *)( command.Field( "section_office_n01").asString() );
}
connection.Disconnect();
}
catch ( SAException & sqlError )
{
runtime_error error( sqlError.ErrText() );
throw error;
}
}
void query_auto_trader_info(const string & strAutoTraderCode, string & strAutoTraderName)
{
SAConnection connection;
SACommand command;
string strCommand =
"select name "
" from shop_code_t "
" where code = '";
strCommand.append( strAutoTraderCode );
strCommand.append( "'" );
try
{
connection.Connect(
g_cszConnectStringIDSt0,
g_szUserNameIDSt0,
g_szPasswordIDSt0,
SA_Informix_Client );
command.setConnection( &connection );
command.setCommandText( strCommand.c_str() );
command.Execute();
if ( command.FetchNext() == true )
{
strAutoTraderName = (const char *)( command.Field( "name").asString() );
}
connection.Disconnect();
}
catch ( SAException & sqlError )
{
runtime_error error( sqlError.ErrText() );
throw error;
}
}

View File

@@ -0,0 +1,55 @@
#ifndef DataQuery_h__
#define DataQuery_h__
#include <string>
using std::string;
//************************************
// Method: QueryOperatorInfo
// FullName: QueryOperatorInfo
// Access: public
// Returns: void
// Qualifier: 查询系统用户的信息
// Parameter: const string & strCode 工号
// Parameter: string & strName 名字
// Parameter: string & strPassword 密码
//************************************
void query_user_info( const string & strCode,
string & strName,
string & strPassword );
//************************************
// Method: queryOperatorInfo
// FullName: queryOperatorInfo
// Access: public
// Returns: void
// Qualifier: 查询经办人的信息
// Parameter: const string & strOperatorCode 经办人代码
// Parameter: string & strOperatorName 经办人名称
// Parameter: string & strDeptCode 部门代码
// Parameter: string & strDeptName 部门名称
// Parameter: string & strOfficeCode 科室代码
// Parameter: string & strOfficeName 科室名称
//************************************
void query_staff_info( const string & strOperatorCode,
string & strOperatorName,
string & strDeptCode = string(),
string & strDeptName = string(),
string & strOfficeCode = string(),
string & strOfficeName = string() );
//************************************
// Method: query_auto_trader_info
// FullName: query_auto_trader_info
// Access: public
// Returns: void
// Qualifier: 查询车商信息
// Parameter: const string & strAutoTraderCode
// Parameter: string & strAutoTraderName
//************************************
void query_auto_trader_info( const string & strAutoTraderCode,
string & strAutoTraderName );
#endif // DataQuery_h__

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@@ -0,0 +1,2 @@
IDI_ICON1 ICON DISCARDABLE "TelSaleAuxKit.ico"

View File

@@ -0,0 +1,537 @@
#include "TelSalePolicyManager.h"
#include <string>
#include <sstream>
#include <exception>
#include <stdlib.h>
using namespace std;
using namespace StringCodeConverter;
#ifndef _UNICODE
#define _UNICODE
#endif
const char g_cszConnectStringIDS6[] =
"DRIVER={};"
"PROTOCOL=onsoctcp;"
"SERVICE=16191;"
"SERVER=xmcx1;"
"HOST=10.39.0.91;"
"DATABASE=ids6;"
"DB_LOCALE=en_US.819;";
const static char g_szUserNameIDS6[] = "ccx99";
const static char g_szPasswordIDS6[] = "c91IT09";
const static char g_cszConnstringYwgl[] =
"DRIVER={};"
"PROTOCOL=onsoctcp;"
"SERVICE=16192;"
"SERVER=xmcx2;"
"HOST=10.39.0.92;"
"DATABASE=ywgl_xm;"
"DB_LOCALE=en_US.819;";
const static char g_cszUserNameYwgl[] = "ccx99";
const static char g_cszPasswordYwgl[] = "c92IT09";
CTelSalePolicyManager::CTelSalePolicyManager(void)
{
}
CTelSalePolicyManager::~CTelSalePolicyManager(void)
{
}
void CTelSalePolicyManager::Query( SPolicyQuery &policy, std::vector<SPolicyRecord> &vPolicy )
{
SAConnection conn;
SACommand command;
//生成查询字符串
string strCommand;
strCommand.reserve( 1024 );
strCommand.append( "select bdh, zhjywy, to_char(czrq, '%Y年%m月%d日') from w_dxbd_i where 1=1 and czrq >='" );
strCommand += policy.strStartDate;
strCommand += "' and czrq <= '";
strCommand += policy.strEndDate;
strCommand += "'";
if ( policy.strPolicySerial.empty() == false )
{
strCommand += " and bdh = '";
strCommand += policy.strPolicySerial;
strCommand += "'";
}
if ( policy.strSalerCode.empty() == false )
{
strCommand += " and zhjywy = '";
strCommand += policy.strSalerCode;
strCommand += "'";
}
if ( policy.strPlateSerial.empty() == false )
{
strCommand += " and chph = '";
strCommand += policy.strPlateSerial;
strCommand += "'";
}
if ( policy.strFrameSerial.empty() == false )
{
strCommand += " and chjh = '";
strCommand += policy.strFrameSerial;
strCommand += "'";
}
if ( policy.strEngineSerial.empty() == false )
{
strCommand += " and fdjh = '";
strCommand += policy.strEngineSerial;
strCommand += "'";
}
command.setConnection( &conn );
command.setCommandText( strCommand.c_str() );
try
{
conn.Connect(
g_cszConnstringYwgl,
g_cszUserNameYwgl,
g_cszPasswordYwgl,
SA_Informix_Client );
command.Execute();
}
catch ( SAException &error )
{
string strError = error.ErrText();
throw strError;
}
while ( command.FetchNext() == true )
{
SPolicyRecord policyQuery;
SAString strCol = command.Field( 1 ).asString();
strCol.TrimRight();
policyQuery.strPolicySerial = strCol;
strCol = command.Field( 2 ).asString();
strCol.TrimRight();
policyQuery.strSalerCode = strCol;
strCol = (SAString)command.Field( 3 ).asString();
strCol.TrimRight();
policyQuery.strOperatorDate = strCol;
vPolicy.push_back( policyQuery );
}
conn.Disconnect();
}
string QueryOperatorName( string strOperatorCode )
{
SAConnection conn;
SACommand command;
string strCommand( "select rymc from rydm where rydm='" );
string strResult;
strCommand += strOperatorCode;
strCommand += "'";
command.setConnection( &conn );
command.setCommandText( strCommand.c_str() );
try
{
conn.Connect(
"DRIVER={};"
"PROTOCOL=onsoctcp;" // protocol in lower case
"SERVICE=7777;"
"SERVER=xmtb1;"
"HOST=10.39.0.80;"
"DATABASE=datacenter;",
"ccxuser",
"ccx99",
SA_Informix_Client );
command.Execute();
}
catch ( SAException &error )
{
SAString strError = error.ErrText();
}
if ( command.FetchNext() == true )
{
SAString sastrResult = command.Field("rymc").asString();
sastrResult.TrimRight();
strResult = (const char *)sastrResult;
}
conn.Disconnect();
return strResult;
}
void QueryOperatorInfo( const string & cstrOperatorCode,
string & strOperatorName,
string & strDeptCode,
string & strDeptName )
{
SAConnection connection;
SACommand command;
string strCommand = "select a.staff_name, "
" a.department_code,"
" b.department_name "
"from rydm_t a, bm_t b "
"where a.department_code = b.department_code "
"and a.staff_code = '";
strCommand.append( cstrOperatorCode );
strCommand.append( "'" );
try
{
connection.Connect( g_cszConnectStringIDS6,
g_szUserNameIDS6,
g_szPasswordIDS6,
SA_Informix_Client );
command.setConnection( &connection );
command.setCommandText( strCommand.c_str() );
command.Execute();
if ( command.FetchNext() == true )
{
strOperatorName = (const char *)( command.Field( "staff_name").asString() );
strDeptCode = (const char *)( command.Field( "department_code").asString() );
strDeptName = (const char *)( command.Field( "department_name").asString() );
}
connection.Disconnect();
}
catch ( SAException & sqlError )
{
runtime_error error( sqlError.ErrText() );
throw error;
}
}
void CTelSalePolicyManager::SavePolicy( const SPolicyRecord & policy,
const vector<TelSalePolicyGift> giftList )
{
if ( policy.strPolicySerial.empty() == true )
{
throw invalid_argument( "保单号为空!" );
}
if ( policy.strSalerCode.empty() == true )
{
throw invalid_argument( "保单号为空!" );
}
ostringstream ostrCommand;
string strAutotraderCall;
//车店联呼
if ( policy.bIsAutotraderCall == true )
{
strAutotraderCall = "1";
}
else
{
strAutotraderCall = "0";
}
ostrCommand << "insert into w_dxbd_i ( khjl, khjllx, bdh, zhjywy, zhjywymc, zhjywybm, zhjywybmm, czydm, czrq , chdlh, khmc, chph, chjh, fdjh ) "
"values( 0, 0, "
<< "'" << policy.strPolicySerial << "', "
<< "'" << policy.strSalerCode << "', "
<< "'" << policy.strSalerName << "', "
<< "'" << policy.strSalerDeptCode << "', "
<< "'" << policy.strSalerDeptName << "', "
<< "'" << policy.strOperatorCode << "', "
<< "'" << policy.strOperatorDate << "', "
<< "'" << strAutotraderCall << "'";
if ( policy.strCustomerName.empty() == false )
{
ostrCommand << ", '" << policy.strCustomerName << "'";
}
else
{
ostrCommand << ", NULL";
}
if ( policy.strPlateSerial.empty() == false )
{
ostrCommand << ", '" << policy.strPlateSerial << "'";
}
else
{
ostrCommand << ", NULL";
}
if ( policy.strFrameSerial.empty() == false )
{
ostrCommand << ", '" << policy.strFrameSerial << "'";
}
else
{
ostrCommand << ", NULL";
}
if ( policy.strEngineSerial.empty() == false )
{
ostrCommand << ", '" << policy.strEngineSerial << "'";
}
else
{
ostrCommand << ", NULL";
}
ostrCommand << " )";
string strCommand = ostrCommand.str();
SAConnection conn;
SACommand command;
command.setConnection( &conn );
command.setCommandText( strCommand.c_str() );
try
{
conn.Connect(
g_cszConnstringYwgl,
g_cszUserNameYwgl,
g_cszPasswordYwgl,
SA_Informix_Client );
//conn.setAutoCommit( SA_AutoCommitOff ); //导致锁表
//保存保单
command.Execute();
//保存礼品列表,先删除旧数据
command.setCommandText( "delete w_dxbd_gift_i where bdh = :1 " );
command.Param( 1 ).setAsString() = policy.strPolicySerial.c_str();
command.Execute();
command.setCommandText( "insert into w_dxbd_gift_i ( bdh, gift_name, gift_price ) values ( :1, :2, :3 )" );
for ( vector<TelSalePolicyGift>::const_iterator iter = giftList.begin(); iter != giftList.end(); ++iter )
{
command.Param( 1 ).setAsString() = policy.strPolicySerial.c_str();
command.Param( 2 ).setAsString() = iter->GiftName().c_str();
command.Param( 3 ).setAsString() = iter->GiftDefaultPrice().c_str();
command.Execute();
}
conn.Commit();
}
catch ( SAException &error )
{
conn.Rollback();
conn.Disconnect();
throw runtime_error( error.ErrText() );
}
conn.Disconnect();
}
void CTelSalePolicyManager::LoadFromExcelFile( const char *pcszFilePath, vector< SPolicyRecord > *pvPolicy )
{
if ( pvPolicy == NULL )
{
return;
}
wchar_t pwszFilePath[1024];
mbs2unicode( pcszFilePath, pwszFilePath );
IBookT<wchar_t> *pBookPolicy = xlCreateXMLBookW();
if ( pBookPolicy == NULL )
{
return;
}
if ( !(pBookPolicy->load( pwszFilePath )) )
{
const char *pcszError = pBookPolicy->errorMessage();
pBookPolicy->release();
}
ISheetT<wchar_t> *pSheet = pBookPolicy->getSheet( 0 );
if ( pSheet == NULL )
{
pBookPolicy->release();
return;
}
int iStartRow = pSheet->firstRow();
int iEndROw = pSheet->lastRow();
for ( iStartRow++; iStartRow <= iEndROw; iStartRow++ )
{
SPolicyRecord policy;
policy.strPolicySerial = getCellString( pSheet, iStartRow, 0 );
if ( policy.strPolicySerial.empty() == true )
{
iStartRow++;
continue;
}
policy.strSalerCode = getCellString( pSheet, iStartRow, 1 );
policy.strCustomerName = getCellString( pSheet, iStartRow, 2 );
policy.strPlateSerial = getCellString( pSheet, iStartRow, 3 );
policy.strFrameSerial = getCellString( pSheet, iStartRow, 4 );
policy.strEngineSerial = getCellString( pSheet, iStartRow, 5 );
pvPolicy->push_back( policy );
}
pBookPolicy->release();
}
void CTelSalePolicyManager::SavePolicyGift( const string & strPolicyNo, const vector<TelSalePolicyGift> & giftsList )
{
if ( strPolicyNo.empty() )
{
throw invalid_argument( "strPolicyNo" );
}
if ( giftsList.empty() )
{
throw invalid_argument( "礼品列表为空!" );
}
SAConnection conn;
SACommand command;
command.setConnection( &conn );
command.setCommandText( "insert into w_dxbd_gift_i ( bdh, gift_name, gift_price ) values ( :1, :2, :3 )" );
try
{
conn.Connect( g_cszConnstringYwgl,
g_cszUserNameYwgl,
g_cszPasswordYwgl,
SA_Informix_Client );
for ( vector<TelSalePolicyGift>::const_iterator iter = giftsList.begin(); iter != giftsList.end(); ++iter )
{
command.Param( 1 ).setAsString() = strPolicyNo.c_str();
command.Param( 2 ).setAsString() = iter->GiftName().c_str();
command.Param( 3 ).setAsString() = iter->GiftDefaultPrice().c_str();
command.Execute();
}
}
catch ( SAException &error )
{
throw runtime_error( error.ErrText() );
}
conn.Disconnect();
}
string getCellString( ISheetT<wchar_t> *pSheet, int iRowIndex, int iColIndex )
{
if ( pSheet == NULL )
{
return NULL;
}
string strCell;
int iCellValue;
const char *pcszBuffer = NULL;
char pszNumber[100];
CellType celltype = pSheet->cellType( iRowIndex, iColIndex );
switch ( celltype )
{
case CELLTYPE_STRING:
//字符串
strCell = unicode2mbs( pSheet->readStr( iRowIndex, iColIndex ) );
break;
case CELLTYPE_NUMBER:
//数字
iCellValue = pSheet->readNum( iRowIndex, iColIndex );
sprintf( pszNumber,"%d", iCellValue );
strCell = pszNumber;
break;
}
return strCell;
}
void queryTelsalePolicyGifts( vector<TelSalePolicyGift> &giftList )
{
SAConnection connection;
SACommand command;
string strSQL = "select id, trim(name), default_price from w_dx_gifts";
command.setConnection( &connection );
command.setCommandText( strSQL.c_str() );
try
{
connection.Connect(
g_cszConnstringYwgl,
g_cszUserNameYwgl,
g_cszPasswordYwgl,
SA_Informix_Client );
command.Execute();
}
catch ( SAException &error )
{
throw runtime_error( error.ErrText() );
}
while ( command.FetchNext() )
{
TelSalePolicyGift gift;
gift.Id( command.Field(1).asLong() );
gift.GiftName( (const char *)(command.Field(2).asString()) );
gift.GiftDefaultPrice( (const char *)(command.Field(3).asString()) );
giftList.push_back( gift );
}
connection.Disconnect();
}

View File

@@ -0,0 +1,96 @@
#pragma once
#include <SQLAPI.h>
#include <string>
#include <vector>
#include <libxl.h>
#include "StringCodeConverter.h"
using namespace libxl;
using namespace std;
// #pragma comment( lib, "user32.lib")
// #pragma comment( lib, "version.lib")
// #pragma comment( lib, "oleaut32.lib")
// #pragma comment( lib, "ole32.lib")
// #pragma comment( lib, "libxl.lib")
#ifdef _DEBUG
#pragma comment( lib, "sqlapisd.lib")
#else
#pragma comment( lib, "sqlapis.lib")
#endif
typedef struct
{
std::string strPolicySerial;
std::string strSalerCode;
std::string strSalerName;
std::string strSalerDeptCode;
std::string strSalerDeptName;
std::string strCustomerName;
std::string strPlateSerial;
std::string strFrameSerial;
std::string strEngineSerial;
std::string strOperatorDate;
std::string strOperatorCode;
bool bIsAutotraderCall;
} SPolicyRecord;
typedef struct
{
std::string strPolicySerial;
std::string strSalerCode;
std::string strPlateSerial;
std::string strFrameSerial;
std::string strEngineSerial;
std::string strStartDate;
std::string strEndDate;
} SPolicyQuery;
class TelSalePolicyGift
{
public:
TelSalePolicyGift() {};
TelSalePolicyGift( int id, string & name, string & defaultPrice ) : m_id( id ), m_giftName( name ), m_giftDefaultPrice( defaultPrice ) {}
int Id() const { return m_id; }
void Id(int val) { m_id = val; }
string GiftName() const { return m_giftName; }
void GiftName(string val) { m_giftName = val; }
string GiftDefaultPrice() const { return m_giftDefaultPrice; }
void GiftDefaultPrice(string val) { m_giftDefaultPrice = val; }
private:
int m_id;
string m_giftName;
string m_giftDefaultPrice;
};
class CTelSalePolicyManager
{
public:
CTelSalePolicyManager(void);
virtual ~CTelSalePolicyManager(void);
public:
static void Query( SPolicyQuery &policy, std::vector<SPolicyRecord> &vPolicy );
static void SavePolicy( const SPolicyRecord & policy, const vector<TelSalePolicyGift> giftList );
static void SavePolicyGift( const string & strPolicyNo, const vector<TelSalePolicyGift> & giftsList );
static void LoadFromExcelFile( const char *pcszFilePath, std::vector<SPolicyRecord> *pvPolicy );
};
std::string QueryOperatorName( std::string strOperatorCode );
void QueryOperatorInfo( const string & cstrOperatorCode,
string & strOperatorName,
string & strDeptCode,
string & strDeptName );
std::string getCellString( ISheetT<wchar_t> *pSheet, int iRowIndex, int iColIndex );
void queryTelsalePolicyGifts( vector<TelSalePolicyGift> &giftList );

View File

@@ -0,0 +1,49 @@
#include "check.h"
unordered_map<string, string> parameters; //存放参数的hashmap
//版本号
const string cstrVersion = "0.99";
string strUserCode;
string strUserName;
string strUserPassword;
bool checkVersion()
{
bool result = false;
unordered_map<string,string>::iterator iter = parameters.find( string("版本号") );
if ( iter != parameters.end() && iter->second == cstrVersion )
{
result = true;
}
return result;
}
string getUserCode()
{
return strUserCode;
}
string getUserName()
{
return strUserName;
}
void setUserCode(const string & cstrUserCode)
{
strUserCode = cstrUserCode;
}
void setUserName(const string & cstrUserName)
{
strUserName = cstrUserName;
}
string getVersion()
{
return cstrVersion;
}

View File

@@ -0,0 +1,22 @@
#ifndef check_h__
#define check_h__
#include <string>
#include <unordered_map>
using namespace std;
extern unordered_map<string, string> parameters;
bool checkVersion();
string getUserCode();
string getUserName();
void setUserCode( const string & cstrUserCode );
void setUserName( const string & cstrUserName );
string getVersion();
#endif // check_h__

Binary file not shown.

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<ExecutablePath>D:\SDK\libxl\libxl_3.1.0\bin;$(ExecutablePath)</ExecutablePath>
</PropertyGroup>
<PropertyGroup>
<IncludePath>D:\SDK\libxl\libxl_3.1.0\include_cpp;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup>
<LibraryPath>D:\SDK\libxl\libxl_3.1.0\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup />
<ItemGroup />
</Project>

View File

@@ -0,0 +1,75 @@
//#include <QTextCodec>
#include <QtWidgets/QtWidgets>
#include <QtWidgets/QApplication>
#include <exception>
#include "QMainFrame.h"
#include "QLoginWidget.h"
#include "SystemData.h"
using namespace std;
int main( int argc, char * argv[] )
{
QApplication * pApp = new QApplication(argc, argv);;
QLoginWidget * pLogin = NULL;
QMainFrame * pMainFrame = NULL;
//返回值
int iReturnCode = 0;
try
{
//初始化参数数据库
init_parameters();
}
catch ( std::runtime_error & error )
{
QMessageBox::critical( NULL,
QString::fromLocal8Bit( "参数读取错误" ),
QString::fromLocal8Bit( error.what() ) );
return iReturnCode;
}
try
{
//pApp =
pLogin = new QLoginWidget();
pLogin->exec();
if ( pLogin->isLogin() == true )
{
pMainFrame = new QMainFrame();
pMainFrame->showMaximized();
iReturnCode = pApp->exec();
}
}
catch ( runtime_error & error )
{
QMessageBox::critical( NULL,
QString::fromLocal8Bit( "错误" ),
QString::fromLocal8Bit( error.what() ) );
}
//清理
if ( pLogin != NULL )
{
delete pLogin;
}
if ( pMainFrame != NULL )
{
delete pMainFrame;
}
if (pApp != NULL)
{
delete pApp;
}
return iReturnCode;
}

View File

@@ -0,0 +1,25 @@
<RCC>
<qresource prefix="/QMainFrame">
<file>Resources/car.png</file>
<file>Resources/car2.png</file>
<file>Resources/clean.png</file>
<file>Resources/CPIC.png</file>
<file>Resources/dec.png</file>
<file>Resources/edit.png</file>
<file>Resources/excel.png</file>
<file>Resources/find.png</file>
<file>Resources/gear.png</file>
<file>Resources/login.png</file>
<file>Resources/manager.png</file>
<file>Resources/new.png</file>
<file>Resources/ok.png</file>
<file>Resources/plus.png</file>
<file>Resources/save.png</file>
<file>Resources/save2.png</file>
<file>Resources/tongji.png</file>
<file>Resources/x.png</file>
<file>Resources/telephone.png</file>
<file>Resources/8218_box1.png</file>
<file>Resources/CNY_Red.png</file>
</qresource>
</RCC>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<ExecutablePath>D:\SDK\sqlapi\sqlapi_msvc2010_3.8.1\bin;$(ExecutablePath)</ExecutablePath>
</PropertyGroup>
<PropertyGroup>
<IncludePath>D:\SDK\sqlapi\sqlapi_msvc2010_3.8.1\include;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup>
<LibraryPath>D:\SDK\sqlapi\sqlapi_msvc2010_3.8.1\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup />
<ItemGroup />
</Project>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,615 @@
/*
** 2006 June 7
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the SQLite interface for use by
** shared libraries that want to be imported as extensions into
** an SQLite instance. Shared libraries that intend to be loaded
** as extensions by SQLite should #include this file instead of
** sqlite3.h.
*/
#ifndef SQLITE3EXT_H
#define SQLITE3EXT_H
#include "sqlite3.h"
/*
** The following structure holds pointers to all of the SQLite API
** routines.
**
** WARNING: In order to maintain backwards compatibility, add new
** interfaces to the end of this structure only. If you insert new
** interfaces in the middle of this structure, then older different
** versions of SQLite will not be able to load each other's shared
** libraries!
*/
struct sqlite3_api_routines {
void * (*aggregate_context)(sqlite3_context*,int nBytes);
int (*aggregate_count)(sqlite3_context*);
int (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*));
int (*bind_double)(sqlite3_stmt*,int,double);
int (*bind_int)(sqlite3_stmt*,int,int);
int (*bind_int64)(sqlite3_stmt*,int,sqlite_int64);
int (*bind_null)(sqlite3_stmt*,int);
int (*bind_parameter_count)(sqlite3_stmt*);
int (*bind_parameter_index)(sqlite3_stmt*,const char*zName);
const char * (*bind_parameter_name)(sqlite3_stmt*,int);
int (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*));
int (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*));
int (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*);
int (*busy_handler)(sqlite3*,int(*)(void*,int),void*);
int (*busy_timeout)(sqlite3*,int ms);
int (*changes)(sqlite3*);
int (*close)(sqlite3*);
int (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*,
int eTextRep,const char*));
int (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*,
int eTextRep,const void*));
const void * (*column_blob)(sqlite3_stmt*,int iCol);
int (*column_bytes)(sqlite3_stmt*,int iCol);
int (*column_bytes16)(sqlite3_stmt*,int iCol);
int (*column_count)(sqlite3_stmt*pStmt);
const char * (*column_database_name)(sqlite3_stmt*,int);
const void * (*column_database_name16)(sqlite3_stmt*,int);
const char * (*column_decltype)(sqlite3_stmt*,int i);
const void * (*column_decltype16)(sqlite3_stmt*,int);
double (*column_double)(sqlite3_stmt*,int iCol);
int (*column_int)(sqlite3_stmt*,int iCol);
sqlite_int64 (*column_int64)(sqlite3_stmt*,int iCol);
const char * (*column_name)(sqlite3_stmt*,int);
const void * (*column_name16)(sqlite3_stmt*,int);
const char * (*column_origin_name)(sqlite3_stmt*,int);
const void * (*column_origin_name16)(sqlite3_stmt*,int);
const char * (*column_table_name)(sqlite3_stmt*,int);
const void * (*column_table_name16)(sqlite3_stmt*,int);
const unsigned char * (*column_text)(sqlite3_stmt*,int iCol);
const void * (*column_text16)(sqlite3_stmt*,int iCol);
int (*column_type)(sqlite3_stmt*,int iCol);
sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol);
void * (*commit_hook)(sqlite3*,int(*)(void*),void*);
int (*complete)(const char*sql);
int (*complete16)(const void*sql);
int (*create_collation)(sqlite3*,const char*,int,void*,
int(*)(void*,int,const void*,int,const void*));
int (*create_collation16)(sqlite3*,const void*,int,void*,
int(*)(void*,int,const void*,int,const void*));
int (*create_function)(sqlite3*,const char*,int,int,void*,
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
void (*xFinal)(sqlite3_context*));
int (*create_function16)(sqlite3*,const void*,int,int,void*,
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
void (*xFinal)(sqlite3_context*));
int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*);
int (*data_count)(sqlite3_stmt*pStmt);
sqlite3 * (*db_handle)(sqlite3_stmt*);
int (*declare_vtab)(sqlite3*,const char*);
int (*enable_shared_cache)(int);
int (*errcode)(sqlite3*db);
const char * (*errmsg)(sqlite3*);
const void * (*errmsg16)(sqlite3*);
int (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**);
int (*expired)(sqlite3_stmt*);
int (*finalize)(sqlite3_stmt*pStmt);
void (*free)(void*);
void (*free_table)(char**result);
int (*get_autocommit)(sqlite3*);
void * (*get_auxdata)(sqlite3_context*,int);
int (*get_table)(sqlite3*,const char*,char***,int*,int*,char**);
int (*global_recover)(void);
void (*interruptx)(sqlite3*);
sqlite_int64 (*last_insert_rowid)(sqlite3*);
const char * (*libversion)(void);
int (*libversion_number)(void);
void *(*malloc)(int);
char * (*mprintf)(const char*,...);
int (*open)(const char*,sqlite3**);
int (*open16)(const void*,sqlite3**);
int (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
int (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*);
void (*progress_handler)(sqlite3*,int,int(*)(void*),void*);
void *(*realloc)(void*,int);
int (*reset)(sqlite3_stmt*pStmt);
void (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*));
void (*result_double)(sqlite3_context*,double);
void (*result_error)(sqlite3_context*,const char*,int);
void (*result_error16)(sqlite3_context*,const void*,int);
void (*result_int)(sqlite3_context*,int);
void (*result_int64)(sqlite3_context*,sqlite_int64);
void (*result_null)(sqlite3_context*);
void (*result_text)(sqlite3_context*,const char*,int,void(*)(void*));
void (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*));
void (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*));
void (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*));
void (*result_value)(sqlite3_context*,sqlite3_value*);
void * (*rollback_hook)(sqlite3*,void(*)(void*),void*);
int (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*,
const char*,const char*),void*);
void (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*));
char * (*xsnprintf)(int,char*,const char*,...);
int (*step)(sqlite3_stmt*);
int (*table_column_metadata)(sqlite3*,const char*,const char*,const char*,
char const**,char const**,int*,int*,int*);
void (*thread_cleanup)(void);
int (*total_changes)(sqlite3*);
void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*);
int (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*);
void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*,
sqlite_int64),void*);
void * (*user_data)(sqlite3_context*);
const void * (*value_blob)(sqlite3_value*);
int (*value_bytes)(sqlite3_value*);
int (*value_bytes16)(sqlite3_value*);
double (*value_double)(sqlite3_value*);
int (*value_int)(sqlite3_value*);
sqlite_int64 (*value_int64)(sqlite3_value*);
int (*value_numeric_type)(sqlite3_value*);
const unsigned char * (*value_text)(sqlite3_value*);
const void * (*value_text16)(sqlite3_value*);
const void * (*value_text16be)(sqlite3_value*);
const void * (*value_text16le)(sqlite3_value*);
int (*value_type)(sqlite3_value*);
char *(*vmprintf)(const char*,va_list);
/* Added ??? */
int (*overload_function)(sqlite3*, const char *zFuncName, int nArg);
/* Added by 3.3.13 */
int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
int (*clear_bindings)(sqlite3_stmt*);
/* Added by 3.4.1 */
int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*,
void (*xDestroy)(void *));
/* Added by 3.5.0 */
int (*bind_zeroblob)(sqlite3_stmt*,int,int);
int (*blob_bytes)(sqlite3_blob*);
int (*blob_close)(sqlite3_blob*);
int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64,
int,sqlite3_blob**);
int (*blob_read)(sqlite3_blob*,void*,int,int);
int (*blob_write)(sqlite3_blob*,const void*,int,int);
int (*create_collation_v2)(sqlite3*,const char*,int,void*,
int(*)(void*,int,const void*,int,const void*),
void(*)(void*));
int (*file_control)(sqlite3*,const char*,int,void*);
sqlite3_int64 (*memory_highwater)(int);
sqlite3_int64 (*memory_used)(void);
sqlite3_mutex *(*mutex_alloc)(int);
void (*mutex_enter)(sqlite3_mutex*);
void (*mutex_free)(sqlite3_mutex*);
void (*mutex_leave)(sqlite3_mutex*);
int (*mutex_try)(sqlite3_mutex*);
int (*open_v2)(const char*,sqlite3**,int,const char*);
int (*release_memory)(int);
void (*result_error_nomem)(sqlite3_context*);
void (*result_error_toobig)(sqlite3_context*);
int (*sleep)(int);
void (*soft_heap_limit)(int);
sqlite3_vfs *(*vfs_find)(const char*);
int (*vfs_register)(sqlite3_vfs*,int);
int (*vfs_unregister)(sqlite3_vfs*);
int (*xthreadsafe)(void);
void (*result_zeroblob)(sqlite3_context*,int);
void (*result_error_code)(sqlite3_context*,int);
int (*test_control)(int, ...);
void (*randomness)(int,void*);
sqlite3 *(*context_db_handle)(sqlite3_context*);
int (*extended_result_codes)(sqlite3*,int);
int (*limit)(sqlite3*,int,int);
sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*);
const char *(*sql)(sqlite3_stmt*);
int (*status)(int,int*,int*,int);
int (*backup_finish)(sqlite3_backup*);
sqlite3_backup *(*backup_init)(sqlite3*,const char*,sqlite3*,const char*);
int (*backup_pagecount)(sqlite3_backup*);
int (*backup_remaining)(sqlite3_backup*);
int (*backup_step)(sqlite3_backup*,int);
const char *(*compileoption_get)(int);
int (*compileoption_used)(const char*);
int (*create_function_v2)(sqlite3*,const char*,int,int,void*,
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
void (*xFinal)(sqlite3_context*),
void(*xDestroy)(void*));
int (*db_config)(sqlite3*,int,...);
sqlite3_mutex *(*db_mutex)(sqlite3*);
int (*db_status)(sqlite3*,int,int*,int*,int);
int (*extended_errcode)(sqlite3*);
void (*log)(int,const char*,...);
sqlite3_int64 (*soft_heap_limit64)(sqlite3_int64);
const char *(*sourceid)(void);
int (*stmt_status)(sqlite3_stmt*,int,int);
int (*strnicmp)(const char*,const char*,int);
int (*unlock_notify)(sqlite3*,void(*)(void**,int),void*);
int (*wal_autocheckpoint)(sqlite3*,int);
int (*wal_checkpoint)(sqlite3*,const char*);
void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*);
int (*blob_reopen)(sqlite3_blob*,sqlite3_int64);
int (*vtab_config)(sqlite3*,int op,...);
int (*vtab_on_conflict)(sqlite3*);
/* Version 3.7.16 and later */
int (*close_v2)(sqlite3*);
const char *(*db_filename)(sqlite3*,const char*);
int (*db_readonly)(sqlite3*,const char*);
int (*db_release_memory)(sqlite3*);
const char *(*errstr)(int);
int (*stmt_busy)(sqlite3_stmt*);
int (*stmt_readonly)(sqlite3_stmt*);
int (*stricmp)(const char*,const char*);
int (*uri_boolean)(const char*,const char*,int);
sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64);
const char *(*uri_parameter)(const char*,const char*);
char *(*xvsnprintf)(int,char*,const char*,va_list);
int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*);
/* Version 3.8.7 and later */
int (*auto_extension)(void(*)(void));
int (*bind_blob64)(sqlite3_stmt*,int,const void*,sqlite3_uint64,
void(*)(void*));
int (*bind_text64)(sqlite3_stmt*,int,const char*,sqlite3_uint64,
void(*)(void*),unsigned char);
int (*cancel_auto_extension)(void(*)(void));
int (*load_extension)(sqlite3*,const char*,const char*,char**);
void *(*malloc64)(sqlite3_uint64);
sqlite3_uint64 (*msize)(void*);
void *(*realloc64)(void*,sqlite3_uint64);
void (*reset_auto_extension)(void);
void (*result_blob64)(sqlite3_context*,const void*,sqlite3_uint64,
void(*)(void*));
void (*result_text64)(sqlite3_context*,const char*,sqlite3_uint64,
void(*)(void*), unsigned char);
int (*strglob)(const char*,const char*);
/* Version 3.8.11 and later */
sqlite3_value *(*value_dup)(const sqlite3_value*);
void (*value_free)(sqlite3_value*);
int (*result_zeroblob64)(sqlite3_context*,sqlite3_uint64);
int (*bind_zeroblob64)(sqlite3_stmt*, int, sqlite3_uint64);
/* Version 3.9.0 and later */
unsigned int (*value_subtype)(sqlite3_value*);
void (*result_subtype)(sqlite3_context*,unsigned int);
/* Version 3.10.0 and later */
int (*status64)(int,sqlite3_int64*,sqlite3_int64*,int);
int (*strlike)(const char*,const char*,unsigned int);
int (*db_cacheflush)(sqlite3*);
/* Version 3.12.0 and later */
int (*system_errno)(sqlite3*);
/* Version 3.14.0 and later */
int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*);
char *(*expanded_sql)(sqlite3_stmt*);
/* Version 3.18.0 and later */
void (*set_last_insert_rowid)(sqlite3*,sqlite3_int64);
/* Version 3.20.0 and later */
int (*prepare_v3)(sqlite3*,const char*,int,unsigned int,
sqlite3_stmt**,const char**);
int (*prepare16_v3)(sqlite3*,const void*,int,unsigned int,
sqlite3_stmt**,const void**);
int (*bind_pointer)(sqlite3_stmt*,int,void*,const char*,void(*)(void*));
void (*result_pointer)(sqlite3_context*,void*,const char*,void(*)(void*));
void *(*value_pointer)(sqlite3_value*,const char*);
int (*vtab_nochange)(sqlite3_context*);
int (*value_nochange)(sqlite3_value*);
const char *(*vtab_collation)(sqlite3_index_info*,int);
/* Version 3.24.0 and later */
int (*keyword_count)(void);
int (*keyword_name)(int,const char**,int*);
int (*keyword_check)(const char*,int);
sqlite3_str *(*str_new)(sqlite3*);
char *(*str_finish)(sqlite3_str*);
void (*str_appendf)(sqlite3_str*, const char *zFormat, ...);
void (*str_vappendf)(sqlite3_str*, const char *zFormat, va_list);
void (*str_append)(sqlite3_str*, const char *zIn, int N);
void (*str_appendall)(sqlite3_str*, const char *zIn);
void (*str_appendchar)(sqlite3_str*, int N, char C);
void (*str_reset)(sqlite3_str*);
int (*str_errcode)(sqlite3_str*);
int (*str_length)(sqlite3_str*);
char *(*str_value)(sqlite3_str*);
};
/*
** This is the function signature used for all extension entry points. It
** is also defined in the file "loadext.c".
*/
typedef int (*sqlite3_loadext_entry)(
sqlite3 *db, /* Handle to the database. */
char **pzErrMsg, /* Used to set error string on failure. */
const sqlite3_api_routines *pThunk /* Extension API function pointers. */
);
/*
** The following macros redefine the API routines so that they are
** redirected through the global sqlite3_api structure.
**
** This header file is also used by the loadext.c source file
** (part of the main SQLite library - not an extension) so that
** it can get access to the sqlite3_api_routines structure
** definition. But the main library does not want to redefine
** the API. So the redefinition macros are only valid if the
** SQLITE_CORE macros is undefined.
*/
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
#define sqlite3_aggregate_context sqlite3_api->aggregate_context
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_aggregate_count sqlite3_api->aggregate_count
#endif
#define sqlite3_bind_blob sqlite3_api->bind_blob
#define sqlite3_bind_double sqlite3_api->bind_double
#define sqlite3_bind_int sqlite3_api->bind_int
#define sqlite3_bind_int64 sqlite3_api->bind_int64
#define sqlite3_bind_null sqlite3_api->bind_null
#define sqlite3_bind_parameter_count sqlite3_api->bind_parameter_count
#define sqlite3_bind_parameter_index sqlite3_api->bind_parameter_index
#define sqlite3_bind_parameter_name sqlite3_api->bind_parameter_name
#define sqlite3_bind_text sqlite3_api->bind_text
#define sqlite3_bind_text16 sqlite3_api->bind_text16
#define sqlite3_bind_value sqlite3_api->bind_value
#define sqlite3_busy_handler sqlite3_api->busy_handler
#define sqlite3_busy_timeout sqlite3_api->busy_timeout
#define sqlite3_changes sqlite3_api->changes
#define sqlite3_close sqlite3_api->close
#define sqlite3_collation_needed sqlite3_api->collation_needed
#define sqlite3_collation_needed16 sqlite3_api->collation_needed16
#define sqlite3_column_blob sqlite3_api->column_blob
#define sqlite3_column_bytes sqlite3_api->column_bytes
#define sqlite3_column_bytes16 sqlite3_api->column_bytes16
#define sqlite3_column_count sqlite3_api->column_count
#define sqlite3_column_database_name sqlite3_api->column_database_name
#define sqlite3_column_database_name16 sqlite3_api->column_database_name16
#define sqlite3_column_decltype sqlite3_api->column_decltype
#define sqlite3_column_decltype16 sqlite3_api->column_decltype16
#define sqlite3_column_double sqlite3_api->column_double
#define sqlite3_column_int sqlite3_api->column_int
#define sqlite3_column_int64 sqlite3_api->column_int64
#define sqlite3_column_name sqlite3_api->column_name
#define sqlite3_column_name16 sqlite3_api->column_name16
#define sqlite3_column_origin_name sqlite3_api->column_origin_name
#define sqlite3_column_origin_name16 sqlite3_api->column_origin_name16
#define sqlite3_column_table_name sqlite3_api->column_table_name
#define sqlite3_column_table_name16 sqlite3_api->column_table_name16
#define sqlite3_column_text sqlite3_api->column_text
#define sqlite3_column_text16 sqlite3_api->column_text16
#define sqlite3_column_type sqlite3_api->column_type
#define sqlite3_column_value sqlite3_api->column_value
#define sqlite3_commit_hook sqlite3_api->commit_hook
#define sqlite3_complete sqlite3_api->complete
#define sqlite3_complete16 sqlite3_api->complete16
#define sqlite3_create_collation sqlite3_api->create_collation
#define sqlite3_create_collation16 sqlite3_api->create_collation16
#define sqlite3_create_function sqlite3_api->create_function
#define sqlite3_create_function16 sqlite3_api->create_function16
#define sqlite3_create_module sqlite3_api->create_module
#define sqlite3_create_module_v2 sqlite3_api->create_module_v2
#define sqlite3_data_count sqlite3_api->data_count
#define sqlite3_db_handle sqlite3_api->db_handle
#define sqlite3_declare_vtab sqlite3_api->declare_vtab
#define sqlite3_enable_shared_cache sqlite3_api->enable_shared_cache
#define sqlite3_errcode sqlite3_api->errcode
#define sqlite3_errmsg sqlite3_api->errmsg
#define sqlite3_errmsg16 sqlite3_api->errmsg16
#define sqlite3_exec sqlite3_api->exec
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_expired sqlite3_api->expired
#endif
#define sqlite3_finalize sqlite3_api->finalize
#define sqlite3_free sqlite3_api->free
#define sqlite3_free_table sqlite3_api->free_table
#define sqlite3_get_autocommit sqlite3_api->get_autocommit
#define sqlite3_get_auxdata sqlite3_api->get_auxdata
#define sqlite3_get_table sqlite3_api->get_table
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_global_recover sqlite3_api->global_recover
#endif
#define sqlite3_interrupt sqlite3_api->interruptx
#define sqlite3_last_insert_rowid sqlite3_api->last_insert_rowid
#define sqlite3_libversion sqlite3_api->libversion
#define sqlite3_libversion_number sqlite3_api->libversion_number
#define sqlite3_malloc sqlite3_api->malloc
#define sqlite3_mprintf sqlite3_api->mprintf
#define sqlite3_open sqlite3_api->open
#define sqlite3_open16 sqlite3_api->open16
#define sqlite3_prepare sqlite3_api->prepare
#define sqlite3_prepare16 sqlite3_api->prepare16
#define sqlite3_prepare_v2 sqlite3_api->prepare_v2
#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2
#define sqlite3_profile sqlite3_api->profile
#define sqlite3_progress_handler sqlite3_api->progress_handler
#define sqlite3_realloc sqlite3_api->realloc
#define sqlite3_reset sqlite3_api->reset
#define sqlite3_result_blob sqlite3_api->result_blob
#define sqlite3_result_double sqlite3_api->result_double
#define sqlite3_result_error sqlite3_api->result_error
#define sqlite3_result_error16 sqlite3_api->result_error16
#define sqlite3_result_int sqlite3_api->result_int
#define sqlite3_result_int64 sqlite3_api->result_int64
#define sqlite3_result_null sqlite3_api->result_null
#define sqlite3_result_text sqlite3_api->result_text
#define sqlite3_result_text16 sqlite3_api->result_text16
#define sqlite3_result_text16be sqlite3_api->result_text16be
#define sqlite3_result_text16le sqlite3_api->result_text16le
#define sqlite3_result_value sqlite3_api->result_value
#define sqlite3_rollback_hook sqlite3_api->rollback_hook
#define sqlite3_set_authorizer sqlite3_api->set_authorizer
#define sqlite3_set_auxdata sqlite3_api->set_auxdata
#define sqlite3_snprintf sqlite3_api->xsnprintf
#define sqlite3_step sqlite3_api->step
#define sqlite3_table_column_metadata sqlite3_api->table_column_metadata
#define sqlite3_thread_cleanup sqlite3_api->thread_cleanup
#define sqlite3_total_changes sqlite3_api->total_changes
#define sqlite3_trace sqlite3_api->trace
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_transfer_bindings sqlite3_api->transfer_bindings
#endif
#define sqlite3_update_hook sqlite3_api->update_hook
#define sqlite3_user_data sqlite3_api->user_data
#define sqlite3_value_blob sqlite3_api->value_blob
#define sqlite3_value_bytes sqlite3_api->value_bytes
#define sqlite3_value_bytes16 sqlite3_api->value_bytes16
#define sqlite3_value_double sqlite3_api->value_double
#define sqlite3_value_int sqlite3_api->value_int
#define sqlite3_value_int64 sqlite3_api->value_int64
#define sqlite3_value_numeric_type sqlite3_api->value_numeric_type
#define sqlite3_value_text sqlite3_api->value_text
#define sqlite3_value_text16 sqlite3_api->value_text16
#define sqlite3_value_text16be sqlite3_api->value_text16be
#define sqlite3_value_text16le sqlite3_api->value_text16le
#define sqlite3_value_type sqlite3_api->value_type
#define sqlite3_vmprintf sqlite3_api->vmprintf
#define sqlite3_vsnprintf sqlite3_api->xvsnprintf
#define sqlite3_overload_function sqlite3_api->overload_function
#define sqlite3_prepare_v2 sqlite3_api->prepare_v2
#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2
#define sqlite3_clear_bindings sqlite3_api->clear_bindings
#define sqlite3_bind_zeroblob sqlite3_api->bind_zeroblob
#define sqlite3_blob_bytes sqlite3_api->blob_bytes
#define sqlite3_blob_close sqlite3_api->blob_close
#define sqlite3_blob_open sqlite3_api->blob_open
#define sqlite3_blob_read sqlite3_api->blob_read
#define sqlite3_blob_write sqlite3_api->blob_write
#define sqlite3_create_collation_v2 sqlite3_api->create_collation_v2
#define sqlite3_file_control sqlite3_api->file_control
#define sqlite3_memory_highwater sqlite3_api->memory_highwater
#define sqlite3_memory_used sqlite3_api->memory_used
#define sqlite3_mutex_alloc sqlite3_api->mutex_alloc
#define sqlite3_mutex_enter sqlite3_api->mutex_enter
#define sqlite3_mutex_free sqlite3_api->mutex_free
#define sqlite3_mutex_leave sqlite3_api->mutex_leave
#define sqlite3_mutex_try sqlite3_api->mutex_try
#define sqlite3_open_v2 sqlite3_api->open_v2
#define sqlite3_release_memory sqlite3_api->release_memory
#define sqlite3_result_error_nomem sqlite3_api->result_error_nomem
#define sqlite3_result_error_toobig sqlite3_api->result_error_toobig
#define sqlite3_sleep sqlite3_api->sleep
#define sqlite3_soft_heap_limit sqlite3_api->soft_heap_limit
#define sqlite3_vfs_find sqlite3_api->vfs_find
#define sqlite3_vfs_register sqlite3_api->vfs_register
#define sqlite3_vfs_unregister sqlite3_api->vfs_unregister
#define sqlite3_threadsafe sqlite3_api->xthreadsafe
#define sqlite3_result_zeroblob sqlite3_api->result_zeroblob
#define sqlite3_result_error_code sqlite3_api->result_error_code
#define sqlite3_test_control sqlite3_api->test_control
#define sqlite3_randomness sqlite3_api->randomness
#define sqlite3_context_db_handle sqlite3_api->context_db_handle
#define sqlite3_extended_result_codes sqlite3_api->extended_result_codes
#define sqlite3_limit sqlite3_api->limit
#define sqlite3_next_stmt sqlite3_api->next_stmt
#define sqlite3_sql sqlite3_api->sql
#define sqlite3_status sqlite3_api->status
#define sqlite3_backup_finish sqlite3_api->backup_finish
#define sqlite3_backup_init sqlite3_api->backup_init
#define sqlite3_backup_pagecount sqlite3_api->backup_pagecount
#define sqlite3_backup_remaining sqlite3_api->backup_remaining
#define sqlite3_backup_step sqlite3_api->backup_step
#define sqlite3_compileoption_get sqlite3_api->compileoption_get
#define sqlite3_compileoption_used sqlite3_api->compileoption_used
#define sqlite3_create_function_v2 sqlite3_api->create_function_v2
#define sqlite3_db_config sqlite3_api->db_config
#define sqlite3_db_mutex sqlite3_api->db_mutex
#define sqlite3_db_status sqlite3_api->db_status
#define sqlite3_extended_errcode sqlite3_api->extended_errcode
#define sqlite3_log sqlite3_api->log
#define sqlite3_soft_heap_limit64 sqlite3_api->soft_heap_limit64
#define sqlite3_sourceid sqlite3_api->sourceid
#define sqlite3_stmt_status sqlite3_api->stmt_status
#define sqlite3_strnicmp sqlite3_api->strnicmp
#define sqlite3_unlock_notify sqlite3_api->unlock_notify
#define sqlite3_wal_autocheckpoint sqlite3_api->wal_autocheckpoint
#define sqlite3_wal_checkpoint sqlite3_api->wal_checkpoint
#define sqlite3_wal_hook sqlite3_api->wal_hook
#define sqlite3_blob_reopen sqlite3_api->blob_reopen
#define sqlite3_vtab_config sqlite3_api->vtab_config
#define sqlite3_vtab_on_conflict sqlite3_api->vtab_on_conflict
/* Version 3.7.16 and later */
#define sqlite3_close_v2 sqlite3_api->close_v2
#define sqlite3_db_filename sqlite3_api->db_filename
#define sqlite3_db_readonly sqlite3_api->db_readonly
#define sqlite3_db_release_memory sqlite3_api->db_release_memory
#define sqlite3_errstr sqlite3_api->errstr
#define sqlite3_stmt_busy sqlite3_api->stmt_busy
#define sqlite3_stmt_readonly sqlite3_api->stmt_readonly
#define sqlite3_stricmp sqlite3_api->stricmp
#define sqlite3_uri_boolean sqlite3_api->uri_boolean
#define sqlite3_uri_int64 sqlite3_api->uri_int64
#define sqlite3_uri_parameter sqlite3_api->uri_parameter
#define sqlite3_uri_vsnprintf sqlite3_api->xvsnprintf
#define sqlite3_wal_checkpoint_v2 sqlite3_api->wal_checkpoint_v2
/* Version 3.8.7 and later */
#define sqlite3_auto_extension sqlite3_api->auto_extension
#define sqlite3_bind_blob64 sqlite3_api->bind_blob64
#define sqlite3_bind_text64 sqlite3_api->bind_text64
#define sqlite3_cancel_auto_extension sqlite3_api->cancel_auto_extension
#define sqlite3_load_extension sqlite3_api->load_extension
#define sqlite3_malloc64 sqlite3_api->malloc64
#define sqlite3_msize sqlite3_api->msize
#define sqlite3_realloc64 sqlite3_api->realloc64
#define sqlite3_reset_auto_extension sqlite3_api->reset_auto_extension
#define sqlite3_result_blob64 sqlite3_api->result_blob64
#define sqlite3_result_text64 sqlite3_api->result_text64
#define sqlite3_strglob sqlite3_api->strglob
/* Version 3.8.11 and later */
#define sqlite3_value_dup sqlite3_api->value_dup
#define sqlite3_value_free sqlite3_api->value_free
#define sqlite3_result_zeroblob64 sqlite3_api->result_zeroblob64
#define sqlite3_bind_zeroblob64 sqlite3_api->bind_zeroblob64
/* Version 3.9.0 and later */
#define sqlite3_value_subtype sqlite3_api->value_subtype
#define sqlite3_result_subtype sqlite3_api->result_subtype
/* Version 3.10.0 and later */
#define sqlite3_status64 sqlite3_api->status64
#define sqlite3_strlike sqlite3_api->strlike
#define sqlite3_db_cacheflush sqlite3_api->db_cacheflush
/* Version 3.12.0 and later */
#define sqlite3_system_errno sqlite3_api->system_errno
/* Version 3.14.0 and later */
#define sqlite3_trace_v2 sqlite3_api->trace_v2
#define sqlite3_expanded_sql sqlite3_api->expanded_sql
/* Version 3.18.0 and later */
#define sqlite3_set_last_insert_rowid sqlite3_api->set_last_insert_rowid
/* Version 3.20.0 and later */
#define sqlite3_prepare_v3 sqlite3_api->prepare_v3
#define sqlite3_prepare16_v3 sqlite3_api->prepare16_v3
#define sqlite3_bind_pointer sqlite3_api->bind_pointer
#define sqlite3_result_pointer sqlite3_api->result_pointer
#define sqlite3_value_pointer sqlite3_api->value_pointer
/* Version 3.22.0 and later */
#define sqlite3_vtab_nochange sqlite3_api->vtab_nochange
#define sqlite3_value_nochange sqlite3_api->value_nochange
#define sqlite3_vtab_collation sqlite3_api->vtab_collation
/* Version 3.24.0 and later */
#define sqlite3_keyword_count sqlite3_api->keyword_count
#define sqlite3_keyword_name sqlite3_api->keyword_name
#define sqlite3_keyword_check sqlite3_api->keyword_check
#define sqlite3_str_new sqlite3_api->str_new
#define sqlite3_str_finish sqlite3_api->str_finish
#define sqlite3_str_appendf sqlite3_api->str_appendf
#define sqlite3_str_vappendf sqlite3_api->str_vappendf
#define sqlite3_str_append sqlite3_api->str_append
#define sqlite3_str_appendall sqlite3_api->str_appendall
#define sqlite3_str_appendchar sqlite3_api->str_appendchar
#define sqlite3_str_reset sqlite3_api->str_reset
#define sqlite3_str_errcode sqlite3_api->str_errcode
#define sqlite3_str_length sqlite3_api->str_length
#define sqlite3_str_value sqlite3_api->str_value
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
/* This case when the file really is being compiled as a loadable
** extension */
# define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api=0;
# define SQLITE_EXTENSION_INIT2(v) sqlite3_api=v;
# define SQLITE_EXTENSION_INIT3 \
extern const sqlite3_api_routines *sqlite3_api;
#else
/* This case when the file is being statically linked into the
** application */
# define SQLITE_EXTENSION_INIT1 /*no-op*/
# define SQLITE_EXTENSION_INIT2(v) (void)v; /* unused parameter */
# define SQLITE_EXTENSION_INIT3 /*no-op*/
#endif
#endif /* SQLITE3EXT_H */