D7myYunxiang/样品新云翔(YPGLBOM.dll)/U_BPZdy_LRPB.pas

1442 lines
42 KiB
ObjectPascal
Raw Normal View History

2025-01-20 13:04:03 +08:00
unit U_BPZdy_LRPB;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
2025-09-25 15:36:55 +08:00
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
cxEdit, DB, cxDBData, ToolWin, ComCtrls, cxGridCustomTableView,
cxGridTableView, cxGridDBTableView, cxGridLevel, cxClasses, cxControls,
cxGridCustomView, cxGrid, DBClient, ADODB, ImgList, StdCtrls, ExtCtrls,
cxTextEdit, cxGridCustomPopupMenu, cxGridPopupMenu, cxButtonEdit, BtnEdit,
cxTL, cxMaskEdit, cxInplaceContainer, cxDBTL, cxTLData, cxContainer,
cxCurrencyEdit, cxCheckBox, cxSplitter, cxLookAndFeels, cxLookAndFeelPainters,
dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel,
dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide, dxSkinDevExpressDarkStyle,
dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast,
dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky,
dxSkinMcSkin, dxSkinMetropolis, dxSkinMetropolisDark, dxSkinMoneyTwins,
dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinOffice2013DarkGray,
dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven,
dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver,
dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld,
dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint,
dxSkinXmas2008Blue, dxSkinscxPCPainter, cxNavigator, cxTLdxBarBuiltInMenu;
2025-01-20 13:04:03 +08:00
type
TfrmBPZDY_LRPB = class(TForm)
ToolBar1: TToolBar;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
DataSource1: TDataSource;
ClientDataSet1: TClientDataSet;
TBClose: TToolButton;
ADOConnection1: TADOConnection;
ThreeImgList: TImageList;
DataSource2: TDataSource;
ML_GYS: TClientDataSet;
DataSource3: TDataSource;
ML_GX: TClientDataSet;
ADOQuery6: TADOQuery;
ADOQuery2: TADOQuery;
ADOQuery3: TADOQuery;
Panel2: TPanel;
cxGrid2: TcxGrid;
TV2: TcxGridDBTableView;
v1XTNo: TcxGridDBColumn;
v1CYName: TcxGridDBColumn;
v1CYNo: TcxGridDBColumn;
v1GYMXNote: TcxGridDBColumn;
v1CYCF: TcxGridDBColumn;
v1CYMF: TcxGridDBColumn;
v1CYKZ: TcxGridDBColumn;
v1CYSpec: TcxGridDBColumn;
v1DefStr6: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
Panel3: TPanel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
CYID: TEdit;
CYName: TEdit;
CYNo: TEdit;
Panel4: TPanel;
Panel5: TPanel;
Label6: TLabel;
Label7: TLabel;
MXName: TEdit;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
BPMiDu: TEdit;
BPJS: TEdit;
Button1: TButton;
DataSource4: TDataSource;
ADOQueryTree: TADOQuery;
Order_Tree: TClientDataSet;
Panel6: TPanel;
cxGrid1: TcxGrid;
TV1: TcxGridDBTableView;
V1BPCode: TcxGridDBColumn;
V1BPName: TcxGridDBColumn;
V1BPMF1: TcxGridDBColumn;
V1BPKZ: TcxGridDBColumn;
V1BPJS: TcxGridDBColumn;
v1BPMiDu: TcxGridDBColumn;
V1BPID: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
ToolBar2: TToolBar;
TBAdd: TToolButton;
TBDel: TToolButton;
ToolButton1: TToolButton;
Panel7: TPanel;
cxDBTreeList1: TcxDBTreeList;
cxDBTreeList1cxDBTreeListColumn2: TcxDBTreeListColumn;
ToolBar3: TToolBar;
ToolPBLE: TToolButton;
cxGridPopupMenu1: TcxGridPopupMenu;
cxGridPopupMenu2: TcxGridPopupMenu;
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
V1BPCF: TcxGridDBColumn;
Label12: TLabel;
cxStyleRepository2: TcxStyleRepository;
cxStyle2: TcxStyle;
BPCF: TEdit;
BPMF: TEdit;
BPKZ: TEdit;
MXCode: TEdit;
Label13: TLabel;
CPMiDu: TEdit;
V1Column2: TcxGridDBColumn;
cxSplitter1: TcxSplitter;
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
BPNameM: TEdit;
BPCodeM: TEdit;
V1BPNote: TcxGridDBColumn;
Label14: TLabel;
BPNote: TEdit;
V1BPPrice: TcxGridDBColumn;
Label15: TLabel;
BPPrice: TEdit;
Label16: TLabel;
V1IFHS: TcxGridDBColumn;
Label17: TLabel;
IFHS: TComboBox;
2025-09-25 15:36:55 +08:00
TbCopy: TToolButton;
2025-01-20 13:04:03 +08:00
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBAddClick(Sender: TObject);
procedure TBSaveClick(Sender: TObject);
procedure TBDelClick(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
2025-09-25 15:36:55 +08:00
procedure TV1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
2025-01-20 13:04:03 +08:00
procedure BPNamehange(Sender: TObject);
procedure V1NotePropertiesEditValueChanged(Sender: TObject);
procedure V1HelpTypePropertiesEditValueChanged(Sender: TObject);
procedure v1note1PropertiesEditValueChanged(Sender: TObject);
procedure V1BPCodePropertiesEditValueChanged(Sender: TObject);
procedure V1BPNamePropertiesEditValueChanged(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
procedure ToolButton5Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure BPCodeMChange(Sender: TObject);
2025-09-25 15:36:55 +08:00
procedure Tv3CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
2025-01-20 13:04:03 +08:00
procedure CYNoChange(Sender: TObject);
procedure CYIDKeyPress(Sender: TObject; var Key: Char);
procedure Button1Click(Sender: TObject);
procedure TPBLBClick(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure Button1KeyPress(Sender: TObject; var Key: Char);
procedure cxDBTreeList1Click(Sender: TObject);
procedure MXCodeKeyPress(Sender: TObject; var Key: Char);
procedure MXNameKeyPress(Sender: TObject; var Key: Char);
procedure BPJSKeyPress(Sender: TObject; var Key: Char);
procedure BPMFKeyPress(Sender: TObject; var Key: Char);
procedure BPKZKeyPress(Sender: TObject; var Key: Char);
procedure BPMiDuKeyPress(Sender: TObject; var Key: Char);
procedure CYNameKeyPress(Sender: TObject; var Key: Char);
procedure CYNoKeyPress(Sender: TObject; var Key: Char);
procedure BPCFKeyPress(Sender: TObject; var Key: Char);
procedure CPMiDuKeyPress(Sender: TObject; var Key: Char);
procedure FormDestroy(Sender: TObject);
2025-09-25 15:36:55 +08:00
procedure TV1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
2025-01-20 13:04:03 +08:00
procedure BPPriceKeyPress(Sender: TObject; var Key: Char);
procedure BPNoteKeyPress(Sender: TObject; var Key: Char);
2025-09-25 15:36:55 +08:00
procedure TbCopyClick(Sender: TObject);
2025-01-20 13:04:03 +08:00
private
2025-09-25 15:36:55 +08:00
FBPID, FCPID, FCPNo, FCPName: string;
2025-01-20 13:04:03 +08:00
procedure InitGrid();
procedure SaveData();
procedure initTree();
{ Private declarations }
public
2025-09-25 15:36:55 +08:00
flag, flagname, snote, MainType, FGYName, Fint, canshu1: string;
fnote, fnote1, forderno, fZdyFlag, ViewFlag, fHelpType: Boolean;
PPSTE: integer;
2025-01-20 13:04:03 +08:00
{ Public declarations }
end;
2025-09-25 15:36:55 +08:00
2025-01-20 13:04:03 +08:00
var
frmBPZDY_LRPB: TfrmBPZDY_LRPB;
implementation
2025-09-25 15:36:55 +08:00
2025-01-20 13:04:03 +08:00
uses
2025-09-25 15:36:55 +08:00
U_DataLink, U_Fun10, U_BPZdy_SH, U_BPZdy_HXK, U_CPTypePB;
2025-01-20 13:04:03 +08:00
{$R *.dfm}
procedure TfrmBPZDY_LRPB.initTree();
begin
with ADOQueryTree do
begin
Close;
SQL.Clear;
SQL.Add('select *');
sql.Add(', Case when isnull(CPNo,'''')<>'''' then RTrim(CPNo)+''/''+CPName else CPName end as CP ');
SQL.Add('from CP_TypePB order by CPlevel,CPOrder,CPName');
Open;
end;
2025-09-25 15:36:55 +08:00
SCreateCDS20(ADOQueryTree, Order_Tree);
SInitCDSData20(ADOQueryTree, Order_Tree);
2025-01-20 13:04:03 +08:00
cxDBTreeList1.Items[0].Expand(true);
end;
procedure TfrmBPZDY_LRPB.SaveData();
2025-09-25 15:36:55 +08:00
var
maxno: string;
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if FGYName <> '' then
exit;
2025-01-20 13:04:03 +08:00
try
ADOQueryCmd.Connection.BeginTrans;
ClientDataSet1.DisableControls;
with ClientDataSet1 do
begin
First;
while not eof do
begin
2025-09-25 15:36:55 +08:00
if Trim(ClientDataSet1.FieldByName('BPID').AsString) = '' then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if GetLSNo(ADOQueryTemp, maxno, 'BP', 'BP_ZDY', 3, 1) = False then
2025-01-20 13:04:03 +08:00
begin
ADOQueryCmd.Connection.RollbackTrans;
ClientDataSet1.EnableControls;
2025-09-25 15:36:55 +08:00
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
Exit;
end;
end
else
begin
2025-09-25 15:36:55 +08:00
maxno := Trim(ClientDataSet1.fieldbyname('BPID').AsString);
2025-01-20 13:04:03 +08:00
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
sql.Add('select * from BP_ZDY where BPID=''' + Trim(maxno) + '''');
2025-01-20 13:04:03 +08:00
Open;
end;
if ADOQueryCmd.IsEmpty then
begin
ADOQueryCmd.Append;
end
else
begin
ADOQueryCmd.Edit;
end;
2025-09-25 15:36:55 +08:00
ADOQueryCmd.FieldByName('BPID').Value := Trim(maxno);
SSetSaveDataCDSNew(ADOQueryCmd, Tv1, ClientDataSet1, 'BP_ZDY', 3);
ADOQueryCmd.FieldByName('BPType').Value := flagName;
ADOQueryCmd.FieldByName('BPFlag').Value := flag;
ADOQueryCmd.FieldByName('valid').Value := 'Y';
2025-01-20 13:04:03 +08:00
ADOQueryCmd.Post;
with ADOQueryTemp do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
sql.add('select * from BP_ZDY where BPCode=''' + Trim(ClientDataSet1.fieldbyname('BPCode').AsString) + '''');
sql.Add(' and BPFlag=''' + trim(flag) + '''');
2025-01-20 13:04:03 +08:00
Open;
end;
2025-09-25 15:36:55 +08:00
if ADOQueryTemp.IsEmpty = False then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if ADOQueryTemp.RecordCount > 1 then
2025-01-20 13:04:03 +08:00
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
SQL.Add('delete BP_ZDY where BPID=''' + Trim(ClientDataSet1.fieldbyname('BPID').AsString) + '''');
2025-01-20 13:04:03 +08:00
ExecSQL;
end;
ADOQueryCmd.Connection.RollbackTrans;
ClientDataSet1.EnableControls;
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
Exit;
end;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
sql.add('select * from BP_ZDY where BPName=''' + Trim(ClientDataSet1.fieldbyname('BPName').AsString) + '''');
sql.add(' and isnull(BPMF,'''')=''' + Trim(ClientDataSet1.fieldbyname('BPMF').AsString) + '''');
sql.add(' and isnull(BPKZ,'''')=''' + Trim(ClientDataSet1.fieldbyname('BPKZ').AsString) + '''');
sql.add(' and isnull(BPJS,'''')=''' + Trim(ClientDataSet1.fieldbyname('BPJS').AsString) + '''');
sql.add(' and isnull(BPWS,'''')=''' + Trim(ClientDataSet1.fieldbyname('BPWS').AsString) + '''');
sql.add(' and isnull(BPMiDu,'''')=''' + Trim(ClientDataSet1.fieldbyname('BPMiDu').AsString) + '''');
sql.add(' and isnull(BPUnit,'''')=''' + Trim(ClientDataSet1.fieldbyname('BPUnit').AsString) + '''');
sql.Add(' and BPFlag=''' + trim(flag) + '''');
2025-01-20 13:04:03 +08:00
Open;
end;
2025-09-25 15:36:55 +08:00
if ADOQueryTemp.IsEmpty = False then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if ADOQueryTemp.RecordCount > 1 then
2025-01-20 13:04:03 +08:00
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
SQL.Add('delete BP_ZDY where BPID=''' + Trim(ClientDataSet1.fieldbyname('BPID').AsString) + '''');
2025-01-20 13:04:03 +08:00
ExecSQL;
end;
ADOQueryCmd.Connection.RollbackTrans;
ClientDataSet1.EnableControls;
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD>ؾ<EFBFBD>ɴγɴ<CEB3>ظ<EFBFBD><D8B8><EFBFBD>', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
Exit;
end;
end;
ClientDataSet1.Edit;
2025-09-25 15:36:55 +08:00
ClientDataSet1.FieldByName('BPID').Value := Trim(maxno);
2025-01-20 13:04:03 +08:00
//ClientDataSet1.Post;
Next;
end;
ClientDataSet1.EnableControls;
end;
2025-09-25 15:36:55 +08:00
TV1.OptionsData.Editing := false;
TV1.OptionsSelection.CellSelect := false;
2025-01-20 13:04:03 +08:00
ADOQueryCmd.Connection.CommitTrans;
2025-09-25 15:36:55 +08:00
except
;
2025-01-20 13:04:03 +08:00
ADOQueryCmd.Connection.RollbackTrans;
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
end;
end;
procedure TfrmBPZDY_LRPB.FormCreate(Sender: TObject);
begin
try
//cxGrid1.Align:=alClient;
with ADOConnection1 do
begin
2025-09-25 15:36:55 +08:00
Connected := false;
ConnectionString := DConString;
2025-01-20 13:04:03 +08:00
//ConnectionString:='';
2025-09-25 15:36:55 +08:00
Connected := true;
2025-01-20 13:04:03 +08:00
end;
2025-09-25 15:36:55 +08:00
except
;
2025-01-20 13:04:03 +08:00
frmBPZDY_LRPB.Free;
end;
2025-09-25 15:36:55 +08:00
canshu1 := Trim(DParameters1);
2025-01-20 13:04:03 +08:00
end;
2025-09-25 15:36:55 +08:00
procedure TfrmBPZDY_LRPB.FormClose(Sender: TObject; var Action: TCloseAction);
2025-01-20 13:04:03 +08:00
begin
ToolBar1.SetFocus;
2025-09-25 15:36:55 +08:00
Action := caFree;
2025-01-20 13:04:03 +08:00
end;
procedure TfrmBPZDY_LRPB.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Close;
sql.Clear;
sql.Add(' exec P_Select_BP :Code,:PState,:CYType,:Stats ');
2025-09-25 15:36:55 +08:00
Parameters.ParamByName('Code').Value := '';
Parameters.ParamByName('PState').Value := 0;
Parameters.ParamByName('CYType').Value := Trim(Order_Tree.fieldbyname('CPID').AsString);
Parameters.ParamByName('Stats').Value := '';
2025-01-20 13:04:03 +08:00
Open;
end;
2025-09-25 15:36:55 +08:00
SCreateCDS20(ADOQueryMain, ClientDataSet1);
SInitCDSData20(ADOQueryMain, ClientDataSet1);
2025-01-20 13:04:03 +08:00
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmBPZDY_LRPB.TBAddClick(Sender: TObject);
var
2025-09-25 15:36:55 +08:00
i: Integer;
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if Order_Tree.FieldByName('CPLevel').AsInteger < 3 then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
Panel5.Visible := False;
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
Exit;
2025-09-25 15:36:55 +08:00
end
else
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
Panel5.Visible := True;
SClearData(Panel5, 2);
BPMF.Text := '160';
BPCF.Text := '100%P';
FBPID := '';
2025-01-20 13:04:03 +08:00
MXCode.SetFocus;
2025-09-25 15:36:55 +08:00
Button1.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
2025-01-20 13:04:03 +08:00
end;
end;
procedure TfrmBPZDY_LRPB.TBSaveClick(Sender: TObject);
var
2025-09-25 15:36:55 +08:00
maxno: string;
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if ClientDataSet1.IsEmpty then
Exit;
2025-01-20 13:04:03 +08:00
Toolbar1.SetFocus;
2025-09-25 15:36:55 +08:00
if ClientDataSet1.Locate('BPCode', null, []) then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
Exit;
end;
2025-09-25 15:36:55 +08:00
if ClientDataSet1.Locate('BPCode', '', []) then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
Exit;
end;
2025-09-25 15:36:55 +08:00
if ClientDataSet1.Locate('BPName', null, []) then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
Exit;
end;
2025-09-25 15:36:55 +08:00
if ClientDataSet1.Locate('BPName', '', []) then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
Exit;
end;
SaveData();
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
end;
procedure TfrmBPZDY_LRPB.TBDelClick(Sender: TObject);
begin
MXCode.SetFocus;
2025-09-25 15:36:55 +08:00
if ClientDataSet1.IsEmpty then
Exit;
if Trim(ClientDataSet1.FieldByName('BPID').AsString) <> '' then
2025-01-20 13:04:03 +08:00
begin
with ADOQueryTemp do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
sql.Add('select * from ML_Manage_PB where isnull(BPID,'''')=''' + Trim(FBPID) + '''');
2025-01-20 13:04:03 +08:00
Open;
end;
2025-09-25 15:36:55 +08:00
if ADOQueryTemp.IsEmpty = False then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
Exit;
end;
2025-09-25 15:36:55 +08:00
if application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD>?', '<27><>ʾ<EFBFBD><CABE>Ϣ', 1) = 2 then
exit;
2025-01-20 13:04:03 +08:00
with ADOQueryCmd do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
sql.Add('delete BP_ZDY where BPID=''' + Trim(ClientDataSet1.fieldbyname('BPID').AsString) + '''');
2025-01-20 13:04:03 +08:00
ExecSQL;
end;
end;
ClientDataSet1.Delete;
2025-09-25 15:36:55 +08:00
SClearData(Panel5, 2);
BPMF.Text := '160';
BPCF.Text := '100%P';
FBPID := '';
2025-01-20 13:04:03 +08:00
end;
procedure TfrmBPZDY_LRPB.TBCloseClick(Sender: TObject);
begin
panel1.SetFocus;
2025-09-25 15:36:55 +08:00
WriteCxGrid('<27>Զ<EFBFBD><D4B6><EFBFBD>' + Trim(flag) + '1YX1', TV1, '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
WriteCxGrid('<27>Զ<EFBFBD><D4B6><EFBFBD>' + Trim(flag) + '2YX1', TV2, '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
2025-01-20 13:04:03 +08:00
Close;
end;
procedure TfrmBPZDY_LRPB.FormShow(Sender: TObject);
begin
initTree();
InitGrid();
2025-09-25 15:36:55 +08:00
ReadCxGrid('<27>Զ<EFBFBD><D4B6><EFBFBD>' + Trim(flag) + '1YX1', TV1, '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
ReadCxGrid('<27>Զ<EFBFBD><D4B6><EFBFBD>' + Trim(flag) + '2YX1', TV2, '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
frmBPZDY_LRPB.Caption := Trim(flagname);
if ViewFlag = True then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
TBAdd.Visible := False;
TbCopy.Visible := False;
TBDel.Visible := False;
ToolButton1.Visible := true;
2025-01-20 13:04:03 +08:00
end;
2025-09-25 15:36:55 +08:00
if canshu1 = '<27><>ѯ' then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
ToolBar3.Visible := False;
ToolBar2.Visible := false;
Button1.Visible := false;
Panel2.Visible := false;
cxSplitter1.Visible := false;
Panel4.Align := alClient;
V1BPNote.Visible := False;
V1BPPrice.Visible := false;
Label15.Visible := false;
BPPrice.Visible := false;
Label14.Visible := false;
BPNote.Visible := false;
2025-01-20 13:04:03 +08:00
end
else
begin
2025-09-25 15:36:55 +08:00
ToolBar3.Visible := true;
ToolBar2.Visible := true;
Button1.Visible := true;
Panel2.Visible := true;
cxSplitter1.Visible := true;
Panel4.Align := alLeft;
V1BPNote.Visible := true;
V1BPPrice.Visible := true;
Label15.Visible := true;
BPPrice.Visible := true;
Label14.Visible := true;
BPNote.Visible := true;
2025-01-20 13:04:03 +08:00
end;
end;
2025-09-25 15:36:55 +08:00
procedure TfrmBPZDY_LRPB.TV1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
var
i: integer;
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if ToolButton1.Visible = true then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
Fint := '1';
ModalResult := 1;
end
else
2025-01-20 13:04:03 +08:00
begin
ToolBar1.SetFocus;
2025-09-25 15:36:55 +08:00
if ClientDataSet1.IsEmpty then
exit;
BPMF.Text := Trim(ClientDataSet1.fieldbyname('BPMF').AsString);
BPKZ.Text := Trim(ClientDataSet1.fieldbyname('BPKZ').AsString);
BPCF.Text := Trim(ClientDataSet1.fieldbyname('BPCF').AsString);
BPJS.Text := Trim(ClientDataSet1.fieldbyname('BPJS').AsString);
BPMiDu.Text := Trim(ClientDataSet1.fieldbyname('BPMiDu').AsString);
CPMiDu.Text := Trim(ClientDataSet1.fieldbyname('CPMiDu').AsString);
MXCode.Text := Trim(ClientDataSet1.FieldByName('MXCode').AsString);
MXName.Text := Trim(ClientDataSet1.FieldByName('MXName').AsString);
IFHS.Text := Trim(ClientDataSet1.FieldByName('IFHS').AsString);
BPPrice.Text := Trim(ClientDataSet1.FieldByName('BPPrice').AsString);
BPNote.Text := Trim(ClientDataSet1.FieldByName('BPNote').AsString);
FBPID := Trim(ClientDataSet1.fieldbyname('BPID').AsString);
FCPID := Trim(ClientDataSet1.fieldbyname('CPID').AsString);
FCPNo := Trim(ClientDataSet1.fieldbyname('CPNo').AsString);
FCPName := Trim(ClientDataSet1.fieldbyname('CPName').AsString);
Panel5.Visible := True;
Button1.Caption := '<27>޸ı<DEB8><C4B1><EFBFBD>';
TBDel.Visible := True;
TBCopy.Visible := True;
2025-01-20 13:04:03 +08:00
end;
end;
procedure TfrmBPZDY_LRPB.BPNamehange(Sender: TObject);
var
2025-09-25 15:36:55 +08:00
fsj: string;
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if Trim(BPNameM.Text) <> '' then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
fsj := ' BPName like ''' + '%' + Trim(BPNameM.Text) + '%' + '''';
2025-01-20 13:04:03 +08:00
end;
if ADOQueryMain.Active then
begin
2025-09-25 15:36:55 +08:00
SDofilter(ADOQueryMain, fsj);
SCreateCDS20(ADOQueryMain, ClientDataSet1);
SInitCDSData20(ADOQueryMain, ClientDataSet1);
2025-01-20 13:04:03 +08:00
end;
end;
procedure TfrmBPZDY_LRPB.V1NotePropertiesEditValueChanged(Sender: TObject);
var
2025-09-25 15:36:55 +08:00
mvalue: string;
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
mvalue := TcxTextEdit(Sender).EditingText;
2025-01-20 13:04:03 +08:00
with ClientDataSet1 do
begin
Edit;
2025-09-25 15:36:55 +08:00
FieldByName('BPKZ').Value := mvalue;
2025-01-20 13:04:03 +08:00
//Post;
end;
end;
2025-09-25 15:36:55 +08:00
procedure TfrmBPZDY_LRPB.V1HelpTypePropertiesEditValueChanged(Sender: TObject);
2025-01-20 13:04:03 +08:00
var
2025-09-25 15:36:55 +08:00
mvalue: string;
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
mvalue := TcxTextEdit(Sender).EditingText;
2025-01-20 13:04:03 +08:00
with ClientDataSet1 do
begin
Edit;
2025-09-25 15:36:55 +08:00
FieldByName('BPWS').Value := mvalue;
2025-01-20 13:04:03 +08:00
Post;
end;
{with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('Update KH_Zdy Set HelpType='''+Trim(mvalue)+'''');
sql.Add(' where ZdyNo='''+Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString)+'''');
ExecSQL;
end;}
end;
procedure TfrmBPZDY_LRPB.v1note1PropertiesEditValueChanged(Sender: TObject);
var
2025-09-25 15:36:55 +08:00
mvalue: string;
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
mvalue := TcxTextEdit(Sender).EditingText;
2025-01-20 13:04:03 +08:00
with ClientDataSet1 do
begin
Edit;
2025-09-25 15:36:55 +08:00
FieldByName('BPMiDu').Value := mvalue;
2025-01-20 13:04:03 +08:00
Post;
end;
end;
procedure TfrmBPZDY_LRPB.V1BPCodePropertiesEditValueChanged(Sender: TObject);
var
2025-09-25 15:36:55 +08:00
mvalue: string;
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
mvalue := TcxTextEdit(Sender).EditingText;
2025-01-20 13:04:03 +08:00
with ClientDataSet1 do
begin
Edit;
2025-09-25 15:36:55 +08:00
FieldByName('BPCode').Value := mvalue;
2025-01-20 13:04:03 +08:00
end;
{with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('Update BP_ZDY Set BPCode='''+Trim(mvalue)+'''');
sql.Add(' where BPID='''+Trim(ClientDataSet1.fieldbyname('BPID').AsString)+'''');
ExecSQL;
end;}
end;
procedure TfrmBPZDY_LRPB.V1BPNamePropertiesEditValueChanged(Sender: TObject);
var
2025-09-25 15:36:55 +08:00
mvalue: string;
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
mvalue := TcxTextEdit(Sender).EditingText;
2025-01-20 13:04:03 +08:00
with ClientDataSet1 do
begin
Edit;
2025-09-25 15:36:55 +08:00
FieldByName('BPName').Value := mvalue;
2025-01-20 13:04:03 +08:00
end;
end;
procedure TfrmBPZDY_LRPB.ToolButton4Click(Sender: TObject);
begin
ToolBar1.SetFocus;
2025-09-25 15:36:55 +08:00
if ClientDataSet1.IsEmpty then
exit;
if ClientDataSet1.FieldByName('BPID').AsString = '' then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
application.MessageBox('<27><EFBFBD><EBB1A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', '<27><>ʾ');
2025-01-20 13:04:03 +08:00
exit;
end;
with ML_GYS do
begin
Append;
post;
end;
end;
procedure TfrmBPZDY_LRPB.ToolButton5Click(Sender: TObject);
begin
ToolBar1.SetFocus;
2025-09-25 15:36:55 +08:00
if ML_GYS.IsEmpty then
Exit;
if Trim(ML_GYS.FieldByName('BPSubID').AsString) <> '' then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD>?', '<27><>ʾ<EFBFBD><CABE>Ϣ', 1) = 2 then
exit;
2025-01-20 13:04:03 +08:00
with ADOQueryCmd do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
sql.Add('delete BP_ZDY_Sub where BPSubID=''' + Trim(ML_GYS.fieldbyname('BPSubID').AsString) + '''');
2025-01-20 13:04:03 +08:00
ExecSQL;
end;
end;
ML_GYS.Delete;
end;
procedure TfrmBPZDY_LRPB.ToolButton3Click(Sender: TObject);
2025-09-25 15:36:55 +08:00
var
maxno: string;
2025-01-20 13:04:03 +08:00
begin
ToolBar1.SetFocus;
try
ADOQueryCmd.Connection.BeginTrans;
ML_GYS.DisableControls;
with ML_GYS do
begin
First;
while not eof do
begin
2025-09-25 15:36:55 +08:00
if Trim(ML_GYS.FieldByName('BPSubID').AsString) = '' then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if GetLSNo(ADOQueryTemp, maxno, 'BS', 'BP_ZDY_Sub', 3, 1) = False then
2025-01-20 13:04:03 +08:00
begin
ADOQueryCmd.Connection.RollbackTrans;
ML_GYS.EnableControls;
2025-09-25 15:36:55 +08:00
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
Exit;
end;
end
else
begin
2025-09-25 15:36:55 +08:00
maxno := Trim(ML_GYS.fieldbyname('BPSubID').AsString);
2025-01-20 13:04:03 +08:00
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
sql.Add('select * from BP_ZDY_Sub where BPSubID=''' + Trim(maxno) + '''');
2025-01-20 13:04:03 +08:00
Open;
end;
if ADOQueryCmd.IsEmpty then
begin
ADOQueryCmd.Append;
end
else
begin
ADOQueryCmd.edit;
end;
2025-09-25 15:36:55 +08:00
ADOQueryCmd.FieldByName('BPSubID').Value := Trim(maxno);
ADOQueryCmd.FieldByName('BPCode').Value := Trim(ClientDataSet1.fieldbyname('BPCode').AsString);
ADOQueryCmd.FieldByName('BPID').Value := Trim(ClientDataSet1.fieldbyname('BPID').AsString);
SSetSaveDataCDSNew(ADOQueryCmd, Tv2, ML_GYS, 'BP_ZDY_Sub', 1);
ADOQueryCmd.FieldByName('BPPrice').Value := ML_GYS.fieldbyname('BPPrice').AsString;
ADOQueryCmd.FieldByName('BPType').Value := flagName;
ADOQueryCmd.FieldByName('BPFlag').Value := flag;
ADOQueryCmd.FieldByName('valid').Value := 'Y';
2025-01-20 13:04:03 +08:00
ADOQueryCmd.Post;
ML_GYS.Edit;
2025-09-25 15:36:55 +08:00
ML_GYS.FieldByName('BPSubID').Value := Trim(maxno);
2025-01-20 13:04:03 +08:00
Next;
end;
ML_GYS.EnableControls;
end;
ADOQueryCmd.Connection.CommitTrans;
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ', 0);
except
;
2025-01-20 13:04:03 +08:00
ADOQueryCmd.Connection.RollbackTrans;
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
end;
end;
procedure TfrmBPZDY_LRPB.BPCodeMChange(Sender: TObject);
var
2025-09-25 15:36:55 +08:00
fsj: string;
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if Trim(BPCodeM.Text) <> '' then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
fsj := ' BPCode like ''' + '%' + Trim(BPCodeM.Text) + '%' + '''';
2025-01-20 13:04:03 +08:00
end;
if ADOQueryMain.Active then
begin
2025-09-25 15:36:55 +08:00
SDofilter(ADOQueryMain, fsj);
SCreateCDS20(ADOQueryMain, ClientDataSet1);
SInitCDSData20(ADOQueryMain, ClientDataSet1);
2025-01-20 13:04:03 +08:00
end;
end;
2025-09-25 15:36:55 +08:00
procedure TfrmBPZDY_LRPB.Tv3CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
var
i: Integer;
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if ML_GX.IsEmpty then
exit;
2025-01-20 13:04:03 +08:00
ML_GX.Delete;
2025-09-25 15:36:55 +08:00
i := 1;
2025-01-20 13:04:03 +08:00
ML_GX.DisableControls;
with ML_GX do
begin
first;
while not eof do
begin
Edit;
2025-09-25 15:36:55 +08:00
FieldByName('BPMiDu').Value := i;
i := i + 1;
2025-01-20 13:04:03 +08:00
next;
end;
end;
ML_GX.EnableControls;
end;
procedure TfrmBPZDY_LRPB.CYNoChange(Sender: TObject);
var
2025-09-25 15:36:55 +08:00
fsj: string;
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if Trim(CYNo.Text) <> '' then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
fsj := ' CYNo like ''' + '%' + Trim(CYNo.Text) + '%' + '''';
2025-01-20 13:04:03 +08:00
end;
if ADOQueryMain.Active then
begin
2025-09-25 15:36:55 +08:00
SDofilter(ADOQueryMain, fsj);
SCreateCDS20(ADOQueryMain, ML_GX);
SInitCDSData20(ADOQueryMain, ML_GX);
2025-01-20 13:04:03 +08:00
end;
end;
procedure TfrmBPZDY_LRPB.CYIDKeyPress(Sender: TObject; var Key: Char);
2025-09-25 15:36:55 +08:00
var
FMXCYID, FColNo, FCYType, CPID: string;
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if Key = #13 then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if Trim(CYID.Text) = '' then
Exit;
2025-01-20 13:04:03 +08:00
with ADOQuery6 do
begin
close;
sql.Clear;
sql.Add('select A.CYID MXCYType,A.ColorNo,CYType=isnull((select Top 1 C.CYType from CP_YDang B inner join CP_YDang C on C.CYID=B.CYType where B.CYID=A.CYID)');
SQL.Add(',(select Top 1 B.CYType from CP_YDang B where B.CYID=A.CYID))');
sql.Add(',CYID=isnull((select Top 1 C.CYID from CP_YDang B inner join CP_YDang C on C.CYID=B.CYType where B.CYID=A.CYID),');
sql.Add('(select Top 1 B.CYID from CP_YDang B where B.CYID=A.CYID))');
2025-09-25 15:36:55 +08:00
sql.Add(' from CP_YDang_Color A where A.CLRID=''' + trim(CYID.Text) + '''');
2025-01-20 13:04:03 +08:00
//ShowMessage(sql.Text);
Open;
end;
with ADOQuery2 do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
sql.Add('select * from CP_YDang where CYID=''' + Trim(CYID.Text) + '''');
2025-01-20 13:04:03 +08:00
Open;
end;
with ADOQuery3 do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
sql.Add('select * from CP_YDang where CYID=''' + Trim(ADOQuery2.fieldbyname('CYType').AsString) + '''');
2025-01-20 13:04:03 +08:00
Open;
end;
2025-09-25 15:36:55 +08:00
if ADOQuery6.IsEmpty = false then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
CPID := Trim(ADOQuery6.fieldbyname('CYType').AsString);
FMXCYID := Trim(ADOQuery6.fieldbyname('CYID').AsString);
FColNo := Trim(ADOQuery6.fieldbyname('ColorNo').AsString);
FCYType := Trim(ADOQuery6.fieldbyname('MXCYType').AsString);
2025-01-20 13:04:03 +08:00
end;
2025-09-25 15:36:55 +08:00
if ADOQuery2.IsEmpty = false then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
CPID := Trim(ADOQuery2.fieldbyname('CYType').AsString);
FMXCYID := Trim(ADOQuery2.fieldbyname('CYID').AsString);
2025-01-20 13:04:03 +08:00
end;
2025-09-25 15:36:55 +08:00
if ADOQuery3.IsEmpty = false then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
CPID := Trim(ADOQuery3.fieldbyname('CYType').AsString);
FMXCYID := Trim(ADOQuery3.fieldbyname('CYID').AsString);
FCYType := Trim(CYID.Text);
2025-01-20 13:04:03 +08:00
end;
with ADOQuery2 do
begin
Close;
sql.Clear;
sql.Add(' exec P_Select_CP_YDang1 :CYType,:CP,:RON,:WSql,:Stats ');
2025-09-25 15:36:55 +08:00
Parameters.ParamByName('CYType').Value := CPID;
Parameters.ParamByName('CP').Value := 1;
Parameters.ParamByName('RON').Value := 100;
Parameters.ParamByName('WSql').Value := ' CYID=''' + Trim(FMXCYID) + ''' ';
Parameters.ParamByName('Stats').Value := 2;
2025-01-20 13:04:03 +08:00
Open;
end;
2025-09-25 15:36:55 +08:00
SCreateCDS20(ADOQuery2, ML_GX);
SInitCDSData20(ADOQuery2, ML_GX);
CYID.Text := '';
2025-01-20 13:04:03 +08:00
end;
end;
procedure TfrmBPZDY_LRPB.Button1Click(Sender: TObject);
var
2025-09-25 15:36:55 +08:00
maxno, FCPMiDu: string;
FInt: Integer;
FReal: Double;
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if Button1.Caption = '<27>޸ı<DEB8><C4B1><EFBFBD>' then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if Application.MessageBox(<><C8B7>Ҫ<EFBFBD>޸ı<DEB8><C4B1><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 1) = 2 then
exit;
2025-01-20 13:04:03 +08:00
end;
2025-09-25 15:36:55 +08:00
if Button1.Caption = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if Label16.Caption = '' then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
2025-01-20 13:04:03 +08:00
exit;
end;
end;
2025-09-25 15:36:55 +08:00
if MXCode.Text = '' then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
application.MessageBox('<27><><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>', '<27><>ʾ');
2025-01-20 13:04:03 +08:00
exit;
end;
2025-09-25 15:36:55 +08:00
if Length(MXCode.Text) > 2 then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
application.MessageBox('<27><><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD><32><CEBB>', '<27><>ʾ');
2025-01-20 13:04:03 +08:00
exit;
end;
2025-09-25 15:36:55 +08:00
if TryStrToInt(MXCode.Text, FInt) = False then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
Exit;
end;
2025-09-25 15:36:55 +08:00
if Trim(BPPrice.Text) <> '' then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if TryStrToFloat(BPPrice.Text, FReal) = False then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD>۷Ƿ<DBB7><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
Exit;
end;
end;
2025-09-25 15:36:55 +08:00
if Trim(Button1.Caption) <> '<27>޸ı<DEB8><C4B1><EFBFBD>' then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if Order_Tree.FieldByName('CPLevel').AsInteger = 1 then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
2025-01-20 13:04:03 +08:00
exit;
end;
end;
2025-09-25 15:36:55 +08:00
if Trim(BPMF.Text) <> '' then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if TryStrToInt(BPMF.Text, FInt) = False then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27>ŷ<EFBFBD><C5B7>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
Exit;
end;
end;
2025-09-25 15:36:55 +08:00
if Trim(BPKZ.Text) <> '' then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if TryStrToInt(BPKZ.Text, FInt) = False then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD>طǷ<D8B7><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
Exit;
end;
end;
2025-09-25 15:36:55 +08:00
FCPMiDu := Trim(CPMiDu.Text);
if Trim(FCPMiDu) <> '' then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if Pos('T', FCPMiDu) <> Length(FCPMiDu) then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
CPMiDu.Text := CPMiDu.Text + 'T';
2025-01-20 13:04:03 +08:00
end;
end;
try
ADOQueryCmd.Connection.BeginTrans;
2025-09-25 15:36:55 +08:00
if FBPID = '' then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if GetLSNo(ADOQueryTemp, FBPID, 'BP', 'BP_ZDY', 3, 1) = False then
2025-01-20 13:04:03 +08:00
begin
ADOQueryCmd.Connection.RollbackTrans;
2025-09-25 15:36:55 +08:00
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
Exit;
end;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
sql.Add('select * from BP_ZDY where BPID=''' + Trim(FBPID) + '''');
2025-01-20 13:04:03 +08:00
Open;
end;
if ADOQueryCmd.IsEmpty then
begin
ADOQueryCmd.Append;
end
else
begin
ADOQueryCmd.Edit;
end;
2025-09-25 15:36:55 +08:00
ADOQueryCmd.FieldByName('BPID').Value := Trim(FBPID);
2025-01-20 13:04:03 +08:00
//SSetsaveSqlNew(ADOQueryCmd,'BP_ZDY',panel5,2);
2025-09-25 15:36:55 +08:00
RTSetsavedata(ADOQueryCmd, 'BP_ZDY', panel5, 2);
ADOQueryCmd.FieldByName('BPType').Value := flagName;
ADOQueryCmd.FieldByName('BPFlag').Value := flag;
ADOQueryCmd.FieldByName('valid').Value := 'Y';
ADOQueryCmd.FieldByName('CPID').Value := trim(FCPID);
ADOQueryCmd.FieldByName('CPNo').Value := trim(FCPNo);
ADOQueryCmd.FieldByName('CPName').Value := trim(FCPName);
ADOQueryCmd.FieldByName('IFHS').AsString := Trim(IFHS.Text);
if Trim(BPPrice.Text) <> '' then
ADOQueryCmd.FieldByName('BPPrice').Value := BPPrice.Text
2025-01-20 13:04:03 +08:00
else
2025-09-25 15:36:55 +08:00
ADOQueryCmd.FieldByName('BPPrice').Value := Null;
ADOQueryCmd.FieldByName('BPNote').Value := Trim(BPNote.Text);
ADOQueryCmd.FieldByName('BPCode').Value := trim(FCPNo) + trim(MXCode.Text);
ADOQueryCmd.FieldByName('BPName').Value := trim(MXName.Text);
ADOQueryCmd.FieldByName('BPCF').Value := trim(BPCF.Text);
2025-01-20 13:04:03 +08:00
ADOQueryCmd.Post;
with ADOQueryTemp do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
sql.add('select * from BP_ZDY where BPCode=''' + Trim(trim(FCPNo) + trim(MXCode.Text)) + '''');
sql.Add(' and BPFlag=''' + trim(flag) + '''');
2025-01-20 13:04:03 +08:00
Open;
end;
2025-09-25 15:36:55 +08:00
if ADOQueryTemp.RecordCount > 1 then
2025-01-20 13:04:03 +08:00
begin
ADOQueryCmd.Connection.RollbackTrans;
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
Exit;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
sql.add('select * from BP_ZDY where BPCode=''' + Trim(trim(FCPNo) + trim(MXCode.Text)) + '''');
sql.Add(' and BPName=''' + Trim(trim(FCPName) + trim(MXName.Text)) + '''');
sql.Add(' and BPFlag=''' + trim(flag) + '''');
2025-01-20 13:04:03 +08:00
Open;
end;
2025-09-25 15:36:55 +08:00
if ADOQueryTemp.RecordCount > 1 then
2025-01-20 13:04:03 +08:00
begin
ADOQueryCmd.Connection.RollbackTrans;
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD>ź<EFBFBD><C5BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
Exit;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
sql.add('select * from BP_ZDY where BPName=''' + Trim(trim(FCPName) + trim(MXName.Text)) + '''');
sql.add(' and isnull(BPMF,'''')=''' + Trim(BPMF.Text) + '''');
sql.add(' and isnull(BPKZ,'''')=''' + Trim(BPKZ.Text) + '''');
sql.add(' and isnull(BPJS,'''')=''' + Trim(BPJS.Text) + '''');
sql.add(' and isnull(BPMiDu,'''')=''' + Trim(BPMiDu.Text) + '''');
sql.Add(' and BPFlag=''' + trim(flag) + '''');
2025-01-20 13:04:03 +08:00
Open;
end;
2025-09-25 15:36:55 +08:00
if ADOQueryTemp.RecordCount > 1 then
2025-01-20 13:04:03 +08:00
begin
ADOQueryCmd.Connection.RollbackTrans;
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><>Ϣ<EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
Exit;
end;
with ClientDataSet1 do
begin
2025-09-25 15:36:55 +08:00
if Button1.Caption <> '<27>޸ı<DEB8><C4B1><EFBFBD>' then
2025-01-20 13:04:03 +08:00
Append
else
edit;
2025-09-25 15:36:55 +08:00
FieldByName('BPID').Value := Trim(FBPID);
FieldByName('BPCode').Value := trim(FCPNo) + Trim(MXCode.Text);
FieldByName('BPName').Value := Trim(MXName.Text);
FieldByName('BPMF').Value := Trim(BPMF.Text);
FieldByName('BPCF').Value := Trim(BPCF.Text);
FieldByName('BPKZ').Value := Trim(BPKZ.Text);
FieldByName('BPJS').Value := Trim(BPJS.Text);
FieldByName('BPMiDu').Value := Trim(BPMiDu.Text);
FieldByName('CPMiDu').Value := Trim(CPMiDu.Text);
FieldByName('MXCode').Value := Trim(MXCode.Text);
FieldByName('MXName').Value := Trim(MXName.Text);
FieldByName('IFHS').AsString := Trim(IFHS.Text);
if Trim(BPPrice.Text) <> '' then
FieldByName('BPPrice').Value := BPPrice.Text
2025-01-20 13:04:03 +08:00
else
2025-09-25 15:36:55 +08:00
FieldByName('BPPrice').Value := Null;
FieldByName('BPNote').Value := Trim(BPNote.Text);
2025-01-20 13:04:03 +08:00
post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
sql.Add('UPdate ML_Manage Set MLCF=''' + Trim(BPCF.Text) + ''',MLJWMD=''' + Trim(CPMiDu.Text) + '''');
SQL.Add(' where SUBSTRING(MLNO,2,LEN(MLNO)-1)=''' + Trim(ClientDataSet1.fieldbyname('BPCode').AsString) + '''');
2025-01-20 13:04:03 +08:00
sql.Add(' and isnull(GYType,'''')=''Ⱦɫ'' ');
sql.Add(' and isnull(MLType,'''')=''Ⱦɫ<C8BE><C9AB><EFBFBD><EFBFBD>''');
ExecSQL;
end;
//cxGrid1.Enabled:=true;
2025-09-25 15:36:55 +08:00
SClearData(Panel5, 2);
BPMF.Text := '160';
BPCF.Text := '100%P';
FBPID := '';
Button1.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
Panel5.Visible := false;
TBDel.Visible := False;
TbCopy.Visible := False;
2025-01-20 13:04:03 +08:00
ADOQueryCmd.Connection.CommitTrans;
2025-09-25 15:36:55 +08:00
except
2025-01-20 13:04:03 +08:00
ADOQueryCmd.Connection.RollbackTrans;
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
end;
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>', '<27><>ʾ');
2025-01-20 13:04:03 +08:00
end;
procedure TfrmBPZDY_LRPB.TPBLBClick(Sender: TObject);
begin
2025-09-25 15:36:55 +08:00
frmCPTypePB := TfrmCPTypePB.Create(self);
2025-01-20 13:04:03 +08:00
with frmCPTypePB do
begin
2025-09-25 15:36:55 +08:00
if ShowModal = 1 then
2025-01-20 13:04:03 +08:00
begin
end;
free;
end;
initTree();
end;
procedure TfrmBPZDY_LRPB.ToolButton1Click(Sender: TObject);
begin
ToolBar1.SetFocus;
2025-09-25 15:36:55 +08:00
FInt := '1';
ModalResult := 1;
2025-01-20 13:04:03 +08:00
end;
procedure TfrmBPZDY_LRPB.Button1KeyPress(Sender: TObject; var Key: Char);
2025-09-25 15:36:55 +08:00
var
maxno: string;
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if Key = #13 then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if MXCode.Text = '' then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
application.MessageBox('<27><>ϸ<EFBFBD><CFB8><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>', '<27><>ʾ');
2025-01-20 13:04:03 +08:00
exit;
end;
try
ADOQueryCmd.Connection.BeginTrans;
2025-09-25 15:36:55 +08:00
if FBPID = '' then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if GetLSNo(ADOQueryTemp, FBPID, 'BP', 'BP_ZDY', 3, 1) = False then
2025-01-20 13:04:03 +08:00
begin
ADOQueryCmd.Connection.RollbackTrans;
2025-09-25 15:36:55 +08:00
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
Exit;
end;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
sql.Add('select * from BP_ZDY where BPID=''' + Trim(FBPID) + '''');
2025-01-20 13:04:03 +08:00
Open;
end;
if ADOQueryCmd.IsEmpty then
begin
ADOQueryCmd.Append;
end
else
begin
ADOQueryCmd.Edit;
end;
2025-09-25 15:36:55 +08:00
ADOQueryCmd.FieldByName('BPID').Value := Trim(FBPID);
SSetsaveSqlNew(ADOQueryCmd, 'BP_ZDY', panel5, 2);
ADOQueryCmd.FieldByName('BPType').Value := flagName;
ADOQueryCmd.FieldByName('BPFlag').Value := flag;
ADOQueryCmd.FieldByName('valid').Value := 'Y';
ADOQueryCmd.FieldByName('CPID').Value := trim(FCPID);
ADOQueryCmd.FieldByName('CPNo').Value := trim(FCPNo);
ADOQueryCmd.FieldByName('CPName').Value := trim(FCPName);
ADOQueryCmd.FieldByName('BPCode').Value := trim(FCPNo) + trim(MXCode.Text);
ADOQueryCmd.FieldByName('BPName').Value := trim(MXName.Text);
2025-01-20 13:04:03 +08:00
ADOQueryCmd.Post;
with ADOQueryTemp do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
sql.add('select * from BP_ZDY where BPCode=''' + Trim(trim(FCPNo) + trim(MXCode.Text)) + '''');
sql.Add(' and BPFlag=''' + trim(flag) + '''');
2025-01-20 13:04:03 +08:00
Open;
end;
2025-09-25 15:36:55 +08:00
if ADOQueryTemp.IsEmpty = False then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if ADOQueryTemp.RecordCount > 1 then
2025-01-20 13:04:03 +08:00
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
SQL.Add('delete BP_ZDY where BPID=''' + Trim(FBPID) + '''');
2025-01-20 13:04:03 +08:00
ExecSQL;
end;
ADOQueryCmd.Connection.RollbackTrans;
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
Exit;
end;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
sql.add('select * from BP_ZDY where BPName=''' + Trim(trim(FCPName) + trim(MXName.Text)) + '''');
sql.add(' and isnull(BPMF,'''')=''' + Trim(BPMF.Text) + '''');
sql.add(' and isnull(BPKZ,'''')=''' + Trim(BPKZ.Text) + '''');
sql.add(' and isnull(BPJS,'''')=''' + Trim(BPJS.Text) + '''');
sql.add(' and isnull(BPMiDu,'''')=''' + Trim(BPMiDu.Text) + '''');
sql.Add(' and BPFlag=''' + trim(flag) + '''');
2025-01-20 13:04:03 +08:00
Open;
end;
2025-09-25 15:36:55 +08:00
if ADOQueryTemp.IsEmpty = False then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if ADOQueryTemp.RecordCount > 1 then
2025-01-20 13:04:03 +08:00
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
SQL.Add('delete BP_ZDY where BPID=''' + Trim(FBPID) + '''');
2025-01-20 13:04:03 +08:00
ExecSQL;
end;
ADOQueryCmd.Connection.RollbackTrans;
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD>ؾ<EFBFBD>ɴγɴ<CEB3>ظ<EFBFBD><D8B8><EFBFBD>', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
Exit;
end;
end;
with ClientDataSet1 do
begin
2025-09-25 15:36:55 +08:00
if Button1.Caption <> <><C8B7><EFBFBD>޸<EFBFBD>' then
Append
2025-01-20 13:04:03 +08:00
else
2025-09-25 15:36:55 +08:00
edit;
FieldByName('BPID').Value := Trim(FBPID);
FieldByName('BPCode').Value := Trim(MXCode.Text);
FieldByName('BPName').Value := Trim(MXName.Text);
FieldByName('BPMF').Value := Trim(BPMF.Text);
FieldByName('BPKZ').Value := Trim(BPKZ.Text);
FieldByName('BPJS').Value := Trim(BPJS.Text);
FieldByName('BPMiDu').Value := Trim(BPMiDu.Text);
FieldByName('MXCode').Value := Trim(MXCode.Text);
FieldByName('MXName').Value := Trim(MXName.Text);
2025-01-20 13:04:03 +08:00
post;
end;
2025-09-25 15:36:55 +08:00
MXCode.Text := '';
MXName.Text := '';
BPJS.Text := '';
BPMF.Text := '';
BPKZ.Text := '';
BPMiDu.Text := '';
FBPID := '';
2025-01-20 13:04:03 +08:00
MXCode.SetFocus;
ADOQueryCmd.Connection.CommitTrans;
2025-09-25 15:36:55 +08:00
except
;
2025-01-20 13:04:03 +08:00
ADOQueryCmd.Connection.RollbackTrans;
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
2025-01-20 13:04:03 +08:00
end;
2025-09-25 15:36:55 +08:00
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>', '<27><>ʾ');
2025-01-20 13:04:03 +08:00
end;
end;
2025-09-25 15:36:55 +08:00
////////////////////////////////////////////////////////////
/// Ŀ¼<C4BF><C2BC>ѡ<EFBFBD><D1A1>
2025-01-20 13:04:03 +08:00
procedure TfrmBPZDY_LRPB.cxDBTreeList1Click(Sender: TObject);
begin
InitGrid();
2025-09-25 15:36:55 +08:00
TBDel.Visible := False;
TbCopy.Visible := False;
Panel5.Visible := False;
if Order_Tree.FieldByName('CPLevel').AsInteger < 3 then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
TBAdd.Visible := False;
end
else
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
FBPID := '';
FCPID := Trim(Order_Tree.fieldbyname('CPID').AsString);
FCPNo := Trim(Order_Tree.fieldbyname('CPNo').AsString);
FCPName := Trim(Order_Tree.fieldbyname('CPName').AsString);
TBAdd.Visible := True;
2025-01-20 13:04:03 +08:00
end;
2025-09-25 15:36:55 +08:00
Label16.Caption := Trim(Order_Tree.fieldbyname('CPNo').AsString);
2025-01-20 13:04:03 +08:00
end;
procedure TfrmBPZDY_LRPB.MXCodeKeyPress(Sender: TObject; var Key: Char);
begin
2025-09-25 15:36:55 +08:00
if Key = #13 then
2025-01-20 13:04:03 +08:00
begin
MXName.SetFocus;
end;
end;
procedure TfrmBPZDY_LRPB.MXNameKeyPress(Sender: TObject; var Key: Char);
begin
2025-09-25 15:36:55 +08:00
if Key = #13 then
2025-01-20 13:04:03 +08:00
begin
BPCF.SetFocus;
end;
end;
procedure TfrmBPZDY_LRPB.BPJSKeyPress(Sender: TObject; var Key: Char);
begin
2025-09-25 15:36:55 +08:00
if Key = #13 then
2025-01-20 13:04:03 +08:00
begin
BPMF.SetFocus;
end;
end;
procedure TfrmBPZDY_LRPB.BPMFKeyPress(Sender: TObject; var Key: Char);
begin
2025-09-25 15:36:55 +08:00
if Key = #13 then
2025-01-20 13:04:03 +08:00
begin
CPMiDu.SetFocus;
end;
end;
procedure TfrmBPZDY_LRPB.BPKZKeyPress(Sender: TObject; var Key: Char);
begin
2025-09-25 15:36:55 +08:00
if Key = #13 then
2025-01-20 13:04:03 +08:00
begin
BPJS.SetFocus;
end;
end;
procedure TfrmBPZDY_LRPB.BPMiDuKeyPress(Sender: TObject; var Key: Char);
begin
2025-09-25 15:36:55 +08:00
if Key = #13 then
2025-01-20 13:04:03 +08:00
begin
BPKZ.SetFocus;
end;
end;
procedure TfrmBPZDY_LRPB.CYNameKeyPress(Sender: TObject; var Key: Char);
2025-09-25 15:36:55 +08:00
var
CPID: string;
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if Key = #13 then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if Trim(CYName.Text) = '' then
Exit;
2025-01-20 13:04:03 +08:00
with ADOQuery2 do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
sql.Add('select * from CP_YDang where CYName like ''' + '%' + Trim(CYName.Text) + '%' + '''');
2025-01-20 13:04:03 +08:00
Open;
end;
2025-09-25 15:36:55 +08:00
SCreateCDS20(ADOQuery2, ML_GX);
SInitCDSData20(ADOQuery2, ML_GX);
2025-01-20 13:04:03 +08:00
end;
end;
procedure TfrmBPZDY_LRPB.CYNoKeyPress(Sender: TObject; var Key: Char);
2025-09-25 15:36:55 +08:00
var
CPID: string;
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if Key = #13 then
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
if Trim(CYNo.Text) = '' then
Exit;
2025-01-20 13:04:03 +08:00
with ADOQuery2 do
begin
Close;
sql.Clear;
2025-09-25 15:36:55 +08:00
sql.Add('select * from CP_YDang where CYNo like ''' + '%' + Trim(CYNo.Text) + '%' + '''');
2025-01-20 13:04:03 +08:00
Open;
end;
2025-09-25 15:36:55 +08:00
SCreateCDS20(ADOQuery2, ML_GX);
SInitCDSData20(ADOQuery2, ML_GX);
2025-01-20 13:04:03 +08:00
end;
end;
procedure TfrmBPZDY_LRPB.BPCFKeyPress(Sender: TObject; var Key: Char);
begin
2025-09-25 15:36:55 +08:00
if Key = #13 then
2025-01-20 13:04:03 +08:00
begin
BPMiDu.SetFocus;
end;
end;
procedure TfrmBPZDY_LRPB.CPMiDuKeyPress(Sender: TObject; var Key: Char);
begin
2025-09-25 15:36:55 +08:00
if Key = #13 then
2025-01-20 13:04:03 +08:00
begin
BPPrice.SetFocus;
end;
end;
procedure TfrmBPZDY_LRPB.FormDestroy(Sender: TObject);
begin
2025-09-25 15:36:55 +08:00
frmBPZDY_LRPB := nil;
2025-01-20 13:04:03 +08:00
end;
2025-09-25 15:36:55 +08:00
procedure TfrmBPZDY_LRPB.TV1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
2025-01-20 13:04:03 +08:00
begin
2025-09-25 15:36:55 +08:00
Panel5.Visible := False;
TBAdd.Visible := False;
TbCopy.Visible := False;
TBDel.Visible := False;
2025-01-20 13:04:03 +08:00
end;
procedure TfrmBPZDY_LRPB.BPPriceKeyPress(Sender: TObject; var Key: Char);
begin
2025-09-25 15:36:55 +08:00
if Key = #13 then
2025-01-20 13:04:03 +08:00
begin
BPNote.SetFocus;
end;
end;
procedure TfrmBPZDY_LRPB.BPNoteKeyPress(Sender: TObject; var Key: Char);
begin
2025-09-25 15:36:55 +08:00
if Key = #13 then
2025-01-20 13:04:03 +08:00
begin
Button1.SetFocus;
end;
end;
2025-09-25 15:36:55 +08:00
procedure TfrmBPZDY_LRPB.TbCopyClick(Sender: TObject);
begin
Panel5.Visible := True;
BPMF.Text := Trim(ClientDataSet1.fieldbyname('BPMF').AsString);
BPKZ.Text := Trim(ClientDataSet1.fieldbyname('BPKZ').AsString);
BPCF.Text := Trim(ClientDataSet1.fieldbyname('BPCF').AsString);
BPJS.Text := Trim(ClientDataSet1.fieldbyname('BPJS').AsString);
BPMiDu.Text := Trim(ClientDataSet1.fieldbyname('BPMiDu').AsString);
CPMiDu.Text := Trim(ClientDataSet1.fieldbyname('CPMiDu').AsString);
MXCode.Text := Trim(ClientDataSet1.FieldByName('MXCode').AsString);
MXName.Text := Trim(ClientDataSet1.FieldByName('MXName').AsString);
IFHS.Text := Trim(ClientDataSet1.FieldByName('IFHS').AsString);
BPPrice.Text := Trim(ClientDataSet1.FieldByName('BPPrice').AsString);
BPNote.Text := Trim(ClientDataSet1.FieldByName('BPNote').AsString);
FBPID := '';
FCPID := Trim(ClientDataSet1.fieldbyname('CPID').AsString);
FCPNo := Trim(ClientDataSet1.fieldbyname('CPNo').AsString);
FCPName := Trim(ClientDataSet1.fieldbyname('CPName').AsString);
MXCode.SetFocus;
Button1.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end;
2025-01-20 13:04:03 +08:00
end.
2025-09-25 15:36:55 +08:00