Переглянути джерело

應收帳款設計,未完成

Signed-off-by: B70340 <b70340@gmail.com>
B70340 5 роки тому
джерело
коміт
9cb7745c97

BIN
.vs/MAOJI-ERP-SYS/v16/.suo Переглянути файл


+ 21
- 1
MaoOrange-Hongji/Module1/SQL_Module.vb Переглянути файл

899
         ConnOpen() : SQL1 = "SELECT 會計科目 FROM 會計科目 WHERE (層級 LIKE '1') AND (停用 IS NULL OR 停用 = 0) ORDER BY  會計科目" : CmdSet_For_dr()
899
         ConnOpen() : SQL1 = "SELECT 會計科目 FROM 會計科目 WHERE (層級 LIKE '1') AND (停用 IS NULL OR 停用 = 0) ORDER BY  會計科目" : CmdSet_For_dr()
900
     End Sub
900
     End Sub
901
     Friend Sub SQL_營運成本收支_決算表_彙總借貸()
901
     Friend Sub SQL_營運成本收支_決算表_彙總借貸()
902
-        ConnOpen() : SQL1 = "SELECT 抵銷科目 FROM dbo.會計科目 WHERE (層級 LIKE 1) AND (會計科目 LIKE '" & PA1 & "')" : CmdSet_For_dr()
902
+        ConnOpen() : SQL1 = "SELECT 抵銷科目 FROM 會計科目 WHERE (層級 LIKE 1) AND (會計科目 LIKE '" & PA1 & "')" : CmdSet_For_dr()
903
     End Sub
903
     End Sub
904
     '---------------------營運成本收支單_對帳表-----------------------------------------------------------------------------------------------------------------
904
     '---------------------營運成本收支單_對帳表-----------------------------------------------------------------------------------------------------------------
905
     Friend Sub SQL_營運成本收支_決算表_清單()
905
     Friend Sub SQL_營運成本收支_決算表_清單()
2114
     Friend Sub SQL_系統通用變數管理刪除()
2114
     Friend Sub SQL_系統通用變數管理刪除()
2115
         SQL1 = "DELETE FROM 通用預設值管理表一 WHERE (流水號 = N'" & PA1 & "')"
2115
         SQL1 = "DELETE FROM 通用預設值管理表一 WHERE (流水號 = N'" & PA1 & "')"
2116
     End Sub
2116
     End Sub
2117
+    '---------------------應收帳款控制表-----------------------------------------------------------------------------------------------------------------
2118
+    Friend Sub SQL_應收賬款清單()
2119
+        If 應收帳款控制表.CheckBox3.Checked = False Then
2120
+            KKKJJ = " WHERE (倉儲明細表.狀態 LIKE '銷售出庫') AND (倉儲明細表.倉儲作業 NOT LIKE '') AND (倉儲明細表.公司編號 LIKE '%" & 公司編號 & "%') AND 
2121
+                            (倉儲明細表.倉儲作業 BETWEEN '" & Format(應收帳款控制表.DateTimePicker1.Value, "yyyy/MM/dd") & "' AND '" & Format(應收帳款控制表.DateTimePicker2.Value, "yyyy/MM/dd") & "') "
2122
+        ElseIf 應收帳款控制表.CheckBox3.Checked = True Then
2123
+            KKKJJ = " WHERE (倉儲明細表.狀態 LIKE '銷售出庫') AND (倉儲明細表.倉儲作業 NOT LIKE '') AND (倉儲明細表.公司編號 LIKE '%" & 公司編號 & "%') AND 
2124
+                            (倉儲明細表.倉儲作業 BETWEEN '" & Format(應收帳款控制表.DateTimePicker1.Value, "yyyy/MM/dd") & "' AND '" & Format(應收帳款控制表.DateTimePicker2.Value, "yyyy/MM/dd") & "') AND 
2125
+                            (倉儲明細表.應收立帳 IS NULL OR 倉儲明細表.應收立帳 = 0)"
2126
+        End If
2127
+        ConnOpen()
2128
+        SQL1 = "SELECT      倉儲明細表.單據編號, 倉儲明細表.客戶編號, 客戶資料表.簡稱 AS 客戶, 物料資料庫.料號, 物料資料庫.頁碼, 
2129
+                            物料資料庫.品名, 倉儲明細表.售價 AS 單價, 倉儲明細表.匯率, 倉儲明細表.出庫, 
2130
+                            倉儲明細表.售價 * 倉儲明細表.匯率 * 倉儲明細表.出庫 AS 金額, 倉儲明細表.採購下單, 倉儲明細表.出庫日期, 
2131
+                            倉儲明細表.備註, 倉儲明細表.應付立帳 AS 選擇, 倉儲明細表.應收立帳, 倉儲明細表.資料流水號, 倉儲明細表.收款狀態 
2132
+                FROM        倉儲明細表 INNER JOIN 客戶資料表 ON 倉儲明細表.客戶編號 = 客戶資料表.編號 LEFT OUTER JOIN
2133
+                            物料資料庫 ON 倉儲明細表.料號 = 物料資料庫.料號 " & KKKJJ & "
2134
+                ORDER BY    倉儲明細表.單據編號, 倉儲明細表.出庫日期"
2135
+        CmdSet_For_DGV()
2136
+    End Sub
2117
 End Module
2137
 End Module

BIN
MaoOrange-Hongji/bin/Debug/MAOJI-ERP-SYS.exe Переглянути файл


BIN
MaoOrange-Hongji/bin/Debug/MAOJI-ERP-SYS.pdb Переглянути файл


BIN
MaoOrange-Hongji/obj/Debug/MAOJI-ERP-SYS.exe Переглянути файл


BIN
MaoOrange-Hongji/obj/Debug/MAOJI-ERP-SYS.pdb Переглянути файл


BIN
MaoOrange-Hongji/obj/Debug/MAOJI-ERP-SYS.vbproj.GenerateResource.cache Переглянути файл


BIN
MaoOrange-Hongji/obj/Debug/MAOJI-ERP-SYS.vbprojAssemblyReference.cache Переглянути файл


+ 434
- 31
MaoOrange-Hongji/財務系統管理/應收帳款控制表.Designer.vb Переглянути файл

22
     '請勿使用程式碼編輯器進行修改。
22
     '請勿使用程式碼編輯器進行修改。
23
     <System.Diagnostics.DebuggerStepThrough()> _
23
     <System.Diagnostics.DebuggerStepThrough()> _
24
     Private Sub InitializeComponent()
24
     Private Sub InitializeComponent()
25
-        Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
26
-        Dim DataGridViewCellStyle2 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
25
+        Dim DataGridViewCellStyle5 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
26
+        Dim DataGridViewCellStyle6 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
27
+        Me.DataGridView1 = New System.Windows.Forms.DataGridView()
27
         Me.Button1 = New System.Windows.Forms.Button()
28
         Me.Button1 = New System.Windows.Forms.Button()
28
         Me.一般月 = New System.Windows.Forms.CheckBox()
29
         Me.一般月 = New System.Windows.Forms.CheckBox()
29
         Me.會計月 = New System.Windows.Forms.CheckBox()
30
         Me.會計月 = New System.Windows.Forms.CheckBox()
31
         Me.Label4 = New System.Windows.Forms.Label()
32
         Me.Label4 = New System.Windows.Forms.Label()
32
         Me.DateTimePicker2 = New System.Windows.Forms.DateTimePicker()
33
         Me.DateTimePicker2 = New System.Windows.Forms.DateTimePicker()
33
         Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker()
34
         Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker()
34
-        Me.DataGridView1 = New System.Windows.Forms.DataGridView()
35
+        Me.TextBox5 = New System.Windows.Forms.TextBox()
36
+        Me.TextBox4 = New System.Windows.Forms.TextBox()
37
+        Me.Label8 = New System.Windows.Forms.Label()
38
+        Me.TextBox1 = New System.Windows.Forms.TextBox()
39
+        Me.Label7 = New System.Windows.Forms.Label()
40
+        Me.NumericUpDown2 = New System.Windows.Forms.NumericUpDown()
41
+        Me.Label2 = New System.Windows.Forms.Label()
42
+        Me.NumericUpDown1 = New System.Windows.Forms.NumericUpDown()
43
+        Me.Label1 = New System.Windows.Forms.Label()
44
+        Me.Button6 = New System.Windows.Forms.Button()
45
+        Me.TextBox2 = New System.Windows.Forms.TextBox()
46
+        Me.CheckBox1 = New System.Windows.Forms.CheckBox()
47
+        Me.DateTimePicker3 = New System.Windows.Forms.DateTimePicker()
48
+        Me.Button5 = New System.Windows.Forms.Button()
49
+        Me.Button4 = New System.Windows.Forms.Button()
50
+        Me.ComboBox7 = New System.Windows.Forms.ComboBox()
51
+        Me.TextBox9 = New System.Windows.Forms.TextBox()
52
+        Me.ComboBox4 = New System.Windows.Forms.ComboBox()
53
+        Me.ComboBox3 = New System.Windows.Forms.ComboBox()
54
+        Me.ComboBox1 = New System.Windows.Forms.ComboBox()
55
+        Me.ComboBox5 = New System.Windows.Forms.ComboBox()
56
+        Me.ComboBox6 = New System.Windows.Forms.ComboBox()
57
+        Me.Label5 = New System.Windows.Forms.Label()
58
+        Me.Button12 = New System.Windows.Forms.Button()
59
+        Me.Button13 = New System.Windows.Forms.Button()
60
+        Me.TextBox3 = New System.Windows.Forms.TextBox()
61
+        Me.Label3 = New System.Windows.Forms.Label()
62
+        Me.Label6 = New System.Windows.Forms.Label()
63
+        Me.CheckBox2 = New System.Windows.Forms.CheckBox()
64
+        Me.CheckBox3 = New System.Windows.Forms.CheckBox()
65
+        Me.ComboBox2 = New System.Windows.Forms.ComboBox()
35
         CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).BeginInit()
66
         CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).BeginInit()
67
+        CType(Me.NumericUpDown2, System.ComponentModel.ISupportInitialize).BeginInit()
68
+        CType(Me.NumericUpDown1, System.ComponentModel.ISupportInitialize).BeginInit()
36
         Me.SuspendLayout()
69
         Me.SuspendLayout()
37
         '
70
         '
71
+        'DataGridView1
72
+        '
73
+        DataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer))
74
+        Me.DataGridView1.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle5
75
+        Me.DataGridView1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
76
+            Or System.Windows.Forms.AnchorStyles.Left) _
77
+            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
78
+        Me.DataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill
79
+        Me.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
80
+        Me.DataGridView1.Location = New System.Drawing.Point(7, 82)
81
+        Me.DataGridView1.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
82
+        Me.DataGridView1.Name = "DataGridView1"
83
+        Me.DataGridView1.RowHeadersWidth = 5
84
+        DataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
85
+        Me.DataGridView1.RowsDefaultCellStyle = DataGridViewCellStyle6
86
+        Me.DataGridView1.RowTemplate.Height = 24
87
+        Me.DataGridView1.Size = New System.Drawing.Size(1234, 517)
88
+        Me.DataGridView1.TabIndex = 1116
89
+        '
38
         'Button1
90
         'Button1
39
         '
91
         '
40
         Me.Button1.Font = New System.Drawing.Font("微軟正黑體", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
92
         Me.Button1.Font = New System.Drawing.Font("微軟正黑體", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
41
         Me.Button1.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
93
         Me.Button1.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
42
-        Me.Button1.Location = New System.Drawing.Point(333, 6)
94
+        Me.Button1.Location = New System.Drawing.Point(7, 54)
43
         Me.Button1.Name = "Button1"
95
         Me.Button1.Name = "Button1"
44
-        Me.Button1.Size = New System.Drawing.Size(64, 23)
96
+        Me.Button1.Size = New System.Drawing.Size(87, 23)
45
         Me.Button1.TabIndex = 1120
97
         Me.Button1.TabIndex = 1120
46
         Me.Button1.Text = "上個月"
98
         Me.Button1.Text = "上個月"
47
         Me.Button1.UseVisualStyleBackColor = True
99
         Me.Button1.UseVisualStyleBackColor = True
49
         '一般月
101
         '一般月
50
         '
102
         '
51
         Me.一般月.AutoSize = True
103
         Me.一般月.AutoSize = True
52
-        Me.一般月.Location = New System.Drawing.Point(270, 8)
104
+        Me.一般月.Location = New System.Drawing.Point(130, 31)
53
         Me.一般月.Name = "一般月"
105
         Me.一般月.Name = "一般月"
54
         Me.一般月.Size = New System.Drawing.Size(63, 20)
106
         Me.一般月.Size = New System.Drawing.Size(63, 20)
55
         Me.一般月.TabIndex = 1123
107
         Me.一般月.TabIndex = 1123
61
         Me.會計月.AutoSize = True
113
         Me.會計月.AutoSize = True
62
         Me.會計月.Checked = True
114
         Me.會計月.Checked = True
63
         Me.會計月.CheckState = System.Windows.Forms.CheckState.Checked
115
         Me.會計月.CheckState = System.Windows.Forms.CheckState.Checked
64
-        Me.會計月.Location = New System.Drawing.Point(211, 8)
116
+        Me.會計月.Location = New System.Drawing.Point(20, 31)
65
         Me.會計月.Name = "會計月"
117
         Me.會計月.Name = "會計月"
66
         Me.會計月.Size = New System.Drawing.Size(63, 20)
118
         Me.會計月.Size = New System.Drawing.Size(63, 20)
67
         Me.會計月.TabIndex = 1122
119
         Me.會計月.TabIndex = 1122
72
         '
124
         '
73
         Me.Button2.Font = New System.Drawing.Font("微軟正黑體", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
125
         Me.Button2.Font = New System.Drawing.Font("微軟正黑體", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
74
         Me.Button2.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
126
         Me.Button2.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
75
-        Me.Button2.Location = New System.Drawing.Point(398, 6)
127
+        Me.Button2.Location = New System.Drawing.Point(117, 55)
76
         Me.Button2.Name = "Button2"
128
         Me.Button2.Name = "Button2"
77
-        Me.Button2.Size = New System.Drawing.Size(64, 23)
129
+        Me.Button2.Size = New System.Drawing.Size(87, 23)
78
         Me.Button2.TabIndex = 1121
130
         Me.Button2.TabIndex = 1121
79
         Me.Button2.Text = "下個月"
131
         Me.Button2.Text = "下個月"
80
         Me.Button2.UseVisualStyleBackColor = True
132
         Me.Button2.UseVisualStyleBackColor = True
82
         'Label4
134
         'Label4
83
         '
135
         '
84
         Me.Label4.AutoSize = True
136
         Me.Label4.AutoSize = True
85
-        Me.Label4.Location = New System.Drawing.Point(99, 10)
137
+        Me.Label4.Location = New System.Drawing.Point(96, 8)
86
         Me.Label4.Name = "Label4"
138
         Me.Label4.Name = "Label4"
87
         Me.Label4.Size = New System.Drawing.Size(20, 16)
139
         Me.Label4.Size = New System.Drawing.Size(20, 16)
88
         Me.Label4.TabIndex = 1119
140
         Me.Label4.TabIndex = 1119
92
         '
144
         '
93
         Me.DateTimePicker2.DropDownAlign = System.Windows.Forms.LeftRightAlignment.Right
145
         Me.DateTimePicker2.DropDownAlign = System.Windows.Forms.LeftRightAlignment.Right
94
         Me.DateTimePicker2.Format = System.Windows.Forms.DateTimePickerFormat.[Short]
146
         Me.DateTimePicker2.Format = System.Windows.Forms.DateTimePickerFormat.[Short]
95
-        Me.DateTimePicker2.Location = New System.Drawing.Point(121, 6)
147
+        Me.DateTimePicker2.Location = New System.Drawing.Point(117, 4)
96
         Me.DateTimePicker2.Name = "DateTimePicker2"
148
         Me.DateTimePicker2.Name = "DateTimePicker2"
97
         Me.DateTimePicker2.Size = New System.Drawing.Size(87, 23)
149
         Me.DateTimePicker2.Size = New System.Drawing.Size(87, 23)
98
         Me.DateTimePicker2.TabIndex = 1118
150
         Me.DateTimePicker2.TabIndex = 1118
100
         'DateTimePicker1
152
         'DateTimePicker1
101
         '
153
         '
102
         Me.DateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.[Short]
154
         Me.DateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.[Short]
103
-        Me.DateTimePicker1.Location = New System.Drawing.Point(10, 6)
155
+        Me.DateTimePicker1.Location = New System.Drawing.Point(7, 4)
104
         Me.DateTimePicker1.Name = "DateTimePicker1"
156
         Me.DateTimePicker1.Name = "DateTimePicker1"
105
         Me.DateTimePicker1.Size = New System.Drawing.Size(87, 23)
157
         Me.DateTimePicker1.Size = New System.Drawing.Size(87, 23)
106
         Me.DateTimePicker1.TabIndex = 1117
158
         Me.DateTimePicker1.TabIndex = 1117
107
         '
159
         '
108
-        'DataGridView1
160
+        'TextBox5
109
         '
161
         '
110
-        DataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer))
111
-        Me.DataGridView1.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle1
112
-        Me.DataGridView1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
113
-            Or System.Windows.Forms.AnchorStyles.Left) _
114
-            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
115
-        Me.DataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill
116
-        Me.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
117
-        Me.DataGridView1.Location = New System.Drawing.Point(14, 59)
118
-        Me.DataGridView1.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
119
-        Me.DataGridView1.Name = "DataGridView1"
120
-        Me.DataGridView1.RowHeadersWidth = 5
121
-        DataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
122
-        Me.DataGridView1.RowsDefaultCellStyle = DataGridViewCellStyle2
123
-        Me.DataGridView1.RowTemplate.Height = 24
124
-        Me.DataGridView1.Size = New System.Drawing.Size(1225, 545)
125
-        Me.DataGridView1.TabIndex = 1116
162
+        Me.TextBox5.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
163
+        Me.TextBox5.Location = New System.Drawing.Point(657, 365)
164
+        Me.TextBox5.Name = "TextBox5"
165
+        Me.TextBox5.Size = New System.Drawing.Size(190, 23)
166
+        Me.TextBox5.TabIndex = 1195
167
+        '
168
+        'TextBox4
169
+        '
170
+        Me.TextBox4.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
171
+        Me.TextBox4.Location = New System.Drawing.Point(657, 336)
172
+        Me.TextBox4.Name = "TextBox4"
173
+        Me.TextBox4.Size = New System.Drawing.Size(190, 23)
174
+        Me.TextBox4.TabIndex = 1193
175
+        '
176
+        'Label8
177
+        '
178
+        Me.Label8.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
179
+        Me.Label8.AutoSize = True
180
+        Me.Label8.ForeColor = System.Drawing.Color.Red
181
+        Me.Label8.Location = New System.Drawing.Point(852, 48)
182
+        Me.Label8.Name = "Label8"
183
+        Me.Label8.Size = New System.Drawing.Size(385, 32)
184
+        Me.Label8.TabIndex = 1191
185
+        Me.Label8.Text = "選擇銷售單號執行開立傳票時實收金額會自動以會計科目-應收帳款立帳" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "未收餘額如果不為零則需要手動選擇會計科目。推薦使用-應收賬款折讓" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10)
186
+        '
187
+        'TextBox1
188
+        '
189
+        Me.TextBox1.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
190
+        Me.TextBox1.Location = New System.Drawing.Point(657, 307)
191
+        Me.TextBox1.Name = "TextBox1"
192
+        Me.TextBox1.Size = New System.Drawing.Size(190, 23)
193
+        Me.TextBox1.TabIndex = 1190
194
+        '
195
+        'Label7
196
+        '
197
+        Me.Label7.AutoSize = True
198
+        Me.Label7.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
199
+        Me.Label7.Location = New System.Drawing.Point(390, 57)
200
+        Me.Label7.Name = "Label7"
201
+        Me.Label7.Size = New System.Drawing.Size(56, 16)
202
+        Me.Label7.TabIndex = 1189
203
+        Me.Label7.Text = "未收餘額"
204
+        '
205
+        'NumericUpDown2
206
+        '
207
+        Me.NumericUpDown2.Location = New System.Drawing.Point(446, 55)
208
+        Me.NumericUpDown2.Maximum = New Decimal(New Integer() {1000000, 0, 0, 0})
209
+        Me.NumericUpDown2.Minimum = New Decimal(New Integer() {1000000, 0, 0, -2147483648})
210
+        Me.NumericUpDown2.Name = "NumericUpDown2"
211
+        Me.NumericUpDown2.Size = New System.Drawing.Size(100, 23)
212
+        Me.NumericUpDown2.TabIndex = 1188
213
+        Me.NumericUpDown2.ThousandsSeparator = True
214
+        '
215
+        'Label2
216
+        '
217
+        Me.Label2.AutoSize = True
218
+        Me.Label2.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
219
+        Me.Label2.Location = New System.Drawing.Point(390, 31)
220
+        Me.Label2.Name = "Label2"
221
+        Me.Label2.Size = New System.Drawing.Size(56, 16)
222
+        Me.Label2.TabIndex = 1187
223
+        Me.Label2.Text = "實收金額"
224
+        '
225
+        'NumericUpDown1
226
+        '
227
+        Me.NumericUpDown1.Location = New System.Drawing.Point(446, 29)
228
+        Me.NumericUpDown1.Maximum = New Decimal(New Integer() {1000000, 0, 0, 0})
229
+        Me.NumericUpDown1.Minimum = New Decimal(New Integer() {1000000, 0, 0, -2147483648})
230
+        Me.NumericUpDown1.Name = "NumericUpDown1"
231
+        Me.NumericUpDown1.Size = New System.Drawing.Size(100, 23)
232
+        Me.NumericUpDown1.TabIndex = 1186
233
+        Me.NumericUpDown1.ThousandsSeparator = True
234
+        '
235
+        'Label1
236
+        '
237
+        Me.Label1.AutoSize = True
238
+        Me.Label1.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
239
+        Me.Label1.Location = New System.Drawing.Point(390, 7)
240
+        Me.Label1.Name = "Label1"
241
+        Me.Label1.Size = New System.Drawing.Size(56, 16)
242
+        Me.Label1.TabIndex = 1185
243
+        Me.Label1.Text = "應收金額"
244
+        '
245
+        'Button6
246
+        '
247
+        Me.Button6.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
248
+        Me.Button6.Font = New System.Drawing.Font("微軟正黑體", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
249
+        Me.Button6.ForeColor = System.Drawing.Color.Olive
250
+        Me.Button6.Location = New System.Drawing.Point(1087, 2)
251
+        Me.Button6.Name = "Button6"
252
+        Me.Button6.Size = New System.Drawing.Size(82, 47)
253
+        Me.Button6.TabIndex = 1184
254
+        Me.Button6.Text = "依據單號取消立帳選擇"
255
+        Me.Button6.UseVisualStyleBackColor = True
256
+        '
257
+        'TextBox2
258
+        '
259
+        Me.TextBox2.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
260
+        Me.TextBox2.Location = New System.Drawing.Point(446, 4)
261
+        Me.TextBox2.Name = "TextBox2"
262
+        Me.TextBox2.Size = New System.Drawing.Size(100, 23)
263
+        Me.TextBox2.TabIndex = 1183
264
+        '
265
+        'CheckBox1
266
+        '
267
+        Me.CheckBox1.AutoSize = True
268
+        Me.CheckBox1.Checked = True
269
+        Me.CheckBox1.CheckState = System.Windows.Forms.CheckState.Checked
270
+        Me.CheckBox1.Location = New System.Drawing.Point(351, 29)
271
+        Me.CheckBox1.Name = "CheckBox1"
272
+        Me.CheckBox1.Size = New System.Drawing.Size(39, 20)
273
+        Me.CheckBox1.TabIndex = 1182
274
+        Me.CheckBox1.Text = "補"
275
+        Me.CheckBox1.UseVisualStyleBackColor = True
276
+        '
277
+        'DateTimePicker3
278
+        '
279
+        Me.DateTimePicker3.Format = System.Windows.Forms.DateTimePickerFormat.[Short]
280
+        Me.DateTimePicker3.Location = New System.Drawing.Point(262, 28)
281
+        Me.DateTimePicker3.Name = "DateTimePicker3"
282
+        Me.DateTimePicker3.Size = New System.Drawing.Size(85, 23)
283
+        Me.DateTimePicker3.TabIndex = 1180
284
+        '
285
+        'Button5
286
+        '
287
+        Me.Button5.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
288
+        Me.Button5.Font = New System.Drawing.Font("微軟正黑體", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
289
+        Me.Button5.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
290
+        Me.Button5.Location = New System.Drawing.Point(1004, 2)
291
+        Me.Button5.Name = "Button5"
292
+        Me.Button5.Size = New System.Drawing.Size(82, 47)
293
+        Me.Button5.TabIndex = 1179
294
+        Me.Button5.Text = "列印帳款清單"
295
+        Me.Button5.UseVisualStyleBackColor = True
296
+        '
297
+        'Button4
298
+        '
299
+        Me.Button4.Font = New System.Drawing.Font("微軟正黑體", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
300
+        Me.Button4.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
301
+        Me.Button4.Location = New System.Drawing.Point(282, 55)
302
+        Me.Button4.Name = "Button4"
303
+        Me.Button4.Size = New System.Drawing.Size(109, 23)
304
+        Me.Button4.TabIndex = 1178
305
+        Me.Button4.Text = "開立收支單(傳票)"
306
+        Me.Button4.UseVisualStyleBackColor = True
307
+        '
308
+        'ComboBox7
309
+        '
310
+        Me.ComboBox7.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
311
+        Me.ComboBox7.FormattingEnabled = True
312
+        Me.ComboBox7.Location = New System.Drawing.Point(657, 55)
313
+        Me.ComboBox7.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
314
+        Me.ComboBox7.Name = "ComboBox7"
315
+        Me.ComboBox7.Size = New System.Drawing.Size(190, 24)
316
+        Me.ComboBox7.TabIndex = 1177
317
+        '
318
+        'TextBox9
319
+        '
320
+        Me.TextBox9.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
321
+        Me.TextBox9.Location = New System.Drawing.Point(549, 55)
322
+        Me.TextBox9.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
323
+        Me.TextBox9.Name = "TextBox9"
324
+        Me.TextBox9.Size = New System.Drawing.Size(105, 23)
325
+        Me.TextBox9.TabIndex = 1176
326
+        Me.TextBox9.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
327
+        '
328
+        'ComboBox4
329
+        '
330
+        Me.ComboBox4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
331
+        Me.ComboBox4.FormattingEnabled = True
332
+        Me.ComboBox4.Location = New System.Drawing.Point(769, 29)
333
+        Me.ComboBox4.Name = "ComboBox4"
334
+        Me.ComboBox4.Size = New System.Drawing.Size(78, 24)
335
+        Me.ComboBox4.TabIndex = 1175
336
+        '
337
+        'ComboBox3
338
+        '
339
+        Me.ComboBox3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
340
+        Me.ComboBox3.FormattingEnabled = True
341
+        Me.ComboBox3.Location = New System.Drawing.Point(657, 29)
342
+        Me.ComboBox3.Name = "ComboBox3"
343
+        Me.ComboBox3.Size = New System.Drawing.Size(109, 24)
344
+        Me.ComboBox3.TabIndex = 1174
345
+        '
346
+        'ComboBox1
347
+        '
348
+        Me.ComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
349
+        Me.ComboBox1.FormattingEnabled = True
350
+        Me.ComboBox1.Location = New System.Drawing.Point(769, 3)
351
+        Me.ComboBox1.Name = "ComboBox1"
352
+        Me.ComboBox1.Size = New System.Drawing.Size(78, 24)
353
+        Me.ComboBox1.TabIndex = 1173
354
+        '
355
+        'ComboBox5
356
+        '
357
+        Me.ComboBox5.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
358
+        Me.ComboBox5.FormattingEnabled = True
359
+        Me.ComboBox5.Location = New System.Drawing.Point(657, 3)
360
+        Me.ComboBox5.Name = "ComboBox5"
361
+        Me.ComboBox5.Size = New System.Drawing.Size(109, 24)
362
+        Me.ComboBox5.TabIndex = 1172
363
+        '
364
+        'ComboBox6
365
+        '
366
+        Me.ComboBox6.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
367
+        Me.ComboBox6.FormattingEnabled = True
368
+        Me.ComboBox6.Location = New System.Drawing.Point(657, 276)
369
+        Me.ComboBox6.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
370
+        Me.ComboBox6.Name = "ComboBox6"
371
+        Me.ComboBox6.Size = New System.Drawing.Size(190, 24)
372
+        Me.ComboBox6.TabIndex = 1170
373
+        '
374
+        'Label5
375
+        '
376
+        Me.Label5.AutoSize = True
377
+        Me.Label5.Location = New System.Drawing.Point(550, 7)
378
+        Me.Label5.Name = "Label5"
379
+        Me.Label5.Size = New System.Drawing.Size(104, 48)
380
+        Me.Label5.TabIndex = 1171
381
+        Me.Label5.Text = "未收餘額不為零時" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "需要選擇未收餘額" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "立帳的會計科目"
382
+        '
383
+        'Button12
384
+        '
385
+        Me.Button12.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
386
+        Me.Button12.Font = New System.Drawing.Font("微軟正黑體", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
387
+        Me.Button12.ForeColor = System.Drawing.Color.Olive
388
+        Me.Button12.Location = New System.Drawing.Point(1170, 26)
389
+        Me.Button12.Name = "Button12"
390
+        Me.Button12.Size = New System.Drawing.Size(74, 23)
391
+        Me.Button12.TabIndex = 1169
392
+        Me.Button12.Text = "全部取消"
393
+        Me.Button12.UseVisualStyleBackColor = True
394
+        '
395
+        'Button13
396
+        '
397
+        Me.Button13.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
398
+        Me.Button13.Font = New System.Drawing.Font("微軟正黑體", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
399
+        Me.Button13.ForeColor = System.Drawing.Color.Olive
400
+        Me.Button13.Location = New System.Drawing.Point(1170, 2)
401
+        Me.Button13.Name = "Button13"
402
+        Me.Button13.Size = New System.Drawing.Size(74, 23)
403
+        Me.Button13.TabIndex = 1168
404
+        Me.Button13.Text = "全部選擇"
405
+        Me.Button13.UseVisualStyleBackColor = True
406
+        '
407
+        'TextBox3
408
+        '
409
+        Me.TextBox3.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
410
+        Me.TextBox3.Location = New System.Drawing.Point(262, 4)
411
+        Me.TextBox3.Name = "TextBox3"
412
+        Me.TextBox3.Size = New System.Drawing.Size(126, 23)
413
+        Me.TextBox3.TabIndex = 1166
414
+        '
415
+        'Label3
416
+        '
417
+        Me.Label3.AutoSize = True
418
+        Me.Label3.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
419
+        Me.Label3.Location = New System.Drawing.Point(206, 7)
420
+        Me.Label3.Name = "Label3"
421
+        Me.Label3.Size = New System.Drawing.Size(56, 16)
422
+        Me.Label3.TabIndex = 1167
423
+        Me.Label3.Text = "單據號碼"
424
+        '
425
+        'Label6
426
+        '
427
+        Me.Label6.AutoSize = True
428
+        Me.Label6.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
429
+        Me.Label6.Location = New System.Drawing.Point(207, 31)
430
+        Me.Label6.Name = "Label6"
431
+        Me.Label6.Size = New System.Drawing.Size(56, 16)
432
+        Me.Label6.TabIndex = 1181
433
+        Me.Label6.Text = "立帳日期"
434
+        '
435
+        'CheckBox2
436
+        '
437
+        Me.CheckBox2.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
438
+        Me.CheckBox2.AutoSize = True
439
+        Me.CheckBox2.Location = New System.Drawing.Point(887, 5)
440
+        Me.CheckBox2.Name = "CheckBox2"
441
+        Me.CheckBox2.Size = New System.Drawing.Size(99, 20)
442
+        Me.CheckBox2.TabIndex = 1192
443
+        Me.CheckBox2.Text = "列印多單選擇"
444
+        Me.CheckBox2.UseVisualStyleBackColor = True
445
+        '
446
+        'CheckBox3
447
+        '
448
+        Me.CheckBox3.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
449
+        Me.CheckBox3.AutoSize = True
450
+        Me.CheckBox3.Location = New System.Drawing.Point(887, 25)
451
+        Me.CheckBox3.Name = "CheckBox3"
452
+        Me.CheckBox3.Size = New System.Drawing.Size(111, 20)
453
+        Me.CheckBox3.TabIndex = 1194
454
+        Me.CheckBox3.Text = "已立帳資料隱藏"
455
+        Me.CheckBox3.UseVisualStyleBackColor = True
456
+        '
457
+        'ComboBox2
458
+        '
459
+        Me.ComboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
460
+        Me.ComboBox2.FormattingEnabled = True
461
+        Me.ComboBox2.Items.AddRange(New Object() {"", "收現", "收票", "託收"})
462
+        Me.ComboBox2.Location = New System.Drawing.Point(210, 54)
463
+        Me.ComboBox2.Name = "ComboBox2"
464
+        Me.ComboBox2.Size = New System.Drawing.Size(66, 24)
465
+        Me.ComboBox2.TabIndex = 1196
126
         '
466
         '
127
         '應收帳款控制表
467
         '應收帳款控制表
128
         '
468
         '
129
         Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 16.0!)
469
         Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 16.0!)
130
         Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
470
         Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
131
         Me.ClientSize = New System.Drawing.Size(1249, 611)
471
         Me.ClientSize = New System.Drawing.Size(1249, 611)
472
+        Me.Controls.Add(Me.ComboBox2)
473
+        Me.Controls.Add(Me.TextBox5)
474
+        Me.Controls.Add(Me.TextBox4)
475
+        Me.Controls.Add(Me.Label8)
476
+        Me.Controls.Add(Me.TextBox1)
477
+        Me.Controls.Add(Me.Label7)
478
+        Me.Controls.Add(Me.NumericUpDown2)
479
+        Me.Controls.Add(Me.Label2)
480
+        Me.Controls.Add(Me.NumericUpDown1)
481
+        Me.Controls.Add(Me.Label1)
482
+        Me.Controls.Add(Me.Button6)
483
+        Me.Controls.Add(Me.TextBox2)
484
+        Me.Controls.Add(Me.CheckBox1)
485
+        Me.Controls.Add(Me.DateTimePicker3)
486
+        Me.Controls.Add(Me.Button5)
487
+        Me.Controls.Add(Me.Button4)
488
+        Me.Controls.Add(Me.ComboBox7)
489
+        Me.Controls.Add(Me.TextBox9)
490
+        Me.Controls.Add(Me.ComboBox4)
491
+        Me.Controls.Add(Me.ComboBox3)
492
+        Me.Controls.Add(Me.ComboBox1)
493
+        Me.Controls.Add(Me.ComboBox5)
494
+        Me.Controls.Add(Me.ComboBox6)
495
+        Me.Controls.Add(Me.Label5)
496
+        Me.Controls.Add(Me.Button12)
497
+        Me.Controls.Add(Me.Button13)
498
+        Me.Controls.Add(Me.TextBox3)
499
+        Me.Controls.Add(Me.Label3)
500
+        Me.Controls.Add(Me.Label6)
501
+        Me.Controls.Add(Me.CheckBox2)
502
+        Me.Controls.Add(Me.CheckBox3)
132
         Me.Controls.Add(Me.Button1)
503
         Me.Controls.Add(Me.Button1)
133
         Me.Controls.Add(Me.一般月)
504
         Me.Controls.Add(Me.一般月)
134
         Me.Controls.Add(Me.會計月)
505
         Me.Controls.Add(Me.會計月)
142
         Me.Name = "應收帳款控制表"
513
         Me.Name = "應收帳款控制表"
143
         Me.Text = "應收帳款控制表"
514
         Me.Text = "應收帳款控制表"
144
         CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).EndInit()
515
         CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).EndInit()
516
+        CType(Me.NumericUpDown2, System.ComponentModel.ISupportInitialize).EndInit()
517
+        CType(Me.NumericUpDown1, System.ComponentModel.ISupportInitialize).EndInit()
145
         Me.ResumeLayout(False)
518
         Me.ResumeLayout(False)
146
         Me.PerformLayout()
519
         Me.PerformLayout()
147
 
520
 
148
     End Sub
521
     End Sub
149
-
522
+    Friend WithEvents DataGridView1 As DataGridView
150
     Friend WithEvents Button1 As Button
523
     Friend WithEvents Button1 As Button
151
     Friend WithEvents 一般月 As CheckBox
524
     Friend WithEvents 一般月 As CheckBox
152
     Friend WithEvents 會計月 As CheckBox
525
     Friend WithEvents 會計月 As CheckBox
154
     Friend WithEvents Label4 As Label
527
     Friend WithEvents Label4 As Label
155
     Friend WithEvents DateTimePicker2 As DateTimePicker
528
     Friend WithEvents DateTimePicker2 As DateTimePicker
156
     Friend WithEvents DateTimePicker1 As DateTimePicker
529
     Friend WithEvents DateTimePicker1 As DateTimePicker
157
-    Friend WithEvents DataGridView1 As DataGridView
530
+    Friend WithEvents TextBox5 As TextBox
531
+    Friend WithEvents TextBox4 As TextBox
532
+    Friend WithEvents Label8 As Label
533
+    Friend WithEvents TextBox1 As TextBox
534
+    Friend WithEvents Label7 As Label
535
+    Friend WithEvents NumericUpDown2 As NumericUpDown
536
+    Friend WithEvents Label2 As Label
537
+    Friend WithEvents NumericUpDown1 As NumericUpDown
538
+    Friend WithEvents Label1 As Label
539
+    Friend WithEvents Button6 As Button
540
+    Friend WithEvents TextBox2 As TextBox
541
+    Friend WithEvents CheckBox1 As CheckBox
542
+    Friend WithEvents DateTimePicker3 As DateTimePicker
543
+    Friend WithEvents Button5 As Button
544
+    Friend WithEvents Button4 As Button
545
+    Friend WithEvents ComboBox7 As ComboBox
546
+    Friend WithEvents TextBox9 As TextBox
547
+    Friend WithEvents ComboBox4 As ComboBox
548
+    Friend WithEvents ComboBox3 As ComboBox
549
+    Friend WithEvents ComboBox1 As ComboBox
550
+    Friend WithEvents ComboBox5 As ComboBox
551
+    Friend WithEvents ComboBox6 As ComboBox
552
+    Friend WithEvents Label5 As Label
553
+    Friend WithEvents Button12 As Button
554
+    Friend WithEvents Button13 As Button
555
+    Friend WithEvents TextBox3 As TextBox
556
+    Friend WithEvents Label3 As Label
557
+    Friend WithEvents Label6 As Label
558
+    Friend WithEvents CheckBox2 As CheckBox
559
+    Friend WithEvents CheckBox3 As CheckBox
560
+    Friend WithEvents ComboBox2 As ComboBox
158
 End Class
561
 End Class

+ 349
- 0
MaoOrange-Hongji/財務系統管理/應收帳款控制表.vb Переглянути файл

1
 Option Strict Off
1
 Option Strict Off
2
+Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle
3
+Imports Microsoft.Office.Interop.Excel.Constants
4
+Imports Microsoft.Office.Interop.Excel.XlBordersIndex
5
+Imports Microsoft.Office.Interop.Excel.XlLineStyle
6
+Imports Microsoft.Office.Interop.Excel.XlBorderWeight
7
+Imports Microsoft.Office.Interop.Excel.XlThemeFont
8
+Imports Microsoft.Office.Interop.Excel.XlThemeColor
9
+Imports Microsoft.Office.Interop.Excel.XlWindowState
10
+Imports Microsoft.Office.Interop.Excel
2
 Public Class 應收帳款控制表
11
 Public Class 應收帳款控制表
12
+    ReadOnly ds As New DataSet
13
+    Dim N1 As Integer : Dim 新項次 As String
14
+    Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet
15
+    Private Sub Set_賬款清單()
16
+        DataGridView1.DataSource = Nothing : ds.Clear() : DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing : DataGridView1.ColumnHeadersHeight = 40
17
+        DataGridView1.AllowUserToAddRows = False : DataGridView1.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText : DataGridView1.MultiSelect = True
18
+        SQL_應收賬款清單()
19
+        da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close()
20
+
21
+        DataGridView1.Columns(0).FillWeight = 150 : DataGridView1.Columns(1).Visible = False : DataGridView1.Columns(2).FillWeight = 100 : DataGridView1.Columns(3).Visible = False
22
+        DataGridView1.Columns(4).FillWeight = 80 : DataGridView1.Columns(5).FillWeight = 300 : DataGridView1.Columns(6).FillWeight = 80 : DataGridView1.Columns(7).FillWeight = 80
23
+        DataGridView1.Columns(8).FillWeight = 80 : DataGridView1.Columns(9).FillWeight = 80 : DataGridView1.Columns(10).FillWeight = 100 : DataGridView1.Columns(11).FillWeight = 100
24
+        DataGridView1.Columns(12).FillWeight = 150 : DataGridView1.Columns(13).FillWeight = 60 : DataGridView1.Columns(14).FillWeight = 50 : DataGridView1.Columns(15).Visible = False
25
+        DataGridView1.Columns(16).FillWeight = 50
26
+
27
+        DataGridView1.Columns(6).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(7).DefaultCellStyle.Format = "#,##0.000"
28
+        DataGridView1.Columns(8).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(9).DefaultCellStyle.Format = "#,##0"
29
+        DataGridView1.Columns(0).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(0).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
30
+        DataGridView1.Columns(2).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(2).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
31
+        DataGridView1.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(4).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
32
+        DataGridView1.Columns(6).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(6).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
33
+        DataGridView1.Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
34
+        DataGridView1.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(8).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
35
+        DataGridView1.Columns(9).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(9).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
36
+        DataGridView1.Columns(10).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(10).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
37
+        DataGridView1.Columns(11).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(11).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
38
+        DataGridView1.Columns(16).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(16).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
39
+
40
+        For I As Integer = 0 To 12 : DataGridView1.Columns(I).ReadOnly = True : Next : DataGridView1.Columns(14).ReadOnly = True
41
+        For I As Integer = 0 To DataGridView1.Rows.Count - 1
42
+            If DataGridView1.Rows(I).Cells("應收立帳").Value.ToString = "" Then : DataGridView1.Rows(I).Cells("應收立帳").Value = False : End If
43
+            DataGridView1.Rows(I).Cells("選擇").Value = False
44
+        Next
45
+    End Sub
46
+    Private Sub ComboBox1下拉表單資料載入()
47
+        SQL_會計科目_第一階()
48
+        ComboBox5.Items.Clear() : ComboBox1.Items.Clear() : While (dr.Read()) : ComboBox5.Items.Add(dr("第一階")) : ComboBox1.Items.Add(dr("編號")) : End While : conn.Close()
49
+    End Sub
50
+    Private Sub ComboBox3下拉表單資料載入()
51
+        PA = ComboBox1.Text : SQL_會計科目_第二階()
52
+        ComboBox3.Items.Clear() : ComboBox4.Items.Clear() : While (dr.Read()) : ComboBox3.Items.Add(dr("第二階")) : ComboBox4.Items.Add(dr("編號")) : End While : conn.Close() : PA = ""
53
+    End Sub
54
+    Private Sub ComboBox6下拉表單資料載入()
55
+        PA = ComboBox4.Text : SQL_會計科目_第三階()
56
+        ComboBox7.Items.Clear() : ComboBox6.Items.Clear() : While (dr.Read()) : ComboBox7.Items.Add(dr("會計科目")) : ComboBox6.Items.Add(dr("編號")) : End While : conn.Close()
57
+        If ComboBox7.Items.Count <> 0 Then : ComboBox7.SelectedIndex = 0 : End If
58
+    End Sub
59
+    Private Sub 日期格式()
60
+        If 會計月.Checked = True Then
61
+            '-------------日期一----------------------------------------------------------------------------------------
62
+            DTP = Strings.Left(Strings.Format(DateTimePicker1.Value, "yyyy/MM/dd"), 8) & "01" : DateTimePicker1.Value = DTP
63
+            DateTimePicker1.Value = DateTimePicker1.Value.AddMonths(-1)
64
+            DTP = Strings.Left(Strings.Format(DateTimePicker1.Value, "yyyy/MM/dd"), 8) & "26" : DateTimePicker1.Value = DTP
65
+            '-------------日期二----------------------------------------------------------------------------------------
66
+            DTP = Strings.Left(Strings.Format(DateTimePicker2.Value, "yyyy/MM/dd"), 8) & "25" : DateTimePicker2.Value = DTP
67
+        Else
68
+            '-------------日期一----------------------------------------------------------------------------------------
69
+            DateTimePicker1.Value = DateTimePicker1.Value.AddMonths(1)
70
+            DTP = Strings.Left(Strings.Format(DateTimePicker1.Value, "yyyy/MM/dd"), 8) & "01" : DateTimePicker1.Value = DTP
71
+            '-------------日期二----------------------------------------------------------------------------------------
72
+            Dim iDays As Integer = DateTime.DaysInMonth(Strings.Left(Strings.Format(DateTimePicker2.Value, "yyyy/MM/dd"), 4), Strings.Mid(Strings.Format(DateTimePicker2.Value, "yyyy/MM/dd"), 6, 2))
73
+            DTP = Strings.Left(Strings.Format(DateTimePicker2.Value, "yyyy/MM/dd"), 8) & iDays : DateTimePicker2.Value = DTP
74
+        End If
75
+    End Sub
76
+    Private Sub 預設關鍵字()
77
+        關鍵字編號 = "DV003" : SQL_通用預設值管理查詢() : If dr.Read() Then : TextBox9.Text = dr("預設值") : End If
78
+    End Sub
3
     Private Sub 應收帳款_Load(sender As Object, e As EventArgs) Handles MyBase.Load
79
     Private Sub 應收帳款_Load(sender As Object, e As EventArgs) Handles MyBase.Load
80
+        Me.MdiParent = MAOJI_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
81
+        ComboBox6.Visible = False : TextBox1.Visible = False : TextBox4.Visible = False : TextBox5.Visible = False
82
+        TextBox1.Text = "0" : TextBox2.Text = "0"
83
+        ComboBox1下拉表單資料載入() : ComboBox3下拉表單資料載入() : ComboBox6下拉表單資料載入() : 日期格式() : Set_賬款清單()
84
+        預設關鍵字()
85
+    End Sub
86
+    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
87
+        DateTimePicker1.Value = DateTimePicker1.Value.AddMonths(-1) : DateTimePicker2.Value = DateTimePicker2.Value.AddMonths(-1) : Set_賬款清單()
88
+    End Sub
89
+    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
90
+        DateTimePicker1.Value = DateTimePicker1.Value.AddMonths(1) : DateTimePicker2.Value = DateTimePicker2.Value.AddMonths(1) : Set_賬款清單()
91
+    End Sub
92
+    Private Sub 會計月_CheckedChanged(sender As Object, e As EventArgs) Handles 會計月.Click
93
+        會計月.Checked = True : 一般月.Checked = False : 日期格式() : Set_賬款清單()
94
+    End Sub
95
+    Private Sub 一般月_CheckedChanged(sender As Object, e As EventArgs) Handles 一般月.Click
96
+        會計月.Checked = False : 一般月.Checked = True : 日期格式() : Set_賬款清單()
97
+    End Sub
98
+    Private Sub ComboBox5_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox5.TextChanged
99
+        ComboBox1.SelectedIndex = ComboBox5.SelectedIndex : TextBox9.Text = "" : ComboBox3下拉表單資料載入() : ComboBox6下拉表單資料載入()
100
+    End Sub
101
+    Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.TextChanged
102
+        ComboBox5.SelectedIndex = ComboBox1.SelectedIndex : ComboBox3下拉表單資料載入() : ComboBox6下拉表單資料載入()
103
+    End Sub
104
+    Private Sub ComboBox3_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox3.TextChanged
105
+        ComboBox4.SelectedIndex = ComboBox3.SelectedIndex : ComboBox6下拉表單資料載入()
106
+    End Sub
107
+    Private Sub ComboBox4_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox4.TextChanged
108
+        ComboBox3.SelectedIndex = ComboBox4.SelectedIndex : ComboBox6下拉表單資料載入()
109
+    End Sub
110
+    Private Sub ComboBox7_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox7.SelectedIndexChanged
111
+        ComboBox6.SelectedIndex = ComboBox7.SelectedIndex
112
+    End Sub
113
+    Private Sub ComboBox6_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox6.SelectedIndexChanged
114
+        ComboBox7.SelectedIndex = ComboBox6.SelectedIndex
115
+    End Sub
116
+    Private Sub TextBox9_TextChanged(sender As Object, e As EventArgs) Handles TextBox9.TextChanged
117
+        PA = TextBox9.Text : SQL_會計科目_關鍵字()
118
+        ComboBox7.Items.Clear() : ComboBox6.Items.Clear() : While (dr.Read()) : ComboBox7.Items.Add(dr("會計科目")) : ComboBox6.Items.Add(dr("編號")) : End While : conn.Close()
119
+        If ComboBox7.Items.Count <> 0 Then : ComboBox7.SelectedIndex = 0 : End If : PA = ""
120
+    End Sub
121
+    Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
122
+        If e.RowIndex = -1 Then : Else
123
+            TextBox3.Text = DataGridView1.Rows(e.RowIndex).Cells("單據編號").Value : TextBox5.Text = DataGridView1.Rows(e.RowIndex).Cells("客戶").Value
124
+            ComboBox2.Text = DataGridView1.Rows(e.RowIndex).Cells("收款狀態").Value.ToString
125
+            TextBox2.Text = "0" : TextBox1.Text = "0"
126
+            For I As Integer = 0 To DataGridView1.Rows.Count - 1
127
+                If CheckBox2.Checked = False Then
128
+                    DataGridView1.Rows(I).Cells("選擇").Value = False
129
+                End If
130
+
131
+                If TextBox3.Text = DataGridView1.Rows(I).Cells("單據編號").Value Then
132
+                    DataGridView1.Rows(I).Cells("選擇").Value = True
133
+                    TextBox1.Text = Val(TextBox1.Text) + DataGridView1.Rows(I).Cells("金額").Value
134
+                    TextBox2.Text = Val(TextBox2.Text) + DataGridView1.Rows(I).Cells("金額").Value
135
+                End If
136
+            Next
137
+            TextBox2.Text = Strings.Format(Val(TextBox2.Text), "#,##0")
138
+        End If
139
+    End Sub
140
+    Private Sub DataGridView1_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView1.RowPostPaint
141
+        Dim linePen As New Pen(Color.Blue, 2)
142
+        If e.RowIndex = DataGridView1.Rows.Count - 1 Then : Exit Sub
143
+        Else
144
+            If DataGridView1(0, e.RowIndex).Value.ToString <> DataGridView1(0, e.RowIndex + 1).Value.ToString Then
145
+                Dim startX As Integer = IIf(DataGridView1.RowHeadersVisible, DataGridView1.RowHeadersWidth, 0)
146
+                Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
147
+                Dim endX As Integer = startX + DataGridView1.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView1.HorizontalScrollingOffset
148
+                e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub
149
+            End If
150
+        End If
151
+    End Sub
152
+    Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
153
+        For i As Integer = 0 To DataGridView1.Rows.Count - 1 : DataGridView1.Rows(i).Cells("選擇").Value = True : Next i
154
+    End Sub
155
+    Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
156
+        For i As Integer = 0 To DataGridView1.Rows.Count - 1 : DataGridView1.Rows(i).Cells("選擇").Value = False : Next i
157
+    End Sub
158
+    Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
159
+        For i As Integer = 0 To DataGridView1.Rows.Count - 1
160
+            If TextBox3.Text = DataGridView1.Rows(i).Cells("單據編號").Value.ToString Then
161
+                DataGridView1.Rows(i).Cells("應收立帳").Value = False
162
+            End If
163
+        Next i
164
+    End Sub
165
+    Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
166
+        NumericUpDown2.Value = Val(TextBox1.Text) - NumericUpDown1.Value
167
+    End Sub
168
+    Private Sub NumericUpDown1_ValueChanged(sender As Object, e As EventArgs) Handles NumericUpDown1.ValueChanged
169
+        NumericUpDown2.Value = Val(TextBox1.Text) - NumericUpDown1.Value
170
+    End Sub
171
+    Private Sub CheckBox3_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox3.CheckedChanged
172
+        Set_賬款清單()
173
+    End Sub
174
+    Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.SelectedIndexChanged
175
+        If ComboBox2.Text = "收現" Then
176
+            關鍵字編號 = "DV003" : SQL_通用預設值管理查詢() : If dr.Read() Then : TextBox9.Text = dr("預設值") : End If
177
+        ElseIf ComboBox2.Text = "收票" Then
178
+            關鍵字編號 = "DV004" : SQL_通用預設值管理查詢() : If dr.Read() Then : TextBox9.Text = dr("預設值") : End If
179
+        ElseIf ComboBox2.Text = "" Or ComboBox2.Text = "託收" Then
180
+            TextBox9.Text = ""
181
+        End If
182
+    End Sub
183
+    Private Sub Set_日期格式轉換()
184
+        If CheckBox1.Checked = False Then : DTP = Strings.Format(Today(), "yyyy/MM/dd") : DTP1 = Strings.Format(Today(), "yyyyMMdd")
185
+        Else : DTP1 = Strings.Format(DateTimePicker3.Value, "yyyyMMdd") : DTP = Strings.Format(DateTimePicker3.Value, "yyyy/MM/dd") : End If
186
+    End Sub
187
+    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
188
+        If ComboBox2.Text = "" Or ComboBox2.Text = "託收" Then
189
+            MsgBox("需要選擇收現或是收票才能運行。")
190
+        Else
191
+            If CheckBox2.Checked = True Then
192
+                MsgBox("開立支付單(傳票)需要一張一張來,請重新選擇。")
193
+                CheckBox2.Checked = False
194
+                For I As Integer = 0 To DataGridView1.Rows.Count - 1
195
+                    DataGridView1.Rows(I).Cells("選擇").Value = False
196
+                Next
197
+            Else
198
+                If NumericUpDown1.Value = 0 Then
199
+                    MsgBox("實收金額不可為零。") : Exit Sub
200
+                Else
201
+                    If NumericUpDown2.Value = 0 Then : Else
202
+                        If ComboBox6.Text = "" Then
203
+                            MsgBox("未收款金額擇讓需要會計科目。") : Exit Sub
204
+                        Else
205
+                        End If
206
+                    End If
207
+                    Dim 確認 As Boolean = False
208
+                    For i As Integer = 0 To DataGridView1.Rows.Count - 1
209
+                        If DataGridView1.Rows(i).Cells("選擇").Value = True Then
210
+                            MsgBox("該採銷售已經開立過傳票,如是之前開立有誤需要從新開立,請先點擊--依據單號取消立帳選擇--按鈕。如是因銷售退貨需要開立收支單(傳票)請先勾選--已立帳資料隱藏--再行操作。")
211
+                            Exit Sub
212
+                        End If
213
+                    Next
214
+                    If 確認 = False Then : MsgBox("沒有選擇任何一筆要轉收支帳(傳票)的銷售單號。")
215
+                    Else
216
+                        Dim NUM1 As Integer : Set_日期格式轉換()
217
+                        For ii As Integer = 1 To 999
218
+                            NUM1 = 0 + ii
219
+                            If NUM1 < 10 Then : TextBox4.Text = "OE-" & DTP1 & "-00" & NUM1
220
+                            ElseIf NUM1 > 9 And NUM1 < 100 Then : TextBox4.Text = "OE-" & DTP1 & "-0" & NUM1
221
+                            ElseIf NUM1 > 99 Then : TextBox4.Text = "OE-" & DTP1 & "-" & NUM1 : End If : PA = TextBox4.Text
222
+                            SQL_營運成本收支單申請_支付單號流水號()
223
+                            If dr.Read() Then : Else : ii = 999 : End If
224
+                        Next
225
+                        SQL_營運成本控制表新增()
226
+
227
+                        SQL_營運成本明細表項次新增查詢()
228
+                        If dr.Read() Then : 新項次 = dr("項次") : Else : 新項次 = "00" : End If : conn.Close() : NUM1 = Double.Parse(新項次) + 1
229
+                        If NUM1 < 10 Then : 新項次 = "0" & NUM1
230
+                        ElseIf NUM1 > 9 And NUM1 < 100 Then : 新項次 = NUM1 : End If
231
+                        關鍵字編號 = "DV001" : SQL_通用預設值管理查詢() : If dr.Read() Then : PA3 = dr("預設值") : End If
232
+                        PA1 = TextBox4.Text : PA2 = 新項次 : PA4 = TextBox5.Text & " - " & DateTimePicker1.Value & " 到 " & DateTimePicker2.Value & " 應收帳款"
233
+                        NU1 = NumericUpDown1.Value : PA5 = "" : NU2 = 0 : NU3 = 0 : NU4 = 0
234
+                        SQL_營運成本明細表新增()
235
+
236
+                        If NumericUpDown2.Value = 0 Then : Else
237
+                            SQL_營運成本明細表項次新增查詢()
238
+                            If dr.Read() Then : 新項次 = dr("項次") : Else : 新項次 = "00" : End If : conn.Close() : NUM1 = Double.Parse(新項次) + 1
239
+                            If NUM1 < 10 Then : 新項次 = "0" & NUM1
240
+                            ElseIf NUM1 > 9 And NUM1 < 100 Then : 新項次 = NUM1 : End If
241
+
242
+                            PA1 = TextBox4.Text : PA2 = 新項次 : PA3 = ComboBox6.Text : PA4 = TextBox5.Text & " - " & DateTimePicker1.Value & " 到 " & DateTimePicker2.Value & " 貨款折讓"
243
+                            NU1 = NumericUpDown2.Value * -1 : PA5 = "" : NU2 = 0 : NU3 = 0 : NU4 = 0
244
+                            SQL_營運成本明細表新增()
245
+                        End If
246
+                        For i As Integer = 0 To DataGridView1.Rows.Count - 1
247
+                            資料數 = DataGridView1.Rows.Count : MyModule1.進度條()
248
+                            If DataGridView1.Rows(i).Cells("選擇").Value = True Then
249
+                                PA6 = DataGridView1.Rows(i).Cells("資料流水號").Value
250
+                                SQL_應付賬款_倉儲明細應付立帳修改()
251
+                            End If
252
+                        Next i : MAOJI_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0 : MsgBox("財務收支單(傳票)申請完成,請通知主管審核。") : Set_賬款清單()
253
+                    End If
254
+                End If
255
+            End If
256
+        End If
257
+    End Sub
258
+    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
259
+        xlApp = CType(CreateObject("Excel.Application"), Application)
260
+        xlBook = xlApp.Workbooks.Add
261
+        xlApp.DisplayAlerts = True
262
+        xlApp.Visible = True
263
+        xlApp.Application.WindowState = xlMaximized
264
+        N1 = 0
265
+        If DataGridView1.Rows.Count = 0 Then : Else
266
+            xlSheet = NewMethod(xlBook)
267
+            xlSheet.Cells(1, 1) = MAOJI_ERP_SYS.ComboBox2.Text : xlSheet.Cells(2, 1) = DateTimePicker1.Value & " 到 " & DateTimePicker2.Value & " 應收帳款清單"
268
+            xlSheet.Cells(3, 1) = "單據編號" : xlSheet.Cells(3, 2) = "客戶" : xlSheet.Cells(3, 3) = "頁碼" : xlSheet.Cells(3, 4) = "品名" : xlSheet.Cells(3, 5) = "售價" : xlSheet.Cells(3, 6) = "匯率"
269
+            xlSheet.Cells(3, 7) = "出庫" : xlSheet.Cells(3, 8) = "金額" : xlSheet.Cells(3, 9) = "銷售接單" : xlSheet.Cells(3, 10) = "出庫日期" : xlSheet.Cells(3, 11) = "是否立帳"
270
+            xlSheet.Cells(2, 7) = "合計" : xlSheet.Cells(2, 8) = "=SUBTOTAL(9,H4:H9999)"
271
+            For i As Integer = 0 To DataGridView1.Rows.Count - 1
272
+                If DataGridView1.Rows(i).Cells("選擇").Value = True Then
273
+                    xlSheet.Cells(N1 + 4, 1) = DataGridView1.Rows(i).Cells("單據編號").Value : xlSheet.Cells(N1 + 4, 2) = DataGridView1.Rows(i).Cells("客戶").Value
274
+                    xlSheet.Cells(N1 + 4, 3) = DataGridView1.Rows(i).Cells("頁碼").Value : xlSheet.Cells(N1 + 4, 4) = DataGridView1.Rows(i).Cells("品名").Value
275
+                    xlSheet.Cells(N1 + 4, 5) = DataGridView1.Rows(i).Cells("單價").Value : xlSheet.Cells(N1 + 4, 6) = DataGridView1.Rows(i).Cells("匯率").Value
276
+                    xlSheet.Cells(N1 + 4, 7) = DataGridView1.Rows(i).Cells("出庫").Value : xlSheet.Cells(N1 + 4, 8) = DataGridView1.Rows(i).Cells("金額").Value
277
+                    xlSheet.Cells(N1 + 4, 9) = DataGridView1.Rows(i).Cells("採購下單").Value : xlSheet.Cells(N1 + 4, 10) = DataGridView1.Rows(i).Cells("出庫日期").Value
278
+                    If DataGridView1.Rows(i).Cells("應收立帳").Value = True Then : PA1 = "YES" : Else : PA1 = "NO" : End If
279
+                    xlSheet.Cells(N1 + 4, 11) = PA1
280
+                    N1 += 1
281
+                End If
282
+            Next i
283
+            N1 += 4
284
+            AA(xlApp, xlSheet)
285
+        End If
286
+
287
+        xlSheet.PageSetup.PrintArea = ""
288
+        xlApp.Cells.Select()
289
+        xlSheet.Range("B1").Select()
290
+        xlApp.Application.WindowState = xlMinimized
291
+        xlSheet.Cells.Select()
292
+        MsgBox("列印完成。")
293
+    End Sub
294
+    Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
295
+        Return CType(xlBook.Worksheets.Add, Worksheet)
296
+    End Function
297
+    Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
298
+        xlSheet.Cells.Select()
299
+        With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
300
+            .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
301
+
302
+        xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 18 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 10
303
+        xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 9 : xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 30
304
+        xlSheet.Columns("E:H").Select : myExcel.Selection.NumberFormatLocal = "#,##0;[紅色]-#,##0"
305
+        xlSheet.Columns("F:F").Select : myExcel.Selection.NumberFormatLocal = "#,##0.000;[紅色]-#,##0.000"
306
+        xlSheet.Columns("E:H").Select : myExcel.Selection.ColumnWidth = 7 : xlSheet.Columns("I:J").Select : myExcel.Selection.ColumnWidth = 10
307
+        xlSheet.Columns("K:K").Select : myExcel.Selection.ColumnWidth = 8
308
+
309
+        xlSheet.Rows("1:1").Select
310
+        With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 22 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
311
+            .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
312
+        xlSheet.Rows("2:2").Select
313
+        With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 18 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
314
+            .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
315
+        xlSheet.Rows("3:3").Select
316
+        With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
317
+            .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
318
+
319
+        xlSheet.Rows("4:4").Select : myExcel.ActiveWindow.FreezePanes = True : xlSheet.Rows("3:3").Select : myExcel.Selection.AutoFilter
320
+        xlSheet.Rows("3:3").Select : myExcel.Selection.RowHeight = 25
321
+        With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
322
+            .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
323
+
324
+        xlSheet.Range("H2:I2").Select()
325
+        With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
326
+            .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
327
+
328
+        xlSheet.Range("G2:I2").Select()
329
+        With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
330
+            .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
331
+
332
+        xlSheet.Range("A1:K1").Select()
333
+        With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
334
+            .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
335
+        xlSheet.Range("A2:F2").Select()
336
+
337
+        With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
338
+            .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
339
+
340
+        xlSheet.Range("L10").Select() : myExcel.ActiveWindow.DisplayGridlines = False
341
+
342
+        xlSheet.Range("G2").Select()
343
+        With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
344
+            .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
4
 
345
 
346
+        xlSheet.Range("A3:K" & N1).Select()
347
+        myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
348
+        With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
349
+        With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
350
+        With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
351
+        With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
352
+        With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
353
+        With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
5
     End Sub
354
     End Sub
6
 End Class
355
 End Class

Завантаження…
Відмінити
Зберегти