📄 griddemocontainer.cpp
字号:
iSheetShowType = EShowSheetSmokePlan;
}
HBufC* uh = iEikonEnv->AllocReadResourceLC(R_SMOKEPLAN_HEADER);
if(uh)
{
TInt c = iSheetContainer->GetShowRowCount();
iSheetContainer->SetStartLineNumber(iStartNumber);
iSheetContainer->SetHeader(*uh);
CDesCArray* dc = iSheetContainer->DataArray();
dc->Reset();
TBuf<1024> buf;
HBufC8* data = HBufC8::NewL(TSmokePlan::Size());
TPtr8 ptr = data->Des();
TInt seek = iStartNumber*TSmokePlan::Size();
iFile.Seek(ESeekStart, seek);
for(TInt i=0; i<c; i++)
{
if(i+iStartNumber >= iRecordRowCount)
break;
iFile.Read(ptr, TSmokePlan::Size());
PlanData2String(buf, ptr);
dc->AppendL(buf);
ptr.Zero();
}
delete data;
CleanupStack::PopAndDestroy(uh);
}
iSheetContainer->UpdateDisplayData();
iListBox->MakeVisible(EFalse);
iSheetContainer->MakeVisible(ETrue);
ShowStatus(iIsShowStatus);
return ETrue;
}
TBool CGridDemoContainer::ShowSmokeRealInfoSheet()
{
if(iSheetShowType != EShowSheetSmokeRealInfo)
{
if(!LoadRealInfoIndex())
{
iMyAppUi->ShowInformationNoteL(R_INDEX_ERROR);
return EFalse;
}
if(iFileIsOpen)
{
iFile.Close();
iFileIsOpen = EFalse;
}
TBuf<256> filename;
filename = KSmokeRealInfoFile;
iMyAppUi->CompleteWithDataPath(filename);
if(!BaflUtils::FileExists(iMyAppUi->FsSession(), filename))
{
iMyAppUi->ShowInformationNoteL(R_FILE_NO_FOUND);
return EFalse;
}
TInt aStart = 0;
TInt aEnd = 0;
if( !FindRealInfoDataFromIndex(aStart, aEnd) )
{
iMyAppUi->ShowInformationNoteL(R_FIND_ERROR);
return EFalse;
}
User::LeaveIfError(iFile.Open(iMyAppUi->FsSession(), filename, EFileRead));
iRecordRowOffset = aStart;
iStartNumber = 0;
iRecordRowCount = aEnd - aStart;
iFileIsOpen = ETrue;
iSheetShowType = EShowSheetSmokeRealInfo;
}
HBufC* uh = iEikonEnv->AllocReadResourceLC(R_SMOKEREALINFO_HEADER);
if(uh)
{
TInt c = iSheetContainer->GetShowRowCount();
iSheetContainer->SetStartLineNumber(iStartNumber);
iSheetContainer->SetHeader(*uh);
CDesCArray* dc = iSheetContainer->DataArray();
dc->Reset();
TBuf<1024> buf;
HBufC8* data = HBufC8::NewL(TSmokeRealInfo::Size());
TPtr8 ptr = data->Des();
TInt seek = (iStartNumber+iRecordRowOffset)*TSmokeRealInfo::Size();
iFile.Seek(ESeekStart, seek);
for(TInt i=0; i<c; i++)
{
iFile.Read(ptr, TSmokeRealInfo::Size());
RealInfoData2String(buf, ptr);
dc->AppendL(buf);
ptr.Zero();
}
delete data;
CleanupStack::PopAndDestroy(uh);
}
iSheetContainer->UpdateDisplayData();
iListBox->MakeVisible(EFalse);
iSheetContainer->MakeVisible(ETrue);
ShowStatus(iIsShowStatus);
return ETrue;
}
void CGridDemoContainer::PlanData2String(TDes& aString, const TDesC8& aData)
{
if(aData.Length() < TSmokePlan::Size())
return;
TSmokePlan* info = new (ELeave) TSmokePlan;
TInt x = 0;
x+= info->iId.MaxLength();
iMyAppUi->Gb23122Unicode(info->iDay, aData.Mid(x, info->iDay.MaxLength()));
x+= info->iDay.MaxLength();
info->iDay.Trim();
aString.Copy(info->iDay);
aString.Append('\t');
iMyAppUi->Gb23122Unicode(info->iNo, aData.Mid(x, info->iNo.MaxLength()));
x+= info->iDay.MaxLength();
info->iNo.Trim();
aString.Append(info->iNo);
aString.Append('\t');
TSmokeType* user = iMyAppUi->FindSmokeType(info->iNo);
if(user)
aString.Append(user->iName);
aString.Append('\t');
iMyAppUi->Gb23122Unicode(info->iContent, aData.Mid(x, info->iContent.MaxLength()));
info->iContent.Trim();
aString.Append(info->iContent);
aString.Append('\t');
delete info;
}
TBool CGridDemoContainer::YearData2String(TDes& aString, const TDesC8& aData)
{
if(aData.Length() < TSmokeYear::Size())
return EFalse;
aString.Zero();
TInt x = 0;
TSmokeYear* info = new (ELeave) TSmokeYear;
iMyAppUi->Gb23122Unicode(info->iYear, aData.Mid(x, info->iYear.MaxLength()));
info->iYear.Trim();
x += info->iYear.MaxLength();
// aString.Copy(info->iYear);
// aString.Append('\t');
iMyAppUi->Gb23122Unicode(info->iNo, aData.Mid(x, info->iNo.MaxLength()));
info->iNo.Trim();
x += info->iNo.MaxLength();
// aString.Append(info->iNo);
// aString.Append('\t');
iMyAppUi->Gb23122Unicode(info->iCode, aData.Mid(x, info->iCode.MaxLength()));
info->iCode.Trim();
x += info->iCode.MaxLength();
aString.Append(info->iCode);
aString.Append('\t');
TSmokeType* user = iMyAppUi->FindSmokeType(info->iCode);
if(user)
aString.Append(user->iName);
aString.Append('\t');
iMyAppUi->Gb23122Unicode(info->iRequire, aData.Mid(x, info->iRequire.MaxLength()));
info->iRequire.Trim();
x += info->iRequire.MaxLength();
aString.Append(info->iRequire);
aString.Append('\t');
iMyAppUi->Gb23122Unicode(info->iMonth, aData.Mid(x, info->iMonth.MaxLength()));
aString.Append(info->iMonth.Mid(0,4));
aString.Append('\t');
aString.Append(info->iMonth.Mid(4,4));
aString.Append('\t');
aString.Append(info->iMonth.Mid(8,4));
aString.Append('\t');
aString.Append(info->iMonth.Mid(12,4));
aString.Append('\t');
aString.Append(info->iMonth.Mid(16,4));
aString.Append('\t');
aString.Append(info->iMonth.Mid(20,4));
aString.Append('\t');
iMyAppUi->Gb23122Unicode(info->iTotal, aData.Right(info->iTotal.MaxLength()));
info->iTotal.Trim();
aString.Append(info->iTotal);
delete info;
return ETrue;
}
TBool CGridDemoContainer::MonthData2String(TDes& aString, const TDesC8& aData)
{
if(aData.Length() < TSmokeMonth::Size())
return EFalse;
aString.Zero();
TInt x = 0;
TSmokeMonth* info = new (ELeave) TSmokeMonth;
info->iNo.Copy( aData.Mid(x, info->iNo.MaxLength()) );
info->iNo.Trim();
x += info->iNo.MaxLength();
// aString.Copy(info->iNo);
// aString.Append('\t');
info->iCode.Copy( aData.Mid(x, info->iCode.MaxLength()) );
info->iCode.Trim();
x += info->iCode.MaxLength();
aString.Append(info->iCode);
aString.Append('\t');
TSmokeType* user = iMyAppUi->FindSmokeType(info->iCode);
if(user)
aString.Append(user->iName);
aString.Append('\t');
info->iRequire.Copy( aData.Mid(x, info->iRequire.MaxLength()) );
info->iRequire.Trim();
x += info->iRequire.MaxLength();
aString.Append(info->iRequire);
aString.Append('\t');
info->iMeasure.Copy( aData.Mid(x, info->iMeasure.MaxLength()) );
info->iMeasure.Trim();
x += info->iMeasure.MaxLength();
aString.Append(info->iMeasure);
aString.Append('\t');
info->iDay.Copy( aData.Mid(x, info->iDay.MaxLength()) );
x += info->iDay.MaxLength();
aString.Append(info->iDay.Mid(0,4));
aString.Append('\t');
aString.Append(info->iDay.Mid(4,4));
aString.Append('\t');
aString.Append(info->iDay.Mid(8,4));
aString.Append('\t');
aString.Append(info->iDay.Mid(12,4));
aString.Append('\t');
aString.Append(info->iDay.Mid(16,4));
aString.Append('\t');
aString.Append(info->iDay.Mid(20,4));
aString.Append('\t');
aString.Append(info->iDay.Mid(24,4));
aString.Append('\t');
aString.Append(info->iDay.Mid(28,4));
aString.Append('\t');
aString.Append(info->iDay.Mid(32,4));
aString.Append('\t');
info->iTotal.Copy( aData.Mid(x, info->iTotal.MaxLength()) );
info->iTotal.Trim();
x += info->iTotal.MaxLength();
aString.Append(info->iTotal);
aString.Append('\t');
info->iDeposit.Copy( aData.Mid(x, info->iDeposit.MaxLength()) );
info->iDeposit.Trim();
x += info->iDeposit.MaxLength();
aString.Append(info->iDeposit);
delete info;
return ETrue;
}
//订单数据转成带格式的串显示表格里
void CGridDemoContainer::FlowData2String(TDes& aString, TSmokeFlow* aFlow)
{
aString.Copy(aFlow->iNo);
aString.Append('\t');
TSmokeUser* user1 = iMyAppUi->FindSmokeUser(aFlow->iNo);
if(user1)
aString.Append(user1->iUserName);
aString.Append('\t');
aString.Append(aFlow->iType);
aString.Append('\t');
aString.Append(aFlow->iCode);
aString.Append('\t');
TSmokeType* user = iMyAppUi->FindSmokeType(aFlow->iCode);
if(user)
aString.Append(user->iName);
aString.Append('\t');
aString.Append(aFlow->iCount1);
aString.Append('\t');
aString.Append(aFlow->iCount3);
aString.Append('\t');
aString.Append(aFlow->iCount2);
aString.Append('\t');
aString.Append(aFlow->iCount4);
aString.Append('\t');
aString.Append(aFlow->iCount5);
aString.Append('\t');
aString.Append(aFlow->iCount6);
aString.Append('\t');
aString.Append(aFlow->iCount7);
aString.Append('\t');
aString.Append(aFlow->iCount8);
aString.Append('\t');
aString.Append(aFlow->iCount9);
aString.Append('\t');
aString.Append(aFlow->iCount10);
aString.Append('\t');
aString.Append(aFlow->iCount11);
}
TBool CGridDemoContainer::ShowSmokeCampaignSheet()
{
if(iSheetShowType != EShowSheetSmokeCampaign)
{
if(iFileIsOpen)
{
iFile.Close();
iFileIsOpen = EFalse;
}
TBuf<256> filename;
filename = KSmokeCampaignFile;
iMyAppUi->CompleteWithDataPath(filename);
if(!BaflUtils::FileExists(iMyAppUi->FsSession(), filename))
{
iMyAppUi->ShowInformationNoteL(R_FILE_NO_FOUND);
return EFalse;
}
User::LeaveIfError(iFile.Open(iMyAppUi->FsSession(), filename, EFileRead));
iFile.Size(iFileSize);
iRecordRowCount = iFileSize / TSmokeCampaign::Size();
if(iRecordRowCount == 0)
{
iMyAppUi->ShowInformationNoteL(R_FILE_SIZE_ERROR);
iFile.Close();
return EFalse;
}
iFileIsOpen = ETrue;
iSheetShowType = EShowSheetSmokeCampaign;
}
HBufC* uh = iEikonEnv->AllocReadResourceLC(R_SMOKECAMPAIGN_HEADER);
if(uh)
{
TInt c = iSheetContainer->GetShowRowCount();
iSheetContainer->SetStartLineNumber(iStartNumber);
iSheetContainer->SetHeader(*uh);
CDesCArray* dc = iSheetContainer->DataArray();
dc->Reset();
TBuf<1024> buf;
HBufC8* data = HBufC8::NewL(TSmokeCampaign::Size());
TPtr8 ptr = data->Des();
TInt seek = iStartNumber*TSmokeCampaign::Size();
iFile.Seek(ESeekStart, seek);
for(TInt i=0; i<c; i++)
{
if(i+iStartNumber >= iRecordRowCount)
break;
iFile.Read(ptr, TSmokeCampaign::Size());
CampaignData2String(buf, ptr);
dc->AppendL(buf);
ptr.Zero();
}
delete data;
CleanupStack::PopAndDestroy(uh);
}
iSheetContainer->UpdateDisplayData();
iListBox->MakeVisible(EFalse);
iSheetContainer->MakeVisible(ETrue);
ShowStatus(iIsShowStatus);
return ETrue;
}
void CGridDemoContainer::CampaignData2String(TDes& aString, const TDesC8& aData)
{
if(aData.Length() < TSmokeCampaign::Size())
return;
TInt pos = 0;
TSmokeCampaign* info = new (ELeave) TSmokeCampaign;
iMyAppUi->Gb23122Unicode(info->iCode, aData.Mid(pos, info->iCode.MaxLength()));
info->iCode.Trim();
pos += info->iCode.MaxLength();
iMyAppUi->Gb23122Unicode(info->iName, aData.Mid(pos, info->iName.MaxLength()));
info->iName.Trim();
pos += info->iName.MaxLength();
iMyAppUi->Gb23122Unicode(info->iStartData, aData.Mid(pos, info->iStartData.MaxLength()));
info->iStartData.Trim();
pos += info->iStartData.MaxLength();
iMyAppUi->Gb23122Unicode(info->iEndData, aData.Mid(pos, info->iEndData.MaxLength()));
info->iEndData.Trim();
pos += info->iEndData.MaxLength();
iMyAppUi->Gb23122Unicode(info->iNote, aData.Mid(pos, info->iNote.MaxLength()));
info->iNote.Trim();
pos += info->iNote.MaxLength();
aString.Copy(info->iCode);
aString.Append('\t');
aString.Append(info->iName);
aString.Append('\t');
aString.Append(info->iStartData);
aString.Append('\t');
aString.Append(info->iEndData);
aString.Append('\t');
aString.Append(info->iNote);
delete info;
}
void CGridDemoContainer::RealInfoData2String(TDes& aString, const TDesC8& aData)
{
if(aData.Length() < TSmokeRealInfo::Size())
return;
TInt pos = 0;
TSmokeRealInfo* info = new (ELeave) TSmokeRealInfo;
iMyAppUi->Gb23122Unicode(info->iNo, aData.Mid(pos, info->iNo.MaxLength()));
info->iNo.Trim();
pos += info->iNo.MaxLength();
iMyAppUi->Gb23122Unicode(info->iClientName, aData.Mid(pos, info->iClientName.MaxLength()));
info->iClientName.Trim();
pos += info->iClientName.MaxLength();
iMyAppUi->Gb23122Unicode(info->iClientAddr, aData.Mid(pos, info->iClientAddr.MaxLength()));
info->iClientAddr.Trim();
pos += info->iClientAddr.MaxLength();
iMyAppUi->Gb23122Unicode(info->iSmokeType, aData.Mid(pos, info->iSmokeType.MaxLength()));
info->iSmokeType.Trim();
pos += info->iSmokeType.MaxLength();
iMyAppUi->Gb23122Unicode(info->iSmokeCode, aData.Mid(pos, info->iSmokeCode.MaxLength()));
info->iSmokeCode.Trim();
pos += info->iSmokeCode.MaxLength();
iMyAppUi->Gb23122Unicode(info->iSmokeName, aData.Mid(pos, info->iSmokeName.MaxLength()));
info->iSmokeName.Trim();
pos += info->iSmokeName.MaxLength();
info->iPrice1.Copy(aData.Mid(pos, info->iPrice1.MaxLength()));
info->iPrice1.Trim();
pos += info->iPrice1.MaxLength();
info->iTotal1.Copy(aData.Mid(pos, info->iTotal1.MaxLength()));
info->iTotal1.Trim();
pos += info->iTotal1.MaxLength();
info->iTotal2.Copy(aData.Mid(pos, info->iTotal2.MaxLength()));
info->iTotal2.Trim();
pos += info->iTotal2.MaxLength();
info->iTotal3.Copy(aData.Mid(pos, info->iTotal3.MaxLength()));
info->iTotal3.Trim();
pos += info->iTotal3.MaxLength();
info->iTotal4.Copy(aData.Mid(pos, info->iTotal4.MaxLength()));
info->iTotal4.Trim();
pos += info->iTotal4.MaxLength();
info->iPrice2.Copy(aData.Mid(pos, info->iPrice2.MaxLength()));
info->iPrice2.Trim();
pos += info->iPrice2.MaxLength();
info->iStopFlag.Copy(aData.Mid(pos, info->iStopFlag.MaxLength()));
info->iStopFlag.Trim();
pos += info->iStopFlag.MaxLength();
aString.Copy(info->iNo);
aString.Append('\t');
aString.Append(info->iClientName);
aString.Append('\t');
aString.Append(info->iClientAddr);
aString.Append('\t');
aString.Append(info->iSmokeType);
aString.Append('\t');
aString.Append(info->iSmokeCode);
aString.Append('\t');
aString.Append(info->iSmokeName);
aString.Append('\t');
aString.Append(info->iPrice1);
aString.Append('\t');
aString.Append(info->iTotal1);
aString.Append('\t');
aString.Append(info->iTotal2);
aString.Append('\t');
aString.Append(info->iTotal3);
aString.Append('\t');
aString.Append(info->iTotal4);
aString.Append('\t');
aString.Append(info->iPrice2);
aString.Append('\t');
aString.Append(info->iStopFlag);
delete info;
}
TBool CGridDemoContainer::ShowSmokeMonthSheet(const TDesC& aFilename)
{
if(iSheetShowType != EShowSheetSmokeMonthAccount)
{
if(!LoadMonthIndex(aFilename))
{
iMyAppUi->ShowInformationNoteL(R_INDEX_ERROR);
return EFalse;
}
if(iFileIsOpen)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -