📄 selsendoutfrm.pas
字号:
dTaxSum := dTaxSum+ FieldbyName('TaxSum').AsFloat;
dAmount := dAmount+ FieldbyName('Amount').AsFloat;
next;
end;
CdsSelSendOut.FieldByName('GoodsQty').AsFloat:=dQty;
CdsSelSendOut.FieldByName('TaxSum').AsFloat:=dTaxSum;
CdsSelSendOut.FieldByName('Amount').AsFloat:=dAmount;
CdsSelSendOut.FieldByName('GoodsSum').AsFloat:=dGoodsSum;
finally
GotoBookmark(Mark1);
FreeBookmark(Mark1);
EnableControls;
end;
end;
end;
procedure TFmSelSendOut.edProvNameButtonClick(Sender: TObject);
Var sCustNo,sCustName,sEmpNo,sPayModeNo:String;
begin
If FEditMode=0 Then Exit;
sCustNo := CdsSelSendOutCustNo.Value;
If SelectCust(sCustNo,sCustName,sEmpNo,sPayModeNo) Then
Begin
CdsSelSendOutCustNo.Value := sCustNo;
CdsSelSendOutCustName.Value := sCustName;
CdsSelSendOutEmpNo.Value := sEmpNo;
CdsSelSendOutPayModeNo.Value := sPayModeNo;
End;
End;
procedure TFmSelSendOut.RzDBButtonEdit1ButtonClick(Sender: TObject);
Var sEmpNo,sEmpName:String;
begin
If FEditMode=0 Then Exit;
sEmpNo := CdsSelSendOutEmpNo.Value;
If SelectEmp(sEmpNo,sEmpName) Then begin
CdsSelSendOutEmpNo.Value := sEmpNo;
CdsSelSendOutEmpName.Value := sEmpName;
End;
end;
procedure TFmSelSendOut.ShowPayModes;
Var
A:Variant;
iClientID, I, k:Integer;
begin
Try
iClientID := IFmMain.IFmMainEx.ClientID;
A:=SvrSelSendOut.AppServer.GetNeedValue(iClientID,3,sPayModes);
If (Not VarIsNull(A)) And (VarIsArray(A)) Then
Begin
slPayModes.Clear;
cbPayModes.Items.Clear;
k := VarArrayHighBound(A,2);
for i:=VarArrayLowBound(A,2) to k do
Begin
slPayModes.Add(A[0,i]);
cbPayModes.Items.Add(A[0,i]+':'+A[1,i]+'('+A[2,i]+')');
End;
End;
Except
On E:Exception Do
Messagebox(Handle,Pchar(E.Message),'',16);
End;
end;
procedure TFmSelSendOut.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
Action:=caFree;
end;
procedure TFmSelSendOut.dbgSelSendOutDtlEditButtonClick(Sender: TObject);
Var
DepotNo,DepotName,sField:String;
dPrice:Double;
iDepotID: Integer;
Begin
If FEditMode=0 Then Exit;
sField :='';
sField := Trim(LowerCase(dbgSelSendOutDtl.SelectedField.FieldName));
If sField='goodsid' Then
ParseGoodsInfo
Else If sField='price' Then
Begin
dPrice := ViewGoodsPrice(CdsSelSendOutDtlGoodsID.Value, CdsSelSendOutDtlUnit.Value);
If dPrice>=0 Then
Begin
CdsSelSendOutDtl.Edit;
CdsSelSendOutDtlprice.Value := dPrice;
End;
End
else if sField='depotno'then
begin
iDepotID := CdsSelSendOutDtlDepotID.Value;
If SelectDepot(iDepotID,DepotNo,DepotName) Then
Begin
CdsSelSendOutDtl.Edit;
CdsSelSendOutDtlDepotID.Value := iDepotID;
CdsSelSendOutDtlDepotNo.Value := DepotNo;
CdsSelSendOutDtlDepotName.Value := DepotName;
End;
end;
End;
procedure TFmSelSendOut.CdsSelSendOutDtlGoodsIDChange(Sender: TField);
{Var
LogText,Flag,sGoodsID,sSetFields,sCustNo:String;
Begin
IF FEditMode=0 Then Exit;
IF FlagGoodsID<>'' Then Begin
FlagGoodsID:='';
Exit;
End;
// If bBrowGoods then Exit;
sGoodsID:=CdsSelSendOutDtlGoodsID.AsString;
If sGoodsID='' Then Exit;
if (BeforeGoodsID=sGoodsID) Then Exit;
BeforeGoodsID:=sGoodsID;
sSetFields:= 'Name,Specs,Unit';
sCustNo := CdsSelSendOutCustNo.Value;
FlagGoodsID:=GetGoodsInfo(CdsSelSendOutDtl,'Price',sGoodsID,sSetFields,sCustNo,'S',1);
If FlagGoodsID='' Then Begin
Messagebox(Handle,'无效药品编号',nil,16);
Abort;
End Else Begin
If sGoodsID<>FlagGoodsID then
CdsSelSendOutDtl.FieldByName('GoodsID').AsString:=FlagGoodsID
Else
FlagGoodsID:='';
End;}
begin
ParseGoodsInfo;
End;
procedure TFmSelSendOut.CdsSelSendOutEmpNoChange(Sender: TField);
Var
sEmpNo,sEmpName,LogText:String;
begin
IF FEditMode=0 Then Exit;
sEmpNo:=CdsSelSendOutEmpNo.Value;
If sEmpNo='' Then Exit;
if sEmpNo=BeforeEmpNo Then Exit;
BeforeEmpNo:=sEmpNO;
sEmpName:=VarToStr(SvrCommon.AppServer.GetEmpInfo(iClientID,sEmpNo,1,'Name',LogText));
CdsSelSendOutEmpName.Value:=sEmpName;
If LogText<>'' Then Begin
Messagebox(Handle,Pchar(LogText),'错误',16);
Abort;
End;
end;
procedure TFmSelSendOut.CdsSelSendOutCustNoChange(Sender: TField);
Var
sCustNo,sCustName,LogText:String;
begin
IF FEditMode=0 Then Exit;
sCustNo:=CdsSelSendOutCustNo.Value;
If sCustNo='' Then Exit;
if sCustNo=BeforeCustNo Then Exit;
BeforeCustNo:=sCustNo;
sCustName:=VarToStr(SvrCommon.AppServer.GetCustInfo(iClientID,sCustNo,1,'CustName',LogText));
CdsSelSendOutCustName.Value:=sCustName;
cdsSelSendOutLinkman.Clear;
If LogText<>'' Then Begin
Messagebox(Handle,Pchar(LogText),'错误',16);
Abort;
End;
end;
procedure TFmSelSendOut.CdsSelSendOutDtlDepotNoChange(Sender: TField);
Var
sDepotNo,LogText:String;
A:Variant;
begin
Try
IF FEditMode=0 Then Exit;
sDepotNo:=CdsSelSendOutDtlDepotNo.Value;
If sDepotNo='' Then Exit;
if sDepotNo=BeforeDepotNo Then Exit;
BeforeDepotNo:=sDepotNo;
A := SvrCommon.AppServer.GetDepotInfo(iClientID,sDepotNo,2,'DepotID,DepotName',LogText);
CdsSelSendOutDtlDepotID.Value := A[0];
CdsSelSendOutDtlDepotName.Value:= A[1];
If LogText<>'' Then Begin
Messagebox(Handle,Pchar('无效的仓库编号...'),'错误',16);
Abort;
End;
Except
Messagebox(Handle,Pchar('无效的仓库编号...'),'错误',16);
Abort;
End;
end;
procedure TFmSelSendOut.ActAuditExecute(Sender: TObject);
Var
sBillNo, MatchBillNo,sBranchMachine,Str: String;
iBranchID,iMachineID,iPos : Integer;
sSysInfo : Variant;
begin
Try
If CdsSelSendOut.IsEmpty Then Exit;
If FEditMode>0 then Exit;
Inherited;
If Application.MessageBox('确实要审核当前数据吗?','提示',4+32)<>6 Then Exit;
str := 'CurrMonth';
sSysInfo := SvrCommon.AppServer.GetSysInfo(iClientID,Str,1);
If Not(VarIsNull(sSysInfo)) Then Begin
If CdsSelSendOutFDate.Value<VarToDateTime(sSysInfo) Then Begin
Messagebox(Handle,Pchar('该月已结算,不能操作已月结的单据!'),'错误',16);
Exit;
End;
End Else Begin
Messagebox(Handle,Pchar('请先设置开帐日期...'),'错误',16);
Exit;
End;
sBillNo := CdsSelSendOutBillNo.AsString;
If sBillNo='' then Exit;
iBranchID := (Application.MainForm as iMainForm).IFmMainEx.GetLocSetting^.BranchNo;
iMachineId := (Application.MainForm as iMainForm).IFmMainEx.GetLocSetting^.MachineNo;
sBranchMachine := FormatFloat('000',iBranchID)+FormatFloat('00',iMachineID);
If Application.MessageBox('[审核]会将出库通知单转成药品出库单,确实要审核吗?', '消息', MB_YESNO+MB_ICONQUESTION)=IDNO then
Exit;
IF SvrSelSendOut.AppServer.BillTurn(iClientID,'SelSendOut','StockOut',sBillNo,sBranchMachine,MatchBillNo) Then
Begin
ActAudit.Enabled:=False and CanAudit;
ActRevert.Enabled:=True and CanRevert;
Lab_State.Caption:='单据状态:已审核';
Lab_State.Font.Color:=clRed;
ActRefreshExecute(NIL);
str := sBillNo+'号出库通知单已成功转出到['+MatchBillNo+']号药品出库单,要查看该单据吗?';
If Application.MessageBox(PChar(str), '消息', MB_YESNO+MB_ICONINFORMATION)=IDYES then Begin
IFmMain.DoSome(ActAudit.ModuleFile, 'ViewBill', MatchBillNo);
End;
end Else
Messagebox(Handle,Pchar('[审核]数据不成功!'),'错误',16)
Except
On E:Exception Do
Messagebox(Handle,Pchar(E.Message),'错误',16);
End;
end;
procedure TFmSelSendOut.ActRevertExecute(Sender: TObject);
Var BillNo : String;
Begin
Try
If CdsSelSendOut.IsEmpty Then Exit;
If FEditMode>0 then Exit;
inherited;
If Application.MessageBox('确实要还原当前已审核过的数据吗?','提示',4+32)<>6 Then Exit;
BillNo := CdsSelSendOutBillNo.Value;
If Not(SvrSelSendOut.AppServer.BillRevert(iClientID,'SelSendOut',BillNo,'')) Then Begin
Messagebox(Handle,Pchar('还原数据不成功!'),'错误',16);
End Else Begin
ActAudit.Enabled:=True and CanAudit;
ActRevert.Enabled:=False and CanRevert;
Lab_State.Caption:='单据状态:未审核';
Lab_State.Font.Color:=clHotLight;
ActRefreshExecute(Nil);
End;
Except
On E:Exception Do
Messagebox(Handle,Pchar(E.Message),'错误',16);
End;
End;
procedure TFmSelSendOut.ActFieldLayoutExecute(Sender: TObject);
begin
SetFieldsLayOut(LocSetting^.FieldLayoutCfgFile, Name,
[dbgSelSendOutDtl],'入库通知单明细');
end;
procedure TFmSelSendOut.ActDataExportExecute(Sender: TObject);
begin
ExportData([CdsSelSendOut, CdsSelSendOutDtl],'入库通知单;入库通知单明细', '');
end;
function TFmSelSendOut.DoSome(cType: PChar; Values: Variant): Variant;
const
cTypes = 'viewbill'#13'query';
// 查看某单 查询
var sTypes: TStrings;
i, k: integer;
str, str2: String;
begin
sTypes := TStringList.Create;
sTypes.Text := cTypes;
i := sTypes.IndexOf(cType);
case i of
0: begin//ViewBill
if VarIsArray(Values) then begin
str := Values[0];
str2:= Values[1];
end else begin
str := Values;
str2:= '';
end;
if str2='' then begin
if sBillNoList.IndexOf(str)<0 then
sBillNoList.Add(str);
end else
sBillNoList.Text := str2;
self.BringToFront;
SetCurrBillNo(str);
end;
end;
end;
procedure TFmSelSendOut.RzDBButtonEdit2ButtonClick(Sender: TObject);
Var
sCustNo,sLinkMan : String;
begin
If FEditMode=0 Then Exit;
If DBEdit7.Text='' Then Begin
MessageBox(Handle,Pchar('请先指定客户单位!'),'错误:',16);
Exit;
End;
sCustNo := CdsSelSendOutCustNo.Value;
If SelectCustLinkMan(sCustNo,sLinkMan) Then
CdsSelSendOutLinkMan.Value := sLinkMan ;
end;
procedure TFmSelSendOut.ActQueryExecute(Sender: TObject);
begin
IFmMain.OnAction(Sender);
end;
procedure TFmSelSendOut.ParseGoodsInfo;
var
sCustNo,sGoodsID,sUnit:string;
dPrice:Double;
b1: Boolean;
begin
if FEditMode=0 then Exit;
if bBrowGoods then Exit;
bBrowGoods := true;
try
b1:=SelectGoods(CdsSelSendOutDtl, CdsSelSendOutDtlGoodsID, CdsSelSendOutDtlUnit, true, False, False);
if not b1 then abort;
sGoodsID := CdsSelSendOutDtlGoodsID.Value;
sCustNo := CdsSelSendOutCustNo.Value;
sUnit := CdsSelSendOutDtlUnit.Value;
if (sGoodsID<>'') And (sUnit<>'') Then Begin
dPrice := SvrCommon.AppServer.GetGoodsPrice(IClientID,'S',sCustNo,sGoodsID,sUnit);
if dPrice<>0 Then
CdsSelSendOutDtlPrice.Value := dPrice;
End;
finally
bBrowGoods := false;
end;
end;
Initialization
RegisterClass(TFmSelSendOut);
Finalization
RegisterClass(TFmSelSendOut);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -