📄 fin_product_xs.pas
字号:
begin
kcNum_size:=FieldValues['size_1'];
if XS_num>kcNum_size then
begin
msgErr(handle,'型号[S/6]库存数量有限,仅剩下 '+inttostr(kcNum_size)+' '+tmp_unit);
Edit_num.SetFocus;
exit;
end;
size_type:='size_1';
end;
if size_name='M/ 8' then
begin
kcNum_size:=FieldValues['size_2'];
if XS_num>kcNum_size then
begin
msgErr(handle,'型号[M/8]库存数量有限,仅剩下 '+inttostr(kcNum_size)+' '+tmp_unit);
Edit_num.SetFocus;
exit;
end;
size_type:='size_2';
end;
if size_name='L/ 10' then
begin
kcNum_size:=FieldValues['size_3'];
if XS_num>kcNum_size then
begin
msgErr(handle,'型号[L/10]库存数量有限,仅剩下 '+inttostr(kcNum_size)+' '+tmp_unit);
Edit_num.SetFocus;
exit;
end;
size_type:='size_3';
end;
if size_name='XL/12' then
begin
kcNum_size:=FieldValues['size_4'];
if XS_num>kcNum_size then
begin
msgErr(handle,'型号[XL/12]库存数量有限,仅剩下 '+inttostr(kcNum_size)+' '+tmp_unit);
Edit_num.SetFocus;
exit;
end;
size_type:='size_4';
end;
if size_name='XXL/14' then
begin
kcNum_size:=FieldValues['size_5'];
if XS_num>kcNum_size then
begin
msgErr(handle,'型号[XXL/14]库存数量有限,仅剩下 '+inttostr(kcNum_size)+' '+tmp_unit);
Edit_num.SetFocus;
exit;
end;
size_type:='size_5';
end;
if size_name='XXXL/16' then
begin
kcNum_size:=FieldValues['size_6'];
if XS_num>kcNum_size then
begin
msgErr(handle,'型号[XXXL/16]库存数量有限,仅剩下 '+inttostr(kcNum_size)+' '+tmp_unit);
Edit_num.SetFocus;
exit;
end;
size_type:='size_6';
end;
end;
tmp_money:=tmp_price*XS_num;
money_Flag:=ChkBox_Flag.Checked;
if money_Flag then
begin
DBComboBox2.Text:=trim(DBComboBox2.Text);
if trim(edtname.Text)='' then
begin
MsgOk(handle,'待透支购买服装的员工姓名为空,请在员工编号文本框内输入员工编号,再按回车键!');
DBComboBox2.SetFocus;
exit;
end;
emp_id:=strtoint(DBComboBox2.Text);
emp_name:=edtname.Text;
Emp_SL:=calbal(strtoint(DBComboBox2.Text));
if Emp_SL<tmp_money then
begin
Msgok(handle,'购买服装成品的金额超过该员工的收入结余,操作无法进行!'+#13+#13+' 购买服装需支出: ¥'+format('%.2f',[tmp_money])+' 元'+#13+#13+' 个人结余为: ¥'+format('%.2f',[Emp_SL])+' 元');
exit;
end;
end;
//显示销售服装的金额及数量信息
Form_FinPro_XS_Query:=TForm_FinPro_XS_Query.Create(application);
if Form_FinPro_XS_Query.ShowModal=mrok then
begin
Edit_num.Text:='0';
ComboBox_size.ItemIndex:=0;
Edit_price.Text:='¥0.00';
ChkBox_Flag.Checked:=false;
ChkBox_FlagClick(self);
end;
end;
procedure TForm_Fin_Product_XS.Edit_priceEnter(Sender: TObject);
begin
if Edit_price.Text='¥0.00' then Edit_price.Text:='0.00';
end;
procedure TForm_Fin_Product_XS.LocateBtnClick(Sender: TObject);
var
tmpdatetime:Tdatetime;
begin
if not panel5.Visible then
begin
add_combox_item;
panel5.Enabled:=true;
panel5.Visible:=true;
//得到入库日期
GetHostDateTime(datamod.ADOCon,tmpdatetime);
edate.DateTime:=tmpdatetime;
ComboBox_ordid.Text:='';
ComboBox_costume.text:='';
ComboBox_cloth.ItemIndex:=0;
ComBox_custname.text:='';
ComBox_opeid.ItemIndex:=0;
edit1.Clear; edit2.Clear;
ExtBtn.Cancel:=false;
CancelBtn.cancel:=true;
end;
end;
procedure TForm_Fin_Product_XS.BitBtn1Click(Sender: TObject);
begin
if not ADOV_XS_Fin.Active then exit;
refreshdb;
end;
procedure TForm_Fin_Product_XS.CancelBtnClick(Sender: TObject);
begin
panel5.Visible:=false;
panel5.Enabled:=false;
ExtBtn.Cancel:=true;
CancelBtn.cancel:=false;
end;
procedure TForm_Fin_Product_XS.OKBtnClick(Sender: TObject);
var
tmpnum, ordid, clothing, cust_name,
costume, tmp_operid, strwhere: string;
begin
ordid:=trim(ComboBox_ordid.text);
clothing:=trim(ComboBox_cloth.text);
costume:=trim(ComboBox_costume.text);
cust_name:=trim(ComBox_custname.text);
tmp_operid:=trim(ComBox_opeid.text);
tmpnum:=Getquery_char(ComboBox1.Text,trim(Edit1.Text),trim(ComboBox2.Text),ComboBox3.Text,trim(Edit2.Text),'num');
//得到查询的条件语句
begin
strwhere:='where (XSdate between :TmpStart and :TmpEnd )';
if ordid<>'' then
strwhere:=strwhere+' and (ord_id = '+''''+ordid+''''+')';
if clothing<>'' then
strwhere:=strwhere+' and (clo_name = '+''''+clothing+''''+')';
if costume<>'' then
strwhere:=strwhere+' and (costume_name = '+''''+costume+''''+')';
if cust_name<>'' then
strwhere:=strwhere+' and (cust_name = '+''''+size_name+''''+')';
if tmp_operid<>'' then
strwhere:=strwhere+' and (opername = '+''''+tmp_operid+''''+')';
strwhere:=strwhere + tmpnum;
end;
with ADOV_XS_Fin do
begin
try
close;
sql.Strings[1]:=strwhere;
sql.Strings[2]:='order by clo_name,cust_name,ord_id,xsdate desc';
parameters.ParamValues['TmpStart']:=strtodatetime(formatdatetime('yyyy-mm-dd',sdate.Date)+' 00:00:00');
parameters.ParamValues['TmpEnd']:=strtodatetime(formatdatetime('yyyy-mm-dd',edate.Date)+' 23:59:59');
execsql;
open;
except
MsgErr(handle,'数据库检索失败(Fin_product_XS_V)!');
refreshdb;
exit;
end;
BtnExport.Enabled:=recordcount>0;
end;
panel5.Visible:=false;
panel5.Enabled:=false;
ExtBtn.Cancel:=true;
CancelBtn.cancel:=false;
end;
procedure TForm_Fin_Product_XS.ChkBox_FlagClick(Sender: TObject);
begin
GroupBox1.Visible:=ChkBox_Flag.Checked;
DBComboBox2.Text:='';
edtsex.Text:='';
edtname.Text:='';
end;
procedure TForm_Fin_Product_XS.DBComboBox2KeyPress(Sender: TObject;
var Key: Char);
begin
if trim(DBComboBox2.Text)='' then exit;
if not ( key in ['0'..'9',chr(8),chr(13)]) then abort;
if key <> chr(13) then exit;
with adoq_temp do
begin
SQL.Clear;
sql.Add('select empid, empname, sex from employee where empid='+''''+trim(DBComboBox2.Text)+'''');
execsql; open;
end;
edtname.Clear;
if adoq_temp.RecordCount=0 then
begin
MsgErr(handle,'人员编码 ['+trim(DBComboBox2.Text)+'] 不存在!');
exit;
end
else
begin
edtname.Text:=adoq_temp.FieldValues['empname'];
edtsex.Text:=adoq_temp.FieldValues['sex'];
end;
end;
procedure TForm_Fin_Product_XS.DBComboBox2Change(Sender: TObject);
begin
DBComboBox2.Text:=trim(DBComboBox2.Text);
edtname.clear;
end;
procedure TForm_Fin_Product_XS.FormShow(Sender: TObject);
begin
//添加人员编码
with adoq_temp do
begin
close;sql.clear;
sql.add('select empid,empname,sex from employee where state=1');
open;
if recordcount =0 then
begin
MsgErr(handle,'无人员信息!');
exit;
end;
first;
while not eof do
begin
DBComboBox2.Items.Add(fieldvalues['empid']);
next;
end;
end;
with adoQ_tmp do
begin
close; sql.Clear;
sql.Add('select ord_id,costume_name from order_msg');
open; First;
ComboBox_ordid.Clear;
ComboBox_costume.Clear;
ComboBox_ordid.Items.Add(' ');
ComboBox_costume.Items.Add(' ');
while not eof do
begin
ComboBox_ordid.Items.Add(fieldvalues['ord_id']);
ComboBox_costume.Items.Add(fieldvalues['costume_name']);
next;
end;
close; sql.Clear;
sql.Add('select cust_name from customer');
open ; First;
ComBox_custname.Items.Clear;
ComBox_custname.Items.Add(' ');
while not eof do
begin
ComBox_custname.Items.Add(fieldvalues['cust_name']);
next;
end;
close; sql.Clear;
sql.Add('select clo_name from clothing');
open ; First;
ComboBox_cloth.Items.Clear;
DBLookupComboBox1.Items.Clear;
ComboBox_cloth.Items.Add(' ');
DBLookupComboBox1.Items.Add(' ');
while not eof do
begin
ComboBox_cloth.Items.Add(fieldvalues['clo_name']);
DBLookupComboBox1.Items.Add(fieldvalues['clo_name']);
next;
end;
close;sql.Clear;
sql.Add('select opername from operator');
open; first;
ComBox_opeid.Clear;
while not eof do
begin
ComBox_opeid.Items.Add(fieldvalues['opername']);
next;
end;
close;
end;
end;
procedure TForm_Fin_Product_XS.Bit_Ser2Click(Sender: TObject);
begin
edit3.Text:=trim(edit3.Text);
if edit3.Text='' then begin edit3.SetFocus;exit;end;
//查找对应的订单信息
with ADOV_KC_Fin do
begin
close;
sql.Strings[1]:='costume_name like '+''''+'%'+edit3.Text+'%'+'''';
open;
if recordcount<0 then
begin
MsgErr(handle,'没找到服装名称为 ['+edit3.Text+'] 的库存订单!');
edit3.SetFocus;
end;
end;
end;
procedure TForm_Fin_Product_XS.Edit3KeyPress(Sender: TObject;
var Key: Char);
begin
if key=chr(13) then Bit_Ser2.Click;
end;
procedure TForm_Fin_Product_XS.PageControl1Change(Sender: TObject);
begin
if PageControl1.ActivePageIndex=0 then
begin
if ADOV_XS_Fin.Active then ADOV_XS_Fin.close;
Edit_price.Text:='¥0.00';
Edit_num.Text:='0';
ComboBox_size.ItemIndex:=0;
end;
end;
//使用服装类别过滤服装库存信息
procedure TForm_Fin_Product_XS.DBLookupComboBox1Change(Sender: TObject);
begin
DBLookupComboBox1.Text:=trim(DBLookupComboBox1.Text);
with ADOV_KC_Fin do
begin
close;
if trim(DBLookupComboBox1.Text)='' then
begin
sql.Strings[1]:='';
open; exit;
end;
SQL.Strings[1]:='where clo_name ='+''''+trim(DBLookupComboBox1.Text)+'''';
execsql; open;
end;
end;
procedure TForm_Fin_Product_XS.Edit1KeyPress(Sender: TObject;
var Key: Char);
begin
if not (key in ['0'..'9',#13, #8]) then abort;
end;
procedure TForm_Fin_Product_XS.BtnExportClick(Sender: TObject);
begin
Form_main.WriteIntoExcel(DBGrid2,datetostr(date),'成品销售信息报表');
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -