-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.php
458 lines (457 loc) · 17.3 KB
/
script.php
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
<?php
include("config/local.php");
$i = mysql_connect ($mysql_host,$mysql_user,$mysql_password); $e=mysql_select_db ($mysql_db_name);
$arend_num=0; $korp_num=0; $energy_num=0; $object_num=0;
//--------------------------------------------------------------------
// ïîëó÷àåì îáùåå êîëè÷åñòâî àðåíäàòîðîâ, ýíåðãîðóñóðñîâ è êîðïóñîâ ñèñòåìû
$query = 'SELECT caption FROM buyers';
$e = mysql_query ($query,$i); $ui = mysql_fetch_row ($e);
for ($z=1;$z<=1200;$z++)
{
$ui = mysql_fetch_row ($e);
if ($ui == true) $arend_num++;
}
$query = 'SELECT * FROM korp';
$e = mysql_query ($query,$i); $ui = mysql_fetch_row ($e);
for ($z=1;$z<=1200;$z++)
{
$ui = mysql_fetch_row ($e);
if ($ui == true) $korp_num++;
}
$query = 'SELECT * FROM energy_supply';
$e = mysql_query ($query,$i); $ui = mysql_fetch_row ($e);
for ($z=1;$z<=1200;$z++)
{
$ui = mysql_fetch_row ($e);
if ($ui == true) $energy_num++;
}
$query = 'SELECT * FROM obj';
$e = mysql_query ($query,$i); $ui = mysql_fetch_row ($e);
for ($z=1;$z<=2000;$z++)
{
$ui = mysql_fetch_row ($e);
if ($ui == true) $object_num++;
}
print '<b>Èñõîäíûå äàííûå</b><br>';
print 'Àðåíäàòîðîâ: '; print $arend_num; print '<br>';
print 'Êîðïóñîâ: '; print $korp_num; print '<br>';
print 'Ýíåðãîðåñóðñîâ: '; print $energy_num; print '<br>';
print 'Îáúåêòîâ: '; print $object_num; print '<br>';
//--------------------------------------------------------------------
$rs_temp=0; // ðàñ÷åòíàÿ òåìïåðàòóðà äëÿ õîëîäíîãî âðåìåíè ãîäà
$cold=0; // ïðîäîëæèòåëüíîñòü îòîïèòåëüíîãî ïåðèîäà
$gradusdays=0; // ãðàäóñîñóòêè îòîïèòåëüíîãî ïåðèîäà
$period=0; // ïðîäîëæèòåëüíîñòü îòîïèòåëüíîãî ïåðèîäà
$Rtepl=0; // ïðèâåäåííîå ñîïðîòèâëåíèå òåïëîïåðåäà÷å îãðàæäàþùèõ êîíñòðóêöèé
$Qpot[0]=0; // ïîòåðè òåïëîòû ÷åðåç îãðàæäàþùèå êîíñòðóêöèè ïîìåùåíèé
$Qras[0]=0; // ðàñ÷åò òåïëîâîãî ïîòîêà è ðàñõîäà òåïëîíîñèòåëÿ
$Qvoda[0]=0; // ðàñ÷åòíîå ïîòðåáëåíèå òåïëà
$Qtepl[0]=0; // ðàñ÷åòíîå ïîòðåáëåíèå òåïëà
$Qpara[0]=0; // ðàñ÷åòíîå ïîòðåáëåíèå ïàðà, âîçäóõà, ãàçà è êèñëîðîäà
$Qelec[0]=0; // ðàñ÷åòíîå ïîòðåáëåíèå ýëåêòðè÷åñòâà
$QT=0; // ñóììàðíîå ðàñ÷åòíîå ïîòðåáëåíèå òåïëà
$QV=0; // ñóììàðíîå ðàñ÷åòíîå ïîòðåáëåíèå âîäû
$QP=0; // ñóììàðíîå ðàñ÷åòíîå ïîòðåáëåíèå ïàðà, âîçäóõà, ãàçà è êèñëîðîäà
$QE=0; // ñóììàðíîå ðàñ÷åòíîå ïîòðåáëåíèå ýëåêòðè÷åñòâà
$QTkor=0; // ñóììàðíîå ðàñ÷åòíîå ïîòðåáëåíèå òåïëà êîðïóñîì
$QVkor=0; // ñóììàðíîå ðàñ÷åòíîå ïîòðåáëåíèå âîäû êîðïóñîì
$QPkor=0; // ñóììàðíîå ðàñ÷åòíîå ïîòðåáëåíèå ïàðà, âîçäóõà, ãàçà è êèñëîðîäà êîðïóñîì
$QEkor=0; // ñóììàðíîå ðàñ÷åòíîå ïîòðåáëåíèå ýëåêòðè÷åñòâà êîðïóñîì
$QTk[0]=0; // ñóììàðíîå ðàñ÷åòíîå ïîòðåáëåíèå òåïëà êîðïóñàìè (ìàññèâ)
$QVk[0]=0; // ñóììàðíîå ðàñ÷åòíîå ïîòðåáëåíèå âîäû êîðïóñàìè (ìàññèâ)
$QPk[0]=0; // ñóììàðíîå ðàñ÷åòíîå ïîòðåáëåíèå ïàðà, âîçäóõà, ãàçà è êèñëîðîäà êîðïóñîì êîðïóñàìè (ìàññèâ)
$QEk[0]=0; // ñóììàðíîå ðàñ÷åòíîå ïîòðåáëåíèå ýëåêòðè÷åñòâà êîðïóñàìè (ìàññèâ)
//--------------------------------------------------------------------
//$query = 'SELECT rs_temp,cold_period FROM territory';
//$e = mysql_query ($query,$i); $ui = mysql_fetch_row ($e);
//for ($z=1;$z<=10;$z++)
//{
// $ui = mysql_fetch_row ($e);
// if ($ui == true)
// {
// $rs_temp=$ui[0];
// $cold=$ui[1];
// }
//}
//print 'Òåìïåðàòóðà çèìîé: '; print $rs_temp; print '<br>';
//print 'Ïðîäîëæèòåëüíîñòü îòîïèòåëüíîãî ïåðèîäà: '; print $cold; print '<br>';
//print '<hr>';
//-------------------------------------------------------
$query = 'SELECT * FROM energy_supply';
$e = mysql_query ($query,$i);
for ($z=1;$z<=100;$z++)
{
$ui = mysql_fetch_row ($e);
if ($ui == true)
{
//-------------------------------------------------------
if ($ui[2]=='1') // òåïëî è òåïëîôèêàöèîííàÿ âîäà
{
print '<h2>Òåïëî </h2>';
// Îáùåå ïîòðåáëåíèå òåïëà
// Äëÿ êàæäîãî îáúåêòà òèïà ïîìåùåíèå
$index=0;
$query = 'SELECT * FROM obj WHERE type=2';
$r = mysql_query ($query,$i);
for ($x=1;$x<=12000;$x++)
{
$uo = mysql_fetch_row ($r);
if ($uo == true)
{
include("eval/objects.php");
include("eval/teplo.php");
$Qtepl[$index]=$Qras[$index];
if ($Qtepl[$index]<0) $Qtepl[$index]=0;
$QT=$QT+$Qtepl[$index];
print '<b>'; print $uo[1]; print '</b>'; print ' Q='; print $Qtepl[$index]; print '(Qras='; print $Qras[$index]; print ',Qpot='; print $Qpot[$index]; print ')<br>';
$index++;
}
}
print 'Îáùåå ïîòðåáëåíèå òåïëà: <b>'; print $QT; print '</b>';
//-------------------------------------------------------
// Îáùåå ïîòðåáëåíèå òåïëà ïî êîðïóñàì
$index_korp=0;
$query = 'SELECT * FROM korp';
$t = mysql_query ($query,$i);
for ($c=1;$c<=100;$c++)
{
$up = mysql_fetch_row ($t);
if ($up == true)
{
// Äëÿ êàæäîãî îáúåêòà òèïà ïîìåùåíèå, ïðèíàäëåæàùèõ êîðïóñó
$index=0; $QTkor=0;
$query = 'SELECT * FROM obj WHERE type=2 AND idkorp=\''.$up[1].'\'';
$r = mysql_query ($query,$i);
for ($x=1;$x<=12000;$x++)
{
$uo = mysql_fetch_row ($r);
if ($uo == true)
{
include("eval/objects.php");
include("eval/teplo.php");
$Qtepl[$index]=$Qras[$index];
$QTkor=$QTkor+$Qtepl[$index];
$index++;
}
}
$QTk[$index_korp]=$QTkor;
print '<br>Îáùåå ïîòðåáëåíèå ïî <b>'; print $up[2]; print '</b>: '; print $QTkor;
// Äëÿ êàæäîãî îáúåêòà òèïà ïîìåùåíèå, ïðèíàäëåæàùèõ êîðïóñó ñ÷èòàåì êîýôôèöèåíò
$index=0;
$query = 'SELECT id,name FROM obj WHERE type=\'2\' AND idkorp=\''.$up[1].'\'';
$r = mysql_query ($query,$i);
for ($x=1;$x<=12000;$x++)
{
$uo = mysql_fetch_row ($r);
if ($uo == true)
{
print '<br>'; print $uo[1]; print ' ('; print $Qtepl[$index]; print '/'; print $QTkor; print ')'; print ' K2 = ';
if ($QTkor>0) print $Qtepl[$index]/$QTkor; else print "0";
if ($QTkor>0) $query = 'UPDATE obj SET K1=\''.$Qtepl[$index]/$QTkor.'\',K2=\''.$Qtepl[$index]/$QTkor.'\' WHERE id=\''.$uo[0].'\'';
else $query = 'UPDATE obj SET K1=\'0\',K2=\'0\' WHERE id=\''.$uo[0].'\'';
$g = mysql_query ($query,$i);
$index++;
}
}
$index_korp++;
}
}
$index_korp=0;
print '<br><hr>';
$query = 'SELECT * FROM korp';
$t = mysql_query ($query,$i);
for ($c=1;$c<=100;$c++)
{
$up = mysql_fetch_row ($t);
if ($up == true)
{
// Äëÿ êàæäîãî îáúåêòà òèïà êîðïóñ
$query = 'SELECT * FROM objects WHERE type=\'1\' AND idkorp=\''.$up[1].'\'';
$r = mysql_query ($query,$i); $uo = mysql_fetch_row ($r);
if ($uo == true)
{
print '<b>'; print $uo[1]; print ' </b>K2 = '; print $QTk[$index_korp]/$QT; print '<br>';
$query = 'UPDATE objects SET K1=\''.$QTk[$index_korp]/$QT.'\',K2=\''.$QTk[$index_korp]/$QT.'\' WHERE id=\''.$uo[0].'\'';
$g = mysql_query ($query,$i);
}
}
$index_korp++;
}
}
//-------------------------------------------------------
if ($ui[2]=='2') // ïîæàðíî-ïèòüåâàÿ âîäà
{
print '<br><h2>ïîæàðíî-ïèòüåâàÿ âîäà: </h2>';
// Äëÿ êàæäîãî îáúåêòà òèïà ïîìåùåíèå èëè àãðåãàò
$index=0;
$query = 'SELECT * FROM obj WHERE type!=1';
$r = mysql_query ($query,$i);
for ($x=1;$x<=12000;$x++)
{
$uo = mysql_fetch_row ($r);
if ($uo == true)
{
include("eval/objects.php");
include("eval/voda.php");
$QV=$QV+$Qvoda[$index];
$index++;
}
}
print 'Îáùåå ïîòðåáëåíèå âîäû: '; print $QV;
//-------------------------------------------------------
// Îáùåå ïîòðåáëåíèå âîäû ïî êîðïóñàì
$index_korp=0;
$query = 'SELECT * FROM korp';
$t = mysql_query ($query,$i);
for ($c=1;$c<=100;$c++)
{
$up = mysql_fetch_row ($t);
if ($up == true)
{
// Äëÿ êàæäîãî îáúåêòà òèïà ïîìåùåíèå èëè àãðåãàò, ïðèíàäëåæàùèõ êîðïóñó
$index=0; $QVkor=0;
$query = 'SELECT * FROM obj WHERE type!=1 AND idkorp=\''.$up[1].'\'';
$r = mysql_query ($query,$i);
for ($x=1;$x<=12000;$x++)
{
$uo = mysql_fetch_row ($r);
if ($uo == true)
{
include("eval/objects.php");
include("eval/voda.php");
$QVkor=$QVkor+$Qvoda[$index];
$index++;
}
}
$QVk[$index_korp]=$QVkor;
print '<br>Îáùåå ïîòðåáëåíèå ïî <b>'; print $up[2]; print '</b>: '; print $QVkor;
// Äëÿ êàæäîãî îáúåêòà òèïà ïîìåùåíèå èëè àãðåãàò, ïðèíàäëåæàùèõ êîðïóñó ñ÷èòàåì êîýôôèöèåíò
$index=0;
$query = 'SELECT id,name FROM obj WHERE type!=1 AND idkorp=\''.$up[1].'\'';
$r = mysql_query ($query,$i);
for ($x=1;$x<=12000;$x++)
{
$uo = mysql_fetch_row ($r);
if ($uo == true)
{
print '<br>'; print $uo[1]; print ' ('; print $Qvoda[$index]; print '/'; print $QVkor; print ')'; print ' K2 = '; if ($QVkor>0) print $Qvoda[$index]/$QVkor; else print '0';
if ($QVkor>0) $query = 'UPDATE obj SET K3='.$Qvoda[$index]/$QVkor.' WHERE id='.$uo[0];
else $query = 'UPDATE obj SET K3=0 WHERE id='.$uo[0];
$g = mysql_query ($query,$i);
$index++;
}
}
$index_korp++;
}
}
$index_korp=0; print '<br><hr>';
$query = 'SELECT * FROM korp';
$t = mysql_query ($query,$i);
for ($c=1;$c<=100;$c++)
{
$up = mysql_fetch_row ($t);
if ($up == true)
{
// Äëÿ êàæäîãî îáúåêòà òèïà êîðïóñ
$query = 'SELECT * FROM obj WHERE type=\'1\' AND idkorp=\''.$up[1].'\'';
$r = mysql_query ($query,$i); $uo = mysql_fetch_row ($r);
if ($uo == true)
{
print '<b>'; print $uo[1]; print ' </b>K3 = '; print $QVk[$index_korp]/$QV; print '<br>';
$query = 'UPDATE obj SET K3='.$QVk[$index_korp]/$QV.' WHERE id=\''.$uo[0].'\'';
$g = mysql_query ($query,$i);
}
}
$index_korp++;
}
}
//-------------------------------------------------------
if ($ui[2]=='3' || $ui[2]=='4' || $ui[2]=='5' || $ui[2]=='6') // ïàð, âîçäóõ, ãàç è êèñëîðîä
{
print '<br><h2>Ïàð, âîçäóõ, ãàç è êèñëîðîä: </h2>';
$res=$ui[2];
// Äëÿ êàæäîãî îáúåêòà òèïà àãðåãàò
$index=0; $QP=0;
if ($res==3) $query = 'SELECT SUM(Qpara) FROM objects WHERE type=3 AND Qpara>0';
if ($res==4) $query = 'SELECT SUM(Qgaza) FROM obj WHERE type=3 AND Qgaza>0';
if ($res==5) $query = 'SELECT SUM(Qszh) FROM obj WHERE type=3 AND Qszh>0';
if ($res==6) $query = 'SELECT SUM(Qkisl) FROM obj WHERE type=3 AND Qkisl>0';
$r = mysql_query ($query,$i);
$uo = mysql_fetch_row ($r);
if ($uo == true)
{
include("eval/objects.php");
include("eval/par.php");
$QP=$QP+$Qpara[$index];
$index++;
}
if ($res==3) { print '<br>Îáùåå ïîòðåáëåíèå ïàðà: '; print $QP; }
if ($res==4) { print '<br>Îáùåå ïîòðåáëåíèå ãàçà: '; print $QP; }
if ($res==5) { print '<br>Îáùåå ïîòðåáëåíèå âîçäóõà: '; print $QP; }
if ($res==6) { print '<br>Îáùåå ïîòðåáëåíèå êèñëîðîäà: '; print $QP; }
//-------------------------------------------------------
// Îáùåå ïîòðåáëåíèå ïî êîðïóñàì
$index_korp=0;
$query = 'SELECT * FROM korp';
$t = mysql_query ($query,$i);
for ($c=1;$c<=100;$c++)
{
$up = mysql_fetch_row ($t);
if ($up == true)
{
// Äëÿ êàæäîãî îáúåêòà òèïà àãðåãàò, ïðèíàäëåæàùèõ êîðïóñó
$index=0; $QPkor=0;
if ($res==3) $query = 'SELECT SUM(Qpara) FROM objects WHERE type=3 AND idkorp=\''.$up[1].'\' AND Qpara>0';
if ($res==4) $query = 'SELECT SUM(Qgaza) FROM obj WHERE type=3 AND idkorp=\''.$up[1].'\' AND Qgaza>0';
if ($res==5) $query = 'SELECT SUM(Qszh) FROM obj WHERE type=3 AND idkorp=\''.$up[1].'\' AND Qszh>0';
if ($res==6) $query = 'SELECT SUM(Qkisl) FROM obj WHERE type=3 AND idkorp=\''.$up[1].'\' AND Qkisl>0';
$r = mysql_query ($query,$i);
$uo = mysql_fetch_row ($r);
if ($uo == true)
{
include("eval/objects.php");
include("eval/par.php");
$QPkor=$QPkor+$Qpara[$index];
}
$QPk[$index_korp]=$QPkor;
print '<br>Îáùåå ïîòðåáëåíèå ïî <b>'; print $up[2]; print '</b>: '; print $QPkor;
// Äëÿ êàæäîãî îáúåêòà òèïà àãðåãàò, ïðèíàäëåæàùèõ êîðïóñó ñ÷èòàåì êîýôôèöèåíò
$index=0;
if ($res==3) $query = 'SELECT id,name,Qpara FROM objects WHERE type=3 AND idkorp=\''.$up[1].'\' AND Qpara>0';
if ($res==4) $query = 'SELECT id,name,Qgaza FROM obj WHERE type=3 AND idkorp=\''.$up[1].'\' AND Qgaza>0';
if ($res==5) $query = 'SELECT id,name,Qszh FROM obj WHERE type=3 AND idkorp=\''.$up[1].'\' AND Qszh>0';
if ($res==6) $query = 'SELECT id,name,Qkisl FROM obj WHERE type=3 AND idkorp=\''.$up[1].'\' AND Qkisl>0';
$r = mysql_query ($query,$i);
for ($x=1;$x<=2000;$x++)
{
$uo = mysql_fetch_row ($r);
if ($uo == true)
{
print '<br>'; print $uo[1]; print ' ('; print $uo[2]; print '/'; print $QPkor; print ')';
if ($res==3) $query = 'UPDATE objects SET K4=\''.$uo[2]/$QPk[$index_korp].'\' WHERE id='.$uo[0];
if ($res==4) $query = 'UPDATE obj SET K5=\''.$uo[2]/$QPk[$index_korp].'\' WHERE id='.$uo[0];
if ($res==5) $query = 'UPDATE obj SET K6=\''.$uo[2]/$QPk[$index_korp].'\' WHERE id='.$uo[0];
if ($res==6) $query = 'UPDATE obj SET K7=\''.$uo[2]/$QPk[$index_korp].'\' WHERE id='.$uo[0];
$g = mysql_query ($query,$i);
$index++;
}
}
$index_korp++;
}
}
$index_korp=0;
$query = 'SELECT * FROM korp';
$t = mysql_query ($query,$i);
for ($c=1;$c<=100;$c++)
{
$up = mysql_fetch_row ($t);
if ($up == true)
{
// Äëÿ êàæäîãî îáúåêòà òèïà êîðïóñ
$query = 'SELECT * FROM objects WHERE type=1 AND idkorp=\''.$up[1].'\'';
$r = mysql_query ($query,$i); $uo = mysql_fetch_row ($r);
if ($uo == true)
{
if ($QP>0) $st=$QPk[$index_korp]/$QP; else $st=0;
print '<br><b>'; print $uo[1]; print ' </b>('; print $QPk[$index_korp]; print '/'; print $QP; print ')'; print ' K = '; print $st;
if ($res==3) $query = 'UPDATE objects SET K4=\''.$st.'\' WHERE id=\''.$uo[0].'\'';
if ($res==4) $query = 'UPDATE obj SET K5=\''.$st.'\' WHERE id=\''.$uo[0].'\'';
if ($res==5) $query = 'UPDATE obj SET K6=\''.$st.'\' WHERE id=\''.$uo[0].'\'';
if ($res==6) $query = 'UPDATE obj SET K7=\''.$st.'\' WHERE id='.$uo[0];
$g = mysql_query ($query,$i);
}
}
$index_korp++;
}
}
//-------------------------------------------------------
if ($ui[2]=='7') // ýëåêòðè÷åñòâî
{
print '<hr><br><h2>Ýëåêòðè÷åñòâî</h2>';
// Äëÿ êàæäîãî îáúåêòà òèïà ïîìåùåíèå èëè àãðåãàò
$index=0; $QE=0;
$query = 'SELECT * FROM objects WHERE type!=1';
$r = mysql_query ($query,$i);
for ($x=1;$x<=12000;$x++)
{
$uo = mysql_fetch_row ($r);
if ($uo == true)
{
include("eval/objects.php");
include("eval/elect.php");
$QE=$QE+$Qelec[$index];
$index++;
}
}
print 'Îáùåå ïîòðåáëåíèå ýëåêòðè÷åñòâà: '; print $QE;
//-------------------------------------------------------
// Îáùåå ïîòðåáëåíèå ýëåêòðè÷åñòâà ïî êîðïóñàì
$index_korp=0; $QEkor=0;
$query = 'SELECT * FROM korp';
$t = mysql_query ($query,$i);
for ($c=1;$c<=100;$c++)
{
$up = mysql_fetch_row ($t);
if ($up == true)
{
// Äëÿ êàæäîãî îáúåêòà òèïà ïîìåùåíèå èëè àãðåãàò, ïðèíàäëåæàùèõ êîðïóñó
$index=0; $QEkor=0;
$query = 'SELECT * FROM objects WHERE type!=1 AND idkorp=\''.$up[1].'\'';
$r = mysql_query ($query,$i);
for ($x=1;$x<=12000;$x++)
{
$uo = mysql_fetch_row ($r);
if ($uo == true)
{
include("eval/objects.php");
include("eval/elect.php");
$QEkor=$QEkor+$Qelec[$index];
$index++;
}
}
$QEk[$index_korp]=$QEkor;
print '<br>Îáùåå ïîòðåáëåíèå ïî êîðïóñó '; print $up[2]; print ': '; print $QEkor;
// Äëÿ êàæäîãî îáúåêòà òèïà ïîìåùåíèå èëè àãðåãàò, ïðèíàäëåæàùèõ êîðïóñó ñ÷èòàåì êîýôôèöèåíò
$index=0;
$query = 'SELECT id FROM objects WHERE type!=1 AND idkorp=\''.$up[1].'\'';
$r = mysql_query ($query,$i);
for ($x=1;$x<=12000;$x++)
{
$uo = mysql_fetch_row ($r);
if ($uo == true)
{
if ($QEkor>0) $st=$Qelec[$index]/$QEkor; else $st=0;
print '<br>'; print $uo[1]; print ' ('; print $Qelec[$index]; print '/'; print $QEkor; print ')'; print ' K2 = '; print $st;
$query = 'UPDATE objects SET K8=\''.$st.'\' WHERE id=\''.$uo[0].'\'';
$g = mysql_query ($query,$i);
$index++;
}
}
$index_korp++;
}
}
$index_korp=0;
$query = 'SELECT * FROM korp';
$t = mysql_query ($query,$i);
for ($c=1;$c<=100;$c++)
{
$up = mysql_fetch_row ($t);
if ($up == true)
{
// Äëÿ êàæäîãî îáúåêòà òèïà êîðïóñ
$query = 'SELECT * FROM objects WHERE type=\'1\' AND idkorp=\''.$up[1].'\'';
$r = mysql_query ($query,$i); $uo = mysql_fetch_row ($r);
if ($uo == true)
{
print '<br>'; print $uo[1]; print ' ('; print $QEk[$index_korp]; print '/'; print $QE; print ')'; print ' K8 = '; print $QEk[$index_korp]/$QE;
$query = 'UPDATE objects SET K8=\''.$QEk[$index_korp]/$QE.'\' WHERE id='.$uo[0];
$g = mysql_query ($query,$i);
}
}
$index_korp++;
}
}
//-------------------------------------------------------
}
}
?>