📄 u_gloat.pas
字号:
NoOne:=False;
NoTWO:=False;
NoTHREE:=True;
NoFOUR:=False;
end
else if (Table5['FOUR']='0') and (Table5['ONE']<>'0') and (Table5['TWO']<>'0')and
(Table5['THREE']<>'0') then
begin
NoOne:=False;
NoTWO:=False;
NoTHREE:=False;
NoFOUR:=True;
OK.Visible:=True;
FirstPrn.Visible:=True;
Panel14.Visible:=True;
TimeRun:=True;
end
else if (Table5['ONE']<>'0') and (Table5['TWO']<>'0') and
(Table5['THREE']<>'0') and (Table5['FOUR']<>'0') then
begin
RadioButton1.Enabled:=False;
RadioButton2.Enabled:=False;
RadioButton3.Enabled:=False;
RadioButton4.Enabled:=False;
Panel14.Visible:=True;
OK.Visible:=False;
FirstPrn.Visible:=False;
NoONE:=False;
NoTWO:=False;
NoTHREE:=False;
NoFOUR:=False;
TimeRun:=False;
end
else OK.Visible:=True;
end;
end;
next;
end;
end;
Table5.close;
end;
procedure TF_Gloat.Timer2Timer(Sender: TObject);
//var m:string;
begin
{randomize; //////////////////////////////调试用
m:=Inttostr(random(99999));
if NoOne=True then Edit1.Text:=m ;
if NoTWO=True then Edit2.Text:=m ;
if NoTHREE=True then Edit3.Text:=m ;
if NoFOUR=True then Edit4.Text:=m ; }
if NoOne=True then Edit1.Text:= F_ComTest.Edit3.Text ;
if NoTWO=True then Edit2.Text:= F_ComTest.Edit3.Text ;
if NoTHREE=True then Edit3.Text:= F_ComTest.Edit3.Text ;
if NoFOUR=True then Edit4.Text:= F_ComTest.Edit3.Text ;
if (Edit1.Text<>'0') and (Edit2.Text<>'0') and
(Edit3.Text<>'0') and (Edit4.Text<>'0') then
begin
Edit6.Text:=Edit2.Text;
Edit7.Text:=
FloatToStr(StrToFloat(Edit3.Text)+ StrToFloat(Edit4.Text)-StrToFloat(Edit1.Text));
Edit9.Text:=
FloatToStr(StrToFloat(Edit2.Text)-(StrToFloat(Edit3.Text)+StrToFloat(Edit4.Text)-StrToFloat(Edit1.Text)));
end
else
begin
Edit6.Text:=Edit2.Text;
Edit7.Text:=
FloatToStr(StrToFloat(Edit1.Text)+StrToFloat(Edit8.Text));
Edit9.Text:=
FloatToStr(StrToFloat(Edit2.Text)-(StrToFloat(Edit1.Text)+StrToFloat(Edit8.Text)));
end;
end;
procedure TF_Gloat.OKClick(Sender: TObject);
//var i:integer;
var SeekData:String;
begin
if (Combobox1.Text='') or (Combobox2.Text='') or
(Combobox3.Text='') or (Combobox4.Text='') or
(Combobox5.Text='') or (Combobox6.Text='') then
begin
MessageDlg('请选择有效资料',mtWarning,[mbOK],0);
Exit;
end;
if (Edit1.Text>'0') and (Edit2.Text>'0')and ///////////////空罐存盘
(StrToInt(Edit3.Text)>=3000) and (StrToInt(Edit4.Text)>=3000) then
begin
with Table8 do
TableName:='EmptyJar.dbf';
with Table8 do
begin
open;
first ;
begin
edit;
Table8['JARWET']:=FloatToStr(StrToFloat(Edit3.Text)-StrToFloat(Edit4.Text));
Table8['DATE']:=DateToStr(Now);
post;
next;
end;
end;
Table8.close;
end;
if ((Edit1.Text<>'0') and (Edit2.Text<>'0')and (Edit3.Text='0') and (Edit4.Text='0') ) or
((Edit1.Text<>'0') and (Edit2.Text<>'0')and(Edit3.Text<>'0') and (Edit4.Text<>'0')) then
begin
with Table7 do //////////// /////////查询存盘
TableName:='DATA\'+'MainWeight.dbf';
with Table7 do
begin
open;
first;
if not EOF then
begin
append;
Table7['SD']:=ComboBox3.Text; //送货单位
Table7['RD']:=ComboBox4.Text; //收货单位
Table7['Name']:=ComboBox5.Text; // 货品名称
Table7['Opter']:=Combobox1.text;
Table7['Ord']:=Edit5.Text;
Table7['InTime']:=Edit14.Text;
Table7['OutTime']:= Edit10.Text;
Table7['Date']:=DateToStr(Now);
Table7['CarNo']:=Combobox2.text;
Table7['MeterNo']:=Edit8.Text;
Table7['TWet']:=StrToFloat(Edit6.Text);
Table7['LWet']:=StrToFloat(Edit7.Text);
Table7['Wet']:=StrToFloat(Edit9.Text);
Table7['Kno']:=formatdatetime( 'mmdd',now);
post;
next;
end;
Edit;
Table7['SD']:=ComboBox3.Text; //送货单位
Table7['RD']:=ComboBox4.Text; //收货单位
Table7['Name']:=ComboBox5.Text; // 货品名称
Table7['Opter']:=Combobox1.text;
Table7['Ord']:=Edit5.Text;
Table7['InTime']:=Edit14.Text;
Table7['OutTime']:= Edit10.Text;
Table7['Date']:=DateToStr(Now);
Table7['CarNo']:=Combobox2.text;
Table7['MeterNo']:=Edit8.Text;
Table7['TWet']:=StrToFloat(Edit6.Text);
Table7['LWet']:=StrToFloat(Edit7.Text);
Table7['Wet']:=StrToFloat(Edit9.Text);
Table7['Kno']:=formatdatetime( 'mmdd',now);
post;
next;
end;
Table7.close;
end;
with Table5 do ///////////////本地存盘
TableName:='Gloat.dbf';
with Table5 do
begin
IndexFieldNames:='CARNO';
SeekData:=Combobox2.Text;
open;
if RecordCount=0 then
begin
edit;
Table5['SD']:=ComboBox3.Text; //送货单位
Table5['RD']:=ComboBox4.Text; //收货单位
Table5['Name']:=ComboBox5.Text; // 货品名称
Table5['Opter']:=Combobox1.text;
Table5['Ord']:=Table5.RecordCount+1;
Table5['InTime']:=Edit14.Text;
Table5['OutTime']:= Edit10.Text;
Table5['Date']:=DateToStr(Now);
Table5['CarNo']:=Combobox2.text;
Table5['MeterNo']:=IntToStr(Random(99));
Table5['TWet']:=StrToFloat(Edit6.Text);
Table5['LWet']:=StrToFloat(Edit7.Text);
Table5['Wet']:=StrToFloat(Edit9.Text);
Table5['ONE']:=Edit1.Text;
Table5['TWO']:=Edit2.Text;
Table5['THREE']:=Edit3.Text;
Table5['FOUR']:=Edit4.Text;
Table5['Kno']:=formatdatetime( 'mmdd',now);
post;
next;
end;
if FindKey([SeekData]) then
begin
edit;
Table5['SD']:=ComboBox3.Text; //送货单位
Table5['RD']:=ComboBox4.Text; //收货单位
Table5['Name']:=ComboBox5.Text; // 货品名称
Table5['Opter']:=Combobox1.text;
Table5['Ord']:=Table5.RecordCount+1;
Table5['InTime']:=Edit14.Text;
Table5['OutTime']:= Edit10.Text;
Table5['Date']:=DateToStr(Now);
Table5['CarNo']:=Combobox2.text;
Table5['MeterNo']:=IntToStr(Random(99));
Table5['TWet']:=StrToFloat(Edit6.Text);
Table5['LWet']:=StrToFloat(Edit7.Text);
Table5['Wet']:=StrToFloat(Edit9.Text);
Table5['ONE']:=Edit1.Text;
Table5['TWO']:=Edit2.Text;
Table5['THREE']:=Edit3.Text;
Table5['FOUR']:=Edit4.Text;
Table5['Kno']:=formatdatetime( 'mmdd',now);
post;
next;
end ;
if not FindKey([SeekData]) then
begin
first;
if not EOF then
begin
append;
Table5['SD']:=ComboBox3.Text; //送货单位
Table5['RD']:=ComboBox4.Text; //收货单位
Table5['Name']:=ComboBox5.Text; // 货品名称
Table5['Opter']:=Combobox1.text;
Table5['Ord']:=Table5.RecordCount+1;
Table5['InTime']:=Edit14.Text;
Table5['OutTime']:= Edit10.Text;
Table5['Date']:=DateToStr(Now);
Table5['CarNo']:=Combobox2.text;
Table5['MeterNo']:=IntToStr(Random(99));
Table5['TWet']:=StrToFloat(Edit6.Text);
Table5['LWet']:=StrToFloat(Edit7.Text);
Table5['Wet']:=StrToFloat(Edit9.Text);
Table5['ONE']:=Edit1.Text;
Table5['TWO']:=Edit2.Text;
Table5['THREE']:=Edit3.Text;
Table5['FOUR']:=Edit4.Text;
Table5['Kno']:=formatdatetime( 'mmdd',now);
post;
next;
end ;
end;
end;
Table5.Close;
close;
end;
procedure TF_Gloat.FirstPrnClick(Sender: TObject);
// var i:integer;
begin
if (Combobox1.Text='') or (Combobox2.Text='') or
(Combobox3.Text='') or (Combobox4.Text='') or
(Combobox5.Text='') or (Combobox6.Text='')
then
begin
MessageDlg('请选择有效资料',mtWarning,[mbOK],0);
Exit;
end;
OKClick(Sender);
with printer do
begin
BeginDoc;
with canvas do
begin
Pen.color:=clBlack; //字体颜色
//Pen.Width:=2;
Font.Charset := DEFAULT_CHARSET;
Font.Color := clWindowText ;
Font.Style := [];
// Font.Name := 'MS Sans Serif';
Font.Name := '宋体';
Font.Height := 11;
//====================第一联====================================//
Font.Size:=18;
TextOut(40,25,'60T地磅称重记录单');
Font.Size:=11;
TextOut(20,110,'送货单位:');
TextOut(20,180,'收货单位:');
TextOut(20,250,'货品名称:');
TextOut(20,320,' 司称员:');
Font.Size:=10;
TextOut(153,110,Combobox3.Text);
TextOut(153,180,Combobox4.Text);
TextOut(153,250,Combobox5.Text);
TextOut(153,320,ComboBox1.Text);
Font.Size:=11;
TextOut(25,380,'请保留好单据');
MoveTo(10,440); //横线
LineTo(480,440);
//************************//上半框
Pen.Width:=4; //框
MoveTo(10,2); //主横条
LineTo(480,2);
MoveTo(10,360);
LineTo(480,360);
MoveTo(10,2); //主竖条
LineTo(10,360);
MoveTo(180,80); //竖隔线
moveTo(180,360);
MoveTo(480,2);
LineTo(480,360);
Pen.Width:=2; //横条
moveTo(10,80);
LineTo(480,80); //
moveTo(10,150);
LineTo(480,150);//
moveTo(10,220);
LineTo(480,220); //
moveTo(10,290);
LineTo(480,290);//
// moveTo(10,360);
// LineTo(500,360); //
//************************//上半框 x=10 y=440
Font.Size:=12;
TextOut(40,460,' 第一联: 客户留存');
Pen.Width:=4; //框
MoveTo(10,500); //主横条1
LineTo(154,500);
MoveTo(10,1130);
LineTo(154,1130);
MoveTo(10,500); //主竖条1
LineTo(10,1130);
MoveTo(154,500);
LineTo(154,1130);
MoveTo(154,500); //主横条2
LineTo(480,500);
MoveTo(154,1130);
LineTo(480,1130);
MoveTo(154,500); //主竖条2
LineTo(154,1130);
MoveTo(480,500);
LineTo(480,1130);
Pen.Width:=2; //横条
moveTo(10,500);
LineTo(480,500); //
moveTo(10,570);
LineTo(480,570);//
moveTo(10,640);
LineTo(480,640); //
moveTo(10,710);
LineTo(480,710);//
moveTo(10,780);
LineTo(480,780); //
moveTo(10,850);
LineTo(480,850); //
moveTo(10,920);
LineTo(480,920);//
moveTo(10,990);
LineTo(480,990); //
moveTo(10,1060);
LineTo(480,1060);//
TextOut(20,530,'序 号');
TextOut(20,590,'日 期');
TextOut(20,660,'入厂时间');
TextOut(20,730,'出厂时间');
TextOut(20,810,'车牌号码');
TextOut(20,870,'空 罐 重');
TextOut(20,950,'总 重 量');
TextOut(20,1010,'皮 重');
TextOut(20,1080,'净 重');
TextOut(400,950,' Kg'); //总重
TextOut(400,1010,' Kg'); //皮重
TextOut(400,1080,' Kg'); //净重
Font.Size:=10;
TextOut(164,530,Edit5.Text);
TextOut(164,590,formatdatetime('yyyy"年"mm"月"dd"日" ',NOW));//DateToStr(NOW));
TextOut(164,660,Edit14.Text);
TextOut(164,730,Edit10.Text);
TextOut(164,810,ComboBox2.Text);
TextOut(164,870,Edit8.Text);
TextOut(164,950,Edit6.Text);
TextOut(164,1010,Edit7.Text);
TextOut(164,1080,Edit9.Text);
TextOut(20,1300,'送货单位签名:');
MoveTo(180,1380);
LineTo(460,1380);
TextOut(20,1500,'收货单位签名:');
MoveTo(180,1580);
LineTo(460,1580);
//===================第二联===========================//
Font.Size:=18;
TextOut(550,25,'60T地磅称重记录单');
Font.Size:=11;
TextOut(530,110,'送货单位:');
TextOut(530,180,'收货单位:');
TextOut(530,250,'货品名称:');
TextOut(530,320,' 司称员:');
Font.Size:=10;
TextOut(663,110,Combobox3.Text);
TextOut(663,180,Combobox4.Text);
TextOut(663,250,Combobox5.Text);
TextOut(663,320,ComboBox1.Text);
Font.Size:=11;
TextOut(535,380,'请保留好单据');
MoveTo(520,440); //横线
LineTo(990,440);
Pen.Width:=4; //框
MoveTo(520,2); //主横条
LineTo(990,2);
MoveTo(520,360);
LineTo(990,360);
MoveTo(520,2); //主竖条
LineTo(520,360);
MoveTo(690,80); //竖隔线
moveTo(690,360);
MoveTo(990,2);
LineTo(990,360);
Pen.Width:=2; //横条
moveTo(520,80);
LineTo(990,80); //
moveTo(520,150);
LineTo(990,150);//
moveTo(520,220);
LineTo(990,220); //
moveTo(520,290);
LineTo(990,290);//
// moveTo(520,360);
// LineTo(1010,360); //
//************************//上半框 x=10 y=440
Font.Size:=12;
TextOut(550,460,' 第二联:收货单位留存');
Pen.Width:=4; //框
MoveTo(520,500); //主横条
LineTo(664,500);
MoveTo(520,1130);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -