Mercurial > mercurial > hgweb_searcher03.cgi
annotate src/bprint.cpp @ 16:1ba97995f642
Get/Put DB files to shared-directory.
author | pyon@macmini |
---|---|
date | Thu, 19 Jun 2014 18:46:11 +0900 |
parents | bbd65edf71d4 |
children | a2ad87cad48b |
rev | line source |
---|---|
2 | 1 // Filename : bprint.cpp |
13 | 2 // Last Change: 21-May-2014. |
2 | 3 // |
4 | |
5 #include "bprint.h" | |
6 #include "marksheet.h" | |
3 | 7 #include "dndfile.h" |
2 | 8 #include "db.h" |
9 | |
10 FrameBatchPrint::FrameBatchPrint( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) | |
11 : wxDialog( parent, id, title, pos, size, style ) | |
12 { | |
13 this->SetSizeHints( wxDefaultSize, wxDefaultSize ); | |
14 this->SetBackgroundColour( wxColour( wxT("WHEAT") ) ); | |
15 | |
16 wxBoxSizer* bSizerTop = new wxBoxSizer( wxHORIZONTAL ); | |
17 | |
18 m_grid = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); | |
19 | |
20 // Grid | |
21 m_grid->CreateGrid( 25, 4 ); | |
22 m_grid->EnableEditing( true ); | |
23 m_grid->EnableGridLines( true ); | |
24 m_grid->EnableDragGridSize( false ); | |
25 m_grid->SetMargins( 0, 0 ); | |
26 | |
27 // Columns | |
28 m_grid->EnableDragColMove( false ); | |
29 m_grid->EnableDragColSize( true ); | |
30 m_grid->SetColLabelSize( 30 ); | |
31 m_grid->SetColLabelValue( 0, wxT("被保険者番号") ); | |
32 m_grid->SetColLabelValue( 1, wxT("氏名") ); | |
33 m_grid->SetColLabelValue( 2, wxT("最新フォルダ") ); | |
34 m_grid->SetColLabelValue( 3, wxT("ステータス") ); | |
35 m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); | |
36 m_grid->SetColSize( 0, 100 ); | |
37 m_grid->SetColSize( 1, 100 ); | |
38 m_grid->SetColSize( 2, 220 ); | |
8 | 39 m_grid->SetColSize( 3, 90 ); |
3 | 40 m_grid->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_ALWAYS ); |
2 | 41 |
42 // Rows | |
43 m_grid->EnableDragRowSize( true ); | |
44 m_grid->SetRowLabelSize( 30 ); | |
45 m_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); | |
46 | |
47 // Cell Defaults | |
48 m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); | |
49 bSizerTop->Add( m_grid, 1, wxALL|wxEXPAND, 5 ); | |
50 | |
51 wxBoxSizer* bSizerButton = new wxBoxSizer( wxVERTICAL ); | |
52 | |
53 bSizerButton->Add( 0, 20, 0, 0, 5 ); | |
54 | |
55 m_buttonClear = new wxButton( this, ID_BPCLEAR, wxT("クリア"), wxDefaultPosition, wxDefaultSize, 0 ); | |
56 bSizerButton->Add( m_buttonClear, 0, wxALL, 5 ); | |
57 | |
12
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
58 m_buttonMaskPrint = new wxButton( this, ID_BPFFMP, wxT("FFMP"), wxDefaultPosition, wxDefaultSize, 0 ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
59 bSizerButton->Add( m_buttonMaskPrint, 0, wxALL, 5 ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
60 |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
61 m_buttonPrint = new wxButton( this, ID_BPPRINT, wxT("一括印刷"), wxDefaultPosition, wxDefaultSize, 0 ); |
2 | 62 bSizerButton->Add( m_buttonPrint, 0, wxALL, 5 ); |
12
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
63 |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
64 m_buttonLdLog = new wxButton( this, ID_BPLDLOG, wxT("一括印刷ログ"), wxDefaultPosition, wxDefaultSize, 0 ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
65 bSizerButton->Add( m_buttonLdLog, 0, wxALL, 5 ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
66 |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
67 bSizerButton->Add( 0, 20, 0, 0, 5 ); |
2 | 68 |
69 bSizerButton->Add( 0, 20, 0, 0, 5 ); | |
70 | |
71 m_buttonClose = new wxButton( this, wxID_CANCEL, wxT("閉じる"), wxDefaultPosition, wxDefaultSize, 0 ); | |
72 m_buttonClose->SetDefault(); | |
73 bSizerButton->Add( m_buttonClose, 0, wxALL, 5 ); | |
74 | |
75 bSizerTop->Add( bSizerButton, 0, wxEXPAND, 5 ); | |
76 | |
77 this->SetSizer( bSizerTop ); | |
78 this->Layout(); | |
79 | |
80 this->Centre( wxBOTH ); | |
81 | |
3 | 82 this->SetDropTarget( new DnDFile( m_grid ) ); |
2 | 83 SetGridReadOnly(); |
84 } | |
85 | |
86 FrameBatchPrint::~FrameBatchPrint() | |
87 { | |
88 } | |
89 | |
90 // Event Table | |
91 BEGIN_EVENT_TABLE( FrameBatchPrint, wxDialog ) | |
92 EVT_GRID_CELL_CHANGING( FrameBatchPrint::OnInput ) | |
93 EVT_BUTTON( ID_BPCLEAR, FrameBatchPrint::OnClear ) | |
12
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
94 EVT_BUTTON( ID_BPFFMP, FrameBatchPrint::OnMaskPrint ) |
2 | 95 EVT_BUTTON( ID_BPPRINT, FrameBatchPrint::OnPrint ) |
12
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
96 EVT_BUTTON( ID_BPLDLOG, FrameBatchPrint::OnLoadLog ) |
2 | 97 END_EVENT_TABLE() |
98 | |
99 // Event Handlers & Functions | |
100 /* 氏名などを表示 */ | |
101 void FrameBatchPrint::OnInput( wxGridEvent& event ) | |
102 { | |
103 wxString hhsno = event.GetString(); | |
104 int r = event.GetRow(); | |
105 for ( int c = 1; c < m_grid->GetNumberCols(); c++ ) | |
106 m_grid->SetCellValue( r, c, wxEmptyString ); | |
107 | |
108 wxArrayString info = wxSplit( GetHhsInfoByHhsNo( hhsno ), '_', '\\' ); | |
109 wxArrayString path = GetPathByHhsNo( hhsno ); | |
110 | |
111 if ( info.IsEmpty() ) info.Add( wxEmptyString ); | |
112 if ( path.IsEmpty() ) { | |
13 | 113 wxMessageBox( wxT("審査会がありません.") ); |
2 | 114 path.Add( wxEmptyString ); |
115 } | |
116 | |
117 m_grid->SetCellValue( r, 1, info[0] ); | |
118 m_grid->SetCellValue( r, 2, path[0] ); | |
119 } | |
120 | |
121 /* グリッドをクリア */ | |
122 void FrameBatchPrint::OnClear( wxCommandEvent& WXUNUSED(event) ) | |
123 { | |
124 m_grid->ClearGrid(); | |
125 } | |
126 | |
127 /* 一括印刷処理 */ | |
128 void FrameBatchPrint::OnPrint( wxCommandEvent& WXUNUSED(event) ) | |
129 { | |
130 wxPrintDialogData pd; | |
131 wxPrinter p( &pd ); | |
132 p.PrintDialog( NULL ); | |
6 | 133 wxArrayString log; |
2 | 134 |
135 for ( int r = 0; r < m_grid->GetNumberRows(); r++ ) { | |
136 wxString path = m_grid->GetCellValue( r, 2 ); | |
137 | |
138 // 印刷用の html を作成 | |
139 if ( path.IsEmpty() ) continue; | |
140 | |
141 wxDir dir( path ); | |
142 if ( !dir.IsOpened() ) return; | |
143 | |
144 wxString html; | |
12
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
145 html = wxT("<html><body>\n"); |
2 | 146 |
147 wxString file; | |
148 bool cout = dir.GetFirst( &file, wxT("*.jpg"), wxDIR_FILES ); | |
4 | 149 bool notyet_mask = true; |
2 | 150 int n = 0; |
151 wxString tmpdir = wxGetCwd() + wxFILE_SEP_PATH + wxT("tmp") + wxFILE_SEP_PATH; | |
152 while ( cout ) { | |
153 file = path + wxFILE_SEP_PATH + file; | |
154 file.Replace( wxFILE_SEP_PATH, wxT("/") ); | |
155 wxString tmpjpg = wxString::Format( wxT("%stmp%d.jpg"), tmpdir, n ); | |
156 | |
5 | 157 if ( notyet_mask && IsMarksheet( file, m_zmin, m_zmax, m_lmin, m_lmax ) ) { // マークシート表面をマスクする |
2 | 158 wxImage img_org( file, wxBITMAP_TYPE_JPEG ); |
159 int ver = GetMarksheetVersion( file ); | |
160 if ( ver == 2 ) { | |
161 img_org.SetRGB( m_mask1, 255, 255, 255 ); // cm name | |
162 img_org.SetRGB( m_mask2, 255, 255, 255 ); // cm no. | |
163 img_org.SetRGB( m_mask3, 255, 255, 255 ); // barcode | |
164 } | |
165 else { // 古いマークシート ver == 1 | |
166 img_org.SetRGB( m_mask1old, 255, 255, 255 ); // cm name | |
167 img_org.SetRGB( m_mask2old, 255, 255, 255 ); // cm no. | |
168 img_org.SetRGB( m_mask3old, 255, 255, 255 ); // barcode | |
169 } | |
170 img_org.SaveFile( tmpjpg ); | |
8 | 171 notyet_mask = false; |
2 | 172 } |
173 else { | |
174 wxCopyFile( file, tmpjpg, true ); | |
175 } | |
176 html = html + wxT("<img src=\"") + tmpjpg + wxT("\" width=\"750\" height=\"1060\"/>"); | |
177 cout = dir.GetNext( &file ); | |
178 n++; | |
179 } | |
180 html = html + wxT("</body></html>"); | |
181 | |
182 // start printing | |
183 wxHtmlPrintout hpout( wxT("Searcher03") ); | |
184 hpout.SetMargins( 0, 0, 0, 0, 0 ); | |
185 | |
186 hpout.SetHtmlText( html, wxEmptyString, false ); | |
187 p.Print( NULL, &hpout, false ); | |
188 | |
8 | 189 wxString pst = wxT("処理済"); |
190 wxString logmsg = path; | |
191 if ( notyet_mask ) { | |
192 pst.Append( wxT(" 非マスク") ); | |
193 logmsg.Append( wxT(" not mask") ); | |
194 } | |
195 m_grid->SetCellValue( r, 3, pst ); | |
196 log.Add( logmsg ); | |
2 | 197 } |
6 | 198 WriteLog( log ); |
2 | 199 } |
200 | |
12
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
201 /* 一枚目強制マスク印刷 */ |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
202 void FrameBatchPrint::OnMaskPrint( wxCommandEvent& WXUNUSED(event) ) |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
203 { |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
204 wxArrayInt rows = m_grid->GetSelectedRows(); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
205 if ( rows.GetCount() != 1 ) { |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
206 wxMessageDialog md( this, wxT("1件のみ選択してください."), wxT("Message"), wxOK|wxICON_INFORMATION ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
207 md.ShowModal(); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
208 return; |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
209 } |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
210 |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
211 wxString path = m_grid->GetCellValue( rows[0], 2 ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
212 wxDir dir( path ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
213 if ( !dir.IsOpened() ) return; |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
214 |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
215 wxPrintDialogData pd; |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
216 wxPrinter p( &pd ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
217 p.PrintDialog( NULL ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
218 |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
219 // 印刷用の html を作成 |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
220 wxString file; |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
221 if ( dir.GetFirst( &file, wxT("*.jpg"), wxDIR_FILES ) ) { |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
222 wxString tmpdir = wxGetCwd() + wxFILE_SEP_PATH + wxT("tmp") + wxFILE_SEP_PATH; |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
223 file = path + wxFILE_SEP_PATH + file; |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
224 file.Replace( wxFILE_SEP_PATH, wxT("/") ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
225 wxString tmpjpg = wxString::Format( wxT("%stmp.jpg"), tmpdir ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
226 |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
227 wxImage img_org( file, wxBITMAP_TYPE_JPEG ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
228 img_org.SetRGB( m_mask1, 255, 255, 255 ); // cm name |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
229 img_org.SetRGB( m_mask2, 255, 255, 255 ); // cm no. |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
230 img_org.SetRGB( m_mask3, 255, 255, 255 ); // barcode |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
231 img_org.SaveFile( tmpjpg ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
232 |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
233 wxString html; |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
234 html = wxT("<html><body>\n"); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
235 html = html + wxT("<img src=\"") + tmpjpg + wxT("\" width=\"750\" height=\"1060\"/>"); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
236 html = html + wxT("</body></html>"); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
237 |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
238 // start printing |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
239 wxHtmlPrintout hpout( wxT("Searcher03") ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
240 hpout.SetMargins( 0, 0, 0, 0, 0 ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
241 hpout.SetHtmlText( html, wxEmptyString, false ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
242 p.Print( NULL, &hpout, false ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
243 } |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
244 } |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
245 |
2 | 246 /* 入力禁止 */ |
247 void FrameBatchPrint::SetGridReadOnly( void ) | |
248 { | |
249 for ( int r = 0; r < m_grid->GetNumberRows(); r++ ) | |
250 for ( int c = 1; c < m_grid->GetNumberCols(); c++ ) | |
251 m_grid->SetReadOnly( r, c, true ); | |
252 } | |
253 | |
12
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
254 /* 印刷ログ表示 */ |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
255 void FrameBatchPrint::OnLoadLog( wxCommandEvent& WXUNUSED(event) ) |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
256 { |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
257 wxFileDialog fd( this, wxT("Choose a file"), wxT("log"), wxEmptyString, wxT("log files (*.log)|bp_*.log"), wxFD_OPEN|wxFD_FILE_MUST_EXIST ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
258 if ( fd.ShowModal() == wxID_CANCEL ) |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
259 return; |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
260 |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
261 m_grid->ClearGrid(); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
262 |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
263 wxTextFile logfile; |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
264 logfile.Open( fd.GetPath() ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
265 |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
266 // |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
267 int d = logfile.GetLineCount() - m_grid->GetNumberRows(); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
268 if ( d > 0 ) |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
269 m_grid->AppendRows( d, true ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
270 |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
271 wxArrayString hhsno; |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
272 wxString hhs, path, stat; |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
273 for ( int n = 0; n < logfile.GetLineCount(); n++ ) { |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
274 hhs = logfile[n].AfterLast( wxFILE_SEP_PATH ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
275 stat = hhs.AfterFirst( ' ' ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
276 hhs = hhs.BeforeFirst( ' ' ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
277 path = logfile[n]; |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
278 if ( !stat.IsEmpty() ) { |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
279 path = path.BeforeFirst( ' ' ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
280 } |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
281 m_grid->SetCellValue( n, 0, hhs ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
282 m_grid->SetCellValue( n, 2, path ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
283 m_grid->SetCellValue( n, 3, stat ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
284 hhsno.Add( hhs ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
285 } |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
286 for ( int n = 0; n < hhsno.GetCount(); n++ ) { |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
287 wxArrayString info = wxSplit( GetHhsInfoByHhsNo( hhsno[n] ), '_', '\\' ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
288 m_grid->SetCellValue( n, 1, info[0] ); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
289 } |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
290 logfile.Close(); |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
291 } |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
292 |
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
293 /* 印刷ログ出力 */ |
6 | 294 void FrameBatchPrint::WriteLog( wxArrayString logline ) |
295 { | |
296 wxDateTime now = wxDateTime::Now(); | |
297 wxString log_file = wxGetCwd() + wxFILE_SEP_PATH + wxT("log") + wxFILE_SEP_PATH + wxT("bp_") + now.Format( wxT("%Y%m%d%H%M%S.log") ); | |
298 wxTextFile file( log_file ); | |
299 file.Create(); | |
300 wxTextFile logfile; | |
301 logfile.Open( log_file ); | |
2 | 302 |
6 | 303 for ( int n = 0; n < logline.GetCount(); n++ ) { |
304 logfile.AddLine( logline[n] ); | |
305 } | |
306 logfile.Write(); | |
307 logfile.Close(); | |
308 } | |
309 |