📄 upriceupdate.pas
字号:
Query1.SQL.Clear;
Query1.SQL.Add('update #tg set 应结算金额=0,已结算金额='+floattostr(StrikeMoney)+',结算数量=0 where id='+inttostr(Aid)+'');
Query1.ExecSQL;
end;
end;
TmpSql:='insert into goodsbase select 品名,牌号,条码,规格,分类,等级,厂家,供货商,进价,售价,';
TmpSql:=TmpSql+'销售部门,新增商品通知单来源,进货上限,进货数量,当前库存,库存损耗数量,结账方式,损耗限额比,物价员,';
TmpSql:=TmpSql+'最后更新日期,专利号,检测报告编号,商标代码,厂家经手人,经手人,合同号,结账日期,销售数量,销售结算金额,库存结算金额,库存损耗金额,应结算金额,交易更新时间,已结算金额,备注,折扣标志,计量单位,销售更新标志,税率,结算数量,折扣,折扣折让,倒扣比例,进价扣率,售价扣率,';
tmpsql:=tmpsql+'销售金额,审核人,选择 from #tg where id='''+inttostr(Aid)+'''';
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add(tmpsql);
Query1.ExecSQL;
//Query1.Close;
//Query1.SQL.Clear;
//Query1.SQL.Add('select 合同号 from goodsbase where id='+inttostr(aid)+'');
//Query1.Open;
//TmpSql:=Query1['合同号'];
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('update storebase set 合同号='''+trim(edit3.Text)+''' where 合同号='''+StaticText2.Caption+'''');
Query1.ExecSQL;
end
else
begin
Application.MessageBox('合同号不能相同!','提示',MB_IconInformation);
end
else
begin
Application.MessageBox('请输入合同号!','消息',MB_IconInformation);
end;
end
else
begin
if Edit3.Text<>StaticText2.Caption then
begin
SellNumber:=strtoint(StaticText3.Caption)-strtoint(Edit2.Text);
StockStrikeMoney:=strtofloat(Edit2.Text)*strtofloat(Edit1.Text);
SellStrikeMoney:=SellNumber * (strtofloat(StaticText7.Caption));
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('update goodsbase set 进货数量='+inttostr(SellNumber)+',销售数量='+inttostr(SellNumber)+',当前库存=0,库存结算金额=0,销售结算金额='+floattostr(SellStrikeMoney)+',应结算金额='+floattostr(SellStrikeMoney)+' where id='+inttostr(aid)+'');
Query1.ExecSQL;
TmpSql:='update #tg set 进价='+edit1.Text+',当前库存='+edit2.Text+',合同号='''+edit3.Text+''',最后更新日期='''+formatdatetime('20yy-mm-dd',now)+''',';
TmpSql:=TmpSql+'厂家经手人='''+edit4.Text+''',经手人='''+edit5.Text+''',进货数量='+edit2.Text+',';
TmpSql:=TmpSql+'库存结算金额='+floattostr(StockStrikeMoney)+',销售数量=0,销售结算金额=0 where id='+inttostr(Aid)+'';
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add(tmpsql);
Query1.ExecSQL;
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('select * from #tg where id='+inttostr(aid)+'');
Query1.Open;
b:=Query1['库存结算金额'];
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('select * from goodsbase where id='+inttostr(aid)+'');
Query1.Open;
a:=Query1['进价']*Query1['进货数量']+b;
ARSellMoney:=(Price.QueryPrice['当前库存']+Price.QueryPrice['销售数量']-Query1['当前库存'])*Price.QueryPrice['进价'];
NewSellMoney:=Query1['当前库存']*Query1['进价'];
Query1.Close;
Query1.SQL.Clear;
case StrikeMode of
1:
begin
TmpSql:='update #tg set 应结算金额='+floattostr(StockStrikeMoney)+',已结算金额='+floattostr(StrikeMoney)+', 结算数量=0';
TmpSql:=TmpSql+' where id='+inttostr(Aid)+'';
Query1.SQL.Add(TmpSql);
Query1.ExecSQL;
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('select * from copebalancebase where 供货商='''+Merchant+'''');
Query1.Open;
CopeMoney:=Query1['应付金额'];
SellStrikeMoney:=Query1['销售结算金额'];
StockStrikeMoney:=Query1['库存结算金额'];
CopeMoney:=CopeMoney-strtofloat(StaticText3.Caption)*strtofloat(StaticText7.Caption);
CopeMoney:=CopeMoney+(strtofloat(StaticText3.Caption)-strtofloat(Edit2.Text))*strtofloat(StaticText7.Caption);
CopeMoney:=CopeMoney+strtofloat(Edit2.Text)*strtofloat(Edit1.Text);
SellStrikeMoney:=SellStrikeMoney-(strtofloat(StaticText4.Caption)*strtofloat(StaticText7.Caption));
SellStrikeMoney:=SellStrikeMoney+strtofloat(StaticText7.Caption)*(strtofloat(StaticText3.Caption)-strtofloat(Edit2.Text));
StockStrikeMoney:=StockStrikeMoney-strtofloat(StaticText8.Caption)*strtofloat(StaticText7.Caption);
StockStrikeMoney:=StockStrikeMoney+strtofloat(Edit2.Text)*strtofloat(Edit1.Text);
CopeBalanceMoney:=Query1['进货金额']-Query1['应付金额'];
b:=Query1['进货金额']-Price.QueryPrice['进价']*Price.QueryPrice['进货数量']+a;
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('update copebalancebase set 进货金额='+floattostr(b)+',应付金额='+floattostr(CopeMoney)+',销售结算金额='+floattostr(SellStrikeMoney)+',库存结算金额='+floattostr(StockStrikeMoney)+',进货平衡金额='+floattostr(CopeBalanceMoney)+' where 供货商='''+Merchant+'''');
Query1.ExecSQL;
end
else
begin
Query1.SQL.Add('update #tg set 应结算金额=0,已结算金额='+floattostr(StrikeMoney)+',结算数量=0 where id='+inttostr(Aid)+'');
Query1.ExecSQL;
BehoveSellMoney:=strtofloat(StaticText4.Caption)*strtofloat(StaticText7.Caption);
ARSellMoney:=(strtofloat(StaticText3.Caption)-strtofloat(Edit2.Text))*strtofloat(StaticText3.Caption);
NewSellMoney:=strtofloat(Edit2.Text)*strtofloat(Edit1.Text);
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('select * from copebalancebase where 供货商='''+Merchant+'''');
Query1.Open;
CopeMoney:=Query1['应付金额'];
SellStrikeMoney:=Query1['销售结算金额'];
StockStrikeMoney:=Query1['库存结算金额'];
CopeMoney:=CopeMoney-BehoveSellMoney;
CopeMoney:=CopeMoney+ARSellMoney;
CopeMoney:=CopeMoney+NewSellMoney;
SellStrikeMoney:=SellStrikeMoney-(strtofloat(StaticText4.Caption)*strtofloat(StaticText7.Caption));
SellStrikeMoney:=SellStrikeMoney+strtofloat(StaticText7.Caption)*(strtofloat(StaticText3.Caption)-strtofloat(Edit2.Text));
StockStrikeMoney:=StockStrikeMoney-strtofloat(StaticText8.Caption)*strtofloat(StaticText7.Caption);
StockStrikeMoney:=StockStrikeMoney+strtofloat(Edit2.Text)*strtofloat(Edit1.Text);
CopeBalanceMoney:=Query1['进货金额']-Query1['应付金额'];
b:=Query1['进货金额']-Price.QueryPrice['进价']*Price.QueryPrice['进货数量']+a;
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('update copebalancebase set 进货金额='+floattostr(b)+',应付金额='+floattostr(CopeMoney)+',销售结算金额='+floattostr(SellStrikeMoney)+',库存结算金额='+floattostr(StockStrikeMoney)+',进货平衡金额='+floattostr(CopeBalanceMoney)+' where 供货商='''+Merchant+'''');
Query1.ExecSQL;
end;
end;
TmpSql:='insert into goodsbase select 品名,牌号,条码,规格,分类,等级,厂家,供货商,进价,售价,';
TmpSql:=TmpSql+'销售部门,新增商品通知单来源,进货上限,进货数量,当前库存,库存损耗数量,结账方式,损耗限额比,物价员,';
TmpSql:=TmpSql+'最后更新日期,专利号,检测报告编号,商标代码,厂家经手人,经手人,合同号,结账日期,销售数量,销售结算金额,库存损耗金额,库存结算金额,应结算金额,交易更新时间,已结算金额,备注,折扣标志,计量单位,销售更新标志,税率,结算数量,折扣,折扣折让,倒扣比例,进价扣率,售价扣率,';
tmpsql:=tmpsql+'销售金额,审核人,选择 from #tg where id='''+inttostr(Aid)+'''';
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add(tmpsql);
Query1.ExecSQL;
//Query1.SQL.Clear;
//Query1.SQL.Add('select 合同号 from goodsbase where id='+inttostr(aid)+'');
//Query1.Open;
//TmpSql:=Query1['合同号'];
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('update storebase set 合同号='''+trim(edit3.Text)+''' where 合同号='''+StaticText2.Caption+'''');
Query1.ExecSQL;
end
else
begin
Application.MessageBox('合同号不能相同!','提示',MB_IconInformation);
end;
end;
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('drop table #tg');
Query1.ExecSQL;
Edit1.Text:='';
Edit2.Text:='';
Edit3.Text:='';
Edit4.Text:='';
Edit5.Text:='';
end
else
begin
Application.MessageBox('新进价不能为空!','提示',MB_IconInformation);
end;
end;
procedure Tpriceupdate.OutlookBtn2Click(Sender: TObject);
var
Merchant:string;
begin
Merchant:=Price.QueryPrice['供货商'];
with price do
begin
QueryPrice.Close;
QueryPrice.SQL.Clear;
QueryPrice.SQL.Add('select * from goodsbase where 供货商='''+Trim(Merchant)+''' and 进货数量<>0');
QueryPrice.Prepare;
QueryPrice.Open;
end;
price.OnActivate(self);
PriceUpdate.Release;
PriceUpdate.Close;
end;
procedure Tpriceupdate.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key=VK_Return then
begin
Key:=0;
postmessage(handle,WM_NEXTDlGctl,0,0);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -