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

Main.cs 131KB

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