プロジェクト

全般

プロフィール

リビジョン 185

山内約8年前に追加

入金確認、請求入力(入金日修正)、入金明細テーブル変更(事前にDBテーブル変更が必要)

差分を表示:

branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IODepositData.cs
43 43
            DepositAmount,
44 44
            DepositAmountCash,
45 45
            DepositAmountBill,
46
            DepositPersonCode,
47
            Note,
46 48
            EntryDate,
47 49
            UpdateDate,
48 50
        }
......
218 220
                    strcmd += string.Format(", {0}", data.DepositAmount.ToString());
219 221
                    strcmd += string.Format(", {0}", data.DepositAmountCash.ToString());
220 222
                    strcmd += string.Format(", {0}", data.DepositAmountBill.ToString());
223
                    strcmd += string.Format(", {0}", data.DepositPersonCode.ToString());
224
                    strcmd += string.Format(", '{0}'", data.Note.ToString());
221 225
                    strcmd += ", NOW()";
222 226
                    strcmd += ", NOW()";
223 227
                    strcmd += ")";
......
260 264
                strcmd += string.Format(",DepositAmount = {0}", data.DepositAmount.ToString());
261 265
                strcmd += string.Format(",DepositAmountCash = {0}", data.DepositAmountCash.ToString());
262 266
                strcmd += string.Format(",DepositAmountBill = {0}", data.DepositAmountBill.ToString());
267
                strcmd += string.Format(",DepositPersonCode =  {0}", data.DepositPersonCode.ToString());
268
                strcmd += string.Format(",Note =  '{0}'", data.Note.ToString());
263 269
                strcmd += ", UpdateDate = NOW()";
264 270
                strcmd += AddSQLString;
265 271

  
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IODepositDataDetail.cs
30 30

  
31 31
        #region 定数
32 32
        /// <summary>
33
        /// 請求データフィールド並び
33
        /// 入金明細データフィールド並び
34 34
        /// </summary>
35 35
        public enum NameColumn
36 36
        {
37 37
            OrderersDivision = 0,
38 38
            OrderersCode,
39 39
            TargetDate,
40
            SeqNo,
41
            LineCount,
42 40
            RequestNo,
43 41
            OrderNo,
44 42
            DepositAmount,
......
46 44
            CnstrPrice,
47 45
            Fees,
48 46
            OtherAdjustments,
49
            CarryAmount,
50
            ApprovalPersonCode,
51
            ApprovalDate,
52
            ApprovalEndFlg,
53
            ENTRYDATE,
54
            UPDATEDATE,
47
            DifferenceAmount,
48
            ConfirmationPersonCode,
49
            ConfirmationDate,
50
            ConfirmationEndFlg,
51
            Note,
52
            EntryDate,
53
            UpdateDate,
55 54
        }
56 55
        #endregion
57 56

  
......
88 87
                strcmd += " OrderersDivision";
89 88
                strcmd += " ,OrderersCode";
90 89
                strcmd += " ,CAST(TargetDate As Char)";
91
                strcmd += " ,SeqNo";
92
                strcmd += " ,LineCount";
93 90
                strcmd += " ,RequestNo";
94 91
                strcmd += " ,OrderNo";
95 92
                strcmd += " ,DepositAmount";
......
97 94
                strcmd += " ,CnstrPrice";
98 95
                strcmd += " ,Fees";
99 96
                strcmd += " ,OtherAdjustments";
100
                strcmd += " ,CarryAmount";
101
                strcmd += " ,ApprovalPersonCode";
102
                strcmd += " ,DATE_FORMAT(ApprovalDate, '%Y/%m/%d')";
103
                strcmd += " ,ApprovalEndFlg";
97
                strcmd += " ,DifferenceAmount";
98
                strcmd += " ,ConfirmationPersonCode";
99
                strcmd += " ,DATE_FORMAT(ConfirmationDate, '%Y/%m/%d')";
100
                strcmd += " ,ConfirmationEndFlg";
104 101
                strcmd += " ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')";
105 102
                strcmd += " ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')";
106 103
                strcmd += " FROM DepositDataDetail";
......
173 170
                strcmd += string.Format(" {0}", data.OrderersDivision.ToString());
174 171
                strcmd += string.Format(", {0}", data.OrderersCode.ToString());
175 172
                strcmd += string.Format(", {0}", data.TargetDate.ToString());
176
                strcmd += string.Format(", {0}", data.SeqNo.ToString());
177
                strcmd += string.Format(", {0}", data.LineCount.ToString());
178 173
                strcmd += string.Format(", {0}", data.RequestNo.ToString());
179 174
                strcmd += string.Format(", {0}", data.OrderNo.ToString());
180 175
                strcmd += string.Format(", {0}", data.DepositAmount.ToString());
......
182 177
                strcmd += string.Format(", {0}", data.CnstrPrice.ToString());
183 178
                strcmd += string.Format(", {0}", data.Fees.ToString());
184 179
                strcmd += string.Format(", {0}", data.OtherAdjustments.ToString());
185
                strcmd += string.Format(", {0}", data.CarryAmount.ToString());
186
                strcmd += string.Format(", {0}", data.ApprovalPersonCode.ToString());
187
                strcmd += string.Format(", DATE_FORMAT('{0}','%Y/%m/%d')", data.ApprovalDate.ToShortDateString());
188
                strcmd += string.Format(", {0}", data.ApprovalEndFlg ? 1 : 0);
189

  
180
                strcmd += string.Format(", {0}", data.DifferenceAmount.ToString());
181
                strcmd += string.Format(", {0}", data.ConfirmationPersonCode.ToString());
182
                strcmd += string.Format(", DATE_FORMAT('{0}','%Y/%m/%d')", data.ConfirmationDate.ToShortDateString());
183
                strcmd += string.Format(", {0}", data.ConfirmationEndFlg.ToString());
184
                strcmd += string.Format(", '{0}'", data.Note.ToString());
190 185
                strcmd += ", NOW()";
191 186
                strcmd += ", NOW()";
192 187
                strcmd += ")";
......
220 215

  
221 216
                strcmd += " SET";
222 217

  
223
//                strcmd += string.Format(" OrderersDivision = {0}", data.OrderersDivision.ToString());
224
//                strcmd += string.Format(",OrderersCode = {0}", data.OrderersCode.ToString());
225
//                strcmd += string.Format(",TargetDate = '{0}'", data.TargetDate);
226
//                strcmd += string.Format(",SeqNo = {0}", data.SeqNo.ToString());
227
//                strcmd += string.Format(",LineCount = {0}", data.LineCount.ToString());
228
                strcmd += string.Format(" RequestNo = {0}", data.RequestNo.ToString());
218
                strcmd += string.Format(" OrderersDivision = {0}", data.OrderersDivision.ToString());
219
                strcmd += string.Format(",OrderersCode = {0}", data.OrderersCode.ToString());
220
                strcmd += string.Format(",TargetDate = {0}", data.TargetDate);
221
                strcmd += string.Format(",RequestNo = {0}", data.RequestNo.ToString());
229 222
                strcmd += string.Format(",OrderNo = {0}", data.OrderNo.ToString());
230 223
                strcmd += string.Format(",DepositAmount = {0}", data.DepositAmount.ToString());
231 224
                strcmd += string.Format(",DiscountAmount = {0}", data.DiscountAmount.ToString());
232 225
                strcmd += string.Format(",CnstrPrice = {0}", data.CnstrPrice.ToString());
233 226
                strcmd += string.Format(",Fees = {0}", data.Fees.ToString());
234 227
                strcmd += string.Format(",OtherAdjustments = {0}", data.OtherAdjustments.ToString());
235
                strcmd += string.Format(",CarryAmount = {0}", data.CarryAmount.ToString());
236
                strcmd += string.Format(",ApprovalPersonCode = {0}", data.ApprovalPersonCode.ToString());
237
                strcmd += string.Format(",ApprovalDate = DATE_FORMAT('{0}','%Y/%m/%d')", data.ApprovalDate.ToShortDateString());
238
                strcmd += string.Format(",ApprovalEndFlg = {0}", data.ApprovalEndFlg ? 1 : 0);
239

  
228
                strcmd += string.Format(",DifferenceAmount = {0}", data.DifferenceAmount.ToString());
229
                strcmd += string.Format(",ConfirmationPersonCode = {0}", data.ConfirmationPersonCode.ToString());
230
                strcmd += string.Format(",ConfirmationDate = DATE_FORMAT('{0}','%Y/%m/%d')", data.ConfirmationDate.ToShortDateString());
231
                strcmd += string.Format(",ConfirmationEndFlg = {0}", data.ConfirmationEndFlg.ToString());
232
                strcmd += string.Format(",Note = '{0}'", data.Note.ToString());
240 233
                strcmd += ", UpdateDate = NOW()";
241
                strcmd += string.Format(" where OrderersDivision = {0} and OrderersCode = {1} and TargetDate = {2} and SeqNo = {3} and LineCount = {4} ",
242
                    data.OrderersDivision, data.OrderersCode, data.TargetDate, data.SeqNo, data.LineCount);
234
                strcmd += string.Format(" where OrderersDivision = {0} and OrderersCode = {1} and TargetDate = {2} and RequestNo = {3} ",
235
                    data.OrderersDivision, data.OrderersCode, data.TargetDate, data.RequestNo);
243 236
                strcmd += AddSQLString;
244 237

  
245 238
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
......
295 288
                wrk.OrderersDivision = int.Parse(objwrk[(int)NameColumn.OrderersDivision].ToString());
296 289
                wrk.OrderersCode = int.Parse(objwrk[(int)NameColumn.OrderersCode].ToString());
297 290
                wrk.TargetDate = objwrk[(int)NameColumn.TargetDate].ToString();
298
                wrk.SeqNo = int.Parse(objwrk[(int)NameColumn.SeqNo].ToString());
299
                wrk.LineCount = int.Parse(objwrk[(int)NameColumn.LineCount].ToString());
300 291
                wrk.RequestNo = int.Parse(objwrk[(int)NameColumn.RequestNo].ToString());
301 292
                wrk.OrderNo = int.Parse(objwrk[(int)NameColumn.OrderNo].ToString());
302 293
                wrk.DepositAmount = long.Parse(objwrk[(int)NameColumn.DepositAmount].ToString());
......
304 295
                wrk.CnstrPrice = long.Parse(objwrk[(int)NameColumn.CnstrPrice].ToString());
305 296
                wrk.Fees = long.Parse(objwrk[(int)NameColumn.Fees].ToString());
306 297
                wrk.OtherAdjustments = long.Parse(objwrk[(int)NameColumn.OtherAdjustments].ToString());
307
                wrk.CarryAmount = long.Parse(objwrk[(int)NameColumn.CarryAmount].ToString());
308
                wrk.ApprovalPersonCode = int.Parse(objwrk[(int)NameColumn.ApprovalPersonCode].ToString());
309
                wrk.ApprovalDate = DateTime.Parse(objwrk[(int)NameColumn.ApprovalDate].ToString());
310
                wrk.ApprovalEndFlg = (int.Parse(objwrk[(int)NameColumn.ApprovalEndFlg].ToString()) != 0);
298
                wrk.DifferenceAmount = long.Parse(objwrk[(int)NameColumn.DifferenceAmount].ToString());
299
                wrk.ConfirmationPersonCode = int.Parse(objwrk[(int)NameColumn.ConfirmationPersonCode].ToString());
300
                wrk.ConfirmationDate = DateTime.Parse(objwrk[(int)NameColumn.ConfirmationDate].ToString());
301
                wrk.ConfirmationEndFlg = int.Parse(objwrk[(int)NameColumn.ConfirmationEndFlg].ToString());
311 302

  
312
                wrk.EntryDate = DateTime.Parse(objwrk[(int)NameColumn.ENTRYDATE].ToString());
313
                wrk.UpdateDate = DateTime.Parse(objwrk[(int)NameColumn.UPDATEDATE].ToString());
303
                wrk.EntryDate = DateTime.Parse(objwrk[(int)NameColumn.EntryDate].ToString());
304
                wrk.UpdateDate = DateTime.Parse(objwrk[(int)NameColumn.UpdateDate].ToString());
314 305
            }
315 306
            catch (MySqlException myex)
316 307
            {
......
336 327
                wrk.OrderersDivision = 0;
337 328
                wrk.OrderersCode = 0;
338 329
                wrk.TargetDate = string.Empty;
339
                wrk.SeqNo = 0;
340
                wrk.LineCount = 0;
341 330
                wrk.RequestNo = 0;
342 331
                wrk.OrderNo = 0;
343 332
                wrk.DepositAmount = 0;
......
345 334
                wrk.CnstrPrice = 0;
346 335
                wrk.Fees = 0;
347 336
                wrk.OtherAdjustments = 0;
348
                wrk.CarryAmount = 0;
349
                wrk.ApprovalPersonCode = 0;
350
                wrk.ApprovalDate = DateTime.MinValue;
351
                wrk.ApprovalEndFlg = false;
337
                wrk.DifferenceAmount = 0;
338
                wrk.ConfirmationPersonCode = 0;
339
                wrk.ConfirmationDate = DateTime.MinValue;
340
                wrk.ConfirmationEndFlg = 0;
352 341

  
353 342
                wrk.EntryDate = DateTime.Now;
354 343
                wrk.UpdateDate = DateTime.Now;
branches/src/ProcessManagement/ProcessManagement/DataModel/DepositData.cs
16 16
        private int m_OrderersCode = 0;                         // 発注者コード
17 17
        private string m_TargetDate = string.Empty;             // 対象年月
18 18
        private int m_SeqNo = 0;                                // 連番
19
        private int m_BusinessPeriod = 0;                         // 営業期
19
        private int m_BusinessPeriod = 0;                       // 営業期
20 20
        private DateTime m_DepositDate = DateTime.MinValue;     // 入金日
21
        private long m_DepositAmount = 0;                        // 入金金額
22
        private long m_DepositAmountCash = 0;                    // 入金金額(現金)
23
        private long m_DepositAmountBill = 0;                    // 入金金額(手形)
21
        private long m_DepositAmount = 0;                       // 入金金額
22
        private long m_DepositAmountCash = 0;                   // 入金金額(現金)
23
        private long m_DepositAmountBill = 0;                   // 入金金額(手形)
24
        private int m_DepositPersonCode = 0;                    // 入金担当者コード
25
        private string m_Note = string.Empty;                   // 備考
24 26
        private DateTime m_EntryDate = DateTime.Now;            // 登録年月日
25 27
        private DateTime m_UpdateDate = DateTime.Now;           // 更新年月日
26 28
        #endregion
......
111 113
        }
112 114

  
113 115
        /// <summary>
116
        /// 入金担当者コード
117
        /// </summary>
118
        public int DepositPersonCode
119
        {
120
            get { return m_DepositPersonCode; }
121
            set { m_DepositPersonCode = value; }
122
        }
123

  
124
        /// <summary>
125
        /// 備考
126
        /// </summary>
127
        public string Note
128
        {
129
            get { return m_Note; }
130
            set { m_Note = value; }
131
        }
132

  
133
        /// <summary>
114 134
        /// 登録年月日
115 135
        /// </summary>
116 136
        public DateTime EntryDate
branches/src/ProcessManagement/ProcessManagement/DataModel/DepositDataDetail.cs
12 12
    public class DepositDataDetail
13 13
    {
14 14
        #region メンバ変数
15
        private int m_OrderersDivision = 0;                     // 発注者区分
16
        private int m_OrderersCode = 0;                         // 発注者コード
17
        private string m_TargetDate = string.Empty;             // 対象年月
18
        private int m_SeqNo = 0;                                // 連番
19
        private int m_LineCount = 0;                            // 行番号
20
        private int m_RequestNo = 0;                            // 請求No
21
        private int m_OrderNo = 0;                              // 受付番号
22
        private long m_DepositAmount = 0;                        // 入金金額
23
        private long m_DiscountAmount = 0;                       // 値引き金額
24
        private long m_CnstrPrice = 0;                           // 協力金
25
        private long m_Fees = 0;                                 // 手数料
26
        private long m_OtherAdjustments = 0;                     // その他調整
27
        private long m_CarryAmount = 0;                          // 繰越金額
28
        private int m_ApprovalPersonCode = 0;                   // 承認担当者コード
29
        private DateTime m_ApprovalDate = DateTime.MinValue;    // 担当者承認日付
30
        private bool m_ApprovalEndFlg = false;                  // 承認完了フラグ
31
        private DateTime m_EntryDate = DateTime.Now;            // 登録年月日
32
        private DateTime m_UpdateDate = DateTime.Now;           // 更新年月日
15
        private int m_OrderersDivision = 0;                         // 発注者区分
16
        private int m_OrderersCode = 0;                             // 発注者コード
17
        private string m_TargetDate = string.Empty;                 // 対象年月
18
        private int m_RequestNo = 0;                                // 請求No
19
        private int m_OrderNo = 0;                                  // 受付番号
20
        private long m_DepositAmount = 0;                           // 入金金額
21
        private long m_DiscountAmount = 0;                          // 値引き金額
22
        private long m_CnstrPrice = 0;                              // 協力金
23
        private long m_Fees = 0;                                    // 手数料
24
        private long m_OtherAdjustments = 0;                        // その他調整
25
        private long m_DifferenceAmount = 0;                        // 差分
26
        private int m_ConfirmationPersonCode = 0;                   // 承認担当者コード
27
        private DateTime m_ConfirmationDate = DateTime.MinValue;    // 担当者承認日付
28
        private int m_ConfirmationEndFlg = 0;                       // 承認完了フラグ
29
        private string m_Note = string.Empty;                       // 備考
30
        private DateTime m_EntryDate = DateTime.Now;                // 登録年月日
31
        private DateTime m_UpdateDate = DateTime.Now;               // 更新年月日
33 32
        #endregion
34 33

  
35 34
        #region コンストラクタ
......
64 63
        }
65 64

  
66 65
        /// <summary>
67
        /// 連番
68
        /// </summary>
69
        public int SeqNo
70
        {
71
            get { return m_SeqNo; }
72
            set { m_SeqNo = value; }
73
        }
74

  
75
        /// <summary>
76
        /// 行番号
77
        /// </summary>
78
        public int LineCount
79
        {
80
            get { return m_LineCount; }
81
            set { m_LineCount = value; }
82
        }
83

  
84
        /// <summary>
85 66
        /// 請求No
86 67
        /// </summary>
87 68
        public int RequestNo
......
145 126
        }
146 127

  
147 128
        /// <summary>
148
        /// 繰越金額
129
        /// 差額金額
149 130
        /// </summary>
150
        public long CarryAmount
131
        public long DifferenceAmount
151 132
        {
152
            get { return m_CarryAmount; }
153
            set { m_CarryAmount = value; }
133
            get { return m_DifferenceAmount; }
134
            set { m_DifferenceAmount = value; }
154 135
        }
155 136

  
156 137
        /// <summary>
157
        /// 認担当者コード
138
        /// 認担当者コード
158 139
        /// </summary>
159
        public int ApprovalPersonCode
140
        public int ConfirmationPersonCode
160 141
        {
161
            get { return m_ApprovalPersonCode; }
162
            set { m_ApprovalPersonCode = value; }
142
            get { return m_ConfirmationPersonCode; }
143
            set { m_ConfirmationPersonCode = value; }
163 144
        }
164 145

  
165 146
        /// <summary>
166
        /// 担当者認日付
147
        /// 担当者認日付
167 148
        /// </summary>
168
        public DateTime ApprovalDate
149
        public DateTime ConfirmationDate
169 150
        {
170
            get { return m_ApprovalDate; }
171
            set { m_ApprovalDate = value; }
151
            get { return m_ConfirmationDate; }
152
            set { m_ConfirmationDate = value; }
172 153
        }
173 154

  
174 155
        /// <summary>
175
        /// 認完了フラグ
156
        /// 認完了フラグ
176 157
        /// </summary>
177
        public bool ApprovalEndFlg
158
        public int ConfirmationEndFlg
178 159
        {
179
            get { return m_ApprovalEndFlg; }
180
            set { m_ApprovalEndFlg = value; }
160
            get { return m_ConfirmationEndFlg; }
161
            set { m_ConfirmationEndFlg = value; }
181 162
        }
182 163

  
183 164
        /// <summary>
165
        /// 備考
166
        /// </summary>
167
        public string Note
168
        {
169
            get { return m_Note; }
170
            set { m_Note = value; }
171
        }
172

  
173
        /// <summary>
184 174
        /// 登録年月日
185 175
        /// </summary>
186 176
        public DateTime EntryDate
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/FrmEntryDeposit.Designer.cs
1
namespace ProcessManagement.Forms.DataEntry.Request
2
{
3
    partial class FrmEntryDeposit
4
    {
5
        /// <summary>
6
        /// Required designer variable.
7
        /// </summary>
8
        private System.ComponentModel.IContainer components = null;
9

  
10
        /// <summary>
11
        /// Clean up any resources being used.
12
        /// </summary>
13
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
14
        protected override void Dispose(bool disposing)
15
        {
16
            if (disposing && (components != null))
17
            {
18
                components.Dispose();
19
            }
20
            base.Dispose(disposing);
21
        }
22

  
23
        #region Windows Form Designer generated code
24

  
25
        /// <summary>
26
        /// Required method for Designer support - do not modify
27
        /// the contents of this method with the code editor.
28
        /// </summary>
29
        private void InitializeComponent()
30
        {
31
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
32
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
33
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = 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
            this.dgv1 = new System.Windows.Forms.DataGridView();
38
            this.OrderersDivision = new System.Windows.Forms.DataGridViewTextBoxColumn();
39
            this.OrderersCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
40
            this.TargetDate = new System.Windows.Forms.DataGridViewTextBoxColumn();
41
            this.SeqNo = new System.Windows.Forms.DataGridViewTextBoxColumn();
42
            this.BusinessPeriod = new System.Windows.Forms.DataGridViewTextBoxColumn();
43
            this.DepositDate = new System.Windows.Forms.DataGridViewTextBoxColumn();
44
            this.DepositAmount = new System.Windows.Forms.DataGridViewTextBoxColumn();
45
            this.DepositAmountCash = new System.Windows.Forms.DataGridViewTextBoxColumn();
46
            this.DepositAmountBill = new System.Windows.Forms.DataGridViewTextBoxColumn();
47
            this.DepositPersonCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
48
            this.DepositPersonName = new System.Windows.Forms.DataGridViewTextBoxColumn();
49
            this.Note = new System.Windows.Forms.DataGridViewTextBoxColumn();
50
            this.btnAccept = new System.Windows.Forms.Button();
51
            this.btnEnd = new System.Windows.Forms.Button();
52
            this.label1 = new System.Windows.Forms.Label();
53
            this.OrderersName = new System.Windows.Forms.Label();
54
            this.button1 = new System.Windows.Forms.Button();
55
            this.btnDelete = new System.Windows.Forms.Button();
56
            ((System.ComponentModel.ISupportInitialize)(this.dgv1)).BeginInit();
57
            this.SuspendLayout();
58
            // 
59
            // dgv1
60
            // 
61
            this.dgv1.AllowUserToAddRows = false;
62
            this.dgv1.AllowUserToResizeColumns = false;
63
            this.dgv1.AllowUserToResizeRows = false;
64
            dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
65
            dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
66
            dataGridViewCellStyle1.Font = new System.Drawing.Font("MS 明朝", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
67
            dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
68
            dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
69
            dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
70
            dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
71
            this.dgv1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
72
            this.dgv1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
73
            this.dgv1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
74
            this.OrderersDivision,
75
            this.OrderersCode,
76
            this.TargetDate,
77
            this.SeqNo,
78
            this.BusinessPeriod,
79
            this.DepositDate,
80
            this.DepositAmount,
81
            this.DepositAmountCash,
82
            this.DepositAmountBill,
83
            this.DepositPersonCode,
84
            this.DepositPersonName,
85
            this.Note});
86
            this.dgv1.Location = new System.Drawing.Point(12, 63);
87
            this.dgv1.Name = "dgv1";
88
            dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
89
            dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control;
90
            dataGridViewCellStyle6.Font = new System.Drawing.Font("MS 明朝", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
91
            dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText;
92
            dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight;
93
            dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
94
            dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
95
            this.dgv1.RowHeadersDefaultCellStyle = dataGridViewCellStyle6;
96
            this.dgv1.RowHeadersVisible = false;
97
            this.dgv1.RowTemplate.Height = 21;
98
            this.dgv1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
99
            this.dgv1.Size = new System.Drawing.Size(652, 172);
100
            this.dgv1.TabIndex = 9;
101
            this.dgv1.CellBeginEdit += new System.Windows.Forms.DataGridViewCellCancelEventHandler(this.dgv1_CellBeginEdit);
102
            this.dgv1.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgv1_CellEnter);
103
            this.dgv1.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dgv1_CellFormatting_1);
104
            this.dgv1.CellValidating += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.dgv1_CellValidating);
105
            this.dgv1.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgv1_CellValueChanged);
106
            // 
107
            // OrderersDivision
108
            // 
109
            this.OrderersDivision.HeaderText = "■発注者区分";
110
            this.OrderersDivision.Name = "OrderersDivision";
111
            this.OrderersDivision.ReadOnly = true;
112
            this.OrderersDivision.Resizable = System.Windows.Forms.DataGridViewTriState.False;
113
            this.OrderersDivision.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
114
            this.OrderersDivision.Visible = false;
115
            // 
116
            // OrderersCode
117
            // 
118
            this.OrderersCode.HeaderText = "■発注者コード";
119
            this.OrderersCode.Name = "OrderersCode";
120
            this.OrderersCode.ReadOnly = true;
121
            this.OrderersCode.Resizable = System.Windows.Forms.DataGridViewTriState.False;
122
            this.OrderersCode.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
123
            this.OrderersCode.Visible = false;
124
            // 
125
            // TargetDate
126
            // 
127
            this.TargetDate.HeaderText = "■対象年月";
128
            this.TargetDate.Name = "TargetDate";
129
            this.TargetDate.ReadOnly = true;
130
            this.TargetDate.Resizable = System.Windows.Forms.DataGridViewTriState.False;
131
            this.TargetDate.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
132
            this.TargetDate.Visible = false;
133
            // 
134
            // SeqNo
135
            // 
136
            this.SeqNo.HeaderText = "■連番";
137
            this.SeqNo.Name = "SeqNo";
138
            this.SeqNo.ReadOnly = true;
139
            this.SeqNo.Resizable = System.Windows.Forms.DataGridViewTriState.False;
140
            this.SeqNo.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
141
            this.SeqNo.Visible = false;
142
            // 
143
            // BusinessPeriod
144
            // 
145
            this.BusinessPeriod.HeaderText = "■営業期";
146
            this.BusinessPeriod.Name = "BusinessPeriod";
147
            this.BusinessPeriod.ReadOnly = true;
148
            this.BusinessPeriod.Resizable = System.Windows.Forms.DataGridViewTriState.False;
149
            this.BusinessPeriod.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
150
            this.BusinessPeriod.Visible = false;
151
            // 
152
            // DepositDate
153
            // 
154
            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
155
            this.DepositDate.DefaultCellStyle = dataGridViewCellStyle2;
156
            this.DepositDate.HeaderText = "入金日";
157
            this.DepositDate.Name = "DepositDate";
158
            this.DepositDate.Resizable = System.Windows.Forms.DataGridViewTriState.False;
159
            this.DepositDate.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
160
            // 
161
            // DepositAmount
162
            // 
163
            this.DepositAmount.HeaderText = "■入金金額";
164
            this.DepositAmount.Name = "DepositAmount";
165
            this.DepositAmount.ReadOnly = true;
166
            this.DepositAmount.Resizable = System.Windows.Forms.DataGridViewTriState.False;
167
            this.DepositAmount.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
168
            this.DepositAmount.Visible = false;
169
            // 
170
            // DepositAmountCash
171
            // 
172
            dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
173
            this.DepositAmountCash.DefaultCellStyle = dataGridViewCellStyle3;
174
            this.DepositAmountCash.HeaderText = "入金金額(現金)";
175
            this.DepositAmountCash.Name = "DepositAmountCash";
176
            this.DepositAmountCash.Resizable = System.Windows.Forms.DataGridViewTriState.False;
177
            this.DepositAmountCash.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
178
            this.DepositAmountCash.Width = 150;
179
            // 
180
            // DepositAmountBill
181
            // 
182
            dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
183
            this.DepositAmountBill.DefaultCellStyle = dataGridViewCellStyle4;
184
            this.DepositAmountBill.HeaderText = "入金金額(手形)";
185
            this.DepositAmountBill.Name = "DepositAmountBill";
186
            this.DepositAmountBill.Resizable = System.Windows.Forms.DataGridViewTriState.False;
187
            this.DepositAmountBill.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
188
            this.DepositAmountBill.Width = 150;
189
            // 
190
            // DepositPersonCode
191
            // 
192
            this.DepositPersonCode.HeaderText = "■入金担当者コード";
193
            this.DepositPersonCode.Name = "DepositPersonCode";
194
            this.DepositPersonCode.ReadOnly = true;
195
            this.DepositPersonCode.Resizable = System.Windows.Forms.DataGridViewTriState.False;
196
            this.DepositPersonCode.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
197
            this.DepositPersonCode.Visible = false;
198
            // 
199
            // DepositPersonName
200
            // 
201
            dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
202
            this.DepositPersonName.DefaultCellStyle = dataGridViewCellStyle5;
203
            this.DepositPersonName.HeaderText = "確認者";
204
            this.DepositPersonName.Name = "DepositPersonName";
205
            this.DepositPersonName.ReadOnly = true;
206
            this.DepositPersonName.Resizable = System.Windows.Forms.DataGridViewTriState.False;
207
            this.DepositPersonName.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
208
            this.DepositPersonName.Width = 80;
209
            // 
210
            // Note
211
            // 
212
            this.Note.HeaderText = "備考";
213
            this.Note.Name = "Note";
214
            this.Note.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
215
            this.Note.Width = 200;
216
            // 
217
            // btnAccept
218
            // 
219
            this.btnAccept.BackColor = System.Drawing.Color.Lime;
220
            this.btnAccept.ForeColor = System.Drawing.Color.Black;
221
            this.btnAccept.Location = new System.Drawing.Point(418, 241);
222
            this.btnAccept.Name = "btnAccept";
223
            this.btnAccept.Size = new System.Drawing.Size(120, 32);
224
            this.btnAccept.TabIndex = 12;
225
            this.btnAccept.Text = "登 録";
226
            this.btnAccept.UseVisualStyleBackColor = false;
227
            this.btnAccept.Click += new System.EventHandler(this.btnAccept_Click);
228
            // 
229
            // btnEnd
230
            // 
231
            this.btnEnd.BackColor = System.Drawing.Color.Blue;
232
            this.btnEnd.ForeColor = System.Drawing.Color.Transparent;
233
            this.btnEnd.Location = new System.Drawing.Point(544, 241);
234
            this.btnEnd.Name = "btnEnd";
235
            this.btnEnd.Size = new System.Drawing.Size(120, 32);
236
            this.btnEnd.TabIndex = 11;
237
            this.btnEnd.Text = "閉じる";
238
            this.btnEnd.UseVisualStyleBackColor = false;
239
            this.btnEnd.Click += new System.EventHandler(this.btnEnd_Click);
240
            // 
241
            // label1
242
            // 
243
            this.label1.BackColor = System.Drawing.Color.Yellow;
244
            this.label1.Location = new System.Drawing.Point(12, 18);
245
            this.label1.Name = "label1";
246
            this.label1.Size = new System.Drawing.Size(106, 25);
247
            this.label1.TabIndex = 13;
248
            this.label1.Text = "発注者";
249
            this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
250
            // 
251
            // OrderersName
252
            // 
253
            this.OrderersName.BackColor = System.Drawing.Color.White;
254
            this.OrderersName.Location = new System.Drawing.Point(124, 18);
255
            this.OrderersName.Name = "OrderersName";
256
            this.OrderersName.Size = new System.Drawing.Size(414, 25);
257
            this.OrderersName.TabIndex = 14;
258
            this.OrderersName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
259
            // 
260
            // button1
261
            // 
262
            this.button1.Font = new System.Drawing.Font("MS 明朝", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
263
            this.button1.Location = new System.Drawing.Point(604, 18);
264
            this.button1.Name = "button1";
265
            this.button1.Size = new System.Drawing.Size(60, 23);
266
            this.button1.TabIndex = 15;
267
            this.button1.Text = "・・・";
268
            this.button1.UseVisualStyleBackColor = true;
269
            this.button1.Visible = false;
270
            this.button1.Click += new System.EventHandler(this.button1_Click);
271
            // 
272
            // btnDelete
273
            // 
274
            this.btnDelete.BackColor = System.Drawing.Color.Magenta;
275
            this.btnDelete.ForeColor = System.Drawing.Color.Black;
276
            this.btnDelete.Location = new System.Drawing.Point(12, 242);
277
            this.btnDelete.Name = "btnDelete";
278
            this.btnDelete.Size = new System.Drawing.Size(120, 32);
279
            this.btnDelete.TabIndex = 16;
280
            this.btnDelete.Text = "入金削除";
281
            this.btnDelete.UseVisualStyleBackColor = false;
282
            this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
283
            // 
284
            // FrmEntryDeposit
285
            // 
286
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
287
            this.BackColor = System.Drawing.Color.Black;
288
            this.ClientSize = new System.Drawing.Size(676, 286);
289
            this.Controls.Add(this.btnDelete);
290
            this.Controls.Add(this.button1);
291
            this.Controls.Add(this.OrderersName);
292
            this.Controls.Add(this.label1);
293
            this.Controls.Add(this.btnAccept);
294
            this.Controls.Add(this.btnEnd);
295
            this.Controls.Add(this.dgv1);
296
            this.Font = new System.Drawing.Font("MS 明朝", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
297
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
298
            this.Margin = new System.Windows.Forms.Padding(4);
299
            this.MaximizeBox = false;
300
            this.MinimizeBox = false;
301
            this.Name = "FrmEntryDeposit";
302
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
303
            this.Text = "入金入力";
304
            this.Load += new System.EventHandler(this.FrmEntryDeposit_Load);
305
            ((System.ComponentModel.ISupportInitialize)(this.dgv1)).EndInit();
306
            this.ResumeLayout(false);
307

  
308
        }
309

  
310
        #endregion
311

  
312
        private System.Windows.Forms.DataGridView dgv1;
313
        private System.Windows.Forms.Button btnAccept;
314
        private System.Windows.Forms.Button btnEnd;
315
        private System.Windows.Forms.Label label1;
316
        private System.Windows.Forms.Label OrderersName;
317
        private System.Windows.Forms.Button button1;
318
        private System.Windows.Forms.DataGridViewTextBoxColumn OrderersDivision;
319
        private System.Windows.Forms.DataGridViewTextBoxColumn OrderersCode;
320
        private System.Windows.Forms.DataGridViewTextBoxColumn TargetDate;
321
        private System.Windows.Forms.DataGridViewTextBoxColumn SeqNo;
322
        private System.Windows.Forms.DataGridViewTextBoxColumn BusinessPeriod;
323
        private System.Windows.Forms.DataGridViewTextBoxColumn DepositDate;
324
        private System.Windows.Forms.DataGridViewTextBoxColumn DepositAmount;
325
        private System.Windows.Forms.DataGridViewTextBoxColumn DepositAmountCash;
326
        private System.Windows.Forms.DataGridViewTextBoxColumn DepositAmountBill;
327
        private System.Windows.Forms.DataGridViewTextBoxColumn DepositPersonCode;
328
        private System.Windows.Forms.DataGridViewTextBoxColumn DepositPersonName;
329
        private System.Windows.Forms.DataGridViewTextBoxColumn Note;
330
        private System.Windows.Forms.Button btnDelete;
331
    }
332
}
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/FrmEntryDeposit.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.Threading.Tasks;
9
using System.Windows.Forms;
10
using ProcessManagement.DataModel;
11
using ProcessManagement.Common;
12
using ProcessManagement.Forms.SubForms;
13
using System.Collections;
14
using ProcessManagement.DB.IOAccess;
15

  
16
using System.Diagnostics;
17
using System.Threading;
18
using System.Text.RegularExpressions;
19

  
20
using log4net;
21
using log4net.Appender;
22
using log4net.Repository.Hierarchy;
23

  
24
using ProcessManagement.DB.Core;
25
using ProcessManagement.Forms.Master;
26
using ProcessManagement.Forms.CustomControls;
27
using ProcessManagement.Forms.ControlsAction;
28

  
29
namespace ProcessManagement.Forms.DataEntry.Request
30
{
31
    public partial class FrmEntryDeposit : Form
32
    {
33
        #region ログ使用定義
34
        //log4netログを使用する
35
        private static readonly log4net.ILog logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
36
        #endregion
37

  
38
        #region 変数
39
        /// <summary>
40
        /// 入金データ
41
        /// </summary>
42
        private DepositData m_DepositData = new DepositData();
43

  
44
        /// <summary>
45
        /// 編集前のセルの内容
46
        /// </summary>
47
        private string oldCellValue = "";
48

  
49
        private List<DepositList> Dlist;
50

  
51
        #endregion
52

  
53
        #region 定数
54
        private const long amount_max = 9999999999;             // 金額最大
55
        private const long amount_min = -9999999999;            // 金額最小
56
        #endregion
57

  
58
        #region 入金情報クラス定義
59
        /// <summary>
60
        /// 入金情報
61
        /// </summary>
62
        private class DepositList
63
        {
64
            public int orderersDivision;
65
            public int orderersCode;
66
            public int targetDate;
67
            public int seqNo;
68
            public string depositDate;
69
            public long depositAmount;
70
            public long depositAmountCash;
71
            public long depositAmountBill;
72
            public int depositPersonCode;
73
            public string personName;
74
            public string note;
75

  
76
            public int AddEdit = 0;
77
        }
78
        #endregion
79

  
80
        #region 取得するデータ項目
81
        /// <summary>
82
        /// 取得するデータ項目
83
        /// </summary>
84
        private enum GetData
85
        {
86
            orderersName = 0,
87
            orderersDivision,
88
            orderersCode,
89
            targetDate,
90
            seqNo,
91
            depositDate,
92
            depositAmount,
93
            depositAmountCash,
94
            depositAmountBill,
95
            depositPersonCode,
96
            personName,
97
            note,
98
        }
99
        #endregion
100

  
101
        #region カラム追加用
102
        /// <summary>
103
        /// カラム追加用
104
        /// </summary>
105
        private enum DispColumn
106
        {
107
            orderersDivision = 0,
108
            orderersCode,
109
            targetDate,
110
            seqNo,
111
            BusinessPeriod,
112
            depositDate,
113
            depositAmount,
114
            depositAmountCash,
115
            depositAmountBill,
116
            depositPersonCode,
117
            personName,
118
            note,
119
        }
120
        #endregion
121

  
122
        #region プロパティ
123
        /// <summary>
124
        /// 入金データ
125
        /// </summary>
126
        public DepositData depositdata
127
        {
128
            get { return m_DepositData; }
129
            set { m_DepositData = value; }
130
        }
131

  
132
        #endregion
133

  
134
        #region コンストラクタ
135
        public FrmEntryDeposit()
136
        {
137
            InitializeComponent();
138
        }
139
        #endregion
140

  
141
        #region フォームロード
142
        /// <summary>
143
        /// フォームロード
144
        /// </summary>
145
        /// <param name="sender"></param>
146
        /// <param name="e"></param>
147
        private void FrmEntryDeposit_Load(object sender, EventArgs e)
148
        {
149
            //フォームサイズ固定
150
            this.MaximizedBounds = new Rectangle(this.Left, this.Top, this.Width, this.Height);
151
            // 初期表示
152
            InitDataLoad();
153
        }
154
        #endregion
155

  
156
        #region 初期表示処理
157
        /// <summary>
158
        /// 初期表示処理
159
        /// </summary>
160
        private void InitDataLoad()
161
        {
162
            try
163
            {
164
                var Dep = SelectDepositData().OfType<object[]>();
165
                Dlist = new List<DepositList>();
166

  
167
                // 取得情報をリストに入れる
168
                foreach (var orderer in Dep)
169
                {
170
                    var o = new DepositList();
171

  
172
                    string orderersName = CommonMotions.cnvString(orderer[(int)GetData.orderersName]);
173
                    if (orderersName != null)
174
                    {
175
                        OrderersName.Text = orderersName;
176
                    }
177
                    o.orderersDivision = CommonMotions.cnvInt(orderer[(int)GetData.orderersDivision]);
178
                    o.orderersCode = CommonMotions.cnvInt(orderer[(int)GetData.orderersCode]);
179
                    o.targetDate = CommonMotions.cnvInt(orderer[(int)GetData.targetDate]);
180
                    o.seqNo = CommonMotions.cnvInt(orderer[(int)GetData.seqNo]);
181
                    o.depositDate = CommonMotions.cnvString(orderer[(int)GetData.depositDate]);
182
                    o.depositAmount = CommonMotions.cnvInt(orderer[(int)GetData.depositAmount]);
183
                    o.depositAmountCash = CommonMotions.cnvInt(orderer[(int)GetData.depositAmountCash]);
184
                    o.depositAmountBill = CommonMotions.cnvInt(orderer[(int)GetData.depositAmountBill]);
185
                    o.depositPersonCode = CommonMotions.cnvInt(orderer[(int)GetData.depositPersonCode]);
186
                    o.personName = CommonMotions.cnvString(orderer[(int)GetData.personName]);
187
                    o.note = CommonMotions.cnvString(orderer[(int)GetData.note]);
188
                    o.AddEdit = 0;
189

  
190
                    Dlist.Add(o);
191
                }
192

  
193
                // 一覧表示
194
                Display();
195

  
196
            }
197
            catch (Exception ex)
198
            {
199
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
200
            }
201
        }
202
        #endregion
203

  
204
        #region 入金データを取得する
205
        /// <summary>
206
        /// 入金データを取得する
207
        /// </summary>
208
        /// <returns></returns>
209
        private ArrayList SelectDepositData()
210
        {
211
            var Dep = new IODepositData();
212
            int Od = depositdata.OrderersDivision;
213
            int Oc = depositdata.OrderersCode;
214
            string Tg = depositdata.TargetDate;
215

  
216
            try
217
            {
218
                var sql = new StringBuilder();
219
                sql.Append(" ( ");
220
                sql.Append("  SELECT ");
221
                sql.Append("   CONCAT(OrderersName1, ' ', OrderersName2) AS ORDERERSNAME ");
222
                sql.Append("   , ORDERCOTEGORY AS ORDERERSDIVISION ");
223
                sql.Append("   , ORDERERSCODE AS ORDERERSCODE ");
224
                sql.AppendFormat("   , {0} AS TARGETDATE ", Tg);
225
                sql.Append("   , NULL AS SEQNO ");
226
                sql.Append("   , NULL AS DEPOSITDATE ");
227
                sql.Append("   , NULL AS DEPOSITAMOUNT ");
228
                sql.Append("   , NULL AS DEPOSITAMOUNTCASH ");
229
                sql.Append("   , NULL AS DEPOSITAMOUNTBILL ");
230
                sql.Append("   , NULL AS DEPOSITPERSONCODE ");
231
                sql.Append("   , NULL AS PERSONNAME ");
232
                sql.Append("   , NULL AS NOTE ");
233
                sql.Append("  FROM ");
234
                sql.Append("   ORDERERSMASTER ");
235
                sql.Append("  WHERE ");
236
                sql.AppendFormat("   ORDERCOTEGORY = {0} ", Od);
237
                sql.AppendFormat("  AND ORDERERSCODE = {0} ", Oc);
238
                sql.Append(" ) ");
239
                sql.Append(" UNION ");
240
                sql.Append(" ( ");
241
                sql.Append("  SELECT ");
242
                sql.Append("   NULL AS ORDERERSNAME ");
243
                sql.Append("   , DEP.ORDERERSDIVISION ");
244
                sql.Append("   , DEP.ORDERERSCODE ");
245
                sql.Append("   , DEP.TARGETDATE ");
246
                sql.Append("   , DEP.SEQNO ");
247
                sql.Append("   , DATE_FORMAT(DEP.DEPOSITDATE, '%m/%d') AS DEPOSITDATE");
248
                sql.Append("   , DEP.DEPOSITAMOUNT ");
249
                sql.Append("   , DEP.DEPOSITAMOUNTCASH ");
250
                sql.Append("   , DEP.DEPOSITAMOUNTBILL ");
251
                sql.Append("   , DEP.DEPOSITPERSONCODE ");
252
                sql.Append("   , PICM.SEALPRINTNAME AS PERSONNAME");
253
                sql.Append("   , DEP.NOTE ");
254
                sql.Append("  FROM ");
255
                sql.Append("   DEPOSITDATA AS DEP ");
256
                sql.Append("   LEFT OUTER JOIN PERSONINCHARGEMASTER PICM ON ");
257
                sql.Append("    PICM.PERSONCODE = DEP.DEPOSITPERSONCODE ");
258
                sql.AppendFormat("  WHERE ORDERERSDIVISION ={0} ", Od);
259
                sql.AppendFormat("   AND ORDERERSCODE = {0} ", Oc);
260
                sql.AppendFormat("   AND TARGETDATE = {0} ", Tg);
261
                sql.Append(" ) ");
262
                sql.Append(" ORDER BY ");
263
                sql.Append(" ORDERERSNAME ");
264
                sql.Append(" ,SEQNO ");
265
                sql.Append(" ; ");
266

  
267
                var data = new ArrayList();
268
                if (!Dep.ExecuteReader(sql.ToString(), ref data)) return new ArrayList();
269
                return data;
270
            }
271
            catch (Exception ex)
272
            {
273
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
274
                return new ArrayList();
275
            }
276
            finally
277
            {
278
                Dep.close();
279
                Dep = null;
280
            }
281
        }
282
        #endregion
283

  
284
        #region 一覧表示
285
        /// <summary>
286
        /// 一覧表示
287
        /// </summary>
288
        private void Display()
289
        {
290
            try
291
            {
292
                for (var i = 0; i < Dlist.Count; i++)
293
                {
294
                    dgv1.Rows.Add();
295
                    dgv1.Rows[i].Cells[(int)DispColumn.orderersDivision].Value = Dlist[i].orderersDivision;
296
                    dgv1.Rows[i].Cells[(int)DispColumn.orderersCode].Value = Dlist[i].orderersCode;
297
                    dgv1.Rows[i].Cells[(int)DispColumn.targetDate].Value = Dlist[i].targetDate;
298
                    dgv1.Rows[i].Cells[(int)DispColumn.depositDate].Value = Dlist[i].depositDate;
299
                    dgv1.Rows[i].Cells[(int)DispColumn.BusinessPeriod].Value = CommonMotions.SystemMasterData.BusinessPeriod;
300
                    SetPrice(dgv1.Rows[i].Cells, (int)DispColumn.depositAmount, Dlist[i].depositAmountCash + Dlist[i].depositAmountBill);
301
                    SetPrice(dgv1.Rows[i].Cells, (int)DispColumn.depositAmountCash, Dlist[i].depositAmountCash);
302
                    SetPrice(dgv1.Rows[i].Cells, (int)DispColumn.depositAmountBill, Dlist[i].depositAmountBill);
303

  
304
                    if (Dlist[i].depositPersonCode != 0)
305
                    {
306
                        dgv1.Rows[i].Cells[(int)DispColumn.seqNo].Value = Dlist[i].seqNo;
307
                        dgv1.Rows[i].Cells[(int)DispColumn.depositPersonCode].Value = Dlist[i].depositPersonCode;
308
                        dgv1.Rows[i].Cells[(int)DispColumn.personName].Value = Dlist[i].personName;
309
                        dgv1.Rows[i].Cells[(int)DispColumn.personName].Style.ForeColor = Color.Red;
310
                    }
311
                    else
312
                    {
313
                        dgv1.Rows[i].Cells[(int)DispColumn.seqNo].Value = i;
314
                        dgv1.Rows[i].Cells[(int)DispColumn.depositPersonCode].Value = CommonMotions.LoginUserData.PersonCode;
315
                        dgv1.Rows[i].Cells[(int)DispColumn.personName].Value = CommonMotions.LoginUserData.SealPrintName;
316
                        dgv1.Rows[i].Cells[(int)DispColumn.personName].Style.ForeColor = Color.Gray;
317
                    }
318
                    dgv1.Rows[i].Cells[(int)DispColumn.note].Value = Dlist[i].note;
319
                }
320
            }
321
            catch (Exception ex)
322
            {
323
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
324
            }
325
        }
326
        #endregion
327

  
328
        #region 金額の設定
329
        /// <summary>
330
        /// 金額の設定
331
        /// </summary>
332
        /// <param name="cells"></param>
333
        /// <param name="index"></param>
334
        /// <param name="price"></param>
335
        private void SetPrice(DataGridViewCellCollection cells, int index, long price)
336
        {
337
            try
338
            {
339
                cells[index].Value = price.ToString("#,0");
340
                cells[index].Style.ForeColor = Color.Black;
341
                if (price < 0)
342
                {
343
                    cells[index].Style.ForeColor = Color.Red;
344
                }
345
            }
346
            catch (Exception ex)
347
            {
348
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
349
            }
350
        }
351
        #endregion
352

  
353
        #region セル編集開始
354
        /// <summary>
355
        /// セル編集開始
356
        /// </summary>
357
        /// <param name="sender"></param>
358
        /// <param name="e"></param>
359
        private void dgv1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
360
        {
361
            dgv1.CellBeginEdit -= dgv1_CellBeginEdit;
362
            dgv1.CellValueChanged -= dgv1_CellValueChanged;
363

  
364
            int tcol = e.ColumnIndex;
365
            int trow = e.RowIndex;
366

  
367
            try
368
            {
369
                if ((tcol == (int)DispColumn.depositAmountCash) ||
370
                (tcol == (int)DispColumn.depositAmountBill))
371
                {
372
                    string val;
373

  
374
                    // セルに値が格納されている場合
375
                    if (dgv1[tcol, trow].Value != null)
376
                    {
377
                        // カンマ区切りを解除
378
                        val = dgv1[tcol, trow].Value.ToString().Replace(",", string.Empty);
379
                    }
380
                    else
381
                    {
382
                        // 0を入力
383
                        val = "0";
384
                    }
385
                    dgv1[tcol, trow].Value = val;
386

  
387
                    // 文字色は一律黒
388
                    dgv1[tcol, trow].Style.ForeColor = Color.Black;
389

  
390
                }
391
                dgv1.CellBeginEdit += dgv1_CellBeginEdit;
392
                dgv1.CellValueChanged += dgv1_CellValueChanged;
393
            }
394
            catch (Exception ex)
395
            {
396
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
397
            }
398
        }
399
        #endregion
400

  
401
        #region セルフォーカス取得
402
        /// <summary>
403
        /// セル編集開始時のイベント
404
        /// </summary>
405
        /// <param name="sender"></param>
406
        /// <param name="e"></param>
407
        private void dgv1_CellEnter(object sender, DataGridViewCellEventArgs e)
408
        {
409
            try
410
            {
411
                if (dgv1.RowCount == 0)
412
                {
413
                    return;
414
                }
415
                oldCellValue = CommonMotions.cnvString(dgv1[e.ColumnIndex, e.RowIndex].Value);
416

  
417
            }
418
            catch (Exception ex)
419
            {
420
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
421
            }
422
        }
423
        #endregion
424

  
425
        #region セル編集完了時のイベント
426
        /// <summary>
427
        /// セル編集完了時のイベント
428
        /// </summary>
429
        /// <param name="sender"></param>
430
        /// <param name="e"></param>
431
        private void dgv1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
432
        {
433
            dgv1.CellEnter -= dgv1_CellEnter;
434
            dgv1.CellValueChanged -= dgv1_CellValueChanged;
435

  
436
            try
437
            {
438

  
439
                // 行が追加されたときではなく、セルの内容が変更されているときだけ処理を実行する。また金額以外の変更は処理を抜ける。
440
                if (e.RowIndex == dgv1.NewRowIndex ||
441
                    !dgv1.IsCurrentCellDirty //||
442
                    //e.ColumnIndex == (int)DispColumn.depositAmountBill ||
443
                    //e.ColumnIndex != (int)DispColumn.depositAmountCash
444
                    )
445
                {
446
                    return;
447
                }
448

  
449
                // 行がなければそのまま返す
450
                if (dgv1.RowCount == 0)
451
                {
452
                    return;
453
                }
454

  
455
                var cells = dgv1.Rows[e.RowIndex].Cells;
456
                var cellValue = CommonMotions.cnvString(cells[e.ColumnIndex].Value);
457

  
458
                // 値が変わっていなければそのまま返す
459
                if (oldCellValue == cellValue)
460
                {
461
                    return;
462
                }
463
                try
464
                {
465
                    // 日付の自動編集
466
                    if (dgv1.Rows[e.RowIndex].Cells[e.ColumnIndex].ColumnIndex == (int)DispColumn.depositDate)
467
                    {
468
                        string txtbox = dgv1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
469

  
470
                        // 日付をyyyy/mm/dd形式で表示する
471
                        if (txtbox.Length == 0)
472
                        {
473
                            return;
474
                        }
475

  
476
                        // 文字の出現回数カウント
477
                        if (CommonMotions.chkNumeric(txtbox))
478
                        {   // 数字のみ入力
479
                            if (txtbox.ToString().Length <= 4)
480
                            {
481
                                txtbox = CommonMotions.cnvInt(txtbox.Substring(0, 2)).ToString("00")
482
                                    + "/" + CommonMotions.cnvInt(txtbox.Substring(2)).ToString("00");
483
                            }
484
                        }
485
                        else
486
                        {   // 99/99の入力
487
                            if (txtbox.ToString().Length <= 5)
488
                            {
489
                                txtbox = CommonMotions.cnvInt(txtbox.Substring(0, txtbox.IndexOf("/"))).ToString("00")
490
                                                + "/" + CommonMotions.cnvInt(txtbox.Substring(txtbox.IndexOf("/") + 1)).ToString("00");
491

  
492
                            }
493
                        }
494

  
495
                        if (!CommonMotions.chkDate(txtbox.ToString()))
496
                        {
497
                            throw new Exception();
498
                        }
499

  
500
                        dgv1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = txtbox.ToString();
501
                        cellValue = txtbox.ToString();
502
                    }
503
                }
504
                catch(Exception ex)
505
                {
506
                    logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
507
                    MessageBox.Show("入金日の値が不正です", "登録エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
508
                    dgv1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "";
509
                }
510

  
511
                // 入金情報を編集
512
                if (e.ColumnIndex == (int)DispColumn.depositAmountCash
513
                    || e.ColumnIndex == (int)DispColumn.depositAmountBill
514
                    || e.ColumnIndex == (int)DispColumn.depositDate
515
                    || e.ColumnIndex == (int)DispColumn.note)
516
                {
517
                    switch (e.ColumnIndex)
518
                    {
519
                        case (int)DispColumn.depositAmountCash:
520
                            if (cellValue != "")
521
                                Dlist[e.RowIndex].depositAmountCash = (int)CommonMotions.cnvLong(cellValue);
522
                            else
523
                                Dlist[e.RowIndex].depositAmountCash = 0;
524
                            break;
525
                        case (int)DispColumn.depositAmountBill:
526
                            if (cellValue != "")
527
                                Dlist[e.RowIndex].depositAmountBill = (int)CommonMotions.cnvLong(cellValue);
528
                            else
529
                                Dlist[e.RowIndex].depositAmountBill = 0;
530
                            break;
531
                        case (int)DispColumn.depositDate:
532
                            DateTime dt;
533
                            if (DateTime.TryParse(cellValue, out dt))
534
                                Dlist[e.RowIndex].depositDate = dt.ToString("yyyy/MM/dd");
535
                            else
536
                                Dlist[e.RowIndex].depositDate = "";
537
                            break;
538
                        case (int)DispColumn.note:
539
                            if (cellValue != "")
540
                                Dlist[e.RowIndex].note = CommonMotions.cnvString(cellValue);
541
                            else
542
                                Dlist[e.RowIndex].note = "";
543
                            break;
544
                    }
545

  
546
                    if (dgv1.Rows[e.RowIndex].Cells[(int)DispColumn.seqNo].Value == null)
547
                    {
548
                        return;
549
                    }
550
                    int seqno = (int)dgv1.Rows[e.RowIndex].Cells[(int)DispColumn.seqNo].Value + 1;
551
                    if (seqno == Dlist.Count)
552
                    {
553
                        Dlist[e.RowIndex].AddEdit = 1;
554
                    }
555
                    else
556
                    {
557
                        Dlist[e.RowIndex].AddEdit = 2;
558
                    }
559
                }
560
            }
561
            catch (Exception ex)
562
            {
563
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
564
            }
565
            finally
566
            {
567
                dgv1.CellEnter += dgv1_CellEnter;
568
                dgv1.CellValueChanged += dgv1_CellValueChanged;
569
            }
570
        }
571
        #endregion
572

  
573
        #region 金額セル検証
574
        /// <summary>
575
        /// 金額セル検証
576
        /// </summary>
577
        /// <param name="sender"></param>
578
        /// <param name="e"></param>
579
        private void dgv1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
580
        {
581
            int tcol = e.ColumnIndex;
582
            int trow = e.RowIndex;
583

  
584
            if (trow == -1)
585
            {
586
                return;
587
            }
588

  
589
            try
590
            {
591
                if ((tcol == (int)DispColumn.depositAmountCash) ||              // 入金金額(振込)
592
                   (tcol == (int)DispColumn.depositAmountBill))                // 入金金額(手形)
593
                {
594
                    // カンマは一旦削除して文字列を取得
595
                    string str = e.FormattedValue.ToString().Replace(",", string.Empty); ;
596

  
597
                    // 不要な空白は削除
598
                    str.Trim();
599

  
600
                    // 値が未設定の場合は0とする
601
                    if (str == "")
602
                    {
603
                        str = "0";
604
                    }
605

  
606
                    long n = 0;
607

  
608
                    if (long.TryParse(str, out n) == true)
609
                    {
610
                        if ((n > amount_max) || (n < amount_min))
611
                        {
612
                            MessageBox.Show("金額が登録可能範囲(-9,999,999,999~9,999,999,999)を超えました。", "入力エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
613
                            e.Cancel = true;
614
                        }
615
                    }
616
                    else
617
                    {
618
                        MessageBox.Show("金額を入力してください", "入力エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
619
                        e.Cancel = true;
620
                    }
621
                }
622
                return;
623
            }
624
            catch (Exception ex)
625
            {
626
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
627
            }
628
        }
629
        #endregion
630

  
631
        #region セルフォーマッティング
632
        /// <summary>
633
        /// セルフォーマッティング
634
        /// </summary>
635
        /// <param name="sender"></param>
636
        /// <param name="e"></param>
637
        private void dgv1_CellFormatting_1(object sender, DataGridViewCellFormattingEventArgs e)
638
        {
639
            DataGridView dgv = (DataGridView)sender;
640

  
641
            try
642
            {
643
                if (dgv.RowCount == 0)
644
                    return;
645

  
646
                if (e.ColumnIndex == (int)DispColumn.depositAmountBill ||
647
                    e.ColumnIndex == (int)DispColumn.depositAmountCash)
648
                {
649
                    // マイナス値は赤
650
                    if (CommonMotions.cnvInt(dgv[e.ColumnIndex, e.RowIndex].Value) < 0)
651
                    {
652
                        dgv[e.ColumnIndex, e.RowIndex].Style.ForeColor = Color.Red;
653
                    }
654
                    else
655
                    {
656
                        dgv[e.ColumnIndex, e.RowIndex].Style.ForeColor = SystemColors.ControlText;
657
                    }
658

  
659
                    dgv[e.ColumnIndex, e.RowIndex].Value = CommonMotions.cnvInt(dgv[e.ColumnIndex, e.RowIndex].Value).ToString("#,0");
660
                }
661

  
662
            }
663
            catch (Exception ex)
664
            {
665
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
666
            }
667
        }
668
        #endregion
669

  
670
        #region 削除ボタン押下
671
        private void btnDelete_Click(object sender, EventArgs e)
672
        {
673
            try
674
            {
675
                if (MessageBox.Show("選択しているデータを削除します。よろしいですか。", "削除確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
676
                {
677
                    return;
678
                }
679
                int row = dgv1.CurrentCell.RowIndex;
680
                Dlist[row].AddEdit = 3;
681
                //CommonMotions.RemoveEndMessage("入金データ");
682
                dgv1.Rows[row].Cells[(int)DispColumn.note].Value = "登録ボタンで削除完了";
683
                dgv1.Rows[row].Cells[(int)DispColumn.note].Style.ForeColor = Color.Red;
684
            }
685
            catch (Exception ex)
686
            {
687
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
688
            }
689

  
690
        }
691
        #endregion
692

  
693
        #region 登録ボタン押下
694
        private void btnAccept_Click(object sender, EventArgs e)
695
        {
696
            dgv1.CellEnter -= dgv1_CellEnter;
697
            dgv1.CellValueChanged -= dgv1_CellValueChanged;
698

  
699
            var ioDepositData = new IODepositData();
700

  
701
            try
702
            {
703
                if (MessageBox.Show("表示中のデータを登録します。", "登録確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
704
                {
705
                    return;
706
                }
707

  
708
                for (int i = 0; i < Dlist.Count; i++)
709
                {
710
                    if (Dlist[i].AddEdit == 0)
711
                    {
712
                        continue;
713
                    }
714
                    #region 入力内容をチェック
715

  
716
                    // 入金日入力済みで入金金額が入力されていない
717
                    if (!string.IsNullOrEmpty(Dlist[i].depositDate)
718
                        && string.IsNullOrEmpty(Dlist[i].depositAmountCash.ToString())
719
                        && string.IsNullOrEmpty(Dlist[i].depositAmountBill.ToString()))
720
                    {
721
                        // エラー表示
722
                        MessageBox.Show("入金日が登録されている行に入金金額が入力されていません。", "登録エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
723

  
724
                        return;
725
                    }
726
                    // 入金金額入力済みで入金日が入力されていない
727
                    if (string.IsNullOrEmpty(Dlist[i].depositDate)
728
                        && (!string.IsNullOrEmpty(Dlist[i].depositAmountCash.ToString())
729
                        || !string.IsNullOrEmpty(Dlist[i].depositAmountBill.ToString())))
730
                    {
731
                        // エラー表示
732
                        MessageBox.Show("入金金額が登録されている行に入金日が入力されていません。", "登録エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
733

  
734
                        return;
735
                    }
736
                    #endregion
737

  
738
                    ioDepositData.connect();
739

  
740
                    #region 登録処理
741
                    string m_note = dgv1.Rows[i].Cells[(int)DispColumn.note].Value.ToString();
742
                    if (m_note == null)
743
                    {
744
                        m_note = "";
745
                    }
746
                    var depositData = new DepositData()
747
                    {
748
                        OrderersDivision = Dlist[i].orderersDivision,
749
                        OrderersCode = Dlist[i].orderersCode,
750
                        TargetDate = Dlist[i].targetDate.ToString(),
751
                        SeqNo = (int)dgv1.Rows[i].Cells[(int)DispColumn.seqNo].Value,
752
                        BusinessPeriod = CommonMotions.SystemMasterData.BusinessPeriod,
753
                        DepositDate = DateTime.Parse(Dlist[i].depositDate),
754
                        DepositAmount = Dlist[i].depositAmountCash + Dlist[i].depositAmountBill,
755
                        DepositAmountCash = Dlist[i].depositAmountCash,
756
                        DepositAmountBill = Dlist[i].depositAmountBill,
757
                        DepositPersonCode = (int)dgv1.Rows[i].Cells[(int)DispColumn.depositPersonCode].Value,
... 差分の行数が表示可能な上限を超えました。超過分は表示しません。

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