169 lines
4.6 KiB
ObjectPascal
169 lines
4.6 KiB
ObjectPascal
unit U_PRTLable;
|
||
|
||
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,
|
||
MovePanel, cxTextEdit, cxContainer, cxCurrencyEdit, BtnEdit, RM_e_main, RM_e_htm, RM_e_Graphic, RM_e_Jpeg, RM_e_txt, RM_e_csv, RM_E_llPDF, Math,
|
||
cxPC, Buttons;
|
||
|
||
type
|
||
TfrmPRTLable = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
Order_Main: TClientDataSet;
|
||
DataSource1: TDataSource;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryPrint: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
Edit1: TEdit;
|
||
Label1: TLabel;
|
||
Label2: TLabel;
|
||
RM2: TRMGridReport;
|
||
RMDB_Main: TRMDBDataSet;
|
||
Label5: TLabel;
|
||
FS: TComboBox;
|
||
Label3: TLabel;
|
||
Label4: TLabel;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
|
||
private
|
||
{ Private declarations }
|
||
procedure PrtDataMD(FMJID: string);
|
||
public
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmPRTLable: TfrmPRTLable;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink,U_RTFun;
|
||
|
||
{$R *.dfm}
|
||
|
||
|
||
procedure TfrmPRTLable.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmPRTLable := nil;
|
||
end;
|
||
|
||
procedure TfrmPRTLable.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmPRTLable.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
end;
|
||
procedure TfrmPRTLable.PrtDataMD(FMJID: string);
|
||
var
|
||
fPrintFile: string;
|
||
Txt, fImagePath,FJYType,FLabName: string;
|
||
Moudle: THandle;
|
||
Makebar: TMakebar;
|
||
Mixtext: TMixtext;
|
||
i: Integer;
|
||
begin
|
||
if Trim(Edit1.Text) = '' then
|
||
Exit;
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select A.*,B.*,C.*,ZH.*,ZHXHNo=ZH.XHNo ');
|
||
sql.Add(',KHNameJC=(select KHNameJC from KH_Main KM where KM.KHNO=B.KHNO)');
|
||
SQL.Add('from JTJY_New A ');
|
||
SQL.Add('inner join ML_OrderMainNew B on B.NewMLID=A.NewMLID ');
|
||
SQL.Add('inner join ML_OrderSubidNew C on C.NewSubid=A.NewSubid ');
|
||
sql.Add('left join ML_OrderZuHe ZH on B.NewMLID=ZH.NewMLID');
|
||
sql.Add('where A.JYID=''' + trim(FMJID) + '''');
|
||
sql.Add(' order by ZH.XHNo');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryPrint,Order_Main);
|
||
SInitCDSData20(ADOQueryPrint,Order_Main);
|
||
FJYType:=Trim(Order_Main.fieldbyname('JYType').AsString);
|
||
if Order_Main.IsEmpty then
|
||
begin
|
||
Label4.Visible:=True;
|
||
Label4.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F3A3A1A3><EFBFBD>';
|
||
Edit1.Text:='';
|
||
Exit;
|
||
end else
|
||
begin
|
||
Label4.Visible:=True;
|
||
Label4.Caption:=FJYType;
|
||
Label4.Color:=clBlue;
|
||
end;
|
||
|
||
if Trim(FJYType)='<27><>Ʒ' then
|
||
begin
|
||
FLabName:=Trim(Order_Main.fieldbyname('CPBQName1').AsString);
|
||
end else
|
||
if Trim(FJYType)='<27>ײ<EFBFBD>' then
|
||
begin
|
||
FLabName:='<27>ײ<EFBFBD><D7B2><EFBFBD>ǩ';
|
||
end else
|
||
if Trim(FJYType)='<27>沼' then
|
||
begin
|
||
FLabName:='<27>沼<EFBFBD><E6B2BC>ǩ';
|
||
end else
|
||
if Trim(FJYType)='<27>˻<EFBFBD>' then
|
||
begin
|
||
FLabName:=Trim(Order_Main.fieldbyname('CPBQName1').AsString);
|
||
end;
|
||
try
|
||
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
||
@Makebar := GetProcAddress(Moudle, 'Make');
|
||
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
||
Txt := Trim(Order_Main.fieldbyname('JYID').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;
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + trim(FLabName) + '.rmf';
|
||
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RMVariables['QRBARCODE'] := fImagePath;
|
||
RM2.LoadFromFile(fPrintFile);
|
||
//RM2.PrintReport;
|
||
//RM2.ShowReport;
|
||
for i := 1 to StrToInt(FS.Text) do
|
||
begin
|
||
RM2.PrintReport;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox('û<><C3BB><EFBFBD>ұ<EFBFBD>ǩ<EFBFBD><C7A9>ʽ', '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
Edit1.Text:='';
|
||
end;
|
||
|
||
procedure TfrmPRTLable.Edit1KeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key=#13 then
|
||
begin
|
||
PrtDataMD(Edit1.Text);
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|
||
|