Ingen beskrivning
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.

cowchin.cs 171KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5. using UnityEngine.UI;
  6. using UnityEngine.Networking;
  7. using System.Text.RegularExpressions;
  8. using System.Data.SqlClient;
  9. using System.Runtime.InteropServices;
  10. using System.Text;
  11. using TMPro;
  12. using System;
  13. using System.IO;
  14. using ZXing;
  15. using ZXing.QrCode;
  16. using System.Net;
  17. using System.Data;
  18. using SimpleJSON;
  19. using System.Linq;
  20. using System.ComponentModel;
  21. using System.Runtime.InteropServices;
  22. using System.Globalization;
  23. using XCharts.Runtime;
  24. public class cowchin : MonoBehaviour
  25. {
  26. public CanvasScaler canvasScaler;
  27. public float idleTime = 300f; // 5分鐘的閒置時間
  28. private float timeSinceLastInteraction = 0f;
  29. [SerializeField] GameObject 語言選擇面板;
  30. [SerializeField] TextMeshProUGUI 選擇語言;
  31. [SerializeField] TextMeshProUGUI 中;
  32. [SerializeField] TextMeshProUGUI 英;
  33. [SerializeField] TextMeshProUGUI 印;
  34. [SerializeField] TextMeshProUGUI 簡;
  35. [SerializeField] Button 中按鈕;
  36. [SerializeField] Button 英按鈕;
  37. [SerializeField] Button 印按鈕;
  38. [SerializeField] Button 簡按鈕;
  39. private Button[] bts;
  40. [SerializeField] TextMeshProUGUI 標題;
  41. [SerializeField] TextMeshProUGUI 標題1;
  42. [SerializeField] TextMeshProUGUI 員工名稱;
  43. [SerializeField] TextMeshProUGUI 員工代碼;
  44. [SerializeField] TextMeshProUGUI 員工崗位;
  45. [SerializeField] TextMeshProUGUI 部門名稱;
  46. [SerializeField] TextMeshProUGUI 總時數;
  47. [SerializeField] TextMeshProUGUI 員工名稱_s;
  48. [SerializeField] TextMeshProUGUI 員工代碼_s;
  49. [SerializeField] TextMeshProUGUI 員工崗位_s;
  50. [SerializeField] TextMeshProUGUI 部門名稱_s;
  51. [SerializeField] TextMeshProUGUI 總時數_s;
  52. [SerializeField] TextMeshProUGUI 星期;
  53. [SerializeField] TextMeshProUGUI 日期;
  54. [SerializeField] TextMeshProUGUI 實際_1;
  55. [SerializeField] TextMeshProUGUI 實際_2;
  56. [SerializeField] TextMeshProUGUI 實際_3;
  57. [SerializeField] TextMeshProUGUI 實際_4;
  58. [SerializeField] TextMeshProUGUI 實際_5;
  59. [SerializeField] TextMeshProUGUI 實際_6;
  60. [SerializeField] TextMeshProUGUI 小時數;
  61. [SerializeField] TextMeshProUGUI 加班;
  62. [SerializeField] TextMeshProUGUI 假日;
  63. [SerializeField] TextMeshProUGUI 假別;
  64. [SerializeField] TextMeshProUGUI 備註;
  65. [SerializeField] TextMeshProUGUI 星期s;
  66. [SerializeField] TextMeshProUGUI 日期s;
  67. [SerializeField] TextMeshProUGUI 實際_1s;
  68. [SerializeField] TextMeshProUGUI 實際_2s;
  69. [SerializeField] TextMeshProUGUI 實際_3s;
  70. [SerializeField] TextMeshProUGUI 實際_4s;
  71. [SerializeField] TextMeshProUGUI 實際_5s;
  72. [SerializeField] TextMeshProUGUI 實際_6s;
  73. [SerializeField] TextMeshProUGUI 小時數s;
  74. [SerializeField] TextMeshProUGUI 加班s;
  75. [SerializeField] TextMeshProUGUI 假日s;
  76. [SerializeField] TextMeshProUGUI 假別s;
  77. [SerializeField] TextMeshProUGUI 備註s;
  78. [SerializeField] TextMeshProUGUI 姓名s;
  79. [SerializeField] TextMeshProUGUI 部門s;
  80. [SerializeField] TextMeshProUGUI 級別s;
  81. [SerializeField] TextMeshProUGUI 實際打卡;
  82. [SerializeField] TextMeshProUGUI 考勤計算;
  83. [SerializeField] GameObject 明細表頁面;
  84. [SerializeField] GameObject 查詢表頁面;
  85. [SerializeField] GameObject 相機按鈕;
  86. [SerializeField] GameObject 上一步;
  87. [SerializeField] GameObject 明細清單;
  88. [SerializeField] GameObject 明細清單表投;
  89. [SerializeField] GameObject 圖表;
  90. [SerializeField] GameObject 邊框左;
  91. [SerializeField] GameObject 邊框右;
  92. [SerializeField] TextMeshProUGUI 下拉字;
  93. [SerializeField] GameObject 下拉1;
  94. [SerializeField] GameObject 下拉2;
  95. [SerializeField] TMP_Dropdown 年;
  96. [SerializeField] TMP_Dropdown 月;
  97. [SerializeField] TMP_Dropdown 年1;
  98. [SerializeField] TMP_Dropdown 月1;
  99. [SerializeField] TMP_Dropdown 日1;
  100. [SerializeField] TMP_Dropdown 級別1;
  101. [SerializeField] TMP_Dropdown 群組;
  102. int 實際考勤;
  103. public GameObject textPrefab;
  104. public Transform textParent;
  105. public GameObject textceneter;
  106. public GameObject textPrefab1;
  107. public Transform textParent1;
  108. public GameObject textceneter1;
  109. private List<GameObject> textcopy = new List<GameObject>();
  110. private List<GameObject> textcopy1 = new List<GameObject>();
  111. private List<GameObject> textcopy2 = new List<GameObject>();
  112. private List<GameObject> textcopy3 = new List<GameObject>();
  113. private List<GameObject> textcopy4 = new List<GameObject>();
  114. private TextMeshProUGUI[] texts2;
  115. private TextMeshProUGUI[] texts1;
  116. private TextMeshProUGUI[] texts;
  117. string[] 時段 = new string[6];
  118. string[] 實際 = new string[6];
  119. string[] 考勤 = new string[6];
  120. string[] 時段1 = new string[6];
  121. string[] 實際1 = new string[6];
  122. string[] 考勤1 = new string[6];
  123. string[] 實際2 = new string[6];
  124. string year;
  125. string month;
  126. string date;
  127. string today;
  128. int currentDay;
  129. string 點擊ID;
  130. public RectTransform buttonRectTransform;
  131. public GameObject buttonPrefab;
  132. public Transform buttonParent;
  133. public GameObject buttonPrefab1;
  134. public Transform buttonParent1;
  135. public GameObject buttonPrefab2;
  136. public Transform buttonParent2;
  137. private JSONNode jsonData;
  138. private float timer = 0f;
  139. private float interval = 60f;
  140. [SerializeField] GameObject 讀取面板;
  141. [SerializeField] TextMeshProUGUI 讀取;
  142. private string loadingText = "";
  143. private int dotCount = 0;
  144. [SerializeField] GameObject 網頁面板;
  145. UniWebView webView;
  146. public GameObject panel;
  147. float scale = 0;
  148. float xbar = 0;
  149. float ybar = 0;
  150. RectTransform panelRectTransform;
  151. // Start is called before the first frame update
  152. void Awake()
  153. {
  154. //Main.Global.阿帕契路徑="http://106.1.48.106:8080/wp-content/themes/event-star/tab.php?";
  155. //Main.Global.阿帕契路徑="http://103.231.201.230/hxpgsweb/wp-content/themes/twentytwentyone/tab.php?";
  156. // Main.Global.預設伺服器路徑="id";
  157. // Main.Global.系統語言="繁體中文";
  158. //Main.Global.ID="";
  159. //Main.Global.部門編號=3;
  160. DateTime currentDate = DateTime.Now;
  161. Main.Global.查詢日期 = currentDate.ToString("yyyy/MM/dd");
  162. int currentMonth = currentDate.Month;
  163. 月.value = currentMonth - 1;
  164. 月1.value = currentMonth - 1;
  165. currentDay = currentDate.Day;
  166. 讀取面板.SetActive(true);
  167. StartCoroutine(群組清單());
  168. }
  169. void Start()
  170. {
  171. Screen.autorotateToPortrait = false;
  172. Screen.orientation = ScreenOrientation.LandscapeLeft;
  173. texts = new TextMeshProUGUI[] { 員工名稱_s, 員工代碼_s, 員工崗位_s, 部門名稱_s };
  174. float screenWidth = Screen.width;
  175. float screenHeight = Screen.height;
  176. float rate = screenWidth/screenHeight;
  177. if (canvasScaler == null)
  178. {
  179. canvasScaler = GetComponent<CanvasScaler>();
  180. }
  181. if (rate>1.6)
  182. {
  183. canvasScaler.matchWidthOrHeight = 1f;
  184. }
  185. else
  186. {
  187. canvasScaler.matchWidthOrHeight = 0f;
  188. }
  189. if (canvasScaler.matchWidthOrHeight == 0f)
  190. {
  191. scale = screenWidth / 1600;
  192. xbar=0;
  193. ybar=(screenHeight-(1000*scale))/2;
  194. }
  195. else
  196. {
  197. scale = screenHeight/ 1000;
  198. xbar=(screenWidth-(1600*scale))/2;
  199. ybar=0;
  200. }
  201. panelRectTransform = panel.GetComponent<RectTransform>();
  202. 實際考勤=0;
  203. 點擊ID="";
  204. 初始化系統語言();
  205. StartCoroutine(判斷更新());
  206. StartCoroutine(AnimateText());
  207. //Main.Global.ID="0003065795";
  208. 系統語言轉換();
  209. 語言選擇按鈕();
  210. if (Main.Global.部門編號==3)
  211. {
  212. 明細表頁面.SetActive(false);
  213. 查詢表頁面.SetActive(true);
  214. 下拉字.text = "GRUP";
  215. 下拉1.SetActive(false);
  216. 下拉2.SetActive(true);
  217. 上一步.SetActive(false);
  218. StartCoroutine(考勤查找表1("", Main.Global.查詢日期));
  219. }
  220. else
  221. {
  222. 明細表頁面.SetActive(false);
  223. 查詢表頁面.SetActive(true);
  224. // 相機按鈕.SetActive(false);
  225. 下拉字.text = "level";
  226. 下拉1.SetActive(true);
  227. 下拉2.SetActive(false);
  228. 上一步.SetActive(false);
  229. StartCoroutine(考勤查找表("", Main.Global.查詢日期));
  230. }
  231. if(Main.Global.ID != "")
  232. {
  233. 上一步.SetActive(true);
  234. 明細表頁面.SetActive(true);
  235. 查詢表頁面.SetActive(false);
  236. 明細清單.SetActive(false);
  237. 明細清單表投.SetActive(false);
  238. 邊框左.SetActive(false);
  239. 邊框右.SetActive(false);
  240. 圖表.SetActive(true);
  241. DateTime currentDate = DateTime.Now; // 取得目前的日期與時間
  242. string yearMonth = currentDate.ToString("yyyy/MM");
  243. if (textcopy != null)
  244. {
  245. DeletetextCopies();
  246. }
  247. if (textcopy3 != null)
  248. {
  249. DeletetextCopies3();
  250. }
  251. if (textcopy2 != null)
  252. {
  253. DeletetextCopies2();
  254. }
  255. StartCoroutine(考勤明細人員讀取(Main.Global.ID));
  256. StartCoroutine(考勤明細表(Main.Global.ID, yearMonth));
  257. buttonRectTransform.anchoredPosition = new Vector2(0f, 270f);
  258. }
  259. 網頁(panelRectTransform, scale, xbar, ybar);
  260. //StartCoroutine(考勤明細人員讀取(Main.Global.ID));
  261. }
  262. IEnumerator AnimateText()
  263. {
  264. string qqq = 讀取.text.ToString();
  265. while (true)
  266. {
  267. yield return new WaitForSeconds(0.5f);
  268. if (dotCount < 3)
  269. {
  270. loadingText += ".";
  271. dotCount++;
  272. }
  273. else
  274. {
  275. loadingText = "";
  276. dotCount = 0;
  277. }
  278. 讀取.text = qqq+loadingText;
  279. }
  280. }
  281. // Update is called once per frame
  282. void Update()
  283. {
  284. timer += Time.deltaTime;
  285. // 判斷是否達到時間間隔
  286. if (timer >= interval)
  287. {
  288. StartCoroutine(判斷更新());
  289. timer = 0f;
  290. }
  291. if (Main.Global.快速登入==false)
  292. {
  293. if (Input.anyKeyDown)
  294. {
  295. timeSinceLastInteraction = 0f;
  296. }
  297. else
  298. {
  299. timeSinceLastInteraction += Time.deltaTime;
  300. if (timeSinceLastInteraction > idleTime)
  301. {
  302. change_Secen(1);
  303. }
  304. }
  305. }
  306. }
  307. IEnumerator 群組清單()
  308. {
  309. List<TMP_Dropdown.OptionData> options = new List<TMP_Dropdown.OptionData>();
  310. 群組.options.Clear();
  311. string strcon = "群組清單";
  312. string se = Main.Global.預設伺服器路徑;
  313. string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}", strcon, se);
  314. UnityWebRequest request = UnityWebRequest.Get(strUrl);
  315. yield return request.SendWebRequest();
  316. if (request.result == UnityWebRequest.Result.ConnectionError)
  317. {
  318. Debug.Log(request.error);
  319. yield break;
  320. }
  321. JSONNode json1 = JSON.Parse(request.downloadHandler.text);
  322. Debug.Log(json1);
  323. options.Add(new TMP_Dropdown.OptionData(""));
  324. for (int i = 0; i<json1.Count; i++)
  325. {
  326. string str = json1[i].ToString();
  327. str=str.Trim('"');
  328. options.Add(new TMP_Dropdown.OptionData(str));
  329. }
  330. 群組.AddOptions(options);
  331. StartCoroutine(年份清單讀取());
  332. }
  333. IEnumerator 年份清單讀取()
  334. {
  335. List<TMP_Dropdown.OptionData> options = new List<TMP_Dropdown.OptionData>();
  336. List<TMP_Dropdown.OptionData> options1 = new List<TMP_Dropdown.OptionData>();
  337. 年1.options.Clear();
  338. 年.options.Clear();
  339. string strcon = "年份";
  340. string se = Main.Global.預設伺服器路徑;
  341. string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}", strcon, se);
  342. UnityWebRequest request = UnityWebRequest.Get(strUrl);
  343. yield return request.SendWebRequest();
  344. if (request.result == UnityWebRequest.Result.ConnectionError)
  345. {
  346. //Debug.Log(request.error);
  347. yield break;
  348. }
  349. JSONNode json1 = JSON.Parse(request.downloadHandler.text);
  350. for (int i = 0; i<json1.Count; i++)
  351. {
  352. string str = json1[i].ToString();
  353. str=str.Trim('"');
  354. options1.Add(new TMP_Dropdown.OptionData(str));
  355. options.Add(new TMP_Dropdown.OptionData(str));
  356. }
  357. 年.AddOptions(options);
  358. 年1.AddOptions(options1);
  359. string year1 = 年1.options[年.value].text;
  360. UpdateDayDropdown(year1);
  361. 日1.value= currentDay - 1;
  362. Main.Global.讀取年份=true;
  363. }
  364. private int GetDaysInMonth(int month, int year)
  365. {
  366. if (month == 2)
  367. {
  368. // 2月份平閏年的天數不一樣
  369. if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))
  370. {
  371. return 29;
  372. }
  373. else
  374. {
  375. return 28;
  376. }
  377. }
  378. else if (month == 4 || month == 6 || month == 9 || month == 11)
  379. {
  380. // 小月份
  381. return 30;
  382. }
  383. else
  384. {
  385. // 大月份
  386. return 31;
  387. }
  388. }
  389. // 更新日期選項
  390. public void UpdateDayDropdown(string year1)
  391. {
  392. // 清空日期選項
  393. 日1.options.Clear();
  394. int month = 月1.value + 1;
  395. int year = int.Parse(year1);
  396. //Debug.Log(year);
  397. int daysInMonth = GetDaysInMonth(month, year);
  398. List<TMP_Dropdown.OptionData> options = new List<TMP_Dropdown.OptionData>();
  399. for (int i = 1; i <= daysInMonth; i++)
  400. {
  401. if (i<10)
  402. {
  403. string 補零 = "0"+i.ToString();
  404. options.Add(new TMP_Dropdown.OptionData(補零));
  405. }
  406. else
  407. {
  408. options.Add(new TMP_Dropdown.OptionData(i.ToString()));
  409. }
  410. }
  411. // 添加日期選項
  412. 日1.AddOptions(options);
  413. }
  414. IEnumerator 考勤明細人員讀取(string IDname)
  415. {
  416. string strcon = "考勤明細人員讀取";
  417. string se = Main.Global.預設伺服器路徑;
  418. string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&ID={1}&se={2}", strcon, IDname, se);
  419. UnityWebRequest request = UnityWebRequest.Get(strUrl);
  420. yield return request.SendWebRequest();
  421. if (request.result == UnityWebRequest.Result.ConnectionError)
  422. {
  423. //Debug.Log(request.error);
  424. yield break;
  425. }
  426. JSONNode json1 = JSON.Parse(request.downloadHandler.text);
  427. for (int i = 0; i<json1.Count; i++)
  428. {
  429. string str = json1[i].ToString();
  430. if (json1[i]==null)
  431. {
  432. texts[i].text="";
  433. }
  434. else
  435. {
  436. str=str.Trim('"');
  437. texts[i].text=str;
  438. }
  439. }
  440. }
  441. IEnumerator 考勤查找表(string level, string date)
  442. {
  443. 讀取面板.SetActive(true);
  444. string strcon1 = "考勤查找表";
  445. string se = Main.Global.預設伺服器路徑;
  446. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&級別={2}&日期={3}", strcon1, se, level, date);
  447. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  448. yield return request1.SendWebRequest();
  449. if (request1.result == UnityWebRequest.Result.ConnectionError)
  450. {
  451. //Debug.Log(request.error);
  452. yield break;
  453. }
  454. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  455. int sum = 0;
  456. for (int i = 0; i<json.Count; i++)
  457. {
  458. GameObject textname = Instantiate(textPrefab1) as GameObject;
  459. textname.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, -sum);
  460. textname.transform.SetParent(textParent1, false);
  461. texts2 = textname.GetComponentsInChildren<TextMeshProUGUI>();
  462. Button newButton = textname.GetComponentInChildren<Button>();
  463. string idname = json[i][15].ToString();
  464. idname=idname.Trim('"');
  465. newButton.onClick.AddListener(() => OnClick(idname));
  466. Toggle[] toggle = textname.GetComponentsInChildren<Toggle>();
  467. if (json[i][12]==1)
  468. {
  469. toggle[1].isOn = true;
  470. }
  471. else
  472. {
  473. toggle[1].isOn = false;
  474. }
  475. if (json[i][11]==1)
  476. {
  477. toggle[0].isOn = true;
  478. }
  479. else
  480. {
  481. toggle[0].isOn = false;
  482. }
  483. for (int j = 0; j<json[0].Count; j++)
  484. {
  485. if (j==0)
  486. {
  487. string str0 = json[i][j].ToString();
  488. str0=str0.Trim('"');
  489. texts2[j].text=str0;
  490. texts2[j].color = Color.blue;
  491. }
  492. if (j==1)
  493. {
  494. string str1 = json[i][j].ToString();
  495. str1=str1.Trim('"');
  496. string[] parts = str1.Split(new char[] { '.', ' ' }, StringSplitOptions.RemoveEmptyEntries);
  497. string result = parts[0] + ".";
  498. if (Main.Global.系統語言=="繁體中文" || Main.Global.系統語言=="簡體中文")
  499. {
  500. result += parts[1];
  501. }
  502. else
  503. {
  504. for (int j1 = 2; j1 < parts.Length; j1++)
  505. {
  506. result += parts[j1]+" ";
  507. }
  508. }
  509. texts2[j].text=result;
  510. }
  511. if (j==2 || j==4 || j==13)
  512. {
  513. if (j==13)
  514. {
  515. texts2[j+1].text=json[i][j];
  516. }
  517. else
  518. {
  519. texts2[j].text=json[i][j];
  520. }
  521. }
  522. if (j==3)
  523. {
  524. string str3 = json[i][j].ToString();
  525. str3=str3.Trim('"');
  526. if (Main.Global.系統語言=="繁體中文" || Main.Global.系統語言=="簡體中文")
  527. {
  528. texts2[j].text=json[i][j];
  529. }
  530. else
  531. {
  532. if (str3=="星期一")
  533. {
  534. if (Main.Global.系統語言=="English")
  535. {
  536. texts2[j].text="Mon";
  537. }
  538. else
  539. {
  540. texts2[j].text="Senin";
  541. }
  542. }
  543. else if (str3=="星期二")
  544. {
  545. if (Main.Global.系統語言=="English")
  546. {
  547. texts2[j].text="Tue";
  548. }
  549. else
  550. {
  551. texts2[j].text="Selasa";
  552. }
  553. }
  554. else if (str3=="星期三")
  555. {
  556. if (Main.Global.系統語言=="English")
  557. {
  558. texts2[j].text="Wed";
  559. }
  560. else
  561. {
  562. texts2[j].text="Rabu";
  563. }
  564. }
  565. else if (str3=="星期四")
  566. {
  567. if (Main.Global.系統語言=="English")
  568. {
  569. texts2[j].text="Thu";
  570. }
  571. else
  572. {
  573. texts2[j].text="Kamis";
  574. }
  575. }
  576. else if (str3=="星期五")
  577. {
  578. if (Main.Global.系統語言=="English")
  579. {
  580. texts2[j].text="Fri";
  581. }
  582. else
  583. {
  584. texts2[j].text="Jumat";
  585. }
  586. }
  587. else if (str3=="星期六")
  588. {
  589. if (Main.Global.系統語言=="English")
  590. {
  591. texts2[j].text="Sat";
  592. }
  593. else
  594. {
  595. texts2[j].text="Sabtu";
  596. }
  597. }
  598. else if (str3=="星期日")
  599. {
  600. if (Main.Global.系統語言=="English")
  601. {
  602. texts2[j].text="Sun";
  603. }
  604. else
  605. {
  606. texts2[j].text="Minggu";
  607. }
  608. }
  609. }
  610. }
  611. if (j==13)
  612. {
  613. string str = json[i][j].ToString();
  614. str=str.Trim('"');
  615. if (Main.Global.系統語言=="繁體中文" || Main.Global.系統語言=="簡體中文")
  616. {
  617. if (str=="")
  618. {
  619. texts2[j].text="";
  620. }
  621. if (str=="1")
  622. {
  623. texts2[j].text="年假";
  624. }
  625. if (str=="2")
  626. {
  627. texts2[j].text="事假";
  628. }
  629. if (str=="3")
  630. {
  631. texts2[j].text="病假";
  632. }
  633. if (str=="4")
  634. {
  635. if (Main.Global.系統語言=="繁體中文")
  636. {
  637. texts2[j].text="產假";
  638. }
  639. else
  640. {
  641. texts2[j].text="产假";
  642. }
  643. }
  644. if (str=="5")
  645. {
  646. texts2[j].text="其他";
  647. }
  648. }
  649. else if (Main.Global.系統語言=="English")
  650. {
  651. if (str=="")
  652. {
  653. texts2[j].text="";
  654. }
  655. if (str=="1")
  656. {
  657. texts2[j].text="Annual Leave";
  658. }
  659. if (str=="2")
  660. {
  661. texts2[j].text="Personal";
  662. }
  663. if (str=="3")
  664. {
  665. texts2[j].text="Sick";
  666. }
  667. if (str=="4")
  668. {
  669. texts2[j].text="Maternity";
  670. }
  671. if (str=="5")
  672. {
  673. texts2[j].text="Other";
  674. }
  675. }
  676. else
  677. {
  678. if (str=="")
  679. {
  680. texts2[j].text="";
  681. }
  682. if (str=="1")
  683. {
  684. texts2[j].text="Cuti Tahunan";
  685. }
  686. if (str=="2")
  687. {
  688. texts2[j].text="Pribadi";
  689. }
  690. if (str=="3")
  691. {
  692. texts2[j].text="Sakit";
  693. }
  694. if (str=="4")
  695. {
  696. texts2[j].text="Melahirkan";
  697. }
  698. if (str=="5")
  699. {
  700. texts2[j].text=" Lainnya";
  701. }
  702. }
  703. }
  704. }
  705. for (int dgv = 0; dgv < 6; dgv++)
  706. {
  707. 時段1[dgv] = "";
  708. 實際1[dgv] = "";
  709. 考勤1[dgv] = "";
  710. }
  711. int CV = 0;
  712. for (int j1 = 5; j1<11; j1++)
  713. {
  714. if (json[i][j1] != null && json[i][j1] !="")
  715. {
  716. string periodtime = json[i][j1].ToString();
  717. periodtime=periodtime.Trim('"');
  718. 時段1[CV]=periodtime;
  719. CV++;
  720. }
  721. }
  722. if (時段1[0] != "" && 時段1[1] == "" && 時段1[2] == "" && 時段1[3] == "" && 時段1[4] == "" && 時段1[5] == "")
  723. {
  724. 實際1[0]=時段1[0];
  725. }
  726. else if (時段1[0] != "" && 時段1[1] != "" && 時段1[2] == "" && 時段1[3] == "" && 時段1[4] == "" && 時段1[5] == "")
  727. {
  728. string sb = 時段1[0];
  729. string sb1 = 時段1[1];
  730. string t1 = 時段1[0].Replace(":", "").Replace(".", "");
  731. string t2 = 時段1[1].Replace(":", "").Replace(".", "");
  732. if ((int.Parse(t2.Substring(0, 4)) >= 1830 || int.Parse(t2.Substring(0, 4)) <= 500) && int.Parse(t1.Substring(0, 4))<1200)
  733. {
  734. 實際1[0]=時段1[0];
  735. 實際1[1]="12:00:00";
  736. 實際1[2]="13:00:00";
  737. 實際1[3]="17:00:00";
  738. 實際1[4]="18:00:00";
  739. 實際1[5]=時段1[1];
  740. }
  741. else if (int.Parse(t2.Substring(0, 4)) < 1830 && int.Parse(t2.Substring(0, 4)) >= 1330 && int.Parse(t1.Substring(0, 4))<1200)
  742. {
  743. 實際1[0]=時段1[0];
  744. 實際1[1]="12:00:00";
  745. 實際1[2]="13:00:00";
  746. 實際1[3]=時段1[1];
  747. }
  748. else if (int.Parse(t2.Substring(0, 4)) <= 1330 && int.Parse(t1.Substring(0, 4))<1200)
  749. {
  750. 實際1[0]=時段1[0];
  751. 實際1[1]=時段1[1];
  752. }
  753. else if (int.Parse(t1.Substring(0, 4)) >= 1230 && int.Parse(t2.Substring(0, 4))<1830)
  754. {
  755. 實際1[0]=時段1[0];
  756. 實際1[1]=時段1[1];
  757. }
  758. else if (int.Parse(t1.Substring(0, 4)) >= 1230 && int.Parse(t2.Substring(0, 4))>1830)
  759. {
  760. 實際1[0]=時段[0];
  761. 實際1[1]="17:00:00";
  762. 實際1[2]="18:00:00";
  763. 實際1[3]=時段[1];
  764. }
  765. else if (int.Parse(t2.Substring(0, 4)) <= 500 && int.Parse(t1.Substring(0, 4))<1230)
  766. {
  767. 實際1[0]=時段1[0];
  768. 實際1[1]="12:00:00";
  769. 實際1[2]="13:00:00";
  770. 實際1[3]="17:00:00";
  771. 實際1[4]="18:00:00";
  772. 實際1[5]=時段1[1];
  773. }
  774. else if (int.Parse(t2.Substring(0, 4)) <= 500 && int.Parse(t1.Substring(0, 4))>1230 && int.Parse(t1.Substring(0, 4))<1730)
  775. {
  776. 實際1[0]=時段1[0];
  777. 實際1[1]="17:00:00";
  778. 實際1[2]="18:00:00";
  779. 實際1[3]=時段1[1];
  780. }
  781. else
  782. {
  783. 實際1[0]=時段1[0];
  784. 實際1[1]=時段1[1];
  785. }
  786. }
  787. else if (時段1[0] != "" && 時段1[1] != "" && 時段1[2] != "" && 時段1[3] == "" && 時段1[4] == "" && 時段1[5] == "")
  788. {
  789. string sb = 時段1[0];
  790. string sb1 = 時段1[1];
  791. string sb2 = 時段1[2];
  792. string sb_4 = 時段定點加四小(sb);
  793. string sb1_1 = 時段定點加一小(sb1);
  794. sb =時段定點(sb);
  795. sb1=時段定點(sb1);
  796. sb2=時段定點(sb2);
  797. int re = 時間比對(sb, sb2);
  798. int re1 = 時間比對(sb, sb1);
  799. int re2 = 時間比對(sb1, sb2);
  800. if (re >= 625)
  801. {
  802. if (re1 <= 325)
  803. {
  804. 實際1[0]=時段1[0];
  805. 實際1[1]=時段1[1];
  806. 實際1[2]="13:00:00";
  807. 實際1[3]="17:00:00";
  808. 實際1[4]="18:00:00";
  809. 實際1[5]=時段1[2];
  810. 考勤1[0]=sb;
  811. 考勤1[1]=sb1;
  812. 考勤1[2]="13:00:00";
  813. 考勤1[3]="17:00:00";
  814. 考勤1[4]="18:00:00";
  815. 考勤1[5]=sb2;
  816. }
  817. else
  818. {
  819. 實際1[0]=時段1[0];
  820. 實際1[1]="12:00:00";
  821. 實際1[2]="13:00:00";
  822. 實際1[3]="17:00:00";
  823. 實際1[4]="18:00:00";
  824. 實際1[5]=時段1[2];
  825. 考勤1[0]=sb;
  826. 考勤1[1]="12:00:00";
  827. 考勤1[2]="13:00:00";
  828. 考勤1[3]="17:00:00";
  829. 考勤1[4]="18:00:00";
  830. 考勤1[5]=sb2;
  831. }
  832. }
  833. else if (re < 625 && re >325)
  834. {
  835. 實際1[0]=時段1[0];
  836. 實際1[1]="12:00:00";
  837. 實際1[2]="13:00:00";
  838. 實際1[3]=時段1[2];
  839. 考勤1[0]=sb;
  840. 考勤1[1]="12:00:00";
  841. 考勤1[2]="13:00:00";
  842. 考勤1[3]=sb2;
  843. }
  844. else if (re >= 325)
  845. {
  846. if (re2>=90)
  847. {
  848. 實際1[0]=時段1[0];
  849. 實際1[1]=時段1[1];
  850. 實際1[2]=sb1_1;
  851. 實際1[3]=時段1[2];
  852. 考勤1[0]=sb;
  853. 考勤1[1]=sb1;
  854. 考勤1[2]=sb1_1;
  855. 考勤1[3]=sb2;
  856. }
  857. else
  858. {
  859. 實際1[0]=時段1[0];
  860. 實際1[1]=時段1[1];
  861. 考勤1[0]=sb;
  862. 考勤1[1]=sb1;
  863. 考勤1[2]=sb2;
  864. }
  865. }
  866. else
  867. {
  868. 實際1[0]=時段1[0];
  869. 實際1[1]=時段1[1];
  870. 考勤1[0]=sb;
  871. 考勤1[1]=sb1;
  872. 考勤1[2]=sb2;
  873. }
  874. }
  875. else if (時段1[0] != "" && 時段1[1] != "" && 時段1[2] != "" && 時段1[3] != "" && 時段1[4] == "" && 時段1[5] == "")
  876. {
  877. string sb = 時段1[0];
  878. string sb1 = 時段1[1];
  879. string sb2 = 時段1[2];
  880. string sb3 = 時段1[3];
  881. sb =時段定點(sb);
  882. sb1=時段定點(sb1);
  883. sb2 =時段定點(sb2);
  884. sb3=時段定點(sb3);
  885. int re = 時間比對(sb, sb3);
  886. int re1 = 時間比對(sb1, sb2);
  887. if (re >= 625)
  888. {
  889. if (re1<325)//改
  890. {
  891. 實際1[0]=時段1[0];
  892. 實際1[1]=時段1[1];
  893. 實際1[2]=時段1[2];
  894. 實際1[3]="17:00:00";
  895. 實際1[4]="18:00:00";
  896. 實際1[5]=時段1[3];
  897. 考勤1[0]=sb;
  898. 考勤1[1]=sb1;
  899. 考勤1[2]=sb2;
  900. 考勤1[3]="17:00:00";
  901. 考勤1[4]="18:00:00";
  902. 考勤1[5]=sb3;
  903. }
  904. else
  905. {
  906. 實際1[0]=時段1[0];
  907. 實際1[1]=時段1[1];
  908. 實際1[2]=時段1[2];
  909. 實際1[3]=時段1[3];
  910. 考勤1[0]=sb;
  911. 考勤1[1]=sb1;
  912. 考勤1[2]=sb2;
  913. 考勤1[3]=sb3;
  914. }
  915. }
  916. else
  917. {
  918. 實際1[0]=時段1[0];
  919. 實際1[1]=時段1[1];
  920. 實際1[2]=時段1[2];
  921. 實際1[3]=時段1[3];
  922. 考勤1[0]=sb;
  923. 考勤1[1]=sb1;
  924. 考勤1[2]=sb2;
  925. 考勤1[3]=sb3;
  926. }
  927. }
  928. else if (時段1[0] != "" && 時段1[1] != "" && 時段1[2] != "" && 時段1[3] != "" && 時段1[4] != "" && 時段1[5] == "")
  929. {
  930. string sb = 時段1[0];
  931. string sb1 = 時段1[1];
  932. string sb2 = 時段1[2];
  933. string sb3 = 時段1[3];
  934. string sb4 = 時段1[4];
  935. sb =時段定點(sb);
  936. sb1=時段定點(sb1);
  937. sb2 =時段定點(sb2);
  938. sb3=時段定點(sb3);
  939. sb4=時段定點(sb4);
  940. int re = 時間比對(sb, sb4);
  941. int re1 = 時間比對(sb3, sb4);
  942. if (re >= 625)
  943. {
  944. if (re1 >= 90)
  945. {
  946. 實際1[0]=時段1[0];
  947. 實際1[1]=時段1[1];
  948. 實際1[2]=時段1[2];
  949. 實際1[3]=時段1[3];
  950. 實際1[4]="18:00:00"; //改
  951. 實際1[5]=時段1[4];
  952. 考勤1[0]=sb;
  953. 考勤1[1]=sb1;
  954. 考勤1[2]=sb2;
  955. 考勤1[3]=sb3;
  956. 考勤1[4]="18:00:00"; //改
  957. 考勤1[5]=sb4;
  958. }
  959. else
  960. {
  961. 實際1[0]=時段1[0];
  962. 實際1[1]=時段1[1];
  963. 實際1[2]=時段1[2];
  964. 實際1[3]=時段1[3];
  965. 實際1[4]=時段1[4];
  966. 考勤1[0]=sb;
  967. 考勤1[1]=sb1;
  968. 考勤1[2]=sb2;
  969. 考勤1[3]=sb3;
  970. 考勤1[4]=sb4;
  971. }
  972. }
  973. else
  974. {
  975. 實際1[0]=時段1[0];
  976. 實際1[1]=時段1[1];
  977. 實際1[2]=時段1[2];
  978. 實際1[3]=時段1[3];
  979. 實際1[4]=時段1[4];
  980. 考勤1[0]=sb;
  981. 考勤1[1]=sb1;
  982. 考勤1[2]=sb2;
  983. 考勤1[3]=sb3;
  984. 考勤1[4]=sb4;
  985. }
  986. }
  987. else if (時段1[0] != "" && 時段1[1] != "" && 時段1[2] != "" && 時段1[3] != "" && 時段1[4] != "" && 時段1[5] != "")
  988. {
  989. string sb = 時段1[0];
  990. string sb1 = 時段1[1];
  991. string sb2 = 時段1[2];
  992. string sb3 = 時段1[3];
  993. string sb4 = 時段1[4];
  994. string sb5 = 時段1[5];
  995. sb =時段定點(sb);
  996. sb1=時段定點(sb1);
  997. sb2 =時段定點(sb2);
  998. sb3=時段定點(sb3);
  999. sb4=時段定點(sb4);
  1000. sb5=時段定點(sb5);
  1001. 實際1[0]=時段1[0];
  1002. 實際1[1]=時段1[1];
  1003. 實際1[2]=時段1[2];
  1004. 實際1[3]=時段1[3];
  1005. 實際1[4]=時段1[4];
  1006. 實際1[5]=時段1[5];
  1007. 考勤1[0]=sb;
  1008. 考勤1[1]=sb1;
  1009. 考勤1[2]=sb2;
  1010. 考勤1[3]=sb3;
  1011. 考勤1[4]=sb4;
  1012. 考勤1[5]=sb5;
  1013. }
  1014. else
  1015. {
  1016. 實際1[0]="";
  1017. 實際1[1]="";
  1018. 實際1[2]="";
  1019. 實際1[3]="";
  1020. 實際1[4]="";
  1021. 實際1[5]="";
  1022. 考勤1[0]="";
  1023. 考勤1[1]="";
  1024. 考勤1[2]="";
  1025. 考勤1[3]="";
  1026. 考勤1[4]="";
  1027. 考勤1[5]="";
  1028. }
  1029. for (int dge = 0; dge<6; dge++)
  1030. {
  1031. texts2[dge+5].text=實際1[dge];
  1032. }
  1033. int 時長 = 0;
  1034. if (實際1[0] != "" && 實際1[1] != "" && 實際1[2] == "" && 實際1[3] == "" && 實際1[4] == "" && 實際1[5] == "")
  1035. {
  1036. int qa = int.Parse(實際1[1].Substring(0, 2));
  1037. if (qa < 5)
  1038. {
  1039. qa+=24;
  1040. 實際1[1]=qa.ToString()+實際1[1].Substring(2);
  1041. }
  1042. string t1 = 實際1[0].Replace(":", "").Replace(".", "");
  1043. string t2 = 實際1[1].Replace(":", "").Replace(".", "");
  1044. int co1=int.Parse(t1.Substring(0, 2));
  1045. int co11 = int.Parse(t1.Substring(2, 2));
  1046. int co2=int.Parse(t2.Substring(0, 2));
  1047. int co22 = int.Parse(t2.Substring(2, 2));
  1048. if (co11>=30)
  1049. {
  1050. co1+=1;
  1051. }
  1052. if (co22>=30)
  1053. {
  1054. co2+=1;
  1055. }
  1056. if (co2<5)
  1057. {
  1058. co2+=24;
  1059. }
  1060. 時長=co2-co1;
  1061. if (時長>4)
  1062. {
  1063. texts2[11].text="04 H 00 M";
  1064. }
  1065. else
  1066. {
  1067. texts2[11].text="0"+時長.ToString()+" H 00 M";
  1068. }
  1069. }
  1070. else if (實際1[0] != "" && 實際1[1] != "" && 實際1[2] != "" && 實際1[3] != "" && 實際1[4] == "" && 實際1[5] == "")
  1071. {
  1072. for (int gg = 1; gg < 4; gg++)
  1073. {
  1074. int qa = int.Parse(實際1[gg].Substring(0, 2));
  1075. if (qa < 5)
  1076. {
  1077. qa+=24;
  1078. 實際1[gg]=qa.ToString()+實際1[gg].Substring(2);
  1079. }
  1080. }
  1081. string t1 = 實際1[0].Replace(":", "").Replace(".", "");
  1082. string t2 = 實際1[1].Replace(":", "").Replace(".", "");
  1083. string t3 = 實際1[2].Replace(":", "").Replace(".", "");
  1084. string t4 = 實際1[3].Replace(":", "").Replace(".", "");
  1085. int co1 = int.Parse(t1.Substring(0, 2));
  1086. int co11 = int.Parse(t1.Substring(2, 2));
  1087. int co2 = int.Parse(t2.Substring(0, 2));
  1088. int co22 = int.Parse(t2.Substring(2, 2));
  1089. int co3 = int.Parse(t3.Substring(0, 2));
  1090. int co33 = int.Parse(t3.Substring(2, 2));
  1091. int co4 = int.Parse(t4.Substring(0, 2));
  1092. int co44 = int.Parse(t4.Substring(2, 2));
  1093. if (co11>=30)
  1094. {
  1095. co1+=1;
  1096. }
  1097. if (co22>=30)
  1098. {
  1099. co2+=1;
  1100. }
  1101. if (co33>=30)
  1102. {
  1103. co3+=1;
  1104. }
  1105. if (co44>=30)
  1106. {
  1107. co4+=1;
  1108. }
  1109. 時長 =(co2-co1)+(co4-co3);
  1110. if (時長<=8)
  1111. {
  1112. texts2[11].text="0"+時長.ToString()+" H 00 M";
  1113. }
  1114. else
  1115. {
  1116. if (json[i][11]==1)
  1117. {
  1118. if (時長<10)
  1119. {
  1120. texts2[11].text="0"+時長.ToString()+" H 00 M";
  1121. }
  1122. else
  1123. {
  1124. texts2[11].text=時長.ToString()+" H 00 M";
  1125. }
  1126. }
  1127. else
  1128. {
  1129. texts2[11].text="08 H 00 M";
  1130. }
  1131. }
  1132. }
  1133. else if (實際1[0] != "" && 實際1[1] != "" && 實際1[2] != "" && 實際1[3] != "" && 實際1[4] != "" && 實際1[5] != "")
  1134. {
  1135. for (int gg = 1; gg < 6; gg++)
  1136. {
  1137. int qa = int.Parse(實際1[gg].Substring(0, 2));
  1138. if (qa < 5)
  1139. {
  1140. qa+=24;
  1141. 實際1[gg]=qa.ToString()+實際1[gg].Substring(2);
  1142. }
  1143. }
  1144. string t1 = 實際1[0].Replace(":", "").Replace(".", "");
  1145. string t2 = 實際1[1].Replace(":", "").Replace(".", "");
  1146. string t3 = 實際1[2].Replace(":", "").Replace(".", "");
  1147. string t4 = 實際1[3].Replace(":", "").Replace(".", "");
  1148. string t5 = 實際1[4].Replace(":", "").Replace(".", "");
  1149. string t6 = 實際1[5].Replace(":", "").Replace(".", "");
  1150. int co1 = int.Parse(t1.Substring(0, 2));
  1151. int co11 = int.Parse(t1.Substring(2, 2));
  1152. int co2 = int.Parse(t2.Substring(0, 2));
  1153. int co22 = int.Parse(t2.Substring(2, 2));
  1154. int co3 = int.Parse(t3.Substring(0, 2));
  1155. int co33 = int.Parse(t3.Substring(2, 2));
  1156. int co4 = int.Parse(t4.Substring(0, 2));
  1157. int co44 = int.Parse(t4.Substring(2, 2));
  1158. int co5 = int.Parse(t5.Substring(0, 2));
  1159. int co55 = int.Parse(t5.Substring(2, 2));
  1160. int co6 = int.Parse(t6.Substring(0, 2));
  1161. int co66 = int.Parse(t6.Substring(2, 2));
  1162. if (co11>=30)
  1163. {
  1164. co1+=1;
  1165. }
  1166. if (co22>=30)
  1167. {
  1168. co2+=1;
  1169. }
  1170. if (co33>=30)
  1171. {
  1172. co3+=1;
  1173. }
  1174. if (co44>=30)
  1175. {
  1176. co4+=1;
  1177. }
  1178. if (co55>=30)
  1179. {
  1180. co5+=1;
  1181. }
  1182. if (co66>=30)
  1183. {
  1184. co6+=1;
  1185. }
  1186. if (co2-co1 > 4)
  1187. {
  1188. if(co4-co3 > 4)
  1189. {
  1190. 時長=8+(co6-co5);
  1191. }
  1192. else
  1193. {
  1194. 時長=4+(co4-co3)+(co6-co5);
  1195. }
  1196. }
  1197. else
  1198. {
  1199. if (co4-co3 > 4)
  1200. {
  1201. 時長=(co2-co1)+4+(co6-co5);
  1202. }
  1203. else
  1204. {
  1205. 時長=(co2-co1)+(co4-co3)+(co6-co5);
  1206. }
  1207. }
  1208. if (時長<=8)
  1209. {
  1210. texts2[8].text="0"+時長.ToString()+" H 00 M";
  1211. }
  1212. else
  1213. {
  1214. if (json[i][11]==0 || json[i][11]==null)
  1215. {
  1216. texts2[11].text="08 H 00 M";
  1217. }
  1218. else
  1219. {
  1220. if (時長<10)
  1221. {
  1222. texts2[11].text="0"+時長.ToString()+" H 00 M";
  1223. }
  1224. else
  1225. {
  1226. texts2[11].text=時長.ToString()+" H 00 M";
  1227. }
  1228. }
  1229. }
  1230. }
  1231. textcopy1.Add(textname);
  1232. sum+=50;
  1233. }
  1234. textceneter1.GetComponent<RectTransform>().sizeDelta = new Vector2(textceneter1.GetComponent<RectTransform>().sizeDelta.x, sum);
  1235. 讀取面板.SetActive(false);
  1236. }
  1237. IEnumerator 考勤查找表1(string 群組, string date)
  1238. {
  1239. 讀取面板.SetActive(true);
  1240. string strcon1 = "考勤查找表1";
  1241. string se = Main.Global.預設伺服器路徑;
  1242. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA={2}&日期={3}", strcon1, se, 群組,date);
  1243. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1244. yield return request1.SendWebRequest();
  1245. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1246. {
  1247. //Debug.Log(request.error);
  1248. yield break;
  1249. }
  1250. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  1251. int sum = 0;
  1252. for (int i = 0; i<json.Count; i++)
  1253. {
  1254. GameObject textname = Instantiate(textPrefab1) as GameObject;
  1255. textname.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, -sum);
  1256. textname.transform.SetParent(textParent1, false);
  1257. texts2 = textname.GetComponentsInChildren<TextMeshProUGUI>();
  1258. Button newButton = textname.GetComponentInChildren<Button>();
  1259. string idname = json[i][15].ToString();
  1260. idname=idname.Trim('"');
  1261. newButton.onClick.AddListener(() => OnClick(idname));
  1262. Toggle[] toggle = textname.GetComponentsInChildren<Toggle>();
  1263. if (json[i][12]==1)
  1264. {
  1265. toggle[1].isOn = true;
  1266. }
  1267. else
  1268. {
  1269. toggle[1].isOn = false;
  1270. }
  1271. if (json[i][11]==1)
  1272. {
  1273. toggle[0].isOn = true;
  1274. }
  1275. else
  1276. {
  1277. toggle[0].isOn = false;
  1278. }
  1279. for (int j = 0; j<json[0].Count; j++)
  1280. {
  1281. if (j==0)
  1282. {
  1283. string str0 = json[i][j].ToString();
  1284. str0=str0.Trim('"');
  1285. texts2[j].text=str0;
  1286. texts2[j].color = Color.blue;
  1287. }
  1288. if (j==1)
  1289. {
  1290. string str1 = json[i][j].ToString();
  1291. str1=str1.Trim('"');
  1292. string[] parts = str1.Split(new char[] { '.', ' ' }, StringSplitOptions.RemoveEmptyEntries);
  1293. string result = parts[0] + ".";
  1294. if (Main.Global.系統語言=="繁體中文" || Main.Global.系統語言=="簡體中文")
  1295. {
  1296. result += parts[1];
  1297. }
  1298. else
  1299. {
  1300. for (int j1 = 2; j1 < parts.Length; j1++)
  1301. {
  1302. result += parts[j1]+" ";
  1303. }
  1304. }
  1305. texts2[j].text=result;
  1306. }
  1307. if (j==2 || j==4 || j==13)
  1308. {
  1309. if (j==13)
  1310. {
  1311. texts2[j+1].text=json[i][j];
  1312. }
  1313. else
  1314. {
  1315. texts2[j].text=json[i][j];
  1316. }
  1317. }
  1318. if (j==3)
  1319. {
  1320. string str3 = json[i][j].ToString();
  1321. str3=str3.Trim('"');
  1322. if (Main.Global.系統語言=="繁體中文" || Main.Global.系統語言=="簡體中文")
  1323. {
  1324. texts2[j].text=json[i][j];
  1325. }
  1326. else
  1327. {
  1328. if (str3=="星期一")
  1329. {
  1330. if (Main.Global.系統語言=="English")
  1331. {
  1332. texts2[j].text="Mon";
  1333. }
  1334. else
  1335. {
  1336. texts2[j].text="Senin";
  1337. }
  1338. }
  1339. else if (str3=="星期二")
  1340. {
  1341. if (Main.Global.系統語言=="English")
  1342. {
  1343. texts2[j].text="Tue";
  1344. }
  1345. else
  1346. {
  1347. texts2[j].text="Selasa";
  1348. }
  1349. }
  1350. else if (str3=="星期三")
  1351. {
  1352. if (Main.Global.系統語言=="English")
  1353. {
  1354. texts2[j].text="Wed";
  1355. }
  1356. else
  1357. {
  1358. texts2[j].text="Rabu";
  1359. }
  1360. }
  1361. else if (str3=="星期四")
  1362. {
  1363. if (Main.Global.系統語言=="English")
  1364. {
  1365. texts2[j].text="Thu";
  1366. }
  1367. else
  1368. {
  1369. texts2[j].text="Kamis";
  1370. }
  1371. }
  1372. else if (str3=="星期五")
  1373. {
  1374. if (Main.Global.系統語言=="English")
  1375. {
  1376. texts2[j].text="Fri";
  1377. }
  1378. else
  1379. {
  1380. texts2[j].text="Jumat";
  1381. }
  1382. }
  1383. else if (str3=="星期六")
  1384. {
  1385. if (Main.Global.系統語言=="English")
  1386. {
  1387. texts2[j].text="Sat";
  1388. }
  1389. else
  1390. {
  1391. texts2[j].text="Sabtu";
  1392. }
  1393. }
  1394. else if (str3=="星期日")
  1395. {
  1396. if (Main.Global.系統語言=="English")
  1397. {
  1398. texts2[j].text="Sun";
  1399. }
  1400. else
  1401. {
  1402. texts2[j].text="Minggu";
  1403. }
  1404. }
  1405. }
  1406. }
  1407. if (j==13)
  1408. {
  1409. string str = json[i][j].ToString();
  1410. str=str.Trim('"');
  1411. if (Main.Global.系統語言=="繁體中文" || Main.Global.系統語言=="簡體中文")
  1412. {
  1413. if (str=="")
  1414. {
  1415. texts2[j].text="";
  1416. }
  1417. if (str=="1")
  1418. {
  1419. texts2[j].text="年假";
  1420. }
  1421. if (str=="2")
  1422. {
  1423. texts2[j].text="事假";
  1424. }
  1425. if (str=="3")
  1426. {
  1427. texts2[j].text="病假";
  1428. }
  1429. if (str=="4")
  1430. {
  1431. if (Main.Global.系統語言=="繁體中文")
  1432. {
  1433. texts2[j].text="產假";
  1434. }
  1435. else
  1436. {
  1437. texts2[j].text="产假";
  1438. }
  1439. }
  1440. if (str=="5")
  1441. {
  1442. texts2[j].text="其他";
  1443. }
  1444. }
  1445. else if (Main.Global.系統語言=="English")
  1446. {
  1447. if (str=="")
  1448. {
  1449. texts2[j].text="";
  1450. }
  1451. if (str=="1")
  1452. {
  1453. texts2[j].text="Annual Leave";
  1454. }
  1455. if (str=="2")
  1456. {
  1457. texts2[j].text="Personal";
  1458. }
  1459. if (str=="3")
  1460. {
  1461. texts2[j].text="Sick";
  1462. }
  1463. if (str=="4")
  1464. {
  1465. texts2[j].text="Maternity";
  1466. }
  1467. if (str=="5")
  1468. {
  1469. texts2[j].text="Other";
  1470. }
  1471. }
  1472. else
  1473. {
  1474. if (str=="")
  1475. {
  1476. texts2[j].text="";
  1477. }
  1478. if (str=="1")
  1479. {
  1480. texts2[j].text="Cuti Tahunan";
  1481. }
  1482. if (str=="2")
  1483. {
  1484. texts2[j].text="Pribadi";
  1485. }
  1486. if (str=="3")
  1487. {
  1488. texts2[j].text="Sakit";
  1489. }
  1490. if (str=="4")
  1491. {
  1492. texts2[j].text="Melahirkan";
  1493. }
  1494. if (str=="5")
  1495. {
  1496. texts2[j].text=" Lainnya";
  1497. }
  1498. }
  1499. }
  1500. }
  1501. for (int dgv = 0; dgv < 6; dgv++)
  1502. {
  1503. 時段1[dgv] = "";
  1504. 實際1[dgv] = "";
  1505. 考勤1[dgv] = "";
  1506. }
  1507. int CV = 0;
  1508. for (int j1 = 5; j1<11; j1++)
  1509. {
  1510. if (json[i][j1] != null && json[i][j1] !="")
  1511. {
  1512. string periodtime = json[i][j1].ToString();
  1513. periodtime=periodtime.Trim('"');
  1514. 時段1[CV]=periodtime;
  1515. CV++;
  1516. }
  1517. }
  1518. if (時段1[0] != "" && 時段1[1] == "" && 時段1[2] == "" && 時段1[3] == "" && 時段1[4] == "" && 時段1[5] == "")
  1519. {
  1520. 實際1[0]=時段1[0];
  1521. }
  1522. else if (時段1[0] != "" && 時段1[1] != "" && 時段1[2] == "" && 時段1[3] == "" && 時段1[4] == "" && 時段1[5] == "")
  1523. {
  1524. string sb = 時段1[0];
  1525. string sb1 = 時段1[1];
  1526. string t1 = 時段1[0].Replace(":", "").Replace(".", "");
  1527. string t2 = 時段1[1].Replace(":", "").Replace(".", "");
  1528. if ((int.Parse(t2.Substring(0, 4)) >= 1830 || int.Parse(t2.Substring(0, 4)) <= 500) && int.Parse(t1.Substring(0, 4))<1200)
  1529. {
  1530. 實際1[0]=時段1[0];
  1531. 實際1[1]="12:00:00";
  1532. 實際1[2]="13:00:00";
  1533. 實際1[3]="17:00:00";
  1534. 實際1[4]="18:00:00";
  1535. 實際1[5]=時段1[1];
  1536. }
  1537. else if (int.Parse(t2.Substring(0, 4)) < 1830 && int.Parse(t2.Substring(0, 4)) >= 1330 && int.Parse(t1.Substring(0, 4))<1200)
  1538. {
  1539. 實際1[0]=時段1[0];
  1540. 實際1[1]="12:00:00";
  1541. 實際1[2]="13:00:00";
  1542. 實際1[3]=時段1[1];
  1543. }
  1544. else if (int.Parse(t2.Substring(0, 4)) <= 1330 && int.Parse(t1.Substring(0, 4))<1200)
  1545. {
  1546. 實際1[0]=時段1[0];
  1547. 實際1[1]=時段1[1];
  1548. }
  1549. else if (int.Parse(t1.Substring(0, 4)) >= 1230 && int.Parse(t2.Substring(0, 4))<1830)
  1550. {
  1551. 實際1[0]=時段1[0];
  1552. 實際1[1]=時段1[1];
  1553. }
  1554. else if (int.Parse(t1.Substring(0, 4)) >= 1230 && int.Parse(t2.Substring(0, 4))>1830)
  1555. {
  1556. 實際1[0]=時段[0];
  1557. 實際1[1]="17:00:00";
  1558. 實際1[2]="18:00:00";
  1559. 實際1[3]=時段[1];
  1560. }
  1561. else if (int.Parse(t2.Substring(0, 4)) <= 500 && int.Parse(t1.Substring(0, 4))<1230)
  1562. {
  1563. 實際1[0]=時段1[0];
  1564. 實際1[1]="12:00:00";
  1565. 實際1[2]="13:00:00";
  1566. 實際1[3]="17:00:00";
  1567. 實際1[4]="18:00:00";
  1568. 實際1[5]=時段1[1];
  1569. }
  1570. else if (int.Parse(t2.Substring(0, 4)) <= 500 && int.Parse(t1.Substring(0, 4))>1230 && int.Parse(t1.Substring(0, 4))<1730)
  1571. {
  1572. 實際1[0]=時段1[0];
  1573. 實際1[1]="17:00:00";
  1574. 實際1[2]="18:00:00";
  1575. 實際1[3]=時段1[1];
  1576. }
  1577. else
  1578. {
  1579. 實際1[0]=時段1[0];
  1580. 實際1[1]=時段1[1];
  1581. }
  1582. }
  1583. else if (時段1[0] != "" && 時段1[1] != "" && 時段1[2] != "" && 時段1[3] == "" && 時段1[4] == "" && 時段1[5] == "")
  1584. {
  1585. string sb = 時段1[0];
  1586. string sb1 = 時段1[1];
  1587. string sb2 = 時段1[2];
  1588. string sb_4 = 時段定點加四小(sb);
  1589. string sb1_1 = 時段定點加一小(sb1);
  1590. sb =時段定點(sb);
  1591. sb1=時段定點(sb1);
  1592. sb2=時段定點(sb2);
  1593. int re = 時間比對(sb, sb2);
  1594. int re1 = 時間比對(sb, sb1);
  1595. int re2 = 時間比對(sb1, sb2);
  1596. if (re >= 625)
  1597. {
  1598. if (re1 <= 325)
  1599. {
  1600. 實際1[0]=時段1[0];
  1601. 實際1[1]=時段1[1];
  1602. 實際1[2]="13:00:00";
  1603. 實際1[3]="17:00:00";
  1604. 實際1[4]="18:00:00";
  1605. 實際1[5]=時段1[2];
  1606. 考勤1[0]=sb;
  1607. 考勤1[1]=sb1;
  1608. 考勤1[2]="13:00:00";
  1609. 考勤1[3]="17:00:00";
  1610. 考勤1[4]="18:00:00";
  1611. 考勤1[5]=sb2;
  1612. }
  1613. else
  1614. {
  1615. 實際1[0]=時段1[0];
  1616. 實際1[1]="12:00:00";
  1617. 實際1[2]="13:00:00";
  1618. 實際1[3]="17:00:00";
  1619. 實際1[4]="18:00:00";
  1620. 實際1[5]=時段1[2];
  1621. 考勤1[0]=sb;
  1622. 考勤1[1]="12:00:00";
  1623. 考勤1[2]="13:00:00";
  1624. 考勤1[3]="17:00:00";
  1625. 考勤1[4]="18:00:00";
  1626. 考勤1[5]=sb2;
  1627. }
  1628. }
  1629. else if (re < 625 && re >325)
  1630. {
  1631. 實際1[0]=時段1[0];
  1632. 實際1[1]="12:00:00";
  1633. 實際1[2]="13:00:00";
  1634. 實際1[3]=時段1[2];
  1635. 考勤1[0]=sb;
  1636. 考勤1[1]="12:00:00";
  1637. 考勤1[2]="13:00:00";
  1638. 考勤1[3]=sb2;
  1639. }
  1640. else if (re >= 325)
  1641. {
  1642. if (re2>=90)
  1643. {
  1644. 實際1[0]=時段1[0];
  1645. 實際1[1]=時段1[1];
  1646. 實際1[2]=sb1_1;
  1647. 實際1[3]=時段1[2];
  1648. 考勤1[0]=sb;
  1649. 考勤1[1]=sb1;
  1650. 考勤1[2]=sb1_1;
  1651. 考勤1[3]=sb2;
  1652. }
  1653. else
  1654. {
  1655. 實際1[0]=時段1[0];
  1656. 實際1[1]=時段1[1];
  1657. 考勤1[0]=sb;
  1658. 考勤1[1]=sb1;
  1659. 考勤1[2]=sb2;
  1660. }
  1661. }
  1662. else
  1663. {
  1664. 實際1[0]=時段1[0];
  1665. 實際1[1]=時段1[1];
  1666. 考勤1[0]=sb;
  1667. 考勤1[1]=sb1;
  1668. 考勤1[2]=sb2;
  1669. }
  1670. }
  1671. else if (時段1[0] != "" && 時段1[1] != "" && 時段1[2] != "" && 時段1[3] != "" && 時段1[4] == "" && 時段1[5] == "")
  1672. {
  1673. string sb = 時段1[0];
  1674. string sb1 = 時段1[1];
  1675. string sb2 = 時段1[2];
  1676. string sb3 = 時段1[3];
  1677. sb =時段定點(sb);
  1678. sb1=時段定點(sb1);
  1679. sb2 =時段定點(sb2);
  1680. sb3=時段定點(sb3);
  1681. int re = 時間比對(sb, sb3);
  1682. int re1 = 時間比對(sb1, sb2);
  1683. if (re >= 625)
  1684. {
  1685. if (re1<325)//改
  1686. {
  1687. 實際1[0]=時段1[0];
  1688. 實際1[1]=時段1[1];
  1689. 實際1[2]=時段1[2];
  1690. 實際1[3]="17:00:00";
  1691. 實際1[4]="18:00:00";
  1692. 實際1[5]=時段1[3];
  1693. 考勤1[0]=sb;
  1694. 考勤1[1]=sb1;
  1695. 考勤1[2]=sb2;
  1696. 考勤1[3]="17:00:00";
  1697. 考勤1[4]="18:00:00";
  1698. 考勤1[5]=sb3;
  1699. }
  1700. else
  1701. {
  1702. 實際1[0]=時段1[0];
  1703. 實際1[1]=時段1[1];
  1704. 實際1[2]=時段1[2];
  1705. 實際1[3]=時段1[3];
  1706. 考勤1[0]=sb;
  1707. 考勤1[1]=sb1;
  1708. 考勤1[2]=sb2;
  1709. 考勤1[3]=sb3;
  1710. }
  1711. }
  1712. else
  1713. {
  1714. 實際1[0]=時段1[0];
  1715. 實際1[1]=時段1[1];
  1716. 實際1[2]=時段1[2];
  1717. 實際1[3]=時段1[3];
  1718. 考勤1[0]=sb;
  1719. 考勤1[1]=sb1;
  1720. 考勤1[2]=sb2;
  1721. 考勤1[3]=sb3;
  1722. }
  1723. }
  1724. else if (時段1[0] != "" && 時段1[1] != "" && 時段1[2] != "" && 時段1[3] != "" && 時段1[4] != "" && 時段1[5] == "")
  1725. {
  1726. string sb = 時段1[0];
  1727. string sb1 = 時段1[1];
  1728. string sb2 = 時段1[2];
  1729. string sb3 = 時段1[3];
  1730. string sb4 = 時段1[4];
  1731. sb =時段定點(sb);
  1732. sb1=時段定點(sb1);
  1733. sb2 =時段定點(sb2);
  1734. sb3=時段定點(sb3);
  1735. sb4=時段定點(sb4);
  1736. int re = 時間比對(sb, sb4);
  1737. int re1 = 時間比對(sb3, sb4);
  1738. if (re >= 625)
  1739. {
  1740. if (re1 >= 90)
  1741. {
  1742. 實際1[0]=時段1[0];
  1743. 實際1[1]=時段1[1];
  1744. 實際1[2]=時段1[2];
  1745. 實際1[3]=時段1[3];
  1746. 實際1[4]="18:00:00"; //改
  1747. 實際1[5]=時段1[4];
  1748. 考勤1[0]=sb;
  1749. 考勤1[1]=sb1;
  1750. 考勤1[2]=sb2;
  1751. 考勤1[3]=sb3;
  1752. 考勤1[4]="18:00:00"; //改
  1753. 考勤1[5]=sb4;
  1754. }
  1755. else
  1756. {
  1757. 實際1[0]=時段1[0];
  1758. 實際1[1]=時段1[1];
  1759. 實際1[2]=時段1[2];
  1760. 實際1[3]=時段1[3];
  1761. 實際1[4]=時段1[4];
  1762. 考勤1[0]=sb;
  1763. 考勤1[1]=sb1;
  1764. 考勤1[2]=sb2;
  1765. 考勤1[3]=sb3;
  1766. 考勤1[4]=sb4;
  1767. }
  1768. }
  1769. else
  1770. {
  1771. 實際1[0]=時段1[0];
  1772. 實際1[1]=時段1[1];
  1773. 實際1[2]=時段1[2];
  1774. 實際1[3]=時段1[3];
  1775. 實際1[4]=時段1[4];
  1776. 考勤1[0]=sb;
  1777. 考勤1[1]=sb1;
  1778. 考勤1[2]=sb2;
  1779. 考勤1[3]=sb3;
  1780. 考勤1[4]=sb4;
  1781. }
  1782. }
  1783. else if (時段1[0] != "" && 時段1[1] != "" && 時段1[2] != "" && 時段1[3] != "" && 時段1[4] != "" && 時段1[5] != "")
  1784. {
  1785. string sb = 時段1[0];
  1786. string sb1 = 時段1[1];
  1787. string sb2 = 時段1[2];
  1788. string sb3 = 時段1[3];
  1789. string sb4 = 時段1[4];
  1790. string sb5 = 時段1[5];
  1791. sb =時段定點(sb);
  1792. sb1=時段定點(sb1);
  1793. sb2 =時段定點(sb2);
  1794. sb3=時段定點(sb3);
  1795. sb4=時段定點(sb4);
  1796. sb5=時段定點(sb5);
  1797. 實際1[0]=時段1[0];
  1798. 實際1[1]=時段1[1];
  1799. 實際1[2]=時段1[2];
  1800. 實際1[3]=時段1[3];
  1801. 實際1[4]=時段1[4];
  1802. 實際1[5]=時段1[5];
  1803. 考勤1[0]=sb;
  1804. 考勤1[1]=sb1;
  1805. 考勤1[2]=sb2;
  1806. 考勤1[3]=sb3;
  1807. 考勤1[4]=sb4;
  1808. 考勤1[5]=sb5;
  1809. }
  1810. else
  1811. {
  1812. 實際1[0]="";
  1813. 實際1[1]="";
  1814. 實際1[2]="";
  1815. 實際1[3]="";
  1816. 實際1[4]="";
  1817. 實際1[5]="";
  1818. 考勤1[0]="";
  1819. 考勤1[1]="";
  1820. 考勤1[2]="";
  1821. 考勤1[3]="";
  1822. 考勤1[4]="";
  1823. 考勤1[5]="";
  1824. }
  1825. for (int dge = 0; dge<6; dge++)
  1826. {
  1827. texts2[dge+5].text=實際1[dge];
  1828. }
  1829. int 時長 = 0;
  1830. if (實際1[0] != "" && 實際1[1] != "" && 實際1[2] == "" && 實際1[3] == "" && 實際1[4] == "" && 實際1[5] == "")
  1831. {
  1832. int qa = int.Parse(實際1[1].Substring(0, 2));
  1833. if (qa < 5)
  1834. {
  1835. qa+=24;
  1836. 實際1[1]=qa.ToString()+實際1[1].Substring(2);
  1837. }
  1838. string t1 = 實際1[0].Replace(":", "").Replace(".", "");
  1839. string t2 = 實際1[1].Replace(":", "").Replace(".", "");
  1840. int co1 = int.Parse(t1.Substring(0, 2));
  1841. int co11 = int.Parse(t1.Substring(2, 2));
  1842. int co2 = int.Parse(t2.Substring(0, 2));
  1843. int co22 = int.Parse(t2.Substring(2, 2));
  1844. if (co11>=30)
  1845. {
  1846. co1+=1;
  1847. }
  1848. if (co22>=30)
  1849. {
  1850. co2+=1;
  1851. }
  1852. if (co2<5)
  1853. {
  1854. co2+=24;
  1855. }
  1856. 時長=co2-co1;
  1857. if (時長>4)
  1858. {
  1859. texts2[11].text="04 H 00 M";
  1860. }
  1861. else
  1862. {
  1863. texts2[11].text="0"+時長.ToString()+" H 00 M";
  1864. }
  1865. }
  1866. else if (實際1[0] != "" && 實際1[1] != "" && 實際1[2] != "" && 實際1[3] != "" && 實際1[4] == "" && 實際1[5] == "")
  1867. {
  1868. for (int gg = 1; gg < 4; gg++)
  1869. {
  1870. int qa = int.Parse(實際1[gg].Substring(0, 2));
  1871. if (qa < 5)
  1872. {
  1873. qa+=24;
  1874. 實際1[gg]=qa.ToString()+實際1[gg].Substring(2);
  1875. }
  1876. }
  1877. string t1 = 實際1[0].Replace(":", "").Replace(".", "");
  1878. string t2 = 實際1[1].Replace(":", "").Replace(".", "");
  1879. string t3 = 實際1[2].Replace(":", "").Replace(".", "");
  1880. string t4 = 實際1[3].Replace(":", "").Replace(".", "");
  1881. int co1 = int.Parse(t1.Substring(0, 2));
  1882. int co11 = int.Parse(t1.Substring(2, 2));
  1883. int co2 = int.Parse(t2.Substring(0, 2));
  1884. int co22 = int.Parse(t2.Substring(2, 2));
  1885. int co3 = int.Parse(t3.Substring(0, 2));
  1886. int co33 = int.Parse(t3.Substring(2, 2));
  1887. int co4 = int.Parse(t4.Substring(0, 2));
  1888. int co44 = int.Parse(t4.Substring(2, 2));
  1889. if (co11>=30)
  1890. {
  1891. co1+=1;
  1892. }
  1893. if (co22>=30)
  1894. {
  1895. co2+=1;
  1896. }
  1897. if (co33>=30)
  1898. {
  1899. co3+=1;
  1900. }
  1901. if (co44>=30)
  1902. {
  1903. co4+=1;
  1904. }
  1905. 時長 =(co2-co1)+(co4-co3);
  1906. if (時長<=8)
  1907. {
  1908. texts2[11].text="0"+時長.ToString()+" H 00 M";
  1909. }
  1910. else
  1911. {
  1912. if (json[i][11]==1)
  1913. {
  1914. if (時長<10)
  1915. {
  1916. texts2[11].text="0"+時長.ToString()+" H 00 M";
  1917. }
  1918. else
  1919. {
  1920. texts2[11].text=時長.ToString()+" H 00 M";
  1921. }
  1922. }
  1923. else
  1924. {
  1925. texts2[11].text="08 H 00 M";
  1926. }
  1927. }
  1928. }
  1929. else if (實際1[0] != "" && 實際1[1] != "" && 實際1[2] != "" && 實際1[3] != "" && 實際1[4] != "" && 實際1[5] != "")
  1930. {
  1931. for (int gg = 1; gg < 6; gg++)
  1932. {
  1933. int qa = int.Parse(實際1[gg].Substring(0, 2));
  1934. if (qa < 5)
  1935. {
  1936. qa+=24;
  1937. 實際1[gg]=qa.ToString()+實際1[gg].Substring(2);
  1938. }
  1939. }
  1940. string t1 = 實際1[0].Replace(":", "").Replace(".", "");
  1941. string t2 = 實際1[1].Replace(":", "").Replace(".", "");
  1942. string t3 = 實際1[2].Replace(":", "").Replace(".", "");
  1943. string t4 = 實際1[3].Replace(":", "").Replace(".", "");
  1944. string t5 = 實際1[4].Replace(":", "").Replace(".", "");
  1945. string t6 = 實際1[5].Replace(":", "").Replace(".", "");
  1946. int co1 = int.Parse(t1.Substring(0, 2));
  1947. int co11 = int.Parse(t1.Substring(2, 2));
  1948. int co2 = int.Parse(t2.Substring(0, 2));
  1949. int co22 = int.Parse(t2.Substring(2, 2));
  1950. int co3 = int.Parse(t3.Substring(0, 2));
  1951. int co33 = int.Parse(t3.Substring(2, 2));
  1952. int co4 = int.Parse(t4.Substring(0, 2));
  1953. int co44 = int.Parse(t4.Substring(2, 2));
  1954. int co5 = int.Parse(t5.Substring(0, 2));
  1955. int co55 = int.Parse(t5.Substring(2, 2));
  1956. int co6 = int.Parse(t6.Substring(0, 2));
  1957. int co66 = int.Parse(t6.Substring(2, 2));
  1958. if (co11>=30)
  1959. {
  1960. co1+=1;
  1961. }
  1962. if (co22>=30)
  1963. {
  1964. co2+=1;
  1965. }
  1966. if (co33>=30)
  1967. {
  1968. co3+=1;
  1969. }
  1970. if (co44>=30)
  1971. {
  1972. co4+=1;
  1973. }
  1974. if (co55>=30)
  1975. {
  1976. co5+=1;
  1977. }
  1978. if (co66>=30)
  1979. {
  1980. co6+=1;
  1981. }
  1982. if (co2-co1 > 4)
  1983. {
  1984. if (co4-co3 > 4)
  1985. {
  1986. 時長=8+(co6-co5);
  1987. }
  1988. else
  1989. {
  1990. 時長=4+(co4-co3)+(co6-co5);
  1991. }
  1992. }
  1993. else
  1994. {
  1995. if (co4-co3 > 4)
  1996. {
  1997. 時長=(co2-co1)+4+(co6-co5);
  1998. }
  1999. else
  2000. {
  2001. 時長=(co2-co1)+(co4-co3)+(co6-co5);
  2002. }
  2003. }
  2004. if (時長<=8)
  2005. {
  2006. texts2[8].text="0"+時長.ToString()+" H 00 M";
  2007. }
  2008. else
  2009. {
  2010. if (json[i][11]==0 || json[i][11]==null)
  2011. {
  2012. texts2[11].text="08 H 00 M";
  2013. }
  2014. else
  2015. {
  2016. if (時長<10)
  2017. {
  2018. texts2[11].text="0"+時長.ToString()+" H 00 M";
  2019. }
  2020. else
  2021. {
  2022. texts2[11].text=時長.ToString()+" H 00 M";
  2023. }
  2024. }
  2025. }
  2026. }
  2027. textcopy1.Add(textname);
  2028. sum+=50;
  2029. }
  2030. textceneter1.GetComponent<RectTransform>().sizeDelta = new Vector2(textceneter1.GetComponent<RectTransform>().sizeDelta.x, sum);
  2031. 讀取面板.SetActive(false);
  2032. }
  2033. IEnumerator 考勤明細表(string IDname, string date)
  2034. {
  2035. 讀取面板.SetActive(true);
  2036. if (textcopy3 != null)
  2037. {
  2038. DeletetextCopies3();
  2039. }
  2040. if (textcopy2 != null)
  2041. {
  2042. DeletetextCopies2();
  2043. }
  2044. string strcon1 = "考勤明細表";
  2045. string se = Main.Global.預設伺服器路徑;
  2046. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&ID={2}&日期={3}", strcon1, se, IDname, date);
  2047. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  2048. yield return request1.SendWebRequest();
  2049. if (request1.result == UnityWebRequest.Result.ConnectionError)
  2050. {
  2051. //Debug.Log(request.error);
  2052. yield break;
  2053. }
  2054. jsonData=JSON.Parse(request1.downloadHandler.text);
  2055. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  2056. //Debug.Log(Main.Global.系統語言);
  2057. int sum = 0;
  2058. int totaltime = 0;
  2059. for (int i = 0; i<json.Count; i++)
  2060. {
  2061. GameObject textname = Instantiate(textPrefab) as GameObject;
  2062. textname.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, -sum);
  2063. textname.transform.SetParent(textParent, false);
  2064. texts1 = textname.GetComponentsInChildren<TextMeshProUGUI>();
  2065. Image[] childImages = textname.GetComponentsInChildren<Image>();
  2066. Toggle[] toggle = textname.GetComponentsInChildren<Toggle>();
  2067. if (json[i][9]==1)
  2068. {
  2069. toggle[1].isOn = true;
  2070. }
  2071. else
  2072. {
  2073. toggle[1].isOn = false;
  2074. }
  2075. if (json[i][8]==1)
  2076. {
  2077. toggle[0].isOn = true;
  2078. }
  2079. else
  2080. {
  2081. toggle[0].isOn = false;
  2082. }
  2083. string da = json[i][0].ToString();
  2084. da=da.Trim('"');
  2085. if (da=="星期日" || json[i][9]==1) {
  2086. foreach (Image childImage in childImages)
  2087. {
  2088. if (childImage.transform.parent == textname.transform) // 檢查是否是小圖像
  2089. {
  2090. childImage.color = new Color32(255, 160, 160, 255); // 改為紅色,你可以自己更改顏色
  2091. }
  2092. }
  2093. }
  2094. if (da=="星期六") {
  2095. foreach (Image childImage in childImages)
  2096. {
  2097. if (childImage.transform.parent == textname.transform) // 檢查是否是小圖像
  2098. {
  2099. childImage.color = new Color32(255, 255, 130, 255); // 改為紅色,你可以自己更改顏色
  2100. }
  2101. }
  2102. }
  2103. for (int j = 0; j<json[0].Count; j++)
  2104. {
  2105. if (j==0)
  2106. {
  2107. string str1 = json[i][j].ToString();
  2108. str1=str1.Trim('"');
  2109. if (Main.Global.系統語言=="繁體中文" || Main.Global.系統語言=="簡體中文")
  2110. {
  2111. texts1[j].text=json[i][j];
  2112. }
  2113. else
  2114. {
  2115. if (str1=="星期一")
  2116. {
  2117. if (Main.Global.系統語言=="English")
  2118. {
  2119. texts1[j].text="Mon";
  2120. }
  2121. else
  2122. {
  2123. texts1[j].text="Senin";
  2124. }
  2125. }
  2126. else if (str1=="星期二")
  2127. {
  2128. if (Main.Global.系統語言=="English")
  2129. {
  2130. texts1[j].text="Tue";
  2131. }
  2132. else
  2133. {
  2134. texts1[j].text="Selasa";
  2135. }
  2136. }
  2137. else if (str1=="星期三")
  2138. {
  2139. if (Main.Global.系統語言=="English")
  2140. {
  2141. texts1[j].text="Wed";
  2142. }
  2143. else
  2144. {
  2145. texts1[j].text="Rabu";
  2146. }
  2147. }
  2148. else if (str1=="星期四")
  2149. {
  2150. if (Main.Global.系統語言=="English")
  2151. {
  2152. texts1[j].text="Thu";
  2153. }
  2154. else
  2155. {
  2156. texts1[j].text="Kamis";
  2157. }
  2158. }
  2159. else if (str1=="星期五")
  2160. {
  2161. if (Main.Global.系統語言=="English")
  2162. {
  2163. texts1[j].text="Fri";
  2164. }
  2165. else
  2166. {
  2167. texts1[j].text="Jumat";
  2168. }
  2169. }
  2170. else if (str1=="星期六")
  2171. {
  2172. if (Main.Global.系統語言=="English")
  2173. {
  2174. texts1[j].text="Sat";
  2175. }
  2176. else
  2177. {
  2178. texts1[j].text="Sabtu";
  2179. }
  2180. }
  2181. else if (str1=="星期日")
  2182. {
  2183. if (Main.Global.系統語言=="English")
  2184. {
  2185. texts1[j].text="Sun";
  2186. }
  2187. else
  2188. {
  2189. texts1[j].text="Minggu";
  2190. }
  2191. }
  2192. }
  2193. }
  2194. if (j==1)
  2195. {
  2196. texts1[j].text=json[i][j];
  2197. }
  2198. if (j==12)
  2199. {
  2200. texts1[j].text=json[i][j-1];
  2201. }
  2202. if (j==11)
  2203. {
  2204. string str = json[i][12].ToString();
  2205. str=str.Trim('"');
  2206. if (Main.Global.系統語言=="繁體中文")
  2207. {
  2208. if (str=="")
  2209. {
  2210. texts1[j].text="";
  2211. }
  2212. if (str=="1")
  2213. {
  2214. texts1[j].text="年假";
  2215. }
  2216. if (str=="2")
  2217. {
  2218. texts1[j].text="事假";
  2219. }
  2220. if (str=="3")
  2221. {
  2222. texts1[j].text="病假";
  2223. }
  2224. if (str=="4")
  2225. {
  2226. texts1[j].text="產假";
  2227. }
  2228. if (str=="5")
  2229. {
  2230. texts1[j].text="其他";
  2231. }
  2232. }
  2233. else if (Main.Global.系統語言=="English")
  2234. {
  2235. if (str=="")
  2236. {
  2237. texts1[j].text="";
  2238. }
  2239. if (str=="1")
  2240. {
  2241. texts1[j].text="Annual Leave";
  2242. }
  2243. if (str=="2")
  2244. {
  2245. texts1[j].text="Personal";
  2246. }
  2247. if (str=="3")
  2248. {
  2249. texts1[j].text="Sick";
  2250. }
  2251. if (str=="4")
  2252. {
  2253. texts1[j].text="Maternity";
  2254. }
  2255. if (str=="5")
  2256. {
  2257. texts1[j].text="Other";
  2258. }
  2259. }
  2260. else
  2261. {
  2262. if (str=="")
  2263. {
  2264. texts1[j].text="";
  2265. }
  2266. if (str=="1")
  2267. {
  2268. texts1[j].text="Cuti Tahunan";
  2269. }
  2270. if (str=="2")
  2271. {
  2272. texts1[j].text="Pribadi";
  2273. }
  2274. if (str=="3")
  2275. {
  2276. texts1[j].text="Sakit";
  2277. }
  2278. if (str=="4")
  2279. {
  2280. texts1[j].text="Melahirkan";
  2281. }
  2282. if (str=="5")
  2283. {
  2284. texts1[j].text=" Lainnya";
  2285. }
  2286. }
  2287. }
  2288. }
  2289. for (int dgv = 0; dgv < 6; dgv++)
  2290. {
  2291. 時段[dgv] = "";
  2292. 實際[dgv] = "";
  2293. 考勤[dgv] = "";
  2294. }
  2295. int CV = 0;
  2296. for (int j1 = 2; j1<8; j1++)
  2297. {
  2298. if (json[i][j1] != null && json[i][j1] !="")
  2299. {
  2300. string periodtime = json[i][j1].ToString();
  2301. periodtime=periodtime.Trim('"');
  2302. 時段[CV]=periodtime;
  2303. CV++;
  2304. }
  2305. }
  2306. if (時段[0] != "" && 時段[1] == "" && 時段[2] == "" && 時段[3] == "" && 時段[4] == "" && 時段[5] == "")
  2307. {
  2308. 實際[0]=時段[0];
  2309. string sb = 時段定點(時段[0]);
  2310. 考勤[0]=sb;
  2311. }
  2312. else if (時段[0] != "" && 時段[1] != "" && 時段[2] == "" && 時段[3] == "" && 時段[4] == "" && 時段[5] == "")
  2313. {
  2314. string sb = 時段[0];
  2315. string sb1 = 時段[1];
  2316. string sb_4 = 時段定點加四小(sb);
  2317. string t1 = 時段[0].Replace(":", "").Replace(".", "");
  2318. string t2 = 時段[1].Replace(":", "").Replace(".", "");
  2319. sb =時段定點(sb);
  2320. sb1=時段定點(sb1);
  2321. if ((int.Parse(t2.Substring(0, 4)) >= 1830 || int.Parse(t2.Substring(0, 4)) <= 500) && int.Parse(t1.Substring(0, 4))<1200)
  2322. {
  2323. 實際[0]=時段[0];
  2324. 實際[1]="12:00:00";
  2325. 實際[2]="13:00:00";
  2326. 實際[3]="17:00:00";
  2327. 實際[4]="18:00:00";
  2328. 實際[5]=時段[1];
  2329. 考勤[0]=sb;
  2330. 考勤[1]="12:00:00";
  2331. 考勤[2]="13:00:00";
  2332. 考勤[3]="17:00:00";
  2333. 考勤[4]="18:00:00";
  2334. 考勤[5]=sb1;
  2335. }
  2336. else if (int.Parse(t2.Substring(0, 4)) < 1830 && int.Parse(t2.Substring(0, 4)) >= 1330 && int.Parse(t1.Substring(0, 4))<1200)
  2337. {
  2338. 實際[0]=時段[0];
  2339. 實際[1]="12:00:00";
  2340. 實際[2]="13:00:00";
  2341. 實際[3]=時段[1];
  2342. 考勤[0]=sb;
  2343. 考勤[1]="12:00:00";
  2344. 考勤[2]="13:00:00";
  2345. 考勤[3]=sb1;
  2346. }
  2347. else if (int.Parse(t2.Substring(0, 4)) <= 1330 && int.Parse(t1.Substring(0, 4))<1200)
  2348. {
  2349. 實際[0]=時段[0];
  2350. 實際[1]=時段[1];
  2351. 考勤[0]=sb;
  2352. 考勤[1]=sb_4;
  2353. }
  2354. else if (int.Parse(t1.Substring(0, 4)) >= 1230 && int.Parse(t2.Substring(0, 4))<1830)
  2355. {
  2356. 實際[0]=時段[0];
  2357. 實際[1]=時段[1];
  2358. 考勤[0]=sb;
  2359. 考勤[1]=sb1;
  2360. }
  2361. else if (int.Parse(t1.Substring(0, 4)) >= 1230 && int.Parse(t2.Substring(0, 4))>1830)
  2362. {
  2363. 實際[0]=時段[0];
  2364. 實際[1]="17:00:00";
  2365. 實際[2]="18:00:00";
  2366. 實際[3]=時段[1];
  2367. 考勤[0]=sb;
  2368. 考勤[1]="17:00:00";
  2369. 考勤[2]="18:00:00";
  2370. 考勤[3]=sb1;
  2371. }
  2372. /*string sb_4 = 時段定點加四小(sb);
  2373. sb =時段定點(sb);
  2374. sb1=時段定點(sb1);
  2375. int re = 時間比對(sb, sb1);
  2376. if (re >= 625)
  2377. {
  2378. 實際[0]=時段[0];
  2379. 實際[1]="12:00:00";
  2380. 實際[2]="13:00:00";
  2381. 實際[3]="17:00:00";
  2382. 實際[4]="18:00:00";
  2383. 實際[5]=時段[1];
  2384. 考勤[0]=sb;
  2385. 考勤[1]="12:00:00";
  2386. 考勤[2]="13:00:00";
  2387. 考勤[3]="17:00:00";
  2388. 考勤[4]="18:00:00";
  2389. 考勤[5]=sb1;
  2390. }
  2391. else if (re < 625 && re >=325)
  2392. {
  2393. 實際[0]=時段[0];
  2394. 實際[1]="12:00:00";
  2395. 實際[2]="13:00:00";
  2396. 實際[3]=時段[1];
  2397. 考勤[0]=sb;
  2398. 考勤[1]="12:00:00";
  2399. 考勤[2]="13:00:00";
  2400. 考勤[3]=sb1;
  2401. }
  2402. else if (re < 325)
  2403. {
  2404. 實際[0]=時段[0];
  2405. 實際[1]=時段[1];
  2406. 考勤[0]=sb;
  2407. 考勤[1]=sb_4;
  2408. }*/
  2409. }
  2410. else if (時段[0] != "" && 時段[1] != "" && 時段[2] != "" && 時段[3] == "" && 時段[4] == "" && 時段[5] == "")
  2411. {
  2412. string sb = 時段[0];
  2413. string sb1 = 時段[1];
  2414. string sb2 = 時段[2];
  2415. string sb_4 = 時段定點加四小(sb);
  2416. string sb1_1 = 時段定點加一小(sb1);
  2417. sb =時段定點(sb);
  2418. sb1=時段定點(sb1);
  2419. sb2=時段定點(sb2);
  2420. int re = 時間比對(sb, sb2);
  2421. int re1 = 時間比對(sb, sb1);
  2422. int re2 = 時間比對(sb1, sb2);
  2423. if (re >= 625)
  2424. {
  2425. if (re1 <= 325)
  2426. {
  2427. 實際[0]=時段[0];
  2428. 實際[1]=時段[1];
  2429. 實際[2]="13:00:00";
  2430. 實際[3]="17:00:00";
  2431. 實際[4]="18:00:00";
  2432. 實際[5]=時段[2];
  2433. 考勤[0]=sb;
  2434. 考勤[1]=sb1;
  2435. 考勤[2]="13:00:00";
  2436. 考勤[3]="17:00:00";
  2437. 考勤[4]="18:00:00";
  2438. 考勤[5]=sb2;
  2439. }
  2440. else
  2441. {
  2442. 實際[0]=時段[0];
  2443. 實際[1]="12:00:00";
  2444. 實際[2]="13:00:00";
  2445. 實際[3]="17:00:00";
  2446. 實際[4]="18:00:00";
  2447. 實際[5]=時段[2];
  2448. 考勤[0]=sb;
  2449. 考勤[1]="12:00:00";
  2450. 考勤[2]="13:00:00";
  2451. 考勤[3]="17:00:00";
  2452. 考勤[4]="18:00:00";
  2453. 考勤[5]=sb2;
  2454. }
  2455. }
  2456. else if (re < 625 && re >325)
  2457. {
  2458. 實際[0]=時段[0];
  2459. 實際[1]="12:00:00";
  2460. 實際[2]="13:00:00";
  2461. 實際[3]=時段[2];
  2462. 考勤[0]=sb;
  2463. 考勤[1]="12:00:00";
  2464. 考勤[2]="13:00:00";
  2465. 考勤[3]=sb2;
  2466. }
  2467. else if (re >= 325)
  2468. {
  2469. if (re2>=90)
  2470. {
  2471. 實際[0]=時段[0];
  2472. 實際[1]=時段[1];
  2473. 實際[2]=sb1_1;
  2474. 實際[3]=時段[2];
  2475. 考勤[0]=sb;
  2476. 考勤[1]=sb1;
  2477. 考勤[2]=sb1_1;
  2478. 考勤[3]=sb2;
  2479. }
  2480. else
  2481. {
  2482. 實際[0]=時段[0];
  2483. 實際[1]=時段[1];
  2484. 考勤[0]=sb;
  2485. 考勤[1]=sb1;
  2486. 考勤[2]=sb2;
  2487. }
  2488. }
  2489. else
  2490. {
  2491. 實際[0]=時段[0];
  2492. 實際[1]=時段[1];
  2493. 考勤[0]=sb;
  2494. 考勤[1]=sb1;
  2495. 考勤[2]=sb2;
  2496. }
  2497. }
  2498. else if (時段[0] != "" && 時段[1] != "" && 時段[2] != "" && 時段[3] != "" && 時段[4] == "" && 時段[5] == "")
  2499. {
  2500. string sb = 時段[0];
  2501. string sb1 = 時段[1];
  2502. string sb2 = 時段[2];
  2503. string sb3 = 時段[3];
  2504. sb =時段定點(sb);
  2505. sb1=時段定點(sb1);
  2506. sb2 =時段定點(sb2);
  2507. sb3=時段定點(sb3);
  2508. int re = 時間比對(sb, sb3);
  2509. int re1 = 時間比對(sb1, sb2);
  2510. if (re >= 625)
  2511. {
  2512. if (re1<325)//改
  2513. {
  2514. 實際[0]=時段[0];
  2515. 實際[1]=時段[1];
  2516. 實際[2]=時段[2];
  2517. 實際[3]="17:00:00";
  2518. 實際[4]="18:00:00";
  2519. 實際[5]=時段[3];
  2520. 考勤[0]=sb;
  2521. 考勤[1]=sb1;
  2522. 考勤[2]=sb2;
  2523. 考勤[3]="17:00:00";
  2524. 考勤[4]="18:00:00";
  2525. 考勤[5]=sb3;
  2526. }
  2527. else
  2528. {
  2529. 實際[0]=時段[0];
  2530. 實際[1]=時段[1];
  2531. 實際[2]=時段[2];
  2532. 實際[3]=時段[3];
  2533. 考勤[0]=sb;
  2534. 考勤[1]=sb1;
  2535. 考勤[2]=sb2;
  2536. 考勤[3]=sb3;
  2537. }
  2538. }
  2539. else
  2540. {
  2541. 實際[0]=時段[0];
  2542. 實際[1]=時段[1];
  2543. 實際[2]=時段[2];
  2544. 實際[3]=時段[3];
  2545. 考勤[0]=sb;
  2546. 考勤[1]=sb1;
  2547. 考勤[2]=sb2;
  2548. 考勤[3]=sb3;
  2549. }
  2550. }
  2551. else if (時段[0] != "" && 時段[1] != "" && 時段[2] != "" && 時段[3] != "" && 時段[4] != "" && 時段[5] == "")
  2552. {
  2553. string sb = 時段[0];
  2554. string sb1 = 時段[1];
  2555. string sb2 = 時段[2];
  2556. string sb3 = 時段[3];
  2557. string sb4 = 時段[4];
  2558. sb =時段定點(sb);
  2559. sb1=時段定點(sb1);
  2560. sb2 =時段定點(sb2);
  2561. sb3=時段定點(sb3);
  2562. sb4=時段定點(sb4);
  2563. int re = 時間比對(sb, sb4);
  2564. int re1 = 時間比對(sb3, sb4);
  2565. if (re >= 625)
  2566. {
  2567. if (re1 >= 90)
  2568. {
  2569. 實際[0]=時段[0];
  2570. 實際[1]=時段[1];
  2571. 實際[2]=時段[2];
  2572. 實際[3]=時段[3];
  2573. 實際[4]="18:00:00"; //改
  2574. 實際[5]=時段[4];
  2575. 考勤[0]=sb;
  2576. 考勤[1]=sb1;
  2577. 考勤[2]=sb2;
  2578. 考勤[3]=sb3;
  2579. 考勤[4]="18:00:00"; //改
  2580. 考勤[5]=sb4;
  2581. }
  2582. else
  2583. {
  2584. 實際[0]=時段[0];
  2585. 實際[1]=時段[1];
  2586. 實際[2]=時段[2];
  2587. 實際[3]=時段[3];
  2588. 實際[4]=時段[4];
  2589. 考勤[0]=sb;
  2590. 考勤[1]=sb1;
  2591. 考勤[2]=sb2;
  2592. 考勤[3]=sb3;
  2593. 考勤[4]=sb4;
  2594. }
  2595. }
  2596. else
  2597. {
  2598. 實際[0]=時段[0];
  2599. 實際[1]=時段[1];
  2600. 實際[2]=時段[2];
  2601. 實際[3]=時段[3];
  2602. 實際[4]=時段[4];
  2603. 考勤[0]=sb;
  2604. 考勤[1]=sb1;
  2605. 考勤[2]=sb2;
  2606. 考勤[3]=sb3;
  2607. 考勤[4]=sb4;
  2608. }
  2609. }
  2610. else if (時段[0] != "" && 時段[1] != "" && 時段[2] != "" && 時段[3] != "" && 時段[4] != "" && 時段[5] != "")
  2611. {
  2612. string sb = 時段[0];
  2613. string sb1 = 時段[1];
  2614. string sb2 = 時段[2];
  2615. string sb3 = 時段[3];
  2616. string sb4 = 時段[4];
  2617. string sb5 = 時段[5];
  2618. sb =時段定點(sb);
  2619. sb1=時段定點(sb1);
  2620. sb2 =時段定點(sb2);
  2621. sb3=時段定點(sb3);
  2622. sb4=時段定點(sb4);
  2623. sb5=時段定點(sb5);
  2624. 實際[0]=時段[0];
  2625. 實際[1]=時段[1];
  2626. 實際[2]=時段[2];
  2627. 實際[3]=時段[3];
  2628. 實際[4]=時段[4];
  2629. 實際[5]=時段[5];
  2630. 考勤[0]=sb;
  2631. 考勤[1]=sb1;
  2632. 考勤[2]=sb2;
  2633. 考勤[3]=sb3;
  2634. 考勤[4]=sb4;
  2635. 考勤[5]=sb5;
  2636. }
  2637. else
  2638. {
  2639. 實際[0]="";
  2640. 實際[1]="";
  2641. 實際[2]="";
  2642. 實際[3]="";
  2643. 實際[4]="";
  2644. 實際[5]="";
  2645. 考勤[0]="";
  2646. 考勤[1]="";
  2647. 考勤[2]="";
  2648. 考勤[3]="";
  2649. 考勤[4]="";
  2650. 考勤[5]="";
  2651. }
  2652. if (實際考勤==0)
  2653. {
  2654. for (int dge = 0; dge<6; dge++)
  2655. {
  2656. texts1[dge+2].text=實際[dge];
  2657. }
  2658. }
  2659. else
  2660. {
  2661. for (int dgi = 0; dgi<6; dgi++)
  2662. {
  2663. texts1[dgi+2].text=考勤[dgi];
  2664. }
  2665. }
  2666. string tr = json[i][0].ToString();
  2667. tr=tr.Trim('"');
  2668. bool trs = false;
  2669. if (json[i][8]==null || json[i][8]==0)
  2670. {
  2671. trs = false;
  2672. }
  2673. else
  2674. {
  2675. trs = true;
  2676. }
  2677. int 時長 = 0;
  2678. if ((trs==false && json[i][9]==1)||(trs==false && tr=="星期日"))
  2679. {
  2680. texts1[8].text="00 H 00 M";
  2681. }
  2682. else
  2683. {
  2684. if (實際[0] != "" && 實際[1] != "" && 實際[2] == "" && 實際[3] == "" && 實際[4] == "" && 實際[5] == "")
  2685. {
  2686. int qa = int.Parse(實際[1].Substring(0, 2));
  2687. if (qa < 5)
  2688. {
  2689. qa+=24;
  2690. 實際[1]=qa.ToString()+實際[1].Substring(2);
  2691. }
  2692. string t1 = 實際[0].Replace(":", "").Replace(".", "");
  2693. string t2 = 實際[1].Replace(":", "").Replace(".", "");
  2694. int co1 = int.Parse(t1.Substring(0, 2));
  2695. int co11 = int.Parse(t1.Substring(2, 2));
  2696. int co2 = int.Parse(t2.Substring(0, 2));
  2697. int co22 = int.Parse(t2.Substring(2, 2));
  2698. if (co11>=30)
  2699. {
  2700. co1+=1;
  2701. }
  2702. if (co22>=30)
  2703. {
  2704. co2+=1;
  2705. }
  2706. if (co2<5)
  2707. {
  2708. co2+=24;
  2709. }
  2710. 時長=co2-co1;
  2711. if (時長>4)
  2712. {
  2713. texts1[8].text="04 H 00 M";
  2714. }
  2715. else
  2716. {
  2717. texts1[8].text="0"+時長.ToString()+" H 00 M";
  2718. }
  2719. }
  2720. else if (實際[0] != "" && 實際[1] != "" && 實際[2] != "" && 實際[3] != "" && 實際[4] == "" && 實際[5] == "")
  2721. {
  2722. for (int gg = 1; gg < 4; gg++)
  2723. {
  2724. int qa = int.Parse(實際[gg].Substring(0, 2));
  2725. if (qa < 5)
  2726. {
  2727. qa+=24;
  2728. 實際[gg]=qa.ToString()+實際[gg].Substring(2);
  2729. }
  2730. }
  2731. string t1 = 實際[0].Replace(":", "").Replace(".", "");
  2732. string t2 = 實際[1].Replace(":", "").Replace(".", "");
  2733. string t3 = 實際[2].Replace(":", "").Replace(".", "");
  2734. string t4 = 實際[3].Replace(":", "").Replace(".", "");
  2735. int co1 = int.Parse(t1.Substring(0, 2));
  2736. int co11 = int.Parse(t1.Substring(2, 2));
  2737. int co2 = int.Parse(t2.Substring(0, 2));
  2738. int co22 = int.Parse(t2.Substring(2, 2));
  2739. int co3 = int.Parse(t3.Substring(0, 2));
  2740. int co33 = int.Parse(t3.Substring(2, 2));
  2741. int co4 = int.Parse(t4.Substring(0, 2));
  2742. int co44 = int.Parse(t4.Substring(2, 2));
  2743. if (co11>=30)
  2744. {
  2745. co1+=1;
  2746. }
  2747. if (co22>=30)
  2748. {
  2749. co2+=1;
  2750. }
  2751. if (co33>=30)
  2752. {
  2753. co3+=1;
  2754. }
  2755. if (co44>=30)
  2756. {
  2757. co4+=1;
  2758. }
  2759. 時長 =(co2-co1)+(co4-co3);
  2760. if (時長<=8)
  2761. {
  2762. texts1[8].text="0"+時長.ToString()+" H 00 M";
  2763. }
  2764. else
  2765. {
  2766. if (json[i][8]==1)
  2767. {
  2768. if (時長<10)
  2769. {
  2770. texts1[8].text="0"+時長.ToString()+" H 00 M";
  2771. }
  2772. else
  2773. {
  2774. texts1[8].text=時長.ToString()+" H 00 M";
  2775. }
  2776. }
  2777. else
  2778. {
  2779. texts1[8].text="08 H 00 M";
  2780. }
  2781. }
  2782. if (時長<=8)
  2783. {
  2784. texts1[8].text="0"+時長.ToString()+" H 00 M";
  2785. }
  2786. else
  2787. {
  2788. if (json[i][8]==1)
  2789. {
  2790. if (時長<10)
  2791. {
  2792. texts1[8].text="0"+時長.ToString()+" H 00 M";
  2793. }
  2794. else
  2795. {
  2796. texts1[8].text=時長.ToString()+" H 00 M";
  2797. }
  2798. }
  2799. else
  2800. {
  2801. texts1[8].text="08 H 00 M";
  2802. }
  2803. }
  2804. }
  2805. else if (實際[0] != "" && 實際[1] != "" && 實際[2] != "" && 實際[3] != "" && 實際[4] != "" && 實際[5] != "")
  2806. {
  2807. for (int gg = 1; gg < 6; gg++)
  2808. {
  2809. int qa = int.Parse(實際[gg].Substring(0, 2));
  2810. if (qa < 5)
  2811. {
  2812. qa+=24;
  2813. 實際[gg]=qa.ToString()+實際[gg].Substring(2);
  2814. }
  2815. }
  2816. string t1 = 實際[0].Replace(":", "").Replace(".", "");
  2817. string t2 = 實際[1].Replace(":", "").Replace(".", "");
  2818. string t3 = 實際[2].Replace(":", "").Replace(".", "");
  2819. string t4 = 實際[3].Replace(":", "").Replace(".", "");
  2820. string t5 = 實際[4].Replace(":", "").Replace(".", "");
  2821. string t6 = 實際[5].Replace(":", "").Replace(".", "");
  2822. int co1 = int.Parse(t1.Substring(0, 2));
  2823. int co11 = int.Parse(t1.Substring(2, 2));
  2824. int co2 = int.Parse(t2.Substring(0, 2));
  2825. int co22 = int.Parse(t2.Substring(2, 2));
  2826. int co3 = int.Parse(t3.Substring(0, 2));
  2827. int co33 = int.Parse(t3.Substring(2, 2));
  2828. int co4 = int.Parse(t4.Substring(0, 2));
  2829. int co44 = int.Parse(t4.Substring(2, 2));
  2830. int co5 = int.Parse(t5.Substring(0, 2));
  2831. int co55 = int.Parse(t5.Substring(2, 2));
  2832. int co6 = int.Parse(t6.Substring(0, 2));
  2833. int co66 = int.Parse(t6.Substring(2, 2));
  2834. if (co11>=30)
  2835. {
  2836. co1+=1;
  2837. }
  2838. if (co22>=30)
  2839. {
  2840. co2+=1;
  2841. }
  2842. if (co33>=30)
  2843. {
  2844. co3+=1;
  2845. }
  2846. if (co44>=30)
  2847. {
  2848. co4+=1;
  2849. }
  2850. if (co55>=30)
  2851. {
  2852. co5+=1;
  2853. }
  2854. if (co66>=30)
  2855. {
  2856. co6+=1;
  2857. }
  2858. if (co2-co1 > 4)
  2859. {
  2860. if (co4-co3 > 4)
  2861. {
  2862. 時長=8+(co6-co5);
  2863. }
  2864. else
  2865. {
  2866. 時長=4+(co4-co3)+(co6-co5);
  2867. }
  2868. }
  2869. else
  2870. {
  2871. if (co4-co3 > 4)
  2872. {
  2873. 時長=(co2-co1)+4+(co6-co5);
  2874. }
  2875. else
  2876. {
  2877. 時長=(co2-co1)+(co4-co3)+(co6-co5);
  2878. }
  2879. }
  2880. if (時長<=8)
  2881. {
  2882. texts1[8].text="0"+時長.ToString()+" H 00 M";
  2883. }
  2884. else
  2885. {
  2886. if (json[i][8]==0 || json[i][8]==null)
  2887. {
  2888. texts1[8].text="08 H 00 M";
  2889. }
  2890. else
  2891. {
  2892. if (時長<10)
  2893. {
  2894. texts1[8].text="0"+時長.ToString()+" H 00 M";
  2895. }
  2896. else
  2897. {
  2898. texts1[8].text=時長.ToString()+" H 00 M";
  2899. }
  2900. }
  2901. }
  2902. }
  2903. }
  2904. if (texts1[8].text !="")
  2905. {
  2906. int duration = int.Parse(texts1[8].text.Substring(0, 2));
  2907. totaltime+=duration;
  2908. }
  2909. for (int ga = 0; ga < 6; ga++)
  2910. {
  2911. if (ga>0 && 實際[ga] != "")
  2912. {
  2913. string tom = 實際[ga];
  2914. string tom1 = tom.Substring(0, 2);
  2915. string tom2 = tom.Substring(2);
  2916. int tom3 = int.Parse(tom1);
  2917. if (tom3 < 5)
  2918. {
  2919. tom3+=24;
  2920. jsonData[i][ga+2]=tom3.ToString()+tom2;
  2921. }
  2922. else
  2923. {
  2924. jsonData[i][ga+2]=實際[ga];
  2925. }
  2926. }
  2927. else
  2928. {
  2929. jsonData[i][ga+2]=實際[ga];
  2930. }
  2931. }
  2932. textcopy.Add(textname);
  2933. sum+=50;
  2934. }
  2935. int min = 0;
  2936. int max = 0;
  2937. Debug.Log(點擊ID);
  2938. Debug.Log(Main.Global.ID);
  2939. if (點擊ID != "" || Main.Global.ID != "")
  2940. {
  2941. //Debug.Log(jsonData);
  2942. for (int cv = 0; cv < jsonData.Count; cv++)
  2943. {
  2944. //Debug.Log(jsonData[cv][2].ToString());
  2945. if (jsonData[cv][2] != "")
  2946. {
  2947. string qq = jsonData[cv][2].ToString().Trim('"');
  2948. string qq1 = qq.Substring(0, 2);
  2949. int mi = int.Parse(qq1);
  2950. if (min==0)
  2951. {
  2952. min = mi;
  2953. }
  2954. else if (min > mi)
  2955. {
  2956. min = mi;
  2957. }
  2958. }
  2959. if (jsonData[cv][7] != "")
  2960. {
  2961. string qq = jsonData[cv][7].ToString().Trim('"');
  2962. string qq1 = qq.Substring(0, 2);
  2963. int ma = int.Parse(qq1);
  2964. if (ma > max)
  2965. {
  2966. max = ma;
  2967. }
  2968. }
  2969. else
  2970. {
  2971. if (jsonData[cv][5] != "")
  2972. {
  2973. string qq = jsonData[cv][5].ToString().Trim('"');
  2974. string qq1 = qq.Substring(0, 2);
  2975. int ma = int.Parse(qq1);
  2976. if (ma > max)
  2977. {
  2978. max = ma;
  2979. }
  2980. }
  2981. else
  2982. {
  2983. if (jsonData[cv][3] !="")
  2984. {
  2985. string qq = jsonData[cv][3].ToString().Trim('"');
  2986. string qq1 = qq.Substring(0, 2);
  2987. int ma = int.Parse(qq1);
  2988. if (ma > max)
  2989. {
  2990. max = ma;
  2991. }
  2992. }
  2993. }
  2994. }
  2995. }
  2996. float sc = 630 /(max-min+1);
  2997. for (int x = min; x<=max+1; x++)
  2998. {
  2999. GameObject buttonObj2 = Instantiate(buttonPrefab2) as GameObject;
  3000. buttonObj2.GetComponent<RectTransform>().anchoredPosition = new Vector2(-12, -2+(x-min)*sc);
  3001. buttonObj2.transform.SetParent(buttonParent2, false);
  3002. TextMeshProUGUI text = buttonObj2.GetComponentInChildren<TextMeshProUGUI>();
  3003. if (x<10)
  3004. {
  3005. text.text = "0"+x.ToString()+":00";
  3006. }
  3007. else
  3008. {
  3009. text.text = x.ToString()+":00";
  3010. }
  3011. textcopy4.Add(buttonObj2);
  3012. }
  3013. for (int dgt = 0; dgt < 6; dgt++)
  3014. {
  3015. 實際2[dgt] = "";
  3016. }
  3017. for (int y = 0; y < jsonData.Count; y++)
  3018. {
  3019. GameObject buttonObj = Instantiate(buttonPrefab) as GameObject;
  3020. buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(100+45*(y), 0);
  3021. buttonObj.transform.SetParent(buttonParent, false);
  3022. string qwe = json[y][0].ToString().Trim('"');
  3023. string asd = json[y][1].ToString().Trim('"');
  3024. string zxc = asd.Substring(asd.Length - 2);
  3025. string zxc1 = qwe.Substring(qwe.Length - 1);
  3026. if(Main.Global.系統語言=="繁體中文" || Main.Global.系統語言=="簡體中文")
  3027. {
  3028. buttonObj.GetComponent<TextMeshProUGUI>().text=zxc+zxc1;
  3029. }
  3030. else
  3031. {
  3032. if(zxc1 == "一")
  3033. {
  3034. buttonObj.GetComponent<TextMeshProUGUI>().text=zxc+"M\nO\nN";
  3035. }
  3036. else if (zxc1 == "二")
  3037. {
  3038. buttonObj.GetComponent<TextMeshProUGUI>().text=zxc+"T\nU\nE";
  3039. }
  3040. else if (zxc1 == "三")
  3041. {
  3042. buttonObj.GetComponent<TextMeshProUGUI>().text=zxc+"W\nE\nD";
  3043. }
  3044. else if (zxc1 == "四")
  3045. {
  3046. buttonObj.GetComponent<TextMeshProUGUI>().text=zxc+"T\nH\nU";
  3047. }
  3048. else if (zxc1 == "五")
  3049. {
  3050. buttonObj.GetComponent<TextMeshProUGUI>().text=zxc+"F\nR\nI";
  3051. }
  3052. else if (zxc1 == "六")
  3053. {
  3054. buttonObj.GetComponent<TextMeshProUGUI>().text=zxc+"S\nA\nT";
  3055. }
  3056. else if (zxc1 == "日")
  3057. {
  3058. buttonObj.GetComponent<TextMeshProUGUI>().text=zxc+"S\nU\nN";
  3059. }
  3060. }
  3061. textcopy2.Add(buttonObj);
  3062. for (int dgs = 0; dgs < 6; dgs++)
  3063. {
  3064. 實際2[dgs] = jsonData[y][dgs+2].ToString().Trim('"');
  3065. }
  3066. if (實際2[0] != "" && 實際2[1] != "" && 實際2[2] == "" && 實際2[3] == "" && 實際2[4] == "" && 實際2[5] == "")
  3067. {
  3068. /*string timeString = 實際[0];
  3069. string[] timeParts = timeString.Split(':');
  3070. int hour = int.Parse(timeParts[0]);
  3071. int minute = int.Parse(timeParts[1]);
  3072. int second = int.Parse(timeParts[2]);
  3073. string timeString1 = 實際[1];
  3074. string[] timeParts1 = timeString1.Split(':');
  3075. int hour1 = int.Parse(timeParts1[0]);
  3076. int minute1 = int.Parse(timeParts1[1]);
  3077. int second1 = int.Parse(timeParts1[2]);
  3078. GameObject buttonObj1 = Instantiate(buttonPrefab1) as GameObject;
  3079. float y2 = (float)((hour-6)*35 + (minute*60+second)*35/3600);
  3080. float y1 = (float)((hour1-6)*35 + (minute1*60+second1)*35/3600);*/
  3081. string timeString = 實際2[0].Replace(":", "").Replace(".", "");
  3082. string timeString1 = 實際2[1].Replace(":", "").Replace(".", "");
  3083. int hour = int.Parse(timeString.Substring(0, 2));
  3084. int minute = int.Parse(timeString.Substring(2, 2));
  3085. int second = int.Parse(timeString.Substring(4, 2));
  3086. int hour1 = int.Parse(timeString1.Substring(0, 2));
  3087. int minute1 = int.Parse(timeString1.Substring(2, 2));
  3088. int second1 = int.Parse(timeString1.Substring(4, 2));
  3089. GameObject buttonObj1 = Instantiate(buttonPrefab1) as GameObject;
  3090. float y2 = (float)((hour-min)*sc + (minute*60+second)*sc/3600);
  3091. float y1 = (float)((hour1-min)*sc + (minute1*60+second1)*sc/3600);
  3092. buttonObj1.GetComponent<RectTransform>().sizeDelta = new Vector2(20, y1-y2);
  3093. buttonObj1.GetComponent<RectTransform>().anchoredPosition = new Vector2(112.5f+y*45f, 100+y2);
  3094. buttonObj1.transform.SetParent(buttonParent1, false);
  3095. textcopy3.Add(buttonObj1);
  3096. }
  3097. else if (實際2[0] != "" && 實際2[1] != "" && 實際2[2] != "" && 實際2[3] != "" && 實際2[4] == "" && 實際2[5] == "")
  3098. {
  3099. for (int g = 0; g < 3; g+=2)
  3100. {
  3101. string timeString = 實際2[g].Replace(":", "").Replace(".", "");
  3102. string timeString1 = 實際2[g+1].Replace(":", "").Replace(".", "");
  3103. int hour = int.Parse(timeString.Substring(0, 2));
  3104. int minute = int.Parse(timeString.Substring(2, 2));
  3105. int second = int.Parse(timeString.Substring(4, 2));
  3106. int hour1 = int.Parse(timeString1.Substring(0, 2));
  3107. int minute1 = int.Parse(timeString1.Substring(2, 2));
  3108. int second1 = int.Parse(timeString1.Substring(4, 2));
  3109. GameObject buttonObj1 = Instantiate(buttonPrefab1) as GameObject;
  3110. float y2 = (float)((hour-min)*sc + (minute*60+second)*sc/3600);
  3111. float y1 = (float)((hour1-min)*sc + (minute1*60+second1)*sc/3600);
  3112. buttonObj1.GetComponent<RectTransform>().sizeDelta = new Vector2(20, y1-y2);
  3113. buttonObj1.GetComponent<RectTransform>().anchoredPosition = new Vector2(112.5f+y*45f, 100+y2); // 修改初始位置
  3114. buttonObj1.transform.SetParent(buttonParent1, false);
  3115. textcopy3.Add(buttonObj1);
  3116. }
  3117. }
  3118. else if (實際2[0] != "" && 實際2[1] != "" && 實際2[2] != "" && 實際2[3] != "" && 實際2[4] != "" && 實際2[5] != "")
  3119. {
  3120. for (int h = 0; h < 5; h+=2)
  3121. {
  3122. string timeString = 實際2[h].Replace(":", "").Replace(".", "");
  3123. string timeString1 = 實際2[h+1].Replace(":", "").Replace(".", "");
  3124. int hour = int.Parse(timeString.Substring(0, 2));
  3125. int minute = int.Parse(timeString.Substring(2, 2));
  3126. int second = int.Parse(timeString.Substring(4, 2));
  3127. int hour1 = int.Parse(timeString1.Substring(0, 2));
  3128. int minute1 = int.Parse(timeString1.Substring(2, 2));
  3129. int second1 = int.Parse(timeString1.Substring(4, 2));
  3130. GameObject buttonObj1 = Instantiate(buttonPrefab1) as GameObject;
  3131. float y2 = (float)((hour-min)*sc + (minute*60+second)*sc/3600);
  3132. float y1 = (float)((hour1-min)*sc + (minute1*60+second1)*sc/3600);
  3133. buttonObj1.GetComponent<RectTransform>().sizeDelta = new Vector2(20, y1-y2);
  3134. buttonObj1.GetComponent<RectTransform>().anchoredPosition = new Vector2(112.5f+y*45f, 100+y2); // 修改初始位置
  3135. buttonObj1.transform.SetParent(buttonParent1, false);
  3136. textcopy3.Add(buttonObj1);
  3137. }
  3138. }
  3139. }
  3140. }
  3141. Debug.Log(min);
  3142. Debug.Log(max);
  3143. if (totaltime<10)
  3144. {
  3145. 總時數_s.text="0"+totaltime.ToString()+" H 00 M";
  3146. }
  3147. else
  3148. {
  3149. 總時數_s.text=totaltime.ToString()+" H 00 M";
  3150. }
  3151. textceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(textceneter.GetComponent<RectTransform>().sizeDelta.x, sum);
  3152. 讀取面板.SetActive(false);
  3153. }
  3154. public void 月份切換()
  3155. {
  3156. if (Main.Global.讀取年份==true)
  3157. {
  3158. year = 年.options[年.value].text;
  3159. month = 月.options[月.value].text;
  3160. date = year+"/"+month;
  3161. //Debug.Log(date);
  3162. if (textcopy != null)
  3163. {
  3164. DeletetextCopies();
  3165. }
  3166. if (textcopy2 != null)
  3167. {
  3168. DeletetextCopies2();
  3169. }
  3170. if (textcopy3 != null)
  3171. {
  3172. DeletetextCopies3();
  3173. }
  3174. if (Main.Global.部門編號==3)
  3175. {
  3176. StartCoroutine(考勤明細表(Main.Global.ID, date));
  3177. }
  3178. else
  3179. {
  3180. StartCoroutine(考勤明細表(點擊ID, date));
  3181. }
  3182. }
  3183. }
  3184. private string 時段定點減一小(string x1)
  3185. {
  3186. string 時 = x1.Substring(0, 2);
  3187. string 分 = x1.Substring(3, 2);
  3188. if ((時 == "23" && int.Parse(分) >= 30) || (時 == "00" && int.Parse(分) < 30))
  3189. {
  3190. x1 = "23:00:00";
  3191. }
  3192. else if ((時 == "00" && int.Parse(分) >= 30) || (時 == "01" && int.Parse(分) < 30))
  3193. {
  3194. x1 = "00:00:00";
  3195. }
  3196. else if ((時 == "01" && int.Parse(分) >= 30) || (時 == "02" && int.Parse(分) < 30))
  3197. {
  3198. x1 = "01:00:00";
  3199. }
  3200. else if ((時 == "02" && int.Parse(分) >= 30) || (時 == "03" && int.Parse(分) < 30))
  3201. {
  3202. x1 = "02:00:00";
  3203. }
  3204. else if ((時 == "03" && int.Parse(分) >= 30) || (時 == "04" && int.Parse(分) < 30))
  3205. {
  3206. x1 = "03:00:00";
  3207. }
  3208. else if ((時 == "04" && int.Parse(分) >= 30) || (時 == "05" && int.Parse(分) < 30))
  3209. {
  3210. x1 = "04:00:00";
  3211. }
  3212. else if ((時 == "05" && int.Parse(分) >= 30) || (時 == "06" && int.Parse(分) < 30))
  3213. {
  3214. x1 = "05:00:00";
  3215. }
  3216. else if ((時 == "06" && int.Parse(分) >= 30) || (時 == "07" && int.Parse(分) < 30))
  3217. {
  3218. x1 = "06:00:00";
  3219. }
  3220. else if ((時 == "07" && int.Parse(分) >= 30) || (時 == "08" && int.Parse(分) < 30))
  3221. {
  3222. x1 = "07:00:00";
  3223. }
  3224. else if ((時 == "08" && int.Parse(分) >= 30) || (時 == "09" && int.Parse(分) < 30))
  3225. {
  3226. x1 = "08:00:00";
  3227. }
  3228. else if ((時 == "09" && int.Parse(分) >= 30) || (時 == "10" && int.Parse(分) < 30))
  3229. {
  3230. x1 = "09:00:00";
  3231. }
  3232. else if ((時 == "10" && int.Parse(分) >= 30) || (時 == "11" && int.Parse(分) < 30))
  3233. {
  3234. x1 = "10:00:00";
  3235. }
  3236. else if ((時 == "11" && int.Parse(分) >= 30) || (時 == "12" && int.Parse(分) < 30))
  3237. {
  3238. x1 = "11:00:00";
  3239. }
  3240. else if ((時 == "12" && int.Parse(分) >= 30) || (時 == "13" && int.Parse(分) < 30))
  3241. {
  3242. x1 = "12:00:00";
  3243. }
  3244. else if ((時 == "13" && int.Parse(分) >= 30) || (時 == "14" && int.Parse(分) < 30))
  3245. {
  3246. x1 = "13:00:00";
  3247. }
  3248. else if ((時 == "14" && int.Parse(分) >= 30) || (時 == "15" && int.Parse(分) < 30))
  3249. {
  3250. x1 = "14:00:00";
  3251. }
  3252. else if ((時 == "15" && int.Parse(分) >= 30) || (時 == "16" && int.Parse(分) < 30))
  3253. {
  3254. x1 = "15:00:00";
  3255. }
  3256. else if ((時 == "16" && int.Parse(分) >= 30) || (時 == "17" && int.Parse(分) < 30))
  3257. {
  3258. x1 = "16:00:00";
  3259. }
  3260. else if ((時 == "17" && int.Parse(分) >= 30) || (時 == "18" && int.Parse(分) < 30))
  3261. {
  3262. x1 = "17:00:00";
  3263. }
  3264. else if ((時 == "18" && int.Parse(分) >= 30) || (時 == "19" && int.Parse(分) < 30))
  3265. {
  3266. x1 = "18:00:00";
  3267. }
  3268. else if ((時 == "19" && int.Parse(分) >= 30) || (時 == "20" && int.Parse(分) < 30))
  3269. {
  3270. x1 = "19:00:00";
  3271. }
  3272. else if ((時 == "20" && int.Parse(分) >= 30) || (時 == "21" && int.Parse(分) < 30))
  3273. {
  3274. x1 = "20:00:00";
  3275. }
  3276. else if ((時 == "21" && int.Parse(分) >= 30) || (時 == "22" && int.Parse(分) < 30))
  3277. {
  3278. x1 = "21:00:00";
  3279. }
  3280. else if ((時 == "22" && int.Parse(分) >= 30) || (時 == "23" && int.Parse(分) < 30))
  3281. {
  3282. x1 = "22:00:00";
  3283. }
  3284. return x1;
  3285. }
  3286. private string 時段定點(string x1)
  3287. {
  3288. string 時 = x1.Substring(0, 2);
  3289. string 分 = x1.Substring(3, 2);
  3290. if ((時 == "23" && int.Parse(分) >= 30) || (時 == "00" && int.Parse(分) < 30))
  3291. {
  3292. x1 = "00:00:00";
  3293. }
  3294. else if ((時 == "00" && int.Parse(分) >= 30) || (時 == "01" && int.Parse(分) < 30))
  3295. {
  3296. x1 = "01:00:00";
  3297. }
  3298. else if ((時 == "01" && int.Parse(分) >= 30) || (時 == "02" && int.Parse(分) < 30))
  3299. {
  3300. x1 = "02:00:00";
  3301. }
  3302. else if ((時 == "02" && int.Parse(分) >= 30) || (時 == "03" && int.Parse(分) < 30))
  3303. {
  3304. x1 = "03:00:00";
  3305. }
  3306. else if ((時 == "03" && int.Parse(分) >= 30) || (時 == "04" && int.Parse(分) < 30))
  3307. {
  3308. x1 = "04:00:00";
  3309. }
  3310. else if ((時 == "04" && int.Parse(分) >= 30) || (時 == "05" && int.Parse(分) < 30))
  3311. {
  3312. x1 = "05:00:00";
  3313. }
  3314. else if ((時 == "05" && int.Parse(分) >= 30) || (時 == "06" && int.Parse(分) < 30))
  3315. {
  3316. x1 = "06:00:00";
  3317. }
  3318. else if ((時 == "06" && int.Parse(分) >= 30) || (時 == "07" && int.Parse(分) < 30))
  3319. {
  3320. x1 = "07:00:00";
  3321. }
  3322. else if ((時 == "07" && int.Parse(分) >= 30) || (時 == "08" && int.Parse(分) < 30))
  3323. {
  3324. x1 = "08:00:00";
  3325. }
  3326. else if ((時 == "08" && int.Parse(分) >= 30) || (時 == "09" && int.Parse(分) < 30))
  3327. {
  3328. x1 = "09:00:00";
  3329. }
  3330. else if ((時 == "09" && int.Parse(分) >= 30) || (時 == "10" && int.Parse(分) < 30))
  3331. {
  3332. x1 = "10:00:00";
  3333. }
  3334. else if ((時 == "10" && int.Parse(分) >= 30) || (時 == "11" && int.Parse(分) < 30))
  3335. {
  3336. x1 = "11:00:00";
  3337. }
  3338. else if ((時 == "11" && int.Parse(分) >= 30) || (時 == "12" && int.Parse(分) < 30))
  3339. {
  3340. x1 = "12:00:00";
  3341. }
  3342. else if ((時 == "12" && int.Parse(分) >= 30) || (時 == "13" && int.Parse(分) < 30))
  3343. {
  3344. x1 = "13:00:00";
  3345. }
  3346. else if ((時 == "13" && int.Parse(分) >= 30) || (時 == "14" && int.Parse(分) < 30))
  3347. {
  3348. x1 = "14:00:00";
  3349. }
  3350. else if ((時 == "14" && int.Parse(分) >= 30) || (時 == "15" && int.Parse(分) < 30))
  3351. {
  3352. x1 = "15:00:00";
  3353. }
  3354. else if ((時 == "15" && int.Parse(分) >= 30) || (時 == "16" && int.Parse(分) < 30))
  3355. {
  3356. x1 = "16:00:00";
  3357. }
  3358. else if ((時 == "16" && int.Parse(分) >= 30) || (時 == "17" && int.Parse(分) < 30))
  3359. {
  3360. x1 = "17:00:00";
  3361. }
  3362. else if ((時 == "17" && int.Parse(分) >= 30) || (時 == "18" && int.Parse(分) < 30))
  3363. {
  3364. x1 = "18:00:00";
  3365. }
  3366. else if ((時 == "18" && int.Parse(分) >= 30) || (時 == "19" && int.Parse(分) < 30))
  3367. {
  3368. x1 = "19:00:00";
  3369. }
  3370. else if ((時 == "19" && int.Parse(分) >= 30) || (時 == "20" && int.Parse(分) < 30))
  3371. {
  3372. x1 = "20:00:00";
  3373. }
  3374. else if ((時 == "20" && int.Parse(分) >= 30) || (時 == "21" && int.Parse(分) < 30))
  3375. {
  3376. x1 = "21:00:00";
  3377. }
  3378. else if ((時 == "21" && int.Parse(分) >= 30) || (時 == "22" && int.Parse(分) < 30))
  3379. {
  3380. x1 = "22:00:00";
  3381. }
  3382. else if ((時 == "22" && int.Parse(分) >= 30) || (時 == "23" && int.Parse(分) < 30))
  3383. {
  3384. x1 = "23:00:00";
  3385. }
  3386. return x1;
  3387. }
  3388. private string 時段定點加一小(string x1)
  3389. {
  3390. string 時 = x1.Substring(0, 2);
  3391. string 分 = x1.Substring(3, 2);
  3392. if ((時 == "23" && int.Parse(分) >= 30) || (時 == "00" && int.Parse(分) < 30))
  3393. {
  3394. x1 = "01:00:00";
  3395. }
  3396. else if ((時 == "00" && int.Parse(分) >= 30) || (時 == "01" && int.Parse(分) < 30))
  3397. {
  3398. x1 = "02:00:00";
  3399. }
  3400. else if ((時 == "01" && int.Parse(分) >= 30) || (時 == "02" && int.Parse(分) < 30))
  3401. {
  3402. x1 = "03:00:00";
  3403. }
  3404. else if ((時 == "02" && int.Parse(分) >= 30) || (時 == "03" && int.Parse(分) < 30))
  3405. {
  3406. x1 = "04:00:00";
  3407. }
  3408. else if ((時 == "03" && int.Parse(分) >= 30) || (時 == "04" && int.Parse(分) < 30))
  3409. {
  3410. x1 = "05:00:00";
  3411. }
  3412. else if ((時 == "04" && int.Parse(分) >= 30) || (時 == "05" && int.Parse(分) < 30))
  3413. {
  3414. x1 = "06:00:00";
  3415. }
  3416. else if ((時 == "05" && int.Parse(分) >= 30) || (時 == "06" && int.Parse(分) < 30))
  3417. {
  3418. x1 = "07:00:00";
  3419. }
  3420. else if ((時 == "06" && int.Parse(分) >= 30) || (時 == "07" && int.Parse(分) < 30))
  3421. {
  3422. x1 = "08:00:00";
  3423. }
  3424. else if ((時 == "07" && int.Parse(分) >= 30) || (時 == "08" && int.Parse(分) < 30))
  3425. {
  3426. x1 = "09:00:00";
  3427. }
  3428. else if ((時 == "08" && int.Parse(分) >= 30) || (時 == "09" && int.Parse(分) < 30))
  3429. {
  3430. x1 = "10:00:00";
  3431. }
  3432. else if ((時 == "09" && int.Parse(分) >= 30) || (時 == "10" && int.Parse(分) < 30))
  3433. {
  3434. x1 = "11:00:00";
  3435. }
  3436. else if ((時 == "10" && int.Parse(分) >= 30) || (時 == "11" && int.Parse(分) < 30))
  3437. {
  3438. x1 = "12:00:00";
  3439. }
  3440. else if ((時 == "11" && int.Parse(分) >= 30) || (時 == "12" && int.Parse(分) < 30))
  3441. {
  3442. x1 = "13:00:00";
  3443. }
  3444. else if ((時 == "12" && int.Parse(分) >= 30) || (時 == "13" && int.Parse(分) < 30))
  3445. {
  3446. x1 = "14:00:00";
  3447. }
  3448. else if ((時 == "13" && int.Parse(分) >= 30) || (時 == "14" && int.Parse(分) < 30))
  3449. {
  3450. x1 = "15:00:00";
  3451. }
  3452. else if ((時 == "14" && int.Parse(分) >= 30) || (時 == "15" && int.Parse(分) < 30))
  3453. {
  3454. x1 = "16:00:00";
  3455. }
  3456. else if ((時 == "15" && int.Parse(分) >= 30) || (時 == "16" && int.Parse(分) < 30))
  3457. {
  3458. x1 = "17:00:00";
  3459. }
  3460. else if ((時 == "16" && int.Parse(分) >= 30) || (時 == "17" && int.Parse(分) < 30))
  3461. {
  3462. x1 = "18:00:00";
  3463. }
  3464. else if ((時 == "17" && int.Parse(分) >= 30) || (時 == "18" && int.Parse(分) < 30))
  3465. {
  3466. x1 = "19:00:00";
  3467. }
  3468. else if ((時 == "18" && int.Parse(分) >= 30) || (時 == "19" && int.Parse(分) < 30))
  3469. {
  3470. x1 = "20:00:00";
  3471. }
  3472. else if ((時 == "19" && int.Parse(分) >= 30) || (時 == "20" && int.Parse(分) < 30))
  3473. {
  3474. x1 = "21:00:00";
  3475. }
  3476. else if ((時 == "20" && int.Parse(分) >= 30) || (時 == "21" && int.Parse(分) < 30))
  3477. {
  3478. x1 = "22:00:00";
  3479. }
  3480. else if ((時 == "21" && int.Parse(分) >= 30) || (時 == "22" && int.Parse(分) < 30))
  3481. {
  3482. x1 = "23:00:00";
  3483. }
  3484. else if ((時 == "22" && int.Parse(分) >= 30) || (時 == "23" && int.Parse(分) < 30))
  3485. {
  3486. x1 = "00:00:00";
  3487. }
  3488. return x1;
  3489. }
  3490. private string 時段定點加四小(string x1)
  3491. {
  3492. string 時 = x1.Substring(0, 2);
  3493. string 分 = x1.Substring(3, 2);
  3494. if ((時 == "23" && int.Parse(分) >= 30) || (時 == "00" && int.Parse(分) < 30))
  3495. {
  3496. x1 = "04:00:00";
  3497. }
  3498. else if ((時 == "00" && int.Parse(分) >= 30) || (時 == "01" && int.Parse(分) < 30))
  3499. {
  3500. x1 = "05:00:00";
  3501. }
  3502. else if ((時 == "01" && int.Parse(分) >= 30) || (時 == "02" && int.Parse(分) < 30))
  3503. {
  3504. x1 = "06:00:00";
  3505. }
  3506. else if ((時 == "02" && int.Parse(分) >= 30) || (時 == "03" && int.Parse(分) < 30))
  3507. {
  3508. x1 = "07:00:00";
  3509. }
  3510. else if ((時 == "03" && int.Parse(分) >= 30) || (時 == "04" && int.Parse(分) < 30))
  3511. {
  3512. x1 = "08:00:00";
  3513. }
  3514. else if ((時 == "04" && int.Parse(分) >= 30) || (時 == "05" && int.Parse(分) < 30))
  3515. {
  3516. x1 = "09:00:00";
  3517. }
  3518. else if ((時 == "05" && int.Parse(分) >= 30) || (時 == "06" && int.Parse(分) < 30))
  3519. {
  3520. x1 = "10:00:00";
  3521. }
  3522. else if ((時 == "06" && int.Parse(分) >= 30) || (時 == "07" && int.Parse(分) < 30))
  3523. {
  3524. x1 = "11:00:00";
  3525. }
  3526. else if ((時 == "07" && int.Parse(分) >= 30) || (時 == "08" && int.Parse(分) < 30))
  3527. {
  3528. x1 = "12:00:00";
  3529. }
  3530. else if ((時 == "08" && int.Parse(分) >= 30) || (時 == "09" && int.Parse(分) < 30))
  3531. {
  3532. x1 = "13:00:00";
  3533. }
  3534. else if ((時 == "09" && int.Parse(分) >= 30) || (時 == "10" && int.Parse(分) < 30))
  3535. {
  3536. x1 = "14:00:00";
  3537. }
  3538. else if ((時 == "10" && int.Parse(分) >= 30) || (時 == "11" && int.Parse(分) < 30))
  3539. {
  3540. x1 = "15:00:00";
  3541. }
  3542. else if ((時 == "11" && int.Parse(分) >= 30) || (時 == "12" && int.Parse(分) < 30))
  3543. {
  3544. x1 = "16:00:00";
  3545. }
  3546. else if ((時 == "12" && int.Parse(分) >= 30) || (時 == "13" && int.Parse(分) < 30))
  3547. {
  3548. x1 = "17:00:00";
  3549. }
  3550. else if ((時 == "13" && int.Parse(分) >= 30) || (時 == "14" && int.Parse(分) < 30))
  3551. {
  3552. x1 = "18:00:00";
  3553. }
  3554. else if ((時 == "14" && int.Parse(分) >= 30) || (時 == "15" && int.Parse(分) < 30))
  3555. {
  3556. x1 = "19:00:00";
  3557. }
  3558. else if ((時 == "15" && int.Parse(分) >= 30) || (時 == "16" && int.Parse(分) < 30))
  3559. {
  3560. x1 = "20:00:00";
  3561. }
  3562. else if ((時 == "16" && int.Parse(分) >= 30) || (時 == "17" && int.Parse(分) < 30))
  3563. {
  3564. x1 = "21:00:00";
  3565. }
  3566. else if ((時 == "17" && int.Parse(分) >= 30) || (時 == "18" && int.Parse(分) < 30))
  3567. {
  3568. x1 = "22:00:00";
  3569. }
  3570. else if ((時 == "18" && int.Parse(分) >= 30) || (時 == "19" && int.Parse(分) < 30))
  3571. {
  3572. x1 = "23:00:00";
  3573. }
  3574. else if ((時 == "19" && int.Parse(分) >= 30) || (時 == "20" && int.Parse(分) < 30))
  3575. {
  3576. x1 = "00:00:00";
  3577. }
  3578. else if ((時 == "20" && int.Parse(分) >= 30) || (時 == "21" && int.Parse(分) < 30))
  3579. {
  3580. x1 = "01:00:00";
  3581. }
  3582. else if ((時 == "21" && int.Parse(分) >= 30) || (時 == "22" && int.Parse(分) < 30))
  3583. {
  3584. x1 = "02:00:00";
  3585. }
  3586. else if ((時 == "22" && int.Parse(分) >= 30) || (時 == "23" && int.Parse(分) < 30))
  3587. {
  3588. x1 = "03:00:00";
  3589. }
  3590. return x1;
  3591. }
  3592. private int 時間比對(string ptime1, string ptime2)
  3593. {
  3594. DateTime time1 = DateTime.ParseExact(ptime1, "HH:mm:ss", CultureInfo.InvariantCulture);
  3595. DateTime time2 = DateTime.ParseExact(ptime2, "HH:mm:ss", CultureInfo.InvariantCulture);
  3596. int hoursDiff = (int)time2.Subtract(time1).TotalMinutes;
  3597. int 間隔1 = Math.Abs(hoursDiff);
  3598. return 間隔1;
  3599. }
  3600. public void setting_click()
  3601. {
  3602. 語言選擇面板.SetActive(true);
  3603. }
  3604. public void setting_exit()
  3605. {
  3606. 語言選擇面板.SetActive(false);
  3607. }
  3608. public void exit_click()
  3609. {
  3610. change_Secen(3);
  3611. }
  3612. public void 實際_click()
  3613. {
  3614. 明細清單.SetActive(!明細清單.activeSelf);
  3615. 明細清單表投.SetActive(!明細清單表投.activeSelf);
  3616. 邊框左.SetActive(!邊框左.activeSelf);
  3617. 邊框右.SetActive(!邊框右.activeSelf);
  3618. 圖表.SetActive(!圖表.activeSelf);
  3619. /*
  3620. if (實際考勤!=0)
  3621. {
  3622. 實際考勤=0;
  3623. 系統語言轉換();
  3624. if (textcopy != null)
  3625. {
  3626. DeletetextCopies();
  3627. }
  3628. if (textcopy2 != null)
  3629. {
  3630. DeletetextCopies2();
  3631. }
  3632. if (textcopy3 != null)
  3633. {
  3634. DeletetextCopies3();
  3635. }
  3636. if (Main.Global.讀取年份==true)
  3637. {
  3638. year = 年.options[年.value].text;
  3639. month = 月.options[月.value].text;
  3640. date = year+"/"+month;
  3641. //Debug.Log(date);
  3642. if (textcopy != null)
  3643. {
  3644. DeletetextCopies();
  3645. }
  3646. if (textcopy2 != null)
  3647. {
  3648. DeletetextCopies2();
  3649. }
  3650. if (textcopy3 != null)
  3651. {
  3652. DeletetextCopies3();
  3653. }
  3654. if (Main.Global.部門編號==3)
  3655. {
  3656. StartCoroutine(考勤明細表(Main.Global.ID, date));
  3657. }
  3658. else
  3659. {
  3660. StartCoroutine(考勤明細表(點擊ID, date));
  3661. }
  3662. }
  3663. }
  3664. */
  3665. }
  3666. public void 考勤_click()
  3667. {
  3668. if (實際考勤!=1)
  3669. {
  3670. 實際考勤=1;
  3671. 系統語言轉換();
  3672. if (textcopy != null)
  3673. {
  3674. DeletetextCopies();
  3675. }
  3676. if (textcopy2 != null)
  3677. {
  3678. DeletetextCopies2();
  3679. }
  3680. if (textcopy3 != null)
  3681. {
  3682. DeletetextCopies3();
  3683. }
  3684. if (Main.Global.讀取年份==true)
  3685. {
  3686. year = 年.options[年.value].text;
  3687. month = 月.options[月.value].text;
  3688. date = year+"/"+month;
  3689. //Debug.Log(date);
  3690. if (textcopy != null)
  3691. {
  3692. DeletetextCopies();
  3693. }
  3694. if (textcopy2 != null)
  3695. {
  3696. DeletetextCopies2();
  3697. }
  3698. if (textcopy3 != null)
  3699. {
  3700. DeletetextCopies3();
  3701. }
  3702. if (Main.Global.部門編號==3)
  3703. {
  3704. StartCoroutine(考勤明細表(Main.Global.ID, date));
  3705. }
  3706. else
  3707. {
  3708. StartCoroutine(考勤明細表(點擊ID, date));
  3709. }
  3710. }
  3711. }
  3712. }
  3713. public void 網頁(RectTransform panelRectTransform, float scale, float xbar, float ybar)
  3714. {
  3715. var webViewGameObject = new GameObject("UniWebView");
  3716. webView = webViewGameObject.AddComponent<UniWebView>();
  3717. webView.Frame =new Rect(panelRectTransform.anchoredPosition.x*scale+xbar, (-panelRectTransform.anchoredPosition.y*scale)+ybar, panelRectTransform.sizeDelta.x*scale, panelRectTransform.sizeDelta.y*scale);
  3718. if (Main.Global.系統語言=="繁體中文" || Main.Global.系統語言=="簡體中文")
  3719. {
  3720. webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-7/");
  3721. }
  3722. else
  3723. {
  3724. webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-8/");
  3725. }
  3726. StartCoroutine(說明顯示查詢());
  3727. //webView.Show();
  3728. }
  3729. IEnumerator 說明顯示查詢()
  3730. {
  3731. string strcon1 = "說明顯示查詢";
  3732. string se = Main.Global.預設伺服器路徑;
  3733. string pb1 = Main.Global.人員;
  3734. string pb2 = "APP-7-8";
  3735. DateTime currentDate = DateTime.Now;
  3736. int year = currentDate.Year;
  3737. string ys = year.ToString();
  3738. int month = currentDate.Month;
  3739. string ms = "";
  3740. if (month < 10)
  3741. {
  3742. ms = "0"+month.ToString();
  3743. }
  3744. else
  3745. {
  3746. ms = month.ToString();
  3747. }
  3748. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PB1={2}&PB2={3}&PB5={4}&PB6={5}", strcon1, se, pb1, pb2, ys, ms);
  3749. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  3750. yield return request1.SendWebRequest();
  3751. if (request1.result == UnityWebRequest.Result.ConnectionError)
  3752. {
  3753. //Debug.Log(request.error);
  3754. yield break;
  3755. }
  3756. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  3757. int 開啟, 公告;
  3758. bool 是否新增 = false;
  3759. if (json.Count>0)
  3760. {
  3761. float floatValue = float.Parse(json[2].ToString().Trim('"'));
  3762. 開啟 = Mathf.RoundToInt(floatValue);
  3763. float floatValue1 = float.Parse(json[3].ToString().Trim('"'));
  3764. 公告 = Mathf.RoundToInt(floatValue1);
  3765. if (開啟<3)
  3766. {
  3767. 網頁面板.SetActive(true);
  3768. webView.Show();
  3769. 開啟+=1;
  3770. 公告+=1;
  3771. }
  3772. else
  3773. {
  3774. 開啟+=1;
  3775. }
  3776. }
  3777. else
  3778. {
  3779. 網頁面板.SetActive(true);
  3780. webView.Show();
  3781. 開啟 = 1;
  3782. 公告 = 1;
  3783. 是否新增 = true;
  3784. }
  3785. if (是否新增==true)
  3786. {
  3787. yield return StartCoroutine(說明顯示新增(開啟, 公告));
  3788. }
  3789. else
  3790. {
  3791. yield return StartCoroutine(說明顯示修改(開啟, 公告));
  3792. }
  3793. }
  3794. IEnumerator 說明顯示新增(int a1, int a2)
  3795. {
  3796. string strcon1 = "說明顯示新增";
  3797. string se = Main.Global.預設伺服器路徑;
  3798. string pb1 = Main.Global.人員;
  3799. string pb2 = "APP-7-8";
  3800. string pb3 = a1.ToString();
  3801. string pb4 = a2.ToString();
  3802. DateTime currentDate = DateTime.Now;
  3803. int year = currentDate.Year;
  3804. string ys = year.ToString();
  3805. int month = currentDate.Month;
  3806. string ms = "";
  3807. if (month < 10)
  3808. {
  3809. ms = "0"+month.ToString();
  3810. }
  3811. else
  3812. {
  3813. ms = month.ToString();
  3814. }
  3815. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PB1={2}&PB2={3}&PB3={4}&PB4={5}&PB5={6}&PB6={7}", strcon1, se, pb1, pb2, pb3, pb4, ys, ms);
  3816. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  3817. yield return request1.SendWebRequest();
  3818. if (request1.result == UnityWebRequest.Result.ConnectionError)
  3819. {
  3820. //Debug.Log(request.error);
  3821. yield break;
  3822. }
  3823. }
  3824. IEnumerator 說明顯示修改(int a1, int a2)
  3825. {
  3826. string strcon1 = "說明顯示修改";
  3827. string se = Main.Global.預設伺服器路徑;
  3828. string pb1 = Main.Global.人員;
  3829. string pb2 = "APP-7-8";
  3830. string pb3 = a1.ToString();
  3831. string pb4 = a2.ToString();
  3832. DateTime currentDate = DateTime.Now;
  3833. int year = currentDate.Year;
  3834. string ys = year.ToString();
  3835. int month = currentDate.Month;
  3836. string ms = "";
  3837. if (month < 10)
  3838. {
  3839. ms = "0"+month.ToString();
  3840. }
  3841. else
  3842. {
  3843. ms = month.ToString();
  3844. }
  3845. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PB1={2}&PB2={3}&PB3={4}&PB4={5}&PB5={6}&PB6={7}", strcon1, se, pb1, pb2, pb3, pb4, ys, ms);
  3846. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  3847. yield return request1.SendWebRequest();
  3848. if (request1.result == UnityWebRequest.Result.ConnectionError)
  3849. {
  3850. //Debug.Log(request.error);
  3851. yield break;
  3852. }
  3853. }
  3854. public void 網頁面板關閉()
  3855. {
  3856. 網頁面板.SetActive(false);
  3857. webView.Hide();
  3858. //Destroy(webView);
  3859. }
  3860. public void 網頁面板開啟()
  3861. {
  3862. 網頁面板.SetActive(true);
  3863. webView.Show();
  3864. //Destroy(webView);
  3865. }
  3866. public void setting_中()
  3867. {
  3868. webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-7/");
  3869. Main.Global.系統語言="繁體中文";
  3870. 系統語言轉換();
  3871. 語言選擇按鈕();
  3872. 語言選擇面板.SetActive(false);
  3873. if (Main.Global.讀取年份==true)
  3874. {
  3875. year = 年.options[年.value].text;
  3876. month = 月.options[月.value].text;
  3877. date = year+"/"+month;
  3878. if (textcopy != null)
  3879. {
  3880. DeletetextCopies();
  3881. }
  3882. if (Main.Global.部門編號==3)
  3883. {
  3884. StartCoroutine(考勤明細表(Main.Global.ID, date));
  3885. }
  3886. else
  3887. {
  3888. StartCoroutine(考勤明細表(點擊ID, date));
  3889. }
  3890. if (textcopy1 != null)
  3891. {
  3892. DeletetextCopies1();
  3893. }
  3894. if (textcopy2 != null)
  3895. {
  3896. DeletetextCopies2();
  3897. }
  3898. if (textcopy3 != null)
  3899. {
  3900. DeletetextCopies3();
  3901. }
  3902. string level = 級別1.options[級別1.value].text;
  3903. StartCoroutine(考勤查找表(level, Main.Global.查詢日期));
  3904. }
  3905. }
  3906. public void setting_簡()
  3907. {
  3908. webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-7/");
  3909. Main.Global.系統語言="簡體中文";
  3910. 系統語言轉換();
  3911. 語言選擇按鈕();
  3912. 語言選擇面板.SetActive(false);
  3913. if (Main.Global.讀取年份==true)
  3914. {
  3915. year = 年.options[年.value].text;
  3916. month = 月.options[月.value].text;
  3917. date = year+"/"+month;
  3918. if (textcopy != null)
  3919. {
  3920. DeletetextCopies();
  3921. }
  3922. if (Main.Global.部門編號==3)
  3923. {
  3924. StartCoroutine(考勤明細表(Main.Global.ID, date));
  3925. }
  3926. else
  3927. {
  3928. StartCoroutine(考勤明細表(點擊ID, date));
  3929. }
  3930. if (textcopy1 != null)
  3931. {
  3932. DeletetextCopies1();
  3933. }
  3934. if (textcopy2 != null)
  3935. {
  3936. DeletetextCopies2();
  3937. }
  3938. if (textcopy3 != null)
  3939. {
  3940. DeletetextCopies3();
  3941. }
  3942. string level = 級別1.options[級別1.value].text;
  3943. StartCoroutine(考勤查找表(level, Main.Global.查詢日期));
  3944. }
  3945. }
  3946. public void setting_英()
  3947. {
  3948. webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-8/");
  3949. Main.Global.系統語言="English";
  3950. 系統語言轉換();
  3951. 語言選擇按鈕();
  3952. 語言選擇面板.SetActive(false);
  3953. if (Main.Global.讀取年份==true)
  3954. {
  3955. year = 年.options[年.value].text;
  3956. month = 月.options[月.value].text;
  3957. date = year+"/"+month;
  3958. if (textcopy != null)
  3959. {
  3960. DeletetextCopies();
  3961. }
  3962. if (Main.Global.部門編號==3)
  3963. {
  3964. StartCoroutine(考勤明細表(Main.Global.ID, date));
  3965. }
  3966. else
  3967. {
  3968. StartCoroutine(考勤明細表(點擊ID, date));
  3969. }
  3970. if (textcopy1 != null)
  3971. {
  3972. DeletetextCopies1();
  3973. }
  3974. if (textcopy2 != null)
  3975. {
  3976. DeletetextCopies2();
  3977. }
  3978. if (textcopy3 != null)
  3979. {
  3980. DeletetextCopies3();
  3981. }
  3982. string level = 級別1.options[級別1.value].text;
  3983. StartCoroutine(考勤查找表(level, Main.Global.查詢日期));
  3984. }
  3985. }
  3986. public void setting_印()
  3987. {
  3988. webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-8/");
  3989. Main.Global.系統語言="Indonesian";
  3990. 系統語言轉換();
  3991. 語言選擇按鈕();
  3992. 語言選擇面板.SetActive(false);
  3993. if (Main.Global.讀取年份==true)
  3994. {
  3995. year = 年.options[年.value].text;
  3996. month = 月.options[月.value].text;
  3997. date = year+"/"+month;
  3998. if (textcopy != null)
  3999. {
  4000. DeletetextCopies();
  4001. }
  4002. if (Main.Global.部門編號==3)
  4003. {
  4004. StartCoroutine(考勤明細表(Main.Global.ID, date));
  4005. }
  4006. else
  4007. {
  4008. StartCoroutine(考勤明細表(點擊ID, date));
  4009. }
  4010. if (textcopy1 != null)
  4011. {
  4012. DeletetextCopies1();
  4013. }
  4014. if (textcopy2 != null)
  4015. {
  4016. DeletetextCopies2();
  4017. }
  4018. if (textcopy3 != null)
  4019. {
  4020. DeletetextCopies3();
  4021. }
  4022. string level = 級別1.options[級別1.value].text;
  4023. StartCoroutine(考勤查找表(level, Main.Global.查詢日期));
  4024. }
  4025. }
  4026. public void 語言選擇按鈕()
  4027. {
  4028. if (bts == null)
  4029. {
  4030. if (Main.Global.系統語言=="繁體中文")
  4031. {
  4032. bts = new Button[] { 簡按鈕, 英按鈕, 印按鈕, 中按鈕 };
  4033. }
  4034. else if (Main.Global.系統語言=="簡體中文")
  4035. {
  4036. bts = new Button[] { 中按鈕, 英按鈕, 印按鈕, 簡按鈕 };
  4037. }
  4038. else if (Main.Global.系統語言=="English")
  4039. {
  4040. bts = new Button[] { 中按鈕, 簡按鈕, 印按鈕, 英按鈕 };
  4041. }
  4042. else
  4043. {
  4044. bts = new Button[] { 中按鈕, 簡按鈕, 英按鈕, 印按鈕 };
  4045. }
  4046. }
  4047. else
  4048. {
  4049. for (int j = 0; j < bts.Length; j++)
  4050. {
  4051. bts[j] = null;
  4052. }
  4053. if (Main.Global.系統語言=="繁體中文")
  4054. {
  4055. bts = new Button[] { 簡按鈕, 英按鈕, 印按鈕, 中按鈕 };
  4056. }
  4057. else if (Main.Global.系統語言=="簡體中文")
  4058. {
  4059. bts = new Button[] { 中按鈕, 英按鈕, 印按鈕, 簡按鈕 };
  4060. }
  4061. else if (Main.Global.系統語言=="English")
  4062. {
  4063. bts = new Button[] { 中按鈕, 簡按鈕, 印按鈕, 英按鈕 };
  4064. }
  4065. else
  4066. {
  4067. bts = new Button[] { 中按鈕, 簡按鈕, 英按鈕, 印按鈕 };
  4068. }
  4069. }
  4070. for (int i = 0; i < bts.Length; i++)
  4071. {
  4072. RectTransform rectTransform = bts[i].GetComponent<RectTransform>();
  4073. if (i==3)
  4074. {
  4075. rectTransform.anchoredPosition = new Vector2(1200, 1200);
  4076. }
  4077. else
  4078. {
  4079. rectTransform.anchoredPosition = new Vector2(300*i, 0);
  4080. }
  4081. }
  4082. }
  4083. public void 明細查詢()
  4084. {
  4085. if (Main.Global.讀取年份==true)
  4086. {
  4087. if (Main.Global.部門編號==3)
  4088. {
  4089. if (textcopy1 != null)
  4090. {
  4091. DeletetextCopies1();
  4092. }
  4093. string year1 = 年1.options[年1.value].text;
  4094. string month1 = 月1.options[月1.value].text;
  4095. string day1 = 日1.options[日1.value].text;
  4096. Main.Global.查詢日期= year1+"/"+month1+"/"+day1;
  4097. //Debug.Log(Main.Global.查詢日期);
  4098. string level = 群組.options[群組.value].text;
  4099. StartCoroutine(考勤查找表1(level, Main.Global.查詢日期));
  4100. }
  4101. else
  4102. {
  4103. if (textcopy1 != null)
  4104. {
  4105. DeletetextCopies1();
  4106. }
  4107. string year1 = 年1.options[年1.value].text;
  4108. string month1 = 月1.options[月1.value].text;
  4109. string day1 = 日1.options[日1.value].text;
  4110. Main.Global.查詢日期= year1+"/"+month1+"/"+day1;
  4111. //Debug.Log(Main.Global.查詢日期);
  4112. string level = 級別1.options[級別1.value].text;
  4113. StartCoroutine(考勤查找表(level, Main.Global.查詢日期));
  4114. }
  4115. }
  4116. }
  4117. public void OnClick(string name)
  4118. {
  4119. 點擊ID=name;
  4120. 上一步.SetActive(true);
  4121. 明細表頁面.SetActive(true);
  4122. 查詢表頁面.SetActive(false);
  4123. 明細清單.SetActive(false);
  4124. 明細清單表投.SetActive(false);
  4125. 邊框左.SetActive(false);
  4126. 邊框右.SetActive(false);
  4127. 圖表.SetActive(true);
  4128. DateTime currentDate = DateTime.Now; // 取得目前的日期與時間
  4129. string yearMonth = currentDate.ToString("yyyy/MM");
  4130. if (textcopy != null)
  4131. {
  4132. DeletetextCopies();
  4133. }
  4134. if (textcopy3 != null)
  4135. {
  4136. DeletetextCopies3();
  4137. }
  4138. if (textcopy2 != null)
  4139. {
  4140. DeletetextCopies2();
  4141. }
  4142. StartCoroutine(考勤明細人員讀取(name));
  4143. StartCoroutine(考勤明細表(name, yearMonth));
  4144. buttonRectTransform.anchoredPosition = new Vector2(0f,270f);
  4145. }
  4146. public void 上一步按鈕 ()
  4147. {
  4148. 上一步.SetActive(false);
  4149. 明細表頁面.SetActive(false);
  4150. 查詢表頁面.SetActive(true);
  4151. 點擊ID="";
  4152. buttonRectTransform.anchoredPosition = new Vector2(0f,360f);
  4153. if (textcopy3 != null)
  4154. {
  4155. DeletetextCopies3();
  4156. }
  4157. if (textcopy2 != null)
  4158. {
  4159. DeletetextCopies2();
  4160. }
  4161. }
  4162. public void cameraopen()
  4163. {
  4164. change_Secen(8);
  4165. }
  4166. public void DeletetextCopies()
  4167. {
  4168. // 刪除複製出來的物件
  4169. foreach (GameObject copy in textcopy)
  4170. {
  4171. Destroy(copy);
  4172. }
  4173. textcopy.Clear();
  4174. }
  4175. public void DeletetextCopies1()
  4176. {
  4177. // 刪除複製出來的物件
  4178. foreach (GameObject copy in textcopy1)
  4179. {
  4180. Destroy(copy);
  4181. }
  4182. textcopy1.Clear();
  4183. }
  4184. public void DeletetextCopies2()
  4185. {
  4186. // 刪除複製出來的物件
  4187. foreach (GameObject copy in textcopy2)
  4188. {
  4189. Destroy(copy);
  4190. }
  4191. textcopy2.Clear();
  4192. }
  4193. public void DeletetextCopies3()
  4194. {
  4195. // 刪除複製出來的物件
  4196. foreach (GameObject copy in textcopy3)
  4197. {
  4198. Destroy(copy);
  4199. }
  4200. textcopy3.Clear();
  4201. if (textcopy4 != null)
  4202. {
  4203. foreach (GameObject copy in textcopy4)
  4204. {
  4205. Destroy(copy);
  4206. }
  4207. textcopy4.Clear();
  4208. }
  4209. }
  4210. IEnumerator 判斷更新()
  4211. {
  4212. string strcon = "更新";
  4213. string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}", strcon);
  4214. UnityWebRequest request = UnityWebRequest.Get(strUrl);
  4215. yield return request.SendWebRequest();
  4216. if (request.result == UnityWebRequest.Result.ConnectionError)
  4217. {
  4218. yield break;
  4219. }
  4220. string str = request.downloadHandler.text.ToString();
  4221. Debug.Log(str);
  4222. if (str == "系統更新")
  4223. {
  4224. change_Secen(1);
  4225. }
  4226. }
  4227. public void change_Secen(int _screenNum)
  4228. {
  4229. SceneManager.LoadScene(_screenNum);
  4230. }
  4231. private void 系統語言轉換()
  4232. {
  4233. string 介面 = "H06";
  4234. if (Main.Global.系統語言=="繁體中文")
  4235. {
  4236. 標題.text = Main.Global.系統語言字典[介面+"05CH"];
  4237. 標題1.text = Main.Global.系統語言字典[介面+"32CH"];
  4238. 中.text = Main.Global.系統語言字典[介面+"01CH"];
  4239. 英.text = Main.Global.系統語言字典[介面+"02CH"];
  4240. 印.text = Main.Global.系統語言字典[介面+"03CH"];
  4241. 簡.text = Main.Global.系統語言字典[介面+"36CH"];
  4242. 選擇語言.text = Main.Global.系統語言字典[介面+"04CH"];
  4243. 員工名稱.text = Main.Global.系統語言字典[介面+"06CH"];
  4244. 員工代碼.text = Main.Global.系統語言字典[介面+"07CH"];
  4245. 員工崗位.text = Main.Global.系統語言字典[介面+"08CH"];
  4246. 部門名稱.text = Main.Global.系統語言字典[介面+"09CH"];
  4247. 星期.text = Main.Global.系統語言字典[介面+"10CH"];
  4248. 日期.text = Main.Global.系統語言字典[介面+"11CH"];
  4249. 小時數.text = Main.Global.系統語言字典[介面+"18CH"];
  4250. 加班.text = Main.Global.系統語言字典[介面+"19CH"];
  4251. 假日.text = Main.Global.系統語言字典[介面+"20CH"];
  4252. 假別.text = Main.Global.系統語言字典[介面+"21CH"];
  4253. 總時數.text = Main.Global.系統語言字典[介面+"22CH"];
  4254. 備註.text = Main.Global.系統語言字典[介面+"23CH"];
  4255. //實際打卡.text = Main.Global.系統語言字典[介面+"30CH"];
  4256. //考勤計算.text = Main.Global.系統語言字典[介面+"31CH"];
  4257. 部門s.text = Main.Global.系統語言字典[介面+"33CH"];
  4258. 姓名s.text = Main.Global.系統語言字典[介面+"34CH"];
  4259. 級別s.text = Main.Global.系統語言字典[介面+"35CH"];
  4260. 星期s.text = Main.Global.系統語言字典[介面+"10CH"];
  4261. 日期s.text = Main.Global.系統語言字典[介面+"11CH"];
  4262. 實際_1s.text = Main.Global.系統語言字典[介面+"12CH"];
  4263. 實際_2s.text = Main.Global.系統語言字典[介面+"13CH"];
  4264. 實際_3s.text = Main.Global.系統語言字典[介面+"14CH"];
  4265. 實際_4s.text = Main.Global.系統語言字典[介面+"15CH"];
  4266. 實際_5s.text = Main.Global.系統語言字典[介面+"16CH"];
  4267. 實際_6s.text = Main.Global.系統語言字典[介面+"17CH"];
  4268. 小時數s.text = Main.Global.系統語言字典[介面+"18CH"];
  4269. 加班s.text = Main.Global.系統語言字典[介面+"19CH"];
  4270. 假日s.text = Main.Global.系統語言字典[介面+"20CH"];
  4271. 假別s.text = Main.Global.系統語言字典[介面+"21CH"];
  4272. 備註s.text = Main.Global.系統語言字典[介面+"23CH"];
  4273. if (實際考勤==0)
  4274. {
  4275. 實際_1.text = Main.Global.系統語言字典[介面+"12CH"];
  4276. 實際_2.text = Main.Global.系統語言字典[介面+"13CH"];
  4277. 實際_3.text = Main.Global.系統語言字典[介面+"14CH"];
  4278. 實際_4.text = Main.Global.系統語言字典[介面+"15CH"];
  4279. 實際_5.text = Main.Global.系統語言字典[介面+"16CH"];
  4280. 實際_6.text = Main.Global.系統語言字典[介面+"17CH"];
  4281. }
  4282. else
  4283. {
  4284. 實際_1.text = Main.Global.系統語言字典[介面+"24CH"];
  4285. 實際_2.text = Main.Global.系統語言字典[介面+"25CH"];
  4286. 實際_3.text = Main.Global.系統語言字典[介面+"26CH"];
  4287. 實際_4.text = Main.Global.系統語言字典[介面+"27CH"];
  4288. 實際_5.text = Main.Global.系統語言字典[介面+"28CH"];
  4289. 實際_6.text = Main.Global.系統語言字典[介面+"29CH"];
  4290. }
  4291. }
  4292. else if (Main.Global.系統語言=="簡體中文")
  4293. {
  4294. 標題.text = Main.Global.系統語言字典[介面+"05CS"];
  4295. 標題1.text = Main.Global.系統語言字典[介面+"32CS"];
  4296. 中.text = Main.Global.系統語言字典[介面+"01CS"];
  4297. 英.text = Main.Global.系統語言字典[介面+"02CS"];
  4298. 印.text = Main.Global.系統語言字典[介面+"03CS"];
  4299. 簡.text = Main.Global.系統語言字典[介面+"36CS"];
  4300. 選擇語言.text = Main.Global.系統語言字典[介面+"04CS"];
  4301. 員工名稱.text = Main.Global.系統語言字典[介面+"06CS"];
  4302. 員工代碼.text = Main.Global.系統語言字典[介面+"07CS"];
  4303. 員工崗位.text = Main.Global.系統語言字典[介面+"08CS"];
  4304. 部門名稱.text = Main.Global.系統語言字典[介面+"09CS"];
  4305. 星期.text = Main.Global.系統語言字典[介面+"10CS"];
  4306. 日期.text = Main.Global.系統語言字典[介面+"11CS"];
  4307. 小時數.text = Main.Global.系統語言字典[介面+"18CS"];
  4308. 加班.text = Main.Global.系統語言字典[介面+"19CS"];
  4309. 假日.text = Main.Global.系統語言字典[介面+"20CS"];
  4310. 假別.text = Main.Global.系統語言字典[介面+"21CS"];
  4311. 總時數.text = Main.Global.系統語言字典[介面+"22CS"];
  4312. 備註.text = Main.Global.系統語言字典[介面+"23CS"];
  4313. //實際打卡.text = Main.Global.系統語言字典[介面+"30CS"];
  4314. //考勤計算.text = Main.Global.系統語言字典[介面+"31CS"];
  4315. 部門s.text = Main.Global.系統語言字典[介面+"33CS"];
  4316. 姓名s.text = Main.Global.系統語言字典[介面+"34CS"];
  4317. 級別s.text = Main.Global.系統語言字典[介面+"35CS"];
  4318. 星期s.text = Main.Global.系統語言字典[介面+"10CS"];
  4319. 日期s.text = Main.Global.系統語言字典[介面+"11CS"];
  4320. 實際_1s.text = Main.Global.系統語言字典[介面+"12CS"];
  4321. 實際_2s.text = Main.Global.系統語言字典[介面+"13CS"];
  4322. 實際_3s.text = Main.Global.系統語言字典[介面+"14CS"];
  4323. 實際_4s.text = Main.Global.系統語言字典[介面+"15CS"];
  4324. 實際_5s.text = Main.Global.系統語言字典[介面+"16CS"];
  4325. 實際_6s.text = Main.Global.系統語言字典[介面+"17CS"];
  4326. 小時數s.text = Main.Global.系統語言字典[介面+"18CS"];
  4327. 加班s.text = Main.Global.系統語言字典[介面+"19CS"];
  4328. 假日s.text = Main.Global.系統語言字典[介面+"20CS"];
  4329. 假別s.text = Main.Global.系統語言字典[介面+"21CS"];
  4330. 備註s.text = Main.Global.系統語言字典[介面+"23CS"];
  4331. if (實際考勤==0)
  4332. {
  4333. 實際_1.text = Main.Global.系統語言字典[介面+"12CS"];
  4334. 實際_2.text = Main.Global.系統語言字典[介面+"13CS"];
  4335. 實際_3.text = Main.Global.系統語言字典[介面+"14CS"];
  4336. 實際_4.text = Main.Global.系統語言字典[介面+"15CS"];
  4337. 實際_5.text = Main.Global.系統語言字典[介面+"16CS"];
  4338. 實際_6.text = Main.Global.系統語言字典[介面+"17CS"];
  4339. }
  4340. else
  4341. {
  4342. 實際_1.text = Main.Global.系統語言字典[介面+"24CS"];
  4343. 實際_2.text = Main.Global.系統語言字典[介面+"25CS"];
  4344. 實際_3.text = Main.Global.系統語言字典[介面+"26CS"];
  4345. 實際_4.text = Main.Global.系統語言字典[介面+"27CS"];
  4346. 實際_5.text = Main.Global.系統語言字典[介面+"28CS"];
  4347. 實際_6.text = Main.Global.系統語言字典[介面+"29CS"];
  4348. }
  4349. }
  4350. else if (Main.Global.系統語言=="English")
  4351. {
  4352. 標題.text = Main.Global.系統語言字典[介面+"05EN"];
  4353. 標題1.text = Main.Global.系統語言字典[介面+"32EN"];
  4354. 中.text = Main.Global.系統語言字典[介面+"01EN"];
  4355. 英.text = Main.Global.系統語言字典[介面+"02EN"];
  4356. 印.text = Main.Global.系統語言字典[介面+"03EN"];
  4357. 簡.text = Main.Global.系統語言字典[介面+"36EN"];
  4358. 選擇語言.text = Main.Global.系統語言字典[介面+"04EN"];
  4359. 員工名稱.text = Main.Global.系統語言字典[介面+"06EN"];
  4360. 員工代碼.text = Main.Global.系統語言字典[介面+"07EN"];
  4361. 員工崗位.text = Main.Global.系統語言字典[介面+"08EN"];
  4362. 部門名稱.text = Main.Global.系統語言字典[介面+"09EN"];
  4363. 星期.text = Main.Global.系統語言字典[介面+"10EN"];
  4364. 日期.text = Main.Global.系統語言字典[介面+"11EN"];
  4365. 小時數.text = Main.Global.系統語言字典[介面+"18EN"];
  4366. 加班.text = Main.Global.系統語言字典[介面+"19EN"];
  4367. 假日.text = Main.Global.系統語言字典[介面+"20EN"];
  4368. 假別.text = Main.Global.系統語言字典[介面+"21EN"];
  4369. 總時數.text = Main.Global.系統語言字典[介面+"22EN"];
  4370. 備註.text = Main.Global.系統語言字典[介面+"23EN"];
  4371. //實際打卡.text = Main.Global.系統語言字典[介面+"30EN"];
  4372. //考勤計算.text = Main.Global.系統語言字典[介面+"31EN"];
  4373. 星期s.text = Main.Global.系統語言字典[介面+"10EN"];
  4374. 日期s.text = Main.Global.系統語言字典[介面+"11EN"];
  4375. 部門s.text = Main.Global.系統語言字典[介面+"33EN"];
  4376. 姓名s.text = Main.Global.系統語言字典[介面+"34EN"];
  4377. 級別s.text = Main.Global.系統語言字典[介面+"35EN"];
  4378. 實際_1s.text = Main.Global.系統語言字典[介面+"12EN"];
  4379. 實際_2s.text = Main.Global.系統語言字典[介面+"13EN"];
  4380. 實際_3s.text = Main.Global.系統語言字典[介面+"14EN"];
  4381. 實際_4s.text = Main.Global.系統語言字典[介面+"15EN"];
  4382. 實際_5s.text = Main.Global.系統語言字典[介面+"16EN"];
  4383. 實際_6s.text = Main.Global.系統語言字典[介面+"17EN"];
  4384. 小時數s.text = Main.Global.系統語言字典[介面+"18EN"];
  4385. 加班s.text = Main.Global.系統語言字典[介面+"19EN"];
  4386. 假日s.text = Main.Global.系統語言字典[介面+"20EN"];
  4387. 假別s.text = Main.Global.系統語言字典[介面+"21EN"];
  4388. 備註s.text = Main.Global.系統語言字典[介面+"23EN"];
  4389. if (實際考勤==0)
  4390. {
  4391. 實際_1.text = Main.Global.系統語言字典[介面+"12EN"];
  4392. 實際_2.text = Main.Global.系統語言字典[介面+"13EN"];
  4393. 實際_3.text = Main.Global.系統語言字典[介面+"14EN"];
  4394. 實際_4.text = Main.Global.系統語言字典[介面+"15EN"];
  4395. 實際_5.text = Main.Global.系統語言字典[介面+"16EN"];
  4396. 實際_6.text = Main.Global.系統語言字典[介面+"17EN"];
  4397. }
  4398. else
  4399. {
  4400. 實際_1.text = Main.Global.系統語言字典[介面+"24EN"];
  4401. 實際_2.text = Main.Global.系統語言字典[介面+"25EN"];
  4402. 實際_3.text = Main.Global.系統語言字典[介面+"26EN"];
  4403. 實際_4.text = Main.Global.系統語言字典[介面+"27EN"];
  4404. 實際_5.text = Main.Global.系統語言字典[介面+"28EN"];
  4405. 實際_6.text = Main.Global.系統語言字典[介面+"29EN"];
  4406. }
  4407. }
  4408. else
  4409. {
  4410. 標題.text = Main.Global.系統語言字典[介面+"05ID"];
  4411. 標題.text = Main.Global.系統語言字典[介面+"32ID"];
  4412. 中.text = Main.Global.系統語言字典[介面+"01ID"];
  4413. 英.text = Main.Global.系統語言字典[介面+"02ID"];
  4414. 印.text = Main.Global.系統語言字典[介面+"03ID"];
  4415. 簡.text = Main.Global.系統語言字典[介面+"36ID"];
  4416. 選擇語言.text = Main.Global.系統語言字典[介面+"04ID"];
  4417. 員工名稱.text = Main.Global.系統語言字典[介面+"06ID"];
  4418. 員工代碼.text = Main.Global.系統語言字典[介面+"07ID"];
  4419. 員工崗位.text = Main.Global.系統語言字典[介面+"08ID"];
  4420. 部門名稱.text = Main.Global.系統語言字典[介面+"09ID"];
  4421. 星期.text = Main.Global.系統語言字典[介面+"10ID"];
  4422. 日期.text = Main.Global.系統語言字典[介面+"11ID"];
  4423. 小時數.text = Main.Global.系統語言字典[介面+"18ID"];
  4424. 加班.text = Main.Global.系統語言字典[介面+"19ID"];
  4425. 假日.text = Main.Global.系統語言字典[介面+"20ID"];
  4426. 假別.text = Main.Global.系統語言字典[介面+"21ID"];
  4427. 總時數.text = Main.Global.系統語言字典[介面+"22ID"];
  4428. 備註.text = Main.Global.系統語言字典[介面+"23ID"];
  4429. //實際打卡.text = Main.Global.系統語言字典[介面+"30ID"];
  4430. //考勤計算.text = Main.Global.系統語言字典[介面+"31ID"];
  4431. 星期s.text = Main.Global.系統語言字典[介面+"10ID"];
  4432. 日期s.text = Main.Global.系統語言字典[介面+"11ID"];
  4433. 部門s.text = Main.Global.系統語言字典[介面+"33ID"];
  4434. 姓名s.text = Main.Global.系統語言字典[介面+"34ID"];
  4435. 級別s.text = Main.Global.系統語言字典[介面+"35ID"];
  4436. 實際_1s.text = Main.Global.系統語言字典[介面+"12ID"];
  4437. 實際_2s.text = Main.Global.系統語言字典[介面+"13ID"];
  4438. 實際_3s.text = Main.Global.系統語言字典[介面+"14ID"];
  4439. 實際_4s.text = Main.Global.系統語言字典[介面+"15ID"];
  4440. 實際_5s.text = Main.Global.系統語言字典[介面+"16ID"];
  4441. 實際_6s.text = Main.Global.系統語言字典[介面+"17ID"];
  4442. 小時數s.text = Main.Global.系統語言字典[介面+"18ID"];
  4443. 加班s.text = Main.Global.系統語言字典[介面+"19ID"];
  4444. 假日s.text = Main.Global.系統語言字典[介面+"20ID"];
  4445. 假別s.text = Main.Global.系統語言字典[介面+"21ID"];
  4446. 備註s.text = Main.Global.系統語言字典[介面+"23ID"];
  4447. if (實際考勤==0)
  4448. {
  4449. 實際_1.text = Main.Global.系統語言字典[介面+"12ID"];
  4450. 實際_2.text = Main.Global.系統語言字典[介面+"13ID"];
  4451. 實際_3.text = Main.Global.系統語言字典[介面+"14ID"];
  4452. 實際_4.text = Main.Global.系統語言字典[介面+"15ID"];
  4453. 實際_5.text = Main.Global.系統語言字典[介面+"16ID"];
  4454. 實際_6.text = Main.Global.系統語言字典[介面+"17ID"];
  4455. }
  4456. else
  4457. {
  4458. 實際_1.text = Main.Global.系統語言字典[介面+"24ID"];
  4459. 實際_2.text = Main.Global.系統語言字典[介面+"25ID"];
  4460. 實際_3.text = Main.Global.系統語言字典[介面+"26ID"];
  4461. 實際_4.text = Main.Global.系統語言字典[介面+"27ID"];
  4462. 實際_5.text = Main.Global.系統語言字典[介面+"28ID"];
  4463. 實際_6.text = Main.Global.系統語言字典[介面+"29ID"];
  4464. }
  4465. }
  4466. }
  4467. private void 初始化系統語言()
  4468. {
  4469. TextAsset txt = Resources.Load("Tran") as TextAsset;
  4470. Main.Global.系統語言資料=txt.text.Split('\n');
  4471. for (int i = 1; i<=Main.Global.系統語言資料.Length; i++)
  4472. {
  4473. try
  4474. {
  4475. string key = Main.Global.系統語言資料[i].ToString().Substring(0, 3)+Main.Global.系統語言資料[i].ToString().Substring(4, 2)+Main.Global.系統語言資料[i].ToString().Substring(7, 2);
  4476. Main.Global.系統語言字典.Add(key, Main.Global.系統語言資料[i].ToString().Substring(10));
  4477. }
  4478. catch
  4479. {
  4480. // Debug.Log("No data");
  4481. }
  4482. }
  4483. }
  4484. }