I am in the main program, the deal with a number of data sets, and then call DLL,
Code about the following:
The function TSysPrint. Xpprint (order_code: string; Bo: Boolean=true) : Integer;
Var
SQL, sl, s2, s, youhui: string;
Qry, qry1 qry2, qry4: TSynQry;
I: Integer;
The DataSet: the TClientDataSet;
Json: tjson;
The list: TStringList;
Plist: TStrings;
The begin
If Syssetup. Printbool=false then
The begin
The Exit;
end;
If FmoneyCom. Bool then
Syssdk. OpenUSBMoneyBox;
Try
Try
Qry:=FTReport. Query;
Qry1:=FTReport. Query;
Qry2:=FTReport. Query;
Qry4:=FTReport. Query;
List:=TStringList. Create;
I:=0;
SQL:='select * from retail_order where order_code=' + QuotedStr (order_code);
Syssdk. This (SQL, qry2);
SQL:='select the number, type the from vi_xiao where the order number=' + QuotedStr (order_code);
Syssdk. This (SQL, qry);
While not qry. Eof do
The begin
If qry. FieldByName (' type '). Then AsInteger=2
I:=I + 1
The else
I:=I + qry. FieldByName (' number '). AsInteger;
Qry. Next;
end;
Sl:=inttostr (I);
//,
SQL:='SELECT - present price as original price is favorable, * from vi_xiao where the order number=' + QuotedStr (order_code);
Qry Filter:='commodity list;
Syssdk. This (SQL, qry);
SQL:='SELECT sum (price) as price, attr_name FROM vi_attr_vs where order_code=' + QuotedStr (order_code) + 'group by attr_code';
Syssdk. This (SQL, qry4);
Qry4. Filter:='commodity attribute;
SQL:='select * from vi_xiao where state=2 and the order number=' + QuotedStr (order_code);
Syssdk. This (SQL, qry1);
The DataSet:=the TClientDataSet. Create (nil);
SysJSON. QuerytoDataSet (qry1. The DataSet, and the DataSet, 'Fsum, id);
The DataSet. First;
I:=DataSet. RecordCount;
I:=0;
While not a DataSet. Eof do
The begin
The DataSet. Edit;
The DataSet. FieldByName (' id '). AsInteger:=I;
The DataSet. FieldByName (' Fsum). AsString:=syssdk. Sfloat (DataSet. FieldByName (' amount '). AsFloat);
The DataSet. Post;
The DataSet. Next;
Inc (I);
end;
S:=DataSet. FieldByName (' pay_method). AsString;
S:=DataSet. FieldByName (' Fsum). AsString;
I:=DataSet. RecordCount;
The DataSet. The Filter:='payment list;
Plist:=TStringList. Create;
Print_storexx (" retail ", plist);
Plist. AddPair (' cashiers' userjson. _ [0]. S [' cas_name ']);
Plist. AddPair (' order time, syssdk UnixDateToDateTime (qry2. FieldByName (" addtime "). AsInteger));
Plist. AddPair (order number, order_code);
Syssdk. Frxprint (plist, qry. The DataSet, qry4. The DataSet, the DataSet, Forder_print. Printfile, Forder_print. Name, Forder_print. Copies, Forder_print. Line_number, Forder_print. Wholeprint, Forder_print. Cuttingbool, bo);
Number of frxprint culvert DLL are roughly as follows:
Procedure TTest. Frxprint (Alist: Pointer {TStrings}; The FileName, PrinterName: pchar; Number: an Integer; Openpreview: BOOL; Ds1: Pointer {TDataSet}; Ds2: Pointer {TDataSet}; Ds3: Pointer {TDataSet}; Ds4: Pointer {TDataSet});
Var
I: Integer;
Category: TfrxVariable;
FileNames, PrinterNames, uname: AnsiString;
Frxbrcdbjct1: TfrxBarCodeObject;
Ffrxrprt1: TfrxReport;
Frxdsgnr1: TfrxDesigner;
Ffrxdbdtst1: TfrxDBDataset;
Ffrxdbdtst2: TfrxDBDataset;
Ffrxdbdtst3: TfrxDBDataset;
Ffrxdbdtst4: TfrxDBDataset;
The begin
Try
Flist:=TStringList. Create;
Frxbrcdbjct1:=TfrxBarCodeObject. Create (Self);
Ffrxrprt1:=TfrxReport. Create (Self);
Frxdsgnr1:=TfrxDesigner. Create (self);
Ffrxdbdtst1:=TfrxDBDataset. Create (Self);
Ffrxdbdtst2:=TfrxDBDataset. Create (Self);
Ffrxdbdtst3:=TfrxDBDataset. Create (Self);
Ffrxdbdtst4:=TfrxDBDataset. Create (Self);
Ffrxrprt1. OnGetValue:=Ffrxrprt1GetValue;
FileNames:=FileName;
PrinterNames:=PrinterName;
If tstrings (Alist) & lt;> Nil then
Flist.Com maText:=tstrings (Alist). CommaText;
Ffrxdbdtst1. UserName:='empty';
Ffrxdbdtst2. UserName:='empty';
Ffrxdbdtst3. UserName:='empty';
Ffrxdbdtst4. UserName:='empty';
If ds1 & lt;> Nil then
The begin
Ffrxdbdtst1. The DataSet:=TDataSet (ds1);
Uname:=TDataSet (ds1). The Filter;
Ffrxdbdtst1. UserName:=uname;
end;
If ds2 & lt;> Nil then
The begin
Ffrxdbdtst2. The DataSet:=TDataSet (ds2);
Uname:=TDataSet (ds2). The Filter;
Ffrxdbdtst2. UserName:=uname;
end;
If ds3 & lt;> Nil then
The begin
Ffrxdbdtst3. The DataSet:=TDataSet (ds3);
Uname:=TDataSet (ds3). The Filter;
Ffrxdbdtst3. UserName:=uname;
end;
If ds4 & lt;> Nil then
The begin
Ffrxdbdtst4. The DataSet:=TDataSet (ds4);
Uname:=TDataSet (ds4). The Filter;
Ffrxdbdtst4. UserName:=uname;
end;
Test. The log (PChar (' PReportZZQ: TDataSet (ds3). FieldsCount='+ TDataSet (ds3). FieldCount. Tostring +' Ffrxdbdtst3. FieldsCount='+ Ffrxdbdtst3. FieldsCount. Tostring));
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull