Advertisement
Guest User

frmEstimCalcCost.pas

a guest
Dec 10th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 21.89 KB | None | 0 0
  1. unit frmEstimCalcCost;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7.   Dialogs, frmCustomMDI, Menus, ImgList, Grids, DBGrids, ExtCtrls, StdCtrls,
  8.   DB, IBCustomDataSet, IBQuery, IBUpdateSQL, IBStoredProc, DBGridEh, DBCtrls,
  9.   Mask, ComCtrls, ToolWin, DBCtrlsEh, DBLookupEh, ActnList, frmCustom,
  10.   Buttons, ToolCtrlsEh, untCommonMineParams, IBDatabase;
  11.  
  12. type
  13.  
  14.   TfmEstimCalcCost = class(TfmCustomMDI)
  15.     pcComplexContent: TPageControl;
  16.     tsEquipLifting: TTabSheet;
  17.     tsEquipPumping: TTabSheet;
  18.     lCentroPumpCount: TLabel;
  19.     lFactWaterFlow: TLabel;
  20.     lFactWaterHeader: TLabel;
  21.     lFactorElectroLube: TLabel;
  22.     lEquipLiftingRopeLength: TLabel;
  23.     lEquipLiftingRopeDiameter: TLabel;
  24.     tsEquipUnderground: TTabSheet;
  25.     tsOtherCost: TTabSheet;
  26.     tsLoaders: TTabSheet;
  27.     lMachineWork: TLabel;
  28.     lAngleSlope: TLabel;
  29.     lInitDepthTrunk: TLabel;
  30.     lUseMode: TLabel;
  31.     lNumberHorizont: TLabel;
  32.     lTailRopeType: TLabel;
  33.     dbeEquipLiftingRopeLength: TDBEditEh;
  34.     edEquipLiftingRopeDiameter: TDBEditEh;
  35.     dbeAngleSlope: TDBEditEh;
  36.     dbeInitDepthTrunk: TDBEditEh;
  37.     dbeNumberHorizont: TDBEditEh;
  38.     dbeFactorElectroLube: TDBEditEh;
  39.     lReceivingAreasCount: TLabel;
  40.     lUndergroundAngleSlope: TLabel;
  41.     lTrunkCount: TLabel;
  42.     lUseFixedBuilding: TLabel;
  43.     lTrunkMethod: TLabel;
  44.     lWorkDuration: TLabel;
  45.     lMainMachine: TLabel;
  46.     lWorkingPumpNumber: TLabel;
  47.     cbUseCounterWeight: TDBCheckBoxEh;
  48.     pnlTop: TPanel;
  49.     lWorkMode: TLabel;
  50.     dbeMachineWork: TDBEditEh;
  51.     lUseEquip: TLabel;
  52.     cbUseMode: TDBComboBoxEh;
  53.     cbTailRopeType: TDBComboBoxEh;
  54.     edFactWaterFlow: TDBEditEh;
  55.     edFactWaterHeader: TDBEditEh;
  56.     edWorkingPumpNumber: TDBEditEh;
  57.     cbTrunkCount: TDBComboBoxEh;
  58.     cbReceivingAreasCount: TDBComboBoxEh;
  59.     edUndergroundAngleSlope: TDBEditEh;
  60.     lTeam: TLabel;
  61.     dbeTeam: TDBEditEh;
  62.     qMainID: TIntegerField;
  63.     qMainWORKDURATION: TIntegerField;
  64.     qMainEQUIPID: TIntegerField;
  65.     qMainEQUIPNAME: TStringField;
  66.     qMainTEAMID: TIntegerField;
  67.     qMainTEAMNAME: TStringField;
  68.     qMainWORKMODE: TFloatField;
  69.     lTubVolume: TLabel;
  70.     lUse4EmergencyExit: TLabel;
  71.     lWagonVolume: TLabel;
  72.     lEquipLiftingRenditionType: TLabel;
  73.     lFinalDepthTrunk: TLabel;
  74.     dbeFinalDepthTrunk: TDBEditEh;
  75.     tsTipperLifting: TTabSheet;
  76.     tsWinchLifting: TTabSheet;
  77.     lWinchLiftingRenditionType: TLabel;
  78.     tsShelfLifting: TTabSheet;
  79.     lUseOnlyZeroFrame: TLabel;
  80.     lDurationZeroFrame: TLabel;
  81.     lFactorAmotrize: TLabel;
  82.     lPresentRegimentShelf: TLabel;
  83.     edDurationZeroFrame: TDBEditEh;
  84.     edFactorAmotrize: TDBEditEh;
  85.     tsHelpEquipLifting: TTabSheet;
  86.     lHelpEquipRopeLength: TLabel;
  87.     edHelpEquipRopeLength: TDBEditEh;
  88.     lHelpEquipRopeDiameter: TLabel;
  89.     edHelpEquipRopeDiameter: TDBEditEh;
  90.     tsComplexWagonLifting: TTabSheet;
  91.     tsHedingComplex: TTabSheet;
  92.     lUseCounterWeight: TLabel;
  93.     lWinchLiftingRopeLength: TLabel;
  94.     edWinchLiftingRopeLength: TDBEditEh;
  95.     lWinchLiftingRopeDiameter: TLabel;
  96.     edWinchLiftingRopeDiameter: TDBEditEh;
  97.     tsSettlingTanksVenting: TTabSheet;
  98.     cbCentroPumpCount: TDBComboBoxEh;
  99.     tsEquipVenting: TTabSheet;
  100.     lFactEquipPower: TLabel;
  101.     lFactorAmortizeRepairs: TLabel;
  102.     lFanCount: TLabel;
  103.     edFactEquipPower: TDBEditEh;
  104.     edFanCount: TDBEditEh;
  105.     edFactorAmortizeRepairs: TDBEditEh;
  106.     lRenditionType: TLabel;
  107.     cbRenditionType: TDBComboBoxEh;
  108.     tsConditionVenting: TTabSheet;
  109.     lEquipUndergroundRopeLength: TLabel;
  110.     lEquipUndergroundRopeDiameter: TLabel;
  111.     edEquipUndergroundRopeLength: TDBEditEh;
  112.     edEquipUndergroundRopeDiameter: TDBEditEh;
  113.     tsWinchUnderground: TTabSheet;
  114.     lWinchUndergroundRopeLength: TLabel;
  115.     lWinchUndergroundRopeDiameter: TLabel;
  116.     edWinchUndergroundRopeLength: TDBEditEh;
  117.     edWinchUndergroundRopeDiameter: TDBEditEh;
  118.     tsElectroUndeground: TTabSheet;
  119.     tsGarageUnderground: TTabSheet;
  120.     tsRoadUnderground: TTabSheet;
  121.     tsConveyorUnderground: TTabSheet;
  122.     tsComplexWagonUnderground: TTabSheet;
  123.     lRoadUndergroundRopeLength: TLabel;
  124.     lRoadUndergroundRopeDiameter: TLabel;
  125.     edRoadUndergroundRopeLength: TDBEditEh;
  126.     edRoadUndergroundRopeDiameter: TDBEditEh;
  127.     lMineWork: TLabel;
  128.     qMainMINECOMPLEXID: TIntegerField;
  129.     qMainROPELENGTH: TFloatField;
  130.     qMainROPEDIAMETER: TFloatField;
  131.     dbeWorkDuration: TDBEditEh;
  132.     dbeWorkMode: TDBEditEh;
  133.     qMainUSEEQUIPID: TIntegerField;
  134.     qMainANGLESLOPE: TSmallintField;
  135.     qMainTUBVOLUMEID: TSmallintField;
  136.     qMainWAGONVOLUMEID: TSmallintField;
  137.     qMainUSE4EMERGENCYEXIT: TIntegerField;
  138.     qMainRENDITIONTYPEID: TIntegerField;
  139.     qMainFINALDEPTHTRUNK: TFloatField;
  140.     qMainUSEMODEID: TIntegerField;
  141.     qMainUSECOUNTERWEIGHT: TSmallintField;
  142.     qMainNUMBERHORIZONT: TIntegerField;
  143.     qMainTAILROPETYPEID: TSmallintField;
  144.     qMainUSEONLYZEROFRAME: TSmallintField;
  145.     qMainDURATIONZEROFRAME: TFloatField;
  146.     qMainPRESENTREGIMENTSHELF: TSmallintField;
  147.     qMainSUBCOMPLEXID: TSmallintField;
  148.     cbUseEquip: TDBComboBoxEh;
  149.     dbTubVolume: TDBComboBoxEh;
  150.     dbWagonVolume: TDBComboBoxEh;
  151.     cbEquipLiftingRenditionType: TDBComboBoxEh;
  152.     cblWinchLiftingRenditionType: TDBComboBoxEh;
  153.     cbUse4EmergencyExit: TDBCheckBoxEh;
  154.     qMainINITDEPTHTRUNK: TFloatField;
  155.     qMainFACTORELECTROLUBE: TFloatField;
  156.     cbUseOnlyZeroFrame: TDBCheckBoxEh;
  157.     cbPresentRegimentShelf: TDBCheckBoxEh;
  158.     qMainFACTORAMORTIZE: TFloatField;
  159.     cbMainMachine: TDBCheckBoxEh;
  160.     qMainPUMPCOUNTID: TSmallintField;
  161.     qMainFACTWATERFLOW: TFloatField;
  162.     cbUseFixedBuilding: TDBCheckBoxEh;
  163.     cbTrunkMethod: TDBComboBoxEh;
  164.     lMinePumpCount: TLabel;
  165.     cbMinePumpCount: TDBComboBoxEh;
  166.     qMainFACTWATERHEADER: TFloatField;
  167.     qMainMAINMACHINE: TSmallintField;
  168.     qMainWORKINGPUMPNUMBER: TIntegerField;
  169.     qMainRECEIVINGAREASCOUNT: TIntegerField;
  170.     qMainFACTEQUIPPOWER: TFloatField;
  171.     qMainFANCOUNT: TIntegerField;
  172.     qMainFACTORAMORTIZEREPAIRS: TFloatField;
  173.     cbMineWork: TDBCheckBoxEh;
  174.     qMainMINEWORK: TSmallintField;
  175.     qMainUSEFIXEDBUILDING: TSmallintField;
  176.     qMainTRUNKCOUNT: TIntegerField;
  177.     qMainTRUNKMETHOD: TSmallintField;
  178.     lConveyorLength: TLabel;
  179.     edConveyorLength: TDBEditEh;
  180.     qMainCONVEYORLENGTH: TFloatField;
  181.     lDepthHorizont: TLabel;
  182.     cbDepthHorizont: TDBComboBoxEh;
  183.     qMainDEPTHHORIZONT: TSmallintField;
  184.     procedure dbeMachineWorkEditButtons0Click(Sender: TObject;
  185.       var Handled: Boolean);
  186.     procedure qMainSUBCOMPLEXIDChange(Sender: TField);
  187.     procedure qMainAfterOpen(DataSet: TDataSet);
  188.     procedure qMainAfterScroll(DataSet: TDataSet);
  189.     procedure dbeTeamEditButtons0Click(Sender: TObject;
  190.       var Handled: Boolean);
  191.     procedure qMainEQUIPIDChange(Sender: TField);
  192.     procedure cbUseOnlyZeroFrameClick(Sender: TObject);
  193.     procedure acInsertExecute(Sender: TObject);
  194.     procedure acEditExecute(Sender: TObject);
  195.   private
  196.     procedure UpdateComplexContent;
  197.     procedure UpdateComplexContentPage;
  198.     procedure ChangeEquip;
  199.     procedure ChangeTeam;
  200.     procedure UpdateTeam;
  201.     //function CreateOutputClass(aCommonMineParamsClass: TCommonMineParamsClass): TCommonMineParams;
  202.   public
  203.     procedure SetState(aFormsState: TFormsState); override;
  204.     class procedure CreateParamsForm(aOwner: TComponent; aDataBase: TIBDatabase;
  205.       aFormsState: TFormsState; aParams: TCommonMineParams);
  206.   private
  207.     function GetComplexClass(aId: Integer): TCommonMineParamsClass;
  208.   end;
  209.  
  210. implementation
  211.  
  212.  
  213. {$R *.dfm}
  214.  
  215. function TfmEstimCalcCost.GetComplexClass(aId: Integer): TCommonMineParamsClass;
  216. begin
  217.   case aId of
  218.     1: Result := TLiftingParams;
  219.     2: Result := TPumpingParams;
  220.     3: Result := TVentingParams;
  221.     4: Result := TUndergroungParams;
  222.     //5: Result := TLiftingParams;
  223.     6: Result := TOtherCommonMineParams;
  224.     7: Result := TLoadersParams;
  225.   else
  226.     Result := TCommonMineParams;
  227.   end
  228.  
  229. end;
  230.  
  231. class procedure TfmEstimCalcCost.CreateParamsForm(aOwner: TComponent; aDataBase: TIBDatabase;
  232.       aFormsState: TFormsState; aParams: TCommonMineParams);
  233. begin
  234.   with TfmEstimCalcCost.Create(aOwner, aDataBase, aFormsState) do
  235.   try
  236.     if ShowModal = mrOk then
  237.     begin
  238.  
  239.       if not (Assigned(aParams)) then
  240.         aParams := GetComplexClass(qMainMINECOMPLEXID.AsInteger).Create
  241.       else if (aParams.ComplexId <> qMainMINECOMPLEXID.AsInteger) then
  242.       begin
  243.         aParams.Free;
  244.         aParams := GetComplexClass(qMainMINECOMPLEXID.AsInteger).Create;
  245.       end;
  246.  
  247.       with aParams do
  248.       begin
  249.         ComplexId   := qMainMINECOMPLEXID.AsInteger;
  250.         EuqipId     := qMainEQUIPID.AsInteger;
  251.         EuqipNameRU := qMainEQUIPNAME.AsString;
  252.         TeamId      := qMainTEAMID.AsInteger;
  253.  
  254.  
  255.  
  256.         with GetQuery('SELECT ec.underworkcost, ' + #13#10 +
  257.                       '       ec.overworkcost, ' + #13#10 +
  258.                       '       case ' + #13#10 +
  259.                       '         when ec.subcomplexid = 1 then ' + #13#10 +
  260.                       '           (select elc.valuecost ' + #13#10 +
  261.                       '              from ElectroCost elc ' + #13#10 +
  262.                       '             where elc.DepthHorizontId = :aDepthHorizontId ' + #13#10 +
  263.                       '               and elc.VolumeId = :aVolumeId ' + #13#10 +
  264.         S              '               and elc.lifttypeid = (case ' + #13#10 +
  265.                       '                                       when ec.id between 1 and 17 then ' + #13#10 +
  266.                       '                                         1 ' + #13#10 +
  267.                       '                                       when ec.id between 18 and 25 then ' + #13#10 +
  268.                       '                                         2 ' + #13#10 +
  269.                       '                                       when ec.id between 26 and 29 then ' + #13#10 +
  270.                       '                                         3 ' + #13#10 +
  271.                       '                                     end)) ' + #13#10 +
  272.                       '       else ' + #13#10 +
  273.                       '         ec.ElectroCost ' + #13#10 +
  274.                       '       end As ElectroCost, ' + #13#10 +
  275.                       '       pressaircost, ' + #13#10 +
  276.                       '       dieselcost, ' + #13#10 +
  277.                       '       greasecost, ' + #13#10 +
  278.                       '       hydrauliccost, ' + #13#10 +
  279.                       '       underrepaircost, ' + #13#10 +
  280.                       '       overrepaircost ' + #13#10 +
  281.                       '  FROM equipcost ec ' + #13#10 +
  282.                       ' WHERE Id = '+ qMainEQUIPID.AsString, False) do
  283.          try
  284.            Prepare;
  285.            if not qMainDEPTHHORIZONT.IsNull then
  286.              ParamByName('aDepthHorizontId').AsInteger := qMainDEPTHHORIZONT.AsInteger
  287.            else
  288.              ParamByName('aDepthHorizontId').Clear;
  289.  
  290.            if (qMainEQUIPID.AsInteger >= 1) and (qMainEQUIPID.AsInteger <= 25) then
  291.            begin
  292.                if not qMainTUBVOLUMEID.IsNull then
  293.                  ParamByName('aVolumeId').AsInteger := qMainTUBVOLUMEID.AsInteger
  294.                else
  295.                  ParamByName('aVolumeId').Clear;
  296.            end
  297.            else if (qMainEQUIPID.AsInteger >= 26) and (qMainEQUIPID.AsInteger <= 29) then
  298.            begin
  299.              if not qMainWAGONVOLUMEID.IsNull then
  300.                ParamByName('aVolumeId').AsInteger := qMainWAGONVOLUMEID.AsInteger
  301.              else
  302.                ParamByName('aVolumeId').Clear;
  303.            end;
  304.  
  305.            Open;
  306.            ElectroCost := FieldByName('electrocost').AsFloat;
  307.            PressAirCost := FieldByName('pressaircost').AsFloat;
  308.            DieselCost := FieldByName('dieselcost').AsFloat;
  309.            GreaseCost := FieldByName('greasecost').AsFloat;
  310.            HydroCost := FieldByName('hydrauliccost').AsFloat;
  311.            OverRepairCost := FieldByName('overrepaircost').AsFloat;
  312.            UnderRepairCost := FieldByName('underrepaircost').AsFloat;
  313.          finally
  314.            Free;
  315.          end;
  316.  
  317.          case qMainMINECOMPLEXID.AsInteger of
  318.            1:
  319.            with TLiftingParams(aParams) do
  320.            begin
  321.              if qMainSUBCOMPLEXID.AsInteger in [1, 2, 4] then
  322.              begin
  323.                RopeLength := qMainROPELENGTH.AsFloat;
  324.                RopeDiameter := qMainROPEDIAMETER.AsFloat;
  325.                AngleSlope := qMainANGLESLOPE.AsInteger;
  326.              end;
  327.            end;
  328.  
  329.            2:
  330.            with TPumpingParams(aParams) do
  331.            begin
  332.  
  333.            end;
  334.            3:
  335.            with TVentingParams(aParams) do
  336.            begin
  337.  
  338.            end;
  339.            4:
  340.            with TUndergroungParams(aParams) do
  341.            begin
  342.              if qMainSUBCOMPLEXID.AsInteger = 17 then
  343.              begin
  344.                ConveyorLength := qMainCONVEYORLENGTH.AsFloat;
  345.                
  346.              end;
  347.              if qMainSUBCOMPLEXID.AsInteger in [12, 13, 19] then
  348.              begin
  349.                RopeLength := qMainROPELENGTH.AsFloat;
  350.                RopeDiameter := qMainROPEDIAMETER.AsFloat;
  351.                AngleSlope := qMainANGLESLOPE.AsInteger;
  352.              end;
  353.            end;
  354.  
  355.           6:
  356.           with TOtherCommonMineParams(aParams) do
  357.           begin
  358.  
  359.           end;
  360.           7:
  361.           with TLoadersParams(aParams) do
  362.           begin
  363. E
  364.           end;
  365.         end;
  366.       end;
  367.     end;
  368.   finally
  369.     Free;
  370.   end;
  371. end;
  372.  
  373. procedure TfmEstimCalcCost.dbeMachineWorkEditButtons0Click(Sender: TObject;
  374.   var Handled: Boolean);
  375. begin
  376.   inherited;
  377.   ChangeEquip;
  378. end;
  379.  
  380. procedure TfmEstimCalcCost.ChangeEquip;
  381. begin
  382.   with TfmCustomMDI.CreateFormEx(Self, qMain.Database, 'MWork','TfmEquipCost', fsGets) do
  383.   try
  384.     lParamId := qMainEQUIPID.AsString;
  385.     lParamValue := qMainMINECOMPLEXID.AsString;
  386.     if ShowModal = mrOk then
  387.     begin
  388.       Self.qMainMINECOMPLEXID.AsString := aReturnThirdId;
  389.       Self.qMainSUBCOMPLEXID.AsString :=  aReturnSecondId;
  390.       Self.qMainEQUIPID.AsString := aReturnId;
  391.       Self.qMainEQUIPNAME.AsString := aReturnName;
  392.       UpdateTeam;
  393.     end;
  394.   finally
  395.     Free;
  396.   end;
  397. end;
  398.  
  399. procedure TfmEstimCalcCost.UpdateTeam;
  400. begin
  401.   if (lFormsState in [fsInsert, fsModify, fsAmend]) and (not qMainEQUIPID.IsNull) then
  402.   with GetQuery('SELECT te.Id, '+
  403.                 '       te.UseEquipName '+
  404.                 '  FROM Team te, '+
  405.                 '       Equipteam et '+
  406.                 ' WHERE te.id = et.teamid '+
  407.                 '   AND et.Equipcostid = '+ qMainEQUIPID.AsString +
  408.                 '   AND et.ComplexId = '+ qMainMINECOMPLEXID.AsString) do
  409.   try
  410.     if RecordCount = 0 then
  411.     begin
  412.       qMainTEAMID.Clear;
  413.       qMainTEAMNAME.Clear;
  414.       dbeTeam.Enabled := False;
  415.       lTeam.Enabled := False;
  416.     end
  417.     else if RecordCount = 1 then
  418.     begin
  419.       qMainTEAMID.AsString := FieldByName('Id').AsString;
  420.       qMainTEAMNAME.AsString := FieldByName('UseEquipName').AsString;
  421.       dbeTeam.Enabled := False;
  422.       lTeam.Enabled := False;
  423.     end
  424.     else
  425.     begin
  426.       qMainTEAMID.Clear;
  427.       qMainTEAMNAME.Clear;
  428.       dbeTeam.Enabled := True;
  429.       lTeam.Enabled := True;
  430.     end;
  431.   finally
  432.     Free;
  433.   end
  434.   else
  435.   begin
  436.     dbeTeam.Enabled := False;
  437.     lTeam.Enabled := False;
  438.   end;
  439. end;
  440.  
  441. procedure TfmEstimCalcCost.ChangeTeam;
  442. begin
  443.   with TfmCustomMDI.CreateFormEx(Self, qMain.Database, 'MWork','TfmTeamWorkerCost', fsGets) do
  444.   try
  445.     lParamValue := qMainEQUIPID.AsString;
  446.     if ShowModal = mrOk then
  447.       qMainTEAMID.AsString := aReturnId;
  448.       qMainTEAMNAME.AsString := aReturnName;
  449.   finally
  450.     Free;
  451.   end;
  452. end;
  453.  
  454. procedure TfmEstimCalcCost.UpdateComplexContent;
  455. begin
  456.   if not qMainSUBCOMPLEXID.IsNull then
  457.   begin
  458.     pcComplexContent.Visible := True;
  459.     pcComplexContent.ActivePageIndex := qMainSUBCOMPLEXID.AsInteger - 1;
  460.   end
  461.   else
  462.     pcComplexContent.Visible := False;
  463. end;
  464.  
  465. procedure TfmEstimCalcCost.qMainSUBCOMPLEXIDChange(Sender: TField);
  466. begin
  467.   inherited;
  468.   UpdateComplexContent;
  469. end;
  470.  
  471. procedure TfmEstimCalcCost.qMainAfterOpen(DataSet: TDataSet);
  472. begin
  473.   inherited;
  474.   UpdateComplexContent;
  475.   UpdateComplexContentPage;
  476. end;
  477.  
  478. procedure TfmEstimCalcCost.qMainAfterScroll(DataSet: TDataSet);
  479. begin
  480.   inherited;
  481.   UpdateComplexContent;
  482.   UpdateComplexContentPage;
  483. end;
  484.  
  485. procedure TfmEstimCalcCost.UpdateComplexContentPage;
  486. begin
  487.   dbeMachineWork.EditButtons.Items[0].Visible := (lFormsState in [fsInsert, fsModify, fsAmend]);
  488.   dbeTeam.EditButtons.Items[0].Visible := (lFormsState in [fsInsert, fsModify, fsAmend]);
  489.  
  490.   case qMainSUBCOMPLEXID.AsInteger of
  491.   1:begin
  492.       lAngleSlope.Enabled := (qMainEQUIPID.AsInteger >= 1) and (qMainEQUIPID.AsInteger <= 59);
  493.       dbeAngleSlope.Enabled := (qMainEQUIPID.AsInteger >= 1) and (qMainEQUIPID.AsInteger <= 59);
  494.       if (qMainEQUIPID.AsInteger >= 1) and (qMainEQUIPID.AsInteger <= 59) then
  495.         dbeAngleSlope.DataField := 'ANGLESLOPE'
  496.       else
  497.         dbeAngleSlope.DataField := '';
  498.       lTubVolume.Enabled := (qMainEQUIPID.AsInteger >= 1) and (qMainEQUIPID.AsInteger <= 17);
  499.       dbTubVolume.Enabled := (qMainEQUIPID.AsInteger >= 1) and (qMainEQUIPID.AsInteger <= 17);
  500.       lWagonVolume.Enabled := (qMainEQUIPID.AsInteger >= 18) and (qMainEQUIPID.AsInteger <= 29);
  501.       dbWagonVolume.Enabled := (qMainEQUIPID.AsInteger >= 18) and (qMainEQUIPID.AsInteger <= 29);
  502.       lUse4EmergencyExit.Enabled := (qMainEQUIPID.AsInteger >= 18) and (qMainEQUIPID.AsInteger <= 29);
  503.       cbUse4EmergencyExit.Enabled := (qMainEQUIPID.AsInteger >= 18) and (qMainEQUIPID.AsInteger <= 29);
  504.       lEquipLiftingRenditionType.Enabled := (qMainEQUIPID.AsInteger >= 1) and (qMainEQUIPID.AsInteger <= 17);
  505.       cbEquipLiftingRenditionType.Enabled := (qMainEQUIPID.AsInteger >= 1) and (qMainEQUIPID.AsInteger <= 17);
  506.       lInitDepthTrunk.Enabled := (qMainEQUIPID.AsInteger >= 1) and (qMainEQUIPID.AsInteger <= 17);
  507.       dbeInitDepthTrunk.Enabled := (qMainEQUIPID.AsInteger >= 1) and (qMainEQUIPID.AsInteger <= 17);
  508.       lUseCounterWeight.Enabled := (qMainEQUIPID.AsInteger >= 18) and (qMainEQUIPID.AsInteger <= 29);
  509.       cbUseCounterWeight.Enabled := (qMainEQUIPID.AsInteger >= 18) and (qMainEQUIPID.AsInteger <= 29);
  510.       lTailRopeType.Enabled := (qMainEQUIPID.AsInteger >= 18) and (qMainEQUIPID.AsInteger <= 29);
  511.       cbTailRopeType.Enabled := (qMainEQUIPID.AsInteger >= 18) and (qMainEQUIPID.AsInteger <= 29);
  512.       lDepthHorizont.Enabled := (qMainEQUIPID.AsInteger >= 1) and (qMainEQUIPID.AsInteger <= 29);
  513.       cbDepthHorizont.Enabled := (qMainEQUIPID.AsInteger >= 1) and (qMainEQUIPID.AsInteger <= 29);
  514.     end;
  515.   2:begin
  516.       lWinchLiftingRenditionType.Enabled := (qMainEQUIPID.AsInteger >= 30) and (qMainEQUIPID.AsInteger <= 39);
  517.       cblWinchLiftingRenditionType.Enabled := (qMainEQUIPID.AsInteger >= 30) and (qMainEQUIPID.AsInteger <= 39);
  518.       if cblWinchLiftingRenditionType.Enabled then
  519.         cblWinchLiftingRenditionType.DataField := 'RENDITIONTYPEID'
  520.       else
  521.         cblWinchLiftingRenditionType.DataField := '';
  522.     end;
  523.   3:begin
  524.       lPresentRegimentShelf.Enabled := (cbUseOnlyZeroFrame.Checked);
  525.       cbPresentRegimentShelf.Enabled := (cbUseOnlyZeroFrame.Checked);
  526.     end;
  527.   8:begin
  528.       lCentroPumpCount.Enabled := (qMainEQUIPID.AsInteger >= 70) and (qMainEQUIPID.AsInteger <= 95);
  529.       cbCentroPumpCount.Enabled := (qMainEQUIPID.AsInteger >= 70) and (qMainEQUIPID.AsInteger <= 95);
  530.  
  531.       lMinePumpCount.Enabled := (qMainEQUIPID.AsInteger >= 96) and (qMainEQUIPID.AsInteger <= 98);
  532.       cbMinePumpCount.Enabled := (qMainEQUIPID.AsInteger >= 96) and (qMainEQUIPID.AsInteger <= 98);
  533.  
  534.       lFactWaterFlow.Enabled := ((qMainEQUIPID.AsInteger >= 70) and (qMainEQUIPID.AsInteger <= 95)) or (qMainEQUIPID.AsInteger = 100);
  535.       edFactWaterFlow.Enabled := ((qMainEQUIPID.AsInteger >= 70) and (qMainEQUIPID.AsInteger <= 95)) or (qMainEQUIPID.AsInteger = 100);
  536.  
  537.       lMainMachine.Enabled := (qMainEQUIPID.AsInteger >= 70) and (qMainEQUIPID.AsInteger <= 95);
  538.       cbMainMachine.Enabled := (qMainEQUIPID.AsInteger >= 70) and (qMainEQUIPID.AsInteger <= 95);
  539.  
  540.       lWorkingPumpNumber.Enabled := (qMainEQUIPID.AsInteger >= 70) and (qMainEQUIPID.AsInteger <= 95);
  541.       lWorkingPumpNumber.Enabled := (qMainEQUIPID.AsInteger >= 70) and (qMainEQUIPID.AsInteger <= 95);
  542.     end;
  543.   10:begin
  544.       lFactEquipPower.Enabled := (qMainEQUIPID.AsInteger >= 102) and (qMainEQUIPID.AsInteger <= 116);
  545.       edFactEquipPower.Enabled := (qMainEQUIPID.AsInteger >= 102) and (qMainEQUIPID.AsInteger <= 116);
  546.  
  547.       lRenditionType.Enabled := (qMainEQUIPID.AsInteger >= 117) and (qMainEQUIPID.AsInteger <= 127);
  548.       cbRenditionType.Enabled := (qMainEQUIPID.AsInteger >= 117) and (qMainEQUIPID.AsInteger <= 127);
  549.  
  550.       lFanCount.Enabled := (qMainEQUIPID.AsInteger >= 117) and (qMainEQUIPID.AsInteger <= 127);
  551.       edFanCount.Enabled := (qMainEQUIPID.AsInteger >= 117) and (qMainEQUIPID.AsInteger <= 127);
  552.     end;
  553.   18:begin
  554.       lMineWork.Enabled :=  (qMainEQUIPID.AsInteger >= 163) and (qMainEQUIPID.AsInteger <= 165);
  555.       cbMineWork.Enabled :=  (qMainEQUIPID.AsInteger >= 163) and (qMainEQUIPID.AsInteger <= 165);
  556.    end;
  557.   end;
  558. end;
  559.  
  560. procedure TfmEstimCalcCost.dbeTeamEditButtons0Click(Sender: TObject;
  561.   var Handled: Boolean);
  562. begin
  563.   inherited;
  564.   ChangeTeam;
  565. end;
  566.  
  567. procedure TfmEstimCalcCost.SetState(aFormsState: TFormsState);
  568. begin
  569.   inherited;
  570.   UpdateComplexContentPage;
  571.   if (aFormsState = fsAmend) then
  572.     UpdateTeam;
  573. end;
  574.  
  575. procedure TfmEstimCalcCost.qMainEQUIPIDChange(Sender: TField);
  576. begin
  577.   inherited;
  578.   UpdateComplexContentPage;
  579. end;
  580.  
  581. procedure TfmEstimCalcCost.cbUseOnlyZeroFrameClick(Sender: TObject);
  582. begin
  583.   inherited;
  584.   UpdateComplexContentPage;
  585. end;
  586.  
  587. procedure TfmEstimCalcCost.acInsertExecute(Sender: TObject);
  588. begin
  589.   inherited;
  590.   UpdateTeam;
  591. end;
  592.  
  593. procedure TfmEstimCalcCost.acEditExecute(Sender: TObject);
  594. begin
  595.   inherited;
  596.   UpdateTeam;
  597. end;
  598.  
  599. initialization
  600.   RegisterClass(TfmEstimCalcCost);
  601.  
  602. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement