Code: Select all
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 134
ClientWidth = 171
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object OraSession1: TOraSession
Options.Direct = True
Options.KeepDesignConnected = False
Username = 'test'
Server = '192.168.0.177:1522:TEST'
Connected = True
ConnectDialog = ConnectDialog1
Left = 24
Top = 16
EncryptedPassword = '8CFF92FF8BFF'
end
object ConnectDialog1: TConnectDialog
Caption = 'Connect'
ConnectButton = 'Connect'
CancelButton = 'Cancel'
Server.Caption = 'Server'
Server.Visible = True
Server.Order = 1
UserName.Caption = 'User Name'
UserName.Visible = True
UserName.Order = 2
Password.Caption = 'Password'
Password.Visible = True
Password.Order = 3
Home.Caption = 'Home Name'
Home.Visible = False
Home.Order = 0
Direct.Caption = 'Direct'
Direct.Visible = False
Direct.Order = 6
Schema.Caption = 'Schema'
Schema.Visible = False
Schema.Order = 4
Role.Caption = 'Connect Mode'
Role.Visible = False
Role.Order = 5
Left = 24
Top = 64
end
object OraQuery2: TOraQuery
Session = OraSession1
SQL.Strings = (
'select m.symbol mag_symbol, m.nazwa mag_nazwa, kon.nazwa_wlasna,' +
' count(distinct pm.pi_numer) ile_inw, '
' sum(decode(om.stoo_symbol, '#39'KI+'#39', om.wart_spz_net, 0)) csn_plus' +
', '
' sum(decode(om.stoo_symbol, '#39'KI-'#39', om.wart_spz_net, 0)) csn_minu' +
's, '
' sum(decode(om.stoo_symbol, '#39'KI+'#39', om.wart_spz_net, '#39'KI-'#39', -om.w' +
'art_spz_net, 0)) csn_saldo, '
' round '
' ( '
' sum '
' ( '
' decode '
' ( '
' m.typ_magazynu, '
' '#39'PSD-FRANCZYZA'#39', 0, '
' decode '
' ( '
' om.stoo_symbol, '
' '#39'KI+'#39', 0, '
' '#39'KI-'#39', 0, '
' om.wart_spz_net '
' ) '
' ) '
' ) '
' *k.tresc/100, 2 '
' ) dop_straty, '
' sum '
' ( '
' decode '
' ( '
' m.typ_magazynu, '
' '#39'PSD-FRANCZYZA'#39', 0, '
' decode '
' ( '
' om.stoo_symbol, '
' '#39'KI+'#39', 0, '
' '#39'KI-'#39', 0, '
' om.wart_spz_net '
' ) '
' ) '
' ) csn_obrot, '
' sum(decode(om.stoo_symbol, '#39'KI+'#39', om.ilosc_jme, 0)) ile_jme_plu' +
's, '
' sum(decode(om.stoo_symbol, '#39'KI-'#39', om.ilosc_jme, 0)) ile_jme_min' +
'us, '
' mp.ak_podmiot_odp, '
' decode(m.typ_magazynu, '#39'PSD-FRANCZYZA'#39', '#39'T'#39', '#39'N'#39') czy_franczyza' +
', '
' sum(decode(om.stoo_symbol, '#39'KI+'#39', 1, 0)) ile_plus, '
' sum(decode(om.stoo_symbol, '#39'KI-'#39', 1, 0)) ile_minus, '
' :BEGINNING data_od, :ENDING data_do, '#39'W TOKU'#39' status, '#39'N'#39' czy_z' +
'amkniete, '
' mp.kon_podmiot_odp '
' from slw_magazyny m '
' join '
' slw_mag_param mp '
' on (mp.symbol = m.symbol) '
' join '
' inw_plan_mag pm '
' on (pm.m_symbol = m.symbol) '
' join '
' mk_operacje_mag om '
' on (om.m_symbol = m.symbol) '
' join '
' mz_konfig k '
' on (k.param = '#39'INW_DOP_STRATY_PROC'#39') '
' join '
' kon_kontrahent kon '
' on (kon.numer_kontrahenta = mp.kon_podmiot_odp) '
' where m.czy_miejscowy = '#39'N'#39' '
' and pm.czy_rozl_wart = '#39'N'#39' '
' and om.data_oper_mag between :BEGINNING and :ENDING '
' and (pm.pi_numer, pm.m_symbol) in '
' ( '
' select distinct om_k.dokument_obcy, om_k.m_symbol '
' from mk_operacje_mag om_k '
' where om_k.data_oper_mag between :BEGINNING and :ENDING '
' and om_k.stoo_symbol in ('#39'KI-'#39', '#39'KI+'#39') '
' and om_k.dokument_obcy is not null '
' ) '
' group by m.symbol, m.nazwa, mp.kon_podmiot_odp, kon.nazwa_wlasn' +
'a, k.tresc, mp.ak_podmiot_odp, m.typ_magazynu')
NonBlocking = True
Left = 112
Top = 64
ParamData = <
item
DataType = ftDateTime
Name = 'BEGINNING'
ParamType = ptInput
Value = nil
end
item
DataType = ftDateTime
Name = 'ENDING'
ParamType = ptInput
Value = nil
end>
object OraQuery2MAG_SYMBOL: TStringField
FieldName = 'MAG_SYMBOL'
Required = True
Size = 3
end
object OraQuery2MAG_NAZWA: TStringField
FieldName = 'MAG_NAZWA'
Size = 40
end
object OraQuery2NAZWA_WLASNA: TStringField
FieldName = 'NAZWA_WLASNA'
end
object OraQuery2ILE_INW: TFloatField
FieldName = 'ILE_INW'
end
object OraQuery2CSN_PLUS: TFloatField
FieldName = 'CSN_PLUS'
end
object OraQuery2CSN_MINUS: TFloatField
FieldName = 'CSN_MINUS'
end
object OraQuery2CSN_SALDO: TFloatField
FieldName = 'CSN_SALDO'
end
object OraQuery2DOP_STRATY: TFloatField
FieldName = 'DOP_STRATY'
end
object OraQuery2CSN_OBROT: TFloatField
FieldName = 'CSN_OBROT'
end
object OraQuery2ILE_JME_PLUS: TFloatField
FieldName = 'ILE_JME_PLUS'
end
object OraQuery2ILE_JME_MINUS: TFloatField
FieldName = 'ILE_JME_MINUS'
end
object OraQuery2AK_PODMIOT_ODP: TFloatField
FieldName = 'AK_PODMIOT_ODP'
end
object OraQuery2CZY_FRANCZYZA: TStringField
FieldName = 'CZY_FRANCZYZA'
Size = 1
end
object OraQuery2ILE_PLUS: TFloatField
FieldName = 'ILE_PLUS'
end
object OraQuery2ILE_MINUS: TFloatField
FieldName = 'ILE_MINUS'
end
object OraQuery2STATUS: TStringField
FieldName = 'STATUS'
FixedChar = True
Size = 6
end
object OraQuery2CZY_ZAMKNIETE: TStringField
FieldName = 'CZY_ZAMKNIETE'
FixedChar = True
Size = 1
end
object OraQuery2KON_PODMIOT_ODP: TIntegerField
FieldName = 'KON_PODMIOT_ODP'
end
object OraQuery2DATA_OD: TDateTimeField
FieldName = 'DATA_OD'
end
object OraQuery2DATA_DO: TDateTimeField
FieldName = 'DATA_DO'
end
end
object OraQuery1: TOraQuery
Session = OraSession1
SQL.Strings = (
'select :PARAM TEST'
' from dual')
Left = 112
Top = 16
ParamData = <
item
DataType = ftDateTime
Name = 'PARAM'
ParamType = ptInput
Value = nil
end>
object OraQuery1TEST: TDateTimeField
FieldName = 'TEST'
end
end
end
Code: Select all
create table SLW_MAGAZYNY
(
SYMBOL VARCHAR2(3) NOT NULL ,
NAZWA VARCHAR2(40) ,
BLOKADA VARCHAR2(1) DEFAULT 'N',
CZY_KRAJOWY VARCHAR2(1) DEFAULT 'N' NOT NULL ,
POWIERZCHNIA_M2 NUMBER(8, 2) DEFAULT 0 NOT NULL ,
DZIENNY_KOSZT_M2 NUMBER(10, 2) DEFAULT 0 NOT NULL ,
WARIANT_ROZLICZEN VARCHAR2(10) DEFAULT 'FIFO' NOT NULL ,
TYP_MAGAZYNU VARCHAR2(13) ,
CZY_MIEJSCOWY VARCHAR2(1) DEFAULT 'T' NOT NULL ,
SKO_NAZWA VARCHAR2(5) NOT NULL ,
PRA_NR_IDENTYFIKACYJNY NUMBER(5, 0) DEFAULT 0 NOT NULL ,
AK_ID NUMBER(10, 0) DEFAULT 0 NOT NULL ,
SYSTEM VARCHAR2(1) DEFAULT 'N' NOT NULL ,
UTWORZONY_PRZEZ VARCHAR2(30) NOT NULL ,
DATA_UTWORZENIA DATE NOT NULL ,
MODYFIKOWANY_PRZEZ VARCHAR2(30) ,
DATA_MODYFIKACJI DATE ,
SKP_NAZWA VARCHAR2(10) ,
SRP_NAZWA VARCHAR2(10) ,
CYKL_DOSTAWY NUMBER DEFAULT 0 NOT NULL ,
PRIORYTET_OBSLUGI NUMBER ,
PODD_NUMER VARCHAR2(12) DEFAULT '0' NOT NULL ,
REP_EMAIL VARCHAR2(40) ,
ROCZNIK NUMBER(4, 0) DEFAULT 0 NOT NULL ,
DNI_PN CHAR(1) DEFAULT 'T' NOT NULL ,
DNI_WT CHAR(1) DEFAULT 'T' NOT NULL ,
DNI_SR CHAR(1) DEFAULT 'T' NOT NULL ,
DNI_CZ CHAR(1) DEFAULT 'T' NOT NULL ,
DNI_PT CHAR(1) DEFAULT 'T' NOT NULL ,
DNI_SO CHAR(1) DEFAULT 'T' NOT NULL ,
DNI_NI CHAR(1) DEFAULT 'T' NOT NULL ,
MIEJSCOWY_DLA_BAZY NUMBER(3, 0) ,
AK_ID_KOMIS NUMBER(10, 0) ,
SS_SYMBOL VARCHAR2(10) ,
TYP_CEN_SPRZ VARCHAR2(5) DEFAULT 'DETAL' NOT NULL ,
CZY_EKSPORTOWY VARCHAR2(1) DEFAULT 'N' NOT NULL ,
INFO_O_STANIE_TOWAROW VARCHAR2(15) DEFAULT 'NIE' NOT NULL ,
DATA_OST_ZAM_AUTO DATE ,
CZY_FRANCZYZ VARCHAR2(1) ,
UMOWA_FRANCZYZ VARCHAR2(16) ,
UMOWA_FRANCZYZ_OD DATE ,
SLW_GR_CENOWE VARCHAR2(3) DEFAULT 'STD',
S_WALUTA VARCHAR2(3) ,
CZY_EWID_KARTONY VARCHAR2(1) DEFAULT 'N' NOT NULL ,
CZY_TRNSF VARCHAR2(1) DEFAULT 'N' NOT NULL ,
ZAM_AUTO_RODZAJ NUMBER(3, 0) DEFAULT 0,
CZY_UE VARCHAR2(1) DEFAULT 'T' NOT NULL ,
CZY_WYMIANA_BAZA_REP VARCHAR2(1) DEFAULT 'N')
/
create table SLW_MAG_PARAM
(
SYMBOL VARCHAR2(3) NOT NULL ,
KAS_POZ_TYPU_B VARCHAR2(1) DEFAULT 'N' NOT NULL ,
POZ_TYP_B_BEZ_STANU VARCHAR2(1) DEFAULT 'N' NOT NULL ,
UTWORZONY_PRZEZ VARCHAR2(60) NOT NULL ,
MODYFIKOWANY_PRZEZ VARCHAR2(60) ,
DATA_UTWORZENIA DATE NOT NULL ,
DATA_MODYFIKACJI DATE ,
CZY_WYJATKI VARCHAR2(1) DEFAULT 'N' NOT NULL ,
WAL_SYMBOL VARCHAR2(3) DEFAULT 'PLN' NOT NULL ,
KRAJ_SYMBOL VARCHAR2(40) DEFAULT 'POLSKA' NOT NULL ,
WYROZNIK VARCHAR2(20) DEFAULT 'BEZ ZNACZENIA' NOT NULL ,
CZY_TRANSFER VARCHAR2(1) DEFAULT 'N' NOT NULL ,
ILE_PALET_MAG_1_DZIEN NUMBER(3, 0) ,
ILE_PALET_CENT_1_DZIEN NUMBER(3, 0) ,
CZY_INWENT VARCHAR2(1) DEFAULT 'N' NOT NULL ,
CZY_INWENT_SPEC VARCHAR2(1) DEFAULT 'N' NOT NULL ,
KON_PODMIOT_ODP NUMBER(8, 0) ,
AK_PODMIOT_ODP NUMBER(10, 0) ,
INW_EMAIL VARCHAR2(100) ,
KON_FRANCZYZA NUMBER(8, 0) ,
KIER_REGION NUMBER(5, 0) ,
EMAIL_KIER_REGION VARCHAR2(100) ,
EMAIL_PODM_ODP VARCHAR2(100) )
/
create table INW_PLAN_MAG
(
ID NUMBER(12, 0) NOT NULL ,
PI_NUMER VARCHAR2(15) NOT NULL ,
M_SYMBOL VARCHAR2(3) NOT NULL ,
STATUS VARCHAR2(20) DEFAULT 'CZEKA' NOT NULL ,
KONTROLER_HASLO VARCHAR2(30) ,
DATA_ODEBRANIA DATE ,
DATA_ROZPOCZECIA_FAKT DATE ,
DATA_ZAKONCZENIA_FAKT DATE ,
IRM_ID NUMBER(12, 0) ,
ZNK_NUMER VARCHAR2(17) ,
CZY_ROZL_WART VARCHAR2(1) DEFAULT 'N' NOT NULL ,
CZY_SALON VARCHAR2(1) NOT NULL ,
UTWORZONY_PRZEZ VARCHAR2(30) NOT NULL ,
DATA_UTWORZENIA DATE NOT NULL ,
MODYFIKOWANY_PRZEZ VARCHAR2(30) ,
DATA_MODYFIKACJI DATE ,
NR_WLASNY_INW VARCHAR2(10) ,
NIEDOBOR_ILOSC NUMBER(12, 2) DEFAULT 0 NOT NULL ,
NIEDOBOR_WARTOSC_CSN NUMBER(12, 2) DEFAULT 0 NOT NULL ,
NIEDOBOR_WARTOSC_CZN NUMBER(12, 2) DEFAULT 0 NOT NULL ,
NADWYZKA_ILOSC NUMBER(12, 2) DEFAULT 0 NOT NULL ,
NADWYZKA_WARTOSC_CSN NUMBER(12, 2) DEFAULT 0 NOT NULL ,
NADWYZKA_WARTOSC_CZN NUMBER(12, 2) DEFAULT 0 NOT NULL ,
SALDO_ILOSC NUMBER(12, 2) DEFAULT 0 NOT NULL ,
SALDO_CSN NUMBER(12, 2) DEFAULT 0 NOT NULL ,
SALDO_CZN NUMBER(12, 2) DEFAULT 0 NOT NULL )
/
create table MK_OPERACJE_MAG
(
NUMER VARCHAR2(18) NOT NULL ,
ZNAK VARCHAR2(1) NOT NULL ,
DATA_OPER_MAG DATE NOT NULL ,
CZY_ANULOWANY VARCHAR2(1) DEFAULT 'N',
UWAGI VARCHAR2(60) ,
DOKUMENT_OBCY VARCHAR2(20) ,
WYROZNIK VARCHAR2(5) ,
AK_ID NUMBER(10, 0) DEFAULT 0 NOT NULL ,
STOO_SYMBOL VARCHAR2(3) NOT NULL ,
M_SYMBOL VARCHAR2(3) NOT NULL ,
ZOO_NUMER VARCHAR2(13) ,
DTK_NUMER VARCHAR2(13) ,
OOS_NUMER VARCHAR2(18) ,
OM_NUMER VARCHAR2(18) ,
UTWORZONY_PRZEZ VARCHAR2(30) NOT NULL ,
DATA_UTWORZENIA DATE NOT NULL ,
MODYFIKOWANY_PRZEZ VARCHAR2(30) ,
DATA_MODYFIKACJI DATE ,
ILOSC_JME NUMBER(12, 2) DEFAULT 0 NOT NULL ,
ILOSC_OPAK NUMBER(8, 2) DEFAULT 0 NOT NULL ,
WART_ZAK_NET NUMBER(14, 4) DEFAULT 0 NOT NULL ,
WART_ZAK_BRT NUMBER(12, 2) DEFAULT 0 NOT NULL ,
WART_RAB_BRT NUMBER(12, 2) DEFAULT 0 NOT NULL ,
WART_RAB_NET NUMBER(12, 2) DEFAULT 0 NOT NULL ,
WART_SPZ_NET NUMBER(12, 2) DEFAULT 0 NOT NULL ,
KOSZT_SKLADU NUMBER(10, 2) DEFAULT 0 NOT NULL ,
KOSZT_PRZEROBU NUMBER(10, 2) DEFAULT 0 NOT NULL ,
KON_NR_KONTRAHENTA NUMBER(8, 0) DEFAULT 0 NOT NULL ,
WART_SPZ_BRT NUMBER(12, 2) DEFAULT 0 NOT NULL ,
SPZ_NUMER VARCHAR2(17) ,
ILE_POM_BEDZIE NUMBER(4, 0) DEFAULT 1 NOT NULL ,
ILE_POM_JEST NUMBER(4, 0) DEFAULT 0 NOT NULL ,
DATA_CZAS_UTWORZENIA DATE NOT NULL ,
PCE_NUMER VARCHAR2(12) DEFAULT '0' NOT NULL ,
PFK_NUMER VARCHAR2(12) DEFAULT '0' NOT NULL ,
PODD_NUMER VARCHAR2(12) DEFAULT '0' NOT NULL ,
WAGA_NETTO_KG NUMBER(10, 2) DEFAULT 0 NOT NULL ,
WAGA_BRUTTO_KG NUMBER(10, 2) DEFAULT 0 NOT NULL ,
OBJETOSC_M3 NUMBER(10, 3) DEFAULT 0 NOT NULL ,
TRANSFER_NUM NUMBER(12, 0) DEFAULT 0 NOT NULL ,
PIF_NUMER VARCHAR2(12) DEFAULT '0',
MPK_SYMBOL VARCHAR2(10) ,
DOK_STAREGO_SYSTEMU VARCHAR2(30) ,
CZY_FAKT_OPOZN VARCHAR2(1) DEFAULT 'N' NOT NULL )
/
create table MZ_KONFIG
(
PARAM VARCHAR2(20) NOT NULL ,
TRESC VARCHAR2(240) ,
DATE_CREATED DATE ,
MODIFIED_BY VARCHAR2(30) ,
CREATED_BY VARCHAR2(30) ,
DATE_MODIFIED DATE ,
SYSTEM VARCHAR2(1) DEFAULT 'N',
KOMENTARZ VARCHAR2(240) )
/
create table KON_KONTRAHENT
(
NUMER_KONTRAHENTA NUMBER(8, 0) NOT NULL ,
NAZWA_WLASNA VARCHAR2(20) ,
NAZWA_PELNA VARCHAR2(120) ,
NIP VARCHAR2(13) ,
REGON VARCHAR2(9) ,
PODATNIK_VAT VARCHAR2(1) DEFAULT 'N',
NAZWA_DOKUM_REJESTROWEGO VARCHAR2(40) ,
NUMER_DOKUM_REJESTROWEGO VARCHAR2(20) ,
CZY_JEST_KOPIA_DOKUM VARCHAR2(1) DEFAULT 'N',
OPINIA_WYWIADOWNI VARCHAR2(256) ,
UWAGI VARCHAR2(256) ,
BLOKADA VARCHAR2(1) DEFAULT 'N' NOT NULL ,
KONTO_ROZRACHUNKOWE VARCHAR2(14) ,
EMAIL VARCHAR2(120) ,
WWW VARCHAR2(100) ,
SSP_NAZWA VARCHAR2(10) NOT NULL ,
UTWORZONY_PRZEZ VARCHAR2(30) NOT NULL ,
DATA_UTWORZENIA DATE NOT NULL ,
MODYFIKOWANY_PRZEZ VARCHAR2(30) ,
DATA_MODYFIKACJI DATE ,
SYSTEM VARCHAR2(1) DEFAULT 'N',
KRS VARCHAR2(10) ,
NR_BAZY NUMBER(3, 0) NOT NULL ,
CZY_OSOBA_FIZYCZNA VARCHAR2(1) DEFAULT 'N' NOT NULL ,
CZY_KON_POWIAZANY VARCHAR2(1) DEFAULT 'N' NOT NULL ,
PCE_NUMER VARCHAR2(12) DEFAULT '0' NOT NULL ,
PODD_NUMER VARCHAR2(12) DEFAULT '0' NOT NULL ,
PESEL VARCHAR2(11) ,
CZY_UNIJNY VARCHAR2(1) DEFAULT 'N' NOT NULL ,
NIP_KOD_UE VARCHAR2(2) ,
NIP_SI VARCHAR2(13) )
/