2
CREATE TRIGGER COMPANY_AI0 FOR COMPANY
ACTIVE AFTER INSERT POSITION 0
AS
declare variable new_val varchar(20);
begin
execute procedure new_procedure new.companyname returning_values :new_val;
update company set REZ=:new_val where ID_COMPANY = new.ID_COMPANY;
end
3
CREATE TRIGGER COMPANY_BI0 FOR COMPANY
ACTIVE BEFORE INSERT POSITION 0
AS
begin
NEW.id_company = gen_id(counter_for_company,1);
End
4
CREATE TRIGGER DISPETCHERS_BI0 FOR DISPETCHERS
ACTIVE BEFORE INSERT POSITION 0
AS
begin
NEW.id_dispetcher = gen_id(for_iddispetch,1);
End
5
CREATE TRIGGER PHISICHESKIE_LICA_BI0 FOR PHISICHESKIE_LICA
ACTIVE BEFORE INSERT POSITION 0
AS
begin
NEW.id_phis_lica = gen_id(gen_phisicheskie_lica_id,1);
End
6
CREATE TRIGGER SOTRUDNIKI_BI0 FOR SOTRUDNIKI
ACTIVE BEFORE INSERT POSITION 0
AS
begin
NEW.id_sotrudnik = gen_id(for_idsotr,1);
End
7
CREATE TRIGGER TEXOBCLUZ_BI0 FOR TEXOBCLUZ
ACTIVE BEFORE INSERT POSITION 0
AS
begin
NEW.id_texobcluz = gen_id(for_idtexobc,1);
End
8
REATE TRIGGER VODITELI_BI0 FOR VODITELI
ACTIVE BEFORE INSERT POSITION 0
AS
begin
NEW.id_voditel= gen_id(for_idvoditel,1);
End
9
CREATE TRIGGER ZAKAZ_BI0 FOR ZAKAZ
ACTIVE BEFORE INSERT POSITION 0
AS
begin
NEW.id_zakaz = gen_id(for_idzakaz,1);
End
10
CREATE TRIGGER ZAKAZ_BI0S FOR ZAKAZ
ACTIVE BEFORE INSERT POSITION 0
AS
begin
NEW.nomer_zakaza = gen_id(for_nomerzakaza,1);
End
Процедура
CREATE PROCEDURE NEW_PROCEDURE (
sel_name varchar(20))
returns (
ret_pay decimal(15,2))
as
declare variable all_pay decimal(15,2);
begin
SELECT SUM(PAY) FROM company
WHERE COMPANYNAME =:sel_name INTO :all_pay;
IF (row_count=0) THEN all_pay=0;
IF (:all_pay>5000) THEN ret_pay =all_pay-(all_pay*20)/100;
ELSE ret_pay=0.95*all_pay;
suspend;
end^
SET TERM ; ^
GRANT SELECT ON COMPANY TO PROCEDURE NEW_PROCEDURE;
GRANT EXECUTE ON PROCEDURE NEW_PROCEDURE TO SYSDBA;
КОД INDEX.PHP
<html>
<head>
<title>База Такси</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<style>
body, td{font-family: verdana;}
</style>
</head>
<body>
<center>
<?
if(@$_GET['f'] == "1")//то что нажали кнопку на форме
{
$Testdb = 'z:\home\localhost\www\kursach';
$host = ibase_connect ($Testdb,'SYSDBA','masterkey','WIN1251');
$what = 'sname, name, pname';
$where = ' bux.id_sotrudnik=phisicheskie_lica.id_phis_lica';
$from = 'phisicheskie_lica, bux';
if(@$_GET['family'])//смотрим че введено в форме
{
$where .= " and SNAME like '".$_GET['family']."%' ";
}
if(@$_GET['fname'])
{
$where .= " and NAME like '".$_GET['fname']."%' ";
}
if(@$_GET['lname'])
{
$where .= " and PNAME like '".$_GET['lname']."%' ";
}
if(@$_GET['cbZarplata'])
{
$v1 = substr($_GET['tbZarplata'], 0, 1);//вся строка без первого символа
$v1 = (($v1=='>')||($v1=='<')) ? $v1 : '>';
if($_GET['tbZarplata'])
if((($_GET['tbZarplata']{0}=='>')||($_GET['tbZarplata']{0}=='<')))
$v2 = substr($_GET['tbZarplata'], 1);
else $v2 = $_GET['tbZarplata'];
if(@!$v2) $v2=0;
$where .= " and ZARPLATA ".$v1." ".$v2." ";
$what.=', zarplata';
}
if(@$_GET['cbCar'])
{
$what.=', marka';
$where .= " and MARKA like '".$_GET['tbCar']."%' ";
$from .= ', avto, voditeli';
$where .= ' and ((voditeli.id_sotrudnik=phisicheskie_lica.id_phis_lica) and (voditeli.id_avto=avto.id_avto))';
}
if(@$_GET['cbType'])
{
$what.=', TIP_ZAKAZA';
$where .= " and TIP_ZAKAZA like '".$_GET['tbType']."%' ";
$from .= ', zakaz';
$where .= ' and (zakaz.zakazchik=phisicheskie_lica.id_phis_lica)';
}
$q = "select DISTINCT ".$what." from ".$from." where ".$where." ";
// echo $q.'<br><br>';
$r = q($q);
//die();
$col1 = "#eeeeee";
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.