⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uremoveoutput.~pas

📁 天涯進銷存系統
💻 ~PAS
📖 第 1 页 / 共 3 页
字号:
end;

procedure TfrmRemoveOutPut.LBEditButton2Click(Sender: TObject);
begin
  if not isStateEdit then Exit;
  GetXoY(LBEditButton2);
  if BillHandData.Fieldbyname('BillDate').asDateTime>0 then
    sDate:=BillHandData.Fieldbyname('BillDate').asDateTime
  else
    sDate:=Date;
  SelectDate;
  BillHandData.Edit;
  BillHandData.FieldByName('BillDate').AsDateTime:=SDate;
end;

procedure TfrmRemoveOutPut.PartCodeDBEditKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if KEY=VK_INSERT then
  begin
    BillAddPart(BillBodyData);
    PartCodeDBEditDblClick(Nil);
  end;
  if Key=VK_DELETE then  BillDeletePart(BillHandData, BillBodyData);
  if (key=VK_F2) then PartCodeDBEditDblClick(Nil);
  if key=13 then
  begin
    DBCtrlGrid.SetFocus;
    PartNameDBEdit.SetFocus;
  end;
  BillKeyDown(Key, BillBodyData, 15);
end;

procedure TfrmRemoveOutPut.PartNameDBEditKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  if KEY=VK_INSERT then
  begin
    BillAddPart(BillBodyData);
    PartCodeDBEditDblClick(Nil);
  end;
  if Key=VK_DELETE then  BillDeletePart(BillHandData, BillBodyData);
  if (key=VK_F2) then PartCodeDBEditDblClick(Nil);
  if key=13 then
  begin
    DBCtrlGrid.SetFocus;
    ProducingDBEdit.SetFocus;
  end;  
  BillKeyDown(Key, BillBodyData, 15);
end;

procedure TfrmRemoveOutPut.ProducingDBEditKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  if key=13 then
  begin
    DBCtrlGrid.SetFocus;
    UnitDBEdit.SetFocus;
  end;
  BillKeyDown(Key, BillBodyData, 15);
end;

procedure TfrmRemoveOutPut.UnitDBEditKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key=13 then
  begin
    DBCtrlGrid.SetFocus;
    DepotPlaceDBEdit.SetFocus;
  end;  
  BillKeyDown(Key, BillBodyData, 15);
end;

procedure TfrmRemoveOutPut.DepotPlaceDBEditKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  if key=13 then
  begin
    DBCtrlGrid.SetFocus;
    QuantityDBEdit.SetFocus;
  end;
  BillKeyDown(Key, BillBodyData, 15);
end;

procedure TfrmRemoveOutPut.QuantityDBEditKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  if key=13 then
  begin
    DBCtrlGrid.SetFocus;
    PriceDBEdit.SetFocus;
  end;
  BillKeyDown(Key, BillBodyData, 15);
end;

procedure TfrmRemoveOutPut.PriceDBEditKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key=13 then
  begin
    DBCtrlGrid.SetFocus;
    AgioDBEdit.SetFocus;
  end;
  BillKeyDown(Key, BillBodyData, 15);
end;

procedure TfrmRemoveOutPut.AgioDBEditKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key=13 then
  begin
    DBCtrlGrid.SetFocus;
    CessDBEdit.SetFocus;
  end;
  BillKeyDown(Key, BillBodyData, 15);
end;

procedure TfrmRemoveOutPut.CessDBEditKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  BillKeyDown(Key, BillBodyData, 15);
  if key=13 then
  begin
    DBCtrlGrid.SetFocus;
    if BillBodyData.Fieldbyname('PartCode').asstring='' then
    begin
      PartCodeDBEdit.SetFocus;
      Exit;
    end;
    if not isStateEdit then
    begin
      if BillBodyData.RecordCount>BillBodyData.RecNo then
        BillBodyData.Next;
      PartCodeDBEdit.SetFocus;
      Exit;
    end;
    BillBodyData.Next;
    PartCodeDBEdit.SetFocus;
    if BillBodyData.Eof then
    begin
      BillBodyData.Append;
      BillBodyData.Fieldbyname('BillCode').asstring:='新单据';
      BillBodyData.Fieldbyname('ID').asinteger:=BillBodyData.RecordCount+1;
      BillBodyData.Post;
    end;
  end;
end;

procedure TfrmRemoveOutPut.QuantityDBEditExit(Sender: TObject);
begin
  if not isStateEdit then Exit;
  if Trim(QuantityDBEdit.Text)='' then QuantityDBEdit.Text:='0';
  OpenData('select PartCode, BillQuantity From StockPart where PartCode='+
           #39+Trim(PartCodeDBEdit.Text)+#39+' and DepotCode='+
           #39+BillHandData.Fieldbyname('DepotCode').asstring+#39, dmData.sdsPublic);
  if dmData.sdsPublic.FieldByName('BillQuantity').asfloat<StrTOFloat(QuantityDBEdit.Text) then
    if Application.MessageBox('库存数量不足,是否继续?',Hintinfo,$24)=idNo then
    begin
      BillBodyData.Edit;
      BillBodyData.FieldByName('Quantity').asfloat:=OldSaleQty;
      BillBodyData.Post;
    end;
  if isStateEdit then  GetSum;
end;

procedure TfrmRemoveOutPut.AgioDBEditExit(Sender: TObject);
begin
  if isStateEdit then
  begin
    if Trim(AgioDBEdit.Text)='' then
    begin
      BillBodyData.Edit;
      BillBodyData.Fieldbyname('Agio').asfloat:=0;
    end;
    if (StrToFloat(AgioDBEdit.Text)>=10)or(StrToFloat(AgioDBEdit.Text)<0) then
    begin
      Application.MessageBox('折扣率只能是小于“10”和大于“0”之间的数字。',Hintinfo,$30);
      BillBodyData.Edit;
      BillBodyData.Fieldbyname('Agio').asfloat:=0;
    end;
    GetSum;
  end;
end;

procedure TfrmRemoveOutPut.CessDBEditExit(Sender: TObject);
begin
  if isStateEdit then
  begin
    if Trim(CessDBEdit.Text)='' then
    begin
      BillBodyData.Edit;
      BillBodyData.Fieldbyname('Cess').asfloat:=0;
    end;
    if StrToFloat(CessDBEdit.Text)<0 then
    begin
      Application.MessageBox('税率只能是大于“0”的数字。',Hintinfo,$30);
      BillBodyData.Edit;
      BillBodyData.Fieldbyname('Cess').asfloat:=0;
    end;
    GetSum;
  end;
end;

procedure TfrmRemoveOutPut.BillNextButtonClick(Sender: TObject);
begin
  if isStateEdit then Exit;
  BillHandData.Next;
  if BillHandData.RecNo=1 then
    BillHandData.Next; 
  if BillHandData.RecordCount=BillHandData.RecNo then
  begin
    if BillHandData.GetNextPacket=0 then
      BillInfoLabel.Caption:='已经是移到第一张单据了!'
    else
      BillInfoLabel.Caption:='';
    BillHandData.Next;
  end
  else
    BillInfoLabel.Caption:='';
end;

procedure TfrmRemoveOutPut.BillPriorButtonClick(Sender: TObject);
begin
  if isStateEdit then Exit;
  BillHandData.Prior;
  if BillHandData.RecNo=1 then
    BillHandData.Prior;
  if BillHandData.Bof then
    BillInfoLabel.Caption:='已经是移到最后一张单据了!'
  else
    BillInfoLabel.Caption:='';
end;

procedure TfrmRemoveOutPut.ORDERMANDBEditKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  if key=13 then  Perform(WM_NEXTDLGCTL,0,0);
end;

procedure TfrmRemoveOutPut.BillDateDBEditKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  if (ssCtrl in Shift) and (Key=13) then
  begin
    LBEditButton2Click(Nil);
    Exit;
  end;
  if key=13 then  Perform(WM_NEXTDLGCTL,0,0);
end;

procedure TfrmRemoveOutPut.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key=27 then Close;
  if not isStateEdit then
  begin
    if key=VK_LEFT then BillNextButtonClick(Sender);
    if key=VK_RIGHT then BillPriorButtonClick(Sender);
  end;   
end;

procedure TfrmRemoveOutPut.DepotDBEditExit(Sender: TObject);
begin
  if not isStateEdit then Exit;
  if (Trim(DepotDBEdit.Text)<>'')
  and (Trim(DepotDBEdit.Text)<> OldFilialeinfoCode) and (isGetList) then
  begin
    BillHandData.Edit;
    TObject(List):=DepotDBEdit.Items.Objects[DepotDBEdit.ItemIndex];
    BillHandData.FieldByName('DepotCode').asstring:=List.Code;
  end;
end;

procedure TfrmRemoveOutPut.DepotDBEditEnter(Sender: TObject);
begin
  if Not isStateEdit then Exit;
  OldDepotCode:=Trim(DepotDBEdit.Text);
  SetIndexListData('select DepotCode, DepotName From Depot', DepotDBEdit, 'DepotCode','DepotName');
  if Not dmData.sdsPublic.IsEmpty then isGetList:=True;
end;


procedure TfrmRemoveOutPut.ORDERMANDBEditEnter(Sender: TObject);
begin
  if not isStateEdit then Exit;
    SetListData('select Name From Employee', ORDERMANDBEdit);
end;

procedure TfrmRemoveOutPut.QuantityDBEditEnter(Sender: TObject);
begin
  if not isStateEdit then Exit;
  if Trim(QuantityDBEdit.Text)='' then QuantityDBEdit.Text:='0';
     OldSaleQty:=StrToFloat(QuantityDBEdit.Text);
end;

procedure TfrmRemoveOutPut.PriceDBEditEnter(Sender: TObject);
begin
  if not isStateEdit then Exit;
  if Trim(PriceDBEdit.Text)='' then PriceDBEdit.Text:='0';
     OldSalePrice:=BillBodyData.Fieldbyname('Price').asFloat;
end;

procedure TfrmRemoveOutPut.PriceDBEditExit(Sender: TObject);
begin
  if not isStateEdit then Exit;
  if Trim(PriceDBEdit.Text)='' then PriceDBEdit.Text:='0';
  OpenData('select Code, CostPrice From Partinfo where Code='+
           #39+Trim(PartCodeDBEdit.Text)+#39, dmData.sdsPublic);
  if dmData.sdsPublic.FieldByName('CostPrice').asfloat>
  BillBodyData.Fieldbyname('Price').asFloat then
    if Application.MessageBox('内部调出价低于成本价,是否继续?',Hintinfo,$24)=idNo then
    begin
      BillBodyData.Edit;
      BillBodyData.FieldByName('Price').asfloat:=OldSalePrice;
      BillBodyData.Post;
    end;  
  if isStateEdit then   GetSum;
end;

procedure TfrmRemoveOutPut.FilialeinfoNameEnter(Sender: TObject);
begin
  if Not isStateEdit then  Exit;
  OldFilialeinfoCode:=Trim(FilialeinfoName.Text);
  SetIndexListData('select FilialeCode, FilialeName From FilialeInfo', FilialeinfoName, 'FilialeCode','FilialeName');
end;

procedure TfrmRemoveOutPut.FilialeinfoNameExit(Sender: TObject);
begin
  if not isStateEdit then Exit;
  if (Trim(FilialeinfoName.Text)<>'')
  and (Trim(FilialeinfoName.Text)<> OldFilialeinfoCode) and
  (FilialeinfoName.Items.Count>0)    then
  begin
    TObject(List):=FilialeinfoName.Items.Objects[FilialeinfoName.ItemIndex];
    BillHandData.Edit;
    BillHandData.FieldByName('ClientCode').asstring:=List.Code;
  end;
end;

procedure TfrmRemoveOutPut.FilialeinfoNameKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  if key=13 then  Perform(WM_NEXTDLGCTL,0,0);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -