Nessuna descrizione
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5. using UnityEngine.UI;
  6. using UnityEngine.Networking;
  7. using UnityEngine.EventSystems;
  8. using System.Text.RegularExpressions;
  9. using System.Data.SqlClient;
  10. using System.Runtime.InteropServices;
  11. using System.Text;
  12. using TMPro;
  13. using System;
  14. using System.IO;
  15. using ZXing;
  16. using ZXing.QrCode;
  17. using System.Net;
  18. using System.Data;
  19. using SimpleJSON;
  20. using System.Linq;
  21. public class yawoo : MonoBehaviour
  22. {
  23. [SerializeField] GameObject 彈跳面板;
  24. [SerializeField] TextMeshProUGUI 彈跳文字;
  25. [SerializeField] Button 彈跳叉;
  26. [SerializeField] Button 是;
  27. [SerializeField] Button 否;
  28. [SerializeField] TextMeshProUGUI 標題;
  29. [SerializeField] TextMeshProUGUI 未折價前;
  30. [SerializeField] TextMeshProUGUI 報價小計;
  31. [SerializeField] TextMeshProUGUI 預估工資總成本;
  32. [SerializeField] TextMeshProUGUI 預估材料總成本;
  33. [SerializeField] TextMeshProUGUI 總成本;
  34. [SerializeField] TextMeshProUGUI 預估工資總報價;
  35. [SerializeField] TextMeshProUGUI 預估材料總報價;
  36. [SerializeField] TextMeshProUGUI 總報價;
  37. [SerializeField] TextMeshProUGUI 利潤比;
  38. [SerializeField] TextMeshProUGUI 利潤比1;
  39. [SerializeField] TextMeshProUGUI 利潤比2;
  40. [SerializeField] TextMeshProUGUI 利潤比3;
  41. [SerializeField] TextMeshProUGUI 預估利潤;
  42. [SerializeField] TextMeshProUGUI 未折價前_錢;
  43. [SerializeField] TextMeshProUGUI 報價小計_錢;
  44. [SerializeField] TextMeshProUGUI 預估工資總成本_錢;
  45. [SerializeField] TextMeshProUGUI 預估材料總成本_錢;
  46. [SerializeField] TextMeshProUGUI 總成本_錢;
  47. [SerializeField] TextMeshProUGUI 預估工資總報價_錢;
  48. [SerializeField] TextMeshProUGUI 預估材料總報價_錢;
  49. [SerializeField] TextMeshProUGUI 總報價_錢;
  50. [SerializeField] TextMeshProUGUI 利潤比_錢;
  51. [SerializeField] TextMeshProUGUI 利潤比1_錢;
  52. [SerializeField] TextMeshProUGUI 利潤比2_錢;
  53. [SerializeField] TextMeshProUGUI 利潤比3_錢;
  54. [SerializeField] TextMeshProUGUI 預估利潤_錢;
  55. [SerializeField] TextMeshProUGUI 折讓金額;
  56. [SerializeField] TextMeshProUGUI 總成本1;
  57. [SerializeField] TextMeshProUGUI 總報價1;
  58. [SerializeField] GameObject 調整係數頁面;
  59. [SerializeField] GameObject 明細下一頁;
  60. [SerializeField] GameObject 明細上一頁;
  61. [SerializeField] GameObject 下一頁;
  62. [SerializeField] GameObject 上一頁;
  63. [SerializeField] GameObject 面板_建立;
  64. [SerializeField] GameObject 面板_明細;
  65. [SerializeField] GameObject 面板_利潤;
  66. [SerializeField] GameObject 面板_利潤表頭;
  67. [SerializeField] GameObject 報價;
  68. [SerializeField] GameObject image_row;
  69. [SerializeField] GameObject 左;
  70. [SerializeField] GameObject 右;
  71. [SerializeField] TextMeshProUGUI 合約編號;
  72. [SerializeField] TextMeshProUGUI 工程名稱;
  73. [SerializeField] TextMeshProUGUI 客戶名稱;
  74. [SerializeField] TextMeshProUGUI 負責人;
  75. [SerializeField] TextMeshProUGUI 工程地點;
  76. [SerializeField] TextMeshProUGUI 地址;
  77. [SerializeField] TextMeshProUGUI 公司名稱;
  78. [SerializeField] TextMeshProUGUI 負責人1;
  79. [SerializeField] TextMeshProUGUI 地址1;
  80. [SerializeField] TextMeshProUGUI 合約編號s;
  81. [SerializeField] TextMeshProUGUI 工程名稱s;
  82. [SerializeField] TextMeshProUGUI 客戶名稱s;
  83. [SerializeField] TextMeshProUGUI 負責人s;
  84. [SerializeField] TextMeshProUGUI 工程地點s;
  85. [SerializeField] TextMeshProUGUI 地址s;
  86. [SerializeField] TextMeshProUGUI 公司名稱s;
  87. [SerializeField] TextMeshProUGUI 負責人1s;
  88. [SerializeField] TextMeshProUGUI 地址1s;
  89. [SerializeField] GameObject 選擇面板;
  90. [SerializeField] TextMeshProUGUI 選擇語言;
  91. [SerializeField] TextMeshProUGUI 中;
  92. [SerializeField] TextMeshProUGUI 英;
  93. [SerializeField] TextMeshProUGUI 印;
  94. [SerializeField] TextMeshProUGUI 簡;
  95. [SerializeField] Button 中按鈕;
  96. [SerializeField] Button 英按鈕;
  97. [SerializeField] Button 印按鈕;
  98. [SerializeField] Button 簡按鈕;
  99. public CanvasScaler canvasScaler;
  100. public float idleTime = 300f; // 5分鐘的閒置時間
  101. private float timeSinceLastInteraction = 0f;
  102. private float timer = 0f;
  103. private float interval = 60f;
  104. [SerializeField] GameObject 讀取面板;
  105. [SerializeField] TextMeshProUGUI 讀取;
  106. private string loadingText = "";
  107. private int dotCount = 0;
  108. private Button[] bts;
  109. int nd;
  110. private JSONNode 合約清單;
  111. private JSONNode 合約內容;
  112. private JSONNode 報價係數;
  113. private JSONNode 報價明細;
  114. private JSONNode 報價內容;
  115. private JSONArray 調整係數;
  116. private JSONNode 初始係數;
  117. public GameObject buttonPrefab;
  118. public Transform buttonParent;
  119. public GameObject buttonceneter;
  120. private List<GameObject> copy = new List<GameObject>();
  121. public GameObject buttonPrefab1;
  122. public Transform buttonParent1;
  123. public GameObject buttonceneter1;
  124. private List<GameObject> copy1 = new List<GameObject>();
  125. public GameObject buttonPrefab2;
  126. public Transform buttonParent2;
  127. public GameObject buttonceneter2;
  128. private List<GameObject> copy2 = new List<GameObject>();
  129. public GameObject buttonPrefab3;
  130. public Transform buttonParent3;
  131. public GameObject buttonceneter3;
  132. private List<GameObject> copy3 = new List<GameObject>();
  133. private int itemsPerPage = 6;
  134. private int currentPage = 0;
  135. [SerializeField] GameObject 網頁面板;
  136. UniWebView webView;
  137. public GameObject panel;
  138. float scale = 0;
  139. float xbar = 0;
  140. float ybar = 0;
  141. RectTransform panelRectTransform;
  142. void Start()
  143. {
  144. Screen.autorotateToPortrait = false;
  145. Screen.orientation = ScreenOrientation.LandscapeLeft;
  146. float screenWidth = Screen.width;
  147. float screenHeight = Screen.height;
  148. float rate = screenWidth/screenHeight;
  149. if (canvasScaler == null)
  150. {
  151. canvasScaler = GetComponent<CanvasScaler>();
  152. }
  153. if (rate>1.6)
  154. {
  155. canvasScaler.matchWidthOrHeight = 1f;
  156. }
  157. else
  158. {
  159. canvasScaler.matchWidthOrHeight = 0f;
  160. }
  161. if (canvasScaler.matchWidthOrHeight == 0f)
  162. {
  163. scale = screenWidth / 1600;
  164. xbar=0;
  165. ybar=(screenHeight-(1000*scale))/2;
  166. }
  167. else
  168. {
  169. scale = screenHeight/ 1000;
  170. xbar=(screenWidth-(1600*scale))/2;
  171. ybar=0;
  172. }
  173. panelRectTransform = panel.GetComponent<RectTransform>();
  174. StartCoroutine(判斷更新());
  175. StartCoroutine(AnimateText());
  176. //Main.Global.阿帕契路徑="http://106.1.48.106:8080/wp-content/themes/event-star/tab.php?";
  177. //Main.Global.阿帕契路徑="http://103.231.201.230/hxpgsweb/wp-content/themes/twentytwentyone/tab.php?";
  178. //初始化系統語言();
  179. //Main.Global.預設伺服器路徑="tw";
  180. //Main.Global.系統語言="繁體中文";
  181. 語言選擇按鈕();
  182. 系統語言轉換();
  183. 網頁(panelRectTransform, scale, xbar, ybar);
  184. StartCoroutine(審核清單());
  185. }
  186. IEnumerator 審核清單()
  187. {
  188. 讀取面板.SetActive(true);
  189. string strcon1 = "審核清單";
  190. string se = Main.Global.預設伺服器路徑;
  191. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}", strcon1, se);
  192. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  193. yield return request1.SendWebRequest();
  194. if (request1.result == UnityWebRequest.Result.ConnectionError)
  195. {
  196. //Debug.Log(request.error);
  197. yield break;
  198. }
  199. 合約清單 = JSON.Parse(request1.downloadHandler.text);
  200. 合約編號s.text="";
  201. 客戶名稱s.text="";
  202. 負責人s.text="";
  203. 工程地點s.text="";
  204. 地址s.text="";
  205. 工程名稱s.text="";
  206. 公司名稱s.text="";
  207. 負責人1s.text="";
  208. 地址1s.text="";
  209. if (Main.Global.跳轉==true)
  210. {
  211. for (int i = 0; i < 合約清單.Count; i++)
  212. {
  213. string str = 合約清單[i][0].ToString().Trim('"');
  214. if (str == Main.Global.跳轉1)
  215. {
  216. nd = i;
  217. break;
  218. }
  219. }
  220. if (nd < 1)
  221. {
  222. 左.SetActive(false);
  223. 右.SetActive(true);
  224. }
  225. else if (nd > 合約清單.Count-2)
  226. {
  227. 左.SetActive(true);
  228. 右.SetActive(false);
  229. }
  230. else
  231. {
  232. 左.SetActive(true);
  233. 右.SetActive(true);
  234. }
  235. }
  236. else
  237. {
  238. nd=0;
  239. if (合約清單.Count <= 1)
  240. {
  241. 左.SetActive(false);
  242. 右.SetActive(false);
  243. }
  244. else
  245. {
  246. 左.SetActive(false);
  247. 右.SetActive(true);
  248. }
  249. }
  250. currentPage=0;
  251. StartCoroutine(合約內容清單());
  252. }
  253. IEnumerator 合約內容清單()
  254. {
  255. 讀取面板.SetActive(true);
  256. string strcon = "合約內容";
  257. string name1 = 合約清單[nd][0].ToString().Trim('"');
  258. string se = Main.Global.預設伺服器路徑;
  259. string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&字={1}&se={2}", strcon, name1, se);
  260. UnityWebRequest request = UnityWebRequest.Get(strUrl);
  261. yield return request.SendWebRequest();
  262. if (request.result == UnityWebRequest.Result.ConnectionError)
  263. {
  264. //Debug.Log(request.error);
  265. yield break;
  266. }
  267. 合約內容 = JSON.Parse(request.downloadHandler.text);
  268. 合約編號s.text=合約內容[0];
  269. 客戶名稱s.text=合約內容[1];
  270. 負責人s.text=合約內容[2];
  271. 工程地點s.text=合約內容[3];
  272. 地址s.text=合約內容[4];
  273. if (Main.Global.系統語言=="繁體中文" || Main.Global.系統語言=="簡體中文")
  274. {
  275. 工程名稱s.text=合約內容[5];
  276. }
  277. else
  278. {
  279. 工程名稱s.text=合約內容[6];
  280. }
  281. 公司名稱s.text=合約內容[7];
  282. 負責人1s.text=合約內容[8];
  283. 地址1s.text=合約內容[9];
  284. StartCoroutine(合約報價係數());
  285. }
  286. IEnumerator 合約報價係數()
  287. {
  288. string strcon3 = "合約報價係數";
  289. string se = Main.Global.預設伺服器路徑;
  290. string num = 合約清單[nd][0].ToString().Trim('"');
  291. string strUrl3 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&編號={2}", strcon3, se, num);
  292. UnityWebRequest request3 = UnityWebRequest.Get(strUrl3);
  293. yield return request3.SendWebRequest();
  294. if (request3.result == UnityWebRequest.Result.ConnectionError)
  295. {
  296. //Debug.Log(request.error);
  297. yield break;
  298. }
  299. 報價係數 = JSON.Parse(request3.downloadHandler.text);
  300. 初始係數 = JSON.Parse(request3.downloadHandler.text);
  301. StartCoroutine(報價內容清單());
  302. }
  303. IEnumerator 報價內容清單()
  304. {
  305. string strcon1 = "報價內容";
  306. string se = Main.Global.預設伺服器路徑;
  307. //string se = "id";
  308. string num = 合約清單[nd][0].ToString().Trim('"');
  309. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&編號={2}", strcon1, se, num);
  310. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  311. yield return request1.SendWebRequest();
  312. if (request1.result == UnityWebRequest.Result.ConnectionError)
  313. {
  314. //Debug.Log(request.error);
  315. yield break;
  316. }
  317. 報價內容 = JSON.Parse(request1.downloadHandler.text);
  318. StartCoroutine(報價明細清單());
  319. }
  320. IEnumerator 報價明細清單()
  321. {
  322. string strcon1 = "報價明細";
  323. string se = Main.Global.預設伺服器路徑;
  324. string lan = Main.Global.系統語言;
  325. string num = 合約清單[nd][0].ToString().Trim('"');
  326. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&編號={2}&語言={3}", strcon1, se, num,lan);
  327. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  328. yield return request1.SendWebRequest();
  329. if (request1.result == UnityWebRequest.Result.ConnectionError)
  330. {
  331. //Debug.Log(request.error);
  332. yield break;
  333. }
  334. 報價明細 = JSON.Parse(request1.downloadHandler.text);
  335. 調整係數 = new JSONArray();
  336. HashSet<string> addedItems = new HashSet<string>();
  337. for (int i = 0; i < 報價係數.Count; i++)
  338. {
  339. for (int j = 0; j < 報價明細.Count; j++)
  340. {
  341. string str = 報價係數[i][2].ToString().Trim('"');
  342. if (str==報價明細[j][32].ToString().Trim('"') || str==報價明細[j][60].ToString().Trim('"') || str==報價明細[j][61].ToString().Trim('"'))
  343. {
  344. if (addedItems.Add(str))
  345. {
  346. JSONNode newValue = new JSONObject();
  347. newValue["項目"] = str;
  348. newValue["係數"] = 報價係數[i][3].ToString().Trim('"');
  349. newValue["單位"] = 報價係數[i][4].ToString().Trim('"');
  350. 調整係數.Add(newValue);
  351. }
  352. }
  353. }
  354. }
  355. if (copy != null)
  356. {
  357. DeleteCopies(copy);
  358. }
  359. int sum = 2;
  360. for (int i = 0; i < 調整係數.Count; i++)
  361. {
  362. GameObject buttonObj = Instantiate(buttonPrefab) as GameObject;
  363. buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, -sum);
  364. buttonObj.transform.SetParent(buttonParent, false);
  365. TextMeshProUGUI[] text = buttonObj.GetComponentsInChildren<TextMeshProUGUI>();
  366. TMP_InputField intext = buttonObj.GetComponentInChildren<TMP_InputField>();
  367. text[0].text =調整係數[i][0].ToString().Trim('"');
  368. text[2].text =調整係數[i][2].ToString().Trim('"');
  369. int index = i;
  370. intext.text =double.Parse(調整係數[i][1]).ToString("#.####");
  371. intext.onSubmit.AddListener((inputText) =>
  372. {
  373. 讀取面板.SetActive(true);
  374. for (int i = 0; i < 報價係數.Count; i++)
  375. {
  376. if (調整係數[index][0] == 報價係數[i][2])
  377. {
  378. 報價係數[i][3] =inputText;
  379. }
  380. }
  381. 明細自動計算();
  382. 總表自動計算();
  383. 讀取面板.SetActive(false);
  384. });
  385. sum+=50;
  386. copy.Add(buttonObj);
  387. }
  388. buttonceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(buttonceneter.GetComponent<RectTransform>().sizeDelta.x, sum);
  389. 明細自動計算();
  390. 總表自動計算();
  391. 讀取面板.SetActive(false);
  392. }
  393. private void 明細自動計算()
  394. {
  395. double 合計 = 0;
  396. double 利潤 = 0;
  397. double 工資係數 = 0;
  398. double 工資成本 = 0;
  399. double 工資利潤 = 0;
  400. double 材料係數 = 0;
  401. double 材基係數 = 0;
  402. double 材料成本 = 0;
  403. double 材料利潤 = 0;
  404. for (int i = 0; i < 報價係數.Count; i++)
  405. {
  406. if (報價係數[i][2].ToString().Trim('"') == "工資利潤")
  407. {
  408. 工資係數 = double.Parse(報價係數[i][3]);
  409. }
  410. if (報價係數[i][2].ToString().Trim('"') == "材料係數")
  411. {
  412. 材基係數 = double.Parse(報價係數[i][3]);
  413. break;
  414. }
  415. }
  416. for (int i = 0; i < 報價明細.Count; i++)
  417. {
  418. 報價明細[i][4]=報價明細[i][8];
  419. for (int ii= 0; ii < 報價係數.Count; ii++)
  420. {
  421. if(報價係數[ii][2]==報價明細[i][61] && 報價係數[ii][4].ToString().Trim('"') == "RP")
  422. {
  423. 報價明細[i][9]=報價係數[ii][3];
  424. break;
  425. }
  426. }
  427. double 數量 = double.Parse(報價明細[i][8]);
  428. double 成本單價 = double.Parse(報價明細[i][9]);
  429. 報價明細[i][10]=(數量*成本單價).ToString();
  430. if (報價明細[i][33] == 0)
  431. {
  432. if (報價明細[i][60] == "")
  433. {
  434. 報價明細[i][11] = (成本單價 * 工資係數 / 100).ToString();
  435. }
  436. else
  437. {
  438. for (int ii = 0; ii < 報價係數.Count; ii++)
  439. {
  440. if(報價明細[i][60]==報價係數[ii][2] && 報價係數[ii][4].ToString().Trim('"') == "%")
  441. {
  442. double 係數 = double.Parse(報價係數[ii][3]);
  443. 報價明細[i][11]=(成本單價 * 係數 / 100).ToString();
  444. }
  445. else if (報價明細[i][60]==報價係數[ii][2] && 報價係數[ii][4].ToString().Trim('"') == "RP")
  446. {
  447. 報價明細[i][11] = (成本單價 * 工資係數 / 100).ToString();
  448. }
  449. }
  450. }
  451. }
  452. else
  453. {
  454. 報價明細[i][11]="0";
  455. }
  456. double 工資報價單價 = double.Parse(報價明細[i][11]);
  457. 報價明細[i][12]=(工資報價單價*數量).ToString();
  458. for (int ii = 0; ii < 報價係數.Count; ii++)
  459. {
  460. if (報價係數[ii][2]==報價明細[i][32] && 報價係數[ii][4].ToString().Trim('"') == "RP")
  461. {
  462. 報價明細[i][13]=報價係數[ii][3];
  463. break;
  464. }
  465. }
  466. double 材料成本單價 = double.Parse(報價明細[i][13]);
  467. 報價明細[i][14]= (數量*材料成本單價).ToString();
  468. if (報價明細[i][32].ToString().Trim('"') == "")
  469. {
  470. 材料係數 = 100;
  471. }
  472. else
  473. {
  474. for (int ii = 0; ii < 報價係數.Count; ii++)
  475. {
  476. if (報價明細[i][32]==報價係數[ii][2] && 報價係數[ii][4].ToString().Trim('"') == "%")
  477. {
  478. double 係數 = double.Parse(報價係數[ii][3]);
  479. 材料係數=報價係數[ii][3];
  480. break;
  481. }
  482. else if (報價明細[i][32]==報價係數[ii][2] && 報價係數[ii][4].ToString().Trim('"') == "RP")
  483. {
  484. 材料係數=材基係數;
  485. }
  486. }
  487. }
  488. if (報價明細[i][33] == 0)
  489. {
  490. 報價明細[i][15] = (材料成本單價 * 材料係數 / 100).ToString();
  491. }
  492. else
  493. {
  494. 報價明細[i][15]="0";
  495. }
  496. double 材料報價單價 = double.Parse(報價明細[i][15]);
  497. 報價明細[i][16]=(材料報價單價*數量).ToString();
  498. double 工資報價後價 = double.Parse(報價明細[i][12]);
  499. double 材料報價後價 = double.Parse(報價明細[i][16]);
  500. double 材料成本後價 = double.Parse(報價明細[i][14]);
  501. double 工資成本後價 = double.Parse(報價明細[i][10]);
  502. 報價明細[i][17]=(材料報價後價+工資報價後價-材料成本後價-工資成本後價).ToString();
  503. if (報價明細[i][33] == 0)
  504. {
  505. 報價明細[i][5] =(工資報價單價+材料報價單價).ToString();
  506. 報價明細[i][6] =((工資報價單價+材料報價單價)*數量).ToString();
  507. }
  508. else
  509. {
  510. 報價明細[i][5] ="0";
  511. 報價明細[i][6] ="0";
  512. }
  513. double AMOUNT = double.Parse(報價明細[i][6]);
  514. double 表利潤 = double.Parse(報價明細[i][17]);
  515. if (報價明細[i][1].ToString().Trim('"') != "*")
  516. {
  517. 合計+=AMOUNT;
  518. 利潤+=表利潤;
  519. 工資成本+=工資成本後價;
  520. 工資利潤+=工資報價後價;
  521. 材料成本+=材料成本後價;
  522. 材料利潤+=材料報價後價;
  523. }
  524. if (報價明細[i][1].ToString().Trim('"') == "*")
  525. {
  526. 報價明細[i][6]=合計.ToString();
  527. 合計=0;
  528. 報價明細[i][17]=利潤.ToString();
  529. 利潤=0;
  530. 報價明細[i][10]=工資成本.ToString();
  531. 工資成本=0;
  532. 報價明細[i][12]=工資利潤.ToString();
  533. 工資利潤=0;
  534. 報價明細[i][14]=材料成本.ToString();
  535. 材料成本=0;
  536. 報價明細[i][16]=材料利潤.ToString();
  537. 材料利潤=0;
  538. }
  539. }
  540. 工資成本 = 0;
  541. 材料成本 = 0;
  542. 工資利潤 = 0;
  543. 材料利潤 = 0;
  544. for (int i = 0; i < 報價明細.Count; i++)
  545. {
  546. if (報價明細[i][1].ToString().Trim('"') == "*")
  547. {
  548. double 工資報價後價 = double.Parse(報價明細[i][12]);
  549. double 材料報價後價 = double.Parse(報價明細[i][16]);
  550. double 材料成本後價 = double.Parse(報價明細[i][14]);
  551. double 工資成本後價 = double.Parse(報價明細[i][10]);
  552. 工資成本+=工資成本後價;
  553. 工資利潤+=工資報價後價;
  554. 材料成本+=材料成本後價;
  555. 材料利潤+=材料報價後價;
  556. }
  557. }
  558. double 折讓 = 0;
  559. for (int i = 0; i < 報價內容.Count; i++)
  560. {
  561. if (報價內容[i][2].ToString().Trim('"')=="折讓 Discount")
  562. {
  563. 折讓+=double.Parse(報價內容[i][6]);
  564. }
  565. }
  566. long doci = (long)Math.Round(工資成本);
  567. long doci1 = (long)Math.Round(材料成本);
  568. long doci2 = (long)Math.Round(工資利潤);
  569. long doci3 = (long)Math.Round(材料利潤);
  570. long 折讓1 = (long)Math.Round(折讓);
  571. double rate = 1-(工資成本/工資利潤);
  572. rate= rate*100;
  573. double rate1 = 1-(材料成本/材料利潤);
  574. rate1= rate1*100;
  575. double rate2 = 1-((工資成本+材料成本)/(工資利潤+材料利潤));
  576. rate2= rate2*100;
  577. double rate3 = 1-((工資成本+材料成本)/(工資利潤+材料利潤+折讓));
  578. rate3= rate3*100;
  579. if (double.IsNaN(rate))
  580. {
  581. rate=0;
  582. }
  583. if (double.IsNaN(rate1))
  584. {
  585. rate1=0;
  586. }
  587. if (double.IsNaN(rate2))
  588. {
  589. rate2=0;
  590. }
  591. if (double.IsNaN(rate3))
  592. {
  593. rate3=0;
  594. }
  595. 利潤比_錢.text=((int)Math.Round(rate)).ToString()+"%";
  596. 利潤比1_錢.text=((int)Math.Round(rate1)).ToString()+"%";
  597. 利潤比2_錢.text=((int)Math.Round(rate2)).ToString()+"%";
  598. 利潤比3_錢.text=((int)Math.Round(rate3)).ToString()+"%";
  599. 預估工資總成本_錢.text=doci.ToString("#,##0");
  600. 預估材料總成本_錢.text=doci1.ToString("#,##0");
  601. 總成本_錢.text=(doci+doci1).ToString("#,##0");
  602. 預估工資總報價_錢.text=doci2.ToString("#,##0");
  603. 預估材料總報價_錢.text=doci3.ToString("#,##0");
  604. 總報價_錢.text=(doci2+doci3).ToString("#,##0");
  605. 預估利潤_錢.text=((doci2+doci3)-((doci+doci1)-折讓1)).ToString("#,##0");
  606. 明細圖表();
  607. }
  608. private void 明細圖表()
  609. {
  610. int startIndex = currentPage * itemsPerPage;
  611. int endIndex = Mathf.Min((currentPage + 1) * itemsPerPage, 報價明細.Count);
  612. if (copy1 != null)
  613. {
  614. DeleteCopies(copy1);
  615. }
  616. int sum = 2;
  617. for (int i = startIndex; i < endIndex; i++)
  618. {
  619. GameObject buttonObj = Instantiate(buttonPrefab1) as GameObject;
  620. buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, -sum);
  621. buttonObj.transform.SetParent(buttonParent1, false);
  622. TextMeshProUGUI[] text = buttonObj.GetComponentsInChildren<TextMeshProUGUI>();
  623. text[0].text =報價明細[i][1].ToString().Trim('"');
  624. string jsonString = 報價明細[i][2].ToString().Trim('"');
  625. string unescapedString = Regex.Unescape(jsonString);
  626. text[1].text =unescapedString;
  627. text[2].text =報價明細[i][3].ToString().Trim('"');
  628. SetTextValue(text[3], 報價明細[i][4], true);
  629. SetTextValue(text[4], 報價明細[i][5], true);
  630. SetTextValue(text[5], 報價明細[i][6], true);
  631. text[6].text =報價明細[i][7].ToString().Trim('"');
  632. SetTextValue1(text[7], 報價明細[i][32]);
  633. SetTextValue1(text[8], 報價明細[i][60]);
  634. SetTextValue1(text[9], 報價明細[i][61]);
  635. sum+=100;
  636. copy1.Add(buttonObj);
  637. }
  638. buttonceneter1.GetComponent<RectTransform>().sizeDelta = new Vector2(buttonceneter1.GetComponent<RectTransform>().sizeDelta.x, sum);
  639. if (copy2 != null)
  640. {
  641. DeleteCopies(copy2);
  642. }
  643. int sum1 = 2;
  644. for (int i = startIndex; i < endIndex; i++)
  645. {
  646. GameObject buttonObj = Instantiate(buttonPrefab2) as GameObject;
  647. buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, -sum1);
  648. buttonObj.transform.SetParent(buttonParent2, false);
  649. TextMeshProUGUI[] text = buttonObj.GetComponentsInChildren<TextMeshProUGUI>();
  650. text[0].text =報價明細[i][1].ToString().Trim('"');
  651. string jsonString = 報價明細[i][2].ToString().Trim('"');
  652. string unescapedString = Regex.Unescape(jsonString);
  653. text[1].text =unescapedString;
  654. double parsedValue = double.Parse(報價明細[i][8]);
  655. text[2].text = parsedValue.ToString("#,##0.00");
  656. SetTextValue(text[3], 報價明細[i][9], false);
  657. SetTextValue(text[4], 報價明細[i][10], false);
  658. SetTextValue(text[5], 報價明細[i][11], false);
  659. SetTextValue(text[6], 報價明細[i][12], false);
  660. SetTextValue(text[7], 報價明細[i][13], false);
  661. SetTextValue(text[8], 報價明細[i][14], false);
  662. SetTextValue(text[9], 報價明細[i][15], false);
  663. SetTextValue(text[10], 報價明細[i][16], false);
  664. SetTextValue(text[11], 報價明細[i][17], false);
  665. sum1+=100;
  666. copy2.Add(buttonObj);
  667. }
  668. buttonceneter2.GetComponent<RectTransform>().sizeDelta = new Vector2(buttonceneter2.GetComponent<RectTransform>().sizeDelta.x, sum1);
  669. }
  670. public void 下一頁s()
  671. {
  672. ChangePage(1);
  673. }
  674. public void 上一頁s()
  675. {
  676. ChangePage(-1);
  677. }
  678. private void ChangePage(int offset)
  679. {
  680. currentPage = Mathf.Clamp(currentPage + offset, 0, Mathf.CeilToInt((float)報價明細.Count / itemsPerPage) - 1);
  681. // 调用刷新页面的方法
  682. 明細圖表();
  683. }
  684. private void SetTextValue(TextMeshProUGUI text, string value ,bool 判斷)
  685. {
  686. if (判斷 == true)
  687. {
  688. if (value.Trim('"') == "0")
  689. {
  690. text.text = "";
  691. }
  692. else
  693. {
  694. double parsedValue = double.Parse(value);
  695. long roundedValue = (long)Math.Round(parsedValue);
  696. text.text = roundedValue.ToString("#,##0");
  697. }
  698. }
  699. else
  700. {
  701. double parsedValue = double.Parse(value);
  702. long roundedValue = (long)Math.Round(parsedValue);
  703. text.text = roundedValue.ToString("#,##0");
  704. }
  705. }
  706. private void SetTextValue1(TextMeshProUGUI text, string value)
  707. {
  708. if (string.IsNullOrEmpty(value))
  709. {
  710. text.text="";
  711. }
  712. else
  713. {
  714. for (int ii = 0; ii < 報價係數.Count; ii++)
  715. {
  716. if (value==報價係數[ii][2] && 報價係數[ii][4].ToString().Trim('"') == "%")
  717. {
  718. double 係數 = double.Parse(報價係數[ii][3]);
  719. text.text =(係數-100).ToString() +" %";
  720. }
  721. else if (value==報價係數[ii][2] && 報價係數[ii][4].ToString().Trim('"') == "RP")
  722. {
  723. double 係數 = double.Parse(報價係數[ii][3]);
  724. text.text =係數.ToString() +" RP";
  725. }
  726. }
  727. }
  728. }
  729. private void 總表自動計算()
  730. {
  731. for (int i = 0; i < 報價內容.Count; i++)
  732. {
  733. string trimmedString = 報價內容[i][2].ToString().Trim('"');
  734. if (trimmedString.Length >= 2)
  735. {
  736. if (報價內容[i][2].ToString().Trim('"').Substring(0, 2) == "管理")
  737. {
  738. 報價內容[i][1] = "^";
  739. }
  740. if (報價內容[i][2].ToString().Trim('"').Substring(0, 2) == "稅金")
  741. {
  742. 報價內容[i][1] = "*";
  743. }
  744. if (報價內容[i][2].ToString().Trim('"').Substring(0, 2) == "小計")
  745. {
  746. 報價內容[i][1] = "$";
  747. }
  748. if (報價內容[i][2].ToString().Trim('"').Substring(0, 2) == "總計")
  749. {
  750. 報價內容[i][1] = "@";
  751. }
  752. if (報價內容[i][2].ToString().Trim('"').Substring(0, 2) == "折讓")
  753. {
  754. 報價內容[i][1] = "#";
  755. }
  756. }
  757. if (報價內容[i][8].ToString().Trim('"') != "")
  758. {
  759. for (int ii = 0; ii < 報價明細.Count; ii++)
  760. {
  761. if (報價內容[i][8] == 報價明細[ii][18])
  762. {
  763. 報價內容[i][5] = 報價明細[ii][6];
  764. break;
  765. }
  766. }
  767. }
  768. }
  769. double 合計 = 0;
  770. double 合計無管 = 0;
  771. double 稅金 = 0;
  772. for (int i = 0; i < 報價內容.Count; i++)
  773. {
  774. if (報價內容[i][1].ToString().Trim('"') == "*" ||
  775. 報價內容[i][1].ToString().Trim('"') == "" ||
  776. 報價內容[i][1].ToString().Trim('"') == "@" ||
  777. 報價內容[i][1].ToString().Trim('"') == "^" ||
  778. 報價內容[i][1].ToString().Trim('"') == "$")
  779. {
  780. // Do nothing
  781. }
  782. else
  783. {
  784. if (DBNull.Value.Equals(報價內容[i][4]))
  785. {
  786. 報價內容[i][4] = "0";
  787. }
  788. if (DBNull.Value.Equals(報價內容[i][5]))
  789. {
  790. 報價內容[i][5] = "0";
  791. }
  792. double qty = double.Parse(報價內容[i][4]);
  793. double price = double.Parse(報價內容[i][5]);
  794. 報價內容[i][6]=(qty*price).ToString();
  795. }
  796. if (報價內容[i][1].ToString().Trim('"') != "*" &&
  797. 報價內容[i][1].ToString().Trim('"') != "" &&
  798. 報價內容[i][1].ToString().Trim('"') != "@" &&
  799. 報價內容[i][1].ToString().Trim('"') != "^" &&
  800. 報價內容[i][2].ToString().Trim('"') != "折讓 Discount")
  801. {
  802. double amount = double.Parse(報價內容[i][6]);
  803. 合計無管 +=amount;
  804. }
  805. string description = 報價內容[i][2].ToString().Trim('"');
  806. if (description == "管理費 0%")
  807. {
  808. 報價內容[i][6] = (合計無管 * 0).ToString();
  809. }
  810. else if (description == "管理費 1%")
  811. {
  812. 報價內容[i][6] = (合計無管 * 0.01).ToString();
  813. }
  814. else if (description == "管理費 2%")
  815. {
  816. 報價內容[i][6] = (合計無管 * 0.02).ToString();
  817. }
  818. else if (description == "管理費 3%")
  819. {
  820. 報價內容[i][6] = (合計無管 * 0.03).ToString();
  821. }
  822. else if (description == "管理費 4%")
  823. {
  824. 報價內容[i][6] = (合計無管 * 0.04).ToString();
  825. }
  826. else if (description == "管理費 5%")
  827. {
  828. 報價內容[i][6] = (合計無管 * 0.05).ToString();
  829. }
  830. else if (description == "管理費 6%")
  831. {
  832. 報價內容[i][6] = (合計無管 * 0.06).ToString();
  833. }
  834. else if (description == "管理費 7%")
  835. {
  836. 報價內容[i][6] = (合計無管 * 0.07).ToString();
  837. }
  838. else if (description == "管理費 8%")
  839. {
  840. 報價內容[i][6] = (合計無管 * 0.08).ToString();
  841. }
  842. else if (description == "管理費 9%")
  843. {
  844. 報價內容[i][6] = (合計無管 * 0.09).ToString();
  845. }
  846. else if (description == "管理費 10%")
  847. {
  848. 報價內容[i][6] = (合計無管 * 0.1).ToString();
  849. }
  850. if (報價內容[i][1].ToString().Trim('"') != "*" &&
  851. 報價內容[i][1].ToString().Trim('"') != "$" &&
  852. 報價內容[i][1].ToString().Trim('"') != "@")
  853. {
  854. double amount = double.Parse(報價內容[i][6]);
  855. 合計 +=amount;
  856. }
  857. if (報價內容[i][2].ToString().Trim('"') == "小計(未稅) Subtotal(Excluding Tax)")
  858. {
  859. 報價內容[i][6] = 合計.ToString();
  860. }
  861. if (報價內容[i][2].ToString().Trim('"') == "稅金 10% Tax")
  862. {
  863. 稅金=合計 * 0.1;
  864. 報價內容[i][6] = 稅金.ToString();
  865. }
  866. else if (報價內容[i][2].ToString().Trim('"') == "稅金 11% Tax")
  867. {
  868. 稅金=合計 * 0.11;
  869. 報價內容[i][6] = 稅金.ToString();
  870. }
  871. string trimmedString = 報價內容[i][2].ToString().Trim('"');
  872. if (trimmedString.Length >= 2)
  873. {
  874. if (報價內容[i][2].ToString().Trim('"').Substring(0, 2) == "總計")
  875. {
  876. long ttt = (long)(合計 + Math.Floor(稅金));
  877. long lastThreeDigits = ttt % 1000;
  878. if (lastThreeDigits == 1)
  879. {
  880. ttt -= 1;
  881. }
  882. else if (lastThreeDigits == 999)
  883. {
  884. ttt += 1;
  885. }
  886. 報價內容[i][6] = ttt.ToString();
  887. }
  888. }
  889. }
  890. double 折讓 = 0;
  891. double 未折 = 0;
  892. double 小計 = 0;
  893. for (int i = 0; i < 報價內容.Count; i++)
  894. {
  895. if (報價內容[i][1].ToString().Trim('"') == "*" ||
  896. 報價內容[i][1].ToString().Trim('"') == "@" ||
  897. 報價內容[i][1].ToString().Trim('"') == "$" ||
  898. 報價內容[i][2].ToString().Trim('"') == "折讓 Discount")
  899. {
  900. }
  901. else
  902. {
  903. double amount = double.Parse(報價內容[i][6]);
  904. 未折+=amount;
  905. }
  906. if (報價內容[i][1].ToString().Trim('"') == "*" ||
  907. 報價內容[i][1].ToString().Trim('"') == "@" ||
  908. 報價內容[i][1].ToString().Trim('"') == "$")
  909. {
  910. }
  911. else
  912. {
  913. double amount = double.Parse(報價內容[i][6]);
  914. 小計+=amount;
  915. }
  916. }
  917. long total = (long)Math.Round(未折);
  918. long total1 = (long)Math.Round(小計);
  919. 未折價前_錢.text=total.ToString("#,##0");
  920. 報價小計_錢.text=total1.ToString("#,##0");
  921. if (copy3 != null)
  922. {
  923. DeleteCopies(copy3);
  924. }
  925. int sum1 = 2;
  926. for (int i = 0; i < 報價內容.Count; i++)
  927. {
  928. GameObject buttonObj = Instantiate(buttonPrefab3) as GameObject;
  929. buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, -sum1);
  930. buttonObj.transform.SetParent(buttonParent3, false);
  931. TextMeshProUGUI[] text = buttonObj.GetComponentsInChildren<TextMeshProUGUI>();
  932. text[0].text =報價內容[i][1].ToString().Trim('"');
  933. string jsonString = 報價內容[i][2].ToString().Trim('"');
  934. string unescapedString = Regex.Unescape(jsonString);
  935. text[1].text =unescapedString;
  936. text[0].text =報價內容[i][3].ToString().Trim('"');
  937. SetTextValue(text[3], 報價內容[i][4], true);
  938. SetTextValue(text[4], 報價內容[i][5], true);
  939. SetTextValue(text[5], 報價內容[i][6], true);
  940. text[6].text =報價內容[i][7].ToString().Trim('"');
  941. sum1+=75;
  942. copy3.Add(buttonObj);
  943. }
  944. buttonceneter3.GetComponent<RectTransform>().sizeDelta = new Vector2(buttonceneter3.GetComponent<RectTransform>().sizeDelta.x, sum1);
  945. }
  946. public void 上一頁_click()
  947. {
  948. 上一頁.SetActive(false);
  949. 下一頁.SetActive(true);
  950. 明細下一頁.SetActive(false);
  951. 明細上一頁.SetActive(false);
  952. 面板_建立.SetActive(true);
  953. 面板_明細.SetActive(false);
  954. }
  955. public void 下一頁_click()
  956. {
  957. 上一頁.SetActive(true);
  958. 下一頁.SetActive(false);
  959. 明細下一頁.SetActive(true);
  960. 明細上一頁.SetActive(true);
  961. 面板_明細.SetActive(true);
  962. 面板_建立.SetActive(false);
  963. }
  964. public void 左按鈕()
  965. {
  966. nd--;
  967. if (nd==0)
  968. {
  969. 左.SetActive(false);
  970. }
  971. else
  972. {
  973. 左.SetActive(true);
  974. }
  975. if (nd==合約清單.Count-1)
  976. {
  977. 右.SetActive(false);
  978. }
  979. else
  980. {
  981. 右.SetActive(true);
  982. }
  983. 合約編號s.text="";
  984. 客戶名稱s.text="";
  985. 負責人s.text="";
  986. 工程地點s.text="";
  987. 地址s.text="";
  988. 工程名稱s.text="";
  989. 公司名稱s.text="";
  990. 負責人1s.text="";
  991. 地址1s.text="";
  992. 面板_建立.SetActive(true);
  993. 面板_明細.SetActive(false);
  994. 面板_利潤.SetActive(false);
  995. 面板_利潤表頭.SetActive(false);
  996. 報價.SetActive(false);
  997. image_row.SetActive(false);
  998. 上一頁.SetActive(false);
  999. 下一頁.SetActive(true);
  1000. 明細下一頁.SetActive(false);
  1001. 明細上一頁.SetActive(false);
  1002. currentPage=0;
  1003. StartCoroutine(合約內容清單());
  1004. }
  1005. public void 重新整理()
  1006. {
  1007. 合約編號s.text="";
  1008. 客戶名稱s.text="";
  1009. 負責人s.text="";
  1010. 工程地點s.text="";
  1011. 地址s.text="";
  1012. 工程名稱s.text="";
  1013. 公司名稱s.text="";
  1014. 負責人1s.text="";
  1015. 地址1s.text="";
  1016. 面板_建立.SetActive(true);
  1017. 面板_明細.SetActive(false);
  1018. 面板_利潤.SetActive(false);
  1019. 面板_利潤表頭.SetActive(false);
  1020. 報價.SetActive(false);
  1021. image_row.SetActive(false);
  1022. 上一頁.SetActive(false);
  1023. 下一頁.SetActive(true);
  1024. 明細下一頁.SetActive(false);
  1025. 明細上一頁.SetActive(false);
  1026. currentPage=0;
  1027. StartCoroutine(合約內容清單());
  1028. }
  1029. public void 右按鈕()
  1030. {
  1031. nd++;
  1032. if (nd==合約清單.Count-1)
  1033. {
  1034. 右.SetActive(false);
  1035. }
  1036. else
  1037. {
  1038. 右.SetActive(true);
  1039. }
  1040. if (nd==0)
  1041. {
  1042. 左.SetActive(false);
  1043. }
  1044. else
  1045. {
  1046. 左.SetActive(true);
  1047. }
  1048. 合約編號s.text="";
  1049. 客戶名稱s.text="";
  1050. 負責人s.text="";
  1051. 工程地點s.text="";
  1052. 地址s.text="";
  1053. 工程名稱s.text="";
  1054. 公司名稱s.text="";
  1055. 負責人1s.text="";
  1056. 地址1s.text="";
  1057. 面板_建立.SetActive(true);
  1058. 面板_明細.SetActive(false);
  1059. 面板_利潤.SetActive(false);
  1060. 面板_利潤表頭.SetActive(false);
  1061. 報價.SetActive(false);
  1062. image_row.SetActive(false);
  1063. 上一頁.SetActive(false);
  1064. 下一頁.SetActive(true);
  1065. 明細下一頁.SetActive(false);
  1066. 明細上一頁.SetActive(false);
  1067. currentPage=0;
  1068. StartCoroutine(合約內容清單());
  1069. }
  1070. IEnumerator AnimateText()
  1071. {
  1072. string qqq = 讀取.text.ToString();
  1073. while (true)
  1074. {
  1075. yield return new WaitForSeconds(0.5f);
  1076. if (dotCount < 3)
  1077. {
  1078. loadingText += ".";
  1079. dotCount++;
  1080. }
  1081. else
  1082. {
  1083. loadingText = "";
  1084. dotCount = 0;
  1085. }
  1086. 讀取.text = qqq+loadingText;
  1087. }
  1088. }
  1089. void Update()
  1090. {
  1091. timer += Time.deltaTime;
  1092. // 判斷是否達到時間間隔
  1093. if (timer >= interval)
  1094. {
  1095. StartCoroutine(判斷更新());
  1096. timer = 0f;
  1097. }
  1098. if (Main.Global.快速登入==false)
  1099. {
  1100. if (Input.anyKeyDown)
  1101. {
  1102. timeSinceLastInteraction = 0f;
  1103. }
  1104. else
  1105. {
  1106. timeSinceLastInteraction += Time.deltaTime;
  1107. if (timeSinceLastInteraction > idleTime)
  1108. {
  1109. change_Secen(1);
  1110. }
  1111. }
  1112. }
  1113. }
  1114. IEnumerator 判斷更新()
  1115. {
  1116. string strcon = "更新";
  1117. string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}", strcon);
  1118. UnityWebRequest request = UnityWebRequest.Get(strUrl);
  1119. yield return request.SendWebRequest();
  1120. if (request.result == UnityWebRequest.Result.ConnectionError)
  1121. {
  1122. yield break;
  1123. }
  1124. string str = request.downloadHandler.text.ToString();
  1125. Debug.Log(str);
  1126. if (str == "系統更新")
  1127. {
  1128. change_Secen(1);
  1129. }
  1130. }
  1131. public void 調整係數_存檔()
  1132. {
  1133. 讀取面板.SetActive(true);
  1134. Debug.Log(報價係數);
  1135. Debug.Log(初始係數);
  1136. for (int i = 0; i < 報價係數.Count; i++)
  1137. {
  1138. for (int ii = 0; ii < 初始係數.Count; ii++)
  1139. {
  1140. if (報價係數[i][2]==初始係數[ii][2])
  1141. {
  1142. if(報價係數[i][3] !=初始係數[ii][3])
  1143. {
  1144. string str = 報價係數[i][3].ToString().Trim('"');
  1145. string str2 = 報價係數[i][1].ToString().Trim('"');
  1146. StartCoroutine(合約係數修改(str, str2));
  1147. 初始係數[ii][3] = str;
  1148. }
  1149. }
  1150. }
  1151. }
  1152. Debug.Log(報價係數);
  1153. Debug.Log(初始係數);
  1154. 明細自動計算();
  1155. 總表自動計算();
  1156. 調整係數頁面.SetActive(false);
  1157. 讀取面板.SetActive(false);
  1158. }
  1159. IEnumerator 合約係數修改(string pa1, string pa4)
  1160. {
  1161. string strcon1 = "合約係數修改";
  1162. string se = Main.Global.預設伺服器路徑;
  1163. string pa3 = 合約編號s.text;
  1164. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA1={2}&PA3={3}&PA4={4}", strcon1, se, pa1, pa3, pa4);
  1165. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1166. yield return request1.SendWebRequest();
  1167. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1168. {
  1169. Debug.Log(request1.error);
  1170. yield break;
  1171. }
  1172. Debug.Log(request1.downloadHandler.text);
  1173. }
  1174. public void 縮放_click()
  1175. {
  1176. image_row.SetActive(!image_row.activeSelf);
  1177. 報價.SetActive(false);
  1178. }
  1179. public void 調整係數_click()
  1180. {
  1181. 調整係數頁面.SetActive(true);
  1182. }
  1183. public void 調整係數關閉_click()
  1184. {
  1185. 調整係數頁面.SetActive(false);
  1186. }
  1187. public void 總價_click()
  1188. {
  1189. 報價.SetActive(!報價.activeSelf);
  1190. image_row.SetActive(false);
  1191. }
  1192. public void 利潤_click()
  1193. {
  1194. 面板_利潤.SetActive(!面板_利潤.activeSelf);
  1195. 面板_利潤表頭.SetActive(!面板_利潤表頭.activeSelf);
  1196. }
  1197. public void change_Secen(int _screenNum)
  1198. {
  1199. SceneManager.LoadScene(_screenNum);
  1200. }
  1201. public void 審核_click()
  1202. {
  1203. 彈跳面板.SetActive(true);
  1204. 彈跳文字.text="是否放行";
  1205. 彈跳叉.gameObject.SetActive(false);
  1206. 是.gameObject.SetActive(true);
  1207. 否.gameObject.SetActive(true);
  1208. 是.onClick.RemoveAllListeners();
  1209. 否.onClick.RemoveAllListeners();
  1210. 是.onClick.AddListener(審核是);
  1211. 否.onClick.AddListener(兩者否);
  1212. }
  1213. public void 作廢_click()
  1214. {
  1215. 彈跳面板.SetActive(true);
  1216. 彈跳文字.text="是否作廢";
  1217. 彈跳叉.gameObject.SetActive(false);
  1218. 是.gameObject.SetActive(true);
  1219. 否.gameObject.SetActive(true);
  1220. 是.onClick.RemoveAllListeners();
  1221. 否.onClick.RemoveAllListeners();
  1222. 是.onClick.AddListener(作廢是);
  1223. 否.onClick.AddListener(兩者否);
  1224. }
  1225. private void 審核是()
  1226. {
  1227. StartCoroutine(報價放行());
  1228. 彈跳叉.gameObject.SetActive(true);
  1229. 是.gameObject.SetActive(false);
  1230. 否.gameObject.SetActive(false);
  1231. 彈跳文字.text="放行成功";
  1232. }
  1233. private void 作廢是()
  1234. {
  1235. StartCoroutine(報價作廢());
  1236. 彈跳叉.gameObject.SetActive(true);
  1237. 是.gameObject.SetActive(false);
  1238. 否.gameObject.SetActive(false);
  1239. 彈跳文字.text="作廢成功";
  1240. }
  1241. public void 兩者否()
  1242. {
  1243. 彈跳叉.gameObject.SetActive(false);
  1244. 是.gameObject.SetActive(false);
  1245. 否.gameObject.SetActive(false);
  1246. 彈跳面板.SetActive(false);
  1247. 彈跳文字.text="";
  1248. }
  1249. IEnumerator 報價作廢()
  1250. {
  1251. string strcon1 = "報價作廢";
  1252. string se = Main.Global.預設伺服器路徑;
  1253. string pa = 合約編號s.text;
  1254. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&編號={2}", strcon1, se, pa);
  1255. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1256. yield return request1.SendWebRequest();
  1257. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1258. {
  1259. Debug.Log(request1.error);
  1260. yield break;
  1261. }
  1262. yield return StartCoroutine(審核清單());
  1263. }
  1264. IEnumerator 報價放行()
  1265. {
  1266. string strcon1 = "報價放行";
  1267. string se = Main.Global.預設伺服器路徑;
  1268. string pa = 合約編號s.text;
  1269. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&編號={2}", strcon1, se, pa);
  1270. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1271. yield return request1.SendWebRequest();
  1272. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1273. {
  1274. Debug.Log(request1.error);
  1275. yield break;
  1276. }
  1277. for (int i = 0; i < 報價係數.Count; i++)
  1278. {
  1279. for (int ii = 0; ii < 初始係數.Count; ii++)
  1280. {
  1281. if (報價係數[i][2]==初始係數[ii][2])
  1282. {
  1283. if (報價係數[i][3] !=初始係數[ii][3])
  1284. {
  1285. string str = 報價係數[i][3].ToString().Trim('"');
  1286. string str2 = 報價係數[i][1].ToString().Trim('"');
  1287. yield return StartCoroutine(合約係數修改(str, str2));
  1288. }
  1289. }
  1290. }
  1291. }
  1292. yield return StartCoroutine(審核清單());
  1293. }
  1294. public void exit_click()
  1295. {
  1296. change_Secen(3);
  1297. }
  1298. public void setting_exit()
  1299. {
  1300. 選擇面板.SetActive(false);
  1301. }
  1302. public void setting_click()
  1303. {
  1304. 選擇面板.SetActive(true);
  1305. }
  1306. public void 網頁(RectTransform panelRectTransform, float scale, float xbar, float ybar)
  1307. {
  1308. var webViewGameObject = new GameObject("UniWebView");
  1309. webView = webViewGameObject.AddComponent<UniWebView>();
  1310. webView.Frame =new Rect(panelRectTransform.anchoredPosition.x*scale+xbar, (-panelRectTransform.anchoredPosition.y*scale)+ybar, panelRectTransform.sizeDelta.x*scale, panelRectTransform.sizeDelta.y*scale);
  1311. if (Main.Global.系統語言=="繁體中文" || Main.Global.系統語言=="簡體中文")
  1312. {
  1313. webView.Load("https://gcm-smart.com/2024/01/17/hx-pgs-erp-app-51/");
  1314. }
  1315. else
  1316. {
  1317. webView.Load("https://gcm-smart.com/2024/01/17/hx-pgs-erp-app-52/");
  1318. }
  1319. StartCoroutine(說明顯示查詢());
  1320. //webView.Show();
  1321. }
  1322. IEnumerator 說明顯示查詢()
  1323. {
  1324. string strcon1 = "說明顯示查詢";
  1325. string se = Main.Global.預設伺服器路徑;
  1326. string pb1 = Main.Global.人員;
  1327. string pb2 = "APP-51-52";
  1328. DateTime currentDate = DateTime.Now;
  1329. int year = currentDate.Year;
  1330. string ys = year.ToString();
  1331. int month = currentDate.Month;
  1332. string ms = "";
  1333. if (month < 10)
  1334. {
  1335. ms = "0"+month.ToString();
  1336. }
  1337. else
  1338. {
  1339. ms = month.ToString();
  1340. }
  1341. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PB1={2}&PB2={3}&PB5={4}&PB6={5}", strcon1, se, pb1, pb2, ys, ms);
  1342. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1343. yield return request1.SendWebRequest();
  1344. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1345. {
  1346. //Debug.Log(request.error);
  1347. yield break;
  1348. }
  1349. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  1350. int 開啟, 公告;
  1351. bool 是否新增 = false;
  1352. if (json.Count>0)
  1353. {
  1354. float floatValue = float.Parse(json[2].ToString().Trim('"'));
  1355. 開啟 = Mathf.RoundToInt(floatValue);
  1356. float floatValue1 = float.Parse(json[3].ToString().Trim('"'));
  1357. 公告 = Mathf.RoundToInt(floatValue1);
  1358. if (開啟<3)
  1359. {
  1360. 網頁面板.SetActive(true);
  1361. webView.Show();
  1362. 開啟+=1;
  1363. 公告+=1;
  1364. }
  1365. else
  1366. {
  1367. 開啟+=1;
  1368. }
  1369. }
  1370. else
  1371. {
  1372. 網頁面板.SetActive(true);
  1373. webView.Show();
  1374. 開啟 = 1;
  1375. 公告 = 1;
  1376. 是否新增 = true;
  1377. }
  1378. if (是否新增==true)
  1379. {
  1380. yield return StartCoroutine(說明顯示新增(開啟, 公告));
  1381. }
  1382. else
  1383. {
  1384. yield return StartCoroutine(說明顯示修改(開啟, 公告));
  1385. }
  1386. }
  1387. IEnumerator 說明顯示新增(int a1, int a2)
  1388. {
  1389. string strcon1 = "說明顯示新增";
  1390. string se = Main.Global.預設伺服器路徑;
  1391. string pb1 = Main.Global.人員;
  1392. string pb2 = "APP-51-52";
  1393. string pb3 = a1.ToString();
  1394. string pb4 = a2.ToString();
  1395. DateTime currentDate = DateTime.Now;
  1396. int year = currentDate.Year;
  1397. string ys = year.ToString();
  1398. int month = currentDate.Month;
  1399. string ms = "";
  1400. if (month < 10)
  1401. {
  1402. ms = "0"+month.ToString();
  1403. }
  1404. else
  1405. {
  1406. ms = month.ToString();
  1407. }
  1408. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PB1={2}&PB2={3}&PB3={4}&PB4={5}&PB5={6}&PB6={7}", strcon1, se, pb1, pb2, pb3, pb4, ys, ms);
  1409. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1410. yield return request1.SendWebRequest();
  1411. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1412. {
  1413. //Debug.Log(request.error);
  1414. yield break;
  1415. }
  1416. }
  1417. IEnumerator 說明顯示修改(int a1, int a2)
  1418. {
  1419. string strcon1 = "說明顯示修改";
  1420. string se = Main.Global.預設伺服器路徑;
  1421. string pb1 = Main.Global.人員;
  1422. string pb2 = "APP-51-52";
  1423. string pb3 = a1.ToString();
  1424. string pb4 = a2.ToString();
  1425. DateTime currentDate = DateTime.Now;
  1426. int year = currentDate.Year;
  1427. string ys = year.ToString();
  1428. int month = currentDate.Month;
  1429. string ms = "";
  1430. if (month < 10)
  1431. {
  1432. ms = "0"+month.ToString();
  1433. }
  1434. else
  1435. {
  1436. ms = month.ToString();
  1437. }
  1438. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PB1={2}&PB2={3}&PB3={4}&PB4={5}&PB5={6}&PB6={7}", strcon1, se, pb1, pb2, pb3, pb4, ys, ms);
  1439. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1440. yield return request1.SendWebRequest();
  1441. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1442. {
  1443. //Debug.Log(request.error);
  1444. yield break;
  1445. }
  1446. }
  1447. public void 網頁面板關閉()
  1448. {
  1449. 網頁面板.SetActive(false);
  1450. webView.Hide();
  1451. }
  1452. public void 網頁面板開啟()
  1453. {
  1454. 網頁面板.SetActive(true);
  1455. webView.Show();
  1456. }
  1457. public void setting_中()
  1458. {
  1459. Main.Global.系統語言="繁體中文";
  1460. 系統語言轉換();
  1461. 語言選擇按鈕();
  1462. 選擇面板.SetActive(false);
  1463. webView.Load("https://gcm-smart.com/2024/01/17/hx-pgs-erp-app-51/");
  1464. }
  1465. public void setting_簡()
  1466. {
  1467. Main.Global.系統語言="簡體中文";
  1468. 系統語言轉換();
  1469. 語言選擇按鈕();
  1470. 選擇面板.SetActive(false);
  1471. webView.Load("https://gcm-smart.com/2024/01/17/hx-pgs-erp-app-51/");
  1472. }
  1473. public void setting_英()
  1474. {
  1475. Main.Global.系統語言="English";
  1476. 系統語言轉換();
  1477. 語言選擇按鈕();
  1478. 選擇面板.SetActive(false);
  1479. webView.Load("https://gcm-smart.com/2024/01/17/hx-pgs-erp-app-52/");
  1480. }
  1481. public void setting_印()
  1482. {
  1483. Main.Global.系統語言="Indonesian";
  1484. 系統語言轉換();
  1485. 語言選擇按鈕();
  1486. 選擇面板.SetActive(false);
  1487. webView.Load("https://gcm-smart.com/2024/01/17/hx-pgs-erp-app-52/");
  1488. }
  1489. public void 語言選擇按鈕()
  1490. {
  1491. if (bts == null)
  1492. {
  1493. if (Main.Global.系統語言=="繁體中文")
  1494. {
  1495. bts = new Button[] { 簡按鈕, 英按鈕, 印按鈕, 中按鈕 };
  1496. }
  1497. else if (Main.Global.系統語言=="簡體中文")
  1498. {
  1499. bts = new Button[] { 中按鈕, 英按鈕, 印按鈕, 簡按鈕 };
  1500. }
  1501. else if (Main.Global.系統語言=="English")
  1502. {
  1503. bts = new Button[] { 中按鈕, 簡按鈕, 印按鈕, 英按鈕 };
  1504. }
  1505. else
  1506. {
  1507. bts = new Button[] { 中按鈕, 簡按鈕, 英按鈕, 印按鈕 };
  1508. }
  1509. }
  1510. else
  1511. {
  1512. for (int j = 0; j < bts.Length; j++)
  1513. {
  1514. bts[j] = null;
  1515. }
  1516. if (Main.Global.系統語言=="繁體中文")
  1517. {
  1518. bts = new Button[] { 簡按鈕, 英按鈕, 印按鈕, 中按鈕 };
  1519. }
  1520. else if (Main.Global.系統語言=="簡體中文")
  1521. {
  1522. bts = new Button[] { 中按鈕, 英按鈕, 印按鈕, 簡按鈕 };
  1523. }
  1524. else if (Main.Global.系統語言=="English")
  1525. {
  1526. bts = new Button[] { 中按鈕, 簡按鈕, 印按鈕, 英按鈕 };
  1527. }
  1528. else
  1529. {
  1530. bts = new Button[] { 中按鈕, 簡按鈕, 英按鈕, 印按鈕 };
  1531. }
  1532. }
  1533. for (int i = 0; i < bts.Length; i++)
  1534. {
  1535. RectTransform rectTransform = bts[i].GetComponent<RectTransform>();
  1536. if (i==3)
  1537. {
  1538. rectTransform.anchoredPosition = new Vector2(1200, 1200);
  1539. }
  1540. else
  1541. {
  1542. rectTransform.anchoredPosition = new Vector2(300*i, 0);
  1543. }
  1544. }
  1545. }
  1546. private void 系統語言轉換()
  1547. {
  1548. string 介面 = "H04";
  1549. if (Main.Global.系統語言=="繁體中文")
  1550. {
  1551. 標題.text = Main.Global.系統語言字典[介面+"00CH"];
  1552. 合約編號.text = Main.Global.系統語言字典[介面+"04CH"];
  1553. 客戶名稱.text = Main.Global.系統語言字典[介面+"05CH"];
  1554. 負責人.text = Main.Global.系統語言字典[介面+"06CH"];
  1555. 負責人1.text = Main.Global.系統語言字典[介面+"06CH"];
  1556. 工程地點.text = Main.Global.系統語言字典[介面+"07CH"];
  1557. 地址.text = Main.Global.系統語言字典[介面+"08CH"];
  1558. 地址1.text = Main.Global.系統語言字典[介面+"08CH"];
  1559. 工程名稱.text = Main.Global.系統語言字典[介面+"09CH"];
  1560. 公司名稱.text = Main.Global.系統語言字典[介面+"10CH"];
  1561. 中.text = Main.Global.系統語言字典[介面+"11CH"];
  1562. 英.text = Main.Global.系統語言字典[介面+"12CH"];
  1563. 印.text = Main.Global.系統語言字典[介面+"13CH"];
  1564. 簡.text = Main.Global.系統語言字典[介面+"29CH"];
  1565. 選擇語言.text = Main.Global.系統語言字典[介面+"14CH"];
  1566. 未折價前.text = Main.Global.系統語言字典[介面+"15CH"];
  1567. 報價小計.text = Main.Global.系統語言字典[介面+"16CH"];
  1568. 預估工資總成本.text = Main.Global.系統語言字典[介面+"17CH"];
  1569. 預估材料總成本.text = Main.Global.系統語言字典[介面+"18CH"];
  1570. 總成本.text = Main.Global.系統語言字典[介面+"19CH"];
  1571. 總成本1.text = Main.Global.系統語言字典[介面+"19CH"];
  1572. 預估工資總報價.text = Main.Global.系統語言字典[介面+"20CH"];
  1573. 預估材料總報價.text = Main.Global.系統語言字典[介面+"21CH"];
  1574. 總報價.text = Main.Global.系統語言字典[介面+"22CH"];
  1575. 總報價1.text = Main.Global.系統語言字典[介面+"22CH"];
  1576. 利潤比.text = Main.Global.系統語言字典[介面+"23CH"];
  1577. 利潤比1.text = Main.Global.系統語言字典[介面+"23CH"];
  1578. 利潤比2.text = Main.Global.系統語言字典[介面+"24CH"];
  1579. 利潤比3.text = Main.Global.系統語言字典[介面+"25CH"];
  1580. 預估利潤.text = Main.Global.系統語言字典[介面+"26CH"];
  1581. 折讓金額.text = Main.Global.系統語言字典[介面+"27CH"];
  1582. }
  1583. else if (Main.Global.系統語言=="簡體中文")
  1584. {
  1585. 標題.text = Main.Global.系統語言字典[介面+"00CS"];
  1586. 合約編號.text = Main.Global.系統語言字典[介面+"04CS"];
  1587. 客戶名稱.text = Main.Global.系統語言字典[介面+"05CS"];
  1588. 負責人.text = Main.Global.系統語言字典[介面+"06CS"];
  1589. 負責人1.text = Main.Global.系統語言字典[介面+"06CS"];
  1590. 工程地點.text = Main.Global.系統語言字典[介面+"07CS"];
  1591. 地址.text = Main.Global.系統語言字典[介面+"08CS"];
  1592. 地址1.text = Main.Global.系統語言字典[介面+"08CS"];
  1593. 工程名稱.text = Main.Global.系統語言字典[介面+"09CS"];
  1594. 公司名稱.text = Main.Global.系統語言字典[介面+"10CS"];
  1595. 中.text = Main.Global.系統語言字典[介面+"11CS"];
  1596. 英.text = Main.Global.系統語言字典[介面+"12CS"];
  1597. 印.text = Main.Global.系統語言字典[介面+"13CS"];
  1598. 簡.text = Main.Global.系統語言字典[介面+"29CS"];
  1599. 選擇語言.text = Main.Global.系統語言字典[介面+"14CS"];
  1600. 未折價前.text = Main.Global.系統語言字典[介面+"15CS"];
  1601. 報價小計.text = Main.Global.系統語言字典[介面+"16CS"];
  1602. 預估工資總成本.text = Main.Global.系統語言字典[介面+"17CS"];
  1603. 預估材料總成本.text = Main.Global.系統語言字典[介面+"18CS"];
  1604. 總成本.text = Main.Global.系統語言字典[介面+"19CS"];
  1605. 總成本1.text = Main.Global.系統語言字典[介面+"19CS"];
  1606. 預估工資總報價.text = Main.Global.系統語言字典[介面+"20CS"];
  1607. 預估材料總報價.text = Main.Global.系統語言字典[介面+"21CS"];
  1608. 總報價.text = Main.Global.系統語言字典[介面+"22CS"];
  1609. 總報價1.text = Main.Global.系統語言字典[介面+"22CS"];
  1610. 利潤比.text = Main.Global.系統語言字典[介面+"23CS"];
  1611. 利潤比1.text = Main.Global.系統語言字典[介面+"23CS"];
  1612. 利潤比2.text = Main.Global.系統語言字典[介面+"24CS"];
  1613. 利潤比3.text = Main.Global.系統語言字典[介面+"25CS"];
  1614. 預估利潤.text = Main.Global.系統語言字典[介面+"26CS"];
  1615. 折讓金額.text = Main.Global.系統語言字典[介面+"27CS"];
  1616. }
  1617. else if (Main.Global.系統語言=="English")
  1618. {
  1619. 標題.text = Main.Global.系統語言字典[介面+"00EN"];
  1620. 合約編號.text = Main.Global.系統語言字典[介面+"04EN"];
  1621. 客戶名稱.text = Main.Global.系統語言字典[介面+"05EN"];
  1622. 負責人.text = Main.Global.系統語言字典[介面+"06EN"];
  1623. 負責人1.text = Main.Global.系統語言字典[介面+"06EN"];
  1624. 工程地點.text = Main.Global.系統語言字典[介面+"07EN"];
  1625. 地址.text = Main.Global.系統語言字典[介面+"08EN"];
  1626. 地址1.text = Main.Global.系統語言字典[介面+"08EN"];
  1627. 工程名稱.text = Main.Global.系統語言字典[介面+"09EN"];
  1628. 公司名稱.text = Main.Global.系統語言字典[介面+"10EN"];
  1629. 中.text = Main.Global.系統語言字典[介面+"11EN"];
  1630. 英.text = Main.Global.系統語言字典[介面+"12EN"];
  1631. 印.text = Main.Global.系統語言字典[介面+"13EN"];
  1632. 簡.text = Main.Global.系統語言字典[介面+"29EN"];
  1633. 選擇語言.text = Main.Global.系統語言字典[介面+"14EN"];
  1634. 未折價前.text = Main.Global.系統語言字典[介面+"15EN"];
  1635. 報價小計.text = Main.Global.系統語言字典[介面+"16EN"];
  1636. 預估工資總成本.text = Main.Global.系統語言字典[介面+"17EN"];
  1637. 預估材料總成本.text = Main.Global.系統語言字典[介面+"18EN"];
  1638. 總成本.text = Main.Global.系統語言字典[介面+"19EN"];
  1639. 總成本1.text = Main.Global.系統語言字典[介面+"19EN"];
  1640. 預估工資總報價.text = Main.Global.系統語言字典[介面+"20EN"];
  1641. 預估材料總報價.text = Main.Global.系統語言字典[介面+"21EN"];
  1642. 總報價.text = Main.Global.系統語言字典[介面+"22EN"];
  1643. 總報價1.text = Main.Global.系統語言字典[介面+"22EN"];
  1644. 利潤比.text = Main.Global.系統語言字典[介面+"23EN"];
  1645. 利潤比1.text = Main.Global.系統語言字典[介面+"23EN"];
  1646. 利潤比2.text = Main.Global.系統語言字典[介面+"24EN"];
  1647. 利潤比3.text = Main.Global.系統語言字典[介面+"25EN"];
  1648. 預估利潤.text = Main.Global.系統語言字典[介面+"26EN"];
  1649. 折讓金額.text = Main.Global.系統語言字典[介面+"27EN"];
  1650. }
  1651. else
  1652. {
  1653. 標題.text = Main.Global.系統語言字典[介面+"00ID"];
  1654. 合約編號.text = Main.Global.系統語言字典[介面+"04ID"];
  1655. 客戶名稱.text = Main.Global.系統語言字典[介面+"05ID"];
  1656. 負責人.text = Main.Global.系統語言字典[介面+"06ID"];
  1657. 負責人1.text = Main.Global.系統語言字典[介面+"06ID"];
  1658. 工程地點.text = Main.Global.系統語言字典[介面+"07ID"];
  1659. 地址.text = Main.Global.系統語言字典[介面+"08ID"];
  1660. 地址1.text = Main.Global.系統語言字典[介面+"08ID"];
  1661. 工程名稱.text = Main.Global.系統語言字典[介面+"09ID"];
  1662. 公司名稱.text = Main.Global.系統語言字典[介面+"10ID"];
  1663. 中.text = Main.Global.系統語言字典[介面+"11ID"];
  1664. 英.text = Main.Global.系統語言字典[介面+"12ID"];
  1665. 印.text = Main.Global.系統語言字典[介面+"13ID"];
  1666. 簡.text = Main.Global.系統語言字典[介面+"29ID"];
  1667. 選擇語言.text = Main.Global.系統語言字典[介面+"14ID"];
  1668. 未折價前.text = Main.Global.系統語言字典[介面+"15ID"];
  1669. 報價小計.text = Main.Global.系統語言字典[介面+"16ID"];
  1670. 預估工資總成本.text = Main.Global.系統語言字典[介面+"17ID"];
  1671. 預估材料總成本.text = Main.Global.系統語言字典[介面+"18ID"];
  1672. 總成本.text = Main.Global.系統語言字典[介面+"19ID"];
  1673. 總成本1.text = Main.Global.系統語言字典[介面+"19ID"];
  1674. 預估工資總報價.text = Main.Global.系統語言字典[介面+"20ID"];
  1675. 預估材料總報價.text = Main.Global.系統語言字典[介面+"21ID"];
  1676. 總報價.text = Main.Global.系統語言字典[介面+"22ID"];
  1677. 總報價1.text = Main.Global.系統語言字典[介面+"22ID"];
  1678. 利潤比.text = Main.Global.系統語言字典[介面+"23ID"];
  1679. 利潤比1.text = Main.Global.系統語言字典[介面+"23ID"];
  1680. 利潤比2.text = Main.Global.系統語言字典[介面+"24ID"];
  1681. 利潤比3.text = Main.Global.系統語言字典[介面+"25ID"];
  1682. 預估利潤.text = Main.Global.系統語言字典[介面+"26ID"];
  1683. 折讓金額.text = Main.Global.系統語言字典[介面+"27ID"];
  1684. }
  1685. }
  1686. private void 初始化系統語言()
  1687. {
  1688. TextAsset txt = Resources.Load("Tran") as TextAsset;
  1689. Main.Global.系統語言資料=txt.text.Split('\n');
  1690. for (int i = 1; i<=Main.Global.系統語言資料.Length; i++)
  1691. {
  1692. try
  1693. {
  1694. string key = Main.Global.系統語言資料[i].ToString().Substring(0, 3)+Main.Global.系統語言資料[i].ToString().Substring(4, 2)+Main.Global.系統語言資料[i].ToString().Substring(7, 2);
  1695. Main.Global.系統語言字典.Add(key, Main.Global.系統語言資料[i].ToString().Substring(10));
  1696. }
  1697. catch
  1698. {
  1699. // Debug.Log("No data");
  1700. }
  1701. }
  1702. }
  1703. private void DeleteCopies(List<GameObject> copyList)
  1704. {
  1705. foreach (GameObject copy in copyList)
  1706. {
  1707. Destroy(copy);
  1708. }
  1709. copyList.Clear();
  1710. }
  1711. }