723 lines
20 KiB
ObjectPascal
723 lines
20 KiB
ObjectPascal
unit U_YMTFHSQList;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
|
||
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses, cxControls,
|
||
cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
||
cxGrid, DBClient, cxCheckBox, cxCalendar, cxSplitter, RM_Dataset, RM_System,
|
||
RM_Common, RM_Class, RM_GridReport, RM_e_Xls, Menus, cxPC, cxButtonEdit,
|
||
RM_E_llPDF, cxDropDownEdit, cxTextEdit, IdBaseComponent, IdComponent,
|
||
IdTCPConnection, IdTCPClient, IdHTTP, cxLookAndFeels, cxLookAndFeelPainters,
|
||
cxNavigator, dxSkinsCore, dxSkinDarkRoom, dxSkinOffice2013White,
|
||
dxSkinSharpPlus, dxSkinSpringTime, dxSkinsDefaultPainters, dxSkinscxPCPainter,
|
||
dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee,
|
||
dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
|
||
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
|
||
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
|
||
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
|
||
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
|
||
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
|
||
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray,
|
||
dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSilver,
|
||
dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinValentine,
|
||
dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue;
|
||
|
||
type
|
||
TfrmYMTFHSQList = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBAdd: TToolButton;
|
||
TBEdit: TToolButton;
|
||
TBDel: TToolButton;
|
||
TBPrint: TToolButton;
|
||
TBClose: TToolButton;
|
||
Tv1: TcxGridDBTableView;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
cxGrid1: TcxGrid;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
v1OrdDate: TcxGridDBColumn;
|
||
v1OrdPerson1: TcxGridDBColumn;
|
||
Order_Main: TClientDataSet;
|
||
RMDB_Main: TRMDBDataSet;
|
||
RMXLSExport1: TRMXLSExport;
|
||
ToolButton1: TToolButton;
|
||
ADOQueryPrint: TADOQuery;
|
||
CDS_Print: TClientDataSet;
|
||
v1Column4: TcxGridDBColumn;
|
||
Panel1: TPanel;
|
||
Label1: TLabel;
|
||
Label4: TLabel;
|
||
Label5: TLabel;
|
||
BegDate: TDateTimePicker;
|
||
EndDate: TDateTimePicker;
|
||
SHDanWei: TEdit;
|
||
Salesman: TEdit;
|
||
tchk: TToolButton;
|
||
Tnochk: TToolButton;
|
||
cxSplitter1: TcxSplitter;
|
||
ADOQuerySub: TADOQuery;
|
||
DataSource2: TDataSource;
|
||
v1Column8: TcxGridDBColumn;
|
||
Label2: TLabel;
|
||
//RMllPDFExport1: TRMllPDFExport;
|
||
cxGrid2: TcxGrid;
|
||
Tv2: TcxGridDBTableView;
|
||
v1Column5: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
ClientDataSet2: TClientDataSet;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
CDS_Note: TClientDataSet;
|
||
v2Column2: TcxGridDBColumn;
|
||
RM1: TRMGridReport;
|
||
v1Column11: TcxGridDBColumn;
|
||
v1Column13: TcxGridDBColumn;
|
||
v1Column17: TcxGridDBColumn;
|
||
v1Column18: TcxGridDBColumn;
|
||
v1Column19: TcxGridDBColumn;
|
||
v2Column1: TcxGridDBColumn;
|
||
v2Column3: TcxGridDBColumn;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
v1Column21: TcxGridDBColumn;
|
||
v2Column9: TcxGridDBColumn;
|
||
v2Column10: TcxGridDBColumn;
|
||
v2Column12: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
CDSUser: TClientDataSet;
|
||
IdHTTP1: TIdHTTP;
|
||
v2Column6: TcxGridDBColumn;
|
||
ComboBox1: TComboBox;
|
||
Label3: TLabel;
|
||
cxStyleRepository1: TcxStyleRepository;
|
||
cxStyle1: TcxStyle;
|
||
v1Column3: TcxGridDBColumn;
|
||
v2Column4: TcxGridDBColumn;
|
||
v2Column5: TcxGridDBColumn;
|
||
ToolButton2: TToolButton;
|
||
Panel3: TPanel;
|
||
Label25: TLabel;
|
||
btnChk: TButton;
|
||
Button3: TButton;
|
||
CRType: TComboBox;
|
||
v1Column6: TcxGridDBColumn;
|
||
//RMllPDFExport1: TRMllPDFExport;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBEditClick(Sender: TObject);
|
||
procedure TBDelClick(Sender: TObject);
|
||
procedure TBPrintClick(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure TBAddClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure CheckBox1Click(Sender: TObject);
|
||
procedure CheckBox2Click(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure tchkClick(Sender: TObject);
|
||
procedure TnochkClick(Sender: TObject);
|
||
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
procedure ComboBox1Change(Sender: TObject);
|
||
procedure BegDateChange(Sender: TObject);
|
||
procedure SHDanWeiKeyPress(Sender: TObject; var Key: Char);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure Button3Click(Sender: TObject);
|
||
procedure btnChkClick(Sender: TObject);
|
||
private
|
||
procedure InitGrid();
|
||
procedure InitSubGrid();
|
||
procedure InitForm();
|
||
function DelData(): Boolean;
|
||
procedure SendMessage(Mfsid: string);
|
||
{ Private declarations }
|
||
public
|
||
FFInt: Integer;
|
||
canshu1, FZZType: string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmYMTFHSQList: TfrmYMTFHSQList;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_YMTFHSQInPut, U_Fun, U_ZDYHelp;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmYMTFHSQList.SendMessage(Mfsid: string);
|
||
begin
|
||
if FZZType = 'γ<><CEB3>' then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select * from SY_User A where ISNULL(wxid,'''')<>''''');
|
||
SQL.Add(' and exists( select * from SY_Purview X where A.UserID=X.UserID and ModuleID=''09'' and ModuleSubID=''03'' ) ');
|
||
Open;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select * from SY_User A where ISNULL(wxid,'''')<>''''');
|
||
SQL.Add(' and exists( select * from SY_Purview X where A.UserID=X.UserID and ModuleID=''09'' and ModuleSubID=''13'' ) ');
|
||
Open;
|
||
end;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDSUser);
|
||
SInitCDSData20(ADOQueryTemp, CDSUser);
|
||
|
||
// if ADOQueryTmp.IsEmpty then
|
||
// begin
|
||
// Application.MessageBox('<27>ͻ<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><CEA2>,<2C>ύʧ<E1BDBB>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
||
// Exit;
|
||
// end;
|
||
|
||
CDSUser.First;
|
||
while not CDSUser.Eof do
|
||
begin
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add('select * from WeixinMessage where 1<>1');
|
||
Open;
|
||
Append;
|
||
FieldByName('MessageType').Value := 'DeliverApplyToAudit';
|
||
FieldByName('MessageName').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
FieldByName('Title').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>µķ<C2B5><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>';
|
||
FieldByName('URL').Value := 'pages/delivery-apply/view?id=' + Trim(Mfsid);
|
||
FieldByName('OpenId').Value := Trim(CDSUser.FieldByName('wxid').AsString);
|
||
FieldByName('Status').Value := '0';
|
||
FieldByName('CreateDate').Value := FormatDateTime('yyyymmdd', SGetServerDateTime(ADOQueryTemp));
|
||
FieldByName('CreateTime').Value := FormatDateTime('HH:mm:ss', SGetServerDateTime(ADOQueryTemp));
|
||
FieldByName('BusinessId').Value := Trim(Mfsid);
|
||
FieldByName('KeyWord1').Value := Trim(Mfsid);
|
||
FieldByName('KeyWord2').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
Post;
|
||
end;
|
||
//GetHTTP(IdHTTP1, 'http://www.rightsoft.top/linghui/api/Message/Send/DeliverApplyToAudit');
|
||
except
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
CDSUser.Next;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmYMTFHSQList := nil;
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.FormCreate(Sender: TObject);
|
||
begin
|
||
cxgrid1.Align := alClient;
|
||
canshu1 := DParameters1;
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>YX', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>YXMX', Tv2, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.InitGrid();
|
||
var
|
||
fwhere, Pwhere: string;
|
||
begin
|
||
Pwhere := SGetFilters(Panel1, 1, 2);
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
Sql.Add(' select A.* from YMT_FHSQ_Main A');
|
||
sql.Add(' where 1=1 ');
|
||
|
||
sql.Add(' and filltime>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.Date)) + '''');
|
||
sql.Add(' and filltime<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.Date + 1)) + '''');
|
||
|
||
if ComboBox1.Text = 'δ<><CEB4><EFBFBD><EFBFBD>' then
|
||
begin
|
||
SQL.Add(' and isnull(A.Chker,'''')='''' ');
|
||
end
|
||
else if ComboBox1.Text = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
SQL.Add(' and isnull(A.Chker,'''')<>'''' ');
|
||
end;
|
||
|
||
if Trim(canshu1) <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
sql.Add(' and isnull(A.Filler,'''')=''' + Trim(DName) + '''');
|
||
end;
|
||
if Pwhere <> '' then
|
||
sql.Add(' and ' + Pwhere);
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.InitForm();
|
||
begin
|
||
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>YX', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>YXMX', Tv2, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
|
||
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
|
||
BegDate.DateTime := EndDate.DateTime;
|
||
InitGrid();
|
||
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.TBEditClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
if trim(Order_Main.fieldbyname('Chker').AsString) <> '' then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
exit;
|
||
end;
|
||
if Trim(canshu1) <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
if Trim(Order_Main.fieldbyname('Filler').AsString) <> Trim(DName) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from YMT_FHSQ_Main');
|
||
sql.Add('where FSID=' + quotedstr(trim(Order_Main.fieldbyname('FSID').AsString)));
|
||
Open;
|
||
end;
|
||
if Trim(ADOQueryTemp.fieldbyname('YSID').AsString) <> '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>˿<CBBF><EEB2BB><EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
try
|
||
frmFHSQInPut := TfrmFHSQInPut.Create(Application);
|
||
with frmFHSQInPut do
|
||
begin
|
||
PState := 1;
|
||
FMainId := Trim(Self.Order_Main.fieldbyname('FSID').AsString);
|
||
FZZType := trim(self.FZZType);
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmFHSQInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.TBDelClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
if trim(Order_Main.fieldbyname('Chker').AsString) <> '' then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
exit;
|
||
end;
|
||
if Trim(Order_Main.fieldbyname('Filler').AsString) <> Trim(DName) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YMT_FHSQ_Sub where FSId=''' + Trim(Order_Main.fieldbyname('FSId').AsString) + '''');
|
||
sql.add(' and isnull(FHPS,0)>0');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27>ѷ<EFBFBD><D1B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from YMT_FHSQ_Main');
|
||
sql.Add('where FSID=' + quotedstr(trim(Order_Main.fieldbyname('FSID').AsString)));
|
||
Open;
|
||
end;
|
||
if Trim(ADOQueryTemp.fieldbyname('YSID').AsString) <> '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>˿<CBBF><EEB2BB>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
if DelData() then
|
||
begin
|
||
Order_Main.Delete;
|
||
InitSubGrid();
|
||
end;
|
||
end;
|
||
|
||
function TfrmYMTFHSQList.DelData(): Boolean;
|
||
begin
|
||
try
|
||
Result := false;
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete YMT_FHSQ_Sub where FSId=''' + Trim(Order_Main.fieldbyname('FSId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete YMT_FHSQ_Main where FSId=''' + Trim(Order_Main.fieldbyname('FSId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Result := True;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Result := False;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.TBPrintClick(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
Txt, fImagePath: string;
|
||
Moudle: THandle;
|
||
Makebar: TMakebar;
|
||
Mixtext: TMixtext;
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
Sql.Add(' select A.*,B.* ');
|
||
sql.Add(' from YMT_FHSQ_Main A inner join YMT_FHSQ_Sub B on A.FSId=B.FSId ');
|
||
sql.Add(' where A.FSId=''' + Trim(Order_Main.fieldbyname('FSId').AsString) + '''');
|
||
open;
|
||
// showmessage(sql.text);
|
||
end;
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
try
|
||
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
||
@Makebar := GetProcAddress(Moudle, 'Make');
|
||
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
||
Txt := Trim(Order_Main.fieldbyname('FSID').AsString);
|
||
fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp';
|
||
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
|
||
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
|
||
if FileExists(fImagePath) then
|
||
DeleteFile(fImagePath);
|
||
Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
|
||
RMVariables['QRBARCODE'] := fImagePath;
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RM1.ShowReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥.rmf'), '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
InitSubGrid();
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.TBAddClick(Sender: TObject);
|
||
var
|
||
maxno: string;
|
||
begin
|
||
try
|
||
frmFHSQInPut := TfrmFHSQInPut.Create(Application);
|
||
with frmFHSQInPut do
|
||
begin
|
||
PState := 0;
|
||
FMainId := '';
|
||
FZZType := trim(self.FZZType);
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmFHSQInPut.Free;
|
||
end;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.FormShow(Sender: TObject);
|
||
begin
|
||
InitForm();
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.CheckBox1Click(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.CheckBox2Click(Sender: TObject);
|
||
begin
|
||
TBRafresh.Click;
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
try
|
||
frmFHSQInPut := TfrmFHSQInPut.Create(Application);
|
||
with frmFHSQInPut do
|
||
begin
|
||
PState := 1;
|
||
FMainId := Trim(Self.Order_Main.fieldbyname('FSID').AsString);
|
||
FZZType := trim(self.FZZType);
|
||
ToolBar2.Visible := False;
|
||
TBSave.Visible := False;
|
||
ScrollBox1.Enabled := False;
|
||
Tv1.OptionsSelection.CellSelect := False;
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmFHSQInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.tchkClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
exit;
|
||
|
||
if trim(Order_Main.fieldbyname('Chker').AsString) <> '' then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
exit;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from KH_Main ');
|
||
sql.Add('where KHNO=' + quotedstr(trim(Order_Main.fieldbyname('KHNO').AsString)));
|
||
open;
|
||
end;
|
||
|
||
if trim(ADOQueryTemp.fieldbyname('status').AsString) <> '1' then
|
||
begin
|
||
application.MessageBox('<27>ͻ<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
exit;
|
||
end;
|
||
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update YMT_FHSQ_Main SET Chker=''' + Trim(DName) + ''',ChkTime=getdate(),ChkStatus=''<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'' ');
|
||
sql.Add('where FSID=' + quotedstr(trim(Order_Main.fieldbyname('FSID').AsString)));
|
||
execsql;
|
||
end;
|
||
Order_Main.Delete;
|
||
InitSubGrid();
|
||
application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.InitSubGrid();
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
if Order_Main.IsEmpty = False then
|
||
sql.Add('select * from YMT_FHSQ_Sub A where A.FSId=''' + Trim(Order_Main.fieldbyname('FSId').AsString) + '''')
|
||
else
|
||
sql.Add('select * from YMT_FHSQ_Sub A where 1=2');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, ClientDataSet2);
|
||
SInitCDSData20(ADOQueryTemp, ClientDataSet2);
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.TnochkClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
exit;
|
||
if trim(Order_Main.fieldbyname('Chker').AsString) = '' then
|
||
begin
|
||
application.MessageBox('<27><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD>ˣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
exit;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from YMT_FHSQ_Main');
|
||
sql.Add('where FSID=' + quotedstr(trim(Order_Main.fieldbyname('FSID').AsString)));
|
||
Open;
|
||
end;
|
||
if Trim(ADOQueryTemp.fieldbyname('YSID').AsString) <> '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>˿<CBBF>ܳ<EFBFBD><DCB3><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
try
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update YMT_FHSQ_Main SET Chker=Null,ChkTime=Null,ChkStatus=Null ');
|
||
sql.Add('where FSID=' + quotedstr(trim(Order_Main.fieldbyname('FSID').AsString)));
|
||
execsql;
|
||
end;
|
||
Order_Main.Delete;
|
||
InitSubGrid();
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.* from YMT_FHSQ_Sub A ');
|
||
sql.Add(' where A.FSId=''' + Trim(Order_Main.fieldbyname('FSId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, ClientDataSet2);
|
||
SInitCDSData20(ADOQueryTemp, ClientDataSet2);
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.ComboBox1Change(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.BegDateChange(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.SHDanWeiKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
|
||
Panel3.Visible := True;
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.Button3Click(Sender: TObject);
|
||
begin
|
||
Panel3.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmYMTFHSQList.btnChkClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
exit;
|
||
if Order_Main.Locate('SSel', True, []) = False then
|
||
begin
|
||
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
exit;
|
||
end;
|
||
|
||
try
|
||
while Order_Main.Locate('SSel', True, []) do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update YMT_FHSQ_Main SET CRType=' + quotedstr(trim(CRType.Text)));
|
||
sql.Add('where FSID=' + quotedstr(trim(Order_Main.fieldbyname('FSID').AsString)));
|
||
execsql;
|
||
end;
|
||
with Order_Main do
|
||
begin
|
||
Edit;
|
||
FieldByName('SSel').Value := False;
|
||
FieldByName('CRType').Value := trim(CRType.Text);
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
Panel3.Visible := False;
|
||
application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|