goodspriceadjustfm.pas
来自「群星医药系统源码」· PAS 代码 · 共 517 行 · 第 1/2 页
PAS
517 行
CdsGoodsPriceAdjustApplyDate.Value:= Date;
CdsGoodsPriceAdjustCreater.Value := LogonInfo^.UserID;
CdsGoodsPriceAdjustGrup.Value := LogonInfo^.UserGrupID;
cdsGoodsPriceAdjustGoodsCount.Value := 0;
end;
procedure TFmGoodsPriceAdjust.CdsGoodsPriceAdjustdtlBeforeInsert(
DataSet: TDataSet);
begin
if clbPriceModes.ItemsChecked=0 then
raise Exception.Create('请先右上角的方框中选择要调价的价格体系!');
iLastItemNo:=GetFieldMaxInt(CdsGoodsPriceAdjustdtl, 'ItemNo')+1;
sBillNo:=CdsGoodsPriceAdjustBillNo.Value;
end;
procedure TFmGoodsPriceAdjust.CdsGoodsPriceAdjustdtlNewRecord(
DataSet: TDataSet);
begin
inherited;
If iLastItemNo<>-1 Then
CdsGoodsPriceAdjustdtlItemNo.Value:=iLastItemNo;
CdsGoodsPriceAdjustdtlBillNo.Value:=sBillNo;
end;
procedure TFmGoodsPriceAdjust.ActAuditExecute(Sender: TObject);
begin
if (not cdsGoodsPriceAdjust.Active)or(cdsGoodsPriceAdjust.IsEmpty) then exit;
inherited;
if MessageBox(Handle,'调价单一经审核生效后便不能被修改或还原!'#13'要继续吗?','警告',MB_ICONEXCLAMATION or MB_YESNO)=IDNO then exit;
if MessageBox(Handle,'即将审核调价单。'#13'请按[确定]继续审核,按[取消]不审核。','警告',MB_ICONEXCLAMATION or MB_OKCANCEL or MB_DEFBUTTON2)=IDCANCEL then exit;
SvrGoodsPriceAdjust.AppServer.AuditBill(iClientID,cdsGoodsPriceAdjustBillNo.Value);
cdsGoodsPriceAdjust.Refresh;
end;
procedure TFmGoodsPriceAdjust.ActRevertExecute(Sender: TObject);
begin
//
end;
procedure TFmGoodsPriceAdjust.ActAddSubItemExecute(Sender: TObject);
begin
if cdsGoodsPriceAdjustDtl.State<>dsInsert then
cdsGoodsPriceAdjustDtl.Append;
BrowGoods;
end;
procedure TFmGoodsPriceAdjust.ActDelSubItemExecute(Sender: TObject);
begin
cdsGoodsPriceAdjustDtl.Delete;
end;
procedure TFmGoodsPriceAdjust.cdsGoodsPriceAdjustAfterScroll(
DataSet: TDataSet);
begin
RefreshNavState;
end;
procedure TFmGoodsPriceAdjust.dbgGoodsPriceAdjustDtlEditButtonClick(Sender: TObject);
begin
if FEditMode=0 then Exit;
if LowerCase(dbgGoodsPriceAdjustDtl.SelectedField.FieldName)='goodsid' then begin
BrowGoods;
end;
end;
procedure TFmGoodsPriceAdjust.BrowGoods;
var i: Integer;
bAppend: Boolean;
begin
if bBrowGoods then Exit;
bBrowGoods := true;
try
if cdsGoodsPriceAdjustDtl.IsEmpty then
cdsGoodsPriceAdjustDtl.Append;
bAppend := cdsGoodsPriceAdjustDtl.State=dsInsert;
if cdsGoodsPriceAdjustDtl.IsEmpty then
cdsGoodsPriceAdjustDtl.Append;
if bAppend then
i := cdsGoodsPriceAdjustDtl.RecordCount;
SelectGoods(cdsGoodsPriceAdjustDtl, CdsGoodsPriceAdjustdtlGoodsID, nil, true, bAppend, true);
if bAppend then
cdsGoodsPriceAdjustDtl.RecNo := i+1;
finally
bBrowGoods := false;
end;
end;
procedure TFmGoodsPriceAdjust.CdsGoodsPriceAdjustdtlGoodsIDChange(
Sender: TField);
var LogText,Flag,sGoodsID,sSetFields:String;
i, k: integer;
begin
if (FEditMode=0) then Exit;
sGoodsID:=cdsGoodsPriceAdjustDtlGoodsID.AsString;
If sGoodsID='' Then Exit;
BrowGoods;
if cdsGoodsPriceAdjustDtlPriceModeNo.IsNull then
begin
k := clbPriceModes.Count;
for i:=0 to k-1 do
if clbPriceModes.ItemChecked[i] then begin
cdsGoodsPriceAdjustDtlModeName.Value := clbPriceModes.Items[i];
cdsGoodsPriceAdjustDtlPriceModeNo.Value := StrToInt(sPriceModes[i]);
Break;
end;
end;
if (not bBrowGoods) or bSelfCopying then//仅仅只需要更新原价格信息
begin
sGoodsID:=cdsGoodsPriceAdjustDtlGoodsID.AsString; //这里一定要再取一次,因为在BorwGoods中会将助记码(如GK)转为编号(如10578)
GetGoodsPrice(cdsGoodsPriceAdjustDtl, 'OldPrice1;OldPrice2', cdsGoodsPriceAdjustDtlPriceModeNo.AsString, '', sGoodsID, '');
Exit;
end;
end;
procedure TFmGoodsPriceAdjust.CdsGoodsPriceAdjustdtlBeforePost(
DataSet: TDataSet);
var i, k: Integer;
begin
if DataSet.FieldByName('GoodsID').IsNull then
raise Exception.Create('请行输入或选择药品代码!');
bDtlAppend := DataSet.State=dsInsert;
if cdsGoodsPriceAdjustDtlPriceModeNo.IsNull then
begin
k := clbPriceModes.Count;
for i:=0 to k-1 do
if clbPriceModes.ItemChecked[i] then begin
DataSet.FieldByName('ModeName').Value := clbPriceModes.Items[i];
DataSet.FieldByName('PriceModeNo').Value:= sPriceModes[i];
Break;
end;
end;
end;
procedure TFmGoodsPriceAdjust.CdsGoodsPriceAdjustdtlAfterPost(
DataSet: TDataSet);
var sGoodsID, sName, sSpecs, sAbcKind, sPdcAddr, sMaker: String;
// Bookmark: TBookmark;
i, k, j: integer;
begin
if bDtlAppend and not bSelfCopying then begin
if clbPriceModes.ItemsChecked=1 then Exit;
sGoodsID := DataSet.FieldByName('GoodsID').AsString;
sName := DataSet.FieldByName('Name').AsString;
sSpecs := DataSet.FieldByName('Specs').AsString;
sAbcKind := DataSet.FieldByName('AbcKind').AsString;
sPdcAddr := DataSet.FieldByName('PdcAddr').AsString;
sMaker := DataSet.FieldByName('Maker').AsString;
// := DataSet.FieldByName('').AsString;
j := 0;
k := clbPriceModes.Count;
bSelfCopying := true;
DataSet.DisableControls;
// Bookmark := DataSet.GetBookmark;
try
for i:=0 to k-1 do begin
if not clbPriceModes.ItemChecked[i] then Continue;
Inc(j);
if j=1 then Continue;
with DataSet do begin
Append;
DataSet.FieldByName('PriceModeNo').Value:= sPriceModes[i];
DataSet.FieldByName('ModeName').Value := clbPriceModes.Items[i];
DataSet.FieldByName('GoodsID').AsString := sGoodsID;//这里一定要先给PriceModeNo字段赋值,然后再给GoodsID字段赋值
DataSet.FieldByName('Name').AsString := sName ;
DataSet.FieldByName('Specs').AsString := sSpecs ;
DataSet.FieldByName('AbcKind').AsString := sAbcKind;
DataSet.FieldByName('PdcAddr').AsString := sPdcAddr;
DataSet.FieldByName('Maker').AsString := sMaker ;
Post;
end;
end;
finally
bSelfCopying := false;
// DataSet.GotoBookmark(Bookmark);
// DataSet.FreeBookmark(Bookmark);
dbgGoodsPriceAdjustDtl.SetFocus;
dbgGoodsPriceAdjustDtl.SelectedIndex := dbgGoodsPriceAdjustDtl.FieldColumns['NewPrice1'].Index;
DataSet.EnableControls;
end;
end;
end;
procedure TFmGoodsPriceAdjust.ActPrintExecute(Sender: TObject);
begin
inherited;
// SelRepPrint(self.Name, [cdsGoodsPriceAdjust, cdsGoodsPriceAdjustDtl], '调价单;调价明细', nil);
end;
procedure TFmGoodsPriceAdjust.RzDBButtonEdit1ButtonClick(Sender: TObject);
var
sEmpNo, sEmpName: string;
begin
if (cdsGoodsPriceAdjust.State = dsEdit) or (cdsGoodsPriceAdjust.State = dsInsert) then
begin
sEmpNo := '';
sEmpName := '';
if SelectEmp(sEmpNo, sEmpName) then
begin
RzDBButtonEdit1.Text := sEmpNo;
RzDBEdit7.Text := sEmpName;
end;
end;
end;
procedure TFmGoodsPriceAdjust.ActFieldLayoutExecute(Sender: TObject);
begin
SetFieldsLayOut(LocSetting^.FieldLayoutCfgFile, Name, [dbgGoodsPriceAdjustDtl],'药品调价明细');
end;
procedure TFmGoodsPriceAdjust.ActDataExportExecute(Sender: TObject);
begin
ExportData([cdsGoodsPriceAdjust, cdsGoodsPriceAdjustDtl],'药品调价单;药品调价明细', '');
end;
procedure TFmGoodsPriceAdjust.ActFirstExecute(Sender: TObject);
begin
inherited;
ResetColWidthFitDataSetEh(dbgGoodsPriceAdjustDtl,CdsGoodsPriceAdjustdtl);
end;
procedure TFmGoodsPriceAdjust.ActPriorExecute(Sender: TObject);
begin
inherited;
ResetColWidthFitDataSetEh(dbgGoodsPriceAdjustDtl,CdsGoodsPriceAdjustdtl);
end;
procedure TFmGoodsPriceAdjust.ActNextExecute(Sender: TObject);
begin
inherited;
ResetColWidthFitDataSetEh(dbgGoodsPriceAdjustDtl,CdsGoodsPriceAdjustdtl);
end;
procedure TFmGoodsPriceAdjust.ActLastExecute(Sender: TObject);
begin
inherited;
ResetColWidthFitDataSetEh(dbgGoodsPriceAdjustDtl,CdsGoodsPriceAdjustdtl);
end;
procedure TFmGoodsPriceAdjust.ActRefreshExecute(Sender: TObject);
begin
inherited;
ResetColWidthFitDataSetEh(dbgGoodsPriceAdjustDtl,CdsGoodsPriceAdjustdtl);
end;
procedure TFmGoodsPriceAdjust.cdsGoodsPriceAdjustAfterOpen(
DataSet: TDataSet);
begin
inherited;
ResetColWidthFitDataSetEh(dbgGoodsPriceAdjustDtl,CdsGoodsPriceAdjustdtl);
end;
initialization
RegisterClass(TFmGoodsPriceAdjust);
finalization
UnRegisterClass(TFmGoodsPriceAdjust);
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?