リビジョン 229
請求書一覧不具合対応
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/ConstrReqList/FrmConstrReqListAuxiliary.cs | ||
---|---|---|
125 | 125 |
/// ????SQL??Z?L?????e?B?????????????? |
126 | 126 |
/// </summary> |
127 | 127 |
/// <param name="strSQL"></param> |
128 |
private void CreateSecuritySQL(ref string strSQL)
|
|
128 |
private void CreateSecuritySQL(ref StringBuilder strSQL)
|
|
129 | 129 |
{ |
130 | 130 |
try |
131 | 131 |
{ |
... | ... | |
150 | 150 |
// ???????L |
151 | 151 |
// ?@???????i?????????j |
152 | 152 |
|
153 |
strSQL += " And (A.SalesPersonCode IN (Select A1.PersonCode From PersonInChargeMaster A1";
|
|
154 |
strSQL += string.Format(" Where A1.DepartmentCode IN (SELECT A2.DEPARTMENTCODE FROM PERSONDEPARTMENTMASTER A2 WHERE A2.PERSONCODE = {0}))", CommonMotions.LoginUserData.PersonCode);
|
|
153 |
strSQL.Append(" And (A.SalesPersonCode IN (Select A1.PersonCode From PersonInChargeMaster A1");
|
|
154 |
strSQL.AppendFormat(" Where A1.DepartmentCode IN (SELECT A2.DEPARTMENTCODE FROM PERSONDEPARTMENTMASTER A2 WHERE A2.PERSONCODE = {0}))", CommonMotions.LoginUserData.PersonCode);
|
|
155 | 155 |
|
156 |
strSQL += string.Format(" Or (A.ConstructionStatusFlg >= {0}", iStatus);
|
|
156 |
strSQL.AppendFormat(" Or (A.ConstructionStatusFlg >= {0}", iStatus);
|
|
157 | 157 |
|
158 |
strSQL += " And (A.ConstructionPersonCode IN (Select A3.PersonCode From PersonInChargeMaster A3";
|
|
159 |
strSQL += string.Format(" Where A3.DepartmentCode IN (SELECT A4.DEPARTMENTCODE FROM PERSONDEPARTMENTMASTER A4 WHERE A4.PERSONCODE = {0}))", CommonMotions.LoginUserData.PersonCode);
|
|
158 |
strSQL.Append(" And (A.ConstructionPersonCode IN (Select A3.PersonCode From PersonInChargeMaster A3");
|
|
159 |
strSQL.AppendFormat(" Where A3.DepartmentCode IN (SELECT A4.DEPARTMENTCODE FROM PERSONDEPARTMENTMASTER A4 WHERE A4.PERSONCODE = {0}))", CommonMotions.LoginUserData.PersonCode);
|
|
160 | 160 |
|
161 |
strSQL += " Or A.CONSTRSUBPERSONCODE IN (Select A5.PersonCode From PersonInChargeMaster A5";
|
|
162 |
strSQL += string.Format(" Where A5.DepartmentCode IN (SELECT A6.DEPARTMENTCODE FROM PERSONDEPARTMENTMASTER A6 WHERE A6.PERSONCODE = {0}))", CommonMotions.LoginUserData.PersonCode);
|
|
161 |
strSQL.Append(" Or A.CONSTRSUBPERSONCODE IN (Select A5.PersonCode From PersonInChargeMaster A5");
|
|
162 |
strSQL.AppendFormat(" Where A5.DepartmentCode IN (SELECT A6.DEPARTMENTCODE FROM PERSONDEPARTMENTMASTER A6 WHERE A6.PERSONCODE = {0}))", CommonMotions.LoginUserData.PersonCode);
|
|
163 | 163 |
|
164 |
strSQL += " Or A.ConstructionInstructor IN (Select A7.PersonCode From PersonInChargeMaster A7";
|
|
165 |
strSQL += string.Format(" Where A7.DepartmentCode IN (SELECT A8.DEPARTMENTCODE FROM PERSONDEPARTMENTMASTER A8 WHERE A8.PERSONCODE = {0}))))", CommonMotions.LoginUserData.PersonCode);
|
|
164 |
strSQL.Append(" Or A.ConstructionInstructor IN (Select A7.PersonCode From PersonInChargeMaster A7");
|
|
165 |
strSQL.AppendFormat(" Where A7.DepartmentCode IN (SELECT A8.DEPARTMENTCODE FROM PERSONDEPARTMENTMASTER A8 WHERE A8.PERSONCODE = {0}))))", CommonMotions.LoginUserData.PersonCode);
|
|
166 | 166 |
|
167 |
strSQL += string.Format(" Or (A.ConstructionStatusFlg >= {0} And A.ConstructionPersonCode = 0)", iStatus); // ????????????o???H???S??????????????????\??
|
|
168 |
strSQL += string.Format(" Or (A.ConstructionStatusFlg = {0}", iStatus2); // ???????p??????p???????????????
|
|
169 |
strSQL += string.Format(" And A.TransferConstruction = {0}))", CommonMotions.LoginUserData.DepartmentCode);
|
|
167 |
strSQL.AppendFormat(" Or (A.ConstructionStatusFlg >= {0} And A.ConstructionPersonCode = 0)", iStatus); // ????????????o???H???S??????????????????\??
|
|
168 |
strSQL.AppendFormat(" Or (A.ConstructionStatusFlg = {0}", iStatus2); // ???????p??????p???????????????
|
|
169 |
strSQL.AppendFormat(" And A.TransferConstruction = {0}))", CommonMotions.LoginUserData.DepartmentCode);
|
|
170 | 170 |
} |
171 | 171 |
else if (CommonMotions.LoginUserSecurity.SecRange == CommonDefine.SecurityRangeList[None].Key) |
172 | 172 |
{ |
173 | 173 |
// ???g?p?? |
174 |
strSQL += string.Format(" And (A.SalesPersonCode = {0}", CommonMotions.LoginUserData.PersonCode);
|
|
174 |
strSQL.AppendFormat(" And (A.SalesPersonCode = {0}", CommonMotions.LoginUserData.PersonCode);
|
|
175 | 175 |
|
176 |
strSQL += string.Format(" Or (A.ConstructionStatusFlg >= {0}", iStatus);
|
|
176 |
strSQL.AppendFormat(" Or (A.ConstructionStatusFlg >= {0}", iStatus);
|
|
177 | 177 |
|
178 |
strSQL += string.Format(" And (A.ConstructionPersonCode = {0}", CommonMotions.LoginUserData.PersonCode);
|
|
178 |
strSQL.AppendFormat(" And (A.ConstructionPersonCode = {0}", CommonMotions.LoginUserData.PersonCode);
|
|
179 | 179 |
|
180 |
strSQL += string.Format(" Or A.CONSTRSUBPERSONCODE = {0}", CommonMotions.LoginUserData.PersonCode);
|
|
180 |
strSQL.AppendFormat(" Or A.CONSTRSUBPERSONCODE = {0}", CommonMotions.LoginUserData.PersonCode);
|
|
181 | 181 |
|
182 |
strSQL += string.Format(" Or A.ConstructionInstructor = {0})))", CommonMotions.LoginUserData.PersonCode);
|
|
182 |
strSQL.AppendFormat(" Or A.ConstructionInstructor = {0})))", CommonMotions.LoginUserData.PersonCode);
|
|
183 | 183 |
} |
184 | 184 |
} |
185 | 185 |
catch (Exception ex) |
... | ... | |
247 | 247 |
} |
248 | 248 |
#endregion |
249 | 249 |
|
250 |
#region ?????????????SQL??
|
|
250 |
#region ??????SQL?? |
|
251 | 251 |
/// <summary> |
252 |
/// ?????????????SQL??
|
|
252 |
/// ??????SQL?? |
|
253 | 253 |
/// </summary> |
254 | 254 |
/// <param name="strSQL"></param> |
255 |
private void CreateInitSQL(ref string strSQL)
|
|
255 |
private void CreateInitSQL(ref StringBuilder strSQL)
|
|
256 | 256 |
{ |
257 | 257 |
try |
258 | 258 |
{ |
259 | 259 |
int Status1 = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("????????")).Key; |
260 |
int Status2 = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("??@?@??")).Key; |
|
261 |
int NotOrderStatus = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("?? ?? ??")).Key; |
|
260 | 262 |
|
261 |
strSQL = "SELECT * FROM (";
|
|
263 |
strSQL.Append("SELECT * FROM (");
|
|
262 | 264 |
for (int i = 0; i < 2; i++) |
263 | 265 |
{ |
264 | 266 |
switch (i) |
265 | 267 |
{ |
266 | 268 |
case 0: |
267 |
strSQL += "SELECT";
|
|
269 |
strSQL.Append("SELECT");
|
|
268 | 270 |
break; |
269 | 271 |
case 1: |
270 |
strSQL += " UNION SELECT";
|
|
272 |
strSQL.Append(" UNION SELECT");
|
|
271 | 273 |
break; |
272 | 274 |
} |
273 | 275 |
|
274 |
strSQL += " DISTINCT A.CONSTRUCTIONCODE,";
|
|
275 |
strSQL += " A.CONSTRUCTIONPERIOD,";
|
|
276 |
strSQL += " B.DETAILSTRING,";
|
|
277 |
strSQL += " A.CONSTRUCTIONSTATUSFLG,";
|
|
278 |
strSQL += " C.PERSONCODE AS SALESMANCODE,";
|
|
279 |
strSQL += " C.PERSONNAME AS SALESMANNAME,";
|
|
280 |
strSQL += " C.DEPARTMENTCODE AS SALESDEPCODE,";
|
|
281 |
strSQL += " C.DEPARTMENTNAME AS SALESDEPNAME,";
|
|
282 |
strSQL += " C.MANDISPORDER AS SALESMANORDER,";
|
|
283 |
strSQL += " C.DEPDISPORDER AS SALESDEPORDER,";
|
|
284 |
strSQL += " D.PERSONCODE,";
|
|
285 |
strSQL += " D.PERSONNAME,";
|
|
286 |
strSQL += " D.DEPARTMENTCODE,";
|
|
287 |
strSQL += " D.DEPARTMENTNAME,";
|
|
288 |
strSQL += " D.MANDISPORDER,";
|
|
289 |
strSQL += " D.DEPDISPORDER,";
|
|
290 |
strSQL += " E.MAINCONSTRUCTIONCODE";
|
|
276 |
strSQL.Append(" DISTINCT A.CONSTRUCTIONCODE,");
|
|
277 |
strSQL.Append(" A.CONSTRUCTIONPERIOD,");
|
|
278 |
strSQL.Append(" B.DETAILSTRING,");
|
|
279 |
strSQL.Append(" A.CONSTRUCTIONSTATUSFLG,");
|
|
280 |
strSQL.Append(" C.PERSONCODE AS SALESMANCODE,");
|
|
281 |
strSQL.Append(" C.PERSONNAME AS SALESMANNAME,");
|
|
282 |
strSQL.Append(" C.DEPARTMENTCODE AS SALESDEPCODE,");
|
|
283 |
strSQL.Append(" C.DEPARTMENTNAME AS SALESDEPNAME,");
|
|
284 |
strSQL.Append(" C.MANDISPORDER AS SALESMANORDER,");
|
|
285 |
strSQL.Append(" C.DEPDISPORDER AS SALESDEPORDER,");
|
|
286 |
strSQL.Append(" D.PERSONCODE,");
|
|
287 |
strSQL.Append(" D.PERSONNAME,");
|
|
288 |
strSQL.Append(" D.DEPARTMENTCODE,");
|
|
289 |
strSQL.Append(" D.DEPARTMENTNAME,");
|
|
290 |
strSQL.Append(" D.MANDISPORDER,");
|
|
291 |
strSQL.Append(" D.DEPDISPORDER,");
|
|
292 |
strSQL.Append(" E.MAINCONSTRUCTIONCODE");
|
|
291 | 293 |
|
292 |
strSQL += " FROM CONSTRUCTIONBASEINFO A";
|
|
294 |
strSQL.Append(" FROM CONSTRUCTIONBASEINFO A");
|
|
293 | 295 |
|
294 |
strSQL += " LEFT JOIN (SELECT CA.CONSTRUCTIONCODE, CA.SALESPERSONCODE PERSONCODE, CB.PERSONNAME PERSONNAME,";
|
|
295 |
strSQL += " CB.DEPARTMENTCODE DEPARTMENTCODE, CC.DEPARTMENTSTRING DEPARTMENTNAME,";
|
|
296 |
strSQL += " CB.DISPLAYORDER MANDISPORDER, CC.DISPLAYORDER DEPDISPORDER";
|
|
297 |
strSQL += " FROM CONSTRUCTIONBASEINFO CA";
|
|
298 |
strSQL += " LEFT JOIN PERSONINCHARGEMASTER CB ON CA.SALESPERSONCODE = CB.PERSONCODE";
|
|
299 |
strSQL += " LEFT JOIN DEPARTMENTMASTER CC ON CB.DEPARTMENTCODE = CC.DEPARTMENTCODE";
|
|
300 |
strSQL += string.Format(" WHERE CA.CONSTRUCTIONPERIOD = {0}) C ON A.CONSTRUCTIONCODE = C.CONSTRUCTIONCODE", numUDConstPro.Value);
|
|
296 |
strSQL.Append(" LEFT JOIN (SELECT CA.CONSTRUCTIONCODE, CA.SALESPERSONCODE PERSONCODE, CB.PERSONNAME PERSONNAME,");
|
|
297 |
strSQL.Append(" CB.DEPARTMENTCODE DEPARTMENTCODE, CC.DEPARTMENTSTRING DEPARTMENTNAME,");
|
|
298 |
strSQL.Append(" CB.DISPLAYORDER MANDISPORDER, CC.DISPLAYORDER DEPDISPORDER");
|
|
299 |
strSQL.Append(" FROM CONSTRUCTIONBASEINFO CA");
|
|
300 |
strSQL.Append(" LEFT JOIN PERSONINCHARGEMASTER CB ON CA.SALESPERSONCODE = CB.PERSONCODE");
|
|
301 |
strSQL.Append(" LEFT JOIN DEPARTMENTMASTER CC ON CB.DEPARTMENTCODE = CC.DEPARTMENTCODE");
|
|
302 |
strSQL.AppendFormat(" WHERE CA.CONSTRUCTIONPERIOD = {0}) C ON A.CONSTRUCTIONCODE = C.CONSTRUCTIONCODE", numUDConstPro.Value);
|
|
301 | 303 |
|
302 |
strSQL += " LEFT JOIN (SELECT DA.CONSTRUCTIONCODE, DA.CONSTRUCTIONPERSONCODE PERSONCODE, DB.PERSONNAME PERSONNAME,";
|
|
303 |
strSQL += " DB.DEPARTMENTCODE DEPARTMENTCODE, DC.DEPARTMENTSTRING DEPARTMENTNAME,";
|
|
304 |
strSQL += " DB.DISPLAYORDER MANDISPORDER, DC.DISPLAYORDER DEPDISPORDER";
|
|
305 |
strSQL += " FROM CONSTRUCTIONBASEINFO DA";
|
|
306 |
strSQL += " LEFT JOIN PERSONINCHARGEMASTER DB ON DA.CONSTRUCTIONPERSONCODE = DB.PERSONCODE";
|
|
307 |
strSQL += " LEFT JOIN DEPARTMENTMASTER DC ON DB.DEPARTMENTCODE = DC.DEPARTMENTCODE";
|
|
304 |
strSQL.Append(" LEFT JOIN (SELECT DA.CONSTRUCTIONCODE, DA.CONSTRUCTIONPERSONCODE PERSONCODE, DB.PERSONNAME PERSONNAME,");
|
|
305 |
strSQL.Append(" DB.DEPARTMENTCODE DEPARTMENTCODE, DC.DEPARTMENTSTRING DEPARTMENTNAME,");
|
|
306 |
strSQL.Append(" DB.DISPLAYORDER MANDISPORDER, DC.DISPLAYORDER DEPDISPORDER");
|
|
307 |
strSQL.Append(" FROM CONSTRUCTIONBASEINFO DA");
|
|
308 |
strSQL.Append(" LEFT JOIN PERSONINCHARGEMASTER DB ON DA.CONSTRUCTIONPERSONCODE = DB.PERSONCODE");
|
|
309 |
strSQL.Append(" LEFT JOIN DEPARTMENTMASTER DC ON DB.DEPARTMENTCODE = DC.DEPARTMENTCODE");
|
|
308 | 310 |
|
309 |
strSQL += string.Format(" WHERE DA.CONSTRUCTIONPERIOD = {0}) D ON A.CONSTRUCTIONCODE = D.CONSTRUCTIONCODE", numUDConstPro.Value);
|
|
311 |
strSQL.AppendFormat(" WHERE DA.CONSTRUCTIONPERIOD = {0}) D ON A.CONSTRUCTIONCODE = D.CONSTRUCTIONCODE", numUDConstPro.Value);
|
|
310 | 312 |
switch (i) |
311 | 313 |
{ |
312 | 314 |
case 0: |
313 |
strSQL += ", CONSTRUCTIONBASEINFODETAIL B";
|
|
314 |
strSQL += " LEFT JOIN REQUESTDATA E ON E.MAINCONSTRUCTIONCODE = B.CONSTRUCTIONCODE";
|
|
315 |
strSQL.Append(", CONSTRUCTIONBASEINFODETAIL B");
|
|
316 |
strSQL.Append(" LEFT JOIN REQUESTDATA E ON E.MAINCONSTRUCTIONCODE = B.CONSTRUCTIONCODE");
|
|
315 | 317 |
break; |
316 | 318 |
case 1: |
317 |
strSQL += ", CONSTRUCTIONBASEINFODETAIL B, REQUESTDATA E";
|
|
319 |
strSQL.Append(", CONSTRUCTIONBASEINFODETAIL B, REQUESTDATA E");
|
|
318 | 320 |
break; |
319 | 321 |
} |
320 | 322 |
|
321 |
strSQL += string.Format(" WHERE A.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value); |
|
322 |
strSQL += string.Format(" AND A.TYINGFLG != {0}", (int)CommonDefine.BaseInfoTyingFlg.Tying); |
|
323 |
strSQL.AppendFormat(" WHERE A.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value); |
|
324 |
strSQL.AppendFormat(" AND A.JOINFLG != {0}", (int)CommonDefine.BaseInfoJoinFlg.JoinChildren); |
|
325 |
strSQL.AppendFormat(" AND A.TYINGFLG != {0}", (int)CommonDefine.BaseInfoTyingFlg.Tying); |
|
323 | 326 |
|
324 |
strSQL += string.Format(" AND A.BILLINGSPLITFLG = {0}", m_ExecuteSubFlg); |
|
325 |
|
|
326 |
strSQL += " AND A.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE"; |
|
327 |
strSQL += string.Format(" AND B.DETAILNO = {0}", (int)ConstructionBaseInfoDetail.DetailDataNo.ConstructionName); |
|
327 |
strSQL.AppendFormat(" AND A.BILLINGSPLITFLG = {0}", m_ExecuteSubFlg); |
|
328 | 328 |
|
329 |
strSQL.Append(" AND A.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE"); |
|
330 |
strSQL.AppendFormat(" AND B.DETAILNO = {0}", (int)ConstructionBaseInfoDetail.DetailDataNo.ConstructionName); |
|
331 |
|
|
329 | 332 |
switch (i) |
330 | 333 |
{ |
331 | 334 |
case 0: |
332 |
strSQL += string.Format(" AND A.CONSTRUCTIONSTATUSFLG = {0}", Status1); |
|
335 |
switch (m_ExecuteSubFlg) |
|
336 |
{ |
|
337 |
case (int)CommonDefine.BaseInfoBillingSplitFlg.AllOnBilling: |
|
338 |
// ?????????? |
|
339 |
strSQL.AppendFormat(" AND (A.CONSTRUCTIONSTATUSFLG = {0}", Status1); |
|
340 |
break; |
|
341 |
case (int)CommonDefine.BaseInfoBillingSplitFlg.SplitBilling: |
|
342 |
// ???????????? |
|
343 |
strSQL.AppendFormat(" AND (A.CONSTRUCTIONSTATUSFLG > {0}", Status2); |
|
344 |
break; |
|
345 |
default: |
|
346 |
break; |
|
347 |
} |
|
348 |
strSQL.AppendFormat(" AND A.CONSTRUCTIONSTATUSFLG != {0})", NotOrderStatus); |
|
333 | 349 |
break; |
334 | 350 |
case 1: |
335 |
strSQL += " AND E.MAINCONSTRUCTIONCODE = B.CONSTRUCTIONCODE"; |
|
351 |
strSQL.Append(" AND E.MAINCONSTRUCTIONCODE = B.CONSTRUCTIONCODE"); |
|
352 |
strSQL.AppendFormat(" AND A.CONSTRUCTIONSTATUSFLG != {0}", NotOrderStatus); |
|
336 | 353 |
break; |
337 | 354 |
} |
338 | 355 |
|
339 | 356 |
// ???????I??????????? |
340 |
strSQL += GetDepartmentString();
|
|
357 |
strSQL.Append(GetDepartmentString());
|
|
341 | 358 |
|
342 | 359 |
// ?S??????I??????????? |
343 |
strSQL += GetPersonString();
|
|
360 |
strSQL.Append(GetPersonString());
|
|
344 | 361 |
|
345 | 362 |
// ?Z?L?????e?B??????? |
346 |
string wrkBuff = string.Empty;
|
|
363 |
StringBuilder wrkBuff = new StringBuilder();
|
|
347 | 364 |
CreateSecuritySQL(ref wrkBuff); |
348 |
strSQL += wrkBuff;
|
|
365 |
strSQL.Append(wrkBuff);
|
|
349 | 366 |
} |
350 | 367 |
|
351 |
strSQL += ") AS UNI";
|
|
368 |
strSQL.Append(") AS UNI");
|
|
352 | 369 |
// ORDER BY ??? |
353 |
strSQL += " ORDER BY 4 ASC, 10 ASC, 9 ASC, 16 ASC, 15 ASC, 1 DESC";
|
|
370 |
strSQL.Append(" ORDER BY 4 ASC, 10 ASC, 9 ASC, 16 ASC, 15 ASC, 1 DESC");
|
|
354 | 371 |
|
355 | 372 |
} |
356 | 373 |
catch (Exception ex) |
... | ... | |
519 | 536 |
{ |
520 | 537 |
foreach (DataGridViewColumn wrkCol in dgvMaster.Columns) wrkCol.SortMode = DataGridViewColumnSortMode.NotSortable; |
521 | 538 |
dgvMaster.Rows.Clear(); |
522 |
string strSQL = "";
|
|
539 |
StringBuilder strSQL = new StringBuilder(); ;
|
|
523 | 540 |
// SQL?? |
524 | 541 |
CreateInitSQL(ref strSQL); |
525 | 542 |
ArrayList arData = new ArrayList(); |
526 | 543 |
// ?H????{???? |
527 |
if (cbiDB.ExecuteReader(strSQL, ref arData)) |
|
544 |
if (cbiDB.ExecuteReader(strSQL.ToString(), ref arData))
|
|
528 | 545 |
{ |
529 | 546 |
// ?O???b?h??Z?b?g????? |
530 | 547 |
SetToGridData(arData); |
... | ... | |
628 | 645 |
// ?O???b?h??????????? |
629 | 646 |
m_GridWidthSize = dgv.Width; |
630 | 647 |
|
631 |
switch (m_ExecuteFlg) |
|
632 |
{ |
|
633 |
case (int)ClsExcute.ProcessExecuteNo.MaterialReserveEntry: |
|
634 |
// ?????????? |
|
635 |
dgv.Columns[(int)DispColumn.ConstructionName].Width = 440; |
|
636 |
dgv.Columns[(int)DispColumn.BillingMark].Visible = true; |
|
637 |
dgv.Columns[(int)DispColumn.BillingMark].Width = 60; |
|
638 |
break; |
|
639 |
case (int)ClsExcute.ProcessExecuteNo.MaterialReturnEntry: |
|
640 |
// ???????????? |
|
641 |
dgv.Columns[(int)DispColumn.ConstructionName].Width = 500; |
|
642 |
dgv.Columns[(int)DispColumn.BillingMark].Visible = false; |
|
643 |
break; |
|
644 |
default: |
|
645 |
break; |
|
646 |
} |
|
647 |
|
|
648 | 648 |
int CellCount = dgv.ColumnCount; |
649 | 649 |
m_CellSize = new int[CellCount]; |
650 | 650 |
foreach (DataGridViewColumn col in dgv.Columns) |
... | ... | |
875 | 875 |
cmbDepartment.Items.Clear(); |
876 | 876 |
cmbDepartment.Text = ""; |
877 | 877 |
|
878 |
string strSQL = string.Empty;
|
|
878 |
StringBuilder strSQL = new StringBuilder();
|
|
879 | 879 |
// ?????}?X?^?????????? |
880 |
strSQL = "SELECT A.DEPARTMENTCODE, A.DEPARTMENTSTRING, A.DISPLAYORDER, COUNT(*)";
|
|
881 |
strSQL += " FROM DEPARTMENTMASTER A, PERSONINCHARGEMASTER B, CONSTRUCTIONBASEINFO C";
|
|
882 |
strSQL += " WHERE A.DELETEFLG = 0";
|
|
880 |
strSQL.AppendFormat("SELECT A.DEPARTMENTCODE, A.DEPARTMENTSTRING, A.DISPLAYORDER, COUNT(*)");
|
|
881 |
strSQL.Append(" FROM DEPARTMENTMASTER A, PERSONINCHARGEMASTER B, CONSTRUCTIONBASEINFO C");
|
|
882 |
strSQL.Append(" WHERE A.DELETEFLG = 0");
|
|
883 | 883 |
|
884 | 884 |
if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode) |
885 | 885 |
{ |
886 | 886 |
// ?Q??????}?X?^???????? |
887 |
strSQL += " AND A.DEPARTMENTCODE IN (SELECT A1.DEPARTMENTCODE FROM PERSONDEPARTMENTMASTER A1";
|
|
888 |
strSQL += string.Format(" WHERE A1.PERSONCODE = {0})", CommonMotions.LoginUserData.PersonCode);
|
|
887 |
strSQL.Append(" AND A.DEPARTMENTCODE IN (SELECT A1.DEPARTMENTCODE FROM PERSONDEPARTMENTMASTER A1");
|
|
888 |
strSQL.AppendFormat(" WHERE A1.PERSONCODE = {0})", CommonMotions.LoginUserData.PersonCode);
|
|
889 | 889 |
} |
890 | 890 |
|
891 |
strSQL += " AND A.DEPARTMENTCODE = B.DEPARTMENTCODE";
|
|
892 |
strSQL += " AND B.PERSONCODE = C.CONSTRUCTIONPERSONCODE";
|
|
893 |
strSQL += " GROUP BY A.DEPARTMENTCODE, A.DEPARTMENTSTRING, A.DISPLAYORDER";
|
|
894 |
strSQL += " ORDER BY A.DISPLAYORDER ASC";
|
|
891 |
strSQL.Append(" AND A.DEPARTMENTCODE = B.DEPARTMENTCODE");
|
|
892 |
strSQL.Append(" AND B.PERSONCODE = C.CONSTRUCTIONPERSONCODE");
|
|
893 |
strSQL.Append(" GROUP BY A.DEPARTMENTCODE, A.DEPARTMENTSTRING, A.DISPLAYORDER");
|
|
894 |
strSQL.Append(" ORDER BY A.DISPLAYORDER ASC");
|
|
895 | 895 |
|
896 | 896 |
// ?????}?X?^??? |
897 | 897 |
ArrayList arList = new ArrayList(); |
898 |
if (!depDB.ExecuteReader(strSQL, ref arList)) return; |
|
898 |
if (!depDB.ExecuteReader(strSQL.ToString(), ref arList)) return;
|
|
899 | 899 |
|
900 | 900 |
List<KeyValuePair<int, string>> ConstructionDataList = new List<KeyValuePair<int, string>>(); |
901 | 901 |
ConstructionDataList.Add(new KeyValuePair<int, string>(0, "")); |
... | ... | |
942 | 942 |
cmbConstructionPerson.Text = ""; |
943 | 943 |
|
944 | 944 |
int DepartmentCode = GetDepartmentCode(); |
945 |
string strSQL = string.Empty;
|
|
945 |
StringBuilder strSQL = new StringBuilder();
|
|
946 | 946 |
// ???????? |
947 |
strSQL = string.Format(" WHERE LEDGERFLG = {0}", (int)CommonDefine.PersonLedgerDivNo.CalcTarget);
|
|
948 |
strSQL += " AND (DEPARTMENTCODE";
|
|
949 |
string strSubSQL = string.Empty;
|
|
947 |
strSQL.AppendFormat(" WHERE LEDGERFLG = {0}", (int)CommonDefine.PersonLedgerDivNo.CalcTarget);
|
|
948 |
strSQL.Append(" AND (DEPARTMENTCODE");
|
|
949 |
StringBuilder strSubSQL = new StringBuilder();
|
|
950 | 950 |
if (DepartmentCode == 0) |
951 | 951 |
{ |
952 | 952 |
// ?Q??????}?X?^???????? |
953 |
strSubSQL += string.Format(" IN (SELECT AA.DEPARTMENTCODE FROM PERSONDEPARTMENTMASTER AA WHERE AA.PERSONCODE = {0})"
|
|
953 |
strSubSQL.AppendFormat(" IN (SELECT AA.DEPARTMENTCODE FROM PERSONDEPARTMENTMASTER AA WHERE AA.PERSONCODE = {0})"
|
|
954 | 954 |
, CommonMotions.LoginUserData.PersonCode); |
955 | 955 |
} |
956 | 956 |
else |
957 | 957 |
{ |
958 |
strSubSQL += string.Format(" = {0}", DepartmentCode);
|
|
958 |
strSubSQL.AppendFormat(" = {0}", DepartmentCode);
|
|
959 | 959 |
} |
960 |
strSQL += strSubSQL + ")"; |
|
960 |
strSQL.Append(strSubSQL.ToString()); |
|
961 |
strSQL.Append(")"); |
|
961 | 962 |
|
962 | 963 |
// ??????????E?????????? |
963 | 964 |
DateTime dtDefaultStart = DateTime.MinValue; |
964 | 965 |
DateTime dtDefaultEnd = DateTime.MinValue; |
965 | 966 |
CreateDefaultStartAndEndDate(ref dtDefaultStart, ref dtDefaultEnd); |
966 | 967 |
|
967 |
strSQL += string.Format(" AND (DATE(STARTDATE) <= STR_TO_DATE('{0}','%Y/%m/%d')", dtDefaultEnd.ToShortDateString());
|
|
968 |
strSQL += string.Format(" AND (STR_TO_DATE('{0}','%Y/%m/%d') <= DATE(ENDDATE)", dtDefaultStart.ToShortDateString());
|
|
969 |
strSQL += string.Format(" OR STR_TO_DATE('{0}','%Y/%m/%d') = DATE(ENDDATE)))", DateTime.MinValue.ToShortDateString());
|
|
968 |
strSQL.AppendFormat(" AND (DATE(STARTDATE) <= STR_TO_DATE('{0}','%Y/%m/%d')", dtDefaultEnd.ToShortDateString());
|
|
969 |
strSQL.AppendFormat(" AND (STR_TO_DATE('{0}','%Y/%m/%d') <= DATE(ENDDATE)", dtDefaultStart.ToShortDateString());
|
|
970 |
strSQL.AppendFormat(" OR STR_TO_DATE('{0}','%Y/%m/%d') = DATE(ENDDATE)))", DateTime.MinValue.ToShortDateString());
|
|
970 | 971 |
|
971 |
strSQL += " Order By DeleteFlg ASC, EmployeeClassFlg ASC, DisplayOrder ASC";
|
|
972 |
strSQL.Append(" Order By DeleteFlg ASC, EmployeeClassFlg ASC, DisplayOrder ASC");
|
|
972 | 973 |
// ?S????}?X?^??? |
973 |
if (!picDB.SelectAction(strSQL, ref workList)) return; |
|
974 |
if (!picDB.SelectAction(strSQL.ToString(), ref workList)) return;
|
|
974 | 975 |
|
975 | 976 |
List<KeyValuePair<int, string>> ConstructionDataList = new List<KeyValuePair<int, string>>(); |
976 | 977 |
ConstructionDataList.Add(new KeyValuePair<int, string>(0, "")); |
... | ... | |
1046 | 1047 |
|
1047 | 1048 |
int DepartmentCode = GetDepartmentCode(); |
1048 | 1049 |
|
1049 |
string strSQL = PersonDB.CreatePrimarykeyString(PersonCode); |
|
1050 |
StringBuilder strSQL = new StringBuilder(); |
|
1051 |
strSQL.Append(PersonDB.CreatePrimarykeyString(PersonCode)); |
|
1050 | 1052 |
PersonInChargeMaster PersonRec = new PersonInChargeMaster(); |
1051 |
PersonDB.SelectAction(strSQL, ref PersonRec); |
|
1053 |
PersonDB.SelectAction(strSQL.ToString(), ref PersonRec);
|
|
1052 | 1054 |
|
1053 | 1055 |
// ?????R???{?{?b?N?X??????R?[?h?Z?b?g |
1054 | 1056 |
if (PersonRec.DepartmentCode > 0 && DepartmentCode != PersonRec.DepartmentCode) |
他の形式にエクスポート: Unified diff