Bladeren bron

應付帳款見面基本功能完成

Signed-off-by: B70340 <b70340@gmail.com>
B70340 5 jaren geleden
bovenliggende
commit
b4c000efd0

BIN
.vs/MAOJI-ERP-SYS/v16/.suo Bestand weergeven


+ 13
- 4
MaoOrange-Hongji/Module1/SQL_Module.vb Bestand weergeven

@@ -2068,18 +2068,27 @@ Module SQL_Module
2068 2068
     End Sub
2069 2069
     '---------------------應付賬款-----------------------------------------------------------------------------------------------------------------
2070 2070
     Friend Sub SQL_應付賬款清單()
2071
+        If 應付賬款.CheckBox3.Checked = False Then
2072
+            KKKJJ = " WHERE (倉儲明細表.狀態 LIKE '採購入庫') AND (倉儲明細表.倉儲作業 NOT LIKE '') AND (倉儲明細表.公司編號 LIKE '%" & 公司編號 & "%') AND 
2073
+                            (倉儲明細表.倉儲作業 BETWEEN '" & Format(應付賬款.DateTimePicker1.Value, "yyyy/MM/dd") & "' AND '" & Format(應付賬款.DateTimePicker2.Value, "yyyy/MM/dd") & "') "
2074
+        ElseIf 應付賬款.CheckBox3.Checked = True Then
2075
+            KKKJJ = " WHERE (倉儲明細表.狀態 LIKE '採購入庫') AND (倉儲明細表.倉儲作業 NOT LIKE '') AND (倉儲明細表.公司編號 LIKE '%" & 公司編號 & "%') AND 
2076
+                            (倉儲明細表.倉儲作業 BETWEEN '" & Format(應付賬款.DateTimePicker1.Value, "yyyy/MM/dd") & "' AND '" & Format(應付賬款.DateTimePicker2.Value, "yyyy/MM/dd") & "') AND 
2077
+                            (倉儲明細表.應付立帳 IS NULL OR 倉儲明細表.應付立帳 = 0)"
2078
+        End If
2071 2079
         ConnOpen()
2072
-        SQL1 = "SELECT      倉儲明細表.單據編號, 倉儲明細表.供應商編號, 供應商資料表.簡稱, 物料資料庫.料號, 
2080
+        SQL1 = "SELECT      倉儲明細表.單據編號, 倉儲明細表.供應商編號, 供應商資料表.簡稱 AS 供應商, 物料資料庫.料號, 
2073 2081
                             物料資料庫.頁碼, 物料資料庫.品名, 倉儲明細表.金額 AS 單價, 倉儲明細表.匯率, 
2074 2082
                             倉儲明細表.入庫, 倉儲明細表.金額 * 倉儲明細表.匯率 * 倉儲明細表.入庫 AS 金額, 
2075 2083
                             倉儲明細表.採購下單, 倉儲明細表.入庫日期, 倉儲明細表.備註, 倉儲明細表.應收立帳 AS 選擇, 
2076 2084
                             倉儲明細表.應付立帳, 倉儲明細表.資料流水號
2077 2085
                 FROM        倉儲明細表 LEFT OUTER JOIN
2078 2086
                             供應商資料表 ON 倉儲明細表.供應商編號 = 供應商資料表.編號 LEFT OUTER JOIN
2079
-                            物料資料庫 ON 倉儲明細表.料號 = 物料資料庫.料號
2080
-                WHERE      (倉儲明細表.狀態 LIKE '採購入庫') AND (倉儲明細表.倉儲作業 NOT LIKE '') AND (倉儲明細表.公司編號 LIKE '%" & 公司編號 & "%') AND 
2081
-                           (倉儲明細表.倉儲作業 BETWEEN '" & Format(應付賬款.DateTimePicker1.Value, "yyyy/MM/dd") & "' AND '" & Format(應付賬款.DateTimePicker2.Value, "yyyy/MM/dd") & "')
2087
+                            物料資料庫 ON 倉儲明細表.料號 = 物料資料庫.料號 " & KKKJJ & "
2082 2088
                 ORDER BY    倉儲明細表.單據編號, 倉儲明細表.入庫日期"
2083 2089
         CmdSet_For_DGV()
2084 2090
     End Sub
2091
+    Friend Sub SQL_應付賬款_倉儲明細應付立帳修改()
2092
+        ConnOpen() : SQL1 = "UPDATE 倉儲明細表 SET 應付立帳 = 1 WHERE 資料流水號 LIKE '" & PA6 & "'" : CmdSet_For_dr()
2093
+    End Sub
2085 2094
 End Module

BIN
MaoOrange-Hongji/bin/Debug/MAOJI-ERP-SYS.exe Bestand weergeven


BIN
MaoOrange-Hongji/bin/Debug/MAOJI-ERP-SYS.pdb Bestand weergeven


BIN
MaoOrange-Hongji/obj/Debug/DesignTimeResolveAssemblyReferences.cache Bestand weergeven


BIN
MaoOrange-Hongji/obj/Debug/MAOJI-ERP-SYS.exe Bestand weergeven


BIN
MaoOrange-Hongji/obj/Debug/MAOJI-ERP-SYS.pdb Bestand weergeven


BIN
MaoOrange-Hongji/obj/Debug/MAOJI-ERP-SYS.vbproj.GenerateResource.cache Bestand weergeven


BIN
MaoOrange-Hongji/obj/Debug/MAOJI-ERP-SYS.vbprojAssemblyReference.cache Bestand weergeven


+ 55
- 32
MaoOrange-Hongji/財務系統管理/應付賬款.Designer.vb Bestand weergeven

@@ -22,8 +22,8 @@ Partial Class 應付賬款
22 22
     '請勿使用程式碼編輯器進行修改。
23 23
     <System.Diagnostics.DebuggerStepThrough()> _
24 24
     Private Sub InitializeComponent()
25
-        Dim DataGridViewCellStyle7 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
26
-        Dim DataGridViewCellStyle8 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
25
+        Dim DataGridViewCellStyle3 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
26
+        Dim DataGridViewCellStyle4 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
27 27
         Me.Button1 = New System.Windows.Forms.Button()
28 28
         Me.一般月 = New System.Windows.Forms.CheckBox()
29 29
         Me.會計月 = New System.Windows.Forms.CheckBox()
@@ -57,9 +57,11 @@ Partial Class 應付賬款
57 57
         Me.Label7 = New System.Windows.Forms.Label()
58 58
         Me.NumericUpDown2 = New System.Windows.Forms.NumericUpDown()
59 59
         Me.TextBox1 = New System.Windows.Forms.TextBox()
60
-        Me.Button3 = New System.Windows.Forms.Button()
61 60
         Me.Label8 = New System.Windows.Forms.Label()
62 61
         Me.CheckBox2 = New System.Windows.Forms.CheckBox()
62
+        Me.TextBox4 = New System.Windows.Forms.TextBox()
63
+        Me.CheckBox3 = New System.Windows.Forms.CheckBox()
64
+        Me.TextBox5 = New System.Windows.Forms.TextBox()
63 65
         CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).BeginInit()
64 66
         CType(Me.NumericUpDown1, System.ComponentModel.ISupportInitialize).BeginInit()
65 67
         CType(Me.NumericUpDown2, System.ComponentModel.ISupportInitialize).BeginInit()
@@ -137,8 +139,8 @@ Partial Class 應付賬款
137 139
         '
138 140
         'DataGridView1
139 141
         '
140
-        DataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer))
141
-        Me.DataGridView1.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle7
142
+        DataGridViewCellStyle3.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer))
143
+        Me.DataGridView1.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle3
142 144
         Me.DataGridView1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
143 145
             Or System.Windows.Forms.AnchorStyles.Left) _
144 146
             Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
@@ -148,8 +150,8 @@ Partial Class 應付賬款
148 150
         Me.DataGridView1.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
149 151
         Me.DataGridView1.Name = "DataGridView1"
150 152
         Me.DataGridView1.RowHeadersWidth = 5
151
-        DataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
152
-        Me.DataGridView1.RowsDefaultCellStyle = DataGridViewCellStyle8
153
+        DataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
154
+        Me.DataGridView1.RowsDefaultCellStyle = DataGridViewCellStyle4
153 155
         Me.DataGridView1.RowTemplate.Height = 24
154 156
         Me.DataGridView1.Size = New System.Drawing.Size(1225, 518)
155 157
         Me.DataGridView1.TabIndex = 1108
@@ -177,9 +179,9 @@ Partial Class 應付賬款
177 179
         Me.Button6.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
178 180
         Me.Button6.Font = New System.Drawing.Font("微軟正黑體", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
179 181
         Me.Button6.ForeColor = System.Drawing.Color.Olive
180
-        Me.Button6.Location = New System.Drawing.Point(1001, 3)
182
+        Me.Button6.Location = New System.Drawing.Point(1087, 3)
181 183
         Me.Button6.Name = "Button6"
182
-        Me.Button6.Size = New System.Drawing.Size(86, 47)
184
+        Me.Button6.Size = New System.Drawing.Size(82, 47)
183 185
         Me.Button6.TabIndex = 1149
184 186
         Me.Button6.Text = "依據單號取消立帳選擇"
185 187
         Me.Button6.UseVisualStyleBackColor = True
@@ -227,9 +229,9 @@ Partial Class 應付賬款
227 229
         Me.Button5.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
228 230
         Me.Button5.Font = New System.Drawing.Font("微軟正黑體", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
229 231
         Me.Button5.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
230
-        Me.Button5.Location = New System.Drawing.Point(849, 3)
232
+        Me.Button5.Location = New System.Drawing.Point(1004, 3)
231 233
         Me.Button5.Name = "Button5"
232
-        Me.Button5.Size = New System.Drawing.Size(75, 47)
234
+        Me.Button5.Size = New System.Drawing.Size(82, 47)
233 235
         Me.Button5.TabIndex = 1144
234 236
         Me.Button5.Text = "列印帳款清單"
235 237
         Me.Button5.UseVisualStyleBackColor = True
@@ -325,7 +327,7 @@ Partial Class 應付賬款
325 327
         Me.Button12.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
326 328
         Me.Button12.Font = New System.Drawing.Font("微軟正黑體", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
327 329
         Me.Button12.ForeColor = System.Drawing.Color.Olive
328
-        Me.Button12.Location = New System.Drawing.Point(1165, 27)
330
+        Me.Button12.Location = New System.Drawing.Point(1170, 27)
329 331
         Me.Button12.Name = "Button12"
330 332
         Me.Button12.Size = New System.Drawing.Size(74, 23)
331 333
         Me.Button12.TabIndex = 1133
@@ -337,7 +339,7 @@ Partial Class 應付賬款
337 339
         Me.Button13.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
338 340
         Me.Button13.Font = New System.Drawing.Font("微軟正黑體", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
339 341
         Me.Button13.ForeColor = System.Drawing.Color.Olive
340
-        Me.Button13.Location = New System.Drawing.Point(1165, 3)
342
+        Me.Button13.Location = New System.Drawing.Point(1170, 3)
341 343
         Me.Button13.Name = "Button13"
342 344
         Me.Button13.Size = New System.Drawing.Size(74, 23)
343 345
         Me.Button13.TabIndex = 1132
@@ -358,6 +360,7 @@ Partial Class 應付賬款
358 360
         '
359 361
         Me.NumericUpDown1.Location = New System.Drawing.Point(446, 30)
360 362
         Me.NumericUpDown1.Maximum = New Decimal(New Integer() {1000000, 0, 0, 0})
363
+        Me.NumericUpDown1.Minimum = New Decimal(New Integer() {1000000, 0, 0, -2147483648})
361 364
         Me.NumericUpDown1.Name = "NumericUpDown1"
362 365
         Me.NumericUpDown1.Size = New System.Drawing.Size(100, 23)
363 366
         Me.NumericUpDown1.TabIndex = 1151
@@ -387,6 +390,7 @@ Partial Class 應付賬款
387 390
         '
388 391
         Me.NumericUpDown2.Location = New System.Drawing.Point(446, 56)
389 392
         Me.NumericUpDown2.Maximum = New Decimal(New Integer() {1000000, 0, 0, 0})
393
+        Me.NumericUpDown2.Minimum = New Decimal(New Integer() {1000000, 0, 0, -2147483648})
390 394
         Me.NumericUpDown2.Name = "NumericUpDown2"
391 395
         Me.NumericUpDown2.Size = New System.Drawing.Size(100, 23)
392 396
         Me.NumericUpDown2.TabIndex = 1153
@@ -397,21 +401,9 @@ Partial Class 應付賬款
397 401
         Me.TextBox1.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
398 402
         Me.TextBox1.Location = New System.Drawing.Point(657, 119)
399 403
         Me.TextBox1.Name = "TextBox1"
400
-        Me.TextBox1.Size = New System.Drawing.Size(100, 23)
404
+        Me.TextBox1.Size = New System.Drawing.Size(190, 23)
401 405
         Me.TextBox1.TabIndex = 1155
402 406
         '
403
-        'Button3
404
-        '
405
-        Me.Button3.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
406
-        Me.Button3.Font = New System.Drawing.Font("微軟正黑體", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
407
-        Me.Button3.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
408
-        Me.Button3.Location = New System.Drawing.Point(925, 3)
409
-        Me.Button3.Name = "Button3"
410
-        Me.Button3.Size = New System.Drawing.Size(75, 47)
411
-        Me.Button3.TabIndex = 1156
412
-        Me.Button3.Text = "列印帳款對帳單"
413
-        Me.Button3.UseVisualStyleBackColor = True
414
-        '
415 407
         'Label8
416 408
         '
417 409
         Me.Label8.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
@@ -427,20 +419,48 @@ Partial Class 應付賬款
427 419
         '
428 420
         Me.CheckBox2.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
429 421
         Me.CheckBox2.AutoSize = True
430
-        Me.CheckBox2.Location = New System.Drawing.Point(1093, 5)
422
+        Me.CheckBox2.Location = New System.Drawing.Point(887, 6)
431 423
         Me.CheckBox2.Name = "CheckBox2"
432
-        Me.CheckBox2.Size = New System.Drawing.Size(75, 20)
424
+        Me.CheckBox2.Size = New System.Drawing.Size(99, 20)
433 425
         Me.CheckBox2.TabIndex = 1158
434
-        Me.CheckBox2.Text = "多重選擇"
426
+        Me.CheckBox2.Text = "列印多單選擇"
435 427
         Me.CheckBox2.UseVisualStyleBackColor = True
436 428
         '
429
+        'TextBox4
430
+        '
431
+        Me.TextBox4.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
432
+        Me.TextBox4.Location = New System.Drawing.Point(657, 148)
433
+        Me.TextBox4.Name = "TextBox4"
434
+        Me.TextBox4.Size = New System.Drawing.Size(190, 23)
435
+        Me.TextBox4.TabIndex = 1163
436
+        '
437
+        'CheckBox3
438
+        '
439
+        Me.CheckBox3.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
440
+        Me.CheckBox3.AutoSize = True
441
+        Me.CheckBox3.Location = New System.Drawing.Point(887, 26)
442
+        Me.CheckBox3.Name = "CheckBox3"
443
+        Me.CheckBox3.Size = New System.Drawing.Size(111, 20)
444
+        Me.CheckBox3.TabIndex = 1164
445
+        Me.CheckBox3.Text = "已立帳資料隱藏"
446
+        Me.CheckBox3.UseVisualStyleBackColor = True
447
+        '
448
+        'TextBox5
449
+        '
450
+        Me.TextBox5.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
451
+        Me.TextBox5.Location = New System.Drawing.Point(657, 177)
452
+        Me.TextBox5.Name = "TextBox5"
453
+        Me.TextBox5.Size = New System.Drawing.Size(190, 23)
454
+        Me.TextBox5.TabIndex = 1165
455
+        '
437 456
         '應付賬款
438 457
         '
439 458
         Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 16.0!)
440 459
         Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
441 460
         Me.ClientSize = New System.Drawing.Size(1249, 611)
461
+        Me.Controls.Add(Me.TextBox5)
462
+        Me.Controls.Add(Me.TextBox4)
442 463
         Me.Controls.Add(Me.Label8)
443
-        Me.Controls.Add(Me.Button3)
444 464
         Me.Controls.Add(Me.TextBox1)
445 465
         Me.Controls.Add(Me.Label7)
446 466
         Me.Controls.Add(Me.NumericUpDown2)
@@ -472,9 +492,10 @@ Partial Class 應付賬款
472 492
         Me.Controls.Add(Me.Label4)
473 493
         Me.Controls.Add(Me.DateTimePicker2)
474 494
         Me.Controls.Add(Me.DateTimePicker1)
475
-        Me.Controls.Add(Me.DataGridView1)
476 495
         Me.Controls.Add(Me.Label6)
477 496
         Me.Controls.Add(Me.CheckBox2)
497
+        Me.Controls.Add(Me.CheckBox3)
498
+        Me.Controls.Add(Me.DataGridView1)
478 499
         Me.Font = New System.Drawing.Font("微軟正黑體", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
479 500
         Me.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
480 501
         Me.Name = "應付賬款"
@@ -520,7 +541,9 @@ Partial Class 應付賬款
520 541
     Friend WithEvents Label7 As Label
521 542
     Friend WithEvents NumericUpDown2 As NumericUpDown
522 543
     Friend WithEvents TextBox1 As TextBox
523
-    Friend WithEvents Button3 As Button
524 544
     Friend WithEvents Label8 As Label
525 545
     Friend WithEvents CheckBox2 As CheckBox
546
+    Friend WithEvents TextBox4 As TextBox
547
+    Friend WithEvents CheckBox3 As CheckBox
548
+    Friend WithEvents TextBox5 As TextBox
526 549
 End Class

+ 192
- 8
MaoOrange-Hongji/財務系統管理/應付賬款.vb Bestand weergeven

@@ -1,6 +1,17 @@
1 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 11
 Public Class 應付賬款
3 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
4 15
     Private Sub Set_賬款清單()
5 16
         DataGridView1.DataSource = Nothing : ds.Clear() : DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing : DataGridView1.ColumnHeadersHeight = 40
6 17
         DataGridView1.AllowUserToAddRows = False : DataGridView1.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText : DataGridView1.MultiSelect = True
@@ -62,7 +73,8 @@ Public Class 應付賬款
62 73
     End Sub
63 74
     Private Sub 應付賬款_Load(sender As Object, e As EventArgs) Handles MyBase.Load
64 75
         Me.MdiParent = MAOJI_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
65
-        ComboBox6.Visible = False : TextBox1.Visible = False
76
+        ComboBox6.Visible = False : TextBox1.Visible = False : TextBox4.Visible = False : TextBox5.Visible = False
77
+        TextBox1.Text = "0" : TextBox2.Text = "0"
66 78
         ComboBox1下拉表單資料載入() : ComboBox3下拉表單資料載入() : ComboBox6下拉表單資料載入() : 日期格式() : Set_賬款清單()
67 79
     End Sub
68 80
     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
@@ -102,19 +114,17 @@ Public Class 應付賬款
102 114
     End Sub
103 115
     Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
104 116
         If e.RowIndex = -1 Then : Else
105
-            TextBox3.Text = DataGridView1.Rows(e.RowIndex).Cells("單據編號").Value
117
+            TextBox3.Text = DataGridView1.Rows(e.RowIndex).Cells("單據編號").Value : TextBox5.Text = DataGridView1.Rows(e.RowIndex).Cells("供應商").Value
106 118
             TextBox2.Text = "0" : TextBox1.Text = "0"
107 119
             For I As Integer = 0 To DataGridView1.Rows.Count - 1
108 120
                 If CheckBox2.Checked = False Then
109 121
                     DataGridView1.Rows(I).Cells("選擇").Value = False
110 122
                 End If
111 123
 
112
-                If DataGridView1.Rows(I).Cells("應付立帳").Value = False Then
113
-                    If TextBox3.Text = DataGridView1.Rows(I).Cells("單據編號").Value Then
114
-                        DataGridView1.Rows(I).Cells("選擇").Value = True
115
-                        TextBox1.Text = Val(TextBox1.Text) + DataGridView1.Rows(I).Cells("金額").Value
116
-                        TextBox2.Text = Val(TextBox2.Text) + DataGridView1.Rows(I).Cells("金額").Value
117
-                    End If
124
+                If TextBox3.Text = DataGridView1.Rows(I).Cells("單據編號").Value Then
125
+                    DataGridView1.Rows(I).Cells("選擇").Value = True
126
+                    TextBox1.Text = Val(TextBox1.Text) + DataGridView1.Rows(I).Cells("金額").Value
127
+                    TextBox2.Text = Val(TextBox2.Text) + DataGridView1.Rows(I).Cells("金額").Value
118 128
                 End If
119 129
             Next
120 130
             TextBox2.Text = Strings.Format(Val(TextBox2.Text), "#,##0")
@@ -145,7 +155,181 @@ Public Class 應付賬款
145 155
             End If
146 156
         Next i
147 157
     End Sub
158
+    Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
159
+        NumericUpDown2.Value = Val(TextBox1.Text) - NumericUpDown1.Value
160
+    End Sub
148 161
     Private Sub NumericUpDown1_ValueChanged(sender As Object, e As EventArgs) Handles NumericUpDown1.ValueChanged
149 162
         NumericUpDown2.Value = Val(TextBox1.Text) - NumericUpDown1.Value
150 163
     End Sub
164
+    Private Sub CheckBox3_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox3.CheckedChanged
165
+        Set_賬款清單()
166
+    End Sub
167
+    Private Sub Set_日期格式轉換()
168
+        If CheckBox1.Checked = False Then : DTP = Strings.Format(Today(), "yyyy/MM/dd") : DTP1 = Strings.Format(Today(), "yyyyMMdd")
169
+        Else : DTP1 = Strings.Format(DateTimePicker3.Value, "yyyyMMdd") : DTP = Strings.Format(DateTimePicker3.Value, "yyyy/MM/dd") : End If
170
+    End Sub
171
+    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
172
+        If CheckBox2.Checked = True Then
173
+            MsgBox("開立支付單(傳票)需要一張一張來,請重新選擇。")
174
+            CheckBox2.Checked = False
175
+            For I As Integer = 0 To DataGridView1.Rows.Count - 1
176
+                DataGridView1.Rows(I).Cells("選擇").Value = False
177
+            Next
178
+        Else
179
+            If NumericUpDown1.Value = 0 Then
180
+                MsgBox("實付金額不可為零。") : Exit Sub
181
+            Else
182
+                If NumericUpDown2.Value = 0 Then : Else
183
+                    If ComboBox6.Text = "" Then
184
+                        MsgBox("未付款金額擇讓需要會計科目。") : Exit Sub
185
+                    Else
186
+                    End If
187
+                End If
188
+                Dim 確認 As Boolean = False
189
+                For i As Integer = 0 To DataGridView1.Rows.Count - 1
190
+                    If DataGridView1.Rows(i).Cells("選擇").Value = True Then
191
+                        MsgBox("該採購單已經開立過傳票,如是之前開立有誤需要從新開立,請先點擊--依據單號取消立帳選擇--按鈕。如是因採購退貨需要開立收支單(傳票)請先勾選--已立帳資料隱藏--再行操作。")
192
+                        確認 = True : Exit Sub
193
+                    End If
194
+                Next
195
+                If 確認 = False Then : MsgBox("沒有選擇任何一筆要轉收支帳(傳票)的採購單號。")
196
+                Else
197
+                    Dim NUM1 As Integer : Set_日期格式轉換()
198
+                    For ii As Integer = 1 To 999
199
+                        NUM1 = 0 + ii
200
+                        If NUM1 < 10 Then : TextBox4.Text = "OE-" & DTP1 & "-00" & NUM1
201
+                        ElseIf NUM1 > 9 And NUM1 < 100 Then : TextBox4.Text = "OE-" & DTP1 & "-0" & NUM1
202
+                        ElseIf NUM1 > 99 Then : TextBox4.Text = "OE-" & DTP1 & "-" & NUM1 : End If : PA = TextBox4.Text
203
+                        SQL_營運成本收支單申請_支付單號流水號()
204
+                        If dr.Read() Then : Else : ii = 999 : End If
205
+                    Next
206
+                    SQL_營運成本控制表新增()
207
+
208
+                    SQL_營運成本明細表項次新增查詢()
209
+                    If dr.Read() Then : 新項次 = dr("項次") : Else : 新項次 = "00" : End If : conn.Close() : NUM1 = Double.Parse(新項次) + 1
210
+                    If NUM1 < 10 Then : 新項次 = "0" & NUM1
211
+                    ElseIf NUM1 > 9 And NUM1 < 100 Then : 新項次 = NUM1 : End If
212
+
213
+                    PA1 = TextBox4.Text : PA2 = 新項次 : PA3 = "B-02-02-02" : PA4 = TextBox5.Text & " - " & DateTimePicker1.Value & " 到 " & DateTimePicker2.Value & " 應付帳款"
214
+                    NU1 = NumericUpDown1.Value : PA5 = "" : NU2 = 0 : NU3 = 0 : NU4 = 0
215
+                    SQL_營運成本明細表新增()
216
+
217
+                    If NumericUpDown2.Value = 0 Then : Else
218
+                        SQL_營運成本明細表項次新增查詢()
219
+                        If dr.Read() Then : 新項次 = dr("項次") : Else : 新項次 = "00" : End If : conn.Close() : NUM1 = Double.Parse(新項次) + 1
220
+                        If NUM1 < 10 Then : 新項次 = "0" & NUM1
221
+                        ElseIf NUM1 > 9 And NUM1 < 100 Then : 新項次 = NUM1 : End If
222
+
223
+                        PA1 = TextBox4.Text : PA2 = 新項次 : PA3 = ComboBox6.Text : PA4 = TextBox5.Text & " - " & DateTimePicker1.Value & " 到 " & DateTimePicker2.Value & " 貨款折讓"
224
+                        NU1 = NumericUpDown2.Value * -1 : PA5 = "" : NU2 = 0 : NU3 = 0 : NU4 = 0
225
+                        SQL_營運成本明細表新增()
226
+                    End If
227
+                    For i As Integer = 0 To DataGridView1.Rows.Count - 1
228
+                        資料數 = DataGridView1.Rows.Count : MyModule1.進度條()
229
+                        If DataGridView1.Rows(i).Cells("選擇").Value = True Then
230
+                            PA6 = DataGridView1.Rows(i).Cells("資料流水號").Value
231
+                            SQL_應付賬款_倉儲明細應付立帳修改()
232
+                        End If
233
+                    Next i : MAOJI_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0 : MsgBox("財務收支單(傳票)申請完成,請通知主管審核。") : Set_賬款清單()
234
+                End If
235
+            End If
236
+        End If
237
+    End Sub
238
+    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
239
+        xlApp = CType(CreateObject("Excel.Application"), Application)
240
+        xlBook = xlApp.Workbooks.Add
241
+        xlApp.DisplayAlerts = True
242
+        xlApp.Visible = True
243
+        xlApp.Application.WindowState = xlMaximized
244
+        N1 = 0
245
+        If DataGridView1.Rows.Count = 0 Then : Else
246
+            xlSheet = NewMethod(xlBook)
247
+            xlSheet.Cells(1, 1) = MAOJI_ERP_SYS.ComboBox2.Text : xlSheet.Cells(2, 1) = DateTimePicker1.Value & " 到 " & DateTimePicker2.Value & " 應付帳款清單"
248
+            xlSheet.Cells(3, 1) = "單據編號" : xlSheet.Cells(3, 2) = "供應商" : xlSheet.Cells(3, 3) = "頁碼" : xlSheet.Cells(3, 4) = "品名" : xlSheet.Cells(3, 5) = "單價" : xlSheet.Cells(3, 6) = "匯率"
249
+            xlSheet.Cells(3, 7) = "入庫" : xlSheet.Cells(3, 8) = "金額" : xlSheet.Cells(3, 9) = "採購下單" : xlSheet.Cells(3, 10) = "入庫日期" : xlSheet.Cells(3, 11) = "是否立帳"
250
+            xlSheet.Cells(2, 7) = "合計" : xlSheet.Cells(2, 8) = "=SUBTOTAL(9,H4:H9999)"
251
+            For i As Integer = 0 To DataGridView1.Rows.Count - 1
252
+                If DataGridView1.Rows(i).Cells("選擇").Value = True Then
253
+                    xlSheet.Cells(N1 + 4, 1) = DataGridView1.Rows(i).Cells("單據編號").Value : xlSheet.Cells(N1 + 4, 2) = DataGridView1.Rows(i).Cells("供應商").Value
254
+                    xlSheet.Cells(N1 + 4, 3) = DataGridView1.Rows(i).Cells("頁碼").Value : xlSheet.Cells(N1 + 4, 4) = DataGridView1.Rows(i).Cells("品名").Value
255
+                    xlSheet.Cells(N1 + 4, 5) = DataGridView1.Rows(i).Cells("單價").Value : xlSheet.Cells(N1 + 4, 6) = DataGridView1.Rows(i).Cells("匯率").Value
256
+                    xlSheet.Cells(N1 + 4, 7) = DataGridView1.Rows(i).Cells("入庫").Value : xlSheet.Cells(N1 + 4, 8) = DataGridView1.Rows(i).Cells("金額").Value
257
+                    xlSheet.Cells(N1 + 4, 9) = DataGridView1.Rows(i).Cells("採購下單").Value : xlSheet.Cells(N1 + 4, 10) = DataGridView1.Rows(i).Cells("入庫日期").Value
258
+                    If DataGridView1.Rows(i).Cells("應付立帳").Value = True Then : PA1 = "YES" : Else : PA1 = "NO" : End If
259
+                    xlSheet.Cells(N1 + 4, 11) = PA1
260
+                    N1 += 1
261
+                End If
262
+            Next i
263
+            N1 += 4
264
+            AA(xlApp, xlSheet)
265
+        End If
266
+
267
+        xlSheet.PageSetup.PrintArea = ""
268
+        xlApp.Cells.Select()
269
+        xlSheet.Range("B1").Select()
270
+        xlApp.Application.WindowState = xlMinimized
271
+        xlSheet.Cells.Select()
272
+        MsgBox("列印完成。")
273
+    End Sub
274
+    Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
275
+        Return CType(xlBook.Worksheets.Add, Worksheet)
276
+    End Function
277
+    Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
278
+        xlSheet.Cells.Select()
279
+        With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
280
+            .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
281
+
282
+        xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 18 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 10
283
+        xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 9 : xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 30
284
+        xlSheet.Columns("E:H").Select : myExcel.Selection.NumberFormatLocal = "#,##0;[紅色]-#,##0"
285
+        xlSheet.Columns("F:F").Select : myExcel.Selection.NumberFormatLocal = "#,##0.000;[紅色]-#,##0.000"
286
+        xlSheet.Columns("E:H").Select : myExcel.Selection.ColumnWidth = 7 : xlSheet.Columns("I:J").Select : myExcel.Selection.ColumnWidth = 10
287
+        xlSheet.Columns("K:K").Select : myExcel.Selection.ColumnWidth = 8
288
+
289
+        xlSheet.Rows("1:1").Select
290
+        With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 22 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
291
+            .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
292
+        xlSheet.Rows("2:2").Select
293
+        With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 18 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
294
+            .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
295
+        xlSheet.Rows("3:3").Select
296
+        With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
297
+            .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
298
+
299
+        xlSheet.Rows("4:4").Select : myExcel.ActiveWindow.FreezePanes = True : xlSheet.Rows("3:3").Select : myExcel.Selection.AutoFilter
300
+        xlSheet.Rows("3:3").Select : myExcel.Selection.RowHeight = 25
301
+        With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
302
+            .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
303
+
304
+        xlSheet.Range("H2:I2").Select()
305
+        With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
306
+            .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
307
+
308
+        xlSheet.Range("G2:I2").Select()
309
+        With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
310
+            .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
311
+
312
+        xlSheet.Range("A1:K1").Select()
313
+        With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
314
+            .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
315
+        xlSheet.Range("A2:F2").Select()
316
+
317
+        With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
318
+            .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
319
+
320
+        xlSheet.Range("L10").Select() : myExcel.ActiveWindow.DisplayGridlines = False
321
+
322
+        xlSheet.Range("G2").Select()
323
+        With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
324
+            .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
325
+
326
+        xlSheet.Range("A3:K" & N1).Select()
327
+        myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
328
+        With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
329
+        With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
330
+        With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
331
+        With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
332
+        With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
333
+        With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
334
+    End Sub
151 335
 End Class

+ 8
- 8
MaoOrange-Hongji/資料庫系統管理/列印_產品標籤介面.vb Bestand weergeven

@@ -54,20 +54,20 @@ Public Class 列印_產品標籤介面
54 54
                 N1 = 0
55 55
                 For II As Integer = 1 To Val(TextBox1.Text)
56 56
                     xlSheet.Cells(1 + N1, 1) = MAOJI_ERP_SYS.ComboBox2.Text : xlSheet.Cells(2 + N1, 1) = PA1
57
-                    xlSheet.Cells(3 + N1, 1) = "系統單號" : xlSheet.Cells(3 + N1, 2) = DataGridView1.Rows(I).Cells("單據編號").Value : xlSheet.Cells(3 + N1, 3) = "單據數量"
58
-                    xlSheet.Cells(4 + N1, 1) = "系統料號" : xlSheet.Cells(4 + N1, 2) = DataGridView1.Rows(I).Cells("料號").Value : xlSheet.Cells(4 + N1, 3) = TextBox1.Text
59
-                    xlSheet.Cells(5 + N1, 1) = "產品頁碼" : xlSheet.Cells(5 + N1, 2) = DataGridView1.Rows(I).Cells("頁碼").Value
60
-                    xlSheet.Cells(6 + N1, 1) = "產品名稱" : xlSheet.Cells(6 + N1, 2) = DataGridView1.Rows(I).Cells("品名").Value
57
+                    xlSheet.Cells(3 + N1, 1) = "系統單號 : " : xlSheet.Cells(3 + N1, 2) = DataGridView1.Rows(I).Cells("單據編號").Value : xlSheet.Cells(3 + N1, 3) = "單據數量"
58
+                    xlSheet.Cells(4 + N1, 1) = "系統料號 : " : xlSheet.Cells(4 + N1, 2) = DataGridView1.Rows(I).Cells("料號").Value : xlSheet.Cells(4 + N1, 3) = TextBox1.Text
59
+                    xlSheet.Cells(5 + N1, 1) = "產品頁碼 : " : xlSheet.Cells(5 + N1, 2) = DataGridView1.Rows(I).Cells("頁碼").Value
60
+                    xlSheet.Cells(6 + N1, 1) = "產品名稱 : " : xlSheet.Cells(6 + N1, 2) = DataGridView1.Rows(I).Cells("品名").Value
61 61
                     xlSheet.Cells(7 + N1, 1) = "產品件數 : 共 (                    )"
62 62
                     BB(xlApp, xlSheet)
63 63
                     N1 += 8
64 64
                 Next
65 65
             Else
66 66
                 xlSheet.Cells(1, 1) = MAOJI_ERP_SYS.ComboBox2.Text : xlSheet.Cells(2, 1) = PA1
67
-                xlSheet.Cells(3, 1) = "系統單號" : xlSheet.Cells(3, 2) = DataGridView1.Rows(I).Cells("項次").Value : xlSheet.Cells(6, 3) = "單據數量"
68
-                xlSheet.Cells(4, 1) = "系統料號" : xlSheet.Cells(4, 2) = DataGridView1.Rows(I).Cells("項次").Value : xlSheet.Cells(4, 3) = TextBox1.Text
69
-                xlSheet.Cells(5, 1) = "產品頁碼" : xlSheet.Cells(5, 2) = DataGridView1.Rows(I).Cells("項次").Value
70
-                xlSheet.Cells(6, 1) = "產品名稱" : xlSheet.Cells(6, 2) = DataGridView1.Rows(I).Cells("項次").Value
67
+                xlSheet.Cells(3, 1) = "系統單號 : " : xlSheet.Cells(3, 2) = DataGridView1.Rows(I).Cells("項次").Value : xlSheet.Cells(6, 3) = "單據數量"
68
+                xlSheet.Cells(4, 1) = "系統料號 : " : xlSheet.Cells(4, 2) = DataGridView1.Rows(I).Cells("項次").Value : xlSheet.Cells(4, 3) = TextBox1.Text
69
+                xlSheet.Cells(5, 1) = "產品頁碼 : " : xlSheet.Cells(5, 2) = DataGridView1.Rows(I).Cells("項次").Value
70
+                xlSheet.Cells(6, 1) = "產品名稱 : " : xlSheet.Cells(6, 2) = DataGridView1.Rows(I).Cells("項次").Value
71 71
                 xlSheet.Cells(7, 1) = "產品件數 : 共 (                    )"
72 72
                 BB(xlApp, xlSheet)
73 73
             End If

Laden…
Annuleren
Opslaan