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

📄 untpossendbill.pas

📁 适合行业为眼镜业
💻 PAS
📖 第 1 页 / 共 3 页
字号:
unit UntPosSendBill;
/////门店配送收货单 ydy create   2004-4-9
/////4-26 改为stringgrid
interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, Buttons, ComCtrls, Grids, DB, DBClient, DBGrids;

type TSendMaster = record
    vcSendBillId: string;
    VcSourceId: string;
    BillNo: string;
    iBIlltype: integer;
    vcSendStockID: string;   //配送仓库
    vcRecvStockID: string;   //接收门店仓库
    dtDrawDate: TDateTime;
    dtOutStockDate: Tdatetime;
    vcEId: string;        ///经手人
    vcListerId: string;   // 制单人
    vcAssessorId: string;  //审核人
    NSumQty: Double;
    nuCess: Double;
    nuTax: Double;
    nuIncTaxSum: Double;
    nuTotalMoney: Double;
    nuUnTaxSum: Double;
    BillStatus: Integer;
    inVoucherSign: Integer;
    inIsReadSign: Integer;
    vcOutHouseReadBillId: string;
    inByReadSign: Integer;
    vcExplain: string;
    SendStatus: Integer;
    VcSendStockName: string;
    VcRecvStockName: string;
    ObjectID: Integer;
  end;
type
  TFmPosSendBill = class(TForm)
    Panel1: TPanel;
    Panel2: TPanel;
    Panel3: TPanel;
    EdtSendStock: TEdit;
    Label2: TLabel;
    SpeedButton1: TSpeedButton;
    Panel4: TPanel;
    TeThemeButton1: TSpeedButton;
    TeThemeButton2: TSpeedButton;
    sourcebill: TSpeedButton;
    query: TSpeedButton;
    help: TSpeedButton;
    Label1: TLabel;
    EdtRecvStock: TEdit;
    SpeedButton2: TSpeedButton;
    Label3: TLabel;
    EdtM: TEdit;
    Label4: TLabel;
    EdtG: TEdit;
    SpeedButton4: TSpeedButton;
    Label5: TLabel;
    EdtC: TEdit;
    SpeedButton5: TSpeedButton;
    Label6: TLabel;
    EdtMemo: TEdit;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    StaticText1: TStaticText;
    EdtBillNo: TEdit;
    BillTitle: TLabel;
    CdsMasterData: TClientDataSet;
    CdsDetailData: TClientDataSet;
    sgorder: TStringGrid;
    bitcheck: TBitBtn;
    edtpart: TLabeledEdit;
    SpeedButton3: TSpeedButton;
    Panel10: TPanel;
    Cmd_Delete: TSpeedButton;
    Cmd_Add: TSpeedButton;
    procedure BitBtn2Click(Sender: TObject);
    procedure sgorderKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
    procedure SpeedButton4Click(Sender: TObject);
    procedure SpeedButton5Click(Sender: TObject);
    procedure EdtSendStockKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure EdtRecvStockKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure EdtMKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure EdtGKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure EdtCKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure EdtMemoKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure BitBtn1Click(Sender: TObject);
    procedure TeThemeButton1Click(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure sgorderDrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    procedure sgorderDblClick(Sender: TObject);
    procedure sgorderSelectCell(Sender: TObject; ACol, ARow: Integer;
      var CanSelect: Boolean);
    procedure sgorderKeyPress(Sender: TObject; var Key: Char);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure bitcheckClick(Sender: TObject);
    procedure sgorderMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure SpeedButton3Click(Sender: TObject);
    procedure edtpartChange(Sender: TObject);
    procedure Cmd_AddClick(Sender: TObject);
    procedure Cmd_DeleteClick(Sender: TObject);
    procedure sourcebillClick(Sender: TObject);
  private
    { Private declarations }
    SendMaster: TSendMaster;
    sBillId, SEditMode: string;
    sGoodsName: string;
    sUserCode: string;
    zd:boolean;
    ckid:string;
    procedure FormIni;
    procedure SelectGoods(iRow: Integer);
    function CheckData: Boolean;
    function SaveData: Boolean;
    function ReadBill: Boolean;
    procedure SumCol(ACol, ARow: Integer);

  public
    { Public declarations }
     pcol,prow:integer; //记录行列编号
  end;
var
  FmPosSendBill: TFmPosSendBill;
  function ShowFmPosSendbill(sBillId: string; EditMode: string; iBillType: Integer): Integer;
implementation

uses  Unt_PubStrGrid, Data, func, untdatadm, UntgoodCodeSelPei,
  Storage_Select, Supply_Monad, Untpart, Untgoodcodedetail, Login_Man,
  UntSQpspart, UntMsgGoods, Unitreportxf;

{$R *.dfm}

function ShowFmPosSendbill(sBillId: string; EditMode: string; iBillType: Integer): Integer;
begin
  Result := 1;
  FmPosSendBill := TFmPosSendBill.Create(application);
  FmPosSendBill.sBillId := sBillId;
  FmPosSendBill.SEditMode := UpperCase(EditMode);
  FmPosSendBill.SendMaster.iBIlltype := iBillType;
  try
    FmPosSendBill.FormIni;
    FmPosSendBill.ShowModal;
  finally
    FmPosSendBill.Free;
  end;
end;

procedure TFmPosSendBill.BitBtn2Click(Sender: TObject);
begin
  Close;
end;

procedure TFmPosSendBill.sgorderKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin

  if (sgorder.Col = 1) or (sgorder.Col = 2) then
  begin
    if key = VK_RETURN then
    begin
      SelectGoods(sgorder.Row);
      Exit;
    end;
  end;


  if (sgorder.Col = 7) then
  begin
    if key = VK_RETURN then
    begin
      sgorder.Col := 8;
      Exit;
    end;
  end;

  if (sgorder.Col = 7) then
  begin
    SumCol(7, sgorder.Row);
    if key = VK_RETURN then
    begin
      sgorder.Col := 8;
      Exit;
    end;
  end;

  if (sgorder.Col = 8) then
  begin
    SumCol(8, sgorder.Row);
    if key = VK_RETURN then
    begin
      if (Trim(sgorder.Cells[1, sgorder.Row]) <> '') or
        (Trim(sgorder.Cells[2, sgorder.Row]) <> '') then
      begin
        if sgorder.Row = (sgorder.RowCount - 1) then
        begin
          sgorder.RowCount := sgorder.RowCount + 1;
        end;

        sgorder.Col := 1;
        sgorder.Row := sgorder.Row + 1;
        Exit;
      end;
    end;
  end;
  if key = VK_RETURN then
    Key := VK_TAB;

end;

procedure TFmPosSendBill.FormIni;
var
  iRow: Integer;
  temp,make:string;
begin
  EdtSendStock.Text := '';
  EdtRecvStock.Text := '';
  EdtM.Text := trim(Handle_Man);
  EdtG.Text := '';
  EdtC.Text := '';
  EdtMemo.Text := '';
  ckid:=shopid ;
  if sbillid='' then
  begin
    temp:='select max(right(billno,4)) from SendMasterTable where dtDrawDate='+''''+formatdatetime('yyyy''-''mm''-''dd',date)+'''';
    make:='PS-'+trim(Handle_Part)+trim(handle_no); //编码中部门编号
    edtbillno.Text:=setcode(temp,make);
     sgorder.RowCount := 2;
  for iRow := 1 to sgorder.RowCount do
    sgorder.Rows[irow].Clear;
    sgorder.Cells[0, iRow] := IntToStr(iRow);
  end else
  begin
    ReadBill;
  end;
  zd:=false;
  InitialStrGrid(sgorder,'配送收货单');
  CdsMasterData.Close;
  CdsMasterData.Data :=null;
  temp:= 'Select * from SendMasterTable where 1=2';
  CdsMasterData.Data:=adisp.PubBatch(temp);
  CdsMasterData.Open;
  temp:='Select * from SendDetailTable where 1=2';
  CdsDetailData.Close;
  CdsDetailData.Data:=null;
  CdsDetailData.Data:=adisp.PubBatch(temp);
  CdsDetailData.Open;
  if SendMaster.iBIlltype = 501 then
  begin
//    FmPosSendBill.Caption := '同价配送单';
    BillTitle.Caption := '同价配送单收货单';
  end;
{
  if SendMaster.iBIlltype = 502 then
  begin
    FmPosSendBill.Caption := '变价配送单';
    BillTitle.Caption := '变价配送单';
  end;
  if SEditMode <> '' then
    ReadBill;
}
end;


procedure TFmPosSendBill.SpeedButton1Click(Sender: TObject);
var
  sStockID, sStockName: string;
begin
//选择中心仓库
  sStockID := '';
  sStockName := '';
  Check_Storage:='';
  Check_Storage_Result:='';
  Check_Storage:='Storage_Umanage_Fad';
  frm_Storage_Select:=Tfrm_Storage_Select.Create(self);
  frm_Storage_Select.ShowModal;
  sStockName:=Trim(Check_Storage_Result);
  sStockID:=Check_Storage_Result_NO;
  frm_Storage_Select.Free;
  EdtSendStock.Text:= sStockName;
  SendMaster.vcSendStockID := sStockID;
  SendMaster.VcSendStockName := sStockName;
  if not zd then
  begin
  ckid:=shopid;
  shopid:= sStockID;
  end;
  Perform(WM_NEXTDLGCTL, 0, 0);
end;

procedure TFmPosSendBill.SpeedButton2Click(Sender: TObject);
var
  sStockID, sStockName: string;
begin
//选择门店仓库
  sStockID := '';
  sStockName := '';
  Check_Storage:='';
  Check_Storage_Result:='';
  Check_Storage:='Storage_Umanage_Fad';
  frm_Storage_Select:=Tfrm_Storage_Select.Create(self);
  frm_Storage_Select.ShowModal;
  sStockName:=Trim(Check_Storage_Result);
  sStockID:=Check_Storage_Result_NO;
  frm_Storage_Select.Free;
  EdtRecvStock.Text:= sStockName;
  SendMaster.vcRecvStockID := sStockID;
  SendMaster.VcRecvStockName := sStockName;
  SendMaster.ObjectID := 1;
  Perform(WM_NEXTDLGCTL, 0, 0);
end;

procedure TFmPosSendBill.SpeedButton4Click(Sender: TObject);
begin
//选择人员
  Employe_Check:='';
  Employe_Check:='Storage_Umanage_Fad';
  Employe_Check_Result:='';
  frm_Login_Man:=Tfrm_Login_Man.Create(self);

⌨️ 快捷键说明

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