-
Notifications
You must be signed in to change notification settings - Fork 7
/
vmx.ro
4965 lines (4941 loc) · 261 KB
/
vmx.ro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Cache for Windows^INT^routine output by %apiRTN^^~Format=Cache.S~^RAW
%RO on 17 Mar 2021 04:57:17PM
MX^INT^1^65770,61762^0
MX ;[ 20200229 13:28:03 ]
; MSM, CACHE, IRIS, GT.M, MiniM
; vmx Copyright(c) SIA ENTERS 2005-2020
Q
MXWEB ; TKWEB-(this comment enables this linetag to be reference from web with M3)
MXGET ; TKWEB
Q
ii(oo) q ""
UCI(%UCI) n %
x:$zv["Mini"!($zv["Ca")!($zv["IRIS") "s %=$znspace" x:'$d(%) "s %=$p($zu(0),"","")"
q $g(%,"UNDEF")
sv j comX4(12) q
comX4(comPort,b,zr)
s zr=$g(zr,"^sv"),b=$g(b,9600),ComPort="COM"_comPort ;; ,terminat=$g(terminat,13)
s $zt="comR4^MX" close ComPort h 1 k @zr s @zr="START-$j="_$j,oldQ=0 ;; ,oldH=0
;OPEN comX ;;;:(:::" 801x0":b):5 s o=$TEST ;; h 1 ;; 20150224
OPEN ComPort:(:::" 8 ":b):5 h 1
s @zr=$j f %=1:1:99 s @zr@(%)=0
;; w *-3 ;; 20150129 ;; q ;;USE comX:(:"SI") f o=1:1:999 r *a:0 ;; read com-port, even $c(3) !!
USE ComPort:(:::" 8 ":b)
comR4
i $g(@zr)="" CLOSE ComPort HALT
;; s jsv=$j i $ze["<ENDOFFILE" CLOSE ComPort HALT
s Q="" f x=0:1:99 r *o:1 q:o=-1!(o=13) s Q=Q_$c(o)
i '$l(Q),o<0 w *-3 f x=0:1:32000 r *o:0 ;; 20161122
g:oldQ=Q!'$l(Q) comR4 s %=$H,oldQ=Q
;; i oldH=%,'Q g comR4
s sec=+%_$e(100000+$p(%,",",2),2,9) i '$d(@zr@(sec)) s o=+$o(@zr@(0)) k @zr@(o)
s @zr@(sec)=Q g comR4
q
comWrite(Port,text,zr,b)
k:'$l($g(zr)) zr k:'$l($g(b)) b
s zr=$g(zr,"^comWrite"),b=$g(b,9600),ComPort="COM"_+Port s @zr@(Port,$$pD^MXD($h,2))="?" ;; ,terminat=$g(terminat,13)
OPEN ComPort:(:::" 8 ":b):5
USE ComPort:(:::" 8 ":b)
WRITE text,$c(13),text,$c(13) ;; *-3
CLOSE:000 ComPort s @zr@(Port,$$pD^MXD($h,2))=text
q
comRtest(Port)
s b=9600,ComPort="COM"_+Port,ts=$$pD^MXD($h,2) n o,x,Q
OPEN ComPort:(:::" 8 ":b):5 h 1
USE ComPort:(:::" 8 ":b)
s Q="" f x=0:1:99 r *o:1 q:o=-1!(o=13) s Q=Q_$c(o)
CLOSE ComPort s ^test(Port,ts)=Q_$$pD^MXD($h,2)
q
mxIndex(reportNo)
n % s %=$g(%omPrint(-reportNo),-1) q:% "" s %omPrint(-reportNo)=""
i $l(%) q:'$d(^om(%USID,reportNo)) "" q $$getObj^MXTQM(%,1)
s:%mxIndex="" %mxIndex=$g(%mxIndex(0)) q:%mxIndex="" ""
I $$S^MXF(" s %YX(%YXy,2)="".<mx ic20.-2 "" ",0)
q $$getObj^MXTQM(%mxIndex,1)
omFormat(oo)
if oo[%B set oo=oo_"<mx format=itog "
q oo
MX1^INT^1^65819,46677^0
MX1 ; ;[ 20210316 12:57:57 ]
; MSM, CACHE, IRIS, GT.M, MiniM
; vmx Copyright(c) SIA ENTERS 2005-2021
q
trm ;
s i=$io,p=$p,io="|TRM|:|"_$j
;; close $p OPEN io:(:5533:"MA"):200
;; USE io:(:5533:"RAWCD":"":32000:32000)
s ^mxMonito($$ts,"trm",$j)=$znspace_" -- START trm^MX1 $io="_$io_" i="_i_" p="_p
;; s ^mxMonito($$ts,"trm",$j)=io_" terminal "
q ;;;
trmRead READ R:99 j:000 webChild:(:5:$io:$io) s ^mxMonito($$ts,"trm",$j)=io_" %="_%
w "terminal-",R,!!!
h 1 g trmRead
q
c2(m,server,port,uci)
n %io,%,r s %io=$p s %15=$c(15)
i $g(port) CLOSE "|TCP|2" d i '%chanel2 u %io s %mxWarng(-1)=%chanel2 q %chanel2
. s %chanel2="ERRO"_"R ::: -- not connected to :"_server_":"_port_":"_uci
. OPEN "|TCP|2":(server:port::$c(15)):2 s %="w $j,"" "",$zv ;; UCI="_uci_" "_%15
. i $t USE "|TCP|2" d:$zv[-64 WRITE %,*-3 READ r:1 WRITE %,*-3 READ r:1 s %chanel2=$e(r,1,$l(r)-2)_" "_server_":"_port_":"_uci q
.. i $zv["Ca" n curdev x "s curdev=##class(%SYS.NLS.Device).%New() s curdevState0=curdev.State,curdev.State=0,curdevState1=curdev.State"
s r=%chanel2
i r u "|TCP|2" w m," ; ",$c(0),%15,*-3 r r:7 s r=$e(r,1,$l(r)-2)
u %io i m[(";CL"_"OSE;"),%chanel2 CLOSE "|TCP|2" s %chanel2=";CLO"_"SED; "_%chanel2
q r
tcpMiniM ; vmx-CONCURRENT-SERVER with tcp port 5233 (minim) ;
k ^mxMonito s io="|TCP|:5233" s ^mxMonito($$ts,1,-$j)="START tcpMiniM "
OPEN io ;; USE io:(/MODE="rwb":/TERM=$c(0))
tcpLmi k:000 ^oooRead1 s $ztrap="tcpErrMi^MX1"
USE io:/ACCEPT ;; h 1 r *%1 ;; i %1<0 g tcpLmi
;; s %=$c(%1) i %1>-1 f r *%1:0 q:%1<0 s:%1>0 %=%_$c(%1)
;; s ^mxMonito($$ts,1,$j)=%_-$l(%) i %'["UCI=" u 0 g tcpMiniM ;; d:000 close $io g tcpMiniM
. i %'["Accept" w 0,$c(15),$c(0),*-3 q
. s %=$c(13)_$c(10) n %mxWeb
. s %mxWeb="HTTP/1.1 200 OK"_%_"Content-type: text/html"_%_"Access-Control-Allow-Origin: *"_%_"Cache-Control: no-cache"_%_"Content-Length: "
. w %mxWeb_1_%_%_$c(0),*-3
s ^mxMonito($$ts,1,-$j)="START tcpMiniM "_io
s:000 ^oooRead1=% g:111 tcpChild^MX1 j:000 tcpChild^MX1:(:$io) ;; h 1
s ^mxMonito($$ts,1,-$j)="START tcpMiniM ->> j tcpChild^MX1 "
g tcpLmi
q
webGoogle
s io="|TCP|"_$j OPEN io:(:80:"MA"):200 USE io:(:80:"RAWCD":"":32765:32765)
s ^mxMonito($$ts,0,-$j)=io_" --- 80 "
READ % j webChildG:(:5:$io:$io) s ^mxMonito($$ts,1,-$j)=io_" --- 80 "
h 1 g webGoogle+3
q
;
webChildG USE $io:(:80:"RAWCD":"":32765:32765) s:000 ^mxMonito($$ts,0,-$j)=$io
READ:1 ooo s o=$p(ooo,"mxGoogle=",2,999),%uciGoogle=$p(o,"-"),%USID=$p(o,"-",2),%mxSheet=$p(o,"-",3),%oGoogle=$p(o,"-",4,9999)
s ^mxMonito($$ts,0,-$j)=$io_";;"_ooo
s (o,%oGoogle)=$$u8^MXF(.%oGoogle) d
f %=$l(o)-2:-1:1 s x=$e(o,%) i x="%" s x=$e(o,%,%+2),x=$f("%20 %22"" %23# %3E> %3C<",x) s:x $e(o,%,%+2)=$e("%20 %22"" %23# %3E> %3C<",x)
k %,x s ooo="" x o s ooo=$g(%uciGoogle)_":"_$g(%USID)_":"_$g(%mxSheet)_":"_$g(ooo,$ze)
s Html=$$U8^MXF(ooo),^mxMonito($$ts,1,-$j)=$g(%oGoogle)_";;"_$l(ooo)_";;"_$e(ooo,1,333)
g webReply
;
;
;
;
web s io="|TCP|"_$j OPEN io:(:80:"MA"):200 USE io:(:80:"RAWCD":"":32765:32765)
s ^mxMonito($$ts,0,-$j)=io_" --- 80 "
READ % j webChild:(:5:$io:$io) s ^mxMonito($$ts,1,-$j)=io_" --- 80 "
h 1 g web+2
q
webChild USE $io:(:80:"RAWCD":"":32765:32765) s:000 ^mxMonito($$ts,0,-$j)=$io
READ:1 ooo s o=$p($p(ooo,"MX=",2),"-"),port=$s(+o=3:5233,$zv[-64:2264,1:2232),uci=$p(o,+o,2,22)
s %USID="web",shee=0,^mxMonito($$ts,0,-$j)=$io_";;"_ooo
i 'o s ooo="",port=80,uci="%SYS" d n o g webReply
. s:o["{" o=$$u8^MXF(.o) s o=$p(o,";;") s:'$l(o) o="s ooo=1234567890"
. f %=$l(o)-2:-1:1 s x=$e(o,%) i x="%" s x=$e(o,%,%+2),x=$f("%20 %22"" %23# %3E> %3C<",x) s:x $e(o,%,%+2)=$e("%20 %22"" %23# %3E> %3C<",x)
. k %,x x o
. s Html=$$U8^MXF(ooo),^mxMonito($$ts,1,-$j)=$g(o)_";;"_$l(ooo)_";;"_$e(ooo,1,333)
f %=3:1:99 i $e(uci,%)?1n!($e(uci,%)=" ") s shee=$p($e(uci,%,99)," "),uci=$e(uci,1,%-1) q
s:$l(shee)<2 shee="1_" ;; s:$l(uci)<3 uci="VMX"
i o,uci'["%" zn uci
d getStart s $p(ooo,";--;",2)=" %mxPort="_port_";"_uci_";"_shee_";"_%session_";"_%USID_"; "
s Html=$$U8^MXF(ooo) s ^mxMonito($$ts,1,-$j)=$p(ooo,";--;",2)
webReply s %=$c(13)_$c(10),%1=$l(Html)
s %mxWeb="HTTP/1.1 200 OK"_%_"Content-type: text/html"_%_"Access-Control-Allow-Origin: *"_%_"Cache-Control: no-cache"_%_"Content-Length: "
w %mxWeb_%1_%_%_Html,*-3 k:000 ooo,Html,uci,port,shee d:$d(o) saveMem
q
tcpErrMi h 1 x "s view=$view(""err"",1)" s ^mxMonito($$ts,999,$j)=$ze_" io="_$g(io)_" view="_view
;; close io g tcpMiniM
q
tcpError h 1 s ^mxMonito($$ts,999,$j)=$ze_" io="_$g(io)
c:$d(io) io h 1 ;; goto tcp+2
tcp(PORT) ; MX-CONCURRENT-SERVER with tcp (defolt-PORT : 2232(32-bit) : 2264(64-bit) : 5233(minim) : 5264 (IRIS) )
s i=$io,p=$p,PORT=$g(PORT,$s($zv["IRIS":5264,$zv["-64":2264,1:2232))
g:$zv["MiniM" tcpMiniM g:$zv["MS" tcpMSM q:$zv'["Ca"&($zv'["IRIS") s io="|TCP|"_$j
OPEN io:(:PORT:"MA"):200
USE io:(:PORT:"RAWCD":"":32765:32765) ;; 32767=7FFF
s ^mxMonito($$ts,0,$j)=$znspace_" -- START tcp^MX1 $io="_$io_" i="_i_" p="_p_" PORT="_PORT
tcpL
s $ztrap="tcpError^MX1"
READ % j tcpChild^MX1:(:5:$io:$io)
;; s ^mxMonito($$ts,0,$j)=$znspace_" -- START j tcpChild^MX1 "_$g(%)
h 1 g tcpL
q
;; i $zv["Ca" s ip=$zu(67,15,$j),o=$d(^mxSYSTEM("mxDenyIP",ip_1)) d g:o tcpL
;; . s ^mxMonito($$ts,0,$j)=ip_" "_p_" "_$tr(%accept_" job="_$j_" $za="_$za_" $zb="_$zb_" $zc="_$zc,$c(0),"o")
;; . i o s o=o_$zr,@$zr=@$zr_" ::: access denyed ::: "_o
tcpChild ;; s ^mxMonito($$ts,0,$j)=$znspace_" -- START j tcpChild^MX1 "
k ooo s ooo=""
i $zv["MS" USE 56 g tcpChilR^MX1
i $zv["MiniM" USE $io:(/MODE="rwb":/TERM=$c(0))
i $zv'["MiniM" USE $io:(:PORT:"RAWCD":"":32765:32765)
s ^mxMonito($$ts,1,$j)=$znspace_" -- START tcp^MX1 $io="_$io_" i="_i_" p="_p_" PORT="_PORT
tcpChil2 s $ztrap="saveMem^MX1",ooo=""
i $zv'["MiniM" f READ:600 ooo d:ooo="" s uci=$tr($p($p(ooo," UCI=",2)," "),"""") s:ooo["OPTIONS" ^mxMonito($$ts,0,-$j)=ooo s:$e(ooo,1,3)="GET" o=$p($p($p(ooo,"UCI=",2),";",1,6)," "),uci=$p(o,";") q:$l(uci)>2
. i $g(%session),$d(%mxWeb),$znspace'="%SYS",$g(%gm),$g(^oAllVars($g(%USID,-2.2),-%session,"$j"))=$j s %=%session n YX,Y,X,ooo,%session,%mxWeb i $$SaveMem^USX(%USID,-%)
i $zv["MiniM" f READ *%:60 d:%>-1 s uci=$tr($p($p(ooo," UCI=",2)," "),"""") s:$e(ooo,1,3)="GET" o=$p($p($p(ooo,"UCI=",2),";",1,6)," "),uci=$p(o,";") q:$l(uci)>2
. s ^mxMonito($$ts,3.1,-$j)=%
. s:%>0 ooo=$c(%) f READ *%:0 q:%<0 s:%>0 ooo=ooo_$c(%)
. s ^mxMonito($$ts,3.2,-$j)=ooo
. ;; i '$l(ooo),$g(%session),$d(%mxWeb),$znspace'="%SYS" k YX,Y,X,ooo i $$SaveMem^USX(%USID,-%session)
;; q:'$l(o)
s ooooREAD=-99 s $ztrap="mxErrChR^MX1"
i $l(uci)>2,$l(uci)<9,$znspace'=uci zn uci
i $e(ooo,1,3)'="GET" w uci,0,$c(0),$c(15),*-3 g tcpChilR^MX1 ;; mx-EXCEL
q:'$l(uci)
;; s ^mxMonito($$ts,3,$j)="START tcpChild^MX1 ooo="_ooo_-$l(o)_$g(o)
i $e(ooo,1,3)="GET" s %mxWeb=1 d ;; mx-WEB
. ;; s %1=+$g(%session)
. i o["%session" f %="YX","%USID","%mxSheet","%session" s @%=$p($p(o,";"_%_"=",2),";")
. i o'["%session" s %USID=$p(o,";",3),%mxSheet=$p(o,";",2),%session=0,YX=""
. i '%session s ^mxMonito($$ts,3.3,$j)="START tcpChild^MX1 o="_o h 1
. s %1omCode=$p($p(ooo,";=",2,999),";];") s:%1omCode["{" %1omCode=$$u8^MXF(.%1omCode)
. f %=$l(%1omCode)-2:-1:1 s o=$e(%1omCode,%) i o="%" s o=$e(%1omCode,%,%+2),o=$f("%20 %22"" %23# %3E> %3C<",o) i o s o=$e("%20 %22"" %23# %3E> %3C<",o),$e(%1omCode,%,%+2)=o
. s %mxForma=%mxSheet i '%session d getStart q
. ;
. ;; s ^mxMonito($$ts,4,$j)=YX_" "_%USID_" "_%mxSheet_" %session="_%session_" ooo="_ooo_" o="_o
. i YX="-2" s:000 %session=$g(^ooomxWeb(%USID,0)) s %=0,ooo="" x "f s %=$o(^oSaveAsT(%USID,""web_MX_JS"",%)) q:'% s o=$p(^(%),""// "") s ooo=ooo_o" q
. s %oldJob=$g(^oAllVars(%USID,-%session,"$j"))
. i %oldJob'=$job s %=%session x "n YX,ooo,%session,%1omCode,%mxSheet,%mxForma i $$RestMem^USX(%USID,-%)" s ^oAllVars(%USID,-%session,"$j")=$job,%mxWeb=1
. i YX=%mxSheet d getForma q
. i $l(%1omCode)>11,'YX s %changed=$g(%changed)+1
. s Y=+YX,X=+$p(YX,"-",2),%qSelect=$g(%qSelect),%ySelect=$g(%ySelect,1),%xSelect=$g(%xSelect,1),%B=$c(254)
. s %1ooooYX=YX,ooo=""
. i Y&X!(YX="0"),$l(%1omCode)>1 d q
.. s:Y Yrc=$g(^oYrc(%USID,%mxSheet,Y),Y),%YXy=Y,%YXx=X
.. i Y,X s %1=$g(^oTQMo(%USID,%mxSheet,Yrc,X)),%2=$g(^oRC(%USID,%mxSheet,Yrc\1,X)),%3=$g(^oYX(%USID,%mxSheet,Y,X))
.. x "n %1,%2,%3,%1ooooYX "_%1omCode s ooo=$g(ooo),YX=%1ooooYX
.. i ooo="",YX d
... i $e(%2,1,6)="?$$B~ " f %=3:2 s o=$p($p(%2," ",1,15),"?",%) q:'$l(o) x "n %,YX s $p(%2,""?"","_%_")="_o
... s ooo=%1_";;oRC="_%2_";;oRC=;;oYX="_%3
s Html=YX_";"_%USID_";"_%mxSheet_";"_%session_";="_$$U8^MXF(.ooo)
s %=$c(13)_$c(10),%1=$l(Html)+1
;; s %mxWeb="HTTP/1.1 206 Partial Content"_%_"Content-type: text/html"_%_"Access-Control-Allow-Origin: *"_%_"Accept-Ranges: bytes"_%_"Content-Range: bytes 1-"_%1_"/"_%1_%_"Cache-Control: no-cache"_%_"Connection: " ;; ..
s %mxWeb="HTTP/1.1 200 OK"_%_"Content-type: text/html"_%_"Access-Control-Allow-Origin: *"_%_"Cache-Control: no-cache"_%_"Content-Length: "
;; s %mxWeb="HTTP/1.1 200 OK"_%_"Content-type: text/html"_%_"Access-Control-Allow-Origin: http://www.armex.pro/links.txt"_%_"Cache-Control: no-cache"_%_"Content-Length: "
;; s ^mxMonito($$ts,7,$j)=$g(%1omCode)_" ooo="_ooo
w %mxWeb_%1_%_%_Html_$c(0),*-3
i $g(%1omCode)[";$$SaveMem;" x "n YX,Y,X,Html,ooo,%mxWeb,o,%1omCode i $$SaveMem^USX(%USID,-%session)"
k Html,ooo,%accept s %mxWeb=1
g tcpChil2
saveMem i $l($g(%USID)),$g(%session)>0,$g(%gm) n ooo i $$SaveMem^USX(%USID,-%session)
q
getStart
s:'$l(%USID) %USID=$e($p($p($p(ooo,"UCI=",2),";",3)," "),1,22)
;; s (^(0),%session)=$g(^ooomxWeb(%USID,0),1)+1
i '$l(%USID) s ooo="<HTML><BODY> -- "_ooo_$zv_" -- user not exists -- ERROR -- </BODY></HTML>" q
i '$d(^oRC(%USID)) s ooo="<!DOCTYPE HTML><BODY> -- "_ooo_$zv_" -- not exists in "_$zr_" -- ERROR -- </BODY></HTML>" q
s (^ooomxWeb(%USID,0),%session)=$g(^ooomxWeb(%USID,0))+1
s %=0,ooo="" d s:000 ^mxMonito($$ts,7,$j)=$l(ooo)
. f s %=$o(^oSaveAsT(%USID,"web_MX_HTML",%)) q:'% s o=$p(^(%),"// ") s ooo=ooo_o
. s %="" f s %=$o(^oAllVars(%USID,%)) q:'% i %<(-%session) k ^(%)
x "n YX,Y,X,Html,ooo,%mxWeb,o,%1omCode s %=%session n %session i $$SaveMem^USX(%USID,-%)"
s ^mxMonito($$ts,6,$j)=$g(YX)_" web %USID="_$g(%USID)_" "_%mxSheet_" $l(ooo)="_$l(ooo)_$zv
q
getForma n %
s ooo="",%=%USID n %USID s %USID=$p(%,".")
i $l(%1omCode)>11 x:'$d(%DatUMs)!'$d(%gm) ";; n %mxSheet,%mxForma,%1omCode,YX,ooo ;; i $$RestMem^USX(%USID,-%session)" d
. s %="%" f s %=$o(^oRC(%USID,%mxForma,"?.var",%)) q:'$l(%) s:'% @%=^(%)
. x %1omCode n %mxSheet,%mxForma,%1omCode,YX,ooo i $$SaveMem^USX(%USID,-%session)
s %=$o(^oYrc(%USID,%mxSheet,0,0)) i % s YX="[=",ooo=^(%) k ^(%) q
q:'$l(%1omCode)
n %0,Yrc,%insRows,ym,xm,xi,X,Y,%11,%,%1,%22,%123,%formatC
s Yrc=0,%insRows=0,ym=2,xm=5,xi=5,%formatC=$g(^vmxExcel(%USID,%mxSheet,".format"))
s Y=0 f s Y=$o(^cYX(%USID,%mxSheet,Y)) q:'Y s X=1 f s X=$o(^cYX(%USID,%mxSheet,Y,X)) q:'X i $d(^(X,2)) s ^oTQMo(%USID,%mxSheet,Y,X)=$g(^oTQMo(%USID,%mxSheet,Y,X))_";;oRC=?$$Image cYX Size=222"
f s Yrc=$o(^oTQMo(%USID,%mxSheet,Yrc)) d:Yrc i 'Yrc s ^oYrc(%USID,%mxSheet,0,999999)=ooo q
. s:Yrc["." %insRows=%insRows+1 s Y=Yrc\1+%insRows,o="",X=.2,%123=.123,%11=0 s:Y>ym ym=Y
. i Yrc'["." f s X=$o(^oTQMo(%USID,%mxSheet,Yrc,X)) q:'X s %1=$g(^(X)),%2=$g(^oRC(%USID,%mxSheet,Yrc,X)) d q:$l(o)>10000
.. s %="" i X>1,$l(%2)!$l(%1) s %=$f(%formatC,"]"_Yrc_-X_":") i % s %=$p($e(%formatC,%,%+210),"]")
.. i $e(%2,1,3)="?$$" d s %=""
... n % s %=$p($p(%2," "),"::",2,9) i $l(%) s %0=%2,%2="" i @% s %2=%0
.. s:%2'=%1&$l(%2) %1=%1_";;oRC="_%2 s:$l(%) %1=%1_" ;f;"_% q:'$l(%1) s:"00.0- "'[%1 %11=X
.. s o=o_"[="_$s(%123+1=X:"~",1:Y_-X_"-")_%1,%123=X
. i Yrc["." f s X=$o(^oTQMo(%USID,%mxSheet,Yrc,X)) q:'X s %1=$g(^(X)) i $l(%1) s o=o_"[="_$s(%123+1=X:"~",1:Y_-X_"-")_%1,%123=X s:"00.0- "'[%1 %11=X q:$l(o)>10000
. i $l(ooo)+$l(o)>10000 s ^oYrc(%USID,%mxSheet,0,Yrc)=ooo,ooo=""
. s:%123>xm xm=%123 s:%11>xi xi=%11 s:Y'=Yrc ^oYrc(%USID,%mxSheet,Y)=Yrc s ooo=ooo_o
k ^oY m ^oY=^oYrc(%USID,%mxSheet,0) s YX="[=",o=$o(^oYrc(%USID,%mxSheet,0,0)),ooo=ym_-xm_-xi_^(o) k ^(o)
;; s ^mxMonito($$ts,6,$j)=YX_" web "_%USID_" "_%mxSheet_" $l(ooo)="_$l(ooo)
q
tcpChilR
i $zv'["MiniM" READ %1omCode
i $zv["MiniM" READ *% s %1omCode=$c(%) f READ *% q:%<1 s %1omCode=%1omCode_$c(%)
s:$e(%1omCode,1,4)["zw" ^mxMonito($$ts,0_$g(%USID))=%1omCode_" ::: "_$zt
s $ztrap="mxErrChR^MX1",%oorxxxw="1"
i $e(%1omCode,1,5)="CLOSE" w $j,":CLOSE:",0,$c(0),$c(15),*-3 close $p hang 2 HALT
i '$d(%oorxxxU) s %oorxxxU="" s:$zv["U) " %oorxxxU=1
i $l(%oorxxxU) s %oorxxxU=$f(%1omCode,"{") d:%oorxxxU
. n %1,%,s f %=%oorxxxU-1:1:$l(%1omCode) i $e(%1omCode,%)="{" f %1=4,5,6 s s=$e(%1omCode,%+%1) i s="}" s s=$e(%1omCode,%+1,%+%1-1) i s\1=s,s<66200,s>250 s $e(%1omCode,%,%+%1)=$c(s) q
x %1omCode w 0_$c(0)_$c(15),*-3 ;; w:$g(%oorxxxw)'="0" 0,$c(0),$c(15),*-3
g tcpChilR
q
tcpChilRformsm ;; not correct work
i $zv["Ca"!($zv["IRIS") READ %1omCode i 1 ;; i $zv["MS" s ^mxMonito($$ts,$g(%USID)_" ")=$e(%1omCode,1,500)
else s %1omCode="" f READ *% q:%<1 s %1omCode=%1omCode_$c(%)
i $zv["MS" s ^mxMonito($$ts,0)=$e(%1omCode,1,500)
i $e(%1omCode),$e(%1omCode,1,7)-1000000>0 s %1omCode=$e(%1omCode,8,999999) f %2=1:1:999 d q:%<0
. s ^mxMonito($$ts,%2)=1000000_$e(%1omCode,1,500)
. w 0_$c(0)_$c(15),*-3 s %1="" f READ *% q:%<1 s %1=%1_$c(%)
. s ^mxMonito($$ts,%2)=$e(%1,1,500)
. s %=$e(%1,1,8)-1000000 s:%>0 %1=$e(%1,8,999999) s %1omCode=%1omCode_%1
s $ztrap="mxErrChR^MX1",%oorxxxw="1"
i $e(%1omCode,1,5)="CLOSE" w $j,":CLOSE:",0,$c(0),$c(15),*-3 close $p hang 2 q
i '$d(%oorxxxU) s %oorxxxU="" s:$zv["U) " %oorxxxU=1
;; i $zv["MS" s ^mxMonito($$ts,$g(%USID)_2)=$e(%1omCode,1,500)
. n %1,%,s f %=%oorxxxU-1:1:$l(%1omCode) i $e(%1omCode,%)="{" f %1=4,5,6 s s=$e(%1omCode,%+%1) i s="}" s s=$e(%1omCode,%+1,%+%1-1) i s\1=s,s<66200,s>250 s $e(%1omCode,%,%+%1)=$c(s) q
x %1omCode w 0_$c(0)_$c(15),*-3 ;; w:$g(%oorxxxw)'="0" 0,$c(0),$c(15),*-3
;; i $zv["MS" s ^mxMonito($$ts,$g(%USID)_2)=$e(%1omCode,1,500)
g tcpChilR
q
mxErrChR n e
s ^mxMonito($g(ooooREAD)+.1,$g(%USID)_" ::: ERROR in : ")=$e($g(%1omCode),1,333)_$ze_" $zt="_$zt_" %mxForma="_$g(%mxForma)_" y="_$g(%YXy)_" x="_$g(%YXx),$zt=""
s e=$e($tr(@$zr,$c(0)),1,333)_" ERRO"_"R ::: "_$ze_" ::: "_$e($g(%1omCode),1,333) s:$zv["U) " e=$$U8^MXF(e)
s %=$ze,^mxMonito($$ts,$g(%USID)_" ::: ERROR in : ")=e_" ::: "_% s e=$$trw^UST(e,"<mx","<.mx")
i %["<DISCONNECT>" close $p hang 1 HALT ;; hang 120
i %["<WRITE>" close $p hang 1 HALT ;; hang 120
s $ec="" w:'$d(%mxWeb) "ERRO"_"R ::: ",$$trw^UST(e,"<mx","<.mx"),0,$c(0),$c(15),*-3
s %=$c(13)_$c(10)
i $d(%mxWeb) s %mxWeb="HTTP/1.1 200 OK"_%_"Content-type: text/html"_%_"Access-Control-Allow-Origin: *"_%_"Cache-Control: no-cache"_%_"Content-Length: "
i $d(%mxWeb) s Html=$g(YX)_";"_$g(%USID)_";"_$g(%mxSheet)_";=ERRO"_"R ::: "_$$U8^MXF(e) w %mxWeb_($l(Html)+1)_%_%_Html,$c(0),*-3 s ooo="" g tcpChil2 ;;; HALT
I %["<NAMESPACE>" h 1 close $p h 1 HALT
g tcpChilR
q
W(%) w $c(0,0),$c($l(%)\256),$c($l(%)#256),%
q
GTMread ;;w !,"gtm : WRITE /WAIT(%ZNTimeS) : %ZNCmd=",%ZNCmd," SOCKET=",%ZNSock
q
enterYX(%USID,%mxSheet,%y,%x,%N,%K) q:'$d(%mxWeb) 0
;; 20190503 ;; i $e(%K)="<",$e(%K,1,3)'="<mx" q " "_%y_"-"_(%x+1)
n %,%1,oo,%mxForma,%ooSheet,%mxIndex,%in,%n,%E,oRCresult,%oldoYXq,ooooooYX,%G,%goY,%goX
n gotoYXyy,gotoYXxx,%oRCmCod,%TQMmCod s %ooSheet=%mxSheet,%qChange=%K
s %mxForma=$p(%mxSheet,"--"),%G=0,%YXy=%y,%YXx=%x,%E="",%GM=0,%flagEdi=$g(%flagEdi),%K(0)=%K
s (%nn,%tabRow)=$$%0Yrc^MXTQM2(%y) s:$e($g(^oRC(%USID,%mxForma,%y,%x)),1,2)["?_" %Yrc=%y
s %oldoYXq=$g(^oYX(%USID,%mxSheet,%y,%x)),%in=$g(^oRC(%USID,%mxForma,%Yrc,%x))
i %oldoYXq'=%K,$d(^onChange(%USID,%mxForma,%y,%x)) s %oRCmCod=^(%x),%qChange=%K,%yChange=%y,%xChange=%x
i %tabRow,%Yrc<%YXy,%YXy-%Yrc+1'=%tabRow s %E=%tabRow_" %Yrc="_%Yrc_" %YXy="_%YXy g enterYXe
i $e(%in)="?",$e(%in,1,3)'="?$$" s %N=$tr($p(%in," "),"?_") i "%oo"'[%N,%in[" ;;; ",%N'="%mxIndex" s %oRCmCod=$p(%in," ;;; ",2,99) s:$e($g(^(%x+1)),1,3)="?.." %oRCmCod=%oRCmCod_$e(^(%x+1),4,999)
i '%tabRow,$e(%K)="="!($e(%K,$l(%K))="=") d g:$l($g(%E)) enterYXe i $d(%1) x:$e(%K)="=" "s %K"_%K x:$e(%K,$l(%K))="=" "s %K="_$e(%K,1,$l(%K)-1) ;; ;; to-do !! $$formuExc()
. s %1=$tr(%K,"+-/*()^_=[]':\#,.;"," ") i $tr(%1," """)="" k %1 q
. q:%K["$"!(%K["^")!(%K["_")!(%K["'")!(%K["%")!(%K["[")!(%K["""")!($e(%K)'="=")!%K
. f %=1:1:$l(%1," ") s %n=$p(%1," ",%) i $l(%n),'%n,$e(%n)'="$",'$d(@%n) s %E=$g(%E)_%n_"--< undef > "
i $e(%in)'="?"!($e(%in,1,3)="?$$"),'%tabRow,'$d(%oRCmCod) s ^oYX(%USID,%mxSheet,%y,%x)=%K g enterYXe
i 0_%mxForma["0t." s %FILE=$e(%mxForma,3,99),%GM=$l(%LI(%FILE),",")
else i %tabRow s %=$g(^oRC(%USID,%mxForma,"?$$TQM",1)),%=$p(%," ",3) i $e(%)="^",%[")" d
. s %oRCmCod="i '$l($g(%E)),1_$d("_%_") s @$zr@(%N)=%K",%FILE=$e($p(%,"("),2,99),%LII(%FILE)=$e($p(%,"(",2,99),1,$l(%)-1),%GM=0
i %tabRow s %=1,%1=-1 f s %=$o(^oRC(%USID,%mxForma,%Yrc,%)) q:'% s o=^(%),%n=$p(o," ") i $e(%n,1,2)="?_" s %n=$e(%n,3,99),%1=%1+1,@%n=$p($g(^oYX(%USID,%mxSheet,%y,%)),"<mx ") s:%n["%mxIndex" @%n=%_o s:%n=%N %G=%1 i %G>1 s:$p(o,";")[" ] " %GM=%1
i %tabRow,%x'>%mxIndex!(%G<2)!'%GM,%flagEdi'[(%y_" "_%mxSheet_" ") d
. s %flagEdi=%y_" "_%mxSheet_" ",%YX(%y,2)="<mx ic19.-2"
. n %x x $p(%mxIndex,";;;",2) i '%G,%K="-" s o=$p(%mxIndex,";-;",2) i $l(o) x o s oo="<mx ic46.-2",%E=1
;
i ($e(%K)="=")!($e(%K,$l(%K))="=") d g:$l(%E) enterYXe i $d(%1) x:$e(%K)="=" "s (oo,%K)"_%K x:$e(%K,$l(%K))="=" "s (oo,%K)="_$e(%K,1,$l(%K)-1) ;; ;; to-do !! $$formuExc()
. s %1=$tr(%K,"+-/*()^_=[]':\#,.;"," ") i $tr(%1," """)="" k %1 q
. q:%K["$"!(%K["^")!(%K["_")!(%K["'")!(%K["%")!(%K["[")!(%K["""")!($e(%K)'="=")!%K
. f %=1:1:$l(%1," ") s %n=$p(%1," ",%) i $l(%n),'%n,$e(%n)'="$",'$d(@%n) s %E=$g(%E)_%n_"--< undef > "
i '$d(%oRCmCod) g:'%G&%E!(%N="%mxIndex") enterYXe
i %tabRow,%flagEdi'[(%y_" "_%mxSheet_" ") s:%G&%GM %YXx=+%mxIndex g enterYXe
i '$d(%oRCmCod),'$l(%N) s ^oYX(%USID,%mxSheet,%y,%x)=%K g enterYXe
s:'$l(%K) %K=$g(%WW(%N)) s:%K["<mx "!($e(%K)="?") oo=%K
i 0_%mxForma["0t.",%G d i '$l(%K) s:%tabRow>1&'$l(%oldoYXq)&(%'=%N) %K=$g(^oYX(%USID,%mxSheet,%y-1,%x)),oo=%K i '$l(%K) s %E="-- enter info in this cell ! --" g enterYXe
. s %=%LII(%FILE),%=$p(%,",",$l(%,",")) q:%'=%N s:$l(%K) @%N=%K,%NEW=$d(@("^"_%FILE_"("_%LII(%FILE)_")"))
;;;;;;;;;;;;;;;;;; i %GM!'%tabRow s oRCresult=$$oRC^MXTQM2(%K,%mxForma,%y,%x)
;; k ^ERR f %="%YXy","%YXx","%y","%x","%mxIndex","%G","%GM","%goY","%goX","%N","%Yrc","%tabRow","%flagEdi","%TQMformu","%oRCformu" s ^ERR(%)=$g(@%,"<undef>")
s @%N=%K x $g(%oRCmCod) x:%tabRow $g(%TQMmCod)
i $l($g(%E)),$e(%E,1,4)'="%SEL" s @%N=%oldoYXq q " - "_%G_%N_";;=%E=;;"_$$trw^UST(%E,$c(10),"<br> ")
i %K(0)'="=%N","ooo"'[%N,%N'?1"%".n s (@%N,^oYX(%USID,%mxSheet,%YXy,%YXx))=$p(%K,"<mx ")
i %ooSheet'=%mxSheet q %mxSheet
i $d(%SEL) q " - "_%G_%N_";;=%E=;;"_$g(%E)_";;=%E=;;=SEL=;;"_$$ooo2^MXF("%SEL")
i $d(%YX) x "n %YXy,%YXx s ooooooYX=$$oYXshowM^MXTQM2(%mxSheet)"
enterYXe s %goY=%YXy,%goX=%YXx+1 s:%K(0)'=%K&'$d(oo) oo=%K
;; s:$l(%oldoYXq)&(%K'=%oldoYXq)&'$d(oo) oo=%K_"<mx ic19 fb @"_%oldoYXq i $d(oo),'$l(oo) s oo=" "
i %G,%GM'<%G s:%YXx'>%mxIndex %YXx=+%mxIndex s:%G=+$g(%GM) %YXx=+%mxIndex,%goY=%YXy+1 s %goX=+$o(^oRC(%USID,%mxForma,%Yrc,%YXx)) s:'%goX %goX=+$o(^oRC(%USID,%mxForma,%Yrc,+%mxIndex))
i '%G,$l(%N),'%tabRow s o=$g(%EnterLi(%mxForma)) d:'$l(o) i o[%N s o=$p(o," "_%N_" ",2,9) i $l(o) f %=1:1:9 s %n=$p(o," ",%) q:%n="//" i $l(%n) s o=$g(^oRC(%USID,%mxForma,"?var",%n)) s:o gotoYXyy=o+(%n=%N),gotoYXxx=+$p(o,"-",2) q
. s %=0 f s %=$o(^oRC(%USID,%mxForma,"?$$EnterList",%)) q:'% s o=o_" "_$p(^(%)," ",2,99)
. s %EnterLi(%mxForma)=o_" "
;; k ^ERR f %="%YXy","%YXx","%y","%x","%mxIndex","%G","%GM","%goY","%goX","%N","%Yrc","%tabRow","%flagEdi","%oRCmCod","oo","%oldoYXq" s ^ERR(%)=$g(@%,"<undef>")
q:$g(%n)[":)" 1
s:$g(gotoYXyy) %goY=gotoYXyy s:$g(gotoYXxx) %goX=gotoYXxx s:$g(%E) %E=";;=%E=;;"_%E_";;=%E=;;"
q " "_%goY_"-"_%goX_" "_%G_%N_$g(%E)_";;=YX=;;"_$g(ooooooYX)_";;=YX=;;=oo=;;"_$g(oo)
q
ts() q $$pD^MXD($h,2)
mxMSMtcp
tcpMSM ; vmx-CONCURRENT-SERVER with tcp port 2666 (msm) ;
k ^mxMonito s io=56,^mxMonito($$ts,1,-$j)="START tcpMSM port 2666 "
initMSM ; Process the init state MSM
x "S nt=($ZB($V(0,-4,2),#F,1)=10)" ; Determine OS type, NT or not NT
close 56 open 56:(:nt*8):"TCP" ; Open and initialize the device
;; s %=$c(%1) i %1>-1 f r *%1:0 q:%1<0 s:%1>0 %=%_$c(%1)
;; s ^mxMonito($$ts,1,$j)=%_-$l(%) i %'["UCI=" u 0 g tcpMiniM ;; d:000 close $io g tcpMiniM
use 56 s %lddb=$KEY,rr(0)=%lddb g listeMSM
q
listeMSM ; Process the ntlisten state
use 56:(%lddb)
s ^mxMonito($$ts,1,-$j)="listeMSM %lddb="_%lddb_" nt="_nt h 1
x "W /SOCKET("""",2666) S %xddb=$KEY,lza=$ZA,lzb=$ZB,lzc=$ZC,%ddb=$ZH(%xddb)"
s ^mxMonito($$ts,1,-$j)="%xddb="_%xddb_" lza="_lza_" lzb="_lzb_" lzc="_lzc_" %ddb="_%ddb h 1
I lzc&(lzb=-8) G listeMSM
I lzc G initMSM
; Save the caller address
x "S addr=$V(%ddb+16,-3,0)"
x "S %(""ADDRESS"")=$V(addr+13,-3,$V(addr+12,-3,1),9)"
x "U 56:$ZH(+%ddb)"
;
;;; Associate the ddb with this job :
;;x "V %ddb+46::$J-$V(272,-4,4):2"
;;; Check for accept error :
;;I lzc&(lzb=-8) G listeMSM
;;I lzc G initMSM
;; g x
s ^mxMonito($$ts,1,-$j)="START MSM "_io
;
d tcpChild^MX1
h 2 g listeMSM
q
nspace(name)
; zn "%SYS" d ^DATABASE
zn "%SYS"
x "s o=##class(Config.Configuration).AddNamespace(name,name,name)"
q o
q
rest(%USID,%UCI,%1omCode)
;; if $zv["UNIX" q restUNIX(%USID,%UCI,%1omCode)
if '$d(%USIDoo)!$g(^oAllVars(%USID_"*",%UCI,-2)) s %1=%USID,%2=%UCI d s %USIDoo=%USID
. n %USID,%UCI,%omCode,%request,%response,%SYSLOG,%session,skipheader,tAuthorized,tRedirectRoutine,tRedirected,tSC,tURL,%zt,%j if 1_$$RestMem^USX(%1_"*",%2)
;
s ooo="",%zt=$zt,%zns=$znspace,$ztrap="restErr^MX1",%io=$io
s ^|"%SYS"|trm($j)=$znspace_" "_%USID_" "_$zt
k ^oooorest($j)
;; s:$e(%1omCode,1,4)["zw" ^mxMonito($$ts,0_$g(%USID))=%1omCode_" ::: "_$zt
s %oorxxxU=$f(%1omCode,"{") d:%oorxxxU
. n %1,%,s f %=%oorxxxU-1:1:$l(%1omCode) i $e(%1omCode,%)="{" f %1=4,5,6 s s=$e(%1omCode,%+%1) i s="}" s s=$e(%1omCode,%+1,%+%1-1) i s\1=s,s<66200,s>250 s $e(%1omCode,%,%+%1)=$c(s) q
if $zv'["UNIX" D $ZU(82,12,1)
x %1omCode close:$zv["UNIX" 2 if '$d(%USID) d oo^MXterm ;; w 0_$c(0)_$c(15),*-3
if $zv'["UNIX" D $ZU(82,12,0)
;; if $zv["UNIX" k ^oooorest($j) m ^oooorest($j)=^SPOOL($j)
if $zv["UNIX" s %=0,ooo="" f s %=$o(^SPOOL($j,%)) q:%>9999999!'% s ooo=ooo_^(%)
if $zv'["UNIX" n % s %=0,ooo="" f s %=$o(^|%zns|oooorest($j,%)) q:'% s ooo=ooo_^(%)
restE
if $l($g(%USID)),$znspace=$g(%UCI),$$SaveMem^USX(%USID_"*",%UCI)
q $g(ooo)
restErr s:$l($g(%zt)) $zt=$g(%zt),ooo="ERROR ::: "_$ze_" "_ooo D $ZU(82,12,0)
g restE
q
MX2^INT^1^65770,61762^0
MX2 ;[ 20191011 20:14:18 ]
; M3-LITE, MSM, CACHE, GT.M-5x
QQ ; TKWEB ; start mxWeb
s %USID=$g(%("FORM","U")),oooo=$g(%("COMMAND")),a=$g(%("ADDRESS")) s:'$l(a) a="127.0.0.1"
i %USID="" s %USID=a s:%USID="127.0.0.1" %USID="es"
s:%USID %USID="u"_$p(%USID,".",4)
s:$l(a) ^o(a)=%USID
w "<html>" k ^oProc m ^oProc=% s ^oProc("ADDRESS")=a
;;w "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Frameset//EN"">",!
w "<head><title>mxWeb</title>",!
;w "<SCRIPT></SCRIPT>",!
w "<HTA:APPLICATION ID=""WL"" APPLICATIONNAME=""WebLink"" ICON=""http://localhost/gb/weblink1.ico""",!
W " CONTEXTMENU=""NO"" SCROLL=""NO"" SINGLEINSTANCE=""YES"" VERSION=""2.0"" WINDOWSTATE=""maximize"">",!
w "</head>",!
w "<frameset frameborder=0 framespacing=0 border=0 cols=* rows=55,*>",!
w "<frame marginwidth=0 marginheight=0 src=""http://localhost/gb/QQTITL^MX"" application=yes name=QQTITL noresize scrolling=no >",!
w "<frameset frameborder=0 framespacing=0 border=0 cols=""225,*"" rows=""*"">",!
w "<frameset frameborder=0 framespacing=0 border=0 cols=""*"" rows=""0,*"">",!
w "<frame marginwidth=0 marginheight=0 application=yes name=""code"" noresize >",!
w "<frame marginwidth=0 marginheight=0 src=""http://localhost/gb/QQMENU^MX"" application=yes name=QQMENU noresize >",!
w "</frameset>",!
w "<frameset rows=95%,5% >",!
w "<SCRIPT> </SCRIPT>",!
w "<frame marginwidth=0 marginheight=0 src=""http://localhost/gb/QQFORM^MX"" application=yes name=QQFORM noresize scrolling=auto >",!
w "<frame marginwidth=0 marginheight=0 src=""http://localhost/gb/QQEMPT^MX"" application=yes name=QQCOMM noresize scrolling=no >",!
w "</frameset></html>"
Q
QQTITL ; TKWEB ; frame title
s oooo=$g(%("COMMAND")),a=$g(%("ADDRESS")) s:'$l(a) (a,%("ADDRESS"))="127.0.0.1" s %USID=^o(a)
s %USID=^o(a),oxxxo=$p(oooo,"&A=",2,99)
i oxxxo="" s oxxxo="d w7^MX"
d getVars
w "<HTML>"
w "<META http-equiv=""Content-Type"" content=""text/html; charset=windows-1257"">",!
w "<HEAD><TITLE>mx-QQTITL</TITLE></HEAD><BODY>",!
w "<table width=1020 border=0 cellspacing=0 cellpadding=0 "
w " align=center style=""position: absolute; left: 0; top: 0"">",!
;;W "<tr valign=""top""> ",!
;;w "<td width=1020 colspan=2 height=30 bgcolor=#FFFFFF>"
;;w "<img src=""toppen.jpg"" width=""2100"" height=30 ></td></tr>",!
w "<tr><td width=1020 colspan=2 height=30>",!
f o=1:1:6 w "<img src=blaknapp.jpg width=170 height=30>"
w "</td></tr>",!
W "</table>",!
w "<SCRIPT></SCRIPT>",!
d oxxxo
Q
w7
f o=%USID k ^MsgVM(o),^MsgMV(o),^MsgMVM(o),^MsgVMV(o),^mxM(o)
;;s $zt="Ervb^USX"
i $$NewDate^MXD
s %XD81=$g(%XD81,20020101),%XD82=$g(%XD82,20021231)
i $$icDate^MXD(%XD81,%XD82)
i $$icFIRMA^fir(1)
w "<table bgcolor=silver width=100% style=""position: absolute; left: 0; top: 30"">"
w "<tr><td> ",$$u^MX($g(%FIRMA)),"</td><td> ",$$u^MX($g(%DatUMs)),"</td> "
w "<td>",%UCI,"</td>"
w "</tr></table>"
Q
QQMENU ; TKWEB ; frame of the menu
s oooo=$g(%("COMMAND")),a=$g(%("ADDRESS")) s:'$l(a) (a,%("ADDRESS"))="127.0.0.1" s %USID=^o(a)
s oxxxo=$p(oooo,"&A=",2,99) s:oxxxo="" oxxxo=" d mxMENU "
d getVars
W "<HTML>"
;w "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Frameset//EN"">",!
;w "<META http-equiv=""Content-Type"" content=""text/html; charset=windows-1257"">",!
w "<HEAD><TITLE>mx-QQMENU</TITLE>",!
;w "<SCRIPT type=""text/javascript"" language=""JavaScript"" >",!
;------------------------- SCRIPT ---------------------------
w "<SCRIPT language=JavaScript >",!
w "function jsMXmenu(line) {",!
w "o21=new String; id=new String",!
w "yMax=MENU.rows.length;",!
w "if (line==yMax) {yMax=0;}",!
w "o21=MENU.rows(line).getAttribute('VALUE'); le=o21.length-1",!
w "vi=MENU.rows(line+1).style.display ; ",!
w "im=MENU.rows(line).all.length-1 ; ",!
w "id=MENU.rows(line).all[im].getAttribute('id') ;",!
w "if ((id.charAt(0)=='o')&&(vi=='none')) {",!
w " MENU.rows(line).all[im].style.display='inline'; ",!
w " MENU.rows(line).all[im-1].style.display='none';}",!
w "if ((id.charAt(0)=='o')&&(vi=='inline')) {",!
w " MENU.rows(line).all[im].style.display='none' ; ",!
w " MENU.rows(line).all[im-1].style.display='inline';}",!
;
;w "window.alert(id)",!
w "for (y=line+1; y<yMax; y++) {",!
w " o21=MENU.rows(y).getAttribute('VALUE');",!
w " if (o21.charAt(le)=='1') {MENU.rows(y).style.display='none';",!
w " im=MENU.rows(y).all.length-1 ; ",!
w " id=MENU.rows(y).all[im].getAttribute('id') ;",!
w " if (id.charAt(0)=='o') {",!
w " MENU.rows(y).all[im-1].style.display='inline'; ",!
w " MENU.rows(y).all[im].style.display='none';} ",!
w " }",!
w " if (o21.charAt(le)!='1') break;",!
w "}",!
w "if (vi=='inline') {yMax=0;}",!
;
w "for (y=line+1; y<yMax; y++) {",!
w " o21=MENU.rows(y).getAttribute('VALUE');",!
w " if (o21.charAt(le)!='1') break;",!
w " if ((o21.charAt(le)=='1')&&(o21.charAt(le+1)!='1')) "
w " {MENU.rows(y).style.display='inline';}",!
w "}"
w "} </SCRIPT>",!
;-------------------------------------------------------------
w "</HEAD>",!
w "<BODY bgcolor=#b6c4d5 >",! ;;onload='jsMXmenuStart()' >",!
d oxxxo
Q
T1menuA ; Example : conv some enother table to '^T1menu'
s %B=$c(254)
s o="" f n=1000:1000 s o=$o(^menu(o)) q:o="" d
. s ^T1menu(n)=%B_2_%B_%B_o_%B_%B_%B_"closed",oo=""
. f nn=100:100 s oo=$o(^menu(o,oo)) q:oo="" d
.. s ^T1menu(n+nn)=%B_1_%B_^menu(o,oo),%=$zr
.. i nn=100 s $p(^T1menu(n),%B,5)=$p(^menu(o,oo),%B,3)
.. s f=$p(^menu(o,oo),%B,2) q:f=""
.. i $d(^AL(f)) s $p(@%,%B,5)=$g(^AL(f,"NAME"))
Q
mxMENU ; create frame 'QQMENU'
d:'$d(^T1menu) T1menuA
w "<table id=MENU border=0 cellpadding=0 cellspacing=0 >",!
s o="" f n=0:1 s o=$o(^T1menu(o)) q:o="" s oo=^(o) d
. w:n#9=0 "<SCRIPT> </SCRIPT>",!
. s o21=$p(oo,%B,2),mo=$p(oo,%B,3),mtxt=$p(oo,%B,4),text=$p(oo,%B,5)
. s ref=$p(oo,%B,6),img=$p(oo,%B,7) s:"- "[text text=mo_" "_mtxt
. w "<tr title='",$$u^MX(text),"' value=",o21
. i o21[2 w " onclick=""jsMXmenu(",n,")""; "
. w " STYLE=""cursor: hand; "
. w:$e(o21)=1 " display:none; "
. w " font: icon; "
. w " margin: 0; padding: 0; border-width: 0; "
. w " overflow: hidden; color:#112299; "
. w " "" ><td VALIGN=TOP nowrap >" ;;;;;;;;;;;;;
.f o1=1:1:$l(o21) i $e(o21,o1)=1 s oo21=$o(^T1menu(o)) d
.. i $e(o21,o1+1)=1 w "<img src='menu_bar.gif'>" q
.. i oo21'="" s oo21=$p(^(oo21),%B,2)
.. i o21=oo21 w "<img src='menu_tee.gif'>"
.. else w "<img src='menu_corner.gif'>"
.d
.. i img["closed" d q
... w "<img id=c",n," src='menu_folder_closed.gif'>"
... w "<img id=o",n," src='menu_folder_open.gif' "
... w " STYLE='display:none;'>"
.. i $l(img)<3 w "<img id=i",n," src='menu_link_ie.gif'>" q
.. w "<img id=i",n," src='",img,"'>"
. ;
.s x=" w """_n_"""",b=" -- ",tt="b,o21,b,mtxt,b,text,b,ref,b,img"
.f nn=1:1:$l(tt,",") s x=x_","""_$$u^MX(@($p(tt,",",nn)))_""""
.d
.. i $l(ref)>2 w "<a href='",ref,"' >",$$u^MX(text)," </a>" q
.. i o21_.2[2.2 w mtxt," ",$$u^MX(text) q
.. w "<a href='XX^MX?&A=",x," ;' target=QQCOMM >",$$u^MX(text)," </a>"
.w "</td></tr>",!
w "</table>"
Q
QQFORM ; TKWEB ; frame of forms
s oooo=$g(%("COMMAND")),a=$g(%("ADDRESS")) s:'$l(a) (a,%("ADDRESS"))="127.0.0.1" s %USID=^o(a)
s oxxxo=$p(oooo,"&A=",2,99) s:oxxxo="" oxxxo=" k %XD81 i $$d8^MXD "
W "<HTML>"
d getVars
;w "<META http-equiv=""Content-Type"" content=""text/html; charset=windows-1257"">",!
w "<HEAD><TITLE>mx-QQFORM</TITLE></HEAD>",!
W "<BODY alink=#437a70 bgcolor=#b6c4d5 leftmargin=0 link=#7d354b marginheight=2 marginwidth=0 text=#222222 topmargin=2 vlink=""#7d354b"" xxOnLoad=xOnLoad()>",!
W "<table border=0 valign=top cellpadding=0 cellspacing=0 width=542 height=425 style=""position: absolute; left: 44; top: 168"">",!
W "<tr valign=top> ",!
W "<td align=center height=61 width=500 > ",!
W "<p><b><font color=""#5B7693""><font face=""Britannic Bold"" size=""7""> - mxWeb - </font>",!
W "<font color=#5B7693><br><font size=5 >",$$u^MX($g(^mvars(%USID,0,"%FIRMA"))),"</font></td></tr></table>",!
;;;
;W "<tr><td valign=top align=center width=55 height=25 ><b>UserName </b></td>",!
W "<table border=1 valign=top cellpadding=0 cellspacing=0 style=""position: absolute; left: 155; top: 268"">",!
W "<tr><td valign=top align=center width=55 height=25 style=""align: right "" ><b>UserName </b></td>",!
W "<td valign=top width=211 height=25 > ",!
W "<input type=text size=26 maxlength=30 name=UserName tabindex=1 value=CASIO ></td></tr>",!
W "<tr><td valign=top align=center width=55 height=25 ><b>Password </b></td>",!
W "<td valign=top width=211 height=25 > ",!
W "<input type=password size=26 maxlength=25 name=Password tabindex=2 value=CASIO ></td></tr>",!
W "<tr><td></td><td align=left height=45 width=211> ",!
W "<p align=left> ",!
W " <input type=image src=""login.gif"" width=93 height=22 border=0 ></td></tr></table>",!
d oxxxo
Q
QQCOMM ; TKWEB ; frame of comments
s oooo=$g(%("COMMAND")),a=$g(%("ADDRESS")) s:'$l(a) (a,%("ADDRESS"))="127.0.0.1" s %USID=^o(a)
s oxxxo=$p(oooo,"&A=",2,99)
W "<HTML>"
;w "<META http-equiv=""Content-Type"" content=""text/html; charset=windows-1257"">",!
w "<HEAD><TITLE>mx-QQCOMM</TITLE></HEAD><BODY>",!
d oxxxo
Q
XX ; TKWEB ; execut &A=oxxxo
s oooo=$g(%("COMMAND")),a=$g(%("ADDRESS")) s:'$l(a) (a,%("ADDRESS"))="127.0.0.1" s %USID=^o(a)
s oxxxo=$p(oooo,"&A=",2,99)
W "<HTML><HEAD><TITLE>mx-XX</TITLE></HEAD><BODY>",!
d oxxxo
q
oxxxo ; ; execut &A=oxxxo
n (%USID,oxxxo,%) s %j=7,^o("oxxxo")=oxxxo
i oxxxo'[";!fast!;" s %=$$RestMem^USX,oxxxo=$g(^o("oxxxo"))
d getVars
i oxxxo'[";/:\;" x oxxxo i 1
else f zxxxo=1:1:$l(oxxxo,";/:\;") s o=$p(oxxxo,";/:\;",zxxxo) x o
i $g(oxxxo)'[";!fast!;",$g(oxxxo)'[";!rest!;",$$SaveMem^USX
w "</BODY></HTML>"
Q
getVars ; get m-vars from enother frames
n o,oo
s oo="" f s oo=$o(%("FORM",oo)) q:oo="" i oo["_t" d
. s o=$p(oo,"_") i $l(o) s ^mvars(%USID,0,o)=%("FORM",oo)
Q
bfRead(f)
; binary files reading
n o,x o "file":(f:"RI") k ^r
f o=1:1 u "file" r *x q:$zc s ^(o\20)=$g(^r(f,o\20))_","_x
c "file" q o
QQEMPT ; TKWEB ; empty page
W "<html><body bgcolor=#b6c4d5>" x "s %UCI=$zu($zv[""Ca""*5)"
w "<p align=center>",$$d8t^MXD($$pD^MXD($h))," ",%UCI," ",$zv,"</p></body></html>"
Q
MXTKWEB ; TKWEB ; frame of ^oTQMret(%USID) --> ^|"%SYS"|omxTKWEB(%mxTKWEB)
;;;s oooo=$g(%("COMMAND")),a=$g(%("ADDRESS")),%USID=^o(a)
;;;s oxxxo=$p(oooo,"&A=",2,99) s:oxxxo="" oxxxo=" k %XD81 i $$d8^MXD "
s %mxTKWEB=1 s ^oMonito($h)=$g(oxxxo)_$g(%mxTKWEB)
s nuf=$g(^oe(%mxTKWEB)),y="",w="" f o="YY","XX" s @o=$g(^oExcelSh(nuf,o))
s %UCI=$p(nuf,":"),%USID=$p(nuf,":",2),%FORM=$p(nuf,":",3)
f %=1:1:$l(XX," ") s o=$p(XX," ",%),$p(w,":",+o)=$p(o,":",2)
f %=1:1:$l(w,":") s o=$p(w,":",%) s:o $p(w,":",%)=o*1.4\1 s:'$l(o) $p(w,":",%)=$p(w,":",%-1)
f %=1:1:$l(YY," ") s o=$p(YY," ",%),$p(y,":",+o)=$p(o,":",2),$p(y,":",+o)=($p(y,":",+o)\1)
;;f %=1:1:$l(y,":")+99 s o=$p(y,":",%) s:o $p(y,":",%)=o*1 s:'$l(o) $p(y,":",%)=$p(y,":",%-1)
W "<HTML>"
;;d getVars
;w "<META http-equiv=""Content-Type"" content=""text/html; charset=windows-1257"">",!
w "<HEAD><TITLE>-mx-oTQMret-oTKW-</TITLE></HEAD>"
W "<BODY alink=#437a70 bgcolor=#b6c4d5 leftmargin=0 link=#7d354b marginheight=1 marginwidth=0 text=#222222 topmargin=2 vlink=""#7d354b"" xxOnLoad=xOnLoad()>"
;;w y
W "<table border=0 valign=top cellpadding=0 cellspacing=0 >"
W "<tr valign=top> "
W "<td align=center height=6 width=500 > "
;W "<p><b><font color=""#5B7693""><font face=""Britannic Bold"" size=""3"">mxWeb "_$g(%ns)_" "_$g(%USID)_" "_$g(%FORM) ;;_" </font>",!
W "<p><b><font color=""#5B7693"">",nuf," %UCI=",%UCI," </font>"
;;W "<font color=#5B7693><br><font size=5 >",$$u^MX($g(^mvars(%USID,0,"%FIRMA"))),"</font></td></tr></table>",!
;;;
;W "<tr><td valign=top align=center width=55 height=25 ><b>UserName </b></td>",!
;;;W "<table border=1 valign=top cellpadding=0 cellspacing=0 style=""position: absolute; left: 155; top: 268"">",!
;;;W "<tr><td valign=top align=center width=55 height=25 style=""align: right "" ><b>UserName </b></td>",!
;;;W "<td valign=top width=211 height=25 > ",!
;;;W "<input type=text size=26 maxlength=30 name=UserName tabindex=1 value=CASIO ></td></tr>",!
;;;W "<tr><td valign=top align=center width=55 height=25 ><b>Password </b></td>",!
;;;W "<td valign=top width=211 height=25 > ",!
;;;W "<input type=password size=26 maxlength=25 name=Password tabindex=2 value=CASIO ></td></tr>",!
;;;W "<tr><td></td><td align=left height=45 width=211> ",!
;;;W "<p align=left> ",!
;W " <input type=image src=""c:/mx/lamxxxer.gif"" width=55 height=22 border=0 ></td></tr></table>"
;;;d oxxxo
;;;W "<table border=1 valign=top cellpadding=0 cellspacing=0 style=""position: absolute; left: 155; top: 268"">",!
W "<table border=0 valign=top cellpadding=0 cellspacing=1 <font color=""#2B3633"" size=1 /font> >"
k flagTabl s %YXy=0,flagTabl=0,yy=10,h=1,y2=0,%YXxm=0,%th=0
f %2yy=1:1:99 s %YXy=$o(^oe(nuf,%YXy)),y2='flagTabl+y2 q:'%YXy q:'$o(^oe(nuf,%YXy,2)) d:00 MXTKWEBt s ww=11,%=$p(y,":",y2) s:%="" %=h s h=% i h f %YXx=2:1 s:'$o(^oe(nuf,%YXy,%YXx-.1)) %YXx=0 d:%YXx i '%YXx w "</tr>" s yy=yy+h+5+(''flagTabl*2) q
. i %YXx=2 s %0=$g(^oe(nuf,%YXy,0)) s:%0 %th=0,flagTabl=%0 i '%th,'%0,$g(^oe(nuf,%YXy+3,0))+$g(^oe(nuf,%YXy+4,0)) s %th=1 d MXTKWEBt
. i %YXx=2,flagTabl,'%0 k flagTabl s flagTabl=0 w "</table><table border=0 valign=top cellpadding=0 cellspacing=0 ><tr>"
. i %YXx=2 w "<tr>" ;;,"<td>",%th,"</td>","<td>",flagTabl,"</td>","<td>",%0,"</td>"
. q:'$p(w,":",%YXx) s oo=$g(^(%YXx)) w:oo["$$B " $$ooB(oo) s:"?"[$e(oo) oo="" s:%YXx>%YXx %YXxm=%YXx
. i flagTabl,oo=0!(oo&$p(oo,".",2)),%YXx>3 s oo=$j(oo,0,2),flagTabl(%YXx)=2 s:'oo oo=""
. i $g(flagTabl(%YXx))=2,oo=0!oo s oo=$j(oo,0,2) s:'oo oo=""
. s a=" " i %YXx>3&oo!$g(flagTabl(%YXx)) s a=" align=right "
. s cc=" " i a=" ",$l(oo)>2,%th,$g(^oe(nuf,%YXy,%YXx+1))="" s cc=" COLSPAN=2 "
. s o="""#3B5673"" size=2" s:$e(oo)="=" o="""#2B2623"" size=2",oo=$$funExcel(oo) s font="<font color="_o_" /font>"
. ;;w "<td wrap height="_(h+5)_" style=""position: absolute; height: "_(h+5)_"; width:"_$p(w,":",%YXx)_"; left:"_ww_"; top:"_yy_""" "_a_cc_$$MXTKWEBf(.oo)_" >"_font_"<NOBR>",$$u^MX($e(" "_oo_" ",1,50)),"</NOBR></td>"
. i %th w "<th BGCOLOR=""#a6b4c5"" width="_$p(w,":",%YXx)_" wrap height="_(h+5)_" "_a_cc_$$MXTKWEBf(.oo)_" >",font,$$u^MX(" "_oo_" "),"</th>"
. i '%th w "<td width="_$p(w,":",%YXx)_" wrap height="_(h+5)_" "_a_cc_$$MXTKWEBf(.oo)_" >",font,"<NOBR>",$$u^MX(" "_oo_" "),"</NOBR></td>"
. ;;w "<td style=""border-right: 1px solid gray; border-bottom: 1px solid gray;"" width="_$p(w,":",%YXx)_a_$$MXTKWEBf(.oo)_" ><font color=""#6B8693"" size=2 /font>",$$u^MX(" "_oo),"</td>"
. s ww=ww+$p(w,":",%YXx)+1
. i cc[2 s %YXx=%YXx+1
w "</table>"
d
.W "<table border=0 valign=top cellpadding=0 cellspacing=1 style=""font: size=1"" >"
.s %YXy=0,%YXxm=20
.f s %YXy=$o(^oe(nuf,%YXy)) q:'%YXy w "<tr><td>",%YXy,"</td>" f %YXx=0:1:%YXxm s oo=$g(^oe(nuf,%YXy,%YXx)) s:$e(oo)="?" oo="" w "<td>",font,$$u^MX(oo),"</td>" i %YXx=%YXxm w "</tr>"
.w "</table>"
.q
w "<table border=1><tr><td> UCI=",%UCI,"</td><td> %USID=",%USID,"</td><td> %mxForma=",%FORM,"</td><td> ",$$pD^MXD($H,2),"</td><td><input type=image src=""c:/mx/lamer.gif"" width=55 height=22 border=0 ></td></tr>"
w "</table>"
i $zv["Ca"!($zv["IRIS") x "s %fromUCI=$zu($zv[""Ca""*5)" i %fromUCI="%SYS" zn %UCI d zn %fromUCI
.n %UCI,%fromUCU x "s %UCI=$zu($zv[""Ca""!($zv[""IRIS"")*5)"
.W "<table border=1 valign=top cellpadding=0 cellspacing=1 style=""font: size=1"" >"
.s %form=0 w "<tr><td>",%UCI,"</td>"
.f s %form=$o(^oTKMe0(%USID,%form)) q:%form="" w "<td>",%UCI,":",%USID,":",%form,"</td>"
.w "</tr></table>"
.q
i $zv["Ca"!($zv["IRIS") x "s %fromUCI=$zu($zv[""Ca""*5)" i %fromUCI="%SYS" zn %UCI d zn %fromUCI
.s %mxForma=%FORM,%j=1,o=$$NewDate^MXD
.k ^oTQM(%USID) m ^oTQM(%USID)=^oTQMe0(%USID,%mxForma) s o=$$TQM^MXTQM()
.W "<table border=0 valign=top cellpadding=0 cellspacing=1 style=""font: size=1; color=green "" >"
.s %YXy=0,%YXxm=20
.f s %YXy=$o(^oTQMret(%USID,%YXy)) q:'%YXy w "<tr><td>",%YXy,"</td>" f %YXx=0:1:%YXxm s oo=$g(^oTQMret(%USID,%YXy,%YXx)) s:$e(oo)="?" oo="" w "<td>",font,$$u^MX(oo),"</td>" i %YXx=%YXxm w "</tr>"
.w "</table>"
.q
w "<a href='http://www.gismeteo.ru/towns/26406.htm'><img src='http://informer.gismeteo.ru/graph/G26406-1.GIF' border=0></a>"
w "</BODY></HTML>"
Q
MXTKWEBt s:$g(^oe(nuf,%YXy,1))="~" $p(y,":",%YXy)=0
;;s o=$g(^oe(nuf,%YXy+1,1)) i o-1,$o(^oe(nuf,%YXy))'["." q
;;i $g(^oe(nuf,%YXy,1))_$g(^oe(nuf,%YXy-1,1))="__" q
w "</table><table border=1 valign=top cellpadding=0 cellspacing=0 >" ;;s flagTabl=-%YXy
;;s o=$o(^oe(nuf,%YXy)) i o["." s flagTabl=$p(o,".",2)+2
;;w "</table>" W "<table style=""border-left: 1px solid black; border-top: 1px solid black;"" valign=top cellpadding=0 cellspacing=1 >" s flagTabl=%YXy
q
MXTKWEBf(oo)
q:oo'["<mx " "" s f=$p(oo,"<mx ",2,9),oo=$p(oo,"<mx ")
i $p(f,"ic",2) ;; w " BGCOLOR=""#b6d4d5"""
q ""
funExcel(oo,z,%y,%x)
n %,%1,%2,y1,y2,o,o9,y s o9="1234567890,:",%y=$g(%y,%YXy),%x=$g(%x,%YXx)
q:$e(oo)'="=" oo s:'$d(z) z=$name(^oe(nuf))
s %1=$p(oo,":"),%2=$p(oo,":",2),y1=$tr(%1,o9_%1,o9),y2=$tr(%2,o9_%2,o9)
s:oo["=SUBTOTAL(" y1=$p(y1,",",2) s y1=+y1,y2=+y2
i y1+1=y2,+$g(@z@(y2,0))=1 f %=y2:1 q:'$g(@z@(%,0)) s y2=%
i 11111_oo["1111=SUM(" f y=y1:1:y2 s oo=oo+$g(@z@(y,%x))
i 1_oo["1=SUBTOTAL(9," f y=y1:1:y2 s oo=oo+$g(@z@(y,%x))
i 1_oo["1=SUBTOTAL(3," f y=y1:1:y2 s oo=oo+''$l($g(@z@(y,%x)))
q:oo["." $j(oo,0,2) q oo
sysTKWEB(%) s %sys="MGR,MXM" s:$zv["Ca" %sys="USER" s:'$g(%) %=1
x "s %UCI=$zu($zv[""Ca""*5),nuf=%UCI_"":""_%USID_"":""_%mxForma"
k ^|%sys|oe(+%) m ^|%sys|oe(+%)=^oTQMe(%USID) s ^|%sys|oe(+%)=nuf
k ^|%sys|oe(nuf) m ^|%sys|oe(nuf)=^oTQMe(%USID)
k ^|%sys|oExcelSh(nuf) m ^|%sys|oExcelSh(nuf)=^oExcelSh(%USID,%mxForma)
q %
ooB(oo) q ""
w "<td><FORM width=5 height=4 NAME=""Form1"" ACTION="""_$$u^MX("//localhost.MXTKWEB^MX2:1")_""">"
; {1072}<INPUT TYPE="hidden" NAME="info" VALUE="{1047}{1072}{1087}{1080}{1089}{1100} {1074}{1072}{1073}{1072}{1085}{1102} {1085}{1072}{1072}{1074}{1086}{1089}{1082}{1088}{1077}{1089}{1077}{1085}{1100}{1077}">
;{1072} <INPUT TYPE="radio" NAME="sex" VALUE="Male" CHECKED> {1052}{1091}{1078}{1080}{1082}<BR>
; {1072}<INPUT TYPE="radio" NAME="sex" VALUE="Female"> {1041}{1072}{1073}{1072}<BR>
; {1072} {1048}{1084}{1103}:<BR>
; {1072}<INPUT TYPE="text" NAME="textfield" VALUE="{1042}{1072}{1089}{1103} {1055}{1091}{1087}{1082}{1080}{1085}" SIZE="30" MAXLENGTH="60"><BR>
; {1072} {1055}{1072}{1088}{1086}{1083}{1100}:<BR>
;{1072} <INPUT TYPE="password" WIDTH="10" NAME="passwd"><BR><BR>
w "<INPUT TYPE=""submit"" VALUE="" "" width=4 height=3 >"
w "</FORM></td>"
q ""
GTMLINK(port)
;Based on Socket Examples from [email protected]
; NO ^ROUTINE ENTRY
n ver
s:port="" port=8000
s ver=$e($zv,1,10)
i ver["GT.M" j START^%MLINK(port) q
i ver["Cache" j srv^%MLINK(port) q
QUIT
;
START(%ZNPort) ;Start the Server
;S %ZNPort=800
S %ZNDev="SCK$"_$J
O %ZNDev:(ZLISTEN=%ZNPort_":TCP":NODELIMITER:ATTACH="listener"):60:"SOCKET"
E Q
; USE fills $KEY with "BOUND|socket_handle|portnumber"
U %ZNDev
;
; Start listening, sets $KEY to "LISTENING|socket_handle|portnumber"
W /LISTEN(1)
;
; Wait for connection, $KEY will be "CONNECT|socket_handle|remote_ipaddress"
1
F D q:$KEY]""
. W /WAIT(60)
. I $KEY]"" Q
;
; Store the connection socket in local variable,
S %ZNSock=$piece($KEY,"|",2)
C %ZNDev:(SOCKET="listener") J START^GTMLINK ;close listener and start another GT.M Link to listen port
S $ZTRAP="GOTO ERROR^GTMLINK"
2 U %ZNDev:(SOCKET=%ZNSock)
W "glc_READY:",$c(0)
;
s qqnump=$j
x "s qW=##class(%Library.qWORD).%New()"
x "s qARM=##class(%Library.TqARM).%New()"
s qqlang=1
3 F D
. s %ZNData=$$GETDATA() q:%ZNData=""
. i %ZNData="" q
. q:%ZNData=$c(1)
. I %ZNData="glc_EXIT:" W "glc_DISCONNECTED:",$c(0) s ^tmplink("close",$j)=$h_"~EXIT" C %ZNDev H
. I $P(%ZNData,":",1)="glc_EXECUTE" D
.. W $c(1,2,3,4,5,6,7,8,9)
.. I %ZNData["getsessionid=1" k:$d(^%session($JOB)) ^%session($JOB) s ^%session($JOB)=$h
.. F %ZTemp=0:1:9 s %Var="P"_%ZTemp,@%Var=$p(%ZNData,$c(1),%ZTemp+2)
.. S %ZNCommand=$P($P(%ZNData,":",2,9999),$c(1),1)
.. S:%ZNCommand[($c(5)_"xmldata=1") %ZNCommand=$p(%ZNCommand,$c(5)_"xmldata=1",1)
.. S P9=""
.. X:%ZNData'["getsessionid=1" %ZNCommand
.. s:%ZNData["getsessionid=1" P0=$JOB
.. F %ZTemp=0:1:9 S %Var="P"_%ZTemp I '$D(@%Var) S @%Var=""
.. W "glc_EXRESPONSE:<registry>",P0,$C(1),P1,$C(1),P2,$C(1),P3,$C(1),P4,$C(1),P5,$C(1),P6,$C(1),P7,$C(1),P8,$C(1),P9,$c(1)
.. W $c(9,8,7,6,5,4,3,2,1)
s ^tmlink("close",$j)=$h
C $I
H
GETDATA()
n c,d,end,c1
S (d,end,c1,c)=""
d FINDST
f d q:end=1
.R *c:60 q:'$T
.S d=d_$C(c)
.S c1=c1_c
.s:c1[987654321 d=$p(d,$c(9,8,7,6,5,4,3,2,1),1),end=1
.q
s ^tmlink("open",$j)=d
q d
FINDST
n c,end,str
s (c,end,str)=""
f d q:end=1
.R *c:60 q:'$T
.q:(c<1)!(c>9)
.s str=str_c
.s:str[123456789 end=1
.q
q
ERROR
W $c(1,2,3,4,5,6,7,8,9)
F %ZTemp=0:1:9 S %Var="P"_%ZTemp I '$D(@%Var) S @%Var=""
s ^GTMERROR($j,$h)=$TR($ZSTATUS,$C(13,10),"")
U %ZNDev:(SOCKET=%ZNSock)
W "glc_ERROR:"_$TR($ZSTATUS,$C(13,10),""),$C(1),"<registry>",P0,$C(1),P1,$C(1),P2,$C(1),P3,$C(1),P4,$C(1),P5,$C(1),P6,$C(1),P7,$C(1),P8,$C(1),P9,$C(1),$c(9,8,7,6,5,4,3,2,1)
g 3
sererror
W $c(1,2,3,4,5,6,7,8,9)
F %ZTemp=0:1:9 S %Var="P"_%ZTemp I '$D(@%Var) S @%Var=""
s ^GTMERROR($j,$h)=$ZERROR
W "glc_ERROR:"_$zerror,$C(1),"<registry>",P0,$C(1),P1,$C(1),P2,$C(1),P3,$C(1),P4,$C(1),P5,$C(1),P6,$C(1),P7,$C(1),P8,$C(1),P9,$C(1),$c(9,8,7,6,5,4,3,2,1),*-3
g 4
srv(port)
n dev,mode,jobflag,id,end
S dev="|TCP|"_port
;; // 4 transfer to job open socket
s $zt="error"
S mode="AS"
s end=""
S jobflag=4
O dev:(:port:mode::32767:32767)
f d q:end=1
.U dev R x:30 ;; // wait connection
.i $T J srvj(port):(:jobflag:$IO:$IO):0 s end=1
.q
error
c dev
j srv^%MLINK(port)
q
srvj(port)
n id,in,d,str,dev
s $zt="sererror"
s d=""
W "glc_READY:"_$c(0),*-3
4 F D
. s %ZNData=$$GETDATA() q:%ZNData=""
. i %ZNData="" q
. q:%ZNData=$c(1)
. I %ZNData="glc_EXIT:" W "glc_DISCONNECTED:",$c(0) s ^tmplink("close",$j)=$h_"~EXIT" H
. I $P(%ZNData,":",1)="glc_EXECUTE" D
.. s value=""
.. W $c(1,2,3,4,5,6,7,8,9)
.. I %ZNData["getsessionid=1" k:$d(^%session($JOB)) ^%session($JOB) s ^%session($JOB)=$h
.. F %ZTemp=0:1:9 s %Var="P"_%ZTemp,@%Var=$p(%ZNData,$c(1),%ZTemp+2)
.. S %ZNCommand=$P($P(%ZNData,":",2,9999),$c(1),1)
.. S:%ZNCommand[($c(5)_"xmldata=1") %ZNCommand=$p(%ZNCommand,$c(5)_"xmldata=1",1)
.. s P9=""
.. ;; //s:($tr(%ZNCommand," ")'="")&(%ZNData'["getsessionid=1") %ZNCommand=$$GetFunc(%ZNCommand)
.. d:%ZNData'["getsessionid=1" Ex(.%ZNCommand)
.. i %ZNData'["getsessionid=1" s ^Aaa("com")=%ZNCommand x %ZNCommand
.. s:%ZNData["getsessionid=1" P0=$JOB
.. F %ZTemp=0:1:9 S %Var="P"_%ZTemp I '$D(@%Var) S @%Var=""
.. W "glc_EXRESPONSE:<registry>",value,$C(1),P0,$C(1),P1,$C(1),P2,$C(1),P3,$C(1),P4,$C(1),P5,$C(1),P6,$C(1),P7,$C(1),P8,$C(1),P9,$c(1)
.. W $c(9,8,7,6,5,4,3,2,1),*-3
..q
.q
Q
Ex(Cmd)
q:Cmd=""
f q:($e(Cmd)'=" ")!(Cmd="") s Cmd=$e(Cmd,2,32000)
q:Cmd=""
i $e(Cmd)="$" s Cmd="s value="_Cmd q
i $e(Cmd)="=" s Cmd="s value"_Cmd q
q
; //end// GT.M Link Server - by [email protected] ; Compiled April 3, 2007 11:16:22
;; {1052}{1086}{1078}{1085}{1086} {1074}{1099}{1082}{1080}{1085}{1091}{1090}{1100}
;; s{1072}qqnump=$j
;; s{1072}qW=##class(%Library.qWORD).%New()
;; s{1072}qARM=##class(%Library.TqARM).%New()
;; s{1072}qqlang=19
;; {1056}{1072}{1073}{1086}{1090}{1072}{1077}{1090} {1083}{1077}{1090} 15 {1087}{1086} cache {1080} GT.M
;; 123456789 - {1087}{1072}{1082}{1077}{1090} {1074}{1085}{1072}{1095}{1072}{1083}{1077} {1087}{1077}{1088}{1077}{1076}{1072}{1095}{1080}
;; 987654321 - {1074} {1082}{1086}{1085}{1094}{1077}
;; {1064}{1083}{1077}{1090} {1076}{1072}{1085}{1085}{1099}{1077} {1082}{1072}{1082} {1087}{1086}{1090}{1086}{1082}{1086}{1084} , {1090}{1072}{1082} {1080} {1090}{1080}{1087}{1072} {1087}{1086} {1082}{1086}{1084}{1072}{1085}{1076}{1077} {1072}{1085}{1072}{1083}{1086}{1075}{1072} VisM
;; {1054}{1090}{1076}{1077}{1083}{1100}{1085}{1086} {1084}{1086}{1078}{1085}{1086} {1087}{1077}{1088}{1077}{1076}{1072}{1074}{1072}{1090}{1100} {1080} {1087}{1086}{1083}{1091}{1095}{1072}{1090}{1100} {1088}{1077}{1075}{1080}{1089}{1090}{1088}{1099} {1086}{1090} P0 {1076}{1086} P9
MXD^INT^1^65819,47306^0
MXD ; [ 04/26/2006 6:08 PM ] ;[ 20210316 13:08:26 ]
; MSM, CACHE, IRIS, GT.M, MiniM
; vmx ( multi-user virtual EXCEL incorporated into the database )
; vmx Copyright(c) 2005-2020, SIA ENTERS, Latvia, Reg.Nr.42102022219
; registered by Agency INTELS, Riga, Latvia, reg.40003134156, on June 28, 2005, Nr.178
;
ts() q $$pD($h,2)
pD(%H,t) ;CONVERTS %H,$H TO ggggmmdd
i $e(%H,1,4)="^mM(" s %H=+$e(%H,5,99),%H=$tr($e(%H,1,$l(%H)-1),".",",")
n time,o s time=""
i $g(t) s o=$s(%H[".":".",1:","),time=+$e($p(%H,o,2),1,5) s:'time time="" d:time
.s time=" "_$e(time\3600+100,2,3)_":"_$e(time#3600\60+100,2,3)_":"_$e(time#60+100,2,3)
n %LY,%R,%Y,%D,%M,%I,%DAT1 s %H=$g(%H,$h)\1,%H=%H>21914+%H
S %LY=%H\1461,%R=%H#1461,%Y=%LY*4+1841+(%R\365),%D=%R#365,%M=1
I %R=1460,%LY'=14 S %D=365,%Y=%Y-1
F %I=31,(%R>1154)&(%LY'=14)+28,31,30,31,30,31,31,30,31,30 Q:%I'<%D d
.s %M=%M+1,%D=%D-%I
I %D=0 S %Y=%Y-1,%M=12,%D=31
q:$g(t)=-1 time q %Y_$e(100+%M,2,3)_$e(100+%D,2,3)_time
dmE(%d,%8)
i '$d(%d),@%N="-" q "-"
i +$g(%d)>2000 s %d=$tr(%d,1234567890_%d,1234567890),%d=$$dmg(%d)
n %2 s:$g(%d) %2=$p(%d," ",2,9),%d=$p(%d," ") s:'$d(%d) %2=$p(@%N," ",2,9)
n %o,% s:'$g(%8)&'$g(%d) %8="8+" s:+$g(%d)=8 %8=%d s:'$g(%8) %8=8
i $g(%d) s %d=$tr(%d,"-/{1102}123456780.9"_%d,"...123456780.9"),%o=$$dmg(%d,%8),%=$$d31(%o,%8) s:%'?8n %d=$$dmg(%o) q:'$l(%2) %d q %d_" "_%2
s @%N=$tr(@%N,"-/{1102}123456780.9"_@%N,"...123456780.9"),%o=$$dmg(@%N,%8),%=$$d31(%o,%8)
s:%'?8n %E=% s:%E="" (oo,@%N)=$$dmg(%o) s:$l($g(%2)) (oo,@%N)=oo_" "_%2
q @%N
gmd(d8,p2)
i $g(p2)=8,d8>999 q $e($tr(d8,1234567890_d8,1234567890),1,8)
i +d8?8n q $e(+d8,1,4)_"."_$e(+d8,5,6)_"."_$e(+d8,7,8)
q:'$d(p2) $$dmg(d8) q $$dmg(d8,p2)
mdg(d8,p2) q:+d8'?8n d8
q:$g(p2)'["/" $e(+d8,5,6)_"."_$e(+d8,7,8)_"."_$e(+d8,1,4) q $e(+d8,5,6)_"/"_$e(+d8,7,8)_"/"_$e(+d8,1,4)
q d8
dmg(d8,p2) s:$g(%LANG)="" %LANG="LV"
n o1,o2,o3,% s p2=$g(p2) s:d8<0 d8=$e(d8,2,99) q:'d8 d8 s:$p(d8,"/",2) d8=$tr(d8,"/",".")
s o1="janv{257}ris febru{257}ris marts apr{299}lis maijs j{363}nijs j{363}lijs augusts septembris oktobris novembris decembris"
s:%LANG["RU" o1="{1103}{1085}{1074}{1072}{1088}{1103} {1092}{1077}{1074}{1088}{1072}{1083}{1103} {1084}{1072}{1088}{1090}{1072} {1072}{1087}{1088}{1077}{1083}{1103} {1084}{1072}{1103} {1080}{1102}{1085}{1103} {1080}{1102}{1083}{1103} {1072}{1074}{1075}{1091}{1089}{1090}{1072} {1089}{1077}{1085}{1090}{1103}{1073}{1088}{1103} {1086}{1082}{1090}{1103}{1073}{1088}{1103} {1085}{1086}{1103}{1073}{1088}{1103} {1076}{1077}{1082}{1072}{1073}{1088}{1103}"
s:"DE"[%LANG o1="Januar Februar M{257}rz April Mai Juni Juli August September Oktober November Dezember"
s:"EN GB"[%LANG o1="January February March April May June July August September October November December"
s:%LANG="UA" o1="{1057}i{1095}{1077}{1085}{1100} {1051}{1102}{1090}{1080}{1081} {1041}{1077}{1088}{1077}{1079}{1077}{1085}{1100} {1050}{1074}i{1090}{1077}{1085}{1100} {1058}{1088}{1072}{1074}{1077}{1085}{1100} {1063}{1077}{1088}{1074}{1077}{1085}{1100} {1051}{1080}{1087}{1077}{1085}{1100} {1057}{1077}{1088}{1087}{1077}{1085}{1100} {1042}{1077}{1088}{1077}{1089}{1077}{1085}{1100} {1046}{1086}{1074}{1090}{1077}{1085}{1100} {1051}{1080}{1089}{1090}{1086}{1087}{1072}{1076} {1043}{1088}{1091}{1076}{1077}{1085}{1100}"
i '$g(p2) q:+d8?6n $e(d8,1,4)_".gada "_$p(o1," ",$e(d8,5,6))
I d8?8n,d8>19000000,d8<21110000 s:p2-8=0 %E=$$d31(d8,p2) q $e(d8,7,8)_"."_$e(d8,5,6)_"."_$e(d8,1,4)
i d8'["." q d8
i '$p(d8,".",3) s $p(d8,".",3)=$e($$d8,1,4)
s o1=$e(100+$p(d8,"."),2,3),o2=$e(100+$p(d8,".",2),2,3),o3=$p(d8,".",3),o3=$s(o3<100:o3+2000,1:o3)
i p2=8 s %=$$d31(o3_o2_o1,8) q:'$l(%) o3_o2_o1 q %
q o3_o2_o1
d8t(d8,mm)
n o1,o2 s:$g(%LANG)="" %LANG="LV"
s o1="janv{257}ris febru{257}ris marts apr{299}lis maijs j{363}nijs j{363}lijs augusts septembris oktobris novembris decembris"
s:%LANG["RU" o1="{1103}{1085}{1074}{1072}{1088}{1103} {1092}{1077}{1074}{1088}{1072}{1083}{1103} {1084}{1072}{1088}{1090}{1072} {1072}{1087}{1088}{1077}{1083}{1103} {1084}{1072}{1103} {1080}{1102}{1085}{1103} {1080}{1102}{1083}{1103} {1072}{1074}{1075}{1091}{1089}{1090}{1072} {1089}{1077}{1085}{1090}{1103}{1073}{1088}{1103} {1086}{1082}{1090}{1103}{1073}{1088}{1103} {1085}{1086}{1103}{1073}{1088}{1103} {1076}{1077}{1082}{1072}{1073}{1088}{1103}"
s:"DE"[%LANG o1="Januar Februar M{257}rz April Mai Juni Juli August September Oktober November Dezember"
i "EN GB"[%LANG s o1="January February March April May June July August September October November December" i d8?8n,"GB EN"[$g(mm) q $p(o1," ",$e(d8,5,6))_" "_$e(d8,7,8)_", "_$e(d8,1,4)
s mm=$g(mm,o1)
s:d8<0 d8=-d8 q:'d8 "" q:+d8?6n $e(d8,1,4)_".gada "_$p(mm," ",$e(d8,5,6))
I '$p(d8,"-",2),d8>0 q $e(d8,1,4)_".gada "_$e(d8,7,8)_"."_$p(mm," ",$e(d8,5,6))
s o1=$e(+d8,1,4)_".gada "_$e(+d8,7,8)_"."_$p(mm," ",$e(+d8,5,6)),o2=+$p(d8,"-",2)
q o1_" - "_$e(o2,1,4)_".gada "_$e(o2,7,8)_"."_$p(mm," ",$e(o2,5,6))
d8(d,d31,dBas)
s d=$g(d)
i d="",$g(%YXy),$g(%YXx) q:+$g(oYX(%YXy-1,%YXx-1))?8n +oYX(%YXy-1,%YXx-1) q:+$g(oYX(%YXy-1,%YXx))?8n +oYX(%YXy-1,%YXx)
i $l(d)>4!'d,+d'?8n q $$pD($h)
i +d?8n!'$d(dBas) q:$$d31(+d,$g(d31))'="" $$d31(+d,$g(d31)) q +d
s:+dBas'?8n dBas=$$pD($h+dBas) s:d<10 d=0_+d s:$l(d)=3&(d=+d) d=0_d s:$l(d)<5 d=$e(+dBas,1,8-$l(d))_d q:$$d31(d,8)'="" $$d31(d,8)
q d
d31(d,N,dmin)
q:'$g(N) 28+$e(3_($e(d,3,4)#4=0)_3232332323,$e(d,5,6)) s dmin=$g(dmin,19000101)
i N>1111 q:-d'[-N "ERROR: d="_+d_", is off range "_N s N=$l(+N)
i N<9,$l(+d)<N q:'d "enter date "_$e("ggggmmdd",1,+N) q "ERROR: d="_+d_", is too short, length must "_N
i N'["+",N<9,d>$e($$pD($h),1,$l(+d)),d>($g(%gm(1))_31),$g(%gm(1))?6n q "ERROR: d="_+d_" > {353}odien/today="_$$pD($h)
i d<dmin q "ERROR: "_+d_" < "_dmin
i d>20990101 q "ERROR: "_+d_" > 20990101"
i N>5,$e(d,5,6)<1!($e(d,5,6)>12) q "ERROR: d="_+d_", MONTH="_$e(d,1,6)
i N>7,$e(d,7,8)=33,mxConfig[":ggggmm33:" q ""
i N>7,$e(d,5,6)=12,$e(d,7,8)>31,$e(d,7,8)<35 q "" ;;;;;;;;;;;;; mxConfig[":ggggmm33:"
i N>7,($e(d,7,8)<1&(mxConfig'[":ggggmm00:"))!($e(d,7,8)>(28+$e(3_($e(d,3,4)#4=0)_3232332323,$e(d,5,6)))) q "ERROR: DAY="_$e(d,1,8)
q ""
dmgCheck(d,dMin)
n %,d0 s d0=d s:$g(dMin)?4n dMin=dMin_"0101"
g:d?8n dmgChecE s d=$tr(d,"/ \{1102}.1234567890"_d,".....1234567890")