Nav apraksta
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using NUnit.Framework.Constraints;
  6. using TMPro;
  7. using Unity.Mathematics;
  8. using Unity.VisualScripting;
  9. using System.Text.RegularExpressions;
  10. using UnityEngine;
  11. using UnityEngine.SceneManagement;
  12. using UnityEngine.UI;
  13. using UnityEngine.Video;
  14. using System.Linq;
  15. using System.IO.Compression;
  16. public class Main : MonoBehaviour{
  17. [SerializeField] TextMeshProUGUI 使用者_tb,日期_tb,彈跳文字_tb,報告書流水號_tb,報告書扶手總長_tb,報告書申請人_tb,報告書開立人_tb,提示_tb,圖片讀取_tb,相片目前_tb,相片總數_tb,
  18. 扶手已使用長度_tb,扶手可使用長度_tb,輸入單項扶手總長度_tb,單項扶手長度_tb,扶手總長2_lb,扶手長度_lb,請輸入扶手總長度_lb,扶手總長度_lb,已使用扶手長度_lb,可使用扶手長度_lb,
  19. 扶手長度2_lb,項目清單2_lb,更換照片提示_tb,評估主頁抬頭_tb,報告書人員資料_申請人_tb,報告書人員資料_客編_tb,報告書人員資料_聯繫人_tb,報告書人員資料_聯繫人電話_tb,
  20. 報告書人員資料_地址_tb,報告書人員資料_聯繫人2_tb,報告書人員資料_聯繫人2電話_tb,報告書項目清單_報告書號_tb,報告書新增客編_tb,相關文件相片總數_tb,相關文件相片目前_tb,
  21. 施作圖片相片總數_tb,施作圖片相片目前_tb,施作圖片相片文件號_tb,文件圖片相片文件號_tb,施工前_tb,施工後_tb;
  22. [SerializeField] GameObject 背景_pl,首頁_pl,系統設定_pl,彈跳_pl,評估_pl,表頭_pl,複製體1,複製體2,評估主頁_pl,評估詳細_pl,拍照頁面_pl,評估紀錄_pl,圖片讀取_pl,新建_pl,選擇客戶_pl,
  23. 客戶清單表頭_pl,報告書圖片_pl,新增項目_pl,文件號_sv,項目清單_sv,報告書資料_pl,項目清單_lb,長照類_sv,圖片寬度_pl,頁面高度_pl,扶手總長_lb,扶手總長_tb,輸入扶手長度_pl,
  24. 輸入單項扶手長度_pl,備註_pl,更換照片_pl,報告書_pl,新客戶_pl,小工具_pl,倍瑞菲_pl,系統設定2_pl,主頁_pl,大主頁_pl,查詢_pl, 報告書人員清單_pl,報告書人員資料_pl,表頭2_pl,
  25. 報告書項目清單_pl,報告書新增人員_pl,報告書人員清單_年份_cb,報告書文件圖片讀取_pl,報告書文件圖片寬度_pl,報告書文件圖片_pl,施作項目_lb,施作項目_sv,施作圖片_pl,
  26. 評估報告書1_物料清單_sv,施作圖片圖片讀取_pl,施作圖片圖片寬度_pl;
  27. [SerializeField] GameObject 長照類_bt,身障類_bt,自費類_bt,返回3_bt,發送通知_bt,回選單_bt,新增項目_bt,刪除項目_bt,更換照片資料夾_bt,更換照片文件號_bt,更換照片確認_bt,
  28. 更換照片取消_bt,更換照片拍照確認_bt,核銷文件_bt,更換照片_bt,刪除照片_bt,業務系統_bt,系統設定_bt,施工前_bt,施工後_bt,拍照_bt,回上頁_bt,文件號_bt,返回8_bt,
  29. 長照類_相關文件_bt,長照類_核定通知書_bt,長照類_評估報告書1_bt,長照類_評估報告書2_bt,返回4_bt,長照類_申請人身分證反面_bt,長照類_受託人身分證反面_bt,長照類_所有權人身分證反面_bt,
  30. 長照類_房屋所有權狀_bt,長照類_土地所有權狀_bt,長照類_房屋稅籍證明_bt,長照類_土地稅籍證明_bt,長照類_房屋稅單_bt,長照類_土地稅單_bt,返回5_bt,拍照1_bt,刪除1_bt,存檔1_bt,返回1_bt,
  31. 返回2_bt,返回2_1_bt,查詢1_bt,新增客戶1_bt,長照類_申請人身心障礙證明_bt,拍照_文件號_bt,拍照_施工前_bt,拍照_施工後_bt,拍照_申請人身分證正反面_bt,拍照_委託人身分證正反面_bt,
  32. 拍照_所有權人身分證正反面_bt, 拍照_申請人身心障礙證明正反面_bt,拍照_房屋所有權狀_bt,拍照_土地所有權狀_bt,拍照_房屋稅籍證明_bt,拍照_土地稅籍證明_bt,拍照_房屋稅單_bt,
  33. 拍照_土地稅單_bt,施作項目_新增_bt,施作項目_刪除_bt,返回6_bt,返回7_bt,拍照_評估報告書1_bt,備註_bt,拍照_評估報告書2_bt,長照類_案場1_bt,長照類_案場2_bt,長照類_案場3_bt,
  34. 施作顯示_tb,存檔2_bt,拍照_核定通知書_bt,拍照_案場1_bt,拍照_案場2_bt,拍照_案場3_bt,產品序號_bt;
  35. [SerializeField] Image 施工前_img,施工後_img,產品序號_img;
  36. [SerializeField] TMP_InputField 輸入扶手總長_tb,扶手長度_tb,備註_tb,報告書查詢1_tb,報告書新增申請人_tb,報告書新增住址_tb,報告書新增電話_tb,報告書新增聯繫人_tb,
  37. 報告書新增聯繫人電話_tb,報告書新增聯繫人2_tb,報告書新增聯繫人2電話_tb,施作_tb;
  38. [SerializeField] RawImage 拍照用,放圖用,更換照片放圖用,更換照片拍照用,文件圖片_rawimage,施作圖片_rawimage;
  39. //[SerializeField] GridLayoutGroup gridLayout;
  40. private WebCamTexture myCam;
  41. public TMP_FontAsset myFont;
  42. public Sprite UIsprite;
  43. public Transform 報告書人員清單_tp;public GameObject 報告書人員清單_rpf;public GameObject 報告書人員清單_ct;public GameObject 報告書人員清單_lpf;
  44. public Transform 報告書清單_tp;public GameObject 報告書清單_rpf;public GameObject 報告書清單_ct;public GameObject 報告書清單_lpf;
  45. public Transform 文件號清單_tp;public GameObject 文件號清單_rpf;public GameObject 文件號清單_ct;public GameObject 文件號清單_lpf;
  46. public Transform 報告書項目清單_tp;public GameObject 報告書項目清單_rpf;public GameObject 報告書項目清單_ct;public GameObject 報告書項目清單_lpf;
  47. public Transform 報告書施工圖片_tp;public GameObject 報告書施工圖片_rpf;public GameObject 報告書施工圖片_ct;public GameObject 報告書施工圖片_lpf;
  48. public Transform 客戶清單_tp;public GameObject 客戶清單_rpf;public GameObject 客戶清單_ct;public GameObject 客戶清單_lpf;
  49. public Transform 長照物料清單_tp;public GameObject 長照物料清單_rpf;public GameObject 長照物料清單_ct;public GameObject 長照物料清單_lpf;
  50. public Transform 報告書文件圖片_tp;public GameObject 報告書文件圖片_rpf;public GameObject 報告書文件圖片_ct;public GameObject 報告書文件圖片_lpf;
  51. public Transform 報告書施作項目清單_tp;public GameObject 報告書施作項目清單_rpf;public GameObject 報告書施作項目清單_ct;public GameObject 報告書施作項目清單_lpf;
  52. public Transform 報告書施作圖片_tp;public GameObject 報告書施作圖片_rpf;public GameObject 報告書施作圖片_ct;public GameObject 報告書施作圖片_lpf;
  53. public Transform 報告書施作圖片_物料清單_tp;public GameObject 報告書施作圖片_物料清單_rpf;public GameObject 報告書施作圖片_物料清單_ct;public GameObject 報告書施作圖片_物料清單_lpf;
  54. public SQL_LINE sql_line;
  55. private string loadingText = "";
  56. private int dotCount = 0;
  57. void Start(){
  58. DateTime today = DateTime.Today;
  59. 使用者_tb.text = Global.使用者暱稱;
  60. 日期_tb.text = today.Year.ToString().PadLeft(2,'0')+" 年 "+today.Month.ToString().PadLeft(2,'0')+" 月 "+today.Day.ToString().PadLeft(2,'0')+" 日 "+ GetChineseDayOfWeek(today.DayOfWeek);
  61. Global.複製體1 = 複製體1;Global.複製體2 = 複製體2;
  62. StartCoroutine(AnimateText());
  63. }
  64. void Update(){
  65. }
  66. public void 系統設定2_bt(){
  67. 主頁_pl.SetActive(false);系統設定2_pl.SetActive(true);
  68. }
  69. public void 回主頁_bt(){
  70. 主頁_pl.SetActive(true);系統設定2_pl.SetActive(false);
  71. }
  72. public void 報告書_pl_bt(){
  73. 大主頁_pl.SetActive(false);主頁_pl.SetActive(false);系統設定2_pl.SetActive(false);報告書_pl.SetActive(true);
  74. 評估_pl.SetActive(true);新建_pl.SetActive(false);報告書新增人員_pl.SetActive(false);查詢1_bt.SetActive(true);新增客戶1_bt.SetActive(true);
  75. 報告書人員清單_年份_cb.GetComponent<TMP_Dropdown>().ClearOptions();
  76. List<string> yearList = new();
  77. int currentYear = DateTime.Now.Year;
  78. int defaultIndex = 0;
  79. SQL_Comm.SQL_客戶資料表_年份();
  80. while (SQL_Module.dr.Read()){
  81. string yearStr = SQL_Module.dr["年份"].ToString();
  82. yearList.Add(yearStr);
  83. if (yearStr == currentYear.ToString()) {
  84. defaultIndex = yearList.Count - 1;
  85. }
  86. }
  87. 報告書人員清單_年份_cb.GetComponent<TMP_Dropdown>().AddOptions(yearList);
  88. 報告書人員清單_年份_cb.GetComponent<TMP_Dropdown>().value=defaultIndex;
  89. 報告書人員清單_年份_cb.GetComponent<TMP_Dropdown>().RefreshShownValue();
  90. Set_報告書人員清單("");
  91. }
  92. public void 報告書返回1(){
  93. 大主頁_pl.SetActive(true);主頁_pl.SetActive(false);系統設定2_pl.SetActive(false);報告書_pl.SetActive(false);
  94. }
  95. public void 報告書清單返回1(){
  96. 大主頁_pl.SetActive(true);主頁_pl.SetActive(true);系統設定2_pl.SetActive(false);報告書_pl.SetActive(false);
  97. }
  98. public void 報告書清單返回2(){
  99. 報告書人員清單_pl.SetActive(true);報告書人員資料_pl.SetActive(false);報告書項目清單_pl.SetActive(false);報告書新增人員_pl.SetActive(false);
  100. 返回1_bt.SetActive(true);查詢1_bt.SetActive(true);新增客戶1_bt.SetActive(true);返回2_bt.SetActive(false);返回2_1_bt.SetActive(false);
  101. }
  102. public void 報告書清單返回3(){
  103. 報告書人員清單_pl.SetActive(false);報告書人員資料_pl.SetActive(true);報告書項目清單_pl.SetActive(false);
  104. 返回2_bt.SetActive(true);返回3_bt.SetActive(false);
  105. }
  106. public void 報告書清單返回4(){
  107. 長照類_bt.SetActive(true);身障類_bt.SetActive(true);自費類_bt.SetActive(true);返回3_bt.SetActive(true);
  108. 長照類_核定通知書_bt.SetActive(false);長照類_相關文件_bt.SetActive(false);長照類_評估報告書1_bt.SetActive(false);
  109. 長照類_評估報告書2_bt.SetActive(false);返回4_bt.SetActive(false);
  110. }
  111. public void 報告書清單返回8(){
  112. 長照類_bt.SetActive(true);身障類_bt.SetActive(true);自費類_bt.SetActive(true);返回3_bt.SetActive(true);
  113. 長照類_案場1_bt.SetActive(false);長照類_案場2_bt.SetActive(false);長照類_案場3_bt.SetActive(false);返回8_bt.SetActive(false);
  114. }
  115. public void 報告書清單返回5(){
  116. 長照類_核定通知書_bt.SetActive(true);長照類_相關文件_bt.SetActive(true);長照類_評估報告書1_bt.SetActive(true);
  117. 長照類_評估報告書2_bt.SetActive(true);返回4_bt.SetActive(true);
  118. 長照類_申請人身分證反面_bt.SetActive(false);長照類_受託人身分證反面_bt.SetActive(false);長照類_所有權人身分證反面_bt.SetActive(false);
  119. 長照類_房屋所有權狀_bt.SetActive(false);長照類_土地所有權狀_bt.SetActive(false);長照類_房屋稅籍證明_bt.SetActive(false);長照類_土地稅籍證明_bt.SetActive(false);
  120. 長照類_房屋稅單_bt.SetActive(false);長照類_土地稅單_bt.SetActive(false);返回5_bt.SetActive(false);拍照1_bt.SetActive(false);刪除1_bt.SetActive(false);
  121. 存檔1_bt.SetActive(false);報告書文件圖片_pl.SetActive(false);長照類_申請人身心障礙證明_bt.SetActive(false);
  122. RectTransform rt = 報告書文件圖片_pl.GetComponent<RectTransform>();
  123. rt.offsetMax = new Vector2(rt.offsetMax.x, -706.66f);
  124. }
  125. public void 報告書清單搜尋1(){
  126. 查詢_pl.SetActive(true);報告書查詢1_tb.text="";
  127. }
  128. public void 報告書清單搜尋確認1(){
  129. 查詢_pl.SetActive(false);string 搜尋條件 = " AND (客戶資料表.負責人 LIKE N'%" + 報告書查詢1_tb.text + "%' OR 客戶資料表.聯繫人1 LIKE N'%" + 報告書查詢1_tb.text + "%') ";
  130. Set_報告書人員清單(搜尋條件);
  131. }
  132. public void 主頁新增(){
  133. 大主頁_pl.SetActive(false);主頁_pl.SetActive(false);系統設定2_pl.SetActive(false);報告書_pl.SetActive(true);
  134. 評估_pl.SetActive(true);新建_pl.SetActive(false);
  135. Global.主頁新增=true;
  136. 真新增();
  137. }
  138. private void 真新增(){
  139. 報告書新增人員_pl.SetActive(true);報告書新增客編_tb.text="";報告書新增申請人_tb.text="";報告書新增住址_tb.text="";報告書新增電話_tb.text="";報告書新增聯繫人_tb.text="";
  140. 報告書新增聯繫人電話_tb.text="";
  141. 報告書人員清單_pl.SetActive(false);報告書人員資料_pl.SetActive(true);報告書項目清單_pl.SetActive(false);
  142. 評估主頁抬頭_tb.text = "";報告書人員資料_申請人_tb.text = "";報告書人員資料_客編_tb.text = "";報告書人員資料_聯繫人_tb.text = "";
  143. 報告書人員資料_聯繫人電話_tb.text = "";報告書人員資料_地址_tb.text = "";報告書人員資料_聯繫人2_tb.text="";報告書人員資料_聯繫人2電話_tb.text="";
  144. 返回1_bt.SetActive(false);查詢1_bt.SetActive(false);新增客戶1_bt.SetActive(false);
  145. if(Global.主頁新增){
  146. 返回2_bt.SetActive(false);返回2_1_bt.SetActive(true);
  147. }else{
  148. 返回2_bt.SetActive(true);返回2_1_bt.SetActive(false);
  149. }
  150. string 加盟商代號;
  151. SQL_Comm.SQL_載入供應商代號(Global.gUser區域);
  152. if(SQL_Module.dr.Read()){
  153. 加盟商代號=SQL_Module.dr["加盟商代號"].ToString();
  154. }else{
  155. 加盟商代號 = "CN";
  156. }
  157. SQL_Comm.SQL_客戶資料表_最後一筆資料(Global.gUser區域);
  158. if (SQL_Module.dr.Read()){
  159. 報告書新增客編_tb.text = SQL_Module.dr["流水號"].ToString();
  160. }else{
  161. 報告書新增客編_tb.text = $"{加盟商代號}{DateTime.Today:yyMM}000";
  162. }
  163. string 年份 = DateTime.Today.ToString("yy");
  164. string 月份 = DateTime.Today.ToString("MM");
  165. if (報告書新增客編_tb.text.Length >= 加盟商代號.Length + 4){
  166. if (報告書新增客編_tb.text.Substring(加盟商代號.Length, 2) == 年份 && 報告書新增客編_tb.text.Substring(加盟商代號.Length + 2, 2) == 月份){
  167. string lastThreeDigits = 報告書新增客編_tb.text[^3..];
  168. if (int.TryParse(lastThreeDigits, out int num)){
  169. num += 1;
  170. 報告書新增客編_tb.text = $"{加盟商代號}{年份}{月份}{num:000}";
  171. }else{
  172. 報告書新增客編_tb.text = $"{加盟商代號}{年份}{月份}001";
  173. }
  174. }else{
  175. 報告書新增客編_tb.text = $"{加盟商代號}{年份}{月份}001";
  176. }
  177. }else{
  178. 報告書新增客編_tb.text = $"{加盟商代號}{年份}{月份}001";
  179. }
  180. }
  181. public void 報告書清單新增人員1(){
  182. Global.主頁新增=false;真新增();
  183. }
  184. public void 報告書清單確認新增1(){
  185. 報告書新增人員_pl.SetActive(false);報告書人員資料_客編_tb.text = 報告書新增客編_tb.text;報告書人員資料_申請人_tb.text = 報告書新增申請人_tb.text;
  186. 報告書人員資料_聯繫人_tb.text = 報告書新增聯繫人_tb.text;報告書人員資料_聯繫人電話_tb.text = 報告書新增聯繫人電話_tb.text;報告書人員資料_地址_tb.text = 報告書新增住址_tb.text;
  187. 報告書人員資料_聯繫人2_tb.text = 報告書新增聯繫人2_tb.text;報告書人員資料_聯繫人2電話_tb.text = 報告書新增聯繫人2電話_tb.text;
  188. SQL_Comm.SQL_客戶資料表_新增(報告書人員資料_客編_tb.text,DateTime.Today.ToString("yyyy/MM/dd"),"","",報告書人員資料_地址_tb.text,報告書人員資料_申請人_tb.text,
  189. Global.gUserName,報告書人員資料_聯繫人_tb.text,報告書人員資料_聯繫人電話_tb.text,"","",Global.gUser區域,"","",報告書人員資料_聯繫人2_tb.text,
  190. 報告書人員資料_聯繫人2電話_tb.text,"","","","");
  191. Set_報告書人員清單("");
  192. }
  193. public void 報告書新增報告書(){
  194. double NUM1;string dat1;string 報告書號;string 圖檔資料庫="";
  195. Set_日期格式轉換();
  196. SQL_Comm.SQL_取得加盟商編號(Global.gUser區域);
  197. if(SQL_Module.dr.Read()){
  198. Global.gUser加盟商編號=SQL_Module.dr[0].ToString();
  199. }else{
  200. Global.gUser加盟商編號="未設定加盟商";
  201. }
  202. SQL_Comm.SQL_報告書_查詢流水號(Global.gUser區域);
  203. if(SQL_Module.dr.Read()){
  204. 報告書號 = SQL_Module.dr["流水號"].ToString();
  205. }else{
  206. 報告書號 = "RE" + Global.DTP1[2..] + "00-" + Global.gUser加盟商編號;
  207. }
  208. dat1 = 報告書號.Substring(2, 6);
  209. if(dat1 != Global.DTP1[2..]){
  210. NUM1 = 1;
  211. }else{
  212. NUM1 = double.Parse(報告書號.Substring(8, 2)) + 1;
  213. }
  214. 報告書號 = "RE" + Global.DTP1[2..] + NUM1.ToString().PadLeft(2, '0') + "-" + Global.gUser加盟商編號;
  215. SQL_Comm.SQL_查詢圖檔資料庫();
  216. if(SQL_Module.dr.Read()){
  217. 圖檔資料庫 = SQL_Module.dr[0].ToString();
  218. SQL_Comm.SQL_報告書_新增(報告書號, 報告書人員資料_客編_tb.text, DateTime.Today.ToString("yyyy/MM/dd"), Global.gUserName, Global.gUser區域, 圖檔資料庫);
  219. Set_報告書清單(報告書人員資料_客編_tb.text,報告書人員資料_申請人_tb.text,報告書人員資料_聯繫人_tb.text,報告書人員資料_聯繫人電話_tb.text,報告書人員資料_地址_tb.text,報告書人員資料_聯繫人2_tb.text,報告書人員資料_聯繫人2電話_tb.text);
  220. }
  221. }
  222. public void 報告書清單拍照1(){
  223. 拍照頁面_pl.SetActive(true);
  224. 拍照_文件號_bt.SetActive(false);拍照_施工前_bt.SetActive(false);拍照_施工後_bt.SetActive(false);拍照_申請人身分證正反面_bt.SetActive(false);拍照_委託人身分證正反面_bt.SetActive(false);
  225. 拍照_所有權人身分證正反面_bt.SetActive(false);拍照_申請人身心障礙證明正反面_bt.SetActive(false);拍照_房屋所有權狀_bt.SetActive(false);拍照_土地所有權狀_bt.SetActive(false);
  226. 拍照_房屋稅籍證明_bt.SetActive(false);拍照_土地稅籍證明_bt.SetActive(false);拍照_房屋稅單_bt.SetActive(false);拍照_土地稅單_bt.SetActive(false);拍照_評估報告書2_bt.SetActive(false);
  227. 拍照_評估報告書1_bt.SetActive(false);拍照_案場1_bt.SetActive(false);拍照_案場2_bt.SetActive(false);拍照_案場3_bt.SetActive(false);拍照_核定通知書_bt.SetActive(false);
  228. if(Global.報告書選項2 =="評估報告書1"){
  229. 拍照_評估報告書1_bt.SetActive(true);
  230. }else if(Global.報告書選項2 =="評估報告書2"){
  231. 拍照_評估報告書2_bt.SetActive(true);
  232. }else if(Global.報告書選項2 =="核定通知書"){
  233. 拍照_核定通知書_bt.SetActive(true);
  234. }else if(Global.報告書選項2 =="案場1"){
  235. 拍照_案場1_bt.SetActive(true);
  236. }else if(Global.報告書選項2 =="案場2"){
  237. 拍照_案場2_bt.SetActive(true);
  238. }else if(Global.報告書選項2 =="案場3"){
  239. 拍照_案場3_bt.SetActive(true);
  240. }else{
  241. if(Global.報告書選項3 =="申請人身分證正反面"){拍照_申請人身分證正反面_bt.SetActive(true);}
  242. else if(Global.報告書選項3 =="委託人身分證正反面"){拍照_委託人身分證正反面_bt.SetActive(true);}
  243. else if(Global.報告書選項3 =="所有權人身分證正反面"){拍照_所有權人身分證正反面_bt.SetActive(true);}
  244. else if(Global.報告書選項3 =="申請人身心障礙證明正反面"){拍照_申請人身心障礙證明正反面_bt.SetActive(true);}
  245. else if(Global.報告書選項3 =="房屋所有權狀"){拍照_房屋所有權狀_bt.SetActive(true);}
  246. else if(Global.報告書選項3 =="土地所有權狀"){拍照_土地所有權狀_bt.SetActive(true);}
  247. else if(Global.報告書選項3 =="房屋稅籍證明"){拍照_房屋稅籍證明_bt.SetActive(true);}
  248. else if(Global.報告書選項3 =="土地稅籍證明"){拍照_土地稅籍證明_bt.SetActive(true);}
  249. else if(Global.報告書選項3 =="房屋稅單"){拍照_房屋稅單_bt.SetActive(true);}
  250. else if(Global.報告書選項3 =="土地稅單"){拍照_土地稅單_bt.SetActive(true);}
  251. }
  252. StartCoroutine(open_Camera(60));
  253. 提示_tb.text ="拍照中";
  254. //拍照2(Global.報告書選項3);
  255. 拍照用.gameObject.SetActive(true);
  256. 放圖用.gameObject.SetActive(false);
  257. }
  258. public void 拍照2(string 階段){
  259. if (拍照用.gameObject.activeSelf && !放圖用.gameObject.activeSelf){
  260. Texture2D photo = new Texture2D(myCam.width, myCam.height);
  261. photo.SetPixels(myCam.GetPixels());
  262. photo.Apply();
  263. Texture2D 上傳圖 = RotateTexture(photo, true);
  264. Texture2D 鏡像後 = 鏡像圖片(photo);
  265. 放圖用.rectTransform.sizeDelta = new Vector2(720f, 1280f);
  266. 放圖用.texture = 鏡像後;
  267. byte[] imageBytes = 上傳圖.EncodeToPNG();
  268. SQL_Comm.SQL_取得報告書資料(報告書流水號_tb.text);
  269. if (SQL_Module.dr.Read()){
  270. Global.圖檔資料庫 = SQL_Module.dr["圖檔資料庫"].ToString();
  271. SQL_CommString.SQL_連線字串_圖片_SQL(Global.圖檔資料庫, Global.資料庫IP);
  272. if(階段=="評估報告書1" || 階段=="評估報告書2" || 階段=="案場1" || 階段=="案場2" || 階段=="案場3"){
  273. SQL_Comm.SQL_讀取施工圖檔流水號(報告書流水號_tb.text,Global.報告書施工狀態,Global.報告書選項2,Global.報告書物料料號,Global.報告書物料明細流水號);
  274. int 流水號2;if(SQL_Module.dr.Read()){流水號2=int.Parse(SQL_Module.dr[0].ToString()[2..]);}else{流水號2 = 0;}流水號2+=1;
  275. SQL_Comm.SQL_上傳施工圖檔(報告書流水號_tb.text,Global.報告書施工狀態,Global.報告書選項2,Global.報告書物料料號,imageBytes,"JPG","IM"+流水號2.ToString().PadLeft(3,'0'),"0",Global.報告書物料明細流水號);
  276. }else{
  277. SQL_Comm.SQL_讀取相關文件圖檔流水號(報告書流水號_tb.text,階段);
  278. int 流水號;if(SQL_Module.dr.Read()){流水號=int.Parse(SQL_Module.dr["流水號"].ToString()[^8..]);}else{流水號 = 0;}流水號+=1;
  279. SQL_Comm.SQL_上傳相關文件圖檔("IM"+流水號.ToString().PadLeft(8,'0'),報告書流水號_tb.text,階段,imageBytes,"JPG","");
  280. }
  281. 拍照結束2(階段);
  282. }
  283. myCam.Stop();
  284. myCam = null;
  285. 提示_tb.text ="";
  286. /*Texture2D photoTexture = CapturePhoto();
  287. if (photoTexture != null){
  288. 放圖用.rectTransform.sizeDelta = new Vector2(720f, 1280f);
  289. 放圖用.texture = photoTexture;
  290. Texture2D texture2D = new((放圖用.texture as Texture2D).width, (放圖用.texture as Texture2D).height);
  291. Graphics.CopyTexture(放圖用.texture, texture2D);
  292. byte[] imageBytes = texture2D.EncodeToPNG();
  293. SQL_Comm.SQL_取得報告書資料(報告書流水號_tb.text);
  294. if(SQL_Module.dr.Read()){
  295. Global.圖檔資料庫 = SQL_Module.dr["圖檔資料庫"].ToString();
  296. SQL_CommString.SQL_連線字串_圖片_SQL(Global.圖檔資料庫,Global.資料庫IP);
  297. if(階段=="評估報告書1" || 階段=="評估報告書2" || 階段=="案場1" || 階段=="案場2" || 階段=="案場3"){
  298. SQL_Comm.SQL_讀取施工圖檔流水號(報告書流水號_tb.text,Global.報告書施工狀態,Global.報告書選項2,Global.報告書物料料號,Global.報告書物料明細流水號);
  299. int 流水號2;if(SQL_Module.dr.Read()){流水號2=int.Parse(SQL_Module.dr[0].ToString()[2..]);}else{流水號2 = 0;}流水號2+=1;
  300. SQL_Comm.SQL_上傳施工圖檔(報告書流水號_tb.text,Global.報告書施工狀態,Global.報告書選項2,Global.報告書物料料號,imageBytes,"JPG","IM"+流水號2.ToString().PadLeft(3,'0'),"0",Global.報告書物料明細流水號);
  301. }else{
  302. SQL_Comm.SQL_讀取相關文件圖檔流水號(報告書流水號_tb.text,階段);
  303. int 流水號;if(SQL_Module.dr.Read()){流水號=int.Parse(SQL_Module.dr["流水號"].ToString()[^8..]);}else{流水號 = 0;}流水號+=1;
  304. SQL_Comm.SQL_上傳相關文件圖檔("IM"+流水號.ToString().PadLeft(8,'0'),報告書流水號_tb.text,階段,imageBytes,"JPG","");
  305. }
  306. 拍照結束2(階段);
  307. }
  308. }
  309. myCam.Stop();
  310. myCam = null;
  311. 提示_tb.text ="";*/
  312. }
  313. }
  314. private void 拍照結束2(string 階段){
  315. 拍照頁面_pl.SetActive(false);
  316. //PhotoScroll.清除currentPage();
  317. if(階段=="評估報告書1" || 階段=="評估報告書2" || 階段=="案場1" || 階段=="案場2" || 階段=="案場3"){
  318. //Set_評估報告書1清單("評估報告書1");
  319. 載入圖片清單2(Global.報告書施工狀態,報告書施作圖片_tp,報告書施作圖片_rpf,報告書施作圖片_ct,報告書施作圖片_lpf,施作圖片圖片讀取_pl,施作圖片圖片寬度_pl);
  320. }else{
  321. 載入圖片清單(階段,報告書文件圖片_tp,報告書文件圖片_rpf,報告書文件圖片_ct,報告書文件圖片_lpf,報告書文件圖片讀取_pl,報告書文件圖片寬度_pl);
  322. }
  323. }
  324. public void Set_報告書人員清單年份刷新(){
  325. Set_報告書人員清單("");
  326. }
  327. private void 載入圖片清單(string 階段,Transform 文件圖片_tp, GameObject 文件圖片_rpf, GameObject 文件圖片_ct, GameObject 文件圖片_lpf,GameObject 圖片讀取,GameObject 圖片寬度){
  328. 圖片讀取.SetActive(true);
  329. Module.清除控件(文件圖片_ct);
  330. SQL_Comm.SQL_取得報告書資料(報告書項目清單_報告書號_tb.text);
  331. if(SQL_Module.dr.Read()){
  332. 報告書申請人_tb.text = SQL_Module.dr["負責人"].ToString();
  333. 報告書開立人_tb.text = SQL_Module.dr["開立人"].ToString();
  334. Global.圖檔資料庫 = SQL_Module.dr["圖檔資料庫"].ToString();
  335. Debug.Log(Global.圖檔資料庫);
  336. SQL_CommString.SQL_連線字串_圖片_SQL(Global.圖檔資料庫,Global.資料庫IP);
  337. SQL_Comm.SQL_報告書_相關文件圖片清單(報告書項目清單_報告書號_tb.text,階段);
  338. DataSet ds1 = new();
  339. SQL_Module.da.Fill(ds1);
  340. if(ds1.Tables[0].Rows.Count>0){
  341. 相關文件相片目前_tb.text="1";相關文件相片總數_tb.text=ds1.Tables[0].Rows.Count.ToString();
  342. 文件圖片相片文件號_tb.text=ds1.Tables[0].Rows[0][0].ToString();
  343. }else{
  344. 相關文件相片目前_tb.text="-";相關文件相片總數_tb.text="-";文件圖片相片文件號_tb.text="文件號";
  345. }
  346. Global.報告書相關文件_table = ds1.Tables[0];
  347. 文件圖片_ct.GetComponent<RectTransform>().sizeDelta=new Vector2(圖片寬度.GetComponent<RectTransform>().rect .width,文件圖片_ct.GetComponent<RectTransform>().sizeDelta.y);
  348. 文件圖片_rpf.GetComponent<RectTransform>().sizeDelta=new Vector2(圖片寬度.GetComponent<RectTransform>().rect .width,文件圖片_rpf.GetComponent<RectTransform>().sizeDelta.y);
  349. 載入報告書圖片("報告書相關文件"+階段,ds1.Tables[0],文件圖片_tp,文件圖片_rpf,文件圖片_ct,myFont,UIsprite,文件圖片_lpf,true);
  350. 圖片讀取.SetActive(false);
  351. }
  352. }
  353. void 更新按鈕顏色(string 階段){
  354. Dictionary<string, GameObject> 按鈕對應表 = new(){
  355. { "申請人身分證正反面", 長照類_申請人身分證反面_bt },{ "委託人身分證正反面", 長照類_受託人身分證反面_bt },{ "所有權人身分證正反面", 長照類_所有權人身分證反面_bt },
  356. { "申請人身心障礙證明正反面", 長照類_申請人身心障礙證明_bt },{ "房屋所有權狀", 長照類_房屋所有權狀_bt }, { "土地所有權狀", 長照類_土地所有權狀_bt },
  357. { "房屋稅籍證明", 長照類_房屋稅籍證明_bt },{ "土地稅籍證明", 長照類_土地稅籍證明_bt },{ "房屋稅單", 長照類_房屋稅單_bt },{ "土地稅單", 長照類_土地稅單_bt }
  358. };
  359. GameObject[] 所有按鈕 = {
  360. 長照類_申請人身分證反面_bt,長照類_申請人身心障礙證明_bt,長照類_所有權人身分證反面_bt,長照類_受託人身分證反面_bt,長照類_房屋所有權狀_bt,長照類_房屋稅籍證明_bt,
  361. 長照類_房屋稅單_bt,長照類_土地所有權狀_bt,長照類_土地稅籍證明_bt,長照類_土地稅單_bt
  362. };
  363. foreach (var 按鈕 in 所有按鈕){
  364. var image = 按鈕.transform.Find("Image")?.GetComponent<Image>();if (image != null) {image.color = new Color32(255, 255, 255, 255);}
  365. }
  366. if (按鈕對應表.TryGetValue(階段, out GameObject 高亮按鈕)) {
  367. var image = 高亮按鈕.transform.Find("Image")?.GetComponent<Image>();if (image != null){image.color = new Color32(158, 255, 183, 255);}
  368. }
  369. }
  370. public void 報告書相關文件(string 階段){
  371. Global.報告書選項3 = 階段;
  372. 更新按鈕顏色(階段);
  373. 載入圖片清單(階段,報告書文件圖片_tp,報告書文件圖片_rpf,報告書文件圖片_ct,報告書文件圖片_lpf,報告書文件圖片讀取_pl,報告書文件圖片寬度_pl);
  374. }
  375. public void 新增報告書_bt_Click(string 階段){
  376. Global.報告書選項3 = 階段;
  377. 載入圖片清單(階段,報告書文件圖片_tp,報告書文件圖片_rpf,報告書文件圖片_ct,報告書文件圖片_lpf,報告書文件圖片讀取_pl,報告書文件圖片寬度_pl);
  378. }
  379. private void 讀取施作(string 文件號){
  380. SQL_Comm.SQL_報告書_查詢施作(報告書流水號_tb.text,文件號);
  381. if(SQL_Module.dr.Read()){
  382. Global.報告書物料明細流水號=SQL_Module.dr[0].ToString();
  383. Global.報告書物料料號 = SQL_Module.dr[1].ToString();
  384. 施作_tb.text=SQL_Module.dr[1].ToString();
  385. }else{
  386. SQL_Comm.SQL_報告書_讀取流水號();
  387. string 流水號;
  388. if(SQL_Module.dr.Read()){
  389. 流水號 = SQL_Module.dr[0].ToString();
  390. }else{
  391. 流水號 = "WS00000000-FC001";
  392. }
  393. int 新流;
  394. if(流水號.Contains("-")){
  395. string[] 前後 = 流水號.Split('-');
  396. 新流 = int.Parse(前後[0][2..]) + 1;
  397. }else{
  398. 新流 = int.Parse(流水號[2..]) + 1;
  399. }
  400. string 欣欣 = "WS"+新流.ToString().PadLeft(8,'0');
  401. Global.報告書物料明細流水號=欣欣;
  402. Global.報告書物料料號 = "";
  403. 施作_tb.text="";
  404. SQL_Comm.SQL_報告書_新增施作("",報告書流水號_tb.text,文件號,欣欣);
  405. }
  406. }
  407. public void 長照類_案場1_bt_click(){
  408. 長照類_案場1_bt.SetActive(false);長照類_案場2_bt.SetActive(false);長照類_案場3_bt.SetActive(false);返回8_bt.SetActive(false);
  409. 施作項目_lb.SetActive(true);施作項目_sv.SetActive(false);施作圖片_pl.SetActive(true);施作項目_新增_bt.SetActive(false);施作項目_刪除_bt.SetActive(false);
  410. 施作顯示_tb.SetActive(true);存檔2_bt.SetActive(true);
  411. 返回6_bt.SetActive(true);施工前_bt.SetActive(true);施工後_bt.SetActive(true);備註_bt.SetActive(true);產品序號_bt.SetActive(false);
  412. 施工前_tb.text = "施工前";施工後_tb.text = "施工後";
  413. Set_評估報告書1清單("案場1");
  414. Global.報告書選項2="案場1";
  415. 讀取施作(Global.報告書選項2);
  416. }
  417. public void 長照類_案場2_bt_click(){
  418. 長照類_案場1_bt.SetActive(false);長照類_案場2_bt.SetActive(false);長照類_案場3_bt.SetActive(false);返回8_bt.SetActive(false);
  419. 施作項目_lb.SetActive(true);施作項目_sv.SetActive(false);施作圖片_pl.SetActive(true);施作項目_新增_bt.SetActive(false);施作項目_刪除_bt.SetActive(false);
  420. 施作顯示_tb.SetActive(true);存檔2_bt.SetActive(true);
  421. 返回6_bt.SetActive(true);施工前_bt.SetActive(true);施工後_bt.SetActive(true);備註_bt.SetActive(true);產品序號_bt.SetActive(false);
  422. 施工前_tb.text = "施工前";施工後_tb.text = "施工後";
  423. Set_評估報告書1清單("案場2");
  424. Global.報告書選項2="案場2";
  425. 讀取施作(Global.報告書選項2);
  426. }
  427. public void 長照類_案場3_bt_click(){
  428. 長照類_案場1_bt.SetActive(false);長照類_案場2_bt.SetActive(false);長照類_案場3_bt.SetActive(false);返回8_bt.SetActive(false);
  429. 施作項目_lb.SetActive(true);施作項目_sv.SetActive(false);施作圖片_pl.SetActive(true);施作項目_新增_bt.SetActive(false);施作項目_刪除_bt.SetActive(false);
  430. 施作顯示_tb.SetActive(true);存檔2_bt.SetActive(true);
  431. 返回6_bt.SetActive(true);施工前_bt.SetActive(true);施工後_bt.SetActive(true);備註_bt.SetActive(true);產品序號_bt.SetActive(false);
  432. Set_評估報告書1清單("案場3");
  433. 施工前_tb.text = "施工前";施工後_tb.text = "施工後";
  434. Global.報告書選項2="案場3";
  435. 讀取施作(Global.報告書選項2);
  436. }
  437. public void 長照類_存檔2_bt_click(){
  438. Global.報告書物料料號 = 施作_tb.text;
  439. SQL_Comm.SQL_報告書_修改施作(施作_tb.text,報告書流水號_tb.text,Global.報告書選項2,Global.報告書物料明細流水號);
  440. SQL_Comm.SQL_取得報告書資料(報告書流水號_tb.text);
  441. if(SQL_Module.dr.Read()){
  442. Global.圖檔資料庫 = SQL_Module.dr["圖檔資料庫"].ToString();
  443. SQL_CommString.SQL_連線字串_圖片_SQL(Global.圖檔資料庫,Global.資料庫IP);
  444. SQL_Comm.SQL_報告書_修改施作2(施作_tb.text,報告書流水號_tb.text,Global.報告書選項2);
  445. }
  446. }
  447. public void 長照類_評估報告書1_bt_click(){
  448. 長照類_核定通知書_bt.SetActive(false);長照類_相關文件_bt.SetActive(false);長照類_評估報告書1_bt.SetActive(false);
  449. 長照類_評估報告書2_bt.SetActive(false);返回4_bt.SetActive(false);
  450. 施作項目_lb.SetActive(true);施作項目_sv.SetActive(true);施作圖片_pl.SetActive(true);施作項目_新增_bt.SetActive(true);施作項目_刪除_bt.SetActive(true);
  451. 返回6_bt.SetActive(true);施工前_bt.SetActive(true);施工後_bt.SetActive(true);備註_bt.SetActive(true);產品序號_bt.SetActive(false);
  452. 施工前_tb.text = "施工前";施工後_tb.text = "施工後";
  453. Set_評估報告書1清單("評估報告書1");
  454. Global.報告書選項2="評估報告書1";
  455. }
  456. public void 長照類_評估報告書2_bt_click(){
  457. 長照類_核定通知書_bt.SetActive(false);長照類_相關文件_bt.SetActive(false);長照類_評估報告書1_bt.SetActive(false);
  458. 長照類_評估報告書2_bt.SetActive(false);返回4_bt.SetActive(false);
  459. 施作項目_lb.SetActive(true);施作項目_sv.SetActive(true);施作圖片_pl.SetActive(true);施作項目_新增_bt.SetActive(true);施作項目_刪除_bt.SetActive(true);
  460. 返回6_bt.SetActive(true);施工前_bt.SetActive(true);施工後_bt.SetActive(true);備註_bt.SetActive(true);產品序號_bt.SetActive(true);
  461. Set_評估報告書1清單("評估報告書2");
  462. if(Global.報告書選項1=="身障類" || Global.報告書選項1=="長照類"){
  463. 施工前_tb.text = "空拍輔具";施工後_tb.text = "使用中";
  464. }else{
  465. 施工前_tb.text = "施工前";施工後_tb.text = "施工後";
  466. }
  467. Global.報告書選項2="評估報告書2";
  468. }
  469. public void 報告書清單返回6(){
  470. if(Global.報告書選項2=="評估報告書1" || Global.報告書選項2=="評估報告書2"){
  471. 長照類_核定通知書_bt.SetActive(true);長照類_相關文件_bt.SetActive(true);長照類_評估報告書1_bt.SetActive(true);
  472. 長照類_評估報告書2_bt.SetActive(true);返回4_bt.SetActive(true);
  473. 施作項目_lb.SetActive(false);施作項目_sv.SetActive(false);施作圖片_pl.SetActive(false);施作項目_新增_bt.SetActive(false);施作項目_刪除_bt.SetActive(false);
  474. 施作顯示_tb.SetActive(false);存檔2_bt.SetActive(false);
  475. 返回6_bt.SetActive(false);施工前_bt.SetActive(false);施工後_bt.SetActive(false);備註_bt.SetActive(false);產品序號_bt.SetActive(false);
  476. 拍照1_bt.SetActive(false);刪除1_bt.SetActive(false);存檔1_bt.SetActive(false);
  477. Module.清除控件(報告書施作圖片_ct);
  478. }else{
  479. 長照類_案場1_bt.SetActive(true);長照類_案場2_bt.SetActive(true);長照類_案場3_bt.SetActive(true);返回8_bt.SetActive(true);
  480. 施作項目_lb.SetActive(false);施作項目_sv.SetActive(false);施作圖片_pl.SetActive(false);施作項目_新增_bt.SetActive(false);施作項目_刪除_bt.SetActive(false);
  481. 施作顯示_tb.SetActive(false);存檔2_bt.SetActive(false);
  482. 返回6_bt.SetActive(false);施工前_bt.SetActive(false);施工後_bt.SetActive(false);備註_bt.SetActive(false);產品序號_bt.SetActive(false);
  483. 拍照1_bt.SetActive(false);刪除1_bt.SetActive(false);存檔1_bt.SetActive(false);
  484. Module.清除控件(報告書施作圖片_ct);
  485. }
  486. }
  487. private void Set_評估報告書1清單(string 文件號){
  488. SQL_Comm.SQL_取得報告書項目清單2(報告書流水號_tb.text,文件號);
  489. DataSet ds1 = new();
  490. SQL_Module.da.Fill(ds1);
  491. for(int i=0;i<=ds1.Tables[0].Rows.Count-1;i++){
  492. ds1.Tables[0].Rows[i][1] = ds1.Tables[0].Rows[i][2].ToString() + " " + ds1.Tables[0].Rows[i][4].ToString();
  493. }
  494. if(文件號=="評估報告書1"){
  495. Global.報告書評估報告書1清單_tabel = ds1.Tables[0];
  496. }else if(文件號=="案場1"){
  497. Global.報告書案場1清單_tabel = ds1.Tables[0];
  498. }else if(文件號=="案場2"){
  499. Global.報告書案場2清單_tabel = ds1.Tables[0];
  500. }else if(文件號=="案場3"){
  501. Global.報告書案場3清單_tabel = ds1.Tables[0];
  502. }else{
  503. Global.報告書評估報告書2清單_tabel = ds1.Tables[0];
  504. }
  505. 載入報告書項目清單表格("報告書"+文件號+"清單",ds1.Tables[0],報告書施作項目清單_tp,報告書施作項目清單_rpf,報告書施作項目清單_ct,myFont,UIsprite,報告書施作項目清單_lpf,true);
  506. }
  507. public void 報告書評估報告書1新增(){
  508. 評估報告書1_物料清單_sv.SetActive(true);返回6_bt.SetActive(false);施作圖片_pl.SetActive(false);返回7_bt.SetActive(true);
  509. if(Global.報告書選項1=="長照類"){
  510. if(Global.報告書選項2=="評估報告書1"){
  511. Set_長照物料清單("施作項目","C",報告書施作圖片_物料清單_tp,報告書施作圖片_物料清單_rpf,報告書施作圖片_物料清單_ct,報告書施作圖片_物料清單_lpf,Global.報告書選項2+"物料清單");
  512. }else{
  513. Set_長照物料清單("施作項目","C2",報告書施作圖片_物料清單_tp,報告書施作圖片_物料清單_rpf,報告書施作圖片_物料清單_ct,報告書施作圖片_物料清單_lpf,Global.報告書選項2+"物料清單");
  514. }
  515. }else{
  516. if(Global.報告書選項2=="評估報告書1"){
  517. Set_長照物料清單("施作項目","D",報告書施作圖片_物料清單_tp,報告書施作圖片_物料清單_rpf,報告書施作圖片_物料清單_ct,報告書施作圖片_物料清單_lpf,Global.報告書選項2+"物料清單");
  518. }else{
  519. Set_長照物料清單("施作項目","D2",報告書施作圖片_物料清單_tp,報告書施作圖片_物料清單_rpf,報告書施作圖片_物料清單_ct,報告書施作圖片_物料清單_lpf,Global.報告書選項2+"物料清單");
  520. }
  521. }
  522. }
  523. public void 報告書評估報告書1刪除(){
  524. Debug.Log(Global.報告書物料料號);
  525. SQL_Comm.SQL_報告書_刪除報告書明細(報告書流水號_tb.text,Global.報告書選項2,Global.報告書物料料號);
  526. SQL_Comm.SQL_取得報告書資料(報告書流水號_tb.text);
  527. if(SQL_Module.dr.Read()){
  528. Global.圖檔資料庫 = SQL_Module.dr["圖檔資料庫"].ToString();
  529. SQL_CommString.SQL_連線字串_圖片_SQL(Global.圖檔資料庫,Global.資料庫IP);
  530. SQL_Comm.SQL_報告書_刪除報告書施工圖檔(報告書流水號_tb.text,Global.報告書選項2,Global.報告書物料料號);
  531. }
  532. Set_評估報告書1清單(Global.報告書選項2);
  533. }
  534. public void 報告書評估報告書1圖檔刪除(){
  535. if(Global.報告書選項2=="評估報告書1"){
  536. SQL_Comm.SQL_取得報告書資料(報告書流水號_tb.text);
  537. if(SQL_Module.dr.Read()){
  538. Global.圖檔資料庫 = SQL_Module.dr["圖檔資料庫"].ToString();
  539. SQL_CommString.SQL_連線字串_圖片_SQL(Global.圖檔資料庫,Global.資料庫IP);
  540. string 文件號=施作圖片相片文件號_tb.text;
  541. SQL_Comm.SQL_報告書_刪除報告書施工圖檔照片(報告書流水號_tb.text,Global.報告書選項2,Global.報告書施工狀態,Global.報告書物料明細流水號,Global.報告書物料料號,文件號);
  542. 載入圖片清單2(Global.報告書施工狀態,報告書施作圖片_tp,報告書施作圖片_rpf,報告書施作圖片_ct,報告書施作圖片_lpf,施作圖片圖片讀取_pl,施作圖片圖片寬度_pl);
  543. }
  544. }else if(Global.報告書選項2=="評估報告書2"){
  545. SQL_Comm.SQL_取得報告書資料(報告書流水號_tb.text);
  546. if(SQL_Module.dr.Read()){
  547. Global.圖檔資料庫 = SQL_Module.dr["圖檔資料庫"].ToString();
  548. SQL_CommString.SQL_連線字串_圖片_SQL(Global.圖檔資料庫,Global.資料庫IP);
  549. string 文件號=施作圖片相片文件號_tb.text;
  550. SQL_Comm.SQL_報告書_刪除報告書施工圖檔照片(報告書流水號_tb.text,Global.報告書選項2,Global.報告書施工狀態,Global.報告書物料明細流水號,Global.報告書物料料號,文件號);
  551. 載入圖片清單2(Global.報告書施工狀態,報告書施作圖片_tp,報告書施作圖片_rpf,報告書施作圖片_ct,報告書施作圖片_lpf,施作圖片圖片讀取_pl,施作圖片圖片寬度_pl);
  552. }
  553. }else if(Global.報告書選項2=="核定通知書"){
  554. string 文件號 = 文件圖片相片文件號_tb.text;
  555. SQL_Comm.SQL_報告書_刪除報告書相關文件圖檔照片(報告書流水號_tb.text,Global.報告書選項2,文件號);
  556. 載入圖片清單(Global.報告書選項2,報告書文件圖片_tp,報告書文件圖片_rpf,報告書文件圖片_ct,報告書文件圖片_lpf,報告書文件圖片讀取_pl,報告書文件圖片寬度_pl);
  557. }else{
  558. string 文件號 = 文件圖片相片文件號_tb.text;
  559. SQL_Comm.SQL_報告書_刪除報告書相關文件圖檔照片(報告書流水號_tb.text,Global.報告書選項3,文件號);
  560. 載入圖片清單(Global.報告書選項3,報告書文件圖片_tp,報告書文件圖片_rpf,報告書文件圖片_ct,報告書文件圖片_lpf,報告書文件圖片讀取_pl,報告書文件圖片寬度_pl);
  561. }
  562. }
  563. public void 報告書清單返回7(){
  564. 評估報告書1_物料清單_sv.SetActive(false);返回6_bt.SetActive(true);施作圖片_pl.SetActive(true);返回7_bt.SetActive(false);
  565. }
  566. public void 長照類_核定通知書_bt_click(){
  567. 長照類_核定通知書_bt.SetActive(false);長照類_相關文件_bt.SetActive(false);長照類_評估報告書1_bt.SetActive(false);
  568. 長照類_評估報告書2_bt.SetActive(false);返回4_bt.SetActive(false);
  569. 返回5_bt.SetActive(true);刪除1_bt.SetActive(true);存檔1_bt.SetActive(true);
  570. 拍照1_bt.SetActive(true);報告書文件圖片_pl.SetActive(true);
  571. RectTransform rt = 報告書文件圖片_pl.GetComponent<RectTransform>();
  572. rt.offsetMax = new Vector2(rt.offsetMax.x, -114f);
  573. Global.報告書選項2="核定通知書";
  574. 載入圖片清單(Global.報告書選項2,報告書文件圖片_tp,報告書文件圖片_rpf,報告書文件圖片_ct,報告書文件圖片_lpf,報告書文件圖片讀取_pl,報告書文件圖片寬度_pl);
  575. }
  576. private void Set_日期格式轉換(){
  577. Global.DTP1 = DateTime.Today.Year.ToString().PadLeft(4,'0')+DateTime.Today.Month.ToString().PadLeft(2,'0')+DateTime.Today.Day.ToString().PadLeft(2,'0');
  578. }
  579. private void Set_報告書人員清單(string 搜尋條件){
  580. 報告書人員清單_pl.SetActive(true);報告書人員資料_pl.SetActive(false);報告書項目清單_pl.SetActive(false);
  581. 評估主頁抬頭_tb.text= "首頁";
  582. string 年份;
  583. if(報告書人員清單_年份_cb.GetComponent<TMP_Dropdown>().options[報告書人員清單_年份_cb.GetComponent<TMP_Dropdown>().value].text==""){
  584. 年份 = "%%";
  585. }else{
  586. 年份 = 報告書人員清單_年份_cb.GetComponent<TMP_Dropdown>().options[報告書人員清單_年份_cb.GetComponent<TMP_Dropdown>().value].text;
  587. }
  588. SQL_Comm.SQL_報告書_人員清單(Global.gUser區域,年份,搜尋條件);
  589. DataSet ds1 = new();
  590. SQL_Module.da.Fill(ds1);
  591. string[] columnNames = new string[] { ds1.Tables[0].Columns[1].ColumnName, ds1.Tables[0].Columns[2].ColumnName};
  592. Global.報告書人員清單_tabel = ds1.Tables[0];
  593. 載入報告書表格("報告書人員清單",ds1.Tables[0].DefaultView.ToTable(false, columnNames),報告書人員清單_tp,報告書人員清單_rpf,報告書人員清單_ct,myFont,UIsprite,報告書人員清單_lpf,true,表頭_pl);
  594. }
  595. private void Set_報告書清單(string 客戶編號,string 申請人,string 聯繫人,string 聯繫人電話,string 住址,string 聯繫人2,string 聯繫人2電話){
  596. 報告書人員清單_pl.SetActive(false);報告書人員資料_pl.SetActive(true);報告書項目清單_pl.SetActive(false);
  597. 評估主頁抬頭_tb.text = 申請人;報告書人員資料_申請人_tb.text = 申請人;報告書人員資料_客編_tb.text = 客戶編號;報告書人員資料_聯繫人_tb.text = 聯繫人;
  598. 報告書人員資料_聯繫人電話_tb.text = 聯繫人電話;報告書人員資料_地址_tb.text = 住址;報告書人員資料_聯繫人2_tb.text=聯繫人2;報告書人員資料_聯繫人2電話_tb.text=聯繫人2電話;
  599. 返回1_bt.SetActive(false);查詢1_bt.SetActive(false);新增客戶1_bt.SetActive(false);返回2_bt.SetActive(true);返回2_1_bt.SetActive(false);
  600. SQL_Comm.SQL_報告書_清單(客戶編號);
  601. DataSet ds1 = new();
  602. SQL_Module.da.Fill(ds1);
  603. string[] columnNames = new string[] { ds1.Tables[0].Columns[0].ColumnName, ds1.Tables[0].Columns[2].ColumnName};
  604. Global.報告書清單_tabel = ds1.Tables[0].DefaultView.ToTable(false, columnNames);
  605. 載入報告書表格("報告書清單",Global.報告書清單_tabel,報告書清單_tp,報告書清單_rpf,報告書清單_ct,myFont,UIsprite,報告書清單_lpf,true,表頭2_pl);
  606. }
  607. private void 載入報告書表格(string table_name,DataTable table,Transform tableParent,GameObject rowPrefab,GameObject ceneter,TMP_FontAsset myFont,Sprite UIsprite,
  608. GameObject LinePrefab,bool overflowMode,GameObject 表頭){
  609. Module.清除控件(表頭);
  610. float 表格高度 = 160f;
  611. for (int j = 0; j <= table.Columns.Count-1; j++){
  612. GameObject headerText = new(table_name+"_Headers (Clone)");
  613. headerText.transform.SetParent(表頭.transform, false);
  614. headerText.AddComponent<TextMeshProUGUI>().text = table.Columns[j].ColumnName;
  615. headerText.GetComponent<TextMeshProUGUI>().tag="Cells";
  616. if(overflowMode){headerText.GetComponent<TextMeshProUGUI>().overflowMode=TextOverflowModes.Ellipsis;}
  617. if(j==0){
  618. headerText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
  619. headerText.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
  620. headerText.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
  621. headerText.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
  622. float x = 表頭.GetComponent<RectTransform>().rect.width -275f;
  623. headerText.GetComponent<RectTransform>().sizeDelta = new Vector2(x, 表格高度);
  624. }else{
  625. headerText.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
  626. headerText.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
  627. headerText.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f);
  628. headerText.GetComponent<RectTransform>().sizeDelta = new Vector2(270f, 表格高度);
  629. headerText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
  630. }
  631. }
  632. GameObject Separation = Instantiate(LinePrefab, 表頭.transform);
  633. Separation.GetComponent<RectTransform>().sizeDelta = new Vector2(5f,表頭.GetComponent<RectTransform>().sizeDelta.y-5f);
  634. Separation.GetComponent<RectTransform>().anchoredPosition = new Vector2(-275f,-3f);
  635. Separation.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
  636. Separation.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
  637. Separation.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f);
  638. Separation.GetComponent<Image>().color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
  639. TextMeshProUGUI[] texts = 表頭.GetComponentsInChildren<TextMeshProUGUI>();
  640. foreach (TextMeshProUGUI text in texts){
  641. if(text.tag.Contains("Cells")){
  642. text.font = myFont;
  643. text.color = Global.系統主題 == 1 ? new Color(0, 0, 0, 1) : text.color;
  644. text.alignment = TextAlignmentOptions.Center;
  645. text.enableAutoSizing = true;
  646. text.margin = new Vector4(10, 0, 10, 0);
  647. }else{
  648. }
  649. }
  650. //==============================================
  651. Module.清除控件(ceneter);
  652. Image centerImage = ceneter.GetComponent<Image>();
  653. if(centerImage == null){
  654. centerImage = ceneter.AddComponent<Image>();
  655. centerImage.type = Image.Type.Sliced;
  656. }
  657. centerImage.sprite = UIsprite;
  658. centerImage.fillCenter = false;
  659. centerImage.color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
  660. for (int i = 0; i < table.Rows.Count; i++){
  661. GameObject row = Instantiate(rowPrefab, tableParent);
  662. row.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, (-表格高度 * i)+(-5*i));
  663. for (int j = 0; j < table.Columns.Count; j++){
  664. string value = table.Rows[i][j].ToString();
  665. GameObject cellText = new(table_name+"_Cells_"+i.ToString()+"_"+j.ToString());
  666. cellText.transform.SetParent(row.transform, false);
  667. cellText.AddComponent<TextMeshProUGUI>().text = value;
  668. cellText.GetComponent<TextMeshProUGUI>().tag="Cells";
  669. if(overflowMode){cellText.GetComponent<TextMeshProUGUI>().overflowMode=TextOverflowModes.Ellipsis;}
  670. cellText.AddComponent<Button>();
  671. cellText.GetComponent<Button>().onClick.AddListener(() => { 按鈕事件(cellText); });
  672. if(j==0){
  673. cellText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
  674. cellText.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
  675. cellText.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
  676. cellText.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
  677. float x = ceneter.GetComponent<RectTransform>().rect.width -275f;
  678. cellText.GetComponent<RectTransform>().sizeDelta = new Vector2(x, 表格高度);
  679. }else{
  680. cellText.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
  681. cellText.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
  682. cellText.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f);
  683. cellText.GetComponent<RectTransform>().sizeDelta = new Vector2(270f, 表格高度);
  684. cellText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
  685. }
  686. }
  687. }
  688. texts = ceneter.GetComponentsInChildren<TextMeshProUGUI>();
  689. foreach (TextMeshProUGUI text in texts){
  690. if(text.tag.Contains("Cells")){
  691. text.font = myFont;
  692. text.color = Global.系統主題 == 1 ? new Color(0, 0, 0, 1) : text.color;
  693. text.alignment = TextAlignmentOptions.Center;
  694. text.enableAutoSizing = true;;
  695. text.margin = new Vector4(10, 0, 10, 0);
  696. }else{
  697. }
  698. }
  699. ceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().sizeDelta.x,table.Rows.Count*表格高度 +((table.Rows.Count-1)*5f));
  700. //========建立分隔線=============
  701. Separation = Instantiate(LinePrefab, tableParent);
  702. Separation.GetComponent<RectTransform>().sizeDelta = new Vector2(5f,ceneter.GetComponent<RectTransform>().sizeDelta.y-5f);
  703. Separation.GetComponent<RectTransform>().anchoredPosition = new Vector2(-275f,-3f);
  704. Separation.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
  705. Separation.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
  706. Separation.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f);
  707. Separation.GetComponent<Image>().color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
  708. /*for(int i=1;i<=table.Rows.Count-1;i++){
  709. GameObject Separation2 = Instantiate(LinePrefab, tableParent);
  710. Separation2.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().rect.width-5f,5f);
  711. Separation2.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
  712. Separation2.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
  713. Separation2.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
  714. Separation2.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 5f * (1 - 19 * i));
  715. Separation2.GetComponent<Image>().color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
  716. }*/
  717. for(int i = 1; i <= table.Rows.Count - 1; i++) {
  718. GameObject Separation2 = Instantiate(LinePrefab, tableParent);
  719. Separation2.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().rect.width - 5f, 5f);
  720. Separation2.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
  721. Separation2.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
  722. Separation2.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
  723. Separation2.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, - (表格高度 + 5f) * i + 5f);
  724. Separation2.GetComponent<Image>().color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
  725. }
  726. }
  727. private void 載入報告書詳細資料(string 報告書流水號){
  728. 文件號_sv.GetComponent<RectTransform>().sizeDelta=new Vector2(報告書資料_pl.GetComponent<RectTransform>().rect.width/2-10f,文件號_sv.GetComponent<RectTransform>().sizeDelta.y);
  729. 項目清單_lb.GetComponent<RectTransform>().sizeDelta=new Vector2(報告書資料_pl.GetComponent<RectTransform>().rect.width/2-10f,項目清單_lb.GetComponent<RectTransform>().sizeDelta.y);
  730. 項目清單_sv.GetComponent<RectTransform>().sizeDelta=new Vector2(報告書資料_pl.GetComponent<RectTransform>().rect.width/2-10f,項目清單_sv.GetComponent<RectTransform>().sizeDelta.y);
  731. 扶手總長_lb.GetComponent<RectTransform>().sizeDelta=new Vector2(報告書資料_pl.GetComponent<RectTransform>().rect.width/2-200f,扶手總長_lb.GetComponent<RectTransform>().sizeDelta.y);
  732. 扶手總長_tb.GetComponent<RectTransform>().sizeDelta=new Vector2(報告書資料_pl.GetComponent<RectTransform>().rect.width/2-200f,扶手總長_tb.GetComponent<RectTransform>().sizeDelta.y);
  733. 報告書扶手總長_tb.text="";單項扶手長度_tb.text="";
  734. SQL_Comm.SQL_取得報告書資料(報告書流水號);
  735. if(SQL_Module.dr.Read()){
  736. 報告書申請人_tb.text = SQL_Module.dr["負責人"].ToString();
  737. 報告書開立人_tb.text = SQL_Module.dr["開立人"].ToString();
  738. Global.圖檔資料庫 = SQL_Module.dr["圖檔資料庫"].ToString();
  739. Debug.Log(Global.圖檔資料庫);
  740. SQL_CommString.SQL_連線字串_圖片_SQL(Global.圖檔資料庫,Global.資料庫IP);
  741. SQL_Comm.SQL_取得文件號清單(報告書流水號);
  742. DataSet ds1 = new();
  743. SQL_Module.da.Fill(ds1);
  744. Global.文件號清單_table=ds1.Tables[0];
  745. for(int i=0;i<=ds1.Tables[0].Rows.Count-1;i++){
  746. ds1.Tables[0].Rows[i][0]="第 "+(i+1)+" 頁";
  747. }
  748. string[] columnNames = new string[]{ds1.Tables[0].Columns[0].ColumnName};
  749. DataTable table1 = ds1.Tables[0].DefaultView.ToTable(false, columnNames);
  750. 載入文件號表格("文件號清單",table1,文件號清單_tp,文件號清單_rpf,文件號清單_ct,myFont,UIsprite,文件號清單_lpf,true);
  751. }
  752. }
  753. private void 載入文件號表格(string table_name,DataTable table,Transform tableParent,GameObject rowPrefab,GameObject ceneter,TMP_FontAsset myFont,Sprite UIsprite,
  754. GameObject LinePrefab,bool overflowMode){
  755. Module.清除控件(ceneter);
  756. Image centerImage = ceneter.GetComponent<Image>();
  757. if(centerImage == null){
  758. centerImage = ceneter.AddComponent<Image>();
  759. centerImage.type = Image.Type.Sliced;
  760. }
  761. centerImage.sprite = UIsprite;
  762. centerImage.fillCenter = false;
  763. centerImage.color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
  764. for (int i = 0; i < table.Rows.Count; i++){
  765. GameObject row = Instantiate(rowPrefab, tableParent);
  766. row.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, (-90 * i)+(-5*i));
  767. string value = table.Rows[i][0].ToString();
  768. GameObject cellText = new(table_name+"_Cells_"+i.ToString()+"_0");
  769. cellText.transform.SetParent(row.transform, false);
  770. cellText.AddComponent<TextMeshProUGUI>().text = value;
  771. cellText.GetComponent<TextMeshProUGUI>().tag="Cells";
  772. if(overflowMode){cellText.GetComponent<TextMeshProUGUI>().overflowMode=TextOverflowModes.Ellipsis;}
  773. cellText.AddComponent<Button>();
  774. cellText.GetComponent<Button>().onClick.AddListener(() => { 按鈕事件(cellText); });
  775. cellText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
  776. cellText.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
  777. cellText.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
  778. cellText.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
  779. cellText.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().rect.width, 90f);
  780. }
  781. TextMeshProUGUI[] texts = ceneter.GetComponentsInChildren<TextMeshProUGUI>();
  782. foreach (TextMeshProUGUI text in texts){
  783. if(text.tag.Contains("Cells")){
  784. text.font = myFont;
  785. text.color = Global.系統主題 == 1 ? new Color(0, 0, 0, 1) : text.color;
  786. text.alignment = TextAlignmentOptions.Center;
  787. text.fontStyle = FontStyles.Bold;
  788. text.fontSize=42;
  789. text.margin = new Vector4(10, 0, 10, 0);
  790. }else{
  791. }
  792. }
  793. ceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().sizeDelta.x,table.Rows.Count*90f+((table.Rows.Count-1)*5f));
  794. //========建立分隔線=============
  795. for(int i=1;i<=table.Rows.Count-1;i++){
  796. GameObject Separation2 = Instantiate(LinePrefab, tableParent);
  797. Separation2.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().rect.width-5f,5f);
  798. Separation2.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
  799. Separation2.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
  800. Separation2.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
  801. Separation2.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 5f * (1 - 19 * i));
  802. Separation2.GetComponent<Image>().color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
  803. }
  804. }
  805. private void 載入報告書項目清單(string 文件號){
  806. SQL_Comm.SQL_取得報告書項目清單(報告書流水號_tb.text,文件號);
  807. DataSet ds1 = new();
  808. SQL_Module.da.Fill(ds1);
  809. Global.報告書項目清單_tabel = ds1.Tables[0];
  810. 載入報告書項目清單表格("報告書項目清單",ds1.Tables[0],報告書項目清單_tp,報告書項目清單_rpf,報告書項目清單_ct,myFont,UIsprite,報告書項目清單_lpf,true);
  811. }
  812. private void 載入報告書項目清單表格(string table_name,DataTable table,Transform tableParent,GameObject rowPrefab,GameObject ceneter,TMP_FontAsset myFont,Sprite UIsprite,
  813. GameObject LinePrefab,bool overflowMode){
  814. Module.清除控件(ceneter);
  815. Image centerImage = ceneter.GetComponent<Image>();
  816. if(centerImage == null){
  817. centerImage = ceneter.AddComponent<Image>();
  818. centerImage.type = Image.Type.Sliced;
  819. }
  820. centerImage.sprite = UIsprite;
  821. centerImage.fillCenter = false;
  822. centerImage.color = Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
  823. for (int i = 0; i < table.Rows.Count; i++){
  824. GameObject row = Instantiate(rowPrefab, tableParent);
  825. row.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, (-90 * i)+(-5*i));
  826. string value = table.Rows[i][1].ToString();
  827. GameObject cellText = new(table_name+"_Cells_"+i.ToString()+"_1");
  828. cellText.transform.SetParent(row.transform, false);
  829. cellText.AddComponent<TextMeshProUGUI>().text = value;
  830. cellText.GetComponent<TextMeshProUGUI>().tag="Cells";
  831. if(overflowMode){cellText.GetComponent<TextMeshProUGUI>().overflowMode=TextOverflowModes.Ellipsis;}
  832. cellText.AddComponent<Button>();
  833. cellText.GetComponent<Button>().onClick.AddListener(() => { 按鈕事件(cellText); });
  834. cellText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
  835. cellText.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
  836. cellText.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
  837. cellText.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
  838. cellText.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().rect.width, 90f);
  839. }
  840. TextMeshProUGUI[] texts = ceneter.GetComponentsInChildren<TextMeshProUGUI>();
  841. foreach (TextMeshProUGUI text in texts){
  842. if(text.tag.Contains("Cells")){
  843. text.font = myFont;
  844. text.color = Global.系統主題 == 1 ? new Color(0, 0, 0, 1) : text.color;
  845. text.alignment = TextAlignmentOptions.Center;
  846. text.fontStyle = FontStyles.Bold;
  847. text.fontSize=42;
  848. text.margin = new Vector4(10, 0, 10, 0);
  849. }else{
  850. }
  851. }
  852. ceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().sizeDelta.x,table.Rows.Count*90f +((table.Rows.Count-1)*5f));
  853. //========建立分隔線=============
  854. for(int i=1;i<=table.Rows.Count-1;i++){
  855. GameObject Separation2 = Instantiate(LinePrefab, tableParent);
  856. Separation2.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().rect.width-5f,5f);
  857. Separation2.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
  858. Separation2.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
  859. Separation2.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
  860. Separation2.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 5f * (1 - 19 * i));
  861. Separation2.GetComponent<Image>().color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
  862. }
  863. }
  864. private void 載入報告書圖片(string table_name,DataTable table,Transform tableParent,GameObject rowPrefab,GameObject ceneter,TMP_FontAsset myFont,Sprite UIsprite,
  865. GameObject LinePrefab,bool overflowMode){
  866. Module.清除控件(ceneter);
  867. Image centerImage = ceneter.GetComponent<Image>();
  868. if(centerImage == null){
  869. centerImage = ceneter.AddComponent<Image>();
  870. centerImage.type = Image.Type.Sliced;
  871. }
  872. centerImage.sprite = UIsprite;
  873. centerImage.fillCenter = false;
  874. centerImage.color = Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
  875. for (int i = 0; i < table.Rows.Count; i++){
  876. GameObject row = Instantiate(rowPrefab, tableParent);
  877. row.GetComponent<RectTransform>().anchoredPosition = new Vector2(rowPrefab.GetComponent<RectTransform>().rect.width*i ,0);
  878. GameObject Imagg = Instantiate(LinePrefab, row.GetComponent<Transform>());
  879. RawImage image = Imagg.AddComponent<RawImage>();
  880. byte[] imageData = (byte[])table.Rows[i][1];
  881. Texture2D texture = new(1, 1);
  882. texture.LoadImage(imageData);
  883. image.texture = texture;
  884. if (texture.width > texture.height){
  885. float scaleFactor = rowPrefab.GetComponent<RectTransform>().rect.width / texture.width;
  886. image.rectTransform.sizeDelta = new Vector2(row.GetComponent<RectTransform>().rect.width, texture.height * scaleFactor);
  887. }else{
  888. float scaleFactor = rowPrefab.GetComponent<RectTransform>().rect.width / texture.height;
  889. image.rectTransform.sizeDelta = new Vector2(texture.width * scaleFactor, row.GetComponent<RectTransform>().rect.width);
  890. }
  891. }
  892. int numm;
  893. if(table.Rows.Count>0){numm=table.Rows.Count;}else{numm=1;}
  894. ceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(rowPrefab.GetComponent<RectTransform>().rect.width*numm, rowPrefab.GetComponent<RectTransform>().sizeDelta.y);
  895. }
  896. private void Set_客戶清單(){
  897. SQL_Comm.SQL_報告書_客戶清單(Global.gUser區域);
  898. // 客戶編號, 來電日期, 申請人, 聯繫人, 聯繫電話, 地址, 需求, 特殊需求
  899. DataSet ds1 = new();
  900. SQL_Module.da.Fill(ds1);
  901. string[] columnNames = new string[]{ds1.Tables[0].Columns[0].ColumnName,ds1.Tables[0].Columns[2].ColumnName,ds1.Tables[0].Columns[3].ColumnName};
  902. DataTable table1 = ds1.Tables[0].DefaultView.ToTable(false, columnNames);Global.客戶清單_tabel=ds1.Tables[0];
  903. 載入客戶清單表格("客戶清單",table1,客戶清單_tp,客戶清單_rpf,客戶清單_ct,myFont,UIsprite,客戶清單_lpf,true);
  904. }
  905. private void 載入客戶清單表格(string table_name,DataTable table,Transform tableParent,GameObject rowPrefab,GameObject ceneter,TMP_FontAsset myFont,Sprite UIsprite,
  906. GameObject LinePrefab,bool overflowMode){
  907. Module.清除控件(客戶清單表頭_pl);
  908. for (int j = 0; j <= table.Columns.Count-1; j++){
  909. GameObject headerText = new(table_name+"_Headers (Clone)");
  910. headerText.transform.SetParent(客戶清單表頭_pl.transform, false);
  911. headerText.AddComponent<TextMeshProUGUI>().text = table.Columns[j].ColumnName;
  912. headerText.GetComponent<TextMeshProUGUI>().tag="Cells";
  913. if(overflowMode){headerText.GetComponent<TextMeshProUGUI>().overflowMode=TextOverflowModes.Ellipsis;}
  914. if(j==0){
  915. headerText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
  916. headerText.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
  917. headerText.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
  918. headerText.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
  919. float x = 客戶清單表頭_pl.GetComponent<RectTransform>().rect.width -420f;
  920. headerText.GetComponent<RectTransform>().sizeDelta = new Vector2(x, 90f);
  921. }else if(j==1){
  922. headerText.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
  923. headerText.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
  924. headerText.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f);
  925. headerText.GetComponent<RectTransform>().sizeDelta = new Vector2(205f, 90f);
  926. headerText.GetComponent<RectTransform>().anchoredPosition=new Vector2(-210f,0f);
  927. }else{
  928. headerText.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
  929. headerText.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
  930. headerText.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f);
  931. headerText.GetComponent<RectTransform>().sizeDelta = new Vector2(205f, 90f);
  932. headerText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
  933. }
  934. }
  935. for(int j = 0; j <= table.Columns.Count-2; j++){
  936. GameObject Separation2 = Instantiate(LinePrefab, 客戶清單表頭_pl.transform);
  937. Separation2.GetComponent<RectTransform>().sizeDelta = new Vector2(5f,客戶清單表頭_pl.GetComponent<RectTransform>().sizeDelta.y-5f);
  938. Separation2.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
  939. Separation2.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
  940. Separation2.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f);
  941. Separation2.GetComponent<Image>().color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
  942. if(j==0){
  943. Separation2.GetComponent<RectTransform>().anchoredPosition = new Vector2(-205f,-3f);
  944. }else{
  945. Separation2.GetComponent<RectTransform>().anchoredPosition = new Vector2(-415f,-3f);
  946. }
  947. }
  948. TextMeshProUGUI[] texts = 客戶清單表頭_pl.GetComponentsInChildren<TextMeshProUGUI>();
  949. foreach (TextMeshProUGUI text in texts){
  950. if(text.tag.Contains("Cells")){
  951. text.font = myFont;
  952. text.color = Global.系統主題 == 1 ? new Color(0, 0, 0, 1) : text.color;
  953. text.alignment = TextAlignmentOptions.Center;
  954. text.fontStyle = FontStyles.Bold;
  955. text.fontSize=42;
  956. text.margin = new Vector4(10, 0, 10, 0);
  957. }else{
  958. }
  959. }
  960. //==========================================
  961. Module.清除控件(ceneter);
  962. Image centerImage = ceneter.GetComponent<Image>();
  963. if(centerImage == null){
  964. centerImage = ceneter.AddComponent<Image>();
  965. centerImage.type = Image.Type.Sliced;
  966. }
  967. centerImage.sprite = UIsprite;
  968. centerImage.fillCenter = false;
  969. centerImage.color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
  970. for (int i = 0; i < table.Rows.Count; i++){
  971. GameObject row = Instantiate(rowPrefab, tableParent);
  972. row.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, (-90 * i)+(-5*i));
  973. for (int j = 0; j < table.Columns.Count; j++){
  974. string value = table.Rows[i][j].ToString();
  975. GameObject cellText = new(table_name+"_Cells_"+i.ToString()+"_"+j.ToString());
  976. cellText.transform.SetParent(row.transform, false);
  977. cellText.AddComponent<TextMeshProUGUI>().text = value;
  978. cellText.GetComponent<TextMeshProUGUI>().tag="Cells";
  979. if(overflowMode){cellText.GetComponent<TextMeshProUGUI>().overflowMode=TextOverflowModes.Ellipsis;}
  980. cellText.AddComponent<Button>();
  981. cellText.GetComponent<Button>().onClick.AddListener(() => { 按鈕事件(cellText); });
  982. if(j==0){
  983. cellText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
  984. cellText.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
  985. cellText.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
  986. cellText.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
  987. float x = ceneter.GetComponent<RectTransform>().rect.width -420f;
  988. cellText.GetComponent<RectTransform>().sizeDelta = new Vector2(x, 90f);
  989. }else if(j==1){
  990. cellText.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
  991. cellText.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
  992. cellText.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f);
  993. cellText.GetComponent<RectTransform>().sizeDelta = new Vector2(205f, 90f);
  994. cellText.GetComponent<RectTransform>().anchoredPosition=new Vector2(-210f,0f);
  995. }else{
  996. cellText.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
  997. cellText.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
  998. cellText.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f);
  999. cellText.GetComponent<RectTransform>().sizeDelta = new Vector2(205, 90f);
  1000. cellText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
  1001. }
  1002. }
  1003. }
  1004. texts = ceneter.GetComponentsInChildren<TextMeshProUGUI>();
  1005. foreach (TextMeshProUGUI text in texts){
  1006. if(text.tag.Contains("Cells")){
  1007. text.font = myFont;
  1008. text.color = Global.系統主題 == 1 ? new Color(0, 0, 0, 1) : text.color;
  1009. text.alignment = TextAlignmentOptions.Center;
  1010. //text.fontStyle = FontStyles.Bold;
  1011. text.fontSize=42;
  1012. //text.enableAutoSizing = true;
  1013. //text.autoSizeTextContainer = true;
  1014. text.margin = new Vector4(10, 0, 10, 0);
  1015. }else{
  1016. }
  1017. }
  1018. ceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().sizeDelta.x,table.Rows.Count*90f +((table.Rows.Count-1)*5f));
  1019. //========建立分隔線=============
  1020. for(int i=0;i<=table.Columns.Count-2;i++){
  1021. GameObject Separation = Instantiate(LinePrefab, tableParent);
  1022. Separation.GetComponent<RectTransform>().sizeDelta = new Vector2(5f,ceneter.GetComponent<RectTransform>().sizeDelta.y-5f);
  1023. Separation.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
  1024. Separation.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
  1025. Separation.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f);
  1026. Separation.GetComponent<Image>().color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
  1027. Separation.GetComponent<RectTransform>().anchoredPosition = new Vector2(-210f*i-205f,-3f);
  1028. }
  1029. for(int i=1;i<=table.Rows.Count-1;i++){
  1030. GameObject Separation2 = Instantiate(LinePrefab, tableParent);
  1031. Separation2.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().rect.width-5f,5f);
  1032. Separation2.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
  1033. Separation2.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
  1034. Separation2.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
  1035. Separation2.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 5f * (1 - 19 * i));
  1036. Separation2.GetComponent<Image>().color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
  1037. }
  1038. }
  1039. private void Set_長照物料清單(string 類別,string 編號,Transform tableParent,GameObject rowPrefab,GameObject ceneter,GameObject LinePrefab,string 清單名稱){
  1040. SQL_Comm.SQL_報告書_項目物料清單(類別,編號);
  1041. // 客戶編號, 來電日期, 申請人, 聯繫人, 聯繫電話, 地址, 需求, 特殊需求
  1042. DataSet ds1 = new();
  1043. SQL_Module.da.Fill(ds1);
  1044. for(int i=0;i<=ds1.Tables[0].Rows.Count-1;i++){
  1045. ds1.Tables[0].Rows[i][0]=ds1.Tables[0].Rows[i][1].ToString()+"-"+ds1.Tables[0].Rows[i][2].ToString();
  1046. }
  1047. Global.長照物料清單_tabel = ds1.Tables[0];
  1048. string[] columnNames = new string[]{ds1.Tables[0].Columns[0].ColumnName};
  1049. DataTable table1 = ds1.Tables[0].DefaultView.ToTable(false, columnNames);
  1050. 載入長照物料清單表格(清單名稱,table1,tableParent,rowPrefab,ceneter,myFont,UIsprite,LinePrefab,true);
  1051. //載入長照物料清單表格("項目物料清單",table1,tableParent,rowPrefab,ceneter,myFont,UIsprite,LinePrefab,true);
  1052. }
  1053. private void 載入長照物料清單表格(string table_name,DataTable table,Transform tableParent,GameObject rowPrefab,GameObject ceneter,TMP_FontAsset myFont,Sprite UIsprite,
  1054. GameObject LinePrefab,bool overflowMode){
  1055. Module.清除控件(ceneter);
  1056. Image centerImage = ceneter.GetComponent<Image>();
  1057. if(centerImage == null){
  1058. centerImage = ceneter.AddComponent<Image>();
  1059. centerImage.type = Image.Type.Sliced;
  1060. }
  1061. centerImage.sprite = UIsprite;
  1062. centerImage.fillCenter = false;
  1063. centerImage.color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
  1064. for (int i = 0; i < table.Rows.Count; i++){
  1065. GameObject row = Instantiate(rowPrefab, tableParent);
  1066. row.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, (-90 * i)+(-5*i));
  1067. string value = table.Rows[i][0].ToString();
  1068. GameObject cellText = new(table_name+"_Cells_"+i.ToString().PadLeft(2,'0'));
  1069. cellText.transform.SetParent(row.transform, false);
  1070. cellText.AddComponent<TextMeshProUGUI>().text = value;
  1071. cellText.GetComponent<TextMeshProUGUI>().tag="Cells";
  1072. if(overflowMode){cellText.GetComponent<TextMeshProUGUI>().overflowMode=TextOverflowModes.Ellipsis;}
  1073. cellText.AddComponent<Button>();
  1074. cellText.GetComponent<Button>().onClick.AddListener(() => { 按鈕事件(cellText); });
  1075. cellText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
  1076. cellText.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
  1077. cellText.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
  1078. cellText.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
  1079. cellText.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().rect.width, 90f);
  1080. }
  1081. TextMeshProUGUI[] texts = ceneter.GetComponentsInChildren<TextMeshProUGUI>();
  1082. foreach (TextMeshProUGUI text in texts){
  1083. if(text.tag.Contains("Cells")){
  1084. text.font = myFont;
  1085. text.color = Global.系統主題 == 1 ? new Color(0, 0, 0, 1) : text.color;
  1086. text.alignment = TextAlignmentOptions.Left;
  1087. text.fontStyle = FontStyles.Bold;
  1088. text.fontSize = 30;
  1089. text.margin = new Vector4(10, 0, 10, 0);
  1090. }else{
  1091. }
  1092. }
  1093. ceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().sizeDelta.x,table.Rows.Count*90f+((table.Rows.Count-1)*5f));
  1094. //========建立分隔線=============
  1095. for(int i=1;i<=table.Rows.Count-1;i++){
  1096. GameObject Separation2 = Instantiate(LinePrefab, tableParent);
  1097. Separation2.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().rect.width-5f,5f);
  1098. Separation2.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
  1099. Separation2.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
  1100. Separation2.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
  1101. Separation2.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 5f * (1 - 19 * i));
  1102. Separation2.GetComponent<Image>().color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
  1103. }
  1104. }
  1105. public void 按鈕事件(GameObject cell_text){
  1106. if(cell_text.name.Contains("報告書清單")){
  1107. string row=cell_text.name.Substring(cell_text.name.Length-3,1);
  1108. 返回2_bt.SetActive(false);返回3_bt.SetActive(true);
  1109. 報告書流水號_tb.text = Global.報告書清單_tabel.Rows[int.Parse(row)][0].ToString();
  1110. 報告書項目清單_報告書號_tb.text = Global.報告書清單_tabel.Rows[int.Parse(row)][0].ToString();
  1111. 報告書人員清單_pl.SetActive(false);報告書人員資料_pl.SetActive(false);報告書項目清單_pl.SetActive(true);
  1112. }else if(cell_text.name.Contains("報告書人員清單")){
  1113. //Set_報告書人員資料();
  1114. Debug.Log(cell_text.name);
  1115. Match match = Regex.Match(cell_text.name, @"_(\d+)_");
  1116. string row=match.Groups[1].Value;
  1117. Debug.Log(row);
  1118. string 客戶編號 = Global.報告書人員清單_tabel.Rows[int.Parse(row)]["客戶編號"].ToString();
  1119. string 申請人 = Global.報告書人員清單_tabel.Rows[int.Parse(row)]["申請人"].ToString();
  1120. string 聯繫人 = Global.報告書人員清單_tabel.Rows[int.Parse(row)]["聯繫人"].ToString();
  1121. string 聯繫人電話 = Global.報告書人員清單_tabel.Rows[int.Parse(row)]["聯繫電話"].ToString();
  1122. string 住址 = Global.報告書人員清單_tabel.Rows[int.Parse(row)]["地址"].ToString();
  1123. string 聯繫人2 = Global.報告書人員清單_tabel.Rows[int.Parse(row)]["聯繫人3"].ToString();
  1124. string 聯繫人2電話 = Global.報告書人員清單_tabel.Rows[int.Parse(row)]["聯繫人3電話"].ToString();
  1125. Set_報告書清單(客戶編號,申請人,聯繫人,聯繫人電話,住址,聯繫人2,聯繫人2電話);
  1126. }else if(cell_text.name.Contains("文件號清單")){
  1127. Module.清除底色(文件號清單_ct);Global.報告書物料明細流水號="";Global.報告書物料料號 ="";報告書扶手總長_tb.text="";單項扶手長度_tb.text="";
  1128. cell_text.GetComponentInParent<Image>().color = new Color(0.67f,1f,0.4f,1f);
  1129. string 文件號id = cell_text.GetComponent<TextMeshProUGUI>().text;
  1130. for(int i=0;i<=Global.文件號清單_table.Rows.Count-1;i++){
  1131. if(文件號id==Global.文件號清單_table.Rows[i][0].ToString()){
  1132. Global.報告書文件號 =Global.文件號清單_table.Rows[i][1].ToString();
  1133. }
  1134. }
  1135. if(Global.報告書施工狀態!="文件號"){
  1136. PhotoScroll.清除currentPage();
  1137. }else{
  1138. 載入施工圖片();
  1139. }
  1140. 載入報告書項目清單(Global.報告書文件號);
  1141. }else if(cell_text.name.Contains("報告書項目清單")){
  1142. Module.清除底色(報告書項目清單_ct);
  1143. cell_text.GetComponentInParent<Image>().color = new Color(0.67f,1f,0.4f,1f);
  1144. string row=cell_text.name.Substring(cell_text.name.Length-3,1);
  1145. Global.報告書物料料號 = cell_text.GetComponent<TextMeshProUGUI>().text;
  1146. Global.報告書物料明細流水號 = Global.報告書項目清單_tabel.Rows[int.Parse(row)][0].ToString();
  1147. if(cell_text.GetComponent<TextMeshProUGUI>().text=="FA01" || cell_text.GetComponent<TextMeshProUGUI>().text=="137" ||
  1148. cell_text.GetComponent<TextMeshProUGUI>().text=="FA09" || cell_text.GetComponent<TextMeshProUGUI>().text=="152"){
  1149. if(cell_text.GetComponent<TextMeshProUGUI>().text=="FA01" || cell_text.GetComponent<TextMeshProUGUI>().text=="137"){
  1150. 扶手總長2_lb.text="扶手總長";
  1151. 扶手長度_lb.text="扶手長度";
  1152. 請輸入扶手總長度_lb.text="請輸入扶手總長度";
  1153. 扶手總長度_lb.text="扶手總長度";
  1154. 已使用扶手長度_lb.text="已使用扶手長度";
  1155. 可使用扶手長度_lb.text="可使用扶手長度";
  1156. 扶手長度2_lb.text="扶手長度";
  1157. }else{
  1158. 扶手總長2_lb.text="總單位";
  1159. 扶手長度_lb.text="單位";
  1160. 請輸入扶手總長度_lb.text="請輸入總單位";
  1161. 扶手總長度_lb.text="總單位";
  1162. 已使用扶手長度_lb.text="已使用單位";
  1163. 可使用扶手長度_lb.text="可使用單位";
  1164. 扶手長度2_lb.text="單位";
  1165. }
  1166. 報告書扶手總長_tb.text = Global.報告書項目清單_tabel.Rows[int.Parse(row)][2].ToString();
  1167. }else{
  1168. 報告書扶手總長_tb.text = "不適用";
  1169. 單項扶手長度_tb.text = "不適用";
  1170. }
  1171. if(Global.報告書施工狀態!="文件號"){
  1172. 載入施工圖片();
  1173. PhotoScroll.清除currentPage();
  1174. }
  1175. }else if(cell_text.name.Contains("客戶清單")){
  1176. int NUM1;string dat1,報告書號;
  1177. Set_日期格式轉換();SQL_Comm.SQL_取得加盟商編號(Global.gUser區域);
  1178. if(SQL_Module.dr.Read()){
  1179. Global.gUser加盟商編號=SQL_Module.dr[0].ToString();
  1180. }else{
  1181. Global.gUser加盟商編號="未設定加盟商";
  1182. }
  1183. SQL_Comm.SQL_報告書_查詢流水號(Global.gUser區域);
  1184. if(SQL_Module.dr.Read()){
  1185. 報告書號 = SQL_Module.dr["流水號"].ToString();
  1186. }else{
  1187. 報告書號 = "RE" + Global.DTP1[2..] + "00-" + Global.gUser加盟商編號;
  1188. }
  1189. dat1 = 報告書號.Substring(2, 6);
  1190. if(dat1 != Global.DTP1[2..]){
  1191. NUM1 = 1;
  1192. }else{
  1193. NUM1 = int.Parse(報告書號.Substring(8, 2)) + 1;
  1194. }
  1195. 報告書號 = "RE" + Global.DTP1[2..] + NUM1.ToString().PadLeft(2, '0') + "-" + Global.gUser加盟商編號;
  1196. string 圖檔資料庫;
  1197. SQL_Comm.SQL_查詢圖檔資料庫();
  1198. if(SQL_Module.dr.Read()){
  1199. 圖檔資料庫 = SQL_Module.dr[0].ToString();
  1200. string 日期 = DateTime.Today.Year.ToString().PadLeft(4,'0')+"/"+DateTime.Today.Month.ToString().PadLeft(2,'0')+"/"+DateTime.Today.Day.ToString().PadLeft(2,'0');
  1201. SQL_Comm.SQL_報告書_新增(報告書號,cell_text.GetComponent<TextMeshProUGUI>().text, 日期, Global.使用者暱稱, Global.gUser區域, 圖檔資料庫);
  1202. 主頁面調整(false,true,false);
  1203. 回上頁_bt.SetActive(true);拍照_bt.SetActive(true);業務系統_bt.SetActive(false);系統設定_bt.SetActive(false);
  1204. 新增項目_bt.SetActive(true);刪除項目_bt.SetActive(true);
  1205. 選擇客戶_pl.SetActive(false);評估詳細_pl.SetActive(true);評估主頁_pl.SetActive(false);
  1206. 報告書流水號_tb.text=報告書號;
  1207. 載入報告書詳細資料(報告書號);
  1208. }else{
  1209. 彈跳_pl.SetActive(true);
  1210. 彈跳文字_tb.text="無可用資料庫,請通知系統商新增資料庫";
  1211. Global.彈跳判斷="新增報告書";
  1212. }
  1213. }else if(cell_text.name.Contains("項目物料清單")){
  1214. 報告書圖片_pl.SetActive(true);新增項目_pl.SetActive(false);
  1215. string 物料料號;
  1216. string row=cell_text.name.Substring(cell_text.name.Length-2,2);
  1217. 物料料號=Global.長照物料清單_tabel.Rows[int.Parse(row)][1].ToString();
  1218. if(物料料號=="FA01" || 物料料號=="137" || 物料料號=="FA09" || 物料料號=="152"){
  1219. if(物料料號=="FA01" || 物料料號=="137"){
  1220. 扶手總長2_lb.text="扶手總長";
  1221. 扶手長度_lb.text="扶手長度";
  1222. 請輸入扶手總長度_lb.text="請輸入扶手總長度";
  1223. 扶手總長度_lb.text="扶手總長度";
  1224. 已使用扶手長度_lb.text="已使用扶手長度";
  1225. 可使用扶手長度_lb.text="可使用扶手長度";
  1226. 扶手長度2_lb.text="扶手長度";
  1227. }else{
  1228. 扶手總長2_lb.text="總單位";
  1229. 扶手長度_lb.text="單位";
  1230. 請輸入扶手總長度_lb.text="請輸入總單位";
  1231. 扶手總長度_lb.text="總單位";
  1232. 已使用扶手長度_lb.text="已使用單位";
  1233. 可使用扶手長度_lb.text="可使用單位";
  1234. 扶手長度2_lb.text="單位";
  1235. }
  1236. Global.輸入物料料號=物料料號;
  1237. 輸入扶手長度_pl.SetActive(true);
  1238. }else{
  1239. SQL_Comm.SQL_報告書_讀取流水號();
  1240. string 明細流水號;double NUM;
  1241. if(SQL_Module.dr.Read()){明細流水號 = SQL_Module.dr["流水號"].ToString();}else{明細流水號 = "WS00000000";}
  1242. NUM = double.Parse(明細流水號.Substring(2, 8)) + 1;
  1243. 明細流水號 = "WS" + NUM.ToString().PadLeft(8, '0');
  1244. SQL_Comm.SQL_報告書_明細寫入(明細流水號, Global.報告書文件號, 物料料號, "", 報告書流水號_tb.text,"0");
  1245. 載入報告書項目清單(Global.報告書文件號);
  1246. }
  1247. }else if(cell_text.name.Contains("報告書評估報告書1清單")){
  1248. Module.清除底色(報告書施作項目清單_ct);
  1249. cell_text.GetComponentInParent<Image>().color = new Color(0.67f,1f,0.4f,1f);
  1250. string row=cell_text.name.Substring(cell_text.name.Length-3,1);
  1251. Global.報告書物料料號 = Global.報告書評估報告書1清單_tabel.Rows[int.Parse(row)][2].ToString();
  1252. Global.報告書物料明細流水號 = Global.報告書評估報告書1清單_tabel.Rows[int.Parse(row)][0].ToString();
  1253. 施工前_img.color = new Color(1f,1f,1f,1f);
  1254. 施工後_img.color = new Color(1f,1f,1f,1f);
  1255. Module.清除控件(報告書施作圖片_ct);
  1256. PhotoScroll.清除currentPage();
  1257. }else if(cell_text.name.Contains("報告書評估報告書2清單")){
  1258. Module.清除底色(報告書施作項目清單_ct);
  1259. cell_text.GetComponentInParent<Image>().color = new Color(0.67f,1f,0.4f,1f);
  1260. string row=cell_text.name.Substring(cell_text.name.Length-3,1);
  1261. Global.報告書物料料號 = Global.報告書評估報告書2清單_tabel.Rows[int.Parse(row)][2].ToString();
  1262. Global.報告書物料明細流水號 = Global.報告書評估報告書2清單_tabel.Rows[int.Parse(row)][0].ToString();
  1263. 施工前_img.color = new Color(1f,1f,1f,1f);
  1264. 施工後_img.color = new Color(1f,1f,1f,1f);
  1265. Module.清除控件(報告書施作圖片_ct);
  1266. PhotoScroll.清除currentPage();
  1267. }else if(cell_text.name.Contains("評估報告書1物料清單")){
  1268. 評估報告書1_物料清單_sv.SetActive(false);返回6_bt.SetActive(true);施作圖片_pl.SetActive(true);返回7_bt.SetActive(false);
  1269. string 物料料號;
  1270. string row=cell_text.name.Substring(cell_text.name.Length-2,2);
  1271. 物料料號=Global.長照物料清單_tabel.Rows[int.Parse(row)][1].ToString();
  1272. SQL_Comm.SQL_報告書_讀取流水號();
  1273. string 明細流水號;double NUM;
  1274. if(SQL_Module.dr.Read()){明細流水號 = SQL_Module.dr["流水號"].ToString();}else{明細流水號 = "WS00000000";}
  1275. NUM = double.Parse(明細流水號.Substring(2, 8)) + 1;
  1276. 明細流水號 = "WS" + NUM.ToString().PadLeft(8, '0');
  1277. SQL_Comm.SQL_報告書_明細寫入(明細流水號,"評估報告書1", 物料料號, "", 報告書流水號_tb.text,"0");
  1278. Set_評估報告書1清單("評估報告書1");
  1279. }else if(cell_text.name.Contains("評估報告書2物料清單")){
  1280. 評估報告書1_物料清單_sv.SetActive(false);返回6_bt.SetActive(true);施作圖片_pl.SetActive(true);返回7_bt.SetActive(false);
  1281. string 物料料號;
  1282. string row=cell_text.name.Substring(cell_text.name.Length-2,2);
  1283. 物料料號=Global.長照物料清單_tabel.Rows[int.Parse(row)][1].ToString();
  1284. SQL_Comm.SQL_報告書_讀取流水號();
  1285. string 明細流水號;double NUM;
  1286. if(SQL_Module.dr.Read()){明細流水號 = SQL_Module.dr["流水號"].ToString();}else{明細流水號 = "WS00000000";}
  1287. NUM = double.Parse(明細流水號.Substring(2, 8)) + 1;
  1288. 明細流水號 = "WS" + NUM.ToString().PadLeft(8, '0');
  1289. SQL_Comm.SQL_報告書_明細寫入(明細流水號,"評估報告書2", 物料料號, "", 報告書流水號_tb.text,"0");
  1290. Set_評估報告書1清單("評估報告書2");
  1291. }
  1292. }
  1293. private void 載入圖片清單2(string 階段,Transform 文件圖片_tp, GameObject 文件圖片_rpf, GameObject 文件圖片_ct, GameObject 文件圖片_lpf,GameObject 圖片讀取,GameObject 圖片寬度){
  1294. 圖片讀取.SetActive(true);
  1295. Module.清除控件(文件圖片_ct);
  1296. SQL_Comm.SQL_取得報告書資料(報告書項目清單_報告書號_tb.text);
  1297. if(SQL_Module.dr.Read()){
  1298. 報告書申請人_tb.text = SQL_Module.dr["負責人"].ToString();
  1299. 報告書開立人_tb.text = SQL_Module.dr["開立人"].ToString();
  1300. Global.圖檔資料庫 = SQL_Module.dr["圖檔資料庫"].ToString();
  1301. Debug.Log(Global.圖檔資料庫);
  1302. SQL_CommString.SQL_連線字串_圖片_SQL(Global.圖檔資料庫,Global.資料庫IP);
  1303. SQL_Comm.SQL_報告書_施工圖片清單(報告書項目清單_報告書號_tb.text,階段,Global.報告書選項2,Global.報告書物料料號,Global.報告書物料明細流水號);
  1304. DataSet ds1 = new();
  1305. SQL_Module.da.Fill(ds1);
  1306. if(ds1.Tables[0].Rows.Count>0){
  1307. 施作圖片相片目前_tb.text="1";施作圖片相片總數_tb.text=ds1.Tables[0].Rows.Count.ToString();
  1308. 施作圖片相片文件號_tb.text = ds1.Tables[0].Rows[0][0].ToString();
  1309. }else{
  1310. 施作圖片相片目前_tb.text="-";施作圖片相片總數_tb.text="-";施作圖片相片文件號_tb.text ="文件號";
  1311. }
  1312. Global.報告書施作圖片_table = ds1.Tables[0];
  1313. 文件圖片_ct.GetComponent<RectTransform>().sizeDelta=new Vector2(圖片寬度.GetComponent<RectTransform>().rect .width,文件圖片_ct.GetComponent<RectTransform>().sizeDelta.y);
  1314. 文件圖片_rpf.GetComponent<RectTransform>().sizeDelta=new Vector2(圖片寬度.GetComponent<RectTransform>().rect .width,文件圖片_rpf.GetComponent<RectTransform>().sizeDelta.y);
  1315. 載入報告書圖片("報告書"+階段,ds1.Tables[0],文件圖片_tp,文件圖片_rpf,文件圖片_ct,myFont,UIsprite,文件圖片_lpf,true);
  1316. 圖片讀取.SetActive(false);
  1317. }
  1318. }
  1319. public void 施工前2(){
  1320. 施工前_img.color = new Color(0.67f,1f,0.4f,1f);
  1321. 施工後_img.color = new Color(1f,1f,1f,1f);
  1322. 產品序號_img.color = new Color(1f,1f,1f,1f);
  1323. Global.報告書施工狀態="施工前";
  1324. 拍照1_bt.SetActive(true);刪除1_bt.SetActive(true);存檔1_bt.SetActive(true);
  1325. 載入圖片清單2(Global.報告書施工狀態,報告書施作圖片_tp,報告書施作圖片_rpf,報告書施作圖片_ct,報告書施作圖片_lpf,施作圖片圖片讀取_pl,施作圖片圖片寬度_pl);
  1326. PhotoScroll.清除currentPage();
  1327. }
  1328. public void 施工後2(){
  1329. 施工前_img.color = new Color(1f,1f,1f,1f);
  1330. 施工後_img.color = new Color(0.67f,1f,0.4f,1f);
  1331. 產品序號_img.color = new Color(1f,1f,1f,1f);
  1332. 拍照1_bt.SetActive(true);刪除1_bt.SetActive(true);存檔1_bt.SetActive(true);
  1333. Global.報告書施工狀態="施工後";
  1334. 載入圖片清單2(Global.報告書施工狀態,報告書施作圖片_tp,報告書施作圖片_rpf,報告書施作圖片_ct,報告書施作圖片_lpf,施作圖片圖片讀取_pl,施作圖片圖片寬度_pl);
  1335. PhotoScroll.清除currentPage();
  1336. }
  1337. public void 產品序號2(){
  1338. 施工前_img.color = new Color(1f,1f,1f,1f);
  1339. 施工後_img.color = new Color(1f,1f,1f,1f);
  1340. 產品序號_img.color = new Color(0.67f,1f,0.4f,1f);
  1341. 拍照1_bt.SetActive(true);刪除1_bt.SetActive(true);存檔1_bt.SetActive(true);
  1342. Global.報告書施工狀態="產品序號";
  1343. 載入圖片清單2(Global.報告書施工狀態,報告書施作圖片_tp,報告書施作圖片_rpf,報告書施作圖片_ct,報告書施作圖片_lpf,施作圖片圖片讀取_pl,施作圖片圖片寬度_pl);
  1344. PhotoScroll.清除currentPage();
  1345. }
  1346. private void 載入施工圖片(){
  1347. 圖片讀取_pl.SetActive(true);
  1348. Module.清除控件(報告書施工圖片_ct);
  1349. if(Global.報告書施工狀態=="文件號"){
  1350. SQL_Comm.SQL_報告書_報告書圖片清單(報告書流水號_tb.text,"報告書",Global.報告書文件號);
  1351. }else{
  1352. SQL_Comm.SQL_報告書_施工圖片清單(報告書流水號_tb.text,Global.報告書施工狀態,Global.報告書文件號,Global.報告書物料料號,Global.報告書物料明細流水號);
  1353. }
  1354. DataSet ds1 = new();
  1355. SQL_Module.da.Fill(ds1);
  1356. if(ds1.Tables[0].Rows.Count>0){
  1357. 相片目前_tb.text="1";相片總數_tb.text=ds1.Tables[0].Rows.Count.ToString();更換照片_bt.SetActive(true);刪除照片_bt.SetActive(true);
  1358. }else{
  1359. 相片目前_tb.text="-";相片總數_tb.text="-";更換照片_bt.SetActive(false);刪除照片_bt.SetActive(false);
  1360. }
  1361. Global.報告書施工圖片_table = ds1.Tables[0];
  1362. 報告書施工圖片_ct.GetComponent<RectTransform>().sizeDelta=new Vector2(圖片寬度_pl.GetComponent<RectTransform>().rect .width,報告書施工圖片_ct.GetComponent<RectTransform>().sizeDelta.y);
  1363. 報告書施工圖片_rpf.GetComponent<RectTransform>().sizeDelta=new Vector2(圖片寬度_pl.GetComponent<RectTransform>().rect .width,報告書施工圖片_rpf.GetComponent<RectTransform>().sizeDelta.y);
  1364. 載入報告書圖片("報告書施工圖片",ds1.Tables[0],報告書施工圖片_tp,報告書施工圖片_rpf,報告書施工圖片_ct,myFont,UIsprite,報告書施工圖片_lpf,true);
  1365. if(Global.報告書施工狀態 == "施工前" && ds1.Tables[0].Rows.Count > 0 && (Global.報告書物料料號 == "FA01" || Global.報告書物料料號 == "137" || Global.報告書物料料號 == "FA09" || Global.報告書物料料號 == "152")){
  1366. if(Global.報告書物料料號=="FA01" || Global.報告書物料料號=="137"){
  1367. 扶手總長2_lb.text="扶手總長";
  1368. 扶手長度_lb.text="扶手長度";
  1369. 請輸入扶手總長度_lb.text="請輸入扶手總長度";
  1370. 扶手總長度_lb.text="扶手總長度";
  1371. 已使用扶手長度_lb.text="已使用扶手長度";
  1372. 可使用扶手長度_lb.text="可使用扶手長度";
  1373. 扶手長度2_lb.text="扶手長度";
  1374. }else{
  1375. 扶手總長2_lb.text="總單位";
  1376. 扶手長度_lb.text="單位";
  1377. 請輸入扶手總長度_lb.text="請輸入總單位";
  1378. 扶手總長度_lb.text="總單位";
  1379. 已使用扶手長度_lb.text="已使用單位";
  1380. 可使用扶手長度_lb.text="可使用單位";
  1381. 扶手長度2_lb.text="單位";
  1382. }
  1383. string 文件號 = Global.報告書施工圖片_table.Rows[0][0].ToString();
  1384. if(Global.報告書施工圖檔文件號==""){Global.報告書施工圖檔文件號 = 文件號;}
  1385. SQL_Comm.SQL_報告書_施工圖檔扶手長度(報告書流水號_tb.text,Global.報告書文件號,Global.報告書物料料號,Global.報告書物料明細流水號,文件號);
  1386. if(SQL_Module.dr.Read()){
  1387. 單項扶手長度_tb.text=SQL_Module.dr[0].ToString();
  1388. }else{
  1389. 單項扶手長度_tb.text="";
  1390. }
  1391. }
  1392. 圖片讀取_pl.SetActive(false);
  1393. }
  1394. private void 主頁面調整(bool 首頁,bool 評估,bool 新建){
  1395. 首頁_pl.SetActive(首頁);評估_pl.SetActive(評估);新建_pl.SetActive(新建);
  1396. }
  1397. public void 開啟系統設定(){
  1398. 主頁面調整(true,false,false);
  1399. 評估紀錄_pl.SetActive(false);
  1400. 系統設定_pl.SetActive(true);
  1401. }
  1402. public void 開啟首頁(){
  1403. 主頁面調整(true,false,false);
  1404. 評估紀錄_pl.SetActive(true);
  1405. 系統設定_pl.SetActive(false);
  1406. Module.清除底色(文件號清單_ct);
  1407. Module.清除底色(報告書項目清單_ct);
  1408. Module.清除控件(報告書施工圖片_ct);
  1409. Global.報告書文件號="";Global.報告書物料料號="";Global.報告書物料明細流水號="";
  1410. }
  1411. public void 開啟評估頁面(){
  1412. 主頁面調整(false,true,false);
  1413. 系統設定_pl.SetActive(false);
  1414. Set_報告書人員清單("");
  1415. }
  1416. public void 開啟新建報告書頁面(){
  1417. 主頁面調整(false,false,true);
  1418. 選擇客戶_pl.SetActive(true);
  1419. Set_客戶清單();
  1420. }
  1421. public void 輸入扶手長度完畢(){
  1422. if(Global.輸入物料料號=="" || 輸入扶手總長_tb.text==""){
  1423. 輸入扶手長度_pl.SetActive(false);
  1424. 彈跳_pl.SetActive(true);
  1425. 彈跳文字_tb.text="輸入資料有誤!";
  1426. Global.彈跳判斷="輸入扶手長度";
  1427. }else{
  1428. SQL_Comm.SQL_報告書_讀取流水號();
  1429. string 明細流水號;double NUM;
  1430. if(SQL_Module.dr.Read()){明細流水號 = SQL_Module.dr["流水號"].ToString();}else{明細流水號 = "WS00000000";}
  1431. NUM = double.Parse(明細流水號.Substring(2, 8)) + 1;
  1432. 明細流水號 = "WS" + NUM.ToString().PadLeft(8, '0');
  1433. SQL_Comm.SQL_報告書_明細寫入(明細流水號, Global.報告書文件號, Global.輸入物料料號, "", 報告書流水號_tb.text,輸入扶手總長_tb.text);
  1434. 載入報告書項目清單(Global.報告書文件號);
  1435. 輸入扶手長度_pl.SetActive(false);
  1436. }
  1437. }
  1438. public void 輸入單項扶手長度完畢(){
  1439. double 扶手可使用長度 = double.Parse(扶手可使用長度_tb.text);double 扶手長度;
  1440. if(扶手長度_tb.text==""){扶手長度=0;}else{扶手長度=double.Parse(扶手長度_tb.text);}
  1441. if(扶手長度 > 扶手可使用長度){
  1442. 彈跳_pl.SetActive(true);
  1443. 彈跳文字_tb.text = "超出扶手可使用長度 !";
  1444. Global.彈跳判斷 = "長度透支";
  1445. }else{
  1446. 輸入單項扶手長度_pl.SetActive(false);
  1447. Texture2D texture2D = new((放圖用.texture as Texture2D).width, (放圖用.texture as Texture2D).height);
  1448. Graphics.CopyTexture(放圖用.texture, texture2D);
  1449. byte[] imageBytes = texture2D.EncodeToPNG();
  1450. SQL_Comm.SQL_讀取施工圖檔流水號(報告書流水號_tb.text,Global.報告書施工狀態,Global.報告書文件號,Global.報告書物料料號,Global.報告書物料明細流水號);
  1451. int 流水號;if(SQL_Module.dr.Read()){流水號=int.Parse(SQL_Module.dr[0].ToString()[2..]);}else{流水號 = 0;}流水號+=1;
  1452. SQL_Comm.SQL_上傳施工圖檔(報告書流水號_tb.text,Global.報告書施工狀態,Global.報告書文件號,Global.報告書物料料號,imageBytes,"JPG","IM"+流水號.ToString().PadLeft(3,'0'),扶手長度.ToString(),Global.報告書物料明細流水號);
  1453. 拍照結束();
  1454. }
  1455. }
  1456. public void 回上頁(string 介面){
  1457. if(介面=="評估"){
  1458. 評估詳細_pl.SetActive(false);評估主頁_pl.SetActive(true);
  1459. 回上頁_bt.SetActive(false);拍照_bt.SetActive(false);業務系統_bt.SetActive(true);系統設定_bt.SetActive(true);
  1460. 新增項目_bt.SetActive(false);刪除項目_bt.SetActive(false);
  1461. Module.清除控件(報告書項目清單_ct);Module.清除控件(報告書施工圖片_ct);
  1462. 報告書流水號_tb.text="";報告書申請人_tb.text="";報告書開立人_tb.text="";Global.報告書物料明細流水號="";
  1463. Set_報告書人員清單("");
  1464. }
  1465. }
  1466. public void 新增相片(){
  1467. if(Global.報告書施工狀態=="文件號"){
  1468. if(報告書流水號_tb.text==""){
  1469. 彈跳_pl.SetActive(true);
  1470. 彈跳文字_tb.text = "看到這則訊息請聯絡系統開發商!";
  1471. Global.彈跳判斷="報告書資料不齊全";
  1472. }else{
  1473. if (!拍照頁面_pl.activeSelf){
  1474. 拍照頁面_pl.SetActive(true);
  1475. StartCoroutine(open_Camera(60));
  1476. 提示_tb.text ="拍照中";
  1477. 拍照用.gameObject.SetActive(true);
  1478. 放圖用.gameObject.SetActive(false);
  1479. }
  1480. }
  1481. }else{
  1482. if(Global.報告書物料料號=="" || Global.報告書文件號==""){
  1483. 彈跳_pl.SetActive(true);
  1484. 彈跳文字_tb.text = "請先選擇文件以及項目!";
  1485. Global.彈跳判斷="報告書資料不齊全";
  1486. }else{
  1487. if (!拍照頁面_pl.activeSelf){
  1488. 拍照頁面_pl.SetActive(true);
  1489. StartCoroutine(open_Camera(60));
  1490. 提示_tb.text ="拍照中";
  1491. 拍照用.gameObject.SetActive(true);
  1492. 放圖用.gameObject.SetActive(false);
  1493. }
  1494. }
  1495. }
  1496. }
  1497. public void 拍照(){
  1498. if (拍照用.gameObject.activeSelf && !放圖用.gameObject.activeSelf){
  1499. Texture2D photoTexture = CapturePhoto();
  1500. if (photoTexture != null){
  1501. 放圖用.rectTransform.sizeDelta = new Vector2(720f, 1280f);
  1502. 放圖用.texture = photoTexture;
  1503. Texture2D texture2D = new((放圖用.texture as Texture2D).width, (放圖用.texture as Texture2D).height);
  1504. Graphics.CopyTexture(放圖用.texture, texture2D);
  1505. byte[] imageBytes = texture2D.EncodeToPNG();
  1506. SQL_CommString.SQL_連線字串_圖片_SQL(Global.圖檔資料庫,Global.資料庫IP);
  1507. if(Global.報告書施工狀態=="文件號"){
  1508. SQL_Comm.SQL_讀取報告書檔案流水號(報告書流水號_tb.text);
  1509. int 流水號;if(SQL_Module.dr.Read()){流水號=int.Parse(SQL_Module.dr[0].ToString()[2..]);}else{流水號 = 0;}流水號+=1;
  1510. SQL_Comm.SQL_上傳報告書圖檔(報告書流水號_tb.text,"報告書","IM"+流水號.ToString().PadLeft(3,'0'),imageBytes,"JPG");
  1511. 拍照結束();
  1512. }else{
  1513. if(Global.報告書施工狀態=="施工前" && (Global.報告書物料料號=="FA01" || Global.報告書物料料號=="137" || Global.報告書物料料號=="FA09" || Global.報告書物料料號=="152")){
  1514. if(Global.報告書物料料號=="FA01" || Global.報告書物料料號=="137"){
  1515. 扶手總長2_lb.text="扶手總長";
  1516. 扶手長度_lb.text="扶手長度";
  1517. 請輸入扶手總長度_lb.text="請輸入扶手總長度";
  1518. 扶手總長度_lb.text="扶手總長度";
  1519. 已使用扶手長度_lb.text="已使用扶手長度";
  1520. 可使用扶手長度_lb.text="可使用扶手長度";
  1521. 扶手長度2_lb.text="扶手長度";
  1522. }else{
  1523. 扶手總長2_lb.text="總單位";
  1524. 扶手長度_lb.text="單位";
  1525. 請輸入扶手總長度_lb.text="請輸入總單位";
  1526. 扶手總長度_lb.text="總單位";
  1527. 已使用扶手長度_lb.text="已使用單位";
  1528. 可使用扶手長度_lb.text="可使用單位";
  1529. 扶手長度2_lb.text="單位";
  1530. }
  1531. 輸入單項扶手總長度_tb.text = 報告書扶手總長_tb.text;
  1532. SQL_Comm.SQL_報告書_施工圖檔扶手長度清單(報告書流水號_tb.text,Global.報告書文件號,Global.報告書物料料號,Global.報告書物料明細流水號);
  1533. DataSet ds1 = new();
  1534. SQL_Module.da.Fill(ds1);
  1535. double 扶手累積長度=0;
  1536. double 扶手總長度 = double.Parse(輸入單項扶手總長度_tb.text);
  1537. for(int i =0;i<=ds1.Tables[0].Rows.Count-1;i++){
  1538. 扶手累積長度 += double.Parse(ds1.Tables[0].Rows[i][0].ToString());
  1539. }
  1540. 扶手已使用長度_tb.text = 扶手累積長度.ToString();
  1541. double 扶手可使用長度 = 扶手總長度 - 扶手累積長度;
  1542. 扶手可使用長度_tb.text = 扶手可使用長度.ToString();
  1543. 扶手長度_tb.text = "";
  1544. 輸入單項扶手長度_pl.SetActive(true);
  1545. }else{
  1546. SQL_Comm.SQL_讀取施工圖檔流水號(報告書流水號_tb.text,Global.報告書施工狀態,Global.報告書文件號,Global.報告書物料料號,Global.報告書物料明細流水號);
  1547. int 流水號;if(SQL_Module.dr.Read()){流水號=int.Parse(SQL_Module.dr[0].ToString()[2..]);}else{流水號 = 0;}流水號+=1;
  1548. SQL_Comm.SQL_上傳施工圖檔(報告書流水號_tb.text,Global.報告書施工狀態,Global.報告書文件號,Global.報告書物料料號,imageBytes,"JPG","IM"+流水號.ToString().PadLeft(3,'0'),"0",Global.報告書物料明細流水號);
  1549. 拍照結束();
  1550. }
  1551. }
  1552. }
  1553. myCam.Stop();
  1554. myCam = null;
  1555. 提示_tb.text ="";
  1556. }
  1557. }
  1558. private void 拍照結束(){
  1559. 拍照頁面_pl.SetActive(false);
  1560. PhotoScroll.清除currentPage();
  1561. 扶手長度_tb.text="";
  1562. if(Global.報告書施工狀態=="文件號"){
  1563. 載入報告書詳細資料(報告書流水號_tb.text);
  1564. }else{
  1565. 載入施工圖片();
  1566. }
  1567. }
  1568. private Texture2D CapturePhoto(){
  1569. if (myCam != null){
  1570. int width = myCam.width;
  1571. int height = myCam.height;
  1572. Texture2D photoTexture = new Texture2D(width, height);
  1573. photoTexture.SetPixels(myCam.GetPixels());
  1574. photoTexture.Apply();
  1575. Texture2D rotatedTexture = RotateTexture(photoTexture, true);
  1576. return rotatedTexture;
  1577. }
  1578. return null;
  1579. }
  1580. private IEnumerator open_Camera(int fps){
  1581. yield return Application.RequestUserAuthorization(UserAuthorization.WebCam); //授權開啟鏡頭
  1582. if (Application.HasUserAuthorization(UserAuthorization.WebCam)){
  1583. myCam = new WebCamTexture(WebCamTexture.devices[0].name, 720, 1280, fps);
  1584. 拍照用.texture = myCam;
  1585. myCam.Play();
  1586. }
  1587. }
  1588. private IEnumerator open_Camera2(int fps){
  1589. yield return Application.RequestUserAuthorization(UserAuthorization.WebCam); //授權開啟鏡頭
  1590. if (Application.HasUserAuthorization(UserAuthorization.WebCam)){
  1591. myCam = new WebCamTexture(WebCamTexture.devices[0].name, 720, 1280, fps);
  1592. 更換照片拍照用.texture = myCam;
  1593. myCam.Play();
  1594. }
  1595. }
  1596. private Texture2D RotateTexture(Texture2D originalTexture, bool clockwise){
  1597. int width = originalTexture.width;
  1598. int height = originalTexture.height;
  1599. Texture2D rotatedTexture = new Texture2D(height, width);
  1600. Color32[] originalPixels = originalTexture.GetPixels32();
  1601. Color32[] rotatedPixels = new Color32[width * height];
  1602. for (int y = 0; y < height; y++){
  1603. for (int x = 0; x < width; x++){
  1604. int newX = clockwise ? y : height - y - 1;
  1605. int newY = clockwise ? width - x - 1 : x;
  1606. rotatedPixels[newY * height + newX] = originalPixels[y * width + x];
  1607. }
  1608. }
  1609. rotatedTexture.SetPixels32(rotatedPixels);
  1610. rotatedTexture.Apply();
  1611. return rotatedTexture;
  1612. }
  1613. private Texture2D 鏡像圖片(Texture2D original){
  1614. Texture2D flipped = new(original.width, original.height);
  1615. for (int y = 0; y < original.height; y++){
  1616. flipped.SetPixels(0, y, original.width, 1, original.GetPixels(0, original.height - 1, original.width, 1));
  1617. }
  1618. flipped.Apply();
  1619. return flipped;
  1620. }
  1621. public void 施工前()
  1622. {
  1623. Global.報告書施工狀態 = "施工前"; 發送通知_bt.SetActive(false);
  1624. 施工前_bt.GetComponentInParent<Image>().color = new Color(0.67f, 1f, 0.4f, 1f);
  1625. 施工後_bt.GetComponentInParent<Image>().color = new Color(1f, 1f, 1f, 1f);
  1626. 文件號_bt.GetComponentInParent<Image>().color = new Color(1f, 1f, 1f, 1f);
  1627. 核銷文件_bt.GetComponentInParent<Image>().color = new Color(1f, 1f, 1f, 1f);
  1628. 載入施工圖片();
  1629. PhotoScroll.清除currentPage();
  1630. }
  1631. public void 施工後(){
  1632. Global.報告書施工狀態="施工後";單項扶手長度_tb.text="";發送通知_bt.SetActive(true);
  1633. 施工前_bt.GetComponentInParent<Image>().color = new Color(1f,1f,1f,1f);
  1634. 施工後_bt.GetComponentInParent<Image>().color = new Color(0.67f,1f,0.4f,1f);
  1635. 文件號_bt.GetComponentInParent<Image>().color = new Color(1f,1f,1f,1f);
  1636. 核銷文件_bt.GetComponentInParent<Image>().color = new Color(1f,1f,1f,1f);
  1637. 載入施工圖片();
  1638. PhotoScroll.清除currentPage();
  1639. }
  1640. public void 核銷文件按鈕(){
  1641. Global.報告書施工狀態="核銷文件";單項扶手長度_tb.text="";發送通知_bt.SetActive(false);
  1642. 施工前_bt.GetComponentInParent<Image>().color = new Color(1f,1f,1f,1f);
  1643. 施工後_bt.GetComponentInParent<Image>().color = new Color(1f,1f,1f,1f);
  1644. 文件號_bt.GetComponentInParent<Image>().color = new Color(1f,1f,1f,1f);
  1645. 核銷文件_bt.GetComponentInParent<Image>().color = new Color(0.67f,1f,0.4f,1f);
  1646. 載入施工圖片();
  1647. PhotoScroll.清除currentPage();
  1648. }
  1649. public void 更換照片_開啟(){
  1650. if(!更換照片_pl.activeInHierarchy){
  1651. 更換照片資料夾_bt.SetActive(true);更換照片文件號_bt.SetActive(true);更換照片確認_bt.SetActive(true);
  1652. 更換照片取消_bt.SetActive(true);更換照片拍照確認_bt.SetActive(false);
  1653. 更換照片_pl.SetActive(true);
  1654. Transform 子1=報告書施工圖片_ct.transform.GetChild(1);
  1655. Transform 子2 = 子1.transform.GetChild(1);
  1656. 更換照片放圖用.texture=子2.gameObject.GetComponent<RawImage>().texture;
  1657. 更換照片提示_tb.text="編輯中";
  1658. }
  1659. }
  1660. public void 更換照片_取消(){
  1661. if(更換照片_pl.activeInHierarchy){
  1662. 更換照片放圖用.texture =null;更換照片拍照用.texture =null;更換照片_pl.SetActive(false);
  1663. }
  1664. }
  1665. public void 更換照片_確認(){
  1666. if(更換照片放圖用.texture != null){
  1667. Texture2D originalTexture = 更換照片放圖用.texture as Texture2D;
  1668. Texture2D texture2D = new(originalTexture.width, originalTexture.height, TextureFormat.RGBA32, false);
  1669. Color[] pixels = originalTexture.GetPixels();
  1670. texture2D.SetPixels(pixels);
  1671. texture2D.Apply();
  1672. byte[] imageBytes = texture2D.EncodeToPNG();
  1673. SQL_CommString.SQL_連線字串_圖片_SQL(Global.圖檔資料庫,Global.資料庫IP);
  1674. if(Global.報告書施工狀態=="文件號"){
  1675. SQL_Comm.SQL_更新報告書圖檔(報告書流水號_tb.text,"報告書",Global.報告書文件號,imageBytes);
  1676. 更換照片結束();
  1677. }else{
  1678. SQL_Comm.SQL_更新施工圖檔(報告書流水號_tb.text,Global.報告書施工狀態,Global.報告書文件號,Global.報告書物料料號,imageBytes,Global.報告書施工圖檔文件號,Global.報告書物料明細流水號);
  1679. 更換照片結束();
  1680. }
  1681. }
  1682. }
  1683. public void 更換照片_拍照(){
  1684. StartCoroutine(open_Camera2(60));
  1685. 更換照片提示_tb.text ="拍照中";
  1686. 更換照片資料夾_bt.SetActive(false);更換照片文件號_bt.SetActive(false);更換照片確認_bt.SetActive(false);
  1687. 更換照片取消_bt.SetActive(false);更換照片拍照確認_bt.SetActive(true);
  1688. 更換照片拍照用.gameObject.SetActive(true);
  1689. 更換照片放圖用.gameObject.SetActive(false);
  1690. }
  1691. public void 更換照片_拍照確認(){
  1692. 更換照片資料夾_bt.SetActive(true);更換照片文件號_bt.SetActive(true);更換照片確認_bt.SetActive(true);
  1693. 更換照片取消_bt.SetActive(true);更換照片拍照確認_bt.SetActive(false);
  1694. if (更換照片拍照用.gameObject.activeSelf && !更換照片放圖用.gameObject.activeSelf){
  1695. Texture2D photoTexture = CapturePhoto();
  1696. if (photoTexture != null){
  1697. 更換照片放圖用.rectTransform.sizeDelta = new Vector2(720f, 1280f);
  1698. 更換照片放圖用.texture = photoTexture;
  1699. }
  1700. myCam.Stop();
  1701. myCam = null;
  1702. 更換照片提示_tb.text ="編輯中";
  1703. 更換照片拍照用.gameObject.SetActive(false);
  1704. 更換照片放圖用.gameObject.SetActive(true);
  1705. }
  1706. }
  1707. private void 更換照片結束(){
  1708. 更換照片_pl.SetActive(false);
  1709. PhotoScroll.清除currentPage();
  1710. 扶手長度_tb.text="";
  1711. if(Global.報告書施工狀態=="文件號"){
  1712. 載入報告書詳細資料(報告書流水號_tb.text);
  1713. Module.清除控件(報告書施工圖片_ct);
  1714. }else{
  1715. 載入施工圖片();
  1716. }
  1717. }
  1718. public void 文件號(){
  1719. Global.報告書施工狀態="文件號";單項扶手長度_tb.text="";發送通知_bt.SetActive(false);
  1720. 施工前_bt.GetComponentInParent<Image>().color = new Color(1f,1f,1f,1f);
  1721. 施工後_bt.GetComponentInParent<Image>().color = new Color(1f,1f,1f,1f);
  1722. 文件號_bt.GetComponentInParent<Image>().color = new Color(0.67f,1f,0.4f,1f);
  1723. 核銷文件_bt .GetComponentInParent<Image>().color = new Color(1f,1f,1f,1f);
  1724. 載入施工圖片();
  1725. PhotoScroll.清除currentPage();
  1726. }
  1727. public void 刪除照片(){
  1728. if(相片總數_tb.text=="-"){
  1729. 彈跳_pl.SetActive(true);
  1730. 彈跳文字_tb.text="請先選擇要刪除的照片";
  1731. }else{
  1732. if(Global.報告書施工狀態=="文件號"){
  1733. 彈跳_pl.SetActive(true);
  1734. 彈跳文字_tb.text="確定要刪除此照片?";
  1735. Global.彈跳判斷="文件號刪除照片";
  1736. }else{
  1737. 彈跳_pl.SetActive(true);
  1738. 彈跳文字_tb.text="確定要刪除此照片?";
  1739. Global.彈跳判斷="施工刪除照片";
  1740. }
  1741. }
  1742. }
  1743. public void 備註_返回(){
  1744. 備註_pl.SetActive(false);備註_tb.text="";
  1745. }
  1746. public void 開啟備註(){
  1747. 備註_pl.SetActive(true);string 備註="";
  1748. SQL_Comm.SQL_報告書_讀取施工備註2(報告書流水號_tb.text,Global.報告書選項2,Global.報告書物料明細流水號,Global.報告書物料料號);
  1749. //SQL_Comm.SQL_報告書_讀取施工備註(報告書流水號_tb.text,Global.報告書選項2,Global.報告書施工狀態,Global.報告書物料明細流水號,Global.報告書物料料號,文件號);
  1750. if(SQL_Module.dr.Read()){
  1751. 備註=SQL_Module.dr[0].ToString();
  1752. }
  1753. 備註_tb.text=備註;
  1754. }
  1755. public void 備註存檔(){
  1756. //string 文件號 = 施作圖片相片文件號_tb.text;
  1757. SQL_Comm.SQL_報告書_寫入施工備註2(報告書流水號_tb.text,Global.報告書選項2,Global.報告書物料明細流水號,Global.報告書物料料號,備註_tb.text);
  1758. //SQL_Comm.SQL_報告書_寫入施工備註(報告書流水號_tb.text,Global.報告書選項2,Global.報告書施工狀態,Global.報告書物料明細流水號,Global.報告書物料料號,文件號,備註_tb.text);
  1759. 備註_pl.SetActive (false);
  1760. }
  1761. public void 發送通知(){
  1762. sql_line.LIN訊息通知("CC215","WS-系統通知(主管)",報告書流水號_tb.text,"");
  1763. //sql_line.LIN訊息通知("CC215","王詩文",報告書流水號_tb.text,"");
  1764. 彈跳_pl.SetActive(true);彈跳文字_tb.text="已發送通知!";Global.彈跳判斷="發送通知";
  1765. }
  1766. public void 新增項目(){
  1767. if(新增項目_pl.activeInHierarchy ){
  1768. 新增項目_pl.SetActive(false);報告書圖片_pl.SetActive(true);
  1769. }else{
  1770. if(報告書流水號_tb.text==""||Global.報告書文件號==""){
  1771. 彈跳_pl.SetActive(true);
  1772. 彈跳文字_tb.text = "請先選擇文件!";
  1773. Global.彈跳判斷="報告書資料不齊全";
  1774. }else{
  1775. 報告書圖片_pl.SetActive(false);新增項目_pl.SetActive(true);
  1776. 長照類_bt.SetActive(true);身障類_bt.SetActive(true);自費類_bt.SetActive(true);長照類_sv.SetActive(false);回選單_bt.SetActive(false);項目清單2_lb.gameObject.SetActive(false);
  1777. }
  1778. }
  1779. }
  1780. /*public void 長照類_bt_click(){
  1781. 長照類_bt.SetActive(false);身障類_bt.SetActive(false);自費類_bt.SetActive(false);長照類_sv.SetActive(true);項目清單2_lb.gameObject.SetActive(true);回選單_bt.SetActive(true);
  1782. 項目清單2_lb.text="長期照顧類";Set_長照物料清單("長期照顧類","C");
  1783. }
  1784. public void 身障類_bt_click(){
  1785. 長照類_bt.SetActive(false);身障類_bt.SetActive(false);自費類_bt.SetActive(false);長照類_sv.SetActive(true);項目清單2_lb.gameObject.SetActive(true);回選單_bt.SetActive(true);
  1786. 項目清單2_lb.text="身心障礙類";Set_長照物料清單("身心障礙類","D");
  1787. }
  1788. public void 自費類_bt_click(){
  1789. 長照類_bt.SetActive(false);身障類_bt.SetActive(false);自費類_bt.SetActive(false);長照類_sv.SetActive(true);項目清單2_lb.gameObject.SetActive(true);回選單_bt.SetActive(true);
  1790. 項目清單2_lb.text="自費類";Set_長照物料清單("自費類","B");
  1791. }*/
  1792. public void 長照類_bt_click(){
  1793. 長照類_bt.SetActive(false);身障類_bt.SetActive(false);自費類_bt.SetActive(false);返回3_bt.SetActive(false);
  1794. 長照類_核定通知書_bt.SetActive(true);長照類_相關文件_bt.SetActive(true);長照類_評估報告書1_bt.SetActive(true);
  1795. 長照類_評估報告書2_bt.SetActive(true); 返回4_bt.SetActive(true);
  1796. Global.報告書選項1="長照類";
  1797. }
  1798. public void 身障類_bt_click(){
  1799. 長照類_bt.SetActive(false);身障類_bt.SetActive(false);自費類_bt.SetActive(false);返回3_bt.SetActive(false);
  1800. 長照類_核定通知書_bt.SetActive(true);長照類_相關文件_bt.SetActive(true);長照類_評估報告書1_bt.SetActive(true);
  1801. 長照類_評估報告書2_bt.SetActive(true); 返回4_bt.SetActive(true);
  1802. Global.報告書選項1="身障類";
  1803. }
  1804. public void 自費類_bt_click(){
  1805. 長照類_bt.SetActive(false);身障類_bt.SetActive(false);自費類_bt.SetActive(false);返回3_bt.SetActive(false);
  1806. 長照類_案場1_bt.SetActive(true);長照類_案場2_bt.SetActive(true);長照類_案場3_bt.SetActive(true);
  1807. 返回8_bt.SetActive(true);
  1808. Global.報告書選項1="自費類";
  1809. }
  1810. public void 回選單_bt_click(){
  1811. 長照類_bt.SetActive(true);身障類_bt.SetActive(true);自費類_bt.SetActive(true);長照類_sv.SetActive(false);項目清單2_lb.gameObject.SetActive(false);回選單_bt.SetActive(false);
  1812. }
  1813. public void 長照類_相關文件_bt_click(){
  1814. 長照類_核定通知書_bt.SetActive(false);長照類_相關文件_bt.SetActive(false);長照類_評估報告書1_bt.SetActive(false);
  1815. 長照類_評估報告書2_bt.SetActive(false);返回4_bt.SetActive(false);
  1816. 長照類_申請人身分證反面_bt.SetActive(true);長照類_受託人身分證反面_bt.SetActive(true);長照類_所有權人身分證反面_bt.SetActive(true);
  1817. 長照類_房屋所有權狀_bt.SetActive(true);長照類_土地所有權狀_bt.SetActive(true);長照類_房屋稅籍證明_bt.SetActive(true);長照類_土地稅籍證明_bt.SetActive(true);
  1818. 長照類_房屋稅單_bt.SetActive(true);長照類_土地稅單_bt.SetActive(true);返回5_bt.SetActive(true);拍照1_bt.SetActive(true);刪除1_bt.SetActive(true);
  1819. 存檔1_bt.SetActive(true);報告書文件圖片_pl.SetActive(true);長照類_申請人身心障礙證明_bt.SetActive(true);
  1820. Global.報告書選項2="相關文件";
  1821. }
  1822. public void 倍瑞菲_bt_click(){
  1823. string url ="";
  1824. #if UNITY_ANDROID
  1825. url = "https://lin.ee/rSFZlqK";
  1826. #elif UNITY_IPHONE
  1827. url = "https://lin.ee/rSFZlqK";
  1828. #else
  1829. url = "https://lin.ee/rSFZlqK";
  1830. #endif
  1831. Application.OpenURL(url);
  1832. }
  1833. public void 地圖_bt_Click(){
  1834. if(報告書人員資料_地址_tb.text!=""){
  1835. string address = 報告書人員資料_地址_tb.text;
  1836. string url = "https://www.google.com/maps/search/?api=1&query=" + UnityEngine.Networking.UnityWebRequest.EscapeURL(address);
  1837. Application.OpenURL(url);
  1838. }else{
  1839. 彈跳_pl.SetActive(true);
  1840. 彈跳文字_tb.text = "地址沒有資料不能跳轉!!";
  1841. Global.彈跳判斷 = "地址";
  1842. }
  1843. }
  1844. public void 小工具_bt_Click(){
  1845. 彈跳_pl.SetActive(true);
  1846. 彈跳文字_tb.text = "功能開發中!!";
  1847. Global.彈跳判斷 = "地址";
  1848. }
  1849. public void 照片存檔_bt_Click(){
  1850. RawImage rawImage ;
  1851. if (施作圖片_pl.activeInHierarchy)
  1852. {
  1853. rawImage = GetCloneRawImage(施作圖片_pl);
  1854. }
  1855. else
  1856. {
  1857. rawImage = GetCloneRawImage(報告書文件圖片_pl);
  1858. }
  1859. if (rawImage.texture == null){
  1860. Debug.LogWarning("RawImage 尚未載入任何圖片,無法儲存");
  1861. return;
  1862. }
  1863. Texture2D tex = null;
  1864. RenderTexture rt = null;
  1865. try
  1866. {
  1867. tex = new Texture2D((int)rawImage.texture.width, (int)rawImage.texture.height, TextureFormat.RGB24, false);
  1868. rt = RenderTexture.GetTemporary(tex.width, tex.height, 0);
  1869. Graphics.Blit(rawImage.texture, rt);
  1870. RenderTexture.active = rt;
  1871. tex.ReadPixels(new Rect(0, 0, tex.width, tex.height), 0, 0);
  1872. tex.Apply();
  1873. }
  1874. finally
  1875. {
  1876. RenderTexture.active = null;
  1877. if (rt != null) RenderTexture.ReleaseTemporary(rt);
  1878. }
  1879. string filename = "RawImage_" + System.DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".png";
  1880. NativeGallery.SaveImageToGallery(tex, "MyAppImages", filename, (success, path) =>
  1881. {
  1882. if (success)
  1883. {
  1884. 彈跳_pl.SetActive(true);
  1885. 彈跳文字_tb.text = "圖片儲存完成!\n 實際儲存路徑: "+ path;
  1886. Global.彈跳判斷 = "圖片儲存";
  1887. }
  1888. else
  1889. {
  1890. 彈跳_pl.SetActive(true);
  1891. 彈跳文字_tb.text = "圖片未儲存,請檢查權限是否異常!";
  1892. Global.彈跳判斷 = "圖片儲存";
  1893. }
  1894. });
  1895. }
  1896. RawImage GetCloneRawImage(GameObject 圖片_panel)
  1897. {
  1898. return 圖片_panel.GetComponentsInChildren<RawImage>(true)
  1899. .FirstOrDefault(r => r.name.Contains("Image(Clone)"));
  1900. }
  1901. public void 刪除項目()
  1902. {
  1903. if (Global.報告書物料明細流水號 == "")
  1904. {
  1905. 彈跳_pl.SetActive(true);
  1906. 彈跳文字_tb.text = "請先選擇刪除項目!";
  1907. Global.彈跳判斷 = "報告書資料不齊全";
  1908. }
  1909. else
  1910. {
  1911. SQL_Comm.SQL_報告書_明細刪除(Global.報告書物料明細流水號); Global.報告書物料明細流水號 = "";
  1912. SQL_Comm.SQL_報告書_施工圖檔刪除(報告書流水號_tb.text, Global.報告書文件號, Global.報告書物料料號);
  1913. 載入報告書項目清單(Global.報告書文件號);
  1914. Module.清除控件(報告書施工圖片_ct);
  1915. PhotoScroll.清除currentPage();
  1916. }
  1917. }
  1918. public void 登出(){
  1919. 彈跳_pl.SetActive(true);
  1920. 彈跳文字_tb.text = "確認登出?";
  1921. Global.彈跳判斷="登出";
  1922. }
  1923. public void 彈跳是(){
  1924. if(Global.彈跳判斷=="登出"){
  1925. 彈跳文字_tb.text ="";
  1926. 彈跳_pl.SetActive(false);
  1927. if(PlayerPrefs.HasKey("帳號")){
  1928. PlayerPrefs.DeleteKey("帳號");
  1929. }
  1930. if(PlayerPrefs.HasKey("密碼")){
  1931. PlayerPrefs.DeleteKey("密碼");
  1932. }
  1933. change_Secen(0);
  1934. }else if(Global.彈跳判斷=="新增報告書"){
  1935. 彈跳文字_tb.text ="";
  1936. 彈跳_pl.SetActive(false);
  1937. }else if(Global.彈跳判斷=="文件號刪除照片"){
  1938. SQL_Comm.SQL_報告書_刪除報告書圖檔(報告書流水號_tb.text,Global.報告書文件號);
  1939. SQL_Comm.SQL_報告書_刪除報告書明細(報告書流水號_tb.text,Global.報告書文件號,Global.報告書物料料號);
  1940. SQL_Comm.SQL_報告書_刪除報告書施工圖檔(報告書流水號_tb.text,Global.報告書文件號,Global.報告書物料料號);
  1941. 彈跳文字_tb.text ="刪除完畢";
  1942. Global.彈跳判斷="文件號照片刪除完成";
  1943. }else if(Global.彈跳判斷=="文件號照片刪除完成"){
  1944. Module.清除控件(報告書施工圖片_ct);
  1945. 載入報告書詳細資料(報告書流水號_tb.text);
  1946. 彈跳文字_tb.text ="";
  1947. 彈跳_pl.SetActive(false);
  1948. }else if(Global.彈跳判斷=="施工刪除照片"){
  1949. SQL_Comm.SQL_報告書_刪除報告書施工圖檔照片(報告書流水號_tb.text,Global.報告書文件號,Global.報告書施工狀態,Global.報告書物料明細流水號,Global.報告書物料料號,Global.報告書施工圖檔文件號);
  1950. 彈跳文字_tb.text ="刪除完畢";
  1951. Global.彈跳判斷="施工照片刪除完成";
  1952. }else if(Global.彈跳判斷=="施工照片刪除完成"){
  1953. 載入施工圖片();
  1954. 彈跳文字_tb.text ="";
  1955. 彈跳_pl.SetActive(false);
  1956. }else{
  1957. 彈跳文字_tb.text ="";
  1958. 彈跳_pl.SetActive(false);
  1959. }
  1960. }
  1961. public void 彈跳否(){
  1962. 彈跳文字_tb.text ="";
  1963. 彈跳_pl.SetActive(false);
  1964. }
  1965. IEnumerator AnimateText(){
  1966. string qqq = 圖片讀取_tb.text.ToString();
  1967. while (true){
  1968. yield return new WaitForSeconds(0.5f);
  1969. if (dotCount < 3){
  1970. loadingText += ".";
  1971. dotCount++;
  1972. }else{
  1973. loadingText = "";
  1974. dotCount = 0;
  1975. }
  1976. 圖片讀取_tb.text = qqq+loadingText;
  1977. }
  1978. }
  1979. string GetChineseDayOfWeek(DayOfWeek dayOfWeek){
  1980. return dayOfWeek switch{
  1981. DayOfWeek.Sunday => "星期日",
  1982. DayOfWeek.Monday => "星期一",
  1983. DayOfWeek.Tuesday => "星期二",
  1984. DayOfWeek.Wednesday => "星期三",
  1985. DayOfWeek.Thursday => "星期四",
  1986. DayOfWeek.Friday => "星期五",
  1987. DayOfWeek.Saturday => "星期六",
  1988. _ => "",
  1989. };
  1990. }
  1991. public static class Global{
  1992. public static string 版本號 ="1.0.10",版本號比對,gUser區域,gUserName,gUser加盟商編號,DTP1,資料庫IP;
  1993. public static string 使用者UID, 使用者暱稱, 使用者ID,螢幕格式,螢幕方向,彈跳判斷,圖檔資料庫,報告書文件號="",報告書物料料號="",輸入物料料號="",報告書物料明細流水號="",
  1994. 報告書施工狀態="文件號",報告書施工圖檔文件號="",報告書選項1="",報告書選項2="",報告書選項3="";
  1995. public static bool 鏡頭啟動,主頁新增;
  1996. public static int camfps,系統主題=1;
  1997. public static float rate , rate_ ,登入條件, 固高, 固寬, 固比, 固比1;
  1998. public static string PA, PB, PC, PD, PE, PF, PG, PH, PI, PJ, PK, PA1, PA2, PA3, PA4, PA5, PA6, PA7, PA8, PA9, PA10;
  1999. public static string[,] PHP = new string[5,2];
  2000. public static GameObject 複製體1,複製體2,複製體3,複製體4;
  2001. public static DataTable 報告書清單_tabel,報告書項目清單_tabel,客戶清單_tabel,長照物料清單_tabel,報告書施工圖片_table,文件號清單_table,報告書人員清單_tabel,
  2002. 報告書相關文件_table,報告書評估報告書1清單_tabel,報告書評估報告書2清單_tabel,報告書施作圖片_table,報告書案場1清單_tabel,報告書案場2清單_tabel,報告書案場3清單_tabel;
  2003. }
  2004. public static void change_Secen(int _screenNum){
  2005. SceneManager.LoadScene(_screenNum);
  2006. }
  2007. }