unit SysEditServiceID; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Mask, ToolEdit, dbtables, Db, DBCtrls; type TSysEditServiceIDForm = class(TForm) lblID: TLabel; edtID: TEdit; lblDescription: TLabel; edtDescription: TEdit; lblServiceID: TLabel; edtServiceID: TEdit; lblService: TLabel; edtService: TEdit; lblServiceTypeID: TLabel; edtServiceTypeID: TEdit; lblActivityID: TLabel; edtActivityID: TEdit; lblElementID: TLabel; edtElementID: TEdit; lblSubledgerID: TLabel; edtSubledgerID: TEdit; lblLocationID: TLabel; edtLocationID: TEdit; lblPersonID: TLabel; edtPersonID: TEdit; lblCurrentRent: TLabel; edtCurrentRent: TEdit; lblPreviousRent: TLabel; edtPreviousRent: TEdit; lblSupplierAccountID: TLabel; edtSupplierAccountID: TEdit; lblCustomerCentreID: TLabel; edtCustomerCentreID: TEdit; lblCustomerActivityID: TLabel; edtCustomerActivityID: TEdit; lblCentreID: TLabel; edtCentreID: TEdit; lblCentre: TLabel; edtCentre: TEdit; lblServiceType: TLabel; edtServiceType: TEdit; lblActivity: TLabel; edtActivity: TEdit; lblElement: TLabel; edtElement: TEdit; lblSubledger: TLabel; edtSubledger: TEdit; lblLocation: TLabel; edtLocation: TEdit; lblPerson: TLabel; edtPerson: TEdit; lblCurrentCalls: TLabel; edtCurrentCalls: TEdit; lblPreviousCalls: TLabel; edtPreviousCalls: TEdit; lblSupplierAccount: TLabel; edtSupplierAccount: TEdit; lblCustomerCentre: TLabel; edtCustomerCentre: TEdit; lblCustomerActivity: TLabel; edtCustomerActivity: TEdit; lblCustomerElement: TLabel; edtCustomerElement: TEdit; lblCustomerSubledger: TLabel; edtCustomerSubledger: TEdit; lblCustomerElementID: TLabel; edtCustomerElementID: TEdit; lblCustomerSubledgerID: TLabel; edtCustomerSubledgerID: TEdit; lblSACCNumber: TLabel; edtSACCNumber: TEdit; lblInstallationDate: TLabel; edtInstallationDate: TDateEdit; lblTerminationDate: TLabel; edtTerminationDate: TDateEdit; btnOk: TButton; btnCancel: TButton; edtServiceCode: TEdit; lblPayType: TLabel; lblApplication: TLabel; lblServiceCode: TLabel; edtPayType: TEdit; edtJobno: TEdit; lblJobNo: TLabel; qApplication: TQuery; dsApplication: TDataSource; cbApplication: TComboBox; lblKpiDescription: TLabel; cbKpiDescription: TComboBox; btnSave: TButton; q: TQuery; btnDetails: TButton; procedure btnOkClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure btnSaveClick(Sender: TObject); procedure btnDetailsClick(Sender: TObject); procedure UpdateDetailsForm; procedure RetrieveDetails; private { Private declarations } AmendString : TStringList; AmendValueString : TStringList; lAppend : boolean; aApplication : array of integer; aKpiID : array of integer; sUserName : string; AuditString : TStringlist; lAudit : boolean; AuditActionUpdate : string; AuditActionDelete : string; AuditActionInsert : string; FirstTimeForDetails : boolean; Original_ID : string; Original_ApplicationID : string; Original_Description : string; Original_SACC : string; Original_ServiceID : string; Original_Service : string; Original_ServiceName : string; Original_ServiceTypeID : string; Original_ServiceTypeName : string; Original_SupplierAccountID : string; Original_SupplierAccountName : string; Original_PayType : string; Original_ServiceCode : string; Original_CentreID : string; Original_CentreName : string; Original_ActivityID : string; Original_ActivityName : string; Original_ElementID : string; Original_ElementName : string; Original_SubledgerID : string; Original_SubledgerName : string; Original_LocationID : string; Original_LocationName : string; Original_PersonID : string; Original_PersonName : string; Original_CustomerCentreID : string; Original_CustomerCentreName : string; Original_CustomerActivityID : string; Original_CustomerActivityName: string; Original_CustomerElementID : string; Original_CustomerElementName : string; Original_CustomerSubledgerID : string; Original_CustomerSubledgerName: string; Original_CurrentRent : string; Original_CurrentCalls : string; Original_PreviousRent : string; Original_PreviousCalls : string; Original_InstallationDate: string; Original_TerminationDate : string; Original_Jobno : string; Original_ServiceKpiID : string; protected procedure SetAppend(Value: boolean); procedure SetApplicationID(Value: integer); function GetApplicationID: integer; procedure SetID(const Value: integer); function GetID: integer; procedure SetSACC(const Value: string); function GetSACC: string; procedure SetDescription(const Value: string); function GetDescription: string; procedure SetServiceID(const Value: string); function GetServiceID: string; procedure SetService(const Value: string); function GetService: string; procedure SetServiceName(const Value: string); procedure SetServiceTypeID(const Value: integer); function GetServiceTypeID: integer; procedure SetServiceTypeName(const Value: string); procedure SetSupplierAccountID(const Value: integer); function GetSupplierAccountID: integer; procedure SetSupplierAccountName(const Value: string); procedure SetPayType(const Value: string); function GetPayType: string; procedure SetServiceCode(const Value: string); function GetServiceCode: string; procedure SetCentreID(const Value: integer); function GetCentreID: integer; procedure SetCentreName(const Value: string); procedure SetActivityID(const Value: integer); function GetActivityID: integer; procedure SetActivityName(const Value: string); procedure SetElementID(const Value: integer); function GetElementID: integer; procedure SetElementName(const Value: string); procedure SetSubledgerID(const Value: integer); function GetSubledgerID: integer; procedure SetSubledgerName(const Value: string); procedure SetLocationID(const Value: integer); function GetLocationID: integer; procedure SetLocationName(const Value: string); procedure SetPersonID(const Value: integer); function GetPersonID: integer; procedure SetPersonName(const Value: string); procedure SetCustomerCentreID(const Value: integer); function GetCustomerCentreID: integer; procedure SetCustomerCentreName(const Value: string); procedure SetCustomerActivityID(const Value: integer); function GetCustomerActivityID: integer; procedure SetCustomerActivityName(const Value: string); procedure SetCustomerElementID(const Value: integer); function GetCustomerElementID: integer; procedure SetCustomerElementName(const Value: string); procedure SetCustomerSubledgerID(const Value: integer); function GetCustomerSubledgerID: integer; procedure SetCustomerSubledgerName(const Value: string); procedure SetCurrentRent(const Value: Currency); function GetCurrentRent: Currency; procedure SetCurrentCalls(const Value: Currency); function GetCurrentCalls: Currency; procedure SetPreviousRent(const Value: Currency); function GetPreviousRent: Currency; procedure SetPreviousCalls(const Value: Currency); function GetPreviousCalls: Currency; procedure SetInstallationDate(const Value: TDateTime); function GetInstallationDate: TDateTime; procedure SetTerminationDate(const Value: TDateTime); function GetTerminationDate: TDateTime; procedure SetJobno(const Value: string); function GetJobno: string; procedure SetServiceKpiID(const Value: integer); function GetServiceKpiID: integer; procedure SetUpMDF(const Value: string); function GetUpMDF: string; procedure SetUpEnd(const Value: string); function GetUpEnd: string; procedure SetDownMDF(const Value: string); function GetDownMDF: string; procedure SetDownEnd(const Value: string); function GetDownEnd: string; procedure SetLineLength(const Value: string); function GetLineLength: string; procedure SetCost(const Value: Currency); function GetCost: Currency; procedure SetCost100(const Value: Currency); function GetCost100: Currency; procedure SetInvoiced(const Value: Currency); function GetInvoiced: Currency; procedure SetNo(const Value: string); function GetNo: string; procedure SetPart(const Value: string); function GetPart: string; procedure SetDrawing(const Value: string); function GetDrawing: string; procedure SetMuxLink(const Value: string); function GetMuxLink: string; procedure SetServiceLink(const Value: string); function GetServiceLink: string; procedure SetMux(const Value: string); function GetMux: string; procedure SetCh(const Value: string); function GetCh: string; procedure SetMake(const Value: string); function GetMake: string; procedure SetBearerID(const Value: integer); function GetBearerID: integer; procedure SetBearerName(const Value: string); function GetBearerName: string; procedure SetSpeedID(const Value: integer); function GetSpeedID: integer; // procedure SetSpeedName(const Value: string); // function GetSpeedName: string; procedure SetModemTypeID(const Value: integer); function GetModemTypeID: integer; // procedure SetModemTypeName(const Value: string); // function GetModemTypeName: string; procedure SetLineID(const Value: integer); function GetLineID: integer; procedure SetLineName(const Value: string); function GetLineName: string; procedure SetAuthorityID(const Value: integer); function GetAuthorityID: integer; // procedure SetAuthorityName(const Value: string); // function GetAuthorityName: string; procedure SetVirtualCableID(const Value: integer); function GetVirtualCableID: integer; procedure SetVirtualCableName(const Value: string); function GetVirtualCableName: string; procedure SetMnemonicID(const Value: integer); function GetMnemonicID: integer; // procedure SetMnemonicName(const Value: string); // function GetMnemonicName: string; procedure UpdateForm; procedure SaveData(var lSuccess: boolean); published property AppendMode: boolean read lAppend write SetAppend; property ApplicationID: integer read GetApplicationID write SetApplicationID; property ID: integer read GetID write SetID; property Description: string read GetDescription write SetDescription; property SACCNumber: string read GetSACC write SetSACC; property ServiceID: string read GetServiceID write SetServiceID; property Service: string read GetService write SetService; property ServiceName: string write SetServiceName; property ServiceTypeID: integer read GetServiceTypeID write SetServiceTypeID; property ServiceTypeName: string write SetServiceTypeName; property SupplierAccountID: integer read GetSupplierAccountID write SetSupplierAccountID; property SupplierAccountName: string write SetSupplierAccountName; property PayType: string read GetPayType write SetPayType; property ServiceCode: string read GetServiceCode write SetServiceCode; property CentreID: integer read GetCentreID write SetCentreID; property CentreName: string write SetCentreName; property ActivityID: integer read GetActivityID write SetActivityID; property ActivityName: string write SetActivityName; property ElementID: integer read GetElementID write SetElementID; property ElementName: string write SetElementName; property SubledgerID: integer read GetSubledgerID write SetSubledgerID; property SubledgerName: string write SetSubledgerName; property LocationID: integer read GetLocationID write SetLocationID; property LocationName: string write SetLocationName; property PersonID: integer read GetPersonID write SetPersonID; property PersonName: string write SetPersonName; property CustomerCentreID: integer read GetCustomerCentreID write SetCustomerCentreID; property CustomerCentreName: string write SetCustomerCentreName; property CustomerActivityID: integer read GetCustomerActivityID write SetCustomerActivityID; property CustomerActivityName: string write SetCustomerActivityName; property CustomerElementID: integer read GetCustomerElementID write SetCustomerElementID; property CustomerElementName: string write SetCustomerElementName; property CustomerSubledgerID: integer read GetCustomerSubledgerID write SetCustomerSubledgerID; property CustomerSubledgerName: string write SetCustomerSubledgerName; property CurrentRent: Currency read GetCurrentRent write SetCurrentRent; property CurrentCalls: Currency read GetCurrentCalls write SetCurrentCalls; property PreviousRent: Currency read GetPreviousRent write SetPreviousRent; property PreviousCalls: Currency read GetPreviousCalls write SetPreviousCalls; property InstallationDate: TDateTime read GetInstallationDate write SetInstallationDate; property TerminationDate: TDateTime read GetTerminationDate write SetTerminationDate; property Jobno: string read GetJobno write SetJobno; property UpMDF: string read GetUpMDF write SetUpMDF; property UpEnd: string read GetUpEnd write SetUpEnd; property DownMDF: string read GetDownMDF write SetDownMDF; property DownEnd: string read GetDownEnd write SetDownEnd; property LineLength: string read GetLineLength write SetLineLength; property No: string read GetNo write SetNo; property Part: string read GetPart write SetPart; property Cost: Currency read GetCost write SetCost; property Cost100: Currency read GetCost100 write SetCost100; property Invoiced: Currency read GetInvoiced write SetInvoiced; property Drawing: string read GetDrawing write SetDrawing; property Make: string read GetMake write SetMake; property Ch: string read GetCh write SetCh; property MuxLink: string read GetMuxLink write SetMuxLink; property Mux: string read GetMux write SetMux; property ServiceLink: string read GetServiceLink write SetServiceLink; property BearerID: integer read GetBearerID write SetBearerID; property BearerName: string read GetBearerName write SetBearerName; property SpeedID: integer read GetSpeedID write SetSpeedID; // property SpeedName: string read GetSpeedName write SetSpeedName; property ModemTypeID: integer read GetModemTypeID write SetModemTypeID; // property ModemTypeName: string read GetModemTypeName write SetModemTypeName; property LineID: integer read GetLineID write SetLineID; property LineName: string read GetLineName write SetLineName; property AuthorityID: integer read GetAuthorityID write SetAuthorityID; // property AuthorityName: string read GetAuthorityName write SetAuthorityName; property VirtualCableID: integer read GetVirtualCableID write SetVirtualCableID; property VirtualCableName: string read GetVirtualCableName write SetVirtualCableName; property MnemonicID: integer read GetMnemonicID write SetMnemonicID; // property MnemonicName: string read GetMnemonicName write SetMnemonicName; property ServiceKpiID: integer read GetServiceKpiID write SetServiceKpiID; public { Public declarations } end; var SysEditServiceIDForm: TSysEditServiceIDForm; implementation uses DataMod, DateFunctions, GenFns, PPSysMain, SysServiceRecord; {$R *.DFM} var SysServiceRecordForm: TSysServiceRecordForm; // Temporary storage for sub-screen. SetServiceID_Original_Values : boolean; ValueLineLength : string; ValueUpMDF : string; ValueUpEnd : string; ValueDownMDF : string; ValueDownEnd : string; ValueNo : string; ValuePart : string; ValueBearerID : integer; ValueBearerName : string; ValueSpeedID : integer; // ValueSpeedName : string; ValueDrawing : string; ValueModemTypeID : integer; // ValueModemTypeName : string; ValueCost : Currency; ValueCost100 : Currency; ValueInvoiced : Currency; ValueMake : string; ValueCh : string; ValueMuxLink : string; ValueMux : string; ValueLineID : integer; ValueLineName : string; ValueApplicationID : integer; ValueApplicationName : string; ValueAuthorityID : integer; // ValueAuthorityName : string; ValueVirtualCableID : integer; ValueVirtualCableName: string; ValueServiceLink : string; ValueMnemonicID : integer; ValueMnemonicName : string; Original_No : string; Original_Part : string; Original_UpMDF : string; Original_UpEnd : string; Original_DownMDF : string; Original_DownEnd : string; Original_LineLength : string; Original_BearerID : string; Original_BearerName : string; Original_SpeedID : string; // Original_SpeedName : string; Original_Drawing : string; Original_ModemTypeID : string; // Original_ModemTypeName : string; Original_Cost : string; Original_Cost100 : string; Original_Invoiced : string; Original_Make : string; Original_Ch : string; Original_MuxLink : string; Original_Mux : string; Original_LineID : string; Original_LineName : string; Original_ApplicationName : string; Original_AuthorityID : string; // Original_AuthorityName : string; Original_VirtualCableID : string; Original_VirtualCableName: string; Original_ServiceLink : string; Original_MnemonicID : string; // Original_MnemonicName : string; procedure TSysEditServiceIDForm.FormCreate(Sender: TObject); var // q : TQuery; nCount : integer; ActionDescription : string; begin lAppend := False; AmendString := TStringList.Create; AmendValueString := TStringList.Create; AuditString := TStringList.Create; FirstTimeForDetails := True; SetServiceID_Original_Values := True; Original_ID := ''; Original_SACC := ''; Original_Description := ''; Original_ServiceID := ''; Original_Service := ''; Original_ServiceName := ''; Original_ServiceTypeID := ''; Original_ServiceTypeName := ''; Original_PayType := ''; Original_ServiceCode := ''; Original_CentreID := ''; Original_CentreName := ''; Original_ActivityID := ''; Original_ActivityName := ''; Original_ElementID := ''; Original_ElementName := ''; Original_SubledgerID := ''; Original_SubledgerName := ''; Original_LocationID := ''; Original_LocationName := ''; Original_PersonID := ''; Original_PersonName := ''; Original_CustomerCentreID := ''; Original_CustomerCentreName := ''; Original_CustomerActivityID := ''; Original_CustomerActivityName := ''; Original_CustomerElementID := ''; Original_CustomerElementName := ''; Original_CustomerSubledgerID := ''; Original_CustomerSubledgerName := ''; Original_CurrentRent := CurrToStr(0.00); Original_CurrentCalls := CurrToStr(0.00); Original_PreviousRent := CurrToStr(0.00); Original_PreviousCalls := CurrToStr(0.00); Original_InstallationDate := ''; Original_TerminationDate := ''; Original_Jobno := ''; Original_UpMDF := ''; Original_UpEnd := ''; Original_DownMDF := ''; Original_DownEnd := ''; Original_LineLength := ''; Original_No := ''; Original_Part := ''; Original_BearerID := ''; Original_BearerName := ''; Original_SpeedID := ''; // Original_SpeedName := ''; Original_Drawing := ''; Original_ModemTypeID := ''; // Original_ModemTypeName := ''; Original_Cost := CurrToStr(0.00); Original_Cost100 := CurrToStr(0.00); Original_Make := ''; Original_Ch := ''; Original_MuxLink := ''; Original_Mux := ''; Original_LineID := ''; Original_LineName := ''; Original_Invoiced := CurrToStr(0.00); Original_ApplicationID := ''; Original_ApplicationName := ''; Original_AuthorityID := ''; // Original_AuthorityName := ''; Original_VirtualCableID := ''; Original_VirtualCableName:= ''; Original_ServiceLink := ''; Original_MnemonicID := ''; // Original_MnemonicName := ''; // Temporary storage for sub-screen. ValueNo := ''; ValuePart := ''; ValueBearerID := 0; ValueBearerName := ''; ValueSpeedID := 0; // ValueSpeedName := ''; ValueDrawing := ''; ValueModemTypeID := 0; // ValueModemTypeName := ''; ValueCost := 0; ValueCost100 := 0; ValueMake := ''; ValueCh := ''; ValueMuxLink := ''; ValueMux := ''; ValueLineID := 0; ValueLineName := ''; ValueInvoiced := 0; ValueApplicationID := 0; ValueApplicationName := ''; ValueAuthorityID := 0; // ValueAuthorityName := ''; ValueVirtualCableID := 0; ValueVirtualCableName:= ''; ValueServiceLink := ''; ValueMnemonicID := 0; // ValueMnemonicName := ''; Original_ServiceKpiID := ''; sUserName := Trim(MainForm.OPERATORNAME); // q := TQuery.Create(SELF); // q.DatabaseName := 'dbPPdata'; // Read the audit event IDs. q.Close; q.SQL.Clear; q.SQL.Add('SELECT *'); q.SQL.Add('FROM tEvent'); q.SQL.Add('WHERE Description LIKE ''Reference%'''); q.Open; while not q.Eof do begin ActionDescription := UpperCase(q.FieldByName('Description').AsString); if (Pos('UPDATE', ActionDescription) > 0) then AuditActionUpdate := q.FieldByName('id').AsString else if (Pos('DELETE', ActionDescription) > 0) then AuditActionDelete := q.FieldByName('id').AsString else if (Pos('INSERT', ActionDescription) > 0) then AuditActionInsert := q.FieldByName('id').AsString; q.Next; end; q.Close; q.SQL.Clear; q.SQL.Add('SELECT Count(*) AS nMax'); q.SQL.Add('FROM tApplication'); q.Open; if not q.Eof then SetLength(aApplication, q.FieldByName('nMax').AsInteger); q.Close; q.SQL.Clear; q.SQL.Add('SELECT *'); q.SQL.Add('FROM tApplication'); q.SQL.Add('WHERE Active = 1'); q.SQL.Add('ORDER BY Description'); q.Open; if not q.Eof then begin nCount := -1; while not q.Eof do begin cbApplication.Items.Add(q.FieldByName('Description').AsString); Inc(nCount); aApplication[nCount] := q.FieldByName('ID').AsInteger; q.Next; end; // while. end; // q.Eof. q.Close; q.SQL.Clear; q.SQL.Add('SELECT Count(*) AS nMax'); q.SQL.Add('FROM tServiceKPI'); q.SQL.Add('WHERE Active = 1'); q.Open; if not q.Eof then SetLength(aKpiID, 1 + q.FieldByName('nMax').AsInteger); q.Close; q.SQL.Clear; q.SQL.Add('SELECT ID, RTRIM(KpiNumber + '' '' + Description) AS Description'); q.SQL.Add('FROM tServiceKPI'); q.SQL.Add('WHERE Active = 1'); q.SQL.Add('ORDER BY KpiNumber'); q.Open; if not q.Eof then begin nCount := 0; cbKpiDescription.Items.Add(''); // Allows user to NOT select a KPI. aKpiID[nCount] := 0; while not q.Eof do begin cbKpiDescription.Items.Add(q.FieldByName('Description').AsString); Inc(nCount); aKpiID[nCount] := q.FieldByName('ID').AsInteger; q.Next; end; // while. end; // q.Eof. q.Close; q.SQL.Clear; q.SQL.Add(''); // q.Free; SysServiceRecordForm := TSysServiceRecordForm.Create(MainForm); SysServiceRecordForm.Hide; lAudit := TestForAudit('tServiceID'); end; // FormCreate. procedure TSysEditServiceIDForm.FormClose(Sender: TObject; var Action: TCloseAction); begin AmendString.Free; AmendValueString.Free; end; // FormClose. procedure TSysEditServiceIDForm.SetAppend(Value: boolean); begin lAppend := Value; // Global variable in this file. if lAppend then begin Caption := Caption + ' (ADD)'; end // if lAppend then begin. else begin Caption := Caption + ' (EDIT)'; end; // if lAppend then begin..else. end; // SetAppend. procedure TSysEditServiceIDForm.SetApplicationID(Value: integer); var sSelected : string; iCount : integer; begin if (Value > 0) then begin sSelected := IntToStr(Value); for iCount := 0 to cbApplication.Items.Count - 1 do begin if (aApplication[iCount] = Value) then begin cbApplication.ItemIndex := iCount; Original_ApplicationID := sSelected; break; end; end; end; { begin Original_ApplicationID := IntToStr(Value); cbApplication.KeyValue := Value; if (Original_ApplicationID = '0') then Original_ApplicationID := ''; } end; // SetApplicationID. function TSysEditServiceIDForm.GetApplicationID: integer; var nSelected : integer; begin nSelected := cbApplication.ItemIndex; if (nSelected < 0) or (Length(Trim(cbApplication.Text)) = 0) then Result := 0 else Result := aApplication[nSelected]; { begin if (Length(Trim(cbApplication.Text)) > 0) then Result := qApplication.FieldByName('id').AsInteger else Result := 0; } end; // SetAppend. procedure TSysEditServiceIDForm.SetID(const Value: integer); begin if (Value = 0) then Original_ID := '' else Original_ID := IntToStr(Value); edtID.Text := Original_ID; end; // SetID. function TSysEditServiceIDForm.GetID: integer; var StrValue : string; begin StrValue := Trim(edtID.Text); if Length(StrValue) = 0 then Result := 0 else Result := StrToInt(StrValue); end; // GetID. procedure TSysEditServiceIDForm.SetDescription(const Value: string); begin Original_Description := Trim(Value); edtDescription.Text := Original_Description; end; // SetDescription. function TSysEditServiceIDForm.GetDescription: string; begin Result := Trim(edtDescription.Text); end; // GetDescription. procedure TSysEditServiceIDForm.SetSACC(const Value: string); begin Original_SACC := Trim(Value); edtSACCNumber.Text := Original_SACC; end; // SetSACC. function TSysEditServiceIDForm.GetSACC: string; begin Result := Trim(edtSACCNumber.Text); end; // GetSACC. procedure TSysEditServiceIDForm.SetServiceID(const Value: string); begin Original_ServiceID := Value; edtServiceID.Text := Original_ServiceID; end; // SetServiceID. function TSysEditServiceIDForm.GetServiceID: string; begin Result := Trim(edtServiceID.Text); end; // GetServiceID. procedure TSysEditServiceIDForm.SetService(const Value: string); begin Original_Service := Value; edtService.Text := Original_Service; end; // SetService. function TSysEditServiceIDForm.GetService: string; begin Result := Trim(edtService.Text); end; // GetService procedure TSysEditServiceIDForm.SetServiceName(const Value: string); begin Original_ServiceName := Trim(Value); edtService.Text := Original_ServiceName; end; // SetService. procedure TSysEditServiceIDForm.SetSupplierAccountID(const Value: integer); begin Original_SupplierAccountID := IntToStr(Value); edtSupplierAccountID.Text := Original_SupplierAccountID; end; // SetSupplierAccountID. function TSysEditServiceIDForm.GetSupplierAccountID: integer; var StrValue : string; begin StrValue := Trim(edtSupplierAccountID.Text); if Length(StrValue) = 0 then Result := 0 else Result := StrToInt(StrValue); end; // GetSupplierAccountID. procedure TSysEditServiceIDForm.SetSupplierAccountName(const Value: string); begin Original_SupplierAccountName := Trim(Value); edtSupplierAccount.Text := Original_SupplierAccountName; end; // SetSupplierAccountName. procedure TSysEditServiceIDForm.SetPayType(const Value: string); begin Original_PayType := Trim(Value); edtPayType.Text := Original_PayType; end; // SetPayType. function TSysEditServiceIDForm.GetPayType: string; begin Result := Trim(edtPayType.Text); end; // GetPayType. procedure TSysEditServiceIDForm.SetServiceCode(const Value: string); begin Original_ServiceCode := Trim(Value); edtServiceCode.Text := Original_ServiceCode; end; // SetServiceCode. function TSysEditServiceIDForm.GetServiceCode: string; begin Result := Trim(edtServiceCode.Text); end; // GetServiceCode. procedure TSysEditServiceIDForm.SetServiceTypeID(const Value: integer); begin Original_ServiceTypeID := IntToStr(Value); edtServiceTypeID.Text := Original_ServiceTypeID; end; // SetServiceTypeID. function TSysEditServiceIDForm.GetServiceTypeID: integer; var StrValue : string; begin StrValue := Trim(edtServiceTypeID.Text); if Length(StrValue) = 0 then Result := 0 else Result := StrToInt(StrValue); end; // GetServiceTypeID. procedure TSysEditServiceIDForm.SetServiceTypeName(const Value: string); begin Original_ServiceTypeName := Trim(Value); edtServiceType.Text := Original_ServiceTypeName; end; // SetSystemName. procedure TSysEditServiceIDForm.SetCentreID(const Value: integer); begin Original_CentreID := IntToStr(Value); edtCentreID.Text := Original_CentreID; end; // SetCentreID. function TSysEditServiceIDForm.GetCentreID: integer; var StrValue : string; begin StrValue := Trim(edtCentreID.Text); if Length(StrValue) = 0 then Result := 0 else Result := StrToInt(StrValue); end; // GetCentreID. procedure TSysEditServiceIDForm.SetCentreName(const Value: string); begin Original_CentreName := Trim(Value); edtCentre.Text := Original_CentreName; end; // SetCentreName. procedure TSysEditServiceIDForm.SetActivityID(const Value: integer); begin Original_ActivityID := IntToStr(Value); edtActivityID.Text := Original_ActivityID; end; // SetActivityID. function TSysEditServiceIDForm.GetActivityID: integer; var StrValue : string; begin StrValue := Trim(edtActivityID.Text); if Length(StrValue) = 0 then Result := 0 else Result := StrToInt(StrValue); end; // GetActivityID. procedure TSysEditServiceIDForm.SetActivityName(const Value: string); begin Original_ActivityName := Trim(Value); edtActivity.Text := Original_ActivityName; end; // SetActivityName. procedure TSysEditServiceIDForm.SetElementID(const Value: integer); begin Original_ElementID := IntToStr(Value); edtElementID.Text := Original_ElementID; end; // SetElementID. function TSysEditServiceIDForm.GetElementID: integer; var StrValue : string; begin StrValue := Trim(edtElementID.Text); if Length(StrValue) = 0 then Result := 0 else Result := StrToInt(StrValue); end; // GetElementID. procedure TSysEditServiceIDForm.SetElementName(const Value: string); begin Original_ElementName := Trim(Value); edtElement.Text := Original_ElementName; end; // SetElementName. procedure TSysEditServiceIDForm.SetSubledgerID(const Value: integer); begin Original_SubledgerID := IntToStr(Value); edtSubledgerID.Text := Original_SubledgerID; end; // SetSubledgerID. function TSysEditServiceIDForm.GetSubledgerID: integer; var StrValue : string; begin StrValue := Trim(edtSubledgerID.Text); if Length(StrValue) = 0 then Result := 0 else Result := StrToInt(StrValue); end; // GetSubledgerID. procedure TSysEditServiceIDForm.SetSubledgerName(const Value: string); begin Original_SubledgerName := Trim(Value); edtSubledger.Text := Original_SubledgerName; end; // SetSubledgerName. procedure TSysEditServiceIDForm.SetLocationID(const Value: integer); begin Original_LocationID := IntToStr(Value); edtLocationID.Text := Original_LocationID; end; // SetLocationID. function TSysEditServiceIDForm.GetLocationID: integer; var StrValue : string; begin StrValue := Trim(edtLocationID.Text); if Length(StrValue) = 0 then Result := 0 else Result := StrToInt(StrValue); end; // GetLocationID. procedure TSysEditServiceIDForm.SetLocationName(const Value: string); begin Original_LocationName := Trim(Value); edtLocation.Text := Original_LocationName; end; // SetLocationName. procedure TSysEditServiceIDForm.SetPersonID(const Value: integer); begin Original_PersonID := IntToStr(Value); edtPersonID.Text := Original_PersonID; end; // SetPersonID. function TSysEditServiceIDForm.GetPersonID: integer; var StrValue : string; begin StrValue := Trim(edtPersonID.Text); if Length(StrValue) = 0 then Result := 0 else Result := StrToInt(StrValue); end; // GetPersonID. procedure TSysEditServiceIDForm.SetPersonName(const Value: string); begin Original_PersonName := Trim(Value); edtPerson.Text := Original_PersonName; end; // SetPersonName. procedure TSysEditServiceIDForm.SetCustomerCentreID(const Value: integer); begin Original_CustomerCentreID := IntToStr(Value); edtCustomerCentreID.Text := Original_CustomerCentreID; end; // SetCustomerCentreID. function TSysEditServiceIDForm.GetCustomerCentreID: integer; var StrValue : string; begin StrValue := Trim(edtCustomerCentreID.Text); if Length(StrValue) = 0 then Result := 0 else Result := StrToInt(StrValue); end; // GetCustomerCentreID. procedure TSysEditServiceIDForm.SetCustomerCentreName(const Value: string); begin Original_CustomerCentreName := Trim(Value); edtCustomerCentre.Text := Original_CustomerCentreName; end; // SetCustomerCentreName. procedure TSysEditServiceIDForm.SetCustomerActivityID(const Value: integer); begin Original_CustomerActivityID := IntToStr(Value); edtCustomerActivityID.Text := Original_CustomerActivityID; end; // SetCustomerActivityID. function TSysEditServiceIDForm.GetCustomerActivityID: integer; var StrValue : string; begin StrValue := Trim(edtCustomerActivityID.Text); if Length(StrValue) = 0 then Result := 0 else Result := StrToInt(StrValue); end; // GetCustomerActivityID. procedure TSysEditServiceIDForm.SetCustomerActivityName(const Value: string); begin Original_CustomerActivityName := Trim(Value); edtCustomerActivity.Text := Original_CustomerActivityName; end; // SetCustomerActivityName. procedure TSysEditServiceIDForm.SetCustomerElementID(const Value: integer); begin Original_CustomerElementID := IntToStr(Value); edtCustomerElementID.Text := Original_CustomerElementID; end; // SetElementID. function TSysEditServiceIDForm.GetCustomerElementID: integer; var StrValue : string; begin StrValue := Trim(edtCustomerElementID.Text); if Length(StrValue) = 0 then Result := 0 else Result := StrToInt(StrValue); end; // GetCustomerElementID. procedure TSysEditServiceIDForm.SetCustomerElementName(const Value: string); begin Original_CustomerElementName := Trim(Value); edtCustomerElement.Text := Original_CustomerElementName; end; // SetCustomerElementName. procedure TSysEditServiceIDForm.SetCustomerSubledgerID(const Value: integer); begin Original_CustomerSubledgerID := IntToStr(Value); edtCustomerSubledgerID.Text := Original_CustomerSubledgerID; end; // SetCustomerSubledgerID. function TSysEditServiceIDForm.GetCustomerSubledgerID: integer; var StrValue : string; begin StrValue := Trim(edtCustomerSubledgerID.Text); if Length(StrValue) = 0 then Result := 0 else Result := StrToInt(StrValue); end; // GetCustomerSubledgerID. procedure TSysEditServiceIDForm.SetCustomerSubledgerName(const Value: string); begin Original_CustomerSubledgerName := Trim(Value); edtCustomerSubledger.Text := Original_CustomerSubledgerName; end; // SetCustomerSubledgerName. procedure TSysEditServiceIDForm.SetCurrentRent(const Value: Currency); begin Original_CurrentRent := CurrToStr(Value); edtCurrentRent.Text := Original_CurrentRent; end; // SetCurrentRent. function TSysEditServiceIDForm.GetCurrentRent: Currency; begin Result := StrToCurr(edtCurrentRent.Text); end; // GetCurrentRent. procedure TSysEditServiceIDForm.SetPreviousRent(const Value: Currency); begin Original_PreviousRent := CurrToStr(Value); edtPreviousRent.Text := Original_PreviousRent; end; // SetPreviousRent. function TSysEditServiceIDForm.GetPreviousRent: Currency; begin Result := StrToCurr(edtPreviousRent.Text); end; // GetPreviousRent. procedure TSysEditServiceIDForm.SetCurrentCalls(const Value: Currency); begin Original_CurrentCalls := CurrToStr(Value); edtCurrentCalls.Text := Original_CurrentCalls; end; // SetCurrentCalls. function TSysEditServiceIDForm.GetCurrentCalls: Currency; begin Result := StrToCurr(edtCurrentCalls.Text); end; // GetCurrentCalls. procedure TSysEditServiceIDForm.SetPreviousCalls(const Value: Currency); begin Original_PreviousCalls := CurrToStr(Value); edtPreviousCalls.Text := Original_PreviousCalls; end; // SetPreviousRent. function TSysEditServiceIDForm.GetPreviousCalls: Currency; begin Result := StrToCurr(edtPreviousCalls.Text); end; // GetPreviousCalls. procedure TSysEditServiceIDForm.SetInstallationDate(const Value: TDateTime); begin if not VarIsNull(Value) then begin Original_InstallationDate := StandardDateString(Value); edtInstallationDate.Date := Value; end; end; // SetStartDate. function TSysEditServiceIDForm.GetInstallationDate: TDateTime; begin if (Length(Original_InstallationDate)=8) then Result := edtInstallationDate.Date else Result := NULL; end; // GetStartDate. procedure TSysEditServiceIDForm.SetTerminationDate(const Value: TDateTime); begin if not VarIsNull(Value) then begin Original_TerminationDate := StandardDateString(Value); edtTerminationDate.Date := Value; end; end; // SetTerminationDate. function TSysEditServiceIDForm.GetTerminationDate: TDateTime; begin if (Length(Original_TerminationDate)=8) then Result := edtTerminationDate.Date else Result := NULL; end; // GetTerminationDate. procedure TSysEditServiceIDForm.SetJobno(const Value: string); begin Original_Jobno := Trim(Value); edtJobno.Text := Original_Jobno; end; // SetJobno. function TSysEditServiceIDForm.GetJobno: string; begin Result := Trim(edtJobno.Text); end; // GetJobno. procedure TSysEditServiceIDForm.SetUpMDF(const Value: string); begin ValueUpMDF := Trim(Value); if SetServiceID_Original_Values then Original_UpMDF := ValueUpMDF; end; // SetUpMDF. function TSysEditServiceIDForm.GetUpMDF: string; begin Result := ValueUpMDF; end; // GetUpMDF. procedure TSysEditServiceIDForm.SetUpEnd(const Value: string); begin ValueUpEnd := Trim(Value); if SetServiceID_Original_Values then Original_UpEnd := ValueUpEnd; end; // SetUpEnd. function TSysEditServiceIDForm.GetUpEnd: string; begin Result := ValueUpEnd; end; // GetUpEnd. procedure TSysEditServiceIDForm.SetDownMDF(const Value: string); begin ValueDownMDF := Trim(Value); if SetServiceID_Original_Values then Original_DownMDF := ValueDownMDF; end; // SetDownMDF. function TSysEditServiceIDForm.GetDownMDF: string; begin Result := ValueDownMDF; end; // GetDownMDF. procedure TSysEditServiceIDForm.SetDownEnd(const Value: string); begin ValueDownEnd := Trim(Value); if SetServiceID_Original_Values then Original_DownEnd := ValueDownEnd; end; // SetDownEnd. function TSysEditServiceIDForm.GetDownEnd: string; begin Result := ValueDownEnd; end; // GetDownEnd. procedure TSysEditServiceIDForm.SetLineLength(const Value: string); begin ValueLineLength := Trim(Value); if SetServiceID_Original_Values then Original_LineLength := ValueLineLength; end; // SetLineLength. function TSysEditServiceIDForm.GetLineLength: string; begin Result := ValueLineLength; end; // GetLineLength. procedure TSysEditServiceIDForm.SetCost(const Value: Currency); begin ValueCost := Value; if SetServiceID_Original_Values then Original_Cost := CurrToStr(ValueCost); end; // SetCost. function TSysEditServiceIDForm.GetCost: Currency; begin Result := ValueCost; end; // GetCost. procedure TSysEditServiceIDForm.SetCost100(const Value: Currency); begin ValueCost100 := Value; if SetServiceID_Original_Values then Original_Cost100 := CurrToStr(ValueCost100); end; // SetCost100. function TSysEditServiceIDForm.GetCost100: Currency; begin Result := ValueCost100; end; // GetCost100. procedure TSysEditServiceIDForm.SetInvoiced(const Value: Currency); begin ValueInvoiced := Value; if SetServiceID_Original_Values then Original_Invoiced := CurrToStr(ValueInvoiced); end; // SetInvoiced. function TSysEditServiceIDForm.GetInvoiced: Currency; begin Result := ValueInvoiced; end; // GetInvoiced. procedure TSysEditServiceIDForm.SetNo(const Value: string); begin ValueNo := Value; if SetServiceID_Original_Values then Original_No := ValueNo; end; // SetNo. function TSysEditServiceIDForm.GetNo: string; begin Result := ValueNo; end; // GetNo. procedure TSysEditServiceIDForm.SetPart(const Value: string); begin ValuePart := Value; if SetServiceID_Original_Values then Original_Part := ValuePart; end; // SetPart. function TSysEditServiceIDForm.GetPart: string; begin Result := ValuePart; end; // GetPart. procedure TSysEditServiceIDForm.SetDrawing(const Value: string); begin ValueDrawing := Value; if SetServiceID_Original_Values then Original_Drawing := ValueDrawing; end; // SetDrawing. function TSysEditServiceIDForm.GetDrawing: string; begin Result := ValueDrawing; end; // GetDrawing. procedure TSysEditServiceIDForm.SetMake(const Value: string); begin ValueMake := Value; if SetServiceID_Original_Values then Original_Make := ValueMake; end; // SetMake. function TSysEditServiceIDForm.GetMake: string; begin Result := ValueMake; end; // GetMake. procedure TSysEditServiceIDForm.SetCh(const Value: string); begin ValueCh := Value; if SetServiceID_Original_Values then Original_Ch := ValueCh; end; // SetCh. function TSysEditServiceIDForm.GetCh: string; begin Result := ValueCh; end; // GetCh. procedure TSysEditServiceIDForm.SetMuxLink(const Value: string); begin ValueMuxLink := Value; if SetServiceID_Original_Values then Original_MuxLink := ValueMuxLink; end; // SetMuxLink. function TSysEditServiceIDForm.GetMuxLink: string; begin Result := ValueMuxLink; end; // GetMuxLink. procedure TSysEditServiceIDForm.SetServiceLink(const Value: string); begin ValueServiceLink := Value; if SetServiceID_Original_Values then Original_ServiceLink := ValueServiceLink; end; // SetServiceLink. function TSysEditServiceIDForm.GetServiceLink: string; begin Result := ValueServiceLink; end; // GetServiceLink. procedure TSysEditServiceIDForm.SetMux(const Value: string); begin ValueMux := Value; if SetServiceID_Original_Values then Original_Mux := ValueMux; end; // SetMux. function TSysEditServiceIDForm.GetMux: string; begin Result := ValueMux; end; // GetMux. procedure TSysEditServiceIDForm.SetBearerID(const Value: integer); {var iCount : integer;} begin ValueBearerID := Value; if SetServiceID_Original_Values then Original_BearerID := IntToStr(ValueBearerID); { if (Value > 0) then begin sSelected := IntToStr(Value); for iCount := 0 to cbBearerDescription.Items.Count - 1 do begin if (aBearerID[iCount] = Value) then begin cbBearerDescription.ItemIndex := iCount; Original_BearerID := sSelected; break; end; end; end;} end; // SetBearerID. function TSysEditServiceIDForm.GetBearerID: integer; {var nSelected : integer; } begin Result := ValueBearerID; { nSelected := cbBearerDescription.ItemIndex; if (nSelected < 0) or (Length(Trim(cbBearerDescription.Text)) = 0) then Result := 0 else Result := aBearerID[nSelected]; } end; // GetBearerID. procedure TSysEditServiceIDForm.SetBearerName(const Value: string); begin ValueBearerName := Value; if SetServiceID_Original_Values then Original_BearerName := ValueBearerName; end; // SetBearerName. function TSysEditServiceIDForm.GetBearerName: string; begin Result := ValueBearerName; end; // GetBearerName. procedure TSysEditServiceIDForm.SetSpeedID(const Value: integer); {var sSelected : string; iCount : integer; } begin ValueSpeedID := Value; if SetServiceID_Original_Values then Original_SpeedID := IntToStr(ValueSpeedID); { if (Value > 0) then begin sSelected := IntToStr(Value); for iCount := 0 to cbSpeedDescription.Items.Count - 1 do begin if (aSpeedID[iCount] = Value) then begin cbSpeedDescription.ItemIndex := iCount; Original_SpeedID := sSelected; break; end; end; end; } end; // SetSpeedID. function TSysEditServiceIDForm.GetSpeedID: integer; {var nSelected : integer; } begin Result := ValueSpeedID; { nSelected := cbSpeedDescription.ItemIndex; if (nSelected < 0) or (Length(Trim(cbSpeedDescription.Text)) = 0) then Result := 0 else Result := aSpeedID[nSelected]; } end; // GetSpeedID. {procedure TSysEditServiceIDForm.SetSpeedName(const Value: string); begin ValueSpeedName := Value; if SetServiceID_Original_Values then Original_SpeedName := ValueSpeedName; end; // SetSpeedName. } {function TSysEditServiceIDForm.GetSpeedName: string; begin Result := ValueSpeedName; end; // GetSpeedName. } procedure TSysEditServiceIDForm.SetModemTypeID(const Value: integer); {var sSelected : string; iCount : integer; } begin ValueModemTypeID := Value; if SetServiceID_Original_Values then Original_ModemTypeID := IntToStr(ValueModemTypeID); { if (Value > 0) then begin sSelected := IntToStr(Value); for iCount := 0 to cbModemTypeDescription.Items.Count - 1 do begin if (aModemTypeID[iCount] = Value) then begin cbModemTypeDescription.ItemIndex := iCount; Original_ModemTypeID := sSelected; break; end; end; end; } end; // SetModemTypeID. function TSysEditServiceIDForm.GetModemTypeID: integer; {var nSelected : integer; } begin Result := ValueModemTypeID; { nSelected := cbModemTypeDescription.ItemIndex; if (nSelected < 0) or (Length(Trim(cbModemTypeDescription.Text)) = 0) then Result := 0 else Result := aModemTypeID[nSelected]; } end; // GetModemTypeID. {procedure TSysEditServiceIDForm.SetModemTypeName(const Value: string); begin ValueModemTypeName := Value; if SetServiceID_Original_Values then Original_ModemTypeName := ValueModemTypeName; end; // SetModemTypeName. } {function TSysEditServiceIDForm.GetModemTypeName: string; begin Result := ValueModemTypeName; end; // GetModemTypeName. } procedure TSysEditServiceIDForm.SetLineID(const Value: integer); {var sSelected : string; iCount : integer; } begin ValueLineID := Value; if SetServiceID_Original_Values then Original_LineID := IntToStr(ValueLineID); { if (Value > 0) then begin sSelected := IntToStr(Value); for iCount := 0 to cbLineDescription.Items.Count - 1 do begin if (aLineID[iCount] = Value) then begin cbLineDescription.ItemIndex := iCount; Original_LineID := sSelected; break; end; end; end;} end; // SetLineID. function TSysEditServiceIDForm.GetLineID: integer; {var nSelected : integer; } begin Result := ValueLineID; { nSelected := cbLineDescription.ItemIndex; if (nSelected < 0) or (Length(Trim(cbLineDescription.Text)) = 0) then Result := 0 else Result := aLineID[nSelected]; } end; // GetLineID. procedure TSysEditServiceIDForm.SetLineName(const Value: string); begin ValueLineName := Value; if SetServiceID_Original_Values then Original_LineName := ValueLineName; end; // SetLineName. function TSysEditServiceIDForm.GetLineName: string; begin Result := ValueLineName; end; // GetLineName. {procedure TSysEditServiceIDForm.SetApplicationID(const Value: integer); var sSelected : string; iCount : integer; begin if (Value > 0) then begin sSelected := IntToStr(Value); for iCount := 0 to cbApplicationDescription.Items.Count - 1 do begin if (aApplicationID[iCount] = Value) then begin cbApplicationDescription.ItemIndex := iCount; if SetServiceID_Original_Values then Original_ApplicationID := sSelected; break; end; end; end; end; // SetApplicationID. function TSysEditServiceIDForm.GetApplicationID: integer; var nSelected : integer; begin nSelected := cbApplicationDescription.ItemIndex; if (nSelected < 0) or (Length(Trim(cbApplicationDescription.Text)) = 0) then Result := 0 else Result := aApplicationID[nSelected]; end; // GetApplicationID. } procedure TSysEditServiceIDForm.SetAuthorityID(const Value: integer); {var sSelected : string; iCount : integer; } begin ValueAuthorityID := Value; if SetServiceID_Original_Values then Original_AuthorityID := IntToStr(ValueAuthorityID); { if (Value > 0) then begin sSelected := IntToStr(Value); for iCount := 0 to cbAuthorityDescription.Items.Count - 1 do begin if (aAuthorityID[iCount] = Value) then begin cbAuthorityDescription.ItemIndex := iCount; Original_AuthorityID := sSelected; break; end; end; end; } end; // SetAuthorityID. function TSysEditServiceIDForm.GetAuthorityID: integer; {var nSelected : integer; } begin Result := ValueAuthorityID; { nSelected := cbAuthorityDescription.ItemIndex; if (nSelected < 0) or (Length(Trim(cbAuthorityDescription.Text)) = 0) then Result := 0 else Result := aAuthorityID[nSelected]; } end; // GetAuthorityID. {procedure TSysEditServiceIDForm.SetAuthorityName(const Value: string); begin ValueAuthorityName := Value; if SetServiceID_Original_Values then Original_AuthorityName := ValueAuthorityName; end; // SetAuthorityName. } {function TSysEditServiceIDForm.GetAuthorityName: string; begin Result := ValueAuthorityName; end; // GetAuthorityName. } procedure TSysEditServiceIDForm.SetVirtualCableID(const Value: integer); {var sSelected : string; iCount : integer; } begin ValueVirtualCableID := Value; if SetServiceID_Original_Values then Original_VirtualCableID := IntToStr(ValueVirtualCableID); { if (Value > 0) then begin sSelected := IntToStr(Value); for iCount := 0 to cbVirtualCableDescription.Items.Count - 1 do begin if (aVirtualCableID[iCount] = Value) then begin cbVirtualCableDescription.ItemIndex := iCount; Original_VirtualCableID := sSelected; break; end; end; end;} end; // SetVirtualCableID. function TSysEditServiceIDForm.GetVirtualCableID: integer; {var nSelected : integer; } begin Result := ValueVirtualCableID; { nSelected := cbVirtualCableDescription.ItemIndex; if (nSelected < 0) or (Length(Trim(cbVirtualCableDescription.Text)) = 0) then Result := 0 else Result := aVirtualCableID[nSelected]; } end; // GetVirtualCableID. procedure TSysEditServiceIDForm.SetVirtualCableName(const Value: string); begin ValueVirtualCableName := Value; if SetServiceID_Original_Values then Original_VirtualCableName := ValueVirtualCableName; end; // SetVirtualCableName. function TSysEditServiceIDForm.GetVirtualCableName: string; begin Result := ValueVirtualCableName; end; // GetVirtualCableName. procedure TSysEditServiceIDForm.SetMnemonicID(const Value: integer); begin ValueMnemonicID := Value; if SetServiceID_Original_Values then Original_MnemonicID := IntToStr(ValueMnemonicID); end; // SetMnemonicID. function TSysEditServiceIDForm.GetMnemonicID: integer; begin Result := ValueMnemonicID; end; // GetMnemonicID. { procedure TSysEditServiceIDForm.SetMnemonicName(const Value: string); begin ValueMnemonicName := Value; if SetServiceID_Original_Values then Original_MnemonicName := ValueMnemonicName; end; // SetMnemonicName. function TSysEditServiceIDForm.GetMnemonicName: string; begin Result := ValueMnemonicName; end; // GetMnemonicName. } procedure TSysEditServiceIDForm.SetServiceKpiID(const Value: integer); var sSelected : string; iCount : integer; begin if (Value > 0) then begin sSelected := IntToStr(Value); for iCount := 0 to cbKpiDescription.Items.Count - 1 do begin if (aKpiID[iCount] = Value) then begin cbKpiDescription.ItemIndex := iCount; Original_ServiceKpiID := sSelected; break; end; end; end; end; // SetServiceKpiID. function TSysEditServiceIDForm.GetServiceKpiID: integer; var nSelected : integer; begin nSelected := cbKpiDescription.ItemIndex; if (nSelected < 0) or (Length(Trim(cbKpiDescription.Text)) = 0) then Result := 0 else Result := aKpiID[nSelected]; end; // GetServiceKpiID. procedure TSysEditServiceIDForm.UpdateForm; // Called to repopulate the screen after saving the data entered so far. // Only values related to ..ID indexes are to be updated - other fields are // already updated by the User entering the values. var IntString : string; begin IntString := IntToStr(ServiceTypeID); // ServiceTypeID if (ServiceTypeID = 0) then begin ServiceTypeName := ''; end else begin q.Close; q.SQL.Clear; q.SQL.Add('SELECT Description'); q.SQL.Add('FROM tServiceType'); q.SQL.Add('WHERE id = '+IntString); q.open; ServiceTypeName := q.FieldByName('Description').AsString; q.Close; end; // Empty field value. IntString := IntToStr(SupplierAccountID); // SupplierAccountID if (SupplierAccountID = 0) then begin SupplierAccountName := ''; end else begin q.Close; q.SQL.Clear; // q.SQL.Add('SELECT SupplierAccount'); // q.SQL.Add('FROM tSupplierAccount'); q.SQL.Add('SELECT AccountNo'); q.SQL.Add('FROM tValidAccountNumber'); q.SQL.Add('WHERE id = '+IntString); q.open; SupplierAccountName := q.FieldByName('AccountNo').AsString; q.Close; end; // Empty field value. IntString := IntToStr(LocationID); // LocationID if (LocationID = 0) then begin LocationName := ''; end else begin q.Close; q.SQL.Clear; q.SQL.Add('SELECT Description'); q.SQL.Add('FROM tLocation'); q.SQL.Add('WHERE id = '+IntString); q.open; LocationName := q.FieldByName('Description').AsString; q.Close; end; // Empty field value. IntString := IntToStr(CustomerCentreID); // CustomerCentreID if (CustomerCentreID = 0) then begin CustomerCentreName := ''; end else begin q.Close; q.SQL.Clear; q.SQL.Add('SELECT Description'); q.SQL.Add('FROM tCentre'); q.SQL.Add('WHERE id = '+IntString); q.open; CustomerCentreName := q.FieldByName('Description').AsString; q.Close; end; // Empty field value. IntString := IntToStr(CustomerActivityID); // CustomerActivityID if (CustomerActivityID = 0) then begin CustomerActivityName := ''; end else begin q.Close; q.SQL.Clear; q.SQL.Add('SELECT Description'); q.SQL.Add('FROM tActivity'); q.SQL.Add('WHERE id = '+IntString); q.open; CustomerActivityName := q.FieldByName('Description').AsString; q.Close; end; // Empty field value. IntString := IntToStr(CustomerElementID); // CustomerElementID if (CustomerElementID = 0) then begin CustomerElementName := ''; end else begin q.Close; q.SQL.Clear; q.SQL.Add('SELECT ElementCode'); q.SQL.Add('FROM tElement'); q.SQL.Add('WHERE id = '+IntString); q.open; CustomerElementName := q.FieldByName('ElementCode').AsString; q.Close; end; // Empty field value. IntString := IntToStr(CustomerSubledgerID); // CustomerSubledgerID if (CustomerSubledgerID = 0) then begin CustomerSubledgerName := ''; end else begin q.Close; q.SQL.Clear; q.SQL.Add('SELECT Description'); q.SQL.Add('FROM tSubledger'); q.SQL.Add('WHERE id = '+IntString); q.open; CustomerSubledgerName := q.FieldByName('Description').AsString; q.Close; end; // Empty field value. IntString := IntToStr(PersonID); // PersonID if (PersonID = 0) then begin PersonName := ''; end else begin q.Close; q.SQL.Clear; q.SQL.Add('SELECT Person'); q.SQL.Add('FROM tPerson'); q.SQL.Add('WHERE id = '+IntString); q.open; PersonName := q.FieldByName('Person').AsString; q.Close; end; // Empty field value. IntString := IntToStr(CentreID); // CentreID if (CentreID = 0) then begin CentreName := ''; end else begin q.Close; q.SQL.Clear; q.SQL.Add('SELECT Description'); q.SQL.Add('FROM tCentre'); q.SQL.Add('WHERE id = '+IntString); q.open; CentreName := q.FieldByName('Description').AsString; q.Close; end; // Empty field value. IntString := IntToStr(ActivityID); // ActivityID if (ActivityID = 0) then begin ActivityName := ''; end else begin q.Close; q.SQL.Clear; q.SQL.Add('SELECT Description'); q.SQL.Add('FROM tActivity'); q.SQL.Add('WHERE id = '+IntString); q.open; ActivityName := q.FieldByName('Description').AsString; q.Close; end; // Empty field value. IntString := IntToStr(ElementID); // ElementID if (ElementID = 0) then begin ElementName := ''; end else begin q.Close; q.SQL.Clear; q.SQL.Add('SELECT ElementCode'); q.SQL.Add('FROM tElement'); q.SQL.Add('WHERE id = '+IntString); q.open; ElementName := q.FieldByName('ElementCode').AsString; q.Close; end; // Empty field value. IntString := IntToStr(SubledgerID); // SubledgerID if (SubledgerID = 0) then begin SubledgerName := ''; end else begin q.Close; q.SQL.Clear; q.SQL.Add('SELECT Description'); q.SQL.Add('FROM tSubledger'); q.SQL.Add('WHERE id = '+IntString); q.open; SubledgerName := q.FieldByName('Description').AsString; q.Close; end; // Empty field value. end; // UpdateForm. procedure TSysEditServiceIDForm.SaveData(var lSuccess: boolean); var lReturn : boolean; sError : string; sOperatorName : string; sAuditInsert : string; sAuditField : string; sAuditValue : string; // AuditTrailDesc : string; AuditAction : string; sField : string; sValue : string; sStarted : string; nPos : integer; iStep : integer; begin if lAppend then AuditAction := AuditActionInsert else AuditAction := AuditActionUpdate; sOperatorName := MainForm.OPERATORNAME; // q := TQuery.Create(SELF); // 'q' Added to the form 100530 RJC. // q.DatabaseName := 'dbPPdata'; // 'q' Added to the form 100530 RJC. q.Close; q.SQL.Clear; lReturn := True; if (Length(ServiceID) > 0) and (ServiceTypeID > 0) and (CustomerCentreID > 0) then begin sStarted := ServiceID; // Ensure there are not any duplicate entries. {// Simplified, to reduce storage of SQL statements in the program. RJC 100612. if lAppend then begin q.SQL.Add('SELECT tServiceID.id'); q.SQL.Add('FROM tServiceID'); q.SQL.Add('WHERE tServiceID.ServiceID LIKE '''+sStarted+''''); q.Open; lReturn := q.Eof; q.Close; q.SQL.Clear; end else begin } q.SQL.Add('SELECT tServiceID.id'); q.SQL.Add('FROM tServiceID'); q.SQL.Add('WHERE tServiceID.ServiceID LIKE '''+sStarted+''''); if not lAppend then begin q.SQL.Add('AND id <> '+ IntToStr(ID)); end; q.Open; lReturn := q.Eof; q.Close; q.SQL.Clear; {// Simplified, to reduce storage of SQL statements in the program. RJC 100612. end; } if lReturn then begin // No duplicates found - continue. if (Length(Service) = 0) then begin // Populate it by removing the first "-" or "." so that // the standard format function works. if (Pos('-',sStarted) > 0) then begin nPos := Pos('-',sStarted); Service := Copy(sStarted,1,nPos-1) + Copy(sStarted,nPos+1,20); end else if (Pos('.',sStarted) > 0) then begin nPos := Pos('.',sStarted); Service := Copy(sStarted,1,nPos-1) + Copy(sStarted,nPos+1,20); end; // if (Pos('-',sStarted) > 0) then begin..else. end; // if (Length(Trim(edtService.Text)) = 0) then begin. sStarted := IntToStr(ServiceTypeID); ProveWholeInteger(sStarted,lReturn); // parameter True if contents altered. lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'ServiceTypeID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tServiceType', StrToInt(sStarted), lReturn); end; if not lReturn then begin // Field value truncated - Not Okay! sError := 'ServiceTypeID '+sStarted+' does not exist.'; end else begin sStarted := IntToStr(CustomerCentreID); ProveWholeInteger(sStarted,lReturn); // parameter True if contents altered. lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'CustomerCentreID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tCentre', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'CustomerCentreID '+sStarted+' does not exist.'; end; end; end; // if not lReturn then begin..else. end else begin edtServiceID.Text := sStarted; sError := 'The ServiceID '+sStarted+' already exists. '+ 'Duplicates are not permitted.'; end; // if not lReturn then begin..else. if lReturn then begin // First, update the variables from the DetailRecordForm. if SysServiceRecordForm.RecordStatus then begin // Save values without resetting Original values. SetServiceID_Original_Values := False; RetrieveDetails; // Now reset the update status - details now read and saved. SysServiceRecordForm.RecordStatus := False; SetServiceID_Original_Values := True; end; //**********************************************************************// //**********************************************************************// //**** APPEND *** APPEND *** APPEND *** APPEND *** APPEND ****// //**********************************************************************// //**********************************************************************// if lAppend then begin AmendString.Add('INSERT INTO tServiceID'); sField := '(ServiceID,CustomerCentreID,ServiceTypeID,'; sValue := 'VALUES ('''+ServiceID+''','+sStarted+','+ IntToStr(ServiceTypeID)+','; if lAudit then begin SetAuditStart(sUserName, AuditAction, 'tServiceID', sAuditInsert, sAuditField, sAuditValue); SetAuditData('SERVICEID', '', ServiceID, AuditString); SetAuditData('SERVICETYPEID', '', IntToStr(ServiceTypeID), AuditString); SetAuditData('CUSTOMERCENTREID', '', sStarted, AuditString); end; // lAudit. // Reset Reference values. ServiceID := ServiceID; ServiceTypeID := ServiceTypeID; CustomerCentreID := CustomerCentreID; sStarted := Service; if (Length(sStarted) > 0) then begin sField := sField + 'Service,'; sValue := sValue + '''' + sStarted +''','; if lAudit then begin SetAuditData('SERVICE', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. Service := Service; end; sStarted := Description; if (Length(sStarted) > 0) then begin sField := sField + 'Description,'; sValue := sValue + '''' + sStarted +''','; if lAudit then begin SetAuditData('DESCRIPTION', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. Description := Description; end; AmendString.Add(sField); AmendValueString.Add(sValue); sField := ''; sValue := ''; sStarted := SACCNumber; if (Length(sStarted) > 0) then begin sField := sField + 'SACCnumber,'; sValue := sValue + '''' + sStarted +''','; if lAudit then begin SetAuditData('SACCNUMBER', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. SACCNumber := SACCNumber; end; sStarted := PayType; if (Length(sStarted) > 0) then begin sField := sField + 'PayType,'; sValue := sValue + '''' + sStarted +''','; if lAudit then begin SetAuditData('PAYTYPE', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. PayType := PayType; end; // Universal code-may loose some characters. Before using, ensure that // a write is ONLY when a change is made. Check with Cable Records // programmers first. sStarted := ServiceCode; if (Length(sStarted) > 0) then begin sField := sField + 'ServiceCode,'; // sValue := sValue + 'N''' + sStarted +''','; sValue := sValue + 'QUOTENAME(''' + sStarted +''',''''),'; end; sStarted := Trim(edtInstallationDate.Text); if (Length(sStarted) > 0) and (Copy(sStarted,1,1) <> '/') then begin sStarted := StandardDateString(edtInstallationDate.Date); sField := sField + 'InstallationDate,'; sValue := sValue +''''+sStarted+''','; if lAudit then begin SetAuditData('INSTALLATIONDATE', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. end; sStarted := Trim(edtTerminationDate.Text); if (Length(sStarted) > 0) and (Copy(sStarted,1,1) <> '/') then begin sStarted := StandardDateString(edtTerminationDate.Date); sField := sField + 'TerminationDate,Active,'; sValue := sValue +''''+sStarted+''',0,'; if lAudit then begin SetAuditData('TERMINATIONDATE', '', sStarted, AuditString); SetAuditData('ACTIVE', '', '0', AuditString); end; // lAudit. end else begin sField := sField + 'Active,'; sValue := sValue +'1,'; if lAudit then begin SetAuditData('ACTIVE', '', '1', AuditString); end; // lAudit. end; sStarted := IntToStr(SupplierAccountID); if (Length(sStarted) > 0) then begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'SupplierAccountID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tValidAccountNumber', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'SupplierAccountID '+sStarted+' does not exist.'; end else begin sField := sField + 'SupplierAccountID,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('SUPPLIERACCOUNTID', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. SupplierAccountID := SupplierAccountID; end; // if lReturn then begin. end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. if lReturn then begin sStarted := IntToStr(LocationID); if (Length(sStarted) > 0) then begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'LocationID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tLocation', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'LocationID '+sStarted+' does not exist.'; end else begin sField := sField + 'LocationID,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('LOCATIONID', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. LocationID := LocationID; end; end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. end; // if lReturn then begin. if (Length(sField) > 0) then begin AmendString.Add(sField); AmendValueString.Add(sValue); sField := ''; sValue := ''; end; if lReturn then begin sStarted := IntToStr(CustomerActivityID); if (Length(sStarted) > 0) then begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'CustomerActivityID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tActivity', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'CustomerActivityID does not exist.'; end else begin sField := sField + 'CustomerActivityID,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('CUSTOMERACTIVITYID', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. CustomerActivityID := CustomerActivityID; end; end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. end; // if lReturn then begin. if lReturn then begin sStarted := IntToStr(CustomerElementID); if (Length(sStarted) > 0) then begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'CustomerElementID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tElement', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'CustomerElementID '+sStarted+' does not exist.'; end else begin sField := sField + 'CustomerElementID,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('CUSTOMERELEMENTID', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. CustomerElementID := CustomerElementID; end; end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. end; // if lReturn then begin. if lReturn then begin sStarted := IntToStr(CustomerSubledgerID); if (Length(sStarted) > 0) then begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'CustomerSubledgerID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tSubledger', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'CustomerSubledgerID '+sStarted+' does not exist.'; end else begin sField := sField + 'CustomerSubledgerID,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('CUSTOMERSUBLEDGERID', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. CustomerSubledgerID := CustomerSubledgerID; end; end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. end; // if lReturn then begin. if lReturn then begin sStarted := IntToStr(PersonID); if (Length(sStarted) > 0) then begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'PersonID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tPerson', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'PersonID does not exist.'; end else begin sField := sField + 'PersonID,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('PERSONID', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. PersonID := PersonID; end; end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. end; // if lReturn then begin. if lReturn then begin if (CentreID < 1) then begin sError := 'CentreID is Mandatory. A valid value MUST be entered.'; lReturn := False; end else begin sStarted := IntToStr(CentreID); if (Length(sStarted) > 0) then begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'CentreID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tCentre', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'CentreID '+sStarted+' does not exist.'; end else begin sField := sField + 'CentreID,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('CENTREID', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. CentreID := CentreID; end; end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. end; // CentreID < 1. end; // if lReturn then begin. if lReturn then begin sStarted := IntToStr(ActivityID); if (Length(sStarted) > 0) then begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'ActivityID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tActivity', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'ActivityID does not exist.'; end else begin sField := sField + 'ActivityID,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('ACTIVITYID', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. ActivityID := ActivityID; end; end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. end; // if lReturn then begin. // Commented out & control disabled. Value reset to ExpenseElementID 15/05/2005. { if lReturn then begin sStarted := IntToStr(ElementID); if (Length(sStarted) > 0) then begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'ElementID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tElement', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'ElementID '+sStarted+' does not exist.'; end else begin if lReturn then begin sField := sField + 'ElementID,'; sValue := sValue + sStarted +','; end else begin sError := 'ElementID MUST be an integer.'; end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. end; // if lReturn then begin. } if lReturn then begin sStarted := IntToStr(SubledgerID); if (Length(sStarted) > 0) then begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'SubledgerID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tSubledger', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'SubledgerID '+sStarted+' does not exist.'; end else begin sField := sField + 'SubledgerID,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('SUBLEDGERID', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. SubledgerID := SubledgerID; end; end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. end; // if lReturn then begin. // if lReturn and (cbApplication.ItemIndex > -1) then begin if lReturn and (ApplicationID > 0) then begin // sStarted := IntToStr(aApplication[cbApplication.ItemIndex]); sStarted := IntToStr(ApplicationID); sField := sField + 'ApplicationID,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('APPLICATIONID', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. ApplicationID := ApplicationID; end; if (Length(sField) > 0) then begin AmendString.Add(sField); AmendValueString.Add(sValue); sField := ''; sValue := ''; end; if lReturn then begin sStarted := CleanString(Jobno); if (Length(sStarted) > 0) then begin sField := sField + 'Jobno,'; sValue := sValue + ''''+ sStarted +''','; if lAudit then begin SetAuditData('JOBNO', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. Jobno := Jobno; end; // (Length(sStarted) > 0). sStarted := CleanString(UpMDF); if (Length(sStarted) > 0) then begin sField := sField + 'UpMDF,'; sValue := sValue + ''''+ sStarted +''','; if lAudit then begin SetAuditData('UPMDF', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. UpMDF := UpMDF; end; // if (Length(sStarted) > 0) then begin. sStarted := CleanString(UpEnd); if (Length(sStarted) > 0) then begin sField := sField + 'UpEnd,'; sValue := sValue + ''''+ sStarted +''','; if lAudit then begin SetAuditData('UPEND', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. UpEnd := UpEnd; end; // if (Length(sStarted) > 0) then begin. sStarted := CleanString(DownMDF); if (Length(sStarted) > 0) then begin sField := sField + 'DownMDF,'; sValue := sValue + ''''+ sStarted +''','; if lAudit then begin SetAuditData('DOWNMDF', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. DownMDF := DownMDF; end; // if (Length(sStarted) > 0) then begin. sStarted := CleanString(DownEnd); if (Length(sStarted) > 0) then begin sField := sField + 'DownEnd,'; sValue := sValue + ''''+ sStarted +''','; if lAudit then begin SetAuditData('DOWNEND', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. DownEnd := DownEnd; end; // if (Length(sStarted) > 0) then begin. sStarted := LineLength; if (Length(sStarted) > 0) then begin sField := sField + 'Length,'; sValue := sValue + sStarted +','; // WARNING - NOT VERIFIED!!!!!! if lAudit then begin SetAuditData('LENGTH', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. LineLength := LineLength; end; // if (Length(sStarted) > 0) then begin. if lReturn and (ServiceKpiID > 0) then begin sStarted := IntToStr(ServiceKpiID); sField := sField + 'ServiceKpiID,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('SERVICEKPIID', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. ServiceKpiID := ServiceKpiID; end; // ServiceKpiID. end; // lReturn. if (Length(sField) > 0) then begin AmendString.Add(sField); AmendValueString.Add(sValue); sField := ''; sValue := ''; end; // ###########################################################################// // ###########################################################################// // ###########################################################################// // ###########################################################################// if lReturn then begin if (Cost <> 0) then begin sStarted := CurrToStr(Cost); sField := sField + 'Cost,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('COST', '0', sStarted, AuditString); end; // lAudit. // Reset Reference (Original) value. Cost := Cost; end; if (Cost100 <> 0) then begin sStarted := CurrToStr(Cost100); sField := sField + 'Cost100,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('COST100', '0', sStarted, AuditString); end; // lAudit. // Reset Reference (Original) value. Cost100 := Cost100; end; if (Invoiced <> 0) then begin sStarted := CurrToStr(Invoiced); sField := sField + 'Invoiced,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('INVOICED', '0', sStarted, AuditString); end; // lAudit. // Reset Reference (Original) value. Invoiced := Invoiced; end; end; // lReturn. if lReturn then begin sStarted := IntToStr(AuthorityID); if (Length(sStarted) > 0) then begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'AuthorityID MUST be an integer.'; end else if (sStarted <> '0') then begin // ProveForeignKey( 'tAuthority', AuthorityID, lReturn); // RJC-110410. // Use new function ProveAnyKey() - link field isn't "ID". // RJC-110522. ProveAnyKey( 'tCableInst', 'AuthNo', AuthorityID, lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'AuthorityID '+sStarted+' does not exist.'; end else begin sField := sField + 'AuthorityID,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('AUTHORITYID', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. AuthorityID := AuthorityID; end; // not lReturn end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. end; // lReturn. if lReturn and (MnemonicID > 0) then begin sStarted := IntToStr(MnemonicID); sField := sField + 'ServiceMnemonicID,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('SERVICEMNEMONICID', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. MnemonicID := MnemonicID; end; if lReturn then begin sStarted := IntToStr(ModemTypeID); if (Length(sStarted) > 0) then begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'ModemTypeID MUST be an integer.'; end else if (sStarted <> '0') then begin // ProveForeignKey( 'tModemType', StrToInt(sStarted), lReturn); ProveForeignKey( 'rModem', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'ModemTypeID '+sStarted+' does not exist.'; end else begin sField := sField + 'ModemTypeID,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('MODEMTYPEID', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. ModemTypeID := ModemTypeID; end; end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. end; // lReturn. if lReturn then begin sStarted := IntToStr(BearerID); if (Length(sStarted) > 0) then begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'BearerID MUST be an integer.'; end else if (sStarted <> '0') then begin //TEMP ProveForeignKey( 'rBearer', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'BearerID '+sStarted+' does not exist.'; end else begin sField := sField + 'BearerID,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('BEARERID', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. BearerID := BearerID; end; end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. end; // lReturn. if lReturn then begin sStarted := IntToStr(SpeedID); if (Length(sStarted) > 0) then begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'SpeedID MUST be an integer.'; end else if (sStarted <> '0') then begin // ProveForeignKey( 'tSpeed', StrToInt(sStarted), lReturn); // RJC-110410. ProveForeignKey( 'rBearerSpeed', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'SpeedID '+sStarted+' does not exist.'; end else begin sField := sField + 'SpeedID,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('SPEEDID', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. SpeedID := SpeedID; end; end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. end; // lReturn. if (Length(sField) > 0) then begin // NOT the last!!! AmendString.Add(sField); AmendValueString.Add(sValue); sField := ''; sValue := ''; end; if lReturn then begin sStarted := CleanString(No); if (Length(sStarted) > 0) then begin sField := sField + 'No,'; sValue := sValue + ''''+ sStarted +''','; if lAudit then begin SetAuditData('NO', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. No := No; end; // No. sStarted := CleanString(Part); if (Length(sStarted) > 0) then begin sField := sField + 'Part,'; sValue := sValue + ''''+ sStarted +''','; if lAudit then begin SetAuditData('PART', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. Part := Part; end; // Part. sStarted := CleanString(Drawing); if (Length(sStarted) > 0) then begin sField := sField + 'Drawing,'; sValue := sValue + ''''+ sStarted +''','; if lAudit then begin SetAuditData('DRAWING', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. Drawing := Drawing; end; // if (Length(sStarted) > 0) then begin. sStarted := CleanString(Make); if (Length(sStarted) > 0) then begin sField := sField + 'Make,'; sValue := sValue + ''''+ sStarted +''','; if lAudit then begin SetAuditData('MAKE', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. Make := Make; end; // Make. sStarted := CleanString(Ch); if (Length(sStarted) > 0) then begin sField := sField + 'Ch,'; sValue := sValue + ''''+ sStarted +''','; if lAudit then begin SetAuditData('CH', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. Ch := Ch; end; // Ch. sStarted := CleanString(Mux); if (Length(sStarted) > 0) then begin sField := sField + 'Mux,'; sValue := sValue + ''''+ sStarted +''','; if lAudit then begin SetAuditData('MUX', '', sStarted, AuditString); end; // lAudit. // Reset Reference value. Mux := Mux; end; // Mux. end; // lReturn. if (Length(sField) > 0) then begin AmendString.Add(sField); AmendValueString.Add(sValue); sField := ''; sValue := ''; end; // ###########################################################################// // ###########################################################################// // ###########################################################################// // ###########################################################################// if lReturn then begin sField := sField + 'DateEntered,DateLastChanged,LastUpdatedBy,'; sValue := sValue + ''''+StandardDateTimeString(Now) +''','''+ StandardDateTimeString(Now)+''','''+sOperatorName+''','; end; // if lReturn then begin. // Replace the last Comma with a closed parenthesis & finish SQL. if (Length(sField) > 0) then begin sField := Copy(sField, 1, Length(sField)-1) + ')'; sValue := Copy(sValue, 1, Length(sValue)-1) + ')'; AmendString.Add(sField); AmendValueString.Add(sValue); end else begin iStep := AmendString.Count - 1; // Modify last entry. sField := AmendString[iStep]; sValue := AmendValueString[iStep-1]; AmendString.Strings[iStep] := Copy(sField, 1, Length(sField)-1) + ')'; AmendValueString.Strings[iStep-1] := Copy(sValue, 1, Length(sValue)-1) + ')'; end; for iStep := 0 to (AmendValueString.Count - 1) do AmendString.Add(AmendValueString[iStep]); { if lAudit and (Length(AuditTrailDesc) = 0) then begin lAudit := False; end; // lAudit. } end // if lAppend then begin. //**********************************************************************// //**********************************************************************// //**** UPDATE *** UPDATE *** UPDATE *** UPDATE *** UPDATE ****// //**********************************************************************// //**********************************************************************// else begin AmendString.Add('UPDATE tServiceID'); AmendString.Add('SET ServiceID = '''+ ServiceID + ''', CustomerCentreID = '+sStarted+ ', ServiceTypeID = '+IntToStr(ServiceTypeID)+','); if lAudit then begin { SetAuditSelect(sUserName, AuditAction, 'tServiceID', AuditString, sAuditField, sAuditValue); sAuditField := sAuditField +',TableID'; sAuditValue := sAuditValue +','+ Trim(edtID.Text); } SetAuditStart(sUserName, AuditAction, 'tServiceID', sAuditInsert, sAuditField, sAuditValue); SetAuditID(Trim(edtID.Text), sAuditValue); if (sStarted <> Original_CustomerCentreID) then begin SetAuditData('CUSTOMERCENTREID', Original_CustomerCentreID, sStarted, AuditString); end; sStarted := ServiceID; if (sStarted <> Original_ServiceID) then begin SetAuditData('SERVICEID', Original_ServiceID, sStarted, AuditString); end; sStarted := IntToStr(ServiceTypeID); if (sStarted <> Original_ServiceTypeID) then begin SetAuditData('SERVICETYPEID', Original_ServiceTypeID, sStarted, AuditString); end; end; // lAudit. // Reset Reference value. ServiceID := ServiceID; ServiceTypeID := ServiceTypeID; CustomerCentreID := CustomerCentreID; sStarted := Service; if (sStarted = '0') or (Length(sStarted) = 0) then begin AmendString.Add('Service = NULL,'); end else begin AmendString.Add('Service = ''' + sStarted +''','); end; if lAudit and (sStarted <> Original_ServiceName) then begin SetAuditData('SERVICE', Original_ServiceName, sStarted, AuditString); end; // Reset Reference value. Service := Service; sStarted := Description; if (Length(sStarted) = 0) then begin AmendString.Add('Description = NULL,'); end else begin AmendString.Add('Description = ''' + sStarted +''','); end; if lAudit and (sStarted <> Original_Description) then begin SetAuditData('DESCRIPTION', Original_Description, sStarted, AuditString); end; // Reset Reference value. Description := Description; sStarted := SACCNumber; if (Length(sStarted) = 0) then begin AmendString.Add('SACCnumber = NULL,'); end else begin AmendString.Add('SACCnumber = ''' + sStarted +''','); end; if lAudit and (sStarted <> Original_SACC) then begin SetAuditData('SACCNUMBER', Original_SACC, sStarted, AuditString); end; // Reset Reference value. SACCNumber := SACCNumber; sStarted := PayType; if (Length(sStarted) = 0) then begin AmendString.Add('PayType = NULL,'); end else begin AmendString.Add('PayType = ''' + sStarted +''','); end; if lAudit and (sStarted <> Original_PayType) then begin SetAuditData('PAYTYPE', Original_PayType, sStarted, AuditString); end; // Reset Reference value. PayType := PayType; if (cbApplication.ItemIndex = -1) then begin if (Length(Original_ApplicationID) > 0) then begin AmendString.Add('ApplicationID = NULL,'); if lAudit then begin SetAuditData('APPLICATIONID', Original_ApplicationID, '', AuditString); end; end; end else begin sStarted := IntToStr(aApplication[cbApplication.ItemIndex]); // sStarted := IntToStr(ApplicationID); if (sStarted <> Original_ApplicationID) then begin AmendString.Add('ApplicationID = ' + sStarted +','); if lAudit then begin SetAuditData('APPLICATIONID', Original_ApplicationID, sStarted, AuditString); end; // lAudit. end; end; // Reset Reference value. // Universal code-may loose some characters. Before using, ensure that // a write is ONLY when a change is made. Check with Cable Records // programmers first. sStarted := Trim(edtServiceCode.Text); if (Length(sStarted) = 0) then begin AmendString.Add('ServiceCode = NULL,'); end else begin AmendString.Add('ServiceCode = QUOTENAME('''+ sStarted +''',''''),'); end; sStarted := Trim(edtInstallationDate.Text); if (Length(sStarted) = 0) or (Copy(sStarted,1,1) = '/') then begin if (Length(Original_InstallationDate) = 8) then begin AmendString.Add(' InstallationDate = NULL,'); if lAudit then begin SetAuditData('INSTALLATIONDATE', Original_InstallationDate, '', AuditString); end; end; end else begin sStarted := StandardDateString(edtInstallationDate.Date); AmendString.Add('InstallationDate = '''+sStarted+''','); if lAudit and (sStarted <> Original_InstallationDate) then begin SetAuditData('INSTALLATIONDATE', Original_InstallationDate, sStarted, AuditString); end; end; // Reset Reference value. sStarted := Trim(edtTerminationDate.Text); if (Length(sStarted) = 0) or (Copy(sStarted,1,1) = '/') then begin if (Length(Original_TerminationDate) = 8) then begin AmendString.Add(' TerminationDate = NULL,Active=1,'); if lAudit then begin SetAuditData('TERMINATIONDATE', Original_TerminationDate, '', AuditString); end; end; end else begin sStarted := StandardDateString(edtTerminationDate.Date); AmendString.Add(' TerminationDate = '''+sStarted+''',Active=0,'); if lAudit and (sStarted <> Original_TerminationDate) then begin SetAuditData('TERMINATIONDATE', Original_TerminationDate, sStarted, AuditString); end; end; // Reset Reference value. sStarted := IntToStr(SupplierAccountID); if (sStarted = '0') or (Length(sStarted) = 0) then begin AmendString.Add('SupplierAccountID = NULL,'); end else begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'SupplierAccountID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tValidAccountNumber', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'SupplierAccountID '+sStarted+' does not exist.'; end else begin AmendString.Add('SupplierAccountID = ' + sStarted +','); if lAudit and (sStarted <> Original_SupplierAccountID) then begin SetAuditData('SUPPLIERACCOUNTID', Original_SupplierAccountID, sStarted, AuditString); end; end; // if lReturn then begin. end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. // Reset Reference value. SupplierAccountID := SupplierAccountID; if lReturn then begin sStarted := IntToStr(LocationID); if (sStarted = '0') or (Length(sStarted) = 0) then begin AmendString.Add('LocationID = NULL,'); // Reset Reference value. LocationID := LocationID end else begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'LocationID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tLocation', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'LocationID '+sStarted+' does not exist.'; end else begin AmendString.Add('LocationID = ' + sStarted +','); if lAudit and (sStarted <> Original_LocationID) then begin SetAuditData('LOCATIONID', Original_LocationID, sStarted, AuditString); end; // Reset Reference value. LocationID := LocationID end; end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. end; // if lReturn then begin. if lReturn then begin sStarted := IntToStr(CustomerActivityID); if (sStarted = '0') or (Length(sStarted) = 0) then begin AmendString.Add('CustomerActivityID = NULL,'); // Reset Reference value. CustomerActivityID := CustomerActivityID; end else begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'CustomerActivityID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tActivity', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'CustomerActivityID '+sStarted+' does not exist.'; end else begin AmendString.Add('CustomerActivityID = ' + sStarted +','); if lAudit and (sStarted <> Original_CustomerActivityID) then begin SetAuditData('CUSTOMERACTIVITYID', Original_CustomerActivityID, sStarted, AuditString); end; // Reset Reference value. CustomerActivityID := CustomerActivityID; end; // if lReturn then begin. end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. end; // if lReturn then begin. if lReturn then begin sStarted := IntToStr(CustomerElementID); if (sStarted = '0') or (Length(sStarted) = 0) then begin AmendString.Add('CustomerElementID = NULL,'); // Reset Reference value. CustomerElementID := CustomerElementID; end else begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'CustomerElementID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tElement', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'CustomerElementID '+sStarted+' does not exist.'; end else begin AmendString.Add('CustomerElementID = ' + sStarted +','); if lAudit and (sStarted <> Original_CustomerElementID) then begin SetAuditData('CUSTOMERELEMENTID', Original_CustomerElementID, sStarted, AuditString); end; // Reset Reference value. CustomerElementID := CustomerElementID; end; // if lReturn then begin. end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. end; // if lReturn then begin. if lReturn then begin sStarted := IntToStr(CustomerSubledgerID); if (sStarted = '0') or (Length(sStarted) = 0) then begin AmendString.Add('CustomerSubledgerID = NULL,'); // Reset Reference value. CustomerSubledgerID := CustomerSubledgerID; end else begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'CustomerSubledgerID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tSubledger', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'CustomerSubledgerID '+sStarted+' does not exist.'; end else begin AmendString.Add('CustomerSubledgerID = '+ sStarted +','); if lAudit and (sStarted <> Original_CustomerSubledgerID) then begin SetAuditData('CUSTOMERSUBLEDGERID', Original_CustomerSubledgerID, sStarted, AuditString); end; // Reset Reference value. CustomerSubledgerID := CustomerSubledgerID; end; // if lReturn then begin. end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. end; // if lReturn then begin. if lReturn then begin sStarted := IntToStr(PersonID); if (sStarted = '0') or (Length(sStarted) = 0) then begin AmendString.Add('PersonID = NULL,'); // Reset Reference value. PersonID := PersonID; end else begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'PersonID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tPerson', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'PersonID does not exist.'; end else begin AmendString.Add('PersonID = '+ sStarted +','); if lAudit and (sStarted <> Original_PersonID) then begin SetAuditData('PERSONID', Original_PersonID, sStarted, AuditString); end; // Reset Reference value. PersonID := PersonID; end; // if lReturn then begin. end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. end; // if lReturn then begin. if lReturn then begin sStarted := IntToStr(CentreID); if (CentreID < 1) then begin sError := 'CentreID is Mandatory. A valid value MUST be entered.'; lReturn := False; end { if (sStarted = '0') or (Length(sStarted) = 0) then begin AmendString.Add('CentreID = NULL,'); // Reset Reference value. CentreID := CentreID; end } else begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'CentreID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tCentre', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'CentreID does not exist.'; end else begin AmendString.Add('CentreID = '+ sStarted +','); if lAudit and (sStarted <> Original_CentreID) then begin SetAuditData('CENTREID', Original_CentreID, sStarted, AuditString); end; // Reset Reference value. CentreID := CentreID; end; // if lReturn then begin. end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. end; // if lReturn then begin. if lReturn then begin sStarted := IntToStr(ActivityID); if (sStarted = '0') or (Length(sStarted) = 0) then begin AmendString.Add('ActivityID = NULL,'); // Reset Reference value. ActivityID := ActivityID; end else begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'ActivityID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tActivity', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'ActivityID does not exist.'; end else begin AmendString.Add('ActivityID = '+ sStarted +','); if lAudit and (sStarted <> Original_ActivityID) then begin SetAuditData('ACTIVITYID', Original_ActivityID, sStarted, AuditString); end; // Reset Reference value. ActivityID := ActivityID; end; // if lReturn then begin. end; // if lReturn then begin. end; // if (Length(sStarted) > 0) then begin. // Reset Reference value. end; // if lReturn then begin. // Commented out & control disabled. Value reset to ExpenseElementID 20050515. // if lReturn then begin // sStarted := IntToStr(ElementID); // if (Length(sStarted) = 0) then begin // AmendString.Add('ElementID = NULL,'); // end // else begin // ProveWholeInteger(sStarted,lReturn); // lReturn := (not lReturn); // Correct the logic. { // If reinstated the following must be added (RJC 20050717). if not lReturn then begin // Field value truncated - Not Okay! sError := 'ElementID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tElement', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'ElementID '+sStarted+' does not exist.'; end else begin } // if lReturn then begin // AmendString.Add('ElementID = '+ sStarted +','); // end; // if lReturn then begin. // end; // if (Length(sStarted) > 0) then begin. // end; // if lReturn then begin. if lReturn then begin sStarted := IntToStr(SubledgerID); if (sStarted = '0') or (Length(sStarted) = 0) then begin AmendString.Add('SubledgerID = NULL,'); // Reset Reference value. SubledgerID := SubledgerID; end else begin ProveWholeInteger(sStarted,lReturn); lReturn := (not lReturn); // Correct the logic. if not lReturn then begin // Field value truncated - Not Okay! sError := 'SubledgerID MUST be an integer.'; end else if (sStarted <> '0') then begin ProveForeignKey( 'tSubledger', StrToInt(sStarted), lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'SubledgerID '+sStarted+' does not exist.'; end else begin AmendString.Add('SubledgerID = '+ sStarted +','); if lAudit and (sStarted <> Original_SubledgerID) then begin SetAuditData('SUBLEDGERID', Original_SubledgerID, sStarted, AuditString); end; // Reset Reference value. SubledgerID := SubledgerID; end; // if lReturn then begin. end; // if lReturn then begin. end; // if (Length(sStarted) = 0) then begin. end; // if lReturn then begin. if lReturn then begin sStarted := CleanString(Jobno); if (Length(sStarted) = 0) then AmendString.Add('Jobno = NULL,') else AmendString.Add('Jobno = '''+ sStarted +''','); if lAudit and (sStarted <> Original_Jobno) then begin SetAuditData('JOBNO', Original_Jobno, sStarted, AuditString); end; // Reset Reference value. Jobno := Jobno; sStarted := CleanString(UpMDF); if (Length(sStarted) = 0) then AmendString.Add('UpMDF = NULL,') else AmendString.Add('UpMDF = '''+ sStarted +''','); if lAudit and (sStarted <> Original_UpMDF) then begin SetAuditData('UPMDF', Original_UpMDF, sStarted, AuditString); end; // Reset Reference value. UpMDF := UpMDF; sStarted := CleanString(UpEnd); if (Length(sStarted) = 0) then AmendString.Add('UpEnd = NULL,') else AmendString.Add('UpEnd = '''+ sStarted +''','); if lAudit and (sStarted <> Original_UpEnd) then begin SetAuditData('UPEND', Original_UpEnd, sStarted, AuditString); end; // Reset Reference value. UpEnd := UpEnd; sStarted := CleanString(DownMDF); if (Length(sStarted) = 0) then AmendString.Add('DownMDF = NULL,') else AmendString.Add('DownMDF = '''+ sStarted +''','); if lAudit and (sStarted <> Original_DownMDF) then begin SetAuditData('DOWNMDF', Original_DownMDF, sStarted, AuditString); end; // Reset Reference value. DownMDF := DownMDF; sStarted := CleanString(DownEnd); if (Length(sStarted) = 0) then AmendString.Add('DownEnd = NULL,') else AmendString.Add('DownEnd = '''+ sStarted +''','); if lAudit and (sStarted <> Original_DownEnd) then begin SetAuditData('DOWNEND', Original_DownEnd, sStarted, AuditString); end; // Reset Reference value. DownEnd := DownEnd; sStarted := LineLength; if (Length(sStarted) = 0) then AmendString.Add('Length = NULL,') else AmendString.Add('Length = '+ sStarted +','); if lAudit and (sStarted <> Original_LineLength) then begin SetAuditData('LINELENGTH', Original_LineLength, sStarted, AuditString); end; // Reset Reference value. LineLength := LineLength; if (ServiceKpiID < 1) then begin if (Length(Original_ServiceKpiID) > 0) then begin AmendString.Add('ServiceKpiID = NULL,'); if lAudit then begin SetAuditData('SERVICEKPIID', Original_ServiceKpiID, '', AuditString); end; end; end else begin sStarted := IntToStr(ServiceKpiID); if (sStarted <> Original_ServiceKpiID) then begin AmendString.Add('ServiceKpiID = ' + sStarted +','); if lAudit then begin SetAuditData('SERVICEKPIID', Original_ServiceKpiID, sStarted, AuditString); end; // lAudit. end; end; // ServiceKpiID. // Reset Reference value. ServiceKpiID := ServiceKpiID; if (MnemonicID < 1) then begin if (Length(Original_MnemonicID) > 0) then begin AmendString.Add('ServiceMnemonicID = NULL,'); if lAudit then begin SetAuditData('SERVICEMNEMONICID', Original_MnemonicID, '', AuditString); end; end; end else begin sStarted := IntToStr(MnemonicID); if (sStarted <> Original_MnemonicID) then begin AmendString.Add('ServiceMnemonicID = ' + sStarted +','); if lAudit then begin SetAuditData('SERVICEMNEMONICID', Original_MnemonicID, sStarted, AuditString); end; // lAudit. end; end; // MnemonicID. // Reset Reference value. MnemonicID := MnemonicID; end; // if lReturn then begin. // ###########################################################################// // ###########################################################################// // ###########################################################################// // ###########################################################################// sStarted := CleanString(No); if (Length(sStarted) = 0) then AmendString.Add('No = NULL,') else AmendString.Add('No = '''+ sStarted +''','); if lAudit and (sStarted <> Original_No) then begin SetAuditData('NO', Original_No, sStarted, AuditString); end; // Reset Reference value. No := No; sStarted := CleanString(Part); if (Length(sStarted) = 0) then AmendString.Add('Part = NULL,') else AmendString.Add('Part = '''+ sStarted +''','); if lAudit and (sStarted <> Original_Part) then begin SetAuditData('PART', Original_Part, sStarted, AuditString); end; // Reset Reference value. Part := Part; sStarted := CleanString(Drawing); if (Length(sStarted) = 0) then AmendString.Add('Drawing = NULL,') else AmendString.Add('Drawing = '''+ sStarted +''','); if lAudit and (sStarted <> Original_Drawing) then begin SetAuditData('DRAWING', Original_Drawing, sStarted, AuditString); end; // Reset Reference value. Drawing := Drawing; if lReturn then begin if (Cost <> 0) then begin sStarted := CurrToStr(Cost); sField := sField + 'Cost,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('COST', '0', sStarted, AuditString); end; // lAudit. // Reset Reference (Original) value. Cost := Cost; end; if (Cost100 <> 0) then begin sStarted := CurrToStr(Cost100); sField := sField + 'Cost100,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('COST100', '0', sStarted, AuditString); end; // lAudit. // Reset Reference (Original) value. Cost100 := Cost100; end; if (Invoiced <> 0) then begin sStarted := CurrToStr(Invoiced); sField := sField + 'Invoiced,'; sValue := sValue + sStarted +','; if lAudit then begin SetAuditData('INVOICED', '0', sStarted, AuditString); end; // lAudit. // Reset Reference (Original) value. Invoiced := Invoiced; end; end; // lReturn. sStarted := IntToStr(AuthorityID); if (AuthorityID < 1) then begin AmendString.Add('AuthorityID = NULL,'); // Reset Reference value. AuthorityID := AuthorityID; end else begin // ProveForeignKey( 'tAuthority', AuthorityID, lReturn); // RJC-110410. // Use new function ProveAnyKey() - link field isn't "ID". // RJC-110522. ProveAnyKey( 'tCableInst', 'AuthNo', AuthorityID, lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'AuthorityID '+sStarted+' does not exist.'; end else begin AmendString.Add('AuthorityID = ' + sStarted +','); if lAudit and (sStarted <> Original_AuthorityID) then begin SetAuditData('AUTHORITYID', Original_AuthorityID, sStarted, AuditString); end; // Reset Reference value. AuthorityID := AuthorityID; end; // if lReturn then begin. end; // AuthorityID < 1. sStarted := IntToStr(ModemTypeID); if (ModemTypeID < 1) then begin AmendString.Add('ModemTypeID = NULL,'); // Reset Reference value. ModemTypeID := ModemTypeID; end else begin ProveForeignKey( 'rModem', ModemTypeID, lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'ModemTypeID '+sStarted+' does not exist.'; end else begin AmendString.Add('ModemTypeID = ' + sStarted +','); if lAudit and (sStarted <> Original_ModemTypeID) then begin SetAuditData('MODEMTYPEID', Original_ModemTypeID, sStarted, AuditString); end; // Reset Reference value. ModemTypeID := ModemTypeID; end; // if lReturn then begin. end; // ModemTypeID < 1. sStarted := IntToStr(BearerID); if (BearerID < 1) then begin AmendString.Add('BearerID = NULL,'); // Reset Reference value. BearerID := BearerID; end else begin //TEMP ProveForeignKey( 'rBearer', BearerID, lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'BearerID '+sStarted+' does not exist.'; end else begin AmendString.Add('BearerID = ' + sStarted +','); if lAudit and (sStarted <> Original_BearerID) then begin SetAuditData('BEARERID', Original_BearerID, sStarted, AuditString); end; // Reset Reference value. BearerID := BearerID; end; // if lReturn then begin. end; // BearerID < 1. sStarted := IntToStr(SpeedID); if (SpeedID < 1) then begin AmendString.Add('SpeedID = NULL,'); // Reset Reference value. SpeedID := SpeedID; end else begin // ProveForeignKey( 'tSpeed', SpeedID, lReturn); // RJC-110410. ProveForeignKey( 'rBearerSpeed', SpeedID, lReturn); if not lReturn then begin // Field value truncated - Not Okay! sError := 'SpeedID '+sStarted+' does not exist.'; end else begin AmendString.Add('SpeedID = ' + sStarted +','); if lAudit and (sStarted <> Original_SpeedID) then begin SetAuditData('SPEEDID', Original_SpeedID, sStarted, AuditString); end; // Reset Reference value. SpeedID := SpeedID; end; // if lReturn then begin. end; // SpeedID < 1. sStarted := CleanString(Make); if (Length(sStarted) = 0) then AmendString.Add('Make = NULL,') else AmendString.Add('Make = '''+ sStarted +''','); if lAudit and (sStarted <> Original_Make) then begin SetAuditData('MAKE', Original_Make, sStarted, AuditString); end; // Reset Reference value. Make := Make; sStarted := CleanString(Ch); if (Length(sStarted) = 0) then AmendString.Add('Ch = NULL,') else AmendString.Add('Ch = '''+ sStarted +''','); if lAudit and (sStarted <> Original_Ch) then begin SetAuditData('CH', Original_Ch, sStarted, AuditString); end; // Reset Reference value. Ch := Ch; sStarted := CleanString(Mux); if (Length(sStarted) = 0) then AmendString.Add('Mux = NULL,') else AmendString.Add('Mux = '''+ sStarted +''','); if lAudit and (sStarted <> Original_Mux) then begin SetAuditData('MUX', Original_Mux, sStarted, AuditString); end; // Reset Reference value. Mux := Mux; // ###########################################################################// // ###########################################################################// // ###########################################################################// // ###########################################################################// AmendString.Add('DateLastChanged = '''+ StandardDateTimeString(Now)+ ''','+'LastUpdatedBy = '''+ sOperatorName +''''); // // Remove the last Comma. // sValue := AmendString.Strings[AmendString.Count - 1]; // sValue := Copy(sValue,1,Length(sValue)-1); // AmendString.Strings[AmendString.Count - 1] := sValue; AmendString.Add('WHERE id = '+ Trim(edtID.Text)); // Make sure something has changed. end; // if lAppend then begin..else. if lReturn then begin q.SQL := AmendString; q.ExecSQL; if lAudit then begin if lAppend then begin // Get and store the new ID for this table. with q do begin SQL.Clear; SQL.Add('SELECT ID'); SQL.ADD('FROM tServiceID'); SQL.Add('WHERE ServiceID LIKE '''+ ServiceID +''''); // SQL.Add('AND Active = 1'); Open; SetAuditID(FieldByName('ID').AsString, sAuditValue); // Now update the displayed ID on the form. ID := FieldByName('ID').AsInteger; AppendMode := False; Close; end; end; // lAppend. SaveAudit(sAuditInsert, sAuditField, sAuditValue, AuditString); end; // lAudit. end; // lReturn. end; // lReturn. end else begin lReturn := False; sError := 'Valid entries are required for ServiceID,'+#13#10+ 'ServiceTypeID, and CustomerCentreID.'; end; AmendString.Clear; if not lReturn then begin MessageDlg(sError, mtWarning, [mbOk], 0); end; // not lReturn. lSuccess := lReturn; //**********************************************************************// //**********************************************************************// //**********************************************************************// //**********************************************************************// end; // SaveData. procedure TSysEditServiceIDForm.btnOkClick(Sender: TObject); var lSuccessful : boolean; begin lSuccessful := False; SaveData(lSuccessful); if lSuccessful then begin ModalResult := mrOk; end; // lSuccessful. end; // btnOkClick. procedure TSysEditServiceIDForm.btnSaveClick(Sender: TObject); var lSuccessful : boolean; begin lSuccessful := False; SaveData(lSuccessful); if lSuccessful then begin UpdateForm; end; // lSuccessful. end; // btnSaveClick. procedure TSysEditServiceIDForm.UpdateDetailsForm; // Copy the details to the ServiceRecordForm. begin with SysServiceRecordForm do begin FormCaptionName := ServiceID; No := SysEditServiceIDForm.No; Part := SysEditServiceIDForm.Part; LineLength := SysEditServiceIDForm.LineLength; UpMDF := SysEditServiceIDForm.UpMDF; UpEnd := SysEditServiceIDForm.UpEnd; DownMDF := SysEditServiceIDForm.DownMDF; DownEnd := SysEditServiceIDForm.DownEnd; Cost := SysEditServiceIDForm.Cost; Cost100 := SysEditServiceIDForm.Cost100; Invoiced := SysEditServiceIDForm.Invoiced; MnemonicID := SysEditServiceIDForm.MnemonicID; Drawing := SysEditServiceIDForm.Drawing; AuthorityID := SysEditServiceIDForm.AuthorityID; // AuthorityName := SysEditServiceIDForm.AuthorityName; ModemTypeID := SysEditServiceIDForm.ModemTypeID; // ModemTypeName := SysEditServiceIDForm.ModemTypeName; BearerID := SysEditServiceIDForm.BearerID; BearerName := SysEditServiceIDForm.BearerName; SpeedID := SysEditServiceIDForm.SpeedID; // SpeedName := SysEditServiceIDForm.SpeedName; Make := SysEditServiceIDForm.Make; Ch := SysEditServiceIDForm.Ch; Mux := SysEditServiceIDForm.Mux; end; // SysServiceRecordForm. end; // UpdateDetailsForm. procedure TSysEditServiceIDForm.RetrieveDetails; // Retrieve the details from the ServicerecordForm. begin No := SysServiceRecordForm.No; Part := SysServiceRecordForm.Part; LineLength := SysServiceRecordForm.LineLength; UpMDF := SysServiceRecordForm.UpMDF; UpEnd := SysServiceRecordForm.UpEnd; DownMDF := SysServiceRecordForm.DownMDF; DownEnd := SysServiceRecordForm.DownEnd; Cost := SysServiceRecordForm.Cost; Cost100 := SysServiceRecordForm.Cost100; Invoiced := SysServiceRecordForm.Invoiced; MnemonicID := SysServiceRecordForm.MnemonicID; Drawing := SysServiceRecordForm.Drawing; AuthorityID := SysServiceRecordForm.AuthorityID; // AuthorityName := SysServiceRecordForm.AuthorityName; ModemTypeID := SysServiceRecordForm.ModemTypeID; // ModemTypeName := SysServiceRecordForm.ModemTypeName; BearerID := SysServiceRecordForm.BearerID; BearerName := SysServiceRecordForm.BearerName; SpeedID := SysServiceRecordForm.SpeedID; // SpeedName := SysServiceRecordForm.SpeedName; Make := SysServiceRecordForm.Make; Ch := SysServiceRecordForm.Ch; Mux := SysServiceRecordForm.Mux; end; // RetrieveDetails. procedure TSysEditServiceIDForm.btnDetailsClick(Sender: TObject); begin if FirstTimeForDetails then UpdateDetailsForm; FirstTimeForDetails := False; SysServiceRecordForm.Show; end; // btnDetailsClick. end.