📄 productunit.pas
字号:
end;
Sqltext := 'execute _PM_P_InvCustState_Query 4,'''+ProdCode.Caption+''',''''';
PlanListBox.Items := Getlist(sqltext) ;
end;
procedure TfrmProduct.N36Click(Sender: TObject);
begin
if Not dm.tbPower.FieldValues['M203_9'] then begin
showmessage('无权执行,请咨询系统管理员!');
exit;
end;
if MessageDlg('提示: '+#13+'确认要删除当前计划中吗?'+#13+#13+#13,mtInformation,[mbOK,mbCancel],0) = mrOk Then begin
try
With dm.sql do begin
CommandText := 'Delete a__Plan Where PBName =:a';
Parameters.ParamByName('a').Value := lefts(PlanListBox.Items.Strings[PlanListBox.ItemIndex]);
execute;
showmessage('删除计划成功!');
end;
except
showmessage('删除计划失败!');
exit ;
end;
end;
Sqltext := 'execute _PM_P_InvCustState_Query 4,'''+ProdCode.Caption+''',''''';
PlanListBox.Items := Getlist(sqltext) ;
end;
procedure TfrmProduct.bStartDateClick(Sender: TObject);
begin
if not QueryInv.Active then bStartDate.Checked := False ;
if bStartDate.Checked then
begin
StartDate.Date := now();
StartDate.Enabled := True ;
// Source.Enabled := True ;
end else Begin
StartDate.Enabled := False;
// Source.Enabled := False ;
end;
end;
procedure TfrmProduct.bcbPriceClick(Sender: TObject);
begin
if not QueryInv.Active then bcbPrice.Checked := False ;
if bcbPrice.Checked then
begin
Sqltext := 'Select isnull(iInvSPrice,0) from inventory where cinvcode = '''+ProdCode.Caption+'''';
lcbPrice.Caption := Getlist(sqltext).Strings[0] ;
cbPrice.Enabled := True ;
end else begin
cbPrice.Enabled := False;
lcbPrice.Caption := '0' ;
end;
end;
procedure TfrmProduct.bxsPriceClick(Sender: TObject);
begin
if not QueryInv.Active then bxsPrice.Checked := False ;
if bxsPrice.Checked then
begin
Sqltext := 'Select isnull(iInvSCost,0) from inventory where cinvcode = '''+ProdCode.Caption+'''';
lxsPrice.Caption := Getlist(sqltext).Strings[0] ;
Sqltext := 'exec _PM_P_LoadItem '''+ ProdCode.Caption +''',13';
xsCustList.Items := Getlist(sqltext);
Sqltext := 'exec _PM_P_LoadItem '''+ ProdCode.Caption +''',14';
wsCustList.Items := Getlist(sqltext);
Sqltext := 'exec _PM_P_LoadItem '''+ ProdCode.Caption +''',15';
noCustList.Items := Getlist(sqltext);
xsPrice.Enabled := True ;
end else begin
xsPrice.Enabled := False;
xsCustList.Items.Clear;
wsCustList.Items.Clear;
noCustList.Items.Clear;
lxsPrice.Caption := '0' ;
end;
end;
procedure TfrmProduct.bwsPriceClick(Sender: TObject);
begin
if not QueryInv.Active then bwsPrice.Checked := False ;
if bwsPrice.Checked then
begin
Sqltext := 'Select isnull(iInvLSCost,0) from inventory where cinvcode = '''+ProdCode.Caption+'''';
lwsPrice.Caption := Getlist(sqltext).Strings[0] ;
Sqltext := 'exec _PM_P_LoadItem '''+ ProdCode.Caption +''',14';
wsCustList.Items := Getlist(sqltext);
wsPrice.Enabled := True ;
end else begin
wsPrice.Enabled := False;
wsCustList.Items.Clear;
lwsPrice.Caption := '0' ;
end;
end;
procedure TfrmProduct.blsPriceClick(Sender: TObject);
begin
if not QueryInv.Active then blsPrice.Checked := False ;
if blsPrice.Checked then
begin
Sqltext := 'Select isnull(fRetailPrice,0) from inventory where cinvcode = '''+ProdCode.Caption+'''';
llsPrice.Caption := Getlist(sqltext).Strings[0] ;
lsPrice.Enabled := True ;
end else begin
lsPrice.Enabled := False;
llsPrice.Caption := '0' ;
end;
end;
procedure TfrmProduct.bstPriceClick(Sender: TObject);
begin
if not QueryInv.Active then bstPrice.Checked := False ;
if bstPrice.Checked then
begin
Sqltext := 'SELECT TOP 1 isnull(S.iUPrice2,0) FROM Inventory AS I LEFT JOIN SA_InvUPrice AS S ON I.cInvCode = S.cInvCode WHERE (I.cInvCode = '''+ProdCode.Caption+''') ORDER BY S.dStartDate DESC ';
lstPrice.Caption := Getlist(sqltext).Strings[0] ;
stPrice.Enabled := True ;
end else begin
stPrice.Enabled := False;
lstPrice.Caption := '0' ;
end;
end;
procedure TfrmProduct.QueryInvAfterClose(DataSet: TDataSet);
begin
// cxLabel23.Caption:= '';
SALE.Close ;
end;
procedure TfrmProduct.tzPriceClick(Sender: TObject);
var
dSDate : Tdatetime ;
i,j : integer;
sCusCodes,sCusNames:string;
begin
if Not dm.tbPower.FieldValues['M203_A'] then begin
showmessage('无权执行,请咨询系统管理员!');
exit;
end;
if bStartDate.Checked then
dSdate := Startdate.date
else dSdate := now();
if (bcbPrice.Checked) and (cbPrice.Value <> 0) then
begin
if QueryInv.FieldByName('cVenCode').IsNull then
begin
showmessage('商品无主供应商,请更新商品资料后调价!');
exit ;
end;
With dm.sql do
begin
CommandText := 'EP_AujudPrice :a,:b,:c,:d,:e,:f,:g';
Parameters.ParamByName('a').Value := 1 ;
Parameters.ParamByName('b').Value := ProdCode.Caption ;
Parameters.ParamByName('c').Value := cbPrice.EditValue ;
Parameters.ParamByName('d').Value := dSDate ;
Parameters.ParamByName('e').Value := QueryInv.FieldByName('cVenCode').AsString ;
Parameters.ParamByName('f').Value := Source.text ;
Parameters.ParamByName('g').Value := FrmLogin.LandingUser ;
execute;
end;
end;
if (bxsPrice.Checked) and (xsPrice.Value <> 0) then
begin
With dm.sql do
begin
CommandText := 'EP_AujudPrice :a,:b,:c,:d,:e,:f,:g';
Parameters.ParamByName('a').Value := 2 ;
Parameters.ParamByName('b').Value := ProdCode.Caption ;
Parameters.ParamByName('c').Value := xsPrice.EditValue ;
Parameters.ParamByName('d').Value := dSDate ;
Parameters.ParamByName('e').Value := QueryInv.FieldByName('cVenCode').AsString ;
Parameters.ParamByName('f').Value := Source.text ;
Parameters.ParamByName('g').Value := FrmLogin.LandingUser ;
execute;
end;
end ;
if (bwsPrice.Checked) and (wsPrice.Value <> 0) then
begin
With dm.sql do
begin
CommandText := 'EP_AujudPrice :a,:b,:c,:d,:e,:f,:g';
Parameters.ParamByName('a').Value := 3 ;
Parameters.ParamByName('b').Value := ProdCode.Caption ;
Parameters.ParamByName('c').Value := wsPrice.EditValue ;
Parameters.ParamByName('d').Value := dSDate ;
Parameters.ParamByName('e').Value := QueryInv.FieldByName('cVenCode').AsString ;
Parameters.ParamByName('f').Value := Source.text ;
Parameters.ParamByName('g').Value := FrmLogin.LandingUser ;
execute;
end;
end ;
if (blsPrice.Checked) and (lsPrice.Value <> 0) then
begin
With dm.sql do
begin
CommandText := 'EP_AujudPrice :a,:b,:c,:d,:e,:f,:g';
Parameters.ParamByName('a').Value := 4 ;
Parameters.ParamByName('b').Value := ProdCode.Caption ;
Parameters.ParamByName('c').Value := lsPrice.EditValue ;
Parameters.ParamByName('d').Value := dSDate ;
Parameters.ParamByName('e').Value := QueryInv.FieldByName('cVenCode').AsString ;
Parameters.ParamByName('f').Value := Source.text ;
Parameters.ParamByName('g').Value := FrmLogin.LandingUser ;
execute;
end;
end ;
if (bstPrice.Checked) and (stPrice.Value <> 0) then
begin
With dm.sql do
begin
CommandText := 'EP_AujudPrice :a,:b,:c,:d,:e,:f,:g';
Parameters.ParamByName('a').Value := 5 ;
Parameters.ParamByName('b').Value := ProdCode.Caption ;
Parameters.ParamByName('c').Value := stPrice.EditValue ;
Parameters.ParamByName('d').Value := dSDate ;
Parameters.ParamByName('e').Value := QueryInv.FieldByName('cVenCode').AsString ;
Parameters.ParamByName('f').Value := Source.text ;
Parameters.ParamByName('g').Value := FrmLogin.LandingUser ;
execute;
end;
end ;
if (bqtPrice.Checked) and (qtPrice.Value <> 0) then
begin
j := 0 ;
with xsCustList.Items do begin
for i := 0 to Count-1 do begin
if xsCustList.Checked[i] then begin
j:=j+1;
if sCusCodes = '' then begin
sCusCodes := ''''+lefts(rights(Strings[i]))+'''';
sCusNames := rights(rights(Strings[i]))+' ';
end else begin
sCusCodes := sCusCodes +','''+ lefts(rights(Strings[i]))+'''';
sCusNames := sCusNames+rights(rights(Strings[i]))+' ';
if (j mod 3 )= 0 then sCusNames := sCusNames+#13 ;
end;
end;
end;
end;
with wsCustList.Items do begin
for i := 0 to Count-1 do begin
if wsCustList.Checked[i] then begin
j:=j+1;
if sCusCodes = '' then begin
sCusCodes := ''''+lefts(rights(Strings[i]))+'''';
sCusNames := rights(rights(Strings[i]))+' ';
end else begin
sCusCodes := sCusCodes +','''+ lefts(rights(Strings[i]))+'''';
sCusNames := sCusNames+rights(rights(Strings[i]))+' ';
if (j mod 3 )= 0 then sCusNames := sCusNames+#13 ;
end;
end;
end;
end;
with noCustList.Items do begin
for i := 0 to Count-1 do begin
if noCustList.Checked[i] then begin
j:=j+1;
if sCusCodes = '' then begin
sCusCodes := ''''+lefts(rights(Strings[i]))+'''';
sCusNames := rights(rights(Strings[i]))+' ';
end else begin
sCusCodes := sCusCodes +','''+ lefts(rights(Strings[i]))+'''';
sCusNames := sCusNames+rights(rights(Strings[i]))+' ';
if (j mod 3 )= 0 then sCusNames := sCusNames+#13 ;
end;
end;
end;
end;
if j=0 then begin
showmessage('无客户明细,不能建档指定价!');
exit ;
end;
if MessageDlg('确认重新指定价格吗? '+#13+#13+sCusNames+#13+#13+#13,mtCustom,[mbOK,mbCancel],0) = mrOk Then begin
try
With dm.sql do begin
CommandText := 'EP_AujudPrice :a,:b,:c,:d,:e,:f,:g';
Parameters.ParamByName('a').Value := 6 ;
Parameters.ParamByName('b').Value := ProdCode.Caption ;
Parameters.ParamByName('c').Value := qtPrice.EditValue ;
Parameters.ParamByName('d').Value := dSDate ;
Parameters.ParamByName('e').Value := sCusCodes ;
Parameters.ParamByName('f').Value := Source.text ;
Parameters.ParamByName('g').Value := FrmLogin.LandingUser ;
execute;
end;
except
exit ;
end;
end;
end;
with dm.sql do
begin
CommandText := '_PM_P_AUTOTransact';
execute;
end;
QueryProd(ProdCode.Caption);
end;
procedure TfrmProduct.ListProdDblClick(Sender: TObject);
begin
QueryProd(Lefts(ListProd.Items.Strings[ListProd.ItemIndex]));
end;
procedure TfrmProduct.bqtPriceClick(Sender: TObject);
begin
if not QueryInv.Active then bqtPrice.Checked := False ;
if bqtPrice.Checked then
begin
qtPrice.Enabled := True ;
end else begin
qtPrice.Enabled := False;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -