Ðåôåðàòû. Ðàçðàáîòêà èíôîðìàöèîííî-ñïðàâî÷íîé ñèñòåìû ïî ó÷åòó âàãîíîâ íà ïîäúåçäíîì ïóòè ïðåäïðèÿòèÿ

  if (Tbl='Vagon') then

    begin

       QueryString := 'select * from Vagon V, Rod_vagona RV, Raion_dvizheniya RD where V.key_rod_vagona=RV.id and V.key_raion_dvizh=RD.id order by invent_nomer desc';

       SelectQ := DataModule2.QShow;

    end;


  if (Tbl='Operations_s_vagonom') then

    begin

       MyKey := DataModule2.Qshow['v.id'];

       SelectQ := DataModule2.QOSV;

       Polya := 'OSV.*, SNACH.*, SKON.*, FNACH.*, FKON.*, O.*, G.*';

       Tabli := 'vagon V, station SNACH, station SKON, front FNACH, front FKON, operation O, gruz G, Operations_s_vagonom OSV';

       Svyaz:= 'OSV.key_station_otpr=SNACH.id and OSV.key_front_otpr=FNACH.id and OSV.key_station_naznach=SKON.id and OSV.key_front_naznach=FKON.id and OSV.key_operation=O.id and OSV.key_gruz=G.id and OSV.key_vagon=V.id and OSV.key_vagon=' + MyKey;

       QueryString := 'select '+Polya+' from '+Tabli+' where '+Svyaz;

    end;


  if (Tbl='Uslugi_sv') then

    begin

       MyKey := DataModule2.QOSV['OSV.id'];

       SelectQ := DataModule2.Quslugi;

       Polya := 'USV.*, CNA.*, CS.*, ST.*, VU.*, V.*';

       Tabli := 'Ceha CNA, Ceha CS, Uslugi_sv USV, Operations_s_vagonom OSV, Stoimost ST, Vid_uslug VU, Ves V';

       Svyaz:= 'USV.key_uslugi=ST.id and USV.key_na=CNA.id and USV.key_s=CS.id and USV.key_vagon=OSV.id and ST.key_vid_uslug=VU.id and ST.key_ves=V.id and USV.key_vagon=' + MyKey;

       QueryString := 'select '+Polya+' from '+Tabli+' where '+Svyaz;

    end;


  if (Tbl='Stoimost') then

    begin

       SelectQ := DataModule2.QSelUs;

       Polya := ' VU.*, V.*, ST.*';

       Tabli := 'Vid_uslug VU, Ves V, Stoimost ST';

       Svyaz:= 'ST.key_vid_uslug=VU.id and ST.key_ves=V.id';

       QueryString := 'select '+Polya+' from '+Tabli+' where '+Svyaz;

    end;


  with SelectQ do

    begin

      Close;

      SQL.Clear;

      SQL.Add(QueryString);

      Open;

    end;


  if (Tbl='Vagon') then

    begin

     SelectQ.Fields[0].Visible := false;

     SelectQ.Fields[7].Visible := false;

     SelectQ.Fields[9].Visible := false;

     SelectQ.Fields[10].Visible := false;

     SelectQ.Fields[12].Visible := false;

     Form1.DBGrid1.Columns[0].Title.Caption :='Ìåñÿö';

     Form1.DBGrid1.Columns[1].Title.Caption :='Ãîä';

     Form1.DBGrid1.Columns[2].Title.Caption :='¹ âàãîíà';

     Form1.DBGrid1.Columns[3].Title.Caption :='Èíâ. ¹';

     Form1.DBGrid1.Columns[4].Title.Caption :='Èçãîò.';

     Form1.DBGrid1.Columns[5].Title.Caption :='Ãðóçîïîä. ò.';

     Form1.DBGrid1.Columns[6].Title.Caption :='Èçíîñ %';

     Form1.DBGrid1.Columns[7].Title.Caption :='Ðîä âàãîíà';

     Form1.DBGrid1.Columns[8].Title.Caption :='Ðàéîí äâèæåíèÿ';

    end;


  if (Tbl='Operations_s_vagonom') then

    begin

     SelectQ.Fields[0].Visible := false;

     SelectQ.Fields[1].Visible := false;

     SelectQ.Fields[2].Visible := false;

     SelectQ.Fields[3].Visible := false;

     SelectQ.Fields[4].Visible := false;

     SelectQ.Fields[7].Visible := false;

     SelectQ.Fields[8].Visible := false;

     SelectQ.Fields[12].Visible := false;

     SelectQ.Fields[13].Visible := false;

     SelectQ.Fields[15].Visible := false;

     SelectQ.Fields[17].Visible := false;

     SelectQ.Fields[19].Visible := false;

     SelectQ.Fields[21].Visible := false;

     SelectQ.Fields[23].Visible := false;

     Form6.DBGrid1.Columns[0].Title.Caption :='Äàòà';

     Form6.DBGrid1.Columns[1].Title.Caption :='Âðåìÿ';

     Form6.DBGrid1.Columns[2].Title.Caption :='Âåñ';

     Form6.DBGrid1.Columns[3].Title.Caption :='¹ äîð. âåä.';

     Form6.DBGrid1.Columns[4].Title.Caption :='¹ âåä.';

     Form6.DBGrid1.Columns[5].Title.Caption :='Ñòàíöèÿ îòïð.';

     Form6.DBGrid1.Columns[6].Title.Caption :='Ñòàíöèÿ ïîë.';

     Form6.DBGrid1.Columns[7].Title.Caption :='Ôðîíò îòïð.';

     Form6.DBGrid1.Columns[8].Title.Caption :='Ôðîíò ïîë.';

     Form6.DBGrid1.Columns[9].Title.Caption :='Îïåðàöèÿ';

     Form6.DBGrid1.Columns[10].Title.Caption :='Ãðóç';

    end;


  if (Tbl='Uslugi_sv') then

    begin

     SelectQ.Fields[0].Visible := false;

     SelectQ.Fields[2].Visible := false;

     SelectQ.Fields[3].Visible := false;

     SelectQ.Fields[4].Visible := false;

     SelectQ.Fields[5].Visible := false;

     SelectQ.Fields[7].Visible := false;

     SelectQ.Fields[10].Visible := false;

     SelectQ.Fields[13].Visible := false;

     SelectQ.Fields[14].Visible := false;

     SelectQ.Fields[15].Visible := false;

     SelectQ.Fields[17].Visible := false;

     SelectQ.Fields[19].Visible := false;

     Form7.DBGrid1.Columns[0].Title.Caption :='Çàêàç';

     Form7.DBGrid1.Columns[1].Title.Caption :='Ñòîèìîñòü çàêàçà';

     Form7.DBGrid1.Columns[2].Title.Caption :='¹ öåõà èñï.';

     Form7.DBGrid1.Columns[3].Title.Caption :='ÁÑ ö.è.';

     Form7.DBGrid1.Columns[4].Title.Caption :='¹ öåõà çàêàç.';

     Form7.DBGrid1.Columns[5].Title.Caption :='ÁÑ ö.ç.';

     Form7.DBGrid1.Columns[6].Title.Caption :='Ñòîèì. óñë.';

     Form7.DBGrid1.Columns[7].Title.Caption :='Âèä óñëóãè';

     Form7.DBGrid1.Columns[8].Title.Caption :='Åäèíèöà èçìåðåíèÿ';

    end;


  if (Tbl='Stoimost') then

    begin

     SelectQ.Fields[0].Visible := false;

     SelectQ.Fields[2].Visible := false;

     SelectQ.Fields[4].Visible := false;

     SelectQ.Fields[5].Visible := false;

     SelectQ.Fields[6].Visible := false;

     Form8.DBGrid1.Columns[0].Title.Caption :='Âèä óñëóãè';

     Form8.DBGrid1.Columns[1].Title.Caption :='Åäèíèöà èçìåðåíèÿ';

     Form8.DBGrid1.Columns[2].Title.Caption :='Ñòîèìîñòü';

    end;


  if ((Tbl='Operation')or(Tbl='Station')or(Tbl='Ceha')or

      (Tbl='Front')or(Tbl='Gruz')or(Tbl='Rod_vagona')or

      (Tbl='Raion_dvizheniya')or(Tbl='Ves')or(Tbl='Vid_uslug')) then

     begin

      SelectQ.Fields[0].Visible := false;

      Form3.DBGrid1.Columns[0].Title.Caption := Form3.Label1.Caption;

      If (tbl='Ceha') then

        begin

          Form3.DBGrid1.Columns[1].Title.Caption := Form3.Label2.Caption;

        end;

     end;


end;


Procedure InsertZapros();

var

   QueryString, Polya: string;

   YN : Boolean;

begin

      YN := false;

      if ((Tbl='Operation')or(Tbl='Station')or(Tbl='Ceha')or

           (Tbl='Front')or(Tbl='Gruz')or(Tbl='Rod_vagona')or

           (Tbl='Raion_dvizheniya')or(Tbl='Ves')or(Tbl='Vid_uslug')) then

         begin

            SelectQ := DataModule2.Query1;

            with DataModule2.Query1 do

              begin

               First;

               while (not Eof) do

                begin

                if (ForEdit <> SelectQ['id']) then

                  begin

                   if DataModule2.Query1[pole2] = ToIns then

                     begin

                      YN:=true;

                      Break;

                     end;

                  end;

                 Next;

                end;

             end;

            if InsEdit then

               begin

                 If (tbl='Ceha') then

                   begin

                     QueryString := 'UPDATE '+TBL+' SET '+pole2+'='+#39+ToIns+#39+','+pole3+'='+#39+ToIns2+#39+ ' where '+pole1+'='+ForEdit;

                   end

                  else

                   begin

                     QueryString := 'UPDATE '+TBL+' SET '+pole2+'='+#39+ToIns+#39+' where '+pole1+'='+ForEdit;

                   end;

                 InsEdit := false;

              end

             else

               begin

                 If (tbl='Ceha') then

                   begin

                     QueryString := 'insert into '+ TBL +' ('+pole2+','+pole3+') values ('+#39+ToIns+#39+','+#39+ToIns2+#39+')';

                   end

                  else

                   begin

                     QueryString := 'insert into '+ TBL +' ('+pole2+') values ('+#39+ToIns+#39+')';

                   end;

               end;

          end;


      if (Tbl='Stoimost') then

         begin

            SelectQ := DataModule2.QSelUs;

            pole1 := 'id';

            pole2 := 'key_vid_uslug';

            pole3 := 'key_ves';

            pole4 := 'stoimost';

            pole5 := '';

            pole6 := '';

            pole7 := '';

            pole8 := '';

            pole9 := '';

            pole10 := '';

            pole11 := '';

            pole12 := '';

            pole13 := '';

            with SelectQ do

              begin

               First;

               while (not Eof) do

                begin

                if (ForEdit <> SelectQ['ST.id']) then

                  begin

                   if ((SelectQ[pole2] = ToIns)and(SelectQ[pole3] = ToIns2)) then

                     begin

                      YN:=true;

                      Break;

                     end;

                   end; 

                 Next;

                end;

             end;

            if InsEdit2 then

              begin

               QueryString := 'UPDATE '+TBL+' SET '+pole2+'='+#39+ToIns+#39+','+pole3+'='+#39+ToIns2+#39+','+pole4+'='+#39+ToIns3+#39+' where '+pole1+'='+ForEdit;

               InsEdit2 := false;

              end

             else

               QueryString := 'insert into '+ TBL +' ('+pole2+','+pole3+','+pole4+') values ('+#39+ToIns+#39+','+#39+ToIns2+#39+','+#39+ToIns3+#39+')';

         end;


      if (Tbl='Vagon') then

         begin

            pole1 := 'id';

            pole2 := 'mymonth';

            pole3 := 'myyear';

            pole4 := 'nomer_vagona';

Ñòðàíèöû: 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



2012 © Âñå ïðàâà çàùèùåíû
Ïðè èñïîëüçîâàíèè ìàòåðèàëîâ àêòèâíàÿ ññûëêà íà èñòî÷íèê îáÿçàòåëüíà.