B70340 3 jaren geleden
bovenliggende
commit
37231c9890

BIN
.vs/TENDEN-MES-SYS/v16/.suo Bestand weergeven


+ 2
- 1
TENDEN-MES-SYS/Module/SQL_人事系統管理.vb Bestand weergeven

@@ -7,7 +7,8 @@
7 7
     End Sub
8 8
     Friend Sub SQL_人員ID卡系統配置設定_配卡()
9 9
         ConnOpen()
10
-        SQL1 = "UPDATE 使用者 SET ID卡號 = N'" & 人員ID卡系統配置設定.ID卡號_tb.Text & "' WHERE (帳號 = N'" & 人員ID卡系統配置設定.帳號_tb.Text & "') AND (姓名 = N'" & 人員ID卡系統配置設定.姓名_tb.Text & "')"
10
+        SQL1 = "UPDATE 使用者 SET ID卡號 = N'" & 人員ID卡系統配置設定.ID卡號_tb.Text & "' 
11
+                WHERE (帳號 = N'" & 人員ID卡系統配置設定.帳號_tb.Text & "') AND (姓名 = N'" & 人員ID卡系統配置設定.姓名_tb.Text & "')"
11 12
         CmdSet_For_dr()
12 13
     End Sub
13 14
 End Module

+ 25
- 225
TENDEN-MES-SYS/Module/SQL_成本系統管理.vb Bestand weergeven

@@ -2,255 +2,55 @@
2 2
     '--------------------------------成本資料庫管理---------------------------------------------------------------------------
3 3
     Friend Sub SQL_成本資料庫管理表單()
4 4
         ConnOpen()
5
-        SQL1 = "SELECT   訂單控制表.訂單流水號, 訂單控制表.資料流水號, 訂單控制表.年份季度, 訂單控制表.客戶訂單號, 訂單控制表.形體號, 訂單控制表.顏色, 訂單控制表.楦型, 訂單控制表.訂單數量 AS 數量, 
6
-                         訂單控制表.客戶交期, 訂單控制表.單價, 訂單控制表.總金額, 訂單控制表.備註, 訂單控制表.生產工廠 AS 工廠, 訂單控制表.訂單種類, 訂單價格利潤明細表.Quantity, 
7
-                         訂單價格利潤明細表.Currency, 訂單價格利潤明細表.Exchange, 訂單價格利潤明細表.FTYPrice, (訂單控制表.單價 - 訂單價格利潤明細表.FTYPrice) * 訂單價格利潤明細表.Quantity 
8
-                         AS CommissionTTL, (訂單控制表.單價 - 訂單價格利潤明細表.FTYPrice) * 訂單價格利潤明細表.Quantity / 2 AS CommissionDarren, (訂單控制表.單價 - 訂單價格利潤明細表.FTYPrice) * 
9
-                         訂單價格利潤明細表.Quantity / 2 AS CommissionTendenza, 訂單控制表.單價 - 訂單價格利潤明細表.FTYPrice AS Percentage, 訂單價格利潤明細表.BasicPrice, 訂單價格利潤明細表.Polybag, 
10
-                         訂單價格利潤明細表.FOOTformOrPETform AS FOOTorPET, 訂單價格利潤明細表.Tooling, 訂單價格利潤明細表.RubberBand, 訂單價格利潤明細表.JHOOK, 訂單價格利潤明細表.WaterResistant, 
11
-                         訂單價格利潤明細表.P16VAT, 訂單價格利潤明細表.EXWsaving, 訂單價格利潤明細表.Quantity * 訂單價格利潤明細表.Tooling AS CollectedToolng, 訂單價格利潤明細表.年份, 
12
-                         訂單價格利潤明細表.利潤表流水號, 訂單控制表.訂單數量 - 訂單價格利潤明細表.Quantity AS 驗證 
13
-                FROM     訂單價格利潤明細表 LEFT OUTER JOIN 訂單控制表 ON 訂單價格利潤明細表.資料流水號 = 訂單控制表.資料流水號 
14
-                WHERE   (訂單價格利潤明細表.年份 LIKE '" & 成本資料庫管理.年份_cb.Text & "') AND (訂單控制表.CXL IS NULL OR 訂單控制表.CXL = 0) AND (訂單控制表.訂單流水號 IS NULL) ORDER BY 訂單控制表.訂單流水號 DESC"
5
+        SQL1 = "SELECT   " & 訂單資料表(1) & ".訂單流水號, " & 訂單資料表(1) & ".資料流水號, " & 訂單資料表(1) & ".年份季度, " & 訂單資料表(1) & ".客戶訂單號, " & 訂單資料表(1) & ".形體號, 
6
+                         " & 訂單資料表(1) & ".顏色, " & 訂單資料表(1) & ".楦型, " & 訂單資料表(1) & ".訂單數量 AS 數量, " & 訂單資料表(1) & ".客戶交期, " & 訂單資料表(1) & ".單價, 
7
+                         " & 訂單資料表(1) & ".總金額, " & 訂單資料表(1) & ".備註, " & 訂單資料表(1) & ".生產工廠 AS 工廠, " & 訂單資料表(1) & ".訂單種類, " & 訂單資料表(7) & ".Quantity, 
8
+                         " & 訂單資料表(7) & ".Currency, " & 訂單資料表(7) & ".Exchange, " & 訂單資料表(7) & ".FTYPrice, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * 
9
+                         " & 訂單資料表(7) & ".Quantity AS CommissionTTL, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionDarren, 
10
+                        (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionTendenza, " & 訂單資料表(1) & ".單價 - 
11
+                         " & 訂單資料表(7) & ".FTYPrice AS Percentage, " & 訂單資料表(7) & ".BasicPrice, " & 訂單資料表(7) & ".Polybag, " & 訂單資料表(7) & ".FOOTformOrPETform AS FOOTorPET, 
12
+                         " & 訂單資料表(7) & ".Tooling, " & 訂單資料表(7) & ".RubberBand, " & 訂單資料表(7) & ".JHOOK, " & 訂單資料表(7) & ".WaterResistant, " & 訂單資料表(7) & ".P16VAT, 
13
+                         " & 訂單資料表(7) & ".EXWsaving, " & 訂單資料表(7) & ".Quantity * " & 訂單資料表(7) & ".Tooling AS CollectedToolng, " & 訂單資料表(7) & ".年份, 
14
+                         " & 訂單資料表(7) & ".利潤表流水號, " & 訂單資料表(1) & ".訂單數量 - " & 訂單資料表(7) & ".Quantity AS 驗證 
15
+                FROM     " & 訂單資料表(7) & " LEFT OUTER JOIN " & 訂單資料表(1) & " ON " & 訂單資料表(7) & ".資料流水號 = " & 訂單資料表(1) & ".資料流水號 
16
+                WHERE   (" & 訂單資料表(7) & ".年份 LIKE '" & 成本資料庫管理.年份_cb.Text & "') AND (" & 訂單資料表(1) & ".CXL IS NULL OR " & 訂單資料表(1) & ".CXL = 0) AND 
17
+                        (" & 訂單資料表(1) & ".訂單流水號 IS NULL) ORDER BY " & 訂單資料表(1) & ".訂單流水號 DESC"
15 18
         CmdSet_For_DGV()
16 19
     End Sub
17 20
     Friend Sub SQL_訂單價格利潤明細表()
18 21
         ConnOpen()
19
-        SQL1 = "SELECT 資料流水號, 天盾訂單號, 客戶流水號, 年份, 利潤表流水號 FROM 訂單價格利潤明細表 WHERE (利潤表流水號 LIKE '" & 成本資料庫管理.利潤表流水號_tb.Text & "')"
22
+        SQL1 = "SELECT 資料流水號, 天盾訂單號, 客戶流水號, 年份, 利潤表流水號 FROM " & 訂單資料表(7) & " WHERE (利潤表流水號 LIKE '" & 成本資料庫管理.利潤表流水號_tb.Text & "')"
20 23
         CmdSet_For_DGV()
21 24
     End Sub
22 25
     Friend Sub SQL_訂單價格利潤明細表_天盾訂單號()
23 26
         ConnOpen()
24
-        SQL1 = "SELECT  訂單價格利潤明細表.資料流水號, 訂單價格利潤明細表.天盾訂單號, 訂單價格利潤明細表.客戶流水號, 訂單價格利潤明細表.年份, 訂單價格利潤明細表.利潤表流水號, 
25
-                            訂單控制表.形體號, 訂單控制表.顏色, 訂單控制表.楦型 
26
-                FROM    訂單價格利潤明細表 LEFT OUTER JOIN 訂單控制表 ON 訂單價格利潤明細表.資料流水號 = 訂單控制表.資料流水號 
27
-                WHERE  (訂單價格利潤明細表.天盾訂單號 LIKE '" & 成本資料庫管理.天盾訂單號_tb.Text & "') ORDER BY 訂單控制表.形體號, 訂單控制表.顏色, 訂單控制表.楦型"
27
+        SQL1 = "SELECT    " & 訂單資料表(7) & ".資料流水號, " & 訂單資料表(7) & ".天盾訂單號, " & 訂單資料表(7) & ".客戶流水號, " & 訂單資料表(7) & ".年份, " & 訂單資料表(7) & ".利潤表流水號, 
28
+                          " & 訂單資料表(1) & ".形體號, " & 訂單資料表(1) & ".顏色, " & 訂單資料表(1) & ".楦型 
29
+                FROM      " & 訂單資料表(7) & " LEFT OUTER JOIN " & 訂單資料表(1) & " ON " & 訂單資料表(7) & ".資料流水號 = " & 訂單資料表(1) & ".資料流水號 
30
+                WHERE    (" & 訂單資料表(7) & ".天盾訂單號 LIKE '" & 成本資料庫管理.天盾訂單號_tb.Text & "') 
31
+                ORDER BY  " & 訂單資料表(1) & ".形體號, " & 訂單資料表(1) & ".顏色, " & 訂單資料表(1) & ".楦型"
28 32
         CmdSet_For_DGV()
29 33
     End Sub
30 34
     Friend Sub SQL_訂單控制表_訂單流水號()
31 35
         ConnOpen()
32
-        SQL1 = "SELECT 訂單流水號, 年份季度, 客戶訂單號, 形體號, 顏色, 楦型 FROM 訂單控制表 WHERE (訂單流水號 LIKE '" & 成本資料庫管理.天盾訂單號_tb.Text & "') ORDER BY   形體號, 顏色, 楦型"
36
+        SQL1 = "SELECT 訂單流水號, 年份季度, 客戶訂單號, 形體號, 顏色, 楦型 FROM " & 訂單資料表(1) & " WHERE (訂單流水號 LIKE '" & 成本資料庫管理.天盾訂單號_tb.Text & "') ORDER BY   形體號, 顏色, 楦型"
33 37
         CmdSet_For_DGV()
34 38
     End Sub
35 39
     Friend Sub SQL_訂單明細表_天盾流水號()
36 40
         ConnOpen()
37
-        SQL1 = "SELECT 天盾流水號, 客戶訂單號, ItemNumber, ProductName, ProductDescription, Color, DM FROM 訂單明細表 WHERE (天盾流水號 LIKE '" & 成本資料庫管理.天盾訂單號_tb.Text & "') ORDER BY   ProductName, Color, DM"
41
+        SQL1 = "SELECT    天盾流水號, 客戶訂單號, ItemNumber, ProductName, ProductDescription, Color, DM FROM " & 訂單資料表(6) & " 
42
+                WHERE    (天盾流水號 LIKE '" & 成本資料庫管理.天盾訂單號_tb.Text & "') 
43
+                ORDER BY  ProductName, Color, DM"
38 44
         CmdSet_For_DGV()
39 45
     End Sub
40 46
     Friend Sub SQL_訂單控制表_資料流水號()
41 47
         ConnOpen()
42
-        SQL1 = "SELECT 訂單流水號, 年份季度, 客戶訂單號, 形體號, 顏色, 楦型 FROM 訂單控制表 WHERE (資料流水號 LIKE '" & 成本資料庫管理.資料流水號_tb.Text & "') ORDER BY   形體號, 顏色, 楦型"
48
+        SQL1 = "SELECT 訂單流水號, 年份季度, 客戶訂單號, 形體號, 顏色, 楦型 FROM " & 訂單資料表(1) & " WHERE (資料流水號 LIKE '" & 成本資料庫管理.資料流水號_tb.Text & "') ORDER BY   形體號, 顏色, 楦型"
43 49
         CmdSet_For_DGV()
44 50
     End Sub
45 51
     Friend Sub SQL_刪除訂單控制表_利潤表流水號()
46 52
         ConnOpen()
47
-        SQL1 = "DELETE FROM 訂單價格利潤明細表 WHERE (利潤表流水號 = '" & 成本資料庫管理.利潤表流水號_tb.Text & "')"
53
+        SQL1 = "DELETE FROM " & 訂單資料表(7) & " WHERE (利潤表流水號 = '" & 成本資料庫管理.利潤表流水號_tb.Text & "')"
48 54
         CmdSet_For_dr()
49 55
     End Sub
50
-    '--------------------------------訂單價格利潤明細表---------------------------------------------------------------------------
51
-    Friend Sub SQL_利潤表載入()
52
-        SQL1 = "SELECT " & 訂單資料表(1) & ".訂單流水號, " & 訂單資料表(1) & ".資料流水號, " & 訂單資料表(1) & ".年份季度, " & 訂單資料表(1) & ".力威訂單號, " & 訂單資料表(1) & ".形體號, 
53
-                               " & 訂單資料表(1) & ".顏色, " & 訂單資料表(1) & ".楦型, " & 訂單資料表(1) & ".訂單數量 AS 數量, " & 訂單資料表(1) & ".客戶交期, " & 訂單資料表(1) & ".單價, 
54
-                               " & 訂單資料表(1) & ".總金額, " & 訂單資料表(1) & ".備註, " & 訂單資料表(1) & ".生產工廠 AS 工廠, " & 訂單資料表(1) & ".訂單種類, " & 訂單資料表(7) & ".Quantity, 
55
-                               " & 訂單資料表(7) & ".Currency, " & 訂單資料表(7) & ".Exchange, " & 訂單資料表(7) & ".FTYPrice, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * 
56
-                               " & 訂單資料表(7) & ".Quantity AS CommissionTTL, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionDarren, 
57
-                              (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionTendenza, (" & 訂單資料表(1) & ".單價 - 
58
-                               " & 訂單資料表(7) & ".FTYPrice) AS Percentage, " & 訂單資料表(7) & ".BasicPrice, " & 訂單資料表(7) & ".Polybag AS [PG/MOQ], " & 訂單資料表(7) & ".FOOTformOrPETform AS FOOTorPET, 
59
-                               " & 訂單資料表(7) & ".Tooling, " & 訂單資料表(7) & ".RubberBand, " & 訂單資料表(7) & ".JHOOK, " & 訂單資料表(7) & ".WaterResistant, " & 訂單資料表(7) & ".P16VAT, 
60
-                               " & 訂單資料表(7) & ".EXWsaving, " & 訂單資料表(7) & ".Quantity * " & 訂單資料表(7) & ".Tooling AS CollectedToolng, " & 訂單資料表(7) & ".年份, 
61
-                               " & 訂單資料表(7) & ".利潤表流水號, " & 訂單資料表(1) & ".訂單數量 - " & 訂單資料表(7) & ".Quantity AS 驗證, STYLELIST.ItemNumber, " & 訂單資料表(7) & ".審核, 
62
-                               " & 訂單資料表(1) & ".客戶訂單號 
63
-                        FROM   " & 訂單資料表(1) & " LEFT OUTER JOIN STYLELIST ON " & 訂單資料表(1) & ".形體號 = STYLELIST.ProductName RIGHT OUTER JOIN " & 訂單資料表(7) & " ON 
64
-                               " & 訂單資料表(1) & ".資料流水號 = " & 訂單資料表(7) & ".資料流水號 
65
-                        WHERE ((" & 訂單資料表(1) & ".訂單流水號 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".年份季度 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".客戶訂單號 LIKE '%" & PA & "%') OR 
66
-                               (" & 訂單資料表(1) & ".形體號 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".顏色 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".楦型 LIKE '%" & PA & "%') OR 
67
-                               (" & 訂單資料表(1) & ".備註 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".備註 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".生產工廠 LIKE '%" & PA & "%') OR 
68
-                               (" & 訂單資料表(1) & ".訂單種類 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".力威訂單號 LIKE '%" & PA & "%')) 
69
-                               AND " & 訂單資料表(7) & ".天盾訂單號 IS NULL AND (" & 訂單資料表(1) & ".CXL IS NULL OR " & 訂單資料表(1) & ".CXL = 0) 
70
-                        ORDER BY " & 訂單資料表(1) & ".訂單流水號 DESC"
71
-    End Sub
72
-    Friend Sub SQL_利潤表載入1()
73
-        SQL1 = "SELECT " & 訂單資料表(1) & ".訂單流水號, " & 訂單資料表(1) & ".資料流水號, " & 訂單資料表(1) & ".年份季度, " & 訂單資料表(1) & ".力威訂單號, " & 訂單資料表(1) & ".形體號, 
74
-                               " & 訂單資料表(1) & ".顏色, " & 訂單資料表(1) & ".楦型, " & 訂單資料表(1) & ".訂單數量 AS 數量, " & 訂單資料表(1) & ".客戶交期, " & 訂單資料表(1) & ".單價, 
75
-                               " & 訂單資料表(1) & ".總金額, " & 訂單資料表(1) & ".備註, " & 訂單資料表(1) & ".生產工廠 AS 工廠, " & 訂單資料表(1) & ".訂單種類, " & 訂單資料表(7) & ".Quantity, 
76
-                               " & 訂單資料表(7) & ".Currency, " & 訂單資料表(7) & ".Exchange, " & 訂單資料表(7) & ".FTYPrice, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * 
77
-                               " & 訂單資料表(7) & ".Quantity AS CommissionTTL, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionDarren, 
78
-                              (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionTendenza, (" & 訂單資料表(1) & ".單價 - 
79
-                               " & 訂單資料表(7) & ".FTYPrice) AS Percentage, " & 訂單資料表(7) & ".BasicPrice, " & 訂單資料表(7) & ".Polybag AS [PG/MOQ], " & 訂單資料表(7) & ".FOOTformOrPETform AS FOOTorPET, 
80
-                               " & 訂單資料表(7) & ".Tooling, " & 訂單資料表(7) & ".RubberBand, " & 訂單資料表(7) & ".JHOOK, " & 訂單資料表(7) & ".WaterResistant, " & 訂單資料表(7) & ".P16VAT, 
81
-                               " & 訂單資料表(7) & ".EXWsaving, " & 訂單資料表(7) & ".Quantity * " & 訂單資料表(7) & ".Tooling AS CollectedToolng, " & 訂單資料表(7) & ".年份, 
82
-                               " & 訂單資料表(7) & ".利潤表流水號, " & 訂單資料表(1) & ".訂單數量 - " & 訂單資料表(7) & ".Quantity AS 驗證, STYLELIST.ItemNumber, " & 訂單資料表(7) & ".審核, 
83
-                               " & 訂單資料表(1) & ".客戶訂單號 
84
-                        FROM   " & 訂單資料表(1) & " LEFT OUTER JOIN STYLELIST ON " & 訂單資料表(1) & ".形體號 = STYLELIST.ProductName LEFT OUTER JOIN " & 訂單資料表(7) & " ON 
85
-                               " & 訂單資料表(1) & ".資料流水號 = " & 訂單資料表(7) & ".資料流水號 
86
-                        WHERE (" & 訂單資料表(1) & ".訂單流水號 LIKE '" & 訂單價格利潤明細表.天盾流水號_tb.Text & "') AND (" & 訂單資料表(1) & ".CXL IS NULL OR " & 訂單資料表(1) & ".CXL = 0) 
87
-                        ORDER BY " & 訂單資料表(1) & ".訂單流水號 DESC"
88
-    End Sub
89
-    Friend Sub SQL_利潤表載入2()
90
-        列印用SQL = "WHERE " & 訂單資料表(7) & ".年份 LIKE '" & 訂單價格利潤明細表.年份_cb.Text & "' AND (" & 訂單資料表(1) & ".CXL IS NULL OR " & 訂單資料表(1) & ".CXL = 0) "
91
-        SQL1 = "SELECT " & 訂單資料表(1) & ".訂單流水號, " & 訂單資料表(1) & ".資料流水號, " & 訂單資料表(1) & ".年份季度, " & 訂單資料表(1) & ".力威訂單號, " & 訂單資料表(1) & ".形體號, 
92
-                               " & 訂單資料表(1) & ".顏色, " & 訂單資料表(1) & ".楦型, " & 訂單資料表(1) & ".訂單數量 AS 數量, " & 訂單資料表(1) & ".客戶交期, " & 訂單資料表(1) & ".單價, 
93
-                               " & 訂單資料表(1) & ".總金額, " & 訂單資料表(1) & ".備註, " & 訂單資料表(1) & ".生產工廠 AS 工廠, " & 訂單資料表(1) & ".訂單種類, " & 訂單資料表(7) & ".Quantity, 
94
-                               " & 訂單資料表(7) & ".Currency, " & 訂單資料表(7) & ".Exchange, " & 訂單資料表(7) & ".FTYPrice, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * 
95
-                               " & 訂單資料表(7) & ".Quantity AS CommissionTTL, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionDarren, 
96
-                              (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionTendenza, (" & 訂單資料表(1) & ".單價 - 
97
-                               " & 訂單資料表(7) & ".FTYPrice) AS Percentage, " & 訂單資料表(7) & ".BasicPrice, " & 訂單資料表(7) & ".Polybag AS [PG/MOQ], " & 訂單資料表(7) & ".FOOTformOrPETform AS FOOTorPET, 
98
-                               " & 訂單資料表(7) & ".Tooling, " & 訂單資料表(7) & ".RubberBand, " & 訂單資料表(7) & ".JHOOK, " & 訂單資料表(7) & ".WaterResistant, " & 訂單資料表(7) & ".P16VAT, 
99
-                               " & 訂單資料表(7) & ".EXWsaving, " & 訂單資料表(7) & ".Quantity * " & 訂單資料表(7) & ".Tooling AS CollectedToolng, " & 訂單資料表(7) & ".年份, 
100
-                               " & 訂單資料表(7) & ".利潤表流水號, " & 訂單資料表(1) & ".訂單數量 - " & 訂單資料表(7) & ".Quantity AS 驗證, STYLELIST.ItemNumber, " & 訂單資料表(7) & ".審核, 
101
-                               " & 訂單資料表(1) & ".客戶訂單號 
102
-                        FROM   " & 訂單資料表(1) & " LEFT OUTER JOIN STYLELIST ON " & 訂單資料表(1) & ".形體號 = STYLELIST.ProductName RIGHT OUTER JOIN " & 訂單資料表(7) & " ON 
103
-                               " & 訂單資料表(1) & ".資料流水號 = " & 訂單資料表(7) & ".資料流水號 " & 列印用SQL & "
104
-                        ORDER BY " & 訂單資料表(1) & ".訂單流水號 DESC"
105
-    End Sub
106
-    Friend Sub SQL_利潤表載入3()
107
-        列印用SQL = " WHERE ((" & 訂單資料表(1) & ".訂單流水號 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".年份季度 LIKE '%" & PA & "%') OR 
108
-                                    (" & 訂單資料表(1) & ".客戶訂單號 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".形體號 LIKE '%" & PA & "%') OR 
109
-                                    (" & 訂單資料表(1) & ".顏色 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".楦型 LIKE '%" & PA & "%') OR 
110
-                                    (" & 訂單資料表(1) & ".備註 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".備註 LIKE '%" & PA & "%') OR 
111
-                                    (" & 訂單資料表(1) & ".生產工廠 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".訂單種類 LIKE '%" & PA & "%') OR 
112
-                                    (" & 訂單資料表(1) & ".力威訂單號 LIKE '%" & PA & "%')) AND " & 訂單資料表(7) & ".天盾訂單號 IS NOT NULL AND 
113
-                                    " & 訂單資料表(7) & ".年份 LIKE '" & 訂單價格利潤明細表.年份_cb.Text & "' AND (" & 訂單資料表(1) & ".CXL IS NULL OR " & 訂單資料表(1) & ".CXL = 0) "
114
-        SQL1 = "SELECT " & 訂單資料表(1) & ".訂單流水號, " & 訂單資料表(1) & ".資料流水號, " & 訂單資料表(1) & ".年份季度, " & 訂單資料表(1) & ".力威訂單號, " & 訂單資料表(1) & ".形體號, 
115
-                               " & 訂單資料表(1) & ".顏色, " & 訂單資料表(1) & ".楦型, " & 訂單資料表(1) & ".訂單數量 AS 數量, " & 訂單資料表(1) & ".客戶交期, " & 訂單資料表(1) & ".單價, 
116
-                               " & 訂單資料表(1) & ".總金額, " & 訂單資料表(1) & ".備註, " & 訂單資料表(1) & ".生產工廠 AS 工廠, " & 訂單資料表(1) & ".訂單種類, " & 訂單資料表(7) & ".Quantity, 
117
-                               " & 訂單資料表(7) & ".Currency, " & 訂單資料表(7) & ".Exchange, " & 訂單資料表(7) & ".FTYPrice, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * 
118
-                               " & 訂單資料表(7) & ".Quantity AS CommissionTTL, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionDarren, 
119
-                              (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionTendenza, (" & 訂單資料表(1) & ".單價 - 
120
-                               " & 訂單資料表(7) & ".FTYPrice) AS Percentage, " & 訂單資料表(7) & ".BasicPrice, " & 訂單資料表(7) & ".Polybag AS [PG/MOQ], " & 訂單資料表(7) & ".FOOTformOrPETform AS FOOTorPET, 
121
-                               " & 訂單資料表(7) & ".Tooling, " & 訂單資料表(7) & ".RubberBand, " & 訂單資料表(7) & ".JHOOK, " & 訂單資料表(7) & ".WaterResistant, " & 訂單資料表(7) & ".P16VAT, 
122
-                               " & 訂單資料表(7) & ".EXWsaving, " & 訂單資料表(7) & ".Quantity * " & 訂單資料表(7) & ".Tooling AS CollectedToolng, " & 訂單資料表(7) & ".年份, 
123
-                               " & 訂單資料表(7) & ".利潤表流水號, " & 訂單資料表(1) & ".訂單數量 - " & 訂單資料表(7) & ".Quantity AS 驗證, STYLELIST.ItemNumber, " & 訂單資料表(7) & ".審核, 
124
-                               " & 訂單資料表(1) & ".客戶訂單號 
125
-                        FROM   " & 訂單資料表(1) & " LEFT OUTER JOIN STYLELIST ON " & 訂單資料表(1) & ".形體號 = STYLELIST.ProductName RIGHT OUTER JOIN " & 訂單資料表(7) & " ON 
126
-                               " & 訂單資料表(1) & ".資料流水號 = " & 訂單資料表(7) & ".資料流水號 " & 列印用SQL & "
127
-                        ORDER BY " & 訂單資料表(1) & ".訂單流水號 DESC"
128
-    End Sub
129
-    Friend Sub SQL_利潤表載入4()
130
-        SQL1 = "SELECT " & 訂單資料表(1) & ".訂單流水號, " & 訂單資料表(1) & ".資料流水號, " & 訂單資料表(1) & ".年份季度, " & 訂單資料表(1) & ".力威訂單號, " & 訂單資料表(1) & ".形體號, 
131
-                               " & 訂單資料表(1) & ".顏色, " & 訂單資料表(1) & ".楦型, " & 訂單資料表(1) & ".訂單數量 AS 數量, " & 訂單資料表(1) & ".客戶交期, " & 訂單資料表(1) & ".單價, 
132
-                               " & 訂單資料表(1) & ".總金額, " & 訂單資料表(1) & ".備註, " & 訂單資料表(1) & ".生產工廠 AS 工廠, " & 訂單資料表(1) & ".訂單種類, " & 訂單資料表(7) & ".Quantity, 
133
-                               " & 訂單資料表(7) & ".Currency, " & 訂單資料表(7) & ".Exchange, " & 訂單資料表(7) & ".FTYPrice, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * 
134
-                               " & 訂單資料表(7) & ".Quantity AS CommissionTTL, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionDarren, 
135
-                              (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionTendenza, (" & 訂單資料表(1) & ".單價 - 
136
-                               " & 訂單資料表(7) & ".FTYPrice) AS Percentage, " & 訂單資料表(7) & ".BasicPrice, " & 訂單資料表(7) & ".Polybag AS [PG/MOQ], " & 訂單資料表(7) & ".FOOTformOrPETform AS FOOTorPET, 
137
-                               " & 訂單資料表(7) & ".Tooling, " & 訂單資料表(7) & ".RubberBand, " & 訂單資料表(7) & ".JHOOK, " & 訂單資料表(7) & ".WaterResistant, " & 訂單資料表(7) & ".P16VAT, 
138
-                               " & 訂單資料表(7) & ".EXWsaving, " & 訂單資料表(7) & ".Quantity * " & 訂單資料表(7) & ".Tooling AS CollectedToolng, " & 訂單資料表(7) & ".年份, 
139
-                               " & 訂單資料表(7) & ".利潤表流水號, " & 訂單資料表(1) & ".訂單數量 - " & 訂單資料表(7) & ".Quantity AS 驗證, STYLELIST.ItemNumber, " & 訂單資料表(7) & ".審核, 
140
-                               " & 訂單資料表(1) & ".客戶訂單號 
141
-                        FROM   " & 訂單資料表(1) & " LEFT OUTER JOIN STYLELIST ON " & 訂單資料表(1) & ".形體號 = STYLELIST.ProductName LEFT OUTER JOIN " & 訂單資料表(7) & " ON 
142
-                               " & 訂單資料表(1) & ".資料流水號 = " & 訂單資料表(7) & ".資料流水號 
143
-                        WHERE (" & 訂單資料表(1) & ".訂單流水號 LIKE '" & 訂單價格利潤明細表.天盾流水號_tb.Text & "') AND (" & 訂單資料表(1) & ".CXL IS NULL OR " & 訂單資料表(1) & ".CXL = 0) 
144
-                        ORDER BY " & 訂單資料表(1) & ".訂單流水號 DESC"
145
-    End Sub
146
-    Friend Sub SQL_利潤表暫存檔_刪除利潤表暫存檔()
147
-        ConnOpen()
148
-        SQL1 = "DELETE FROM 訂單價格利潤表暫存檔"
149
-        CmdSet_For_dr()
150
-    End Sub
151
-    Friend Sub SQL_利潤表暫存檔_訂單資料表_最後一筆資料()
152
-        ConnOpen()
153
-        SQL1 = "SELECT TOP (1) 利潤表流水號 FROM " & PA & " ORDER BY 利潤表流水號 DESC"
154
-        CmdSet_For_dr()
155
-    End Sub
156
-    Friend Sub SQL_利潤表暫存檔_訂單資料表_新增一筆流水號資料()
157
-        ConnOpen()
158
-        SQL1 = "INSERT INTO 訂單價格利潤表暫存檔 (資料流水號, 利潤表流水號, 訂單流水號) 
159
-               VALUES ('" & PA & "','" & PA1 & "', '" & PA2 & "')"
160
-        CmdSet_For_dr()
161
-    End Sub
162
-    Friend Sub SQL_訂單資料表_訂單流水號資料()
163
-        ConnOpen()
164
-        SQL1 = "SELECT " & PA1 & ".訂單流水號 
165
-                FROM   " & PA1 & " FULL OUTER JOIN " & PA2 & " ON " & PA1 & ".資料流水號 = " & PA2 & ".資料流水號 
166
-                WHERE (" & PA2 & ".天盾訂單號 IS NULL) AND 
167
-                      (LEFT(" & PA1 & ".客戶交期, 4) NOT LIKE '2009') AND (LEFT(" & PA1 & ".客戶交期, 4) NOT LIKE '2010') AND 
168
-                      (LEFT(" & PA1 & ".客戶交期, 4) NOT LIKE '2011') AND (LEFT(" & PA1 & ".客戶交期, 4) NOT LIKE '2012') AND 
169
-                      (LEFT(" & PA1 & ".客戶交期, 4) NOT LIKE '2013') AND (LEFT(" & PA1 & ".客戶交期, 4) NOT LIKE '2014') AND 
170
-                      (LEFT(" & PA1 & ".客戶交期, 4) NOT LIKE '2015') AND (LEFT(" & PA1 & ".客戶交期, 4) NOT LIKE '2016') AND 
171
-                      (LEFT(" & PA1 & ".客戶交期, 4) NOT LIKE '2017') AND (" & PA1 & ".CXL IS NULL OR " & PA1 & ".CXL = 0) 
172
-                GROUP BY   " & PA1 & ".訂單流水號 ORDER BY   " & PA1 & ".訂單流水號 DESC"
173
-        CmdSet_For_DGV()
174
-    End Sub
175
-    Friend Sub SQL_訂單資料表_新增一筆客戶資料()
176
-        ConnOpen()
177
-        SQL1 = "INSERT INTO " & PA & " (資料流水號, 天盾訂單號, 客戶流水號, FTYPrice, BasicPrice, Polybag, FOOTformOrPETform, Tooling, RubberBand, JHOOK, WaterResistant, P16VAT, 
178
-                                                       EXWsaving, Currency, Exchange, 年份, Quantity, 利潤表流水號, 審核) 
179
-                VALUES ('" & 訂單價格利潤明細表.TextBox16.Text & "', '" & 訂單價格利潤明細表.天盾流水號_tb.Text & "', '" & 訂單價格利潤明細表.客戶訂單號_tb.Text & "', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '" & 訂單價格利潤明細表.Currency_cb.Text & "', '0', 
180
-                        '" & 訂單價格利潤明細表.年份_cb.Text & "', '0', '" & PA1 & "', '0')"
181
-        CmdSet_For_dr()
182
-    End Sub
183
-    Friend Sub SQL_利潤表暫存檔_刪除利潤表流水號()
184
-        ConnOpen()
185
-        SQL1 = "DELETE FROM 訂單價格利潤表暫存檔 WHERE 利潤表流水號 LIKE '" & 訂單價格利潤明細表.TextBox17.Text & "'"
186
-        CmdSet_For_dr()
187
-    End Sub
188
-    Friend Sub SQL_利潤表暫存檔_刪除利潤表流水號1()
189
-        ConnOpen()
190
-        SQL1 = "DELETE FROM " & PA & " WHERE 利潤表流水號 LIKE '" & 訂單價格利潤明細表.TextBox17.Text & "'"
191
-        CmdSet_For_dr()
192
-    End Sub
193
-    Friend Sub SQL_訂單資料表_查詢資料流水號()
194
-        ConnOpen()
195
-        SQL1 = "SELECT 利潤表流水號 FROM " & PA & " WHERE (資料流水號 LIKE '" & PA1 & "')"
196
-        CmdSet_For_dr()
197
-    End Sub
198
-    Friend Sub SQL_訂單控制表修改紀錄_查詢最後一筆流水號()
199
-        ConnOpen()
200
-        SQL1 = "SELECT TOP (1) 編輯次數 FROM 訂單控制表修改紀錄 WHERE (流水號 LIKE '" & PA1 & "') ORDER BY 編輯次數 DESC"
201
-        CmdSet_For_dr()
202
-    End Sub
203
-    Friend Sub SQL_訂單控制表修改紀錄_新增一筆流水號()
204
-        ConnOpen()
205
-        SQL1 = "INSERT INTO 訂單控制表修改紀錄 (流水號, 編輯者, 編輯時間, 編輯次數) 
206
-                            VALUES ('" & PA2 & "','" & gUserName & "','" & Format(Today, "yyyy/MM/dd") & "','" & PA3 & "')"
207
-        CmdSet_For_dr()
208
-    End Sub
209
-    Friend Sub SQL_訂單控制表修改紀錄_修改訂單資料表()
210
-        ConnOpen()
211
-        SQL1 = "UPDATE " & PA4 & " SET  單價 = '" & PA5 & "', 總金額 = '" & PA6 & "' 
212
-                WHERE (資料流水號 LIKE '" & PA7 & "')"
213
-        CmdSet_For_dr()
214
-    End Sub
215
-    Friend Sub SQL_訂單資料表_新增訂單資料表資料()
216
-        ConnOpen()
217
-        SQL1 = "INSERT INTO " & PA8 & " (資料流水號, 天盾訂單號, 客戶流水號, FTYPrice, BasicPrice, Polybag, FOOTformOrPETform, Tooling, RubberBand, JHOOK, WaterResistant, 
218
-                                                               P16VAT, EXWsaving, Currency, Exchange, 年份, Quantity, 利潤表流水號, 審核) 
219
-                VALUES ('" & PA9 & "', '" & PA10 & "', '" & PA11 & "', '" & PA12 & "', '" & PA13 & "', '" & PA14 & "', 
220
-                        '" & PA15 & "', '" & PA16 & "', '" & PA17 & "', '" & PA18 & "', '" & PA19 & "', '" & PA20 & "', 
221
-                        '" & PA21 & "', '" & 訂單價格利潤明細表.Currency_cb.Text & "', '" & PA22 & "', '" & PA23 & "', 
222
-                        '" & PA24 & "', '" & PA25 & "', '" & PA26 & "')"
223
-        CmdSet_For_dr()
224
-    End Sub
225
-    Friend Sub SQL_訂單資料表_更新訂單資料表資料()
226
-        ConnOpen()
227
-        SQL1 = "UPDATE " & PA8 & " SET  FTYPrice = '" & PA9 & "', BasicPrice = '" & PA10 & "', Polybag = '" & PA11 & "', FOOTformOrPETform = '" & PA12 & "', 
228
-                                                Tooling = '" & PA13 & "', RubberBand = '" & PA14 & "', JHOOK = '" & PA15 & "', WaterResistant = '" & PA16 & "', 
229
-                                                P16VAT = '" & PA17 & "', EXWsaving = '" & PA18 & "', Currency = '" & 訂單價格利潤明細表.Currency_cb.Text & "', Exchange = '" & PA19 & "',  
230
-                                                年份 = '" & PA20 & "', Quantity = '" & PA21 & "', 審核 = '" & PA22 & "' 
231
-                WHERE (利潤表流水號 LIKE '" & PA23 & "')"
232
-        CmdSet_For_dr()
233
-    End Sub
234
-    Friend Sub SQL_訂單資料表_更新金額()
235
-        ConnOpen()
236
-        SQL1 = "UPDATE " & PA1 & " SET  單價 = '0.00', 總金額 = '0.00' WHERE (訂單流水號 LIKE '" & 訂單價格利潤明細表.天盾流水號_tb.Text & "')"
237
-        CmdSet_For_dr()
238
-    End Sub
239
-    Friend Sub SQL_訂單資料表_刪除訂單資料()
240
-        ConnOpen()
241
-        SQL1 = "DELETE FROM " & PA2 & " WHERE (天盾訂單號 = '" & 訂單價格利潤明細表.天盾流水號_tb.Text & "')"
242
-        CmdSet_For_dr()
243
-    End Sub
244
-    Friend Sub SQL_利潤表暫存檔_利潤表流水號_最後一筆資料()
245
-        ConnOpen()
246
-        SQL1 = "SELECT TOP (1) 利潤表流水號 FROM 訂單價格利潤表暫存檔 ORDER BY 利潤表流水號 DESC"
247
-        CmdSet_For_dr()
248
-    End Sub
249
-    Friend Sub SQL_新增訂單價格利潤表暫存檔()
250
-        ConnOpen()
251
-        SQL1 = "INSERT INTO 訂單價格利潤表暫存檔 (資料流水號, 利潤表流水號, 訂單流水號) VALUES ('" & 訂單價格利潤明細表.TextBox16.Text & "','" & PA & "', '" & 訂單價格利潤明細表.天盾流水號_tb.Text & "')"
252
-        CmdSet_For_dr() : conn.Close()
253
-    End Sub
254
-
255
-
256 56
 End Module

+ 1
- 1
TENDEN-MES-SYS/Module/全域變數.vb Bestand weergeven

@@ -4,7 +4,7 @@
4 4
     Public Target As String : Public Target1 As String : Public Target2 As String : Public FTP帳號 As String : Public FTP密碼 As String : Public 登入人IP As String
5 5
     Public CC(99) As Boolean : Public AA(99) As String : Public 登入判斷 As Boolean
6 6
     '----系統版本-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
7
-    Public 版本 As String = "2021121401"
7
+    Public 版本 As String = "2022011401"
8 8
     '----系統用全域變數-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
9 9
     Public 匯率 As Double
10 10
 

BIN
TENDEN-MES-SYS/bin/Debug/TENDEN-ERP-SYS.exe Bestand weergeven


BIN
TENDEN-MES-SYS/bin/Debug/TENDEN-ERP-SYS.pdb Bestand weergeven


BIN
TENDEN-MES-SYS/obj/Debug/TENDEN-ERP-SYS.exe Bestand weergeven


BIN
TENDEN-MES-SYS/obj/Debug/TENDEN-ERP-SYS.pdb Bestand weergeven


BIN
TENDEN-MES-SYS/obj/Debug/天盾系統.vbproj.GenerateResource.cache Bestand weergeven


BIN
TENDEN-MES-SYS/obj/Debug/天盾系統.vbprojAssemblyReference.cache Bestand weergeven


+ 59
- 22
TENDEN-MES-SYS/成本系統管理/成本資料庫管理.Designer.vb Bestand weergeven

@@ -40,6 +40,9 @@ Partial Class 成本資料庫管理
40 40
         Me.資料流水號_dgv = New System.Windows.Forms.DataGridView()
41 41
         Me.資料流水號_tb = New System.Windows.Forms.TextBox()
42 42
         Me.刪除_bt = New System.Windows.Forms.Button()
43
+        Me.資料庫選擇2_bt = New System.Windows.Forms.Button()
44
+        Me.資料庫選擇1_bt = New System.Windows.Forms.Button()
45
+        Me.Label20 = New System.Windows.Forms.Label()
43 46
         CType(Me.訂單清單_dgv, System.ComponentModel.ISupportInitialize).BeginInit()
44 47
         CType(Me.利潤表流水_dgv, System.ComponentModel.ISupportInitialize).BeginInit()
45 48
         CType(Me.天盾訂單號_dgv, System.ComponentModel.ISupportInitialize).BeginInit()
@@ -52,7 +55,7 @@ Partial Class 成本資料庫管理
52 55
         '
53 56
         Me.Label16.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
54 57
         Me.Label16.AutoSize = True
55
-        Me.Label16.Location = New System.Drawing.Point(1173, 8)
58
+        Me.Label16.Location = New System.Drawing.Point(1173, 29)
56 59
         Me.Label16.Name = "Label16"
57 60
         Me.Label16.Size = New System.Drawing.Size(32, 16)
58 61
         Me.Label16.TabIndex = 479
@@ -64,15 +67,13 @@ Partial Class 成本資料庫管理
64 67
         Me.年份_cb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
65 68
         Me.年份_cb.FormattingEnabled = True
66 69
         Me.年份_cb.Items.AddRange(New Object() {"2023", "2022", "2021", "2020", "2019", "2018"})
67
-        Me.年份_cb.Location = New System.Drawing.Point(1211, 5)
70
+        Me.年份_cb.Location = New System.Drawing.Point(1211, 26)
68 71
         Me.年份_cb.Name = "年份_cb"
69 72
         Me.年份_cb.Size = New System.Drawing.Size(134, 24)
70 73
         Me.年份_cb.TabIndex = 478
71 74
         '
72 75
         '訂單清單_dgv
73 76
         '
74
-        Me.訂單清單_dgv.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
75
-            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
76 77
         Me.訂單清單_dgv.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill
77 78
         DataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control
78 79
         DataGridViewCellStyle1.Font = New System.Drawing.Font("微軟正黑體", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
@@ -82,16 +83,17 @@ Partial Class 成本資料庫管理
82 83
         DataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
83 84
         Me.訂單清單_dgv.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle1
84 85
         Me.訂單清單_dgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
85
-        Me.訂單清單_dgv.Location = New System.Drawing.Point(5, 5)
86
+        Me.訂單清單_dgv.Location = New System.Drawing.Point(5, 3)
86 87
         Me.訂單清單_dgv.Name = "訂單清單_dgv"
87 88
         Me.訂單清單_dgv.RowHeadersWidth = 5
88 89
         Me.訂單清單_dgv.RowTemplate.Height = 24
89
-        Me.訂單清單_dgv.Size = New System.Drawing.Size(548, 377)
90
+        Me.訂單清單_dgv.Size = New System.Drawing.Size(548, 386)
90 91
         Me.訂單清單_dgv.TabIndex = 480
91 92
         '
92 93
         '利潤表流水_dgv
93 94
         '
94
-        Me.利潤表流水_dgv.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
95
+        Me.利潤表流水_dgv.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
96
+            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
95 97
         Me.利潤表流水_dgv.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill
96 98
         DataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control
97 99
         DataGridViewCellStyle2.Font = New System.Drawing.Font("微軟正黑體", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
@@ -101,24 +103,25 @@ Partial Class 成本資料庫管理
101 103
         DataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
102 104
         Me.利潤表流水_dgv.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle2
103 105
         Me.利潤表流水_dgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
104
-        Me.利潤表流水_dgv.Location = New System.Drawing.Point(559, 5)
106
+        Me.利潤表流水_dgv.Location = New System.Drawing.Point(559, 3)
105 107
         Me.利潤表流水_dgv.Name = "利潤表流水_dgv"
106 108
         Me.利潤表流水_dgv.RowHeadersWidth = 5
107 109
         Me.利潤表流水_dgv.RowTemplate.Height = 24
108
-        Me.利潤表流水_dgv.Size = New System.Drawing.Size(526, 50)
110
+        Me.利潤表流水_dgv.Size = New System.Drawing.Size(526, 60)
109 111
         Me.利潤表流水_dgv.TabIndex = 481
110 112
         '
111 113
         '利潤表流水號_tb
112 114
         '
113 115
         Me.利潤表流水號_tb.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
114
-        Me.利潤表流水號_tb.Location = New System.Drawing.Point(1171, 35)
116
+        Me.利潤表流水號_tb.Location = New System.Drawing.Point(1171, 51)
115 117
         Me.利潤表流水號_tb.Name = "利潤表流水號_tb"
116 118
         Me.利潤表流水號_tb.Size = New System.Drawing.Size(174, 23)
117 119
         Me.利潤表流水號_tb.TabIndex = 482
118 120
         '
119 121
         '天盾訂單號_dgv
120 122
         '
121
-        Me.天盾訂單號_dgv.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
123
+        Me.天盾訂單號_dgv.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
124
+            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
122 125
         Me.天盾訂單號_dgv.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill
123 126
         DataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control
124 127
         DataGridViewCellStyle3.Font = New System.Drawing.Font("微軟正黑體", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
@@ -128,7 +131,7 @@ Partial Class 成本資料庫管理
128 131
         DataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
129 132
         Me.天盾訂單號_dgv.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle3
130 133
         Me.天盾訂單號_dgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
131
-        Me.天盾訂單號_dgv.Location = New System.Drawing.Point(559, 117)
134
+        Me.天盾訂單號_dgv.Location = New System.Drawing.Point(559, 124)
132 135
         Me.天盾訂單號_dgv.Name = "天盾訂單號_dgv"
133 136
         Me.天盾訂單號_dgv.RowHeadersWidth = 5
134 137
         Me.天盾訂單號_dgv.RowTemplate.Height = 24
@@ -148,11 +151,11 @@ Partial Class 成本資料庫管理
148 151
         DataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
149 152
         Me.訂單流水號_dgv.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle4
150 153
         Me.訂單流水號_dgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
151
-        Me.訂單流水號_dgv.Location = New System.Drawing.Point(5, 388)
154
+        Me.訂單流水號_dgv.Location = New System.Drawing.Point(5, 391)
152 155
         Me.訂單流水號_dgv.Name = "訂單流水號_dgv"
153 156
         Me.訂單流水號_dgv.RowHeadersWidth = 5
154 157
         Me.訂單流水號_dgv.RowTemplate.Height = 24
155
-        Me.訂單流水號_dgv.Size = New System.Drawing.Size(548, 307)
158
+        Me.訂單流水號_dgv.Size = New System.Drawing.Size(548, 304)
156 159
         Me.訂單流水號_dgv.TabIndex = 484
157 160
         '
158 161
         '天盾流水號_dgv
@@ -169,7 +172,7 @@ Partial Class 成本資料庫管理
169 172
         DataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
170 173
         Me.天盾流水號_dgv.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle5
171 174
         Me.天盾流水號_dgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
172
-        Me.天盾流水號_dgv.Location = New System.Drawing.Point(559, 388)
175
+        Me.天盾流水號_dgv.Location = New System.Drawing.Point(559, 391)
173 176
         Me.天盾流水號_dgv.Name = "天盾流水號_dgv"
174 177
         Me.天盾流水號_dgv.RowHeadersWidth = 5
175 178
         Me.天盾流水號_dgv.RowTemplate.Height = 24
@@ -179,14 +182,15 @@ Partial Class 成本資料庫管理
179 182
         '天盾訂單號_tb
180 183
         '
181 184
         Me.天盾訂單號_tb.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
182
-        Me.天盾訂單號_tb.Location = New System.Drawing.Point(1171, 89)
185
+        Me.天盾訂單號_tb.Location = New System.Drawing.Point(1171, 99)
183 186
         Me.天盾訂單號_tb.Name = "天盾訂單號_tb"
184 187
         Me.天盾訂單號_tb.Size = New System.Drawing.Size(174, 23)
185 188
         Me.天盾訂單號_tb.TabIndex = 486
186 189
         '
187 190
         '資料流水號_dgv
188 191
         '
189
-        Me.資料流水號_dgv.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
192
+        Me.資料流水號_dgv.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
193
+            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
190 194
         Me.資料流水號_dgv.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill
191 195
         DataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control
192 196
         DataGridViewCellStyle6.Font = New System.Drawing.Font("微軟正黑體", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
@@ -196,17 +200,17 @@ Partial Class 成本資料庫管理
196 200
         DataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
197 201
         Me.資料流水號_dgv.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle6
198 202
         Me.資料流水號_dgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
199
-        Me.資料流水號_dgv.Location = New System.Drawing.Point(559, 61)
203
+        Me.資料流水號_dgv.Location = New System.Drawing.Point(559, 66)
200 204
         Me.資料流水號_dgv.Name = "資料流水號_dgv"
201 205
         Me.資料流水號_dgv.RowHeadersWidth = 5
202 206
         Me.資料流水號_dgv.RowTemplate.Height = 24
203
-        Me.資料流水號_dgv.Size = New System.Drawing.Size(606, 50)
207
+        Me.資料流水號_dgv.Size = New System.Drawing.Size(606, 55)
204 208
         Me.資料流水號_dgv.TabIndex = 487
205 209
         '
206 210
         '資料流水號_tb
207 211
         '
208 212
         Me.資料流水號_tb.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
209
-        Me.資料流水號_tb.Location = New System.Drawing.Point(1171, 62)
213
+        Me.資料流水號_tb.Location = New System.Drawing.Point(1171, 75)
210 214
         Me.資料流水號_tb.Name = "資料流水號_tb"
211 215
         Me.資料流水號_tb.Size = New System.Drawing.Size(174, 23)
212 216
         Me.資料流水號_tb.TabIndex = 488
@@ -215,18 +219,48 @@ Partial Class 成本資料庫管理
215 219
         '
216 220
         Me.刪除_bt.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
217 221
         Me.刪除_bt.ForeColor = System.Drawing.Color.Green
218
-        Me.刪除_bt.Location = New System.Drawing.Point(1091, 5)
222
+        Me.刪除_bt.Location = New System.Drawing.Point(1091, 26)
219 223
         Me.刪除_bt.Name = "刪除_bt"
220
-        Me.刪除_bt.Size = New System.Drawing.Size(74, 50)
224
+        Me.刪除_bt.Size = New System.Drawing.Size(74, 35)
221 225
         Me.刪除_bt.TabIndex = 489
222 226
         Me.刪除_bt.Text = "刪除"
223 227
         Me.刪除_bt.UseVisualStyleBackColor = True
224 228
         '
229
+        '資料庫選擇2_bt
230
+        '
231
+        Me.資料庫選擇2_bt.Location = New System.Drawing.Point(1270, 1)
232
+        Me.資料庫選擇2_bt.Name = "資料庫選擇2_bt"
233
+        Me.資料庫選擇2_bt.Size = New System.Drawing.Size(75, 24)
234
+        Me.資料庫選擇2_bt.TabIndex = 565
235
+        Me.資料庫選擇2_bt.Text = "DRS/ LIF"
236
+        Me.資料庫選擇2_bt.UseVisualStyleBackColor = True
237
+        '
238
+        '資料庫選擇1_bt
239
+        '
240
+        Me.資料庫選擇1_bt.Location = New System.Drawing.Point(1192, 1)
241
+        Me.資料庫選擇1_bt.Name = "資料庫選擇1_bt"
242
+        Me.資料庫選擇1_bt.Size = New System.Drawing.Size(75, 24)
243
+        Me.資料庫選擇1_bt.TabIndex = 564
244
+        Me.資料庫選擇1_bt.Text = "VIONIC"
245
+        Me.資料庫選擇1_bt.UseVisualStyleBackColor = True
246
+        '
247
+        'Label20
248
+        '
249
+        Me.Label20.AutoSize = True
250
+        Me.Label20.Location = New System.Drawing.Point(1100, 5)
251
+        Me.Label20.Name = "Label20"
252
+        Me.Label20.Size = New System.Drawing.Size(80, 16)
253
+        Me.Label20.TabIndex = 563
254
+        Me.Label20.Text = "選擇訂單品牌"
255
+        '
225 256
         '成本資料庫管理
226 257
         '
227 258
         Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 16.0!)
228 259
         Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
229 260
         Me.ClientSize = New System.Drawing.Size(1350, 701)
261
+        Me.Controls.Add(Me.資料庫選擇2_bt)
262
+        Me.Controls.Add(Me.資料庫選擇1_bt)
263
+        Me.Controls.Add(Me.Label20)
230 264
         Me.Controls.Add(Me.刪除_bt)
231 265
         Me.Controls.Add(Me.資料流水號_tb)
232 266
         Me.Controls.Add(Me.資料流水號_dgv)
@@ -266,5 +300,8 @@ Partial Class 成本資料庫管理
266 300
     Friend WithEvents 資料流水號_dgv As DataGridView
267 301
     Friend WithEvents 資料流水號_tb As TextBox
268 302
     Friend WithEvents 刪除_bt As Button
303
+    Friend WithEvents 資料庫選擇2_bt As Button
304
+    Friend WithEvents 資料庫選擇1_bt As Button
305
+    Friend WithEvents Label20 As Label
269 306
 End Class
270 307
 

+ 7
- 2
TENDEN-MES-SYS/成本系統管理/成本資料庫管理.vb Bestand weergeven

@@ -89,8 +89,7 @@ Public Class 成本資料庫管理
89 89
     End Sub
90 90
     Private Sub 成本資料庫管理_Load(sender As Object, e As EventArgs) Handles MyBase.Load
91 91
         Me.MdiParent = TENDEN_MES_SYS : Me.WindowState = 2 : Me.AutoScroll = True
92
-        年份_cb.Text = Year(Today)
93
-        Set_訂單清單() : Set_grid()
92
+        訂單資料庫選擇.ShowDialog() : 年份_cb.Text = Year(Today) : Set_訂單清單() : Set_grid()
94 93
     End Sub
95 94
     Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 年份_cb.SelectedIndexChanged
96 95
         Set_訂單清單() : Set_grid()
@@ -132,4 +131,10 @@ Public Class 成本資料庫管理
132 131
         End If
133 132
         MsgBox("刪除完成")
134 133
     End Sub
134
+    Private Sub 資料庫選擇1_bt_Click(sender As Object, e As EventArgs) Handles 資料庫選擇1_bt.Click
135
+        SQL_訂單資料表選擇_VIONIC() : Set_訂單清單() : Set_grid()
136
+    End Sub
137
+    Private Sub 資料庫選擇2_bt_Click(sender As Object, e As EventArgs) Handles 資料庫選擇2_bt.Click
138
+        SQL_訂單資料表選擇_非VIONIC() : Set_訂單清單() : Set_grid()
139
+    End Sub
135 140
 End Class

+ 192
- 81
TENDEN-MES-SYS/成本系統管理/訂單價格利潤明細表.vb Bestand weergeven

@@ -2,52 +2,134 @@
2 2
 Public Class 訂單價格利潤明細表
3 3
     ReadOnly ds As New DataSet : ReadOnly ds1 As New DataSet
4 4
     ReadOnly BB(3) As Boolean : Dim WW As String : Public 平均數 As Integer : Public 最終數 As Integer = 0 : Public 資料數 As Integer = 0
5
-    Private Sub Set_DGV1載入前設定()
5
+    Private Sub 利潤表載入前設定()
6 6
         利潤表_dgv.DataSource = Nothing : ds.Clear()
7 7
         利潤表_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
8 8
         利潤表_dgv.ColumnHeadersHeight = 25
9 9
         利潤表_dgv.AllowUserToAddRows = False
10 10
         ConnOpen()
11 11
     End Sub
12
-    Private Sub Set_DGV1載入後設定()
12
+    Private Sub 利潤表載入後設定()
13 13
         CmdSet_For_DGV() : da.SelectCommand.CommandTimeout = 900 : da.Fill(ds) : 利潤表_dgv.DataSource = ds.Tables(0) : conn.Close()
14 14
     End Sub
15 15
     Private Sub Set_訂單清單()
16
-        Set_DGV1載入前設定()
16
+        利潤表載入前設定()
17 17
         If 未建檔_cb.Checked = True Then
18 18
             Timer1.Enabled = True : 存檔_bt.Enabled = True : 刪除_bt.Enabled = False : 修改_bt.Enabled = False
19 19
             等於訂單數_bt.Enabled = True : 等於零_bt.Enabled = True : 匯率為1_bt.Enabled = True
20
-            'PA1 = 訂單資料表(1) : PA2 = 訂單資料表(7)
21 20
             If 天盾流水號_tb.Text = "" Then
22
-                SQL_利潤表載入()
21
+                SQL1 = "SELECT " & 訂單資料表(1) & ".訂單流水號, " & 訂單資料表(1) & ".資料流水號, " & 訂單資料表(1) & ".年份季度, " & 訂單資料表(1) & ".力威訂單號, " & 訂單資料表(1) & ".形體號, 
22
+                               " & 訂單資料表(1) & ".顏色, " & 訂單資料表(1) & ".楦型, " & 訂單資料表(1) & ".訂單數量 AS 數量, " & 訂單資料表(1) & ".客戶交期, " & 訂單資料表(1) & ".單價, 
23
+                               " & 訂單資料表(1) & ".總金額, " & 訂單資料表(1) & ".備註, " & 訂單資料表(1) & ".生產工廠 AS 工廠, " & 訂單資料表(1) & ".訂單種類, " & 訂單資料表(7) & ".Quantity, 
24
+                               " & 訂單資料表(7) & ".Currency, " & 訂單資料表(7) & ".Exchange, " & 訂單資料表(7) & ".FTYPrice, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * 
25
+                               " & 訂單資料表(7) & ".Quantity AS CommissionTTL, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionDarren, 
26
+                              (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionTendenza, (" & 訂單資料表(1) & ".單價 - 
27
+                               " & 訂單資料表(7) & ".FTYPrice) AS Percentage, " & 訂單資料表(7) & ".BasicPrice, " & 訂單資料表(7) & ".Polybag AS [PG/MOQ], " & 訂單資料表(7) & ".FOOTformOrPETform AS FOOTorPET, 
28
+                               " & 訂單資料表(7) & ".Tooling, " & 訂單資料表(7) & ".RubberBand, " & 訂單資料表(7) & ".JHOOK, " & 訂單資料表(7) & ".WaterResistant, " & 訂單資料表(7) & ".P16VAT, 
29
+                               " & 訂單資料表(7) & ".EXWsaving, " & 訂單資料表(7) & ".Quantity * " & 訂單資料表(7) & ".Tooling AS CollectedToolng, " & 訂單資料表(7) & ".年份, 
30
+                               " & 訂單資料表(7) & ".利潤表流水號, " & 訂單資料表(1) & ".訂單數量 - " & 訂單資料表(7) & ".Quantity AS 驗證, STYLELIST.ItemNumber, " & 訂單資料表(7) & ".審核, 
31
+                               " & 訂單資料表(1) & ".客戶訂單號 
32
+                        FROM   " & 訂單資料表(1) & " LEFT OUTER JOIN STYLELIST ON " & 訂單資料表(1) & ".形體號 = STYLELIST.ProductName RIGHT OUTER JOIN " & 訂單資料表(7) & " ON 
33
+                               " & 訂單資料表(1) & ".資料流水號 = " & 訂單資料表(7) & ".資料流水號 
34
+                        WHERE ((" & 訂單資料表(1) & ".訂單流水號 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".年份季度 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".客戶訂單號 LIKE '%" & PA & "%') OR 
35
+                               (" & 訂單資料表(1) & ".形體號 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".顏色 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".楦型 LIKE '%" & PA & "%') OR 
36
+                               (" & 訂單資料表(1) & ".備註 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".備註 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".生產工廠 LIKE '%" & PA & "%') OR 
37
+                               (" & 訂單資料表(1) & ".訂單種類 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".力威訂單號 LIKE '%" & PA & "%')) 
38
+                               AND " & 訂單資料表(7) & ".天盾訂單號 IS NULL AND (" & 訂單資料表(1) & ".CXL IS NULL OR " & 訂單資料表(1) & ".CXL = 0) 
39
+                        ORDER BY " & 訂單資料表(1) & ".訂單流水號 DESC"
23 40
             Else
24
-                SQL_利潤表載入1()
41
+                SQL1 = "SELECT " & 訂單資料表(1) & ".訂單流水號, " & 訂單資料表(1) & ".資料流水號, " & 訂單資料表(1) & ".年份季度, " & 訂單資料表(1) & ".力威訂單號, " & 訂單資料表(1) & ".形體號, 
42
+                               " & 訂單資料表(1) & ".顏色, " & 訂單資料表(1) & ".楦型, " & 訂單資料表(1) & ".訂單數量 AS 數量, " & 訂單資料表(1) & ".客戶交期, " & 訂單資料表(1) & ".單價, 
43
+                               " & 訂單資料表(1) & ".總金額, " & 訂單資料表(1) & ".備註, " & 訂單資料表(1) & ".生產工廠 AS 工廠, " & 訂單資料表(1) & ".訂單種類, " & 訂單資料表(7) & ".Quantity, 
44
+                               " & 訂單資料表(7) & ".Currency, " & 訂單資料表(7) & ".Exchange, " & 訂單資料表(7) & ".FTYPrice, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * 
45
+                               " & 訂單資料表(7) & ".Quantity AS CommissionTTL, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionDarren, 
46
+                              (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionTendenza, (" & 訂單資料表(1) & ".單價 - 
47
+                               " & 訂單資料表(7) & ".FTYPrice) AS Percentage, " & 訂單資料表(7) & ".BasicPrice, " & 訂單資料表(7) & ".Polybag AS [PG/MOQ], " & 訂單資料表(7) & ".FOOTformOrPETform AS FOOTorPET, 
48
+                               " & 訂單資料表(7) & ".Tooling, " & 訂單資料表(7) & ".RubberBand, " & 訂單資料表(7) & ".JHOOK, " & 訂單資料表(7) & ".WaterResistant, " & 訂單資料表(7) & ".P16VAT, 
49
+                               " & 訂單資料表(7) & ".EXWsaving, " & 訂單資料表(7) & ".Quantity * " & 訂單資料表(7) & ".Tooling AS CollectedToolng, " & 訂單資料表(7) & ".年份, 
50
+                               " & 訂單資料表(7) & ".利潤表流水號, " & 訂單資料表(1) & ".訂單數量 - " & 訂單資料表(7) & ".Quantity AS 驗證, STYLELIST.ItemNumber, " & 訂單資料表(7) & ".審核, 
51
+                               " & 訂單資料表(1) & ".客戶訂單號 
52
+                        FROM   " & 訂單資料表(1) & " LEFT OUTER JOIN STYLELIST ON " & 訂單資料表(1) & ".形體號 = STYLELIST.ProductName LEFT OUTER JOIN " & 訂單資料表(7) & " ON 
53
+                               " & 訂單資料表(1) & ".資料流水號 = " & 訂單資料表(7) & ".資料流水號 
54
+                        WHERE (" & 訂單資料表(1) & ".訂單流水號 LIKE '" & 天盾流水號_tb.Text & "') AND (" & 訂單資料表(1) & ".CXL IS NULL OR " & 訂單資料表(1) & ".CXL = 0) 
55
+                        ORDER BY " & 訂單資料表(1) & ".訂單流水號 DESC"
25 56
             End If
26
-            Set_DGV1載入後設定() : Set_grid() : Set_自動彙總1()
57
+            利潤表載入後設定() : Set_grid() : Set_自動彙總1()
27 58
             Set_暫存資料設定() : Set_編輯清單() : Set_grid() : Set_自動彙總1()
28 59
         ElseIf 未建檔_cb.Checked = False Then
29 60
             Timer1.Enabled = False : Label47.Visible = False : 存檔_bt.Enabled = False : 刪除_bt.Enabled = True : 修改_bt.Enabled = True
30 61
             等於訂單數_bt.Enabled = False : 等於零_bt.Enabled = False : 匯率為1_bt.Enabled = False
31 62
             If PA = "" Then
32
-                SQL_利潤表載入2()
63
+                列印用SQL = "WHERE " & 訂單資料表(7) & ".年份 LIKE '" & 年份_cb.Text & "' AND (" & 訂單資料表(1) & ".CXL IS NULL OR " & 訂單資料表(1) & ".CXL = 0) "
64
+                SQL1 = "SELECT " & 訂單資料表(1) & ".訂單流水號, " & 訂單資料表(1) & ".資料流水號, " & 訂單資料表(1) & ".年份季度, " & 訂單資料表(1) & ".力威訂單號, " & 訂單資料表(1) & ".形體號, 
65
+                               " & 訂單資料表(1) & ".顏色, " & 訂單資料表(1) & ".楦型, " & 訂單資料表(1) & ".訂單數量 AS 數量, " & 訂單資料表(1) & ".客戶交期, " & 訂單資料表(1) & ".單價, 
66
+                               " & 訂單資料表(1) & ".總金額, " & 訂單資料表(1) & ".備註, " & 訂單資料表(1) & ".生產工廠 AS 工廠, " & 訂單資料表(1) & ".訂單種類, " & 訂單資料表(7) & ".Quantity, 
67
+                               " & 訂單資料表(7) & ".Currency, " & 訂單資料表(7) & ".Exchange, " & 訂單資料表(7) & ".FTYPrice, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * 
68
+                               " & 訂單資料表(7) & ".Quantity AS CommissionTTL, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionDarren, 
69
+                              (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionTendenza, (" & 訂單資料表(1) & ".單價 - 
70
+                               " & 訂單資料表(7) & ".FTYPrice) AS Percentage, " & 訂單資料表(7) & ".BasicPrice, " & 訂單資料表(7) & ".Polybag AS [PG/MOQ], " & 訂單資料表(7) & ".FOOTformOrPETform AS FOOTorPET, 
71
+                               " & 訂單資料表(7) & ".Tooling, " & 訂單資料表(7) & ".RubberBand, " & 訂單資料表(7) & ".JHOOK, " & 訂單資料表(7) & ".WaterResistant, " & 訂單資料表(7) & ".P16VAT, 
72
+                               " & 訂單資料表(7) & ".EXWsaving, " & 訂單資料表(7) & ".Quantity * " & 訂單資料表(7) & ".Tooling AS CollectedToolng, " & 訂單資料表(7) & ".年份, 
73
+                               " & 訂單資料表(7) & ".利潤表流水號, " & 訂單資料表(1) & ".訂單數量 - " & 訂單資料表(7) & ".Quantity AS 驗證, STYLELIST.ItemNumber, " & 訂單資料表(7) & ".審核, 
74
+                               " & 訂單資料表(1) & ".客戶訂單號 
75
+                        FROM   " & 訂單資料表(1) & " LEFT OUTER JOIN STYLELIST ON " & 訂單資料表(1) & ".形體號 = STYLELIST.ProductName RIGHT OUTER JOIN " & 訂單資料表(7) & " ON 
76
+                               " & 訂單資料表(1) & ".資料流水號 = " & 訂單資料表(7) & ".資料流水號 " & 列印用SQL & "
77
+                        ORDER BY " & 訂單資料表(1) & ".訂單流水號 DESC"
33 78
             Else
34
-                SQL_利潤表載入3()
79
+                列印用SQL = " WHERE ((" & 訂單資料表(1) & ".訂單流水號 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".年份季度 LIKE '%" & PA & "%') OR 
80
+                                    (" & 訂單資料表(1) & ".客戶訂單號 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".形體號 LIKE '%" & PA & "%') OR 
81
+                                    (" & 訂單資料表(1) & ".顏色 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".楦型 LIKE '%" & PA & "%') OR 
82
+                                    (" & 訂單資料表(1) & ".備註 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".備註 LIKE '%" & PA & "%') OR 
83
+                                    (" & 訂單資料表(1) & ".生產工廠 LIKE '%" & PA & "%') OR (" & 訂單資料表(1) & ".訂單種類 LIKE '%" & PA & "%') OR 
84
+                                    (" & 訂單資料表(1) & ".力威訂單號 LIKE '%" & PA & "%')) AND " & 訂單資料表(7) & ".天盾訂單號 IS NOT NULL AND 
85
+                                    " & 訂單資料表(7) & ".年份 LIKE '" & 年份_cb.Text & "' AND (" & 訂單資料表(1) & ".CXL IS NULL OR " & 訂單資料表(1) & ".CXL = 0) "
86
+
87
+                SQL1 = "SELECT " & 訂單資料表(1) & ".訂單流水號, " & 訂單資料表(1) & ".資料流水號, " & 訂單資料表(1) & ".年份季度, " & 訂單資料表(1) & ".力威訂單號, " & 訂單資料表(1) & ".形體號, 
88
+                               " & 訂單資料表(1) & ".顏色, " & 訂單資料表(1) & ".楦型, " & 訂單資料表(1) & ".訂單數量 AS 數量, " & 訂單資料表(1) & ".客戶交期, " & 訂單資料表(1) & ".單價, 
89
+                               " & 訂單資料表(1) & ".總金額, " & 訂單資料表(1) & ".備註, " & 訂單資料表(1) & ".生產工廠 AS 工廠, " & 訂單資料表(1) & ".訂單種類, " & 訂單資料表(7) & ".Quantity, 
90
+                               " & 訂單資料表(7) & ".Currency, " & 訂單資料表(7) & ".Exchange, " & 訂單資料表(7) & ".FTYPrice, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * 
91
+                               " & 訂單資料表(7) & ".Quantity AS CommissionTTL, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionDarren, 
92
+                              (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionTendenza, (" & 訂單資料表(1) & ".單價 - 
93
+                               " & 訂單資料表(7) & ".FTYPrice) AS Percentage, " & 訂單資料表(7) & ".BasicPrice, " & 訂單資料表(7) & ".Polybag AS [PG/MOQ], " & 訂單資料表(7) & ".FOOTformOrPETform AS FOOTorPET, 
94
+                               " & 訂單資料表(7) & ".Tooling, " & 訂單資料表(7) & ".RubberBand, " & 訂單資料表(7) & ".JHOOK, " & 訂單資料表(7) & ".WaterResistant, " & 訂單資料表(7) & ".P16VAT, 
95
+                               " & 訂單資料表(7) & ".EXWsaving, " & 訂單資料表(7) & ".Quantity * " & 訂單資料表(7) & ".Tooling AS CollectedToolng, " & 訂單資料表(7) & ".年份, 
96
+                               " & 訂單資料表(7) & ".利潤表流水號, " & 訂單資料表(1) & ".訂單數量 - " & 訂單資料表(7) & ".Quantity AS 驗證, STYLELIST.ItemNumber, " & 訂單資料表(7) & ".審核, 
97
+                               " & 訂單資料表(1) & ".客戶訂單號 
98
+                        FROM   " & 訂單資料表(1) & " LEFT OUTER JOIN STYLELIST ON " & 訂單資料表(1) & ".形體號 = STYLELIST.ProductName RIGHT OUTER JOIN " & 訂單資料表(7) & " ON 
99
+                               " & 訂單資料表(1) & ".資料流水號 = " & 訂單資料表(7) & ".資料流水號 " & 列印用SQL & "
100
+                        ORDER BY " & 訂單資料表(1) & ".訂單流水號 DESC"
35 101
             End If
36
-            Set_DGV1載入後設定()
102
+            利潤表載入後設定()
37 103
         End If
38 104
         資料筆數_tb.Text = Format(利潤表_dgv.Rows.Count, "#,##0")
39 105
     End Sub
40 106
     Private Sub Set_編輯清單()
41
-        Set_DGV1載入前設定()
42
-        SQL_利潤表載入4()
43
-        Set_DGV1載入後設定()
107
+        利潤表載入前設定()
108
+        SQL1 = "SELECT " & 訂單資料表(1) & ".訂單流水號, " & 訂單資料表(1) & ".資料流水號, " & 訂單資料表(1) & ".年份季度, " & 訂單資料表(1) & ".力威訂單號, " & 訂單資料表(1) & ".形體號, 
109
+                       " & 訂單資料表(1) & ".顏色, " & 訂單資料表(1) & ".楦型, " & 訂單資料表(1) & ".訂單數量 AS 數量, " & 訂單資料表(1) & ".客戶交期, " & 訂單資料表(1) & ".單價, 
110
+                       " & 訂單資料表(1) & ".總金額, " & 訂單資料表(1) & ".備註, " & 訂單資料表(1) & ".生產工廠 AS 工廠, " & 訂單資料表(1) & ".訂單種類, " & 訂單資料表(7) & ".Quantity, 
111
+                       " & 訂單資料表(7) & ".Currency, " & 訂單資料表(7) & ".Exchange, " & 訂單資料表(7) & ".FTYPrice, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * 
112
+                       " & 訂單資料表(7) & ".Quantity AS CommissionTTL, (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionDarren, 
113
+                      (" & 訂單資料表(1) & ".單價 - " & 訂單資料表(7) & ".FTYPrice) * " & 訂單資料表(7) & ".Quantity / 2 AS CommissionTendenza, " & 訂單資料表(1) & ".單價 - 
114
+                       " & 訂單資料表(7) & ".FTYPrice AS Percentage, " & 訂單資料表(7) & ".BasicPrice, " & 訂單資料表(7) & ".Polybag AS [PG/MOQ], " & 訂單資料表(7) & ".FOOTformOrPETform AS FOOTorPET, 
115
+                       " & 訂單資料表(7) & ".Tooling, " & 訂單資料表(7) & ".RubberBand, " & 訂單資料表(7) & ".JHOOK, " & 訂單資料表(7) & ".WaterResistant, " & 訂單資料表(7) & ".P16VAT, 
116
+                       " & 訂單資料表(7) & ".EXWsaving, " & 訂單資料表(7) & ".Quantity * " & 訂單資料表(7) & ".Tooling AS CollectedToolng, " & 訂單資料表(7) & ".年份, 
117
+                       訂單價格利潤表暫存檔.利潤表流水號, " & 訂單資料表(1) & ".訂單數量 - " & 訂單資料表(7) & ".Quantity AS 驗證, STYLELIST.ItemNumber, " & 訂單資料表(7) & ".審核, 
118
+                       " & 訂單資料表(1) & ".客戶訂單號 
119
+                FROM   STYLELIST RIGHT OUTER JOIN " & 訂單資料表(1) & " ON STYLELIST.ProductName = " & 訂單資料表(1) & ".形體號 RIGHT OUTER JOIN 訂單價格利潤表暫存檔 ON 
120
+                       " & 訂單資料表(1) & ".資料流水號 = 訂單價格利潤表暫存檔.資料流水號 LEFT OUTER JOIN " & 訂單資料表(7) & " ON 訂單價格利潤表暫存檔.資料流水號 = " & 訂單資料表(7) & ".資料流水號 
121
+                ORDER BY " & 訂單資料表(1) & ".訂單流水號 DESC, " & 訂單資料表(1) & ".形體號, " & 訂單資料表(1) & ".顏色, " & 訂單資料表(1) & ".楦型"
122
+        利潤表載入後設定()
44 123
     End Sub
45 124
     Private Sub Set_暫存資料設定()
46
-        SQL_利潤表暫存檔_刪除利潤表暫存檔() : conn.Close()
125
+        ConnOpen()
126
+        SQL1 = "DELETE FROM 訂單價格利潤表暫存檔"
127
+        CmdSet_For_dr() : conn.Close()
47 128
 
48 129
         Dim NUM2 As Integer
49
-        PA = 訂單資料表(7)
50
-        SQL_利潤表暫存檔_訂單資料表_最後一筆資料()
130
+        ConnOpen()
131
+        SQL1 = "SELECT TOP (1) 利潤表流水號 FROM " & 訂單資料表(7) & " ORDER BY 利潤表流水號 DESC"
132
+        CmdSet_For_dr()
51 133
         If dr.Read() Then : NUM2 = Strings.Right(dr("利潤表流水號").ToString, 8) : End If
52 134
         conn.Close()
53 135
         For i As Integer = 0 To 利潤表_dgv.Rows.Count - 1
@@ -61,10 +143,10 @@ Public Class 訂單價格利潤明細表
61 143
             ElseIf NUM2 > 999999 And NUM2 < 1000000 Then : WW = "PR" & "0" & NUM2
62 144
             ElseIf NUM2 > 9999999 Then : WW = "PR" & NUM2
63 145
             End If
64
-            PA = 利潤表_dgv.Rows(i).Cells("資料流水號").Value
65
-            PA1 = WW
66
-            PA2 = 利潤表_dgv.Rows(i).Cells("訂單流水號").Value
67
-            SQL_利潤表暫存檔_訂單資料表_新增一筆流水號資料() : conn.Close()
146
+            ConnOpen()
147
+            SQL1 = "INSERT INTO 訂單價格利潤表暫存檔 (資料流水號, 利潤表流水號, 訂單流水號) 
148
+                    VALUES ('" & 利潤表_dgv.Rows(i).Cells("資料流水號").Value & "','" & WW & "', '" & 利潤表_dgv.Rows(i).Cells("訂單流水號").Value & "')"
149
+            CmdSet_For_dr() : conn.Close()
68 150
         Next i
69 151
     End Sub
70 152
     Private Sub Set_未建檔清單()
@@ -72,9 +154,17 @@ Public Class 訂單價格利潤明細表
72 154
         訂單流水號_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
73 155
         訂單流水號_dgv.ColumnHeadersHeight = 25
74 156
         訂單流水號_dgv.AllowUserToAddRows = False
75
-        PA1 = 訂單資料表(1)
76
-        PA2 = 訂單資料表(7)
77
-        SQL_訂單資料表_訂單流水號資料() : da.Fill(ds1) : 訂單流水號_dgv.DataSource = ds1.Tables(0) : conn.Close()
157
+        ConnOpen()
158
+        SQL1 = "SELECT " & 訂單資料表(1) & ".訂單流水號 
159
+                FROM   " & 訂單資料表(1) & " FULL OUTER JOIN " & 訂單資料表(7) & " ON " & 訂單資料表(1) & ".資料流水號 = " & 訂單資料表(7) & ".資料流水號 
160
+                WHERE (" & 訂單資料表(7) & ".天盾訂單號 IS NULL) AND 
161
+                      (LEFT(" & 訂單資料表(1) & ".客戶交期, 4) NOT LIKE '2009') AND (LEFT(" & 訂單資料表(1) & ".客戶交期, 4) NOT LIKE '2010') AND 
162
+                      (LEFT(" & 訂單資料表(1) & ".客戶交期, 4) NOT LIKE '2011') AND (LEFT(" & 訂單資料表(1) & ".客戶交期, 4) NOT LIKE '2012') AND 
163
+                      (LEFT(" & 訂單資料表(1) & ".客戶交期, 4) NOT LIKE '2013') AND (LEFT(" & 訂單資料表(1) & ".客戶交期, 4) NOT LIKE '2014') AND 
164
+                      (LEFT(" & 訂單資料表(1) & ".客戶交期, 4) NOT LIKE '2015') AND (LEFT(" & 訂單資料表(1) & ".客戶交期, 4) NOT LIKE '2016') AND 
165
+                      (LEFT(" & 訂單資料表(1) & ".客戶交期, 4) NOT LIKE '2017') AND (" & 訂單資料表(1) & ".CXL IS NULL OR " & 訂單資料表(1) & ".CXL = 0) 
166
+                GROUP BY   " & 訂單資料表(1) & ".訂單流水號 ORDER BY   " & 訂單資料表(1) & ".訂單流水號 DESC"
167
+        CmdSet_For_DGV() : da.SelectCommand.CommandTimeout = 900 : da.Fill(ds1) : 訂單流水號_dgv.DataSource = ds1.Tables(0) : conn.Close()
78 168
     End Sub
79 169
     Private Sub Set_grid()
80 170
         利潤表_dgv.Columns(0).FillWeight = 85 : 利潤表_dgv.Columns(1).Visible = False
@@ -265,7 +355,7 @@ Public Class 訂單價格利潤明細表
265 355
     Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
266 356
         If Label47.Visible = True Then : Label47.Visible = False : Else : Label47.Visible = True : End If
267 357
     End Sub
268
-    Private Sub 利潤表_dgv_CellEndEdit(ByVal sender As Object, ByVal e As DataGridViewCellEventArgs) Handles 利潤表_dgv.CellEndEdit
358
+    Private Sub DataGridView1_CellEndEdit(ByVal sender As Object, ByVal e As DataGridViewCellEventArgs) Handles 利潤表_dgv.CellEndEdit
269 359
         Set_自動彙總1()
270 360
     End Sub
271 361
     Private Sub 利潤表_dgv_CellClick(ByVal sender As Object, ByVal e As DataGridViewCellEventArgs) Handles 利潤表_dgv.CellClick
@@ -277,7 +367,7 @@ Public Class 訂單價格利潤明細表
277 367
             TextBox17.Text = 利潤表_dgv(33, e.RowIndex).Value.ToString
278 368
         End If
279 369
     End Sub
280
-    Private Sub 訂單流水號_dgv_CellClick(ByVal sender As Object, ByVal e As DataGridViewCellEventArgs) Handles 訂單流水號_dgv.CellClick
370
+    Private Sub 訂單流水號_dgv2_CellClick(ByVal sender As Object, ByVal e As DataGridViewCellEventArgs) Handles 訂單流水號_dgv.CellClick
281 371
         If e.RowIndex = -1 Then : Else
282 372
             天盾流水號_tb.Text = 訂單流水號_dgv(0, e.RowIndex).Value.ToString
283 373
             Timer1.Enabled = True : 存檔_bt.Enabled = True : 未建檔_cb.Checked = True : 已建檔_bt.Checked = False : 刪除_bt.Enabled = False : 修改_bt.Enabled = False
@@ -291,7 +381,9 @@ Public Class 訂單價格利潤明細表
291 381
                 MsgBox("沒有選擇將要拆分的資料")
292 382
             Else
293 383
                 Dim NUM2 As Integer
294
-                SQL_利潤表暫存檔_利潤表流水號_最後一筆資料()
384
+                ConnOpen()
385
+                SQL1 = "SELECT TOP (1) 利潤表流水號 FROM 訂單價格利潤表暫存檔 ORDER BY 利潤表流水號 DESC"
386
+                CmdSet_For_dr()
295 387
                 If dr.Read() Then : NUM2 = Strings.Right(dr("利潤表流水號").ToString, 8) : End If
296 388
                 conn.Close()
297 389
                 NUM2 += 1
@@ -304,14 +396,16 @@ Public Class 訂單價格利潤明細表
304 396
                 ElseIf NUM2 > 999999 And NUM2 < 1000000 Then : WW = "PR" & "0" & NUM2
305 397
                 ElseIf NUM2 > 9999999 Then : WW = "PR" & NUM2
306 398
                 End If
307
-                PA = WW
308
-                SQL_新增訂單價格利潤表暫存檔() : conn.Close()
399
+                ConnOpen()
400
+                SQL1 = "INSERT INTO 訂單價格利潤表暫存檔 (資料流水號, 利潤表流水號, 訂單流水號) VALUES ('" & TextBox16.Text & "','" & WW & "', '" & 天盾流水號_tb.Text & "')"
401
+                CmdSet_For_dr() : conn.Close()
309 402
                 Set_編輯清單() : Set_grid() : Set_自動彙總1()
310 403
             End If
311 404
         ElseIf 未建檔_cb.Checked = False Then
312 405
             Dim NUM2 As Integer
313
-            PA = 訂單資料表(7)
314
-            SQL_利潤表暫存檔_訂單資料表_新增一筆流水號資料()
406
+            ConnOpen()
407
+            SQL1 = "SELECT TOP (1) 利潤表流水號 FROM " & 訂單資料表(7) & " ORDER BY 利潤表流水號 DESC"
408
+            CmdSet_For_dr()
315 409
             If dr.Read() Then : NUM2 = Strings.Right(dr("利潤表流水號").ToString, 8) : End If
316 410
             conn.Close()
317 411
             NUM2 += 1
@@ -324,19 +418,25 @@ Public Class 訂單價格利潤明細表
324 418
             ElseIf NUM2 > 999999 And NUM2 < 1000000 Then : WW = "PR" & "0" & NUM2
325 419
             ElseIf NUM2 > 9999999 Then : WW = "PR" & NUM2
326 420
             End If
327
-            PA = 訂單資料表(7)
328
-            PA1 = WW
329
-            SQL_訂單資料表_新增一筆客戶資料() : conn.Close()
421
+            ConnOpen()
422
+            SQL1 = "INSERT INTO " & 訂單資料表(7) & " (資料流水號, 天盾訂單號, 客戶流水號, FTYPrice, BasicPrice, Polybag, FOOTformOrPETform, Tooling, RubberBand, JHOOK, WaterResistant, P16VAT, 
423
+                                                       EXWsaving, Currency, Exchange, 年份, Quantity, 利潤表流水號, 審核) 
424
+                    VALUES ('" & TextBox16.Text & "', '" & 天盾流水號_tb.Text & "', '" & 客戶訂單號_tb.Text & "', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '" & Currency_cb.Text & "', '0', 
425
+                            '" & 年份_cb.Text & "', '0', '" & WW & "', '0')"
426
+            CmdSet_For_dr() : conn.Close()
330 427
             Set_訂單清單() : Set_grid() : Set_自動彙總1()
331 428
         End If
332 429
     End Sub
333 430
     Private Sub 刪除拆分資料_bt_Click(sender As Object, e As EventArgs) Handles 刪除拆分資料_bt.Click
334 431
         If 未建檔_cb.Checked = True Then
335
-            SQL_利潤表暫存檔_刪除利潤表流水號() : conn.Close()
432
+            ConnOpen()
433
+            SQL1 = "DELETE FROM 訂單價格利潤表暫存檔 WHERE 利潤表流水號 LIKE '" & TextBox17.Text & "'"
434
+            CmdSet_For_dr() : conn.Close()
336 435
             Set_編輯清單() : Set_grid() : Set_自動彙總1()
337 436
         ElseIf 未建檔_cb.Checked = False Then
338
-            PA = 訂單資料表(7)
339
-            SQL_利潤表暫存檔_刪除利潤表流水號1() : conn.Close()
437
+            ConnOpen()
438
+            SQL1 = "DELETE FROM " & 訂單資料表(7) & " WHERE 利潤表流水號 LIKE '" & TextBox17.Text & "'"
439
+            CmdSet_For_dr() : conn.Close()
340 440
             Set_訂單清單() : Set_grid() : Set_自動彙總1()
341 441
         End If
342 442
     End Sub
@@ -416,36 +516,41 @@ Public Class 訂單價格利潤明細表
416 516
             MsgBox("年份或幣別沒有選擇")
417 517
         Else
418 518
             For i As Integer = 0 To 利潤表_dgv.Rows.Count - 1
419
-                PA = 訂單資料表(7)
420
-                PA1 = 利潤表_dgv.Rows(i).Cells("資料流水號").Value
421
-                SQL_訂單資料表_查詢資料流水號()
519
+                ConnOpen()
520
+                SQL1 = "SELECT 利潤表流水號 FROM " & 訂單資料表(7) & " WHERE (資料流水號 LIKE '" & 利潤表_dgv.Rows(i).Cells("資料流水號").Value & "')"
521
+                CmdSet_For_dr()
422 522
                 If dr.Read() Then
423 523
                     conn.Close()
424 524
                 Else
425
-                    SQL_訂單控制表修改紀錄_查詢最後一筆流水號()
525
+                    conn.Close()
526
+                    ConnOpen()
527
+                    SQL1 = "SELECT TOP (1) 編輯次數 FROM 訂單控制表修改紀錄 WHERE (流水號 LIKE '" & 利潤表_dgv.Rows(i).Cells("資料流水號").Value & "') ORDER BY 編輯次數 DESC"
528
+                    CmdSet_For_dr()
426 529
                     If dr.Read() Then : NUM2 = dr("編輯次數").ToString : End If
427 530
                     conn.Close()
428 531
                     NUM2 += 1
429
-                    PA2 = 利潤表_dgv.Rows(i).Cells("資料流水號").Value
430
-                    PA3 = NUM2
431
-
432
-                    SQL_訂單控制表修改紀錄_新增一筆流水號() : conn.Close()
532
+                    ConnOpen()
533
+                    SQL1 = "INSERT INTO 訂單控制表修改紀錄 (流水號, 編輯者, 編輯時間, 編輯次數) 
534
+                            VALUES ('" & 利潤表_dgv.Rows(i).Cells("資料流水號").Value & "','" & gUserName & "','" & Format(Today, "yyyy/MM/dd") & "','" & NUM2 & "')"
535
+                    CmdSet_For_dr() : conn.Close()
433 536
 
434
-                    PA4 = 訂單資料表(1)
435
-                    PA5 = 利潤表_dgv.Rows(i).Cells("單價").Value
436
-                    PA6 = 利潤表_dgv.Rows(i).Cells("總金額").Value
437
-                    PA7 = 利潤表_dgv.Rows(i).Cells("資料流水號").Value
438
-
439
-                    SQL_訂單控制表修改紀錄_修改訂單資料表() : conn.Close()
440
-
441
-                    PA8 = 訂單資料表(7)
442
-                    PA9 = 利潤表_dgv.Rows(i).Cells("資料流水號").Value : PA10 = 利潤表_dgv.Rows(i).Cells("訂單流水號").Value : PA11 = 利潤表_dgv.Rows(i).Cells("客戶訂單號").Value
443
-                    PA12 = 利潤表_dgv.Rows(i).Cells("FTYPrice").Value : PA13 = 利潤表_dgv.Rows(i).Cells("BasicPrice").Value : PA14 = 利潤表_dgv.Rows(i).Cells("PG/MOQ").Value
444
-                    PA15 = 利潤表_dgv.Rows(i).Cells("FOOTorPET").Value : PA16 = 利潤表_dgv.Rows(i).Cells("Tooling").Value : PA17 = 利潤表_dgv.Rows(i).Cells("RubberBand").Value
445
-                    PA18 = 利潤表_dgv.Rows(i).Cells("JHOOK").Value : PA19 = 利潤表_dgv.Rows(i).Cells("WaterResistant").Value : PA20 = 利潤表_dgv.Rows(i).Cells("P16VAT").Value
446
-                    PA21 = 利潤表_dgv.Rows(i).Cells("EXWsaving").Value : PA22 = 利潤表_dgv.Rows(i).Cells("Exchange").Value : PA23 = 利潤表_dgv.Rows(i).Cells("年份").Value
447
-                    PA24 = 利潤表_dgv.Rows(i).Cells("Quantity").Value : PA25 = 利潤表_dgv.Rows(i).Cells("利潤表流水號").Value : PA26 = 利潤表_dgv.Rows(i).Cells("審核").Value
448
-                    SQL_訂單資料表_新增訂單資料表資料() : conn.Close()
537
+                    ConnOpen()
538
+                    SQL1 = "UPDATE " & 訂單資料表(1) & " SET  單價 = '" & 利潤表_dgv.Rows(i).Cells("單價").Value & "', 總金額 = '" & 利潤表_dgv.Rows(i).Cells("總金額").Value & "' 
539
+                            WHERE (資料流水號 LIKE '" & 利潤表_dgv.Rows(i).Cells("資料流水號").Value & "')"
540
+                    CmdSet_For_dr() : conn.Close()
541
+                    ConnOpen()
542
+                    SQL1 = "INSERT INTO " & 訂單資料表(7) & " (資料流水號, 天盾訂單號, 客戶流水號, FTYPrice, BasicPrice, Polybag, FOOTformOrPETform, Tooling, RubberBand, JHOOK, WaterResistant, 
543
+                                                               P16VAT, EXWsaving, Currency, Exchange, 年份, Quantity, 利潤表流水號, 審核) 
544
+                            VALUES ('" & 利潤表_dgv.Rows(i).Cells("資料流水號").Value & "', '" & 利潤表_dgv.Rows(i).Cells("訂單流水號").Value & "', 
545
+                                    '" & 利潤表_dgv.Rows(i).Cells("客戶訂單號").Value & "', '" & 利潤表_dgv.Rows(i).Cells("FTYPrice").Value & "', 
546
+                                    '" & 利潤表_dgv.Rows(i).Cells("BasicPrice").Value & "', '" & 利潤表_dgv.Rows(i).Cells("PG/MOQ").Value & "', 
547
+                                    '" & 利潤表_dgv.Rows(i).Cells("FOOTorPET").Value & "', '" & 利潤表_dgv.Rows(i).Cells("Tooling").Value & "', 
548
+                                    '" & 利潤表_dgv.Rows(i).Cells("RubberBand").Value & "', '" & 利潤表_dgv.Rows(i).Cells("JHOOK").Value & "', 
549
+                                    '" & 利潤表_dgv.Rows(i).Cells("WaterResistant").Value & "', '" & 利潤表_dgv.Rows(i).Cells("P16VAT").Value & "', 
550
+                                    '" & 利潤表_dgv.Rows(i).Cells("EXWsaving").Value & "', '" & Currency_cb.Text & "', '" & 利潤表_dgv.Rows(i).Cells("Exchange").Value & "', 
551
+                                    '" & 利潤表_dgv.Rows(i).Cells("年份").Value & "', '" & 利潤表_dgv.Rows(i).Cells("Quantity").Value & "', 
552
+                                    '" & 利潤表_dgv.Rows(i).Cells("利潤表流水號").Value & "', '" & 利潤表_dgv.Rows(i).Cells("審核").Value & "')"
553
+                    CmdSet_For_dr() : conn.Close()
449 554
                 End If
450 555
             Next i
451 556
             MsgBox("存檔完成")
@@ -466,28 +571,32 @@ Public Class 訂單價格利潤明細表
466 571
         Else
467 572
             For i As Integer = 0 To 利潤表_dgv.Rows.Count - 1
468 573
                 資料數 = 利潤表_dgv.Rows.Count : 進度條()
469
-                SQL_訂單控制表修改紀錄_查詢最後一筆流水號()
574
+                ConnOpen()
575
+                SQL1 = "SELECT TOP (1) 編輯次數 FROM 訂單控制表修改紀錄 WHERE (流水號 LIKE '" & 利潤表_dgv.Rows(i).Cells("資料流水號").Value & "') ORDER BY 編輯次數 DESC"
576
+                CmdSet_For_dr()
470 577
                 If dr.Read() Then : NUM2 = dr("編輯次數").ToString : End If
471 578
                 conn.Close()
472 579
                 NUM2 += 1
473
-                SQL_訂單控制表修改紀錄_新增一筆流水號() : conn.Close()
474
-
475
-                PA4 = 訂單資料表(1)
476
-                PA5 = 利潤表_dgv.Rows(i).Cells("單價").Value
477
-                PA6 = 利潤表_dgv.Rows(i).Cells("總金額").Value
478
-                PA7 = 利潤表_dgv.Rows(i).Cells("資料流水號").Value
479
-
480
-                SQL_訂單控制表修改紀錄_修改訂單資料表() : conn.Close()
481
-
482
-                PA8 = 訂單資料表(7)
483
-                PA9 = 利潤表_dgv.Rows(i).Cells("FTYPrice").Value : PA10 = 利潤表_dgv.Rows(i).Cells("BasicPrice").Value : PA11 = 利潤表_dgv.Rows(i).Cells("PG/MOQ").Value
484
-                PA12 = 利潤表_dgv.Rows(i).Cells("FOOTorPET").Value : PA13 = 利潤表_dgv.Rows(i).Cells("Tooling").Value : PA14 = 利潤表_dgv.Rows(i).Cells("RubberBand").Value
485
-                PA15 = 利潤表_dgv.Rows(i).Cells("JHOOK").Value : PA16 = 利潤表_dgv.Rows(i).Cells("WaterResistant").Value : PA17 = 利潤表_dgv.Rows(i).Cells("P16VAT").Value
486
-                PA18 = 利潤表_dgv.Rows(i).Cells("EXWsaving").Value : PA19 = 利潤表_dgv.Rows(i).Cells("Exchange").Value : PA20 = 利潤表_dgv.Rows(i).Cells("年份").Value
487
-                PA21 = 利潤表_dgv.Rows(i).Cells("Quantity").Value : PA22 = 利潤表_dgv.Rows(i).Cells("審核").Value : PA23 = 利潤表_dgv.Rows(i).Cells("利潤表流水號").Value
488
-                PA24 = 利潤表_dgv.Rows(i).Cells("Quantity").Value : PA25 = 利潤表_dgv.Rows(i).Cells("利潤表流水號").Value : PA26 = 利潤表_dgv.Rows(i).Cells("審核").Value
580
+                ConnOpen()
581
+                SQL1 = "INSERT INTO 訂單控制表修改紀錄 (流水號, 編輯者, 編輯時間, 編輯次數) 
582
+                        VALUES ('" & 利潤表_dgv.Rows(i).Cells("資料流水號").Value & "','" & gUserName & "','" & Format(Today, "yyyy/MM/dd") & "','" & NUM2 & "')"
583
+                CmdSet_For_dr() : conn.Close()
489 584
 
490
-                SQL_訂單資料表_更新訂單資料表資料() : conn.Close()
585
+                ConnOpen()
586
+                SQL1 = "UPDATE " & 訂單資料表(1) & " SET  單價 = '" & 利潤表_dgv.Rows(i).Cells("單價").Value & "', 總金額 = '" & 利潤表_dgv.Rows(i).Cells("總金額").Value & "' 
587
+                        WHERE (資料流水號 LIKE '" & 利潤表_dgv.Rows(i).Cells("資料流水號").Value & "')"
588
+                CmdSet_For_dr() : conn.Close()
589
+                ConnOpen()
590
+                SQL1 = "UPDATE " & 訂單資料表(7) & " SET  FTYPrice = '" & 利潤表_dgv.Rows(i).Cells("FTYPrice").Value & "', BasicPrice = '" & 利潤表_dgv.Rows(i).Cells("BasicPrice").Value & "', 
591
+                                                          Polybag = '" & 利潤表_dgv.Rows(i).Cells("PG/MOQ").Value & "', FOOTformOrPETform = '" & 利潤表_dgv.Rows(i).Cells("FOOTorPET").Value & "', 
592
+                                                          Tooling = '" & 利潤表_dgv.Rows(i).Cells("Tooling").Value & "', RubberBand = '" & 利潤表_dgv.Rows(i).Cells("RubberBand").Value & "', 
593
+                                                          JHOOK = '" & 利潤表_dgv.Rows(i).Cells("JHOOK").Value & "', WaterResistant = '" & 利潤表_dgv.Rows(i).Cells("WaterResistant").Value & "', 
594
+                                                          P16VAT = '" & 利潤表_dgv.Rows(i).Cells("P16VAT").Value & "', EXWsaving = '" & 利潤表_dgv.Rows(i).Cells("EXWsaving").Value & "', 
595
+                                                          Currency = '" & Currency_cb.Text & "', Exchange = '" & 利潤表_dgv.Rows(i).Cells("Exchange").Value & "',  
596
+                                                          年份 = '" & 利潤表_dgv.Rows(i).Cells("年份").Value & "', Quantity = '" & 利潤表_dgv.Rows(i).Cells("Quantity").Value & "', 
597
+                                                          審核 = '" & 利潤表_dgv.Rows(i).Cells("審核").Value & "' 
598
+                        WHERE (利潤表流水號 LIKE '" & 利潤表_dgv.Rows(i).Cells("利潤表流水號").Value & "')"
599
+                CmdSet_For_dr() : conn.Close()
491 600
             Next i : ProgressBar1.Value = 0 : 最終數 = 0
492 601
             MsgBox("修改完成")
493 602
             未建檔_cb.Checked = False : 已建檔_bt.Checked = True
@@ -500,11 +609,13 @@ Public Class 訂單價格利潤明細表
500 609
         Else
501 610
             Dim aa As MsgBoxResult
502 611
             aa = MsgBox("確定要刪除該筆資料?", MsgBoxStyle.OkCancel)
503
-            PA1 = 訂單資料表(1)
504
-            PA2 = 訂單資料表(7)
505 612
             If aa = MsgBoxResult.Ok Then
506
-                SQL_訂單資料表_更新金額() : conn.Close()
507
-                SQL_訂單資料表_刪除訂單資料() : conn.Close()
613
+                ConnOpen()
614
+                SQL1 = "UPDATE " & 訂單資料表(1) & " SET  單價 = '0.00', 總金額 = '0.00' WHERE (訂單流水號 LIKE '" & 天盾流水號_tb.Text & "')"
615
+                CmdSet_For_dr() : conn.Close()
616
+                ConnOpen()
617
+                SQL1 = "DELETE FROM " & 訂單資料表(7) & " WHERE (天盾訂單號 = '" & 天盾流水號_tb.Text & "')"
618
+                CmdSet_For_dr() : conn.Close()
508 619
                 MsgBox("刪除完成")
509 620
             End If
510 621
         End If

Laden…
Annuleren
Opslaan