Алексей — различия между версиями
Материал из Фабиус wiki
Hisava (обсуждение | вклад) м |
Hisava (обсуждение | вклад) м |
||
Строка 1: | Строка 1: | ||
− | + | local _, sql, _2, fld, aa | |
− | + | local acp, data, flt | |
− | + | local ip, m, data, i, my | |
− | + | fld := ' _0,C,4; _1,N,5; _2,N,14,4; _3,C,60; ' | |
− | + | ip := { '20180101', '20180301' } | |
− | + | m := ( Year( StoD( ip[2] ) ) - Year( StoD( ip[1] ) ) ) * 12 + Month( StoD( ip[2] ) ) - Month( StoD( ip[1] ) ) | |
− | + | data := StoD( ip[1] ) | |
− | + | my := data | |
− | + | try | |
− | + | _ := CreateTmpFile( fld, '_', ~IsFreeDel := true ) | |
− | while !eof | + | _2 := CreateTmpFile( fld, '_2', ~IsFreeDel := true ) |
− | + | for i := 0 to m | |
− | + | try | |
+ | acp := OPENCHILDDOC( 'ACP', '1', ~ParentForm := "", ~IsCondition := false, ~Month := MONTH( my ), ~Year := YEAR( my ) ) | ||
+ | flt := [ KINDDOC = 'ACP' and LVLNUM = '1' AND (!("Д" $ DREFL2)) ] | ||
+ | ( acp )->( SETFILTER( flt ) ) | ||
+ | ( acp )->( REFRESH() ) | ||
+ | ( acp )->( DBGOTOP() ) | ||
+ | while !( acp )->( eof() ) | ||
+ | sql := [ Select KREFL2, KANAL2, "SUM" From DOCS] + RET_F_EXT( my ) + [ Where KINDDOC = 'RTH' and LVLNUM = '3' and CATTR10 <> 'Д' and ; | ||
+ | AMNT <> 0 and KREFL2 = 'R11 ' and ] + SQLFIELD( 'NDS_PRC ') + [ = 10 and EXTPARENT = '] + ( acp )->RGNUM + [' ] | ||
SimpleSql( [ Insert into ] + TmpFilePath( _2 ) + [( _0, _1, _2 ) ] + sql, OpdataPath ) // RTH3 | SimpleSql( [ Insert into ] + TmpFilePath( _2 ) + [( _0, _1, _2 ) ] + sql, OpdataPath ) // RTH3 | ||
− | sql := [ Select KREFL2, KANAL2, ] + SQLFIELD( 'NACSUM' ) + [ From DOCS] + RET_F_EXT() + [ Where KINDDOC = 'YTM' and | + | sql := [ Select KREFL2, KANAL2, ] + SQLFIELD( 'NACSUM' ) + [ From DOCS] + RET_F_EXT( my ) + [ Where KINDDOC = 'YTM' and LVLNUM = '2' and EXTPARENT = '] + ( acp )->RGNUM + [' and ] + SQLFIELD( 'NDSPRC ') + [ = 10 ] // YTM2 |
− | + | ||
SimpleSql( [ Insert into ] + TmpFilePath( _2 ) + [( _0, _1, _2 ) ] + sql, OpdataPath ) | SimpleSql( [ Insert into ] + TmpFilePath( _2 ) + [( _0, _1, _2 ) ] + sql, OpdataPath ) | ||
− | sql := [ Select KREFL2, KANAL2, "SUM" From DOCS] + RET_F_EXT() + [ Where KINDDOC = 'ACP' and LVLNUM = '3' and | + | sql := [ Select KREFL2, KANAL2, "SUM" From DOCS] + RET_F_EXT( my ) + [ Where KINDDOC = 'ACP' and LVLNUM = '3' and ] + SQLFIELD( 'NDSPRC ') + [ = 10 and PARENT = '] + ( acp )->RGNUM + [' ] // ACP3 |
− | + | ||
SimpleSql( [ Insert into ] + TmpFilePath( _2 ) + [( _0, _1, _2 ) ] + sql, OpdataPath ) | SimpleSql( [ Insert into ] + TmpFilePath( _2 ) + [( _0, _1, _2 ) ] + sql, OpdataPath ) | ||
− | DBSKIP() | + | ( acp )->( DBSKIP() ) |
+ | end | ||
+ | finally | ||
+ | CLOSEFORM( ( acp )->( GETFORM( GETAREA() ) ), true ) | ||
end | end | ||
+ | my := EOM( my ) + 1 | ||
+ | next | ||
+ | |||
sql := [ Select _0, _1, SUM( _2 ) From ] + TmpFilePath( _2 ) + [ Group by _0, _1 ] // _2 -> _ | sql := [ Select _0, _1, SUM( _2 ) From ] + TmpFilePath( _2 ) + [ Group by _0, _1 ] // _2 -> _ | ||
SimpleSql( [ Insert into ] + TmpFilePath( _ ) + [( _0, _1, _2 ) ] + sql, OpdataPath ) | SimpleSql( [ Insert into ] + TmpFilePath( _ ) + [( _0, _1, _2 ) ] + sql, OpdataPath ) | ||
− | + | // sql := [ Update _ Set _3 = Left( PNAME, 60 ) From ] + TmpFilePath( _ ) + [ _ ; | |
− | + | // left outer join R08 ON _1 = KOD Where _0 = 'R08 ' ] | |
+ | // sql := [ Update tt Set _3 = Left( PNAME, 60 ) From ] + TmpFilePath( _ ) + [ tt left outer join R08 ON _1 = KOD Where _0 = 'R08 ' ] | ||
+ | // SIMPLESQL( sql, reflispath ) | ||
− | + | ( _ )->( DBGOTOP() ) | |
+ | while !( _ )->( eof() ) | ||
+ | ( _ )->_3 := LEFT( REALNAME( ( _ )->_0, ( _ )->_1 ), 60 ) | ||
+ | ( _ )->( DBSKIP() ) | ||
+ | end | ||
@ | @ | ||
− | + | finally | |
− | + | CLOSETABLE( _2 ) | |
− | + | CLOSETABLE( _ ) | |
− | + | end | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
[mailto:support@sftserv.ru support@sftserv.ru] | [mailto:support@sftserv.ru support@sftserv.ru] |
Версия 20:42, 19 июля 2018
local _, sql, _2, fld, aa local acp, data, flt local ip, m, data, i, my fld := ' _0,C,4; _1,N,5; _2,N,14,4; _3,C,60; ' ip := { '20180101', '20180301' } m := ( Year( StoD( ip[2] ) ) - Year( StoD( ip[1] ) ) ) * 12 + Month( StoD( ip[2] ) ) - Month( StoD( ip[1] ) ) data := StoD( ip[1] ) my := data try
_ := CreateTmpFile( fld, '_', ~IsFreeDel := true ) _2 := CreateTmpFile( fld, '_2', ~IsFreeDel := true ) for i := 0 to m try acp := OPENCHILDDOC( 'ACP', '1', ~ParentForm := "", ~IsCondition := false, ~Month := MONTH( my ), ~Year := YEAR( my ) ) flt := [ KINDDOC = 'ACP' and LVLNUM = '1' AND (!("Д" $ DREFL2)) ] ( acp )->( SETFILTER( flt ) ) ( acp )->( REFRESH() ) ( acp )->( DBGOTOP() ) while !( acp )->( eof() ) sql := [ Select KREFL2, KANAL2, "SUM" From DOCS] + RET_F_EXT( my ) + [ Where KINDDOC = 'RTH' and LVLNUM = '3' and CATTR10 <> 'Д' and ; AMNT <> 0 and KREFL2 = 'R11 ' and ] + SQLFIELD( 'NDS_PRC ') + [ = 10 and EXTPARENT = '] + ( acp )->RGNUM + [' ] SimpleSql( [ Insert into ] + TmpFilePath( _2 ) + [( _0, _1, _2 ) ] + sql, OpdataPath ) // RTH3 sql := [ Select KREFL2, KANAL2, ] + SQLFIELD( 'NACSUM' ) + [ From DOCS] + RET_F_EXT( my ) + [ Where KINDDOC = 'YTM' and LVLNUM = '2' and EXTPARENT = '] + ( acp )->RGNUM + [' and ] + SQLFIELD( 'NDSPRC ') + [ = 10 ] // YTM2 SimpleSql( [ Insert into ] + TmpFilePath( _2 ) + [( _0, _1, _2 ) ] + sql, OpdataPath ) sql := [ Select KREFL2, KANAL2, "SUM" From DOCS] + RET_F_EXT( my ) + [ Where KINDDOC = 'ACP' and LVLNUM = '3' and ] + SQLFIELD( 'NDSPRC ') + [ = 10 and PARENT = '] + ( acp )->RGNUM + [' ] // ACP3 SimpleSql( [ Insert into ] + TmpFilePath( _2 ) + [( _0, _1, _2 ) ] + sql, OpdataPath ) ( acp )->( DBSKIP() ) end finally CLOSEFORM( ( acp )->( GETFORM( GETAREA() ) ), true ) end my := EOM( my ) + 1 next
sql := [ Select _0, _1, SUM( _2 ) From ] + TmpFilePath( _2 ) + [ Group by _0, _1 ] // _2 -> _ SimpleSql( [ Insert into ] + TmpFilePath( _ ) + [( _0, _1, _2 ) ] + sql, OpdataPath )
// sql := [ Update _ Set _3 = Left( PNAME, 60 ) From ] + TmpFilePath( _ ) + [ _ ; // left outer join R08 ON _1 = KOD Where _0 = 'R08 ' ] // sql := [ Update tt Set _3 = Left( PNAME, 60 ) From ] + TmpFilePath( _ ) + [ tt left outer join R08 ON _1 = KOD Where _0 = 'R08 ' ] // SIMPLESQL( sql, reflispath )
( _ )->( DBGOTOP() ) while !( _ )->( eof() ) ( _ )->_3 := LEFT( REALNAME( ( _ )->_0, ( _ )->_1 ), 60 ) ( _ )->( DBSKIP() ) end
@ finally
CLOSETABLE( _2 ) CLOSETABLE( _ )
end
Skype
alexey_veretennikov
Рабочий телефон
8 (495) 989-57-08 ( добавочный 05 )
Все права защищены
https://msk.yitservice.ru/
R217\\4.7.47.51:5050\data\fabius\opdata\dict.add
MAKER=Softs servicepath=\\server\vol1\service\db
192.168.234.32
raidex@yandex.ru
AdsSys - логин для словаря DICT.ADD
https://notepad-plus-plus.org/