📄 slip_print.pas
字号:
unit Slip_Print;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Base, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, cxGridCustomTableView,
cxGridTableView, cxGridDBTableView, ADODB, cxGridLevel, cxClasses,
cxControls, cxGridCustomView, cxGrid, StdCtrls, ComCtrls, ExtCtrls,
frxClass, frxDBSet, cxImage, cxBlobEdit, Mask, DBCtrlsEh;
type
TfrmSlip_Print = class(TfrmBase)
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
DateTimePicker1: TDateTimePicker;
DateTimePicker2: TDateTimePicker;
Button1: TButton;
GroupBox1: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
Button2: TButton;
cxGrid1DBTableView1: TcxGridDBTableView;
cxGrid1Level1: TcxGridLevel;
cxGrid1: TcxGrid;
ADODetail: TADOQuery;
ADOLiable: TADOQuery;
DataDetail: TDataSource;
ADOGroup: TADOQuery;
SaveDialog1: TSaveDialog;
frxDBDataset1: TfrxDBDataset;
frxDBDataset2: TfrxDBDataset;
frxDBDataset3: TfrxDBDataset;
ADODetailID: TBCDField;
ADODetaildates: TDateTimeField;
ADODetailhth: TStringField;
ADODetailbuyer: TStringField;
ADODetailxh: TStringField;
ADODetailsizes: TStringField;
ADODetailPlate: TStringField;
ADODetailWeight: TBCDField;
ADODetailGrain: TBCDField;
ADODetailAmount: TBCDField;
ADODetailLiabler: TStringField;
ADODetailUp_date: TDateTimeField;
ADODetailChecker: TStringField;
ADODetailLiable_dept: TStringField;
ADODetailremark: TStringField;
ADODetailimages: TBlobField;
ADODetailsavedate: TDateTimeField;
ADODetailinputer: TStringField;
ADODetailDirect_losing: TBCDField;
ADODetailSum_losing: TBCDField;
ADODetailworking_procedure: TStringField;
ADODetailmachine_No: TStringField;
cxGrid1DBTableView1ID: TcxGridDBColumn;
cxGrid1DBTableView1dates: TcxGridDBColumn;
cxGrid1DBTableView1hth: TcxGridDBColumn;
cxGrid1DBTableView1buyer: TcxGridDBColumn;
cxGrid1DBTableView1xh: TcxGridDBColumn;
cxGrid1DBTableView1sizes: TcxGridDBColumn;
cxGrid1DBTableView1Plate: TcxGridDBColumn;
cxGrid1DBTableView1Slip_text: TcxGridDBColumn;
cxGrid1DBTableView1Weight: TcxGridDBColumn;
cxGrid1DBTableView1Grain: TcxGridDBColumn;
cxGrid1DBTableView1Amount: TcxGridDBColumn;
cxGrid1DBTableView1Liabler: TcxGridDBColumn;
cxGrid1DBTableView1Up_date: TcxGridDBColumn;
cxGrid1DBTableView1Manage: TcxGridDBColumn;
cxGrid1DBTableView1Checker: TcxGridDBColumn;
cxGrid1DBTableView1Liable_dept: TcxGridDBColumn;
cxGrid1DBTableView1remark: TcxGridDBColumn;
cxGrid1DBTableView1images: TcxGridDBColumn;
cxGrid1DBTableView1savedate: TcxGridDBColumn;
cxGrid1DBTableView1inputer: TcxGridDBColumn;
cxGrid1DBTableView1Direct_losing: TcxGridDBColumn;
cxGrid1DBTableView1Sum_losing: TcxGridDBColumn;
cxGrid1DBTableView1working_procedure: TcxGridDBColumn;
cxGrid1DBTableView1machine_No: TcxGridDBColumn;
Button3: TButton;
ADOGroupworking_procedure: TStringField;
ADOGroupsum_losing: TBCDField;
ADOGroupdirect_losing: TBCDField;
ADOGroupcounts: TIntegerField;
ADODetailSlip_text: TMemoField;
ADODetailManage: TMemoField;
ADODetailtechnics: TStringField;
cxGrid1DBTableView1technics: TcxGridDBColumn;
ADODetailproduct_line: TStringField;
cxGrid1DBTableView1product_line: TcxGridDBColumn;
Label25: TLabel;
ADOProduct_line: TADOQuery;
ComboBox1: TComboBox;
ADOLiableliabler: TStringField;
ADOLiablesum_losing: TBCDField;
ADOLiabledirect_losing: TBCDField;
frxReport1: TfrxReport;
ADODept: TADOQuery;
frxDBDataDept: TfrxDBDataset;
DataDept: TDataSource;
ADOGroupLiable_dept: TStringField;
ADOLiableLiable_dept: TStringField;
frxReport2: TfrxReport;
frxReport3: TfrxReport;
procedure FormCreate(Sender: TObject);
procedure cxGrid1DBTableView1TcxGridDBDataControllerTcxDataSummaryFooterSummaryItems0GetText(
Sender: TcxDataSummaryItem; const AValue: Variant;
AIsFooter: Boolean; var AText: String);
procedure Button1Click(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmSlip_Print: TfrmSlip_Print;
implementation
{$R *.dfm}
uses DataModule,Global;
procedure TfrmSlip_Print.FormCreate(Sender: TObject);
begin
inherited;
//-----------时间设置
DateTimePicker1.DateTime := Now;
DateTimePicker2.DateTime := Now;
//-------------------产品线
self.ADOProduct_line.Close;
self.ADOProduct_line.SQL.Clear;
self.ADOProduct_line.SQL.Add(' select distinct product_line from dbo.Ccproductline ');
self.ADOProduct_line.open;
ComboBox1.Items.Clear;
with self.ADOProduct_line do
begin
First;
while not eof do
begin
ComboBox1.Items.Add(trim(ADOProduct_line.FieldByName('product_line').AsString));
next;
end
end;
end;
procedure TfrmSlip_Print.cxGrid1DBTableView1TcxGridDBDataControllerTcxDataSummaryFooterSummaryItems0GetText(
Sender: TcxDataSummaryItem; const AValue: Variant; AIsFooter: Boolean;
var AText: String);
begin
inherited;
AText := '合计:';
end;
procedure TfrmSlip_Print.Button1Click(Sender: TObject);
begin
inherited;
with ADODetail do
begin
Close;
Parameters.ParamValues['a']:=StrToDateTime(formatdatetime('yyyy-MM-dd',DateTimePicker1.datetime));
Parameters.ParamValues['b']:=strtodatetime(formatdatetime('yyyy-MM-dd',DateTimePicker2.datetime));
Parameters.ParamValues['c']:=Trim(ComboBox1.Text);
Open;
end;
with ADOLiable do
begin
Close;
Parameters.ParamValues['a']:=strtodatetime(formatdatetime('yyyy-MM-dd',DateTimePicker1.datetime));
Parameters.ParamValues['b']:=strtodatetime(formatdatetime('yyyy-MM-dd',DateTimePicker2.datetime));
Parameters.ParamValues['c']:=Trim(ComboBox1.Text);
Open;
end;
with ADOGroup do
begin
Close;
Parameters.ParamValues['a']:=strtodatetime(formatdatetime('yyyy-MM-dd',DateTimePicker1.datetime));
Parameters.ParamValues['b']:=strtodatetime(formatdatetime('yyyy-MM-dd',DateTimePicker2.datetime));
Parameters.ParamValues['e']:=Trim(ComboBox1.Text);
Open ;
end;
with ADODept do
begin
Close;
SQL.Clear;
SQL.Add('select distinct Liable_dept from CcSlipFile_Detail where Cut_date>=:Date1 and Cut_date<:Date2 and product_line=:a');
Parameters.ParamValues['Date1']:=strtodatetime(formatdatetime('yyyy-MM-dd',DateTimePicker1.datetime));
Parameters.ParamValues['Date2']:=strtodatetime(formatdatetime('yyyy-MM-dd',DateTimePicker2.datetime));
Parameters.ParamValues['a']:=Trim(ComboBox1.Text);
Open;
end;
ShowMessage('查询完毕!');
end;
procedure TfrmSlip_Print.FormDestroy(Sender: TObject);
begin
inherited;
frmSlip_Print:=nil;
end;
procedure TfrmSlip_Print.Button3Click(Sender: TObject);
begin
inherited;
Close;
end;
procedure TfrmSlip_Print.Button2Click(Sender: TObject);
begin
inherited;
if RadioButton1.Checked=True then
frxReport1.ShowReport();
if RadioButton2.checked=True then
frxReport2.ShowReport();
if RadioButton3.checked=True then
frxReport3.ShowReport()
else
begin
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -