git-svn-id: svn://192.168.0.12/source@198 8346c931-da38-4b9b-9d4c-e48b93cbd075
This commit is contained in:
@@ -490,8 +490,9 @@ void Widget::InsertCopyRow(int _nRow,QTableWidget *_pCurrent,QTableWidget *_pNew
|
|||||||
|
|
||||||
void Widget::SearchDate()
|
void Widget::SearchDate()
|
||||||
{
|
{
|
||||||
STable *pNew = new STable;
|
|
||||||
STable *pCurrent = (STable *)m_ptwData->currentWidget();
|
STable *pCurrent = (STable *)m_ptwData->currentWidget();
|
||||||
|
STable *pNew = new STable;
|
||||||
|
if (pCurrent == NULL) return;
|
||||||
pNew->setArticleSelect(pCurrent->getArticleSelect());
|
pNew->setArticleSelect(pCurrent->getArticleSelect());
|
||||||
pNew->SetHeaderList(&m_vecColumn,E_COLUMN_NAME);
|
pNew->SetHeaderList(&m_vecColumn,E_COLUMN_NAME);
|
||||||
m_pProgress->setRange(0,pCurrent->rowCount()-1);
|
m_pProgress->setRange(0,pCurrent->rowCount()-1);
|
||||||
@@ -1315,8 +1316,6 @@ void Widget::DataBaseCounterFilter(int _nArticle,int _nCategory,int _nComp,int _
|
|||||||
DataBaseFilter(E_FILTER_TYPE_COUNTER,json.Sql(strJson),_nGroup,_nCommand,_strFilterId);
|
DataBaseFilter(E_FILTER_TYPE_COUNTER,json.Sql(strJson),_nGroup,_nCommand,_strFilterId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Widget::DataBaseReplaceFilter(int _nArticle,int _nCategory,int _nFind,QString _strFind,QString _strReplace,int _nGroup,int _nCommand,QString _strFilterId)
|
void Widget::DataBaseReplaceFilter(int _nArticle,int _nCategory,int _nFind,QString _strFind,QString _strReplace,int _nGroup,int _nCommand,QString _strFilterId)
|
||||||
{
|
{
|
||||||
QString strJson;
|
QString strJson;
|
||||||
@@ -1563,7 +1562,7 @@ bool Widget::ReloadColumn()
|
|||||||
m_nColumn = -1;
|
m_nColumn = -1;
|
||||||
foreach(QStringList strList,m_vecColumn)
|
foreach(QStringList strList,m_vecColumn)
|
||||||
{
|
{
|
||||||
if (strList.at(E_COLUMN_DATE).trimmed() == QString("o") )
|
if (strList.at(E_COLUMN_DATE).trimmed() == QString("o"))
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
m_nColumn++;
|
m_nColumn++;
|
||||||
@@ -1680,30 +1679,55 @@ void Widget::CountSave()
|
|||||||
m_pProgress->setRange(0,pCurrent->rowCount()-1);
|
m_pProgress->setRange(0,pCurrent->rowCount()-1);
|
||||||
|
|
||||||
QVector <SCount> vecData;
|
QVector <SCount> vecData;
|
||||||
for (int nCount = 0 ; nCount < pCurrent->rowCount(); nCount++ )
|
if (nCatalog == m_nColumn)
|
||||||
{
|
{
|
||||||
QString str;
|
QDate dateStart(2020,1,1),dateEnd(2000,1,1);
|
||||||
if (nCatalog == m_nColumn)
|
QMap <QDate,int> mapDate;
|
||||||
|
for (int nCount = 0 ; nCount < pCurrent->rowCount(); nCount++ )
|
||||||
{
|
{
|
||||||
QDateTime date;
|
if (pCurrent->item(nCount,nCatalog)->text().trimmed().isEmpty()) continue;
|
||||||
str = date.fromString(pCurrent->item(nCount,nCatalog)->text().trimmed(),"yyyy-MM-dd hh:mm:ss").date().toString("yyyy-MM-dd");
|
QDate date = QDateTime::fromString(pCurrent->item(nCount,nCatalog)->text().trimmed(),"yyyy-MM-dd hh:mm:ss").date();
|
||||||
|
dateStart = (date < dateStart ) ? date : dateStart;
|
||||||
|
dateEnd = (date > dateEnd ) ? date : dateEnd;
|
||||||
|
if (mapDate.contains(date) == false)
|
||||||
|
mapDate.insert(date,0);
|
||||||
|
mapDate[date]++;
|
||||||
|
m_pProgress->setValue(nCount);
|
||||||
|
m_pProgress->repaint();
|
||||||
}
|
}
|
||||||
else
|
for(QDate date = dateStart; date < dateEnd; date=date.addDays(1))
|
||||||
|
{
|
||||||
|
SCount stCount;
|
||||||
|
stCount.m_str = date.toString("yyyy-MM-dd");
|
||||||
|
if (mapDate.contains(date))
|
||||||
|
stCount.m_nCount = mapDate[date];
|
||||||
|
else
|
||||||
|
stCount.m_nCount = 0;
|
||||||
|
vecData.push_back(stCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int nCount = 0 ; nCount < pCurrent->rowCount(); nCount++ )
|
||||||
|
{
|
||||||
|
QString str;
|
||||||
str = pCurrent->item(nCount,nCatalog)->text().trimmed();
|
str = pCurrent->item(nCount,nCatalog)->text().trimmed();
|
||||||
bool bInsert = true;
|
if (str.isEmpty()) continue;
|
||||||
for (int i = 0; i < vecData.size(); i++)
|
bool bInsert = true;
|
||||||
{
|
for (int i = 0; i < vecData.size(); i++)
|
||||||
if(vecData[i].m_str.compare(str) == 0)
|
|
||||||
{
|
{
|
||||||
vecData[i].m_nCount++;
|
if(vecData[i].m_str.compare(str) == 0)
|
||||||
bInsert = false;
|
{
|
||||||
break;
|
vecData[i].m_nCount++;
|
||||||
|
bInsert = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (bInsert)
|
||||||
|
vecData.push_back(SCount(str));
|
||||||
|
m_pProgress->setValue(nCount);
|
||||||
|
m_pProgress->repaint();
|
||||||
}
|
}
|
||||||
if (bInsert)
|
|
||||||
vecData.push_back(SCount(str));
|
|
||||||
m_pProgress->setValue(nCount);
|
|
||||||
m_pProgress->repaint();
|
|
||||||
}
|
}
|
||||||
QFile file(strFilename);
|
QFile file(strFilename);
|
||||||
if(!file.open(QFile::WriteOnly | QFile::Text)) return;
|
if(!file.open(QFile::WriteOnly | QFile::Text)) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user