252 lines
6.8 KiB
ObjectPascal
252 lines
6.8 KiB
ObjectPascal
![]() |
unit U_WBQBD;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, StdCtrls, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
|||
|
cxDataStorage, cxEdit, DB, cxDBData, cxCalendar, cxGridLevel,
|
|||
|
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
|||
|
cxControls, cxGridCustomView, cxGrid, RM_Common, RM_Class, RM_GridReport,
|
|||
|
RM_System, RM_Dataset, ADODB, DBClient, cxGridCustomPopupMenu, cxGridPopupMenu,
|
|||
|
ExtCtrls, ComCtrls, ToolWin, cxTextEdit, Buttons, cxSplitter, cxCheckBox,
|
|||
|
MovePanel, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, RM_Preview;
|
|||
|
|
|||
|
type
|
|||
|
TfrmWBQBD = class(TForm)
|
|||
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
cxStyle1: TcxStyle;
|
|||
|
cxStyle2: TcxStyle;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
ADOCmd: TADOQuery;
|
|||
|
RMDB_Main: TRMDBDataSet;
|
|||
|
RM2: TRMGridReport;
|
|||
|
cxGrid3: TcxGrid;
|
|||
|
Tv3: TcxGridDBTableView;
|
|||
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
cxGridLevel2: TcxGridLevel;
|
|||
|
DataSource3: TDataSource;
|
|||
|
CDS_MJID: TClientDataSet;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
v3Column1: TcxGridDBColumn;
|
|||
|
v3Column2: TcxGridDBColumn;
|
|||
|
v3Column3: TcxGridDBColumn;
|
|||
|
v3Column4: TcxGridDBColumn;
|
|||
|
v3Column5: TcxGridDBColumn;
|
|||
|
ADOTmp: TADOQuery;
|
|||
|
Panel6: TPanel;
|
|||
|
Button5: TButton;
|
|||
|
Button3: TButton;
|
|||
|
Button1: TButton;
|
|||
|
Label1: TLabel;
|
|||
|
edtSBQ: TEdit;
|
|||
|
Button2: TButton;
|
|||
|
Button4: TButton;
|
|||
|
Button6: TButton;
|
|||
|
Button7: TButton;
|
|||
|
Button8: TButton;
|
|||
|
Button9: TButton;
|
|||
|
Button10: TButton;
|
|||
|
Button11: TButton;
|
|||
|
Button12: TButton;
|
|||
|
Button13: TButton;
|
|||
|
Button14: TButton;
|
|||
|
Tv3Column1: TcxGridDBColumn;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryLabel: TADOQuery;
|
|||
|
RM3: TRMGridReport;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
Label2: TLabel;
|
|||
|
procedure Button5Click(Sender: TObject);
|
|||
|
procedure Button3Click(Sender: TObject);
|
|||
|
procedure Edit8Click(Sender: TObject);
|
|||
|
procedure Button1Click(Sender: TObject);
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure Tv3CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
|
|||
|
procedure InitDDYGrid(JT: string);
|
|||
|
procedure PrtData(FMJID, ZCTS: string);
|
|||
|
public
|
|||
|
fmanage: string;
|
|||
|
{ Public declarations }
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmWBQBD: TfrmWBQBD;
|
|||
|
newh, newh1: hwnd;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_Fun, U_ZDYHelp, U_iniParam, U_ProductOrderListSel;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmWBQBD.InitDDYGrid(JT: string);
|
|||
|
begin
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select A.*');
|
|||
|
sql.Add('from WFB_MJJY A where isnull(BaoID,'''')<>'''' ');
|
|||
|
sql.Add(' and JTType=''' + Trim(JT) + '''');
|
|||
|
|
|||
|
sql.Add(' and ISNULL(EDITTIME,Filltime)>' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)));
|
|||
|
sql.Add(' and ISNULL(EDITTIME,Filltime)<=' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1)));
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_MJID);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_MJID);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmWBQBD.PrtData(FMJID, ZCTS: string);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
Txt, fImagePath: string;
|
|||
|
Moudle: THandle;
|
|||
|
Makebar: TMakebar;
|
|||
|
Mixtext: TMixtext;
|
|||
|
begin
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(' EXEC P_Print_JYLab ');
|
|||
|
SQL.Add(' @MJID=''' + Trim(FMJID) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryPrint.IsEmpty then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>δ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
|||
|
@Makebar := GetProcAddress(Moudle, 'Make');
|
|||
|
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
|||
|
Txt := Trim(ADOQueryPrint.fieldbyname('MJID').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;
|
|||
|
|
|||
|
if Trim(ADOQueryPrint.fieldbyname('THBQ').AsString) <> '' then
|
|||
|
begin
|
|||
|
ExportFtErpFile(Trim(ADOQueryPrint.fieldbyname('THBQ').AsString) + '.rmf', ADOTmp);
|
|||
|
if Trim(ADOQueryPrint.fieldbyname('THBQ').AsString) <> '' then
|
|||
|
begin
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('THBQ').AsString) + '.rmf'
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
ExportFtErpFile('ͨ<><CDA8>Ӣ<EFBFBD>ı<EFBFBD>ǩ.rmf', ADOTmp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\ͨ<><CDA8>Ӣ<EFBFBD>ı<EFBFBD>ǩ.rmf';
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
ExportFtErpFile(Trim(ADOQueryPrint.fieldbyname('LBName').AsString) + '.rmf', ADOTmp);
|
|||
|
if Trim(ADOQueryPrint.fieldbyname('LBName').AsString) <> '' then
|
|||
|
begin
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('LBName').AsString) + '.rmf'
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
ExportFtErpFile('ͨ<><CDA8>Ӣ<EFBFBD>ı<EFBFBD>ǩ.rmf', ADOTmp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\ͨ<><CDA8>Ӣ<EFBFBD>ı<EFBFBD>ǩ.rmf';
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
|
|||
|
RM2.LoadFromFile(fPrintFile);
|
|||
|
if Trim(edtSBQ.Text) <> '' then
|
|||
|
Rm2.DefaultCopies := 2
|
|||
|
else
|
|||
|
Rm2.DefaultCopies := 1;
|
|||
|
RM2.PrintReport;
|
|||
|
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmWBQBD.Button5Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
i: Integer;
|
|||
|
mvalue: Double;
|
|||
|
begin
|
|||
|
|
|||
|
// with ADOCmd do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// SQL.Clear;
|
|||
|
// SQL.Add(' update WFB_MJJY set BaoID=MJID where MJID=' + Quotedstr(Trim(CDS_MJID.fieldbyname('MJID').AsString)));
|
|||
|
// ExecSQL;
|
|||
|
// end;
|
|||
|
PrtData(CDS_MJID.fieldbyname('MJID').AsString, '<27><>ӡ');
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmWBQBD.Button3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmWBQBD.Edit8Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if Trim(TEdit(Sender).Text) = '' then
|
|||
|
begin
|
|||
|
TEdit(Sender).Text := '<27><>';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
TEdit(Sender).Text := '';
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmWBQBD.Button1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
InitDDYGrid(TButton(Sender).Hint);
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmWBQBD.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmWBQBD := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmWBQBD.Tv3CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
PrtData(CDS_MJID.fieldbyname('MJID').AsString, 'Ԥ<><D4A4>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmWBQBD.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
EndDate.DateTime := SGetServerDate10(ADOTmp);
|
|||
|
|
|||
|
BegDate.DateTime := EndDate.DateTime;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|