プロジェクト

全般

プロフィール

リビジョン 261

堀内7年以上前に追加

売上グラフ請求データ対応
区分マスタデータ定義CommonDefineよりDivisionMasterへ移動
台帳一覧振分金額バグ修正

差分を表示:

branches/src/ProcessManagement/ProcessManagement/Common/CommonDefine.cs
389 389
        }
390 390
        #endregion
391 391

  
392
        #region 区分マスタ:データ分け区分
393
        /// <summary>
394
        /// 区分マスタ区分
395
        /// </summary>
396
        public enum DivisionMasterCodeDefine
397
        {
398
            /// <summary>
399
            /// 発注者区分登録
400
            /// </summary>
401
            OrderDivision = 1,
402
            /// <summary>
403
            /// 工事種別登録
404
            /// </summary>
405
            ConstructionClass = 2,
406
            /// <summary>
407
            /// 工事経費名称登録
408
            /// </summary>
409
            ConstructionExpenses = 3,
410
        }
411
        /// <summary>
412
        /// 区分マスタ区分キー
413
        /// </summary>
414
        public static Dictionary<int, string> DivisionMasterCode = new Dictionary<int, string>(){
415
                                                                                {1, "発注者区分登録"},
416
                                                                                {2, "工事種別登録"},
417
                                                                                {3, "工事経費名称登録"},
418
                                                                                };
419
        #endregion
420

  
421 392
        #region 期限マスタ:日付チェックタイミング
422 393
        /// <summary>
423 394
        /// 期限マスタ:日付チェックタイミング
branches/src/ProcessManagement/ProcessManagement/Common/CommonMotions.cs
2253 2253
            try
2254 2254
            {
2255 2255
                string strwork = string.Empty;
2256
                string strwork2 = string.Empty;
2257
                string strwork3 = string.Empty;
2258 2256
                if (bPeriod)
2259 2257
                {   // 営業期
2260 2258
                    strwork = CommonMotions.SystemMasterData.BusinessBeginningDate;
......
2263 2261
                {   // 工事年度
2264 2262
                    strwork = CommonMotions.SystemMasterData.ConstructionBeginningDate;
2265 2263
                }
2266
                strwork2 = strwork.Substring(0, strwork.IndexOf("/"));
2267
                strwork3 = strwork.Substring(strwork.IndexOf("/") + 1, 2);
2268
                Mounth = CommonMotions.cnvInt(strwork2);
2269
                Days = CommonMotions.cnvInt(strwork3);
2264
                string[] strArray = strwork.Split('/');
2265
                Mounth = CommonMotions.cnvInt(strArray[0]);
2266
                Days = CommonMotions.cnvInt(strArray[1]);
2270 2267

  
2271 2268
            }
2272 2269
            catch (System.Exception ex)
......
2276 2273
        }
2277 2274
        #endregion
2278 2275

  
2276
        #region 指定期・指定年度の期首日・期末日を取得する
2277
        /// <summary>
2278
        /// 指定期・指定年度の期首日・期末日を取得する
2279
        /// </summary>
2280
        /// <param name="nYear"></param>
2281
        /// <param name="bOpen"></param>
2282
        /// <param name="bPeriod"></param>
2283
        /// <returns></returns>
2284
        public static DateTime GetOpeningEndDate(int nYear, bool bOpen = true, bool bPeriod = true)
2285
        {
2286
            try
2287
            {
2288
                DateTime dtRet = DateTime.Today;
2289

  
2290
                string strwork = string.Empty;
2291
                int TargetYear = DateTime.Today.Year;
2292

  
2293
                if (bPeriod)
2294
                {   // 営業期
2295
                    strwork = CommonMotions.SystemMasterData.BusinessBeginningDate;
2296
                    TargetYear = BusinessPeriodToConstructionYears(nYear);
2297
                }
2298
                else
2299
                {   // 工事年度
2300
                    strwork = CommonMotions.SystemMasterData.ConstructionBeginningDate;
2301
                    TargetYear = nYear;
2302
                }
2303
                // 月・日分割
2304
                string[] DateArray = strwork.Split('/');
2305

  
2306
                // 年月日作成
2307
                dtRet = new DateTime(TargetYear, int.Parse(DateArray[0]), int.Parse(DateArray[1]));
2308

  
2309
                // 期末取得時
2310
                if (!bOpen)
2311
                {
2312
                    dtRet = dtRet.AddYears(1).AddDays(-1);
2313
                }
2314

  
2315
                return dtRet;
2316
            }
2317
            catch (System.Exception ex)
2318
            {
2319
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
2320
                return DateTime.Today;
2321
            }
2322
        }
2323
        #endregion
2324

  
2279 2325
        #region TimeSpanから年数を取得する
2280 2326
        /// <summary>
2281 2327
        /// TimeSpanから年数を取得する
......
2643 2689
                strSQL.Append(" ORDER BY A.d, B.STARTDATE DESC) AS AX");
2644 2690
                strSQL.Append(" GROUP BY AX.hiduke");
2645 2691
                strSQL.Append(" ORDER BY AX.hiduke");
2646
                strSQL.Append(" ) SAL");
2692
                strSQL.Append(" ) AS SAL");
2647 2693

  
2648 2694
                ArrayList ArData = new ArrayList();
2649 2695
                SalDB.ExecuteReader(strSQL.ToString(), ref ArData);
branches/src/ProcessManagement/ProcessManagement/Common/CommonVersion.cs
14 14
        /// <summary>
15 15
        /// 本体バージョン
16 16
        /// </summary>
17
        public static int s_SystemVersion = 70;
17
        public static int s_SystemVersion = 71;
18 18

  
19 19
        /// <summary>
20 20
        /// コピー・環境バージョン
branches/src/ProcessManagement/ProcessManagement/Common/Process/ClsExcute.cs
3408 3408
                }
3409 3409
                if (EditFlg == (int)CommonDefine.ProcessDataEdit.Reference) frm.EditLock = true;
3410 3410

  
3411
                frm.DivisionCode = (int)CommonDefine.DivisionMasterCodeDefine.OrderDivision;
3411
                frm.DivisionCode = (int)DivisionMaster.DivisionMasterCodeDefine.OrderDivision;
3412 3412

  
3413 3413
                frm.ShowDialog();
3414 3414
            }
......
3445 3445
                }
3446 3446
                if (EditFlg == (int)CommonDefine.ProcessDataEdit.Reference) frm.EditLock = true;
3447 3447

  
3448
                frm.DivisionCode = (int)CommonDefine.DivisionMasterCodeDefine.ConstructionExpenses;
3448
                frm.DivisionCode = (int)DivisionMaster.DivisionMasterCodeDefine.ConstructionExpenses;
3449 3449

  
3450 3450
                frm.ShowDialog();
3451 3451
            }
branches/src/ProcessManagement/ProcessManagement/DataModel/DivisionMaster.cs
10 10
    /// </summary>
11 11
    public class DivisionMaster
12 12
    {
13
        #region 定数
14
        /// <summary>
15
        /// 区分マスタ区分
16
        /// </summary>
17
        public enum DivisionMasterCodeDefine
18
        {
19
            /// <summary>
20
            /// 発注者区分登録
21
            /// </summary>
22
            OrderDivision = 1,
23
            /// <summary>
24
            /// 工事種別登録
25
            /// </summary>
26
            ConstructionClass = 2,
27
            /// <summary>
28
            /// 工事経費名称登録
29
            /// </summary>
30
            ConstructionExpenses = 3,
31
        }
32
        /// <summary>
33
        /// 区分マスタ区分キー
34
        /// </summary>
35
        public static Dictionary<int, string> DivisionMasterCode = new Dictionary<int, string>(){
36
                                                                                {1, "発注者区分登録"},
37
                                                                                {2, "工事種別登録"},
38
                                                                                {3, "工事経費名称登録"},
39
                                                                                };
40
        #endregion
41

  
13 42
        #region メンバ変数
14 43
        private int         m_DivisionCode = 0;	                // 区分コード
15 44
        private int         m_NameCode = 0;	                    // 名称コード
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstractionList/FrmConstructionList.cs
311 311
        #endregion
312 312

  
313 313
        #region ?????R???{?{?b?N?X??X
314
        /// <summary>
315
        /// ?????R???{?{?b?N?X??X
316
        /// </summary>
317
        /// <param name="sender"></param>
318
        /// <param name="e"></param>
319
        private void cmbDepartment_TextChanged(object sender, EventArgs e)
314
        private void cmbDepartment_SelectedIndexChanged(object sender, EventArgs e)
320 315
        {
321 316
            if (m_initDataLoad) return;
322 317

  
......
326 321
            // ?f?[?^?\??
327 322
            DataDisplay();
328 323
        }
324

  
329 325
        #endregion
330 326

  
331 327
        #region ?S????R???{?{?b?N?X??X
332
        /// <summary>
333
        /// ?S?????X
334
        /// </summary>
335
        /// <param name="sender"></param>
336
        /// <param name="e"></param>
337
        private void cmbConstructionPerson_TextChanged(object sender, EventArgs e)
328
        private void cmbConstructionPerson_SelectedIndexChanged(object sender, EventArgs e)
338 329
        {
339 330
            if (m_initDataLoad) return;
340 331

  
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstractionList/FrmConstructionList.designer.cs
28 28
        /// </summary>
29 29
        private void InitializeComponent()
30 30
        {
31
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
32
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
33
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
34
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
35
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
36
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
37
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
38
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
39
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
40
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
41
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
42
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
43
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
31
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle();
32
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle();
33
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle39 = new System.Windows.Forms.DataGridViewCellStyle();
34
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle29 = new System.Windows.Forms.DataGridViewCellStyle();
35
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle30 = new System.Windows.Forms.DataGridViewCellStyle();
36
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle31 = new System.Windows.Forms.DataGridViewCellStyle();
37
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle32 = new System.Windows.Forms.DataGridViewCellStyle();
38
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle33 = new System.Windows.Forms.DataGridViewCellStyle();
39
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle34 = new System.Windows.Forms.DataGridViewCellStyle();
40
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle35 = new System.Windows.Forms.DataGridViewCellStyle();
41
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle36 = new System.Windows.Forms.DataGridViewCellStyle();
42
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle37 = new System.Windows.Forms.DataGridViewCellStyle();
43
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle38 = new System.Windows.Forms.DataGridViewCellStyle();
44 44
            this.btnDataEntry = new System.Windows.Forms.Button();
45 45
            this.btnEnd = new System.Windows.Forms.Button();
46 46
            this.label1 = new System.Windows.Forms.Label();
......
239 239
            this.cmbConstructionPerson.Name = "cmbConstructionPerson";
240 240
            this.cmbConstructionPerson.Size = new System.Drawing.Size(200, 23);
241 241
            this.cmbConstructionPerson.TabIndex = 2;
242
            this.cmbConstructionPerson.TextChanged += new System.EventHandler(this.cmbConstructionPerson_TextChanged);
242
            this.cmbConstructionPerson.SelectedIndexChanged += new System.EventHandler(this.cmbConstructionPerson_SelectedIndexChanged);
243 243
            // 
244 244
            // cmbDepartment
245 245
            // 
......
251 251
            this.cmbDepartment.Name = "cmbDepartment";
252 252
            this.cmbDepartment.Size = new System.Drawing.Size(200, 23);
253 253
            this.cmbDepartment.TabIndex = 1;
254
            this.cmbDepartment.TextChanged += new System.EventHandler(this.cmbDepartment_TextChanged);
254
            this.cmbDepartment.SelectedIndexChanged += new System.EventHandler(this.cmbDepartment_SelectedIndexChanged);
255 255
            // 
256 256
            // label2
257 257
            // 
......
310 310
            this.dgvMaster.AllowUserToDeleteRows = false;
311 311
            this.dgvMaster.AllowUserToResizeColumns = false;
312 312
            this.dgvMaster.AllowUserToResizeRows = false;
313
            dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
314
            this.dgvMaster.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
313
            dataGridViewCellStyle27.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
314
            this.dgvMaster.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle27;
315 315
            this.dgvMaster.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
316 316
            | System.Windows.Forms.AnchorStyles.Left) 
317 317
            | System.Windows.Forms.AnchorStyles.Right)));
318 318
            this.dgvMaster.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
319 319
            this.dgvMaster.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
320
            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
321
            dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
322
            dataGridViewCellStyle2.Font = new System.Drawing.Font("MS 明朝", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
323
            dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
324
            dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
325
            dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
326
            dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
327
            this.dgvMaster.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
320
            dataGridViewCellStyle28.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
321
            dataGridViewCellStyle28.BackColor = System.Drawing.SystemColors.Control;
322
            dataGridViewCellStyle28.Font = new System.Drawing.Font("MS 明朝", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
323
            dataGridViewCellStyle28.ForeColor = System.Drawing.SystemColors.WindowText;
324
            dataGridViewCellStyle28.SelectionBackColor = System.Drawing.SystemColors.Highlight;
325
            dataGridViewCellStyle28.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
326
            dataGridViewCellStyle28.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
327
            this.dgvMaster.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle28;
328 328
            this.dgvMaster.ColumnHeadersHeight = 24;
329 329
            this.dgvMaster.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
330 330
            this.dgvMaster.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
......
339 339
            this.Column3,
340 340
            this.Column2,
341 341
            this.Column11});
342
            dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
343
            dataGridViewCellStyle13.BackColor = System.Drawing.SystemColors.Window;
344
            dataGridViewCellStyle13.Font = new System.Drawing.Font("MS 明朝", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
345
            dataGridViewCellStyle13.ForeColor = System.Drawing.SystemColors.ControlText;
346
            dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.LightSeaGreen;
347
            dataGridViewCellStyle13.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
348
            dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
349
            this.dgvMaster.DefaultCellStyle = dataGridViewCellStyle13;
342
            dataGridViewCellStyle39.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
343
            dataGridViewCellStyle39.BackColor = System.Drawing.SystemColors.Window;
344
            dataGridViewCellStyle39.Font = new System.Drawing.Font("MS 明朝", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
345
            dataGridViewCellStyle39.ForeColor = System.Drawing.SystemColors.ControlText;
346
            dataGridViewCellStyle39.SelectionBackColor = System.Drawing.Color.LightSeaGreen;
347
            dataGridViewCellStyle39.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
348
            dataGridViewCellStyle39.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
349
            this.dgvMaster.DefaultCellStyle = dataGridViewCellStyle39;
350 350
            this.dgvMaster.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
351 351
            this.dgvMaster.Location = new System.Drawing.Point(10, 103);
352 352
            this.dgvMaster.MultiSelect = false;
......
362 362
            // 
363 363
            // Column1
364 364
            // 
365
            dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
366
            this.Column1.DefaultCellStyle = dataGridViewCellStyle3;
365
            dataGridViewCellStyle29.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
366
            this.Column1.DefaultCellStyle = dataGridViewCellStyle29;
367 367
            this.Column1.Frozen = true;
368 368
            this.Column1.HeaderText = "№";
369 369
            this.Column1.Name = "Column1";
......
374 374
            // 
375 375
            // Column9
376 376
            // 
377
            dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
378
            this.Column9.DefaultCellStyle = dataGridViewCellStyle4;
377
            dataGridViewCellStyle30.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
378
            this.Column9.DefaultCellStyle = dataGridViewCellStyle30;
379 379
            this.Column9.Frozen = true;
380 380
            this.Column9.HeaderText = "営業部署";
381 381
            this.Column9.Name = "Column9";
......
385 385
            // 
386 386
            // Column5
387 387
            // 
388
            dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
389
            this.Column5.DefaultCellStyle = dataGridViewCellStyle5;
388
            dataGridViewCellStyle31.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
389
            this.Column5.DefaultCellStyle = dataGridViewCellStyle31;
390 390
            this.Column5.Frozen = true;
391 391
            this.Column5.HeaderText = "営業担当者";
392 392
            this.Column5.Name = "Column5";
......
397 397
            // 
398 398
            // Column10
399 399
            // 
400
            dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
401
            this.Column10.DefaultCellStyle = dataGridViewCellStyle6;
400
            dataGridViewCellStyle32.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
401
            this.Column10.DefaultCellStyle = dataGridViewCellStyle32;
402 402
            this.Column10.Frozen = true;
403 403
            this.Column10.HeaderText = "工事部署";
404 404
            this.Column10.Name = "Column10";
......
408 408
            // 
409 409
            // Column6
410 410
            // 
411
            dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
412
            this.Column6.DefaultCellStyle = dataGridViewCellStyle7;
411
            dataGridViewCellStyle33.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
412
            this.Column6.DefaultCellStyle = dataGridViewCellStyle33;
413 413
            this.Column6.Frozen = true;
414 414
            this.Column6.HeaderText = "工事担当者";
415 415
            this.Column6.Name = "Column6";
......
420 420
            // 
421 421
            // Column4
422 422
            // 
423
            dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
424
            this.Column4.DefaultCellStyle = dataGridViewCellStyle8;
423
            dataGridViewCellStyle34.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
424
            this.Column4.DefaultCellStyle = dataGridViewCellStyle34;
425 425
            this.Column4.Frozen = true;
426 426
            this.Column4.HeaderText = "工 事 名 称";
427 427
            this.Column4.Name = "Column4";
......
432 432
            // 
433 433
            // Column7
434 434
            // 
435
            dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
436
            this.Column7.DefaultCellStyle = dataGridViewCellStyle9;
435
            dataGridViewCellStyle35.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
436
            this.Column7.DefaultCellStyle = dataGridViewCellStyle35;
437 437
            this.Column7.Frozen = true;
438 438
            this.Column7.HeaderText = "施工状態";
439 439
            this.Column7.Name = "Column7";
......
444 444
            // 
445 445
            // Column8
446 446
            // 
447
            dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
448
            this.Column8.DefaultCellStyle = dataGridViewCellStyle10;
447
            dataGridViewCellStyle36.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
448
            this.Column8.DefaultCellStyle = dataGridViewCellStyle36;
449 449
            this.Column8.Frozen = true;
450 450
            this.Column8.HeaderText = "印刷";
451 451
            this.Column8.Name = "Column8";
......
456 456
            // 
457 457
            // Column3
458 458
            // 
459
            dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
460
            this.Column3.DefaultCellStyle = dataGridViewCellStyle11;
459
            dataGridViewCellStyle37.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
460
            this.Column3.DefaultCellStyle = dataGridViewCellStyle37;
461 461
            this.Column3.Frozen = true;
462 462
            this.Column3.HeaderText = "営業期";
463 463
            this.Column3.Name = "Column3";
......
469 469
            // 
470 470
            // Column2
471 471
            // 
472
            dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
473
            this.Column2.DefaultCellStyle = dataGridViewCellStyle12;
472
            dataGridViewCellStyle38.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
473
            this.Column2.DefaultCellStyle = dataGridViewCellStyle38;
474 474
            this.Column2.Frozen = true;
475 475
            this.Column2.HeaderText = "工事コード";
476 476
            this.Column2.Name = "Column2";
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBaseInfo/DataChange.cs
398 398
                strSQL += " LEFT JOIN PERSONINCHARGEMASTER D ON D.PERSONCODE = A.CONSTRUCTIONINSTRUCTOR";
399 399
                strSQL += " , PERSONINCHARGEMASTER B";
400 400
                strSQL += string.Format(" LEFT JOIN DEPARTMENTEXPENSESMASTER E ON E.DEPARTMENTCODE = B.DEPARTMENTCODE AND E.EXPENSESPERIOD = {0} AND E.NAMECODE = 3", ConstrPeriod);
401
                strSQL += string.Format(" LEFT JOIN DIVISIONMASTER E1 ON E1.DIVISIONCODE = {0} AND E1.NAMECODE = E.NAMECODE", (int)CommonDefine.DivisionMasterCodeDefine.ConstructionExpenses);
401
                strSQL += string.Format(" LEFT JOIN DIVISIONMASTER E1 ON E1.DIVISIONCODE = {0} AND E1.NAMECODE = E.NAMECODE", (int)DivisionMaster.DivisionMasterCodeDefine.ConstructionExpenses);
402 402
                strSQL += string.Format(" LEFT JOIN DEPARTMENTEXPENSESMASTER F ON F.DEPARTMENTCODE = B.DEPARTMENTCODE AND F.EXPENSESPERIOD = {0} AND F.NAMECODE = 1", ConstrPeriod);
403
                strSQL += string.Format(" LEFT JOIN DIVISIONMASTER F1 ON F1.DIVISIONCODE = {0} AND F1.NAMECODE = F.NAMECODE", (int)CommonDefine.DivisionMasterCodeDefine.ConstructionExpenses);
403
                strSQL += string.Format(" LEFT JOIN DIVISIONMASTER F1 ON F1.DIVISIONCODE = {0} AND F1.NAMECODE = F.NAMECODE", (int)DivisionMaster.DivisionMasterCodeDefine.ConstructionExpenses);
404 404
                strSQL += string.Format(" LEFT JOIN DEPARTMENTEXPENSESMASTER G ON G.DEPARTMENTCODE = B.DEPARTMENTCODE AND G.EXPENSESPERIOD = {0} AND G.NAMECODE = 2", ConstrPeriod);
405
                strSQL += string.Format(" LEFT JOIN DIVISIONMASTER G1 ON G1.DIVISIONCODE = {0} AND G1.NAMECODE = G.NAMECODE", (int)CommonDefine.DivisionMasterCodeDefine.ConstructionExpenses);
405
                strSQL += string.Format(" LEFT JOIN DIVISIONMASTER G1 ON G1.DIVISIONCODE = {0} AND G1.NAMECODE = G.NAMECODE", (int)DivisionMaster.DivisionMasterCodeDefine.ConstructionExpenses);
406 406
                strSQL += string.Format(" WHERE A.CONSTRUCTIONCODE = {0}", ConstrCode);
407 407
                strSQL += " AND B.PERSONCODE = A.CONSTRUCTIONPERSONCODE";
408 408
            }
......
614 614
                strSQL += " LEFT OUTER JOIN";
615 615
                strSQL += string.Format(" (SELECT NAMECODE, DEPARTMENTCODE, EXPENSESRAITO FROM DEPARTMENTEXPENSESMASTER WHERE DEPARTMENTCODE = {0}) B", DepartmentCode);
616 616
                strSQL += " ON A.NAMECODE = B.NAMECODE";
617
                strSQL += string.Format(" WHERE A.DIVISIONCODE = {0}", (int)CommonDefine.DivisionMasterCodeDefine.ConstructionExpenses);
617
                strSQL += string.Format(" WHERE A.DIVISIONCODE = {0}", (int)DivisionMaster.DivisionMasterCodeDefine.ConstructionExpenses);
618 618
                strSQL += " ORDER BY A.DISPLAYORDER";
619 619
                if (!expDB.ExecuteReader(strSQL, ref ExpensesList)) return false;
620 620
                if (ExpensesList.Count == 0) return false;
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBaseInfo/FrmConstructionBaseInfoAuxiliary.cs
2470 2470
                // Value????Key??????
2471 2471
                //string DivisionName = CommonDefine.DivisionMasterCode[1];
2472 2472
                //int DivisionCode = CommonDefine.DivisionMasterCode.First(x => x.Value == DivisionName).Key;
2473
                string strSQL = dvDB.CreatePrimarykeyString((int)CommonDefine.DivisionMasterCodeDefine.OrderDivision) + " And DeleteFlg = 0 ORDER BY DISPLAYORDER";
2473
                string strSQL = dvDB.CreatePrimarykeyString((int)DivisionMaster.DivisionMasterCodeDefine.OrderDivision) + " And DeleteFlg = 0 ORDER BY DISPLAYORDER";
2474 2474
                if (!dvDB.SelectAction(strSQL, ref bvList)) return;
2475 2475
                if (bvList.Count == 0) return;
2476 2476

  
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBudget/FrmConstructionBudgetAuxiliary.cs
254 254
                strSQL += string.Format(" FROM DEPARTMENTEXPENSESMASTER WHERE DEPARTMENTCODE = {0}) B", picRec.DepartmentCode);
255 255
                strSQL += " ON A.NAMECODE = B.NAMECODE";
256 256
                strSQL += string.Format(" AND B.EXPENSESPERIOD = {0}", m_ConstructionBaseInfo.ConstructionPeriod);
257
                strSQL += string.Format(" WHERE A.DIVISIONCODE = {0}", (int)CommonDefine.DivisionMasterCodeDefine.ConstructionExpenses);
257
                strSQL += string.Format(" WHERE A.DIVISIONCODE = {0}", (int)DivisionMaster.DivisionMasterCodeDefine.ConstructionExpenses);
258 258
                strSQL += " ORDER BY A.DISPLAYORDER";
259 259
                if (!expDB.ExecuteReader(strSQL, ref m_ExpensesList)) return false;
260 260
                if (m_ExpensesList.Count == 0) return false;
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionJoin/FrmJoinSelect.cs
260 260
                string strSQL = "SELECT A.NAMESTRING, B.ORDERERSNAME1, B.ORDERERSNAME2";
261 261
                strSQL += " FROM DIVISIONMASTER A, ORDERERSMASTER B";
262 262
                strSQL += string.Format(" WHERE (A.DIVISIONCODE = {0} AND A.NAMECODE = {1})"
263
                                        , (int)CommonDefine.DivisionMasterCodeDefine.OrderDivision
263
                                        , (int)DivisionMaster.DivisionMasterCodeDefine.OrderDivision
264 264
                                        , m_OrderersDivision);
265 265
                strSQL += string.Format(" AND B.ORDERCOTEGORY = A.NAMECODE AND B.ORDERERSCODE = {0}", m_OrdererCode);
266 266
                ArrayList arList = new ArrayList();
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedger/FrmConstructionLedgerAuxiliary.cs
122 122
                strSQL += string.Format(" FROM DEPARTMENTEXPENSESMASTER WHERE DEPARTMENTCODE = {0}) B", picRec.DepartmentCode);
123 123
                strSQL += " ON A.NAMECODE = B.NAMECODE";
124 124
                strSQL += string.Format(" AND B.EXPENSESPERIOD = {0}", m_ConstructionBaseInfo.ConstructionPeriod);
125
                strSQL += string.Format(" WHERE A.DIVISIONCODE = {0}", (int)CommonDefine.DivisionMasterCodeDefine.ConstructionExpenses);
125
                strSQL += string.Format(" WHERE A.DIVISIONCODE = {0}", (int)DivisionMaster.DivisionMasterCodeDefine.ConstructionExpenses);
126 126
                strSQL += " ORDER BY A.DISPLAYORDER";
127 127
                if (!expDB.ExecuteReader(strSQL, ref m_ExpensesList)) return false;
128 128
                if (m_ExpensesList.Count == 0) return false;
......
1595 1595
            IOConstructionBudgetDetail DetailDB = new IOConstructionBudgetDetail();
1596 1596
            try
1597 1597
            {
1598
                int DivCode = CommonDefine.DivisionMasterCode.First(x => x.Value.Equals("工事経費名称登録")).Key;
1598
                int DivCode = DivisionMaster.DivisionMasterCode.First(x => x.Value.Equals("工事経費名称登録")).Key;
1599 1599
                string strSQL = "SELECT B.NAMESTRING, A.AMOUNTCONFIGRATE, A.COMPONENTCODE";
1600 1600
                strSQL += " FROM CONSTRUCTIONBUDGETDETAIL A, DIVISIONMASTER B";
1601 1601
                strSQL += DetailDB.CreatePrimarykeyString(m_ConstructionCode, (int)FrmConstructionBudget.DataGroup.Expenses, 0, "A");
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/CreateLedgerSQL.cs
1
using System;
2
using System.Collections.Generic;
3
using System.ComponentModel;
4
using System.Data;
5
using System.Drawing;
6
using System.Linq;
7
using System.Text;
8
using System.Windows.Forms;
9
using System.Collections;
10
using System.Diagnostics;
11
using System.Threading;
12

  
13
using log4net;
14
using log4net.Appender;
15
using log4net.Repository.Hierarchy;
16

  
17
using ProcessManagement.Common;
18
using ProcessManagement.DB.IOAccess;
19
using ProcessManagement.DataModel;
20
using ProcessManagement.DB.Core;
21
using ProcessManagement.Forms.CustomControls;
22
using ProcessManagement.Forms.ControlsAction;
23
using ProcessManagement.Forms.SubForms;
24
//*---------------------------- 台帳データ取得SQL作成クラス -------------------*
25
//  2017/08/21  Ver1.0.0.0      Create Source           
26
//
27
//
28
//
29
//*----------------------------------------------------------------------------*
30

  
31
namespace ProcessManagement.Forms.DataEntry
32
{
33
    /// <summary>
34
    /// 台帳データ取得SQL作成クラス
35
    /// </summary>
36
    public static class CreateLedgerSQL
37
    {
38
        #region ログ定義
39
        /// <summary>
40
        /// log4netログを使用する
41
        /// </summary>
42
        private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
43
        #endregion
44

  
45
        #region 期間データ取得順
46
        /// <summary>
47
        /// 期間データ取得順
48
        /// </summary>
49
        public enum GetPersonTerm
50
        {
51
            DepartmentCode = 0,
52
            /// <summary>
53
            /// 担当者コード
54
            /// </summary>
55
            PersonCode,
56
            /// <summary>
57
            /// 担当者名
58
            /// </summary>
59
            Personname,
60
            /// <summary>
61
            /// 表示順
62
            /// </summary>
63
            Displayorder,
64
            /// <summary>
65
            /// 月額給与
66
            /// </summary>
67
            MonthlySalary,
68
            /// <summary>
69
            /// 契約工期開始
70
            /// </summary>
71
            StartDate,
72
            /// <summary>
73
            /// 契約工期終了
74
            /// </summary>
75
            CompDate,
76
            /// <summary>
77
            /// 雇用開始日付
78
            /// </summary>
79
            HireStartDays,
80
            /// <summary>
81
            /// 雇用終了日付
82
            /// </summary>
83
            HireCompDays,
84
        }
85
        #endregion
86

  
87
        #region 部署内の担当者コードを一覧で返す
88
        /// <summary>
89
        /// 部署内の担当者コードを一覧で返す
90
        /// </summary>
91
        public static int GetPersonInDepartment(int BusinessPeriod, int DepartmentCode, int PersonCode, ref ArrayList TargetList)
92
        {
93
            IOMPersonInCharge PersonDB = new IOMPersonInCharge();
94
            try
95
            {
96
                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("非 受 注")).Key;
97

  
98
                StringBuilder strSQL = new StringBuilder();
99

  
100
                DateTime dtDefaultStart = DateTime.MinValue;
101
                DateTime dtDefaultEnd = DateTime.MinValue;
102
                CreateDefaultStartAndEndDate(BusinessPeriod, ref dtDefaultStart, ref dtDefaultEnd);
103
                strSQL.Append("Select");
104
                strSQL.Append(" Person.DepartmentCode");
105
                strSQL.Append(", Person.PersonCode");
106
                strSQL.Append(", Person.PersonName");
107
                strSQL.Append(", Person.DisplayOrder");
108
                strSQL.Append(", Person.MonthlySalary");
109
                strSQL.Append(", Detail.SDate");
110
                strSQL.Append(", Detail.EDate");
111
                strSQL.Append(", Person.StartDate");
112
                strSQL.Append(", Person.EndDate");
113
                strSQL.Append(" From");
114
                strSQL.Append(" personinchargemaster As Person");
115
                strSQL.Append(" Left Join (Select");
116
                strSQL.Append(" Ledger.PersonCode AS PersonCode");
117
                strSQL.Append(" , MIN(Ledger.Start0) As SDate");
118
                strSQL.Append(" , MAX(Ledger.Comp0) AS EDate");
119
                strSQL.Append(" From");
120
                strSQL.Append(" (Select");
121
                strSQL.Append(" LDetail.CompanyCode As PersonCode");
122
                strSQL.Append(", Ledger.ConstructionStart As Start0");
123
                strSQL.Append(", Ledger.ConstructionEnd As Comp0");
124
                strSQL.Append(", LDetail.GROUPCOUNT");
125
                strSQL.Append(", LDetail.ConstructionCode");
126
                strSQL.Append(" From");
127
                strSQL.Append(" constructionledgerdetail As LDetail");
128
                strSQL.Append(" Inner Join constructionledger As Ledger On Ledger.ConstructionCode = LDetail.ConstructionCode");
129
                strSQL.Append(", constructionbaseinfo As Base");
130
                strSQL.Append(" Where");
131
                strSQL.AppendFormat(" LDetail.GroupCount IN ({0}, {1}, {2})"
132
                                , (int)FrmConstructionLedger.DataGroup.Instructor
133
                                , (int)FrmConstructionLedger.DataGroup.Assistant
134
                                , (int)FrmConstructionLedger.DataGroup.Payroll);
135
                strSQL.Append(" And LDetail.CompanyCode <> 0");
136
                strSQL.Append(" And Base.ConstructionCode = LDetail.ConstructionCode");
137
                strSQL.AppendFormat(" And Base.ConstructionStatusFlg <> {0}", NotOrder);
138
                strSQL.AppendFormat(" And Base.ConstructionPeriod = {0}) As Ledger", BusinessPeriod);
139
                strSQL.Append(" Group By Ledger.PersonCode) As Detail");
140
                strSQL.Append(" ON Detail.PersonCode = Person.PersonCode");
141
                strSQL.AppendFormat(" Where Person.LEDGERFLG = {0}", (int)CommonDefine.PersonLedgerDivNo.CalcTarget);
142

  
143
                if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode)
144
                {
145
                    strSQL.Append(" AND Person.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
146
                    strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
147
                }
148

  
149
                // 工事台帳データの部署だけが対象
150
                if (DepartmentCode == 0)
151
                {
152
                    strSQL.Append(" AND Person.DEPARTMENTCODE IN");
153
                    strSQL.Append(" (SELECT AA.DEPARTMENTCODE FROM (SELECT A.DEPARTMENTCODE, A.DEPARTMENTSTRING, A.DISPLAYORDER, COUNT(*) CNT");
154
                    strSQL.Append(" FROM DEPARTMENTMASTER A, PERSONINCHARGEMASTER B, CONSTRUCTIONBASEINFO C , CONSTRUCTIONLEDGERDETAIL D");
155
                    strSQL.Append(" WHERE A.DELETEFLG = 0");
156
                    strSQL.Append(" AND A.DEPARTMENTCODE = B.DEPARTMENTCODE");
157
                    strSQL.Append(" AND B.PERSONCODE = C.CONSTRUCTIONPERSONCODE");
158
                    strSQL.Append(" AND D.CONSTRUCTIONCODE = C.CONSTRUCTIONCODE");
159

  
160
                    strSQL.Append(" GROUP BY A.DEPARTMENTCODE, A.DEPARTMENTSTRING, A.DISPLAYORDER) AA)");
161
                }
162
                else
163
                {
164
                    // 部署コード選択時は部署を検索条件へ入れる
165
                    strSQL.AppendFormat(" AND Person.DEPARTMENTCODE = {0}", DepartmentCode);
166
                }
167
                if (PersonCode != 0) strSQL.AppendFormat(" AND Person.PERSONCODE = {0}", PersonCode);
168

  
169
                strSQL.AppendFormat(" And ((DATE(Person.StartDate) <= DATE ('{0}') And DATE (Person.EndDate) = DATE ('{1}'))"
170
                                    , dtDefaultStart.ToShortDateString()
171
                                    , DateTime.MinValue.ToShortDateString());
172

  
173
                strSQL.AppendFormat(" Or (DATE('{0}') <= DATE(Person.StartDate) And DATE(Person.StartDate) <= DATE('{1}'))"
174
                                    , dtDefaultStart.ToShortDateString()
175
                                    , dtDefaultEnd.ToShortDateString());
176

  
177
                strSQL.AppendFormat(" Or (DATE('{0}') <= DATE(Person.EndDate) And DATE(Person.EndDate) <= DATE('{1}')))"
178
                                    , dtDefaultStart.ToShortDateString()
179
                                    , dtDefaultEnd.ToShortDateString());
180

  
181
                strSQL.AppendFormat(" ORDER BY Person.EmployeeClassFlg, Person.DISPLAYORDER");
182

  
183
                if (!PersonDB.ExecuteReader(strSQL.ToString(), ref TargetList)) return 0;
184

  
185
                return TargetList.Count;
186
            }
187
            catch (Exception ex)
188
            {
189
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
190
                return 0;
191
            }
192
            finally
193
            {
194
                PersonDB.close(); PersonDB = null;
195
            }
196
        }
197
        #endregion
198

  
199
        #region デフォルトの期首日・期末日を求める
200
        /// <summary>
201
        /// デフォルトの期首日・期末日を求める
202
        /// </summary>
203
        /// <param name="dtStart"></param>
204
        /// <param name="dtEnd"></param>
205
        public static void CreateDefaultStartAndEndDate(int BusinessPeriod, ref DateTime dtStart, ref DateTime dtEnd)
206
        {
207
            try
208
            {
209
                // 当期期首年月日を取得
210
                int iYear = 0;
211
                int month = 0;
212
                int day = 0;
213
                bool bPeriod = false;
214
                if (CommonMotions.SystemMasterData.ConstructionNoBase == (int)CommonDefine.SystemConstructionNoBase.BusinessPeriod)
215
                {   // 営業期
216
                    iYear = CommonMotions.PeriodCountToYear(BusinessPeriod);
217
                    bPeriod = true;
218
                }
219
                else
220
                {   // 工事年度
221
                    iYear = CommonMotions.SystemMasterData.ConstructionYear;
222
                }
223
                CommonMotions.GetBeginningMonthDay(bPeriod, ref month, ref day);
224
                dtStart = new DateTime(iYear, month, day);
225
                dtEnd = dtStart.AddYears(1).AddDays(-1);     // 終了は+1年-1日
226
            }
227
            catch (Exception ex)
228
            {
229
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
230
            }
231
        }
232
        #endregion
233

  
234
        #region 計算開始・終了日のチェック入れ替え
235
        /// <summary>
236
        /// 計算開始・終了日のチェック入れ替え
237
        /// </summary>
238
        public static void CalcStartCompDate(int BusinessPeriod,
239
                                        DateTime dtDefaultStart, DateTime dtDefaultEnd,
240
                                        DateTime HireStartDate, DateTime HireCompDate,
241
                                        ref DateTime StartDate, ref DateTime CompDate)
242
        {
243
            try
244
            {
245
                if (StartDate == DateTime.MinValue)
246
                {
247
                    StartDate = dtDefaultStart;
248
                }
249
                else if (dtDefaultStart <= HireStartDate && HireStartDate <= dtDefaultEnd)
250
                {
251
                    StartDate = HireStartDate;
252
                }
253
                else if (dtDefaultStart < StartDate)
254
                {
255
                    StartDate = dtDefaultStart;
256
                }
257

  
258
                // 最大日が今日より小さい場合以外は処理しない
259
                if (CompDate.Date > DateTime.Today.Date) return;
260

  
261
                if (BusinessPeriod != CommonMotions.SystemMasterData.BusinessPeriod)
262
                {   // 今期以外はは期末
263
                    CompDate = dtDefaultEnd;
264

  
265
                    // 退社日が期内ならば終了を退社日にする
266
                    if (dtDefaultStart < HireCompDate && HireCompDate < dtDefaultEnd) CompDate = HireCompDate;
267
                }
268
                else
269
                {   // 以外は今日
270
                    CompDate = DateTime.Today.Date;
271

  
272
                    // 退社日が期内ならば終了を退社日にする
273
                    if (dtDefaultStart < HireCompDate && HireCompDate < dtDefaultEnd) CompDate = HireCompDate;
274
                }
275
            }
276
            catch (Exception ex)
277
            {
278
                logger.ErrorFormat("システムエラー:{0}", ex.Message);
279
            }
280
        }
281
        #endregion
282

  
283
        #region 工事詳細台帳より振分給与金額・粗利益を取得する
284
        /// <summary>
285
        /// 工事詳細台帳より振分給与金額・粗利益を取得する
286
        /// </summary>
287
        public static void ProfitGeneral(IOConstructionLedger LedgerDB, int ConstructionPeriod,
288
                                            int DepartmentCode, int PersonCode, ref int OnSalary)
289
        {
290
            try
291
            {
292
                // 部署コード取得
293
                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("非 受 注")).Key;
294

  
295
                // 振分給与金額取得
296
                StringBuilder strSQL = new StringBuilder();
297
                //strSQL.Append("SELECT SUM(C.EXECUTIONAMOUNT) FROM");
298
                strSQL.Append("SELECT SUM(C2.PaymentAmount) FROM");
299
                strSQL.Append(" CONSTRUCTIONLEDGER P");
300
                strSQL.Append(", CONSTRUCTIONBASEINFO B");
301
                strSQL.Append(", CONSTRUCTIONLEDGERDETAIL C");
302
                strSQL.Append(" LEFT JOIN constructionledgerexcute C2");
303
                strSQL.Append(" ON C2.ConstructionCode = C.ConstructionCode");
304
                strSQL.Append(" And C2.GroupCount = C.GroupCount");
305
                strSQL.Append(" And C2.LineCount = C.LineCount");
306
                strSQL.Append(", PERSONINCHARGEMASTER D");
307
                // 振分無では無い
308
                strSQL.Append(" WHERE P.CONSTRUCTIONCODE IN (SELECT A.CONSTRUCTIONCODE FROM CONSTRUCTIONLEDGERDETAIL A");
309
                strSQL.AppendFormat(" WHERE A.GROUPCOUNT = {0} AND (A.SALARYFLG = {1} OR A.SALARYFLG = {2}))"
310
                                        , (int)FrmConstructionLedger.DataGroup.Payroll
311
                                        , (int)CommonDefine.SalaryDevision.All
312
                                        , (int)CommonDefine.SalaryDevision.DaysInput);
313

  
314
                strSQL.Append(" AND P.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE");
315
                strSQL.AppendFormat(" AND B.CONSTRUCTIONPERIOD = {0}", ConstructionPeriod);
316
                strSQL.AppendFormat(" AND B.CONSTRUCTIONSTATUSFLG != {0}", NotOrder);
317
                strSQL.Append(" AND C.CONSTRUCTIONCODE = P.CONSTRUCTIONCODE");
318
                strSQL.AppendFormat(" AND C.GROUPCOUNT = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
319
                strSQL.Append(" AND D.PERSONCODE = C.CompanyCode");
320

  
321
                if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode)
322
                {
323
                    strSQL.Append(" AND D.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
324
                    strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
325
                }
326

  
327
                if (DepartmentCode != 0) strSQL.AppendFormat(" AND D.DEPARTMENTCODE = {0}", DepartmentCode);
328
                if (PersonCode != 0) strSQL.AppendFormat(" AND D.PERSONCODE = {0}", PersonCode);
329

  
330
                ArrayList arList = new ArrayList();
331
                if (!LedgerDB.ExecuteReader(strSQL.ToString(), ref arList)) return;
332
                object[] objSalary = (object[])arList[0];
333
                OnSalary = CommonMotions.cnvInt(objSalary[0]);
334
            }
335
            catch (Exception ex)
336
            {
337
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
338
            }
339
        }
340
        #endregion 
341

  
342
        #region 担当者毎割当無費目毎の経費を取得する
343
        /// <summary>
344
        /// 担当者毎割当無費目毎の経費を取得する
345
        /// </summary>
346
        public static void GetPersonExpensesCostValue(IOCostDataOfPerson CostDB,
347
                                                        int DepartmentCode, int PersonCode,
348
                                                        DateTime dtStart, DateTime dtEnd,
349
                                                        ref int[] CostValue)
350
        {
351
            try
352
            {
353
                // 担当者毎経費データよりどこの工事にも所属していない経費を取得する
354
                StringBuilder strSQL = new StringBuilder();
355

  
356
                strSQL.Append(" SELECT");
357
                strSQL.Append(" PERSONCODE");
358
                strSQL.Append(", B.DATATYPE AS DATATYPE");
359
                strSQL.Append(", SUM(B.ENTRYPRICE) AS SUMPRICE");
360
                strSQL.Append(" FROM");
361
                strSQL.Append(" COSTDATAOFPERSON AS B");
362
                strSQL.Append(" WHERE");
363
                strSQL.Append(" B.PERSONCODE IN (SELECT BPerson.PERSONCODE FROM personinchargemaster As BPerson");
364
                strSQL.Append(" Where");
365
                
366
                StringBuilder strSub = new StringBuilder();
367
                if (DepartmentCode != 0) strSub.AppendFormat(" BPerson.DepartmentCode = {0})", DepartmentCode);
368
                if (PersonCode != 0)
369
                {
370
                    if (strSub.ToString().Length > 0) strSub.Append(" And");
371
                    strSub.AppendFormat(" BPerson.PersonCode = {0})", PersonCode);
372
                }
373
                strSQL.Append(strSub.ToString());
374

  
375
                strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(B.ACTIONDATE)", dtStart.ToShortDateString());
376
                strSQL.AppendFormat(" AND DATE(B.ACTIONDATE) <= DATE('{0}'))", dtEnd.ToShortDateString());
377
                strSQL.Append(" AND B.CONSTRUCTIONCODE = 0");
378
                strSQL.Append(" GROUP BY B.DATATYPE");
379

  
380
                ArrayList arList = new ArrayList();
381
                CostDB.ExecuteReader(strSQL.ToString(), ref arList);
382

  
383
                // 取得結果を振り分ける
384
                foreach (object[] wrkobj in arList)
385
                {
386
                    for (int i = 1; i < CommonDefine.CostDataNoString.Length; i++)
387
                    {
388
                        if (CommonMotions.cnvInt(wrkobj[1]) == i)
389
                        {
390
                            CostValue[i] += CommonMotions.cnvInt(wrkobj[2]);
391
                            break;
392
                        }
393
                    }
394
                }
395
            }
396
            catch (Exception ex)
397
            {
398
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
399
            }
400
        }
401
        #endregion
402

  
403
        #region 期間データ取得順 ※旧バージョン
404
        /// <summary>
405
        /// 期間データ取得順 ※旧バージョン
406
        /// </summary>
407
        private enum GetPersonTermOLD
408
        {
409
            DepartmentCode = 0,
410
            /// <summary>
411
            /// 担当者コード
412
            /// </summary>
413
            PersonCode,
414
            /// <summary>
415
            /// 担当者名
416
            /// </summary>
417
            Personname,
418
            /// <summary>
419
            /// 表示順
420
            /// </summary>
421
            Displayorder,
422
            /// <summary>
423
            /// 月額給与
424
            /// </summary>
425
            MonthlySalary,
426
            /// <summary>
427
            /// 雇用開始日付
428
            /// </summary>
429
            HireStartDays,
430
            /// <summary>
431
            /// 雇用終了日付
432
            /// </summary>
433
            HireCompDays,
434
            /// <summary>
435
            /// 担当者契約工期開始
436
            /// </summary>
437
            MainStart1,
438
            /// <summary>
439
            /// 担当者契約工期延長開始
440
            /// </summary>
441
            MainStart2,
442
            /// <summary>
443
            /// 副担当者契約工期開始
444
            /// </summary>
445
            AssistStart1,
446
            /// <summary>
447
            /// 副担当者契約工期延長開始
448
            /// </summary>
449
            AssistStart2,
450
            /// <summary>
451
            /// 指導員契約工期開始
452
            /// </summary>
453
            InstStart1,
454
            /// <summary>
455
            /// 指導員契約工期延長開始
456
            /// </summary>
457
            InstStart2,
458
            /// <summary>
459
            /// 担当者契約工期終了
460
            /// </summary>
461
            MainEnd1,
462
            /// <summary>
463
            /// 担当者契約工期延長終了
464
            /// </summary>
465
            MainEnd2,
466
            /// <summary>
467
            /// 副担当者契約工期終了
468
            /// </summary>
469
            AssistEnd1,
470
            /// <summary>
471
            /// 副担当者契約工期延長終了
472
            /// </summary>
473
            AssistEnd2,
474
            /// <summary>
475
            /// 指導員契約工期終了
476
            /// </summary>
477
            InstEnd1,
478
            /// <summary>
479
            /// 指導員契約工期延長終了
480
            /// </summary>
481
            InstEnd2,
482
            /// <summary>
483
            /// 担当者金額集計
484
            /// </summary>
485
            MainSumAmount,
486
            /// <summary>
487
            /// 副担当者金額集計
488
            /// </summary>
489
            AssistSumAmount,
490
            /// <summary>
491
            /// 指導員金額集計
492
            /// </summary>
493
            InstSumAmount,
494
            /// <summary>
495
            /// 担当者データ件数
496
            /// </summary>
497
            MainDataCount,
498
            /// <summary>
499
            /// 副担当者データ件数
500
            /// </summary>
501
            AssistDataCmount,
502
            /// <summary>
503
            /// 指導員データ件数
504
            /// </summary>
505
            InstDataCmount,
506
        }
507
        #endregion
508

  
509
        #region 部署内の担当者コードを一覧で返す ※旧バージョン
510
        /// <summary>
511
        /// 部署内の担当者コードを一覧で返す
512
        /// </summary>
513
        /// <param name="DepartmentCode">部署コード</param>
514
        /// <param name="PersonCodeList">担当者コード一覧</param>
515
        /// <returns>データ件数</returns>
516
        public static int GetPersonInDepartment_OLD(int BusinessPeriod, int DepartmentCode, int PersonCode, ref ArrayList TargetList)
517
        {
518
            IOMPersonInCharge PersonDB = new IOMPersonInCharge();
519
            try
520
            {
521
                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("非 受 注")).Key;
522

  
523
                StringBuilder strSQL = new StringBuilder();
524
                strSQL.Append("SELECT P.PERSONCODE, P.PERSONNAME, P.DISPLAYORDER, P.MonthlySalary,");
525
                strSQL.Append(" P.STARTDATE, P.ENDDATE,");
526
                strSQL.Append(" MIN(C.CONSTRUCTIONPERIODSTART) M1, MIN(C.CONSTRUCTIONPERIODSTART2) M2,");
527
                strSQL.Append(" MIN(D.CONSTRUCTIONPERIODSTART) S1, MIN(D.CONSTRUCTIONPERIODSTART2) S2,");
528
                strSQL.Append(" MIN(E.CONSTRUCTIONPERIODSTART) I1, MIN(E.CONSTRUCTIONPERIODSTART2) I2,");
529
                strSQL.Append(" MAX(C.CONSTRUCTIONPERIODEND) M3, MAX(C.CONSTRUCTIONPERIODEND2) M4,");
530
                strSQL.Append(" MAX(D.CONSTRUCTIONPERIODEND) S3, MAX(D.CONSTRUCTIONPERIODEND2) S4,");
531
                strSQL.Append(" MAX(E.CONSTRUCTIONPERIODEND) I3, MAX(E.CONSTRUCTIONPERIODEND2) I4,");
532
                strSQL.Append(" SUM(C.EXECUTIONAMOUNT) M5, SUM(D.EXECUTIONAMOUNT) S5, SUM(E.EXECUTIONAMOUNT) I5,");
533
                strSQL.Append(" COUNT(C.EXECUTIONAMOUNT) M6, COUNT(D.EXECUTIONAMOUNT) S6, COUNT(E.EXECUTIONAMOUNT) I6");
534
                strSQL.Append(" FROM PERSONINCHARGEMASTER P");
535

  
536
                // 工事担当者のデータ取得
537
                strSQL.Append(" LEFT JOIN (SELECT C1.CONSTRUCTIONPERSONCODE, C1.CONSTRUCTIONSTATUSFLG, C1.CONSTRUCTIONPERIOD");
538
                strSQL.Append(", C1.CONSTRUCTIONPERIODSTART, C1.CONSTRUCTIONPERIODSTART2, C1.CONSTRUCTIONPERIODEND, C1.CONSTRUCTIONPERIODEND2, C2.EXECUTIONAMOUNT");
539
                strSQL.Append(" FROM CONSTRUCTIONBASEINFO C1, CONSTRUCTIONLEDGERDETAIL C2, CONSTRUCTIONLEDGER C3");
540
                strSQL.Append(" WHERE C2.CONSTRUCTIONCODE = C1.CONSTRUCTIONCODE");
541
                strSQL.AppendFormat(" AND C2.GROUPCOUNT = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
542
                strSQL.Append(" AND C3.CONSTRUCTIONCODE = C2.CONSTRUCTIONCODE) C");
543
                strSQL.Append(" ON C.CONSTRUCTIONPERSONCODE = P.PERSONCODE");
544
                strSQL.AppendFormat(" AND C.CONSTRUCTIONSTATUSFLG <> {0}", NotOrder);
545
                strSQL.AppendFormat(" AND C.CONSTRUCTIONPERIOD = {0}", BusinessPeriod);
546

  
547
                // 工事副担当者のデータ取得
548
                strSQL.Append(" LEFT JOIN (SELECT D1.CONSTRSUBPERSONCODE CONSTRUCTIONPERSONCODE, D1.CONSTRUCTIONSTATUSFLG, D1.CONSTRUCTIONPERIOD");
549
                strSQL.Append(", D1.CONSTRUCTIONPERIODSTART, D1.CONSTRUCTIONPERIODSTART2, D1.CONSTRUCTIONPERIODEND, D1.CONSTRUCTIONPERIODEND2, D2.EXECUTIONAMOUNT");
550
                strSQL.Append(" FROM CONSTRUCTIONBASEINFO D1, CONSTRUCTIONLEDGERDETAIL D2, CONSTRUCTIONLEDGER D3");
551
                strSQL.Append(" WHERE D2.CONSTRUCTIONCODE = D1.CONSTRUCTIONCODE");
552
                strSQL.AppendFormat(" AND D2.GROUPCOUNT = {0}", (int)FrmConstructionLedger.DataGroup.Assistant);
553
                strSQL.Append(" AND D3.CONSTRUCTIONCODE = D2.CONSTRUCTIONCODE) D");
554
                strSQL.Append(" ON D.CONSTRUCTIONPERSONCODE = P.PERSONCODE");
555
                strSQL.AppendFormat(" AND D.CONSTRUCTIONSTATUSFLG <> {0}", NotOrder);
556
                strSQL.AppendFormat(" AND D.CONSTRUCTIONPERIOD = {0}", BusinessPeriod);
557

  
558
                // 工事指導員のデータ取得
559
                strSQL.Append(" LEFT JOIN (SELECT E1.CONSTRUCTIONINSTRUCTOR CONSTRUCTIONPERSONCODE, E1.CONSTRUCTIONSTATUSFLG, E1.CONSTRUCTIONPERIOD");
560
                strSQL.Append(", E1.CONSTRUCTIONPERIODSTART, E1.CONSTRUCTIONPERIODSTART2, E1.CONSTRUCTIONPERIODEND, E1.CONSTRUCTIONPERIODEND2, E2.EXECUTIONAMOUNT");
561
                strSQL.Append(" FROM CONSTRUCTIONBASEINFO E1, CONSTRUCTIONLEDGERDETAIL E2, CONSTRUCTIONLEDGER E3");
562
                strSQL.Append(" WHERE E2.CONSTRUCTIONCODE = E1.CONSTRUCTIONCODE");
563
                strSQL.AppendFormat(" AND E2.GROUPCOUNT = {0}", (int)FrmConstructionLedger.DataGroup.Instructor);
564
                strSQL.Append(" AND E3.CONSTRUCTIONCODE = E2.CONSTRUCTIONCODE) E");
565
                strSQL.Append(" ON E.CONSTRUCTIONPERSONCODE = P.PERSONCODE");
566
                strSQL.AppendFormat(" AND E.CONSTRUCTIONSTATUSFLG <> {0}", NotOrder);
567
                strSQL.AppendFormat(" AND E.CONSTRUCTIONPERIOD = {0}", BusinessPeriod);
568

  
569
                strSQL.AppendFormat(" WHERE P.LEDGERFLG = {0}", (int)CommonDefine.PersonLedgerDivNo.CalcTarget);
570

  
571
                // 当期期首日・期末日を取得
572
                DateTime dtDefaultStart = DateTime.MinValue;
573
                DateTime dtDefaultEnd = DateTime.MinValue;
574
                CreateDefaultStartAndEndDate(BusinessPeriod, ref dtDefaultStart, ref dtDefaultEnd);
575
                strSQL.AppendFormat(" AND (DATE(P.STARTDATE) <= STR_TO_DATE('{0}','%Y/%m/%d')", dtDefaultEnd.ToShortDateString());
576
                strSQL.AppendFormat(" AND (STR_TO_DATE('{0}','%Y/%m/%d') <= DATE(P.ENDDATE)", dtDefaultStart.ToShortDateString());
577
                strSQL.AppendFormat(" OR STR_TO_DATE('{0}','%Y/%m/%d') = DATE(P.ENDDATE)))", DateTime.MinValue.ToShortDateString());
578
                if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode)
579
                {
580
                    strSQL.Append(" AND P.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
581
                    strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
582
                }
583

  
584
                // 工事台帳データの部署だけが対象
585
                if (DepartmentCode == 0)
586
                {
587
                    strSQL.Append(" AND P.DEPARTMENTCODE IN");
588
                    strSQL.Append(" (SELECT TMP.DEPARTMENTCODE FROM (SELECT A.DEPARTMENTCODE, A.DEPARTMENTSTRING, A.DISPLAYORDER, COUNT(*) CNT");
589
                    strSQL.Append(" FROM DEPARTMENTMASTER A, PERSONINCHARGEMASTER B, CONSTRUCTIONBASEINFO C , CONSTRUCTIONLEDGERDETAIL D");
590
                    strSQL.Append(" WHERE A.DELETEFLG = 0");
591
                    strSQL.Append(" AND A.DEPARTMENTCODE = B.DEPARTMENTCODE");
592
                    strSQL.Append(" AND B.PERSONCODE = C.CONSTRUCTIONPERSONCODE");
593
                    strSQL.Append(" AND D.CONSTRUCTIONCODE = C.CONSTRUCTIONCODE");
594

  
595
                    strSQL.Append(" GROUP BY A.DEPARTMENTCODE, A.DEPARTMENTSTRING, A.DISPLAYORDER) TMP)");
596
                }
597
                else
598
                {
599
                    // 部署コード選択時は部署を検索条件へ入れる
600
                    strSQL.AppendFormat(" AND P.DEPARTMENTCODE = {0}", DepartmentCode);
601
                }
602
                if (PersonCode != 0) strSQL.AppendFormat(" AND P.PERSONCODE = {0}", PersonCode);
603

  
604
                strSQL.Append(" GROUP BY P.PERSONCODE, P.PERSONNAME, P.DISPLAYORDER, P.MonthlySalary, P.STARTDATE, P.ENDDATE");
605
                strSQL.Append(" ORDER BY P.DISPLAYORDER");
606

  
607
                ArrayList arList = new ArrayList();
608
                if (!PersonDB.ExecuteReader(strSQL.ToString(), ref arList)) return 0;
609

  
610
                DateTime stDate = DateTime.MaxValue;
611
                DateTime edDate = DateTime.MinValue;
612
                DateTime maxDate = DateTime.MinValue;
613
                foreach (object[] objRec in arList)
614
                {
615
                    stDate = DateTime.MaxValue;
616
                    edDate = DateTime.MinValue;
617
                    maxDate = DateTime.MinValue;
618

  
619
                    // 担当者コードを取得する
620
                    int Person = CommonMotions.cnvInt(objRec[(int)GetPersonTermOLD.PersonCode]);
621

  
622
                    DateTime wrkDate = DateTime.MinValue;
623
                    // 最小の開始日を取得する
624
                    //stDate = dtDefaultStart;
625
                    wrkDate = CommonMotions.cnvDate(objRec[(int)GetPersonTermOLD.MainStart1]).Date;
626
                    if (wrkDate != DateTime.MinValue && wrkDate < stDate) stDate = wrkDate;
627
                    wrkDate = CommonMotions.cnvDate(objRec[(int)GetPersonTermOLD.MainStart2]).Date;
628
                    if (wrkDate != DateTime.MinValue && wrkDate < stDate) stDate = wrkDate;
629

  
630
                    // 最大の終了日を取得する
631
                    //maxDate = dtDefaultEnd;
632
                    wrkDate = CommonMotions.cnvDate(objRec[(int)GetPersonTermOLD.MainEnd1]).Date;
633
                    if (wrkDate != DateTime.MinValue && wrkDate > maxDate) maxDate = wrkDate;
634
                    wrkDate = CommonMotions.cnvDate(objRec[(int)GetPersonTermOLD.MainEnd2]).Date;
635
                    if (wrkDate != DateTime.MinValue && wrkDate > maxDate) maxDate = wrkDate;
636

  
637
                    // 計算の終了日を取得する
638
                    //edDate = dtDefaultEnd;
639
                    // 月額給与を取得する
640
                    int Salary = CommonMotions.cnvInt(objRec[(int)GetPersonTermOLD.MonthlySalary]);
641

  
642
                    // 雇用開始・終了日を取得する
643
                    DateTime dtHireStDay = CommonMotions.cnvDate(objRec[(int)GetPersonTermOLD.HireStartDays]);
644
                    DateTime dtHireEdDay = CommonMotions.cnvDate(objRec[(int)GetPersonTermOLD.HireCompDays]);
645

  
646
                    TargetList.Add(new object[]{Person,         // 担当者コード
647
                                                stDate,         // 開始日
648
                                                edDate,         // 終了日
649
                                                maxDate,        // 最大終了日
650
                                                Salary,         // 給与金額
651
                                                DateTime.Now,
652
                                                DateTime.Now,
653
                                                dtHireStDay,    // 雇用開始日
654
                                                dtHireEdDay});  // 雇用終了日
655
                }
656
                return arList.Count;
657
            }
658
            catch (Exception ex)
659
            {
660
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
661
                return 0;
662
            }
663
            finally
664
            {
665
                PersonDB.close(); PersonDB = null;
666
            }
667
        }
668
        #endregion
669
    }
670
}
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/FrmConstructionLedgerListAuxiliary.cs
509 509
        }
510 510
        #endregion
511 511

  
512
        #region ?f?t?H???g???????E?????????????
513
        /// <summary>
514
        /// ?f?t?H???g???????E?????????????
515
        /// </summary>
516
        /// <param name="dtStart"></param>
517
        /// <param name="dtEnd"></param>
518
        private void CreateDefaultStartAndEndDate(ref DateTime dtStart, ref DateTime dtEnd)
519
        {
520
            try
521
            {
522
                // ????????N????????
523
                int iYear = 0;
524
                int month = 0;
525
                int day = 0;
526
                bool bPeriod = false;
527
                if (CommonMotions.SystemMasterData.ConstructionNoBase == (int)CommonDefine.SystemConstructionNoBase.BusinessPeriod)
528
                {   // ?c???
529
                    iYear = CommonMotions.PeriodCountToYear(CommonMotions.cnvInt(numUDConstPro.Value));
530
                    bPeriod = true;
531
                }
532
                else
533
                {   // ?H???N?x
534
                    iYear = CommonMotions.SystemMasterData.ConstructionYear;
535
                }
536
                CommonMotions.GetBeginningMonthDay(bPeriod, ref month, ref day);
537
                dtStart = new DateTime(iYear, month, day);
538
                dtEnd = dtStart.AddYears(1).AddDays(-1);     // ?I????{1?N?|1??
539
            }
540
            catch (Exception ex)
541
            {
542
                logger.ErrorFormat("?V?X?e???G???[?F{0}?F{1}", CommonMotions.GetMethodName(), ex.Message);
543
            }
544
        }
545
        #endregion
546

  
547 512
        #region ?H?????????????E?????????????
548 513
        /// <summary>
549 514
        /// ?H?????????????E?????????????
......
590 555
        /// <param name="dtStartArray"></param>
591 556
        /// <param name="dtCompArray"></param>
592 557
        /// <returns></returns>
593
        private int SetOtherCost(List<int> PersonCDArray, List<DateTime> dtStartArray, List<DateTime> dtCompArray,  List<DateTime> dtHireStDayArray)
558
        private int SetOtherCost(DateTime dtDefaultStart, DateTime dtDefaultEnd, ArrayList TargetList, IOCostDataOfPerson CostDB)
594 559
        {
595 560
            try
596 561
            {
597
                // ??????????E??????????
598
                DateTime dtDefaultStart = DateTime.MinValue;
599
                DateTime dtDefaultEnd = DateTime.MinValue;
600
                CreateDefaultStartAndEndDate(ref dtDefaultStart, ref dtDefaultEnd);
601

  
602 562
                int ArrayCount = Common.CommonDefine.CostDataNoString.Length;
603 563
                int[] CostValue = new int[ArrayCount];
604 564
                // ?\???G???A?N???A
605 565
                Array.Clear(CostValue, 0, CostValue.Length);
606 566

  
607 567
                // ???v???W?v????
608
                for (int ii = 0; ii < PersonCDArray.Count; ii++)
568
                DateTime stDate = DateTime.MaxValue;
569
                DateTime edDate = DateTime.MaxValue;
570
                // for (int ii = 0; ii < PersonCDArray.Count; ii++)
571
                foreach (object[] ObjRec in TargetList)
609 572
                {
610
                    // ?J?n?E?I??????????????f?t?H???g?????E???????g?p????
611
                    //if (dtStartArray[ii] == DateTime.MinValue || dtStartArray[ii] == DateTime.MaxValue) dtStartArray[ii] = dtDefaultStart;
612
                    //if (dtCompArray[ii] == DateTime.MinValue || dtCompArray[ii] == DateTime.MaxValue) dtCompArray[ii] = dtDefaultEnd;
613
                    // ?J?n?E?I??????????????f?t?H???g?????E???????g?p????
573
                    CreateLedgerSQL.CalcStartCompDate((int)numUDConstPro.Value,
574
                                                        dtDefaultStart, dtDefaultEnd,
575
                                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.HireStartDays]),
576
                                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.HireCompDays]),
577
                                                        ref stDate, ref edDate);
614 578

  
615
                    DateTime stDate = dtStartArray[ii];
616
                    DateTime edDate = dtCompArray[ii];
617
                    CalcStartCompDate(dtDefaultStart, dtDefaultEnd, dtHireStDayArray[ii], dtCompArray[ii], ref stDate, ref edDate);
618

  
619

  
620 579
                    // ?o???
621
                    //GetPersonExpensesCostValue(PersonCDArray[ii], dtStartArray[ii], dtCompArray[ii], ref CostValue);
622
                    GetPersonExpensesCostValue(PersonCDArray[ii], stDate, edDate, ref CostValue);
580
                    CreateLedgerSQL.GetPersonExpensesCostValue(CostDB, 0,
581
                                                CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]),
582
                                                dtDefaultStart, dtDefaultEnd, ref CostValue);
623 583
                }
624 584

  
625 585
                // ----- ?o???W?v
......
726 686
        }
727 687
        #endregion
728 688

  
729
        #region ????f?[?^????
730
        /// <summary>
731
        /// ????f?[?^????
732
        /// </summary>
733
        private enum GetPersonTerm
734
        {
735
            /// <summary>
736
            /// ?S????R?[?h
737
            /// </summary>
738
            Personcode = 0,
739
            /// <summary>
740
            /// ?S?????
741
            /// </summary>
742
            Personname,
743
            /// <summary>
744
            /// ?\????
745
            /// </summary>
746
            Displayorder,
747
            /// <summary>
748
            /// ???z???^
749
            /// </summary>
750
            MonthlySalary,
751
            /// <summary>
752
            /// ?S????_??H???J?n
753
            /// </summary>
754
            MainStart1,
755
            /// <summary>
756
            /// ?S????_??H???????J?n
757
            /// </summary>
758
            MainStart2,
759
            /// <summary>
760
            /// ???S????_??H???J?n
761
            /// </summary>
762
            AssistStart1,
763
            /// <summary>
764
            /// ???S????_??H???????J?n
765
            /// </summary>
766
            AssistStart2,
767
            /// <summary>
768
            /// ?w?????_??H???J?n
769
            /// </summary>
770
            InstStart1,
771
            /// <summary>
772
            /// ?w?????_??H???????J?n
773
            /// </summary>
774
            InstStart2,
775
            /// <summary>
776
            /// ?S????_??H???I??
777
            /// </summary>
778
            MainEnd1,
779
            /// <summary>
780
            /// ?S????_??H???????I??
781
            /// </summary>
782
            MainEnd2,
783
            /// <summary>
784
            /// ???S????_??H???I??
785
            /// </summary>
786
            AssistEnd1,
787
            /// <summary>
788
            /// ???S????_??H???????I??
789
            /// </summary>
790
            AssistEnd2,
791
            /// <summary>
792
            /// ?w?????_??H???I??
793
            /// </summary>
794
            InstEnd1,
795
            /// <summary>
796
            /// ?w?????_??H???????I??
797
            /// </summary>
798
            InstEnd2,
799
            /// <summary>
800
            /// ?S??????z?W?v
801
            /// </summary>
802
            MainSumAmount,
803
            /// <summary>
804
            /// ???S??????z?W?v
805
            /// </summary>
806
            AssistSumAmount,
807
            /// <summary>
808
            /// ?w???????z?W?v
809
            /// </summary>
810
            InstSumAmount,
811
            /// <summary>
812
            /// ?S????f?[?^????
813
            /// </summary>
814
            MainDataCount,
815
            /// <summary>
816
            /// ???S????f?[?^????
817
            /// </summary>
818
            AssistDataCmount,
819
            /// <summary>
820
            /// ?w?????f?[?^????
821
            /// </summary>
822
            InstDataCmount,
823
            /// <summary>
824
            /// ??p?J?n???t
825
            /// </summary>
826
            HireStartDays,
827
            /// <summary>
828
            /// ??p?I?????t
829
            /// </summary>
830
            HireCompDays,
831
        }
832
        #endregion
833

  
834
        #region ????????S????R?[?h????????
835
        /// <summary>
836
        /// ????????S????R?[?h????????
837
        /// </summary>
838
        /// <param name="DepartmentCode">?????R?[?h</param>
839
        /// <param name="PersonCodeList">?S????R?[?h??</param>
840
        /// <returns>?f?[?^????</returns>
841
        private int GetPersonInDepartment(ref List<int> PersonCodeList, ref List<DateTime> dtStartList,
842
                                            ref List<DateTime> dtCompList, ref List<DateTime> dtMaxComp,
843
                                            ref List<int> MonthSalaryList, ref List<DateTime> dtHireStDays, ref List<DateTime> dtHireEdDays)
844
        {
845
            IOMPersonInCharge PersonDB = new IOMPersonInCharge();
846
            try
847
            {
848
                int DepartmentCode = GetDepartmentCode();
849
                int PersonCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
850
                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("?? ?? ??")).Key;
851

  
852
                StringBuilder strSQL = new StringBuilder();
853
                strSQL.Append("SELECT P.PERSONCODE, P.PERSONNAME, P.DISPLAYORDER, P.MonthlySalary,");
854
                strSQL.Append(" MIN(C.CONSTRUCTIONPERIODSTART) M1, MIN(C.CONSTRUCTIONPERIODSTART2) M2,");
855
                strSQL.Append(" MIN(D.CONSTRUCTIONPERIODSTART) S1, MIN(D.CONSTRUCTIONPERIODSTART2) S2,");
856
                strSQL.Append(" MIN(E.CONSTRUCTIONPERIODSTART) I1, MIN(E.CONSTRUCTIONPERIODSTART2) I2,");
857
                strSQL.Append(" MAX(C.CONSTRUCTIONPERIODEND) M3, MAX(C.CONSTRUCTIONPERIODEND2) M4,");
858
                strSQL.Append(" MAX(D.CONSTRUCTIONPERIODEND) S3, MAX(D.CONSTRUCTIONPERIODEND2) S4,");
859
                strSQL.Append(" MAX(E.CONSTRUCTIONPERIODEND) I3, MAX(E.CONSTRUCTIONPERIODEND2) I4,");
860
                strSQL.Append(" SUM(C.EXECUTIONAMOUNT) M5, SUM(D.EXECUTIONAMOUNT) S5, SUM(E.EXECUTIONAMOUNT) I5,");
861
                strSQL.Append(" COUNT(C.EXECUTIONAMOUNT) M6, COUNT(D.EXECUTIONAMOUNT) S6, COUNT(E.EXECUTIONAMOUNT) I6,");
862
                strSQL.Append(" P.STARTDATE, P.ENDDATE");
863
                strSQL.Append(" FROM PERSONINCHARGEMASTER P");
864

  
865
                // ?H???S?????f?[?^??
866
                strSQL.Append(" LEFT JOIN (SELECT C1.CONSTRUCTIONPERSONCODE, C1.CONSTRUCTIONSTATUSFLG, C1.CONSTRUCTIONPERIOD");
867
                strSQL.Append(", C1.CONSTRUCTIONPERIODSTART, C1.CONSTRUCTIONPERIODSTART2, C1.CONSTRUCTIONPERIODEND, C1.CONSTRUCTIONPERIODEND2, C2.EXECUTIONAMOUNT");
868
                strSQL.Append(" FROM CONSTRUCTIONBASEINFO C1, CONSTRUCTIONLEDGERDETAIL C2, CONSTRUCTIONLEDGER C3");
869
                strSQL.Append(" WHERE C2.CONSTRUCTIONCODE = C1.CONSTRUCTIONCODE");
870
                strSQL.AppendFormat(" AND C2.GROUPCOUNT = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
871
                strSQL.Append(" AND C3.CONSTRUCTIONCODE = C2.CONSTRUCTIONCODE) C");
872
                strSQL.Append(" ON C.CONSTRUCTIONPERSONCODE = P.PERSONCODE");
873
                strSQL.AppendFormat(" AND C.CONSTRUCTIONSTATUSFLG <> {0}", NotOrder);
874
                strSQL.AppendFormat(" AND C.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
875

  
876
                // ?H?????S?????f?[?^??
877
                strSQL.Append(" LEFT JOIN (SELECT D1.CONSTRSUBPERSONCODE CONSTRUCTIONPERSONCODE, D1.CONSTRUCTIONSTATUSFLG, D1.CONSTRUCTIONPERIOD");
878
                strSQL.Append(", D1.CONSTRUCTIONPERIODSTART, D1.CONSTRUCTIONPERIODSTART2, D1.CONSTRUCTIONPERIODEND, D1.CONSTRUCTIONPERIODEND2, D2.EXECUTIONAMOUNT");
879
                strSQL.Append(" FROM CONSTRUCTIONBASEINFO D1, CONSTRUCTIONLEDGERDETAIL D2, CONSTRUCTIONLEDGER D3");
880
                strSQL.Append(" WHERE D2.CONSTRUCTIONCODE = D1.CONSTRUCTIONCODE");
881
                strSQL.AppendFormat(" AND D2.GROUPCOUNT = {0}", (int)FrmConstructionLedger.DataGroup.Assistant);
882
                strSQL.Append(" AND D3.CONSTRUCTIONCODE = D2.CONSTRUCTIONCODE) D");
883
                strSQL.Append(" ON D.CONSTRUCTIONPERSONCODE = P.PERSONCODE");
884
                strSQL.AppendFormat(" AND D.CONSTRUCTIONSTATUSFLG <> {0}", NotOrder);
885
                strSQL.AppendFormat(" AND D.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
886

  
887
                // ?H???w??????f?[?^??
888
                strSQL.Append(" LEFT JOIN (SELECT E1.CONSTRUCTIONINSTRUCTOR CONSTRUCTIONPERSONCODE, E1.CONSTRUCTIONSTATUSFLG, E1.CONSTRUCTIONPERIOD");
889
                strSQL.Append(", E1.CONSTRUCTIONPERIODSTART, E1.CONSTRUCTIONPERIODSTART2, E1.CONSTRUCTIONPERIODEND, E1.CONSTRUCTIONPERIODEND2, E2.EXECUTIONAMOUNT");
890
                strSQL.Append(" FROM CONSTRUCTIONBASEINFO E1, CONSTRUCTIONLEDGERDETAIL E2, CONSTRUCTIONLEDGER E3");
891
                strSQL.Append(" WHERE E2.CONSTRUCTIONCODE = E1.CONSTRUCTIONCODE");
892
                strSQL.AppendFormat(" AND E2.GROUPCOUNT = {0}", (int)FrmConstructionLedger.DataGroup.Instructor);
893
                strSQL.Append(" AND E3.CONSTRUCTIONCODE = E2.CONSTRUCTIONCODE) E");
894
                strSQL.Append(" ON E.CONSTRUCTIONPERSONCODE = P.PERSONCODE");
895
                strSQL.AppendFormat(" AND E.CONSTRUCTIONSTATUSFLG <> {0}", NotOrder);
896
                strSQL.AppendFormat(" AND E.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
897

  
898
                strSQL.AppendFormat(" WHERE P.LEDGERFLG = {0}", (int)CommonDefine.PersonLedgerDivNo.CalcTarget);
899

  
900
                // ??????????E??????????
901
                DateTime dtDefaultStart = DateTime.MinValue;
... 差分の行数が表示可能な上限を超えました。超過分は表示しません。

他の形式にエクスポート: Unified diff